@dafaz-ui/react 2.2.1 → 3.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
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __defProps = Object.defineProperties;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
8
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
11
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
12
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -44,6 +46,14 @@ var __copyProps = (to, from, except, desc) => {
44
46
  }
45
47
  return to;
46
48
  };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
+ // If the importer is in node compatibility mode or this is not an ESM
51
+ // file that has been converted to a CommonJS file using a Babel-
52
+ // compatible transform (i.e. "__esModule" has not been set), then set
53
+ // "default" to the CommonJS "module.exports" for node compatibility.
54
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
+ mod
56
+ ));
47
57
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
58
 
49
59
  // src/index.tsx
@@ -51,8 +61,11 @@ var src_exports = {};
51
61
  __export(src_exports, {
52
62
  Box: () => Box,
53
63
  Button: () => Button,
64
+ CheckBox: () => CheckBox,
54
65
  Heading: () => Heading,
66
+ Radio: () => Radio,
55
67
  Text: () => Text,
68
+ TextArea: () => TextArea,
56
69
  TextInput: () => TextInput,
57
70
  config: () => config,
58
71
  createTheme: () => createTheme,
@@ -197,6 +210,7 @@ function Box(_a) {
197
210
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
198
211
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxUI, __spreadProps(__spreadValues({}, props), { children }));
199
212
  }
213
+ Box.displayName = "Box";
200
214
 
201
215
  // src/components/Button/styles.ts
202
216
  var ButtonUI = styled("button", {
@@ -304,41 +318,134 @@ function Button(_a) {
304
318
  }
305
319
  ButtonUI.displayName = "Button";
306
320
 
307
- // src/components/Text/styles.ts
308
- var TextUI = styled("p", {
309
- fontFamily: "$web",
310
- lineHeight: "$base",
311
- margin: 0,
321
+ // src/components/CheckBox/styles.ts
322
+ var Checkbox = __toESM(require("@radix-ui/react-checkbox"));
323
+ var CheckBoxUI = styled(Checkbox.Root, {
324
+ all: "unset",
325
+ borderRadius: "$md",
326
+ lineHeight: 0,
327
+ cursor: "pointer",
328
+ overflow: "hidden",
329
+ boxSizing: "border-box",
330
+ display: "flex",
331
+ justifyContent: "center",
332
+ alignItems: "center",
333
+ borderBottom: "2px solid $dafaz600",
334
+ transition: "border 0.1s linear",
335
+ '&:focus,&[data-state="checked"]': {
336
+ backgroundColor: "$dafaz600",
337
+ borderColor: "$dafaz600"
338
+ },
339
+ '&[data-state="unchecked"]': {
340
+ backgroundColor: "$gray800"
341
+ },
342
+ "&:hover": {
343
+ borderColor: "$dafaz600"
344
+ },
345
+ variants: {
346
+ size: {
347
+ lg: {
348
+ width: "$7",
349
+ height: "$7",
350
+ borderBottom: "2px solid $dafaz600"
351
+ },
352
+ md: {
353
+ width: "$5",
354
+ height: "$5",
355
+ borderBottom: "1px solid $dafaz600"
356
+ },
357
+ sm: {
358
+ width: "$5",
359
+ height: "$5",
360
+ borderBottom: "0.5px solid $dafaz600"
361
+ }
362
+ }
363
+ },
364
+ defaultVariants: {
365
+ size: "lg"
366
+ }
367
+ });
368
+ var slideIn = keyframes({
369
+ from: { transform: "translateY(-100%)" },
370
+ to: { transform: "translateY(0)" }
371
+ });
372
+ var slideOut = keyframes({
373
+ from: { transform: "translateY(0)" },
374
+ to: { transform: "translateY(100%)" }
375
+ });
376
+ var CheckBoxIndicator = styled(Checkbox.Indicator, {
312
377
  color: "$white",
378
+ '&[data-state="checked"]': {
379
+ animation: `${slideIn} 200ms ease-out`
380
+ },
381
+ '&[data-state="unchecked"]': {
382
+ animation: `${slideOut} 200ms ease-out`
383
+ },
313
384
  variants: {
314
385
  size: {
315
- xxs: { fontSize: "$xxs" },
316
- xs: { fontSize: "$xs" },
317
- sm: { fontSize: "$sm" },
318
- md: { fontSize: "$md" },
319
- lg: { fontSize: "$lg" },
320
- xl: { fontSize: "$xl" },
321
- "2xl": { fontSize: "$2xl" }
386
+ lg: {
387
+ width: "$5",
388
+ height: "$5"
389
+ },
390
+ md: {
391
+ width: "$4",
392
+ height: "$4"
393
+ },
394
+ sm: {
395
+ width: "$3",
396
+ height: "$3"
397
+ }
322
398
  }
323
399
  },
324
400
  defaultVariants: {
325
- size: "md"
401
+ size: "lg"
402
+ }
403
+ });
404
+ var Label = styled("label", {
405
+ fontFamily: "$app",
406
+ lineHeight: 0,
407
+ color: "$white",
408
+ fontWeight: "$regular",
409
+ cursor: "pointer",
410
+ display: "flex",
411
+ gap: "$2",
412
+ alignItems: "center",
413
+ variants: {
414
+ size: {
415
+ lg: {
416
+ fontSize: "$xl"
417
+ },
418
+ md: {
419
+ fontSize: "$lg"
420
+ },
421
+ sm: {
422
+ fontSize: "$md"
423
+ }
424
+ }
425
+ },
426
+ defaultVariants: {
427
+ size: "lg"
326
428
  }
327
429
  });
328
430
 
329
- // src/components/Text/index.tsx
431
+ // src/components/CheckBox/index.tsx
432
+ var import_react2 = require("@phosphor-icons/react");
330
433
  var import_jsx_runtime3 = require("react/jsx-runtime");
331
- function Text(_a) {
434
+ function CheckBox(_a) {
332
435
  var _b = _a, {
333
- children,
334
- size = "md"
436
+ id,
437
+ label,
438
+ size
335
439
  } = _b, props = __objRest(_b, [
336
- "children",
440
+ "id",
441
+ "label",
337
442
  "size"
338
443
  ]);
339
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextUI, __spreadProps(__spreadValues({ size }, props), { children }));
444
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label, { htmlFor: id, size, children: [
445
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxUI, __spreadProps(__spreadValues({ id }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.Check, { weight: "bold" }) }) })),
446
+ label
447
+ ] });
340
448
  }
