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
@@ -14,11 +14,13 @@ import { CheckIcon, ClockIcon, MoreIcon } from "./icons.js";
14
14
  import { DropdownMenu, MenuItem, MenuLabel, MenuSeparator } from "./menu.js";
15
15
  import { ConfirmDialog } from "./modal.js";
16
16
  import { Button, Card, IconButton } from "./primitives.js";
17
- import { useNishStrings } from "./provider.js";
17
+ import { useStrings } from "./provider.js";
18
+ import { INBOX_STRINGS, SHELL_STRINGS, STATUS_STRINGS, OVERLAY_STRINGS } from "./strings.js";
18
19
  import { Tabs } from "./tabs.js";
19
20
  import { DEFAULT_INBOX_LABELS } from "./inbox-classes.js";
20
21
  import { DEFAULT_INBOX_LABELS as DEFAULT_INBOX_LABELS2 } from "./inbox-classes.js";
21
22
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
23
+ var useInboxStrings = () => useStrings(INBOX_STRINGS, SHELL_STRINGS, STATUS_STRINGS, OVERLAY_STRINGS);
22
24
  var DOT_TONE = {
23
25
  urgent: "loss",
24
26
  normal: "accent",
@@ -142,7 +144,7 @@ function Inbox({
142
144
  ref,
143
145
  ...rest
144
146
  }) {
145
- const strings = useNishStrings();
147
+ const strings = useInboxStrings();
146
148
  const labels = { ...DEFAULT_INBOX_LABELS, ...labelOverrides };
147
149
  const idBase = useId().replace(/:/g, "");
148
150
  const wide = useMediaQuery("(min-width: 480px)");
@@ -13,7 +13,8 @@ import { mergeRefs } from "./data-classes.js";
13
13
  import { Callout } from "./display.js";
14
14
  import { useHeightVar, useStuck } from "./layout-vars.js";
15
15
  import { Button } from "./primitives.js";
16
- import { useNishStrings } from "./provider.js";
16
+ import { useStrings } from "./provider.js";
17
+ import { STATUS_STRINGS } from "./strings.js";
17
18
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
18
19
  function StickyBar({
19
20
  children,
@@ -55,7 +56,7 @@ function StickyActionBar({
55
56
  ref: refProp,
56
57
  ...rest
57
58
  }) {
58
- const strings = useNishStrings();
59
+ const strings = useStrings(STATUS_STRINGS);
59
60
  const ref = useRef(null);
60
61
  useHeightVar(ref, "--nish-bottom-bar-h", open);
61
62
  if (!open) return null;
@@ -97,7 +98,7 @@ function LoadingBar({
97
98
  ref,
98
99
  ...rest
99
100
  }) {
100
- const strings = useNishStrings();
101
+ const strings = useStrings(STATUS_STRINGS);
101
102
  const [shown, setShown] = useState(false);
102
103
  useEffect(() => {
103
104
  if (!active) {
@@ -185,7 +186,7 @@ function ConnectionBanner({
185
186
  onRetry,
186
187
  ...rest
187
188
  }) {
188
- const strings = useNishStrings();
189
+ const strings = useStrings(STATUS_STRINGS);
189
190
  const online = useOnline();
190
191
  const [reachable, setReachable] = useState(true);
191
192
  const [retrying, setRetrying] = useState(false);
@@ -6,7 +6,8 @@ import { cn } from "../cn.js";
6
6
  import { safeUrl } from "../url.js";
7
7
  import { ListRow } from "./data.js";
8
8
  import { Badge } from "./primitives.js";
9
- import { useNishStrings } from "./provider.js";
9
+ import { useStrings } from "./provider.js";
10
+ import { MEDIA_STRINGS } from "./strings.js";
10
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  var THUMB_BOX = {
12
13
  wide: {
@@ -61,7 +62,7 @@ function MediaRow({
61
62
  ref,
62
63
  ...rest
63
64
  }) {
64
- const t = useNishStrings();
65
+ const t = useStrings(MEDIA_STRINGS);
65
66
  const small = dense || compact;
66
67
  const size = thumbSize ?? (small ? "sm" : "md");
67
68
  const badgeSize = small ? "xs" : "sm";
@@ -8,7 +8,8 @@ import { isRtl } from "./client.js";
8
8
  import { useMediaQuery } from "./hooks.js";
9
9
  import { useLatest } from "./latest.js";
10
10
  import { lazyModule, useLazyModule } from "./lazy-module.js";
11
- import { useNishConfig, useNishStrings } from "./provider.js";
11
+ import { useStrings, useNishContext } from "./provider.js";
12
+ import { OVERLAY_STRINGS } from "./strings.js";
12
13
  import { MENU_ROW, PHONE_QUERY, menuItemClass } from "./overlay-classes.js";
13
14
  import { layerHost, setRef, useMergedRef } from "./overlay-core.js";
14
15
  import { useAnchoredPosition, floatingStyle, useDismiss, useReturnFocus } from "./overlay-position.js";
@@ -43,8 +44,8 @@ function DropdownMenu({
43
44
  onKeyDown: userKeyDown,
44
45
  ...rest
45
46
  }) {
46
- const strings = useNishStrings();
47
- const config = useNishConfig();
47
+ const strings = useStrings(OVERLAY_STRINGS);
48
+ const config = useNishContext();
48
49
  const [openState, setOpenState] = useState(defaultOpen);
49
50
  const open = openProp ?? openState;
50
51
  const triggerRef = useRef(null);
@@ -291,7 +292,7 @@ function MenuSeparator({
291
292
  return /* @__PURE__ */ jsx("div", { ...rest, ref, role: "separator", className: cn("my-1 h-px bg-th-line forced-colors:bg-[CanvasText]", className) });
292
293
  }
293
294
  function MenuSubHeader({ onBack, children, className, ref, onKeyDown, ...rest }) {
294
- const strings = useNishStrings();
295
+ const strings = useStrings(OVERLAY_STRINGS);
295
296
  return /* @__PURE__ */ jsxs(
296
297
  "button",
297
298
  {
@@ -7,7 +7,8 @@ import { XIcon } from "./icons.js";
7
7
  import { Button } from "./primitives.js";
8
8
  import { useLatest } from "./latest.js";
9
9
  import { Portal } from "./portal.js";
10
- import { useNishStrings } from "./provider.js";
10
+ import { useStrings } from "./provider.js";
11
+ import { OVERLAY_STRINGS } from "./strings.js";
11
12
  import { CLOSE_BUTTON, MODAL_SIZE, SHEET_HEIGHT_CLASS } from "./overlay-classes.js";
12
13
  import { isPhoneViewport, closeVetoes, warnDev, useMergedRef, useScrollable } from "./overlay-core.js";
13
14
  import { useDialog, useSheetExit, useSheetSwipe, SheetHandle } from "./overlay-dialog.js";
@@ -38,7 +39,7 @@ function ModalPanel({
38
39
  ref,
39
40
  ...rest
40
41
  }) {
41
- const strings = useNishStrings();
42
+ const strings = useStrings(OVERLAY_STRINGS);
42
43
  const titleId = useId();
43
44
  const [panelRef, setPanelRef] = useMergedRef(ref);
44
45
  const scrimRef = useRef(null);
@@ -132,7 +133,7 @@ function ConfirmDialog({
132
133
  open,
133
134
  onOpenChange
134
135
  }) {
135
- const strings = useNishStrings();
136
+ const strings = useStrings(OVERLAY_STRINGS);
136
137
  const bodyId = useId();
137
138
  const pendingRef = useLatest(pending);
138
139
  const onOpenChangeRef = useLatest(onOpenChange);
@@ -5,11 +5,12 @@ import { cn } from "../cn.js";
5
5
  import { FORCED_MARK } from "./display-classes.js";
6
6
  import { Drawer } from "./drawer.js";
7
7
  import { FOCUS, NavBadge, renderItem, visibleNavItems } from "./nav-items.js";
8
- import { useNishStrings } from "./provider.js";
8
+ import { useStrings } from "./provider.js";
9
+ import { SHELL_STRINGS, THEME_STRINGS } from "./strings.js";
9
10
  import { ThemeToggle } from "./theme-toggle.js";
10
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  function MoreSheet({ open, onClose, items, title, footer, renderLink }) {
12
- const strings = useNishStrings();
13
+ const strings = useStrings(SHELL_STRINGS, THEME_STRINGS);
13
14
  if (!open) return null;
14
15
  const shown = visibleNavItems(items);
15
16
  const row = (active) => cn(
@@ -7,7 +7,8 @@ import { CheckIcon, XIcon } from "./icons.js";
7
7
  import { Spinner } from "./feedback.js";
8
8
  import { Chip } from "./forms.js";
9
9
  import { fieldClass } from "./primitives.js";
10
- import { useNishStrings } from "./provider.js";
10
+ import { useStrings } from "./provider.js";
11
+ import { FIELD_STRINGS, MULTI_SELECT_STRINGS } from "./strings.js";
11
12
  import { indexComboboxOptions, setRef } from "./forms-classes.js";
12
13
  import { COMBOBOX_DEBOUNCE_MS, COMBOBOX_MAX_SHOWN } from "../combobox-filter.js";
13
14
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -42,7 +43,7 @@ function MultiSelect({
42
43
  className,
43
44
  ...rest
44
45
  }) {
45
- const strings = useNishStrings();
46
+ const strings = useStrings(FIELD_STRINGS, MULTI_SELECT_STRINGS);
46
47
  const autoId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
47
48
  const inputId = id ?? `nish-ms-${autoId}`;
48
49
  const listId = `nish-ms-list-${autoId}`;
@@ -6,10 +6,11 @@ import { safeUrl } from "../url.js";
6
6
  import { isRtl, useIsoLayoutEffect } from "./client.js";
7
7
  import { navigateFromLayer } from "./navigate.js";
8
8
  import { warnDev } from "./display-classes.js";
9
- import { useNishConfig, useNishStrings } from "./provider.js";
9
+ import { useStrings, useNishContext } from "./provider.js";
10
+ import { SHELL_STRINGS } from "./strings.js";
10
11
  import { jsx } from "react/jsx-runtime";
11
12
  function useEndSide(ref) {
12
- const dir = useNishConfig().dir;
13
+ const dir = useNishContext().dir;
13
14
  const [rtl, setRtl] = useState(dir === "rtl");
14
15
  useIsoLayoutEffect(() => {
15
16
  setRtl(dir ? dir === "rtl" : isRtl(ref.current));
@@ -17,7 +18,7 @@ function useEndSide(ref) {
17
18
  return rtl ? "left" : "right";
18
19
  }
19
20
  function NavBadge({ value }) {
20
- const strings = useNishStrings();
21
+ const strings = useStrings(SHELL_STRINGS);
21
22
  if (value === void 0 || value === false || value === 0) return null;
22
23
  if (value === true) {
23
24
  return /* @__PURE__ */ jsx(
@@ -16,7 +16,8 @@ import { PanelLeftCloseIcon, PanelLeftOpenIcon } from "./icons.js";
16
16
  import { useHeightVar, useScrollEdges } from "./layout-vars.js";
17
17
  import { NavBadge, FOCUS, renderItem, useEndSide, visibleNavItems } from "./nav-items.js";
18
18
  import { IconButton } from "./primitives.js";
19
- import { useNishStrings } from "./provider.js";
19
+ import { useStrings } from "./provider.js";
20
+ import { SHELL_STRINGS } from "./strings.js";
20
21
  import { Tooltip } from "./tooltip.js";
21
22
  import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
22
23
  var MAX_QUERY = {
@@ -44,7 +45,7 @@ function BottomNav({
44
45
  ref: refProp,
45
46
  ...rest
46
47
  }) {
47
- const strings = useNishStrings();
48
+ const strings = useStrings(SHELL_STRINGS);
48
49
  const ref = useRef(null);
49
50
  const visible = useMediaQuery(MAX_QUERY[hideFrom]);
50
51
  useHeightVar(ref, "--nish-bottom-nav-h", visible);
@@ -115,7 +116,7 @@ function NavRail({
115
116
  ref: refProp,
116
117
  ...rest
117
118
  }) {
118
- const strings = useNishStrings();
119
+ const strings = useStrings(SHELL_STRINGS);
119
120
  const ref = useRef(null);
120
121
  const side = useEndSide(ref);
121
122
  const shown = visibleNavItems(items);
@@ -179,7 +180,7 @@ function NavSidebar({
179
180
  ref: refProp,
180
181
  ...rest
181
182
  }) {
182
- const strings = useNishStrings();
183
+ const strings = useStrings(SHELL_STRINGS);
183
184
  const ref = useRef(null);
184
185
  const side = useEndSide(ref);
185
186
  const shown = visibleNavItems(items);
@@ -4,7 +4,8 @@
4
4
  import { useCallback, useEffect, useRef, useState } from "react";
5
5
  import { cn } from "../cn.js";
6
6
  import { useLatest } from "./latest.js";
7
- import { useNishStrings } from "./provider.js";
7
+ import { useStrings } from "./provider.js";
8
+ import { OVERLAY_STRINGS } from "./strings.js";
8
9
  import { SHEET_EXIT_MS } from "./overlay-classes.js";
9
10
  import { ov, isTop, syncLayerAttr, pushInert, popInert, acquireGuard, releaseGuard, prefersReducedMotion, closeVetoes, focusables, lockScroll, queueHistoryPush, cancelHistoryPush } from "./overlay-core.js";
10
11
  import { jsx } from "react/jsx-runtime";
@@ -225,7 +226,7 @@ function useSheetSwipe(panelRef, scrimRef, enabled, onDismiss, allow = () => tru
225
226
  };
226
227
  }
227
228
  function SheetHandle({ onClose, swipe, className }) {
228
- const strings = useNishStrings();
229
+ const strings = useStrings(OVERLAY_STRINGS);
229
230
  return /* @__PURE__ */ jsx(
230
231
  "div",
231
232
  {
@@ -4,7 +4,8 @@
4
4
  import { useCallback, useRef, useState } from "react";
5
5
  import { cn } from "../cn.js";
6
6
  import { useIsoLayoutEffect } from "./client.js";
7
- import { useNishStrings } from "./provider.js";
7
+ import { useStrings } from "./provider.js";
8
+ import { PAGING_STRINGS } from "./strings.js";
8
9
  import { paginationRange } from "./pagination-classes.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  var SIZE = { sm: "h-8 min-w-8 text-xs", md: "h-9 min-w-9 text-sm" };
@@ -60,7 +61,7 @@ function Pagination({
60
61
  ref,
61
62
  ...rest
62
63
  }) {
63
- const strings = useNishStrings();
64
+ const strings = useStrings(PAGING_STRINGS);
64
65
  const [pageState, setPageState] = useState(defaultPage);
65
66
  const navRef = useRef(null);
66
67
  const [narrow, setNarrow] = useState(false);
@@ -6,7 +6,7 @@ import { createPortal } from "react-dom";
6
6
  import { cn } from "../cn.js";
7
7
  import { useIsClient } from "./client.js";
8
8
  import { useLatest } from "./latest.js";
9
- import { useNishConfig } from "./provider.js";
9
+ import { useNishContext } from "./provider.js";
10
10
  import { focusables, layerHost, useMergedRef } from "./overlay-core.js";
11
11
  import { useAnchoredPosition, floatingStyle, useDismiss, useReturnFocus } from "./overlay-position.js";
12
12
  import { jsx } from "react/jsx-runtime";
@@ -26,7 +26,7 @@ function Popover({
26
26
  onKeyDown: userKeyDown,
27
27
  ...rest
28
28
  }) {
29
- const config = useNishConfig();
29
+ const config = useNishContext();
30
30
  const isClient = useIsClient();
31
31
  const [panelRef, setPanelRef] = useMergedRef(ref);
32
32
  const pos = useAnchoredPosition(anchor, panelRef, open, side, align);
@@ -3,10 +3,10 @@
3
3
  // src/components/portal.tsx
4
4
  import { createPortal } from "react-dom";
5
5
  import { useIsClient } from "./client.js";
6
- import { useNishConfig } from "./provider.js";
6
+ import { useNishContext } from "./provider.js";
7
7
  function Portal({ children, container }) {
8
8
  const isClient = useIsClient();
9
- const config = useNishConfig();
9
+ const config = useNishContext();
10
10
  if (!isClient) return null;
11
11
  const target = container ?? config.portalContainer ?? document.body;
12
12
  return createPortal(children, target);
@@ -1,7 +1,8 @@
1
1
  // src/components/progress.tsx
2
2
  import { useId } from "react";
3
3
  import { cn } from "../cn.js";
4
- import { useNishStrings } from "./provider.js";
4
+ import { useStrings } from "./provider.js";
5
+ import { PROGRESS_STRINGS } from "./strings.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  var FILL = {
7
8
  accent: "bg-th-accent",
@@ -27,7 +28,7 @@ function Progress({
27
28
  "aria-labelledby": ariaLabelledBy,
28
29
  ...rest
29
30
  }) {
30
- const strings = useNishStrings();
31
+ const strings = useStrings(PROGRESS_STRINGS);
31
32
  const labelId = useId();
32
33
  const indeterminate = value == null || Number.isNaN(value);
33
34
  const clamped = indeterminate ? 0 : Math.min(Math.max(value, 0), max);
@@ -4,8 +4,8 @@
4
4
  import { createContext, useContext, useMemo } from "react";
5
5
  import { DEFAULT_STRINGS } from "./strings.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
- var DEFAULT_CONFIG = { strings: DEFAULT_STRINGS };
8
- var NishContext = /* @__PURE__ */ createContext(DEFAULT_CONFIG);
7
+ var EMPTY = {};
8
+ var NishContext = /* @__PURE__ */ createContext({ strings: EMPTY });
9
9
  function NishProvider({ strings, locale, dir, portalContainer, children }) {
10
10
  const outer = useContext(NishContext);
11
11
  const value = useMemo(
@@ -19,14 +19,43 @@ function NishProvider({ strings, locale, dir, portalContainer, children }) {
19
19
  );
20
20
  return /* @__PURE__ */ jsx(NishContext.Provider, { value, children });
21
21
  }
22
- function useNishConfig() {
22
+ function useNishContext() {
23
23
  return useContext(NishContext);
24
24
  }
25
+ function pick(o, groups) {
26
+ const out = {};
27
+ for (const key of Object.keys(o)) {
28
+ for (const g of groups) {
29
+ if (g && Object.hasOwn(g, key)) {
30
+ out[key] = o[key];
31
+ break;
32
+ }
33
+ }
34
+ }
35
+ return out;
36
+ }
37
+ function useStrings(a, b, c, d) {
38
+ const o = useContext(NishContext).strings;
39
+ return useMemo(
40
+ () => o === EMPTY && !b ? a : Object.assign({}, a, b, c, d, pick(o, [a, b, c, d])),
41
+ [a, b, c, d, o]
42
+ );
43
+ }
44
+ function useNishConfig() {
45
+ const ctx = useContext(NishContext);
46
+ return useMemo(
47
+ () => ({ ...ctx, strings: ctx.strings === EMPTY ? DEFAULT_STRINGS : { ...DEFAULT_STRINGS, ...ctx.strings } }),
48
+ [ctx]
49
+ );
50
+ }
25
51
  function useNishStrings() {
26
- return useContext(NishContext).strings;
52
+ const o = useContext(NishContext).strings;
53
+ return useMemo(() => o === EMPTY ? DEFAULT_STRINGS : { ...DEFAULT_STRINGS, ...o }, [o]);
27
54
  }
28
55
  export {
29
56
  NishProvider,
30
57
  useNishConfig,
31
- useNishStrings
58
+ useNishContext,
59
+ useNishStrings,
60
+ useStrings
32
61
  };
@@ -14,7 +14,8 @@ import {
14
14
  toRange
15
15
  } from "./calendar-classes.js";
16
16
  import { CalendarBase } from "./calendar-base.js";
17
- import { useNishConfig, useNishStrings } from "./provider.js";
17
+ import { useStrings, useNishContext } from "./provider.js";
18
+ import { PICKER_STRINGS } from "./strings.js";
18
19
  import { jsx } from "react/jsx-runtime";
19
20
  var warned = /* @__PURE__ */ new Set();
20
21
  var OUTSIDE = { filled: false, band: null, ariaSelected: false };
@@ -40,8 +41,8 @@ function RangeCalendar({
40
41
  allowDisabledInRange = false,
41
42
  ...shared
42
43
  }) {
43
- const strings = useNishStrings();
44
- const config = useNishConfig();
44
+ const strings = useStrings(PICKER_STRINGS);
45
+ const config = useNishContext();
45
46
  const loc = resolveLocale(shared.locale ?? config.locale ?? getDefaultLocale());
46
47
  const { min: minProp, max: maxProp, isDateDisabled } = shared;
47
48
  const min = minProp != null && parseIso(minProp) ? minProp : null;
@@ -14,11 +14,12 @@ import { ErrorState, SkeletonRows } from "./feedback.js";
14
14
  import { ConfirmDialog } from "./overlay.js";
15
15
  import { Badge, Button } from "./primitives.js";
16
16
  import { apiFetch } from "./resource.js";
17
- import { useNishStrings } from "./provider.js";
17
+ import { useStrings } from "./provider.js";
18
+ import { TOKEN_STRINGS, STATUS_STRINGS, ERROR_STRINGS, OVERLAY_STRINGS } from "./strings.js";
18
19
  import { SettingRow, SettingsSection } from "./settings.js";
19
20
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
20
21
  function useServiceTokens(url = "/api/service-tokens") {
21
- const strings = useNishStrings();
22
+ const strings = useStrings(TOKEN_STRINGS, STATUS_STRINGS, ERROR_STRINGS, OVERLAY_STRINGS);
22
23
  const [tokens, setTokens] = useState(
23
24
  void 0
24
25
  );
@@ -88,7 +89,7 @@ function ServiceTokensSection({
88
89
  envSourceLabel = "from SERVICE_TOKENS",
89
90
  ...rest
90
91
  }) {
91
- const strings = useNishStrings();
92
+ const strings = useStrings(TOKEN_STRINGS, STATUS_STRINGS, ERROR_STRINGS, OVERLAY_STRINGS);
92
93
  const title = titleProp ?? strings.serviceTokens;
93
94
  const description = descriptionProp ?? strings.serviceTokensIntro;
94
95
  const [target, setTarget] = useState(null);
@@ -13,7 +13,8 @@ import {
13
13
  import { cn } from "../cn.js";
14
14
  import { Spinner } from "./feedback.js";
15
15
  import { Card, Input } from "./primitives.js";
16
- import { useNishStrings } from "./provider.js";
16
+ import { useStrings } from "./provider.js";
17
+ import { SETTINGS_STRINGS } from "./strings.js";
17
18
  import { jsx, jsxs } from "react/jsx-runtime";
18
19
  var CompactSettings = /* @__PURE__ */ createContext(false);
19
20
  function SettingsSection({ title, description, id, actions, compact = false, children, className, ref, ...rest }) {
@@ -82,7 +83,7 @@ function SettingRow({
82
83
  var SAVED_MS = 1500;
83
84
  var ERROR_MS = 3e3;
84
85
  function useSaveStatus() {
85
- const strings = useNishStrings();
86
+ const strings = useStrings(SETTINGS_STRINGS);
86
87
  const [status, setStatus] = useState("idle");
87
88
  const [error, setError] = useState(null);
88
89
  const timer = useRef(void 0);
@@ -144,7 +145,7 @@ function NumberField({
144
145
  ref,
145
146
  ...rest
146
147
  }) {
147
- const strings = useNishStrings();
148
+ const strings = useStrings(SETTINGS_STRINGS);
148
149
  const auto = useId();
149
150
  const errId = `${id ?? auto}-error`;
150
151
  const [draft, setDraftState] = useState(fmt(value));
@@ -9,7 +9,8 @@ import {
9
9
  import { cn } from "../cn.js";
10
10
  import { isRtl, useIsoLayoutEffect } from "./client.js";
11
11
  import { useLatest } from "./latest.js";
12
- import { useNishStrings } from "./provider.js";
12
+ import { useStrings } from "./provider.js";
13
+ import { SLIDER_STRINGS } from "./strings.js";
13
14
  import { jsx, jsxs } from "react/jsx-runtime";
14
15
  var decimals = (n) => {
15
16
  const s = String(n);
@@ -69,7 +70,7 @@ function Slider({
69
70
  onPointerCancel,
70
71
  ...rest
71
72
  }) {
72
- const strings = useNishStrings();
73
+ const strings = useStrings(SLIDER_STRINGS);
73
74
  const auto = useId();
74
75
  const rootRef = useRef(null);
75
76
  const trackRef = useRef(null);
@@ -19,7 +19,8 @@ import { isRtl, useIsoLayoutEffect } from "./client.js";
19
19
  import { useMediaQuery } from "./hooks.js";
20
20
  import { ScrollRow } from "./nav.js";
21
21
  import { Tooltip } from "./tooltip.js";
22
- import { useNishStrings } from "./provider.js";
22
+ import { useStrings } from "./provider.js";
23
+ import { SPLIT_STRINGS } from "./strings.js";
23
24
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
24
25
  function nodeAt(node, path) {
25
26
  let cur = node;
@@ -45,7 +46,7 @@ function equalizeAt(node, path) {
45
46
  };
46
47
  }
47
48
  function SplitDividers({ layout, w, h, gap, onResize, onDragChange, minPane, barInset = 0, rtl = false, paneId }) {
48
- const strings = useNishStrings();
49
+ const strings = useStrings(SPLIT_STRINGS);
49
50
  const coarse = useMediaQuery("(pointer: coarse)");
50
51
  const drag = useRef(null);
51
52
  const hit = coarse ? 44 : 24;
@@ -328,7 +329,7 @@ function LayoutPresetPicker({
328
329
  ref,
329
330
  ...rest
330
331
  }) {
331
- const strings = useNishStrings();
332
+ const strings = useStrings(SPLIT_STRINGS);
332
333
  const label = labelProp ?? strings.layoutPresets;
333
334
  const group = useRef(null);
334
335
  const onKeyDown = (e) => {