@you-agent-factory/components 0.0.0 → 0.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/LICENSE.md +21 -0
- package/README.md +38 -7
- package/dist/category-paths.d.ts +3 -0
- package/dist/charts/chart-state-panel.d.ts +11 -0
- package/dist/charts/chart.d.ts +35 -0
- package/dist/charts/index.d.ts +5 -0
- package/dist/charts/index.js +287 -0
- package/dist/chunks/action-row.js +39 -0
- package/dist/chunks/alert-panel.js +182 -0
- package/dist/chunks/button.js +193 -0
- package/dist/chunks/cn.js +6 -0
- package/dist/chunks/factory-emulator-controls.js +123 -0
- package/dist/chunks/package-form-field.js +546 -0
- package/dist/chunks/scroll-area.js +261 -0
- package/dist/chunks/surface-panel.js +73 -0
- package/dist/chunks/table-layout.js +292 -0
- package/dist/chunks/typography-roles.js +26 -0
- package/dist/chunks/typography.js +129 -0
- package/dist/chunks/widget-frame.js +344 -0
- package/dist/data-display/code-panel.d.ts +12 -0
- package/dist/data-display/data-table.d.ts +27 -0
- package/dist/data-display/description-list.d.ts +4 -0
- package/{src/data-display/index.ts → dist/data-display/index.d.ts} +4 -26
- package/dist/data-display/index.js +20 -0
- package/dist/data-display/table-layout.d.ts +8 -0
- package/dist/data-display/table.d.ts +14 -0
- package/dist/factory-emulator/factory-emulator-controls.d.ts +23 -0
- package/dist/factory-emulator/index.d.ts +6 -0
- package/dist/factory-emulator/index.js +6 -0
- package/dist/feedback/alert-panel-semantics.d.ts +11 -0
- package/dist/feedback/alert-panel.d.ts +29 -0
- package/dist/feedback/index.d.ts +6 -0
- package/dist/feedback/index.js +10 -0
- package/dist/feedback/skeleton.d.ts +2 -0
- package/dist/forms/index.d.ts +19 -0
- package/dist/forms/index.js +37 -0
- package/dist/forms/package-checkbox.d.ts +3 -0
- package/dist/forms/package-enum-select.d.ts +42 -0
- package/dist/forms/package-file-input.d.ts +3 -0
- package/dist/forms/package-form-field.d.ts +49 -0
- package/dist/forms/package-input.d.ts +6 -0
- package/dist/forms/package-native-select.d.ts +3 -0
- package/dist/forms/package-select.d.ts +32 -0
- package/dist/forms/package-textarea.d.ts +10 -0
- package/dist/forms/select-icons.d.ts +3 -0
- package/dist/graphs/graph-edge-path.d.ts +18 -0
- package/dist/graphs/graph-edge.d.ts +15 -0
- package/dist/graphs/graph-node-button.d.ts +11 -0
- package/dist/graphs/graph-node-handle-badge.d.ts +5 -0
- package/dist/graphs/graph-node-handle.d.ts +18 -0
- package/dist/graphs/graph-node-shell.d.ts +13 -0
- package/dist/graphs/graph-node-state-indicator.d.ts +6 -0
- package/dist/graphs/graph-node-state.d.ts +23 -0
- package/dist/graphs/graph-viewport-surface.d.ts +5 -0
- package/dist/graphs/index.d.ts +13 -0
- package/dist/graphs/index.js +614 -0
- package/{src/icons/index.ts → dist/icons/index.d.ts} +1 -2
- package/dist/icons/index.js +4 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +145 -0
- package/dist/layout/action-row.d.ts +8 -0
- package/{src/layout/index.ts → dist/layout/index.d.ts} +1 -3
- package/dist/layout/index.js +9 -0
- package/dist/layout/surface-panel.d.ts +15 -0
- package/{src/navigation/index.ts → dist/navigation/index.d.ts} +1 -2
- package/dist/navigation/index.js +4 -0
- package/dist/overlays/collapsible.d.ts +5 -0
- package/dist/overlays/dialog.d.ts +16 -0
- package/dist/overlays/index.d.ts +10 -0
- package/dist/overlays/index.js +27 -0
- package/dist/overlays/overlay-layout.d.ts +6 -0
- package/dist/overlays/popover.d.ts +6 -0
- package/dist/overlays/scroll-area.d.ts +9 -0
- package/dist/primitives/button-link.d.ts +5 -0
- package/dist/primitives/button.d.ts +9 -0
- package/dist/primitives/icon-button-shell.d.ts +10 -0
- package/{src/primitives/index.ts → dist/primitives/index.d.ts} +2 -19
- package/dist/primitives/index.js +49 -0
- package/dist/primitives/package-text.d.ts +6 -0
- package/dist/primitives/typography-roles.d.ts +12 -0
- package/dist/primitives/typography.d.ts +36 -0
- package/dist/recipes/index.d.ts +14 -0
- package/dist/recipes/index.js +32 -0
- package/dist/recipes/widget-frame-content.d.ts +24 -0
- package/dist/recipes/widget-frame-disclosure.d.ts +33 -0
- package/dist/recipes/widget-frame-layout.d.ts +12 -0
- package/dist/recipes/widget-frame-skeleton.d.ts +2 -0
- package/dist/recipes/widget-frame-states.d.ts +15 -0
- package/dist/recipes/widget-frame-typography.d.ts +10 -0
- package/dist/recipes/widget-frame.d.ts +12 -0
- package/{src → dist}/styles.css +36 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +16 -0
- package/dist/testing/render.d.ts +5 -0
- package/{src/tokens/index.ts → dist/tokens/index.d.ts} +1 -2
- package/dist/tokens/index.js +4 -0
- package/dist/utilities/cn.d.ts +1 -0
- package/{src/utilities/index.ts → dist/utilities/index.d.ts} +1 -3
- package/dist/utilities/index.js +6 -0
- package/package.json +65 -64
- package/docs/README.md +0 -83
- package/docs/button.md +0 -119
- package/docs/charts.md +0 -325
- package/docs/data-display-code-panel.md +0 -120
- package/docs/feedback-alert-panel.md +0 -117
- package/docs/feedback-skeleton.md +0 -54
- package/docs/forms-form-field.md +0 -490
- package/docs/forms-input-primitives.md +0 -311
- package/docs/forms-select-primitives.md +0 -362
- package/docs/graphs.md +0 -250
- package/docs/layout-display-primitives.md +0 -211
- package/docs/overlays.md +0 -414
- package/docs/table-data-table.md +0 -331
- package/docs/typography-roles.md +0 -182
- package/docs/widget-frame-recipes.md +0 -273
- package/src/category-paths.ts +0 -20
- package/src/charts/chart-state-panel.tsx +0 -103
- package/src/charts/chart.tsx +0 -287
- package/src/charts/index.ts +0 -21
- package/src/data-display/code-panel.tsx +0 -67
- package/src/data-display/data-table.tsx +0 -180
- package/src/data-display/description-list.tsx +0 -24
- package/src/data-display/table-layout.ts +0 -12
- package/src/data-display/table.tsx +0 -131
- package/src/feedback/alert-panel-semantics.ts +0 -75
- package/src/feedback/alert-panel.tsx +0 -187
- package/src/feedback/index.ts +0 -21
- package/src/feedback/skeleton.tsx +0 -16
- package/src/forms/index.ts +0 -73
- package/src/forms/package-checkbox.tsx +0 -50
- package/src/forms/package-enum-select.tsx +0 -185
- package/src/forms/package-file-input.tsx +0 -25
- package/src/forms/package-form-field.tsx +0 -202
- package/src/forms/package-input.tsx +0 -25
- package/src/forms/package-native-select.tsx +0 -25
- package/src/forms/package-select.tsx +0 -209
- package/src/forms/package-textarea.tsx +0 -35
- package/src/forms/select-icons.tsx +0 -35
- package/src/graphs/graph-edge-path.ts +0 -241
- package/src/graphs/graph-edge.tsx +0 -130
- package/src/graphs/graph-interactive-example.tsx +0 -187
- package/src/graphs/graph-node-button.tsx +0 -51
- package/src/graphs/graph-node-handle-badge.tsx +0 -108
- package/src/graphs/graph-node-handle.ts +0 -28
- package/src/graphs/graph-node-shell.tsx +0 -111
- package/src/graphs/graph-node-state-indicator.tsx +0 -47
- package/src/graphs/graph-node-state.ts +0 -111
- package/src/graphs/graph-viewport-surface.tsx +0 -27
- package/src/graphs/index.ts +0 -41
- package/src/index.ts +0 -209
- package/src/layout/action-row.tsx +0 -53
- package/src/layout/surface-panel.tsx +0 -91
- package/src/overlays/collapsible.tsx +0 -22
- package/src/overlays/dialog.tsx +0 -148
- package/src/overlays/index.ts +0 -31
- package/src/overlays/overlay-layout.ts +0 -9
- package/src/overlays/popover.tsx +0 -29
- package/src/overlays/scroll-area.tsx +0 -78
- package/src/primitives/button-link.tsx +0 -22
- package/src/primitives/button.tsx +0 -258
- package/src/primitives/icon-button-shell.tsx +0 -49
- package/src/primitives/package-text.tsx +0 -29
- package/src/primitives/typography-roles.ts +0 -12
- package/src/primitives/typography.tsx +0 -165
- package/src/recipes/index.ts +0 -61
- package/src/recipes/widget-frame-content.tsx +0 -114
- package/src/recipes/widget-frame-disclosure.tsx +0 -161
- package/src/recipes/widget-frame-layout.ts +0 -40
- package/src/recipes/widget-frame-skeleton.tsx +0 -16
- package/src/recipes/widget-frame-states.tsx +0 -99
- package/src/recipes/widget-frame-typography.ts +0 -19
- package/src/recipes/widget-frame.tsx +0 -84
- package/src/testing/index.ts +0 -13
- package/src/testing/render.tsx +0 -16
- package/src/utilities/cn.ts +0 -5
- /package/{src → dist}/styles/color-palette-presets.css +0 -0
- /package/{src → dist}/styles/color-role-tokens.css +0 -0
- /package/{src → dist}/styles/layout-role-tokens.css +0 -0
- /package/{src → dist}/styles/text-color-role-tokens.css +0 -0
- /package/{src → dist}/styles/typography-role-tokens.css +0 -0
- /package/{src → dist}/styles/typography-role-utilities.css +0 -0
- /package/{src → dist}/styles/typography-roles.css +0 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState } from "react";
|
|
3
|
+
import { c as cn } from "./cn.js";
|
|
4
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
5
|
+
const CHECKBOX_ROOT_CLASS = "relative inline-flex size-4 shrink-0 items-center justify-center [&:has(:disabled)]:cursor-not-allowed";
|
|
6
|
+
function CheckboxCheckIcon() {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"svg",
|
|
9
|
+
{
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
className: "size-3 opacity-0",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
strokeWidth: 2.5,
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
const PackageCheckbox = forwardRef(function PackageCheckbox2({ className, ...props }, ref) {
|
|
23
|
+
return /* @__PURE__ */ jsxs("span", { className: cn(CHECKBOX_ROOT_CLASS, className), children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
"input",
|
|
26
|
+
{
|
|
27
|
+
className: "peer sr-only",
|
|
28
|
+
ref,
|
|
29
|
+
type: "checkbox",
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
className: "pointer-events-none flex size-4 items-center justify-center rounded border border-outline bg-surface-container-high text-on-primary transition-colors peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-af-focus-ring peer-disabled:border-outline peer-disabled:bg-surface-container-low peer-checked:border-primary peer-checked:bg-primary peer-aria-invalid:ring-2 peer-aria-invalid:ring-af-danger-border peer-checked:[&_svg]:opacity-100",
|
|
38
|
+
children: /* @__PURE__ */ jsx(CheckboxCheckIcon, {})
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
});
|
|
43
|
+
const INPUT_CLASS = "flex min-h-11 w-full rounded-xl border border-outline bg-surface-container-high px-3 py-2.5 text-sm text-on-surface outline-none transition-colors placeholder:text-on-surface-disabled focus-visible:border-outline-variant focus-visible:ring-2 focus-visible:ring-af-focus-ring aria-invalid:border-af-danger-border aria-invalid:ring-2 aria-invalid:ring-af-danger-border disabled:cursor-not-allowed disabled:border-outline disabled:bg-surface-container-low disabled:text-on-surface-disabled";
|
|
44
|
+
function inputVariants({ className } = {}) {
|
|
45
|
+
return cn(INPUT_CLASS, className);
|
|
46
|
+
}
|
|
47
|
+
const PackageInput = forwardRef(
|
|
48
|
+
function PackageInput2({ className, type = "text", ...props }, ref) {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
"input",
|
|
51
|
+
{
|
|
52
|
+
className: inputVariants({ className }),
|
|
53
|
+
ref,
|
|
54
|
+
type,
|
|
55
|
+
...props
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
function SelectChevronDownIcon(props) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"svg",
|
|
63
|
+
{
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
fill: "none",
|
|
66
|
+
stroke: "currentColor",
|
|
67
|
+
strokeLinecap: "round",
|
|
68
|
+
strokeLinejoin: "round",
|
|
69
|
+
strokeWidth: 1.8,
|
|
70
|
+
viewBox: "0 0 24 24",
|
|
71
|
+
...props,
|
|
72
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function SelectCheckIcon(props) {
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"svg",
|
|
79
|
+
{
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
fill: "none",
|
|
82
|
+
stroke: "currentColor",
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round",
|
|
85
|
+
strokeWidth: 2,
|
|
86
|
+
viewBox: "0 0 24 24",
|
|
87
|
+
...props,
|
|
88
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
const Select = SelectPrimitive.Root;
|
|
93
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
94
|
+
const SelectValue = SelectPrimitive.Value;
|
|
95
|
+
const SelectTrigger = forwardRef(function SelectTrigger2({ className, children, ...props }, ref) {
|
|
96
|
+
return /* @__PURE__ */ jsxs(
|
|
97
|
+
SelectPrimitive.Trigger,
|
|
98
|
+
{
|
|
99
|
+
className: cn(
|
|
100
|
+
inputVariants({
|
|
101
|
+
className: "flex items-center justify-between gap-2 text-left data-[placeholder]:text-on-surface-disabled [&>span]:line-clamp-1"
|
|
102
|
+
}),
|
|
103
|
+
className
|
|
104
|
+
),
|
|
105
|
+
ref,
|
|
106
|
+
...props,
|
|
107
|
+
children: [
|
|
108
|
+
children,
|
|
109
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(SelectChevronDownIcon, { className: "h-4 w-4 shrink-0 text-af-text-subtle" }) })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
const SELECT_CONTENT_POPPER_CLASS = "min-w-[var(--radix-select-trigger-width)]";
|
|
115
|
+
const SELECT_VIEWPORT_POPPER_CLASS = "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]";
|
|
116
|
+
function SelectContent({
|
|
117
|
+
children,
|
|
118
|
+
className,
|
|
119
|
+
onCloseAutoFocus,
|
|
120
|
+
position = "popper",
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
124
|
+
SelectPrimitive.Content,
|
|
125
|
+
{
|
|
126
|
+
className: cn(
|
|
127
|
+
"relative z-50 max-h-72 overflow-hidden rounded-xl border border-outline bg-surface-container-high text-on-surface shadow-af-panel data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
128
|
+
position === "popper" && SELECT_CONTENT_POPPER_CLASS,
|
|
129
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
130
|
+
className
|
|
131
|
+
),
|
|
132
|
+
onCloseAutoFocus,
|
|
133
|
+
position,
|
|
134
|
+
...props,
|
|
135
|
+
children: /* @__PURE__ */ jsx(
|
|
136
|
+
SelectPrimitive.Viewport,
|
|
137
|
+
{
|
|
138
|
+
className: cn(
|
|
139
|
+
"p-1",
|
|
140
|
+
position === "popper" && SELECT_VIEWPORT_POPPER_CLASS
|
|
141
|
+
),
|
|
142
|
+
children
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
) });
|
|
147
|
+
}
|
|
148
|
+
function SelectLabel({ className, ...props }) {
|
|
149
|
+
return /* @__PURE__ */ jsx(
|
|
150
|
+
SelectPrimitive.Label,
|
|
151
|
+
{
|
|
152
|
+
className: cn(
|
|
153
|
+
"px-2 py-1.5 text-xs font-semibold uppercase tracking-[0.08em] text-on-surface-subtle",
|
|
154
|
+
className
|
|
155
|
+
),
|
|
156
|
+
...props
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
const SELECT_EMPTY_STATE_VALUE = "__select-empty-state__";
|
|
161
|
+
const SelectItem = forwardRef(function SelectItem2({ children, className, ...props }, ref) {
|
|
162
|
+
return /* @__PURE__ */ jsxs(
|
|
163
|
+
SelectPrimitive.Item,
|
|
164
|
+
{
|
|
165
|
+
className: cn(
|
|
166
|
+
"relative flex w-full min-w-0 cursor-default select-none items-center rounded-lg py-2 pl-8 pr-2 text-sm outline-none focus:bg-surface-container-highest data-[disabled]:pointer-events-none data-[disabled]:text-on-surface-disabled data-[highlighted]:bg-surface-container-highest",
|
|
167
|
+
className
|
|
168
|
+
),
|
|
169
|
+
ref,
|
|
170
|
+
...props,
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(SelectCheckIcon, { className: "h-4 w-4" }) }) }),
|
|
173
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { className: "line-clamp-2 break-words", children })
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
function SelectEmpty({ children, className }) {
|
|
179
|
+
return /* @__PURE__ */ jsx(
|
|
180
|
+
SelectPrimitive.Item,
|
|
181
|
+
{
|
|
182
|
+
className: cn(
|
|
183
|
+
"relative flex w-full min-w-0 cursor-default select-none items-center rounded-lg px-2 py-2 text-sm text-on-surface-disabled data-[disabled]:pointer-events-none data-[disabled]:text-on-surface-disabled",
|
|
184
|
+
className
|
|
185
|
+
),
|
|
186
|
+
disabled: true,
|
|
187
|
+
value: SELECT_EMPTY_STATE_VALUE,
|
|
188
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { className: "line-clamp-2 break-words", children })
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
function SelectSeparator({ className, ...props }) {
|
|
193
|
+
return /* @__PURE__ */ jsx(
|
|
194
|
+
SelectPrimitive.Separator,
|
|
195
|
+
{
|
|
196
|
+
className: cn("-mx-1 my-1 h-px bg-outline", className),
|
|
197
|
+
...props
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
function SelectField({
|
|
202
|
+
children,
|
|
203
|
+
className,
|
|
204
|
+
description,
|
|
205
|
+
descriptionId,
|
|
206
|
+
error,
|
|
207
|
+
errorId,
|
|
208
|
+
inputId,
|
|
209
|
+
label
|
|
210
|
+
}) {
|
|
211
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("grid gap-2", className), children: [
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
"label",
|
|
214
|
+
{
|
|
215
|
+
className: "text-xs font-bold uppercase tracking-[0.08em] text-af-text-subtle",
|
|
216
|
+
htmlFor: inputId,
|
|
217
|
+
children: label
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
children,
|
|
221
|
+
description ? /* @__PURE__ */ jsx("p", { className: "m-0 text-sm text-af-text-muted", id: descriptionId, children: description }) : null,
|
|
222
|
+
error ? /* @__PURE__ */ jsx(
|
|
223
|
+
"p",
|
|
224
|
+
{
|
|
225
|
+
className: "m-0 text-sm font-medium text-on-error-container",
|
|
226
|
+
id: errorId,
|
|
227
|
+
role: "alert",
|
|
228
|
+
children: error
|
|
229
|
+
}
|
|
230
|
+
) : null
|
|
231
|
+
] });
|
|
232
|
+
}
|
|
233
|
+
const ENUM_SELECT_EMPTY_VALUE = "__enum-select-empty__";
|
|
234
|
+
function EnumSelect({
|
|
235
|
+
className,
|
|
236
|
+
disabled,
|
|
237
|
+
emptyOptionsLabel = "No options available",
|
|
238
|
+
id,
|
|
239
|
+
loading = false,
|
|
240
|
+
loadingLabel = "Loading options...",
|
|
241
|
+
onValueChange,
|
|
242
|
+
options,
|
|
243
|
+
placeholder,
|
|
244
|
+
value,
|
|
245
|
+
...aria
|
|
246
|
+
}) {
|
|
247
|
+
const isEmpty = !loading && options.length === 0;
|
|
248
|
+
const resolvedPlaceholder = loading ? loadingLabel : placeholder;
|
|
249
|
+
return /* @__PURE__ */ jsxs(
|
|
250
|
+
Select,
|
|
251
|
+
{
|
|
252
|
+
disabled: disabled || loading,
|
|
253
|
+
onValueChange,
|
|
254
|
+
value: loading ? SELECT_EMPTY_STATE_VALUE : value,
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
SelectTrigger,
|
|
258
|
+
{
|
|
259
|
+
"aria-busy": loading || void 0,
|
|
260
|
+
className,
|
|
261
|
+
id,
|
|
262
|
+
...aria,
|
|
263
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: resolvedPlaceholder })
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
/* @__PURE__ */ jsx(SelectContent, { children: loading ? /* @__PURE__ */ jsx(SelectEmpty, { children: loadingLabel }) : isEmpty ? /* @__PURE__ */ jsx(SelectEmpty, { children: emptyOptionsLabel }) : options.map((option) => /* @__PURE__ */ jsx(
|
|
267
|
+
SelectItem,
|
|
268
|
+
{
|
|
269
|
+
disabled: option.disabled,
|
|
270
|
+
value: option.value,
|
|
271
|
+
children: option.label
|
|
272
|
+
},
|
|
273
|
+
option.value
|
|
274
|
+
)) })
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
function OptionalEnumSelect({
|
|
280
|
+
className,
|
|
281
|
+
disabled,
|
|
282
|
+
emptyOptionLabel,
|
|
283
|
+
id,
|
|
284
|
+
onValueChange,
|
|
285
|
+
options,
|
|
286
|
+
value,
|
|
287
|
+
...aria
|
|
288
|
+
}) {
|
|
289
|
+
return /* @__PURE__ */ jsxs(
|
|
290
|
+
Select,
|
|
291
|
+
{
|
|
292
|
+
disabled,
|
|
293
|
+
onValueChange: (nextValue) => onValueChange(nextValue === ENUM_SELECT_EMPTY_VALUE ? null : nextValue),
|
|
294
|
+
value: value ?? ENUM_SELECT_EMPTY_VALUE,
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className, id, ...aria, children: /* @__PURE__ */ jsx(SelectValue, { placeholder: emptyOptionLabel }) }),
|
|
297
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
298
|
+
/* @__PURE__ */ jsx(SelectItem, { value: ENUM_SELECT_EMPTY_VALUE, children: emptyOptionLabel }),
|
|
299
|
+
options.map((option) => /* @__PURE__ */ jsx(
|
|
300
|
+
SelectItem,
|
|
301
|
+
{
|
|
302
|
+
disabled: option.disabled,
|
|
303
|
+
value: option.value,
|
|
304
|
+
children: option.label
|
|
305
|
+
},
|
|
306
|
+
option.value
|
|
307
|
+
))
|
|
308
|
+
] })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
function ResetEnumSelect({
|
|
314
|
+
className,
|
|
315
|
+
disabled,
|
|
316
|
+
id,
|
|
317
|
+
onValueChange,
|
|
318
|
+
options,
|
|
319
|
+
placeholder,
|
|
320
|
+
...aria
|
|
321
|
+
}) {
|
|
322
|
+
const [instanceKey, setInstanceKey] = useState(0);
|
|
323
|
+
return /* @__PURE__ */ jsxs(
|
|
324
|
+
Select,
|
|
325
|
+
{
|
|
326
|
+
disabled,
|
|
327
|
+
onValueChange: (nextValue) => {
|
|
328
|
+
onValueChange(nextValue);
|
|
329
|
+
setInstanceKey((current) => current + 1);
|
|
330
|
+
},
|
|
331
|
+
value: void 0,
|
|
332
|
+
children: [
|
|
333
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className, id, ...aria, children: /* @__PURE__ */ jsx(SelectValue, { placeholder }) }),
|
|
334
|
+
/* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(
|
|
335
|
+
SelectItem,
|
|
336
|
+
{
|
|
337
|
+
disabled: option.disabled,
|
|
338
|
+
value: option.value,
|
|
339
|
+
children: option.label
|
|
340
|
+
},
|
|
341
|
+
option.value
|
|
342
|
+
)) })
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
instanceKey
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
const FILE_INPUT_CLASS = "block w-full rounded-xl px-3 py-3 text-sm text-on-surface-variant outline-none focus-visible:ring-2 focus-visible:ring-af-focus-ring file:mr-3 file:rounded-lg file:border-0 file:bg-surface-container-high file:px-3 file:py-2 file:text-sm file:font-semibold file:text-on-surface hover:bg-af-overlay aria-invalid:border-af-danger-border aria-invalid:ring-2 aria-invalid:ring-af-danger-border disabled:cursor-not-allowed disabled:bg-surface-container-low disabled:text-on-surface-disabled";
|
|
349
|
+
const PackageFileInput = forwardRef(function PackageFileInput2({ className, ...props }, ref) {
|
|
350
|
+
return /* @__PURE__ */ jsx(
|
|
351
|
+
"input",
|
|
352
|
+
{
|
|
353
|
+
className: cn(FILE_INPUT_CLASS, className),
|
|
354
|
+
ref,
|
|
355
|
+
type: "file",
|
|
356
|
+
...props
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
});
|
|
360
|
+
const NativeSelect = forwardRef(
|
|
361
|
+
function NativeSelect2({ children, className, ...props }, ref) {
|
|
362
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
363
|
+
/* @__PURE__ */ jsx(
|
|
364
|
+
"select",
|
|
365
|
+
{
|
|
366
|
+
className: inputVariants({
|
|
367
|
+
className: `appearance-none pr-10 ${className ?? ""}`
|
|
368
|
+
}),
|
|
369
|
+
ref,
|
|
370
|
+
...props,
|
|
371
|
+
children
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ jsx(SelectChevronDownIcon, { className: "pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-af-text-subtle" })
|
|
375
|
+
] });
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
const TEXTAREA_PLAIN_CLASS = "m-0 w-full resize-none border-0 bg-transparent p-0 text-sm leading-6 text-on-surface outline-none";
|
|
379
|
+
const TEXTAREA_FIELD_CLASS = "min-h-28 max-h-52 resize-none overflow-y-auto py-3";
|
|
380
|
+
function textareaVariants({ className } = {}) {
|
|
381
|
+
return inputVariants({ className: cn(TEXTAREA_FIELD_CLASS, className) });
|
|
382
|
+
}
|
|
383
|
+
const PackageTextarea = forwardRef(function PackageTextarea2({ className, variant = "field", ...props }, ref) {
|
|
384
|
+
return /* @__PURE__ */ jsx(
|
|
385
|
+
"textarea",
|
|
386
|
+
{
|
|
387
|
+
className: variant === "plain" ? cn(TEXTAREA_PLAIN_CLASS, className) : textareaVariants({ className }),
|
|
388
|
+
ref,
|
|
389
|
+
...props
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
});
|
|
393
|
+
function buildFormFieldAriaDescribedBy(messageIds) {
|
|
394
|
+
const ids = [
|
|
395
|
+
messageIds.descriptionId,
|
|
396
|
+
messageIds.helperId,
|
|
397
|
+
messageIds.warningId,
|
|
398
|
+
messageIds.errorId,
|
|
399
|
+
messageIds.successId
|
|
400
|
+
].filter((id) => Boolean(id));
|
|
401
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
402
|
+
}
|
|
403
|
+
const FormField = forwardRef(
|
|
404
|
+
function FormField2({ className, ...props }, ref) {
|
|
405
|
+
return /* @__PURE__ */ jsx("div", { className: cn("space-y-2", className), ref, ...props });
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
const FORM_LABEL_CLASS = "block text-sm font-semibold text-on-surface";
|
|
409
|
+
const FormLabel = forwardRef(
|
|
410
|
+
function FormLabel2({ as: Component = "label", className, ...props }, ref) {
|
|
411
|
+
return /* @__PURE__ */ jsx(
|
|
412
|
+
Component,
|
|
413
|
+
{
|
|
414
|
+
className: cn(FORM_LABEL_CLASS, className),
|
|
415
|
+
ref,
|
|
416
|
+
...props
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
const FORM_BODY_TEXT_CLASS = "m-0 text-body-medium text-on-surface";
|
|
422
|
+
const FORM_SUPPORTING_TEXT_CLASS = "m-0 text-body-small text-on-surface-variant";
|
|
423
|
+
const FormDescription = forwardRef(
|
|
424
|
+
function FormDescription2({ as: Component = "p", className, variant = "supporting", ...props }, ref) {
|
|
425
|
+
return /* @__PURE__ */ jsx(
|
|
426
|
+
Component,
|
|
427
|
+
{
|
|
428
|
+
className: cn(
|
|
429
|
+
variant === "body" ? FORM_BODY_TEXT_CLASS : FORM_SUPPORTING_TEXT_CLASS,
|
|
430
|
+
className
|
|
431
|
+
),
|
|
432
|
+
ref,
|
|
433
|
+
...props
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
const FormHelperText = forwardRef(
|
|
439
|
+
function FormHelperText2({ as: Component = "p", className, ...props }, ref) {
|
|
440
|
+
return /* @__PURE__ */ jsx(
|
|
441
|
+
Component,
|
|
442
|
+
{
|
|
443
|
+
className: cn(FORM_SUPPORTING_TEXT_CLASS, className),
|
|
444
|
+
ref,
|
|
445
|
+
...props
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
const FormError = forwardRef(
|
|
451
|
+
function FormError2({ as: Component = "p", className, role = "alert", ...props }, ref) {
|
|
452
|
+
return /* @__PURE__ */ jsx(
|
|
453
|
+
Component,
|
|
454
|
+
{
|
|
455
|
+
className: cn(
|
|
456
|
+
"m-0 text-body-small font-medium text-on-error-container",
|
|
457
|
+
className
|
|
458
|
+
),
|
|
459
|
+
ref,
|
|
460
|
+
role,
|
|
461
|
+
...props
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
const FormWarning = forwardRef(
|
|
467
|
+
function FormWarning2({ as: Component = "p", className, role, ...props }, ref) {
|
|
468
|
+
return /* @__PURE__ */ jsx(
|
|
469
|
+
Component,
|
|
470
|
+
{
|
|
471
|
+
className: cn(
|
|
472
|
+
"m-0 text-body-small font-medium text-on-warning-container",
|
|
473
|
+
className
|
|
474
|
+
),
|
|
475
|
+
ref,
|
|
476
|
+
role,
|
|
477
|
+
...props
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
const FormSuccess = forwardRef(
|
|
483
|
+
function FormSuccess2({ as: Component = "p", className, role = "status", ...props }, ref) {
|
|
484
|
+
return /* @__PURE__ */ jsx(
|
|
485
|
+
Component,
|
|
486
|
+
{
|
|
487
|
+
className: cn(
|
|
488
|
+
"m-0 text-body-small font-medium text-on-success-container",
|
|
489
|
+
className
|
|
490
|
+
),
|
|
491
|
+
ref,
|
|
492
|
+
role,
|
|
493
|
+
...props
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
const FormFieldGroup = forwardRef(
|
|
499
|
+
function FormFieldGroup2({ className, ...props }, ref) {
|
|
500
|
+
return /* @__PURE__ */ jsx(
|
|
501
|
+
"fieldset",
|
|
502
|
+
{
|
|
503
|
+
className: cn("m-0 space-y-2 border-0 p-0", className),
|
|
504
|
+
ref,
|
|
505
|
+
...props
|
|
506
|
+
}
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
);
|
|
510
|
+
const FormFieldGroupLabel = forwardRef(function FormFieldGroupLabel2({ className, ...props }, ref) {
|
|
511
|
+
return /* @__PURE__ */ jsx("legend", { className: cn(FORM_LABEL_CLASS, "px-0", className), ref, ...props });
|
|
512
|
+
});
|
|
513
|
+
export {
|
|
514
|
+
ENUM_SELECT_EMPTY_VALUE as E,
|
|
515
|
+
FormDescription as F,
|
|
516
|
+
NativeSelect as N,
|
|
517
|
+
OptionalEnumSelect as O,
|
|
518
|
+
PackageCheckbox as P,
|
|
519
|
+
ResetEnumSelect as R,
|
|
520
|
+
SELECT_EMPTY_STATE_VALUE as S,
|
|
521
|
+
EnumSelect as a,
|
|
522
|
+
FormError as b,
|
|
523
|
+
FormField as c,
|
|
524
|
+
FormFieldGroup as d,
|
|
525
|
+
FormFieldGroupLabel as e,
|
|
526
|
+
FormHelperText as f,
|
|
527
|
+
FormLabel as g,
|
|
528
|
+
FormSuccess as h,
|
|
529
|
+
FormWarning as i,
|
|
530
|
+
PackageFileInput as j,
|
|
531
|
+
PackageInput as k,
|
|
532
|
+
PackageTextarea as l,
|
|
533
|
+
Select as m,
|
|
534
|
+
SelectContent as n,
|
|
535
|
+
SelectEmpty as o,
|
|
536
|
+
SelectField as p,
|
|
537
|
+
SelectGroup as q,
|
|
538
|
+
SelectItem as r,
|
|
539
|
+
SelectLabel as s,
|
|
540
|
+
SelectSeparator as t,
|
|
541
|
+
SelectTrigger as u,
|
|
542
|
+
SelectValue as v,
|
|
543
|
+
buildFormFieldAriaDescribedBy as w,
|
|
544
|
+
inputVariants as x,
|
|
545
|
+
textareaVariants as y
|
|
546
|
+
};
|