@ftdata/ui 0.0.19 → 0.0.21

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 (28) hide show
  1. package/dist/components/DateRangePicker/constants/index.d.ts +477 -0
  2. package/dist/components/DateRangePicker/constants/index.js +22 -0
  3. package/dist/components/DateRangePicker/helpers/createFormatDate.d.ts +2 -0
  4. package/dist/components/DateRangePicker/helpers/createFormatDate.js +9 -0
  5. package/dist/components/DateRangePicker/index.d.ts +26 -0
  6. package/dist/components/DateRangePicker/index.js +90 -0
  7. package/dist/components/DateRangePicker/styles.d.ts +16 -0
  8. package/dist/components/DateRangePicker/styles.js +147 -0
  9. package/dist/components/DateRangePicker/types/dataRange.d.ts +3 -0
  10. package/dist/components/DateRangePicker/types/dataRange.js +0 -0
  11. package/dist/components/Modal/Button/index.d.ts +50 -0
  12. package/dist/components/Modal/Button/index.js +105 -0
  13. package/dist/components/Modal/Button/modifiers/color.d.ts +9 -0
  14. package/dist/components/Modal/Button/modifiers/color.js +96 -0
  15. package/dist/components/Modal/Button/modifiers/size.d.ts +5 -0
  16. package/dist/components/Modal/Button/modifiers/size.js +22 -0
  17. package/dist/components/Modal/Button/styles.d.ts +20 -0
  18. package/dist/components/Modal/Button/styles.js +105 -0
  19. package/dist/components/Modal/index.d.ts +13 -9
  20. package/dist/components/Modal/index.js +12 -6
  21. package/dist/components/Modal/styles.d.ts +1 -1
  22. package/dist/components/Modal/styles.js +5 -6
  23. package/dist/components/MultiSelect/components/Badge/styles.js +4 -2
  24. package/dist/components/MultiSelect/index.js +2 -1
  25. package/dist/index.d.ts +3 -1
  26. package/dist/index.js +2 -1
  27. package/dist/style/rsuite.css +3192 -0
  28. package/package.json +4 -2
