@dafaz-ui/react 4.0.18 → 6.0.5
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +61 -0
- package/dist/index.d.mts +678 -42
- package/dist/index.d.ts +678 -42
- package/dist/index.js +776 -147
- package/dist/index.mjs +780 -149
- package/package.json +1 -1
- package/src/components/Box/styles.ts +64 -10
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Button/styles.ts +14 -7
- package/src/components/CheckBox/index.tsx +10 -26
- package/src/components/CheckBox/styles.ts +3 -1
- package/src/components/Heading/index.tsx +1 -1
- package/src/components/Heading/styles.ts +29 -15
- package/src/components/MultiSelect/index.tsx +232 -0
- package/src/components/MultiSelect/styles.ts +116 -0
- package/src/components/Radio/RadioItem/index.tsx +6 -4
- package/src/components/Radio/RadioItem/styles.ts +4 -1
- package/src/components/Radio/index.tsx +38 -23
- package/src/components/Radio/styles.ts +2 -1
- package/src/components/Select/index.tsx +49 -35
- package/src/components/Select/styles.ts +78 -13
- package/src/components/Separator/index.tsx +7 -0
- package/src/components/Separator/styles.ts +51 -0
- package/src/components/Text/index.tsx +3 -2
- package/src/components/Text/styles.ts +24 -3
- package/src/components/TextArea/index.tsx +17 -9
- package/src/components/TextArea/styles.ts +7 -2
- package/src/components/TextInput/index.tsx +38 -4
- package/src/components/TextInput/styles.ts +60 -3
- package/src/index.tsx +2 -0
package/dist/index.js
CHANGED
@@ -55,6 +55,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
55
55
|
mod
|
56
56
|
));
|
57
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
58
|
+
var __async = (__this, __arguments, generator) => {
|
59
|
+
return new Promise((resolve, reject) => {
|
60
|
+
var fulfilled = (value) => {
|
61
|
+
try {
|
62
|
+
step(generator.next(value));
|
63
|
+
} catch (e) {
|
64
|
+
reject(e);
|
65
|
+
}
|
66
|
+
};
|
67
|
+
var rejected = (value) => {
|
68
|
+
try {
|
69
|
+
step(generator.throw(value));
|
70
|
+
} catch (e) {
|
71
|
+
reject(e);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
75
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
76
|
+
});
|
77
|
+
};
|
58
78
|
|
59
79
|
// src/index.tsx
|
60
80
|
var src_exports = {};
|
@@ -63,8 +83,10 @@ __export(src_exports, {
|
|
63
83
|
Button: () => Button,
|
64
84
|
CheckBox: () => CheckBox,
|
65
85
|
Heading: () => Heading,
|
86
|
+
MultiSelect: () => MultiSelect,
|
66
87
|
Radio: () => Radio,
|
67
88
|
Select: () => Select,
|
89
|
+
Separator: () => Separator,
|
68
90
|
Text: () => Text,
|
69
91
|
TextArea: () => TextArea,
|
70
92
|
TextInput: () => TextInput,
|
@@ -83,6 +105,7 @@ module.exports = __toCommonJS(src_exports);
|
|
83
105
|
var colors = {
|
84
106
|
white: "#FFF",
|
85
107
|
black: "#000",
|
108
|
+
red: "#ED0A0A",
|
86
109
|
gray100: "#D6D6D6",
|
87
110
|
gray200: "#666666",
|
88
111
|
gray400: "#444444",
|
@@ -125,7 +148,7 @@ var radii = {
|
|
125
148
|
var fonts = {
|
126
149
|
default: "Roboto, sans-serif",
|
127
150
|
app: "Poppins",
|
128
|
-
web: "League Spartan",
|
151
|
+
web: "League Spartan, League_Spartan",
|
129
152
|
offer: "KoHo",
|
130
153
|
code: "monospace"
|
131
154
|
};
|
@@ -136,7 +159,15 @@ var fontSizes = {
|
|
136
159
|
md: "0.875rem",
|
137
160
|
lg: "1.0rem",
|
138
161
|
xl: "1.25rem",
|
139
|
-
"2xl": "
|
162
|
+
"2xl": "1.5rem",
|
163
|
+
"3xl": "1.75rem",
|
164
|
+
"4xl": "2rem",
|
165
|
+
"5xl": "2.5rem",
|
166
|
+
"6xl": "3rem",
|
167
|
+
"7xl": "3.5rem",
|
168
|
+
"8xl": "4rem",
|
169
|
+
"9xl": "5rem",
|
170
|
+
"10xl": "6rem"
|
140
171
|
};
|
141
172
|
var fontWeights = {
|
142
173
|
regular: "400",
|
@@ -182,26 +213,77 @@ var {
|
|
182
213
|
var BoxUI = styled("div", {
|
183
214
|
padding: "$4",
|
184
215
|
variants: {
|
216
|
+
withShadow: {
|
217
|
+
true: {
|
218
|
+
boxShadow: "1px 1px 2px $colors$gray800"
|
219
|
+
}
|
220
|
+
},
|
185
221
|
stretch: {
|
186
222
|
true: {
|
187
|
-
width: "100%"
|
223
|
+
width: "100%",
|
224
|
+
"> div": {
|
225
|
+
paddingLeft: 0
|
226
|
+
}
|
188
227
|
},
|
189
228
|
false: {
|
190
|
-
width: "
|
229
|
+
width: "24.5rem",
|
230
|
+
"> div": {
|
231
|
+
paddingLeft: 0
|
232
|
+
}
|
191
233
|
}
|
192
234
|
},
|
193
|
-
|
194
|
-
|
235
|
+
color: {
|
236
|
+
dark: {
|
195
237
|
background: "$gray800"
|
196
238
|
},
|
197
|
-
|
239
|
+
primary: {
|
240
|
+
background: "$dafaz400"
|
241
|
+
},
|
242
|
+
secondary: {
|
243
|
+
background: "$dafaz800"
|
244
|
+
},
|
245
|
+
light: {
|
246
|
+
background: "$dafaz100"
|
247
|
+
},
|
248
|
+
transparent: {
|
198
249
|
background: "transparent"
|
199
250
|
}
|
251
|
+
},
|
252
|
+
rounded: {
|
253
|
+
px: {
|
254
|
+
borderRadius: "$px"
|
255
|
+
},
|
256
|
+
sm: {
|
257
|
+
borderRadius: "$sm"
|
258
|
+
},
|
259
|
+
md: {
|
260
|
+
borderRadius: "$md"
|
261
|
+
},
|
262
|
+
full: {
|
263
|
+
borderRadius: "$full"
|
264
|
+
}
|
265
|
+
},
|
266
|
+
direction: {
|
267
|
+
none: {},
|
268
|
+
row: {
|
269
|
+
display: "flex",
|
270
|
+
alignItems: "center",
|
271
|
+
justifyContent: "center"
|
272
|
+
},
|
273
|
+
column: {
|
274
|
+
display: "flex",
|
275
|
+
flexDirection: "column",
|
276
|
+
alignItems: "center",
|
277
|
+
justifyContent: "center"
|
278
|
+
}
|
200
279
|
}
|
201
280
|
},
|
202
281
|
defaultVariants: {
|
203
|
-
stretch:
|
204
|
-
|
282
|
+
stretch: true,
|
283
|
+
color: "dark",
|
284
|
+
rounded: "px",
|
285
|
+
withShadow: false,
|
286
|
+
direction: "row"
|
205
287
|
}
|
206
288
|
});
|
207
289
|
|
@@ -223,12 +305,14 @@ var ButtonUI = styled("button", {
|
|
223
305
|
textAlign: "center",
|
224
306
|
minWidth: 120,
|
225
307
|
boxSizing: "border-box",
|
308
|
+
boxShadow: "3px 3px 2px -2px $colors$gray400",
|
226
309
|
display: "flex",
|
227
310
|
alignItems: "center",
|
228
311
|
justifyContent: "center",
|
229
312
|
gap: "$2",
|
230
313
|
padding: "$2 $5",
|
231
314
|
cursor: "pointer",
|
315
|
+
transition: "background 0.2s linear",
|
232
316
|
"&:disabled": {
|
233
317
|
cursor: "not-allowed"
|
234
318
|
},
|
@@ -237,21 +321,21 @@ var ButtonUI = styled("button", {
|
|
237
321
|
primary: {
|
238
322
|
color: "$white",
|
239
323
|
background: "$dafaz600",
|
240
|
-
opacity: 0.8,
|
241
324
|
"&:not(:disabled):hover": {
|
242
|
-
|
325
|
+
background: "$dafaz400"
|
243
326
|
},
|
244
327
|
"&:disabled": {
|
245
328
|
background: "$gray200"
|
246
329
|
}
|
247
330
|
},
|
248
331
|
secondary: {
|
332
|
+
transition: "border, color 0.2s linear",
|
249
333
|
fontWeight: "$medium",
|
250
334
|
color: "$dafaz600",
|
251
335
|
border: "2px solid $dafaz600",
|
252
|
-
opacity: 0.8,
|
253
336
|
"&:not(:disabled):hover": {
|
254
|
-
|
337
|
+
color: "$dafaz400",
|
338
|
+
border: "2px solid $dafaz400"
|
255
339
|
},
|
256
340
|
"&:disabled": {
|
257
341
|
color: "$gray200",
|
@@ -259,10 +343,12 @@ var ButtonUI = styled("button", {
|
|
259
343
|
}
|
260
344
|
},
|
261
345
|
tertiary: {
|
346
|
+
transition: "color 0.2s linear",
|
347
|
+
boxShadow: "none",
|
262
348
|
fontWeight: "$medium",
|
263
|
-
color: "$
|
349
|
+
color: "$gray100",
|
264
350
|
"&:not(:disabled):hover": {
|
265
|
-
|
351
|
+
opacity: 0.9
|
266
352
|
},
|
267
353
|
"&:disabled": {
|
268
354
|
color: "$gray200"
|
@@ -340,6 +426,7 @@ var CheckBoxUI = styled(Checkbox.Root, {
|
|
340
426
|
alignItems: "center",
|
341
427
|
transition: "border 0.2s linear",
|
342
428
|
border: "2px solid $gray400",
|
429
|
+
boxShadow: "1.3px 1.3px 4px -1px $colors$dafaz600",
|
343
430
|
'&:focus,&[data-state="checked"]': {
|
344
431
|
backgroundColor: "$dafaz600",
|
345
432
|
borderColor: "$dafaz600"
|
@@ -451,41 +538,26 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
451
538
|
var CheckBox = (0, import_react2.forwardRef)(
|
452
539
|
(_a, ref) => {
|
453
540
|
var _b = _a, {
|
454
|
-
id,
|
455
541
|
label,
|
456
542
|
size,
|
457
543
|
disabled = false,
|
458
|
-
|
459
|
-
onCheckedChange,
|
460
|
-
value
|
544
|
+
handleOnChange
|
461
545
|
} = _b, props = __objRest(_b, [
|
462
|
-
"id",
|
463
546
|
"label",
|
464
547
|
"size",
|
465
548
|
"disabled",
|
466
|
-
"
|
467
|
-
"onCheckedChange",
|
468
|
-
"value"
|
549
|
+
"handleOnChange"
|
469
550
|
]);
|
470
|
-
const
|
471
|
-
(0,
|
472
|
-
if (checked) {
|
473
|
-
setCheckValue(value);
|
474
|
-
} else {
|
475
|
-
setCheckValue(void 0);
|
476
|
-
}
|
477
|
-
}, [checked, value]);
|
478
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label, { htmlFor: id, disabled, size, children: [
|
551
|
+
const htmlId = (0, import_react2.useId)();
|
552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label, { htmlFor: htmlId, disabled, size, children: [
|
479
553
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
480
554
|
CheckBoxUI,
|
481
555
|
__spreadProps(__spreadValues({
|
482
556
|
ref,
|
483
|
-
checked,
|
484
|
-
onCheckedChange,
|
485
557
|
disabled,
|
486
|
-
id,
|
558
|
+
id: htmlId,
|
487
559
|
size,
|
488
|
-
|
560
|
+
onCheckedChange: handleOnChange
|
489
561
|
}, props), {
|
490
562
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.Check, { weight: "bold" }) })
|
491
563
|
})
|
@@ -502,24 +574,37 @@ var HeadingUI = styled("h2", {
|
|
502
574
|
lineHeight: "$shorter",
|
503
575
|
margin: 0,
|
504
576
|
variants: {
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
},
|
577
|
+
size: {
|
578
|
+
sm: { fontSize: "$2xl" },
|
579
|
+
md: { fontSize: "$3xl" },
|
580
|
+
lg: { fontSize: "$4xl" },
|
581
|
+
xl: { fontSize: "$5xl" },
|
582
|
+
"2xl": { fontSize: "$6xl" },
|
583
|
+
"3xl": { fontSize: "$7xl" },
|
584
|
+
"4xl": { fontSize: "$8xl" },
|
585
|
+
"5xl": { fontSize: "$9xl" },
|
586
|
+
"6xl": { fontSize: "$10xl" }
|
587
|
+
},
|
588
|
+
color: {
|
509
589
|
white: {
|
510
590
|
color: "$white"
|
591
|
+
},
|
592
|
+
black: {
|
593
|
+
color: "black"
|
594
|
+
},
|
595
|
+
primary: {
|
596
|
+
color: "$dafaz400"
|
597
|
+
},
|
598
|
+
lightGray: {
|
599
|
+
color: "$gray400"
|
600
|
+
},
|
601
|
+
darkGray: {
|
602
|
+
color: "$gray800"
|
511
603
|
}
|
512
|
-
},
|
513
|
-
size: {
|
514
|
-
sm: { fontSize: "$lg" },
|
515
|
-
md: { fontSize: "$xl" },
|
516
|
-
lg: { fontSize: "$2xl" },
|
517
|
-
xl: { fontSize: "3rem" },
|
518
|
-
"2xl": { fontSize: "4rem" }
|
519
604
|
}
|
520
605
|
},
|
521
606
|
defaultVariants: {
|
522
|
-
|
607
|
+
color: "white",
|
523
608
|
size: "lg"
|
524
609
|
}
|
525
610
|
});
|
@@ -575,6 +660,7 @@ var RadioItemUI = styled(RadioGroup2.Item, {
|
|
575
660
|
display: "flex",
|
576
661
|
justifyContent: "center",
|
577
662
|
alignItems: "center",
|
663
|
+
boxShadow: "1.3px 1.3px 4px -1px $colors$dafaz600",
|
578
664
|
transition: "border 0.2s linear",
|
579
665
|
"&:disabled": {
|
580
666
|
cursor: "not-allowed"
|
@@ -681,57 +767,132 @@ var Label2 = styled("label", {
|
|
681
767
|
});
|
682
768
|
|
683
769
|
// src/components/Radio/RadioItem/index.tsx
|
770
|
+
var import_react5 = require("react");
|
684
771
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
685
772
|
function RadioItem(_a) {
|
686
773
|
var _b = _a, {
|
687
774
|
label,
|
688
|
-
id,
|
689
775
|
size,
|
690
776
|
disabled = false
|
691
777
|
} = _b, props = __objRest(_b, [
|
692
778
|
"label",
|
693
|
-
"id",
|
694
779
|
"size",
|
695
780
|
"disabled"
|
696
781
|
]);
|
782
|
+
const htmlId = (0, import_react5.useId)();
|
697
783
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(RadioItemContainer, { children: [
|
698
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioItemUI, __spreadProps(__spreadValues({ disabled, id }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.Check, { weight: "bold" }) }) })),
|
699
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label2, { disabled, htmlFor:
|
700
|
-
] }
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioItemUI, __spreadProps(__spreadValues({ disabled, id: htmlId }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.Check, { weight: "bold" }) }) })),
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label2, { disabled, htmlFor: htmlId, size, children: label })
|
786
|
+
] });
|
701
787
|
}
|
702
788
|
RadioItem.displayName = "RadioItem";
|
703
789
|
|
704
790
|
// src/components/Radio/index.tsx
|
791
|
+
var import_react6 = require("react");
|
705
792
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
793
|
+
var Radio = (0, import_react6.forwardRef)(
|
794
|
+
(_a, ref) => {
|
795
|
+
var _b = _a, {
|
796
|
+
items,
|
797
|
+
size,
|
798
|
+
disabled = false,
|
799
|
+
onValueChange,
|
800
|
+
value
|
801
|
+
} = _b, props = __objRest(_b, [
|
802
|
+
"items",
|
803
|
+
"size",
|
804
|
+
"disabled",
|
805
|
+
"onValueChange",
|
806
|
+
"value"
|
807
|
+
]);
|
717
808
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
718
|
-
|
719
|
-
{
|
720
|
-
|
721
|
-
label: item.label,
|
722
|
-
value: item.value,
|
723
|
-
size,
|
809
|
+
RadioUI,
|
810
|
+
__spreadProps(__spreadValues({
|
811
|
+
ref,
|
724
812
|
disabled
|
725
|
-
},
|
726
|
-
|
813
|
+
}, props), {
|
814
|
+
onValueChange,
|
815
|
+
value,
|
816
|
+
children: items.map((item) => {
|
817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
818
|
+
RadioItem,
|
819
|
+
{
|
820
|
+
label: item.label,
|
821
|
+
value: item.value,
|
822
|
+
size,
|
823
|
+
disabled
|
824
|
+
},
|
825
|
+
item.id
|
826
|
+
);
|
827
|
+
})
|
828
|
+
})
|
727
829
|
);
|
728
|
-
}
|
729
|
-
|
830
|
+
}
|
831
|
+
);
|
730
832
|
Radio.displayName = "Radio";
|
731
833
|
|
834
|
+
// src/components/Select/index.tsx
|
835
|
+
var import_react7 = require("@phosphor-icons/react");
|
836
|
+
|
732
837
|
// src/components/Select/styles.ts
|
838
|
+
var SelectContainer = styled("div", {
|
839
|
+
display: "flex",
|
840
|
+
alignItems: "center",
|
841
|
+
justifyContent: "space-between",
|
842
|
+
fontFamily: "$app",
|
843
|
+
color: "$white",
|
844
|
+
cursor: "pointer",
|
845
|
+
width: "100%",
|
846
|
+
maxWidth: "24.5rem",
|
847
|
+
boxSizing: "border-box",
|
848
|
+
borderRadius: "$md",
|
849
|
+
borderBottom: "2px solid $dafaz600",
|
850
|
+
boxShadow: "0 3px 2px -2px $colors$gray400",
|
851
|
+
transition: "border 0.2s linear",
|
852
|
+
"&:disabled": {
|
853
|
+
cursor: "not-allowed",
|
854
|
+
opacity: 0.5
|
855
|
+
},
|
856
|
+
"&:active": {
|
857
|
+
borderBottom: "2px solid $dafaz400"
|
858
|
+
},
|
859
|
+
"&:hover": {
|
860
|
+
borderBottom: "2px solid $dafaz400"
|
861
|
+
},
|
862
|
+
variants: {
|
863
|
+
size: {
|
864
|
+
lg: {
|
865
|
+
fontSize: "$xl",
|
866
|
+
svg: {
|
867
|
+
width: "$5",
|
868
|
+
height: "$5"
|
869
|
+
}
|
870
|
+
},
|
871
|
+
md: {
|
872
|
+
fontSize: "$lg",
|
873
|
+
svg: {
|
874
|
+
width: "$4",
|
875
|
+
height: "$4"
|
876
|
+
}
|
877
|
+
},
|
878
|
+
sm: {
|
879
|
+
fontSize: "$sm",
|
880
|
+
svg: {
|
881
|
+
width: "$3",
|
882
|
+
height: "$3"
|
883
|
+
}
|
884
|
+
}
|
885
|
+
}
|
886
|
+
},
|
887
|
+
defaultVariants: {
|
888
|
+
size: "lg"
|
889
|
+
}
|
890
|
+
});
|
733
891
|
var SelectUI = styled("select", {
|
734
|
-
|
892
|
+
zIndex: 1,
|
893
|
+
"-moz-appearance": "none",
|
894
|
+
"-webkit-appearance": "none",
|
895
|
+
appearance: "none",
|
735
896
|
overflow: "hidden",
|
736
897
|
background: "transparent",
|
737
898
|
border: "none",
|
@@ -739,20 +900,15 @@ var SelectUI = styled("select", {
|
|
739
900
|
color: "$white",
|
740
901
|
fontWeight: "$regular",
|
741
902
|
cursor: "pointer",
|
742
|
-
boxSizing: "border-box",
|
743
|
-
borderRadius: "$md",
|
744
|
-
borderBottom: "2px solid $dafaz600",
|
745
|
-
transition: "border 0.2s linear",
|
746
903
|
width: "100%",
|
904
|
+
maxWidth: "24.5rem",
|
747
905
|
margin: 0,
|
748
906
|
padding: "$1 $1",
|
749
|
-
"&:focus": {
|
750
|
-
outline: 0,
|
751
|
-
borderBottom: "2px solid $dafaz400"
|
752
|
-
},
|
753
907
|
"&:disabled": {
|
754
|
-
opacity: 0.5
|
755
|
-
|
908
|
+
opacity: 0.5
|
909
|
+
},
|
910
|
+
"&:focus": {
|
911
|
+
outline: 0
|
756
912
|
},
|
757
913
|
variants: {
|
758
914
|
size: {
|
@@ -795,49 +951,110 @@ var OptionUI = styled("option", {
|
|
795
951
|
});
|
796
952
|
|
797
953
|
// src/components/Select/index.tsx
|
798
|
-
var
|
954
|
+
var import_react8 = require("react");
|
799
955
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
800
|
-
|
801
|
-
|
802
|
-
size,
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
items.map((item) => {
|
827
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { value: item.value, children: item.label }, item.id);
|
956
|
+
var Select = (0, import_react8.forwardRef)(
|
957
|
+
(_a, ref) => {
|
958
|
+
var _b = _a, { id, size, placeholder, items } = _b, props = __objRest(_b, ["id", "size", "placeholder", "items"]);
|
959
|
+
const [value, setValue] = (0, import_react8.useState)("");
|
960
|
+
function handleSelect(event) {
|
961
|
+
setValue(() => {
|
962
|
+
return event.target.value;
|
963
|
+
});
|
964
|
+
}
|
965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(SelectContainer, { size, children: [
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
967
|
+
SelectUI,
|
968
|
+
__spreadProps(__spreadValues({
|
969
|
+
id,
|
970
|
+
ref,
|
971
|
+
size
|
972
|
+
}, props), {
|
973
|
+
value,
|
974
|
+
onChange: handleSelect,
|
975
|
+
style: { opacity: value != "" ? 1 : 0.75 },
|
976
|
+
children: [
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { className: "placeholder", value: "", children: placeholder }),
|
978
|
+
items.map((item) => {
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OptionUI, { value: item.value, children: item.label }, item.id);
|
980
|
+
})
|
981
|
+
]
|
828
982
|
})
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
983
|
+
),
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
985
|
+
"span",
|
986
|
+
{
|
987
|
+
style: {
|
988
|
+
display: "flex",
|
989
|
+
alignItems: "center",
|
990
|
+
paddingLeft: "1rem",
|
991
|
+
marginRight: "0.6rem",
|
992
|
+
marginLeft: "-3rem"
|
993
|
+
},
|
994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react7.CaretDown, { size: 24, weight: "bold" })
|
995
|
+
}
|
996
|
+
)
|
997
|
+
] });
|
998
|
+
}
|
999
|
+
);
|
833
1000
|
Select.displayName = "Select";
|
834
1001
|
|
1002
|
+
// src/components/Separator/styles.ts
|
1003
|
+
var SeparatorUI = styled("hr", {
|
1004
|
+
width: "100%",
|
1005
|
+
borderStyle: "solid",
|
1006
|
+
variants: {
|
1007
|
+
color: {
|
1008
|
+
primary: {
|
1009
|
+
borderColor: "$dafaz400"
|
1010
|
+
},
|
1011
|
+
lightGray: {
|
1012
|
+
borderColor: "$gray100"
|
1013
|
+
},
|
1014
|
+
darkGray: {
|
1015
|
+
borderColor: "$gray800"
|
1016
|
+
},
|
1017
|
+
white: {
|
1018
|
+
borderColor: "$white"
|
1019
|
+
},
|
1020
|
+
black: {
|
1021
|
+
borderColor: "$black"
|
1022
|
+
}
|
1023
|
+
},
|
1024
|
+
size: {
|
1025
|
+
lg: {
|
1026
|
+
borderWidth: "2px"
|
1027
|
+
},
|
1028
|
+
md: {
|
1029
|
+
borderWidth: "1px"
|
1030
|
+
},
|
1031
|
+
sm: {
|
1032
|
+
borderWidth: "0.75px"
|
1033
|
+
},
|
1034
|
+
xs: {
|
1035
|
+
borderWidth: "0.5px"
|
1036
|
+
}
|
1037
|
+
}
|
1038
|
+
},
|
1039
|
+
defaultVariants: {
|
1040
|
+
color: "primary",
|
1041
|
+
size: "lg"
|
1042
|
+
}
|
1043
|
+
});
|
1044
|
+
|
1045
|
+
// src/components/Separator/index.tsx
|
1046
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
1047
|
+
function Separator(_a) {
|
1048
|
+
var _b = _a, { size, color, style } = _b, props = __objRest(_b, ["size", "color", "style"]);
|
1049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SeparatorUI, __spreadValues({ size, color, style }, props));
|
1050
|
+
}
|
1051
|
+
Separator.displayName = "Separator";
|
1052
|
+
|
835
1053
|
// src/components/Text/styles.ts
|
836
1054
|
var TextUI = styled("p", {
|
837
1055
|
fontFamily: "$web",
|
838
1056
|
lineHeight: "$base",
|
839
1057
|
margin: 0,
|
840
|
-
color: "$white",
|
841
1058
|
variants: {
|
842
1059
|
size: {
|
843
1060
|
xxs: { fontSize: "$xxs" },
|
@@ -846,28 +1063,53 @@ var TextUI = styled("p", {
|
|
846
1063
|
md: { fontSize: "$md" },
|
847
1064
|
lg: { fontSize: "$lg" },
|
848
1065
|
xl: { fontSize: "$xl" },
|
849
|
-
"2xl": { fontSize: "$2xl" }
|
1066
|
+
"2xl": { fontSize: "$2xl" },
|
1067
|
+
"3xl": { fontSize: "$3xl" },
|
1068
|
+
"4xl": { fontSize: "$4xl" }
|
1069
|
+
},
|
1070
|
+
color: {
|
1071
|
+
white: {
|
1072
|
+
color: "$white"
|
1073
|
+
},
|
1074
|
+
black: {
|
1075
|
+
color: "black"
|
1076
|
+
},
|
1077
|
+
primary: {
|
1078
|
+
color: "$dafaz400"
|
1079
|
+
},
|
1080
|
+
lightGray: {
|
1081
|
+
color: "$gray400"
|
1082
|
+
},
|
1083
|
+
darkGray: {
|
1084
|
+
color: "$gray800"
|
1085
|
+
}
|
850
1086
|
}
|
851
1087
|
},
|
852
1088
|
defaultVariants: {
|
853
|
-
size: "md"
|
1089
|
+
size: "md",
|
1090
|
+
color: "white"
|
854
1091
|
}
|
855
1092
|
});
|
856
1093
|
|
857
1094
|
// src/components/Text/index.tsx
|
858
|
-
var
|
1095
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
859
1096
|
function Text(_a) {
|
860
1097
|
var _b = _a, {
|
861
1098
|
children,
|
862
|
-
size
|
1099
|
+
size,
|
1100
|
+
color
|
863
1101
|
} = _b, props = __objRest(_b, [
|
864
1102
|
"children",
|
865
|
-
"size"
|
1103
|
+
"size",
|
1104
|
+
"color"
|
866
1105
|
]);
|
867
|
-
return /* @__PURE__ */ (0,
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TextUI, __spreadProps(__spreadValues({ size, color }, props), { children }));
|
868
1107
|
}
|
869
1108
|
Text.displayName = "Text";
|
870
1109
|
|
1110
|
+
// src/components/TextArea/index.tsx
|
1111
|
+
var import_react9 = require("react");
|
1112
|
+
|
871
1113
|
// src/components/TextArea/styles.ts
|
872
1114
|
var TextAreaUI = styled("textarea", {
|
873
1115
|
fontFamily: "$app",
|
@@ -875,6 +1117,7 @@ var TextAreaUI = styled("textarea", {
|
|
875
1117
|
color: "$white",
|
876
1118
|
fontWeight: "$regular",
|
877
1119
|
resize: "vertical",
|
1120
|
+
boxShadow: "0 3px 2px -2px $colors$gray400",
|
878
1121
|
border: "0.7px solid $gray400",
|
879
1122
|
margin: 0,
|
880
1123
|
backgroundColor: "transparent",
|
@@ -885,8 +1128,10 @@ var TextAreaUI = styled("textarea", {
|
|
885
1128
|
alignItems: "baseline",
|
886
1129
|
width: "100%",
|
887
1130
|
padding: "$1 $2",
|
1131
|
+
transition: "border 0.2s linear",
|
888
1132
|
"&:focus": {
|
889
|
-
outline: 0
|
1133
|
+
outline: 0,
|
1134
|
+
borderBottom: "2px solid $dafaz400"
|
890
1135
|
},
|
891
1136
|
"&:disabled": {
|
892
1137
|
opacity: 0.5,
|
@@ -901,19 +1146,26 @@ var TextAreaUI = styled("textarea", {
|
|
901
1146
|
});
|
902
1147
|
|
903
1148
|
// src/components/TextArea/index.tsx
|
904
|
-
var
|
905
|
-
|
906
|
-
var _b = _a, {
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
1149
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
1150
|
+
var TextArea = (0, import_react9.forwardRef)((_a, ref) => {
|
1151
|
+
var _b = _a, { id, disabled, placeholder, children } = _b, props = __objRest(_b, ["id", "disabled", "placeholder", "children"]);
|
1152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
1153
|
+
TextAreaUI,
|
1154
|
+
__spreadProps(__spreadValues({
|
1155
|
+
ref,
|
1156
|
+
rows: 3,
|
1157
|
+
id,
|
1158
|
+
placeholder,
|
1159
|
+
disabled
|
1160
|
+
}, props), {
|
1161
|
+
children
|
1162
|
+
})
|
1163
|
+
);
|
1164
|
+
});
|
913
1165
|
TextArea.displayName = "TextArea";
|
914
1166
|
|
915
1167
|
// src/components/TextInput/index.tsx
|
916
|
-
var
|
1168
|
+
var import_react10 = require("react");
|
917
1169
|
|
918
1170
|
// src/components/TextInput/styles.ts
|
919
1171
|
var InputContainer = styled("div", {
|
@@ -923,8 +1175,8 @@ var InputContainer = styled("div", {
|
|
923
1175
|
borderRadius: "$md",
|
924
1176
|
boxSizing: "border-box",
|
925
1177
|
display: "flex",
|
926
|
-
alignItems: "baseline",
|
927
1178
|
width: "100%",
|
1179
|
+
boxShadow: "0 3px 2px -2px $colors$gray400",
|
928
1180
|
transition: "border 0.2s linear",
|
929
1181
|
"&:has(input:focus)": {
|
930
1182
|
borderBottom: "2px solid $dafaz400"
|
@@ -933,7 +1185,41 @@ var InputContainer = styled("div", {
|
|
933
1185
|
opacity: 0.5,
|
934
1186
|
cursor: "not-allowed"
|
935
1187
|
},
|
1188
|
+
button: {
|
1189
|
+
border: 0,
|
1190
|
+
background: "none",
|
1191
|
+
marginRight: "0.5rem",
|
1192
|
+
cursor: "pointer",
|
1193
|
+
svg: {
|
1194
|
+
opacity: 0.75,
|
1195
|
+
color: "$white",
|
1196
|
+
marginBottom: "-0.3rem"
|
1197
|
+
}
|
1198
|
+
},
|
936
1199
|
variants: {
|
1200
|
+
size: {
|
1201
|
+
lg: {
|
1202
|
+
fontSize: "$xl",
|
1203
|
+
svg: {
|
1204
|
+
width: "$5",
|
1205
|
+
height: "$5"
|
1206
|
+
}
|
1207
|
+
},
|
1208
|
+
md: {
|
1209
|
+
fontSize: "$lg",
|
1210
|
+
svg: {
|
1211
|
+
width: "$5",
|
1212
|
+
height: "$5"
|
1213
|
+
}
|
1214
|
+
},
|
1215
|
+
sm: {
|
1216
|
+
fontSize: "$md",
|
1217
|
+
svg: {
|
1218
|
+
width: "$4",
|
1219
|
+
height: "$4"
|
1220
|
+
}
|
1221
|
+
}
|
1222
|
+
},
|
937
1223
|
withShadow: {
|
938
1224
|
true: {
|
939
1225
|
boxShadow: "inset 0 3rem #444"
|
@@ -941,20 +1227,23 @@ var InputContainer = styled("div", {
|
|
941
1227
|
}
|
942
1228
|
},
|
943
1229
|
defaultVariants: {
|
1230
|
+
size: "lg",
|
944
1231
|
withShadow: false
|
945
1232
|
}
|
946
1233
|
});
|
947
1234
|
var InputUI = styled("input", {
|
948
1235
|
margin: 0,
|
949
1236
|
fontFamily: "$app",
|
950
|
-
fontSize: "$xl",
|
951
1237
|
color: "$white",
|
952
1238
|
backgroundColor: "transparent",
|
953
1239
|
border: "none",
|
954
1240
|
width: "100%",
|
955
1241
|
padding: "$1 $2",
|
956
1242
|
"&::-ms-reveal": {
|
957
|
-
|
1243
|
+
display: "none"
|
1244
|
+
},
|
1245
|
+
"&::-ms-clear": {
|
1246
|
+
display: "none"
|
958
1247
|
},
|
959
1248
|
"&::placeholder": {
|
960
1249
|
fontWeight: "$regular",
|
@@ -963,6 +1252,22 @@ var InputUI = styled("input", {
|
|
963
1252
|
},
|
964
1253
|
"&:focus": {
|
965
1254
|
outline: 0
|
1255
|
+
},
|
1256
|
+
variants: {
|
1257
|
+
size: {
|
1258
|
+
lg: {
|
1259
|
+
fontSize: "$xl"
|
1260
|
+
},
|
1261
|
+
md: {
|
1262
|
+
fontSize: "$lg"
|
1263
|
+
},
|
1264
|
+
sm: {
|
1265
|
+
fontSize: "$md"
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
},
|
1269
|
+
defaultVariants: {
|
1270
|
+
size: "lg"
|
966
1271
|
}
|
967
1272
|
});
|
968
1273
|
var Sufix = styled("span", {
|
@@ -977,21 +1282,27 @@ var Sufix = styled("span", {
|
|
977
1282
|
});
|
978
1283
|
|
979
1284
|
// src/components/TextInput/index.tsx
|
980
|
-
var
|
981
|
-
var
|
1285
|
+
var import_react11 = require("@phosphor-icons/react");
|
1286
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
1287
|
+
var TextInput = (0, import_react10.forwardRef)(
|
982
1288
|
(_a, ref) => {
|
983
1289
|
var _b = _a, {
|
984
1290
|
withShadow = false,
|
985
1291
|
required = true,
|
986
1292
|
requiredText = "Opcional",
|
987
|
-
id
|
1293
|
+
id,
|
1294
|
+
type = "text",
|
1295
|
+
size
|
988
1296
|
} = _b, props = __objRest(_b, [
|
989
1297
|
"withShadow",
|
990
1298
|
"required",
|
991
1299
|
"requiredText",
|
992
|
-
"id"
|
1300
|
+
"id",
|
1301
|
+
"type",
|
1302
|
+
"size"
|
993
1303
|
]);
|
994
|
-
const [hiddenOptional, setHiddenOptional] = (0,
|
1304
|
+
const [hiddenOptional, setHiddenOptional] = (0, import_react10.useState)(required);
|
1305
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react10.useState)(false);
|
995
1306
|
function handleOnChange(event) {
|
996
1307
|
if (!required) {
|
997
1308
|
if (event.target.value === "") {
|
@@ -1001,21 +1312,339 @@ var TextInput = (0, import_react6.forwardRef)(
|
|
1001
1312
|
}
|
1002
1313
|
}
|
1003
1314
|
}
|
1004
|
-
return /* @__PURE__ */ (0,
|
1005
|
-
/* @__PURE__ */ (0,
|
1006
|
-
|
1315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(InputContainer, { size, withShadow, children: [
|
1316
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
1317
|
+
InputUI,
|
1318
|
+
__spreadValues({
|
1319
|
+
id,
|
1320
|
+
ref,
|
1321
|
+
size,
|
1322
|
+
onChange: handleOnChange,
|
1323
|
+
type: !isPasswordVisible ? type : "text"
|
1324
|
+
}, props)
|
1325
|
+
),
|
1326
|
+
!hiddenOptional && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Sufix, { style: { marginLeft: `-${requiredText.length / 2}rem` }, children: requiredText }),
|
1327
|
+
type === "password" && isPasswordVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
1328
|
+
"button",
|
1329
|
+
{
|
1330
|
+
type: "button",
|
1331
|
+
onClick: () => {
|
1332
|
+
setIsPasswordVisible(false);
|
1333
|
+
},
|
1334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.EyeSlash, { size: 24 })
|
1335
|
+
}
|
1336
|
+
),
|
1337
|
+
type === "password" && !isPasswordVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
1338
|
+
"button",
|
1339
|
+
{
|
1340
|
+
type: "button",
|
1341
|
+
onClick: () => {
|
1342
|
+
setIsPasswordVisible(true);
|
1343
|
+
},
|
1344
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.Eye, { size: 24 })
|
1345
|
+
}
|
1346
|
+
)
|
1007
1347
|
] });
|
1008
1348
|
}
|
1009
1349
|
);
|
1010
1350
|
TextInput.displayName = "TextInput";
|
1351
|
+
|
1352
|
+
// src/components/MultiSelect/index.tsx
|
1353
|
+
var import_react12 = require("@phosphor-icons/react");
|
1354
|
+
|
1355
|
+
// src/components/MultiSelect/styles.ts
|
1356
|
+
var SelectUI2 = styled("div", {
|
1357
|
+
width: "100%",
|
1358
|
+
maxWidth: "24.5rem",
|
1359
|
+
position: "relative",
|
1360
|
+
display: "inline-block",
|
1361
|
+
fontFamily: "$app",
|
1362
|
+
color: "$white",
|
1363
|
+
fontWeight: "$regular",
|
1364
|
+
cursor: "pointer",
|
1365
|
+
margin: 0,
|
1366
|
+
backgroundColor: "transparent",
|
1367
|
+
borderBottom: "2px solid $dafaz600",
|
1368
|
+
borderRadius: "$md",
|
1369
|
+
boxSizing: "border-box",
|
1370
|
+
transition: "border 0.2s linear",
|
1371
|
+
padding: "$1 $2",
|
1372
|
+
boxShadow: "0 3px 2px -2px $colors$gray400",
|
1373
|
+
"&:hover": {
|
1374
|
+
borderBottom: "2px solid $dafaz400"
|
1375
|
+
},
|
1376
|
+
"&.clicked": {
|
1377
|
+
borderBottom: "2px solid $dafaz400",
|
1378
|
+
"&:hover": {
|
1379
|
+
"> div": {
|
1380
|
+
display: "flex",
|
1381
|
+
flexDirection: "column",
|
1382
|
+
alignItems: "start",
|
1383
|
+
gap: "$3"
|
1384
|
+
}
|
1385
|
+
}
|
1386
|
+
},
|
1387
|
+
variants: {
|
1388
|
+
disabled: {
|
1389
|
+
true: {
|
1390
|
+
opacity: 0.5,
|
1391
|
+
cursor: "not-allowed"
|
1392
|
+
}
|
1393
|
+
},
|
1394
|
+
size: {
|
1395
|
+
lg: {
|
1396
|
+
fontSize: "$xl",
|
1397
|
+
svg: {
|
1398
|
+
width: "$5",
|
1399
|
+
height: "$5"
|
1400
|
+
}
|
1401
|
+
},
|
1402
|
+
md: {
|
1403
|
+
fontSize: "$lg",
|
1404
|
+
svg: {
|
1405
|
+
width: "$4",
|
1406
|
+
height: "$4"
|
1407
|
+
}
|
1408
|
+
},
|
1409
|
+
sm: {
|
1410
|
+
fontSize: "$md",
|
1411
|
+
svg: {
|
1412
|
+
width: "$3",
|
1413
|
+
height: "$3"
|
1414
|
+
}
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
},
|
1418
|
+
defaultVariants: {
|
1419
|
+
disabled: false,
|
1420
|
+
size: "lg"
|
1421
|
+
}
|
1422
|
+
});
|
1423
|
+
var SelectContainerUI = styled("div", {
|
1424
|
+
marginTop: "0.4rem",
|
1425
|
+
marginLeft: "-0.5rem",
|
1426
|
+
padding: "$3 $2",
|
1427
|
+
border: "1px solid $gray400",
|
1428
|
+
boxSizing: "border-box",
|
1429
|
+
borderRadius: "$md",
|
1430
|
+
display: "none",
|
1431
|
+
position: "absolute",
|
1432
|
+
zIndex: 999,
|
1433
|
+
minWidth: "100%",
|
1434
|
+
maxWidth: "24.5rem",
|
1435
|
+
background: "$gray800",
|
1436
|
+
fontFamily: "$app",
|
1437
|
+
color: "$white",
|
1438
|
+
fontWeight: "$regular",
|
1439
|
+
cursor: "pointer",
|
1440
|
+
"&:hover": {
|
1441
|
+
display: "flex",
|
1442
|
+
flexDirection: "column",
|
1443
|
+
alignItems: "start",
|
1444
|
+
gap: "$3"
|
1445
|
+
}
|
1446
|
+
});
|
1447
|
+
|
1448
|
+
// src/components/MultiSelect/index.tsx
|
1449
|
+
var import_react13 = require("react");
|
1450
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
1451
|
+
var MultiSelect = (0, import_react13.forwardRef)(
|
1452
|
+
(_a, ref) => {
|
1453
|
+
var _b = _a, { id, size, items, placeholder, onChange } = _b, props = __objRest(_b, ["id", "size", "items", "placeholder", "onChange"]);
|
1454
|
+
const [values, setValues] = (0, import_react13.useState)([
|
1455
|
+
{ id: "", label: "", value: "", isChecked: false }
|
1456
|
+
]);
|
1457
|
+
const [selectedValue, setSelectedValue] = (0, import_react13.useState)([""]);
|
1458
|
+
const [clickClass, setClickClass] = (0, import_react13.useState)(false);
|
1459
|
+
(0, import_react13.useEffect)(() => {
|
1460
|
+
items.map(
|
1461
|
+
(item) => setValues((state) => {
|
1462
|
+
const values2 = state.filter((item2) => item2.id !== "");
|
1463
|
+
return [
|
1464
|
+
...values2,
|
1465
|
+
{
|
1466
|
+
id: item.id,
|
1467
|
+
label: item.label,
|
1468
|
+
value: item.value,
|
1469
|
+
isChecked: false
|
1470
|
+
}
|
1471
|
+
].sort((a, b) => a.label > b.label ? 1 : -1);
|
1472
|
+
})
|
1473
|
+
);
|
1474
|
+
}, [items]);
|
1475
|
+
(0, import_react13.useEffect)(() => {
|
1476
|
+
setClickClass(false);
|
1477
|
+
values.map((item) => {
|
1478
|
+
if (item.isChecked) {
|
1479
|
+
setSelectedValue((state) => {
|
1480
|
+
const alreadyChecked = state.find((obj) => obj === item.value);
|
1481
|
+
if (alreadyChecked) {
|
1482
|
+
return state;
|
1483
|
+
} else {
|
1484
|
+
return [...state, item.value];
|
1485
|
+
}
|
1486
|
+
});
|
1487
|
+
} else {
|
1488
|
+
setSelectedValue((state) => {
|
1489
|
+
const itemsChecked2 = state.filter((obj) => obj !== item.value);
|
1490
|
+
return itemsChecked2;
|
1491
|
+
});
|
1492
|
+
}
|
1493
|
+
});
|
1494
|
+
}, [values, items, setValues]);
|
1495
|
+
function handleOnValueChange(id2) {
|
1496
|
+
setClickClass(() => false);
|
1497
|
+
setValues((state) => {
|
1498
|
+
const items2 = state.filter((item2) => item2.id !== id2);
|
1499
|
+
const item = state.find((item2) => item2.id === id2);
|
1500
|
+
if (item) {
|
1501
|
+
return [
|
1502
|
+
{
|
1503
|
+
id: item.id,
|
1504
|
+
label: item.label,
|
1505
|
+
value: item.value,
|
1506
|
+
isChecked: !item.isChecked
|
1507
|
+
},
|
1508
|
+
...items2
|
1509
|
+
].sort((a, b) => a.label > b.label ? 1 : -1);
|
1510
|
+
}
|
1511
|
+
return state;
|
1512
|
+
});
|
1513
|
+
values.map((item) => {
|
1514
|
+
if (item.isChecked) {
|
1515
|
+
setSelectedValue((state) => {
|
1516
|
+
const alreadyChecked = state.find((obj) => obj === item.value);
|
1517
|
+
if (alreadyChecked) {
|
1518
|
+
return state;
|
1519
|
+
} else {
|
1520
|
+
return [...state, item.value];
|
1521
|
+
}
|
1522
|
+
});
|
1523
|
+
} else {
|
1524
|
+
setSelectedValue((state) => {
|
1525
|
+
const itemsChecked2 = state.filter((obj) => obj !== item.value);
|
1526
|
+
return itemsChecked2;
|
1527
|
+
});
|
1528
|
+
}
|
1529
|
+
});
|
1530
|
+
}
|
1531
|
+
function handleOnClick() {
|
1532
|
+
setClickClass((state) => !state);
|
1533
|
+
}
|
1534
|
+
function handleRemoveItem(e, id2) {
|
1535
|
+
handleOnValueChange(id2);
|
1536
|
+
}
|
1537
|
+
function updateSelectComponent(item) {
|
1538
|
+
const checkedItem = selectedValue.find((obj) => obj === item);
|
1539
|
+
if (checkedItem) {
|
1540
|
+
return selectedValue.filter((obj) => obj !== item);
|
1541
|
+
} else {
|
1542
|
+
return [...selectedValue.filter((obj) => obj !== ""), item].sort(
|
1543
|
+
(a, b) => a > b ? 1 : -1
|
1544
|
+
);
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
const itemsChecked = values.filter((item) => item.isChecked === true).sort((a, b) => a.label > b.label ? 1 : -1);
|
1548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
1549
|
+
SelectUI2,
|
1550
|
+
__spreadProps(__spreadValues({
|
1551
|
+
ref,
|
1552
|
+
id,
|
1553
|
+
size,
|
1554
|
+
onClick: handleOnClick,
|
1555
|
+
onBlur: handleOnClick,
|
1556
|
+
value: selectedValue,
|
1557
|
+
onChange,
|
1558
|
+
className: clickClass ? "clicked" : ""
|
1559
|
+
}, props), {
|
1560
|
+
children: [
|
1561
|
+
itemsChecked.length > 0 && itemsChecked.map((item) => {
|
1562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
1563
|
+
"div",
|
1564
|
+
{
|
1565
|
+
style: {
|
1566
|
+
display: "flex",
|
1567
|
+
justifyContent: "space-between",
|
1568
|
+
width: "100%",
|
1569
|
+
marginTop: "0.2rem",
|
1570
|
+
alignItems: "center"
|
1571
|
+
},
|
1572
|
+
children: [
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: item.label }),
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
1575
|
+
"button",
|
1576
|
+
{
|
1577
|
+
style: {
|
1578
|
+
all: "unset",
|
1579
|
+
display: "flex",
|
1580
|
+
alignItems: "center",
|
1581
|
+
paddingLeft: "1rem"
|
1582
|
+
},
|
1583
|
+
type: "button",
|
1584
|
+
onClick: (e) => handleRemoveItem(e, item.id),
|
1585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.X, { size: 24, weight: "bold" })
|
1586
|
+
}
|
1587
|
+
)
|
1588
|
+
]
|
1589
|
+
}
|
1590
|
+
) }, `opt:${item.id}`);
|
1591
|
+
}) || itemsChecked.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
1592
|
+
"div",
|
1593
|
+
{
|
1594
|
+
style: {
|
1595
|
+
display: "flex",
|
1596
|
+
justifyContent: "space-between",
|
1597
|
+
width: "100%",
|
1598
|
+
alignItems: "center"
|
1599
|
+
},
|
1600
|
+
children: [
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { opacity: 0.75 }, children: placeholder }),
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
1603
|
+
"span",
|
1604
|
+
{
|
1605
|
+
style: {
|
1606
|
+
display: "flex",
|
1607
|
+
alignItems: "center",
|
1608
|
+
paddingLeft: "1rem"
|
1609
|
+
},
|
1610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react12.CaretDown, { size: 24, weight: "bold" })
|
1611
|
+
}
|
1612
|
+
)
|
1613
|
+
]
|
1614
|
+
}
|
1615
|
+
) }),
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectContainerUI, { onMouseOutCapture: handleOnClick, children: values.map((item) => {
|
1617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
1618
|
+
CheckBox,
|
1619
|
+
{
|
1620
|
+
name: `chk${item.id}`,
|
1621
|
+
size,
|
1622
|
+
label: item.label,
|
1623
|
+
checked: item.isChecked,
|
1624
|
+
value: updateSelectComponent(item.value),
|
1625
|
+
handleOnChange: () => __async(void 0, null, function* () {
|
1626
|
+
handleOnValueChange(item.id);
|
1627
|
+
})
|
1628
|
+
},
|
1629
|
+
item.id
|
1630
|
+
);
|
1631
|
+
}) })
|
1632
|
+
]
|
1633
|
+
})
|
1634
|
+
);
|
1635
|
+
}
|
1636
|
+
);
|
1637
|
+
MultiSelect.displayName = "MultiSelect";
|
1011
1638
|
// Annotate the CommonJS export names for ESM import in node:
|
1012
1639
|
0 && (module.exports = {
|
1013
1640
|
Box,
|
1014
1641
|
Button,
|
1015
1642
|
CheckBox,
|
1016
1643
|
Heading,
|
1644
|
+
MultiSelect,
|
1017
1645
|
Radio,
|
1018
1646
|
Select,
|
1647
|
+
Separator,
|
1019
1648
|
Text,
|
1020
1649
|
TextArea,
|
1021
1650
|
TextInput,
|