@imfusion/web-ui 0.11.1-dev.48.g0fcb0d30 → 0.11.1-dev.49.gcda1589f

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.
@@ -0,0 +1,173 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { a as t } from "./utils-J6vbjIt1.js";
3
+ import { cva as n, cx as r } from "class-variance-authority";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ import { createContext as a, useCallback as o, useContext as s } from "react";
6
+ import { Switch as c } from "@base-ui/react/switch";
7
+ import { Tabs as l } from "@base-ui/react/tabs";
8
+ var u = {
9
+ root: "imf-ui-switch-module-root",
10
+ thumb: "imf-ui-switch-module-thumb"
11
+ }, d = /* @__PURE__ */ e({
12
+ Root: () => m,
13
+ Thumb: () => h
14
+ }), f = n(u.root), p = n(u.thumb);
15
+ function m(e) {
16
+ return /* @__PURE__ */ i(c.Root, {
17
+ ...e,
18
+ "data-imf-ui-component": "Switch.Root",
19
+ className: (n) => f({ className: t(e.className, n) })
20
+ });
21
+ }
22
+ m.displayName = "Switch.Root";
23
+ function h(e) {
24
+ return /* @__PURE__ */ i(c.Thumb, {
25
+ ...e,
26
+ "data-imf-ui-component": "Switch.Thumb",
27
+ className: (n) => p({ className: t(e.className, n) })
28
+ });
29
+ }
30
+ h.displayName = "Switch.Thumb";
31
+ var g = {
32
+ item: "imf-ui-tabs-underline-module-item",
33
+ rule: "imf-ui-tabs-underline-module-rule"
34
+ }, _ = n(g.rule), v = n(g.item), y = {
35
+ indicator: "imf-ui-tabs-module-indicator",
36
+ indicatorUnderline: "imf-ui-tabs-module-indicatorUnderline",
37
+ list: "imf-ui-tabs-module-list",
38
+ listFill: "imf-ui-tabs-module-listFill",
39
+ listUnderline: "imf-ui-tabs-module-listUnderline",
40
+ panel: "imf-ui-tabs-module-panel",
41
+ panelUnderline: "imf-ui-tabs-module-panelUnderline",
42
+ panelViewport: "imf-ui-tabs-module-panelViewport",
43
+ panelViewportUnderline: "imf-ui-tabs-module-panelViewportUnderline",
44
+ root: "imf-ui-tabs-module-root",
45
+ tab: "imf-ui-tabs-module-tab",
46
+ tabUnderline: "imf-ui-tabs-module-tabUnderline"
47
+ }, b = /* @__PURE__ */ e({
48
+ Indicator: () => N,
49
+ List: () => j,
50
+ Panel: () => F,
51
+ PanelViewport: () => P,
52
+ Root: () => A,
53
+ Tab: () => M
54
+ }), x = n(y.list, { variants: {
55
+ fill: {
56
+ true: y.listFill,
57
+ false: null
58
+ },
59
+ appearance: {
60
+ boxed: null,
61
+ underline: r(y.listUnderline, _())
62
+ }
63
+ } }), S = n(y.root), C = n(null, { variants: { appearance: {
64
+ boxed: y.tab,
65
+ underline: r(y.tabUnderline, v())
66
+ } } }), w = n(null, { variants: { appearance: {
67
+ boxed: y.indicator,
68
+ underline: y.indicatorUnderline
69
+ } } }), T = n(y.panelViewport, { variants: { appearance: {
70
+ boxed: null,
71
+ underline: y.panelViewportUnderline
72
+ } } }), E = n(y.panel, { variants: { appearance: {
73
+ boxed: null,
74
+ underline: y.panelUnderline
75
+ } } }), D = a("boxed");
76
+ function O(e, t) {
77
+ typeof e == "function" ? e(t) : e && (e.current = t);
78
+ }
79
+ function k(e) {
80
+ let t = new ResizeObserver(() => {
81
+ let t = e.dataset.orientation === "vertical" ? e.scrollHeight > e.clientHeight : e.scrollWidth > e.clientWidth;
82
+ e.toggleAttribute("data-overflowing", t);
83
+ }), n = () => {
84
+ t.disconnect(), t.observe(e);
85
+ for (let n of e.children) t.observe(n);
86
+ }, r = new MutationObserver(n);
87
+ return r.observe(e, { childList: !0 }), n(), () => {
88
+ t.disconnect(), r.disconnect();
89
+ };
90
+ }
91
+ function A({ appearance: e = "boxed", ...n }) {
92
+ let r = n.orientation === "vertical" ? "boxed" : e;
93
+ return /* @__PURE__ */ i(D, {
94
+ value: r,
95
+ children: /* @__PURE__ */ i(l.Root, {
96
+ ...n,
97
+ "data-imf-ui-component": "Tabs.Root",
98
+ className: (e) => S({ className: t(n.className, e) })
99
+ })
100
+ });
101
+ }
102
+ A.displayName = "Tabs.Root";
103
+ function j({ fill: e = !1, ref: n, ...r }) {
104
+ let a = s(D), c = o((e) => {
105
+ if (!e) return;
106
+ O(n, e);
107
+ let t = k(e);
108
+ return () => {
109
+ t(), O(n, null);
110
+ };
111
+ }, [n]);
112
+ return /* @__PURE__ */ i(l.List, {
113
+ ...r,
114
+ ref: c,
115
+ "data-imf-ui-component": "Tabs.List",
116
+ className: (n) => x({
117
+ fill: e,
118
+ appearance: a,
119
+ className: t(r.className, n)
120
+ })
121
+ });
122
+ }
123
+ j.displayName = "Tabs.List";
124
+ function M(e) {
125
+ let n = s(D);
126
+ return /* @__PURE__ */ i(l.Tab, {
127
+ ...e,
128
+ "data-imf-ui-component": "Tabs.Tab",
129
+ className: (r) => C({
130
+ appearance: n,
131
+ className: t(e.className, r)
132
+ })
133
+ });
134
+ }
135
+ M.displayName = "Tabs.Tab";
136
+ function N(e) {
137
+ let n = s(D);
138
+ return /* @__PURE__ */ i(l.Indicator, {
139
+ ...e,
140
+ "data-imf-ui-component": "Tabs.Indicator",
141
+ className: (r) => w({
142
+ appearance: n,
143
+ className: t(e.className, r)
144
+ })
145
+ });
146
+ }
147
+ N.displayName = "Tabs.Indicator";
148
+ function P(e) {
149
+ let t = s(D);
150
+ return /* @__PURE__ */ i("div", {
151
+ ...e,
152
+ "data-imf-ui-component": "Tabs.PanelViewport",
153
+ className: T({
154
+ appearance: t,
155
+ className: e.className
156
+ })
157
+ });
158
+ }
159
+ P.displayName = "Tabs.PanelViewport";
160
+ function F(e) {
161
+ let n = s(D);
162
+ return /* @__PURE__ */ i(l.Panel, {
163
+ ...e,
164
+ "data-imf-ui-component": "Tabs.Panel",
165
+ className: (r) => E({
166
+ appearance: n,
167
+ className: t(e.className, r)
168
+ })
169
+ });
170
+ }
171
+ F.displayName = "Tabs.Panel";
172
+ //#endregion
173
+ export { A as a, v as c, h as d, d as f, P as i, _ as l, j as n, M as o, F as r, b as s, N as t, m as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imfusion/web-ui",
3
- "version": "0.11.1-dev.48.g0fcb0d30",
3
+ "version": "0.11.1-dev.49.gcda1589f",
4
4
  "description": "The official Web UI component library for ImFusion web apps",
5
5
  "author": "ImFusion GmbH",
6
6
  "homepage": "https://imfusion.com",
@@ -122,8 +122,8 @@
122
122
  "commander": "15.0.0"
123
123
  },
