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.
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/components/Accordion/CustomAccordionGroup.d.ts +10 -0
- package/dist/components/Accordion/CustomAccordionGroup.js +20 -0
- package/dist/components/Accordion/CustomAccordionItem.d.ts +12 -0
- package/dist/components/Accordion/CustomAccordionItem.js +5 -0
- package/dist/components/CustomAlertDialog.d.ts +8 -0
- package/dist/components/CustomAlertDialog.js +18 -0
- package/dist/components/CustomAutoComplete.d.ts +35 -0
- package/dist/components/CustomAutoComplete.js +141 -0
- package/dist/components/CustomBadge.d.ts +9 -0
- package/dist/components/CustomBadge.js +25 -0
- package/dist/components/CustomButton.d.ts +16 -0
- package/dist/components/CustomButton.js +18 -0
- package/dist/components/CustomCard.d.ts +11 -0
- package/dist/components/CustomCard.js +20 -0
- package/dist/components/CustomCheckBox.d.ts +12 -0
- package/dist/components/CustomCheckBox.js +26 -0
- package/dist/components/CustomCheckboxGroup.d.ts +21 -0
- package/dist/components/CustomCheckboxGroup.js +28 -0
- package/dist/components/CustomDrawer.d.ts +11 -0
- package/dist/components/CustomDrawer.js +36 -0
- package/dist/components/CustomIconButton.d.ts +7 -0
- package/dist/components/CustomIconButton.js +19 -0
- package/dist/components/CustomInput.d.ts +19 -0
- package/dist/components/CustomInput.js +32 -0
- package/dist/components/CustomInputNumber.d.ts +17 -0
- package/dist/components/CustomInputNumber.js +23 -0
- package/dist/components/CustomList.d.ts +22 -0
- package/dist/components/CustomList.js +27 -0
- package/dist/components/CustomLoadingCenterPage.d.ts +6 -0
- package/dist/components/CustomLoadingCenterPage.js +5 -0
- package/dist/components/CustomModal.d.ts +19 -0
- package/dist/components/CustomModal.js +83 -0
- package/dist/components/CustomModalNfe.d.ts +34 -0
- package/dist/components/CustomModalNfe.js +86 -0
- package/dist/components/CustomMultSelect.d.ts +28 -0
- package/dist/components/CustomMultSelect.js +51 -0
- package/dist/components/CustomMultipleInputs.d.ts +36 -0
- package/dist/components/CustomMultipleInputs.js +91 -0
- package/dist/components/CustomPopover.d.ts +21 -0
- package/dist/components/CustomPopover.js +19 -0
- package/dist/components/CustomRadioGroup.d.ts +32 -0
- package/dist/components/CustomRadioGroup.js +37 -0
- package/dist/components/CustomSelect.d.ts +20 -0
- package/dist/components/CustomSelect.js +25 -0
- package/dist/components/CustomSkeleton.d.ts +9 -0
- package/dist/components/CustomSkeleton.js +17 -0
- package/dist/components/CustomSwitch.d.ts +20 -0
- package/dist/components/CustomSwitch.js +15 -0
- package/dist/components/CustomTable.d.ts +51 -0
- package/dist/components/CustomTable.js +307 -0
- package/dist/components/CustomTabs.d.ts +27 -0
- package/dist/components/CustomTabs.js +100 -0
- package/dist/components/CustomTextarea.d.ts +14 -0
- package/dist/components/CustomTextarea.js +35 -0
- package/dist/components/CustomToast.d.ts +10 -0
- package/dist/components/CustomToast.js +6 -0
- package/dist/components/DatePicker/CustomDatePicker.d.ts +24 -0
- package/dist/components/DatePicker/CustomDatePicker.js +628 -0
- package/dist/components/Pagination/CustomPagination.d.ts +50 -0
- package/dist/components/Pagination/CustomPagination.js +159 -0
- package/dist/components/ThemeToggle.d.ts +1 -0
- package/dist/components/ThemeToggle.js +30 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.js +30 -0
- package/dist/contexts/ThemeContext.d.ts +18 -0
- package/dist/contexts/ThemeContext.js +34 -0
- package/dist/examples/CodeViewer.d.ts +8 -0
- package/dist/examples/CodeViewer.js +7 -0
- package/dist/examples/FormikExample.d.ts +2 -0
- package/dist/examples/FormikExample.js +199 -0
- package/dist/examples/NumberInputExample.d.ts +2 -0
- package/dist/examples/NumberInputExample.js +198 -0
- package/dist/examples/ReactHookFormExample.d.ts +2 -0
- package/dist/examples/ReactHookFormExample.js +217 -0
- package/dist/examples/SimpleFormExample.d.ts +2 -0
- package/dist/examples/SimpleFormExample.js +216 -0
- package/dist/examples/TabsExample.d.ts +2 -0
- package/dist/examples/TabsExample.js +182 -0
- package/dist/examples/index.d.ts +6 -0
- package/dist/examples/index.js +6 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +32 -0
- package/dist/providers/LsCKFrontProvider.d.ts +6 -0
- package/dist/providers/LsCKFrontProvider.js +7 -0
- package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionGroup.stories.d.ts +13 -0
- package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionGroup.stories.js +787 -0
- package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionItem.stories.d.ts +13 -0
- package/dist/stories/Londrisoft/Components/Accordion/CustomAccordionItem.stories.js +759 -0
- package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckBox.stories.d.ts +15 -0
- package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckBox.stories.js +770 -0
- package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckboxGroup.stories.d.ts +33 -0
- package/dist/stories/Londrisoft/Components/Checkbox/CustomCheckboxGroup.stories.js +2152 -0
- package/dist/stories/Londrisoft/Components/CustomAlertDialog.stories.d.ts +24 -0
- package/dist/stories/Londrisoft/Components/CustomAlertDialog.stories.js +462 -0
- package/dist/stories/Londrisoft/Components/CustomAutoComplete.stories.d.ts +41 -0
- package/dist/stories/Londrisoft/Components/CustomAutoComplete.stories.js +1135 -0
- package/dist/stories/Londrisoft/Components/CustomBadge.stories.d.ts +21 -0
- package/dist/stories/Londrisoft/Components/CustomBadge.stories.js +546 -0
- package/dist/stories/Londrisoft/Components/CustomButton.stories.d.ts +17 -0
- package/dist/stories/Londrisoft/Components/CustomButton.stories.js +1099 -0
- package/dist/stories/Londrisoft/Components/CustomCard.stories.d.ts +17 -0
- package/dist/stories/Londrisoft/Components/CustomCard.stories.js +687 -0
- package/dist/stories/Londrisoft/Components/CustomDrawer.stories.d.ts +24 -0
- package/dist/stories/Londrisoft/Components/CustomDrawer.stories.js +521 -0
- package/dist/stories/Londrisoft/Components/CustomIconButton.stories.d.ts +14 -0
- package/dist/stories/Londrisoft/Components/CustomIconButton.stories.js +1024 -0
- package/dist/stories/Londrisoft/Components/CustomInput.stories.d.ts +15 -0
- package/dist/stories/Londrisoft/Components/CustomInput.stories.js +1094 -0
- package/dist/stories/Londrisoft/Components/CustomInputNumber.stories.d.ts +11 -0
- package/dist/stories/Londrisoft/Components/CustomInputNumber.stories.js +676 -0
- package/dist/stories/Londrisoft/Components/CustomList.stories.d.ts +18 -0
- package/dist/stories/Londrisoft/Components/CustomList.stories.js +1353 -0
- package/dist/stories/Londrisoft/Components/CustomLoadingCenterPage.stories.d.ts +17 -0
- package/dist/stories/Londrisoft/Components/CustomLoadingCenterPage.stories.js +304 -0
- package/dist/stories/Londrisoft/Components/CustomModal.stories.d.ts +19 -0
- package/dist/stories/Londrisoft/Components/CustomModal.stories.js +631 -0
- package/dist/stories/Londrisoft/Components/CustomModalNfe.stories.d.ts +19 -0
- package/dist/stories/Londrisoft/Components/CustomModalNfe.stories.js +589 -0
- package/dist/stories/Londrisoft/Components/CustomMultSelect.stories.d.ts +15 -0
- package/dist/stories/Londrisoft/Components/CustomMultSelect.stories.js +447 -0
- package/dist/stories/Londrisoft/Components/CustomMultipleInputs.stories.d.ts +15 -0
- package/dist/stories/Londrisoft/Components/CustomMultipleInputs.stories.js +1068 -0
- package/dist/stories/Londrisoft/Components/CustomPopover.stories.d.ts +10 -0
- package/dist/stories/Londrisoft/Components/CustomPopover.stories.js +208 -0
- package/dist/stories/Londrisoft/Components/CustomSelect.stories.d.ts +27 -0
- package/dist/stories/Londrisoft/Components/CustomSelect.stories.js +1086 -0
- package/dist/stories/Londrisoft/Components/CustomSkeleton.stories.d.ts +25 -0
- package/dist/stories/Londrisoft/Components/CustomSkeleton.stories.js +534 -0
- package/dist/stories/Londrisoft/Components/CustomSwitch.stories.d.ts +15 -0
- package/dist/stories/Londrisoft/Components/CustomSwitch.stories.js +422 -0
- package/dist/stories/Londrisoft/Components/CustomTable.stories.d.ts +43 -0
- package/dist/stories/Londrisoft/Components/CustomTable.stories.js +2121 -0
- package/dist/stories/Londrisoft/Components/CustomTabs.stories.d.ts +19 -0
- package/dist/stories/Londrisoft/Components/CustomTabs.stories.js +866 -0
- package/dist/stories/Londrisoft/Components/CustomTextarea.stories.d.ts +21 -0
- package/dist/stories/Londrisoft/Components/CustomTextarea.stories.js +408 -0
- package/dist/stories/Londrisoft/Components/CustomToast.stories.d.ts +21 -0
- package/dist/stories/Londrisoft/Components/CustomToast.stories.js +1041 -0
- package/dist/stories/Londrisoft/Components/DatePicker/CustomDatePicker.stories.d.ts +17 -0
- package/dist/stories/Londrisoft/Components/DatePicker/CustomDatePicker.stories.js +653 -0
- package/dist/stories/Londrisoft/Components/Pagination/CustomPagination.stories.d.ts +17 -0
- package/dist/stories/Londrisoft/Components/Pagination/CustomPagination.stories.js +429 -0
- package/dist/stories/Londrisoft/Components/Radio/CustomRadioGroup.stories.d.ts +22 -0
- package/dist/stories/Londrisoft/Components/Radio/CustomRadioGroup.stories.js +766 -0
- package/dist/stories/Londrisoft/Examples/IntegrationExamples.stories.d.ts +16 -0
- package/dist/stories/Londrisoft/Examples/IntegrationExamples.stories.js +514 -0
- package/dist/stories/Londrisoft/Theme/ThemeShowcase.stories.d.ts +5 -0
- package/dist/stories/Londrisoft/Theme/ThemeShowcase.stories.js +112 -0
- package/dist/stories/options.d.ts +13 -0
- package/dist/stories/options.js +124 -0
- package/dist/theme/bime.d.ts +92 -0
- package/dist/theme/bime.js +352 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme/index.js +8 -0
- package/dist/theme/waipe.d.ts +102 -0
- package/dist/theme/waipe.js +362 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Londrisoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Lib Front
|
|
2
|
+
|
|
3
|
+
## 📋 Sobre o Projeto
|
|
4
|
+
|
|
5
|
+
Este é um projeto front-end desenvolvido com React, TypeScript, oferecendo uma estrutura moderna e eficiente para desenvolvimento web.
|
|
6
|
+
|
|
7
|
+
## 🚀 Tecnologias Utilizadas
|
|
8
|
+
|
|
9
|
+
- [React](https://react.dev/)
|
|
10
|
+
- [TypeScript](https://www.typescriptlang.org/)
|
|
11
|
+
- [chakraUI](https://v2.chakra-ui.com/getting-started)
|
|
12
|
+
|
|
13
|
+
## ⚙️ Pré-requisitos
|
|
14
|
+
|
|
15
|
+
- Node.js (versão 14.x ou superior)
|
|
16
|
+
- npm ou yarn
|
|
17
|
+
|
|
18
|
+
## 🛠️ Instalação
|
|
19
|
+
|
|
20
|
+
1. Clone o repositório:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git clone [URL_DO_SEU_REPOSITÓRIO]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
````markdown:c:\Users\usuario\Documents\JS\lib-front\README.md
|
|
27
|
+
2. Instale as dependências:
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
# ou
|
|
31
|
+
yarn install
|
|
32
|
+
````
|
|
33
|
+
|
|
34
|
+
3. Inicie o servidor de desenvolvimento:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run dev
|
|
38
|
+
# ou
|
|
39
|
+
yarn dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 📦 Scripts Disponíveis
|
|
43
|
+
|
|
44
|
+
- `dev`: Inicia o servidor de desenvolvimento
|
|
45
|
+
- `build`: Gera a versão de produção
|
|
46
|
+
- `lint`: Executa a verificação de código com ESLint
|
|
47
|
+
- `preview`: Visualiza a versão de produção localmente
|
|
48
|
+
|
|
49
|
+
## 🔧 Configuração do ESLint
|
|
50
|
+
|
|
51
|
+
O projeto inclui uma configuração robusta do ESLint com suporte a TypeScript. Para mais detalhes sobre a configuração, consulte o arquivo `eslint.config.js`.
|
|
52
|
+
|
|
53
|
+
## 📚 Documentação
|
|
54
|
+
|
|
55
|
+
### 📖 Documentação da Biblioteca
|
|
56
|
+
|
|
57
|
+
- [📚 Documentação Completa dos Componentes](./docs/COMPONENTS_DOCUMENTATION.md)
|
|
58
|
+
- [⚡ Guia de Referência Rápida](./docs/QUICK_REFERENCE.md)
|
|
59
|
+
- [📝 Componentes de Formulário](./docs/FORM_COMPONENTS.md)
|
|
60
|
+
- [🔧 Exemplos de Integração](./docs/INTEGRATION_EXAMPLES.md)
|
|
61
|
+
- [📋 Documentação da CustomTable](./docs/CUSTOM_TABLE_DOCUMENTATION.md)
|
|
62
|
+
- [📋 Regras de Desenvolvimento](./docs/DEVELOPMENT_RULES.md)
|
|
63
|
+
|
|
64
|
+
### 🔗 Documentação Externa
|
|
65
|
+
|
|
66
|
+
Para mais informações sobre as tecnologias utilizadas:
|
|
67
|
+
|
|
68
|
+
- [Documentação do React](https://react.dev/)
|
|
69
|
+
- [Documentação do TypeScript](https://www.typescriptlang.org/docs/)
|
|
70
|
+
- [Documentação do Chakra UI](https://chakra-ui.com/)
|
|
71
|
+
|
|
72
|
+
## 📝 Licença
|
|
73
|
+
|
|
74
|
+
Este projeto está sob a licença MIT.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
Desenvolvido com ❤️ por [@Londrisoft](https://londrisoft.com.br/)
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AccordionProps } from "@chakra-ui/react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
interface CustomAccordionGroupProps extends AccordionProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Um agrupador de itens de Accordion com configuração padrão e estilização consistente com o design system.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CustomAccordionGroup: React.FC<CustomAccordionGroupProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { Accordion } from "@chakra-ui/react";
|
|
14
|
+
/**
|
|
15
|
+
* Um agrupador de itens de Accordion com configuração padrão e estilização consistente com o design system.
|
|
16
|
+
*/
|
|
17
|
+
export const CustomAccordionGroup = (_a) => {
|
|
18
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
19
|
+
return (_jsx(Accordion, Object.assign({ allowMultiple: true }, props, { children: children })));
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface CustomAccordionItemProps {
|
|
3
|
+
title: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
bgColor?: string;
|
|
7
|
+
hoverColor?: string;
|
|
8
|
+
expandedColor?: string;
|
|
9
|
+
expandedTextColor?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const CustomAccordionItem: React.FC<CustomAccordionItemProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AccordionItem, AccordionButton, AccordionPanel, AccordionIcon, Box, Text, } from "@chakra-ui/react";
|
|
3
|
+
export const CustomAccordionItem = ({ title, label, children, bgColor = "background.secondary", hoverColor = "background.primary", expandedColor = "background.brand", expandedTextColor = "white", }) => {
|
|
4
|
+
return (_jsxs(AccordionItem, { children: [label && (_jsx(Box, { px: 4, pt: 4, children: _jsx(Text, { fontSize: "xs", fontWeight: "bold", color: "primary.300", textTransform: "uppercase", mb: 1, children: label }) })), _jsxs(AccordionButton, { px: 4, bg: bgColor, _hover: { bg: hoverColor }, _expanded: { bg: expandedColor, color: expandedTextColor }, children: [_jsx(Box, { flex: "1", textAlign: "left", fontWeight: "bold", color: "neutral.400", children: title }), _jsx(AccordionIcon, {})] }), _jsx(AccordionPanel, { px: 6, children: children })] }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AlertDialogProps } from "@chakra-ui/react";
|
|
2
|
+
type CustomAlertDialogProps = Omit<AlertDialogProps, "children"> & {
|
|
3
|
+
header?: React.ReactNode;
|
|
4
|
+
body?: React.ReactNode;
|
|
5
|
+
footer?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export default function CustomAlertDialog({ isOpen, onClose, leastDestructiveRef, header, body, footer, ...props }: CustomAlertDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { AlertDialog, AlertDialogBody, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay } from "@chakra-ui/react";
|
|
14
|
+
import { CustomButton } from "./CustomButton";
|
|
15
|
+
export default function CustomAlertDialog(_a) {
|
|
16
|
+
var { isOpen, onClose, leastDestructiveRef, header, body, footer } = _a, props = __rest(_a, ["isOpen", "onClose", "leastDestructiveRef", "header", "body", "footer"]);
|
|
17
|
+
return (_jsx(AlertDialog, Object.assign({ isOpen: isOpen, leastDestructiveRef: leastDestructiveRef, onClose: onClose }, props, { children: _jsx(AlertDialogOverlay, { children: _jsxs(AlertDialogContent, { children: [header && (_jsx(AlertDialogHeader, { fontSize: 'lg', fontWeight: 'bold', children: header })), body && (_jsx(AlertDialogBody, { children: body })), footer ? (_jsx(AlertDialogFooter, { children: footer })) : (_jsxs(AlertDialogFooter, { children: [_jsx(CustomButton, { onClick: onClose, children: "Cancelar" }), _jsx(CustomButton, { onClick: onClose, ml: 3, children: "Confirmar" })] }))] }) }) })));
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { InputProps } from "@chakra-ui/react";
|
|
3
|
+
interface Option {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface CustomAutocompleteProps extends Omit<InputProps, "onChange" | "onSelect"> {
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
leftIcon?: ReactNode;
|
|
13
|
+
rightIcon?: ReactNode;
|
|
14
|
+
showError?: boolean;
|
|
15
|
+
withFormControl?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
labelColor?: string;
|
|
19
|
+
labelBold?: boolean;
|
|
20
|
+
size?: "sm" | "md" | "lg";
|
|
21
|
+
options: Option[];
|
|
22
|
+
value?: string;
|
|
23
|
+
onChange?: (value: string) => void;
|
|
24
|
+
onSelect?: (option: Option) => void;
|
|
25
|
+
isLoading?: boolean;
|
|
26
|
+
noOptionsMessage?: string;
|
|
27
|
+
loadingMessage?: string;
|
|
28
|
+
minCharsToSearch?: number;
|
|
29
|
+
maxHeight?: string;
|
|
30
|
+
allowCustomValue?: boolean;
|
|
31
|
+
caseSensitive?: boolean;
|
|
32
|
+
returnValueOnSelect?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const CustomAutocomplete: React.ForwardRefExoticComponent<CustomAutocompleteProps & React.RefAttributes<HTMLInputElement>>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
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, { useState, useRef, useCallback, useEffect, } from "react";
|
|
14
|
+
import { Box, FormControl, FormLabel, FormErrorMessage, Tooltip, Text, HStack, List, ListItem, Spinner, IconButton, useOutsideClick, } from "@chakra-ui/react";
|
|
15
|
+
import { ChevronUpIcon, ChevronDownIcon, CloseIcon } from "@chakra-ui/icons";
|
|
16
|
+
import { CustomInput } from "./CustomInput";
|
|
17
|
+
import { Info } from "lucide-react";
|
|
18
|
+
export const CustomAutocomplete = React.forwardRef((_a, ref) => {
|
|
19
|
+
var _b;
|
|
20
|
+
var { label, placeholder, error, leftIcon, rightIcon, withFormControl = true, showError = true, required = false, tooltip, labelColor, labelBold = false, size = "sm", options = [], value = "", onChange, onSelect, isLoading = false, noOptionsMessage = "Nenhuma opção encontrada", loadingMessage = "Carregando...", minCharsToSearch = 0, maxHeight = "200px", allowCustomValue = false, caseSensitive = false, returnValueOnSelect = true } = _a, // Por padrão retorna value para compatibilidade com backend
|
|
21
|
+
props = __rest(_a, ["label", "placeholder", "error", "leftIcon", "rightIcon", "withFormControl", "showError", "required", "tooltip", "labelColor", "labelBold", "size", "options", "value", "onChange", "onSelect", "isLoading", "noOptionsMessage", "loadingMessage", "minCharsToSearch", "maxHeight", "allowCustomValue", "caseSensitive", "returnValueOnSelect"]);
|
|
22
|
+
const [inputValue, setInputValue] = useState(value);
|
|
23
|
+
const [filteredOptions, setFilteredOptions] = useState([]);
|
|
24
|
+
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
25
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
+
const containerRef = useRef(null);
|
|
27
|
+
const listRef = useRef(null);
|
|
28
|
+
// Filtra as opções baseado no input
|
|
29
|
+
const filterOptions = useCallback((searchTerm) => {
|
|
30
|
+
if (searchTerm.length < minCharsToSearch) {
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
const term = caseSensitive ? searchTerm : searchTerm.toLowerCase();
|
|
34
|
+
return options.filter((option) => {
|
|
35
|
+
const label = caseSensitive
|
|
36
|
+
? option.label
|
|
37
|
+
: option.label.toLowerCase();
|
|
38
|
+
return label.includes(term) && !option.disabled;
|
|
39
|
+
});
|
|
40
|
+
}, [options, minCharsToSearch, caseSensitive]);
|
|
41
|
+
// Atualiza opções filtradas quando input ou options mudam
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const filtered = filterOptions(inputValue);
|
|
44
|
+
setFilteredOptions(filtered);
|
|
45
|
+
setSelectedIndex(-1);
|
|
46
|
+
}, [inputValue, filterOptions]);
|
|
47
|
+
// Sincroniza inputValue com value externo
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setInputValue(value);
|
|
50
|
+
}, [value]);
|
|
51
|
+
// Fecha dropdown quando clica fora
|
|
52
|
+
useOutsideClick({
|
|
53
|
+
ref: containerRef,
|
|
54
|
+
handler: () => setIsOpen(false),
|
|
55
|
+
});
|
|
56
|
+
// Keyboard navigation
|
|
57
|
+
const handleKeyDown = (e) => {
|
|
58
|
+
if (!isOpen && (e.key === "ArrowDown" || e.key === "Enter")) {
|
|
59
|
+
setIsOpen(true);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!isOpen)
|
|
63
|
+
return;
|
|
64
|
+
switch (e.key) {
|
|
65
|
+
case "ArrowDown":
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
setSelectedIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0);
|
|
68
|
+
break;
|
|
69
|
+
case "ArrowUp":
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
setSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1);
|
|
72
|
+
break;
|
|
73
|
+
case "Enter":
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
if (selectedIndex >= 0 && filteredOptions[selectedIndex]) {
|
|
76
|
+
handleSelect(filteredOptions[selectedIndex]);
|
|
77
|
+
}
|
|
78
|
+
else if (allowCustomValue) {
|
|
79
|
+
handleCustomValue();
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case "Escape":
|
|
83
|
+
setIsOpen(false);
|
|
84
|
+
setSelectedIndex(-1);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
// Scroll para o item selecionado
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (selectedIndex >= 0 && listRef.current) {
|
|
91
|
+
const selectedElement = listRef.current.children[selectedIndex];
|
|
92
|
+
if (selectedElement) {
|
|
93
|
+
selectedElement.scrollIntoView({ block: "nearest" });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [selectedIndex]);
|
|
97
|
+
const handleInputChange = (e) => {
|
|
98
|
+
const newValue = e.target.value;
|
|
99
|
+
setInputValue(newValue);
|
|
100
|
+
setIsOpen(true);
|
|
101
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
102
|
+
};
|
|
103
|
+
const handleSelect = (option) => {
|
|
104
|
+
setInputValue(option.label);
|
|
105
|
+
setIsOpen(false);
|
|
106
|
+
setSelectedIndex(-1);
|
|
107
|
+
// Retorna value ou label baseado na prop returnValueOnSelect
|
|
108
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(returnValueOnSelect ? option.value : option.label);
|
|
109
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
|
|
110
|
+
};
|
|
111
|
+
const handleCustomValue = () => {
|
|
112
|
+
setIsOpen(false);
|
|
113
|
+
setSelectedIndex(-1);
|
|
114
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
115
|
+
};
|
|
116
|
+
const handleInputFocus = () => {
|
|
117
|
+
if (filteredOptions.length > 0) {
|
|
118
|
+
setIsOpen(true);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const toggleDropdown = () => {
|
|
122
|
+
setIsOpen(!isOpen);
|
|
123
|
+
if (!isOpen) {
|
|
124
|
+
setSelectedIndex(-1);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const handleClear = () => {
|
|
128
|
+
setInputValue("");
|
|
129
|
+
setIsOpen(false);
|
|
130
|
+
setSelectedIndex(-1);
|
|
131
|
+
onChange === null || onChange === void 0 ? void 0 : onChange("");
|
|
132
|
+
};
|
|
133
|
+
const shouldShowDropdown = isOpen && (filteredOptions.length > 0 || isLoading);
|
|
134
|
+
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(Box, { ref: containerRef, position: "relative", overflow: "visible", children: [_jsxs(Box, { position: "relative", sx: { width: ((_b = props.style) === null || _b === void 0 ? void 0 : _b.width) || "auto" }, children: [leftIcon && (_jsx(Box, { display: "flex", alignItems: "center", position: "absolute", left: "8px", children: leftIcon })), _jsx(CustomInput, { ref: ref, value: inputValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onFocus: handleInputFocus, placeholder: placeholder, leftIcon: leftIcon, size: size, _placeholder: {
|
|
135
|
+
color: "neutral.200",
|
|
136
|
+
opacity: 1
|
|
137
|
+
}, style: Object.assign({ paddingRight: inputValue ? "80px" : "40px" }, (props.isDisabled && {
|
|
138
|
+
backgroundColor: "var(--chakra-colors-background-secondary)",
|
|
139
|
+
})), isDisabled: props.isDisabled }), _jsxs(Box, { display: "flex", alignItems: "center", position: "absolute", right: "8px", top: "50%", transform: "translateY(-50%)", zIndex: 1, children: [isLoading ? (_jsx(Spinner, { size: "xs", color: "neutral.200" })) : inputValue && !props.isDisabled ? (_jsxs(HStack, { spacing: 1, children: [_jsx(IconButton, { size: "xs", variant: "ghost", icon: _jsx(CloseIcon, { boxSize: 3 }), onClick: handleClear, "aria-label": "Limpar campo", _hover: { bg: "transparent" }, color: "neutral.300", isDisabled: props.isDisabled }), _jsx(IconButton, { size: "xs", variant: "ghost", icon: isOpen ? (_jsx(ChevronUpIcon, { boxSize: 3 })) : (_jsx(ChevronDownIcon, { boxSize: 3 })), onClick: props.isDisabled ? undefined : toggleDropdown, "aria-label": "Toggle dropdown", _hover: { bg: "transparent" }, isDisabled: props.isDisabled, opacity: props.isDisabled ? 0.5 : 1, cursor: props.isDisabled ? "not-allowed" : "pointer" })] })) : (_jsx(IconButton, { size: "xs", variant: "ghost", icon: isOpen ? (_jsx(ChevronUpIcon, { boxSize: 3 })) : (_jsx(ChevronDownIcon, { boxSize: 3 })), onClick: props.isDisabled ? undefined : toggleDropdown, "aria-label": "Toggle dropdown", _hover: { bg: "transparent" }, isDisabled: props.isDisabled, opacity: props.isDisabled ? 0.5 : 1, cursor: props.isDisabled ? "not-allowed" : "pointer" })), rightIcon] })] }), shouldShowDropdown && (_jsx(Box, { position: "absolute", top: "100%", left: 0, right: 0, zIndex: 9999, bg: "background.primary", border: "1px solid", borderColor: "border.primary", borderRadius: "md", boxShadow: "lg", maxHeight: maxHeight, overflow: "hidden", mt: 1, children: _jsx(List, { ref: listRef, spacing: 0, maxHeight: "200px", overflowY: "auto", children: isLoading ? (_jsx(ListItem, { p: 3, textAlign: "center", color: "neutral.200", children: loadingMessage })) : filteredOptions.length > 0 ? (filteredOptions.map((option, index) => (_jsx(ListItem, { p: 3, cursor: "pointer", bg: selectedIndex === index ? "secondary.50" : "transparent", _hover: { bg: "background.secondary" }, onClick: () => handleSelect(option), opacity: option.disabled ? 0.5 : 1, pointerEvents: option.disabled ? "none" : "auto", children: _jsx(Text, { fontSize: "sm", color: "neutral.400", children: option.label }) }, option.value)))) : (_jsx(ListItem, { p: 3, textAlign: "center", color: "neutral.200", children: noOptionsMessage })) }) }))] }), showError && error && (_jsx(FormErrorMessage, { fontSize: "xs", mt: "3px", children: error }))] }));
|
|
140
|
+
return withFormControl ? (_jsx(FormControl, { isInvalid: !!error, children: inputElement })) : (inputElement);
|
|
141
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BadgeProps } from '@chakra-ui/react';
|
|
3
|
+
interface CustomBadgeProps extends BadgeProps {
|
|
4
|
+
colorScheme?: BadgeProps['colorScheme'] | string;
|
|
5
|
+
pHorizontal?: number | string;
|
|
6
|
+
pVertical?: number | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CustomBadge: React.FC<CustomBadgeProps>;
|
|
9
|
+
export default CustomBadge;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { Badge } from '@chakra-ui/react';
|
|
14
|
+
export const CustomBadge = (_a) => {
|
|
15
|
+
var { colorScheme = "alert.success", children, pHorizontal = 1.5, // Padding horizontal
|
|
16
|
+
pVertical = 1.5 } = _a, // Padding vertical
|
|
17
|
+
props = __rest(_a, ["colorScheme", "children", "pHorizontal", "pVertical"]);
|
|
18
|
+
// Se colorScheme contém ponto, usar como bg direto
|
|
19
|
+
if (typeof colorScheme === 'string' && colorScheme.includes('.')) {
|
|
20
|
+
return (_jsx(Badge, Object.assign({ bg: colorScheme, color: "background.alwaysLight", px: pHorizontal, py: pVertical, borderRadius: "4px" }, props, { children: children })));
|
|
21
|
+
}
|
|
22
|
+
// Senão, usar colorScheme normal do Chakra
|
|
23
|
+
return (_jsx(Badge, Object.assign({ colorScheme: colorScheme, px: pHorizontal, py: pVertical }, props, { children: children })));
|
|
24
|
+
};
|
|
25
|
+
export default CustomBadge;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ButtonProps } from "@chakra-ui/react";
|
|
3
|
+
export interface CustomButtonProps extends ButtonProps {
|
|
4
|
+
variant?: "primary" | "secondary" | "outline" | "link" | "unstyled" | "solid" | "ghost";
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
leftIcon?: React.ReactElement;
|
|
8
|
+
rightIcon?: React.ReactElement;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
borderColor?: string;
|
|
13
|
+
width?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
export declare const CustomButton: React.FC<CustomButtonProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { Button } from "@chakra-ui/react";
|
|
14
|
+
export const CustomButton = (_a) => {
|
|
15
|
+
var { variant = "outline", // Variante padrão
|
|
16
|
+
isLoading = false, disabled = false, leftIcon, rightIcon, children, backgroundColor = "primary.300", color, borderColor, width, style } = _a, props = __rest(_a, ["variant", "isLoading", "disabled", "leftIcon", "rightIcon", "children", "backgroundColor", "color", "borderColor", "width", "style"]);
|
|
17
|
+
return (_jsx(Button, Object.assign({ isLoading: isLoading, isDisabled: disabled, leftIcon: leftIcon, rightIcon: rightIcon, width: width, backgroundColor: backgroundColor, borderColor: borderColor, variant: variant, color: color ? color : "background.alwaysLight", _hover: { backgroundColor: backgroundColor, opacity: 0.7 }, borderRadius: "4px" }, props, { children: children })));
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CardProps } from "@chakra-ui/react";
|
|
2
|
+
type CustomCardProps = CardProps & {
|
|
3
|
+
header?: React.ReactNode;
|
|
4
|
+
body?: React.ReactNode;
|
|
5
|
+
footer?: React.ReactNode;
|
|
6
|
+
maxWidth?: string | number;
|
|
7
|
+
borderRadius?: string | number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export default function CustomCard({ header, body, footer, maxWidth, borderRadius, style, ...props }: CustomCardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { Card, CardBody, CardFooter, CardHeader, } from "@chakra-ui/react";
|
|
14
|
+
export default function CustomCard(_a) {
|
|
15
|
+
var { header, body, footer, maxWidth = "sm", borderRadius = "lg", style } = _a, props = __rest(_a, ["header", "body", "footer", "maxWidth", "borderRadius", "style"]);
|
|
16
|
+
return (_jsxs(Card, Object.assign({ maxW: maxWidth, borderRadius: borderRadius, style: style, overflow: "hidden" }, props, { sx: { border: `1px solid`, borderColor: "border.secondary" }, children: [header && _jsx(CardHeader, { children: header }), body && _jsx(CardBody, { children: body }), footer && (_jsx(CardFooter, { sx: {
|
|
17
|
+
borderTop: "1px solid",
|
|
18
|
+
borderColor: "neutral.50",
|
|
19
|
+
}, children: footer }))] })));
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CheckboxProps } from "@chakra-ui/react";
|
|
3
|
+
export default interface CustomCheckboxProps extends CheckboxProps {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
helperText?: React.ReactNode;
|
|
6
|
+
error?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
labelColor?: string;
|
|
10
|
+
labelBold?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const CustomCheckbox: React.ForwardRefExoticComponent<CustomCheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { forwardRef, useId } from "react";
|
|
14
|
+
import { Checkbox, FormControl, FormErrorMessage, FormHelperText, FormLabel, HStack, Text, Tooltip, } from "@chakra-ui/react";
|
|
15
|
+
import { Info } from "lucide-react";
|
|
16
|
+
export const CustomCheckbox = forwardRef((_a, ref) => {
|
|
17
|
+
var { id, label, helperText, error, isRequired, isDisabled, children, required = false, tooltip, labelColor = "neutral.400", labelBold = true } = _a, checkboxProps = __rest(_a, ["id", "label", "helperText", "error", "isRequired", "isDisabled", "children", "required", "tooltip", "labelColor", "labelBold"]);
|
|
18
|
+
// Gera um ID único se não for fornecido via props
|
|
19
|
+
const generatedId = useId();
|
|
20
|
+
const checkboxId = id !== null && id !== void 0 ? id : `custom-checkbox-${generatedId}`;
|
|
21
|
+
return (_jsxs(FormControl, { isInvalid: !!error, isDisabled: isDisabled, children: [label && (_jsx(FormLabel, { htmlFor: checkboxId, fontSize: "sm", children: _jsxs(HStack, { spacing: 1, align: "center", children: [_jsx(Text, { color: labelColor, fontWeight: labelBold ? "bold" : "normal", children: label }), (required || isRequired) && (_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(Checkbox, Object.assign({ id: checkboxId, ref: ref }, checkboxProps, { borderColor: "primary.300", _focusVisible: {
|
|
22
|
+
ring: 1,
|
|
23
|
+
ringColor: "primary.300",
|
|
24
|
+
}, children: children })), helperText && !error && (_jsx(FormHelperText, { fontSize: "xs", children: helperText })), error && _jsx(FormErrorMessage, { fontSize: "xs", mt: "3px", children: error })] }));
|
|
25
|
+
});
|
|
26
|
+
CustomCheckbox.displayName = "CustomCheckbox";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CheckboxGroupProps } from "@chakra-ui/react";
|
|
3
|
+
export interface CheckboxOption {
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CustomCheckboxGroupProps extends Omit<CheckboxGroupProps, "children"> {
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
helperText?: React.ReactNode;
|
|
10
|
+
error?: string;
|
|
11
|
+
options: CheckboxOption[];
|
|
12
|
+
fieldSize?: "sm" | "md" | "lg";
|
|
13
|
+
direction?: "row" | "column";
|
|
14
|
+
spacing?: number | string;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
tooltip?: string;
|
|
17
|
+
labelColor?: string;
|
|
18
|
+
labelBold?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const CustomCheckboxGroup: React.ForwardRefExoticComponent<CustomCheckboxGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export default CustomCheckboxGroup;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { forwardRef, useId } from "react";
|
|
14
|
+
import { CheckboxGroup, FormControl, FormLabel, FormHelperText, FormErrorMessage, Stack, Tooltip, Text, HStack, } from "@chakra-ui/react";
|
|
15
|
+
import { CustomCheckbox } from "./CustomCheckBox";
|
|
16
|
+
import { Info } from "lucide-react";
|
|
17
|
+
export const CustomCheckboxGroup = forwardRef((_a, ref) => {
|
|
18
|
+
var { label, helperText, error, options, fieldSize = "sm", direction = "column", spacing = 4, isDisabled = false, tooltip, labelColor = "neutral.400", labelBold = true } = _a, groupProps = __rest(_a, ["label", "helperText", "error", "options", "fieldSize", "direction", "spacing", "isDisabled", "tooltip", "labelColor", "labelBold"]);
|
|
19
|
+
// id base para o grupo e para cada checkbox
|
|
20
|
+
const generatedId = useId();
|
|
21
|
+
const groupId = `checkbox-group-${generatedId}`;
|
|
22
|
+
return (_jsxs(FormControl, { ref: ref, id: groupId, isInvalid: !!error, isDisabled: isDisabled, children: [label && (_jsx(FormLabel, { htmlFor: groupId, fontSize: "sm", children: _jsxs(HStack, { spacing: 1, align: "center", children: [_jsx(Text, { color: labelColor, fontWeight: labelBold ? "bold" : "normal", children: label }), tooltip && (_jsx(Tooltip, { label: tooltip, placement: "top", hasArrow: true, children: _jsx(Info, { color: "var(--chakra-colors-alert-warning)", width: "16px", height: "16px" }) }))] }) })), _jsx(CheckboxGroup, Object.assign({}, groupProps, { children: _jsx(Stack, { direction: direction, spacing: spacing, children: options.map((option) => {
|
|
23
|
+
var _a;
|
|
24
|
+
return (_jsx(CustomCheckbox, { id: `${groupId}-${option.value}`, value: option.value.toString(), size: fieldSize, isDisabled: isDisabled, children: (_a = option.label) !== null && _a !== void 0 ? _a : option.value }, option.value));
|
|
25
|
+
}) }) })), helperText && !error && (_jsx(FormHelperText, { fontSize: "xs", children: helperText })), error && _jsx(FormErrorMessage, { fontSize: "xs", mt: "3px", children: error })] }));
|
|
26
|
+
});
|
|
27
|
+
CustomCheckboxGroup.displayName = "CustomCheckboxGroup";
|
|
28
|
+
export default CustomCheckboxGroup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DrawerProps } from "@chakra-ui/react";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
type CustomDrawerProps = Omit<DrawerProps, "children"> & {
|
|
4
|
+
header?: ReactNode;
|
|
5
|
+
footer?: ReactNode;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
showCloseButton?: boolean;
|
|
8
|
+
contentProps?: Record<string, any>;
|
|
9
|
+
};
|
|
10
|
+
declare const CustomDrawer: React.FC<CustomDrawerProps>;
|
|
11
|
+
export default CustomDrawer;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, Text, } from "@chakra-ui/react";
|
|
14
|
+
import styled from "@emotion/styled";
|
|
15
|
+
const CustomDrawer = (_a) => {
|
|
16
|
+
var { isOpen, onClose, placement = "right", header, footer, children, showCloseButton = true, contentProps } = _a, rest = __rest(_a, ["isOpen", "onClose", "placement", "header", "footer", "children", "showCloseButton", "contentProps"]);
|
|
17
|
+
return (_jsxs(Drawer, Object.assign({ isOpen: isOpen, placement: placement, onClose: onClose }, rest, { children: [_jsx(DrawerOverlay, {}), _jsxs(DrawerContent, Object.assign({}, contentProps, { children: [showCloseButton && _jsx(DrawerCloseButton, { color: "neutral.100" }), header && (_jsxs(CustomDrawerHeader, { children: [_jsx(Text, { fontSize: "sm", color: "primary.300", fontWeight: "bold", children: header }), _jsx(Divider, { borderColor: "primary.300" })] })), _jsx(CustomDrawerContent, { children: children }), footer && _jsx(CustomDrawerFooter, { children: footer })] }))] })));
|
|
18
|
+
};
|
|
19
|
+
export default CustomDrawer;
|
|
20
|
+
const CustomDrawerHeader = styled(DrawerHeader) `
|
|
21
|
+
background-color: var(--chakra-colors-background-primary);
|
|
22
|
+
padding-left: 18px;
|
|
23
|
+
padding-right: 18px;
|
|
24
|
+
padding-top: 26px;
|
|
25
|
+
`;
|
|
26
|
+
const CustomDrawerContent = styled(DrawerBody) `
|
|
27
|
+
background-color: var(--chakra-colors-background-primary);
|
|
28
|
+
padding-left: 18px;
|
|
29
|
+
padding-right: 18px;
|
|
30
|
+
padding-top: 0px;
|
|
31
|
+
`;
|
|
32
|
+
const CustomDrawerFooter = styled(DrawerFooter) `
|
|
33
|
+
background-color: var(--chakra-colors-background-secondary);
|
|
34
|
+
padding-right: 18px;
|
|
35
|
+
padding-left: 18px;
|
|
36
|
+
`;
|