@namroodinc/liquid-editorial 0.11.0 → 0.13.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/README.md +44 -20
- package/UPGRADING.md +322 -0
- package/dist/chunks/{Avatar-DPnrvkwd.cjs → Avatar-BY0dAItT.cjs} +2 -2
- package/dist/chunks/{Avatar-DPnrvkwd.cjs.map → Avatar-BY0dAItT.cjs.map} +1 -1
- package/dist/chunks/{Avatar-BK8IdL5W.js → Avatar-UjhjcHh5.js} +2 -2
- package/dist/chunks/{Avatar-BK8IdL5W.js.map → Avatar-UjhjcHh5.js.map} +1 -1
- package/dist/chunks/{Board-Cnyqrc-R.js → Board-BCS7sDXg.js} +13 -5
- package/dist/chunks/{Board-Cnyqrc-R.js.map → Board-BCS7sDXg.js.map} +1 -1
- package/dist/chunks/{Board-DFuJt2Oh.cjs → Board-CNVy8gHI.cjs} +2 -2
- package/dist/chunks/Board-CNVy8gHI.cjs.map +1 -0
- package/dist/chunks/CollectionView-CIJdNwcq.cjs +2 -0
- package/dist/chunks/CollectionView-CIJdNwcq.cjs.map +1 -0
- package/dist/chunks/{CollectionView-Vj84E26b.js → CollectionView-JRNdXHti.js} +5 -5
- package/dist/chunks/CollectionView-JRNdXHti.js.map +1 -0
- package/dist/chunks/{ColourField-DkO8tjeB.js → ColourField-BTj9NHgI.js} +147 -153
- package/dist/chunks/ColourField-BTj9NHgI.js.map +1 -0
- package/dist/chunks/ColourField-DuoVeXjG.cjs +2 -0
- package/dist/chunks/ColourField-DuoVeXjG.cjs.map +1 -0
- package/dist/chunks/DatePicker-BYpGsfL4.cjs +2 -0
- package/dist/chunks/DatePicker-BYpGsfL4.cjs.map +1 -0
- package/dist/chunks/{DatePicker-B8tllGYy.js → DatePicker-Cb5WspIC.js} +22 -22
- package/dist/chunks/DatePicker-Cb5WspIC.js.map +1 -0
- package/dist/chunks/{Drawer-DTtgAZO2.js → Drawer-Ck5XKT_V.js} +4 -4
- package/dist/chunks/Drawer-Ck5XKT_V.js.map +1 -0
- package/dist/chunks/Drawer-DdIH9jpe.cjs +2 -0
- package/dist/chunks/Drawer-DdIH9jpe.cjs.map +1 -0
- package/dist/chunks/EntryPicker-CCCoJxbd.cjs +2 -0
- package/dist/chunks/EntryPicker-CCCoJxbd.cjs.map +1 -0
- package/dist/chunks/{EntryPicker-KxHZzZsh.js → EntryPicker-DLCP4S-q.js} +4 -4
- package/dist/chunks/EntryPicker-DLCP4S-q.js.map +1 -0
- package/dist/chunks/{FormEditor-BJcAIVcL.cjs → FormEditor-ArvjKtJJ.cjs} +2 -2
- package/dist/chunks/{FormEditor-BJcAIVcL.cjs.map → FormEditor-ArvjKtJJ.cjs.map} +1 -1
- package/dist/chunks/{FormEditor-CdLqPaKK.js → FormEditor-DnNBv9Xf.js} +16 -16
- package/dist/chunks/{FormEditor-CdLqPaKK.js.map → FormEditor-DnNBv9Xf.js.map} +1 -1
- package/dist/chunks/{Message-CyLq9ef-.js → Message-C73sJfdo.js} +4 -8
- package/dist/chunks/{Message-CyLq9ef-.js.map → Message-C73sJfdo.js.map} +1 -1
- package/dist/chunks/{Message-D3b8HDhm.cjs → Message-CIKSTXp8.cjs} +2 -2
- package/dist/chunks/{Message-D3b8HDhm.cjs.map → Message-CIKSTXp8.cjs.map} +1 -1
- package/dist/chunks/RichTextEditor--kMao88d.cjs +2 -0
- package/dist/chunks/RichTextEditor--kMao88d.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-DmNM63Wg.js → RichTextEditor-CvbboqJY.js} +397 -380
- package/dist/chunks/RichTextEditor-CvbboqJY.js.map +1 -0
- package/dist/chunks/{dialogLabel-D18maX-p.js → dialogLabel-DT7rCr3_.js} +19 -19
- package/dist/chunks/{dialogLabel-D18maX-p.js.map → dialogLabel-DT7rCr3_.js.map} +1 -1
- package/dist/chunks/{dialogLabel-2HRYMHbF.cjs → dialogLabel-_-MTckE_.cjs} +2 -2
- package/dist/chunks/{dialogLabel-2HRYMHbF.cjs.map → dialogLabel-_-MTckE_.cjs.map} +1 -1
- package/dist/chunks/overlayLayer-iGhuAByk.cjs +2 -0
- package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +1 -0
- package/dist/chunks/{overlayLayer-IuoPVwTO.js → overlayLayer-lU4iWSjO.js} +32 -28
- package/dist/chunks/overlayLayer-lU4iWSjO.js.map +1 -0
- package/dist/chunks/{group-7Z_xRlQx.js → style-7Z_xRlQx.js} +1 -1
- package/dist/chunks/{group-7Z_xRlQx.js.map → style-7Z_xRlQx.js.map} +1 -1
- package/dist/chunks/{group-nulIa2_8.cjs → style-nulIa2_8.cjs} +1 -1
- package/dist/chunks/{group-nulIa2_8.cjs.map → style-nulIa2_8.cjs.map} +1 -1
- package/dist/chunks/use-picker-session-Bue5MJHQ.cjs +2 -0
- package/dist/chunks/use-picker-session-Bue5MJHQ.cjs.map +1 -0
- package/dist/chunks/{use-picker-session-BDEWL2jK.js → use-picker-session-DUO4G8Cs.js} +4 -4
- package/dist/chunks/use-picker-session-DUO4G8Cs.js.map +1 -0
- package/dist/chunks/{useTooltip-BXAvQwt4.cjs → useTooltip-C7ON4nkV.cjs} +2 -2
- package/dist/chunks/{useTooltip-BXAvQwt4.cjs.map → useTooltip-C7ON4nkV.cjs.map} +1 -1
- package/dist/chunks/{useTooltip-BrC7FdeH.js → useTooltip-DnJEFBLg.js} +2 -2
- package/dist/chunks/{useTooltip-BrC7FdeH.js.map → useTooltip-DnJEFBLg.js.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.cjs.map +1 -1
- package/dist/components/AssetCard/index.d.cts.map +1 -1
- package/dist/components/AssetCard/index.d.ts.map +1 -1
- package/dist/components/AssetCard/index.js +16 -16
- package/dist/components/AssetCard/index.js.map +1 -1
- package/dist/components/AssetCard/style.css +47 -46
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.cjs.map +1 -1
- package/dist/components/AssetGrid/index.d.cts +0 -2
- package/dist/components/AssetGrid/index.d.cts.map +1 -1
- package/dist/components/AssetGrid/index.d.ts +0 -2
- package/dist/components/AssetGrid/index.d.ts.map +1 -1
- package/dist/components/AssetGrid/index.js +15 -15
- package/dist/components/AssetGrid/index.js.map +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Avatar/style.css +26 -5
- package/dist/components/Badge/index.cjs +1 -1
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.cts +2 -3
- package/dist/components/Badge/index.d.cts.map +1 -1
- package/dist/components/Badge/index.d.ts +2 -3
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/style.css +29 -35
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Board/style.css +37 -16
- package/dist/components/Button/style.css +17 -12
- package/dist/components/ButtonGroup/index.cjs.map +1 -1
- package/dist/components/ButtonGroup/index.d.cts +1 -1
- package/dist/components/ButtonGroup/index.d.ts +1 -1
- package/dist/components/ButtonGroup/index.js.map +1 -1
- package/dist/components/ButtonGroup/style.css +4 -20
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +3 -3
- package/dist/components/Choice/index.js.map +1 -1
- package/dist/components/Choice/style.css +34 -22
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/CollectionView/style.css +8 -11
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.d.cts.map +1 -1
- package/dist/components/ColourField/index.d.ts.map +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/ColourField/style.css +31 -20
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DatePicker/style.css +10 -3
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/Drawer/style.css +10 -23
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.js +4 -4
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EditLayout/style.css +5 -6
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/style.css +46 -20
- package/dist/components/Field/style.css +6 -5
- package/dist/components/FormEditor/README.md +28 -19
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/style.css +1 -0
- package/dist/components/ImageCropper/style.css +20 -20
- package/dist/components/LimitReading/style.css +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/style.css +3 -3
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/style.css +6 -6
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +58 -55
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Popover/style.css +2 -2
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
- package/dist/components/RichTextEditor/style.css +123 -75
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.d.cts.map +1 -1
- package/dist/components/SelectionCard/index.d.ts.map +1 -1
- package/dist/components/SelectionCard/index.js +7 -3
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/SelectionCard/style.css +30 -48
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.cjs.map +1 -1
- package/dist/components/SideNav/index.d.cts +3 -3
- package/dist/components/SideNav/index.d.ts +3 -3
- package/dist/components/SideNav/index.js +15 -3
- package/dist/components/SideNav/index.js.map +1 -1
- package/dist/components/SideNav/style.css +19 -13
- package/dist/components/Skeleton/style.css +1 -1
- package/dist/components/Slider/style.css +19 -32
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.cjs.map +1 -1
- package/dist/components/SortableList/index.js +6 -2
- package/dist/components/SortableList/index.js.map +1 -1
- package/dist/components/SortableList/style.css +20 -5
- package/dist/components/Stepper/style.css +8 -9
- package/dist/components/SubNav/index.cjs.map +1 -1
- package/dist/components/SubNav/index.d.cts +2 -2
- package/dist/components/SubNav/index.d.ts +2 -2
- package/dist/components/SubNav/index.js.map +1 -1
- package/dist/components/SubNav/style.css +3 -8
- package/dist/components/Switch/index.cjs +1 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js +3 -2
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/style.css +26 -6
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.cjs.map +1 -1
- package/dist/components/Table/index.js +2 -2
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/style.css +34 -22
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.js +1 -1
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TagsInput/style.css +12 -5
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Time/style.css +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Toast/style.css +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.cjs.map +1 -1
- package/dist/components/TopNav/index.d.cts +4 -4
- package/dist/components/TopNav/index.d.ts +4 -4
- package/dist/components/TopNav/index.js +5 -1
- package/dist/components/TopNav/index.js.map +1 -1
- package/dist/components/TopNav/style.css +6 -9
- package/dist/elements.css +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -44
- package/dist/internal/dialogFocus.d.cts +2 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +2 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/dist/message.css +13 -17
- package/dist/tokens.css +112 -280
- package/package.json +1 -1
- package/dist/chunks/Board-DFuJt2Oh.cjs.map +0 -1
- package/dist/chunks/CollectionView-BNYx29b1.cjs +0 -2
- package/dist/chunks/CollectionView-BNYx29b1.cjs.map +0 -1
- package/dist/chunks/CollectionView-Vj84E26b.js.map +0 -1
- package/dist/chunks/ColourField--rS9KDpq.cjs +0 -2
- package/dist/chunks/ColourField--rS9KDpq.cjs.map +0 -1
- package/dist/chunks/ColourField-DkO8tjeB.js.map +0 -1
- package/dist/chunks/DatePicker-B8tllGYy.js.map +0 -1
- package/dist/chunks/DatePicker-OiqjoO-f.cjs +0 -2
- package/dist/chunks/DatePicker-OiqjoO-f.cjs.map +0 -1
- package/dist/chunks/Drawer-BDX9_qHA.cjs +0 -2
- package/dist/chunks/Drawer-BDX9_qHA.cjs.map +0 -1
- package/dist/chunks/Drawer-DTtgAZO2.js.map +0 -1
- package/dist/chunks/EntryPicker-BI_7g2Wg.cjs +0 -2
- package/dist/chunks/EntryPicker-BI_7g2Wg.cjs.map +0 -1
- package/dist/chunks/EntryPicker-KxHZzZsh.js.map +0 -1
- package/dist/chunks/RichTextEditor-BXyhSeJd.cjs +0 -2
- package/dist/chunks/RichTextEditor-BXyhSeJd.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-DmNM63Wg.js.map +0 -1
- package/dist/chunks/overlayLayer-IuoPVwTO.js.map +0 -1
- package/dist/chunks/overlayLayer-seJG-EFn.cjs +0 -2
- package/dist/chunks/overlayLayer-seJG-EFn.cjs.map +0 -1
- package/dist/chunks/use-picker-session-BDEWL2jK.js.map +0 -1
- package/dist/chunks/use-picker-session-C4FGinLN.cjs +0 -2
- package/dist/chunks/use-picker-session-C4FGinLN.cjs.map +0 -1
- package/dist/components/ColourField/focus.d.cts +0 -3
- package/dist/components/ColourField/focus.d.cts.map +0 -1
- package/dist/components/ColourField/focus.d.ts +0 -3
- package/dist/components/ColourField/focus.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,wEAAwE;AACxE,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,eAAe,CAAC;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,iGAAiG;IACjG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,wGA0ChB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef as e } from "react";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/Badge/index.tsx
|
|
4
|
-
var r = e(function({ shape: e = "tag", size: r = "md", tone: i, appearance: a = "
|
|
4
|
+
var r = e(function({ shape: e = "tag", size: r = "md", tone: i, appearance: a = "soft", isCountExact: o = !1, className: s, children: c, ...l }, u) {
|
|
5
5
|
if (e === "count" && !o) {
|
|
6
6
|
let e = Number(c);
|
|
7
7
|
if (!Number.isNaN(e)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Badge","forwardRef","rest","shape","isCountExact","value","children","size","appearance","tone","className"],"sources":["../../../src/components/Badge/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type BadgeShape = \"status\" | \"tag\" | \"count\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * How much ink the badge spends.\n * - `
|
|
1
|
+
{"version":3,"file":"index.js","names":["Badge","forwardRef","rest","shape","isCountExact","value","children","size","appearance","tone","className"],"sources":["../../../src/components/Badge/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type BadgeShape = \"status\" | \"tag\" | \"count\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * How much ink the badge spends.\n * - `soft` — the tone's soft fill behind tone-coloured text. The default.\n * - `solid` — the tone as a full fill. Reserve it for the one state a row is\n * really about; a table of solid badges reads as noise.\n */\nexport type BadgeAppearance = \"soft\" | \"solid\";\n\n/** Six publication states, and no seventh without a decision record. */\nexport type StatusTone =\n \"draft\" | \"scheduled\" | \"published\" | \"changed\" | \"unpublished\" | \"archived\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n shape?: BadgeShape;\n /** `md` keeps the standard size; `sm` condenses labels for dense layouts. */\n size?: BadgeSize;\n /** Required on `status`, forbidden on `tag` and `count`. */\n tone?: StatusTone;\n appearance?: BadgeAppearance;\n /** Show count values in full, including zero. Other count badges keep their compact defaults. */\n isCountExact?: boolean;\n children?: ReactNode;\n}\n\n/**\n * A small, non-interactive label attached to something else. Never a button,\n * never a filter. Status tones are reserved for publication state.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n {\n shape = \"tag\",\n size = \"md\",\n tone,\n appearance = \"soft\",\n isCountExact = false,\n className,\n children,\n ...rest\n },\n ref,\n) {\n if (shape === \"count\" && !isCountExact) {\n const value = Number(children);\n if (!Number.isNaN(value)) {\n if (value === 0) {\n return null;\n }\n children = value > 99 ? \"99+\" : String(value);\n }\n }\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-size={size}\n data-appearance={appearance}\n data-tone={shape === \"status\" ? tone : undefined}\n className={[\"ds-badge\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {shape === \"status\" && (\n <span\n className=\"ds-badge__dot\"\n aria-hidden=\"true\"\n />\n )}\n {children}\n </span>\n );\n});\n"],"mappings":";;;AAkCA,IAAaA,IAAQC,EAAwC,SAC3D,EACE,WAAQ,OACR,UAAO,MACP,SACA,gBAAa,QACb,kBAAe,IACf,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAIC,MAAU,WAAW,CAACC,GAAc;EACtC,IAAMC,IAAQ,OAAOC,CAAQ;EAC7B,IAAI,CAAC,OAAO,MAAMD,CAAK,GAAG;GACxB,IAAIA,MAAU,GACZ,OAAO;GAET,IAAWA,IAAQ,KAAK,QAAQ,OAAOA,CAAK;EAC9C;CACF;CAEA,OACE,kBAAC,QAAD;EACO;EACL,cAAYF;EACZ,aAAWI;EACX,mBAAiBC;EACjB,aAAWL,MAAU,WAAWM,IAAO,KAAA;EACvC,WAAW,CAAC,YAAYC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC3D,GAAIR;EAPN,UAAA,CASGC,MAAU,YACT,kBAAC,QAAD;GACE,WAAU;GACV,eAAY;EACb,CAAA,GAEFG,CACG;;AAEV,CAAC"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
@layer components {
|
|
2
2
|
.ds-badge {
|
|
3
|
-
--badge-ink: var(--color-text
|
|
4
|
-
|
|
3
|
+
--badge-ink: var(--color-text);
|
|
4
|
+
|
|
5
|
+
/* Neutral soft badges (tags, counts, draft and archived) step from the
|
|
6
|
+
* fill they sit on, so they read on the canvas, the header, bands and
|
|
7
|
+
* hovered rows alike. Toned statuses keep their status fills. */
|
|
8
|
+
--badge-soft: var(--fill-control);
|
|
5
9
|
--badge-solid: var(--color-text);
|
|
6
|
-
--badge-on-solid: var(--color-
|
|
10
|
+
--badge-on-solid: var(--color-canvas);
|
|
7
11
|
--badge-marker: currentcolor;
|
|
8
12
|
|
|
9
13
|
display: inline-flex;
|
|
10
14
|
align-items: center;
|
|
11
15
|
gap: var(--badge-gap);
|
|
12
|
-
padding: var(--badge-pad-block) var(--badge-pad-inline,
|
|
13
|
-
border:
|
|
16
|
+
padding: var(--badge-pad-block) var(--badge-pad-inline, 10px);
|
|
17
|
+
border: 0;
|
|
14
18
|
border-radius: var(--badge-radius);
|
|
15
19
|
font-family: var(--font-sans);
|
|
16
20
|
font-size: var(--badge-font-size);
|
|
@@ -21,26 +25,26 @@
|
|
|
21
25
|
white-space: nowrap;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
/* The base metrics are md; sizes keep the same
|
|
28
|
+
/* The base metrics are md; sizes keep the same corners and tracking. */
|
|
25
29
|
.ds-badge[data-size="sm"] {
|
|
26
|
-
--badge-pad-block: var(--badge-sm-pad-block,
|
|
27
|
-
--badge-pad-inline:
|
|
30
|
+
--badge-pad-block: var(--badge-sm-pad-block, 3px);
|
|
31
|
+
--badge-pad-inline: 6px;
|
|
28
32
|
--badge-gap: var(--space-1);
|
|
29
33
|
--badge-marker-size: var(--space-1);
|
|
30
34
|
--badge-count-min: 20px;
|
|
31
|
-
--badge-count-pad-inline:
|
|
35
|
+
--badge-count-pad-inline: 6px;
|
|
32
36
|
--badge-count-font-size: var(--badge-font-size);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
.ds-badge[data-size="lg"] {
|
|
36
40
|
--badge-font-size: var(--font-size-xs);
|
|
37
41
|
--badge-line-height: 1rem;
|
|
38
|
-
--badge-pad-block:
|
|
39
|
-
--badge-pad-inline:
|
|
42
|
+
--badge-pad-block: 6px;
|
|
43
|
+
--badge-pad-inline: 14px;
|
|
40
44
|
--badge-gap: var(--space-2);
|
|
41
45
|
--badge-marker-size: var(--space-2);
|
|
42
46
|
--badge-count-min: 28px;
|
|
43
|
-
--badge-count-pad-inline:
|
|
47
|
+
--badge-count-pad-inline: 10px;
|
|
44
48
|
--badge-count-font-size: var(--font-size-sm);
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -55,24 +59,16 @@
|
|
|
55
59
|
font-variant-numeric: tabular-nums;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
/*
|
|
59
|
-
.ds-badge[data-appearance="outline"] {
|
|
60
|
-
background: transparent;
|
|
61
|
-
border-color: var(--badge-ink);
|
|
62
|
-
color: var(--badge-ink);
|
|
63
|
-
}
|
|
64
|
-
|
|
62
|
+
/* Both appearances keep the same dimensions. */
|
|
65
63
|
.ds-badge[data-appearance="soft"] {
|
|
66
64
|
--badge-marker: var(--badge-soft-marker, currentColor);
|
|
67
65
|
|
|
68
66
|
background: var(--badge-soft);
|
|
69
|
-
border-color: transparent;
|
|
70
67
|
color: var(--badge-ink);
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
.ds-badge[data-appearance="solid"] {
|
|
74
71
|
background: var(--badge-solid);
|
|
75
|
-
border-color: var(--badge-solid);
|
|
76
72
|
color: var(--badge-on-solid);
|
|
77
73
|
}
|
|
78
74
|
|
|
@@ -86,44 +82,42 @@
|
|
|
86
82
|
|
|
87
83
|
/* ── Publication tones ───────────────────────────────────────────────── */
|
|
88
84
|
.ds-badge[data-tone="draft"] {
|
|
89
|
-
--badge-ink: var(--
|
|
90
|
-
--badge-soft: var(--
|
|
91
|
-
--badge-soft-marker: var(--status-draft);
|
|
85
|
+
--badge-ink: var(--color-text-subtle);
|
|
86
|
+
--badge-soft-marker: var(--color-border-strong);
|
|
92
87
|
--badge-solid: var(--color-text-muted);
|
|
93
|
-
--badge-on-solid: var(--color-
|
|
88
|
+
--badge-on-solid: var(--color-canvas);
|
|
94
89
|
}
|
|
95
90
|
|
|
96
91
|
.ds-badge[data-tone="scheduled"] {
|
|
97
|
-
--badge-ink: var(--
|
|
98
|
-
--badge-soft: var(--
|
|
92
|
+
--badge-ink: var(--color-primary-text);
|
|
93
|
+
--badge-soft: var(--color-primary-soft);
|
|
99
94
|
--badge-solid: var(--color-primary);
|
|
100
95
|
--badge-on-solid: var(--color-text-on-solid);
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
.ds-badge[data-tone="published"] {
|
|
104
|
-
--badge-ink: var(--
|
|
105
|
-
--badge-soft: var(--
|
|
99
|
+
--badge-ink: var(--color-success-text);
|
|
100
|
+
--badge-soft: var(--color-success-soft);
|
|
106
101
|
--badge-solid: var(--color-success);
|
|
107
102
|
--badge-on-solid: var(--color-text-on-solid);
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
.ds-badge[data-tone="changed"] {
|
|
111
|
-
--badge-ink: var(--
|
|
112
|
-
--badge-soft: var(--
|
|
106
|
+
--badge-ink: var(--color-warning-text);
|
|
107
|
+
--badge-soft: var(--color-warning-soft);
|
|
113
108
|
--badge-solid: var(--color-warning);
|
|
114
109
|
--badge-on-solid: var(--color-text-on-solid);
|
|
115
110
|
}
|
|
116
111
|
|
|
117
112
|
.ds-badge[data-tone="unpublished"] {
|
|
118
|
-
--badge-ink: var(--
|
|
119
|
-
--badge-soft: var(--
|
|
113
|
+
--badge-ink: var(--color-danger-text);
|
|
114
|
+
--badge-soft: var(--color-danger-soft);
|
|
120
115
|
--badge-solid: var(--color-danger);
|
|
121
116
|
--badge-on-solid: var(--color-text-on-solid);
|
|
122
117
|
}
|
|
123
118
|
|
|
124
119
|
.ds-badge[data-tone="archived"] {
|
|
125
|
-
--badge-ink: var(--
|
|
126
|
-
--badge-soft: var(--color-surface-subtle);
|
|
120
|
+
--badge-ink: var(--color-text-subtle);
|
|
127
121
|
--badge-solid: var(--color-border-strong);
|
|
128
122
|
--badge-on-solid: var(--color-text);
|
|
129
123
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Message-CIKSTXp8.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({className:t,...r},i){return(0,n.jsx)(e.t,{"aria-atomic":!1,...r,ref:i,appearance:`inline`,classPrefix:`ds-banner`,className:[`ds-banner`,t].filter(Boolean).join(` `)})});exports.Banner=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-CNVy8gHI.cjs");exports.Board=e.t,exports.BoardCard=e.n,exports.BoardColumn=e.r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-
|
|
1
|
+
export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-BCS7sDXg.js";
|
|
@@ -7,28 +7,37 @@
|
|
|
7
7
|
padding-block-end: var(--space-2);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
/*
|
|
10
|
+
/* Lanes paint the band; their cards rest on --fill-card, a step off it. */
|
|
11
11
|
.ds-board-column {
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
flex: none;
|
|
15
15
|
inline-size: var(--board-column-width);
|
|
16
16
|
max-block-size: var(--board-column-max-height);
|
|
17
|
-
border:
|
|
17
|
+
border: 0;
|
|
18
18
|
border-radius: var(--radius-lg);
|
|
19
|
-
background: var(--
|
|
19
|
+
background: var(--field-bg);
|
|
20
20
|
overflow: hidden;
|
|
21
|
+
|
|
22
|
+
--field-bg: var(--fill-band);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
/* The drop target reads on the fill
|
|
25
|
+
/* The drop target reads on the fill. */
|
|
24
26
|
.ds-board-column[data-over] {
|
|
25
|
-
background: var(--
|
|
26
|
-
}
|
|
27
|
+
background: var(--field-bg);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
--field-bg: var(--color-primary-soft);
|
|
30
|
+
--button-active-bg: var(--color-primary-soft-pressed);
|
|
31
|
+
}
|
|
29
32
|
|
|
33
|
+
/* A lane being reordered leaves a recessed slot: the pressed step of the
|
|
34
|
+
* lane fill, darker than every resting lane. Its grip stays visible because
|
|
35
|
+
* it holds focus through a keyboard drag. */
|
|
30
36
|
.ds-board-column[data-dragging] {
|
|
31
|
-
|
|
37
|
+
--field-paint: var(--field-pressed);
|
|
38
|
+
|
|
39
|
+
background: var(--field-pressed);
|
|
40
|
+
color: var(--color-text-muted);
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
.ds-board-column[data-overlay] {
|
|
@@ -68,8 +77,7 @@
|
|
|
68
77
|
display: flex;
|
|
69
78
|
align-items: center;
|
|
70
79
|
gap: var(--space-2);
|
|
71
|
-
padding:
|
|
72
|
-
border-block-end: var(--rule-width) solid var(--rule-color);
|
|
80
|
+
padding: 12px 16px 4px;
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
.ds-board-column__title {
|
|
@@ -90,7 +98,7 @@
|
|
|
90
98
|
.ds-board-column__body {
|
|
91
99
|
display: flex;
|
|
92
100
|
flex-direction: column;
|
|
93
|
-
gap: var(--space-
|
|
101
|
+
gap: var(--space-2);
|
|
94
102
|
padding: var(--space-3);
|
|
95
103
|
overflow-y: auto;
|
|
96
104
|
min-block-size: var(--board-column-min-body);
|
|
@@ -101,16 +109,22 @@
|
|
|
101
109
|
display: flex;
|
|
102
110
|
align-items: stretch;
|
|
103
111
|
gap: var(--space-2);
|
|
104
|
-
border:
|
|
112
|
+
border: 0;
|
|
105
113
|
border-radius: var(--radius-md);
|
|
106
|
-
background: var(--
|
|
114
|
+
background: var(--field-bg);
|
|
107
115
|
padding: var(--space-3);
|
|
108
116
|
font-size: var(--font-size-sm);
|
|
109
117
|
user-select: none;
|
|
110
118
|
transition: background-color var(--duration-fast) var(--ease-standard);
|
|
119
|
+
|
|
120
|
+
--field-bg: var(--fill-card);
|
|
111
121
|
}
|
|
112
122
|
|
|
123
|
+
/* Painted fills other than the ground are named in --field-paint, so
|
|
124
|
+
* neutral badges and controls on the card step from them. */
|
|
113
125
|
.ds-board-card:hover {
|
|
126
|
+
--field-paint: var(--field-hover);
|
|
127
|
+
|
|
114
128
|
background: var(--field-hover);
|
|
115
129
|
}
|
|
116
130
|
|
|
@@ -123,14 +137,21 @@
|
|
|
123
137
|
min-inline-size: 0;
|
|
124
138
|
}
|
|
125
139
|
|
|
126
|
-
/* The card left behind stays in place as a
|
|
140
|
+
/* The card left behind stays in place as a recessed slot, so the row never
|
|
141
|
+
* collapses and the slot separates from both the lane and resting cards. */
|
|
127
142
|
.ds-board-card[data-dragging] {
|
|
128
|
-
|
|
143
|
+
--field-paint: var(--field-pressed);
|
|
144
|
+
|
|
145
|
+
background: var(--field-pressed);
|
|
146
|
+
color: var(--color-text-muted);
|
|
129
147
|
}
|
|
130
148
|
|
|
149
|
+
/* The pointer rests on the overlay, so it keeps its rest fill. */
|
|
131
150
|
.ds-board-card[data-overlay] {
|
|
151
|
+
--field-paint: initial;
|
|
152
|
+
|
|
132
153
|
box-shadow: var(--shadow-lg);
|
|
133
|
-
background: var(--
|
|
154
|
+
background: var(--field-bg);
|
|
134
155
|
}
|
|
135
156
|
|
|
136
157
|
.ds-board-card[data-overlay] .ds-board-card__handle {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
6
6
|
gap: var(--space-2);
|
|
7
|
-
border:
|
|
7
|
+
border: 0;
|
|
8
8
|
border-radius: var(--radius-md);
|
|
9
9
|
font-family: var(--font-sans);
|
|
10
10
|
font-weight: var(--font-weight-semibold);
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.ds-button:where(:not(.ds-field-skin))[data-variant="neutral"] {
|
|
68
|
-
background: var(--
|
|
68
|
+
background: var(--fill-control);
|
|
69
69
|
color: var(--color-text);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -73,14 +73,14 @@
|
|
|
73
73
|
:disabled,
|
|
74
74
|
[aria-disabled="true"]
|
|
75
75
|
) {
|
|
76
|
-
background: var(--
|
|
76
|
+
background: var(--fill-control-hover);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.ds-button:where(:not(.ds-field-skin))[data-variant="neutral"]:active:not(
|
|
80
80
|
:disabled,
|
|
81
81
|
[aria-disabled="true"]
|
|
82
82
|
) {
|
|
83
|
-
background: var(--
|
|
83
|
+
background: var(--fill-control-pressed);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.ds-button:where(:not(.ds-field-skin))[data-variant="danger"] {
|
|
@@ -92,39 +92,44 @@
|
|
|
92
92
|
:disabled,
|
|
93
93
|
[aria-disabled="true"]
|
|
94
94
|
) {
|
|
95
|
-
background: var(--color-danger-hover
|
|
95
|
+
background: var(--color-danger-hover);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.ds-button:where(:not(.ds-field-skin))[data-variant="danger"]:active:not(
|
|
99
99
|
:disabled,
|
|
100
100
|
[aria-disabled="true"]
|
|
101
101
|
) {
|
|
102
|
-
background: var(--color-danger-pressed
|
|
102
|
+
background: var(--color-danger-pressed);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/* Selected containers raise --button-active-bg above their own soft fill.
|
|
106
|
+
* Hover and press step from it on the soft ladder, so they always move
|
|
107
|
+
* further from rest; on the default ground they equal the soft steps. */
|
|
105
108
|
.ds-button:where(:not(.ds-field-skin))[data-variant="active"] {
|
|
106
|
-
background: var(--
|
|
109
|
+
background: var(--button-active-bg);
|
|
107
110
|
color: var(--color-primary-text);
|
|
108
|
-
border-color: var(--color-primary);
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
.ds-button:where(:not(.ds-field-skin))[data-variant="active"]:hover:not(
|
|
112
114
|
:disabled,
|
|
113
115
|
[aria-disabled="true"]
|
|
114
116
|
) {
|
|
115
|
-
background: var(--color-primary-
|
|
117
|
+
background: color-mix(in srgb, var(--color-primary) var(--tint-hover), var(--button-active-bg));
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
.ds-button:where(:not(.ds-field-skin))[data-variant="active"]:active:not(
|
|
119
121
|
:disabled,
|
|
120
122
|
[aria-disabled="true"]
|
|
121
123
|
) {
|
|
122
|
-
background:
|
|
124
|
+
background: color-mix(
|
|
125
|
+
in srgb,
|
|
126
|
+
var(--color-primary) var(--tint-pressed),
|
|
127
|
+
var(--button-active-bg)
|
|
128
|
+
);
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
.ds-button:where(:not(.ds-field-skin))[data-variant="simple"] {
|
|
126
132
|
background: transparent;
|
|
127
|
-
border-color: transparent;
|
|
128
133
|
color: var(--color-text-muted);
|
|
129
134
|
font-weight: var(--font-weight-regular);
|
|
130
135
|
}
|
|
@@ -144,7 +149,7 @@
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
.ds-button:focus-visible {
|
|
147
|
-
outline: var(--
|
|
152
|
+
outline: var(--focus-width) solid var(--color-focus);
|
|
148
153
|
outline-offset: 2px;
|
|
149
154
|
}
|
|
150
155
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","react","react_jsx_runtime","ButtonGroup","rest","isAttached","orientation","className"],"sources":["../../../src/components/ButtonGroup/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Attached segments read as one control; spaced reads as related actions. */\n isAttached?: boolean;\n orientation?: ButtonGroupOrientation;\n /** Required when the group itself carries the meaning (e.g. a view switcher). */\n \"aria-label\"?: string;\n children?: ReactNode;\n}\n\n/**\n * A row of `Button`s that belong to one decision. Mark the current segment with\n * `variant=\"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","react","react_jsx_runtime","ButtonGroup","rest","isAttached","orientation","className"],"sources":["../../../src/components/ButtonGroup/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Attached segments read as one control; spaced reads as related actions. */\n isAttached?: boolean;\n orientation?: ButtonGroupOrientation;\n /** Required when the group itself carries the meaning (e.g. a view switcher). */\n \"aria-label\"?: string;\n children?: ReactNode;\n}\n\n/**\n * A row of `Button`s that belong to one decision. Mark the current segment with\n * `variant=\"primary\"` and `aria-pressed` — the group adds no selection state of\n * its own, so it stays a layout contract rather than a second control API.\n */\nexport const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(function ButtonGroup(\n { isAttached = true, orientation = \"horizontal\", className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-attached={isAttached}\n data-orientation={orientation}\n className={[\"ds-button-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {children}\n </div>\n );\n});\n"],"mappings":"A,yHAmBA,IAAaG,GAAA,EAAcH,EAAAA,WAAAA,CAA6C,SACtE,CAAE,aAAa,GAAM,cAAc,aAAc,YAAW,WAAU,GAAGI,GACzE,EACA,CACA,OACE,EAAAF,EAAA,IAAA,CAAC,MAAD,CACO,MACL,KAAK,QACL,gBAAeG,EACf,mBAAkBC,EAClB,UAAW,CAAC,kBAAmBC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,GAAIH,EAEH,UACE,CAAA,CAET,CAAC,E"}
|
|
@@ -10,7 +10,7 @@ export interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* A row of `Button`s that belong to one decision. Mark the current segment with
|
|
13
|
-
* `variant="
|
|
13
|
+
* `variant="primary"` and `aria-pressed` — the group adds no selection state of
|
|
14
14
|
* its own, so it stays a layout contract rather than a second control API.
|
|
15
15
|
*/
|
|
16
16
|
export declare const ButtonGroup: import("react").ForwardRefExoticComponent<ButtonGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -10,7 +10,7 @@ export interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* A row of `Button`s that belong to one decision. Mark the current segment with
|
|
13
|
-
* `variant="
|
|
13
|
+
* `variant="primary"` and `aria-pressed` — the group adds no selection state of
|
|
14
14
|
* its own, so it stays a layout contract rather than a second control API.
|
|
15
15
|
*/
|
|
16
16
|
export declare const ButtonGroup: import("react").ForwardRefExoticComponent<ButtonGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ButtonGroup","forwardRef","rest","isAttached","orientation","className"],"sources":["../../../src/components/ButtonGroup/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Attached segments read as one control; spaced reads as related actions. */\n isAttached?: boolean;\n orientation?: ButtonGroupOrientation;\n /** Required when the group itself carries the meaning (e.g. a view switcher). */\n \"aria-label\"?: string;\n children?: ReactNode;\n}\n\n/**\n * A row of `Button`s that belong to one decision. Mark the current segment with\n * `variant=\"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ButtonGroup","forwardRef","rest","isAttached","orientation","className"],"sources":["../../../src/components/ButtonGroup/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\";\n\nexport interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Attached segments read as one control; spaced reads as related actions. */\n isAttached?: boolean;\n orientation?: ButtonGroupOrientation;\n /** Required when the group itself carries the meaning (e.g. a view switcher). */\n \"aria-label\"?: string;\n children?: ReactNode;\n}\n\n/**\n * A row of `Button`s that belong to one decision. Mark the current segment with\n * `variant=\"primary\"` and `aria-pressed` — the group adds no selection state of\n * its own, so it stays a layout contract rather than a second control API.\n */\nexport const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(function ButtonGroup(\n { isAttached = true, orientation = \"horizontal\", className, children, ...rest },\n ref,\n) {\n return (\n <div\n ref={ref}\n role=\"group\"\n data-attached={isAttached}\n data-orientation={orientation}\n className={[\"ds-button-group\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {children}\n </div>\n );\n});\n"],"mappings":";;;AAmBA,IAAaA,IAAcC,EAA6C,SACtE,EAAE,gBAAa,IAAM,iBAAc,cAAc,cAAW,aAAU,GAAGC,KACzE,GACA;CACA,OACE,kBAAC,OAAD;EACO;EACL,MAAK;EACL,iBAAeC;EACf,oBAAkBC;EAClB,WAAW,CAAC,mBAAmBC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAClE,GAAIH;EAEH;CACE,CAAA;AAET,CAAC"}
|
|
@@ -4,16 +4,10 @@
|
|
|
4
4
|
align-items: stretch;
|
|
5
5
|
align-self: start;
|
|
6
6
|
width: fit-content;
|
|
7
|
-
|
|
8
|
-
/* The group is the container; its children give up their outer geometry. */
|
|
7
|
+
gap: 2px;
|
|
9
8
|
border-radius: var(--radius-md);
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
/* Collapse the doubled 2px control strokes into one shared rule. */
|
|
13
|
-
.ds-button-group > .ds-button + .ds-button {
|
|
14
|
-
margin-inline-start: calc(-1 * var(--control-border-width));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
.ds-button-group > .ds-button {
|
|
18
12
|
border-radius: 0;
|
|
19
13
|
}
|
|
@@ -28,12 +22,9 @@
|
|
|
28
22
|
border-end-end-radius: var(--radius-md);
|
|
29
23
|
}
|
|
30
24
|
|
|
31
|
-
/*
|
|
32
|
-
|
|
33
|
-
.ds-button-group > .ds-button:focus-visible
|
|
34
|
-
.ds-button-group > .ds-button[data-variant="active"],
|
|
35
|
-
.ds-button-group > .ds-button[data-variant="primary"],
|
|
36
|
-
.ds-button-group > .ds-button[data-variant="danger"] {
|
|
25
|
+
/* The focus ring overhangs the 2px gap, so lift the focused segment above
|
|
26
|
+
* its neighbours' fills. */
|
|
27
|
+
.ds-button-group > .ds-button:focus-visible {
|
|
37
28
|
position: relative;
|
|
38
29
|
z-index: 1;
|
|
39
30
|
}
|
|
@@ -42,11 +33,6 @@
|
|
|
42
33
|
flex-direction: column;
|
|
43
34
|
}
|
|
44
35
|
|
|
45
|
-
.ds-button-group[data-orientation="vertical"] > .ds-button + .ds-button {
|
|
46
|
-
margin-inline-start: 0;
|
|
47
|
-
margin-block-start: calc(-1 * var(--control-border-width));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
36
|
.ds-button-group[data-orientation="vertical"] > .ds-button:first-child {
|
|
51
37
|
border-radius: var(--radius-md) var(--radius-md) 0 0;
|
|
52
38
|
}
|
|
@@ -55,13 +41,11 @@
|
|
|
55
41
|
border-radius: 0 0 var(--radius-md) var(--radius-md);
|
|
56
42
|
}
|
|
57
43
|
|
|
58
|
-
/* Spaced: related actions that are not one control. */
|
|
59
44
|
.ds-button-group[data-attached="false"] {
|
|
60
45
|
gap: var(--space-2);
|
|
61
46
|
}
|
|
62
47
|
|
|
63
48
|
.ds-button-group[data-attached="false"] > .ds-button {
|
|
64
49
|
border-radius: var(--radius-md);
|
|
65
|
-
margin: 0;
|
|
66
50
|
}
|
|
67
51
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../../chunks/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../../chunks/style-nulIa2_8.cjs"),r=require("../Grid/index.cjs");let i=require("react"),a=require("react/jsx-runtime");var o=e=>{e.preventDefault(),e.stopPropagation()};function s(e,{disabled:n,isFocusableWhenDisabled:r,name:i,required:a,...s}){let c=!!(n&&r);return t.t(()=>{let t=e.current;if(t&&c)return t.addEventListener(`click`,o),()=>t.removeEventListener(`click`,o)},[e,c]),c?{...s,"aria-disabled":!0,"data-disabled":``}:{...s,disabled:n,name:i,required:a}}var c=(0,i.forwardRef)(function({isIndeterminate:t=!1,className:n,children:r,...o},c){let l=(0,i.useRef)(null),u=s(l,o);return(0,i.useEffect)(()=>{l.current&&(l.current.indeterminate=t)},[t]),(0,a.jsxs)(`label`,{className:[`ds-choice`,n].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{type:`checkbox`,className:`ds-choice__control ds-indicator`,"data-kind":`checkbox`,ref:e.t(l,c),...u}),r&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:r})]})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},o){let c=(0,i.useRef)(null),l=s(c,r);return(0,a.jsxs)(`label`,{className:[`ds-choice`,t].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{ref:e.t(c,o),type:`radio`,className:`ds-choice__control ds-indicator`,"data-kind":`radio`,...l}),n&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:n})]})});function u({label:e,columns:t=1,children:i,className:o,...s}){return(0,a.jsx)(n.t,{...s,label:e,className:[`ds-choice-group`,o].filter(Boolean).join(` `),children:t===1?(0,a.jsx)(r.Stack,{gap:`sm`,children:i}):(0,a.jsx)(r.Grid,{columns:t,gap:`sm`,className:`ds-choice-group__grid ds-field-group-grid`,style:{"--field-group-columns":t},children:i})})}exports.Checkbox=c,exports.ChoiceGroup=u,exports.Radio=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","require_style","require_components_Grid_index","react","react_jsx_runtime","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","node","input","Checkbox","inner","inputProps","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":"A,6TA0BA,IAAMY,EAAU,GAAiB,CAC/BC,EAAM,eAAe,EACrBA,EAAM,gBAAgB,CACxB,EAWA,SAASC,EACP,EACA,CAAE,WAAU,0BAAyB,OAAM,WAAU,GAAGC,GACxD,CACA,IAAMC,EAAa,GAAQC,GAAYC,GASvC,OARAX,EAAA,MAAgC,CAC9B,IAAMY,EAAOC,EAAM,QACnB,GAAKD,GAASH,EAId,OADAG,EAAK,iBAAiB,QAASP,CAAM,MACxBO,EAAK,oBAAoB,QAASP,CAAM,CACvD,EAAG,CAACQ,EAAOJ,CAAU,CAAC,EACfA,EACH,CAAE,GAAGD,EAAM,gBAAiB,GAAM,gBAAiB,EAAG,EACtD,CAAE,GAAGA,EAAM,WAAU,OAAM,UAAS,CAC1C,CASA,IAAaM,GAAA,EAAWrB,EAAAA,WAAAA,CAA4C,SAClE,CAAE,kBAAkB,GAAO,YAAW,WAAU,GAAGe,GACnD,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAQ7C,OANA,EAAAL,EAAA,UAAA,KAAgB,CACVY,EAAM,UACR,EAAM,QAAQ,cAAgBE,EAElC,EAAG,CAACA,CAAe,CAAC,GAGlB,EAAAb,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAAnE,SAAA,EACE,EAAAd,EAAA,IAAA,CAAC,QAAD,CACE,KAAK,WACL,UAAU,kCACV,YAAU,WACV,IAAKT,EAAAA,EAAUoB,EAAOI,CAAG,EACzB,GAAIH,CACL,CAAA,EACAI,IAAY,EAAAhB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,UAAe,CAAA,CAC3D,C,EAEX,CAAC,EAOYiB,GAAA,EAAQ5B,EAAAA,WAAAA,CAAyC,SAC5D,CAAE,YAAW,WAAU,GAAGe,GAC1B,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAC7C,OACE,EAAAJ,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAAnE,SAAA,EACE,EAAAd,EAAA,IAAA,CAAC,QAAD,CACE,IAAKT,EAAAA,EAAUoB,EAAOI,CAAG,EACzB,KAAK,QACL,UAAU,kCACV,YAAU,QACV,GAAIH,CACL,CAAA,EACAI,IAAY,EAAAhB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,UAAe,CAAA,CAC3D,C,EAEX,CAAC,EAYD,SAAgBkB,EAAY,CAC1B,QACA,UAAU,EACV,WACA,YACA,GAAGC,GACgB,CACnB,OACE,EAAAnB,EAAA,IAAA,CAACR,EAAAA,EAAD,CACE,GAAI2B,EACG,QACP,UAAW,CAAC,kBAAmBL,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAEjE,SAAAM,IAAY,GACX,EAAApB,EAAA,IAAA,CAACP,EAAAA,MAAD,CAAO,IAAI,KAAM,UAAgB,CAAA,GAEjC,EAAAO,EAAA,IAAA,CAACN,EAAAA,KAAD,CACW,UACT,IAAI,KACJ,UAAU,4CACV,MAAO,CAAE,wBAAyB0B,CAAQ,EAEzC,UACG,CAAA,CAEE,CAAA,CAEhB,C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
2
2
|
import { t } from "../../chunks/useIsomorphicLayoutEffect-Bc9hxFMc.js";
|
|
3
|
-
import { t as n } from "../../chunks/
|
|
3
|
+
import { t as n } from "../../chunks/style-7Z_xRlQx.js";
|
|
4
4
|
import { Grid as r, Stack as i } from "../Grid/index.js";
|
|
5
5
|
import { forwardRef as a, useEffect as o, useRef as s } from "react";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -32,7 +32,7 @@ var f = a(function({ isIndeterminate: t = !1, className: n, children: r, ...i },
|
|
|
32
32
|
className: ["ds-choice", n].filter(Boolean).join(" "),
|
|
33
33
|
children: [/* @__PURE__ */ c("input", {
|
|
34
34
|
type: "checkbox",
|
|
35
|
-
className: "ds-choice__control",
|
|
35
|
+
className: "ds-choice__control ds-indicator",
|
|
36
36
|
"data-kind": "checkbox",
|
|
37
37
|
ref: e(u, a),
|
|
38
38
|
...f
|
|
@@ -48,7 +48,7 @@ var f = a(function({ isIndeterminate: t = !1, className: n, children: r, ...i },
|
|
|
48
48
|
children: [/* @__PURE__ */ c("input", {
|
|
49
49
|
ref: e(a, i),
|
|
50
50
|
type: "radio",
|
|
51
|
-
className: "ds-choice__control",
|
|
51
|
+
className: "ds-choice__control ds-indicator",
|
|
52
52
|
"data-kind": "radio",
|
|
53
53
|
...o
|
|
54
54
|
}), n && /* @__PURE__ */ c("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mergeRefs","FieldGroup","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","useIsomorphicLayoutEffect","node","input","Checkbox","forwardRef","inner","useRef","inputProps","useEffect","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns","Stack","Grid"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":";;;;;;;AA0BA,IAAME,KAAU,MAAiB;CAE/B,AADAC,EAAM,eAAe,GACrBA,EAAM,gBAAgB;AACxB;AAWA,SAASC,EACP,GACA,EAAE,aAAU,4BAAyB,SAAM,aAAU,GAAGC,KACxD;CACA,IAAMC,IAAa,GAAQC,KAAYC;CASvC,OARAC,QAAgC;EAC9B,IAAMC,IAAOC,EAAM;EACnB,IAAKD,KAASJ,GAId,OADAI,EAAK,iBAAiB,SAASR,CAAM,SACxBQ,EAAK,oBAAoB,SAASR,CAAM;CACvD,GAAG,CAACS,GAAOL,CAAU,CAAC,GACfA,IACH;EAAE,GAAGD;EAAM,iBAAiB;EAAM,iBAAiB;CAAG,IACtD;EAAE,GAAGA;EAAM;EAAU;EAAM;CAAS;AAC1C;AASA,IAAaO,IAAWC,EAA4C,SAClE,EAAE,qBAAkB,IAAO,cAAW,aAAU,GAAGR,KACnD,GACA;CACA,IAAMS,IAAQC,EAAgC,IAAI,GAC5CC,IAAaZ,EAAeU,GAAOT,CAAI;CAQ7C,OANAY,QAAgB;EACd,AAAIH,EAAM,YACR,EAAM,QAAQ,gBAAgBI;CAElC,GAAG,CAACA,CAAe,CAAC,GAGlB,kBAAC,SAAD;EAAO,WAAW,CAAC,aAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAnE,UAAA,CACE,kBAAC,SAAD;GACE,MAAK;GACL,WAAU;GACV,aAAU;GACV,KAAKnB,EAAUc,GAAOM,CAAG;GACzB,GAAIJ;EACL,CAAA,GACAK,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC,GAOYC,IAAQT,EAAyC,SAC5D,EAAE,cAAW,aAAU,GAAGR,KAC1B,GACA;CACA,IAAMS,IAAQC,EAAgC,IAAI,GAC5CC,IAAaZ,EAAeU,GAAOT,CAAI;CAC7C,OACE,kBAAC,SAAD;EAAO,WAAW,CAAC,aAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAnE,UAAA,CACE,kBAAC,SAAD;GACE,KAAKnB,EAAUc,GAAOM,CAAG;GACzB,MAAK;GACL,WAAU;GACV,aAAU;GACV,GAAIJ;EACL,CAAA,GACAK,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC;AAYD,SAAgBE,EAAY,EAC1B,UACA,aAAU,GACV,aACA,cACA,GAAGC,KACgB;CACnB,OACE,kBAACvB,GAAD;EACE,GAAIuB;EACG;EACP,WAAW,CAAC,mBAAmBL,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAEjE,UAAAM,MAAY,IACX,kBAACC,GAAD;GAAO,KAAI;GAAM;EAAgB,CAAA,IAEjC,kBAACC,GAAD;GACW;GACT,KAAI;GACJ,WAAU;GACV,OAAO,EAAE,yBAAyBF,EAAQ;GAEzC;EACG,CAAA;CAEE,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["mergeRefs","FieldGroup","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","useIsomorphicLayoutEffect","node","input","Checkbox","forwardRef","inner","useRef","inputProps","useEffect","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns","Stack","Grid"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":";;;;;;;AA0BA,IAAME,KAAU,MAAiB;CAE/B,AADAC,EAAM,eAAe,GACrBA,EAAM,gBAAgB;AACxB;AAWA,SAASC,EACP,GACA,EAAE,aAAU,4BAAyB,SAAM,aAAU,GAAGC,KACxD;CACA,IAAMC,IAAa,GAAQC,KAAYC;CASvC,OARAC,QAAgC;EAC9B,IAAMC,IAAOC,EAAM;EACnB,IAAKD,KAASJ,GAId,OADAI,EAAK,iBAAiB,SAASR,CAAM,SACxBQ,EAAK,oBAAoB,SAASR,CAAM;CACvD,GAAG,CAACS,GAAOL,CAAU,CAAC,GACfA,IACH;EAAE,GAAGD;EAAM,iBAAiB;EAAM,iBAAiB;CAAG,IACtD;EAAE,GAAGA;EAAM;EAAU;EAAM;CAAS;AAC1C;AASA,IAAaO,IAAWC,EAA4C,SAClE,EAAE,qBAAkB,IAAO,cAAW,aAAU,GAAGR,KACnD,GACA;CACA,IAAMS,IAAQC,EAAgC,IAAI,GAC5CC,IAAaZ,EAAeU,GAAOT,CAAI;CAQ7C,OANAY,QAAgB;EACd,AAAIH,EAAM,YACR,EAAM,QAAQ,gBAAgBI;CAElC,GAAG,CAACA,CAAe,CAAC,GAGlB,kBAAC,SAAD;EAAO,WAAW,CAAC,aAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAnE,UAAA,CACE,kBAAC,SAAD;GACE,MAAK;GACL,WAAU;GACV,aAAU;GACV,KAAKnB,EAAUc,GAAOM,CAAG;GACzB,GAAIJ;EACL,CAAA,GACAK,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC,GAOYC,IAAQT,EAAyC,SAC5D,EAAE,cAAW,aAAU,GAAGR,KAC1B,GACA;CACA,IAAMS,IAAQC,EAAgC,IAAI,GAC5CC,IAAaZ,EAAeU,GAAOT,CAAI;CAC7C,OACE,kBAAC,SAAD;EAAO,WAAW,CAAC,aAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAnE,UAAA,CACE,kBAAC,SAAD;GACE,KAAKnB,EAAUc,GAAOM,CAAG;GACzB,MAAK;GACL,WAAU;GACV,aAAU;GACV,GAAIJ;EACL,CAAA,GACAK,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC;AAYD,SAAgBE,EAAY,EAC1B,UACA,aAAU,GACV,aACA,cACA,GAAGC,KACgB;CACnB,OACE,kBAACvB,GAAD;EACE,GAAIuB;EACG;EACP,WAAW,CAAC,mBAAmBL,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAEjE,UAAAM,MAAY,IACX,kBAACC,GAAD;GAAO,KAAI;GAAM;EAAgB,CAAA,IAEjC,kBAACC,GAAD;GACW;GACT,KAAI;GACJ,WAAU;GACV,OAAO,EAAE,yBAAyBF,EAAQ;GAEzC;EACG,CAAA;CAEE,CAAA;AAEhB"}
|