nish-ui 2.2.0 → 3.0.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.
Files changed (74) hide show
  1. package/README.md +5 -1
  2. package/dist/chart.js +1 -1
  3. package/dist/elements-all.js +58 -58
  4. package/dist/elements-charts.js +1 -1
  5. package/dist/elements-data.js +1 -1
  6. package/dist/elements-forms.js +1 -1
  7. package/dist/elements.js +4 -4
  8. package/dist/esm/components/accordion.js +3 -2
  9. package/dist/esm/components/app-shell.js +3 -2
  10. package/dist/esm/components/avatar.js +4 -3
  11. package/dist/esm/components/breadcrumbs.js +3 -2
  12. package/dist/esm/components/calendar-base.js +4 -3
  13. package/dist/esm/components/canvas/legend.js +3 -2
  14. package/dist/esm/components/canvas/node.js +3 -2
  15. package/dist/esm/components/canvas/system-canvas.js +3 -2
  16. package/dist/esm/components/carousel.js +3 -2
  17. package/dist/esm/components/charts.js +8 -7
  18. package/dist/esm/components/combobox.js +3 -2
  19. package/dist/esm/components/command.js +4 -3
  20. package/dist/esm/components/context-menu.js +3 -2
  21. package/dist/esm/components/data.js +4 -3
  22. package/dist/esm/components/date-picker.js +4 -3
  23. package/dist/esm/components/date-range-picker.js +4 -3
  24. package/dist/esm/components/display.js +7 -6
  25. package/dist/esm/components/drawer.js +3 -2
  26. package/dist/esm/components/error-boundary.js +4 -2
  27. package/dist/esm/components/feedback.js +7 -6
  28. package/dist/esm/components/file-dropzone.js +3 -2
  29. package/dist/esm/components/filters.js +4 -3
  30. package/dist/esm/components/flow.js +6 -5
  31. package/dist/esm/components/forms.js +13 -8
  32. package/dist/esm/components/hooks.js +2 -2
  33. package/dist/esm/components/hover-card.js +2 -2
  34. package/dist/esm/components/inbox.js +4 -2
  35. package/dist/esm/components/layout.js +5 -4
  36. package/dist/esm/components/media.js +3 -2
  37. package/dist/esm/components/menu.js +5 -4
  38. package/dist/esm/components/modal.js +4 -3
  39. package/dist/esm/components/more-sheet.js +3 -2
  40. package/dist/esm/components/multi-select.js +3 -2
  41. package/dist/esm/components/nav-items.js +4 -3
  42. package/dist/esm/components/nav.js +5 -4
  43. package/dist/esm/components/overlay-dialog.js +3 -2
  44. package/dist/esm/components/pagination.js +3 -2
  45. package/dist/esm/components/popover.js +2 -2
  46. package/dist/esm/components/portal.js +2 -2
  47. package/dist/esm/components/progress.js +3 -2
  48. package/dist/esm/components/provider.js +34 -5
  49. package/dist/esm/components/range-calendar.js +4 -3
  50. package/dist/esm/components/service-tokens.js +4 -3
  51. package/dist/esm/components/settings.js +4 -3
  52. package/dist/esm/components/slider.js +3 -2
  53. package/dist/esm/components/split.js +4 -3
  54. package/dist/esm/components/strings.js +174 -65
  55. package/dist/esm/components/tag-input.js +3 -2
  56. package/dist/esm/components/theme-toggle.js +3 -2
  57. package/dist/esm/components/time-field.js +4 -3
  58. package/dist/esm/components/toast-card.js +155 -0
  59. package/dist/esm/components/toast-store.js +136 -0
  60. package/dist/esm/components/toast.js +38 -241
  61. package/dist/esm/components/tooltip.js +2 -2
  62. package/dist/esm/components/virtual-table.js +3 -2
  63. package/dist/esm/index.js +0 -20
  64. package/dist/esm/runtime.js +1 -1
  65. package/dist/esm/system-canvas.js +4 -0
  66. package/dist/esm/theme.js +7 -7
  67. package/dist/format.js +1 -1
  68. package/dist/index.d.ts +11 -14
  69. package/dist/system-canvas.d.ts +183 -2
  70. package/dist/theme.d.ts +3 -3
  71. package/dist/theme.global.js +21 -145
  72. package/dist/theme.js +21 -145
  73. package/package.json +1 -1
  74. package/dist/system-canvas-BLuWd69H.d.ts +0 -183
