@namroodinc/liquid-editorial 0.1.6 → 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.
Files changed (142) hide show
  1. package/AGENTS.md +2 -0
  2. package/README.md +42 -0
  3. package/UPGRADING.md +68 -11
  4. package/dist/components/AppShell/index.cjs +2 -0
  5. package/dist/components/AppShell/index.cjs.map +1 -0
  6. package/dist/components/AppShell/index.d.cts +15 -0
  7. package/dist/components/AppShell/index.d.cts.map +1 -0
  8. package/dist/components/AppShell/index.d.ts +15 -0
  9. package/dist/components/AppShell/index.d.ts.map +1 -0
  10. package/dist/components/AppShell/index.js +93 -0
  11. package/dist/components/AppShell/index.js.map +1 -0
  12. package/dist/components/AppShell/style.css +79 -0
  13. package/dist/components/AssetGrid/index.cjs +1 -1
  14. package/dist/components/AssetGrid/index.cjs.map +1 -1
  15. package/dist/components/AssetGrid/index.d.cts.map +1 -1
  16. package/dist/components/AssetGrid/index.d.ts.map +1 -1
  17. package/dist/components/AssetGrid/index.js +57 -59
  18. package/dist/components/AssetGrid/index.js.map +1 -1
  19. package/dist/components/AssetGrid/style.css +8 -16
  20. package/dist/components/Board/index.cjs +1 -1
  21. package/dist/components/Board/index.cjs.map +1 -1
  22. package/dist/components/Board/index.d.cts.map +1 -1
  23. package/dist/components/Board/index.d.ts.map +1 -1
  24. package/dist/components/Board/index.js +88 -84
  25. package/dist/components/Board/index.js.map +1 -1
  26. package/dist/components/Board/style.css +17 -28
  27. package/dist/components/Button/index.cjs +1 -1
  28. package/dist/components/Button/index.cjs.map +1 -1
  29. package/dist/components/Button/index.d.cts +3 -2
  30. package/dist/components/Button/index.d.cts.map +1 -1
  31. package/dist/components/Button/index.d.ts +3 -2
  32. package/dist/components/Button/index.d.ts.map +1 -1
  33. package/dist/components/Button/index.js +1 -1
  34. package/dist/components/Button/index.js.map +1 -1
  35. package/dist/components/Button/style.css +21 -15
  36. package/dist/components/DatePicker/index.cjs +1 -1
  37. package/dist/components/DatePicker/index.cjs.map +1 -1
  38. package/dist/components/DatePicker/index.d.cts.map +1 -1
  39. package/dist/components/DatePicker/index.d.ts.map +1 -1
  40. package/dist/components/DatePicker/index.js +46 -45
  41. package/dist/components/DatePicker/index.js.map +1 -1
  42. package/dist/components/DatePicker/style.css +4 -61
  43. package/dist/components/Drawer/index.cjs +1 -1
  44. package/dist/components/Drawer/index.cjs.map +1 -1
  45. package/dist/components/Drawer/index.d.cts +10 -1
  46. package/dist/components/Drawer/index.d.cts.map +1 -1
  47. package/dist/components/Drawer/index.d.ts +10 -1
  48. package/dist/components/Drawer/index.d.ts.map +1 -1
  49. package/dist/components/Drawer/index.js +69 -47
  50. package/dist/components/Drawer/index.js.map +1 -1
  51. package/dist/components/Drawer/style.css +106 -0
  52. package/dist/components/EntryPicker/index.cjs +1 -1
  53. package/dist/components/EntryPicker/index.cjs.map +1 -1
  54. package/dist/components/EntryPicker/index.d.cts.map +1 -1
  55. package/dist/components/EntryPicker/index.d.ts.map +1 -1
  56. package/dist/components/EntryPicker/index.js +12 -11
  57. package/dist/components/EntryPicker/index.js.map +1 -1
  58. package/dist/components/EntryPicker/style.css +3 -30
  59. package/dist/components/Field/style.css +11 -3
  60. package/dist/components/Menu/index.cjs +1 -1
  61. package/dist/components/Menu/index.cjs.map +1 -1
  62. package/dist/components/Menu/index.d.cts.map +1 -1
  63. package/dist/components/Menu/index.d.ts.map +1 -1
  64. package/dist/components/Menu/index.js +11 -16
  65. package/dist/components/Menu/index.js.map +1 -1
  66. package/dist/components/Menu/style.css +7 -41
  67. package/dist/components/Modal/index.cjs +1 -1
  68. package/dist/components/Modal/index.cjs.map +1 -1
  69. package/dist/components/Modal/index.d.cts.map +1 -1
  70. package/dist/components/Modal/index.d.ts.map +1 -1
  71. package/dist/components/Modal/index.js +12 -12
  72. package/dist/components/Modal/index.js.map +1 -1
  73. package/dist/components/NumberField/index.cjs +1 -1
  74. package/dist/components/NumberField/index.cjs.map +1 -1
  75. package/dist/components/NumberField/index.js +13 -17
  76. package/dist/components/NumberField/index.js.map +1 -1
  77. package/dist/components/NumberField/style.css +1 -41
  78. package/dist/components/Popover/index.cjs +1 -1
  79. package/dist/components/Popover/index.cjs.map +1 -1
  80. package/dist/components/Popover/index.js +4 -4
  81. package/dist/components/SearchField/index.cjs +1 -1
  82. package/dist/components/SearchField/index.cjs.map +1 -1
  83. package/dist/components/SearchField/index.d.cts.map +1 -1
  84. package/dist/components/SearchField/index.d.ts.map +1 -1
  85. package/dist/components/SearchField/index.js +26 -27
  86. package/dist/components/SearchField/index.js.map +1 -1
  87. package/dist/components/SearchField/style.css +0 -21
  88. package/dist/components/Select/index.cjs +1 -1
  89. package/dist/components/Select/index.cjs.map +1 -1
  90. package/dist/components/Select/index.d.cts.map +1 -1
  91. package/dist/components/Select/index.d.ts.map +1 -1
  92. package/dist/components/Select/index.js +82 -75
  93. package/dist/components/Select/index.js.map +1 -1
  94. package/dist/components/Select/style.css +5 -38
  95. package/dist/components/SideNav/index.cjs +1 -1
  96. package/dist/components/SideNav/index.cjs.map +1 -1
  97. package/dist/components/SideNav/index.d.cts.map +1 -1
  98. package/dist/components/SideNav/index.d.ts.map +1 -1
  99. package/dist/components/SideNav/index.js +52 -49
  100. package/dist/components/SideNav/index.js.map +1 -1
  101. package/dist/components/SideNav/style.css +2 -27
  102. package/dist/components/SortableList/index.cjs +1 -1
  103. package/dist/components/SortableList/index.cjs.map +1 -1
  104. package/dist/components/SortableList/index.d.cts.map +1 -1
  105. package/dist/components/SortableList/index.d.ts.map +1 -1
  106. package/dist/components/SortableList/index.js +42 -39
  107. package/dist/components/SortableList/index.js.map +1 -1
  108. package/dist/components/SortableList/style.css +9 -15
  109. package/dist/components/Stepper/index.cjs +1 -1
  110. package/dist/components/Stepper/index.cjs.map +1 -1
  111. package/dist/components/Stepper/index.d.cts.map +1 -1
  112. package/dist/components/Stepper/index.d.ts.map +1 -1
  113. package/dist/components/Stepper/index.js +48 -39
  114. package/dist/components/Stepper/index.js.map +1 -1
  115. package/dist/components/Stepper/style.css +24 -18
  116. package/dist/components/SubNav/index.cjs +1 -1
  117. package/dist/components/SubNav/index.cjs.map +1 -1
  118. package/dist/components/SubNav/index.d.cts.map +1 -1
  119. package/dist/components/SubNav/index.d.ts.map +1 -1
  120. package/dist/components/SubNav/index.js +27 -28
  121. package/dist/components/SubNav/index.js.map +1 -1
  122. package/dist/components/SubNav/style.css +13 -0
  123. package/dist/components/Switch/index.cjs +1 -1
  124. package/dist/components/Switch/index.cjs.map +1 -1
  125. package/dist/components/Switch/index.d.cts.map +1 -1
  126. package/dist/components/Switch/index.d.ts.map +1 -1
  127. package/dist/components/Switch/index.js +23 -21
  128. package/dist/components/Switch/index.js.map +1 -1
  129. package/dist/components/Switch/style.css +2 -28
  130. package/dist/components/TagsInput/index.cjs +1 -1
  131. package/dist/components/TagsInput/index.cjs.map +1 -1
  132. package/dist/components/TagsInput/index.js +8 -10
  133. package/dist/components/TagsInput/index.js.map +1 -1
  134. package/dist/components/TagsInput/style.css +2 -24
  135. package/dist/index.cjs +1 -1
  136. package/dist/index.d.cts +2 -0
  137. package/dist/index.d.cts.map +1 -1
  138. package/dist/index.d.ts +2 -0
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +39 -38
  141. package/dist/styles.css +1 -0
  142. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
1
  import { t as e } from "../../chunks/Icon-CGY1FNXT.js";
