@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
package/dist/components/input.js
CHANGED
|
@@ -1,164 +1,131 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__objRest,
|
|
4
|
+
__spreadProps,
|
|
4
5
|
__spreadValues
|
|
5
6
|
} from "../chunk-ORMEWXMH.js";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { useRef, useState } from "react";
|
|
9
|
+
import {
|
|
10
|
+
clearNativeValue,
|
|
11
|
+
FieldAction,
|
|
12
|
+
FieldShell,
|
|
13
|
+
hasContent,
|
|
14
|
+
useFieldIds,
|
|
15
|
+
warnIfUnlabelled
|
|
16
|
+
} from "./internal/field.js";
|
|
17
|
+
import { CloseIcon } from "./internal/icons.js";
|
|
18
|
+
function Input(_a) {
|
|
15
19
|
var _b = _a, {
|
|
16
20
|
label,
|
|
17
|
-
|
|
21
|
+
labelPosition,
|
|
22
|
+
hint,
|
|
18
23
|
error,
|
|
19
|
-
|
|
24
|
+
errorMessage,
|
|
20
25
|
required,
|
|
21
|
-
|
|
22
|
-
iconLeft,
|
|
23
|
-
iconRight,
|
|
26
|
+
leadingIcon,
|
|
24
27
|
prefix,
|
|
25
28
|
suffix,
|
|
29
|
+
trailingIcon,
|
|
26
30
|
clearable,
|
|
27
31
|
onClear,
|
|
28
|
-
|
|
29
|
-
showCount,
|
|
30
|
-
className = "",
|
|
32
|
+
clearLabel = "Limpar",
|
|
31
33
|
id,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
disabled,
|
|
35
|
+
className,
|
|
36
|
+
style,
|
|
37
|
+
onChange,
|
|
38
|
+
ref
|
|
39
|
+
} = _b, input = __objRest(_b, [
|
|
37
40
|
"label",
|
|
38
|
-
"
|
|
41
|
+
"labelPosition",
|
|
42
|
+
"hint",
|
|
39
43
|
"error",
|
|
40
|
-
"
|
|
44
|
+
"errorMessage",
|
|
41
45
|
"required",
|
|
42
|
-
"
|
|
43
|
-
"iconLeft",
|
|
44
|
-
"iconRight",
|
|
46
|
+
"leadingIcon",
|
|
45
47
|
"prefix",
|
|
46
48
|
"suffix",
|
|
49
|
+
"trailingIcon",
|
|
47
50
|
"clearable",
|
|
48
51
|
"onClear",
|
|
49
|
-
"
|
|
50
|
-
"showCount",
|
|
51
|
-
"className",
|
|
52
|
+
"clearLabel",
|
|
52
53
|
"id",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
54
|
+
"disabled",
|
|
55
|
+
"className",
|
|
56
|
+
"style",
|
|
57
|
+
"onChange",
|
|
58
|
+
"ref"
|
|
57
59
|
]);
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
] })
|
|
130
|
-
] });
|
|
131
|
-
const wrappedInput = hasAffix ? /* @__PURE__ */ jsxs("div", { className: "inline-flex w-full items-stretch", children: [
|
|
132
|
-
prefix && /* @__PURE__ */ jsx("span", { className: [
|
|
133
|
-
"inline-flex items-center border border-r-0 border-stroke-control rounded-l-(--radius-control) bg-surface-raised text-fg-muted",
|
|
134
|
-
sz.text,
|
|
135
|
-
sz.affix
|
|
136
|
-
].join(" "), children: prefix }),
|
|
137
|
-
inputElement,
|
|
138
|
-
suffix && /* @__PURE__ */ jsx("span", { className: [
|
|
139
|
-
"inline-flex items-center border border-l-0 border-stroke-control rounded-r-(--radius-control) bg-surface-raised text-fg-muted",
|
|
140
|
-
sz.text,
|
|
141
|
-
sz.affix
|
|
142
|
-
].join(" "), children: suffix })
|
|
143
|
-
] }) : inputElement;
|
|
144
|
-
const currentLength = typeof value === "string" ? value.length : typeof defaultValue === "string" ? defaultValue.length : 0;
|
|
145
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 w-full", children: [
|
|
146
|
-
label && /* @__PURE__ */ jsxs("label", { htmlFor: inputId, className: "inline-flex items-center gap-1 text-label font-medium text-fg-primary", children: [
|
|
147
|
-
/* @__PURE__ */ jsx("span", { children: label }),
|
|
148
|
-
required && /* @__PURE__ */ jsx("span", { className: "text-danger", "aria-label": "obrigat\xF3rio", children: "*" }),
|
|
149
|
-
optional && !required && /* @__PURE__ */ jsx("span", { className: "text-fg-muted font-normal", children: "(opcional)" })
|
|
150
|
-
] }),
|
|
151
|
-
wrappedInput,
|
|
152
|
-
(error || helper || showCount && maxLength) && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
153
|
-
error ? /* @__PURE__ */ jsx("p", { id: `${inputId}-error`, className: "text-caption text-danger-text flex-1", children: error }) : helper ? /* @__PURE__ */ jsx("p", { id: `${inputId}-helper`, className: "text-caption text-fg-muted flex-1", children: helper }) : /* @__PURE__ */ jsx("span", { className: "flex-1" }),
|
|
154
|
-
showCount && maxLength && /* @__PURE__ */ jsxs("span", { className: "text-caption text-fg-muted tabular-nums shrink-0", children: [
|
|
155
|
-
currentLength,
|
|
156
|
-
"/",
|
|
157
|
-
maxLength
|
|
158
|
-
] })
|
|
159
|
-
] })
|
|
160
|
-
] });
|
|
161
|
-
});
|
|
60
|
+
warnIfUnlabelled("Input", label, input["aria-label"], input["aria-labelledby"]);
|
|
61
|
+
const { controlId, hintId, errorId, invalid, describedBy } = useFieldIds(id, hint, error, errorMessage);
|
|
62
|
+
const own = useRef(null);
|
|
63
|
+
const [typed, setTyped] = useState(() => hasContent(input.defaultValue));
|
|
64
|
+
const hasValue = input.value !== void 0 ? String(input.value) !== "" : typed;
|
|
65
|
+
const showClear = clearable && hasValue && !disabled;
|
|
66
|
+
const floating = labelPosition === "floating" && hasContent(label);
|
|
67
|
+
function change(event) {
|
|
68
|
+
setTyped(event.target.value !== "");
|
|
69
|
+
onChange == null ? void 0 : onChange(event);
|
|
70
|
+
}
|
|
71
|
+
function setRef(node) {
|
|
72
|
+
own.current = node;
|
|
73
|
+
if (typeof ref === "function") ref(node);
|
|
74
|
+
else if (ref) ref.current = node;
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ jsxs(
|
|
77
|
+
FieldShell,
|
|
78
|
+
{
|
|
79
|
+
kind: "rds-input",
|
|
80
|
+
controlId,
|
|
81
|
+
hintId,
|
|
82
|
+
errorId,
|
|
83
|
+
label,
|
|
84
|
+
labelPosition,
|
|
85
|
+
hint,
|
|
86
|
+
errorMessage,
|
|
87
|
+
invalid,
|
|
88
|
+
required,
|
|
89
|
+
disabled,
|
|
90
|
+
boxClassName: showClear ? "rds-field__box--action" : void 0,
|
|
91
|
+
className,
|
|
92
|
+
style,
|
|
93
|
+
children: [
|
|
94
|
+
leadingIcon && /* @__PURE__ */ jsx("span", { className: "rds-field__icon", "aria-hidden": "true", children: leadingIcon }),
|
|
95
|
+
prefix && /* @__PURE__ */ jsx("span", { className: "rds-field__affix", "aria-hidden": "true", children: prefix }),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"input",
|
|
98
|
+
__spreadProps(__spreadValues({}, input), {
|
|
99
|
+
ref: setRef,
|
|
100
|
+
id: controlId,
|
|
101
|
+
className: "rds-field__control",
|
|
102
|
+
required,
|
|
103
|
+
disabled,
|
|
104
|
+
"aria-invalid": invalid || void 0,
|
|
105
|
+
"aria-describedby": [describedBy, input["aria-describedby"]].filter(Boolean).join(" ") || void 0,
|
|
106
|
+
onChange: change,
|
|
107
|
+
placeholder: floating ? " " : input.placeholder
|
|
108
|
+
})
|
|
109
|
+
),
|
|
110
|
+
suffix && /* @__PURE__ */ jsx("span", { className: "rds-field__affix", "aria-hidden": "true", children: suffix }),
|
|
111
|
+
trailingIcon && !showClear && /* @__PURE__ */ jsx("span", { className: "rds-field__icon", "aria-hidden": "true", children: trailingIcon }),
|
|
112
|
+
showClear && /* @__PURE__ */ jsx(
|
|
113
|
+
FieldAction,
|
|
114
|
+
{
|
|
115
|
+
label: clearLabel,
|
|
116
|
+
icon: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
117
|
+
onClick: () => {
|
|
118
|
+
var _a2;
|
|
119
|
+
clearNativeValue(own.current);
|
|
120
|
+
(_a2 = own.current) == null ? void 0 : _a2.focus();
|
|
121
|
+
onClear == null ? void 0 : onClear();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
162
129
|
export {
|
|
163
130
|
Input
|
|
164
131
|
};
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, ComponentType } from 'react';
|
|
2
3
|
|
|
3
4
|
type InsightCardType = 'alert' | 'opportunity' | 'tip';
|
|
4
|
-
interface InsightCardProps {
|
|
5
|
+
interface InsightCardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
6
|
+
/** The kind of message: it gives the colour and the tag (Atenção, Oportunidade, Dica). */
|
|
5
7
|
type: InsightCardType;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
8
|
+
/** What the system noticed, in one line (Figma: `title`). */
|
|
9
|
+
title: ReactNode;
|
|
10
|
+
/** Why it matters or what to do (Figma: `description`). */
|
|
11
|
+
description: ReactNode;
|
|
12
|
+
/** A number or short highlight beside the title (Figma: `hasPotential` + `potential`): "+ R$ 450/mês". */
|
|
13
|
+
potential?: ReactNode;
|
|
14
|
+
/** The action's text (Figma: `hasAction` + `action`). Rendered with `actionHref` (a link) or `actionOnClick`. */
|
|
11
15
|
action?: string;
|
|
12
|
-
/**
|
|
16
|
+
/** Where the action leads: renders a link (`linkAs`, or a plain <a>). */
|
|
13
17
|
actionHref?: string;
|
|
14
|
-
/**
|
|
18
|
+
/** What the action does: renders a button. Takes precedence over `actionHref`. */
|
|
15
19
|
actionOnClick?: () => void;
|
|
20
|
+
/** The link component for `actionHref` (a framework Link). Default: a plain <a>. */
|
|
21
|
+
linkAs?: ComponentType<{
|
|
22
|
+
href: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}>;
|
|
26
|
+
/** The heading level that fits the page's heading order. */
|
|
27
|
+
titleAs?: 'h2' | 'h3' | 'h4';
|
|
16
28
|
}
|
|
17
|
-
|
|
29
|
+
/**
|
|
30
|
+
* InsightCard — Figma [RDS] Content/InsightCard. A note from the system about the business: an alert, an
|
|
31
|
+
* opportunity or a tip, with what to do. Styles: insight-card.css.
|
|
32
|
+
*/
|
|
33
|
+
declare function InsightCard({ type, title, description, potential, action, actionHref, actionOnClick, linkAs: LinkAs, titleAs: Title, className, ...rest }: InsightCardProps): react.JSX.Element;
|
|
18
34
|
|
|
19
35
|
export { InsightCard, type InsightCardProps, type InsightCardType };
|
|
@@ -1,37 +1,52 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
2
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
const
|
|
4
|
-
alert: { card: "[border-color:var(--insight-alert-border)] [background:var(--insight-alert-bg)]", badge: "[background:var(--insight-alert-badge-bg)] [color:var(--insight-alert-badge-text)]" },
|
|
5
|
-
opportunity: { card: "[border-color:var(--insight-opportunity-border)] [background:var(--insight-opportunity-bg)]", badge: "[background:var(--insight-opportunity-badge-bg)] [color:var(--insight-opportunity-badge-text)]" },
|
|
6
|
-
tip: { card: "[border-color:var(--insight-tip-border)] [background:var(--insight-tip-bg)]", badge: "[background:var(--insight-tip-badge-bg)] [color:var(--insight-tip-badge-text)]" }
|
|
7
|
-
};
|
|
8
|
-
const TYPE_LABELS = {
|
|
7
|
+
const LABELS = {
|
|
9
8
|
alert: "Aten\xE7\xE3o",
|
|
10
9
|
opportunity: "Oportunidade",
|
|
11
10
|
tip: "Dica"
|
|
12
11
|
};
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
function DefaultLink({ href, className, children }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("a", { href, className, children });
|
|
14
|
+
}
|
|
15
|
+
function InsightCard(_a) {
|
|
16
|
+
var _b = _a, {
|
|
17
|
+
type,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
potential,
|
|
21
|
+
action,
|
|
22
|
+
actionHref,
|
|
23
|
+
actionOnClick,
|
|
24
|
+
linkAs: LinkAs = DefaultLink,
|
|
25
|
+
titleAs: Title = "h3",
|
|
26
|
+
className
|
|
27
|
+
} = _b, rest = __objRest(_b, [
|
|
28
|
+
"type",
|
|
29
|
+
"title",
|
|
30
|
+
"description",
|
|
31
|
+
"potential",
|
|
32
|
+
"action",
|
|
33
|
+
"actionHref",
|
|
34
|
+
"actionOnClick",
|
|
35
|
+
"linkAs",
|
|
36
|
+
"titleAs",
|
|
37
|
+
"className"
|
|
38
|
+
]);
|
|
39
|
+
return /* @__PURE__ */ jsxs("article", __spreadProps(__spreadValues({}, rest), { className: ["rds-insight-card", `rds-insight-card--${type}`, className].filter(Boolean).join(" "), children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-insight-card__body", children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "rds-insight-card__badge", children: LABELS[type] }),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "rds-insight-card__head", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Title, { className: "rds-insight-card__title", children: title }),
|
|
44
|
+
potential && /* @__PURE__ */ jsx("span", { className: "rds-insight-card__potential", children: potential })
|
|
30
45
|
] }),
|
|
31
|
-
/* @__PURE__ */ jsx("p", { className: "
|
|
46
|
+
/* @__PURE__ */ jsx("p", { className: "rds-insight-card__description", children: description })
|
|
32
47
|
] }),
|
|
33
|
-
action && (actionOnClick ? /* @__PURE__ */ jsx("button", { type: "button",
|
|
34
|
-
] })
|
|
48
|
+
action && (actionOnClick ? /* @__PURE__ */ jsx("button", { type: "button", className: "rds-insight-card__action", onClick: actionOnClick, children: action }) : actionHref ? /* @__PURE__ */ jsx(LinkAs, { href: actionHref, className: "rds-insight-card__action", children: action }) : null)
|
|
49
|
+
] }));
|
|
35
50
|
}
|
|
36
51
|
export {
|
|
37
52
|
InsightCard
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../../chunk-ORMEWXMH.js";
|
|
2
|
+
let region = null;
|
|
3
|
+
function announce(message) {
|
|
4
|
+
if (typeof document === "undefined") return;
|
|
5
|
+
if (!region || !region.isConnected) {
|
|
6
|
+
region = document.createElement("div");
|
|
7
|
+
region.setAttribute("role", "status");
|
|
8
|
+
region.className = "rds-visually-hidden";
|
|
9
|
+
region.dataset.rdsAnnouncer = "";
|
|
10
|
+
document.body.append(region);
|
|
11
|
+
}
|
|
12
|
+
region.textContent = "";
|
|
13
|
+
const target = region;
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
target.textContent = message;
|
|
16
|
+
}, 50);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
announce
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface BlockHeadingProps {
|
|
5
|
+
/** A short label above the title (Figma: `eyebrow`). */
|
|
6
|
+
eyebrow?: ReactNode;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** The title's id: it names the block's <section>. */
|
|
10
|
+
titleId: string;
|
|
11
|
+
}
|
|
12
|
+
declare function BlockHeading({ eyebrow, title, description, titleId }: BlockHeadingProps): react.JSX.Element;
|
|
13
|
+
declare const cx: (...names: (string | false | undefined)[]) => string;
|
|
14
|
+
|
|
15
|
+
export { BlockHeading, type BlockHeadingProps, cx };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-ORMEWXMH.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function BlockHeading({ eyebrow, title, description, titleId }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: "rds-block__heading", children: [
|
|
5
|
+
eyebrow && /* @__PURE__ */ jsx("p", { className: "rds-block__eyebrow", children: eyebrow }),
|
|
6
|
+
/* @__PURE__ */ jsx("h2", { id: titleId, className: "rds-block__title", children: title }),
|
|
7
|
+
description && /* @__PURE__ */ jsx("p", { className: "rds-block__description", children: description })
|
|
8
|
+
] });
|
|
9
|
+
}
|
|
10
|
+
const cx = (...names) => names.filter(Boolean).join(" ");
|
|
11
|
+
export {
|
|
12
|
+
BlockHeading,
|
|
13
|
+
cx
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { MouseEventHandler, MouseEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
type ButtonTone = 'action' | 'neutral' | 'danger' | 'inverse';
|
|
5
|
+
/** Figma calls this property `style`; here it is `variant` because `style` belongs to React. */
|
|
6
|
+
type ButtonVariant = 'fill' | 'outline' | 'ghost';
|
|
7
|
+
/**
|
|
8
|
+
* The height: sm 36, md 44 (the default), lg 52. The touch target is 44 in every size: on sm, an invisible layer
|
|
9
|
+
* extends it to 44 under a coarse pointer (button.css).
|
|
10
|
+
*/
|
|
11
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
12
|
+
declare function buttonClassName(tone: ButtonTone, variant: ButtonVariant, size: ButtonSize, extra?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* With aria-disabled the element still fires click (implicit form submit on a button, navigation
|
|
15
|
+
* on a link rendered with asChild); cancel it here.
|
|
16
|
+
*/
|
|
17
|
+
declare function blockWhenDisabled<T extends HTMLElement>(disabled: boolean | undefined, onClick?: MouseEventHandler<T>): (event: MouseEvent<T>) => void;
|
|
18
|
+
/** Says `label` through the page's live region when loading starts. */
|
|
19
|
+
declare function useLoadingAnnouncement(loading: boolean | undefined, label: string): void;
|
|
20
|
+
/** The loader: a turning arc, drawn inline so the button needs no icon library. */
|
|
21
|
+
declare function Loader(): react.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { type ButtonSize, type ButtonTone, type ButtonVariant, Loader, blockWhenDisabled, buttonClassName, useLoadingAnnouncement };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "../../chunk-ORMEWXMH.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { announce } from "./announce.js";
|
|
5
|
+
function buttonClassName(tone, variant, size, extra) {
|
|
6
|
+
return ["rds-button", `rds-button--${tone}`, `rds-button--${variant}`, `rds-button--${size}`, extra].filter(Boolean).join(" ");
|
|
7
|
+
}
|
|
8
|
+
function blockWhenDisabled(disabled, onClick) {
|
|
9
|
+
return (event) => {
|
|
10
|
+
if (disabled) {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
onClick == null ? void 0 : onClick(event);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function useLoadingAnnouncement(loading, label) {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (loading) announce(label);
|
|
20
|
+
}, [loading, label]);
|
|
21
|
+
}
|
|
22
|
+
function Loader() {
|
|
23
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Loader,
|
|
27
|
+
blockWhenDisabled,
|
|
28
|
+
buttonClassName,
|
|
29
|
+
useLoadingAnnouncement
|
|
30
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** row: the line with the radio; tile: a grid cell, icon on top; preview: an image on top. */
|
|
5
|
+
type ChoiceCardLayout = 'row' | 'tile' | 'preview';
|
|
6
|
+
interface ChoiceCardProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'children' | 'checked' | 'onSelect'> {
|
|
7
|
+
/** The option (Figma: `label`). It is the radio's accessible name. */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** What choosing it means (Figma: `hasDescription` + `description`). */
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/** An inline SVG in a 36 square (Figma: `hasIcon` + `icon`). Decorative. Not drawn in `preview`. */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** Chosen (Figma: `selected`). Inside a ChoiceCardGroup the group decides; alone, pass it with `onSelect`. */
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
/** Called when the person chooses this card (click, Space, or an arrow key from a sibling with the same name). */
|
|
16
|
+
onSelect?: () => void;
|
|
17
|
+
/** The value inside a ChoiceCardGroup. */
|
|
18
|
+
value?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Figma: `layout`. row (the default): the line with the radio. tile: a grid cell, the icon on top and a check in
|
|
21
|
+
* the corner when chosen. preview: an image on top with the check in its corner. Inside a ChoiceCardGroup the
|
|
22
|
+
* group's layout is the default.
|
|
23
|
+
*/
|
|
24
|
+
layout?: ChoiceCardLayout;
|
|
25
|
+
/** The picture on top in `preview` (a mockup, a swatch, an <img>). Decorative; without it, a placeholder icon. */
|
|
26
|
+
preview?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
declare function ChoiceCardControl({ control, children, description, icon, selected, onSelect, value, disabled, className, onChange, name, layout, preview, ...rest }: ChoiceCardProps & {
|
|
29
|
+
control: 'radio' | 'checkbox';
|
|
30
|
+
}): react.JSX.Element;
|
|
31
|
+
interface ChoiceCardGroupProps {
|
|
32
|
+
/** What is being chosen. Required: it names the group (a visible <legend>). */
|
|
33
|
+
legend: ReactNode;
|
|
34
|
+
/** The ChoiceCards, each with a `value`. */
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
value?: string;
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
onValueChange?: (value: string) => void;
|
|
39
|
+
/** The form field name. By default a generated one. */
|
|
40
|
+
name?: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The cards' layout. row stacks them; tile and preview lay them in a grid (cells of at least 160 and 240) and are
|
|
44
|
+
* every card's default.
|
|
45
|
+
*/
|
|
46
|
+
layout?: ChoiceCardLayout;
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/** A set of ChoiceCards where one is chosen at a time: a <fieldset> of native radios with a legend. */
|
|
50
|
+
declare function ChoiceCardGroup({ legend, children, value, defaultValue, onValueChange, name, disabled, layout, className }: ChoiceCardGroupProps): react.JSX.Element;
|
|
51
|
+
|
|
52
|
+
export { ChoiceCardControl, ChoiceCardGroup, type ChoiceCardGroupProps, type ChoiceCardLayout, type ChoiceCardProps };
|