@vector-business-services/cristal-ds-web 0.20.0 → 0.22.0

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/dist/index.d.cts CHANGED
@@ -320,6 +320,58 @@ interface ContextMenuHandle {
320
320
  }
321
321
  declare const ContextMenu: react.ForwardRefExoticComponent<ContextMenuProps & react.RefAttributes<ContextMenuHandle>>;
322
322
 
323
+ /** Um período: [início, fim], com as duas datas no mesmo dia quando é um dia só. */
324
+ type DateRange = [Date, Date];
325
+ /** Item da lista de períodos do Data Picker (.Period no Figma). */
326
+ interface DateRangePeriod {
327
+ /** Texto do item e do botão ("Este mês"). */
328
+ label: string;
329
+ /** O período, a partir do dia de hoje. */
330
+ range: (hoje: Date) => DateRange;
331
+ }
332
+ /**
333
+ * Os períodos do Figma (DatePicker: .Period, de 6 a 9 itens). O `DateRangeButton` mostra os seis
334
+ * primeiros; os outros entram pela prop `periods`.
335
+ */
336
+ declare const DATE_PERIODS: {
337
+ today: {
338
+ label: string;
339
+ range: (hoje: Date) => [Date, Date];
340
+ };
341
+ yesterday: {
342
+ label: string;
343
+ range: (hoje: Date) => [Date, Date];
344
+ };
345
+ last7Days: {
346
+ label: string;
347
+ range: (hoje: Date) => [Date, Date];
348
+ };
349
+ last14Days: {
350
+ label: string;
351
+ range: (hoje: Date) => [Date, Date];
352
+ };
353
+ last30Days: {
354
+ label: string;
355
+ range: (hoje: Date) => [Date, Date];
356
+ };
357
+ thisMonth: {
358
+ label: string;
359
+ range: (hoje: Date) => [Date, Date];
360
+ };
361
+ lastWeek: {
362
+ label: string;
363
+ range: (hoje: Date) => [Date, Date];
364
+ };
365
+ lastMonth: {
366
+ label: string;
367
+ range: (hoje: Date) => [Date, Date];
368
+ };
369
+ thisYear: {
370
+ label: string;
371
+ range: (hoje: Date) => [Date, Date];
372
+ };
373
+ };
374
+
323
375
  type DatePickerVariant = InputVariant;
324
376
  type DatePickerSize = InputSize;
325
377
  /**
@@ -340,6 +392,19 @@ interface DatePickerProps<TMode extends CalendarSelectionMode = 'single'> extend
340
392
  error?: string;
341
393
  /** Dias de folga (Day Off no Figma): aparecem riscados. Para não deixar escolher, use `disabledDates`. */
342
394
  offDays?: Date[];
395
+ /**
396
+ * Lista de períodos à esquerda do calendário, com os campos de data inicial e final em cima (o
397
+ * Data Picker do Figma). Só com `selectionMode="range"`; os do Figma estão em `DATE_PERIODS`.
398
+ * Padrão: sem lista.
399
+ */
400
+ periods?: DateRangePeriod[];
401
+ /**
402
+ * Rodapé com Fechar e Selecionar (Data Picker do Figma): a escolha só vale no Selecionar; o
403
+ * Fechar, o Esc e o clique fora descartam. Padrão: false.
404
+ */
405
+ footer?: boolean;
406
+ /** O dia de hoje para os períodos (Hoje, Este mês...). Padrão: a data atual. */
407
+ today?: Date;
343
408
  }
344
409
  /** A ref é a do Calendar do Prime: `show()`, `hide()`, `getInput()`, `getElement()`... */
345
410
  type DatePickerHandle = Calendar$1;
@@ -348,6 +413,46 @@ declare const DatePicker: <TMode extends CalendarSelectionMode = "single">(props
348
413
  ref?: Ref<DatePickerHandle>;
349
414
  }) => ReactElement;
350
415
 
