@ftdata/ui 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/assets/fonts/Inter-Italic.js +2 -0
  2. package/dist/assets/fonts/Inter.js +2 -0
  3. package/dist/components/DoubleList/DoubleList.stories.d.ts +2 -2
  4. package/dist/components/DoubleList/DoubleList.stories.js +43 -43
  5. package/dist/components/DoubleList/Row/index.d.ts +4 -0
  6. package/dist/components/DoubleList/Row/index.js +12 -0
  7. package/dist/components/DoubleList/Row/style.d.ts +1 -0
  8. package/dist/components/DoubleList/Row/style.js +31 -0
  9. package/dist/components/DoubleList/index.js +27 -35
  10. package/dist/components/DoubleList/style.d.ts +0 -1
  11. package/dist/components/DoubleList/style.js +2 -31
  12. package/dist/components/Menu/Menu.stories.d.ts +6 -0
  13. package/dist/components/Menu/Menu.stories.js +116 -0
  14. package/dist/components/Menu/index.js +29 -14
  15. package/dist/components/Menu/styles.d.ts +1 -0
  16. package/dist/components/Menu/styles.js +44 -28
  17. package/dist/components/MultiSelect/MultiSelectList/Row/index.d.ts +7 -0
  18. package/dist/components/MultiSelect/MultiSelectList/Row/index.js +26 -0
  19. package/dist/components/MultiSelect/MultiSelectList/Row/style.d.ts +6 -0
  20. package/dist/components/MultiSelect/MultiSelectList/Row/style.js +48 -0
  21. package/dist/components/MultiSelect/MultiSelectList/index.d.ts +4 -3
  22. package/dist/components/MultiSelect/MultiSelectList/index.js +51 -41
  23. package/dist/components/MultiSelect/MultiSelectList/style.d.ts +0 -1
  24. package/dist/components/MultiSelect/MultiSelectList/style.js +2 -31
  25. package/dist/components/MultiSelect/helpers/addOption.d.ts +5 -0
  26. package/dist/components/MultiSelect/helpers/addOption.js +14 -0
  27. package/dist/components/MultiSelect/helpers/computeUnselected.d.ts +2 -0
  28. package/dist/components/MultiSelect/helpers/computeUnselected.js +2 -0
  29. package/dist/components/MultiSelect/helpers/feedbackText.d.ts +5 -0
  30. package/dist/components/MultiSelect/helpers/feedbackText.js +30 -0
  31. package/dist/components/MultiSelect/helpers/filterOptions.d.ts +2 -0
  32. package/dist/components/MultiSelect/helpers/filterOptions.js +5 -0
  33. package/dist/components/MultiSelect/helpers/removeOptions.d.ts +5 -0
  34. package/dist/components/MultiSelect/helpers/removeOptions.js +9 -0
  35. package/dist/components/MultiSelect/index.d.ts +29 -14
  36. package/dist/components/MultiSelect/index.js +149 -215
  37. package/dist/components/MultiSelect/styles.d.ts +6 -5
  38. package/dist/components/MultiSelect/styles.js +20 -66
  39. package/dist/components/Select/List/Row/index.d.ts +11 -0
  40. package/dist/components/Select/List/Row/index.js +29 -0
  41. package/dist/components/{CustomSelect/CustomSelectList → Select/List/Row}/style.d.ts +0 -2
  42. package/dist/components/{CustomSelect/CustomSelectList → Select/List/Row}/style.js +1 -54
  43. package/dist/components/Select/List/index.d.ts +12 -0
  44. package/dist/components/Select/List/index.js +63 -0
  45. package/dist/components/Select/List/style.d.ts +2 -0
  46. package/dist/components/Select/List/style.js +56 -0
  47. package/dist/components/Select/index.d.ts +34 -0
  48. package/dist/components/{CustomSelect → Select}/index.js +11 -9
  49. package/dist/components/{CustomSelect → Select}/styles.d.ts +2 -2
  50. package/dist/components/{CustomSelect → Select}/styles.js +6 -8
  51. package/dist/components/fields/components/HelpText/index.d.ts +8 -0
  52. package/dist/components/fields/components/HelpText/index.js +35 -0
  53. package/dist/components/fields/components/HelpText/modifiers/colors.d.ts +4 -0
  54. package/dist/components/fields/components/HelpText/modifiers/colors.js +9 -0
  55. package/dist/components/fields/components/HelpText/styles.d.ts +2 -0
  56. package/dist/components/fields/components/HelpText/styles.js +19 -0
  57. package/dist/components/fields/components/Label/index.d.ts +8 -0
  58. package/dist/components/fields/components/Label/index.js +22 -0
  59. package/dist/components/fields/components/Label/styles.d.ts +5 -0
  60. package/dist/components/fields/components/Label/styles.js +28 -0
  61. package/dist/components/fields/components/RotateButton/index.d.ts +6 -0
  62. package/dist/components/fields/components/RotateButton/index.js +13 -0
  63. package/dist/components/fields/components/RotateButton/styles.d.ts +5 -0
  64. package/dist/components/fields/components/RotateButton/styles.js +10 -0
  65. package/dist/components/fields/helpers/getFeedbackType.d.ts +2 -0
  66. package/dist/components/fields/helpers/getFeedbackType.js +11 -0
  67. package/dist/components/fields/modifiers/color_modifiers.d.ts +2 -0
  68. package/dist/components/fields/modifiers/color_modifiers.js +7 -0
  69. package/dist/components/fields/modifiers/inputColorModifier.d.ts +2 -0
  70. package/dist/components/fields/modifiers/inputColorModifier.js +14 -0
  71. package/dist/components/fields/modifiers/selectColorModifier.d.ts +2 -0
  72. package/dist/components/fields/modifiers/selectColorModifier.js +10 -0
  73. package/dist/index.d.ts +2 -2
  74. package/dist/index.js +2 -2
  75. package/dist/static/font/Inter-Italic.ttf +0 -0
  76. package/dist/static/font/Inter.ttf +0 -0
  77. package/dist/style/base.css +11 -4
  78. package/dist/types/feedback.d.ts +1 -0
  79. package/package.json +2 -2
  80. package/dist/assets/fonts/Inter-Regular.js +0 -2
  81. package/dist/components/CustomSelect/CustomSelect.stories.d.ts +0 -73
  82. package/dist/components/CustomSelect/CustomSelect.stories.js +0 -477
  83. package/dist/components/CustomSelect/CustomSelectList/index.d.ts +0 -10
  84. package/dist/components/CustomSelect/CustomSelectList/index.js +0 -66
  85. package/dist/components/CustomSelect/index.d.ts +0 -30
  86. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -61
  87. package/dist/components/MultiSelect/MultiSelect.stories.js +0 -336
  88. package/dist/static/font/Inter-Regular.ttf +0 -0
  89. /package/dist/components/MultiSelect/{calcTextSize.d.ts → helpers/calcTextSize.d.ts} +0 -0
  90. /package/dist/components/MultiSelect/{calcTextSize.js → helpers/calcTextSize.js} +0 -0
