@pibit.ai/cure-design-system 0.5.11 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/applications/date-picker/calendar-value.d.ts +4 -0
  2. package/dist/applications/date-picker/calendar-value.d.ts.map +1 -0
  3. package/dist/applications/date-picker/calendar-value.js +6 -0
  4. package/dist/applications/date-picker/calendar.d.ts.map +1 -1
  5. package/dist/applications/date-picker/calendar.js +130 -124
  6. package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -1
  7. package/dist/applications/date-picker/date-time-calendar.js +56 -55
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +161 -157
  11. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +6 -6
  12. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +5 -5
  13. package/dist/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +3 -3
  14. package/dist/node_modules/{@react-stately/data/dist → react-stately/dist/private/data}/useListData.js +61 -64
  15. package/dist/patterns/table/rowReorderDrag.js +4 -4
  16. package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
  17. package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +160 -139
  18. package/dist/patterns/table-component/TableComponent.d.ts +1 -1
  19. package/dist/patterns/table-component/TableComponent.d.ts.map +1 -1
  20. package/dist/patterns/table-component/TableComponent.js +996 -580
  21. package/dist/patterns/table-component/columnReorderDrag.d.ts +41 -0
  22. package/dist/patterns/table-component/columnReorderDrag.d.ts.map +1 -0
  23. package/dist/patterns/table-component/columnReorderDrag.js +55 -0
  24. package/dist/patterns/table-component/columnReorderDrag.test.d.ts +2 -0
  25. package/dist/patterns/table-component/columnReorderDrag.test.d.ts.map +1 -0
  26. package/dist/patterns/table-component/types.d.ts +8 -0
  27. package/dist/patterns/table-component/types.d.ts.map +1 -1
  28. package/dist/primitives/avatar/avatar.d.ts +46 -28
  29. package/dist/primitives/avatar/avatar.d.ts.map +1 -1
  30. package/dist/primitives/avatar/avatar.js +114 -39
  31. package/dist/primitives/avatar/base-components/avatar-online-indicator.d.ts +8 -0
  32. package/dist/primitives/avatar/base-components/avatar-online-indicator.d.ts.map +1 -0
  33. package/dist/primitives/avatar/base-components/avatar-online-indicator.js +29 -0
  34. package/dist/primitives/avatar/base-components/index.d.ts +3 -0
  35. package/dist/primitives/avatar/base-components/index.d.ts.map +1 -0
  36. package/dist/primitives/avatar/base-components/verified-tick.d.ts +7 -0
  37. package/dist/primitives/avatar/base-components/verified-tick.d.ts.map +1 -0
  38. package/dist/primitives/avatar/base-components/verified-tick.js +41 -0
  39. package/dist/primitives/dropdown/dropdown.d.ts +2 -2
  40. package/dist/primitives/input/input.d.ts.map +1 -1
  41. package/dist/primitives/input/input.js +9 -1
  42. package/dist/primitives/select/SearchInput.d.ts +7 -7
  43. package/dist/primitives/select/SearchInput.d.ts.map +1 -1
  44. package/dist/primitives/select/__tests__/multi-select-utils.test.d.ts +2 -0
  45. package/dist/primitives/select/__tests__/multi-select-utils.test.d.ts.map +1 -0
  46. package/dist/primitives/select/combobox.d.ts +1 -2
  47. package/dist/primitives/select/combobox.d.ts.map +1 -1
  48. package/dist/primitives/select/index.d.ts +3 -1
  49. package/dist/primitives/select/index.d.ts.map +1 -1
  50. package/dist/primitives/select/multi-select-utils.d.ts +7 -0
  51. package/dist/primitives/select/multi-select-utils.d.ts.map +1 -0
  52. package/dist/primitives/select/multi-select-utils.js +17 -0
  53. package/dist/primitives/select/multi-select.d.ts +17 -4
  54. package/dist/primitives/select/multi-select.d.ts.map +1 -1
  55. package/dist/primitives/select/multi-select.js +631 -237
  56. package/dist/primitives/select/searchable-select.d.ts +26 -4
  57. package/dist/primitives/select/searchable-select.d.ts.map +1 -1
  58. package/dist/primitives/select/searchable-select.js +292 -189
  59. package/dist/primitives/select/select-checkbox.d.ts +6 -0
  60. package/dist/primitives/select/select-checkbox.d.ts.map +1 -0
  61. package/dist/primitives/select/select-checkbox.js +62 -0
  62. package/dist/primitives/select/select-item.d.ts +3 -1
  63. package/dist/primitives/select/select-item.d.ts.map +1 -1
  64. package/dist/primitives/select/select-item.js +95 -77
  65. package/dist/primitives/select/select-native.d.ts +21 -2
  66. package/dist/primitives/select/select-native.d.ts.map +1 -1
  67. package/dist/primitives/select/select-native.js +88 -0
  68. package/dist/primitives/select/select-shared.d.ts +1 -0
  69. package/dist/primitives/select/select-shared.d.ts.map +1 -1
  70. package/dist/primitives/select/select.d.ts +12 -2
  71. package/dist/primitives/select/select.d.ts.map +1 -1
  72. package/dist/primitives/select/select.js +207 -152
  73. package/dist/styles/components.css +1 -1
  74. package/dist/styles/theme.css +1 -1
  75. package/package.json +4 -4