416
+ interface DateRangeButtonChangeEvent {
417
+ /** O período escolhido: [início, fim]. */
418
+ value: DateRange;
419
+ /** O item da lista de períodos, se veio dele (ou se as datas são as dele). */
420
+ period: DateRangePeriod | null;
421
+ }
422
+ interface DateRangeButtonProps {
423
+ /** O período mostrado no botão (controlado). */
424
+ value?: DateRange | null;
425
+ /** O Selecionar do painel (ou, sem o rodapé, o período completo). */
426
+ onChange?: (event: DateRangeButtonChangeEvent) => void;
427
+ /** Rótulo acima do botão (Label no Figma). Sem rótulo, o nome é o texto do botão. */
428
+ label?: string;
429
+ required?: boolean;
430
+ /** Texto do botão sem período. Padrão: "Selecione o período". */
431
+ placeholder?: string;
432
+ /**
433
+ * A lista de períodos do painel (.Period no Figma). Padrão: os seis do Figma (Hoje a Este mês);
434
+ * os outros estão em `DATE_PERIODS`. Com `[]`, o painel fica sem a lista.
435
+ */
436
+ periods?: DateRangePeriod[];
437
+ /** Rodapé com Fechar e Selecionar. Sem ele, o período vale assim que fica completo. Padrão: true. */
438
+ footer?: boolean;
439
+ /** Meses lado a lado no calendário. Padrão: 2. */
440
+ numberOfMonths?: number;
441
+ minDate?: Date;
442
+ maxDate?: Date;
443
+ disabledDates?: Date[];
444
+ /** Dias de folga (Day Off no Figma): aparecem riscados. */
445
+ offDays?: Date[];
446
+ /** O dia de hoje para os períodos (Hoje, Este mês...). Padrão: a data atual. */
447
+ today?: Date;
448
+ disabled?: boolean;
449
+ /** Vai no <button>. */
450
+ id?: string;
451
+ className?: string;
452
+ style?: CSSProperties;
453
+ }
454
+ declare const DateRangeButton: react.ForwardRefExoticComponent<DateRangeButtonProps & react.RefAttributes<HTMLButtonElement>>;
455
+
351
456
  /** Horizontal Divider e Vertical Divider no Figma. */
352
457
  type DividerOrientation = 'horizontal' | 'vertical';
353
458
  /** Style no Figma: Solid (Default no vertical) e Dashed. */
@@ -1080,5 +1185,5 @@ interface ToastProps {
1080
1185
  }
1081
1186
  declare const Toast: react.ForwardRefExoticComponent<ToastProps & react.RefAttributes<ToastHandle>>;
1082
1187
 
1083
- export { Accordion, AccordionTab, AutoComplete, Badge, Button, Calendar, Card, Chart, Checkbox, Chip, Column, ContextMenu, DatePicker, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Skeleton, Switch, TabPanel, Table, TableRowActions, TableToolbar, Tabs, Tag, Toast, Tooltip };
1084
- export type { AccordionProps, AccordionTabProps, AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CalendarHandle, CalendarProps, CardPadding, CardProps, ChartAxis, ChartColor, ChartProps, ChartSeries, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, ColumnProps, ContextMenuHandle, ContextMenuItem, ContextMenuProps, DatePickerHandle, DatePickerProps, DatePickerSize, DatePickerVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerHandle, DrawerProps, DrawerSide, DrawerSize, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, MessageProps, MessageType, ModalHandle, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PageHeaderProps, PageHeaderTab, PageHeaderVariant, PaginatorPageChangeEvent, PaginatorProps, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SkeletonProps, SkeletonShape, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TableFilter, TableHandle, TableProps, TableRowActionsProps, TableToolbarAction, TableToolbarProps, TabsProps, TagProps, TagSize, TagVariant, ToastHandle, ToastMessage, ToastPosition, ToastProps, ToastType, TooltipPosition, TooltipProps, TooltipType };
1188
+ export { Accordion, AccordionTab, AutoComplete, Badge, Button, Calendar, Card, Chart, Checkbox, Chip, Column, ContextMenu, DATE_PERIODS, DatePicker, DateRangeButton, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Skeleton, Switch, TabPanel, Table, TableRowActions, TableToolbar, Tabs, Tag, Toast, Tooltip };
1189
+ export type { AccordionProps, AccordionTabProps, AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CalendarHandle, CalendarProps, CardPadding, CardProps, ChartAxis, ChartColor, ChartProps, ChartSeries, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, ColumnProps, ContextMenuHandle, ContextMenuItem, ContextMenuProps, DatePickerHandle, DatePickerProps, DatePickerSize, DatePickerVariant, DateRange, DateRangeButtonChangeEvent, DateRangeButtonProps, DateRangePeriod, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerHandle, DrawerProps, DrawerSide, DrawerSize, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, MessageProps, MessageType, ModalHandle, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PageHeaderProps, PageHeaderTab, PageHeaderVariant, PaginatorPageChangeEvent, PaginatorProps, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SkeletonProps, SkeletonShape, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TableFilter, TableHandle, TableProps, TableRowActionsProps, TableToolbarAction, TableToolbarProps, TabsProps, TagProps, TagSize, TagVariant, ToastHandle, ToastMessage, ToastPosition, ToastProps, ToastType, TooltipPosition, TooltipProps, TooltipType };
package/dist/index.d.ts CHANGED
@@ -320,6 +320,58 @@ interface ContextMenuHandle {
320
320
  }
