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

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 +236 -233
  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 +4 -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
@@ -0,0 +1,147 @@
1
+ function R(e) {
2
+ return e ? new Set(e) : void 0;
3
+ }
4
+ function C(e) {
5
+ return e ? new Map(e) : void 0;
6
+ }
7
+ function A(e) {
8
+ return e == null ? void 0 : e.map((n) => ({ ...n }));
9
+ }
10
+ function f(e) {
11
+ return e == null ? void 0 : e.map((n) => ({ ...n }));
12
+ }
13
+ function v(e) {
14
+ if (e)
15
+ return typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e));
16
+ }
17
+ function S(e) {
18
+ var g, o, s, l, m, w, y;
19
+ const { toolbar: n, columnAlignments: i, summaryFooterProps: d, appliedFilterConditions: u, data: r, getData: t } = e, p = i ?? ((g = n == null ? void 0 : n.align) == null ? void 0 : g.columnAlignments) ?? void 0, h = u ?? ((o = n == null ? void 0 : n.filter) == null ? void 0 : o.pendingConditions);
20
+ return {
21
+ hiddenColumns: R((s = n == null ? void 0 : n.hideFields) == null ? void 0 : s.hiddenColumns),
22
+ columnOrder: n != null && n.hideFields ? [...n.hideFields.columnOrder] : void 0,
23
+ columnAlignments: C(p),
24
+ groupBy: ((l = n == null ? void 0 : n.groupBy) == null ? void 0 : l.value) ?? null,
25
+ showSummary: (m = n == null ? void 0 : n.summary) == null ? void 0 : m.value,
26
+ summaryAggregations: C(d == null ? void 0 : d.summaryAggregations),
27
+ rowHeight: (w = n == null ? void 0 : n.rowHeight) == null ? void 0 : w.value,
28
+ sorts: A((y = n == null ? void 0 : n.sort) == null ? void 0 : y.sorts),
29
+ filterConditions: f(h),
30
+ data: v((t == null ? void 0 : t()) ?? r)
31
+ };
32
+ }
33
+ function B(e, n) {
34
+ const { toolbar: i, summaryFooterProps: d, onDataRestore: u } = n;
35
+ e.hiddenColumns !== void 0 && (i != null && i.hideFields) && i.hideFields.setHiddenColumns(new Set(e.hiddenColumns)), e.columnOrder !== void 0 && (i != null && i.hideFields) && i.hideFields.setColumnOrder([...e.columnOrder]), e.columnAlignments !== void 0 && (i != null && i.align) && i.align.setColumnAlignments(new Map(e.columnAlignments)), e.groupBy !== void 0 && (i != null && i.groupBy) && i.groupBy.onChange(e.groupBy), e.showSummary !== void 0 && (i != null && i.summary) && i.summary.onChange(e.showSummary), e.rowHeight !== void 0 && (i != null && i.rowHeight) && i.rowHeight.onChange(e.rowHeight), e.sorts !== void 0 && (i != null && i.sort) && (i.sort.onSortsChange(A(e.sorts) ?? []), i.sort.onApply()), e.filterConditions !== void 0 && (i != null && i.filter) && (i.filter.setPendingConditions(f(e.filterConditions) ?? []), i.filter.onApply()), e.summaryAggregations !== void 0 && (d != null && d.setSummaryAggregations) && d.setSummaryAggregations(new Map(e.summaryAggregations)), e.data !== void 0 && u && u(v(e.data) ?? []);
36
+ }
37
+ function c(e) {
38
+ let n = !1;
39
+ return () => {
40
+ n || (e(), n = !0, queueMicrotask(() => {
41
+ n = !1;
42
+ }));
43
+ };
44
+ }
45
+ function H(e, n) {
46
+ const i = c(n);
47
+ return {
48
+ ...e,
49
+ sort: e.sort ? {
50
+ ...e.sort,
51
+ onApply: () => {
52
+ n(), e.sort.onApply();
53
+ },
54
+ onClear: () => {
55
+ n(), e.sort.onClear();
56
+ }
57
+ } : void 0,
58
+ filter: e.filter ? {
59
+ ...e.filter,
60
+ onApply: () => {
61
+ n(), e.filter.onApply();
62
+ },
63
+ onClearAll: () => {
64
+ n(), e.filter.onClearAll();
65
+ }
66
+ } : void 0,
67
+ hideFields: e.hideFields ? {
68
+ ...e.hideFields,
69
+ setHiddenColumns: (d) => {
70
+ i(), e.hideFields.setHiddenColumns(d);
71
+ },
72
+ setColumnOrder: (d) => {
73
+ i(), e.hideFields.setColumnOrder(d);
74
+ }
75
+ } : void 0,
76
+ align: e.align ? {
77
+ ...e.align,
78
+ setColumnAlignments: (d) => {
79
+ n(), e.align.setColumnAlignments(d);
80
+ }
81
+ } : void 0,
82
+ groupBy: e.groupBy ? {
83
+ ...e.groupBy,
84
+ onChange: (d) => {
85
+ n(), e.groupBy.onChange(d);
86
+ }
87
+ } : void 0,
88
+ summary: e.summary ? {
89
+ ...e.summary,
90
+ onChange: (d) => {
91
+ n(), e.summary.onChange(d);
92
+ }
93
+ } : void 0,
94
+ rowHeight: e.rowHeight ? {
95
+ ...e.rowHeight,
96
+ onChange: (d) => {
97
+ n(), e.rowHeight.onChange(d);
98
+ }
99
+ } : void 0
100
+ };
101
+ }
102
+ function F(e, n) {
103
+ return {
104
+ ...e,
105
+ setSummaryAggregations: (i) => {
106
+ n(), e.setSummaryAggregations(i);
107
+ }
108
+ };
109
+ }
110
+ function a(e, n) {
111
+ return {
112
+ ...e,
113
+ onAddRow: () => {
114
+ n(), e.onAddRow();
115
+ },
116
+ onDeleteRow: (i) => {
117
+ n(), e.onDeleteRow(i);
118
+ }
119
+ };
120
+ }
121
+ function D(e, n) {
122
+ const i = (d) => (u, r) => {
123
+ n(), d == null || d(u, r);
124
+ };
125
+ return {
126
+ ...e,
127
+ onAddRowAbove: e.onAddRowAbove ? i(e.onAddRowAbove) : void 0,
128
+ onAddRowBelow: e.onAddRowBelow ? i(e.onAddRowBelow) : void 0,
129
+ onDuplicateRow: e.onDuplicateRow ? i(e.onDuplicateRow) : void 0,
130
+ onPasteRowValues: e.onPasteRowValues ? i(e.onPasteRowValues) : void 0,
131
+ onDeleteRow: e.onDeleteRow ? i(e.onDeleteRow) : void 0
132
+ };
133
+ }
134
+ function O(e, n) {
135
+ return (i, d) => {
136
+ (d.type === "align" || d.type === "hide" || d.type === "sort") && n(), e(i, d);
137
+ };
138
+ }
139
+ export {
140
+ B as applyTableUndoSnapshot,
141
+ S as captureTableUndoSnapshot,
142
+ O as wrapColumnHeaderActionWithUndoRedo,
143
+ a as wrapEditChromeWithUndoRedo,
144
+ D as wrapRowActionsWithUndoRedo,
145
+ F as wrapSummaryFooterWithUndoRedo,
146
+ H as wrapToolbarWithUndoRedo
147
+ };
@@ -44,6 +44,10 @@ interface ColumnHeaderMenuProps {
44
44
  onAction: (action: ColumnMenuAction) => void;
45
45
  /** Domain-specific rows rendered after variant sections and before universal items. */
46
46
  renderExtraItems?: (column: TableColumnMenuSchema) => ReactNode;
47
+ /** When true, keep the trigger quiet until the header cell is hovered. */
48
+ showOnHeaderHover?: boolean;
49
+ /** Set by `Table.Head` when the parent header cell is hovered. */
50
+ isHeaderHovered?: boolean;
47
51
  }