@@ -33,7 +33,8 @@ import {
33
33
  import { isRtl, useIsoLayoutEffect } from "./client.js";
34
34
  import { ChevronLeftIcon, ChevronRightIcon } from "./icons.js";
35
35
  import { IconButton, Select } from "./primitives.js";
36
- import { useNishConfig, useNishStrings } from "./provider.js";
36
+ import { useNishContext, useStrings } from "./provider.js";
37
+ import { PICKER_STRINGS } from "./strings.js";
37
38
  import { jsx, jsxs } from "react/jsx-runtime";
38
39
  var warned = /* @__PURE__ */ new Set();
39
40
  var noopSubscribe = () => () => {
@@ -81,8 +82,8 @@ function CalendarBase({
81
82
  ref,
82
83
  ...rest
83
84
  }) {
84
- const strings = useNishStrings();
85
- const config = useNishConfig();
85
+ const strings = useStrings(PICKER_STRINGS);
86
+ const config = useNishContext();
86
87
  const loc = resolveLocale(locale ?? config.locale ?? getDefaultLocale());
87
88
  const ws = weekStartsOn ?? weekStartFor(loc);
88
89
  const titleId = useId();
@@ -3,7 +3,8 @@
3
3
  // src/components/canvas/legend.tsx
4
4
  import { memo, useEffect, useId, useRef, useState } from "react";
5
5
  import { cn } from "../../cn.js";
6
- import { useNishStrings } from "../provider.js";
6
+ import { useStrings } from "../provider.js";
7
+ import { CANVAS_STRINGS } from "../strings.js";
7
8
  import { Svg } from "./icons.js";
8
9
  import { DEFAULT_CANVAS_LABELS } from "./types.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -22,7 +23,7 @@ var EdgeLegend = memo(function EdgeLegend2({
22
23
  onToggle,
23
24
  labels = DEFAULT_CANVAS_LABELS
24
25
  }) {
25
- const strings = useNishStrings();
26
+ const strings = useStrings(CANVAS_STRINGS);
26
27
  const [open, setOpen] = useState(false);
27
28
  const rootRef = useRef(null);
28
29
  const buttonRef = useRef(null);
@@ -4,7 +4,8 @@
4
4
  import { memo, useRef } from "react";
5
5
  import { useIsoLayoutEffect } from "../client.js";
6
6
  import { TickerText } from "../flow.js";
7
- import { useNishStrings } from "../provider.js";
7
+ import { useStrings } from "../provider.js";
8
+ import { MEDIA_STRINGS } from "../strings.js";
8
9
  import { KIND_ICON, Svg } from "./icons.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  function hueStyle(hue) {
@@ -32,7 +33,7 @@ function usePing(active) {
32
33
  }
33
34
  var NodeView = memo(
34
35
  function NodeView2({ node, groupTitle, hue, box, selected, dim, delay, onSelect }) {
35
- const strings = useNishStrings();
36
+ const strings = useStrings(MEDIA_STRINGS);
36
37
  const active = !!node.active;
37
38
  const heat = clamp01(node.heat);
38
39
  const ref = usePing(active);
@@ -13,7 +13,8 @@ import { cn } from "../../cn.js";
13
13
  import { useIsoLayoutEffect } from "../client.js";
14
14
  import { usePrefersReducedMotion } from "../flow.js";
15
15
  import { IconButton } from "../primitives.js";
16
- import { useNishStrings } from "../provider.js";
16
+ import { useStrings } from "../provider.js";
17
+ import { CANVAS_STRINGS } from "../strings.js";
17
18
  import { FollowCaption } from "./follow-caption.js";
18
19
  import { useFollow } from "./follow.js";
19
20
  import { FitIcon, FollowIcon, MinusIcon, PlusIcon } from "./icons.js";
@@ -52,7 +53,7 @@ function SystemCanvas({
52
53
  ref: forwardedRef,
53
54
  ...rest
54
55
  }) {
55
- const strings = useNishStrings();
56
+ const strings = useStrings(CANVAS_STRINGS);
56
57
  const label = labelProp ?? strings.systemMap;
57
58
  const labels = useMemo(() => ({ ...DEFAULT_CANVAS_LABELS, ...labelOverrides }), [labelOverrides]);
58
59
  const reduced = usePrefersReducedMotion();
@@ -14,7 +14,8 @@ import { CAROUSEL_MAX_DOTS, CAROUSEL_MIN_INTERVAL, nearestSlide, stepIndex } fro
14
14
  import { useMediaQuery } from "./hooks.js";
15
15
  import { ChevronLeftIcon, ChevronRightIcon, PauseIcon, PlayIcon } from "./icons.js";
16
16
  import { IconButton } from "./primitives.js";
17
- import { useNishStrings } from "./provider.js";
17
+ import { useStrings } from "./provider.js";
18
+ import { CAROUSEL_STRINGS } from "./strings.js";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  var SETTLE_MS = 700;
20
21
  function Carousel({
@@ -38,7 +39,7 @@ function Carousel({
38
39
  onBlur,
39
40
  ...rest
40
41
  }) {
41
- const strings = useNishStrings();
42
+ const strings = useStrings(CAROUSEL_STRINGS);
42
43
  const reduced = useMediaQuery("(prefers-reduced-motion: reduce)");
43
44
  const slides = Children.toArray(children);
44
45
  const count = slides.length;
@@ -15,7 +15,8 @@ import { isRtl } from "./client.js";
15
15
  import { chartNumber, decimateMinMax, mergeRefs } from "./data-classes.js";
16
16
  import { Skeleton } from "./feedback.js";
17
17
  import { useMediaQuery } from "./hooks.js";
18
- import { useNishConfig, useNishStrings } from "./provider.js";
18
+ import { useNishContext, useStrings } from "./provider.js";
19
+ import { DISPLAY_STRINGS } from "./strings.js";
19
20
  import { jsx, jsxs } from "react/jsx-runtime";
20
21
  function toneColor(tone, index) {
21
22
  if (!tone) return seriesColor(index);
@@ -41,7 +42,7 @@ function useWidth() {
41
42
  return [setEl, width, el];
42
43
  }
43
44
  function useChartRtl(el) {
44
- const { dir } = useNishConfig();
45
+ const { dir } = useNishContext();
45
46
  const [measured, setMeasured] = useState(false);
46
47
  useEffect(() => {
47
48
  setMeasured(isRtl(el));
@@ -78,8 +79,8 @@ function LineChart({
78
79
  ref,
79
80
  ...rest
80
81
  }) {
81
- const t = useNishStrings();
82
- const config = useNishConfig();
82
+ const t = useStrings(DISPLAY_STRINGS);
83
+ const config = useNishContext();
83
84
  const loc = locale ?? config.locale ?? "en-US";
84
85
  const yFmt = yFormat ?? ((v) => chartNumber(v, loc));
85
86
  const xFmt = xFormat ?? ((v) => chartNumber(v, loc));
@@ -322,8 +323,8 @@ function BarChart({
322
323
  ref,
323
324
  ...rest
324
325
  }) {
325
- const t = useNishStrings();
326
- const config = useNishConfig();
326
+ const t = useStrings(DISPLAY_STRINGS);
327
+ const config = useNishContext();
327
328
  const loc = locale ?? config.locale ?? "en-US";
328
329
  const fmt = valueFormat ?? ((v) => chartNumber(v, loc));
329
330
  const [wrapRef, width, wrapEl] = useWidth();
@@ -425,7 +426,7 @@ function BarChart({
425
426
  ] });
426
427
  }
427
428
  function RangeBar({ min, max, low, high, current, label, locale, className, ref, ...rest }) {
428
- const config = useNishConfig();
429
+ const config = useNishContext();
429
430
  const loc = locale ?? config.locale ?? "en-US";
430
431
  const num = (v) => chartNumber(v, loc);
431
432
  const span = max - min;
@@ -6,7 +6,8 @@ import { cn } from "../cn.js";
6
6
  import { CheckIcon, XIcon } from "./icons.js";
7
7
  import { Spinner } from "./feedback.js";
8
8
  import { fieldClass } from "./primitives.js";
9
- import { useNishStrings } from "./provider.js";
9
+ import { useStrings } from "./provider.js";
10
+ import { FIELD_STRINGS } from "./strings.js";
10
11
  import { indexComboboxOptions, setRef } from "./forms-classes.js";
11
12
  import { COMBOBOX_DEBOUNCE_MS, COMBOBOX_MAX_SHOWN } from "../combobox-filter.js";
12
13
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -43,7 +44,7 @@ function Combobox({
43
44
  className,
44
45
  ...rest
45
46
  }) {
46
- const strings = useNishStrings();
47
+ const strings = useStrings(FIELD_STRINGS);
47
48
  const autoId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
48
49
  const inputId = id ?? `nish-cb-${autoId}`;
49
50
  const listId = `nish-cb-list-${autoId}`;
@@ -14,7 +14,8 @@ import { XIcon } from "./icons.js";
14
14
  import { Modal } from "./modal.js";
15
15
  import { navigateFromLayer, warnUnsafe } from "./navigate.js";
16
16
  import { useLatest } from "./latest.js";
17
- import { useNishStrings } from "./provider.js";
17
+ import { useStrings } from "./provider.js";
18
+ import { COMMAND_STRINGS, FIELD_STRINGS, OVERLAY_STRINGS } from "./strings.js";
18
19
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
20
  var MAX_RESULTS = 50;
20
21
  function indexItems(items) {
@@ -162,7 +163,7 @@ function CommandPalette({
162
163
  footer,
163
164
  onSubmitQuery
164
165
  }) {
165
- const s = useNishStrings();
166
+ const s = useStrings(COMMAND_STRINGS, FIELD_STRINGS, OVERLAY_STRINGS);
166
167
  useCommandHotkey(() => {
167
168
  if (!open) onOpenChange(true);
168
169
  }, hotkey);
@@ -183,7 +184,7 @@ function CommandPalette({
183
184
  );
184
185
  }
185
186
  function PaletteDialog({ onClose, items, placeholder, emptyText, resultsLabel, externalLabel, onQuery, footer, onSubmitQuery }) {
186
- const s = useNishStrings();
187
+ const s = useStrings(COMMAND_STRINGS, FIELD_STRINGS, OVERLAY_STRINGS);
187
188
  const uid = useId();
188
189
  const listId = `${uid}-list`;
189
190
  const optionId = (i) => `${uid}-opt-${i}`;
@@ -6,7 +6,8 @@ import { cn } from "../cn.js";
6
6
  import { isRtl, useIsoLayoutEffect } from "./client.js";
7
7
  import { mergeRefs } from "./data-classes.js";
8
8
  import { DropdownMenu } from "./menu.js";
9
- import { useNishStrings } from "./provider.js";
9
+ import { useStrings } from "./provider.js";
10
+ import { OVERLAY_STRINGS } from "./strings.js";
10
11
  import { jsx, jsxs } from "react/jsx-runtime";
11
12
  var FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
12
13
  var NATIVE_MENU_TARGETS = 'input, textarea, select, [contenteditable]:not([contenteditable="false"])';
@@ -35,7 +36,7 @@ function ContextMenu({
35
36
  onClickCapture,
36
37
  ...rest
37
38
  }) {
38
- const t = useNishStrings();
39
+ const t = useStrings(OVERLAY_STRINGS);
39
40
  const [openState, setOpenState] = useState(false);
40
41
  const [point, setPoint] = useState(null);
41
42
  const [target, setTarget] = useState(null);
@@ -25,7 +25,8 @@ import { useMediaQuery } from "./hooks.js";
25
25
  import { StatusDot } from "./display.js";
26
26
  import { CardListSkeleton, EmptyState, ErrorState, SkeletonRows } from "./feedback.js";
27
27
  import { useLatest } from "./latest.js";
28
- import { useNishStrings } from "./provider.js";
28
+ import { useStrings } from "./provider.js";
29
+ import { STATUS_STRINGS, TABLE_STRINGS } from "./strings.js";
29
30
  import { Table, TableWrap, Td, Th, Tr } from "./table.js";
30
31
  import { cardClass, IconButton, Select } from "./primitives.js";
31
32
  import { configureFavicons, googleFavicon } from "./data-classes.js";
@@ -120,7 +121,7 @@ function ResponsiveTable({
120
121
  ref,
121
122
  ...rest
122
123
  }) {
123
- const t = useNishStrings();
124
+ const t = useStrings(STATUS_STRINGS, TABLE_STRINGS);
124
125
  const text = { ...DEFAULT_SORT_TEXT, ...sortText };
125
126
  const [innerSort, setInnerSort] = useState(null);
126
127
  const [announcement, setAnnouncement] = useState("");
@@ -490,7 +491,7 @@ function LinkCard({
490
491
  );
491
492
  }
492
493
  function AsyncPanel({ status, skeleton, error, empty, children, className, ref, ...rest }) {
493
- const t = useNishStrings();
494
+ const t = useStrings(STATUS_STRINGS, TABLE_STRINGS);
494
495
  let body;
495
496
  if (status === "loading") body = skeleton ?? /* @__PURE__ */ jsx(SkeletonRows, {});
496
497
  else if (status === "error")
@@ -18,7 +18,8 @@ import { setRef } from "./forms-classes.js";
18
18
  import { Popover } from "./popover.js";
19
19
  import { CalendarIcon } from "./icons.js";
20
20
  import { fieldClass } from "./primitives-classes.js";
21
- import { useNishConfig, useNishStrings } from "./provider.js";
21
+ import { useNishContext, useStrings } from "./provider.js";
22
+ import { PICKER_STRINGS } from "./strings.js";
22
23
  import { jsx, jsxs } from "react/jsx-runtime";
23
24
  function DatePicker({
24
25
  ref,
@@ -47,8 +48,8 @@ function DatePicker({
47
48
  className,
48
49
  ...rest
49
50
  }) {
50
- const strings = useNishStrings();
51
- const config = useNishConfig();
51
+ const strings = useStrings(PICKER_STRINGS);
52
+ const config = useNishContext();
52
53
  const loc = resolveLocale(locale ?? config.locale ?? getDefaultLocale());
53
54
  const autoId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
54
55
  const inputId = id ?? `nish-dp-${autoId}`;
@@ -21,7 +21,8 @@ import { Popover } from "./popover.js";
21
21
  import { CalendarIcon } from "./icons.js";
22
22
  import { RangeCalendar } from "./range-calendar.js";
23
23
  import { fieldClass } from "./primitives-classes.js";
24
- import { useNishConfig, useNishStrings } from "./provider.js";
24
+ import { useNishContext, useStrings } from "./provider.js";
25
+ import { PICKER_STRINGS } from "./strings.js";
25
26
  import { jsx, jsxs } from "react/jsx-runtime";
26
27
  function DateRangePicker({
27
28
  ref,
@@ -51,8 +52,8 @@ function DateRangePicker({
51
52
  className,
52
53
  ...rest
53
54
  }) {
54
- const strings = useNishStrings();
55
- const config = useNishConfig();
55
+ const strings = useStrings(PICKER_STRINGS);
56
+ const config = useNishContext();
56
57
  const loc = resolveLocale(locale ?? config.locale ?? getDefaultLocale());
57
58
  const autoId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
58
59
  const inputId = id ?? `nish-drp-${autoId}`;
@@ -39,7 +39,8 @@ import { useHeightVar, useStuck } from "./layout-vars.js";
39
39
  import { DropdownMenu } from "./menu.js";
40
40
  import { Tooltip } from "./tooltip.js";
41
41
  import { Badge, Button, Card, IconButton } from "./primitives.js";
42
- import { useNishStrings } from "./provider.js";
42
+ import { useStrings } from "./provider.js";
43
+ import { DISPLAY_STRINGS, SHELL_STRINGS } from "./strings.js";
43
44
  import { ThemeToggle } from "./theme-toggle.js";
44
45
  import { signTone, toneFor as toneFor2 } from "./display-classes.js";
45
46
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -93,7 +94,7 @@ function Callout({
93
94
  ref,
94
95
  ...rest
95
96
  }) {
96
- const strings = useNishStrings();
97
+ const strings = useStrings(DISPLAY_STRINGS, SHELL_STRINGS);
97
98
  const t = CALLOUT_TONE[tone];
98
99
  const shown = icon === false ? null : icon ?? defaultCalloutIcon(tone, compact ? 14 : 16);
99
100
  const href = hrefProp == null ? void 0 : safeUrl(hrefProp) ?? void 0;
@@ -310,7 +311,7 @@ function Sparkline({
310
311
  ref,
311
312
  ...rest
312
313
  }) {
313
- const strings = useNishStrings();
314
+ const strings = useStrings(DISPLAY_STRINGS, SHELL_STRINGS);
314
315
  const { empty, lines, areas, baseline } = useMemo(
315
316
  () => sparklineGeometry(values, width, height, min, max),
316
317
  [values, width, height, min, max]
@@ -472,7 +473,7 @@ function CopyButton({
472
473
  ref,
473
474
  ...rest
474
475
  }) {
475
- const strings = useNishStrings();
476
+ const strings = useStrings(DISPLAY_STRINGS, SHELL_STRINGS);
476
477
  const idleText = label ?? strings.copy;
477
478
  const doneText = copiedLabel ?? strings.copied;
478
479
  const [state, setState] = useState("idle");
@@ -578,7 +579,7 @@ function AppHeader({
578
579
  ref: refProp,
579
580
  ...rest
580
581
  }) {
581
- const strings = useNishStrings();
582
+ const strings = useStrings(DISPLAY_STRINGS, SHELL_STRINGS);
582
583
  const ref = useRef(null);
583
584
  useHeightVar(ref, "--nish-header-h", sticky);
584
585
  const stuck = useStuck(ref) && sticky;
@@ -711,7 +712,7 @@ function KeyValueList({ items, dense = false, as = "ul", className, ref, ...rest
711
712
  ] }, it.key)) });
712
713
  }
713
714
  function ChartLegend({ items, marker = "line", label, className, ref, ...rest }) {
714
- const strings = useNishStrings();
715
+ const strings = useStrings(DISPLAY_STRINGS, SHELL_STRINGS);
715
716
  return /* @__PURE__ */ jsx(
716
717
  "ul",
717
718
  {
@@ -6,7 +6,8 @@ import { cn } from "../cn.js";
6
6
  import { XIcon } from "./icons.js";
7
7
  import { IconButton } from "./primitives.js";
8
8
  import { Portal } from "./portal.js";
9
- import { useNishStrings } from "./provider.js";
9
+ import { useStrings } from "./provider.js";
10
+ import { OVERLAY_STRINGS } from "./strings.js";
10
11
  import { DRAWER_SHEET_HEIGHT, DRAWER_WIDTH } from "./overlay-classes.js";
11
12
  import { warnDev, useMergedRef, useScrollable } from "./overlay-core.js";
12
13
  import { useDialog, useSheetExit, useSheetSwipe, SheetHandle } from "./overlay-dialog.js";
@@ -35,7 +36,7 @@ function DrawerPanel({
35
36
  ref,
36
37
  ...rest
37
38
  }) {
38
- const strings = useNishStrings();
39
+ const strings = useStrings(OVERLAY_STRINGS);
39
40
  const titleId = useId();
40
41
  const [panelRef, setPanelRef] = useMergedRef(ref);
41
42
  const scrimRef = useRef(null);
@@ -3,7 +3,8 @@
3
3
  // src/components/error-boundary.tsx
4
4
  import { Component } from "react";
5
5
  import { Button, Card } from "./primitives.js";
6
- import { useNishStrings } from "./provider.js";
6
+ import { useStrings } from "./provider.js";
7
+ import { ERROR_STRINGS } from "./strings.js";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  var CHUNK_MESSAGE = /Failed to fetch dynamically imported module|Importing a module script failed/;
9
10
  function isChunkError(e) {
@@ -19,6 +20,7 @@ function isDevelopment() {
19
20
  return false;
20
21
  }
21
22
  }
23
+ var useErrorStrings = () => useStrings(ERROR_STRINGS);
22
24
  var Boundary = class extends Component {
23
25
  state = { error: null };
24
26
  static getDerivedStateFromError(error) {
@@ -56,7 +58,7 @@ var Boundary = class extends Component {
56
58
  }
57
59
  };
58
60
  function AppErrorBoundary(props) {
59
- const strings = useNishStrings();
61
+ const strings = useErrorStrings();
60
62
  return /* @__PURE__ */ jsx(Boundary, { ...props, strings });
61
63
  }
62
64
  export {
@@ -4,13 +4,14 @@
4
4
  import { cn } from "../cn.js";
5
5
  import { AlertTriangleIcon, LoaderIcon, RotateIcon } from "./icons.js";
6
6
  import { cardClass } from "./primitives.js";
7
- import { useNishStrings } from "./provider.js";
7
+ import { useStrings } from "./provider.js";
8
+ import { STATUS_STRINGS } from "./strings.js";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  function Skeleton({ className, style, ref, ...rest }) {
10
11
  return /* @__PURE__ */ jsx("div", { ...rest, ref, "aria-hidden": "true", className: cn("nish-skeleton rounded-md", className), style });
11
12
  }
12
13
  function SkeletonRows({ rows = 5, height = 56, gap = "md", label, className, rowClassName, ref, ...rest }) {
13
- const s = useNishStrings();
14
+ const s = useStrings(STATUS_STRINGS);
14
15
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, role: "status", className: cn("grid", gap === "sm" ? "gap-1.5" : "gap-2.5", className), children: [
15
16
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: label ?? s.loading }),
16
17
  Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { className: cn("w-full rounded-xl", rowClassName), style: rowClassName && /\bh-/.test(rowClassName) ? void 0 : { height } }, i))
@@ -28,7 +29,7 @@ function Spinner({ size = "md", label, className, ref, ...rest }) {
28
29
  ] });
29
30
  }
30
31
  function SkeletonLines({ lines = 3, className, label, ref, ...rest }) {
31
- const s = useNishStrings();
32
+ const s = useStrings(STATUS_STRINGS);
32
33
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, role: "status", className: cn("flex flex-col gap-2.5 p-3", className), children: [
33
34
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: label ?? s.loading }),
34
35
  /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-2/5" }),
@@ -44,7 +45,7 @@ function SkeletonCard({ lines = 3, media = "none", className, ref, ...rest }) {
44
45
  ] });
45
46
  }
46
47
  function StatGridSkeleton({ count = 4, className, label, ref, ...rest }) {
47
- const s = useNishStrings();
48
+ const s = useStrings(STATUS_STRINGS);
48
49
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, role: "status", className: cn("grid grid-cols-2 gap-3 md:grid-cols-4", className), children: [
49
50
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: label ?? s.loading }),
50
51
  Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsxs("div", { className: cn(cardClass({ padding: "sm" }), "min-w-0"), children: [
@@ -55,7 +56,7 @@ function StatGridSkeleton({ count = 4, className, label, ref, ...rest }) {
55
56
  ] });
56
57
  }
57
58
  function CardListSkeleton({ count = 3, lines = 2, className, label, ref, ...rest }) {
58
- const s = useNishStrings();
59
+ const s = useStrings(STATUS_STRINGS);
59
60
  return /* @__PURE__ */ jsxs("div", { ...rest, ref, role: "status", className: cn("grid gap-2.5", className), children: [
60
61
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: label ?? s.loading }),
61
62
  Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx(SkeletonCard, { lines }, i))
@@ -91,7 +92,7 @@ function ErrorState({
91
92
  ref,
92
93
  ...rest
93
94
  }) {
94
- const s = useNishStrings();
95
+ const s = useStrings(STATUS_STRINGS);
95
96
  return /* @__PURE__ */ jsxs(
96
97
  "div",
97
98
  {
@@ -5,7 +5,8 @@ import { useRef, useState } from "react";
5
5
  import { cn } from "../cn.js";
6
6
  import { XIcon } from "./icons.js";
7
7
  import { IconButton } from "./primitives.js";
8
- import { useNishStrings } from "./provider.js";
8
+ import { useStrings } from "./provider.js";
9
+ import { FILE_STRINGS } from "./strings.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  function matchesAccept(file, accept) {
11
12
  const tokens = (accept ?? "").split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
@@ -53,7 +54,7 @@ function FileDropzone({
53
54
  "aria-invalid": ariaInvalid,
54
55
  ...rest
55
56
  }) {
56
- const strings = useNishStrings();
57
+ const strings = useStrings(FILE_STRINGS);
57
58
  const input = useRef(null);
58
59
  const depth = useRef(0);
59
60
  const [files, setFiles] = useState([]);
@@ -7,7 +7,8 @@ import { SearchInput } from "./forms.js";
7
7
  import { NARROW_QUERY, useMediaQuery } from "./hooks.js";
8
8
  import { Drawer } from "./drawer.js";
9
9
  import { Badge, Button } from "./primitives.js";
10
- import { useNishStrings } from "./provider.js";
10
+ import { useStrings } from "./provider.js";
11
+ import { FILTER_STRINGS, FIELD_STRINGS } from "./strings.js";
11
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
13
  var LG_QUERY = "(max-width: 1023.98px)";
13
14
  function FunnelIcon({ size = 16, ...rest }) {
@@ -30,7 +31,7 @@ function FunnelIcon({ size = 16, ...rest }) {
30
31
  );
31
32
  }
32
33
  function FilterSheet({ open, onClose, title, children, onClear, activeCount, resultLabel }) {
33
- const strings = useNishStrings();
34
+ const strings = useStrings(FILTER_STRINGS, FIELD_STRINGS);
34
35
  if (!open) return null;
35
36
  return /* @__PURE__ */ jsx(
36
37
  Drawer,
@@ -61,7 +62,7 @@ function FilterBar({
61
62
  ref,
62
63
  ...rest
63
64
  }) {
64
- const strings = useNishStrings();
65
+ const strings = useStrings(FILTER_STRINGS, FIELD_STRINGS);
65
66
  const compact = useMediaQuery(sheetBelow === "lg" ? LG_QUERY : NARROW_QUERY);
66
67
  const [open, setOpen] = useState(false);
67
68
  const hasChildren = children != null && children !== false;
@@ -14,7 +14,8 @@ import { useIsoLayoutEffect } from "./client.js";
14
14
  import { useMediaQuery, useNow } from "./hooks.js";
15
15
  import { Tooltip } from "./tooltip.js";
16
16
  import { Badge } from "./primitives.js";
17
- import { useNishStrings } from "./provider.js";
17
+ import { useStrings } from "./provider.js";
18
+ import { PROGRESS_STRINGS, FLOW_STRINGS } from "./strings.js";
18
19
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
20
  var EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
20
21
  function usePrefersReducedMotion() {
@@ -203,7 +204,7 @@ function StepRow({
203
204
  );
204
205
  }
205
206
  function FlowSteps({ steps, orientation = "auto", label, statusLabels, className, ref, ...rest }) {
206
- const s = useNishStrings();
207
+ const s = useStrings(PROGRESS_STRINGS, FLOW_STRINGS);
207
208
  const allDone = steps.length > 0 && steps.every((s2) => s2.status === "done");
208
209
  const prevAll = useRef(null);
209
210
  const [sweeping, setSweeping] = useState(false);
@@ -234,7 +235,7 @@ function FlowSteps({ steps, orientation = "auto", label, statusLabels, className
234
235
  )) }) });
235
236
  }
236
237
  function StepBar({ total, done, active = false, label, className, ref, ...rest }) {
237
- const s = useNishStrings();
238
+ const s = useStrings(PROGRESS_STRINGS, FLOW_STRINGS);
238
239
  const t = Number.isFinite(total) ? Math.max(0, Math.floor(total)) : 0;
239
240
  const d = Number.isFinite(done) ? Math.min(t, Math.max(0, Math.floor(done))) : 0;
240
241
  const props = {
@@ -397,7 +398,7 @@ function PhaseConnector({ flowing }) {
397
398
  ] });
398
399
  }
399
400
  function WorkflowBoard({ phases, agents, label, otherLabel, waitingLabel, className, ref, ...rest }) {
400
- const s = useNishStrings();
401
+ const s = useStrings(PROGRESS_STRINGS, FLOW_STRINGS);
401
402
  const otherTitle = otherLabel ?? s.other;
402
403
  const fresh = useFreshIds(
403
404
  agents.map((a) => a.id),
@@ -507,7 +508,7 @@ var FEED_DOT = {
507
508
  };
508
509
  var FEED_DOT_FORCED = "forced-colors:bg-[color:CanvasText]";
509
510
  function ActivityFeed({ items, max = 50, now, label, empty, className, ref, ...rest }) {
510
- const s = useNishStrings();
511
+ const s = useStrings(PROGRESS_STRINGS, FLOW_STRINGS);
511
512
  const internalNow = useNow(15e3);
512
513
  const clock = now ?? internalNow;
513
514
  const shown = useMemo(() => [...items].sort((a, b) => b.at - a.at).slice(0, Math.max(0, max)), [items, max]);
@@ -15,7 +15,9 @@ import { cn } from "../cn.js";
15
15
  import { FIELD, IconButton, Input } from "./primitives.js";
16
16
  import { XIcon } from "./icons.js";
17
17
  import { isRtl, useIsoLayoutEffect } from "./client.js";
18
- import { useNishStrings } from "./provider.js";
18
+ import { useStrings } from "./provider.js";
19
+ import { FIELD_STRINGS } from "./strings.js";
20
+ import { warnDev } from "./display-classes.js";
19
21
  import { chipClass, setRef } from "./forms-classes.js";
20
22
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
23
  function Svg({ size = 16, children, ...rest }) {
@@ -180,7 +182,6 @@ function Switch({
180
182
  ref,
181
183
  checked: checkedProp,
182
184
  defaultChecked = false,
183
- onChange,
184
185
  onCheckedChange,
185
186
  name,
186
187
  value = "on",
@@ -194,8 +195,13 @@ function Switch({
194
195
  className,
195
196
  id,
196
197
  onClick,
197
- ...rest
198
+ ...allRest
198
199
  }) {
200
+ const { onChange: removedOnChange, ...rest } = allRest;
201
+ const removed = removedOnChange !== void 0;
202
+ useEffect(() => {
203
+ if (removed) warnDev("Switch: onChange was removed in nish-ui 3.0. Use onCheckedChange(checked).");
204
+ }, [removed]);
199
205
  const auto = useId();
200
206
  const btnId = id ?? `${auto}-switch`;
201
207
  const labelId = `${auto}-label`;
@@ -229,7 +235,6 @@ function Switch({
229
235
  if (e.defaultPrevented) return;
230
236
  const next = !checked;
231
237
  if (!controlled) setInner(next);
232
- onChange?.(next, e);
233
238
  onCheckedChange?.(next);
234
239
  },
235
240
  className: cn(
@@ -327,7 +332,7 @@ function Field({
327
332
  ...rest
328
333
  }) {
329
334
  const auto = useId();
330
- const strings = useNishStrings();
335
+ const strings = useStrings(FIELD_STRINGS);
331
336
  const only = Children.count(children) === 1 && isValidElement(children) ? children : null;
332
337
  const childId = only && typeof only.props.id === "string" ? only.props.id : void 0;
333
338
  const controlId = htmlFor ?? childId ?? `${auto}-control`;
@@ -385,7 +390,7 @@ function Field({
385
390
  }
386
391
  function FieldGroup({ ref, label, hint, error, optional = false, className, children, ...rest }) {
387
392
  const auto = useId();
388
- const strings = useNishStrings();
393
+ const strings = useStrings(FIELD_STRINGS);
389
394
  const hasError = error != null && error !== false && error !== "";
390
395
  const hintId = `${auto}-hint`;
391
396
  const errorId = `${auto}-error`;
@@ -420,7 +425,7 @@ function SearchInput({
420
425
  disabled,
421
426
  ...rest
422
427
  }) {
423
- const strings = useNishStrings();
428
+ const strings = useStrings(FIELD_STRINGS);
424
429
  const inner = useRef(null);
425
430
  const [own, setOwn] = useState(defaultValue);
426
431
  const controlled = valueProp !== void 0;
@@ -494,7 +499,7 @@ function SearchInput({
494
499
  ] });
495
500
  }
496
501
  function Chip({ ref, variant = "toggle", pressed, onRemove, removeLabel, icon, trailing, size = "md", className, children, type = "button", ...rest }) {
497
- const strings = useNishStrings();
502
+ const strings = useStrings(FIELD_STRINGS);
498
503
  if (variant === "tag") {
499
504
  const name = removeLabel ?? (typeof children === "string" ? strings.removeNamed(children) : strings.remove);
500
505
  const spanProps = rest;
@@ -11,7 +11,7 @@ import {
11
11
  import { cn } from "../cn.js";
12
12
  import { ago, dateTime } from "../format.js";
13
13
  import { BREAKPOINTS, NARROW_QUERY, PHONE_QUERY } from "./hooks-classes.js";
14
- import { useNishConfig } from "./provider.js";
14
+ import { useNishContext } from "./provider.js";
15
15
  import { jsx } from "react/jsx-runtime";
16
16
  var queries = /* @__PURE__ */ new Map();
17
17
  function hasMatchMedia() {
@@ -215,7 +215,7 @@ function RelativeTime({
215
215
  ...rest
216
216
  }) {
217
217
  const now = useNow(refreshMs);
218
- const config = useNishConfig();
218
+ const config = useNishContext();
219
219
  const loc = locale ?? config.locale;
220
220
  const d = new Date(value);
221
221
  const iso = Number.isNaN(d.getTime()) ? void 0 : d.toISOString();
@@ -20,7 +20,7 @@ import { mergeRefs, warnOnce } from "./data-classes.js";
20
20
  import { useLatest } from "./latest.js";
21
21
  import { place } from "./overlay-position.js";
22
22
  import { keyboardFocused, touchTracker } from "./overlay-classes.js";
23
- import { useNishConfig } from "./provider.js";
23
+ import { useNishContext } from "./provider.js";
24
24
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
25
25
  var openCard = () => shared("hoverCard", () => ({ close: null }));
26
26
  function useCardPosition(anchor, card, open, side, align) {
@@ -74,7 +74,7 @@ function HoverCard({
74
74
  }) {
75
75
  const [openState, setOpenState] = useState(defaultOpen ?? false);
76
76
  const open = openProp ?? openState;
77
- const config = useNishConfig();
77
+ const config = useNishContext();
78
78
  const isClient = useIsClient();
79
79
  const autoId = useId();
80
80
  const id = rest.id ?? autoId;