321
321
  declare const ContextMenu: react.ForwardRefExoticComponent<ContextMenuProps & react.RefAttributes<ContextMenuHandle>>;
322
322
 
323
+ /** Um período: [início, fim], com as duas datas no mesmo dia quando é um dia só. */
324
+ type DateRange = [Date, Date];
325
+ /** Item da lista de períodos do Data Picker (.Period no Figma). */
326
+ interface DateRangePeriod {
327
+ /** Texto do item e do botão ("Este mês"). */
328
+ label: string;
329
+ /** O período, a partir do dia de hoje. */
330
+ range: (hoje: Date) => DateRange;
331
+ }
332
+ /**
333
+ * Os períodos do Figma (DatePicker: .Period, de 6 a 9 itens). O `DateRangeButton` mostra os seis
334
+ * primeiros; os outros entram pela prop `periods`.
335
+ */
336
+ declare const DATE_PERIODS: {
337
+ today: {
338
+ label: string;
339
+ range: (hoje: Date) => [Date, Date];
340
+ };
341
+ yesterday: {
342
+ label: string;
343
+ range: (hoje: Date) => [Date, Date];
344
+ };
345
+ last7Days: {
346
+ label: string;
347
+ range: (hoje: Date) => [Date, Date];
348
+ };
349
+ last14Days: {
350
+ label: string;
351
+ range: (hoje: Date) => [Date, Date];
352
+ };
353
+ last30Days: {
354
+ label: string;
355
+ range: (hoje: Date) => [Date, Date];
356
+ };
357
+ thisMonth: {
358
+ label: string;
359
+ range: (hoje: Date) => [Date, Date];
360
+ };
361
+ lastWeek: {
362
+ label: string;
363
+ range: (hoje: Date) => [Date, Date];
364
+ };
365
+ lastMonth: {
366
+ label: string;
367
+ range: (hoje: Date) => [Date, Date];
368
+ };
369
+ thisYear: {
370
+ label: string;
371
+ range: (hoje: Date) => [Date, Date];
372
+ };
373
+ };
374
+
323
375
  type DatePickerVariant = InputVariant;
324
376
  type DatePickerSize = InputSize;
325
377
  /**
@@ -340,6 +392,19 @@ interface DatePickerProps<TMode extends CalendarSelectionMode = 'single'> extend
340
392
  error?: string;
341
393
  /** Dias de folga (Day Off no Figma): aparecem riscados. Para não deixar escolher, use `disabledDates`. */
342
394
  offDays?: Date[];
395
+ /**
396
+ * Lista de períodos à esquerda do calendário, com os campos de data inicial e final em cima (o
397
+ * Data Picker do Figma). Só com `selectionMode="range"`; os do Figma estão em `DATE_PERIODS`.
398
+ * Padrão: sem lista.
399
+ */
400
+ periods?: DateRangePeriod[];
401
+ /**
402
+ * Rodapé com Fechar e Selecionar (Data Picker do Figma): a escolha só vale no Selecionar; o
403
+ * Fechar, o Esc e o clique fora descartam. Padrão: false.
404
+ */
405
+ footer?: boolean;
406
+ /** O dia de hoje para os períodos (Hoje, Este mês...). Padrão: a data atual. */
407
+ today?: Date;
343
408
  }
344
409
  /** A ref é a do Calendar do Prime: `show()`, `hide()`, `getInput()`, `getElement()`... */
345
410
  type DatePickerHandle = Calendar$1;
@@ -348,6 +413,46 @@ declare const DatePicker: <TMode extends CalendarSelectionMode = "single">(props
348
413
  ref?: Ref<DatePickerHandle>;
349
414
  }) => ReactElement;
350
415
 
