@koaris/bloom-ui 1.2.2 → 1.2.3

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.cjs CHANGED
@@ -1,37 +1,10 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
8
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
- var __objRest = (source, exclude) => {
24
- var target = {};
25
- for (var prop in source)
26
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
- target[prop] = source[prop];
28
- if (source != null && __getOwnPropSymbols)
29
- for (var prop of __getOwnPropSymbols(source)) {
30
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
- target[prop] = source[prop];
32
- }
33
- return target;
34
- };
35
8
  var __export = (target, all) => {
36
9
  for (var name in all)
37
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -44,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
44
17
  }
45
18
  return to;
46
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
47
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
29
 
49
30
  // src/index.tsx
@@ -58,11 +39,20 @@ __export(index_exports, {
58
39
  Heading: () => Heading,
59
40
  Input: () => Input,
60
41
  Link: () => Link,
42
+ Loading: () => Loading,
43
+ Modal: () => Modal,
61
44
  MultiStep: () => MultiStep,
62
45
  RadioGroup: () => RadioGroup,
46
+ Skeleton: () => Skeleton,
63
47
  Text: () => Text,
64
48
  TextArea: () => TextArea,
65
- TextInput: () => TextInput
49
+ TextInput: () => TextInput,
50
+ Toast: () => Toast,
51
+ ToastContainer: () => ToastContainer,
52
+ ToastContext: () => ToastContext,
53
+ ToastProvider: () => ToastProvider,
54
+ Toggle: () => Toggle,
55
+ useToast: () => useToast
66
56
  });
67
57
  module.exports = __toCommonJS(index_exports);
68
58
 
@@ -94,7 +84,6 @@ var createClassGroupUtils = (config) => {
94
84
  };
95
85
  };
96
86
  var getGroupRecursive = (classParts, classPartObject) => {
97
- var _a;
98
87
  if (classParts.length === 0) {
99
88
  return classPartObject.classGroupId;
100
89
  }
@@ -108,15 +97,15 @@ var getGroupRecursive = (classParts, classPartObject) => {
108
97
  return void 0;
109
98
  }
110
99
  const classRest = classParts.join(CLASS_PART_SEPARATOR);
111
- return (_a = classPartObject.validators.find(({
100
+ return classPartObject.validators.find(({
112
101
  validator
113
- }) => validator(classRest))) == null ? void 0 : _a.classGroupId;
102
+ }) => validator(classRest))?.classGroupId;
114
103
  };
115
104
  var arbitraryPropertyRegex = /^\[(.+)\]$/;
116
105
  var getGroupIdForArbitraryProperty = (className) => {
117
106
  if (arbitraryPropertyRegex.test(className)) {
118
107
  const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
119
- const property = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(":"));
108
+ const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
120
109
  if (property) {
121
110
  return "arbitrary.." + property;
122
111
  }
@@ -301,10 +290,11 @@ var sortModifiers = (modifiers) => {
301
290
  sortedModifiers.push(...unsortedModifiers.sort());
302
291
  return sortedModifiers;
303
292
  };
304
- var createConfigUtils = (config) => __spreadValues({
293
+ var createConfigUtils = (config) => ({
305
294
  cache: createLruCache(config.cacheSize),
306
- parseClassName: createParseClassName(config)
307
- }, createClassGroupUtils(config));
295
+ parseClassName: createParseClassName(config),
296
+ ...createClassGroupUtils(config)
297
+ });
308
298
  var SPLIT_CLASSES_REGEX = /\s+/;
309
299
  var mergeClassList = (classList, configUtils) => {
310
300
  const {
@@ -2528,50 +2518,97 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
2528
2518
 
2529
2519
  // src/components/Card/index.tsx
2530
2520
  var import_jsx_runtime = require("react/jsx-runtime");
2531
- var Card = (_a) => {
2532
- var _b = _a, {
2533
- className,
2534
- selected = false,
2535
- direction,
2536
- size,
2537
- disabled,
2538
- imageSize,
2539
- onClick
2540
- } = _b, rest = __objRest(_b, [
2541
- "className",
2542
- "selected",
2543
- "direction",
2544
- "size",
2545
- "disabled",
2546
- "imageSize",
2547
- "onClick"
2548
- ]);
2521
+ var Card = ({
2522
+ className,
2523
+ selected = false,
2524
+ direction = "row",
2525
+ size = "medium",
2526
+ disabled = false,
2527
+ image,
2528
+ imageSize = "100px",
2529
+ imageAlt = "",
2530
+ title,
2531
+ content,
2532
+ onClick,
2533
+ footer,
2534
+ hoverable = true,
2535
+ ...rest
2536
+ }) => {
2537
+ const handleClick = () => {
2538
+ if (!disabled && onClick) {
2539
+ onClick();
2540
+ }
2541
+ };
2542
+ const cardSizeClasses = {
2543
+ small: "max-w-xs p-3",
2544
+ medium: "max-w-md p-4",
2545
+ large: "max-w-lg p-5",
2546
+ full: "w-full p-5"
2547
+ };
2549
2548
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2550
2549
  "div",
2551
2550
  {
2552
2551
  className: twMerge(
2553
- "flex items-center justify-center rounded-lg cursor-pointer bg-neutral",
2554
- "hover:shadow-md hover:shadow-neutral-500 border border-neutral-500 text-neutral-1000",
2555
- size === "medium" && "w-64 px-8 py-4",
2556
- size === "large" && "w-96 pr-5",
2557
- direction === "col" && "flex-col",
2558
- selected === true && "border-2 border-orange-500",
2559
- disabled === true && "opacity-50 cursor-not-allowed",
2552
+ "flex items-center rounded-lg bg-neutral border border-neutral-500 text-neutral-1000 transition-all duration-200",
2553
+ direction === "col" ? "flex-col" : "flex-row",
2554
+ cardSizeClasses[size],
2555
+ hoverable && !disabled && "hover:shadow-md hover:shadow-neutral-500",
2556
+ selected && "border-2 border-orange-500",
2557
+ disabled && "opacity-50 cursor-not-allowed",
2558
+ onClick && !disabled && "cursor-pointer",
2560
2559
  className
2561
2560
  ),
2562
- onClick,
2561
+ onClick: handleClick,
2562
+ role: onClick && !disabled ? "button" : void 0,
2563
+ tabIndex: onClick && !disabled ? 0 : void 0,
2564
+ onKeyDown: (e) => {
2565
+ if ((e.key === "Enter" || e.key === " ") && onClick && !disabled) {
2566
+ e.preventDefault();
2567
+ onClick();
2568
+ }
2569
+ },
2570
+ "aria-disabled": disabled,
2571
+ ...rest,
2563
2572
  children: [
2564
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: rest.image, alt: rest.title, width: imageSize, height: "auto" }),
2573
+ image && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2574
+ "div",
2575
+ {
2576
+ className: twMerge(
2577
+ "flex-shrink-0",
2578
+ direction === "row" ? "mr-4" : "mb-4",
2579
+ size === "small" && direction === "row" ? "mr-3" : "",
2580
+ size === "small" && direction === "col" ? "mb-3" : ""
2581
+ ),
2582
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2583
+ "img",
2584
+ {
2585
+ src: image,
2586
+ alt: imageAlt,
2587
+ width: imageSize,
2588
+ height: "auto",
2589
+ className: "rounded object-cover"
2590
+ }
2591
+ )
2592
+ }
2593
+ ),
2565
2594
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2566
- "aside",
2595
+ "div",
2567
2596
  {
2568
2597
  className: twMerge(
2569
- direction === "col" && "text-center",
2570
- "flex flex-col gap-2"
2598
+ "flex flex-col",
2599
+ direction === "col" && "text-center w-full",
2600
+ direction === "row" && "flex-1"
2571
2601
  ),
2572
2602
  children: [
2573
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-xl font-bold font-default leading-tight", children: rest.title }),
2574
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-justify", children: rest.content })
2603
+ title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-xl font-bold font-default leading-tight mb-2", children: title }),
2604
+ content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: twMerge(
2605
+ "text-base",
2606
+ direction === "col" ? "text-center" : "text-left"
2607
+ ), children: content }),
2608
+ footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: twMerge(
2609
+ "mt-4 pt-3 border-t border-neutral-300",
2610
+ direction === "col" ? "text-center" : "text-left"
2611
+ ), children: footer })
2575
2612
  ]