48
52
  export declare const ColumnHeaderMenu: FC<ColumnHeaderMenuProps>;
49
53
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnHeaderMenu.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/ColumnHeaderMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,EAAE,E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AAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,qBAAqB;IAC7B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC3C,gBAAgB,EAAE,aAAa,CAAC;IAChC,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,2EAA2E;IAC3E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAChE,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA8ED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2KtD,CAAC"}
@@ -1,34 +1,34 @@
1
- import { jsxs as t, jsx as e, Fragment as m } from "react/jsx-runtime";
2
- import { useState as _ } from "react";
3
- import { AlignLeft as E, AlignCenter as I, AlignRight as U, ChevronDown as V, Eye as Z, Edit03 as B, ArrowRight as G, ArrowLeft as K, ArrowDown as $, ArrowUp as J, ChevronRight as T, FilterLines as Q, EyeOff as W, Trash01 as X, Check as Y } from "@untitledui/icons";
4
- import { Button as q } from "react-aria-components";
1
+ import { jsxs as n, jsx as e, Fragment as m } from "react/jsx-runtime";
2
+ import { useState as q } from "react";
3
+ import { AlignLeft as V, AlignCenter as Z, AlignRight as B, ChevronDown as G, Eye as K, Edit03 as $, ArrowRight as J, ArrowLeft as Q, ArrowDown as W, ArrowUp as X, ChevronRight as P, FilterLines as Y, EyeOff as D, Trash01 as ee, Check as te } from "@untitledui/icons";
4
+ import { Button as z } from "react-aria-components";
5
5
  import { cx as p } from "../../../utils/cn.js";
