nish-ui 2.2.0 → 3.1.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/README.md +10 -6
- package/dist/chart.d.ts +8 -3
- package/dist/chart.js +2 -417
- package/dist/elements-all.js +81 -80
- package/dist/elements-charts.d.ts +7 -1
- package/dist/elements-charts.js +16 -16
- package/dist/elements-data.d.ts +7 -1
- package/dist/elements-data.js +5 -5
- package/dist/elements-forms.d.ts +7 -1
- package/dist/elements-forms.js +18 -17
- package/dist/elements.d.ts +7 -1
- package/dist/elements.js +4 -4
- package/dist/esm/components/accordion.js +3 -2
- package/dist/esm/components/app-shell.js +3 -2
- package/dist/esm/components/avatar.js +6 -5
- package/dist/esm/components/breadcrumbs.js +3 -2
- package/dist/esm/components/calendar-base.js +4 -3
- package/dist/esm/components/canvas/legend.js +7 -6
- package/dist/esm/components/canvas/node.js +3 -2
- package/dist/esm/components/canvas/system-canvas.js +27 -3
- package/dist/esm/components/carousel.js +24 -5
- package/dist/esm/components/charts.js +29 -20
- package/dist/esm/components/combobox.js +4 -3
- package/dist/esm/components/command.js +4 -3
- package/dist/esm/components/context-menu.js +3 -2
- package/dist/esm/components/data-classes.js +5 -4
- package/dist/esm/components/data.js +5 -8
- package/dist/esm/components/date-picker.js +5 -3
- package/dist/esm/components/date-range-picker.js +5 -3
- package/dist/esm/components/display.js +10 -9
- package/dist/esm/components/drawer.js +3 -2
- package/dist/esm/components/error-boundary.js +4 -2
- package/dist/esm/components/feedback.js +7 -6
- package/dist/esm/components/file-dropzone.js +24 -3
- package/dist/esm/components/filters.js +7 -4
- package/dist/esm/components/flow.js +17 -15
- package/dist/esm/components/forms.js +37 -10
- package/dist/esm/components/hooks.js +22 -19
- package/dist/esm/components/hover-card.js +2 -2
- package/dist/esm/components/inbox.js +12 -8
- package/dist/esm/components/layout-vars.js +10 -7
- package/dist/esm/components/layout.js +5 -4
- package/dist/esm/components/media.js +3 -2
- package/dist/esm/components/menu.js +12 -8
- package/dist/esm/components/modal.js +4 -3
- package/dist/esm/components/more-sheet.js +3 -2
- package/dist/esm/components/multi-select.js +10 -6
- package/dist/esm/components/nav-items.js +4 -3
- package/dist/esm/components/nav.js +5 -4
- package/dist/esm/components/overlay-core.js +31 -10
- package/dist/esm/components/overlay-dialog.js +20 -4
- package/dist/esm/components/pagination.js +7 -3
- package/dist/esm/components/popover.js +17 -11
- package/dist/esm/components/portal.js +2 -2
- package/dist/esm/components/primitives.js +1 -1
- package/dist/esm/components/progress.js +5 -2
- package/dist/esm/components/provider.js +34 -5
- package/dist/esm/components/range-calendar.js +4 -3
- package/dist/esm/components/resource-classes.js +34 -16
- package/dist/esm/components/resource.js +5 -4
- package/dist/esm/components/service-tokens.js +4 -3
- package/dist/esm/components/settings.js +8 -5
- package/dist/esm/components/slider.js +4 -2
- package/dist/esm/components/split.js +4 -3
- package/dist/esm/components/strings.js +182 -65
- package/dist/esm/components/tag-input.js +18 -9
- package/dist/esm/components/theme-toggle.js +3 -2
- package/dist/esm/components/time-field-classes.js +5 -2
- package/dist/esm/components/time-field.js +19 -10
- package/dist/esm/components/toast-card.js +155 -0
- package/dist/esm/components/toast-store.js +136 -0
- package/dist/esm/components/toast.js +38 -241
- package/dist/esm/components/tooltip.js +3 -3
- package/dist/esm/components/url-state.js +1 -0
- package/dist/esm/components/virtual-table.js +11 -4
- package/dist/esm/components/virtual.js +16 -2
- package/dist/esm/format.js +17 -14
- package/dist/esm/index.js +0 -20
- package/dist/esm/runtime.js +1 -1
- package/dist/esm/server/inbox/client.js +1 -1
- package/dist/esm/system-canvas.js +4 -0
- package/dist/esm/theme.js +73 -13
- package/dist/format.js +18 -15
- package/dist/inbox-client.js +1 -1
- package/dist/index.d.ts +43 -21
- package/dist/nish-components.css +41 -1
- package/dist/nish-components.min.css +1 -1
- package/dist/node/th-check.js +12 -3
- package/dist/server/hono.d.ts +1 -1
- package/dist/server/hono.js +20 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +19 -5
- package/dist/{spa-BLlMc0eI.d.ts → spa-7myD4xvA.d.ts} +3 -2
- package/dist/system-canvas.d.ts +179 -2
- package/dist/theme.d.ts +23 -5
- package/dist/theme.global.js +87 -151
- package/dist/theme.js +87 -151
- package/package.json +1 -1
- package/dist/system-canvas-BLuWd69H.d.ts +0 -183
|
@@ -12,14 +12,15 @@ import {
|
|
|
12
12
|
import { cn } from "../cn.js";
|
|
13
13
|
import { useIsoLayoutEffect } from "./client.js";
|
|
14
14
|
import { sortRows } from "./data-classes.js";
|
|
15
|
-
import {
|
|
15
|
+
import { useStrings } from "./provider.js";
|
|
16
|
+
import { TABLE_STRINGS, STATUS_STRINGS } from "./strings.js";
|
|
16
17
|
import { useLatest } from "./latest.js";
|
|
17
18
|
import { Table, TableWrap, Td, Th, Tr } from "./table.js";
|
|
18
19
|
import { useVirtualRows } from "./virtual.js";
|
|
19
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
21
|
var HIDE_BELOW = { sm: "hidden sm:table-cell", md: "hidden md:table-cell", lg: "hidden lg:table-cell" };
|
|
21
22
|
var ROW_FOCUS = "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-th-accent";
|
|
22
|
-
var INTERACTIVE_CHILD =
|
|
23
|
+
var INTERACTIVE_CHILD = 'a,button,input,select,textarea,label,summary,[role="button"],[role="link"]';
|
|
23
24
|
function VirtualTable({
|
|
24
25
|
rows,
|
|
25
26
|
columns,
|
|
@@ -46,7 +47,7 @@ function VirtualTable({
|
|
|
46
47
|
ref,
|
|
47
48
|
...rest
|
|
48
49
|
}) {
|
|
49
|
-
const t =
|
|
50
|
+
const t = useStrings(TABLE_STRINGS, STATUS_STRINGS);
|
|
50
51
|
const size = rowHeight ?? (onRowClick ? 44 : dense ? 33 : 41);
|
|
51
52
|
const [innerSort, setInnerSort] = useState(null);
|
|
52
53
|
const [announcement, setAnnouncement] = useState("");
|
|
@@ -99,10 +100,15 @@ function VirtualTable({
|
|
|
99
100
|
const topSpace = indices.length > 0 ? offsetOf(first) : 0;
|
|
100
101
|
const bottomSpace = Math.max(0, total - (last >= 0 ? offsetOf(last) + sizeOf(last) : 0));
|
|
101
102
|
const interactive = !!onRowClick;
|
|
102
|
-
const
|
|
103
|
+
const firstInView = virtual.range.start === 0 ? first : indices.find((i) => i >= virtual.range.start + overscan) ?? first;
|
|
104
|
+
const tabbable = indices.includes(focusIndex) ? focusIndex : firstInView;
|
|
103
105
|
useEffect(() => {
|
|
104
106
|
if (count > 0 && focusIndex > count - 1) setFocusIndex(count - 1);
|
|
105
107
|
}, [count, focusIndex]);
|
|
108
|
+
useIsoLayoutEffect(() => {
|
|
109
|
+
const h = headRef.current?.offsetHeight ?? 0;
|
|
110
|
+
if (scrollRef.current) scrollRef.current.style.scrollPaddingTop = h ? `${h}px` : "";
|
|
111
|
+
});
|
|
106
112
|
useIsoLayoutEffect(() => {
|
|
107
113
|
const body = bodyRef.current;
|
|
108
114
|
if (pendingFocus.current !== null) {
|
|
@@ -126,6 +132,7 @@ function VirtualTable({
|
|
|
126
132
|
};
|
|
127
133
|
const onBodyBlur = (e) => {
|
|
128
134
|
const next = e.relatedTarget;
|
|
135
|
+
if (!next && (!document.hasFocus() || document.activeElement === e.target)) return;
|
|
129
136
|
if (next ? !bodyRef.current?.contains(next) : e.target.isConnected) {
|
|
130
137
|
hadFocus.current = false;
|
|
131
138
|
pin(null);
|
|
@@ -24,6 +24,18 @@ import { mergeRefs, warnOnce } from "./data-classes.js";
|
|
|
24
24
|
import { useLatest } from "./latest.js";
|
|
25
25
|
import { jsx } from "react/jsx-runtime";
|
|
26
26
|
var PIN_REACH = 100;
|
|
27
|
+
function rootPx(style, name) {
|
|
28
|
+
const n = parseFloat(style.getPropertyValue(name));
|
|
29
|
+
return Number.isFinite(n) ? n : 0;
|
|
30
|
+
}
|
|
31
|
+
function windowInsets() {
|
|
32
|
+
if (typeof document === "undefined" || typeof getComputedStyle === "undefined") return { top: 0, bottom: 0 };
|
|
33
|
+
const style = getComputedStyle(document.documentElement);
|
|
34
|
+
const top = rootPx(style, "--nish-header-h") + rootPx(style, "--nish-sticky-extra");
|
|
35
|
+
const raw = style.getPropertyValue("--nish-bottom-inset");
|
|
36
|
+
const bottom = Number.isFinite(parseFloat(raw)) ? parseFloat(raw) : rootPx(style, "--nish-bottom-nav-h") + rootPx(style, "--nish-bottom-bar-h");
|
|
37
|
+
return { top, bottom };
|
|
38
|
+
}
|
|
27
39
|
var byIndex = (i) => i;
|
|
28
40
|
function useVirtualRows(options) {
|
|
29
41
|
const { count, itemSize, getKey, measure, gap, overscan, initialCount, scrollRef, listRef, coverTop, pinMode, onRangeChange } = options;
|
|
@@ -59,8 +71,9 @@ function useVirtualRows(options) {
|
|
|
59
71
|
viewTop = top + cover;
|
|
60
72
|
viewBottom = top + scroller.clientHeight;
|
|
61
73
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
const inset = windowInsets();
|
|
75
|
+
viewTop = latest.current.coverTop ? cover : inset.top;
|
|
76
|
+
viewBottom = window.innerHeight - inset.bottom;
|
|
64
77
|
}
|
|
65
78
|
return { top: viewTop - listTop, bottom: viewBottom - listTop, listTop, viewTop, viewBottom };
|
|
66
79
|
}, [listRef, scrollRef, latest]);
|
|
@@ -238,6 +251,7 @@ function VirtualList({
|
|
|
238
251
|
};
|
|
239
252
|
const onBlur = (e) => {
|
|
240
253
|
const next = e.relatedTarget;
|
|
254
|
+
if (!next && (!document.hasFocus() || document.activeElement === e.target)) return;
|
|
241
255
|
if (!next || !listRef.current?.contains(next)) pin(null);
|
|
242
256
|
};
|
|
243
257
|
const rootStyle = self ? { ...style, height, overflowY: "auto", overflowAnchor: "none", overscrollBehavior: "contain" } : style;
|
package/dist/esm/format.js
CHANGED
|
@@ -80,32 +80,35 @@ function compactAbs(abs, digits, locale) {
|
|
|
80
80
|
function isZeroAfterRounding(v, digits) {
|
|
81
81
|
return Number(Math.abs(v).toFixed(digits)) === 0;
|
|
82
82
|
}
|
|
83
|
-
var
|
|
84
|
-
function
|
|
83
|
+
var currencies = /* @__PURE__ */ new Map();
|
|
84
|
+
function currencyInfo(currency, locale) {
|
|
85
85
|
const key = `${locale}|${currency}`;
|
|
86
|
-
let
|
|
87
|
-
if (
|
|
86
|
+
let info = currencies.get(key);
|
|
87
|
+
if (info === void 0) {
|
|
88
88
|
try {
|
|
89
|
-
const
|
|
89
|
+
const nf2 = new Intl.NumberFormat(locale, {
|
|
90
90
|
style: "currency",
|
|
91
91
|
currency,
|
|
92
92
|
currencyDisplay: "narrowSymbol"
|
|
93
|
-
})
|
|
94
|
-
s =
|
|
93
|
+
});
|
|
94
|
+
let s = nf2.formatToParts(0).find((p) => p.type === "currency")?.value ?? currency;
|
|
95
|
+
if (/\p{L}$/u.test(s)) s += "\xA0";
|
|
96
|
+
info = { symbol: s, digits: nf2.resolvedOptions().maximumFractionDigits ?? 2 };
|
|
95
97
|
} catch {
|
|
96
|
-
|
|
98
|
+
info = { symbol: currency + " ", digits: 2 };
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
currencies.set(key, info);
|
|
99
101
|
}
|
|
100
|
-
return
|
|
102
|
+
return info;
|
|
101
103
|
}
|
|
102
104
|
function moneyAbs(abs, o, locale) {
|
|
103
|
-
const symbol =
|
|
105
|
+
const { symbol, digits } = currencyInfo(o.currency ?? "USD", locale);
|
|
104
106
|
if (o.compact && abs >= 1e3) return symbol + compactAbs(abs, 1, locale);
|
|
105
107
|
const cents = o.cents ?? "auto";
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
|
|
108
|
+
const unit = 10 ** digits;
|
|
109
|
+
const hasCents = Math.round(abs * unit) % unit !== 0;
|
|
110
|
+
const showCents = digits > 0 && (cents === "always" || cents === "auto" && (abs < 1e3 || hasCents));
|
|
111
|
+
return symbol + (showCents ? fixed(abs, digits, digits, locale) : fixed(abs, 0, 0, locale));
|
|
109
112
|
}
|
|
110
113
|
function money(v, o = {}) {
|
|
111
114
|
if (!finite(v)) return DASH;
|
package/dist/esm/index.js
CHANGED
|
@@ -87,12 +87,6 @@ import {
|
|
|
87
87
|
AnimatedList,
|
|
88
88
|
usePrefersReducedMotion
|
|
89
89
|
} from "./components/flow.js";
|
|
90
|
-
import { SystemCanvas, layoutSystem, pickLayout, routeEdges } from "./system-canvas.js";
|
|
91
|
-
import { DEFAULT_CANVAS_LABELS } from "./components/canvas/types.js";
|
|
92
|
-
import { Inbox } from "./components/inbox.js";
|
|
93
|
-
import { DEFAULT_INBOX_LABELS } from "./components/inbox-classes.js";
|
|
94
|
-
import { INBOX_SOURCE_LABELS, INBOX_DEFAULT_SETTINGS } from "./inbox-types.js";
|
|
95
|
-
import { INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS } from "./inbox-types.js";
|
|
96
90
|
import { AppShell } from "./components/app-shell.js";
|
|
97
91
|
import { useResource } from "./components/resource.js";
|
|
98
92
|
import { apiFetch, ApiError, configureApi } from "./components/resource-classes.js";
|
|
@@ -100,7 +94,6 @@ import { AppErrorBoundary } from "./components/error-boundary.js";
|
|
|
100
94
|
import { FilterBar, FilterSheet } from "./components/filters.js";
|
|
101
95
|
import { useUrlState, locationAdapter } from "./components/url-state.js";
|
|
102
96
|
import { SettingsSection, SettingRow, NumberField, useSaveStatus } from "./components/settings.js";
|
|
103
|
-
import { ServiceTokensSection, useServiceTokens } from "./components/service-tokens.js";
|
|
104
97
|
import { Combobox } from "./components/combobox.js";
|
|
105
98
|
import { Calendar } from "./components/calendar.js";
|
|
106
99
|
import { DatePicker } from "./components/date-picker.js";
|
|
@@ -195,8 +188,6 @@ export {
|
|
|
195
188
|
ConnectionBanner,
|
|
196
189
|
ContextMenu,
|
|
197
190
|
CopyButton,
|
|
198
|
-
DEFAULT_CANVAS_LABELS,
|
|
199
|
-
DEFAULT_INBOX_LABELS,
|
|
200
191
|
DEFAULT_STRINGS,
|
|
201
192
|
DEFAULT_THEME,
|
|
202
193
|
DatePicker,
|
|
@@ -215,12 +206,7 @@ export {
|
|
|
215
206
|
FlowSteps,
|
|
216
207
|
HUE_ROLES,
|
|
217
208
|
HoverCard,
|
|
218
|
-
INBOX_ACTION_HEADER,
|
|
219
|
-
INBOX_ACTION_TIMEOUT_MS,
|
|
220
|
-
INBOX_DEFAULT_SETTINGS,
|
|
221
|
-
INBOX_SOURCE_LABELS,
|
|
222
209
|
IconButton,
|
|
223
|
-
Inbox,
|
|
224
210
|
InfoIcon,
|
|
225
211
|
Input,
|
|
226
212
|
Kbd,
|
|
@@ -279,7 +265,6 @@ export {
|
|
|
279
265
|
Segmented,
|
|
280
266
|
Select,
|
|
281
267
|
Separator,
|
|
282
|
-
ServiceTokensSection,
|
|
283
268
|
SettingRow,
|
|
284
269
|
SettingsIcon,
|
|
285
270
|
SettingsSection,
|
|
@@ -301,7 +286,6 @@ export {
|
|
|
301
286
|
StickyBar,
|
|
302
287
|
SunIcon,
|
|
303
288
|
Switch,
|
|
304
|
-
SystemCanvas,
|
|
305
289
|
THEMES,
|
|
306
290
|
TabPanel,
|
|
307
291
|
Table,
|
|
@@ -341,16 +325,13 @@ export {
|
|
|
341
325
|
googleFavicon,
|
|
342
326
|
iconButtonClass,
|
|
343
327
|
isRtl,
|
|
344
|
-
layoutSystem,
|
|
345
328
|
linkClass,
|
|
346
329
|
locationAdapter,
|
|
347
330
|
menuItemClass,
|
|
348
331
|
navigateFromLayer,
|
|
349
332
|
paginationRange,
|
|
350
|
-
pickLayout,
|
|
351
333
|
presetOptions,
|
|
352
334
|
revealClass,
|
|
353
|
-
routeEdges,
|
|
354
335
|
safeUrl,
|
|
355
336
|
setDefaultLocale,
|
|
356
337
|
signTone,
|
|
@@ -377,7 +358,6 @@ export {
|
|
|
377
358
|
useSaveStatus,
|
|
378
359
|
useScrollEdges,
|
|
379
360
|
useScrollSpy,
|
|
380
|
-
useServiceTokens,
|
|
381
361
|
useStuck,
|
|
382
362
|
useTheme,
|
|
383
363
|
useToast,
|
package/dist/esm/runtime.js
CHANGED
|
@@ -265,7 +265,7 @@ function createInboxClient(options) {
|
|
|
265
265
|
if (disabled) return { ok: false, error: "disabled", queued: false };
|
|
266
266
|
if (queue.length > 0) {
|
|
267
267
|
enqueue(parsed.value);
|
|
268
|
-
void flush();
|
|
268
|
+
if (timer === null) void flush();
|
|
269
269
|
return { ok: false, error: "queued behind earlier events", queued: true };
|
|
270
270
|
}
|
|
271
271
|
const result = await attempt(parsed.value);
|
package/dist/esm/theme.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { DEFAULT_THEME, THEMES } from "./tokens.mjs";
|
|
3
3
|
import { shared } from "./runtime.js";
|
|
4
4
|
import { safeUrl } from "./url.js";
|
|
5
|
-
import {
|
|
5
|
+
import { DISPLAY_STRINGS, OVERLAY_STRINGS, THEME_STRINGS } from "./components/strings.js";
|
|
6
6
|
function buildPresets() {
|
|
7
7
|
return Object.keys(THEMES).map((id) => ({
|
|
8
8
|
id,
|
|
@@ -201,9 +201,9 @@ var TOGGLE_ICONS = {
|
|
|
201
201
|
dark: [["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9" }]]
|
|
202
202
|
};
|
|
203
203
|
var defaultToggleLabels = () => ({
|
|
204
|
-
system:
|
|
205
|
-
light:
|
|
206
|
-
dark:
|
|
204
|
+
system: THEME_STRINGS.themeSystem,
|
|
205
|
+
light: THEME_STRINGS.themeLight,
|
|
206
|
+
dark: THEME_STRINGS.themeDark
|
|
207
207
|
});
|
|
208
208
|
var DEFAULT_ELSEWHERE = "set on another site";
|
|
209
209
|
function nextChoice(choice) {
|
|
@@ -217,7 +217,7 @@ function themeLabel(choice, words) {
|
|
|
217
217
|
}
|
|
218
218
|
function mountThemeToggle(button, opts = {}) {
|
|
219
219
|
const words = { ...defaultToggleLabels(), ...opts.labels };
|
|
220
|
-
const sentence = opts.strings?.themeToggleLabel ??
|
|
220
|
+
const sentence = opts.strings?.themeToggleLabel ?? THEME_STRINGS.themeToggleLabel;
|
|
221
221
|
const elsewhereWords = opts.elsewhereLabel ?? DEFAULT_ELSEWHERE;
|
|
222
222
|
if (button.tagName === "BUTTON" && !button.getAttribute("type")) button.setAttribute("type", "button");
|
|
223
223
|
const children = Object.keys(TOGGLE_ICONS).map(
|
|
@@ -341,7 +341,7 @@ function showToast(content, opts = {}) {
|
|
|
341
341
|
const close = document.createElement("button");
|
|
342
342
|
close.type = "button";
|
|
343
343
|
close.className = "nish-toast-close";
|
|
344
|
-
close.setAttribute("aria-label", opts.dismissLabel ?? opts.strings?.dismiss ??
|
|
344
|
+
close.setAttribute("aria-label", opts.dismissLabel ?? opts.strings?.dismiss ?? DISPLAY_STRINGS.dismiss);
|
|
345
345
|
close.append(svgIcon(14, [["path", { d: "M18 6 6 18M6 6l12 12" }]]));
|
|
346
346
|
close.addEventListener("click", hide);
|
|
347
347
|
box.append(close);
|
|
@@ -391,7 +391,7 @@ function confirmDialog(opts) {
|
|
|
391
391
|
b.textContent = label;
|
|
392
392
|
return b;
|
|
393
393
|
};
|
|
394
|
-
const cancelBtn = button(opts.cancelLabel ?? opts.strings?.cancel ??
|
|
394
|
+
const cancelBtn = button(opts.cancelLabel ?? opts.strings?.cancel ?? OVERLAY_STRINGS.cancel, "nish-btn");
|
|
395
395
|
const confirmBtn = button(opts.confirmLabel ?? "Confirm", `nish-btn ${danger ? "nish-btn--danger" : "nish-btn--primary"}`);
|
|
396
396
|
(danger ? cancelBtn : confirmBtn).autofocus = true;
|
|
397
397
|
actions.append(cancelBtn, confirmBtn);
|
|
@@ -648,7 +648,8 @@ function mountStuck(el, onChange) {
|
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
650
|
function mountScrollspy(nav, o = {}) {
|
|
651
|
-
|
|
651
|
+
const noop = Object.assign(() => void 0, { lock: (_id) => void 0 });
|
|
652
|
+
if (typeof document === "undefined") return noop;
|
|
652
653
|
const links = Array.from(nav.querySelectorAll('a[href^="#"]')).filter((a) => a.hash.length > 1);
|
|
653
654
|
const target = (a) => {
|
|
654
655
|
try {
|
|
@@ -659,13 +660,16 @@ function mountScrollspy(nav, o = {}) {
|
|
|
659
660
|
};
|
|
660
661
|
const unheight = o.height === false ? () => void 0 : mountHeightVar(nav, "--nish-sticky-extra");
|
|
661
662
|
let current = null;
|
|
663
|
+
let locked = null;
|
|
664
|
+
let unlockListeners = null;
|
|
662
665
|
const edges = () => {
|
|
663
666
|
const max = nav.scrollWidth - nav.clientWidth;
|
|
664
|
-
|
|
665
|
-
nav.dataset.
|
|
667
|
+
const left = getComputedStyle(nav).direction === "rtl" ? nav.scrollLeft + max : nav.scrollLeft;
|
|
668
|
+
nav.dataset.atStart = String(left <= 1);
|
|
669
|
+
nav.dataset.atEnd = String(max <= 1 || left >= max - 1);
|
|
666
670
|
};
|
|
667
671
|
const reveal = (a) => {
|
|
668
|
-
const left = a.
|
|
672
|
+
const left = a.getBoundingClientRect().left - nav.getBoundingClientRect().left + nav.scrollLeft - nav.clientLeft;
|
|
669
673
|
const view = nav.clientWidth;
|
|
670
674
|
if (left < nav.scrollLeft + 24) nav.scrollLeft = Math.max(0, left - 24);
|
|
671
675
|
else if (left + a.offsetWidth > nav.scrollLeft + view - 24) nav.scrollLeft = left + a.offsetWidth - view + 24;
|
|
@@ -691,7 +695,61 @@ function mountScrollspy(nav, o = {}) {
|
|
|
691
695
|
if (window.innerHeight + window.scrollY >= de.scrollHeight - 2) {
|
|
692
696
|
for (const a of links) if (target(a)) found = a;
|
|
693
697
|
}
|
|
694
|
-
activate(found);
|
|
698
|
+
activate(locked ?? found);
|
|
699
|
+
};
|
|
700
|
+
const unlock = () => {
|
|
701
|
+
unlockListeners?.();
|
|
702
|
+
unlockListeners = null;
|
|
703
|
+
locked = null;
|
|
704
|
+
};
|
|
705
|
+
const lock = (id) => {
|
|
706
|
+
const a = links.find((l) => {
|
|
707
|
+
try {
|
|
708
|
+
return decodeURIComponent(l.hash.slice(1)) === id;
|
|
709
|
+
} catch {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
if (!a) return;
|
|
714
|
+
unlock();
|
|
715
|
+
locked = a;
|
|
716
|
+
activate(a);
|
|
717
|
+
const release = () => {
|
|
718
|
+
unlock();
|
|
719
|
+
schedule();
|
|
720
|
+
};
|
|
721
|
+
const onKey = (e) => {
|
|
722
|
+
if (["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(e.key)) release();
|
|
723
|
+
};
|
|
724
|
+
let settled = false;
|
|
725
|
+
const settle = () => {
|
|
726
|
+
settled = true;
|
|
727
|
+
};
|
|
728
|
+
let t = setTimeout(settle, 400);
|
|
729
|
+
const onScroll = () => {
|
|
730
|
+
if (settled) release();
|
|
731
|
+
else {
|
|
732
|
+
clearTimeout(t);
|
|
733
|
+
t = setTimeout(settle, 200);
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
const onScrollEnd = () => {
|
|
737
|
+
clearTimeout(t);
|
|
738
|
+
t = setTimeout(settle, 50);
|
|
739
|
+
};
|
|
740
|
+
window.addEventListener("wheel", release, { passive: true });
|
|
741
|
+
window.addEventListener("touchstart", release, { passive: true });
|
|
742
|
+
window.addEventListener("keydown", onKey);
|
|
743
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
744
|
+
window.addEventListener("scrollend", onScrollEnd);
|
|
745
|
+
unlockListeners = () => {
|
|
746
|
+
clearTimeout(t);
|
|
747
|
+
window.removeEventListener("wheel", release);
|
|
748
|
+
window.removeEventListener("touchstart", release);
|
|
749
|
+
window.removeEventListener("keydown", onKey);
|
|
750
|
+
window.removeEventListener("scroll", onScroll);
|
|
751
|
+
window.removeEventListener("scrollend", onScrollEnd);
|
|
752
|
+
};
|
|
695
753
|
};
|
|
696
754
|
let frame = 0;
|
|
697
755
|
const schedule = () => {
|
|
@@ -719,7 +777,8 @@ function mountScrollspy(nav, o = {}) {
|
|
|
719
777
|
});
|
|
720
778
|
ro.observe(nav);
|
|
721
779
|
}
|
|
722
|
-
|
|
780
|
+
const stop = () => {
|
|
781
|
+
unlock();
|
|
723
782
|
if (frame) cancelAnimationFrame(frame);
|
|
724
783
|
window.removeEventListener("scroll", schedule);
|
|
725
784
|
window.removeEventListener("resize", schedule);
|
|
@@ -731,6 +790,7 @@ function mountScrollspy(nav, o = {}) {
|
|
|
731
790
|
delete nav.dataset.atStart;
|
|
732
791
|
delete nav.dataset.atEnd;
|
|
733
792
|
};
|
|
793
|
+
return Object.assign(stop, { lock });
|
|
734
794
|
}
|
|
735
795
|
function mountChecklist(list) {
|
|
736
796
|
if (typeof document === "undefined") return () => void 0;
|
package/dist/format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/runtime.ts
|
|
2
|
-
var version = true ? "
|
|
2
|
+
var version = true ? "3.1.0" : "dev";
|
|
3
3
|
var KEY = /* @__PURE__ */ Symbol.for("nish-ui.runtime.v1");
|
|
4
4
|
function runtime() {
|
|
5
5
|
const g = globalThis;
|
|
@@ -106,32 +106,35 @@ function compactAbs(abs, digits, locale) {
|
|
|
106
106
|
function isZeroAfterRounding(v, digits) {
|
|
107
107
|
return Number(Math.abs(v).toFixed(digits)) === 0;
|
|
108
108
|
}
|
|
109
|
-
var
|
|
110
|
-
function
|
|
109
|
+
var currencies = /* @__PURE__ */ new Map();
|
|
110
|
+
function currencyInfo(currency, locale) {
|
|
111
111
|
const key = `${locale}|${currency}`;
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
112
|
+
let info = currencies.get(key);
|
|
113
|
+
if (info === void 0) {
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
115
|
+
const nf2 = new Intl.NumberFormat(locale, {
|
|
116
116
|
style: "currency",
|
|
117
117
|
currency,
|
|
118
118
|
currencyDisplay: "narrowSymbol"
|
|
119
|
-
})
|
|
120
|
-
s =
|
|
119
|
+
});
|
|
120
|
+
let s = nf2.formatToParts(0).find((p) => p.type === "currency")?.value ?? currency;
|
|
121
|
+
if (/\p{L}$/u.test(s)) s += "\xA0";
|
|
122
|
+
info = { symbol: s, digits: nf2.resolvedOptions().maximumFractionDigits ?? 2 };
|
|
121
123
|
} catch {
|
|
122
|
-
|
|
124
|
+
info = { symbol: currency + " ", digits: 2 };
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
currencies.set(key, info);
|
|
125
127
|
}
|
|
126
|
-
return
|
|
128
|
+
return info;
|
|
127
129
|
}
|
|
128
130
|
function moneyAbs(abs, o, locale) {
|
|
129
|
-
const symbol =
|
|
131
|
+
const { symbol, digits } = currencyInfo(o.currency ?? "USD", locale);
|
|
130
132
|
if (o.compact && abs >= 1e3) return symbol + compactAbs(abs, 1, locale);
|
|
131
133
|
const cents = o.cents ?? "auto";
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
|
|
134
|
+
const unit = 10 ** digits;
|
|
135
|
+
const hasCents = Math.round(abs * unit) % unit !== 0;
|
|
136
|
+
const showCents = digits > 0 && (cents === "always" || cents === "auto" && (abs < 1e3 || hasCents));
|
|
137
|
+
return symbol + (showCents ? fixed(abs, digits, digits, locale) : fixed(abs, 0, 0, locale));
|
|
135
138
|
}
|
|
136
139
|
function money(v, o = {}) {
|
|
137
140
|
if (!finite(v)) return DASH;
|
package/dist/inbox-client.js
CHANGED
|
@@ -283,7 +283,7 @@ function createInboxClient(options) {
|
|
|
283
283
|
if (disabled) return { ok: false, error: "disabled", queued: false };
|
|
284
284
|
if (queue.length > 0) {
|
|
285
285
|
enqueue(parsed.value);
|
|
286
|
-
void flush();
|
|
286
|
+
if (timer === null) void flush();
|
|
287
287
|
return { ok: false, error: "queued behind earlier events", queued: true };
|
|
288
288
|
}
|
|
289
289
|
const result = await attempt(parsed.value);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent,
|
|
4
|
-
export { C as CanvasEdge, a as CanvasEdgeKind, b as CanvasGroup, c as CanvasHue, d as CanvasLabels, e as CanvasLayout, f as CanvasLayoutMode, g as CanvasNode, h as CanvasNodeKind, D as DEFAULT_CANVAS_LABELS, L as LayoutOptions, R as RoutedEdge, S as SystemCanvas, i as SystemCanvasProps, l as layoutSystem, p as pickLayout, r as routeEdges } from './system-canvas-BLuWd69H.js';
|
|
5
|
-
export { DEFAULT_INBOX_LABELS, INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS, INBOX_DEFAULT_SETTINGS, INBOX_SOURCE_LABELS, Inbox, InboxAction, InboxActionCall, InboxActionResult, InboxItem, InboxLabels, InboxListResponse, InboxProps, InboxSettings, InboxSeverity, InboxView } from './inbox.js';
|
|
6
|
-
export { ServiceTokenListResponse, ServiceTokenView, ServiceTokensSection, ServiceTokensSectionProps, useServiceTokens } from './service-tokens.js';
|
|
3
|
+
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, ComponentPropsWithoutRef, RefObject, ReactElement, ComponentProps, ElementType, ComponentPropsWithRef, SVGProps, MouseEvent } from 'react';
|
|
7
4
|
|
|
8
5
|
/** Conditional Tailwind classes with conflict resolution. */
|
|
9
6
|
declare function cn(...inputs: ClassValue[]): string;
|
|
@@ -244,6 +241,20 @@ interface NishStrings {
|
|
|
244
241
|
offlineBadge: string;
|
|
245
242
|
/** FlowSteps: group label. */
|
|
246
243
|
progress: string;
|
|
244
|
+
/** AgentNode: spoken state word. */
|
|
245
|
+
agentQueued: string;
|
|
246
|
+
/** AgentNode: spoken state word. */
|
|
247
|
+
agentRunning: string;
|
|
248
|
+
/** AgentNode: spoken state word. */
|
|
249
|
+
agentDone: string;
|
|
250
|
+
/** AgentNode: spoken state word. */
|
|
251
|
+
agentFailed: string;
|
|
252
|
+
/** FlowSteps: hidden text appended to a finished step. */
|
|
253
|
+
stepDone: string;
|
|
254
|
+
/** FlowSteps: hidden text appended to a failed step. */
|
|
255
|
+
stepFailed: string;
|
|
256
|
+
/** ResponsiveTable: label of the sort-direction button, from the current direction. */
|
|
257
|
+
sortToggle: (dir: 'asc' | 'desc' | null) => string;
|
|
247
258
|
/** WorkflowBoard: group label. */
|
|
248
259
|
workflow: string;
|
|
249
260
|
/** ActivityFeed: group label. */
|
|
@@ -314,6 +325,8 @@ interface NishStrings {
|
|
|
314
325
|
breadcrumbs: string;
|
|
315
326
|
/** TagInput: remove button aria label. */
|
|
316
327
|
removeTag: (tag: string) => string;
|
|
328
|
+
/** TagInput: shown when a tag is refused because the limit is reached. */
|
|
329
|
+
maxTags: (max: number) => string;
|
|
317
330
|
/** FileDropzone: drop area text. */
|
|
318
331
|
dropzoneLabel: string;
|
|
319
332
|
/** FileDropzone: browse button. */
|
|
@@ -333,6 +346,7 @@ interface NishStrings {
|
|
|
333
346
|
/** Progress: label of an indeterminate bar. */
|
|
334
347
|
progressIndeterminate: string;
|
|
335
348
|
}
|
|
349
|
+
/** Every English default. Built from the groups; components read their own groups through `useStrings`. */
|
|
336
350
|
declare const DEFAULT_STRINGS: NishStrings;
|
|
337
351
|
|
|
338
352
|
/** Theme switching shared by every nish.software page.
|
|
@@ -385,7 +399,7 @@ interface MountThemeToggleOptions {
|
|
|
385
399
|
/** Replace the words "System", "Light" and "Dark" in the button's label, e.g. for
|
|
386
400
|
* another language. The label reads "Theme: Light. Switch to Dark". */
|
|
387
401
|
labels?: ThemeToggleLabels;
|
|
388
|
-
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to
|
|
402
|
+
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to THEME_STRINGS. */
|
|
389
403
|
strings?: Partial<Pick<NishStrings, 'themeToggleLabel'>>;
|
|
390
404
|
/** The words after a preset saved on another site: "Theme: Mocha (set on another site). …".
|
|
391
405
|
* Default "set on another site". */
|
|
@@ -430,7 +444,7 @@ interface ShowToastOptions {
|
|
|
430
444
|
href?: string;
|
|
431
445
|
onClick?: () => void;
|
|
432
446
|
};
|
|
433
|
-
/** Accessible name of the dismiss button. Default
|
|
447
|
+
/** Accessible name of the dismiss button. Default DISPLAY_STRINGS.dismiss ("Dismiss"). */
|
|
434
448
|
dismissLabel?: string;
|
|
435
449
|
/** Strings for this toast (another language): `dismiss`. `dismissLabel` wins when both are given. */
|
|
436
450
|
strings?: Partial<Pick<NishStrings, 'dismiss'>>;
|
|
@@ -448,7 +462,7 @@ interface ConfirmDialogOptions {
|
|
|
448
462
|
body?: string | Node;
|
|
449
463
|
/** The confirm button's label: a verb that names the action. Default "Confirm". */
|
|
450
464
|
confirmLabel?: string;
|
|
451
|
-
/** The cancel button's label. Default
|
|
465
|
+
/** The cancel button's label. Default OVERLAY_STRINGS.cancel ("Cancel"). */
|
|
452
466
|
cancelLabel?: string;
|
|
453
467
|
/** Strings for this dialog (another language): `cancel`. `cancelLabel` wins when both are given. */
|
|
454
468
|
strings?: Partial<Pick<NishStrings, 'cancel'>>;
|
|
@@ -502,8 +516,10 @@ interface MountScrollspyOptions {
|
|
|
502
516
|
* has passed the offset, the first one at the top of the page), is scrolled into view
|
|
503
517
|
* inside the nav, and the nav gets `data-at-start` / `data-at-end` for its edge fades.
|
|
504
518
|
* Publishes the nav's height as `--nish-sticky-extra` so `.nish-scroll-target` clears it.
|
|
505
|
-
* Returns a function that removes everything. */
|
|
506
|
-
declare function mountScrollspy(nav: HTMLElement, o?: MountScrollspyOptions): () => void
|
|
519
|
+
* Returns a function that removes everything; its `lock(id)` keeps that section's link current until the user scrolls. */
|
|
520
|
+
declare function mountScrollspy(nav: HTMLElement, o?: MountScrollspyOptions): (() => void) & {
|
|
521
|
+
lock: (id: string) => void;
|
|
522
|
+
};
|
|
507
523
|
/** Persist a checklist: the `input[type=checkbox]` inside each `li[data-id]` of `list` is
|
|
508
524
|
* saved to localStorage under `list.dataset.store` (a JSON array of checked ids) and
|
|
509
525
|
* restored now. Updates the `.nish-checklist-progress` element before the list (or the
|
|
@@ -895,11 +911,9 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
895
911
|
checked?: boolean;
|
|
896
912
|
/** The starting state of an uncontrolled switch (no `checked`). */
|
|
897
913
|
defaultChecked?: boolean;
|
|
898
|
-
/** Called with the new value
|
|
899
|
-
*
|
|
900
|
-
|
|
901
|
-
/** Called with the new value. The form-library friendly callback: use it with
|
|
902
|
-
* react-hook-form's Controller (`onCheckedChange={field.onChange}`). */
|
|
914
|
+
/** Called with the new value when the switch is clicked or toggled with Space or Enter.
|
|
915
|
+
* Use it with react-hook-form's Controller (`onCheckedChange={field.onChange}`). Need the
|
|
916
|
+
* click event? Use `onClick`. */
|
|
903
917
|
onCheckedChange?: (checked: boolean) => void;
|
|
904
918
|
/** Field name for a native form. With it, a hidden checkbox mirrors the state, so
|
|
905
919
|
* FormData and `<form action>` carry the value. */
|
|
@@ -926,7 +940,7 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
926
940
|
* waits for Save; use Checkbox for that). A `<button role="switch" aria-checked>`; with a
|
|
927
941
|
* `name` it also posts in native forms. `ref` and the remaining props go to the button;
|
|
928
942
|
* `className` goes to the row (or to the button when there is no label). */
|
|
929
|
-
declare function Switch({ ref, checked: checkedProp, defaultChecked,
|
|
943
|
+
declare function Switch({ ref, checked: checkedProp, defaultChecked, onCheckedChange, name, value, required, form, label, description, size, labelSide, disabled, className, id, onClick, ...allRest }: SwitchProps): react.JSX.Element;
|
|
930
944
|
interface FieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
931
945
|
/** The wrapper element. */
|
|
932
946
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -1324,6 +1338,7 @@ type ToastFn = ToastCall & {
|
|
|
1324
1338
|
declare const toast: ToastFn;
|
|
1325
1339
|
/** Same API as a hook, for code that prefers one. */
|
|
1326
1340
|
declare function useToast(): ToastFn;
|
|
1341
|
+
|
|
1327
1342
|
interface ToasterProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'children'> {
|
|
1328
1343
|
/** Extra classes for the stack, e.g. to lift it above a bottom nav: sm:bottom-20. */
|
|
1329
1344
|
className?: string;
|
|
@@ -2657,7 +2672,7 @@ interface ThemeToggleProps {
|
|
|
2657
2672
|
ref?: Ref<HTMLElement>;
|
|
2658
2673
|
}
|
|
2659
2674
|
/** System / Light / Dark as a Segmented radio group, optionally with a preset picker,
|
|
2660
|
-
* or one cycling icon button when compact. Words come from `
|
|
2675
|
+
* or one cycling icon button when compact. Words come from `useStrings(THEME_STRINGS)`. Other props
|
|
2661
2676
|
* (id, data-*, aria-*, style) go on the root element. */
|
|
2662
2677
|
declare function ThemeToggle({ ref, presets, labels, block, size, compact, variant, phone, collapse, className, elsewhereLabel, ...rest }: ThemeToggleProps & Omit<HTMLAttributes<HTMLElement>, 'children' | 'onChange'>): react.JSX.Element;
|
|
2663
2678
|
|
|
@@ -3391,7 +3406,9 @@ interface AppShellSidebar {
|
|
|
3391
3406
|
* "nish-sidebar-collapsed"; false keeps it in memory only. */
|
|
3392
3407
|
storageKey?: string | false;
|
|
3393
3408
|
/** Buttons above the nav (search, an assistant). Give them labels: collapsed, they stack as
|
|
3394
|
-
* icons. Below 1024px, where there is no sidebar, they show in the header before `actions`.
|
|
3409
|
+
* icons. Below 1024px, where there is no sidebar, they show in the header before `actions`.
|
|
3410
|
+
* Both copies stay mounted and CSS shows one, so they must not hold a global key listener, a fixed id or
|
|
3411
|
+
* open state of their own (put those in the app and pass plain buttons). */
|
|
3395
3412
|
tools?: ReactNode;
|
|
3396
3413
|
/** Next to the collapse button at the bottom. Sidebar only: put anything people need on a
|
|
3397
3414
|
* phone in `actions` or `moreItems` too. */
|
|
@@ -3426,7 +3443,8 @@ interface AppShellProps {
|
|
|
3426
3443
|
navLabel?: string;
|
|
3427
3444
|
/** id of the `main` element and target of the skip link. Default "nish-main"; give each shell on a page its own. */
|
|
3428
3445
|
mainId?: string;
|
|
3429
|
-
/** Header buttons before the theme toggle.
|
|
3446
|
+
/** Header buttons before the theme toggle. With a `brand` sidebar they are also shown in the sidebar's tools, so
|
|
3447
|
+
* the same rule applies: two copies are mounted, only one is visible. */
|
|
3430
3448
|
actions?: ReactNode;
|
|
3431
3449
|
/** Replaces the header's ThemeToggle; false hides it. */
|
|
3432
3450
|
themeToggle?: ReactNode | false;
|
|
@@ -3521,7 +3539,7 @@ interface ApiConfig {
|
|
|
3521
3539
|
* request URL; never called for a same-origin URL, which always gets them. */
|
|
3522
3540
|
headersFor?: (url: string) => boolean;
|
|
3523
3541
|
}
|
|
3524
|
-
/** Merges into the
|
|
3542
|
+
/** Merges into the page-wide config used by every apiFetch call. */
|
|
3525
3543
|
declare function configureApi(c: ApiConfig): void;
|
|
3526
3544
|
/** fetch with JSON in and out, a timeout, and a typed ApiError for every failure. */
|
|
3527
3545
|
declare function apiFetch<T = unknown>(path: string, o?: ApiFetchOptions): Promise<T>;
|
|
@@ -3979,7 +3997,8 @@ interface TimeFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'
|
|
|
3979
3997
|
defaultValue?: string | null;
|
|
3980
3998
|
/** Called with HH:mm when both boxes hold a valid time inside min and max, or null when both are emptied. */
|
|
3981
3999
|
onValueChange?: (value: string | null) => void;
|
|
3982
|
-
/** Earliest allowed time (HH:mm). An earlier time marks the field invalid and is not reported.
|
|
4000
|
+
/** Earliest allowed time (HH:mm). An earlier time marks the field invalid and is not reported. A min after max is a
|
|
4001
|
+
* range that wraps past midnight (22:00 to 06:00), as on `<input type="time">`. */
|
|
3983
4002
|
min?: string;
|
|
3984
4003
|
/** Latest allowed time (HH:mm). */
|
|
3985
4004
|
max?: string;
|
|
@@ -4745,11 +4764,14 @@ interface AvatarProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'>
|
|
|
4745
4764
|
shape?: AvatarShape;
|
|
4746
4765
|
/** A status dot at the bottom corner. Give it text elsewhere; color is never the only signal. */
|
|
4747
4766
|
status?: StatusTone;
|
|
4767
|
+
/** What a screen reader hears for the status dot (for example "Online"). Without it the dot is hidden from
|
|
4768
|
+
* assistive tech; it is always hidden when `alt=""`. */
|
|
4769
|
+
statusLabel?: string;
|
|
4748
4770
|
/** The root element. */
|
|
4749
4771
|
ref?: Ref<HTMLSpanElement>;
|
|
4750
4772
|
}
|
|
4751
4773
|
/** A person or entity: their image, or initials on a color taken from their name. */
|
|
4752
|
-
declare function Avatar({ src, name, alt, size, shape, status, className, ref, ...rest }: AvatarProps): react.JSX.Element;
|
|
4774
|
+
declare function Avatar({ src, name, alt, size, shape, status, statusLabel, className, ref, ...rest }: AvatarProps): react.JSX.Element;
|
|
4753
4775
|
interface AvatarGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
4754
4776
|
/** Avatars shown before the "+N" overflow badge. Default: all. */
|
|
4755
4777
|
max?: number;
|