@mohirlab/react 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion.d.ts +1 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +1 -0
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/accordion/accordion.styles.js +1 -0
- package/dist/components/accordion/index.d.ts +1 -0
- package/dist/components/avatar/avatar.css.d.ts +1 -0
- package/dist/components/avatar/avatar.css.d.ts.map +1 -1
- package/dist/components/avatar/avatar.d.ts +1 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +1 -0
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/avatar/avatar.styles.js +1 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/badge/badge.css.d.ts +1 -0
- package/dist/components/badge/badge.css.d.ts.map +1 -1
- package/dist/components/badge/badge.d.ts +1 -0
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +1 -0
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/badge/badge.styles.js +1 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/box/box.d.ts +1 -0
- package/dist/components/box/box.d.ts.map +1 -1
- package/dist/components/box/box.js +1 -0
- package/dist/components/box/box.js.map +1 -1
- package/dist/components/box/index.d.ts +1 -0
- package/dist/components/box/stack.d.ts +1 -0
- package/dist/components/box/stack.d.ts.map +1 -1
- package/dist/components/box/stack.js +1 -0
- package/dist/components/box/stack.js.map +1 -1
- package/dist/components/button/button.css.d.ts +1 -0
- package/dist/components/button/button.css.d.ts.map +1 -1
- package/dist/components/button/button.d.ts +1 -0
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +1 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button/button.styles.js +1 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/card/card-media.d.ts +1 -0
- package/dist/components/card/card-media.d.ts.map +1 -1
- package/dist/components/card/card-media.js +1 -0
- package/dist/components/card/card-media.js.map +1 -1
- package/dist/components/card/card.css.d.ts +1 -0
- package/dist/components/card/card.css.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +1 -0
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +1 -0
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/card.styles.js +1 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/choice/choice.d.ts +1 -0
- package/dist/components/choice/choice.d.ts.map +1 -1
- package/dist/components/choice/choice.js +1 -0
- package/dist/components/choice/choice.js.map +1 -1
- package/dist/components/choice/choice.styles.js +1 -0
- package/dist/components/choice/index.d.ts +1 -0
- package/dist/components/combobox/combobox.d.ts +34 -0
- package/dist/components/combobox/combobox.d.ts.map +1 -0
- package/dist/components/combobox/combobox.js +265 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/combobox/combobox.styles.js +42 -0
- package/dist/components/combobox/combobox.styles.js.map +1 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/dialog/dialog.css.d.ts +1 -0
- package/dist/components/dialog/dialog.css.d.ts.map +1 -1
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +1 -0
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/dialog.styles.js +1 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/feedback/feedback.css.d.ts +39 -0
- package/dist/components/feedback/feedback.css.d.ts.map +1 -0
- package/dist/components/feedback/feedback.d.ts +41 -0
- package/dist/components/feedback/feedback.d.ts.map +1 -0
- package/dist/components/feedback/feedback.js +70 -0
- package/dist/components/feedback/feedback.js.map +1 -0
- package/dist/components/feedback/feedback.styles.js +40 -0
- package/dist/components/feedback/feedback.styles.js.map +1 -0
- package/dist/components/feedback/index.d.ts +3 -0
- package/dist/components/field/field-context.d.ts +1 -0
- package/dist/components/field/field-context.d.ts.map +1 -1
- package/dist/components/field/field-context.js +1 -0
- package/dist/components/field/field-context.js.map +1 -1
- package/dist/components/field/field.d.ts +1 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/field.js +1 -0
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/field.styles.js +1 -0
- package/dist/components/field/index.d.ts +1 -0
- package/dist/components/field/use-field-control.js +1 -0
- package/dist/components/field/use-field-control.js.map +1 -1
- package/dist/components/icon/icon.d.ts +1 -0
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +1 -0
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/icon/index.d.ts +1 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/input.css.d.ts +1 -0
- package/dist/components/input/input.css.d.ts.map +1 -1
- package/dist/components/input/input.d.ts +1 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +1 -0
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.styles.js +1 -0
- package/dist/components/menu/index.d.ts +3 -0
- package/dist/components/menu/menu.d.ts +48 -0
- package/dist/components/menu/menu.d.ts.map +1 -0
- package/dist/components/menu/menu.js +188 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/menu/menu.styles.js +28 -0
- package/dist/components/menu/menu.styles.js.map +1 -0
- package/dist/components/navigation/index.d.ts +3 -1
- package/dist/components/navigation/nav.d.ts +1 -0
- package/dist/components/navigation/nav.d.ts.map +1 -1
- package/dist/components/navigation/nav.js +1 -0
- package/dist/components/navigation/nav.js.map +1 -1
- package/dist/components/navigation/navigation.styles.js +1 -0
- package/dist/components/navigation/pagination.d.ts +34 -0
- package/dist/components/navigation/pagination.d.ts.map +1 -0
- package/dist/components/navigation/pagination.js +109 -0
- package/dist/components/navigation/pagination.js.map +1 -0
- package/dist/components/navigation/pagination.styles.js +11 -0
- package/dist/components/navigation/pagination.styles.js.map +1 -0
- package/dist/components/navigation/tabs.d.ts +1 -0
- package/dist/components/navigation/tabs.d.ts.map +1 -1
- package/dist/components/navigation/tabs.js +1 -0
- package/dist/components/navigation/tabs.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/popover.css.d.ts +1 -0
- package/dist/components/popover/popover.css.d.ts.map +1 -1
- package/dist/components/popover/popover.d.ts +1 -0
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +2 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/popover/popover.styles.js +1 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +1 -0
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/select.styles.js +1 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider/slider.d.ts +1 -0
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +1 -0
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/slider/slider.styles.js +1 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +1 -0
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +1 -0
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/table/table.styles.js +1 -0
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/text/text.css.d.ts +1 -0
- package/dist/components/text/text.css.d.ts.map +1 -1
- package/dist/components/text/text.d.ts +1 -0
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/text/text.js +1 -0
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/text/text.styles.js +1 -0
- package/dist/components/theme-scope/theme-scope.d.ts +1 -0
- package/dist/components/theme-scope/theme-scope.d.ts.map +1 -1
- package/dist/components/theme-scope/theme-scope.js +1 -0
- package/dist/components/theme-scope/theme-scope.js.map +1 -1
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/toast.d.ts +1 -0
- package/dist/components/toast/toast.d.ts.map +1 -1
- package/dist/components/toast/toast.js +1 -0
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toast/toast.styles.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +3 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +13 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/components/visually-hidden/visually-hidden.js +19 -0
- package/dist/components/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/components/visually-hidden/visually-hidden.styles.js +7 -0
- package/dist/components/visually-hidden/visually-hidden.styles.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-disclosure.d.ts +1 -0
- package/dist/hooks/use-disclosure.d.ts.map +1 -1
- package/dist/hooks/use-disclosure.js +1 -0
- package/dist/hooks/use-disclosure.js.map +1 -1
- package/dist/hooks/use-presence.d.ts +1 -0
- package/dist/hooks/use-presence.d.ts.map +1 -1
- package/dist/hooks/use-presence.js +1 -0
- package/dist/hooks/use-presence.js.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +9 -3
- package/dist/styles.css +640 -166
- package/dist/utils/cx.d.ts +1 -0
- package/dist/utils/cx.d.ts.map +1 -1
- package/dist/utils/cx.js +1 -0
- package/dist/utils/cx.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { iconCheck, iconChevronDown } from "@mohirlab/icons";
|
|
4
|
+
import { cx } from "../../utils/cx.js";
|
|
5
|
+
import { useFieldControl } from "../field/use-field-control.js";
|
|
6
|
+
import { Icon } from "../icon/icon.js";
|
|
7
|
+
import { useAnchorName } from "../popover/popover.js";
|
|
8
|
+
import { check, empty, field, input, listbox, match, option, optionText, panel, popover, toggle, wrap } from "./combobox.styles.js";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/components/combobox/combobox.tsx
|
|
11
|
+
/** Case- and accent-insensitive, so "o'zbek" finds "Oʻzbek" and "e" finds "é". */
|
|
12
|
+
const fold = (text) => text.normalize("NFD").replace(/[̀-ͯʻʼ'’`]/g, "").toLowerCase();
|
|
13
|
+
const defaultFilter = (option, query) => {
|
|
14
|
+
const q = fold(query.trim());
|
|
15
|
+
return !q || fold(option.label).includes(q) || fold(option.description ?? "").includes(q);
|
|
16
|
+
};
|
|
17
|
+
/** The label with the first match of the query marked. */
|
|
18
|
+
function Highlight({ text, query }) {
|
|
19
|
+
const q = fold(query.trim());
|
|
20
|
+
if (!q) return /* @__PURE__ */ jsx(Fragment, { children: text });
|
|
21
|
+
const folded = [...text].map((c) => fold(c));
|
|
22
|
+
let start = -1;
|
|
23
|
+
for (let i = 0; i < folded.length && start < 0; i++) {
|
|
24
|
+
let joined = "";
|
|
25
|
+
for (let j = i; j < folded.length && joined.length < q.length; j++) joined += folded[j];
|
|
26
|
+
if (joined.startsWith(q)) start = i;
|
|
27
|
+
}
|
|
28
|
+
if (start < 0) return /* @__PURE__ */ jsx(Fragment, { children: text });
|
|
29
|
+
const chars = [...text];
|
|
30
|
+
let end = start;
|
|
31
|
+
for (let length = 0; end < chars.length && length < q.length; end++) length += folded[end].length;
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
chars.slice(0, start).join(""),
|
|
34
|
+
/* @__PURE__ */ jsx("mark", {
|
|
35
|
+
className: match,
|
|
36
|
+
children: chars.slice(start, end).join("")
|
|
37
|
+
}),
|
|
38
|
+
chars.slice(end).join("")
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A select you can type into: for long lists such as countries, people or tags.
|
|
43
|
+
* Follows the WAI-ARIA combobox pattern (list autocomplete): focus stays in the field,
|
|
44
|
+
* arrows move through the matches, Enter chooses, Escape closes. With `name` it submits
|
|
45
|
+
* the chosen value, not the typed text. For short lists, prefer `Select`.
|
|
46
|
+
*/
|
|
47
|
+
function Combobox({ options, value: valueProp, defaultValue = "", onValueChange, size, invalid, emptyText = "No matches", filter = defaultFilter, toggleLabel = "Show options", name, placeholder, className, style, id, required, disabled, onKeyDown, onBlur, ...rest }) {
|
|
48
|
+
const control = useFieldControl({
|
|
49
|
+
id,
|
|
50
|
+
required,
|
|
51
|
+
disabled,
|
|
52
|
+
invalid,
|
|
53
|
+
"aria-describedby": rest["aria-describedby"]
|
|
54
|
+
});
|
|
55
|
+
const listId = useId();
|
|
56
|
+
const optionId = useId();
|
|
57
|
+
const anchor = useAnchorName();
|
|
58
|
+
const panelRef = useRef(null);
|
|
59
|
+
const inputRef = useRef(null);
|
|
60
|
+
const [innerValue, setInnerValue] = useState(defaultValue);
|
|
61
|
+
const value = valueProp ?? innerValue;
|
|
62
|
+
const selected = options.find((o) => o.value === value);
|
|
63
|
+
const [query, setQuery] = useState(selected?.label ?? "");
|
|
64
|
+
/** False right after opening: show every option, not only those matching the current label. */
|
|
65
|
+
const [filtering, setFiltering] = useState(false);
|
|
66
|
+
const [open, setOpen] = useState(false);
|
|
67
|
+
const [active, setActive] = useState(-1);
|
|
68
|
+
const [shownValue, setShownValue] = useState(value);
|
|
69
|
+
if (shownValue !== value) {
|
|
70
|
+
setShownValue(value);
|
|
71
|
+
setQuery(selected?.label ?? "");
|
|
72
|
+
}
|
|
73
|
+
const visible = useMemo(() => filtering ? options.filter((o) => filter(o, query)) : options, [
|
|
74
|
+
options,
|
|
75
|
+
filter,
|
|
76
|
+
query,
|
|
77
|
+
filtering
|
|
78
|
+
]);
|
|
79
|
+
const enabled = (index) => index >= 0 && index < visible.length && !visible[index].disabled;
|
|
80
|
+
const firstEnabled = (from, step) => {
|
|
81
|
+
for (let i = from; i >= 0 && i < visible.length; i += step) if (enabled(i)) return i;
|
|
82
|
+
return -1;
|
|
83
|
+
};
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const panel = panelRef.current;
|
|
86
|
+
if (!panel || panel.matches(":popover-open") === open) return;
|
|
87
|
+
if (open) panel.showPopover();
|
|
88
|
+
else panel.hidePopover();
|
|
89
|
+
}, [open]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (active < 0) return;
|
|
92
|
+
document.getElementById(`${optionId}-${active}`)?.scrollIntoView?.({ block: "nearest" });
|
|
93
|
+
}, [active, optionId]);
|
|
94
|
+
const show = (at = "selected") => {
|
|
95
|
+
setFiltering(false);
|
|
96
|
+
setOpen(true);
|
|
97
|
+
const current = options.findIndex((o) => o.value === value);
|
|
98
|
+
if (at === "last") setActive(lastEnabledOf(options));
|
|
99
|
+
else setActive(at === "selected" && current >= 0 ? current : firstEnabledOf(options));
|
|
100
|
+
};
|
|
101
|
+
const hide = () => {
|
|
102
|
+
setOpen(false);
|
|
103
|
+
setActive(-1);
|
|
104
|
+
};
|
|
105
|
+
const choose = (option) => {
|
|
106
|
+
if (option.disabled) return;
|
|
107
|
+
if (valueProp === void 0) setInnerValue(option.value);
|
|
108
|
+
setShownValue(option.value);
|
|
109
|
+
setQuery(option.label);
|
|
110
|
+
if (option.value !== value) onValueChange?.(option.value);
|
|
111
|
+
hide();
|
|
112
|
+
};
|
|
113
|
+
/** Leaving the field: an exact label match counts as a choice, anything else is undone. */
|
|
114
|
+
const settle = () => {
|
|
115
|
+
const exact = options.find((o) => !o.disabled && fold(o.label) === fold(query.trim()));
|
|
116
|
+
if (exact) choose(exact);
|
|
117
|
+
else if (!query.trim() && value) {
|
|
118
|
+
if (valueProp === void 0) setInnerValue("");
|
|
119
|
+
setShownValue("");
|
|
120
|
+
onValueChange?.("");
|
|
121
|
+
} else setQuery(selected?.label ?? "");
|
|
122
|
+
hide();
|
|
123
|
+
};
|
|
124
|
+
const onFieldKeyDown = (event) => {
|
|
125
|
+
onKeyDown?.(event);
|
|
126
|
+
if (event.defaultPrevented) return;
|
|
127
|
+
switch (event.key) {
|
|
128
|
+
case "ArrowDown":
|
|
129
|
+
if (event.altKey || !open) show(event.altKey ? "selected" : "first");
|
|
130
|
+
else setActive((i) => firstEnabled(i + 1, 1) >= 0 ? firstEnabled(i + 1, 1) : firstEnabled(0, 1));
|
|
131
|
+
break;
|
|
132
|
+
case "ArrowUp":
|
|
133
|
+
if (!open) show("last");
|
|
134
|
+
else setActive((i) => firstEnabled(i - 1, -1) >= 0 ? firstEnabled(i - 1, -1) : firstEnabled(visible.length - 1, -1));
|
|
135
|
+
break;
|
|
136
|
+
case "Enter":
|
|
137
|
+
if (!open) return;
|
|
138
|
+
if (enabled(active)) choose(visible[active]);
|
|
139
|
+
break;
|
|
140
|
+
case "Escape":
|
|
141
|
+
if (open) {
|
|
142
|
+
setQuery(selected?.label ?? "");
|
|
143
|
+
hide();
|
|
144
|
+
} else if (query) setQuery("");
|
|
145
|
+
else return;
|
|
146
|
+
break;
|
|
147
|
+
case "Home":
|
|
148
|
+
case "End": return;
|
|
149
|
+
default: return;
|
|
150
|
+
}
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
};
|
|
153
|
+
const activeId = open && active >= 0 ? `${optionId}-${active}` : void 0;
|
|
154
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
155
|
+
className: cx(wrap, className),
|
|
156
|
+
style,
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ jsx("input", {
|
|
159
|
+
...rest,
|
|
160
|
+
...control,
|
|
161
|
+
ref: inputRef,
|
|
162
|
+
type: "text",
|
|
163
|
+
role: "combobox",
|
|
164
|
+
autoComplete: "off",
|
|
165
|
+
"aria-autocomplete": "list",
|
|
166
|
+
"aria-expanded": open,
|
|
167
|
+
"aria-controls": listId,
|
|
168
|
+
"aria-activedescendant": activeId,
|
|
169
|
+
placeholder,
|
|
170
|
+
value: query,
|
|
171
|
+
className: cx(input({ size }), field),
|
|
172
|
+
style: { anchorName: anchor },
|
|
173
|
+
onChange: (event) => {
|
|
174
|
+
setQuery(event.target.value);
|
|
175
|
+
setFiltering(true);
|
|
176
|
+
setOpen(true);
|
|
177
|
+
const matches = options.filter((o) => filter(o, event.target.value));
|
|
178
|
+
setActive(firstEnabledOf(matches));
|
|
179
|
+
},
|
|
180
|
+
onKeyDown: onFieldKeyDown,
|
|
181
|
+
onBlur: (event) => {
|
|
182
|
+
onBlur?.(event);
|
|
183
|
+
settle();
|
|
184
|
+
},
|
|
185
|
+
onClick: () => !open && show()
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ jsx("button", {
|
|
188
|
+
type: "button",
|
|
189
|
+
tabIndex: -1,
|
|
190
|
+
"aria-label": toggleLabel,
|
|
191
|
+
"aria-expanded": open,
|
|
192
|
+
"aria-controls": listId,
|
|
193
|
+
className: toggle,
|
|
194
|
+
disabled: control.disabled,
|
|
195
|
+
onPointerDown: (event) => event.preventDefault(),
|
|
196
|
+
onClick: () => {
|
|
197
|
+
if (open) hide();
|
|
198
|
+
else show();
|
|
199
|
+
inputRef.current?.focus();
|
|
200
|
+
},
|
|
201
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
202
|
+
icon: iconChevronDown,
|
|
203
|
+
size: 18
|
|
204
|
+
})
|
|
205
|
+
}),
|
|
206
|
+
name && /* @__PURE__ */ jsx("input", {
|
|
207
|
+
type: "hidden",
|
|
208
|
+
name,
|
|
209
|
+
value
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsxs("div", {
|
|
212
|
+
ref: panelRef,
|
|
213
|
+
popover: "manual",
|
|
214
|
+
className: cx(popover({ placement: "bottom-start" }), panel),
|
|
215
|
+
style: { positionAnchor: anchor },
|
|
216
|
+
onPointerDown: (event) => event.preventDefault(),
|
|
217
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
218
|
+
id: listId,
|
|
219
|
+
role: "listbox",
|
|
220
|
+
className: listbox,
|
|
221
|
+
"aria-label": rest["aria-label"],
|
|
222
|
+
children: visible.map((option$1, index) => /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
id: `${optionId}-${index}`,
|
|
224
|
+
role: "option",
|
|
225
|
+
"aria-selected": option$1.value === value,
|
|
226
|
+
"aria-disabled": option$1.disabled || void 0,
|
|
227
|
+
"data-active": index === active ? "" : void 0,
|
|
228
|
+
className: option,
|
|
229
|
+
onPointerMove: () => enabled(index) && index !== active && setActive(index),
|
|
230
|
+
onClick: () => choose(option$1),
|
|
231
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
232
|
+
className: optionText,
|
|
233
|
+
children: [/* @__PURE__ */ jsx("span", { children: filtering ? /* @__PURE__ */ jsx(Highlight, {
|
|
234
|
+
text: option$1.label,
|
|
235
|
+
query
|
|
236
|
+
}) : option$1.label }), option$1.description && /* @__PURE__ */ jsx("span", {
|
|
237
|
+
className: "ml_1ouolxs7",
|
|
238
|
+
children: filtering ? /* @__PURE__ */ jsx(Highlight, {
|
|
239
|
+
text: option$1.description,
|
|
240
|
+
query
|
|
241
|
+
}) : option$1.description
|
|
242
|
+
})]
|
|
243
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
244
|
+
icon: iconCheck,
|
|
245
|
+
size: 16,
|
|
246
|
+
className: check
|
|
247
|
+
})]
|
|
248
|
+
}, option$1.value))
|
|
249
|
+
}), /* @__PURE__ */ jsx("output", {
|
|
250
|
+
className: empty,
|
|
251
|
+
children: visible.length === 0 ? emptyText : null
|
|
252
|
+
})]
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function firstEnabledOf(list) {
|
|
258
|
+
return list.findIndex((o) => !o.disabled);
|
|
259
|
+
}
|
|
260
|
+
function lastEnabledOf(list) {
|
|
261
|
+
return list.findLastIndex((o) => !o.disabled);
|
|
262
|
+
}
|
|
263
|
+
export { Combobox, defaultFilter };
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["styles.match","styles.wrap","styles.input","styles.field","styles.toggle","styles.popover","styles.panel","styles.listbox","option","styles.option","styles.optionText","styles.check","styles.empty"],"sources":["../../../src/components/combobox/combobox.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithRef,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { iconCheck, iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { Icon } from '../icon';\nimport type { InputVariants } from '../input/input.css';\nimport { useAnchorName } from '../popover/popover';\nimport * as styles from './combobox.css';\n\nexport interface ComboboxOption {\n value: string;\n label: string;\n /** A second, quieter line. Also searched. */\n description?: string;\n disabled?: boolean;\n}\n\n/** Case- and accent-insensitive, so \"o'zbek\" finds \"Oʻzbek\" and \"e\" finds \"é\". */\nconst fold = (text: string) =>\n text\n .normalize('NFD')\n .replace(/[̀-ͯʻʼ'’`]/g, '')\n .toLowerCase();\n\nexport const defaultFilter = (option: ComboboxOption, query: string) => {\n const q = fold(query.trim());\n return !q || fold(option.label).includes(q) || fold(option.description ?? '').includes(q);\n};\n\n/** The label with the first match of the query marked. */\nfunction Highlight({ text, query }: { text: string; query: string }) {\n const q = fold(query.trim());\n if (!q) return <>{text}</>;\n // fold() can change lengths (combining marks), so map positions character by character.\n const folded = [...text].map((c) => fold(c));\n let start = -1;\n for (let i = 0; i < folded.length && start < 0; i++) {\n let joined = '';\n for (let j = i; j < folded.length && joined.length < q.length; j++) joined += folded[j];\n if (joined.startsWith(q)) start = i;\n }\n if (start < 0) return <>{text}</>;\n const chars = [...text];\n let end = start;\n for (let length = 0; end < chars.length && length < q.length; end++) length += folded[end]!.length;\n return (\n <>\n {chars.slice(0, start).join('')}\n <mark className={styles.match}>{chars.slice(start, end).join('')}</mark>\n {chars.slice(end).join('')}\n </>\n );\n}\n\nexport interface ComboboxProps extends Omit<\n ComponentPropsWithRef<'input'>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'children'\n> {\n options: ComboboxOption[];\n /** The chosen option's value; `''` for none. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n size?: InputVariants['size'];\n invalid?: boolean;\n /** Shown when nothing matches. */\n emptyText?: ReactNode;\n /** Decide which options match what was typed. Default: label or description contains it. */\n filter?: (option: ComboboxOption, query: string) => boolean;\n /** Accessible name of the open/close button. */\n toggleLabel?: string;\n}\n\n/**\n * A select you can type into: for long lists such as countries, people or tags.\n * Follows the WAI-ARIA combobox pattern (list autocomplete): focus stays in the field,\n * arrows move through the matches, Enter chooses, Escape closes. With `name` it submits\n * the chosen value, not the typed text. For short lists, prefer `Select`.\n */\nexport function Combobox({\n options,\n value: valueProp,\n defaultValue = '',\n onValueChange,\n size,\n invalid,\n emptyText = 'No matches',\n filter = defaultFilter,\n toggleLabel = 'Show options',\n name,\n placeholder,\n className,\n style,\n id,\n required,\n disabled,\n onKeyDown,\n onBlur,\n ...rest\n}: ComboboxProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n const listId = useId();\n const optionId = useId();\n const anchor = useAnchorName();\n const panelRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [innerValue, setInnerValue] = useState(defaultValue);\n const value = valueProp ?? innerValue;\n const selected = options.find((o) => o.value === value);\n const [query, setQuery] = useState(selected?.label ?? '');\n /** False right after opening: show every option, not only those matching the current label. */\n const [filtering, setFiltering] = useState(false);\n const [open, setOpen] = useState(false);\n const [active, setActive] = useState(-1);\n\n // Keep the text in step when the value changes from outside.\n const [shownValue, setShownValue] = useState(value);\n if (shownValue !== value) {\n setShownValue(value);\n setQuery(selected?.label ?? '');\n }\n\n const visible = useMemo(\n () => (filtering ? options.filter((o) => filter(o, query)) : options),\n [options, filter, query, filtering],\n );\n const enabled = (index: number) => index >= 0 && index < visible.length && !visible[index]!.disabled;\n const firstEnabled = (from: number, step: 1 | -1) => {\n for (let i = from; i >= 0 && i < visible.length; i += step) if (enabled(i)) return i;\n return -1;\n };\n\n useEffect(() => {\n const panel = panelRef.current;\n if (!panel || panel.matches(':popover-open') === open) return;\n if (open) panel.showPopover();\n else panel.hidePopover();\n }, [open]);\n\n useEffect(() => {\n if (active < 0) return;\n document.getElementById(`${optionId}-${active}`)?.scrollIntoView?.({ block: 'nearest' });\n }, [active, optionId]);\n\n const show = (at: 'selected' | 'first' | 'last' = 'selected') => {\n setFiltering(false);\n setOpen(true);\n const current = options.findIndex((o) => o.value === value);\n if (at === 'last') setActive(lastEnabledOf(options));\n else setActive(at === 'selected' && current >= 0 ? current : firstEnabledOf(options));\n };\n const hide = () => {\n setOpen(false);\n setActive(-1);\n };\n const choose = (option: ComboboxOption) => {\n if (option.disabled) return;\n if (valueProp === undefined) setInnerValue(option.value);\n setShownValue(option.value);\n setQuery(option.label);\n if (option.value !== value) onValueChange?.(option.value);\n hide();\n };\n /** Leaving the field: an exact label match counts as a choice, anything else is undone. */\n const settle = () => {\n const exact = options.find((o) => !o.disabled && fold(o.label) === fold(query.trim()));\n if (exact) choose(exact);\n else if (!query.trim() && value) {\n if (valueProp === undefined) setInnerValue('');\n setShownValue('');\n onValueChange?.('');\n } else setQuery(selected?.label ?? '');\n hide();\n };\n\n const onFieldKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n switch (event.key) {\n case 'ArrowDown':\n if (event.altKey || !open) show(event.altKey ? 'selected' : 'first');\n else setActive((i) => (firstEnabled(i + 1, 1) >= 0 ? firstEnabled(i + 1, 1) : firstEnabled(0, 1)));\n break;\n case 'ArrowUp':\n if (!open) show('last');\n else\n setActive((i) =>\n firstEnabled(i - 1, -1) >= 0 ? firstEnabled(i - 1, -1) : firstEnabled(visible.length - 1, -1),\n );\n break;\n case 'Enter':\n if (!open) return;\n if (enabled(active)) choose(visible[active]!);\n break;\n case 'Escape':\n if (open) {\n setQuery(selected?.label ?? '');\n hide();\n } else if (query) {\n setQuery('');\n } else return;\n break;\n case 'Home':\n case 'End':\n // In the text field these move the caret, as users expect.\n return;\n default:\n return;\n }\n event.preventDefault();\n };\n\n const activeId = open && active >= 0 ? `${optionId}-${active}` : undefined;\n\n return (\n <span className={cx(styles.wrap, className)} style={style}>\n <input\n {...rest}\n {...control}\n ref={inputRef}\n type=\"text\"\n role=\"combobox\"\n autoComplete=\"off\"\n aria-autocomplete=\"list\"\n aria-expanded={open}\n aria-controls={listId}\n aria-activedescendant={activeId}\n placeholder={placeholder}\n value={query}\n className={cx(styles.input({ size }), styles.field)}\n style={{ anchorName: anchor } as CSSProperties}\n onChange={(event) => {\n setQuery(event.target.value);\n setFiltering(true);\n setOpen(true);\n const matches = options.filter((o) => filter(o, event.target.value));\n setActive(firstEnabledOf(matches));\n }}\n onKeyDown={onFieldKeyDown}\n onBlur={(event) => {\n onBlur?.(event);\n settle();\n }}\n onClick={() => !open && show()}\n />\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={toggleLabel}\n aria-expanded={open}\n aria-controls={listId}\n className={styles.toggle}\n disabled={control.disabled}\n // Keep focus in the field.\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n if (open) hide();\n else show();\n inputRef.current?.focus();\n }}\n >\n <Icon icon={iconChevronDown} size={18} />\n </button>\n {name && <input type=\"hidden\" name={name} value={value} />}\n <div\n ref={panelRef}\n popover=\"manual\"\n className={cx(styles.popover({ placement: 'bottom-start' }), styles.panel)}\n style={{ positionAnchor: anchor } as CSSProperties}\n // Clicks inside must not blur the field.\n onPointerDown={(event) => event.preventDefault()}\n >\n {/* The combobox pattern needs ARIA listbox and option roles: focus stays in the field\n and aria-activedescendant points at the active option. A native <select> or\n <datalist> can be neither styled nor filtered like this. */}\n {/* oxlint-disable-next-line jsx-a11y/prefer-tag-over-role */}\n <div id={listId} role=\"listbox\" className={styles.listbox} aria-label={rest['aria-label']}>\n {visible.map((option, index) => (\n // Options are chosen with the keyboard from the field (see onFieldKeyDown), so they\n // take no focus and no key handlers of their own.\n // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus\n <div\n key={option.value}\n id={`${optionId}-${index}`}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"option\"\n aria-selected={option.value === value}\n aria-disabled={option.disabled || undefined}\n data-active={index === active ? '' : undefined}\n className={styles.option}\n onPointerMove={() => enabled(index) && index !== active && setActive(index)}\n onClick={() => choose(option)}\n >\n <span className={styles.optionText}>\n <span>{filtering ? <Highlight text={option.label} query={query} /> : option.label}</span>\n {option.description && (\n <span className={styles.optionDescription}>\n {filtering ? <Highlight text={option.description} query={query} /> : option.description}\n </span>\n )}\n </span>\n <Icon icon={iconCheck} size={16} className={styles.check} />\n </div>\n ))}\n </div>\n {/* Always present, so screen readers announce the text when it appears. */}\n <output className={styles.empty}>{visible.length === 0 ? emptyText : null}</output>\n </div>\n </span>\n );\n}\n\nfunction firstEnabledOf(list: ComboboxOption[]) {\n return list.findIndex((o) => !o.disabled);\n}\nfunction lastEnabledOf(list: ComboboxOption[]) {\n return list.findLastIndex((o) => !o.disabled);\n}\n"],"mappings":";;;;;;;;;;;AA4BA,MAAM,QAAQ,SACZ,KACG,UAAU,KAAK,CAAC,CAChB,QAAQ,eAAe,EAAE,CAAC,CAC1B,YAAY;AAEjB,MAAa,iBAAiB,QAAwB,UAAkB;CACtE,MAAM,IAAI,KAAK,MAAM,KAAK,CAAC;CAC3B,OAAO,CAAC,KAAK,KAAK,OAAO,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,KAAK,OAAO,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC;AAC1F;;AAGA,SAAS,UAAU,EAAE,MAAM,SAA0C;CACnE,MAAM,IAAI,KAAK,MAAM,KAAK,CAAC;CAC3B,IAAI,CAAC,GAAG,OAAO,oBAAA,UAAA,EAAA,UAAG,KAAO,CAAA;CAEzB,MAAM,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,KA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}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
3
|
+
// src/components/combobox/combobox.css.ts
|
|
4
|
+
var check = "ml_1ouolxs8";
|
|
5
|
+
var empty = "ml_1ouolxsa";
|
|
6
|
+
var field = "ml_1ouolxs1";
|
|
7
|
+
var input = createRuntimeFn({
|
|
8
|
+
defaultClassName: "ml_18bh0930",
|
|
9
|
+
variantClassNames: { size: {
|
|
10
|
+
sm: "ml_size_sm_18bh0931",
|
|
11
|
+
md: "ml_size_md_18bh0932",
|
|
12
|
+
lg: "ml_size_lg_18bh0933"
|
|
13
|
+
} },
|
|
14
|
+
defaultVariants: { size: "md" },
|
|
15
|
+
compoundVariants: []
|
|
16
|
+
});
|
|
17
|
+
var listbox = "ml_1ouolxs4";
|
|
18
|
+
var match = "ml_1ouolxs9";
|
|
19
|
+
var option = "ml_1ouolxs5";
|
|
20
|
+
var optionDescription = "ml_1ouolxs7";
|
|
21
|
+
var optionText = "ml_1ouolxs6";
|
|
22
|
+
var panel = "ml_1ouolxs3";
|
|
23
|
+
var popover = createRuntimeFn({
|
|
24
|
+
defaultClassName: "ml_12557yp0",
|
|
25
|
+
variantClassNames: { placement: {
|
|
26
|
+
top: "ml_placement_top_12557yp1",
|
|
27
|
+
"top-start": "ml_placement_top-start_12557yp2",
|
|
28
|
+
"top-end": "ml_placement_top-end_12557yp3",
|
|
29
|
+
bottom: "ml_placement_bottom_12557yp4",
|
|
30
|
+
"bottom-start": "ml_placement_bottom-start_12557yp5",
|
|
31
|
+
"bottom-end": "ml_placement_bottom-end_12557yp6",
|
|
32
|
+
start: "ml_placement_start_12557yp7",
|
|
33
|
+
end: "ml_placement_end_12557yp8"
|
|
34
|
+
} },
|
|
35
|
+
defaultVariants: { placement: "bottom-start" },
|
|
36
|
+
compoundVariants: []
|
|
37
|
+
});
|
|
38
|
+
var toggle = "ml_1ouolxs2";
|
|
39
|
+
var wrap = "ml_1ouolxs0";
|
|
40
|
+
export { check, empty, field, input, listbox, match, option, optionDescription, optionText, panel, popover, toggle, wrap };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=combobox.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.styles.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.css.d.ts","names":[],"sources":["../../../src/components/dialog/dialog.css.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog.css.d.ts","names":[],"sources":["../../../src/components/dialog/dialog.css.ts"],"mappings":";;cAWM;qBAmBO,2CAAM;;;;;;;;;;SA4BE;;;;;SACA;;;;;SACA;;;;;YAMT,iBAAiB,YAAY,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","names":["styles.DialogVariants"],"sources":["../../../src/components/dialog/dialog.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","names":["styles.DialogVariants"],"sources":["../../../src/components/dialog/dialog.tsx"],"mappings":";;;iBAiBiB,oBAAoB,KAAK;EACxC;EACA,eAAe;;EAEf,OAAO;EACP,cAAc;;EAEd,YAAYA;EACZ,OAAOA;;;;;EAKP;EACA;;EAEA;EACA,WAAW;;;;;;wBAUG,SACd,MACA,cACA,OACA,aACA,WACA,MACA,aACA,MACA,YACA,WACA,aACG,QACF,8BAAW,IAAA;;wBAgJE,aAAa,cAAc,QAAQ,+CAA4B,IAAA;;;;;wBAQ/D,gBAAgB,cAAc,QAAQ,+CAA4B,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["title","description","styles.dialog","styles.dragArea","styles.handle","styles.header","styles.title","styles.body","styles.actions"],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n type ComponentPropsWithRef,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from 'react';\nimport { iconClose } from '@mohirlab/icons';\nimport { mq } from '@mohirlab/sprinkles';\nimport { usePresence } from '../../hooks/use-presence';\nimport { cx } from '../../utils/cx';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport * as styles from './dialog.css';\n\nexport interface DialogProps extends Omit<ComponentPropsWithRef<'dialog'>, 'open' | 'title' | 'role'> {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Required: names the dialog for assistive technology. */\n title: ReactNode;\n description?: ReactNode;\n /** `auto` (default): bottom sheet on phones, centered from tablet up. */\n placement?: styles.DialogVariants['placement'];\n size?: styles.DialogVariants['size'];\n /**\n * Whether Escape, the backdrop and the close button may dismiss it. Turn off for\n * decisions the user must make; pair with `role=\"alertdialog\"`.\n */\n dismissible?: boolean;\n role?: 'dialog' | 'alertdialog';\n /** Label of the close button, for localisation. */\n closeLabel?: string;\n children?: ReactNode;\n}\n\nconst DISMISS_DISTANCE = 0.3; // fraction of the sheet's height\nconst DISMISS_VELOCITY = 0.6; // px per ms\n\n/**\n * A modal dialog on the native `<dialog>` element: the browser traps focus, makes the\n * rest of the page inert, handles Escape and returns focus when it closes.\n */\nexport function Dialog({\n open,\n onOpenChange,\n title,\n description,\n placement = 'auto',\n size,\n dismissible = true,\n role = 'dialog',\n closeLabel = 'Close',\n className,\n children,\n ...rest\n}: DialogProps) {\n const ref = useRef<HTMLDialogElement>(null);\n const titleId = useId();\n const descriptionId = useId();\n const { mounted, state } = usePresence(open, ref, {\n onExitComplete: () => ref.current?.open && ref.current.close(),\n });\n\n // Open as a modal as soon as the element exists.\n useLayoutEffect(() => {\n const el = ref.current;\n if (mounted && open && el && !el.open) el.showModal();\n }, [mounted, open]);\n\n // The page behind must not scroll while a modal is open.\n useEffect(() => {\n if (!mounted) return;\n const root = document.documentElement;\n const previous = root.style.overflow;\n root.style.overflow = 'hidden';\n return () => {\n root.style.overflow = previous;\n };\n }, [mounted]);\n\n const requestClose = () => {\n if (dismissible) onOpenChange(false);\n };\n\n // --- Drag a sheet down to dismiss it --------------------------------------------\n const drag = useRef<{ startY: number; startTime: number; dy: number } | null>(null);\n const isSheetNow = () =>\n placement === 'sheet' || (placement === 'auto' && !window.matchMedia(mq('tablet')).matches);\n\n const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!dismissible || !isSheetNow() || (event.target as Element).closest('button, a, input')) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n drag.current = { startY: event.clientY, startTime: performance.now(), dy: 0 };\n };\n const onPointerMove = (event: ReactPointerEvent<HTMLDivElement>) => {\n const el = ref.current;\n if (!drag.current || !el) return;\n drag.current.dy = Math.max(0, event.clientY - drag.current.startY);\n el.style.transition = 'none';\n el.style.transform = `translateY(${drag.current.dy}px)`;\n };\n const onPointerUp = () => {\n const el = ref.current;\n const current = drag.current;\n drag.current = null;\n if (!current || !el) return;\n const velocity = current.dy / Math.max(1, performance.now() - current.startTime);\n if (current.dy > el.offsetHeight * DISMISS_DISTANCE || velocity > DISMISS_VELOCITY) {\n // The exit animation continues from where the finger let go.\n onOpenChange(false);\n return;\n }\n el.style.transition = '';\n el.style.transform = '';\n };\n\n // Reset any drag offset once the sheet has gone.\n useEffect(() => {\n if (!mounted && ref.current) {\n ref.current.style.transform = '';\n ref.current.style.transition = '';\n }\n }, [mounted]);\n\n if (!mounted) return null;\n\n return (\n // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- backdrop click; Escape is the keyboard equivalent\n <dialog\n {...rest}\n ref={ref}\n role={role === 'alertdialog' ? 'alertdialog' : undefined}\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n data-state={state}\n data-placement={placement}\n className={cx(styles.dialog({ placement, size }), className)}\n onCancel={(event) => {\n // Escape: we close through state so the exit animation can run.\n event.preventDefault();\n requestClose();\n }}\n onClose={() => {\n // Closed by the browser or a <form method=\"dialog\">: keep state in sync.\n if (open) onOpenChange(false);\n }}\n onClick={(event) => {\n // A click on the backdrop lands on the <dialog> itself, outside its box.\n if (event.target !== ref.current) return;\n const box = ref.current.getBoundingClientRect();\n const inside =\n event.clientX >= box.left &&\n event.clientX <= box.right &&\n event.clientY >= box.top &&\n event.clientY <= box.bottom;\n if (!inside) requestClose();\n }}\n >\n <div\n className={styles.dragArea}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n <span className={styles.handle} aria-hidden=\"true\" />\n <div className={styles.header}>\n <h2 id={titleId} className={styles.title}>\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className={styles.description}>\n {description}\n </p>\n )}\n </div>\n </div>\n {children}\n {/* Last in tab order, so focus starts in the content; shown top-right. */}\n {dismissible && (\n <span className={styles.close}>\n <Button\n appearance=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n iconOnly\n aria-label={closeLabel}\n onClick={requestClose}\n >\n <Icon icon={iconClose} />\n </Button>\n </span>\n )}\n </dialog>\n );\n}\n\n/** Scrollable content area of a dialog. */\nexport function DialogBody({ className, ...rest }: ComponentPropsWithRef<'div'>) {\n return <div {...rest} className={cx(styles.body, className)} />;\n}\n\n/**\n * The dialog's buttons. Put the primary action last: it lands on the right of a\n * centered dialog and on top of the full-width stack in a sheet.\n */\nexport function DialogActions({ className, ...rest }: ComponentPropsWithRef<'div'>) {\n return <div {...rest} className={cx(styles.actions, className)} />;\n}\n"],"mappings":";;;;;;;;;;AAqCA,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;;;;;AAMzB,SAAgB,OAAO,EACrB,MACA,cACAA,OAAAA,SACAC,aAAAA,eACA,YAAY,QACZ,MACA,cAAc,MACd,OAAO,UACP,aAAa,SACb,WACA,UACA,GAAG,QACW;CACd,MAAM,MAAM,OAA0B,IAAI;CAC1C,MAAM,UAAU,MAAM;CACtB,MAAM,gBAAgB,MAAM;CAC5B,MAAM,EAAE,SAAS,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,UAAAA;KACA,CAAA,CAEF;IACF,CAAA,CAAA;;GACJ;GAEA,eACC,oBAAC,QAAD;IAAM,WAAW;IACf,UAAA,oBAAC,QAAD;KACE,YAAW;KACX,MAAK;KACL,MAAK;KACL,UAAA;KACA,cAAY;KACZ,SAAS;KAET,UAAA,oBAAC,MAAD,EAAM,MAAM,UAAY,CAAA;IAClB,CAAA;GACJ,CAAA;EAEF;;AAEZ;;AAGA,SAAgB,WAAW,EAAE,WAAW,GAAG,QAAsC;CAC/E,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAGM,MAAa,SAAS;CAAI,CAAA;AAChE;;;;;AAMA,SAAgB,cAAc,EAAE,WAAW,GAAG,QAAsC;CAClF,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAGC,SAAgB,SAAS;CAAI,CAAA;AACnE"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["title","description","styles.dialog","styles.dragArea","styles.handle","styles.header","styles.title","styles.body","styles.actions"],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n type ComponentPropsWithRef,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n} from 'react';\nimport { iconClose } from '@mohirlab/icons';\nimport { mq } from '@mohirlab/sprinkles';\nimport { usePresence } from '../../hooks/use-presence';\nimport { cx } from '../../utils/cx';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport * as styles from './dialog.css';\n\nexport interface DialogProps extends Omit<ComponentPropsWithRef<'dialog'>, 'open' | 'title' | 'role'> {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Required: names the dialog for assistive technology. */\n title: ReactNode;\n description?: ReactNode;\n /** `auto` (default): bottom sheet on phones, centered from tablet up. */\n placement?: styles.DialogVariants['placement'];\n size?: styles.DialogVariants['size'];\n /**\n * Whether Escape, the backdrop and the close button may dismiss it. Turn off for\n * decisions the user must make; pair with `role=\"alertdialog\"`.\n */\n dismissible?: boolean;\n role?: 'dialog' | 'alertdialog';\n /** Label of the close button, for localisation. */\n closeLabel?: string;\n children?: ReactNode;\n}\n\nconst DISMISS_DISTANCE = 0.3; // fraction of the sheet's height\nconst DISMISS_VELOCITY = 0.6; // px per ms\n\n/**\n * A modal dialog on the native `<dialog>` element: the browser traps focus, makes the\n * rest of the page inert, handles Escape and returns focus when it closes.\n */\nexport function Dialog({\n open,\n onOpenChange,\n title,\n description,\n placement = 'auto',\n size,\n dismissible = true,\n role = 'dialog',\n closeLabel = 'Close',\n className,\n children,\n ...rest\n}: DialogProps) {\n const ref = useRef<HTMLDialogElement>(null);\n const titleId = useId();\n const descriptionId = useId();\n const { mounted, state } = usePresence(open, ref, {\n onExitComplete: () => ref.current?.open && ref.current.close(),\n });\n\n // Open as a modal as soon as the element exists.\n useLayoutEffect(() => {\n const el = ref.current;\n if (mounted && open && el && !el.open) el.showModal();\n }, [mounted, open]);\n\n // The page behind must not scroll while a modal is open.\n useEffect(() => {\n if (!mounted) return;\n const root = document.documentElement;\n const previous = root.style.overflow;\n root.style.overflow = 'hidden';\n return () => {\n root.style.overflow = previous;\n };\n }, [mounted]);\n\n const requestClose = () => {\n if (dismissible) onOpenChange(false);\n };\n\n // --- Drag a sheet down to dismiss it --------------------------------------------\n const drag = useRef<{ startY: number; startTime: number; dy: number } | null>(null);\n const isSheetNow = () =>\n placement === 'sheet' || (placement === 'auto' && !window.matchMedia(mq('tablet')).matches);\n\n const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {\n if (!dismissible || !isSheetNow() || (event.target as Element).closest('button, a, input')) return;\n event.currentTarget.setPointerCapture(event.pointerId);\n drag.current = { startY: event.clientY, startTime: performance.now(), dy: 0 };\n };\n const onPointerMove = (event: ReactPointerEvent<HTMLDivElement>) => {\n const el = ref.current;\n if (!drag.current || !el) return;\n drag.current.dy = Math.max(0, event.clientY - drag.current.startY);\n el.style.transition = 'none';\n el.style.transform = `translateY(${drag.current.dy}px)`;\n };\n const onPointerUp = () => {\n const el = ref.current;\n const current = drag.current;\n drag.current = null;\n if (!current || !el) return;\n const velocity = current.dy / Math.max(1, performance.now() - current.startTime);\n if (current.dy > el.offsetHeight * DISMISS_DISTANCE || velocity > DISMISS_VELOCITY) {\n // The exit animation continues from where the finger let go.\n onOpenChange(false);\n return;\n }\n el.style.transition = '';\n el.style.transform = '';\n };\n\n // Reset any drag offset once the sheet has gone.\n useEffect(() => {\n if (!mounted && ref.current) {\n ref.current.style.transform = '';\n ref.current.style.transition = '';\n }\n }, [mounted]);\n\n if (!mounted) return null;\n\n return (\n // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- backdrop click; Escape is the keyboard equivalent\n <dialog\n {...rest}\n ref={ref}\n role={role === 'alertdialog' ? 'alertdialog' : undefined}\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n data-state={state}\n data-placement={placement}\n className={cx(styles.dialog({ placement, size }), className)}\n onCancel={(event) => {\n // Escape: we close through state so the exit animation can run.\n event.preventDefault();\n requestClose();\n }}\n onClose={() => {\n // Closed by the browser or a <form method=\"dialog\">: keep state in sync.\n if (open) onOpenChange(false);\n }}\n onClick={(event) => {\n // A click on the backdrop lands on the <dialog> itself, outside its box.\n if (event.target !== ref.current) return;\n const box = ref.current.getBoundingClientRect();\n const inside =\n event.clientX >= box.left &&\n event.clientX <= box.right &&\n event.clientY >= box.top &&\n event.clientY <= box.bottom;\n if (!inside) requestClose();\n }}\n >\n <div\n className={styles.dragArea}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n <span className={styles.handle} aria-hidden=\"true\" />\n <div className={styles.header}>\n <h2 id={titleId} className={styles.title}>\n {title}\n </h2>\n {description && (\n <p id={descriptionId} className={styles.description}>\n {description}\n </p>\n )}\n </div>\n </div>\n {children}\n {/* Last in tab order, so focus starts in the content; shown top-right. */}\n {dismissible && (\n <span className={styles.close}>\n <Button\n appearance=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n iconOnly\n aria-label={closeLabel}\n onClick={requestClose}\n >\n <Icon icon={iconClose} />\n </Button>\n </span>\n )}\n </dialog>\n );\n}\n\n/** Scrollable content area of a dialog. */\nexport function DialogBody({ className, ...rest }: ComponentPropsWithRef<'div'>) {\n return <div {...rest} className={cx(styles.body, className)} />;\n}\n\n/**\n * The dialog's buttons. Put the primary action last: it lands on the right of a\n * centered dialog and on top of the full-width stack in a sheet.\n */\nexport function DialogActions({ className, ...rest }: ComponentPropsWithRef<'div'>) {\n return <div {...rest} className={cx(styles.actions, className)} />;\n}\n"],"mappings":";;;;;;;;;;;AAqCA,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;;;;;AAMzB,SAAgB,OAAO,EACrB,MACA,cACAA,OAAAA,SACAC,aAAAA,eACA,YAAY,QACZ,MACA,cAAc,MACd,OAAO,UACP,aAAa,SACb,WACA,UACA,GAAG,QACW;CACd,MAAM,MAAM,OAA0B,IAAI;CAC1C,MAAM,UAAU,MAAM;CACtB,MAAM,gBAAgB,MAAM;CAC5B,MAAM,EAAE,SAAS,UAAU,YAAY,MAAM,KAAK,EAChD,sBAAsB,IAAI,SAAS,QAAQ,IAAI,QAAQ,MAAM,EAC/D,CAAC;CAGD,sBAAsB;EACpB,MAAM,KAAK,IAAI;EACf,IAAI,WAAW,QAAQ,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU;CACtD,GAAG,CAAC,SAAS,IAAI,CAAC;CAGlB,gBAAgB;EACd,IAAI,CAAC,SAAS;EACd,MAAM,OAAO,SAAS;EACtB,MAAM,WAAW,KAAK,MAAM;EAC5B,KAAK,MAAM,WAAW;EACtB,aAAa;GACX,KAAK,MAAM,WAAW;EACxB;CACF,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,qBAAqB;EACzB,IAAI,aAAa,aAAa,KAAK;CACrC;CAGA,MAAM,OAAO,OAAiE,IAAI;C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SAAgB,SAAS;CAAI,CAAA;AACnE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
import { RecipeVariants } from "@vanilla-extract/recipes";
|
|
3
|
+
export declare const skeleton: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
4
|
+
shape: {
|
|
5
|
+
text: {
|
|
6
|
+
height: "0.75em";
|
|
7
|
+
marginBlock: "0.375em";
|
|
8
|
+
borderRadius: `var(--${string})`;
|
|
9
|
+
};
|
|
10
|
+
circle: {
|
|
11
|
+
borderRadius: `var(--${string})`;
|
|
12
|
+
aspectRatio: "1";
|
|
13
|
+
};
|
|
14
|
+
block: {
|
|
15
|
+
borderRadius: `var(--${string})`;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export type SkeletonVariants = NonNullable<RecipeVariants<typeof skeleton>>;
|
|
20
|
+
export declare const empty: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
21
|
+
size: {
|
|
22
|
+
sm: {
|
|
23
|
+
paddingBlock: `var(--${string})`;
|
|
24
|
+
};
|
|
25
|
+
md: {
|
|
26
|
+
paddingBlock: `var(--${string})`;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/** A dashed paper edge, for drop zones and empty panels inside a page. */
|
|
30
|
+
framed: {
|
|
31
|
+
true: {
|
|
32
|
+
border: `1px dashed var(--${string})`;
|
|
33
|
+
borderRadius: `var(--${string})`;
|
|
34
|
+
};
|
|
35
|
+
false: {};
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
export type EmptyStateVariants = NonNullable<RecipeVariants<typeof empty>>;
|
|
39
|
+
//# sourceMappingURL=feedback.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.css.d.ts","names":[],"sources":["../../../src/components/feedback/feedback.css.ts"],"mappings":";;qBAYa,6CAAQ;;;;;;;;;;;;MAcN;;;;YAMH,mBAAmB,YAAY,sBAAsB;qBAOpD,0CAAK;;IAYZ;MAAM;;IACN;MAAM;;;;;;;;;;;;YAWA,qBAAqB,YAAY,sBAAsB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
import { IconData } from "@mohirlab/icons";
|
|
4
|
+
import { EmptyStateVariants, SkeletonVariants } from "./feedback.css.js";
|
|
5
|
+
type Length = number | string;
|
|
6
|
+
export interface SkeletonProps extends Omit<ComponentPropsWithRef<'span'>, 'children'> {
|
|
7
|
+
/** `text` follows the font size, `circle` is for avatars, `block` for images and cards. */
|
|
8
|
+
shape?: SkeletonVariants['shape'];
|
|
9
|
+
/** For `text`: how many lines. The last one is shorter. Default 1. */
|
|
10
|
+
lines?: number;
|
|
11
|
+
width?: Length;
|
|
12
|
+
/** For `block`. */
|
|
13
|
+
height?: Length;
|
|
14
|
+
/** For `circle`: the diameter. */
|
|
15
|
+
size?: Length;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A placeholder in the shape of content that is still loading. It is hidden from
|
|
19
|
+
* assistive technology: mark the loading region with `aria-busy="true"` and give it a
|
|
20
|
+
* name or a status message, so screen reader users hear that something is loading.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Skeleton({ shape, lines, width, height, size, className, style, ...rest }: SkeletonProps): import("react").JSX.Element;
|
|
23
|
+
export interface EmptyStateProps extends Omit<ComponentPropsWithRef<'div'>, 'title'> {
|
|
24
|
+
/** Shown in the seal tile above the title. */
|
|
25
|
+
icon?: IconData;
|
|
26
|
+
title: ReactNode;
|
|
27
|
+
/** One or two sentences: why it is empty and what to do next. */
|
|
28
|
+
description?: ReactNode;
|
|
29
|
+
/** Usually one primary `Button`, maybe a secondary one. */
|
|
30
|
+
actions?: ReactNode;
|
|
31
|
+
/** `sm` inside panels and cards, `md` for a whole page or table. */
|
|
32
|
+
size?: EmptyStateVariants['size'];
|
|
33
|
+
/** Dashed edge: for empty panels inside a page and drop zones. */
|
|
34
|
+
framed?: boolean;
|
|
35
|
+
/** Heading level of the title. Default 2. */
|
|
36
|
+
level?: 2 | 3 | 4;
|
|
37
|
+
}
|
|
38
|
+
/** What a list, table or page shows when there is nothing in it yet, or no results. */
|
|
39
|
+
export declare function EmptyState({ icon, title, description, actions, size, framed, level, className, children, ...rest }: EmptyStateProps): import("react").JSX.Element;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","names":["styles.SkeletonVariants","styles.EmptyStateVariants"],"sources":["../../../src/components/feedback/feedback.tsx"],"mappings":";;;;KAMK;iBAGY,sBAAsB,KAAK;;EAE1C,QAAQA;;EAER;EACA,QAAQ;;EAER,SAAS;;EAET,OAAO;;;;;;;wBAQO,WACd,OACA,OACA,OACA,QACA,MACA,WACA,UACG,QACF,gCAAa,IAAA;iBAsBC,wBAAwB,KAAK;;EAE5C,OAAO;EACP,OAAO;;EAEP,cAAc;;EAEd,UAAU;;EAEV,OAAOC;;EAEP;;EAEA;;;wBAIc,aACd,MACA,OACA,aACA,SACA,MACA,QACA,OACA,WACA,aACG,QACF,kCAAe,IAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import { Icon } from "../icon/icon.js";
|
|
4
|
+
import { empty, emptyTitle, skeleton, skeletonLines } from "./feedback.styles.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/feedback/feedback.tsx
|
|
7
|
+
const toLength = (value) => typeof value === "number" ? `${value}px` : value;
|
|
8
|
+
/**
|
|
9
|
+
* A placeholder in the shape of content that is still loading. It is hidden from
|
|
10
|
+
* assistive technology: mark the loading region with `aria-busy="true"` and give it a
|
|
11
|
+
* name or a status message, so screen reader users hear that something is loading.
|
|
12
|
+
*/
|
|
13
|
+
function Skeleton({ shape = "text", lines = 1, width, height, size, className, style, ...rest }) {
|
|
14
|
+
const box = {
|
|
15
|
+
width: toLength(shape === "circle" ? size : width),
|
|
16
|
+
height: toLength(shape === "circle" ? void 0 : height),
|
|
17
|
+
...style
|
|
18
|
+
};
|
|
19
|
+
if (shape === "circle" && box.width === void 0) box.width = "2.5rem";
|
|
20
|
+
if (shape === "text" && lines > 1) return /* @__PURE__ */ jsx("span", {
|
|
21
|
+
...rest,
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: cx(skeletonLines, className),
|
|
24
|
+
style: box,
|
|
25
|
+
children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx("span", { className: cx(skeleton({ shape }), i === lines - 1 && "ml_5ga6w26") }, i))
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsx("span", {
|
|
28
|
+
...rest,
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
className: cx(skeleton({ shape }), className),
|
|
31
|
+
style: box
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** What a list, table or page shows when there is nothing in it yet, or no results. */
|
|
35
|
+
function EmptyState({ icon, title, description, actions, size, framed, level = 2, className, children, ...rest }) {
|
|
36
|
+
const Heading = `h${level}`;
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
...rest,
|
|
39
|
+
className: cx(empty({
|
|
40
|
+
size,
|
|
41
|
+
framed
|
|
42
|
+
}), className),
|
|
43
|
+
children: [
|
|
44
|
+
icon && /* @__PURE__ */ jsx("span", {
|
|
45
|
+
className: "ml_5ga6w2c",
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
48
|
+
icon,
|
|
49
|
+
size: 22
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
53
|
+
className: emptyTitle,
|
|
54
|
+
children: title
|
|
55
|
+
}),
|
|
56
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
57
|
+
className: "ml_5ga6w2e",
|
|
58
|
+
children: description
|
|
59
|
+
}),
|
|
60
|
+
children,
|
|
61
|
+
actions && /* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "ml_5ga6w2f",
|
|
63
|
+
children: actions
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export { EmptyState, Skeleton };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.js","names":["styles.skeletonLines","styles.skeleton","styles.empty","styles.emptyTitle"],"sources":["../../../src/components/feedback/feedback.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, CSSProperties, ReactNode } from 'react';\nimport type { IconData } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './feedback.css';\n\ntype Length = number | string;\nconst toLength = (value: Length | undefined) => (typeof value === 'number' ? `${value}px` : value);\n\nexport interface SkeletonProps extends Omit<ComponentPropsWithRef<'span'>, 'children'> {\n /** `text` follows the font size, `circle` is for avatars, `block` for images and cards. */\n shape?: styles.SkeletonVariants['shape'];\n /** For `text`: how many lines. The last one is shorter. Default 1. */\n lines?: number;\n width?: Length;\n /** For `block`. */\n height?: Length;\n /** For `circle`: the diameter. */\n size?: Length;\n}\n\n/**\n * A placeholder in the shape of content that is still loading. It is hidden from\n * assistive technology: mark the loading region with `aria-busy=\"true\"` and give it a\n * name or a status message, so screen reader users hear that something is loading.\n */\nexport function Skeleton({\n shape = 'text',\n lines = 1,\n width,\n height,\n size,\n className,\n style,\n ...rest\n}: SkeletonProps) {\n const box: CSSProperties = {\n width: toLength(shape === 'circle' ? size : width),\n height: toLength(shape === 'circle' ? undefined : height),\n ...style,\n };\n if (shape === 'circle' && box.width === undefined) box.width = '2.5rem';\n\n if (shape === 'text' && lines > 1) {\n return (\n <span {...rest} aria-hidden=\"true\" className={cx(styles.skeletonLines, className)} style={box}>\n {Array.from({ length: lines }, (_, i) => (\n <span key={i} className={cx(styles.skeleton({ shape }), i === lines - 1 && styles.lastLine)} />\n ))}\n </span>\n );\n }\n return (\n <span {...rest} aria-hidden=\"true\" className={cx(styles.skeleton({ shape }), className)} style={box} />\n );\n}\n\nexport interface EmptyStateProps extends Omit<ComponentPropsWithRef<'div'>, 'title'> {\n /** Shown in the seal tile above the title. */\n icon?: IconData;\n title: ReactNode;\n /** One or two sentences: why it is empty and what to do next. */\n description?: ReactNode;\n /** Usually one primary `Button`, maybe a secondary one. */\n actions?: ReactNode;\n /** `sm` inside panels and cards, `md` for a whole page or table. */\n size?: styles.EmptyStateVariants['size'];\n /** Dashed edge: for empty panels inside a page and drop zones. */\n framed?: boolean;\n /** Heading level of the title. Default 2. */\n level?: 2 | 3 | 4;\n}\n\n/** What a list, table or page shows when there is nothing in it yet, or no results. */\nexport function EmptyState({\n icon,\n title,\n description,\n actions,\n size,\n framed,\n level = 2,\n className,\n children,\n ...rest\n}: EmptyStateProps) {\n const Heading = `h${level}` as const;\n return (\n <div {...rest} className={cx(styles.empty({ size, framed }), className)}>\n {icon && (\n <span className={styles.emptyMark} aria-hidden=\"true\">\n <Icon icon={icon} size={22} />\n </span>\n )}\n <Heading className={styles.emptyTitle}>{title}</Heading>\n {description && <p className={styles.emptyText}>{description}</p>}\n {children}\n {actions && <div className={styles.emptyActions}>{actions}</div>}\n </div>\n );\n}\n"],"mappings":";;;;;;AAOA,MAAM,YAAY,UAA+B,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;;;;;;AAmB5F,SAAgB,SAAS,EACvB,QAAQ,QACR,QAAQ,GACR,OACA,QACA,MACA,WACA,OACA,GAAG,QACa;CAChB,MAAM,MAAqB;EACzB,OAAO,SAAS,UAAU,WAAW,OAAO,KAAK;EACjD,QAAQ,SAAS,UAAU,WAAW,KAAA,IAAY,MAAM;EACxD,GAAG;CACL;CACA,IAAI,UAAU,YAAY,IAAI,UAAU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