@@ -1,13 +1,10 @@
1
1
  import { useState as K, useMemo as x } from "react";
2
- function g(s) {
3
- let { initialItems: f = [], initialSelectedKeys: d, getKey: r = (o) => {
4
- var m;
5
- return (m = o.id) !== null && m !== void 0 ? m : o.key;
6
- }, filter: t, initialFilterText: e = "" } = s, [l, i] = K({
2
+ function $(o) {
3
+ let { initialItems: f = [], initialSelectedKeys: d, getKey: i = (m) => m.id ?? m.key, filter: t, initialFilterText: e = "" } = o, [l, r] = K({
7
4
  items: f,
8
5
  selectedKeys: d === "all" ? "all" : new Set(d || []),
9
6
  filterText: e
10
- }), n = x(() => t ? l.items.filter((o) => t(o, l.filterText)) : l.items, [
7
+ }), n = x(() => t ? l.items.filter((m) => t(m, l.filterText)) : l.items, [
11
8
  l.items,
12
9
  l.filterText,
13
10
  t
@@ -16,15 +13,15 @@ function g(s) {
16
13
  ...l,
17
14
  items: n,
18
15
  ...S({
19
- getKey: r
20
- }, i),
21
- getItem(o) {
22
- return l.items.find((m) => r(m) === o);
16
+ getKey: i
17
+ }, r),
18
+ getItem(m) {
19
+ return l.items.find((s) => i(s) === m);
23
20
  }
24
21
  };
25
22
  }
26
- function S(s, f) {
27
- let { cursor: d, getKey: r } = s;
23
+ function S(o, f) {
24
+ let { cursor: d, getKey: i } = o;
28
25
  return {
29
26
  setSelectedKeys(t) {
30
27
  f((e) => ({
@@ -50,8 +47,8 @@ function S(s, f) {
50
47
  ...e,
51
48
  selectedKeys: /* @__PURE__ */ new Set()
52
49
  };
53
- let l = e.selectedKeys === "all" ? new Set(e.items.map(r)) : new Set(e.selectedKeys);
54
- for (let i of t) l.delete(i);
50
+ let l = e.selectedKeys === "all" ? new Set(e.items.map(i)) : new Set(e.selectedKeys);
51
+ for (let r of t) l.delete(r);
55
52
  return {
56
53
  ...e,
57
54
  selectedKeys: l
@@ -69,20 +66,20 @@ function S(s, f) {
69
66
  },
70
67
  insertBefore(t, ...e) {
71
68
  f((l) => {
72
- let i = l.items.findIndex((n) => (r == null ? void 0 : r(n)) === t);
73
- if (i === -1)
74
- if (l.items.length === 0) i = 0;
69
+ let r = l.items.findIndex((n) => (i == null ? void 0 : i(n)) === t);
70
+ if (r === -1)
71
+ if (l.items.length === 0) r = 0;
75
72
  else return l;
76
- return u(l, i, ...e);
73
+ return u(l, r, ...e);
77
74
  });
78
75
  },
79
76
  insertAfter(t, ...e) {
80
77
  f((l) => {
81
- let i = l.items.findIndex((n) => (r == null ? void 0 : r(n)) === t);
82
- if (i === -1)
83
- if (l.items.length === 0) i = 0;
78
+ let r = l.items.findIndex((n) => (i == null ? void 0 : i(n)) === t);
79
+ if (r === -1)
80
+ if (l.items.length === 0) r = 0;
84
81
  else return l;
85
- return u(l, i + 1, ...e);
82
+ return u(l, r + 1, ...e);
86
83
  });
87
84
  },
88
85
  prepend(...t) {
@@ -93,14 +90,14 @@ function S(s, f) {
93
90
  },
94
91
  remove(...t) {
95
92
  f((e) => {
96
- let l = new Set(t), i = e.items.filter((o) => !l.has(r(o))), n = "all";
93
+ let l = new Set(t), r = e.items.filter((m) => !l.has(i(m))), n = "all";
97
94
  if (e.selectedKeys !== "all") {
98
95
  n = new Set(e.selectedKeys);
99
- for (let o of t) n.delete(o);
96
+ for (let m of t) n.delete(m);
100
97
  }
101
- return d == null && i.length === 0 && (n = /* @__PURE__ */ new Set()), {
98
+ return d == null && r.length === 0 && (n = /* @__PURE__ */ new Set()), {
102
99
  ...e,
103
- items: i,
100
+ items: r,
104
101
  selectedKeys: n
105
102
  };
106
103
  });
@@ -112,7 +109,7 @@ function S(s, f) {
112
109
  items: [],
113
110
  selectedKeys: /* @__PURE__ */ new Set()
114
111
  };
115
- let e = t.selectedKeys, l = t.items.filter((i) => !e.has(r(i)));
112
+ let e = t.selectedKeys, l = t.items.filter((r) => !e.has(i(r)));
116
113
  return {
117
114
  ...t,
118
115
  items: l,
@@ -122,10 +119,10 @@ function S(s, f) {
122
119
  },
123
120
  move(t, e) {
124
121
  f((l) => {
125
- let i = l.items.findIndex((m) => r(m) === t);
126
- if (i === -1) return l;
127
- let n = l.items.slice(), [o] = n.splice(i, 1);
128
- return n.splice(e, 0, o), {
122
+ let r = l.items.findIndex((s) => i(s) === t);
123
+ if (r === -1) return l;
124
+ let n = l.items.slice(), [m] = n.splice(r, 1);
125
+ return n.splice(e, 0, m), {
129
126
  ...l,
130
127
  items: n
131
128
  };
@@ -133,80 +130,80 @@ function S(s, f) {
133
130
  },
134
131
  moveBefore(t, e) {
135
132
  f((l) => {
136
- let i = l.items.findIndex((m) => r(m) === t);
137
- if (i === -1) return l;
138
- let o = (Array.isArray(e) ? e : [
133
+ let r = l.items.findIndex((s) => i(s) === t);
134
+ if (r === -1) return l;
135
+ let m = (Array.isArray(e) ? e : [
139
136
  ...e
140
- ]).map((m) => l.items.findIndex((c) => r(c) === m)).sort((m, c) => m - c);
141
- return y(l, o, i);
137
+ ]).map((s) => l.items.findIndex((c) => i(c) === s)).sort((s, c) => s - c);
138
+ return y(l, m, r);
142
139
  });
143
140
  },
144
141
  moveAfter(t, e) {
145
142
  f((l) => {
146
- let i = l.items.findIndex((m) => r(m) === t);
147
- if (i === -1) return l;
148
- let o = (Array.isArray(e) ? e : [
143
+ let r = l.items.findIndex((s) => i(s) === t);
144
+ if (r === -1) return l;
145
+ let m = (Array.isArray(e) ? e : [
149
146
  ...e
150
- ]).map((m) => l.items.findIndex((c) => r(c) === m)).sort((m, c) => m - c);
151
- return y(l, o, i + 1);
147
+ ]).map((s) => l.items.findIndex((c) => i(c) === s)).sort((s, c) => s - c);
148
+ return y(l, m, r + 1);
152
149
  });
153
150
  },
154
151
  update(t, e) {
155
152
  f((l) => {
156
- let i = l.items.findIndex((o) => r(o) === t);
157
- if (i === -1) return l;
153
+ let r = l.items.findIndex((m) => i(m) === t);
154
+ if (r === -1) return l;
158
155
  let n;
159
- return typeof e == "function" ? n = e(l.items[i]) : n = e, {
156
+ return typeof e == "function" ? n = e(l.items[r]) : n = e, {
160
157
  ...l,
161
158
  items: [
162
- ...l.items.slice(0, i),
159
+ ...l.items.slice(0, r),
163
160
  n,
164
- ...l.items.slice(i + 1)
161
+ ...l.items.slice(r + 1)
165
162
  ]
166
163
  };
167
164
  });
168
165
  }
169
166
  };
170
167
  }
171
- function u(s, f, ...d) {
168
+ function u(o, f, ...d) {
172
169
  return {
173
- ...s,
170
+ ...o,
174
171
  items: [
175
- ...s.items.slice(0, f),
172
+ ...o.items.slice(0, f),
176
173
  ...d,
177
- ...s.items.slice(f)
174
+ ...o.items.slice(f)
178
175
  ]
179
176
  };
180
177
  }
181
- function y(s, f, d) {
178
+ function y(o, f, d) {
182
179
  d -= f.filter((e) => e < d).length;
183
- let r = f.map((e) => ({
180
+ let i = f.map((e) => ({
184
181
  from: e,
185
182
  to: d++
186
183
  }));
187
- for (let e = 0; e < r.length; e++) {
188
- let l = r[e].from;
189
- for (let i = e; i < r.length; i++)
190
- r[i].from > l && r[i].from--;
184
+ for (let e = 0; e < i.length; e++) {
185
+ let l = i[e].from;
186
+ for (let r = e; r < i.length; r++)
187
+ i[r].from > l && i[r].from--;
191
188
  }
192
- for (let e = 0; e < r.length; e++) {
193
- let l = r[e];
194
- for (let i = r.length - 1; i > e; i--) {
195
- let n = r[i];
189
+ for (let e = 0; e < i.length; e++) {
190
+ let l = i[e];
191
+ for (let r = i.length - 1; r > e; r--) {
192
+ let n = i[r];
196
193
  n.from < l.to ? l.to++ : n.from++;
197
194
  }
198
195
  }
199
- let t = s.items.slice();
200
- for (let e of r) {
196
+ let t = o.items.slice();
197
+ for (let e of i) {
201
198
  let [l] = t.splice(e.from, 1);
202
199
  t.splice(e.to, 0, l);
203
200
  }
204
201
  return {
205
- ...s,
202
+ ...o,
206
203
  items: t
207
204
  };
208
205
  }
209
206
  export {
210
207
  S as createListActions,
211
- g as useListData
208
+ $ as useListData
212
209
  };
@@ -102,7 +102,7 @@ const k = ({ session: r }) => {
102
102
  ref: e,
103
103
  "aria-hidden": !0,
104
104
  className: L(
105
- "pointer-events-none fixed z-[10000] overflow-hidden rounded-md bg-primary shadow-lg",
105
+ "pointer-events-none fixed z-(--z-index-drag-overlay) overflow-hidden rounded-md bg-primary shadow-lg",
106
106
  "cursor-grabbing"
107
107
  ),
108
108
  style: {
@@ -117,12 +117,12 @@ const k = ({ session: r }) => {
117
117
  ),
118
118
  document.body
119
119
  );
120
- }, q = ({ y: r, left: e, width: t }) => A(
120
+ }, z = ({ y: r, left: e, width: t }) => A(
121
121
  /* @__PURE__ */ x(
122
122
  "div",
123
123
  {
124
124
  "aria-hidden": !0,
125
- className: "pointer-events-none fixed z-[10000] h-0.5",
125
+ className: "pointer-events-none fixed z-(--z-index-drag-indicator) h-0.5",
126
126
  style: {
127
127
  top: r - 1,
128
128
  left: e,
@@ -135,7 +135,7 @@ const k = ({ session: r }) => {
135
135
  document.body
136
136
  );
137
137
  export {
138
- q as DropIndicatorLine,
138
+ z as DropIndicatorLine,
139
139
  k as FloatingRowPreview,
140
140
  D as ROW_DRAG_SCROLL_EDGE_PX,
141
141
  O as ROW_DRAG_SCROLL_MAX_PX,
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnHeaderMenu.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/ColumnHeaderMenu.ts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,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,iGAAiG;AACjG,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;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;AAoFD,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAwLtD,CAAC"}
@@ -1,9 +1,9 @@
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
- import { cx as p } from "../../../utils/cn.js";
6
- import { Dropdown as g } from "../../../primitives/dropdown/dropdown.js";
1
+ import { jsxs as n, jsx as e, Fragment as p } from "react/jsx-runtime";
2
+ import { useState as _ } 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 j, FilterLines as Y, EyeOff as D, Trash01 as ee, Check as re } from "@untitledui/icons";
4
+ import { Button as q } from "react-aria-components";
5
+ import { cx as u } from "../../../utils/cn.js";
6
+ import { Dropdown as y } from "../../../primitives/dropdown/dropdown.js";
7
7
  const i = ({
8
8
  icon: o,
9
9
  label: a,
@@ -11,17 +11,19 @@ const i = ({
11
11
  submenu: h,
12
12
  selected: t,
13
13
  disabled: d,
14
- title: y,
15
- onClick: u
14
+ title: v,
15
+ onClick: m
16
16
  }) => /* @__PURE__ */ n(
17
17
  "div",
18
18
  {
19
- onClick: d ? void 0 : u,
20
- title: y,
19
+ onClick: (f) => {
20
+ f.stopPropagation(), d || m == null || m();
21
+ },
22
+ title: v,
21
23
  "aria-disabled": d || void 0,
22
- className: p(
24
+ className: u(
23
25
  "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium transition-colors w-full text-left",
24
- d ? "cursor-not-allowed text-disabled" : p(
26
+ d ? "cursor-not-allowed text-disabled" : u(
25
27
  "cursor-pointer",
26
28
  s ? "text-error-primary hover:bg-error-primary" : t ? "bg-utility-brand-25 text-secondary" : "text-secondary hover:bg-primary_hover"
27
29
  )
@@ -31,18 +33,18 @@ const i = ({
31
33
  o,
32
34
  {
33
35
  size: 16,
34
- className: p(
36
+ className: u(
35
37
  "shrink-0",
36
38
  d ? "text-fg-disabled" : s ? "text-error-primary" : "text-fg-quaternary"
37
39
  )
38
40
  }
39
41
  ),
40
42
  /* @__PURE__ */ e("span", { className: "flex-1 truncate", children: a }),
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
+ t && /* @__PURE__ */ e(re, { size: 14, className: "shrink-0 text-brand-600" }),
44
+ h && /* @__PURE__ */ e(j, { size: 14, className: "shrink-0 text-fg-quaternary" })
43
45
  ]
44
46
  }
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: [
47
+ ), c = () => /* @__PURE__ */ e("div", { className: "my-1 h-px w-full bg-secondary" }), z = ({ children: o }) => /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wider text-tertiary", children: o }), te = ({ 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
48
  /* @__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
49
  /* @__PURE__ */ e("span", { className: "text-xs font-semibold text-primary", children: o }),
48
50
  a && /* @__PURE__ */ e("span", { className: "text-xs text-tertiary", children: a })
@@ -57,149 +59,168 @@ const i = ({
57
59
  currentAlignment: h,
58
60
  capabilities: t,
59
61
  hideDisabled: d,
60
- onAction: y,
61
- renderExtraItems: u,
62
- showOnHeaderHover: w = !1,
62
+ onAction: v,
63
+ renderExtraItems: m,
64
+ showOnHeaderHover: f = !1,
63
65
  isHeaderHovered: M = !1
64
66
  }) => {
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);
67
+ var S, T;
68
+ const O = (s == null ? void 0 : s.data_type) ?? o.dataType, g = O === "LOOKUP" || o.variant === "lookup", F = O === "DERIVED" || o.variant === "derived", E = g ? "Hide field" : "Hide column", x = (t == null ? void 0 : t.sort) ?? !0, N = (t == null ? void 0 : t.align) ?? !0, b = (t == null ? void 0 : t.filter) ?? !0, k = (t == null ? void 0 : t.hide) ?? !0, [L, R] = _(!1), [H, w] = _(!1), I = !f || L || M, l = (r) => {
69
+ v(r), w(!1), R(!1);
70
+ }, P = C.find((r) => r.id === h) ?? C[0], U = P.icon, A = m == null ? void 0 : m(o);
69
71
  return /* @__PURE__ */ n(
70
- g.Root,
72
+ y.Root,
71
73
  {
72
- isOpen: F,
74
+ isOpen: L,
73
75
  onOpenChange: (r) => {
74
- L(r), r || b(!1);
76
+ R(r), r || w(!1);
75
77
  },
76
78
  children: [
77
79
  /* @__PURE__ */ e(
78
- z,
80
+ q,
79
81
  {
80
82
  "aria-label": `Open ${a} column menu`,
83
+ "data-column-reorder-ignore": !0,
81
84
  onClick: (r) => r.stopPropagation(),
82
- className: p(
85
+ className: u(
83
86
  "flex items-center justify-center rounded p-0.5 outline-none cursor-pointer transition-opacity",
84
87
  "text-fg-quaternary hover:bg-secondary_subtle hover:text-fg-quaternary_hover",
85
88
  "data-[pressed]:bg-secondary_subtle data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring",
86
- w && !I && "pointer-events-none opacity-0"
89
+ f && !I && "pointer-events-none opacity-0"
87
90
  ),
88
91
  children: /* @__PURE__ */ e(G, { size: 14, className: "stroke-2" })
89
92
  }
90
93
  ),
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" })
96
- ] }),
97
- /* @__PURE__ */ e(c, {}),
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" }) }),
100
- /* @__PURE__ */ e(c, {}),
101
- /* @__PURE__ */ e(
102
- i,
103
- {
104
- icon: J,
105
- label: "Add field to right",
106
- onClick: () => l({ type: "add-field", side: "right" })
107
- }
108
- ),
109
- /* @__PURE__ */ e(
110
- i,
111
- {
112
- icon: Q,
113
- label: "Add field to left",
114
- onClick: () => l({ type: "add-field", side: "left" })
115
- }
116
- ),
117
- /* @__PURE__ */ e(c, {})
118
- ] }),
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 })
123
- ] }),
124
- /* @__PURE__ */ e(c, {})
125
- ] }),
126
- S,
127
- S && (f || v || k || N) && /* @__PURE__ */ e(c, {}),
128
- f && /* @__PURE__ */ n(m, { children: [
129
- /* @__PURE__ */ e(
130
- i,
131
- {
132
- icon: W,
133
- label: "Sort A to Z",
134
- onClick: () => l({ type: "sort", direction: "asc" })
135
- }
136
- ),
137
- /* @__PURE__ */ e(
138
- i,
139
- {
140
- icon: X,
141
- label: "Sort Z to A",
142
- onClick: () => l({ type: "sort", direction: "desc" })
143
- }
144
- )
145
- ] }),
146
- v && /* @__PURE__ */ n(m, { children: [
147
- f && /* @__PURE__ */ e(c, {}),
148
- /* @__PURE__ */ n(g.Root, { isOpen: H, onOpenChange: b, children: [
149
- /* @__PURE__ */ n(
150
- z,
151
- {
152
- className: p(
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",
154
- "text-secondary hover:bg-primary_hover",
155
- "data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring"
94
+ /* @__PURE__ */ e(
95
+ y.Popover,
96
+ {
97
+ "data-column-reorder-ignore": !0,
98
+ className: u(g || F ? "w-72" : "w-56"),
99
+ children: /* @__PURE__ */ n("div", { className: "flex flex-col py-1 px-1.5", children: [
100
+ g && /* @__PURE__ */ n(p, { children: [
101
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5 px-2 py-2", children: [
102
+ /* @__PURE__ */ e(z, { children: "Lookup field" }),
103
+ /* @__PURE__ */ e(te, { label: a, suffix: "Object name" })
104
+ ] }),
105
+ /* @__PURE__ */ e(c, {}),
106
+ /* @__PURE__ */ e(i, { icon: K, label: "View Field", onClick: () => l({ type: "lookup-view" }) }),
107
+ /* @__PURE__ */ e(i, { icon: $, label: "Edit field", onClick: () => l({ type: "lookup-edit" }) }),
108
+ /* @__PURE__ */ e(c, {}),
109
+ /* @__PURE__ */ e(
110
+ i,
111
+ {
112
+ icon: J,
113
+ label: "Add field to right",
114
+ onClick: () => l({ type: "add-field", side: "right" })
115
+ }
116
+ ),
117
+ /* @__PURE__ */ e(
118
+ i,
119
+ {
120
+ icon: Q,
121
+ label: "Add field to left",
122
+ onClick: () => l({ type: "add-field", side: "left" })
123
+ }
124
+ ),
125
+ /* @__PURE__ */ e(c, {})
126
+ ] }),
127
+ F && /* @__PURE__ */ n(p, { children: [
128
+ /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5 px-2 py-2", children: [
129
+ /* @__PURE__ */ e(z, { children: "Formula" }),
130
+ /* @__PURE__ */ e("div", { className: "text-xs font-medium text-secondary break-words", children: ((S = s == null ? void 0 : s.formula) == null ? void 0 : S.trim()) || ((T = o.formula) == null ? void 0 : T.trim()) || a })
131
+ ] }),
132
+ /* @__PURE__ */ e(c, {})
133
+ ] }),
134
+ A && // Same guard `MenuRow` applies: the popover is portalled, but React
135
+ // still bubbles clicks to the header cell, which would also run its
136
+ // sort/drag handlers. The consumer's own handlers fire first.
137
+ /* @__PURE__ */ e("div", { onClick: (r) => r.stopPropagation(), children: A }),
138
+ A && (x || N || b || k) && /* @__PURE__ */ e(c, {}),
139
+ x && /* @__PURE__ */ n(p, { children: [
140
+ /* @__PURE__ */ e(
141
+ i,
142
+ {
143
+ icon: W,
144
+ label: "Sort A to Z",
145
+ onClick: () => l({ type: "sort", direction: "asc" })
146
+ }
147
+ ),
148
+ /* @__PURE__ */ e(
149
+ i,
150
+ {
151
+ icon: X,
152
+ label: "Sort Z to A",
153
+ onClick: () => l({ type: "sort", direction: "desc" })
154
+ }
155
+ )
156
+ ] }),
157
+ N && /* @__PURE__ */ n(p, { children: [
158
+ x && /* @__PURE__ */ e(c, {}),
159
+ /* @__PURE__ */ n(y.Root, { isOpen: H, onOpenChange: w, children: [
160
+ /* @__PURE__ */ n(
161
+ q,
162
+ {
163
+ className: u(
164
+ "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",
165
+ "text-secondary hover:bg-primary_hover",
166
+ "data-[focus-visible]:ring-2 data-[focus-visible]:ring-focus-ring"
167
+ ),
168
+ children: [
169
+ /* @__PURE__ */ e(U, { size: 16, className: "shrink-0 text-fg-quaternary" }),
170
+ /* @__PURE__ */ e("span", { className: "flex-1 truncate", children: P.label }),
171
+ /* @__PURE__ */ e(j, { size: 14, className: "shrink-0 text-fg-quaternary" })
172
+ ]
173
+ }
156
174
  ),
157
- children: [
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" })
161
- ]
162
- }
163
- ),
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(
165
- i,
166
- {
167
- icon: r.icon,
168
- label: r.label,
169
- selected: h === r.id,
170
- onClick: () => l({ type: "align", alignment: r.id })
171
- },
172
- r.id
173
- )) }) })
175
+ /* @__PURE__ */ e(
176
+ y.Popover,
177
+ {
178
+ "data-column-reorder-ignore": !0,
179
+ placement: "right top",
180
+ className: "w-44",
181
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col py-1 px-1.5", children: C.map((r) => /* @__PURE__ */ e(
182
+ i,
183
+ {
184
+ icon: r.icon,
185
+ label: r.label,
186
+ selected: h === r.id,
187
+ onClick: () => l({ type: "align", alignment: r.id })
188
+ },
189
+ r.id
190
+ )) })
191
+ }
192
+ )
193
+ ] })
194
+ ] }),
195
+ (b || k) && /* @__PURE__ */ n(p, { children: [
196
+ (x || N) && /* @__PURE__ */ e(c, {}),
197
+ b && /* @__PURE__ */ e(i, { icon: Y, label: "Filter by", onClick: () => l({ type: "filter" }) }),
198
+ k && /* @__PURE__ */ e(
199
+ i,
200
+ {
201
+ icon: D,
202
+ label: E,
203
+ disabled: d,
204
+ title: d ? "At least one column must remain visible" : void 0,
205
+ onClick: () => l({ type: "hide" })
206
+ }
207
+ )
208
+ ] }),
209
+ g && /* @__PURE__ */ n(p, { children: [
210
+ /* @__PURE__ */ e(c, {}),
211
+ /* @__PURE__ */ e(
212
+ i,
213
+ {
214
+ icon: ee,
215
+ label: "Delete fields",
216
+ danger: !0,
217
+ onClick: () => l({ type: "lookup-delete" })
218
+ }
219
+ )
220
+ ] })
174
221
  ] })
175
- ] }),
176
- (k || N) && /* @__PURE__ */ n(m, { children: [
177
- (f || v) && /* @__PURE__ */ e(c, {}),
178
- k && /* @__PURE__ */ e(i, { icon: Y, label: "Filter by", onClick: () => l({ type: "filter" }) }),
179
- N && /* @__PURE__ */ e(
180
- i,
181
- {
182
- icon: D,
183
- label: E,
184
- disabled: d,
185
- title: d ? "At least one column must remain visible" : void 0,
186
- onClick: () => l({ type: "hide" })
187
- }
188
- )
189
- ] }),
190
- x && /* @__PURE__ */ n(m, { children: [
191
- /* @__PURE__ */ e(c, {}),
192
- /* @__PURE__ */ e(
193
- i,
194
- {
195
- icon: ee,
196
- label: "Delete fields",
197
- danger: !0,
198
- onClick: () => l({ type: "lookup-delete" })
199
- }
200
- )
201
- ] })
202
- ] }) })
222
+ }
223
+ )
203
224
  ]
204
225
  }
205
226
  );