@flatwork-ui/react 0.0.0-stage → 0.1.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/index.cjs ADDED
@@ -0,0 +1,1261 @@
1
+ "use client";
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ Accordion: () => Accordion,
25
+ AccordionItem: () => AccordionItem,
26
+ Affix: () => Affix,
27
+ Alert: () => Alert,
28
+ Avatar: () => Avatar,
29
+ AvatarGroup: () => AvatarGroup,
30
+ Badge: () => Badge,
31
+ Brand: () => Brand,
32
+ Breadcrumb: () => Breadcrumb,
33
+ Button: () => Button,
34
+ ButtonGroup: () => ButtonGroup,
35
+ ButtonLink: () => ButtonLink,
36
+ Card: () => Card,
37
+ CardBody: () => CardBody,
38
+ CardFooter: () => CardFooter,
39
+ CardHeader: () => CardHeader,
40
+ Checkbox: () => Checkbox,
41
+ CodeBlock: () => CodeBlock,
42
+ CommandPalette: () => CommandPalette,
43
+ DescriptionList: () => DescriptionList,
44
+ Dialog: () => Dialog,
45
+ Divider: () => Divider,
46
+ Drawer: () => Drawer,
47
+ DropdownMenu: () => DropdownMenu,
48
+ Dropzone: () => Dropzone,
49
+ EmptyState: () => EmptyState,
50
+ Field: () => Field,
51
+ Fieldset: () => Fieldset,
52
+ FlatworkRoot: () => FlatworkRoot,
53
+ IconArrowRight: () => IconArrowRight,
54
+ IconBell: () => IconBell,
55
+ IconChart: () => IconChart,
56
+ IconCheck: () => IconCheck,
57
+ IconCheckCircle: () => IconCheckCircle,
58
+ IconChevronDown: () => IconChevronDown,
59
+ IconChevronLeft: () => IconChevronLeft,
60
+ IconChevronRight: () => IconChevronRight,
61
+ IconChevronUp: () => IconChevronUp,
62
+ IconCopy: () => IconCopy,
63
+ IconDownload: () => IconDownload,
64
+ IconError: () => IconError,
65
+ IconEye: () => IconEye,
66
+ IconFolder: () => IconFolder,
67
+ IconGrid: () => IconGrid,
68
+ IconHome: () => IconHome,
69
+ IconInfo: () => IconInfo,
70
+ IconList: () => IconList,
71
+ IconLock: () => IconLock,
72
+ IconMore: () => IconMore,
73
+ IconPencil: () => IconPencil,
74
+ IconPlus: () => IconPlus,
75
+ IconSearch: () => IconSearch,
76
+ IconSettings: () => IconSettings,
77
+ IconTrash: () => IconTrash,
78
+ IconUpload: () => IconUpload,
79
+ IconUser: () => IconUser,
80
+ IconWarning: () => IconWarning,
81
+ IconX: () => IconX,
82
+ Input: () => Input,
83
+ InputGroup: () => InputGroup,
84
+ Kbd: () => Kbd,
85
+ List: () => List,
86
+ ListItem: () => ListItem,
87
+ Menu: () => Menu,
88
+ MenuItem: () => MenuItem,
89
+ MenuLabel: () => MenuLabel,
90
+ MenuSeparator: () => MenuSeparator,
91
+ NavGroupLabel: () => NavGroupLabel,
92
+ NavItem: () => NavItem,
93
+ Pagination: () => Pagination,
94
+ Popover: () => Popover,
95
+ Progress: () => Progress,
96
+ Radio: () => Radio,
97
+ Range: () => Range,
98
+ SegmentedControl: () => SegmentedControl,
99
+ Select: () => Select,
100
+ SideNav: () => SideNav,
101
+ Skeleton: () => Skeleton,
102
+ SortableHeader: () => SortableHeader,
103
+ Spinner: () => Spinner,
104
+ StatCard: () => StatCard,
105
+ Stepper: () => Stepper,
106
+ Switch: () => Switch,
107
+ Tab: () => Tab,
108
+ TabList: () => TabList,
109
+ TabPanel: () => TabPanel,
110
+ Table: () => Table,
111
+ Tabs: () => Tabs,
112
+ Tag: () => Tag,
113
+ Text: () => Text,
114
+ Textarea: () => Textarea,
115
+ Toast: () => Toast,
116
+ ToastProvider: () => ToastProvider,
117
+ Tooltip: () => Tooltip,
118
+ TopNav: () => TopNav,
119
+ VisuallyHidden: () => VisuallyHidden,
120
+ cx: () => cx,
121
+ pageRange: () => pageRange,
122
+ useToast: () => useToast
123
+ });
124
+ module.exports = __toCommonJS(index_exports);
125
+
126
+ // src/cx.ts
127
+ function cx(...classes) {
128
+ return classes.filter(Boolean).join(" ");
129
+ }
130
+
131
+ // src/base.tsx
132
+ var import_react = require("react");
133
+ var import_jsx_runtime = require("react/jsx-runtime");
134
+ var FlatworkRoot = (0, import_react.forwardRef)(function FlatworkRoot2({ mode, className, ...props }, ref) {
135
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: cx("fw", className), "data-theme": mode, ...props });
136
+ });
137
+ var defaultTag = {
138
+ display: "h1",
139
+ title: "h2",
140
+ heading: "h3",
141
+ body: "p",
142
+ label: "span",
143
+ caption: "span",
144
+ mono: "span"
145
+ };
146
+ function Text({ variant = "body", muted, as, className, ...props }) {
147
+ const Tag2 = as ?? defaultTag[variant];
148
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag2, { className: cx(`fw-t-${variant}`, muted && "fw-t-muted", className), ...props });
149
+ }
150
+ function Kbd(props) {
151
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { ...props });
152
+ }
153
+ function Spinner({ size = "md", label, className, ...props }) {
154
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
155
+ "span",
156
+ {
157
+ className: cx("fw-spinner", size === "lg" && "fw-spinner-lg", className),
158
+ ...label ? { role: "status", "aria-label": label } : { "aria-hidden": true },
159
+ ...props
160
+ }
161
+ );
162
+ }
163
+ function VisuallyHidden({ children }) {
164
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap" }, children });
165
+ }
166
+
167
+ // src/Button.tsx
168
+ var import_react2 = require("react");
169
+ var import_jsx_runtime2 = require("react/jsx-runtime");
170
+ function buttonClass({ variant = "secondary", size = "md", iconOnly, block }, className) {
171
+ return cx(
172
+ "fw-btn",
173
+ `fw-btn-${variant}`,
174
+ size !== "md" && `fw-btn-${size}`,
175
+ iconOnly && "fw-btn-icon",
176
+ block && "fw-btn-block",
177
+ className
178
+ );
179
+ }
180
+ function content({ loading, leadingIcon, trailingIcon }, children) {
181
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
182
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spinner, {}) : leadingIcon,
183
+ children,
184
+ trailingIcon
185
+ ] });
186
+ }
187
+ var Button = (0, import_react2.forwardRef)(function Button2({ variant, size, iconOnly, block, loading, leadingIcon, trailingIcon, className, children, type = "button", disabled, ...props }, ref) {
188
+ const own = { variant, size, iconOnly, block, loading, leadingIcon, trailingIcon };
189
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
190
+ "button",
191
+ {
192
+ ref,
193
+ type,
194
+ className: buttonClass(own, className),
195
+ disabled: disabled || loading,
196
+ "aria-busy": loading || void 0,
197
+ ...props,
198
+ children: content(own, children)
199
+ }
200
+ );
201
+ });
202
+ var ButtonLink = (0, import_react2.forwardRef)(function ButtonLink2({ variant, size, iconOnly, block, loading, leadingIcon, trailingIcon, className, children, ...props }, ref) {
203
+ const own = { variant, size, iconOnly, block, loading, leadingIcon, trailingIcon };
204
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { ref, className: buttonClass(own, className), ...props, children: content(own, children) });
205
+ });
206
+ function ButtonGroup({ className, ...props }) {
207
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { role: "group", className: cx("fw-btn-group", className), ...props });
208
+ }
209
+
210
+ // src/Form.tsx
211
+ var import_react3 = require("react");
212
+
213
+ // src/icons.tsx
214
+ var import_jsx_runtime3 = require("react/jsx-runtime");
215
+ function icon(name, paths) {
216
+ const Icon = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
217
+ "svg",
218
+ {
219
+ "aria-hidden": "true",
220
+ viewBox: "0 0 16 16",
221
+ width: "16",
222
+ height: "16",
223
+ fill: "none",
224
+ stroke: "currentColor",
225
+ strokeWidth: 1.4,
226
+ strokeLinecap: "round",
227
+ strokeLinejoin: "round",
228
+ ...props,
229
+ children: paths
230
+ }
231
+ );
232
+ Icon.displayName = name;
233
+ return Icon;
234
+ }
235
+ var IconHome = icon("IconHome", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
236
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2 6.5 8 2l6 4.5V14H2z" }),
237
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6.25 14V9.5h3.5V14" })
238
+ ] }));
239
+ var IconUser = icon("IconUser", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "5.5", r: "2.75" }),
241
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2.75 14c.6-2.6 2.7-4 5.25-4s4.65 1.4 5.25 4" })
242
+ ] }));
243
+ var IconSettings = icon("IconSettings", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
244
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "2" }),
245
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 1.5v2M8 12.5v2M1.5 8h2M12.5 8h2M3.4 3.4l1.4 1.4M11.2 11.2l1.4 1.4M3.4 12.6l1.4-1.4M11.2 4.8l1.4-1.4" })
246
+ ] }));
247
+ var IconPlus = icon("IconPlus", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 3v10M3 8h10" }));
248
+ var IconDownload = icon("IconDownload", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 2.5v8M4.5 7 8 10.5 11.5 7M2.5 13.5h11" }));
249
+ var IconUpload = icon("IconUpload", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 10.5v-8M4.5 6 8 2.5 11.5 6M2.5 13.5h11" }));
250
+ var IconChevronDown = icon("IconChevronDown", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m4 6 4 4 4-4" }));
251
+ var IconChevronUp = icon("IconChevronUp", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m4 10 4-4 4 4" }));
252
+ var IconChevronRight = icon("IconChevronRight", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m6 3.5 4 4.5-4 4.5" }));
253
+ var IconChevronLeft = icon("IconChevronLeft", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m10 3.5-4 4.5 4 4.5" }));
254
+ var IconArrowRight = icon("IconArrowRight", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 8h10M9 4l4 4-4 4" }));
255
+ var IconPencil = icon("IconPencil", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M10.5 2.5 13.5 5.5 5.5 13.5H2.5V10.5z" }));
256
+ var IconCopy = icon("IconCopy", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
257
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "5", y: "5", width: "8.5", height: "8.5", rx: "1.5" }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 10.5V3.5A1 1 0 0 1 4 2.5h6.5" })
259
+ ] }));
260
+ var IconMore = icon("IconMore", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
261
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "3.5", cy: "8", r: "1.25" }),
262
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "1.25" }),
263
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12.5", cy: "8", r: "1.25" })
264
+ ] }));
265
+ var IconX = icon("IconX", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m4 4 8 8M12 4l-8 8" }));
266
+ var IconTrash = icon("IconTrash", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2.5 4.5h11M6 4.5V3h4v1.5M4 4.5l.7 9h6.6l.7-9" }));
267
+ var IconSearch = icon("IconSearch", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
268
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "7", cy: "7", r: "4.5" }),
269
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m10.5 10.5 3.5 3.5" })
270
+ ] }));
271
+ var IconEye = icon("IconEye", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
272
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M1.5 8S3.9 3.5 8 3.5 14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8z" }),
273
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "2" })
274
+ ] }));
275
+ var IconInfo = icon("IconInfo", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
276
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "6.25" }),
277
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 7.25v4M8 4.75v.25" })
278
+ ] }));
279
+ var IconCheckCircle = icon("IconCheckCircle", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
280
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "6.25" }),
281
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m5.5 8.25 1.75 1.75 3.25-3.5" })
282
+ ] }));
283
+ var IconWarning = icon("IconWarning", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
284
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 2 14.5 13.5h-13z" }),
285
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 6.5v3.25M8 11.5v.25" })
286
+ ] }));
287
+ var IconError = icon("IconError", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
288
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "6.25" }),
289
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 4.75v3.75M8 10.75v.5" })
290
+ ] }));
291
+ var IconFolder = icon("IconFolder", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2 4.5h4l1.5 1.5H14V13H2z" }));
292
+ var IconBell = icon("IconBell", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
293
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 6.5a4 4 0 0 1 8 0c0 3.5 1.5 4.5 1.5 4.5h-11S4 10 4 6.5z" }),
294
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6.75 13.5a1.4 1.4 0 0 0 2.5 0" })
295
+ ] }));
296
+ var IconChart = icon("IconChart", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2 13V9M6 13V5M10 13V7M14 13V3" }));
297
+ var IconLock = icon("IconLock", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
298
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "3", y: "7", width: "10", height: "7", rx: "1.5" }),
299
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5.5 7V5a2.5 2.5 0 0 1 5 0v2" })
300
+ ] }));
301
+ var IconGrid = icon("IconGrid", /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
302
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "2.5", y: "2.5", width: "4.5", height: "4.5", rx: "1" }),
303
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "9", y: "2.5", width: "4.5", height: "4.5", rx: "1" }),
304
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "2.5", y: "9", width: "4.5", height: "4.5", rx: "1" }),
305
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "9", y: "9", width: "4.5", height: "4.5", rx: "1" })
306
+ ] }));
307
+ var IconList = icon("IconList", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2.5 4h11M2.5 8h11M2.5 12h11" }));
308
+ var IconCheck = icon("IconCheck", /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m3 8.5 3 3 7-7" }));
309
+
310
+ // src/Form.tsx
311
+ var import_jsx_runtime4 = require("react/jsx-runtime");
312
+ var FieldContext = (0, import_react3.createContext)(null);
313
+ function useFieldProps(props) {
314
+ const field = (0, import_react3.useContext)(FieldContext);
315
+ const invalid = props.invalid ?? field?.invalid ?? false;
316
+ return {
317
+ id: props.id ?? field?.id,
318
+ "aria-describedby": props["aria-describedby"] ?? field?.describedBy,
319
+ "aria-invalid": props["aria-invalid"] ?? (invalid || void 0),
320
+ invalid
321
+ };
322
+ }
323
+ function Field({ label, optional, help, error, labelEnd, labelAsText, id, className, children, ...props }) {
324
+ const autoId = (0, import_react3.useId)();
325
+ const controlId = id ?? autoId;
326
+ const messageId = `${controlId}-message`;
327
+ const message = error ?? help;
328
+ const labelEl = labelAsText ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fw-label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fw-label", htmlFor: controlId, children: [
329
+ label,
330
+ optional && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fw-opt", children: " (optional)" })
331
+ ] });
332
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldContext.Provider, { value: { id: controlId, describedBy: message ? messageId : void 0, invalid: Boolean(error) }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx("fw-field", className), ...props, children: [
333
+ labelEnd ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [
334
+ labelEl,
335
+ labelEnd
336
+ ] }) : labelEl,
337
+ children,
338
+ error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fw-field-error", id: messageId, children: error }) : help ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fw-help", id: messageId, children: help }) : null
339
+ ] }) });
340
+ }
341
+ var Input = (0, import_react3.forwardRef)(function Input2({ size = "md", invalid: _invalid, mono, className, ...props }, ref) {
342
+ const { invalid, ...field } = useFieldProps({ ...props, invalid: _invalid });
343
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
344
+ "input",
345
+ {
346
+ ref,
347
+ className: cx("fw-input", size === "sm" && "fw-input-sm", invalid && "is-error", mono && "is-mono", className),
348
+ ...props,
349
+ ...field
350
+ }
351
+ );
352
+ });
353
+ var Textarea = (0, import_react3.forwardRef)(function Textarea2({ invalid: _invalid, className, ...props }, ref) {
354
+ const { invalid, ...field } = useFieldProps({ ...props, invalid: _invalid });
355
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { ref, className: cx("fw-textarea", invalid && "is-error", className), ...props, ...field });
356
+ });
357
+ var Select = (0, import_react3.forwardRef)(function Select2({ invalid: _invalid, className, children, ...props }, ref) {
358
+ const { invalid, ...field } = useFieldProps({ ...props, invalid: _invalid });
359
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "fw-select-wrap", children: [
360
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { ref, className: cx("fw-select", invalid && "is-error", className), ...props, ...field, children }),
361
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconChevronDown, {})
362
+ ] });
363
+ });
364
+ function InputGroup({ className, ...props }) {
365
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx("fw-input-affix", className), ...props });
366
+ }
367
+ function Affix({ boxed, end, className, ...props }) {
368
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: cx("fw-affix", boxed && "fw-affix-box", boxed && end && "fw-end", className), ...props });
369
+ }
370
+ function ChoiceLabel({ label, description, children, center, spread, style, className }) {
371
+ if (label === void 0) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
372
+ const text = description ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
373
+ label,
374
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { children: description })
375
+ ] }) : label;
376
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
377
+ "label",
378
+ {
379
+ className: cx("fw-check", className),
380
+ style: { ...center && { alignItems: "center" }, ...spread && { justifyContent: "space-between", width: "100%" }, ...style },
381
+ children: spread ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
382
+ text,
383
+ children
384
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
385
+ children,
386
+ text
387
+ ] })
388
+ }
389
+ );
390
+ }
391
+ var Checkbox = (0, import_react3.forwardRef)(function Checkbox2({ label, description, indeterminate, className, style, ...props }, ref) {
392
+ const inner = (0, import_react3.useRef)(null);
393
+ (0, import_react3.useImperativeHandle)(ref, () => inner.current);
394
+ (0, import_react3.useEffect)(() => {
395
+ if (inner.current) inner.current.indeterminate = Boolean(indeterminate);
396
+ }, [indeterminate]);
397
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChoiceLabel, { label, description, className: label !== void 0 ? className : void 0, style: label !== void 0 ? style : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
398
+ "input",
399
+ {
400
+ ref: inner,
401
+ type: "checkbox",
402
+ className: cx("fw-checkbox", indeterminate && "is-indeterminate", label === void 0 && className),
403
+ "aria-checked": indeterminate ? "mixed" : void 0,
404
+ style: label === void 0 ? style : void 0,
405
+ ...props
406
+ }
407
+ ) });
408
+ });
409
+ var Radio = (0, import_react3.forwardRef)(function Radio2({ label, description, className, style, ...props }, ref) {
410
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChoiceLabel, { label, description, className: label !== void 0 ? className : void 0, style: label !== void 0 ? style : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { ref, type: "radio", className: cx("fw-radio", label === void 0 && className), style: label === void 0 ? style : void 0, ...props }) });
411
+ });
412
+ var Switch = (0, import_react3.forwardRef)(function Switch2({ label, description, spread, className, style, ...props }, ref) {
413
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChoiceLabel, { label, description, center: true, spread, className: label !== void 0 ? className : void 0, style: label !== void 0 ? style : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { ref, type: "checkbox", role: "switch", className: cx("fw-switch", label === void 0 && className), style: label === void 0 ? style : void 0, ...props }) });
414
+ });
415
+ var Range = (0, import_react3.forwardRef)(function Range2({ className, style, min = 0, max = 100, value, defaultValue, onChange, ...props }, ref) {
416
+ const field = useFieldProps(props);
417
+ const inner = (0, import_react3.useRef)(null);
418
+ (0, import_react3.useImperativeHandle)(ref, () => inner.current);
419
+ const setFill = (el) => {
420
+ const lo = Number(el.min), hi = Number(el.max);
421
+ el.style.setProperty("--fw-fill", `${hi > lo ? (Number(el.value) - lo) / (hi - lo) * 100 : 0}%`);
422
+ };
423
+ (0, import_react3.useEffect)(() => {
424
+ if (inner.current) setFill(inner.current);
425
+ }, [value, min, max]);
426
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
427
+ "input",
428
+ {
429
+ ref: inner,
430
+ type: "range",
431
+ className: cx("fw-range", className),
432
+ style,
433
+ min,
434
+ max,
435
+ value,
436
+ defaultValue,
437
+ onChange: (e) => {
438
+ setFill(e.currentTarget);
439
+ onChange?.(e);
440
+ },
441
+ ...props,
442
+ id: field.id,
443
+ "aria-describedby": field["aria-describedby"]
444
+ }
445
+ );
446
+ });
447
+ function Dropzone({ title, hint, onFiles, onChange, className, ...props }) {
448
+ const field = useFieldProps(props);
449
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
450
+ "label",
451
+ {
452
+ className: cx("fw-dropzone", className),
453
+ style: { cursor: "pointer", position: "relative" },
454
+ onDragOver: (e) => e.preventDefault(),
455
+ onDrop: (e) => {
456
+ e.preventDefault();
457
+ if (e.dataTransfer.files.length) onFiles?.(e.dataTransfer.files);
458
+ },
459
+ children: [
460
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconUpload, {}),
461
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: title ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
462
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "Click to upload" }),
463
+ " or drag and drop"
464
+ ] }) }),
465
+ hint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "var(--fw-mono)", fontSize: 12 }, children: hint }),
466
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
467
+ "input",
468
+ {
469
+ type: "file",
470
+ style: { position: "absolute", width: 1, height: 1, opacity: 0 },
471
+ onChange: (e) => {
472
+ if (e.currentTarget.files?.length) onFiles?.(e.currentTarget.files);
473
+ onChange?.(e);
474
+ },
475
+ ...props,
476
+ id: field.id,
477
+ "aria-describedby": field["aria-describedby"]
478
+ }
479
+ )
480
+ ]
481
+ }
482
+ );
483
+ }
484
+ function Fieldset({ legend, className, children, ...props }) {
485
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("fieldset", { className: cx("fw-fieldset", className), ...props, children: [
486
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("legend", { children: legend }),
487
+ children
488
+ ] });
489
+ }
490
+
491
+ // src/Feedback.tsx
492
+ var import_react4 = require("react");
493
+ var import_jsx_runtime5 = require("react/jsx-runtime");
494
+ var toneIcon = {
495
+ info: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconInfo, {}),
496
+ success: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconCheckCircle, {}),
497
+ warning: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconWarning, {}),
498
+ error: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconError, {}),
499
+ neutral: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconInfo, {})
500
+ };
501
+ function Alert({ tone = "info", title, icon: icon2, onDismiss, className, children, ...props }) {
502
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
503
+ "div",
504
+ {
505
+ role: tone === "error" ? "alert" : "status",
506
+ className: cx("fw-alert", tone !== "info" && `fw-alert-${tone}`, className),
507
+ ...props,
508
+ children: [
509
+ icon2 === void 0 ? toneIcon[tone] : icon2,
510
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fw-alert-body", children: [
511
+ title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-alert-title", children: title }),
512
+ children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-alert-text", children })
513
+ ] }),
514
+ onDismiss && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": "Dismiss", onClick: onDismiss, style: { margin: "-6px -6px 0 0", color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconX, {}) })
515
+ ]
516
+ }
517
+ );
518
+ }
519
+ function Toast({ tone = "success", title, description, actions, onDismiss, className, ...props }) {
520
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { role: tone === "error" ? "alert" : "status", className: cx("fw-toast", className), ...props, children: [
521
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: `var(--fw-${tone === "neutral" ? "muted" : tone})`, display: "contents" }, children: toneIcon[tone] }),
522
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fw-alert-body", children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-alert-title", children: title }),
524
+ description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: description }),
525
+ actions && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "fw-toast-actions", children: actions })
526
+ ] }),
527
+ onDismiss && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": "Dismiss", onClick: onDismiss, style: { margin: "-6px -8px 0 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconX, {}) })
528
+ ] });
529
+ }
530
+ var ToastContext = (0, import_react4.createContext)(null);
531
+ function ToastProvider({ children }) {
532
+ const [toasts, setToasts] = (0, import_react4.useState)([]);
533
+ const timers = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
534
+ const dismiss = (0, import_react4.useCallback)((id) => {
535
+ clearTimeout(timers.current.get(id));
536
+ timers.current.delete(id);
537
+ setToasts((list) => list.filter((t) => t.id !== id));
538
+ }, []);
539
+ const show = (0, import_react4.useCallback)(
540
+ (toast) => {
541
+ const id = Math.random().toString(36).slice(2);
542
+ setToasts((list) => [...list, { ...toast, id }]);
543
+ const duration = toast.duration ?? (toast.tone === "error" ? Infinity : 5e3);
544
+ if (Number.isFinite(duration)) timers.current.set(id, setTimeout(() => dismiss(id), duration));
545
+ return id;
546
+ },
547
+ [dismiss]
548
+ );
549
+ (0, import_react4.useEffect)(() => () => timers.current.forEach(clearTimeout), []);
550
+ const api = (0, import_react4.useMemo)(() => ({ show, dismiss }), [show, dismiss]);
551
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(ToastContext.Provider, { value: api, children: [
552
+ children,
553
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "fw-toaster", "aria-live": "polite", children: toasts.map(({ id, duration: _duration, ...toast }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Toast, { ...toast, onDismiss: () => dismiss(id) }, id)) })
554
+ ] });
555
+ }
556
+ function useToast() {
557
+ const api = (0, import_react4.useContext)(ToastContext);
558
+ if (!api) throw new Error("useToast must be used inside <ToastProvider>");
559
+ return api;
560
+ }
561
+ function Badge({ tone = "neutral", dot, count, className, children, ...props }) {
562
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: cx("fw-badge", tone !== "neutral" && `fw-badge-${tone}`, count && "fw-badge-count", className), ...props, children: [
563
+ dot && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-dot" }),
564
+ children
565
+ ] });
566
+ }
567
+ function Tag({ onRemove, removeLabel, className, children, ...props }) {
568
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: cx("fw-tag", className), ...props, children: [
569
+ children,
570
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", "aria-label": removeLabel ?? (typeof children === "string" ? `Remove ${children}` : "Remove"), onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconX, {}) })
571
+ ] });
572
+ }
573
+ function Progress({ value, max = 100, tone = "accent", meter, className, ...props }) {
574
+ const indeterminate = value === void 0;
575
+ const pct = indeterminate ? void 0 : Math.max(0, Math.min(100, value / max * 100));
576
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
577
+ "div",
578
+ {
579
+ role: meter ? "meter" : "progressbar",
580
+ "aria-valuenow": value,
581
+ "aria-valuemin": indeterminate ? void 0 : 0,
582
+ "aria-valuemax": indeterminate ? void 0 : max,
583
+ className: cx("fw-progress", indeterminate && "fw-progress-indeterminate", tone !== "accent" && `is-${tone}`, className),
584
+ ...props,
585
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: pct === void 0 ? void 0 : { width: `${pct}%` } })
586
+ }
587
+ );
588
+ }
589
+ function Skeleton({ width, height = 12, circle, className, style, ...props }) {
590
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
591
+ "span",
592
+ {
593
+ "aria-hidden": "true",
594
+ className: cx("fw-skeleton", className),
595
+ style: { display: "block", width, height, ...circle && { borderRadius: "50%" }, ...style },
596
+ ...props
597
+ }
598
+ );
599
+ }
600
+ function EmptyState({ icon: icon2, title, description, action, className, ...props }) {
601
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cx("fw-empty", className), ...props, children: [
602
+ icon2 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-empty-icon", children: icon2 }),
603
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-t-heading", children: title }),
604
+ description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fw-t-caption", style: { maxWidth: 260 }, children: description }),
605
+ action && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginTop: 8 }, children: action })
606
+ ] });
607
+ }
608
+
609
+ // src/Menu.tsx
610
+ var import_react5 = require("react");
611
+ var import_jsx_runtime6 = require("react/jsx-runtime");
612
+ var Menu = (0, import_react5.forwardRef)(function Menu2({ className, role = "menu", ...props }, ref) {
613
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { ref, role, className: cx("fw-menu", className), ...props });
614
+ });
615
+ function MenuLabel({ className, ...props }) {
616
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { role: "presentation", className: cx("fw-menu-label", className), ...props });
617
+ }
618
+ function MenuSeparator({ className, ...props }) {
619
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { role: "separator", className: cx("fw-menu-sep", className), ...props });
620
+ }
621
+ function MenuItem({ icon: icon2, shortcut, danger, selected, disabled, as = "button", className, children, ...props }) {
622
+ const classes = cx("fw-menu-item", danger && "is-danger", selected && "is-selected", className);
623
+ const inner = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
624
+ icon2,
625
+ children,
626
+ shortcut ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "fw-end", children: shortcut }) : selected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconCheck, { style: { marginLeft: "auto", color: "var(--fw-accent)" } }) : null
627
+ ] });
628
+ if (as === "li") {
629
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { className: classes, "aria-disabled": disabled || void 0, ...props, children: inner });
630
+ }
631
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { role: "none", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", role: "menuitem", className: classes, disabled, ...props, children: inner }) });
632
+ }
633
+
634
+ // src/Overlay.tsx
635
+ var import_react6 = require("react");
636
+ var import_jsx_runtime7 = require("react/jsx-runtime");
637
+ function useDismiss(ref, active, onOutside) {
638
+ (0, import_react6.useEffect)(() => {
639
+ if (!active) return;
640
+ const onPointer = (e) => {
641
+ if (ref.current && !ref.current.contains(e.target)) onOutside();
642
+ };
643
+ const onKey = (e) => {
644
+ if (e.key === "Escape") onOutside();
645
+ };
646
+ document.addEventListener("pointerdown", onPointer);
647
+ document.addEventListener("keydown", onKey);
648
+ return () => {
649
+ document.removeEventListener("pointerdown", onPointer);
650
+ document.removeEventListener("keydown", onKey);
651
+ };
652
+ }, [ref, active, onOutside]);
653
+ }
654
+ function Tooltip({ content: content2, shortcut, children, delay = 500 }) {
655
+ const [open, setOpen] = (0, import_react6.useState)(false);
656
+ const timer = (0, import_react6.useRef)(void 0);
657
+ const id = (0, import_react6.useId)();
658
+ const show = (wait) => {
659
+ clearTimeout(timer.current);
660
+ if (wait <= 0) setOpen(true);
661
+ else timer.current = setTimeout(() => setOpen(true), wait);
662
+ };
663
+ const hide = () => {
664
+ clearTimeout(timer.current);
665
+ setOpen(false);
666
+ };
667
+ (0, import_react6.useEffect)(() => () => clearTimeout(timer.current), []);
668
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
669
+ "span",
670
+ {
671
+ className: "fw-anchor",
672
+ onPointerEnter: () => show(delay),
673
+ onPointerLeave: hide,
674
+ onFocus: () => show(0),
675
+ onBlur: hide,
676
+ onKeyDown: (e) => e.key === "Escape" && hide(),
677
+ children: [
678
+ (0, import_react6.cloneElement)(children, { "aria-describedby": open ? id : void 0 }),
679
+ open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "fw-tooltip", role: "tooltip", id, children: [
680
+ content2,
681
+ shortcut && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: shortcut })
682
+ ] })
683
+ ]
684
+ }
685
+ );
686
+ }
687
+ function Popover({ trigger, children, open: controlled, defaultOpen = false, onOpenChange, alignEnd, label, className, ...props }) {
688
+ const [uncontrolled, setUncontrolled] = (0, import_react6.useState)(defaultOpen);
689
+ const open = controlled ?? uncontrolled;
690
+ const setOpen = (next) => {
691
+ setUncontrolled(next);
692
+ onOpenChange?.(next);
693
+ };
694
+ const ref = (0, import_react6.useRef)(null);
695
+ const id = (0, import_react6.useId)();
696
+ useDismiss(ref, open, () => setOpen(false));
697
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "fw-anchor", ref, children: [
698
+ (0, import_react6.cloneElement)(trigger, {
699
+ "aria-expanded": open,
700
+ "aria-haspopup": "dialog",
701
+ "aria-controls": open ? id : void 0,
702
+ onClick: () => setOpen(!open)
703
+ }),
704
+ open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { id, role: "dialog", "aria-label": label, className: cx("fw-popover", alignEnd && "is-end", className), ...props, children })
705
+ ] });
706
+ }
707
+ function DropdownMenu({ trigger, children, alignEnd, label }) {
708
+ const [open, setOpen] = (0, import_react6.useState)(false);
709
+ const ref = (0, import_react6.useRef)(null);
710
+ const menuRef = (0, import_react6.useRef)(null);
711
+ const id = (0, import_react6.useId)();
712
+ useDismiss(ref, open, () => setOpen(false));
713
+ (0, import_react6.useEffect)(() => {
714
+ if (open) menuRef.current?.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
715
+ }, [open]);
716
+ const onKeyDown = (e) => {
717
+ const items = [...menuRef.current?.querySelectorAll('[role="menuitem"]:not(:disabled)') ?? []];
718
+ const i = items.indexOf(document.activeElement);
719
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
720
+ e.preventDefault();
721
+ items[(i + (e.key === "ArrowDown" ? 1 : -1) + items.length) % items.length]?.focus();
722
+ } else if (e.key === "Home" || e.key === "End") {
723
+ e.preventDefault();
724
+ items[e.key === "Home" ? 0 : items.length - 1]?.focus();
725
+ }
726
+ };
727
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "fw-anchor", ref, children: [
728
+ (0, import_react6.cloneElement)(trigger, {
729
+ "aria-expanded": open,
730
+ "aria-haspopup": "menu",
731
+ "aria-controls": open ? id : void 0,
732
+ onClick: () => setOpen(!open)
733
+ }),
734
+ open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
735
+ Menu,
736
+ {
737
+ ref: menuRef,
738
+ id,
739
+ "aria-label": label,
740
+ className: alignEnd ? "is-end" : void 0,
741
+ onKeyDown,
742
+ onClick: (e) => e.target.closest('[role="menuitem"]') && setOpen(false),
743
+ children
744
+ }
745
+ )
746
+ ] });
747
+ }
748
+ function useModal(open, onClose) {
749
+ const ref = (0, import_react6.useRef)(null);
750
+ (0, import_react6.useEffect)(() => {
751
+ const dialog = ref.current;
752
+ if (!dialog) return;
753
+ if (open && !dialog.open) dialog.showModal();
754
+ if (!open && dialog.open) dialog.close();
755
+ }, [open]);
756
+ const props = {
757
+ ref,
758
+ onCancel: (e) => {
759
+ e.preventDefault();
760
+ onClose();
761
+ },
762
+ onClick: (e) => {
763
+ if (e.target === e.currentTarget) onClose();
764
+ }
765
+ };
766
+ return props;
767
+ }
768
+ function DialogHead({ titleId, title, subtitle, onClose, hideClose, divided }) {
769
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fw-dialog-head", style: divided ? { paddingBottom: 16, borderBottom: "1px solid var(--fw-border)" } : void 0, children: [
770
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
771
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "fw-dialog-title", id: titleId, children: title }),
772
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "fw-card-sub", children: subtitle })
773
+ ] }),
774
+ !hideClose && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": "Close", onClick: onClose, style: { margin: "-6px -10px 0 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconX, {}) })
775
+ ] });
776
+ }
777
+ function Dialog({ open, onClose, title, subtitle, footer, alert, hideClose, className, children, ...props }) {
778
+ const modal = useModal(open, onClose);
779
+ const titleId = (0, import_react6.useId)();
780
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dialog", { ...modal, role: alert ? "alertdialog" : void 0, "aria-labelledby": titleId, className: cx("fw-dialog", className), ...props, children: open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
781
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogHead, { titleId, title, subtitle, onClose, hideClose }),
782
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fw-dialog-body", children }),
783
+ footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fw-dialog-foot", children: footer })
784
+ ] }) });
785
+ }
786
+ function Drawer({ open, onClose, title, subtitle, footer, hideClose, className, children, ...props }) {
787
+ const modal = useModal(open, onClose);
788
+ const titleId = (0, import_react6.useId)();
789
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dialog", { ...modal, "aria-labelledby": titleId, className: cx("fw-drawer", className), ...props, children: open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
790
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogHead, { titleId, title, subtitle, onClose, hideClose, divided: true }),
791
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fw-dialog-body", style: { paddingTop: 20 }, children }),
792
+ footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fw-dialog-foot", children: footer })
793
+ ] }) });
794
+ }
795
+ function CommandPalette({ open, onClose, commands, placeholder = "Search commands", onOpenShortcut }) {
796
+ const modal = useModal(open, onClose);
797
+ const [query, setQuery] = (0, import_react6.useState)("");
798
+ const [active, setActive] = (0, import_react6.useState)(0);
799
+ const listId = (0, import_react6.useId)();
800
+ (0, import_react6.useEffect)(() => {
801
+ if (!onOpenShortcut) return;
802
+ const onKey = (e) => {
803
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
804
+ e.preventDefault();
805
+ onOpenShortcut();
806
+ }
807
+ };
808
+ document.addEventListener("keydown", onKey);
809
+ return () => document.removeEventListener("keydown", onKey);
810
+ }, [onOpenShortcut]);
811
+ (0, import_react6.useEffect)(() => {
812
+ if (open) {
813
+ setQuery("");
814
+ setActive(0);
815
+ }
816
+ }, [open]);
817
+ const results = (0, import_react6.useMemo)(() => {
818
+ const q = query.trim().toLowerCase();
819
+ return q ? commands.filter((c) => [c.label, c.group ?? "", ...c.keywords ?? []].some((s) => s.toLowerCase().includes(q))) : commands;
820
+ }, [commands, query]);
821
+ const run = (c) => {
822
+ if (!c) return;
823
+ onClose();
824
+ c.onSelect();
825
+ };
826
+ const onKeyDown = (e) => {
827
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
828
+ e.preventDefault();
829
+ if (results.length) setActive((i) => (i + (e.key === "ArrowDown" ? 1 : -1) + results.length) % results.length);
830
+ } else if (e.key === "Enter") {
831
+ e.preventDefault();
832
+ run(results[active]);
833
+ }
834
+ };
835
+ let lastGroup;
836
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dialog", { ...modal, "aria-label": "Command palette", className: "fw-command", children: open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
837
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fw-command-input", children: [
838
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconSearch, {}),
839
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
840
+ "input",
841
+ {
842
+ autoFocus: true,
843
+ role: "combobox",
844
+ "aria-expanded": "true",
845
+ "aria-controls": listId,
846
+ "aria-activedescendant": results[active] ? `${listId}-${results[active].id}` : void 0,
847
+ "aria-label": placeholder,
848
+ placeholder,
849
+ value: query,
850
+ onChange: (e) => {
851
+ setQuery(e.target.value);
852
+ setActive(0);
853
+ },
854
+ onKeyDown
855
+ }
856
+ ),
857
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: "Esc" })
858
+ ] }),
859
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Menu, { id: listId, role: "listbox", children: [
860
+ results.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuLabel, { children: "No results" }),
861
+ results.map((c, i) => {
862
+ const header = c.group && c.group !== lastGroup ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuLabel, { children: c.group }, `g-${c.group}`) : null;
863
+ lastGroup = c.group;
864
+ return [
865
+ header,
866
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
867
+ MenuItem,
868
+ {
869
+ as: "li",
870
+ id: `${listId}-${c.id}`,
871
+ role: "option",
872
+ "aria-selected": i === active,
873
+ className: i === active ? "is-hover" : void 0,
874
+ icon: c.icon,
875
+ shortcut: c.shortcut ?? (i === active ? "\u21B5" : void 0),
876
+ onPointerMove: () => setActive(i),
877
+ onClick: () => run(c),
878
+ children: c.label
879
+ },
880
+ c.id
881
+ )
882
+ ];
883
+ })
884
+ ] }),
885
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fw-command-foot", children: [
886
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
887
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: "\u2191" }),
888
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: "\u2193" }),
889
+ "navigate"
890
+ ] }),
891
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
892
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: "\u21B5" }),
893
+ "select"
894
+ ] }),
895
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
896
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("kbd", { children: "Esc" }),
897
+ "close"
898
+ ] })
899
+ ] })
900
+ ] }) });
901
+ }
902
+
903
+ // src/Navigation.tsx
904
+ var import_react7 = require("react");
905
+ var import_jsx_runtime8 = require("react/jsx-runtime");
906
+ function rovingKeys(selector, orientation = "horizontal") {
907
+ return (e) => {
908
+ const [prev, next] = orientation === "horizontal" ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"];
909
+ if (![prev, next, "Home", "End"].includes(e.key)) return;
910
+ const items = [...e.currentTarget.querySelectorAll(selector)].filter((el) => !el.hasAttribute("disabled"));
911
+ const i = items.indexOf(document.activeElement);
912
+ const target = e.key === "Home" ? 0 : e.key === "End" ? items.length - 1 : (i + (e.key === next ? 1 : -1) + items.length) % items.length;
913
+ e.preventDefault();
914
+ items[target]?.focus();
915
+ items[target]?.click();
916
+ };
917
+ }
918
+ function TopNav({ brand, end, navLabel = "Primary", className, children, ...props }) {
919
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { className: cx("fw-topnav", className), ...props, children: [
920
+ brand,
921
+ children && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { "aria-label": navLabel, children }),
922
+ end && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "fw-end", children: end })
923
+ ] });
924
+ }
925
+ function Brand({ mark, className, children, style, ...props }) {
926
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("a", { className: cx("fw-brand", className), style: { textDecoration: "none", ...style }, ...props, children: [
927
+ mark && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fw-logo-mark", "aria-hidden": "true", children: mark }),
928
+ children
929
+ ] });
930
+ }
931
+ function SideNav({ className, ...props }) {
932
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { className: cx("fw-sidenav", className), ...props });
933
+ }
934
+ function NavGroupLabel({ className, ...props }) {
935
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cx("fw-group-label", className), ...props });
936
+ }
937
+ function NavItem({ icon: icon2, badge, current, as, className, children, ...props }) {
938
+ const Tag2 = as ?? "a";
939
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tag2, { className: cx("fw-nav-item", className), "aria-current": current ? "page" : void 0, ...props, children: [
940
+ icon2,
941
+ children,
942
+ badge
943
+ ] });
944
+ }
945
+ var TabsContext = (0, import_react7.createContext)(null);
946
+ function useTabs() {
947
+ const ctx = (0, import_react7.useContext)(TabsContext);
948
+ if (!ctx) throw new Error("Tab components must be used inside <Tabs>");
949
+ return ctx;
950
+ }
951
+ function Tabs({ value: controlled, defaultValue = "", onValueChange, children }) {
952
+ const [uncontrolled, setUncontrolled] = (0, import_react7.useState)(defaultValue);
953
+ const baseId = (0, import_react7.useId)();
954
+ const value = controlled ?? uncontrolled;
955
+ const setValue = (v) => {
956
+ setUncontrolled(v);
957
+ onValueChange?.(v);
958
+ };
959
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TabsContext.Provider, { value: { value, setValue, baseId }, children });
960
+ }
961
+ function TabList({ className, ...props }) {
962
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { role: "tablist", className: cx("fw-tabs", className), onKeyDown: rovingKeys('[role="tab"]'), ...props });
963
+ }
964
+ function Tab({ value, badge, className, children, ...props }) {
965
+ const tabs = useTabs();
966
+ const selected = tabs.value === value;
967
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
968
+ "button",
969
+ {
970
+ type: "button",
971
+ role: "tab",
972
+ id: `${tabs.baseId}-tab-${value}`,
973
+ "aria-selected": selected,
974
+ "aria-controls": `${tabs.baseId}-panel-${value}`,
975
+ tabIndex: selected ? 0 : -1,
976
+ className: cx("fw-tab", selected && "is-active", className),
977
+ onClick: () => tabs.setValue(value),
978
+ ...props,
979
+ children: [
980
+ children,
981
+ badge
982
+ ]
983
+ }
984
+ );
985
+ }
986
+ function TabPanel({ value, ...props }) {
987
+ const tabs = useTabs();
988
+ if (tabs.value !== value) return null;
989
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { role: "tabpanel", id: `${tabs.baseId}-panel-${value}`, "aria-labelledby": `${tabs.baseId}-tab-${value}`, tabIndex: 0, ...props });
990
+ }
991
+ function SegmentedControl({ options, value: controlled, defaultValue, onValueChange, label, className, ...props }) {
992
+ const [uncontrolled, setUncontrolled] = (0, import_react7.useState)(defaultValue ?? options[0]?.value);
993
+ const value = controlled ?? uncontrolled;
994
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { role: "radiogroup", "aria-label": label, className: cx("fw-segmented", className), onKeyDown: rovingKeys('[role="radio"]'), ...props, children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
995
+ "button",
996
+ {
997
+ type: "button",
998
+ role: "radio",
999
+ "aria-checked": o.value === value,
1000
+ "aria-label": o.ariaLabel,
1001
+ tabIndex: o.value === value ? 0 : -1,
1002
+ className: cx("fw-seg", o.value === value && "is-active"),
1003
+ onClick: () => {
1004
+ setUncontrolled(o.value);
1005
+ onValueChange?.(o.value);
1006
+ },
1007
+ children: [
1008
+ o.icon,
1009
+ o.label
1010
+ ]
1011
+ },
1012
+ o.value
1013
+ )) });
1014
+ }
1015
+ function Breadcrumb({ items, renderLink, className, ...props }) {
1016
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { "aria-label": "Breadcrumb", className, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ol", { className: "fw-breadcrumb", children: items.map((c, i) => {
1017
+ const last = i === items.length - 1;
1018
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.Fragment, { children: [
1019
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: last ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-current": "page", children: c.label }) : renderLink ? renderLink(c) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { href: c.href, children: c.label }) }),
1020
+ !last && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconChevronRight, { className: "fw-sep" }) })
1021
+ ] }, i);
1022
+ }) }) });
1023
+ }
1024
+ function pageRange(page, count) {
1025
+ const pages = new Set([1, count, page - 1, page, page + 1].filter((p) => p >= 1 && p <= count));
1026
+ const sorted = [...pages].sort((a, b) => a - b);
1027
+ const out = [];
1028
+ sorted.forEach((p, i) => {
1029
+ if (i > 0 && p - sorted[i - 1] > 1) out.push("gap");
1030
+ out.push(p);
1031
+ });
1032
+ return out;
1033
+ }
1034
+ function Pagination({ page, count, onPageChange, className, ...props }) {
1035
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { "aria-label": "Pagination", className, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("ul", { className: "fw-pagination", children: [
1036
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "fw-page", type: "button", "aria-label": "Previous page", disabled: page <= 1, onClick: () => onPageChange(page - 1), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconChevronLeft, {}) }) }),
1037
+ pageRange(page, count).map(
1038
+ (p, i) => p === "gap" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fw-page", "aria-hidden": "true", style: { cursor: "default" }, children: "\u2026" }) }, `gap-${i}`) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1039
+ "button",
1040
+ {
1041
+ type: "button",
1042
+ className: cx("fw-page", p === page && "is-active"),
1043
+ "aria-current": p === page ? "page" : void 0,
1044
+ onClick: () => onPageChange(p),
1045
+ children: p
1046
+ }
1047
+ ) }, p)
1048
+ ),
1049
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "fw-page", type: "button", "aria-label": "Next page", disabled: page >= count, onClick: () => onPageChange(page + 1), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconChevronRight, {}) }) })
1050
+ ] }) });
1051
+ }
1052
+ function Stepper({ steps, current, className, ...props }) {
1053
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ol", { className: cx("fw-stepper", className), ...props, children: steps.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.Fragment, { children: [
1054
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { className: "fw-step-line", "aria-hidden": "true" }),
1055
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: cx("fw-step", i < current && "is-done", i === current && "is-active"), "aria-current": i === current ? "step" : void 0, children: [
1056
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fw-step-n", children: i < current ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconCheck, {}) : i + 1 }),
1057
+ label
1058
+ ] })
1059
+ ] }, i)) });
1060
+ }
1061
+
1062
+ // src/Data.tsx
1063
+ var import_react8 = require("react");
1064
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1065
+ function Card({ className, ...props }) {
1066
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cx("fw-card", className), ...props });
1067
+ }
1068
+ function CardHeader({ title, subtitle, action, className, children, ...props }) {
1069
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cx("fw-card-head", className), ...props, children: [
1070
+ children ?? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
1071
+ title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "fw-card-title", children: title }),
1072
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "fw-card-sub", children: subtitle })
1073
+ ] }),
1074
+ action
1075
+ ] });
1076
+ }
1077
+ function CardBody({ className, ...props }) {
1078
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cx("fw-card-body", className), ...props });
1079
+ }
1080
+ function CardFooter({ className, ...props }) {
1081
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cx("fw-card-foot", className), ...props });
1082
+ }
1083
+ function StatCard({ label, value, delta, caption, ...props }) {
1084
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Card, { ...props, children: [
1085
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(CardHeader, { children: [
1086
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fw-t-caption", children: label }),
1087
+ delta
1088
+ ] }),
1089
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(CardBody, { children: [
1090
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fw-stat-value", children: value }),
1091
+ caption && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fw-t-caption", children: caption })
1092
+ ] })
1093
+ ] });
1094
+ }
1095
+ function Table({ caption, footer, className, children, ...props }) {
1096
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fw-table-wrap", children: [
1097
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("table", { className: cx("fw-table", className), ...props, children: [
1098
+ caption && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("caption", { children: caption }),
1099
+ children
1100
+ ] }),
1101
+ footer && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fw-table-foot", children: footer })
1102
+ ] });
1103
+ }
1104
+ function SortableHeader({ sort = "none", onSort, className, children, ...props }) {
1105
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("th", { className: cx("fw-sortable", className), "aria-sort": sort, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", onClick: onSort, style: { background: "none", border: 0, padding: 0, font: "inherit", color: "inherit", cursor: "pointer" }, children: [
1106
+ children,
1107
+ sort === "descending" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconChevronDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconChevronUp, { style: sort === "none" ? { opacity: 0.4 } : void 0 })
1108
+ ] }) });
1109
+ }
1110
+ function List({ className, ...props }) {
1111
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: cx("fw-list", className), ...props });
1112
+ }
1113
+ function ListItem({ leading, title, meta, trailing, ...props }) {
1114
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { ...props, children: [
1115
+ leading,
1116
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "fw-grow", children: [
1117
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fw-title", children: title }),
1118
+ meta && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fw-meta", children: meta })
1119
+ ] }),
1120
+ trailing
1121
+ ] });
1122
+ }
1123
+ function DescriptionList({ items, className, ...props }) {
1124
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { className: cx("fw-dl", className), ...props, children: items.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react8.Fragment, { children: [
1125
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: it.term }),
1126
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { className: it.mono ? "fw-mono" : void 0, children: it.value })
1127
+ ] }, i)) });
1128
+ }
1129
+ function Accordion({ className, ...props }) {
1130
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cx("fw-accordion", className), ...props });
1131
+ }
1132
+ function AccordionItem({ title, children, ...props }) {
1133
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { ...props, children: [
1134
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
1135
+ title,
1136
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconChevronDown, {})
1137
+ ] }),
1138
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fw-acc-body", children })
1139
+ ] });
1140
+ }
1141
+ function CodeBlock({ className, ...props }) {
1142
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { className: cx("fw-code-block", className), ...props });
1143
+ }
1144
+ function Divider({ label }) {
1145
+ if (!label) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("hr", {});
1146
+ const line = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { flex: 1, height: 1, background: "var(--fw-border)" } });
1147
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { role: "separator", style: { display: "flex", alignItems: "center", gap: 12, color: "var(--fw-muted)", fontSize: 12 }, children: [
1148
+ line,
1149
+ label,
1150
+ line
1151
+ ] });
1152
+ }
1153
+ function Avatar({ size = "md", square, online, className, ...props }) {
1154
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cx("fw-avatar", size !== "md" && `fw-avatar-${size}`, square && "fw-avatar-sq", online && "fw-presence", className), ...props });
1155
+ }
1156
+ function AvatarGroup({ className, ...props }) {
1157
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cx("fw-avatar-group", className), ...props });
1158
+ }
1159
+ // Annotate the CommonJS export names for ESM import in node:
1160
+ 0 && (module.exports = {
1161
+ Accordion,
1162
+ AccordionItem,
1163
+ Affix,
1164
+ Alert,
1165
+ Avatar,
1166
+ AvatarGroup,
1167
+ Badge,
1168
+ Brand,
1169
+ Breadcrumb,
1170
+ Button,
1171
+ ButtonGroup,
1172
+ ButtonLink,
1173
+ Card,
1174
+ CardBody,
1175
+ CardFooter,
1176
+ CardHeader,
1177
+ Checkbox,
1178
+ CodeBlock,
1179
+ CommandPalette,
1180
+ DescriptionList,
1181
+ Dialog,
1182
+ Divider,
1183
+ Drawer,
1184
+ DropdownMenu,
1185
+ Dropzone,
1186
+ EmptyState,
1187
+ Field,
1188
+ Fieldset,
1189
+ FlatworkRoot,
1190
+ IconArrowRight,
1191
+ IconBell,
1192
+ IconChart,
1193
+ IconCheck,
1194
+ IconCheckCircle,
1195
+ IconChevronDown,
1196
+ IconChevronLeft,
1197
+ IconChevronRight,
1198
+ IconChevronUp,
1199
+ IconCopy,
1200
+ IconDownload,
1201
+ IconError,
1202
+ IconEye,
1203
+ IconFolder,
1204
+ IconGrid,
1205
+ IconHome,
1206
+ IconInfo,
1207
+ IconList,
1208
+ IconLock,
1209
+ IconMore,
1210
+ IconPencil,
1211
+ IconPlus,
1212
+ IconSearch,
1213
+ IconSettings,
1214
+ IconTrash,
1215
+ IconUpload,
1216
+ IconUser,
1217
+ IconWarning,
1218
+ IconX,
1219
+ Input,
1220
+ InputGroup,
1221
+ Kbd,
1222
+ List,
1223
+ ListItem,
1224
+ Menu,
1225
+ MenuItem,
1226
+ MenuLabel,
1227
+ MenuSeparator,
1228
+ NavGroupLabel,
1229
+ NavItem,
1230
+ Pagination,
1231
+ Popover,
1232
+ Progress,
1233
+ Radio,
1234
+ Range,
1235
+ SegmentedControl,
1236
+ Select,
1237
+ SideNav,
1238
+ Skeleton,
1239
+ SortableHeader,
1240
+ Spinner,
1241
+ StatCard,
1242
+ Stepper,
1243
+ Switch,
1244
+ Tab,
1245
+ TabList,
1246
+ TabPanel,
1247
+ Table,
1248
+ Tabs,
1249
+ Tag,
1250
+ Text,
1251
+ Textarea,
1252
+ Toast,
1253
+ ToastProvider,
1254
+ Tooltip,
1255
+ TopNav,
1256
+ VisuallyHidden,
1257
+ cx,
1258
+ pageRange,
1259
+ useToast
1260
+ });
1261
+ //# sourceMappingURL=index.cjs.map