@rojaostudio/ds 1.0.2 → 2.0.0-next.1
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 -52
- package/dist/components/index.js +190 -74
- 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
package/dist/components/alert.js
CHANGED
|
@@ -1,77 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
2
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
warning: {
|
|
16
|
-
container: "bg-warning-soft border-warning-border text-warning-text",
|
|
17
|
-
icon: /* @__PURE__ */ jsx(AlertTriangle, { size: 16, className: "shrink-0 mt-0.5" }),
|
|
18
|
-
actionColor: "text-warning-text hover:bg-warning-soft/60"
|
|
19
|
-
},
|
|
20
|
-
info: {
|
|
21
|
-
container: "bg-info-soft border-info-border text-info-text",
|
|
22
|
-
icon: /* @__PURE__ */ jsx(Info, { size: 16, className: "shrink-0 mt-0.5" }),
|
|
23
|
-
actionColor: "text-info-text hover:bg-info-soft/60"
|
|
24
|
-
},
|
|
25
|
-
neutral: {
|
|
26
|
-
container: "bg-neutral-soft border-neutral-border text-neutral-text",
|
|
27
|
-
icon: /* @__PURE__ */ jsx(Info, { size: 16, className: "shrink-0 mt-0.5" }),
|
|
28
|
-
actionColor: "text-neutral-text hover:bg-neutral-soft/60"
|
|
29
|
-
}
|
|
8
|
+
import { useRef, useState } from "react";
|
|
9
|
+
import { IconButton } from "./icon-button.js";
|
|
10
|
+
import { Tooltip } from "./tooltip.js";
|
|
11
|
+
import { focusAfter } from "./internal/focus-after.js";
|
|
12
|
+
import { AlertIcon, CircleCheckIcon, CloseIcon, InfoIcon, TriangleAlertIcon } from "./internal/icons.js";
|
|
13
|
+
const ICONS = {
|
|
14
|
+
neutral: InfoIcon,
|
|
15
|
+
info: InfoIcon,
|
|
16
|
+
success: CircleCheckIcon,
|
|
17
|
+
warning: TriangleAlertIcon,
|
|
18
|
+
danger: AlertIcon
|
|
30
19
|
};
|
|
31
|
-
function Alert({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
function Alert(_a) {
|
|
21
|
+
var _b = _a, {
|
|
22
|
+
tone = "neutral",
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
showIcon = true,
|
|
26
|
+
action,
|
|
27
|
+
onClose,
|
|
28
|
+
closeLabel = "Fechar aviso",
|
|
29
|
+
announce = "none",
|
|
30
|
+
className
|
|
31
|
+
} = _b, rest = __objRest(_b, [
|
|
32
|
+
"tone",
|
|
33
|
+
"title",
|
|
34
|
+
"description",
|
|
35
|
+
"showIcon",
|
|
36
|
+
"action",
|
|
37
|
+
"onClose",
|
|
38
|
+
"closeLabel",
|
|
39
|
+
"announce",
|
|
40
|
+
"className"
|
|
41
|
+
]);
|
|
42
|
+
const [open, setOpen] = useState(true);
|
|
43
|
+
const ref = useRef(null);
|
|
44
|
+
if (!open) return null;
|
|
45
|
+
const Icon = ICONS[tone];
|
|
43
46
|
return /* @__PURE__ */ jsxs(
|
|
44
47
|
"div",
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
__spreadProps(__spreadValues({
|
|
49
|
+
ref,
|
|
50
|
+
role: announce === "none" ? void 0 : announce
|
|
51
|
+
}, rest), {
|
|
52
|
+
className: ["rds-alert", `rds-alert--${tone}`, className].filter(Boolean).join(" "),
|
|
48
53
|
children: [
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
action && /* @__PURE__ */ jsx(
|
|
54
|
-
"button",
|
|
55
|
-
{
|
|
56
|
-
type: "button",
|
|
57
|
-
onClick: action.onClick,
|
|
58
|
-
className: ["mt-2 inline-flex text-caption font-semibold px-2 py-1 -mx-2 rounded transition-colors", actionColor].join(" "),
|
|
59
|
-
children: action.label
|
|
60
|
-
}
|
|
61
|
-
)
|
|
54
|
+
showIcon && /* @__PURE__ */ jsx("span", { className: "rds-alert__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Icon, {}) }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-alert__content", children: [
|
|
56
|
+
/* @__PURE__ */ jsx("p", { className: "rds-alert__title", children: title }),
|
|
57
|
+
description && /* @__PURE__ */ jsx("div", { className: "rds-alert__description", children: description }),
|
|
58
|
+
action && /* @__PURE__ */ jsx("div", { className: "rds-alert__action", children: action })
|
|
62
59
|
] }),
|
|
63
|
-
onClose && /* @__PURE__ */ jsx(
|
|
64
|
-
|
|
60
|
+
onClose && /* @__PURE__ */ jsx(Tooltip, { text: closeLabel, children: /* @__PURE__ */ jsx(
|
|
61
|
+
IconButton,
|
|
65
62
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
icon: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
64
|
+
label: closeLabel,
|
|
65
|
+
tone: "neutral",
|
|
66
|
+
variant: "ghost",
|
|
67
|
+
className: "rds-alert__close",
|
|
68
|
+
onClick: () => {
|
|
69
|
+
focusAfter(ref.current);
|
|
70
|
+
setOpen(false);
|
|
71
|
+
onClose();
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
|
-
)
|
|
74
|
+
) })
|
|
73
75
|
]
|
|
74
|
-
}
|
|
76
|
+
})
|
|
75
77
|
);
|
|
76
78
|
}
|
|
77
79
|
export {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type AttachmentStatus = 'idle' | 'uploading' | 'processing' | 'error' | 'done';
|
|
5
|
+
type AttachmentOrientation = 'horizontal' | 'vertical';
|
|
6
|
+
interface AttachmentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
7
|
+
/** The file name (Figma: `title`). It also names the actions and the status said to screen readers. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Type and size, such as "PDF · 240 KB" (Figma: `description`). In error, say what went wrong here. */
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The upload's life cycle (Figma: `status`). idle: ready; uploading: the bar (`progress`); processing: a Spinner
|
|
13
|
+
* in place of the icon; error: error border and text, and the retry action; done: a check in place of the icon.
|
|
14
|
+
* Every change is said to screen readers ("Enviando…", "Enviado"), in a polite live region.
|
|
15
|
+
*/
|
|
16
|
+
status?: AttachmentStatus;
|
|
17
|
+
/** horizontal: a document, icon in a 40 box; vertical: an image, a 112 tall preview (Figma: `orientation`). */
|
|
18
|
+
orientation?: AttachmentOrientation;
|
|
19
|
+
/**
|
|
20
|
+
* The file icon (Figma: `icon`). By default a document, or an image when vertical. Vertical, an `<img alt="">`
|
|
21
|
+
* here fills the preview.
|
|
22
|
+
*/
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/** 0 to 100 while uploading. */
|
|
25
|
+
progress?: number;
|
|
26
|
+
/** Shows the × (Figma: `showAction`), named "Remover <title>". */
|
|
27
|
+
onRemove?: () => void;
|
|
28
|
+
/** In error, the action becomes "Enviar <title> de novo". */
|
|
29
|
+
onRetry?: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Attachment — Figma [RDS] Chat/Attachment. A file in the conversation or in the send field: before, during and
|
|
33
|
+
* after the upload. Styles: attachment.css.
|
|
34
|
+
*/
|
|
35
|
+
declare function Attachment({ title, description, status, orientation, icon, progress, onRemove, onRetry, className, ...rest }: AttachmentProps): react.JSX.Element;
|
|
36
|
+
|
|
37
|
+
export { Attachment, type AttachmentOrientation, type AttachmentProps, type AttachmentStatus };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { IconButton } from "./icon-button.js";
|
|
9
|
+
import { Tooltip } from "./tooltip.js";
|
|
10
|
+
import { AlertIcon, CircleCheckIcon, CloseIcon, FileTextIcon, ImageIcon, RotateCcwIcon } from "./internal/icons.js";
|
|
11
|
+
import { Progress } from "./progress.js";
|
|
12
|
+
import { Spinner } from "./spinner.js";
|
|
13
|
+
const SAID = {
|
|
14
|
+
idle: () => "",
|
|
15
|
+
uploading: (title) => `Enviando ${title}`,
|
|
16
|
+
processing: (title) => `Processando ${title}`,
|
|
17
|
+
error: (title) => `N\xE3o deu para enviar ${title}`,
|
|
18
|
+
done: (title) => `${title} enviado`
|
|
19
|
+
};
|
|
20
|
+
function Attachment(_a) {
|
|
21
|
+
var _b = _a, {
|
|
22
|
+
title,
|
|
23
|
+
description,
|
|
24
|
+
status = "idle",
|
|
25
|
+
orientation = "horizontal",
|
|
26
|
+
icon,
|
|
27
|
+
progress = 0,
|
|
28
|
+
onRemove,
|
|
29
|
+
onRetry,
|
|
30
|
+
className
|
|
31
|
+
} = _b, rest = __objRest(_b, [
|
|
32
|
+
"title",
|
|
33
|
+
"description",
|
|
34
|
+
"status",
|
|
35
|
+
"orientation",
|
|
36
|
+
"icon",
|
|
37
|
+
"progress",
|
|
38
|
+
"onRemove",
|
|
39
|
+
"onRetry",
|
|
40
|
+
"className"
|
|
41
|
+
]);
|
|
42
|
+
const busy = status === "uploading" || status === "processing";
|
|
43
|
+
let media;
|
|
44
|
+
if (status === "processing") media = /* @__PURE__ */ jsx(Spinner, { size: "sm" });
|
|
45
|
+
else if (status === "error") media = /* @__PURE__ */ jsx(AlertIcon, {});
|
|
46
|
+
else if (status === "done") media = /* @__PURE__ */ jsx(CircleCheckIcon, {});
|
|
47
|
+
else media = icon != null ? icon : orientation === "vertical" ? /* @__PURE__ */ jsx(ImageIcon, {}) : /* @__PURE__ */ jsx(FileTextIcon, {});
|
|
48
|
+
const action = status === "error" && onRetry ? /* @__PURE__ */ jsx(Tooltip, { text: `Enviar ${title} de novo`, children: /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(RotateCcwIcon, {}), label: `Enviar ${title} de novo`, tone: "neutral", variant: "ghost", onClick: onRetry }) }) : onRemove ? /* @__PURE__ */ jsx(Tooltip, { text: `Remover ${title}`, children: /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(CloseIcon, {}), label: `Remover ${title}`, tone: "neutral", variant: "ghost", onClick: onRemove }) }) : null;
|
|
49
|
+
const content = /* @__PURE__ */ jsxs("div", { className: "rds-attachment__content", children: [
|
|
50
|
+
/* @__PURE__ */ jsx("span", { className: "rds-attachment__title", children: title }),
|
|
51
|
+
description && /* @__PURE__ */ jsx("span", { className: "rds-attachment__description", children: description }),
|
|
52
|
+
status === "uploading" && /* @__PURE__ */ jsx(Progress, { size: "sm", value: progress, label: `Enviando ${title}`, showLabel: false, showValue: false })
|
|
53
|
+
] });
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
55
|
+
"div",
|
|
56
|
+
__spreadProps(__spreadValues({
|
|
57
|
+
"aria-busy": busy || void 0
|
|
58
|
+
}, rest), {
|
|
59
|
+
className: ["rds-attachment", `rds-attachment--${orientation}`, `rds-attachment--${status}`, className].filter(Boolean).join(" "),
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx("div", { className: "rds-attachment__media", "aria-hidden": "true", children: media }),
|
|
62
|
+
orientation === "vertical" ? /* @__PURE__ */ jsxs("div", { className: "rds-attachment__row", children: [
|
|
63
|
+
content,
|
|
64
|
+
action
|
|
65
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
content,
|
|
67
|
+
action
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: "rds-visually-hidden", role: "status", children: SAID[status](title) })
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
Attachment
|
|
76
|
+
};
|
|
@@ -1,45 +1,52 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* <Avatar name="A" />
|
|
15
|
-
* <Avatar name="B" />
|
|
16
|
-
* ...
|
|
17
|
-
* </AvatarGroup>
|
|
18
|
-
*/
|
|
19
|
-
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
20
|
-
type AvatarStatus = 'active' | 'inactive' | 'pending' | 'error';
|
|
21
|
-
interface AvatarProps {
|
|
4
|
+
/** person is a circle; brand is a rounded square (a brand, a company, a campaign). */
|
|
5
|
+
type AvatarType = 'person' | 'brand';
|
|
6
|
+
type AvatarSize = 'sm' | 'default' | 'lg' | 'xl';
|
|
7
|
+
/** What the Avatar shows. It follows from the props: a photo (`src`), initials (a name) or an icon (no name). */
|
|
8
|
+
type AvatarVariant = 'image' | 'fallback' | 'icon';
|
|
9
|
+
interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
10
|
+
/** person is a circle; brand is a square with rounded corners, initials in bold on the brand's mark colour. */
|
|
11
|
+
type?: AvatarType;
|
|
12
|
+
/** sm 24, default 32, lg 40, xl 56. Inside an AvatarGroup, the group's size. */
|
|
13
|
+
size?: AvatarSize;
|
|
14
|
+
/** The photo (Figma: `variant=image`). If it fails to load, the initials (or the icon) show instead. */
|
|
22
15
|
src?: string;
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The full name: the photo's alt, the initials' aria-label and the source of the initials. Leave it out only for an
|
|
18
|
+
* avatar without a name (a visitor): it is then decorative and hidden from screen readers.
|
|
19
|
+
*/
|
|
25
20
|
name?: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
/** The initials (Figma: `fallbackText`). By default two letters from `name`, one on a brand. */
|
|
22
|
+
fallbackText?: string;
|
|
23
|
+
/** The icon when there is no name (Figma: `variant=icon` + `icon`). By default a person, or a building on a brand. */
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
/** The presence dot (Figma: `showBadge`). The colour is not the only sign: `badgeLabel` goes into the accessible name. */
|
|
26
|
+
showBadge?: boolean;
|
|
27
|
+
/** What the dot means, said after the name. */
|
|
28
|
+
badgeLabel?: string;
|
|
31
29
|
}
|
|
30
|
+
/** Two letters: first and last name, or the first two letters of a single word. "?" for an empty name. */
|
|
32
31
|
declare function initials(name: string): string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Avatar — Figma [RDS] Content/Avatar. A person, or a brand, in miniature: photo, initials or icon. Not
|
|
34
|
+
* interactive. The Figma `variant` follows from the props: `src` → image, a name → fallback, neither → icon.
|
|
35
|
+
* Styles: avatar.css.
|
|
36
|
+
*/
|
|
37
|
+
declare function Avatar({ type, size, src, name, fallbackText, icon, showBadge, badgeLabel, className, ...rest }: AvatarProps): react.JSX.Element;
|
|
38
|
+
type AvatarGroupSize = Exclude<AvatarSize, 'xl'>;
|
|
39
|
+
interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
40
|
+
/** Who the group is ("Equipe do projeto"). Required: it names the group for screen readers. */
|
|
41
|
+
'aria-label': string;
|
|
42
|
+
/** The size of every Avatar inside (Figma: sm, default, lg). */
|
|
43
|
+
size?: AvatarGroupSize;
|
|
44
|
+
/** Show only the first `max` and a "+N" with the rest. 3 or 4 is a good limit. */
|
|
36
45
|
max?: number;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
size?: AvatarSize;
|
|
40
|
-
children: React.ReactNode;
|
|
41
|
-
className?: string;
|
|
46
|
+
/** The Avatars. */
|
|
47
|
+
children: ReactNode;
|
|
42
48
|
}
|
|
43
|
-
|
|
49
|
+
/** AvatarGroup — Figma [RDS] Content/AvatarGroup. Overlapping avatars, each with a ring that separates it. */
|
|
50
|
+
declare function AvatarGroup({ size, max, className, children, ...rest }: AvatarGroupProps): react.JSX.Element;
|
|
44
51
|
|
|
45
|
-
export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, type
|
|
52
|
+
export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarGroupSize, type AvatarProps, type AvatarSize, type AvatarType, type AvatarVariant, initials };
|
|
@@ -1,101 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadProps,
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "../chunk-ORMEWXMH.js";
|
|
2
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Children,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sm: "size-8 text-caption",
|
|
7
|
-
md: "size-10 text-label",
|
|
8
|
-
lg: "size-12 text-body",
|
|
9
|
-
xl: "size-16 text-heading-sm"
|
|
10
|
-
};
|
|
11
|
-
const STATUS_DOT_SIZE = {
|
|
12
|
-
xs: "size-1.5",
|
|
13
|
-
sm: "size-2",
|
|
14
|
-
md: "size-2.5",
|
|
15
|
-
lg: "size-3",
|
|
16
|
-
xl: "size-3.5"
|
|
17
|
-
};
|
|
18
|
-
const STATUS_COLOR = {
|
|
19
|
-
active: "bg-success",
|
|
20
|
-
inactive: "bg-state-disabled-text",
|
|
21
|
-
pending: "bg-warning",
|
|
22
|
-
error: "bg-danger"
|
|
23
|
-
};
|
|
8
|
+
import { Children, createContext, useContext, useState } from "react";
|
|
9
|
+
import { BuildingIcon, UserIcon } from "./internal/icons.js";
|
|
10
|
+
const GroupSize = createContext(void 0);
|
|
24
11
|
function initials(name) {
|
|
25
12
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
26
13
|
if (parts.length === 0) return "?";
|
|
27
14
|
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
|
28
15
|
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
29
16
|
}
|
|
30
|
-
function Avatar({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
17
|
+
function Avatar(_a) {
|
|
18
|
+
var _b = _a, {
|
|
19
|
+
type = "person",
|
|
20
|
+
size,
|
|
21
|
+
src,
|
|
22
|
+
name,
|
|
23
|
+
fallbackText,
|
|
24
|
+
icon,
|
|
25
|
+
showBadge,
|
|
26
|
+
badgeLabel = "online",
|
|
27
|
+
className
|
|
28
|
+
} = _b, rest = __objRest(_b, [
|
|
29
|
+
"type",
|
|
30
|
+
"size",
|
|
31
|
+
"src",
|
|
32
|
+
"name",
|
|
33
|
+
"fallbackText",
|
|
34
|
+
"icon",
|
|
35
|
+
"showBadge",
|
|
36
|
+
"badgeLabel",
|
|
37
|
+
"className"
|
|
38
|
+
]);
|
|
39
|
+
var _a2, _b2;
|
|
40
|
+
const groupSize = useContext(GroupSize);
|
|
41
|
+
const finalSize = (_a2 = size != null ? size : groupSize) != null ? _a2 : "default";
|
|
42
|
+
const [failed, setFailed] = useState(null);
|
|
43
|
+
const trimmed = (_b2 = name == null ? void 0 : name.trim()) != null ? _b2 : "";
|
|
44
|
+
const letters = fallbackText != null ? fallbackText : trimmed ? type === "brand" ? trimmed[0].toUpperCase() : initials(trimmed) : "";
|
|
45
|
+
const variant = src && failed !== src ? "image" : letters ? "fallback" : "icon";
|
|
46
|
+
const label = trimmed ? showBadge ? `${trimmed}, ${badgeLabel}` : trimmed : void 0;
|
|
47
|
+
const semantics = variant === "image" ? {} : label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
"span",
|
|
50
|
+
__spreadProps(__spreadValues(__spreadValues({}, semantics), rest), {
|
|
51
|
+
className: ["rds-avatar", `rds-avatar--${type}`, `rds-avatar--${finalSize}`, `rds-avatar--${variant}`, className].filter(Boolean).join(" "),
|
|
52
|
+
children: [
|
|
53
|
+
variant === "image" ? /* @__PURE__ */ jsx("img", { className: "rds-avatar__image", src, alt: label != null ? label : "", onError: () => setFailed(src != null ? src : null) }) : /* @__PURE__ */ jsx("span", { className: "rds-avatar__fallback", "aria-hidden": "true", children: variant === "fallback" ? letters : icon != null ? icon : type === "brand" ? /* @__PURE__ */ jsx(BuildingIcon, {}) : /* @__PURE__ */ jsx(UserIcon, {}) }),
|
|
54
|
+
showBadge && /* @__PURE__ */ jsx("span", { className: "rds-avatar__badge", "aria-hidden": "true" })
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
);
|
|
69
58
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
children,
|
|
80
|
-
className = ""
|
|
81
|
-
}) {
|
|
82
|
-
const items = Children.toArray(children).filter(isValidElement);
|
|
83
|
-
const visible = items.slice(0, max);
|
|
84
|
-
const overflow = items.length - visible.length;
|
|
85
|
-
return /* @__PURE__ */ jsxs("div", { className: ["inline-flex items-center", className].join(" "), role: "group", children: [
|
|
86
|
-
visible.map((child, idx) => {
|
|
87
|
-
var _a;
|
|
88
|
-
return /* @__PURE__ */ jsx("div", { className: idx === 0 ? "" : SPACING_CLASS[spacing], children: cloneElement(child, { size: (_a = child.props.size) != null ? _a : size }) }, idx);
|
|
89
|
-
}),
|
|
90
|
-
overflow > 0 && /* @__PURE__ */ jsx("div", { className: SPACING_CLASS[spacing], children: /* @__PURE__ */ jsx(
|
|
91
|
-
Avatar,
|
|
92
|
-
{
|
|
93
|
-
name: `+${overflow}`,
|
|
94
|
-
variant: "neutral",
|
|
95
|
-
size
|
|
96
|
-
}
|
|
97
|
-
) })
|
|
98
|
-
] });
|
|
59
|
+
function AvatarGroup(_c) {
|
|
60
|
+
var _d = _c, { size = "default", max, className, children } = _d, rest = __objRest(_d, ["size", "max", "className", "children"]);
|
|
61
|
+
const items = Children.toArray(children);
|
|
62
|
+
const shown = max && items.length > max ? items.slice(0, max) : items;
|
|
63
|
+
const hidden = items.length - shown.length;
|
|
64
|
+
return /* @__PURE__ */ jsx(GroupSize.Provider, { value: size, children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ role: "group" }, rest), { className: ["rds-avatar-group", `rds-avatar-group--${size}`, className].filter(Boolean).join(" "), children: [
|
|
65
|
+
shown,
|
|
66
|
+
hidden > 0 && /* @__PURE__ */ jsx(Avatar, { fallbackText: `+${hidden}`, name: `mais ${hidden} ${hidden === 1 ? "pessoa" : "pessoas"}` })
|
|
67
|
+
] })) });
|
|
99
68
|
}
|
|
100
69
|
export {
|
|
101
70
|
Avatar,
|
|
@@ -1,45 +1,34 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
declare const STATUS_VARIANTS: {
|
|
13
|
-
readonly active: {
|
|
14
|
-
readonly dot: "bg-success";
|
|
15
|
-
readonly text: "text-success-text";
|
|
16
|
-
};
|
|
17
|
-
readonly inactive: {
|
|
18
|
-
readonly dot: "bg-state-disabled-text";
|
|
19
|
-
readonly text: "text-state-disabled-text";
|
|
20
|
-
};
|
|
21
|
-
readonly pending: {
|
|
22
|
-
readonly dot: "bg-warning";
|
|
23
|
-
readonly text: "text-warning-text";
|
|
24
|
-
};
|
|
25
|
-
readonly error: {
|
|
26
|
-
readonly dot: "bg-danger";
|
|
27
|
-
readonly text: "text-danger-text";
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
type BadgeVariant = keyof typeof LABEL_VARIANTS | keyof typeof STATUS_VARIANTS | 'count' | 'dot';
|
|
31
|
-
type BadgeSize = 'sm' | 'md';
|
|
32
|
-
interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
33
|
-
variant?: BadgeVariant;
|
|
34
|
-
size?: BadgeSize;
|
|
35
|
-
/** Para variant="count": número exibido. Acima de `max` mostra "max+". */
|
|
36
|
-
count?: number;
|
|
37
|
-
/** Limite pra count overflow. default = 99. */
|
|
38
|
-
max?: number;
|
|
39
|
-
/** Para variant="dot": cor da bolinha (default = brand-primary). */
|
|
40
|
-
dotColor?: 'brand' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
|
|
41
|
-
children?: React.ReactNode;
|
|
4
|
+
type BadgeTone = 'neutral' | 'action' | 'accent' | 'inverse';
|
|
5
|
+
/** Figma calls this property `style`. */
|
|
6
|
+
type BadgeVariant = 'fill' | 'soft' | 'highlight';
|
|
7
|
+
interface BadgeBase extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
8
|
+
/** The label (Figma: `label`): "Nova", "Grátis". Ignored when `value` is given. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Counter mode (Figma: `number=true` + `value`). Above 99 it shows "99+". */
|
|
11
|
+
value?: number;
|
|
42
12
|
}
|
|
43
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Not every tone has every variant (as in Figma): soft only on neutral and action, highlight only on accent,
|
|
15
|
+
* inverse only fill. The types allow only those.
|
|
16
|
+
*/
|
|
17
|
+
type BadgeProps = BadgeBase & ({
|
|
18
|
+
tone?: 'neutral' | 'action';
|
|
19
|
+
variant?: 'fill' | 'soft';
|
|
20
|
+
} | {
|
|
21
|
+
tone: 'accent';
|
|
22
|
+
variant?: 'fill' | 'highlight';
|
|
23
|
+
} | {
|
|
24
|
+
tone: 'inverse';
|
|
25
|
+
variant?: 'fill';
|
|
26
|
+
});
|
|
27
|
+
declare function formatBadgeValue(value: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* Badge — Figma [RDS] Indicators/Badge. A short brand or layout label ("Nova", "Grátis") or a counter. Not
|
|
30
|
+
* interactive and not a state: a state that changes over time is the Status. Styles: badge.css.
|
|
31
|
+
*/
|
|
32
|
+
declare function Badge({ tone, variant, value, children, className, ...rest }: BadgeProps): react.JSX.Element;
|
|
44
33
|
|
|
45
|
-
export { Badge, type BadgeProps, type
|
|
34
|
+
export { Badge, type BadgeProps, type BadgeTone, type BadgeVariant, formatBadgeValue };
|