@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
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
import {
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { IconButton } from "./icon-button.js";
|
|
5
|
+
import { PencilIcon } from "./internal/icons.js";
|
|
6
|
+
import { Item } from "./item.js";
|
|
7
|
+
import { Switch } from "./switch.js";
|
|
8
|
+
import { Tooltip } from "./tooltip.js";
|
|
4
9
|
function ToggleCardCompact({
|
|
5
10
|
icon,
|
|
6
11
|
label,
|
|
@@ -10,88 +15,24 @@ function ToggleCardCompact({
|
|
|
10
15
|
onCheckedChange,
|
|
11
16
|
onEdit,
|
|
12
17
|
editLabel = "Editar",
|
|
13
|
-
name
|
|
18
|
+
name,
|
|
19
|
+
disabled,
|
|
20
|
+
className
|
|
14
21
|
}) {
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Item,
|
|
17
24
|
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
checked ? "[background:var(--section-card-header-bg-active)]" : ""
|
|
30
|
-
].join(" ")
|
|
31
|
-
},
|
|
32
|
-
icon && /* @__PURE__ */ React.createElement(
|
|
33
|
-
"span",
|
|
34
|
-
{
|
|
35
|
-
className: [
|
|
36
|
-
"shrink-0",
|
|
37
|
-
checked ? "[color:var(--section-card-label-active)] opacity-80" : "text-(--text-disabled)"
|
|
38
|
-
].join(" ")
|
|
39
|
-
},
|
|
40
|
-
icon
|
|
41
|
-
),
|
|
42
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement(
|
|
43
|
-
"p",
|
|
44
|
-
{
|
|
45
|
-
className: [
|
|
46
|
-
"text-caption font-semibold uppercase tracking-wide",
|
|
47
|
-
checked ? "[color:var(--section-card-label-active)]" : "[color:var(--section-card-label)]"
|
|
48
|
-
].join(" ")
|
|
49
|
-
},
|
|
50
|
-
label
|
|
51
|
-
), (checked ? summary : description) && /* @__PURE__ */ React.createElement(
|
|
52
|
-
"p",
|
|
53
|
-
{
|
|
54
|
-
className: [
|
|
55
|
-
"text-caption leading-snug mt-0.5 truncate",
|
|
56
|
-
checked ? "[color:var(--section-card-badge-active)]" : "[color:var(--section-card-badge)]"
|
|
57
|
-
].join(" ")
|
|
58
|
-
},
|
|
59
|
-
checked ? summary : description
|
|
60
|
-
)),
|
|
61
|
-
checked && onEdit && /* @__PURE__ */ React.createElement(
|
|
62
|
-
"button",
|
|
63
|
-
{
|
|
64
|
-
type: "button",
|
|
65
|
-
onClick: onEdit,
|
|
66
|
-
"aria-label": editLabel,
|
|
67
|
-
className: "shrink-0 [color:var(--section-card-label-active)] opacity-70 hover:opacity-100 transition-opacity p-1 -m-1 rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-white/40"
|
|
68
|
-
},
|
|
69
|
-
/* @__PURE__ */ React.createElement(Pencil, { size: 14 })
|
|
70
|
-
),
|
|
71
|
-
/* @__PURE__ */ React.createElement(
|
|
72
|
-
"button",
|
|
73
|
-
{
|
|
74
|
-
type: "button",
|
|
75
|
-
role: "switch",
|
|
76
|
-
"aria-checked": checked,
|
|
77
|
-
"aria-label": label,
|
|
78
|
-
onClick: () => onCheckedChange == null ? void 0 : onCheckedChange(!checked),
|
|
79
|
-
className: [
|
|
80
|
-
"relative inline-flex shrink-0 h-5 w-9 rounded-full transition-colors focus:outline-none focus-visible:ring-2",
|
|
81
|
-
checked ? "bg-(--surface-default)/30 focus-visible:ring-white/40" : "bg-(--surface-raised) border border-stroke-default focus-visible:ring-stroke-focus/30"
|
|
82
|
-
].join(" ")
|
|
83
|
-
},
|
|
84
|
-
/* @__PURE__ */ React.createElement(
|
|
85
|
-
"span",
|
|
86
|
-
{
|
|
87
|
-
className: [
|
|
88
|
-
"absolute top-0.5 inline-block h-4 w-4 rounded-full bg-(--surface-default) shadow-sm transition-transform",
|
|
89
|
-
checked ? "translate-x-[18px]" : "translate-x-0.5"
|
|
90
|
-
].join(" ")
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
)
|
|
94
|
-
)
|
|
25
|
+
variant: "outline",
|
|
26
|
+
className: ["rds-toggle-card-compact", className].filter(Boolean).join(" "),
|
|
27
|
+
media: icon,
|
|
28
|
+
title: label,
|
|
29
|
+
description: (checked ? summary : description) || void 0,
|
|
30
|
+
action: /* @__PURE__ */ jsxs("span", { className: "rds-toggle-card-compact__actions", children: [
|
|
31
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: checked ? "on" : "" }),
|
|
32
|
+
checked && onEdit && /* @__PURE__ */ jsx(Tooltip, { text: editLabel, children: /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(PencilIcon, {}), label: editLabel, variant: "ghost", tone: "neutral", onClick: onEdit, disabled }) }),
|
|
33
|
+
/* @__PURE__ */ jsx(Switch, { "aria-label": label, checked, onCheckedChange, disabled })
|
|
34
|
+
] })
|
|
35
|
+
}
|
|
95
36
|
);
|
|
96
37
|
}
|
|
97
38
|
export {
|
|
@@ -2,14 +2,23 @@ import * as react from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface ToggleCardProps {
|
|
5
|
+
/** The setting it turns on (the Switch's label). */
|
|
5
6
|
label: string;
|
|
7
|
+
/** A line under the label (the Switch's hint). */
|
|
6
8
|
description?: string;
|
|
7
9
|
checked: boolean;
|
|
8
10
|
onCheckedChange: (checked: boolean) => void;
|
|
9
|
-
/**
|
|
11
|
+
/** Submits 'on' (or '') under this name with a native form, through a hidden input. */
|
|
10
12
|
name?: string;
|
|
13
|
+
/** The setting's options, shown under it while it is on. */
|
|
11
14
|
children?: ReactNode;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
className?: string;
|
|
12
17
|
}
|
|
13
|
-
|
|
18
|
+
/**
|
|
19
|
+
* ToggleCard — a composition of the Card and the Switch (Figma [RDS] Forms/Switch): a setting that, when on, opens
|
|
20
|
+
* its own options below it. Styles: toggle-card.css.
|
|
21
|
+
*/
|
|
22
|
+
declare function ToggleCard({ label, description, checked, onCheckedChange, name, children, disabled, className }: ToggleCardProps): react.JSX.Element;
|
|
14
23
|
|
|
15
24
|
export { ToggleCard, type ToggleCardProps };
|
|
@@ -1,75 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
"div",
|
|
13
|
-
{
|
|
14
|
-
className: [
|
|
15
|
-
"rounded-(--radius-card) overflow-hidden transition-colors border",
|
|
16
|
-
checked ? "[border-color:var(--section-card-border-active)]" : "[border-color:var(--section-card-border)]"
|
|
17
|
-
].join(" ")
|
|
18
|
-
},
|
|
19
|
-
name && /* @__PURE__ */ React.createElement("input", { type: "hidden", name, value: checked ? "on" : "" }),
|
|
20
|
-
/* @__PURE__ */ React.createElement(
|
|
21
|
-
"button",
|
|
22
|
-
{
|
|
23
|
-
type: "button",
|
|
24
|
-
role: "switch",
|
|
25
|
-
"aria-checked": checked,
|
|
26
|
-
onClick: () => onCheckedChange(!checked),
|
|
27
|
-
className: [
|
|
28
|
-
"w-full flex items-center justify-between gap-3 px-4 py-3 text-left transition-colors",
|
|
29
|
-
checked ? "[background:var(--section-card-header-bg-active)]" : "hover:[background:var(--section-card-header-bg-hover)]"
|
|
30
|
-
].join(" ")
|
|
31
|
-
},
|
|
32
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-0.5 min-w-0 flex-1" }, /* @__PURE__ */ React.createElement(
|
|
33
|
-
"span",
|
|
34
|
-
{
|
|
35
|
-
className: [
|
|
36
|
-
"text-caption font-semibold uppercase tracking-wide",
|
|
37
|
-
checked ? "[color:var(--section-card-label-active)]" : "[color:var(--section-card-label)]"
|
|
38
|
-
].join(" ")
|
|
39
|
-
},
|
|
40
|
-
label
|
|
41
|
-
), description && /* @__PURE__ */ React.createElement(
|
|
42
|
-
"span",
|
|
43
|
-
{
|
|
44
|
-
className: [
|
|
45
|
-
"text-caption leading-snug",
|
|
46
|
-
checked ? "[color:var(--section-card-badge-active)]" : "[color:var(--section-card-badge)]"
|
|
47
|
-
].join(" ")
|
|
48
|
-
},
|
|
49
|
-
description
|
|
50
|
-
)),
|
|
51
|
-
/* @__PURE__ */ React.createElement(
|
|
52
|
-
"span",
|
|
53
|
-
{
|
|
54
|
-
"aria-hidden": true,
|
|
55
|
-
className: [
|
|
56
|
-
"relative inline-flex shrink-0 h-5 w-9 rounded-full transition-colors",
|
|
57
|
-
checked ? "bg-(--surface-default)/30" : "bg-(--surface-raised) border border-stroke-default"
|
|
58
|
-
].join(" ")
|
|
59
|
-
},
|
|
60
|
-
/* @__PURE__ */ React.createElement(
|
|
61
|
-
"span",
|
|
62
|
-
{
|
|
63
|
-
className: [
|
|
64
|
-
"absolute top-0.5 inline-block h-4 w-4 rounded-full bg-(--surface-default) shadow-sm transition-transform",
|
|
65
|
-
checked ? "translate-x-[18px]" : "translate-x-0.5"
|
|
66
|
-
].join(" ")
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
)
|
|
70
|
-
),
|
|
71
|
-
checked && children && /* @__PURE__ */ React.createElement("div", { className: "px-4 pb-4 pt-4 space-y-4 [border-top:1px_solid_var(--section-card-divider)] [background:var(--surface-default)]" }, children)
|
|
72
|
-
);
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Card } from "./card.js";
|
|
5
|
+
import { Switch } from "./switch.js";
|
|
6
|
+
function ToggleCard({ label, description, checked, onCheckedChange, name, children, disabled, className }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs(Card, { as: "div", className: ["rds-toggle-card", className].filter(Boolean).join(" "), children: [
|
|
8
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: checked ? "on" : "" }),
|
|
9
|
+
/* @__PURE__ */ jsx("div", { className: "rds-toggle-card__header", children: /* @__PURE__ */ jsx(Switch, { checked, onCheckedChange, hint: description, disabled, children: label }) }),
|
|
10
|
+
checked && children && /* @__PURE__ */ jsx("div", { className: "rds-toggle-card__content", children })
|
|
11
|
+
] });
|
|
73
12
|
}
|
|
74
13
|
export {
|
|
75
14
|
ToggleCard
|
|
@@ -1,67 +1,29 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
3
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
4
|
+
import { ToggleVariant } from './internal/toggle.js';
|
|
3
5
|
|
|
6
|
+
type ToggleGroupProps = ComponentPropsWithRef<typeof ToggleGroupPrimitive.Root> & {
|
|
7
|
+
/** One emphasis for every item (the Toggle `style`; ghost and outline are not mixed in a group). */
|
|
8
|
+
variant?: ToggleVariant;
|
|
9
|
+
/** Required: what the group chooses ("Vista", "Estilo do texto"). */
|
|
10
|
+
'aria-label': string;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
|
-
* ToggleGroup —
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* <ToggleGroup value={view} onChange={setView} options={[
|
|
9
|
-
* { value: 'day', label: 'Dia' },
|
|
10
|
-
* { value: 'week', label: 'Semana' },
|
|
11
|
-
* { value: 'month', label: 'Mês' },
|
|
12
|
-
* ]} />
|
|
13
|
-
*
|
|
14
|
-
* Uso (multi):
|
|
15
|
-
* <ToggleGroup type="multi" value={selected} onChange={setSelected} options={[
|
|
16
|
-
* { value: 'bold', icon: <Bold /> },
|
|
17
|
-
* { value: 'italic', icon: <Italic /> },
|
|
18
|
-
* ]} />
|
|
13
|
+
* ToggleGroup — Figma [RDS] Actions/ToggleGroup. Toggles side by side (Figma: slot `items`).
|
|
14
|
+
* `type="single"`: only one on (Lista or Grade). `type="multiple"`: each one on its own (bold, italic).
|
|
15
|
+
* Tab enters the group, the arrow keys move between items. Styles: toggle-group.css and toggle.css.
|
|
19
16
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label
|
|
17
|
+
declare function ToggleGroup({ variant, className, ...rest }: ToggleGroupProps): react.JSX.Element;
|
|
18
|
+
interface ToggleGroupItemProps extends Omit<ComponentPropsWithRef<typeof ToggleGroupPrimitive.Item>, 'children' | 'disabled'> {
|
|
19
|
+
/** The option's name (the Toggle `label`). Without it, pass aria-label. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** Icon before the text. Decorative, rendered with aria-hidden. */
|
|
23
22
|
icon?: ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
style?: React.CSSProperties;
|
|
23
|
+
/** Rendered as aria-disabled="true", as in the Toggle. */
|
|
26
24
|
disabled?: boolean;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/** Label renderada acima do controle (mesmo padrão do Input do DS). */
|
|
31
|
-
label?: ReactNode;
|
|
32
|
-
value: T | null;
|
|
33
|
-
/** null quando allowDeselect=true e o item ativo é clicado novamente. */
|
|
34
|
-
onChange: (value: T | null) => void;
|
|
35
|
-
options: ToggleOption<T>[];
|
|
36
|
-
size?: 'sm' | 'md' | 'lg';
|
|
37
|
-
/** Cor do item selecionado. 'brand' (default) pinta com a cor da marca; 'neutral'
|
|
38
|
-
* usa tinta neutra de alto contraste (surface-invert) — para controles utilitários
|
|
39
|
-
* que não devem vestir a paleta da loja. */
|
|
40
|
-
selectedTone?: 'brand' | 'neutral';
|
|
41
|
-
/** Se permite desselecionar o ativo (clica de novo = null). default = false. */
|
|
42
|
-
allowDeselect?: boolean;
|
|
43
|
-
/** Botões crescem para preencher toda a largura do container. */
|
|
44
|
-
stretch?: boolean;
|
|
45
|
-
className?: string;
|
|
46
|
-
'aria-label'?: string;
|
|
47
|
-
}
|
|
48
|
-
interface ToggleGroupMultiProps<T extends string> {
|
|
49
|
-
type: 'multi';
|
|
50
|
-
/** Label renderada acima do controle (mesmo padrão do Input do DS). */
|
|
51
|
-
label?: ReactNode;
|
|
52
|
-
value: T[];
|
|
53
|
-
onChange: (value: T[]) => void;
|
|
54
|
-
options: ToggleOption<T>[];
|
|
55
|
-
size?: 'sm' | 'md' | 'lg';
|
|
56
|
-
/** Cor do item selecionado. 'brand' (default) pinta com a cor da marca; 'neutral'
|
|
57
|
-
* usa tinta neutra de alto contraste (surface-invert). */
|
|
58
|
-
selectedTone?: 'brand' | 'neutral';
|
|
59
|
-
/** Botões crescem para preencher toda a largura do container. */
|
|
60
|
-
stretch?: boolean;
|
|
61
|
-
className?: string;
|
|
62
|
-
'aria-label'?: string;
|
|
63
|
-
}
|
|
64
|
-
type ToggleGroupProps<T extends string = string> = ToggleGroupSingleProps<T> | ToggleGroupMultiProps<T>;
|
|
65
|
-
declare function ToggleGroup<T extends string = string>(props: ToggleGroupProps<T>): react.JSX.Element;
|
|
26
|
+
/** One option of a ToggleGroup: a Toggle that the group turns on and off. */
|
|
27
|
+
declare function ToggleGroupItem({ icon, children, disabled, className, onClick, ...rest }: ToggleGroupItemProps): react.JSX.Element;
|
|
66
28
|
|
|
67
|
-
export { ToggleGroup, type
|
|
29
|
+
export { ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps };
|
|
@@ -1,80 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
single.onChange(null);
|
|
32
|
-
} else {
|
|
33
|
-
single.onChange(opt.value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const group = /* @__PURE__ */ React.createElement(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
id: groupId,
|
|
41
|
-
role: isMulti ? "group" : "radiogroup",
|
|
42
|
-
"aria-label": props["aria-label"],
|
|
43
|
-
className: [
|
|
44
|
-
stretch ? "flex w-full" : "inline-flex",
|
|
45
|
-
"rounded-(--radius-control) border border-stroke-default bg-surface-default p-0.5 gap-0.5",
|
|
46
|
-
label ? "" : className
|
|
47
|
-
].join(" ")
|
|
48
|
-
},
|
|
49
|
-
options.map((opt) => {
|
|
50
|
-
const active = isActive(opt);
|
|
51
|
-
return /* @__PURE__ */ React.createElement(
|
|
52
|
-
"button",
|
|
53
|
-
{
|
|
54
|
-
key: opt.value,
|
|
55
|
-
type: "button",
|
|
56
|
-
role: isMulti ? "switch" : "radio",
|
|
57
|
-
"aria-checked": active,
|
|
58
|
-
disabled: opt.disabled,
|
|
59
|
-
style: opt.style,
|
|
60
|
-
onClick: () => handleClick(opt),
|
|
61
|
-
className: [
|
|
62
|
-
"inline-flex items-center justify-center rounded-(--radius-control) font-medium transition-colors",
|
|
63
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus focus-visible:z-10",
|
|
64
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
65
|
-
stretch ? "flex-1" : "",
|
|
66
|
-
SIZE_CLASS[size],
|
|
67
|
-
active ? selectedTone === "neutral" ? "bg-surface-invert text-fg-inverse" : "bg-brand-primary text-brand-on-primary" : "text-fg-secondary hover:text-fg-primary hover:bg-surface-raised"
|
|
68
|
-
].join(" ")
|
|
69
|
-
},
|
|
70
|
-
opt.icon && /* @__PURE__ */ React.createElement("span", { className: "[&_svg]:size-4 shrink-0" }, opt.icon),
|
|
71
|
-
opt.label && /* @__PURE__ */ React.createElement("span", null, opt.label)
|
|
72
|
-
);
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createContext, useContext } from "react";
|
|
9
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
10
|
+
import { blockWhenDisabled } from "./internal/button.js";
|
|
11
|
+
import { toggleClassName, warnIfUnnamed } from "./internal/toggle.js";
|
|
12
|
+
const VariantContext = createContext("outline");
|
|
13
|
+
function ToggleGroup(_a) {
|
|
14
|
+
var _b = _a, { variant = "outline", className } = _b, rest = __objRest(_b, ["variant", "className"]);
|
|
15
|
+
return /* @__PURE__ */ jsx(VariantContext.Provider, { value: variant, children: /* @__PURE__ */ jsx(ToggleGroupPrimitive.Root, __spreadProps(__spreadValues({}, rest), { className: ["rds-toggle-group", className].filter(Boolean).join(" ") })) });
|
|
16
|
+
}
|
|
17
|
+
function ToggleGroupItem(_c) {
|
|
18
|
+
var _d = _c, { icon, children, disabled, className, onClick } = _d, rest = __objRest(_d, ["icon", "children", "disabled", "className", "onClick"]);
|
|
19
|
+
const variant = useContext(VariantContext);
|
|
20
|
+
warnIfUnnamed("ToggleGroupItem", Boolean(children), rest["aria-label"], rest["aria-labelledby"]);
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
ToggleGroupPrimitive.Item,
|
|
23
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
24
|
+
className: toggleClassName(variant, className),
|
|
25
|
+
"aria-disabled": disabled || void 0,
|
|
26
|
+
onClick: blockWhenDisabled(disabled, onClick),
|
|
27
|
+
children: [
|
|
28
|
+
icon && /* @__PURE__ */ jsx("span", { className: "rds-toggle__icon", "aria-hidden": "true", children: icon }),
|
|
29
|
+
children
|
|
30
|
+
]
|
|
73
31
|
})
|
|
74
32
|
);
|
|
75
|
-
if (!label) return group;
|
|
76
|
-
return /* @__PURE__ */ React.createElement("div", { className: ["flex flex-col gap-1.5", className].join(" ") }, /* @__PURE__ */ React.createElement("label", { htmlFor: groupId, className: "text-label font-medium text-fg-primary" }, label), group);
|
|
77
33
|
}
|
|
78
34
|
export {
|
|
79
|
-
ToggleGroup
|
|
35
|
+
ToggleGroup,
|
|
36
|
+
ToggleGroupItem
|
|
80
37
|
};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
3
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
4
|
+
import { ToggleVariant } from './internal/toggle.js';
|
|
3
5
|
|
|
4
|
-
interface ToggleProps extends Omit<
|
|
5
|
-
label
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
interface ToggleProps extends Omit<ComponentPropsWithRef<typeof TogglePrimitive.Root>, 'children' | 'disabled'> {
|
|
7
|
+
/** The name of what it turns on (Figma: `showLabel` + `label`). It never changes when pressed. Without it, pass aria-label. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** Icon before the text (Figma: `showIcon` + `iconName`). Decorative, rendered with aria-hidden. */
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/** The emphasis (Figma: `style`): ghost in a toolbar, outline when it stands alone. */
|
|
12
|
+
variant?: ToggleVariant;
|
|
13
|
+
/** Rendered as aria-disabled="true": stays in the tab order and takes focus, but does not toggle. */
|
|
14
|
+
disabled?: boolean;
|
|
10
15
|
}
|
|
11
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Toggle — Figma [RDS] Actions/Toggle. A button that stays on or off (aria-pressed). `pressed` +
|
|
18
|
+
* `onPressedChange` to control it, `defaultPressed` to start on (Figma: `pressed`). Not the Switch:
|
|
19
|
+
* a Toggle turns on a mode or a format (bold, list view); a Switch, a setting. Styles: toggle.css.
|
|
20
|
+
*/
|
|
21
|
+
declare function Toggle({ variant, icon, children, disabled, className, onClick, ...rest }: ToggleProps): react.JSX.Element;
|
|
12
22
|
|
|
13
|
-
export { Toggle, type ToggleProps };
|
|
23
|
+
export { Toggle, type ToggleProps, ToggleVariant };
|
|
@@ -1,64 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__objRest,
|
|
4
|
+
__spreadProps,
|
|
4
5
|
__spreadValues
|
|
5
6
|
} from "../chunk-ORMEWXMH.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
id: inputId,
|
|
25
|
-
className: "peer sr-only"
|
|
26
|
-
}, props)
|
|
27
|
-
), /* @__PURE__ */ React.createElement(
|
|
28
|
-
"span",
|
|
29
|
-
{
|
|
30
|
-
className: [
|
|
31
|
-
"absolute inset-0 rounded-full transition-colors",
|
|
32
|
-
"bg-surface-raised border border-stroke-control",
|
|
33
|
-
"peer-checked:bg-(--toggle-track-active) peer-checked:border-transparent",
|
|
34
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-stroke-focus/30",
|
|
35
|
-
"peer-disabled:cursor-not-allowed"
|
|
36
|
-
].join(" ")
|
|
37
|
-
}
|
|
38
|
-
), /* @__PURE__ */ React.createElement(
|
|
39
|
-
"span",
|
|
40
|
-
{
|
|
41
|
-
className: [
|
|
42
|
-
"relative rounded-full bg-surface-default shadow-sm transition-transform translate-x-0.5",
|
|
43
|
-
sz.thumb
|
|
44
|
-
].join(" ")
|
|
45
|
-
}
|
|
46
|
-
));
|
|
47
|
-
return /* @__PURE__ */ React.createElement(
|
|
48
|
-
"label",
|
|
49
|
-
{
|
|
50
|
-
htmlFor: inputId,
|
|
51
|
-
className: [
|
|
52
|
-
"inline-flex items-start gap-2.5 cursor-pointer",
|
|
53
|
-
"has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
|
|
54
|
-
className
|
|
55
|
-
].filter(Boolean).join(" ")
|
|
56
|
-
},
|
|
57
|
-
labelPosition === "left" && labelEl,
|
|
58
|
-
/* @__PURE__ */ React.createElement("span", { className: "flex items-center pt-0.5" }, switchEl),
|
|
59
|
-
labelPosition === "right" && labelEl
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
9
|
+
import { blockWhenDisabled } from "./internal/button.js";
|
|
10
|
+
import { toggleClassName, warnIfUnnamed } from "./internal/toggle.js";
|
|
11
|
+
function Toggle(_a) {
|
|
12
|
+
var _b = _a, { variant = "ghost", icon, children, disabled, className, onClick } = _b, rest = __objRest(_b, ["variant", "icon", "children", "disabled", "className", "onClick"]);
|
|
13
|
+
warnIfUnnamed("Toggle", Boolean(children), rest["aria-label"], rest["aria-labelledby"]);
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
TogglePrimitive.Root,
|
|
16
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
17
|
+
className: toggleClassName(variant, className),
|
|
18
|
+
"aria-disabled": disabled || void 0,
|
|
19
|
+
onClick: blockWhenDisabled(disabled, onClick),
|
|
20
|
+
children: [
|
|
21
|
+
icon && /* @__PURE__ */ jsx("span", { className: "rds-toggle__icon", "aria-hidden": "true", children: icon }),
|
|
22
|
+
children
|
|
23
|
+
]
|
|
24
|
+
})
|
|
60
25
|
);
|
|
61
|
-
}
|
|
26
|
+
}
|
|
62
27
|
export {
|
|
63
28
|
Toggle
|
|
64
29
|
};
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type TooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
6
|
+
interface TooltipProps extends Omit<ComponentPropsWithRef<typeof TooltipPrimitive.Trigger>, 'children' | 'asChild'> {
|
|
7
|
+
/**
|
|
8
|
+
* The control it describes, almost always an IconButton. It must be a single focusable element: it receives the
|
|
9
|
+
* aria-describedby that ties it to the balloon (Radix Tooltip with asChild), not a wrapper around it.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactElement;
|
|
12
|
+
/** The action's name, in up to four words (Figma: `text`). Never something the person needs: touch does not show it. */
|
|
13
|
+
text: ReactNode;
|
|
14
|
+
/** Which side of the control the balloon sits on (Figma: `side`). */
|
|
15
|
+
side?: TooltipSide;
|
|
16
|
+
/** ms before it opens on hover. On keyboard focus it opens at once. */
|
|
8
17
|
delay?: number;
|
|
9
|
-
/** Extra classes on the tooltip bubble — use to override whitespace-nowrap for rich content */
|
|
10
|
-
className?: string;
|
|
11
|
-
/** Classes on the trigger wrapper span — override the default `inline-flex items-center` when the
|
|
12
|
-
* target must fill a flex/grid cell (e.g. `relative flex-1`, `block w-full`). */
|
|
13
|
-
wrapperClassName?: string;
|
|
14
18
|
}
|
|
15
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Tooltip — Figma [RDS] Feedback/Tooltip. A short label on hovering or focusing a control (Radix Tooltip):
|
|
21
|
+
* role="tooltip", tied to the focusable control with aria-describedby. Escape closes; the mouse can go over the
|
|
22
|
+
* balloon without it disappearing (WCAG 1.4.13). Styles: tooltip.css.
|
|
23
|
+
*
|
|
24
|
+
* Every IconButton goes with one, with the same text as its label (Figma: IconButton, "Com Tooltip"): they are two
|
|
25
|
+
* components, always together. Any other prop and the ref go to the control, so the pair can itself be the child of
|
|
26
|
+
* another asChild trigger (a DropdownMenu, a Dialog close).
|
|
27
|
+
*/
|
|
28
|
+
declare function Tooltip({ children, text, side, delay, ...trigger }: TooltipProps): react.JSX.Element;
|
|
16
29
|
|
|
17
|
-
export { Tooltip, type TooltipProps };
|
|
30
|
+
export { Tooltip, type TooltipProps, type TooltipSide };
|