Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changeset/fix-tags-input-overflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@

- **TagsInput**: Fix overflow issue where very long tags would overflow the
container instead of truncating with ellipsis.

- **CheckboxGroup**: Fix type issue where `CheckboxGroupProps` could not be
passed to the `CheckboxGroup` component.
19 changes: 19 additions & 0 deletions .changeset/improve-outline-border-visibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@chakra-ui/react": minor
"@chakra-ui/panda-preset": minor
---

### Added

- **Semantic Tokens**: Add new `border` semantic token to all color palettes
(`gray.300`/`gray.700` for gray, `color.500`/`color.400` for colored palettes)
to improve outline component appearance

### Changed

- **Button, Badge, Tag, Checkbox**: Update outline variants to use
`colorPalette.border` instead of `colorPalette.muted` or global `border` token
for better appearance, especially for non-gray color palettes.

> **NOTE**: All changes include CSS variable fallbacks to `colorPalette.muted`
> for backward compatibility.
37 changes: 37 additions & 0 deletions apps/compositions/src/examples/drawer-non-modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Button, CloseButton, Drawer, Portal } from "@chakra-ui/react"

export const DrawerNonModal = () => {
return (
<Drawer.Root closeOnInteractOutside={false} modal={false}>
<Drawer.Trigger asChild>
<Button variant="outline" size="sm">
Open Drawer
</Button>
</Drawer.Trigger>
<Portal>
<Drawer.Positioner pointerEvents="none">
<Drawer.Content>
<Drawer.Header>
<Drawer.Title>Drawer Title</Drawer.Title>
</Drawer.Header>
<Drawer.Body>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
</Drawer.Body>
<Drawer.Footer>
<Drawer.ActionTrigger asChild>
<Button variant="outline">Cancel</Button>
</Drawer.ActionTrigger>
<Button>Save</Button>
</Drawer.Footer>
<Drawer.CloseTrigger asChild>
<CloseButton size="sm" />
</Drawer.CloseTrigger>
</Drawer.Content>
</Drawer.Positioner>
</Portal>
</Drawer.Root>
)
}
11 changes: 11 additions & 0 deletions apps/www/content/docs/components/drawer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ corresponding sizes. For example:

<ExampleTabs name="drawer-with-conditional-variants" />

### Non-Modal Drawer

We don't recommend using a non-modal drawer due to the accessibility concerns
they present. In event you need it, here's what you can do:

- set the `modal` prop to `false`
- set `pointerEvents` to `none` on the `Drawer.Positioner` component
- (optional)set the `closeOnInteractOutside` prop to `false`

<ExampleTabs name="drawer-non-modal" />

## Props

