@rojaostudio/ds 1.0.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/LICENSE +21 -0
- package/README.md +89 -0
- 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
- package/dist/chunk-ORMEWXMH.js +37 -0
- package/dist/compat/generate.d.ts +6 -0
- package/dist/compat/generate.js +1 -0
- package/dist/compat/recipes.d.ts +1 -0
- package/dist/compat/recipes.js +1 -0
- package/dist/compat/themes.d.ts +1 -0
- package/dist/compat/themes.js +1 -0
- package/dist/compat/tokens.d.ts +1 -0
- package/dist/compat/tokens.js +1 -0
- package/dist/components/accordion.d.ts +35 -0
- package/dist/components/accordion.js +95 -0
- package/dist/components/alert.d.ts +24 -0
- package/dist/components/alert.js +72 -0
- package/dist/components/avatar.d.ts +45 -0
- package/dist/components/avatar.js +97 -0
- package/dist/components/badge.d.ts +45 -0
- package/dist/components/badge.js +114 -0
- package/dist/components/blocker-card.d.ts +42 -0
- package/dist/components/blocker-card.js +45 -0
- package/dist/components/bottom-sheet.d.ts +31 -0
- package/dist/components/bottom-sheet.js +120 -0
- package/dist/components/breadcrumb.d.ts +28 -0
- package/dist/components/breadcrumb.js +52 -0
- package/dist/components/button.d.ts +27 -0
- package/dist/components/button.js +124 -0
- package/dist/components/card.d.ts +27 -0
- package/dist/components/card.js +52 -0
- package/dist/components/chat-bubble.d.ts +16 -0
- package/dist/components/chat-bubble.js +55 -0
- package/dist/components/checkbox.d.ts +14 -0
- package/dist/components/checkbox.js +78 -0
- package/dist/components/chip-input.d.ts +26 -0
- package/dist/components/chip-input.js +182 -0
- package/dist/components/chips.d.ts +22 -0
- package/dist/components/chips.js +94 -0
- package/dist/components/choice-card.d.ts +16 -0
- package/dist/components/choice-card.js +60 -0
- package/dist/components/choice-carousel.d.ts +16 -0
- package/dist/components/choice-carousel.js +154 -0
- package/dist/components/choice-preview-card.d.ts +37 -0
- package/dist/components/choice-preview-card.js +39 -0
- package/dist/components/color-input.d.ts +20 -0
- package/dist/components/color-input.js +79 -0
- package/dist/components/combobox.d.ts +70 -0
- package/dist/components/combobox.js +213 -0
- package/dist/components/context-menu.d.ts +33 -0
- package/dist/components/context-menu.js +70 -0
- package/dist/components/copilot-hint.d.ts +18 -0
- package/dist/components/copilot-hint.js +63 -0
- package/dist/components/copy-field.d.ts +16 -0
- package/dist/components/copy-field.js +41 -0
- package/dist/components/currency-input.d.ts +32 -0
- package/dist/components/currency-input.js +138 -0
- package/dist/components/danger-zone.d.ts +20 -0
- package/dist/components/danger-zone.js +21 -0
- package/dist/components/data-table-header.d.ts +43 -0
- package/dist/components/data-table-header.js +205 -0
- package/dist/components/date-picker.d.ts +40 -0
- package/dist/components/date-picker.js +252 -0
- package/dist/components/divider.d.ts +20 -0
- package/dist/components/divider.js +47 -0
- package/dist/components/drawer.d.ts +26 -0
- package/dist/components/drawer.js +82 -0
- package/dist/components/dropzone.d.ts +19 -0
- package/dist/components/dropzone.js +65 -0
- package/dist/components/empty-state.d.ts +48 -0
- package/dist/components/empty-state.js +91 -0
- package/dist/components/fab.d.ts +38 -0
- package/dist/components/fab.js +100 -0
- package/dist/components/filter-chip.d.ts +54 -0
- package/dist/components/filter-chip.js +66 -0
- package/dist/components/floating-stepper.d.ts +44 -0
- package/dist/components/floating-stepper.js +53 -0
- package/dist/components/form-card-header.d.ts +13 -0
- package/dist/components/form-card-header.js +8 -0
- package/dist/components/icon-button.d.ts +17 -0
- package/dist/components/icon-button.js +80 -0
- package/dist/components/image-crop-modal.d.ts +59 -0
- package/dist/components/image-crop-modal.js +240 -0
- package/dist/components/image-upload.d.ts +72 -0
- package/dist/components/image-upload.js +271 -0
- package/dist/components/index.d.ts +85 -0
- package/dist/components/index.js +200 -0
- package/dist/components/input.d.ts +25 -0
- package/dist/components/input.js +136 -0
- package/dist/components/insight-card.d.ts +19 -0
- package/dist/components/insight-card.js +27 -0
- package/dist/components/label.d.ts +16 -0
- package/dist/components/label.js +43 -0
- package/dist/components/media-tile.d.ts +24 -0
- package/dist/components/media-tile.js +28 -0
- package/dist/components/menu.d.ts +50 -0
- package/dist/components/menu.js +80 -0
- package/dist/components/modal.d.ts +25 -0
- package/dist/components/modal.js +71 -0
- package/dist/components/notice.d.ts +50 -0
- package/dist/components/notice.js +103 -0
- package/dist/components/option-tile.d.ts +60 -0
- package/dist/components/option-tile.js +144 -0
- package/dist/components/page-shell.d.ts +29 -0
- package/dist/components/page-shell.js +36 -0
- package/dist/components/page-skeleton.d.ts +35 -0
- package/dist/components/page-skeleton.js +12 -0
- package/dist/components/page-tabs.d.ts +35 -0
- package/dist/components/page-tabs.js +55 -0
- package/dist/components/pagination.d.ts +31 -0
- package/dist/components/pagination.js +80 -0
- package/dist/components/paywall-banner.d.ts +37 -0
- package/dist/components/paywall-banner.js +42 -0
- package/dist/components/paywall.d.ts +44 -0
- package/dist/components/paywall.js +55 -0
- package/dist/components/phone-frame.d.ts +9 -0
- package/dist/components/phone-frame.js +18 -0
- package/dist/components/phone-input.d.ts +24 -0
- package/dist/components/phone-input.js +92 -0
- package/dist/components/pix-icon.d.ts +8 -0
- package/dist/components/pix-icon.js +24 -0
- package/dist/components/popover.d.ts +44 -0
- package/dist/components/popover.js +140 -0
- package/dist/components/pricing-card.d.ts +42 -0
- package/dist/components/pricing-card.js +29 -0
- package/dist/components/qr-display.d.ts +19 -0
- package/dist/components/qr-display.js +24 -0
- package/dist/components/radio.d.ts +33 -0
- package/dist/components/radio.js +97 -0
- package/dist/components/row-actions.d.ts +24 -0
- package/dist/components/row-actions.js +76 -0
- package/dist/components/saving-bar-context.d.ts +40 -0
- package/dist/components/saving-bar-context.js +125 -0
- package/dist/components/saving-bar.d.ts +18 -0
- package/dist/components/saving-bar.js +72 -0
- package/dist/components/search.d.ts +30 -0
- package/dist/components/search.js +81 -0
- package/dist/components/section-card.d.ts +14 -0
- package/dist/components/section-card.js +49 -0
- package/dist/components/section-header.d.ts +29 -0
- package/dist/components/section-header.js +7 -0
- package/dist/components/select.d.ts +21 -0
- package/dist/components/select.js +140 -0
- package/dist/components/selectable-card.d.ts +35 -0
- package/dist/components/selectable-card.js +27 -0
- package/dist/components/setting-row.d.ts +33 -0
- package/dist/components/setting-row.js +19 -0
- package/dist/components/settings-list.d.ts +25 -0
- package/dist/components/settings-list.js +22 -0
- package/dist/components/skeleton.d.ts +24 -0
- package/dist/components/skeleton.js +49 -0
- package/dist/components/slider.d.ts +32 -0
- package/dist/components/slider.js +79 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +36 -0
- package/dist/components/step-progress.d.ts +12 -0
- package/dist/components/step-progress.js +24 -0
- package/dist/components/summary-bar.d.ts +31 -0
- package/dist/components/summary-bar.js +54 -0
- package/dist/components/table.d.ts +23 -0
- package/dist/components/table.js +80 -0
- package/dist/components/textarea.d.ts +21 -0
- package/dist/components/textarea.js +95 -0
- package/dist/components/themed.d.ts +36 -0
- package/dist/components/themed.js +22 -0
- package/dist/components/time-picker.d.ts +34 -0
- package/dist/components/time-picker.js +213 -0
- package/dist/components/toaster.d.ts +84 -0
- package/dist/components/toaster.js +284 -0
- package/dist/components/toggle-card-compact.d.ts +21 -0
- package/dist/components/toggle-card-compact.js +99 -0
- package/dist/components/toggle-card.d.ts +15 -0
- package/dist/components/toggle-card.js +76 -0
- package/dist/components/toggle-group.d.ts +67 -0
- package/dist/components/toggle-group.js +80 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +64 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +89 -0
- package/dist/components/typing-indicator.d.ts +8 -0
- package/dist/components/typing-indicator.js +27 -0
- package/dist/components/use-dismiss.d.ts +9 -0
- package/dist/components/use-dismiss.js +28 -0
- package/dist/components/use-focus-trap.d.ts +5 -0
- package/dist/components/use-focus-trap.js +54 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +89 -0
- package/dist/targets/native/components/accordion.d.ts +18 -0
- package/dist/targets/native/components/accordion.js +122 -0
- package/dist/targets/native/components/alert.d.ts +16 -0
- package/dist/targets/native/components/alert.js +58 -0
- package/dist/targets/native/components/avatar.d.ts +25 -0
- package/dist/targets/native/components/avatar.js +88 -0
- package/dist/targets/native/components/badge.d.ts +27 -0
- package/dist/targets/native/components/badge.js +59 -0
- package/dist/targets/native/components/button.d.ts +18 -0
- package/dist/targets/native/components/button.js +84 -0
- package/dist/targets/native/components/card.d.ts +6 -0
- package/dist/targets/native/components/card.js +36 -0
- package/dist/targets/native/components/checkbox.d.ts +12 -0
- package/dist/targets/native/components/checkbox.js +59 -0
- package/dist/targets/native/components/chips.d.ts +17 -0
- package/dist/targets/native/components/chips.js +77 -0
- package/dist/targets/native/components/choice-card.d.ts +11 -0
- package/dist/targets/native/components/choice-card.js +52 -0
- package/dist/targets/native/components/context-menu.d.ts +11 -0
- package/dist/targets/native/components/context-menu.js +19 -0
- package/dist/targets/native/components/currency-input.d.ts +22 -0
- package/dist/targets/native/components/currency-input.js +105 -0
- package/dist/targets/native/components/danger-zone.d.ts +13 -0
- package/dist/targets/native/components/danger-zone.js +27 -0
- package/dist/targets/native/components/date-picker.d.ts +13 -0
- package/dist/targets/native/components/date-picker.js +185 -0
- package/dist/targets/native/components/divider.d.ts +9 -0
- package/dist/targets/native/components/divider.js +36 -0
- package/dist/targets/native/components/empty-state.d.ts +13 -0
- package/dist/targets/native/components/empty-state.js +10 -0
- package/dist/targets/native/components/fab.d.ts +25 -0
- package/dist/targets/native/components/fab.js +112 -0
- package/dist/targets/native/components/filter-chip.d.ts +22 -0
- package/dist/targets/native/components/filter-chip.js +70 -0
- package/dist/targets/native/components/form-field.d.ts +13 -0
- package/dist/targets/native/components/form-field.js +29 -0
- package/dist/targets/native/components/form-screen.d.ts +19 -0
- package/dist/targets/native/components/form-screen.js +88 -0
- package/dist/targets/native/components/google-icon.d.ts +8 -0
- package/dist/targets/native/components/google-icon.js +32 -0
- package/dist/targets/native/components/icon-button.d.ts +18 -0
- package/dist/targets/native/components/icon-button.js +80 -0
- package/dist/targets/native/components/icon.d.ts +11 -0
- package/dist/targets/native/components/icon.js +9 -0
- package/dist/targets/native/components/image-upload.d.ts +12 -0
- package/dist/targets/native/components/image-upload.js +95 -0
- package/dist/targets/native/components/index.d.ts +45 -0
- package/dist/targets/native/components/index.js +100 -0
- package/dist/targets/native/components/input.d.ts +17 -0
- package/dist/targets/native/components/input.js +103 -0
- package/dist/targets/native/components/list-item.d.ts +20 -0
- package/dist/targets/native/components/list-item.js +71 -0
- package/dist/targets/native/components/menu.d.ts +24 -0
- package/dist/targets/native/components/menu.js +71 -0
- package/dist/targets/native/components/modal.d.ts +15 -0
- package/dist/targets/native/components/modal.js +110 -0
- package/dist/targets/native/components/paywall-banner.d.ts +11 -0
- package/dist/targets/native/components/paywall-banner.js +46 -0
- package/dist/targets/native/components/paywall.d.ts +18 -0
- package/dist/targets/native/components/paywall.js +61 -0
- package/dist/targets/native/components/radio.d.ts +20 -0
- package/dist/targets/native/components/radio.js +71 -0
- package/dist/targets/native/components/search.d.ts +22 -0
- package/dist/targets/native/components/search.js +92 -0
- package/dist/targets/native/components/select.d.ts +17 -0
- package/dist/targets/native/components/select.js +86 -0
- package/dist/targets/native/components/sheet.d.ts +11 -0
- package/dist/targets/native/components/sheet.js +51 -0
- package/dist/targets/native/components/skeleton.d.ts +18 -0
- package/dist/targets/native/components/skeleton.js +52 -0
- package/dist/targets/native/components/slider.d.ts +18 -0
- package/dist/targets/native/components/slider.js +153 -0
- package/dist/targets/native/components/spinner.d.ts +7 -0
- package/dist/targets/native/components/spinner.js +10 -0
- package/dist/targets/native/components/stepper.d.ts +10 -0
- package/dist/targets/native/components/stepper.js +33 -0
- package/dist/targets/native/components/switch.d.ts +20 -0
- package/dist/targets/native/components/switch.js +68 -0
- package/dist/targets/native/components/text.d.ts +12 -0
- package/dist/targets/native/components/text.js +31 -0
- package/dist/targets/native/components/textarea.d.ts +13 -0
- package/dist/targets/native/components/textarea.js +92 -0
- package/dist/targets/native/components/theme.d.ts +18 -0
- package/dist/targets/native/components/theme.js +20 -0
- package/dist/targets/native/components/toaster.d.ts +35 -0
- package/dist/targets/native/components/toaster.js +159 -0
- package/dist/targets/native/fonts.d.ts +9 -0
- package/dist/targets/native/fonts.js +10 -0
- package/dist/targets/native/icons.d.ts +1 -0
- package/dist/targets/native/icons.js +1 -0
- package/dist/targets/native/index.d.ts +3 -0
- package/dist/targets/native/index.js +11 -0
- package/dist/targets/native/preset.cjs +69 -0
- package/dist/targets/native/resolve.d.ts +22 -0
- package/dist/targets/native/resolve.js +85 -0
- package/dist/targets/native/theme.css +118 -0
- package/dist/targets/native/theme.d.ts +117 -0
- package/dist/targets/native/theme.js +118 -0
- package/package.json +194 -0
- package/styles/_primitives.generated.css +284 -0
- package/styles/base.css +950 -0
- package/styles/themes/rojao.css +107 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ChatBubbleVariant = 'bot' | 'user';
|
|
5
|
+
type ChatBubbleState = 'sent' | 'editing' | 'pending';
|
|
6
|
+
interface ChatBubbleProps {
|
|
7
|
+
variant: ChatBubbleVariant;
|
|
8
|
+
state?: ChatBubbleState;
|
|
9
|
+
dim?: boolean;
|
|
10
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function ChatBubble({ variant, state, dim, onClick, children, ariaLabel, }: ChatBubbleProps): react.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { ChatBubble, type ChatBubbleProps, type ChatBubbleState, type ChatBubbleVariant };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
function ChatBubble({
|
|
4
|
+
variant,
|
|
5
|
+
state = "sent",
|
|
6
|
+
dim = false,
|
|
7
|
+
onClick,
|
|
8
|
+
children,
|
|
9
|
+
ariaLabel
|
|
10
|
+
}) {
|
|
11
|
+
const isBot = variant === "bot";
|
|
12
|
+
const interactive = !!onClick && !dim;
|
|
13
|
+
const wrapperClass = [
|
|
14
|
+
"w-full flex",
|
|
15
|
+
isBot ? "justify-start" : "justify-end"
|
|
16
|
+
].join(" ");
|
|
17
|
+
const bubbleClass = [
|
|
18
|
+
"inline-block max-w-[var(--chat-bubble-max-width)]",
|
|
19
|
+
"px-[var(--chat-bubble-padding-x)] py-[var(--chat-bubble-padding-y)]",
|
|
20
|
+
"text-[length:var(--font-size-body)] leading-[var(--line-height-body)]",
|
|
21
|
+
"transition-all",
|
|
22
|
+
isBot ? "bg-[var(--chat-bubble-bot-bg)] text-[var(--chat-bubble-bot-text)]" : "bg-[var(--chat-bubble-user-bg)] text-[var(--chat-bubble-user-text)]",
|
|
23
|
+
dim ? "opacity-[var(--chat-bubble-dim-opacity)] pointer-events-none" : "",
|
|
24
|
+
state === "editing" ? "ring-2 ring-[var(--chat-bubble-editing-border)] ring-offset-1" : "",
|
|
25
|
+
interactive ? "cursor-pointer hover:brightness-95" : ""
|
|
26
|
+
].filter(Boolean).join(" ");
|
|
27
|
+
const radiusStyle = isBot ? {
|
|
28
|
+
borderRadius: "var(--chat-bubble-radius-lg)",
|
|
29
|
+
borderTopLeftRadius: "var(--chat-bubble-radius-sm)"
|
|
30
|
+
} : {
|
|
31
|
+
borderRadius: "var(--chat-bubble-radius-lg)",
|
|
32
|
+
borderBottomRightRadius: "var(--chat-bubble-radius-sm)"
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ React.createElement("div", { className: wrapperClass }, /* @__PURE__ */ React.createElement(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: bubbleClass,
|
|
38
|
+
style: radiusStyle,
|
|
39
|
+
onClick: interactive ? onClick : void 0,
|
|
40
|
+
role: interactive ? "button" : void 0,
|
|
41
|
+
tabIndex: interactive ? 0 : void 0,
|
|
42
|
+
onKeyDown: interactive ? (e) => {
|
|
43
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
onClick == null ? void 0 : onClick(e);
|
|
46
|
+
}
|
|
47
|
+
} : void 0,
|
|
48
|
+
"aria-label": ariaLabel
|
|
49
|
+
},
|
|
50
|
+
children
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
ChatBubble
|
|
55
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** Texto secundário abaixo do label. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
indeterminate?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
size?: 'sm' | 'md';
|
|
11
|
+
}
|
|
12
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
13
|
+
|
|
14
|
+
export { Checkbox, type CheckboxProps };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__objRest,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-ORMEWXMH.js";
|
|
6
|
+
import { forwardRef, useEffect, useId, useRef } from "react";
|
|
7
|
+
const SIZE_CLASS = {
|
|
8
|
+
sm: { box: "size-3.5", svg: "size-3.5", label: "text-caption", icon: 12 },
|
|
9
|
+
md: { box: "size-4", svg: "size-4", label: "text-label", icon: 14 }
|
|
10
|
+
};
|
|
11
|
+
const Checkbox = forwardRef(function Checkbox2(_a, ref) {
|
|
12
|
+
var _b = _a, { label, description, indeterminate = false, error, size = "md", className = "", id } = _b, props = __objRest(_b, ["label", "description", "indeterminate", "error", "size", "className", "id"]);
|
|
13
|
+
const innerRef = useRef(null);
|
|
14
|
+
const setRef = (node) => {
|
|
15
|
+
innerRef.current = node;
|
|
16
|
+
if (typeof ref === "function") ref(node);
|
|
17
|
+
else if (ref) ref.current = node;
|
|
18
|
+
};
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
21
|
+
}, [indeterminate]);
|
|
22
|
+
const generatedId = useId();
|
|
23
|
+
const inputId = id != null ? id : generatedId;
|
|
24
|
+
const errId = `${inputId}-error`;
|
|
25
|
+
const sz = SIZE_CLASS[size];
|
|
26
|
+
return /* @__PURE__ */ React.createElement("div", { className: "inline-flex flex-col gap-0.5" }, /* @__PURE__ */ React.createElement(
|
|
27
|
+
"label",
|
|
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",
|
|
65
|
+
{
|
|
66
|
+
className: ["absolute inset-0 pointer-events-none hidden peer-indeterminate:block text-brand-on-primary", sz.svg].join(" "),
|
|
67
|
+
viewBox: "0 0 16 16",
|
|
68
|
+
fill: "none",
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
},
|
|
71
|
+
/* @__PURE__ */ React.createElement("path", { d: "M4 8H12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
72
|
+
)),
|
|
73
|
+
(label || description) && /* @__PURE__ */ React.createElement("span", { className: "flex flex-col gap-0.5 select-none" }, label && /* @__PURE__ */ React.createElement("span", { className: [sz.label, "text-fg-primary leading-snug"].join(" ") }, label), description && /* @__PURE__ */ React.createElement("span", { className: "text-caption text-fg-muted leading-snug" }, description))
|
|
74
|
+
), error && /* @__PURE__ */ React.createElement("p", { id: errId, className: [sz.box === "size-3.5" ? "pl-5" : "pl-6", "text-caption text-danger-text"].join(" ") }, error));
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
Checkbox
|
|
78
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChipItem {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
interface ChipInputProps {
|
|
9
|
+
value: ChipItem[];
|
|
10
|
+
onChange: (next: ChipItem[]) => void;
|
|
11
|
+
/** Available suggestions — filtered by current input text. */
|
|
12
|
+
suggestions?: ChipItem[];
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Helper text shown below the input. */
|
|
15
|
+
helper?: ReactNode;
|
|
16
|
+
/** When defined, free-form text confirms create the chip via this callback. */
|
|
17
|
+
onCreate?: (text: string) => Promise<ChipItem | null> | ChipItem | null;
|
|
18
|
+
/** Dropdown copy for the "create" option. */
|
|
19
|
+
createPrefix?: string;
|
|
20
|
+
creatingLabel?: string;
|
|
21
|
+
/** Custom aria-label for the chip remove button. */
|
|
22
|
+
removeAriaLabel?: (chip: ChipItem) => string;
|
|
23
|
+
}
|
|
24
|
+
declare function ChipInput({ value, onChange, suggestions, placeholder, helper, onCreate, createPrefix, creatingLabel, removeAriaLabel, }: ChipInputProps): react.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { ChipInput, type ChipInputProps, type ChipItem };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
function ChipInput({
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
suggestions = [],
|
|
10
|
+
placeholder,
|
|
11
|
+
helper,
|
|
12
|
+
onCreate,
|
|
13
|
+
createPrefix = "Criar",
|
|
14
|
+
creatingLabel = "Criando...",
|
|
15
|
+
removeAriaLabel
|
|
16
|
+
}) {
|
|
17
|
+
const [input, setInput] = useState("");
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const [creating, setCreating] = useState(false);
|
|
20
|
+
const inputRef = useRef(null);
|
|
21
|
+
const containerRef = useRef(null);
|
|
22
|
+
const listRef = useRef(null);
|
|
23
|
+
const [pos, setPos] = useState(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
function onOutside(e) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const target = e.target;
|
|
28
|
+
if (((_a = containerRef.current) == null ? void 0 : _a.contains(target)) || ((_b = listRef.current) == null ? void 0 : _b.contains(target))) return;
|
|
29
|
+
setOpen(false);
|
|
30
|
+
}
|
|
31
|
+
document.addEventListener("mousedown", onOutside);
|
|
32
|
+
return () => document.removeEventListener("mousedown", onOutside);
|
|
33
|
+
}, []);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!open) return;
|
|
36
|
+
function update() {
|
|
37
|
+
const el = containerRef.current;
|
|
38
|
+
if (!el) return;
|
|
39
|
+
const r = el.getBoundingClientRect();
|
|
40
|
+
setPos({ top: r.bottom + 4, left: r.left, width: r.width });
|
|
41
|
+
}
|
|
42
|
+
update();
|
|
43
|
+
window.addEventListener("scroll", update, true);
|
|
44
|
+
window.addEventListener("resize", update);
|
|
45
|
+
return () => {
|
|
46
|
+
window.removeEventListener("scroll", update, true);
|
|
47
|
+
window.removeEventListener("resize", update);
|
|
48
|
+
};
|
|
49
|
+
}, [open]);
|
|
50
|
+
const trimmed = input.trim();
|
|
51
|
+
const filtered = suggestions.filter(
|
|
52
|
+
(s) => !value.some((v) => v.id === s.id) && s.label.toLowerCase().includes(trimmed.toLowerCase())
|
|
53
|
+
);
|
|
54
|
+
const exactMatch = suggestions.some((s) => s.label.toLowerCase() === trimmed.toLowerCase());
|
|
55
|
+
const showCreate = !!onCreate && trimmed.length > 0 && !exactMatch;
|
|
56
|
+
function selectChip(chip) {
|
|
57
|
+
if (value.some((v) => v.id === chip.id)) return;
|
|
58
|
+
onChange([...value, chip]);
|
|
59
|
+
setInput("");
|
|
60
|
+
setOpen(false);
|
|
61
|
+
}
|
|
62
|
+
function removeChip(id) {
|
|
63
|
+
onChange(value.filter((v) => v.id !== id));
|
|
64
|
+
}
|
|
65
|
+
async function handleCreate() {
|
|
66
|
+
if (!onCreate || !trimmed || creating) return;
|
|
67
|
+
setCreating(true);
|
|
68
|
+
try {
|
|
69
|
+
const result = await onCreate(trimmed);
|
|
70
|
+
if (result) {
|
|
71
|
+
onChange([...value, result]);
|
|
72
|
+
setInput("");
|
|
73
|
+
setOpen(false);
|
|
74
|
+
}
|
|
75
|
+
} finally {
|
|
76
|
+
setCreating(false);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function handleKeyDown(e) {
|
|
80
|
+
if (e.key === "Enter" || e.key === ",") {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
if (filtered.length > 0) {
|
|
83
|
+
selectChip(filtered[0]);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (showCreate) void handleCreate();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (e.key === "Backspace" && !input && value.length > 0) {
|
|
90
|
+
removeChip(value[value.length - 1].id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ React.createElement("div", { ref: containerRef, className: "relative" }, /* @__PURE__ */ React.createElement(
|
|
94
|
+
"div",
|
|
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",
|
|
128
|
+
{
|
|
129
|
+
ref: inputRef,
|
|
130
|
+
type: "text",
|
|
131
|
+
value: input,
|
|
132
|
+
onChange: (e) => {
|
|
133
|
+
setInput(e.target.value);
|
|
134
|
+
setOpen(true);
|
|
135
|
+
},
|
|
136
|
+
onKeyDown: handleKeyDown,
|
|
137
|
+
onFocus: () => setOpen(true),
|
|
138
|
+
placeholder: value.length === 0 ? placeholder : "",
|
|
139
|
+
className: "flex-1 min-w-[120px] bg-transparent text-label text-(--text-secondary) placeholder:text-(--text-disabled) focus:outline-none"
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
), open && pos && (filtered.length > 0 || showCreate) && createPortal(
|
|
143
|
+
/* @__PURE__ */ React.createElement(
|
|
144
|
+
"ul",
|
|
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",
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
disabled: creating,
|
|
167
|
+
onMouseDown: (e) => {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
void handleCreate();
|
|
170
|
+
},
|
|
171
|
+
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"
|
|
172
|
+
},
|
|
173
|
+
/* @__PURE__ */ React.createElement("span", { className: "text-(--text-disabled)" }, "+"),
|
|
174
|
+
creating ? creatingLabel : /* @__PURE__ */ React.createElement(React.Fragment, null, createPrefix, " ", /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, `"${trimmed}"`))
|
|
175
|
+
))
|
|
176
|
+
),
|
|
177
|
+
document.body
|
|
178
|
+
), helper && /* @__PURE__ */ React.createElement("p", { className: "mt-1 text-caption text-(--text-disabled)" }, helper));
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
ChipInput
|
|
182
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, MouseEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChipProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
onClick?: (e: MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
7
|
+
/** Leading slot — ícone, avatar, qualquer ReactNode. */
|
|
8
|
+
leading?: ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Sem borda, background discreto. */
|
|
12
|
+
subtle?: boolean;
|
|
13
|
+
/** Destaca com cor primária. Usado com onRemove. */
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
/** Exibe botão X de remover. Implica estrutura de div (não button). */
|
|
16
|
+
onRemove?: () => void;
|
|
17
|
+
/** Border tracejado + brand-secondary. Sinaliza sugestão de IA. */
|
|
18
|
+
highlight?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare function Chip({ children, onClick, leading, disabled, className, subtle, selected, onRemove, highlight, }: ChipProps): react.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { Chip, type ChipProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import "../chunk-ORMEWXMH.js";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
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
|
+
function Chip({
|
|
5
|
+
children,
|
|
6
|
+
onClick,
|
|
7
|
+
leading,
|
|
8
|
+
disabled = false,
|
|
9
|
+
className = "",
|
|
10
|
+
subtle = false,
|
|
11
|
+
selected = false,
|
|
12
|
+
onRemove,
|
|
13
|
+
highlight = false
|
|
14
|
+
}) {
|
|
15
|
+
if (onRemove !== void 0 || selected) {
|
|
16
|
+
let handleKey2 = function(e) {
|
|
17
|
+
if (!interactive) return;
|
|
18
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
onClick == null ? void 0 : onClick(e);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var handleKey = handleKey2;
|
|
24
|
+
const interactive = !!onClick;
|
|
25
|
+
return /* @__PURE__ */ React.createElement(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
role: interactive ? "button" : void 0,
|
|
29
|
+
tabIndex: interactive && !disabled ? 0 : void 0,
|
|
30
|
+
onClick: disabled ? void 0 : onClick,
|
|
31
|
+
onKeyDown: handleKey2,
|
|
32
|
+
className: [
|
|
33
|
+
BASE,
|
|
34
|
+
onRemove ? "pr-1.5" : "",
|
|
35
|
+
selected ? "border-brand-primary bg-brand-primary text-brand-on-primary" : "border-stroke-default bg-surface-default text-fg-primary",
|
|
36
|
+
interactive && !disabled ? "cursor-pointer hover:bg-surface-raised" : "",
|
|
37
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
38
|
+
className
|
|
39
|
+
].join(" ")
|
|
40
|
+
},
|
|
41
|
+
leading && /* @__PURE__ */ React.createElement("span", { className: "shrink-0 [&_svg]:size-3.5" }, leading),
|
|
42
|
+
/* @__PURE__ */ React.createElement("span", { className: "truncate" }, children),
|
|
43
|
+
onRemove && /* @__PURE__ */ React.createElement(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
type: "button",
|
|
47
|
+
onClick: (e) => {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
onRemove();
|
|
50
|
+
},
|
|
51
|
+
"aria-label": "Remover",
|
|
52
|
+
disabled,
|
|
53
|
+
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"
|
|
54
|
+
},
|
|
55
|
+
/* @__PURE__ */ React.createElement(X, { size: 12 })
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (highlight) {
|
|
60
|
+
return /* @__PURE__ */ React.createElement(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
onClick,
|
|
65
|
+
disabled,
|
|
66
|
+
className: [
|
|
67
|
+
BASE,
|
|
68
|
+
"border-dashed border-brand-secondary bg-brand-secondary/10 text-brand-secondary hover:bg-brand-secondary/20",
|
|
69
|
+
className
|
|
70
|
+
].join(" ")
|
|
71
|
+
},
|
|
72
|
+
leading && /* @__PURE__ */ React.createElement("span", { className: "shrink-0 [&_svg]:size-3.5" }, leading),
|
|
73
|
+
children
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ React.createElement(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick,
|
|
81
|
+
disabled,
|
|
82
|
+
className: [
|
|
83
|
+
BASE,
|
|
84
|
+
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
|
+
className
|
|
86
|
+
].join(" ")
|
|
87
|
+
},
|
|
88
|
+
leading && /* @__PURE__ */ React.createElement("span", { className: "shrink-0 [&_svg]:size-3.5" }, leading),
|
|
89
|
+
children
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
Chip
|
|
94
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChoiceCardProps {
|
|
5
|
+
selected: boolean;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Override pontual (ex.: rounded-b-none quando há painel anexado embaixo). */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function ChoiceCard({ selected, onClick, label, description, icon, disabled, className }: ChoiceCardProps): react.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { ChoiceCard, type ChoiceCardProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
function ChoiceCard({ selected, onClick, label, description, icon, disabled = false, className = "" }) {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(
|
|
5
|
+
"button",
|
|
6
|
+
{
|
|
7
|
+
type: "button",
|
|
8
|
+
onClick,
|
|
9
|
+
disabled,
|
|
10
|
+
className: [
|
|
11
|
+
"w-full flex items-center gap-4 px-4 py-4 rounded-(--radius-card) border text-left transition-all",
|
|
12
|
+
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
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
14
|
+
className
|
|
15
|
+
].filter(Boolean).join(" ")
|
|
16
|
+
},
|
|
17
|
+
icon && /* @__PURE__ */ React.createElement(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
className: [
|
|
21
|
+
"shrink-0 w-9 h-9 rounded-(--radius-card) flex items-center justify-center transition-colors",
|
|
22
|
+
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)]"
|
|
23
|
+
].join(" ")
|
|
24
|
+
},
|
|
25
|
+
icon
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement(
|
|
28
|
+
"p",
|
|
29
|
+
{
|
|
30
|
+
className: [
|
|
31
|
+
"text-label font-semibold",
|
|
32
|
+
selected ? "[color:var(--choice-card-label-active)]" : "[color:var(--choice-card-label)]"
|
|
33
|
+
].join(" ")
|
|
34
|
+
},
|
|
35
|
+
label
|
|
36
|
+
), description && /* @__PURE__ */ React.createElement(
|
|
37
|
+
"p",
|
|
38
|
+
{
|
|
39
|
+
className: [
|
|
40
|
+
"text-caption mt-0.5",
|
|
41
|
+
selected ? "[color:var(--choice-card-description-active)]" : "[color:var(--choice-card-description)]"
|
|
42
|
+
].join(" ")
|
|
43
|
+
},
|
|
44
|
+
description
|
|
45
|
+
)),
|
|
46
|
+
/* @__PURE__ */ React.createElement(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: [
|
|
50
|
+
"shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",
|
|
51
|
+
selected ? "[border-color:var(--choice-card-radio-border-active)]" : "[border-color:var(--choice-card-radio-border)]"
|
|
52
|
+
].join(" ")
|
|
53
|
+
},
|
|
54
|
+
selected && /* @__PURE__ */ React.createElement("div", { className: "w-2 h-2 rounded-full [background:var(--choice-card-radio-dot)]" })
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
ChoiceCard
|
|
60
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ChoiceCarouselProps<T> {
|
|
5
|
+
options: T[];
|
|
6
|
+
getKey: (option: T) => string;
|
|
7
|
+
renderCard: (option: T, isSelected: boolean) => ReactNode;
|
|
8
|
+
value: T | T[] | null;
|
|
9
|
+
onChange: (value: T | T[]) => void;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
ariaLabel: string;
|
|
12
|
+
isDisabled?: (option: T) => boolean;
|
|
13
|
+
}
|
|
14
|
+
declare function ChoiceCarousel<T>({ options, getKey, renderCard, value, onChange, multiple, ariaLabel, isDisabled, }: ChoiceCarouselProps<T>): react.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { ChoiceCarousel, type ChoiceCarouselProps };
|