@namroodinc/liquid-editorial 0.1.5 → 0.1.7
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/AGENTS.md +2 -0
- package/README.md +149 -4
- package/UPGRADING.md +127 -4
- package/dist/components/AppShell/index.cjs +2 -0
- package/dist/components/AppShell/index.cjs.map +1 -0
- package/dist/components/AppShell/index.d.cts +15 -0
- package/dist/components/AppShell/index.d.cts.map +1 -0
- package/dist/components/AppShell/index.d.ts +15 -0
- package/dist/components/AppShell/index.d.ts.map +1 -0
- package/dist/components/AppShell/index.js +93 -0
- package/dist/components/AppShell/index.js.map +1 -0
- package/dist/components/AppShell/style.css +79 -0
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.cjs.map +1 -1
- package/dist/components/AssetGrid/index.d.cts.map +1 -1
- package/dist/components/AssetGrid/index.d.ts.map +1 -1
- package/dist/components/AssetGrid/index.js +57 -59
- package/dist/components/AssetGrid/index.js.map +1 -1
- package/dist/components/AssetGrid/style.css +8 -16
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.cjs.map +1 -1
- package/dist/components/Board/index.d.cts.map +1 -1
- package/dist/components/Board/index.d.ts.map +1 -1
- package/dist/components/Board/index.js +88 -84
- package/dist/components/Board/index.js.map +1 -1
- package/dist/components/Board/style.css +17 -28
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.cjs.map +1 -1
- package/dist/components/Button/index.d.cts +3 -2
- package/dist/components/Button/index.d.cts.map +1 -1
- package/dist/components/Button/index.d.ts +3 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/style.css +21 -15
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.cjs.map +1 -1
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +46 -45
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/style.css +4 -61
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.cts +10 -1
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts +10 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +69 -47
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/style.css +106 -0
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.cjs.map +1 -1
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +12 -11
- package/dist/components/EntryPicker/index.js.map +1 -1
- package/dist/components/EntryPicker/style.css +3 -30
- package/dist/components/Field/style.css +11 -3
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.d.cts +3 -17
- package/dist/components/ImageCropper/index.d.cts.map +1 -1
- package/dist/components/ImageCropper/index.d.ts +3 -17
- package/dist/components/ImageCropper/index.d.ts.map +1 -1
- package/dist/components/ImageCropper/index.js +143 -180
- package/dist/components/ImageCropper/index.js.map +1 -1
- package/dist/components/ImageCropper/style.css +2 -94
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +11 -16
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/style.css +7 -41
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.d.cts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +12 -12
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.cjs.map +1 -1
- package/dist/components/NumberField/index.js +13 -17
- package/dist/components/NumberField/index.js.map +1 -1
- package/dist/components/NumberField/style.css +1 -41
- package/dist/components/Pagination/index.cjs +2 -0
- package/dist/components/Pagination/index.cjs.map +1 -0
- package/dist/components/Pagination/index.d.cts +24 -0
- package/dist/components/Pagination/index.d.cts.map +1 -0
- package/dist/components/Pagination/index.d.ts +24 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Pagination/index.js +96 -0
- package/dist/components/Pagination/index.js.map +1 -0
- package/dist/components/Pagination/style.css +52 -0
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts +5 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts +5 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +27 -26
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +26 -27
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/SearchField/style.css +0 -21
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts +3 -0
- package/dist/components/Select/index.d.cts.map +1 -1
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +82 -73
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/style.css +5 -38
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.cjs.map +1 -1
- package/dist/components/SideNav/index.d.cts.map +1 -1
- package/dist/components/SideNav/index.d.ts.map +1 -1
- package/dist/components/SideNav/index.js +52 -49
- package/dist/components/SideNav/index.js.map +1 -1
- package/dist/components/SideNav/style.css +2 -27
- package/dist/components/Slider/style.css +14 -5
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.cjs.map +1 -1
- package/dist/components/SortableList/index.d.cts.map +1 -1
- package/dist/components/SortableList/index.d.ts.map +1 -1
- package/dist/components/SortableList/index.js +42 -39
- package/dist/components/SortableList/index.js.map +1 -1
- package/dist/components/SortableList/style.css +9 -15
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.cjs.map +1 -1
- package/dist/components/Stepper/index.d.cts.map +1 -1
- package/dist/components/Stepper/index.d.ts.map +1 -1
- package/dist/components/Stepper/index.js +48 -39
- package/dist/components/Stepper/index.js.map +1 -1
- package/dist/components/Stepper/style.css +24 -18
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.cjs.map +1 -1
- package/dist/components/SubNav/index.d.cts.map +1 -1
- package/dist/components/SubNav/index.d.ts.map +1 -1
- package/dist/components/SubNav/index.js +27 -28
- package/dist/components/SubNav/index.js.map +1 -1
- package/dist/components/SubNav/style.css +13 -0
- 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 +23 -21
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/style.css +2 -28
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.js +8 -10
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TagsInput/style.css +2 -24
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -34
- package/dist/styles.css +2 -0
- package/package.json +1 -1
|
@@ -1,85 +1,88 @@
|
|
|
1
1
|
import { t as e } from "../../chunks/Icon-CGY1FNXT.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { Button as t } from "../Button/index.js";
|
|
3
|
+
import { Children as n, forwardRef as r, isValidElement as i, useCallback as a, useId as o, useState as s } from "react";
|
|
4
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import { DndContext as u, DragOverlay as d, KeyboardSensor as f, PointerSensor as p, closestCenter as m, useSensor as h, useSensors as g } from "@dnd-kit/core";
|
|
6
|
+
import { restrictToVerticalAxis as _ } from "@dnd-kit/modifiers";
|
|
7
|
+
import { SortableContext as v, arrayMove as y, sortableKeyboardCoordinates as b, useSortable as x, verticalListSortingStrategy as S } from "@dnd-kit/sortable";
|
|
8
|
+
import { CSS as C } from "@dnd-kit/utilities";
|
|
8
9
|
//#region src/components/SortableList/index.tsx
|
|
9
|
-
function
|
|
10
|
-
return
|
|
10
|
+
function w(e) {
|
|
11
|
+
return i(e) && typeof e.props.id == "string";
|
|
11
12
|
}
|
|
12
|
-
var
|
|
13
|
-
let D =
|
|
14
|
-
|
|
15
|
-
let P = h(
|
|
13
|
+
var T = r(function({ items: t, onReorder: r, renderDragOverlay: i, className: x, children: C, ...T }, E) {
|
|
14
|
+
let D = o(), [O, k] = s(null), [A, j] = s(t), [M, N] = s(t);
|
|
15
|
+
t !== M && t.join("\0") !== M.join("\0") && (N(t), j(t));
|
|
16
|
+
let P = g(h(p, { activationConstraint: { distance: 4 } }), h(f, { coordinateGetter: b })), F = a((e) => {
|
|
16
17
|
k(String(e.active.id));
|
|
17
|
-
}, []), I =
|
|
18
|
+
}, []), I = a((e) => {
|
|
18
19
|
k(null);
|
|
19
20
|
let { active: t, over: n } = e;
|
|
20
21
|
if (!n || t.id === n.id) return;
|
|
21
22
|
let i = A.indexOf(String(t.id)), a = A.indexOf(String(n.id));
|
|
22
23
|
if (i < 0 || a < 0) return;
|
|
23
|
-
let o =
|
|
24
|
+
let o = y(A, i, a);
|
|
24
25
|
j(o), r?.(o);
|
|
25
|
-
}, [A, r]), L =
|
|
26
|
-
return /* @__PURE__ */
|
|
26
|
+
}, [A, r]), L = n.toArray(C), R = new Map(L.filter(w).map((e) => [e.props.id, e])), z = [...A.flatMap((e) => R.get(e) ?? []), ...L.filter((e) => !w(e) || !A.includes(e.props.id))], B = O ? R.get(O) : void 0;
|
|
27
|
+
return /* @__PURE__ */ l(u, {
|
|
27
28
|
id: `ds-sortable-list-${D}`,
|
|
28
29
|
sensors: P,
|
|
29
|
-
collisionDetection:
|
|
30
|
-
modifiers: [
|
|
30
|
+
collisionDetection: m,
|
|
31
|
+
modifiers: [_],
|
|
31
32
|
onDragStart: F,
|
|
32
33
|
onDragEnd: I,
|
|
33
34
|
onDragCancel: () => k(null),
|
|
34
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ c(v, {
|
|
35
36
|
items: A,
|
|
36
|
-
strategy:
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
strategy: S,
|
|
38
|
+
children: /* @__PURE__ */ c("ul", {
|
|
38
39
|
ref: E,
|
|
39
|
-
className: ["ds-sortable-list",
|
|
40
|
+
className: ["ds-sortable-list", x].filter(Boolean).join(" "),
|
|
40
41
|
...T,
|
|
41
42
|
children: z
|
|
42
43
|
})
|
|
43
|
-
}), /* @__PURE__ */
|
|
44
|
+
}), /* @__PURE__ */ c(d, { children: O ? /* @__PURE__ */ l("div", {
|
|
44
45
|
className: "ds-sortable-item",
|
|
45
46
|
"data-overlay": !0,
|
|
46
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ c("span", {
|
|
47
48
|
className: "ds-sortable-item__handle",
|
|
48
49
|
"aria-hidden": "true",
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
-
}), /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ c(e, { name: "grip-vertical" })
|
|
51
|
+
}), /* @__PURE__ */ c("div", {
|
|
51
52
|
className: "ds-sortable-item__content",
|
|
52
|
-
children:
|
|
53
|
+
children: i ? i(O) : B?.props.children
|
|
53
54
|
})]
|
|
54
55
|
}) : null })]
|
|
55
56
|
});
|
|
56
|
-
}),
|
|
57
|
-
let { attributes: u, listeners: d, setNodeRef: f, transform: p, transition: m, isDragging: h } =
|
|
58
|
-
return /* @__PURE__ */
|
|
57
|
+
}), E = r(function({ id: e, label: n, action: r, className: i, children: a, ...o }, s) {
|
|
58
|
+
let { attributes: u, listeners: d, setNodeRef: f, transform: p, transition: m, isDragging: h } = x({ id: e });
|
|
59
|
+
return /* @__PURE__ */ l("li", {
|
|
59
60
|
ref: (e) => {
|
|
60
|
-
f(e), typeof
|
|
61
|
+
f(e), typeof s == "function" ? s(e) : s && (s.current = e);
|
|
61
62
|
},
|
|
62
63
|
style: {
|
|
63
|
-
transform:
|
|
64
|
+
transform: C.Translate.toString(p),
|
|
64
65
|
transition: m
|
|
65
66
|
},
|
|
66
67
|
className: ["ds-sortable-item", i].filter(Boolean).join(" "),
|
|
67
68
|
"data-dragging": h || void 0,
|
|
68
69
|
...o,
|
|
69
70
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
71
|
+
/* @__PURE__ */ c(t, {
|
|
72
|
+
variant: "simple",
|
|
73
|
+
size: "sm",
|
|
74
|
+
isIconOnly: !0,
|
|
75
|
+
iconStart: "grip-vertical",
|
|
72
76
|
className: "ds-sortable-item__handle",
|
|
73
77
|
"aria-label": n ? `Move ${n}` : "Move item",
|
|
74
78
|
...u,
|
|
75
|
-
...d
|
|
76
|
-
children: /* @__PURE__ */ s(e, { name: "grip-vertical" })
|
|
79
|
+
...d
|
|
77
80
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ c("div", {
|
|
79
82
|
className: "ds-sortable-item__content",
|
|
80
83
|
children: a
|
|
81
84
|
}),
|
|
82
|
-
r && /* @__PURE__ */
|
|
85
|
+
r && /* @__PURE__ */ c("div", {
|
|
83
86
|
className: "ds-sortable-item__action",
|
|
84
87
|
children: r
|
|
85
88
|
})
|
|
@@ -87,6 +90,6 @@ var w = n(function({ items: n, onReorder: r, renderDragOverlay: b, className: S,
|
|
|
87
90
|
});
|
|
88
91
|
});
|
|
89
92
|
//#endregion
|
|
90
|
-
export {
|
|
93
|
+
export { T as SortableList, E as SortableListItem };
|
|
91
94
|
|
|
92
95
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Icon","isItem","isValidElement","child","SortableList","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","order","setOrder","items","prevItems","setPrevItems","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","handleStart","useCallback","event","handleEnd","over","active","from","to","next","arrayMove","onReorder","childArray","Children","children","rows","ordered","id","activeRow","DndContext","closestCenter","restrictToVerticalAxis","SortableContext","verticalListSortingStrategy","className","DragOverlay","renderDragOverlay","SortableListItem","useSortable","setNodeRef","node","ref","CSS","transform","isDragging","label","attributes","listeners","action"],"sources":["../../../src/components/SortableList/index.tsx"],"sourcesContent":["import {\n Children,\n forwardRef,\n isValidElement,\n useCallback,\n useId,\n useState,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { Icon } from \"../Icon\";\nimport \"./style.css\";\n\nexport interface SortableListProps extends Omit<HTMLAttributes<HTMLUListElement>, \"onDragEnd\"> {\n /** Item ids in render order. */\n items: string[];\n /** Fired with the whole list in its new order. Apply it to your own state. */\n onReorder?: (items: string[]) => void;\n /** Rendered inside the drag overlay while a row is in the air. Defaults to the row's content. */\n renderDragOverlay?: (id: string) => ReactNode;\n children?: ReactNode;\n}\n\ntype ItemElement = ReactElement<SortableListItemProps>;\n\nfunction isItem(child: ReactNode): child is ItemElement {\n return isValidElement<SortableListItemProps>(child) && typeof child.props.id === \"string\";\n}\n\n/**\n * A single vertical list you can re-order — the board's mechanics without the\n * lanes. Each row carries a grip on the left. The list keeps the dropped order\n * itself, so it works on its own; pass `onReorder` to mirror it into your data.\n * A new `items` value from the parent always wins.\n */\nexport const SortableList = forwardRef<HTMLUListElement, SortableListProps>(\n function SortableList({ items, onReorder, renderDragOverlay, className, children, ...rest }, ref) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [order, setOrder] = useState(items);\n const [prevItems, setPrevItems] = useState(items);\n if (items !== prevItems && items.join(\"\\u0000\") !== prevItems.join(\"\\u0000\")) {\n setPrevItems(items);\n setOrder(items);\n }\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n setActiveId(null);\n const { active, over } = event;\n if (!over || active.id === over.id) return;\n const from = order.indexOf(String(active.id));\n const to = order.indexOf(String(over.id));\n if (from < 0 || to < 0) return;\n const next = arrayMove(order, from, to);\n setOrder(next);\n onReorder?.(next);\n },\n [order, onReorder],\n );\n\n // Rows follow the list's own order; anything that isn't a row keeps its place at the end.\n const childArray = Children.toArray(children);\n const rows = new Map(childArray.filter(isItem).map((child) => [child.props.id, child]));\n const ordered = [\n ...order.flatMap((id) => rows.get(id) ?? []),\n ...childArray.filter((child) => !isItem(child) || !order.includes(child.props.id)),\n ];\n const activeRow = activeId ? rows.get(activeId) : undefined;\n\n return (\n <DndContext\n id={`ds-sortable-list-${dndId}`}\n sensors={sensors}\n collisionDetection={closestCenter}\n modifiers={[restrictToVerticalAxis]}\n onDragStart={handleStart}\n onDragEnd={handleEnd}\n onDragCancel={() => setActiveId(null)}\n >\n <SortableContext items={order} strategy={verticalListSortingStrategy}>\n <ul\n ref={ref}\n className={[\"ds-sortable-list\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {ordered}\n </ul>\n </SortableContext>\n <DragOverlay>\n {activeId ? (\n <div className=\"ds-sortable-item\" data-overlay>\n <span className=\"ds-sortable-item__handle\" aria-hidden=\"true\">\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-sortable-item__content\">\n {renderDragOverlay ? renderDragOverlay(activeId) : activeRow?.props.children}\n </div>\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n },\n);\n\nexport interface SortableListItemProps extends HTMLAttributes<HTMLLIElement> {\n id: string;\n /** Accessible name announced when the row is picked up. */\n label?: string;\n /** A control at the end of the row, e.g. a menu or a delete button. */\n action?: ReactNode;\n children?: ReactNode;\n}\n\n/** One row of a `SortableList`. The grip on the left is the only handle. */\nexport const SortableListItem = forwardRef<HTMLLIElement, SortableListItemProps>(\n function SortableListItem({ id, label, action, className, children, ...rest }, ref) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id,\n });\n\n return (\n <li\n ref={(node) => {\n setNodeRef(node);\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-sortable-item\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n {...rest}\n >\n <
|
|
1
|
+
{"version":3,"file":"index.js","names":["Icon","isItem","isValidElement","child","SortableList","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","order","setOrder","items","prevItems","setPrevItems","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","handleStart","useCallback","event","handleEnd","over","active","from","to","next","arrayMove","onReorder","childArray","Children","children","rows","ordered","id","activeRow","DndContext","closestCenter","restrictToVerticalAxis","SortableContext","verticalListSortingStrategy","className","DragOverlay","renderDragOverlay","SortableListItem","useSortable","setNodeRef","node","ref","CSS","transform","isDragging","Button","label","attributes","listeners","action"],"sources":["../../../src/components/SortableList/index.tsx"],"sourcesContent":["import {\n Children,\n forwardRef,\n isValidElement,\n useCallback,\n useId,\n useState,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\nimport {\n SortableContext,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport \"./style.css\";\n\nexport interface SortableListProps extends Omit<HTMLAttributes<HTMLUListElement>, \"onDragEnd\"> {\n /** Item ids in render order. */\n items: string[];\n /** Fired with the whole list in its new order. Apply it to your own state. */\n onReorder?: (items: string[]) => void;\n /** Rendered inside the drag overlay while a row is in the air. Defaults to the row's content. */\n renderDragOverlay?: (id: string) => ReactNode;\n children?: ReactNode;\n}\n\ntype ItemElement = ReactElement<SortableListItemProps>;\n\nfunction isItem(child: ReactNode): child is ItemElement {\n return isValidElement<SortableListItemProps>(child) && typeof child.props.id === \"string\";\n}\n\n/**\n * A single vertical list you can re-order — the board's mechanics without the\n * lanes. Each row carries a grip on the left. The list keeps the dropped order\n * itself, so it works on its own; pass `onReorder` to mirror it into your data.\n * A new `items` value from the parent always wins.\n */\nexport const SortableList = forwardRef<HTMLUListElement, SortableListProps>(\n function SortableList({ items, onReorder, renderDragOverlay, className, children, ...rest }, ref) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [order, setOrder] = useState(items);\n const [prevItems, setPrevItems] = useState(items);\n if (items !== prevItems && items.join(\"\\u0000\") !== prevItems.join(\"\\u0000\")) {\n setPrevItems(items);\n setOrder(items);\n }\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n setActiveId(null);\n const { active, over } = event;\n if (!over || active.id === over.id) return;\n const from = order.indexOf(String(active.id));\n const to = order.indexOf(String(over.id));\n if (from < 0 || to < 0) return;\n const next = arrayMove(order, from, to);\n setOrder(next);\n onReorder?.(next);\n },\n [order, onReorder],\n );\n\n // Rows follow the list's own order; anything that isn't a row keeps its place at the end.\n const childArray = Children.toArray(children);\n const rows = new Map(childArray.filter(isItem).map((child) => [child.props.id, child]));\n const ordered = [\n ...order.flatMap((id) => rows.get(id) ?? []),\n ...childArray.filter((child) => !isItem(child) || !order.includes(child.props.id)),\n ];\n const activeRow = activeId ? rows.get(activeId) : undefined;\n\n return (\n <DndContext\n id={`ds-sortable-list-${dndId}`}\n sensors={sensors}\n collisionDetection={closestCenter}\n modifiers={[restrictToVerticalAxis]}\n onDragStart={handleStart}\n onDragEnd={handleEnd}\n onDragCancel={() => setActiveId(null)}\n >\n <SortableContext items={order} strategy={verticalListSortingStrategy}>\n <ul\n ref={ref}\n className={[\"ds-sortable-list\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {ordered}\n </ul>\n </SortableContext>\n <DragOverlay>\n {activeId ? (\n <div className=\"ds-sortable-item\" data-overlay>\n <span className=\"ds-sortable-item__handle\" aria-hidden=\"true\">\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-sortable-item__content\">\n {renderDragOverlay ? renderDragOverlay(activeId) : activeRow?.props.children}\n </div>\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n );\n },\n);\n\nexport interface SortableListItemProps extends HTMLAttributes<HTMLLIElement> {\n id: string;\n /** Accessible name announced when the row is picked up. */\n label?: string;\n /** A control at the end of the row, e.g. a menu or a delete button. */\n action?: ReactNode;\n children?: ReactNode;\n}\n\n/** One row of a `SortableList`. The grip on the left is the only handle. */\nexport const SortableListItem = forwardRef<HTMLLIElement, SortableListItemProps>(\n function SortableListItem({ id, label, action, className, children, ...rest }, ref) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({\n id,\n });\n\n return (\n <li\n ref={(node) => {\n setNodeRef(node);\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n style={{ transform: CSS.Translate.toString(transform), transition }}\n className={[\"ds-sortable-item\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n {...rest}\n >\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"grip-vertical\"\n className=\"ds-sortable-item__handle\"\n aria-label={label ? `Move ${label}` : \"Move item\"}\n {...attributes}\n {...listeners}\n />\n <div className=\"ds-sortable-item__content\">{children}</div>\n {action && <div className=\"ds-sortable-item__action\">{action}</div>}\n </li>\n );\n },\n);\n"],"mappings":";;;;;;;;;AA+CA,SAASC,EAAO,GAAwC;CACtD,OAAOC,EAAsCC,CAAK,KAAK,OAAOA,EAAM,MAAM,MAAO;AACnF;AAQA,IAAaC,IAAeC,EAC1B,SAAsB,EAAE,UAAO,cAAW,sBAAmB,cAAW,aAAU,GAAGC,KAAQ,GAAK;CAChG,IAAMC,IAAQC,EAAM,GACd,CAACC,GAAUC,KAAeC,EAAwB,IAAI,GACtD,CAACC,GAAOC,KAAYF,EAASG,CAAK,GAClC,CAACC,GAAWC,KAAgBL,EAASG,CAAK;CAChD,AAAI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,IAAQ,QAAQA,MAAU;IACtC,GAAIC;IACJ,GAAIC;GACL,CAAA;GACD,kBAAC,OAAD;IAAK,WAAU;IAA6B;GAAc,CAAA;GACzDC,KAAU,kBAAC,OAAD;IAAK,WAAU;IAA4B,UAAAA;GAAY,CAAA;EAChE;;AAER,CACF"}
|
|
@@ -35,25 +35,19 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.ds-sortable-item__handle {
|
|
38
|
-
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
border: 0;
|
|
42
|
-
padding: 0;
|
|
43
|
-
background: none;
|
|
44
|
-
color: var(--color-text-muted);
|
|
38
|
+
flex: none;
|
|
45
39
|
cursor: grab;
|
|
46
40
|
touch-action: none;
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
/* The drag overlay's grip is a picture of the handle, not a second control. */
|
|
44
|
+
span.ds-sortable-item__handle {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
inline-size: var(--field-height-sm);
|
|
49
|
+
block-size: var(--field-height-sm);
|
|
50
|
+
color: var(--color-text-muted);
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
.ds-sortable-item[data-overlay] .ds-sortable-item__handle {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs"),t=require("../Button/index.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(e,t){return e<t?`complete`:e===t?`current`:`upcoming`}var a=(0,n.forwardRef)(function({steps:a,activeStep:o,size:s=`md`,label:c=`Progress`,onStepChange:l,className:u,...d},f){let p=(0,n.useId)();return(0,r.jsx)(`nav`,{ref:f,"aria-label":c,"data-size":s,className:[`ds-stepper`,u].filter(Boolean).join(` `),...d,children:(0,r.jsx)(`ol`,{className:`ds-stepper__list`,children:a.map((n,a)=>{let s=i(a,o),c=!!l&&s!==`upcoming`,u=(0,r.jsxs)(r.Fragment,{children:[s===`complete`?(0,r.jsx)(e.t,{name:`check`,size:16,"aria-hidden":`true`}):a+1,(0,r.jsx)(`span`,{id:`${p}-${a}-status`,className:`ds-stepper__sr`,children:s})]});return(0,r.jsxs)(`li`,{className:`ds-stepper__step`,"data-status":s,"aria-current":s===`current`?`step`:void 0,children:[(0,r.jsxs)(`span`,{className:`ds-stepper__track`,"aria-hidden":`true`,children:[(0,r.jsx)(`span`,{className:`ds-stepper__connector`,"data-side":`start`}),(0,r.jsx)(`span`,{className:`ds-stepper__connector`,"data-side":`end`})]}),c?(0,r.jsx)(t.Button,{className:`ds-stepper__marker`,variant:s===`complete`?`primary`:`active`,size:`sm`,isIconOnly:!0,"aria-labelledby":`${p}-${a}-label`,"aria-describedby":`${p}-${a}-status`,onClick:()=>l?.(a,n.id),children:u}):(0,r.jsx)(`span`,{className:`ds-stepper__marker`,children:u}),(0,r.jsxs)(`span`,{className:`ds-stepper__text`,children:[(0,r.jsx)(`span`,{id:`${p}-${a}-label`,className:`ds-stepper__label`,children:n.label}),n.description&&(0,r.jsx)(`span`,{className:`ds-stepper__description`,children:n.description})]})]},n.id)})})})});exports.Stepper=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","Icon","require_Icon","react","react_jsx_runtime","statusOf","index","activeStep","Stepper","rest","label","size","className","steps","status","interactive","onStepChange","step"],"sources":["../../../src/components/Stepper/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport \"./style.css\";\n\nexport type StepperSize = \"sm\" | \"md\";\nexport type StepStatus = \"complete\" | \"current\" | \"upcoming\";\n\nexport interface Step {\n /** Stable key, and the value reported by `onStepChange`. */\n id: string;\n /** The step in the user's words — sentence case. */\n label: ReactNode;\n /** One line on what happens here. */\n description?: ReactNode;\n}\n\nexport interface StepperProps\n extends Omit<HTMLAttributes<HTMLElement>, \"onChange\" | \"children\"> {\n /** The ordered steps. Three or more spread evenly across the full width. */\n steps: Step[];\n /** Index of the step being worked on. Everything before it reads as complete. */\n activeStep: number;\n /** Marker scale. `sm` for a toolbar band, `md` for a page header. */\n size?: StepperSize;\n /** Accessible name for the progress bar. */\n label?: string;\n /**\n * Makes completed steps (and the current one) navigable. Omit for a\n * read-only progress indicator.\n */\n onStepChange?: (index: number, id: string) => void;\n}\n\nfunction statusOf(index: number, activeStep: number): StepStatus {\n if (index < activeStep) return \"complete\";\n if (index === activeStep) return \"current\";\n return \"upcoming\";\n}\n\n/**\n * A linear progress rail: 1 - 2 - 3. Steps share the row equally however many\n * there are, so the last marker always lands on the trailing edge.\n */\nexport const Stepper = forwardRef<HTMLElement, StepperProps>(function Stepper(\n { steps, activeStep, size = \"md\", label = \"Progress\", onStepChange, className, ...rest },\n ref,\n) {\n return (\n <nav\n ref={ref}\n aria-label={label}\n data-size={size}\n className={[\"ds-stepper\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ol className=\"ds-stepper__list\">\n {steps.map((step, index) => {\n const status = statusOf(index, activeStep);\n const interactive = Boolean(onStepChange) && status !== \"upcoming\";\n const
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useId","_Fragment","Icon","Button","require_Icon","require_components_Button_index","react","react_jsx_runtime","statusOf","index","activeStep","Stepper","rest","id","label","size","className","steps","status","interactive","onStepChange","marker","step"],"sources":["../../../src/components/Stepper/index.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport \"./style.css\";\n\nexport type StepperSize = \"sm\" | \"md\";\nexport type StepStatus = \"complete\" | \"current\" | \"upcoming\";\n\nexport interface Step {\n /** Stable key, and the value reported by `onStepChange`. */\n id: string;\n /** The step in the user's words — sentence case. */\n label: ReactNode;\n /** One line on what happens here. */\n description?: ReactNode;\n}\n\nexport interface StepperProps\n extends Omit<HTMLAttributes<HTMLElement>, \"onChange\" | \"children\"> {\n /** The ordered steps. Three or more spread evenly across the full width. */\n steps: Step[];\n /** Index of the step being worked on. Everything before it reads as complete. */\n activeStep: number;\n /** Marker scale. `sm` for a toolbar band, `md` for a page header. */\n size?: StepperSize;\n /** Accessible name for the progress bar. */\n label?: string;\n /**\n * Makes completed steps (and the current one) navigable. Omit for a\n * read-only progress indicator.\n */\n onStepChange?: (index: number, id: string) => void;\n}\n\nfunction statusOf(index: number, activeStep: number): StepStatus {\n if (index < activeStep) return \"complete\";\n if (index === activeStep) return \"current\";\n return \"upcoming\";\n}\n\n/**\n * A linear progress rail: 1 - 2 - 3. Steps share the row equally however many\n * there are, so the last marker always lands on the trailing edge.\n */\nexport const Stepper = forwardRef<HTMLElement, StepperProps>(function Stepper(\n { steps, activeStep, size = \"md\", label = \"Progress\", onStepChange, className, ...rest },\n ref,\n) {\n const id = useId();\n return (\n <nav\n ref={ref}\n aria-label={label}\n data-size={size}\n className={[\"ds-stepper\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ol className=\"ds-stepper__list\">\n {steps.map((step, index) => {\n const status = statusOf(index, activeStep);\n const interactive = Boolean(onStepChange) && status !== \"upcoming\";\n const marker = <>\n {status === \"complete\" ? <Icon name=\"check\" size={16} aria-hidden=\"true\" /> : index + 1}\n <span id={`${id}-${index}-status`} className=\"ds-stepper__sr\">{status}</span>\n </>;\n return (\n <li\n key={step.id}\n className=\"ds-stepper__step\"\n data-status={status}\n aria-current={status === \"current\" ? \"step\" : undefined}\n >\n <span className=\"ds-stepper__track\" aria-hidden=\"true\">\n <span className=\"ds-stepper__connector\" data-side=\"start\" />\n <span className=\"ds-stepper__connector\" data-side=\"end\" />\n </span>\n {interactive ? <Button\n className=\"ds-stepper__marker\"\n variant={status === \"complete\" ? \"primary\" : \"active\"}\n size=\"sm\"\n isIconOnly\n aria-labelledby={`${id}-${index}-label`}\n aria-describedby={`${id}-${index}-status`}\n onClick={() => onStepChange?.(index, step.id)}\n >{marker}</Button> : <span className=\"ds-stepper__marker\">{marker}</span>}\n <span className=\"ds-stepper__text\">\n <span id={`${id}-${index}-label`} className=\"ds-stepper__label\">{step.label}</span>\n {step.description && (\n <span className=\"ds-stepper__description\">{step.description}</span>\n )}\n </span>\n </li>\n );\n })}\n </ol>\n </nav>\n );\n});\n"],"mappings":"A,4MAkCA,SAASS,EAAS,EAAe,EAAgC,CAG/D,OAFIC,EAAQC,EAAmB,WAC3BD,IAAUC,EAAmB,UAC1B,UACT,CAMA,IAAaC,GAAA,EAAUZ,EAAAA,WAAAA,CAAsC,SAC3D,CAAE,QAAO,aAAY,OAAO,KAAM,QAAQ,WAAY,eAAc,YAAW,GAAGa,GAClF,EACA,CACA,IAAMC,GAAA,EAAKb,EAAAA,MAAAA,CAAM,EACjB,OACE,EAAAO,EAAA,IAAA,CAAC,MAAD,CACO,MACL,aAAYO,EACZ,YAAWC,EACX,UAAW,CAAC,aAAcC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC7D,GAAIJ,EAEJ,UAAA,EAAAL,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,mBACX,SAAAU,EAAM,KAAK,EAAM,IAAU,CAC1B,IAAMC,EAASV,EAASC,EAAOC,CAAU,EACnCS,EAAc,EAAQC,GAAiBF,IAAW,WAClDG,GAAS,EAAAd,EAAA,KAAA,CAAAN,EAAAA,SAAA,CAAA,SAAA,CACZiB,IAAW,YAAa,EAAAX,EAAA,IAAA,CAACL,EAAAA,EAAD,CAAM,KAAK,QAAQ,KAAM,GAAI,cAAY,MAAQ,CAAA,EAA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@@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Stepper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Stepper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/E,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AACtC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAE7D,MAAM,WAAW,IAAI;IACnB,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,KAAK,EAAE,SAAS,CAAC;IACjB,qCAAqC;IACrC,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAClE,4EAA4E;IAC5E,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAQD;;;GAGG;AACH,eAAO,MAAM,OAAO,sGAqDlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Stepper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Stepper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/E,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AACtC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAE7D,MAAM,WAAW,IAAI;IACnB,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,KAAK,EAAE,SAAS,CAAC;IACjB,qCAAqC;IACrC,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAClE,4EAA4E;IAC5E,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAQD;;;GAGG;AACH,eAAO,MAAM,OAAO,sGAqDlB,CAAC"}
|
|
@@ -1,69 +1,78 @@
|
|
|
1
1
|
import { t as e } from "../../chunks/Icon-CGY1FNXT.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Button as t } from "../Button/index.js";
|
|
3
|
+
import { forwardRef as n, useId as r } from "react";
|
|
4
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/Stepper/index.tsx
|
|
5
|
-
function
|
|
6
|
+
function s(e, t) {
|
|
6
7
|
return e < t ? "complete" : e === t ? "current" : "upcoming";
|
|
7
8
|
}
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
var c = n(function({ steps: n, activeStep: c, size: l = "md", label: u = "Progress", onStepChange: d, className: f, ...p }, m) {
|
|
10
|
+
let h = r();
|
|
11
|
+
return /* @__PURE__ */ a("nav", {
|
|
12
|
+
ref: m,
|
|
13
|
+
"aria-label": u,
|
|
14
|
+
"data-size": l,
|
|
15
|
+
className: ["ds-stepper", f].filter(Boolean).join(" "),
|
|
16
|
+
...p,
|
|
17
|
+
children: /* @__PURE__ */ a("ol", {
|
|
16
18
|
className: "ds-stepper__list",
|
|
17
|
-
children:
|
|
18
|
-
let
|
|
19
|
-
|
|
19
|
+
children: n.map((n, r) => {
|
|
20
|
+
let l = s(r, c), u = !!d && l !== "upcoming", f = /* @__PURE__ */ o(i, { children: [l === "complete" ? /* @__PURE__ */ a(e, {
|
|
21
|
+
name: "check",
|
|
22
|
+
size: 16,
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
}) : r + 1, /* @__PURE__ */ a("span", {
|
|
25
|
+
id: `${h}-${r}-status`,
|
|
26
|
+
className: "ds-stepper__sr",
|
|
27
|
+
children: l
|
|
28
|
+
})] });
|
|
29
|
+
return /* @__PURE__ */ o("li", {
|
|
20
30
|
className: "ds-stepper__step",
|
|
21
|
-
"data-status":
|
|
22
|
-
"aria-current":
|
|
31
|
+
"data-status": l,
|
|
32
|
+
"aria-current": l === "current" ? "step" : void 0,
|
|
23
33
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ o("span", {
|
|
25
35
|
className: "ds-stepper__track",
|
|
26
36
|
"aria-hidden": "true",
|
|
27
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ a("span", {
|
|
28
38
|
className: "ds-stepper__connector",
|
|
29
39
|
"data-side": "start"
|
|
30
|
-
}), /* @__PURE__ */
|
|
40
|
+
}), /* @__PURE__ */ a("span", {
|
|
31
41
|
className: "ds-stepper__connector",
|
|
32
42
|
"data-side": "end"
|
|
33
43
|
})]
|
|
34
44
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
45
|
+
u ? /* @__PURE__ */ a(t, {
|
|
36
46
|
className: "ds-stepper__marker",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
children: s
|
|
48
|
-
})]
|
|
47
|
+
variant: l === "complete" ? "primary" : "active",
|
|
48
|
+
size: "sm",
|
|
49
|
+
isIconOnly: !0,
|
|
50
|
+
"aria-labelledby": `${h}-${r}-label`,
|
|
51
|
+
"aria-describedby": `${h}-${r}-status`,
|
|
52
|
+
onClick: () => d?.(r, n.id),
|
|
53
|
+
children: f
|
|
54
|
+
}) : /* @__PURE__ */ a("span", {
|
|
55
|
+
className: "ds-stepper__marker",
|
|
56
|
+
children: f
|
|
49
57
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ o("span", {
|
|
51
59
|
className: "ds-stepper__text",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ a("span", {
|
|
61
|
+
id: `${h}-${r}-label`,
|
|
53
62
|
className: "ds-stepper__label",
|
|
54
|
-
children:
|
|
55
|
-
}),
|
|
63
|
+
children: n.label
|
|
64
|
+
}), n.description && /* @__PURE__ */ a("span", {
|
|
56
65
|
className: "ds-stepper__description",
|
|
57
|
-
children:
|
|
66
|
+
children: n.description
|
|
58
67
|
})]
|
|
59
68
|
})
|
|
60
69
|
]
|
|
61
|
-
},
|
|
70
|
+
}, n.id);
|
|
62
71
|
})
|
|
63
72
|
})
|
|
64
73
|
});
|
|
65
74
|
});
|
|
66
75
|
//#endregion
|
|
67
|
-
export {
|
|
76
|
+
export { c as Stepper };
|
|
68
77
|
|
|
69
78
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Icon","statusOf","index","activeStep","Stepper","forwardRef","rest","label","size","className","steps","status","interactive","onStepChange","step"],"sources":["../../../src/components/Stepper/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport \"./style.css\";\n\nexport type StepperSize = \"sm\" | \"md\";\nexport type StepStatus = \"complete\" | \"current\" | \"upcoming\";\n\nexport interface Step {\n /** Stable key, and the value reported by `onStepChange`. */\n id: string;\n /** The step in the user's words — sentence case. */\n label: ReactNode;\n /** One line on what happens here. */\n description?: ReactNode;\n}\n\nexport interface StepperProps\n extends Omit<HTMLAttributes<HTMLElement>, \"onChange\" | \"children\"> {\n /** The ordered steps. Three or more spread evenly across the full width. */\n steps: Step[];\n /** Index of the step being worked on. Everything before it reads as complete. */\n activeStep: number;\n /** Marker scale. `sm` for a toolbar band, `md` for a page header. */\n size?: StepperSize;\n /** Accessible name for the progress bar. */\n label?: string;\n /**\n * Makes completed steps (and the current one) navigable. Omit for a\n * read-only progress indicator.\n */\n onStepChange?: (index: number, id: string) => void;\n}\n\nfunction statusOf(index: number, activeStep: number): StepStatus {\n if (index < activeStep) return \"complete\";\n if (index === activeStep) return \"current\";\n return \"upcoming\";\n}\n\n/**\n * A linear progress rail: 1 - 2 - 3. Steps share the row equally however many\n * there are, so the last marker always lands on the trailing edge.\n */\nexport const Stepper = forwardRef<HTMLElement, StepperProps>(function Stepper(\n { steps, activeStep, size = \"md\", label = \"Progress\", onStepChange, className, ...rest },\n ref,\n) {\n return (\n <nav\n ref={ref}\n aria-label={label}\n data-size={size}\n className={[\"ds-stepper\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ol className=\"ds-stepper__list\">\n {steps.map((step, index) => {\n const status = statusOf(index, activeStep);\n const interactive = Boolean(onStepChange) && status !== \"upcoming\";\n const
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","Icon","Fragment$1","statusOf","index","activeStep","Stepper","forwardRef","rest","id","useId","label","size","className","steps","status","interactive","onStepChange","marker","Button","step"],"sources":["../../../src/components/Stepper/index.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport \"./style.css\";\n\nexport type StepperSize = \"sm\" | \"md\";\nexport type StepStatus = \"complete\" | \"current\" | \"upcoming\";\n\nexport interface Step {\n /** Stable key, and the value reported by `onStepChange`. */\n id: string;\n /** The step in the user's words — sentence case. */\n label: ReactNode;\n /** One line on what happens here. */\n description?: ReactNode;\n}\n\nexport interface StepperProps\n extends Omit<HTMLAttributes<HTMLElement>, \"onChange\" | \"children\"> {\n /** The ordered steps. Three or more spread evenly across the full width. */\n steps: Step[];\n /** Index of the step being worked on. Everything before it reads as complete. */\n activeStep: number;\n /** Marker scale. `sm` for a toolbar band, `md` for a page header. */\n size?: StepperSize;\n /** Accessible name for the progress bar. */\n label?: string;\n /**\n * Makes completed steps (and the current one) navigable. Omit for a\n * read-only progress indicator.\n */\n onStepChange?: (index: number, id: string) => void;\n}\n\nfunction statusOf(index: number, activeStep: number): StepStatus {\n if (index < activeStep) return \"complete\";\n if (index === activeStep) return \"current\";\n return \"upcoming\";\n}\n\n/**\n * A linear progress rail: 1 - 2 - 3. Steps share the row equally however many\n * there are, so the last marker always lands on the trailing edge.\n */\nexport const Stepper = forwardRef<HTMLElement, StepperProps>(function Stepper(\n { steps, activeStep, size = \"md\", label = \"Progress\", onStepChange, className, ...rest },\n ref,\n) {\n const id = useId();\n return (\n <nav\n ref={ref}\n aria-label={label}\n data-size={size}\n className={[\"ds-stepper\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ol className=\"ds-stepper__list\">\n {steps.map((step, index) => {\n const status = statusOf(index, activeStep);\n const interactive = Boolean(onStepChange) && status !== \"upcoming\";\n const marker = <>\n {status === \"complete\" ? <Icon name=\"check\" size={16} aria-hidden=\"true\" /> : index + 1}\n <span id={`${id}-${index}-status`} className=\"ds-stepper__sr\">{status}</span>\n </>;\n return (\n <li\n key={step.id}\n className=\"ds-stepper__step\"\n data-status={status}\n aria-current={status === \"current\" ? \"step\" : undefined}\n >\n <span className=\"ds-stepper__track\" aria-hidden=\"true\">\n <span className=\"ds-stepper__connector\" data-side=\"start\" />\n <span className=\"ds-stepper__connector\" data-side=\"end\" />\n </span>\n {interactive ? <Button\n className=\"ds-stepper__marker\"\n variant={status === \"complete\" ? \"primary\" : \"active\"}\n size=\"sm\"\n isIconOnly\n aria-labelledby={`${id}-${index}-label`}\n aria-describedby={`${id}-${index}-status`}\n onClick={() => onStepChange?.(index, step.id)}\n >{marker}</Button> : <span className=\"ds-stepper__marker\">{marker}</span>}\n <span className=\"ds-stepper__text\">\n <span id={`${id}-${index}-label`} className=\"ds-stepper__label\">{step.label}</span>\n {step.description && (\n <span className=\"ds-stepper__description\">{step.description}</span>\n )}\n </span>\n </li>\n );\n })}\n </ol>\n </nav>\n );\n});\n"],"mappings":";;;;;AAkCA,SAASG,EAAS,GAAe,GAAgC;CAG/D,OAFIC,IAAQC,IAAmB,aAC3BD,MAAUC,IAAmB,YAC1B;AACT;AAMA,IAAaC,IAAUC,EAAsC,SAC3D,EAAE,UAAO,eAAY,UAAO,MAAM,WAAQ,YAAY,iBAAc,cAAW,GAAGC,KAClF,GACA;CACA,IAAMC,IAAKC,EAAM;CACjB,OACE,kBAAC,OAAD;EACO;EACL,cAAYC;EACZ,aAAWC;EACX,WAAW,CAAC,cAAcC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC7D,GAAIL;EAEJ,UAAA,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAM,EAAM,KAAK,GAAM,MAAU;IAC1B,IAAMC,IAASZ,EAASC,GAAOC,CAAU,GACnCW,IAAc,EAAQC,KAAiBF,MAAW,YAClDG,IAAS,kBAAAlB,GAAA,EAAA,UAAA,CACZ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to the rail's marker size, so the
|
|
64
|
+
* connector and labels line up with read-only steps. */
|
|
65
|
+
.ds-stepper .ds-stepper__marker.ds-button {
|
|
66
|
+
inline-size: var(--stepper-marker-size);
|
|
67
|
+
height: var(--stepper-marker-size);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-stepper[data-size="sm"] .ds-stepper__marker.ds-button {
|
|
71
|
+
inline-size: var(--stepper-marker-size-sm);
|
|
72
|
+
height: var(--stepper-marker-size-sm);
|
|
73
|
+
font-size: var(--font-size-xs);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ds-stepper__marker:not(.ds-button) {
|
|
77
|
+
position: relative;
|
|
78
|
+
z-index: 1;
|
|
79
|
+
flex: none;
|
|
61
80
|
inline-size: var(--stepper-marker-size);
|
|
62
81
|
block-size: var(--stepper-marker-size);
|
|
63
82
|
display: grid;
|
|
@@ -74,38 +93,25 @@
|
|
|
74
93
|
transition: background-color var(--duration-fast) var(--ease-standard);
|
|
75
94
|
}
|
|
76
95
|
|
|
77
|
-
.ds-stepper[data-size="sm"] .ds-stepper__marker {
|
|
96
|
+
.ds-stepper[data-size="sm"] .ds-stepper__marker:not(.ds-button) {
|
|
78
97
|
inline-size: var(--stepper-marker-size-sm);
|
|
79
98
|
block-size: var(--stepper-marker-size-sm);
|
|
80
99
|
font-size: var(--font-size-xs);
|
|
81
100
|
}
|
|
82
101
|
|
|
83
|
-
|
|
84
|
-
cursor: pointer;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
button.ds-stepper__marker:hover {
|
|
88
|
-
background: var(--field-hover);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
button.ds-stepper__marker:focus-visible {
|
|
92
|
-
outline: var(--control-border-width) solid var(--color-focus);
|
|
93
|
-
outline-offset: 2px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.ds-stepper__step[data-status="complete"] .ds-stepper__marker {
|
|
102
|
+
.ds-stepper__step[data-status="complete"] .ds-stepper__marker:not(.ds-button) {
|
|
97
103
|
background: var(--color-primary);
|
|
98
104
|
border-color: var(--color-primary);
|
|
99
105
|
color: var(--color-text-on-solid);
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
.ds-stepper__step[data-status="current"] .ds-stepper__marker {
|
|
108
|
+
.ds-stepper__step[data-status="current"] .ds-stepper__marker:not(.ds-button) {
|
|
103
109
|
background: var(--color-primary-soft);
|
|
104
110
|
border-color: var(--color-primary);
|
|
105
111
|
color: var(--color-primary-text);
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
.ds-stepper__step[data-status="upcoming"] .ds-stepper__marker {
|
|
114
|
+
.ds-stepper__step[data-status="upcoming"] .ds-stepper__marker:not(.ds-button) {
|
|
109
115
|
color: var(--color-text-muted);
|
|
110
116
|
border-color: var(--color-border-muted);
|
|
111
117
|
}
|
|
@@ -147,7 +153,7 @@
|
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
@media (prefers-reduced-motion: reduce) {
|
|
150
|
-
.ds-stepper__marker {
|
|
156
|
+
.ds-stepper__marker:not(.ds-button) {
|
|
151
157
|
transition: none;
|
|
152
158
|
}
|
|
153
159
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs"),t=require("../Button/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=(0,n.forwardRef)(function({label:e,actions:t,className:n,children:i,...a},o){return(0,r.jsxs)(`nav`,{ref:o,"aria-label":e,className:[`ds-subnav`,n].filter(Boolean).join(` `),...a,children:[(0,r.jsx)(`ul`,{className:`ds-subnav__list`,children:i}),t&&(0,r.jsx)(`div`,{className:`ds-subnav__actions`,children:t})]})}),a=(0,n.forwardRef)(function({label:t,icon:n,isActive:i,count:a,className:o,...s},c){return(0,r.jsx)(`li`,{className:`ds-subnav__row`,children:(0,r.jsxs)(`a`,{ref:c,className:[`ds-subnav__item`,o].filter(Boolean).join(` `),"data-active":i||void 0,"aria-current":i?`page`:void 0,...s,children:[n&&(0,r.jsx)(e.t,{name:n}),t,a!==void 0&&(0,r.jsx)(`span`,{className:`ds-subnav__count`,children:a})]})})}),o=(0,n.forwardRef)(function({label:e,icon:n,isActive:i,count:a,disabled:o,className:s,...c},l){return(0,r.jsx)(`li`,{className:`ds-subnav__row`,children:(0,r.jsxs)(t.Button,{ref:l,variant:`simple`,iconStart:n,isDisabled:o,className:[`ds-subnav__item`,s].filter(Boolean).join(` `),"data-active":i||void 0,"aria-pressed":i,...c,children:[e,a!==void 0&&(0,r.jsx)(`span`,{className:`ds-subnav__count`,children:a})]})})});exports.SubNav=i,exports.SubNavButton=o,exports.SubNavItem=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","Icon","require_Icon","react","react_jsx_runtime","SubNav","rest","label","className","actions","SubNavItem","isActive","icon","count","SubNavButton"],"sources":["../../../src/components/SubNav/index.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport interface SubNavProps extends HTMLAttributes<HTMLElement> {\n /** Accessible name — say what the set switches, e.g. \"Article sections\". */\n label: string;\n /** Controls parked at the end of the row, e.g. a view switch. */\n actions?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * The second level: views inside one page — Content, Settings, Revisions. A\n * hairline rule runs the full width; the active item sits on the rail.\n */\nexport const SubNav = forwardRef<HTMLElement, SubNavProps>(function SubNav(\n { label, actions, className, children, ...rest },\n ref,\n) {\n return (\n <nav\n ref={ref}\n aria-label={label}\n className={[\"ds-subnav\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ul className=\"ds-subnav__list\">{children}</ul>\n {actions && <div className=\"ds-subnav__actions\">{actions}</div>}\n </nav>\n );\n});\n\ninterface SubNavItemBase {\n label: string;\n icon?: IconName;\n isActive?: boolean;\n /** A count beside the label — kept quiet, never a status colour. */\n count?: number;\n}\n\nexport interface SubNavItemProps\n extends SubNavItemBase,\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"children\"> {}\n\n/** One view, as a link. Use `SubNavButton` when the view is client state. */\nexport const SubNavItem = forwardRef<HTMLAnchorElement, SubNavItemProps>(\n function SubNavItem({ label, icon, isActive, count, className, ...rest }, ref) {\n return (\n <li className=\"ds-subnav__row\">\n <a\n ref={ref}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-current={isActive ? \"page\" : undefined}\n {...rest}\n >\n {icon && <Icon name={icon} />}\n {label}\n {count !== undefined && <span className=\"ds-subnav__count\">{count}</span>}\n </a>\n </li>\n );\n },\n);\n\nexport interface SubNavButtonProps\n extends SubNavItemBase,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"type\"> {}\n\n/** One view, as a control — for panes switched in place rather than routed. */\nexport const SubNavButton = forwardRef<HTMLButtonElement, SubNavButtonProps>(\n function SubNavButton({ label, icon, isActive, count, className, ...rest }, ref) {\n return (\n <li className=\"ds-subnav__row\">\n <
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","Icon","Button","require_Icon","require_components_Button_index","react","react_jsx_runtime","SubNav","rest","label","className","actions","SubNavItem","isActive","icon","count","SubNavButton","disabled"],"sources":["../../../src/components/SubNav/index.tsx"],"sourcesContent":["import {\n forwardRef,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport interface SubNavProps extends HTMLAttributes<HTMLElement> {\n /** Accessible name — say what the set switches, e.g. \"Article sections\". */\n label: string;\n /** Controls parked at the end of the row, e.g. a view switch. */\n actions?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * The second level: views inside one page — Content, Settings, Revisions. A\n * hairline rule runs the full width; the active item sits on the rail.\n */\nexport const SubNav = forwardRef<HTMLElement, SubNavProps>(function SubNav(\n { label, actions, className, children, ...rest },\n ref,\n) {\n return (\n <nav\n ref={ref}\n aria-label={label}\n className={[\"ds-subnav\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <ul className=\"ds-subnav__list\">{children}</ul>\n {actions && <div className=\"ds-subnav__actions\">{actions}</div>}\n </nav>\n );\n});\n\ninterface SubNavItemBase {\n label: string;\n icon?: IconName;\n isActive?: boolean;\n /** A count beside the label — kept quiet, never a status colour. */\n count?: number;\n}\n\nexport interface SubNavItemProps\n extends SubNavItemBase,\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"children\"> {}\n\n/** One view, as a link. Use `SubNavButton` when the view is client state. */\nexport const SubNavItem = forwardRef<HTMLAnchorElement, SubNavItemProps>(\n function SubNavItem({ label, icon, isActive, count, className, ...rest }, ref) {\n return (\n <li className=\"ds-subnav__row\">\n <a\n ref={ref}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-current={isActive ? \"page\" : undefined}\n {...rest}\n >\n {icon && <Icon name={icon} />}\n {label}\n {count !== undefined && <span className=\"ds-subnav__count\">{count}</span>}\n </a>\n </li>\n );\n },\n);\n\nexport interface SubNavButtonProps\n extends SubNavItemBase,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"type\"> {}\n\n/** One view, as a control — for panes switched in place rather than routed. */\nexport const SubNavButton = forwardRef<HTMLButtonElement, SubNavButtonProps>(\n function SubNavButton({ label, icon, isActive, count, disabled, className, ...rest }, ref) {\n return (\n <li className=\"ds-subnav__row\">\n <Button\n ref={ref}\n variant=\"simple\"\n iconStart={icon}\n isDisabled={disabled}\n className={[\"ds-subnav__item\", className].filter(Boolean).join(\" \")}\n data-active={isActive || undefined}\n aria-pressed={isActive}\n {...rest}\n >\n {label}\n {count !== undefined && <span className=\"ds-subnav__count\">{count}</span>}\n </Button>\n </li>\n );\n },\n);\n"],"mappings":"A,4MAwBA,IAAaO,GAAA,EAASP,EAAAA,WAAAA,CAAqC,SACzD,CAAE,QAAO,UAAS,YAAW,WAAU,GAAGQ,GAC1C,EACA,CACA,OACE,EAAAF,EAAA,KAAA,CAAC,MAAD,CACO,MACL,aAAYG,EACZ,UAAW,CAAC,YAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC5D,GAAIF,EAJN,SAAA,EAME,EAAAF,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,kBAAmB,UAAa,CAAA,EAC7CK,IAAW,EAAAL,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qBAAsB,SAAAK,CAAa,CAAA,CAC3D,C,EAET,CAAC,EAeYC,GAAA,EAAaZ,EAAAA,WAAAA,CACxB,SAAoB,CAAE,QAAO,OAAM,WAAU,QAAO,YAAW,GAAGQ,GAAQ,EAAK,CAC7E,OACE,EAAAF,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,iBACZ,UAAA,EAAAA,EAAA,KAAA,CAAC,IAAD,CACO,MACL,UAAW,CAAC,kBAAmBI,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,cAAaG,GAAY,IAAA,GACzB,eAAcA,EAAW,OAAS,IAAA,GAClC,GAAIL,EALN,SAAA,CAOGM,IAAQ,EAAAR,EAAA,IAAA,CAACL,EAAAA,EAAD,CAAM,KAAMa,CAAO,CAAA,EAC3BL,EACAM,IAAU,IAAA,KAAa,EAAAT,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,SAAAS,CAAY,CAAA,CACvE,C,EACD,CAAA,CAER,CACF,EAOaC,GAAA,EAAehB,EAAAA,WAAAA,CAC1B,SAAsB,CAAE,QAAO,OAAM,WAAU,QAAO,WAAU,YAAW,GAAGQ,GAAQ,EAAK,CACzF,OACE,EAAAF,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,iBACZ,UAAA,EAAAA,EAAA,KAAA,CAACJ,EAAAA,OAAD,CACO,MACL,QAAQ,SACR,UAAWY,EACX,WAAYG,EACZ,UAAW,CAAC,kBAAmBP,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAClE,cAAaG,GAAY,IAAA,GACzB,eAAcA,EACd,GAAIL,EARN,SAAA,CAUGC,EACAM,IAAU,IAAA,KAAa,EAAAT,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,SAAAS,CAAY,CAAA,CAClE,C,EACN,CAAA,CAER,CACF,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SubNav/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SubNav/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,qGAejB,CAAC;AAEH,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eACf,SAAQ,cAAc,EACpB,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAAG;AAEhE,6EAA6E;AAC7E,eAAO,MAAM,UAAU,+GAkBtB,CAAC;AAEF,MAAM,WAAW,iBACf,SAAQ,cAAc,EACpB,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAAG;AAEzE,+EAA+E;AAC/E,eAAO,MAAM,YAAY,iHAoBxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SubNav/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SubNav/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,qGAejB,CAAC;AAEH,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eACf,SAAQ,cAAc,EACpB,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAAG;AAEhE,6EAA6E;AAC7E,eAAO,MAAM,UAAU,+GAkBtB,CAAC;AAEF,MAAM,WAAW,iBACf,SAAQ,cAAc,EACpB,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAAG;AAEzE,+EAA+E;AAC/E,eAAO,MAAM,YAAY,iHAoBxB,CAAC"}
|