@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,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
function ChoiceCard({ selected, onClick, label, description, icon, disabled = false, className = "" }) {
|
|
4
|
-
return /* @__PURE__ */
|
|
5
|
+
return /* @__PURE__ */ jsxs(
|
|
5
6
|
"button",
|
|
6
7
|
{
|
|
7
8
|
type: "button",
|
|
@@ -12,47 +13,52 @@ function ChoiceCard({ selected, onClick, label, description, icon, disabled = fa
|
|
|
12
13
|
selected ? "[border-color:var(--choice-card-border-active)] [background:var(--choice-card-bg-active)]" : "[border-color:var(--choice-card-border)] [background:var(--choice-card-bg)] hover:[border-color:var(--choice-card-border-hover)]",
|
|
13
14
|
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
14
15
|
className
|
|
15
|
-
].filter(Boolean).join(" ")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
16
|
+
].filter(Boolean).join(" "),
|
|
17
|
+
children: [
|
|
18
|
+
icon && /* @__PURE__ */ jsx(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: [
|
|
22
|
+
"shrink-0 w-9 h-9 rounded-(--radius-card) flex items-center justify-center transition-colors",
|
|
23
|
+
selected ? "[background:var(--choice-card-icon-bg-active)] [color:var(--choice-card-icon-active)]" : "[background:var(--choice-card-icon-bg)] [color:var(--choice-card-icon)]"
|
|
24
|
+
].join(" "),
|
|
25
|
+
children: icon
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"p",
|
|
31
|
+
{
|
|
32
|
+
className: [
|
|
33
|
+
"text-label font-semibold",
|
|
34
|
+
selected ? "[color:var(--choice-card-label-active)]" : "[color:var(--choice-card-label)]"
|
|
35
|
+
].join(" "),
|
|
36
|
+
children: label
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
description && /* @__PURE__ */ jsx(
|
|
40
|
+
"p",
|
|
41
|
+
{
|
|
42
|
+
className: [
|
|
43
|
+
"text-caption mt-0.5",
|
|
44
|
+
selected ? "[color:var(--choice-card-description-active)]" : "[color:var(--choice-card-description)]"
|
|
45
|
+
].join(" "),
|
|
46
|
+
children: description
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: [
|
|
54
|
+
"shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",
|
|
55
|
+
selected ? "[border-color:var(--choice-card-radio-border-active)]" : "[border-color:var(--choice-card-radio-border)]"
|
|
56
|
+
].join(" "),
|
|
57
|
+
children: selected && /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full [background:var(--choice-card-radio-dot)]" })
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
]
|
|
61
|
+
}
|
|
56
62
|
);
|
|
57
63
|
}
|
|
58
64
|
export {
|
|
@@ -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 { useRef, useState, useEffect, useCallback } from "react";
|
|
4
5
|
function ChoiceCarousel({
|
|
5
6
|
options,
|
|
@@ -70,84 +71,88 @@ function ChoiceCarousel({
|
|
|
70
71
|
scrollByAmount(-1);
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
"aria-label": "Anterior",
|
|
80
|
+
onClick: () => scrollByAmount(-1),
|
|
81
|
+
disabled: !canScrollLeft,
|
|
82
|
+
className: "hidden md:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
|
|
83
|
+
style: {
|
|
84
|
+
background: "var(--choice-carousel-chevron-bg)",
|
|
85
|
+
border: `1px solid var(--choice-carousel-chevron-border)`,
|
|
86
|
+
color: "var(--choice-carousel-chevron-text)",
|
|
87
|
+
boxShadow: "var(--shadow-md)"
|
|
88
|
+
},
|
|
89
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M10 4l-4 4 4 4", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
ref: trackRef,
|
|
96
|
+
role: multiple ? "group" : "radiogroup",
|
|
97
|
+
"aria-label": ariaLabel,
|
|
98
|
+
tabIndex: 0,
|
|
99
|
+
onKeyDown: handleKeyDown,
|
|
100
|
+
className: "flex overflow-x-auto scroll-smooth focus:outline-none",
|
|
101
|
+
style: {
|
|
102
|
+
gap: "var(--choice-carousel-gap)",
|
|
103
|
+
scrollSnapType: "x mandatory",
|
|
104
|
+
scrollbarWidth: "none",
|
|
105
|
+
paddingBlock: 4
|
|
106
|
+
},
|
|
107
|
+
children: options.map((option) => {
|
|
108
|
+
var _a;
|
|
109
|
+
const selected = isSelected(option);
|
|
110
|
+
const disabled = (_a = isDisabled == null ? void 0 : isDisabled(option)) != null ? _a : false;
|
|
111
|
+
return /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
role: multiple ? "checkbox" : "radio",
|
|
115
|
+
"aria-checked": selected,
|
|
116
|
+
"aria-disabled": disabled,
|
|
117
|
+
tabIndex: disabled ? -1 : 0,
|
|
118
|
+
onClick: () => handleSelect(option),
|
|
119
|
+
onKeyDown: (e) => {
|
|
120
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
handleSelect(option);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
className: "shrink-0",
|
|
126
|
+
style: {
|
|
127
|
+
width: "var(--choice-carousel-card-width-mobile)",
|
|
128
|
+
scrollSnapAlign: "start",
|
|
129
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
130
|
+
},
|
|
131
|
+
children: renderCard(option, selected)
|
|
132
|
+
},
|
|
133
|
+
getKey(option)
|
|
134
|
+
);
|
|
135
|
+
})
|
|
103
136
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
onKeyDown: (e) => {
|
|
119
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
120
|
-
e.preventDefault();
|
|
121
|
-
handleSelect(option);
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
className: "shrink-0",
|
|
125
|
-
style: {
|
|
126
|
-
width: "var(--choice-carousel-card-width-mobile)",
|
|
127
|
-
scrollSnapAlign: "start",
|
|
128
|
-
cursor: disabled ? "not-allowed" : "pointer"
|
|
129
|
-
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
"aria-label": "Pr\xF3ximo",
|
|
143
|
+
onClick: () => scrollByAmount(1),
|
|
144
|
+
disabled: !canScrollRight,
|
|
145
|
+
className: "hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
|
|
146
|
+
style: {
|
|
147
|
+
background: "var(--choice-carousel-chevron-bg)",
|
|
148
|
+
border: `1px solid var(--choice-carousel-chevron-border)`,
|
|
149
|
+
color: "var(--choice-carousel-chevron-text)",
|
|
150
|
+
boxShadow: "var(--shadow-md)"
|
|
130
151
|
},
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
})
|
|
134
|
-
), /* @__PURE__ */ React.createElement(
|
|
135
|
-
"button",
|
|
136
|
-
{
|
|
137
|
-
type: "button",
|
|
138
|
-
"aria-label": "Pr\xF3ximo",
|
|
139
|
-
onClick: () => scrollByAmount(1),
|
|
140
|
-
disabled: !canScrollRight,
|
|
141
|
-
className: "hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
|
|
142
|
-
style: {
|
|
143
|
-
background: "var(--choice-carousel-chevron-bg)",
|
|
144
|
-
border: `1px solid var(--choice-carousel-chevron-border)`,
|
|
145
|
-
color: "var(--choice-carousel-chevron-text)",
|
|
146
|
-
boxShadow: "var(--shadow-md)"
|
|
152
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M6 4l4 4-4 4", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
147
153
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
));
|
|
154
|
+
)
|
|
155
|
+
] });
|
|
151
156
|
}
|
|
152
157
|
export {
|
|
153
158
|
ChoiceCarousel
|
|
@@ -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 { Check, Lock } from "lucide-react";
|
|
4
5
|
function ChoicePreviewCard({
|
|
5
6
|
selected,
|
|
@@ -14,7 +15,7 @@ function ChoicePreviewCard({
|
|
|
14
15
|
className = ""
|
|
15
16
|
}) {
|
|
16
17
|
const aspect = previewAspect === "square" ? "aspect-square" : previewAspect === "wide" ? "aspect-[2/1]" : "aspect-video";
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
18
19
|
"button",
|
|
19
20
|
{
|
|
20
21
|
type: "button",
|
|
@@ -27,11 +28,21 @@ function ChoicePreviewCard({
|
|
|
27
28
|
selected ? "border-2 border-stroke-focus bg-surface-raised" : "border border-stroke-default bg-surface-default hover:border-stroke-strong",
|
|
28
29
|
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
|
29
30
|
className
|
|
30
|
-
].filter(Boolean).join(" ")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
].filter(Boolean).join(" "),
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { className: ["relative w-full overflow-hidden rounded-(--radius-card) ring-1 ring-inset ring-stroke-subtle", aspect].join(" "), children: [
|
|
34
|
+
preview,
|
|
35
|
+
badge && /* @__PURE__ */ jsx("span", { className: "absolute top-1.5 left-1.5", children: badge }),
|
|
36
|
+
selected && /* @__PURE__ */ jsx("span", { className: "absolute bottom-1.5 right-1.5 size-5 rounded-full bg-stroke-focus text-surface-default flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { size: 12, strokeWidth: 3 }) }),
|
|
37
|
+
locked && // TODO(DS): trocar por token de overlay (--choice-preview-overlay) — Patrick.
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.55)]", children: /* @__PURE__ */ jsx(Lock, { size: 18, className: "text-white" }) })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "px-1 pt-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-fg-primary", children: label }),
|
|
42
|
+
description && /* @__PURE__ */ jsx("div", { className: "text-xs text-fg-muted mt-0.5 leading-snug", children: description })
|
|
43
|
+
] })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
35
46
|
);
|
|
36
47
|
}
|
|
37
48
|
export {
|
|
@@ -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 { useEffect, useRef, useState } from "react";
|
|
4
5
|
const HEX_RE = /^#[0-9a-fA-F]{6}$/;
|
|
5
6
|
function ColorInput({
|
|
@@ -27,7 +28,7 @@ function ColorInput({
|
|
|
27
28
|
}
|
|
28
29
|
const h = size === "sm" ? "h-control-sm" : "h-control-md";
|
|
29
30
|
const swatch = size === "sm" ? "size-5" : "size-6";
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
31
32
|
"div",
|
|
32
33
|
{
|
|
33
34
|
className: [
|
|
@@ -37,41 +38,46 @@ function ColorInput({
|
|
|
37
38
|
"transition-colors focus-within:border-stroke-focus focus-within:ring-2 focus-within:ring-stroke-focus/20",
|
|
38
39
|
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
39
40
|
className
|
|
40
|
-
].filter(Boolean).join(" ")
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
e
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
].filter(Boolean).join(" "),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("span", { className: `relative shrink-0 ${swatch} rounded-(--radius-control) border border-stroke-subtle overflow-hidden`, children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0", style: { backgroundColor: value } }),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"input",
|
|
47
|
+
{
|
|
48
|
+
type: "color",
|
|
49
|
+
value: HEX_RE.test(value) ? value : "#000000",
|
|
50
|
+
onChange: (e) => onChange(e.target.value.toUpperCase()),
|
|
51
|
+
disabled,
|
|
52
|
+
"aria-label": ariaLabel,
|
|
53
|
+
className: "absolute inset-0 opacity-0 w-full h-full cursor-pointer disabled:cursor-not-allowed"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"input",
|
|
59
|
+
{
|
|
60
|
+
ref: inputRef,
|
|
61
|
+
type: "text",
|
|
62
|
+
value: draft,
|
|
63
|
+
onChange: (e) => setDraft(e.target.value),
|
|
64
|
+
onBlur: commit,
|
|
65
|
+
onKeyDown: (e) => {
|
|
66
|
+
var _a;
|
|
67
|
+
if (e.key === "Enter") {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
commit();
|
|
70
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
disabled,
|
|
74
|
+
maxLength: 7,
|
|
75
|
+
"aria-label": ariaLabel,
|
|
76
|
+
className: "min-w-0 flex-1 bg-transparent text-label font-mono text-fg-primary outline-none disabled:cursor-not-allowed"
|
|
67
77
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"aria-label": ariaLabel,
|
|
72
|
-
className: "min-w-0 flex-1 bg-transparent text-label font-mono text-fg-primary outline-none disabled:cursor-not-allowed"
|
|
73
|
-
}
|
|
74
|
-
)
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
}
|
|
75
81
|
);
|
|
76
82
|
}
|
|
77
83
|
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 { forwardRef, useState, useRef, useEffect, useId, useImperativeHandle } from "react";
|
|
4
5
|
import { ChevronDown, Check, Search as SearchIcon, X, Plus } from "lucide-react";
|
|
5
6
|
import { Popover } from "./popover.js";
|
|
@@ -100,81 +101,97 @@ const Combobox = forwardRef(function Combobox2(props, ref) {
|
|
|
100
101
|
const sel = selectedOption();
|
|
101
102
|
const triggerLabel = isMulti ? props.value.length === 0 ? placeholder : `${props.value.length} selecionado(s)` : (_a = sel == null ? void 0 : sel.label) != null ? _a : placeholder;
|
|
102
103
|
const isPlaceholder = isMulti ? props.value.length === 0 : !sel;
|
|
103
|
-
const dropdown = /* @__PURE__ */
|
|
104
|
+
const dropdown = /* @__PURE__ */ jsxs(
|
|
104
105
|
"div",
|
|
105
106
|
{
|
|
106
107
|
id,
|
|
107
108
|
role: "listbox",
|
|
108
109
|
style: { width: Math.max(dropdownWidth, dropdownMinWidth != null ? dropdownMinWidth : 0) || void 0 },
|
|
109
|
-
className: "max-h-72 overflow-hidden rounded-(--radius-control) border border-stroke-control bg-surface-default shadow-lg flex flex-col"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
110
|
+
className: "max-h-72 overflow-hidden rounded-(--radius-control) border border-stroke-control bg-surface-default shadow-lg flex flex-col",
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "relative shrink-0 border-b border-stroke-subtle", children: [
|
|
113
|
+
/* @__PURE__ */ jsx(SearchIcon, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-fg-muted pointer-events-none" }),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
"input",
|
|
116
|
+
{
|
|
117
|
+
ref: inputRef,
|
|
118
|
+
type: "text",
|
|
119
|
+
value: query,
|
|
120
|
+
onChange: (e) => {
|
|
121
|
+
setQuery(e.target.value);
|
|
122
|
+
setActiveIdx(0);
|
|
123
|
+
},
|
|
124
|
+
onKeyDown: handleKey,
|
|
125
|
+
placeholder: "Buscar\u2026",
|
|
126
|
+
className: "w-full pl-9 pr-8 py-2 text-label bg-transparent outline-none text-fg-primary placeholder:text-fg-placeholder",
|
|
127
|
+
"aria-label": "Buscar op\xE7\xF5es"
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
query && /* @__PURE__ */ jsx(
|
|
131
|
+
"button",
|
|
132
|
+
{
|
|
133
|
+
type: "button",
|
|
134
|
+
onClick: () => {
|
|
135
|
+
var _a2;
|
|
136
|
+
setQuery("");
|
|
137
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
138
|
+
},
|
|
139
|
+
"aria-label": "Limpar",
|
|
140
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 text-fg-muted hover:text-fg-primary p-1",
|
|
141
|
+
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-y-auto py-1 max-h-60", children: filtered.length === 0 && !showCreate ? /* @__PURE__ */ jsx("div", { className: "px-3 py-3 text-label text-fg-muted text-center", children: emptyMessage }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
146
|
+
filtered.map((opt, idx) => {
|
|
147
|
+
const selected = isSelected(opt);
|
|
148
|
+
const active = idx === activeIdx;
|
|
149
|
+
return /* @__PURE__ */ jsxs(
|
|
150
|
+
"button",
|
|
151
|
+
{
|
|
152
|
+
type: "button",
|
|
153
|
+
role: "option",
|
|
154
|
+
"aria-selected": selected,
|
|
155
|
+
disabled: opt.disabled,
|
|
156
|
+
onClick: () => handleSelect(opt),
|
|
157
|
+
onMouseEnter: () => setActiveIdx(idx),
|
|
158
|
+
className: [
|
|
159
|
+
"w-full flex items-start gap-2.5 px-3 py-2 text-label text-left transition-colors",
|
|
160
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
161
|
+
active ? "bg-surface-raised" : "hover:bg-surface-raised"
|
|
162
|
+
].join(" "),
|
|
163
|
+
children: [
|
|
164
|
+
opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-fg-muted mt-0.5 [&_svg]:size-4", children: opt.icon }),
|
|
165
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1 min-w-0", children: [
|
|
166
|
+
/* @__PURE__ */ jsx("span", { className: "block text-fg-primary truncate", children: opt.label }),
|
|
167
|
+
opt.description && /* @__PURE__ */ jsx("span", { className: "block text-caption text-fg-muted truncate", children: opt.description })
|
|
168
|
+
] }),
|
|
169
|
+
selected && /* @__PURE__ */ jsx(Check, { size: 14, className: "shrink-0 text-fg-muted mt-0.5" })
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
opt.value
|
|
173
|
+
);
|
|
174
|
+
}),
|
|
175
|
+
showCreate && /* @__PURE__ */ jsxs(
|
|
176
|
+
"button",
|
|
177
|
+
{
|
|
178
|
+
type: "button",
|
|
179
|
+
onClick: doCreate,
|
|
180
|
+
className: "w-full flex items-center gap-2.5 px-3 py-2 text-label text-left text-fg-primary transition-colors hover:bg-surface-raised border-t border-stroke-subtle",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ jsx(Plus, { size: 14, className: "shrink-0 text-fg-muted" }),
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: createLabel(trimmed) })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }) })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
173
190
|
);
|
|
174
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ jsx("div", { className: ["relative inline-block", width === "full" ? "w-full" : "w-auto", className].join(" "), children: /* @__PURE__ */ jsx(
|
|
175
192
|
Popover,
|
|
176
193
|
{
|
|
177
|
-
trigger: /* @__PURE__ */
|
|
194
|
+
trigger: /* @__PURE__ */ jsxs(
|
|
178
195
|
"button",
|
|
179
196
|
{
|
|
180
197
|
ref: triggerRef,
|
|
@@ -192,10 +209,15 @@ const Combobox = forwardRef(function Combobox2(props, ref) {
|
|
|
192
209
|
"transition-colors focus:outline-none focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
|
|
193
210
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
194
211
|
SIZE_CLASS[size]
|
|
195
|
-
].join(" ")
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
212
|
+
].join(" "),
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsx("span", { className: ["truncate inline-flex items-center", isPlaceholder ? "text-fg-placeholder" : "text-fg-primary"].join(" "), children: triggerContent ? triggerContent(sel) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
215
|
+
(sel == null ? void 0 : sel.icon) && /* @__PURE__ */ jsx("span", { className: "inline-flex mr-2 align-middle [&_svg]:size-4", children: sel.icon }),
|
|
216
|
+
triggerLabel
|
|
217
|
+
] }) }),
|
|
218
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 16, className: "text-fg-muted shrink-0" })
|
|
219
|
+
]
|
|
220
|
+
}
|
|
199
221
|
),
|
|
200
222
|
triggerClassName: width === "full" ? "block w-full" : "inline-block",
|
|
201
223
|
placement: "bottom-start",
|
|
@@ -203,10 +225,10 @@ const Combobox = forwardRef(function Combobox2(props, ref) {
|
|
|
203
225
|
open,
|
|
204
226
|
onOpenChange: (v) => {
|
|
205
227
|
if (!disabled) setOpen(v);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
));
|
|
228
|
+
},
|
|
229
|
+
children: () => dropdown
|
|
230
|
+
}
|
|
231
|
+
) });
|
|
210
232
|
});
|
|
211
233
|
export {
|
|
212
234
|
Combobox
|