@openwarelabs/ui 0.9.0 → 0.10.1
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.
- package/README.md +12 -4
- package/dist/components/Avatar/Avatar.d.cts +2 -13
- package/dist/components/Avatar/Avatar.d.ts +2 -13
- package/dist/components/Avatar/Avatar.types.d.cts +13 -0
- package/dist/components/Avatar/Avatar.types.d.ts +13 -0
- package/dist/components/Calendar/DatePicker.d.cts +2 -19
- package/dist/components/Calendar/DatePicker.d.ts +2 -19
- package/dist/components/Calendar/DatePicker.types.d.cts +19 -0
- package/dist/components/Calendar/DatePicker.types.d.ts +19 -0
- package/dist/components/Calendar/DateRangePicker.d.cts +2 -34
- package/dist/components/Calendar/DateRangePicker.d.ts +2 -34
- package/dist/components/Calendar/DateRangePicker.types.d.cts +34 -0
- package/dist/components/Calendar/DateRangePicker.types.d.ts +34 -0
- package/dist/components/ColorPicker/ColorPicker.d.cts +2 -55
- package/dist/components/ColorPicker/ColorPicker.d.ts +2 -55
- package/dist/components/ColorPicker/ColorPicker.types.d.cts +54 -0
- package/dist/components/ColorPicker/ColorPicker.types.d.ts +54 -0
- package/dist/components/ListBox/ListBox.d.cts +3 -61
- package/dist/components/ListBox/ListBox.d.ts +3 -61
- package/dist/components/ListBox/ListBox.types.d.cts +61 -0
- package/dist/components/ListBox/ListBox.types.d.ts +61 -0
- package/dist/components/Prose/Prose.d.cts +2 -16
- package/dist/components/Prose/Prose.d.ts +2 -16
- package/dist/components/Prose/Prose.types.d.cts +16 -0
- package/dist/components/Prose/Prose.types.d.ts +16 -0
- package/dist/components.css +16 -0
- package/dist/index.cjs +110 -98
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +179 -167
- package/dist/index.js.map +3 -3
- package/dist/openware-ui.iife.js +6 -6
- package/dist/styles.css +16 -0
- package/package.json +19 -5
package/dist/index.js
CHANGED
|
@@ -97,7 +97,7 @@ function buttonClassName({
|
|
|
97
97
|
iconOnly && "ow-button--icon-only"
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
|
-
var Button = forwardRef(function Button2({
|
|
100
|
+
var Button = /* @__PURE__ */ forwardRef(function Button2({
|
|
101
101
|
children,
|
|
102
102
|
className,
|
|
103
103
|
disabled,
|
|
@@ -189,33 +189,33 @@ function icon(paths) {
|
|
|
189
189
|
);
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
var CheckIcon = icon(/* @__PURE__ */ jsx4("path", { d: "M20 6 9 17l-5-5" }));
|
|
193
|
-
var ChevronDownIcon = icon(/* @__PURE__ */ jsx4("path", { d: "m6 9 6 6 6-6" }));
|
|
194
|
-
var SearchIcon = icon(
|
|
192
|
+
var CheckIcon = /* @__PURE__ */ icon(/* @__PURE__ */ jsx4("path", { d: "M20 6 9 17l-5-5" }));
|
|
193
|
+
var ChevronDownIcon = /* @__PURE__ */ icon(/* @__PURE__ */ jsx4("path", { d: "m6 9 6 6 6-6" }));
|
|
194
|
+
var SearchIcon = /* @__PURE__ */ icon(
|
|
195
195
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
196
196
|
/* @__PURE__ */ jsx4("circle", { cx: "11", cy: "11", r: "8" }),
|
|
197
197
|
/* @__PURE__ */ jsx4("path", { d: "m21 21-4.3-4.3" })
|
|
198
198
|
] })
|
|
199
199
|
);
|
|
200
|
-
var CornerDownLeftIcon = icon(
|
|
200
|
+
var CornerDownLeftIcon = /* @__PURE__ */ icon(
|
|
201
201
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
202
202
|
/* @__PURE__ */ jsx4("polyline", { points: "9 10 4 15 9 20" }),
|
|
203
203
|
/* @__PURE__ */ jsx4("path", { d: "M20 4v7a4 4 0 0 1-4 4H4" })
|
|
204
204
|
] })
|
|
205
205
|
);
|
|
206
|
-
var XIcon = icon(
|
|
206
|
+
var XIcon = /* @__PURE__ */ icon(
|
|
207
207
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
208
208
|
/* @__PURE__ */ jsx4("path", { d: "M18 6 6 18" }),
|
|
209
209
|
/* @__PURE__ */ jsx4("path", { d: "m6 6 12 12" })
|
|
210
210
|
] })
|
|
211
211
|
);
|
|
212
|
-
var UserIcon = icon(
|
|
212
|
+
var UserIcon = /* @__PURE__ */ icon(
|
|
213
213
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
214
214
|
/* @__PURE__ */ jsx4("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
215
215
|
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "7", r: "4" })
|
|
216
216
|
] })
|
|
217
217
|
);
|
|
218
|
-
var TrashIcon = icon(
|
|
218
|
+
var TrashIcon = /* @__PURE__ */ icon(
|
|
219
219
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
220
220
|
/* @__PURE__ */ jsx4("path", { d: "M3 6h18" }),
|
|
221
221
|
/* @__PURE__ */ jsx4("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
@@ -224,57 +224,56 @@ var TrashIcon = icon(
|
|
|
224
224
|
/* @__PURE__ */ jsx4("line", { x1: "14", x2: "14", y1: "11", y2: "17" })
|
|
225
225
|
] })
|
|
226
226
|
);
|
|
227
|
-
var CircleCheckIcon = icon(
|
|
227
|
+
var CircleCheckIcon = /* @__PURE__ */ icon(
|
|
228
228
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
229
229
|
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10" }),
|
|
230
230
|
/* @__PURE__ */ jsx4("path", { d: "m9 12 2 2 4-4" })
|
|
231
231
|
] })
|
|
232
232
|
);
|
|
233
|
-
var CircleAlertIcon = icon(
|
|
233
|
+
var CircleAlertIcon = /* @__PURE__ */ icon(
|
|
234
234
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
235
235
|
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10" }),
|
|
236
236
|
/* @__PURE__ */ jsx4("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
|
|
237
237
|
/* @__PURE__ */ jsx4("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
|
|
238
238
|
] })
|
|
239
239
|
);
|
|
240
|
-
var ChevronRightIcon = icon(/* @__PURE__ */ jsx4("path", { d: "m9 18 6-6-6-6" }));
|
|
241
|
-
var ChevronLeftIcon = icon(/* @__PURE__ */ jsx4("path", { d: "m15 18-6-6 6-6" }));
|
|
242
|
-
var
|
|
243
|
-
var
|
|
244
|
-
var PlusIcon = icon(
|
|
240
|
+
var ChevronRightIcon = /* @__PURE__ */ icon(/* @__PURE__ */ jsx4("path", { d: "m9 18 6-6-6-6" }));
|
|
241
|
+
var ChevronLeftIcon = /* @__PURE__ */ icon(/* @__PURE__ */ jsx4("path", { d: "m15 18-6-6 6-6" }));
|
|
242
|
+
var MinusIcon = /* @__PURE__ */ icon(/* @__PURE__ */ jsx4("path", { d: "M5 12h14" }));
|
|
243
|
+
var PlusIcon = /* @__PURE__ */ icon(
|
|
245
244
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
246
245
|
/* @__PURE__ */ jsx4("path", { d: "M5 12h14" }),
|
|
247
246
|
/* @__PURE__ */ jsx4("path", { d: "M12 5v14" })
|
|
248
247
|
] })
|
|
249
248
|
);
|
|
250
|
-
var InfoIcon = icon(
|
|
249
|
+
var InfoIcon = /* @__PURE__ */ icon(
|
|
251
250
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
252
251
|
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10" }),
|
|
253
252
|
/* @__PURE__ */ jsx4("path", { d: "M12 16v-4" }),
|
|
254
253
|
/* @__PURE__ */ jsx4("path", { d: "M12 8h.01" })
|
|
255
254
|
] })
|
|
256
255
|
);
|
|
257
|
-
var TriangleAlertIcon = icon(
|
|
256
|
+
var TriangleAlertIcon = /* @__PURE__ */ icon(
|
|
258
257
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
259
258
|
/* @__PURE__ */ jsx4("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
260
259
|
/* @__PURE__ */ jsx4("path", { d: "M12 9v4" }),
|
|
261
260
|
/* @__PURE__ */ jsx4("path", { d: "M12 17h.01" })
|
|
262
261
|
] })
|
|
263
262
|
);
|
|
264
|
-
var PipetteIcon = icon(
|
|
263
|
+
var PipetteIcon = /* @__PURE__ */ icon(
|
|
265
264
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
266
265
|
/* @__PURE__ */ jsx4("path", { d: "m2 22 1-1h3l9-9" }),
|
|
267
266
|
/* @__PURE__ */ jsx4("path", { d: "M3 21v-3l9-9" }),
|
|
268
267
|
/* @__PURE__ */ jsx4("path", { d: "m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" })
|
|
269
268
|
] })
|
|
270
269
|
);
|
|
271
|
-
var CopyIcon = icon(
|
|
270
|
+
var CopyIcon = /* @__PURE__ */ icon(
|
|
272
271
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
273
272
|
/* @__PURE__ */ jsx4("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
|
|
274
273
|
/* @__PURE__ */ jsx4("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
|
|
275
274
|
] })
|
|
276
275
|
);
|
|
277
|
-
var CalendarIcon = icon(
|
|
276
|
+
var CalendarIcon = /* @__PURE__ */ icon(
|
|
278
277
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
279
278
|
/* @__PURE__ */ jsx4("path", { d: "M8 2v4" }),
|
|
280
279
|
/* @__PURE__ */ jsx4("path", { d: "M16 2v4" }),
|
|
@@ -282,62 +281,55 @@ var CalendarIcon = icon(
|
|
|
282
281
|
/* @__PURE__ */ jsx4("path", { d: "M3 10h18" })
|
|
283
282
|
] })
|
|
284
283
|
);
|
|
285
|
-
var FileIcon = icon(
|
|
284
|
+
var FileIcon = /* @__PURE__ */ icon(
|
|
286
285
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
287
286
|
/* @__PURE__ */ jsx4("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
288
287
|
/* @__PURE__ */ jsx4("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })
|
|
289
288
|
] })
|
|
290
289
|
);
|
|
291
|
-
var FolderIcon = icon(
|
|
290
|
+
var FolderIcon = /* @__PURE__ */ icon(
|
|
292
291
|
/* @__PURE__ */ jsx4("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" })
|
|
293
292
|
);
|
|
294
|
-
var FolderOpenIcon = icon(
|
|
293
|
+
var FolderOpenIcon = /* @__PURE__ */ icon(
|
|
295
294
|
/* @__PURE__ */ jsx4("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" })
|
|
296
295
|
);
|
|
297
|
-
var UploadIcon = icon(
|
|
296
|
+
var UploadIcon = /* @__PURE__ */ icon(
|
|
298
297
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
299
298
|
/* @__PURE__ */ jsx4("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
300
299
|
/* @__PURE__ */ jsx4("polyline", { points: "17 8 12 3 7 8" }),
|
|
301
300
|
/* @__PURE__ */ jsx4("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
|
|
302
301
|
] })
|
|
303
302
|
);
|
|
304
|
-
var ArrowUpRightIcon = icon(
|
|
303
|
+
var ArrowUpRightIcon = /* @__PURE__ */ icon(
|
|
305
304
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
306
305
|
/* @__PURE__ */ jsx4("path", { d: "M7 7h10v10" }),
|
|
307
306
|
/* @__PURE__ */ jsx4("path", { d: "M7 17 17 7" })
|
|
308
307
|
] })
|
|
309
308
|
);
|
|
310
|
-
var ArrowUpIcon = icon(
|
|
309
|
+
var ArrowUpIcon = /* @__PURE__ */ icon(
|
|
311
310
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
312
311
|
/* @__PURE__ */ jsx4("path", { d: "m5 12 7-7 7 7" }),
|
|
313
312
|
/* @__PURE__ */ jsx4("path", { d: "M12 19V5" })
|
|
314
313
|
] })
|
|
315
314
|
);
|
|
316
|
-
var ArrowDownIcon = icon(
|
|
315
|
+
var ArrowDownIcon = /* @__PURE__ */ icon(
|
|
317
316
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
318
317
|
/* @__PURE__ */ jsx4("path", { d: "M12 5v14" }),
|
|
319
318
|
/* @__PURE__ */ jsx4("path", { d: "m19 12-7 7-7-7" })
|
|
320
319
|
] })
|
|
321
320
|
);
|
|
322
|
-
var ChevronsUpDownIcon = icon(
|
|
321
|
+
var ChevronsUpDownIcon = /* @__PURE__ */ icon(
|
|
323
322
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
324
323
|
/* @__PURE__ */ jsx4("path", { d: "m7 15 5 5 5-5" }),
|
|
325
324
|
/* @__PURE__ */ jsx4("path", { d: "m7 9 5-5 5 5" })
|
|
326
325
|
] })
|
|
327
326
|
);
|
|
328
|
-
var InboxIcon = icon(
|
|
327
|
+
var InboxIcon = /* @__PURE__ */ icon(
|
|
329
328
|
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
330
329
|
/* @__PURE__ */ jsx4("polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12" }),
|
|
331
330
|
/* @__PURE__ */ jsx4("path", { d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
|
|
332
331
|
] })
|
|
333
332
|
);
|
|
334
|
-
var EllipsisIcon = icon(
|
|
335
|
-
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
336
|
-
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "1" }),
|
|
337
|
-
/* @__PURE__ */ jsx4("circle", { cx: "19", cy: "12", r: "1" }),
|
|
338
|
-
/* @__PURE__ */ jsx4("circle", { cx: "5", cy: "12", r: "1" })
|
|
339
|
-
] })
|
|
340
|
-
);
|
|
341
333
|
|
|
342
334
|
// src/components/Button/ButtonGroup.tsx
|
|
343
335
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
@@ -356,7 +348,7 @@ function ButtonGroup({ attached = true, orientation = "horizontal", className, .
|
|
|
356
348
|
}
|
|
357
349
|
);
|
|
358
350
|
}
|
|
359
|
-
var CloseButton = forwardRef2(function CloseButton2({ size: size2 = "md", label = "Close", className, type = "button", ...buttonProps }, ref) {
|
|
351
|
+
var CloseButton = /* @__PURE__ */ forwardRef2(function CloseButton2({ size: size2 = "md", label = "Close", className, type = "button", ...buttonProps }, ref) {
|
|
360
352
|
return /* @__PURE__ */ jsx5(
|
|
361
353
|
"button",
|
|
362
354
|
{
|
|
@@ -369,7 +361,7 @@ var CloseButton = forwardRef2(function CloseButton2({ size: size2 = "md", label
|
|
|
369
361
|
}
|
|
370
362
|
);
|
|
371
363
|
});
|
|
372
|
-
var ToggleButton = forwardRef2(function ToggleButton2({ pressed, defaultPressed = false, onPressedChange, onClick, className, variant = "secondary", ...buttonProps }, ref) {
|
|
364
|
+
var ToggleButton = /* @__PURE__ */ forwardRef2(function ToggleButton2({ pressed, defaultPressed = false, onPressedChange, onClick, className, variant = "secondary", ...buttonProps }, ref) {
|
|
373
365
|
const [isPressed, setPressed] = useControllableState(pressed, defaultPressed, onPressedChange);
|
|
374
366
|
return /* @__PURE__ */ jsx5(
|
|
375
367
|
Button,
|
|
@@ -502,7 +494,7 @@ function SegmentedControl({
|
|
|
502
494
|
// src/components/ChoiceCard/ChoiceCard.tsx
|
|
503
495
|
import { forwardRef as forwardRef3 } from "react";
|
|
504
496
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
505
|
-
var ChoiceCard = forwardRef3(function ChoiceCard2({ className, description, icon: icon2, recommended = false, shortcut, title, type = "button", ...buttonProps }, ref) {
|
|
497
|
+
var ChoiceCard = /* @__PURE__ */ forwardRef3(function ChoiceCard2({ className, description, icon: icon2, recommended = false, shortcut, title, type = "button", ...buttonProps }, ref) {
|
|
506
498
|
return /* @__PURE__ */ jsxs4(
|
|
507
499
|
"button",
|
|
508
500
|
{
|
|
@@ -629,7 +621,7 @@ import {
|
|
|
629
621
|
useRef as useRef4
|
|
630
622
|
} from "react";
|
|
631
623
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
632
|
-
var ToolbarContext = createContext(null);
|
|
624
|
+
var ToolbarContext = /* @__PURE__ */ createContext(null);
|
|
633
625
|
var candidates = 'button, a[href], input:not([type="hidden"]), select, textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"], [tabindex]';
|
|
634
626
|
var textTypes = ["text", "search", "url", "tel", "password", "email"];
|
|
635
627
|
var pressTypes = ["button", "checkbox", "submit", "reset", "image", "file", "color"];
|
|
@@ -661,7 +653,7 @@ function keepsKey(element, key, forward) {
|
|
|
661
653
|
if (selectionStart === null || selectionEnd === null || selectionStart !== selectionEnd) return true;
|
|
662
654
|
return forward ? selectionEnd < value.length : selectionStart > 0;
|
|
663
655
|
}
|
|
664
|
-
var Toolbar = forwardRef4(function Toolbar2({ orientation = "horizontal", variant = "raised", size: size2 = "md", className, children, onKeyDown, onFocus, ...props }, forwardedRef) {
|
|
656
|
+
var Toolbar = /* @__PURE__ */ forwardRef4(function Toolbar2({ orientation = "horizontal", variant = "raised", size: size2 = "md", className, children, onKeyDown, onFocus, ...props }, forwardedRef) {
|
|
665
657
|
const rootRef = useRef4(null);
|
|
666
658
|
const activeRef = useRef4(null);
|
|
667
659
|
const activeIndex = useRef4(0);
|
|
@@ -1071,12 +1063,12 @@ import {
|
|
|
1071
1063
|
useRef as useRef7
|
|
1072
1064
|
} from "react";
|
|
1073
1065
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1074
|
-
var CheckboxGroupContext = createContext2(null);
|
|
1066
|
+
var CheckboxGroupContext = /* @__PURE__ */ createContext2(null);
|
|
1075
1067
|
function assignRef(ref, value) {
|
|
1076
1068
|
if (typeof ref === "function") ref(value);
|
|
1077
1069
|
else if (ref) ref.current = value;
|
|
1078
1070
|
}
|
|
1079
|
-
var Checkbox = forwardRef5(function Checkbox2({
|
|
1071
|
+
var Checkbox = /* @__PURE__ */ forwardRef5(function Checkbox2({
|
|
1080
1072
|
className,
|
|
1081
1073
|
size: size2 = "md",
|
|
1082
1074
|
tone = "primary",
|
|
@@ -1256,7 +1248,7 @@ function Alert({
|
|
|
1256
1248
|
|
|
1257
1249
|
// src/components/Form/Form.tsx
|
|
1258
1250
|
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1259
|
-
var FormContext = createContext3(null);
|
|
1251
|
+
var FormContext = /* @__PURE__ */ createContext3(null);
|
|
1260
1252
|
var checks = [
|
|
1261
1253
|
"valueMissing",
|
|
1262
1254
|
"typeMismatch",
|
|
@@ -1301,7 +1293,7 @@ function sameErrors(a, b) {
|
|
|
1301
1293
|
const keys = Object.keys(a);
|
|
1302
1294
|
return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);
|
|
1303
1295
|
}
|
|
1304
|
-
var Form = forwardRef6(function Form2({ onSubmit, validate, validationErrors, children, className, onChange, onBlur, onReset, ...formProps }, ref) {
|
|
1296
|
+
var Form = /* @__PURE__ */ forwardRef6(function Form2({ onSubmit, validate, validationErrors, children, className, onChange, onBlur, onReset, ...formProps }, ref) {
|
|
1305
1297
|
const formRef = useRef8(null);
|
|
1306
1298
|
const fields = useRef8(/* @__PURE__ */ new Set());
|
|
1307
1299
|
const [local, setLocal] = useState7({});
|
|
@@ -1582,7 +1574,7 @@ function Field({ label, children, hint, error, name: nameProp, errorMessages, cl
|
|
|
1582
1574
|
// src/components/Input/Input.tsx
|
|
1583
1575
|
import { forwardRef as forwardRef7 } from "react";
|
|
1584
1576
|
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1585
|
-
var Input = forwardRef7(function Input2({ className, isInvalid = false, size: size2 = "md", startContent, endContent, ...inputProps }, ref) {
|
|
1577
|
+
var Input = /* @__PURE__ */ forwardRef7(function Input2({ className, isInvalid = false, size: size2 = "md", startContent, endContent, ...inputProps }, ref) {
|
|
1586
1578
|
const invalid = isInvalid || void 0;
|
|
1587
1579
|
if (startContent === void 0 && endContent === void 0) {
|
|
1588
1580
|
return /* @__PURE__ */ jsx16(
|
|
@@ -1621,7 +1613,7 @@ function assignRef2(ref, value) {
|
|
|
1621
1613
|
if (typeof ref === "function") ref(value);
|
|
1622
1614
|
else if (ref) ref.current = value;
|
|
1623
1615
|
}
|
|
1624
|
-
var SearchField = forwardRef8(function SearchField2({
|
|
1616
|
+
var SearchField = /* @__PURE__ */ forwardRef8(function SearchField2({
|
|
1625
1617
|
value,
|
|
1626
1618
|
defaultValue = "",
|
|
1627
1619
|
onChange,
|
|
@@ -1681,7 +1673,7 @@ var SearchField = forwardRef8(function SearchField2({
|
|
|
1681
1673
|
import { forwardRef as forwardRef9, useState as useState9 } from "react";
|
|
1682
1674
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1683
1675
|
var decimals = (step) => (String(step).split(".")[1] ?? "").length;
|
|
1684
|
-
var NumberField = forwardRef9(function NumberField2({
|
|
1676
|
+
var NumberField = /* @__PURE__ */ forwardRef9(function NumberField2({
|
|
1685
1677
|
value,
|
|
1686
1678
|
defaultValue = null,
|
|
1687
1679
|
onChange,
|
|
@@ -2392,7 +2384,7 @@ function dateLayout(locale) {
|
|
|
2392
2384
|
}
|
|
2393
2385
|
return layout;
|
|
2394
2386
|
}
|
|
2395
|
-
var DateField = forwardRef10(function DateField2({
|
|
2387
|
+
var DateField = /* @__PURE__ */ forwardRef10(function DateField2({
|
|
2396
2388
|
value,
|
|
2397
2389
|
defaultValue = "",
|
|
2398
2390
|
onChange,
|
|
@@ -2555,7 +2547,7 @@ function timeLayout(locale, twelve, seconds) {
|
|
|
2555
2547
|
if (twelve && !layout.some((part) => part.type === "dayPeriod")) layout.push({ type: "literal", text: " " }, { type: "dayPeriod" });
|
|
2556
2548
|
return { layout, am: periodOf(1) ?? "AM", pm: periodOf(13) ?? "PM" };
|
|
2557
2549
|
}
|
|
2558
|
-
var TimeField = forwardRef11(function TimeField2({
|
|
2550
|
+
var TimeField = /* @__PURE__ */ forwardRef11(function TimeField2({
|
|
2559
2551
|
value,
|
|
2560
2552
|
defaultValue = "",
|
|
2561
2553
|
onChange,
|
|
@@ -2742,7 +2734,7 @@ function assignRef3(ref, element) {
|
|
|
2742
2734
|
if (typeof ref === "function") ref(element);
|
|
2743
2735
|
else if (ref) ref.current = element;
|
|
2744
2736
|
}
|
|
2745
|
-
var Textarea = forwardRef12(function Textarea2({
|
|
2737
|
+
var Textarea = /* @__PURE__ */ forwardRef12(function Textarea2({
|
|
2746
2738
|
autoGrow = false,
|
|
2747
2739
|
autoGrowMaxHeight = defaultAutoGrowMaxHeight,
|
|
2748
2740
|
bare = false,
|
|
@@ -3311,7 +3303,7 @@ function ListBoxWithRef({
|
|
|
3311
3303
|
);
|
|
3312
3304
|
};
|
|
3313
3305
|
const isEmpty = flat.length === 0;
|
|
3314
|
-
const describedBy =
|
|
3306
|
+
const describedBy = ariaDescribedBy;
|
|
3315
3307
|
return /* @__PURE__ */ jsxs16(
|
|
3316
3308
|
"div",
|
|
3317
3309
|
{
|
|
@@ -3354,13 +3346,15 @@ function ListBoxWithRef({
|
|
|
3354
3346
|
item.options.map(renderOption)
|
|
3355
3347
|
] }, `group-${item.label}-${groupIndex}`) : renderOption(item)
|
|
3356
3348
|
),
|
|
3357
|
-
isEmpty ?
|
|
3349
|
+
isEmpty ? (
|
|
3350
|
+
// A listbox holds options, so an empty one says so with one that can't be chosen.
|
|
3351
|
+
/* @__PURE__ */ jsx25("div", { id: emptyId, className: "ow-listbox__empty", role: "option", "aria-disabled": "true", "aria-selected": "false", children: emptyMessage })
|
|
3352
|
+
) : null
|
|
3358
3353
|
]
|
|
3359
3354
|
}
|
|
3360
3355
|
);
|
|
3361
3356
|
}
|
|
3362
|
-
var ForwardedListBox = forwardRef13(ListBoxWithRef);
|
|
3363
|
-
ForwardedListBox.displayName = "ListBox";
|
|
3357
|
+
var ForwardedListBox = /* @__PURE__ */ Object.assign(/* @__PURE__ */ forwardRef13(ListBoxWithRef), { displayName: "ListBox" });
|
|
3364
3358
|
var ListBox = ForwardedListBox;
|
|
3365
3359
|
|
|
3366
3360
|
// src/components/Combobox/Combobox.tsx
|
|
@@ -3377,7 +3371,7 @@ function assignRef4(ref, value) {
|
|
|
3377
3371
|
if (typeof ref === "function") ref(value);
|
|
3378
3372
|
else if (ref) ref.current = value;
|
|
3379
3373
|
}
|
|
3380
|
-
var Combobox = forwardRef14(function Combobox2({
|
|
3374
|
+
var Combobox = /* @__PURE__ */ forwardRef14(function Combobox2({
|
|
3381
3375
|
options,
|
|
3382
3376
|
value,
|
|
3383
3377
|
defaultValue = "",
|
|
@@ -3603,7 +3597,7 @@ var Combobox = forwardRef14(function Combobox2({
|
|
|
3603
3597
|
// src/components/RadioGroup/RadioGroup.tsx
|
|
3604
3598
|
import { createContext as createContext4, useContext as useContext6, useId as useId6 } from "react";
|
|
3605
3599
|
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3606
|
-
var RadioGroupContext = createContext4(null);
|
|
3600
|
+
var RadioGroupContext = /* @__PURE__ */ createContext4(null);
|
|
3607
3601
|
function RadioGroup({
|
|
3608
3602
|
label,
|
|
3609
3603
|
description,
|
|
@@ -3666,7 +3660,7 @@ function Radio({ value, children, description, disabled, className, ...inputProp
|
|
|
3666
3660
|
// src/components/Switch/Switch.tsx
|
|
3667
3661
|
import { forwardRef as forwardRef15 } from "react";
|
|
3668
3662
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3669
|
-
var Switch = forwardRef15(function Switch2({ checked, onChange, label, className, disabled, ...buttonProps }, ref) {
|
|
3663
|
+
var Switch = /* @__PURE__ */ forwardRef15(function Switch2({ checked, onChange, label, className, disabled, ...buttonProps }, ref) {
|
|
3670
3664
|
return /* @__PURE__ */ jsx28(
|
|
3671
3665
|
"button",
|
|
3672
3666
|
{
|
|
@@ -3886,7 +3880,7 @@ function FileDropZone({
|
|
|
3886
3880
|
// src/components/Calendar/Calendar.tsx
|
|
3887
3881
|
import { forwardRef as forwardRef16, useEffect as useEffect14, useImperativeHandle, useMemo as useMemo8, useRef as useRef20, useState as useState17 } from "react";
|
|
3888
3882
|
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3889
|
-
var Calendar = forwardRef16(function Calendar2({ value, defaultValue = "", onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, autoFocus = false, className }, ref) {
|
|
3883
|
+
var Calendar = /* @__PURE__ */ forwardRef16(function Calendar2({ value, defaultValue = "", onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, autoFocus = false, className }, ref) {
|
|
3890
3884
|
const [selected, setSelected] = useControllableState(value, defaultValue, onChange);
|
|
3891
3885
|
const today = todayISO();
|
|
3892
3886
|
const [focused, setFocused] = useState17(() => selected || clampDate(today, min, max));
|
|
@@ -4080,7 +4074,7 @@ function assignRef5(ref, value) {
|
|
|
4080
4074
|
if (typeof ref === "function") ref(value);
|
|
4081
4075
|
else if (ref) ref.current = value;
|
|
4082
4076
|
}
|
|
4083
|
-
var DatePicker = forwardRef17(function DatePicker2({
|
|
4077
|
+
var DatePicker = /* @__PURE__ */ forwardRef17(function DatePicker2({
|
|
4084
4078
|
value,
|
|
4085
4079
|
defaultValue = "",
|
|
4086
4080
|
onChange,
|
|
@@ -4123,9 +4117,9 @@ var DatePicker = forwardRef17(function DatePicker2({
|
|
|
4123
4117
|
"aria-haspopup": "dialog",
|
|
4124
4118
|
"aria-expanded": isOpen,
|
|
4125
4119
|
"aria-controls": isOpen ? panelId : void 0,
|
|
4126
|
-
"aria-label": ariaLabel,
|
|
4127
|
-
"aria-labelledby": ariaLabelledBy,
|
|
4128
|
-
"aria-describedby":
|
|
4120
|
+
"aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : void 0,
|
|
4121
|
+
"aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
|
|
4122
|
+
"aria-describedby": ariaDescribedBy,
|
|
4129
4123
|
"aria-invalid": isInvalid || void 0,
|
|
4130
4124
|
disabled,
|
|
4131
4125
|
className: cx(
|
|
@@ -4180,7 +4174,7 @@ var DatePicker = forwardRef17(function DatePicker2({
|
|
|
4180
4174
|
// src/components/Calendar/RangeCalendar.tsx
|
|
4181
4175
|
import { forwardRef as forwardRef18, useEffect as useEffect15, useId as useId10, useImperativeHandle as useImperativeHandle2, useRef as useRef22, useState as useState19 } from "react";
|
|
4182
4176
|
import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4183
|
-
var RangeCalendar = forwardRef18(function RangeCalendar2({ value, defaultValue = null, onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, visibleMonths = 1, autoFocus = false, className }, ref) {
|
|
4177
|
+
var RangeCalendar = /* @__PURE__ */ forwardRef18(function RangeCalendar2({ value, defaultValue = null, onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, visibleMonths = 1, autoFocus = false, className }, ref) {
|
|
4184
4178
|
const months = visibleMonths;
|
|
4185
4179
|
const [range, setRange] = useControllableState(value, defaultValue, onChange);
|
|
4186
4180
|
const today = todayISO();
|
|
@@ -4363,7 +4357,7 @@ function useMediaQuery(query) {
|
|
|
4363
4357
|
}, [query]);
|
|
4364
4358
|
return matches2;
|
|
4365
4359
|
}
|
|
4366
|
-
var DateRangePicker = forwardRef19(function DateRangePicker2({
|
|
4360
|
+
var DateRangePicker = /* @__PURE__ */ forwardRef19(function DateRangePicker2({
|
|
4367
4361
|
value,
|
|
4368
4362
|
defaultValue = null,
|
|
4369
4363
|
onChange,
|
|
@@ -4428,9 +4422,9 @@ var DateRangePicker = forwardRef19(function DateRangePicker2({
|
|
|
4428
4422
|
"aria-haspopup": "dialog",
|
|
4429
4423
|
"aria-expanded": isOpen,
|
|
4430
4424
|
"aria-controls": isOpen ? panelId : void 0,
|
|
4431
|
-
"aria-label": ariaLabel,
|
|
4432
|
-
"aria-labelledby": ariaLabelledBy,
|
|
4433
|
-
"aria-describedby":
|
|
4425
|
+
"aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : void 0,
|
|
4426
|
+
"aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
|
|
4427
|
+
"aria-describedby": ariaDescribedBy,
|
|
4434
4428
|
"aria-invalid": isInvalid || void 0,
|
|
4435
4429
|
disabled,
|
|
4436
4430
|
className: cx("ow-select", "ow-date-range-picker__trigger", `ow-select--${size2}`, {
|
|
@@ -5172,7 +5166,7 @@ function useMenuKeyboard({
|
|
|
5172
5166
|
|
|
5173
5167
|
// src/components/Menu/Menu.tsx
|
|
5174
5168
|
import { jsx as jsx43, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5175
|
-
var MenuContext = createContext5(null);
|
|
5169
|
+
var MenuContext = /* @__PURE__ */ createContext5(null);
|
|
5176
5170
|
function Menu({ trigger, children, label, align = "start", above = false, width, defaultOpen = false, className }) {
|
|
5177
5171
|
const [open, setOpen] = useState24(defaultOpen);
|
|
5178
5172
|
const rootRef = useRef27(null);
|
|
@@ -5239,7 +5233,7 @@ function Menu({ trigger, children, label, align = "start", above = false, width,
|
|
|
5239
5233
|
) : null
|
|
5240
5234
|
] });
|
|
5241
5235
|
}
|
|
5242
|
-
var MenuItem = forwardRef20(function MenuItem2({ icon: icon2, onSelect, destructive = false, shortcut, className, children, onClick, ...buttonProps }, ref) {
|
|
5236
|
+
var MenuItem = /* @__PURE__ */ forwardRef20(function MenuItem2({ icon: icon2, onSelect, destructive = false, shortcut, className, children, onClick, ...buttonProps }, ref) {
|
|
5243
5237
|
const menu = useContext7(MenuContext);
|
|
5244
5238
|
return /* @__PURE__ */ jsxs32(
|
|
5245
5239
|
"button",
|
|
@@ -5413,7 +5407,7 @@ import {
|
|
|
5413
5407
|
useRef as useRef29
|
|
5414
5408
|
} from "react";
|
|
5415
5409
|
import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5416
|
-
var TabsContext = createContext6(null);
|
|
5410
|
+
var TabsContext = /* @__PURE__ */ createContext6(null);
|
|
5417
5411
|
function useTabs(component) {
|
|
5418
5412
|
const context = useContext8(TabsContext);
|
|
5419
5413
|
if (!context) throw new Error(`${component} must be inside <Tabs>.`);
|
|
@@ -5584,7 +5578,7 @@ function Disclosure({
|
|
|
5584
5578
|
}
|
|
5585
5579
|
);
|
|
5586
5580
|
}
|
|
5587
|
-
var AccordionContext = createContext7(null);
|
|
5581
|
+
var AccordionContext = /* @__PURE__ */ createContext7(null);
|
|
5588
5582
|
function Accordion({
|
|
5589
5583
|
type = "single",
|
|
5590
5584
|
value,
|
|
@@ -5647,7 +5641,7 @@ function Breadcrumbs({ items: items2, separator = "chevron", label = "Breadcrumb
|
|
|
5647
5641
|
function linkClassName({ variant = "default" } = {}) {
|
|
5648
5642
|
return cx("ow-link", `ow-link--${variant}`);
|
|
5649
5643
|
}
|
|
5650
|
-
var Link = forwardRef21(function Link2({ variant = "default", external = false, className, children, target, rel, ...props }, ref) {
|
|
5644
|
+
var Link = /* @__PURE__ */ forwardRef21(function Link2({ variant = "default", external = false, className, children, target, rel, ...props }, ref) {
|
|
5651
5645
|
return /* @__PURE__ */ jsxs36(
|
|
5652
5646
|
"a",
|
|
5653
5647
|
{
|
|
@@ -5800,7 +5794,7 @@ function NavList({ label, heading, orientation = "vertical", children, className
|
|
|
5800
5794
|
children
|
|
5801
5795
|
] });
|
|
5802
5796
|
}
|
|
5803
|
-
var NavItem = forwardRef22(function NavItem2({ icon: icon2, active = false, className, children, type = "button", href, end, ...buttonProps }, ref) {
|
|
5797
|
+
var NavItem = /* @__PURE__ */ forwardRef22(function NavItem2({ icon: icon2, active = false, className, children, type = "button", href, end, ...buttonProps }, ref) {
|
|
5804
5798
|
const content = /* @__PURE__ */ jsxs39(Fragment9, { children: [
|
|
5805
5799
|
icon2 ? /* @__PURE__ */ jsx50("span", { className: "ow-nav__icon", children: icon2 }) : null,
|
|
5806
5800
|
/* @__PURE__ */ jsx50("span", { className: "ow-nav__label", children }),
|
|
@@ -6173,7 +6167,8 @@ function Avatar({ name, src, size: size2 = "md", label, className }) {
|
|
|
6173
6167
|
className: cx("ow-avatar", sizing.className, !initials && !showImage && "ow-avatar--empty", className),
|
|
6174
6168
|
style: sizing.style,
|
|
6175
6169
|
...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
|
|
6176
|
-
|
|
6170
|
+
"data-initials": !showImage && initials ? initials : void 0,
|
|
6171
|
+
children: showImage ? /* @__PURE__ */ jsx56("img", { src, alt: "", className: "ow-avatar__image", onError: () => setFailedImage(src) }) : initials ? null : /* @__PURE__ */ jsx56(UserIcon, { size: Math.round(sizing.pixels * 0.52) })
|
|
6177
6172
|
}
|
|
6178
6173
|
);
|
|
6179
6174
|
}
|
|
@@ -6401,14 +6396,31 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
|
|
|
6401
6396
|
}
|
|
6402
6397
|
|
|
6403
6398
|
// src/components/Prose/Prose.tsx
|
|
6404
|
-
import { forwardRef as forwardRef23 } from "react";
|
|
6399
|
+
import { forwardRef as forwardRef23, useEffect as useEffect26, useRef as useRef34 } from "react";
|
|
6405
6400
|
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
6406
|
-
var Prose = forwardRef23(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
|
|
6401
|
+
var Prose = /* @__PURE__ */ forwardRef23(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
|
|
6407
6402
|
const Element2 = as;
|
|
6403
|
+
const root = useRef34(null);
|
|
6404
|
+
useEffect26(() => {
|
|
6405
|
+
const element = root.current;
|
|
6406
|
+
if (!element) return;
|
|
6407
|
+
for (const scroller of element.querySelectorAll("pre, .ow-table-wrap")) {
|
|
6408
|
+
if (scroller.scrollWidth > scroller.clientWidth && !scroller.hasAttribute("tabindex")) scroller.tabIndex = 0;
|
|
6409
|
+
}
|
|
6410
|
+
for (const box of element.querySelectorAll('li > input[type="checkbox"], li > p > input[type="checkbox"]')) {
|
|
6411
|
+
if (box.labels?.length || box.hasAttribute("aria-label") || box.hasAttribute("aria-labelledby")) continue;
|
|
6412
|
+
const text = box.closest("li")?.textContent?.trim();
|
|
6413
|
+
if (text) box.setAttribute("aria-label", text);
|
|
6414
|
+
}
|
|
6415
|
+
});
|
|
6408
6416
|
return /* @__PURE__ */ jsx62(
|
|
6409
6417
|
Element2,
|
|
6410
6418
|
{
|
|
6411
|
-
ref
|
|
6419
|
+
ref: (node) => {
|
|
6420
|
+
root.current = node;
|
|
6421
|
+
if (typeof ref === "function") ref(node);
|
|
6422
|
+
else if (ref) ref.current = node;
|
|
6423
|
+
},
|
|
6412
6424
|
className: cx("ow-prose", `ow-prose--${size2}`, size2 === "md" ? "ow-type-prose" : "ow-type-copy", fullWidth && "ow-prose--full", className),
|
|
6413
6425
|
...props,
|
|
6414
6426
|
children
|
|
@@ -6433,10 +6445,10 @@ function TextShimmer({ children, as = "span", duration = 2, active = true, class
|
|
|
6433
6445
|
// src/components/PromptInput/PromptInput.tsx
|
|
6434
6446
|
import {
|
|
6435
6447
|
forwardRef as forwardRef24,
|
|
6436
|
-
useEffect as
|
|
6448
|
+
useEffect as useEffect27,
|
|
6437
6449
|
useId as useId22,
|
|
6438
6450
|
useLayoutEffect as useLayoutEffect7,
|
|
6439
|
-
useRef as
|
|
6451
|
+
useRef as useRef35,
|
|
6440
6452
|
useState as useState29
|
|
6441
6453
|
} from "react";
|
|
6442
6454
|
import { jsx as jsx64, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
@@ -6526,7 +6538,7 @@ function accepts(file, accept) {
|
|
|
6526
6538
|
});
|
|
6527
6539
|
}
|
|
6528
6540
|
var hasFiles = (event) => Array.from(event.dataTransfer.types).includes("Files");
|
|
6529
|
-
var PromptInput = forwardRef24(function PromptInput2({
|
|
6541
|
+
var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
6530
6542
|
value,
|
|
6531
6543
|
defaultValue = "",
|
|
6532
6544
|
onChange,
|
|
@@ -6558,13 +6570,13 @@ var PromptInput = forwardRef24(function PromptInput2({
|
|
|
6558
6570
|
className
|
|
6559
6571
|
}, ref) {
|
|
6560
6572
|
const [text, setText] = useControllableState(value, defaultValue, onChange);
|
|
6561
|
-
const textAreaRef =
|
|
6562
|
-
const actionRef =
|
|
6563
|
-
const pickerRef =
|
|
6564
|
-
const listRef =
|
|
6565
|
-
const composing =
|
|
6566
|
-
const dragDepth =
|
|
6567
|
-
const pendingFocus =
|
|
6573
|
+
const textAreaRef = useRef35(null);
|
|
6574
|
+
const actionRef = useRef35(null);
|
|
6575
|
+
const pickerRef = useRef35(null);
|
|
6576
|
+
const listRef = useRef35(null);
|
|
6577
|
+
const composing = useRef35(false);
|
|
6578
|
+
const dragDepth = useRef35(0);
|
|
6579
|
+
const pendingFocus = useRef35(null);
|
|
6568
6580
|
const [isDragging, setIsDragging] = useState29(false);
|
|
6569
6581
|
const [notice, setNotice] = useState29();
|
|
6570
6582
|
const [announcement, setAnnouncement] = useState29("");
|
|
@@ -6587,7 +6599,7 @@ var PromptInput = forwardRef24(function PromptInput2({
|
|
|
6587
6599
|
if (typeof ref === "function") ref(element);
|
|
6588
6600
|
else if (ref) ref.current = element;
|
|
6589
6601
|
}
|
|
6590
|
-
|
|
6602
|
+
useEffect27(() => {
|
|
6591
6603
|
const textArea = textAreaRef.current;
|
|
6592
6604
|
if (!textArea || typeof ResizeObserver === "undefined") return;
|
|
6593
6605
|
let width = textArea.clientWidth;
|
|
@@ -6602,8 +6614,8 @@ var PromptInput = forwardRef24(function PromptInput2({
|
|
|
6602
6614
|
useLayoutEffect7(() => {
|
|
6603
6615
|
if (textAreaRef.current) resizeTextArea(textAreaRef.current);
|
|
6604
6616
|
}, [size2, rows]);
|
|
6605
|
-
const wasStreaming =
|
|
6606
|
-
const actionHadFocus =
|
|
6617
|
+
const wasStreaming = useRef35(isStreaming);
|
|
6618
|
+
const actionHadFocus = useRef35(false);
|
|
6607
6619
|
if (wasStreaming.current !== isStreaming) {
|
|
6608
6620
|
actionHadFocus.current = typeof document !== "undefined" && document.activeElement === actionRef.current;
|
|
6609
6621
|
}
|
|
@@ -6621,7 +6633,7 @@ var PromptInput = forwardRef24(function PromptInput2({
|
|
|
6621
6633
|
const next = buttons?.length ? buttons[Math.min(pending.index, buttons.length - 1)] : void 0;
|
|
6622
6634
|
(next ?? textAreaRef.current)?.focus();
|
|
6623
6635
|
}, [attachments]);
|
|
6624
|
-
|
|
6636
|
+
useEffect27(() => {
|
|
6625
6637
|
if (!showCounter || document.activeElement !== textAreaRef.current) return;
|
|
6626
6638
|
const timer = window.setTimeout(() => {
|
|
6627
6639
|
setAnnouncement(`${number(remaining)} ${remaining === 1 ? "character" : "characters"} left`);
|
|
@@ -6877,7 +6889,7 @@ var PromptInput = forwardRef24(function PromptInput2({
|
|
|
6877
6889
|
// src/components/PromptInput/PromptSuggestion.tsx
|
|
6878
6890
|
import { forwardRef as forwardRef25 } from "react";
|
|
6879
6891
|
import { jsx as jsx65, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
6880
|
-
var PromptSuggestion = forwardRef25(function PromptSuggestion2({ children, icon: icon2, description, variant = description ? "card" : "pill", type = "button", className, ...buttonProps }, ref) {
|
|
6892
|
+
var PromptSuggestion = /* @__PURE__ */ forwardRef25(function PromptSuggestion2({ children, icon: icon2, description, variant = description ? "card" : "pill", type = "button", className, ...buttonProps }, ref) {
|
|
6881
6893
|
if (variant === "card") {
|
|
6882
6894
|
return /* @__PURE__ */ jsxs49("button", { ref, type, className: cx("ow-prompt-suggestion", "ow-prompt-suggestion--card", className), ...buttonProps, children: [
|
|
6883
6895
|
icon2 ? /* @__PURE__ */ jsx65("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
|
|
@@ -6935,19 +6947,19 @@ import {
|
|
|
6935
6947
|
createContext as createContext8,
|
|
6936
6948
|
forwardRef as forwardRef26,
|
|
6937
6949
|
useCallback as useCallback10,
|
|
6938
|
-
useEffect as
|
|
6950
|
+
useEffect as useEffect28,
|
|
6939
6951
|
useImperativeHandle as useImperativeHandle3,
|
|
6940
6952
|
useLayoutEffect as useLayoutEffect8,
|
|
6941
6953
|
useMemo as useMemo12,
|
|
6942
|
-
useRef as
|
|
6954
|
+
useRef as useRef36,
|
|
6943
6955
|
useState as useState30
|
|
6944
6956
|
} from "react";
|
|
6945
6957
|
import { jsx as jsx66, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
6946
|
-
var ChatConversationContext = createContext8(null);
|
|
6958
|
+
var ChatConversationContext = /* @__PURE__ */ createContext8(null);
|
|
6947
6959
|
var stickyDistance = 32;
|
|
6948
6960
|
var defaultCount = (count) => `${count} new`;
|
|
6949
6961
|
var prefersReducedMotion = () => typeof window !== "undefined" && Boolean(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches);
|
|
6950
|
-
var ChatConversation = forwardRef26(function ChatConversation2({
|
|
6962
|
+
var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
|
|
6951
6963
|
children,
|
|
6952
6964
|
empty,
|
|
6953
6965
|
footer,
|
|
@@ -6959,13 +6971,13 @@ var ChatConversation = forwardRef26(function ChatConversation2({
|
|
|
6959
6971
|
className,
|
|
6960
6972
|
...props
|
|
6961
6973
|
}, ref) {
|
|
6962
|
-
const scrollerRef =
|
|
6963
|
-
const contentRef =
|
|
6964
|
-
const jumpRef =
|
|
6965
|
-
const following =
|
|
6966
|
-
const lastTop =
|
|
6967
|
-
const ready =
|
|
6968
|
-
const unseen =
|
|
6974
|
+
const scrollerRef = useRef36(null);
|
|
6975
|
+
const contentRef = useRef36(null);
|
|
6976
|
+
const jumpRef = useRef36(null);
|
|
6977
|
+
const following = useRef36(true);
|
|
6978
|
+
const lastTop = useRef36(0);
|
|
6979
|
+
const ready = useRef36(false);
|
|
6980
|
+
const unseen = useRef36(/* @__PURE__ */ new Set());
|
|
6969
6981
|
const [isFollowing, setIsFollowing] = useState30(true);
|
|
6970
6982
|
const [newCount, setNewCount] = useState30(0);
|
|
6971
6983
|
const isEmpty = Children2.toArray(children).length === 0;
|
|
@@ -6994,10 +7006,10 @@ var ChatConversation = forwardRef26(function ChatConversation2({
|
|
|
6994
7006
|
);
|
|
6995
7007
|
useImperativeHandle3(ref, () => ({ scrollToBottom }), [scrollToBottom]);
|
|
6996
7008
|
useLayoutEffect8(stick, [stick]);
|
|
6997
|
-
|
|
7009
|
+
useEffect28(() => {
|
|
6998
7010
|
ready.current = true;
|
|
6999
7011
|
}, []);
|
|
7000
|
-
|
|
7012
|
+
useEffect28(() => {
|
|
7001
7013
|
const scroller = scrollerRef.current;
|
|
7002
7014
|
const content = contentRef.current;
|
|
7003
7015
|
if (!scroller || !content || typeof ResizeObserver === "undefined") return void 0;
|
|
@@ -7083,10 +7095,10 @@ var ChatConversation = forwardRef26(function ChatConversation2({
|
|
|
7083
7095
|
import {
|
|
7084
7096
|
forwardRef as forwardRef27,
|
|
7085
7097
|
useContext as useContext10,
|
|
7086
|
-
useEffect as
|
|
7098
|
+
useEffect as useEffect29,
|
|
7087
7099
|
useId as useId23,
|
|
7088
7100
|
useLayoutEffect as useLayoutEffect9,
|
|
7089
|
-
useRef as
|
|
7101
|
+
useRef as useRef37,
|
|
7090
7102
|
useState as useState31
|
|
7091
7103
|
} from "react";
|
|
7092
7104
|
import { Fragment as Fragment10, jsx as jsx67, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
@@ -7112,7 +7124,7 @@ function lucide(paths) {
|
|
|
7112
7124
|
);
|
|
7113
7125
|
};
|
|
7114
7126
|
}
|
|
7115
|
-
var BotIcon = lucide(
|
|
7127
|
+
var BotIcon = /* @__PURE__ */ lucide(
|
|
7116
7128
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7117
7129
|
/* @__PURE__ */ jsx67("path", { d: "M12 8V4H8" }),
|
|
7118
7130
|
/* @__PURE__ */ jsx67("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
@@ -7122,25 +7134,25 @@ var BotIcon = lucide(
|
|
|
7122
7134
|
/* @__PURE__ */ jsx67("path", { d: "M9 13v2" })
|
|
7123
7135
|
] })
|
|
7124
7136
|
);
|
|
7125
|
-
var RotateCcwIcon = lucide(
|
|
7137
|
+
var RotateCcwIcon = /* @__PURE__ */ lucide(
|
|
7126
7138
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7127
7139
|
/* @__PURE__ */ jsx67("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
7128
7140
|
/* @__PURE__ */ jsx67("path", { d: "M3 3v5h5" })
|
|
7129
7141
|
] })
|
|
7130
7142
|
);
|
|
7131
|
-
var ThumbsUpIcon = lucide(
|
|
7143
|
+
var ThumbsUpIcon = /* @__PURE__ */ lucide(
|
|
7132
7144
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7133
7145
|
/* @__PURE__ */ jsx67("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }),
|
|
7134
7146
|
/* @__PURE__ */ jsx67("path", { d: "M7 10v12" })
|
|
7135
7147
|
] })
|
|
7136
7148
|
);
|
|
7137
|
-
var ThumbsDownIcon = lucide(
|
|
7149
|
+
var ThumbsDownIcon = /* @__PURE__ */ lucide(
|
|
7138
7150
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7139
7151
|
/* @__PURE__ */ jsx67("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }),
|
|
7140
7152
|
/* @__PURE__ */ jsx67("path", { d: "M17 14V2" })
|
|
7141
7153
|
] })
|
|
7142
7154
|
);
|
|
7143
|
-
var PencilIcon = lucide(
|
|
7155
|
+
var PencilIcon = /* @__PURE__ */ lucide(
|
|
7144
7156
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7145
7157
|
/* @__PURE__ */ jsx67("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
|
|
7146
7158
|
/* @__PURE__ */ jsx67("path", { d: "m15 5 4 4" })
|
|
@@ -7232,15 +7244,15 @@ function useStreamingCaret(bodyRef, contentRef, caretRef, active) {
|
|
|
7232
7244
|
};
|
|
7233
7245
|
}, [active, bodyRef, contentRef, caretRef]);
|
|
7234
7246
|
}
|
|
7235
|
-
var ChatMessage = forwardRef27(function ChatMessage2({ from, children, name, avatar, time, locale, status = "done", error, onRetry, retryLabel = "Retry", actions, showActions = "hover", className, ...props }, ref) {
|
|
7247
|
+
var ChatMessage = /* @__PURE__ */ forwardRef27(function ChatMessage2({ from, children, name, avatar, time, locale, status = "done", error, onRetry, retryLabel = "Retry", actions, showActions = "hover", className, ...props }, ref) {
|
|
7236
7248
|
const conversation = useContext10(ChatConversationContext);
|
|
7237
7249
|
const entering = useChatEntrance();
|
|
7238
7250
|
const id = useId23();
|
|
7239
|
-
const bodyRef =
|
|
7240
|
-
const contentRef =
|
|
7241
|
-
const caretRef =
|
|
7251
|
+
const bodyRef = useRef37(null);
|
|
7252
|
+
const contentRef = useRef37(null);
|
|
7253
|
+
const caretRef = useRef37(null);
|
|
7242
7254
|
const streaming = status === "streaming";
|
|
7243
|
-
|
|
7255
|
+
useEffect29(() => conversation?.register(id), [conversation, id]);
|
|
7244
7256
|
useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== "system");
|
|
7245
7257
|
if (from === "system") {
|
|
7246
7258
|
return /* @__PURE__ */ jsx67(
|
|
@@ -7303,8 +7315,8 @@ var ChatMessage = forwardRef27(function ChatMessage2({ from, children, name, ava
|
|
|
7303
7315
|
var defaultLabels = { copy: "Copy", copied: "Copied", edit: "Edit", retry: "Retry", good: "Good response", bad: "Bad response" };
|
|
7304
7316
|
function CopyAction({ text, label, copiedLabel }) {
|
|
7305
7317
|
const [copied, setCopied] = useState31(false);
|
|
7306
|
-
const timer =
|
|
7307
|
-
|
|
7318
|
+
const timer = useRef37(0);
|
|
7319
|
+
useEffect29(() => () => window.clearTimeout(timer.current), []);
|
|
7308
7320
|
const current = copied ? copiedLabel : label;
|
|
7309
7321
|
return /* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7310
7322
|
/* @__PURE__ */ jsx67(Tooltip, { label: current, children: /* @__PURE__ */ jsx67(
|
|
@@ -7397,7 +7409,7 @@ function ChatLoader({ label, inline = false, name, avatar, srLabel = "Working\u2
|
|
|
7397
7409
|
}
|
|
7398
7410
|
|
|
7399
7411
|
// src/components/ChatTool/ChatTool.tsx
|
|
7400
|
-
import { forwardRef as forwardRef28, useEffect as
|
|
7412
|
+
import { forwardRef as forwardRef28, useEffect as useEffect30, useId as useId24, useRef as useRef38, useState as useState32 } from "react";
|
|
7401
7413
|
import { Fragment as Fragment11, jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
7402
7414
|
var statusWords = {
|
|
7403
7415
|
pending: "Not started",
|
|
@@ -7483,9 +7495,9 @@ function useStatusExpansion({
|
|
|
7483
7495
|
initial = wantsOpen
|
|
7484
7496
|
}) {
|
|
7485
7497
|
const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded ?? initial, onExpandedChange);
|
|
7486
|
-
const touched =
|
|
7487
|
-
const previous =
|
|
7488
|
-
|
|
7498
|
+
const touched = useRef38(false);
|
|
7499
|
+
const previous = useRef38(wantsOpen);
|
|
7500
|
+
useEffect30(() => {
|
|
7489
7501
|
if (previous.current === wantsOpen) return;
|
|
7490
7502
|
previous.current = wantsOpen;
|
|
7491
7503
|
if (expanded !== void 0) return;
|
|
@@ -7511,8 +7523,8 @@ function ChatCollapse({
|
|
|
7511
7523
|
className,
|
|
7512
7524
|
children
|
|
7513
7525
|
}) {
|
|
7514
|
-
const ref =
|
|
7515
|
-
|
|
7526
|
+
const ref = useRef38(null);
|
|
7527
|
+
useEffect30(() => {
|
|
7516
7528
|
if (ref.current) ref.current.inert = !open;
|
|
7517
7529
|
}, [open]);
|
|
7518
7530
|
return /* @__PURE__ */ jsx69("div", { ref, id, className: cx("ow-chat-collapse", bleed && "ow-chat-collapse--bleed"), "data-open": open, children: /* @__PURE__ */ jsx69("div", { className: "ow-chat-collapse__clip", children: /* @__PURE__ */ jsx69("div", { className, children }) }) });
|
|
@@ -7526,7 +7538,7 @@ function formatInput(input) {
|
|
|
7526
7538
|
return String(input);
|
|
7527
7539
|
}
|
|
7528
7540
|
}
|
|
7529
|
-
var ChatTool = forwardRef28(function ChatTool2({
|
|
7541
|
+
var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
7530
7542
|
title,
|
|
7531
7543
|
name,
|
|
7532
7544
|
icon: icon2,
|
|
@@ -7549,10 +7561,10 @@ var ChatTool = forwardRef28(function ChatTool2({
|
|
|
7549
7561
|
...props
|
|
7550
7562
|
}, ref) {
|
|
7551
7563
|
const id = useId24();
|
|
7552
|
-
const rootRef =
|
|
7553
|
-
const triggerRef =
|
|
7554
|
-
const messageRef =
|
|
7555
|
-
const decided =
|
|
7564
|
+
const rootRef = useRef38(null);
|
|
7565
|
+
const triggerRef = useRef38(null);
|
|
7566
|
+
const messageRef = useRef38(null);
|
|
7567
|
+
const decided = useRef38(false);
|
|
7556
7568
|
const [announcement, setAnnouncement] = useState32("");
|
|
7557
7569
|
const needsApproval = status === "approval";
|
|
7558
7570
|
const [isOpen, toggle] = useStatusExpansion({
|
|
@@ -7566,7 +7578,7 @@ var ChatTool = forwardRef28(function ChatTool2({
|
|
|
7566
7578
|
const hasError = error !== void 0 && error !== null && error !== false && error !== "";
|
|
7567
7579
|
const hasDetails = hasInput || hasOutput || hasError;
|
|
7568
7580
|
const hasMeta = Boolean(summary) || duration !== void 0;
|
|
7569
|
-
|
|
7581
|
+
useEffect30(() => {
|
|
7570
7582
|
if (!needsApproval) {
|
|
7571
7583
|
setAnnouncement("");
|
|
7572
7584
|
return;
|
|
@@ -7577,7 +7589,7 @@ var ChatTool = forwardRef28(function ChatTool2({
|
|
|
7577
7589
|
}, 150);
|
|
7578
7590
|
return () => window.clearTimeout(timer);
|
|
7579
7591
|
}, [needsApproval]);
|
|
7580
|
-
|
|
7592
|
+
useEffect30(() => {
|
|
7581
7593
|
if (needsApproval || !decided.current) return;
|
|
7582
7594
|
decided.current = false;
|
|
7583
7595
|
const active = document.activeElement;
|
|
@@ -7683,7 +7695,7 @@ var ChatTool = forwardRef28(function ChatTool2({
|
|
|
7683
7695
|
import { forwardRef as forwardRef29, useId as useId25 } from "react";
|
|
7684
7696
|
import { jsx as jsx70, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
7685
7697
|
var plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
7686
|
-
var ChainOfThought = forwardRef29(function ChainOfThought2({
|
|
7698
|
+
var ChainOfThought = /* @__PURE__ */ forwardRef29(function ChainOfThought2({
|
|
7687
7699
|
steps = [],
|
|
7688
7700
|
status = "success",
|
|
7689
7701
|
duration,
|
|
@@ -7744,11 +7756,11 @@ var ChainOfThought = forwardRef29(function ChainOfThought2({
|
|
|
7744
7756
|
});
|
|
7745
7757
|
|
|
7746
7758
|
// src/components/ChatSource/ChatSource.tsx
|
|
7747
|
-
import { forwardRef as forwardRef30, useCallback as useCallback11, useEffect as
|
|
7759
|
+
import { forwardRef as forwardRef30, useCallback as useCallback11, useEffect as useEffect31, useId as useId26, useRef as useRef39, useState as useState33 } from "react";
|
|
7748
7760
|
import { Fragment as Fragment12, jsx as jsx71, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
7749
7761
|
var openDelay = 250;
|
|
7750
7762
|
var closeDelay = 150;
|
|
7751
|
-
var ChatSource = forwardRef30(function ChatSource2({
|
|
7763
|
+
var ChatSource = /* @__PURE__ */ forwardRef30(function ChatSource2({
|
|
7752
7764
|
title,
|
|
7753
7765
|
source,
|
|
7754
7766
|
snippet,
|
|
@@ -7764,11 +7776,11 @@ var ChatSource = forwardRef30(function ChatSource2({
|
|
|
7764
7776
|
className
|
|
7765
7777
|
}, ref) {
|
|
7766
7778
|
const id = useId26();
|
|
7767
|
-
const wrapperRef =
|
|
7768
|
-
const chipRef =
|
|
7769
|
-
const cardRef =
|
|
7770
|
-
const timer =
|
|
7771
|
-
const pointer =
|
|
7779
|
+
const wrapperRef = useRef39(null);
|
|
7780
|
+
const chipRef = useRef39(null);
|
|
7781
|
+
const cardRef = useRef39(null);
|
|
7782
|
+
const timer = useRef39(0);
|
|
7783
|
+
const pointer = useRef39("mouse");
|
|
7772
7784
|
const [open, setOpen] = useState33(false);
|
|
7773
7785
|
const { mounted, state } = usePresence(open);
|
|
7774
7786
|
const style = useFloating({ open: mounted, anchorRef: chipRef, floatingRef: cardRef, placement: "bottom-start", offset: 6, maxHeight: 360 });
|
|
@@ -7782,7 +7794,7 @@ var ChatSource = forwardRef30(function ChatSource2({
|
|
|
7782
7794
|
setOpen(false);
|
|
7783
7795
|
}, []);
|
|
7784
7796
|
useDismiss(open, [wrapperRef], close);
|
|
7785
|
-
|
|
7797
|
+
useEffect31(() => () => window.clearTimeout(timer.current), []);
|
|
7786
7798
|
const name = ariaLabel ?? (index !== void 0 ? `Source ${index}` : label ?? "Source");
|
|
7787
7799
|
const describedBy = [`${id}-title`, source ? `${id}-source` : null, snippet ? `${id}-snippet` : null].filter(Boolean).join(" ");
|
|
7788
7800
|
const externalProps = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
|
|
@@ -7847,7 +7859,7 @@ var ChatSource = forwardRef30(function ChatSource2({
|
|
|
7847
7859
|
}
|
|
7848
7860
|
);
|
|
7849
7861
|
});
|
|
7850
|
-
var ChatSources = forwardRef30(function ChatSources2({ sources, label, expanded, defaultExpanded = false, onExpandedChange, className, ...props }, ref) {
|
|
7862
|
+
var ChatSources = /* @__PURE__ */ forwardRef30(function ChatSources2({ sources, label, expanded, defaultExpanded = false, onExpandedChange, className, ...props }, ref) {
|
|
7851
7863
|
const id = useId26();
|
|
7852
7864
|
const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded, onExpandedChange);
|
|
7853
7865
|
if (sources.length === 0) return null;
|
|
@@ -7888,7 +7900,7 @@ var ChatSources = forwardRef30(function ChatSources2({ sources, label, expanded,
|
|
|
7888
7900
|
});
|
|
7889
7901
|
|
|
7890
7902
|
// src/components/ColorPicker/ColorPicker.tsx
|
|
7891
|
-
import { forwardRef as forwardRef31, useCallback as useCallback12, useEffect as
|
|
7903
|
+
import { forwardRef as forwardRef31, useCallback as useCallback12, useEffect as useEffect32, useId as useId27, useRef as useRef40, useState as useState34 } from "react";
|
|
7892
7904
|
import { HexAlphaColorPicker, HexColorInput, HexColorPicker } from "react-colorful";
|
|
7893
7905
|
import { Fragment as Fragment13, jsx as jsx72, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
7894
7906
|
var swatchColor = (swatch) => typeof swatch === "string" ? swatch : swatch.color;
|
|
@@ -7907,9 +7919,9 @@ function ColorPicker({
|
|
|
7907
7919
|
}) {
|
|
7908
7920
|
const [color, setColor] = useControllableState(value, defaultValue, onChange);
|
|
7909
7921
|
const [canPick, setCanPick] = useState34(false);
|
|
7910
|
-
const rootRef =
|
|
7911
|
-
|
|
7912
|
-
|
|
7922
|
+
const rootRef = useRef40(null);
|
|
7923
|
+
useEffect32(() => setCanPick(typeof window !== "undefined" && "EyeDropper" in window), []);
|
|
7924
|
+
useEffect32(() => {
|
|
7913
7925
|
const names = { saturation: "Colour", hue: "Hue", alpha: "Opacity" };
|
|
7914
7926
|
for (const [part, label] of Object.entries(names)) {
|
|
7915
7927
|
rootRef.current?.querySelector(`.react-colorful__${part} .react-colorful__interactive`)?.setAttribute("aria-label", label);
|
|
@@ -7967,7 +7979,7 @@ function assignRef7(ref, value) {
|
|
|
7967
7979
|
if (typeof ref === "function") ref(value);
|
|
7968
7980
|
else if (ref) ref.current = value;
|
|
7969
7981
|
}
|
|
7970
|
-
var ColorField = forwardRef31(function ColorField2({
|
|
7982
|
+
var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
|
|
7971
7983
|
value,
|
|
7972
7984
|
defaultValue = "#312c7e",
|
|
7973
7985
|
onChange,
|
|
@@ -7984,8 +7996,8 @@ var ColorField = forwardRef31(function ColorField2({
|
|
|
7984
7996
|
}, ref) {
|
|
7985
7997
|
const [color, setColor] = useControllableState(value, defaultValue, onChange);
|
|
7986
7998
|
const [isOpen, setOpen] = useState34(false);
|
|
7987
|
-
const triggerRef =
|
|
7988
|
-
const panelRef =
|
|
7999
|
+
const triggerRef = useRef40(null);
|
|
8000
|
+
const panelRef = useRef40(null);
|
|
7989
8001
|
const panelId = useId27();
|
|
7990
8002
|
const { mounted, state } = usePresence(isOpen);
|
|
7991
8003
|
const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement, offset: 6, maxHeight: 640 });
|
|
@@ -7994,7 +8006,7 @@ var ColorField = forwardRef31(function ColorField2({
|
|
|
7994
8006
|
if (reason !== "outside") triggerRef.current?.focus();
|
|
7995
8007
|
}, []);
|
|
7996
8008
|
useDismiss(isOpen, [panelRef, triggerRef], close);
|
|
7997
|
-
|
|
8009
|
+
useEffect32(() => {
|
|
7998
8010
|
if (!isOpen) return void 0;
|
|
7999
8011
|
const frame = requestAnimationFrame(() => panelRef.current?.querySelector(".react-colorful__interactive")?.focus());
|
|
8000
8012
|
return () => cancelAnimationFrame(frame);
|
|
@@ -8012,9 +8024,9 @@ var ColorField = forwardRef31(function ColorField2({
|
|
|
8012
8024
|
"aria-haspopup": "dialog",
|
|
8013
8025
|
"aria-expanded": isOpen,
|
|
8014
8026
|
"aria-controls": isOpen ? panelId : void 0,
|
|
8015
|
-
"aria-label": ariaLabel,
|
|
8016
|
-
"aria-labelledby": ariaLabelledBy,
|
|
8017
|
-
"aria-describedby":
|
|
8027
|
+
"aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${color.toUpperCase()}` : void 0,
|
|
8028
|
+
"aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
|
|
8029
|
+
"aria-describedby": ariaDescribedBy,
|
|
8018
8030
|
"aria-invalid": isInvalid || void 0,
|
|
8019
8031
|
disabled,
|
|
8020
8032
|
className: cx(
|
|
@@ -8059,10 +8071,10 @@ var ColorField = forwardRef31(function ColorField2({
|
|
|
8059
8071
|
});
|
|
8060
8072
|
|
|
8061
8073
|
// src/components/ColorPicker/ColorArea.tsx
|
|
8062
|
-
import { forwardRef as forwardRef32, useRef as
|
|
8074
|
+
import { forwardRef as forwardRef32, useRef as useRef42, useState as useState36 } from "react";
|
|
8063
8075
|
|
|
8064
8076
|
// src/components/ColorPicker/color.ts
|
|
8065
|
-
import { useCallback as useCallback13, useReducer, useRef as
|
|
8077
|
+
import { useCallback as useCallback13, useReducer, useRef as useRef41, useState as useState35 } from "react";
|
|
8066
8078
|
var clamp2 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
8067
8079
|
function parseHex(color) {
|
|
8068
8080
|
let hex = color.trim().replace(/^#/, "");
|
|
@@ -8139,7 +8151,7 @@ var hslModel = {
|
|
|
8139
8151
|
var fallback = { r: 0, g: 0, b: 0, a: 1 };
|
|
8140
8152
|
function useColorModel(value, defaultValue, onChange, model, { hue, alpha = false } = {}) {
|
|
8141
8153
|
const [color, setColor] = useControllableState(value, defaultValue, onChange);
|
|
8142
|
-
const memory =
|
|
8154
|
+
const memory = useRef41(null);
|
|
8143
8155
|
const [, rerender] = useReducer((n) => n + 1, 0);
|
|
8144
8156
|
const incoming = normalizeHex(color);
|
|
8145
8157
|
if (!memory.current || memory.current.hex !== incoming || memory.current.model !== model) {
|
|
@@ -8249,7 +8261,7 @@ function assignRef8(ref, value) {
|
|
|
8249
8261
|
if (typeof ref === "function") ref(value);
|
|
8250
8262
|
else if (ref) ref.current = value;
|
|
8251
8263
|
}
|
|
8252
|
-
var ColorArea = forwardRef32(function ColorArea2({
|
|
8264
|
+
var ColorArea = /* @__PURE__ */ forwardRef32(function ColorArea2({
|
|
8253
8265
|
value,
|
|
8254
8266
|
defaultValue = "#312c7e",
|
|
8255
8267
|
onChange,
|
|
@@ -8267,8 +8279,8 @@ var ColorArea = forwardRef32(function ColorArea2({
|
|
|
8267
8279
|
className
|
|
8268
8280
|
}, ref) {
|
|
8269
8281
|
const { value: hsv, rgba, hex, set, latest } = useColorModel(value, defaultValue, onChange, hsvModel, { hue });
|
|
8270
|
-
const rootRef =
|
|
8271
|
-
const inputs =
|
|
8282
|
+
const rootRef = useRef42(null);
|
|
8283
|
+
const inputs = useRef42({ x: null, y: null });
|
|
8272
8284
|
const [axis, setAxis] = useState36("x");
|
|
8273
8285
|
const isRtl = () => rootRef.current ? getComputedStyle(rootRef.current).direction === "rtl" : false;
|
|
8274
8286
|
const end = () => onChangeEnd?.(latest());
|
|
@@ -8390,7 +8402,7 @@ var ColorArea = forwardRef32(function ColorArea2({
|
|
|
8390
8402
|
});
|
|
8391
8403
|
|
|
8392
8404
|
// src/components/ColorPicker/ColorSlider.tsx
|
|
8393
|
-
import { forwardRef as forwardRef33, useId as useId28, useRef as
|
|
8405
|
+
import { forwardRef as forwardRef33, useId as useId28, useRef as useRef43 } from "react";
|
|
8394
8406
|
import { jsx as jsx74, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
8395
8407
|
var channels = {
|
|
8396
8408
|
hue: { name: "Hue", max: 360, unit: "degree" },
|
|
@@ -8438,7 +8450,7 @@ function assignRef9(ref, value) {
|
|
|
8438
8450
|
if (typeof ref === "function") ref(value);
|
|
8439
8451
|
else if (ref) ref.current = value;
|
|
8440
8452
|
}
|
|
8441
|
-
var ColorSlider = forwardRef33(function ColorSlider2({
|
|
8453
|
+
var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
|
|
8442
8454
|
channel,
|
|
8443
8455
|
value,
|
|
8444
8456
|
defaultValue = "#312c7e",
|
|
@@ -8467,8 +8479,8 @@ var ColorSlider = forwardRef33(function ColorSlider2({
|
|
|
8467
8479
|
const { rgba, latest } = color;
|
|
8468
8480
|
const current = read(channel, color.value, rgba);
|
|
8469
8481
|
const labelId = useId28();
|
|
8470
|
-
const trackRef =
|
|
8471
|
-
const inputRef =
|
|
8482
|
+
const trackRef = useRef43(null);
|
|
8483
|
+
const inputRef = useRef43(null);
|
|
8472
8484
|
const vertical = orientation === "vertical";
|
|
8473
8485
|
const isRtl = () => !vertical && trackRef.current !== null && getComputedStyle(trackRef.current).direction === "rtl";
|
|
8474
8486
|
const end = () => onChangeEnd?.(latest());
|
|
@@ -8578,11 +8590,11 @@ var ColorSlider = forwardRef33(function ColorSlider2({
|
|
|
8578
8590
|
});
|
|
8579
8591
|
|
|
8580
8592
|
// src/components/ColorPicker/ColorSwatchPicker.tsx
|
|
8581
|
-
import { forwardRef as forwardRef34, useRef as
|
|
8593
|
+
import { forwardRef as forwardRef34, useRef as useRef44 } from "react";
|
|
8582
8594
|
import { jsx as jsx75, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
8583
|
-
var ColorSwatchPicker = forwardRef34(function ColorSwatchPicker2({ options, value, defaultValue, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
|
|
8595
|
+
var ColorSwatchPicker = /* @__PURE__ */ forwardRef34(function ColorSwatchPicker2({ options, value, defaultValue, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
|
|
8584
8596
|
const [current, setCurrent] = useControllableState(value, defaultValue ?? "", onChange);
|
|
8585
|
-
const refs =
|
|
8597
|
+
const refs = useRef44([]);
|
|
8586
8598
|
const items2 = options.map((option) => {
|
|
8587
8599
|
const item = typeof option === "string" ? { value: option } : option;
|
|
8588
8600
|
const rgba = parseHex(item.value);
|