416
+ interface DateRangeButtonChangeEvent {
417
+ /** O período escolhido: [início, fim]. */
418
+ value: DateRange;
419
+ /** O item da lista de períodos, se veio dele (ou se as datas são as dele). */
420
+ period: DateRangePeriod | null;
421
+ }
422
+ interface DateRangeButtonProps {
423
+ /** O período mostrado no botão (controlado). */
424
+ value?: DateRange | null;
425
+ /** O Selecionar do painel (ou, sem o rodapé, o período completo). */
426
+ onChange?: (event: DateRangeButtonChangeEvent) => void;
427
+ /** Rótulo acima do botão (Label no Figma). Sem rótulo, o nome é o texto do botão. */
428
+ label?: string;
429
+ required?: boolean;
430
+ /** Texto do botão sem período. Padrão: "Selecione o período". */
431
+ placeholder?: string;
432
+ /**
433
+ * A lista de períodos do painel (.Period no Figma). Padrão: os seis do Figma (Hoje a Este mês);
434
+ * os outros estão em `DATE_PERIODS`. Com `[]`, o painel fica sem a lista.
435
+ */
436
+ periods?: DateRangePeriod[];
437
+ /** Rodapé com Fechar e Selecionar. Sem ele, o período vale assim que fica completo. Padrão: true. */
438
+ footer?: boolean;
439
+ /** Meses lado a lado no calendário. Padrão: 2. */
440
+ numberOfMonths?: number;
441
+ minDate?: Date;
442
+ maxDate?: Date;
443
+ disabledDates?: Date[];
444
+ /** Dias de folga (Day Off no Figma): aparecem riscados. */
445
+ offDays?: Date[];
446
+ /** O dia de hoje para os períodos (Hoje, Este mês...). Padrão: a data atual. */
447
+ today?: Date;
448
+ disabled?: boolean;
449
+ /** Vai no <button>. */
450
+ id?: string;
451
+ className?: string;
452
+ style?: CSSProperties;
453
+ }
454
+ declare const DateRangeButton: react.ForwardRefExoticComponent<DateRangeButtonProps & react.RefAttributes<HTMLButtonElement>>;
455
+
351
456
  /** Horizontal Divider e Vertical Divider no Figma. */
352
457
  type DividerOrientation = 'horizontal' | 'vertical';
353
458
  /** Style no Figma: Solid (Default no vertical) e Dashed. */
@@ -1080,5 +1185,5 @@ interface ToastProps {
1080
1185
  }
1081
1186
  declare const Toast: react.ForwardRefExoticComponent<ToastProps & react.RefAttributes<ToastHandle>>;
1082
1187
 
1083
- export { Accordion, AccordionTab, AutoComplete, Badge, Button, Calendar, Card, Chart, Checkbox, Chip, Column, ContextMenu, DatePicker, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Skeleton, Switch, TabPanel, Table, TableRowActions, TableToolbar, Tabs, Tag, Toast, Tooltip };
1084
- export type { AccordionProps, AccordionTabProps, AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CalendarHandle, CalendarProps, CardPadding, CardProps, ChartAxis, ChartColor, ChartProps, ChartSeries, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, ColumnProps, ContextMenuHandle, ContextMenuItem, ContextMenuProps, DatePickerHandle, DatePickerProps, DatePickerSize, DatePickerVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerHandle, DrawerProps, DrawerSide, DrawerSize, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, MessageProps, MessageType, ModalHandle, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PageHeaderProps, PageHeaderTab, PageHeaderVariant, PaginatorPageChangeEvent, PaginatorProps, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SkeletonProps, SkeletonShape, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TableFilter, TableHandle, TableProps, TableRowActionsProps, TableToolbarAction, TableToolbarProps, TabsProps, TagProps, TagSize, TagVariant, ToastHandle, ToastMessage, ToastPosition, ToastProps, ToastType, TooltipPosition, TooltipProps, TooltipType };
1188
+ export { Accordion, AccordionTab, AutoComplete, Badge, Button, Calendar, Card, Chart, Checkbox, Chip, Column, ContextMenu, DATE_PERIODS, DatePicker, DateRangeButton, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Skeleton, Switch, TabPanel, Table, TableRowActions, TableToolbar, Tabs, Tag, Toast, Tooltip };
1189
+ export type { AccordionProps, AccordionTabProps, AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CalendarHandle, CalendarProps, CardPadding, CardProps, ChartAxis, ChartColor, ChartProps, ChartSeries, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, ColumnProps, ContextMenuHandle, ContextMenuItem, ContextMenuProps, DatePickerHandle, DatePickerProps, DatePickerSize, DatePickerVariant, DateRange, DateRangeButtonChangeEvent, DateRangeButtonProps, DateRangePeriod, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerHandle, DrawerProps, DrawerSide, DrawerSize, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, MessageProps, MessageType, ModalHandle, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PageHeaderProps, PageHeaderTab, PageHeaderVariant, PaginatorPageChangeEvent, PaginatorProps, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SkeletonProps, SkeletonShape, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TableFilter, TableHandle, TableProps, TableRowActionsProps, TableToolbarAction, TableToolbarProps, TabsProps, TagProps, TagSize, TagVariant, ToastHandle, ToastMessage, ToastPosition, ToastProps, ToastType, TooltipPosition, TooltipProps, TooltipType };