2576
2613
  }
2577
2614
  )
@@ -2579,72 +2616,130 @@ var Card = (_a) => {
2579
2616
  }
2580
2617
  );
2581
2618
  };
2619
+ Card.displayName = "Card";
2582
2620
 
2583
2621
  // src/components/Button/index.tsx
2622
+ var import_react = require("react");
2584
2623
  var import_jsx_runtime2 = require("react/jsx-runtime");
2585
- var Button = (_a) => {
2586
- var _b = _a, {
2624
+ var Button = (0, import_react.forwardRef)(
2625
+ ({
2587
2626
  className,
2588
2627
  variant = "primary",
2589
2628
  size = "md",
2590
- disabled,
2591
- onClick
2592
- } = _b, rest = __objRest(_b, [
2593
- "className",
2594
- "variant",
2595
- "size",
2596
- "disabled",
2597
- "onClick"
2598
- ]);
2599
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2600
- "button",
2601
- __spreadValues({
2602
- className: twMerge(
2603
- "flex gap-4 items-center justify-center rounded-sm px-8 py-2 text-md font-medium hover:shadow-md hover:shadow-neutral-500 w-full max-w-[180px]",
2604
- variant === "primary" && "bg-orange-500 text-neutral hover:bg-orange-700",
2605
- variant === "secondary" && "bg-neutral text-orange-500 border border-orange-500 hover:text-orange-100 hover:bg-orange-500",
2606
- size === "sm" && "px-6 py-1",
2607
- typeof rest.children !== "string" && "px-4",
2608
- disabled === true && "opacity-50 cursor-not-allowed",
2609
- className
2610
- ),
2611
- onClick
2612
- }, rest)
2613
- );
2614
- };
2629
+ disabled = false,
2630
+ loading = false,
2631
+ startIcon,
2632
+ endIcon,
2633
+ fullWidth = false,
2634
+ onClick,
2635
+ children,
2636
+ ...rest
2637
+ }, ref) => {
2638
+ const sizeClasses = {
2639
+ xs: "px-3 py-1 text-xs",
2640
+ sm: "px-5 py-1.5 text-sm",
2641
+ md: "px-6 py-2 text-md",
2642
+ lg: "px-8 py-3 text-lg"
2643
+ };
2644
+ const variantClasses = {
2645
+ primary: "bg-orange-500 text-neutral hover:bg-orange-700 focus:ring-orange-500",
2646
+ secondary: "bg-neutral text-orange-500 border border-orange-500 hover:text-neutral hover:bg-orange-500 focus:ring-orange-500",
2647
+ outline: "bg-transparent text-orange-500 border border-orange-500 hover:bg-orange-50 focus:ring-orange-500",
2648
+ ghost: "bg-transparent text-orange-500 hover:bg-orange-50 focus:ring-orange-500",
2649
+ link: "bg-transparent text-orange-500 hover:underline p-0 h-auto shadow-none focus:ring-0"
2650
+ };
2651
+ const handleClick = (e) => {
2652
+ if (loading || disabled) return;
2653
+ onClick?.(e);
2654
+ };
2655
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2656
+ "button",
2657
+ {
2658
+ ref,
2659
+ className: twMerge(
2660
+ "relative font-medium rounded-sm transition-all duration-200",
2661
+ "focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-opacity-50",
2662
+ variantClasses[variant],
2663
+ sizeClasses[size],
2664
+ fullWidth ? "w-full" : "max-w-[180px]",
2665
+ "inline-flex items-center justify-center gap-2",
2666
+ (disabled || loading) && "opacity-50 cursor-not-allowed hover:shadow-none hover:bg-opacity-100",
2667
+ className
2668
+ ),
2669
+ onClick: handleClick,
2670
+ disabled: disabled || loading,
2671
+ ...rest,
2672
+ children: [
2673
+ loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2674
+ "svg",
2675
+ {
2676
+ className: "animate-spin h-5 w-5",
2677
+ viewBox: "0 0 24 24",
2678
+ fill: "none",
2679
+ xmlns: "http://www.w3.org/2000/svg",
2680
+ children: [
2681
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2682
+ "circle",
2683
+ {
2684
+ className: "opacity-25",
2685
+ cx: "12",
2686
+ cy: "12",
2687
+ r: "10",
2688
+ stroke: "currentColor",
2689
+ strokeWidth: "4"
2690
+ }
2691
+ ),
2692
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2693
+ "path",
2694
+ {
2695
+ className: "opacity-75",
2696
+ fill: "currentColor",
2697
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
2698
+ }
2699
+ )
2700
+ ]
2701
+ }
2702
+ ) }),
2703
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: loading ? "invisible" : "flex items-center gap-2", children: [
2704
+ startIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-1", children: startIcon }),
2705
+ children,
2706
+ endIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-1", children: endIcon })
2707
+ ] })
2708
+ ]
2709
+ }
2710
+ );
2711
+ }
2712
+ );
2713
+ Button.displayName = "Button";
2615
2714
 
2616
2715
  // src/components/Link/index.tsx
2617
2716
  var import_jsx_runtime3 = require("react/jsx-runtime");
2618
- var Link = (_a) => {
2619
- var _b = _a, {
2620
- className,
2621
- disabled,
2622
- url,
2623
- newPage = true,
2624
- onClick
2625
- } = _b, rest = __objRest(_b, [
2626
- "className",
2627
- "disabled",
2628
- "url",
2629
- "newPage",
2630
- "onClick"
2631
- ]);
2717
+ var Link = ({
2718
+ className,
2719
+ disabled,
2720
+ url,
2721
+ newPage = true,
2722
+ onClick,
2723
+ ...rest
2724
+ }) => {
2632
2725
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2633
2726
  "a",
2634
- __spreadValues(__spreadValues({
2727
+ {
2635
2728
  className: twMerge(
2636
2729
  "text-blue-800 font-bold",
2637
2730
  typeof rest.children !== "string" && "px-4",
2638
2731
  disabled === true && "opacity-50 cursor-not-allowed",
2639
2732
  className
2640
2733
  ),
2641
- href: url
2642
- }, newPage && { target: "_blank", rel: "noopener noreferrer" }), rest)
2734
+ href: url,
2735
+ ...newPage && { target: "_blank", rel: "noopener noreferrer" },
2736
+ ...rest
2737
+ }
2643
2738
  );
2644
2739
  };
2645
2740
 
