nish-ui 3.0.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 +5 -5
- package/dist/chart.d.ts +8 -3
- package/dist/chart.js +2 -417
- package/dist/elements-all.js +71 -70
- 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/avatar.js +2 -2
- package/dist/esm/components/canvas/legend.js +4 -4
- package/dist/esm/components/canvas/system-canvas.js +24 -1
- package/dist/esm/components/carousel.js +21 -3
- package/dist/esm/components/charts.js +21 -13
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/data-classes.js +5 -4
- package/dist/esm/components/data.js +1 -5
- package/dist/esm/components/date-picker.js +1 -0
- package/dist/esm/components/date-range-picker.js +1 -0
- package/dist/esm/components/display.js +3 -3
- package/dist/esm/components/file-dropzone.js +21 -1
- package/dist/esm/components/filters.js +3 -1
- package/dist/esm/components/flow.js +12 -11
- package/dist/esm/components/forms.js +24 -2
- package/dist/esm/components/hooks.js +20 -17
- package/dist/esm/components/inbox.js +9 -7
- package/dist/esm/components/layout-vars.js +10 -7
- package/dist/esm/components/menu.js +7 -4
- package/dist/esm/components/multi-select.js +7 -4
- package/dist/esm/components/overlay-core.js +31 -10
- package/dist/esm/components/overlay-dialog.js +17 -2
- package/dist/esm/components/pagination.js +4 -1
- package/dist/esm/components/popover.js +15 -9
- package/dist/esm/components/primitives.js +1 -1
- package/dist/esm/components/progress.js +2 -0
- package/dist/esm/components/resource-classes.js +34 -16
- package/dist/esm/components/resource.js +5 -4
- package/dist/esm/components/settings.js +4 -2
- package/dist/esm/components/slider.js +1 -0
- package/dist/esm/components/strings.js +9 -1
- package/dist/esm/components/tag-input.js +15 -7
- package/dist/esm/components/time-field-classes.js +5 -2
- package/dist/esm/components/time-field.js +15 -7
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/components/url-state.js +1 -0
- package/dist/esm/components/virtual-table.js +8 -2
- package/dist/esm/components/virtual.js +16 -2
- package/dist/esm/format.js +17 -14
- package/dist/esm/runtime.js +1 -1
- package/dist/esm/server/inbox/client.js +1 -1
- package/dist/esm/theme.js +66 -6
- package/dist/format.js +18 -15
- package/dist/inbox-client.js +1 -1
- package/dist/index.d.ts +32 -7
- 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 +0 -4
- package/dist/theme.d.ts +20 -2
- package/dist/theme.global.js +67 -7
- package/dist/theme.js +67 -7
- package/package.json +1 -1
package/dist/format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/runtime.ts
|
|
2
|
-
var version = true ? "3.
|
|
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
|
@@ -241,6 +241,20 @@ interface NishStrings {
|
|
|
241
241
|
offlineBadge: string;
|
|
242
242
|
/** FlowSteps: group label. */
|
|
243
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;
|
|
244
258
|
/** WorkflowBoard: group label. */
|
|
245
259
|
workflow: string;
|
|
246
260
|
/** ActivityFeed: group label. */
|
|
@@ -311,6 +325,8 @@ interface NishStrings {
|
|
|
311
325
|
breadcrumbs: string;
|
|
312
326
|
/** TagInput: remove button aria label. */
|
|
313
327
|
removeTag: (tag: string) => string;
|
|
328
|
+
/** TagInput: shown when a tag is refused because the limit is reached. */
|
|
329
|
+
maxTags: (max: number) => string;
|
|
314
330
|
/** FileDropzone: drop area text. */
|
|
315
331
|
dropzoneLabel: string;
|
|
316
332
|
/** FileDropzone: browse button. */
|
|
@@ -500,8 +516,10 @@ interface MountScrollspyOptions {
|
|
|
500
516
|
* has passed the offset, the first one at the top of the page), is scrolled into view
|
|
501
517
|
* inside the nav, and the nav gets `data-at-start` / `data-at-end` for its edge fades.
|
|
502
518
|
* Publishes the nav's height as `--nish-sticky-extra` so `.nish-scroll-target` clears it.
|
|
503
|
-
* Returns a function that removes everything. */
|
|
504
|
-
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
|
+
};
|
|
505
523
|
/** Persist a checklist: the `input[type=checkbox]` inside each `li[data-id]` of `list` is
|
|
506
524
|
* saved to localStorage under `list.dataset.store` (a JSON array of checked ids) and
|
|
507
525
|
* restored now. Updates the `.nish-checklist-progress` element before the list (or the
|
|
@@ -3388,7 +3406,9 @@ interface AppShellSidebar {
|
|
|
3388
3406
|
* "nish-sidebar-collapsed"; false keeps it in memory only. */
|
|
3389
3407
|
storageKey?: string | false;
|
|
3390
3408
|
/** Buttons above the nav (search, an assistant). Give them labels: collapsed, they stack as
|
|
3391
|
-
* 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). */
|
|
3392
3412
|
tools?: ReactNode;
|
|
3393
3413
|
/** Next to the collapse button at the bottom. Sidebar only: put anything people need on a
|
|
3394
3414
|
* phone in `actions` or `moreItems` too. */
|
|
@@ -3423,7 +3443,8 @@ interface AppShellProps {
|
|
|
3423
3443
|
navLabel?: string;
|
|
3424
3444
|
/** id of the `main` element and target of the skip link. Default "nish-main"; give each shell on a page its own. */
|
|
3425
3445
|
mainId?: string;
|
|
3426
|
-
/** 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. */
|
|
3427
3448
|
actions?: ReactNode;
|
|
3428
3449
|
/** Replaces the header's ThemeToggle; false hides it. */
|
|
3429
3450
|
themeToggle?: ReactNode | false;
|
|
@@ -3518,7 +3539,7 @@ interface ApiConfig {
|
|
|
3518
3539
|
* request URL; never called for a same-origin URL, which always gets them. */
|
|
3519
3540
|
headersFor?: (url: string) => boolean;
|
|
3520
3541
|
}
|
|
3521
|
-
/** Merges into the
|
|
3542
|
+
/** Merges into the page-wide config used by every apiFetch call. */
|
|
3522
3543
|
declare function configureApi(c: ApiConfig): void;
|
|
3523
3544
|
/** fetch with JSON in and out, a timeout, and a typed ApiError for every failure. */
|
|
3524
3545
|
declare function apiFetch<T = unknown>(path: string, o?: ApiFetchOptions): Promise<T>;
|
|
@@ -3976,7 +3997,8 @@ interface TimeFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'
|
|
|
3976
3997
|
defaultValue?: string | null;
|
|
3977
3998
|
/** Called with HH:mm when both boxes hold a valid time inside min and max, or null when both are emptied. */
|
|
3978
3999
|
onValueChange?: (value: string | null) => void;
|
|
3979
|
-
/** 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">`. */
|
|
3980
4002
|
min?: string;
|
|
3981
4003
|
/** Latest allowed time (HH:mm). */
|
|
3982
4004
|
max?: string;
|
|
@@ -4742,11 +4764,14 @@ interface AvatarProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'>
|
|
|
4742
4764
|
shape?: AvatarShape;
|
|
4743
4765
|
/** A status dot at the bottom corner. Give it text elsewhere; color is never the only signal. */
|
|
4744
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;
|
|
4745
4770
|
/** The root element. */
|
|
4746
4771
|
ref?: Ref<HTMLSpanElement>;
|
|
4747
4772
|
}
|
|
4748
4773
|
/** A person or entity: their image, or initials on a color taken from their name. */
|
|
4749
|
-
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;
|
|
4750
4775
|
interface AvatarGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
4751
4776
|
/** Avatars shown before the "+N" overflow badge. Default: all. */
|
|
4752
4777
|
max?: number;
|
package/dist/nish-components.css
CHANGED
|
@@ -3462,6 +3462,10 @@
|
|
|
3462
3462
|
z-index: 10;
|
|
3463
3463
|
background: inherit;
|
|
3464
3464
|
}
|
|
3465
|
+
/* The pinned corner sits above the pinned body column it would otherwise tie with. */
|
|
3466
|
+
:where(.nish-table-wrap--sticky-first) :where(thead tr > :first-child) {
|
|
3467
|
+
z-index: 11;
|
|
3468
|
+
}
|
|
3465
3469
|
:where(.nish-table-wrap--sticky-first) :where(tr > :first-child)::after {
|
|
3466
3470
|
content: '';
|
|
3467
3471
|
position: absolute;
|
|
@@ -3474,7 +3478,8 @@
|
|
|
3474
3478
|
transition: opacity 150ms;
|
|
3475
3479
|
pointer-events: none;
|
|
3476
3480
|
}
|
|
3477
|
-
:where(.nish-table-wrap--sticky-first[data-at-start='false']) :where(tr > :first-child)::after
|
|
3481
|
+
:where(.nish-table-wrap--sticky-first[data-at-start='false']:not(:dir(rtl))) :where(tr > :first-child)::after,
|
|
3482
|
+
:where(.nish-table-wrap--sticky-first[data-at-end='false']:dir(rtl)) :where(tr > :first-child)::after {
|
|
3478
3483
|
opacity: 1;
|
|
3479
3484
|
}
|
|
3480
3485
|
:where(.nish-table--zebra) :where(tbody tr:nth-child(even)) {
|
|
@@ -4764,8 +4769,23 @@
|
|
|
4764
4769
|
}
|
|
4765
4770
|
:where(.nish-tab[aria-selected='true'], .nish-tab[aria-current]:not([aria-current='false'])) {
|
|
4766
4771
|
border-bottom-color: Highlight;
|
|
4772
|
+
}
|
|
4773
|
+
:where(.nish-tab[aria-selected='true']:not(:focus-visible), .nish-tab[aria-current]:not([aria-current='false']):not(:focus-visible)) {
|
|
4767
4774
|
outline: 0;
|
|
4768
4775
|
}
|
|
4776
|
+
:where(.nish-tab:focus-visible) {
|
|
4777
|
+
outline: 2px solid Highlight;
|
|
4778
|
+
outline-offset: -2px;
|
|
4779
|
+
}
|
|
4780
|
+
/* Focus drawn only with a shadow or a fill is dropped here: use a real outline. */
|
|
4781
|
+
:where(.nish-chart svg[role='img']:focus-visible, .nish-split-divider:focus-visible) {
|
|
4782
|
+
outline: 2px solid Highlight;
|
|
4783
|
+
outline-offset: 2px;
|
|
4784
|
+
}
|
|
4785
|
+
:where(.nish-split-divider:hover, .nish-split-divider:focus-visible, .nish-split-divider:active, .nish-split-divider[data-dragging]) {
|
|
4786
|
+
forced-color-adjust: none;
|
|
4787
|
+
background: Highlight;
|
|
4788
|
+
}
|
|
4769
4789
|
:where(.nish-tabs--pill .nish-tab[aria-selected='true'], .nish-tabs--pill .nish-tab[aria-current]:not([aria-current='false'])) {
|
|
4770
4790
|
forced-color-adjust: none;
|
|
4771
4791
|
background: Highlight;
|
|
@@ -4806,4 +4826,24 @@
|
|
|
4806
4826
|
display: none !important;
|
|
4807
4827
|
}
|
|
4808
4828
|
}
|
|
4829
|
+
|
|
4830
|
+
/* Chip rows scroll sideways on a phone instead of wrapping (UI-070). */
|
|
4831
|
+
@media (max-width: 639.98px) {
|
|
4832
|
+
:where(.nish-chips--scroll) {
|
|
4833
|
+
flex-wrap: nowrap;
|
|
4834
|
+
overflow-x: auto;
|
|
4835
|
+
padding-block: 4px;
|
|
4836
|
+
scrollbar-width: none;
|
|
4837
|
+
}
|
|
4838
|
+
:where(.nish-chips--scroll)::-webkit-scrollbar {
|
|
4839
|
+
display: none;
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
/* Hide the browser's own clear button on search inputs; the component has its own (UI-075). */
|
|
4844
|
+
:where(.nish-search) > :where(input)::-webkit-search-cancel-button,
|
|
4845
|
+
:where(.nish-search) > :where(input)::-webkit-search-decoration {
|
|
4846
|
+
-webkit-appearance: none;
|
|
4847
|
+
appearance: none;
|
|
4848
|
+
}
|
|
4809
4849
|
}
|