341
- Text.displayName = "Text";
342
449
 
343
450
  // src/components/Heading/styles.ts
344
451
  var HeadingUI = styled("h2", {
@@ -376,8 +483,257 @@ function Heading(_a) {
376
483
  }
377
484
  Heading.displayName = "Heading";
378
485
 
486
+ // src/components/Radio/styles.ts
487
+ var RadioGroup = __toESM(require("@radix-ui/react-radio-group"));
488
+ var RadioUI = styled(RadioGroup.Root, {
489
+ all: "unset",
490
+ display: "flex",
491
+ flexDirection: "column",
492
+ gap: "$4",
493
+ variants: {
494
+ size: {
495
+ lg: {},
496
+ md: {},
497
+ sm: {}
498
+ }
499
+ },
500
+ defaultVariants: {
501
+ size: "lg"
502
+ }
503
+ });
504
+
505
+ // src/components/Radio/RadioItem/index.tsx
506
+ var import_react3 = require("@phosphor-icons/react");
507
+
508
+ // src/components/Radio/RadioItem/styles.ts
509
+ var RadioGroup2 = __toESM(require("@radix-ui/react-radio-group"));
510
+ var RadioItemContainer = styled("div", {
511
+ display: "flex",
512
+ alignItems: "center",
513
+ gap: "$2"
514
+ });
515
+ var RadioItemUI = styled(RadioGroup2.Item, {
516
+ all: "unset",
517
+ borderRadius: "$full",
518
+ lineHeight: 0,
519
+ cursor: "pointer",
520
+ overflow: "hidden",
521
+ boxSizing: "border-box",
522
+ display: "flex",
523
+ justifyContent: "center",
524
+ alignItems: "center",
525
+ borderBottom: "2px solid $dafaz600",
526
+ transition: "border 0.1s linear",
527
+ '&:focus,&[data-state="checked"]': {
528
+ backgroundColor: "$dafaz600",
529
+ borderColor: "$dafaz600"
530
+ },
531
+ '&[data-state="unchecked"]': {
532
+ backgroundColor: "$gray800"
533
+ },
534
+ "&:hover": {
535
+ borderColor: "$dafaz600"
536
+ },
537
+ variants: {
538
+ size: {
539
+ lg: {
540
+ width: "$7",
541
+ height: "$7",
542
+ borderBottom: "2px solid $dafaz600"
543
+ },
544
+ md: {
545
+ width: "$5",
546
+ height: "$5",
547
+ borderBottom: "1px solid $dafaz600"
548
+ },
549
+ sm: {
550
+ width: "$5",
551
+ height: "$5",
552
+ borderBottom: "0.5px solid $dafaz600"
553
+ }
554
+ }
555
+ },
556
+ defaultVariants: {
557
+ size: "lg"
558
+ }
559
+ });
560
+ var slideIn2 = keyframes({
561
+ from: { transform: "translateY(-100%)" },
562
+ to: { transform: "translateY(0)" }
563
+ });
564
+ var slideOut2 = keyframes({
565
+ from: { transform: "translateY(0)" },
566
+ to: { transform: "translateY(100%)" }
567
+ });
568
+ var RadioIndicator = styled(RadioGroup2.Indicator, {
569
+ color: "$white",
570
+ '&[data-state="checked"]': {
571
+ animation: `${slideIn2} 200ms ease-out`
572
+ },
573
+ '&[data-state="unchecked"]': {
574
+ animation: `${slideOut2} 200ms ease-out`
575
+ },
576
+ variants: {
577
+ size: {
578
+ lg: {
579
+ width: "$5",
580
+ height: "$5"
581
+ },
582
+ md: {
583
+ width: "$4",
584
+ height: "$4"
585
+ },
586
+ sm: {
587
+ width: "$3",
588
+ height: "$3"
589
+ }
590
+ }
591
+ },
592
+ defaultVariants: {
593
+ size: "lg"
594
+ }
595
+ });
596
+ var Label2 = styled("label", {
597
+ fontFamily: "$app",
598
+ lineHeight: 0,
599
+ color: "$white",
600
+ fontWeight: "$regular",
601
+ cursor: "pointer",
602
+ variants: {
603
+ size: {
604
+ lg: {
605
+ fontSize: "$xl"
606
+ },
607
+ md: {
608
+ fontSize: "$lg"
609
+ },
610
+ sm: {
611
+ fontSize: "$md"
612
+ }
613
+ }
614
+ },
615
+ defaultVariants: {
616
+ size: "lg"
617
+ }
618
+ });
619
+
620
+ // src/components/Radio/RadioItem/index.tsx
621
+ var import_jsx_runtime5 = require("react/jsx-runtime");
622
+ function RadioItem(_a) {
623
+ var _b = _a, {
624
+ label,
625
+ id,
626
+ size
627
+ } = _b, props = __objRest(_b, [
628
+ "label",
629
+ "id",
630
+ "size"
631
+ ]);
632
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(RadioItemContainer, { children: [
633
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioItemUI, __spreadProps(__spreadValues({ id }, props), { size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react3.Check, { weight: "bold" }) }) })),
634
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label2, { htmlFor: id, size, children: label })
635
+ ] }, id);
636
+ }
637
+
638
+ // src/components/Radio/index.tsx
639
+ var import_jsx_runtime6 = require("react/jsx-runtime");
640
+ function Radio(_a) {
641
+ var _b = _a, { items, size } = _b, props = __objRest(_b, ["items", "size"]);
642
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadioUI, __spreadProps(__spreadValues({}, props), { children: items.map((item) => {
643
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
644
+ RadioItem,
645
+ {
646
+ id: item.id,
647
+ label: item.label,
648
+ value: item.value,
649
+ size
650
+ }
651
+ );
652
+ }) }));
653
+ }
654
+
655
+ // src/components/Text/styles.ts
656
+ var TextUI = styled("p", {
657
+ fontFamily: "$web",
658
+ lineHeight: "$base",
659
+ margin: 0,
660
+ color: "$white",
661
+ variants: {
662
+ size: {
663
+ xxs: { fontSize: "$xxs" },
664
+ xs: { fontSize: "$xs" },
665
+ sm: { fontSize: "$sm" },
666
+ md: { fontSize: "$md" },
667
+ lg: { fontSize: "$lg" },
668
+ xl: { fontSize: "$xl" },
669
+ "2xl": { fontSize: "$2xl" }
670
+ }
671
+ },
672
+ defaultVariants: {
673
+ size: "md"
674
+ }
675
+ });
676
+
677
+ // src/components/Text/index.tsx
678
+ var import_jsx_runtime7 = require("react/jsx-runtime");
679
+ function Text(_a) {
680
+ var _b = _a, {
681
+ children,
682
+ size = "md"
683
+ } = _b, props = __objRest(_b, [
684
+ "children",
685
+ "size"
686
+ ]);
687
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TextUI, __spreadProps(__spreadValues({ size }, props), { children }));
688
+ }
689
+ Text.displayName = "Text";
690
+
691
+ // src/components/TextArea/styles.ts
692
+ var TextAreaUI = styled("textarea", {
693
+ fontFamily: "$app",
694
+ fontSize: "$lg",
695
+ color: "$white",
696
+ fontWeight: "$regular",
697
+ resize: "vertical",
698
+ border: "0.7px solid $gray400",
699
+ margin: 0,
700
+ backgroundColor: "transparent",
701
+ borderBottom: "2px solid $dafaz600",
702
+ borderRadius: "$md",
703
+ boxSizing: "border-box",
704
+ display: "flex",
705
+ alignItems: "baseline",
706
+ width: "100%",
707
+ padding: "$1 $2",
708
+ "&:focus": {
709
+ outline: 0
710
+ },
711
+ "&:disabled": {
712
+ opacity: 0.5,
713
+ cursor: "not-allowed"
714
+ },
715
+ "&::placeholder": {
716
+ fontSize: "$xl",
717
+ fontWeight: "$regular",
718
+ color: "$white",
719
+ opacity: 0.75
720
+ }
721
+ });
722
+
723
+ // src/components/TextArea/index.tsx
724
+ var import_jsx_runtime8 = require("react/jsx-runtime");
725
+ function TextArea(_a) {
726
+ var _b = _a, {
727
+ children
728
+ } = _b, props = __objRest(_b, [
729
+ "children"
730
+ ]);
731
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TextAreaUI, __spreadProps(__spreadValues({ rows: 3 }, props), { children }));
732
+ }
733
+ TextArea.displayName = "TextArea";
734
+
379
735
  // src/components/TextInput/index.tsx
