@42-central/ui-react 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
- package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
- package/dist/{chunk-NLSJ6T7V.js → chunk-4D2V4JE4.js} +3 -3
- package/dist/{chunk-NLSJ6T7V.js.map → chunk-4D2V4JE4.js.map} +1 -1
- package/dist/{chunk-QZ4N5LYG.js → chunk-5H5YOPCF.js} +3 -3
- package/dist/{chunk-QZ4N5LYG.js.map → chunk-5H5YOPCF.js.map} +1 -1
- package/dist/{chunk-6II2DVYR.js → chunk-7KFUFAVP.js} +4 -4
- package/dist/{chunk-6II2DVYR.js.map → chunk-7KFUFAVP.js.map} +1 -1
- package/dist/{chunk-XUFCI262.js → chunk-7OGZT7U2.js} +12 -4
- package/dist/chunk-7OGZT7U2.js.map +1 -0
- package/dist/{chunk-PI7X5YFJ.js → chunk-BGDVUC3B.js} +5 -5
- package/dist/{chunk-PI7X5YFJ.js.map → chunk-BGDVUC3B.js.map} +1 -1
- package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
- package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
- package/dist/{chunk-FZSLSUSX.js → chunk-HCHGERDB.js} +3 -3
- package/dist/{chunk-FZSLSUSX.js.map → chunk-HCHGERDB.js.map} +1 -1
- package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
- package/dist/chunk-HWBFRDX7.js.map +1 -0
- package/dist/{chunk-HQPU73WV.js → chunk-I4IJOLNA.js} +4 -4
- package/dist/{chunk-HQPU73WV.js.map → chunk-I4IJOLNA.js.map} +1 -1
- package/dist/{chunk-UDCCOUWR.js → chunk-IA6DCC3N.js} +6 -6
- package/dist/{chunk-UDCCOUWR.js.map → chunk-IA6DCC3N.js.map} +1 -1
- package/dist/{chunk-36NWC4GV.js → chunk-ISX3AM32.js} +3 -3
- package/dist/{chunk-36NWC4GV.js.map → chunk-ISX3AM32.js.map} +1 -1
- package/dist/{chunk-LMCUGYHT.js → chunk-L24N5EON.js} +6 -6
- package/dist/chunk-L24N5EON.js.map +1 -0
- package/dist/{chunk-HRNWWL3Y.js → chunk-L5GH7LLD.js} +61 -29
- package/dist/chunk-L5GH7LLD.js.map +1 -0
- package/dist/chunk-LJVIZNPE.js +9 -0
- package/dist/chunk-LJVIZNPE.js.map +1 -0
- package/dist/{chunk-AHKMN3YQ.js → chunk-MCRTAUSZ.js} +6 -6
- package/dist/chunk-MCRTAUSZ.js.map +1 -0
- package/dist/{chunk-LHUWOA2U.js → chunk-MNYY7UU2.js} +6 -6
- package/dist/{chunk-LHUWOA2U.js.map → chunk-MNYY7UU2.js.map} +1 -1
- package/dist/{chunk-7HZBD4YZ.js → chunk-NF2PBGD3.js} +36 -23
- package/dist/chunk-NF2PBGD3.js.map +1 -0
- package/dist/{chunk-54W6VAI3.js → chunk-NNPSBC7O.js} +5 -5
- package/dist/{chunk-54W6VAI3.js.map → chunk-NNPSBC7O.js.map} +1 -1
- package/dist/{chunk-MW42XVPD.js → chunk-PBSVX5DB.js} +15 -5
- package/dist/chunk-PBSVX5DB.js.map +1 -0
- package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
- package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
- package/dist/{chunk-6UIQJJNJ.js → chunk-QRNQQIQM.js} +5 -5
- package/dist/{chunk-6UIQJJNJ.js.map → chunk-QRNQQIQM.js.map} +1 -1
- package/dist/{chunk-N66NC6QK.js → chunk-RKCUXOU2.js} +4 -4
- package/dist/{chunk-N66NC6QK.js.map → chunk-RKCUXOU2.js.map} +1 -1
- package/dist/{chunk-N5M4PDBK.js → chunk-SBZJGFZ6.js} +3 -3
- package/dist/{chunk-N5M4PDBK.js.map → chunk-SBZJGFZ6.js.map} +1 -1
- package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
- package/dist/chunk-SLUOF7XW.js.map +1 -0
- package/dist/{chunk-SAXWCGWR.js → chunk-SOUDKESO.js} +14 -7
- package/dist/chunk-SOUDKESO.js.map +1 -0
- package/dist/{chunk-T44RW5DW.js → chunk-ULF5LOBS.js} +4 -4
- package/dist/{chunk-T44RW5DW.js.map → chunk-ULF5LOBS.js.map} +1 -1
- package/dist/components/ambient-background/index.js +9 -23
- package/dist/components/ambient-background/index.js.map +1 -1
- package/dist/components/ambient-background/starfield.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +55 -10
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.d.ts +1 -1
- package/dist/components/app-shell/index.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +299 -38
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +4 -4
- package/dist/components/avatar/avatar.d.ts +1 -1
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/index.js +10 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/button-group/button-group.d.ts +10 -2
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/button-multi-select/index.js +2 -2
- package/dist/components/button-select/button-select-control.d.ts +4 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +4 -1
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +2 -2
- package/dist/components/calendar-heatmap/index.js +2 -2
- package/dist/components/camera/index.js +6 -6
- package/dist/components/code-block/chrome.js +5 -5
- package/dist/components/code-block/index.js +6 -6
- package/dist/components/combobox/index.js +4 -4
- package/dist/components/combobox-list/index.js +6 -6
- package/dist/components/data-table/data-table-features.d.ts +8 -0
- package/dist/components/data-table/data-table-features.d.ts.map +1 -1
- package/dist/components/data-table/data-table-group.d.ts +128 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -0
- package/dist/components/data-table/data-table-grouping.d.ts +72 -0
- package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
- package/dist/components/data-table/data-table-icons.d.ts +4 -2
- package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
- package/dist/components/data-table/data-table-meta.d.ts +9 -0
- package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
- package/dist/components/data-table/data-table-pagination.d.ts +4 -1
- package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
- package/dist/components/data-table/data-table-schema.d.ts +4 -0
- package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts +16 -3
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
- package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
- package/dist/components/data-table/data-table-translations.d.ts +35 -0
- package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +55 -3
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.d.ts +3 -1
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +878 -230
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +8 -8
- package/dist/components/drawer/index.js +4 -4
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/geodesic/badge-frame.d.ts +13 -1
- package/dist/components/geodesic/badge-frame.d.ts.map +1 -1
- package/dist/components/geodesic/exam-badge.d.ts +4 -1
- package/dist/components/geodesic/exam-badge.d.ts.map +1 -1
- package/dist/components/geodesic/geometry.d.ts +14 -9
- package/dist/components/geodesic/geometry.d.ts.map +1 -1
- package/dist/components/geodesic/index.js +62 -23
- package/dist/components/geodesic/index.js.map +1 -1
- package/dist/components/geodesic/status.d.ts +8 -6
- package/dist/components/geodesic/status.d.ts.map +1 -1
- package/dist/components/geodesic/styles.css +15 -2
- package/dist/components/hover-card/index.js +3 -3
- package/dist/components/indicator/index.js +23 -8
- package/dist/components/indicator/index.js.map +1 -1
- package/dist/components/indicator/indicator.d.ts +15 -6
- package/dist/components/indicator/indicator.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/lightbox/index.js +4 -4
- package/dist/components/menu/index.js +4 -4
- package/dist/components/modal/index.js +4 -4
- package/dist/components/multi-combobox-list/index.js +6 -6
- package/dist/components/multi-select/index.js +4 -4
- package/dist/components/nav-link/index.js +5 -1
- package/dist/components/nav-link/nav-link.d.ts.map +1 -1
- package/dist/components/nav-link/tanstack.js +5 -1
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +15 -3
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/types.d.ts +5 -0
- package/dist/components/notification/types.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/overlays/index.js +5 -5
- package/dist/components/photo-capture/index.js +6 -6
- package/dist/components/popover/index.js +3 -3
- package/dist/components/schedule/index.js +4 -4
- package/dist/components/segment-group/index.js +1 -1
- package/dist/components/segment-group/segment-group.d.ts +6 -1
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +5 -5
- package/dist/components/spotlight/index.js +8 -8
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/tabs-data.d.ts +4 -1
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tabs/tabs.d.ts +4 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +3 -3
- package/dist/components/time-input/index.js +6 -6
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/tree-multi-select/index.js +4 -4
- package/dist/components/tree-select/index.js +4 -4
- package/dist/index.js +2 -2
- package/dist/lib/overlay-container.d.ts.map +1 -1
- package/dist/lib/overlay-layer.d.ts +10 -3
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/sidebar-rail.d.ts +21 -0
- package/dist/lib/sidebar-rail.d.ts.map +1 -0
- package/dist/theme.css +21 -18
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +6 -0
- package/src/components/ambient-background/starfield.tsx +14 -41
- package/src/components/app-shell/app-shell.test.tsx +430 -5
- package/src/components/app-shell/app-shell.tsx +484 -24
- package/src/components/app-shell/index.ts +2 -0
- package/src/components/avatar/avatar.test.tsx +12 -0
- package/src/components/avatar/avatar.tsx +9 -0
- package/src/components/button-group/button-group.test.tsx +24 -0
- package/src/components/button-group/button-group.tsx +21 -4
- package/src/components/button-multi-select/button-multi-select.test.tsx +15 -0
- package/src/components/button-select/button-select-control.tsx +5 -0
- package/src/components/button-select/button-select.test.tsx +25 -0
- package/src/components/button-select/button-select.tsx +13 -2
- package/src/components/data-table/data-table-features.ts +11 -0
- package/src/components/data-table/data-table-group.test.tsx +1007 -0
- package/src/components/data-table/data-table-group.tsx +474 -0
- package/src/components/data-table/data-table-grouping.ts +160 -0
- package/src/components/data-table/data-table-icons.tsx +8 -1
- package/src/components/data-table/data-table-meta.ts +9 -0
- package/src/components/data-table/data-table-pagination.tsx +5 -1
- package/src/components/data-table/data-table-stack.tsx +165 -43
- package/src/components/data-table/data-table-toolbar.tsx +110 -2
- package/src/components/data-table/data-table-translations.ts +44 -0
- package/src/components/data-table/data-table.tsx +420 -150
- package/src/components/data-table/index.ts +4 -0
- package/src/components/drawer/drawer.tsx +1 -1
- package/src/components/geodesic/badge-frame.tsx +67 -13
- package/src/components/geodesic/exam-badge.tsx +8 -4
- package/src/components/geodesic/geometry.ts +8 -6
- package/src/components/geodesic/status.test.ts +11 -2
- package/src/components/geodesic/status.ts +11 -7
- package/src/components/geodesic/styles.css +15 -2
- package/src/components/indicator/indicator.test.tsx +45 -0
- package/src/components/indicator/indicator.tsx +40 -13
- package/src/components/modal/modal.tsx +1 -1
- package/src/components/nav-link/nav-link.test.tsx +121 -1
- package/src/components/nav-link/nav-link.tsx +78 -29
- package/src/components/notification/create-notifier.tsx +18 -2
- package/src/components/notification/notify-in-modal.test.tsx +128 -0
- package/src/components/notification/types.ts +5 -0
- package/src/components/segment-group/segment-group.test.tsx +22 -0
- package/src/components/segment-group/segment-group.tsx +35 -19
- package/src/components/tabs/tabs-data.tsx +5 -1
- package/src/components/tabs/tabs.test.tsx +28 -0
- package/src/components/tabs/tabs.tsx +14 -4
- package/src/lib/overlay-container.tsx +2 -1
- package/src/lib/overlay-layer.test.tsx +63 -1
- package/src/lib/overlay-layer.tsx +29 -6
- package/src/lib/sidebar-rail.ts +24 -0
- package/src/theme.css +21 -18
- package/src/theme.test.ts +14 -11
- package/dist/chunk-7HZBD4YZ.js.map +0 -1
- package/dist/chunk-7P32XCEU.js.map +0 -1
- package/dist/chunk-AHKMN3YQ.js.map +0 -1
- package/dist/chunk-H7WOMZXO.js.map +0 -1
- package/dist/chunk-HRNWWL3Y.js.map +0 -1
- package/dist/chunk-LMCUGYHT.js.map +0 -1
- package/dist/chunk-MW42XVPD.js.map +0 -1
- package/dist/chunk-SAXWCGWR.js.map +0 -1
- package/dist/chunk-XUFCI262.js.map +0 -1
|
@@ -70,12 +70,21 @@ const avatarVariants = cva(
|
|
|
70
70
|
// `size`/`spacing` pairing (e.g. `md` avatars in a `spacing="xs"`
|
|
71
71
|
// group) still gets a correctly-sized notch, just more or less
|
|
72
72
|
// overlap.
|
|
73
|
+
//
|
|
74
|
+
// `2xl` (88px) and `3xl` (128px) sit outside the shared `SIZES` scale
|
|
75
|
+
// in `lib/sizes.ts`, the way Text/Title/Container declare their own
|
|
76
|
+
// extra steps: they're for a person shown as the subject of a screen
|
|
77
|
+
// rather than in a list. They keep `xl`'s proportions — initials at
|
|
78
|
+
// about 0.28× the diameter, the icon at 0.5× — and their own
|
|
79
|
+
// `--avatar-r`. `Avatar.Group`'s `spacing` stays on the shared scale.
|
|
73
80
|
size: {
|
|
74
81
|
xs: "size-6 text-[10px] [&_svg]:size-3.5 [--avatar-r:12]",
|
|
75
82
|
sm: "size-8 text-xs [&_svg]:size-4 [--avatar-r:16]",
|
|
76
83
|
md: "size-10 text-sm [&_svg]:size-5 [--avatar-r:20]",
|
|
77
84
|
lg: "size-12 text-base [&_svg]:size-6 [--avatar-r:24]",
|
|
78
85
|
xl: "size-16 text-lg [&_svg]:size-8 [--avatar-r:32]",
|
|
86
|
+
"2xl": "size-22 text-2xl [&_svg]:size-11 [--avatar-r:44]",
|
|
87
|
+
"3xl": "size-32 text-4xl [&_svg]:size-16 [--avatar-r:64]",
|
|
79
88
|
},
|
|
80
89
|
// `--avatar-corner-r` also rides along with `radius`: it's the other
|
|
81
90
|
// half of `Avatar.Group`'s notch for a non-circular avatar (see
|
|
@@ -165,4 +165,28 @@ describe("ButtonGroup", () => {
|
|
|
165
165
|
expect(screen.getByTestId("two").getAttribute("data-size")).toBe("xl")
|
|
166
166
|
expect(screen.getByTestId("three").getAttribute("data-size")).toBe("md")
|
|
167
167
|
})
|
|
168
|
+
|
|
169
|
+
it("spans the container with an even share per child under `grow`", () => {
|
|
170
|
+
const group = renderGroup(
|
|
171
|
+
<ButtonGroup grow>
|
|
172
|
+
<Button>One</Button>
|
|
173
|
+
<Button>Two</Button>
|
|
174
|
+
</ButtonGroup>,
|
|
175
|
+
)
|
|
176
|
+
expect(group.className).toMatch(/(^|\s)w-full(\s|$)/)
|
|
177
|
+
expect(group.className).toContain("*:flex-1")
|
|
178
|
+
expect(group.className).not.toContain("inline-flex")
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
it("hugs its children without `grow`", () => {
|
|
182
|
+
const group = renderGroup(
|
|
183
|
+
<ButtonGroup>
|
|
184
|
+
<Button>One</Button>
|
|
185
|
+
<Button>Two</Button>
|
|
186
|
+
</ButtonGroup>,
|
|
187
|
+
)
|
|
188
|
+
expect(group.className).toContain("inline-flex")
|
|
189
|
+
expect(group.className).not.toMatch(/(^|\s)w-full(\s|$)/)
|
|
190
|
+
expect(group.className).not.toContain("*:flex-1")
|
|
191
|
+
})
|
|
168
192
|
})
|
|
@@ -42,6 +42,9 @@ import type { WithTestId } from "../../lib/test-id"
|
|
|
42
42
|
* `orientation="horizontal"` (default) flattens the inline edges — logical
|
|
43
43
|
* `rounded-s` / `rounded-e` + `-ms`, so it flips correctly under RTL — while
|
|
44
44
|
* `"vertical"` flattens the block edges.
|
|
45
|
+
*
|
|
46
|
+
* `grow` spans the container and gives every child an even share of it
|
|
47
|
+
* (`flex-1`), like a tab bar.
|
|
45
48
|
*/
|
|
46
49
|
export const buttonGroupVariants = cva(
|
|
47
50
|
[
|
|
@@ -97,6 +100,10 @@ export const buttonGroupVariants = cva(
|
|
|
97
100
|
"[&>:is([data-variant=filled],[data-variant=subtle])]:border-x-0",
|
|
98
101
|
],
|
|
99
102
|
},
|
|
103
|
+
// Span the container, with an even share per child. `flex` (not
|
|
104
|
+
// `inline-flex`) so `w-full` resolves against the parent; `cn`'s twMerge
|
|
105
|
+
// drops the base `inline-flex`.
|
|
106
|
+
grow: { true: "flex w-full *:flex-1" },
|
|
100
107
|
},
|
|
101
108
|
defaultVariants: { orientation: "horizontal" },
|
|
102
109
|
},
|
|
@@ -107,14 +114,24 @@ export type ButtonGroupOrientation = NonNullable<
|
|
|
107
114
|
>
|
|
108
115
|
|
|
109
116
|
export type ButtonGroupProps = HTMLArkProps<"div"> &
|
|
110
|
-
VariantProps<typeof buttonGroupVariants> &
|
|
111
|
-
WithTestId
|
|
117
|
+
Omit<VariantProps<typeof buttonGroupVariants>, "grow"> &
|
|
118
|
+
WithTestId & {
|
|
119
|
+
/** Span the container and give every child an even share of it, like a
|
|
120
|
+
* tab bar. Without it the group hugs its children. */
|
|
121
|
+
grow?: boolean
|
|
122
|
+
}
|
|
112
123
|
|
|
113
|
-
export const ButtonGroup = ({
|
|
124
|
+
export const ButtonGroup = ({
|
|
125
|
+
className,
|
|
126
|
+
orientation,
|
|
127
|
+
grow,
|
|
128
|
+
testId,
|
|
129
|
+
...rest
|
|
130
|
+
}: ButtonGroupProps) => (
|
|
114
131
|
<ark.div
|
|
115
132
|
role="group"
|
|
116
133
|
data-orientation={orientation ?? "horizontal"}
|
|
117
|
-
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
134
|
+
className={cn(buttonGroupVariants({ orientation, grow }), className)}
|
|
118
135
|
{...props({ "data-testid": testId })}
|
|
119
136
|
{...rest}
|
|
120
137
|
/>
|
|
@@ -132,6 +132,21 @@ describe("ButtonMultiSelect", () => {
|
|
|
132
132
|
fireEvent.click(toggle("Italic"))
|
|
133
133
|
await waitFor(() => expect(toggle("Italic").getAttribute("data-variant")).toBe("light"))
|
|
134
134
|
})
|
|
135
|
+
|
|
136
|
+
it("spans the container under `grow`", () => {
|
|
137
|
+
render(<ButtonMultiSelect data={DAYS} testId="days" grow />)
|
|
138
|
+
const root = screen.getByTestId("days")
|
|
139
|
+
expect(root.className).toMatch(/(^|\s)w-full(\s|$)/)
|
|
140
|
+
expect(root.className).not.toContain("w-fit")
|
|
141
|
+
expect(root.className).toContain("*:flex-1")
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it("hugs its items without `grow`", () => {
|
|
145
|
+
render(<ButtonMultiSelect data={DAYS} testId="days" />)
|
|
146
|
+
const root = screen.getByTestId("days")
|
|
147
|
+
expect(root.className).toContain("w-fit")
|
|
148
|
+
expect(root.className).not.toContain("*:flex-1")
|
|
149
|
+
})
|
|
135
150
|
})
|
|
136
151
|
|
|
137
152
|
describe("ButtonMultiSelect types", () => {
|
|
@@ -36,6 +36,9 @@ export type ButtonSelectBaseProps<Data extends ButtonSelectData> = Pick<
|
|
|
36
36
|
orientation?: "horizontal" | "vertical"
|
|
37
37
|
/** Red invalid state, independent of (and OR'd with) `error`. */
|
|
38
38
|
invalid?: boolean
|
|
39
|
+
/** Span the container and give every item an even share of it, like a tab
|
|
40
|
+
* bar. Without it the group hugs its items. */
|
|
41
|
+
grow?: boolean
|
|
39
42
|
/** Dims and blocks every item. */
|
|
40
43
|
disabled?: boolean
|
|
41
44
|
size?: ButtonSize
|
|
@@ -70,6 +73,7 @@ export const ButtonSelectControl = ({
|
|
|
70
73
|
renderItem,
|
|
71
74
|
orientation,
|
|
72
75
|
invalid,
|
|
76
|
+
grow,
|
|
73
77
|
disabled,
|
|
74
78
|
required,
|
|
75
79
|
size = "md",
|
|
@@ -116,6 +120,7 @@ export const ButtonSelectControl = ({
|
|
|
116
120
|
orientation={orientation}
|
|
117
121
|
disabled={disabled}
|
|
118
122
|
invalid={isInvalid}
|
|
123
|
+
grow={grow}
|
|
119
124
|
size={size}
|
|
120
125
|
variant={variant}
|
|
121
126
|
selectedVariant={selectedVariant}
|
|
@@ -207,6 +207,31 @@ describe("ButtonSelect", () => {
|
|
|
207
207
|
await waitFor(() => expect(onChange).toHaveBeenLastCalledWith("right"))
|
|
208
208
|
expect(radio("Right").getAttribute("data-variant")).toBe("filled")
|
|
209
209
|
})
|
|
210
|
+
|
|
211
|
+
it("spans the container under `grow`, the invalid ring with it", () => {
|
|
212
|
+
render(<ButtonSelect data={ITEMS} testId="range" grow invalid />)
|
|
213
|
+
const root = screen.getByTestId("range")
|
|
214
|
+
expect(root.className).toMatch(/(^|\s)w-full(\s|$)/)
|
|
215
|
+
expect(root.className).not.toContain("w-fit")
|
|
216
|
+
expect(root.className).toContain("*:flex-1")
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
it("hugs its items without `grow`", () => {
|
|
220
|
+
render(<ButtonSelect data={ITEMS} testId="range" />)
|
|
221
|
+
const root = screen.getByTestId("range")
|
|
222
|
+
expect(root.className).toContain("w-fit")
|
|
223
|
+
expect(root.className).not.toMatch(/(^|\s)w-full(\s|$)/)
|
|
224
|
+
expect(root.className).not.toContain("*:flex-1")
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it("spans the container under `grow` on the composable Root", () => {
|
|
228
|
+
render(
|
|
229
|
+
<ButtonSelect.Root grow testId="root">
|
|
230
|
+
<ButtonSelect.Item value="a">A</ButtonSelect.Item>
|
|
231
|
+
</ButtonSelect.Root>,
|
|
232
|
+
)
|
|
233
|
+
expect(screen.getByTestId("root").className).toContain("*:flex-1")
|
|
234
|
+
})
|
|
210
235
|
})
|
|
211
236
|
|
|
212
237
|
describe("ButtonSelect types", () => {
|
|
@@ -63,7 +63,9 @@ const ButtonSelectStyleContext = createContext<StyleContextValue>({
|
|
|
63
63
|
* seams out-specify a per-item border anyway. A `ring` (box-shadow) is used, not
|
|
64
64
|
* an `outline`, because the machine writes `outline: none` inline on the root.
|
|
65
65
|
* `w-fit` keeps that ring hugging the items: inside `Field`'s flex column the
|
|
66
|
-
* root would otherwise stretch to the field's full width.
|
|
66
|
+
* root would otherwise stretch to the field's full width. Under `grow` the root
|
|
67
|
+
* spans that width on purpose, so `w-full` overrides it and the ring spans the
|
|
68
|
+
* row with it.
|
|
67
69
|
*/
|
|
68
70
|
const invalidRing =
|
|
69
71
|
"w-fit rounded-button data-invalid:ring-1 data-invalid:ring-red-500 data-invalid:ring-offset-2 data-invalid:ring-offset-brand-50 dark:data-invalid:ring-offset-brand-950"
|
|
@@ -82,6 +84,9 @@ type BaseRootProps = Omit<
|
|
|
82
84
|
size?: ButtonSize
|
|
83
85
|
/** Red invalid ring around the group. */
|
|
84
86
|
invalid?: boolean
|
|
87
|
+
/** Span the container and give every item an even share of it, like a tab
|
|
88
|
+
* bar. Without it the group hugs its items. */
|
|
89
|
+
grow?: boolean
|
|
85
90
|
/** Lands on the group root, which forwards focus to its active item. Ark's
|
|
86
91
|
* prop types carry no `ref`, so it is declared here. */
|
|
87
92
|
ref?: Ref<HTMLDivElement>
|
|
@@ -152,6 +157,7 @@ export const RootBase = ({
|
|
|
152
157
|
selectedVariant = "filled",
|
|
153
158
|
size = "md",
|
|
154
159
|
invalid,
|
|
160
|
+
grow,
|
|
155
161
|
loopFocus = true,
|
|
156
162
|
className,
|
|
157
163
|
testId,
|
|
@@ -190,7 +196,12 @@ export const RootBase = ({
|
|
|
190
196
|
data-color={color}
|
|
191
197
|
{...props({ "aria-invalid": invalid, "data-invalid": invalid, "data-testid": testId })}
|
|
192
198
|
{...fieldA11yProps(field)}
|
|
193
|
-
className={cn(
|
|
199
|
+
className={cn(
|
|
200
|
+
buttonGroupVariants({ orientation, grow }),
|
|
201
|
+
invalidRing,
|
|
202
|
+
grow && "w-full",
|
|
203
|
+
className,
|
|
204
|
+
)}
|
|
194
205
|
{...rest}
|
|
195
206
|
>
|
|
196
207
|
{children}
|
|
@@ -8,10 +8,13 @@ import type {
|
|
|
8
8
|
} from "@tanstack/react-table"
|
|
9
9
|
import {
|
|
10
10
|
columnFilteringFeature,
|
|
11
|
+
columnGroupingFeature,
|
|
11
12
|
columnResizingFeature,
|
|
12
13
|
columnSizingFeature,
|
|
13
14
|
columnVisibilityFeature,
|
|
15
|
+
createExpandedRowModel,
|
|
14
16
|
createFilteredRowModel,
|
|
17
|
+
createGroupedRowModel,
|
|
15
18
|
createPaginatedRowModel,
|
|
16
19
|
createSortedRowModel,
|
|
17
20
|
filterFn_arrIncludes,
|
|
@@ -21,6 +24,7 @@ import {
|
|
|
21
24
|
filterFn_inNumberRange,
|
|
22
25
|
filterFn_weakEquals,
|
|
23
26
|
globalFilteringFeature,
|
|
27
|
+
rowExpandingFeature,
|
|
24
28
|
rowPaginationFeature,
|
|
25
29
|
rowSelectionFeature,
|
|
26
30
|
rowSortingFeature,
|
|
@@ -57,11 +61,18 @@ export const dataTableFeatures = tableFeatures({
|
|
|
57
61
|
columnVisibilityFeature,
|
|
58
62
|
columnSizingFeature,
|
|
59
63
|
columnResizingFeature,
|
|
64
|
+
// Row grouping (`grouping`) and its fold state (`expanded`). No
|
|
65
|
+
// `rowAggregationFeature`: a group row draws a header, never cells, so there
|
|
66
|
+
// is nothing to aggregate.
|
|
67
|
+
columnGroupingFeature,
|
|
68
|
+
rowExpandingFeature,
|
|
60
69
|
|
|
61
70
|
// v8's `get*RowModel` options moved into these slots. The core row model is
|
|
62
71
|
// automatic in v9 and must not be passed.
|
|
63
72
|
filteredRowModel: createFilteredRowModel(),
|
|
73
|
+
groupedRowModel: createGroupedRowModel(),
|
|
64
74
|
sortedRowModel: createSortedRowModel(),
|
|
75
|
+
expandedRowModel: createExpandedRowModel(),
|
|
65
76
|
paginatedRowModel: createPaginatedRowModel(),
|
|
66
77
|
|
|
67
78
|
/* These two registries are load-bearing, and their failure mode is silent.
|