@parrot-co/parrot-ui 1.0.0-beta.0 → 1.0.0-beta.2
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.d.mts +229 -31
- package/dist/index.d.ts +229 -31
- package/dist/index.js +1402 -436
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1384 -438
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +437 -32
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React13 = require('react');
|
|
4
4
|
var reactAriaComponents = require('react-aria-components');
|
|
5
|
-
var
|
|
5
|
+
var inputOtp = require('input-otp');
|
|
6
6
|
var date = require('@internationalized/date');
|
|
7
7
|
var reactStately = require('react-stately');
|
|
8
|
+
var reactDom = require('react-dom');
|
|
9
|
+
var reactAria = require('react-aria');
|
|
8
10
|
|
|
9
11
|
function _interopNamespace(e) {
|
|
10
12
|
if (e && e.__esModule) return e;
|
|
@@ -24,7 +26,7 @@ function _interopNamespace(e) {
|
|
|
24
26
|
return Object.freeze(n);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
var
|
|
29
|
+
var React13__namespace = /*#__PURE__*/_interopNamespace(React13);
|
|
28
30
|
|
|
29
31
|
// src/components/input/input.tsx
|
|
30
32
|
|
|
@@ -87,7 +89,7 @@ function cx(...args) {
|
|
|
87
89
|
return classStr;
|
|
88
90
|
}
|
|
89
91
|
function cn(...args) {
|
|
90
|
-
return
|
|
92
|
+
return cx(...args);
|
|
91
93
|
}
|
|
92
94
|
var validDOMProperties = /* @__PURE__ */ new Set([
|
|
93
95
|
// Common HTML attributes
|
|
@@ -309,7 +311,7 @@ function InputLabel({
|
|
|
309
311
|
reactAriaComponents.LabelContext
|
|
310
312
|
);
|
|
311
313
|
const { elementType: ElementType = "label", ...labelProps } = merged;
|
|
312
|
-
return /* @__PURE__ */
|
|
314
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
313
315
|
ElementType,
|
|
314
316
|
{
|
|
315
317
|
...labelProps,
|
|
@@ -326,7 +328,7 @@ function InputError({
|
|
|
326
328
|
className,
|
|
327
329
|
...props
|
|
328
330
|
}) {
|
|
329
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
330
332
|
reactAriaComponents.FieldError,
|
|
331
333
|
{
|
|
332
334
|
...props,
|
|
@@ -337,7 +339,7 @@ function InputError({
|
|
|
337
339
|
children
|
|
338
340
|
);
|
|
339
341
|
}
|
|
340
|
-
var SpaceContext =
|
|
342
|
+
var SpaceContext = React13__namespace.createContext({ classNames: {}, compactItemWrapperAdjust: "" });
|
|
341
343
|
var GAP_CLASS = {
|
|
342
344
|
none: "gap-0",
|
|
343
345
|
"4xs": "gap-0.5",
|
|
@@ -362,13 +364,13 @@ function Space({
|
|
|
362
364
|
style,
|
|
363
365
|
styles
|
|
364
366
|
}) {
|
|
365
|
-
const childrenCount =
|
|
366
|
-
const nodes =
|
|
367
|
-
return
|
|
367
|
+
const childrenCount = React13__namespace.Children.count(children);
|
|
368
|
+
const nodes = React13__namespace.useMemo(() => {
|
|
369
|
+
return React13__namespace.Children.map(children, (child, index) => {
|
|
368
370
|
const isFirstChild = index == 0;
|
|
369
371
|
const isLastChild = index == childrenCount - 1;
|
|
370
|
-
if (!
|
|
371
|
-
return /* @__PURE__ */
|
|
372
|
+
if (!React13__namespace.isValidElement(child)) return null;
|
|
373
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
372
374
|
SpaceContext.Provider,
|
|
373
375
|
{
|
|
374
376
|
value: {
|
|
@@ -384,7 +386,7 @@ function Space({
|
|
|
384
386
|
);
|
|
385
387
|
});
|
|
386
388
|
}, [children]);
|
|
387
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
388
390
|
"div",
|
|
389
391
|
{
|
|
390
392
|
"data-compact": compact,
|
|
@@ -401,15 +403,15 @@ function Space({
|
|
|
401
403
|
);
|
|
402
404
|
}
|
|
403
405
|
function useSpace() {
|
|
404
|
-
return
|
|
406
|
+
return React13__namespace.useContext(SpaceContext);
|
|
405
407
|
}
|
|
406
|
-
var ThemeContext =
|
|
408
|
+
var ThemeContext = React13__namespace.createContext(null);
|
|
407
409
|
function ThemeProvider(props) {
|
|
408
410
|
const { children, className, ...themeProps } = props;
|
|
409
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ React13__namespace.createElement(ThemeContext.Provider, { value: themeProps }, /* @__PURE__ */ React13__namespace.createElement(
|
|
410
412
|
"div",
|
|
411
413
|
{
|
|
412
|
-
"data-theme": themeProps.
|
|
414
|
+
"data-theme": themeProps.colorScheme,
|
|
413
415
|
"data-radius": themeProps.radius,
|
|
414
416
|
"data-color": themeProps.color,
|
|
415
417
|
className: cn("parrot-theme", className)
|
|
@@ -418,7 +420,7 @@ function ThemeProvider(props) {
|
|
|
418
420
|
));
|
|
419
421
|
}
|
|
420
422
|
function useTheme(options) {
|
|
421
|
-
const theme =
|
|
423
|
+
const theme = React13__namespace.useContext(ThemeContext);
|
|
422
424
|
if (!theme && options?.requireThemeProvider)
|
|
423
425
|
throw new Error("No theme found");
|
|
424
426
|
return theme;
|
|
@@ -431,14 +433,14 @@ function Field({
|
|
|
431
433
|
error,
|
|
432
434
|
color = "gray",
|
|
433
435
|
radius,
|
|
434
|
-
size
|
|
436
|
+
size,
|
|
435
437
|
className,
|
|
436
438
|
classNames,
|
|
437
439
|
style,
|
|
438
440
|
styles,
|
|
439
441
|
prepend,
|
|
440
442
|
append,
|
|
441
|
-
appearance
|
|
443
|
+
appearance,
|
|
442
444
|
validationStatus,
|
|
443
445
|
children,
|
|
444
446
|
replaceDefaultControlWrapper,
|
|
@@ -448,16 +450,18 @@ function Field({
|
|
|
448
450
|
}) {
|
|
449
451
|
const space = useSpace();
|
|
450
452
|
const theme = useTheme();
|
|
451
|
-
const
|
|
453
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
454
|
+
const resolvedAppearance = appearance ?? theme?.inputAppearance ?? "outline";
|
|
455
|
+
const controlRef = React13__namespace.default.useRef(null);
|
|
452
456
|
const [, groupRef] = reactAriaComponents.useContextProps({}, controlRef, reactAriaComponents.GroupContext);
|
|
453
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
454
458
|
"div",
|
|
455
459
|
{
|
|
456
460
|
ref: wrapperRef,
|
|
457
461
|
...filterDOMProps(props),
|
|
458
462
|
"data-color": color,
|
|
459
463
|
"data-radius": radius ?? theme?.radius ?? "lg",
|
|
460
|
-
"data-size":
|
|
464
|
+
"data-size": resolvedSize,
|
|
461
465
|
className: cn(
|
|
462
466
|
"prt-input-group flex flex-col gap-1",
|
|
463
467
|
space.compactItemWrapperAdjust,
|
|
@@ -466,7 +470,7 @@ function Field({
|
|
|
466
470
|
),
|
|
467
471
|
style: { ...style, ...styles?.wrapper }
|
|
468
472
|
},
|
|
469
|
-
label && /* @__PURE__ */
|
|
473
|
+
label && /* @__PURE__ */ React13__namespace.default.createElement(
|
|
470
474
|
InputLabel,
|
|
471
475
|
{
|
|
472
476
|
style: styles?.label,
|
|
@@ -475,7 +479,7 @@ function Field({
|
|
|
475
479
|
},
|
|
476
480
|
label
|
|
477
481
|
),
|
|
478
|
-
!replaceDefaultControlWrapper && /* @__PURE__ */
|
|
482
|
+
!replaceDefaultControlWrapper && /* @__PURE__ */ React13__namespace.default.createElement(
|
|
479
483
|
"div",
|
|
480
484
|
{
|
|
481
485
|
ref: groupRef,
|
|
@@ -484,16 +488,16 @@ function Field({
|
|
|
484
488
|
space.classNames
|
|
485
489
|
),
|
|
486
490
|
"data-has-error": !!error,
|
|
487
|
-
"data-appearance":
|
|
491
|
+
"data-appearance": resolvedAppearance,
|
|
488
492
|
"data-disabled": isDisabled
|
|
489
493
|
},
|
|
490
|
-
prepend && /* @__PURE__ */
|
|
494
|
+
prepend && /* @__PURE__ */ React13__namespace.default.createElement("div", { className: "add-on add-on-left flex items-center" }, prepend),
|
|
491
495
|
children,
|
|
492
|
-
append && /* @__PURE__ */
|
|
496
|
+
append && /* @__PURE__ */ React13__namespace.default.createElement("div", { className: "add-on add-on-right flex items-center" }, append)
|
|
493
497
|
),
|
|
494
498
|
replaceDefaultControlWrapper && children,
|
|
495
|
-
error && /* @__PURE__ */
|
|
496
|
-
description && /* @__PURE__ */
|
|
499
|
+
error && /* @__PURE__ */ React13__namespace.default.createElement(InputError, { validationStatus }, error),
|
|
500
|
+
description && /* @__PURE__ */ React13__namespace.default.createElement(
|
|
497
501
|
FieldDescription,
|
|
498
502
|
{
|
|
499
503
|
style: styles?.description,
|
|
@@ -514,7 +518,7 @@ function FieldDescription({
|
|
|
514
518
|
null,
|
|
515
519
|
reactAriaComponents.TextContext
|
|
516
520
|
);
|
|
517
|
-
return /* @__PURE__ */
|
|
521
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
518
522
|
"div",
|
|
519
523
|
{
|
|
520
524
|
...merged,
|
|
@@ -549,7 +553,7 @@ function Input({
|
|
|
549
553
|
placeholder,
|
|
550
554
|
...textFieldProps
|
|
551
555
|
}) {
|
|
552
|
-
return /* @__PURE__ */
|
|
556
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.TextField, { ...textFieldProps, onChange, isInvalid: !!error }, /* @__PURE__ */ React13__namespace.createElement(
|
|
553
557
|
Field,
|
|
554
558
|
{
|
|
555
559
|
className,
|
|
@@ -568,7 +572,7 @@ function Input({
|
|
|
568
572
|
appearance,
|
|
569
573
|
validationStatus
|
|
570
574
|
},
|
|
571
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
572
576
|
reactAriaComponents.Input,
|
|
573
577
|
{
|
|
574
578
|
ref: inputRef,
|
|
@@ -587,15 +591,16 @@ function Loader({
|
|
|
587
591
|
classNames,
|
|
588
592
|
style,
|
|
589
593
|
styles,
|
|
590
|
-
size
|
|
594
|
+
size,
|
|
591
595
|
label = "Loading",
|
|
592
596
|
ref,
|
|
593
597
|
...props
|
|
594
598
|
}) {
|
|
595
599
|
const theme = useTheme();
|
|
596
600
|
const resolvedColor = color ?? theme?.color;
|
|
597
|
-
const
|
|
598
|
-
|
|
601
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
602
|
+
const id2 = React13__namespace.useId();
|
|
603
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
599
604
|
"div",
|
|
600
605
|
{
|
|
601
606
|
"data-color": resolvedColor,
|
|
@@ -606,16 +611,16 @@ function Loader({
|
|
|
606
611
|
ref,
|
|
607
612
|
...props
|
|
608
613
|
},
|
|
609
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
610
615
|
"svg",
|
|
611
616
|
{
|
|
612
617
|
className: cn("prt-loader-icon", classNames?.icon),
|
|
613
618
|
style: styles?.icon,
|
|
614
|
-
"data-size":
|
|
619
|
+
"data-size": resolvedSize,
|
|
615
620
|
viewBox: "0 0 24 24",
|
|
616
621
|
"aria-hidden": "true"
|
|
617
622
|
},
|
|
618
|
-
/* @__PURE__ */
|
|
623
|
+
/* @__PURE__ */ React13__namespace.createElement("defs", null, /* @__PURE__ */ React13__namespace.createElement(
|
|
619
624
|
"linearGradient",
|
|
620
625
|
{
|
|
621
626
|
id: `${id2}-a`,
|
|
@@ -624,9 +629,9 @@ function Loader({
|
|
|
624
629
|
y1: "5.271%",
|
|
625
630
|
y2: "91.793%"
|
|
626
631
|
},
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
629
|
-
), /* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ React13__namespace.createElement("stop", { offset: "0%", stopColor: "currentColor" }),
|
|
633
|
+
/* @__PURE__ */ React13__namespace.createElement("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0.55" })
|
|
634
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
630
635
|
"linearGradient",
|
|
631
636
|
{
|
|
632
637
|
id: `${id2}-b`,
|
|
@@ -635,17 +640,17 @@ function Loader({
|
|
|
635
640
|
y1: "15.24%",
|
|
636
641
|
y2: "87.15%"
|
|
637
642
|
},
|
|
638
|
-
/* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
643
|
+
/* @__PURE__ */ React13__namespace.createElement("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "0" }),
|
|
644
|
+
/* @__PURE__ */ React13__namespace.createElement("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0.55" })
|
|
640
645
|
)),
|
|
641
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ React13__namespace.createElement("g", { fill: "none" }, /* @__PURE__ */ React13__namespace.createElement(
|
|
642
647
|
"path",
|
|
643
648
|
{
|
|
644
649
|
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
650
|
fill: `url(#${id2}-a)`,
|
|
646
651
|
transform: "translate(1.5 1.625)"
|
|
647
652
|
}
|
|
648
|
-
), /* @__PURE__ */
|
|
653
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
649
654
|
"path",
|
|
650
655
|
{
|
|
651
656
|
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",
|
|
@@ -671,7 +676,7 @@ function omitNullOrUndefined(object) {
|
|
|
671
676
|
}
|
|
672
677
|
|
|
673
678
|
// src/components/button/button-group.tsx
|
|
674
|
-
var ButtonGroupContext =
|
|
679
|
+
var ButtonGroupContext = React13__namespace.createContext({});
|
|
675
680
|
function ButtonGroup({
|
|
676
681
|
color,
|
|
677
682
|
variant,
|
|
@@ -691,7 +696,7 @@ function ButtonGroup({
|
|
|
691
696
|
size,
|
|
692
697
|
radius
|
|
693
698
|
});
|
|
694
|
-
return /* @__PURE__ */
|
|
699
|
+
return /* @__PURE__ */ React13__namespace.createElement(ButtonGroupContext.Provider, { value: cleanProps }, /* @__PURE__ */ React13__namespace.createElement(
|
|
695
700
|
Space,
|
|
696
701
|
{
|
|
697
702
|
className,
|
|
@@ -705,7 +710,7 @@ function ButtonGroup({
|
|
|
705
710
|
));
|
|
706
711
|
}
|
|
707
712
|
function useButtonGroup() {
|
|
708
|
-
return
|
|
713
|
+
return React13__namespace.useContext(ButtonGroupContext);
|
|
709
714
|
}
|
|
710
715
|
|
|
711
716
|
// src/components/button/button.tsx
|
|
@@ -718,23 +723,24 @@ function Button(props) {
|
|
|
718
723
|
variant = "solid",
|
|
719
724
|
append,
|
|
720
725
|
prepend,
|
|
721
|
-
size
|
|
726
|
+
size,
|
|
722
727
|
children,
|
|
723
728
|
className,
|
|
724
729
|
isLoading,
|
|
725
|
-
radius
|
|
730
|
+
radius,
|
|
726
731
|
isIconButton,
|
|
727
732
|
style,
|
|
728
733
|
classNames,
|
|
729
734
|
styles,
|
|
730
735
|
...otherProps
|
|
731
736
|
} = { ...buttonGroupProps, ...props };
|
|
732
|
-
|
|
737
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
738
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
733
739
|
reactAriaComponents.Button,
|
|
734
740
|
{
|
|
735
741
|
style: { ...style, ...styles?.wrapper },
|
|
736
|
-
"data-size":
|
|
737
|
-
"data-radius": radius,
|
|
742
|
+
"data-size": resolvedSize,
|
|
743
|
+
"data-radius": radius ?? theme?.radius ?? "full",
|
|
738
744
|
"data-icon-button": isIconButton,
|
|
739
745
|
"data-loading": isLoading,
|
|
740
746
|
"aria-busy": isLoading,
|
|
@@ -750,7 +756,7 @@ function Button(props) {
|
|
|
750
756
|
},
|
|
751
757
|
prepend,
|
|
752
758
|
isIconButton && isLoading ? null : children,
|
|
753
|
-
isLoading ? /* @__PURE__ */
|
|
759
|
+
isLoading ? /* @__PURE__ */ React13__namespace.createElement(
|
|
754
760
|
Loader,
|
|
755
761
|
{
|
|
756
762
|
color,
|
|
@@ -762,9 +768,9 @@ function Button(props) {
|
|
|
762
768
|
);
|
|
763
769
|
}
|
|
764
770
|
function IconButton({ children, ...props }) {
|
|
765
|
-
return /* @__PURE__ */
|
|
771
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(Button, { isIconButton: true, ...props }, children);
|
|
766
772
|
}
|
|
767
|
-
var ToggleButtonGroupContext =
|
|
773
|
+
var ToggleButtonGroupContext = React13__namespace.createContext({});
|
|
768
774
|
function ToggleButton({
|
|
769
775
|
idleColor,
|
|
770
776
|
idleVariant,
|
|
@@ -784,15 +790,15 @@ function ToggleButton({
|
|
|
784
790
|
}) {
|
|
785
791
|
const space = useSpace();
|
|
786
792
|
const theme = useTheme();
|
|
787
|
-
const group =
|
|
793
|
+
const group = React13__namespace.useContext(ToggleButtonGroupContext);
|
|
788
794
|
const _idleColor = idleColor ?? group.idleColor ?? "gray";
|
|
789
795
|
const _idleVariant = idleVariant ?? group.idleVariant ?? "outline";
|
|
790
796
|
const _activeColor = activeColor ?? group.activeColor ?? theme?.color ?? "primary";
|
|
791
797
|
const _activeVariant = activeVariant ?? group.activeVariant ?? "solid";
|
|
792
|
-
const _size = size ?? group.size ?? "md";
|
|
798
|
+
const _size = size ?? group.size ?? theme?.size ?? "md";
|
|
793
799
|
const _radius = radius ?? group.radius ?? "full";
|
|
794
800
|
const _isIconButton = isIconButton ?? group.isIconButton;
|
|
795
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
796
802
|
reactAriaComponents.ToggleButton,
|
|
797
803
|
{
|
|
798
804
|
...props,
|
|
@@ -803,7 +809,7 @@ function ToggleButton({
|
|
|
803
809
|
classNames?.wrapper
|
|
804
810
|
),
|
|
805
811
|
style: { ...style, ...styles?.wrapper },
|
|
806
|
-
render: (domProps, { isSelected }) => /* @__PURE__ */
|
|
812
|
+
render: (domProps, { isSelected }) => /* @__PURE__ */ React13__namespace.createElement(
|
|
807
813
|
"button",
|
|
808
814
|
{
|
|
809
815
|
...domProps,
|
|
@@ -825,7 +831,7 @@ function ToggleButton({
|
|
|
825
831
|
// src/components/input/number-input.tsx
|
|
826
832
|
function NumberInput({
|
|
827
833
|
appearance = "outline",
|
|
828
|
-
size
|
|
834
|
+
size,
|
|
829
835
|
color = "gray",
|
|
830
836
|
classNames,
|
|
831
837
|
styles,
|
|
@@ -846,19 +852,21 @@ function NumberInput({
|
|
|
846
852
|
...props
|
|
847
853
|
}) {
|
|
848
854
|
const space = useSpace();
|
|
849
|
-
|
|
855
|
+
const theme = useTheme();
|
|
856
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
857
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
850
858
|
reactAriaComponents.NumberField,
|
|
851
859
|
{
|
|
852
860
|
...props,
|
|
853
861
|
isInvalid: !!error,
|
|
854
862
|
"aria-label": props["aria-label"] ?? "number input"
|
|
855
863
|
},
|
|
856
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
857
865
|
Field,
|
|
858
866
|
{
|
|
859
867
|
classNames,
|
|
860
868
|
color,
|
|
861
|
-
size,
|
|
869
|
+
size: resolvedSize,
|
|
862
870
|
radius,
|
|
863
871
|
error,
|
|
864
872
|
label,
|
|
@@ -866,19 +874,19 @@ function NumberInput({
|
|
|
866
874
|
validationStatus,
|
|
867
875
|
replaceDefaultControlWrapper: true
|
|
868
876
|
},
|
|
869
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Group, { className: "prt-input-container", style: { display: "flex", gap: 4 } }, showSteppers && /* @__PURE__ */ React13__namespace.createElement(
|
|
870
878
|
IconButton,
|
|
871
879
|
{
|
|
872
880
|
slot: "decrement",
|
|
873
881
|
radius: "md",
|
|
874
882
|
color,
|
|
875
883
|
variant: "outline",
|
|
876
|
-
size,
|
|
884
|
+
size: resolvedSize,
|
|
877
885
|
className: classNames?.decrement,
|
|
878
886
|
style: styles?.decrement
|
|
879
887
|
},
|
|
880
888
|
decrementIcon
|
|
881
|
-
), /* @__PURE__ */
|
|
889
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
882
890
|
reactAriaComponents.Input,
|
|
883
891
|
{
|
|
884
892
|
style: styles?.input,
|
|
@@ -894,14 +902,14 @@ function NumberInput({
|
|
|
894
902
|
"data-has-left-addon": !!prepend,
|
|
895
903
|
"data-has-right-addon": !!append
|
|
896
904
|
}
|
|
897
|
-
), showSteppers && /* @__PURE__ */
|
|
905
|
+
), showSteppers && /* @__PURE__ */ React13__namespace.createElement(
|
|
898
906
|
IconButton,
|
|
899
907
|
{
|
|
900
908
|
slot: "increment",
|
|
901
909
|
radius: "md",
|
|
902
910
|
color,
|
|
903
911
|
variant: "outline",
|
|
904
|
-
size,
|
|
912
|
+
size: resolvedSize,
|
|
905
913
|
className: classNames?.increment,
|
|
906
914
|
style: styles?.increment
|
|
907
915
|
},
|
|
@@ -911,46 +919,219 @@ function NumberInput({
|
|
|
911
919
|
);
|
|
912
920
|
}
|
|
913
921
|
function HiCheck({ size = "1em", ...props }) {
|
|
914
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
923
|
}
|
|
916
924
|
function HiChevronDown({ size = "1em", ...props }) {
|
|
917
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
926
|
}
|
|
919
927
|
function HiChevronLeft({ size = "1em", ...props }) {
|
|
920
|
-
return /* @__PURE__ */
|
|
928
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
929
|
}
|
|
922
930
|
function HiChevronRight({ size = "1em", ...props }) {
|
|
923
|
-
return /* @__PURE__ */
|
|
931
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
932
|
}
|
|
925
933
|
function HiChevronUp({ size = "1em", ...props }) {
|
|
926
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
935
|
}
|
|
928
936
|
function HiOutlineCalendar({ size = "1em", ...props }) {
|
|
929
|
-
return /* @__PURE__ */
|
|
937
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
938
|
}
|
|
931
939
|
function HiOutlineCheckCircle({ size = "1em", ...props }) {
|
|
932
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
941
|
}
|
|
934
942
|
function HiOutlineDocumentAdd({ size = "1em", ...props }) {
|
|
935
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
944
|
}
|
|
937
945
|
function HiOutlineExclamationCircle({ size = "1em", ...props }) {
|
|
938
|
-
return /* @__PURE__ */
|
|
946
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }));
|
|
947
|
+
}
|
|
948
|
+
function HiOutlineInformationCircle({ size = "1em", ...props }) {
|
|
949
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__namespace.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }));
|
|
939
950
|
}
|
|
940
951
|
function HiOutlinePaperClip({ size = "1em", ...props }) {
|
|
941
|
-
return /* @__PURE__ */
|
|
952
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
953
|
}
|
|
943
954
|
function HiOutlineRefresh({ size = "1em", ...props }) {
|
|
944
|
-
return /* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
956
|
}
|
|
946
957
|
function HiOutlineTrash({ size = "1em", ...props }) {
|
|
947
|
-
return /* @__PURE__ */
|
|
958
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
959
|
}
|
|
949
960
|
function HiSelector({ size = "1em", ...props }) {
|
|
950
|
-
return /* @__PURE__ */
|
|
961
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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
962
|
}
|
|
952
963
|
function HiX({ size = "1em", ...props }) {
|
|
953
|
-
return /* @__PURE__ */
|
|
964
|
+
return /* @__PURE__ */ React13__namespace.createElement("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", width: size, height: size, ...props }, /* @__PURE__ */ React13__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" }));
|
|
965
|
+
}
|
|
966
|
+
var PATTERNS = {
|
|
967
|
+
numeric: inputOtp.REGEXP_ONLY_DIGITS,
|
|
968
|
+
alphanumeric: inputOtp.REGEXP_ONLY_DIGITS_AND_CHARS,
|
|
969
|
+
all: void 0
|
|
970
|
+
};
|
|
971
|
+
var INPUT_MODE = {
|
|
972
|
+
numeric: "numeric",
|
|
973
|
+
alphanumeric: "text",
|
|
974
|
+
all: "text"
|
|
975
|
+
};
|
|
976
|
+
var PinInputConfigContext = React13__namespace.createContext(null);
|
|
977
|
+
function usePinInputConfig() {
|
|
978
|
+
const ctx = React13__namespace.useContext(PinInputConfigContext);
|
|
979
|
+
if (!ctx) {
|
|
980
|
+
throw new Error(
|
|
981
|
+
"PinInput compound components must be rendered inside <PinInput>"
|
|
982
|
+
);
|
|
983
|
+
}
|
|
984
|
+
return ctx;
|
|
985
|
+
}
|
|
986
|
+
function PinInput({
|
|
987
|
+
value,
|
|
988
|
+
defaultValue,
|
|
989
|
+
onChange,
|
|
990
|
+
onComplete,
|
|
991
|
+
length,
|
|
992
|
+
maxLength: maxLength2,
|
|
993
|
+
type = "numeric",
|
|
994
|
+
pattern: pattern2,
|
|
995
|
+
mask = false,
|
|
996
|
+
placeholder,
|
|
997
|
+
isReadOnly = false,
|
|
998
|
+
autoFocus,
|
|
999
|
+
name,
|
|
1000
|
+
groupSize,
|
|
1001
|
+
separator,
|
|
1002
|
+
children,
|
|
1003
|
+
inputRef: inputRefProp,
|
|
1004
|
+
classNames,
|
|
1005
|
+
styles,
|
|
1006
|
+
...fieldProps
|
|
1007
|
+
}) {
|
|
1008
|
+
const resolvedMax = maxLength2 ?? length ?? 6;
|
|
1009
|
+
const isDisabled = fieldProps.isDisabled ?? false;
|
|
1010
|
+
const isInvalid = !!fieldProps.error;
|
|
1011
|
+
const isControlled = value !== void 0;
|
|
1012
|
+
const [internalValue, setInternalValue] = React13__namespace.useState(defaultValue ?? "");
|
|
1013
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1014
|
+
function handleChange(next) {
|
|
1015
|
+
if (!isControlled) setInternalValue(next);
|
|
1016
|
+
onChange?.(next);
|
|
1017
|
+
}
|
|
1018
|
+
const config = React13__namespace.useMemo(
|
|
1019
|
+
() => ({ mask, placeholder, isDisabled, isInvalid }),
|
|
1020
|
+
[mask, placeholder, isDisabled, isInvalid]
|
|
1021
|
+
);
|
|
1022
|
+
const fieldError = React13__namespace.useMemo(
|
|
1023
|
+
() => ({
|
|
1024
|
+
isInvalid,
|
|
1025
|
+
validationErrors: [],
|
|
1026
|
+
validationDetails: {}
|
|
1027
|
+
}),
|
|
1028
|
+
[isInvalid]
|
|
1029
|
+
);
|
|
1030
|
+
const content = children ?? renderSlots(resolvedMax, groupSize, separator, classNames?.slot);
|
|
1031
|
+
return /* @__PURE__ */ React13__namespace.createElement(PinInputConfigContext.Provider, { value: config }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.FieldErrorContext.Provider, { value: fieldError }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1032
|
+
Field,
|
|
1033
|
+
{
|
|
1034
|
+
...fieldProps,
|
|
1035
|
+
classNames,
|
|
1036
|
+
styles,
|
|
1037
|
+
replaceDefaultControlWrapper: true
|
|
1038
|
+
},
|
|
1039
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1040
|
+
"div",
|
|
1041
|
+
{
|
|
1042
|
+
className: cn("prt-pin", classNames?.control),
|
|
1043
|
+
style: styles?.control,
|
|
1044
|
+
"data-disabled": isDisabled || void 0,
|
|
1045
|
+
"data-invalid": isInvalid || void 0
|
|
1046
|
+
},
|
|
1047
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1048
|
+
inputOtp.OTPInput,
|
|
1049
|
+
{
|
|
1050
|
+
ref: inputRefProp,
|
|
1051
|
+
value: currentValue,
|
|
1052
|
+
onChange: handleChange,
|
|
1053
|
+
onComplete,
|
|
1054
|
+
maxLength: resolvedMax,
|
|
1055
|
+
pattern: pattern2?.source ?? PATTERNS[type],
|
|
1056
|
+
inputMode: INPUT_MODE[type],
|
|
1057
|
+
textAlign: "center",
|
|
1058
|
+
autoComplete: "one-time-code",
|
|
1059
|
+
autoCorrect: "off",
|
|
1060
|
+
autoCapitalize: "off",
|
|
1061
|
+
spellCheck: false,
|
|
1062
|
+
autoFocus,
|
|
1063
|
+
disabled: isDisabled,
|
|
1064
|
+
readOnly: isReadOnly,
|
|
1065
|
+
name,
|
|
1066
|
+
"aria-invalid": isInvalid || void 0,
|
|
1067
|
+
containerClassName: "prt-pin-otp",
|
|
1068
|
+
className: cn("prt-pin-input", classNames?.input),
|
|
1069
|
+
style: styles?.input
|
|
1070
|
+
},
|
|
1071
|
+
content
|
|
1072
|
+
)
|
|
1073
|
+
)
|
|
1074
|
+
)));
|
|
1075
|
+
}
|
|
1076
|
+
function renderSlots(maxLength2, groupSize, separator, slotClassName) {
|
|
1077
|
+
const size = groupSize && groupSize > 0 ? groupSize : maxLength2;
|
|
1078
|
+
const groups = [];
|
|
1079
|
+
for (let i = 0; i < maxLength2; i += size) {
|
|
1080
|
+
groups.push(
|
|
1081
|
+
Array.from({ length: Math.min(size, maxLength2 - i) }, (_, j) => i + j)
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
return groups.map((indices, groupIndex) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, { key: groupIndex }, groupIndex > 0 && /* @__PURE__ */ React13__namespace.createElement(PinInputSeparator, null, separator), /* @__PURE__ */ React13__namespace.createElement(PinInputGroup, null, indices.map((index) => /* @__PURE__ */ React13__namespace.createElement(PinInputSlot, { key: index, index, className: slotClassName })))));
|
|
1085
|
+
}
|
|
1086
|
+
function PinInputGroup({ className, ...props }) {
|
|
1087
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1088
|
+
"div",
|
|
1089
|
+
{
|
|
1090
|
+
className: cn("prt-pin-group", className),
|
|
1091
|
+
"data-slot": "group",
|
|
1092
|
+
...props
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
function PinInputSlot({
|
|
1097
|
+
index,
|
|
1098
|
+
className,
|
|
1099
|
+
...props
|
|
1100
|
+
}) {
|
|
1101
|
+
const { mask, placeholder, isDisabled, isInvalid } = usePinInputConfig();
|
|
1102
|
+
const { slots } = React13__namespace.useContext(inputOtp.OTPInputContext);
|
|
1103
|
+
const slot = slots[index];
|
|
1104
|
+
const char = slot?.char ?? null;
|
|
1105
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1106
|
+
"div",
|
|
1107
|
+
{
|
|
1108
|
+
...props,
|
|
1109
|
+
className: cn("prt-pin-slot", className),
|
|
1110
|
+
"data-slot": "slot",
|
|
1111
|
+
"data-active": slot?.isActive || void 0,
|
|
1112
|
+
"data-filled": !!char || void 0,
|
|
1113
|
+
"data-disabled": isDisabled || void 0,
|
|
1114
|
+
"data-invalid": isInvalid || void 0
|
|
1115
|
+
},
|
|
1116
|
+
char !== null ? /* @__PURE__ */ React13__namespace.createElement("span", { className: "prt-pin-char" }, mask ? "\u2022" : char) : placeholder ? /* @__PURE__ */ React13__namespace.createElement("span", { className: "prt-pin-placeholder" }, placeholder) : null,
|
|
1117
|
+
slot?.hasFakeCaret && /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-pin-caret", "aria-hidden": true })
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
function PinInputSeparator({
|
|
1121
|
+
className,
|
|
1122
|
+
children,
|
|
1123
|
+
...props
|
|
1124
|
+
}) {
|
|
1125
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1126
|
+
"div",
|
|
1127
|
+
{
|
|
1128
|
+
className: cn("prt-pin-separator", className),
|
|
1129
|
+
"data-slot": "separator",
|
|
1130
|
+
"aria-hidden": true,
|
|
1131
|
+
...props
|
|
1132
|
+
},
|
|
1133
|
+
children ?? "-"
|
|
1134
|
+
);
|
|
954
1135
|
}
|
|
955
1136
|
|
|
956
1137
|
// src/utils/theme.ts
|
|
@@ -1026,7 +1207,7 @@ function breakpointClassNames(prefix, value) {
|
|
|
1026
1207
|
// src/components/text/text.tsx
|
|
1027
1208
|
function Text({
|
|
1028
1209
|
textCase,
|
|
1029
|
-
size
|
|
1210
|
+
size,
|
|
1030
1211
|
weight,
|
|
1031
1212
|
color = "gray",
|
|
1032
1213
|
variant = "default",
|
|
@@ -1039,7 +1220,9 @@ function Text({
|
|
|
1039
1220
|
className,
|
|
1040
1221
|
...rest
|
|
1041
1222
|
}) {
|
|
1042
|
-
|
|
1223
|
+
const theme = useTheme();
|
|
1224
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
1225
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1043
1226
|
Comp,
|
|
1044
1227
|
{
|
|
1045
1228
|
className: cn(
|
|
@@ -1052,7 +1235,7 @@ function Text({
|
|
|
1052
1235
|
[`text-line-height-${lineHeight}`]: !!lineHeight,
|
|
1053
1236
|
[`text-transform-${textCase}`]: !!textCase
|
|
1054
1237
|
},
|
|
1055
|
-
breakpointClassNames("text-size",
|
|
1238
|
+
breakpointClassNames("text-size", resolvedSize)
|
|
1056
1239
|
),
|
|
1057
1240
|
"data-underline": underline,
|
|
1058
1241
|
"data-italic": italic,
|
|
@@ -1087,7 +1270,7 @@ function Textarea({
|
|
|
1087
1270
|
...textFieldProps
|
|
1088
1271
|
}) {
|
|
1089
1272
|
const theme = useTheme();
|
|
1090
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.TextField, { ...textFieldProps, isDisabled, isInvalid: !!error }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1091
1274
|
Field,
|
|
1092
1275
|
{
|
|
1093
1276
|
label,
|
|
@@ -1102,7 +1285,7 @@ function Textarea({
|
|
|
1102
1285
|
classNames,
|
|
1103
1286
|
replaceDefaultControlWrapper: true
|
|
1104
1287
|
},
|
|
1105
|
-
/* @__PURE__ */
|
|
1288
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1106
1289
|
reactAriaComponents.TextArea,
|
|
1107
1290
|
{
|
|
1108
1291
|
placeholder,
|
|
@@ -1117,7 +1300,7 @@ function Textarea({
|
|
|
1117
1300
|
)
|
|
1118
1301
|
));
|
|
1119
1302
|
}
|
|
1120
|
-
var CheckboxGroupVariantContext =
|
|
1303
|
+
var CheckboxGroupVariantContext = React13__namespace.createContext(null);
|
|
1121
1304
|
function CheckboxGroup({
|
|
1122
1305
|
children,
|
|
1123
1306
|
label,
|
|
@@ -1130,17 +1313,17 @@ function CheckboxGroup({
|
|
|
1130
1313
|
shape,
|
|
1131
1314
|
...props
|
|
1132
1315
|
}) {
|
|
1133
|
-
const variants =
|
|
1316
|
+
const variants = React13__namespace.useMemo(
|
|
1134
1317
|
() => ({ size, appearance, color, radius, shape }),
|
|
1135
1318
|
[size, appearance, color, radius, shape]
|
|
1136
1319
|
);
|
|
1137
|
-
return /* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1138
1321
|
reactAriaComponents.CheckboxGroup,
|
|
1139
1322
|
{
|
|
1140
1323
|
...props,
|
|
1141
1324
|
"aria-label": typeof label === "string" ? label : void 0
|
|
1142
1325
|
},
|
|
1143
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-2" }, label && /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm font-medium text-gray-700" }, label), /* @__PURE__ */ React13__namespace.createElement(CheckboxGroupVariantContext.Provider, { value: variants }, children), description && /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-xs leading-normal text-gray-400" }, description), errorMessage && /* @__PURE__ */ React13__namespace.createElement(InputError, null, errorMessage))
|
|
1144
1327
|
);
|
|
1145
1328
|
}
|
|
1146
1329
|
|
|
@@ -1163,18 +1346,19 @@ function Checkbox({
|
|
|
1163
1346
|
children,
|
|
1164
1347
|
...props
|
|
1165
1348
|
}) {
|
|
1166
|
-
const
|
|
1349
|
+
const theme = useTheme();
|
|
1350
|
+
const group = React13__namespace.useContext(CheckboxGroupVariantContext);
|
|
1167
1351
|
const resolvedColor = color ?? group?.color ?? "primary";
|
|
1168
|
-
const resolvedAppearance = appearance ?? group?.appearance ?? "outline";
|
|
1169
|
-
const resolvedSize = size ?? group?.size ?? "md";
|
|
1352
|
+
const resolvedAppearance = appearance ?? group?.appearance ?? theme?.inputAppearance ?? "outline";
|
|
1353
|
+
const resolvedSize = size ?? group?.size ?? theme?.size ?? "md";
|
|
1170
1354
|
const resolvedRadius = radius ?? group?.radius ?? getRadius(shape ?? group?.shape) ?? "md";
|
|
1171
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CheckboxField, { ...props }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1172
1356
|
reactAriaComponents.CheckboxButton,
|
|
1173
1357
|
{
|
|
1174
1358
|
style: { ...style, ...styles?.wrapper },
|
|
1175
1359
|
className: cn(className, "prt-checkbox", classNames?.wrapper)
|
|
1176
1360
|
},
|
|
1177
|
-
({ isSelected, isIndeterminate, isFocusVisible }) => /* @__PURE__ */
|
|
1361
|
+
({ isSelected, isIndeterminate, isFocusVisible }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
|
|
1178
1362
|
"div",
|
|
1179
1363
|
{
|
|
1180
1364
|
style: styles?.checkbox,
|
|
@@ -1189,7 +1373,7 @@ function Checkbox({
|
|
|
1189
1373
|
"data-appearance": isSelected || isIndeterminate ? void 0 : resolvedAppearance,
|
|
1190
1374
|
"aria-hidden": "true"
|
|
1191
1375
|
},
|
|
1192
|
-
isSelected && !isIndeterminate && /* @__PURE__ */
|
|
1376
|
+
isSelected && !isIndeterminate && /* @__PURE__ */ React13__namespace.createElement(
|
|
1193
1377
|
"svg",
|
|
1194
1378
|
{
|
|
1195
1379
|
className: cn("prt-checkbox-icon", classNames?.icon),
|
|
@@ -1201,9 +1385,9 @@ function Checkbox({
|
|
|
1201
1385
|
strokeLinecap: "round",
|
|
1202
1386
|
strokeLinejoin: "round"
|
|
1203
1387
|
},
|
|
1204
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ React13__namespace.createElement("path", { d: "M9 12l2 2l4 -4" })
|
|
1205
1389
|
),
|
|
1206
|
-
isIndeterminate && /* @__PURE__ */
|
|
1390
|
+
isIndeterminate && /* @__PURE__ */ React13__namespace.createElement(
|
|
1207
1391
|
"div",
|
|
1208
1392
|
{
|
|
1209
1393
|
className: cn(["prt-checkbox-icon", classNames?.icon]),
|
|
@@ -1226,7 +1410,7 @@ function CheckboxItem({
|
|
|
1226
1410
|
children,
|
|
1227
1411
|
...props
|
|
1228
1412
|
}) {
|
|
1229
|
-
return /* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CheckboxField, { ...props }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1230
1414
|
reactAriaComponents.CheckboxButton,
|
|
1231
1415
|
{
|
|
1232
1416
|
style: { ...style, ...styles?.wrapper },
|
|
@@ -1236,13 +1420,13 @@ function CheckboxItem({
|
|
|
1236
1420
|
));
|
|
1237
1421
|
}
|
|
1238
1422
|
function Menu({ children, ...props }) {
|
|
1239
|
-
return /* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.MenuTrigger, { ...props }, children);
|
|
1240
1424
|
}
|
|
1241
1425
|
function MenuTrigger({ asChild, children }) {
|
|
1242
1426
|
if (asChild) {
|
|
1243
|
-
return /* @__PURE__ */
|
|
1427
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Pressable, null, children);
|
|
1244
1428
|
}
|
|
1245
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ React13__namespace.createElement(Button, null, children);
|
|
1246
1430
|
}
|
|
1247
1431
|
function px(value) {
|
|
1248
1432
|
if (value == null) return void 0;
|
|
@@ -1269,7 +1453,7 @@ function MenuContent({
|
|
|
1269
1453
|
const dataRadius = theme?.radius ?? "lg";
|
|
1270
1454
|
const header = typeof menuHeader === "function" ? menuHeader() : menuHeader;
|
|
1271
1455
|
const footer = typeof menuFooter === "function" ? menuFooter() : menuFooter;
|
|
1272
|
-
return /* @__PURE__ */
|
|
1456
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1273
1457
|
reactAriaComponents.Popover,
|
|
1274
1458
|
{
|
|
1275
1459
|
placement,
|
|
@@ -1279,7 +1463,7 @@ function MenuContent({
|
|
|
1279
1463
|
className: cn("prt-popover", classNames?.popover),
|
|
1280
1464
|
style: { ...styles?.popover }
|
|
1281
1465
|
},
|
|
1282
|
-
/* @__PURE__ */
|
|
1466
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1283
1467
|
"div",
|
|
1284
1468
|
{
|
|
1285
1469
|
"data-color": dataColor,
|
|
@@ -1294,7 +1478,7 @@ function MenuContent({
|
|
|
1294
1478
|
}
|
|
1295
1479
|
},
|
|
1296
1480
|
header,
|
|
1297
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1298
1482
|
reactAriaComponents.Menu,
|
|
1299
1483
|
{
|
|
1300
1484
|
...props,
|
|
@@ -1320,7 +1504,7 @@ function MenuItem({
|
|
|
1320
1504
|
...props
|
|
1321
1505
|
}) {
|
|
1322
1506
|
const resolvedTextValue = textValue ?? (typeof label === "string" ? label : void 0) ?? (typeof children === "string" ? children : void 0);
|
|
1323
|
-
return /* @__PURE__ */
|
|
1507
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1324
1508
|
reactAriaComponents.MenuItem,
|
|
1325
1509
|
{
|
|
1326
1510
|
...props,
|
|
@@ -1330,18 +1514,18 @@ function MenuItem({
|
|
|
1330
1514
|
style,
|
|
1331
1515
|
className: cn(className, "prt-list-option prt-menu-item")
|
|
1332
1516
|
},
|
|
1333
|
-
({ isSelected }) => /* @__PURE__ */
|
|
1517
|
+
({ isSelected }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex items-center gap-3" }, icon && /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex gap-3 prt-list-option-icon-wrapper" }, React13__namespace.isValidElement(icon) && React13__namespace.cloneElement(icon, {
|
|
1334
1518
|
className: "prt-list-option-icon",
|
|
1335
1519
|
size: 18,
|
|
1336
1520
|
...icon.props
|
|
1337
|
-
})), /* @__PURE__ */
|
|
1521
|
+
})), /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ React13__namespace.createElement("div", { slot: "label", className: "text-sm text-black" }, label ?? children), description && /* @__PURE__ */ React13__namespace.createElement(
|
|
1338
1522
|
"div",
|
|
1339
1523
|
{
|
|
1340
1524
|
slot: "description",
|
|
1341
1525
|
className: "text-sm leading-normal text-gray-500"
|
|
1342
1526
|
},
|
|
1343
1527
|
description
|
|
1344
|
-
))), isSelected && /* @__PURE__ */
|
|
1528
|
+
))), isSelected && /* @__PURE__ */ React13__namespace.createElement(HiCheck, { className: "selected-marker" }))
|
|
1345
1529
|
);
|
|
1346
1530
|
}
|
|
1347
1531
|
function MenuSection({
|
|
@@ -1350,9 +1534,9 @@ function MenuSection({
|
|
|
1350
1534
|
className,
|
|
1351
1535
|
...props
|
|
1352
1536
|
}) {
|
|
1353
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.MenuSection, { ...props, className: cn(className, "prt-list-section") }, title && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Header, { className: "prt-list-section-header" }, title), children);
|
|
1354
1538
|
}
|
|
1355
|
-
var ListBoxConfigContext =
|
|
1539
|
+
var ListBoxConfigContext = React13__namespace.createContext({
|
|
1356
1540
|
showSelectionIndicator: true
|
|
1357
1541
|
});
|
|
1358
1542
|
function ListBox({
|
|
@@ -1377,7 +1561,7 @@ function ListBox({
|
|
|
1377
1561
|
...props
|
|
1378
1562
|
}) {
|
|
1379
1563
|
const theme = useTheme();
|
|
1380
|
-
const config =
|
|
1564
|
+
const config = React13__namespace.useMemo(
|
|
1381
1565
|
() => ({
|
|
1382
1566
|
showSelectionIndicator,
|
|
1383
1567
|
renderSelectionIndicator
|
|
@@ -1389,15 +1573,15 @@ function ListBox({
|
|
|
1389
1573
|
const id2 = record[valueKey];
|
|
1390
1574
|
const label = record[labelKey];
|
|
1391
1575
|
if (sectionKey && record[sectionKey]) {
|
|
1392
|
-
return /* @__PURE__ */
|
|
1576
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1393
1577
|
ListBoxSection,
|
|
1394
1578
|
{
|
|
1395
1579
|
id: id2,
|
|
1396
1580
|
title: renderSectionLabel?.(item) ?? label
|
|
1397
1581
|
},
|
|
1398
|
-
/* @__PURE__ */
|
|
1582
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Collection, { items: record[sectionKey] }, (child) => {
|
|
1399
1583
|
const childRecord = child;
|
|
1400
|
-
return /* @__PURE__ */
|
|
1584
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1401
1585
|
ListBoxItem,
|
|
1402
1586
|
{
|
|
1403
1587
|
id: childRecord[valueKey],
|
|
@@ -1408,10 +1592,10 @@ function ListBox({
|
|
|
1408
1592
|
})
|
|
1409
1593
|
);
|
|
1410
1594
|
}
|
|
1411
|
-
return /* @__PURE__ */
|
|
1595
|
+
return /* @__PURE__ */ React13__namespace.createElement(ListBoxItem, { id: id2, textValue: label }, renderOption?.(item) ?? label);
|
|
1412
1596
|
}
|
|
1413
1597
|
const listBoxChildren = children ?? renderItem;
|
|
1414
|
-
return /* @__PURE__ */
|
|
1598
|
+
return /* @__PURE__ */ React13__namespace.createElement(ListBoxConfigContext.Provider, { value: config }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1415
1599
|
reactAriaComponents.ListBox,
|
|
1416
1600
|
{
|
|
1417
1601
|
...props,
|
|
@@ -1422,13 +1606,13 @@ function ListBox({
|
|
|
1422
1606
|
"data-color": color,
|
|
1423
1607
|
"data-section-separator": showSectionSeparator,
|
|
1424
1608
|
style: { width, ...style, ...styles?.wrapper },
|
|
1425
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
1609
|
+
renderEmptyState: () => /* @__PURE__ */ React13__namespace.createElement(
|
|
1426
1610
|
"div",
|
|
1427
1611
|
{
|
|
1428
1612
|
className: "flex items-center justify-center gap-3",
|
|
1429
1613
|
style: { height: 50 }
|
|
1430
1614
|
},
|
|
1431
|
-
renderEmpty?.() ?? /* @__PURE__ */
|
|
1615
|
+
renderEmpty?.() ?? /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-gray-400" }, "No options")
|
|
1432
1616
|
)
|
|
1433
1617
|
},
|
|
1434
1618
|
listBoxChildren
|
|
@@ -1443,10 +1627,10 @@ function ListBoxItem({
|
|
|
1443
1627
|
textValue,
|
|
1444
1628
|
...props
|
|
1445
1629
|
}) {
|
|
1446
|
-
const config =
|
|
1630
|
+
const config = React13__namespace.useContext(ListBoxConfigContext);
|
|
1447
1631
|
const showIndicator = showSelectionIndicator ?? config.showSelectionIndicator;
|
|
1448
1632
|
const resolvedTextValue = textValue ?? (typeof children === "string" ? children : void 0);
|
|
1449
|
-
return /* @__PURE__ */
|
|
1633
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1450
1634
|
reactAriaComponents.ListBoxItem,
|
|
1451
1635
|
{
|
|
1452
1636
|
...props,
|
|
@@ -1457,9 +1641,9 @@ function ListBoxItem({
|
|
|
1457
1641
|
},
|
|
1458
1642
|
reactAriaComponents.composeRenderProps(
|
|
1459
1643
|
children,
|
|
1460
|
-
(rendered, renderProps) => /* @__PURE__ */
|
|
1644
|
+
(rendered, renderProps) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, rendered, renderProps.isSelected && showIndicator && /* @__PURE__ */ React13__namespace.createElement("span", { className: "selection-indicator" }, config.renderSelectionIndicator?.(
|
|
1461
1645
|
props.value ?? props
|
|
1462
|
-
) ?? /* @__PURE__ */
|
|
1646
|
+
) ?? /* @__PURE__ */ React13__namespace.createElement(HiCheck, { size: 16 })))
|
|
1463
1647
|
)
|
|
1464
1648
|
);
|
|
1465
1649
|
}
|
|
@@ -1469,7 +1653,7 @@ function ListBoxSection({
|
|
|
1469
1653
|
children,
|
|
1470
1654
|
...props
|
|
1471
1655
|
}) {
|
|
1472
|
-
return /* @__PURE__ */
|
|
1656
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.ListBoxSection, { ...props, className: cn("prt-list-section", className) }, title && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Header, { className: "prt-list-section-header" }, title), children);
|
|
1473
1657
|
}
|
|
1474
1658
|
|
|
1475
1659
|
// src/components/combo-box/combo-box.tsx
|
|
@@ -1477,7 +1661,7 @@ function ComboBox({
|
|
|
1477
1661
|
description,
|
|
1478
1662
|
error,
|
|
1479
1663
|
label,
|
|
1480
|
-
selectorIcon = /* @__PURE__ */
|
|
1664
|
+
selectorIcon = /* @__PURE__ */ React13__namespace.createElement(HiSelector, { size: 18 }),
|
|
1481
1665
|
selectorSize = "sm",
|
|
1482
1666
|
style,
|
|
1483
1667
|
styles,
|
|
@@ -1485,7 +1669,7 @@ function ComboBox({
|
|
|
1485
1669
|
classNames,
|
|
1486
1670
|
isLoading,
|
|
1487
1671
|
loadData,
|
|
1488
|
-
loadingIndicator = /* @__PURE__ */
|
|
1672
|
+
loadingIndicator = /* @__PURE__ */ React13__namespace.createElement(Loader, { size: "xs" }),
|
|
1489
1673
|
items,
|
|
1490
1674
|
defaultItems,
|
|
1491
1675
|
inputValue,
|
|
@@ -1531,13 +1715,13 @@ function ComboBox({
|
|
|
1531
1715
|
isInvalid: !!error,
|
|
1532
1716
|
defaultFilter: contains
|
|
1533
1717
|
};
|
|
1534
|
-
return /* @__PURE__ */
|
|
1718
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1535
1719
|
reactAriaComponents.ComboBox,
|
|
1536
1720
|
{
|
|
1537
1721
|
...comboBoxProps,
|
|
1538
1722
|
className: cn("prt-combo-box", className, classNames?.wrapper)
|
|
1539
1723
|
},
|
|
1540
|
-
/* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1541
1725
|
Field,
|
|
1542
1726
|
{
|
|
1543
1727
|
styles,
|
|
@@ -1553,7 +1737,7 @@ function ComboBox({
|
|
|
1553
1737
|
prepend,
|
|
1554
1738
|
append
|
|
1555
1739
|
},
|
|
1556
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1557
1741
|
reactAriaComponents.Input,
|
|
1558
1742
|
{
|
|
1559
1743
|
placeholder,
|
|
@@ -1565,7 +1749,7 @@ function ComboBox({
|
|
|
1565
1749
|
)
|
|
1566
1750
|
}
|
|
1567
1751
|
),
|
|
1568
|
-
/* @__PURE__ */
|
|
1752
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1569
1753
|
IconButton,
|
|
1570
1754
|
{
|
|
1571
1755
|
className: cn("prt-combo-box-button", classNames?.button),
|
|
@@ -1577,7 +1761,7 @@ function ComboBox({
|
|
|
1577
1761
|
loading ? loadingIndicator : selectorIcon
|
|
1578
1762
|
)
|
|
1579
1763
|
),
|
|
1580
|
-
/* @__PURE__ */
|
|
1764
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1581
1765
|
reactAriaComponents.Popover,
|
|
1582
1766
|
{
|
|
1583
1767
|
offset: 6,
|
|
@@ -1588,7 +1772,7 @@ function ComboBox({
|
|
|
1588
1772
|
),
|
|
1589
1773
|
style: styles?.popover
|
|
1590
1774
|
},
|
|
1591
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1592
1776
|
ListBox,
|
|
1593
1777
|
{
|
|
1594
1778
|
items: comboItems,
|
|
@@ -1605,7 +1789,7 @@ function ComboBox({
|
|
|
1605
1789
|
);
|
|
1606
1790
|
}
|
|
1607
1791
|
function Radio({
|
|
1608
|
-
size
|
|
1792
|
+
size,
|
|
1609
1793
|
className,
|
|
1610
1794
|
style,
|
|
1611
1795
|
appearance,
|
|
@@ -1613,14 +1797,18 @@ function Radio({
|
|
|
1613
1797
|
children,
|
|
1614
1798
|
...props
|
|
1615
1799
|
}) {
|
|
1616
|
-
|
|
1800
|
+
const theme = useTheme();
|
|
1801
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
1802
|
+
const resolvedAppearance = appearance ?? theme?.inputAppearance;
|
|
1803
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.RadioField, { ...props }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.RadioButton, { style, className: cn("prt-radio", className) }, ({ isSelected }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
|
|
1617
1804
|
"div",
|
|
1618
1805
|
{
|
|
1619
1806
|
"data-color": color,
|
|
1807
|
+
"data-variant": isSelected ? "solid" : void 0,
|
|
1620
1808
|
className: "prt-fake-radio",
|
|
1621
|
-
"data-appearance":
|
|
1809
|
+
"data-appearance": resolvedAppearance,
|
|
1622
1810
|
"data-checked": isSelected,
|
|
1623
|
-
"data-size":
|
|
1811
|
+
"data-size": resolvedSize
|
|
1624
1812
|
}
|
|
1625
1813
|
), children)));
|
|
1626
1814
|
}
|
|
@@ -1636,13 +1824,13 @@ function RadioGroup({
|
|
|
1636
1824
|
...props
|
|
1637
1825
|
}) {
|
|
1638
1826
|
const isHorizontal = props.orientation === "horizontal";
|
|
1639
|
-
return /* @__PURE__ */
|
|
1827
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1640
1828
|
reactAriaComponents.RadioGroup,
|
|
1641
1829
|
{
|
|
1642
1830
|
...props,
|
|
1643
1831
|
"aria-label": typeof label === "string" ? label : void 0
|
|
1644
1832
|
},
|
|
1645
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1646
1834
|
"div",
|
|
1647
1835
|
{
|
|
1648
1836
|
style: { ...style, ...styles?.wrapper },
|
|
@@ -1652,10 +1840,10 @@ function RadioGroup({
|
|
|
1652
1840
|
classNames?.wrapper
|
|
1653
1841
|
)
|
|
1654
1842
|
},
|
|
1655
|
-
label && /* @__PURE__ */
|
|
1656
|
-
description && /* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
errorMessage && /* @__PURE__ */
|
|
1843
|
+
label && /* @__PURE__ */ React13__namespace.createElement(InputLabel, null, label),
|
|
1844
|
+
description && /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-gray-600" }, description),
|
|
1845
|
+
/* @__PURE__ */ React13__namespace.createElement("div", { className: cn("flex gap-2", isHorizontal ? "flex-row" : "flex-col") }, children),
|
|
1846
|
+
errorMessage && /* @__PURE__ */ React13__namespace.createElement(InputError, null, errorMessage)
|
|
1659
1847
|
)
|
|
1660
1848
|
);
|
|
1661
1849
|
}
|
|
@@ -1672,23 +1860,25 @@ function RadioCard({
|
|
|
1672
1860
|
styles,
|
|
1673
1861
|
...props
|
|
1674
1862
|
}) {
|
|
1675
|
-
|
|
1863
|
+
const theme = useTheme();
|
|
1864
|
+
const resolvedAppearance = appearance ?? theme?.inputAppearance;
|
|
1865
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.RadioField, { ...props }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1676
1866
|
reactAriaComponents.RadioButton,
|
|
1677
1867
|
{
|
|
1678
1868
|
"data-radius": "lg",
|
|
1679
1869
|
className: cn(className, "prt-radio-card", classNames?.wrapper),
|
|
1680
1870
|
"data-color": color,
|
|
1681
|
-
"data-appearance":
|
|
1871
|
+
"data-appearance": resolvedAppearance,
|
|
1682
1872
|
style: { ...style, ...styles?.wrapper }
|
|
1683
1873
|
},
|
|
1684
|
-
({ isSelected }) => /* @__PURE__ */
|
|
1874
|
+
({ isSelected }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, showIndicator && /* @__PURE__ */ React13__namespace.createElement(
|
|
1685
1875
|
"div",
|
|
1686
1876
|
{
|
|
1687
1877
|
className: "prt-radio-card-indicator prt-fake-radio",
|
|
1688
1878
|
"data-size": "sm",
|
|
1689
1879
|
"data-checked": isSelected
|
|
1690
1880
|
}
|
|
1691
|
-
), /* @__PURE__ */
|
|
1881
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
1692
1882
|
"div",
|
|
1693
1883
|
{
|
|
1694
1884
|
className: cn(
|
|
@@ -1697,14 +1887,14 @@ function RadioCard({
|
|
|
1697
1887
|
),
|
|
1698
1888
|
style: { ...styles?.content }
|
|
1699
1889
|
},
|
|
1700
|
-
(title || description) && /* @__PURE__ */
|
|
1890
|
+
(title || description) && /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-0.5" }, title && /* @__PURE__ */ React13__namespace.createElement(
|
|
1701
1891
|
"div",
|
|
1702
1892
|
{
|
|
1703
1893
|
className: cn("text-sm", classNames?.title),
|
|
1704
1894
|
style: { ...styles?.title }
|
|
1705
1895
|
},
|
|
1706
1896
|
title
|
|
1707
|
-
), description && /* @__PURE__ */
|
|
1897
|
+
), description && /* @__PURE__ */ React13__namespace.createElement(
|
|
1708
1898
|
"div",
|
|
1709
1899
|
{
|
|
1710
1900
|
className: cn(
|
|
@@ -1727,7 +1917,7 @@ function RadioItem({
|
|
|
1727
1917
|
children,
|
|
1728
1918
|
...props
|
|
1729
1919
|
}) {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.RadioField, { ...props }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1731
1921
|
reactAriaComponents.RadioButton,
|
|
1732
1922
|
{
|
|
1733
1923
|
style: { ...style, ...styles?.wrapper },
|
|
@@ -1742,7 +1932,7 @@ function Tag({
|
|
|
1742
1932
|
children,
|
|
1743
1933
|
hashValue,
|
|
1744
1934
|
color,
|
|
1745
|
-
size
|
|
1935
|
+
size,
|
|
1746
1936
|
shape,
|
|
1747
1937
|
variant = "light",
|
|
1748
1938
|
className,
|
|
@@ -1754,19 +1944,21 @@ function Tag({
|
|
|
1754
1944
|
...props
|
|
1755
1945
|
}) {
|
|
1756
1946
|
warnDeprecation("shape", "radius", shape);
|
|
1757
|
-
const
|
|
1947
|
+
const theme = useTheme();
|
|
1948
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
1949
|
+
const randomColor = React13__namespace.default.useMemo(() => {
|
|
1758
1950
|
if (hashValue) {
|
|
1759
1951
|
return getRandomColor(hashValue);
|
|
1760
1952
|
}
|
|
1761
1953
|
return "gray";
|
|
1762
1954
|
}, [hashValue]);
|
|
1763
|
-
return /* @__PURE__ */
|
|
1955
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
1764
1956
|
"span",
|
|
1765
1957
|
{
|
|
1766
1958
|
className: cn(className, "prt-tag", classNames?.wrapper),
|
|
1767
1959
|
style: { ...style, ...styles?.wrapper },
|
|
1768
1960
|
"data-radius": radius,
|
|
1769
|
-
"data-size":
|
|
1961
|
+
"data-size": resolvedSize,
|
|
1770
1962
|
"data-color": color ?? randomColor,
|
|
1771
1963
|
"data-variant": variant,
|
|
1772
1964
|
ref,
|
|
@@ -1784,21 +1976,12 @@ function Select({
|
|
|
1784
1976
|
description,
|
|
1785
1977
|
error,
|
|
1786
1978
|
placeholder,
|
|
1787
|
-
|
|
1788
|
-
appearance = "outline",
|
|
1979
|
+
appearance,
|
|
1789
1980
|
renderValue,
|
|
1790
1981
|
color = "gray",
|
|
1791
|
-
size
|
|
1982
|
+
size,
|
|
1792
1983
|
radius,
|
|
1793
1984
|
listBoxColor,
|
|
1794
|
-
name,
|
|
1795
|
-
value,
|
|
1796
|
-
defaultValue,
|
|
1797
|
-
isDisabled,
|
|
1798
|
-
isRequired,
|
|
1799
|
-
disabledKeys,
|
|
1800
|
-
onChange,
|
|
1801
|
-
onSelectionChange,
|
|
1802
1985
|
showSectionSeparator = true,
|
|
1803
1986
|
showSelectionIndicator = true,
|
|
1804
1987
|
items,
|
|
@@ -1808,65 +1991,61 @@ function Select({
|
|
|
1808
1991
|
sectionKey,
|
|
1809
1992
|
renderOption,
|
|
1810
1993
|
renderSectionLabel,
|
|
1994
|
+
disabledKeys,
|
|
1811
1995
|
className,
|
|
1812
1996
|
classNames,
|
|
1813
1997
|
style,
|
|
1814
|
-
styles
|
|
1998
|
+
styles,
|
|
1999
|
+
"aria-label": ariaLabel,
|
|
2000
|
+
...racProps
|
|
1815
2001
|
}) {
|
|
1816
2002
|
const theme = useTheme();
|
|
1817
|
-
const
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
onSelectionChange?.(v == null ? [] : Array.isArray(v) ? v : [v]);
|
|
1822
|
-
}
|
|
2003
|
+
const resolvedColor = color ?? theme?.color;
|
|
2004
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
2005
|
+
const resolvedAppearance = appearance ?? theme?.inputAppearance ?? "outline";
|
|
2006
|
+
const isMultiple = racProps.selectionMode === "multiple";
|
|
1823
2007
|
function labelOf(item) {
|
|
1824
2008
|
if (item == null) return null;
|
|
1825
2009
|
return item[labelKey];
|
|
1826
2010
|
}
|
|
1827
|
-
|
|
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(
|
|
2011
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1839
2012
|
reactAriaComponents.Select,
|
|
1840
2013
|
{
|
|
1841
|
-
...
|
|
1842
|
-
|
|
2014
|
+
...racProps,
|
|
2015
|
+
placeholder,
|
|
2016
|
+
isInvalid: !!error,
|
|
2017
|
+
"aria-label": ariaLabel ?? (label == null ? placeholder ?? "Select" : void 0),
|
|
1843
2018
|
className: cn("prt-select", className, classNames?.wrapper),
|
|
1844
2019
|
style: { ...style, ...styles?.wrapper }
|
|
1845
2020
|
},
|
|
1846
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1847
2022
|
Field,
|
|
1848
2023
|
{
|
|
1849
2024
|
replaceDefaultControlWrapper: true,
|
|
1850
2025
|
label,
|
|
1851
2026
|
error,
|
|
1852
2027
|
description,
|
|
1853
|
-
color,
|
|
1854
|
-
size,
|
|
2028
|
+
color: resolvedColor,
|
|
2029
|
+
size: resolvedSize,
|
|
1855
2030
|
radius,
|
|
1856
2031
|
classNames,
|
|
1857
2032
|
styles
|
|
1858
2033
|
},
|
|
1859
|
-
/* @__PURE__ */
|
|
2034
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1860
2035
|
reactAriaComponents.Button,
|
|
1861
2036
|
{
|
|
1862
|
-
"data-selection-mode": selectionMode,
|
|
1863
|
-
"data-appearance":
|
|
2037
|
+
"data-selection-mode": racProps.selectionMode ?? "single",
|
|
2038
|
+
"data-appearance": resolvedAppearance,
|
|
1864
2039
|
style: styles?.trigger,
|
|
1865
|
-
className: cn(
|
|
2040
|
+
className: cn(
|
|
2041
|
+
"prt-input-control",
|
|
2042
|
+
"prt-select-trigger",
|
|
2043
|
+
classNames?.trigger
|
|
2044
|
+
)
|
|
1866
2045
|
},
|
|
1867
|
-
/* @__PURE__ */
|
|
2046
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.SelectValue, { className: cn("single-value", classNames?.value) }, ({ isPlaceholder, selectedItems, selectedText }) => {
|
|
1868
2047
|
if (isPlaceholder) {
|
|
1869
|
-
return /* @__PURE__ */
|
|
2048
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1870
2049
|
"span",
|
|
1871
2050
|
{
|
|
1872
2051
|
style: styles?.placeholder,
|
|
@@ -1876,13 +2055,13 @@ function Select({
|
|
|
1876
2055
|
);
|
|
1877
2056
|
}
|
|
1878
2057
|
if (isMultiple) {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1880
|
-
(item, index) => item == null ? null : renderValue?.(item) ?? /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-wrap gap-1" }, selectedItems.map(
|
|
2059
|
+
(item, index) => item == null ? null : renderValue?.(item) ?? /* @__PURE__ */ React13__namespace.createElement(
|
|
1881
2060
|
Tag,
|
|
1882
2061
|
{
|
|
1883
2062
|
size: "md",
|
|
1884
2063
|
variant: "pastel",
|
|
1885
|
-
color,
|
|
2064
|
+
color: resolvedColor,
|
|
1886
2065
|
key: index
|
|
1887
2066
|
},
|
|
1888
2067
|
labelOf(item)
|
|
@@ -1890,7 +2069,7 @@ function Select({
|
|
|
1890
2069
|
));
|
|
1891
2070
|
}
|
|
1892
2071
|
const selectedItem = selectedItems[0] ?? null;
|
|
1893
|
-
return /* @__PURE__ */
|
|
2072
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
1894
2073
|
"div",
|
|
1895
2074
|
{
|
|
1896
2075
|
className: cn("single-value", classNames?.value),
|
|
@@ -1899,23 +2078,32 @@ function Select({
|
|
|
1899
2078
|
(selectedItem && renderValue?.(selectedItem)) ?? labelOf(selectedItem) ?? selectedText
|
|
1900
2079
|
);
|
|
1901
2080
|
}),
|
|
1902
|
-
/* @__PURE__ */
|
|
2081
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2082
|
+
HiSelector,
|
|
2083
|
+
{
|
|
2084
|
+
className: "selector",
|
|
2085
|
+
size: 18,
|
|
2086
|
+
"data-variant": "solid",
|
|
2087
|
+
"data-interactive": "false"
|
|
2088
|
+
}
|
|
2089
|
+
)
|
|
1903
2090
|
)
|
|
1904
2091
|
),
|
|
1905
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1906
2093
|
reactAriaComponents.Popover,
|
|
1907
2094
|
{
|
|
1908
2095
|
offset: 4,
|
|
1909
2096
|
className: cn("prt-popover", "prt-select-popover", classNames?.popover),
|
|
1910
2097
|
style: styles?.popover
|
|
1911
2098
|
},
|
|
1912
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
1913
2100
|
ListBox,
|
|
1914
2101
|
{
|
|
1915
2102
|
items,
|
|
1916
2103
|
labelKey,
|
|
1917
2104
|
valueKey,
|
|
1918
2105
|
sectionKey,
|
|
2106
|
+
disabledKeys,
|
|
1919
2107
|
renderOption,
|
|
1920
2108
|
renderSectionLabel,
|
|
1921
2109
|
showSectionSeparator,
|
|
@@ -1932,7 +2120,7 @@ function CalendarBody({
|
|
|
1932
2120
|
numberOfMonths = 1,
|
|
1933
2121
|
showMonthAndYearPickers = false
|
|
1934
2122
|
}) {
|
|
1935
|
-
return /* @__PURE__ */
|
|
2123
|
+
return /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement("header", { className: "prt-calendar-header" }, /* @__PURE__ */ React13__namespace.createElement(
|
|
1936
2124
|
IconButton,
|
|
1937
2125
|
{
|
|
1938
2126
|
slot: "previous",
|
|
@@ -1941,8 +2129,8 @@ function CalendarBody({
|
|
|
1941
2129
|
size: "sm",
|
|
1942
2130
|
color: "gray"
|
|
1943
2131
|
},
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
), showMonthAndYearPickers ? /* @__PURE__ */
|
|
2132
|
+
/* @__PURE__ */ React13__namespace.createElement(HiChevronLeft, { size: 20 })
|
|
2133
|
+
), showMonthAndYearPickers ? /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex items-center gap-2 prt-calendar-selects" }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CalendarMonthPicker, null, ({ "aria-label": ariaLabel, value, onChange, items }) => /* @__PURE__ */ React13__namespace.createElement(
|
|
1946
2134
|
Select,
|
|
1947
2135
|
{
|
|
1948
2136
|
"aria-label": ariaLabel,
|
|
@@ -1951,10 +2139,10 @@ function CalendarBody({
|
|
|
1951
2139
|
valueKey: "id",
|
|
1952
2140
|
labelKey: "formatted",
|
|
1953
2141
|
value,
|
|
1954
|
-
onChange: (
|
|
2142
|
+
onChange: (v) => v != null && onChange(Number(v)),
|
|
1955
2143
|
items
|
|
1956
2144
|
}
|
|
1957
|
-
)), /* @__PURE__ */
|
|
2145
|
+
)), /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CalendarYearPicker, null, ({ "aria-label": ariaLabel, value, onChange, items }) => /* @__PURE__ */ React13__namespace.createElement(
|
|
1958
2146
|
Select,
|
|
1959
2147
|
{
|
|
1960
2148
|
"aria-label": ariaLabel,
|
|
@@ -1963,10 +2151,10 @@ function CalendarBody({
|
|
|
1963
2151
|
valueKey: "id",
|
|
1964
2152
|
labelKey: "formatted",
|
|
1965
2153
|
value,
|
|
1966
|
-
onChange: (
|
|
2154
|
+
onChange: (v) => v != null && onChange(Number(v)),
|
|
1967
2155
|
items
|
|
1968
2156
|
}
|
|
1969
|
-
))) : /* @__PURE__ */
|
|
2157
|
+
))) : /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Heading, { className: "prt-calendar-heading" }), /* @__PURE__ */ React13__namespace.createElement(
|
|
1970
2158
|
IconButton,
|
|
1971
2159
|
{
|
|
1972
2160
|
slot: "next",
|
|
@@ -1975,16 +2163,16 @@ function CalendarBody({
|
|
|
1975
2163
|
size: "sm",
|
|
1976
2164
|
color: "gray"
|
|
1977
2165
|
},
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
)), /* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ React13__namespace.createElement(HiChevronRight, { size: 20 })
|
|
2167
|
+
)), /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-calendar-months" }, Array.from({ length: numberOfMonths }, (_, i) => /* @__PURE__ */ React13__namespace.createElement(
|
|
1980
2168
|
reactAriaComponents.CalendarGrid,
|
|
1981
2169
|
{
|
|
1982
2170
|
key: i,
|
|
1983
2171
|
offset: { months: i },
|
|
1984
2172
|
className: "prt-calendar-grid"
|
|
1985
2173
|
},
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CalendarGridHeader, null, (day) => /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CalendarHeaderCell, { className: "prt-date-weekday" }, day)),
|
|
2175
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CalendarGridBody, null, (date) => /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.CalendarCell, { date, className: "prt-date-cell" }))
|
|
1988
2176
|
))));
|
|
1989
2177
|
}
|
|
1990
2178
|
function Calendar({
|
|
@@ -1996,17 +2184,19 @@ function Calendar({
|
|
|
1996
2184
|
...props
|
|
1997
2185
|
}) {
|
|
1998
2186
|
const theme = useTheme();
|
|
1999
|
-
return /* @__PURE__ */
|
|
2187
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2000
2188
|
reactAriaComponents.Calendar,
|
|
2001
2189
|
{
|
|
2002
2190
|
...props,
|
|
2003
2191
|
ref,
|
|
2004
2192
|
visibleDuration: { months: numberOfMonths },
|
|
2005
2193
|
"data-color": color ?? theme?.color ?? "primary",
|
|
2194
|
+
"data-variant": "solid",
|
|
2195
|
+
"data-interactive": "false",
|
|
2006
2196
|
"data-radius": radius ?? theme?.radius ?? "lg",
|
|
2007
2197
|
className: "prt-calendar-wrapper"
|
|
2008
2198
|
},
|
|
2009
|
-
/* @__PURE__ */
|
|
2199
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2010
2200
|
CalendarBody,
|
|
2011
2201
|
{
|
|
2012
2202
|
numberOfMonths,
|
|
@@ -2024,18 +2214,20 @@ function RangeCalendar({
|
|
|
2024
2214
|
...props
|
|
2025
2215
|
}) {
|
|
2026
2216
|
const theme = useTheme();
|
|
2027
|
-
return /* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2028
2218
|
reactAriaComponents.RangeCalendar,
|
|
2029
2219
|
{
|
|
2030
2220
|
...props,
|
|
2031
2221
|
ref,
|
|
2032
2222
|
visibleDuration: { months: numberOfMonths },
|
|
2033
2223
|
"data-color": color ?? theme?.color ?? "primary",
|
|
2224
|
+
"data-variant": "solid",
|
|
2225
|
+
"data-interactive": "false",
|
|
2034
2226
|
"data-radius": radius ?? theme?.radius ?? "lg",
|
|
2035
2227
|
"data-range": "true",
|
|
2036
2228
|
className: "prt-calendar-wrapper"
|
|
2037
2229
|
},
|
|
2038
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2039
2231
|
CalendarBody,
|
|
2040
2232
|
{
|
|
2041
2233
|
numberOfMonths,
|
|
@@ -2045,13 +2237,22 @@ function RangeCalendar({
|
|
|
2045
2237
|
);
|
|
2046
2238
|
}
|
|
2047
2239
|
function DateSegments({ slot, className }) {
|
|
2048
|
-
return /* @__PURE__ */
|
|
2240
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2241
|
+
reactAriaComponents.DateInput,
|
|
2242
|
+
{
|
|
2243
|
+
slot,
|
|
2244
|
+
"data-variant": "solid",
|
|
2245
|
+
"data-interactive": "false",
|
|
2246
|
+
className: cn("prt-date-field", className)
|
|
2247
|
+
},
|
|
2248
|
+
(segment) => /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.DateSegment, { segment, className: "prt-date-input-segment" })
|
|
2249
|
+
);
|
|
2049
2250
|
}
|
|
2050
2251
|
|
|
2051
2252
|
// src/components/date/date-field.tsx
|
|
2052
2253
|
function DateField({
|
|
2053
2254
|
appearance = "outline",
|
|
2054
|
-
size
|
|
2255
|
+
size,
|
|
2055
2256
|
color,
|
|
2056
2257
|
radius,
|
|
2057
2258
|
value,
|
|
@@ -2070,10 +2271,12 @@ function DateField({
|
|
|
2070
2271
|
ref,
|
|
2071
2272
|
...props
|
|
2072
2273
|
}) {
|
|
2274
|
+
const theme = useTheme();
|
|
2275
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
2073
2276
|
function handleChange(date) {
|
|
2074
2277
|
onChange?.(date?.toString() ?? null, date);
|
|
2075
2278
|
}
|
|
2076
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2077
2280
|
reactAriaComponents.DateField,
|
|
2078
2281
|
{
|
|
2079
2282
|
...props,
|
|
@@ -2082,7 +2285,7 @@ function DateField({
|
|
|
2082
2285
|
onChange: handleChange,
|
|
2083
2286
|
isInvalid: !!error
|
|
2084
2287
|
},
|
|
2085
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2086
2289
|
Field,
|
|
2087
2290
|
{
|
|
2088
2291
|
replaceDefaultControlWrapper: true,
|
|
@@ -2090,7 +2293,7 @@ function DateField({
|
|
|
2090
2293
|
error,
|
|
2091
2294
|
description,
|
|
2092
2295
|
color,
|
|
2093
|
-
size,
|
|
2296
|
+
size: resolvedSize,
|
|
2094
2297
|
radius,
|
|
2095
2298
|
appearance,
|
|
2096
2299
|
validationStatus,
|
|
@@ -2099,7 +2302,7 @@ function DateField({
|
|
|
2099
2302
|
style,
|
|
2100
2303
|
styles
|
|
2101
2304
|
},
|
|
2102
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2103
2306
|
reactAriaComponents.Group,
|
|
2104
2307
|
{
|
|
2105
2308
|
ref,
|
|
@@ -2107,16 +2310,16 @@ function DateField({
|
|
|
2107
2310
|
"data-color": color,
|
|
2108
2311
|
className: cn("prt-input-control", "date-field-control")
|
|
2109
2312
|
},
|
|
2110
|
-
prepend && /* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
append && /* @__PURE__ */
|
|
2313
|
+
prepend && /* @__PURE__ */ React13__namespace.createElement("div", { className: "add-on add-on-left flex items-center" }, prepend),
|
|
2314
|
+
/* @__PURE__ */ React13__namespace.createElement(DateSegments, null),
|
|
2315
|
+
append && /* @__PURE__ */ React13__namespace.createElement("div", { className: "add-on add-on-right flex items-center" }, append)
|
|
2113
2316
|
)
|
|
2114
2317
|
)
|
|
2115
2318
|
);
|
|
2116
2319
|
}
|
|
2117
2320
|
function TimeField({
|
|
2118
2321
|
appearance = "outline",
|
|
2119
|
-
size
|
|
2322
|
+
size,
|
|
2120
2323
|
color,
|
|
2121
2324
|
radius,
|
|
2122
2325
|
value,
|
|
@@ -2135,10 +2338,12 @@ function TimeField({
|
|
|
2135
2338
|
ref,
|
|
2136
2339
|
...props
|
|
2137
2340
|
}) {
|
|
2341
|
+
const theme = useTheme();
|
|
2342
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
2138
2343
|
function handleChange(time) {
|
|
2139
2344
|
onChange?.(time?.toString() ?? null, time);
|
|
2140
2345
|
}
|
|
2141
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2142
2347
|
reactAriaComponents.TimeField,
|
|
2143
2348
|
{
|
|
2144
2349
|
...props,
|
|
@@ -2147,7 +2352,7 @@ function TimeField({
|
|
|
2147
2352
|
onChange: handleChange,
|
|
2148
2353
|
isInvalid: !!error
|
|
2149
2354
|
},
|
|
2150
|
-
/* @__PURE__ */
|
|
2355
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2151
2356
|
Field,
|
|
2152
2357
|
{
|
|
2153
2358
|
replaceDefaultControlWrapper: true,
|
|
@@ -2155,7 +2360,7 @@ function TimeField({
|
|
|
2155
2360
|
error,
|
|
2156
2361
|
description,
|
|
2157
2362
|
color,
|
|
2158
|
-
size,
|
|
2363
|
+
size: resolvedSize,
|
|
2159
2364
|
radius,
|
|
2160
2365
|
appearance,
|
|
2161
2366
|
validationStatus,
|
|
@@ -2164,7 +2369,7 @@ function TimeField({
|
|
|
2164
2369
|
style,
|
|
2165
2370
|
styles
|
|
2166
2371
|
},
|
|
2167
|
-
/* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2168
2373
|
reactAriaComponents.Group,
|
|
2169
2374
|
{
|
|
2170
2375
|
ref,
|
|
@@ -2172,21 +2377,21 @@ function TimeField({
|
|
|
2172
2377
|
"data-color": color,
|
|
2173
2378
|
className: cn("prt-input-control", "date-field-control")
|
|
2174
2379
|
},
|
|
2175
|
-
prepend && /* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
append && /* @__PURE__ */
|
|
2380
|
+
prepend && /* @__PURE__ */ React13__namespace.createElement("div", { className: "add-on add-on-left flex items-center" }, prepend),
|
|
2381
|
+
/* @__PURE__ */ React13__namespace.createElement(DateSegments, null),
|
|
2382
|
+
append && /* @__PURE__ */ React13__namespace.createElement("div", { className: "add-on add-on-right flex items-center" }, append)
|
|
2178
2383
|
)
|
|
2179
2384
|
)
|
|
2180
2385
|
);
|
|
2181
2386
|
}
|
|
2182
2387
|
function DatePicker({
|
|
2183
2388
|
appearance = "outline",
|
|
2184
|
-
size
|
|
2389
|
+
size,
|
|
2185
2390
|
color,
|
|
2186
2391
|
numberOfMonths,
|
|
2187
2392
|
showMonthAndYearPickers,
|
|
2188
2393
|
radius,
|
|
2189
|
-
selectorIcon = /* @__PURE__ */
|
|
2394
|
+
selectorIcon = /* @__PURE__ */ React13__namespace.createElement(HiOutlineCalendar, { size: 16 }),
|
|
2190
2395
|
value,
|
|
2191
2396
|
defaultValue,
|
|
2192
2397
|
onChange,
|
|
@@ -2201,10 +2406,12 @@ function DatePicker({
|
|
|
2201
2406
|
ref,
|
|
2202
2407
|
...props
|
|
2203
2408
|
}) {
|
|
2409
|
+
const theme = useTheme();
|
|
2410
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
2204
2411
|
function handleChange(date) {
|
|
2205
2412
|
onChange?.(date?.toString() ?? null, date);
|
|
2206
2413
|
}
|
|
2207
|
-
return /* @__PURE__ */
|
|
2414
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2208
2415
|
reactAriaComponents.DatePicker,
|
|
2209
2416
|
{
|
|
2210
2417
|
...props,
|
|
@@ -2213,7 +2420,7 @@ function DatePicker({
|
|
|
2213
2420
|
onChange: handleChange,
|
|
2214
2421
|
isInvalid: !!error
|
|
2215
2422
|
},
|
|
2216
|
-
/* @__PURE__ */
|
|
2423
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2217
2424
|
Field,
|
|
2218
2425
|
{
|
|
2219
2426
|
replaceDefaultControlWrapper: true,
|
|
@@ -2221,7 +2428,7 @@ function DatePicker({
|
|
|
2221
2428
|
error,
|
|
2222
2429
|
description,
|
|
2223
2430
|
color,
|
|
2224
|
-
size,
|
|
2431
|
+
size: resolvedSize,
|
|
2225
2432
|
radius,
|
|
2226
2433
|
appearance,
|
|
2227
2434
|
validationStatus,
|
|
@@ -2230,7 +2437,7 @@ function DatePicker({
|
|
|
2230
2437
|
style,
|
|
2231
2438
|
styles
|
|
2232
2439
|
},
|
|
2233
|
-
/* @__PURE__ */
|
|
2440
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2234
2441
|
reactAriaComponents.Group,
|
|
2235
2442
|
{
|
|
2236
2443
|
ref,
|
|
@@ -2238,18 +2445,18 @@ function DatePicker({
|
|
|
2238
2445
|
"data-color": color,
|
|
2239
2446
|
className: cn("prt-input-control", "prt-date-picker-trigger")
|
|
2240
2447
|
},
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ React13__namespace.createElement(DateSegments, null),
|
|
2449
|
+
/* @__PURE__ */ React13__namespace.createElement(IconButton, { size: "sm", variant: "light", color }, selectorIcon)
|
|
2243
2450
|
)
|
|
2244
2451
|
),
|
|
2245
|
-
/* @__PURE__ */
|
|
2452
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2246
2453
|
reactAriaComponents.Popover,
|
|
2247
2454
|
{
|
|
2248
2455
|
offset: 8,
|
|
2249
2456
|
placement: "bottom start",
|
|
2250
2457
|
className: cn("prt-popover", "prt-date-popover")
|
|
2251
2458
|
},
|
|
2252
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2253
2460
|
Calendar,
|
|
2254
2461
|
{
|
|
2255
2462
|
color,
|
|
@@ -2266,12 +2473,12 @@ function toRange(value) {
|
|
|
2266
2473
|
}
|
|
2267
2474
|
function DateRangePicker({
|
|
2268
2475
|
appearance = "outline",
|
|
2269
|
-
size
|
|
2476
|
+
size,
|
|
2270
2477
|
color,
|
|
2271
2478
|
numberOfMonths = 2,
|
|
2272
2479
|
showMonthAndYearPickers,
|
|
2273
2480
|
radius,
|
|
2274
|
-
dropdownIcon = /* @__PURE__ */
|
|
2481
|
+
dropdownIcon = /* @__PURE__ */ React13__namespace.createElement(HiOutlineCalendar, { size: 16 }),
|
|
2275
2482
|
value,
|
|
2276
2483
|
defaultValue,
|
|
2277
2484
|
onChange,
|
|
@@ -2292,7 +2499,9 @@ function DateRangePicker({
|
|
|
2292
2499
|
range
|
|
2293
2500
|
);
|
|
2294
2501
|
}
|
|
2295
|
-
|
|
2502
|
+
const theme = useTheme();
|
|
2503
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
2504
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2296
2505
|
reactAriaComponents.DateRangePicker,
|
|
2297
2506
|
{
|
|
2298
2507
|
...props,
|
|
@@ -2301,7 +2510,7 @@ function DateRangePicker({
|
|
|
2301
2510
|
onChange: handleChange,
|
|
2302
2511
|
isInvalid: !!error
|
|
2303
2512
|
},
|
|
2304
|
-
/* @__PURE__ */
|
|
2513
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2305
2514
|
Field,
|
|
2306
2515
|
{
|
|
2307
2516
|
replaceDefaultControlWrapper: true,
|
|
@@ -2309,7 +2518,7 @@ function DateRangePicker({
|
|
|
2309
2518
|
error,
|
|
2310
2519
|
description,
|
|
2311
2520
|
color,
|
|
2312
|
-
size,
|
|
2521
|
+
size: resolvedSize,
|
|
2313
2522
|
radius,
|
|
2314
2523
|
appearance,
|
|
2315
2524
|
validationStatus,
|
|
@@ -2318,7 +2527,7 @@ function DateRangePicker({
|
|
|
2318
2527
|
style,
|
|
2319
2528
|
styles
|
|
2320
2529
|
},
|
|
2321
|
-
/* @__PURE__ */
|
|
2530
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2322
2531
|
reactAriaComponents.Group,
|
|
2323
2532
|
{
|
|
2324
2533
|
ref,
|
|
@@ -2326,18 +2535,27 @@ function DateRangePicker({
|
|
|
2326
2535
|
"data-color": color,
|
|
2327
2536
|
className: cn("prt-input-control", "prt-date-picker-trigger")
|
|
2328
2537
|
},
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
|
|
2538
|
+
/* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-date-range-fields" }, /* @__PURE__ */ React13__namespace.createElement(DateSegments, { slot: "start" }), /* @__PURE__ */ React13__namespace.createElement(
|
|
2539
|
+
"span",
|
|
2540
|
+
{
|
|
2541
|
+
"aria-hidden": "true",
|
|
2542
|
+
"data-variant": "solid",
|
|
2543
|
+
"data-interactive": "false",
|
|
2544
|
+
className: "prt-date-range-sep"
|
|
2545
|
+
},
|
|
2546
|
+
"\u2013"
|
|
2547
|
+
), /* @__PURE__ */ React13__namespace.createElement(DateSegments, { slot: "end" })),
|
|
2548
|
+
/* @__PURE__ */ React13__namespace.createElement(IconButton, { size: "sm", variant: "light", color }, dropdownIcon)
|
|
2331
2549
|
)
|
|
2332
2550
|
),
|
|
2333
|
-
/* @__PURE__ */
|
|
2551
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2334
2552
|
reactAriaComponents.Popover,
|
|
2335
2553
|
{
|
|
2336
2554
|
offset: 8,
|
|
2337
2555
|
placement: "bottom start",
|
|
2338
2556
|
className: cn("prt-popover", "prt-date-popover")
|
|
2339
2557
|
},
|
|
2340
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2341
2559
|
RangeCalendar,
|
|
2342
2560
|
{
|
|
2343
2561
|
color,
|
|
@@ -2349,7 +2567,7 @@ function DateRangePicker({
|
|
|
2349
2567
|
)
|
|
2350
2568
|
);
|
|
2351
2569
|
}
|
|
2352
|
-
var AvatarGroupContext =
|
|
2570
|
+
var AvatarGroupContext = React13__namespace.createContext(null);
|
|
2353
2571
|
function defaultGetInitials(name) {
|
|
2354
2572
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
2355
2573
|
if (parts.length === 0) return "";
|
|
@@ -2374,18 +2592,18 @@ function Avatar({
|
|
|
2374
2592
|
ref,
|
|
2375
2593
|
...props
|
|
2376
2594
|
}) {
|
|
2377
|
-
const [erroredSrc, setErroredSrc] =
|
|
2595
|
+
const [erroredSrc, setErroredSrc] = React13__namespace.useState();
|
|
2378
2596
|
const theme = useTheme();
|
|
2379
|
-
const group =
|
|
2380
|
-
const defaultColor =
|
|
2597
|
+
const group = React13__namespace.useContext(AvatarGroupContext);
|
|
2598
|
+
const defaultColor = React13__namespace.useMemo(() => {
|
|
2381
2599
|
return supportedColors[hashCode(name || "") % supportedColors.length];
|
|
2382
2600
|
}, [name]);
|
|
2383
|
-
const resolvedSize = size ?? group?.size ?? "md";
|
|
2601
|
+
const resolvedSize = size ?? group?.size ?? theme?.size ?? "md";
|
|
2384
2602
|
const resolvedVariant = variant ?? group?.variant ?? "light";
|
|
2385
2603
|
const resolvedColor = color ?? group?.color ?? defaultColor;
|
|
2386
2604
|
function renderContent() {
|
|
2387
2605
|
if (src && erroredSrc !== src) {
|
|
2388
|
-
return /* @__PURE__ */
|
|
2606
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2389
2607
|
"img",
|
|
2390
2608
|
{
|
|
2391
2609
|
className: cn("prt-avatar-img", classNames?.img),
|
|
@@ -2398,7 +2616,7 @@ function Avatar({
|
|
|
2398
2616
|
}
|
|
2399
2617
|
if (children) return children;
|
|
2400
2618
|
if (name) {
|
|
2401
|
-
return /* @__PURE__ */
|
|
2619
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2402
2620
|
"span",
|
|
2403
2621
|
{
|
|
2404
2622
|
className: cn("prt-avatar-fallback", classNames?.fallback),
|
|
@@ -2409,12 +2627,12 @@ function Avatar({
|
|
|
2409
2627
|
}
|
|
2410
2628
|
return fallback ?? null;
|
|
2411
2629
|
}
|
|
2412
|
-
return /* @__PURE__ */
|
|
2630
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2413
2631
|
"div",
|
|
2414
2632
|
{
|
|
2415
2633
|
style: { ...style, ...styles?.base },
|
|
2416
2634
|
className: cn("prt-avatar prt-size", className, classNames?.base),
|
|
2417
|
-
"data-radius": radius ?? theme?.
|
|
2635
|
+
"data-radius": radius ?? theme?.radius ?? "full",
|
|
2418
2636
|
"data-color": resolvedColor,
|
|
2419
2637
|
"data-variant": resolvedVariant,
|
|
2420
2638
|
"data-interactive": false,
|
|
@@ -2428,7 +2646,7 @@ function Avatar({
|
|
|
2428
2646
|
);
|
|
2429
2647
|
}
|
|
2430
2648
|
function AvatarGroup({
|
|
2431
|
-
max,
|
|
2649
|
+
max: max2,
|
|
2432
2650
|
size,
|
|
2433
2651
|
color,
|
|
2434
2652
|
variant,
|
|
@@ -2438,21 +2656,21 @@ function AvatarGroup({
|
|
|
2438
2656
|
classNames,
|
|
2439
2657
|
styles
|
|
2440
2658
|
}) {
|
|
2441
|
-
const value =
|
|
2659
|
+
const value = React13__namespace.useMemo(
|
|
2442
2660
|
() => ({ size, color, variant }),
|
|
2443
2661
|
[size, color, variant]
|
|
2444
2662
|
);
|
|
2445
|
-
const items =
|
|
2446
|
-
const visible =
|
|
2447
|
-
const overflow =
|
|
2448
|
-
return /* @__PURE__ */
|
|
2663
|
+
const items = React13__namespace.Children.toArray(children);
|
|
2664
|
+
const visible = max2 != null ? items.slice(0, max2) : items;
|
|
2665
|
+
const overflow = max2 != null ? Math.max(0, items.length - max2) : 0;
|
|
2666
|
+
return /* @__PURE__ */ React13__namespace.createElement(AvatarGroupContext.Provider, { value }, /* @__PURE__ */ React13__namespace.createElement(
|
|
2449
2667
|
"div",
|
|
2450
2668
|
{
|
|
2451
2669
|
className: cn("prt-avatar-group", className, classNames?.wrapper),
|
|
2452
2670
|
style: { ...style, ...styles?.wrapper }
|
|
2453
2671
|
},
|
|
2454
2672
|
visible,
|
|
2455
|
-
overflow > 0 && /* @__PURE__ */
|
|
2673
|
+
overflow > 0 && /* @__PURE__ */ React13__namespace.createElement(
|
|
2456
2674
|
"div",
|
|
2457
2675
|
{
|
|
2458
2676
|
className: cn("prt-avatar prt-size", classNames?.overflow),
|
|
@@ -2492,7 +2710,7 @@ function FileUploader({
|
|
|
2492
2710
|
className,
|
|
2493
2711
|
style
|
|
2494
2712
|
}) {
|
|
2495
|
-
const [_uploads, setUploads] =
|
|
2713
|
+
const [_uploads, setUploads] = React13__namespace.useState([]);
|
|
2496
2714
|
const uploads = controlledUploads ?? _uploads;
|
|
2497
2715
|
function onUpload(next) {
|
|
2498
2716
|
if (isEmptyArray(next)) return;
|
|
@@ -2514,15 +2732,15 @@ function FileUploader({
|
|
|
2514
2732
|
const isUploading = !allowMultiple && uploads[0]?.status === "loading";
|
|
2515
2733
|
const isUploaded = !allowMultiple && uploads[0]?.status === "success";
|
|
2516
2734
|
const isFailed = !allowMultiple && uploads[0]?.status === "error";
|
|
2517
|
-
return /* @__PURE__ */
|
|
2735
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2518
2736
|
"div",
|
|
2519
2737
|
{
|
|
2520
2738
|
ref,
|
|
2521
2739
|
className: cn("flex flex-col gap-2.5", classNames?.wrapper, className),
|
|
2522
2740
|
style: { ...styles?.wrapper, ...style }
|
|
2523
2741
|
},
|
|
2524
|
-
label && /* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2742
|
+
label && /* @__PURE__ */ React13__namespace.createElement(InputLabel, null, label),
|
|
2743
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2526
2744
|
reactAriaComponents.DropZone,
|
|
2527
2745
|
{
|
|
2528
2746
|
"aria-label": typeof label === "string" ? label : "File upload",
|
|
@@ -2537,13 +2755,33 @@ function FileUploader({
|
|
|
2537
2755
|
},
|
|
2538
2756
|
"data-radius": "lg",
|
|
2539
2757
|
"data-color": color,
|
|
2758
|
+
"data-variant": "light",
|
|
2759
|
+
"data-interactive": "false",
|
|
2540
2760
|
className: cn("prt-file-uploader", classNames?.dropzone),
|
|
2541
2761
|
style: { ...styles?.dropzone },
|
|
2542
2762
|
"data-state": allowMultiple || !uploads.length ? "idle" : uploads[0]?.status
|
|
2543
2763
|
},
|
|
2544
|
-
isIdle && /* @__PURE__ */
|
|
2545
|
-
|
|
2546
|
-
|
|
2764
|
+
isIdle && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.FileTrigger, { allowsMultiple: allowMultiple, onSelect: handleSelect }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Button, { className: "prt-file-uploader-trigger" }, /* @__PURE__ */ React13__namespace.createElement(
|
|
2765
|
+
"div",
|
|
2766
|
+
{
|
|
2767
|
+
"data-variant": "solid",
|
|
2768
|
+
"data-interactive": "false",
|
|
2769
|
+
className: "prt-file-uploader-content flex items-center gap-2.5"
|
|
2770
|
+
},
|
|
2771
|
+
/* @__PURE__ */ React13__namespace.createElement(HiOutlineDocumentAdd, { className: "state-icon", size: 20 }),
|
|
2772
|
+
/* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-inherit" }, "Click or drag files here to upload")
|
|
2773
|
+
))),
|
|
2774
|
+
isUploading && /* @__PURE__ */ React13__namespace.createElement(
|
|
2775
|
+
"div",
|
|
2776
|
+
{
|
|
2777
|
+
"data-variant": "solid",
|
|
2778
|
+
"data-interactive": "false",
|
|
2779
|
+
className: "prt-file-uploader-content flex items-center gap-2.5"
|
|
2780
|
+
},
|
|
2781
|
+
/* @__PURE__ */ React13__namespace.createElement(Loader, { size: "xs" }),
|
|
2782
|
+
/* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-inherit" }, "Name_of_file.ext / Uploading...")
|
|
2783
|
+
),
|
|
2784
|
+
isUploaded && /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex w-full items-center justify-between" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React13__namespace.createElement(HiOutlineCheckCircle, { size: 16 }), /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-green-600" }, "File successfully uploaded")), /* @__PURE__ */ React13__namespace.createElement(
|
|
2547
2785
|
IconButton,
|
|
2548
2786
|
{
|
|
2549
2787
|
onPress: handleRemoveFile,
|
|
@@ -2551,9 +2789,9 @@ function FileUploader({
|
|
|
2551
2789
|
color: "green",
|
|
2552
2790
|
size: "xs"
|
|
2553
2791
|
},
|
|
2554
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ React13__namespace.createElement(HiOutlineTrash, { size: 16 })
|
|
2555
2793
|
)),
|
|
2556
|
-
isFailed && /* @__PURE__ */
|
|
2794
|
+
isFailed && /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex w-full justify-between" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ React13__namespace.createElement(HiOutlineExclamationCircle, { className: "state-icon" }), /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-red-600" }, "Failed to upload file")), /* @__PURE__ */ React13__namespace.createElement(
|
|
2557
2795
|
IconButton,
|
|
2558
2796
|
{
|
|
2559
2797
|
onPress: handleRetry,
|
|
@@ -2561,18 +2799,18 @@ function FileUploader({
|
|
|
2561
2799
|
color: "tomato",
|
|
2562
2800
|
size: "xs"
|
|
2563
2801
|
},
|
|
2564
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ React13__namespace.createElement(HiOutlineRefresh, { size: 16 })
|
|
2565
2803
|
))
|
|
2566
2804
|
),
|
|
2567
|
-
uploads.length > 1 && !hideFileList && /* @__PURE__ */
|
|
2805
|
+
uploads.length > 1 && !hideFileList && /* @__PURE__ */ React13__namespace.createElement(
|
|
2568
2806
|
"div",
|
|
2569
2807
|
{
|
|
2570
2808
|
style: { marginTop: 10, ...styles?.list },
|
|
2571
2809
|
className: cn("flex flex-col gap-3 upload-list", classNames?.list)
|
|
2572
2810
|
},
|
|
2573
|
-
uploads.map((upload) => /* @__PURE__ */
|
|
2811
|
+
uploads.map((upload) => /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex items-center gap-2.5", key: upload.id }, upload.status === "loading" && /* @__PURE__ */ React13__namespace.createElement(Loader, null), upload.status === "success" && /* @__PURE__ */ React13__namespace.createElement(HiOutlinePaperClip, null), /* @__PURE__ */ React13__namespace.createElement("span", { className: "text-sm text-gray-700" }, upload.name)))
|
|
2574
2812
|
),
|
|
2575
|
-
error && /* @__PURE__ */
|
|
2813
|
+
error && /* @__PURE__ */ React13__namespace.createElement(InputError, null, error)
|
|
2576
2814
|
);
|
|
2577
2815
|
}
|
|
2578
2816
|
function Separator({
|
|
@@ -2583,7 +2821,7 @@ function Separator({
|
|
|
2583
2821
|
ref,
|
|
2584
2822
|
...props
|
|
2585
2823
|
}) {
|
|
2586
|
-
return /* @__PURE__ */
|
|
2824
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2587
2825
|
"div",
|
|
2588
2826
|
{
|
|
2589
2827
|
"data-opacity": opacity,
|
|
@@ -2606,7 +2844,7 @@ function Progress({
|
|
|
2606
2844
|
ref,
|
|
2607
2845
|
...props
|
|
2608
2846
|
}) {
|
|
2609
|
-
return /* @__PURE__ */
|
|
2847
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2610
2848
|
reactAriaComponents.ProgressBar,
|
|
2611
2849
|
{
|
|
2612
2850
|
...props,
|
|
@@ -2615,14 +2853,14 @@ function Progress({
|
|
|
2615
2853
|
className: cn("progress-bar", className, classNames?.wrapper),
|
|
2616
2854
|
style: { ...style, ...styles?.wrapper }
|
|
2617
2855
|
},
|
|
2618
|
-
({ percentage }) => /* @__PURE__ */
|
|
2856
|
+
({ percentage }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, label && /* @__PURE__ */ React13__namespace.createElement(
|
|
2619
2857
|
"span",
|
|
2620
2858
|
{
|
|
2621
2859
|
className: cn("text-sm text-gray-700", classNames?.label),
|
|
2622
2860
|
style: { ...styles?.label }
|
|
2623
2861
|
},
|
|
2624
2862
|
label
|
|
2625
|
-
), /* @__PURE__ */
|
|
2863
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
2626
2864
|
"div",
|
|
2627
2865
|
{
|
|
2628
2866
|
className: cn("progress-wrapper", classNames?.track),
|
|
@@ -2636,16 +2874,18 @@ function Progress({
|
|
|
2636
2874
|
},
|
|
2637
2875
|
ref
|
|
2638
2876
|
},
|
|
2639
|
-
/* @__PURE__ */
|
|
2877
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2640
2878
|
"div",
|
|
2641
2879
|
{
|
|
2880
|
+
"data-variant": "solid",
|
|
2881
|
+
"data-interactive": "false",
|
|
2642
2882
|
className: cn("progress absolute", classNames?.bar),
|
|
2643
2883
|
style: {
|
|
2644
2884
|
left: 0,
|
|
2645
2885
|
top: 0,
|
|
2646
2886
|
height: "100%",
|
|
2647
2887
|
width: `${percentage ?? 0}%`,
|
|
2648
|
-
background: "var(--
|
|
2888
|
+
background: "var(--variant-bg)",
|
|
2649
2889
|
transition: "all 0.3s ease",
|
|
2650
2890
|
...styles?.bar
|
|
2651
2891
|
}
|
|
@@ -2656,7 +2896,7 @@ function Progress({
|
|
|
2656
2896
|
}
|
|
2657
2897
|
function Switch({
|
|
2658
2898
|
color = "violet",
|
|
2659
|
-
size
|
|
2899
|
+
size,
|
|
2660
2900
|
children,
|
|
2661
2901
|
className,
|
|
2662
2902
|
style,
|
|
@@ -2664,20 +2904,30 @@ function Switch({
|
|
|
2664
2904
|
styles,
|
|
2665
2905
|
...props
|
|
2666
2906
|
}) {
|
|
2667
|
-
|
|
2907
|
+
const theme = useTheme();
|
|
2908
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
2909
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.SwitchField, { ...props }, /* @__PURE__ */ React13__namespace.createElement(
|
|
2668
2910
|
reactAriaComponents.SwitchButton,
|
|
2669
2911
|
{
|
|
2670
2912
|
className: cn(className, "prt-switch-group", classNames?.wrapper),
|
|
2671
2913
|
style: { ...style, ...styles?.wrapper }
|
|
2672
2914
|
},
|
|
2673
|
-
/* @__PURE__ */
|
|
2915
|
+
({ isSelected }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
|
|
2674
2916
|
"span",
|
|
2675
2917
|
{
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2918
|
+
"data-color": color,
|
|
2919
|
+
"data-size": resolvedSize,
|
|
2920
|
+
"data-variant": isSelected ? "solid" : void 0,
|
|
2921
|
+
className: "prt-switch track"
|
|
2922
|
+
},
|
|
2923
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2924
|
+
"span",
|
|
2925
|
+
{
|
|
2926
|
+
className: cn("prt-switch-thumb", classNames?.thumb),
|
|
2927
|
+
style: { ...styles?.thumb }
|
|
2928
|
+
}
|
|
2929
|
+
)
|
|
2930
|
+
), children)
|
|
2681
2931
|
));
|
|
2682
2932
|
}
|
|
2683
2933
|
function Slider({
|
|
@@ -2686,48 +2936,54 @@ function Slider({
|
|
|
2686
2936
|
style,
|
|
2687
2937
|
styles,
|
|
2688
2938
|
name,
|
|
2689
|
-
size
|
|
2939
|
+
size,
|
|
2690
2940
|
color,
|
|
2691
2941
|
label,
|
|
2692
2942
|
orientation = "horizontal",
|
|
2693
2943
|
...props
|
|
2694
2944
|
}) {
|
|
2695
|
-
|
|
2945
|
+
const theme = useTheme();
|
|
2946
|
+
const resolvedSize = size ?? theme?.size ?? "sm";
|
|
2947
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2696
2948
|
reactAriaComponents.Slider,
|
|
2697
2949
|
{
|
|
2698
2950
|
...props,
|
|
2699
2951
|
orientation,
|
|
2700
2952
|
"aria-label": typeof label === "string" ? label : props["aria-label"] ?? "slider",
|
|
2701
2953
|
"data-color": color,
|
|
2702
|
-
"data-size":
|
|
2954
|
+
"data-size": resolvedSize,
|
|
2703
2955
|
style: { ...style, ...styles?.wrapper },
|
|
2704
2956
|
className: cn("prt-slider", orientation, className, classNames?.wrapper)
|
|
2705
2957
|
},
|
|
2706
|
-
label && /* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2958
|
+
label && /* @__PURE__ */ React13__namespace.createElement(InputLabel, { style: styles?.label, className: classNames?.label }, label),
|
|
2959
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2708
2960
|
reactAriaComponents.SliderTrack,
|
|
2709
2961
|
{
|
|
2710
2962
|
className: cn("prt-slider-track", classNames?.track),
|
|
2711
2963
|
style: styles?.track
|
|
2712
2964
|
},
|
|
2713
|
-
({ state }) => /* @__PURE__ */
|
|
2965
|
+
({ state }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, /* @__PURE__ */ React13__namespace.createElement(
|
|
2714
2966
|
"div",
|
|
2715
2967
|
{
|
|
2968
|
+
"data-variant": "solid",
|
|
2969
|
+
"data-interactive": "false",
|
|
2716
2970
|
style: {
|
|
2717
2971
|
...styles?.fill,
|
|
2718
2972
|
width: `${state.getThumbPercent(0) * 100}%`
|
|
2719
2973
|
},
|
|
2720
2974
|
className: cn("prt-slider-track-fill", classNames?.fill)
|
|
2721
2975
|
}
|
|
2722
|
-
), /* @__PURE__ */
|
|
2976
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
2723
2977
|
reactAriaComponents.SliderThumb,
|
|
2724
2978
|
{
|
|
2725
2979
|
index: 0,
|
|
2726
2980
|
name,
|
|
2981
|
+
"data-variant": "solid",
|
|
2982
|
+
"data-interactive": "false",
|
|
2727
2983
|
className: cn("prt-slider-thumb", classNames?.thumb),
|
|
2728
2984
|
style: styles?.thumb
|
|
2729
2985
|
},
|
|
2730
|
-
/* @__PURE__ */
|
|
2986
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2731
2987
|
"div",
|
|
2732
2988
|
{
|
|
2733
2989
|
style: styles?.innerThumb,
|
|
@@ -2750,7 +3006,7 @@ function Sticker({
|
|
|
2750
3006
|
...props
|
|
2751
3007
|
}) {
|
|
2752
3008
|
const theme = useTheme();
|
|
2753
|
-
return /* @__PURE__ */
|
|
3009
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
2754
3010
|
"div",
|
|
2755
3011
|
{
|
|
2756
3012
|
ref,
|
|
@@ -2777,11 +3033,11 @@ function Tabs({
|
|
|
2777
3033
|
...props
|
|
2778
3034
|
}) {
|
|
2779
3035
|
const theme = useTheme();
|
|
2780
|
-
const tabListRef =
|
|
2781
|
-
const [indicator, setIndicator] =
|
|
3036
|
+
const tabListRef = React13__namespace.useRef(null);
|
|
3037
|
+
const [indicator, setIndicator] = React13__namespace.useState({ width: 0, left: 0 });
|
|
2782
3038
|
const tabs = [];
|
|
2783
|
-
|
|
2784
|
-
if (
|
|
3039
|
+
React13__namespace.Children.forEach(children, (child, index) => {
|
|
3040
|
+
if (React13__namespace.isValidElement(child)) {
|
|
2785
3041
|
tabs.push({
|
|
2786
3042
|
id: child.props.id ?? child.key ?? index,
|
|
2787
3043
|
title: child.props.title,
|
|
@@ -2790,13 +3046,13 @@ function Tabs({
|
|
|
2790
3046
|
});
|
|
2791
3047
|
}
|
|
2792
3048
|
});
|
|
2793
|
-
const [activeKey, setActiveKey] =
|
|
3049
|
+
const [activeKey, setActiveKey] = React13__namespace.useState(
|
|
2794
3050
|
props.selectedKey ?? props.defaultSelectedKey ?? tabs[0]?.id
|
|
2795
3051
|
);
|
|
2796
|
-
|
|
3052
|
+
React13__namespace.useEffect(() => {
|
|
2797
3053
|
if (props.selectedKey != null) setActiveKey(props.selectedKey);
|
|
2798
3054
|
}, [props.selectedKey]);
|
|
2799
|
-
|
|
3055
|
+
React13__namespace.useEffect(() => {
|
|
2800
3056
|
const list = tabListRef.current;
|
|
2801
3057
|
const selected = list?.querySelector(
|
|
2802
3058
|
".prt-tab[data-selected]"
|
|
@@ -2807,7 +3063,7 @@ function Tabs({
|
|
|
2807
3063
|
setIndicator({ width: sb.width, left: sb.left - lb.left });
|
|
2808
3064
|
}
|
|
2809
3065
|
}, [activeKey, tabs.length]);
|
|
2810
|
-
return /* @__PURE__ */
|
|
3066
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2811
3067
|
reactAriaComponents.Tabs,
|
|
2812
3068
|
{
|
|
2813
3069
|
...props,
|
|
@@ -2819,7 +3075,7 @@ function Tabs({
|
|
|
2819
3075
|
className: cn("prt-tabs", className, classNames?.wrapper),
|
|
2820
3076
|
style: { position: "relative", ...style, ...styles?.wrapper }
|
|
2821
3077
|
},
|
|
2822
|
-
/* @__PURE__ */
|
|
3078
|
+
/* @__PURE__ */ React13__namespace.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React13__namespace.createElement(
|
|
2823
3079
|
reactAriaComponents.TabList,
|
|
2824
3080
|
{
|
|
2825
3081
|
ref: tabListRef,
|
|
@@ -2827,7 +3083,7 @@ function Tabs({
|
|
|
2827
3083
|
style: { ...styles?.list },
|
|
2828
3084
|
items: tabs
|
|
2829
3085
|
},
|
|
2830
|
-
(tab) => /* @__PURE__ */
|
|
3086
|
+
(tab) => /* @__PURE__ */ React13__namespace.createElement(
|
|
2831
3087
|
reactAriaComponents.Tab,
|
|
2832
3088
|
{
|
|
2833
3089
|
id: tab.id,
|
|
@@ -2837,7 +3093,7 @@ function Tabs({
|
|
|
2837
3093
|
},
|
|
2838
3094
|
tab.title
|
|
2839
3095
|
)
|
|
2840
|
-
), /* @__PURE__ */
|
|
3096
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
2841
3097
|
"div",
|
|
2842
3098
|
{
|
|
2843
3099
|
className: cn("indicator", classNames?.indicator),
|
|
@@ -2854,7 +3110,7 @@ function Tabs({
|
|
|
2854
3110
|
}
|
|
2855
3111
|
}
|
|
2856
3112
|
)),
|
|
2857
|
-
tabs.map((tab) => /* @__PURE__ */
|
|
3113
|
+
tabs.map((tab) => /* @__PURE__ */ React13__namespace.createElement(
|
|
2858
3114
|
reactAriaComponents.TabPanel,
|
|
2859
3115
|
{
|
|
2860
3116
|
key: String(tab.id),
|
|
@@ -2877,6 +3133,7 @@ function Table({
|
|
|
2877
3133
|
selectionMode = "none",
|
|
2878
3134
|
selectedKeys,
|
|
2879
3135
|
onSelectionChange,
|
|
3136
|
+
onRowAction,
|
|
2880
3137
|
sortDescriptor,
|
|
2881
3138
|
onSortChange,
|
|
2882
3139
|
renderEmptyState,
|
|
@@ -2887,14 +3144,13 @@ function Table({
|
|
|
2887
3144
|
styles,
|
|
2888
3145
|
...props
|
|
2889
3146
|
}) {
|
|
2890
|
-
const racColumns =
|
|
3147
|
+
const racColumns = React13__namespace.useMemo(
|
|
2891
3148
|
() => columns.map((column) => ({ ...column, id: column.key })),
|
|
2892
3149
|
[columns]
|
|
2893
3150
|
);
|
|
2894
|
-
const
|
|
2895
|
-
const [internalSort, setInternalSort] = React36__namespace.useState();
|
|
3151
|
+
const [internalSort, setInternalSort] = React13__namespace.useState();
|
|
2896
3152
|
const activeSort = onSortChange ? sortDescriptor : internalSort;
|
|
2897
|
-
const rows =
|
|
3153
|
+
const rows = React13__namespace.useMemo(() => {
|
|
2898
3154
|
if (onSortChange || !activeSort) return data;
|
|
2899
3155
|
const column = columns.find((c) => c.key === activeSort.column);
|
|
2900
3156
|
if (!column) return data;
|
|
@@ -2905,63 +3161,94 @@ function Table({
|
|
|
2905
3161
|
return activeSort.direction === "descending" ? -cmp : cmp;
|
|
2906
3162
|
});
|
|
2907
3163
|
}, [data, columns, activeSort, onSortChange]);
|
|
2908
|
-
return /* @__PURE__ */
|
|
3164
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
2909
3165
|
reactAriaComponents.Table,
|
|
2910
3166
|
{
|
|
2911
3167
|
...props,
|
|
2912
3168
|
selectionMode,
|
|
2913
3169
|
selectedKeys,
|
|
2914
3170
|
onSelectionChange,
|
|
3171
|
+
onRowAction: onRowAction ? (key) => onRowAction(key) : void 0,
|
|
2915
3172
|
sortDescriptor: activeSort,
|
|
2916
3173
|
onSortChange: onSortChange ?? setInternalSort,
|
|
2917
3174
|
"data-radius": radius,
|
|
2918
3175
|
className: cn("prt-table", className, classNames?.wrapper),
|
|
2919
3176
|
style: { ...style, ...styles?.wrapper }
|
|
2920
3177
|
},
|
|
2921
|
-
/* @__PURE__ */
|
|
2922
|
-
|
|
3178
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3179
|
+
TableHead,
|
|
2923
3180
|
{
|
|
2924
|
-
columns
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
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
|
-
)
|
|
3181
|
+
columns,
|
|
3182
|
+
racColumns,
|
|
3183
|
+
classNames,
|
|
3184
|
+
styles
|
|
3185
|
+
}
|
|
2937
3186
|
),
|
|
2938
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
2939
3188
|
reactAriaComponents.TableBody,
|
|
2940
3189
|
{
|
|
2941
3190
|
items: rows,
|
|
2942
3191
|
dependencies: [columns],
|
|
2943
|
-
renderEmptyState: renderEmptyState ? () => /* @__PURE__ */
|
|
3192
|
+
renderEmptyState: renderEmptyState ? () => /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-table-empty" }, renderEmptyState()) : void 0
|
|
2944
3193
|
},
|
|
2945
|
-
(item) => /* @__PURE__ */
|
|
2946
|
-
|
|
3194
|
+
(item) => /* @__PURE__ */ React13__namespace.createElement(
|
|
3195
|
+
TableBodyRow,
|
|
2947
3196
|
{
|
|
3197
|
+
item,
|
|
2948
3198
|
id: getRowId(item),
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
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
|
-
)
|
|
3199
|
+
racColumns,
|
|
3200
|
+
classNames,
|
|
3201
|
+
styles
|
|
3202
|
+
}
|
|
2961
3203
|
)
|
|
2962
3204
|
)
|
|
2963
3205
|
);
|
|
2964
3206
|
}
|
|
3207
|
+
function TableHead({
|
|
3208
|
+
columns,
|
|
3209
|
+
racColumns,
|
|
3210
|
+
classNames,
|
|
3211
|
+
styles
|
|
3212
|
+
}) {
|
|
3213
|
+
const { selectionBehavior, selectionMode } = reactAriaComponents.useTableOptions();
|
|
3214
|
+
const firstColumnKey = columns[0]?.key;
|
|
3215
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.TableHeader, { className: cn("prt-table-header", classNames?.header) }, selectionBehavior === "toggle" && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Column, { className: "prt-table-column prt-table-selection" }, selectionMode === "multiple" ? /* @__PURE__ */ React13__namespace.createElement(Checkbox, { slot: "selection", size: "sm" }) : null), /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Collection, { items: racColumns }, (column) => /* @__PURE__ */ React13__namespace.createElement(
|
|
3216
|
+
reactAriaComponents.Column,
|
|
3217
|
+
{
|
|
3218
|
+
isRowHeader: column.key === firstColumnKey,
|
|
3219
|
+
allowsSorting: column.allowSorting,
|
|
3220
|
+
className: cn("prt-table-column", classNames?.column),
|
|
3221
|
+
style: styles?.column
|
|
3222
|
+
},
|
|
3223
|
+
({ allowsSorting, sortDirection }) => /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-table-column-header" }, /* @__PURE__ */ React13__namespace.createElement("span", null, column.title), allowsSorting && sortDirection && /* @__PURE__ */ React13__namespace.createElement("span", { "aria-hidden": "true", className: "prt-table-sort-indicator" }, sortDirection === "ascending" ? /* @__PURE__ */ React13__namespace.createElement(HiChevronUp, { size: 14 }) : /* @__PURE__ */ React13__namespace.createElement(HiChevronDown, { size: 14 })))
|
|
3224
|
+
)));
|
|
3225
|
+
}
|
|
3226
|
+
function TableBodyRow({
|
|
3227
|
+
item,
|
|
3228
|
+
id: id2,
|
|
3229
|
+
racColumns,
|
|
3230
|
+
classNames,
|
|
3231
|
+
styles
|
|
3232
|
+
}) {
|
|
3233
|
+
const { selectionBehavior } = reactAriaComponents.useTableOptions();
|
|
3234
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3235
|
+
reactAriaComponents.Row,
|
|
3236
|
+
{
|
|
3237
|
+
id: id2,
|
|
3238
|
+
className: cn("prt-table-row", classNames?.row),
|
|
3239
|
+
style: styles?.row
|
|
3240
|
+
},
|
|
3241
|
+
selectionBehavior === "toggle" && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Cell, { className: "prt-table-cell prt-table-selection" }, /* @__PURE__ */ React13__namespace.createElement(Checkbox, { slot: "selection", size: "sm" })),
|
|
3242
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Collection, { items: racColumns }, (column) => /* @__PURE__ */ React13__namespace.createElement(
|
|
3243
|
+
reactAriaComponents.Cell,
|
|
3244
|
+
{
|
|
3245
|
+
className: cn("prt-table-cell", classNames?.cell),
|
|
3246
|
+
style: styles?.cell
|
|
3247
|
+
},
|
|
3248
|
+
column.render ? column.render(item[column.dataIndex], item) : item[column.dataIndex]
|
|
3249
|
+
))
|
|
3250
|
+
);
|
|
3251
|
+
}
|
|
2965
3252
|
function Timeline({
|
|
2966
3253
|
items,
|
|
2967
3254
|
render,
|
|
@@ -2973,25 +3260,25 @@ function Timeline({
|
|
|
2973
3260
|
className,
|
|
2974
3261
|
style
|
|
2975
3262
|
}) {
|
|
2976
|
-
return /* @__PURE__ */
|
|
3263
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
2977
3264
|
"div",
|
|
2978
3265
|
{
|
|
2979
3266
|
className: cn(classNames?.wrapper, className),
|
|
2980
3267
|
style: { ...styles?.wrapper, ...style }
|
|
2981
3268
|
},
|
|
2982
3269
|
items.map((item, index) => {
|
|
2983
|
-
const indicator = getIndicator?.(item) ?? /* @__PURE__ */
|
|
3270
|
+
const indicator = getIndicator?.(item) ?? /* @__PURE__ */ React13__namespace.default.createElement("div", { className: "prt-timeline-indicator", "data-variant": "outline" });
|
|
2984
3271
|
const content = render?.(item) ?? item[labelKey];
|
|
2985
3272
|
const isLast = index === items.length - 1;
|
|
2986
|
-
return /* @__PURE__ */
|
|
3273
|
+
return /* @__PURE__ */ React13__namespace.default.createElement(
|
|
2987
3274
|
"div",
|
|
2988
3275
|
{
|
|
2989
3276
|
className: cn("flex gap-3 prt-timeline-item", classNames?.item),
|
|
2990
3277
|
style: { ...styles?.item },
|
|
2991
3278
|
key: index
|
|
2992
3279
|
},
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3280
|
+
/* @__PURE__ */ React13__namespace.default.createElement("div", { className: "flex flex-col items-center gap-3" }, /* @__PURE__ */ React13__namespace.default.createElement("div", { className: "flex gap-3 prt-timeline-indicator-container" }, indicator), isLast && hideLastItemTail ? null : /* @__PURE__ */ React13__namespace.default.createElement("div", { className: "prt-timeline-item-tail" })),
|
|
3281
|
+
/* @__PURE__ */ React13__namespace.default.createElement(
|
|
2995
3282
|
"div",
|
|
2996
3283
|
{
|
|
2997
3284
|
className: cn(
|
|
@@ -3030,7 +3317,7 @@ function Modal({
|
|
|
3030
3317
|
...props
|
|
3031
3318
|
}) {
|
|
3032
3319
|
const theme = useTheme();
|
|
3033
|
-
return /* @__PURE__ */
|
|
3320
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3034
3321
|
reactAriaComponents.ModalOverlay,
|
|
3035
3322
|
{
|
|
3036
3323
|
...props,
|
|
@@ -3038,14 +3325,14 @@ function Modal({
|
|
|
3038
3325
|
style: styles?.underlay,
|
|
3039
3326
|
className: cn("prt-modal-underlay", classNames?.underlay)
|
|
3040
3327
|
},
|
|
3041
|
-
/* @__PURE__ */
|
|
3328
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3042
3329
|
reactAriaComponents.Modal,
|
|
3043
3330
|
{
|
|
3044
|
-
"data-
|
|
3331
|
+
"data-layout": variant,
|
|
3045
3332
|
style: styles?.wrapper,
|
|
3046
3333
|
className: cn("prt-modal-container", classNames?.wrapper)
|
|
3047
3334
|
},
|
|
3048
|
-
/* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3049
3336
|
reactAriaComponents.Dialog,
|
|
3050
3337
|
{
|
|
3051
3338
|
"aria-label": typeof title === "string" ? title : void 0,
|
|
@@ -3053,7 +3340,7 @@ function Modal({
|
|
|
3053
3340
|
className: cn("prt-modal-content", className, classNames?.content),
|
|
3054
3341
|
style: { width, ...style, ...styles?.content }
|
|
3055
3342
|
},
|
|
3056
|
-
({ close }) => /* @__PURE__ */
|
|
3343
|
+
({ close }) => /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, !hideTitle && /* @__PURE__ */ React13__namespace.createElement(
|
|
3057
3344
|
"header",
|
|
3058
3345
|
{
|
|
3059
3346
|
style: styles?.header,
|
|
@@ -3062,7 +3349,7 @@ function Modal({
|
|
|
3062
3349
|
classNames?.header
|
|
3063
3350
|
)
|
|
3064
3351
|
},
|
|
3065
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-1" }, title && /* @__PURE__ */ React13__namespace.createElement(
|
|
3066
3353
|
"div",
|
|
3067
3354
|
{
|
|
3068
3355
|
style: styles?.title,
|
|
@@ -3072,8 +3359,8 @@ function Modal({
|
|
|
3072
3359
|
)
|
|
3073
3360
|
},
|
|
3074
3361
|
title
|
|
3075
|
-
), description && /* @__PURE__ */
|
|
3076
|
-
showCloseButton && /* @__PURE__ */
|
|
3362
|
+
), description && /* @__PURE__ */ React13__namespace.createElement("div", { className: "text-xs leading-normal text-gray-500" }, description)),
|
|
3363
|
+
showCloseButton && /* @__PURE__ */ React13__namespace.createElement(
|
|
3077
3364
|
IconButton,
|
|
3078
3365
|
{
|
|
3079
3366
|
variant: "ghost",
|
|
@@ -3084,9 +3371,9 @@ function Modal({
|
|
|
3084
3371
|
close();
|
|
3085
3372
|
}
|
|
3086
3373
|
},
|
|
3087
|
-
/* @__PURE__ */
|
|
3374
|
+
/* @__PURE__ */ React13__namespace.createElement(HiX, { size: 18 })
|
|
3088
3375
|
)
|
|
3089
|
-
), /* @__PURE__ */
|
|
3376
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
3090
3377
|
"div",
|
|
3091
3378
|
{
|
|
3092
3379
|
className: cn(
|
|
@@ -3096,7 +3383,7 @@ function Modal({
|
|
|
3096
3383
|
style: styles?.body
|
|
3097
3384
|
},
|
|
3098
3385
|
children
|
|
3099
|
-
), (onConfirm || onCancel) && /* @__PURE__ */
|
|
3386
|
+
), (onConfirm || onCancel) && /* @__PURE__ */ React13__namespace.createElement(
|
|
3100
3387
|
"footer",
|
|
3101
3388
|
{
|
|
3102
3389
|
style: styles?.footer,
|
|
@@ -3105,7 +3392,7 @@ function Modal({
|
|
|
3105
3392
|
classNames?.footer
|
|
3106
3393
|
)
|
|
3107
3394
|
},
|
|
3108
|
-
onCancel && /* @__PURE__ */
|
|
3395
|
+
onCancel && /* @__PURE__ */ React13__namespace.createElement(
|
|
3109
3396
|
Button,
|
|
3110
3397
|
{
|
|
3111
3398
|
onPress: () => {
|
|
@@ -3118,7 +3405,7 @@ function Modal({
|
|
|
3118
3405
|
},
|
|
3119
3406
|
cancelLabel
|
|
3120
3407
|
),
|
|
3121
|
-
onConfirm && /* @__PURE__ */
|
|
3408
|
+
onConfirm && /* @__PURE__ */ React13__namespace.createElement(Button, { onPress: onConfirm, ...confirmButtonProps }, confirmLabel)
|
|
3122
3409
|
))
|
|
3123
3410
|
)
|
|
3124
3411
|
)
|
|
@@ -3127,14 +3414,89 @@ function Modal({
|
|
|
3127
3414
|
function useModal(props = {}) {
|
|
3128
3415
|
return reactStately.useOverlayTriggerState(props);
|
|
3129
3416
|
}
|
|
3417
|
+
var ModalContext = React13__namespace.createContext(null);
|
|
3418
|
+
var counter = 0;
|
|
3419
|
+
function uid() {
|
|
3420
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
3421
|
+
return crypto.randomUUID();
|
|
3422
|
+
}
|
|
3423
|
+
return `prt-modal-${++counter}`;
|
|
3424
|
+
}
|
|
3425
|
+
function ModalProvider({ registry, children }) {
|
|
3426
|
+
const registryRef = React13__namespace.useRef(registry);
|
|
3427
|
+
registryRef.current = registry;
|
|
3428
|
+
const [stack, setStack] = React13__namespace.useState([]);
|
|
3429
|
+
const stackRef = React13__namespace.useRef(stack);
|
|
3430
|
+
stackRef.current = stack;
|
|
3431
|
+
const closeById = React13__namespace.useCallback((id2, result) => {
|
|
3432
|
+
setStack((prev) => {
|
|
3433
|
+
prev.find((m) => m.id === id2)?.resolve(result);
|
|
3434
|
+
return prev.filter((m) => m.id !== id2);
|
|
3435
|
+
});
|
|
3436
|
+
}, []);
|
|
3437
|
+
const controls = React13__namespace.useMemo(
|
|
3438
|
+
() => ({
|
|
3439
|
+
open: (key, props) => new Promise((resolve) => {
|
|
3440
|
+
setStack((prev) => [
|
|
3441
|
+
...prev,
|
|
3442
|
+
{
|
|
3443
|
+
id: uid(),
|
|
3444
|
+
key,
|
|
3445
|
+
props: props ?? {},
|
|
3446
|
+
resolve
|
|
3447
|
+
}
|
|
3448
|
+
]);
|
|
3449
|
+
}),
|
|
3450
|
+
close: (key) => {
|
|
3451
|
+
setStack((prev) => {
|
|
3452
|
+
for (const m of prev) if (m.key === key) m.resolve(void 0);
|
|
3453
|
+
return prev.filter((m) => m.key !== key);
|
|
3454
|
+
});
|
|
3455
|
+
},
|
|
3456
|
+
update: (key, props) => {
|
|
3457
|
+
setStack(
|
|
3458
|
+
(prev) => prev.map(
|
|
3459
|
+
(m) => m.key === key ? { ...m, props: { ...m.props, ...props } } : m
|
|
3460
|
+
)
|
|
3461
|
+
);
|
|
3462
|
+
},
|
|
3463
|
+
isOpen: (key) => stackRef.current.some((m) => m.key === key)
|
|
3464
|
+
}),
|
|
3465
|
+
[]
|
|
3466
|
+
);
|
|
3467
|
+
return /* @__PURE__ */ React13__namespace.createElement(ModalContext.Provider, { value: controls }, children, stack.map((instance) => {
|
|
3468
|
+
const def = registryRef.current[instance.key];
|
|
3469
|
+
if (!def) return null;
|
|
3470
|
+
const Component = def.component;
|
|
3471
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3472
|
+
Component,
|
|
3473
|
+
{
|
|
3474
|
+
key: instance.id,
|
|
3475
|
+
...instance.props,
|
|
3476
|
+
isOpen: true,
|
|
3477
|
+
onOpenChange: (open) => {
|
|
3478
|
+
if (!open) closeById(instance.id, void 0);
|
|
3479
|
+
},
|
|
3480
|
+
onResolve: (result) => closeById(instance.id, result)
|
|
3481
|
+
}
|
|
3482
|
+
);
|
|
3483
|
+
}));
|
|
3484
|
+
}
|
|
3485
|
+
function useModals() {
|
|
3486
|
+
const ctx = React13__namespace.useContext(ModalContext);
|
|
3487
|
+
if (!ctx) {
|
|
3488
|
+
throw new Error("useModals must be used within <ModalProvider>");
|
|
3489
|
+
}
|
|
3490
|
+
return ctx;
|
|
3491
|
+
}
|
|
3130
3492
|
|
|
3131
3493
|
// src/utils/regex.ts
|
|
3132
3494
|
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
3495
|
function useControlledState(value, defaultValue, onChange) {
|
|
3134
|
-
const [state, setState] =
|
|
3496
|
+
const [state, setState] = React13__namespace.useState(value || defaultValue);
|
|
3135
3497
|
const isControlled = !isUndefinedOrNull(value);
|
|
3136
3498
|
const controlledValue = isControlled ? value : state;
|
|
3137
|
-
const setValue =
|
|
3499
|
+
const setValue = React13__namespace.useCallback(
|
|
3138
3500
|
(value2) => {
|
|
3139
3501
|
if (!isControlled) {
|
|
3140
3502
|
setState(value2);
|
|
@@ -3178,7 +3540,7 @@ function escapeRegExp(value) {
|
|
|
3178
3540
|
}
|
|
3179
3541
|
function TagInput({
|
|
3180
3542
|
appearance = "outline",
|
|
3181
|
-
size
|
|
3543
|
+
size,
|
|
3182
3544
|
label,
|
|
3183
3545
|
error,
|
|
3184
3546
|
description,
|
|
@@ -3205,15 +3567,17 @@ function TagInput({
|
|
|
3205
3567
|
renderTag,
|
|
3206
3568
|
ref
|
|
3207
3569
|
}) {
|
|
3208
|
-
const
|
|
3570
|
+
const theme = useTheme();
|
|
3571
|
+
const resolvedSize = size ?? theme?.size ?? "md";
|
|
3572
|
+
const [inputValue, setInputValue] = React13__namespace.useState("");
|
|
3209
3573
|
const [values, setValues] = useControlledState(
|
|
3210
3574
|
dedupe(tags),
|
|
3211
3575
|
dedupe(defaultTags) ?? [],
|
|
3212
3576
|
onChange
|
|
3213
3577
|
);
|
|
3214
|
-
const inputRef =
|
|
3578
|
+
const inputRef = React13__namespace.useRef(null);
|
|
3215
3579
|
const isValid = validate ?? FORMAT_VALIDATORS[format];
|
|
3216
|
-
const splitPattern =
|
|
3580
|
+
const splitPattern = React13__namespace.useMemo(
|
|
3217
3581
|
() => new RegExp(`[${delimiters.map(escapeRegExp).join("")}\\n]`),
|
|
3218
3582
|
[delimiters]
|
|
3219
3583
|
);
|
|
@@ -3252,7 +3616,7 @@ function TagInput({
|
|
|
3252
3616
|
inputRef.current?.focus();
|
|
3253
3617
|
}
|
|
3254
3618
|
const groupLabel = typeof label === "string" ? label : "tags";
|
|
3255
|
-
return /* @__PURE__ */
|
|
3619
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3256
3620
|
reactAriaComponents.TextField,
|
|
3257
3621
|
{
|
|
3258
3622
|
value: inputValue,
|
|
@@ -3260,7 +3624,7 @@ function TagInput({
|
|
|
3260
3624
|
isRequired,
|
|
3261
3625
|
isInvalid: !!error
|
|
3262
3626
|
},
|
|
3263
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3264
3628
|
Field,
|
|
3265
3629
|
{
|
|
3266
3630
|
replaceDefaultControlWrapper: true,
|
|
@@ -3268,7 +3632,7 @@ function TagInput({
|
|
|
3268
3632
|
error,
|
|
3269
3633
|
description,
|
|
3270
3634
|
color,
|
|
3271
|
-
size,
|
|
3635
|
+
size: resolvedSize,
|
|
3272
3636
|
radius,
|
|
3273
3637
|
appearance,
|
|
3274
3638
|
validationStatus,
|
|
@@ -3277,7 +3641,7 @@ function TagInput({
|
|
|
3277
3641
|
style,
|
|
3278
3642
|
styles
|
|
3279
3643
|
},
|
|
3280
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3281
3645
|
"div",
|
|
3282
3646
|
{
|
|
3283
3647
|
ref,
|
|
@@ -3285,14 +3649,14 @@ function TagInput({
|
|
|
3285
3649
|
"data-appearance": appearance,
|
|
3286
3650
|
onClick: captureFocus
|
|
3287
3651
|
},
|
|
3288
|
-
/* @__PURE__ */
|
|
3652
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3289
3653
|
reactAriaComponents.TagGroup,
|
|
3290
3654
|
{
|
|
3291
3655
|
"aria-label": groupLabel,
|
|
3292
3656
|
className: "prt-tag-field-group",
|
|
3293
3657
|
onRemove: (keys) => setValues(values.filter((v) => !keys.has(v)))
|
|
3294
3658
|
},
|
|
3295
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.TagList, { className: "prt-tag-field-list" }, values.map((value) => /* @__PURE__ */ React13__namespace.createElement(
|
|
3296
3660
|
reactAriaComponents.Tag,
|
|
3297
3661
|
{
|
|
3298
3662
|
key: value,
|
|
@@ -3300,28 +3664,28 @@ function TagInput({
|
|
|
3300
3664
|
textValue: value,
|
|
3301
3665
|
className: "prt-tag-field-tag"
|
|
3302
3666
|
},
|
|
3303
|
-
renderTag ? renderTag(value, removeValue) : /* @__PURE__ */
|
|
3667
|
+
renderTag ? renderTag(value, removeValue) : /* @__PURE__ */ React13__namespace.createElement(
|
|
3304
3668
|
Tag,
|
|
3305
3669
|
{
|
|
3306
3670
|
variant: tagVariant,
|
|
3307
3671
|
color: tagColor,
|
|
3308
3672
|
radius: tagShape ? SHAPE_RADIUS[tagShape] : "full",
|
|
3309
3673
|
size: tagSize,
|
|
3310
|
-
append: /* @__PURE__ */
|
|
3674
|
+
append: /* @__PURE__ */ React13__namespace.createElement(
|
|
3311
3675
|
reactAriaComponents.Button,
|
|
3312
3676
|
{
|
|
3313
3677
|
slot: "remove",
|
|
3314
3678
|
className: "prt-tag-field-remove",
|
|
3315
3679
|
"aria-label": `Remove ${value}`
|
|
3316
3680
|
},
|
|
3317
|
-
/* @__PURE__ */
|
|
3681
|
+
/* @__PURE__ */ React13__namespace.createElement(HiX, { size: 14 })
|
|
3318
3682
|
)
|
|
3319
3683
|
},
|
|
3320
3684
|
value
|
|
3321
3685
|
)
|
|
3322
3686
|
)))
|
|
3323
3687
|
),
|
|
3324
|
-
/* @__PURE__ */
|
|
3688
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3325
3689
|
reactAriaComponents.Input,
|
|
3326
3690
|
{
|
|
3327
3691
|
ref: inputRef,
|
|
@@ -3334,22 +3698,22 @@ function TagInput({
|
|
|
3334
3698
|
)
|
|
3335
3699
|
);
|
|
3336
3700
|
}
|
|
3337
|
-
var PopoverContext =
|
|
3701
|
+
var PopoverContext = React13__namespace.createContext(null);
|
|
3338
3702
|
function usePopoverContext(component) {
|
|
3339
|
-
const ctx =
|
|
3703
|
+
const ctx = React13__namespace.useContext(PopoverContext);
|
|
3340
3704
|
if (!ctx) {
|
|
3341
3705
|
throw new Error(`${component} must be used within a Popover`);
|
|
3342
3706
|
}
|
|
3343
3707
|
return ctx;
|
|
3344
3708
|
}
|
|
3345
3709
|
function Popover({ children, ...props }) {
|
|
3346
|
-
const triggerRef =
|
|
3710
|
+
const triggerRef = React13__namespace.useRef(null);
|
|
3347
3711
|
const state = reactStately.useOverlayTriggerState(props);
|
|
3348
|
-
return /* @__PURE__ */
|
|
3712
|
+
return /* @__PURE__ */ React13__namespace.createElement(PopoverContext.Provider, { value: { triggerRef, state } }, children);
|
|
3349
3713
|
}
|
|
3350
3714
|
function PopoverTrigger({ children }) {
|
|
3351
3715
|
const ctx = usePopoverContext("PopoverTrigger");
|
|
3352
|
-
return
|
|
3716
|
+
return React13__namespace.cloneElement(children, {
|
|
3353
3717
|
ref: ctx.triggerRef,
|
|
3354
3718
|
onPress: () => ctx.state.toggle()
|
|
3355
3719
|
});
|
|
@@ -3367,7 +3731,7 @@ function PopoverContent({
|
|
|
3367
3731
|
}) {
|
|
3368
3732
|
const ctx = usePopoverContext("PopoverContent");
|
|
3369
3733
|
const theme = useTheme();
|
|
3370
|
-
return /* @__PURE__ */
|
|
3734
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3371
3735
|
reactAriaComponents.Popover,
|
|
3372
3736
|
{
|
|
3373
3737
|
...props,
|
|
@@ -3381,7 +3745,7 @@ function PopoverContent({
|
|
|
3381
3745
|
className: cn("prt-popover", classNames?.popover),
|
|
3382
3746
|
style: { ...width != null ? { width } : null, ...styles?.popover }
|
|
3383
3747
|
},
|
|
3384
|
-
/* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3385
3749
|
"div",
|
|
3386
3750
|
{
|
|
3387
3751
|
"data-radius": "md",
|
|
@@ -3392,7 +3756,7 @@ function PopoverContent({
|
|
|
3392
3756
|
)
|
|
3393
3757
|
);
|
|
3394
3758
|
}
|
|
3395
|
-
var TagGroupVariantContext =
|
|
3759
|
+
var TagGroupVariantContext = React13__namespace.createContext({});
|
|
3396
3760
|
function TagGroup({
|
|
3397
3761
|
label,
|
|
3398
3762
|
description,
|
|
@@ -3411,24 +3775,24 @@ function TagGroup({
|
|
|
3411
3775
|
style,
|
|
3412
3776
|
...props
|
|
3413
3777
|
}) {
|
|
3414
|
-
const variants =
|
|
3778
|
+
const variants = React13__namespace.useMemo(
|
|
3415
3779
|
() => ({ activeColor, activeVariant, idleColor, idleVariant, autoColor }),
|
|
3416
3780
|
[activeColor, activeVariant, idleColor, idleVariant, autoColor]
|
|
3417
3781
|
);
|
|
3418
|
-
return /* @__PURE__ */
|
|
3782
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3419
3783
|
reactAriaComponents.TagGroup,
|
|
3420
3784
|
{
|
|
3421
3785
|
...props,
|
|
3422
3786
|
"aria-label": typeof label === "string" ? label : void 0
|
|
3423
3787
|
},
|
|
3424
|
-
/* @__PURE__ */
|
|
3788
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3425
3789
|
"div",
|
|
3426
3790
|
{
|
|
3427
3791
|
className: cn("flex flex-col gap-3 tag-group", classNames?.wrapper, className),
|
|
3428
3792
|
style: { ...styles?.wrapper, ...style }
|
|
3429
3793
|
},
|
|
3430
|
-
label && /* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3794
|
+
label && /* @__PURE__ */ React13__namespace.createElement(InputLabel, null, label),
|
|
3795
|
+
/* @__PURE__ */ React13__namespace.createElement(TagGroupVariantContext.Provider, { value: variants }, /* @__PURE__ */ React13__namespace.createElement(
|
|
3432
3796
|
reactAriaComponents.TagList,
|
|
3433
3797
|
{
|
|
3434
3798
|
items,
|
|
@@ -3438,8 +3802,8 @@ function TagGroup({
|
|
|
3438
3802
|
},
|
|
3439
3803
|
children
|
|
3440
3804
|
)),
|
|
3441
|
-
errorMessage && /* @__PURE__ */
|
|
3442
|
-
description && /* @__PURE__ */
|
|
3805
|
+
errorMessage && /* @__PURE__ */ React13__namespace.createElement(InputError, null, errorMessage),
|
|
3806
|
+
description && /* @__PURE__ */ React13__namespace.createElement("div", { className: "text-sm text-gray-700" }, description)
|
|
3443
3807
|
)
|
|
3444
3808
|
);
|
|
3445
3809
|
}
|
|
@@ -3455,10 +3819,10 @@ function TagGroupItem({
|
|
|
3455
3819
|
idleColor = "gray",
|
|
3456
3820
|
idleVariant = "outline",
|
|
3457
3821
|
autoColor
|
|
3458
|
-
} =
|
|
3822
|
+
} = React13__namespace.useContext(TagGroupVariantContext);
|
|
3459
3823
|
const resolvedActive = activeColor ?? theme?.color ?? "gray";
|
|
3460
3824
|
const tv = textValue ?? (typeof children === "string" ? children : void 0);
|
|
3461
|
-
return /* @__PURE__ */
|
|
3825
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3462
3826
|
reactAriaComponents.Tag,
|
|
3463
3827
|
{
|
|
3464
3828
|
...props,
|
|
@@ -3466,7 +3830,7 @@ function TagGroupItem({
|
|
|
3466
3830
|
render: (domProps, { isSelected }) => {
|
|
3467
3831
|
const color = autoColor ? getRandomColor(String(tv ?? "")) : isSelected ? resolvedActive : idleColor;
|
|
3468
3832
|
const variant = isSelected ? activeVariant : idleVariant;
|
|
3469
|
-
return /* @__PURE__ */
|
|
3833
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3470
3834
|
"div",
|
|
3471
3835
|
{
|
|
3472
3836
|
...domProps,
|
|
@@ -3491,7 +3855,7 @@ function ColorPicker({
|
|
|
3491
3855
|
className,
|
|
3492
3856
|
style
|
|
3493
3857
|
}) {
|
|
3494
|
-
const [colorSpace, setColorSpace] =
|
|
3858
|
+
const [colorSpace, setColorSpace] = React13__namespace.useState("hex");
|
|
3495
3859
|
const [color, setColor] = useControlledState(
|
|
3496
3860
|
colorProp,
|
|
3497
3861
|
reactAriaComponents.parseColor("#BB66CC").toFormat("hsla"),
|
|
@@ -3511,13 +3875,13 @@ function ColorPicker({
|
|
|
3511
3875
|
const [h, s, l] = color.getColorChannels();
|
|
3512
3876
|
const rgbaColor = color.toFormat("rgba");
|
|
3513
3877
|
const [r, g, b] = rgbaColor.getColorChannels();
|
|
3514
|
-
return /* @__PURE__ */
|
|
3878
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3515
3879
|
"div",
|
|
3516
3880
|
{
|
|
3517
3881
|
className: cn("flex flex-col gap-3", className, classNames?.wrapper),
|
|
3518
3882
|
style: { width: 240, ...style, ...styles?.wrapper }
|
|
3519
3883
|
},
|
|
3520
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3521
3885
|
ColorArea,
|
|
3522
3886
|
{
|
|
3523
3887
|
onChange: handleChange,
|
|
@@ -3528,7 +3892,7 @@ function ColorPicker({
|
|
|
3528
3892
|
style: { width: "100%", height: 140 }
|
|
3529
3893
|
}
|
|
3530
3894
|
),
|
|
3531
|
-
/* @__PURE__ */
|
|
3895
|
+
/* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-3", style: { padding: 8 } }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-2" }, /* @__PURE__ */ React13__namespace.createElement(
|
|
3532
3896
|
ColorSlider,
|
|
3533
3897
|
{
|
|
3534
3898
|
value: color,
|
|
@@ -3536,7 +3900,7 @@ function ColorPicker({
|
|
|
3536
3900
|
onChangeEnd: handleChange,
|
|
3537
3901
|
channel: h
|
|
3538
3902
|
}
|
|
3539
|
-
), /* @__PURE__ */
|
|
3903
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
3540
3904
|
ColorSlider,
|
|
3541
3905
|
{
|
|
3542
3906
|
value: color,
|
|
@@ -3544,7 +3908,7 @@ function ColorPicker({
|
|
|
3544
3908
|
onChangeEnd: handleChange,
|
|
3545
3909
|
channel: "alpha"
|
|
3546
3910
|
}
|
|
3547
|
-
)), /* @__PURE__ */
|
|
3911
|
+
)), /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex gap-1", style: { width: "100%" } }, colorSpace === "hex" && /* @__PURE__ */ React13__namespace.createElement(Space, { style: { gap: 3 }, compact: true }, /* @__PURE__ */ React13__namespace.createElement(
|
|
3548
3912
|
ColorField,
|
|
3549
3913
|
{
|
|
3550
3914
|
value: color,
|
|
@@ -3554,7 +3918,7 @@ function ColorPicker({
|
|
|
3554
3918
|
appearance: "filled",
|
|
3555
3919
|
placeholder: "Add a color"
|
|
3556
3920
|
}
|
|
3557
|
-
), /* @__PURE__ */
|
|
3921
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
3558
3922
|
NumberInput,
|
|
3559
3923
|
{
|
|
3560
3924
|
onChange: (n) => setAlpha(n),
|
|
@@ -3568,28 +3932,28 @@ function ColorPicker({
|
|
|
3568
3932
|
style: { width: "40%" },
|
|
3569
3933
|
appearance: "filled"
|
|
3570
3934
|
}
|
|
3571
|
-
)), ["rgb", "hsl"].includes(colorSpace) && /* @__PURE__ */
|
|
3935
|
+
)), ["rgb", "hsl"].includes(colorSpace) && /* @__PURE__ */ React13__namespace.createElement(Space, { style: { gap: 3 }, compact: true }, /* @__PURE__ */ React13__namespace.createElement(
|
|
3572
3936
|
NumberInput,
|
|
3573
3937
|
{
|
|
3574
3938
|
value: colorSpace === "rgb" ? rgbaColor.getChannelValue(r) : color.getChannelValue(h),
|
|
3575
3939
|
appearance: "filled",
|
|
3576
3940
|
size: "sm"
|
|
3577
3941
|
}
|
|
3578
|
-
), /* @__PURE__ */
|
|
3942
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
3579
3943
|
NumberInput,
|
|
3580
3944
|
{
|
|
3581
3945
|
value: colorSpace === "rgb" ? rgbaColor.getChannelValue(g) : color.getChannelValue(s),
|
|
3582
3946
|
appearance: "filled",
|
|
3583
3947
|
size: "sm"
|
|
3584
3948
|
}
|
|
3585
|
-
), /* @__PURE__ */
|
|
3949
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
3586
3950
|
NumberInput,
|
|
3587
3951
|
{
|
|
3588
3952
|
value: colorSpace === "rgb" ? rgbaColor.getChannelValue(b) : color.getChannelValue(l),
|
|
3589
3953
|
appearance: "filled",
|
|
3590
3954
|
size: "sm"
|
|
3591
3955
|
}
|
|
3592
|
-
), /* @__PURE__ */
|
|
3956
|
+
), /* @__PURE__ */ React13__namespace.createElement(
|
|
3593
3957
|
NumberInput,
|
|
3594
3958
|
{
|
|
3595
3959
|
formatOptions: {
|
|
@@ -3600,12 +3964,12 @@ function ColorPicker({
|
|
|
3600
3964
|
appearance: "filled",
|
|
3601
3965
|
size: "sm"
|
|
3602
3966
|
}
|
|
3603
|
-
)), /* @__PURE__ */
|
|
3967
|
+
)), /* @__PURE__ */ React13__namespace.createElement(
|
|
3604
3968
|
Select,
|
|
3605
3969
|
{
|
|
3606
3970
|
style: { width: "60%" },
|
|
3607
3971
|
valueKey: "id",
|
|
3608
|
-
onChange: (v) => setColorSpace(v
|
|
3972
|
+
onChange: (v) => setColorSpace(v ?? colorSpace),
|
|
3609
3973
|
showSelectionIndicator: false,
|
|
3610
3974
|
value: colorSpace,
|
|
3611
3975
|
size: "sm",
|
|
@@ -3615,7 +3979,7 @@ function ColorPicker({
|
|
|
3615
3979
|
id: o
|
|
3616
3980
|
}))
|
|
3617
3981
|
}
|
|
3618
|
-
)), /* @__PURE__ */
|
|
3982
|
+
)), /* @__PURE__ */ React13__namespace.createElement(Separator, { color: "gray" }), /* @__PURE__ */ React13__namespace.createElement("div", { className: "flex gap-3" }, /* @__PURE__ */ React13__namespace.createElement(
|
|
3619
3983
|
ColorSwatchPicker,
|
|
3620
3984
|
{
|
|
3621
3985
|
styles: {
|
|
@@ -3668,7 +4032,7 @@ function ColorArea({
|
|
|
3668
4032
|
...props
|
|
3669
4033
|
}) {
|
|
3670
4034
|
const theme = useTheme();
|
|
3671
|
-
return /* @__PURE__ */
|
|
4035
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3672
4036
|
reactAriaComponents.ColorArea,
|
|
3673
4037
|
{
|
|
3674
4038
|
...props,
|
|
@@ -3680,7 +4044,7 @@ function ColorArea({
|
|
|
3680
4044
|
...style
|
|
3681
4045
|
})
|
|
3682
4046
|
},
|
|
3683
|
-
/* @__PURE__ */
|
|
4047
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3684
4048
|
reactAriaComponents.ColorThumb,
|
|
3685
4049
|
{
|
|
3686
4050
|
className: cn("prt-color-area-thumb", classNames?.thumb),
|
|
@@ -3710,14 +4074,14 @@ function ColorField({
|
|
|
3710
4074
|
placeholder,
|
|
3711
4075
|
...colorFieldProps
|
|
3712
4076
|
}) {
|
|
3713
|
-
return /* @__PURE__ */
|
|
4077
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3714
4078
|
reactAriaComponents.ColorField,
|
|
3715
4079
|
{
|
|
3716
4080
|
...colorFieldProps,
|
|
3717
4081
|
isInvalid: !!error,
|
|
3718
4082
|
"aria-label": colorFieldProps["aria-label"] ?? "color-field"
|
|
3719
4083
|
},
|
|
3720
|
-
/* @__PURE__ */
|
|
4084
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3721
4085
|
Field,
|
|
3722
4086
|
{
|
|
3723
4087
|
className,
|
|
@@ -3736,7 +4100,7 @@ function ColorField({
|
|
|
3736
4100
|
appearance,
|
|
3737
4101
|
validationStatus
|
|
3738
4102
|
},
|
|
3739
|
-
/* @__PURE__ */
|
|
4103
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
3740
4104
|
reactAriaComponents.Input,
|
|
3741
4105
|
{
|
|
3742
4106
|
ref: inputRef,
|
|
@@ -3761,7 +4125,7 @@ function ColorSwatchPicker({
|
|
|
3761
4125
|
styles,
|
|
3762
4126
|
...props
|
|
3763
4127
|
}) {
|
|
3764
|
-
return /* @__PURE__ */
|
|
4128
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3765
4129
|
reactAriaComponents.ColorSwatchPicker,
|
|
3766
4130
|
{
|
|
3767
4131
|
...props,
|
|
@@ -3770,7 +4134,7 @@ function ColorSwatchPicker({
|
|
|
3770
4134
|
className: cn("prt-color-swatch-picker", className, classNames?.wrapper),
|
|
3771
4135
|
style: { ...style, ...styles?.wrapper }
|
|
3772
4136
|
},
|
|
3773
|
-
colors.map((option) => /* @__PURE__ */
|
|
4137
|
+
colors.map((option) => /* @__PURE__ */ React13__namespace.createElement(
|
|
3774
4138
|
reactAriaComponents.ColorSwatchPickerItem,
|
|
3775
4139
|
{
|
|
3776
4140
|
key: option.key ?? option.color,
|
|
@@ -3778,18 +4142,18 @@ function ColorSwatchPicker({
|
|
|
3778
4142
|
className: cn("prt-color-swatch-item", classNames?.swatch),
|
|
3779
4143
|
style: styles?.swatch
|
|
3780
4144
|
},
|
|
3781
|
-
/* @__PURE__ */
|
|
4145
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.ColorSwatch, { className: "prt-color-swatch" })
|
|
3782
4146
|
))
|
|
3783
4147
|
);
|
|
3784
4148
|
}
|
|
3785
4149
|
function ColorSlider({ label, ...props }) {
|
|
3786
|
-
return /* @__PURE__ */
|
|
4150
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3787
4151
|
reactAriaComponents.ColorSlider,
|
|
3788
4152
|
{
|
|
3789
4153
|
...props,
|
|
3790
4154
|
"aria-label": props["aria-label"] ?? "color-slider"
|
|
3791
4155
|
},
|
|
3792
|
-
/* @__PURE__ */
|
|
4156
|
+
/* @__PURE__ */ React13__namespace.createElement(Field, { label, className: "prt-color-slider", replaceDefaultControlWrapper: true }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.SliderTrack, { className: "prt-color-slider-track" }, /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-color-slider-checkers" }), /* @__PURE__ */ React13__namespace.createElement(
|
|
3793
4157
|
reactAriaComponents.ColorThumb,
|
|
3794
4158
|
{
|
|
3795
4159
|
className: "prt-color-slider-thumb",
|
|
@@ -3827,7 +4191,7 @@ function ToggleGroup({
|
|
|
3827
4191
|
styles,
|
|
3828
4192
|
children
|
|
3829
4193
|
}) {
|
|
3830
|
-
const groupDefaults =
|
|
4194
|
+
const groupDefaults = React13__namespace.useMemo(
|
|
3831
4195
|
() => ({ idleColor, idleVariant, activeColor, activeVariant, size, radius }),
|
|
3832
4196
|
[idleColor, idleVariant, activeColor, activeVariant, size, radius]
|
|
3833
4197
|
);
|
|
@@ -3837,7 +4201,7 @@ function ToggleGroup({
|
|
|
3837
4201
|
selectionMode === "multiple" ? arr : arr[0] ?? ""
|
|
3838
4202
|
);
|
|
3839
4203
|
}
|
|
3840
|
-
return /* @__PURE__ */
|
|
4204
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
3841
4205
|
reactAriaComponents.ToggleButtonGroup,
|
|
3842
4206
|
{
|
|
3843
4207
|
"aria-label": label,
|
|
@@ -3848,7 +4212,7 @@ function ToggleGroup({
|
|
|
3848
4212
|
disallowEmptySelection: disallowEmptySelection ?? selectionMode === "single",
|
|
3849
4213
|
orientation
|
|
3850
4214
|
},
|
|
3851
|
-
/* @__PURE__ */
|
|
4215
|
+
/* @__PURE__ */ React13__namespace.createElement(ToggleButtonGroupContext.Provider, { value: groupDefaults }, /* @__PURE__ */ React13__namespace.createElement(
|
|
3852
4216
|
Space,
|
|
3853
4217
|
{
|
|
3854
4218
|
compact,
|
|
@@ -3863,7 +4227,589 @@ function ToggleGroup({
|
|
|
3863
4227
|
);
|
|
3864
4228
|
}
|
|
3865
4229
|
function Toggle({ value, ...props }) {
|
|
3866
|
-
return /* @__PURE__ */
|
|
4230
|
+
return /* @__PURE__ */ React13__namespace.createElement(ToggleButton, { id: value, ...props });
|
|
4231
|
+
}
|
|
4232
|
+
var DEFAULT_TIMEOUT = 4e3;
|
|
4233
|
+
var ALL_POSITIONS = [
|
|
4234
|
+
"top-left",
|
|
4235
|
+
"top-center",
|
|
4236
|
+
"top-right",
|
|
4237
|
+
"bottom-left",
|
|
4238
|
+
"bottom-center",
|
|
4239
|
+
"bottom-right"
|
|
4240
|
+
];
|
|
4241
|
+
var VARIANT_COLOR = {
|
|
4242
|
+
success: "success",
|
|
4243
|
+
error: "critical",
|
|
4244
|
+
warning: "warning",
|
|
4245
|
+
info: "info"
|
|
4246
|
+
};
|
|
4247
|
+
function createQueue() {
|
|
4248
|
+
return new reactAriaComponents.UNSTABLE_ToastQueue({
|
|
4249
|
+
maxVisibleToasts: 5,
|
|
4250
|
+
wrapUpdate(fn) {
|
|
4251
|
+
reactDom.flushSync(fn);
|
|
4252
|
+
}
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
var queues = {
|
|
4256
|
+
"top-left": createQueue(),
|
|
4257
|
+
"top-center": createQueue(),
|
|
4258
|
+
"top-right": createQueue(),
|
|
4259
|
+
"bottom-left": createQueue(),
|
|
4260
|
+
"bottom-center": createQueue(),
|
|
4261
|
+
"bottom-right": createQueue()
|
|
4262
|
+
};
|
|
4263
|
+
var defaultPosition = "top-right";
|
|
4264
|
+
function resolveTimeout(duration) {
|
|
4265
|
+
if (duration == null) return DEFAULT_TIMEOUT;
|
|
4266
|
+
if (!Number.isFinite(duration) || duration <= 0) return void 0;
|
|
4267
|
+
return duration;
|
|
4268
|
+
}
|
|
4269
|
+
function ToastIcon({ variant }) {
|
|
4270
|
+
switch (variant) {
|
|
4271
|
+
case "success":
|
|
4272
|
+
return /* @__PURE__ */ React13__namespace.createElement(HiOutlineCheckCircle, { className: "prt-toast-icon", size: 20 });
|
|
4273
|
+
case "error":
|
|
4274
|
+
case "warning":
|
|
4275
|
+
return /* @__PURE__ */ React13__namespace.createElement(HiOutlineExclamationCircle, { className: "prt-toast-icon", size: 20 });
|
|
4276
|
+
case "info":
|
|
4277
|
+
return /* @__PURE__ */ React13__namespace.createElement(HiOutlineInformationCircle, { className: "prt-toast-icon", size: 20 });
|
|
4278
|
+
default:
|
|
4279
|
+
return null;
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
function ToastItem({
|
|
4283
|
+
toast: toast2,
|
|
4284
|
+
queue,
|
|
4285
|
+
position
|
|
4286
|
+
}) {
|
|
4287
|
+
const content = toast2.content;
|
|
4288
|
+
const viewTransitionName = toast2.key;
|
|
4289
|
+
if (content.kind === "custom") {
|
|
4290
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
4291
|
+
reactAriaComponents.UNSTABLE_Toast,
|
|
4292
|
+
{
|
|
4293
|
+
toast: toast2,
|
|
4294
|
+
className: "prt-toast",
|
|
4295
|
+
"data-position": position,
|
|
4296
|
+
style: { viewTransitionName }
|
|
4297
|
+
},
|
|
4298
|
+
content.render({ close: () => queue.close(toast2.key) })
|
|
4299
|
+
);
|
|
4300
|
+
}
|
|
4301
|
+
const { variant, title, description, action, cancel } = content;
|
|
4302
|
+
const color = variant === "default" ? void 0 : VARIANT_COLOR[variant];
|
|
4303
|
+
return /* @__PURE__ */ React13__namespace.createElement(
|
|
4304
|
+
reactAriaComponents.UNSTABLE_Toast,
|
|
4305
|
+
{
|
|
4306
|
+
toast: toast2,
|
|
4307
|
+
className: "prt-toast",
|
|
4308
|
+
"data-color": color,
|
|
4309
|
+
"data-position": position,
|
|
4310
|
+
style: { viewTransitionName }
|
|
4311
|
+
},
|
|
4312
|
+
/* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.UNSTABLE_ToastContent, { className: "prt-toast-content" }, /* @__PURE__ */ React13__namespace.createElement(ToastIcon, { variant }), /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-toast-body" }, /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Text, { slot: "title", className: "prt-toast-title" }, title), description && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.Text, { slot: "description", className: "prt-toast-description" }, description), (action || cancel) && /* @__PURE__ */ React13__namespace.createElement("div", { className: "prt-toast-actions" }, action && /* @__PURE__ */ React13__namespace.createElement(
|
|
4313
|
+
Button,
|
|
4314
|
+
{
|
|
4315
|
+
size: "xs",
|
|
4316
|
+
color: "primary",
|
|
4317
|
+
variant: "solid",
|
|
4318
|
+
onPress: () => {
|
|
4319
|
+
action.onClick();
|
|
4320
|
+
queue.close(toast2.key);
|
|
4321
|
+
}
|
|
4322
|
+
},
|
|
4323
|
+
action.label
|
|
4324
|
+
), cancel && /* @__PURE__ */ React13__namespace.createElement(
|
|
4325
|
+
Button,
|
|
4326
|
+
{
|
|
4327
|
+
size: "xs",
|
|
4328
|
+
color: "gray",
|
|
4329
|
+
variant: "outline",
|
|
4330
|
+
onPress: () => {
|
|
4331
|
+
cancel.onClick();
|
|
4332
|
+
queue.close(toast2.key);
|
|
4333
|
+
}
|
|
4334
|
+
},
|
|
4335
|
+
cancel.label
|
|
4336
|
+
)))),
|
|
4337
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
4338
|
+
IconButton,
|
|
4339
|
+
{
|
|
4340
|
+
slot: "close",
|
|
4341
|
+
"aria-label": "Close",
|
|
4342
|
+
size: "xs",
|
|
4343
|
+
variant: "ghost",
|
|
4344
|
+
color: "gray",
|
|
4345
|
+
className: "prt-toast-close"
|
|
4346
|
+
},
|
|
4347
|
+
/* @__PURE__ */ React13__namespace.createElement(HiX, { size: 16 })
|
|
4348
|
+
)
|
|
4349
|
+
);
|
|
4350
|
+
}
|
|
4351
|
+
function ToastRegion({ position = "top-right" }) {
|
|
4352
|
+
React13__namespace.useEffect(() => {
|
|
4353
|
+
defaultPosition = position;
|
|
4354
|
+
}, [position]);
|
|
4355
|
+
return /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, ALL_POSITIONS.map((pos) => /* @__PURE__ */ React13__namespace.createElement(
|
|
4356
|
+
reactAriaComponents.UNSTABLE_ToastRegion,
|
|
4357
|
+
{
|
|
4358
|
+
key: pos,
|
|
4359
|
+
queue: queues[pos],
|
|
4360
|
+
"data-position": pos,
|
|
4361
|
+
className: cn("prt-toast-region", `prt-toast-region-${pos}`)
|
|
4362
|
+
},
|
|
4363
|
+
({ toast: toast2 }) => /* @__PURE__ */ React13__namespace.createElement(ToastItem, { toast: toast2, queue: queues[pos], position: pos })
|
|
4364
|
+
)));
|
|
4365
|
+
}
|
|
4366
|
+
function addToast(variant, title, options) {
|
|
4367
|
+
const position = options?.position ?? defaultPosition;
|
|
4368
|
+
return queues[position].add(
|
|
4369
|
+
{
|
|
4370
|
+
kind: "standard",
|
|
4371
|
+
variant,
|
|
4372
|
+
title,
|
|
4373
|
+
description: options?.description,
|
|
4374
|
+
action: options?.action,
|
|
4375
|
+
cancel: options?.cancel
|
|
4376
|
+
},
|
|
4377
|
+
{ timeout: resolveTimeout(options?.duration) }
|
|
4378
|
+
);
|
|
4379
|
+
}
|
|
4380
|
+
function toast(title, options) {
|
|
4381
|
+
return addToast("default", title, options);
|
|
4382
|
+
}
|
|
4383
|
+
toast.success = function(title, options) {
|
|
4384
|
+
return addToast("success", title, options);
|
|
4385
|
+
};
|
|
4386
|
+
toast.error = function(title, options) {
|
|
4387
|
+
return addToast("error", title, options);
|
|
4388
|
+
};
|
|
4389
|
+
toast.warning = function(title, options) {
|
|
4390
|
+
return addToast("warning", title, options);
|
|
4391
|
+
};
|
|
4392
|
+
toast.info = function(title, options) {
|
|
4393
|
+
return addToast("info", title, options);
|
|
4394
|
+
};
|
|
4395
|
+
toast.custom = function(render, options) {
|
|
4396
|
+
const position = options?.position ?? defaultPosition;
|
|
4397
|
+
return queues[position].add(
|
|
4398
|
+
{ kind: "custom", render },
|
|
4399
|
+
{ timeout: resolveTimeout(options?.duration) }
|
|
4400
|
+
);
|
|
4401
|
+
};
|
|
4402
|
+
toast.dismiss = function(key) {
|
|
4403
|
+
for (const pos of ALL_POSITIONS) queues[pos].close(key);
|
|
4404
|
+
};
|
|
4405
|
+
function Tooltip({
|
|
4406
|
+
content,
|
|
4407
|
+
children,
|
|
4408
|
+
delay = 600,
|
|
4409
|
+
closeDelay,
|
|
4410
|
+
isDisabled,
|
|
4411
|
+
showArrow = true,
|
|
4412
|
+
placement = "top",
|
|
4413
|
+
offset = 8,
|
|
4414
|
+
className,
|
|
4415
|
+
classNames,
|
|
4416
|
+
style,
|
|
4417
|
+
styles,
|
|
4418
|
+
...props
|
|
4419
|
+
}) {
|
|
4420
|
+
return /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.TooltipTrigger, { delay, closeDelay, isDisabled }, children, /* @__PURE__ */ React13__namespace.createElement(
|
|
4421
|
+
reactAriaComponents.Tooltip,
|
|
4422
|
+
{
|
|
4423
|
+
...props,
|
|
4424
|
+
placement,
|
|
4425
|
+
offset,
|
|
4426
|
+
className: cn("prt-tooltip", className, classNames?.tooltip),
|
|
4427
|
+
style: { ...style, ...styles?.tooltip }
|
|
4428
|
+
},
|
|
4429
|
+
showArrow && /* @__PURE__ */ React13__namespace.createElement(reactAriaComponents.OverlayArrow, { className: "prt-tooltip-arrow" }, /* @__PURE__ */ React13__namespace.createElement("svg", { width: "10", height: "5", viewBox: "0 0 10 5", "aria-hidden": "true" }, /* @__PURE__ */ React13__namespace.createElement("path", { d: "M0 0 L5 5 L10 0 Z" }))),
|
|
4430
|
+
content
|
|
4431
|
+
));
|
|
4432
|
+
}
|
|
4433
|
+
function HoverCard({
|
|
4434
|
+
children,
|
|
4435
|
+
content,
|
|
4436
|
+
openDelay = 300,
|
|
4437
|
+
closeDelay = 200,
|
|
4438
|
+
isDisabled,
|
|
4439
|
+
isOpen,
|
|
4440
|
+
defaultOpen,
|
|
4441
|
+
onOpenChange,
|
|
4442
|
+
offset = 10,
|
|
4443
|
+
placement = "bottom",
|
|
4444
|
+
className,
|
|
4445
|
+
classNames,
|
|
4446
|
+
style,
|
|
4447
|
+
styles,
|
|
4448
|
+
...props
|
|
4449
|
+
}) {
|
|
4450
|
+
const theme = useTheme();
|
|
4451
|
+
const triggerRef = React13__namespace.useRef(null);
|
|
4452
|
+
const state = reactStately.useOverlayTriggerState({ isOpen, defaultOpen, onOpenChange });
|
|
4453
|
+
const openTimer = React13__namespace.useRef(null);
|
|
4454
|
+
const closeTimer = React13__namespace.useRef(null);
|
|
4455
|
+
function clearTimers() {
|
|
4456
|
+
if (openTimer.current) clearTimeout(openTimer.current);
|
|
4457
|
+
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
4458
|
+
}
|
|
4459
|
+
function scheduleOpen() {
|
|
4460
|
+
clearTimers();
|
|
4461
|
+
if (isDisabled) return;
|
|
4462
|
+
openTimer.current = setTimeout(() => state.open(), openDelay);
|
|
4463
|
+
}
|
|
4464
|
+
function scheduleClose() {
|
|
4465
|
+
clearTimers();
|
|
4466
|
+
closeTimer.current = setTimeout(() => state.close(), closeDelay);
|
|
4467
|
+
}
|
|
4468
|
+
function openNow() {
|
|
4469
|
+
clearTimers();
|
|
4470
|
+
if (!isDisabled) state.open();
|
|
4471
|
+
}
|
|
4472
|
+
function keepOpen() {
|
|
4473
|
+
clearTimers();
|
|
4474
|
+
}
|
|
4475
|
+
React13__namespace.useEffect(() => clearTimers, []);
|
|
4476
|
+
const { hoverProps: triggerHover } = reactAria.useHover({
|
|
4477
|
+
isDisabled,
|
|
4478
|
+
onHoverStart: scheduleOpen,
|
|
4479
|
+
onHoverEnd: scheduleClose
|
|
4480
|
+
});
|
|
4481
|
+
const { focusWithinProps: triggerFocus } = reactAria.useFocusWithin({
|
|
4482
|
+
isDisabled,
|
|
4483
|
+
onFocusWithin: openNow,
|
|
4484
|
+
onBlurWithin: scheduleClose
|
|
4485
|
+
});
|
|
4486
|
+
const { hoverProps: contentHover } = reactAria.useHover({
|
|
4487
|
+
onHoverStart: keepOpen,
|
|
4488
|
+
onHoverEnd: scheduleClose
|
|
4489
|
+
});
|
|
4490
|
+
const { focusWithinProps: contentFocus } = reactAria.useFocusWithin({
|
|
4491
|
+
onFocusWithin: keepOpen,
|
|
4492
|
+
onBlurWithin: scheduleClose
|
|
4493
|
+
});
|
|
4494
|
+
const trigger = React13__namespace.cloneElement(children, {
|
|
4495
|
+
...reactAria.mergeProps(
|
|
4496
|
+
children.props,
|
|
4497
|
+
triggerHover,
|
|
4498
|
+
triggerFocus
|
|
4499
|
+
),
|
|
4500
|
+
ref: triggerRef
|
|
4501
|
+
});
|
|
4502
|
+
return /* @__PURE__ */ React13__namespace.createElement(React13__namespace.Fragment, null, trigger, /* @__PURE__ */ React13__namespace.createElement(
|
|
4503
|
+
reactAriaComponents.Popover,
|
|
4504
|
+
{
|
|
4505
|
+
...props,
|
|
4506
|
+
triggerRef,
|
|
4507
|
+
isOpen: state.isOpen,
|
|
4508
|
+
onOpenChange: state.setOpen,
|
|
4509
|
+
isNonModal: true,
|
|
4510
|
+
offset,
|
|
4511
|
+
placement,
|
|
4512
|
+
"data-color": theme?.color,
|
|
4513
|
+
"data-radius": theme?.radius,
|
|
4514
|
+
className: cn("prt-popover", classNames?.popover),
|
|
4515
|
+
style: styles?.popover
|
|
4516
|
+
},
|
|
4517
|
+
/* @__PURE__ */ React13__namespace.createElement(
|
|
4518
|
+
"div",
|
|
4519
|
+
{
|
|
4520
|
+
...reactAria.mergeProps(contentHover, contentFocus),
|
|
4521
|
+
className: cn("prt-popover-content", className, classNames?.content),
|
|
4522
|
+
style: { ...style, ...styles?.content }
|
|
4523
|
+
},
|
|
4524
|
+
content
|
|
4525
|
+
)
|
|
4526
|
+
));
|
|
4527
|
+
}
|
|
4528
|
+
function isEmpty(value) {
|
|
4529
|
+
if (value === null || value === void 0) return true;
|
|
4530
|
+
if (typeof value === "string") return value.trim() === "";
|
|
4531
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
4532
|
+
return false;
|
|
4533
|
+
}
|
|
4534
|
+
function cleanErrors(fields) {
|
|
4535
|
+
const errors = {};
|
|
4536
|
+
for (const key of Object.keys(fields)) errors[key] = null;
|
|
4537
|
+
return errors;
|
|
4538
|
+
}
|
|
4539
|
+
function cleanTouched(fields) {
|
|
4540
|
+
const touched = {};
|
|
4541
|
+
for (const key of Object.keys(fields)) touched[key] = false;
|
|
4542
|
+
return touched;
|
|
4543
|
+
}
|
|
4544
|
+
function useForm({
|
|
4545
|
+
fields: defaultFields,
|
|
4546
|
+
validators,
|
|
4547
|
+
optional = [],
|
|
4548
|
+
resetKey
|
|
4549
|
+
}) {
|
|
4550
|
+
const [values, setValues] = React13__namespace.useState(defaultFields);
|
|
4551
|
+
const [errors, setErrors] = React13__namespace.useState(
|
|
4552
|
+
() => cleanErrors(defaultFields)
|
|
4553
|
+
);
|
|
4554
|
+
const [touched, setTouched] = React13__namespace.useState(
|
|
4555
|
+
() => cleanTouched(defaultFields)
|
|
4556
|
+
);
|
|
4557
|
+
const [isSubmitting, setIsSubmitting] = React13__namespace.useState(false);
|
|
4558
|
+
const valuesRef = React13__namespace.useRef(values);
|
|
4559
|
+
valuesRef.current = values;
|
|
4560
|
+
const touchedRef = React13__namespace.useRef(touched);
|
|
4561
|
+
touchedRef.current = touched;
|
|
4562
|
+
const isSubmittingRef = React13__namespace.useRef(false);
|
|
4563
|
+
const fieldsRef = React13__namespace.useRef(defaultFields);
|
|
4564
|
+
fieldsRef.current = defaultFields;
|
|
4565
|
+
const resetKeyRef = React13__namespace.useRef(resetKey);
|
|
4566
|
+
React13__namespace.useEffect(() => {
|
|
4567
|
+
if (resetKey !== void 0 && resetKey !== resetKeyRef.current) {
|
|
4568
|
+
resetKeyRef.current = resetKey;
|
|
4569
|
+
setValues(fieldsRef.current);
|
|
4570
|
+
setErrors(cleanErrors(fieldsRef.current));
|
|
4571
|
+
setTouched(cleanTouched(fieldsRef.current));
|
|
4572
|
+
setIsSubmitting(false);
|
|
4573
|
+
isSubmittingRef.current = false;
|
|
4574
|
+
}
|
|
4575
|
+
}, [resetKey]);
|
|
4576
|
+
const validateField = React13__namespace.useCallback(
|
|
4577
|
+
(fieldName, value, currentValues) => {
|
|
4578
|
+
const validator = validators?.[fieldName];
|
|
4579
|
+
if (validator) return validator(value, currentValues);
|
|
4580
|
+
if (!optional.includes(fieldName) && isEmpty(value)) {
|
|
4581
|
+
return "This field is required";
|
|
4582
|
+
}
|
|
4583
|
+
return null;
|
|
4584
|
+
},
|
|
4585
|
+
[validators, optional]
|
|
4586
|
+
);
|
|
4587
|
+
function onChange(fieldName, value) {
|
|
4588
|
+
const next = { ...valuesRef.current, [fieldName]: value };
|
|
4589
|
+
setValues(next);
|
|
4590
|
+
setTouched((prev) => ({ ...prev, [fieldName]: true }));
|
|
4591
|
+
setErrors((prev) => {
|
|
4592
|
+
const nextErrors = { ...prev };
|
|
4593
|
+
nextErrors[fieldName] = validateField(fieldName, value, next);
|
|
4594
|
+
for (const field of Object.keys(prev)) {
|
|
4595
|
+
if (field !== fieldName && touchedRef.current[field]) {
|
|
4596
|
+
nextErrors[field] = validateField(field, next[field], next);
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
return nextErrors;
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
function visibleError(fieldName) {
|
|
4603
|
+
return touched[fieldName] ? errors[fieldName] : null;
|
|
4604
|
+
}
|
|
4605
|
+
function getFieldProps(fieldName) {
|
|
4606
|
+
return {
|
|
4607
|
+
name: String(fieldName),
|
|
4608
|
+
value: values[fieldName] ?? "",
|
|
4609
|
+
onChange: (value) => onChange(fieldName, value),
|
|
4610
|
+
error: visibleError(fieldName)
|
|
4611
|
+
};
|
|
4612
|
+
}
|
|
4613
|
+
function getNumberFieldProps(fieldName) {
|
|
4614
|
+
return {
|
|
4615
|
+
name: String(fieldName),
|
|
4616
|
+
value: values[fieldName] ?? Number.NaN,
|
|
4617
|
+
onChange: (value) => onChange(fieldName, value),
|
|
4618
|
+
error: visibleError(fieldName)
|
|
4619
|
+
};
|
|
4620
|
+
}
|
|
4621
|
+
function getSelectProps(fieldName) {
|
|
4622
|
+
return {
|
|
4623
|
+
name: String(fieldName),
|
|
4624
|
+
value: values[fieldName] ?? null,
|
|
4625
|
+
onChange: (value) => onChange(fieldName, value ?? ""),
|
|
4626
|
+
error: visibleError(fieldName)
|
|
4627
|
+
};
|
|
4628
|
+
}
|
|
4629
|
+
function getCheckboxGroupProps(fieldName) {
|
|
4630
|
+
return {
|
|
4631
|
+
name: String(fieldName),
|
|
4632
|
+
value: values[fieldName] ?? [],
|
|
4633
|
+
onChange: (value) => onChange(fieldName, value),
|
|
4634
|
+
errorMessage: visibleError(fieldName)
|
|
4635
|
+
};
|
|
4636
|
+
}
|
|
4637
|
+
function getRadioGroupProps(fieldName) {
|
|
4638
|
+
return {
|
|
4639
|
+
name: String(fieldName),
|
|
4640
|
+
value: values[fieldName] ?? "",
|
|
4641
|
+
onChange: (value) => onChange(fieldName, value),
|
|
4642
|
+
errorMessage: visibleError(fieldName)
|
|
4643
|
+
};
|
|
4644
|
+
}
|
|
4645
|
+
function getSwitchProps(fieldName) {
|
|
4646
|
+
return {
|
|
4647
|
+
name: String(fieldName),
|
|
4648
|
+
isSelected: Boolean(values[fieldName]),
|
|
4649
|
+
onChange: (value) => onChange(fieldName, value)
|
|
4650
|
+
};
|
|
4651
|
+
}
|
|
4652
|
+
function validateAll() {
|
|
4653
|
+
const current = valuesRef.current;
|
|
4654
|
+
const allErrors = {};
|
|
4655
|
+
const allTouched = {};
|
|
4656
|
+
for (const field of Object.keys(current)) {
|
|
4657
|
+
allErrors[field] = validateField(field, current[field], current);
|
|
4658
|
+
allTouched[field] = true;
|
|
4659
|
+
}
|
|
4660
|
+
setErrors(allErrors);
|
|
4661
|
+
setTouched(allTouched);
|
|
4662
|
+
return allErrors;
|
|
4663
|
+
}
|
|
4664
|
+
function handleSubmit(callback) {
|
|
4665
|
+
return (e) => {
|
|
4666
|
+
e.preventDefault();
|
|
4667
|
+
if (isSubmittingRef.current) return;
|
|
4668
|
+
const allErrors = validateAll();
|
|
4669
|
+
const hasErrors = Object.values(allErrors).some((error) => error !== null);
|
|
4670
|
+
if (hasErrors) return;
|
|
4671
|
+
const result = callback(valuesRef.current);
|
|
4672
|
+
if (result instanceof Promise) {
|
|
4673
|
+
isSubmittingRef.current = true;
|
|
4674
|
+
setIsSubmitting(true);
|
|
4675
|
+
result.finally(() => {
|
|
4676
|
+
isSubmittingRef.current = false;
|
|
4677
|
+
setIsSubmitting(false);
|
|
4678
|
+
});
|
|
4679
|
+
}
|
|
4680
|
+
};
|
|
4681
|
+
}
|
|
4682
|
+
function isValid() {
|
|
4683
|
+
const current = valuesRef.current;
|
|
4684
|
+
for (const field of Object.keys(current)) {
|
|
4685
|
+
if (validateField(field, current[field], current) !== null) return false;
|
|
4686
|
+
}
|
|
4687
|
+
return true;
|
|
4688
|
+
}
|
|
4689
|
+
const isDirty = React13__namespace.useMemo(() => {
|
|
4690
|
+
for (const field of Object.keys(defaultFields)) {
|
|
4691
|
+
if (values[field] !== defaultFields[field]) return true;
|
|
4692
|
+
}
|
|
4693
|
+
return false;
|
|
4694
|
+
}, [values, defaultFields]);
|
|
4695
|
+
function reset() {
|
|
4696
|
+
setValues(fieldsRef.current);
|
|
4697
|
+
setErrors(cleanErrors(fieldsRef.current));
|
|
4698
|
+
setTouched(cleanTouched(fieldsRef.current));
|
|
4699
|
+
setIsSubmitting(false);
|
|
4700
|
+
isSubmittingRef.current = false;
|
|
4701
|
+
}
|
|
4702
|
+
function setFieldValues(newValues) {
|
|
4703
|
+
const next = { ...valuesRef.current, ...newValues };
|
|
4704
|
+
setValues(next);
|
|
4705
|
+
setErrors((prev) => {
|
|
4706
|
+
const nextErrors = { ...prev };
|
|
4707
|
+
for (const field of Object.keys(newValues)) {
|
|
4708
|
+
nextErrors[field] = validateField(field, next[field], next);
|
|
4709
|
+
}
|
|
4710
|
+
return nextErrors;
|
|
4711
|
+
});
|
|
4712
|
+
setTouched((prev) => {
|
|
4713
|
+
const nextTouched = { ...prev };
|
|
4714
|
+
for (const field of Object.keys(newValues)) {
|
|
4715
|
+
nextTouched[field] = true;
|
|
4716
|
+
}
|
|
4717
|
+
return nextTouched;
|
|
4718
|
+
});
|
|
4719
|
+
}
|
|
4720
|
+
function setFieldError(fieldName, error) {
|
|
4721
|
+
setErrors((prev) => ({ ...prev, [fieldName]: error }));
|
|
4722
|
+
setTouched((prev) => ({ ...prev, [fieldName]: true }));
|
|
4723
|
+
}
|
|
4724
|
+
return {
|
|
4725
|
+
values,
|
|
4726
|
+
errors,
|
|
4727
|
+
touched,
|
|
4728
|
+
isDirty,
|
|
4729
|
+
isSubmitting,
|
|
4730
|
+
setIsSubmitting,
|
|
4731
|
+
onChange,
|
|
4732
|
+
getFieldProps,
|
|
4733
|
+
getNumberFieldProps,
|
|
4734
|
+
getSelectProps,
|
|
4735
|
+
getCheckboxGroupProps,
|
|
4736
|
+
getRadioGroupProps,
|
|
4737
|
+
getSwitchProps,
|
|
4738
|
+
handleSubmit,
|
|
4739
|
+
isValid,
|
|
4740
|
+
reset,
|
|
4741
|
+
validateAll,
|
|
4742
|
+
setFieldValues,
|
|
4743
|
+
setFieldError
|
|
4744
|
+
};
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
// src/hooks/validators.ts
|
|
4748
|
+
function required(message) {
|
|
4749
|
+
return function(value) {
|
|
4750
|
+
if (value === "" || value === null || value === void 0) {
|
|
4751
|
+
return message ?? "This field is required";
|
|
4752
|
+
}
|
|
4753
|
+
if (typeof value === "string" && value.trim() === "") {
|
|
4754
|
+
return message ?? "This field is required";
|
|
4755
|
+
}
|
|
4756
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
4757
|
+
return message ?? "This field is required";
|
|
4758
|
+
}
|
|
4759
|
+
return null;
|
|
4760
|
+
};
|
|
4761
|
+
}
|
|
4762
|
+
function email(message) {
|
|
4763
|
+
return function(value) {
|
|
4764
|
+
if (!value) return null;
|
|
4765
|
+
const valid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(value));
|
|
4766
|
+
return valid ? null : message ?? "Invalid email address";
|
|
4767
|
+
};
|
|
4768
|
+
}
|
|
4769
|
+
function minLength(length, message) {
|
|
4770
|
+
return function(value) {
|
|
4771
|
+
if (!value) return null;
|
|
4772
|
+
return String(value).length >= length ? null : message ?? `Must be at least ${length} characters`;
|
|
4773
|
+
};
|
|
4774
|
+
}
|
|
4775
|
+
function maxLength(length, message) {
|
|
4776
|
+
return function(value) {
|
|
4777
|
+
if (!value) return null;
|
|
4778
|
+
return String(value).length <= length ? null : message ?? `Must be at most ${length} characters`;
|
|
4779
|
+
};
|
|
4780
|
+
}
|
|
4781
|
+
function min(n, message) {
|
|
4782
|
+
return function(value) {
|
|
4783
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
4784
|
+
return Number(value) >= n ? null : message ?? `Must be at least ${n}`;
|
|
4785
|
+
};
|
|
4786
|
+
}
|
|
4787
|
+
function max(n, message) {
|
|
4788
|
+
return function(value) {
|
|
4789
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
4790
|
+
return Number(value) <= n ? null : message ?? `Must be at most ${n}`;
|
|
4791
|
+
};
|
|
4792
|
+
}
|
|
4793
|
+
function pattern(regex, message) {
|
|
4794
|
+
return function(value) {
|
|
4795
|
+
if (!value) return null;
|
|
4796
|
+
return regex.test(String(value)) ? null : message ?? "Invalid format";
|
|
4797
|
+
};
|
|
4798
|
+
}
|
|
4799
|
+
function matches(fieldName, message) {
|
|
4800
|
+
return function(value, values) {
|
|
4801
|
+
if (!value) return null;
|
|
4802
|
+
return value === values[fieldName] ? null : message ?? `Must match ${fieldName}`;
|
|
4803
|
+
};
|
|
4804
|
+
}
|
|
4805
|
+
function compose(...fns) {
|
|
4806
|
+
return function(value, values) {
|
|
4807
|
+
for (const fn of fns) {
|
|
4808
|
+
const error = fn(value, values);
|
|
4809
|
+
if (error) return error;
|
|
4810
|
+
}
|
|
4811
|
+
return null;
|
|
4812
|
+
};
|
|
3867
4813
|
}
|
|
3868
4814
|
|
|
3869
4815
|
exports.Avatar = Avatar;
|
|
@@ -3884,6 +4830,7 @@ exports.DateField = DateField;
|
|
|
3884
4830
|
exports.DatePicker = DatePicker;
|
|
3885
4831
|
exports.DateRangePicker = DateRangePicker;
|
|
3886
4832
|
exports.FileUploader = FileUploader;
|
|
4833
|
+
exports.HoverCard = HoverCard;
|
|
3887
4834
|
exports.IconButton = IconButton;
|
|
3888
4835
|
exports.Input = Input;
|
|
3889
4836
|
exports.ListBox = ListBox;
|
|
@@ -3896,8 +4843,13 @@ exports.MenuItem = MenuItem;
|
|
|
3896
4843
|
exports.MenuSection = MenuSection;
|
|
3897
4844
|
exports.MenuTrigger = MenuTrigger;
|
|
3898
4845
|
exports.Modal = Modal;
|
|
4846
|
+
exports.ModalProvider = ModalProvider;
|
|
3899
4847
|
exports.NumberInput = NumberInput;
|
|
3900
4848
|
exports.Option = ListBoxItem;
|
|
4849
|
+
exports.PinInput = PinInput;
|
|
4850
|
+
exports.PinInputGroup = PinInputGroup;
|
|
4851
|
+
exports.PinInputSeparator = PinInputSeparator;
|
|
4852
|
+
exports.PinInputSlot = PinInputSlot;
|
|
3901
4853
|
exports.Popover = Popover;
|
|
3902
4854
|
exports.PopoverContent = PopoverContent;
|
|
3903
4855
|
exports.PopoverTrigger = PopoverTrigger;
|
|
@@ -3926,11 +4878,25 @@ exports.Textarea = Textarea;
|
|
|
3926
4878
|
exports.ThemeProvider = ThemeProvider;
|
|
3927
4879
|
exports.TimeField = TimeField;
|
|
3928
4880
|
exports.Timeline = Timeline;
|
|
4881
|
+
exports.ToastRegion = ToastRegion;
|
|
3929
4882
|
exports.Toggle = Toggle;
|
|
3930
4883
|
exports.ToggleButton = ToggleButton;
|
|
3931
4884
|
exports.ToggleGroup = ToggleGroup;
|
|
4885
|
+
exports.Tooltip = Tooltip;
|
|
4886
|
+
exports.compose = compose;
|
|
4887
|
+
exports.email = email;
|
|
4888
|
+
exports.matches = matches;
|
|
4889
|
+
exports.max = max;
|
|
4890
|
+
exports.maxLength = maxLength;
|
|
4891
|
+
exports.min = min;
|
|
4892
|
+
exports.minLength = minLength;
|
|
3932
4893
|
exports.parseColor = parseColor2;
|
|
4894
|
+
exports.pattern = pattern;
|
|
4895
|
+
exports.required = required;
|
|
4896
|
+
exports.toast = toast;
|
|
4897
|
+
exports.useForm = useForm;
|
|
3933
4898
|
exports.useModal = useModal;
|
|
4899
|
+
exports.useModals = useModals;
|
|
3934
4900
|
exports.useTheme = useTheme;
|
|
3935
4901
|
//# sourceMappingURL=index.js.map
|
|
3936
4902
|
//# sourceMappingURL=index.js.map
|