@spear-ai/spectral 1.3.43 → 1.3.44

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 (93) hide show
  1. package/dist/.js +142 -110
  2. package/dist/Alert.js +17 -12
  3. package/dist/Avatar.d.ts +2 -0
  4. package/dist/Avatar.js +1 -0
  5. package/dist/Button.js +24 -30
  6. package/dist/Dialog/DialogBase.d.ts +5 -5
  7. package/dist/Dialog/DialogBase.js +87 -86
  8. package/dist/Icons/CheckCircleIcon.d.ts +3 -0
  9. package/dist/Icons/CheckCircleIcon.js +29 -0
  10. package/dist/Icons/CheckSquareIcon.d.ts +3 -0
  11. package/dist/Icons/CheckSquareIcon.js +29 -0
  12. package/dist/Icons/ChevronDownIcon.d.ts +3 -0
  13. package/dist/Icons/ChevronDownIcon.js +28 -0
  14. package/dist/Icons/ChevronUpIcon.d.ts +3 -0
  15. package/dist/Icons/ChevronUpIcon.js +28 -0
  16. package/dist/Icons/{CheckIcon.d.ts → ErrorIcon.d.ts} +2 -2
  17. package/dist/Icons/ErrorIcon.js +30 -0
  18. package/dist/Icons/LoaderIcon.d.ts +3 -0
  19. package/dist/Icons/LoaderIcon.js +53 -0
  20. package/dist/Icons/index.d.ts +6 -1
  21. package/dist/Icons.js +82 -72
  22. package/dist/Input/InputUtils.d.ts +15 -0
  23. package/dist/Input/InputUtils.js +54 -0
  24. package/dist/Input.d.ts +24 -0
  25. package/dist/Input.js +170 -0
  26. package/dist/MultiSelect/MultiSelectBase.d.ts +34 -0
  27. package/dist/MultiSelect/MultiSelectBase.js +321 -0
  28. package/dist/MultiSelect/MutiSelect.d.ts +15 -0
  29. package/dist/MultiSelect/MutiSelect.js +30 -0
  30. package/dist/Popover.d.ts +1 -1
  31. package/dist/Popover.js +61 -59
  32. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +18 -17
  33. package/dist/Select/SelectBase.d.ts +26 -0
  34. package/dist/Select/SelectBase.js +233 -0
  35. package/dist/Select.d.ts +50 -0
  36. package/dist/Select.js +136 -0
  37. package/dist/Textarea/TextareaUtils.d.ts +19 -0
  38. package/dist/Textarea/TextareaUtils.js +54 -0
  39. package/dist/Textarea.d.ts +17 -0
  40. package/dist/Textarea.js +160 -0
  41. package/dist/chevron-down-UbkgS76q.js +19 -0
  42. package/dist/components/Avatar/Avatar.d.ts +2 -0
  43. package/dist/components/Avatar/Avatar.d.ts.map +1 -0
  44. package/dist/components/Dialog/DialogBase.d.ts +5 -5
  45. package/dist/components/Dialog/DialogBase.d.ts.map +1 -1
  46. package/dist/components/Icons/CheckCircleIcon.d.ts +3 -0
  47. package/dist/components/Icons/CheckCircleIcon.d.ts.map +1 -0
  48. package/dist/components/Icons/CheckSquareIcon.d.ts +3 -0
  49. package/dist/components/Icons/CheckSquareIcon.d.ts.map +1 -0
  50. package/dist/components/Icons/ChevronDownIcon.d.ts +3 -0
  51. package/dist/components/Icons/ChevronDownIcon.d.ts.map +1 -0
  52. package/dist/components/Icons/ChevronUpIcon.d.ts +3 -0
  53. package/dist/components/Icons/ChevronUpIcon.d.ts.map +1 -0
  54. package/dist/components/Icons/{CheckIcon.d.ts → ErrorIcon.d.ts} +2 -2
  55. package/dist/components/Icons/ErrorIcon.d.ts.map +1 -0
  56. package/dist/components/Icons/LoaderIcon.d.ts +3 -0
  57. package/dist/components/Icons/LoaderIcon.d.ts.map +1 -0
  58. package/dist/components/Icons/index.d.ts +6 -1
  59. package/dist/components/Icons/index.d.ts.map +1 -1
  60. package/dist/components/Input/Input.d.ts +24 -0
  61. package/dist/components/Input/Input.d.ts.map +1 -0
  62. package/dist/components/Input/InputUtils.d.ts +15 -0
  63. package/dist/components/Input/InputUtils.d.ts.map +1 -0
  64. package/dist/components/MultiSelect/MultiSelectBase.d.ts +34 -0
  65. package/dist/components/MultiSelect/MultiSelectBase.d.ts.map +1 -0
  66. package/dist/components/MultiSelect/MutiSelect.d.ts +15 -0
  67. package/dist/components/MultiSelect/MutiSelect.d.ts.map +1 -0
  68. package/dist/components/Popover/Popover.d.ts +1 -1
  69. package/dist/components/Popover/Popover.d.ts.map +1 -1
  70. package/dist/components/RadioButtonGroup/RadioButtonGroupBase.d.ts.map +1 -1
  71. package/dist/components/Select/Select.d.ts +50 -0
  72. package/dist/components/Select/Select.d.ts.map +1 -0
  73. package/dist/components/Select/SelectBase.d.ts +26 -0
  74. package/dist/components/Select/SelectBase.d.ts.map +1 -0
  75. package/dist/components/Textarea/Textarea.d.ts +17 -0
  76. package/dist/components/Textarea/Textarea.d.ts.map +1 -0
  77. package/dist/components/Textarea/TextareaUtils.d.ts +19 -0
  78. package/dist/components/Textarea/TextareaUtils.d.ts.map +1 -0
  79. package/dist/features/LabelingTools.js +8 -3
  80. package/dist/features/SensorMetadata.js +12 -7
  81. package/dist/features/SettingsPopover.js +18 -13
  82. package/dist/index.d.ts +2 -1
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/loader-circle-CvdzOiQ_.js +11 -0
  85. package/dist/styles/base-colors.css +33 -33
  86. package/dist/styles/main.css +1 -1
  87. package/dist/utils/formFieldUtils.d.ts +70 -0
  88. package/dist/utils/formFieldUtils.d.ts.map +1 -0
  89. package/dist/utils/formFieldUtils.js +178 -0
  90. package/dist/x-BBpi7a_7.js +14 -0
  91. package/package.json +1 -1
  92. package/dist/Icons/CheckIcon.js +0 -29
  93. package/dist/components/Icons/CheckIcon.d.ts.map +0 -1