@@ -1,66 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { FixedSizeList } from "react-window";
3
- import { LoadingContainer, OptionContainer, SelectDropdown } from "./style.js";
4
- import Loading from "../../Loading/Loading/index.js";
5
- import { TooltipWrapper } from "../../TooltipWrapper/index.js";
6
- const renderRow = ({ data, index, style, onClickOption, selectedOption, showTooltip, hideTooltip, handleCustomAction })=>{
7
- const option = data[index];
8
- const isSelected = selectedOption ? option.value === selectedOption.value : false;
9
- const handleShowTooltip = (event)=>{
10
- const target = event.currentTarget.querySelector("span");
11
- if (target && target.scrollWidth > target.clientWidth) return void showTooltip(event, option.label);
12
- };
13
- const handleClick = (event)=>{
14
- if (option.action) return void handleCustomAction(option.action);
15
- if (onClickOption) onClickOption(event, option);
16
- };
17
- return /*#__PURE__*/ jsxs(OptionContainer, {
18
- style: style,
19
- isSelected: isSelected,
20
- onMouseEnter: handleShowTooltip,
21
- onMouseLeave: hideTooltip,
22
- onClick: handleClick,
23
- className: option.action ? "action" : "",
24
- children: [
25
- /*#__PURE__*/ jsx("span", {
26
- children: option.label
27
- }),
28
- option.chip || null
29
- ]
30
- });
31
- };
32
- const CustomSelectList = ({ options, onClickOption, selectedOption, isLoading, handleCustomAction })=>{
33
- const OPTION_SIZE = 36;
34
- const optionLength = options.length;
35
- const height = OPTION_SIZE * (0 === optionLength ? 1 : optionLength >= 7 ? 7 : optionLength);
36
- return /*#__PURE__*/ jsx(SelectDropdown, {
37
- children: isLoading ? /*#__PURE__*/ jsx(LoadingContainer, {
38
- children: /*#__PURE__*/ jsx(Loading, {
39
- size: "lg",
40
- variant: "light"
41
- })
42
- }) : /*#__PURE__*/ jsx(TooltipWrapper, {
43
- spacing: 18,
44
- children: ({ showTooltip, hideTooltip })=>/*#__PURE__*/ jsx(FixedSizeList, {
45
- itemCount: options.length,
46
- itemData: options,
47
- itemSize: 36,
48
- height: height,
49
- width: "100%",
50
- itemKey: (index)=>options[index].value || index,
51
- children: ({ index, style, data })=>renderRow({
52
- data,
53
- index,
54
- style,
55
- onClickOption,
56
- selectedOption,
57
- showTooltip,
58
- hideTooltip,
59
- handleCustomAction
60
- })
61
- })
62
- })
63
- });
64
- };
65
- const CustomSelect_CustomSelectList = CustomSelectList;
66
- export { CustomSelect_CustomSelectList as default };
@@ -1,30 +0,0 @@
1
- import React, { InputHTMLAttributes, JSX } from "react";
2
- export interface ICustomSelectOption {
3
- label: string;
4
- value: string;
5
- chip?: JSX.Element;
6
- action?: () => void;
7
- }
8
- export interface IAction {
9
- label: string;
10
- action: () => void;
11
- }
12
- export interface CustomSelectProps extends InputHTMLAttributes<HTMLInputElement> {
13
- t: (key: string) => string;
14
- helpText?: string;
15
- isError?: boolean;
16
- isSuccess?: boolean;
17
- label?: string;
18
- isRequired?: boolean;
19
- name?: string;
20
- options: ICustomSelectOption[] | [];
21
- placeholder?: string;
22
- search?: (query: string) => void;
23
- isLoading?: boolean;
24
- icon?: JSX.Element;
25
- variation?: "default" | "searchable";
26
- selected: ICustomSelectOption | null;
27
- setSelected: React.Dispatch<React.SetStateAction<ICustomSelectOption | null>>;
28
- }
29
- export default function CustomSelect({ helpText, isError, isSuccess, label, name, isRequired, options, placeholder, icon, isLoading, search, t, variation, selected, setSelected, ...rest }: CustomSelectProps): import("react/jsx-runtime").JSX.Element;
30
- export declare const normalizeOptions: (options: ICustomSelectOption[]) => ICustomSelectOption[];
@@ -1,61 +0,0 @@
1
- import { Meta, StoryObj } from "@storybook/react";
2
- import MultiSelect from ".";
3
- /**
4
- * O componente MultiSelect é usado para selecionar múltiplas opções de uma lista.
5
- * Ele herda todos atributos de um HTML input.
6
- */
7
- declare const meta: Meta<typeof MultiSelect>;
8
- export default meta;
9
- type Story = StoryObj<typeof meta>;
10
- /**
11
- * Variação padrão do MultiSelect quando apenas as propriedades obrigatórias são fornecidas.
12
- */
13
- export declare const Default: Story;
14
- /**
15
- * Variação do MultiSelect com label.
16
- */
17
- export declare const Label: Story;
18
- /**
19
- * Variação do MultiSelect com com a opção de selecionar todos.
20
- */
21
- export declare const SelectAll: Story;
22
- /**
23
- * Variação do MultiSelect com valor de seleção máxima.
24
- */
25
- export declare const MaxItems: Story;
26
- /**
27
- * Variação do MultiSelect com quantidade grande e opções.
28
- */
29
- export declare const ManyOptions: Story;
30
- /**
31
- * Variação do MultiSelect quando é opcional.
32
- */
33
- export declare const Optional: Story;
34
- /**
35
- * Variação do MultiSelect quando é obrigatório.
36
- */
37
- export declare const Required: Story;
38
- /**
39
- * Variação do MultiSelect com texto de ajuda para auxiliar o usuário.
40
- */
41
- export declare const HelpText: Story;
42
- /**
43
- * Variação do MultiSelect quando está carreagando seus dados.
44
- */
45
- export declare const Loading: Story;
46
- /**
47
- * Variação do MultiSelect com feedback de sucesso.
48
- */
49
- export declare const Success: Story;
50
- /**
51
- * Variação do MultiSelect com feedback de erro.
52
- */
53
- export declare const Error: Story;
54
- /**
55
- * Variação do MultiSelect usando um valor definido
56
- */
57
- export declare const Value: Story;
58
- /**
59
- * Variação do MultiSelect com o change Items controlando os selecionados.
60
- */
61
- export declare const onChangeItems: Story;
@@ -1,336 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import index from "./index.js";
4
- const meta = {
5
- title: "DESIGN COMPONENTS/MultiSelect",
6
- component: index,
7
- tags: [
8
- "autodocs"
9
- ],
10
- parameters: {
11
- layout: "centered"
12
- },
13
- decorators: [
14
- (Story)=>/*#__PURE__*/ jsx("div", {
15
- style: {
16
- width: "402px",
17
- height: "402px",
18
- display: "flex"
19
- },
20
- children: /*#__PURE__*/ jsx(Story, {})
21
- })
22
- ],
23
- argTypes: {
24
- translation: {
25
- description: "Recebe a fun\xe7\xe3o de tradu\xe7\xe3o do i18n"
26
- },
27
- placeholder: {
28
- description: "Recebe o placeholder do input."
29
- },
30
- name: {
31
- description: "Recebe a propriedade name para a label e para o input."
32
- },
33
- options: {
34
- description: "Recebe as op\xe7\xf5es que ir\xe3o aparecer na listagem.",
35
- table: {
36
- type: {
37
- summary: "IMultiSelectOption[] ({ value: string, label: string }[])"
38
- }
39
- }
40
- },
41
- onChangeItems: {
42
- description: "Recebe uma fun\xe7\xe3o para controlar o estado de op\xe7\xf5es selecionadas quando elas mudarem."
43
- },
44
- optional: {
45
- description: "Recebe um texto descrevendo que \xe9 opcional."
46
- },
47
- required: {
48
- description: "Define se esse campo \xe9 obrigat\xf3rio."
49
- },
50
- selectAll: {
51
- description: "Define se a op\xe7\xe3o de selecionar todos est\xe1 dispon\xedvel ou n\xe3o."
52
- },
53
- isLoading: {
54
- description: "Coloca a lista em estado de loading."
55
- },
56
- isError: {
57
- description: "Define se o campo est\xe1 preeenchido incorretamente."
58
- },
59
- isSuccess: {
60
- description: "Define se o campo est\xe1 preeenchido corretamente."
61
- },
62
- maxItems: {
63
- description: "Define um limite de sele\xe7\xf5es."
64
- }
65
- }
66
- };
67
- const MultiSelect_stories = meta;
68
- const mockTranslate = (key)=>{
69
- switch(key){
70
- case "all_were_selected":
71
- return "Todos foram Selecionados.";
72
- case "remove_all":
73
- return "Remover todos";
74
- case "select_all":
75
- return "Selecionar todos";
76
- case "no_data_was_found":
77
- return "Nenhum dado foi encontrado.";
78
- case "the_selection_limit_has_been_reached":
79
- return "O limite de sele\xe7\xf5es foi atingido.";
80
- case "no_data_is_available":
81
- return "Nenhum dado dispon\xedvel.";
82
- default:
83
- return key;
84
- }
85
- };
86
- const mockOptions = [
87
- {
88
- value: "xs",
89
- label: "Extra Pequeno"
90
- },
91
- {
92
- value: "s",
93
- label: "Pequeno"
94
- },
95
- {
96
- value: "m",
97
- label: "M\xe9dio"
98
- },
99
- {
100
- value: "l",
101
- label: "Grande"
102
- },
103
- {
104
- value: "xl",
105
- label: "Extra Grande"
106
- },
107
- {
108
- value: "xxl",
109
- label: "Extra Extra Grande"
110
- },
111
- {
112
- value: "2xl",
113
- label: "2X Grande"
114
- },
115
- {
116
- value: "3xl",
117
- label: "3X Grande"
118
- },
119
- {
120
- value: "one-size",
121
- label: "Tamanho \xdanico"
122
- },
123
- {
124
- value: "custom",
125
- label: "Tamanho Personalizado"
126
- },
127
- {
128
- value: "not-applicable",
129
- label: "N\xe3o Aplic\xe1vel"
130
- }
131
- ];
132
- const mockManyOptions = [
133
- {
134
- value: "xxs",
135
- label: "Extra Extra Pequeno"
136
- },
137
- ...mockOptions,
138
- {
139
- value: "padrao",
140
- label: "Padr\xe3o"
141
- }
142
- ];
143
- const Default = {
144
- args: {
145
- placeholder: "Selecione ...",
146
- options: mockOptions,
147
- translation: mockTranslate,
148
- label: "Default"
149
- }
150
- };
151
- const Label = {
152
- args: {
153
- placeholder: "Selecione ...",
154
- options: mockOptions,
155
- helpText: "",
156
- label: "Label",
157
- translation: mockTranslate
158
- }
159
- };
160
- const SelectAll = {
161
- args: {
162
- placeholder: "Selecione ...",
163
- options: mockOptions,
164
- helpText: "",
165
- label: "Label",
166
- translation: mockTranslate,
167
- selectAll: true
168
- }
169
- };
170
- const MaxItems = {
171
- args: {
172
- placeholder: "Selecione ...",
173
- options: mockOptions,
174
- helpText: "",
175
- label: "Label",
176
- translation: mockTranslate,
177
- maxItems: 5
178
- }
179
- };
180
- const ManyOptions = {
181
- args: {
182
- placeholder: "Selecione ...",
183
- options: mockManyOptions,
184
- helpText: "",
185
- label: "Label",
186
- translation: mockTranslate
187
- }
188
- };
189
- const Optional = {
190
- args: {
191
- placeholder: "Selecione ...",
192
- options: mockOptions,
193
- helpText: "",
194
- label: "Opcional",
195
- optional: "(opcional)",
196
- translation: mockTranslate
197
- }
198
- };
199
- const Required = {
200
- args: {
201
- placeholder: "Selecione ...",
202
- options: mockOptions,
203
- helpText: "",
204
- label: "Obrigat\xf3rio",
205
- translation: mockTranslate,
206
- required: true
207
- }
208
- };
209
- const HelpText = {
210
- args: {
211
- placeholder: "Selecione ...",
212
- options: mockOptions,
213
- helpText: "texto de ajuda",
214
- label: "Texto de Ajuda",
215
- translation: mockTranslate
216
- }
217
- };
218
- const Loading = {
219
- args: {
220
- placeholder: "Selecione ...",
221
- options: mockOptions,
222
- helpText: "",
223
- label: "Loading",
224
- translation: mockTranslate,
225
- isLoading: true
226
- }
227
- };
228
- const Success = {
229
- args: {
230
- placeholder: "Selecione ...",
231
- options: mockOptions,
232
- helpText: "mensagem de sucesso",
233
- label: "Sucesso",
234
- translation: mockTranslate,
235
- isSuccess: true
236
- }
237
- };
238
- const Error = {
239
- args: {
240
- placeholder: "Selecione ...",
241
- options: mockOptions,
242
- helpText: "Mensagem de erro",
243
- label: "Erro",
244
- translation: mockTranslate,
245
- optional: "",
246
- isError: true
247
- }
248
- };
249
- const Value = {
250
- args: {
251
- placeholder: "Selecione ...",
252
- options: mockOptions,
253
- helpText: "Alguns dados j\xe1 foram selecionados",
254
- label: "Value",
255
- translation: mockTranslate,
256
- optional: "",
257
- value: mockOptions.slice(0, 8)
258
- }
259
- };
260
- const onChangeItems = {
261
- render: ()=>{
262
- const [selected, setSelected] = useState([]);
263
- const handleChangeSeleceted = (options)=>{
264
- setSelected(options);
265
- };
266
- return /*#__PURE__*/ jsxs("div", {
267
- style: {
268
- display: "flex",
269
- flexDirection: "column",
270
- width: "100%",
271
- gap: "3rem"
272
- },
273
- children: [
274
- /*#__PURE__*/ jsxs("div", {
275
- children: [
276
- /*#__PURE__*/ jsxs("h2", {
277
- style: {
278
- fontWeight: "500",
279
- marginBottom: "1rem",
280
- color: "#26333B"
281
- },
282
- children: [
283
- "Selecionados:",
284
- " "
285
- ]
286
- }),
287
- /*#__PURE__*/ jsx("div", {
288
- style: {
289
- display: "flex",
290
- gap: "0.5rem",
291
- flexWrap: "wrap"
292
- },
293
- children: selected.length ? /*#__PURE__*/ jsxs(Fragment, {
294
- children: [
295
- " ",
296
- selected.map((op)=>/*#__PURE__*/ jsx("span", {
297
- style: {
298
- padding: "0.25rem",
299
- background: "#FF5656",
300
- fontSize: "12px",
301
- lineHeight: "12px",
302
- borderRadius: "4px",
303
- color: "#F5F5F5",
304
- fontWeight: "600"
305
- },
306
- children: op.label
307
- }, op.value))
308
- ]
309
- }) : /*#__PURE__*/ jsx("span", {
310
- style: {
311
- padding: "0.25rem",
312
- background: "#FF5656",
313
- fontSize: "12px",
314
- lineHeight: "12px",
315
- borderRadius: "4px",
316
- color: "#F5F5F5",
317
- fontWeight: "600"
318
- },
319
- children: "Nenhum Selecionado"
320
- })
321
- })
322
- ]
323
- }),
324
- /*#__PURE__*/ jsx(index, {
325
- options: mockOptions,
326
- placeholder: "Selecione os tamanhos",
327
- onChangeItems: handleChangeSeleceted,
328
- translation: mockTranslate,
329
- label: "Tamanho",
330
- selectAll: true
331
- })
332
- ]
333
- });
334
- }
335
- };
336
- export { Default, Error, HelpText, Label, Loading, ManyOptions, MaxItems, Optional, Required, SelectAll, Success, Value, MultiSelect_stories as default, onChangeItems };
Binary file