@@ -0,0 +1,477 @@
1
+ import type { LocaleCode } from "../types/dataRange";
2
+ export declare const RSUITE_LOCALES: {
3
+ readonly "pt-BR": {
4
+ code: string;
5
+ common: {
6
+ loading: string;
7
+ emptyMessage: string;
8
+ remove: string;
9
+ clear: string;
10
+ };
11
+ Plaintext: {
12
+ unfilled: string;
13
+ notSelected: string;
14
+ notUploaded: string;
15
+ };
16
+ Pagination: {
17
+ more: string;
18
+ prev: string;
19
+ next: string;
20
+ first: string;
21
+ last: string;
22
+ limit: string;
23
+ total: string;
24
+ skip: string;
25
+ };
26
+ DateTimeFormats: {
27
+ sunday: string;
28
+ monday: string;
29
+ tuesday: string;
30
+ wednesday: string;
31
+ thursday: string;
32
+ friday: string;
33
+ saturday: string;
34
+ ok: string;
35
+ today: string;
36
+ yesterday: string;
37
+ now: string;
38
+ hours: string;
39
+ minutes: string;
40
+ seconds: string;
41
+ formattedMonthPattern: string;
42
+ formattedDayPattern: string;
43
+ shortDateFormat: string;
44
+ shortTimeFormat: string;
45
+ dateLocale: any;
46
+ };
47
+ Calendar: {
48
+ sunday: string;
49
+ monday: string;
50
+ tuesday: string;
51
+ wednesday: string;
52
+ thursday: string;
53
+ friday: string;
54
+ saturday: string;
55
+ ok: string;
56
+ today: string;
57
+ yesterday: string;
58
+ now: string;
59
+ hours: string;
60
+ minutes: string;
61
+ seconds: string;
62
+ formattedMonthPattern: string;
63
+ formattedDayPattern: string;
64
+ shortDateFormat: string;
65
+ shortTimeFormat: string;
66
+ dateLocale: any;
67
+ };
68
+ DatePicker: {
69
+ sunday: string;
70
+ monday: string;
71
+ tuesday: string;
72
+ wednesday: string;
73
+ thursday: string;
74
+ friday: string;
75
+ saturday: string;
76
+ ok: string;
77
+ today: string;
78
+ yesterday: string;
79
+ now: string;
80
+ hours: string;
81
+ minutes: string;
82
+ seconds: string;
83
+ formattedMonthPattern: string;
84
+ formattedDayPattern: string;
85
+ shortDateFormat: string;
86
+ shortTimeFormat: string;
87
+ dateLocale: any;
88
+ };
89
+ DateRangePicker: {
90
+ last7Days: string;
91
+ sunday: string;
92
+ monday: string;
93
+ tuesday: string;
94
+ wednesday: string;
95
+ thursday: string;
96
+ friday: string;
97
+ saturday: string;
98
+ ok: string;
99
+ today: string;
100
+ yesterday: string;
101
+ now: string;
102
+ hours: string;
103
+ minutes: string;
104
+ seconds: string;
105
+ formattedMonthPattern: string;
106
+ formattedDayPattern: string;
107
+ shortDateFormat: string;
108
+ shortTimeFormat: string;
109
+ dateLocale: any;
110
+ };
111
+ Combobox: {
112
+ noResultsText: string;
113
+ placeholder: string;
114
+ searchPlaceholder: string;
115
+ checkAll: string;
116
+ };
117
+ InputPicker: {
118
+ newItem: string;
119
+ createOption: string;
120
+ noResultsText: string;
121
+ placeholder: string;
122
+ searchPlaceholder: string;
123
+ checkAll: string;
124
+ };
125
+ TagPicker: {
126
+ newItem: string;
127
+ createOption: string;
128
+ noResultsText: string;
129
+ placeholder: string;
130
+ searchPlaceholder: string;
131
+ checkAll: string;
132
+ };
133
+ Uploader: {
134
+ inited: string;
135
+ progress: string;
136
+ error: string;
137
+ complete: string;
138
+ emptyFile: string;
139
+ upload: string;
140
+ removeFile: string;
141
+ };
142
+ CloseButton: {
143
+ closeLabel: string;
144
+ };
145
+ Breadcrumb: {
146
+ expandText: string;
147
+ };
148
+ Toggle: {
149
+ on: string;
150
+ off: string;
151
+ };
152
+ Dialog: {
153
+ alert: string;
154
+ confirm: string;
155
+ ok: string;
156
+ cancel: string;
157
+ };
158
+ };
159
+ readonly "en-US": {
160
+ code: string;
161
+ common: {
162
+ loading: string;
163
+ emptyMessage: string;
164
+ remove: string;
165
+ clear: string;
166
+ };
167
+ Plaintext: {
168
+ unfilled: string;
169
+ notSelected: string;
170
+ notUploaded: string;
171
+ };
172
+ Pagination: {
173
+ more: string;
174
+ prev: string;
175
+ next: string;
176
+ first: string;
177
+ last: string;
178
+ limit: string;
179
+ total: string;
180
+ skip: string;
181
+ };
182
+ DateTimeFormats: {
183
+ sunday: string;
184
+ monday: string;
185
+ tuesday: string;
186
+ wednesday: string;
187
+ thursday: string;
188
+ friday: string;
189
+ saturday: string;
190
+ ok: string;
191
+ today: string;
192
+ yesterday: string;
193
+ now: string;
194
+ hours: string;
195
+ minutes: string;
196
+ seconds: string;
197
+ formattedMonthPattern: string;
198
+ formattedDayPattern: string;
199
+ shortDateFormat: string;
200
+ shortTimeFormat: string;
201
+ dateLocale: any;
202
+ };
203
+ Calendar: {
204
+ sunday: string;
205
+ monday: string;
206
+ tuesday: string;
207
+ wednesday: string;
208
+ thursday: string;
209
+ friday: string;
210
+ saturday: string;
211
+ ok: string;
212
+ today: string;
213
+ yesterday: string;
214
+ now: string;
215
+ hours: string;
216
+ minutes: string;
217
+ seconds: string;
218
+ formattedMonthPattern: string;
219
+ formattedDayPattern: string;
220
+ shortDateFormat: string;
221
+ shortTimeFormat: string;
222
+ dateLocale: any;
223
+ };
224
+ DatePicker: {
225
+ sunday: string;
226
+ monday: string;
227
+ tuesday: string;
228
+ wednesday: string;
229
+ thursday: string;
230
+ friday: string;
231
+ saturday: string;
232
+ ok: string;
233
+ today: string;
234
+ yesterday: string;
235
+ now: string;
236
+ hours: string;
237
+ minutes: string;
238
+ seconds: string;
239
+ formattedMonthPattern: string;
240
+ formattedDayPattern: string;
241
+ shortDateFormat: string;
242
+ shortTimeFormat: string;
243
+ dateLocale: any;
244
+ };
245
+ DateRangePicker: {
246
+ last7Days: string;
247
+ sunday: string;
248
+ monday: string;
249
+ tuesday: string;
250
+ wednesday: string;
251
+ thursday: string;
252
+ friday: string;
253
+ saturday: string;
254
+ ok: string;
255
+ today: string;
256
+ yesterday: string;
257
+ now: string;
258
+ hours: string;
259
+ minutes: string;
260
+ seconds: string;
261
+ formattedMonthPattern: string;
262
+ formattedDayPattern: string;
263
+ shortDateFormat: string;
264
+ shortTimeFormat: string;
265
+ dateLocale: any;
266
+ };
267
+ Combobox: {
268
+ noResultsText: string;
269
+ placeholder: string;
270
+ searchPlaceholder: string;
271
+ checkAll: string;
272
+ };
273
+ InputPicker: {
274
+ newItem: string;
275
+ createOption: string;
276
+ noResultsText: string;
277
+ placeholder: string;
278
+ searchPlaceholder: string;
279
+ checkAll: string;
280
+ };
281
+ TagPicker: {
282
+ newItem: string;
283
+ createOption: string;
284
+ noResultsText: string;
285
+ placeholder: string;
286
+ searchPlaceholder: string;
287
+ checkAll: string;
288
+ };
289
+ Uploader: {
290
+ inited: string;
291
+ progress: string;
292
+ error: string;
293
+ complete: string;
294
+ emptyFile: string;
295
+ upload: string;
296
+ removeFile: string;
297
+ };
298
+ CloseButton: {
299
+ closeLabel: string;
300
+ };
301
+ Breadcrumb: {
302
+ expandText: string;
303
+ };
304
+ Toggle: {
305
+ on: string;
306
+ off: string;
307
+ };
308
+ Dialog: {
309
+ alert: string;
310
+ confirm: string;
311
+ ok: string;
312
+ cancel: string;
313
+ };
314
+ };
315
+ readonly "es-ES": {
316
+ code: string;
317
+ common: {
318
+ loading: string;
319
+ emptyMessage: string;
320
+ remove: string;
321
+ clear: string;
322
+ };
323
+ Plaintext: {
324
+ unfilled: string;
325
+ notSelected: string;
326
+ notUploaded: string;
327
+ };
328
+ Pagination: {
329
+ more: string;
330
+ prev: string;
331
+ next: string;
332
+ first: string;
333
+ last: string;
334
+ limit: string;
335
+ total: string;
336
+ skip: string;
337
+ };
338
+ DateTimeFormats: {
339
+ sunday: string;
340
+ monday: string;
341
+ tuesday: string;
342
+ wednesday: string;
343
+ thursday: string;
344
+ friday: string;
345
+ saturday: string;
346
+ ok: string;
347
+ today: string;
348
+ yesterday: string;
349
+ now: string;
350
+ hours: string;
351
+ minutes: string;
352
+ seconds: string;
353
+ formattedMonthPattern: string;
354
+ formattedDayPattern: string;
355
+ shortDateFormat: string;
356
+ shortTimeFormat: string;
357
+ dateLocale: any;
358
+ };
359
+ Calendar: {
360
+ sunday: string;
361
+ monday: string;
362
+ tuesday: string;
363
+ wednesday: string;
364
+ thursday: string;
365
+ friday: string;
366
+ saturday: string;
367
+ ok: string;
368
+ today: string;
369
+ yesterday: string;
370
+ now: string;
371
+ hours: string;
372
+ minutes: string;
373
+ seconds: string;
374
+ formattedMonthPattern: string;
375
+ formattedDayPattern: string;
376
+ shortDateFormat: string;
377
+ shortTimeFormat: string;
378
+ dateLocale: any;
379
+ };
380
+ DatePicker: {
381
+ sunday: string;
382
+ monday: string;
383
+ tuesday: string;
384
+ wednesday: string;
385
+ thursday: string;
386
+ friday: string;
387
+ saturday: string;
388
+ ok: string;
389
+ today: string;
390
+ yesterday: string;
391
+ now: string;
392
+ hours: string;
393
+ minutes: string;
394
+ seconds: string;
395
+ formattedMonthPattern: string;
396
+ formattedDayPattern: string;
397
+ shortDateFormat: string;
398
+ shortTimeFormat: string;
399
+ dateLocale: any;
400
+ };
401
+ DateRangePicker: {
402
+ last7Days: string;
403
+ sunday: string;
404
+ monday: string;
405
+ tuesday: string;
406
+ wednesday: string;
407
+ thursday: string;
408
+ friday: string;
409
+ saturday: string;
410
+ ok: string;
411
+ today: string;
412
+ yesterday: string;
413
+ now: string;
414
+ hours: string;
415
+ minutes: string;
416
+ seconds: string;
417
+ formattedMonthPattern: string;
418
+ formattedDayPattern: string;
419
+ shortDateFormat: string;
420
+ shortTimeFormat: string;
421
+ dateLocale: any;
422
+ };
423
+ Combobox: {
424
+ noResultsText: string;
425
+ placeholder: string;
426
+ searchPlaceholder: string;
427
+ checkAll: string;
428
+ };
429
+ InputPicker: {
430
+ newItem: string;
431
+ createOption: string;
432
+ noResultsText: string;
433
+ placeholder: string;
434
+ searchPlaceholder: string;
435
+ checkAll: string;
436
+ };
437
+ TagPicker: {
438
+ newItem: string;
439
+ createOption: string;
440
+ noResultsText: string;
441
+ placeholder: string;
442
+ searchPlaceholder: string;
443
+ checkAll: string;
444
+ };
445
+ Uploader: {
446
+ inited: string;
447
+ progress: string;
448
+ error: string;
449
+ complete: string;
450
+ emptyFile: string;
451
+ upload: string;
452
+ removeFile: string;
453
+ };
454
+ CloseButton: {
455
+ closeLabel: string;
456
+ };
457
+ Breadcrumb: {
458
+ expandText: string;
459
+ };
460
+ Toggle: {
461
+ on: string;
462
+ off: string;
463
+ };
464
+ Dialog: {
465
+ alert: string;
466
+ confirm: string;
467
+ ok: string;
468
+ cancel: string;
469
+ };
470
+ };
471
+ };
472
+ export declare const DATE_FNS_LOCALES: {
473
+ readonly "pt-BR": import("date-fns").Locale;
474
+ readonly "en-US": import("date-fns").Locale;
475
+ readonly "es-ES": import("date-fns").Locale;
476
+ };
477
+ export declare const CLEAR_BUTTON_LABELS: Record<LocaleCode, string>;
@@ -0,0 +1,22 @@
1
+ import { ptBR } from "date-fns/locale/pt-BR";
2
+ import { enUS } from "date-fns/locale/en-US";
3
+ import { es } from "date-fns/locale/es";
4
+ import pt_BR from "rsuite/locales/pt_BR";
5
+ import en_US from "rsuite/locales/en_US";
6
+ import es_ES from "rsuite/locales/es_ES";
7
+ const RSUITE_LOCALES = {
8
+ "pt-BR": pt_BR,
9
+ "en-US": en_US,
10
+ "es-ES": es_ES
11
+ };
12
+ const DATE_FNS_LOCALES = {
13
+ "pt-BR": ptBR,
14
+ "en-US": enUS,
15
+ "es-ES": es
16
+ };
17
+ const CLEAR_BUTTON_LABELS = {
18
+ "pt-BR": "Limpar",
19
+ "en-US": "Clear",
20
+ "es-ES": "Limpiar"
21
+ };
22
+ export { CLEAR_BUTTON_LABELS, DATE_FNS_LOCALES, RSUITE_LOCALES };
@@ -0,0 +1,2 @@
1
+ import { LocaleCode } from "../types/dataRange";
2
+ export declare const createFormatDate: (localeCode: LocaleCode) => (date: Date | number, formatStr: string) => string;
@@ -0,0 +1,9 @@
1
+ import { formatDate } from "date-fns";
2
+ import { DATE_FNS_LOCALES } from "../constants/index.js";
3
+ const createFormatDate = (localeCode)=>{
4
+ const locale = DATE_FNS_LOCALES[localeCode];
5
+ return (date, formatStr)=>formatDate(date, formatStr, {
6
+ locale
7
+ });
8
+ };
9
+ export { createFormatDate };
@@ -0,0 +1,26 @@
1
+ import { JSX } from "react";
2
+ import { IconsNames } from "@ftdata/f-icons";
3
+ import { FieldFeedbackType } from "../../types/feedback";
4
+ import { LocaleCode } from "./types/dataRange";
5
+ import "../../style/rsuite.css";
6
+ import type { DateRangePickerProps as RsuiteDateRangePickerProps } from "rsuite";
7
+ export type { DateRange, LocaleCode } from "./types/dataRange";
8
+ export interface DateRangePickerProps extends Omit<RsuiteDateRangePickerProps, "locale"> {
9
+ /** Idioma/localização do componente. */
10
+ locale?: LocaleCode;
11
+ /** Texto de ajuda exibido abaixo do campo. */
12
+ helpText?: string;
13
+ /** Ícone exibido junto ao texto de ajuda. */
14
+ helpIcon?: IconsNames;
15
+ /** Estado de feedback visual do campo (ex.: erro, sucesso, aviso). */
16
+ feedback?: FieldFeedbackType;
17
+ /** Texto do label exibido acima do campo. */
18
+ label?: string;
19
+ /** Texto auxiliar exibido abaixo do label. */
20
+ sublabel?: string;
21
+ /** Define se o campo é obrigatório. */
22
+ required?: boolean;
23
+ /** Ícone exibido à esquerda do input. Pode ser `IconName` ou JSX. */
24
+ icon?: IconsNames | JSX.Element;
25
+ }
26
+ export default function DateRangePicker({ label, sublabel, helpText, helpIcon, feedback, disabled, required, locale, icon, value, onChange, onOpen, onClose, name, placement, ...rest }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,90 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { CustomProvider, DateRangePicker } from "rsuite";
4
+ import { Icon } from "@ftdata/f-icons";
5
+ import { COLOR_NEUTRAL_MEDIUM } from "@ftdata/f-tokens";
6
+ import HelpText from "../fields/components/HelpText/index.js";
7
+ import Label from "../fields/components/Label/index.js";
8
+ import RotateButton from "../fields/components/RotateButton/index.js";
9
+ import { CLEAR_BUTTON_LABELS, RSUITE_LOCALES } from "./constants/index.js";
10
+ import { createFormatDate } from "./helpers/createFormatDate.js";
11
+ import { DateRangePickerContainer, DateRangePickerGlobalStyles, DateRangePickerWrapper, IconContainer, LabelContainer } from "./styles.js";
12
+ import "../../style/rsuite.css";
13
+ function DateRangePicker_DateRangePicker({ label, sublabel, helpText, helpIcon, feedback, disabled, required, locale = "pt-BR", icon, value, onChange, onOpen, onClose, name, placement, ...rest }) {
14
+ const [isOpen, setIsOpen] = useState(false);
15
+ const handleOpen = ()=>{
16
+ setIsOpen(true);
17
+ onOpen?.();
18
+ };
19
+ const handleClose = ()=>{
20
+ setIsOpen(false);
21
+ onClose?.();
22
+ };
23
+ const handleClear = ()=>{
24
+ onChange?.(null, {});
25
+ };
26
+ const rsuiteLocale = RSUITE_LOCALES[locale];
27
+ const customFormatDate = createFormatDate(locale);
28
+ const clearLabel = CLEAR_BUTTON_LABELS[locale];
29
+ const showClearButton = value && !disabled;
30
+ return /*#__PURE__*/ jsxs(DateRangePickerWrapper, {
31
+ children: [
32
+ /*#__PURE__*/ jsx(DateRangePickerGlobalStyles, {
33
+ placement: placement
34
+ }),
35
+ /*#__PURE__*/ jsxs(LabelContainer, {
36
+ children: [
37
+ label && /*#__PURE__*/ jsx(Label, {
38
+ text: label,
39
+ subtext: sublabel,
40
+ required: required,
41
+ htmlFor: name
42
+ }),
43
+ showClearButton && /*#__PURE__*/ jsx("button", {
44
+ type: "button",
45
+ onClick: handleClear,
46
+ children: clearLabel
47
+ })
48
+ ]
49
+ }),
50
+ /*#__PURE__*/ jsxs(DateRangePickerContainer, {
51
+ feedback: feedback,
52
+ disabled: disabled,
53
+ $active: isOpen,
54
+ $icon: !!icon,
55
+ children: [
56
+ !!icon && /*#__PURE__*/ jsx(IconContainer, {
57
+ children: "string" == typeof icon ? /*#__PURE__*/ jsx(Icon, {
58
+ name: icon,
59
+ color: COLOR_NEUTRAL_MEDIUM
60
+ }) : icon
61
+ }),
62
+ /*#__PURE__*/ jsx(CustomProvider, {
63
+ locale: rsuiteLocale,
64
+ formatDate: customFormatDate,
65
+ children: /*#__PURE__*/ jsx(DateRangePicker, {
66
+ disabled: disabled,
67
+ onOpen: handleOpen,
68
+ onClose: handleClose,
69
+ value: value,
70
+ onChange: onChange,
71
+ placement: placement,
72
+ ...rest
73
+ })
74
+ }),
75
+ /*#__PURE__*/ jsx(RotateButton, {
76
+ rotate: isOpen,
77
+ disabled: disabled,
78
+ className: "rs_rotate"
79
+ })
80
+ ]
81
+ }),
82
+ helpText && /*#__PURE__*/ jsx(HelpText, {
83
+ text: helpText,
84
+ feedback: feedback,
85
+ icon: helpIcon
86
+ })
87
+ ]
88
+ });
89
+ }
90
+ export { DateRangePicker_DateRangePicker as default };
@@ -0,0 +1,16 @@
1
+ import { FieldFeedbackType } from "../../types/feedback";
2
+ interface DateRangePickerGlobalStylesProps {
3
+ placement?: string;
4
+ }
5
+ export declare const DateRangePickerGlobalStyles: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & DateRangePickerGlobalStylesProps>;
6
+ export declare const DateRangePickerWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
+ export declare const LabelContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
+ interface DateRangePickerContainerProps {
9
+ feedback?: FieldFeedbackType;
10
+ disabled?: boolean;
11
+ $active?: boolean;
12
+ $icon?: boolean;
13
+ }
14
+ export declare const DateRangePickerContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, DateRangePickerContainerProps>> & string;
15
+ export declare const IconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
16
+ export {};