@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,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__objRest,
|
|
4
|
+
__spreadProps,
|
|
4
5
|
__spreadValues
|
|
5
6
|
} from "../chunk-ORMEWXMH.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
import { forwardRef } from "react";
|
|
7
9
|
const variantColorClasses = {
|
|
8
10
|
// secondary = ação de BAIXA ÊNFASE, neutra por construção (não a 2ª cor de marca).
|
|
@@ -67,17 +69,19 @@ function buttonVariants({
|
|
|
67
69
|
className
|
|
68
70
|
].filter(Boolean).join(" ");
|
|
69
71
|
}
|
|
70
|
-
const Spinner = () => /* @__PURE__ */
|
|
72
|
+
const Spinner = () => /* @__PURE__ */ jsxs(
|
|
71
73
|
"svg",
|
|
72
74
|
{
|
|
73
75
|
className: "animate-spin size-4 shrink-0",
|
|
74
76
|
xmlns: "http://www.w3.org/2000/svg",
|
|
75
77
|
fill: "none",
|
|
76
78
|
viewBox: "0 0 24 24",
|
|
77
|
-
"aria-hidden": "true"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
82
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
81
85
|
);
|
|
82
86
|
const Button = forwardRef(function Button2(_a, ref) {
|
|
83
87
|
var _b = _a, {
|
|
@@ -105,17 +109,20 @@ const Button = forwardRef(function Button2(_a, ref) {
|
|
|
105
109
|
"children",
|
|
106
110
|
"type"
|
|
107
111
|
]);
|
|
108
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ jsxs(
|
|
109
113
|
"button",
|
|
110
|
-
__spreadValues({
|
|
114
|
+
__spreadProps(__spreadValues({
|
|
111
115
|
ref,
|
|
112
116
|
type,
|
|
113
117
|
disabled: disabled || loading,
|
|
114
118
|
className: buttonVariants({ variant, color, size, fullWidth, className })
|
|
115
|
-
}, rest),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
}, rest), {
|
|
120
|
+
children: [
|
|
121
|
+
loading ? /* @__PURE__ */ jsx(Spinner, {}) : iconLeft && /* @__PURE__ */ jsx("span", { className: "shrink-0 [&_svg]:size-4", children: iconLeft }),
|
|
122
|
+
children,
|
|
123
|
+
iconRight && !loading && /* @__PURE__ */ jsx("span", { className: "shrink-0 [&_svg]:size-4", children: iconRight })
|
|
124
|
+
]
|
|
125
|
+
})
|
|
119
126
|
);
|
|
120
127
|
});
|
|
121
128
|
export {
|
package/dist/components/card.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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
|
const VARIANT_CLASS = {
|
|
6
8
|
outlined: "border border-stroke-default bg-surface-default",
|
|
7
9
|
elevated: "border border-transparent bg-surface-default shadow-sm",
|
|
@@ -11,37 +13,50 @@ const VARIANT_CLASS = {
|
|
|
11
13
|
};
|
|
12
14
|
function Card(_a) {
|
|
13
15
|
var _b = _a, { variant = "elevated", interactive = false, className = "", children } = _b, props = __objRest(_b, ["variant", "interactive", "className", "children"]);
|
|
14
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
15
17
|
"div",
|
|
16
|
-
__spreadValues({
|
|
18
|
+
__spreadProps(__spreadValues({
|
|
17
19
|
className: [
|
|
18
20
|
"rounded-(--radius-card) overflow-hidden",
|
|
19
21
|
VARIANT_CLASS[variant],
|
|
20
22
|
interactive && "transition-shadow hover:shadow-md cursor-pointer",
|
|
21
23
|
className
|
|
22
24
|
].filter(Boolean).join(" ")
|
|
23
|
-
}, props),
|
|
24
|
-
|
|
25
|
+
}, props), {
|
|
26
|
+
children
|
|
27
|
+
})
|
|
25
28
|
);
|
|
26
29
|
}
|
|
27
30
|
function CardHeader(_c) {
|
|
28
31
|
var _d = _c, { title, description, action, badge, icon, className = "", children } = _d, props = __objRest(_d, ["title", "description", "action", "badge", "icon", "className", "children"]);
|
|
29
32
|
if (children) {
|
|
30
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ className: ["ds-card-header flex items-center justify-between gap-4 px-4 py-4", className].join(" ") }, props), { children }));
|
|
31
34
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: ["ds-card-header flex items-start justify-between gap-4 px-4 py-4", className].join(" ") }, props), { children: [
|
|
36
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 min-w-0 flex-1", children: [
|
|
37
|
+
icon && /* @__PURE__ */ jsx("div", { className: "shrink-0 size-10 rounded-(--radius-card) bg-surface-raised flex items-center justify-center text-fg-secondary", children: icon }),
|
|
38
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("h3", { className: "text-label font-semibold text-fg-primary leading-snug", children: title }),
|
|
41
|
+
badge
|
|
42
|
+
] }),
|
|
43
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-caption text-fg-muted", children: description })
|
|
44
|
+
] })
|
|
45
|
+
] }),
|
|
46
|
+
action && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action })
|
|
47
|
+
] }));
|
|
33
48
|
}
|
|
34
49
|
function CardTitle(_e) {
|
|
35
50
|
var _f = _e, { className = "", children } = _f, props = __objRest(_f, ["className", "children"]);
|
|
36
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ jsx("h3", __spreadProps(__spreadValues({ className: ["text-body font-semibold text-fg-primary", className].join(" ") }, props), { children }));
|
|
37
52
|
}
|
|
38
53
|
function CardBody(_g) {
|
|
39
54
|
var _h = _g, { noPadding, className = "", children } = _h, props = __objRest(_h, ["noPadding", "className", "children"]);
|
|
40
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ className: [noPadding ? "" : "px-4 pb-4 pt-4 [.ds-card-header+&]:pt-0", className].join(" ").trim() }, props), { children }));
|
|
41
56
|
}
|
|
42
57
|
function CardFooter(_i) {
|
|
43
58
|
var _j = _i, { className = "", children } = _j, props = __objRest(_j, ["className", "children"]);
|
|
44
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ className: ["flex items-center justify-end gap-3 px-4 pt-2 pb-4", className].join(" ") }, props), { children }));
|
|
45
60
|
}
|
|
46
61
|
export {
|
|
47
62
|
Card,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
function ChatBubble({
|
|
4
5
|
variant,
|
|
5
6
|
state = "sent",
|
|
@@ -31,7 +32,7 @@ function ChatBubble({
|
|
|
31
32
|
borderRadius: "var(--chat-bubble-radius-lg)",
|
|
32
33
|
borderBottomRightRadius: "var(--chat-bubble-radius-sm)"
|
|
33
34
|
};
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx("div", { className: wrapperClass, children: /* @__PURE__ */ jsx(
|
|
35
36
|
"div",
|
|
36
37
|
{
|
|
37
38
|
className: bubbleClass,
|
|
@@ -45,10 +46,10 @@ function ChatBubble({
|
|
|
45
46
|
onClick == null ? void 0 : onClick(e);
|
|
46
47
|
}
|
|
47
48
|
} : void 0,
|
|
48
|
-
"aria-label": ariaLabel
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
));
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
children
|
|
51
|
+
}
|
|
52
|
+
) });
|
|
52
53
|
}
|
|
53
54
|
export {
|
|
54
55
|
ChatBubble
|
|
@@ -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, useEffect, useId, useRef } from "react";
|
|
7
8
|
const SIZE_CLASS = {
|
|
8
9
|
sm: { box: "size-3.5", svg: "size-3.5", label: "text-caption", icon: 12 },
|
|
@@ -23,55 +24,67 @@ const Checkbox = forwardRef(function Checkbox2(_a, ref) {
|
|
|
23
24
|
const inputId = id != null ? id : generatedId;
|
|
24
25
|
const errId = `${inputId}-error`;
|
|
25
26
|
const sz = SIZE_CLASS[size];
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
htmlFor: inputId,
|
|
30
|
-
className: [
|
|
31
|
-
"inline-flex items-start gap-2 cursor-pointer",
|
|
32
|
-
"has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
|
|
33
|
-
className
|
|
34
|
-
].filter(Boolean).join(" ")
|
|
35
|
-
},
|
|
36
|
-
/* @__PURE__ */ React.createElement("span", { className: ["relative flex shrink-0 mt-0.5", sz.box].join(" ") }, /* @__PURE__ */ React.createElement(
|
|
37
|
-
"input",
|
|
38
|
-
__spreadValues({
|
|
39
|
-
ref: setRef,
|
|
40
|
-
type: "checkbox",
|
|
41
|
-
id: inputId,
|
|
42
|
-
"aria-invalid": error ? true : void 0,
|
|
43
|
-
"aria-describedby": error ? errId : void 0,
|
|
44
|
-
className: [
|
|
45
|
-
"peer appearance-none rounded shrink-0 cursor-pointer",
|
|
46
|
-
sz.box,
|
|
47
|
-
"bg-surface-default",
|
|
48
|
-
error ? "border border-danger checked:bg-danger checked:border-danger indeterminate:bg-danger indeterminate:border-danger" : "border border-stroke-control checked:bg-brand-primary checked:border-brand-primary indeterminate:bg-brand-primary indeterminate:border-brand-primary",
|
|
49
|
-
"focus-visible:ring-2 focus-visible:ring-stroke-focus/30 focus-visible:outline-none",
|
|
50
|
-
"disabled:cursor-not-allowed",
|
|
51
|
-
"transition-colors"
|
|
52
|
-
].join(" ")
|
|
53
|
-
}, props)
|
|
54
|
-
), /* @__PURE__ */ React.createElement(
|
|
55
|
-
"svg",
|
|
56
|
-
{
|
|
57
|
-
className: ["absolute inset-0 pointer-events-none hidden peer-checked:block text-brand-on-primary", sz.svg].join(" "),
|
|
58
|
-
viewBox: "0 0 16 16",
|
|
59
|
-
fill: "none",
|
|
60
|
-
"aria-hidden": "true"
|
|
61
|
-
},
|
|
62
|
-
/* @__PURE__ */ React.createElement("path", { d: "M3.5 8L6.5 11L12.5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
63
|
-
), /* @__PURE__ */ React.createElement(
|
|
64
|
-
"svg",
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-col gap-0.5", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs(
|
|
29
|
+
"label",
|
|
65
30
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
31
|
+
htmlFor: inputId,
|
|
32
|
+
className: [
|
|
33
|
+
"inline-flex items-start gap-2 cursor-pointer",
|
|
34
|
+
"has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
|
|
35
|
+
className
|
|
36
|
+
].filter(Boolean).join(" "),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsxs("span", { className: ["relative flex shrink-0 mt-0.5", sz.box].join(" "), children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"input",
|
|
41
|
+
__spreadValues({
|
|
42
|
+
ref: setRef,
|
|
43
|
+
type: "checkbox",
|
|
44
|
+
id: inputId,
|
|
45
|
+
"aria-invalid": error ? true : void 0,
|
|
46
|
+
"aria-describedby": error ? errId : void 0,
|
|
47
|
+
className: [
|
|
48
|
+
"peer appearance-none rounded shrink-0 cursor-pointer",
|
|
49
|
+
sz.box,
|
|
50
|
+
"bg-surface-default",
|
|
51
|
+
error ? "border border-danger checked:bg-danger checked:border-danger indeterminate:bg-danger indeterminate:border-danger" : "border border-stroke-control checked:bg-brand-primary checked:border-brand-primary indeterminate:bg-brand-primary indeterminate:border-brand-primary",
|
|
52
|
+
"focus-visible:ring-2 focus-visible:ring-stroke-focus/30 focus-visible:outline-none",
|
|
53
|
+
"disabled:cursor-not-allowed",
|
|
54
|
+
"transition-colors"
|
|
55
|
+
].join(" ")
|
|
56
|
+
}, props)
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"svg",
|
|
60
|
+
{
|
|
61
|
+
className: ["absolute inset-0 pointer-events-none hidden peer-checked:block text-brand-on-primary", sz.svg].join(" "),
|
|
62
|
+
viewBox: "0 0 16 16",
|
|
63
|
+
fill: "none",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
children: /* @__PURE__ */ jsx("path", { d: "M3.5 8L6.5 11L12.5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"svg",
|
|
70
|
+
{
|
|
71
|
+
className: ["absolute inset-0 pointer-events-none hidden peer-indeterminate:block text-brand-on-primary", sz.svg].join(" "),
|
|
72
|
+
viewBox: "0 0 16 16",
|
|
73
|
+
fill: "none",
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4 8H12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] }),
|
|
79
|
+
(label || description) && /* @__PURE__ */ jsxs("span", { className: "flex flex-col gap-0.5 select-none", children: [
|
|
80
|
+
label && /* @__PURE__ */ jsx("span", { className: [sz.label, "text-fg-primary leading-snug"].join(" "), children: label }),
|
|
81
|
+
description && /* @__PURE__ */ jsx("span", { className: "text-caption text-fg-muted leading-snug", children: description })
|
|
82
|
+
] })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
error && /* @__PURE__ */ jsx("p", { id: errId, className: [sz.box === "size-3.5" ? "pl-5" : "pl-6", "text-caption text-danger-text"].join(" "), children: error })
|
|
87
|
+
] });
|
|
75
88
|
});
|
|
76
89
|
export {
|
|
77
90
|
Checkbox
|
|
@@ -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 { useState, useRef, useEffect } from "react";
|
|
4
5
|
import { createPortal } from "react-dom";
|
|
5
6
|
import { X } from "lucide-react";
|
|
@@ -90,92 +91,108 @@ function ChipInput({
|
|
|
90
91
|
removeChip(value[value.length - 1].id);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
className: "flex flex-wrap gap-1.5 px-2.5 py-2 min-h-[38px] border border-stroke-control rounded-(--radius-control) bg-surface-default focus-within:border-stroke-strong cursor-text",
|
|
97
|
-
onClick: () => {
|
|
98
|
-
var _a;
|
|
99
|
-
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
value.map((chip) => {
|
|
103
|
-
var _a;
|
|
104
|
-
return /* @__PURE__ */ React.createElement(
|
|
105
|
-
"span",
|
|
106
|
-
{
|
|
107
|
-
key: chip.id,
|
|
108
|
-
className: "inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full bg-(--brand-primary) text-(--text-inverse) text-caption font-medium"
|
|
109
|
-
},
|
|
110
|
-
chip.label,
|
|
111
|
-
/* @__PURE__ */ React.createElement(
|
|
112
|
-
"button",
|
|
113
|
-
{
|
|
114
|
-
type: "button",
|
|
115
|
-
onClick: (e) => {
|
|
116
|
-
e.stopPropagation();
|
|
117
|
-
removeChip(chip.id);
|
|
118
|
-
},
|
|
119
|
-
className: "ml-0.5 leading-none hover:opacity-70 transition-opacity",
|
|
120
|
-
"aria-label": (_a = removeAriaLabel == null ? void 0 : removeAriaLabel(chip)) != null ? _a : `Remove ${chip.label}`
|
|
121
|
-
},
|
|
122
|
-
/* @__PURE__ */ React.createElement(X, { size: 12, strokeWidth: 2.5 })
|
|
123
|
-
)
|
|
124
|
-
);
|
|
125
|
-
}),
|
|
126
|
-
/* @__PURE__ */ React.createElement(
|
|
127
|
-
"input",
|
|
94
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative", children: [
|
|
95
|
+
/* @__PURE__ */ jsxs(
|
|
96
|
+
"div",
|
|
128
97
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
setInput(e.target.value);
|
|
134
|
-
setOpen(true);
|
|
98
|
+
className: "flex flex-wrap gap-1.5 px-2.5 py-2 min-h-[38px] border border-stroke-control rounded-(--radius-control) bg-surface-default focus-within:border-stroke-strong cursor-text",
|
|
99
|
+
onClick: () => {
|
|
100
|
+
var _a;
|
|
101
|
+
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
135
102
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
103
|
+
children: [
|
|
104
|
+
value.map((chip) => {
|
|
105
|
+
var _a;
|
|
106
|
+
return /* @__PURE__ */ jsxs(
|
|
107
|
+
"span",
|
|
108
|
+
{
|
|
109
|
+
className: "inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full bg-(--brand-primary) text-(--text-inverse) text-caption font-medium",
|
|
110
|
+
children: [
|
|
111
|
+
chip.label,
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
onClick: (e) => {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
removeChip(chip.id);
|
|
119
|
+
},
|
|
120
|
+
className: "ml-0.5 leading-none hover:opacity-70 transition-opacity",
|
|
121
|
+
"aria-label": (_a = removeAriaLabel == null ? void 0 : removeAriaLabel(chip)) != null ? _a : `Remove ${chip.label}`,
|
|
122
|
+
children: /* @__PURE__ */ jsx(X, { size: 12, strokeWidth: 2.5 })
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
chip.id
|
|
128
|
+
);
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
"input",
|
|
132
|
+
{
|
|
133
|
+
ref: inputRef,
|
|
134
|
+
type: "text",
|
|
135
|
+
value: input,
|
|
136
|
+
onChange: (e) => {
|
|
137
|
+
setInput(e.target.value);
|
|
138
|
+
setOpen(true);
|
|
139
|
+
},
|
|
140
|
+
onKeyDown: handleKeyDown,
|
|
141
|
+
onFocus: () => setOpen(true),
|
|
142
|
+
placeholder: value.length === 0 ? placeholder : "",
|
|
143
|
+
className: "flex-1 min-w-[120px] bg-transparent text-label text-(--text-secondary) placeholder:text-(--text-disabled) focus:outline-none"
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
]
|
|
140
147
|
}
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
ref: listRef,
|
|
147
|
-
style: { position: "fixed", top: pos.top, left: pos.left, width: pos.width },
|
|
148
|
-
className: "z-50 bg-surface-default border border-stroke-control rounded-(--radius-control) shadow-md max-h-48 overflow-auto"
|
|
149
|
-
},
|
|
150
|
-
filtered.map((s) => /* @__PURE__ */ React.createElement("li", { key: s.id }, /* @__PURE__ */ React.createElement(
|
|
151
|
-
"button",
|
|
152
|
-
{
|
|
153
|
-
type: "button",
|
|
154
|
-
onMouseDown: (e) => {
|
|
155
|
-
e.preventDefault();
|
|
156
|
-
selectChip(s);
|
|
157
|
-
},
|
|
158
|
-
className: "w-full text-left px-3 py-2 text-label text-(--text-secondary) hover:bg-(--surface-page) transition-colors"
|
|
159
|
-
},
|
|
160
|
-
s.label
|
|
161
|
-
))),
|
|
162
|
-
showCreate && /* @__PURE__ */ React.createElement("li", { className: filtered.length > 0 ? "border-t border-stroke-subtle" : "" }, /* @__PURE__ */ React.createElement(
|
|
163
|
-
"button",
|
|
148
|
+
),
|
|
149
|
+
open && pos && (filtered.length > 0 || showCreate) && createPortal(
|
|
150
|
+
/* @__PURE__ */ jsxs(
|
|
151
|
+
"ul",
|
|
164
152
|
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
153
|
+
ref: listRef,
|
|
154
|
+
style: { position: "fixed", top: pos.top, left: pos.left, width: pos.width },
|
|
155
|
+
className: "z-50 bg-surface-default border border-stroke-control rounded-(--radius-control) shadow-md max-h-48 overflow-auto",
|
|
156
|
+
children: [
|
|
157
|
+
filtered.map((s) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
158
|
+
"button",
|
|
159
|
+
{
|
|
160
|
+
type: "button",
|
|
161
|
+
onMouseDown: (e) => {
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
selectChip(s);
|
|
164
|
+
},
|
|
165
|
+
className: "w-full text-left px-3 py-2 text-label text-(--text-secondary) hover:bg-(--surface-page) transition-colors",
|
|
166
|
+
children: s.label
|
|
167
|
+
}
|
|
168
|
+
) }, s.id)),
|
|
169
|
+
showCreate && /* @__PURE__ */ jsx("li", { className: filtered.length > 0 ? "border-t border-stroke-subtle" : "", children: /* @__PURE__ */ jsxs(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
disabled: creating,
|
|
174
|
+
onMouseDown: (e) => {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
void handleCreate();
|
|
177
|
+
},
|
|
178
|
+
className: "w-full text-left px-3 py-2 text-label font-medium text-(--text-primary) hover:bg-(--surface-page) transition-colors flex items-center gap-2 disabled:opacity-50",
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsx("span", { className: "text-(--text-disabled)", children: "+" }),
|
|
181
|
+
creating ? creatingLabel : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
182
|
+
createPrefix,
|
|
183
|
+
" ",
|
|
184
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: `"${trimmed}"` })
|
|
185
|
+
] })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) })
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
document.body
|
|
176
193
|
),
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
helper && /* @__PURE__ */ jsx("p", { className: "mt-1 text-caption text-(--text-disabled)", children: helper })
|
|
195
|
+
] });
|
|
179
196
|
}
|
|
180
197
|
export {
|
|
181
198
|
ChipInput
|
package/dist/components/chips.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-ORMEWXMH.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { X } from "lucide-react";
|
|
3
4
|
const BASE = "inline-flex items-center gap-1.5 px-3 h-7 text-caption font-medium rounded-full border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus disabled:cursor-not-allowed disabled:opacity-50";
|
|
4
5
|
function Chip({
|
|
@@ -22,7 +23,7 @@ function Chip({
|
|
|
22
23
|
};
|
|
23
24
|
var handleKey = handleKey2;
|
|
24
25
|
const interactive = !!onClick;
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsxs(
|
|
26
27
|
"div",
|
|
27
28
|
{
|
|
28
29
|
role: interactive ? "button" : void 0,
|
|
@@ -36,28 +37,30 @@ function Chip({
|
|
|
36
37
|
interactive && !disabled ? "cursor-pointer hover:bg-surface-raised" : "",
|
|
37
38
|
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
38
39
|
className
|
|
39
|
-
].join(" ")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
].join(" "),
|
|
41
|
+
children: [
|
|
42
|
+
leading && /* @__PURE__ */ jsx("span", { className: "shrink-0 [&_svg]:size-3.5", children: leading }),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children }),
|
|
44
|
+
onRemove && /* @__PURE__ */ jsx(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
onClick: (e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
onRemove();
|
|
51
|
+
},
|
|
52
|
+
"aria-label": "Remover",
|
|
53
|
+
disabled,
|
|
54
|
+
className: "inline-flex items-center justify-center size-4 rounded-full opacity-60 hover:opacity-100 ml-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus transition-opacity",
|
|
55
|
+
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
}
|
|
57
60
|
);
|
|
58
61
|
}
|
|
59
62
|
if (highlight) {
|
|
60
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ jsxs(
|
|
61
64
|
"button",
|
|
62
65
|
{
|
|
63
66
|
type: "button",
|
|
@@ -67,13 +70,15 @@ function Chip({
|
|
|
67
70
|
BASE,
|
|
68
71
|
"border-dashed border-brand-secondary bg-brand-secondary/10 text-brand-secondary hover:bg-brand-secondary/20",
|
|
69
72
|
className
|
|
70
|
-
].join(" ")
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
].join(" "),
|
|
74
|
+
children: [
|
|
75
|
+
leading && /* @__PURE__ */ jsx("span", { className: "shrink-0 [&_svg]:size-3.5", children: leading }),
|
|
76
|
+
children
|
|
77
|
+
]
|
|
78
|
+
}
|
|
74
79
|
);
|
|
75
80
|
}
|
|
76
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ jsxs(
|
|
77
82
|
"button",
|
|
78
83
|
{
|
|
79
84
|
type: "button",
|
|
@@ -83,10 +88,12 @@ function Chip({
|
|
|
83
88
|
BASE,
|
|
84
89
|
subtle ? "border-transparent bg-surface-raised text-fg-secondary hover:bg-stroke-default hover:text-fg-primary" : "border-stroke-default bg-surface-default text-fg-primary hover:bg-surface-raised",
|
|
85
90
|
className
|
|
86
|
-
].join(" ")
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
].join(" "),
|
|
92
|
+
children: [
|
|
93
|
+
leading && /* @__PURE__ */ jsx("span", { className: "shrink-0 [&_svg]:size-3.5", children: leading }),
|
|
94
|
+
children
|
|
95
|
+
]
|
|
96
|
+
}
|
|
90
97
|
);
|
|
91
98
|
}
|
|
92
99
|
export {
|