2646
2741
  // src/components/RadioGroup/index.tsx
2647
- var import_react = require("react");
2742
+ var import_react2 = require("react");
2648
2743
  var import_fi = require("react-icons/fi");
2649
2744
  var import_jsx_runtime4 = require("react/jsx-runtime");
2650
2745
  var RadioGroup = ({
@@ -2656,7 +2751,7 @@ var RadioGroup = ({
2656
2751
  required = false,
2657
2752
  className
2658
2753
  }) => {
2659
- const [selectedOption, setSelectedOption] = (0, import_react.useState)("");
2754
+ const [selectedOption, setSelectedOption] = (0, import_react2.useState)("");
2660
2755
  const handleOptionChange = (value) => {
2661
2756
  setSelectedOption(value);
2662
2757
  };
@@ -2695,11 +2790,11 @@ var RadioGroup = ({
2695
2790
  };
2696
2791
 
2697
2792
  // src/components/Checkbox/index.tsx
2698
- var import_react2 = require("react");
2793
+ var import_react3 = require("react");
2699
2794
  var import_fi2 = require("react-icons/fi");
2700
2795
  var import_jsx_runtime5 = require("react/jsx-runtime");
2701
2796
  var Checkbox = ({ className, required, disabled }) => {
2702
- const [selected, setSelected] = (0, import_react2.useState)(false);
2797
+ const [selected, setSelected] = (0, import_react3.useState)(false);
2703
2798
  const handleCheckboxChange = (value) => {
2704
2799
  setSelected(!value);
2705
2800
  };
@@ -2734,211 +2829,262 @@ var Checkbox = ({ className, required, disabled }) => {
2734
2829
  };
2735
2830
 
2736
2831
  // src/components/Input/index.tsx
2737
- var import_react3 = require("react");
2832
+ var import_react4 = require("react");
2738
2833
  var import_fi3 = require("react-icons/fi");
2739
-
2740
- // src/components/Shared/masks.tsx
2741
- var masks = {
2742
- password: [/^(?=.*[!@#$%^&*])/, /(?=.*[0-9])/, /.{8,}$/],
2743
- date: [/\d/, /\d/, "/", /\d/, /\d/, "/", /\d/, /\d/, /\d/, /\d/],
2744
- cpf: [
2745
- /\d/,
2746
- /\d/,
2747
- /\d/,
2748
- ".",
2749
- /\d/,
2750
- /\d/,
2751
- /\d/,
2752
- ".",
2753
- /\d/,
2754
- /\d/,
2755
- /\d/,
2756
- "-",
2757
- /\d/,
2758
- /\d/
2759
- ],
2760
- cnpj: [
2761
- /\d/,
2762
- /\d/,
2763
- ".",
2764
- /\d/,
2765
- /\d/,
2766
- /\d/,
2767
- ".",
2768
- /\d/,
2769
- /\d/,
2770
- /\d/,
2771
- "/",
2772
- /\d/,
2773
- /\d/,
2774
- /\d/,
2775
- /\d/,
2776
- "-",
2777
- /\d/,
2778
- /\d/
2779
- ],
2780
- cep: [/\d/, /\d/, /\d/, /\d/, /\d/, "-", /\d/, /\d/, /\d/],
2781
- phone: [
2782
- "(",
2783
- /[1-9]/,
2784
- /[1-9]/,
2785
- ")",
2786
- " ",
2787
- /\d/,
2788
- /\d/,
2789
- /\d/,
2790
- /\d/,
2791
- /\d/,
2792
- "-",
2793
- /\d/,
2794
- /\d/,
2795
- /\d/,
2796
- /\d/
2797
- ]
2798
- };
2799
- var masks_default = masks;
2800
-
2801
- // src/components/Input/index.tsx
2802
2834
  var import_jsx_runtime6 = require("react/jsx-runtime");
2803
- var Input = (0, import_react3.forwardRef)(
2804
- (_a, ref) => {
2805
- var _b = _a, {
2806
- className,
2807
- disabled,
2808
- placeholder,
2809
- value,
2810
- validated,
2811
- error,
2812
- required,
2813
- type,
2814
- onClick
2815
- } = _b, rest = __objRest(_b, [
2816
- "className",
2817
- "disabled",
2818
- "placeholder",
2819
- "value",
2820
- "validated",
2821
- "error",
2822
- "required",
2823
- "type",
2824
- "onClick"
2825
- ]);
2826
- const [selected, setSelected] = (0, import_react3.useState)(false);
2827
- const [inputValue, setInputValue] = (0, import_react3.useState)(value);
2828
- const [hasNumber, setHasNumber] = (0, import_react3.useState)(false);
2829
- const [hasSpecialCharacteres, setHasSpecialCharacteres] = (0, import_react3.useState)(false);
2830
- const [hasEightCharacteres, setHasEightCharacteres] = (0, import_react3.useState)(false);
2835
+ var passwordMask = {
2836
+ password: [/^(?=.*[!@#$%^&*])/, /(?=.*[0-9])/, /.{8,}$/]
2837
+ };
2838
+ var Input = (0, import_react4.forwardRef)(
2839
+ ({
2840
+ className,
2841
+ disabled,
2842
+ placeholder,
2843
+ value,
2844
+ validated,
2845
+ error,
2846
+ required,
2847
+ type,
2848
+ onClick,
2849
+ errorMessage,
2850
+ onChange: externalOnChange,
2851
+ label,
2852
+ helperText,
2853
+ id,
2854
+ ...rest
2855
+ }, ref) => {
2856
+ const [selected, setSelected] = (0, import_react4.useState)(false);
2857
+ const [inputValue, setInputValue] = (0, import_react4.useState)(value || "");
2858
+ const [passwordValidation, setPasswordValidation] = (0, import_react4.useState)({
2859
+ hasEightCharacters: false,
2860
+ hasSpecialCharacters: false,
2861
+ hasNumber: false
2862
+ });
2863
+ const [isValid, setIsValid] = (0, import_react4.useState)(false);
2831
2864
  const handleFocus = () => {
2832
- setSelected(!selected);
2865
+ setSelected(true);
2833
2866
  };
2834
2867
  const handleBlur = () => {
2835
2868
  setSelected(false);
2869
+ validateInput(inputValue || "");
2870
+ };
2871
+ const applyMask = (value2, type2) => {
2872
+ let result = value2;
2873
+ switch (type2) {
2874
+ case "date":
2875
+ result = value2.replace(/\D/g, "");
2876
+ if (result.length > 8) result = result.substring(0, 8);
2877
+ if (result.length > 4) result = result.replace(/(\d{2})(\d{2})(\d+)/, "$1/$2/$3");
2878
+ else if (result.length > 2) result = result.replace(/(\d{2})(\d+)/, "$1/$2");
2879
+ break;
2880
+ case "cpf":
2881
+ result = value2.replace(/\D/g, "");
2882
+ if (result.length > 11) result = result.substring(0, 11);
2883
+ if (result.length > 9) result = result.replace(/(\d{3})(\d{3})(\d{3})(\d+)/, "$1.$2.$3-$4");
2884
+ else if (result.length > 6) result = result.replace(/(\d{3})(\d{3})(\d+)/, "$1.$2.$3");
2885
+ else if (result.length > 3) result = result.replace(/(\d{3})(\d+)/, "$1.$2");
2886
+ break;
2887
+ case "cnpj":
2888
+ result = value2.replace(/\D/g, "");
2889
+ if (result.length > 14) result = result.substring(0, 14);
2890
+ if (result.length > 12)
2891
+ result = result.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d+)/, "$1.$2.$3/$4-$5");
2892
+ else if (result.length > 8)
2893
+ result = result.replace(/(\d{2})(\d{3})(\d{3})(\d+)/, "$1.$2.$3/$4");
2894
+ else if (result.length > 5)
2895
+ result = result.replace(/(\d{2})(\d{3})(\d+)/, "$1.$2.$3");
2896
+ else if (result.length > 2)
2897
+ result = result.replace(/(\d{2})(\d+)/, "$1.$2");
2898
+ break;
2899
+ case "cep":
2900
+ result = value2.replace(/\D/g, "");
2901
+ if (result.length > 8) result = result.substring(0, 8);
2902
+ if (result.length > 5) result = result.replace(/(\d{5})(\d+)/, "$1-$2");
2903
+ break;
2904
+ case "phone":
2905
+ result = value2.replace(/\D/g, "");
2906
+ if (result.length > 11) result = result.substring(0, 11);
2907
+ if (result.length > 10)
2908
+ result = result.replace(/(\d{2})(\d{5})(\d+)/, "($1) $2-$3");
2909
+ else if (result.length > 6)
2910
+ result = result.replace(/(\d{2})(\d{4})(\d+)/, "($1) $2-$3");
2911
+ else if (result.length > 2)
2912
+ result = result.replace(/(\d{2})(\d+)/, "($1) $2");
2913
+ break;
2914
+ default:
2915
+ break;
2916
+ }
2917
+ return result;
2918
+ };
2919
+ const validateInput = (value2) => {
2920
+ if (!value2) return false;
2921
+ let valid = false;
2922
+ switch (type) {
2923
+ case "password":
2924
+ valid = passwordValidation.hasEightCharacters && passwordValidation.hasSpecialCharacters && passwordValidation.hasNumber;
2925
+ break;
2926
+ case "date":
2927
+ valid = /^\d{2}\/\d{2}\/\d{4}$/.test(value2);
2928
+ break;
2929
+ case "cpf":
2930
+ valid = /^\d{3}\.\d{3}\.\d{3}-\d{2}$/.test(value2);
2931
+ break;
2932
+ case "cnpj":
2933
+ valid = /^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/.test(value2);
2934
+ break;
2935
+ case "cep":
2936
+ valid = /^\d{5}-\d{3}$/.test(value2);
2937
+ break;
2938
+ case "phone":
2939
+ valid = /^\(\d{2}\) \d{5}-\d{4}$/.test(value2);
2940
+ break;
2941
+ default:
2942
+ valid = value2.length > 0;
2943
+ break;
2944
+ }
2945
+ setIsValid(valid);
2946
+ return valid;
2836
2947
  };
2837
2948
  const handleInput = (event) => {
2838
- setInputValue(event.currentTarget.value);
2839
- checkPassword(event.currentTarget.value);
2949
+ let newValue = event.currentTarget.value;
2950
+ if (["date", "cpf", "phone", "cnpj", "cep"].includes(type)) {
2951
+ newValue = applyMask(newValue, type);
2952
+ }
2953
+ const newEvent = {
2954
+ ...event,
2955
+ currentTarget: {
2956
+ ...event.currentTarget,
2957
+ value: newValue
2958
+ },
2959
+ target: {
2960
+ ...event.target,
2961
+ value: newValue
2962
+ }
2963
+ };
2964
+ setInputValue(newValue);
2965
+ if (type === "password") {
2966
+ checkPassword(newValue);
2967
+ } else {
2968
+ validateInput(newValue);
2969
+ }
2970
+ externalOnChange?.(newEvent);
2840
2971
  };
2841
- (0, import_react3.useEffect)(() => {
2842
- setInputValue(value);
2843
- }, [value]);
2972
+ (0, import_react4.useEffect)(() => {
2973
+ setInputValue(value || "");
2974
+ if (value && type === "password") {
2975
+ checkPassword(value);
2976
+ } else if (value) {
2977
+ validateInput(value);
2978
+ }
2979
+ }, [value, type]);
2844
2980
  const checkPassword = (value2) => {
2845
- setHasSpecialCharacteres((value2 == null ? void 0 : value2.match(masks_default.password[0])) !== null);
2846
- setHasNumber((value2 == null ? void 0 : value2.match(masks_default.password[1])) !== null);
2847
- setHasEightCharacteres((value2 == null ? void 0 : value2.match(masks_default.password[2])) !== null);
2981
+ const validationResult = {
2982
+ hasEightCharacters: value2?.match(passwordMask.password[2]) !== null,
2983
+ hasSpecialCharacters: value2?.match(passwordMask.password[0]) !== null,
2984
+ hasNumber: value2?.match(passwordMask.password[1]) !== null
2985
+ };
2986
+ setPasswordValidation(validationResult);
2987
+ setIsValid(
2988
+ validationResult.hasEightCharacters && validationResult.hasSpecialCharacters && validationResult.hasNumber
2989
+ );
2848
2990
  };
2849
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
2850
- type === "text" || type === "password" || type === "date" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
2851
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2852
- "input",
2853
- __spreadValues({
2854
- type,
2855
- required,
2856
- ref,
2857
- className: twMerge(
2858
- "flex items-center justify-center border-2 border-neutral rounded-sm w-full px-3 py-2 text-md hover:shadow-md hover:shadow-neutral-500 focus:outline-none",
2859
- className,
2860
- disabled === true && "opacity-50 cursor-not-allowed",
2861
- selected === true && "border-2 border-orange-500",
2862
- validated === true && "border-2 border-green-900",
2863
- error === true && "border-2 border-red-900"
2864
- ),
2865
- onClick,
2866
- onFocus: handleFocus,
2867
- onChange: handleInput,
2868
- onBlur: handleBlur,
2869
- placeholder,
2870
- value: inputValue
2871
- }, rest)
2872
- ),
2873
- type === "password" && (!hasEightCharacteres || !hasSpecialCharacteres || !hasNumber) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ul", { className: "py-1", children: [
2874
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center px-2", children: [
2875
- hasEightCharacteres ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiCheck, {}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiX, {}),
2876
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-1", children: "Pelo menos 8 caracteres" })
2877
- ] }),
2878
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center px-2", children: [
2879
- hasSpecialCharacteres ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiCheck, {}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiX, {}),
2880
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-1", children: "Pelo menos 1 s\xEDmbolo (@, !, $, etc)" })
2881
- ] }),
2882
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center px-2", children: [
2883
- hasNumber ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiCheck, {}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiX, {}),
2884
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-1", children: "Deve conter 1 n\xFAmero" })
2885
- ] })
2991
+ const getInputType = () => {
2992
+ switch (type) {
2993
+ case "password":
2994
+ return "password";
2995
+ case "date":
2996
+ case "cpf":
2997
+ case "phone":
2998
+ case "cnpj":
2999
+ case "cep":
3000
+ return "text";
3001
+ default:
3002
+ return "text";
3003
+ }
3004
+ };
3005
+ const inputClasses = twMerge(
3006
+ "flex items-center justify-center border-2 border-neutral rounded-sm w-full px-3 py-2 text-md hover:shadow-md hover:shadow-neutral-500 focus:outline-none transition-all duration-200",
3007
+ className,
3008
+ disabled && "opacity-50 cursor-not-allowed",
3009
+ selected && "border-2 border-orange-500",
3010
+ validated && isValid && "border-2 border-green-900",
3011
+ error && "border-2 border-red-900"
3012
+ );
3013
+ const renderPasswordValidation = () => {
3014
+ if (type !== "password") return null;
3015
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("ul", { className: "py-1 text-sm", role: "list", children: [
3016
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center px-2", role: "listitem", children: [
3017
+ passwordValidation.hasEightCharacters ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiCheck, { className: "text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiX, { className: "text-red-500" }),
3018
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-1", children: "Pelo menos 8 caracteres" })
3019
+ ] }),
3020
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center px-2", role: "listitem", children: [
3021
+ passwordValidation.hasSpecialCharacters ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiCheck, { className: "text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiX, { className: "text-red-500" }),
3022
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-1", children: "Pelo menos 1 s\xEDmbolo (@, !, $, etc)" })
3023
+ ] }),
3024
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "flex items-center px-2", role: "listitem", children: [
3025
+ passwordValidation.hasNumber ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiCheck, { className: "text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_fi3.FiX, { className: "text-red-500" }),
3026
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-1", children: "Deve conter 1 n\xFAmero" })
2886
3027
  ] })
