@rojaostudio/ds 1.0.1 → 2.0.0-next.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/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 -87
- 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 +74 -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 -83
- package/dist/components/badge.d.ts +30 -41
- package/dist/components/badge.js +16 -106
- 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 +40 -48
- 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 +51 -107
- 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 +38 -38
- 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 +86 -67
- package/dist/components/chip-input.d.ts +46 -20
- package/dist/components/chip-input.js +171 -158
- 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 -56
- package/dist/components/choice-carousel.d.ts +9 -0
- package/dist/components/choice-carousel.js +67 -78
- package/dist/components/choice-preview-card.d.ts +10 -20
- package/dist/components/choice-preview-card.js +13 -30
- package/dist/components/color-input.d.ts +36 -11
- package/dist/components/color-input.js +139 -61
- package/dist/components/combobox.d.ts +60 -57
- package/dist/components/combobox.js +215 -196
- 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 +43 -66
- package/dist/components/copy-field.d.ts +10 -5
- package/dist/components/copy-field.js +25 -27
- package/dist/components/currency-input.d.ts +25 -11
- package/dist/components/currency-input.js +39 -67
- package/dist/components/danger-zone.d.ts +10 -1
- package/dist/components/danger-zone.js +20 -14
- package/dist/components/data-table-header.d.ts +13 -2
- package/dist/components/data-table-header.js +143 -169
- package/dist/components/date-picker.d.ts +31 -32
- package/dist/components/date-picker.js +126 -242
- 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 +56 -76
- 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 -55
- 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 -39
- 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 -57
- package/dist/components/floating-stepper.d.ts +7 -18
- package/dist/components/floating-stepper.js +17 -35
- 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 +47 -61
- package/dist/components/image-crop-modal.d.ts +3 -3
- package/dist/components/image-crop-modal.js +66 -52
- package/dist/components/image-upload.d.ts +21 -29
- package/dist/components/image-upload.js +59 -219
- package/dist/components/index.d.ts +105 -49
- package/dist/components/index.js +190 -68
- 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 +103 -108
- package/dist/components/insight-card.d.ts +25 -9
- package/dist/components/insight-card.js +45 -19
- 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 -24
- 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 -131
- 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 -27
- package/dist/components/page-skeleton.d.ts +15 -21
- package/dist/components/page-skeleton.js +37 -4
- package/dist/components/pagination.d.ts +32 -22
- package/dist/components/pagination.js +83 -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 +77 -47
- 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 +32 -129
- package/dist/components/pricing-card.d.ts +9 -25
- package/dist/components/pricing-card.js +9 -25
- 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 +8 -19
- 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 +46 -87
- package/dist/components/row-actions.d.ts +5 -0
- package/dist/components/row-actions.js +57 -56
- package/dist/components/saving-bar-context.d.ts +0 -5
- package/dist/components/saving-bar-context.js +16 -34
- package/dist/components/saving-bar.d.ts +26 -11
- package/dist/components/saving-bar.js +53 -65
- package/dist/components/section-card.d.ts +18 -4
- package/dist/components/section-card.js +26 -39
- package/dist/components/section-header.d.ts +8 -12
- package/dist/components/section-header.js +7 -2
- package/dist/components/select.d.ts +44 -16
- package/dist/components/select.js +85 -135
- package/dist/components/selectable-card.d.ts +11 -19
- package/dist/components/selectable-card.js +4 -21
- 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 +11 -14
- package/dist/components/settings-list.d.ts +10 -12
- package/dist/components/settings-list.js +9 -17
- 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 -36
- package/dist/components/slider.d.ts +21 -23
- package/dist/components/slider.js +65 -56
- 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 +35 -32
- 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 +20 -17
- package/dist/components/summary-bar.d.ts +20 -20
- package/dist/components/summary-bar.js +13 -50
- 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 +65 -59
- 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 -75
- 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 +191 -189
- 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 +22 -81
- package/dist/components/toggle-card.d.ts +11 -2
- package/dist/components/toggle-card.js +9 -70
- package/dist/components/toggle-group.d.ts +21 -59
- package/dist/components/toggle-group.js +31 -74
- package/dist/components/toggle.d.ts +19 -9
- package/dist/components/toggle.js +20 -55
- package/dist/components/tooltip.d.ts +25 -12
- package/dist/components/tooltip.js +16 -84
- 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 -21
- 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/icons/pix.js +29 -0
- package/dist/targets/native/components/accordion.js +31 -25
- package/dist/targets/native/components/alert.js +22 -16
- package/dist/targets/native/components/avatar.js +36 -29
- package/dist/targets/native/components/badge.js +4 -3
- package/dist/targets/native/components/button.js +11 -4
- package/dist/targets/native/components/card.js +2 -1
- package/dist/targets/native/components/checkbox.js +18 -15
- package/dist/targets/native/components/chips.js +19 -16
- package/dist/targets/native/components/choice-card.js +29 -23
- package/dist/targets/native/components/context-menu.js +13 -9
- package/dist/targets/native/components/currency-input.js +28 -25
- package/dist/targets/native/components/danger-zone.js +10 -4
- package/dist/targets/native/components/date-picker.js +86 -70
- package/dist/targets/native/components/divider.js +3 -2
- package/dist/targets/native/components/empty-state.js +6 -1
- package/dist/targets/native/components/fab.js +32 -26
- package/dist/targets/native/components/filter-chip.js +9 -8
- package/dist/targets/native/components/form-field.js +20 -10
- package/dist/targets/native/components/form-screen.js +50 -45
- package/dist/targets/native/components/google-icon.js +31 -25
- package/dist/targets/native/components/icon-button.js +6 -4
- package/dist/targets/native/components/icon.js +2 -1
- package/dist/targets/native/components/image-upload.js +59 -50
- package/dist/targets/native/components/index.d.ts +0 -2
- package/dist/targets/native/components/index.js +0 -4
- package/dist/targets/native/components/input.js +41 -34
- package/dist/targets/native/components/list-item.js +29 -23
- package/dist/targets/native/components/menu.js +12 -10
- package/dist/targets/native/components/modal.js +41 -32
- package/dist/targets/native/components/radio.js +19 -16
- package/dist/targets/native/components/search.js +41 -38
- package/dist/targets/native/components/select.js +71 -63
- package/dist/targets/native/components/sheet.js +36 -30
- package/dist/targets/native/components/skeleton.js +6 -5
- package/dist/targets/native/components/slider.js +51 -43
- package/dist/targets/native/components/spinner.js +2 -1
- package/dist/targets/native/components/stepper.js +14 -9
- package/dist/targets/native/components/switch.js +15 -14
- package/dist/targets/native/components/text.js +2 -1
- package/dist/targets/native/components/textarea.js +2 -1
- package/dist/targets/native/components/theme.js +2 -1
- package/dist/targets/native/components/toaster.js +24 -21
- package/dist/targets/native/index.d.ts +1 -1
- package/dist/targets/native/index.js +1 -3
- 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 +35 -16
- package/styles/_primitives.generated.css +40 -0
- package/styles/base.css +15 -21
- 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/brand/rojao-black-on-white.png +0 -0
- package/brand/rojao-black.png +0 -0
- package/brand/rojao-white-on-black.png +0 -0
- package/brand/rojao-white.png +0 -0
- package/dist/components/blocker-card.d.ts +0 -42
- package/dist/components/blocker-card.js +0 -45
- package/dist/components/bottom-sheet.d.ts +0 -31
- package/dist/components/bottom-sheet.js +0 -120
- package/dist/components/chat-bubble.d.ts +0 -16
- package/dist/components/chat-bubble.js +0 -55
- package/dist/components/chips.d.ts +0 -22
- package/dist/components/chips.js +0 -94
- package/dist/components/copilot-hint.d.ts +0 -18
- package/dist/components/copilot-hint.js +0 -63
- package/dist/components/divider.d.ts +0 -20
- package/dist/components/divider.js +0 -47
- package/dist/components/empty-state.d.ts +0 -48
- package/dist/components/empty-state.js +0 -91
- package/dist/components/form-card-header.d.ts +0 -13
- package/dist/components/form-card-header.js +0 -8
- package/dist/components/label.d.ts +0 -16
- package/dist/components/label.js +0 -43
- package/dist/components/menu.d.ts +0 -50
- package/dist/components/menu.js +0 -80
- package/dist/components/modal.d.ts +0 -25
- package/dist/components/modal.js +0 -71
- package/dist/components/notice.d.ts +0 -50
- package/dist/components/notice.js +0 -103
- package/dist/components/page-tabs.d.ts +0 -35
- package/dist/components/page-tabs.js +0 -55
- package/dist/components/paywall-banner.d.ts +0 -37
- package/dist/components/paywall-banner.js +0 -42
- package/dist/components/paywall.d.ts +0 -44
- package/dist/components/paywall.js +0 -55
- package/dist/components/phone-frame.d.ts +0 -9
- package/dist/components/phone-frame.js +0 -18
- package/dist/components/pix-icon.d.ts +0 -8
- package/dist/components/pix-icon.js +0 -24
- package/dist/components/search.d.ts +0 -30
- package/dist/components/search.js +0 -81
- package/dist/components/themed.d.ts +0 -36
- package/dist/components/themed.js +0 -22
- package/dist/components/toaster.d.ts +0 -84
- package/dist/components/toaster.js +0 -284
- 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 -46
- package/dist/targets/native/components/paywall.d.ts +0 -18
- package/dist/targets/native/components/paywall.js +0 -61
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type MessageAlign = 'start' | 'end';
|
|
5
|
+
interface MessageProps extends HTMLAttributes<HTMLElement> {
|
|
6
|
+
/** start: the one answering, avatar on the left; end: the person writing, on the right. */
|
|
7
|
+
align?: MessageAlign;
|
|
8
|
+
/**
|
|
9
|
+
* Who said it (Figma: `showHeader` + `name`). Leave it out, with `time`, in the upper messages of a sequence from
|
|
10
|
+
* the same person: the header goes away.
|
|
11
|
+
*/
|
|
12
|
+
name?: ReactNode;
|
|
13
|
+
/** When, as shown, such as "14:32" (Figma: `time`). */
|
|
14
|
+
time?: ReactNode;
|
|
15
|
+
/** The machine-readable moment, for the `<time>` element (ISO 8601). */
|
|
16
|
+
dateTime?: string;
|
|
17
|
+
/** An Avatar (Figma: `showAvatar`). Leave it out in the upper messages of a sequence. */
|
|
18
|
+
avatar?: ReactNode;
|
|
19
|
+
/** The Bubble (the Figma exposes it: pick its variant there). */
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The actions (Figma: `showFooter` + slot `footer`): neutral ghost IconButtons — copy, try again, rate; edit on
|
|
23
|
+
* the person's own message.
|
|
24
|
+
*/
|
|
25
|
+
footer?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Message — Figma [RDS] Chat/Message. One message of the conversation: avatar, name and time, the Bubble and the
|
|
29
|
+
* actions. Goes in a MessageScroller. Styles: message.css.
|
|
30
|
+
*/
|
|
31
|
+
declare function Message({ align, name, time, dateTime, avatar, children, footer, className, ...rest }: MessageProps): react.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Message, type MessageAlign, type MessageProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function Message(_a) {
|
|
8
|
+
var _b = _a, { align = "start", name, time, dateTime, avatar, children, footer, className } = _b, rest = __objRest(_b, ["align", "name", "time", "dateTime", "avatar", "children", "footer", "className"]);
|
|
9
|
+
return /* @__PURE__ */ jsxs("article", __spreadProps(__spreadValues({}, rest), { className: ["rds-message", `rds-message--${align}`, className].filter(Boolean).join(" "), children: [
|
|
10
|
+
avatar && /* @__PURE__ */ jsx("div", { className: "rds-message__avatar", children: avatar }),
|
|
11
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-message__content", children: [
|
|
12
|
+
(name || time) && /* @__PURE__ */ jsxs("p", { className: "rds-message__header", children: [
|
|
13
|
+
name && /* @__PURE__ */ jsx("span", { className: "rds-message__name", children: name }),
|
|
14
|
+
time && /* @__PURE__ */ jsx("time", { className: "rds-message__time", dateTime, children: time })
|
|
15
|
+
] }),
|
|
16
|
+
children,
|
|
17
|
+
footer && /* @__PURE__ */ jsx("div", { className: "rds-message__footer", children: footer })
|
|
18
|
+
] })
|
|
19
|
+
] }));
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
Message
|
|
23
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface NavigationMenuLink {
|
|
5
|
+
/** The link's name (Figma: .navmenu/link `title`). */
|
|
6
|
+
title: string;
|
|
7
|
+
/** One short phrase under the title (Figma: `showDescription` + `description`). */
|
|
8
|
+
description?: string;
|
|
9
|
+
href: string;
|
|
10
|
+
}
|
|
11
|
+
/** A section: a label that opens a panel of links (Figma: .navmenu/trigger), or a plain link. */
|
|
12
|
+
type NavigationMenuEntry = {
|
|
13
|
+
label: string;
|
|
14
|
+
links: NavigationMenuLink[];
|
|
15
|
+
} | {
|
|
16
|
+
label: string;
|
|
17
|
+
href: string;
|
|
18
|
+
};
|
|
19
|
+
/** A link component that spreads the props it gets onto its element (Next's `Link` does). */
|
|
20
|
+
type NavigationMenuLinkComponent = ComponentType<{
|
|
21
|
+
href: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}>;
|
|
25
|
+
interface NavigationMenuProps {
|
|
26
|
+
/** The sections, in order (Figma: the `items` slot). A panel holds up to eight links (Figma: the `links` slot). */
|
|
27
|
+
items: NavigationMenuEntry[];
|
|
28
|
+
/** The nav's name ("Principal"). */
|
|
29
|
+
'aria-label': string;
|
|
30
|
+
/** The link element (default `<a>`). Pass a framework Link (Next's `Link`) to navigate on the client. */
|
|
31
|
+
linkAs?: NavigationMenuLinkComponent;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* NavigationMenu — Figma [RDS] Navigation/NavigationMenu. The site's top links that open a panel of sub-links, on
|
|
36
|
+
* desktop (Radix NavigationMenu). Click, Enter, Space and hover open a panel; Esc closes it and gives the focus back
|
|
37
|
+
* to its trigger; the arrows move between the items. Inside the signed-in product, the navigation is the Sidebar.
|
|
38
|
+
* Styles: navigation-menu.css.
|
|
39
|
+
*/
|
|
40
|
+
declare function NavigationMenu({ items, linkAs: Link, className, ...rest }: NavigationMenuProps): react.JSX.Element;
|
|
41
|
+
|
|
42
|
+
export { NavigationMenu, type NavigationMenuEntry, type NavigationMenuLink, type NavigationMenuLinkComponent, type NavigationMenuProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import * as Nav from "@radix-ui/react-navigation-menu";
|
|
9
|
+
import { ChevronDownIcon } from "./internal/icons.js";
|
|
10
|
+
function Anchor(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx("a", __spreadValues({}, props));
|
|
12
|
+
}
|
|
13
|
+
function NavigationMenu(_a) {
|
|
14
|
+
var _b = _a, { items, linkAs: Link = Anchor, className } = _b, rest = __objRest(_b, ["items", "linkAs", "className"]);
|
|
15
|
+
return /* @__PURE__ */ jsx(Nav.Root, __spreadProps(__spreadValues({}, rest), { className: ["rds-navmenu", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx(Nav.List, { className: "rds-navmenu__items", children: items.map(
|
|
16
|
+
(item) => "links" in item ? /* @__PURE__ */ jsxs(Nav.Item, { className: "rds-navmenu__item", children: [
|
|
17
|
+
/* @__PURE__ */ jsxs(Nav.Trigger, { className: "rds-navmenu__trigger", children: [
|
|
18
|
+
item.label,
|
|
19
|
+
/* @__PURE__ */ jsx("span", { className: "rds-navmenu__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) })
|
|
20
|
+
] }),
|
|
21
|
+
/* @__PURE__ */ jsx(Nav.Content, { className: "rds-navmenu__panel", children: /* @__PURE__ */ jsx("ul", { className: "rds-navmenu__links", children: item.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Nav.Link, { asChild: true, children: /* @__PURE__ */ jsxs(Link, { href: link.href, className: "rds-navmenu__link", children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: "rds-navmenu__link-title", children: link.title }),
|
|
23
|
+
link.description && /* @__PURE__ */ jsx("span", { className: "rds-navmenu__link-description", children: link.description })
|
|
24
|
+
] }) }) }, link.href)) }) })
|
|
25
|
+
] }, item.label) : /* @__PURE__ */ jsx(Nav.Item, { className: "rds-navmenu__item", children: /* @__PURE__ */ jsx(Nav.Link, { asChild: true, children: /* @__PURE__ */ jsx(Link, { href: item.href, className: "rds-navmenu__trigger", children: item.label }) }) }, item.label)
|
|
26
|
+
) }) }));
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
NavigationMenu
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, FormEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
interface NewsletterProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'onSubmit'> {
|
|
5
|
+
/** The block's title, an h2 that names the section and the form (Figma: `title`). */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** A line under the form: what the person gets, how to cancel (Figma: `note`). */
|
|
9
|
+
note?: ReactNode;
|
|
10
|
+
/** The field's name, off screen but read (the Figma shows only the placeholder). */
|
|
11
|
+
inputLabel?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** The button's verb. */
|
|
14
|
+
submitLabel?: string;
|
|
15
|
+
/** The message when the e-mail does not look valid. */
|
|
16
|
+
invalidMessage?: string;
|
|
17
|
+
/** Runs with the e-mail when it looks valid; otherwise the field shows `invalidMessage`. */
|
|
18
|
+
onSubscribe: (email: string, event: FormEvent<HTMLFormElement>) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Newsletter — Figma [RDS] Blocks/Newsletter. A call to subscribe by e-mail, centred on the page: title, sentence,
|
|
22
|
+
* the field with the button and a note. Below 640 of container width the field and the button stack (Figma:
|
|
23
|
+
* `screen`). Styles: newsletter.css.
|
|
24
|
+
*/
|
|
25
|
+
declare function Newsletter({ title, description, note, inputLabel, placeholder, submitLabel, invalidMessage, onSubscribe, className, ...rest }: NewsletterProps): react.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { Newsletter, type NewsletterProps };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useId, useState } from "react";
|
|
9
|
+
import { Button } from "./button.js";
|
|
10
|
+
import { Input } from "./input.js";
|
|
11
|
+
import { BlockHeading } from "./internal/block.js";
|
|
12
|
+
const LOOKS_LIKE_EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
13
|
+
function Newsletter(_a) {
|
|
14
|
+
var _b = _a, {
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
note,
|
|
18
|
+
inputLabel = "E-mail",
|
|
19
|
+
placeholder = "nome@empresa.com.br",
|
|
20
|
+
submitLabel = "Assinar",
|
|
21
|
+
invalidMessage = "Falta o @ ou o dom\xEDnio. Exemplo: nome@empresa.com.br",
|
|
22
|
+
onSubscribe,
|
|
23
|
+
className
|
|
24
|
+
} = _b, rest = __objRest(_b, [
|
|
25
|
+
"title",
|
|
26
|
+
"description",
|
|
27
|
+
"note",
|
|
28
|
+
"inputLabel",
|
|
29
|
+
"placeholder",
|
|
30
|
+
"submitLabel",
|
|
31
|
+
"invalidMessage",
|
|
32
|
+
"onSubscribe",
|
|
33
|
+
"className"
|
|
34
|
+
]);
|
|
35
|
+
const titleId = useId();
|
|
36
|
+
const [error, setError] = useState(false);
|
|
37
|
+
return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({ "aria-labelledby": titleId }, rest), { className: ["rds-block", "rds-newsletter", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs("div", { className: "rds-block__inner", children: [
|
|
38
|
+
/* @__PURE__ */ jsx(BlockHeading, { title, description, titleId }),
|
|
39
|
+
/* @__PURE__ */ jsxs(
|
|
40
|
+
"form",
|
|
41
|
+
{
|
|
42
|
+
className: "rds-newsletter__form",
|
|
43
|
+
"aria-labelledby": titleId,
|
|
44
|
+
noValidate: true,
|
|
45
|
+
onSubmit: (event) => {
|
|
46
|
+
var _a2;
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
const email = String((_a2 = new FormData(event.currentTarget).get("email")) != null ? _a2 : "").trim();
|
|
49
|
+
const valid = LOOKS_LIKE_EMAIL.test(email);
|
|
50
|
+
setError(!valid);
|
|
51
|
+
if (valid) onSubscribe(email, event);
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx("div", { className: "rds-newsletter__field", children: /* @__PURE__ */ jsx(
|
|
55
|
+
Input,
|
|
56
|
+
{
|
|
57
|
+
name: "email",
|
|
58
|
+
type: "email",
|
|
59
|
+
autoComplete: "email",
|
|
60
|
+
"aria-label": inputLabel,
|
|
61
|
+
placeholder,
|
|
62
|
+
errorMessage: error ? invalidMessage : void 0,
|
|
63
|
+
onChange: () => error && setError(false)
|
|
64
|
+
}
|
|
65
|
+
) }),
|
|
66
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", children: submitLabel })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
note && /* @__PURE__ */ jsx("p", { className: "rds-newsletter__note", children: note })
|
|
71
|
+
] }) }));
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
Newsletter
|
|
75
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { FieldTextProps } from './internal/field.js';
|
|
4
|
+
|
|
5
|
+
interface NumberInputStep {
|
|
6
|
+
/** The value the chip sets. */
|
|
7
|
+
value: number;
|
|
8
|
+
/** What the chip says. By default the value with the unit ("500 un"). */
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
interface NumberInputProps extends Omit<FieldTextProps, 'labelPosition'> {
|
|
12
|
+
/** Controlled: the number (Figma: `value`), or null for none. */
|
|
13
|
+
value?: number | null;
|
|
14
|
+
/** Uncontrolled: the number at first. */
|
|
15
|
+
defaultValue?: number | null;
|
|
16
|
+
/**
|
|
17
|
+
* Called with the new number, after `debounce` ms without another change (a run of + presses sends one value).
|
|
18
|
+
* null when the field is emptied.
|
|
19
|
+
*/
|
|
20
|
+
onChange?: (value: number | null) => void;
|
|
21
|
+
/** The smallest value: at it the − turns off (Figma: limit=min). Also the base of the steps. */
|
|
22
|
+
min?: number;
|
|
23
|
+
/** The largest value: at it the + turns off (Figma: limit=max). */
|
|
24
|
+
max?: number;
|
|
25
|
+
/** How much − and + move, and the multiples the value snaps to, counted from `min`. */
|
|
26
|
+
step?: number;
|
|
27
|
+
/** After the number (Figma: `showUnit` + `unit`): un, kg, cx. Read with the value when it is text. */
|
|
28
|
+
unit?: ReactNode;
|
|
29
|
+
/** Named steps under the field (Figma: `showPresets`), as FilterChips: the lots of the domain (500 un, 1000 un). */
|
|
30
|
+
steps?: (number | NumberInputStep)[];
|
|
31
|
+
/** The name of the steps' group. */
|
|
32
|
+
stepsLabel?: string;
|
|
33
|
+
/** Milliseconds without a change before `onChange` fires. 0 sends every change at once. */
|
|
34
|
+
debounce?: number;
|
|
35
|
+
/** The − button's name. */
|
|
36
|
+
decrementLabel?: string;
|
|
37
|
+
/** The + button's name. */
|
|
38
|
+
incrementLabel?: string;
|
|
39
|
+
/** The form field name: a hidden input carries the number. */
|
|
40
|
+
name?: string;
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
id?: string;
|
|
44
|
+
className?: string;
|
|
45
|
+
style?: CSSProperties;
|
|
46
|
+
/** The name when there is no visible label. */
|
|
47
|
+
'aria-label'?: string;
|
|
48
|
+
'aria-labelledby'?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* NumberInput — Figma [RDS] Forms/NumberInput (rojaostudio/ds#9). A number with − and + in the same frame, segments
|
|
52
|
+
* split by an inner border: for small whole quantities moved a little at a time (items in a cart, people in a
|
|
53
|
+
* booking, instalments). The number in the middle is typed; the field is a spinbutton, so the arrows move it (Page
|
|
54
|
+
* Up/Down by ten steps, Home/End to the limits) and − and + stay out of the Tab order. At a limit its button turns
|
|
55
|
+
* off. A price, a CPF or a CEP is the Input; a continuous range, the Slider; the steps of a flow, the
|
|
56
|
+
* FloatingStepper. Styles: number-input.css and internal/field.css.
|
|
57
|
+
*/
|
|
58
|
+
declare function NumberInput({ label, hint, error, errorMessage, required, value, defaultValue, onChange, min, max, step, unit, steps, stepsLabel, debounce, decrementLabel, incrementLabel, name, placeholder, disabled, id, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NumberInputProps): react.JSX.Element;
|
|
59
|
+
|
|
60
|
+
export { NumberInput, type NumberInputProps, type NumberInputStep };
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { FilterChip, FilterChipGroup } from "./filter-chip.js";
|
|
6
|
+
import { FieldAction, FieldShell, useFieldIds, warnIfUnlabelled } from "./internal/field.js";
|
|
7
|
+
import { MinusIcon, PlusIcon } from "./internal/icons.js";
|
|
8
|
+
const decimals = (n) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
return Number.isInteger(n) ? 0 : (_b = (_a = String(n).split(".")[1]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
11
|
+
};
|
|
12
|
+
const parse = (text) => {
|
|
13
|
+
const clean = text.trim().replace(/\s/g, "").replace(",", ".");
|
|
14
|
+
if (clean === "" || clean === "-") return null;
|
|
15
|
+
const n = Number(clean);
|
|
16
|
+
return Number.isFinite(n) ? n : NaN;
|
|
17
|
+
};
|
|
18
|
+
function NumberInput({
|
|
19
|
+
label,
|
|
20
|
+
hint,
|
|
21
|
+
error,
|
|
22
|
+
errorMessage,
|
|
23
|
+
required,
|
|
24
|
+
value,
|
|
25
|
+
defaultValue = null,
|
|
26
|
+
onChange,
|
|
27
|
+
min,
|
|
28
|
+
max,
|
|
29
|
+
step = 1,
|
|
30
|
+
unit,
|
|
31
|
+
steps,
|
|
32
|
+
stepsLabel = "Valores sugeridos",
|
|
33
|
+
debounce = 300,
|
|
34
|
+
decrementLabel = "Diminuir",
|
|
35
|
+
incrementLabel = "Aumentar",
|
|
36
|
+
name,
|
|
37
|
+
placeholder,
|
|
38
|
+
disabled,
|
|
39
|
+
id,
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
"aria-labelledby": ariaLabelledBy
|
|
44
|
+
}) {
|
|
45
|
+
var _a;
|
|
46
|
+
warnIfUnlabelled("NumberInput", label, ariaLabel, ariaLabelledBy);
|
|
47
|
+
const { controlId, hintId, errorId, invalid, describedBy } = useFieldIds(id, hint, error, errorMessage);
|
|
48
|
+
const places = Math.max(decimals(step), decimals(min != null ? min : 0));
|
|
49
|
+
const format = (n) => n === null ? "" : n.toLocaleString("pt-BR", { minimumFractionDigits: 0, maximumFractionDigits: places, useGrouping: false });
|
|
50
|
+
const [current, setCurrent] = useState(value !== void 0 ? value : defaultValue);
|
|
51
|
+
const [text, setText] = useState(() => format(current));
|
|
52
|
+
const [editing, setEditing] = useState(false);
|
|
53
|
+
const timer = useRef(void 0);
|
|
54
|
+
const pending = useRef(false);
|
|
55
|
+
const input = useRef(null);
|
|
56
|
+
const latest = useRef(current);
|
|
57
|
+
latest.current = current;
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (value === void 0 || pending.current) return;
|
|
60
|
+
setCurrent(value);
|
|
61
|
+
}, [value]);
|
|
62
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
63
|
+
const clamp = (n) => Math.min(max != null ? max : Infinity, Math.max(min != null ? min : -Infinity, n));
|
|
64
|
+
const round = (n) => Number(n.toFixed(places));
|
|
65
|
+
function emit(next) {
|
|
66
|
+
latest.current = next;
|
|
67
|
+
setCurrent(next);
|
|
68
|
+
clearTimeout(timer.current);
|
|
69
|
+
if (debounce <= 0) {
|
|
70
|
+
onChange == null ? void 0 : onChange(next);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
pending.current = true;
|
|
74
|
+
timer.current = setTimeout(() => {
|
|
75
|
+
pending.current = false;
|
|
76
|
+
onChange == null ? void 0 : onChange(next);
|
|
77
|
+
}, debounce);
|
|
78
|
+
}
|
|
79
|
+
function nudge(direction, times = 1, start = latest.current) {
|
|
80
|
+
const base = min != null ? min : 0;
|
|
81
|
+
const from = start != null ? start : direction > 0 ? (min != null ? min : 0) - step : (max != null ? max : 0) + step;
|
|
82
|
+
const k = (from - base) / step;
|
|
83
|
+
const epsilon = 1e-9;
|
|
84
|
+
const target = direction > 0 ? Math.floor(k + epsilon) + times : Math.ceil(k - epsilon) - times;
|
|
85
|
+
const next = clamp(round(base + target * step));
|
|
86
|
+
setEditing(false);
|
|
87
|
+
if (next !== latest.current) emit(next);
|
|
88
|
+
}
|
|
89
|
+
function commitText() {
|
|
90
|
+
setEditing(false);
|
|
91
|
+
const parsed = parse(text);
|
|
92
|
+
if (parsed === null) {
|
|
93
|
+
if (current !== null) emit(null);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (Number.isNaN(parsed)) return;
|
|
97
|
+
const next = clamp(round(parsed));
|
|
98
|
+
if (next !== current) emit(next);
|
|
99
|
+
}
|
|
100
|
+
function keyDown(event) {
|
|
101
|
+
const typed = editing ? parse(text) : current;
|
|
102
|
+
const start = typed === null || Number.isNaN(typed) ? current : clamp(round(typed));
|
|
103
|
+
const moves = {
|
|
104
|
+
ArrowUp: () => nudge(1, 1, start),
|
|
105
|
+
ArrowDown: () => nudge(-1, 1, start),
|
|
106
|
+
PageUp: () => nudge(1, 10, start),
|
|
107
|
+
PageDown: () => nudge(-1, 10, start),
|
|
108
|
+
Home: () => min !== void 0 && emit(min),
|
|
109
|
+
End: () => max !== void 0 && emit(max)
|
|
110
|
+
};
|
|
111
|
+
const move = moves[event.key];
|
|
112
|
+
if (move) {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
setEditing(false);
|
|
115
|
+
move();
|
|
116
|
+
} else if (event.key === "Enter") {
|
|
117
|
+
commitText();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const atMin = min !== void 0 && current !== null && current <= min;
|
|
121
|
+
const atMax = max !== void 0 && current !== null && current >= max;
|
|
122
|
+
const shown = editing ? text : format(current);
|
|
123
|
+
const unitText = typeof unit === "string" || typeof unit === "number" ? String(unit) : void 0;
|
|
124
|
+
const presets = (steps != null ? steps : []).map((s) => typeof s === "number" ? { value: s } : s);
|
|
125
|
+
const button = (direction) => /* @__PURE__ */ jsx(
|
|
126
|
+
FieldAction,
|
|
127
|
+
{
|
|
128
|
+
label: direction > 0 ? incrementLabel : decrementLabel,
|
|
129
|
+
icon: direction > 0 ? /* @__PURE__ */ jsx(PlusIcon, {}) : /* @__PURE__ */ jsx(MinusIcon, {}),
|
|
130
|
+
tabIndex: -1,
|
|
131
|
+
disabled: disabled || (direction > 0 ? atMax : atMin),
|
|
132
|
+
onMouseDown: (event) => {
|
|
133
|
+
var _a2;
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
(_a2 = input.current) == null ? void 0 : _a2.focus();
|
|
136
|
+
},
|
|
137
|
+
onClick: () => nudge(direction)
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
return /* @__PURE__ */ jsxs(
|
|
141
|
+
FieldShell,
|
|
142
|
+
{
|
|
143
|
+
kind: "rds-number-input",
|
|
144
|
+
controlId,
|
|
145
|
+
hintId,
|
|
146
|
+
errorId,
|
|
147
|
+
label,
|
|
148
|
+
hint,
|
|
149
|
+
errorMessage,
|
|
150
|
+
invalid,
|
|
151
|
+
required,
|
|
152
|
+
disabled,
|
|
153
|
+
boxClassName: "rds-number-input__box",
|
|
154
|
+
className,
|
|
155
|
+
style,
|
|
156
|
+
afterBox: presets.length > 0 && /* @__PURE__ */ jsx(FilterChipGroup, { "aria-label": stepsLabel, className: "rds-number-input__steps", children: presets.map((preset) => {
|
|
157
|
+
var _a2;
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
FilterChip,
|
|
160
|
+
{
|
|
161
|
+
active: current === preset.value,
|
|
162
|
+
disabled,
|
|
163
|
+
onActiveChange: () => {
|
|
164
|
+
setEditing(false);
|
|
165
|
+
if (current !== preset.value) emit(clamp(preset.value));
|
|
166
|
+
},
|
|
167
|
+
children: (_a2 = preset.label) != null ? _a2 : unitText ? `${format(preset.value)} ${unitText}` : format(preset.value)
|
|
168
|
+
},
|
|
169
|
+
preset.value
|
|
170
|
+
);
|
|
171
|
+
}) }),
|
|
172
|
+
children: [
|
|
173
|
+
button(-1),
|
|
174
|
+
/* @__PURE__ */ jsx("span", { className: "rds-number-input__divider", "aria-hidden": "true" }),
|
|
175
|
+
/* @__PURE__ */ jsxs(
|
|
176
|
+
"span",
|
|
177
|
+
{
|
|
178
|
+
className: "rds-number-input__value",
|
|
179
|
+
onMouseDown: (event) => {
|
|
180
|
+
var _a2;
|
|
181
|
+
if (event.target !== input.current) {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
(_a2 = input.current) == null ? void 0 : _a2.focus();
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
"input",
|
|
189
|
+
{
|
|
190
|
+
ref: input,
|
|
191
|
+
id: controlId,
|
|
192
|
+
className: "rds-field__control",
|
|
193
|
+
type: "text",
|
|
194
|
+
role: "spinbutton",
|
|
195
|
+
inputMode: places > 0 || (min != null ? min : 0) < 0 ? "decimal" : "numeric",
|
|
196
|
+
autoComplete: "off",
|
|
197
|
+
size: Math.max(1, shown.length || ((_a = placeholder == null ? void 0 : placeholder.length) != null ? _a : 1)),
|
|
198
|
+
"aria-valuenow": current != null ? current : void 0,
|
|
199
|
+
"aria-valuemin": min,
|
|
200
|
+
"aria-valuemax": max,
|
|
201
|
+
"aria-valuetext": current !== null && unitText ? `${format(current)} ${unitText}` : void 0,
|
|
202
|
+
"aria-label": ariaLabel,
|
|
203
|
+
"aria-labelledby": ariaLabelledBy,
|
|
204
|
+
"aria-invalid": invalid || void 0,
|
|
205
|
+
"aria-describedby": describedBy,
|
|
206
|
+
"aria-required": required || void 0,
|
|
207
|
+
required,
|
|
208
|
+
disabled,
|
|
209
|
+
placeholder,
|
|
210
|
+
value: shown,
|
|
211
|
+
onChange: (event) => {
|
|
212
|
+
setText(event.target.value.replace(/[^\d,.\-\s]/g, ""));
|
|
213
|
+
setEditing(true);
|
|
214
|
+
},
|
|
215
|
+
onKeyDown: keyDown,
|
|
216
|
+
onBlur: () => {
|
|
217
|
+
if (editing) commitText();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
unit !== void 0 && unit !== null && unit !== "" && /* @__PURE__ */ jsx("span", { className: "rds-number-input__unit", "aria-hidden": "true", children: unit })
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ jsx("span", { className: "rds-number-input__divider", "aria-hidden": "true" }),
|
|
226
|
+
button(1),
|
|
227
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: current != null ? current : "" })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
NumberInput
|
|
234
|
+
};
|
|
@@ -1,45 +1,41 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, KeyboardEvent } from 'react';
|
|
3
|
-
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
import { ReactNode, KeyboardEvent, ComponentType } from 'react';
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* OptionTile / OptionTileGrid — grade de escolha única (onboarding #449).
|
|
7
|
-
*
|
|
8
|
-
* MESMA FAMÍLIA visual do ChoiceCard (os dois single-choice): casca idle suave
|
|
9
|
-
* (borda 1px border-default, hover border-strong) e selecionado = fill SÓLIDO
|
|
10
|
-
* derivado da camada semântica de seleção (--selection-fill-active). Baixa visão:
|
|
11
|
-
* a seleção é distinguível por mais que cor — fill de alto contraste + check
|
|
12
|
-
* redundante (badge on-fill, glifo fill), nunca só um realce sutil. Todo conteúdo
|
|
13
|
-
* sobre o fill ativo usa tokens de contraste próprios (*-active → on-fill), nunca
|
|
14
|
-
* os tokens de superfície clara.
|
|
15
|
-
*
|
|
16
|
-
* Acessibilidade: OptionTileGrid é um radiogroup com roving tabindex — só um tile é
|
|
17
|
-
* tabbable; setas movem foco E seleção (padrão ARIA), Home/End vão às pontas.
|
|
18
|
-
*/
|
|
4
|
+
/** @deprecated Use ChoiceCardProps. */
|
|
19
5
|
interface OptionTileProps {
|
|
20
6
|
selected: boolean;
|
|
21
7
|
label: string;
|
|
22
8
|
onClick: () => void;
|
|
23
9
|
icon?: ReactNode;
|
|
24
10
|
disabled?: boolean;
|
|
11
|
+
/** true: a checkbox (several chosen); false: a radio (one at a time). */
|
|
25
12
|
multiple?: boolean;
|
|
26
13
|
tabIndex?: number;
|
|
14
|
+
/** Ignored: the native radio handles the keyboard. */
|
|
27
15
|
onKeyDown?: (e: KeyboardEvent<HTMLButtonElement>) => void;
|
|
16
|
+
/** Ignored: the control is an <input>, not a <button>. */
|
|
28
17
|
buttonRef?: (el: HTMLButtonElement | null) => void;
|
|
18
|
+
/** Takes the whole line of the grid. */
|
|
29
19
|
fullSpan?: boolean;
|
|
30
20
|
className?: string;
|
|
31
21
|
}
|
|
32
|
-
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use ChoiceCard with layout="tile" (Figma [RDS] Content/ChoiceCard). A thin wrapper over it: `label` is
|
|
24
|
+
* the children, `onClick` is `onSelect`. A native radio (a checkbox with `multiple`), no longer a button.
|
|
25
|
+
*/
|
|
26
|
+
declare function OptionTile({ selected, label, onClick, icon, disabled, multiple, tabIndex, fullSpan, className }: OptionTileProps): react.JSX.Element;
|
|
27
|
+
/** @deprecated Use ChoiceCardGroup's items. */
|
|
33
28
|
interface OptionTileItem<T extends string = string> {
|
|
34
29
|
value: T;
|
|
35
30
|
label: string;
|
|
36
|
-
icon
|
|
31
|
+
/** An icon component (lucide or your own); absent, the tile is text only. */
|
|
32
|
+
icon?: ComponentType;
|
|
37
33
|
fullSpan?: boolean;
|
|
38
34
|
}
|
|
39
35
|
interface OptionTileGridBase<T extends string = string> {
|
|
40
36
|
label?: ReactNode;
|
|
41
37
|
options: OptionTileItem<T>[];
|
|
42
|
-
/**
|
|
38
|
+
/** Ignored: the grid fits as many 160 cells as the width allows. */
|
|
43
39
|
columns?: 2 | 3;
|
|
44
40
|
className?: string;
|
|
45
41
|
'aria-label'?: string;
|
|
@@ -54,7 +50,12 @@ type OptionTileGridMulti<T extends string = string> = OptionTileGridBase<T> & {
|
|
|
54
50
|
value: T[];
|
|
55
51
|
onChange: (value: T[]) => void;
|
|
56
52
|
};
|
|
53
|
+
/** @deprecated Use ChoiceCardGroupProps. */
|
|
57
54
|
type OptionTileGridProps<T extends string = string> = OptionTileGridSingle<T> | OptionTileGridMulti<T>;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use ChoiceCardGroup with layout="tile". A thin wrapper over it: `label` (or `aria-label`) is the legend.
|
|
57
|
+
* With `multiple` the tiles are checkboxes, each toggling its value in the list.
|
|
58
|
+
*/
|
|
58
59
|
declare function OptionTileGrid<T extends string = string>(props: OptionTileGridProps<T>): react.JSX.Element;
|
|
59
60
|
|
|
60
61
|
export { OptionTile, OptionTileGrid, type OptionTileGridProps, type OptionTileItem, type OptionTileProps };
|