@pibit.ai/cure-design-system 0.3.23 → 0.3.26

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 (52) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +157 -140
  4. package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
  5. package/dist/patterns/table/TableWrapper.js +376 -369
  6. package/dist/patterns/table/index.d.ts +4 -1
  7. package/dist/patterns/table/index.d.ts.map +1 -1
  8. package/dist/patterns/table/integrateTableUndoRedo.d.ts +41 -0
  9. package/dist/patterns/table/integrateTableUndoRedo.d.ts.map +1 -0
  10. package/dist/patterns/table/integrateTableUndoRedo.js +63 -0
  11. package/dist/patterns/table/storyHelpers/useMockTableState.d.ts +3 -1
  12. package/dist/patterns/table/storyHelpers/useMockTableState.d.ts.map +1 -1
  13. package/dist/patterns/table/table.d.ts +2 -1
  14. package/dist/patterns/table/table.d.ts.map +1 -1
  15. package/dist/patterns/table/table.js +181 -155
  16. package/dist/patterns/table/tableUndoRedo.d.ts +38 -0
  17. package/dist/patterns/table/tableUndoRedo.d.ts.map +1 -0
  18. package/dist/patterns/table/tableUndoRedo.js +147 -0
  19. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +4 -0
  20. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
  21. package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +81 -77
  22. package/dist/patterns/table/toolbar/TableToolbar.d.ts +11 -2
  23. package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
  24. package/dist/patterns/table/toolbar/TableToolbar.js +163 -114
  25. package/dist/patterns/table/toolbar/index.d.ts +1 -1
  26. package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
  27. package/dist/patterns/table/toolbar/useUndoRedoShortcuts.d.ts +9 -0
  28. package/dist/patterns/table/toolbar/useUndoRedoShortcuts.d.ts.map +1 -0
  29. package/dist/patterns/table/toolbar/useUndoRedoShortcuts.js +21 -0
  30. package/dist/patterns/table/types.d.ts +5 -1
  31. package/dist/patterns/table/types.d.ts.map +1 -1
  32. package/dist/patterns/table/useTableUndoRedo.d.ts +41 -0
  33. package/dist/patterns/table/useTableUndoRedo.d.ts.map +1 -0
  34. package/dist/patterns/table/useTableUndoRedo.js +168 -0
  35. package/dist/primitives/badge/badge.js +5 -5
  36. package/dist/primitives/input/input.d.ts +1 -1
  37. package/dist/primitives/input/input.d.ts.map +1 -1
  38. package/dist/primitives/input/input.js +63 -62
  39. package/dist/primitives/select/ExpandableSearchInput.d.ts +1 -1
  40. package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
  41. package/dist/primitives/select/SearchInput.d.ts +2 -2
  42. package/dist/primitives/select/SearchInput.d.ts.map +1 -1
  43. package/dist/primitives/select/SearchInput.js +38 -37
  44. package/dist/primitives/select/combobox.d.ts.map +1 -1
  45. package/dist/primitives/select/combobox.js +48 -47
  46. package/dist/primitives/select/multi-select.d.ts.map +1 -1
  47. package/dist/primitives/select/multi-select.js +50 -49
  48. package/dist/styles/components.css +1 -1
  49. package/dist/utils/keyboard-shortcut.d.ts +4 -0
  50. package/dist/utils/keyboard-shortcut.d.ts.map +1 -0
  51. package/dist/utils/keyboard-shortcut.js +29 -0
  52. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as N, Fragment as _ } from "react/jsx-runtime";
2
- import { useCallback as z, useRef as E, useState as L, createContext as q, useContext as D } from "react";
2
+ import { useCallback as z, useRef as L, useState as E, createContext as q, useContext as D } from "react";
3
3
  import { ComboBox as j, ListBox as C, Group as V, ComboBoxStateContext as W, Input as G } from "react-aria-components";
4
4
  import { Avatar as H } from "../avatar/avatar.js";
5
5
  import { HintText as U } from "../input/hint-text.js";
@@ -9,15 +9,16 @@ import { sizes as O } from "./select.js";
9
9
  import { TagCloseX as Q } from "../tags/base-components/tag-close-x.js";
