@42-central/ui-react 0.24.0 → 0.26.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-YWTOW7PZ.js → chunk-276RL7FX.js} +10 -10
- package/dist/{chunk-YWTOW7PZ.js.map → chunk-276RL7FX.js.map} +1 -1
- package/dist/{chunk-FUNTJZX7.js → chunk-2CL3FKEY.js} +3 -3
- package/dist/{chunk-FUNTJZX7.js.map → chunk-2CL3FKEY.js.map} +1 -1
- package/dist/{chunk-YPFSRZ3T.js → chunk-2NTCQIRP.js} +5 -5
- package/dist/{chunk-YPFSRZ3T.js.map → chunk-2NTCQIRP.js.map} +1 -1
- package/dist/{chunk-D3JYDAUZ.js → chunk-2TZU4LSX.js} +4 -4
- package/dist/{chunk-D3JYDAUZ.js.map → chunk-2TZU4LSX.js.map} +1 -1
- package/dist/{chunk-DJLNGWMM.js → chunk-6IRMKF5T.js} +3 -3
- package/dist/{chunk-DJLNGWMM.js.map → chunk-6IRMKF5T.js.map} +1 -1
- package/dist/{chunk-DT6LKNZF.js → chunk-7247WBTV.js} +5 -4
- package/dist/chunk-7247WBTV.js.map +1 -0
- package/dist/{chunk-F2FSHVO5.js → chunk-7B44J3CF.js} +7 -7
- package/dist/{chunk-F2FSHVO5.js.map → chunk-7B44J3CF.js.map} +1 -1
- package/dist/{chunk-6VYGK3Q3.js → chunk-7E7JNWOC.js} +16 -21
- package/dist/chunk-7E7JNWOC.js.map +1 -0
- package/dist/{chunk-7AQ4MN4M.js → chunk-7OGZT7U2.js} +14 -6
- package/dist/chunk-7OGZT7U2.js.map +1 -0
- package/dist/{chunk-UAYENYS2.js → chunk-AKXALCUN.js} +3 -3
- package/dist/{chunk-UAYENYS2.js.map → chunk-AKXALCUN.js.map} +1 -1
- package/dist/{chunk-BE2LWUHY.js → chunk-BMEJBY6H.js} +5 -3
- package/dist/chunk-BMEJBY6H.js.map +1 -0
- package/dist/{chunk-DHJB4UJD.js → chunk-DMI4KS32.js} +5 -5
- package/dist/{chunk-DHJB4UJD.js.map → chunk-DMI4KS32.js.map} +1 -1
- package/dist/{chunk-FB2G4LNH.js → chunk-DSZF2TW6.js} +7 -7
- package/dist/{chunk-FB2G4LNH.js.map → chunk-DSZF2TW6.js.map} +1 -1
- package/dist/{chunk-N66NC6QK.js → chunk-E3XLWMEB.js} +3 -3
- package/dist/{chunk-N66NC6QK.js.map → chunk-E3XLWMEB.js.map} +1 -1
- package/dist/{chunk-MXAACRWE.js → chunk-E52Z2FKU.js} +5 -5
- package/dist/{chunk-MXAACRWE.js.map → chunk-E52Z2FKU.js.map} +1 -1
- package/dist/chunk-F374BNL4.js +129 -0
- package/dist/chunk-F374BNL4.js.map +1 -0
- package/dist/{chunk-3L5GLI67.js → chunk-I4B3N3UX.js} +3 -3
- package/dist/{chunk-3L5GLI67.js.map → chunk-I4B3N3UX.js.map} +1 -1
- package/dist/{chunk-IPYHTCFL.js → chunk-IUK7OJXZ.js} +3 -3
- package/dist/{chunk-IPYHTCFL.js.map → chunk-IUK7OJXZ.js.map} +1 -1
- package/dist/{chunk-HRNWWL3Y.js → chunk-J2NW7JID.js} +61 -29
- package/dist/chunk-J2NW7JID.js.map +1 -0
- package/dist/{chunk-MRAJ45IM.js → chunk-JDPVD2YE.js} +5 -5
- package/dist/{chunk-MRAJ45IM.js.map → chunk-JDPVD2YE.js.map} +1 -1
- package/dist/{chunk-SZEOTXRZ.js → chunk-JFB6O7IY.js} +5 -5
- package/dist/{chunk-SZEOTXRZ.js.map → chunk-JFB6O7IY.js.map} +1 -1
- package/dist/{chunk-2MXWEIMD.js → chunk-KKLCHLCZ.js} +12 -11
- package/dist/chunk-KKLCHLCZ.js.map +1 -0
- package/dist/{chunk-6N6J2DOE.js → chunk-LIZWCWED.js} +3 -3
- package/dist/{chunk-6N6J2DOE.js.map → chunk-LIZWCWED.js.map} +1 -1
- package/dist/chunk-LJVIZNPE.js +9 -0
- package/dist/chunk-LJVIZNPE.js.map +1 -0
- package/dist/{chunk-HQPU73WV.js → chunk-LYGOFMXJ.js} +3 -3
- package/dist/{chunk-HQPU73WV.js.map → chunk-LYGOFMXJ.js.map} +1 -1
- package/dist/{chunk-JVG5ISPT.js → chunk-N42EFOML.js} +4 -4
- package/dist/{chunk-JVG5ISPT.js.map → chunk-N42EFOML.js.map} +1 -1
- package/dist/{chunk-C4NFRSOR.js → chunk-NF2PBGD3.js} +38 -25
- package/dist/chunk-NF2PBGD3.js.map +1 -0
- package/dist/{chunk-DA4QII2N.js → chunk-NLSJ6T7V.js} +4 -4
- package/dist/{chunk-DA4QII2N.js.map → chunk-NLSJ6T7V.js.map} +1 -1
- package/dist/{chunk-UT3TOV2Q.js → chunk-OVT2KZHY.js} +3 -3
- package/dist/{chunk-UT3TOV2Q.js.map → chunk-OVT2KZHY.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-SVKN5ZHX.js → chunk-PEHFWGTT.js} +16 -13
- package/dist/chunk-PEHFWGTT.js.map +1 -0
- package/dist/{chunk-J44FJ7PH.js → chunk-PFZMB3US.js} +4 -4
- package/dist/{chunk-J44FJ7PH.js.map → chunk-PFZMB3US.js.map} +1 -1
- package/dist/{chunk-IRNF274I.js → chunk-PT22KEVD.js} +5 -5
- package/dist/{chunk-IRNF274I.js.map → chunk-PT22KEVD.js.map} +1 -1
- package/dist/{chunk-OZMSXYBX.js → chunk-QEAF57ZQ.js} +4 -4
- package/dist/{chunk-OZMSXYBX.js.map → chunk-QEAF57ZQ.js.map} +1 -1
- package/dist/{chunk-SWVUXEBT.js → chunk-SCXXJDKQ.js} +3 -3
- package/dist/{chunk-SWVUXEBT.js.map → chunk-SCXXJDKQ.js.map} +1 -1
- package/dist/{chunk-E5H3YWZV.js → chunk-SOUDKESO.js} +15 -8
- package/dist/chunk-SOUDKESO.js.map +1 -0
- package/dist/{chunk-4FEOMQYR.js → chunk-THGJLR5S.js} +6 -6
- package/dist/{chunk-4FEOMQYR.js.map → chunk-THGJLR5S.js.map} +1 -1
- package/dist/{chunk-TCFB23JT.js → chunk-WERJ44ZN.js} +3 -3
- package/dist/{chunk-TCFB23JT.js.map → chunk-WERJ44ZN.js.map} +1 -1
- package/dist/{chunk-QNKD2SQM.js → chunk-X3YIHN2U.js} +5 -5
- package/dist/{chunk-QNKD2SQM.js.map → chunk-X3YIHN2U.js.map} +1 -1
- package/dist/{chunk-VD6PB3VA.js → chunk-X6DESK37.js} +12 -3
- package/dist/chunk-X6DESK37.js.map +1 -0
- package/dist/{chunk-47LEAR6G.js → chunk-Y2G47ARQ.js} +6 -6
- package/dist/{chunk-47LEAR6G.js.map → chunk-Y2G47ARQ.js.map} +1 -1
- package/dist/{chunk-O7LS6OZR.js → chunk-YMVUQ2L7.js} +4 -4
- package/dist/{chunk-O7LS6OZR.js.map → chunk-YMVUQ2L7.js.map} +1 -1
- package/dist/{chunk-F342ZT7O.js → chunk-ZVECQBGG.js} +13 -7
- package/dist/chunk-ZVECQBGG.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/ambient-background/index.js +14 -26
- 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 +300 -39
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +5 -5
- 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 +12 -3
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/index.js +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 +4 -4
- 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 +4 -4
- package/dist/components/calendar/index.js +4 -4
- package/dist/components/calendar-heatmap/index.js +2 -2
- package/dist/components/camera/index.js +12 -12
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/carousel/index.js +2 -2
- package/dist/components/checkbox/checkbox.d.ts +3 -2
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/clipboard/index.js +3 -3
- package/dist/components/code-block/chrome.js +3 -3
- package/dist/components/code-block/code-block.d.ts +6 -3
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/highlighter.d.ts +16 -15
- package/dist/components/code-block/highlighter.d.ts.map +1 -1
- package/dist/components/code-block/index.d.ts +2 -1
- package/dist/components/code-block/index.d.ts.map +1 -1
- package/dist/components/code-block/index.js +85 -14
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/code-block/languages.d.ts +61 -0
- package/dist/components/code-block/languages.d.ts.map +1 -0
- package/dist/components/code-block/static.d.ts +2 -1
- package/dist/components/code-block/static.d.ts.map +1 -1
- package/dist/components/code-block/static.js +99 -10
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/combobox/index.js +5 -5
- package/dist/components/combobox-list/index.js +7 -7
- package/dist/components/compare/index.js +2 -2
- package/dist/components/data-table/index.js +32 -32
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +14 -14
- package/dist/components/download-button/index.js +2 -2
- package/dist/components/drawer/index.js +5 -5
- package/dist/components/field/field.d.ts +3 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/file-item/index.js +5 -5
- package/dist/components/file-preview/index.js +5 -5
- package/dist/components/file-trigger/index.js +2 -2
- package/dist/components/file-upload/index.js +6 -6
- package/dist/components/gallery/index.js +2 -2
- 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 +2 -2
- package/dist/components/image-cropper/index.js +7 -7
- package/dist/components/indicator/index.js +24 -9
- 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/input/index.js +2 -2
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +8 -8
- package/dist/components/menu/index.js +4 -4
- package/dist/components/modal/index.js +5 -5
- package/dist/components/multi-combobox-list/index.js +7 -7
- package/dist/components/multi-select/index.js +8 -8
- 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/number-input/index.js +5 -5
- package/dist/components/overlays/index.js +7 -7
- package/dist/components/password-input/index.js +3 -3
- package/dist/components/photo-capture/index.js +16 -16
- package/dist/components/pills-input/index.js +5 -5
- package/dist/components/pin-input/index.js +2 -2
- package/dist/components/popover/index.js +2 -2
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/index.js +1 -1
- package/dist/components/schedule/index.js +7 -7
- package/dist/components/segment-group/index.js +4 -4
- 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 +6 -6
- package/dist/components/slider/index.js +2 -2
- package/dist/components/spotlight/index.js +11 -11
- package/dist/components/switch/index.js +14 -19
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts +1 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/tabs/index.js +3 -3
- 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 +7 -7
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/theme-icon/index.js +1 -1
- package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
- package/dist/components/time-input/index.js +9 -9
- package/dist/components/tree-multi-select/index.js +8 -8
- package/dist/components/tree-select/index.js +5 -5
- package/dist/index.js +4 -4
- package/dist/lib/sidebar-rail.d.ts +21 -0
- package/dist/lib/sidebar-rail.d.ts.map +1 -0
- package/dist/theme.css +35 -35
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +6 -0
- package/src/components/action-icon/action-icon.tsx +3 -1
- package/src/components/ambient-background/starfield.tsx +18 -43
- 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/badge/badge.tsx +11 -6
- package/src/components/button/button.tsx +1 -1
- 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/card/card.tsx +10 -9
- package/src/components/checkbox/checkbox.test.tsx +17 -9
- package/src/components/checkbox/checkbox.tsx +26 -27
- package/src/components/choice-card-group/choice-card-group.tsx +3 -3
- package/src/components/code-block/code-block.tsx +7 -4
- package/src/components/code-block/highlighter.test.ts +79 -1
- package/src/components/code-block/highlighter.ts +76 -30
- package/src/components/code-block/index.ts +2 -0
- package/src/components/code-block/languages.ts +63 -0
- package/src/components/code-block/static.tsx +2 -1
- package/src/components/data-table/data-table-pagination.tsx +5 -5
- package/src/components/data-table/data-table-stack.tsx +2 -2
- package/src/components/field/field.tsx +14 -0
- 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/kbd/kbd.tsx +2 -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/segment-group/segment-group.test.tsx +22 -0
- package/src/components/segment-group/segment-group.tsx +35 -19
- package/src/components/switch/switch.test.tsx +15 -0
- package/src/components/switch/switch.tsx +27 -27
- package/src/components/table/table.test.tsx +1 -1
- package/src/components/table/table.tsx +14 -11
- 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/components/theme-icon/theme-icon.tsx +46 -12
- package/src/lib/sidebar-rail.ts +24 -0
- package/src/theme.css +35 -35
- package/src/theme.test.ts +0 -1
- package/dist/chunk-2MXWEIMD.js.map +0 -1
- package/dist/chunk-6VYGK3Q3.js.map +0 -1
- package/dist/chunk-7AQ4MN4M.js.map +0 -1
- package/dist/chunk-7CNDZZZ6.js +0 -95
- package/dist/chunk-7CNDZZZ6.js.map +0 -1
- package/dist/chunk-BE2LWUHY.js.map +0 -1
- package/dist/chunk-C4NFRSOR.js.map +0 -1
- package/dist/chunk-DT6LKNZF.js.map +0 -1
- package/dist/chunk-E5H3YWZV.js.map +0 -1
- package/dist/chunk-F342ZT7O.js.map +0 -1
- package/dist/chunk-HRNWWL3Y.js.map +0 -1
- package/dist/chunk-MW42XVPD.js.map +0 -1
- package/dist/chunk-SVKN5ZHX.js.map +0 -1
- package/dist/chunk-VD6PB3VA.js.map +0 -1
|
@@ -10,7 +10,13 @@ import { focusStyles } from "../../lib/focus-styles"
|
|
|
10
10
|
import { props } from "../../lib/props"
|
|
11
11
|
import type { Size } from "../../lib/sizes"
|
|
12
12
|
import type { WithTestId } from "../../lib/test-id"
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
FieldShell,
|
|
15
|
+
fieldA11yProps,
|
|
16
|
+
fieldInlineStack,
|
|
17
|
+
fieldLabel,
|
|
18
|
+
requiredMark,
|
|
19
|
+
} from "../field/field"
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
22
|
* Switch — a single boolean toggle on Ark UI's Switch machine, styled as a
|
|
@@ -18,8 +24,9 @@ import { FieldShell, fieldA11yProps, fieldLabel, fieldRoot, requiredMark } from
|
|
|
18
24
|
* through the switch's own `Ark.Label` part (not `Field`'s) so it stays
|
|
19
25
|
* correctly wired to the hidden input's `aria-labelledby` and carries no
|
|
20
26
|
* layout footprint when visually hidden (e.g. `classNames.label: "sr-only"`).
|
|
21
|
-
* `description` / `error` / `required` live below
|
|
22
|
-
* scaffold,
|
|
27
|
+
* `description` / `error` / `required` live below the label via the shared
|
|
28
|
+
* `Field` scaffold, with the track centered on the label line, so a `Switch`
|
|
29
|
+
* is accessible and complete on its own. Implements
|
|
23
30
|
* the kit's `FormControlProps` contract: the `ref` and `onBlur` land on the
|
|
24
31
|
* submittable hidden `<input>`, and `name` wires it into native form
|
|
25
32
|
* submission.
|
|
@@ -127,6 +134,7 @@ export type SwitchProps = WithTestId & {
|
|
|
127
134
|
control?: string
|
|
128
135
|
thumb?: string
|
|
129
136
|
label?: string
|
|
137
|
+
/** The description / error field, under the label. */
|
|
130
138
|
field?: string
|
|
131
139
|
}
|
|
132
140
|
}
|
|
@@ -171,9 +179,10 @@ export const Switch = ({
|
|
|
171
179
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
172
180
|
const isInvalid = invalid || error != null
|
|
173
181
|
|
|
174
|
-
// A visible label above description/error
|
|
175
|
-
//
|
|
176
|
-
//
|
|
182
|
+
// A visible label above description/error switches the root to a grid: the
|
|
183
|
+
// control centers on the label's row alone (not on the whole text stack),
|
|
184
|
+
// and the field hangs under the label in the second column. Label-only
|
|
185
|
+
// (incl. sr-only) stays a plain inline row.
|
|
177
186
|
const hasStack = label != null && (description != null || error != null)
|
|
178
187
|
|
|
179
188
|
const labelNode = label != null && (
|
|
@@ -206,7 +215,9 @@ export const Switch = ({
|
|
|
206
215
|
// `relative` contains the absolutely positioned hidden input, which would
|
|
207
216
|
// otherwise escape any scroller this control sits in.
|
|
208
217
|
className={cn(
|
|
209
|
-
|
|
218
|
+
hasStack
|
|
219
|
+
? fieldInlineStack({ size })
|
|
220
|
+
: "relative inline-flex items-center gap-2 select-none",
|
|
210
221
|
className,
|
|
211
222
|
classNames?.root,
|
|
212
223
|
)}
|
|
@@ -215,26 +226,15 @@ export const Switch = ({
|
|
|
215
226
|
<Ark.Thumb className={cn(switchThumb({ size }), classNames?.thumb)} />
|
|
216
227
|
</Ark.Control>
|
|
217
228
|
|
|
218
|
-
{
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
{labelNode}
|
|
228
|
-
<FieldShell
|
|
229
|
-
description={description}
|
|
230
|
-
error={error}
|
|
231
|
-
size={size}
|
|
232
|
-
className={classNames?.field}
|
|
233
|
-
>
|
|
234
|
-
<SwitchHiddenInput ref={ref} onBlur={onBlur} />
|
|
235
|
-
</FieldShell>
|
|
236
|
-
</>
|
|
237
|
-
)}
|
|
229
|
+
{labelNode}
|
|
230
|
+
<FieldShell
|
|
231
|
+
description={description}
|
|
232
|
+
error={error}
|
|
233
|
+
size={size}
|
|
234
|
+
className={cn(hasStack && "col-start-2", classNames?.field)}
|
|
235
|
+
>
|
|
236
|
+
<SwitchHiddenInput ref={ref} onBlur={onBlur} />
|
|
237
|
+
</FieldShell>
|
|
238
238
|
</Ark.Root>
|
|
239
239
|
)
|
|
240
240
|
}
|
|
@@ -73,7 +73,7 @@ describe("Table", () => {
|
|
|
73
73
|
const scroll = container.querySelector("table")?.parentElement as HTMLElement
|
|
74
74
|
// Root container: bordered, rounded, and clipped so the rounding survives a scrollbar.
|
|
75
75
|
expect(root.className).toContain("overflow-hidden")
|
|
76
|
-
expect(root.className).toContain("rounded-
|
|
76
|
+
expect(root.className).toContain("rounded-xl")
|
|
77
77
|
expect(root.className).toContain("border")
|
|
78
78
|
// The table sits inside the scrollable region.
|
|
79
79
|
expect(scroll.className).toContain("overflow-auto")
|
|
@@ -31,9 +31,12 @@ import { TEXT_COLOR_CLASSES } from "../../lib/typography-size"
|
|
|
31
31
|
*/
|
|
32
32
|
const tableContainer = cn(
|
|
33
33
|
"flex w-full flex-col overflow-hidden contain-layout",
|
|
34
|
-
//
|
|
35
|
-
// (
|
|
36
|
-
|
|
34
|
+
// The table is a card: the same surface as Card's default — white 4%,
|
|
35
|
+
// edged white 8% (Figma's `bg-primary` / `border-primary`) — at the radius
|
|
36
|
+
// Figma draws for a table (12, node 22286-101476). One surface, laid once
|
|
37
|
+
// on the frame: the header, the rows and the pagination band are clear, so
|
|
38
|
+
// the pagination reads as part of the table, not as a darker strip.
|
|
39
|
+
"rounded-xl border border-brand-900/20 dark:border-white/8 dark:bg-white/4",
|
|
37
40
|
)
|
|
38
41
|
|
|
39
42
|
/**
|
|
@@ -52,19 +55,19 @@ const tableVariants = cva(
|
|
|
52
55
|
[
|
|
53
56
|
// Row separators — on cells, since separate-mode ignores <tr> borders.
|
|
54
57
|
"[&_tbody_tr:not(:last-child)_td]:border-b",
|
|
55
|
-
"[&_tbody_td]:border-brand-900/20 dark:[&_tbody_td]:border-white/
|
|
58
|
+
"[&_tbody_td]:border-brand-900/20 dark:[&_tbody_td]:border-white/8",
|
|
56
59
|
// Cells
|
|
57
60
|
"[&_td]:align-middle",
|
|
58
61
|
"[&_th]:text-start [&_th]:align-middle [&_th]:font-medium [&_th]:text-brand-950 dark:[&_th]:text-white",
|
|
59
62
|
// Header — subtle fill + a bottom separator that survives sticky. Same
|
|
60
63
|
// brand-tinted fill Popover/Modal/Drawer use for their own surface, at
|
|
61
64
|
// the same /90 light /85 dark opacity recipe.
|
|
62
|
-
"[&_thead]:bg-brand-50/90 dark:[&_thead]:bg-
|
|
63
|
-
"[&_thead_th]:border-b [&_thead_th]:border-brand-900/20 dark:[&_thead_th]:border-white/
|
|
65
|
+
"[&_thead]:bg-brand-50/90 dark:[&_thead]:bg-transparent",
|
|
66
|
+
"[&_thead_th]:border-b [&_thead_th]:border-brand-900/20 dark:[&_thead_th]:border-white/8",
|
|
64
67
|
// Footer — subtle fill + a top separator that survives sticky.
|
|
65
|
-
"[&_tfoot]:bg-brand-50/90 dark:[&_tfoot]:bg-
|
|
68
|
+
"[&_tfoot]:bg-brand-50/90 dark:[&_tfoot]:bg-transparent [&_tfoot]:font-medium",
|
|
66
69
|
"[&_tfoot_th]:border-t [&_tfoot_td]:border-t",
|
|
67
|
-
"[&_tfoot_th]:border-brand-900/20 [&_tfoot_td]:border-brand-900/20 dark:[&_tfoot_th]:border-white/
|
|
70
|
+
"[&_tfoot_th]:border-brand-900/20 [&_tfoot_td]:border-brand-900/20 dark:[&_tfoot_th]:border-white/8 dark:[&_tfoot_td]:border-white/8",
|
|
68
71
|
// Excludes a `data-placeholder` row (an empty/error/loading state, e.g.
|
|
69
72
|
// `DataTable`'s) — it has no row to hover, so it shouldn't tint like one.
|
|
70
73
|
// Black/white wash, same convention as Popover/Menu/TreeSelect's own row
|
|
@@ -93,11 +96,11 @@ const tableVariants = cva(
|
|
|
93
96
|
/** Pin the whole `<thead>` to the top of the scroll region; `backdrop-blur`
|
|
94
97
|
* keeps scrolled body rows legible behind the translucent header fill. */
|
|
95
98
|
const stickyHeaderClasses =
|
|
96
|
-
"[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:backdrop-blur-lg"
|
|
99
|
+
"[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10 [&_thead]:backdrop-blur-lg dark:[&_thead]:bg-brand-950/85"
|
|
97
100
|
|
|
98
101
|
/** Pin the whole `<tfoot>` (e.g. a totals row) to the bottom of the scroll region. */
|
|
99
102
|
const stickyFooterClasses =
|
|
100
|
-
"[&_tfoot]:sticky [&_tfoot]:bottom-0 [&_tfoot]:z-10 [&_tfoot]:backdrop-blur-lg"
|
|
103
|
+
"[&_tfoot]:sticky [&_tfoot]:bottom-0 [&_tfoot]:z-10 [&_tfoot]:backdrop-blur-lg dark:[&_tfoot]:bg-brand-950/85"
|
|
101
104
|
|
|
102
105
|
/** `Table`'s density scale — the kit's canonical `Size` (xs–xl). */
|
|
103
106
|
export type TableSize = Size
|
|
@@ -182,7 +185,7 @@ const TableToolbar = ({ className, testId, ...rest }: TableToolbarProps) => (
|
|
|
182
185
|
{...props({ "data-testid": testId })}
|
|
183
186
|
{...rest}
|
|
184
187
|
className={cn(
|
|
185
|
-
"flex shrink-0 items-center justify-between gap-2 border-b border-brand-900/20 px-3 ps-5 py-3 dark:border-white/
|
|
188
|
+
"flex shrink-0 items-center justify-between gap-2 border-b border-brand-900/20 px-3 ps-5 py-3 dark:border-white/8",
|
|
186
189
|
className,
|
|
187
190
|
)}
|
|
188
191
|
/>
|
|
@@ -71,6 +71,9 @@ export type TabsProps<Data extends TabsData = TabsData> = Omit<
|
|
|
71
71
|
/** Palette for the underline bar + active-trigger text. Scoped to the
|
|
72
72
|
* strip (it lands on the `List`), so it never tints the panel content. */
|
|
73
73
|
color?: Color
|
|
74
|
+
/** Give every tab an even share of the strip, like a tab bar. Lands on the
|
|
75
|
+
* `List`. */
|
|
76
|
+
grow?: boolean
|
|
74
77
|
/** Fires with the selected value (narrowed to the data value union). */
|
|
75
78
|
onChange?: (value: TabsValue<Data>) => void
|
|
76
79
|
}
|
|
@@ -80,6 +83,7 @@ const TabsComponent = <const Data extends TabsData>({
|
|
|
80
83
|
variant,
|
|
81
84
|
size,
|
|
82
85
|
color,
|
|
86
|
+
grow,
|
|
83
87
|
value,
|
|
84
88
|
defaultValue,
|
|
85
89
|
onChange,
|
|
@@ -92,7 +96,7 @@ const TabsComponent = <const Data extends TabsData>({
|
|
|
92
96
|
onValueChange={onChange ? (d) => onChange(d.value as TabsValue<Data>) : undefined}
|
|
93
97
|
{...root}
|
|
94
98
|
>
|
|
95
|
-
<List variant={variant} size={size} color={color}>
|
|
99
|
+
<List variant={variant} size={size} color={color} grow={grow}>
|
|
96
100
|
<Indicator />
|
|
97
101
|
{data.map((item) => (
|
|
98
102
|
<Trigger
|
|
@@ -341,4 +341,32 @@ describe("Tabs", () => {
|
|
|
341
341
|
const indicator = container.querySelector('[data-part="indicator"]') as HTMLElement
|
|
342
342
|
expect(indicator.className).not.toMatch(/(^|\s)z-0(\s|$)/)
|
|
343
343
|
})
|
|
344
|
+
|
|
345
|
+
it("gives every trigger an even share under `List`'s `grow`", () => {
|
|
346
|
+
render(
|
|
347
|
+
<Root defaultValue="a">
|
|
348
|
+
<List grow>
|
|
349
|
+
<Trigger value="a">A</Trigger>
|
|
350
|
+
<Trigger value="b">B</Trigger>
|
|
351
|
+
</List>
|
|
352
|
+
</Root>,
|
|
353
|
+
)
|
|
354
|
+
for (const tab of screen.getAllByRole("tab")) {
|
|
355
|
+
expect(tab.className).toMatch(/(^|\s)flex-1(\s|$)/)
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
it("passes `grow` through the data-driven Tabs to its List", () => {
|
|
360
|
+
render(<Tabs data={ITEMS} grow />)
|
|
361
|
+
for (const tab of screen.getAllByRole("tab")) {
|
|
362
|
+
expect(tab.className).toMatch(/(^|\s)flex-1(\s|$)/)
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
it("keeps the triggers hugging their labels without `grow`", () => {
|
|
367
|
+
render(<Tabs data={ITEMS} />)
|
|
368
|
+
for (const tab of screen.getAllByRole("tab")) {
|
|
369
|
+
expect(tab.className).not.toMatch(/(^|\s)flex-1(\s|$)/)
|
|
370
|
+
}
|
|
371
|
+
})
|
|
344
372
|
})
|
|
@@ -171,6 +171,10 @@ const tabsTrigger = cva(
|
|
|
171
171
|
true: "data-selected:text-(--c-text)",
|
|
172
172
|
false: "data-selected:text-brand-950 dark:data-selected:text-white",
|
|
173
173
|
},
|
|
174
|
+
// An even share of the list per trigger, like a tab bar. Read from
|
|
175
|
+
// `TabsStyleContext` (set by `List`'s `grow`), not a child selector on
|
|
176
|
+
// the list, so a custom element in the list never grows by accident.
|
|
177
|
+
grow: { true: "flex-1" },
|
|
174
178
|
size: {
|
|
175
179
|
xs: "px-2 py-0.5 text-xs",
|
|
176
180
|
sm: "px-2.5 py-1 text-sm",
|
|
@@ -307,6 +311,7 @@ export type TabsVariant = NonNullable<VariantProps<typeof tabsList>["variant"]>
|
|
|
307
311
|
type TabsStyle = {
|
|
308
312
|
variant: TabsVariant
|
|
309
313
|
size: Size
|
|
314
|
+
grow: boolean
|
|
310
315
|
color: Color | undefined
|
|
311
316
|
colors: Readonly<Record<string, Color>>
|
|
312
317
|
setTriggerColor: (value: string, color: Color | undefined) => void
|
|
@@ -315,6 +320,7 @@ type TabsStyle = {
|
|
|
315
320
|
const TabsStyleContext = createContext<TabsStyle>({
|
|
316
321
|
variant: "underline",
|
|
317
322
|
size: "md",
|
|
323
|
+
grow: false,
|
|
318
324
|
color: undefined,
|
|
319
325
|
colors: {},
|
|
320
326
|
setTriggerColor: () => {},
|
|
@@ -356,11 +362,15 @@ export type TabsListProps = Omit<Ark.ListProps, "color"> &
|
|
|
356
362
|
* on the list, so the `--c-*` slots reach the triggers and the indicator
|
|
357
363
|
* without reaching the `Content` panels. */
|
|
358
364
|
color?: Color
|
|
365
|
+
/** Give every trigger an even share of the list's width (its height when
|
|
366
|
+
* vertical), like a tab bar. Without it the triggers hug their labels. */
|
|
367
|
+
grow?: boolean
|
|
359
368
|
}
|
|
360
369
|
|
|
361
370
|
const List = ({
|
|
362
371
|
variant = "underline",
|
|
363
372
|
size = "md",
|
|
373
|
+
grow = false,
|
|
364
374
|
color,
|
|
365
375
|
className,
|
|
366
376
|
testId,
|
|
@@ -375,8 +385,8 @@ const List = ({
|
|
|
375
385
|
})
|
|
376
386
|
}, [])
|
|
377
387
|
const style = useMemo(
|
|
378
|
-
() => ({ variant, size, color, colors, setTriggerColor }),
|
|
379
|
-
[variant, size, color, colors, setTriggerColor],
|
|
388
|
+
() => ({ variant, size, grow, color, colors, setTriggerColor }),
|
|
389
|
+
[variant, size, grow, color, colors, setTriggerColor],
|
|
380
390
|
)
|
|
381
391
|
return (
|
|
382
392
|
<TabsStyleContext.Provider value={style}>
|
|
@@ -401,7 +411,7 @@ export type TabsTriggerProps = Omit<Ark.TriggerProps, "color"> &
|
|
|
401
411
|
}
|
|
402
412
|
|
|
403
413
|
const Trigger = ({ color, className, testId, ...rest }: TabsTriggerProps) => {
|
|
404
|
-
const { variant, size, color: listColor, setTriggerColor } = useContext(TabsStyleContext)
|
|
414
|
+
const { variant, size, grow, color: listColor, setTriggerColor } = useContext(TabsStyleContext)
|
|
405
415
|
const { value } = rest
|
|
406
416
|
useEffect(() => {
|
|
407
417
|
setTriggerColor(value, color)
|
|
@@ -410,7 +420,7 @@ const Trigger = ({ color, className, testId, ...rest }: TabsTriggerProps) => {
|
|
|
410
420
|
return (
|
|
411
421
|
<Ark.Trigger
|
|
412
422
|
className={cn(
|
|
413
|
-
tabsTrigger({ variant, size, colored: (color ?? listColor) !== undefined }),
|
|
423
|
+
tabsTrigger({ variant, size, grow, colored: (color ?? listColor) !== undefined }),
|
|
414
424
|
className,
|
|
415
425
|
)}
|
|
416
426
|
data-color={color}
|
|
@@ -47,28 +47,62 @@ const themeIconVariants = cva(
|
|
|
47
47
|
// intentionally not reused.
|
|
48
48
|
filled:
|
|
49
49
|
"bg-(--c-solid)/15 text-(--c-text) border-[color-mix(in_oklab,var(--c-solid)_35%,black_65%)]",
|
|
50
|
-
light
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
// `light`, `outline` and `subtle` paint through two local properties,
|
|
51
|
+
// `--theme-icon-fill` and `--theme-icon-glyph`, and only the
|
|
52
|
+
// properties change per theme and palette. The `bg-*`/`text-*` stay
|
|
53
|
+
// plain utilities, so a caller's `className` colour replaces them
|
|
54
|
+
// through `cn`: a `dark:` or `data-color` text class would outrank it.
|
|
55
|
+
//
|
|
56
|
+
// Figma tints a hued tile with its solid shade at 30%
|
|
57
|
+
// (`bg-<hue>-secondary`), as Badge's `light` does: `--c-soft` is the
|
|
58
|
+
// -50/-950 end of the scale and fades into the page in both themes.
|
|
59
|
+
// The dark glyph is that solid shade (`fg-<hue>-primary`); the light
|
|
60
|
+
// theme draws it in the palette's text step instead, as Badge does,
|
|
61
|
+
// since a -500 glyph on its own tint over white falls under 3:1 for
|
|
62
|
+
// yellow, orange and green. Neutral (also the no-`color` default,
|
|
63
|
+
// which resolves to the neutral mirror on :root) fills with the
|
|
64
|
+
// black/white-16 overlay its own `--c-soft` already is, and draws its
|
|
65
|
+
// glyph in the solid black/white.
|
|
66
|
+
light: [
|
|
67
|
+
"bg-(--theme-icon-fill) text-(--theme-icon-glyph) border-transparent",
|
|
68
|
+
"[--theme-icon-fill:color-mix(in_oklab,var(--c-solid)_30%,transparent)] [--theme-icon-glyph:var(--c-text)] dark:[--theme-icon-glyph:var(--c-solid)]",
|
|
69
|
+
"not-data-color:[--theme-icon-fill:var(--c-soft)] data-[color=neutral]:[--theme-icon-fill:var(--c-soft)] data-[color=gray]:[--theme-icon-fill:var(--c-soft)]",
|
|
70
|
+
"not-data-color:[--theme-icon-glyph:var(--c-solid)] data-[color=neutral]:[--theme-icon-glyph:var(--c-solid)] data-[color=gray]:[--theme-icon-glyph:var(--c-solid)]",
|
|
71
|
+
],
|
|
72
|
+
// A hued glyph takes the palette's text step (Figma `fg-<hue>-secondary`,
|
|
73
|
+
// the -300). Neutral's text step is the 80% secondary white, but Figma
|
|
74
|
+
// draws its glyph in `fg-primary` — full white, which is neutral's
|
|
75
|
+
// solid shade (black in the light theme).
|
|
76
|
+
outline: [
|
|
77
|
+
"bg-transparent text-(--theme-icon-glyph) border-(--c-solid) [--theme-icon-glyph:var(--c-text)]",
|
|
78
|
+
"not-data-color:[--theme-icon-glyph:var(--c-solid)] data-[color=neutral]:[--theme-icon-glyph:var(--c-solid)] data-[color=gray]:[--theme-icon-glyph:var(--c-solid)]",
|
|
79
|
+
],
|
|
80
|
+
subtle: [
|
|
81
|
+
"bg-transparent text-(--theme-icon-glyph) border-transparent [--theme-icon-glyph:var(--c-text)]",
|
|
82
|
+
"not-data-color:[--theme-icon-glyph:var(--c-solid)] data-[color=neutral]:[--theme-icon-glyph:var(--c-solid)] data-[color=gray]:[--theme-icon-glyph:var(--c-solid)]",
|
|
83
|
+
],
|
|
53
84
|
// Palette-independent neutral surface. Unlike ActionIcon's
|
|
54
85
|
// high-contrast inverted `default` (a black/white button look),
|
|
55
86
|
// this stays a muted card in both themes. It sits on the kit's
|
|
56
|
-
// translucent surface
|
|
57
|
-
//
|
|
58
|
-
//
|
|
87
|
+
// translucent surface (the quiet `bg-black/3 dark:bg-white/4` fill
|
|
88
|
+
// `Kbd` and `Card` share, edged with Figma's `border-secondary`,
|
|
89
|
+
// `dark:border-white/16`) rather than an opaque gray step, so the tile
|
|
59
90
|
// reads on whatever surface hosts it. Light mode darkens because a
|
|
60
91
|
// bare `bg-white/4` vanishes on a near-white page.
|
|
61
92
|
default: [
|
|
62
93
|
"bg-black/3 text-brand-900/70 border-brand-900/20",
|
|
63
|
-
"dark:bg-white/4 dark:text-white/80 dark:border-white/
|
|
94
|
+
"dark:bg-white/4 dark:text-white/80 dark:border-white/16",
|
|
64
95
|
],
|
|
65
96
|
},
|
|
97
|
+
// Figma (ThemeIcon, node 17583-16687): the glyph is 12/14/16/18/22px in
|
|
98
|
+
// a 28/32/36/40/48px tile — under half the tile, so the tile reads as a
|
|
99
|
+
// frame around the icon, not as the icon's own padding.
|
|
66
100
|
size: {
|
|
67
|
-
xs: "h-7 [&_svg]:size-
|
|
68
|
-
sm: "h-8 [&_svg]:size-
|
|
69
|
-
md: "h-9 [&_svg]:size-
|
|
70
|
-
lg: "h-10 [&_svg]:size-
|
|
71
|
-
xl: "h-12 [&_svg]:size-
|
|
101
|
+
xs: "h-7 [&_svg]:size-3",
|
|
102
|
+
sm: "h-8 [&_svg]:size-3.5",
|
|
103
|
+
md: "h-9 [&_svg]:size-4",
|
|
104
|
+
lg: "h-10 [&_svg]:size-4.5",
|
|
105
|
+
xl: "h-12 [&_svg]:size-5.5",
|
|
72
106
|
},
|
|
73
107
|
radius: {
|
|
74
108
|
xs: "rounded-xs",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from "react"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content is sitting in a sidebar collapsed to an icon rail —
|
|
7
|
+
* provided by `AppShell.Sidebar collapse="icons"`, read by anything that has to
|
|
8
|
+
* change *behaviour* there (not just appearance): `NavLink` turns its label
|
|
9
|
+
* into a tooltip on the icon.
|
|
10
|
+
*
|
|
11
|
+
* Kept in `lib` rather than exported from AppShell so a nav component can
|
|
12
|
+
* react to a rail without depending on the shell that draws it. Appearance
|
|
13
|
+
* alone needs no JS: the rail carries `data-sidebar-rail`, and the
|
|
14
|
+
* `sidebar-rail:` variant (theme.css) styles anything inside it.
|
|
15
|
+
*
|
|
16
|
+
* `null` outside a rail-capable sidebar; `{ active: false }` inside one that is
|
|
17
|
+
* expanded (or peeking, labels visible); `{ active: true }` while it shows
|
|
18
|
+
* icons only.
|
|
19
|
+
*/
|
|
20
|
+
export type SidebarRailState = { active: boolean }
|
|
21
|
+
|
|
22
|
+
export const SidebarRailContext = createContext<SidebarRailState | null>(null)
|
|
23
|
+
|
|
24
|
+
export const useSidebarRail = (): SidebarRailState | null => useContext(SidebarRailContext)
|
package/src/theme.css
CHANGED
|
@@ -132,19 +132,19 @@
|
|
|
132
132
|
--color-lime-900: #2b5314;
|
|
133
133
|
--color-lime-950: #15290a;
|
|
134
134
|
|
|
135
|
-
/* Green */
|
|
135
|
+
/* Green — Figma « _Primitives / Success » (42 UI Kit V3). */
|
|
136
136
|
--color-green-25: #f6fef9;
|
|
137
|
-
--color-green-50: #
|
|
138
|
-
--color-green-100: #
|
|
139
|
-
--color-green-200: #
|
|
140
|
-
--color-green-300: #
|
|
141
|
-
--color-green-400: #
|
|
137
|
+
--color-green-50: #ecfdf3;
|
|
138
|
+
--color-green-100: #dcfae6;
|
|
139
|
+
--color-green-200: #abefc6;
|
|
140
|
+
--color-green-300: #75e0a7;
|
|
141
|
+
--color-green-400: #47cd89;
|
|
142
142
|
--color-green-500: #17b26a;
|
|
143
143
|
--color-green-600: #079455;
|
|
144
144
|
--color-green-700: #067647;
|
|
145
|
-
--color-green-800: #
|
|
146
|
-
--color-green-900: #
|
|
147
|
-
--color-green-950: #
|
|
145
|
+
--color-green-800: #085d3a;
|
|
146
|
+
--color-green-900: #074d31;
|
|
147
|
+
--color-green-950: #053321;
|
|
148
148
|
|
|
149
149
|
/* Teal */
|
|
150
150
|
--color-teal-25: #f6fefc;
|
|
@@ -202,19 +202,20 @@
|
|
|
202
202
|
--color-purple-900: #3e1c96;
|
|
203
203
|
--color-purple-950: #27115f;
|
|
204
204
|
|
|
205
|
-
/* Pink
|
|
206
|
-
|
|
207
|
-
--color-pink-
|
|
208
|
-
--color-pink-
|
|
209
|
-
--color-pink-
|
|
210
|
-
--color-pink-
|
|
211
|
-
--color-pink-
|
|
212
|
-
--color-pink-
|
|
213
|
-
--color-pink-
|
|
214
|
-
--color-pink-
|
|
215
|
-
--color-pink-
|
|
216
|
-
--color-pink-
|
|
217
|
-
--color-pink-
|
|
205
|
+
/* Pink — Figma « _Primitives / Pink » (42 UI Kit V3): a mauve, not the
|
|
206
|
+
Untitled UI fuchsia this ramp started from. */
|
|
207
|
+
--color-pink-25: #fcf8fb;
|
|
208
|
+
--color-pink-50: #fbf4f9;
|
|
209
|
+
--color-pink-100: #f7ecf5;
|
|
210
|
+
--color-pink-200: #f2d8ed;
|
|
211
|
+
--color-pink-300: #e7bade;
|
|
212
|
+
--color-pink-400: #d88ec9;
|
|
213
|
+
--color-pink-500: #c86cb6;
|
|
214
|
+
--color-pink-600: #b44e9f;
|
|
215
|
+
--color-pink-700: #9a3c87;
|
|
216
|
+
--color-pink-800: #7f3570;
|
|
217
|
+
--color-pink-900: #6c2f60;
|
|
218
|
+
--color-pink-950: #3f1c38;
|
|
218
219
|
|
|
219
220
|
/* Rose */
|
|
220
221
|
--color-rose-25: #fff5f6;
|
|
@@ -1417,7 +1418,11 @@ body {
|
|
|
1417
1418
|
color-mix(in oklch, var(--color-brand-700) 13%, transparent),
|
|
1418
1419
|
transparent 70%
|
|
1419
1420
|
);
|
|
1420
|
-
|
|
1421
|
+
/* The dark grain, tuned against Figma's « Background / Cosmos » (2026-10-29): fine
|
|
1422
|
+
(frequency 1, a pixel-sized grain like Figma's tiled noise) and lightly coloured — each
|
|
1423
|
+
channel swings with its own turbulence around the same light-blue tint (×2, ×2, ×1.6),
|
|
1424
|
+
where Figma's grain is speckled blue and violet. Same weight: one inline SVG, no image. */
|
|
1425
|
+
--ambient-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='2' stitchTiles='stitch' result='t'/%3E%3CfeColorMatrix in='t' type='matrix' values='2 0 0 0 -0.427 0 2 0 0 -0.31 0 0 1.6 0 0.18 0 0 0 1 0' result='c'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='gamma' amplitude='0.1' exponent='2' offset='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
|
|
1421
1426
|
}
|
|
1422
1427
|
|
|
1423
1428
|
/* The starfield's motion (`withStarfield`, see ambient-background/starfield.tsx).
|
|
@@ -1429,10 +1434,6 @@ body {
|
|
|
1429
1434
|
--animate-ambient-star-twinkle: ambient-star-twinkle 8s ease-in-out infinite;
|
|
1430
1435
|
/* The dust dims the same way, deeper and slower, one group per layer. */
|
|
1431
1436
|
--animate-ambient-star-dim: ambient-star-dim 17s ease-in-out infinite;
|
|
1432
|
-
/* The nebula's clouds swing slowly away and back, each by its own drift
|
|
1433
|
-
(`--drift-*`, set per cloud): moved, swollen a little and thinned out at
|
|
1434
|
-
the far end, eased at both. */
|
|
1435
|
-
--animate-ambient-nebula-drift: ambient-nebula-drift 90s ease-in-out infinite alternate;
|
|
1436
1437
|
/* A meteor's whole cycle is mostly waiting: it streaks across in the first
|
|
1437
1438
|
2% (about a second of its long cycle), its tail growing behind the head
|
|
1438
1439
|
as it fades in and burning out before it stops, then nothing until the
|
|
@@ -1460,13 +1461,6 @@ body {
|
|
|
1460
1461
|
}
|
|
1461
1462
|
}
|
|
1462
1463
|
|
|
1463
|
-
@keyframes ambient-nebula-drift {
|
|
1464
|
-
to {
|
|
1465
|
-
transform: translate3d(var(--drift-x), var(--drift-y), 0) scale(var(--drift-scale));
|
|
1466
|
-
opacity: var(--drift-fade);
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
1464
|
@keyframes ambient-meteor {
|
|
1471
1465
|
0% {
|
|
1472
1466
|
opacity: 0;
|
|
@@ -1484,7 +1478,7 @@ body {
|
|
|
1484
1478
|
|
|
1485
1479
|
/* `motion-safe:` reads only the OS setting; apps that let people choose
|
|
1486
1480
|
in-app set `data-motion="reduced"` on `<html>`, and the sky stills for that
|
|
1487
|
-
too: no
|
|
1481
|
+
too: no dimming, no twinkle, no meteors. */
|
|
1488
1482
|
:where(:root[data-motion="reduced"]) {
|
|
1489
1483
|
.ambient-starfield,
|
|
1490
1484
|
.ambient-starfield * {
|
|
@@ -1509,5 +1503,11 @@ body {
|
|
|
1509
1503
|
> &
|
|
1510
1504
|
);
|
|
1511
1505
|
|
|
1506
|
+
/* Inside an `AppShell.Sidebar collapse="icons"` while it shows icons only:
|
|
1507
|
+
hide what doesn't fit a 68px rail (`sidebar-rail:hidden` on a logo's
|
|
1508
|
+
wordmark, a footer's user name). Matches the rail itself too. NavLink uses it
|
|
1509
|
+
for its label, endSlot, chevron. */
|
|
1510
|
+
@custom-variant sidebar-rail (&:where([data-sidebar-rail], [data-sidebar-rail] *));
|
|
1511
|
+
|
|
1512
1512
|
/* Variants to use with slider's values */
|
|
1513
1513
|
@custom-variant state-under-or-at (&:is([data-state="under-value"], [data-state="at-value"]));
|
package/src/theme.test.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/card/card.tsx"],"names":[],"mappings":";;;;;;;;AAcA,IAAM,YAAA,GAAe,IAAI,mCAAA,EAAqC;AAAA,EAC5D,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,M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EAAW;AAAA,MAClE;AAAA,KACF;AAAA,IACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAKF,IAAM,cAAc,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBAChD,GAAA;AAAA,EAAC,GAAA,CAAI,GAAA;AAAA,EAAJ;AAAA,IACC,SAAA,EAAW,EAAA,CAAG,kBAAA,EAAoB,SAAS,CAAA;AAAA,IAC1C,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAKF,IAAM,UAAA,GAAa,CAAC,EAAE,SAAA,EAAW,YAAY,MAAA,EAAQ,GAAG,MAAK,qBAC3D,GAAA;AAAA,EAAC,GAAA,CAAI,GAAA;AAAA,EAAJ;AAAA,IACC,SAAA,EAAW,EAAA;AAAA,MACT,+CAAA;AAAA,MACA,EAAE,qDAAqD,UAAA,EAAW;AAAA,MAClE;AAAA,KACF;AAAA,IACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAGK,IAAM,IAAA,GAAO,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe;AAAA,EAC/C,MAAA,EAAQ,UAAA;AAAA,EACR,KAAA,EAAO,SAAA;AAAA,EACP,WAAA,EAAa,eAAA;AAAA,EACb,OAAA,EAAS,WAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAC","file":"chunk-2MXWEIMD.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport {\n buildGradientVars,\n GRADIENT_DIR_BEFORE_CLASS,\n type GradientDir,\n type GradientProps,\n} from \"../../lib/gradient\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\nconst cardVariants = cva(\"flex flex-col rounded-card border\", {\n variants: {\n variant: {\n // Matches the 42 UI Kit Figma's card chrome — navy text in light\n // theme, white text in dark theme (a straight inversion, confirmed\n // against Figma's own light-mode test frame). The 4% white overlay\n // (Figma's own bg-primary token) is Figma's dark-theme elevation\n // tint — meant to sit on an already-dark page, lightening whatever's\n // behind it rather than imposing a flat hue — used here in both\n // themes for a consistently subtle surface.\n //\n // The border is the kit's hairline, `border-brand-900/20\n // dark:border-white/15` — the same pair `Input`'s shell,\n // `SegmentGroup` and `ChoiceCardGroup` draw. It used to sit at\n // /30 ÷ /10, brand-tinted but off by an opacity step from everything\n // else, left over from an earlier partial alignment pass.\n default: [\n \"bg-white/4 text-brand-950 border-brand-900/20\",\n \"dark:text-white dark:border-white/15\",\n ],\n filled: \"bg-(--c-solid) text-(--c-on-solid) border-(--c-solid)\",\n light: \"bg-(--c-soft) text-(--c-text) border-(--c-soft)\",\n outline: \"bg-white/4 text-(--c-text) border-(--c-solid)\",\n // from-(--card-gradient-from) / to-(--card-gradient-to) read CSS vars\n // cascaded from the card element's inline style via buildGradientVars().\n // The ring inherits the host's radius per corner, so a `className`\n // radius reshapes it too. `-inset-px` spans the transparent border, so\n // the ring covers the border box, the box that radius shapes.\n gradient: [\n \"relative isolate border-transparent bg-white/4\",\n TEXT_COLOR_CLASSES.primary,\n \"before:absolute before:-inset-px before:-z-10 before:rounded-[inherit] before:p-px\",\n \"before:bg-linear-to-r\",\n \"before:from-(--card-gradient-from) before:to-(--card-gradient-to)\",\n \"before:mask before:mask-exclude\",\n ],\n },\n padding: {\n none: \"p-0\",\n xs: \"p-2\",\n sm: \"p-3\",\n md: \"p-4\",\n lg: \"p-6\",\n xl: \"p-8\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n padding: \"md\",\n },\n})\n\nexport type CardVariant = NonNullable<VariantProps<typeof cardVariants>[\"variant\"]>\n\nexport type { GradientDir, GradientProps }\n\nexport type CardProps = HTMLArkProps<\"div\"> &\n VariantProps<typeof cardVariants> &\n WithTestId & {\n color?: Color\n /**\n * Gradient config. Only applied when `variant=\"gradient\"`.\n * Mirrors Tailwind's from-* / to-* / via-* utilities via CSS vars so\n * the ::before pseudo-element gradient is fully controlled from props.\n * Unset fields fall back to purple-300 → pink-400, to-r.\n */\n gradient?: GradientProps\n }\n\n/**\n * Card — a bordered content surface. Combines a `variant` (shape) with a\n * `color` (palette) like the rest of the kit, and exposes its regions as\n * namespaced parts: `Card.Header`, `Card.Title`, `Card.Description`,\n * `Card.Content`, `Card.Footer`. Use `padding=\"none\"` when composing the parts\n * so they own the spacing.\n *\n * <Card variant=\"light\" color=\"green\" padding=\"none\">\n * <Card.Header>\n * <Card.Title>Title</Card.Title>\n * <Card.Description>Supporting text.</Card.Description>\n * </Card.Header>\n * <Card.Content>Body</Card.Content>\n * <Card.Footer><Button size=\"sm\">Action</Button></Card.Footer>\n * </Card>\n *\n * `Card.Header`, `Card.Description`, and `Card.Footer` each take a `withBorder`\n * boolean (default `false`) that draws a separator on the edge facing the\n * content — bottom for `Header`, top for `Description` / `Footer` — for when\n * a section needs visual separation from its neighbor. `Card.Content` has no\n * `withBorder`: it sits between the two, so `Header` / `Footer` already own\n * that edge.\n */\nconst CardComponent = ({\n className,\n variant,\n padding,\n color,\n gradient,\n style,\n testId,\n ...rest\n}: CardProps) => {\n const isGradient = variant === \"gradient\"\n\n return (\n <ark.div\n data-color={isGradient ? undefined : color}\n style={\n isGradient\n ? {\n ...buildGradientVars(gradient, {\n fromVar: \"--card-gradient-from\",\n toVar: \"--card-gradient-to\",\n viaVar: \"--card-gradient-via\",\n fromDefault: \"var(--color-purple-300)\",\n toDefault: \"var(--color-pink-400)\",\n }),\n ...style,\n }\n : style\n }\n className={cn(\n cardVariants({ variant, padding }),\n isGradient && gradient?.dir && GRADIENT_DIR_BEFORE_CLASS[gradient.dir],\n isGradient && gradient?.via && \"before:via-(--card-gradient-via)\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type CardHeaderProps = HTMLArkProps<\"div\"> & WithTestId & { withBorder?: boolean }\n\nconst CardHeader = ({ className, withBorder, testId, ...rest }: CardHeaderProps) => (\n <ark.div\n className={cn(\n \"flex flex-col gap-1 px-4 py-3\",\n { \"border-b border-brand-900/20 dark:border-white/15\": withBorder },\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardTitleProps = HTMLArkProps<\"h3\"> & WithTestId\n\nconst CardTitle = ({ className, testId, ...rest }: CardTitleProps) => (\n <ark.h3\n className={cn(\"font-semibold tracking-normal\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardDescriptionProps = HTMLArkProps<\"p\"> & WithTestId & { withBorder?: boolean }\n\nconst CardDescription = ({ className, withBorder, testId, ...rest }: CardDescriptionProps) => (\n <ark.p\n className={cn(\n \"text-sm\",\n TEXT_COLOR_CLASSES.muted,\n { \"border-t border-brand-900/20 dark:border-white/15\": withBorder },\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardContentProps = HTMLArkProps<\"div\"> & WithTestId\n\nconst CardContent = ({ className, testId, ...rest }: CardContentProps) => (\n <ark.div\n className={cn(\"flex-1 px-4 py-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type CardFooterProps = HTMLArkProps<\"div\"> & WithTestId & { withBorder?: boolean }\n\nconst CardFooter = ({ className, withBorder, testId, ...rest }: CardFooterProps) => (\n <ark.div\n className={cn(\n \"flex items-center justify-end gap-2 px-4 py-3\",\n { \"border-t border-brand-900/20 dark:border-white/15\": withBorder },\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Card = Object.assign(CardComponent, {\n Header: CardHeader,\n Title: CardTitle,\n Description: CardDescription,\n Content: CardContent,\n Footer: CardFooter,\n})\n"]}
|
|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A,EAAa,IAAA,EAAE,gBAAM,aAAA,EAAc;AAAA,SAAA,EACpD,CAAA;AAAA,QAEC,QAAA,mBACC,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,SAAA,CAAU,EAAE,IAAA,EAAM,CAAA,EAAG,UAAA,EAAY,KAAK,CAAA,EACtD,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,0BACD,GAAA,CAAC,cAAW,WAAA,EAA0B,KAAA,EAAc,MAClD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB,CAAA,EACjD;AAAA,SAAA,EACF,oBAEA,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,0BACD,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,WAAA;AAAA,cACA,KAAA;AAAA,cACA,IAAA;AAAA,cACA,WAAW,UAAA,EAAY,KAAA;AAAA,cAEvB,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB;AAAA;AAAA;AACjD,SAAA,EACF;AAAA;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-6VYGK3Q3.js","sourcesContent":["\"use client\"\n\nimport { Checkbox as Ark } from \"@ark-ui/react/checkbox\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Minus } from \"lucide-react\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { FieldShell, fieldA11yProps, fieldLabel, fieldRoot, requiredMark } from \"../field/field\"\nimport { CheckIcon } from \"../popover/icons\"\nimport { type ControlIndicatorVariant, controlIndicator } from \"./control\"\n\n/**\n * Checkbox — a single boolean (or tri-state) control on Ark UI's Checkbox\n * machine. The label sits inline beside the box, rendered through the\n * checkbox's own `Ark.Label` part (not `Field`'s) so it stays correctly\n * wired to the hidden input's `aria-labelledby` and — critically — carries no\n * layout footprint when it's visually hidden (e.g. `classNames.label:\n * \"sr-only\"`): an absolutely-positioned flex child isn't a flex item at all,\n * so it can't pick up the root's `gap-2`. `description` / `error` live below\n * it via the shared `Field` scaffold, so a `Checkbox` is accessible and\n * complete on its own. Implements the kit's `FormControlProps` contract: the\n * `ref` and `onBlur` land on the submittable hidden `<input>`, and `name`\n * wires it into native form submission.\n *\n * - The checked state is `boolean | \"indeterminate\"`; `onCheckedChange`\n * hands you that next value directly (the indeterminate state never sets\n * itself — drive it from the parent, e.g. a \"select all\" header).\n * - `invalid` is OR'd with `error != null`, matching the rest of the family,\n * so a form library can flip the red state independently of the message.\n *\n * Two `variant`s decide the checked fill: `default` is a neutral, monochrome\n * box (palette-independent), while `filled` tints the checked fill with the\n * active palette via `data-color` + the `--c-solid` slot var. The box is\n * palette-independent at rest, and the focus ring is always the brand ring.\n */\n\nexport type CheckboxIconSlot = \"check\" | \"indeterminate\"\nexport type CheckboxIcons = IconMap<CheckboxIconSlot>\n\n/** The default marks: a check, and a dash for the indeterminate state. */\nexport const DEFAULT_ICONS: Record<CheckboxIconSlot, ReactNode> = {\n check: <CheckIcon />,\n indeterminate: <Minus className={iconStroke} />,\n}\n\nexport type CheckboxProps = WithTestId & {\n /** Controlled checked state. `\"indeterminate\"` renders the partial mark. */\n checked?: boolean | \"indeterminate\"\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean | \"indeterminate\"\n /** Fires with the next checked state (a value, not a DOM event). */\n onCheckedChange?: (checked: boolean | \"indeterminate\") => void\n /** Inline label beside the box. */\n label?: ReactNode\n /** Helper text above the control. */\n description?: ReactNode\n /** Error message below the control; its presence sets the invalid state. */\n error?: ReactNode\n /** Required flag (and, with a label, the red asterisk). */\n required?: boolean\n /** Red invalid state, OR'd with `error != null`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n size?: Size\n /** Checked-fill treatment: `default` (monochrome) or `filled` (palette-colored). */\n variant?: ControlIndicatorVariant\n color?: Color\n /** Field name for native form submission. */\n name?: string\n /** Submitted value when checked (defaults to `\"on\"`). */\n value?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the hidden `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the hidden `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Replaces the marks: `check` and `indeterminate`. A missing key keeps its default. */\n icons?: CheckboxIcons\n className?: string\n classNames?: {\n root?: string\n control?: string\n label?: string\n field?: string\n }\n}\n\n/**\n * The real, submittable hidden `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `Checkbox` itself renders that shell, so calling `useFieldContext()`\n * at its own top level would run too early. Same pattern as `Switch`: `fieldA11yProps` points\n * `aria-describedby` at the error once invalid (Ark's own tracking doesn't reliably catch up) and\n * adds `aria-errormessage`. Its `aria-labelledby` is left out: this `Field` never renders a label\n * (the checkbox's own `Ark.Label` names the input), so it would point at nothing.\n */\nconst CheckboxHiddenInput = ({ ref, onBlur }: Pick<CheckboxProps, \"ref\" | \"onBlur\">) => {\n const { \"aria-labelledby\": _unrendered, ...described } = fieldA11yProps(useFieldContext())\n return <Ark.HiddenInput ref={ref} onBlur={onBlur} {...described} />\n}\n\nexport const Checkbox = ({\n checked,\n defaultChecked,\n onCheckedChange,\n label,\n description,\n error,\n required,\n invalid,\n disabled,\n readOnly,\n size = \"md\",\n variant,\n color,\n name,\n value,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n icons: iconsProp,\n}: CheckboxProps) => {\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n // A visible label above description/error needs the two grouped into one\n // flex-col item, or they'd land side by side in the root's row instead of\n // stacked. Label-only (incl. sr-only) never needs this extra wrapper.\n const hasStack = label != null && (description != null || error != null)\n\n const labelNode = label != null && (\n <Ark.Label\n className={cn(fieldLabel({ size }), !hasStack && \"min-w-0 flex-1\", classNames?.label)}\n >\n {label}\n {required && (\n <span aria-hidden=\"true\" {...requiredMark}>\n *\n </span>\n )}\n </Ark.Label>\n )\n\n return (\n <Ark.Root\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={onCheckedChange ? (d) => onCheckedChange(d.checked) : undefined}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n value={value}\n id={id}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\n \"relative inline-flex items-center gap-2 select-none\",\n className,\n classNames?.root,\n )}\n >\n <Ark.Control className={cn(controlIndicator({ size, variant }), classNames?.control)}>\n <Ark.Indicator>{icons.check}</Ark.Indicator>\n <Ark.Indicator indeterminate>{icons.indeterminate}</Ark.Indicator>\n </Ark.Control>\n\n {hasStack ? (\n <div className={cn(fieldRoot({ size }), classNames?.field)}>\n {labelNode}\n <FieldShell description={description} error={error} size={size}>\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </div>\n ) : (\n <>\n {labelNode}\n <FieldShell\n description={description}\n error={error}\n size={size}\n className={classNames?.field}\n >\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </>\n )}\n </Ark.Root>\n )\n}\n"]}
|