2887
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3028
+ ] });
3029
+ };
3030
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "w-full", children: [
3031
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3032
+ "label",
3033
+ {
3034
+ htmlFor: id,
3035
+ className: "block text-sm font-medium text-gray-700 mb-1",
3036
+ children: [
3037
+ label,
3038
+ required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
3039
+ ]
3040
+ }
3041
+ ),
3042
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2888
3043
  "input",
2889
- __spreadValues({
2890
- type,
3044
+ {
3045
+ type: getInputType(),
2891
3046
  required,
3047
+ disabled,
2892
3048
  ref,
2893
- className: twMerge(
2894
- "flex items-center justify-center border-2 border-neutral rounded-sm w-full px-3 py-2 text-md hover:shadow-md hover:shadow-neutral-500 focus:outline-none",
2895
- className,
2896
- disabled === true && "opacity-50 cursor-not-allowed",
2897
- selected === true && "border-2 border-orange-500",
2898
- error === true && "border-2 border-red-900"
2899
- ),
3049
+ id,
3050
+ className: inputClasses,
2900
3051
  onClick,
2901
3052
  onFocus: handleFocus,
2902
3053
  onChange: handleInput,
2903
3054
  onBlur: handleBlur,
2904
3055
  placeholder,
2905
- value: inputValue
2906
- }, rest)
3056
+ value: inputValue,
3057
+ "aria-invalid": error,
3058
+ "aria-describedby": error ? `${id}-error` : helperText ? `${id}-helper` : void 0,
3059
+ ...rest
3060
+ }
2907
3061
  ),
