@rojaostudio/ds 1.0.2 → 2.0.0-next.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/README.md +75 -13
- package/dist/compat/generate.d.ts +0 -1
- package/dist/components/accordion.d.ts +30 -20
- package/dist/components/accordion.js +31 -93
- package/dist/components/action-bar.d.ts +24 -0
- package/dist/components/action-bar.js +55 -0
- package/dist/components/alert-dialog.d.ts +31 -0
- package/dist/components/alert-dialog.js +43 -0
- package/dist/components/alert.d.ts +31 -19
- package/dist/components/alert.js +67 -65
- package/dist/components/attachment.d.ts +37 -0
- package/dist/components/attachment.js +76 -0
- package/dist/components/avatar.d.ts +43 -36
- package/dist/components/avatar.js +59 -90
- package/dist/components/badge.d.ts +30 -41
- package/dist/components/badge.js +13 -110
- package/dist/components/banner.d.ts +27 -0
- package/dist/components/banner.js +66 -0
- package/dist/components/benefits.d.ts +30 -0
- package/dist/components/benefits.js +32 -0
- package/dist/components/breadcrumb.d.ts +25 -18
- package/dist/components/breadcrumb.js +38 -56
- package/dist/components/browser.d.ts +18 -0
- package/dist/components/browser.js +32 -0
- package/dist/components/bubble.d.ts +29 -0
- package/dist/components/bubble.js +33 -0
- package/dist/components/button-group.d.ts +19 -0
- package/dist/components/button-group.js +20 -0
- package/dist/components/button.d.ts +47 -20
- package/dist/components/button.js +45 -108
- package/dist/components/calendar.d.ts +29 -0
- package/dist/components/calendar.js +149 -0
- package/dist/components/card.d.ts +47 -19
- package/dist/components/card.js +31 -46
- package/dist/components/carousel.d.ts +28 -0
- package/dist/components/carousel.js +130 -0
- package/dist/components/chart.d.ts +49 -0
- package/dist/components/chart.js +258 -0
- package/dist/components/checkbox-group.d.ts +16 -0
- package/dist/components/checkbox-group.js +13 -0
- package/dist/components/checkbox.d.ts +25 -10
- package/dist/components/checkbox.js +87 -81
- package/dist/components/chip-input.d.ts +46 -20
- package/dist/components/chip-input.js +172 -176
- package/dist/components/chip.d.ts +28 -0
- package/dist/components/chip.js +73 -0
- package/dist/components/choice-card.d.ts +10 -13
- package/dist/components/choice-card.js +11 -62
- package/dist/components/choice-carousel.d.ts +9 -0
- package/dist/components/choice-carousel.js +28 -44
- package/dist/components/choice-preview-card.d.ts +10 -20
- package/dist/components/choice-preview-card.js +12 -40
- package/dist/components/color-input.d.ts +36 -11
- package/dist/components/color-input.js +131 -59
- package/dist/components/combobox.d.ts +60 -57
- package/dist/components/combobox.js +210 -213
- package/dist/components/command.d.ts +58 -0
- package/dist/components/command.js +177 -0
- package/dist/components/contact.d.ts +23 -0
- package/dist/components/contact.js +32 -0
- package/dist/components/context-menu.d.ts +34 -26
- package/dist/components/context-menu.js +41 -68
- package/dist/components/copy-field.d.ts +10 -5
- package/dist/components/copy-field.js +24 -29
- package/dist/components/currency-input.d.ts +25 -11
- package/dist/components/currency-input.js +29 -65
- package/dist/components/danger-zone.d.ts +10 -1
- package/dist/components/danger-zone.js +14 -18
- package/dist/components/data-table-header.d.ts +13 -2
- package/dist/components/data-table-header.js +114 -190
- package/dist/components/date-picker.d.ts +31 -32
- package/dist/components/date-picker.js +119 -254
- package/dist/components/delta.d.ts +26 -0
- package/dist/components/delta.js +24 -0
- package/dist/components/dialog.d.ts +21 -0
- package/dist/components/dialog.js +16 -0
- package/dist/components/drawer.d.ts +15 -23
- package/dist/components/drawer.js +57 -89
- package/dist/components/dropdown-menu.d.ts +63 -0
- package/dist/components/dropdown-menu.js +62 -0
- package/dist/components/dropzone.d.ts +10 -4
- package/dist/components/dropzone.js +30 -58
- package/dist/components/empty.d.ts +29 -0
- package/dist/components/empty.js +42 -0
- package/dist/components/fab.d.ts +29 -6
- package/dist/components/fab.js +51 -51
- package/dist/components/faq.d.ts +21 -0
- package/dist/components/faq.js +24 -0
- package/dist/components/file-input.d.ts +56 -0
- package/dist/components/file-input.js +244 -0
- package/dist/components/filter-chip.d.ts +34 -47
- package/dist/components/filter-chip.js +61 -61
- package/dist/components/floating-stepper.d.ts +7 -18
- package/dist/components/floating-stepper.js +27 -55
- package/dist/components/footer.d.ts +36 -0
- package/dist/components/footer.js +38 -0
- package/dist/components/form-actions.d.ts +28 -0
- package/dist/components/form-actions.js +24 -0
- package/dist/components/google-account-chooser.d.ts +25 -0
- package/dist/components/google-account-chooser.js +44 -0
- package/dist/components/google-button.d.ts +26 -0
- package/dist/components/google-button.js +38 -0
- package/dist/components/google-consent.d.ts +23 -0
- package/dist/components/google-consent.js +28 -0
- package/dist/components/google-sign-in.d.ts +26 -0
- package/dist/components/google-sign-in.js +36 -0
- package/dist/components/hover-card.d.ts +30 -0
- package/dist/components/hover-card.js +55 -0
- package/dist/components/icon-button.d.ts +41 -11
- package/dist/components/icon-button.js +44 -64
- package/dist/components/image-crop-modal.d.ts +3 -3
- package/dist/components/image-crop-modal.js +32 -39
- package/dist/components/image-upload.d.ts +21 -29
- package/dist/components/image-upload.js +55 -259
- package/dist/components/index.d.ts +105 -52
- package/dist/components/index.js +190 -74
- package/dist/components/input-otp.d.ts +35 -0
- package/dist/components/input-otp.js +119 -0
- package/dist/components/input.d.ts +23 -17
- package/dist/components/input.js +104 -137
- package/dist/components/insight-card.d.ts +25 -9
- package/dist/components/insight-card.js +42 -27
- package/dist/components/internal/announce.d.ts +3 -0
- package/dist/components/internal/announce.js +20 -0
- package/dist/components/internal/block.d.ts +15 -0
- package/dist/components/internal/block.js +14 -0
- package/dist/components/internal/button.d.ts +23 -0
- package/dist/components/internal/button.js +30 -0
- package/dist/components/internal/choice-card.d.ts +52 -0
- package/dist/components/internal/choice-card.js +117 -0
- package/dist/components/internal/choice.d.ts +25 -0
- package/dist/components/internal/choice.js +44 -0
- package/dist/components/internal/dates.d.ts +17 -0
- package/dist/components/internal/dates.js +59 -0
- package/dist/components/internal/field.d.ts +66 -0
- package/dist/components/internal/field.js +105 -0
- package/dist/components/internal/fieldset.d.ts +25 -0
- package/dist/components/internal/fieldset.js +56 -0
- package/dist/components/internal/focus-after.d.ts +3 -0
- package/dist/components/internal/focus-after.js +13 -0
- package/dist/components/internal/google.d.ts +47 -0
- package/dist/components/internal/google.js +73 -0
- package/dist/components/internal/icons.d.ts +108 -0
- package/dist/components/internal/icons.js +316 -0
- package/dist/components/internal/menu.d.ts +16 -0
- package/dist/components/internal/menu.js +14 -0
- package/dist/components/internal/modal.d.ts +50 -0
- package/dist/components/internal/modal.js +85 -0
- package/dist/components/internal/option-content.d.ts +10 -0
- package/dist/components/internal/option-content.js +13 -0
- package/dist/components/internal/radio-context.d.ts +16 -0
- package/dist/components/internal/radio-context.js +6 -0
- package/dist/components/internal/toggle.d.ts +7 -0
- package/dist/components/internal/toggle.js +13 -0
- package/dist/components/internal/use-listbox.d.ts +56 -0
- package/dist/components/internal/use-listbox.js +69 -0
- package/dist/components/internal/whatsapp.d.ts +8 -0
- package/dist/components/internal/whatsapp.js +12 -0
- package/dist/components/item.d.ts +32 -0
- package/dist/components/item.js +35 -0
- package/dist/components/kbd.d.ts +17 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/listbox.d.ts +34 -0
- package/dist/components/listbox.js +114 -0
- package/dist/components/marker.d.ts +24 -0
- package/dist/components/marker.js +28 -0
- package/dist/components/media-tile.d.ts +17 -14
- package/dist/components/media-tile.js +19 -27
- package/dist/components/message-scroller.d.ts +20 -0
- package/dist/components/message-scroller.js +108 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +23 -0
- package/dist/components/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu.js +30 -0
- package/dist/components/newsletter.d.ts +27 -0
- package/dist/components/newsletter.js +75 -0
- package/dist/components/number-input.d.ts +60 -0
- package/dist/components/number-input.js +234 -0
- package/dist/components/option-tile.d.ts +20 -19
- package/dist/components/option-tile.js +52 -137
- package/dist/components/page-header.d.ts +31 -0
- package/dist/components/page-header.js +25 -0
- package/dist/components/page-shell.d.ts +11 -1
- package/dist/components/page-shell.js +8 -34
- package/dist/components/page-skeleton.d.ts +15 -21
- package/dist/components/page-skeleton.js +28 -25
- package/dist/components/pagination.d.ts +32 -22
- package/dist/components/pagination.js +78 -76
- package/dist/components/password-input.d.ts +26 -0
- package/dist/components/password-input.js +112 -0
- package/dist/components/phone-input.d.ts +12 -8
- package/dist/components/phone-input.js +75 -64
- package/dist/components/phone.d.ts +27 -0
- package/dist/components/phone.js +35 -0
- package/dist/components/popover.d.ts +25 -36
- package/dist/components/popover.js +30 -131
- package/dist/components/pricing-card.d.ts +9 -25
- package/dist/components/pricing-card.js +9 -40
- package/dist/components/pricing.d.ts +48 -0
- package/dist/components/pricing.js +64 -0
- package/dist/components/progress.d.ts +30 -0
- package/dist/components/progress.js +57 -0
- package/dist/components/qr-display.d.ts +11 -6
- package/dist/components/qr-display.js +6 -22
- package/dist/components/questionnaire.d.ts +42 -0
- package/dist/components/questionnaire.js +107 -0
- package/dist/components/radio-group.d.ts +21 -0
- package/dist/components/radio-group.js +40 -0
- package/dist/components/radio.d.ts +15 -29
- package/dist/components/radio.js +45 -103
- package/dist/components/row-actions.d.ts +5 -0
- package/dist/components/row-actions.js +27 -34
- package/dist/components/saving-bar-context.d.ts +0 -5
- package/dist/components/saving-bar-context.js +16 -40
- package/dist/components/saving-bar.d.ts +26 -11
- package/dist/components/saving-bar.js +50 -65
- package/dist/components/section-card.d.ts +18 -4
- package/dist/components/section-card.js +29 -50
- package/dist/components/section-header.d.ts +8 -12
- package/dist/components/section-header.js +5 -10
- package/dist/components/select.d.ts +44 -16
- package/dist/components/select.js +83 -154
- package/dist/components/selectable-card.d.ts +11 -19
- package/dist/components/selectable-card.js +4 -28
- package/dist/components/separator.d.ts +20 -0
- package/dist/components/separator.js +19 -0
- package/dist/components/setting-row.d.ts +11 -15
- package/dist/components/setting-row.js +10 -23
- package/dist/components/settings-list.d.ts +10 -12
- package/dist/components/settings-list.js +7 -19
- package/dist/components/sheet.d.ts +21 -0
- package/dist/components/sheet.js +16 -0
- package/dist/components/sidebar.d.ts +79 -0
- package/dist/components/sidebar.js +111 -0
- package/dist/components/skeleton.d.ts +14 -20
- package/dist/components/skeleton.js +8 -37
- package/dist/components/slider.d.ts +21 -23
- package/dist/components/slider.js +59 -64
- package/dist/components/sparkline.d.ts +19 -0
- package/dist/components/sparkline.js +32 -0
- package/dist/components/spinner.d.ts +16 -8
- package/dist/components/spinner.js +34 -37
- package/dist/components/star-rating.d.ts +22 -0
- package/dist/components/star-rating.js +25 -0
- package/dist/components/stat.d.ts +33 -0
- package/dist/components/stat.js +29 -0
- package/dist/components/status.d.ts +27 -0
- package/dist/components/status.js +34 -0
- package/dist/components/step-progress.d.ts +13 -6
- package/dist/components/step-progress.js +18 -16
- package/dist/components/summary-bar.d.ts +20 -20
- package/dist/components/summary-bar.js +13 -55
- package/dist/components/switch.d.ts +20 -0
- package/dist/components/switch.js +46 -0
- package/dist/components/table.d.ts +56 -17
- package/dist/components/table.js +59 -58
- package/dist/components/tabs.d.ts +67 -0
- package/dist/components/tabs.js +56 -0
- package/dist/components/testimonial.d.ts +30 -0
- package/dist/components/testimonial.js +36 -0
- package/dist/components/textarea.d.ts +11 -16
- package/dist/components/textarea.js +55 -91
- package/dist/components/tile.d.ts +24 -0
- package/dist/components/tile.js +21 -0
- package/dist/components/time-picker.d.ts +40 -25
- package/dist/components/time-picker.js +185 -203
- package/dist/components/toast.d.ts +63 -0
- package/dist/components/toast.js +132 -0
- package/dist/components/toggle-card-compact.d.ts +15 -5
- package/dist/components/toggle-card-compact.js +19 -86
- package/dist/components/toggle-card.d.ts +11 -2
- package/dist/components/toggle-card.js +8 -77
- package/dist/components/toggle-group.d.ts +21 -59
- package/dist/components/toggle-group.js +31 -80
- package/dist/components/toggle.d.ts +19 -9
- package/dist/components/toggle.js +16 -61
- package/dist/components/tooltip.d.ts +25 -12
- package/dist/components/tooltip.js +15 -88
- package/dist/components/top-navigation.d.ts +33 -0
- package/dist/components/top-navigation.js +85 -0
- package/dist/components/typing-indicator.d.ts +6 -0
- package/dist/components/typing-indicator.js +3 -24
- package/dist/components/whatsapp-chat.d.ts +28 -0
- package/dist/components/whatsapp-chat.js +95 -0
- package/dist/components/whatsapp-message.d.ts +22 -0
- package/dist/components/whatsapp-message.js +34 -0
- package/dist/components/whatsapp-notification.d.ts +27 -0
- package/dist/components/whatsapp-notification.js +73 -0
- package/dist/components/whatsapp-template.d.ts +42 -0
- package/dist/components/whatsapp-template.js +69 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/pix.d.ts +16 -0
- package/dist/targets/native/components/index.d.ts +0 -2
- package/dist/targets/native/components/index.js +0 -4
- package/dist/targets/native/preset.cjs +0 -1
- package/dist/targets/native/theme.css +58 -60
- package/dist/targets/native/theme.d.ts +58 -60
- package/dist/targets/native/theme.js +58 -60
- package/package.json +34 -12
- package/styles/_primitives.generated.css +40 -0
- package/styles/base.css +12 -18
- package/styles/rds/components-styles.css +11365 -0
- package/styles/rds/components.css +993 -0
- package/styles/rds/foundation.css +74 -0
- package/styles/rds/theme.css +261 -0
- package/styles/rds.css +6 -0
- package/styles/themes/rojao.css +46 -53
- package/dist/components/blocker-card.d.ts +0 -42
- package/dist/components/blocker-card.js +0 -54
- package/dist/components/bottom-sheet.d.ts +0 -31
- package/dist/components/bottom-sheet.js +0 -127
- package/dist/components/chat-bubble.d.ts +0 -16
- package/dist/components/chat-bubble.js +0 -56
- package/dist/components/chips.d.ts +0 -22
- package/dist/components/chips.js +0 -101
- package/dist/components/copilot-hint.d.ts +0 -18
- package/dist/components/copilot-hint.js +0 -72
- package/dist/components/divider.d.ts +0 -20
- package/dist/components/divider.js +0 -50
- package/dist/components/empty-state.d.ts +0 -48
- package/dist/components/empty-state.js +0 -94
- package/dist/components/form-card-header.d.ts +0 -13
- package/dist/components/form-card-header.js +0 -16
- package/dist/components/label.d.ts +0 -16
- package/dist/components/label.js +0 -48
- package/dist/components/menu.d.ts +0 -50
- package/dist/components/menu.js +0 -83
- package/dist/components/modal.d.ts +0 -25
- package/dist/components/modal.js +0 -86
- package/dist/components/notice.d.ts +0 -50
- package/dist/components/notice.js +0 -121
- package/dist/components/page-tabs.d.ts +0 -35
- package/dist/components/page-tabs.js +0 -68
- package/dist/components/paywall-banner.d.ts +0 -37
- package/dist/components/paywall-banner.js +0 -58
- package/dist/components/paywall.d.ts +0 -44
- package/dist/components/paywall.js +0 -65
- package/dist/components/phone-frame.d.ts +0 -9
- package/dist/components/phone-frame.js +0 -19
- package/dist/components/pix-icon.d.ts +0 -8
- package/dist/components/search.d.ts +0 -30
- package/dist/components/search.js +0 -86
- package/dist/components/themed.d.ts +0 -36
- package/dist/components/themed.js +0 -23
- package/dist/components/toaster.d.ts +0 -84
- package/dist/components/toaster.js +0 -290
- package/dist/components/use-dismiss.d.ts +0 -9
- package/dist/components/use-dismiss.js +0 -28
- package/dist/components/use-focus-trap.d.ts +0 -5
- package/dist/components/use-focus-trap.js +0 -54
- package/dist/targets/native/components/paywall-banner.d.ts +0 -11
- package/dist/targets/native/components/paywall-banner.js +0 -55
- package/dist/targets/native/components/paywall.d.ts +0 -18
- package/dist/targets/native/components/paywall.js +0 -71
- /package/dist/{components/pix-icon.js → icons/pix.js} +0 -0
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { IsoDate } from './internal/dates.js';
|
|
4
|
+
import { FieldTextProps } from './internal/field.js';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/** Label renderada acima do controle (mesmo padrão do Input do DS). */
|
|
20
|
-
label?: ReactNode;
|
|
21
|
-
value: Date | null;
|
|
22
|
-
onChange: (date: Date | null) => void;
|
|
23
|
-
min?: Date;
|
|
24
|
-
max?: Date;
|
|
25
|
-
placeholder?: string;
|
|
26
|
-
size?: 'sm' | 'md';
|
|
27
|
-
width?: 'full' | 'hug';
|
|
28
|
-
/** locale pra formato. default = 'pt-BR'. */
|
|
29
|
-
locale?: string;
|
|
30
|
-
/** Primeiro dia da semana. default = 1 (segunda). */
|
|
31
|
-
weekStartsOn?: 0 | 1;
|
|
6
|
+
interface DatePickerProps extends FieldTextProps {
|
|
7
|
+
/** Controlled: the date, ISO (2026-09-30), or '' for none (Figma: the Input's `text`). */
|
|
8
|
+
value?: IsoDate;
|
|
9
|
+
/** Uncontrolled: the date at first. */
|
|
10
|
+
defaultValue?: IsoDate;
|
|
11
|
+
/** Called with the ISO date when a valid date is typed or chosen, and with '' when the field is emptied. */
|
|
12
|
+
onValueChange?: (value: IsoDate) => void;
|
|
13
|
+
/** Days that can't be chosen in the calendar. */
|
|
14
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
15
|
+
/** The message when the typed date does not exist (31/02). */
|
|
16
|
+
invalidMessage?: string;
|
|
17
|
+
/** The calendar button's accessible name, also the popover's. */
|
|
18
|
+
pickLabel?: string;
|
|
19
|
+
/** The form field name: a hidden input carries the ISO date. */
|
|
20
|
+
name?: string;
|
|
32
21
|
disabled?: boolean;
|
|
33
|
-
|
|
34
|
-
weekdayLabels?: string[];
|
|
22
|
+
id?: string;
|
|
35
23
|
className?: string;
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
/** The name when there is no visible label. */
|
|
36
26
|
'aria-label'?: string;
|
|
27
|
+
'aria-labelledby'?: string;
|
|
28
|
+
/** Today, for tests and screenshots. */
|
|
29
|
+
today?: IsoDate;
|
|
37
30
|
}
|
|
38
|
-
|
|
31
|
+
/**
|
|
32
|
+
* DatePicker — Figma [RDS] Forms/DatePicker. A date field that takes typing (dd/mm/aaaa, the slashes come by
|
|
33
|
+
* themselves) and, from the calendar button, opens the Calendar in a popover (Figma: `menu`). Choosing a day
|
|
34
|
+
* closes it and gives the focus back to the field; Escape closes without choosing. For a date near today, where
|
|
35
|
+
* seeing the month helps: a birth date is an Input. Styles: date-picker.css, internal/field.css, calendar.css.
|
|
36
|
+
*/
|
|
37
|
+
declare function DatePicker({ label, labelPosition, hint, error, errorMessage, required, value, defaultValue, onValueChange, isDateDisabled, invalidMessage, pickLabel, name, disabled, id, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, today, }: DatePickerProps): react.JSX.Element;
|
|
39
38
|
|
|
40
39
|
export { DatePicker, type DatePickerProps };
|
|
@@ -1,271 +1,136 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"Mar\xE7o",
|
|
12
|
-
"Abril",
|
|
13
|
-
"Maio",
|
|
14
|
-
"Junho",
|
|
15
|
-
"Julho",
|
|
16
|
-
"Agosto",
|
|
17
|
-
"Setembro",
|
|
18
|
-
"Outubro",
|
|
19
|
-
"Novembro",
|
|
20
|
-
"Dezembro"
|
|
21
|
-
];
|
|
22
|
-
const SIZE_CLASS = {
|
|
23
|
-
sm: "h-8 text-caption px-2.5",
|
|
24
|
-
md: "h-10 text-label px-3"
|
|
25
|
-
};
|
|
26
|
-
function startOfDay(d) {
|
|
27
|
-
const x = new Date(d);
|
|
28
|
-
x.setHours(0, 0, 0, 0);
|
|
29
|
-
return x;
|
|
30
|
-
}
|
|
31
|
-
function isSameDay(a, b) {
|
|
32
|
-
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
33
|
-
}
|
|
34
|
-
function addDays(d, n) {
|
|
35
|
-
const r = new Date(d);
|
|
36
|
-
r.setDate(r.getDate() + n);
|
|
37
|
-
return r;
|
|
38
|
-
}
|
|
39
|
-
function buildMonthGrid(year, month, weekStartsOn) {
|
|
40
|
-
const first = new Date(year, month, 1);
|
|
41
|
-
const firstWeekday = first.getDay();
|
|
42
|
-
const offset = (firstWeekday - weekStartsOn + 7) % 7;
|
|
43
|
-
const start = new Date(year, month, 1 - offset);
|
|
44
|
-
const days = [];
|
|
45
|
-
for (let i = 0; i < 42; i++) {
|
|
46
|
-
days.push(new Date(start.getFullYear(), start.getMonth(), start.getDate() + i));
|
|
47
|
-
}
|
|
48
|
-
return days;
|
|
49
|
-
}
|
|
50
|
-
const DatePicker = forwardRef(function DatePicker2({
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
6
|
+
import { Calendar } from "./calendar.js";
|
|
7
|
+
import { formatBr, maskBr, parseBr } from "./internal/dates.js";
|
|
8
|
+
import { FieldAction, FieldShell, useFieldIds, warnIfUnlabelled } from "./internal/field.js";
|
|
9
|
+
import { CalendarIcon } from "./internal/icons.js";
|
|
10
|
+
function DatePicker({
|
|
51
11
|
label,
|
|
12
|
+
labelPosition,
|
|
13
|
+
hint,
|
|
14
|
+
error,
|
|
15
|
+
errorMessage,
|
|
16
|
+
required,
|
|
52
17
|
value,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"aria-
|
|
65
|
-
|
|
66
|
-
|
|
18
|
+
defaultValue = "",
|
|
19
|
+
onValueChange,
|
|
20
|
+
isDateDisabled,
|
|
21
|
+
invalidMessage = "Essa data n\xE3o existe. Use dd/mm/aaaa.",
|
|
22
|
+
pickLabel = "Escolher data",
|
|
23
|
+
name,
|
|
24
|
+
disabled,
|
|
25
|
+
id,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
"aria-label": ariaLabel,
|
|
29
|
+
"aria-labelledby": ariaLabelledBy,
|
|
30
|
+
today
|
|
31
|
+
}) {
|
|
32
|
+
warnIfUnlabelled("DatePicker", label, ariaLabel, ariaLabelledBy);
|
|
33
|
+
const [own, setOwn] = useState(defaultValue);
|
|
34
|
+
const iso = value != null ? value : own;
|
|
35
|
+
const [text, setText] = useState(() => formatBr(iso));
|
|
36
|
+
const [editing, setEditing] = useState(false);
|
|
67
37
|
const [open, setOpen] = useState(false);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, [open, value]);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (!open) setFocusedDate(null);
|
|
83
|
-
}, [open]);
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
var _a;
|
|
86
|
-
if (focusedDate) (_a = activeDayRef.current) == null ? void 0 : _a.focus();
|
|
87
|
-
}, [focusedDate]);
|
|
88
|
-
function isDisabled(date) {
|
|
89
|
-
if (min && startOfDay(date) < startOfDay(min)) return true;
|
|
90
|
-
if (max && startOfDay(date) > startOfDay(max)) return true;
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
function handleSelect(date) {
|
|
94
|
-
if (isDisabled(date)) return;
|
|
95
|
-
onChange(date);
|
|
96
|
-
setOpen(false);
|
|
97
|
-
}
|
|
98
|
-
function handleClear(e) {
|
|
99
|
-
var _a;
|
|
100
|
-
e.stopPropagation();
|
|
101
|
-
onChange(null);
|
|
102
|
-
(_a = triggerRef.current) == null ? void 0 : _a.focus();
|
|
103
|
-
}
|
|
104
|
-
function handleGridKeyDown(e) {
|
|
105
|
-
var _a;
|
|
106
|
-
const base = (_a = focusedDate != null ? focusedDate : value) != null ? _a : new Date(view.year, view.month, 1);
|
|
107
|
-
let next = null;
|
|
108
|
-
if (e.key === "ArrowRight") {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
next = addDays(base, 1);
|
|
111
|
-
} else if (e.key === "ArrowLeft") {
|
|
112
|
-
e.preventDefault();
|
|
113
|
-
next = addDays(base, -1);
|
|
114
|
-
} else if (e.key === "ArrowDown") {
|
|
115
|
-
e.preventDefault();
|
|
116
|
-
next = addDays(base, 7);
|
|
117
|
-
} else if (e.key === "ArrowUp") {
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
next = addDays(base, -7);
|
|
120
|
-
} else if (e.key === "Enter" && focusedDate && !isDisabled(focusedDate)) {
|
|
121
|
-
e.preventDefault();
|
|
122
|
-
handleSelect(focusedDate);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (next) {
|
|
126
|
-
setFocusedDate(next);
|
|
127
|
-
if (next.getMonth() !== view.month || next.getFullYear() !== view.year) {
|
|
128
|
-
setView({ year: next.getFullYear(), month: next.getMonth() });
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function nav(delta) {
|
|
133
|
-
setView(({ year, month }) => {
|
|
134
|
-
const m = month + delta;
|
|
135
|
-
if (m < 0) return { year: year - 1, month: 11 };
|
|
136
|
-
if (m > 11) return { year: year + 1, month: 0 };
|
|
137
|
-
return { year, month: m };
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const tabFocusDate = focusedDate != null ? focusedDate : value;
|
|
141
|
-
const days = buildMonthGrid(view.year, view.month, weekStartsOn);
|
|
142
|
-
const weekdays = weekdayLabels != null ? weekdayLabels : weekStartsOn === 1 ? PT_WEEKDAYS_MON_FIRST : ["D", ...PT_WEEKDAYS_MON_FIRST.slice(0, 6)];
|
|
143
|
-
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
144
|
-
const formatted = value ? value.toLocaleDateString(locale, { day: "2-digit", month: "2-digit", year: "numeric" }) : "";
|
|
145
|
-
const calendar = /* @__PURE__ */ jsxs(
|
|
146
|
-
"div",
|
|
38
|
+
const input = useRef(null);
|
|
39
|
+
const shown = editing ? text : formatBr(iso);
|
|
40
|
+
const nonexistent = shown.length === 10 && !parseBr(shown);
|
|
41
|
+
const message = nonexistent ? invalidMessage : errorMessage;
|
|
42
|
+
const { controlId, hintId, errorId, invalid, describedBy } = useFieldIds(id, hint, error || nonexistent, message);
|
|
43
|
+
const floating = labelPosition === "floating" && Boolean(label);
|
|
44
|
+
const commit = (next) => {
|
|
45
|
+
if (value === void 0) setOwn(next);
|
|
46
|
+
onValueChange == null ? void 0 : onValueChange(next);
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
FieldShell,
|
|
147
50
|
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
51
|
+
kind: "rds-date-picker",
|
|
52
|
+
controlId,
|
|
53
|
+
hintId,
|
|
54
|
+
errorId,
|
|
55
|
+
label,
|
|
56
|
+
labelPosition,
|
|
57
|
+
hint,
|
|
58
|
+
errorMessage: message,
|
|
59
|
+
invalid,
|
|
60
|
+
required,
|
|
61
|
+
disabled,
|
|
62
|
+
boxClassName: "rds-field__box--action",
|
|
63
|
+
className,
|
|
64
|
+
style,
|
|
151
65
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"input",
|
|
68
|
+
{
|
|
69
|
+
ref: input,
|
|
70
|
+
id: controlId,
|
|
71
|
+
className: "rds-field__control",
|
|
72
|
+
inputMode: "numeric",
|
|
73
|
+
autoComplete: "off",
|
|
74
|
+
placeholder: floating ? " " : "dd/mm/aaaa",
|
|
75
|
+
maxLength: 10,
|
|
76
|
+
required,
|
|
77
|
+
disabled,
|
|
78
|
+
"aria-label": ariaLabel,
|
|
79
|
+
"aria-labelledby": ariaLabelledBy,
|
|
80
|
+
"aria-invalid": invalid || void 0,
|
|
81
|
+
"aria-describedby": describedBy,
|
|
82
|
+
value: shown,
|
|
83
|
+
onChange: (event) => {
|
|
84
|
+
const masked = maskBr(event.target.value);
|
|
85
|
+
setText(masked);
|
|
86
|
+
setEditing(true);
|
|
87
|
+
if (masked === "") commit("");
|
|
88
|
+
const parsed = parseBr(masked);
|
|
89
|
+
if (parsed) commit(parsed);
|
|
90
|
+
},
|
|
91
|
+
onBlur: () => {
|
|
92
|
+
if (parseBr(text) || text === "") setEditing(false);
|
|
161
93
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"button",
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: iso }),
|
|
97
|
+
/* @__PURE__ */ jsxs(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
|
|
98
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, disabled, children: /* @__PURE__ */ jsx(FieldAction, { label: pickLabel, icon: /* @__PURE__ */ jsx(CalendarIcon, {}) }) }),
|
|
99
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
100
|
+
PopoverPrimitive.Content,
|
|
170
101
|
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
className: "
|
|
175
|
-
|
|
102
|
+
"aria-label": pickLabel,
|
|
103
|
+
align: "end",
|
|
104
|
+
sideOffset: 4,
|
|
105
|
+
className: "rds-date-picker__popover",
|
|
106
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
107
|
+
onCloseAutoFocus: (event) => {
|
|
108
|
+
var _a;
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
(_a = input.current) == null ? void 0 : _a.focus();
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
Calendar,
|
|
114
|
+
{
|
|
115
|
+
value: iso || null,
|
|
116
|
+
today,
|
|
117
|
+
autoFocus: true,
|
|
118
|
+
isDateDisabled,
|
|
119
|
+
onValueChange: (next) => {
|
|
120
|
+
commit(next);
|
|
121
|
+
setText(formatBr(next));
|
|
122
|
+
setEditing(false);
|
|
123
|
+
setOpen(false);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
)
|
|
176
127
|
}
|
|
177
|
-
)
|
|
178
|
-
] })
|
|
179
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-1", children: weekdays.map((w, i) => /* @__PURE__ */ jsx("div", { className: "text-center text-[10px] font-semibold text-fg-muted uppercase", children: w }, i)) }),
|
|
180
|
-
/* @__PURE__ */ jsx("div", { role: "grid", className: "grid grid-cols-7 gap-1", onKeyDown: handleGridKeyDown, children: days.map((d, i) => {
|
|
181
|
-
const inMonth = d.getMonth() === view.month;
|
|
182
|
-
const isToday = isSameDay(d, today);
|
|
183
|
-
const isSelected = !!value && isSameDay(d, value);
|
|
184
|
-
const isFocused = !!tabFocusDate && isSameDay(d, tabFocusDate);
|
|
185
|
-
const dis = isDisabled(d);
|
|
186
|
-
return /* @__PURE__ */ jsx(
|
|
187
|
-
"button",
|
|
188
|
-
{
|
|
189
|
-
ref: isFocused ? activeDayRef : void 0,
|
|
190
|
-
type: "button",
|
|
191
|
-
role: "gridcell",
|
|
192
|
-
onClick: () => handleSelect(d),
|
|
193
|
-
disabled: dis,
|
|
194
|
-
"aria-selected": isSelected,
|
|
195
|
-
"aria-label": d.toLocaleDateString(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
196
|
-
tabIndex: isFocused ? 0 : -1,
|
|
197
|
-
className: [
|
|
198
|
-
"h-8 rounded text-caption font-medium transition-colors",
|
|
199
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
200
|
-
"disabled:cursor-not-allowed disabled:opacity-30",
|
|
201
|
-
isSelected ? "bg-brand-primary text-brand-on-primary" : isToday ? "border border-stroke-focus text-fg-primary hover:bg-surface-raised" : inMonth ? "text-fg-primary hover:bg-surface-raised" : "text-fg-disabled hover:bg-surface-raised"
|
|
202
|
-
].join(" "),
|
|
203
|
-
children: d.getDate()
|
|
204
|
-
},
|
|
205
|
-
i
|
|
206
|
-
);
|
|
207
|
-
}) })
|
|
128
|
+
) })
|
|
129
|
+
] })
|
|
208
130
|
]
|
|
209
131
|
}
|
|
210
132
|
);
|
|
211
|
-
|
|
212
|
-
/* @__PURE__ */ jsx(
|
|
213
|
-
Popover,
|
|
214
|
-
{
|
|
215
|
-
trigger: /* @__PURE__ */ jsxs(
|
|
216
|
-
"button",
|
|
217
|
-
{
|
|
218
|
-
ref: triggerRef,
|
|
219
|
-
id: triggerId,
|
|
220
|
-
type: "button",
|
|
221
|
-
onClick: (e) => {
|
|
222
|
-
e.stopPropagation();
|
|
223
|
-
if (!disabled) setOpen((o) => !o);
|
|
224
|
-
},
|
|
225
|
-
disabled,
|
|
226
|
-
"aria-label": ariaLabel != null ? ariaLabel : "Selecionar data",
|
|
227
|
-
"aria-haspopup": "dialog",
|
|
228
|
-
"aria-expanded": open,
|
|
229
|
-
className: [
|
|
230
|
-
"w-full flex items-center gap-2 rounded-(--radius-control) border border-stroke-control bg-surface-default",
|
|
231
|
-
"transition-colors focus:outline-none focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
|
|
232
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
233
|
-
value ? "pr-7" : "",
|
|
234
|
-
SIZE_CLASS[size]
|
|
235
|
-
].join(" "),
|
|
236
|
-
children: [
|
|
237
|
-
/* @__PURE__ */ jsx(Calendar, { size: 16, className: "text-fg-muted shrink-0" }),
|
|
238
|
-
/* @__PURE__ */ jsx("span", { className: ["flex-1 text-left truncate", value ? "text-fg-primary" : "text-fg-placeholder"].join(" "), children: formatted || placeholder })
|
|
239
|
-
]
|
|
240
|
-
}
|
|
241
|
-
),
|
|
242
|
-
triggerClassName: width === "full" ? "block w-full" : "inline-block",
|
|
243
|
-
placement: "bottom-start",
|
|
244
|
-
offset: 4,
|
|
245
|
-
open,
|
|
246
|
-
onOpenChange: (v) => {
|
|
247
|
-
if (!disabled) setOpen(v);
|
|
248
|
-
},
|
|
249
|
-
children: () => calendar
|
|
250
|
-
}
|
|
251
|
-
),
|
|
252
|
-
value && !disabled && /* @__PURE__ */ jsx(
|
|
253
|
-
"button",
|
|
254
|
-
{
|
|
255
|
-
type: "button",
|
|
256
|
-
onClick: handleClear,
|
|
257
|
-
"aria-label": "Limpar data",
|
|
258
|
-
className: "absolute right-2 top-1/2 -translate-y-1/2 text-fg-muted hover:text-fg-primary p-0.5 rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
259
|
-
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
260
|
-
}
|
|
261
|
-
)
|
|
262
|
-
] });
|
|
263
|
-
if (!label) return control;
|
|
264
|
-
return /* @__PURE__ */ jsxs("div", { className: ["flex flex-col gap-1.5", width === "full" ? "w-full" : "inline-flex", className].join(" "), children: [
|
|
265
|
-
/* @__PURE__ */ jsx("label", { htmlFor: triggerId, className: "text-label font-medium text-fg-primary", children: label }),
|
|
266
|
-
control
|
|
267
|
-
] });
|
|
268
|
-
});
|
|
133
|
+
}
|
|
269
134
|
export {
|
|
270
135
|
DatePicker
|
|
271
136
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type DeltaDirection = 'up' | 'down' | 'flat';
|
|
5
|
+
/** Whether the change is good (success), bad (danger) or just information (neutral). Not the direction. */
|
|
6
|
+
type DeltaTone = 'neutral' | 'success' | 'danger';
|
|
7
|
+
interface DeltaProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
8
|
+
/** How much it changed, with the unit (Figma: `value`): "24%", "3,5 pp". */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** Where the number went (Figma: `direction`). */
|
|
11
|
+
direction?: DeltaDirection;
|
|
12
|
+
/** Whether that is good: going up is not always good (Figma: `tone`). */
|
|
13
|
+
tone?: DeltaTone;
|
|
14
|
+
/**
|
|
15
|
+
* What a screen reader hears before the value, since the arrow is hidden from it. Defaults to a word for the
|
|
16
|
+
* direction ("Subiu", "Caiu", "Sem mudança"); pass the full sentence when there is context, such as the period.
|
|
17
|
+
*/
|
|
18
|
+
srPrefix?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Delta — Figma [RDS] Indicators/Delta. The change of a number against the previous period: an arrow and the value.
|
|
22
|
+
* Styles: delta.css.
|
|
23
|
+
*/
|
|
24
|
+
declare function Delta({ direction, tone, srPrefix, children, className, ...rest }: DeltaProps): react.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { Delta, type DeltaDirection, type DeltaProps, type DeltaTone };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ArrowDownIcon, ArrowUpIcon, MinusIcon } from "./internal/icons.js";
|
|
8
|
+
const ARROWS = { up: ArrowUpIcon, down: ArrowDownIcon, flat: MinusIcon };
|
|
9
|
+
const SR_PREFIX = { up: "Subiu", down: "Caiu", flat: "Sem mudan\xE7a" };
|
|
10
|
+
function Delta(_a) {
|
|
11
|
+
var _b = _a, { direction = "up", tone = "neutral", srPrefix, children, className } = _b, rest = __objRest(_b, ["direction", "tone", "srPrefix", "children", "className"]);
|
|
12
|
+
const Arrow = ARROWS[direction];
|
|
13
|
+
return /* @__PURE__ */ jsxs("span", __spreadProps(__spreadValues({}, rest), { className: ["rds-delta", `rds-delta--${tone}`, className].filter(Boolean).join(" "), children: [
|
|
14
|
+
/* @__PURE__ */ jsx("span", { className: "rds-delta__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Arrow, {}) }),
|
|
15
|
+
/* @__PURE__ */ jsxs("span", { className: "rds-visually-hidden", children: [
|
|
16
|
+
srPrefix != null ? srPrefix : SR_PREFIX[direction],
|
|
17
|
+
" "
|
|
18
|
+
] }),
|
|
19
|
+
children
|
|
20
|
+
] }));
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
Delta
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ModalProps } from './internal/modal.js';
|
|
4
|
+
|
|
5
|
+
type DialogSize = 'sm' | 'default' | 'lg';
|
|
6
|
+
interface DialogProps extends ModalProps {
|
|
7
|
+
/** sm 400 (a question with one field), default 560 (a short form), lg 720 (a table or a preview). */
|
|
8
|
+
size?: DialogSize;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Dialog — Figma [RDS] Overlays/Dialog. A window over the screen for a short task: create, edit (Radix Dialog).
|
|
12
|
+
* role="dialog", aria-modal, named by the title and described by the description; the focus opens on the first
|
|
13
|
+
* control of the content, stays inside (Tab cycles) and goes back to what opened it. Escape, the × and a click on
|
|
14
|
+
* the veil close it, and the page behind doesn't scroll. Something with no way back is the AlertDialog; a long
|
|
15
|
+
* form is the Sheet. Styles: internal/modal.css and dialog.css.
|
|
16
|
+
*/
|
|
17
|
+
declare function Dialog({ size, ...props }: DialogProps): react.JSX.Element;
|
|
18
|
+
/** Wraps an element inside the Dialog that closes it when pressed, with asChild. */
|
|
19
|
+
declare const DialogClose: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
20
|
+
|
|
21
|
+
export { Dialog, DialogClose, type DialogProps, type DialogSize };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { ModalClose, ModalShell } from "./internal/modal.js";
|
|
8
|
+
function Dialog(_a) {
|
|
9
|
+
var _b = _a, { size = "default" } = _b, props = __objRest(_b, ["size"]);
|
|
10
|
+
return /* @__PURE__ */ jsx(ModalShell, __spreadValues({ prefix: "rds-dialog", modifiers: [`rds-dialog--${size}`] }, props));
|
|
11
|
+
}
|
|
12
|
+
const DialogClose = ModalClose;
|
|
13
|
+
export {
|
|
14
|
+
Dialog,
|
|
15
|
+
DialogClose
|
|
16
|
+
};
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
+
import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
|
|
1
2
|
import * as react from 'react';
|
|
3
|
+
import { ModalProps } from './internal/modal.js';
|
|
2
4
|
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** Largura custom (Tailwind class, ex: "w-96"). Use só se size não atende. */
|
|
16
|
-
width?: string;
|
|
17
|
-
closeOnBackdrop?: boolean;
|
|
18
|
-
hideClose?: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
/** Alvo do portal. default = document.body. Passe um elemento de um subtree TEMATIZADO (ex.: a
|
|
21
|
-
* raiz do tema da loja) pra o drawer herdar tokens/mode/fonte daquele contexto em vez do global. */
|
|
22
|
-
container?: Element | null;
|
|
23
|
-
}
|
|
24
|
-
declare function Drawer({ open, onClose, title, subtitle, children, footer, side, size, width, closeOnBackdrop, hideClose, className, container, }: DrawerProps): react.ReactPortal | null;
|
|
5
|
+
type DrawerProps = ModalProps;
|
|
6
|
+
/**
|
|
7
|
+
* Drawer — Figma [RDS] Overlays/Drawer. The panel that comes up from the bottom, on a phone: filters, quick
|
|
8
|
+
* choices (Radix Dialog). role="dialog", aria-modal, named by the title; the focus stays inside and goes back to
|
|
9
|
+
* what opened it, and the page behind doesn't scroll. It has no ×: dragging the handle down, a tap on the veil,
|
|
10
|
+
* Escape or Cancel close it. The default footer is stacked, the main action first and full width.
|
|
11
|
+
* In 1.x this was the BottomSheet; the 1.x Drawer (from the side) is now the Sheet.
|
|
12
|
+
* Styles: internal/modal.css and drawer.css.
|
|
13
|
+
*/
|
|
14
|
+
declare function Drawer({ open, defaultOpen, onOpenChange, ...props }: DrawerProps): react.JSX.Element;
|
|
15
|
+
/** Wraps an element inside the Drawer that closes it when pressed, with asChild. */
|
|
16
|
+
declare const DrawerClose: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
25
17
|
|
|
26
|
-
export { Drawer,
|
|
18
|
+
export { Drawer, DrawerClose, type DrawerProps };
|