124
124
  "devDependencies": {
125
- "@imfusion/sdk": "1.0.0",
126
- "@imfusion/sdk-react": "1.0.0",
125
+ "@imfusion/sdk": "1.3.0",
126
+ "@imfusion/sdk-react": "1.3.0",
127
127
  "@storybook/addon-a11y": "10.6.2",
128
128
  "@storybook/addon-docs": "10.6.2",
129
129
  "@storybook/addon-mcp": "10.6.2",
@@ -14267,5 +14267,28 @@
14267
14267
  ]
14268
14268
  },
14269
14269
  "subComponents": []
14270
+ },
14271
+ "view-tools": {
14272
+ "root": {
14273
+ "name": "ViewTools",
14274
+ "description": "ViewTools - Pan, Zoom, and Windowing toggles that limit the left mouse button in the main 2D and MPR views to one\naction, and a button that resets the view group. Releasing the active toggle restores the default input mapping.\nThe active tool is the one `useViewInteraction` reads and sets.\n\nMust render inside `ImFusionReady`, within an `ImFusionProvider`. Needs `@imfusion/sdk` 1.3.0 or later.",
14275
+ "props": [
14276
+ {
14277
+ "name": "orientation",
14278
+ "required": false,
14279
+ "type": "\"horizontal\" | \"vertical\"",
14280
+ "defaultValue": null,
14281
+ "description": "Lays the tools out in a row or a column."
14282
+ },
14283
+ {
14284
+ "name": "ref",
14285
+ "required": false,
14286
+ "type": "Ref<HTMLDivElement>",
14287
+ "defaultValue": null,
14288
+ "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}"
14289
+ }
14290
+ ]
14291
+ },
14292
+ "subComponents": []
14270
14293
  }