2
- import { createContext as t, forwardRef as n, useCallback as r, useContext as i, useId as a, useMemo as o, useState as s } from "react";
3
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
4
- import { DndContext as u, DragOverlay as d, KeyboardSensor as f, MeasuringStrategy as p, PointerSensor as m, closestCorners as h, pointerWithin as g, useDroppable as _, useSensor as v, useSensors as y } from "@dnd-kit/core";
5
- import { SortableContext as b, horizontalListSortingStrategy as x, sortableKeyboardCoordinates as S, useSortable as C, verticalListSortingStrategy as w } from "@dnd-kit/sortable";
6
- import { CSS as T } from "@dnd-kit/utilities";
2
+ import { Button as t } from "../Button/index.js";
3
+ import { createContext as n, forwardRef as r, useCallback as i, useContext as a, useId as o, useMemo as s, useState as c } from "react";
4
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { DndContext as d, DragOverlay as f, KeyboardSensor as p, MeasuringStrategy as m, PointerSensor as h, closestCorners as g, pointerWithin as _, useDroppable as v, useSensor as y, useSensors as b } from "@dnd-kit/core";
6
+ import { SortableContext as x, horizontalListSortingStrategy as S, sortableKeyboardCoordinates as C, useSortable as w, verticalListSortingStrategy as T } from "@dnd-kit/sortable";
7
+ import { CSS as E } from "@dnd-kit/utilities";
7
8
  //#region src/components/Board/index.tsx
