@dafaz-ui/react 4.0.19 → 7.0.0

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