### Root
Expand Down
11 changes: 10 additions & 1 deletion apps/www/public/r/examples/drawer.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
"import {\n Button,\n CloseButton,\n Drawer,\n For,\n HStack,\n Kbd,\n Portal,\n} from \"@chakra-ui/react\""
],
"importPath": "import { Drawer } from \"@chakra-ui/react\""
},
{
"name": "drawer-non-modal",
"content": "export const DrawerNonModal = () => {\n return (\n <Drawer.Root closeOnInteractOutside={false} modal={false}>\n <Drawer.Trigger asChild>\n <Button variant=\"outline\" size=\"sm\">\n Open Drawer\n </Button>\n </Drawer.Trigger>\n <Portal>\n <Drawer.Positioner pointerEvents=\"none\">\n <Drawer.Content>\n <Drawer.Header>\n <Drawer.Title>Drawer Title</Drawer.Title>\n </Drawer.Header>\n <Drawer.Body>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do\n eiusmod tempor incididunt ut labore et dolore magna aliqua.\n </p>\n </Drawer.Body>\n <Drawer.Footer>\n <Drawer.ActionTrigger asChild>\n <Button variant=\"outline\">Cancel</Button>\n </Drawer.ActionTrigger>\n <Button>Save</Button>\n </Drawer.Footer>\n <Drawer.CloseTrigger asChild>\n <CloseButton size=\"sm\" />\n </Drawer.CloseTrigger>\n </Drawer.Content>\n </Drawer.Positioner>\n </Portal>\n </Drawer.Root>\n )\n}\n",
"hasSnippet": false,
"importPaths": [
"import { Button, CloseButton, Drawer, Portal } from \"@chakra-ui/react\""
],
"importPath": "import { Drawer } from \"@chakra-ui/react\""
}
]
}
}
1 change: 1 addition & 0 deletions apps/www/public/r/examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
"drawer-with-offset",
"drawer-with-placement",
"drawer-with-sizes",
"drawer-non-modal",
"editable-basic",
"editable-controlled",
"editable-disabled",
Expand Down
4 changes: 3 additions & 1 deletion packages/panda-preset/src/recipes/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export const badgeRecipe = defineRecipe({
},
outline: {
color: "colorPalette.fg",
"--outline-shadow-legacy": "colors.colorPalette.muted",
"--outline-shadow": "colors.colorPalette.border",
shadow: "inset 0 0 0px 1px var(--shadow-color)",
shadowColor: "colorPalette.muted",
shadowColor: "var(--outline-shadow, var(--outline-shadow-legacy))",
},
surface: {
bg: "colorPalette.subtle",
Expand Down
4 changes: 3 additions & 1 deletion packages/panda-preset/src/recipes/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ export const buttonRecipe = defineRecipe({
},
outline: {
borderWidth: "1px",
borderColor: "colorPalette.muted",
"--outline-color-legacy": "colors.colorPalette.muted",
"--outline-color": "colors.colorPalette.border",
borderColor: "var(--outline-color, var(--outline-color-legacy))",
color: "colorPalette.fg",
_hover: {
bg: "colorPalette.subtle",
Expand Down
4 changes: 3 additions & 1 deletion packages/panda-preset/src/recipes/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ export const codeRecipe = defineRecipe({
},
outline: {
color: "colorPalette.fg",
"--outline-shadow-legacy": "colors.colorPalette.muted",
"--outline-shadow": "colors.colorPalette.border",
shadow: "inset 0 0 0px 1px var(--shadow-color)",
shadowColor: "colorPalette.muted",
shadowColor: "var(--outline-shadow, var(--outline-shadow-legacy))",
},
surface: {
bg: "colorPalette.subtle",
Expand Down
60 changes: 60 additions & 0 deletions packages/panda-preset/src/semantic-tokens/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.gray.400}",
},
},
border: {
value: {
_light: "{colors.gray.200}",
_dark: "{colors.gray.800}",
},
},
},
red: {
contrast: {
Expand Down Expand Up @@ -256,6 +262,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.red.500}",
},
},
border: {
value: {
_light: "{colors.red.500}",
_dark: "{colors.red.400}",
},
},
},
orange: {
contrast: {
Expand Down Expand Up @@ -300,6 +312,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.orange.500}",
},
},
border: {
value: {
_light: "{colors.orange.500}",
_dark: "{colors.orange.400}",
},
},
},
green: {
contrast: {
Expand Down Expand Up @@ -344,6 +362,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.green.500}",
},
},
border: {
value: {
_light: "{colors.green.500}",
_dark: "{colors.green.400}",
},
},
},
blue: {
contrast: {
Expand Down Expand Up @@ -388,6 +412,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.blue.500}",
},
},
border: {
value: {
_light: "{colors.blue.500}",
_dark: "{colors.blue.400}",
},
},
},
yellow: {
contrast: {
Expand Down Expand Up @@ -432,6 +462,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.yellow.500}",
},
},
border: {
value: {
_light: "{colors.yellow.500}",
_dark: "{colors.yellow.500}",
},
},
},
teal: {
contrast: {
Expand Down Expand Up @@ -476,6 +512,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.teal.500}",
},
},
border: {
value: {
_light: "{colors.teal.500}",
_dark: "{colors.teal.400}",
},
},
},
purple: {
contrast: {
Expand Down Expand Up @@ -520,6 +562,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.purple.500}",
},
},
border: {
value: {
_light: "{colors.purple.500}",
_dark: "{colors.purple.400}",
},
},
},
pink: {
contrast: {
Expand Down Expand Up @@ -564,6 +612,12 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.pink.500}",
},
},
border: {
value: {
_light: "{colors.pink.500}",
_dark: "{colors.pink.400}",
},
},
},
cyan: {
contrast: {
Expand Down Expand Up @@ -608,5 +662,11 @@ export const colors = defineSemanticTokens.colors({
_dark: "{colors.cyan.500}",
},
},
border: {
value: {
_light: "{colors.cyan.500}",
_dark: "{colors.cyan.400}",
},
},
},
})
4 changes: 3 additions & 1 deletion packages/panda-preset/src/slot-recipes/alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export const alertSlotRecipe = defineSlotRecipe({
root: {
color: "colorPalette.fg",
shadow: "inset 0 0 0px 1px var(--shadow-color)",
shadowColor: "colorPalette.muted",
"--outline-shadow-legacy": "colors.colorPalette.muted",
"--outline-shadow": "colors.colorPalette.border",
shadowColor: "var(--outline-shadow, var(--outline-shadow-legacy))",
},
indicator: {
color: "colorPalette.fg",
Expand Down
4 changes: 3 additions & 1 deletion packages/panda-preset/src/slot-recipes/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export const avatarSlotRecipe = defineSlotRecipe({
root: {
color: "colorPalette.fg",
borderWidth: "1px",
borderColor: "colorPalette.muted",
"--outline-shadow-legacy": "colors.colorPalette.muted",
"--outline-shadow": "colors.colorPalette.border",
borderColor: "var(--outline-shadow, var(--outline-shadow-legacy))",
},
},
},
Expand Down
63 changes: 36 additions & 27 deletions packages/panda-preset/src/slot-recipes/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,63 @@ export const carouselSlotRecipe = defineSlotRecipe({
"itemGroup",
"item",
"control",
"prevTrigger",
"nextTrigger",
"autoplayTrigger",
"prevTrigger",
"indicatorGroup",
"indicator",
"autoplayTrigger",
],
base: {
root: {
position: "relative",
overflow: "hidden",
"--carousel-spacing": "spacing.4",
},
itemGroup: {
display: "flex",
transition: "transform 0.3s ease-in-out",
gap: "2",
_horizontal: {
flexDirection: "column",
},
_vertical: {
flexDirection: "row",
},
},
item: {
minWidth: "0",
flex: "0 0 auto",
width: "full",
_horizontal: {
width: "100%",
},
_vertical: {
height: "100%",
},
},
control: {
position: "absolute",
top: "50%",
left: 0,
width: "100%",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
transform: "translateY(-50%)",
px: "var(--carousel-spacing)",
zIndex: 2,
_horizontal: {
flexDirection: "row",
width: "100%",
},
_vertical: {
flexDirection: "column",
height: "100%",
},
},
indicatorGroup: {
display: "flex",
justifyContent: "center",
gap: "2",
mt: "var(--carousel-spacing)",
gap: "3",
_horizontal: {
flexDirection: "row",
},
_vertical: {
flexDirection: "column",
},
},
indicator: {
width: "3",
height: "3",
width: "2.5",
height: "2.5",
borderRadius: "full",
bg: "bg.muted",
cursor: "pointer",
transition: "all 0.2s",
"&[data-current]": {
bg: "fg",
bg: "colorPalette.subtle",
cursor: "button",
_current: {
bg: "colorPalette.solid",
},
},
},
Expand Down
4 changes: 3 additions & 1 deletion packages/panda-preset/src/slot-recipes/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ export const tagSlotRecipe = defineSlotRecipe({
outline: {
root: {
color: "colorPalette.fg",
"--outline-shadow-legacy": "colors.colorPalette.muted",
"--outline-shadow": "colors.colorPalette.border",
shadow: "inset 0 0 0px 1px var(--shadow-color)",
shadowColor: "colorPalette.muted",
shadowColor: "var(--outline-shadow, var(--outline-shadow-legacy))",
},
},
surface: {
Expand Down
Loading