@@ -0,0 +1,321 @@
1
+ "use client";
2
+ import "../styles/main.css";
3
+ import { jsxs as a, jsx as s, Fragment as ce } from "react/jsx-runtime";
4
+ import { c as p } from "../twUtils-CRiPKpXj.js";
5
+ import { forwardRef as ue, useId as pe, useState as I, useRef as $, useMemo as F, useCallback as b, useEffect as me } from "react";
6
+ import { X as K } from "../x-BBpi7a_7.js";
7
+ import { C as be, a as fe } from "../chevron-down-UbkgS76q.js";
8
+ import { c as ge } from "../createLucideIcon-CI1yJrZf.js";
9
+ import { L as he } from "../loader-circle-CvdzOiQ_.js";
10
+ /**
11
+ * @license lucide-react v0.542.0 - ISC
12
+ *
13
+ * This source code is licensed under the ISC license.
14
+ * See the LICENSE file in the root directory of this source tree.
15
+ */
16
+ const xe = [
17
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
18
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
19
+ ], ye = ge("search", xe), S = "h-4 w-4", ve = "h-5 w-5", Ne = (t) => ({
20
+ error: "border-danger hover:border-danger focus-visible:border-danger focus-visible:ring-danger",
21
+ loading: "cursor-wait border-input-border--disabled",
22
+ disabled: "cursor-not-allowed opacity-50 border-input-border--disabled bg-input-bg--disabled",
23
+ default: ""
24
+ })[t], we = (t, l, i) => p(
25
+ "flex h-12 w-full items-center justify-between rounded-lg border border-input-border bg-input-bg px-4 py-3 text-sm",
26
+ "hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
27
+ "focus:ring-2 focus:ring-black focus:ring-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2",
28
+ "disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
29
+ "transition duration-200 text-input-text",
30
+ l && "border-input-border--focus ring-2 ring-black ring-offset-2",
31
+ Ne(t),
32
+ i
33
+ ), Ce = (t) => p(
34
+ "absolute top-full left-0 right-0 z-50 mt-1 max-h-80 overflow-hidden rounded-lg border border-input-border bg-input-bg shadow-lg",
35
+ "transition-all duration-200 origin-top",
36
+ t ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none"
37
+ ), ke = (t) => {
38
+ const l = $(null);
39
+ return me(() => {
40
+ const i = (o) => {
41
+ l.current && !l.current.contains(o.target) && t();
42
+ };
43
+ return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
44
+ }, [t]), l;
45
+ }, Se = (t, l, i) => {
46
+ const [o, m] = I(-1), u = b(
47
+ (d) => {
48
+ const y = {
49
+ ArrowDown: () => {
50
+ d.preventDefault(), m((f) => Math.min(f + 1, t.length - 1));
51
+ },
52
+ ArrowUp: () => {
53
+ d.preventDefault(), m((f) => Math.max(f - 1, -1));
54
+ },
55
+ Enter: () => {
56
+ d.preventDefault(), o >= 0 && t[o] && l(t[o].value);
57
+ },
58
+ " ": () => {
59
+ d.preventDefault(), o >= 0 && t[o] && l(t[o].value);
60
+ },
61
+ Escape: () => {
62
+ d.preventDefault(), i();
63
+ }
64
+ }[d.key];
65
+ y && y();
66
+ },
67
+ [t, o, l, i]
68
+ );
69
+ return { focusedIndex: o, setFocusedIndex: m, handleKeyDown: u };
70
+ }, Ie = ue(
71
+ ({
72
+ value: t = [],
73
+ onChange: l,
74
+ options: i = [],
75
+ placeholder: o = "Select options",
76
+ maxCount: m = 3,
77
+ state: u = "default",
78
+ errorMessage: d,
79
+ emptyMessage: O = "No options found",
80
+ loadingMessage: y = "Loading options...",
81
+ searchPlaceholder: f = "Search options...",
82
+ selectAllLabel: P = "Select all",
83
+ clearAllLabel: T = "Clear all",
84
+ sortAlphabetically: D = !1,
85
+ showSelectAll: B = !0,
86
+ showClearAll: G = !0,
87
+ showSearch: H = !0,
88
+ closeOnSelect: V = !1,
89
+ name: j,
90
+ id: Z,
91
+ label: z,
92
+ className: U,
93
+ "aria-label": X,
94
+ "aria-describedby": q,
95
+ ...L
96
+ }, J) => {
97
+ const Q = pe(), E = Z || `${j}-${Q}`, M = `${E}-error`, [g, v] = I(!1), [w, W] = I(""), Y = ke(() => v(!1)), R = $(null), C = L.disabled || u === "disabled", ee = u === "loading", te = u === "error", h = F(() => {
98
+ let e = i.filter((n) => n.label.toLowerCase().includes(w.toLowerCase()));
99
+ return D && (e = [...e].sort((n, r) => n.label.localeCompare(r.label))), e;
100
+ }, [i, w, D]), x = F(() => {
101
+ const e = {}, n = [];
102
+ return h.forEach((r) => {
103
+ r.group ? (e[r.group] || (e[r.group] = []), e[r.group].push(r)) : n.push(r);
104
+ }), { groups: e, ungrouped: n, hasGroups: Object.keys(e).length > 0 };
105
+ }, [h]), { focusedIndex: re, handleKeyDown: se } = Se(h, N, () => v(!1)), ne = b(() => {
106
+ C || v((e) => (e || setTimeout(() => R.current?.focus(), 0), !e));
107
+ }, [C]);
108
+ function N(e) {
109
+ if (i.find((c) => c.value === e)?.disabled) return;
110
+ const r = t.includes(e) ? t.filter((c) => c !== e) : [...t, e];
111
+ l(r), V && v(!1);
112
+ }
113
+ const le = b(() => {
114
+ const e = i.filter((r) => !r.disabled).map((r) => r.value), n = e.every((r) => t.includes(r));
115
+ l(n ? [] : e);
116
+ }, [i, t, l]), _ = b(() => {
117
+ l([]);
118
+ }, [l]), ae = b((e) => {
119
+ W(e.target.value);
120
+ }, []), ie = b(
121
+ (e, n) => {
122
+ n.stopPropagation(), N(e);
123
+ },
124
+ [N]
125
+ ), oe = () => {
126
+ if (t.length === 0)
127
+ return /* @__PURE__ */ s("span", { className: "text-input-text-placeholder", children: o });
128
+ const e = t.slice(0, m), n = t.length - m;
129
+ return /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-1", children: [
130
+ e.map((r) => {
131
+ const c = i.find((k) => k.value === r);
132
+ return c ? /* @__PURE__ */ a(
133
+ "span",
134
+ {
135
+ className: "bg-input-bg--selected text-input-text inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs",
136
+ children: [
137
+ c.label,
138
+ /* @__PURE__ */ s(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ onClick: (k) => ie(r, k),
143
+ className: "hover:text-danger focus:outline-none",
144
+ "aria-label": `Remove ${c.label}`,
145
+ children: /* @__PURE__ */ s(K, { className: "h-3 w-3" })
146
+ }
147
+ )
148
+ ]
149
+ },
150
+ r
151
+ ) : null;
152
+ }),
153
+ n > 0 && /* @__PURE__ */ a("span", { className: "text-input-text-secondary text-xs", children: [
154
+ "+",
155
+ n,
156
+ " more"
157
+ ] })
158
+ ] });
159
+ }, A = (e, n) => {
160
+ const r = t.includes(e.value);
161
+ return /* @__PURE__ */ a(
162
+ "button",
163
+ {
164
+ type: "button",
165
+ className: p(
166
+ "hover:bg-input-bg--hover focus:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-left text-sm focus:outline-none",
167
+ "disabled:cursor-not-allowed disabled:opacity-50",
168
+ n === re && "bg-input-bg--hover",
169
+ r && "text-input-text font-medium"
170
+ ),
171
+ onClick: () => N(e.value),
172
+ disabled: e.disabled,
173
+ children: [
174
+ /* @__PURE__ */ s(
175
+ "div",
176
+ {
177
+ className: p(
178
+ "border-input-border flex h-4 w-4 items-center justify-center rounded border",
179
+ r && "bg-primary border-primary"
180
+ ),
181
+ children: r && /* @__PURE__ */ s(fe, { className: "h-3 w-3 text-white" })
182
+ }
183
+ ),
184
+ /* @__PURE__ */ s("span", { children: e.label })
185
+ ]
186
+ },
187
+ e.value
188
+ );
189
+ }, de = () => ({
190
+ "--multiselect-border-radius": "0.5rem",
191
+ "--multiselect-trigger-height": "3rem",
192
+ "--multiselect-dropdown-max-height": "20rem"
193
+ });
194
+ return /* @__PURE__ */ a("div", { className: "w-full", "data-testid": "multiselect-root", children: [
195
+ /* @__PURE__ */ a(
196
+ "div",
197
+ {
198
+ ref: Y,
199
+ className: "relative",
200
+ "data-testid": "multiselect-wrapper",
201
+ onKeyDown: g ? se : void 0,
202
+ children: [
203
+ /* @__PURE__ */ a(
204
+ "button",
205
+ {
206
+ ref: J,
207
+ type: "button",
208
+ id: E,
209
+ name: j,
210
+ className: we(u, g, U),
211
+ onClick: ne,
212
+ disabled: C,
213
+ "aria-label": X || z,
214
+ "aria-describedby": p(te && M, q),
215
+ "aria-expanded": g,
216
+ "aria-haspopup": "listbox",
217
+ "data-state": u,
218
+ style: de(),
219
+ ...L,
220
+ children: [
221
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: oe() }),
222
+ /* @__PURE__ */ a("div", { className: "ml-2 flex items-center gap-2", children: [
223
+ t.length > 0 && /* @__PURE__ */ s(
224
+ "button",
225
+ {
226
+ type: "button",
227
+ onClick: (e) => {
228
+ e.stopPropagation(), _();
229
+ },
230
+ className: "text-input-icon hover:text-input-icon--hover focus:outline-none",
231
+ "aria-label": "Clear all selections",
232
+ children: /* @__PURE__ */ s(K, { className: S })
233
+ }
234
+ ),
235
+ /* @__PURE__ */ s(
236
+ be,
237
+ {
238
+ className: p(
239
+ ve,
240
+ "text-input-icon transition-transform duration-200",
241
+ g && "rotate-180"
242
+ )
243
+ }
244
+ )
245
+ ] })
246
+ ]
247
+ }
248
+ ),
249
+ /* @__PURE__ */ s("div", { className: Ce(g), "data-testid": "multiselect-dropdown", children: /* @__PURE__ */ a("div", { className: "p-1", children: [
250
+ H && /* @__PURE__ */ a("div", { className: "relative mb-2", children: [
251
+ /* @__PURE__ */ s(ye, { className: p(S, "text-input-icon absolute top-1/2 left-3 -translate-y-1/2") }),
252
+ /* @__PURE__ */ s(
253
+ "input",
254
+ {
255
+ ref: R,
256
+ type: "text",
257
+ className: "border-input-border bg-input-bg focus:border-input-border--focus w-full rounded-md border py-2 pr-3 pl-9 text-sm focus:ring-1 focus:ring-black focus:outline-none",
258
+ placeholder: f,
259
+ value: w,
260
+ onChange: ae,
261
+ "aria-label": "Search options"
262
+ }
263
+ )
264
+ ] }),
265
+ /* @__PURE__ */ s("div", { className: "max-h-64 overflow-y-auto", role: "listbox", "aria-multiselectable": "true", children: ee ? /* @__PURE__ */ a("div", { className: "text-input-text-secondary flex items-center justify-center gap-2 py-6 text-sm", children: [
266
+ /* @__PURE__ */ s(he, { className: p(S, "animate-spin") }),
267
+ y
268
+ ] }) : h.length === 0 ? /* @__PURE__ */ s("div", { className: "text-input-text-secondary py-6 text-center text-sm", children: O }) : /* @__PURE__ */ a(ce, { children: [
269
+ B && /* @__PURE__ */ a("div", { className: "mb-1", children: [
270
+ /* @__PURE__ */ s(
271
+ "button",
272
+ {
273
+ type: "button",
274
+ className: "text-input-text-secondary hover:bg-input-bg--hover focus:bg-input-bg--hover flex w-full items-center gap-3 px-3 py-2 text-sm font-medium focus:outline-none",
275
+ onClick: le,
276
+ children: P
277
+ }
278
+ ),
279
+ /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" })
280
+ ] }),
281
+ x.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: x.ungrouped.map((e, n) => A(e, n)) }),
282
+ Object.entries(x.groups).map(([e, n]) => /* @__PURE__ */ a("div", { className: "mb-1", children: [
283
+ (x.ungrouped.length > 0 || Object.keys(x.groups).indexOf(e) > 0) && /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" }),
284
+ /* @__PURE__ */ s("div", { className: "text-input-text-secondary px-3 py-1 text-xs font-semibold tracking-wide uppercase", children: e }),
285
+ n.map((r, c) => A(r, h.indexOf(r)))
286
+ ] }, e)),
287
+ G && t.length > 0 && /* @__PURE__ */ a("div", { className: "mt-1", children: [
288
+ /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" }),
289
+ /* @__PURE__ */ s(
290
+ "button",
291
+ {
292
+ type: "button",
293
+ className: "text-danger hover:bg-danger-50 focus:bg-danger-50 flex w-full items-center gap-3 px-3 py-2 text-sm font-medium focus:outline-none",
294
+ onClick: _,
295
+ children: T
296
+ }
297
+ )
298
+ ] })
299
+ ] }) })
300
+ ] }) })
301
+ ]
302
+ }
303
+ ),
304
+ u === "error" && d && /* @__PURE__ */ s(
305
+ "p",
306
+ {
307
+ id: M,
308
+ className: "text-danger-500 mt-1.5 text-sm",
309
+ "data-testid": "multiselect-error-message",
310
+ "aria-live": "polite",
311
+ "aria-atomic": "true",
312
+ children: d
313
+ }
314
+ )
315
+ ] });
316
+ }
317
+ );
318
+ Ie.displayName = "MultiSelectBase";
319
+ export {
320
+ Ie as MultiSelectBase
321
+ };
@@ -0,0 +1,15 @@
1
+ import { MultiSelectBaseProps } from './MultiSelectBase';
2
+ export interface MultiSelectProps extends Omit<MultiSelectBaseProps, 'onChange' | 'options'> {
3
+ onValueChange: (value: string[]) => void;
4
+ options: Array<{
5
+ label: string;
6
+ value: string;
7
+ group?: string;
8
+ }>;
9
+ loading?: boolean;
10
+ emptyText?: string;
11
+ sortAlphabetically?: boolean;
12
+ onSearchChange?: (search: string) => void;
13
+ }
14
+ export declare const MultiSelect: import('react').ForwardRefExoticComponent<MultiSelectProps & import('react').RefAttributes<HTMLButtonElement>>;
15
+ //# sourceMappingURL=MutiSelect.d.ts.map
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import "../styles/main.css";
3
+ import { jsx as m } from "react/jsx-runtime";
4
+ import { MultiSelectBase as p } from "./MultiSelectBase.js";
5
+ import { forwardRef as u } from "react";
6
+ const f = u(
7
+ ({ onValueChange: t, options: a, loading: l = !1, emptyText: o = "No matches found.", state: s, ...r }, i) => {
8
+ const d = a.map((e) => ({
9
+ label: e.label,
10
+ value: e.value,
11
+ group: e.group,
12
+ disabled: !1
13
+ }));
14
+ return /* @__PURE__ */ m(
15
+ p,
16
+ {
17
+ ref: i,
18
+ onChange: t,
19
+ options: d,
20
+ state: l ? "loading" : s,
21
+ emptyMessage: o,
22
+ ...r
23
+ }
24
+ );
25
+ }
26
+ );
27
+ f.displayName = "MultiSelect";
28
+ export {
29
+ f as MultiSelect
30
+ };
package/dist/Popover.d.ts CHANGED
@@ -5,7 +5,7 @@ export type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content
5
5
  };
