@fanvue/ui 3.12.1 → 3.14.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/dist/cjs/components/Accordion/AccordionTrigger.cjs +11 -2
- package/dist/cjs/components/Accordion/AccordionTrigger.cjs.map +1 -1
- package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs +357 -0
- package/dist/cjs/components/AudioPlayer/AudioPlayer.cjs.map +1 -0
- package/dist/cjs/components/Avatar/Avatar.cjs +2 -2
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.cjs +2 -1
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +25 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
- package/dist/cjs/components/FloatingActionButton/FloatingActionButton.cjs +59 -0
- package/dist/cjs/components/FloatingActionButton/FloatingActionButton.cjs.map +1 -0
- package/dist/cjs/components/Icons/GifIcon.cjs +12 -36
- package/dist/cjs/components/Icons/GifIcon.cjs.map +1 -1
- package/dist/cjs/components/Icons/GridViewIcon.cjs +50 -0
- package/dist/cjs/components/Icons/GridViewIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ListViewIcon.cjs +50 -0
- package/dist/cjs/components/Icons/ListViewIcon.cjs.map +1 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs +30 -5
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs.map +1 -1
- package/dist/cjs/components/ProgressBar/ProgressBarItem.cjs +49 -0
- package/dist/cjs/components/ProgressBar/ProgressBarItem.cjs.map +1 -0
- package/dist/cjs/components/ProgressBar/ProgressBarSteps.cjs +66 -0
- package/dist/cjs/components/ProgressBar/ProgressBarSteps.cjs.map +1 -0
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +42 -11
- package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/dist/cjs/components/TextArea/TextArea.cjs +4 -4
- package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/cjs/components/TextField/TextField.cjs +105 -62
- package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
- package/dist/cjs/index.cjs +12 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/Accordion/AccordionTrigger.mjs +11 -2
- package/dist/components/Accordion/AccordionTrigger.mjs.map +1 -1
- package/dist/components/AudioPlayer/AudioPlayer.mjs +340 -0
- package/dist/components/AudioPlayer/AudioPlayer.mjs.map +1 -0
- package/dist/components/Avatar/Avatar.mjs +2 -2
- package/dist/components/Avatar/Avatar.mjs.map +1 -1
- package/dist/components/Dialog/Dialog.mjs +2 -1
- package/dist/components/Dialog/Dialog.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.mjs +25 -2
- package/dist/components/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/dist/components/FloatingActionButton/FloatingActionButton.mjs +42 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.mjs.map +1 -0
- package/dist/components/Icons/GifIcon.mjs +12 -36
- package/dist/components/Icons/GifIcon.mjs.map +1 -1
- package/dist/components/Icons/GridViewIcon.mjs +33 -0
- package/dist/components/Icons/GridViewIcon.mjs.map +1 -0
- package/dist/components/Icons/ListViewIcon.mjs +33 -0
- package/dist/components/Icons/ListViewIcon.mjs.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.mjs +30 -5
- package/dist/components/ProgressBar/ProgressBar.mjs.map +1 -1
- package/dist/components/ProgressBar/ProgressBarItem.mjs +32 -0
- package/dist/components/ProgressBar/ProgressBarItem.mjs.map +1 -0
- package/dist/components/ProgressBar/ProgressBarSteps.mjs +49 -0
- package/dist/components/ProgressBar/ProgressBarSteps.mjs.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.mjs +42 -11
- package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.mjs +4 -4
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/TextField/TextField.mjs +105 -62
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/index.d.ts +237 -10
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -28,43 +28,71 @@ const CONTAINER_HEIGHT = {
|
|
|
28
28
|
"40": "h-10",
|
|
29
29
|
"32": "h-8"
|
|
30
30
|
};
|
|
31
|
-
const
|
|
32
|
-
"48": "py-3 typography-body-default-16px-regular autofill-body-lg",
|
|
33
|
-
"40": "py-2 typography-body-default-16px-regular autofill-body-lg",
|
|
34
|
-
"32": "py-2 typography-body-small-14px-regular autofill-body-md"
|
|
35
|
-
};
|
|
36
|
-
const INPUT_PL = {
|
|
37
|
-
"48": { default: "pl-4", withIcon: "pl-10" },
|
|
38
|
-
"40": { default: "pl-4", withIcon: "pl-10" },
|
|
39
|
-
"32": { default: "pl-3", withIcon: "pl-9" }
|
|
40
|
-
};
|
|
41
|
-
const INPUT_PR = {
|
|
42
|
-
"48": { default: "pr-4", withIcon: "pr-10" },
|
|
43
|
-
"40": { default: "pr-4", withIcon: "pr-10" },
|
|
44
|
-
"32": { default: "pr-3", withIcon: "pr-9" }
|
|
45
|
-
};
|
|
46
|
-
const ICON_INSET = {
|
|
31
|
+
const CONTAINER_PADDING_X = {
|
|
47
32
|
"48": "px-4",
|
|
48
33
|
"40": "px-4",
|
|
49
34
|
"32": "px-3"
|
|
50
35
|
};
|
|
36
|
+
const CONTAINER_GAP = {
|
|
37
|
+
"48": "gap-2.5",
|
|
38
|
+
"40": "gap-2.5",
|
|
39
|
+
"32": "gap-2"
|
|
40
|
+
};
|
|
41
|
+
const INPUT_TYPOGRAPHY = {
|
|
42
|
+
"48": "typography-body-default-16px-regular autofill-body-lg",
|
|
43
|
+
"40": "typography-body-default-16px-regular autofill-body-lg",
|
|
44
|
+
"32": "typography-body-small-14px-regular autofill-body-md"
|
|
45
|
+
};
|
|
46
|
+
const SIDE_LABEL_TYPOGRAPHY = {
|
|
47
|
+
"48": "typography-body-default-16px-regular",
|
|
48
|
+
"40": "typography-body-default-16px-regular",
|
|
49
|
+
"32": "typography-body-small-14px-regular"
|
|
50
|
+
};
|
|
51
51
|
function getContainerClassName(size, error, disabled) {
|
|
52
52
|
return cn.cn(
|
|
53
|
-
"relative overflow-hidden rounded-sm border bg-inputs-inputs-primary has-focus-visible:shadow-focus-ring has-focus-visible:outline-none motion-safe:transition-colors",
|
|
53
|
+
"relative flex items-center overflow-hidden rounded-sm border bg-inputs-inputs-primary has-focus-visible:shadow-focus-ring has-focus-visible:outline-none motion-safe:transition-colors",
|
|
54
|
+
CONTAINER_PADDING_X[size],
|
|
55
|
+
CONTAINER_GAP[size],
|
|
54
56
|
error ? "border-error-content" : "border-border-primary",
|
|
55
57
|
!disabled && !error && "hover:border-neutral-alphas-400",
|
|
56
58
|
CONTAINER_HEIGHT[size],
|
|
57
59
|
disabled && "opacity-50"
|
|
58
60
|
);
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
function LeadingIcon({ children }) {
|
|
63
|
+
if (!children) return null;
|
|
64
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none flex size-4 shrink-0 items-center justify-center text-content-secondary", children });
|
|
65
|
+
}
|
|
66
|
+
function SideLabel({
|
|
67
|
+
id,
|
|
68
|
+
size,
|
|
69
|
+
align,
|
|
70
|
+
children
|
|
71
|
+
}) {
|
|
72
|
+
if (!children) return null;
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
74
|
+
"span",
|
|
75
|
+
{
|
|
76
|
+
id,
|
|
77
|
+
className: cn.cn(
|
|
78
|
+
"shrink-0 select-none whitespace-nowrap text-content-tertiary",
|
|
79
|
+
align === "right" && "text-right",
|
|
80
|
+
SIDE_LABEL_TYPOGRAPHY[size]
|
|
81
|
+
),
|
|
82
|
+
children
|
|
83
|
+
}
|
|
66
84
|
);
|
|
67
85
|
}
|
|
86
|
+
function TrailingAdornment({
|
|
87
|
+
rightIcon,
|
|
88
|
+
validated
|
|
89
|
+
}) {
|
|
90
|
+
if (!rightIcon && !validated) return null;
|
|
91
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-2 text-content-secondary", children: [
|
|
92
|
+
rightIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-tf-interactive": "", className: "flex size-4 shrink-0 items-center justify-center", children: rightIcon }),
|
|
93
|
+
validated && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none flex size-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckOutlineIcon.CheckOutlineIcon, { className: "text-success-content" }) })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
68
96
|
function TextFieldHelperText({
|
|
69
97
|
id,
|
|
70
98
|
error,
|
|
@@ -101,6 +129,8 @@ const TextField = React__namespace.forwardRef(
|
|
|
101
129
|
validated = false,
|
|
102
130
|
leftIcon,
|
|
103
131
|
rightIcon,
|
|
132
|
+
leftLabel,
|
|
133
|
+
rightLabel,
|
|
104
134
|
className,
|
|
105
135
|
id,
|
|
106
136
|
disabled,
|
|
@@ -110,7 +140,31 @@ const TextField = React__namespace.forwardRef(
|
|
|
110
140
|
const generatedId = React__namespace.useId();
|
|
111
141
|
const inputId = id || generatedId;
|
|
112
142
|
const helperTextId = `${inputId}-helper`;
|
|
143
|
+
const leftLabelId = `${inputId}-left-label`;
|
|
144
|
+
const rightLabelId = `${inputId}-right-label`;
|
|
113
145
|
const bottomText = error && errorMessage ? errorMessage : helperText;
|
|
146
|
+
const describedBy = [
|
|
147
|
+
leftLabel != null ? leftLabelId : null,
|
|
148
|
+
rightLabel != null ? rightLabelId : null,
|
|
149
|
+
bottomText ? helperTextId : null
|
|
150
|
+
].filter(Boolean).join(" ") || void 0;
|
|
151
|
+
const innerRef = React__namespace.useRef(null);
|
|
152
|
+
const setRefs = React__namespace.useCallback(
|
|
153
|
+
(node) => {
|
|
154
|
+
innerRef.current = node;
|
|
155
|
+
if (typeof ref === "function") ref(node);
|
|
156
|
+
else if (ref) ref.current = node;
|
|
157
|
+
},
|
|
158
|
+
[ref]
|
|
159
|
+
);
|
|
160
|
+
const handleContainerMouseDown = (event) => {
|
|
161
|
+
if (disabled) return;
|
|
162
|
+
const target = event.target;
|
|
163
|
+
if (target === innerRef.current) return;
|
|
164
|
+
if (target.closest("[data-tf-interactive]")) return;
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
innerRef.current?.focus();
|
|
167
|
+
};
|
|
114
168
|
warnMissingAccessibleName(label, props["aria-label"], props["aria-labelledby"]);
|
|
115
169
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
116
170
|
"div",
|
|
@@ -127,46 +181,35 @@ const TextField = React__namespace.forwardRef(
|
|
|
127
181
|
children: label
|
|
128
182
|
}
|
|
129
183
|
),
|
|
130
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-4 shrink-0 items-center justify-center", children: leftIcon })
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
(rightIcon || validated) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
157
|
-
"div",
|
|
158
|
-
{
|
|
159
|
-
className: cn.cn(
|
|
160
|
-
"absolute inset-y-0 right-0 flex items-center gap-2 text-content-secondary",
|
|
161
|
-
ICON_INSET[size]
|
|
184
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
className: getContainerClassName(size, error, disabled),
|
|
188
|
+
onMouseDown: handleContainerMouseDown,
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsx(LeadingIcon, { children: leftIcon }),
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx(SideLabel, { id: leftLabelId, size, align: "left", children: leftLabel }),
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
193
|
+
"input",
|
|
194
|
+
{
|
|
195
|
+
ref: setRefs,
|
|
196
|
+
id: inputId,
|
|
197
|
+
disabled,
|
|
198
|
+
"aria-describedby": describedBy,
|
|
199
|
+
"aria-invalid": error || void 0,
|
|
200
|
+
className: cn.cn(
|
|
201
|
+
"h-full min-w-0 flex-1 bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed",
|
|
202
|
+
INPUT_TYPOGRAPHY[size],
|
|
203
|
+
"[&[type='search']::-webkit-search-cancel-button]:hidden [&[type='search']::-webkit-search-cancel-button]:appearance-none"
|
|
204
|
+
),
|
|
205
|
+
...props
|
|
206
|
+
}
|
|
162
207
|
),
|
|
163
|
-
children:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
)
|
|
169
|
-
] }),
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsx(SideLabel, { id: rightLabelId, size, align: "right", children: rightLabel }),
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrailingAdornment, { rightIcon, validated })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
),
|
|
170
213
|
bottomText && /* @__PURE__ */ jsxRuntime.jsx(TextFieldHelperText, { id: helperTextId, error, children: bottomText })
|
|
171
214
|
]
|
|
172
215
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.cjs","sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { CheckOutlineIcon } from \"@/index\";\nimport { cn } from \"../../utils/cn\";\n\n/** Text field height in pixels. */\nexport type TextFieldSize = \"48\" | \"40\" | \"32\";\n\nexport interface TextFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n /** Label text displayed above the input. Also used as the accessible name. */\n label?: string;\n /** Helper text displayed below the input. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the text field in pixels. @default \"48\" */\n size?: TextFieldSize;\n /** Whether the text field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the input. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Whether the text field is validated. @default false */\n validated?: boolean;\n /** Icon element displayed at the left side of the input. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed at the right side of the input. */\n rightIcon?: React.ReactNode;\n /** Whether the text field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n}\n\nconst CONTAINER_HEIGHT: Record<TextFieldSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst INPUT_SIZE_CLASSES: Record<TextFieldSize, string> = {\n \"48\": \"py-3 typography-body-default-16px-regular autofill-body-lg\",\n \"40\": \"py-2 typography-body-default-16px-regular autofill-body-lg\",\n \"32\": \"py-2 typography-body-small-14px-regular autofill-body-md\",\n};\n\nconst INPUT_PL: Record<TextFieldSize, { default: string; withIcon: string }> = {\n \"48\": { default: \"pl-4\", withIcon: \"pl-10\" },\n \"40\": { default: \"pl-4\", withIcon: \"pl-10\" },\n \"32\": { default: \"pl-3\", withIcon: \"pl-9\" },\n};\n\nconst INPUT_PR: Record<TextFieldSize, { default: string; withIcon: string }> = {\n \"48\": { default: \"pr-4\", withIcon: \"pr-10\" },\n \"40\": { default: \"pr-4\", withIcon: \"pr-10\" },\n \"32\": { default: \"pr-3\", withIcon: \"pr-9\" },\n};\n\nconst ICON_INSET: Record<TextFieldSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nfunction getContainerClassName(size: TextFieldSize, error: boolean, disabled?: boolean) {\n return cn(\n \"relative overflow-hidden rounded-sm border bg-inputs-inputs-primary has-focus-visible:shadow-focus-ring has-focus-visible:outline-none motion-safe:transition-colors\",\n error ? \"border-error-content\" : \"border-border-primary\",\n !disabled && !error && \"hover:border-neutral-alphas-400\",\n CONTAINER_HEIGHT[size],\n disabled && \"opacity-50\",\n );\n}\n\nfunction getInputClassName(size: TextFieldSize, hasLeftIcon: boolean, hasRightIcon: boolean) {\n return cn(\n \"h-full w-full rounded-sm bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed\",\n INPUT_SIZE_CLASSES[size],\n hasLeftIcon ? INPUT_PL[size].withIcon : INPUT_PL[size].default,\n hasRightIcon ? INPUT_PR[size].withIcon : INPUT_PR[size].default,\n );\n}\n\nfunction TextFieldHelperText({\n id,\n error,\n children,\n}: {\n id: string;\n error: boolean;\n children: React.ReactNode;\n}) {\n return (\n <p\n id={id}\n className={cn(\n \"typography-description-12px-regular px-2 pt-2 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {children}\n </p>\n );\n}\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"TextField: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A text input field with optional label, helper/error text, and icon slots.\n *\n * Provide at least one of `label`, `aria-label`, or `aria-labelledby` for\n * accessibility — a console warning is emitted in development if none are set.\n *\n * @example\n * ```tsx\n * <TextField\n * label=\"Email\"\n * placeholder=\"you@example.com\"\n * error={!!emailError}\n * errorMessage={emailError}\n * />\n * ```\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n validated = false,\n leftIcon,\n rightIcon,\n className,\n id,\n disabled,\n fullWidth = false,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const helperTextId = `${inputId}-helper`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n warnMissingAccessibleName(label, props[\"aria-label\"], props[\"aria-labelledby\"]);\n\n return (\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={inputId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n <div className={getContainerClassName(size, error, disabled)}>\n <input\n ref={ref}\n id={inputId}\n disabled={disabled}\n aria-describedby={bottomText ? helperTextId : undefined}\n aria-invalid={error || undefined}\n className={cn(\n getInputClassName(size, !!leftIcon, !!(rightIcon || validated)),\n \"[&[type='search']::-webkit-search-cancel-button]:hidden [&[type='search']::-webkit-search-cancel-button]:appearance-none\",\n )}\n {...props}\n />\n\n {leftIcon && (\n <div\n className={cn(\n \"pointer-events-none absolute inset-y-0 left-0 flex items-center text-content-secondary\",\n ICON_INSET[size],\n )}\n >\n <div className=\"flex size-4 shrink-0 items-center justify-center\">{leftIcon}</div>\n </div>\n )}\n\n {(rightIcon || validated) && (\n <div\n className={cn(\n \"absolute inset-y-0 right-0 flex items-center gap-2 text-content-secondary\",\n ICON_INSET[size],\n )}\n >\n {rightIcon && (\n <div className=\"flex size-4 shrink-0 items-center justify-center\">{rightIcon}</div>\n )}\n {validated && (\n <div className=\"pointer-events-none flex size-4 shrink-0 items-center justify-center\">\n <CheckOutlineIcon className=\"text-success-content\" />\n </div>\n )}\n </div>\n )}\n </div>\n\n {bottomText && (\n <TextFieldHelperText id={helperTextId} error={error}>\n {bottomText}\n </TextF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AAA,gBACA,IAAI;AAAA,gBACJ;AAAA,gBACA,oBAAkB,aAAa,eAAe;AAAA,gBAC9C,gBAAc,SAAS;AAAA,gBACvB,WAAWD,GAAAA;AAAAA,kBACT,kBAAkB,MAAM,CAAC,CAAC,UAAU,CAAC,EAAE,aAAa,UAAU;AAAA,kBAC9D;AAAA,gBAAA;AAAA,gBAED,GAAG;AAAA,cAAA;AAAA,YAAA;AAAA,YAGL,YACCC,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWD,GAAAA;AAAAA,kBACT;AAAA,kBACA,WAAW,IAAI;AAAA,gBAAA;AAAA,gBAGjB,UAAAC,2BAAAA,IAAC,OAAA,EAAI,WAAU,oDAAoD,UAAA,SAAA,CAAS;AAAA,cAAA;AAAA,YAAA;AAAA,aAI9E,aAAa,cACbE,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWH,GAAAA;AAAAA,kBACT;AAAA,kBACA,WAAW,IAAI;AAAA,gBAAA;AAAA,gBAGhB,UAAA;AAAA,kBAAA,aACCC,2BAAAA,IAAC,OAAA,EAAI,WAAU,oDAAoD,UAAA,WAAU;AAAA,kBAE9E,4CACE,OAAA,EAAI,WAAU,wEACb,UAAAA,2BAAAA,IAACG,iBAAAA,kBAAA,EAAiB,WAAU,uBAAA,CAAuB,EAAA,CACrD;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ,GAEJ;AAAA,UAEC,cACCH,2BAAAA,IAAC,qBAAA,EAAoB,IAAI,cAAc,OACpC,UAAA,WAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,UAAU,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"TextField.cjs","sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { CheckOutlineIcon } from \"@/index\";\nimport { cn } from \"../../utils/cn\";\n\n/** Text field height in pixels. */\nexport type TextFieldSize = \"48\" | \"40\" | \"32\";\n\nexport interface TextFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n /** Label text displayed above the input. Also used as the accessible name. */\n label?: string;\n /** Helper text displayed below the input. Replaced by `errorMessage` when `error` is `true`. */\n helperText?: string;\n /** Height of the text field in pixels. @default \"48\" */\n size?: TextFieldSize;\n /** Whether the text field is in an error state. @default false */\n error?: boolean;\n /** Error message displayed below the input. Shown instead of `helperText` when `error` is `true`. */\n errorMessage?: string;\n /** Whether the text field is validated. @default false */\n validated?: boolean;\n /** Icon element displayed at the left side of the input. */\n leftIcon?: React.ReactNode;\n /** Icon element displayed at the right side of the input. */\n rightIcon?: React.ReactNode;\n /** Fixed, non-editable label pinned inside the left edge of the field — for a prefix such as a currency symbol or country code. */\n leftLabel?: React.ReactNode;\n /** Fixed, non-editable label pinned inside the right edge of the field — for a unit or suffix such as a currency code or domain. */\n rightLabel?: React.ReactNode;\n /** Whether the text field stretches to fill its container width. @default false */\n fullWidth?: boolean;\n}\n\nconst CONTAINER_HEIGHT: Record<TextFieldSize, string> = {\n \"48\": \"h-12\",\n \"40\": \"h-10\",\n \"32\": \"h-8\",\n};\n\nconst CONTAINER_PADDING_X: Record<TextFieldSize, string> = {\n \"48\": \"px-4\",\n \"40\": \"px-4\",\n \"32\": \"px-3\",\n};\n\nconst CONTAINER_GAP: Record<TextFieldSize, string> = {\n \"48\": \"gap-2.5\",\n \"40\": \"gap-2.5\",\n \"32\": \"gap-2\",\n};\n\nconst INPUT_TYPOGRAPHY: Record<TextFieldSize, string> = {\n \"48\": \"typography-body-default-16px-regular autofill-body-lg\",\n \"40\": \"typography-body-default-16px-regular autofill-body-lg\",\n \"32\": \"typography-body-small-14px-regular autofill-body-md\",\n};\n\nconst SIDE_LABEL_TYPOGRAPHY: Record<TextFieldSize, string> = {\n \"48\": \"typography-body-default-16px-regular\",\n \"40\": \"typography-body-default-16px-regular\",\n \"32\": \"typography-body-small-14px-regular\",\n};\n\nfunction getContainerClassName(size: TextFieldSize, error: boolean, disabled?: boolean) {\n return cn(\n \"relative flex items-center overflow-hidden rounded-sm border bg-inputs-inputs-primary has-focus-visible:shadow-focus-ring has-focus-visible:outline-none motion-safe:transition-colors\",\n CONTAINER_PADDING_X[size],\n CONTAINER_GAP[size],\n error ? \"border-error-content\" : \"border-border-primary\",\n !disabled && !error && \"hover:border-neutral-alphas-400\",\n CONTAINER_HEIGHT[size],\n disabled && \"opacity-50\",\n );\n}\n\nfunction LeadingIcon({ children }: { children?: React.ReactNode }) {\n if (!children) return null;\n return (\n <span className=\"pointer-events-none flex size-4 shrink-0 items-center justify-center text-content-secondary\">\n {children}\n </span>\n );\n}\n\nfunction SideLabel({\n id,\n size,\n align,\n children,\n}: {\n id?: string;\n size: TextFieldSize;\n align: \"left\" | \"right\";\n children?: React.ReactNode;\n}) {\n if (!children) return null;\n return (\n <span\n id={id}\n className={cn(\n \"shrink-0 select-none whitespace-nowrap text-content-tertiary\",\n align === \"right\" && \"text-right\",\n SIDE_LABEL_TYPOGRAPHY[size],\n )}\n >\n {children}\n </span>\n );\n}\n\nfunction TrailingAdornment({\n rightIcon,\n validated,\n}: {\n rightIcon?: React.ReactNode;\n validated: boolean;\n}) {\n if (!rightIcon && !validated) return null;\n return (\n <span className=\"flex shrink-0 items-center gap-2 text-content-secondary\">\n {rightIcon && (\n <span data-tf-interactive=\"\" className=\"flex size-4 shrink-0 items-center justify-center\">\n {rightIcon}\n </span>\n )}\n {validated && (\n <span className=\"pointer-events-none flex size-4 shrink-0 items-center justify-center\">\n <CheckOutlineIcon className=\"text-success-content\" />\n </span>\n )}\n </span>\n );\n}\n\nfunction TextFieldHelperText({\n id,\n error,\n children,\n}: {\n id: string;\n error: boolean;\n children: React.ReactNode;\n}) {\n return (\n <p\n id={id}\n className={cn(\n \"typography-description-12px-regular px-2 pt-2 pb-0.5\",\n error ? \"text-error-content\" : \"text-content-secondary\",\n )}\n >\n {children}\n </p>\n );\n}\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"TextField: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A text input field with optional label, helper/error text, icon slots, and side labels.\n *\n * Use `leftLabel` / `rightLabel` for fixed unit or prefix affordances (currency symbol,\n * country code, domain suffix). Provide at least one of `label`, `aria-label`, or\n * `aria-labelledby` for accessibility — a console warning is emitted in development if none are set.\n *\n * @example\n * ```tsx\n * <TextField\n * label=\"Email\"\n * placeholder=\"you@example.com\"\n * error={!!emailError}\n * errorMessage={emailError}\n * />\n * ```\n *\n * @example\n * ```tsx\n * <TextField label=\"Price\" leftLabel=\"$\" rightLabel=\"USD\" placeholder=\"0.00\" />\n * ```\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n label,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n validated = false,\n leftIcon,\n rightIcon,\n leftLabel,\n rightLabel,\n className,\n id,\n disabled,\n fullWidth = false,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const inputId = id || generatedId;\n const helperTextId = `${inputId}-helper`;\n const leftLabelId = `${inputId}-left-label`;\n const rightLabelId = `${inputId}-right-label`;\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n const describedBy =\n [\n leftLabel != null ? leftLabelId : null,\n rightLabel != null ? rightLabelId : null,\n bottomText ? helperTextId : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n const innerRef = React.useRef<HTMLInputElement>(null);\n const setRefs = React.useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref],\n );\n\n // Keep clicks on the non-interactive adornments (icons, side labels, padding)\n // focusing the input, matching the old absolute/pointer-events-none layout.\n const handleContainerMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return;\n const target = event.target as HTMLElement;\n if (target === innerRef.current) return;\n if (target.closest(\"[data-tf-interactive]\")) return;\n event.preventDefault();\n innerRef.current?.focus();\n };\n\n warnMissingAccessibleName(label, props[\"aria-label\"], props[\"aria-labelledby\"]);\n\n return (\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={inputId}\n className=\"typography-description-12px-semibold pb-2 text-content-primary\"\n >\n {label}\n </label>\n )}\n\n {/* biome-ignore lint/a11y/noStaticElementInteractions: focus bridge delegates pointer clicks on adornments to the input */}\n <div\n className={getContainerClassName(size, error, disabled)}\n onMouseDown={handleContainerMouseDown}\n >\n <LeadingIcon>{leftIcon}</LeadingIcon>\n <SideLabel id={leftLabelId} size={size} align=\"left\">\n {leftLabel}\n </SideLabel>\n\n <input\n ref={setRefs}\n id={inputId}\n disabled={disabled}\n aria-describedby={describedBy}\n aria-invalid={error || undefined}\n className={cn(\n \"h-full min-w-0 flex-1 bg-transparent text-content-primary no-underline placeholder:text-content-tertiary focus:outline-none disabled:cursor-not-allowed\",\n INPUT_TYPOGRAPHY[size],\n \"[&[type='search']::-webkit-search-cancel-button]:hidden [&[type='search']::-webkit-search-cancel-button]:appearance-none\",\n )}\n {...props}\n />\n\n <SideLabel id={rightLabelId} size={size} align=\"right\">\n {rightLabel}\n </SideLabel>\n <TrailingAdornment rightIcon={rightIcon} validated={validated} />\n </div>\n\n {bottomText && (\n <TextFieldHelperText id={helperTextId} error={error}>\n {bottomText}\n </TextFieldHelperText>\n )}\n </div>\n );\n },\n);\n\nTextField.displayName = \"TextField\";\n"],"names":["cn","jsx","jsxs","CheckOutlineIcon","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,mBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAA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AAAA,sBACrB;AAAA,oBAAA;AAAA,oBAED,GAAG;AAAA,kBAAA;AAAA,gBAAA;AAAA,+CAGL,WAAA,EAAU,IAAI,cAAc,MAAY,OAAM,SAC5C,UAAA,YACH;AAAA,gBACAC,2BAAAA,IAAC,mBAAA,EAAkB,WAAsB,UAAA,CAAsB;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGhE,cACCA,2BAAAA,IAAC,qBAAA,EAAoB,IAAI,cAAc,OACpC,UAAA,WAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,UAAU,cAAc;;"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const AccordionContent = require("./components/Accordion/AccordionContent.cjs");
|
|
|
7
7
|
const AccordionItem = require("./components/Accordion/AccordionItem.cjs");
|
|
8
8
|
const AccordionTrigger = require("./components/Accordion/AccordionTrigger.cjs");
|
|
9
9
|
const Alert = require("./components/Alert/Alert.cjs");
|
|
10
|
+
const AudioPlayer = require("./components/AudioPlayer/AudioPlayer.cjs");
|
|
10
11
|
const AudioUpload = require("./components/AudioUpload/AudioUpload.cjs");
|
|
11
12
|
const useAudioRecorder = require("./components/AudioUpload/useAudioRecorder.cjs");
|
|
12
13
|
const Autocomplete = require("./components/Autocomplete/Autocomplete.cjs");
|
|
@@ -32,6 +33,7 @@ const Drawer = require("./components/Drawer/Drawer.cjs");
|
|
|
32
33
|
const DropdownMenu = require("./components/DropdownMenu/DropdownMenu.cjs");
|
|
33
34
|
const EmptyState = require("./components/EmptyState/EmptyState.cjs");
|
|
34
35
|
const FanFollowerCount = require("./components/FanFollowerCount/FanFollowerCount.cjs");
|
|
36
|
+
const FloatingActionButton = require("./components/FloatingActionButton/FloatingActionButton.cjs");
|
|
35
37
|
const IconButton = require("./components/IconButton/IconButton.cjs");
|
|
36
38
|
const AddIcon = require("./components/Icons/AddIcon.cjs");
|
|
37
39
|
const AffiliatesIcon = require("./components/Icons/AffiliatesIcon.cjs");
|
|
@@ -105,6 +107,7 @@ const GenderIcon = require("./components/Icons/GenderIcon.cjs");
|
|
|
105
107
|
const GifIcon = require("./components/Icons/GifIcon.cjs");
|
|
106
108
|
const GiftIcon = require("./components/Icons/GiftIcon.cjs");
|
|
107
109
|
const GoogleIcon = require("./components/Icons/GoogleIcon.cjs");
|
|
110
|
+
const GridViewIcon = require("./components/Icons/GridViewIcon.cjs");
|
|
108
111
|
const HealthIcon = require("./components/Icons/HealthIcon.cjs");
|
|
109
112
|
const HeartIcon = require("./components/Icons/HeartIcon.cjs");
|
|
110
113
|
const HelpIcon = require("./components/Icons/HelpIcon.cjs");
|
|
@@ -117,6 +120,7 @@ const InfoCircleIcon = require("./components/Icons/InfoCircleIcon.cjs");
|
|
|
117
120
|
const InfoIcon = require("./components/Icons/InfoIcon.cjs");
|
|
118
121
|
const LanguageIcon = require("./components/Icons/LanguageIcon.cjs");
|
|
119
122
|
const LinkIcon = require("./components/Icons/LinkIcon.cjs");
|
|
123
|
+
const ListViewIcon = require("./components/Icons/ListViewIcon.cjs");
|
|
120
124
|
const LocationIcon = require("./components/Icons/LocationIcon.cjs");
|
|
121
125
|
const LockerIcon = require("./components/Icons/LockerIcon.cjs");
|
|
122
126
|
const LockerOffIcon = require("./components/Icons/LockerOffIcon.cjs");
|
|
@@ -211,6 +215,8 @@ const Pill = require("./components/Pill/Pill.cjs");
|
|
|
211
215
|
const ProfileOnlineStatus = require("./components/ProfileOnlineStatus/ProfileOnlineStatus.cjs");
|
|
212
216
|
const ProfileStatus = require("./components/ProfileStatus/ProfileStatus.cjs");
|
|
213
217
|
const ProgressBar = require("./components/ProgressBar/ProgressBar.cjs");
|
|
218
|
+
const ProgressBarItem = require("./components/ProgressBar/ProgressBarItem.cjs");
|
|
219
|
+
const ProgressBarSteps = require("./components/ProgressBar/ProgressBarSteps.cjs");
|
|
214
220
|
const Radio = require("./components/Radio/Radio.cjs");
|
|
215
221
|
const RadioGroup = require("./components/RadioGroup/RadioGroup.cjs");
|
|
216
222
|
const RatingSummary = require("./components/RatingSummary/RatingSummary.cjs");
|
|
@@ -255,6 +261,7 @@ exports.AccordionContent = AccordionContent.AccordionContent;
|
|
|
255
261
|
exports.AccordionItem = AccordionItem.AccordionItem;
|
|
256
262
|
exports.AccordionTrigger = AccordionTrigger.AccordionTrigger;
|
|
257
263
|
exports.Alert = Alert.Alert;
|
|
264
|
+
exports.AudioPlayer = AudioPlayer.AudioPlayer;
|
|
258
265
|
exports.AudioUpload = AudioUpload.AudioUpload;
|
|
259
266
|
exports.useAudioRecorder = useAudioRecorder.useAudioRecorder;
|
|
260
267
|
exports.Autocomplete = Autocomplete.Autocomplete;
|
|
@@ -319,6 +326,7 @@ exports.DropdownMenuSeparator = DropdownMenu.DropdownMenuSeparator;
|
|
|
319
326
|
exports.DropdownMenuTrigger = DropdownMenu.DropdownMenuTrigger;
|
|
320
327
|
exports.EmptyState = EmptyState.EmptyState;
|
|
321
328
|
exports.FanFollowerCount = FanFollowerCount.FanFollowerCount;
|
|
329
|
+
exports.FloatingActionButton = FloatingActionButton.FloatingActionButton;
|
|
322
330
|
exports.IconButton = IconButton.IconButton;
|
|
323
331
|
exports.AddIcon = AddIcon.AddIcon;
|
|
324
332
|
exports.AffiliatesIcon = AffiliatesIcon.AffiliatesIcon;
|
|
@@ -392,6 +400,7 @@ exports.GenderIcon = GenderIcon.GenderIcon;
|
|
|
392
400
|
exports.GifIcon = GifIcon.GifIcon;
|
|
393
401
|
exports.GiftIcon = GiftIcon.GiftIcon;
|
|
394
402
|
exports.GoogleIcon = GoogleIcon.GoogleIcon;
|
|
403
|
+
exports.GridViewIcon = GridViewIcon.GridViewIcon;
|
|
395
404
|
exports.HealthIcon = HealthIcon.HealthIcon;
|
|
396
405
|
exports.HeartIcon = HeartIcon.HeartIcon;
|
|
397
406
|
exports.HelpIcon = HelpIcon.HelpIcon;
|
|
@@ -404,6 +413,7 @@ exports.InfoCircleIcon = InfoCircleIcon.InfoCircleIcon;
|
|
|
404
413
|
exports.InfoIcon = InfoIcon.InfoIcon;
|
|
405
414
|
exports.LanguageIcon = LanguageIcon.LanguageIcon;
|
|
406
415
|
exports.LinkIcon = LinkIcon.LinkIcon;
|
|
416
|
+
exports.ListViewIcon = ListViewIcon.ListViewIcon;
|
|
407
417
|
exports.LocationIcon = LocationIcon.LocationIcon;
|
|
408
418
|
exports.LockerIcon = LockerIcon.LockerIcon;
|
|
409
419
|
exports.LockerOffIcon = LockerOffIcon.LockerOffIcon;
|
|
@@ -500,6 +510,8 @@ exports.Pill = Pill.Pill;
|
|
|
500
510
|
exports.ProfileOnlineStatus = ProfileOnlineStatus.ProfileOnlineStatus;
|
|
501
511
|
exports.ProfileStatus = ProfileStatus.ProfileStatus;
|
|
502
512
|
exports.ProgressBar = ProgressBar.ProgressBar;
|
|
513
|
+
exports.ProgressBarItem = ProgressBarItem.ProgressBarItem;
|
|
514
|
+
exports.ProgressBarSteps = ProgressBarSteps.ProgressBarSteps;
|
|
503
515
|
exports.Radio = Radio.Radio;
|
|
504
516
|
exports.RadioGroup = RadioGroup.RadioGroup;
|
|
505
517
|
exports.RatingSummary = RatingSummary.RatingSummary;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,7 +4,7 @@ import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cn } from "../../utils/cn.mjs";
|
|
6
6
|
import { ChevronDownIcon } from "../Icons/ChevronDownIcon.mjs";
|
|
7
|
-
const AccordionTrigger = React.forwardRef(({ className, children, icon, ...props }, ref) => {
|
|
7
|
+
const AccordionTrigger = React.forwardRef(({ className, children, icon, description, leadingIcon, avatar, ...props }, ref) => {
|
|
8
8
|
const showIcon = icon !== null;
|
|
9
9
|
const iconElement = icon === void 0 ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 shrink-0 text-content-secondary" }) : icon;
|
|
10
10
|
return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
@@ -24,7 +24,16 @@ const AccordionTrigger = React.forwardRef(({ className, children, icon, ...props
|
|
|
24
24
|
),
|
|
25
25
|
...props,
|
|
26
26
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
28
|
+
avatar && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", "aria-hidden": "true", children: avatar }),
|
|
29
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-start gap-2 text-left", children: [
|
|
30
|
+
leadingIcon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center pt-px [&>svg]:size-4", "aria-hidden": "true", children: leadingIcon }),
|
|
31
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "truncate typography-body-small-14px-semibold text-content-primary", children }),
|
|
33
|
+
description && /* @__PURE__ */ jsx("span", { className: "typography-description-12px-regular text-content-secondary", children: description })
|
|
34
|
+
] })
|
|
35
|
+
] })
|
|
36
|
+
] }),
|
|
28
37
|
showIcon && /* @__PURE__ */ jsx("span", { className: "shrink-0 motion-safe:transition-transform motion-safe:duration-200 [[data-state=open]>&]:rotate-180", children: iconElement })
|
|
29
38
|
]
|
|
30
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionTrigger.mjs","sources":["../../../src/components/Accordion/AccordionTrigger.tsx"],"sourcesContent":["import * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Props for the {@link AccordionTrigger} button component. */\nexport type AccordionTriggerProps = React.ComponentPropsWithoutRef<\n typeof AccordionPrimitive.Trigger\n> & {\n /**
|
|
1
|
+
{"version":3,"file":"AccordionTrigger.mjs","sources":["../../../src/components/Accordion/AccordionTrigger.tsx"],"sourcesContent":["import * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Props for the {@link AccordionTrigger} button component. */\nexport type AccordionTriggerProps = React.ComponentPropsWithoutRef<\n typeof AccordionPrimitive.Trigger\n> & {\n /** Trailing indicator icon. Defaults to `ChevronDownIcon` (rotates when open). Pass `null` to suppress it. */\n icon?: React.ReactNode | null;\n /** Secondary line rendered under the title, for extra context. */\n description?: React.ReactNode;\n /** Leading icon shown before the title (sized to 16px). */\n leadingIcon?: React.ReactNode;\n /** Leading avatar shown before the title, for headers representing a person or account. Pass an `Avatar` sized to `24`. */\n avatar?: React.ReactNode;\n};\n\n/** An interactive button that toggles the visibility of its associated {@link AccordionContent} panel. */\nexport const AccordionTrigger = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Trigger>,\n AccordionTriggerProps\n>(({ className, children, icon, description, leadingIcon, avatar, ...props }, ref) => {\n const showIcon = icon !== null;\n const iconElement =\n icon === undefined ? (\n <ChevronDownIcon className=\"size-4 shrink-0 text-content-secondary\" />\n ) : (\n icon\n );\n\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex flex-1 items-center justify-between gap-3\",\n \"rounded-sm px-3 py-3\",\n \"typography-body-small-14px-semibold text-content-primary\",\n \"cursor-pointer\",\n \"motion-safe:transition-colors motion-safe:duration-200 motion-safe:ease-in-out\",\n \"hover:bg-neutral-alphas-100\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 items-center gap-3\">\n {avatar && (\n <span className=\"flex shrink-0 items-center\" aria-hidden=\"true\">\n {avatar}\n </span>\n )}\n <span className=\"flex min-w-0 flex-1 items-start gap-2 text-left\">\n {leadingIcon && (\n <span className=\"flex shrink-0 items-center pt-px [&>svg]:size-4\" aria-hidden=\"true\">\n {leadingIcon}\n </span>\n )}\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span className=\"truncate typography-body-small-14px-semibold text-content-primary\">\n {children}\n </span>\n {description && (\n <span className=\"typography-description-12px-regular text-content-secondary\">\n {description}\n </span>\n )}\n </span>\n </span>\n </span>\n {showIcon && (\n <span className=\"shrink-0 motion-safe:transition-transform motion-safe:duration-200 [[data-state=open]>&]:rotate-180\">\n {iconElement}\n </span>\n )}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n});\n\nAccordionTrigger.displayName = \"AccordionTrigger\";\n"],"names":[],"mappings":";;;;;;AAoBO,MAAM,mBAAmB,MAAM,WAGpC,CAAC,EAAE,WAAW,UAAU,MAAM,aAAa,aAAa,QAAQ,GAAG,MAAA,GAAS,QAAQ;AACpF,QAAM,WAAW,SAAS;AAC1B,QAAM,cACJ,SAAS,6BACN,iBAAA,EAAgB,WAAU,0CAAyC,IAEpE;AAGJ,SACE,oBAAC,mBAAmB,QAAnB,EAA0B,WAAU,QACnC,UAAA;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA,qBAAC,QAAA,EAAK,WAAU,0CACb,UAAA;AAAA,UAAA,8BACE,QAAA,EAAK,WAAU,8BAA6B,eAAY,QACtD,UAAA,QACH;AAAA,UAEF,qBAAC,QAAA,EAAK,WAAU,mDACb,UAAA;AAAA,YAAA,mCACE,QAAA,EAAK,WAAU,mDAAkD,eAAY,QAC3E,UAAA,aACH;AAAA,YAEF,qBAAC,QAAA,EAAK,WAAU,sCACd,UAAA;AAAA,cAAA,oBAAC,QAAA,EAAK,WAAU,qEACb,SAAA,CACH;AAAA,cACC,eACC,oBAAC,QAAA,EAAK,WAAU,8DACb,UAAA,YAAA,CACH;AAAA,YAAA,EAAA,CAEJ;AAAA,UAAA,EAAA,CACF;AAAA,QAAA,GACF;AAAA,QACC,YACC,oBAAC,QAAA,EAAK,WAAU,uGACb,UAAA,YAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,CAAC;AAED,iBAAiB,cAAc;"}
|