@arcfusionz/arc-primitive-ui 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AILoader/AILoader.d.ts +32 -0
- package/dist/components/AILoader/AILoader.js +157 -0
- package/dist/components/AILoader/index.d.ts +2 -0
- package/dist/components/AILoader/index.js +2 -0
- package/dist/components/Accordion/Accordion.d.ts +96 -0
- package/dist/components/Accordion/Accordion.js +149 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +152 -0
- package/dist/components/Avatar/Avatar.js +216 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +87 -0
- package/dist/components/Badge/Badge.js +118 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +109 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +182 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/index.js +2 -0
- package/dist/components/Button/Button.d.ts +57 -0
- package/dist/components/Button/Button.js +177 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Calendar/Calendar.d.ts +140 -0
- package/dist/components/Calendar/Calendar.js +468 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +60 -0
- package/dist/components/Checkbox/Checkbox.js +129 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +251 -0
- package/dist/components/Combobox/Combobox.js +354 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +129 -0
- package/dist/components/ContextMenu/ContextMenu.js +93 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +109 -0
- package/dist/components/DatePicker/DatePicker.js +145 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +107 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +161 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/DateRangePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +112 -0
- package/dist/components/Dialog/Dialog.js +141 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Drawer/Drawer.d.ts +188 -0
- package/dist/components/Drawer/Drawer.js +268 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +2 -0
- package/dist/components/Field/Field.d.ts +123 -0
- package/dist/components/Field/Field.js +241 -0
- package/dist/components/Field/FieldContext.d.ts +43 -0
- package/dist/components/Field/FieldContext.js +28 -0
- package/dist/components/Field/index.d.ts +3 -0
- package/dist/components/Field/index.js +3 -0
- package/dist/components/Fieldset/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset/Fieldset.js +48 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Fieldset/index.js +2 -0
- package/dist/components/Form/Form.d.ts +54 -0
- package/dist/components/Form/Form.js +57 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/Input/Input.d.ts +64 -0
- package/dist/components/Input/Input.js +111 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +212 -0
- package/dist/components/Menu/Menu.js +255 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +122 -0
- package/dist/components/Popover/Popover.js +116 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Progress/Progress.d.ts +87 -0
- package/dist/components/Progress/Progress.js +73 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Radio/Radio.d.ts +65 -0
- package/dist/components/Radio/Radio.js +93 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Select/Select.d.ts +136 -0
- package/dist/components/Select/Select.js +219 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +39 -0
- package/dist/components/Skeleton/Skeleton.js +44 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Stepper/Stepper.d.ts +161 -0
- package/dist/components/Stepper/Stepper.js +344 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +56 -0
- package/dist/components/Switch/Switch.js +87 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +116 -0
- package/dist/components/Table/Table.js +143 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +116 -0
- package/dist/components/Tabs/Tabs.js +158 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Timeline/Timeline.d.ts +137 -0
- package/dist/components/Timeline/Timeline.js +243 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +135 -0
- package/dist/components/Toast/Toast.js +314 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +104 -0
- package/dist/components/Tooltip/Tooltip.js +95 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +38 -0
- package/dist/components/Typography/Typography.js +53 -0
- package/dist/components/Typography/index.d.ts +2 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/index.d.ts +66 -3398
- package/dist/index.js +34 -5343
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.js +9 -0
- package/package.json +6 -2
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Select } from "@base-ui/react/select";
|
|
5
|
+
//#region src/components/Select/Select.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Groups the select parts and owns value + popup state. This is Base UI's
|
|
8
|
+
* `Select.Root` re-exported unchanged, so every root feature is available:
|
|
9
|
+
* `value`/`defaultValue`/`onValueChange(value, details)`, `multiple`,
|
|
10
|
+
* `items` (lets `SelectValue` display labels instead of raw values),
|
|
11
|
+
* `name`/`required`/`disabled`/`readOnly` form wiring, and object values via
|
|
12
|
+
* `isItemEqualToValue`/`itemToStringLabel`/`itemToStringValue`.
|
|
13
|
+
*/
|
|
14
|
+
const Select$1 = Select.Root;
|
|
15
|
+
function ChevronDownIcon(props) {
|
|
16
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "none",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
strokeWidth: 2,
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round",
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
...props,
|
|
25
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function ChevronUpIcon(props) {
|
|
29
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
30
|
+
viewBox: "0 0 24 24",
|
|
31
|
+
fill: "none",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
strokeWidth: 2,
|
|
34
|
+
strokeLinecap: "round",
|
|
35
|
+
strokeLinejoin: "round",
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
...props,
|
|
38
|
+
children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" })
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function CheckIcon(props) {
|
|
42
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
fill: "none",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeWidth: 2,
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
...props,
|
|
51
|
+
children: /* @__PURE__ */ jsx("path", { d: "m5 13 4 4L19 7" })
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Visible label for the select — Base UI associates it with the trigger
|
|
56
|
+
* automatically, and clicking it focuses the trigger without opening the
|
|
57
|
+
* popup. Renders a `<div>`. When no visible label is rendered, give the
|
|
58
|
+
* trigger an accessible name with `aria-label` instead.
|
|
59
|
+
*/
|
|
60
|
+
const SelectLabel = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Select.Label, {
|
|
61
|
+
ref,
|
|
62
|
+
className: cn("cursor-default font-sans text-sm font-medium text-foreground", className),
|
|
63
|
+
...rest
|
|
64
|
+
}));
|
|
65
|
+
SelectLabel.displayName = "SelectLabel";
|
|
66
|
+
const triggerBaseClasses = "inline-flex cursor-pointer items-center justify-between gap-2 rounded-md whitespace-nowrap select-none font-sans text-foreground transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring data-readonly:cursor-default data-invalid:border-destructive data-invalid:focus-visible:outline-destructive aria-invalid:border-destructive aria-invalid:focus-visible:outline-destructive disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
67
|
+
const triggerVariantClasses = {
|
|
68
|
+
outline: "border border-border bg-background hover:bg-primary-50 data-popup-open:bg-primary-50",
|
|
69
|
+
ghost: "border border-transparent bg-transparent hover:bg-primary-50 data-popup-open:bg-primary-50"
|
|
70
|
+
};
|
|
71
|
+
const triggerSizeClasses = {
|
|
72
|
+
sm: "h-8 px-2.5 text-sm",
|
|
73
|
+
md: "h-10 px-3 text-sm",
|
|
74
|
+
lg: "h-12 px-4 text-base [&_svg:not([class*='size-'])]:size-5"
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Class list for an element styled as the select trigger — for select-shaped
|
|
78
|
+
* controls that don't come from Base UI (custom comboboxes, fake dropdowns
|
|
79
|
+
* in previews) so every value-picker in the product shares one look.
|
|
80
|
+
*/
|
|
81
|
+
function selectTriggerVariants({ variant = "outline", size = "md", fullWidth = false, className } = {}) {
|
|
82
|
+
return cn(triggerBaseClasses, triggerVariantClasses[variant], triggerSizeClasses[size], fullWidth && "w-full", className);
|
|
83
|
+
}
|
|
84
|
+
function mergeAnchorWidth(anchorWidth, style) {
|
|
85
|
+
if (anchorWidth == null) return style;
|
|
86
|
+
const anchorStyle = { width: anchorWidth };
|
|
87
|
+
return typeof style === "function" ? (state) => ({
|
|
88
|
+
...anchorStyle,
|
|
89
|
+
...style(state)
|
|
90
|
+
}) : {
|
|
91
|
+
...anchorStyle,
|
|
92
|
+
...style ?? {}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The button that shows the current value and opens the popup. Place a
|
|
97
|
+
* `SelectValue` inside it and the dropdown chevron is appended
|
|
98
|
+
* automatically. The trigger's accessible name comes from a sibling
|
|
99
|
+
* `SelectLabel` (or a composed `Field.Label`); without one, pass
|
|
100
|
+
* `aria-label`.
|
|
101
|
+
*/
|
|
102
|
+
const SelectTrigger = forwardRef(({ variant = "outline", size = "md", fullWidth = false, anchorWidth, icon, style, className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Select.Trigger, {
|
|
103
|
+
ref,
|
|
104
|
+
className: cn(selectTriggerVariants({
|
|
105
|
+
variant,
|
|
106
|
+
size,
|
|
107
|
+
fullWidth
|
|
108
|
+
}), className),
|
|
109
|
+
style: mergeAnchorWidth(anchorWidth, style),
|
|
110
|
+
...rest,
|
|
111
|
+
children: [children, /* @__PURE__ */ jsx(Select.Icon, {
|
|
112
|
+
"aria-hidden": "true",
|
|
113
|
+
className: "flex text-muted-foreground",
|
|
114
|
+
children: icon ?? /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
115
|
+
})]
|
|
116
|
+
}));
|
|
117
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
118
|
+
/**
|
|
119
|
+
* The selected value's text inside the trigger. Set `placeholder` for the
|
|
120
|
+
* empty state (rendered muted). With `items` on the root it shows the
|
|
121
|
+
* matching label instead of the raw value; pass a function as `children`
|
|
122
|
+
* to format the value yourself — the multi-select "+N more" pattern lives
|
|
123
|
+
* there.
|
|
124
|
+
*/
|
|
125
|
+
const SelectValue = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Select.Value, {
|
|
126
|
+
ref,
|
|
127
|
+
className: cn("min-w-0 truncate text-primary data-placeholder:text-muted-foreground", className),
|
|
128
|
+
...rest
|
|
129
|
+
}));
|
|
130
|
+
SelectValue.displayName = "SelectValue";
|
|
131
|
+
const popupSurfaceClasses = "relative overflow-clip rounded-md border border-border bg-background font-sans text-sm text-foreground shadow-md outline-none";
|
|
132
|
+
const popupBehaviorClasses = "flex max-h-[min(var(--select-max-height,9999px),var(--available-height))] flex-col min-w-[var(--anchor-width)] max-w-[var(--available-width)] origin-[var(--transform-origin)] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
133
|
+
const listClasses = "min-h-0 scroll-py-6 overflow-y-auto p-1";
|
|
134
|
+
const scrollArrowBaseClasses = "z-[1] flex h-6 w-full cursor-default items-center justify-center bg-background text-muted-foreground";
|
|
135
|
+
const scrollUpArrowClasses = cn(scrollArrowBaseClasses, "top-0");
|
|
136
|
+
const scrollDownArrowClasses = cn(scrollArrowBaseClasses, "bottom-0");
|
|
137
|
+
/**
|
|
138
|
+
* The floating option list, with the portal, positioning, list, and
|
|
139
|
+
* hover-scroll arrow plumbing folded in. Always drops below the trigger and
|
|
140
|
+
* flips above it only when the space below runs out — never sideways. Long
|
|
141
|
+
* lists scroll inside the popup, up to `maxHeight`.
|
|
142
|
+
*/
|
|
143
|
+
const SelectPopup = forwardRef(({ align = "center", sideOffset = 4, alignOffset = 0, collisionPadding, maxHeight, container, className, children, ...rest }, ref) => /* @__PURE__ */ jsx(Select.Portal, {
|
|
144
|
+
container,
|
|
145
|
+
children: /* @__PURE__ */ jsx(Select.Positioner, {
|
|
146
|
+
side: "bottom",
|
|
147
|
+
align,
|
|
148
|
+
sideOffset,
|
|
149
|
+
alignOffset,
|
|
150
|
+
collisionPadding,
|
|
151
|
+
alignItemWithTrigger: false,
|
|
152
|
+
collisionAvoidance: {
|
|
153
|
+
side: "flip",
|
|
154
|
+
fallbackAxisSide: "none"
|
|
155
|
+
},
|
|
156
|
+
className: "z-50 select-none",
|
|
157
|
+
style: maxHeight != null ? { "--select-max-height": typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight } : void 0,
|
|
158
|
+
children: /* @__PURE__ */ jsxs(Select.Popup, {
|
|
159
|
+
ref,
|
|
160
|
+
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
161
|
+
...rest,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsx(Select.ScrollUpArrow, {
|
|
164
|
+
className: scrollUpArrowClasses,
|
|
165
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsx(Select.List, {
|
|
168
|
+
className: listClasses,
|
|
169
|
+
children
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsx(Select.ScrollDownArrow, {
|
|
172
|
+
className: scrollDownArrowClasses,
|
|
173
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
}));
|
|
179
|
+
SelectPopup.displayName = "SelectPopup";
|
|
180
|
+
const itemClasses = "relative flex cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 font-sans text-sm text-foreground outline-none select-none scroll-my-1 data-highlighted:bg-primary-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
181
|
+
/**
|
|
182
|
+
* One option in the popup. Children render as the option's label (wrapped in
|
|
183
|
+
* Base UI's `ItemText`); a check mark appears at the item's right edge while
|
|
184
|
+
* selected. Set `label` when children aren't plain text so keyboard
|
|
185
|
+
* typeahead has something to match, and `disabled` for unavailable options.
|
|
186
|
+
*/
|
|
187
|
+
const SelectItem = forwardRef(({ className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Select.Item, {
|
|
188
|
+
ref,
|
|
189
|
+
className: cn(itemClasses, className),
|
|
190
|
+
...rest,
|
|
191
|
+
children: [/* @__PURE__ */ jsx(Select.ItemText, { children }), /* @__PURE__ */ jsx(Select.ItemIndicator, {
|
|
192
|
+
className: "absolute right-2 flex size-4 items-center justify-center text-primary",
|
|
193
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
194
|
+
})]
|
|
195
|
+
}));
|
|
196
|
+
SelectItem.displayName = "SelectItem";
|
|
197
|
+
/** Groups related options under a `SelectGroupLabel`, announced together by assistive technology. */
|
|
198
|
+
const SelectGroup = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Select.Group, {
|
|
199
|
+
ref,
|
|
200
|
+
className,
|
|
201
|
+
...rest
|
|
202
|
+
}));
|
|
203
|
+
SelectGroup.displayName = "SelectGroup";
|
|
204
|
+
/** Heading for a `SelectGroup` — visually a meta caption, wired to the group via `aria-labelledby`. */
|
|
205
|
+
const SelectGroupLabel = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Select.GroupLabel, {
|
|
206
|
+
ref,
|
|
207
|
+
className: cn("px-2 py-1.5 font-sans text-xs font-medium text-muted-foreground", className),
|
|
208
|
+
...rest
|
|
209
|
+
}));
|
|
210
|
+
SelectGroupLabel.displayName = "SelectGroupLabel";
|
|
211
|
+
/** Divider between option groups, exposed to screen readers as a separator. */
|
|
212
|
+
const SelectSeparator = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Select.Separator, {
|
|
213
|
+
ref,
|
|
214
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
215
|
+
...rest
|
|
216
|
+
}));
|
|
217
|
+
SelectSeparator.displayName = "SelectSeparator";
|
|
218
|
+
//#endregion
|
|
219
|
+
export { Select$1 as Select, SelectGroup, SelectGroupLabel, SelectItem, SelectLabel, SelectPopup, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Select, SelectAlign, SelectGroup, SelectGroupLabel, SelectGroupLabelProps, SelectGroupProps, SelectItem, SelectItemProps, SelectLabel, SelectLabelProps, SelectPopup, SelectPopupProps, SelectProps, SelectSeparator, SelectSeparatorProps, SelectTrigger, SelectTriggerProps, SelectTriggerSize, SelectTriggerVariant, SelectTriggerVariantsOptions, SelectValue, SelectValueProps, selectTriggerVariants } from "./Select.js";
|
|
2
|
+
export { Select, type SelectAlign, SelectGroup, SelectGroupLabel, type SelectGroupLabelProps, type SelectGroupProps, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, SelectPopup, type SelectPopupProps, type SelectProps, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, type SelectTriggerSize, type SelectTriggerVariant, type SelectTriggerVariantsOptions, SelectValue, type SelectValueProps, selectTriggerVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Select, SelectGroup, SelectGroupLabel, SelectItem, SelectLabel, SelectPopup, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants } from "./Select.js";
|
|
2
|
+
export { Select, SelectGroup, SelectGroupLabel, SelectItem, SelectLabel, SelectPopup, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
//#region src/components/Skeleton/Skeleton.d.ts
|
|
4
|
+
type SkeletonVariant = "text" | "circular" | "rectangular" | "rounded";
|
|
5
|
+
type SkeletonAnimation = "pulse" | "wave" | "none";
|
|
6
|
+
interface SkeletonRenderState extends Record<string, unknown> {
|
|
7
|
+
/** Whether the placeholder is currently concealing its content. */
|
|
8
|
+
loading: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface SkeletonVariantsOptions {
|
|
11
|
+
/** Shape recipe for text, avatars, sharp media, or rounded surfaces. */
|
|
12
|
+
variant?: SkeletonVariant;
|
|
13
|
+
/** Indeterminate motion. All animation stops when reduced motion is requested. */
|
|
14
|
+
animation?: SkeletonAnimation;
|
|
15
|
+
/** Apply placeholder appearance; `false` keeps only the structural wrapper classes. */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** Additional classes merged after the Skeleton recipe. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Class list for an element styled as a Skeleton placeholder. */
|
|
21
|
+
declare function skeletonVariants({ variant, animation, loading, className }?: SkeletonVariantsOptions): string;
|
|
22
|
+
interface SkeletonBaseProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "className"> {
|
|
23
|
+
/** Shape of the placeholder. `text` has a usable 16px minimum height and fills its container; other shapes infer dimensions from children or `className`/`style`. */
|
|
24
|
+
variant?: SkeletonVariant;
|
|
25
|
+
/** `pulse` is the calm default, `wave` adds directional progress, and `none` is static. Motion is disabled automatically for `prefers-reduced-motion`. */
|
|
26
|
+
animation?: SkeletonAnimation;
|
|
27
|
+
/** Show the placeholder and make wrapped content inert. Set to `false` to reveal the content without replacing the host element. */
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
/** Optional content whose dimensions the placeholder should preserve. Interactive descendants cannot be focused or activated while loading. */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
/** Replace the rendered `div` or inspect `{ loading }` in a render callback. */
|
|
32
|
+
render?: useRender.RenderProp<SkeletonRenderState>;
|
|
33
|
+
/** Additional classes for dimensions, layout, or a context-specific semantic background. */
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
type SkeletonProps = SkeletonBaseProps;
|
|
37
|
+
declare const Skeleton: import("react").ForwardRefExoticComponent<SkeletonBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { Skeleton, SkeletonAnimation, SkeletonProps, SkeletonRenderState, SkeletonVariant, SkeletonVariantsOptions, skeletonVariants };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { forwardRef, version } from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/Skeleton/Skeleton.tsx
|
|
5
|
+
const rootClasses = "relative inline-block align-middle";
|
|
6
|
+
const loadingClasses = "overflow-hidden bg-muted text-transparent select-none [&>*]:invisible";
|
|
7
|
+
const variantClasses = {
|
|
8
|
+
text: "min-h-4 w-full rounded-md",
|
|
9
|
+
circular: "aspect-square rounded-full",
|
|
10
|
+
rectangular: "rounded-none",
|
|
11
|
+
rounded: "rounded-md"
|
|
12
|
+
};
|
|
13
|
+
const animationClasses = {
|
|
14
|
+
pulse: "motion-safe:animate-pulse",
|
|
15
|
+
wave: "before:pointer-events-none before:absolute before:inset-0 before:-translate-x-full before:bg-[linear-gradient(90deg,transparent,var(--color-surface),transparent)] before:content-[''] motion-safe:before:animate-skeleton-wave motion-safe:before:will-change-transform",
|
|
16
|
+
none: ""
|
|
17
|
+
};
|
|
18
|
+
const supportsBooleanInert = Number.parseInt(version, 10) >= 19;
|
|
19
|
+
/** Class list for an element styled as a Skeleton placeholder. */
|
|
20
|
+
function skeletonVariants({ variant = "text", animation = "pulse", loading = true, className } = {}) {
|
|
21
|
+
return cn(rootClasses, loading && loadingClasses, loading && variantClasses[variant], loading && animationClasses[animation], className);
|
|
22
|
+
}
|
|
23
|
+
const Skeleton = forwardRef(({ variant = "text", animation = "pulse", loading = true, render, className, ...rest }, ref) => {
|
|
24
|
+
return useRender({
|
|
25
|
+
defaultTagName: "div",
|
|
26
|
+
render,
|
|
27
|
+
ref,
|
|
28
|
+
state: { loading },
|
|
29
|
+
props: {
|
|
30
|
+
"aria-hidden": loading || void 0,
|
|
31
|
+
inert: loading ? supportsBooleanInert ? true : "true" : void 0,
|
|
32
|
+
className: skeletonVariants({
|
|
33
|
+
variant,
|
|
34
|
+
animation,
|
|
35
|
+
loading,
|
|
36
|
+
className
|
|
37
|
+
}),
|
|
38
|
+
...rest
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
Skeleton.displayName = "Skeleton";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Skeleton, skeletonVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Skeleton, SkeletonAnimation, SkeletonProps, SkeletonRenderState, SkeletonVariant, SkeletonVariantsOptions, skeletonVariants } from "./Skeleton.js";
|
|
2
|
+
export { Skeleton, type SkeletonAnimation, type SkeletonProps, type SkeletonRenderState, type SkeletonVariant, type SkeletonVariantsOptions, skeletonVariants };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEvent, ReactNode } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
//#region src/components/Stepper/Stepper.d.ts
|
|
4
|
+
type StepperOrientation = "horizontal" | "vertical";
|
|
5
|
+
type StepperSize = "sm" | "md" | "lg";
|
|
6
|
+
interface StepperTriggerVariantsOptions {
|
|
7
|
+
size?: StepperSize;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Class list for an element laid out and focus-styled as a StepperTrigger.
|
|
12
|
+
*
|
|
13
|
+
* Use it when a foreign interactive element must sit in a step's place — e.g.
|
|
14
|
+
* a router link that re-enters a completed step:
|
|
15
|
+
*
|
|
16
|
+
* <a href="/checkout/plan" className={stepperTriggerVariants()}>
|
|
17
|
+
* <StepperIndicator />
|
|
18
|
+
* <StepperTitle>Choose plan</StepperTitle>
|
|
19
|
+
* </a>
|
|
20
|
+
*/
|
|
21
|
+
declare function stepperTriggerVariants({ size, className }?: StepperTriggerVariantsOptions): string;
|
|
22
|
+
interface StepperProps extends Omit<ComponentPropsWithoutRef<"ol">, "className"> {
|
|
23
|
+
/**
|
|
24
|
+
* Zero-based index of the current step. Steps before it read as completed,
|
|
25
|
+
* steps after it as upcoming (per-item `completed` overrides). Set it to
|
|
26
|
+
* the step count once the flow finishes so every step reads completed.
|
|
27
|
+
* The stepper holds no internal state — the surrounding flow owns the step.
|
|
28
|
+
*/
|
|
29
|
+
value?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Called with a step's index when its `StepperTrigger` is activated.
|
|
32
|
+
* Update `value` from it (gate the update to keep a step unreachable).
|
|
33
|
+
* Without triggers the stepper is a static indicator and this never fires.
|
|
34
|
+
*/
|
|
35
|
+
onValueChange?: (value: number, event: MouseEvent<HTMLButtonElement>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Enforce sequential order (the NN/g wizard default): triggers on steps
|
|
38
|
+
* after the current one are blocked, while completed steps stay
|
|
39
|
+
* revisitable. Blocked steps keep the upcoming look — only the explicit
|
|
40
|
+
* `disabled` prop fades a step. Set `false` for free navigation.
|
|
41
|
+
*/
|
|
42
|
+
linear?: boolean;
|
|
43
|
+
/** Layout axis. Vertical suits long labels, descriptions, and inline step content. */
|
|
44
|
+
orientation?: StepperOrientation;
|
|
45
|
+
/**
|
|
46
|
+
* Indicator diameter: `sm` 24px · `md` 32px · `lg` 40px. `sm` sits exactly
|
|
47
|
+
* on the WCAG 2.5.8 24px target-size floor — with triggers, the label
|
|
48
|
+
* extends the target, but prefer `md`+ for touch-first surfaces.
|
|
49
|
+
*/
|
|
50
|
+
size?: StepperSize;
|
|
51
|
+
/** Visually-hidden status appended to completed steps (USWDS wording). Localize it with the page. */
|
|
52
|
+
completedLabel?: string;
|
|
53
|
+
/** Visually-hidden status appended to upcoming steps. Localize it with the page. */
|
|
54
|
+
incompleteLabel?: string;
|
|
55
|
+
/** Visually-hidden status appended to invalid steps. Localize it with the page. */
|
|
56
|
+
invalidLabel?: string;
|
|
57
|
+
/** Replace the rendered `ol`. Preserve list semantics — they give screen-reader users the "step 2 of 4" position for free. */
|
|
58
|
+
render?: useRender.RenderProp;
|
|
59
|
+
/** Additional classes merged after the root recipe, e.g. `max-w-md`. */
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Progress through a multi-step flow, marked up as an ordered list with
|
|
64
|
+
* `aria-current="step"` on the current step and visually-hidden state text on
|
|
65
|
+
* the others. It defaults to `aria-label="Progress"`; pass a localized
|
|
66
|
+
* `aria-label` (or `aria-labelledby`) when the page language isn't English.
|
|
67
|
+
*/
|
|
68
|
+
declare const Stepper: import("react").ForwardRefExoticComponent<StepperProps & import("react").RefAttributes<HTMLOListElement>>;
|
|
69
|
+
interface StepperItemProps extends Omit<ComponentPropsWithoutRef<"li">, "className"> {
|
|
70
|
+
/** Zero-based position of this step. Drives the derived state and the number the indicator shows. */
|
|
71
|
+
index: number;
|
|
72
|
+
/**
|
|
73
|
+
* Override the derived completed state — e.g. mark a skipped optional step
|
|
74
|
+
* incomplete with `completed={false}`, or a finished later step in a free
|
|
75
|
+
* flow with `completed`. Omit to derive from the stepper's `value`.
|
|
76
|
+
*/
|
|
77
|
+
completed?: boolean;
|
|
78
|
+
/** Fade the step and block its trigger. For sequence-enforcement leave it to `linear` instead, which blocks without fading. */
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
/** Mark the step as failed: destructive styling, an error glyph, and the `invalidLabel` status for screen readers. */
|
|
81
|
+
invalid?: boolean;
|
|
82
|
+
/** Replace the rendered `li`. Preserve list-item semantics. */
|
|
83
|
+
render?: useRender.RenderProp;
|
|
84
|
+
/** Additional classes merged after the item recipe. */
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* One step in the flow. When it holds no `StepperTrigger` the item itself
|
|
89
|
+
* carries `aria-current="step"` (the USWDS static-indicator pattern); with a
|
|
90
|
+
* trigger, the trigger takes over so keyboard focus announces the state.
|
|
91
|
+
*/
|
|
92
|
+
declare const StepperItem: import("react").ForwardRefExoticComponent<StepperItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
93
|
+
interface StepperTriggerProps extends Omit<ComponentPropsWithoutRef<"button">, "className"> {
|
|
94
|
+
/** Replace the rendered `button`, e.g. `render={<a href="…" />}` when steps are routed pages. Keep it interactive — static steps simply omit the trigger. */
|
|
95
|
+
render?: useRender.RenderProp;
|
|
96
|
+
/** Additional classes merged after the trigger recipe. */
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Makes a step navigable: activating it calls the stepper's `onValueChange`
|
|
101
|
+
* with this step's index. Under `linear` (the default) upcoming steps are
|
|
102
|
+
* blocked automatically; completed steps stay revisitable, which is the
|
|
103
|
+
* universal wizard convention. Carries `aria-current="step"` on the current
|
|
104
|
+
* step so the state is announced on focus, not only while browsing the list.
|
|
105
|
+
*/
|
|
106
|
+
declare const StepperTrigger: import("react").ForwardRefExoticComponent<StepperTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
107
|
+
interface StepperIndicatorProps extends Omit<ComponentPropsWithoutRef<"span">, "className" | "children"> {
|
|
108
|
+
/**
|
|
109
|
+
* Custom glyph — an icon, a spinner, a letter. It replaces the default
|
|
110
|
+
* number/check/error glyph in every state (state still shows through the
|
|
111
|
+
* fill colors and the visually-hidden status text). Mark decorative glyphs
|
|
112
|
+
* `aria-hidden` yourself; the defaults already are.
|
|
113
|
+
*/
|
|
114
|
+
children?: ReactNode;
|
|
115
|
+
/** Replace the rendered `span`. */
|
|
116
|
+
render?: useRender.RenderProp;
|
|
117
|
+
/** Additional classes merged after the indicator recipe, e.g. `size-3` with an empty fragment as children for a dots-only stepper. */
|
|
118
|
+
className?: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The step's circular marker: the step number, a check once completed, an
|
|
122
|
+
* error glyph when invalid. Numbers and glyphs are decorative — the
|
|
123
|
+
* visually-hidden status text rendered alongside them (`completedLabel` /
|
|
124
|
+
* `incompleteLabel` / `invalidLabel`) plus the list position carry the state
|
|
125
|
+
* for screen readers, following the USWDS step indicator.
|
|
126
|
+
*/
|
|
127
|
+
declare const StepperIndicator: import("react").ForwardRefExoticComponent<StepperIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
128
|
+
interface StepperTitleProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
129
|
+
/** Replace the rendered `span`. */
|
|
130
|
+
render?: useRender.RenderProp;
|
|
131
|
+
/** Additional classes merged after the title recipe, e.g. `sr-only` to keep labels for assistive technology in a compact stepper. */
|
|
132
|
+
className?: string;
|
|
133
|
+
}
|
|
134
|
+
/** The step's label. Carbon guidance: keep it to one or two words. */
|
|
135
|
+
declare const StepperTitle: import("react").ForwardRefExoticComponent<StepperTitleProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
136
|
+
interface StepperDescriptionProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
137
|
+
/** Replace the rendered `span`. */
|
|
138
|
+
render?: useRender.RenderProp;
|
|
139
|
+
/** Additional classes merged after the description recipe. */
|
|
140
|
+
className?: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Secondary line under the title: helper copy, or the "Optional" marker the
|
|
144
|
+
* W3C multi-page-forms guidance asks for on skippable steps.
|
|
145
|
+
*/
|
|
146
|
+
declare const StepperDescription: import("react").ForwardRefExoticComponent<StepperDescriptionProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
147
|
+
interface StepperSeparatorProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
148
|
+
/** Replace the rendered `span`. Keep it hidden from assistive technology — connectors are purely visual. */
|
|
149
|
+
render?: useRender.RenderProp;
|
|
150
|
+
/** Additional classes merged after the separator recipe. */
|
|
151
|
+
className?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Connector after a step (omit it on the last item). It fills toward the
|
|
155
|
+
* next step horizontally and hangs below the indicator vertically — where it
|
|
156
|
+
* tracks the item's height, so inline step content stretches it. The line
|
|
157
|
+
* turns primary once its step completes.
|
|
158
|
+
*/
|
|
159
|
+
declare const StepperSeparator: import("react").ForwardRefExoticComponent<StepperSeparatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
160
|
+
//#endregion
|
|
161
|
+
export { Stepper, StepperDescription, StepperDescriptionProps, StepperIndicator, StepperIndicatorProps, StepperItem, StepperItemProps, StepperOrientation, StepperProps, StepperSeparator, StepperSeparatorProps, StepperSize, StepperTitle, StepperTitleProps, StepperTrigger, StepperTriggerProps, StepperTriggerVariantsOptions, stepperTriggerVariants };
|