lsoft-ui 0.0.1

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/dist/components/Accordion/CustomAccordionGroup.d.ts +10 -0
  4. package/dist/components/Accordion/CustomAccordionGroup.js +20 -0
  5. package/dist/components/Accordion/CustomAccordionItem.d.ts +12 -0
  6. package/dist/components/Accordion/CustomAccordionItem.js +5 -0
  7. package/dist/components/CustomAlertDialog.d.ts +8 -0
  8. package/dist/components/CustomAlertDialog.js +18 -0
  9. package/dist/components/CustomAutoComplete.d.ts +35 -0
  10. package/dist/components/CustomAutoComplete.js +141 -0
  11. package/dist/components/CustomBadge.d.ts +9 -0
  12. package/dist/components/CustomBadge.js +25 -0
  13. package/dist/components/CustomButton.d.ts +16 -0
  14. package/dist/components/CustomButton.js +18 -0
  15. package/dist/components/CustomCard.d.ts +11 -0
  16. package/dist/components/CustomCard.js +20 -0
  17. package/dist/components/CustomCheckBox.d.ts +12 -0
  18. package/dist/components/CustomCheckBox.js +26 -0
  19. package/dist/components/CustomCheckboxGroup.d.ts +21 -0
  20. package/dist/components/CustomCheckboxGroup.js +28 -0
  21. package/dist/components/CustomDrawer.d.ts +11 -0
  22. package/dist/components/CustomDrawer.js +36 -0
  23. package/dist/components/CustomIconButton.d.ts +7 -0
  24. package/dist/components/CustomIconButton.js +19 -0
  25. package/dist/components/CustomInput.d.ts +19 -0
  26. package/dist/components/CustomInput.js +32 -0
  27. package/dist/components/CustomInputNumber.d.ts +17 -0
  28. package/dist/components/CustomInputNumber.js +23 -0
  29. package/dist/components/CustomList.d.ts +22 -0
  30. package/dist/components/CustomList.js +27 -0
  31. package/dist/components/CustomLoadingCenterPage.d.ts +6 -0
  32. package/dist/components/CustomLoadingCenterPage.js +5 -0
  33. package/dist/components/CustomModal.d.ts +19 -0
  34. package/dist/components/CustomModal.js +83 -0
  35. package/dist/components/CustomModalNfe.d.ts +34 -0
  36. package/dist/components/CustomModalNfe.js +86 -0
  37. package/dist/components/CustomMultSelect.d.ts +28 -0
  38. package/dist/components/CustomMultSelect.js +51 -0
  39. package/dist/components/CustomMultipleInputs.d.ts +36 -0
  40. package/dist/components/CustomMultipleInputs.js +91 -0
  41. package/dist/components/CustomPopover.d.ts +21 -0
  42. package/dist/components/CustomPopover.js +19 -0
  43. package/dist/components/CustomRadioGroup.d.ts +32 -0
  44. package/dist/components/CustomRadioGroup.js +37 -0
  45. package/dist/components/CustomSelect.d.ts +20 -0
  46. package/dist/components/CustomSelect.js +25 -0
  47. package/dist/components/CustomSkeleton.d.ts +9 -0
  48. package/dist/components/CustomSkeleton.js +17 -0
  49. package/dist/components/CustomSwitch.d.ts +20 -0
  50. package/dist/components/CustomSwitch.js +15 -0
  51. package/dist/components/CustomTable.d.ts +51 -0
  52. package/dist/components/CustomTable.js +307 -0
  53. package/dist/components/CustomTabs.d.ts +27 -0
  54. package/dist/components/CustomTabs.js +100 -0
  55. package/dist/components/CustomTextarea.d.ts +14 -0
  56. package/dist/components/CustomTextarea.js +35 -0
  57. package/dist/components/CustomToast.d.ts +10 -0
  58. package/dist/components/CustomToast.js +6 -0
  59. package/dist/components/DatePicker/CustomDatePicker.d.ts +24 -0
  60. package/dist/components/DatePicker/CustomDatePicker.js +628 -0
  61. package/dist/components/Pagination/CustomPagination.d.ts +50 -0
  62. package/dist/components/Pagination/CustomPagination.js +159 -0
  63. package/dist/components/ThemeToggle.d.ts +1 -0
  64. package/dist/components/ThemeToggle.js +30 -0
  65. package/dist/components/index.d.ts +30 -0
  66. package/dist/components/index.js +30 -0
  67. package/dist/contexts/ThemeContext.d.ts +18 -0
  68. package/dist/contexts/ThemeContext.js +34 -0
  69. package/dist/examples/CodeViewer.d.ts +8 -0
  70. package/dist/examples/CodeViewer.js +7 -0
  71. package/dist/examples/FormikExample.d.ts +2 -0
  72. package/dist/examples/FormikExample.js +199 -0
  73. package/dist/examples/NumberInputExample.d.ts +2 -0
  74. package/dist/examples/NumberInputExample.js +198 -0
  75. package/dist/examples/ReactHookFormExample.d.ts +2 -0
  76. package/dist/examples/ReactHookFormExample.js +217 -0
  77. package/dist/examples/SimpleFormExample.d.ts +2 -0
  78. package/dist/examples/SimpleFormExample.js +216 -0
  79. package/dist/examples/TabsExample.d.ts +2 -0
  80. package/dist/examples/TabsExample.js +182 -0
  81. package/dist/examples/index.d.ts +6 -0
  82. package/dist/examples/index.js +6 -0
  83. package/dist/index.d.ts +32 -0
  84. package/dist/index.js +32 -0
  85. package/dist/providers/LsCKFrontProvider.d.ts +6 -0
  86. package/dist/providers/LsCKFrontProvider.js +7 -0
  87. package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionGroup.stories.d.ts +13 -0
  88. package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionGroup.stories.js +787 -0
  89. package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionItem.stories.d.ts +13 -0
  90. package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionItem.stories.js +759 -0
  91. package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckBox.stories.d.ts +15 -0
  92. package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckBox.stories.js +770 -0
  93. package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckboxGroup.stories.d.ts +33 -0
  94. package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckboxGroup.stories.js +2152 -0
  95. package/dist/stories/Londrisoft/Components/CustomAlertDialog.stories.d.ts +24 -0
  96. package/dist/stories/Londrisoft/Components/CustomAlertDialog.stories.js +462 -0
  97. package/dist/stories/Londrisoft/Components/CustomAutoComplete.stories.d.ts +41 -0
  98. package/dist/stories/Londrisoft/Components/CustomAutoComplete.stories.js +1135 -0
  99. package/dist/stories/Londrisoft/Components/CustomBadge.stories.d.ts +21 -0
  100. package/dist/stories/Londrisoft/Components/CustomBadge.stories.js +546 -0
  101. package/dist/stories/Londrisoft/Components/CustomButton.stories.d.ts +17 -0
  102. package/dist/stories/Londrisoft/Components/CustomButton.stories.js +1099 -0
  103. package/dist/stories/Londrisoft/Components/CustomCard.stories.d.ts +17 -0
  104. package/dist/stories/Londrisoft/Components/CustomCard.stories.js +687 -0
  105. package/dist/stories/Londrisoft/Components/CustomDrawer.stories.d.ts +24 -0
  106. package/dist/stories/Londrisoft/Components/CustomDrawer.stories.js +521 -0
  107. package/dist/stories/Londrisoft/Components/CustomIconButton.stories.d.ts +14 -0
  108. package/dist/stories/Londrisoft/Components/CustomIconButton.stories.js +1024 -0
  109. package/dist/stories/Londrisoft/Components/CustomInput.stories.d.ts +15 -0
  110. package/dist/stories/Londrisoft/Components/CustomInput.stories.js +1094 -0
  111. package/dist/stories/Londrisoft/Components/CustomInputNumber.stories.d.ts +11 -0
  112. package/dist/stories/Londrisoft/Components/CustomInputNumber.stories.js +676 -0
  113. package/dist/stories/Londrisoft/Components/CustomList.stories.d.ts +18 -0
  114. package/dist/stories/Londrisoft/Components/CustomList.stories.js +1353 -0
  115. package/dist/stories/Londrisoft/Components/CustomLoadingCenterPage.stories.d.ts +17 -0
  116. package/dist/stories/Londrisoft/Components/CustomLoadingCenterPage.stories.js +304 -0
  117. package/dist/stories/Londrisoft/Components/CustomModal.stories.d.ts +19 -0
  118. package/dist/stories/Londrisoft/Components/CustomModal.stories.js +631 -0
  119. package/dist/stories/Londrisoft/Components/CustomModalNfe.stories.d.ts +19 -0
  120. package/dist/stories/Londrisoft/Components/CustomModalNfe.stories.js +589 -0
  121. package/dist/stories/Londrisoft/Components/CustomMultSelect.stories.d.ts +15 -0
  122. package/dist/stories/Londrisoft/Components/CustomMultSelect.stories.js +447 -0
  123. package/dist/stories/Londrisoft/Components/CustomMultipleInputs.stories.d.ts +15 -0
  124. package/dist/stories/Londrisoft/Components/CustomMultipleInputs.stories.js +1068 -0
  125. package/dist/stories/Londrisoft/Components/CustomPopover.stories.d.ts +10 -0
  126. package/dist/stories/Londrisoft/Components/CustomPopover.stories.js +208 -0
  127. package/dist/stories/Londrisoft/Components/CustomSelect.stories.d.ts +27 -0
  128. package/dist/stories/Londrisoft/Components/CustomSelect.stories.js +1086 -0
  129. package/dist/stories/Londrisoft/Components/CustomSkeleton.stories.d.ts +25 -0
  130. package/dist/stories/Londrisoft/Components/CustomSkeleton.stories.js +534 -0
  131. package/dist/stories/Londrisoft/Components/CustomSwitch.stories.d.ts +15 -0
  132. package/dist/stories/Londrisoft/Components/CustomSwitch.stories.js +422 -0
  133. package/dist/stories/Londrisoft/Components/CustomTable.stories.d.ts +43 -0
  134. package/dist/stories/Londrisoft/Components/CustomTable.stories.js +2121 -0
  135. package/dist/stories/Londrisoft/Components/CustomTabs.stories.d.ts +19 -0
  136. package/dist/stories/Londrisoft/Components/CustomTabs.stories.js +866 -0
  137. package/dist/stories/Londrisoft/Components/CustomTextarea.stories.d.ts +21 -0
  138. package/dist/stories/Londrisoft/Components/CustomTextarea.stories.js +408 -0
  139. package/dist/stories/Londrisoft/Components/CustomToast.stories.d.ts +21 -0
  140. package/dist/stories/Londrisoft/Components/CustomToast.stories.js +1041 -0
  141. package/dist/stories/Londrisoft/Components/DatePicker/CustomDatePicker.stories.d.ts +17 -0
  142. package/dist/stories/Londrisoft/Components/DatePicker/CustomDatePicker.stories.js +653 -0
  143. package/dist/stories/Londrisoft/Components/Pagination/CustomPagination.stories.d.ts +17 -0
  144. package/dist/stories/Londrisoft/Components/Pagination/CustomPagination.stories.js +429 -0
  145. package/dist/stories/Londrisoft/Components/Radio/CustomRadioGroup.stories.d.ts +22 -0
  146. package/dist/stories/Londrisoft/Components/Radio/CustomRadioGroup.stories.js +766 -0
  147. package/dist/stories/Londrisoft/Examples/IntegrationExamples.stories.d.ts +16 -0
  148. package/dist/stories/Londrisoft/Examples/IntegrationExamples.stories.js +514 -0
  149. package/dist/stories/Londrisoft/Theme/ThemeShowcase.stories.d.ts +5 -0
  150. package/dist/stories/Londrisoft/Theme/ThemeShowcase.stories.js +112 -0
  151. package/dist/stories/options.d.ts +13 -0
  152. package/dist/stories/options.js +124 -0
  153. package/dist/theme/bime.d.ts +92 -0
  154. package/dist/theme/bime.js +352 -0
  155. package/dist/theme/index.d.ts +5 -0
  156. package/dist/theme/index.js +8 -0
  157. package/dist/theme/waipe.d.ts +102 -0
  158. package/dist/theme/waipe.js +362 -0
  159. package/package.json +53 -0
