@imfusion/web-ui 0.10.1-dev.33.g8275f59f → 0.10.1-dev.37.g9147f90f

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.
@@ -3,26 +3,26 @@ import { mh as r, pM as i } from "./icons-BsK_o-Cb.js";
3
3
  import { t as a } from "./meta-V_KyLeGn.js";
4
4
  import { cva as o } from "class-variance-authority";
5
5
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
- import { Children as l, useCallback as u } from "react";
7
- import { Switch as d } from "@base-ui/react/switch";
8
- import { Toggle as f } from "@base-ui/react/toggle";
9
- import { ToggleGroup as p } from "@base-ui/react/toggle-group";
10
- import { Tabs as m } from "@base-ui/react/tabs";
11
- var h = {
6
+ import { Children as l, createContext as u, useCallback as d, useContext as f } from "react";
7
+ import { Toggle as p } from "@base-ui/react/toggle";
8
+ import { ToggleGroup as ee } from "@base-ui/react/toggle-group";
9
+ import { Switch as m } from "@base-ui/react/switch";
10
+ import { Tabs as h } from "@base-ui/react/tabs";
11
+ var g = {
12
12
  flat: "imf-ui-kbd-module-flat",
13
13
  icon: "imf-ui-kbd-module-icon",
14
14
  primary: "imf-ui-kbd-module-primary",
15
15
  root: "imf-ui-kbd-module-root"
16
- }, g = o(h.root, { variants: { variant: {
16
+ }, _ = o(g.root, { variants: { variant: {
17
17
  default: null,
18
- primary: h.primary,
19
- flat: h.flat
18
+ primary: g.primary,
19
+ flat: g.flat
20
20
  } } });
21
- function _({ variant: e = "default", icon: t = !1, children: n, ...a }) {
21
+ function v({ variant: e = "default", icon: t = !1, children: n, ...a }) {
22
22
  return /* @__PURE__ */ c("kbd", {
23
23
  ...a,
24
24
  "data-imf-ui-component": "Kbd",
25
- className: g({
25
+ className: _({
26
26
  variant: e,
27
27
  className: a.className
28
28
  }),
@@ -30,20 +30,20 @@ function _({ variant: e = "default", icon: t = !1, children: n, ...a }) {
30
30
  glyph: r,
31
31
  strokeWidth: 2,
32
32
  "aria-hidden": !0,
33
- className: h.icon
33
+ className: g.icon
34
34
  }), n]
35
35
  });
36
36
  }
37
37
  //#endregion
38
38
  //#region src/components/kbd/kbd.meta.ts
39
- var ee = {
39
+ var te = {
40
40
  name: "Kbd",
41
41
  category: a.display,
42
42
  status: "experimental",
43
43
  description: "Shows a keyboard key or shortcut, such as the letter that activates a button. Also called a key hint; Button and Toggle render it through their `shortcut` prop.",
44
44
  origin: "native",
45
45
  internalDependencies: ["Icon"]
46
- }, v = {
46
+ }, y = {
47
47
  ctrl: "Control",
48
48
  control: "Control",
49
49
  cmd: "Meta",
@@ -58,75 +58,94 @@ var ee = {
58
58
  esc: "Escape",
59
59
  escape: "Escape"
60
60
  };
61
- function y(e) {
61
+ function b(e) {
62
62
  let t = e.trim().split(/\s+/).filter(Boolean);
63
- if (t.length !== 0) return t.map((e) => v[e.toLowerCase()] ?? (e.length === 1 ? e.toUpperCase() : e)).join("+");
63
+ if (t.length !== 0) return t.map((e) => y[e.toLowerCase()] ?? (e.length === 1 ? e.toUpperCase() : e)).join("+");
64
64
  }
65
- var b = {
66
- root: "imf-ui-switch-module-root",
67
- thumb: "imf-ui-switch-module-thumb"
68
- }, x = /* @__PURE__ */ t({
69
- Root: () => w,
70
- Thumb: () => T
71
- }), S = o(b.root), C = o(b.thumb);
72
- function w(e) {
73
- return /* @__PURE__ */ s(d.Root, {
74
- ...e,
75
- "data-imf-ui-component": "Switch.Root",
76
- className: (t) => S({ className: n(e.className, t) })
77
- });
78
- }
79
- w.displayName = "Switch.Root";
80
- function T(e) {
81
- return /* @__PURE__ */ s(d.Thumb, {
82
- ...e,
83
- "data-imf-ui-component": "Switch.Thumb",
84
- className: (t) => C({ className: n(e.className, t) })
85
- });
86
- }
87
- T.displayName = "Switch.Thumb";
88
- var E = {
65
+ //#endregion
66
+ //#region src/components/toggle-group/toggle-group-size.ts
67
+ var x = u("md"), S = {
89
68
  root: "imf-ui-toggle-module-root",
90
- shortcut: "imf-ui-toggle-module-shortcut"
91
- }, te = o(E.root), D = 2;
92
- function O(e) {
69
+ shortcut: "imf-ui-toggle-module-shortcut",
70
+ sizeSm: "imf-ui-toggle-module-sizeSm"
71
+ }, C = o(S.root, { variants: { size: {
72
+ sm: S.sizeSm,
73
+ md: null
74
+ } } }), w = 2;
75
+ function T(e) {
93
76
  let t = 0;
94
77
  return l.forEach(e, (e) => {
95
- typeof e == "string" || typeof e == "number" ? t += String(e).trim().length : e != null && typeof e != "boolean" && (t += D);
78
+ typeof e == "string" || typeof e == "number" ? t += String(e).trim().length : e != null && typeof e != "boolean" && (t += w);
96
79
  }), t;
97
80
  }
98
- function k({ style: t, shortcut: r, children: i, ...a }) {
99
- let o = {
100
- "--glyph-count": O(i),
101
- "--max-glyphs": D
81
+ function ne({ style: t, shortcut: r, size: i, children: a, ...o }) {
82
+ let l = f(x), u = {
83
+ "--glyph-count": T(a),
84
+ "--max-glyphs": w
102
85
  };
103
- return /* @__PURE__ */ c(f, {
104
- "aria-keyshortcuts": r ? y(r) : void 0,
105
- ...a,
86
+ return /* @__PURE__ */ c(p, {
87
+ "aria-keyshortcuts": r ? b(r) : void 0,
88
+ ...o,
106
89
  "data-imf-ui-component": "Toggle",
107
90
  style: (n) => ({
108
- ...o,
91
+ ...u,
109
92
  ...e(t, n)
110
93
  }),
111
- className: (e) => te({ className: n(a.className, e) }),
112
- children: [i, r && /* @__PURE__ */ s(_, {
94
+ className: (e) => C({
95
+ size: i ?? l,
96
+ className: n(o.className, e)
97
+ }),
98
+ children: [a, r && /* @__PURE__ */ s(v, {
113
99
  variant: "flat",
114
- className: E.shortcut,
100
+ className: S.shortcut,
115
101
  "aria-hidden": !0,
116
102
  children: r
117
103
  })]
118
104
  });
119
105
  }
120
- //#endregion
121
- //#region src/components/toggle-group/toggle-group.tsx
122
- var A = o({ root: "imf-ui-toggle-group-module-root" }.root);
106
+ var E = {
107
+ root: "imf-ui-toggle-group-module-root",
108
+ sizeSm: "imf-ui-toggle-group-module-sizeSm"
109
+ }, re = o(E.root, { variants: { size: {
110
+ sm: E.sizeSm,
111
+ md: null
112
+ } } });
113
+ function ie({ size: e = "md", ...t }) {
114
+ return /* @__PURE__ */ s(x.Provider, {
115
+ value: e ?? "md",
116
+ children: /* @__PURE__ */ s(ee, {
117
+ ...t,
118
+ "data-imf-ui-component": "ToggleGroup",
119
+ className: (r) => re({
120
+ size: e,
121
+ className: n(t.className, r)
122
+ })
123
+ })
124
+ });
125
+ }
126
+ var D = {
127
+ root: "imf-ui-switch-module-root",
128
+ thumb: "imf-ui-switch-module-thumb"
129
+ }, ae = /* @__PURE__ */ t({
130
+ Root: () => A,
131
+ Thumb: () => j
132
+ }), O = o(D.root), k = o(D.thumb);
133
+ function A(e) {
134
+ return /* @__PURE__ */ s(m.Root, {
135
+ ...e,
136
+ "data-imf-ui-component": "Switch.Root",
137
+ className: (t) => O({ className: n(e.className, t) })
138
+ });
139
+ }
140
+ A.displayName = "Switch.Root";
123
141
  function j(e) {
124
- return /* @__PURE__ */ s(p, {
142
+ return /* @__PURE__ */ s(m.Thumb, {
125
143
  ...e,
126
- "data-imf-ui-component": "ToggleGroup",
127
- className: (t) => A({ className: n(e.className, t) })
144
+ "data-imf-ui-component": "Switch.Thumb",
145
+ className: (t) => k({ className: n(e.className, t) })
128
146
  });
129
147
  }
148
+ j.displayName = "Switch.Thumb";
130
149
  var M = {
131
150
  alignCenter: "imf-ui-row-module-alignCenter",
132
151
  alignEnd: "imf-ui-row-module-alignEnd",
@@ -294,7 +313,7 @@ function q(e) {
294
313
  };
295
314
  }
296
315
  function J(e) {
297
- return /* @__PURE__ */ s(m.Root, {
316
+ return /* @__PURE__ */ s(h.Root, {
298
317
  ...e,
299
318
  "data-imf-ui-component": "Tabs.Root",
300
319
  className: (t) => V({ className: n(e.className, t) })
@@ -302,7 +321,7 @@ function J(e) {
302
321
  }
303
322
  J.displayName = "Tabs.Root";
304
323
  function Y({ fill: e = !1, ref: t, ...r }) {
305
- let i = u((e) => {
324
+ let i = d((e) => {
306
325
  if (!e) return;
307
326
  K(t, e);
308
327
  let n = q(e);
@@ -310,7 +329,7 @@ function Y({ fill: e = !1, ref: t, ...r }) {
310
329
  n(), K(t, null);
311
330
  };
312
331
  }, [t]);
313
- return /* @__PURE__ */ s(m.List, {
332
+ return /* @__PURE__ */ s(h.List, {
314
333
  ...r,
315
334
  ref: i,
316
335
  "data-imf-ui-component": "Tabs.List",
@@ -322,7 +341,7 @@ function Y({ fill: e = !1, ref: t, ...r }) {
322
341
  }
323
342
  Y.displayName = "Tabs.List";
324
343
  function X(e) {
325
- return /* @__PURE__ */ s(m.Tab, {
344
+ return /* @__PURE__ */ s(h.Tab, {
326
345
  ...e,
327
346
  "data-imf-ui-component": "Tabs.Tab",
328
347
  className: (t) => H({ className: n(e.className, t) })
@@ -330,7 +349,7 @@ function X(e) {
330
349
  }
331
350
  X.displayName = "Tabs.Tab";
332
351
  function Z(e) {
333
- return /* @__PURE__ */ s(m.Indicator, {
352
+ return /* @__PURE__ */ s(h.Indicator, {
334
353
  ...e,
335
354
  "data-imf-ui-component": "Tabs.Indicator",
336
355
  className: (t) => U({ className: n(e.className, t) })
@@ -346,7 +365,7 @@ function Q(e) {
346
365
  }
347
366
  Q.displayName = "Tabs.PanelViewport";
348
367
  function $(e) {
349
- return /* @__PURE__ */ s(m.Panel, {
368
+ return /* @__PURE__ */ s(h.Panel, {
350
369
  ...e,
351
370
  "data-imf-ui-component": "Tabs.Panel",
352
371
  className: (t) => G({ className: n(e.className, t) })
@@ -354,4 +373,4 @@ function $(e) {
354
373
  }
355
374
  $.displayName = "Tabs.Panel";
356
375
  //#endregion
357
- export { _, J as a, L as c, k as d, w as f, ee as g, y as h, Q as i, P as l, x as m, Y as n, X as o, T as p, $ as r, z as s, Z as t, j as u };
376
+ export { v as _, J as a, L as c, j as d, ae as f, te as g, b as h, Q as i, P as l, ne as m, Y as n, X as o, ie as p, $ as r, z as s, Z as t, A as u };
@@ -120,4 +120,8 @@ component colors cannot disagree with them:
120
120
  <WebUIProvider colorScheme="dark">{children}</WebUIProvider>
121
121
  ```
122
122
 
123
+ To let the user pick Light, System, or Dark, place a
124
+ [`ColorSchemeToggle`](?path=/docs/primitives-inputs-colorschemetoggle--docs). It stores the choice and works only while
125
+ the provider's `colorScheme` is unset.
126
+
123
127
  <PageNav />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imfusion/web-ui",
3
- "version": "0.10.1-dev.33.g8275f59f",
3
+ "version": "0.10.1-dev.37.g9147f90f",
4
4
  "description": "The official Web UI component library for ImFusion web apps",
5
5
  "author": "ImFusion GmbH",
6
6
  "homepage": "https://imfusion.com",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "type": "module",
13
13
  "engines": {
14
- "node": ">=24"
14
+ "node": "^22.22.1 || ^24.11 || >=26"
15
15
  },
16
16
  "imports": {
17
17
  "#/*": "./src/*",
@@ -1377,6 +1377,99 @@
1377
1377
  }
1378
1378
  ]
1379
1379
  },
1380
+ "color-scheme-toggle": {
1381
+ "root": {
1382
+ "name": "ColorSchemeToggle",
1383
+ "description": "ColorSchemeToggle - lets the user pick Light, System, or Dark. It reads and stores the preference through\n`useColorScheme`, so placing it is enough. System stays pressed while the page follows the operating system.",
1384
+ "props": [
1385
+ {
1386
+ "name": "className",
1387
+ "required": false,
1388
+ "type": "string | ((state: ToggleGroupState) => string)",
1389
+ "defaultValue": null,
1390
+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."
1391
+ },
1392
+ {
1393
+ "name": "darkLabel",
1394
+ "required": false,
1395
+ "type": "string",
1396
+ "defaultValue": "Dark",
1397
+ "description": "Text of the segment that picks the dark scheme."
1398
+ },
1399
+ {
1400
+ "name": "disabled",
1401
+ "required": false,
1402
+ "type": "boolean",
1403
+ "defaultValue": "false",
1404
+ "description": "Whether the toggle group should ignore user interaction."
1405
+ },
1406
+ {
1407
+ "name": "label",
1408
+ "required": false,
1409
+ "type": "string",
1410
+ "defaultValue": "Color scheme",
1411
+ "description": "Accessible name of the group."
1412
+ },
1413
+ {
1414
+ "name": "lightLabel",
1415
+ "required": false,
1416
+ "type": "string",
1417
+ "defaultValue": "Light",
1418
+ "description": "Text of the segment that picks the light scheme."
1419
+ },
1420
+ {
1421
+ "name": "loopFocus",
1422
+ "required": false,
1423
+ "type": "boolean",
1424
+ "defaultValue": "true",
1425
+ "description": "Whether to loop keyboard focus back to the first item\nwhen the end of the list is reached while using the arrow keys."
1426
+ },
1427
+ {
1428
+ "name": "orientation",
1429
+ "required": false,
1430
+ "type": "Orientation",
1431
+ "defaultValue": "horizontal",
1432
+ "description": ""
1433
+ },
1434
+ {
1435
+ "name": "ref",
1436
+ "required": false,
1437
+ "type": "Ref<HTMLDivElement>",
1438
+ "defaultValue": null,
1439
+ "description": "Allows getting a ref to the component instance.\nOnce the component unmounts, React will set `ref.current` to `null`\n(or call the ref with `null` if you passed a callback ref).\n@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}"
1440
+ },
1441
+ {
1442
+ "name": "render",
1443
+ "required": false,
1444
+ "type": "| ReactElement<\n unknown,\n string | JSXElementConstructor<any>\n >\n| ComponentRenderFn<HTMLProps, ToggleGroupState>",
1445
+ "defaultValue": null,
1446
+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
1447
+ },
1448
+ {
1449
+ "name": "size",
1450
+ "required": false,
1451
+ "type": "\"sm\" | \"md\" | null",
1452
+ "defaultValue": null,
1453
+ "description": ""
1454
+ },
1455
+ {
1456
+ "name": "style",
1457
+ "required": false,
1458
+ "type": "| CSSProperties\n| ((state: ToggleGroupState) => CSSProperties)",
1459
+ "defaultValue": null,
1460
+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."
1461
+ },
1462
+ {
1463
+ "name": "systemLabel",
1464
+ "required": false,
1465
+ "type": "string",
1466
+ "defaultValue": "System",
1467
+ "description": "Text of the segment that follows the operating system."
1468
+ }
1469
+ ]
1470
+ },
1471
+ "subComponents": []
1472
+ },
1380
1473
  "copy-button": {
1381
1474
  "root": {
1382
1475
  "name": "CopyButton",
@@ -6622,6 +6715,13 @@
6622
6715
  "type": "SelectValueType<Value, Multiple> | null",
6623
6716
  "defaultValue": null,
6624
6717
  "description": "The value of the select. Use when controlled."
6718
+ },
6719
+ {
6720
+ "name": "width",
6721
+ "required": false,
6722
+ "type": "\"auto\" | \"wide\" | \"full\" | null",
6723
+ "defaultValue": "auto",
6724
+ "description": "Trigger width: `auto` keeps the compact minimum; `wide` raises it; `full` fills the parent."
6625
6725
  }
6626
6726
  ]
6627
6727
  },
@@ -9290,6 +9390,13 @@
9290
9390
  "defaultValue": null,
9291
9391
  "description": "Key hint shown in the top corner at the end of the line, such as `\"P\"` or `\"Ctrl Z\"`. It also sets\n`aria-keyshortcuts` in its notation (`Control+Z`), which an explicit\n`aria-keyshortcuts` prop overrides. Display only: bind the key in the app, for example with `useHotkey` from TanStack Hotkeys."
9292
9392
  },
9393
+ {
9394
+ "name": "size",
9395
+ "required": false,
9396
+ "type": "\"sm\" | \"md\" | null",
9397
+ "defaultValue": null,
9398
+ "description": "Defaults to the enclosing `ToggleGroup`'s `size`, or `\"md\"` standalone."
9399
+ },
9293
9400
  {
9294
9401
  "name": "style",
9295
9402
  "required": false,
@@ -9311,7 +9418,7 @@
9311
9418
  "toggle-group": {
9312
9419
  "root": {
9313
9420
  "name": "ToggleGroup",
9314
- "description": "ToggleGroup - a set of connected `Toggle`s sharing one value. Single-select by\ndefault (a segmented control); set `multiple` for multi-select. Compose one\n`Toggle` per segment, each with a `value`.",
9421
+ "description": "ToggleGroup - a set of connected `Toggle`s sharing one value. Single-select by\ndefault (a segmented control); set `multiple` for multi-select. Compose one\n`Toggle` per segment, each with a `value`. `size` applies to every toggle in the group.",
9315
9422
  "props": [
9316
9423
  {
9317
9424
  "name": "className",
@@ -9376,6 +9483,13 @@
9376
9483
  "defaultValue": null,
9377
9484
  "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
9378
9485
  },
9486
+ {
9487
+ "name": "size",
9488
+ "required": false,
9489
+ "type": "\"sm\" | \"md\" | null",
9490
+ "defaultValue": "md",
9491
+ "description": ""
9492
+ },
9379
9493
  {
9380
9494
  "name": "style",
9381
9495
  "required": false,
@@ -73,6 +73,11 @@ Show-and-hide region for secondary content such as FAQs, settings, or details. A
73
73
  - props: node_modules/@imfusion/web-ui/src/docgen/doc.gen.json -> .collapsible (jq: jq '.collapsible' node_modules/@imfusion/web-ui/src/docgen/doc.gen.json)
74
74
  - further reading (usage/anatomy, not props): https://base-ui.com/react/components/collapsible.md
75
75
 
76
+ ## ColorSchemeToggle
77
+ - category: Inputs, status: experimental
78
+ Light, System, and Dark segments that set and remember the page's color scheme. Also called an appearance or theme switch; built on ToggleGroup, which is the choice for any other segmented selection.
79
+ - props: node_modules/@imfusion/web-ui/src/docgen/doc.gen.json -> .color-scheme-toggle (jq: jq '.color-scheme-toggle' node_modules/@imfusion/web-ui/src/docgen/doc.gen.json)
80
+
76
81
  ## CopyButton
77
82
  - category: Buttons, status: stable
78
83
  Copies a value to the clipboard and briefly shows confirmation. Also called a copy-to-clipboard button; commonly used with Code.Block.
@@ -70,8 +70,10 @@ Cross-topic invalidation can then use `keys.topic` instead of rebuilding a prefi
70
70
 
71
71
  ## Options factories and naming
72
72
 
73
- Queries use `get*` names such as `getAll`, `getById`, and `getDetails`. Mutations use bare verbs such as `update` or
74
- `delete`. Do not add a topic prefix or `Options` suffix; `context.api.user.getDetails()` already supplies the context.
73
+ Queries use `get*` names such as `getAll`, `getById`, and `getDetails`. Mutations use verbs such as `update` or `delete`. A
74
+ name never repeats its topic or adds an `Options` suffix; `context.api.user.getDetails()` already supplies the context. When
75
+ a topic has more than one mutation target, add the sub-resource to the verb: `api.projects.removeMember(projectId)` and
76
+ `api.projects.setMemberPermissions(projectId)`, where a bare `remove` would read as deleting the project.
75
77
 
76
78
  A query factory owns its key and parsing:
77
79
 
@@ -29,6 +29,9 @@ instead, so component colors cannot resolve against the opposite scheme:
29
29
  <WebUIProvider colorScheme="dark">
30
30
  ```
31
31
 
32
+ To let the user pick Light, System, or Dark, place a `ColorSchemeToggle`. It stores the choice and works only while the
33
+ provider's `colorScheme` is unset.
34
+
32
35
  ## Symptoms of broken setup
33
36
 
34
37
  - Unstyled components usually mean the `styles.css` import is missing.