@rojaostudio/ds 1.0.2 → 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 -93
- package/dist/components/action-bar.d.ts +24 -0
- package/dist/components/action-bar.js +55 -0
- package/dist/components/alert-dialog.d.ts +31 -0
- package/dist/components/alert-dialog.js +43 -0
- package/dist/components/alert.d.ts +31 -19
- package/dist/components/alert.js +67 -65
- package/dist/components/attachment.d.ts +37 -0
- package/dist/components/attachment.js +76 -0
- package/dist/components/avatar.d.ts +43 -36
- package/dist/components/avatar.js +59 -90
- package/dist/components/badge.d.ts +30 -41
- package/dist/components/badge.js +13 -110
- package/dist/components/banner.d.ts +27 -0
- package/dist/components/banner.js +66 -0
- package/dist/components/benefits.d.ts +30 -0
- package/dist/components/benefits.js +32 -0
- package/dist/components/breadcrumb.d.ts +25 -18
- package/dist/components/breadcrumb.js +38 -56
- package/dist/components/browser.d.ts +18 -0
- package/dist/components/browser.js +32 -0
- package/dist/components/bubble.d.ts +29 -0
- package/dist/components/bubble.js +33 -0
- package/dist/components/button-group.d.ts +19 -0
- package/dist/components/button-group.js +20 -0
- package/dist/components/button.d.ts +47 -20
- package/dist/components/button.js +45 -108
- package/dist/components/calendar.d.ts +29 -0
- package/dist/components/calendar.js +149 -0
- package/dist/components/card.d.ts +47 -19
- package/dist/components/card.js +31 -46
- package/dist/components/carousel.d.ts +28 -0
- package/dist/components/carousel.js +130 -0
- package/dist/components/chart.d.ts +49 -0
- package/dist/components/chart.js +258 -0
- package/dist/components/checkbox-group.d.ts +16 -0
- package/dist/components/checkbox-group.js +13 -0
- package/dist/components/checkbox.d.ts +25 -10
- package/dist/components/checkbox.js +87 -81
- package/dist/components/chip-input.d.ts +46 -20
- package/dist/components/chip-input.js +172 -176
- package/dist/components/chip.d.ts +28 -0
- package/dist/components/chip.js +73 -0
- package/dist/components/choice-card.d.ts +10 -13
- package/dist/components/choice-card.js +11 -62
- package/dist/components/choice-carousel.d.ts +9 -0
- package/dist/components/choice-carousel.js +28 -44
- package/dist/components/choice-preview-card.d.ts +10 -20
- package/dist/components/choice-preview-card.js +12 -40
- package/dist/components/color-input.d.ts +36 -11
- package/dist/components/color-input.js +131 -59
- package/dist/components/combobox.d.ts +60 -57
- package/dist/components/combobox.js +210 -213
- package/dist/components/command.d.ts +58 -0
- package/dist/components/command.js +177 -0
- package/dist/components/contact.d.ts +23 -0
- package/dist/components/contact.js +32 -0
- package/dist/components/context-menu.d.ts +34 -26
- package/dist/components/context-menu.js +41 -68
- package/dist/components/copy-field.d.ts +10 -5
- package/dist/components/copy-field.js +24 -29
- package/dist/components/currency-input.d.ts +25 -11
- package/dist/components/currency-input.js +29 -65
- package/dist/components/danger-zone.d.ts +10 -1
- package/dist/components/danger-zone.js +14 -18
- package/dist/components/data-table-header.d.ts +13 -2
- package/dist/components/data-table-header.js +114 -190
- package/dist/components/date-picker.d.ts +31 -32
- package/dist/components/date-picker.js +119 -254
- package/dist/components/delta.d.ts +26 -0
- package/dist/components/delta.js +24 -0
- package/dist/components/dialog.d.ts +21 -0
- package/dist/components/dialog.js +16 -0
- package/dist/components/drawer.d.ts +15 -23
- package/dist/components/drawer.js +57 -89
- package/dist/components/dropdown-menu.d.ts +63 -0
- package/dist/components/dropdown-menu.js +62 -0
- package/dist/components/dropzone.d.ts +10 -4
- package/dist/components/dropzone.js +30 -58
- package/dist/components/empty.d.ts +29 -0
- package/dist/components/empty.js +42 -0
- package/dist/components/fab.d.ts +29 -6
- package/dist/components/fab.js +51 -51
- package/dist/components/faq.d.ts +21 -0
- package/dist/components/faq.js +24 -0
- package/dist/components/file-input.d.ts +56 -0
- package/dist/components/file-input.js +244 -0
- package/dist/components/filter-chip.d.ts +34 -47
- package/dist/components/filter-chip.js +61 -61
- package/dist/components/floating-stepper.d.ts +7 -18
- package/dist/components/floating-stepper.js +27 -55
- package/dist/components/footer.d.ts +36 -0
- package/dist/components/footer.js +38 -0
- package/dist/components/form-actions.d.ts +28 -0
- package/dist/components/form-actions.js +24 -0
- package/dist/components/google-account-chooser.d.ts +25 -0
- package/dist/components/google-account-chooser.js +44 -0
- package/dist/components/google-button.d.ts +26 -0
- package/dist/components/google-button.js +38 -0
- package/dist/components/google-consent.d.ts +23 -0
- package/dist/components/google-consent.js +28 -0
- package/dist/components/google-sign-in.d.ts +26 -0
- package/dist/components/google-sign-in.js +36 -0
- package/dist/components/hover-card.d.ts +30 -0
- package/dist/components/hover-card.js +55 -0
- package/dist/components/icon-button.d.ts +41 -11
- package/dist/components/icon-button.js +44 -64
- package/dist/components/image-crop-modal.d.ts +3 -3
- package/dist/components/image-crop-modal.js +32 -39
- package/dist/components/image-upload.d.ts +21 -29
- package/dist/components/image-upload.js +55 -259
- package/dist/components/index.d.ts +105 -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 +104 -137
- package/dist/components/insight-card.d.ts +25 -9
- package/dist/components/insight-card.js +42 -27
- package/dist/components/internal/announce.d.ts +3 -0
- package/dist/components/internal/announce.js +20 -0
- package/dist/components/internal/block.d.ts +15 -0
- package/dist/components/internal/block.js +14 -0
- package/dist/components/internal/button.d.ts +23 -0
- package/dist/components/internal/button.js +30 -0
- package/dist/components/internal/choice-card.d.ts +52 -0
- package/dist/components/internal/choice-card.js +117 -0
- package/dist/components/internal/choice.d.ts +25 -0
- package/dist/components/internal/choice.js +44 -0
- package/dist/components/internal/dates.d.ts +17 -0
- package/dist/components/internal/dates.js +59 -0
- package/dist/components/internal/field.d.ts +66 -0
- package/dist/components/internal/field.js +105 -0
- package/dist/components/internal/fieldset.d.ts +25 -0
- package/dist/components/internal/fieldset.js +56 -0
- package/dist/components/internal/focus-after.d.ts +3 -0
- package/dist/components/internal/focus-after.js +13 -0
- package/dist/components/internal/google.d.ts +47 -0
- package/dist/components/internal/google.js +73 -0
- package/dist/components/internal/icons.d.ts +108 -0
- package/dist/components/internal/icons.js +316 -0
- package/dist/components/internal/menu.d.ts +16 -0
- package/dist/components/internal/menu.js +14 -0
- package/dist/components/internal/modal.d.ts +50 -0
- package/dist/components/internal/modal.js +85 -0
- package/dist/components/internal/option-content.d.ts +10 -0
- package/dist/components/internal/option-content.js +13 -0
- package/dist/components/internal/radio-context.d.ts +16 -0
- package/dist/components/internal/radio-context.js +6 -0
- package/dist/components/internal/toggle.d.ts +7 -0
- package/dist/components/internal/toggle.js +13 -0
- package/dist/components/internal/use-listbox.d.ts +56 -0
- package/dist/components/internal/use-listbox.js +69 -0
- package/dist/components/internal/whatsapp.d.ts +8 -0
- package/dist/components/internal/whatsapp.js +12 -0
- package/dist/components/item.d.ts +32 -0
- package/dist/components/item.js +35 -0
- package/dist/components/kbd.d.ts +17 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/listbox.d.ts +34 -0
- package/dist/components/listbox.js +114 -0
- package/dist/components/marker.d.ts +24 -0
- package/dist/components/marker.js +28 -0
- package/dist/components/media-tile.d.ts +17 -14
- package/dist/components/media-tile.js +19 -27
- package/dist/components/message-scroller.d.ts +20 -0
- package/dist/components/message-scroller.js +108 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +23 -0
- package/dist/components/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu.js +30 -0
- package/dist/components/newsletter.d.ts +27 -0
- package/dist/components/newsletter.js +75 -0
- package/dist/components/number-input.d.ts +60 -0
- package/dist/components/number-input.js +234 -0
- package/dist/components/option-tile.d.ts +20 -19
- package/dist/components/option-tile.js +52 -137
- package/dist/components/page-header.d.ts +31 -0
- package/dist/components/page-header.js +25 -0
- package/dist/components/page-shell.d.ts +11 -1
- package/dist/components/page-shell.js +8 -34
- package/dist/components/page-skeleton.d.ts +15 -21
- package/dist/components/page-skeleton.js +28 -25
- package/dist/components/pagination.d.ts +32 -22
- package/dist/components/pagination.js +78 -76
- package/dist/components/password-input.d.ts +26 -0
- package/dist/components/password-input.js +112 -0
- package/dist/components/phone-input.d.ts +12 -8
- package/dist/components/phone-input.js +75 -64
- package/dist/components/phone.d.ts +27 -0
- package/dist/components/phone.js +35 -0
- package/dist/components/popover.d.ts +25 -36
- package/dist/components/popover.js +30 -131
- package/dist/components/pricing-card.d.ts +9 -25
- package/dist/components/pricing-card.js +9 -40
- package/dist/components/pricing.d.ts +48 -0
- package/dist/components/pricing.js +64 -0
- package/dist/components/progress.d.ts +30 -0
- package/dist/components/progress.js +57 -0
- package/dist/components/qr-display.d.ts +11 -6
- package/dist/components/qr-display.js +6 -22
- package/dist/components/questionnaire.d.ts +42 -0
- package/dist/components/questionnaire.js +107 -0
- package/dist/components/radio-group.d.ts +21 -0
- package/dist/components/radio-group.js +40 -0
- package/dist/components/radio.d.ts +15 -29
- package/dist/components/radio.js +45 -103
- package/dist/components/row-actions.d.ts +5 -0
- package/dist/components/row-actions.js +27 -34
- package/dist/components/saving-bar-context.d.ts +0 -5
- package/dist/components/saving-bar-context.js +16 -40
- package/dist/components/saving-bar.d.ts +26 -11
- package/dist/components/saving-bar.js +50 -65
- package/dist/components/section-card.d.ts +18 -4
- package/dist/components/section-card.js +29 -50
- package/dist/components/section-header.d.ts +8 -12
- package/dist/components/section-header.js +5 -10
- package/dist/components/select.d.ts +44 -16
- package/dist/components/select.js +83 -154
- package/dist/components/selectable-card.d.ts +11 -19
- package/dist/components/selectable-card.js +4 -28
- package/dist/components/separator.d.ts +20 -0
- package/dist/components/separator.js +19 -0
- package/dist/components/setting-row.d.ts +11 -15
- package/dist/components/setting-row.js +10 -23
- package/dist/components/settings-list.d.ts +10 -12
- package/dist/components/settings-list.js +7 -19
- package/dist/components/sheet.d.ts +21 -0
- package/dist/components/sheet.js +16 -0
- package/dist/components/sidebar.d.ts +79 -0
- package/dist/components/sidebar.js +111 -0
- package/dist/components/skeleton.d.ts +14 -20
- package/dist/components/skeleton.js +8 -37
- package/dist/components/slider.d.ts +21 -23
- package/dist/components/slider.js +59 -64
- package/dist/components/sparkline.d.ts +19 -0
- package/dist/components/sparkline.js +32 -0
- package/dist/components/spinner.d.ts +16 -8
- package/dist/components/spinner.js +34 -37
- package/dist/components/star-rating.d.ts +22 -0
- package/dist/components/star-rating.js +25 -0
- package/dist/components/stat.d.ts +33 -0
- package/dist/components/stat.js +29 -0
- package/dist/components/status.d.ts +27 -0
- package/dist/components/status.js +34 -0
- package/dist/components/step-progress.d.ts +13 -6
- package/dist/components/step-progress.js +18 -16
- package/dist/components/summary-bar.d.ts +20 -20
- package/dist/components/summary-bar.js +13 -55
- package/dist/components/switch.d.ts +20 -0
- package/dist/components/switch.js +46 -0
- package/dist/components/table.d.ts +56 -17
- package/dist/components/table.js +59 -58
- package/dist/components/tabs.d.ts +67 -0
- package/dist/components/tabs.js +56 -0
- package/dist/components/testimonial.d.ts +30 -0
- package/dist/components/testimonial.js +36 -0
- package/dist/components/textarea.d.ts +11 -16
- package/dist/components/textarea.js +55 -91
- package/dist/components/tile.d.ts +24 -0
- package/dist/components/tile.js +21 -0
- package/dist/components/time-picker.d.ts +40 -25
- package/dist/components/time-picker.js +185 -203
- package/dist/components/toast.d.ts +63 -0
- package/dist/components/toast.js +132 -0
- package/dist/components/toggle-card-compact.d.ts +15 -5
- package/dist/components/toggle-card-compact.js +19 -86
- package/dist/components/toggle-card.d.ts +11 -2
- package/dist/components/toggle-card.js +8 -77
- package/dist/components/toggle-group.d.ts +21 -59
- package/dist/components/toggle-group.js +31 -80
- package/dist/components/toggle.d.ts +19 -9
- package/dist/components/toggle.js +16 -61
- package/dist/components/tooltip.d.ts +25 -12
- package/dist/components/tooltip.js +15 -88
- package/dist/components/top-navigation.d.ts +33 -0
- package/dist/components/top-navigation.js +85 -0
- package/dist/components/typing-indicator.d.ts +6 -0
- package/dist/components/typing-indicator.js +3 -24
- package/dist/components/whatsapp-chat.d.ts +28 -0
- package/dist/components/whatsapp-chat.js +95 -0
- package/dist/components/whatsapp-message.d.ts +22 -0
- package/dist/components/whatsapp-message.js +34 -0
- package/dist/components/whatsapp-notification.d.ts +27 -0
- package/dist/components/whatsapp-notification.js +73 -0
- package/dist/components/whatsapp-template.d.ts +42 -0
- package/dist/components/whatsapp-template.js +69 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +2 -0
- package/dist/icons/pix.d.ts +16 -0
- package/dist/targets/native/components/index.d.ts +0 -2
- package/dist/targets/native/components/index.js +0 -4
- package/dist/targets/native/preset.cjs +0 -1
- package/dist/targets/native/theme.css +58 -60
- package/dist/targets/native/theme.d.ts +58 -60
- package/dist/targets/native/theme.js +58 -60
- package/package.json +34 -12
- package/styles/_primitives.generated.css +40 -0
- package/styles/base.css +12 -18
- package/styles/rds/components-styles.css +11365 -0
- package/styles/rds/components.css +993 -0
- package/styles/rds/foundation.css +74 -0
- package/styles/rds/theme.css +261 -0
- package/styles/rds.css +6 -0
- package/styles/themes/rojao.css +46 -53
- package/dist/components/blocker-card.d.ts +0 -42
- package/dist/components/blocker-card.js +0 -54
- package/dist/components/bottom-sheet.d.ts +0 -31
- package/dist/components/bottom-sheet.js +0 -127
- package/dist/components/chat-bubble.d.ts +0 -16
- package/dist/components/chat-bubble.js +0 -56
- package/dist/components/chips.d.ts +0 -22
- package/dist/components/chips.js +0 -101
- package/dist/components/copilot-hint.d.ts +0 -18
- package/dist/components/copilot-hint.js +0 -72
- package/dist/components/divider.d.ts +0 -20
- package/dist/components/divider.js +0 -50
- package/dist/components/empty-state.d.ts +0 -48
- package/dist/components/empty-state.js +0 -94
- package/dist/components/form-card-header.d.ts +0 -13
- package/dist/components/form-card-header.js +0 -16
- package/dist/components/label.d.ts +0 -16
- package/dist/components/label.js +0 -48
- package/dist/components/menu.d.ts +0 -50
- package/dist/components/menu.js +0 -83
- package/dist/components/modal.d.ts +0 -25
- package/dist/components/modal.js +0 -86
- package/dist/components/notice.d.ts +0 -50
- package/dist/components/notice.js +0 -121
- package/dist/components/page-tabs.d.ts +0 -35
- package/dist/components/page-tabs.js +0 -68
- package/dist/components/paywall-banner.d.ts +0 -37
- package/dist/components/paywall-banner.js +0 -58
- package/dist/components/paywall.d.ts +0 -44
- package/dist/components/paywall.js +0 -65
- package/dist/components/phone-frame.d.ts +0 -9
- package/dist/components/phone-frame.js +0 -19
- package/dist/components/pix-icon.d.ts +0 -8
- package/dist/components/search.d.ts +0 -30
- package/dist/components/search.js +0 -86
- package/dist/components/themed.d.ts +0 -36
- package/dist/components/themed.js +0 -23
- package/dist/components/toaster.d.ts +0 -84
- package/dist/components/toaster.js +0 -290
- package/dist/components/use-dismiss.d.ts +0 -9
- package/dist/components/use-dismiss.js +0 -28
- package/dist/components/use-focus-trap.d.ts +0 -5
- package/dist/components/use-focus-trap.js +0 -54
- package/dist/targets/native/components/paywall-banner.d.ts +0 -11
- package/dist/targets/native/components/paywall-banner.js +0 -55
- package/dist/targets/native/components/paywall.d.ts +0 -18
- package/dist/targets/native/components/paywall.js +0 -71
- /package/dist/{components/pix-icon.js → icons/pix.js} +0 -0
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
3
|
+
import { ButtonTone, ButtonVariant, ButtonSize } from './internal/button.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/** Which side of the text the icon goes (Figma: `iconPosition`). */
|
|
6
|
+
type ButtonIconPosition = 'start' | 'end';
|
|
7
|
+
interface ButtonProps extends ComponentPropsWithRef<'button'> {
|
|
8
|
+
/** The button text (Figma: `label`): a verb or a destination. Required, it is the accessible name. */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** The role: brand click (action), quiet (neutral), destructive (danger), or over the brand plate (inverse). */
|
|
11
|
+
tone?: ButtonTone;
|
|
12
|
+
/** The emphasis (Figma: `style`): fill draws the most attention, ghost the least. */
|
|
8
13
|
variant?: ButtonVariant;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
15
|
-
variant?: ButtonVariant;
|
|
16
|
-
color?: ButtonColor;
|
|
14
|
+
/**
|
|
15
|
+
* The height, by the space available (Figma: `size`): sm 36, md 44 (default), lg 52. Text 14/20 on sm and md,
|
|
16
|
+
* 16/24 on lg. The touch target is 44 × 44 in every size: on sm, an invisible layer extends it under a coarse
|
|
17
|
+
* pointer (`@media (pointer: coarse)`), so keep two sm buttons at least 8px apart.
|
|
18
|
+
*/
|
|
17
19
|
size?: ButtonSize;
|
|
20
|
+
/** Icon next to the text (Figma: `showIcon` + `iconName`). Decorative, rendered with aria-hidden. */
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* The side of the icon (Figma: `iconPosition`): `end` (default) after the text, `start` before it. The loader
|
|
24
|
+
* takes the icon's side. It does not change the accessible name.
|
|
25
|
+
*/
|
|
26
|
+
iconPosition?: ButtonIconPosition;
|
|
27
|
+
/** Rendered as aria-disabled="true": the button stays in the tab order and takes focus, but clicks do nothing. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Waiting for what the click started (Figma: `loading`): the icon gives way to a turning loader (without an
|
|
31
|
+
* icon, the loader covers the label), the width stays, clicks are ignored, aria-busy is on and
|
|
32
|
+
* `loadingLabel` is announced to screen readers.
|
|
33
|
+
*/
|
|
18
34
|
loading?: boolean;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
/** What is being waited for, announced while loading ("Salvando…"). */
|
|
36
|
+
loadingLabel?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Render the single child element (an `<a>`, a framework `Link`) with the button's classes and behavior
|
|
39
|
+
* instead of a `<button>`. Use it for navigation: a link that looks like a button.
|
|
40
|
+
*/
|
|
41
|
+
asChild?: boolean;
|
|
24
42
|
}
|
|
25
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Button — Figma [RDS] Actions/Button. Three tones on light surfaces plus inverse for the brand plate,
|
|
45
|
+
* three variants, three sizes (sm 36, md 44, lg 52; the touch target is 44 in all of them), and the icon on
|
|
46
|
+
* either side of the text. Styles: button.css.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <Button size="sm" icon={<PlusIcon />} iconPosition="start">Novo cliente</Button>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function Button({ tone, variant, size, icon, iconPosition, disabled, loading, loadingLabel, asChild, type, className, onClick, children, ...rest }: ButtonProps): react.JSX.Element;
|
|
26
53
|
|
|
27
|
-
export { Button, type
|
|
54
|
+
export { Button, type ButtonIconPosition, type ButtonProps, ButtonSize, ButtonTone, ButtonVariant };
|
|
@@ -5,127 +5,64 @@ import {
|
|
|
5
5
|
__spreadValues
|
|
6
6
|
} from "../chunk-ORMEWXMH.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// Borda de AFFORDANCE: transparente por padrão (filled não tem borda visível). O motor só
|
|
17
|
-
// colore --brand-primary-border quando o fill da marca quase encosta na superfície — aí o
|
|
18
|
-
// hairline evita o botão "sumir" no fundo sem tocar na cor escolhida pelo lojista.
|
|
19
|
-
primary: "bg-brand-primary text-brand-on-primary hover:bg-brand-hover border border-[var(--brand-primary-border,transparent)]",
|
|
20
|
-
secondary: "bg-surface-raised text-fg-primary hover:opacity-90",
|
|
21
|
-
danger: "bg-danger text-fg-inverse hover:bg-danger-text"
|
|
22
|
-
},
|
|
23
|
-
tonal: {
|
|
24
|
-
primary: "bg-brand-primary/10 text-brand-primary hover:bg-brand-primary/20",
|
|
25
|
-
secondary: "bg-surface-raised/60 text-fg-secondary hover:bg-surface-raised",
|
|
26
|
-
danger: "bg-danger-soft text-danger-text hover:bg-danger-soft/70"
|
|
27
|
-
},
|
|
28
|
-
outline: {
|
|
29
|
-
primary: "ring-1 ring-inset ring-brand-primary bg-transparent text-brand-primary hover:bg-surface-raised",
|
|
30
|
-
secondary: "ring-1 ring-inset ring-border-default bg-transparent text-fg-secondary hover:bg-surface-raised",
|
|
31
|
-
danger: "ring-1 ring-inset ring-danger bg-transparent text-danger-text hover:bg-danger-soft"
|
|
32
|
-
},
|
|
33
|
-
ghost: {
|
|
34
|
-
primary: "bg-transparent text-brand-primary hover:bg-surface-raised",
|
|
35
|
-
secondary: "bg-transparent text-fg-secondary hover:bg-surface-raised",
|
|
36
|
-
danger: "bg-transparent text-danger-text hover:bg-danger-soft"
|
|
37
|
-
},
|
|
38
|
-
link: {
|
|
39
|
-
primary: "bg-transparent text-brand-primary underline-offset-4 hover:underline",
|
|
40
|
-
secondary: "bg-transparent text-fg-secondary underline-offset-4 hover:underline",
|
|
41
|
-
danger: "bg-transparent text-danger-text underline-offset-4 hover:underline"
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const sizeClasses = {
|
|
45
|
-
sm: "box-border h-control-sm px-3 text-caption gap-1.5",
|
|
46
|
-
md: "box-border h-control-md px-4 text-label gap-2",
|
|
47
|
-
lg: "box-border h-control-lg px-5 text-body gap-2"
|
|
48
|
-
};
|
|
49
|
-
const linkSizeClasses = {
|
|
50
|
-
sm: "text-caption gap-1",
|
|
51
|
-
md: "text-label gap-1.5",
|
|
52
|
-
lg: "text-body gap-2"
|
|
53
|
-
};
|
|
54
|
-
function buttonVariants({
|
|
55
|
-
variant = "filled",
|
|
56
|
-
color = "primary",
|
|
57
|
-
size = "md",
|
|
58
|
-
fullWidth = false,
|
|
59
|
-
className = ""
|
|
60
|
-
} = {}) {
|
|
61
|
-
return [
|
|
62
|
-
"inline-flex items-center justify-center font-medium transition-colors",
|
|
63
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus focus-visible:ring-offset-2",
|
|
64
|
-
"disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none",
|
|
65
|
-
// Radius vem do token semântico — nunca hardcode (governança em base.css)
|
|
66
|
-
variant === "link" ? linkSizeClasses[size] : `rounded-(--radius-control) ${sizeClasses[size]}`,
|
|
67
|
-
variantColorClasses[variant][color],
|
|
68
|
-
fullWidth && "w-full",
|
|
69
|
-
className
|
|
70
|
-
].filter(Boolean).join(" ");
|
|
71
|
-
}
|
|
72
|
-
const Spinner = () => /* @__PURE__ */ jsxs(
|
|
73
|
-
"svg",
|
|
74
|
-
{
|
|
75
|
-
className: "animate-spin size-4 shrink-0",
|
|
76
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
-
fill: "none",
|
|
78
|
-
viewBox: "0 0 24 24",
|
|
79
|
-
"aria-hidden": "true",
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
82
|
-
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
const Button = forwardRef(function Button2(_a, ref) {
|
|
8
|
+
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
9
|
+
import {
|
|
10
|
+
blockWhenDisabled,
|
|
11
|
+
buttonClassName,
|
|
12
|
+
Loader,
|
|
13
|
+
useLoadingAnnouncement
|
|
14
|
+
} from "./internal/button.js";
|
|
15
|
+
function Button(_a) {
|
|
87
16
|
var _b = _a, {
|
|
88
|
-
|
|
89
|
-
|
|
17
|
+
tone = "action",
|
|
18
|
+
variant = "fill",
|
|
90
19
|
size = "md",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
iconLeft,
|
|
94
|
-
iconRight,
|
|
20
|
+
icon,
|
|
21
|
+
iconPosition = "end",
|
|
95
22
|
disabled,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
23
|
+
loading,
|
|
24
|
+
loadingLabel = "Carregando\u2026",
|
|
25
|
+
asChild,
|
|
26
|
+
type = "button",
|
|
27
|
+
className,
|
|
28
|
+
onClick,
|
|
29
|
+
children
|
|
99
30
|
} = _b, rest = __objRest(_b, [
|
|
31
|
+
"tone",
|
|
100
32
|
"variant",
|
|
101
|
-
"color",
|
|
102
33
|
"size",
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"iconLeft",
|
|
106
|
-
"iconRight",
|
|
34
|
+
"icon",
|
|
35
|
+
"iconPosition",
|
|
107
36
|
"disabled",
|
|
37
|
+
"loading",
|
|
38
|
+
"loadingLabel",
|
|
39
|
+
"asChild",
|
|
40
|
+
"type",
|
|
108
41
|
"className",
|
|
109
|
-
"
|
|
110
|
-
"
|
|
42
|
+
"onClick",
|
|
43
|
+
"children"
|
|
111
44
|
]);
|
|
45
|
+
const Root = asChild ? Slot : "button";
|
|
46
|
+
useLoadingAnnouncement(loading, loadingLabel);
|
|
47
|
+
const overlay = loading && !icon;
|
|
48
|
+
const iconNode = (icon || loading) && /* @__PURE__ */ jsx("span", { className: loading ? "rds-button__icon rds-button__loader" : "rds-button__icon", "aria-hidden": "true", children: loading ? /* @__PURE__ */ jsx(Loader, {}) : icon });
|
|
49
|
+
const start = iconPosition === "start";
|
|
112
50
|
return /* @__PURE__ */ jsxs(
|
|
113
|
-
|
|
114
|
-
__spreadProps(__spreadValues({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
disabled: disabled ||
|
|
118
|
-
|
|
119
|
-
|
|
51
|
+
Root,
|
|
52
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
53
|
+
type: asChild ? void 0 : type,
|
|
54
|
+
className: buttonClassName(tone, variant, size, [overlay && "rds-button--loading", className].filter(Boolean).join(" ")),
|
|
55
|
+
"aria-disabled": disabled || void 0,
|
|
56
|
+
"aria-busy": loading || void 0,
|
|
57
|
+
onClick: blockWhenDisabled(disabled || loading, onClick),
|
|
120
58
|
children: [
|
|
121
|
-
|
|
122
|
-
children,
|
|
123
|
-
|
|
59
|
+
start && iconNode,
|
|
60
|
+
/* @__PURE__ */ jsx(Slottable, { children }),
|
|
61
|
+
!start && iconNode
|
|
124
62
|
]
|
|
125
63
|
})
|
|
126
64
|
);
|
|
127
|
-
}
|
|
65
|
+
}
|
|
128
66
|
export {
|
|
129
|
-
Button
|
|
130
|
-
buttonVariants
|
|
67
|
+
Button
|
|
131
68
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { IsoDate } from './internal/dates.js';
|
|
4
|
+
|
|
5
|
+
interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
6
|
+
/** Controlled: the chosen day, ISO (2026-09-30), or null for none. */
|
|
7
|
+
value?: IsoDate | null;
|
|
8
|
+
/** Uncontrolled: the day chosen at first. */
|
|
9
|
+
defaultValue?: IsoDate;
|
|
10
|
+
/** Called with the ISO day the person chose. */
|
|
11
|
+
onValueChange?: (value: IsoDate) => void;
|
|
12
|
+
/** The month shown at first when there is no choice (any ISO day in it). By default, today's month. */
|
|
13
|
+
defaultMonth?: IsoDate;
|
|
14
|
+
/** Days that can't be chosen (past days, weekends). They stay in the grid, faded and struck through. */
|
|
15
|
+
isDateDisabled?: (date: Date) => boolean;
|
|
16
|
+
/** Takes the focus to the chosen day (or today) when it mounts: for the DatePicker's popover. */
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
/** Today, for tests and screenshots. By default the real today. */
|
|
19
|
+
today?: IsoDate;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Calendar — Figma [RDS] Forms/Calendar. A month to choose a day: the header with the month and the arrows,
|
|
23
|
+
* the weekdays (Sunday first) and always six weeks, so the height does not jump. role="grid", one day in the
|
|
24
|
+
* tab order: the arrows move a day or a week, PageUp/PageDown change the month, Home/End go to the start and
|
|
25
|
+
* end of the week, Enter or Space choose. A range of two days is not in the Figma yet. Styles: calendar.css.
|
|
26
|
+
*/
|
|
27
|
+
declare function Calendar({ value, defaultValue, onValueChange, defaultMonth, isDateDisabled, autoFocus, today: todayIso, className, ...rest }: CalendarProps): react.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { Calendar, type CalendarProps, IsoDate };
|
|
@@ -0,0 +1,149 @@
|
|
|
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 { useEffect, useId, useRef, useState } from "react";
|
|
9
|
+
import { IconButton } from "./icon-button.js";
|
|
10
|
+
import { Tooltip } from "./tooltip.js";
|
|
11
|
+
import { addDays, addMonths, dayName, fromIso, monthName, toIso } from "./internal/dates.js";
|
|
12
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "./internal/icons.js";
|
|
13
|
+
const WEEKDAYS = [
|
|
14
|
+
["D", "domingo"],
|
|
15
|
+
["S", "segunda-feira"],
|
|
16
|
+
["T", "ter\xE7a-feira"],
|
|
17
|
+
["Q", "quarta-feira"],
|
|
18
|
+
["Q", "quinta-feira"],
|
|
19
|
+
["S", "sexta-feira"],
|
|
20
|
+
["S", "s\xE1bado"]
|
|
21
|
+
];
|
|
22
|
+
const startOfGrid = (month) => addDays(month, -month.getDay());
|
|
23
|
+
const sameDay = (a, b) => a !== null && toIso(a) === toIso(b);
|
|
24
|
+
function Calendar(_a) {
|
|
25
|
+
var _b = _a, {
|
|
26
|
+
value,
|
|
27
|
+
defaultValue,
|
|
28
|
+
onValueChange,
|
|
29
|
+
defaultMonth,
|
|
30
|
+
isDateDisabled,
|
|
31
|
+
autoFocus,
|
|
32
|
+
today: todayIso,
|
|
33
|
+
className
|
|
34
|
+
} = _b, rest = __objRest(_b, [
|
|
35
|
+
"value",
|
|
36
|
+
"defaultValue",
|
|
37
|
+
"onValueChange",
|
|
38
|
+
"defaultMonth",
|
|
39
|
+
"isDateDisabled",
|
|
40
|
+
"autoFocus",
|
|
41
|
+
"today",
|
|
42
|
+
"className"
|
|
43
|
+
]);
|
|
44
|
+
var _a2;
|
|
45
|
+
const titleId = useId();
|
|
46
|
+
const [own, setOwn] = useState(defaultValue);
|
|
47
|
+
const chosen = fromIso(value !== void 0 ? value : own);
|
|
48
|
+
const today = (_a2 = fromIso(todayIso)) != null ? _a2 : /* @__PURE__ */ new Date();
|
|
49
|
+
const [focusDay, setFocusDay] = useState(() => {
|
|
50
|
+
var _a3;
|
|
51
|
+
return (_a3 = chosen != null ? chosen : fromIso(defaultMonth)) != null ? _a3 : today;
|
|
52
|
+
});
|
|
53
|
+
const month = new Date(focusDay.getFullYear(), focusDay.getMonth(), 1);
|
|
54
|
+
const grid = useRef(null);
|
|
55
|
+
const moved = useRef(Boolean(autoFocus));
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
var _a3, _b2;
|
|
58
|
+
if (!moved.current) return;
|
|
59
|
+
(_b2 = (_a3 = grid.current) == null ? void 0 : _a3.querySelector('button[tabindex="0"]')) == null ? void 0 : _b2.focus();
|
|
60
|
+
}, [focusDay]);
|
|
61
|
+
const go = (date) => {
|
|
62
|
+
moved.current = true;
|
|
63
|
+
setFocusDay(date);
|
|
64
|
+
};
|
|
65
|
+
const choose = (date) => {
|
|
66
|
+
const iso = toIso(date);
|
|
67
|
+
if (value === void 0) setOwn(iso);
|
|
68
|
+
onValueChange == null ? void 0 : onValueChange(iso);
|
|
69
|
+
go(date);
|
|
70
|
+
};
|
|
71
|
+
const onKeyDown = (event) => {
|
|
72
|
+
const moves = {
|
|
73
|
+
ArrowLeft: () => addDays(focusDay, -1),
|
|
74
|
+
ArrowRight: () => addDays(focusDay, 1),
|
|
75
|
+
ArrowUp: () => addDays(focusDay, -7),
|
|
76
|
+
ArrowDown: () => addDays(focusDay, 7),
|
|
77
|
+
PageUp: () => addMonths(focusDay, -1),
|
|
78
|
+
PageDown: () => addMonths(focusDay, 1),
|
|
79
|
+
Home: () => addDays(focusDay, -focusDay.getDay()),
|
|
80
|
+
End: () => addDays(focusDay, 6 - focusDay.getDay())
|
|
81
|
+
};
|
|
82
|
+
const next = moves[event.key];
|
|
83
|
+
if (!next) return;
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
go(next());
|
|
86
|
+
};
|
|
87
|
+
const first = startOfGrid(month);
|
|
88
|
+
const weeks = Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_2, d) => addDays(first, w * 7 + d)));
|
|
89
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, rest), { className: ["rds-calendar", className].filter(Boolean).join(" "), children: [
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-calendar__header", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Tooltip, { text: "M\xEAs anterior", children: /* @__PURE__ */ jsx(
|
|
92
|
+
IconButton,
|
|
93
|
+
{
|
|
94
|
+
icon: /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
|
|
95
|
+
label: "M\xEAs anterior",
|
|
96
|
+
tone: "neutral",
|
|
97
|
+
variant: "ghost",
|
|
98
|
+
onClick: () => setFocusDay(addMonths(focusDay, -1))
|
|
99
|
+
}
|
|
100
|
+
) }),
|
|
101
|
+
/* @__PURE__ */ jsx("h2", { id: titleId, className: "rds-calendar__title", "aria-live": "polite", children: monthName(month) }),
|
|
102
|
+
/* @__PURE__ */ jsx(Tooltip, { text: "Pr\xF3ximo m\xEAs", children: /* @__PURE__ */ jsx(
|
|
103
|
+
IconButton,
|
|
104
|
+
{
|
|
105
|
+
icon: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
|
|
106
|
+
label: "Pr\xF3ximo m\xEAs",
|
|
107
|
+
tone: "neutral",
|
|
108
|
+
variant: "ghost",
|
|
109
|
+
onClick: () => setFocusDay(addMonths(focusDay, 1))
|
|
110
|
+
}
|
|
111
|
+
) })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsxs("table", { ref: grid, role: "grid", "aria-labelledby": titleId, className: "rds-calendar__grid", onKeyDown, children: [
|
|
114
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: WEEKDAYS.map(([letter, name], i) => /* @__PURE__ */ jsxs("th", { scope: "col", abbr: name, className: "rds-calendar__weekday", children: [
|
|
115
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: letter }),
|
|
116
|
+
/* @__PURE__ */ jsx("span", { className: "rds-visually-hidden", children: name })
|
|
117
|
+
] }, i)) }) }),
|
|
118
|
+
/* @__PURE__ */ jsx("tbody", { children: weeks.map((week, w) => /* @__PURE__ */ jsx("tr", { children: week.map((date) => {
|
|
119
|
+
var _a3;
|
|
120
|
+
const outside = date.getMonth() !== month.getMonth();
|
|
121
|
+
const disabled = (_a3 = isDateDisabled == null ? void 0 : isDateDisabled(date)) != null ? _a3 : false;
|
|
122
|
+
const selected = sameDay(chosen, date);
|
|
123
|
+
const isToday = sameDay(today, date);
|
|
124
|
+
return /* @__PURE__ */ jsx("td", { role: "gridcell", "aria-selected": selected, className: "rds-calendar__cell", children: /* @__PURE__ */ jsx(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
tabIndex: sameDay(focusDay, date) ? 0 : -1,
|
|
129
|
+
"aria-label": dayName(date),
|
|
130
|
+
"aria-current": isToday ? "date" : void 0,
|
|
131
|
+
"aria-disabled": disabled || void 0,
|
|
132
|
+
className: [
|
|
133
|
+
"rds-calendar__day",
|
|
134
|
+
outside && "rds-calendar__day--outside",
|
|
135
|
+
isToday && "rds-calendar__day--today",
|
|
136
|
+
selected && "rds-calendar__day--selected",
|
|
137
|
+
disabled && "rds-calendar__day--disabled"
|
|
138
|
+
].filter(Boolean).join(" "),
|
|
139
|
+
onClick: () => disabled ? go(date) : choose(date),
|
|
140
|
+
children: date.getDate()
|
|
141
|
+
}
|
|
142
|
+
) }, toIso(date));
|
|
143
|
+
}) }, w)) })
|
|
144
|
+
] })
|
|
145
|
+
] }));
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
Calendar
|
|
149
|
+
};
|
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
type CardSurface = 'default' | 'tint';
|
|
5
|
+
type CardSize = 'default' | 'sm';
|
|
6
|
+
type Heading = 'h2' | 'h3' | 'h4';
|
|
7
|
+
interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
8
|
+
/** tint is the brand's light background, with no border, for a card that stands out. */
|
|
9
|
+
surface?: CardSurface;
|
|
10
|
+
/** sm aligns everything on 12 and makes the header text smaller, for dense lists and indicators. */
|
|
11
|
+
size?: CardSize;
|
|
12
|
+
/** article (default) for a topic that reads on its own; section or div when it is part of something larger. */
|
|
13
|
+
as?: 'article' | 'section' | 'div';
|
|
14
|
+
/**
|
|
15
|
+
* CardHeader, CardContent and CardFooter, in this order (Figma: `showHeader`, the `cardContent` slot,
|
|
16
|
+
* `showFooter`). Header and footer are optional.
|
|
17
|
+
*/
|
|
18
|
+
children: ReactNode;
|
|
9
19
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Card — Figma [RDS] Content/Card. A topic that reads on its own: a plan, a summary with an action. Never a card
|
|
22
|
+
* inside a card. When it has a CardHeader, the title names the card. Styles: card.css.
|
|
23
|
+
*/
|
|
24
|
+
declare function Card({ surface, size, as: Root, className, children, ...rest }: CardProps): react.JSX.Element;
|
|
25
|
+
interface CardHeaderProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
26
|
+
/** What the card is about (Figma: `title`). It names the card for screen readers. */
|
|
27
|
+
title: ReactNode;
|
|
28
|
+
/** The heading level that fits the page's heading order. */
|
|
29
|
+
titleAs?: Heading;
|
|
30
|
+
/** One supporting line (Figma: `showDescription` + `description`). */
|
|
13
31
|
description?: ReactNode;
|
|
14
|
-
|
|
15
|
-
badge?: ReactNode;
|
|
16
|
-
/** Ícone exibido à esquerda do título num container 40×40 bg-surface-raised. */
|
|
32
|
+
/** A Tile before the text (Figma: `showIcon`): variant soft, size default (sm on a small card). */
|
|
17
33
|
icon?: ReactNode;
|
|
34
|
+
/** One action on the right (Figma: `showAction` + `action`): a ghost Button or an IconButton. */
|
|
35
|
+
action?: ReactNode;
|
|
36
|
+
/** start: side by side; center: stacked and centred. */
|
|
37
|
+
align?: 'start' | 'center';
|
|
18
38
|
}
|
|
19
|
-
|
|
20
|
-
declare function
|
|
21
|
-
|
|
22
|
-
|
|
39
|
+
/** The card's header (Figma: .card/header). */
|
|
40
|
+
declare function CardHeader({ title, titleAs: Title, description, icon, action, align, className, ...rest }: CardHeaderProps): react.JSX.Element;
|
|
41
|
+
type CardContentProps = HTMLAttributes<HTMLDivElement>;
|
|
42
|
+
/** The card's content (Figma: the `cardContent` slot). */
|
|
43
|
+
declare function CardContent({ className, ...rest }: CardContentProps): react.JSX.Element;
|
|
44
|
+
interface CardFooterProps extends HTMLAttributes<HTMLElement> {
|
|
45
|
+
/** One or two Buttons (Figma: `actions` one · two). A third action goes into the content, as a link. */
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
/** start, end, or full (buttons stacked across the whole width). */
|
|
48
|
+
align?: 'start' | 'end' | 'full';
|
|
49
|
+
/** A line under the buttons (Figma: `showTertiaryContent` + `tertiaryContent`), such as a sign-up link. */
|
|
50
|
+
note?: ReactNode;
|
|
23
51
|
}
|
|
24
|
-
|
|
25
|
-
declare function CardFooter({ className, children, ...
|
|
52
|
+
/** The card's footer, with its actions (Figma: .card/footer). */
|
|
53
|
+
declare function CardFooter({ align, note, className, children, ...rest }: CardFooterProps): react.JSX.Element;
|
|
26
54
|
|
|
27
|
-
export { Card,
|
|
55
|
+
export { Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, type CardSize, type CardSurface };
|
package/dist/components/card.js
CHANGED
|
@@ -1,67 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
__objRest,
|
|
3
4
|
__spreadProps,
|
|
4
5
|
__spreadValues
|
|
5
6
|
} from "../chunk-ORMEWXMH.js";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
elevated: "border border-transparent bg-surface-default shadow-sm",
|
|
10
|
-
filled: "border border-transparent bg-surface-raised",
|
|
11
|
-
flat: "border-0 bg-transparent shadow-none",
|
|
12
|
-
invert: "border border-transparent bg-surface-invert text-fg-inverse"
|
|
13
|
-
};
|
|
8
|
+
import { createContext, useContext, useId } from "react";
|
|
9
|
+
const TitleId = createContext(void 0);
|
|
14
10
|
function Card(_a) {
|
|
15
|
-
var _b = _a, {
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
var _b = _a, { surface = "default", size = "default", as: Root = "article", className, children } = _b, rest = __objRest(_b, ["surface", "size", "as", "className", "children"]);
|
|
12
|
+
const titleId = useId();
|
|
13
|
+
const labelled = Root !== "div" && !rest["aria-label"] && !rest["aria-labelledby"];
|
|
14
|
+
return /* @__PURE__ */ jsx(TitleId.Provider, { value: labelled ? titleId : void 0, children: /* @__PURE__ */ jsx(
|
|
15
|
+
Root,
|
|
18
16
|
__spreadProps(__spreadValues({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
interactive && "transition-shadow hover:shadow-md cursor-pointer",
|
|
23
|
-
className
|
|
24
|
-
].filter(Boolean).join(" ")
|
|
25
|
-
}, props), {
|
|
17
|
+
"aria-labelledby": labelled ? titleId : void 0
|
|
18
|
+
}, rest), {
|
|
19
|
+
className: ["rds-card", `rds-card--${surface}`, size === "sm" && "rds-card--sm", className].filter(Boolean).join(" "),
|
|
26
20
|
children
|
|
27
21
|
})
|
|
28
|
-
);
|
|
22
|
+
) });
|
|
29
23
|
}
|
|
30
24
|
function CardHeader(_c) {
|
|
31
|
-
var _d = _c, { title,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
39
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
40
|
-
/* @__PURE__ */ jsx("h3", { className: "text-label font-semibold text-fg-primary leading-snug", children: title }),
|
|
41
|
-
badge
|
|
42
|
-
] }),
|
|
43
|
-
description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-caption text-fg-muted", children: description })
|
|
44
|
-
] })
|
|
25
|
+
var _d = _c, { title, titleAs: Title = "h3", description, icon, action, align = "start", className } = _d, rest = __objRest(_d, ["title", "titleAs", "description", "icon", "action", "align", "className"]);
|
|
26
|
+
const titleId = useContext(TitleId);
|
|
27
|
+
return /* @__PURE__ */ jsxs("header", __spreadProps(__spreadValues({}, rest), { className: ["rds-card__header", `rds-card__header--${align}`, className].filter(Boolean).join(" "), children: [
|
|
28
|
+
icon,
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-card__heading", children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Title, { id: titleId, className: "rds-card__title", children: title }),
|
|
31
|
+
description && /* @__PURE__ */ jsx("p", { className: "rds-card__description", children: description })
|
|
45
32
|
] }),
|
|
46
|
-
action && /* @__PURE__ */ jsx("div", { className: "
|
|
33
|
+
action && /* @__PURE__ */ jsx("div", { className: "rds-card__action", children: action })
|
|
47
34
|
] }));
|
|
48
35
|
}
|
|
49
|
-
function
|
|
50
|
-
var _f = _e, { className
|
|
51
|
-
return /* @__PURE__ */ jsx("
|
|
52
|
-
}
|
|
53
|
-
function CardBody(_g) {
|
|
54
|
-
var _h = _g, { noPadding, className = "", children } = _h, props = __objRest(_h, ["noPadding", "className", "children"]);
|
|
55
|
-
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ className: [noPadding ? "" : "px-4 pb-4 pt-4 [.ds-card-header+&]:pt-0", className].join(" ").trim() }, props), { children }));
|
|
36
|
+
function CardContent(_e) {
|
|
37
|
+
var _f = _e, { className } = _f, rest = __objRest(_f, ["className"]);
|
|
38
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, rest), { className: ["rds-card__content", className].filter(Boolean).join(" ") }));
|
|
56
39
|
}
|
|
57
|
-
function CardFooter(
|
|
58
|
-
var
|
|
59
|
-
return /* @__PURE__ */
|
|
40
|
+
function CardFooter(_g) {
|
|
41
|
+
var _h = _g, { align = "end", note, className, children } = _h, rest = __objRest(_h, ["align", "note", "className", "children"]);
|
|
42
|
+
return /* @__PURE__ */ jsxs("footer", __spreadProps(__spreadValues({}, rest), { className: ["rds-card__footer", `rds-card__footer--${align}`, className].filter(Boolean).join(" "), children: [
|
|
43
|
+
/* @__PURE__ */ jsx("div", { className: "rds-card__actions", children }),
|
|
44
|
+
note && /* @__PURE__ */ jsx("p", { className: "rds-card__note", children: note })
|
|
45
|
+
] }));
|
|
60
46
|
}
|
|
61
47
|
export {
|
|
62
48
|
Card,
|
|
63
|
-
|
|
49
|
+
CardContent,
|
|
64
50
|
CardFooter,
|
|
65
|
-
CardHeader
|
|
66
|
-
CardTitle
|
|
51
|
+
CardHeader
|
|
67
52
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CarouselProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
5
|
+
/** What the sequence is ("Depoimentos"). Required: it names the carousel. */
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
/** The slides, one child each (Figma: the `slide` slot). Up to 5: beyond that, a list or a grid shows better. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** The previous and next arrows (Figma: `showControls`). On a phone, where the person swipes, you can turn them off. */
|
|
10
|
+
showControls?: boolean;
|
|
11
|
+
/** The position dots (Figma: `showDots`). */
|
|
12
|
+
showDots?: boolean;
|
|
13
|
+
/** The slide shown at first (0-based). */
|
|
14
|
+
defaultIndex?: number;
|
|
15
|
+
/** Controlled slide index. */
|
|
16
|
+
index?: number;
|
|
17
|
+
onIndexChange?: (index: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Carousel — Figma [RDS] Content/Carousel. A short sequence of the same kind of thing, one slide at a time. It never
|
|
21
|
+
* moves on its own. The viewport is a polite live region, so the new slide ("2 de 5") is announced. Keyboard: the
|
|
22
|
+
* left and right arrows change slides while the focus is inside. On touch, swipe. Styles: carousel.css.
|
|
23
|
+
*/
|
|
24
|
+
declare function Carousel({ showControls, showDots, defaultIndex, index, onIndexChange, className, children, onKeyDown, ...rest }: CarouselProps): react.JSX.Element;
|
|
25
|
+
/** Text for an empty slide, as in Figma ("Slide 1 de 5"): a placeholder while the content is not there. */
|
|
26
|
+
declare function CarouselPlaceholder({ className, ...rest }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { Carousel, CarouselPlaceholder, type CarouselProps };
|