10
10
  import { SelectItem as Y } from "./select-item.js";
11
11
  import { cx as w } from "../../utils/cn.js";
12
- import { useResizeObserver as Z } from "../../hooks/use-resize-observer.js";
13
- import { useFilter as M } from "../../node_modules/@react-aria/i18n/dist/useFilter.js";
14
- import { useListData as B } from "../../node_modules/@react-stately/data/dist/useListData.js";
15
- import { FocusScope as I, useFocusManager as ee } from "../../node_modules/@react-aria/focus/dist/FocusScope.js";
16
- const te = {
12
+ import { getPlatformShortcutLabel as Z } from "../../utils/keyboard-shortcut.js";
13
+ import { useResizeObserver as M } from "../../hooks/use-resize-observer.js";
14
+ import { useFilter as B } from "../../node_modules/@react-aria/i18n/dist/useFilter.js";
15
+ import { useListData as I } from "../../node_modules/@react-stately/data/dist/useListData.js";
16
+ import { FocusScope as ee, useFocusManager as te } from "../../node_modules/@react-aria/focus/dist/FocusScope.js";
17
+ const re = {
17
18
  sm: "text-xs",
18
19
  md: "text-sm",
19
20
  lg: "text-md"
20
- }, K = q({
21
+ }, P = q({
21
22
  size: "sm",
22
23
  selectedKeys: [],
23
24
  selectedItems: {},
@@ -34,7 +35,7 @@ const te = {
34
35
  selectedItems: l,
35
36
  onItemCleared: c,
36
37
  onItemInserted: t,
37
- shortcut: s,
38
+ shortcut: r,
38
39
  placeholder: d = "Search",
39
40
  showAvatar: p = !0,
40
41
  readOnly: g = !1,
@@ -45,37 +46,37 @@ const te = {
45
46
  ...n
46
47
  }) => {
47
48
  var A;
48
- const { contains: x } = M({ sensitivity: "base" }), u = (A = l == null ? void 0 : l.items) != null && A.length ? l.items.map((r) => r.id) : [], e = z(
49
- (r, a) => !u.includes(r.id) && x(r.label || r.supportingText || "", a),
49
+ const { contains: x } = B({ sensitivity: "base" }), u = (A = l == null ? void 0 : l.items) != null && A.length ? l.items.map((s) => s.id) : [], e = z(
50
+ (s, a) => !u.includes(s.id) && x(s.label || s.supportingText || "", a),
50
51
  [x, u]
51
- ), o = B({
52
+ ), o = I({
52
53
  initialItems: m,
53
54
  filter: e
54
55
  }), v = z(
55
- (r) => {
56
- const a = r.values().next().value;
56
+ (s) => {
57
+ const a = s.values().next().value;
57
58
  a && (l.remove(a), c == null || c(a));
58
59
  },
59
60
  [l, c]
60
- ), S = (r) => {
61
- if (!r)
61
+ ), S = (s) => {
62
+ if (!s)
62
63
  return;
63
- const a = o.getItem(r);
64
- a && (u.includes(r) || (l.append(a), t == null || t(r)), o.setFilterText(""));
65
- }, y = (r) => {
66
- g || o.setFilterText(r);
67
- }, f = E(null), [P, F] = L(""), $ = z(() => {
64
+ const a = o.getItem(s);
65
+ a && (u.includes(s) || (l.append(a), t == null || t(s)), o.setFilterText(""));
66
+ }, y = (s) => {
67
+ g || o.setFilterText(s);
68
+ }, f = L(null), [K, F] = E(""), $ = z(() => {
68
69
  var a;
69
70
  if (!f.current) return;
70
- let r = (a = f.current) == null ? void 0 : a.getBoundingClientRect();
71
- F(r.width + "px");
71
+ let s = (a = f.current) == null ? void 0 : a.getBoundingClientRect();
72
+ F(s.width + "px");
72
73
  }, [f, F]);
73
- return Z({
74
+ return M({
74
75
  ref: f,
75
76
  onResize: $,
76
77
  box: "border-box"
77
78
  }), /* @__PURE__ */ i(
78
- K.Provider,
79
+ P.Provider,
79
80
  {
80
81
  value: {
81
82
  size: h,
@@ -98,15 +99,15 @@ const te = {
98
99
  selectedKey: null,
99
100
  onSelectionChange: S,
100
101
  ...n,
101
- children: (r) => {
102
+ children: (s) => {
102
103
  var a;
103
104
  return /* @__PURE__ */ N("div", { className: "flex flex-col gap-1.5", children: [
104
- n.label && /* @__PURE__ */ i(X, { isRequired: r.isRequired, tooltip: n.tooltip, children: n.label }),
105
+ n.label && /* @__PURE__ */ i(X, { isRequired: s.isRequired, tooltip: n.tooltip, children: n.label }),
105
106
  /* @__PURE__ */ i(
106
- ie,
107
+ ae,
107
108
  {
108
109
  size: h,
109
- shortcut: s,
110
+ shortcut: r,
110
111
  ref: f,
111
112
  placeholder: d,
112
113
  readOnly: g,
@@ -119,7 +120,7 @@ const te = {
119
120
  {
120
121
  size: "md",
121
122
  triggerRef: f,
122
- style: { width: P },
123
+ style: { width: K },
123
124
  className: n == null ? void 0 : n.popoverClassName,
124
125
  children: /* @__PURE__ */ i(
125
126
  C,
@@ -131,14 +132,14 @@ const te = {
131
132
  )
132
133
  }
133
134
  ),
134
- n.hint && /* @__PURE__ */ i(U, { isInvalid: r.isInvalid, children: n.hint })
135
+ n.hint && /* @__PURE__ */ i(U, { isInvalid: s.isInvalid, children: n.hint })
135
136
  ] });
136
137
  }
137
138
  }
138
139
  )
139
140
  }
140
141
  );
141
- }, re = ({
142
+ }, ie = ({
142
143
  isDisabled: m,
143
144
  shortcut: b,
144
145
  shortcutClassName: h,
@@ -146,7 +147,7 @@ const te = {
146
147
  readOnly: c = !1
147
148
  }) => {
148
149
  var T, n, x, u;
149
- const t = ee(), s = D(K), d = D(W), p = (e) => {
150
+ const t = te(), r = D(P), d = D(W), p = (e) => {
150
151
  if (!(!(e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) && e.currentTarget.value !== ""))
151
152
  switch (e.key) {
152
153
  case "Backspace":
@@ -164,12 +165,12 @@ const te = {
164
165
  if (e.key === "Tab")
165
166
  return;
166
167
  e.preventDefault();
167
- const v = ((f = (y = (S = s == null ? void 0 : s.selectedItems) == null ? void 0 : S.items) == null ? void 0 : y[0]) == null ? void 0 : f.id) === o;
168
+ const v = ((f = (y = (S = r == null ? void 0 : r.selectedItems) == null ? void 0 : S.items) == null ? void 0 : y[0]) == null ? void 0 : f.id) === o;
168
169
  switch (e.key) {
169
170
  case " ":
170
171
  case "Enter":
171
172
  case "Backspace":
172
- v ? t == null || t.focusNext({ wrap: !1, tabbable: !1 }) : t == null || t.focusPrevious({ wrap: !1, tabbable: !1 }), s.onRemove(/* @__PURE__ */ new Set([o]));
173
+ v ? t == null || t.focusNext({ wrap: !1, tabbable: !1 }) : t == null || t.focusPrevious({ wrap: !1, tabbable: !1 }), r.onRemove(/* @__PURE__ */ new Set([o]));
173
174
  break;
174
175
  case "ArrowLeft":
175
176
  t == null || t.focusPrevious({ wrap: !1, tabbable: !1 });
@@ -181,17 +182,17 @@ const te = {
181
182
  d == null || d.close();
182
183
  break;
183
184
  }
184
- }, R = ((n = (T = s == null ? void 0 : s.selectedItems) == null ? void 0 : T.items) == null ? void 0 : n.length) === 0;
185
+ }, R = ((n = (T = r == null ? void 0 : r.selectedItems) == null ? void 0 : T.items) == null ? void 0 : n.length) === 0;
185
186
  return /* @__PURE__ */ N("div", { className: "relative flex w-full flex-1 flex-row flex-wrap items-center justify-start gap-1.5", children: [
186
- !R && ((u = (x = s == null ? void 0 : s.selectedItems) == null ? void 0 : x.items) == null ? void 0 : u.map((e) => /* @__PURE__ */ N(
187
+ !R && ((u = (x = r == null ? void 0 : r.selectedItems) == null ? void 0 : x.items) == null ? void 0 : u.map((e) => /* @__PURE__ */ N(
187
188
  "span",
188
189
  {
189
190
  className: w(
190
191
  "flex items-center rounded-md bg-primary py-0.5 pr-1 pl-1.25 ring-1 ring-[var(--color-gray-100)] ring-inset",
191
- s == null ? void 0 : s.chipClassName
192
+ r == null ? void 0 : r.chipClassName
192
193
  ),
193
194
  children: [
194
- (s == null ? void 0 : s.showAvatar) && /* @__PURE__ */ i(
195
+ (r == null ? void 0 : r.showAvatar) && /* @__PURE__ */ i(
195
196
  H,
196
197
  {
197
198
  size: "sm",
@@ -208,7 +209,7 @@ const te = {
208
209
  isDisabled: m,
209
210
  className: "ml-0.75",
210
211
  onKeyDown: (o) => k(o, e.id),
211
- onPress: () => s.onRemove(/* @__PURE__ */ new Set([e.id]))
212
+ onPress: () => r.onRemove(/* @__PURE__ */ new Set([e.id]))
212
213
  }
213
214
  )
214
215
  ]
@@ -234,7 +235,7 @@ const te = {
234
235
  className: w(
235
236
  "w-full flex-[1_0_0] appearance-none bg-transparent text-ellipsis text-primary caret-alpha-black/90 outline-none placeholder:text-placeholder_subtle focus:outline-hidden disabled:cursor-not-allowed disabled:text-disabled disabled:placeholder:text-disabled",
236
237
  c && "cursor-default",
237
- te[(s == null ? void 0 : s.size) || "sm"]
238
+ re[(r == null ? void 0 : r.size) || "sm"]
238
239
  )
239
240
  }
240
241
  ),
@@ -253,7 +254,7 @@ const te = {
253
254
  "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
254
255
  m && "bg-transparent text-disabled"
255
256
  ),
256
- children: "K"
257
+ children: Z(["meta"], "K")
257
258
  }
258
259
  )
259
260
  }
@@ -262,7 +263,7 @@ const te = {
262
263
  }
263
264
  )
264
265
  ] });
265
- }, ie = ({
266
+ }, ae = ({
266
267
  size: m,
267
268
  shortcut: b,
268
269
  placeholder: h,
@@ -270,7 +271,7 @@ const te = {
270
271
  placeholderIcon: c = null,
271
272
  readOnly: t = !1,
272
273
  // Omit this prop to avoid invalid HTML attribute warning
273
- isDisabled: s,
274
+ isDisabled: r,
274
275
  ...d
275
276
  }) => /* @__PURE__ */ i(
276
277
  V,
@@ -284,8 +285,8 @@ const te = {
284
285
  ),
285
286
  children: ({ isDisabled: p }) => /* @__PURE__ */ N(_, { children: [
286
287
  c && /* @__PURE__ */ i(c, { className: "pointer-events-none size-5 text-fg-quaternary" }),
287
- /* @__PURE__ */ i(I, { contain: !1, autoFocus: !1, restoreFocus: !1, children: /* @__PURE__ */ i(
288
- re,
288
+ /* @__PURE__ */ i(ee, { contain: !1, autoFocus: !1, restoreFocus: !1, children: /* @__PURE__ */ i(
289
+ ie,
289
290
  {
290
291
  isDisabled: p,
291
292
  size: m,
@@ -297,10 +298,10 @@ const te = {
297
298
  ) })
298
299
  ] })
299
300
  }
300
- ), ae = se;
301
- ae.Item = Y;
301
+ ), le = se;
302
+ le.Item = Y;
302
303
  export {
303
- ae as MultiSelect,
304
+ le as MultiSelect,
304
305
  se as MultiSelectBase,
305
- ie as MultiSelectTagsValue
306
+ ae as MultiSelectTagsValue
306
307
  };