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,766 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// src/components/CustomRadioGroup/CustomRadioGroup.stories.tsx
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Stack } from "@chakra-ui/react";
|
|
5
|
+
import CustomRadioGroup from "../../../../components/CustomRadioGroup";
|
|
6
|
+
const options = [
|
|
7
|
+
{ value: "opcao1", label: "Opção 1" },
|
|
8
|
+
{ value: "opcao2", label: "Opção 2" },
|
|
9
|
+
{ value: "opcao3", label: "Opção 3" },
|
|
10
|
+
];
|
|
11
|
+
const meta = {
|
|
12
|
+
title: "Londrisoft/Components/Radio/Radio-Group",
|
|
13
|
+
component: CustomRadioGroup,
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (_jsx("div", { style: { maxWidth: 400, margin: "2rem auto" }, children: _jsx(Story, {}) })),
|
|
17
|
+
],
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: `
|
|
22
|
+
Grupo de radios customizado com:
|
|
23
|
+
- **label**, **helperText** e **error** em nível de grupo
|
|
24
|
+
- **fieldSize** (sm/md/lg)
|
|
25
|
+
- **direction** (row/column) e **spacing**
|
|
26
|
+
`,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
label: {
|
|
32
|
+
control: "text",
|
|
33
|
+
description: "Rótulo exibido acima do grupo de radios.",
|
|
34
|
+
defaultValue: "Escolha uma opção",
|
|
35
|
+
},
|
|
36
|
+
helperText: {
|
|
37
|
+
control: "text",
|
|
38
|
+
description: "Texto de ajuda exibido abaixo do grupo (se não houver erro).",
|
|
39
|
+
},
|
|
40
|
+
error: {
|
|
41
|
+
control: "text",
|
|
42
|
+
description: "Mensagem de erro exibida abaixo do grupo.",
|
|
43
|
+
},
|
|
44
|
+
options: {
|
|
45
|
+
control: "object",
|
|
46
|
+
description: "Array de opções com `value` e `label`.",
|
|
47
|
+
defaultValue: options,
|
|
48
|
+
},
|
|
49
|
+
fieldSize: {
|
|
50
|
+
control: "radio",
|
|
51
|
+
options: ["sm", "md", "lg"],
|
|
52
|
+
description: "Tamanho dos radios.",
|
|
53
|
+
defaultValue: "md",
|
|
54
|
+
},
|
|
55
|
+
direction: {
|
|
56
|
+
control: "radio",
|
|
57
|
+
options: ["column", "row"],
|
|
58
|
+
description: "Direção do Stack interno.",
|
|
59
|
+
defaultValue: "column",
|
|
60
|
+
},
|
|
61
|
+
spacing: {
|
|
62
|
+
control: { type: "number", min: 0, max: 10, step: 1 },
|
|
63
|
+
description: "Espaçamento entre itens do Stack.",
|
|
64
|
+
defaultValue: 4,
|
|
65
|
+
},
|
|
66
|
+
isDisabled: {
|
|
67
|
+
control: "boolean",
|
|
68
|
+
description: "Desabilita todos os radios do grupo.",
|
|
69
|
+
defaultValue: false,
|
|
70
|
+
},
|
|
71
|
+
defaultValue: {
|
|
72
|
+
control: "inline-radio",
|
|
73
|
+
options: options.map((o) => o.value),
|
|
74
|
+
description: "Valor inicial (uncontrolled).",
|
|
75
|
+
},
|
|
76
|
+
value: {
|
|
77
|
+
table: { disable: true },
|
|
78
|
+
description: "Valor selecionado (controlled).",
|
|
79
|
+
},
|
|
80
|
+
onChange: {
|
|
81
|
+
action: "onChange",
|
|
82
|
+
table: { disable: true },
|
|
83
|
+
description: "Callback disparado ao alterar seleção.",
|
|
84
|
+
},
|
|
85
|
+
colorScheme: {
|
|
86
|
+
control: "select",
|
|
87
|
+
options: [
|
|
88
|
+
"whiteAlpha",
|
|
89
|
+
"blackAlpha",
|
|
90
|
+
"gray",
|
|
91
|
+
"red",
|
|
92
|
+
"orange",
|
|
93
|
+
"yellow",
|
|
94
|
+
"green",
|
|
95
|
+
"teal",
|
|
96
|
+
"blue",
|
|
97
|
+
"cyan",
|
|
98
|
+
"purple",
|
|
99
|
+
"pink",
|
|
100
|
+
"linkedin",
|
|
101
|
+
"facebook",
|
|
102
|
+
"messenger",
|
|
103
|
+
"whatsapp",
|
|
104
|
+
"twitter",
|
|
105
|
+
"telegram",
|
|
106
|
+
"primary",
|
|
107
|
+
"secondary",
|
|
108
|
+
"success",
|
|
109
|
+
"warning",
|
|
110
|
+
"danger",
|
|
111
|
+
],
|
|
112
|
+
description: "Cor de destaque do Radio quando selecionado.",
|
|
113
|
+
defaultValue: "blue",
|
|
114
|
+
},
|
|
115
|
+
style: {
|
|
116
|
+
control: "object",
|
|
117
|
+
description: "Estilos customizados para cada Radio.",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
export default meta;
|
|
122
|
+
export const Controlled = {
|
|
123
|
+
render: (args) => {
|
|
124
|
+
var _a;
|
|
125
|
+
const [val, setVal] = useState((_a = args.defaultValue) !== null && _a !== void 0 ? _a : "");
|
|
126
|
+
return (_jsx(CustomRadioGroup, Object.assign({}, args, { value: val, onChange: (newVal) => setVal(newVal) })));
|
|
127
|
+
},
|
|
128
|
+
args: {
|
|
129
|
+
label: "Opção controlada",
|
|
130
|
+
helperText: "Clique para alternar",
|
|
131
|
+
options,
|
|
132
|
+
defaultValue: "opcao1",
|
|
133
|
+
},
|
|
134
|
+
parameters: {
|
|
135
|
+
docs: {
|
|
136
|
+
source: {
|
|
137
|
+
code: `
|
|
138
|
+
import React, { useState } from 'react';
|
|
139
|
+
import CustomRadioGroup, { RadioOption } from './CustomRadioGroup';
|
|
140
|
+
|
|
141
|
+
// Radio group controlado básico
|
|
142
|
+
const BasicControlledRadioGroup = () => {
|
|
143
|
+
const [value, setValue] = useState("opcao1");
|
|
144
|
+
|
|
145
|
+
const options: RadioOption[] = [
|
|
146
|
+
{ value: "opcao1", label: "Opção 1" },
|
|
147
|
+
{ value: "opcao2", label: "Opção 2" },
|
|
148
|
+
{ value: "opcao3", label: "Opção 3" },
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<CustomRadioGroup
|
|
153
|
+
label="Opção controlada"
|
|
154
|
+
helperText="Clique para alternar"
|
|
155
|
+
options={options}
|
|
156
|
+
value={value}
|
|
157
|
+
onChange={(newVal) => setValue(newVal)}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// Radio group com valores iniciais
|
|
163
|
+
const ControlledWithInitialValues = () => {
|
|
164
|
+
const [value, setValue] = useState("opcao2");
|
|
165
|
+
|
|
166
|
+
const options: RadioOption[] = [
|
|
167
|
+
{ value: "masculino", label: "Masculino" },
|
|
168
|
+
{ value: "feminino", label: "Feminino" },
|
|
169
|
+
{ value: "outro", label: "Outro" },
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<CustomRadioGroup
|
|
174
|
+
label="Gênero"
|
|
175
|
+
helperText="Selecione seu gênero"
|
|
176
|
+
options={options}
|
|
177
|
+
value={value}
|
|
178
|
+
onChange={(newVal) => setValue(newVal)}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// Radio group com validação
|
|
184
|
+
const ValidatedRadioGroup = () => {
|
|
185
|
+
const [value, setValue] = useState("");
|
|
186
|
+
const [error, setError] = useState("");
|
|
187
|
+
|
|
188
|
+
const options: RadioOption[] = [
|
|
189
|
+
{ value: "basico", label: "Plano Básico" },
|
|
190
|
+
{ value: "pro", label: "Plano Pro" },
|
|
191
|
+
{ value: "enterprise", label: "Plano Enterprise" },
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
const handleChange = (newVal: string) => {
|
|
195
|
+
setValue(newVal);
|
|
196
|
+
|
|
197
|
+
// Validação
|
|
198
|
+
if (!newVal) {
|
|
199
|
+
setError("Você deve selecionar um plano");
|
|
200
|
+
} else {
|
|
201
|
+
setError("");
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<CustomRadioGroup
|
|
207
|
+
label="Escolha seu plano"
|
|
208
|
+
helperText="Selecione um plano"
|
|
209
|
+
error={error}
|
|
210
|
+
options={options}
|
|
211
|
+
value={value}
|
|
212
|
+
onChange={handleChange}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Radio group para formulário
|
|
218
|
+
const FormRadioGroup = () => {
|
|
219
|
+
const [formData, setFormData] = useState({
|
|
220
|
+
plan: "",
|
|
221
|
+
region: "",
|
|
222
|
+
payment: ""
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const planOptions: RadioOption[] = [
|
|
226
|
+
{ value: "gratuito", label: "Gratuito" },
|
|
227
|
+
{ value: "basico", label: "Básico" },
|
|
228
|
+
{ value: "premium", label: "Premium" },
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
const regionOptions: RadioOption[] = [
|
|
232
|
+
{ value: "br", label: "Brasil" },
|
|
233
|
+
{ value: "us", label: "Estados Unidos" },
|
|
234
|
+
{ value: "eu", label: "Europa" },
|
|
235
|
+
];
|
|
236
|
+
|
|
237
|
+
const paymentOptions: RadioOption[] = [
|
|
238
|
+
{ value: "credito", label: "Cartão de Crédito" },
|
|
239
|
+
{ value: "pix", label: "PIX" },
|
|
240
|
+
{ value: "boleto", label: "Boleto" },
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
const handleChange = (field: string) => (newVal: string) => {
|
|
244
|
+
setFormData({
|
|
245
|
+
...formData,
|
|
246
|
+
[field]: newVal
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
252
|
+
<CustomRadioGroup
|
|
253
|
+
label="Plano"
|
|
254
|
+
helperText="Escolha um plano"
|
|
255
|
+
options={planOptions}
|
|
256
|
+
value={formData.plan}
|
|
257
|
+
onChange={handleChange('plan')}
|
|
258
|
+
/>
|
|
259
|
+
|
|
260
|
+
<CustomRadioGroup
|
|
261
|
+
label="Região"
|
|
262
|
+
helperText="Selecione a região do servidor"
|
|
263
|
+
options={regionOptions}
|
|
264
|
+
value={formData.region}
|
|
265
|
+
onChange={handleChange('region')}
|
|
266
|
+
/>
|
|
267
|
+
|
|
268
|
+
<CustomRadioGroup
|
|
269
|
+
label="Forma de Pagamento"
|
|
270
|
+
helperText="Escolha uma forma de pagamento"
|
|
271
|
+
options={paymentOptions}
|
|
272
|
+
value={formData.payment}
|
|
273
|
+
onChange={handleChange('payment')}
|
|
274
|
+
/>
|
|
275
|
+
</div>
|
|
276
|
+
);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// Radio group com layout horizontal
|
|
280
|
+
const HorizontalRadioGroup = () => {
|
|
281
|
+
const [value, setValue] = useState("");
|
|
282
|
+
|
|
283
|
+
const options: RadioOption[] = [
|
|
284
|
+
{ value: "pequeno", label: "Pequeno" },
|
|
285
|
+
{ value: "medio", label: "Médio" },
|
|
286
|
+
{ value: "grande", label: "Grande" },
|
|
287
|
+
];
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
<CustomRadioGroup
|
|
291
|
+
label="Tamanho"
|
|
292
|
+
helperText="Escolha um tamanho"
|
|
293
|
+
options={options}
|
|
294
|
+
direction="row"
|
|
295
|
+
spacing={6}
|
|
296
|
+
value={value}
|
|
297
|
+
onChange={(newVal) => setValue(newVal)}
|
|
298
|
+
/>
|
|
299
|
+
);
|
|
300
|
+
};
|
|
301
|
+
`,
|
|
302
|
+
language: "tsx",
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Exemplo com helperText (sem erro).
|
|
309
|
+
*/
|
|
310
|
+
export const WithHelperText = {
|
|
311
|
+
args: {
|
|
312
|
+
label: "Com ajuda",
|
|
313
|
+
helperText: "Esse texto some se houver erro",
|
|
314
|
+
options,
|
|
315
|
+
},
|
|
316
|
+
parameters: {
|
|
317
|
+
docs: {
|
|
318
|
+
source: {
|
|
319
|
+
code: `
|
|
320
|
+
import React from 'react';
|
|
321
|
+
import CustomRadioGroup, { RadioOption } from './CustomRadioGroup';
|
|
322
|
+
|
|
323
|
+
// Radio group com texto auxiliar
|
|
324
|
+
const RadioGroupWithHelperText = () => {
|
|
325
|
+
const options: RadioOption[] = [
|
|
326
|
+
{ value: "opcao1", label: "Opção 1" },
|
|
327
|
+
{ value: "opcao2", label: "Opção 2" },
|
|
328
|
+
{ value: "opcao3", label: "Opção 3" },
|
|
329
|
+
];
|
|
330
|
+
|
|
331
|
+
return (
|
|
332
|
+
<CustomRadioGroup
|
|
333
|
+
label="Com ajuda"
|
|
334
|
+
helperText="Esse texto some se houver erro"
|
|
335
|
+
options={options}
|
|
336
|
+
/>
|
|
337
|
+
);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// Radio groups com diferentes tipos de texto auxiliar
|
|
341
|
+
const RadioGroupsWithDifferentHelperTexts = () => {
|
|
342
|
+
const techOptions: RadioOption[] = [
|
|
343
|
+
{ value: "js", label: "JavaScript" },
|
|
344
|
+
{ value: "ts", label: "TypeScript" },
|
|
345
|
+
{ value: "react", label: "React" },
|
|
346
|
+
];
|
|
347
|
+
|
|
348
|
+
const notificationOptions: RadioOption[] = [
|
|
349
|
+
{ value: "email", label: "Email" },
|
|
350
|
+
{ value: "sms", label: "SMS" },
|
|
351
|
+
{ value: "push", label: "Push" },
|
|
352
|
+
];
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
356
|
+
<CustomRadioGroup
|
|
357
|
+
label="Tecnologias"
|
|
358
|
+
helperText="Selecione as tecnologias que você conhece"
|
|
359
|
+
options={techOptions}
|
|
360
|
+
/>
|
|
361
|
+
|
|
362
|
+
<CustomRadioGroup
|
|
363
|
+
label="Notificações"
|
|
364
|
+
helperText="Como você gostaria de receber notificações?"
|
|
365
|
+
options={notificationOptions}
|
|
366
|
+
/>
|
|
367
|
+
</div>
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// Radio group com texto auxiliar informativo
|
|
372
|
+
const RadioGroupWithInformativeHelperText = () => {
|
|
373
|
+
const policyOptions: RadioOption[] = [
|
|
374
|
+
{ value: "terms", label: "Termos de Uso" },
|
|
375
|
+
{ value: "privacy", label: "Política de Privacidade" },
|
|
376
|
+
{ value: "cookies", label: "Cookies" },
|
|
377
|
+
];
|
|
378
|
+
|
|
379
|
+
return (
|
|
380
|
+
<CustomRadioGroup
|
|
381
|
+
label="Políticas"
|
|
382
|
+
helperText="Leia e aceite as políticas necessárias para continuar"
|
|
383
|
+
options={policyOptions}
|
|
384
|
+
/>
|
|
385
|
+
);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// Radio group com texto auxiliar condicional
|
|
389
|
+
const RadioGroupWithConditionalHelperText = () => {
|
|
390
|
+
const advancedOptions: RadioOption[] = [
|
|
391
|
+
{ value: "advanced", label: "Configurações Avançadas" },
|
|
392
|
+
{ value: "developer", label: "Modo Desenvolvedor" },
|
|
393
|
+
{ value: "logs", label: "Logs Detalhados" },
|
|
394
|
+
];
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<CustomRadioGroup
|
|
398
|
+
label="Configurações"
|
|
399
|
+
helperText="Recomendado apenas para usuários experientes"
|
|
400
|
+
options={advancedOptions}
|
|
401
|
+
/>
|
|
402
|
+
);
|
|
403
|
+
};
|
|
404
|
+
`,
|
|
405
|
+
language: "tsx",
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Exemplo exibindo mensagem de erro (helperText é ignorado).
|
|
412
|
+
*/
|
|
413
|
+
export const WithError = {
|
|
414
|
+
args: {
|
|
415
|
+
label: "Com erro",
|
|
416
|
+
helperText: "Não aparece quando há erro",
|
|
417
|
+
error: "Selecione uma opção",
|
|
418
|
+
options,
|
|
419
|
+
},
|
|
420
|
+
parameters: {
|
|
421
|
+
docs: {
|
|
422
|
+
source: {
|
|
423
|
+
code: `
|
|
424
|
+
import React from 'react';
|
|
425
|
+
import CustomRadioGroup, { RadioOption } from './CustomRadioGroup';
|
|
426
|
+
|
|
427
|
+
// Radio group com erro
|
|
428
|
+
const RadioGroupWithError = () => {
|
|
429
|
+
const options: RadioOption[] = [
|
|
430
|
+
{ value: "opcao1", label: "Opção 1" },
|
|
431
|
+
{ value: "opcao2", label: "Opção 2" },
|
|
432
|
+
{ value: "opcao3", label: "Opção 3" },
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
return (
|
|
436
|
+
<CustomRadioGroup
|
|
437
|
+
label="Com erro"
|
|
438
|
+
helperText="Não aparece quando há erro"
|
|
439
|
+
error="Selecione uma opção"
|
|
440
|
+
options={options}
|
|
441
|
+
/>
|
|
442
|
+
);
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
// Radio groups com diferentes tipos de erro
|
|
446
|
+
const RadioGroupsWithDifferentErrors = () => {
|
|
447
|
+
const policyOptions: RadioOption[] = [
|
|
448
|
+
{ value: "terms", label: "Termos de Uso" },
|
|
449
|
+
{ value: "privacy", label: "Política de Privacidade" },
|
|
450
|
+
{ value: "cookies", label: "Cookies" },
|
|
451
|
+
];
|
|
452
|
+
|
|
453
|
+
const techOptions: RadioOption[] = [
|
|
454
|
+
{ value: "js", label: "JavaScript" },
|
|
455
|
+
{ value: "ts", label: "TypeScript" },
|
|
456
|
+
{ value: "react", label: "React" },
|
|
457
|
+
];
|
|
458
|
+
|
|
459
|
+
return (
|
|
460
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
461
|
+
<CustomRadioGroup
|
|
462
|
+
label="Políticas"
|
|
463
|
+
error="Você deve aceitar pelo menos uma política"
|
|
464
|
+
options={policyOptions}
|
|
465
|
+
/>
|
|
466
|
+
|
|
467
|
+
<CustomRadioGroup
|
|
468
|
+
label="Tecnologias"
|
|
469
|
+
error="Selecione pelo menos uma tecnologia"
|
|
470
|
+
options={techOptions}
|
|
471
|
+
/>
|
|
472
|
+
</div>
|
|
473
|
+
);
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// Radio group com validação de erro
|
|
477
|
+
const ValidationErrorRadioGroup = () => {
|
|
478
|
+
const requiredOptions: RadioOption[] = [
|
|
479
|
+
{ value: "aceitar", label: "Aceitar Termos" },
|
|
480
|
+
{ value: "aceitar_privacy", label: "Aceitar Privacidade" },
|
|
481
|
+
{ value: "aceitar_cookies", label: "Aceitar Cookies" },
|
|
482
|
+
];
|
|
483
|
+
|
|
484
|
+
return (
|
|
485
|
+
<CustomRadioGroup
|
|
486
|
+
label="Aceitar políticas"
|
|
487
|
+
error="É necessário aceitar pelo menos uma política para continuar"
|
|
488
|
+
helperText="Este texto não aparece quando há erro"
|
|
489
|
+
options={requiredOptions}
|
|
490
|
+
/>
|
|
491
|
+
);
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// Radio group com erro condicional
|
|
495
|
+
const ConditionalErrorRadioGroup = () => {
|
|
496
|
+
const advancedOptions: RadioOption[] = [
|
|
497
|
+
{ value: "advanced", label: "Configurações Avançadas" },
|
|
498
|
+
{ value: "developer", label: "Modo Desenvolvedor" },
|
|
499
|
+
{ value: "logs", label: "Logs Detalhados" },
|
|
500
|
+
];
|
|
501
|
+
|
|
502
|
+
return (
|
|
503
|
+
<CustomRadioGroup
|
|
504
|
+
label="Configurações Avançadas"
|
|
505
|
+
error="Você deve aceitar os riscos das configurações avançadas"
|
|
506
|
+
options={advancedOptions}
|
|
507
|
+
/>
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
`,
|
|
511
|
+
language: "tsx",
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
/**
|
|
517
|
+
* Exemplo de grupo desabilitado.
|
|
518
|
+
*/
|
|
519
|
+
export const Disabled = {
|
|
520
|
+
args: {
|
|
521
|
+
label: "Desabilitado",
|
|
522
|
+
options,
|
|
523
|
+
isDisabled: true,
|
|
524
|
+
},
|
|
525
|
+
parameters: {
|
|
526
|
+
docs: {
|
|
527
|
+
source: {
|
|
528
|
+
code: `
|
|
529
|
+
import React from 'react';
|
|
530
|
+
import CustomRadioGroup, { RadioOption } from './CustomRadioGroup';
|
|
531
|
+
|
|
532
|
+
// Radio group desabilitado básico
|
|
533
|
+
const BasicDisabledRadioGroup = () => {
|
|
534
|
+
const options: RadioOption[] = [
|
|
535
|
+
{ value: "opcao1", label: "Opção 1" },
|
|
536
|
+
{ value: "opcao2", label: "Opção 2" },
|
|
537
|
+
{ value: "opcao3", label: "Opção 3" },
|
|
538
|
+
];
|
|
539
|
+
|
|
540
|
+
return (
|
|
541
|
+
<CustomRadioGroup
|
|
542
|
+
label="Desabilitado"
|
|
543
|
+
options={options}
|
|
544
|
+
isDisabled={true}
|
|
545
|
+
/>
|
|
546
|
+
);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// Radio groups desabilitados com diferentes estilos
|
|
550
|
+
const DisabledRadioGroupsWithDifferentStyles = () => {
|
|
551
|
+
const systemOptions: RadioOption[] = [
|
|
552
|
+
{ value: "backup", label: "Backup Automático" },
|
|
553
|
+
{ value: "logs", label: "Logs Detalhados" },
|
|
554
|
+
{ value: "safe", label: "Modo Seguro" },
|
|
555
|
+
];
|
|
556
|
+
|
|
557
|
+
const userOptions: RadioOption[] = [
|
|
558
|
+
{ value: "notifications", label: "Notificações" },
|
|
559
|
+
{ value: "dark", label: "Modo Escuro" },
|
|
560
|
+
{ value: "autosave", label: "Auto-save" },
|
|
561
|
+
];
|
|
562
|
+
|
|
563
|
+
return (
|
|
564
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
565
|
+
<CustomRadioGroup
|
|
566
|
+
label="Configurações do Sistema"
|
|
567
|
+
options={systemOptions}
|
|
568
|
+
isDisabled={true}
|
|
569
|
+
/>
|
|
570
|
+
|
|
571
|
+
<CustomRadioGroup
|
|
572
|
+
label="Preferências do Usuário"
|
|
573
|
+
options={userOptions}
|
|
574
|
+
isDisabled={true}
|
|
575
|
+
/>
|
|
576
|
+
</div>
|
|
577
|
+
);
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// Radio group desabilitado com valores
|
|
581
|
+
const DisabledWithValues = () => {
|
|
582
|
+
const options: RadioOption[] = [
|
|
583
|
+
{ value: "config1", label: "Configuração 1" },
|
|
584
|
+
{ value: "config2", label: "Configuração 2" },
|
|
585
|
+
{ value: "config3", label: "Configuração 3" },
|
|
586
|
+
];
|
|
587
|
+
|
|
588
|
+
return (
|
|
589
|
+
<CustomRadioGroup
|
|
590
|
+
label="Configurações do Sistema"
|
|
591
|
+
options={options}
|
|
592
|
+
isDisabled={true}
|
|
593
|
+
defaultValue="config1"
|
|
594
|
+
/>
|
|
595
|
+
);
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
// Radio group desabilitado com erro
|
|
599
|
+
const DisabledWithError = () => {
|
|
600
|
+
const options: RadioOption[] = [
|
|
601
|
+
{ value: "blocked1", label: "Configuração Bloqueada 1" },
|
|
602
|
+
{ value: "blocked2", label: "Configuração Bloqueada 2" },
|
|
603
|
+
{ value: "blocked3", label: "Configuração Bloqueada 3" },
|
|
604
|
+
];
|
|
605
|
+
|
|
606
|
+
return (
|
|
607
|
+
<CustomRadioGroup
|
|
608
|
+
label="Configurações Bloqueadas"
|
|
609
|
+
options={options}
|
|
610
|
+
isDisabled={true}
|
|
611
|
+
error="Estas configurações não podem ser alteradas no momento"
|
|
612
|
+
/>
|
|
613
|
+
);
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
// Radio group desabilitado para configurações
|
|
617
|
+
const SettingsDisabledRadioGroup = () => {
|
|
618
|
+
const adminOptions: RadioOption[] = [
|
|
619
|
+
{ value: "admin", label: "Modo Administrador" },
|
|
620
|
+
{ value: "root", label: "Acesso Root" },
|
|
621
|
+
{ value: "system_logs", label: "Logs de Sistema" },
|
|
622
|
+
];
|
|
623
|
+
|
|
624
|
+
return (
|
|
625
|
+
<CustomRadioGroup
|
|
626
|
+
label="Configurações Administrativas"
|
|
627
|
+
helperText="Estas configurações são gerenciadas pelo sistema"
|
|
628
|
+
options={adminOptions}
|
|
629
|
+
isDisabled={true}
|
|
630
|
+
defaultValue="admin"
|
|
631
|
+
/>
|
|
632
|
+
);
|
|
633
|
+
};
|
|
634
|
+
`,
|
|
635
|
+
language: "tsx",
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* Demonstração de tamanhos diferentes.
|
|
642
|
+
*/
|
|
643
|
+
export const FieldSizes = {
|
|
644
|
+
render: () => (_jsxs(Stack, { spacing: 6, children: [_jsx(CustomRadioGroup, { label: "Size sm", options: options, defaultValue: "opcao1", fieldSize: "sm" }), _jsx(CustomRadioGroup, { label: "Size md", options: options, defaultValue: "opcao2", fieldSize: "md" }), _jsx(CustomRadioGroup, { label: "Size lg", options: options, defaultValue: "opcao3", fieldSize: "lg" })] })),
|
|
645
|
+
parameters: {
|
|
646
|
+
docs: {
|
|
647
|
+
source: {
|
|
648
|
+
code: `
|
|
649
|
+
import React from 'react';
|
|
650
|
+
import { Stack } from '@chakra-ui/react';
|
|
651
|
+
import CustomRadioGroup, { RadioOption } from './CustomRadioGroup';
|
|
652
|
+
|
|
653
|
+
// Demonstração de diferentes tamanhos
|
|
654
|
+
const FieldSizesDemo = () => {
|
|
655
|
+
const options: RadioOption[] = [
|
|
656
|
+
{ value: "opcao1", label: "Opção 1" },
|
|
657
|
+
{ value: "opcao2", label: "Opção 2" },
|
|
658
|
+
{ value: "opcao3", label: "Opção 3" },
|
|
659
|
+
];
|
|
660
|
+
|
|
661
|
+
return (
|
|
662
|
+
<Stack spacing={6}>
|
|
663
|
+
<CustomRadioGroup
|
|
664
|
+
label="Size sm"
|
|
665
|
+
options={options}
|
|
666
|
+
defaultValue="opcao1"
|
|
667
|
+
fieldSize="sm"
|
|
668
|
+
/>
|
|
669
|
+
<CustomRadioGroup
|
|
670
|
+
label="Size md"
|
|
671
|
+
options={options}
|
|
672
|
+
defaultValue="opcao2"
|
|
673
|
+
fieldSize="md"
|
|
674
|
+
/>
|
|
675
|
+
<CustomRadioGroup
|
|
676
|
+
label="Size lg"
|
|
677
|
+
options={options}
|
|
678
|
+
defaultValue="opcao3"
|
|
679
|
+
fieldSize="lg"
|
|
680
|
+
/>
|
|
681
|
+
</Stack>
|
|
682
|
+
);
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// Radio groups com diferentes tamanhos
|
|
686
|
+
const MultiSizeRadioGroups = () => {
|
|
687
|
+
const smallOptions: RadioOption[] = [
|
|
688
|
+
{ value: "small1", label: "Pequeno 1" },
|
|
689
|
+
{ value: "small2", label: "Pequeno 2" },
|
|
690
|
+
];
|
|
691
|
+
|
|
692
|
+
const mediumOptions: RadioOption[] = [
|
|
693
|
+
{ value: "medium1", label: "Médio 1" },
|
|
694
|
+
{ value: "medium2", label: "Médio 2" },
|
|
695
|
+
{ value: "medium3", label: "Médio 3" },
|
|
696
|
+
];
|
|
697
|
+
|
|
698
|
+
const largeOptions: RadioOption[] = [
|
|
699
|
+
{ value: "large1", label: "Grande 1" },
|
|
700
|
+
{ value: "large2", label: "Grande 2" },
|
|
701
|
+
{ value: "large3", label: "Grande 3" },
|
|
702
|
+
{ value: "large4", label: "Grande 4" },
|
|
703
|
+
];
|
|
704
|
+
|
|
705
|
+
return (
|
|
706
|
+
<Stack spacing={6}>
|
|
707
|
+
<CustomRadioGroup
|
|
708
|
+
label="Opções Pequenas"
|
|
709
|
+
options={smallOptions}
|
|
710
|
+
fieldSize="sm"
|
|
711
|
+
/>
|
|
712
|
+
|
|
713
|
+
<CustomRadioGroup
|
|
714
|
+
label="Opções Médias"
|
|
715
|
+
options={mediumOptions}
|
|
716
|
+
fieldSize="md"
|
|
717
|
+
/>
|
|
718
|
+
|
|
719
|
+
<CustomRadioGroup
|
|
720
|
+
label="Opções Grandes"
|
|
721
|
+
options={largeOptions}
|
|
722
|
+
fieldSize="lg"
|
|
723
|
+
/>
|
|
724
|
+
</Stack>
|
|
725
|
+
);
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// Radio groups responsivos
|
|
729
|
+
const ResponsiveRadioGroups = () => {
|
|
730
|
+
const techOptions: RadioOption[] = [
|
|
731
|
+
{ value: "js", label: "JavaScript" },
|
|
732
|
+
{ value: "ts", label: "TypeScript" },
|
|
733
|
+
{ value: "react", label: "React" },
|
|
734
|
+
];
|
|
735
|
+
|
|
736
|
+
return (
|
|
737
|
+
<Stack spacing={6}>
|
|
738
|
+
<CustomRadioGroup
|
|
739
|
+
label="Tecnologias (Pequeno)"
|
|
740
|
+
options={techOptions}
|
|
741
|
+
fieldSize="sm"
|
|
742
|
+
defaultValue="js"
|
|
743
|
+
/>
|
|
744
|
+
|
|
745
|
+
<CustomRadioGroup
|
|
746
|
+
label="Tecnologias (Médio)"
|
|
747
|
+
options={techOptions}
|
|
748
|
+
fieldSize="md"
|
|
749
|
+
defaultValue="ts"
|
|
750
|
+
/>
|
|
751
|
+
|
|
752
|
+
<CustomRadioGroup
|
|
753
|
+
label="Tecnologias (Grande)"
|
|
754
|
+
options={techOptions}
|
|
755
|
+
fieldSize="lg"
|
|
756
|
+
defaultValue="react"
|
|
757
|
+
/>
|
|
758
|
+
</Stack>
|
|
759
|
+
);
|
|
760
|
+
};
|
|
761
|
+
`,
|
|
762
|
+
language: "tsx",
|
|
763
|
+
},
|
|
764
|
+
},
|
|
765
|
+
},
|
|
766
|
+
};
|