@@ -0,0 +1,19 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { IconButton } from "@chakra-ui/react";
14
+ import { SearchIcon } from "@chakra-ui/icons";
15
+ const CustomIconButton = (_a) => {
16
+ var { icon = _jsx(SearchIcon, {}), colorScheme = "blue", backgroundColor = "primary.300", borderColor = "" } = _a, props = __rest(_a, ["icon", "colorScheme", "backgroundColor", "borderColor"]);
17
+ return (_jsx(IconButton, Object.assign({ colorScheme: colorScheme, icon: icon, backgroundColor: backgroundColor, borderColor: borderColor, borderWidth: borderColor ? "1px" : "0px" }, props)));
18
+ };
19
+ export default CustomIconButton;
@@ -0,0 +1,19 @@
1
+ import React, { ReactNode } from "react";
2
+ import { InputProps } from "@chakra-ui/react";
3
+ interface CustomInputProps extends InputProps {
4
+ label?: string;
5
+ type?: string;
6
+ placeholder?: string;
7
+ error?: string;
8
+ leftIcon?: ReactNode;
9
+ rightIcon?: ReactNode;
10
+ showError?: boolean;
11
+ withFormControl?: boolean;
12
+ required?: boolean;
13
+ tooltip?: string;
14
+ labelColor?: string;
15
+ labelBold?: boolean;
16
+ size?: "xs" | "sm" | "md" | "lg";
17
+ }
18
+ export declare const CustomInput: React.ForwardRefExoticComponent<CustomInputProps & React.RefAttributes<HTMLInputElement>>;
19
+ export {};
@@ -0,0 +1,32 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import React from "react";
14
+ import { Input, FormControl, FormLabel, FormErrorMessage, InputGroup, InputLeftElement, InputRightElement, Tooltip, Text, HStack, } from "@chakra-ui/react";
15
+ import { Info } from "lucide-react";
16
+ export const CustomInput = React.forwardRef((_a, ref) => {
17
+ var { label, type = "text", placeholder, error, leftIcon, rightIcon, withFormControl = true, showError = true, required = false, tooltip, labelColor = "neutral.400", labelBold = false, size = "sm" } = _a, props = __rest(_a, ["label", "type", "placeholder", "error", "leftIcon", "rightIcon", "withFormControl", "showError", "required", "tooltip", "labelColor", "labelBold", "size"]);
18
+ const inputElement = (_jsxs(_Fragment, { children: [label && label.trim() !== "" && (_jsx(FormLabel, { fontSize: "xs", children: _jsxs(HStack, { spacing: 1, align: "center", children: [_jsx(Text, { color: labelColor || "neutral.400", fontWeight: labelBold ? "bold" : "normal", children: label }), required && (_jsx(Text, { color: "red.500", fontSize: "xs", children: "*" })), tooltip && (_jsx(Tooltip, { label: tooltip, placement: "top", hasArrow: true, children: _jsx(Info, { color: "var(--chakra-colors-alert-warning)", width: "16px", height: "16px" }) }))] }) })), _jsxs(InputGroup, { size: size, sx: {
19
+ ".chakra-input": { transition: "border-color .5s, box-shadow .5s" },
20
+ ".input-left, .input-right": { transition: "color .5s" },
21
+ "&:focus-within .input-left, &:focus-within .input-right": {
22
+ color: "primary.300",
23
+ },
24
+ "&:has(input:not(:placeholder-shown)) .input-left, &:has(input:not(:placeholder-shown)) .input-right": {
25
+ color: "primary.300",
26
+ },
27
+ }, children: [leftIcon && (_jsx(InputLeftElement, { className: "input-left", color: "border.primary", children: leftIcon })), _jsx(Input, Object.assign({ ref: ref, type: type, placeholder: placeholder, focusBorderColor: "primary.300", backgroundColor: props.isDisabled ? "background.secondary" : "background.primary", borderColor: "border.primary", color: "neutral.400", borderRadius: "4px", size: size, _placeholder: {
28
+ color: "neutral.200",
29
+ opacity: 1,
30
+ } }, props)), rightIcon && (_jsx(InputRightElement, { className: "input-right", color: "border.primary", children: rightIcon }))] }), showError && error && (_jsx(FormErrorMessage, { fontSize: "xs", mt: "3px", children: error }))] }));
31
+ return withFormControl ? (_jsx(FormControl, { isInvalid: !!error, children: inputElement })) : (inputElement);
32
+ });
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { NumberInputProps } from "@chakra-ui/react";
3
+ interface CustomInputNumberProps extends NumberInputProps {
4
+ label?: string;
5
+ error?: string;
6
+ showError?: boolean;
7
+ withFormControl?: boolean;
8
+ fieldSize?: "sm" | "md" | "lg";
9
+ disabled?: boolean;
10
+ style?: React.CSSProperties;
11
+ required?: boolean;
12
+ tooltip?: string;
13
+ labelColor?: string;
14
+ labelBold?: boolean;
15
+ }
16
+ declare const CustomInputNumber: React.FC<CustomInputNumberProps>;
17
+ export default CustomInputNumber;
@@ -0,0 +1,23 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { FormControl, FormErrorMessage, FormLabel, NumberInput, NumberInputField, Tooltip, Text, HStack, } from "@chakra-ui/react";
14
+ import { Info } from "lucide-react";
15
+ const CustomInputNumber = (_a) => {
16
+ var { label, error, showError = true, withFormControl = true, fieldSize = "md", disabled = false, style = {}, required = false, tooltip, labelColor = "neutral.400", labelBold = false } = _a, props = __rest(_a, ["label", "error", "showError", "withFormControl", "fieldSize", "disabled", "style", "required", "tooltip", "labelColor", "labelBold"]);
17
+ const inputElement = (_jsxs(_Fragment, { children: [label && label.trim() !== "" && (_jsx(FormLabel, { fontSize: "xs", children: _jsxs(HStack, { spacing: 1, align: "center", children: [_jsx(Text, { color: labelColor, fontWeight: labelBold ? "bold" : "normal", children: label }), required && (_jsx(Text, { color: "red.500", fontSize: "xs", children: "*" })), tooltip && (_jsx(Tooltip, { label: tooltip, placement: "top", hasArrow: true, children: _jsx(Info, { color: "var(--chakra-colors-alert-warning)", width: "16px", height: "16px" }) }))] }) })), _jsx(NumberInput, Object.assign({ size: fieldSize, focusBorderColor: "primary.300", backgroundColor: props.isDisabled ? "background.secondary" : "background.primary", borderColor: "border.primary", color: "neutral.400", borderRadius: "4px", style: style, isDisabled: disabled }, props, { children: _jsx(NumberInputField, { _placeholder: {
18
+ color: "neutral.200",
19
+ opacity: 1
20
+ } }) })), showError && error && (_jsx(FormErrorMessage, { fontSize: "xs", mt: "3px", children: error }))] }));
21
+ return withFormControl ? (_jsx(FormControl, { isInvalid: !!error, children: inputElement })) : (inputElement);
22
+ };
23
+ export default CustomInputNumber;
@@ -0,0 +1,22 @@
1
+ import { ListProps } from "@chakra-ui/react";
2
+ import { ReactNode } from "react";
3
+ export interface CustomListItem {
4
+ id: string | number;
5
+ label: string | ReactNode;
6
+ icon?: ReactNode;
7
+ description?: string | ReactNode;
8
+ isActive?: boolean;
9
+ }
10
+ interface CustomListProps extends Omit<ListProps, "children"> {
11
+ items: CustomListItem[];
12
+ onItemClick?: (item: CustomListItem) => void;
13
+ bgColor?: string;
14
+ hoverColor?: string;
15
+ activeColor?: string;
16
+ iconColor?: string;
17
+ striped?: boolean;
18
+ stripedColor?: string;
19
+ }
20
+ export declare function CustomList({ items, onItemClick, bgColor, hoverColor, activeColor, iconColor, striped, stripedColor, // cor alternada
21
+ ...props }: CustomListProps): import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,27 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { List, ListItem, Text, Box, } from "@chakra-ui/react";
14
+ export function CustomList(_a) {
15
+ var { items, onItemClick, bgColor = "background.primary", hoverColor = "background.secondary", activeColor = "transparent", iconColor, striped = false, stripedColor = "background.secondary" } = _a, // cor alternada
16
+ props = __rest(_a, ["items", "onItemClick", "bgColor", "hoverColor", "activeColor", "iconColor", "striped", "stripedColor"]);
17
+ return (_jsx(List, Object.assign({ spacing: 1 }, props, { children: items.map((item, index) => {
18
+ // se striped = true, alterna a cor
19
+ const itemBg = item.isActive
20
+ ? activeColor
21
+ : striped && index % 2 !== 0
22
+ ? stripedColor
23
+ : bgColor;
24
+ return (_jsx(ListItem, { px: 4, py: 2, bg: itemBg, borderRadius: "none", cursor: onItemClick ? "pointer" : "default", transition: "background 0.2s ease", _hover: { bg: hoverColor }, onClick: () => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item), role: onItemClick ? "button" : undefined, "aria-label": onItemClick ? `Selecionar ${item.label}` : undefined, children: _jsxs(Box, { children: [typeof item.label === "string" ? (_jsx(Text, { fontSize: "sm", fontWeight: "medium", children: item.label })) : (item.label), item.description &&
25
+ (typeof item.description === "string" ? (_jsx(Text, { fontSize: "xs", color: "neutral.400", children: item.description })) : (item.description))] }) }, item.id));
26
+ }) })));
27
+ }
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface LoadingProps {
3
+ message?: string;
4
+ }
5
+ export declare const CustomLoadingCenterPage: React.FC<LoadingProps>;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Spinner, Text } from "@chakra-ui/react";
3
+ export const CustomLoadingCenterPage = ({ message, }) => {
4
+ return (_jsxs(Box, { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", bg: "transparent", flexDirection: "column", children: [_jsx(Spinner, { size: "xl", thickness: "4px", speed: "0.65s", color: "primary.300", emptyColor: "gray.200" }), message && (_jsx(Text, { mt: 4, fontSize: "lg", color: "netural.400", textAlign: "center", children: message }))] }));
5
+ };
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { ModalProps, ModalOverlayProps, ModalContentProps } from "@chakra-ui/react";
3
+ export interface CustomModalProps extends Omit<ModalProps, "children"> {
4
+ modalHeader?: React.ReactNode;
5
+ modalBody?: React.ReactNode;
6
+ modalFooter?: React.ReactNode;
7
+ modalHeaderIcon?: {
8
+ icon: React.ReactNode;
9
+ iconColor: string;
10
+ bgIconColor: string;
11
+ headerColor: string;
12
+ };
13
+ overlayProps?: ModalOverlayProps;
14
+ contentProps?: ModalContentProps;
15
+ icon?: React.ReactNode;
16
+ style?: React.CSSProperties;
17
+ typeMsg?: "success" | "error" | "warning" | "info" | "nfWarning" | "nfError" | "nfSuccess" | "nfDenied";
18
+ }
19
+ export declare const CustomModal: React.FC<CustomModalProps>;
@@ -0,0 +1,83 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter, ModalCloseButton, Flex, Heading, Text, } from "@chakra-ui/react";
14
+ import { CircleCheck, CircleX, TriangleAlert } from "lucide-react";
15
+ function getTypeMsgColors(type) {
16
+ switch (type) {
17
+ case "success":
18
+ return {
19
+ boxBg: "alert.success",
20
+ flexBg: "alert.successBg",
21
+ IconModal: _jsx(CircleCheck, { size: 41 }),
22
+ };
23
+ case "error":
24
+ return {
25
+ boxBg: "alert.error",
26
+ flexBg: "alert.errorBg",
27
+ IconModal: _jsx(CircleX, { size: 41 }),
28
+ };
29
+ case "warning":
30
+ return {
31
+ boxBg: "alert.warning",
32
+ flexBg: "alert.warningBg",
33
+ IconModal: _jsx(TriangleAlert, { size: 41 }),
34
+ };
35
+ case "info":
36
+ return {
37
+ boxBg: "alert.info",
38
+ flexBg: "alert.infoBg",
39
+ IconModal: _jsx(TriangleAlert, { size: 41 }),
40
+ };
41
+ case "nfWarning":
42
+ return {
43
+ boxBg: "alert.warning",
44
+ flexBg: "alert.warningBg",
45
+ IconModal: _jsx(TriangleAlert, { size: 41 }),
46
+ };
47
+ case "nfError":
48
+ return {
49
+ boxBg: "alert.error",
50
+ flexBg: "alert.errorBg",
51
+ IconModal: _jsx(CircleX, { size: 41 }),
52
+ };
53
+ case "nfSuccess":
54
+ return {
55
+ boxBg: "alert.success",
56
+ flexBg: "alert.successBg",
57
+ IconModal: _jsx(CircleCheck, { size: 41 }),
58
+ };
59
+ case "nfDenied":
60
+ return {
61
+ boxBg: "neutral.300",
62
+ flexBg: "neutral.200",
63
+ IconModal: _jsx(CircleX, { size: 41 }),
64
+ };
65
+ default:
66
+ return {
67
+ boxBg: "primary.300",
68
+ flexBg: "transparent",
69
+ IconModal: _jsx(TriangleAlert, { size: 41, color: "yellow.400" }),
70
+ };
71
+ }
72
+ }
73
+ export const CustomModal = (_a) => {
74
+ var _b, _c, _d, _e;
75
+ var { isOpen, onClose, modalHeader, modalHeaderIcon, modalBody, modalFooter, typeMsg, size = "sm", overlayProps, contentProps } = _a, props = __rest(_a, ["isOpen", "onClose", "modalHeader", "modalHeaderIcon", "modalBody", "modalFooter", "typeMsg", "size", "overlayProps", "contentProps"]);
76
+ const { boxBg, flexBg, IconModal } = getTypeMsgColors(typeMsg);
77
+ return (_jsxs(Modal, Object.assign({ isOpen: isOpen, onClose: onClose, size: size, isCentered: true }, props, { children: [_jsx(ModalOverlay, Object.assign({}, overlayProps)), _jsxs(ModalContent, Object.assign({ w: "auto", minW: size, maxW: "90vw", borderRadius: "0" }, contentProps, { children: [_jsxs(ModalHeader, { px: "40px", pt: "40px", pb: "0", color: (_b = modalHeaderIcon === null || modalHeaderIcon === void 0 ? void 0 : modalHeaderIcon.headerColor) !== null && _b !== void 0 ? _b : boxBg, children: [_jsxs(Flex, { justifyContent: "space-between", align: "flex-start", children: [_jsx(Flex, { bg: (_c = modalHeaderIcon === null || modalHeaderIcon === void 0 ? void 0 : modalHeaderIcon.bgIconColor) !== null && _c !== void 0 ? _c : flexBg, color: (_d = modalHeaderIcon === null || modalHeaderIcon === void 0 ? void 0 : modalHeaderIcon.iconColor) !== null && _d !== void 0 ? _d : boxBg, h: "46px", w: "48px", borderRadius: "5px", p: "5px", justify: "center", align: "center", children: (_e = modalHeaderIcon === null || modalHeaderIcon === void 0 ? void 0 : modalHeaderIcon.icon) !== null && _e !== void 0 ? _e : IconModal }), _jsx(ModalCloseButton, { color: "neutral.300", position: "relative", h: 0, w: 0, sx: {
78
+ "& .chakra-icon": {
79
+ width: "14px",
80
+ height: "14px",
81
+ },
82
+ } })] }), modalHeader && (_jsx(Heading, { as: "h3", size: "md", pt: 7, fontSize: "2xl", children: modalHeader }))] }), modalBody && (_jsx(ModalBody, { pt: 3, px: "40px", pb: modalFooter ? 0 : "40px", maxW: "calc(var(--chakra-sizes-xl) - 62px)", children: _jsx(Text, { children: modalBody }) })), modalFooter && (_jsx(ModalFooter, { px: "40px", pt: 5, pb: "40px", justifyContent: "flex-end", children: modalFooter }))] }))] })));
83
+ };
@@ -0,0 +1,34 @@
1
+ export declare enum StatusNFeResumeEnum {
2
+ APPROVED = 100,
3
+ CANCELED = 101,
4
+ INUTILIZED = 102,
5
+ DENIED = 103,
6
+ NOT_TRANSMITTED = 104,
7
+ WITH_ERROR = 105
8
+ }
9
+ export interface NFeNotaItem {
10
+ serie: string;
11
+ nfnumero: number;
12
+ modelo: number;
13
+ dataemissao: string;
14
+ datacancelado: string;
15
+ clicnpj: string;
16
+ agente: number;
17
+ nomagente: string;
18
+ pedido: number;
19
+ totalnota: number;
20
+ chave_nfe: string;
21
+ tpamb: "1" | "2";
22
+ cliemail: string;
23
+ mensagem: string;
24
+ status: string;
25
+ }
26
+ interface ModalNfeProps {
27
+ isOpen: boolean;
28
+ onClose: () => void;
29
+ size?: "sm" | "md" | "lg" | "xl" | "2xl";
30
+ nfSelected: NFeNotaItem;
31
+ bodyOptions?: React.ReactNode;
32
+ }
33
+ export declare const CustomModalNfe: ({ isOpen, onClose, nfSelected, bodyOptions, size, }: ModalNfeProps) => import("react/jsx-runtime").JSX.Element | null;
34
+ export {};
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon, Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, Text, Box, Flex, useToast, } from "@chakra-ui/react";
3
+ import { CustomInput } from "./CustomInput";
4
+ import CustomTextarea from "./CustomTextarea";
5
+ import { Check, CheckCircle2Icon, CircleSlash, Copy, X, XCircle, } from "lucide-react";
6
+ import CustomToast from "./CustomToast";
7
+ import { useCallback } from "react";
8
+ export var StatusNFeResumeEnum;
9
+ (function (StatusNFeResumeEnum) {
10
+ StatusNFeResumeEnum[StatusNFeResumeEnum["APPROVED"] = 100] = "APPROVED";
11
+ StatusNFeResumeEnum[StatusNFeResumeEnum["CANCELED"] = 101] = "CANCELED";
12
+ StatusNFeResumeEnum[StatusNFeResumeEnum["INUTILIZED"] = 102] = "INUTILIZED";
13
+ StatusNFeResumeEnum[StatusNFeResumeEnum["DENIED"] = 103] = "DENIED";
14
+ StatusNFeResumeEnum[StatusNFeResumeEnum["NOT_TRANSMITTED"] = 104] = "NOT_TRANSMITTED";
15
+ StatusNFeResumeEnum[StatusNFeResumeEnum["WITH_ERROR"] = 105] = "WITH_ERROR";
16
+ })(StatusNFeResumeEnum || (StatusNFeResumeEnum = {}));
17
+ // nota fiscar rejeitada ou não transmitida - alert.warning
18
+ // nota fiscal cancelada ou inutilizada - alert.error
19
+ //nota fiscal denegada - neutral.300
20
+ //nota fiscal aprovada - alert.success
21
+ const colorStatus = {
22
+ [StatusNFeResumeEnum.DENIED]: "alert.warning",
23
+ [StatusNFeResumeEnum.CANCELED]: "alert.error",
24
+ [StatusNFeResumeEnum.INUTILIZED]: "alert.error",
25
+ [StatusNFeResumeEnum.NOT_TRANSMITTED]: "alert.warning",
26
+ [StatusNFeResumeEnum.WITH_ERROR]: "alert.warning",
27
+ [StatusNFeResumeEnum.APPROVED]: "alert.success",
28
+ };
29
+ const messageStatus = {
30
+ [StatusNFeResumeEnum.DENIED]: "Nota fiscal não autorizada",
31
+ [StatusNFeResumeEnum.CANCELED]: "Nota fiscal cancelada",
32
+ [StatusNFeResumeEnum.INUTILIZED]: "Nota fiscal inutilizada",
33
+ [StatusNFeResumeEnum.NOT_TRANSMITTED]: "Nota fiscal não transmitida",
34
+ [StatusNFeResumeEnum.WITH_ERROR]: "Nota fiscal rejeitada",
35
+ [StatusNFeResumeEnum.APPROVED]: "Nota fiscal aprovada",
36
+ };
37
+ const iconByStatus = {
38
+ [StatusNFeResumeEnum.DENIED]: XCircle,
39
+ [StatusNFeResumeEnum.CANCELED]: XCircle,
40
+ [StatusNFeResumeEnum.INUTILIZED]: CircleSlash,
41
+ [StatusNFeResumeEnum.NOT_TRANSMITTED]: XCircle,
42
+ [StatusNFeResumeEnum.WITH_ERROR]: XCircle,
43
+ [StatusNFeResumeEnum.APPROVED]: CheckCircle2Icon,
44
+ };
45
+ const hoverStyle = {
46
+ _hover: {
47
+ borderColor: "primary.300",
48
+ },
49
+ };
50
+ const formatChaveAcesso = (chave) => {
51
+ if (!chave || chave.length !== 44)
52
+ return chave;
53
+ return chave.replace(/(\d{4})(?=\d)/g, "$1 ");
54
+ };
55
+ export const CustomModalNfe = ({ isOpen, onClose, nfSelected, bodyOptions, size = "2xl", }) => {
56
+ var _a;
57
+ const toast = useToast();
58
+ const handleCopyChave = useCallback((chave) => {
59
+ navigator.clipboard.writeText(chave);
60
+ toast({
61
+ position: "top-right",
62
+ duration: 2000,
63
+ render: () => (_jsx(CustomToast, { msg: "Chave de acesso copiada!", textColor: "alert.success", bgColor: "alert.successBg", borderColor: "alert.success", icon: _jsx(Icon, { as: Check, boxSize: 4, color: "alert.success" }) })),
64
+ });
65
+ }, [toast]);
66
+ if (!nfSelected)
67
+ return null;
68
+ const { serie, nfnumero, modelo, dataemissao, mensagem, chave_nfe, status } = nfSelected;
69
+ return (_jsxs(Modal, { isOpen: isOpen, onClose: onClose, isCentered: true, size: size, children: [_jsx(ModalOverlay, {}), _jsxs(ModalContent, { gap: 6, children: [_jsx(ModalHeader, { pb: 0, pt: 10, px: 10, children: _jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", w: "full", children: [_jsxs(Flex, { alignItems: "flex-start", flexDir: "column", gap: 5, children: [_jsx(Box, { background: `${colorStatus[Number(status)]}Bg`, borderRadius: "md", p: 2, width: "fit-content", children: _jsx(Icon, { as: (_a = iconByStatus[Number(status)]) !== null && _a !== void 0 ? _a : XCircle, boxSize: 35, color: colorStatus[Number(status)] }) }), _jsx(Text, { id: "modal-nfe-title", color: colorStatus[Number(status)], fontSize: "lg", fontWeight: "bold", children: messageStatus[Number(status)] })] }), _jsx(Icon, { as: X, boxSize: 5, color: "neutral.300", cursor: "pointer", _hover: { color: "neutral.400" }, onClick: onClose, role: "button", "aria-label": "Fechar modal", tabIndex: 0, onKeyDown: (e) => {
70
+ if (e.key === "Enter" || e.key === " ") {
71
+ e.preventDefault();
72
+ onClose();
73
+ }
74
+ } })] }) }), _jsx(ModalBody, { id: "modal-nfe-description", pt: 0, pb: 10, px: 10, children: _jsxs(Flex, { flexDir: "column", gap: 3, children: [_jsxs(Flex, { gap: 4, children: [_jsx(Box, { flex: 2, children: _jsx(CustomInput, { label: "S\u00E9rie", value: serie, _hover: hoverStyle, isReadOnly: true }) }), _jsx(Box, { flex: 2.5, children: _jsx(CustomInput, { label: "N\u00FAmero", value: nfnumero, _hover: hoverStyle, isReadOnly: true }) }), _jsx(Box, { flex: 1, children: _jsx(CustomInput, { label: "Modelo", value: modelo, _hover: hoverStyle, isReadOnly: true }) }), _jsx(Box, { flex: 2, children: _jsx(CustomInput, { label: "Data de emiss\u00E3o", value: new Date(dataemissao).toLocaleDateString("pt-BR", {
75
+ timeZone: "UTC",
76
+ }), _hover: hoverStyle, isReadOnly: true }) })] }), _jsx(Flex, { children: (mensagem === null || mensagem === void 0 ? void 0 : mensagem.includes("Arquivo XML")) ? (_jsx(CustomTextarea, { label: "Mensagem", value: mensagem, _hover: hoverStyle, isReadOnly: true })) : (_jsx(Box, { role: "group", width: "100%", children: _jsx(CustomInput, { label: "Chave de Acesso", value: formatChaveAcesso(chave_nfe), leftIcon: _jsx(Icon, { as: Copy, boxSize: 4, cursor: "pointer", color: "neutral.200", transition: "color 0.5s", _groupHover: { color: "primary.300" }, onClick: (e) => {
77
+ e.stopPropagation();
78
+ handleCopyChave(chave_nfe);
79
+ }, role: "button", "aria-label": "Copiar chave de acesso", tabIndex: 0, onKeyDown: (e) => {
80
+ if (e.key === "Enter" || e.key === " ") {
81
+ e.preventDefault();
82
+ e.stopPropagation();
83
+ handleCopyChave(chave_nfe);
84
+ }
85
+ } }), _hover: hoverStyle, isReadOnly: true }) })) }), bodyOptions] }) })] })] }));
86
+ };
@@ -0,0 +1,28 @@
1
+ export interface MultiSelectOption {
2
+ value: string;
3
+ label: string;
4
+ icon?: JSX.Element;
5
+ }
6
+ interface MultiSelectProps {
7
+ options: MultiSelectOption[];
8
+ value?: string[];
9
+ defaultValue?: string[];
10
+ onChange?: (values: string[]) => void;
11
+ placeholder?: string;
12
+ maxWidth?: string | number;
13
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl";
14
+ multipleLabel?: (count: number) => string;
15
+ label?: string;
16
+ labelColor?: string;
17
+ labelBold?: boolean;
18
+ labelSize?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl";
19
+ tooltip?: string;
20
+ error?: string;
21
+ touched?: boolean;
22
+ withFormControl?: boolean;
23
+ required?: boolean;
24
+ helperText?: string;
25
+ }
26
+ export declare function MultiSelectLikeSelect({ options, value, defaultValue, onChange, placeholder, maxWidth, // 👈 default é 100%, mas pode ser sobrescrito
27
+ size, multipleLabel, label, labelColor, labelBold, labelSize, tooltip, error, touched, withFormControl, required, helperText, }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
28
+ export {};
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Menu, MenuButton, MenuList, MenuItem, Button, HStack, Text, useDisclosure, FormControl, FormLabel, Tooltip, FormErrorMessage, FormHelperText, Icon, } from "@chakra-ui/react";
3
+ import { ChevronDownIcon } from "@chakra-ui/icons";
4
+ import { useState } from "react";
5
+ import { Info } from "lucide-react";
6
+ import { CustomCheckbox } from "./CustomCheckBox";
7
+ export function MultiSelectLikeSelect({ options, value, defaultValue = [], onChange, placeholder = "Selecione uma ou mais opções", maxWidth = "100%", // 👈 default é 100%, mas pode ser sobrescrito
8
+ size = "sm", multipleLabel = (count) => `${count} selecionados`,
9
+ // extras
10
+ label, labelColor = "neutral.400", labelBold = false, labelSize = "sm", tooltip, error, touched = true, withFormControl = true, required = false, helperText, }) {
11
+ const [internalValue, setInternalValue] = useState(defaultValue);
12
+ const { isOpen, onOpen, onClose } = useDisclosure();
13
+ const selected = value !== null && value !== void 0 ? value : internalValue;
14
+ const toggleValue = (val) => {
15
+ const newValues = selected.includes(val)
16
+ ? selected.filter((v) => v !== val)
17
+ : [...selected, val];
18
+ if (!value)
19
+ setInternalValue(newValues);
20
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
21
+ };
22
+ const renderButtonLabel = () => {
23
+ if (selected.length === 0)
24
+ return placeholder;
25
+ if (selected.length === 1) {
26
+ const opt = options.find((o) => o.value === selected[0]);
27
+ return (_jsxs(HStack, { spacing: 2, maxW: maxWidth, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: [opt === null || opt === void 0 ? void 0 : opt.icon, _jsx(Text, { children: opt === null || opt === void 0 ? void 0 : opt.label })] }));
28
+ }
29
+ return multipleLabel(selected.length);
30
+ };
31
+ const menuElement = (_jsxs(Menu, { closeOnSelect: false, isOpen: isOpen, onOpen: onOpen, onClose: onClose, matchWidth: true, children: [_jsx(MenuButton, { as: Button, rightIcon: _jsx(Icon, { as: ChevronDownIcon, transition: "transform 0.2s ease-in-out", transform: isOpen ? "rotate(180deg)" : "rotate(0deg)" }), variant: "outline", w: "100%", maxW: maxWidth, textAlign: "left", fontWeight: "normal", size: size, children: renderButtonLabel() }), _jsx(MenuList, { maxW: maxWidth, maxH: "160px", overflowY: "auto", sx: {
32
+ "::-webkit-scrollbar": {
33
+ width: "6px",
34
+ },
35
+ "::-webkit-scrollbar-track": {
36
+ background: "transparent",
37
+ },
38
+ "::-webkit-scrollbar-thumb": {
39
+ background: "neutral.200",
40
+ borderRadius: "full",
41
+ },
42
+ "::-webkit-scrollbar-thumb:hover": {
43
+ background: "neutral.300",
44
+ },
45
+ scrollbarWidth: "thin", // Firefox
46
+ scrollbarColor: "var(--chakra-colors-neutral-200) transparent",
47
+ }, children: options.map((opt) => (_jsx(MenuItem, { closeOnSelect: false, display: "flex", alignItems: "center", width: "100%", onClick: (e) => e.stopPropagation(), children: _jsx(CustomCheckbox, { width: "100%", size: size, isChecked: selected.includes(opt.value), onChange: () => toggleValue(opt.value), children: _jsxs(HStack, { spacing: 2, children: [opt.icon, _jsx(Text, { children: opt.label })] }) }) }, opt.value))) })] }));
48
+ if (!withFormControl)
49
+ return menuElement;
50
+ return (_jsxs(FormControl, { isInvalid: !!error && touched, children: [label && (_jsx(FormLabel, { fontSize: "xs", children: _jsxs(HStack, { spacing: 1, align: "center", children: [_jsx(Text, { fontSize: labelSize, color: labelColor, fontWeight: labelBold ? "bold" : "normal", children: label }), required && (_jsx(Text, { color: "red.500", fontSize: "xs", children: "*" })), tooltip && (_jsx(Tooltip, { label: tooltip, placement: "top", hasArrow: true, children: _jsx(Info, { color: "var(--chakra-colors-alert-warning)", width: "16px", height: "16px" }) }))] }) })), menuElement, !error && helperText && (_jsx(FormHelperText, { fontSize: "xs", children: helperText })), error && touched && (_jsx(FormErrorMessage, { fontSize: "xs", children: error }))] }));
51
+ }
@@ -0,0 +1,36 @@
1
+ import { InputProps } from "@chakra-ui/react";
2
+ import { ReactNode } from "react";
3
+ export interface InputConfig {
4
+ label?: string;
5
+ type?: string;
6
+ placeholder?: string;
7
+ error?: string;
8
+ leftIcon?: ReactNode;
9
+ rightIcon?: ReactNode;
10
+ showError?: boolean;
11
+ required?: boolean;
12
+ tooltip?: string;
13
+ labelColor?: string;
14
+ labelBold?: boolean;
15
+ labelSize?: "xs" | "sm" | "md" | "lg";
16
+ }
17
+ export interface CustomMultipleInputsProps extends Omit<InputProps, "size" | "onChange" | "ref"> {
18
+ label?: string;
19
+ type?: string;
20
+ placeholder?: string;
21
+ leftIcon?: ReactNode;
22
+ rightIcon?: ReactNode;
23
+ showError?: boolean;
24
+ withFormControl?: boolean;
25
+ required?: boolean;
26
+ tooltip?: string;
27
+ labelColor?: string;
28
+ labelBold?: boolean;
29
+ labelSize?: "xs" | "sm" | "md" | "lg";
30
+ size?: "xs" | "sm" | "md" | "lg";
31
+ inputs: [InputConfig, InputConfig, ...InputConfig[]];
32
+ error?: string[];
33
+ values?: string[];
34
+ onChange?: (values: string[]) => void;
35
+ }
36
+ export declare const CustomMultipleInputs: import("react").ForwardRefExoticComponent<CustomMultipleInputsProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,91 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { FormControl, HStack, FormLabel, Text, Tooltip, Icon, InputGroup, Flex, InputRightElement, InputLeftElement, Input, FormErrorMessage, } from "@chakra-ui/react";
14
+ import { Info } from "lucide-react";
15
+ import { forwardRef, useCallback, useMemo } from "react";
16
+ /* -------------------------------- Constants --------------------------------- */
17
+ const INPUT_GROUP_STYLES = {
18
+ ".chakra-input": { transition: "border-color .5s, box-shadow .5s" },
19
+ ".input-left, .input-right": { transition: "color .5s" },
20
+ "&:focus-within .input-left, &:focus-within .input-right": {
21
+ color: "primary.300",
22
+ },
23
+ "&:has(input:not(:placeholder-shown)) .input-left, &:has(input:not(:placeholder-shown)) .input-right": {
24
+ color: "primary.300",
25
+ },
26
+ };
27
+ const INPUT_GROUP_INDIVIDUAL_STYLES = {
28
+ ".chakra-input": {
29
+ transition: "border-color .5s, box-shadow .5s",
30
+ },
31
+ ".input-left, .input-right": { transition: "color .5s" },
32
+ "&:focus-within .input-left, &:focus-within .input-right": {
33
+ color: "primary.300",
34
+ },
35
+ "&:focus-within .input-label": { color: "primary.300" },
36
+ };
37
+ const LABEL_FLOATING_STYLES = {
38
+ position: "absolute",
39
+ zIndex: 10,
40
+ backgroundColor: "background.primary",
41
+ top: "0",
42
+ transform: "translateY(-50%)",
43
+ ml: 2,
44
+ pl: 1,
45
+ pr: 1,
46
+ };
47
+ const LabelWithTooltip = ({ label, required, tooltip, labelColor = "neutral.400", labelBold, labelSize = "sm", error, htmlFor, variant = "main", }) => {
48
+ const labelElement = (_jsx(Text, { className: variant === "floating" ? "input-label" : undefined, as: variant === "floating" ? "label" : undefined, htmlFor: htmlFor, color: variant === "floating"
49
+ ? error
50
+ ? "alert.error"
51
+ : "border.primary"
52
+ : labelColor, fontWeight: labelBold ? "bold" : "normal", transition: variant === "floating" ? "color .5s" : undefined, fontSize: labelSize, children: label }));
53
+ const requiredIndicator = required && (_jsx(Text, { color: variant === "floating" ? "alert.error" : "alert.warning", fontSize: labelSize, "aria-label": "campo obrigat\u00F3rio", children: "*" }));
54
+ const tooltipIcon = tooltip && (_jsx(Tooltip, { label: tooltip, placement: "top", hasArrow: true, children: _jsx(Icon, { as: Info, color: "alert.warning", size: 16, role: "img", "aria-label": "Informa\u00E7\u00E3o" }) }));
55
+ if (variant === "floating") {
56
+ return (_jsxs(HStack, Object.assign({ spacing: 1, align: "center" }, LABEL_FLOATING_STYLES, { children: [labelElement, requiredIndicator, tooltipIcon] })));
57
+ }
58
+ return (_jsxs(HStack, { spacing: 1, align: "center", children: [labelElement, requiredIndicator, tooltipIcon] }));
59
+ };
60
+ const SingleInputField = ({ index, input, value, error, shouldShowError, size, defaultType, labelBold, labelSize, isDisabled, onChange, inputRef, inputProps, }) => {
61
+ const { label, type = defaultType, placeholder, leftIcon, rightIcon, required, tooltip, labelColor, labelBold: inputLabelBold, labelSize: inputLabelSize, } = input;
62
+ const inputId = `multiple-input-${index}`;
63
+ const errorId = `multiple-input-error-${index}`;
64
+ const hasError = !!error;
65
+ return (_jsxs(FormControl, { isInvalid: hasError, flex: 1, sx: {
66
+ "&:focus-within .input-label": { color: "primary.300" },
67
+ }, children: [_jsxs(InputGroup, { size: size, position: "relative", sx: INPUT_GROUP_INDIVIDUAL_STYLES, children: [label && label.trim() !== "" && (_jsx(LabelWithTooltip, { label: label, required: required, tooltip: tooltip, labelColor: labelColor, labelBold: inputLabelBold !== null && inputLabelBold !== void 0 ? inputLabelBold : labelBold, labelSize: inputLabelSize !== null && inputLabelSize !== void 0 ? inputLabelSize : labelSize, error: hasError, htmlFor: inputId, variant: "floating" })), leftIcon && (_jsx(InputLeftElement, { className: "input-left", color: "border.primary", children: leftIcon })), _jsx(Input, Object.assign({ ref: index === 0 ? inputRef : undefined, id: inputId, type: type, placeholder: placeholder, value: value, onChange: (e) => onChange(index, e.target.value), focusBorderColor: "primary.300", backgroundColor: isDisabled ? "background.secondary" : "background.primary", borderColor: "border.primary", color: "neutral.400", borderRadius: "4px", size: size, _placeholder: { color: "neutral.200", opacity: 1 }, pt: size === "xs" ? 1 : 0, "aria-invalid": hasError, "aria-describedby": hasError && shouldShowError ? errorId : undefined, "aria-required": required }, inputProps)), rightIcon && (_jsx(InputRightElement, { className: "input-right", color: "border.primary", children: rightIcon }))] }), shouldShowError && error && (_jsx(FormErrorMessage, { id: errorId, fontSize: "xs", mt: "3px", children: error }))] }));
68
+ };
69
+ /* -------------------------------- Main Component --------------------------- */
70
+ export const CustomMultipleInputs = forwardRef((_a, ref) => {
71
+ var { label, type = "text", error, leftIcon, rightIcon, withFormControl = true, showError = true, required = false, tooltip, labelColor = "neutral.400", labelBold = false, labelSize = "sm", size = "sm", inputs, values = [], onChange } = _a, props = __rest(_a, ["label", "type", "error", "leftIcon", "rightIcon", "withFormControl", "showError", "required", "tooltip", "labelColor", "labelBold", "labelSize", "size", "inputs", "values", "onChange"]);
72
+ const handleChange = useCallback((index, value) => {
73
+ if (!onChange)
74
+ return;
75
+ const newValues = [...values];
76
+ newValues[index] = value;
77
+ onChange(newValues);
78
+ }, [values, onChange]);
79
+ const hasError = useMemo(() => {
80
+ return ((error === null || error === void 0 ? void 0 : error.some(Boolean)) || inputs.some((input) => !!input.error));
81
+ }, [error, inputs]);
82
+ const inputElement = (_jsxs(_Fragment, { children: [label && label.trim() !== "" && (_jsx(FormLabel, { fontSize: labelSize, children: _jsx(LabelWithTooltip, { label: label, required: required, tooltip: tooltip, labelColor: labelColor, labelBold: labelBold, labelSize: labelSize, variant: "main" }) })), _jsx(InputGroup, { size: size, sx: INPUT_GROUP_STYLES, children: _jsx(Flex, { gap: 3, w: "full", children: inputs.map((input, index) => {
83
+ var _a, _b;
84
+ const fieldError = (error === null || error === void 0 ? void 0 : error[index]) || input.error;
85
+ const shouldShowError = (_a = input.showError) !== null && _a !== void 0 ? _a : showError;
86
+ const inputValue = (_b = values[index]) !== null && _b !== void 0 ? _b : "";
87
+ return (_jsx(SingleInputField, { index: index, input: input, value: inputValue, error: fieldError, shouldShowError: shouldShowError, size: size, defaultType: type, labelBold: labelBold, labelSize: labelSize, isDisabled: props.isDisabled, onChange: handleChange, inputRef: ref, inputProps: props }, index));
88
+ }) }) })] }));
89
+ return withFormControl ? (_jsx(FormControl, { isInvalid: hasError, children: inputElement })) : (inputElement);
90
+ });
91
+ CustomMultipleInputs.displayName = "CustomMultipleInputs";