2908
- error === true && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: rest.id, className: "text-red-900", children: "Campo inv\xE1lido." })
3062
+ renderPasswordValidation(),
3063
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id: `${id}-error`, className: "mt-1 text-sm text-red-900", role: "alert", children: errorMessage || "Invalid field." }),
3064
+ helperText && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id: `${id}-helper`, className: "mt-1 text-sm text-gray-500", children: helperText })
2909
3065
  ] });
2910
3066
  }
2911
3067
  );
2912
3068
  Input.displayName = "Input";
2913
3069
 
2914
3070
  // src/components/TextInput/index.tsx
2915
- var import_react4 = require("react");
3071
+ var import_react5 = require("react");
2916
3072
  var import_jsx_runtime7 = require("react/jsx-runtime");
2917
- var TextInput = (0, import_react4.forwardRef)(
2918
- (_a, ref) => {
2919
- var _b = _a, {
2920
- className,
2921
- disabled,
2922
- value,
2923
- prefix,
2924
- placeholder,
2925
- error,
2926
- type = "text",
2927
- variant = "primary",
2928
- onClick
2929
- } = _b, rest = __objRest(_b, [
2930
- "className",
2931
- "disabled",
2932
- "value",
2933
- "prefix",
2934
- "placeholder",
2935
- "error",
2936
- "type",
2937
- "variant",
2938
- "onClick"
2939
- ]);
2940
- const [selected, setSelected] = (0, import_react4.useState)(false);
2941
- const [inputValue, setInputValue] = (0, import_react4.useState)(value);
3073
+ var TextInput = (0, import_react5.forwardRef)(
3074
+ ({
3075
+ className,
3076
+ disabled,
3077
+ value,
3078
+ prefix,
3079
+ placeholder,
3080
+ error,
3081
+ type = "text",
3082
+ variant = "primary",
3083
+ onClick,
3084
+ ...rest
3085
+ }, ref) => {
3086
+ const [selected, setSelected] = (0, import_react5.useState)(false);
3087
+ const [inputValue, setInputValue] = (0, import_react5.useState)(value);
2942
3088
  const handleFocus = () => {
2943
3089
  setSelected(!selected);
2944
3090
  };
@@ -2948,7 +3094,7 @@ var TextInput = (0, import_react4.forwardRef)(
2948
3094
  const handleInput = (event) => {
2949
3095
  setInputValue(event.currentTarget.value);
2950
3096
  };
2951
- (0, import_react4.useEffect)(() => {
3097
+ (0, import_react5.useEffect)(() => {
2952
3098
  setInputValue(value);
2953
3099
  }, [value]);
2954
3100
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
@@ -2966,7 +3112,7 @@ var TextInput = (0, import_react4.forwardRef)(
2966
3112
  !!prefix && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-neutral-500 sm:text-sm", children: prefix }),
2967
3113
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2968
3114
  "input",
2969
- __spreadValues({
3115
+ {
2970
3116
  type,
2971
3117
  required: rest.required,
2972
3118
  onClick,
@@ -2983,8 +3129,9 @@ var TextInput = (0, import_react4.forwardRef)(
2983
3129
  disabled === true && "cursor-not-allowed",
2984
3130
  variant === "secondary" && "bg-neutral-800 text-neutral",
2985
3131
  className
2986
- )
2987
- }, rest)
3132
+ ),
3133
+ ...rest
3134
+ }
2988
3135
  )
2989
3136
  ]
2990
3137
  }
@@ -2994,32 +3141,22 @@ var TextInput = (0, import_react4.forwardRef)(
2994
3141
  TextInput.displayName = "TextInput";
2995
3142
 
2996
3143
  // src/components/TextArea/index.tsx
2997
- var import_react5 = require("react");
3144
+ var import_react6 = require("react");
2998
3145
  var import_jsx_runtime8 = require("react/jsx-runtime");
2999
- var TextArea = (_a) => {
3000
- var _b = _a, {
3001
- className,
3002
- disabled,
3003
- reference,
3004
- value,
3005
- error,
3006
- required,
3007
- placeholder,
3008
- resize,
3009
- onClick
3010
- } = _b, rest = __objRest(_b, [
3011
- "className",
3012
- "disabled",
3013
- "reference",
3014
- "value",
3015
- "error",
3016
- "required",
3017
- "placeholder",
3018
- "resize",
3019
- "onClick"
3020
- ]);
3021
- const [selected, setSelected] = (0, import_react5.useState)(false);
3022
- const [inputValue, setInputValue] = (0, import_react5.useState)(value);
3146
+ var TextArea = ({
3147
+ className,
3148
+ disabled,
3149
+ reference,
3150
+ value,
3151
+ error,
3152
+ required,
3153
+ placeholder,
3154
+ resize,
3155
+ onClick,
3156
+ ...rest
3157
+ }) => {
3158
+ const [selected, setSelected] = (0, import_react6.useState)(false);
3159
+ const [inputValue, setInputValue] = (0, import_react6.useState)(value);
3023
3160
  const handleFocus = () => {
3024
3161
  setSelected(!selected);
3025
3162
  };
@@ -3029,12 +3166,12 @@ var TextArea = (_a) => {
3029
3166
  const handleInput = (event) => {
3030
3167
  setInputValue(event.currentTarget.value);
3031
3168
  };
3032
- (0, import_react5.useEffect)(() => {
3169
+ (0, import_react6.useEffect)(() => {
3033
3170
  setInputValue(value);
3034
3171
  }, [value]);
3035
3172
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3036
3173
  "textarea",
3037
- __spreadValues({
3174
+ {
3038
3175
  required,
3039
3176
  ref: reference,
3040
3177
  disabled,
@@ -3052,27 +3189,22 @@ var TextArea = (_a) => {
3052
3189
  onChange: handleInput,
3053
3190
  onBlur: handleBlur,
3054
3191
  placeholder,
3055
- value: inputValue
3056
- }, rest)
3192
+ value: inputValue,
3193
+ ...rest
3194
+ }
3057
3195
  );
3058
3196
  };
3059
3197
 
3060
3198
  // src/components/Text/index.tsx
3061
3199
  var import_jsx_runtime9 = require("react/jsx-runtime");
3062
- var Text = (_a) => {
3063
- var _b = _a, {
3064
- children,
3065
- color = "neutral-800",
3066
- size = "md",
3067
- tag = "p",
3068
- className
3069
- } = _b, rest = __objRest(_b, [
3070
- "children",
3071
- "color",
3072
- "size",
3073
- "tag",
3074
- "className"
3075
- ]);
3200
+ var Text = ({
3201
+ children,
3202
+ color = "neutral-800",
3203
+ size = "md",
3204
+ tag = "p",
3205
+ className,
3206
+ ...rest
3207
+ }) => {
3076
3208
  const fontSize = {
3077
3209
  xxs: "text-xxs",
3078
3210
  xs: "text-xs",
@@ -3090,7 +3222,7 @@ var Text = (_a) => {
3090
3222
  "9xl": "text-9xl"
3091
3223
  }[size];
3092
3224
  const Tag = tag;
3093
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tag, __spreadProps(__spreadValues({}, rest), { className: twMerge(`text-${color} ${fontSize}`, className), children }));
3225
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tag, { ...rest, className: twMerge(`text-${color} ${fontSize}`, className), children });
3094
3226
  };
3095
3227
 
3096
3228
  // src/components/Heading/index.tsx
@@ -3145,39 +3277,33 @@ var Box = ({
3145
3277
 
3146
3278
  // src/components/Form/index.tsx
3147
3279
  var import_jsx_runtime12 = require("react/jsx-runtime");
3148
- var Form = (_a) => {
3149
- var _b = _a, {
3150
- className,
3151
- children,
3152
- variant = "secondary",
3153
- orientation = "row"
3154
- } = _b, rest = __objRest(_b, [
3155
- "className",
3156
- "children",
3157
- "variant",
3158
- "orientation"
3159
- ]);
3280
+ var Form = ({
3281
+ className,
3282
+ children,
3283
+ variant = "secondary",
3284
+ orientation = "row",
3285
+ ...rest
3286
+ }) => {
3160
3287
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3161
3288
  "form",
3162
- __spreadProps(__spreadValues({
3289
+ {
3163
3290
  className: twMerge(
3164
3291
  "flex flex-row gap-2 p-6 rounded-md border-2",
3165
3292
  variant === "primary" && "text-neutral-800 bg-neutral-200 border-neutral-300",
3166
3293
  variant === "secondary" && "text-neutral-200 bg-neutral-600 border-neutral-800",
3167
3294
  orientation === "col" && "flex-col",
3168
3295
  className
3169
- )
3170
- }, rest), {
3296
+ ),
3297
+ ...rest,
3171
3298
  children
3172
- })
3299
+ }
3173
3300
  );
3174
3301
  };
3175
3302
 
3176
3303
  // src/components/Avatar/index.tsx
3177
3304
  var import_fa = require("react-icons/fa");
3178
3305
  var import_jsx_runtime13 = require("react/jsx-runtime");
3179
- var Avatar = (_a) => {
3180
- var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
3306
+ var Avatar = ({ className, ...rest }) => {
3181
3307
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3182
3308
  "div",
3183
3309
  {
@@ -3187,7 +3313,7 @@ var Avatar = (_a) => {
3187
3313
  bg-neutral-600 justify-center`,
3188
3314
  className
3189
3315
  ),
3190
- children: rest.src ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", __spreadValues({ className: "w-full h-full object-cover rounded-full" }, rest)) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_fa.FaUser, { color: "#FFFFFF", size: 24 })
3316
+ children: rest.src ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { className: "w-full h-full object-cover rounded-full", ...rest }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_fa.FaUser, { color: "#FFFFFF", size: 24 })
3191
3317
  }
3192
3318
  );
3193
3319
  };
@@ -3212,6 +3338,436 @@ var MultiStep = ({ className, size, currentStep }) => {
3212
3338
  }) })
3213
3339
  ] });
3214
3340
  };
3341
+
3342
+ // src/components/Toggle/index.tsx
3343
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3344
+ var Toggle = ({
3345
+ className,
3346
+ disabled,
3347
+ active,
3348
+ label,
3349
+ setActive,
3350
+ size = "md",
3351
+ hideLabel = false,
3352
+ id,
3353
+ ...rest
3354
+ }) => {
3355
+ const toggleId = id || `toggle-${Math.random().toString(36).substring(2, 9)}`;
3356
+ const sizeClasses = {
3357
+ sm: {
3358
+ toggle: "h-5 w-9",
3359
+ knob: "h-3 w-3",
3360
+ translate: active ? "translate-x-5" : "translate-x-1"
3361
+ },
3362
+ md: {
3363
+ toggle: "h-6 w-11",
3364
+ knob: "h-4 w-4",
3365
+ translate: active ? "translate-x-6" : "translate-x-1"
3366
+ },
3367
+ lg: {
3368
+ toggle: "h-7 w-14",
3369
+ knob: "h-5 w-5",
3370
+ translate: active ? "translate-x-8" : "translate-x-1"
3371
+ }
3372
+ };
3373
+ const selectedSize = sizeClasses[size];
3374
+ const handleKeyDown = (e) => {
3375
+ if (e.key === "Enter" || e.key === " ") {
3376
+ e.preventDefault();
3377
+ if (!disabled) {
3378
+ setActive(!active);
3379
+ }
3380
+ }
3381
+ };
3382
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3383
+ "div",
3384
+ {
3385
+ className: twMerge("flex items-center gap-3", className),
3386
+ ...rest,
3387
+ children: [
3388
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3389
+ "button",
3390
+ {
3391
+ type: "button",
3392
+ role: "switch",
3393
+ "aria-checked": active,
3394
+ "aria-labelledby": hideLabel ? void 0 : `${toggleId}-label`,
3395
+ "aria-label": hideLabel ? label : void 0,
3396
+ id: toggleId,
3397
+ disabled,
3398
+ onClick: () => setActive(!active),
3399
+ onKeyDown: handleKeyDown,
3400
+ className: twMerge(`
3401
+ relative inline-flex items-center rounded-full
3402
+ ${selectedSize.toggle}
3403
+ ${active ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"}
3404
+ ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
3405
+ transition-colors duration-300 ease-in-out
3406
+ focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
3407
+ `),
3408
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `
3409
+ inline-block transform rounded-full bg-white shadow-md
3410
+ ${selectedSize.knob}
3411
+ ${selectedSize.translate}
3412
+ transition-transform duration-300 ease-in-out
3413
+ ` })
3414
+ }
3415
+ ),
3416
+ !hideLabel && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3417
+ "label",
3418
+ {
3419
+ id: `${toggleId}-label`,
3420
+ htmlFor: toggleId,
3421
+ className: `text-sm font-medium text-gray-700 dark:text-gray-300 ${disabled ? "opacity-50" : ""}`,
3422
+ children: label
3423
+ }
3424
+ )
3425
+ ]
3426
+ }
3427
+ );
3428
+ };
3429
+
3430
+ // src/components/Skeleton/index.tsx
3431
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3432
+ var Skeleton = ({
3433
+ width = "full",
3434
+ height = "16",
3435
+ rounded = false,
3436
+ circle = false,
3437
+ animate = true,
3438
+ className
3439
+ }) => {
3440
+ const widthClass = typeof width === "string" ? width.includes("px") || width.includes("%") || width.includes("rem") || width.includes("em") ? `w-[${width}]` : `w-${width}` : `w-[${width}px]`;
3441
+ const heightClass = typeof height === "string" ? height.includes("px") || height.includes("%") || height.includes("rem") || height.includes("em") ? `h-[${height}]` : `h-${height}` : `h-[${height}px]`;
3442
+ const safeWidthClass = widthClass.includes("[") ? "w-full" : widthClass;
3443
+ const safeHeightClass = heightClass.includes("[") ? "h-16" : heightClass;
3444
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3445
+ "div",
3446
+ {
3447
+ className: twMerge(
3448
+ "bg-gray-200",
3449
+ safeWidthClass,
3450
+ safeHeightClass,
3451
+ rounded && !circle && "rounded-md",
3452
+ circle && "rounded-full",
3453
+ animate && "animate-pulse",
3454
+ className
3455
+ ),
3456
+ "aria-hidden": "true"
3457
+ }
3458
+ );
3459
+ };
3460
+ Skeleton.displayName = "Skeleton";
3461
+
3462
+ // src/components/Loading/index.tsx
3463
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3464
+ var Loading = ({
3465
+ size = "md",
3466
+ color = "primary",
3467
+ withText = false,
3468
+ text = "Loading...",
3469
+ centered = false,
3470
+ className
3471
+ }) => {
3472
+ const sizeClasses = {
3473
+ xs: "h-4 w-4",
3474
+ sm: "h-6 w-6",
3475
+ md: "h-8 w-8",
3476
+ lg: "h-12 w-12"
3477
+ };
3478
+ const colorClasses = {
3479
+ primary: "text-orange-500",
3480
+ secondary: "text-neutral",
3481
+ white: "text-white",
3482
+ black: "text-black",
3483
+ gray: "text-gray-400"
3484
+ };
3485
+ const textSizeClasses = {
3486
+ xs: "text-xs",
3487
+ sm: "text-sm",
3488
+ md: "text-base",
3489
+ lg: "text-lg"
3490
+ };
3491
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3492
+ "div",
3493
+ {
3494
+ className: twMerge(
3495
+ "inline-flex items-center",
3496
+ centered && "justify-center",
3497
+ className
3498
+ ),
3499
+ role: "status",
3500
+ children: [
3501
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3502
+ "svg",
3503
+ {
3504
+ className: twMerge(
3505
+ "animate-spin",
3506
+ sizeClasses[size],
3507
+ colorClasses[color]
3508
+ ),
3509
+ xmlns: "http://www.w3.org/2000/svg",
3510
+ fill: "none",
3511
+ viewBox: "0 0 24 24",
3512
+ children: [
3513
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3514
+ "circle",
3515
+ {
3516
+ className: "opacity-25",
3517
+ cx: "12",
3518
+ cy: "12",
3519
+ r: "10",
3520
+ stroke: "currentColor",
3521
+ strokeWidth: "4"
3522
+ }
3523
+ ),
3524
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3525
+ "path",
3526
+ {
3527
+ className: "opacity-75",
3528
+ fill: "currentColor",
3529
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
3530
+ }
3531
+ )
3532
+ ]
3533
+ }
3534
+ ),
3535
+ withText && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: twMerge(
3536
+ "ml-3",
3537
+ textSizeClasses[size],
3538
+ colorClasses[color]
3539
+ ), children: text }),
3540
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sr-only", children: "Loading" })
3541
+ ]
3542
+ }
3543
+ );
3544
+ };
3545
+ Loading.displayName = "Loading";
3546
+
3547
+ // src/components/Modal/index.tsx
3548
+ var import_react7 = require("react");
3549
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3550
+ var Modal = ({
3551
+ className,
3552
+ isOpen,
3553
+ onClose,
3554
+ title,
3555
+ size = "md",
3556
+ children,
3557
+ showCloseButton = true,
3558
+ closeOnOutsideClick = true,
3559
+ closeOnEsc = true,
3560
+ footer,
3561
+ ...rest
3562
+ }) => {
3563
+ const modalRef = (0, import_react7.useRef)(null);
3564
+ const portalRoot = (0, import_react7.useRef)(null);
3565
+ const [mounted, setMounted] = (0, import_react7.useState)(false);
3566
+ (0, import_react7.useEffect)(() => {
3567
+ portalRoot.current = document.createElement("div");
3568
+ portalRoot.current.id = "bloom-ui-portal-root";
3569
+ document.body.appendChild(portalRoot.current);
3570
+ setMounted(true);
3571
+ return () => {
3572
+ portalRoot.current?.remove();
3573
+ document.body.style.overflow = "";
3574
+ };
3575
+ }, []);
3576
+ (0, import_react7.useEffect)(() => {
3577
+ if (isOpen) {
3578
+ document.body.style.overflow = "hidden";
3579
+ } else {
3580
+ document.body.style.overflow = "";
3581
+ }
3582
+ }, [isOpen]);
3583
+ (0, import_react7.useEffect)(() => {
3584
+ const handleKeyDown = (e) => {
3585
+ if (isOpen && closeOnEsc && e.key === "Escape") onClose();
3586
+ };
3587
+ document.addEventListener("keydown", handleKeyDown);
3588
+ return () => document.removeEventListener("keydown", handleKeyDown);
3589
+ }, [isOpen, onClose, closeOnEsc]);
3590
+ const handleBackdropClick = (e) => {
3591
+ if (closeOnOutsideClick && modalRef.current && !modalRef.current.contains(e.target)) {
3592
+ onClose();
3593
+ }
3594
+ };
3595
+ const sizeClasses = {
3596
+ sm: "max-w-sm",
3597
+ md: "max-w-md",
3598
+ lg: "max-w-lg",
3599
+ xl: "max-w-xl"
3600
+ };
3601
+ if (!isOpen || !mounted || !portalRoot.current) return null;
3602
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3603
+ "div",
3604
+ {
3605
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black bg-opacity-50 transition-opacity duration-300",
3606
+ onClick: handleBackdropClick,
3607
+ "aria-modal": "true",
3608
+ role: "dialog",
3609
+ ...rest,
3610
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3611
+ "div",
3612
+ {
3613
+ ref: modalRef,
3614
+ className: twMerge(
3615
+ `relative bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full
3616
+ ${sizeClasses[size]} opacity-100 scale-100
3617
+ transition-all duration-300 ease-in-out`,
3618
+ className
3619
+ ),
3620
+ children: [
3621
+ (title || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: [
3622
+ title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: title }),
3623
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3624
+ "button",
3625
+ {
3626
+ type: "button",
3627
+ "aria-label": "Close modal",
3628
+ onClick: onClose,
3629
+ className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500 rounded-full",
3630
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "h-5 w-5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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" }) })
3631
+ }
3632
+ )
3633
+ ] }),
3634
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-6 py-4 max-h-[70vh] overflow-y-auto", children }),
3635
+ footer && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-6 py-4 border-t border-gray-200 dark:border-gray-700", children: footer })
3636
+ ]
3637
+ }
3638
+ )
3639
+ }
3640
+ );
3641
+ };
3642
+
3643
+ // src/components/Toast/index.tsx
3644
+ var import_react8 = __toESM(require("react"), 1);
3645
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3646
+ var Toast = ({
3647
+ id,
3648
+ message,
3649
+ title,
3650
+ variant = "info",
3651
+ duration = 5e3,
3652
+ showCloseButton = true,
3653
+ onDismiss,
3654
+ className
3655
+ }) => {
3656
+ const [isRemoving, setIsRemoving] = (0, import_react8.useState)(false);
3657
+ const timerRef = (0, import_react8.useRef)();
3658
+ const handleDismiss = () => {
3659
+ setIsRemoving(true);
3660
+ setTimeout(() => onDismiss?.(id), 300);
3661
+ };
3662
+ (0, import_react8.useEffect)(() => {
3663
+ if (duration > 0) {
3664
+ timerRef.current = window.setTimeout(handleDismiss, duration);
3665
+ }
3666
+ return () => window.clearTimeout(timerRef.current);
3667
+ }, [duration]);
3668
+ const variantStyles = {
3669
+ success: "bg-green-100 border-green-500 text-green-800",
3670
+ error: "bg-red-100 border-red-500 text-red-800",
3671
+ warning: "bg-yellow-100 border-yellow-500 text-yellow-800",
3672
+ info: "bg-blue-100 border-blue-500 text-blue-800"
3673
+ };
3674
+ const icons = {
3675
+ success: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }) }),
3676
+ error: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }),
3677
+ warning: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }),
3678
+ info: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) })
3679
+ };
3680
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3681
+ "div",
3682
+ {
3683
+ className: twMerge(
3684
+ "flex items-start p-4 mb-3 w-full max-w-xs rounded-md shadow-md border-l-4 transform transition-all duration-300",
3685
+ variantStyles[variant],
3686
+ isRemoving ? "translate-x-full opacity-0" : "translate-x-0 opacity-100",
3687
+ className
3688
+ ),
3689
+ role: "alert",
3690
+ children: [
3691
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `flex-shrink-0 mr-3 text-${variant}-500`, children: icons[variant] }),
3692
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1", children: [
3693
+ title && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "font-medium text-sm", children: title }),
3694
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-sm", children: message })
3695
+ ] }),
3696
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3697
+ "button",
3698
+ {
3699
+ type: "button",
3700
+ className: "ml-3 text-gray-400 hover:text-gray-900",
3701
+ onClick: handleDismiss,
3702
+ "aria-label": "Close",
3703
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M6 18L18 6M6 6l12 12" }) })
3704
+ }
3705
+ )
3706
+ ]
3707
+ }
3708
+ );
3709
+ };
3710
+ var ToastContainer = ({
3711
+ position = "top-right",
3712
+ className,
3713
+ children
3714
+ }) => {
3715
+ const containerRef = (0, import_react8.useRef)({ current: null });
3716
+ const [isMounted, setIsMounted] = (0, import_react8.useState)(false);
3717
+ (0, import_react8.useEffect)(() => {
3718
+ const container = document.createElement("div");
3719
+ container.id = "toast-root";
3720
+ container.className = "fixed z-50 p-4";
3721
+ document.body.appendChild(container);
3722
+ containerRef.current = { current: container };
3723
+ setIsMounted(true);
3724
+ return () => {
3725
+ container.remove();
3726
+ };
3727
+ }, []);
3728
+ const positionClasses = {
3729
+ "top-right": "top-0 right-0",
3730
+ "top-left": "top-0 left-0",
3731
+ "bottom-right": "bottom-0 right-0",
3732
+ "bottom-left": "bottom-0 left-0",
3733
+ "top-center": "top-0 left-1/2 -translate-x-1/2",
3734
+ "bottom-center": "bottom-0 left-1/2 -translate-x-1/2"
3735
+ };
3736
+ if (!isMounted || !containerRef.current) return null;
3737
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3738
+ "div",
3739
+ {
3740
+ className: twMerge(
3741
+ "fixed z-50 p-4 flex flex-col items-end",
3742
+ positionClasses[position],
3743
+ className
3744
+ ),
3745
+ children
3746
+ }
3747
+ );
3748
+ };
3749
+ var ToastContext = import_react8.default.createContext(void 0);
3750
+ var ToastProvider = ({ position = "top-right", children }) => {
3751
+ const [toasts, setToasts] = (0, import_react8.useState)([]);
3752
+ const showToast = (toast) => {
3753
+ const id = `toast-${Date.now()}`;
3754
+ setToasts((prev) => [...prev, { ...toast, id }]);
3755
+ return id;
3756
+ };
3757
+ const hideToast = (id) => setToasts((prev) => prev.filter((toast) => toast.id !== id));
3758
+ const clearToasts = () => setToasts([]);
3759
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ToastContext.Provider, { value: { showToast, hideToast, clearToasts }, children: [
3760
+ children,
3761
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToastContainer, { position, children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Toast, { ...toast, onDismiss: hideToast }, toast.id)) })
3762
+ ] });
3763
+ };
3764
+ var useToast = () => {
3765
+ const context = import_react8.default.useContext(ToastContext);
3766
+ if (!context) throw new Error("useToast must be used within ToastProvider");
3767
+ return context;
3768
+ };
3769
+ Toast.displayName = "Toast";
3770
+ ToastContainer.displayName = "ToastContainer";
3215
3771
  // Annotate the CommonJS export names for ESM import in node:
3216
3772
  0 && (module.exports = {
3217
3773
  Avatar,
@@ -3223,9 +3779,18 @@ var MultiStep = ({ className, size, currentStep }) => {
3223
3779
  Heading,
3224
3780
  Input,
3225
3781
  Link,
3782
+ Loading,
3783
+ Modal,
3226
3784
  MultiStep,
3227
3785
  RadioGroup,
3786
+ Skeleton,
3228
3787
  Text,
3229
3788
  TextArea,
3230
- TextInput
3789
+ TextInput,
3790
+ Toast,
3791
+ ToastContainer,
3792
+ ToastContext,
3793
+ ToastProvider,
3794
+ Toggle,
3795
+ useToast
3231
3796
  });