Skip to content

Commit

Permalink
Merge branch 'main' into feat/breadcrumb-ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
hirotomoyamada committed Apr 28, 2024
2 parents 8d01318 + 169a760 commit d5f9ce4
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-buckets-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yamada-ui/utils": minor
---

Added `isBoolean` function.
5 changes: 5 additions & 0 deletions .changeset/ten-hotels-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yamada-ui/core": patch
---

Fixed a bug where TextStyles and LayerStyles have more types than necessary.
5 changes: 5 additions & 0 deletions .changeset/twenty-tips-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yamada-ui/calendar": patch
---

Fixed to set `display: none` on button if a custom component is not displayed element (e.g. null, undefined, boolean) in order to address a11y violations.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Please read the following before submitting:
- PRs that adds new external dependencies might take a while to review.
- Keep your PR as small as possible.
- Limit your PR to one type (docs, feature, refactoring, ci, or bugfix)
- If a PR is not merged within one week of its creation, core members may intervene.
- If a PR is not merged within one week of its creation, maintainers may intervene.
-->

Closes # <!-- Github issue # here -->
Expand Down
36 changes: 25 additions & 11 deletions packages/components/calendar/src/month.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import type { ButtonProps } from "@yamada-ui/button"
import { Button } from "@yamada-ui/button"
import type { HTMLUIProps } from "@yamada-ui/core"
import { ui } from "@yamada-ui/core"
import { cx, dataAttr, filterUndefined } from "@yamada-ui/utils"
import {
cx,
dataAttr,
filterUndefined,
isBoolean,
isNull,
isUndefined,
} from "@yamada-ui/utils"
import dayjs from "dayjs"
import type { FC } from "react"
import { useMemo } from "react"
Expand Down Expand Up @@ -188,6 +195,19 @@ export const Month: FC<MonthProps> = ({
index,
})

const day = customDay({
date,
row,
col,
weekday: weekdays[col],
isSelected,
isWeekend,
isOutside,
})

const isDisplayed =
!isNull(day) && !isUndefined(day) && !isBoolean(day)

return (
<ui.td
key={col}
Expand All @@ -206,20 +226,14 @@ export const Month: FC<MonthProps> = ({
p: 0,
fontSize: undefined,
fontWeight: "normal",
...(isHidden ? { display: "none" } : {}),
...(isHidden || !isDisplayed
? { display: "none" }
: {}),
...styles.day,
}}
{...props}
>
{customDay({
date,
row,
col,
weekday: weekdays[col],
isSelected,
isWeekend,
isOutside,
})}
{day}
</Button>
</ui.td>
)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/theme.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ export type ThemeConfig = {
}
}

export type LayerStyles = Record<string, UIStyle>
export type TextStyles = Record<string, UIStyle>
export type LayerStyles = Record<string, CSSUIObject>
export type TextStyles = Record<string, CSSUIObject>
export type ThemeTokens = {
[key: string | number]:
| string
Expand Down
3 changes: 3 additions & 0 deletions packages/utils/src/assertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export const isNumeric = (value: any): boolean =>
export const isString = (value: any): value is string =>
Object.prototype.toString.call(value) === "[object String]"

export const isBoolean = (value: any): value is boolean =>
typeof value === "boolean"

export const isUndefined = (value: any): value is undefined =>
typeof value === "undefined" && value === undefined

Expand Down
2 changes: 1 addition & 1 deletion scripts/observe-pull-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const GITHUB_JOINING_COMMENT = (id: string) =>
[
`@${id}`,
`Hi, Thanks for the PR!`,
`A week has passed since this PR was created, so core members will be joining this PR.`,
`A week has passed since this PR was created, so maintainers will be joining this PR.`,
].join("\n\n")
const DISCORD_HELP_WANTED_COMMENT = (
number: number,
Expand Down
2 changes: 2 additions & 0 deletions stories/components/overlay/menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const withCommand: Story = () => {
<MenuButton
as={IconButton}
icon={<Icon icon={faBars} />}
aria-label="Menu"
variant="outline"
/>

Expand All @@ -76,6 +77,7 @@ export const withIcon: Story = () => {
<MenuButton
as={IconButton}
icon={<Icon icon={faBars} />}
aria-label="Menu"
variant="outline"
/>

Expand Down

0 comments on commit d5f9ce4

Please sign in to comment.