380
- var import_react2 = require("react");
736
+ var import_react4 = require("react");
381
737
 
382
738
  // src/components/TextInput/styles.ts
383
739
  var InputContainer = styled("div", {
@@ -388,7 +744,7 @@ var InputContainer = styled("div", {
388
744
  boxSizing: "border-box",
389
745
  display: "flex",
390
746
  alignItems: "baseline",
391
- padding: "$1 $2",
747
+ width: "100%",
392
748
  transition: "border 0.2s linear",
393
749
  "&:has(input:focus)": {
394
750
  borderBottom: "2px solid $dafaz400"
@@ -415,6 +771,8 @@ var InputUI = styled("input", {
415
771
  color: "$white",
416
772
  backgroundColor: "transparent",
417
773
  border: "none",
774
+ width: "100%",
775
+ padding: "$1 $2",
418
776
  "&::-ms-reveal": {
419
777
  filter: "invert(100%)"
420
778
  },
@@ -432,14 +790,15 @@ var Sufix = styled("span", {
432
790
  fontSize: "$sm",
433
791
  color: "$white",
434
792
  fontStyle: "italic",
793
+ marginRight: "$2",
435
794
  "&:has(input:focus)": {
436
795
  visibility: "hidden"
437
796
  }
438
797
  });
439
798
 
440
799
  // src/components/TextInput/index.tsx
441
- var import_jsx_runtime5 = require("react/jsx-runtime");
442
- var TextInput = (0, import_react2.forwardRef)(
800
+ var import_jsx_runtime9 = require("react/jsx-runtime");
801
+ var TextInput = (0, import_react4.forwardRef)(
443
802
  (_a, ref) => {
444
803
  var _b = _a, {
445
804
  withShadow = false,
@@ -450,7 +809,7 @@ var TextInput = (0, import_react2.forwardRef)(
450
809
  "required",
451
810
  "requiredText"
452
811
  ]);
453
- const [hiddenOptional, setHiddenOptional] = (0, import_react2.useState)(required);
812
+ const [hiddenOptional, setHiddenOptional] = (0, import_react4.useState)(required);
454
813
  function handleOnChange(event) {
455
814
  if (!required) {
456
815
  if (event.target.value === "") {
@@ -460,19 +819,22 @@ var TextInput = (0, import_react2.forwardRef)(
460
819
  }
461
820
  }
462
821
  }
463
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(InputContainer, { withShadow, children: [
464
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InputUI, __spreadValues({ ref, onChange: handleOnChange }, props)),
465
- !hiddenOptional && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Sufix, { style: { marginLeft: `-${requiredText.length / 2}rem` }, children: requiredText })
822
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InputContainer, { withShadow, children: [
823
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputUI, __spreadValues({ ref, onChange: handleOnChange }, props)),
824
+ !hiddenOptional && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Sufix, { style: { marginLeft: `-${requiredText.length / 2}rem` }, children: requiredText })
466
825
  ] });
467
826
  }
468
827
  );
469
- TextInput.displayName = "Input";
828
+ TextInput.displayName = "TextInput";
470
829
  // Annotate the CommonJS export names for ESM import in node:
471
830
  0 && (module.exports = {
472
831
  Box,
473
832
  Button,
833
+ CheckBox,
474
834
  Heading,
835
+ Radio,
475
836
  Text,
837
+ TextArea,
476
838
  TextInput,
477
839
  config,
478
840
  createTheme,