@rojaostudio/ds 1.0.0 → 1.0.2
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/dist/components/accordion.js +43 -37
- package/dist/components/alert.js +35 -28
- package/dist/components/avatar.js +41 -34
- package/dist/components/badge.js +21 -14
- package/dist/components/blocker-card.js +11 -2
- package/dist/components/bottom-sheet.js +60 -53
- package/dist/components/breadcrumb.js +32 -22
- package/dist/components/button.js +18 -11
- package/dist/components/card.js +24 -9
- package/dist/components/chat-bubble.js +6 -5
- package/dist/components/checkbox.js +61 -48
- package/dist/components/chip-input.js +98 -81
- package/dist/components/chips.js +36 -29
- package/dist/components/choice-card.js +48 -42
- package/dist/components/choice-carousel.js +79 -74
- package/dist/components/choice-preview-card.js +17 -6
- package/dist/components/color-input.js +41 -35
- package/dist/components/combobox.js +97 -75
- package/dist/components/context-menu.js +17 -13
- package/dist/components/copilot-hint.js +40 -31
- package/dist/components/copy-field.js +8 -5
- package/dist/components/currency-input.js +40 -32
- package/dist/components/danger-zone.js +19 -9
- package/dist/components/data-table-header.js +185 -135
- package/dist/components/date-picker.js +114 -95
- package/dist/components/divider.js +11 -8
- package/dist/components/drawer.js +40 -28
- package/dist/components/dropzone.js +23 -20
- package/dist/components/empty-state.js +26 -23
- package/dist/components/fab.js +38 -26
- package/dist/components/filter-chip.js +20 -16
- package/dist/components/floating-stepper.js +42 -32
- package/dist/components/form-card-header.js +9 -1
- package/dist/components/icon-button.js +19 -13
- package/dist/components/image-crop-modal.js +69 -48
- package/dist/components/image-upload.js +172 -128
- package/dist/components/input.js +90 -62
- package/dist/components/insight-card.js +12 -1
- package/dist/components/label.js +12 -7
- package/dist/components/media-tile.js +11 -8
- package/dist/components/menu.js +28 -25
- package/dist/components/modal.js +43 -28
- package/dist/components/notice.js +34 -16
- package/dist/components/option-tile.js +55 -49
- package/dist/components/page-shell.js +13 -6
- package/dist/components/page-skeleton.js +32 -2
- package/dist/components/page-tabs.js +39 -26
- package/dist/components/pagination.js +38 -33
- package/dist/components/paywall-banner.js +19 -3
- package/dist/components/paywall.js +18 -8
- package/dist/components/phone-frame.js +5 -4
- package/dist/components/phone-input.js +50 -31
- package/dist/components/pix-icon.js +11 -6
- package/dist/components/popover.js +27 -23
- package/dist/components/pricing-card.js +16 -1
- package/dist/components/qr-display.js +16 -11
- package/dist/components/radio.js +73 -56
- package/dist/components/row-actions.js +61 -53
- package/dist/components/saving-bar-context.js +35 -29
- package/dist/components/saving-bar.js +36 -33
- package/dist/components/search.js +49 -44
- package/dist/components/section-card.js +43 -35
- package/dist/components/section-header.js +11 -1
- package/dist/components/select.js +83 -62
- package/dist/components/selectable-card.js +10 -3
- package/dist/components/setting-row.js +11 -1
- package/dist/components/settings-list.js +9 -5
- package/dist/components/skeleton.js +6 -5
- package/dist/components/slider.js +52 -38
- package/dist/components/spinner.js +18 -12
- package/dist/components/step-progress.js +11 -10
- package/dist/components/summary-bar.js +33 -28
- package/dist/components/table.js +20 -15
- package/dist/components/textarea.js +40 -24
- package/dist/components/themed.d.ts +1 -1
- package/dist/components/themed.js +2 -1
- package/dist/components/time-picker.js +117 -97
- package/dist/components/toaster.js +80 -74
- package/dist/components/toggle-card-compact.js +79 -71
- package/dist/components/toggle-card.js +61 -53
- package/dist/components/toggle-group.js +35 -29
- package/dist/components/toggle.js +46 -36
- package/dist/components/tooltip.js +30 -25
- package/dist/components/typing-indicator.js +10 -7
- package/dist/targets/native/components/accordion.js +31 -25
- package/dist/targets/native/components/alert.js +22 -16
- package/dist/targets/native/components/avatar.js +36 -29
- package/dist/targets/native/components/badge.js +4 -3
- package/dist/targets/native/components/button.js +11 -4
- package/dist/targets/native/components/card.js +2 -1
- package/dist/targets/native/components/checkbox.js +18 -15
- package/dist/targets/native/components/chips.js +19 -16
- package/dist/targets/native/components/choice-card.js +29 -23
- package/dist/targets/native/components/context-menu.js +13 -9
- package/dist/targets/native/components/currency-input.js +28 -25
- package/dist/targets/native/components/danger-zone.js +10 -4
- package/dist/targets/native/components/date-picker.js +86 -70
- package/dist/targets/native/components/divider.js +3 -2
- package/dist/targets/native/components/empty-state.js +6 -1
- package/dist/targets/native/components/fab.js +32 -26
- package/dist/targets/native/components/filter-chip.js +9 -8
- package/dist/targets/native/components/form-field.js +20 -10
- package/dist/targets/native/components/form-screen.js +50 -45
- package/dist/targets/native/components/google-icon.js +31 -25
- package/dist/targets/native/components/icon-button.js +6 -4
- package/dist/targets/native/components/icon.js +2 -1
- package/dist/targets/native/components/image-upload.js +59 -50
- package/dist/targets/native/components/input.js +41 -34
- package/dist/targets/native/components/list-item.js +29 -23
- package/dist/targets/native/components/menu.js +12 -10
- package/dist/targets/native/components/modal.js +41 -32
- package/dist/targets/native/components/paywall-banner.js +13 -4
- package/dist/targets/native/components/paywall.js +11 -1
- package/dist/targets/native/components/radio.js +19 -16
- package/dist/targets/native/components/search.js +41 -38
- package/dist/targets/native/components/select.js +71 -63
- package/dist/targets/native/components/sheet.js +36 -30
- package/dist/targets/native/components/skeleton.js +6 -5
- package/dist/targets/native/components/slider.js +51 -43
- package/dist/targets/native/components/spinner.js +2 -1
- package/dist/targets/native/components/stepper.js +14 -9
- package/dist/targets/native/components/switch.js +15 -14
- package/dist/targets/native/components/text.js +2 -1
- package/dist/targets/native/components/textarea.js +2 -1
- package/dist/targets/native/components/theme.js +2 -1
- package/dist/targets/native/components/toaster.js +24 -21
- package/dist/targets/native/index.d.ts +1 -1
- package/dist/targets/native/index.js +1 -3
- package/package.json +190 -194
- package/styles/base.css +3 -3
- package/brand/rojao-black-on-white.png +0 -0
- package/brand/rojao-black.png +0 -0
- package/brand/rojao-white-on-black.png +0 -0
- package/brand/rojao-white.png +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { useId, useMemo, useState } from "react";
|
|
4
5
|
import { usePhoneInput, defaultCountries, parseCountry, FlagImage } from "react-international-phone";
|
|
5
6
|
import { Combobox } from "./combobox.js";
|
|
@@ -50,42 +51,60 @@ function PhoneInput({
|
|
|
50
51
|
value: p.iso2,
|
|
51
52
|
label: p.name,
|
|
52
53
|
description: `+${p.dialCode}`,
|
|
53
|
-
icon: /* @__PURE__ */
|
|
54
|
+
icon: /* @__PURE__ */ jsx(FlagImage, { iso2: p.iso2, size: "18px" })
|
|
54
55
|
};
|
|
55
56
|
}),
|
|
56
57
|
[]
|
|
57
58
|
);
|
|
58
59
|
const errorBorder = error ? "border-danger focus-within:border-danger focus-within:ring-2 focus-within:ring-danger/20" : "border-stroke-control focus-within:border-stroke-focus focus-within:ring-2 focus-within:ring-stroke-focus/20";
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 w-full", children: [
|
|
61
|
+
label && /* @__PURE__ */ jsxs("label", { htmlFor: inputId, className: "inline-flex items-center gap-1 text-label font-medium text-fg-primary", children: [
|
|
62
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
63
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-danger", "aria-label": "obrigat\xF3rio", children: "*" }),
|
|
64
|
+
optional && !required && /* @__PURE__ */ jsx("span", { className: "text-fg-muted font-normal", children: "(opcional)" })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-stretch gap-2", children: [
|
|
67
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
68
|
+
Combobox,
|
|
69
|
+
{
|
|
70
|
+
width: "hug",
|
|
71
|
+
options: countryOptions,
|
|
72
|
+
value: country.iso2,
|
|
73
|
+
onChange: (iso2) => {
|
|
74
|
+
if (iso2) setCountry(iso2);
|
|
75
|
+
},
|
|
76
|
+
placeholder: "Pa\xEDs",
|
|
77
|
+
"aria-label": "Pa\xEDs",
|
|
78
|
+
dropdownMinWidth: 272,
|
|
79
|
+
triggerContent: (sel) => {
|
|
80
|
+
var _a;
|
|
81
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center [&_svg]:size-4 [&_img]:rounded-(--radius-sm)", children: (_a = sel == null ? void 0 : sel.icon) != null ? _a : /* @__PURE__ */ jsx("span", { className: "text-fg-placeholder", children: "Pa\xEDs" }) });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
) }),
|
|
85
|
+
/* @__PURE__ */ jsxs("div", { className: ["flex-1 min-w-0 flex items-center rounded-(--radius-control) border bg-surface-default h-10 transition-colors", errorBorder].join(" "), children: [
|
|
86
|
+
/* @__PURE__ */ jsxs("span", { className: "pl-3 pr-1.5 text-label text-fg-muted select-none shrink-0", "aria-hidden": true, children: [
|
|
87
|
+
"+",
|
|
88
|
+
country.dialCode
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
"input",
|
|
92
|
+
{
|
|
93
|
+
id: inputId,
|
|
94
|
+
ref: inputRef,
|
|
95
|
+
type: "tel",
|
|
96
|
+
value: inputValue,
|
|
97
|
+
onChange: handlePhoneValueChange,
|
|
98
|
+
placeholder,
|
|
99
|
+
"aria-invalid": error ? true : void 0,
|
|
100
|
+
className: "flex-1 min-w-0 bg-transparent pr-3 h-full text-label text-fg-primary placeholder:text-fg-placeholder outline-none"
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: displayValue }),
|
|
106
|
+
(error || helper) && /* @__PURE__ */ jsx("p", { className: ["text-caption", error ? "text-danger-text" : "text-fg-muted"].join(" "), children: error != null ? error : helper })
|
|
107
|
+
] });
|
|
89
108
|
}
|
|
90
109
|
export {
|
|
91
110
|
PhoneInput
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__objRest,
|
|
3
|
+
__spreadProps,
|
|
3
4
|
__spreadValues
|
|
4
5
|
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
7
|
function PixIcon(_a) {
|
|
6
8
|
var _b = _a, { size = 16 } = _b, props = __objRest(_b, ["size"]);
|
|
7
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsxs(
|
|
8
10
|
"svg",
|
|
9
|
-
__spreadValues({
|
|
11
|
+
__spreadProps(__spreadValues({
|
|
10
12
|
width: size,
|
|
11
13
|
height: size,
|
|
12
14
|
viewBox: "0 0 512 512",
|
|
13
15
|
fill: "currentColor",
|
|
14
16
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
17
|
"aria-hidden": "true"
|
|
16
|
-
}, props),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
}, props), {
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx("path", { d: "M242.4 292.5c5.4-5.4 14.7-5.4 20.1 0l77 77c14.2 14.2 33.1 22 53.1 22h15.1l-97.1 97.1c-30.3 30.3-79.5 30.3-109.8 0L103.3 391.2h9.3c20 0 38.9-7.8 53.1-22l76.7-76.7z" }),
|
|
21
|
+
/* @__PURE__ */ jsx("path", { d: "M262.5 218.9c-5.4 5.4-14.7 5.4-20.1 0l-76.7-76.7c-14.2-14.2-33.1-22-53.1-22h-9.3l97.4-97.4c30.3-30.3 79.5-30.3 109.8 0l97.1 97.1h-15.1c-20 0-38.9 7.8-53.1 22l-77 77z" }),
|
|
22
|
+
/* @__PURE__ */ jsx("path", { d: "M112.6 142.7c13.8 0 27.4 5.6 37.2 15.4l76.7 76.7c7.3 7.3 17 10.9 26.6 10.9s19.3-3.6 26.6-10.9l77-77c9.8-9.8 23.4-15.4 37.2-15.4h37.2l58.4 58.4c30.3 30.3 30.3 79.5 0 109.8l-58.4 58.4h-37.2c-13.8 0-27.4-5.6-37.2-15.4l-77-77c-14.2-14.2-39-14.2-53.2 0l-76.7 76.7c-9.8 9.8-23.4 15.4-37.2 15.4H75.4L17 310.7c-30.3-30.3-30.3-79.5 0-109.8l58.4-58.4h37.2z" })
|
|
23
|
+
]
|
|
24
|
+
})
|
|
20
25
|
);
|
|
21
26
|
}
|
|
22
27
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { useEffect, useRef, useState, useId } from "react";
|
|
4
5
|
import { createPortal } from "react-dom";
|
|
5
6
|
function calcPosition(triggerRect, popRect, placement, offset) {
|
|
@@ -108,32 +109,35 @@ function Popover({
|
|
|
108
109
|
}, [open, closeOnOutsideClick, closeOnEsc]);
|
|
109
110
|
const close = () => setOpen(false);
|
|
110
111
|
const toggle = () => setOpen(!open);
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
ref: triggerRef,
|
|
115
|
-
onClick: toggle,
|
|
116
|
-
role: "none",
|
|
117
|
-
className: triggerClassName != null ? triggerClassName : "inline-block"
|
|
118
|
-
},
|
|
119
|
-
trigger
|
|
120
|
-
), mounted && open && createPortal(
|
|
121
|
-
/* @__PURE__ */ React.createElement(
|
|
112
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
122
114
|
"div",
|
|
123
115
|
{
|
|
124
|
-
ref:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
visibility: position ? "visible" : "hidden"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
typeof children === "function" ? children({ close }) : children
|
|
116
|
+
ref: triggerRef,
|
|
117
|
+
onClick: toggle,
|
|
118
|
+
role: "none",
|
|
119
|
+
className: triggerClassName != null ? triggerClassName : "inline-block",
|
|
120
|
+
children: trigger
|
|
121
|
+
}
|
|
134
122
|
),
|
|
135
|
-
|
|
136
|
-
|
|
123
|
+
mounted && open && createPortal(
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
ref: popRef,
|
|
128
|
+
id,
|
|
129
|
+
className: ["fixed z-[1000]", className].join(" "),
|
|
130
|
+
style: {
|
|
131
|
+
top: (_a = position == null ? void 0 : position.top) != null ? _a : -9999,
|
|
132
|
+
left: (_b = position == null ? void 0 : position.left) != null ? _b : -9999,
|
|
133
|
+
visibility: position ? "visible" : "hidden"
|
|
134
|
+
},
|
|
135
|
+
children: typeof children === "function" ? children({ close }) : children
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
document.body
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
137
141
|
}
|
|
138
142
|
export {
|
|
139
143
|
Popover
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-ORMEWXMH.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { Check } from "lucide-react";
|
|
3
4
|
const CHECK_TONE = {
|
|
4
5
|
recommended: "text-brand-on-accent",
|
|
@@ -22,7 +23,21 @@ function PricingCard({
|
|
|
22
23
|
const periodTone = recommended ? "text-fg-inverse/60" : "text-fg-muted";
|
|
23
24
|
const featTone = recommended ? "text-fg-inverse/85" : "text-fg-secondary";
|
|
24
25
|
const check = recommended ? CHECK_TONE.recommended : CHECK_TONE.default;
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", { className: `relative flex flex-col rounded-(--radius-card) p-6 ${surface} ${className}`, children: [
|
|
27
|
+
recommended && /* @__PURE__ */ jsx("span", { className: "absolute -top-3 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-(--radius-badge) bg-brand-accent px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-brand-on-accent", children: recommendedLabel }),
|
|
28
|
+
badge && /* @__PURE__ */ jsx("span", { className: "absolute -top-3 right-4 whitespace-nowrap rounded-(--radius-badge) border border-brand-accent bg-surface-default px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-brand-accent", children: badge }),
|
|
29
|
+
/* @__PURE__ */ jsx("p", { className: `text-caption font-semibold uppercase tracking-widest ${nameTone}`, children: name }),
|
|
30
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 mb-1 flex items-baseline gap-1", children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "text-4xl font-bold leading-none tracking-tight tabular-nums", children: price }),
|
|
32
|
+
period && /* @__PURE__ */ jsx("span", { className: `text-caption ${periodTone}`, children: period })
|
|
33
|
+
] }),
|
|
34
|
+
description && /* @__PURE__ */ jsx("p", { className: `mb-5 min-h-10 text-caption ${descTone}`, children: description }),
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: cta }),
|
|
36
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-5 space-y-2", children: features.map((f) => /* @__PURE__ */ jsxs("li", { className: `flex items-start gap-2 text-caption ${featTone}`, children: [
|
|
37
|
+
/* @__PURE__ */ jsx(Check, { size: 14, className: `mt-0.5 shrink-0 ${check}`, "aria-hidden": "true" }),
|
|
38
|
+
/* @__PURE__ */ jsx("span", { children: f })
|
|
39
|
+
] }, f)) })
|
|
40
|
+
] });
|
|
26
41
|
}
|
|
27
42
|
export {
|
|
28
43
|
PricingCard
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-ORMEWXMH.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
function QRDisplay({
|
|
3
4
|
src,
|
|
4
5
|
alt = "QR Code",
|
|
@@ -7,17 +8,21 @@ function QRDisplay({
|
|
|
7
8
|
children,
|
|
8
9
|
className = ""
|
|
9
10
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: ["flex flex-col items-center gap-4", className].join(" "), children: [
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-(--radius-card) bg-white p-4 shadow-sm", children: /* @__PURE__ */ jsx(
|
|
13
|
+
"img",
|
|
14
|
+
{
|
|
15
|
+
src,
|
|
16
|
+
alt,
|
|
17
|
+
width: size,
|
|
18
|
+
height: size,
|
|
19
|
+
style: { width: size, height: size },
|
|
20
|
+
className: "block"
|
|
21
|
+
}
|
|
22
|
+
) }),
|
|
23
|
+
children,
|
|
24
|
+
caption && /* @__PURE__ */ jsx("div", { className: "max-w-xs text-center text-sm text-fg-secondary leading-snug", children: caption })
|
|
25
|
+
] });
|
|
21
26
|
}
|
|
22
27
|
export {
|
|
23
28
|
QRDisplay
|
package/dist/components/radio.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
__objRest,
|
|
4
4
|
__spreadValues
|
|
5
5
|
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { forwardRef, useId } from "react";
|
|
7
8
|
const SIZE_CLASS = {
|
|
8
9
|
sm: { box: "size-3.5", dot: "size-1.5", label: "text-caption" },
|
|
@@ -14,46 +15,57 @@ const Radio = forwardRef(function Radio2(_a, ref) {
|
|
|
14
15
|
const inputId = id != null ? id : generatedId;
|
|
15
16
|
const errId = `${inputId}-error`;
|
|
16
17
|
const sz = SIZE_CLASS[size];
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
htmlFor: inputId,
|
|
21
|
-
className: [
|
|
22
|
-
"inline-flex items-start gap-2 cursor-pointer",
|
|
23
|
-
"has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
|
|
24
|
-
className
|
|
25
|
-
].filter(Boolean).join(" ")
|
|
26
|
-
},
|
|
27
|
-
/* @__PURE__ */ React.createElement("span", { className: ["relative flex shrink-0 mt-0.5", sz.box].join(" ") }, /* @__PURE__ */ React.createElement(
|
|
28
|
-
"input",
|
|
29
|
-
__spreadValues({
|
|
30
|
-
ref,
|
|
31
|
-
type: "radio",
|
|
32
|
-
id: inputId,
|
|
33
|
-
"aria-invalid": error ? true : void 0,
|
|
34
|
-
"aria-describedby": error ? errId : void 0,
|
|
35
|
-
className: [
|
|
36
|
-
"peer appearance-none rounded-full shrink-0 cursor-pointer",
|
|
37
|
-
sz.box,
|
|
38
|
-
"bg-surface-default",
|
|
39
|
-
error ? "border border-danger checked:border-danger" : "border border-stroke-control checked:border-brand-primary",
|
|
40
|
-
"focus-visible:ring-2 focus-visible:ring-stroke-focus/30 focus-visible:outline-none",
|
|
41
|
-
"disabled:cursor-not-allowed transition-colors"
|
|
42
|
-
].join(" ")
|
|
43
|
-
}, props)
|
|
44
|
-
), /* @__PURE__ */ React.createElement(
|
|
45
|
-
"span",
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-col gap-0.5", children: [
|
|
19
|
+
/* @__PURE__ */ jsxs(
|
|
20
|
+
"label",
|
|
46
21
|
{
|
|
47
|
-
|
|
22
|
+
htmlFor: inputId,
|
|
48
23
|
className: [
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
].join(" ")
|
|
24
|
+
"inline-flex items-start gap-2 cursor-pointer",
|
|
25
|
+
"has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
|
|
26
|
+
className
|
|
27
|
+
].filter(Boolean).join(" "),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("span", { className: ["relative flex shrink-0 mt-0.5", sz.box].join(" "), children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
"input",
|
|
32
|
+
__spreadValues({
|
|
33
|
+
ref,
|
|
34
|
+
type: "radio",
|
|
35
|
+
id: inputId,
|
|
36
|
+
"aria-invalid": error ? true : void 0,
|
|
37
|
+
"aria-describedby": error ? errId : void 0,
|
|
38
|
+
className: [
|
|
39
|
+
"peer appearance-none rounded-full shrink-0 cursor-pointer",
|
|
40
|
+
sz.box,
|
|
41
|
+
"bg-surface-default",
|
|
42
|
+
error ? "border border-danger checked:border-danger" : "border border-stroke-control checked:border-brand-primary",
|
|
43
|
+
"focus-visible:ring-2 focus-visible:ring-stroke-focus/30 focus-visible:outline-none",
|
|
44
|
+
"disabled:cursor-not-allowed transition-colors"
|
|
45
|
+
].join(" ")
|
|
46
|
+
}, props)
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
className: [
|
|
53
|
+
"absolute inset-0 m-auto rounded-full bg-transparent transition-colors pointer-events-none",
|
|
54
|
+
sz.dot,
|
|
55
|
+
error ? "peer-checked:bg-danger" : "peer-checked:bg-brand-primary"
|
|
56
|
+
].join(" ")
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }),
|
|
60
|
+
(label || description) && /* @__PURE__ */ jsxs("span", { className: "flex flex-col gap-0.5 select-none", children: [
|
|
61
|
+
label && /* @__PURE__ */ jsx("span", { className: [sz.label, "text-fg-primary leading-snug"].join(" "), children: label }),
|
|
62
|
+
description && /* @__PURE__ */ jsx("span", { className: "text-caption text-fg-muted leading-snug", children: description })
|
|
63
|
+
] })
|
|
64
|
+
]
|
|
53
65
|
}
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
),
|
|
67
|
+
error && /* @__PURE__ */ jsx("p", { id: errId, className: [sz.box === "size-3.5" ? "pl-5" : "pl-6", "text-caption text-danger-text"].join(" "), children: error })
|
|
68
|
+
] });
|
|
57
69
|
});
|
|
58
70
|
function RadioGroup({
|
|
59
71
|
name,
|
|
@@ -67,28 +79,33 @@ function RadioGroup({
|
|
|
67
79
|
required,
|
|
68
80
|
className = ""
|
|
69
81
|
}) {
|
|
70
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsxs(
|
|
71
83
|
"fieldset",
|
|
72
84
|
{
|
|
73
85
|
className: ["flex flex-col gap-2", className].join(" "),
|
|
74
|
-
"aria-invalid": error ? true : void 0
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
"aria-invalid": error ? true : void 0,
|
|
87
|
+
children: [
|
|
88
|
+
legend && /* @__PURE__ */ jsxs("legend", { className: "text-label font-medium text-fg-primary mb-0.5", children: [
|
|
89
|
+
legend,
|
|
90
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-danger ml-0.5", "aria-label": "obrigat\xF3rio", children: "*" })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ jsx("div", { className: ["flex", orientation === "horizontal" ? "flex-row gap-4 flex-wrap" : "flex-col gap-2"].join(" "), children: options.map((opt) => /* @__PURE__ */ jsx(
|
|
93
|
+
Radio,
|
|
94
|
+
{
|
|
95
|
+
name,
|
|
96
|
+
value: opt.value,
|
|
97
|
+
checked: value === opt.value,
|
|
98
|
+
onChange: () => onChange(opt.value),
|
|
99
|
+
label: opt.label,
|
|
100
|
+
description: opt.description,
|
|
101
|
+
disabled: opt.disabled,
|
|
102
|
+
size
|
|
103
|
+
},
|
|
104
|
+
opt.value
|
|
105
|
+
)) }),
|
|
106
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-caption text-danger-text", children: error })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
92
109
|
);
|
|
93
110
|
}
|
|
94
111
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { MoreVertical } from "lucide-react";
|
|
4
5
|
import { Menu, MenuItem, MenuSeparator } from "./menu.js";
|
|
5
6
|
import { IconButton } from "./icon-button.js";
|
|
@@ -15,61 +16,68 @@ function RowActions({
|
|
|
15
16
|
const normalItems = showSep ? items.filter((i) => i.variant !== "danger") : items;
|
|
16
17
|
const dangerItems = showSep ? items.filter((i) => i.variant === "danger") : [];
|
|
17
18
|
const primaryCls = "inline-flex items-center gap-1 text-caption font-medium border border-stroke-default rounded-(--radius-control) px-2.5 py-1 text-fg-secondary hover:bg-surface-page hover:border-stroke-strong transition-colors whitespace-nowrap";
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
type: "button",
|
|
22
|
-
className: primaryCls,
|
|
23
|
-
onClick: (e) => {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
primaryOnClick();
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
primaryLabel
|
|
29
|
-
) : null, items.length > 0 && /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React.createElement(
|
|
30
|
-
Menu,
|
|
31
|
-
{
|
|
32
|
-
trigger: /* @__PURE__ */ React.createElement(
|
|
33
|
-
IconButton,
|
|
34
|
-
{
|
|
35
|
-
icon: /* @__PURE__ */ React.createElement(MoreVertical, null),
|
|
36
|
-
"aria-label": "Mais a\xE7\xF5es",
|
|
37
|
-
size: "sm",
|
|
38
|
-
variant: "ghost",
|
|
39
|
-
color: "secondary"
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
placement: "bottom-end",
|
|
43
|
-
minWidth: 160
|
|
44
|
-
},
|
|
45
|
-
({ close }) => /* @__PURE__ */ React.createElement(React.Fragment, null, normalItems.map((item, i) => /* @__PURE__ */ React.createElement(
|
|
46
|
-
MenuItem,
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-1", children: [
|
|
20
|
+
primaryHref ? /* @__PURE__ */ jsx("a", { href: primaryHref, className: primaryCls, onClick: (e) => e.stopPropagation(), children: primaryLabel }) : primaryOnClick ? /* @__PURE__ */ jsx(
|
|
21
|
+
"button",
|
|
47
22
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
MenuItem,
|
|
23
|
+
type: "button",
|
|
24
|
+
className: primaryCls,
|
|
25
|
+
onClick: (e) => {
|
|
26
|
+
e.stopPropagation();
|
|
27
|
+
primaryOnClick();
|
|
28
|
+
},
|
|
29
|
+
children: primaryLabel
|
|
30
|
+
}
|
|
31
|
+
) : null,
|
|
32
|
+
items.length > 0 && /* @__PURE__ */ jsx("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
33
|
+
Menu,
|
|
60
34
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
35
|
+
trigger: /* @__PURE__ */ jsx(
|
|
36
|
+
IconButton,
|
|
37
|
+
{
|
|
38
|
+
icon: /* @__PURE__ */ jsx(MoreVertical, {}),
|
|
39
|
+
"aria-label": "Mais a\xE7\xF5es",
|
|
40
|
+
size: "sm",
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
color: "secondary"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
placement: "bottom-end",
|
|
46
|
+
minWidth: 160,
|
|
47
|
+
children: ({ close }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
normalItems.map((item, i) => /* @__PURE__ */ jsx(
|
|
49
|
+
MenuItem,
|
|
50
|
+
{
|
|
51
|
+
icon: item.icon,
|
|
52
|
+
variant: item.variant,
|
|
53
|
+
disabled: item.disabled,
|
|
54
|
+
onClick: () => {
|
|
55
|
+
item.onClick();
|
|
56
|
+
close();
|
|
57
|
+
},
|
|
58
|
+
children: item.label
|
|
59
|
+
},
|
|
60
|
+
i
|
|
61
|
+
)),
|
|
62
|
+
showSep && dangerItems.length > 0 && /* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
63
|
+
dangerItems.map((item, i) => /* @__PURE__ */ jsx(
|
|
64
|
+
MenuItem,
|
|
65
|
+
{
|
|
66
|
+
icon: item.icon,
|
|
67
|
+
variant: "danger",
|
|
68
|
+
disabled: item.disabled,
|
|
69
|
+
onClick: () => {
|
|
70
|
+
item.onClick();
|
|
71
|
+
close();
|
|
72
|
+
},
|
|
73
|
+
children: item.label
|
|
74
|
+
},
|
|
75
|
+
`d-${i}`
|
|
76
|
+
))
|
|
77
|
+
] })
|
|
78
|
+
}
|
|
79
|
+
) })
|
|
80
|
+
] });
|
|
73
81
|
}
|
|
74
82
|
export {
|
|
75
83
|
RowActions
|