8
- var E = (e, t) => {
9
+ var D = (e, t) => {
9
10
  let { currentCoordinates: n, context: r } = t;
10
11
  if (e.code === "ArrowLeft" || e.code === "ArrowRight") {
11
12
  let t = r.droppableContainers.getEnabled().filter((e) => e.data.current?.type === "column-body").sort((e, t) => (e.rect.current?.left ?? 0) - (t.rect.current?.left ?? 0)), i = r.active?.rect.current.translated;
@@ -16,8 +17,8 @@ var E = (e, t) => {
16
17
  y: n.y
17
18
  }) : void 0;
18
19
  }
19
- return S(e, t);
20
- }, D = (e) => {
20
+ return C(e, t);
21
+ }, O = (e) => {
21
22
  let t = e.active.data.current?.type === "column", n = e.droppableContainers.filter((e) => {
22
23
  let n = e.data.current?.type;
23
24
  return t ? n === "column" : n !== "column";
@@ -25,21 +26,21 @@ var E = (e, t) => {
25
26
  ...e,
26
27
  droppableContainers: n
27
28
  };
28
- if (t) return h(r);
29
- let i = g(r);
29
+ if (t) return g(r);
30
+ let i = _(r);
30
31
  if (i.length > 0) {
31
32
  let e = (e) => n.find((t) => t.id === e)?.data.current?.type === "card" ? 0 : 1;
32
33
  return [...i].sort((t, n) => e(t.id) - e(n.id));
33
34
  }
34
- return h(r);
35
- }, O = t({
35
+ return g(r);
36
+ }, k = n({
36
37
  activeId: null,
37
38
  activeType: null,
38
39
  overColumnId: null
39
- }), k = n(function({ columnIds: t, onMove: n, onColumnMove: i, renderDragOverlay: h, renderColumnDragOverlay: g, className: _, children: S, ...C }, w) {
40
- let T = a(), [k, A] = s(null), [j, M] = s(null), [N, P] = s(null), F = y(v(m, { activationConstraint: { distance: 4 } }), v(f, { coordinateGetter: E })), I = r((e) => {
40
+ }), A = r(function({ columnIds: t, onMove: n, onColumnMove: r, renderDragOverlay: a, renderColumnDragOverlay: g, className: _, children: v, ...C }, w) {
41
+ let T = o(), [E, A] = c(null), [j, M] = c(null), [N, P] = c(null), F = b(y(h, { activationConstraint: { distance: 4 } }), y(p, { coordinateGetter: D })), I = i((e) => {
41
42
  A(String(e.active.id)), M(e.active.data.current?.type === "column" ? "column" : "card");
42
- }, []), L = r((e) => {
43
+ }, []), L = i((e) => {
43
44
  let t = e.over;
44
45
  if (!t) {
45
46
  P(null);
@@ -47,181 +48,184 @@ var E = (e, t) => {
47
48
  }
48
49
  let n = t.data.current ?? {}, r = n.type === "column" ? String(t.id) : String(n.columnId ?? "");
49
50
  P(r || null);
50
- }, []), R = r(() => {
51
+ }, []), R = i(() => {
51
52
  A(null), M(null), P(null);
52
- }, []), z = r((e) => {
53
- let { active: r, over: a } = e;
53
+ }, []), z = i((e) => {
54
+ let { active: i, over: a } = e;
54
55
  if (R(), !a) return;
55
- let o = r.data.current ?? {}, s = a.data.current ?? {};
56
+ let o = i.data.current ?? {}, s = a.data.current ?? {};
56
57
  if (o.type === "column") {
57
58
  let e = t ?? [], n = s.type === "column" ? String(a.id) : String(s.columnId ?? ""), o = e.indexOf(n);
58
- if (o < 0 || n === String(r.id)) return;
59
- i?.({
60
- columnId: String(r.id),
59
+ if (o < 0 || n === String(i.id)) return;
60
+ r?.({
61
+ columnId: String(i.id),
61
62
  toIndex: o
62
63
  });
63
64
  return;
64
65
  }
65
66
  let c = String(o.columnId ?? ""), l = "", u = 0;
66
- s.type === "card" ? (l = String(s.columnId ?? ""), u = s.sortable?.index ?? 0) : (l = String(s.columnId ?? a.id), u = (s.items ?? []).length), l && (c !== l || String(r.id) !== String(a.id)) && n?.({
67
- cardId: String(r.id),
67
+ s.type === "card" ? (l = String(s.columnId ?? ""), u = s.sortable?.index ?? 0) : (l = String(s.columnId ?? a.id), u = (s.items ?? []).length), l && (c !== l || String(i.id) !== String(a.id)) && n?.({
68
+ cardId: String(i.id),
68
69
  fromColumnId: c,
69
70
  toColumnId: l,
70
71
  toIndex: u
71
72
  });
72
73
  }, [
73
74
  t,
74
- i,
75
+ r,
75
76
  n,
76
77
  R
77
- ]), B = o(() => ({
78
- activeId: k,
78
+ ]), B = s(() => ({
79
+ activeId: E,
79
80
  activeType: j,
80
81
  overColumnId: N
81
82
  }), [
82
- k,
83
+ E,
83
84
  j,
84
85
  N
85
- ]), V = /* @__PURE__ */ c("div", {
86
+ ]), V = /* @__PURE__ */ l("div", {
86
87
  ref: w,
87
88
  className: ["ds-board", _].filter(Boolean).join(" "),
88
89
  ...C,
89
- children: S
90
+ children: v
90
91
  });
91
- return /* @__PURE__ */ c(O.Provider, {
92
+ return /* @__PURE__ */ l(k.Provider, {
92
93
  value: B,
93
- children: /* @__PURE__ */ l(u, {
94
+ children: /* @__PURE__ */ u(d, {
94
95
  id: `ds-board-${T}`,
95
96
  sensors: F,
96
- collisionDetection: D,
97
- measuring: { droppable: { strategy: p.Always } },
97
+ collisionDetection: O,
98
+ measuring: { droppable: { strategy: m.Always } },
98
99
  onDragStart: I,
99
100
  onDragOver: L,
100
101
  onDragEnd: z,
101
102
  onDragCancel: R,
102
- children: [t ? /* @__PURE__ */ c(b, {
103
+ children: [t ? /* @__PURE__ */ l(x, {
103
104
  items: t,
104
- strategy: x,
105
+ strategy: S,
105
106
  children: V
106
- }) : V, /* @__PURE__ */ l(d, { children: [k && j === "card" ? /* @__PURE__ */ l("div", {
107
+ }) : V, /* @__PURE__ */ u(f, { children: [E && j === "card" ? /* @__PURE__ */ u("div", {
107
108
  className: "ds-board-card",
108
109
  "data-overlay": !0,
109
- children: [/* @__PURE__ */ c("span", {
110
+ children: [/* @__PURE__ */ l("span", {
110
111
  className: "ds-board-card__handle",
111
112
  "aria-hidden": "true",
112
- children: /* @__PURE__ */ c(e, { name: "grip-vertical" })
113
- }), /* @__PURE__ */ c("div", {
113
+ children: /* @__PURE__ */ l(e, { name: "grip-vertical" })
114
+ }), /* @__PURE__ */ l("div", {
114
115
  className: "ds-board-card__content",
115
- children: h?.(k)
116
+ children: a?.(E)
116
117
  })]
117
- }) : null, k && j === "column" ? /* @__PURE__ */ c("div", {
118
+ }) : null, E && j === "column" ? /* @__PURE__ */ l("div", {
118
119
  className: "ds-board-column",
119
120
  "data-overlay": !0,
120
- children: g?.(k)
121
+ children: g?.(E)
121
122
  }) : null] })]
122
123
  })
123
124
  });
124
- }), A = n(function({ id: t, title: n, itemIds: r, count: a, action: o, isDraggable: s = !0, className: u, children: d, ...f }, p) {
125
- let { activeType: m, overColumnId: h } = i(O), { setNodeRef: g } = _({
126
- id: `${t}::body`,
125
+ }), j = r(function({ id: e, title: n, itemIds: r, count: i, action: o, isDraggable: s = !0, className: c, children: d, ...f }, p) {
126
+ let { activeType: m, overColumnId: h } = a(k), { setNodeRef: g } = v({
127
+ id: `${e}::body`,
127
128
  data: {
128
129
  type: "column-body",
129
- columnId: t,
130
+ columnId: e,
130
131
  items: r
131
132
  }
132
- }), { attributes: v, listeners: y, setNodeRef: x, transform: S, transition: E, isDragging: D } = C({
133
- id: t,
133
+ }), { attributes: _, listeners: y, setNodeRef: b, transform: S, transition: C, isDragging: D } = w({
134
+ id: e,
134
135
  disabled: !s,
135
136
  data: {
136
137
  type: "column",
137
- columnId: t,
138
+ columnId: e,
138
139
  items: r
139
140
  }
140
141
  });
141
- return /* @__PURE__ */ l("section", {
142
+ return /* @__PURE__ */ u("section", {
142
143
  ref: (e) => {
143
- x(e), typeof p == "function" ? p(e) : p && (p.current = e);
144
+ b(e), typeof p == "function" ? p(e) : p && (p.current = e);
144
145
  },
145
146
  style: {
146
- transform: T.Translate.toString(S),
147
- transition: E
147
+ transform: E.Translate.toString(S),
148
+ transition: C
148
149
  },
149
- className: ["ds-board-column", u].filter(Boolean).join(" "),
150
- "data-over": m === "card" && h === t || void 0,
150
+ className: ["ds-board-column", c].filter(Boolean).join(" "),
151
+ "data-over": m === "card" && h === e || void 0,
151
152
  "data-dragging": D || void 0,
152
153
  "aria-label": n,
153
154
  ...f,
154
155
  children: [
155
- s && /* @__PURE__ */ c("button", {
156
- type: "button",
156
+ s && /* @__PURE__ */ l(t, {
157
+ variant: "simple",
158
+ size: "sm",
159
+ iconStart: "grip-horizontal",
157
160
  className: "ds-board-column__grip",
158
161
  "aria-label": `Reorder ${n}`,
159
- ...v,
160
- ...y,
161
- children: /* @__PURE__ */ c(e, { name: "grip-horizontal" })
162
+ ..._,
163
+ ...y
162
164
  }),
163
- /* @__PURE__ */ l("header", {
165
+ /* @__PURE__ */ u("header", {
164
166
  className: "ds-board-column__head",
165
167
  children: [
166
- /* @__PURE__ */ c("span", {
168
+ /* @__PURE__ */ l("span", {
167
169
  className: "ds-board-column__title",
168
170
  children: n
169
171
  }),
170
- /* @__PURE__ */ c("span", {
172
+ /* @__PURE__ */ l("span", {
171
173
  className: "ds-board-column__count",
172
- children: a ?? r.length
174
+ children: i ?? r.length
173
175
  }),
174
- o && /* @__PURE__ */ c("span", {
176
+ o && /* @__PURE__ */ l("span", {
175
177
  className: "ds-board-column__action",
176
178
  children: o
177
179
  })
178
180
  ]
179
181
  }),
180
- /* @__PURE__ */ c("div", {
182
+ /* @__PURE__ */ l("div", {
181
183
  ref: g,
182
184
  className: "ds-board-column__body",
183
- children: /* @__PURE__ */ c(b, {
185
+ children: /* @__PURE__ */ l(x, {
184
186
  items: r,
185
- strategy: w,
187
+ strategy: T,
186
188
  children: d
187
189
  })
188
190
  })
189
191
  ]
190
192
  });
191
- }), j = n(function({ id: t, columnId: n, label: r, className: a, children: o, ...s }, u) {
192
- let { attributes: d, listeners: f, setNodeRef: p, transform: m, transition: h, isDragging: g } = C({
193
- id: t,
193
+ }), M = r(function({ id: e, columnId: n, label: r, className: i, children: o, ...s }, c) {
194
+ let { attributes: d, listeners: f, setNodeRef: p, transform: m, transition: h, isDragging: g } = w({
195
+ id: e,
194
196
  data: {
195
197
  type: "card",
196
198
  columnId: n
197
199
  }
198
- }), { activeId: _ } = i(O);
199
- return /* @__PURE__ */ l("div", {
200
+ }), { activeId: _ } = a(k);
201
+ return /* @__PURE__ */ u("div", {
200
202
  ref: (e) => {
201
- p(e), typeof u == "function" ? u(e) : u && (u.current = e);
203
+ p(e), typeof c == "function" ? c(e) : c && (c.current = e);
202
204
  },
203
205
  style: {
204
- transform: T.Translate.toString(m),
206
+ transform: E.Translate.toString(m),
205
207
  transition: h
206
208
  },
207
- className: ["ds-board-card", a].filter(Boolean).join(" "),
209
+ className: ["ds-board-card", i].filter(Boolean).join(" "),
208
210
  "data-dragging": g || void 0,
209
- "data-idle": _ && _ !== t ? "" : void 0,
211
+ "data-idle": _ && _ !== e ? "" : void 0,
210
212
  ...s,
211
- children: [/* @__PURE__ */ c("button", {
212
- type: "button",
213
+ children: [/* @__PURE__ */ l(t, {
214
+ variant: "simple",
215
+ size: "sm",
216
+ isIconOnly: !0,
217
+ iconStart: "grip-vertical",
213
218
  className: "ds-board-card__handle",
214
219
  "aria-label": r ? `Move ${r}` : "Move card",
215
220
  ...d,
216
- ...f,
217
- children: /* @__PURE__ */ c(e, { name: "grip-vertical" })
218
- }), /* @__PURE__ */ c("div", {
221
+ ...f
222
+ }), /* @__PURE__ */ l("div", {
219
223
  className: "ds-board-card__content",
220
224
  children: o
221
225
  })]
222
226
  });
223
227
  });
224
228
  //#endregion
225
- export { k as Board, j as BoardCard, A as BoardColumn };
229
+ export { A as Board, M as BoardCard, j as BoardColumn };
226
230
 
227
231
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Icon","boardCoordinateGetter","args","event","containers","context","c","\"type\"","a","b","activeRect","rect","currentCoordinates","sortableKeyboardCoordinates","boardCollisionDetection","isColumn","type","container","scoped","closestCorners","within","pointerWithin","rank","id","BoardContext","createContext","Board","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","activeType","setActiveType","overColumnId","setOverColumnId","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","handleStart","useCallback","handleOver","over","overData","columnId","\"columnId\"","reset","handleEnd","activeData","active","ids","columnIds","toIndex","fromColumnId","toColumnId","\"sortable\"","\"items\"","onMove","onColumnMove","value","useMemo","board","className","DndContext","MeasuringStrategy","SortableContext","horizontalListSortingStrategy","DragOverlay","renderDragOverlay","renderColumnDragOverlay","BoardColumn","useContext","setBodyRef","useDroppable","itemIds","setColumnRef","useSortable","isDraggable","node","ref","CSS","transform","isDragging","title","attributes","listeners","count","action","verticalListSortingStrategy","BoardCard","setNodeRef","label"],"sources":["../../../src/components/Board/index.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCorners,\n pointerWithin,\n MeasuringStrategy,\n\n useDroppable,\n useSensor,\n useSensors,\n type CollisionDetection,\n type DragEndEvent,\n type DragOverEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n horizontalListSortingStrategy,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport type { KeyboardCoordinateGetter } from \"@dnd-kit/core\";\nimport { Icon } from \"../Icon\";\nimport \"./style.css\";\n\nexport interface BoardMove {\n cardId: string;\n fromColumnId: string;\n toColumnId: string;\n /** Index the card lands on inside the destination column. */\n toIndex: number;\n}\n\nexport interface BoardColumnMove {\n columnId: string;\n toIndex: number;\n}\n\ninterface BoardContextValue {\n activeId: string | null;\n activeType: \"card\" | \"column\" | null;\n /** The lane the pointer is currently over, whatever it is actually over. */\n overColumnId: string | null;\n}\n\n/**\n * Arrow up/down sorts inside a lane; left/right jumps lanes, which the stock\n * sortable getter does not do.\n */\nconst boardCoordinateGetter: KeyboardCoordinateGetter = (event, args) => {\n const { currentCoordinates, context } = args;\n if (event.code === \"ArrowLeft\" || event.code === \"ArrowRight\") {\n const containers = context.droppableContainers\n .getEnabled()\n .filter((c) => c.data.current?.[\"type\"] === \"column-body\")\n .sort((a, b) => (a.rect.current?.left ?? 0) - (b.rect.current?.left ?? 0));\n const activeRect = context.active?.rect.current.translated;\n if (!activeRect) return undefined;\n const index = containers.findIndex(\n (c) => (c.rect.current?.left ?? 0) <= activeRect.left + 1 &&\n (c.rect.current?.right ?? 0) >= activeRect.left - 1,\n );\n const next = containers[index + (event.code === \"ArrowRight\" ? 1 : -1)];\n const rect = next?.rect.current;\n if (!rect) return undefined;\n event.preventDefault();\n return { x: rect.left + rect.width / 2 - activeRect.width / 2, y: currentCoordinates.y };\n }\n return sortableKeyboardCoordinates(event, args);\n};\n\n/**\n * A lane's body sits inside the lane's frame, so a raw corner-distance\n * strategy lets the body steal the hit from the lane itself — most visibly at\n * the board ends, where the last lane then never shifts aside to open the\n * drop gap. Resolve by what is being dragged: a column only ever hits other\n * columns; a card hits the card under the pointer first, then the lane body\n * under it, then whatever is nearest.\n */\nconst boardCollisionDetection: CollisionDetection = (args) => {\n const isColumn = args.active.data.current?.[\"type\"] === \"column\";\n const containers = args.droppableContainers.filter((container) => {\n const type = container.data.current?.[\"type\"];\n return isColumn ? type === \"column\" : type !== \"column\";\n });\n const scoped = { ...args, droppableContainers: containers };\n if (isColumn) return closestCorners(scoped);\n const within = pointerWithin(scoped);\n if (within.length > 0) {\n const rank = (id: (typeof within)[number][\"id\"]) =>\n containers.find((c) => c.id === id)?.data.current?.[\"type\"] === \"card\" ? 0 : 1;\n return [...within].sort((a, b) => rank(a.id) - rank(b.id));\n }\n return closestCorners(scoped);\n};\n\nconst BoardContext = createContext<BoardContextValue>({\n activeId: null,\n activeType: null,\n overColumnId: null,\n});\n\nexport interface BoardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onDragEnd\"> {\n /** Column ids in render order. Required for columns to be re-orderable. */\n columnIds?: string[];\n /** Fired once a card is dropped somewhere new. Apply it to your own state. */\n onMove?: (move: BoardMove) => void;\n /** Fired once a column is dropped in a new position. */\n onColumnMove?: (move: BoardColumnMove) => void;\n /** Rendered inside the drag overlay while a card is in the air. */\n renderDragOverlay?: (cardId: string) => ReactNode;\n /** Rendered inside the drag overlay while a column is in the air. */\n renderColumnDragOverlay?: (columnId: string) => ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A column board with pointer and keyboard dragging. The board owns the drag\n * mechanics only — the card data stays yours; react to `onMove`.\n */\nexport const Board = forwardRef<HTMLDivElement, BoardProps>(function Board(\n {\n columnIds,\n onMove,\n onColumnMove,\n renderDragOverlay,\n renderColumnDragOverlay,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeType, setActiveType] = useState<\"card\" | \"column\" | null>(null);\n const [overColumnId, setOverColumnId] = useState<string | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: boardCoordinateGetter }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n setActiveType(event.active.data.current?.[\"type\"] === \"column\" ? \"column\" : \"card\");\n }, []);\n\n /* Cards land on cards as often as on empty space, so the lane a drag is over\n * is always resolved back to a column id — one highlight, one meaning. */\n const handleOver = useCallback((event: DragOverEvent) => {\n const over = event.over;\n if (!over) {\n setOverColumnId(null);\n return;\n }\n const overData = over.data.current ?? {};\n const columnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n setOverColumnId(columnId || null);\n }, []);\n\n const reset = useCallback(() => {\n setActiveId(null);\n setActiveType(null);\n setOverColumnId(null);\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n reset();\n if (!over) return;\n\n const activeData = active.data.current ?? {};\n const overData = over.data.current ?? {};\n\n /* Columns reorder among themselves; a column never lands inside a lane. */\n if (activeData[\"type\"] === \"column\") {\n const ids = columnIds ?? [];\n const overColumnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n const toIndex = ids.indexOf(overColumnId);\n if (toIndex < 0 || overColumnId === String(active.id)) return;\n onColumnMove?.({ columnId: String(active.id), toIndex });\n return;\n }\n\n const fromColumnId = String(activeData[\"columnId\"] ?? \"\");\n let toColumnId = \"\";\n let toIndex = 0;\n\n if (overData[\"type\"] === \"card\") {\n /* Dropped on a card — land exactly where that card sits, in any lane. */\n toColumnId = String(overData[\"columnId\"] ?? \"\");\n toIndex = (overData[\"sortable\"] as { index: number } | undefined)?.index ?? 0;\n } else {\n /* Dropped on empty lane space — land at the end. */\n toColumnId = String(overData[\"columnId\"] ?? over.id);\n toIndex = ((overData[\"items\"] as string[] | undefined) ?? []).length;\n }\n\n if (!toColumnId) return;\n if (fromColumnId === toColumnId && String(active.id) === String(over.id)) return;\n onMove?.({ cardId: String(active.id), fromColumnId, toColumnId, toIndex });\n },\n [columnIds, onColumnMove, onMove, reset],\n );\n\n const value = useMemo(\n () => ({ activeId, activeType, overColumnId }),\n [activeId, activeType, overColumnId],\n );\n\n const board = (\n <div ref={ref} className={[\"ds-board\", className].filter(Boolean).join(\" \")} {...rest}>\n {children}\n </div>\n );\n\n return (\n <BoardContext.Provider value={value}>\n <DndContext\n id={`ds-board-${dndId}`}\n sensors={sensors}\n collisionDetection={boardCollisionDetection}\n /* Lanes scroll and change height mid-drag, so positions are re-read\n * continuously — without this the shift animation misfires. */\n measuring={{ droppable: { strategy: MeasuringStrategy.Always } }}\n\n onDragStart={handleStart}\n onDragOver={handleOver}\n onDragEnd={handleEnd}\n onDragCancel={reset}\n >\n {columnIds ? (\n <SortableContext items={columnIds} strategy={horizontalListSortingStrategy}>\n {board}\n </SortableContext>\n ) : (\n board\n )}\n <DragOverlay>\n {activeId && activeType === \"card\" ? (\n <div className=\"ds-board-card\" data-overlay>\n <span className=\"ds-board-card__handle\" aria-hidden=\"true\">\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-board-card__content\">{renderDragOverlay?.(activeId)}</div>\n </div>\n ) : null}\n {activeId && activeType === \"column\" ? (\n <div className=\"ds-board-column\" data-overlay>\n {renderColumnDragOverlay?.(activeId)}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </BoardContext.Provider>\n );\n});\n\nexport interface BoardColumnProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n title: string;\n /** Card ids in render order — the sortable contract for this column. */\n itemIds: string[];\n /** Shown beside the title; defaults to the number of cards. */\n count?: number;\n /** A control in the column head, e.g. an add button or a menu. */\n action?: ReactNode;\n /** Set false to pin a lane in place. */\n isDraggable?: boolean;\n children?: ReactNode;\n}\n\n/**\n * One lane of the board. Heavy frame, hairline head rule, scrolling body, and\n * a grip on top of the head that drags the whole lane sideways.\n */\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(\n function BoardColumn(\n { id, title, itemIds, count, action, isDraggable = true, className, children, ...rest },\n ref,\n ) {\n const { activeType, overColumnId } = useContext(BoardContext);\n const { setNodeRef: setBodyRef } = useDroppable({\n id: `${id}::body`,\n data: { type: \"column-body\", columnId: id, items: itemIds },\n });\n const {\n attributes,\n listeners,\n setNodeRef: setColumnRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n disabled: !isDraggable,\n data: { type: \"column\", columnId: id, items: itemIds },\n });\n\n return (\n <section\n ref={(node) => {\n setColumnRef(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-board-column\", className].filter(Boolean).join(\" \")}\n data-over={(activeType === \"card\" && overColumnId === id) || undefined}\n data-dragging={isDragging || undefined}\n\n aria-label={title}\n {...rest}\n >\n {isDraggable && (\n <button\n type=\"button\"\n className=\"ds-board-column__grip\"\n aria-label={`Reorder ${title}`}\n {...attributes}\n {...listeners}\n >\n <Icon name=\"grip-horizontal\" />\n </button>\n )}\n <header className=\"ds-board-column__head\">\n <span className=\"ds-board-column__title\">{title}</span>\n <span className=\"ds-board-column__count\">{count ?? itemIds.length}</span>\n {action && <span className=\"ds-board-column__action\">{action}</span>}\n </header>\n <div ref={setBodyRef} className=\"ds-board-column__body\">\n <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>\n {children}\n </SortableContext>\n </div>\n </section>\n );\n },\n);\n\nexport interface BoardCardProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n columnId: string;\n /** Accessible name announced when the card is picked up. */\n label?: string;\n children?: ReactNode;\n}\n\n/**\n * A draggable card. The grip on the left is the handle, so the card body can\n * hold links and buttons; the grip is a real button for keyboard users:\n * space to pick up, arrows to move, space to drop.\n */\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { id, columnId, label, className, children, ...rest },\n ref,\n) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } =\n useSortable({ id, data: { type: \"card\", columnId } });\n const { activeId } = useContext(BoardContext);\n\n return (\n <div\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-board-card\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n data-idle={activeId && activeId !== id ? \"\" : undefined}\n {...rest}\n >\n <button\n type=\"button\"\n className=\"ds-board-card__handle\"\n aria-label={label ? `Move ${label}` : \"Move card\"}\n {...attributes}\n {...listeners}\n >\n <Icon name=\"grip-vertical\" />\n </button>\n <div className=\"ds-board-card__content\">{children}</div>\n </div>\n );\n});\n"],"mappings":";;;;;;;AAgEA,IAAMC,KAAmD,GAAO,MAAS;CACvE,I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S;GAAG;EAAW;EAClE,WAAW,CAAC,iBAAiBnB,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAChE,iBAAeoB,KAAc,KAAA;EAC7B,aAAWvD,KAAYA,MAAaR,IAAK,KAAK,KAAA;EAC9C,GAAIK;EAVN,UAAA,CAYE,kBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,cAAYmE,IAAQ,QAAQA,MAAU;GACtC,GAAIP;GACJ,GAAIC;GAEJ,UAAA,kBAACzF,GAAD,EAAM,MAAK,gBAAiB,CAAA;EACtB,CAAA,GACR,kBAAC,OAAD;GAAK,WAAU;GAA0B;EAAc,CAAA,CACpD;;AAET,CAAC"}
1
+ {"version":3,"file":"index.js","names":["Icon","boardCoordinateGetter","args","event","containers","context","c","\"type\"","a","b","activeRect","rect","currentCoordinates","sortableKeyboardCoordinates","boardCollisionDetection","isColumn","type","container","scoped","closestCorners","within","pointerWithin","rank","id","BoardContext","createContext","Board","forwardRef","rest","dndId","useId","activeId","setActiveId","useState","activeType","setActiveType","overColumnId","setOverColumnId","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","handleStart","useCallback","handleOver","over","overData","columnId","\"columnId\"","reset","handleEnd","activeData","active","ids","columnIds","toIndex","fromColumnId","toColumnId","\"sortable\"","\"items\"","onMove","onColumnMove","value","useMemo","board","className","DndContext","MeasuringStrategy","SortableContext","horizontalListSortingStrategy","DragOverlay","renderDragOverlay","renderColumnDragOverlay","BoardColumn","useContext","setBodyRef","useDroppable","itemIds","setColumnRef","useSortable","isDraggable","node","ref","CSS","transform","isDragging","title","Button","attributes","listeners","count","action","verticalListSortingStrategy","BoardCard","setNodeRef","label"],"sources":["../../../src/components/Board/index.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n closestCorners,\n pointerWithin,\n MeasuringStrategy,\n\n useDroppable,\n useSensor,\n useSensors,\n type CollisionDetection,\n type DragEndEvent,\n type DragOverEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n horizontalListSortingStrategy,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport type { KeyboardCoordinateGetter } from \"@dnd-kit/core\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport \"./style.css\";\n\nexport interface BoardMove {\n cardId: string;\n fromColumnId: string;\n toColumnId: string;\n /** Index the card lands on inside the destination column. */\n toIndex: number;\n}\n\nexport interface BoardColumnMove {\n columnId: string;\n toIndex: number;\n}\n\ninterface BoardContextValue {\n activeId: string | null;\n activeType: \"card\" | \"column\" | null;\n /** The lane the pointer is currently over, whatever it is actually over. */\n overColumnId: string | null;\n}\n\n/**\n * Arrow up/down sorts inside a lane; left/right jumps lanes, which the stock\n * sortable getter does not do.\n */\nconst boardCoordinateGetter: KeyboardCoordinateGetter = (event, args) => {\n const { currentCoordinates, context } = args;\n if (event.code === \"ArrowLeft\" || event.code === \"ArrowRight\") {\n const containers = context.droppableContainers\n .getEnabled()\n .filter((c) => c.data.current?.[\"type\"] === \"column-body\")\n .sort((a, b) => (a.rect.current?.left ?? 0) - (b.rect.current?.left ?? 0));\n const activeRect = context.active?.rect.current.translated;\n if (!activeRect) return undefined;\n const index = containers.findIndex(\n (c) => (c.rect.current?.left ?? 0) <= activeRect.left + 1 &&\n (c.rect.current?.right ?? 0) >= activeRect.left - 1,\n );\n const next = containers[index + (event.code === \"ArrowRight\" ? 1 : -1)];\n const rect = next?.rect.current;\n if (!rect) return undefined;\n event.preventDefault();\n return { x: rect.left + rect.width / 2 - activeRect.width / 2, y: currentCoordinates.y };\n }\n return sortableKeyboardCoordinates(event, args);\n};\n\n/**\n * A lane's body sits inside the lane's frame, so a raw corner-distance\n * strategy lets the body steal the hit from the lane itself — most visibly at\n * the board ends, where the last lane then never shifts aside to open the\n * drop gap. Resolve by what is being dragged: a column only ever hits other\n * columns; a card hits the card under the pointer first, then the lane body\n * under it, then whatever is nearest.\n */\nconst boardCollisionDetection: CollisionDetection = (args) => {\n const isColumn = args.active.data.current?.[\"type\"] === \"column\";\n const containers = args.droppableContainers.filter((container) => {\n const type = container.data.current?.[\"type\"];\n return isColumn ? type === \"column\" : type !== \"column\";\n });\n const scoped = { ...args, droppableContainers: containers };\n if (isColumn) return closestCorners(scoped);\n const within = pointerWithin(scoped);\n if (within.length > 0) {\n const rank = (id: (typeof within)[number][\"id\"]) =>\n containers.find((c) => c.id === id)?.data.current?.[\"type\"] === \"card\" ? 0 : 1;\n return [...within].sort((a, b) => rank(a.id) - rank(b.id));\n }\n return closestCorners(scoped);\n};\n\nconst BoardContext = createContext<BoardContextValue>({\n activeId: null,\n activeType: null,\n overColumnId: null,\n});\n\nexport interface BoardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onDragEnd\"> {\n /** Column ids in render order. Required for columns to be re-orderable. */\n columnIds?: string[];\n /** Fired once a card is dropped somewhere new. Apply it to your own state. */\n onMove?: (move: BoardMove) => void;\n /** Fired once a column is dropped in a new position. */\n onColumnMove?: (move: BoardColumnMove) => void;\n /** Rendered inside the drag overlay while a card is in the air. */\n renderDragOverlay?: (cardId: string) => ReactNode;\n /** Rendered inside the drag overlay while a column is in the air. */\n renderColumnDragOverlay?: (columnId: string) => ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A column board with pointer and keyboard dragging. The board owns the drag\n * mechanics only — the card data stays yours; react to `onMove`.\n */\nexport const Board = forwardRef<HTMLDivElement, BoardProps>(function Board(\n {\n columnIds,\n onMove,\n onColumnMove,\n renderDragOverlay,\n renderColumnDragOverlay,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const dndId = useId();\n const [activeId, setActiveId] = useState<string | null>(null);\n const [activeType, setActiveType] = useState<\"card\" | \"column\" | null>(null);\n const [overColumnId, setOverColumnId] = useState<string | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, { coordinateGetter: boardCoordinateGetter }),\n );\n\n const handleStart = useCallback((event: DragStartEvent) => {\n setActiveId(String(event.active.id));\n setActiveType(event.active.data.current?.[\"type\"] === \"column\" ? \"column\" : \"card\");\n }, []);\n\n /* Cards land on cards as often as on empty space, so the lane a drag is over\n * is always resolved back to a column id — one highlight, one meaning. */\n const handleOver = useCallback((event: DragOverEvent) => {\n const over = event.over;\n if (!over) {\n setOverColumnId(null);\n return;\n }\n const overData = over.data.current ?? {};\n const columnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n setOverColumnId(columnId || null);\n }, []);\n\n const reset = useCallback(() => {\n setActiveId(null);\n setActiveType(null);\n setOverColumnId(null);\n }, []);\n\n const handleEnd = useCallback(\n (event: DragEndEvent) => {\n const { active, over } = event;\n reset();\n if (!over) return;\n\n const activeData = active.data.current ?? {};\n const overData = over.data.current ?? {};\n\n /* Columns reorder among themselves; a column never lands inside a lane. */\n if (activeData[\"type\"] === \"column\") {\n const ids = columnIds ?? [];\n const overColumnId =\n overData[\"type\"] === \"column\" ? String(over.id) : String(overData[\"columnId\"] ?? \"\");\n const toIndex = ids.indexOf(overColumnId);\n if (toIndex < 0 || overColumnId === String(active.id)) return;\n onColumnMove?.({ columnId: String(active.id), toIndex });\n return;\n }\n\n const fromColumnId = String(activeData[\"columnId\"] ?? \"\");\n let toColumnId = \"\";\n let toIndex = 0;\n\n if (overData[\"type\"] === \"card\") {\n /* Dropped on a card — land exactly where that card sits, in any lane. */\n toColumnId = String(overData[\"columnId\"] ?? \"\");\n toIndex = (overData[\"sortable\"] as { index: number } | undefined)?.index ?? 0;\n } else {\n /* Dropped on empty lane space — land at the end. */\n toColumnId = String(overData[\"columnId\"] ?? over.id);\n toIndex = ((overData[\"items\"] as string[] | undefined) ?? []).length;\n }\n\n if (!toColumnId) return;\n if (fromColumnId === toColumnId && String(active.id) === String(over.id)) return;\n onMove?.({ cardId: String(active.id), fromColumnId, toColumnId, toIndex });\n },\n [columnIds, onColumnMove, onMove, reset],\n );\n\n const value = useMemo(\n () => ({ activeId, activeType, overColumnId }),\n [activeId, activeType, overColumnId],\n );\n\n const board = (\n <div ref={ref} className={[\"ds-board\", className].filter(Boolean).join(\" \")} {...rest}>\n {children}\n </div>\n );\n\n return (\n <BoardContext.Provider value={value}>\n <DndContext\n id={`ds-board-${dndId}`}\n sensors={sensors}\n collisionDetection={boardCollisionDetection}\n /* Lanes scroll and change height mid-drag, so positions are re-read\n * continuously — without this the shift animation misfires. */\n measuring={{ droppable: { strategy: MeasuringStrategy.Always } }}\n\n onDragStart={handleStart}\n onDragOver={handleOver}\n onDragEnd={handleEnd}\n onDragCancel={reset}\n >\n {columnIds ? (\n <SortableContext items={columnIds} strategy={horizontalListSortingStrategy}>\n {board}\n </SortableContext>\n ) : (\n board\n )}\n <DragOverlay>\n {activeId && activeType === \"card\" ? (\n <div className=\"ds-board-card\" data-overlay>\n <span className=\"ds-board-card__handle\" aria-hidden=\"true\">\n <Icon name=\"grip-vertical\" />\n </span>\n <div className=\"ds-board-card__content\">{renderDragOverlay?.(activeId)}</div>\n </div>\n ) : null}\n {activeId && activeType === \"column\" ? (\n <div className=\"ds-board-column\" data-overlay>\n {renderColumnDragOverlay?.(activeId)}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </BoardContext.Provider>\n );\n});\n\nexport interface BoardColumnProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n title: string;\n /** Card ids in render order — the sortable contract for this column. */\n itemIds: string[];\n /** Shown beside the title; defaults to the number of cards. */\n count?: number;\n /** A control in the column head, e.g. an add button or a menu. */\n action?: ReactNode;\n /** Set false to pin a lane in place. */\n isDraggable?: boolean;\n children?: ReactNode;\n}\n\n/**\n * One lane of the board. Heavy frame, hairline head rule, scrolling body, and\n * a grip on top of the head that drags the whole lane sideways.\n */\nexport const BoardColumn = forwardRef<HTMLElement, BoardColumnProps>(\n function BoardColumn(\n { id, title, itemIds, count, action, isDraggable = true, className, children, ...rest },\n ref,\n ) {\n const { activeType, overColumnId } = useContext(BoardContext);\n const { setNodeRef: setBodyRef } = useDroppable({\n id: `${id}::body`,\n data: { type: \"column-body\", columnId: id, items: itemIds },\n });\n const {\n attributes,\n listeners,\n setNodeRef: setColumnRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id,\n disabled: !isDraggable,\n data: { type: \"column\", columnId: id, items: itemIds },\n });\n\n return (\n <section\n ref={(node) => {\n setColumnRef(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-board-column\", className].filter(Boolean).join(\" \")}\n data-over={(activeType === \"card\" && overColumnId === id) || undefined}\n data-dragging={isDragging || undefined}\n\n aria-label={title}\n {...rest}\n >\n {isDraggable && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n iconStart=\"grip-horizontal\"\n className=\"ds-board-column__grip\"\n aria-label={`Reorder ${title}`}\n {...attributes}\n {...listeners}\n />\n )}\n <header className=\"ds-board-column__head\">\n <span className=\"ds-board-column__title\">{title}</span>\n <span className=\"ds-board-column__count\">{count ?? itemIds.length}</span>\n {action && <span className=\"ds-board-column__action\">{action}</span>}\n </header>\n <div ref={setBodyRef} className=\"ds-board-column__body\">\n <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>\n {children}\n </SortableContext>\n </div>\n </section>\n );\n },\n);\n\nexport interface BoardCardProps extends HTMLAttributes<HTMLDivElement> {\n id: string;\n columnId: string;\n /** Accessible name announced when the card is picked up. */\n label?: string;\n children?: ReactNode;\n}\n\n/**\n * A draggable card. The grip on the left is the handle, so the card body can\n * hold links and buttons; the grip is a real button for keyboard users:\n * space to pick up, arrows to move, space to drop.\n */\nexport const BoardCard = forwardRef<HTMLDivElement, BoardCardProps>(function BoardCard(\n { id, columnId, label, className, children, ...rest },\n ref,\n) {\n const { attributes, listeners, setNodeRef, transform, transition, isDragging } =\n useSortable({ id, data: { type: \"card\", columnId } });\n const { activeId } = useContext(BoardContext);\n\n return (\n <div\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-board-card\", className].filter(Boolean).join(\" \")}\n data-dragging={isDragging || undefined}\n data-idle={activeId && activeId !== id ? \"\" : undefined}\n {...rest}\n >\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"grip-vertical\"\n className=\"ds-board-card__handle\"\n aria-label={label ? `Move ${label}` : \"Move card\"}\n {...attributes}\n {...listeners}\n />\n <div className=\"ds-board-card__content\">{children}</div>\n </div>\n );\n});\n"],"mappings":";;;;;;;;AAiEA,IAAMC,KAAmD,GAAO,MAAS;CACvE,IAAM,EAAE,uBAAoB,eAAYC;CACxC,IAAIC,EAAM,SAAS,eAAeA,EAAM,SAAS,cAAc;EAC7D,IAAMC,IAAaC,EAAQ,oBACxB,WAAW,CAAC,CACZ,QAAQ,MAAMC,EAAE,KAAK,SAAUC,SAAY,aAAa,CAAC,CACzD,MAAM,GAAG,OAAOC,EAAE,KAAK,SAAS,QAAQ,MAAMC,EAAE,KAAK,SAAS,QAAQ,EAAE,GACrEC,IAAaL,EAAQ,QAAQ,KAAK,QAAQ;EAChD,IAAI,CAACK,GAAY;EAMjB,IAAMC,IADOP,EAJCA,EAAW,WACtB,OAAOE,EAAE,KAAK,SAAS,QAAQ,MAAMI,EAAW,OAAO,MACrDJ,EAAE,KAAK,SAAS,SAAS,MAAMI,EAAW,OAAO,CAE9B,KAASP,EAAM,SAAS,eAAe,IAAI,IACtD,EAAM,KAAK;EAGxB,OAFKQ,KACLR,EAAM,eAAe,GACd;GAAE,GAAGQ,EAAK,OAAOA,EAAK,QAAQ,IAAID,EAAW,QAAQ;GAAG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,OAAD;IAAK,KAAKhB;IAAY,WAAU;IAC9B,UAAA,kBAACP,GAAD;KAAiB,OAAOS;KAAS,UAAUe;KACxC;IACc,CAAA;GACd,CAAA;EACE;;AAEb,CACF,GAeaC,IAAYnE,EAA2C,SAClE,EAAE,OAAI,aAAU,UAAO,cAAW,aAAU,GAAGC,KAC/C,GACA;CACA,IAAM,EAAE,eAAY,cAAW,eAAY,cAAW,eAAY,kBAChEoD,EAAY;EAAE;EAAI,MAAM;GAAE,MAAM;GAAQ;EAAS;CAAE,CAAC,GAChD,EAAE,gBAAaL,EAAWnD,CAAY;CAE5C,OACE,kBAAC,OAAD;EACE,MAAM,MAAS;GAEb,AADAuE,EAAWb,CAAI,GACX,OAAOC,KAAQ,aAAYA,EAAID,CAAI,IAC9BC,MAAK,EAAI,UAAUD;EAC9B;EACA,OAAO;GAAE,WAAWE,EAAI,UAAU,SAASC,CAAS;GAAG;EAAW;EAClE,WAAW,CAAC,iBAAiBnB,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAChE,iBAAeoB,KAAc,KAAA;EAC7B,aAAWvD,KAAYA,MAAaR,IAAK,KAAK,KAAA;EAC9C,GAAIK;EAVN,UAAA,CAYE,kBAAC4D,GAAD;GACE,SAAQ;GACR,MAAK;GACL,YAAA;GACA,WAAU;GACV,WAAU;GACV,cAAYQ,IAAQ,QAAQA,MAAU;GACtC,GAAIP;GACJ,GAAIC;EACL,CAAA,GACD,kBAAC,OAAD;GAAK,WAAU;GAA0B;EAAc,CAAA,CACpD;;AAET,CAAC"}
@@ -36,37 +36,28 @@
36
36
  box-shadow: var(--shadow-lg);
37
37
  }
38
38
 
39
- /* The lane grip sits on top of the head — the whole lane travels with it. */
40
- .ds-board-column__grip,
41
- .ds-board-card__handle {
42
- display: flex;
43
- align-items: center;
44
- justify-content: center;
45
- border: 0;
46
- background: none;
47
- color: var(--color-text-muted);
39
+ /* The lane grip sits on top of the head — the whole lane travels with it.
40
+ * Qualified so grab outranks Button's pointer, which the aggregate
41
+ * stylesheet loads after this file. */
42
+ .ds-board-column__grip.ds-button,
43
+ .ds-board-card__handle.ds-button {
44
+ flex: none;
48
45
  cursor: grab;
49
46
  touch-action: none;
50
- padding: 0;
51
- }
52
-
53
- .ds-board-column__grip:hover,
54
- .ds-board-card__handle:hover {
55
- color: var(--color-text);
56
47
  }
57
48
 
58
- .ds-board-column__grip:focus-visible,
59
- .ds-board-card__handle:focus-visible {
60
- outline: var(--control-border-width) solid var(--color-focus);
61
- outline-offset: 2px;
62
- border-radius: var(--radius-sm);
49
+ /* The drag overlay's grip is a picture of the handle, not a second control. */
50
+ span.ds-board-card__handle {
51
+ display: inline-flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ flex: none;
55
+ inline-size: var(--field-height-sm);
56
+ block-size: var(--field-height-sm);
57
+ color: var(--color-text-muted);
63
58
  }
64
59
 
65
- .ds-board-column__grip {
66
- inline-size: 100%;
67
- block-size: var(--space-5);
68
- border-block-end: var(--rule-width) solid var(--rule-color);
69
- }
60
+ .ds-board-column__grip { inline-size: 100%; }
70
61
 
71
62
  .ds-board-column__head {
72
63
  display: flex;
@@ -119,9 +110,7 @@
119
110
  }
120
111
 
121
112
  .ds-board-card__handle {
122
- align-self: stretch;
123
- align-items: flex-start;
124
- padding-block-start: 2px;
113
+ align-self: flex-start;
125
114
  }
126
115
 
127
116
  .ds-board-card__content {
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({variant:t=`neutral`,size:r=`md`,iconStart:i,iconEnd:a,isIconOnly:o=!1,isDisabled:s=!1,isPending:c=!1,className:l,children:u,type:d=`button`,...f},p){let m=r===`lg`?20:16;return(0,n.jsxs)(`button`,{ref:p,type:d,disabled:s||c,"data-variant":t,"data-size":r,"data-icon-only":o||void 0,"data-pending":c||void 0,className:[`ds-button`,l].filter(Boolean).join(` `),...f,children:[c?(0,n.jsx)(e.t,{name:`spinner`,size:m,className:`ds-button__spinner`}):i&&(0,n.jsx)(e.t,{name:i,size:m}),!o&&u,a&&!o&&(0,n.jsx)(e.t,{name:a,size:m})]})});exports.Button=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({variant:t=`neutral`,size:r=`md`,iconStart:i,iconEnd:a,isIconOnly:o=!1,isDisabled:s=!1,isPending:c=!1,className:l,children:u,type:d=`button`,...f},p){let m=r===`lg`?20:16;return(0,n.jsxs)(`button`,{ref:p,type:d,disabled:s||c,"data-variant":t,"data-size":r,"data-icon-only":o||void 0,"data-pending":c||void 0,className:[`ds-button`,l].filter(Boolean).join(` `),...f,children:[c?(0,n.jsx)(e.t,{name:`spinner`,size:m,className:`ds-button__spinner`}):i&&(0,n.jsx)(e.t,{name:i,size:m}),(!o||!i&&!c)&&u,a&&!o&&(0,n.jsx)(e.t,{name:a,size:m})]})});exports.Button=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["forwardRef","Icon","require_Icon","react","react_jsx_runtime","Button","rest","glyph","size","isDisabled","isPending","variant","isIconOnly","className","iconStart","children","iconEnd"],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport type ButtonVariant = \"primary\" | \"neutral\" | \"danger\" | \"active\" | \"simple\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n iconStart?: IconName;\n iconEnd?: IconName;\n /** Square, height-sized button. Requires `aria-label`. */\n isIconOnly?: boolean;\n isDisabled?: boolean;\n /** Label stays, spinner replaces `iconStart`, press is blocked. */\n isPending?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Every action the user can take. One primary per view; a sixth variant is a\n * conversation, not a prop.\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"neutral\",\n size = \"md\",\n iconStart,\n iconEnd,\n isIconOnly = false,\n isDisabled = false,\n isPending = false,\n className,\n children,\n type = \"button\",\n ...rest\n },\n ref,\n) {\n const glyph = size === \"lg\" ? 20 : 16;\n return (\n <button\n ref={ref}\n type={type}\n disabled={isDisabled || isPending}\n data-variant={variant}\n data-size={size}\n data-icon-only={isIconOnly || undefined}\n data-pending={isPending || undefined}\n className={[\"ds-button\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {isPending ? (\n <Icon name=\"spinner\" size={glyph} className=\"ds-button__spinner\" />\n ) : (\n iconStart && <Icon name={iconStart} size={glyph} />\n )}\n {!isIconOnly && children}\n {iconEnd && !isIconOnly && <Icon name={iconEnd} size={glyph} />}\n </button>\n );\n});\n"],"mappings":"A,2KA0BA,IAAaK,GAAA,EAASL,EAAAA,WAAAA,CAA2C,SAC/D,CACE,UAAU,UACV,OAAO,KACP,YACA,UACA,aAAa,GACb,aAAa,GACb,YAAY,GACZ,YACA,WACA,OAAO,SACP,GAAGM,GAEL,EACA,CACA,IAAMC,EAAQC,IAAS,KAAO,GAAK,GACnC,OACE,EAAAJ,EAAA,KAAA,CAAC,SAAD,CACO,MACC,OACN,SAAUK,GAAcC,EACxB,eAAcC,EACd,YAAWH,EACX,iBAAgBI,GAAc,IAAA,GAC9B,eAAcF,GAAa,IAAA,GAC3B,UAAW,CAAC,YAAaG,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC5D,GAAIP,EATN,SAAA,CAWGI,GACC,EAAAN,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAM,KAAK,UAAU,KAAMM,EAAO,UAAU,oBAAsB,CAAA,EAElEO,IAAa,EAAAV,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAM,KAAMa,EAAW,KAAMP,CAAQ,CAAA,EAEnD,CAACK,GAAcG,EACfC,GAAW,CAACJ,IAAc,EAAAR,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAM,KAAMe,EAAS,KAAMT,CAAQ,CAAA,CACxD,C,EAEZ,CAAC,E"}
1
+ {"version":3,"file":"index.cjs","names":["forwardRef","Icon","require_Icon","react","react_jsx_runtime","Button","rest","glyph","size","isDisabled","isPending","variant","isIconOnly","className","iconStart","children","iconEnd"],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport type ButtonVariant = \"primary\" | \"neutral\" | \"danger\" | \"active\" | \"simple\";\nexport type ButtonSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n variant?: ButtonVariant;\n /** `xs` is for compact actions inside a field or chip, such as clear and remove. */\n size?: ButtonSize;\n iconStart?: IconName;\n iconEnd?: IconName;\n /** Square button. Label with aria-label/aria-labelledby. Children can supply a custom glyph. */\n isIconOnly?: boolean;\n isDisabled?: boolean;\n /** Label stays, spinner replaces `iconStart`, press is blocked. */\n isPending?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Every action the user can take. One primary per view; a sixth variant is a\n * conversation, not a prop.\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"neutral\",\n size = \"md\",\n iconStart,\n iconEnd,\n isIconOnly = false,\n isDisabled = false,\n isPending = false,\n className,\n children,\n type = \"button\",\n ...rest\n },\n ref,\n) {\n const glyph = size === \"lg\" ? 20 : 16;\n return (\n <button\n ref={ref}\n type={type}\n disabled={isDisabled || isPending}\n data-variant={variant}\n data-size={size}\n data-icon-only={isIconOnly || undefined}\n data-pending={isPending || undefined}\n className={[\"ds-button\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {isPending ? (\n <Icon name=\"spinner\" size={glyph} className=\"ds-button__spinner\" />\n ) : (\n iconStart && <Icon name={iconStart} size={glyph} />\n )}\n {(!isIconOnly || (!iconStart && !isPending)) && children}\n {iconEnd && !isIconOnly && <Icon name={iconEnd} size={glyph} />}\n </button>\n );\n});\n"],"mappings":"A,2KA2BA,IAAaK,GAAA,EAASL,EAAAA,WAAAA,CAA2C,SAC/D,CACE,UAAU,UACV,OAAO,KACP,YACA,UACA,aAAa,GACb,aAAa,GACb,YAAY,GACZ,YACA,WACA,OAAO,SACP,GAAGM,GAEL,EACA,CACA,IAAMC,EAAQC,IAAS,KAAO,GAAK,GACnC,OACE,EAAAJ,EAAA,KAAA,CAAC,SAAD,CACO,MACC,OACN,SAAUK,GAAcC,EACxB,eAAcC,EACd,YAAWH,EACX,iBAAgBI,GAAc,IAAA,GAC9B,eAAcF,GAAa,IAAA,GAC3B,UAAW,CAAC,YAAaG,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC5D,GAAIP,EATN,SAAA,CAWGI,GACC,EAAAN,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAM,KAAK,UAAU,KAAMM,EAAO,UAAU,oBAAsB,CAAA,EAElEO,IAAa,EAAAV,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAM,KAAMa,EAAW,KAAMP,CAAQ,CAAA,GAElD,CAACK,GAAe,CAACE,GAAa,CAACJ,IAAeK,EAC/CC,GAAW,CAACJ,IAAc,EAAAR,EAAA,IAAA,CAACH,EAAAA,EAAD,CAAM,KAAMe,EAAS,KAAMT,CAAQ,CAAA,CACxD,C,EAEZ,CAAC,E"}
@@ -1,13 +1,14 @@
1
1
  import { type ButtonHTMLAttributes, type ReactNode } from "react";
2
2
  import type { IconName } from "../Icon/icons.cjs";
3
3
  export type ButtonVariant = "primary" | "neutral" | "danger" | "active" | "simple";
4
- export type ButtonSize = "sm" | "md" | "lg";
4
+ export type ButtonSize = "xs" | "sm" | "md" | "lg";
5
5
  export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
6
6
  variant?: ButtonVariant;
7
+ /** `xs` is for compact actions inside a field or chip, such as clear and remove. */
7
8
  size?: ButtonSize;
8
9
  iconStart?: IconName;
9
10
  iconEnd?: IconName;
10
- /** Square, height-sized button. Requires `aria-label`. */
11
+ /** Square button. Label with aria-label/aria-labelledby. Children can supply a custom glyph. */
11
12
  isIconOnly?: boolean;
12
13
  isDisabled?: boolean;
13
14
  /** Label stays, spinner replaces `iconStart`, press is blocked. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAsCjB,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,oFAAoF;IACpF,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,gGAAgG;IAChG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAsCjB,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import { type ButtonHTMLAttributes, type ReactNode } from "react";
2
2
  import type { IconName } from "../Icon/icons.js";
3
3
  export type ButtonVariant = "primary" | "neutral" | "danger" | "active" | "simple";
4
- export type ButtonSize = "sm" | "md" | "lg";
4
+ export type ButtonSize = "xs" | "sm" | "md" | "lg";
5
5
  export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
6
6
  variant?: ButtonVariant;
7
+ /** `xs` is for compact actions inside a field or chip, such as clear and remove. */
7
8
  size?: ButtonSize;
8
9
  iconStart?: IconName;
9
10
  iconEnd?: IconName;
10
- /** Square, height-sized button. Requires `aria-label`. */
11
+ /** Square button. Label with aria-label/aria-labelledby. Children can supply a custom glyph. */
11
12
  isIconOnly?: boolean;
12
13
  isDisabled?: boolean;
13
14
  /** Label stays, spinner replaces `iconStart`, press is blocked. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAsCjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACnF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,oFAAoF;IACpF,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,gGAAgG;IAChG,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAsCjB,CAAC"}
@@ -23,7 +23,7 @@ var i = t(function({ variant: t = "neutral", size: i = "md", iconStart: a, iconE
23
23
  name: a,
24
24
  size: h
25
25
  }),
26
- !s && d,
26
+ (!s || !a && !l) && d,
27
27
  o && !s && /* @__PURE__ */ n(e, {
28
28
  name: o,
29
29
  size: h
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Icon","Button","forwardRef","rest","glyph","size","isDisabled","isPending","variant","isIconOnly","className","iconStart","children","iconEnd"],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport type ButtonVariant = \"primary\" | \"neutral\" | \"danger\" | \"active\" | \"simple\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n iconStart?: IconName;\n iconEnd?: IconName;\n /** Square, height-sized button. Requires `aria-label`. */\n isIconOnly?: boolean;\n isDisabled?: boolean;\n /** Label stays, spinner replaces `iconStart`, press is blocked. */\n isPending?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Every action the user can take. One primary per view; a sixth variant is a\n * conversation, not a prop.\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"neutral\",\n size = \"md\",\n iconStart,\n iconEnd,\n isIconOnly = false,\n isDisabled = false,\n isPending = false,\n className,\n children,\n type = \"button\",\n ...rest\n },\n ref,\n) {\n const glyph = size === \"lg\" ? 20 : 16;\n return (\n <button\n ref={ref}\n type={type}\n disabled={isDisabled || isPending}\n data-variant={variant}\n data-size={size}\n data-icon-only={isIconOnly || undefined}\n data-pending={isPending || undefined}\n className={[\"ds-button\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {isPending ? (\n <Icon name=\"spinner\" size={glyph} className=\"ds-button__spinner\" />\n ) : (\n iconStart && <Icon name={iconStart} size={glyph} />\n )}\n {!isIconOnly && children}\n {iconEnd && !isIconOnly && <Icon name={iconEnd} size={glyph} />}\n </button>\n );\n});\n"],"mappings":";;;;AA0BA,IAAaC,IAASC,EAA2C,SAC/D,EACE,aAAU,WACV,UAAO,MACP,cACA,YACA,gBAAa,IACb,gBAAa,IACb,eAAY,IACZ,cACA,aACA,UAAO,UACP,GAAGC,KAEL,GACA;CACA,IAAMC,IAAQC,MAAS,OAAO,KAAK;CACnC,OACE,kBAAC,UAAD;EACO;EACC;EACN,UAAUC,KAAcC;EACxB,gBAAcC;EACd,aAAWH;EACX,kBAAgBI,KAAc,KAAA;EAC9B,gBAAcF,KAAa,KAAA;EAC3B,WAAW,CAAC,aAAaG,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC5D,GAAIP;EATN,UAAA;GAWGI,IACC,kBAACP,GAAD;IAAM,MAAK;IAAU,MAAMI;IAAO,WAAU;GAAsB,CAAA,IAElEO,KAAa,kBAACX,GAAD;IAAM,MAAMW;IAAW,MAAMP;GAAQ,CAAA;GAEnD,CAACK,KAAcG;GACfC,KAAW,CAACJ,KAAc,kBAACT,GAAD;IAAM,MAAMa;IAAS,MAAMT;GAAQ,CAAA;EACxD;;AAEZ,CAAC"}
1
+ {"version":3,"file":"index.js","names":["Icon","Button","forwardRef","rest","glyph","size","isDisabled","isPending","variant","isIconOnly","className","iconStart","children","iconEnd"],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nexport type ButtonVariant = \"primary\" | \"neutral\" | \"danger\" | \"active\" | \"simple\";\nexport type ButtonSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n variant?: ButtonVariant;\n /** `xs` is for compact actions inside a field or chip, such as clear and remove. */\n size?: ButtonSize;\n iconStart?: IconName;\n iconEnd?: IconName;\n /** Square button. Label with aria-label/aria-labelledby. Children can supply a custom glyph. */\n isIconOnly?: boolean;\n isDisabled?: boolean;\n /** Label stays, spinner replaces `iconStart`, press is blocked. */\n isPending?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Every action the user can take. One primary per view; a sixth variant is a\n * conversation, not a prop.\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"neutral\",\n size = \"md\",\n iconStart,\n iconEnd,\n isIconOnly = false,\n isDisabled = false,\n isPending = false,\n className,\n children,\n type = \"button\",\n ...rest\n },\n ref,\n) {\n const glyph = size === \"lg\" ? 20 : 16;\n return (\n <button\n ref={ref}\n type={type}\n disabled={isDisabled || isPending}\n data-variant={variant}\n data-size={size}\n data-icon-only={isIconOnly || undefined}\n data-pending={isPending || undefined}\n className={[\"ds-button\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {isPending ? (\n <Icon name=\"spinner\" size={glyph} className=\"ds-button__spinner\" />\n ) : (\n iconStart && <Icon name={iconStart} size={glyph} />\n )}\n {(!isIconOnly || (!iconStart && !isPending)) && children}\n {iconEnd && !isIconOnly && <Icon name={iconEnd} size={glyph} />}\n </button>\n );\n});\n"],"mappings":";;;;AA2BA,IAAaC,IAASC,EAA2C,SAC/D,EACE,aAAU,WACV,UAAO,MACP,cACA,YACA,gBAAa,IACb,gBAAa,IACb,eAAY,IACZ,cACA,aACA,UAAO,UACP,GAAGC,KAEL,GACA;CACA,IAAMC,IAAQC,MAAS,OAAO,KAAK;CACnC,OACE,kBAAC,UAAD;EACO;EACC;EACN,UAAUC,KAAcC;EACxB,gBAAcC;EACd,aAAWH;EACX,kBAAgBI,KAAc,KAAA;EAC9B,gBAAcF,KAAa,KAAA;EAC3B,WAAW,CAAC,aAAaG,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC5D,GAAIP;EATN,UAAA;GAWGI,IACC,kBAACP,GAAD;IAAM,MAAK;IAAU,MAAMI;IAAO,WAAU;GAAsB,CAAA,IAElEO,KAAa,kBAACX,GAAD;IAAM,MAAMW;IAAW,MAAMP;GAAQ,CAAA;IAElD,CAACK,KAAe,CAACE,KAAa,CAACJ,MAAeK;GAC/CC,KAAW,CAACJ,KAAc,kBAACT,GAAD;IAAM,MAAMa;IAAS,MAAMT;GAAQ,CAAA;EACxD;;AAEZ,CAAC"}