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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { DatePickerField } from "../../../../components/DatePicker/CustomDatePicker";
|
|
3
|
+
declare const meta: Meta<typeof DatePickerField>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DatePickerField>;
|
|
6
|
+
/** 🎯 Default: Exemplo básico do DatePicker */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
/** 🎨 Variants: Demonstração de diferentes variantes */
|
|
9
|
+
export declare const Variants: Story;
|
|
10
|
+
/** 🎨 States: Demonstração de diferentes estados */
|
|
11
|
+
export declare const States: Story;
|
|
12
|
+
/** 🎨 CloseBlur: Demonstração do comportamento closeBlur */
|
|
13
|
+
export declare const CloseBlur: Story;
|
|
14
|
+
/** 🎨 WithInput: Demonstração com input editável */
|
|
15
|
+
export declare const WithInput: Story;
|
|
16
|
+
/** 🎨 AdvancedFeatures: Funcionalidades avançadas */
|
|
17
|
+
export declare const AdvancedFeatures: Story;
|
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, VStack } from "@chakra-ui/react";
|
|
4
|
+
import { DatePickerField } from "../../../../components/DatePicker/CustomDatePicker";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Londrisoft/Components/DatePicker",
|
|
7
|
+
component: DatePickerField,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
args: {
|
|
10
|
+
variant: "simple",
|
|
11
|
+
label: "Selecione uma data",
|
|
12
|
+
placeholder: "Selecione o período",
|
|
13
|
+
required: false,
|
|
14
|
+
error: "",
|
|
15
|
+
disabled: false,
|
|
16
|
+
showInput: false,
|
|
17
|
+
withFormControl: true,
|
|
18
|
+
status: false,
|
|
19
|
+
closeBlur: false,
|
|
20
|
+
name: "",
|
|
21
|
+
defaultValue: "",
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
variant: {
|
|
25
|
+
control: { type: "select", options: ["simple", "advanced"] },
|
|
26
|
+
description: "Variante do DatePicker: simple (data única) ou advanced (range de datas com presets).",
|
|
27
|
+
table: { category: "Behavior" },
|
|
28
|
+
},
|
|
29
|
+
name: {
|
|
30
|
+
control: "text",
|
|
31
|
+
description: "Nome do campo (para qualquer biblioteca de formulário).",
|
|
32
|
+
table: { category: "Content" },
|
|
33
|
+
},
|
|
34
|
+
label: {
|
|
35
|
+
control: "text",
|
|
36
|
+
description: "Texto do label exibido acima do campo.",
|
|
37
|
+
table: { category: "Content" },
|
|
38
|
+
},
|
|
39
|
+
placeholder: {
|
|
40
|
+
control: "text",
|
|
41
|
+
description: "Texto exibido quando nenhuma data está selecionada.",
|
|
42
|
+
table: { category: "Content" },
|
|
43
|
+
},
|
|
44
|
+
value: {
|
|
45
|
+
control: "text",
|
|
46
|
+
description: "Valor da data (string ISO para simple ou array de strings para advanced).",
|
|
47
|
+
table: { category: "State" },
|
|
48
|
+
},
|
|
49
|
+
onChange: {
|
|
50
|
+
action: "changed",
|
|
51
|
+
description: "Função callback chamada quando a data é alterada.",
|
|
52
|
+
table: { category: "Events" },
|
|
53
|
+
},
|
|
54
|
+
minDate: {
|
|
55
|
+
control: "text",
|
|
56
|
+
description: "Data mínima permitida (formato ISO string).",
|
|
57
|
+
table: { category: "Validation" },
|
|
58
|
+
},
|
|
59
|
+
maxDate: {
|
|
60
|
+
control: "text",
|
|
61
|
+
description: "Data máxima permitida (formato ISO string).",
|
|
62
|
+
table: { category: "Validation" },
|
|
63
|
+
},
|
|
64
|
+
required: {
|
|
65
|
+
control: "boolean",
|
|
66
|
+
description: "Adiciona asterisco vermelho indicando campo obrigatório.",
|
|
67
|
+
table: { category: "Validation" },
|
|
68
|
+
},
|
|
69
|
+
error: {
|
|
70
|
+
control: "text",
|
|
71
|
+
description: "Mensagem de erro exibida abaixo do campo.",
|
|
72
|
+
table: { category: "State" },
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
control: "boolean",
|
|
76
|
+
description: "Desabilita o campo de data.",
|
|
77
|
+
table: { category: "State" },
|
|
78
|
+
},
|
|
79
|
+
defaultValue: {
|
|
80
|
+
control: "text",
|
|
81
|
+
description: "Valor padrão da data (formato ISO string).",
|
|
82
|
+
table: { category: "State" },
|
|
83
|
+
},
|
|
84
|
+
showInput: {
|
|
85
|
+
control: "boolean",
|
|
86
|
+
description: "Se true, mostra input editável ao invés de botão com calendário.",
|
|
87
|
+
table: { category: "Behavior" },
|
|
88
|
+
},
|
|
89
|
+
withFormControl: {
|
|
90
|
+
control: "boolean",
|
|
91
|
+
description: "Envolve o campo em FormControl para exibir erros.",
|
|
92
|
+
table: { category: "Behavior" },
|
|
93
|
+
},
|
|
94
|
+
closeBlur: {
|
|
95
|
+
control: "boolean",
|
|
96
|
+
description: "Se true, fecha o popover quando perde o foco (blur).",
|
|
97
|
+
table: { category: "Behavior" },
|
|
98
|
+
},
|
|
99
|
+
status: {
|
|
100
|
+
control: "boolean",
|
|
101
|
+
description: "Para indicar estado de erro visual.",
|
|
102
|
+
table: { category: "State" },
|
|
103
|
+
},
|
|
104
|
+
color: {
|
|
105
|
+
control: "color",
|
|
106
|
+
description: "Cor do texto do botão/input.",
|
|
107
|
+
table: { category: "Styling" },
|
|
108
|
+
},
|
|
109
|
+
backgroundColor: {
|
|
110
|
+
control: "color",
|
|
111
|
+
description: "Cor de fundo do botão/input.",
|
|
112
|
+
table: { category: "Styling" },
|
|
113
|
+
},
|
|
114
|
+
borderColor: {
|
|
115
|
+
control: "color",
|
|
116
|
+
description: "Cor da borda do botão/input.",
|
|
117
|
+
table: { category: "Styling" },
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
parameters: {
|
|
121
|
+
docs: {
|
|
122
|
+
description: {
|
|
123
|
+
component: `
|
|
124
|
+
**DatePickerField** é um componente de seleção de data baseado no react-datepicker, otimizado para formulários e interfaces de usuário modernas.
|
|
125
|
+
|
|
126
|
+
## Características Principais
|
|
127
|
+
|
|
128
|
+
- **Duas Variantes**: Simple (data única) e Advanced (range de datas com presets)
|
|
129
|
+
- **Validação Integrada**: Sistema de validação com exibição de erros e estados visuais
|
|
130
|
+
- **Input Editável**: Opção de mostrar input editável ou botão com calendário
|
|
131
|
+
- **Presets Inteligentes**: Modo advanced com presets predefinidos (Hoje, Esta semana, Este mês, etc.)
|
|
132
|
+
- **Controle de Foco**: Parâmetro \`closeBlur\` para controlar o fechamento do popover ao perder foco
|
|
133
|
+
- **Valor Padrão**: Suporte a \`defaultValue\` para inicializar o campo com uma data
|
|
134
|
+
- **Nome do Campo**: Suporte a \`name\` para integração com bibliotecas de formulário
|
|
135
|
+
- **Acessibilidade**: Implementação completa de ARIA labels e navegação por teclado
|
|
136
|
+
- **Integração com Tema**: Compatível com o sistema de design Londrisoft
|
|
137
|
+
|
|
138
|
+
## Casos de Uso Comuns
|
|
139
|
+
|
|
140
|
+
- **Formulários**: Seleção de datas de nascimento, eventos, prazos
|
|
141
|
+
- **Filtros**: Seleção de períodos para relatórios e dashboards
|
|
142
|
+
- **Agendamentos**: Seleção de datas para agendamentos e reservas
|
|
143
|
+
- **Validação**: Validação de períodos com datas mínimas e máximas
|
|
144
|
+
|
|
145
|
+
## Variantes Disponíveis
|
|
146
|
+
|
|
147
|
+
- **simple**: Seleção de data única
|
|
148
|
+
- **advanced**: Seleção de range de datas com presets predefinidos
|
|
149
|
+
`,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
backgrounds: {
|
|
153
|
+
default: "light",
|
|
154
|
+
values: [
|
|
155
|
+
{ name: "light", value: "#ffffff" },
|
|
156
|
+
{ name: "dark", value: "#000000" },
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
a11y: {
|
|
160
|
+
element: "#root",
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
export default meta;
|
|
165
|
+
/** 🎯 Default: Exemplo básico do DatePicker */
|
|
166
|
+
export const Default = {
|
|
167
|
+
name: "Padrão",
|
|
168
|
+
render: () => {
|
|
169
|
+
const [value, setValue] = useState("");
|
|
170
|
+
return (_jsx(Box, { maxWidth: "400px", children: _jsx(DatePickerField, { label: "Selecione uma data", placeholder: "Selecione o per\u00EDodo", value: value, onChange: (newValue) => {
|
|
171
|
+
setValue(newValue);
|
|
172
|
+
} }) }));
|
|
173
|
+
},
|
|
174
|
+
parameters: {
|
|
175
|
+
docs: {
|
|
176
|
+
description: {
|
|
177
|
+
story: `
|
|
178
|
+
**Exemplo básico** do DatePickerField com configuração padrão.
|
|
179
|
+
|
|
180
|
+
**Características:**
|
|
181
|
+
- Variante simple (data única)
|
|
182
|
+
- Label descritivo
|
|
183
|
+
- Placeholder informativo
|
|
184
|
+
- Valor controlado
|
|
185
|
+
- Sem erros ou validações
|
|
186
|
+
|
|
187
|
+
**Casos de uso:**
|
|
188
|
+
- Campos de data simples
|
|
189
|
+
- Formulários básicos
|
|
190
|
+
- Seleção de datas não críticas
|
|
191
|
+
- Prototipagem rápida
|
|
192
|
+
|
|
193
|
+
**Dicas de implementação:**
|
|
194
|
+
- Use labels claros e descritivos
|
|
195
|
+
- Placeholders devem guiar o usuário
|
|
196
|
+
- Considere validação quando necessário
|
|
197
|
+
- Mantenha consistência visual
|
|
198
|
+
`,
|
|
199
|
+
},
|
|
200
|
+
source: {
|
|
201
|
+
code: `
|
|
202
|
+
import React, { useState } from 'react';
|
|
203
|
+
import { DatePickerField } from '../../../components/DatePicker/CustomDatePicker';
|
|
204
|
+
|
|
205
|
+
const BasicDatePicker = () => {
|
|
206
|
+
const [value, setValue] = useState('');
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<DatePickerField
|
|
210
|
+
label="Selecione uma data"
|
|
211
|
+
placeholder="Selecione o período"
|
|
212
|
+
value={value}
|
|
213
|
+
onChange={(newValue) => {
|
|
214
|
+
setValue(newValue as string);
|
|
215
|
+
}}
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
`,
|
|
220
|
+
language: "tsx",
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
/** 🎨 Variants: Demonstração de diferentes variantes */
|
|
226
|
+
export const Variants = {
|
|
227
|
+
name: "Variantes",
|
|
228
|
+
render: () => {
|
|
229
|
+
const [simpleValue, setSimpleValue] = useState("");
|
|
230
|
+
const [advancedValue, setAdvancedValue] = useState([null, null]);
|
|
231
|
+
return (_jsxs(VStack, { spacing: 6, align: "stretch", children: [_jsxs(Box, { children: [_jsx(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: "Simple - Data \u00DAnica" }), _jsx(DatePickerField, { variant: "simple", label: "Data de nascimento", placeholder: "Selecione uma data", value: simpleValue, onChange: (newValue) => {
|
|
232
|
+
setSimpleValue(newValue);
|
|
233
|
+
} })] }), _jsxs(Box, { children: [_jsx(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: "Advanced - Range de Datas" }), _jsx(DatePickerField, { variant: "advanced", label: "Per\u00EDodo de busca", placeholder: "Selecione o per\u00EDodo", value: advancedValue, onChange: (newValue) => {
|
|
234
|
+
setAdvancedValue(newValue);
|
|
235
|
+
} })] })] }));
|
|
236
|
+
},
|
|
237
|
+
parameters: {
|
|
238
|
+
docs: {
|
|
239
|
+
description: {
|
|
240
|
+
story: `
|
|
241
|
+
**Demonstração** das diferentes variantes do DatePickerField.
|
|
242
|
+
|
|
243
|
+
**Variantes mostradas:**
|
|
244
|
+
- **Simple**: Seleção de data única
|
|
245
|
+
- **Advanced**: Seleção de range de datas com presets predefinidos
|
|
246
|
+
|
|
247
|
+
**Casos de uso por variante:**
|
|
248
|
+
- **Simple**: Datas de nascimento, eventos únicos, prazos
|
|
249
|
+
- **Advanced**: Períodos de relatórios, filtros de dashboard, busca por intervalo
|
|
250
|
+
|
|
251
|
+
**Dicas de design:**
|
|
252
|
+
- Use Simple para datas individuais
|
|
253
|
+
- Use Advanced quando precisar de períodos ou filtros
|
|
254
|
+
- Mantenha consistência visual entre campos relacionados
|
|
255
|
+
`,
|
|
256
|
+
},
|
|
257
|
+
source: {
|
|
258
|
+
code: `
|
|
259
|
+
import React, { useState } from 'react';
|
|
260
|
+
import { VStack, Box, Text } from '@chakra-ui/react';
|
|
261
|
+
import { DatePickerField } from '../../../components/DatePicker/CustomDatePicker';
|
|
262
|
+
|
|
263
|
+
const DatePickerVariants = () => {
|
|
264
|
+
const [simpleValue, setSimpleValue] = useState('');
|
|
265
|
+
const [advancedValue, setAdvancedValue] = useState<[string | null, string | null]>([null, null]);
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<VStack spacing={6} align="stretch">
|
|
269
|
+
<Box>
|
|
270
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>Simple - Data Única</Text>
|
|
271
|
+
<DatePickerField
|
|
272
|
+
variant="simple"
|
|
273
|
+
label="Data de nascimento"
|
|
274
|
+
placeholder="Selecione uma data"
|
|
275
|
+
value={simpleValue}
|
|
276
|
+
onChange={(newValue) => {
|
|
277
|
+
setSimpleValue(newValue as string);
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
</Box>
|
|
281
|
+
|
|
282
|
+
<Box>
|
|
283
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>Advanced - Range de Datas</Text>
|
|
284
|
+
<DatePickerField
|
|
285
|
+
variant="advanced"
|
|
286
|
+
label="Período de busca"
|
|
287
|
+
placeholder="Selecione o período"
|
|
288
|
+
value={advancedValue}
|
|
289
|
+
onChange={(newValue) => {
|
|
290
|
+
setAdvancedValue(newValue as [string | null, string | null]);
|
|
291
|
+
}}
|
|
292
|
+
/>
|
|
293
|
+
</Box>
|
|
294
|
+
</VStack>
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
`,
|
|
298
|
+
language: "tsx",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
/** 🎨 States: Demonstração de diferentes estados */
|
|
304
|
+
export const States = {
|
|
305
|
+
name: "Estados",
|
|
306
|
+
render: () => {
|
|
307
|
+
const [value1, setValue1] = useState("");
|
|
308
|
+
const [value2, setValue2] = useState("");
|
|
309
|
+
const [value3, setValue3] = useState("");
|
|
310
|
+
const [value4, setValue4] = useState("");
|
|
311
|
+
const [value5, setValue5] = useState("2024-01-15T12:00:00.000Z");
|
|
312
|
+
return (_jsxs(VStack, { spacing: 6, align: "stretch", children: [_jsxs(Box, { children: [_jsx(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: "Estados de Valida\u00E7\u00E3o" }), _jsxs(VStack, { spacing: 4, align: "stretch", children: [_jsx(DatePickerField, { label: "Campo Normal", placeholder: "Estado normal", value: value1, onChange: (newValue) => {
|
|
313
|
+
setValue1(newValue);
|
|
314
|
+
} }), _jsx(DatePickerField, { label: "Campo com Erro", placeholder: "Campo com erro", error: "Este campo tem um erro de valida\u00E7\u00E3o", value: value2, onChange: (newValue) => {
|
|
315
|
+
setValue2(newValue);
|
|
316
|
+
} }), _jsx(DatePickerField, { label: "Campo Desabilitado", placeholder: "Campo desabilitado", disabled: true, value: value5 }), _jsx(DatePickerField, { label: "Campo Obrigat\u00F3rio", placeholder: "Campo obrigat\u00F3rio", required: true, value: value4, onChange: (newValue) => {
|
|
317
|
+
setValue4(newValue);
|
|
318
|
+
} })] })] }), _jsxs(Box, { children: [_jsx(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: "Valida\u00E7\u00E3o com Datas M\u00EDnimas e M\u00E1ximas" }), _jsxs(VStack, { spacing: 4, align: "stretch", children: [_jsx(DatePickerField, { label: "Data com M\u00EDnima", placeholder: "Data m\u00EDnima: 2024-01-01", minDate: "2024-01-01", value: value3, onChange: (newValue) => {
|
|
319
|
+
setValue3(newValue);
|
|
320
|
+
} }), _jsx(DatePickerField, { label: "Data com M\u00E1xima", placeholder: "Data m\u00E1xima: 2024-12-31", maxDate: "2024-12-31", value: value3, onChange: (newValue) => {
|
|
321
|
+
setValue3(newValue);
|
|
322
|
+
} }), _jsx(DatePickerField, { label: "Data com Range", placeholder: "Entre 2024-01-01 e 2024-12-31", minDate: "2024-01-01", maxDate: "2024-12-31", value: value3, onChange: (newValue) => {
|
|
323
|
+
setValue3(newValue);
|
|
324
|
+
} })] })] })] }));
|
|
325
|
+
},
|
|
326
|
+
parameters: {
|
|
327
|
+
docs: {
|
|
328
|
+
description: {
|
|
329
|
+
story: `
|
|
330
|
+
**Demonstração** dos diferentes estados do DatePickerField.
|
|
331
|
+
|
|
332
|
+
**Estados mostrados:**
|
|
333
|
+
- **Validação**: Normal, erro, desabilitado, obrigatório
|
|
334
|
+
- **Validação com Datas**: Mínima, máxima, range completo
|
|
335
|
+
|
|
336
|
+
**Casos de uso:**
|
|
337
|
+
- **Normal**: Campos funcionais sem validação
|
|
338
|
+
- **Erro**: Feedback visual para dados inválidos
|
|
339
|
+
- **Desabilitado**: Campos não editáveis
|
|
340
|
+
- **Obrigatório**: Campos que devem ser preenchidos
|
|
341
|
+
- **Validação**: Limites de datas para períodos específicos
|
|
342
|
+
|
|
343
|
+
**Dicas de implementação:**
|
|
344
|
+
- Use mensagens de erro claras e específicas
|
|
345
|
+
- Considere validação em tempo real para melhor UX
|
|
346
|
+
- Mantenha consistência visual entre estados
|
|
347
|
+
- Use minDate e maxDate para limitar períodos válidos
|
|
348
|
+
`,
|
|
349
|
+
},
|
|
350
|
+
source: {
|
|
351
|
+
code: `
|
|
352
|
+
import React, { useState } from 'react';
|
|
353
|
+
import { VStack, Box, Text } from '@chakra-ui/react';
|
|
354
|
+
import { DatePickerField } from '../../../components/DatePicker/CustomDatePicker';
|
|
355
|
+
|
|
356
|
+
const DatePickerStates = () => {
|
|
357
|
+
const [value, setValue] = useState('');
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<VStack spacing={6} align="stretch">
|
|
361
|
+
<Box>
|
|
362
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>Estados de Validação</Text>
|
|
363
|
+
<VStack spacing={4} align="stretch">
|
|
364
|
+
<DatePickerField
|
|
365
|
+
label="Campo Normal"
|
|
366
|
+
placeholder="Estado normal"
|
|
367
|
+
value={value}
|
|
368
|
+
onChange={(newValue) => setValue(newValue as string)}
|
|
369
|
+
/>
|
|
370
|
+
<DatePickerField
|
|
371
|
+
label="Campo com Erro"
|
|
372
|
+
placeholder="Campo com erro"
|
|
373
|
+
error="Este campo tem um erro de validação"
|
|
374
|
+
value={value}
|
|
375
|
+
onChange={(newValue) => setValue(newValue as string)}
|
|
376
|
+
/>
|
|
377
|
+
<DatePickerField
|
|
378
|
+
label="Campo Desabilitado"
|
|
379
|
+
placeholder="Campo desabilitado"
|
|
380
|
+
disabled={true}
|
|
381
|
+
value="2024-01-15T12:00:00.000Z"
|
|
382
|
+
/>
|
|
383
|
+
<DatePickerField
|
|
384
|
+
label="Campo Obrigatório"
|
|
385
|
+
placeholder="Campo obrigatório"
|
|
386
|
+
required={true}
|
|
387
|
+
value={value}
|
|
388
|
+
onChange={(newValue) => setValue(newValue as string)}
|
|
389
|
+
/>
|
|
390
|
+
</VStack>
|
|
391
|
+
</Box>
|
|
392
|
+
|
|
393
|
+
<Box>
|
|
394
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>Validação com Datas Mínimas e Máximas</Text>
|
|
395
|
+
<VStack spacing={4} align="stretch">
|
|
396
|
+
<DatePickerField
|
|
397
|
+
label="Data com Mínima"
|
|
398
|
+
placeholder="Data mínima: 2024-01-01"
|
|
399
|
+
minDate="2024-01-01"
|
|
400
|
+
value={value}
|
|
401
|
+
onChange={(newValue) => setValue(newValue as string)}
|
|
402
|
+
/>
|
|
403
|
+
<DatePickerField
|
|
404
|
+
label="Data com Máxima"
|
|
405
|
+
placeholder="Data máxima: 2024-12-31"
|
|
406
|
+
maxDate="2024-12-31"
|
|
407
|
+
value={value}
|
|
408
|
+
onChange={(newValue) => setValue(newValue as string)}
|
|
409
|
+
/>
|
|
410
|
+
<DatePickerField
|
|
411
|
+
label="Data com Range"
|
|
412
|
+
placeholder="Entre 2024-01-01 e 2024-12-31"
|
|
413
|
+
minDate="2024-01-01"
|
|
414
|
+
maxDate="2024-12-31"
|
|
415
|
+
value={value}
|
|
416
|
+
onChange={(newValue) => setValue(newValue as string)}
|
|
417
|
+
/>
|
|
418
|
+
</VStack>
|
|
419
|
+
</Box>
|
|
420
|
+
</VStack>
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
`,
|
|
424
|
+
language: "tsx",
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
};
|
|
429
|
+
/** 🎨 CloseBlur: Demonstração do comportamento closeBlur */
|
|
430
|
+
export const CloseBlur = {
|
|
431
|
+
name: "Comportamento CloseBlur",
|
|
432
|
+
render: () => {
|
|
433
|
+
const [value1, setValue1] = useState("");
|
|
434
|
+
const [value2, setValue2] = useState("");
|
|
435
|
+
return (_jsxs(VStack, { spacing: 6, align: "stretch", children: [_jsxs(Box, { children: [_jsxs(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: ["closeBlur=", false, " (Padr\u00E3o)"] }), _jsx(Text, { fontSize: "sm", color: "gray.600", mb: 4, children: "O popover n\u00E3o fecha quando perde o foco. O usu\u00E1rio precisa clicar fora ou no bot\u00E3o de fechar." }), _jsx(DatePickerField, { variant: "simple", label: "Data sem closeBlur", placeholder: "Selecione uma data", closeBlur: false, value: value1, onChange: (newValue) => {
|
|
436
|
+
setValue1(newValue);
|
|
437
|
+
} })] }), _jsxs(Box, { children: [_jsxs(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: ["closeBlur=", true] }), _jsx(Text, { fontSize: "sm", color: "gray.600", mb: 4, children: "O popover fecha automaticamente quando perde o foco (blur). \u00DAtil para melhorar a UX em formul\u00E1rios." }), _jsx(DatePickerField, { variant: "simple", label: "Data com closeBlur", placeholder: "Selecione uma data", closeBlur: true, value: value2, onChange: (newValue) => {
|
|
438
|
+
setValue2(newValue);
|
|
439
|
+
} })] })] }));
|
|
440
|
+
},
|
|
441
|
+
parameters: {
|
|
442
|
+
docs: {
|
|
443
|
+
description: {
|
|
444
|
+
story: `
|
|
445
|
+
**Demonstração** do comportamento do parâmetro \`closeBlur\` no DatePickerField.
|
|
446
|
+
|
|
447
|
+
**Comportamentos mostrados:**
|
|
448
|
+
- **closeBlur={false}**: Popover não fecha quando perde o foco (padrão)
|
|
449
|
+
- **closeBlur={true}**: Popover fecha automaticamente quando perde o foco
|
|
450
|
+
|
|
451
|
+
**Casos de uso:**
|
|
452
|
+
- **closeBlur={false}**: Quando o usuário precisa interagir com o calendário por mais tempo
|
|
453
|
+
- **closeBlur={true}**: Para melhorar a UX em formulários, fechando automaticamente após seleção
|
|
454
|
+
|
|
455
|
+
**Dicas de implementação:**
|
|
456
|
+
- Use \`closeBlur={true}\` em formulários para melhorar a experiência
|
|
457
|
+
- Use \`closeBlur={false}\` quando o usuário precisa navegar entre meses
|
|
458
|
+
- Considere o contexto da aplicação ao escolher o comportamento
|
|
459
|
+
`,
|
|
460
|
+
},
|
|
461
|
+
source: {
|
|
462
|
+
code: `
|
|
463
|
+
import React, { useState } from 'react';
|
|
464
|
+
import { VStack, Box, Text } from '@chakra-ui/react';
|
|
465
|
+
import { DatePickerField } from '../../../components/DatePicker/CustomDatePicker';
|
|
466
|
+
|
|
467
|
+
const CloseBlurExample = () => {
|
|
468
|
+
const [value1, setValue1] = useState('');
|
|
469
|
+
const [value2, setValue2] = useState('');
|
|
470
|
+
|
|
471
|
+
return (
|
|
472
|
+
<VStack spacing={6} align="stretch">
|
|
473
|
+
<Box>
|
|
474
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>closeBlur={false} (Padrão)</Text>
|
|
475
|
+
<DatePickerField
|
|
476
|
+
variant="simple"
|
|
477
|
+
label="Data sem closeBlur"
|
|
478
|
+
placeholder="Selecione uma data"
|
|
479
|
+
closeBlur={false}
|
|
480
|
+
value={value1}
|
|
481
|
+
onChange={(newValue) => setValue1(newValue as string)}
|
|
482
|
+
/>
|
|
483
|
+
</Box>
|
|
484
|
+
|
|
485
|
+
<Box>
|
|
486
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>closeBlur={true}</Text>
|
|
487
|
+
<DatePickerField
|
|
488
|
+
variant="simple"
|
|
489
|
+
label="Data com closeBlur"
|
|
490
|
+
placeholder="Selecione uma data"
|
|
491
|
+
closeBlur={true}
|
|
492
|
+
value={value2}
|
|
493
|
+
onChange={(newValue) => setValue2(newValue as string)}
|
|
494
|
+
/>
|
|
495
|
+
</Box>
|
|
496
|
+
</VStack>
|
|
497
|
+
);
|
|
498
|
+
};
|
|
499
|
+
`,
|
|
500
|
+
language: "tsx",
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
};
|
|
505
|
+
/** 🎨 WithInput: Demonstração com input editável */
|
|
506
|
+
export const WithInput = {
|
|
507
|
+
name: "Com Input Editável",
|
|
508
|
+
render: () => {
|
|
509
|
+
const [value1, setValue1] = useState("");
|
|
510
|
+
const [value2, setValue2] = useState("");
|
|
511
|
+
return (_jsxs(VStack, { spacing: 6, align: "stretch", children: [_jsxs(Box, { children: [_jsxs(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: ["Com Input Edit\u00E1vel (showInput=", true, ")"] }), _jsx(DatePickerField, { variant: "simple", label: "Data de in\u00EDcio", placeholder: "dd/mm/aaaa", showInput: true, value: value1, onChange: (newValue) => {
|
|
512
|
+
setValue1(newValue);
|
|
513
|
+
} })] }), _jsxs(Box, { children: [_jsxs(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: ["Com Bot\u00E3o e Calend\u00E1rio (showInput=", false, ")"] }), _jsx(DatePickerField, { variant: "simple", label: "Data de t\u00E9rmino", placeholder: "Selecione o per\u00EDodo", showInput: false, value: value2, onChange: (newValue) => {
|
|
514
|
+
setValue2(newValue);
|
|
515
|
+
} })] })] }));
|
|
516
|
+
},
|
|
517
|
+
parameters: {
|
|
518
|
+
docs: {
|
|
519
|
+
description: {
|
|
520
|
+
story: `
|
|
521
|
+
**Demonstração** do DatePickerField com input editável e botão com calendário.
|
|
522
|
+
|
|
523
|
+
**Modos mostrados:**
|
|
524
|
+
- **showInput={true}**: Input editável onde o usuário pode digitar a data diretamente
|
|
525
|
+
- **showInput={false}**: Botão com calendário popup (padrão)
|
|
526
|
+
|
|
527
|
+
**Casos de uso:**
|
|
528
|
+
- **Input Editável**: Quando o usuário precisa digitar datas rapidamente
|
|
529
|
+
- **Botão com Calendário**: Quando a visualização do calendário é preferida
|
|
530
|
+
|
|
531
|
+
**Dicas de design:**
|
|
532
|
+
- Use input editável para usuários que digitam rápido
|
|
533
|
+
- Use botão com calendário para melhor visualização
|
|
534
|
+
- Mantenha consistência na mesma interface
|
|
535
|
+
`,
|
|
536
|
+
},
|
|
537
|
+
source: {
|
|
538
|
+
code: `
|
|
539
|
+
import React, { useState } from 'react';
|
|
540
|
+
import { VStack, Box, Text } from '@chakra-ui/react';
|
|
541
|
+
import { DatePickerField } from '../../../components/DatePicker/CustomDatePicker';
|
|
542
|
+
|
|
543
|
+
const DatePickerWithInput = () => {
|
|
544
|
+
const [value1, setValue1] = useState('');
|
|
545
|
+
const [value2, setValue2] = useState('');
|
|
546
|
+
|
|
547
|
+
return (
|
|
548
|
+
<VStack spacing={6} align="stretch">
|
|
549
|
+
<Box>
|
|
550
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>Com Input Editável</Text>
|
|
551
|
+
<DatePickerField
|
|
552
|
+
variant="simple"
|
|
553
|
+
label="Data de início"
|
|
554
|
+
placeholder="dd/mm/aaaa"
|
|
555
|
+
showInput={true}
|
|
556
|
+
value={value1}
|
|
557
|
+
onChange={(newValue) => setValue1(newValue as string)}
|
|
558
|
+
/>
|
|
559
|
+
</Box>
|
|
560
|
+
|
|
561
|
+
<Box>
|
|
562
|
+
<Text fontSize="lg" fontWeight="bold" mb={3}>Com Botão e Calendário</Text>
|
|
563
|
+
<DatePickerField
|
|
564
|
+
variant="simple"
|
|
565
|
+
label="Data de término"
|
|
566
|
+
placeholder="Selecione o período"
|
|
567
|
+
showInput={false}
|
|
568
|
+
value={value2}
|
|
569
|
+
onChange={(newValue) => setValue2(newValue as string)}
|
|
570
|
+
/>
|
|
571
|
+
</Box>
|
|
572
|
+
</VStack>
|
|
573
|
+
);
|
|
574
|
+
};
|
|
575
|
+
`,
|
|
576
|
+
language: "tsx",
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
};
|
|
581
|
+
/** 🎨 AdvancedFeatures: Funcionalidades avançadas */
|
|
582
|
+
export const AdvancedFeatures = {
|
|
583
|
+
name: "Funcionalidades Avançadas",
|
|
584
|
+
render: () => {
|
|
585
|
+
const [value, setValue] = useState([
|
|
586
|
+
null,
|
|
587
|
+
null,
|
|
588
|
+
]);
|
|
589
|
+
return (_jsxs(VStack, { spacing: 6, align: "stretch", children: [_jsxs(Box, { children: [_jsx(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: "Modo Advanced com Presets" }), _jsx(Text, { fontSize: "sm", color: "gray.600", mb: 4, children: "O modo advanced oferece presets predefinidos como \"Hoje\", \"Esta semana\", \"Este m\u00EAs\", etc., al\u00E9m de permitir sele\u00E7\u00E3o manual de per\u00EDodo." }), _jsx(DatePickerField, { variant: "advanced", label: "Per\u00EDodo de an\u00E1lise", placeholder: "Selecione o per\u00EDodo", value: value, onChange: (newValue) => {
|
|
590
|
+
setValue(newValue);
|
|
591
|
+
} })] }), _jsxs(Box, { children: [_jsx(Text, { fontSize: "lg", fontWeight: "bold", mb: 3, children: "Presets Dispon\u00EDveis" }), _jsxs(VStack, { spacing: 2, align: "stretch", fontSize: "sm", color: "gray.600", children: [_jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Manual" }), ": Digite as datas manualmente"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Hoje" }), ": Seleciona a data atual"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Esta semana" }), ": Segunda a domingo da semana atual"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Semana passada" }), ": Segunda a domingo da semana anterior"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Este m\u00EAs" }), ": Primeiro ao \u00FAltimo dia do m\u00EAs atual"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "M\u00EAs passado" }), ": Primeiro ao \u00FAltimo dia do m\u00EAs anterior"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Selecionar m\u00EAs" }), ": Seleciona um m\u00EAs espec\u00EDfico"] }), _jsxs(Text, { children: ["\u2022 ", _jsx("strong", { children: "Per\u00EDodo customizado" }), ": Permite selecionar qualquer per\u00EDodo"] })] })] })] }));
|
|
592
|
+
},
|
|
593
|
+
parameters: {
|
|
594
|
+
docs: {
|
|
595
|
+
description: {
|
|
596
|
+
story: `
|
|
597
|
+
**Demonstração** das funcionalidades avançadas do DatePickerField.
|
|
598
|
+
|
|
599
|
+
**Funcionalidades mostradas:**
|
|
600
|
+
- **Modo Advanced**: Range de datas com presets predefinidos
|
|
601
|
+
- **Presets Inteligentes**: Seleção rápida de períodos comuns
|
|
602
|
+
- **Seleção Manual**: Permite digitar datas manualmente
|
|
603
|
+
- **Seleção de Mês**: Visualização mensal para seleção rápida
|
|
604
|
+
|
|
605
|
+
**Presets Disponíveis:**
|
|
606
|
+
- **Manual**: Digite as datas manualmente
|
|
607
|
+
- **Hoje**: Seleciona a data atual
|
|
608
|
+
- **Esta semana**: Segunda a domingo da semana atual
|
|
609
|
+
- **Semana passada**: Segunda a domingo da semana anterior
|
|
610
|
+
- **Este mês**: Primeiro ao último dia do mês atual
|
|
611
|
+
- **Mês passado**: Primeiro ao último dia do mês anterior
|
|
612
|
+
- **Selecionar mês**: Seleciona um mês específico
|
|
613
|
+
- **Período customizado**: Permite selecionar qualquer período
|
|
614
|
+
|
|
615
|
+
**Casos de uso:**
|
|
616
|
+
- **Dashboards**: Filtros rápidos de período
|
|
617
|
+
- **Relatórios**: Seleção de períodos de análise
|
|
618
|
+
- **Filtros**: Busca por intervalo de datas
|
|
619
|
+
- **Analytics**: Períodos pré-definidos para métricas
|
|
620
|
+
|
|
621
|
+
**Dicas de implementação:**
|
|
622
|
+
- Use presets para melhorar a UX
|
|
623
|
+
- Mantenha consistência com outros filtros
|
|
624
|
+
- Considere validação de períodos
|
|
625
|
+
`,
|
|
626
|
+
},
|
|
627
|
+
source: {
|
|
628
|
+
code: `
|
|
629
|
+
import React, { useState } from 'react';
|
|
630
|
+
import { VStack, Box, Text } from '@chakra-ui/react';
|
|
631
|
+
import { DatePickerField } from '../../../components/DatePicker/CustomDatePicker';
|
|
632
|
+
|
|
633
|
+
const AdvancedDatePicker = () => {
|
|
634
|
+
const [value, setValue] = useState<[string | null, string | null]>([null, null]);
|
|
635
|
+
|
|
636
|
+
return (
|
|
637
|
+
<DatePickerField
|
|
638
|
+
variant="advanced"
|
|
639
|
+
label="Período de análise"
|
|
640
|
+
placeholder="Selecione o período"
|
|
641
|
+
value={value}
|
|
642
|
+
onChange={(newValue) => {
|
|
643
|
+
setValue(newValue as [string | null, string | null]);
|
|
644
|
+
}}
|
|
645
|
+
/>
|
|
646
|
+
);
|
|
647
|
+
};
|
|
648
|
+
`,
|
|
649
|
+
language: "tsx",
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { CustomPagination } from "../../../../components/Pagination/CustomPagination";
|
|
3
|
+
declare const meta: Meta<typeof CustomPagination>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CustomPagination>;
|
|
6
|
+
/** 🎯 Default: Exemplo básico do CustomPagination */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
/** 🎨 Variations: Demonstração de diferentes variações */
|
|
9
|
+
export declare const Variations: Story;
|
|
10
|
+
/** 📊 States: Demonstração de diferentes estados */
|
|
11
|
+
export declare const States: Story;
|
|
12
|
+
/** 🔍 Edge Cases: Casos extremos e edge cases */
|
|
13
|
+
export declare const EdgeCases: Story;
|
|
14
|
+
/** ♿ Accessibility: Demonstração de recursos de acessibilidade */
|
|
15
|
+
export declare const Accessibility: Story;
|
|
16
|
+
/** 📋 Integração com Tabela: Exemplo prático */
|
|
17
|
+
export declare const WithTable: Story;
|