@processhub-lib/react 1.0.4 → 1.0.6

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.
Files changed (50) hide show
  1. package/dist/classnames-2Mts7qXW.js +29 -0
  2. package/dist/classnames-BqI3URgS.cjs +1 -0
  3. package/dist/index-B1vZ8U-f.cjs +88 -0
  4. package/dist/index-hkfwDYXz.js +3097 -0
  5. package/dist/index.cjs.js +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.es.js +12 -0
  8. package/dist/scripts/generate-endpoints.d.ts +1 -0
  9. package/dist/style.css +1 -0
  10. package/dist/ui/Button/colors.d.ts +162 -0
  11. package/dist/ui/Button/index.d.ts +3 -0
  12. package/dist/ui/Button/types/button.d.ts +16 -0
  13. package/dist/ui/Input/index.d.ts +3 -0
  14. package/{src/ui/Input/types/input.ts → dist/ui/Input/types/input.d.ts} +6 -7
  15. package/dist/ui/Select/index.d.ts +3 -0
  16. package/dist/ui/Select/types/select.d.ts +17 -0
  17. package/dist/ui/index.d.ts +3 -0
  18. package/dist/ui.cjs.js +1 -0
  19. package/dist/ui.d.ts +1 -0
  20. package/dist/ui.es.js +6 -0
  21. package/dist/utils/applyMask.d.ts +9 -0
  22. package/dist/utils/classnames.d.ts +16 -0
  23. package/dist/utils/formatar.d.ts +62 -0
  24. package/dist/utils/index.d.ts +4 -0
  25. package/dist/utils/isDocumento.d.ts +11 -0
  26. package/dist/utils.cjs.js +1 -0
  27. package/dist/utils.d.ts +1 -0
  28. package/dist/utils.es.js +128 -0
  29. package/package.json +5 -1
  30. package/postcss.config.js +0 -5
  31. package/src/context/ThemeContext.tsx +0 -45
  32. package/src/index.ts +0 -4
  33. package/src/scripts/generate-endpoints.ts +0 -184
  34. package/src/style.css +0 -1
  35. package/src/ui/Button/colors.tsx +0 -163
  36. package/src/ui/Button/index.tsx +0 -45
  37. package/src/ui/Button/types/button.ts +0 -17
  38. package/src/ui/Input/index.tsx +0 -74
  39. package/src/ui/Select/index.tsx +0 -150
  40. package/src/ui/Select/types/select.ts +0 -16
  41. package/src/ui/index.ts +0 -3
  42. package/src/utils/applyMask.tsx +0 -49
  43. package/src/utils/classnames.tsx +0 -89
  44. package/src/utils/formatar.tsx +0 -173
  45. package/src/utils/index.ts +0 -4
  46. package/src/utils/isDocumento.tsx +0 -46
  47. package/tailwind.config.js +0 -13
  48. package/tsconfig.json +0 -26
  49. package/tsconfig.node.json +0 -10
  50. package/vite.config.ts +0 -31
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-B1vZ8U-f.cjs"),s=require("./classnames-BqI3URgS.cjs"),t=require("./utils.cjs.js");exports.Button=e.Button;exports.Input=e.Input;exports.Select=e.Select;exports.classnames=s.classnames;exports.applyMask=t.applyMask;exports.formatar=t.formatar;exports.isDocumento=t.isDocumento;
@@ -0,0 +1,3 @@
1
+
2
+ export * from './ui';
3
+ export * from './utils';
@@ -0,0 +1,12 @@
1
+ import { B as s, I as t, S as r } from "./index-hkfwDYXz.js";
2
+ import { c as m } from "./classnames-2Mts7qXW.js";
3
+ import { applyMask as c, formatar as f, isDocumento as n } from "./utils.es.js";
4
+ export {
5
+ s as Button,
6
+ t as Input,
7
+ r as Select,
8
+ c as applyMask,
9
+ m as classnames,
10
+ f as formatar,
11
+ n as isDocumento
12
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-green-100:oklch(96.2% .044 156.743);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-400:oklch(70.7% .022 261.325);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--font-weight-medium:500;--font-weight-bold:700;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.z-50{z-index:50}.m-0{margin:calc(var(--spacing)*0)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.block{display:block}.flex{display:flex}.inline{display:inline}.max-h-72{max-height:calc(var(--spacing)*72)}.w-auto{width:auto}.w-full{width:100%}.flex-1{flex:1}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-start{justify-content:flex-start}.gap-2{gap:calc(var(--spacing)*2)}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-blue-500{border-color:var(--color-blue-500)}.border-green-500{border-color:var(--color-green-500)}.border-red-500{border-color:var(--color-red-500)}.border-transparent{border-color:#0000}.border-yellow-500{border-color:var(--color-yellow-500)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-400\/40{background-color:#99a1af66}@supports (color:color-mix(in lab,red,red)){.bg-gray-400\/40{background-color:color-mix(in oklab,var(--color-gray-400)40%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.bg-yellow-500{background-color:var(--color-yellow-500)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.pr-8{padding-right:calc(var(--spacing)*8)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-black{color:var(--color-black)}.text-blue-600{color:var(--color-blue-600)}.text-green-600{color:var(--color-green-600)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-white{color:var(--color-white)}.text-yellow-600{color:var(--color-yellow-600)}.placeholder-red-500::placeholder{color:var(--color-red-500)}.opacity-50{opacity:.5}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.first-letter\:uppercase:first-letter{text-transform:uppercase}@media (hover:hover){.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-green-100:hover{background-color:var(--color-green-100)}.hover\:bg-green-500:hover{background-color:var(--color-green-500)}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-yellow-100:hover{background-color:var(--color-yellow-100)}.hover\:bg-yellow-500:hover{background-color:var(--color-yellow-500)}.hover\:bg-yellow-600:hover{background-color:var(--color-yellow-600)}.hover\:text-black:hover{color:var(--color-black)}.hover\:text-white:hover{color:var(--color-white)}}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (prefers-color-scheme:dark){.dark\:text-red-500{color:var(--color-red-500)}}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}
@@ -0,0 +1,162 @@
1
+ export declare const COLORS: {
2
+ green: {
3
+ solid: {
4
+ bg: string;
5
+ hover: string;
6
+ text: string;
7
+ border: string;
8
+ };
9
+ outline: {
10
+ bg: string;
11
+ hover: string;
12
+ text: string;
13
+ border: string;
14
+ };
15
+ ghost: {
16
+ bg: string;
17
+ hover: string;
18
+ text: string;
19
+ border: string;
20
+ };
21
+ };
22
+ blue: {
23
+ solid: {
24
+ bg: string;
25
+ hover: string;
26
+ text: string;
27
+ border: string;
28
+ };
29
+ outline: {
30
+ bg: string;
31
+ hover: string;
32
+ text: string;
33
+ border: string;
34
+ };
35
+ ghost: {
36
+ bg: string;
37
+ hover: string;
38
+ text: string;
39
+ border: string;
40
+ };
41
+ };
42
+ red: {
43
+ solid: {
44
+ bg: string;
45
+ hover: string;
46
+ text: string;
47
+ border: string;
48
+ };
49
+ outline: {
50
+ bg: string;
51
+ hover: string;
52
+ text: string;
53
+ border: string;
54
+ };
55
+ ghost: {
56
+ bg: string;
57
+ hover: string;
58
+ text: string;
59
+ border: string;
60
+ };
61
+ };
62
+ yellow: {
63
+ solid: {
64
+ bg: string;
65
+ hover: string;
66
+ text: string;
67
+ border: string;
68
+ };
69
+ outline: {
70
+ bg: string;
71
+ hover: string;
72
+ text: string;
73
+ border: string;
74
+ };
75
+ ghost: {
76
+ bg: string;
77
+ hover: string;
78
+ text: string;
79
+ border: string;
80
+ };
81
+ };
82
+ primary: {
83
+ solid: {
84
+ bg: string;
85
+ hover: string;
86
+ text: string;
87
+ border: string;
88
+ };
89
+ outline: {
90
+ bg: string;
91
+ hover: string;
92
+ text: string;
93
+ border: string;
94
+ };
95
+ ghost: {
96
+ bg: string;
97
+ hover: string;
98
+ text: string;
99
+ border: string;
100
+ };
101
+ };
102
+ secondary: {
103
+ solid: {
104
+ bg: string;
105
+ hover: string;
106
+ text: string;
107
+ border: string;
108
+ };
109
+ outline: {
110
+ bg: string;
111
+ hover: string;
112
+ text: string;
113
+ border: string;
114
+ };
115
+ ghost: {
116
+ bg: string;
117
+ hover: string;
118
+ text: string;
119
+ border: string;
120
+ };
121
+ };
122
+ destructive: {
123
+ solid: {
124
+ bg: string;
125
+ hover: string;
126
+ text: string;
127
+ border: string;
128
+ };
129
+ outline: {
130
+ bg: string;
131
+ hover: string;
132
+ text: string;
133
+ border: string;
134
+ };
135
+ ghost: {
136
+ bg: string;
137
+ hover: string;
138
+ text: string;
139
+ border: string;
140
+ };
141
+ };
142
+ card: {
143
+ solid: {
144
+ bg: string;
145
+ hover: string;
146
+ text: string;
147
+ border: string;
148
+ };
149
+ outline: {
150
+ bg: string;
151
+ hover: string;
152
+ text: string;
153
+ border: string;
154
+ };
155
+ ghost: {
156
+ bg: string;
157
+ hover: string;
158
+ text: string;
159
+ border: string;
160
+ };
161
+ };
162
+ };
@@ -0,0 +1,3 @@
1
+ import { ButtonProps } from './types/button';
2
+ export * from './types/button';
3
+ export declare function Button({ title, icon, positionIcon, color, variant, disable, className, type, onClick, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { COLORS } from '../colors';
2
+
3
+ export interface ButtonProps {
4
+ onClick?: (e?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
5
+ title: string;
6
+ icon?: JSX.Element;
7
+ positionIcon?: "left" | "right";
8
+ disable?: boolean;
9
+ className?: string;
10
+ type?: "button" | "submit" | "reset";
11
+ color: Color;
12
+ variant?: "solid" | "outline" | "ghost";
13
+ }
14
+ export interface CustomColors {
15
+ }
16
+ export type Color = keyof typeof COLORS | keyof CustomColors;
@@ -0,0 +1,3 @@
1
+ import { InputProps } from './types/input';
2
+
3
+ export declare function Input<T>({ field, title, id, type, placeholder, className, value, iconPosition, icon, error, ...rest }: InputProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,10 @@
1
1
  export type inputElementsType<T> = {
2
- mask?: string;
3
- field: keyof T;
4
- title: string;
5
- iconPosition?: "left" | "right";
6
- icon?: React.JSX.Element;
2
+ mask?: string;
3
+ field: keyof T;
4
+ title: string;
5
+ iconPosition?: "left" | "right";
6
+ icon?: React.JSX.Element;
7
7
  } & React.InputHTMLAttributes<HTMLInputElement | HTMLSelectElement>;
8
-
9
8
  export type InputProps<T> = {
10
- error?: string;
9
+ error?: string;
11
10
  } & inputElementsType<T>;
@@ -0,0 +1,3 @@
1
+ import { SelectProps } from './types/select';
2
+
3
+ export declare function Select<T>({ field, title, id, placeholder, value, options, icon, iconPosition, optionPosition, error, required, onChange, selected, isClearable, searchable, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ export type SelectProps<T> = {
2
+ title: string;
3
+ id: string;
4
+ placeholder?: string;
5
+ field: keyof T & string;
6
+ value: string;
7
+ options: T[];
8
+ icon?: React.ReactNode;
9
+ iconPosition?: "left" | "right";
10
+ optionPosition?: "left" | "right";
11
+ error?: string;
12
+ required?: boolean;
13
+ onChange?: (value: T) => void;
14
+ selected?: T;
15
+ isClearable?: boolean;
16
+ searchable?: boolean;
17
+ };
@@ -0,0 +1,3 @@
1
+ export * from './Button';
2
+ export * from './Input';
3
+ export * from './Select';
package/dist/ui.cjs.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-B1vZ8U-f.cjs");exports.Button=t.Button;exports.Input=t.Input;exports.Select=t.Select;
package/dist/ui.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './ui/index'
package/dist/ui.es.js ADDED
@@ -0,0 +1,6 @@
1
+ import { B as e, I as o, S as s } from "./index-hkfwDYXz.js";
2
+ export {
3
+ e as Button,
4
+ o as Input,
5
+ s as Select
6
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Aplica uma máscara numérica ao valor informado.
3
+ *
4
+ * @param value - String com dígitos (ex: "12345678901")
5
+ * @param tipo Opcional - Tipo de máscara ("cnpj" ou "cpf")
6
+ * @param mask Opcional - Máscara no formato com 'x' para dígitos (ex: "xxx.xxx.xxx-xx")
7
+ * @returns Valor formatado conforme máscara (ex: "123.456.789-01")
8
+ */
9
+ export declare function applyMask(value: string, tipo?: "cnpj" | "cpf" | "outro", mask?: string): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Constrói uma string de classes CSS dinamicamente.
3
+ *
4
+ * Aceita qualquer número de argumentos do tipo string, boolean, null, undefined ou objeto:
5
+ * - Strings são adicionadas diretamente.
6
+ * - Objetos: chaves com valor truthy são incluídas como classes.
7
+ * - Arrays são processados recursivamente.
8
+ *
9
+ * @example
10
+ * classnames("btn", { active: isActive, disabled: false }, ["px-2", null])
11
+ * // Resultado: "btn active px-2"
12
+ *
13
+ * @param {...(string | object | undefined | null | boolean)[]} args - Lista de classes e condições.
14
+ * @returns {string} String final de classes separadas por espaço.
15
+ */
16
+ export declare function classnames(...args: (string | object | undefined | null | boolean)[]): string;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @file formatar.tsx
3
+ * @description Utilitário unificado para formatação de dados (Data, Massa, Moeda, Porcentagem).
4
+ * Este módulo não possui dependências externas.
5
+ */
6
+ /** Unidades de massa suportadas para conversão e exibição */
7
+ export type UnidadeMassa = "kg" | "t" | "kt" | "Mt";
8
+ /** Tipos de formatação disponíveis no sistema */
9
+ export type TipoFormato = "data" | "massa" | "moeda" | "porcentagem";
10
+ /**
11
+ * Interface para as opções de configuração dos formatadores.
12
+ * Permite personalizar a exibição de acordo com o tipo de dado.
13
+ *
14
+ * @property formato - Template para formatação de data (ex: "DD/MM/YYYY", "YYYY-MM-DD HH:mm"). Padrão: "DD/MM/YYYY"
15
+ * @property unidade - Unidade de massa para conversão/exibição. Padrão: "t"
16
+ * @property locale - Localidade para Intl (ex: "pt-BR", "en-US"). Padrão: "pt-BR"
17
+ * @property minimumFractionDigits - Mínimo de casas decimais.
18
+ * @property maximumFractionDigits - Máximo de casas decimais.
19
+ * @property currency - Moeda para formatação monetária (ex: "BRL", "USD"). Padrão: "BRL"
20
+ * @property notation - Notação numérica (standard, scientific, engineering, compact).
21
+ * @property compactDisplay - Exibição compacta (short, long).
22
+ */
23
+ export interface FormatarOptions {
24
+ formato?: string;
25
+ unidade?: UnidadeMassa;
26
+ locale?: string;
27
+ minimumFractionDigits?: number;
28
+ maximumFractionDigits?: number;
29
+ currency?: string;
30
+ notation?: "standard" | "scientific" | "engineering" | "compact";
31
+ compactDisplay?: "short" | "long";
32
+ }
33
+ /**
34
+ * Método unificado para formatação de diversos tipos de dados no sistema.
35
+ * Suporta datas (nativamente), massa, moeda e porcentagem.
36
+ *
37
+ * @param tipo - O tipo de dado a ser formatado ("data", "massa", "moeda", "porcentagem")
38
+ * @param valor - O valor bruto (String, Number ou Date)
39
+ * @param opcoes - Opções de customização (locale, formato, unidade, etc)
40
+ * @returns String formatada seguindo as regras do tipo e localidade
41
+ *
42
+ * @example
43
+ * // Formatação de Moeda
44
+ * formatar("moeda", 1500.5) // "R$ 1.500,50"
45
+ * formatar("moeda", 1500.5, { notation: "compact" }) // "1,5 mil R$"
46
+ *
47
+ * @example
48
+ * // Formatação de Data
49
+ * formatar("data", new Date()) // "19/03/2026"
50
+ * formatar("data", "2026-12-25", { formato: "DD/MM" }) // "25/12"
51
+ * formatar("data", "25/12/2026 15:30", { formato: "YYYY-MM-DD HH:mm" }) // "2026-12-25 15:30"
52
+ *
53
+ * @example
54
+ * // Formatação de Massa
55
+ * formatar("massa", 5000) // "5,0000 t"
56
+ * formatar("massa", 5000, { unidade: "kg" }) // "5.000,0000 kg"
57
+ *
58
+ * @example
59
+ * // Formatação de Porcentagem
60
+ * formatar("porcentagem", 75.5) // "75,5%"
61
+ * formatar("porcentagem", 100) // "100%"
62
+ */ export declare const formatar: (tipo: TipoFormato, valor: any, opcoes?: FormatarOptions) => string;
@@ -0,0 +1,4 @@
1
+ export * from './classnames';
2
+ export * from './applyMask';
3
+ export * from './isDocumento';
4
+ export * from './formatar';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Valida CPF ou CNPJ de forma unificada, identificando automaticamente o tipo pelo tamanho.
3
+ *
4
+ * @param documento - CPF ou CNPJ com ou sem formatação.
5
+ * @returns `true` se válido, `false` caso contrário.
6
+ *
7
+ * @example
8
+ * isDocumento("123.456.789-00") // true ou false
9
+ * isDocumento("12.345.678/0001-90") // true ou false
10
+ */
11
+ export declare function isDocumento(documento: string): boolean;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./classnames-BqI3URgS.cjs");function g(u,t,e){if((t==null?void 0:t.toLocaleLowerCase())==="cnpj")return g(u,"outro","xx.xxx.xxx/xxxx-xx");if((t==null?void 0:t.toLocaleLowerCase())==="cpf")return g(u,"outro","xxx.xxx.xxx-xx");const r=u.replace(/\D/g,"");let n="",a=0;if(e)for(let i=0;i<e.length;i++)if(e[i]==="x")if(a<r.length)n+=r[a],a++;else break;else if(a<r.length)n+=e[i];else break;return n}function F(u){const t=u.replace(/[^\d]+/g,"");if(/^(\d)\1+$/.test(t))return!1;if(t.length===11){for(let e=9;e<=10;e++){let r=0;for(let a=0;a<e;a++)r+=parseInt(t.charAt(a))*(e+1-a);let n=r*10%11;if((n===10||n===11)&&(n=0),n!==parseInt(t.charAt(e)))return!1}return!0}if(t.length===14){const e=[6,5,4,3,2,9,8,7,6,5,4,3,2];for(let r=12;r<=13;r++){let n=0;for(let i=0;i<r;i++)n+=parseInt(t.charAt(i))*e[i+13-r];const a=(n%=11)<2?0:11-n;if(parseInt(t.charAt(r))!==a)return!1}return!0}return!1}const S={kg:1,t:1e3,kt:1e6,Mt:1e9},w=(u,t,e={})=>{const{locale:r="pt-BR",formato:n="DD/MM/YYYY",unidade:a="t",minimumFractionDigits:i,maximumFractionDigits:d,currency:x="BRL"}=e,f=s=>typeof s=="number"?s:typeof s=="string"?Number(s.replace(",",".")):NaN;switch(u){case"data":{if(!t)return"";const o=(c=>{if(c instanceof Date)return c;if(typeof c=="string"){const m=c.match(/^(\d{2})\/(\d{2})\/(\d{4})(?: (\d{2}):(\d{2})(?::(\d{2}))?)?$/);if(m){const N=Number(m[3]),p=Number(m[2])-1,Y=Number(m[1]),b=Number(m[4]||0),h=Number(m[5]||0),y=Number(m[6]||0);return new Date(N,p,Y,b,h,y)}}return new Date(c)})(t);if(isNaN(o.getTime()))return"";const l=c=>String(c).padStart(2,"0"),D={YYYY:String(o.getFullYear()),YY:String(o.getFullYear()).slice(-2),MM:l(o.getMonth()+1),DD:l(o.getDate()),HH:l(o.getHours()),mm:l(o.getMinutes()),ss:l(o.getSeconds())};return n.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,c=>D[c])}case"massa":{const s=f(t);if(isNaN(s))return"Valor inválido";const o=s/S[a];return`${new Intl.NumberFormat(r,{minimumFractionDigits:i??4,maximumFractionDigits:d??4}).format(o)} ${a}`}case"moeda":{const s=f(t);return isNaN(s)?"Valor inválido":new Intl.NumberFormat(r,{notation:e.notation??"standard",compactDisplay:e.compactDisplay??"short",style:"currency",currency:x}).format(s)}case"porcentagem":{const s=f(t);return isNaN(s)?"0%":new Intl.NumberFormat(r,{style:"percent",minimumFractionDigits:i??0,maximumFractionDigits:d??1}).format(s/100)}default:return String(t)}};exports.classnames=M.classnames;exports.applyMask=g;exports.formatar=w;exports.isDocumento=F;
@@ -0,0 +1 @@
1
+ export * from './utils/index'
@@ -0,0 +1,128 @@
1
+ import { c as A } from "./classnames-2Mts7qXW.js";
2
+ function x(u, t, e) {
3
+ if ((t == null ? void 0 : t.toLocaleLowerCase()) === "cnpj")
4
+ return x(u, "outro", "xx.xxx.xxx/xxxx-xx");
5
+ if ((t == null ? void 0 : t.toLocaleLowerCase()) === "cpf")
6
+ return x(u, "outro", "xxx.xxx.xxx-xx");
7
+ const r = u.replace(/\D/g, "");
8
+ let n = "", a = 0;
9
+ if (e)
10
+ for (let i = 0; i < e.length; i++)
11
+ if (e[i] === "x")
12
+ if (a < r.length)
13
+ n += r[a], a++;
14
+ else
15
+ break;
16
+ else if (a < r.length)
17
+ n += e[i];
18
+ else
19
+ break;
20
+ return n;
21
+ }
22
+ function M(u) {
23
+ const t = u.replace(/[^\d]+/g, "");
24
+ if (/^(\d)\1+$/.test(t)) return !1;
25
+ if (t.length === 11) {
26
+ for (let e = 9; e <= 10; e++) {
27
+ let r = 0;
28
+ for (let a = 0; a < e; a++)
29
+ r += parseInt(t.charAt(a)) * (e + 1 - a);
30
+ let n = r * 10 % 11;
31
+ if ((n === 10 || n === 11) && (n = 0), n !== parseInt(t.charAt(e))) return !1;
32
+ }
33
+ return !0;
34
+ }
35
+ if (t.length === 14) {
36
+ const e = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
37
+ for (let r = 12; r <= 13; r++) {
38
+ let n = 0;
39
+ for (let i = 0; i < r; i++)
40
+ n += parseInt(t.charAt(i)) * e[i + 13 - r];
41
+ const a = (n %= 11) < 2 ? 0 : 11 - n;
42
+ if (parseInt(t.charAt(r)) !== a) return !1;
43
+ }
44
+ return !0;
45
+ }
46
+ return !1;
47
+ }
48
+ const F = {
49
+ kg: 1,
50
+ t: 1e3,
51
+ kt: 1e6,
52
+ Mt: 1e9
53
+ }, w = (u, t, e = {}) => {
54
+ const {
55
+ locale: r = "pt-BR",
56
+ formato: n = "DD/MM/YYYY",
57
+ unidade: a = "t",
58
+ minimumFractionDigits: i,
59
+ maximumFractionDigits: g,
60
+ currency: d = "BRL"
61
+ } = e, l = (s) => typeof s == "number" ? s : typeof s == "string" ? Number(s.replace(",", ".")) : NaN;
62
+ switch (u) {
63
+ case "data": {
64
+ if (!t) return "";
65
+ const o = ((c) => {
66
+ if (c instanceof Date) return c;
67
+ if (typeof c == "string") {
68
+ const m = c.match(
69
+ /^(\d{2})\/(\d{2})\/(\d{4})(?: (\d{2}):(\d{2})(?::(\d{2}))?)?$/
70
+ );
71
+ if (m) {
72
+ const N = Number(m[3]), p = Number(m[2]) - 1, Y = Number(m[1]), b = Number(m[4] || 0), h = Number(m[5] || 0), y = Number(m[6] || 0);
73
+ return new Date(N, p, Y, b, h, y);
74
+ }
75
+ }
76
+ return new Date(c);
77
+ })(t);
78
+ if (isNaN(o.getTime())) return "";
79
+ const f = (c) => String(c).padStart(2, "0"), D = {
80
+ YYYY: String(o.getFullYear()),
81
+ YY: String(o.getFullYear()).slice(-2),
82
+ MM: f(o.getMonth() + 1),
83
+ DD: f(o.getDate()),
84
+ HH: f(o.getHours()),
85
+ mm: f(o.getMinutes()),
86
+ ss: f(o.getSeconds())
87
+ };
88
+ return n.replace(
89
+ /YYYY|YY|MM|DD|HH|mm|ss/g,
90
+ (c) => D[c]
91
+ );
92
+ }
93
+ case "massa": {
94
+ const s = l(t);
95
+ if (isNaN(s)) return "Valor inválido";
96
+ const o = s / F[a];
97
+ return `${new Intl.NumberFormat(r, {
98
+ minimumFractionDigits: i ?? 4,
99
+ maximumFractionDigits: g ?? 4
100
+ }).format(o)} ${a}`;
101
+ }
102
+ case "moeda": {
103
+ const s = l(t);
104
+ return isNaN(s) ? "Valor inválido" : new Intl.NumberFormat(r, {
105
+ notation: e.notation ?? "standard",
106
+ compactDisplay: e.compactDisplay ?? "short",
107
+ style: "currency",
108
+ currency: d
109
+ }).format(s);
110
+ }
111
+ case "porcentagem": {
112
+ const s = l(t);
113
+ return isNaN(s) ? "0%" : new Intl.NumberFormat(r, {
114
+ style: "percent",
115
+ minimumFractionDigits: i ?? 0,
116
+ maximumFractionDigits: g ?? 1
117
+ }).format(s / 100);
118
+ }
119
+ default:
120
+ return String(t);
121
+ }
122
+ };
123
+ export {
124
+ x as applyMask,
125
+ A as classnames,
126
+ w as formatar,
127
+ M as isDocumento
128
+ };
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "@processhub-lib/react",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "gen:endpoints": "tsx src/scripts/generate-endpoints.ts",
7
+ "release": "npm run build && npm version patch && npm publish --access public",
7
8
  "build": "vite build"
8
9
  },
9
10
  "main": "./dist/index.cjs.js",
10
11
  "module": "./dist/index.es.js",
11
12
  "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
12
16
  "exports": {
13
17
  ".": {
14
18
  "import": "./dist/index.es.js",
package/postcss.config.js DELETED
@@ -1,5 +0,0 @@
1
- export default {
2
- plugins: {
3
- "@tailwindcss/postcss": {},
4
- },
5
- };
@@ -1,45 +0,0 @@
1
- import React, { createContext, useContext, ReactNode } from "react";
2
- import { COLORS } from "../ui/Button/colors";
3
-
4
- export interface ColorSet {
5
- bg: string;
6
- hover: string;
7
- text: string;
8
- border: string;
9
- }
10
-
11
- export interface Theme {
12
- [key: string]: {
13
- solid: ColorSet;
14
- outline: ColorSet;
15
- ghost: ColorSet;
16
- };
17
- }
18
-
19
- const ThemeContext = createContext<Theme>(COLORS as Theme);
20
-
21
- export const useTheme = () => {
22
- const context = useContext(ThemeContext);
23
- if (!context) {
24
- throw new Error("useTheme must be used within a ProcessHubProvider");
25
- }
26
- return context;
27
- };
28
-
29
- interface ProcessHubProviderProps {
30
- children: ReactNode;
31
- theme?: Partial<Theme>;
32
- }
33
-
34
- export const ProcessHubProvider: React.FC<ProcessHubProviderProps> = ({
35
- children,
36
- theme = {},
37
- }) => {
38
- const activeTheme = { ...COLORS, ...theme } as Theme;
39
-
40
- return (
41
- <ThemeContext.Provider value={activeTheme}>
42
- {children}
43
- </ThemeContext.Provider>
44
- );
45
- };
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import "./style.css";
2
- export * from "./ui";
3
- export * from "./utils";
4
- export * from "./context/ThemeContext";