6
6
  declare function Popover({ ...props }: ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function PopoverTrigger({ ...props }: ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
8
- declare function PopoverContent({ className, align, sideOffset, width, ...props }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
8
+ declare function PopoverContent({ className, align, side, sideOffset, width, ...props }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
9
9
  declare function PopoverAnchor({ ...props }: ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
10
10
  export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
11
11
  //# sourceMappingURL=Popover.d.ts.map
package/dist/Popover.js CHANGED
@@ -10,22 +10,22 @@ var C = "Popover", [E, he] = z(C, [
10
10
  b
11
11
  ]), g = b(), [X, l] = E(C), F = (e) => {
12
12
  const {
13
- __scopePopover: a,
14
- children: t,
15
- open: r,
13
+ __scopePopover: n,
14
+ children: r,
15
+ open: a,
16
16
  defaultOpen: o,
17
- onOpenChange: n,
17
+ onOpenChange: t,
18
18
  modal: c = !1
19
- } = e, p = g(a), f = i.useRef(null), [v, h] = i.useState(!1), [m, u] = L({
20
- prop: r,
19
+ } = e, p = g(n), f = i.useRef(null), [v, h] = i.useState(!1), [m, u] = L({
20
+ prop: a,
21
21
  defaultProp: o ?? !1,
22
- onChange: n,
22
+ onChange: t,
23
23
  caller: C
24
24
  });
25
25
  return /* @__PURE__ */ s(q, { ...p, children: /* @__PURE__ */ s(
26
26
  X,
27
27
  {
28
- scope: a,
28
+ scope: n,
29
29
  contentId: G(),
30
30
  triggerRef: f,
31
31
  open: m,
@@ -35,21 +35,21 @@ var C = "Popover", [E, he] = z(C, [
35
35
  onCustomAnchorAdd: i.useCallback(() => h(!0), []),
36
36
  onCustomAnchorRemove: i.useCallback(() => h(!1), []),
37
37
  modal: c,
38
- children: t
38
+ children: r
39
39
  }
40
40
  ) });
41
41
  };
42
42
  F.displayName = C;
43
43
  var N = "PopoverAnchor", y = i.forwardRef(
44
- (e, a) => {
45
- const { __scopePopover: t, ...r } = e, o = l(N, t), n = g(t), { onCustomAnchorAdd: c, onCustomAnchorRemove: p } = o;
46
- return i.useEffect(() => (c(), () => p()), [c, p]), /* @__PURE__ */ s(w, { ...n, ...r, ref: a });
44
+ (e, n) => {
45
+ const { __scopePopover: r, ...a } = e, o = l(N, r), t = g(r), { onCustomAnchorAdd: c, onCustomAnchorRemove: p } = o;
46
+ return i.useEffect(() => (c(), () => p()), [c, p]), /* @__PURE__ */ s(w, { ...t, ...a, ref: n });
47
47
  }
48
48
  );
49
49
  y.displayName = N;
50
50
  var S = "PopoverTrigger", D = i.forwardRef(
51
- (e, a) => {
52
- const { __scopePopover: t, ...r } = e, o = l(S, t), n = g(t), c = O(a, o.triggerRef), p = /* @__PURE__ */ s(
51
+ (e, n) => {
52
+ const { __scopePopover: r, ...a } = e, o = l(S, r), t = g(r), c = O(n, o.triggerRef), p = /* @__PURE__ */ s(
53
53
  _.button,
54
54
  {
55
55
  type: "button",
@@ -57,50 +57,50 @@ var S = "PopoverTrigger", D = i.forwardRef(
57
57
  "aria-expanded": o.open,
58
58
  "aria-controls": o.contentId,
59
59
  "data-state": $(o.open),
60
- ...r,
60
+ ...a,
61
61
  ref: c,
62
62
  onClick: P(e.onClick, o.onOpenToggle)
63
63
  }
64
64
  );
65
- return o.hasCustomAnchor ? p : /* @__PURE__ */ s(w, { asChild: !0, ...n, children: p });
65
+ return o.hasCustomAnchor ? p : /* @__PURE__ */ s(w, { asChild: !0, ...t, children: p });
66
66
  }
67
67
  );
68
68
  D.displayName = S;
69
69
  var A = "PopoverPortal", [Y, ee] = E(A, {
70
70
  forceMount: void 0
71
71
  }), M = (e) => {
72
- const { __scopePopover: a, forceMount: t, children: r, container: o } = e, n = l(A, a);
73
- return /* @__PURE__ */ s(Y, { scope: a, forceMount: t, children: /* @__PURE__ */ s(x, { present: t || n.open, children: /* @__PURE__ */ s(H, { asChild: !0, container: o, children: r }) }) });
72
+ const { __scopePopover: n, forceMount: r, children: a, container: o } = e, t = l(A, n);
73
+ return /* @__PURE__ */ s(Y, { scope: n, forceMount: r, children: /* @__PURE__ */ s(x, { present: r || t.open, children: /* @__PURE__ */ s(H, { asChild: !0, container: o, children: a }) }) });
74
74
  };
75
75
  M.displayName = A;
76
76
  var d = "PopoverContent", T = i.forwardRef(
77
- (e, a) => {
78
- const t = ee(d, e.__scopePopover), { forceMount: r = t.forceMount, ...o } = e, n = l(d, e.__scopePopover);
79
- return /* @__PURE__ */ s(x, { present: r || n.open, children: n.modal ? /* @__PURE__ */ s(te, { ...o, ref: a }) : /* @__PURE__ */ s(re, { ...o, ref: a }) });
77
+ (e, n) => {
78
+ const r = ee(d, e.__scopePopover), { forceMount: a = r.forceMount, ...o } = e, t = l(d, e.__scopePopover);
79
+ return /* @__PURE__ */ s(x, { present: a || t.open, children: t.modal ? /* @__PURE__ */ s(te, { ...o, ref: n }) : /* @__PURE__ */ s(re, { ...o, ref: n }) });
80
80
  }
81
81
  );
82
82
  T.displayName = d;
83
83
  var oe = K("PopoverContent.RemoveScroll"), te = i.forwardRef(
84
- (e, a) => {
85
- const t = l(d, e.__scopePopover), r = i.useRef(null), o = O(a, r), n = i.useRef(!1);
84
+ (e, n) => {
85
+ const r = l(d, e.__scopePopover), a = i.useRef(null), o = O(n, a), t = i.useRef(!1);
86
86
  return i.useEffect(() => {
87
- const c = r.current;
87
+ const c = a.current;
88
88
  if (c) return U(c);
89
89
  }, []), /* @__PURE__ */ s(V, { as: oe, allowPinchZoom: !0, children: /* @__PURE__ */ s(
90
90
  k,
91
91
  {
92
92
  ...e,
93
93
  ref: o,
94
- trapFocus: t.open,
94
+ trapFocus: r.open,
95
95
  disableOutsidePointerEvents: !0,
96
96
  onCloseAutoFocus: P(e.onCloseAutoFocus, (c) => {
97
- c.preventDefault(), n.current || t.triggerRef.current?.focus();
97
+ c.preventDefault(), t.current || r.triggerRef.current?.focus();
98
98
  }),
99
99
  onPointerDownOutside: P(
100
100
  e.onPointerDownOutside,
101
101
  (c) => {
102
102
  const p = c.detail.originalEvent, f = p.button === 0 && p.ctrlKey === !0, v = p.button === 2 || f;
103
- n.current = v;
103
+ t.current = v;
104
104
  },
105
105
  { checkForDefaultPrevented: !1 }
106
106
  ),
@@ -113,48 +113,48 @@ var oe = K("PopoverContent.RemoveScroll"), te = i.forwardRef(
113
113
  ) });
114
114
  }
115
115
  ), re = i.forwardRef(
116
- (e, a) => {
117
- const t = l(d, e.__scopePopover), r = i.useRef(!1), o = i.useRef(!1);
116
+ (e, n) => {
117
+ const r = l(d, e.__scopePopover), a = i.useRef(!1), o = i.useRef(!1);
118
118
  return /* @__PURE__ */ s(
119
119
  k,
120
120
  {
121
121
  ...e,
122
- ref: a,
122
+ ref: n,
123
123
  trapFocus: !1,
124
124
  disableOutsidePointerEvents: !1,
125
- onCloseAutoFocus: (n) => {
126
- e.onCloseAutoFocus?.(n), n.defaultPrevented || (r.current || t.triggerRef.current?.focus(), n.preventDefault()), r.current = !1, o.current = !1;
125
+ onCloseAutoFocus: (t) => {
126
+ e.onCloseAutoFocus?.(t), t.defaultPrevented || (a.current || r.triggerRef.current?.focus(), t.preventDefault()), a.current = !1, o.current = !1;
127
127
  },
128
- onInteractOutside: (n) => {
129
- e.onInteractOutside?.(n), n.defaultPrevented || (r.current = !0, n.detail.originalEvent.type === "pointerdown" && (o.current = !0));
130
- const c = n.target;
131
- t.triggerRef.current?.contains(c) && n.preventDefault(), n.detail.originalEvent.type === "focusin" && o.current && n.preventDefault();
128
+ onInteractOutside: (t) => {
129
+ e.onInteractOutside?.(t), t.defaultPrevented || (a.current = !0, t.detail.originalEvent.type === "pointerdown" && (o.current = !0));
130
+ const c = t.target;
131
+ r.triggerRef.current?.contains(c) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && o.current && t.preventDefault();
132
132
  }
133
133
  }
134
134
  );
135
135
  }
136
136
  ), k = i.forwardRef(
137
- (e, a) => {
137
+ (e, n) => {
138
138
  const {
139
- __scopePopover: t,
140
- trapFocus: r,
139
+ __scopePopover: r,
140
+ trapFocus: a,
141
141
  onOpenAutoFocus: o,
142
- onCloseAutoFocus: n,
142
+ onCloseAutoFocus: t,
143
143
  disableOutsidePointerEvents: c,
144
144
  onEscapeKeyDown: p,
145
145
  onPointerDownOutside: f,
146
146
  onFocusOutside: v,
147
147
  onInteractOutside: h,
148
148
  ...m
149
- } = e, u = l(d, t), R = g(t);
149
+ } = e, u = l(d, r), R = g(r);
150
150
  return W(), /* @__PURE__ */ s(
151
151
  Z,
152
152
  {
153
153
  asChild: !0,
154
154
  loop: !0,
155
- trapped: r,
155
+ trapped: a,
156
156
  onMountAutoFocus: o,
157
- onUnmountAutoFocus: n,
157
+ onUnmountAutoFocus: t,
158
158
  children: /* @__PURE__ */ s(
159
159
  j,
160
160
  {
@@ -173,7 +173,7 @@ var oe = K("PopoverContent.RemoveScroll"), te = i.forwardRef(
173
173
  id: u.contentId,
174
174
  ...R,
175
175
  ...m,
176
- ref: a,
176
+ ref: n,
177
177
  style: {
178
178
  ...m.style,
179
179
  "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
@@ -190,14 +190,14 @@ var oe = K("PopoverContent.RemoveScroll"), te = i.forwardRef(
190
190
  );
191
191
  }
192
192
  ), I = "PopoverClose", ne = i.forwardRef(
193
- (e, a) => {
194
- const { __scopePopover: t, ...r } = e, o = l(I, t);
193
+ (e, n) => {
194
+ const { __scopePopover: r, ...a } = e, o = l(I, r);
195
195
  return /* @__PURE__ */ s(
196
196
  _.button,
197
197
  {
198
198
  type: "button",
199
- ...r,
200
- ref: a,
199
+ ...a,
200
+ ref: n,
201
201
  onClick: P(e.onClick, () => o.onOpenChange(!1))
202
202
  }
203
203
  );
@@ -205,9 +205,9 @@ var oe = K("PopoverContent.RemoveScroll"), te = i.forwardRef(
205
205
  );
206
206
  ne.displayName = I;
207
207
  var ae = "PopoverArrow", se = i.forwardRef(
208
- (e, a) => {
209
- const { __scopePopover: t, ...r } = e, o = g(t);
210
- return /* @__PURE__ */ s(J, { ...o, ...r, ref: a });
208
+ (e, n) => {
209
+ const { __scopePopover: r, ...a } = e, o = g(r);
210
+ return /* @__PURE__ */ s(J, { ...o, ...a, ref: n });
211
211
  }
212
212
  );
213
213
  se.displayName = ae;
@@ -223,17 +223,19 @@ function Ce({ ...e }) {
223
223
  }
224
224
  function Re({
225
225
  className: e,
226
- align: a = "center",
227
- sideOffset: t = 4,
228
- width: r = "w-fit",
229
- ...o
226
+ align: n = "center",
227
+ side: r = "bottom",
228
+ sideOffset: a = 4,
229
+ width: o = "w-fit",
230
+ ...t
230
231
  }) {
231
232
  return /* @__PURE__ */ s(le, { children: /* @__PURE__ */ s(
232
233
  ue,
233
234
  {
234
235
  "data-slot": "popover-content",
235
- align: a,
236
- sideOffset: t,
236
+ align: n,
237
+ side: r,
238
+ sideOffset: a,
237
239
  className: Q(
238
240
  "bg-popover-bg text-popover-text data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
239
241
  "data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2",
@@ -243,9 +245,9 @@ function Re({
243
245
  e
244
246
  ),
245
247
  style: {
246
- "--popover-width": typeof r == "number" ? `${r}px` : r === "w-fit" ? "320px" : r
248
+ "--popover-width": typeof o == "number" ? `${o}px` : o === "w-fit" ? "320px" : o
247
249
  },
248
- ...o
250
+ ...t
249
251
  }
250
252
  ) });
251
253
  }