6
- import { Dropdown as y } from "../../../primitives/dropdown/dropdown.js";
6
+ import { Dropdown as g } from "../../../primitives/dropdown/dropdown.js";
7
7
  const i = ({
8
- icon: n,
8
+ icon: o,
9
9
  label: a,
10
10
  danger: s,
11
11
  submenu: h,
12
- selected: r,
12
+ selected: t,
13
13
  disabled: d,
14
- title: g,
14
+ title: y,
15
15
  onClick: u
16
- }) => /* @__PURE__ */ t(
16
+ }) => /* @__PURE__ */ n(
17
17
  "div",
18
18
  {
19
19
  onClick: d ? void 0 : u,
20
- title: g,
20
+ title: y,
21
21
  "aria-disabled": d || void 0,
22
22
  className: p(
23
23
  "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium transition-colors w-full text-left",
24
24
  d ? "cursor-not-allowed text-disabled" : p(
25
25
  "cursor-pointer",
26
- s ? "text-error-primary hover:bg-error-primary" : r ? "bg-utility-brand-25 text-secondary" : "text-secondary hover:bg-primary_hover"
26
+ s ? "text-error-primary hover:bg-error-primary" : t ? "bg-utility-brand-25 text-secondary" : "text-secondary hover:bg-primary_hover"
27
27
  )
28
28
  ),
29
29
  children: [
30
- n && /* @__PURE__ */ e(
31
- n,
30
+ o && /* @__PURE__ */ e(
31
+ o,
32
32
  {
33
33
  size: 16,
34
34
  className: p(
@@ -38,66 +38,70 @@ const i = ({
38
38
  }
39
39
  ),
40
40
  /* @__PURE__ */ e("span", { className: "flex-1 truncate", children: a }),
41
- r && /* @__PURE__ */ e(Y, { size: 14, className: "shrink-0 text-brand-600" }),
42
- h && /* @__PURE__ */ e(T, { size: 14, className: "shrink-0 text-fg-quaternary" })
41
+ t && /* @__PURE__ */ e(te, { size: 14, className: "shrink-0 text-brand-600" }),
42
+ h && /* @__PURE__ */ e(P, { size: 14, className: "shrink-0 text-fg-quaternary" })
43
43
  ]
44
44
  }
45
- ), c = () => /* @__PURE__ */ e("div", { className: "my-1 h-px w-full bg-secondary" }), z = ({ children: n }) => /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wider text-tertiary", children: n }), D = ({ label: n, suffix: a }) => /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1.5 rounded-md border border-secondary bg-primary px-1.5 py-0.5", children: [
45
+ ), c = () => /* @__PURE__ */ e("div", { className: "my-1 h-px w-full bg-secondary" }), j = ({ children: o }) => /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wider text-tertiary", children: o }), re = ({ label: o, suffix: a }) => /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1.5 rounded-md border border-secondary bg-primary px-1.5 py-0.5", children: [
46
46
  /* @__PURE__ */ e("span", { className: "flex h-4 w-4 items-center justify-center rounded-sm border border-secondary text-[9px] font-semibold text-tertiary", children: "T" }),
47
- /* @__PURE__ */ e("span", { className: "text-xs font-semibold text-primary", children: n }),
47
+ /* @__PURE__ */ e("span", { className: "text-xs font-semibold text-primary", children: o }),
48
48
  a && /* @__PURE__ */ e("span", { className: "text-xs text-tertiary", children: a })
49
49
  ] }), C = [
50
- { id: "left", icon: E, label: "Align Left" },
51
- { id: "center", icon: I, label: "Align Center" },
52
- { id: "right", icon: U, label: "Align Right" }
53
- ], ie = ({
54
- column: n,
50
+ { id: "left", icon: V, label: "Align Left" },
51
+ { id: "center", icon: Z, label: "Align Center" },
52
+ { id: "right", icon: B, label: "Align Right" }
53
+ ], ce = ({
54
+ column: o,
55
55
  columnLabel: a,
56
56
  fieldDef: s,
57
57
  currentAlignment: h,
58
- capabilities: r,
58
+ capabilities: t,
59
59
  hideDisabled: d,
60
- onAction: g,
61
- renderExtraItems: u
60
+ onAction: y,
61
+ renderExtraItems: u,
62
+ showOnHeaderHover: w = !1,
63
+ isHeaderHovered: M = !1
62
64
  }) => {
63
- var R, S;
64
- const w = (s == null ? void 0 : s.data_type) ?? n.dataType, x = w === "LOOKUP" || n.variant === "lookup", A = w === "DERIVED" || n.variant === "derived", j = x ? "Hide field" : "Hide column", f = (r == null ? void 0 : r.sort) ?? !0, v = (r == null ? void 0 : r.align) ?? !0, N = (r == null ? void 0 : r.filter) ?? !0, k = (r == null ? void 0 : r.hide) ?? !0, [H, O] = _(!1), [M, b] = _(!1), l = (o) => {
65
- g(o), b(!1), O(!1);
66
- }, F = C.find((o) => o.id === h) ?? C[0], P = F.icon, L = u == null ? void 0 : u(n);
67
- return /* @__PURE__ */ t(
68
- y.Root,
65
+ var T, _;
66
+ const A = (s == null ? void 0 : s.data_type) ?? o.dataType, x = A === "LOOKUP" || o.variant === "lookup", O = A === "DERIVED" || o.variant === "derived", E = x ? "Hide field" : "Hide column", f = (t == null ? void 0 : t.sort) ?? !0, v = (t == null ? void 0 : t.align) ?? !0, k = (t == null ? void 0 : t.filter) ?? !0, N = (t == null ? void 0 : t.hide) ?? !0, [F, L] = q(!1), [H, b] = q(!1), I = !w || F || M, l = (r) => {
67
+ y(r), b(!1), L(!1);
68
+ }, R = C.find((r) => r.id === h) ?? C[0], U = R.icon, S = u == null ? void 0 : u(o);
69
+ return /* @__PURE__ */ n(
70
+ g.Root,
69
71
  {
70
- isOpen: H,
71
- onOpenChange: (o) => {
72
- O(o), o || b(!1);
72
+ isOpen: F,
73
+ onOpenChange: (r) => {
74
+ L(r), r || b(!1);
73
75
  },
74
76
  children: [
75
77
  /* @__PURE__ */ e(
76
- q,
78
+ z,
77
79
  {
78
80
  "aria-label": `Open ${a} column menu`,
81
+ onClick: (r) => r.stopPropagation(),
79
82
  className: p(
80
- "flex items-center justify-center rounded p-0.5 outline-none cursor-pointer",
83
+ "flex items-center justify-center rounded p-0.5 outline-none cursor-pointer transition-opacity",
81
84
  "text-fg-quaternary hover:bg-secondary_subtle hover:text-fg-quaternary_hover",
82
- "data-[pressed]:bg-secondary_subtle data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring"
85
+ "data-[pressed]:bg-secondary_subtle data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring",
86
+ w && !I && "pointer-events-none opacity-0"
83
87
  ),
84
- children: /* @__PURE__ */ e(V, { size: 14, className: "stroke-2" })
88
+ children: /* @__PURE__ */ e(G, { size: 14, className: "stroke-2" })
85
89
  }
86
90
  ),
87
- /* @__PURE__ */ e(y.Popover, { className: p(x || A ? "w-72" : "w-56"), children: /* @__PURE__ */ t("div", { className: "flex flex-col py-1 px-1.5", children: [
88
- x && /* @__PURE__ */ t(m, { children: [
89
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-1.5 px-2 py-2", children: [
90
- /* @__PURE__ */ e(z, { children: "Lookup field" }),
91
- /* @__PURE__ */ e(D, { label: a, suffix: "Object name" })
91
+ /* @__PURE__ */ e(g.Popover, { className: p(x || O ? "w-72" : "w-56"), children: /* @__PURE__ */ n("div", { className: "flex flex-col py-1 px-1.5", children: [
92
+ x && /* @__PURE__ */ n(m, { children: [
93
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5 px-2 py-2", children: [
94
+ /* @__PURE__ */ e(j, { children: "Lookup field" }),
95
+ /* @__PURE__ */ e(re, { label: a, suffix: "Object name" })
92
96
  ] }),
93
97
  /* @__PURE__ */ e(c, {}),
94
- /* @__PURE__ */ e(i, { icon: Z, label: "View Field", onClick: () => l({ type: "lookup-view" }) }),
95
- /* @__PURE__ */ e(i, { icon: B, label: "Edit field", onClick: () => l({ type: "lookup-edit" }) }),
98
+ /* @__PURE__ */ e(i, { icon: K, label: "View Field", onClick: () => l({ type: "lookup-view" }) }),
99
+ /* @__PURE__ */ e(i, { icon: $, label: "Edit field", onClick: () => l({ type: "lookup-edit" }) }),
96
100
  /* @__PURE__ */ e(c, {}),
97
101
  /* @__PURE__ */ e(
98
102
  i,
99
103
  {
100
- icon: G,
104
+ icon: J,
101
105
  label: "Add field to right",
102
106
  onClick: () => l({ type: "add-field", side: "right" })
103
107
  }
@@ -105,27 +109,27 @@ const i = ({
105
109
  /* @__PURE__ */ e(
106
110
  i,
107
111
  {
108
- icon: K,
112
+ icon: Q,
109
113
  label: "Add field to left",
110
114
  onClick: () => l({ type: "add-field", side: "left" })
111
115
  }
112
116
  ),
113
117
  /* @__PURE__ */ e(c, {})
114
118
  ] }),
115
- A && /* @__PURE__ */ t(m, { children: [
116
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-1.5 px-2 py-2", children: [
117
- /* @__PURE__ */ e(z, { children: "Formula" }),
118
- /* @__PURE__ */ e("div", { className: "text-xs font-medium text-secondary break-words", children: ((R = s == null ? void 0 : s.formula) == null ? void 0 : R.trim()) || ((S = n.formula) == null ? void 0 : S.trim()) || a })
119
+ O && /* @__PURE__ */ n(m, { children: [
120
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5 px-2 py-2", children: [
121
+ /* @__PURE__ */ e(j, { children: "Formula" }),
122
+ /* @__PURE__ */ e("div", { className: "text-xs font-medium text-secondary break-words", children: ((T = s == null ? void 0 : s.formula) == null ? void 0 : T.trim()) || ((_ = o.formula) == null ? void 0 : _.trim()) || a })
119
123
  ] }),
120
124
  /* @__PURE__ */ e(c, {})
121
125
  ] }),
122
- L,
123
- L && (f || v || N || k) && /* @__PURE__ */ e(c, {}),
124
- f && /* @__PURE__ */ t(m, { children: [
126
+ S,
127
+ S && (f || v || k || N) && /* @__PURE__ */ e(c, {}),
128
+ f && /* @__PURE__ */ n(m, { children: [
125
129
  /* @__PURE__ */ e(
126
130
  i,
127
131
  {
128
- icon: $,
132
+ icon: W,
129
133
  label: "Sort A to Z",
130
134
  onClick: () => l({ type: "sort", direction: "asc" })
131
135
  }
@@ -133,17 +137,17 @@ const i = ({
133
137
  /* @__PURE__ */ e(
134
138
  i,
135
139
  {
136
- icon: J,
140
+ icon: X,
137
141
  label: "Sort Z to A",
138
142
  onClick: () => l({ type: "sort", direction: "desc" })
139
143
  }
140
144
  )
141
145
  ] }),
142
- v && /* @__PURE__ */ t(m, { children: [
146
+ v && /* @__PURE__ */ n(m, { children: [
143
147
  f && /* @__PURE__ */ e(c, {}),
144
- /* @__PURE__ */ t(y.Root, { isOpen: M, onOpenChange: b, children: [
145
- /* @__PURE__ */ t(
146
- q,
148
+ /* @__PURE__ */ n(g.Root, { isOpen: H, onOpenChange: b, children: [
149
+ /* @__PURE__ */ n(
150
+ z,
147
151
  {
148
152
  className: p(
149
153
  "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium cursor-pointer transition-colors w-full text-left outline-none",
@@ -151,44 +155,44 @@ const i = ({
151
155
  "data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring"
152
156
  ),
153
157
  children: [
154
- /* @__PURE__ */ e(P, { size: 16, className: "shrink-0 text-fg-quaternary" }),
155
- /* @__PURE__ */ e("span", { className: "flex-1 truncate", children: F.label }),
156
- /* @__PURE__ */ e(T, { size: 14, className: "shrink-0 text-fg-quaternary" })
158
+ /* @__PURE__ */ e(U, { size: 16, className: "shrink-0 text-fg-quaternary" }),
159
+ /* @__PURE__ */ e("span", { className: "flex-1 truncate", children: R.label }),
160
+ /* @__PURE__ */ e(P, { size: 14, className: "shrink-0 text-fg-quaternary" })
157
161
  ]
158
162
  }
159
163
  ),
160
- /* @__PURE__ */ e(y.Popover, { placement: "right top", className: "w-44", children: /* @__PURE__ */ e("div", { className: "flex flex-col py-1 px-1.5", children: C.map((o) => /* @__PURE__ */ e(
164
+ /* @__PURE__ */ e(g.Popover, { placement: "right top", className: "w-44", children: /* @__PURE__ */ e("div", { className: "flex flex-col py-1 px-1.5", children: C.map((r) => /* @__PURE__ */ e(
161
165
  i,
162
166
  {
163
- icon: o.icon,
164
- label: o.label,
165
- selected: h === o.id,
166
- onClick: () => l({ type: "align", alignment: o.id })
167
+ icon: r.icon,
168
+ label: r.label,
169
+ selected: h === r.id,
170
+ onClick: () => l({ type: "align", alignment: r.id })
167
171
  },
168
- o.id
172
+ r.id
169
173
  )) }) })
170
174
  ] })
171
175
  ] }),
172
- (N || k) && /* @__PURE__ */ t(m, { children: [
176
+ (k || N) && /* @__PURE__ */ n(m, { children: [
173
177
  (f || v) && /* @__PURE__ */ e(c, {}),
174
- N && /* @__PURE__ */ e(i, { icon: Q, label: "Filter by", onClick: () => l({ type: "filter" }) }),
175
- k && /* @__PURE__ */ e(
178
+ k && /* @__PURE__ */ e(i, { icon: Y, label: "Filter by", onClick: () => l({ type: "filter" }) }),
179
+ N && /* @__PURE__ */ e(
176
180
  i,
177
181
  {
178
- icon: W,
179
- label: j,
182
+ icon: D,
183
+ label: E,
180
184
  disabled: d,
181
185
  title: d ? "At least one column must remain visible" : void 0,
182
186
  onClick: () => l({ type: "hide" })
183
187
  }
184
188
  )
185
189
  ] }),
186
- x && /* @__PURE__ */ t(m, { children: [
190
+ x && /* @__PURE__ */ n(m, { children: [
187
191
  /* @__PURE__ */ e(c, {}),
188
192
  /* @__PURE__ */ e(
189
193
  i,
190
194
  {
191
- icon: X,
195
+ icon: ee,
192
196
  label: "Delete fields",
193
197
  danger: !0,
194
198
  onClick: () => l({ type: "lookup-delete" })
@@ -201,5 +205,5 @@ const i = ({
201
205
  );
202
206
  };
203
207
  export {
204
- ie as ColumnHeaderMenu
208
+ ce as ColumnHeaderMenu
205
209
  };
@@ -10,7 +10,7 @@ export type FilterToolConfig = LegacyFilterToolConfig;
10
10
  export interface SearchToolConfig {
11
11
  value: string;
12
12
  onChange: (value: string) => void;
13
- /** When true, registers Cmd+K / Ctrl+K for this table search. Default false — use page-level search shortcuts instead. */
13
+ /** When true, registers the platform-specific primary shortcut for this table search. Default false — use page-level search shortcuts instead. */
14
14
  shortcut?: boolean;
15
15
  }
16
16
  export type RowHeightToolConfig = RowHeightDropdownProps;
@@ -18,10 +18,19 @@ export type HideFieldsToolConfig = HideFieldsDropdownProps;
18
18
  export type AlignToolConfig = AlignDropdownProps;
19
19
  export type GroupByToolConfig = GroupByDropdownProps;
20
20
  export type SummaryToolConfig = ShowSummaryDropdownProps;
21
+ export interface UndoRedoToolConfig {
22
+ canUndo: boolean;
23
+ canRedo: boolean;
24
+ onUndo: () => void;
25
+ onRedo: () => void;
26
+ /** Register Cmd/Ctrl+Z and redo shortcuts. Default true when undoRedo is provided. */
27
+ shortcut?: boolean;
28
+ isDisabled?: boolean;
29
+ }
21
30
  export interface TableToolbarProps {
22
31
  className?: string;
23
32
  fallbackTitle?: string;
24
- showUndoRedo?: boolean;
33
+ undoRedo?: UndoRedoToolConfig;
25
34
  sort?: SortToolConfig;
26
35
  filter?: FilterToolConfig;
27
36
  search?: SearchToolConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/TableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQ3C,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,0HAA0H;IAC1H,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AACzD,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AACjD,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AACrD,MAAM,MAAM,iBAAiB,GAAG,wBA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