@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,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import {
|
|
5
|
+
createContext,
|
|
6
|
+
useContext,
|
|
7
|
+
useEffect,
|
|
8
|
+
useId,
|
|
9
|
+
useLayoutEffect,
|
|
10
|
+
useRef,
|
|
11
|
+
useState
|
|
12
|
+
} from "react";
|
|
13
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
14
|
+
import { SearchIcon } from "./internal/icons.js";
|
|
15
|
+
import { MenuItemContent, menuItemClassName } from "./internal/menu.js";
|
|
16
|
+
const CommandContext = createContext(null);
|
|
17
|
+
function useCommand(part) {
|
|
18
|
+
const ctx = useContext(CommandContext);
|
|
19
|
+
if (!ctx) throw new Error(`${part} must be inside a Command`);
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
const normalize = (text) => text.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase();
|
|
23
|
+
const OPTION = '[role="option"]:not([aria-disabled="true"])';
|
|
24
|
+
function Command({
|
|
25
|
+
trigger,
|
|
26
|
+
open,
|
|
27
|
+
defaultOpen,
|
|
28
|
+
onOpenChange,
|
|
29
|
+
query: queryProp,
|
|
30
|
+
defaultQuery = "",
|
|
31
|
+
onQueryChange,
|
|
32
|
+
placeholder = "Buscar ou ir para\u2026",
|
|
33
|
+
children,
|
|
34
|
+
emptyMessage = "Nenhum resultado",
|
|
35
|
+
hotkey = true,
|
|
36
|
+
label = "Comandos",
|
|
37
|
+
container
|
|
38
|
+
}) {
|
|
39
|
+
const [ownOpen, setOwnOpen] = useState(defaultOpen != null ? defaultOpen : false);
|
|
40
|
+
const isOpen = open != null ? open : ownOpen;
|
|
41
|
+
const [ownQuery, setOwnQuery] = useState(defaultQuery);
|
|
42
|
+
const query = queryProp != null ? queryProp : ownQuery;
|
|
43
|
+
const [activeId, setActiveId] = useState(null);
|
|
44
|
+
const [count, setCount] = useState(0);
|
|
45
|
+
const listRef = useRef(null);
|
|
46
|
+
const listId = useId();
|
|
47
|
+
const setQuery = (next) => {
|
|
48
|
+
setOwnQuery(next);
|
|
49
|
+
onQueryChange == null ? void 0 : onQueryChange(next);
|
|
50
|
+
};
|
|
51
|
+
const setOpen = (next) => {
|
|
52
|
+
setOwnOpen(next);
|
|
53
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
54
|
+
if (!next) setQuery("");
|
|
55
|
+
};
|
|
56
|
+
const toggle = useRef(() => {
|
|
57
|
+
});
|
|
58
|
+
toggle.current = () => setOpen(!isOpen);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!hotkey) return;
|
|
61
|
+
const onKey = (event) => {
|
|
62
|
+
if (event.key.toLowerCase() === "k" && (event.ctrlKey || event.metaKey)) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
toggle.current();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
window.addEventListener("keydown", onKey);
|
|
68
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
69
|
+
}, [hotkey]);
|
|
70
|
+
const run = (onSelect) => {
|
|
71
|
+
setOpen(false);
|
|
72
|
+
onSelect == null ? void 0 : onSelect();
|
|
73
|
+
};
|
|
74
|
+
const onKeyDown = (event) => {
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
76
|
+
const options = [...(_b = (_a = listRef.current) == null ? void 0 : _a.querySelectorAll(OPTION)) != null ? _b : []];
|
|
77
|
+
if (!options.length) return;
|
|
78
|
+
const current = options.findIndex((o) => o.id === activeId);
|
|
79
|
+
let next = -1;
|
|
80
|
+
if (event.key === "ArrowDown") next = (current + 1) % options.length;
|
|
81
|
+
else if (event.key === "ArrowUp") next = (current - 1 + options.length) % options.length;
|
|
82
|
+
else if (event.key === "Home") next = 0;
|
|
83
|
+
else if (event.key === "End") next = options.length - 1;
|
|
84
|
+
else if (event.key === "Enter") {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
(_c = options[Math.max(current, 0)]) == null ? void 0 : _c.click();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (next < 0) return;
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
setActiveId(options[next].id);
|
|
92
|
+
(_e = (_d = options[next]).scrollIntoView) == null ? void 0 : _e.call(_d, { block: "nearest" });
|
|
93
|
+
};
|
|
94
|
+
const mac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.userAgent);
|
|
95
|
+
return /* @__PURE__ */ jsxs(DialogPrimitive.Root, { open: isOpen, onOpenChange: setOpen, children: [
|
|
96
|
+
trigger && /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { asChild: true, children: trigger }),
|
|
97
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container, children: [
|
|
98
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: "rds-command__scrim" }),
|
|
99
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Content, { className: "rds-command", "aria-describedby": void 0, children: [
|
|
100
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "rds-visually-hidden", children: label }),
|
|
101
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-command__search", children: [
|
|
102
|
+
/* @__PURE__ */ jsx("span", { className: "rds-command__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(SearchIcon, {}) }),
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
"input",
|
|
105
|
+
{
|
|
106
|
+
className: "rds-command__input",
|
|
107
|
+
type: "text",
|
|
108
|
+
role: "combobox",
|
|
109
|
+
"aria-label": placeholder,
|
|
110
|
+
"aria-expanded": "true",
|
|
111
|
+
"aria-autocomplete": "list",
|
|
112
|
+
"aria-controls": listId,
|
|
113
|
+
"aria-activedescendant": count && activeId ? activeId : void 0,
|
|
114
|
+
autoComplete: "off",
|
|
115
|
+
spellCheck: false,
|
|
116
|
+
placeholder,
|
|
117
|
+
value: query,
|
|
118
|
+
onChange: (event) => setQuery(event.target.value),
|
|
119
|
+
onKeyDown
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
hotkey && /* @__PURE__ */ jsx("kbd", { className: "rds-command__hint", "aria-hidden": "true", children: mac ? "\u2318 K" : "Ctrl K" })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ jsx("div", { ref: listRef, id: listId, role: "listbox", "aria-label": "Resultados", className: "rds-command__results", children: /* @__PURE__ */ jsx(CommandContext.Provider, { value: { query: normalize(query.trim()), activeId, setActiveId, run }, children }) }),
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
Sync,
|
|
127
|
+
{
|
|
128
|
+
sync: () => {
|
|
129
|
+
var _a, _b, _c, _d;
|
|
130
|
+
const options = [...(_b = (_a = listRef.current) == null ? void 0 : _a.querySelectorAll(OPTION)) != null ? _b : []];
|
|
131
|
+
if (options.length !== count) setCount(options.length);
|
|
132
|
+
if (!options.some((o) => o.id === activeId)) setActiveId((_d = (_c = options[0]) == null ? void 0 : _c.id) != null ? _d : null);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
count === 0 && /* @__PURE__ */ jsx("p", { className: "rds-command__empty", children: emptyMessage }),
|
|
137
|
+
/* @__PURE__ */ jsx("span", { className: "rds-visually-hidden", "aria-live": "polite", children: query ? count ? `${count} ${count === 1 ? "resultado" : "resultados"}` : emptyMessage : "" })
|
|
138
|
+
] })
|
|
139
|
+
] })
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
function Sync({ sync }) {
|
|
143
|
+
useLayoutEffect(sync);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
function CommandGroup({ label, children }) {
|
|
147
|
+
return /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": label, className: "rds-command__group", children: [
|
|
148
|
+
/* @__PURE__ */ jsx("p", { className: "rds-command__group-label", "aria-hidden": "true", children: label }),
|
|
149
|
+
children
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
function CommandItem({ children, icon, shortcut, onSelect, value, keywords = [], disabled }) {
|
|
153
|
+
const { query, activeId, setActiveId, run } = useCommand("CommandItem");
|
|
154
|
+
const id = useId();
|
|
155
|
+
const text = value != null ? value : typeof children === "string" || typeof children === "number" ? String(children) : "";
|
|
156
|
+
if (query && !normalize([text, ...keywords].join(" ")).includes(query)) return null;
|
|
157
|
+
const active = id === activeId;
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
id,
|
|
162
|
+
role: "option",
|
|
163
|
+
"aria-selected": active,
|
|
164
|
+
"aria-disabled": disabled || void 0,
|
|
165
|
+
"data-active": active ? "" : void 0,
|
|
166
|
+
className: menuItemClassName(),
|
|
167
|
+
onPointerMove: disabled ? void 0 : () => setActiveId(id),
|
|
168
|
+
onClick: disabled ? void 0 : () => run(onSelect),
|
|
169
|
+
children: /* @__PURE__ */ jsx(MenuItemContent, { icon, shortcut, children })
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
Command,
|
|
175
|
+
CommandGroup,
|
|
176
|
+
CommandItem
|
|
177
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, FormEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ContactProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'onSubmit'> {
|
|
5
|
+
eyebrow?: ReactNode;
|
|
6
|
+
/** The block's title, an h2 that names the section and the form. */
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The fields and the button (the Figma exposes them): Input name and e-mail, Textarea, the consent Checkbox and a
|
|
11
|
+
* submit Button, which takes the full width.
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** Runs on send, with the form's data. The browser's own validation is off: show the fields' errors. */
|
|
15
|
+
onSubmit: (data: FormData, event: FormEvent<HTMLFormElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Contact — Figma [RDS] Blocks/Contact. The contact form of a public page. Adapts to the width of its container
|
|
19
|
+
* (Figma: `screen`). Styles: contact.css.
|
|
20
|
+
*/
|
|
21
|
+
declare function Contact({ eyebrow, title, description, children, onSubmit, className, ...rest }: ContactProps): react.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { Contact, type ContactProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 } from "react";
|
|
9
|
+
import { BlockHeading } from "./internal/block.js";
|
|
10
|
+
function Contact(_a) {
|
|
11
|
+
var _b = _a, { eyebrow, title, description, children, onSubmit, className } = _b, rest = __objRest(_b, ["eyebrow", "title", "description", "children", "onSubmit", "className"]);
|
|
12
|
+
const titleId = useId();
|
|
13
|
+
return /* @__PURE__ */ jsx("section", __spreadProps(__spreadValues({ "aria-labelledby": titleId }, rest), { className: ["rds-block", "rds-contact", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs("div", { className: "rds-block__inner", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(BlockHeading, { eyebrow, title, description, titleId }),
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
"form",
|
|
17
|
+
{
|
|
18
|
+
className: "rds-contact__form",
|
|
19
|
+
"aria-labelledby": titleId,
|
|
20
|
+
noValidate: true,
|
|
21
|
+
onSubmit: (event) => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
onSubmit(new FormData(event.currentTarget), event);
|
|
24
|
+
},
|
|
25
|
+
children
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
] }) }));
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
Contact
|
|
32
|
+
};
|
|
@@ -1,33 +1,41 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { MenuItemContentProps, MenuItemTone } from './internal/menu.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
* ContextMenu — menu acionado por clique direito (contextmenu event).
|
|
6
|
-
*
|
|
7
|
-
* Uso:
|
|
8
|
-
* <ContextMenu menu={({ close }) => (
|
|
9
|
-
* <>
|
|
10
|
-
* <MenuItem onClick={() => { copy(); close(); }}>Copiar</MenuItem>
|
|
11
|
-
* <MenuItem onClick={() => { paste(); close(); }}>Colar</MenuItem>
|
|
12
|
-
* </>
|
|
13
|
-
* )}>
|
|
14
|
-
* <div className="border p-4">Clique direito aqui</div>
|
|
15
|
-
* </ContextMenu>
|
|
16
|
-
*
|
|
17
|
-
* Posiciona no ponto exato do clique. Fecha em ESC, clique fora, scroll.
|
|
18
|
-
*/
|
|
5
|
+
type ContextMenuItemTone = MenuItemTone;
|
|
19
6
|
interface ContextMenuProps {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* The area it opens on (one element). Make it focusable (tabIndex={0}, or a control) so the keyboard can open
|
|
9
|
+
* the menu too, with the menu key or Shift+F10.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactElement;
|
|
12
|
+
/** The ContextMenuItems, with a ContextMenuSeparator between groups. */
|
|
13
|
+
items: ReactNode;
|
|
14
|
+
/** Turns it off: the right click shows the browser's menu again. */
|
|
28
15
|
disabled?: boolean;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/** The menu's name for screen readers. */
|
|
18
|
+
'aria-label'?: string;
|
|
29
19
|
className?: string;
|
|
30
20
|
}
|
|
31
|
-
|
|
21
|
+
/**
|
|
22
|
+
* ContextMenu — Figma [RDS] Overlays/ContextMenu (spec only: the DropdownMenu's look, opened by the right click,
|
|
23
|
+
* a long touch, the menu key or Shift+F10). Radix ContextMenu: role="menu" at the pointer; the arrows move,
|
|
24
|
+
* Enter chooses, Escape closes. It is never the only way to an action: every item also lives on the screen or in a
|
|
25
|
+
* DropdownMenu. Styles: internal/menu.css.
|
|
26
|
+
*/
|
|
27
|
+
declare function ContextMenu({ children, items, disabled, onOpenChange, className, 'aria-label': ariaLabel }: ContextMenuProps): react.JSX.Element;
|
|
28
|
+
interface ContextMenuItemProps extends MenuItemContentProps {
|
|
29
|
+
/** Runs when the item is chosen; the menu then closes. */
|
|
30
|
+
onSelect?: () => void;
|
|
31
|
+
/** danger for what destroys: last, after a separator. */
|
|
32
|
+
tone?: ContextMenuItemTone;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
textValue?: string;
|
|
35
|
+
}
|
|
36
|
+
/** One action (Figma .menu/item): role="menuitem". */
|
|
37
|
+
declare function ContextMenuItem({ children, icon, shortcut, onSelect, tone, disabled, textValue }: ContextMenuItemProps): react.JSX.Element;
|
|
38
|
+
/** The line between groups of actions. */
|
|
39
|
+
declare function ContextMenuSeparator(): react.JSX.Element;
|
|
32
40
|
|
|
33
|
-
export { ContextMenu, type ContextMenuProps };
|
|
41
|
+
export { ContextMenu, ContextMenuItem, type ContextMenuItemProps, type ContextMenuItemTone, type ContextMenuProps, ContextMenuSeparator };
|
|
@@ -1,70 +1,47 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const { innerWidth: vw, innerHeight: vh } = window;
|
|
44
|
-
let { x, y } = pos;
|
|
45
|
-
if (x + rect.width > vw - 8) x = vw - rect.width - 8;
|
|
46
|
-
if (y + rect.height > vh - 8) y = vh - rect.height - 8;
|
|
47
|
-
if (x !== pos.x || y !== pos.y) setPos({ x, y });
|
|
48
|
-
}, [pos]);
|
|
49
|
-
function handleContext(e) {
|
|
50
|
-
if (disabled) return;
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
setPos({ x: e.clientX, y: e.clientY });
|
|
53
|
-
}
|
|
54
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: containerRef, onContextMenu: handleContext, className }, children), mounted && pos && createPortal(
|
|
55
|
-
/* @__PURE__ */ React.createElement(
|
|
56
|
-
"div",
|
|
57
|
-
{
|
|
58
|
-
ref: menuRef,
|
|
59
|
-
role: "menu",
|
|
60
|
-
className: "fixed z-[1000] rounded-(--radius-card) border border-stroke-default bg-surface-default shadow-lg py-1",
|
|
61
|
-
style: { top: pos.y, left: pos.x, minWidth }
|
|
62
|
-
},
|
|
63
|
-
typeof menu === "function" ? menu({ close: () => setPos(null) }) : menu
|
|
64
|
-
),
|
|
65
|
-
document.body
|
|
66
|
-
));
|
|
67
|
-
});
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import * as Menu from "@radix-ui/react-context-menu";
|
|
5
|
+
import { MenuItemContent, menuItemClassName } from "./internal/menu.js";
|
|
6
|
+
function openFromKeyboard(event) {
|
|
7
|
+
const isMenuKey = event.key === "ContextMenu" || event.shiftKey && event.key === "F10";
|
|
8
|
+
if (!isMenuKey) return;
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
11
|
+
event.currentTarget.dispatchEvent(
|
|
12
|
+
new MouseEvent("contextmenu", {
|
|
13
|
+
bubbles: true,
|
|
14
|
+
cancelable: true,
|
|
15
|
+
clientX: rect.left + Math.min(rect.width, 16),
|
|
16
|
+
clientY: rect.top + Math.min(rect.height, 16)
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function ContextMenu({ children, items, disabled, onOpenChange, className, "aria-label": ariaLabel }) {
|
|
21
|
+
return (
|
|
22
|
+
// Not modal, as the DropdownMenu: the page is not hidden from screen readers while the menu is open.
|
|
23
|
+
/* @__PURE__ */ jsxs(Menu.Root, { onOpenChange, modal: false, children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { asChild: true, disabled, onKeyDown: disabled ? void 0 : openFromKeyboard, children }),
|
|
25
|
+
/* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
|
|
26
|
+
Menu.Content,
|
|
27
|
+
{
|
|
28
|
+
collisionPadding: 8,
|
|
29
|
+
"aria-label": ariaLabel,
|
|
30
|
+
className: ["rds-menu", "rds-context-menu", className].filter(Boolean).join(" "),
|
|
31
|
+
children: items
|
|
32
|
+
}
|
|
33
|
+
) })
|
|
34
|
+
] })
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function ContextMenuItem({ children, icon, shortcut, onSelect, tone, disabled, textValue }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(Menu.Item, { onSelect, disabled, textValue, className: menuItemClassName(tone), children: /* @__PURE__ */ jsx(MenuItemContent, { icon, shortcut, children }) });
|
|
39
|
+
}
|
|
40
|
+
function ContextMenuSeparator() {
|
|
41
|
+
return /* @__PURE__ */ jsx(Menu.Separator, { className: "rds-menu__separator" });
|
|
42
|
+
}
|
|
68
43
|
export {
|
|
69
|
-
ContextMenu
|
|
44
|
+
ContextMenu,
|
|
45
|
+
ContextMenuItem,
|
|
46
|
+
ContextMenuSeparator
|
|
70
47
|
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
interface CopyFieldProps {
|
|
4
|
-
/**
|
|
4
|
+
/** What goes to the clipboard. */
|
|
5
5
|
value: string;
|
|
6
|
-
/**
|
|
6
|
+
/** The button's text at rest. */
|
|
7
7
|
label?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** The text for 2 s after copying; it is announced too. */
|
|
9
9
|
copiedLabel?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Takes the container's whole width. */
|
|
11
11
|
fullWidth?: boolean;
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* CopyField — a composition of the Button (Figma [RDS] Actions/Button, outline, neutral): copies `value` to the
|
|
16
|
+
* clipboard and says so for 2 s ("Copiado!"), on screen and to screen readers. Used next to a QR code or a link
|
|
17
|
+
* to share. Styles: copy-field.css.
|
|
18
|
+
*/
|
|
19
|
+
declare function CopyField({ value, label, copiedLabel, fullWidth, className }: CopyFieldProps): react.JSX.Element;
|
|
15
20
|
|
|
16
21
|
export { CopyField, type CopyFieldProps };
|
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fullWidth = false,
|
|
10
|
-
className = ""
|
|
11
|
-
}) {
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { announce } from "./internal/announce.js";
|
|
7
|
+
import { CheckIcon, CopyIcon } from "./internal/icons.js";
|
|
8
|
+
function CopyField({ value, label = "Copiar", copiedLabel = "Copiado!", fullWidth = false, className }) {
|
|
12
9
|
const [copied, setCopied] = useState(false);
|
|
13
|
-
|
|
10
|
+
const timer = useRef(null);
|
|
11
|
+
useEffect(() => () => {
|
|
12
|
+
if (timer.current) clearTimeout(timer.current);
|
|
13
|
+
}, []);
|
|
14
|
+
async function copy() {
|
|
14
15
|
try {
|
|
15
16
|
await navigator.clipboard.writeText(value);
|
|
16
|
-
setCopied(true);
|
|
17
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
18
17
|
} catch (e) {
|
|
18
|
+
return;
|
|
19
19
|
}
|
|
20
|
+
setCopied(true);
|
|
21
|
+
announce(copiedLabel);
|
|
22
|
+
if (timer.current) clearTimeout(timer.current);
|
|
23
|
+
timer.current = setTimeout(() => setCopied(false), 2e3);
|
|
20
24
|
}
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
Button,
|
|
23
27
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
fullWidth ? "w-full" : "",
|
|
32
|
-
className
|
|
33
|
-
].join(" ")
|
|
34
|
-
},
|
|
35
|
-
copied ? /* @__PURE__ */ React.createElement(Check, { className: "size-4 shrink-0 text-success-text" }) : /* @__PURE__ */ React.createElement(Copy, { className: "size-4 shrink-0" }),
|
|
36
|
-
copied ? copiedLabel : label
|
|
28
|
+
variant: "outline",
|
|
29
|
+
tone: "neutral",
|
|
30
|
+
icon: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
31
|
+
onClick: copy,
|
|
32
|
+
className: ["rds-copy-field", fullWidth && "rds-copy-field--full", className].filter(Boolean).join(" "),
|
|
33
|
+
children: copied ? copiedLabel : label
|
|
34
|
+
}
|
|
37
35
|
);
|
|
38
36
|
}
|
|
39
37
|
export {
|
|
@@ -2,31 +2,45 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface CurrencyInputProps {
|
|
5
|
-
/**
|
|
5
|
+
/** The field's label (the Input's). Without it, pass aria-label. */
|
|
6
6
|
label?: ReactNode;
|
|
7
|
-
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
/** The name of the hidden input that submits the value, in subunits (an integer: 9900 is R$ 99,00). */
|
|
8
9
|
name: string;
|
|
9
|
-
/** ISO 4217
|
|
10
|
+
/** ISO 4217 ('BRL', 'USD', 'JPY'): resolves the symbol, the decimals and the locale. */
|
|
10
11
|
currency?: string;
|
|
11
|
-
/**
|
|
12
|
+
/** The symbol before the value (R$, $, €, ₿), the Input's prefix. Needed without `currency`. */
|
|
12
13
|
symbol?: string;
|
|
13
|
-
/**
|
|
14
|
+
/** Decimal places: BRL and USD 2, JPY 0, BTC 8. Needed without `currency`. */
|
|
14
15
|
decimals?: number;
|
|
15
|
-
/**
|
|
16
|
+
/** The locale the value is formatted in. Default: the currency's (BRL → pt-BR), or 'en-US'. */
|
|
16
17
|
locale?: string;
|
|
17
|
-
/**
|
|
18
|
+
/** The starting value in subunits. */
|
|
18
19
|
defaultValueSubunits?: number | null;
|
|
19
20
|
placeholder?: string;
|
|
20
21
|
disabled?: boolean;
|
|
21
|
-
|
|
22
|
+
required?: boolean;
|
|
23
|
+
/** A line under the field (the Input's hint). */
|
|
24
|
+
hint?: ReactNode;
|
|
25
|
+
/** What is wrong with the value (the Input's error). */
|
|
26
|
+
errorMessage?: ReactNode;
|
|
27
|
+
/** Called with the value in subunits on every change. */
|
|
22
28
|
onChange?: (subunits: number) => void;
|
|
23
|
-
/**
|
|
29
|
+
/** The most digits it takes. Default 10 (R$ 99.999.999,99). */
|
|
24
30
|
maxDigits?: number;
|
|
25
|
-
/**
|
|
31
|
+
/** Shows 0,00 instead of the placeholder when the value is zero. */
|
|
26
32
|
showZero?: boolean;
|
|
33
|
+
/** @deprecated The [RDS] Input has one height (44). Ignored. */
|
|
27
34
|
size?: 'sm' | 'md' | 'lg';
|
|
35
|
+
id?: string;
|
|
28
36
|
className?: string;
|
|
29
37
|
}
|
|
30
|
-
|
|
38
|
+
/**
|
|
39
|
+
* CurrencyInput — a composition of the Input (Figma [RDS] Forms/Input) with the currency symbol as its prefix and a
|
|
40
|
+
* right-to-left mask: each digit typed becomes a cent, Backspace takes the last one off, pasting "R$ 50,00" gives
|
|
41
|
+
* 5000. The mask follows the input's value (onChange), not the keys, so the phone's keyboard opens and works. The
|
|
42
|
+
* value goes with the form in subunits, through a hidden input named `name`.
|
|
43
|
+
*/
|
|
44
|
+
declare function CurrencyInput({ label, 'aria-label': ariaLabel, name, currency, symbol: symbolProp, decimals: decimalsProp, locale: localeProp, defaultValueSubunits, placeholder, disabled, required, hint, errorMessage, onChange, maxDigits, showZero, id, className, }: CurrencyInputProps): react.JSX.Element;
|
|
31
45
|
|
|
32
46
|
export { CurrencyInput, type CurrencyInputProps };
|