@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,73 @@
|
|
|
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 { announce } from "./internal/announce.js";
|
|
9
|
+
import { CloseIcon } from "./internal/icons.js";
|
|
10
|
+
function Chip(_a) {
|
|
11
|
+
var _b = _a, {
|
|
12
|
+
children,
|
|
13
|
+
icon,
|
|
14
|
+
onRemove,
|
|
15
|
+
removeLabel,
|
|
16
|
+
removedMessage,
|
|
17
|
+
disabled,
|
|
18
|
+
className
|
|
19
|
+
} = _b, rest = __objRest(_b, [
|
|
20
|
+
"children",
|
|
21
|
+
"icon",
|
|
22
|
+
"onRemove",
|
|
23
|
+
"removeLabel",
|
|
24
|
+
"removedMessage",
|
|
25
|
+
"disabled",
|
|
26
|
+
"className"
|
|
27
|
+
]);
|
|
28
|
+
const text = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
29
|
+
function remove(event) {
|
|
30
|
+
if (disabled || !onRemove) return;
|
|
31
|
+
const next = neighbourRemove(event.currentTarget);
|
|
32
|
+
onRemove();
|
|
33
|
+
const message = removedMessage != null ? removedMessage : text ? `${text} removido` : void 0;
|
|
34
|
+
if (message) announce(message);
|
|
35
|
+
requestAnimationFrame(() => next == null ? void 0 : next.focus());
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"span",
|
|
39
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
40
|
+
role: disabled ? "group" : rest.role,
|
|
41
|
+
"aria-disabled": disabled || void 0,
|
|
42
|
+
className: ["rds-chip", onRemove && "rds-chip--removable", disabled && "rds-chip--disabled", className].filter(Boolean).join(" "),
|
|
43
|
+
children: [
|
|
44
|
+
icon && /* @__PURE__ */ jsx("span", { className: "rds-chip__icon", "aria-hidden": "true", children: icon }),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { className: "rds-chip__label", children }),
|
|
46
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
className: "rds-chip__remove",
|
|
51
|
+
"aria-label": removeLabel != null ? removeLabel : `Remover ${text != null ? text : ""}`.trim(),
|
|
52
|
+
"aria-disabled": disabled || void 0,
|
|
53
|
+
onClick: remove,
|
|
54
|
+
children: /* @__PURE__ */ jsx("span", { className: "rds-chip__remove-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(CloseIcon, {}) })
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function neighbourRemove(own) {
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
|
+
const chip = own.closest(".rds-chip");
|
|
64
|
+
const list = (_a = chip == null ? void 0 : chip.closest('ul, ol, [role="list"]')) != null ? _a : chip == null ? void 0 : chip.parentElement;
|
|
65
|
+
if (!list) return null;
|
|
66
|
+
const all = Array.from(list.querySelectorAll('.rds-chip__remove:not([aria-disabled="true"])'));
|
|
67
|
+
const index = all.indexOf(own);
|
|
68
|
+
if (index === -1) return (_b = all[0]) != null ? _b : null;
|
|
69
|
+
return (_d = (_c = all[index + 1]) != null ? _c : all[index - 1]) != null ? _d : null;
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
Chip
|
|
73
|
+
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChoiceCardProps } from './internal/choice-card.js';
|
|
3
|
+
export { ChoiceCardGroup, ChoiceCardGroupProps, ChoiceCardLayout } from './internal/choice-card.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Override pontual (ex.: rounded-b-none quando há painel anexado embaixo). */
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
declare function ChoiceCard({ selected, onClick, label, description, icon, disabled, className }: ChoiceCardProps): react.JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* ChoiceCard — Figma [RDS] Content/ChoiceCard. A large single-choice option with icon, label and description, for
|
|
7
|
+
* when each option needs an explanation. Three layouts: row (the line with the radio), tile (a grid cell) and
|
|
8
|
+
* preview (an image on top). It is a native radio: Tab reaches the group, the arrows move and choose, Space
|
|
9
|
+
* chooses. Use it inside a ChoiceCardGroup (one chosen at a time). Styles: choice-card.css.
|
|
10
|
+
*/
|
|
11
|
+
declare function ChoiceCard(props: ChoiceCardProps): react.JSX.Element;
|
|
15
12
|
|
|
16
|
-
export { ChoiceCard,
|
|
13
|
+
export { ChoiceCard, ChoiceCardProps };
|
|
@@ -1,60 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"w-full flex items-center gap-4 px-4 py-4 rounded-(--radius-card) border text-left transition-all",
|
|
12
|
-
selected ? "[border-color:var(--choice-card-border-active)] [background:var(--choice-card-bg-active)]" : "[border-color:var(--choice-card-border)] [background:var(--choice-card-bg)] hover:[border-color:var(--choice-card-border-hover)]",
|
|
13
|
-
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
14
|
-
className
|
|
15
|
-
].filter(Boolean).join(" ")
|
|
16
|
-
},
|
|
17
|
-
icon && /* @__PURE__ */ React.createElement(
|
|
18
|
-
"div",
|
|
19
|
-
{
|
|
20
|
-
className: [
|
|
21
|
-
"shrink-0 w-9 h-9 rounded-(--radius-card) flex items-center justify-center transition-colors",
|
|
22
|
-
selected ? "[background:var(--choice-card-icon-bg-active)] [color:var(--choice-card-icon-active)]" : "[background:var(--choice-card-icon-bg)] [color:var(--choice-card-icon)]"
|
|
23
|
-
].join(" ")
|
|
24
|
-
},
|
|
25
|
-
icon
|
|
26
|
-
),
|
|
27
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement(
|
|
28
|
-
"p",
|
|
29
|
-
{
|
|
30
|
-
className: [
|
|
31
|
-
"text-label font-semibold",
|
|
32
|
-
selected ? "[color:var(--choice-card-label-active)]" : "[color:var(--choice-card-label)]"
|
|
33
|
-
].join(" ")
|
|
34
|
-
},
|
|
35
|
-
label
|
|
36
|
-
), description && /* @__PURE__ */ React.createElement(
|
|
37
|
-
"p",
|
|
38
|
-
{
|
|
39
|
-
className: [
|
|
40
|
-
"text-caption mt-0.5",
|
|
41
|
-
selected ? "[color:var(--choice-card-description-active)]" : "[color:var(--choice-card-description)]"
|
|
42
|
-
].join(" ")
|
|
43
|
-
},
|
|
44
|
-
description
|
|
45
|
-
)),
|
|
46
|
-
/* @__PURE__ */ React.createElement(
|
|
47
|
-
"div",
|
|
48
|
-
{
|
|
49
|
-
className: [
|
|
50
|
-
"shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",
|
|
51
|
-
selected ? "[border-color:var(--choice-card-radio-border-active)]" : "[border-color:var(--choice-card-radio-border)]"
|
|
52
|
-
].join(" ")
|
|
53
|
-
},
|
|
54
|
-
selected && /* @__PURE__ */ React.createElement("div", { className: "w-2 h-2 rounded-full [background:var(--choice-card-radio-dot)]" })
|
|
55
|
-
)
|
|
56
|
-
);
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { ChoiceCardControl } from "./internal/choice-card.js";
|
|
8
|
+
import { ChoiceCardGroup } from "./internal/choice-card.js";
|
|
9
|
+
function ChoiceCard(props) {
|
|
10
|
+
return /* @__PURE__ */ jsx(ChoiceCardControl, __spreadProps(__spreadValues({}, props), { control: "radio" }));
|
|
57
11
|
}
|
|
58
12
|
export {
|
|
59
|
-
ChoiceCard
|
|
13
|
+
ChoiceCard,
|
|
14
|
+
ChoiceCardGroup
|
|
60
15
|
};
|
|
@@ -3,14 +3,23 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
|
|
4
4
|
interface ChoiceCarouselProps<T> {
|
|
5
5
|
options: T[];
|
|
6
|
+
/** A stable key per option. */
|
|
6
7
|
getKey: (option: T) => string;
|
|
8
|
+
/** Draws an option. Static content: the carousel item is the radio (or checkbox), so no button inside. */
|
|
7
9
|
renderCard: (option: T, isSelected: boolean) => ReactNode;
|
|
8
10
|
value: T | T[] | null;
|
|
9
11
|
onChange: (value: T | T[]) => void;
|
|
12
|
+
/** Several at once (checkboxes) instead of one (radios). */
|
|
10
13
|
multiple?: boolean;
|
|
14
|
+
/** The group's name for screen readers. */
|
|
11
15
|
ariaLabel: string;
|
|
12
16
|
isDisabled?: (option: T) => boolean;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* ChoiceCarousel — a horizontal, scroll-snapped row of options to pick one (radiogroup) or several (group of
|
|
20
|
+
* checkboxes); the options are drawn by `renderCard`. On a wide screen two outline IconButtons (with their Tooltips)
|
|
21
|
+
* scroll it by one option; the arrow keys do the same on the row. Styles: choice-carousel.css.
|
|
22
|
+
*/
|
|
14
23
|
declare function ChoiceCarousel<T>({ options, getKey, renderCard, value, onChange, multiple, ariaLabel, isDisabled, }: ChoiceCarouselProps<T>): react.JSX.Element;
|
|
15
24
|
|
|
16
25
|
export { ChoiceCarousel, type ChoiceCarouselProps };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useRef, useState, useEffect, useCallback, useMemo } from "react";
|
|
5
|
+
import { IconButton } from "./icon-button.js";
|
|
6
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "./internal/icons.js";
|
|
7
|
+
import { Tooltip } from "./tooltip.js";
|
|
4
8
|
function ChoiceCarousel({
|
|
5
9
|
options,
|
|
6
10
|
getKey,
|
|
@@ -14,7 +18,7 @@ function ChoiceCarousel({
|
|
|
14
18
|
const trackRef = useRef(null);
|
|
15
19
|
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
16
20
|
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
17
|
-
const valueArray = multiple ? value != null ? value : [] : [];
|
|
21
|
+
const valueArray = useMemo(() => multiple ? value != null ? value : [] : [], [multiple, value]);
|
|
18
22
|
const valueSingle = multiple ? null : value;
|
|
19
23
|
const isSelected = useCallback(
|
|
20
24
|
(option) => {
|
|
@@ -58,7 +62,7 @@ function ChoiceCarousel({
|
|
|
58
62
|
const el = trackRef.current;
|
|
59
63
|
if (!el) return;
|
|
60
64
|
const cardWidth = (_b = (_a = el.firstElementChild) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 160;
|
|
61
|
-
const gap =
|
|
65
|
+
const gap = parseFloat(getComputedStyle(el).columnGap) || 0;
|
|
62
66
|
el.scrollBy({ left: dir * (cardWidth + gap), behavior: "smooth" });
|
|
63
67
|
};
|
|
64
68
|
const handleKeyDown = (e) => {
|
|
@@ -70,84 +74,69 @@ function ChoiceCarousel({
|
|
|
70
74
|
scrollByAmount(-1);
|
|
71
75
|
}
|
|
72
76
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
boxShadow: "var(--shadow-md)"
|
|
77
|
+
return /* @__PURE__ */ jsxs("div", { className: "rds-choice-carousel", children: [
|
|
78
|
+
/* @__PURE__ */ jsx(Tooltip, { text: "Anterior", children: /* @__PURE__ */ jsx(
|
|
79
|
+
IconButton,
|
|
80
|
+
{
|
|
81
|
+
className: "rds-choice-carousel__arrow rds-choice-carousel__arrow--prev",
|
|
82
|
+
icon: /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
83
|
+
label: "Anterior",
|
|
84
|
+
variant: "outline",
|
|
85
|
+
tone: "neutral",
|
|
86
|
+
onClick: () => scrollByAmount(-1),
|
|
87
|
+
disabled: !canScrollLeft,
|
|
88
|
+
tabIndex: -1
|
|
86
89
|
}
|
|
87
|
-
},
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
ref: trackRef,
|
|
95
|
+
role: multiple ? "group" : "radiogroup",
|
|
96
|
+
"aria-label": ariaLabel,
|
|
97
|
+
tabIndex: 0,
|
|
98
|
+
onKeyDown: handleKeyDown,
|
|
99
|
+
className: "rds-choice-carousel__track",
|
|
100
|
+
children: options.map((option) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const selected = isSelected(option);
|
|
103
|
+
const disabled = (_a = isDisabled == null ? void 0 : isDisabled(option)) != null ? _a : false;
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
role: multiple ? "checkbox" : "radio",
|
|
108
|
+
"aria-checked": selected,
|
|
109
|
+
"aria-disabled": disabled || void 0,
|
|
110
|
+
tabIndex: disabled ? -1 : 0,
|
|
111
|
+
onClick: () => handleSelect(option),
|
|
112
|
+
onKeyDown: (e) => {
|
|
113
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
handleSelect(option);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
className: "rds-choice-carousel__option",
|
|
119
|
+
children: renderCard(option, selected)
|
|
120
|
+
},
|
|
121
|
+
getKey(option)
|
|
122
|
+
);
|
|
123
|
+
})
|
|
103
124
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
tabIndex: disabled ? -1 : 0,
|
|
117
|
-
onClick: () => handleSelect(option),
|
|
118
|
-
onKeyDown: (e) => {
|
|
119
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
120
|
-
e.preventDefault();
|
|
121
|
-
handleSelect(option);
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
className: "shrink-0",
|
|
125
|
-
style: {
|
|
126
|
-
width: "var(--choice-carousel-card-width-mobile)",
|
|
127
|
-
scrollSnapAlign: "start",
|
|
128
|
-
cursor: disabled ? "not-allowed" : "pointer"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
renderCard(option, selected)
|
|
132
|
-
);
|
|
133
|
-
})
|
|
134
|
-
), /* @__PURE__ */ React.createElement(
|
|
135
|
-
"button",
|
|
136
|
-
{
|
|
137
|
-
type: "button",
|
|
138
|
-
"aria-label": "Pr\xF3ximo",
|
|
139
|
-
onClick: () => scrollByAmount(1),
|
|
140
|
-
disabled: !canScrollRight,
|
|
141
|
-
className: "hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
|
|
142
|
-
style: {
|
|
143
|
-
background: "var(--choice-carousel-chevron-bg)",
|
|
144
|
-
border: `1px solid var(--choice-carousel-chevron-border)`,
|
|
145
|
-
color: "var(--choice-carousel-chevron-text)",
|
|
146
|
-
boxShadow: "var(--shadow-md)"
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx(Tooltip, { text: "Pr\xF3ximo", children: /* @__PURE__ */ jsx(
|
|
127
|
+
IconButton,
|
|
128
|
+
{
|
|
129
|
+
className: "rds-choice-carousel__arrow rds-choice-carousel__arrow--next",
|
|
130
|
+
icon: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
|
|
131
|
+
label: "Pr\xF3ximo",
|
|
132
|
+
variant: "outline",
|
|
133
|
+
tone: "neutral",
|
|
134
|
+
onClick: () => scrollByAmount(1),
|
|
135
|
+
disabled: !canScrollRight,
|
|
136
|
+
tabIndex: -1
|
|
147
137
|
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
));
|
|
138
|
+
) })
|
|
139
|
+
] });
|
|
151
140
|
}
|
|
152
141
|
export {
|
|
153
142
|
ChoiceCarousel
|
|
@@ -1,37 +1,27 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* ChoicePreviewCard — cartão de seleção VERTICAL: mini-preview (mockup/swatch/imagem) em
|
|
6
|
-
* cima, label + descrição embaixo, check no selecionado. Para escolhas onde o rótulo não
|
|
7
|
-
* basta e o usuário precisa VER a opção (layout da home, tema, densidade, modo).
|
|
8
|
-
*
|
|
9
|
-
* Quando usar cada "card clicável" do DS:
|
|
10
|
-
* - ChoicePreviewCard — tile VERTICAL de preview selecionável (este).
|
|
11
|
-
* - ChoiceCard — row HORIZONTAL com radio (escolha exclusiva textual).
|
|
12
|
-
* - SelectableCard — clicável genérico (ação/navegação), button/a.
|
|
13
|
-
* - ToggleCard — toggle dentro de card.
|
|
14
|
-
* - MediaTile — thumbnail de navegação (sem estado selecionado).
|
|
15
|
-
*
|
|
16
|
-
* Estado selected é NEUTRO (stroke-focus), seguro no admin. A seleção única é gerenciada
|
|
17
|
-
* pelo consumidor (map + selected/onSelect) — sem grupo no DS de propósito.
|
|
18
|
-
*/
|
|
4
|
+
/** @deprecated Use ChoiceCardProps. */
|
|
19
5
|
interface ChoicePreviewCardProps {
|
|
20
6
|
selected: boolean;
|
|
21
7
|
onSelect: () => void;
|
|
22
|
-
/**
|
|
8
|
+
/** The picture on top. */
|
|
23
9
|
preview: ReactNode;
|
|
24
10
|
label: string;
|
|
25
11
|
description?: string;
|
|
26
|
-
/**
|
|
12
|
+
/** Ignored: the ChoiceCard has no locked state. */
|
|
27
13
|
locked?: boolean;
|
|
28
|
-
/** Desabilitado (não-clicável). */
|
|
29
14
|
disabled?: boolean;
|
|
30
|
-
/**
|
|
15
|
+
/** Ignored: the ChoiceCard has no badge on the picture. */
|
|
31
16
|
badge?: ReactNode;
|
|
17
|
+
/** Ignored: the picture is always 16:9. */
|
|
32
18
|
previewAspect?: 'square' | 'video' | 'wide';
|
|
33
19
|
className?: string;
|
|
34
20
|
}
|
|
35
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use ChoiceCard with layout="preview" (Figma [RDS] Content/ChoiceCard). A thin wrapper over it: `label`
|
|
23
|
+
* is the children. It is a native radio now, not a toggle button; `locked`, `badge` and `previewAspect` are ignored.
|
|
24
|
+
*/
|
|
25
|
+
declare function ChoicePreviewCard({ selected, onSelect, preview, label, description, disabled, className }: ChoicePreviewCardProps): react.JSX.Element;
|
|
36
26
|
|
|
37
27
|
export { ChoicePreviewCard, type ChoicePreviewCardProps };
|
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
label,
|
|
9
|
-
description,
|
|
10
|
-
locked = false,
|
|
11
|
-
disabled = false,
|
|
12
|
-
badge,
|
|
13
|
-
previewAspect = "video",
|
|
14
|
-
className = ""
|
|
15
|
-
}) {
|
|
16
|
-
const aspect = previewAspect === "square" ? "aspect-square" : previewAspect === "wide" ? "aspect-[2/1]" : "aspect-video";
|
|
17
|
-
return /* @__PURE__ */ React.createElement(
|
|
18
|
-
"button",
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { ChoiceCard } from "./choice-card.js";
|
|
5
|
+
function ChoicePreviewCard({ selected, onSelect, preview, label, description, disabled, className }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
ChoiceCard,
|
|
19
8
|
{
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
layout: "preview",
|
|
10
|
+
selected,
|
|
11
|
+
onSelect,
|
|
12
|
+
preview,
|
|
13
|
+
description,
|
|
22
14
|
disabled,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
27
|
-
selected ? "border-2 border-stroke-focus bg-surface-raised" : "border border-stroke-default bg-surface-default hover:border-stroke-strong",
|
|
28
|
-
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
29
|
-
className
|
|
30
|
-
].filter(Boolean).join(" ")
|
|
31
|
-
},
|
|
32
|
-
/* @__PURE__ */ React.createElement("div", { className: ["relative w-full overflow-hidden rounded-(--radius-card) ring-1 ring-inset ring-stroke-subtle", aspect].join(" ") }, preview, badge && /* @__PURE__ */ React.createElement("span", { className: "absolute top-1.5 left-1.5" }, badge), selected && /* @__PURE__ */ React.createElement("span", { className: "absolute bottom-1.5 right-1.5 size-5 rounded-full bg-stroke-focus text-surface-default flex items-center justify-center" }, /* @__PURE__ */ React.createElement(Check, { size: 12, strokeWidth: 3 })), locked && // TODO(DS): trocar por token de overlay (--choice-preview-overlay) — Patrick.
|
|
33
|
-
/* @__PURE__ */ React.createElement("span", { className: "absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.55)]" }, /* @__PURE__ */ React.createElement(Lock, { size: 18, className: "text-white" }))),
|
|
34
|
-
/* @__PURE__ */ React.createElement("div", { className: "px-1 pt-2" }, /* @__PURE__ */ React.createElement("div", { className: "text-sm font-medium text-fg-primary" }, label), description && /* @__PURE__ */ React.createElement("div", { className: "text-xs text-fg-muted mt-0.5 leading-snug" }, description))
|
|
15
|
+
className,
|
|
16
|
+
children: label
|
|
17
|
+
}
|
|
35
18
|
);
|
|
36
19
|
}
|
|
37
20
|
export {
|
|
@@ -1,20 +1,45 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { FieldTextProps } from './internal/field.js';
|
|
2
4
|
|
|
3
|
-
interface ColorInputProps {
|
|
4
|
-
/**
|
|
5
|
-
value
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface ColorInputProps extends Omit<FieldTextProps, 'labelPosition'> {
|
|
6
|
+
/** Controlled: the colour, #RRGGBB (Figma: `value`). */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** Uncontrolled: the colour at first. */
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/** Called only with a valid #RRGGBB, in capitals: typed and confirmed, or chosen in the palette. */
|
|
11
|
+
onChange?: (hex: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* The colours the swatch's popover offers (#RRGGBB): the caller decides, usually the brand's. Without a palette the
|
|
14
|
+
* swatch opens the system's colour picker instead.
|
|
15
|
+
*/
|
|
16
|
+
palette?: string[];
|
|
17
|
+
/** The palette's title. */
|
|
18
|
+
paletteTitle?: string;
|
|
19
|
+
/** The line under the palette. */
|
|
20
|
+
paletteCaption?: string;
|
|
21
|
+
/** The swatch's accessible name: it opens the palette (or the system's picker). */
|
|
22
|
+
pickLabel?: string;
|
|
23
|
+
/** The form field name: carries the hex. */
|
|
24
|
+
name?: string;
|
|
9
25
|
disabled?: boolean;
|
|
26
|
+
id?: string;
|
|
10
27
|
className?: string;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
/** The name when there is no visible label. */
|
|
11
30
|
'aria-label'?: string;
|
|
31
|
+
'aria-labelledby'?: string;
|
|
12
32
|
}
|
|
33
|
+
/** "2563eb", "#2563eb" → "#2563EB"; anything else → null. */
|
|
34
|
+
declare function normalizeHex(text: string): string | null;
|
|
13
35
|
/**
|
|
14
|
-
* ColorInput —
|
|
15
|
-
*
|
|
16
|
-
*
|
|
36
|
+
* ColorInput — Figma [RDS] Forms/ColorInput. One colour, chosen or typed: the swatch shows it and the hex beside it
|
|
37
|
+
* is editable (#RRGGBB, with or without #). The swatch opens a popover with the palette the caller passes (Figma:
|
|
38
|
+
* menu=open); without one, the system's colour picker. Enter or leaving the field confirms the hex; an invalid hex
|
|
39
|
+
* goes back to the last valid one. The swatch's colour is the person's data, not a token: it is the one inline
|
|
40
|
+
* style the DS allows (style.backgroundColor of the swatch and of each palette colour). Choosing among a few fixed
|
|
41
|
+
* colours without a hex is the ToggleGroup or the ChoiceCard. Styles: color-input.css and internal/field.css.
|
|
17
42
|
*/
|
|
18
|
-
declare function ColorInput({ value, onChange,
|
|
43
|
+
declare function ColorInput({ label, hint, error, errorMessage, required, value, defaultValue, onChange, palette, paletteTitle, paletteCaption, pickLabel, name, disabled, id, className, style, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: ColorInputProps): react.JSX.Element;
|
|
19
44
|
|
|
20
|
-
export { ColorInput, type ColorInputProps };
|
|
45
|
+
export { ColorInput, type ColorInputProps, normalizeHex };
|