@parrot-co/parrot-ui 0.1.28 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3936 @@
1
+ 'use strict';
2
+
3
+ var React36 = require('react');
4
+ var reactAriaComponents = require('react-aria-components');
5
+ var tailwindMerge = require('tailwind-merge');
6
+ var date = require('@internationalized/date');
7
+ var reactStately = require('react-stately');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React36__namespace = /*#__PURE__*/_interopNamespace(React36);
28
+
29
+ // src/components/input/input.tsx
30
+
31
+ // src/utils/assertions.ts
32
+ function isArray(value) {
33
+ return value !== null && Array.isArray(value);
34
+ }
35
+ function isEmptyArray(value) {
36
+ return isArray(value) && value.length === 0;
37
+ }
38
+ function isObject(value) {
39
+ return (typeof value === "object" || typeof value === "function") && !Array.isArray(value) && value !== null;
40
+ }
41
+ function isUndefinedOrNull(value) {
42
+ return value == null;
43
+ }
44
+
45
+ // src/utils/dom.ts
46
+ function processClassValue(value) {
47
+ if (!value) {
48
+ return null;
49
+ }
50
+ if (typeof value === "function") {
51
+ return processClassValue(value?.());
52
+ }
53
+ if (isArray(value)) {
54
+ let i = 0;
55
+ let temp = "";
56
+ while (i < value.length) {
57
+ const result = processClassValue(value[i++]);
58
+ if (result) {
59
+ temp && (temp += " ");
60
+ temp += `${result}`;
61
+ }
62
+ }
63
+ return temp;
64
+ }
65
+ if (isObject(value)) {
66
+ let str = "";
67
+ for (const key in value) {
68
+ if (value[key]) {
69
+ str && (str += " ");
70
+ str += `${key}`;
71
+ }
72
+ }
73
+ return str;
74
+ }
75
+ return value;
76
+ }
77
+ function cx(...args) {
78
+ let i = 0;
79
+ let classStr = "";
80
+ while (i < args.length) {
81
+ const result = processClassValue(args[i++]);
82
+ if (result) {
83
+ classStr && (classStr += " ");
84
+ classStr += result;
85
+ }
86
+ }
87
+ return classStr;
88
+ }
89
+ function cn(...args) {
90
+ return tailwindMerge.twMerge(cx(...args));
91
+ }
92
+ var validDOMProperties = /* @__PURE__ */ new Set([
93
+ // Common HTML attributes
94
+ "accept",
95
+ "acceptCharset",
96
+ "accessKey",
97
+ "action",
98
+ "allowFullScreen",
99
+ "allowTransparency",
100
+ "alt",
101
+ "async",
102
+ "autoComplete",
103
+ "autoFocus",
104
+ "autoPlay",
105
+ "capture",
106
+ "cellPadding",
107
+ "cellSpacing",
108
+ "challenge",
109
+ "charSet",
110
+ "checked",
111
+ "cite",
112
+ "classID",
113
+ "className",
114
+ "colSpan",
115
+ "cols",
116
+ "content",
117
+ "contentEditable",
118
+ "contextMenu",
119
+ "controls",
120
+ "coords",
121
+ "crossOrigin",
122
+ "data",
123
+ "dateTime",
124
+ "default",
125
+ "defer",
126
+ "dir",
127
+ "disabled",
128
+ "download",
129
+ "draggable",
130
+ "encType",
131
+ "form",
132
+ "formAction",
133
+ "formEncType",
134
+ "formMethod",
135
+ "formNoValidate",
136
+ "formTarget",
137
+ "frameBorder",
138
+ "headers",
139
+ "height",
140
+ "hidden",
141
+ "high",
142
+ "href",
143
+ "hrefLang",
144
+ "htmlFor",
145
+ "httpEquiv",
146
+ "icon",
147
+ "id",
148
+ "inputMode",
149
+ "integrity",
150
+ "is",
151
+ "keyParams",
152
+ "keyType",
153
+ "kind",
154
+ "label",
155
+ "lang",
156
+ "list",
157
+ "loop",
158
+ "low",
159
+ "manifest",
160
+ "marginHeight",
161
+ "marginWidth",
162
+ "max",
163
+ "maxLength",
164
+ "media",
165
+ "mediaGroup",
166
+ "method",
167
+ "min",
168
+ "minLength",
169
+ "multiple",
170
+ "muted",
171
+ "name",
172
+ "noValidate",
173
+ "nonce",
174
+ "open",
175
+ "optimum",
176
+ "pattern",
177
+ "placeholder",
178
+ "poster",
179
+ "preload",
180
+ "profile",
181
+ "radioGroup",
182
+ "readOnly",
183
+ "referrerPolicy",
184
+ "rel",
185
+ "required",
186
+ "reversed",
187
+ "role",
188
+ "rowSpan",
189
+ "rows",
190
+ "sandbox",
191
+ "scope",
192
+ "scoped",
193
+ "scrolling",
194
+ "seamless",
195
+ "selected",
196
+ "shape",
197
+ "size",
198
+ "sizes",
199
+ "span",
200
+ "spellCheck",
201
+ "src",
202
+ "srcDoc",
203
+ "srcLang",
204
+ "srcSet",
205
+ "start",
206
+ "step",
207
+ "style",
208
+ "summary",
209
+ "tabIndex",
210
+ "target",
211
+ "title",
212
+ "type",
213
+ "useMap",
214
+ "value",
215
+ "width",
216
+ "wmode",
217
+ "wrap",
218
+ // Event handlers
219
+ "onCopy",
220
+ "onCut",
221
+ "onPaste",
222
+ "onCompositionEnd",
223
+ "onCompositionStart",
224
+ "onCompositionUpdate",
225
+ "onKeyDown",
226
+ "onKeyPress",
227
+ "onKeyUp",
228
+ "onFocus",
229
+ "onBlur",
230
+ "onChange",
231
+ "onInput",
232
+ "onInvalid",
233
+ "onSubmit",
234
+ "onClick",
235
+ "onContextMenu",
236
+ "onDoubleClick",
237
+ "onDrag",
238
+ "onDragEnd",
239
+ "onDragEnter",
240
+ "onDragExit",
241
+ "onDragLeave",
242
+ "onDragOver",
243
+ "onDragStart",
244
+ "onDrop",
245
+ "onMouseDown",
246
+ "onMouseEnter",
247
+ "onMouseLeave",
248
+ "onMouseMove",
249
+ "onMouseOut",
250
+ "onMouseOver",
251
+ "onMouseUp",
252
+ "onSelect",
253
+ "onTouchCancel",
254
+ "onTouchEnd",
255
+ "onTouchMove",
256
+ "onTouchStart",
257
+ "onScroll",
258
+ "onWheel",
259
+ "onAbort",
260
+ "onCanPlay",
261
+ "onCanPlayThrough",
262
+ "onDurationChange",
263
+ "onEmptied",
264
+ "onEncrypted",
265
+ "onEnded",
266
+ "onError",
267
+ "onLoadedData",
268
+ "onLoadedMetadata",
269
+ "onLoadStart",
270
+ "onPause",
271
+ "onPlay",
272
+ "onPlaying",
273
+ "onProgress",
274
+ "onRateChange",
275
+ "onSeeked",
276
+ "onSeeking",
277
+ "onStalled",
278
+ "onSuspend",
279
+ "onTimeUpdate",
280
+ "onVolumeChange",
281
+ "onWaiting",
282
+ "onLoad",
283
+ "onAnimationStart",
284
+ "onAnimationEnd",
285
+ "onAnimationIteration",
286
+ "onTransitionEnd",
287
+ "onToggle"
288
+ ]);
289
+ function filterDOMProps(props) {
290
+ const newProps = {};
291
+ for (const key in props) {
292
+ if (!key.startsWith("data-") && !validDOMProperties.has(key)) {
293
+ continue;
294
+ }
295
+ newProps[key] = props[key];
296
+ }
297
+ return newProps;
298
+ }
299
+ function InputLabel({
300
+ ref,
301
+ color,
302
+ className,
303
+ children,
304
+ ...props
305
+ }) {
306
+ const [merged, mergedRef] = reactAriaComponents.useContextProps(
307
+ props,
308
+ ref ?? null,
309
+ reactAriaComponents.LabelContext
310
+ );
311
+ const { elementType: ElementType = "label", ...labelProps } = merged;
312
+ return /* @__PURE__ */ React36__namespace.createElement(
313
+ ElementType,
314
+ {
315
+ ...labelProps,
316
+ ref: mergedRef,
317
+ "data-color": color,
318
+ className: cn("prt-input-label", className)
319
+ },
320
+ children
321
+ );
322
+ }
323
+ function InputError({
324
+ children,
325
+ validationStatus = "error",
326
+ className,
327
+ ...props
328
+ }) {
329
+ return /* @__PURE__ */ React36__namespace.createElement(
330
+ reactAriaComponents.FieldError,
331
+ {
332
+ ...props,
333
+ elementType: "div",
334
+ className: cn("prt-input-error", className),
335
+ "data-validation-status": validationStatus
336
+ },
337
+ children
338
+ );
339
+ }
340
+ var SpaceContext = React36__namespace.createContext({ classNames: {}, compactItemWrapperAdjust: "" });
341
+ var GAP_CLASS = {
342
+ none: "gap-0",
343
+ "4xs": "gap-0.5",
344
+ "3xs": "gap-1",
345
+ "2xs": "gap-2",
346
+ xs: "gap-2.5",
347
+ sm: "gap-3",
348
+ md: "gap-3.5",
349
+ lg: "gap-4",
350
+ xl: "gap-6",
351
+ "2xl": "gap-8",
352
+ "3xl": "gap-10",
353
+ "4xl": "gap-12"
354
+ };
355
+ function Space({
356
+ children,
357
+ compact,
358
+ gap = "none",
359
+ stack,
360
+ className,
361
+ classNames,
362
+ style,
363
+ styles
364
+ }) {
365
+ const childrenCount = React36__namespace.Children.count(children);
366
+ const nodes = React36__namespace.useMemo(() => {
367
+ return React36__namespace.Children.map(children, (child, index) => {
368
+ const isFirstChild = index == 0;
369
+ const isLastChild = index == childrenCount - 1;
370
+ if (!React36__namespace.isValidElement(child)) return null;
371
+ return /* @__PURE__ */ React36__namespace.createElement(
372
+ SpaceContext.Provider,
373
+ {
374
+ value: {
375
+ classNames: {
376
+ "space-item-first": isFirstChild,
377
+ "space-item-last": isLastChild,
378
+ "space-item": true
379
+ },
380
+ compactItemWrapperAdjust: isLastChild ? "" : "compact-item-wrapper-adjust"
381
+ }
382
+ },
383
+ child
384
+ );
385
+ });
386
+ }, [children]);
387
+ return /* @__PURE__ */ React36__namespace.createElement(
388
+ "div",
389
+ {
390
+ "data-compact": compact,
391
+ style: { ...style, ...styles?.wrapper },
392
+ className: cn(
393
+ "prt-space flex",
394
+ stack ? "flex-col" : "flex-row",
395
+ GAP_CLASS[gap],
396
+ className,
397
+ classNames?.wrapper
398
+ )
399
+ },
400
+ nodes
401
+ );
402
+ }
403
+ function useSpace() {
404
+ return React36__namespace.useContext(SpaceContext);
405
+ }
406
+ var ThemeContext = React36__namespace.createContext(null);
407
+ function ThemeProvider(props) {
408
+ const { children, className, ...themeProps } = props;
409
+ return /* @__PURE__ */ React36__namespace.createElement(ThemeContext.Provider, { value: themeProps }, /* @__PURE__ */ React36__namespace.createElement(
410
+ "div",
411
+ {
412
+ "data-theme": themeProps.appearance,
413
+ "data-radius": themeProps.radius,
414
+ "data-color": themeProps.color,
415
+ className: cn("parrot-theme", className)
416
+ },
417
+ children
418
+ ));
419
+ }
420
+ function useTheme(options) {
421
+ const theme = React36__namespace.useContext(ThemeContext);
422
+ if (!theme && options?.requireThemeProvider)
423
+ throw new Error("No theme found");
424
+ return theme;
425
+ }
426
+
427
+ // src/components/form/field.tsx
428
+ function Field({
429
+ label,
430
+ description,
431
+ error,
432
+ color = "gray",
433
+ radius,
434
+ size = "md",
435
+ className,
436
+ classNames,
437
+ style,
438
+ styles,
439
+ prepend,
440
+ append,
441
+ appearance = "outline",
442
+ validationStatus,
443
+ children,
444
+ replaceDefaultControlWrapper,
445
+ isDisabled,
446
+ wrapperRef,
447
+ ...props
448
+ }) {
449
+ const space = useSpace();
450
+ const theme = useTheme();
451
+ const controlRef = React36__namespace.default.useRef(null);
452
+ const [, groupRef] = reactAriaComponents.useContextProps({}, controlRef, reactAriaComponents.GroupContext);
453
+ return /* @__PURE__ */ React36__namespace.default.createElement(
454
+ "div",
455
+ {
456
+ ref: wrapperRef,
457
+ ...filterDOMProps(props),
458
+ "data-color": color,
459
+ "data-radius": radius ?? theme?.radius ?? "lg",
460
+ "data-size": size,
461
+ className: cn(
462
+ "prt-input-group flex flex-col gap-1",
463
+ space.compactItemWrapperAdjust,
464
+ className,
465
+ classNames?.wrapper
466
+ ),
467
+ style: { ...style, ...styles?.wrapper }
468
+ },
469
+ label && /* @__PURE__ */ React36__namespace.default.createElement(
470
+ InputLabel,
471
+ {
472
+ style: styles?.label,
473
+ className: classNames?.label,
474
+ color
475
+ },
476
+ label
477
+ ),
478
+ !replaceDefaultControlWrapper && /* @__PURE__ */ React36__namespace.default.createElement(
479
+ "div",
480
+ {
481
+ ref: groupRef,
482
+ className: cn(
483
+ "prt-input-control relative inline-flex w-full items-center",
484
+ space.classNames
485
+ ),
486
+ "data-has-error": !!error,
487
+ "data-appearance": appearance,
488
+ "data-disabled": isDisabled
489
+ },
490
+ prepend && /* @__PURE__ */ React36__namespace.default.createElement("div", { className: "add-on add-on-left flex items-center" }, prepend),
491
+ children,
492
+ append && /* @__PURE__ */ React36__namespace.default.createElement("div", { className: "add-on add-on-right flex items-center" }, append)
493
+ ),
494
+ replaceDefaultControlWrapper && children,
495
+ error && /* @__PURE__ */ React36__namespace.default.createElement(InputError, { validationStatus }, error),
496
+ description && /* @__PURE__ */ React36__namespace.default.createElement(
497
+ FieldDescription,
498
+ {
499
+ style: styles?.description,
500
+ className: classNames?.description
501
+ },
502
+ description
503
+ )
504
+ );
505
+ }
506
+ Field.displayName = "Field";
507
+ function FieldDescription({
508
+ children,
509
+ className,
510
+ style
511
+ }) {
512
+ const [merged, ref] = reactAriaComponents.useContextProps(
513
+ { slot: "description" },
514
+ null,
515
+ reactAriaComponents.TextContext
516
+ );
517
+ return /* @__PURE__ */ React36__namespace.default.createElement(
518
+ "div",
519
+ {
520
+ ...merged,
521
+ ref,
522
+ className: cn("prt-input-description", className),
523
+ style
524
+ },
525
+ children
526
+ );
527
+ }
528
+
529
+ // src/components/input/input.tsx
530
+ function Input({
531
+ className,
532
+ classNames,
533
+ style,
534
+ styles,
535
+ onChange,
536
+ inputRef,
537
+ wrapperRef,
538
+ prepend,
539
+ append,
540
+ label,
541
+ description,
542
+ error,
543
+ color,
544
+ size,
545
+ radius,
546
+ appearance,
547
+ validationStatus,
548
+ shape,
549
+ placeholder,
550
+ ...textFieldProps
551
+ }) {
552
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.TextField, { ...textFieldProps, onChange, isInvalid: !!error }, /* @__PURE__ */ React36__namespace.createElement(
553
+ Field,
554
+ {
555
+ className,
556
+ classNames,
557
+ styles,
558
+ style,
559
+ wrapperRef,
560
+ prepend,
561
+ append,
562
+ label,
563
+ description,
564
+ error,
565
+ color,
566
+ size,
567
+ radius,
568
+ appearance,
569
+ validationStatus
570
+ },
571
+ /* @__PURE__ */ React36__namespace.createElement(
572
+ reactAriaComponents.Input,
573
+ {
574
+ ref: inputRef,
575
+ placeholder,
576
+ "data-has-left-addon": !!prepend,
577
+ "data-has-right-addon": !!append,
578
+ style: styles?.input,
579
+ className: cn("prt-text-input-el", classNames?.input)
580
+ }
581
+ )
582
+ ));
583
+ }
584
+ function Loader({
585
+ color,
586
+ className,
587
+ classNames,
588
+ style,
589
+ styles,
590
+ size = "sm",
591
+ label = "Loading",
592
+ ref,
593
+ ...props
594
+ }) {
595
+ const theme = useTheme();
596
+ const resolvedColor = color ?? theme?.color;
597
+ const id2 = React36__namespace.useId();
598
+ return /* @__PURE__ */ React36__namespace.createElement(
599
+ "div",
600
+ {
601
+ "data-color": resolvedColor,
602
+ className: cn("prt-loader", className, classNames?.wrapper),
603
+ style: { ...style, ...styles?.wrapper },
604
+ role: "status",
605
+ "aria-label": label,
606
+ ref,
607
+ ...props
608
+ },
609
+ /* @__PURE__ */ React36__namespace.createElement(
610
+ "svg",
611
+ {
612
+ className: cn("prt-loader-icon", classNames?.icon),
613
+ style: styles?.icon,
614
+ "data-size": size,
615
+ viewBox: "0 0 24 24",
616
+ "aria-hidden": "true"
617
+ },
618
+ /* @__PURE__ */ React36__namespace.createElement("defs", null, /* @__PURE__ */ React36__namespace.createElement(
619
+ "linearGradient",
620
+ {
621
+ id: `${id2}-a`,
622
+ x1: "50%",
623
+ x2: "50%",
624
+ y1: "5.271%",
625
+ y2: "91.793%"
626
+ },
627
+ /* @__PURE__ */ React36__namespace.createElement("stop", { offset: "0%", stopColor: "currentColor" }),
628
+ /* @__PURE__ */ React36__namespace.createElement("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0.55" })
629
+ ), /* @__PURE__ */ React36__namespace.createElement(
630
+ "linearGradient",
631
+ {
632
+ id: `${id2}-b`,
633
+ x1: "50%",
634
+ x2: "50%",
635
+ y1: "15.24%",
636
+ y2: "87.15%"
637
+ },
638
+ /* @__PURE__ */ React36__namespace.createElement("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "0" }),
639
+ /* @__PURE__ */ React36__namespace.createElement("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0.55" })
640
+ )),
641
+ /* @__PURE__ */ React36__namespace.createElement("g", { fill: "none" }, /* @__PURE__ */ React36__namespace.createElement(
642
+ "path",
643
+ {
644
+ d: "M8.749.021a1.5 1.5 0 0 1 .497 2.958A7.5 7.5 0 0 0 3 10.375a7.5 7.5 0 0 0 7.5 7.5v3c-5.799 0-10.5-4.7-10.5-10.5C0 5.23 3.726.865 8.749.021",
645
+ fill: `url(#${id2}-a)`,
646
+ transform: "translate(1.5 1.625)"
647
+ }
648
+ ), /* @__PURE__ */ React36__namespace.createElement(
649
+ "path",
650
+ {
651
+ d: "M15.392 2.673a1.5 1.5 0 0 1 2.119-.115A10.48 10.48 0 0 1 21 10.375c0 5.8-4.701 10.5-10.5 10.5v-3a7.5 7.5 0 0 0 5.007-13.084a1.5 1.5 0 0 1-.115-2.118",
652
+ fill: `url(#${id2}-b)`,
653
+ transform: "translate(1.5 1.625)"
654
+ }
655
+ ))
656
+ )
657
+ );
658
+ }
659
+
660
+ // src/utils/object.ts
661
+ function omitNullOrUndefined(object) {
662
+ return Object.keys(object).reduce((obj, key) => {
663
+ if (object[key] == null) {
664
+ return { ...obj };
665
+ }
666
+ return {
667
+ ...obj,
668
+ [key]: object[key]
669
+ };
670
+ }, {});
671
+ }
672
+
673
+ // src/components/button/button-group.tsx
674
+ var ButtonGroupContext = React36__namespace.createContext({});
675
+ function ButtonGroup({
676
+ color,
677
+ variant,
678
+ size,
679
+ compact,
680
+ radius,
681
+ gap,
682
+ children,
683
+ className,
684
+ classNames,
685
+ style,
686
+ styles
687
+ }) {
688
+ const cleanProps = omitNullOrUndefined({
689
+ color,
690
+ variant,
691
+ size,
692
+ radius
693
+ });
694
+ return /* @__PURE__ */ React36__namespace.createElement(ButtonGroupContext.Provider, { value: cleanProps }, /* @__PURE__ */ React36__namespace.createElement(
695
+ Space,
696
+ {
697
+ className,
698
+ classNames,
699
+ style,
700
+ styles,
701
+ gap,
702
+ compact
703
+ },
704
+ children
705
+ ));
706
+ }
707
+ function useButtonGroup() {
708
+ return React36__namespace.useContext(ButtonGroupContext);
709
+ }
710
+
711
+ // src/components/button/button.tsx
712
+ function Button(props) {
713
+ const space = useSpace();
714
+ const buttonGroupProps = useButtonGroup();
715
+ const theme = useTheme();
716
+ const {
717
+ color = theme?.color ?? "primary",
718
+ variant = "solid",
719
+ append,
720
+ prepend,
721
+ size = "md",
722
+ children,
723
+ className,
724
+ isLoading,
725
+ radius = "full",
726
+ isIconButton,
727
+ style,
728
+ classNames,
729
+ styles,
730
+ ...otherProps
731
+ } = { ...buttonGroupProps, ...props };
732
+ return /* @__PURE__ */ React36__namespace.createElement(
733
+ reactAriaComponents.Button,
734
+ {
735
+ style: { ...style, ...styles?.wrapper },
736
+ "data-size": size,
737
+ "data-radius": radius,
738
+ "data-icon-button": isIconButton,
739
+ "data-loading": isLoading,
740
+ "aria-busy": isLoading,
741
+ "data-color": color,
742
+ "data-variant": variant,
743
+ className: cn(
744
+ "prt-button prt-size",
745
+ space.classNames,
746
+ className,
747
+ classNames?.wrapper
748
+ ),
749
+ ...otherProps
750
+ },
751
+ prepend,
752
+ isIconButton && isLoading ? null : children,
753
+ isLoading ? /* @__PURE__ */ React36__namespace.createElement(
754
+ Loader,
755
+ {
756
+ color,
757
+ className: cn("prt-button-loader", classNames?.loader),
758
+ style: styles?.loader,
759
+ size: "xs"
760
+ }
761
+ ) : append
762
+ );
763
+ }
764
+ function IconButton({ children, ...props }) {
765
+ return /* @__PURE__ */ React36__namespace.default.createElement(Button, { isIconButton: true, ...props }, children);
766
+ }
767
+ var ToggleButtonGroupContext = React36__namespace.createContext({});
768
+ function ToggleButton({
769
+ idleColor,
770
+ idleVariant,
771
+ activeColor,
772
+ activeVariant,
773
+ append,
774
+ prepend,
775
+ size,
776
+ radius,
777
+ isIconButton,
778
+ className,
779
+ classNames,
780
+ style,
781
+ styles,
782
+ children,
783
+ ...props
784
+ }) {
785
+ const space = useSpace();
786
+ const theme = useTheme();
787
+ const group = React36__namespace.useContext(ToggleButtonGroupContext);
788
+ const _idleColor = idleColor ?? group.idleColor ?? "gray";
789
+ const _idleVariant = idleVariant ?? group.idleVariant ?? "outline";
790
+ const _activeColor = activeColor ?? group.activeColor ?? theme?.color ?? "primary";
791
+ const _activeVariant = activeVariant ?? group.activeVariant ?? "solid";
792
+ const _size = size ?? group.size ?? "md";
793
+ const _radius = radius ?? group.radius ?? "full";
794
+ const _isIconButton = isIconButton ?? group.isIconButton;
795
+ return /* @__PURE__ */ React36__namespace.createElement(
796
+ reactAriaComponents.ToggleButton,
797
+ {
798
+ ...props,
799
+ className: cn(
800
+ "prt-button prt-size",
801
+ space.classNames,
802
+ className,
803
+ classNames?.wrapper
804
+ ),
805
+ style: { ...style, ...styles?.wrapper },
806
+ render: (domProps, { isSelected }) => /* @__PURE__ */ React36__namespace.createElement(
807
+ "button",
808
+ {
809
+ ...domProps,
810
+ "data-is-toggle": "true",
811
+ "data-size": _size,
812
+ "data-radius": _radius,
813
+ "data-icon-button": _isIconButton,
814
+ "data-color": isSelected ? _activeColor : _idleColor,
815
+ "data-variant": isSelected ? _activeVariant : _idleVariant
816
+ },
817
+ prepend,
818
+ children,
819
+ append
820
+ )
821
+ }
822
+ );
823
+ }
824
+
825
+ // src/components/input/number-input.tsx
826
+ function NumberInput({
827
+ appearance = "outline",
828
+ size = "md",
829
+ color = "gray",
830
+ classNames,
831
+ styles,
832
+ append,
833
+ prepend,
834
+ placeholder,
835
+ showSteppers = false,
836
+ error,
837
+ label,
838
+ description,
839
+ incrementIcon,
840
+ decrementIcon,
841
+ inputRef,
842
+ wrapperRef,
843
+ validationStatus,
844
+ shape,
845
+ radius,
846
+ ...props
847
+ }) {
848
+ const space = useSpace();
849
+ return /* @__PURE__ */ React36__namespace.createElement(
850
+ reactAriaComponents.NumberField,
851
+ {
852
+ ...props,
853
+ isInvalid: !!error,
854
+ "aria-label": props["aria-label"] ?? "number input"
855
+ },
856
+ /* @__PURE__ */ React36__namespace.createElement(
857
+ Field,
858
+ {
859
+ classNames,
860
+ color,
861
+ size,
862
+ radius,
863
+ error,
864
+ label,
865
+ description,
866
+ validationStatus,
867
+ replaceDefaultControlWrapper: true
868
+ },
869
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Group, { className: "prt-input-container", style: { display: "flex", gap: 4 } }, showSteppers && /* @__PURE__ */ React36__namespace.createElement(
870
+ IconButton,
871
+ {
872
+ slot: "decrement",
873
+ radius: "md",
874
+ color,
875
+ variant: "outline",
876
+ size,
877
+ className: classNames?.decrement,
878
+ style: styles?.decrement
879
+ },
880
+ decrementIcon
881
+ ), /* @__PURE__ */ React36__namespace.createElement(
882
+ reactAriaComponents.Input,
883
+ {
884
+ style: styles?.input,
885
+ ref: inputRef,
886
+ placeholder,
887
+ className: cn(
888
+ classNames?.input,
889
+ "prt-input-control",
890
+ "space-item",
891
+ space.classNames
892
+ ),
893
+ "data-appearance": appearance,
894
+ "data-has-left-addon": !!prepend,
895
+ "data-has-right-addon": !!append
896
+ }
897
+ ), showSteppers && /* @__PURE__ */ React36__namespace.createElement(
898
+ IconButton,
899
+ {
900
+ slot: "increment",
901
+ radius: "md",
902
+ color,
903
+ variant: "outline",
904
+ size,
905
+ className: classNames?.increment,
906
+ style: styles?.increment
907
+ },
908
+ incrementIcon
909
+ ))
910
+ )
911
+ );
912
+ }
913
+ function HiCheck({ size = "1em", ...props }) {
914
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", clipRule: "evenodd" }));
915
+ }
916
+ function HiChevronDown({ size = "1em", ...props }) {
917
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }));
918
+ }
919
+ function HiChevronLeft({ size = "1em", ...props }) {
920
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z", clipRule: "evenodd" }));
921
+ }
922
+ function HiChevronRight({ size = "1em", ...props }) {
923
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" }));
924
+ }
925
+ function HiChevronUp({ size = "1em", ...props }) {
926
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293 3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 010 1.414z", clipRule: "evenodd" }));
927
+ }
928
+ function HiOutlineCalendar({ size = "1em", ...props }) {
929
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }));
930
+ }
931
+ function HiOutlineCheckCircle({ size = "1em", ...props }) {
932
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }));
933
+ }
934
+ function HiOutlineDocumentAdd({ size = "1em", ...props }) {
935
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 13h6m-3-3v6m5 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }));
936
+ }
937
+ function HiOutlineExclamationCircle({ size = "1em", ...props }) {
938
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }));
939
+ }
940
+ function HiOutlinePaperClip({ size = "1em", ...props }) {
941
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13" }));
942
+ }
943
+ function HiOutlineRefresh({ size = "1em", ...props }) {
944
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }));
945
+ }
946
+ function HiOutlineTrash({ size = "1em", ...props }) {
947
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }));
948
+ }
949
+ function HiSelector({ size = "1em", ...props }) {
950
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z", clipRule: "evenodd" }));
951
+ }
952
+ function HiX({ size = "1em", ...props }) {
953
+ return /* @__PURE__ */ React36__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React36__namespace.createElement("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }));
954
+ }
955
+
956
+ // src/utils/theme.ts
957
+ var supportedColors = [
958
+ "red",
959
+ "orange",
960
+ "amber",
961
+ "yellow",
962
+ "lime",
963
+ "green",
964
+ "emerald",
965
+ "teal",
966
+ "cyan",
967
+ "sky",
968
+ "blue",
969
+ "indigo",
970
+ "violet",
971
+ "purple",
972
+ "fuchsia",
973
+ "pink",
974
+ "rose",
975
+ "slate",
976
+ "gray",
977
+ "zinc",
978
+ "neutral",
979
+ "stone"
980
+ ];
981
+
982
+ // src/utils/helpers.ts
983
+ function warnDeprecation(deprecatedProp, newProp, value) {
984
+ if (!isUndefinedOrNull(value)) {
985
+ console.warn(
986
+ `${deprecatedProp} is deprecated and will be removed in a future release. ${`Please use ${newProp} instead.` }`
987
+ );
988
+ }
989
+ }
990
+ function hashCode(text) {
991
+ const str = String(text);
992
+ let hash = 0;
993
+ let char;
994
+ if (str.trim().length === 0) return hash;
995
+ for (let i = 0; i < str.length; i++) {
996
+ char = str.charCodeAt(i);
997
+ hash = (hash << 5) - hash + char;
998
+ hash &= hash;
999
+ }
1000
+ return Math.abs(hash);
1001
+ }
1002
+ function id() {
1003
+ return Math.random().toString(36);
1004
+ }
1005
+ function getRandomColor(string) {
1006
+ const hash = hashCode(string);
1007
+ return supportedColors[hash % supportedColors.length];
1008
+ }
1009
+ function breakpointClassNames(prefix, value) {
1010
+ if (!value) return "";
1011
+ if (typeof value === "string" || typeof value === "number") {
1012
+ return `${prefix}-${value}`;
1013
+ }
1014
+ let classNames = "";
1015
+ for (const key of Object.keys(value)) {
1016
+ const breakpoint = key;
1017
+ const breakpointValue = value[breakpoint];
1018
+ if (breakpointValue) {
1019
+ classNames && (classNames += " ");
1020
+ classNames += breakpoint === "base" ? `${prefix}-${breakpointValue}` : `${breakpoint}:${prefix}-${breakpointValue}`;
1021
+ }
1022
+ }
1023
+ return classNames;
1024
+ }
1025
+
1026
+ // src/components/text/text.tsx
1027
+ function Text({
1028
+ textCase,
1029
+ size = "sm",
1030
+ weight,
1031
+ color = "gray",
1032
+ variant = "default",
1033
+ highlight,
1034
+ align,
1035
+ lineHeight,
1036
+ underline,
1037
+ italic,
1038
+ as: Comp = "span",
1039
+ className,
1040
+ ...rest
1041
+ }) {
1042
+ return /* @__PURE__ */ React36__namespace.createElement(
1043
+ Comp,
1044
+ {
1045
+ className: cn(
1046
+ "prt-text",
1047
+ className,
1048
+ {
1049
+ [`text-highlight`]: !!highlight,
1050
+ [`text-weight-${weight}`]: !!weight,
1051
+ [`text-align-${align}`]: !!align,
1052
+ [`text-line-height-${lineHeight}`]: !!lineHeight,
1053
+ [`text-transform-${textCase}`]: !!textCase
1054
+ },
1055
+ breakpointClassNames("text-size", size)
1056
+ ),
1057
+ "data-underline": underline,
1058
+ "data-italic": italic,
1059
+ "data-color": color,
1060
+ "data-color-variant": variant,
1061
+ ...rest
1062
+ }
1063
+ );
1064
+ }
1065
+ function Textarea({
1066
+ appearance = "outline",
1067
+ resize,
1068
+ label,
1069
+ description,
1070
+ error,
1071
+ color = "gray",
1072
+ radius,
1073
+ size,
1074
+ className,
1075
+ classNames,
1076
+ styles,
1077
+ style,
1078
+ prepend,
1079
+ append,
1080
+ validationStatus,
1081
+ shape,
1082
+ inputRef,
1083
+ wrapperRef,
1084
+ placeholder,
1085
+ rows,
1086
+ isDisabled,
1087
+ ...textFieldProps
1088
+ }) {
1089
+ const theme = useTheme();
1090
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.TextField, { ...textFieldProps, isDisabled, isInvalid: !!error }, /* @__PURE__ */ React36__namespace.createElement(
1091
+ Field,
1092
+ {
1093
+ label,
1094
+ description,
1095
+ error,
1096
+ color,
1097
+ size,
1098
+ radius: radius ?? theme?.radius ?? "lg",
1099
+ validationStatus,
1100
+ style,
1101
+ styles,
1102
+ classNames,
1103
+ replaceDefaultControlWrapper: true
1104
+ },
1105
+ /* @__PURE__ */ React36__namespace.createElement(
1106
+ reactAriaComponents.TextArea,
1107
+ {
1108
+ placeholder,
1109
+ rows,
1110
+ disabled: isDisabled,
1111
+ className: cn("prt-input-control", "prt-text-area", className),
1112
+ "data-has-error": !!error,
1113
+ "data-resize": resize,
1114
+ "data-appearance": appearance,
1115
+ style: styles?.input
1116
+ }
1117
+ )
1118
+ ));
1119
+ }
1120
+ var CheckboxGroupVariantContext = React36__namespace.createContext(null);
1121
+ function CheckboxGroup({
1122
+ children,
1123
+ label,
1124
+ description,
1125
+ errorMessage,
1126
+ size,
1127
+ appearance,
1128
+ color,
1129
+ radius,
1130
+ shape,
1131
+ ...props
1132
+ }) {
1133
+ const variants = React36__namespace.useMemo(
1134
+ () => ({ size, appearance, color, radius, shape }),
1135
+ [size, appearance, color, radius, shape]
1136
+ );
1137
+ return /* @__PURE__ */ React36__namespace.createElement(
1138
+ reactAriaComponents.CheckboxGroup,
1139
+ {
1140
+ ...props,
1141
+ "aria-label": typeof label === "string" ? label : void 0
1142
+ },
1143
+ /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-2" }, label && /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm font-medium text-gray-700" }, label), /* @__PURE__ */ React36__namespace.createElement(CheckboxGroupVariantContext.Provider, { value: variants }, children), description && /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-xs leading-normal text-gray-400" }, description), errorMessage && /* @__PURE__ */ React36__namespace.createElement(InputError, null, errorMessage))
1144
+ );
1145
+ }
1146
+
1147
+ // src/components/checkbox/checkbox.tsx
1148
+ function getRadius(shape) {
1149
+ if (shape === "sharp") return "none";
1150
+ if (shape === "round") return "md";
1151
+ return void 0;
1152
+ }
1153
+ function Checkbox({
1154
+ appearance,
1155
+ size,
1156
+ shape,
1157
+ radius,
1158
+ color,
1159
+ className,
1160
+ classNames,
1161
+ styles,
1162
+ style,
1163
+ children,
1164
+ ...props
1165
+ }) {
1166
+ const group = React36__namespace.useContext(CheckboxGroupVariantContext);
1167
+ const resolvedColor = color ?? group?.color ?? "primary";
1168
+ const resolvedAppearance = appearance ?? group?.appearance ?? "outline";
1169
+ const resolvedSize = size ?? group?.size ?? "md";
1170
+ const resolvedRadius = radius ?? group?.radius ?? getRadius(shape ?? group?.shape) ?? "md";
1171
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CheckboxField, { ...props }, /* @__PURE__ */ React36__namespace.createElement(
1172
+ reactAriaComponents.CheckboxButton,
1173
+ {
1174
+ style: { ...style, ...styles?.wrapper },
1175
+ className: cn(className, "prt-checkbox", classNames?.wrapper)
1176
+ },
1177
+ ({ isSelected, isIndeterminate, isFocusVisible }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, /* @__PURE__ */ React36__namespace.createElement(
1178
+ "div",
1179
+ {
1180
+ style: styles?.checkbox,
1181
+ "data-color": resolvedColor,
1182
+ "data-variant": isSelected || isIndeterminate ? "solid" : void 0,
1183
+ "data-radius": resolvedRadius,
1184
+ className: cn(["prt-fake-checkbox", classNames?.checkbox]),
1185
+ "data-focused": isFocusVisible,
1186
+ "data-checked": isSelected && !isIndeterminate,
1187
+ "data-indeterminate": isIndeterminate,
1188
+ "data-size": resolvedSize,
1189
+ "data-appearance": isSelected || isIndeterminate ? void 0 : resolvedAppearance,
1190
+ "aria-hidden": "true"
1191
+ },
1192
+ isSelected && !isIndeterminate && /* @__PURE__ */ React36__namespace.createElement(
1193
+ "svg",
1194
+ {
1195
+ className: cn("prt-checkbox-icon", classNames?.icon),
1196
+ xmlns: "http://www.w3.org/2000/svg",
1197
+ viewBox: "6 7 12 10",
1198
+ fill: "none",
1199
+ stroke: "currentColor",
1200
+ strokeWidth: "2",
1201
+ strokeLinecap: "round",
1202
+ strokeLinejoin: "round"
1203
+ },
1204
+ /* @__PURE__ */ React36__namespace.createElement("path", { d: "M9 12l2 2l4 -4" })
1205
+ ),
1206
+ isIndeterminate && /* @__PURE__ */ React36__namespace.createElement(
1207
+ "div",
1208
+ {
1209
+ className: cn(["prt-checkbox-icon", classNames?.icon]),
1210
+ style: {
1211
+ background: "currentColor",
1212
+ width: "70%",
1213
+ height: 2,
1214
+ borderRadius: 4
1215
+ }
1216
+ }
1217
+ )
1218
+ ), children)
1219
+ ));
1220
+ }
1221
+ function CheckboxItem({
1222
+ className,
1223
+ classNames,
1224
+ styles,
1225
+ style,
1226
+ children,
1227
+ ...props
1228
+ }) {
1229
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CheckboxField, { ...props }, /* @__PURE__ */ React36__namespace.createElement(
1230
+ reactAriaComponents.CheckboxButton,
1231
+ {
1232
+ style: { ...style, ...styles?.wrapper },
1233
+ className: cn(className, "prt-checkbox-item", classNames?.wrapper)
1234
+ },
1235
+ children
1236
+ ));
1237
+ }
1238
+ function Menu({ children, ...props }) {
1239
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.MenuTrigger, { ...props }, children);
1240
+ }
1241
+ function MenuTrigger({ asChild, children }) {
1242
+ if (asChild) {
1243
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Pressable, null, children);
1244
+ }
1245
+ return /* @__PURE__ */ React36__namespace.createElement(Button, null, children);
1246
+ }
1247
+ function px(value) {
1248
+ if (value == null) return void 0;
1249
+ return typeof value === "number" ? `${value}px` : value;
1250
+ }
1251
+ function MenuContent({
1252
+ children,
1253
+ menuHeader,
1254
+ menuFooter,
1255
+ minWidth = 200,
1256
+ maxHeight = 300,
1257
+ maxWidth,
1258
+ placement = "bottom start",
1259
+ offset = 8,
1260
+ color,
1261
+ classNames,
1262
+ styles,
1263
+ className,
1264
+ style,
1265
+ ...props
1266
+ }) {
1267
+ const theme = useTheme();
1268
+ const dataColor = color ?? theme?.color ?? "violet";
1269
+ const dataRadius = theme?.radius ?? "lg";
1270
+ const header = typeof menuHeader === "function" ? menuHeader() : menuHeader;
1271
+ const footer = typeof menuFooter === "function" ? menuFooter() : menuFooter;
1272
+ return /* @__PURE__ */ React36__namespace.createElement(
1273
+ reactAriaComponents.Popover,
1274
+ {
1275
+ placement,
1276
+ offset,
1277
+ "data-color": dataColor,
1278
+ "data-radius": dataRadius,
1279
+ className: cn("prt-popover", classNames?.popover),
1280
+ style: { ...styles?.popover }
1281
+ },
1282
+ /* @__PURE__ */ React36__namespace.createElement(
1283
+ "div",
1284
+ {
1285
+ "data-color": dataColor,
1286
+ "data-radius": dataRadius,
1287
+ className: cn("prt-list-box-wrapper", classNames?.wrapper, className),
1288
+ style: {
1289
+ minWidth: typeof minWidth === "number" ? `max(200px, ${minWidth}px)` : minWidth,
1290
+ maxWidth: px(maxWidth),
1291
+ maxHeight: px(maxHeight),
1292
+ ...styles?.wrapper,
1293
+ ...style
1294
+ }
1295
+ },
1296
+ header,
1297
+ /* @__PURE__ */ React36__namespace.createElement(
1298
+ reactAriaComponents.Menu,
1299
+ {
1300
+ ...props,
1301
+ className: cn("prt-menu-list", classNames?.list),
1302
+ style: { ...styles?.list }
1303
+ },
1304
+ children
1305
+ ),
1306
+ footer
1307
+ )
1308
+ );
1309
+ }
1310
+ function MenuItem({
1311
+ children,
1312
+ icon,
1313
+ label,
1314
+ description,
1315
+ color,
1316
+ isReadOnly,
1317
+ className,
1318
+ style,
1319
+ textValue,
1320
+ ...props
1321
+ }) {
1322
+ const resolvedTextValue = textValue ?? (typeof label === "string" ? label : void 0) ?? (typeof children === "string" ? children : void 0);
1323
+ return /* @__PURE__ */ React36__namespace.createElement(
1324
+ reactAriaComponents.MenuItem,
1325
+ {
1326
+ ...props,
1327
+ textValue: resolvedTextValue,
1328
+ "data-color": color,
1329
+ "data-readonly": isReadOnly || void 0,
1330
+ style,
1331
+ className: cn(className, "prt-list-option prt-menu-item")
1332
+ },
1333
+ ({ isSelected }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-3" }, icon && /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex gap-3 prt-list-option-icon-wrapper" }, React36__namespace.isValidElement(icon) && React36__namespace.cloneElement(icon, {
1334
+ className: "prt-list-option-icon",
1335
+ size: 18,
1336
+ ...icon.props
1337
+ })), /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ React36__namespace.createElement("div", { slot: "label", className: "text-sm text-black" }, label ?? children), description && /* @__PURE__ */ React36__namespace.createElement(
1338
+ "div",
1339
+ {
1340
+ slot: "description",
1341
+ className: "text-sm leading-normal text-gray-500"
1342
+ },
1343
+ description
1344
+ ))), isSelected && /* @__PURE__ */ React36__namespace.createElement(HiCheck, { className: "selected-marker" }))
1345
+ );
1346
+ }
1347
+ function MenuSection({
1348
+ title,
1349
+ children,
1350
+ className,
1351
+ ...props
1352
+ }) {
1353
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.MenuSection, { ...props, className: cn(className, "prt-list-section") }, title && /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Header, { className: "prt-list-section-header" }, title), children);
1354
+ }
1355
+ var ListBoxConfigContext = React36__namespace.createContext({
1356
+ showSelectionIndicator: true
1357
+ });
1358
+ function ListBox({
1359
+ items,
1360
+ children,
1361
+ labelKey = "label",
1362
+ valueKey = "id",
1363
+ sectionKey,
1364
+ color = "gray",
1365
+ width,
1366
+ showSectionSeparator = true,
1367
+ showSelectionIndicator = true,
1368
+ renderOption,
1369
+ renderSelectionIndicator,
1370
+ renderSectionLabel,
1371
+ renderEmpty,
1372
+ className,
1373
+ classNames,
1374
+ style,
1375
+ styles,
1376
+ listBoxRef,
1377
+ ...props
1378
+ }) {
1379
+ const theme = useTheme();
1380
+ const config = React36__namespace.useMemo(
1381
+ () => ({
1382
+ showSelectionIndicator,
1383
+ renderSelectionIndicator
1384
+ }),
1385
+ [showSelectionIndicator, renderSelectionIndicator]
1386
+ );
1387
+ function renderItem(item) {
1388
+ const record = item;
1389
+ const id2 = record[valueKey];
1390
+ const label = record[labelKey];
1391
+ if (sectionKey && record[sectionKey]) {
1392
+ return /* @__PURE__ */ React36__namespace.createElement(
1393
+ ListBoxSection,
1394
+ {
1395
+ id: id2,
1396
+ title: renderSectionLabel?.(item) ?? label
1397
+ },
1398
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Collection, { items: record[sectionKey] }, (child) => {
1399
+ const childRecord = child;
1400
+ return /* @__PURE__ */ React36__namespace.createElement(
1401
+ ListBoxItem,
1402
+ {
1403
+ id: childRecord[valueKey],
1404
+ textValue: childRecord[labelKey]
1405
+ },
1406
+ renderOption?.(child) ?? childRecord[labelKey]
1407
+ );
1408
+ })
1409
+ );
1410
+ }
1411
+ return /* @__PURE__ */ React36__namespace.createElement(ListBoxItem, { id: id2, textValue: label }, renderOption?.(item) ?? label);
1412
+ }
1413
+ const listBoxChildren = children ?? renderItem;
1414
+ return /* @__PURE__ */ React36__namespace.createElement(ListBoxConfigContext.Provider, { value: config }, /* @__PURE__ */ React36__namespace.createElement(
1415
+ reactAriaComponents.ListBox,
1416
+ {
1417
+ ...props,
1418
+ ref: listBoxRef,
1419
+ items,
1420
+ className: cn("prt-list-box-wrapper", classNames?.wrapper, className),
1421
+ "data-radius": theme?.radius ?? "lg",
1422
+ "data-color": color,
1423
+ "data-section-separator": showSectionSeparator,
1424
+ style: { width, ...style, ...styles?.wrapper },
1425
+ renderEmptyState: () => /* @__PURE__ */ React36__namespace.createElement(
1426
+ "div",
1427
+ {
1428
+ className: "flex items-center justify-center gap-3",
1429
+ style: { height: 50 }
1430
+ },
1431
+ renderEmpty?.() ?? /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-gray-400" }, "No options")
1432
+ )
1433
+ },
1434
+ listBoxChildren
1435
+ ));
1436
+ }
1437
+ function ListBoxItem({
1438
+ color,
1439
+ variant,
1440
+ className,
1441
+ showSelectionIndicator,
1442
+ children,
1443
+ textValue,
1444
+ ...props
1445
+ }) {
1446
+ const config = React36__namespace.useContext(ListBoxConfigContext);
1447
+ const showIndicator = showSelectionIndicator ?? config.showSelectionIndicator;
1448
+ const resolvedTextValue = textValue ?? (typeof children === "string" ? children : void 0);
1449
+ return /* @__PURE__ */ React36__namespace.createElement(
1450
+ reactAriaComponents.ListBoxItem,
1451
+ {
1452
+ ...props,
1453
+ textValue: resolvedTextValue,
1454
+ className: cn("prt-list-option", className),
1455
+ "data-color": color,
1456
+ "data-variant": variant
1457
+ },
1458
+ reactAriaComponents.composeRenderProps(
1459
+ children,
1460
+ (rendered, renderProps) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, rendered, renderProps.isSelected && showIndicator && /* @__PURE__ */ React36__namespace.createElement("span", { className: "selection-indicator" }, config.renderSelectionIndicator?.(
1461
+ props.value ?? props
1462
+ ) ?? /* @__PURE__ */ React36__namespace.createElement(HiCheck, { size: 16 })))
1463
+ )
1464
+ );
1465
+ }
1466
+ function ListBoxSection({
1467
+ title,
1468
+ className,
1469
+ children,
1470
+ ...props
1471
+ }) {
1472
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.ListBoxSection, { ...props, className: cn("prt-list-section", className) }, title && /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Header, { className: "prt-list-section-header" }, title), children);
1473
+ }
1474
+
1475
+ // src/components/combo-box/combo-box.tsx
1476
+ function ComboBox({
1477
+ description,
1478
+ error,
1479
+ label,
1480
+ selectorIcon = /* @__PURE__ */ React36__namespace.createElement(HiSelector, { size: 18 }),
1481
+ selectorSize = "sm",
1482
+ style,
1483
+ styles,
1484
+ className,
1485
+ classNames,
1486
+ isLoading,
1487
+ loadData,
1488
+ loadingIndicator = /* @__PURE__ */ React36__namespace.createElement(Loader, { size: "xs" }),
1489
+ items,
1490
+ defaultItems,
1491
+ inputValue,
1492
+ onInputChange,
1493
+ placeholder,
1494
+ prepend,
1495
+ append,
1496
+ color,
1497
+ size,
1498
+ radius,
1499
+ appearance,
1500
+ labelKey,
1501
+ valueKey,
1502
+ sectionKey,
1503
+ renderOption,
1504
+ renderSectionLabel,
1505
+ children,
1506
+ ...props
1507
+ }) {
1508
+ const list = reactAriaComponents.useAsyncList({
1509
+ async load({ filterText, signal }) {
1510
+ if (loadData) {
1511
+ return { items: await loadData(filterText, signal) };
1512
+ }
1513
+ return { items: [] };
1514
+ }
1515
+ });
1516
+ const { contains } = reactAriaComponents.useFilter({ sensitivity: "base" });
1517
+ const usingAsync = !!loadData;
1518
+ const comboItems = usingAsync ? list.items : items;
1519
+ const comboInputValue = usingAsync ? list.filterText : inputValue;
1520
+ const loading = usingAsync ? list.isLoading : isLoading;
1521
+ function handleInputChange(value) {
1522
+ if (usingAsync) list.setFilterText(value);
1523
+ onInputChange?.(value);
1524
+ }
1525
+ const comboBoxProps = {
1526
+ ...props,
1527
+ items: comboItems,
1528
+ defaultItems,
1529
+ inputValue: comboInputValue,
1530
+ onInputChange: handleInputChange,
1531
+ isInvalid: !!error,
1532
+ defaultFilter: contains
1533
+ };
1534
+ return /* @__PURE__ */ React36__namespace.createElement(
1535
+ reactAriaComponents.ComboBox,
1536
+ {
1537
+ ...comboBoxProps,
1538
+ className: cn("prt-combo-box", className, classNames?.wrapper)
1539
+ },
1540
+ /* @__PURE__ */ React36__namespace.createElement(
1541
+ Field,
1542
+ {
1543
+ styles,
1544
+ classNames,
1545
+ style,
1546
+ label,
1547
+ description,
1548
+ error,
1549
+ color,
1550
+ size,
1551
+ radius,
1552
+ appearance,
1553
+ prepend,
1554
+ append
1555
+ },
1556
+ /* @__PURE__ */ React36__namespace.createElement(
1557
+ reactAriaComponents.Input,
1558
+ {
1559
+ placeholder,
1560
+ style: styles?.input,
1561
+ className: cn(
1562
+ "prt-text-input-el",
1563
+ "prt-combo-box-input",
1564
+ classNames?.input
1565
+ )
1566
+ }
1567
+ ),
1568
+ /* @__PURE__ */ React36__namespace.createElement(
1569
+ IconButton,
1570
+ {
1571
+ className: cn("prt-combo-box-button", classNames?.button),
1572
+ style: styles?.button,
1573
+ variant: "ghost",
1574
+ color: "gray",
1575
+ size: selectorSize
1576
+ },
1577
+ loading ? loadingIndicator : selectorIcon
1578
+ )
1579
+ ),
1580
+ /* @__PURE__ */ React36__namespace.createElement(
1581
+ reactAriaComponents.Popover,
1582
+ {
1583
+ offset: 6,
1584
+ className: cn(
1585
+ "prt-popover",
1586
+ "prt-combo-box-popover",
1587
+ classNames?.popover
1588
+ ),
1589
+ style: styles?.popover
1590
+ },
1591
+ /* @__PURE__ */ React36__namespace.createElement(
1592
+ ListBox,
1593
+ {
1594
+ items: comboItems,
1595
+ labelKey,
1596
+ valueKey,
1597
+ sectionKey,
1598
+ renderOption,
1599
+ renderSectionLabel,
1600
+ width: "var(--trigger-width)"
1601
+ },
1602
+ children
1603
+ )
1604
+ )
1605
+ );
1606
+ }
1607
+ function Radio({
1608
+ size = "sm",
1609
+ className,
1610
+ style,
1611
+ appearance,
1612
+ color,
1613
+ children,
1614
+ ...props
1615
+ }) {
1616
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.RadioField, { ...props }, /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.RadioButton, { style, className: cn("prt-radio", className) }, ({ isSelected }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, /* @__PURE__ */ React36__namespace.createElement(
1617
+ "div",
1618
+ {
1619
+ "data-color": color,
1620
+ className: "prt-fake-radio",
1621
+ "data-appearance": appearance,
1622
+ "data-checked": isSelected,
1623
+ "data-size": size
1624
+ }
1625
+ ), children)));
1626
+ }
1627
+ function RadioGroup({
1628
+ className,
1629
+ classNames,
1630
+ style,
1631
+ styles,
1632
+ label,
1633
+ description,
1634
+ errorMessage,
1635
+ children,
1636
+ ...props
1637
+ }) {
1638
+ const isHorizontal = props.orientation === "horizontal";
1639
+ return /* @__PURE__ */ React36__namespace.createElement(
1640
+ reactAriaComponents.RadioGroup,
1641
+ {
1642
+ ...props,
1643
+ "aria-label": typeof label === "string" ? label : void 0
1644
+ },
1645
+ /* @__PURE__ */ React36__namespace.createElement(
1646
+ "div",
1647
+ {
1648
+ style: { ...style, ...styles?.wrapper },
1649
+ className: cn(
1650
+ "prt-radio-group flex flex-col gap-2",
1651
+ className,
1652
+ classNames?.wrapper
1653
+ )
1654
+ },
1655
+ label && /* @__PURE__ */ React36__namespace.createElement(InputLabel, null, label),
1656
+ description && /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-gray-600" }, description),
1657
+ /* @__PURE__ */ React36__namespace.createElement("div", { className: cn("flex gap-2", isHorizontal ? "flex-row" : "flex-col") }, children),
1658
+ errorMessage && /* @__PURE__ */ React36__namespace.createElement(InputError, null, errorMessage)
1659
+ )
1660
+ );
1661
+ }
1662
+ function RadioCard({
1663
+ title,
1664
+ description,
1665
+ children,
1666
+ appearance,
1667
+ showIndicator = true,
1668
+ color,
1669
+ className,
1670
+ style,
1671
+ classNames,
1672
+ styles,
1673
+ ...props
1674
+ }) {
1675
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.RadioField, { ...props }, /* @__PURE__ */ React36__namespace.createElement(
1676
+ reactAriaComponents.RadioButton,
1677
+ {
1678
+ "data-radius": "lg",
1679
+ className: cn(className, "prt-radio-card", classNames?.wrapper),
1680
+ "data-color": color,
1681
+ "data-appearance": appearance,
1682
+ style: { ...style, ...styles?.wrapper }
1683
+ },
1684
+ ({ isSelected }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, showIndicator && /* @__PURE__ */ React36__namespace.createElement(
1685
+ "div",
1686
+ {
1687
+ className: "prt-radio-card-indicator prt-fake-radio",
1688
+ "data-size": "sm",
1689
+ "data-checked": isSelected
1690
+ }
1691
+ ), /* @__PURE__ */ React36__namespace.createElement(
1692
+ "div",
1693
+ {
1694
+ className: cn(
1695
+ "flex w-full flex-col gap-2.5 prt-radio-card-content",
1696
+ classNames?.content
1697
+ ),
1698
+ style: { ...styles?.content }
1699
+ },
1700
+ (title || description) && /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-0.5" }, title && /* @__PURE__ */ React36__namespace.createElement(
1701
+ "div",
1702
+ {
1703
+ className: cn("text-sm", classNames?.title),
1704
+ style: { ...styles?.title }
1705
+ },
1706
+ title
1707
+ ), description && /* @__PURE__ */ React36__namespace.createElement(
1708
+ "div",
1709
+ {
1710
+ className: cn(
1711
+ "text-xs leading-relaxed text-gray-400",
1712
+ classNames?.description
1713
+ ),
1714
+ style: { ...styles?.description }
1715
+ },
1716
+ description
1717
+ )),
1718
+ children
1719
+ ))
1720
+ ));
1721
+ }
1722
+ function RadioItem({
1723
+ className,
1724
+ style,
1725
+ classNames,
1726
+ styles,
1727
+ children,
1728
+ ...props
1729
+ }) {
1730
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.RadioField, { ...props }, /* @__PURE__ */ React36__namespace.createElement(
1731
+ reactAriaComponents.RadioButton,
1732
+ {
1733
+ style: { ...style, ...styles?.wrapper },
1734
+ className: cn(className, classNames?.wrapper, "prt-radio-item")
1735
+ },
1736
+ children
1737
+ ));
1738
+ }
1739
+ function Tag({
1740
+ prepend,
1741
+ append,
1742
+ children,
1743
+ hashValue,
1744
+ color,
1745
+ size = "sm",
1746
+ shape,
1747
+ variant = "light",
1748
+ className,
1749
+ style,
1750
+ classNames,
1751
+ styles,
1752
+ radius = "full",
1753
+ ref,
1754
+ ...props
1755
+ }) {
1756
+ warnDeprecation("shape", "radius", shape);
1757
+ const randomColor = React36__namespace.default.useMemo(() => {
1758
+ if (hashValue) {
1759
+ return getRandomColor(hashValue);
1760
+ }
1761
+ return "gray";
1762
+ }, [hashValue]);
1763
+ return /* @__PURE__ */ React36__namespace.default.createElement(
1764
+ "span",
1765
+ {
1766
+ className: cn(className, "prt-tag", classNames?.wrapper),
1767
+ style: { ...style, ...styles?.wrapper },
1768
+ "data-radius": radius,
1769
+ "data-size": size,
1770
+ "data-color": color ?? randomColor,
1771
+ "data-variant": variant,
1772
+ ref,
1773
+ ...props
1774
+ },
1775
+ prepend,
1776
+ children,
1777
+ append
1778
+ );
1779
+ }
1780
+
1781
+ // src/components/select/select.tsx
1782
+ function Select({
1783
+ label,
1784
+ description,
1785
+ error,
1786
+ placeholder,
1787
+ selectionMode = "single",
1788
+ appearance = "outline",
1789
+ renderValue,
1790
+ color = "gray",
1791
+ size = "sm",
1792
+ radius,
1793
+ listBoxColor,
1794
+ name,
1795
+ value,
1796
+ defaultValue,
1797
+ isDisabled,
1798
+ isRequired,
1799
+ disabledKeys,
1800
+ onChange,
1801
+ onSelectionChange,
1802
+ showSectionSeparator = true,
1803
+ showSelectionIndicator = true,
1804
+ items,
1805
+ children,
1806
+ labelKey = "label",
1807
+ valueKey = "id",
1808
+ sectionKey,
1809
+ renderOption,
1810
+ renderSectionLabel,
1811
+ className,
1812
+ classNames,
1813
+ style,
1814
+ styles
1815
+ }) {
1816
+ const theme = useTheme();
1817
+ const isMultiple = selectionMode === "multiple";
1818
+ color = color ?? theme?.color;
1819
+ function handleChange(v) {
1820
+ onChange?.({ target: { value: v, name } });
1821
+ onSelectionChange?.(v == null ? [] : Array.isArray(v) ? v : [v]);
1822
+ }
1823
+ function labelOf(item) {
1824
+ if (item == null) return null;
1825
+ return item[labelKey];
1826
+ }
1827
+ const racSelectProps = {
1828
+ selectionMode,
1829
+ isDisabled,
1830
+ isRequired,
1831
+ placeholder,
1832
+ disabledKeys,
1833
+ value,
1834
+ defaultValue,
1835
+ isInvalid: !!error,
1836
+ onChange: handleChange
1837
+ };
1838
+ return /* @__PURE__ */ React36__namespace.createElement(
1839
+ reactAriaComponents.Select,
1840
+ {
1841
+ ...racSelectProps,
1842
+ "aria-label": label == null ? placeholder ?? "Select" : void 0,
1843
+ className: cn("prt-select", className, classNames?.wrapper),
1844
+ style: { ...style, ...styles?.wrapper }
1845
+ },
1846
+ /* @__PURE__ */ React36__namespace.createElement(
1847
+ Field,
1848
+ {
1849
+ replaceDefaultControlWrapper: true,
1850
+ label,
1851
+ error,
1852
+ description,
1853
+ color,
1854
+ size,
1855
+ radius,
1856
+ classNames,
1857
+ styles
1858
+ },
1859
+ /* @__PURE__ */ React36__namespace.createElement(
1860
+ reactAriaComponents.Button,
1861
+ {
1862
+ "data-selection-mode": selectionMode,
1863
+ "data-appearance": appearance,
1864
+ style: styles?.trigger,
1865
+ className: cn("prt-input-control", "prt-select-trigger", classNames?.trigger)
1866
+ },
1867
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.SelectValue, { className: cn("single-value", classNames?.value) }, ({ isPlaceholder, selectedItems, selectedText }) => {
1868
+ if (isPlaceholder) {
1869
+ return /* @__PURE__ */ React36__namespace.createElement(
1870
+ "span",
1871
+ {
1872
+ style: styles?.placeholder,
1873
+ className: cn("text-gray-400", classNames?.placeholder)
1874
+ },
1875
+ placeholder
1876
+ );
1877
+ }
1878
+ if (isMultiple) {
1879
+ return /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-wrap gap-1" }, selectedItems.map(
1880
+ (item, index) => item == null ? null : renderValue?.(item) ?? /* @__PURE__ */ React36__namespace.createElement(
1881
+ Tag,
1882
+ {
1883
+ size: "md",
1884
+ variant: "pastel",
1885
+ color,
1886
+ key: index
1887
+ },
1888
+ labelOf(item)
1889
+ )
1890
+ ));
1891
+ }
1892
+ const selectedItem = selectedItems[0] ?? null;
1893
+ return /* @__PURE__ */ React36__namespace.createElement(
1894
+ "div",
1895
+ {
1896
+ className: cn("single-value", classNames?.value),
1897
+ style: styles?.value
1898
+ },
1899
+ (selectedItem && renderValue?.(selectedItem)) ?? labelOf(selectedItem) ?? selectedText
1900
+ );
1901
+ }),
1902
+ /* @__PURE__ */ React36__namespace.createElement(HiSelector, { className: "selector", size: 18 })
1903
+ )
1904
+ ),
1905
+ /* @__PURE__ */ React36__namespace.createElement(
1906
+ reactAriaComponents.Popover,
1907
+ {
1908
+ offset: 4,
1909
+ className: cn("prt-popover", "prt-select-popover", classNames?.popover),
1910
+ style: styles?.popover
1911
+ },
1912
+ /* @__PURE__ */ React36__namespace.createElement(
1913
+ ListBox,
1914
+ {
1915
+ items,
1916
+ labelKey,
1917
+ valueKey,
1918
+ sectionKey,
1919
+ renderOption,
1920
+ renderSectionLabel,
1921
+ showSectionSeparator,
1922
+ showSelectionIndicator,
1923
+ color: listBoxColor ?? "gray",
1924
+ width: "var(--trigger-width)"
1925
+ },
1926
+ children
1927
+ )
1928
+ )
1929
+ );
1930
+ }
1931
+ function CalendarBody({
1932
+ numberOfMonths = 1,
1933
+ showMonthAndYearPickers = false
1934
+ }) {
1935
+ return /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, /* @__PURE__ */ React36__namespace.createElement("header", { className: "prt-calendar-header" }, /* @__PURE__ */ React36__namespace.createElement(
1936
+ IconButton,
1937
+ {
1938
+ slot: "previous",
1939
+ variant: "outline",
1940
+ radius: "full",
1941
+ size: "sm",
1942
+ color: "gray"
1943
+ },
1944
+ /* @__PURE__ */ React36__namespace.createElement(HiChevronLeft, { size: 20 })
1945
+ ), showMonthAndYearPickers ? /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-2 prt-calendar-selects" }, /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CalendarMonthPicker, null, ({ "aria-label": ariaLabel, value, onChange, items }) => /* @__PURE__ */ React36__namespace.createElement(
1946
+ Select,
1947
+ {
1948
+ "aria-label": ariaLabel,
1949
+ size: "sm",
1950
+ appearance: "filled",
1951
+ valueKey: "id",
1952
+ labelKey: "formatted",
1953
+ value,
1954
+ onChange: (e) => onChange(e.target.value),
1955
+ items
1956
+ }
1957
+ )), /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CalendarYearPicker, null, ({ "aria-label": ariaLabel, value, onChange, items }) => /* @__PURE__ */ React36__namespace.createElement(
1958
+ Select,
1959
+ {
1960
+ "aria-label": ariaLabel,
1961
+ size: "sm",
1962
+ appearance: "filled",
1963
+ valueKey: "id",
1964
+ labelKey: "formatted",
1965
+ value,
1966
+ onChange: (e) => onChange(e.target.value),
1967
+ items
1968
+ }
1969
+ ))) : /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Heading, { className: "prt-calendar-heading" }), /* @__PURE__ */ React36__namespace.createElement(
1970
+ IconButton,
1971
+ {
1972
+ slot: "next",
1973
+ variant: "outline",
1974
+ radius: "full",
1975
+ size: "sm",
1976
+ color: "gray"
1977
+ },
1978
+ /* @__PURE__ */ React36__namespace.createElement(HiChevronRight, { size: 20 })
1979
+ )), /* @__PURE__ */ React36__namespace.createElement("div", { className: "prt-calendar-months" }, Array.from({ length: numberOfMonths }, (_, i) => /* @__PURE__ */ React36__namespace.createElement(
1980
+ reactAriaComponents.CalendarGrid,
1981
+ {
1982
+ key: i,
1983
+ offset: { months: i },
1984
+ className: "prt-calendar-grid"
1985
+ },
1986
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CalendarGridHeader, null, (day) => /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CalendarHeaderCell, { className: "prt-date-weekday" }, day)),
1987
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CalendarGridBody, null, (date) => /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.CalendarCell, { date, className: "prt-date-cell" }))
1988
+ ))));
1989
+ }
1990
+ function Calendar({
1991
+ numberOfMonths = 1,
1992
+ showMonthAndYearPickers,
1993
+ color,
1994
+ radius,
1995
+ ref,
1996
+ ...props
1997
+ }) {
1998
+ const theme = useTheme();
1999
+ return /* @__PURE__ */ React36__namespace.createElement(
2000
+ reactAriaComponents.Calendar,
2001
+ {
2002
+ ...props,
2003
+ ref,
2004
+ visibleDuration: { months: numberOfMonths },
2005
+ "data-color": color ?? theme?.color ?? "primary",
2006
+ "data-radius": radius ?? theme?.radius ?? "lg",
2007
+ className: "prt-calendar-wrapper"
2008
+ },
2009
+ /* @__PURE__ */ React36__namespace.createElement(
2010
+ CalendarBody,
2011
+ {
2012
+ numberOfMonths,
2013
+ showMonthAndYearPickers
2014
+ }
2015
+ )
2016
+ );
2017
+ }
2018
+ function RangeCalendar({
2019
+ numberOfMonths = 1,
2020
+ showMonthAndYearPickers,
2021
+ color,
2022
+ radius,
2023
+ ref,
2024
+ ...props
2025
+ }) {
2026
+ const theme = useTheme();
2027
+ return /* @__PURE__ */ React36__namespace.createElement(
2028
+ reactAriaComponents.RangeCalendar,
2029
+ {
2030
+ ...props,
2031
+ ref,
2032
+ visibleDuration: { months: numberOfMonths },
2033
+ "data-color": color ?? theme?.color ?? "primary",
2034
+ "data-radius": radius ?? theme?.radius ?? "lg",
2035
+ "data-range": "true",
2036
+ className: "prt-calendar-wrapper"
2037
+ },
2038
+ /* @__PURE__ */ React36__namespace.createElement(
2039
+ CalendarBody,
2040
+ {
2041
+ numberOfMonths,
2042
+ showMonthAndYearPickers
2043
+ }
2044
+ )
2045
+ );
2046
+ }
2047
+ function DateSegments({ slot, className }) {
2048
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.DateInput, { slot, className: cn("prt-date-field", className) }, (segment) => /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.DateSegment, { segment, className: "prt-date-input-segment" }));
2049
+ }
2050
+
2051
+ // src/components/date/date-field.tsx
2052
+ function DateField({
2053
+ appearance = "outline",
2054
+ size = "md",
2055
+ color,
2056
+ radius,
2057
+ value,
2058
+ defaultValue,
2059
+ onChange,
2060
+ label,
2061
+ description,
2062
+ error,
2063
+ validationStatus,
2064
+ prepend,
2065
+ append,
2066
+ className,
2067
+ classNames,
2068
+ style,
2069
+ styles,
2070
+ ref,
2071
+ ...props
2072
+ }) {
2073
+ function handleChange(date) {
2074
+ onChange?.(date?.toString() ?? null, date);
2075
+ }
2076
+ return /* @__PURE__ */ React36__namespace.createElement(
2077
+ reactAriaComponents.DateField,
2078
+ {
2079
+ ...props,
2080
+ value: value != null ? date.parseDate(value) : void 0,
2081
+ defaultValue: defaultValue != null ? date.parseDate(defaultValue) : void 0,
2082
+ onChange: handleChange,
2083
+ isInvalid: !!error
2084
+ },
2085
+ /* @__PURE__ */ React36__namespace.createElement(
2086
+ Field,
2087
+ {
2088
+ replaceDefaultControlWrapper: true,
2089
+ label,
2090
+ error,
2091
+ description,
2092
+ color,
2093
+ size,
2094
+ radius,
2095
+ appearance,
2096
+ validationStatus,
2097
+ className,
2098
+ classNames,
2099
+ style,
2100
+ styles
2101
+ },
2102
+ /* @__PURE__ */ React36__namespace.createElement(
2103
+ reactAriaComponents.Group,
2104
+ {
2105
+ ref,
2106
+ "data-appearance": appearance,
2107
+ "data-color": color,
2108
+ className: cn("prt-input-control", "date-field-control")
2109
+ },
2110
+ prepend && /* @__PURE__ */ React36__namespace.createElement("div", { className: "add-on add-on-left flex items-center" }, prepend),
2111
+ /* @__PURE__ */ React36__namespace.createElement(DateSegments, null),
2112
+ append && /* @__PURE__ */ React36__namespace.createElement("div", { className: "add-on add-on-right flex items-center" }, append)
2113
+ )
2114
+ )
2115
+ );
2116
+ }
2117
+ function TimeField({
2118
+ appearance = "outline",
2119
+ size = "md",
2120
+ color,
2121
+ radius,
2122
+ value,
2123
+ defaultValue,
2124
+ onChange,
2125
+ label,
2126
+ description,
2127
+ error,
2128
+ validationStatus,
2129
+ prepend,
2130
+ append,
2131
+ className,
2132
+ classNames,
2133
+ style,
2134
+ styles,
2135
+ ref,
2136
+ ...props
2137
+ }) {
2138
+ function handleChange(time) {
2139
+ onChange?.(time?.toString() ?? null, time);
2140
+ }
2141
+ return /* @__PURE__ */ React36__namespace.createElement(
2142
+ reactAriaComponents.TimeField,
2143
+ {
2144
+ ...props,
2145
+ value: value != null ? date.parseTime(value) : void 0,
2146
+ defaultValue: defaultValue != null ? date.parseTime(defaultValue) : void 0,
2147
+ onChange: handleChange,
2148
+ isInvalid: !!error
2149
+ },
2150
+ /* @__PURE__ */ React36__namespace.createElement(
2151
+ Field,
2152
+ {
2153
+ replaceDefaultControlWrapper: true,
2154
+ label,
2155
+ error,
2156
+ description,
2157
+ color,
2158
+ size,
2159
+ radius,
2160
+ appearance,
2161
+ validationStatus,
2162
+ className,
2163
+ classNames,
2164
+ style,
2165
+ styles
2166
+ },
2167
+ /* @__PURE__ */ React36__namespace.createElement(
2168
+ reactAriaComponents.Group,
2169
+ {
2170
+ ref,
2171
+ "data-appearance": appearance,
2172
+ "data-color": color,
2173
+ className: cn("prt-input-control", "date-field-control")
2174
+ },
2175
+ prepend && /* @__PURE__ */ React36__namespace.createElement("div", { className: "add-on add-on-left flex items-center" }, prepend),
2176
+ /* @__PURE__ */ React36__namespace.createElement(DateSegments, null),
2177
+ append && /* @__PURE__ */ React36__namespace.createElement("div", { className: "add-on add-on-right flex items-center" }, append)
2178
+ )
2179
+ )
2180
+ );
2181
+ }
2182
+ function DatePicker({
2183
+ appearance = "outline",
2184
+ size = "md",
2185
+ color,
2186
+ numberOfMonths,
2187
+ showMonthAndYearPickers,
2188
+ radius,
2189
+ selectorIcon = /* @__PURE__ */ React36__namespace.createElement(HiOutlineCalendar, { size: 16 }),
2190
+ value,
2191
+ defaultValue,
2192
+ onChange,
2193
+ label,
2194
+ description,
2195
+ error,
2196
+ validationStatus,
2197
+ className,
2198
+ classNames,
2199
+ style,
2200
+ styles,
2201
+ ref,
2202
+ ...props
2203
+ }) {
2204
+ function handleChange(date) {
2205
+ onChange?.(date?.toString() ?? null, date);
2206
+ }
2207
+ return /* @__PURE__ */ React36__namespace.createElement(
2208
+ reactAriaComponents.DatePicker,
2209
+ {
2210
+ ...props,
2211
+ value: value != null ? date.parseDate(value) : void 0,
2212
+ defaultValue: defaultValue != null ? date.parseDate(defaultValue) : void 0,
2213
+ onChange: handleChange,
2214
+ isInvalid: !!error
2215
+ },
2216
+ /* @__PURE__ */ React36__namespace.createElement(
2217
+ Field,
2218
+ {
2219
+ replaceDefaultControlWrapper: true,
2220
+ label,
2221
+ error,
2222
+ description,
2223
+ color,
2224
+ size,
2225
+ radius,
2226
+ appearance,
2227
+ validationStatus,
2228
+ className,
2229
+ classNames,
2230
+ style,
2231
+ styles
2232
+ },
2233
+ /* @__PURE__ */ React36__namespace.createElement(
2234
+ reactAriaComponents.Group,
2235
+ {
2236
+ ref,
2237
+ "data-appearance": appearance,
2238
+ "data-color": color,
2239
+ className: cn("prt-input-control", "prt-date-picker-trigger")
2240
+ },
2241
+ /* @__PURE__ */ React36__namespace.createElement(DateSegments, null),
2242
+ /* @__PURE__ */ React36__namespace.createElement(IconButton, { size: "sm", variant: "light", color }, selectorIcon)
2243
+ )
2244
+ ),
2245
+ /* @__PURE__ */ React36__namespace.createElement(
2246
+ reactAriaComponents.Popover,
2247
+ {
2248
+ offset: 8,
2249
+ placement: "bottom start",
2250
+ className: cn("prt-popover", "prt-date-popover")
2251
+ },
2252
+ /* @__PURE__ */ React36__namespace.createElement(
2253
+ Calendar,
2254
+ {
2255
+ color,
2256
+ radius,
2257
+ numberOfMonths,
2258
+ showMonthAndYearPickers
2259
+ }
2260
+ )
2261
+ )
2262
+ );
2263
+ }
2264
+ function toRange(value) {
2265
+ return value != null ? { start: date.parseDate(value.start), end: date.parseDate(value.end) } : void 0;
2266
+ }
2267
+ function DateRangePicker({
2268
+ appearance = "outline",
2269
+ size = "md",
2270
+ color,
2271
+ numberOfMonths = 2,
2272
+ showMonthAndYearPickers,
2273
+ radius,
2274
+ dropdownIcon = /* @__PURE__ */ React36__namespace.createElement(HiOutlineCalendar, { size: 16 }),
2275
+ value,
2276
+ defaultValue,
2277
+ onChange,
2278
+ label,
2279
+ description,
2280
+ error,
2281
+ validationStatus,
2282
+ className,
2283
+ classNames,
2284
+ style,
2285
+ styles,
2286
+ ref,
2287
+ ...props
2288
+ }) {
2289
+ function handleChange(range) {
2290
+ onChange?.(
2291
+ range ? { start: range.start.toString(), end: range.end.toString() } : null,
2292
+ range
2293
+ );
2294
+ }
2295
+ return /* @__PURE__ */ React36__namespace.createElement(
2296
+ reactAriaComponents.DateRangePicker,
2297
+ {
2298
+ ...props,
2299
+ value: toRange(value),
2300
+ defaultValue: toRange(defaultValue),
2301
+ onChange: handleChange,
2302
+ isInvalid: !!error
2303
+ },
2304
+ /* @__PURE__ */ React36__namespace.createElement(
2305
+ Field,
2306
+ {
2307
+ replaceDefaultControlWrapper: true,
2308
+ label,
2309
+ error,
2310
+ description,
2311
+ color,
2312
+ size,
2313
+ radius,
2314
+ appearance,
2315
+ validationStatus,
2316
+ className,
2317
+ classNames,
2318
+ style,
2319
+ styles
2320
+ },
2321
+ /* @__PURE__ */ React36__namespace.createElement(
2322
+ reactAriaComponents.Group,
2323
+ {
2324
+ ref,
2325
+ "data-appearance": appearance,
2326
+ "data-color": color,
2327
+ className: cn("prt-input-control", "prt-date-picker-trigger")
2328
+ },
2329
+ /* @__PURE__ */ React36__namespace.createElement("div", { className: "prt-date-range-fields" }, /* @__PURE__ */ React36__namespace.createElement(DateSegments, { slot: "start" }), /* @__PURE__ */ React36__namespace.createElement("span", { "aria-hidden": "true", className: "prt-date-range-sep" }, "\u2013"), /* @__PURE__ */ React36__namespace.createElement(DateSegments, { slot: "end" })),
2330
+ /* @__PURE__ */ React36__namespace.createElement(IconButton, { size: "sm", variant: "light", color }, dropdownIcon)
2331
+ )
2332
+ ),
2333
+ /* @__PURE__ */ React36__namespace.createElement(
2334
+ reactAriaComponents.Popover,
2335
+ {
2336
+ offset: 8,
2337
+ placement: "bottom start",
2338
+ className: cn("prt-popover", "prt-date-popover")
2339
+ },
2340
+ /* @__PURE__ */ React36__namespace.createElement(
2341
+ RangeCalendar,
2342
+ {
2343
+ color,
2344
+ radius,
2345
+ numberOfMonths,
2346
+ showMonthAndYearPickers
2347
+ }
2348
+ )
2349
+ )
2350
+ );
2351
+ }
2352
+ var AvatarGroupContext = React36__namespace.createContext(null);
2353
+ function defaultGetInitials(name) {
2354
+ const parts = name.trim().split(/\s+/).filter(Boolean);
2355
+ if (parts.length === 0) return "";
2356
+ if (parts.length === 1) return parts[0].slice(0, 2);
2357
+ return parts[0][0] + parts[parts.length - 1][0];
2358
+ }
2359
+ function Avatar({
2360
+ src,
2361
+ alt,
2362
+ name,
2363
+ color,
2364
+ variant,
2365
+ fallback,
2366
+ children,
2367
+ size,
2368
+ className,
2369
+ radius,
2370
+ classNames,
2371
+ styles,
2372
+ style,
2373
+ getInitials = defaultGetInitials,
2374
+ ref,
2375
+ ...props
2376
+ }) {
2377
+ const [erroredSrc, setErroredSrc] = React36__namespace.useState();
2378
+ const theme = useTheme();
2379
+ const group = React36__namespace.useContext(AvatarGroupContext);
2380
+ const defaultColor = React36__namespace.useMemo(() => {
2381
+ return supportedColors[hashCode(name || "") % supportedColors.length];
2382
+ }, [name]);
2383
+ const resolvedSize = size ?? group?.size ?? "md";
2384
+ const resolvedVariant = variant ?? group?.variant ?? "light";
2385
+ const resolvedColor = color ?? group?.color ?? defaultColor;
2386
+ function renderContent() {
2387
+ if (src && erroredSrc !== src) {
2388
+ return /* @__PURE__ */ React36__namespace.createElement(
2389
+ "img",
2390
+ {
2391
+ className: cn("prt-avatar-img", classNames?.img),
2392
+ style: styles?.img,
2393
+ onError: () => setErroredSrc(src),
2394
+ src,
2395
+ alt: alt ?? name
2396
+ }
2397
+ );
2398
+ }
2399
+ if (children) return children;
2400
+ if (name) {
2401
+ return /* @__PURE__ */ React36__namespace.createElement(
2402
+ "span",
2403
+ {
2404
+ className: cn("prt-avatar-fallback", classNames?.fallback),
2405
+ style: styles?.fallback
2406
+ },
2407
+ getInitials(name)
2408
+ );
2409
+ }
2410
+ return fallback ?? null;
2411
+ }
2412
+ return /* @__PURE__ */ React36__namespace.createElement(
2413
+ "div",
2414
+ {
2415
+ style: { ...style, ...styles?.base },
2416
+ className: cn("prt-avatar prt-size", className, classNames?.base),
2417
+ "data-radius": radius ?? theme?.avatarRadiusSize ?? "full",
2418
+ "data-color": resolvedColor,
2419
+ "data-variant": resolvedVariant,
2420
+ "data-interactive": false,
2421
+ "data-size": resolvedSize,
2422
+ role: "img",
2423
+ "aria-label": alt ?? name,
2424
+ ref,
2425
+ ...props
2426
+ },
2427
+ renderContent()
2428
+ );
2429
+ }
2430
+ function AvatarGroup({
2431
+ max,
2432
+ size,
2433
+ color,
2434
+ variant,
2435
+ children,
2436
+ className,
2437
+ style,
2438
+ classNames,
2439
+ styles
2440
+ }) {
2441
+ const value = React36__namespace.useMemo(
2442
+ () => ({ size, color, variant }),
2443
+ [size, color, variant]
2444
+ );
2445
+ const items = React36__namespace.Children.toArray(children);
2446
+ const visible = max != null ? items.slice(0, max) : items;
2447
+ const overflow = max != null ? Math.max(0, items.length - max) : 0;
2448
+ return /* @__PURE__ */ React36__namespace.createElement(AvatarGroupContext.Provider, { value }, /* @__PURE__ */ React36__namespace.createElement(
2449
+ "div",
2450
+ {
2451
+ className: cn("prt-avatar-group", className, classNames?.wrapper),
2452
+ style: { ...style, ...styles?.wrapper }
2453
+ },
2454
+ visible,
2455
+ overflow > 0 && /* @__PURE__ */ React36__namespace.createElement(
2456
+ "div",
2457
+ {
2458
+ className: cn("prt-avatar prt-size", classNames?.overflow),
2459
+ style: styles?.overflow,
2460
+ "data-size": size ?? "md",
2461
+ "data-color": color ?? "gray",
2462
+ "data-variant": variant ?? "light",
2463
+ "data-radius": "full",
2464
+ "data-interactive": false
2465
+ },
2466
+ "+",
2467
+ overflow
2468
+ )
2469
+ ));
2470
+ }
2471
+ function convertFileToUpload(file) {
2472
+ return {
2473
+ name: file.name,
2474
+ id: id(),
2475
+ url: URL.createObjectURL(file),
2476
+ status: "success",
2477
+ file
2478
+ };
2479
+ }
2480
+ function FileUploader({
2481
+ onFileUpload,
2482
+ onRemoveFile,
2483
+ error,
2484
+ label,
2485
+ allowMultiple,
2486
+ uploads: controlledUploads,
2487
+ hideFileList,
2488
+ color = "gray",
2489
+ ref,
2490
+ classNames,
2491
+ styles,
2492
+ className,
2493
+ style
2494
+ }) {
2495
+ const [_uploads, setUploads] = React36__namespace.useState([]);
2496
+ const uploads = controlledUploads ?? _uploads;
2497
+ function onUpload(next) {
2498
+ if (isEmptyArray(next)) return;
2499
+ setUploads(next);
2500
+ onFileUpload?.(next);
2501
+ }
2502
+ function handleSelect(files) {
2503
+ if (!files?.length) return;
2504
+ onUpload(Array.from(files).map(convertFileToUpload));
2505
+ }
2506
+ function handleRemoveFile() {
2507
+ setUploads([]);
2508
+ onRemoveFile?.();
2509
+ }
2510
+ function handleRetry() {
2511
+ console.log("retry");
2512
+ }
2513
+ const isIdle = allowMultiple || !allowMultiple && uploads[0]?.status === "idle" || !uploads.length;
2514
+ const isUploading = !allowMultiple && uploads[0]?.status === "loading";
2515
+ const isUploaded = !allowMultiple && uploads[0]?.status === "success";
2516
+ const isFailed = !allowMultiple && uploads[0]?.status === "error";
2517
+ return /* @__PURE__ */ React36__namespace.createElement(
2518
+ "div",
2519
+ {
2520
+ ref,
2521
+ className: cn("flex flex-col gap-2.5", classNames?.wrapper, className),
2522
+ style: { ...styles?.wrapper, ...style }
2523
+ },
2524
+ label && /* @__PURE__ */ React36__namespace.createElement(InputLabel, null, label),
2525
+ /* @__PURE__ */ React36__namespace.createElement(
2526
+ reactAriaComponents.DropZone,
2527
+ {
2528
+ "aria-label": typeof label === "string" ? label : "File upload",
2529
+ onDrop: async (e) => {
2530
+ const fileItems = e.items.filter(
2531
+ (item) => item.kind === "file"
2532
+ );
2533
+ const files = await Promise.all(
2534
+ fileItems.map((item) => item.getFile())
2535
+ );
2536
+ onUpload(files.map(convertFileToUpload));
2537
+ },
2538
+ "data-radius": "lg",
2539
+ "data-color": color,
2540
+ className: cn("prt-file-uploader", classNames?.dropzone),
2541
+ style: { ...styles?.dropzone },
2542
+ "data-state": allowMultiple || !uploads.length ? "idle" : uploads[0]?.status
2543
+ },
2544
+ isIdle && /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.FileTrigger, { allowsMultiple: allowMultiple, onSelect: handleSelect }, /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.Button, { className: "prt-file-uploader-trigger" }, /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React36__namespace.createElement(HiOutlineDocumentAdd, { className: "state-icon", size: 20 }), /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-inherit" }, "Click or drag files here to upload")))),
2545
+ isUploading && /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React36__namespace.createElement(Loader, { size: "xs" }), /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-inherit" }, "Name_of_file.ext / Uploading...")),
2546
+ isUploaded && /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex w-full items-center justify-between" }, /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React36__namespace.createElement(HiOutlineCheckCircle, { size: 16 }), /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-green-600" }, "File successfully uploaded")), /* @__PURE__ */ React36__namespace.createElement(
2547
+ IconButton,
2548
+ {
2549
+ onPress: handleRemoveFile,
2550
+ variant: "outline",
2551
+ color: "green",
2552
+ size: "xs"
2553
+ },
2554
+ /* @__PURE__ */ React36__namespace.createElement(HiOutlineTrash, { size: 16 })
2555
+ )),
2556
+ isFailed && /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex w-full justify-between" }, /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React36__namespace.createElement(HiOutlineExclamationCircle, { className: "state-icon" }), /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-red-600" }, "Failed to upload file")), /* @__PURE__ */ React36__namespace.createElement(
2557
+ IconButton,
2558
+ {
2559
+ onPress: handleRetry,
2560
+ variant: "outline",
2561
+ color: "tomato",
2562
+ size: "xs"
2563
+ },
2564
+ /* @__PURE__ */ React36__namespace.createElement(HiOutlineRefresh, { size: 16 })
2565
+ ))
2566
+ ),
2567
+ uploads.length > 1 && !hideFileList && /* @__PURE__ */ React36__namespace.createElement(
2568
+ "div",
2569
+ {
2570
+ style: { marginTop: 10, ...styles?.list },
2571
+ className: cn("flex flex-col gap-3 upload-list", classNames?.list)
2572
+ },
2573
+ uploads.map((upload) => /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex items-center gap-2.5", key: upload.id }, upload.status === "loading" && /* @__PURE__ */ React36__namespace.createElement(Loader, null), upload.status === "success" && /* @__PURE__ */ React36__namespace.createElement(HiOutlinePaperClip, null), /* @__PURE__ */ React36__namespace.createElement("span", { className: "text-sm text-gray-700" }, upload.name)))
2574
+ ),
2575
+ error && /* @__PURE__ */ React36__namespace.createElement(InputError, null, error)
2576
+ );
2577
+ }
2578
+ function Separator({
2579
+ orientation,
2580
+ className,
2581
+ color,
2582
+ opacity,
2583
+ ref,
2584
+ ...props
2585
+ }) {
2586
+ return /* @__PURE__ */ React36__namespace.createElement(
2587
+ "div",
2588
+ {
2589
+ "data-opacity": opacity,
2590
+ "data-color": color,
2591
+ "data-orientation": orientation,
2592
+ className: cn(["prt-separator", className]),
2593
+ ref,
2594
+ ...props
2595
+ }
2596
+ );
2597
+ }
2598
+ function Progress({
2599
+ height = 2,
2600
+ className,
2601
+ style,
2602
+ classNames,
2603
+ styles,
2604
+ color = "gray",
2605
+ label,
2606
+ ref,
2607
+ ...props
2608
+ }) {
2609
+ return /* @__PURE__ */ React36__namespace.createElement(
2610
+ reactAriaComponents.ProgressBar,
2611
+ {
2612
+ ...props,
2613
+ ...typeof label === "string" ? { "aria-label": label } : {},
2614
+ "data-color": color,
2615
+ className: cn("progress-bar", className, classNames?.wrapper),
2616
+ style: { ...style, ...styles?.wrapper }
2617
+ },
2618
+ ({ percentage }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, label && /* @__PURE__ */ React36__namespace.createElement(
2619
+ "span",
2620
+ {
2621
+ className: cn("text-sm text-gray-700", classNames?.label),
2622
+ style: { ...styles?.label }
2623
+ },
2624
+ label
2625
+ ), /* @__PURE__ */ React36__namespace.createElement(
2626
+ "div",
2627
+ {
2628
+ className: cn("progress-wrapper", classNames?.track),
2629
+ style: {
2630
+ height,
2631
+ background: "var(--color-gray-200)",
2632
+ position: "relative",
2633
+ borderRadius: 60,
2634
+ overflow: "hidden",
2635
+ ...styles?.track
2636
+ },
2637
+ ref
2638
+ },
2639
+ /* @__PURE__ */ React36__namespace.createElement(
2640
+ "div",
2641
+ {
2642
+ className: cn("progress absolute", classNames?.bar),
2643
+ style: {
2644
+ left: 0,
2645
+ top: 0,
2646
+ height: "100%",
2647
+ width: `${percentage ?? 0}%`,
2648
+ background: "var(--c-solid)",
2649
+ transition: "all 0.3s ease",
2650
+ ...styles?.bar
2651
+ }
2652
+ }
2653
+ )
2654
+ ))
2655
+ );
2656
+ }
2657
+ function Switch({
2658
+ color = "violet",
2659
+ size = "sm",
2660
+ children,
2661
+ className,
2662
+ style,
2663
+ classNames,
2664
+ styles,
2665
+ ...props
2666
+ }) {
2667
+ return /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.SwitchField, { ...props }, /* @__PURE__ */ React36__namespace.createElement(
2668
+ reactAriaComponents.SwitchButton,
2669
+ {
2670
+ className: cn(className, "prt-switch-group", classNames?.wrapper),
2671
+ style: { ...style, ...styles?.wrapper }
2672
+ },
2673
+ /* @__PURE__ */ React36__namespace.createElement("span", { "data-color": color, "data-size": size, className: "prt-switch track" }, /* @__PURE__ */ React36__namespace.createElement(
2674
+ "span",
2675
+ {
2676
+ className: cn("prt-switch-thumb", classNames?.thumb),
2677
+ style: { ...styles?.thumb }
2678
+ }
2679
+ )),
2680
+ children
2681
+ ));
2682
+ }
2683
+ function Slider({
2684
+ className,
2685
+ classNames,
2686
+ style,
2687
+ styles,
2688
+ name,
2689
+ size = "sm",
2690
+ color,
2691
+ label,
2692
+ orientation = "horizontal",
2693
+ ...props
2694
+ }) {
2695
+ return /* @__PURE__ */ React36__namespace.createElement(
2696
+ reactAriaComponents.Slider,
2697
+ {
2698
+ ...props,
2699
+ orientation,
2700
+ "aria-label": typeof label === "string" ? label : props["aria-label"] ?? "slider",
2701
+ "data-color": color,
2702
+ "data-size": size,
2703
+ style: { ...style, ...styles?.wrapper },
2704
+ className: cn("prt-slider", orientation, className, classNames?.wrapper)
2705
+ },
2706
+ label && /* @__PURE__ */ React36__namespace.createElement(InputLabel, { style: styles?.label, className: classNames?.label }, label),
2707
+ /* @__PURE__ */ React36__namespace.createElement(
2708
+ reactAriaComponents.SliderTrack,
2709
+ {
2710
+ className: cn("prt-slider-track", classNames?.track),
2711
+ style: styles?.track
2712
+ },
2713
+ ({ state }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, /* @__PURE__ */ React36__namespace.createElement(
2714
+ "div",
2715
+ {
2716
+ style: {
2717
+ ...styles?.fill,
2718
+ width: `${state.getThumbPercent(0) * 100}%`
2719
+ },
2720
+ className: cn("prt-slider-track-fill", classNames?.fill)
2721
+ }
2722
+ ), /* @__PURE__ */ React36__namespace.createElement(
2723
+ reactAriaComponents.SliderThumb,
2724
+ {
2725
+ index: 0,
2726
+ name,
2727
+ className: cn("prt-slider-thumb", classNames?.thumb),
2728
+ style: styles?.thumb
2729
+ },
2730
+ /* @__PURE__ */ React36__namespace.createElement(
2731
+ "div",
2732
+ {
2733
+ style: styles?.innerThumb,
2734
+ className: cn("prt-slider-thumb-inner", classNames?.innerThumb)
2735
+ }
2736
+ )
2737
+ ))
2738
+ )
2739
+ );
2740
+ }
2741
+ function Sticker({
2742
+ variant = "outline",
2743
+ color = "violet",
2744
+ padded = true,
2745
+ radius,
2746
+ children,
2747
+ ref,
2748
+ className,
2749
+ style,
2750
+ ...props
2751
+ }) {
2752
+ const theme = useTheme();
2753
+ return /* @__PURE__ */ React36__namespace.default.createElement(
2754
+ "div",
2755
+ {
2756
+ ref,
2757
+ "data-radius": radius ?? theme?.radius ?? "lg",
2758
+ "data-variant": variant,
2759
+ "data-color": color,
2760
+ style,
2761
+ className: cn("inline-flex items-center gap-3", padded && "p-4", className),
2762
+ ...props
2763
+ },
2764
+ children
2765
+ );
2766
+ }
2767
+ function Tab(_props) {
2768
+ return null;
2769
+ }
2770
+ function Tabs({
2771
+ className,
2772
+ style,
2773
+ classNames,
2774
+ styles,
2775
+ children,
2776
+ onSelectionChange,
2777
+ ...props
2778
+ }) {
2779
+ const theme = useTheme();
2780
+ const tabListRef = React36__namespace.useRef(null);
2781
+ const [indicator, setIndicator] = React36__namespace.useState({ width: 0, left: 0 });
2782
+ const tabs = [];
2783
+ React36__namespace.Children.forEach(children, (child, index) => {
2784
+ if (React36__namespace.isValidElement(child)) {
2785
+ tabs.push({
2786
+ id: child.props.id ?? child.key ?? index,
2787
+ title: child.props.title,
2788
+ children: child.props.children,
2789
+ isDisabled: child.props.isDisabled
2790
+ });
2791
+ }
2792
+ });
2793
+ const [activeKey, setActiveKey] = React36__namespace.useState(
2794
+ props.selectedKey ?? props.defaultSelectedKey ?? tabs[0]?.id
2795
+ );
2796
+ React36__namespace.useEffect(() => {
2797
+ if (props.selectedKey != null) setActiveKey(props.selectedKey);
2798
+ }, [props.selectedKey]);
2799
+ React36__namespace.useEffect(() => {
2800
+ const list = tabListRef.current;
2801
+ const selected = list?.querySelector(
2802
+ ".prt-tab[data-selected]"
2803
+ );
2804
+ if (list && selected) {
2805
+ const lb = list.getBoundingClientRect();
2806
+ const sb = selected.getBoundingClientRect();
2807
+ setIndicator({ width: sb.width, left: sb.left - lb.left });
2808
+ }
2809
+ }, [activeKey, tabs.length]);
2810
+ return /* @__PURE__ */ React36__namespace.createElement(
2811
+ reactAriaComponents.Tabs,
2812
+ {
2813
+ ...props,
2814
+ onSelectionChange: (key) => {
2815
+ setActiveKey(key);
2816
+ onSelectionChange?.(key);
2817
+ },
2818
+ "data-color": theme?.color ?? "violet",
2819
+ className: cn("prt-tabs", className, classNames?.wrapper),
2820
+ style: { position: "relative", ...style, ...styles?.wrapper }
2821
+ },
2822
+ /* @__PURE__ */ React36__namespace.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React36__namespace.createElement(
2823
+ reactAriaComponents.TabList,
2824
+ {
2825
+ ref: tabListRef,
2826
+ className: cn("prt-tab-list", classNames?.list),
2827
+ style: { ...styles?.list },
2828
+ items: tabs
2829
+ },
2830
+ (tab) => /* @__PURE__ */ React36__namespace.createElement(
2831
+ reactAriaComponents.Tab,
2832
+ {
2833
+ id: tab.id,
2834
+ className: cn("prt-tab", classNames?.tab),
2835
+ style: { ...styles?.tab },
2836
+ isDisabled: tab.isDisabled
2837
+ },
2838
+ tab.title
2839
+ )
2840
+ ), /* @__PURE__ */ React36__namespace.createElement(
2841
+ "div",
2842
+ {
2843
+ className: cn("indicator", classNames?.indicator),
2844
+ style: {
2845
+ position: "absolute",
2846
+ left: indicator.left,
2847
+ bottom: 0,
2848
+ background: "var(--color-10)",
2849
+ height: 2,
2850
+ marginBottom: -1,
2851
+ width: indicator.width,
2852
+ transition: "all 0.2s ease",
2853
+ ...styles?.indicator
2854
+ }
2855
+ }
2856
+ )),
2857
+ tabs.map((tab) => /* @__PURE__ */ React36__namespace.createElement(
2858
+ reactAriaComponents.TabPanel,
2859
+ {
2860
+ key: String(tab.id),
2861
+ id: tab.id,
2862
+ className: cn(classNames?.panel),
2863
+ style: { ...styles?.panel }
2864
+ },
2865
+ tab.children
2866
+ ))
2867
+ );
2868
+ }
2869
+ function defaultRowId(item) {
2870
+ const record = item;
2871
+ return record.id ?? record.key;
2872
+ }
2873
+ function Table({
2874
+ columns,
2875
+ data,
2876
+ getRowId = defaultRowId,
2877
+ selectionMode = "none",
2878
+ selectedKeys,
2879
+ onSelectionChange,
2880
+ sortDescriptor,
2881
+ onSortChange,
2882
+ renderEmptyState,
2883
+ radius,
2884
+ className,
2885
+ classNames,
2886
+ style,
2887
+ styles,
2888
+ ...props
2889
+ }) {
2890
+ const racColumns = React36__namespace.useMemo(
2891
+ () => columns.map((column) => ({ ...column, id: column.key })),
2892
+ [columns]
2893
+ );
2894
+ const firstColumnKey = columns[0]?.key;
2895
+ const [internalSort, setInternalSort] = React36__namespace.useState();
2896
+ const activeSort = onSortChange ? sortDescriptor : internalSort;
2897
+ const rows = React36__namespace.useMemo(() => {
2898
+ if (onSortChange || !activeSort) return data;
2899
+ const column = columns.find((c) => c.key === activeSort.column);
2900
+ if (!column) return data;
2901
+ return [...data].sort((a, b) => {
2902
+ const av = a[column.dataIndex];
2903
+ const bv = b[column.dataIndex];
2904
+ const cmp = av < bv ? -1 : av > bv ? 1 : 0;
2905
+ return activeSort.direction === "descending" ? -cmp : cmp;
2906
+ });
2907
+ }, [data, columns, activeSort, onSortChange]);
2908
+ return /* @__PURE__ */ React36__namespace.createElement(
2909
+ reactAriaComponents.Table,
2910
+ {
2911
+ ...props,
2912
+ selectionMode,
2913
+ selectedKeys,
2914
+ onSelectionChange,
2915
+ sortDescriptor: activeSort,
2916
+ onSortChange: onSortChange ?? setInternalSort,
2917
+ "data-radius": radius,
2918
+ className: cn("prt-table", className, classNames?.wrapper),
2919
+ style: { ...style, ...styles?.wrapper }
2920
+ },
2921
+ /* @__PURE__ */ React36__namespace.createElement(
2922
+ reactAriaComponents.TableHeader,
2923
+ {
2924
+ columns: racColumns,
2925
+ className: cn("prt-table-header", classNames?.header)
2926
+ },
2927
+ (column) => /* @__PURE__ */ React36__namespace.createElement(
2928
+ reactAriaComponents.Column,
2929
+ {
2930
+ isRowHeader: column.key === firstColumnKey,
2931
+ allowsSorting: column.allowSorting,
2932
+ className: cn("prt-table-column", classNames?.column),
2933
+ style: styles?.column
2934
+ },
2935
+ ({ allowsSorting, sortDirection }) => /* @__PURE__ */ React36__namespace.createElement("div", { className: "prt-table-column-header" }, /* @__PURE__ */ React36__namespace.createElement("span", null, column.title), allowsSorting && sortDirection && /* @__PURE__ */ React36__namespace.createElement("span", { "aria-hidden": "true", className: "prt-table-sort-indicator" }, sortDirection === "ascending" ? /* @__PURE__ */ React36__namespace.createElement(HiChevronUp, { size: 14 }) : /* @__PURE__ */ React36__namespace.createElement(HiChevronDown, { size: 14 })))
2936
+ )
2937
+ ),
2938
+ /* @__PURE__ */ React36__namespace.createElement(
2939
+ reactAriaComponents.TableBody,
2940
+ {
2941
+ items: rows,
2942
+ dependencies: [columns],
2943
+ renderEmptyState: renderEmptyState ? () => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, renderEmptyState()) : void 0
2944
+ },
2945
+ (item) => /* @__PURE__ */ React36__namespace.createElement(
2946
+ reactAriaComponents.Row,
2947
+ {
2948
+ id: getRowId(item),
2949
+ columns: racColumns,
2950
+ className: cn("prt-table-row", classNames?.row),
2951
+ style: styles?.row
2952
+ },
2953
+ (column) => /* @__PURE__ */ React36__namespace.createElement(
2954
+ reactAriaComponents.Cell,
2955
+ {
2956
+ className: cn("prt-table-cell", classNames?.cell),
2957
+ style: styles?.cell
2958
+ },
2959
+ column.render ? column.render(item[column.dataIndex], item) : item[column.dataIndex]
2960
+ )
2961
+ )
2962
+ )
2963
+ );
2964
+ }
2965
+ function Timeline({
2966
+ items,
2967
+ render,
2968
+ labelKey,
2969
+ getIndicator,
2970
+ hideLastItemTail = true,
2971
+ classNames,
2972
+ styles,
2973
+ className,
2974
+ style
2975
+ }) {
2976
+ return /* @__PURE__ */ React36__namespace.default.createElement(
2977
+ "div",
2978
+ {
2979
+ className: cn(classNames?.wrapper, className),
2980
+ style: { ...styles?.wrapper, ...style }
2981
+ },
2982
+ items.map((item, index) => {
2983
+ const indicator = getIndicator?.(item) ?? /* @__PURE__ */ React36__namespace.default.createElement("div", { className: "prt-timeline-indicator", "data-variant": "outline" });
2984
+ const content = render?.(item) ?? item[labelKey];
2985
+ const isLast = index === items.length - 1;
2986
+ return /* @__PURE__ */ React36__namespace.default.createElement(
2987
+ "div",
2988
+ {
2989
+ className: cn("flex gap-3 prt-timeline-item", classNames?.item),
2990
+ style: { ...styles?.item },
2991
+ key: index
2992
+ },
2993
+ /* @__PURE__ */ React36__namespace.default.createElement("div", { className: "flex flex-col items-center gap-3" }, /* @__PURE__ */ React36__namespace.default.createElement("div", { className: "flex gap-3 prt-timeline-indicator-container" }, indicator), isLast && hideLastItemTail ? null : /* @__PURE__ */ React36__namespace.default.createElement("div", { className: "prt-timeline-item-tail" })),
2994
+ /* @__PURE__ */ React36__namespace.default.createElement(
2995
+ "div",
2996
+ {
2997
+ className: cn(
2998
+ "flex w-full gap-3 prt-timeline-item-content",
2999
+ classNames?.content
3000
+ ),
3001
+ style: { ...styles?.content }
3002
+ },
3003
+ content
3004
+ )
3005
+ );
3006
+ })
3007
+ );
3008
+ }
3009
+ function Modal({
3010
+ variant = "modal",
3011
+ radius,
3012
+ isDismissable = true,
3013
+ width = 400,
3014
+ title,
3015
+ description,
3016
+ onConfirm,
3017
+ onCancel,
3018
+ confirmLabel = "Confirm",
3019
+ cancelLabel = "Cancel",
3020
+ confirmButtonProps,
3021
+ cancelButtonProps,
3022
+ showCloseButton = true,
3023
+ hideTitle,
3024
+ onClose,
3025
+ children,
3026
+ className,
3027
+ style,
3028
+ classNames,
3029
+ styles,
3030
+ ...props
3031
+ }) {
3032
+ const theme = useTheme();
3033
+ return /* @__PURE__ */ React36__namespace.createElement(
3034
+ reactAriaComponents.ModalOverlay,
3035
+ {
3036
+ ...props,
3037
+ isDismissable,
3038
+ style: styles?.underlay,
3039
+ className: cn("prt-modal-underlay", classNames?.underlay)
3040
+ },
3041
+ /* @__PURE__ */ React36__namespace.createElement(
3042
+ reactAriaComponents.Modal,
3043
+ {
3044
+ "data-variant": variant,
3045
+ style: styles?.wrapper,
3046
+ className: cn("prt-modal-container", classNames?.wrapper)
3047
+ },
3048
+ /* @__PURE__ */ React36__namespace.createElement(
3049
+ reactAriaComponents.Dialog,
3050
+ {
3051
+ "aria-label": typeof title === "string" ? title : void 0,
3052
+ "data-radius": radius ?? theme?.radius ?? "md",
3053
+ className: cn("prt-modal-content", className, classNames?.content),
3054
+ style: { width, ...style, ...styles?.content }
3055
+ },
3056
+ ({ close }) => /* @__PURE__ */ React36__namespace.createElement(React36__namespace.Fragment, null, !hideTitle && /* @__PURE__ */ React36__namespace.createElement(
3057
+ "header",
3058
+ {
3059
+ style: styles?.header,
3060
+ className: cn(
3061
+ "prt-modal-head flex items-center justify-between gap-8",
3062
+ classNames?.header
3063
+ )
3064
+ },
3065
+ /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-1" }, title && /* @__PURE__ */ React36__namespace.createElement(
3066
+ "div",
3067
+ {
3068
+ style: styles?.title,
3069
+ className: cn(
3070
+ "prt-modal-title font-medium text-base text-black",
3071
+ classNames?.title
3072
+ )
3073
+ },
3074
+ title
3075
+ ), description && /* @__PURE__ */ React36__namespace.createElement("div", { className: "text-xs leading-normal text-gray-500" }, description)),
3076
+ showCloseButton && /* @__PURE__ */ React36__namespace.createElement(
3077
+ IconButton,
3078
+ {
3079
+ variant: "ghost",
3080
+ color: "gray",
3081
+ size: "sm",
3082
+ onPress: () => {
3083
+ onClose?.();
3084
+ close();
3085
+ }
3086
+ },
3087
+ /* @__PURE__ */ React36__namespace.createElement(HiX, { size: 18 })
3088
+ )
3089
+ ), /* @__PURE__ */ React36__namespace.createElement(
3090
+ "div",
3091
+ {
3092
+ className: cn(
3093
+ "prt-modal-body flex flex-col gap-3",
3094
+ classNames?.body
3095
+ ),
3096
+ style: styles?.body
3097
+ },
3098
+ children
3099
+ ), (onConfirm || onCancel) && /* @__PURE__ */ React36__namespace.createElement(
3100
+ "footer",
3101
+ {
3102
+ style: styles?.footer,
3103
+ className: cn(
3104
+ "prt-modal-footer flex w-full justify-end gap-2.5",
3105
+ classNames?.footer
3106
+ )
3107
+ },
3108
+ onCancel && /* @__PURE__ */ React36__namespace.createElement(
3109
+ Button,
3110
+ {
3111
+ onPress: () => {
3112
+ onCancel();
3113
+ close();
3114
+ },
3115
+ variant: "outline",
3116
+ color: "gray",
3117
+ ...cancelButtonProps
3118
+ },
3119
+ cancelLabel
3120
+ ),
3121
+ onConfirm && /* @__PURE__ */ React36__namespace.createElement(Button, { onPress: onConfirm, ...confirmButtonProps }, confirmLabel)
3122
+ ))
3123
+ )
3124
+ )
3125
+ );
3126
+ }
3127
+ function useModal(props = {}) {
3128
+ return reactStately.useOverlayTriggerState(props);
3129
+ }
3130
+
3131
+ // src/utils/regex.ts
3132
+ var EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
3133
+ function useControlledState(value, defaultValue, onChange) {
3134
+ const [state, setState] = React36__namespace.useState(value || defaultValue);
3135
+ const isControlled = !isUndefinedOrNull(value);
3136
+ const controlledValue = isControlled ? value : state;
3137
+ const setValue = React36__namespace.useCallback(
3138
+ (value2) => {
3139
+ if (!isControlled) {
3140
+ setState(value2);
3141
+ }
3142
+ if (!Object.is(controlledValue, value2)) {
3143
+ onChange?.(value2);
3144
+ }
3145
+ },
3146
+ [isControlled, controlledValue]
3147
+ );
3148
+ return [controlledValue, setValue];
3149
+ }
3150
+
3151
+ // src/components/tag-input/tag-input.tsx
3152
+ function isValidUrl(value) {
3153
+ const candidate = /^https?:\/\//.test(value) ? value : `https://${value}`;
3154
+ try {
3155
+ new URL(candidate);
3156
+ return /\./.test(value);
3157
+ } catch {
3158
+ return false;
3159
+ }
3160
+ }
3161
+ var FORMAT_VALIDATORS = {
3162
+ text: (value) => value.trim().length > 0,
3163
+ email: (value) => EMAIL_REGEX.test(value),
3164
+ url: isValidUrl,
3165
+ number: (value) => value.trim() !== "" && !Number.isNaN(Number(value))
3166
+ };
3167
+ var SHAPE_RADIUS = {
3168
+ pill: "full",
3169
+ rounded: "md",
3170
+ sharp: "none"
3171
+ };
3172
+ function dedupe(values) {
3173
+ if (!values) return void 0;
3174
+ return Array.from(new Set(values));
3175
+ }
3176
+ function escapeRegExp(value) {
3177
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3178
+ }
3179
+ function TagInput({
3180
+ appearance = "outline",
3181
+ size = "md",
3182
+ label,
3183
+ error,
3184
+ description,
3185
+ placeholder,
3186
+ tags,
3187
+ defaultTags,
3188
+ format = "text",
3189
+ validate,
3190
+ delimiters = [","],
3191
+ isRequired,
3192
+ tagColor = "gray",
3193
+ tagVariant = "light",
3194
+ tagShape = "rounded",
3195
+ tagSize = "md",
3196
+ color = "gray",
3197
+ radius,
3198
+ validationStatus,
3199
+ className,
3200
+ classNames,
3201
+ style,
3202
+ styles,
3203
+ onChange,
3204
+ onInputValueChange,
3205
+ renderTag,
3206
+ ref
3207
+ }) {
3208
+ const [inputValue, setInputValue] = React36__namespace.useState("");
3209
+ const [values, setValues] = useControlledState(
3210
+ dedupe(tags),
3211
+ dedupe(defaultTags) ?? [],
3212
+ onChange
3213
+ );
3214
+ const inputRef = React36__namespace.useRef(null);
3215
+ const isValid = validate ?? FORMAT_VALIDATORS[format];
3216
+ const splitPattern = React36__namespace.useMemo(
3217
+ () => new RegExp(`[${delimiters.map(escapeRegExp).join("")}\\n]`),
3218
+ [delimiters]
3219
+ );
3220
+ function commit(raw) {
3221
+ const candidates = raw.split(splitPattern).map((v) => v.trim()).filter(Boolean).filter(isValid);
3222
+ if (!candidates.length) return;
3223
+ setValues(Array.from(/* @__PURE__ */ new Set([...values, ...candidates])));
3224
+ setInputValue("");
3225
+ }
3226
+ function removeValue(value) {
3227
+ setValues(values.filter((v) => v !== value));
3228
+ }
3229
+ function handleInputChange(value) {
3230
+ if (delimiters.some((d) => value.includes(d))) {
3231
+ const parts = value.split(splitPattern);
3232
+ const trailing = parts.pop() ?? "";
3233
+ commit(parts.join(","));
3234
+ setInputValue(trailing);
3235
+ onInputValueChange?.(trailing);
3236
+ return;
3237
+ }
3238
+ setInputValue(value);
3239
+ onInputValueChange?.(value);
3240
+ }
3241
+ function onKeyDown(e) {
3242
+ if (e.key === "Enter") {
3243
+ e.preventDefault();
3244
+ commit(inputValue);
3245
+ return;
3246
+ }
3247
+ if (e.key === "Backspace" && !inputValue && values.length) {
3248
+ removeValue(values[values.length - 1]);
3249
+ }
3250
+ }
3251
+ function captureFocus() {
3252
+ inputRef.current?.focus();
3253
+ }
3254
+ const groupLabel = typeof label === "string" ? label : "tags";
3255
+ return /* @__PURE__ */ React36__namespace.createElement(
3256
+ reactAriaComponents.TextField,
3257
+ {
3258
+ value: inputValue,
3259
+ onChange: handleInputChange,
3260
+ isRequired,
3261
+ isInvalid: !!error
3262
+ },
3263
+ /* @__PURE__ */ React36__namespace.createElement(
3264
+ Field,
3265
+ {
3266
+ replaceDefaultControlWrapper: true,
3267
+ label,
3268
+ error,
3269
+ description,
3270
+ color,
3271
+ size,
3272
+ radius,
3273
+ appearance,
3274
+ validationStatus,
3275
+ className,
3276
+ classNames,
3277
+ style,
3278
+ styles
3279
+ },
3280
+ /* @__PURE__ */ React36__namespace.createElement(
3281
+ "div",
3282
+ {
3283
+ ref,
3284
+ className: cn("prt-input-control", "prt-tag-field"),
3285
+ "data-appearance": appearance,
3286
+ onClick: captureFocus
3287
+ },
3288
+ /* @__PURE__ */ React36__namespace.createElement(
3289
+ reactAriaComponents.TagGroup,
3290
+ {
3291
+ "aria-label": groupLabel,
3292
+ className: "prt-tag-field-group",
3293
+ onRemove: (keys) => setValues(values.filter((v) => !keys.has(v)))
3294
+ },
3295
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.TagList, { className: "prt-tag-field-list" }, values.map((value) => /* @__PURE__ */ React36__namespace.createElement(
3296
+ reactAriaComponents.Tag,
3297
+ {
3298
+ key: value,
3299
+ id: value,
3300
+ textValue: value,
3301
+ className: "prt-tag-field-tag"
3302
+ },
3303
+ renderTag ? renderTag(value, removeValue) : /* @__PURE__ */ React36__namespace.createElement(
3304
+ Tag,
3305
+ {
3306
+ variant: tagVariant,
3307
+ color: tagColor,
3308
+ radius: tagShape ? SHAPE_RADIUS[tagShape] : "full",
3309
+ size: tagSize,
3310
+ append: /* @__PURE__ */ React36__namespace.createElement(
3311
+ reactAriaComponents.Button,
3312
+ {
3313
+ slot: "remove",
3314
+ className: "prt-tag-field-remove",
3315
+ "aria-label": `Remove ${value}`
3316
+ },
3317
+ /* @__PURE__ */ React36__namespace.createElement(HiX, { size: 14 })
3318
+ )
3319
+ },
3320
+ value
3321
+ )
3322
+ )))
3323
+ ),
3324
+ /* @__PURE__ */ React36__namespace.createElement(
3325
+ reactAriaComponents.Input,
3326
+ {
3327
+ ref: inputRef,
3328
+ placeholder,
3329
+ onKeyDown,
3330
+ className: "prt-tag-field-input"
3331
+ }
3332
+ )
3333
+ )
3334
+ )
3335
+ );
3336
+ }
3337
+ var PopoverContext = React36__namespace.createContext(null);
3338
+ function usePopoverContext(component) {
3339
+ const ctx = React36__namespace.useContext(PopoverContext);
3340
+ if (!ctx) {
3341
+ throw new Error(`${component} must be used within a Popover`);
3342
+ }
3343
+ return ctx;
3344
+ }
3345
+ function Popover({ children, ...props }) {
3346
+ const triggerRef = React36__namespace.useRef(null);
3347
+ const state = reactStately.useOverlayTriggerState(props);
3348
+ return /* @__PURE__ */ React36__namespace.createElement(PopoverContext.Provider, { value: { triggerRef, state } }, children);
3349
+ }
3350
+ function PopoverTrigger({ children }) {
3351
+ const ctx = usePopoverContext("PopoverTrigger");
3352
+ return React36__namespace.cloneElement(children, {
3353
+ ref: ctx.triggerRef,
3354
+ onPress: () => ctx.state.toggle()
3355
+ });
3356
+ }
3357
+ function PopoverContent({
3358
+ children,
3359
+ offset = 12,
3360
+ placement,
3361
+ style,
3362
+ className,
3363
+ classNames,
3364
+ styles,
3365
+ width,
3366
+ ...props
3367
+ }) {
3368
+ const ctx = usePopoverContext("PopoverContent");
3369
+ const theme = useTheme();
3370
+ return /* @__PURE__ */ React36__namespace.createElement(
3371
+ reactAriaComponents.Popover,
3372
+ {
3373
+ ...props,
3374
+ triggerRef: ctx.triggerRef,
3375
+ isOpen: ctx.state.isOpen,
3376
+ onOpenChange: ctx.state.setOpen,
3377
+ offset,
3378
+ placement,
3379
+ "data-color": theme?.color,
3380
+ "data-radius": theme?.radius,
3381
+ className: cn("prt-popover", classNames?.popover),
3382
+ style: { ...width != null ? { width } : null, ...styles?.popover }
3383
+ },
3384
+ /* @__PURE__ */ React36__namespace.createElement(
3385
+ "div",
3386
+ {
3387
+ "data-radius": "md",
3388
+ className: cn("prt-popover-content", className, classNames?.content),
3389
+ style: { ...style, ...styles?.content }
3390
+ },
3391
+ children
3392
+ )
3393
+ );
3394
+ }
3395
+ var TagGroupVariantContext = React36__namespace.createContext({});
3396
+ function TagGroup({
3397
+ label,
3398
+ description,
3399
+ errorMessage,
3400
+ items,
3401
+ children,
3402
+ renderEmptyState,
3403
+ activeColor,
3404
+ activeVariant,
3405
+ idleColor,
3406
+ idleVariant,
3407
+ autoColor,
3408
+ classNames,
3409
+ styles,
3410
+ className,
3411
+ style,
3412
+ ...props
3413
+ }) {
3414
+ const variants = React36__namespace.useMemo(
3415
+ () => ({ activeColor, activeVariant, idleColor, idleVariant, autoColor }),
3416
+ [activeColor, activeVariant, idleColor, idleVariant, autoColor]
3417
+ );
3418
+ return /* @__PURE__ */ React36__namespace.createElement(
3419
+ reactAriaComponents.TagGroup,
3420
+ {
3421
+ ...props,
3422
+ "aria-label": typeof label === "string" ? label : void 0
3423
+ },
3424
+ /* @__PURE__ */ React36__namespace.createElement(
3425
+ "div",
3426
+ {
3427
+ className: cn("flex flex-col gap-3 tag-group", classNames?.wrapper, className),
3428
+ style: { ...styles?.wrapper, ...style }
3429
+ },
3430
+ label && /* @__PURE__ */ React36__namespace.createElement(InputLabel, null, label),
3431
+ /* @__PURE__ */ React36__namespace.createElement(TagGroupVariantContext.Provider, { value: variants }, /* @__PURE__ */ React36__namespace.createElement(
3432
+ reactAriaComponents.TagList,
3433
+ {
3434
+ items,
3435
+ renderEmptyState,
3436
+ className: cn("prt-tag-list", classNames?.list),
3437
+ style: { display: "flex", flexWrap: "wrap", gap: 6, ...styles?.list }
3438
+ },
3439
+ children
3440
+ )),
3441
+ errorMessage && /* @__PURE__ */ React36__namespace.createElement(InputError, null, errorMessage),
3442
+ description && /* @__PURE__ */ React36__namespace.createElement("div", { className: "text-sm text-gray-700" }, description)
3443
+ )
3444
+ );
3445
+ }
3446
+ function TagGroupItem({
3447
+ children,
3448
+ textValue,
3449
+ ...props
3450
+ }) {
3451
+ const theme = useTheme();
3452
+ const {
3453
+ activeColor,
3454
+ activeVariant = "solid",
3455
+ idleColor = "gray",
3456
+ idleVariant = "outline",
3457
+ autoColor
3458
+ } = React36__namespace.useContext(TagGroupVariantContext);
3459
+ const resolvedActive = activeColor ?? theme?.color ?? "gray";
3460
+ const tv = textValue ?? (typeof children === "string" ? children : void 0);
3461
+ return /* @__PURE__ */ React36__namespace.createElement(
3462
+ reactAriaComponents.Tag,
3463
+ {
3464
+ ...props,
3465
+ textValue: tv,
3466
+ render: (domProps, { isSelected }) => {
3467
+ const color = autoColor ? getRandomColor(String(tv ?? "")) : isSelected ? resolvedActive : idleColor;
3468
+ const variant = isSelected ? activeVariant : idleVariant;
3469
+ return /* @__PURE__ */ React36__namespace.createElement(
3470
+ "div",
3471
+ {
3472
+ ...domProps,
3473
+ "data-is-toggle": "true",
3474
+ "data-radius": "full",
3475
+ "data-size": "sm",
3476
+ "data-color": color,
3477
+ "data-variant": variant,
3478
+ className: "prt-button prt-size"
3479
+ },
3480
+ children
3481
+ );
3482
+ }
3483
+ }
3484
+ );
3485
+ }
3486
+ function ColorPicker({
3487
+ onChange,
3488
+ color: colorProp,
3489
+ styles,
3490
+ classNames,
3491
+ className,
3492
+ style
3493
+ }) {
3494
+ const [colorSpace, setColorSpace] = React36__namespace.useState("hex");
3495
+ const [color, setColor] = useControlledState(
3496
+ colorProp,
3497
+ reactAriaComponents.parseColor("#BB66CC").toFormat("hsla"),
3498
+ onChange
3499
+ );
3500
+ function handleChange(color2) {
3501
+ setColor(color2);
3502
+ onChange?.(color2);
3503
+ }
3504
+ function setAlpha(alpha) {
3505
+ if (isNaN(alpha)) {
3506
+ return;
3507
+ }
3508
+ const newColor = color.withChannelValue("alpha", alpha);
3509
+ setColor(newColor);
3510
+ }
3511
+ const [h, s, l] = color.getColorChannels();
3512
+ const rgbaColor = color.toFormat("rgba");
3513
+ const [r, g, b] = rgbaColor.getColorChannels();
3514
+ return /* @__PURE__ */ React36__namespace.createElement(
3515
+ "div",
3516
+ {
3517
+ className: cn("flex flex-col gap-3", className, classNames?.wrapper),
3518
+ style: { width: 240, ...style, ...styles?.wrapper }
3519
+ },
3520
+ /* @__PURE__ */ React36__namespace.createElement(
3521
+ ColorArea,
3522
+ {
3523
+ onChange: handleChange,
3524
+ onChangeEnd: handleChange,
3525
+ xChannel: s,
3526
+ yChannel: l,
3527
+ value: color ?? reactAriaComponents.parseColor("hsl(219, 79%, 66%)"),
3528
+ style: { width: "100%", height: 140 }
3529
+ }
3530
+ ),
3531
+ /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-3", style: { padding: 8 } }, /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-2" }, /* @__PURE__ */ React36__namespace.createElement(
3532
+ ColorSlider,
3533
+ {
3534
+ value: color,
3535
+ onChange: handleChange,
3536
+ onChangeEnd: handleChange,
3537
+ channel: h
3538
+ }
3539
+ ), /* @__PURE__ */ React36__namespace.createElement(
3540
+ ColorSlider,
3541
+ {
3542
+ value: color,
3543
+ onChange: handleChange,
3544
+ onChangeEnd: handleChange,
3545
+ channel: "alpha"
3546
+ }
3547
+ )), /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex gap-1", style: { width: "100%" } }, colorSpace === "hex" && /* @__PURE__ */ React36__namespace.createElement(Space, { style: { gap: 3 }, compact: true }, /* @__PURE__ */ React36__namespace.createElement(
3548
+ ColorField,
3549
+ {
3550
+ value: color,
3551
+ onChange: (c) => c && handleChange(c),
3552
+ size: "sm",
3553
+ style: { width: "60%" },
3554
+ appearance: "filled",
3555
+ placeholder: "Add a color"
3556
+ }
3557
+ ), /* @__PURE__ */ React36__namespace.createElement(
3558
+ NumberInput,
3559
+ {
3560
+ onChange: (n) => setAlpha(n),
3561
+ maxValue: 1,
3562
+ formatOptions: {
3563
+ style: "percent",
3564
+ maximumFractionDigits: 0
3565
+ },
3566
+ size: "sm",
3567
+ value: color.getChannelValue("alpha"),
3568
+ style: { width: "40%" },
3569
+ appearance: "filled"
3570
+ }
3571
+ )), ["rgb", "hsl"].includes(colorSpace) && /* @__PURE__ */ React36__namespace.createElement(Space, { style: { gap: 3 }, compact: true }, /* @__PURE__ */ React36__namespace.createElement(
3572
+ NumberInput,
3573
+ {
3574
+ value: colorSpace === "rgb" ? rgbaColor.getChannelValue(r) : color.getChannelValue(h),
3575
+ appearance: "filled",
3576
+ size: "sm"
3577
+ }
3578
+ ), /* @__PURE__ */ React36__namespace.createElement(
3579
+ NumberInput,
3580
+ {
3581
+ value: colorSpace === "rgb" ? rgbaColor.getChannelValue(g) : color.getChannelValue(s),
3582
+ appearance: "filled",
3583
+ size: "sm"
3584
+ }
3585
+ ), /* @__PURE__ */ React36__namespace.createElement(
3586
+ NumberInput,
3587
+ {
3588
+ value: colorSpace === "rgb" ? rgbaColor.getChannelValue(b) : color.getChannelValue(l),
3589
+ appearance: "filled",
3590
+ size: "sm"
3591
+ }
3592
+ ), /* @__PURE__ */ React36__namespace.createElement(
3593
+ NumberInput,
3594
+ {
3595
+ formatOptions: {
3596
+ style: "percent",
3597
+ maximumFractionDigits: 0
3598
+ },
3599
+ value: colorSpace === "rgb" ? rgbaColor.getChannelValue("alpha") : color.getChannelValue("alpha"),
3600
+ appearance: "filled",
3601
+ size: "sm"
3602
+ }
3603
+ )), /* @__PURE__ */ React36__namespace.createElement(
3604
+ Select,
3605
+ {
3606
+ style: { width: "60%" },
3607
+ valueKey: "id",
3608
+ onChange: (v) => setColorSpace(v.target.value ?? colorSpace),
3609
+ showSelectionIndicator: false,
3610
+ value: colorSpace,
3611
+ size: "sm",
3612
+ appearance: "filled",
3613
+ items: ["hex", "rgb", "hsl"].map((o) => ({
3614
+ label: o.toUpperCase(),
3615
+ id: o
3616
+ }))
3617
+ }
3618
+ )), /* @__PURE__ */ React36__namespace.createElement(Separator, { color: "gray" }), /* @__PURE__ */ React36__namespace.createElement("div", { className: "flex gap-3" }, /* @__PURE__ */ React36__namespace.createElement(
3619
+ ColorSwatchPicker,
3620
+ {
3621
+ styles: {
3622
+ wrapper: { gap: 6 },
3623
+ swatch: {
3624
+ borderRadius: 5
3625
+ }
3626
+ },
3627
+ onChange: handleChange,
3628
+ colors: [
3629
+ "#000000",
3630
+ "#333333",
3631
+ "#555555",
3632
+ "#777777",
3633
+ "#999999",
3634
+ "#bbbbbb",
3635
+ "#dddddd",
3636
+ "#ffffff",
3637
+ "#4455BB",
3638
+ "#1199EE",
3639
+ "#55CCFF",
3640
+ "#22CCDD",
3641
+ "#22AA99",
3642
+ "#66BB66",
3643
+ "#99CC66",
3644
+ "#CCDD33",
3645
+ "#7755CC",
3646
+ "#BB66CC",
3647
+ "#FF88AA",
3648
+ "#EE4444",
3649
+ "#FF7744",
3650
+ "#FFAA22",
3651
+ "#FFCC66",
3652
+ "#FFEE66"
3653
+ ].map((color2) => ({
3654
+ label: color2,
3655
+ color: reactAriaComponents.parseColor(color2).toString("hsl"),
3656
+ key: color2
3657
+ }))
3658
+ }
3659
+ ))))
3660
+ );
3661
+ }
3662
+ function ColorArea({
3663
+ className,
3664
+ classNames,
3665
+ style,
3666
+ styles,
3667
+ radius,
3668
+ ...props
3669
+ }) {
3670
+ const theme = useTheme();
3671
+ return /* @__PURE__ */ React36__namespace.createElement(
3672
+ reactAriaComponents.ColorArea,
3673
+ {
3674
+ ...props,
3675
+ className: cn("prt-color-area", className, classNames?.wrapper),
3676
+ "data-radius": radius ?? theme?.radius ?? "lg",
3677
+ style: ({ defaultStyle }) => ({
3678
+ ...defaultStyle,
3679
+ ...styles?.wrapper,
3680
+ ...style
3681
+ })
3682
+ },
3683
+ /* @__PURE__ */ React36__namespace.createElement(
3684
+ reactAriaComponents.ColorThumb,
3685
+ {
3686
+ className: cn("prt-color-area-thumb", classNames?.thumb),
3687
+ style: ({ defaultStyle }) => ({ ...defaultStyle, ...styles?.thumb })
3688
+ }
3689
+ )
3690
+ );
3691
+ }
3692
+ function ColorField({
3693
+ className,
3694
+ classNames,
3695
+ style,
3696
+ styles,
3697
+ inputRef,
3698
+ wrapperRef,
3699
+ prepend,
3700
+ append,
3701
+ label,
3702
+ description,
3703
+ error,
3704
+ color,
3705
+ size,
3706
+ radius,
3707
+ appearance,
3708
+ validationStatus,
3709
+ shape,
3710
+ placeholder,
3711
+ ...colorFieldProps
3712
+ }) {
3713
+ return /* @__PURE__ */ React36__namespace.createElement(
3714
+ reactAriaComponents.ColorField,
3715
+ {
3716
+ ...colorFieldProps,
3717
+ isInvalid: !!error,
3718
+ "aria-label": colorFieldProps["aria-label"] ?? "color-field"
3719
+ },
3720
+ /* @__PURE__ */ React36__namespace.createElement(
3721
+ Field,
3722
+ {
3723
+ className,
3724
+ classNames,
3725
+ styles,
3726
+ style,
3727
+ wrapperRef,
3728
+ prepend,
3729
+ append,
3730
+ label,
3731
+ description,
3732
+ error,
3733
+ color,
3734
+ size,
3735
+ radius,
3736
+ appearance,
3737
+ validationStatus
3738
+ },
3739
+ /* @__PURE__ */ React36__namespace.createElement(
3740
+ reactAriaComponents.Input,
3741
+ {
3742
+ ref: inputRef,
3743
+ placeholder,
3744
+ "data-has-left-addon": !!prepend,
3745
+ "data-has-right-addon": !!append,
3746
+ style: styles?.input,
3747
+ className: cn("prt-text-input-el", classNames?.input)
3748
+ }
3749
+ )
3750
+ )
3751
+ );
3752
+ }
3753
+ function ColorSwatchPicker({
3754
+ colors,
3755
+ size,
3756
+ radius,
3757
+ onChange,
3758
+ className,
3759
+ classNames,
3760
+ style,
3761
+ styles,
3762
+ ...props
3763
+ }) {
3764
+ return /* @__PURE__ */ React36__namespace.createElement(
3765
+ reactAriaComponents.ColorSwatchPicker,
3766
+ {
3767
+ ...props,
3768
+ onChange,
3769
+ "aria-label": props["aria-label"] ?? "color swatch picker",
3770
+ className: cn("prt-color-swatch-picker", className, classNames?.wrapper),
3771
+ style: { ...style, ...styles?.wrapper }
3772
+ },
3773
+ colors.map((option) => /* @__PURE__ */ React36__namespace.createElement(
3774
+ reactAriaComponents.ColorSwatchPickerItem,
3775
+ {
3776
+ key: option.key ?? option.color,
3777
+ color: option.color,
3778
+ className: cn("prt-color-swatch-item", classNames?.swatch),
3779
+ style: styles?.swatch
3780
+ },
3781
+ /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.ColorSwatch, { className: "prt-color-swatch" })
3782
+ ))
3783
+ );
3784
+ }
3785
+ function ColorSlider({ label, ...props }) {
3786
+ return /* @__PURE__ */ React36__namespace.createElement(
3787
+ reactAriaComponents.ColorSlider,
3788
+ {
3789
+ ...props,
3790
+ "aria-label": props["aria-label"] ?? "color-slider"
3791
+ },
3792
+ /* @__PURE__ */ React36__namespace.createElement(Field, { label, className: "prt-color-slider", replaceDefaultControlWrapper: true }, /* @__PURE__ */ React36__namespace.createElement(reactAriaComponents.SliderTrack, { className: "prt-color-slider-track" }, /* @__PURE__ */ React36__namespace.createElement("div", { className: "prt-color-slider-checkers" }), /* @__PURE__ */ React36__namespace.createElement(
3793
+ reactAriaComponents.ColorThumb,
3794
+ {
3795
+ className: "prt-color-slider-thumb",
3796
+ style: ({ defaultStyle }) => ({ ...defaultStyle })
3797
+ }
3798
+ )))
3799
+ );
3800
+ }
3801
+ function parseColor2(color) {
3802
+ return reactAriaComponents.parseColor(color);
3803
+ }
3804
+ function toKeys(value) {
3805
+ if (value == null) return void 0;
3806
+ return new Set(Array.isArray(value) ? value : [value]);
3807
+ }
3808
+ function ToggleGroup({
3809
+ selectionMode = "single",
3810
+ value,
3811
+ defaultValue,
3812
+ onChange,
3813
+ label,
3814
+ size,
3815
+ radius,
3816
+ idleColor,
3817
+ idleVariant,
3818
+ activeColor,
3819
+ activeVariant,
3820
+ disallowEmptySelection,
3821
+ orientation,
3822
+ compact,
3823
+ gap,
3824
+ className,
3825
+ classNames,
3826
+ style,
3827
+ styles,
3828
+ children
3829
+ }) {
3830
+ const groupDefaults = React36__namespace.useMemo(
3831
+ () => ({ idleColor, idleVariant, activeColor, activeVariant, size, radius }),
3832
+ [idleColor, idleVariant, activeColor, activeVariant, size, radius]
3833
+ );
3834
+ function handleSelectionChange(keys) {
3835
+ const arr = [...keys].map(String);
3836
+ onChange?.(
3837
+ selectionMode === "multiple" ? arr : arr[0] ?? ""
3838
+ );
3839
+ }
3840
+ return /* @__PURE__ */ React36__namespace.createElement(
3841
+ reactAriaComponents.ToggleButtonGroup,
3842
+ {
3843
+ "aria-label": label,
3844
+ selectionMode,
3845
+ selectedKeys: toKeys(value),
3846
+ defaultSelectedKeys: toKeys(defaultValue),
3847
+ onSelectionChange: handleSelectionChange,
3848
+ disallowEmptySelection: disallowEmptySelection ?? selectionMode === "single",
3849
+ orientation
3850
+ },
3851
+ /* @__PURE__ */ React36__namespace.createElement(ToggleButtonGroupContext.Provider, { value: groupDefaults }, /* @__PURE__ */ React36__namespace.createElement(
3852
+ Space,
3853
+ {
3854
+ compact,
3855
+ gap,
3856
+ className,
3857
+ classNames,
3858
+ style,
3859
+ styles
3860
+ },
3861
+ children
3862
+ ))
3863
+ );
3864
+ }
3865
+ function Toggle({ value, ...props }) {
3866
+ return /* @__PURE__ */ React36__namespace.createElement(ToggleButton, { id: value, ...props });
3867
+ }
3868
+
3869
+ exports.Avatar = Avatar;
3870
+ exports.AvatarGroup = AvatarGroup;
3871
+ exports.Button = Button;
3872
+ exports.ButtonGroup = ButtonGroup;
3873
+ exports.Calendar = Calendar;
3874
+ exports.Checkbox = Checkbox;
3875
+ exports.CheckboxGroup = CheckboxGroup;
3876
+ exports.CheckboxItem = CheckboxItem;
3877
+ exports.ColorArea = ColorArea;
3878
+ exports.ColorField = ColorField;
3879
+ exports.ColorPicker = ColorPicker;
3880
+ exports.ColorSlider = ColorSlider;
3881
+ exports.ColorSwatchPicker = ColorSwatchPicker;
3882
+ exports.ComboBox = ComboBox;
3883
+ exports.DateField = DateField;
3884
+ exports.DatePicker = DatePicker;
3885
+ exports.DateRangePicker = DateRangePicker;
3886
+ exports.FileUploader = FileUploader;
3887
+ exports.IconButton = IconButton;
3888
+ exports.Input = Input;
3889
+ exports.ListBox = ListBox;
3890
+ exports.ListBoxItem = ListBoxItem;
3891
+ exports.ListBoxSection = ListBoxSection;
3892
+ exports.Loader = Loader;
3893
+ exports.Menu = Menu;
3894
+ exports.MenuContent = MenuContent;
3895
+ exports.MenuItem = MenuItem;
3896
+ exports.MenuSection = MenuSection;
3897
+ exports.MenuTrigger = MenuTrigger;
3898
+ exports.Modal = Modal;
3899
+ exports.NumberInput = NumberInput;
3900
+ exports.Option = ListBoxItem;
3901
+ exports.Popover = Popover;
3902
+ exports.PopoverContent = PopoverContent;
3903
+ exports.PopoverTrigger = PopoverTrigger;
3904
+ exports.Progress = Progress;
3905
+ exports.Radio = Radio;
3906
+ exports.RadioCard = RadioCard;
3907
+ exports.RadioGroup = RadioGroup;
3908
+ exports.RadioItem = RadioItem;
3909
+ exports.RangeCalendar = RangeCalendar;
3910
+ exports.Section = ListBoxSection;
3911
+ exports.Select = Select;
3912
+ exports.Separator = Separator;
3913
+ exports.Slider = Slider;
3914
+ exports.Space = Space;
3915
+ exports.Sticker = Sticker;
3916
+ exports.Switch = Switch;
3917
+ exports.Tab = Tab;
3918
+ exports.Table = Table;
3919
+ exports.Tabs = Tabs;
3920
+ exports.Tag = Tag;
3921
+ exports.TagGroup = TagGroup;
3922
+ exports.TagGroupItem = TagGroupItem;
3923
+ exports.TagInput = TagInput;
3924
+ exports.Text = Text;
3925
+ exports.Textarea = Textarea;
3926
+ exports.ThemeProvider = ThemeProvider;
3927
+ exports.TimeField = TimeField;
3928
+ exports.Timeline = Timeline;
3929
+ exports.Toggle = Toggle;
3930
+ exports.ToggleButton = ToggleButton;
3931
+ exports.ToggleGroup = ToggleGroup;
3932
+ exports.parseColor = parseColor2;
3933
+ exports.useModal = useModal;
3934
+ exports.useTheme = useTheme;
3935
+ //# sourceMappingURL=index.js.map
3936
+ //# sourceMappingURL=index.js.map