14271
14294
  }
@@ -308,3 +308,9 @@ Hover- or focus-triggered label for brief help about a control or term. Also cal
308
308
  - category: Display, status: stable
309
309
  Semantic text primitives for display and standard headings, paragraphs, lists, quotes, links, and inline code. The namespace uses native HTML elements and token-based text roles.
310
310
  - props: node_modules/@imfusion/web-ui/src/docgen/doc.gen.json -> .typo (jq: jq '.typo' node_modules/@imfusion/web-ui/src/docgen/doc.gen.json)
311
+
312
+ ## ViewTools
313
+ - category: Inputs, status: experimental
314
+ Toolbar that limits mouse interaction in the ImFusion main 2D and MPR views to pan, zoom, or windowing, with a reset button for the view group. For a segmented control not tied to the SDK, use ToggleGroup.
315
+ - props: node_modules/@imfusion/web-ui/src/docgen/doc.gen.json -> .view-tools (jq: jq '.view-tools' node_modules/@imfusion/web-ui/src/docgen/doc.gen.json)
316
+ - further reading (usage/anatomy, not props): https://docs.imfusion.com/
@@ -1,305 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { a as t } from "./utils-J6vbjIt1.js";
3
- import { cva as n, cx as r } from "class-variance-authority";
4
- import { jsx as i } from "react/jsx-runtime";
5
- import { createContext as a, useCallback as o, useContext as s } from "react";
6
- import { Switch as c } from "@base-ui/react/switch";
7
- import { Tabs as l } from "@base-ui/react/tabs";
8
- var u = {
9
- alignCenter: "imf-ui-stack-module-alignCenter",
10
- alignEnd: "imf-ui-stack-module-alignEnd",
11
- alignStart: "imf-ui-stack-module-alignStart",
12
- alignStretch: "imf-ui-stack-module-alignStretch",
13
- gap0: "imf-ui-stack-module-gap0",
14
- gap1: "imf-ui-stack-module-gap1",
15
- gap10: "imf-ui-stack-module-gap10",
16
- gap2: "imf-ui-stack-module-gap2",
17
- gap3: "imf-ui-stack-module-gap3",
18
- gap4: "imf-ui-stack-module-gap4",
19
- gap5: "imf-ui-stack-module-gap5",
20
- gap6: "imf-ui-stack-module-gap6",
21
- gap7: "imf-ui-stack-module-gap7",
22
- gap8: "imf-ui-stack-module-gap8",
23
- gap9: "imf-ui-stack-module-gap9",
24
- justifyAround: "imf-ui-stack-module-justifyAround",
25
- justifyBetween: "imf-ui-stack-module-justifyBetween",
26
- justifyCenter: "imf-ui-stack-module-justifyCenter",
27
- justifyEnd: "imf-ui-stack-module-justifyEnd",
28
- justifyEvenly: "imf-ui-stack-module-justifyEvenly",
29
- justifyStart: "imf-ui-stack-module-justifyStart",
30
- root: "imf-ui-stack-module-root"
31
- }, d = n(u.root, { variants: {
32
- gap: {
33
- 0: u.gap0,
34
- 1: u.gap1,
35
- 2: u.gap2,
36
- 3: u.gap3,
37
- 4: u.gap4,
38
- 5: u.gap5,
39
- 6: u.gap6,
40
- 7: u.gap7,
41
- 8: u.gap8,
42
- 9: u.gap9,
43
- 10: u.gap10
44
- },
45
- align: {
46
- start: u.alignStart,
47
- center: u.alignCenter,
48
- end: u.alignEnd,
49
- stretch: u.alignStretch
50
- },
51
- justify: {
52
- start: u.justifyStart,
53
- center: u.justifyCenter,
54
- end: u.justifyEnd,
55
- between: u.justifyBetween,
56
- around: u.justifyAround,
57
- evenly: u.justifyEvenly
58
- }
59
- } });
60
- function f({ gap: e = "4", align: t = "stretch", justify: n = "start", ...r }) {
61
- return /* @__PURE__ */ i("div", {
62
- ...r,
63
- "data-imf-ui-component": "Stack",
64
- className: d({
65
- gap: e,
66
- align: t,
67
- justify: n,
68
- className: r.className
69
- })
70
- });
71
- }
72
- var p = {
73
- root: "imf-ui-switch-module-root",
74
- thumb: "imf-ui-switch-module-thumb"
75
- }, m = /* @__PURE__ */ e({
76
- Root: () => _,
77
- Thumb: () => v
78
- }), h = n(p.root), g = n(p.thumb);
79
- function _(e) {
80
- return /* @__PURE__ */ i(c.Root, {
81
- ...e,
82
- "data-imf-ui-component": "Switch.Root",
83
- className: (n) => h({ className: t(e.className, n) })
84
- });
85
- }
86
- _.displayName = "Switch.Root";
87
- function v(e) {
88
- return /* @__PURE__ */ i(c.Thumb, {
89
- ...e,
90
- "data-imf-ui-component": "Switch.Thumb",
91
- className: (n) => g({ className: t(e.className, n) })
92
- });
93
- }
94
- v.displayName = "Switch.Thumb";
95
- var y = {
96
- alignCenter: "imf-ui-row-module-alignCenter",
97
- alignEnd: "imf-ui-row-module-alignEnd",
98
- alignStart: "imf-ui-row-module-alignStart",
99
- alignStretch: "imf-ui-row-module-alignStretch",
100
- gap1: "imf-ui-row-module-gap1",
101
- gap10: "imf-ui-row-module-gap10",
102
- gap2: "imf-ui-row-module-gap2",
103
- gap3: "imf-ui-row-module-gap3",
104
- gap4: "imf-ui-row-module-gap4",
105
- gap5: "imf-ui-row-module-gap5",
106
- gap6: "imf-ui-row-module-gap6",
107
- gap7: "imf-ui-row-module-gap7",
108
- gap8: "imf-ui-row-module-gap8",
109
- gap9: "imf-ui-row-module-gap9",
110
- justifyAround: "imf-ui-row-module-justifyAround",
111
- justifyBetween: "imf-ui-row-module-justifyBetween",
112
- justifyCenter: "imf-ui-row-module-justifyCenter",
113
- justifyEnd: "imf-ui-row-module-justifyEnd",
114
- justifyEvenly: "imf-ui-row-module-justifyEvenly",
115
- justifyStart: "imf-ui-row-module-justifyStart",
116
- root: "imf-ui-row-module-root",
117
- wrap: "imf-ui-row-module-wrap"
118
- }, b = n(y.root, { variants: {
119
- gap: {
120
- 1: y.gap1,
121
- 2: y.gap2,
122
- 3: y.gap3,
123
- 4: y.gap4,
124
- 5: y.gap5,
125
- 6: y.gap6,
126
- 7: y.gap7,
127
- 8: y.gap8,
128
- 9: y.gap9,
129
- 10: y.gap10
130
- },
131
- align: {
132
- start: y.alignStart,
133
- center: y.alignCenter,
134
- end: y.alignEnd,
135
- stretch: y.alignStretch
136
- },
137
- justify: {
138
- start: y.justifyStart,
139
- center: y.justifyCenter,
140
- end: y.justifyEnd,
141
- between: y.justifyBetween,
142
- around: y.justifyAround,
143
- evenly: y.justifyEvenly
144
- },
145
- wrap: {
146
- true: y.wrap,
147
- false: null
148
- }
149
- } });
150
- function x({ gap: e = "2", align: t = "stretch", justify: n = "start", wrap: r = !1, ...a }) {
151
- return /* @__PURE__ */ i("div", {
152
- ...a,
153
- "data-imf-ui-component": "Row",
154
- className: b({
155
- gap: e,
156
- align: t,
157
- justify: n,
158
- wrap: r,
159
- className: a.className
160
- })
161
- });
162
- }
163
- var S = {
164
- item: "imf-ui-tabs-underline-module-item",
165
- rule: "imf-ui-tabs-underline-module-rule"
166
- }, C = n(S.rule), w = n(S.item), T = {
167
- indicator: "imf-ui-tabs-module-indicator",
168
- indicatorUnderline: "imf-ui-tabs-module-indicatorUnderline",
169
- list: "imf-ui-tabs-module-list",
170
- listFill: "imf-ui-tabs-module-listFill",
171
- listUnderline: "imf-ui-tabs-module-listUnderline",
172
- panel: "imf-ui-tabs-module-panel",
173
- panelUnderline: "imf-ui-tabs-module-panelUnderline",
174
- panelViewport: "imf-ui-tabs-module-panelViewport",
175
- panelViewportUnderline: "imf-ui-tabs-module-panelViewportUnderline",
176
- root: "imf-ui-tabs-module-root",
177
- tab: "imf-ui-tabs-module-tab",
178
- tabUnderline: "imf-ui-tabs-module-tabUnderline"
179
- }, E = /* @__PURE__ */ e({
180
- Indicator: () => z,
181
- List: () => L,
182
- Panel: () => V,
183
- PanelViewport: () => B,
184
- Root: () => I,
185
- Tab: () => R
186
- }), D = n(T.list, { variants: {
187
- fill: {
188
- true: T.listFill,
189
- false: null
190
- },
191
- appearance: {
192
- boxed: null,
193
- underline: r(T.listUnderline, C())
194
- }
195
- } }), O = n(T.root), k = n(null, { variants: { appearance: {
196
- boxed: T.tab,
197
- underline: r(T.tabUnderline, w())
198
- } } }), A = n(null, { variants: { appearance: {
199
- boxed: T.indicator,
200
- underline: T.indicatorUnderline
201
- } } }), j = n(T.panelViewport, { variants: { appearance: {
202
- boxed: null,
203
- underline: T.panelViewportUnderline
204
- } } }), M = n(T.panel, { variants: { appearance: {
205
- boxed: null,
206
- underline: T.panelUnderline
207
- } } }), N = a("boxed");
208
- function P(e, t) {
209
- typeof e == "function" ? e(t) : e && (e.current = t);
210
- }
211
- function F(e) {
212
- let t = new ResizeObserver(() => {
213
- let t = e.dataset.orientation === "vertical" ? e.scrollHeight > e.clientHeight : e.scrollWidth > e.clientWidth;
214
- e.toggleAttribute("data-overflowing", t);
215
- }), n = () => {
216
- t.disconnect(), t.observe(e);
217
- for (let n of e.children) t.observe(n);
218
- }, r = new MutationObserver(n);
219
- return r.observe(e, { childList: !0 }), n(), () => {
220
- t.disconnect(), r.disconnect();
221
- };
222
- }
223
- function I({ appearance: e = "boxed", ...n }) {
224
- let r = n.orientation === "vertical" ? "boxed" : e;
225
- return /* @__PURE__ */ i(N, {
226
- value: r,
227
- children: /* @__PURE__ */ i(l.Root, {
228
- ...n,
229
- "data-imf-ui-component": "Tabs.Root",
230
- className: (e) => O({ className: t(n.className, e) })
231
- })
232
- });
233
- }
234
- I.displayName = "Tabs.Root";
235
- function L({ fill: e = !1, ref: n, ...r }) {
236
- let a = s(N), c = o((e) => {
237
- if (!e) return;
238
- P(n, e);
239
- let t = F(e);
240
- return () => {
241
- t(), P(n, null);
242
- };
243
- }, [n]);
244
- return /* @__PURE__ */ i(l.List, {
245
- ...r,
246
- ref: c,
247
- "data-imf-ui-component": "Tabs.List",
248
- className: (n) => D({
249
- fill: e,
250
- appearance: a,
251
- className: t(r.className, n)
252
- })
253
- });
254
- }
255
- L.displayName = "Tabs.List";
256
- function R(e) {
257
- let n = s(N);
258
- return /* @__PURE__ */ i(l.Tab, {
259
- ...e,
260
- "data-imf-ui-component": "Tabs.Tab",
261
- className: (r) => k({
262
- appearance: n,
263
- className: t(e.className, r)
264
- })
265
- });
266
- }
267
- R.displayName = "Tabs.Tab";
268
- function z(e) {
269
- let n = s(N);
270
- return /* @__PURE__ */ i(l.Indicator, {
271
- ...e,
272
- "data-imf-ui-component": "Tabs.Indicator",
273
- className: (r) => A({
274
- appearance: n,
275
- className: t(e.className, r)
276
- })
277
- });
278
- }
279
- z.displayName = "Tabs.Indicator";
280
- function B(e) {
281
- let t = s(N);
282
- return /* @__PURE__ */ i("div", {
283
- ...e,
284
- "data-imf-ui-component": "Tabs.PanelViewport",
285
- className: j({
286
- appearance: t,
287
- className: e.className
288
- })
289
- });
290
- }
291
- B.displayName = "Tabs.PanelViewport";
292
- function V(e) {
293
- let n = s(N);
294
- return /* @__PURE__ */ i(l.Panel, {
295
- ...e,
296
- "data-imf-ui-component": "Tabs.Panel",
297
- className: (r) => M({
298
- appearance: n,
299
- className: t(e.className, r)
300
- })
301
- });
302
- }
303
- V.displayName = "Tabs.Panel";
304
- //#endregion
305
- export { I as a, w as c, _ as d, v as f, B as i, C as l, f as m, L as n, R as o, m as p, V as r, E as s, z as t, x as u };