@stenajs-webui/core 18.0.1 → 18.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v18.0.2 (Mon Feb 27 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Make `Heading` style customisable [#562](https://github.com/StenaIT/stenajs-webui/pull/562) ([@mattias800](https://github.com/mattias800))
6
+
7
+ #### Authors: 1
8
+
9
+ - Mattias Andersson ([@mattias800](https://github.com/mattias800))
10
+
11
+ ---
12
+
1
13
  # v17.29.0 (Mon Dec 12 2022)
2
14
 
3
15
  #### 🐛 Bug Fix
package/dist/index.es.js CHANGED
@@ -1,14 +1,14 @@
1
- (function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("._text_1iisw_1{--swui-text-color: var(--swui-text-primary-color);--swui-text-color-caption: var(--lhds-color-ui-600);--swui-text-color-overline: var(--lhds-color-ui-600);--swui-text-font-family: var(--swui-font-primary);--swui-text-font-weight: var(--swui-font-weight-text);--current-color: var(--swui-text-color);--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium);--current-font-weight: var(--swui-text-font-weight);--current-letter-spacing: var(--swui-text-letter-spacing);font-size:var(--current-font-size);line-height:var(--current-line-height);color:var(--current-color);letter-spacing:var(--current-letter-spacing);font-family:var(--swui-text-font-family);font-weight:var(--current-font-weight)}._text_1iisw_1._bold_1iisw_27{--current-font-weight: var(--swui-font-weight-text-bold)}._text_1iisw_1._caption_1iisw_31{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small);--current-color: var(--swui-text-color-caption);--current-letter-spacing: 0;font-style:italic}._text_1iisw_1._overline_1iisw_39{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller);--current-color: var(--swui-text-color-overline);--current-font-weight: var(--swui-font-weight-text-bold);--current-letter-spacing: .1rem;text-transform:uppercase}._text_1iisw_1._large_1iisw_48{--current-font-size: var(--swui-font-size-large);--current-line-height: var(--swui-line-height-large)}._text_1iisw_1._medium_1iisw_53{--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium)}._text_1iisw_1._small_1iisw_58{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small)}._text_1iisw_1._smaller_1iisw_63{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller)}._heading_1u7xw_1{font-size:var(--swui-heading-font-size);color:var(--lhds-color-ui-900);letter-spacing:0;margin:0;line-height:var(--swui-heading-line-height);font-family:var(--swui-font-primary);font-weight:var(--swui-font-weight-text)}._heading_1u7xw_1._h1_1u7xw_10{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_1u7xw_1._h2_1u7xw_15{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_1u7xw_1._h3_1u7xw_20{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_1u7xw_1._h4_1u7xw_25{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 2.4rem;font-weight:var(--swui-font-weight-text-bold)}._heading_1u7xw_1._h5_1u7xw_31{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}._heading_1u7xw_1._h6_1u7xw_37{--swui-heading-font-size: 1.2rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}")),document.head.appendChild(e)}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
1
+ (function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("._text_1iisw_1{--swui-text-color: var(--swui-text-primary-color);--swui-text-color-caption: var(--lhds-color-ui-600);--swui-text-color-overline: var(--lhds-color-ui-600);--swui-text-font-family: var(--swui-font-primary);--swui-text-font-weight: var(--swui-font-weight-text);--current-color: var(--swui-text-color);--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium);--current-font-weight: var(--swui-text-font-weight);--current-letter-spacing: var(--swui-text-letter-spacing);font-size:var(--current-font-size);line-height:var(--current-line-height);color:var(--current-color);letter-spacing:var(--current-letter-spacing);font-family:var(--swui-text-font-family);font-weight:var(--current-font-weight)}._text_1iisw_1._bold_1iisw_27{--current-font-weight: var(--swui-font-weight-text-bold)}._text_1iisw_1._caption_1iisw_31{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small);--current-color: var(--swui-text-color-caption);--current-letter-spacing: 0;font-style:italic}._text_1iisw_1._overline_1iisw_39{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller);--current-color: var(--swui-text-color-overline);--current-font-weight: var(--swui-font-weight-text-bold);--current-letter-spacing: .1rem;text-transform:uppercase}._text_1iisw_1._large_1iisw_48{--current-font-size: var(--swui-font-size-large);--current-line-height: var(--swui-line-height-large)}._text_1iisw_1._medium_1iisw_53{--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium)}._text_1iisw_1._small_1iisw_58{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small)}._text_1iisw_1._smaller_1iisw_63{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller)}._heading_8a8m8_1{--swui-heading-text-color: var(--swui-text-primary-color);--swui-heading-font-family: var(--swui-font-primary);--swui-heading-font-weight: var(--swui-font-weight-text);font-size:var(--swui-heading-font-size);color:var(--swui-heading-text-color);letter-spacing:0;margin:0;line-height:var(--swui-heading-line-height);font-family:var(--swui-heading-font-family);font-weight:var(--swui-heading-font-weight)}._heading_8a8m8_1._h1_8a8m8_14{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_8a8m8_1._h2_8a8m8_19{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_8a8m8_1._h3_8a8m8_24{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_8a8m8_1._h4_8a8m8_29{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 2.4rem;font-weight:var(--swui-font-weight-text-bold)}._heading_8a8m8_1._h5_8a8m8_35{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}._heading_8a8m8_1._h6_8a8m8_41{--swui-heading-font-size: 1.2rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}")),document.head.appendChild(e)}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
2
  import "@stenajs-webui/theme";
3
- import x from "@emotion/styled";
4
- import { forwardRef as w, useState as f, useCallback as h, useLayoutEffect as L, useRef as p, useEffect as m, useMemo as z } from "react";
5
- import { jsx as a, Fragment as I } from "react/jsx-runtime";
3
+ import _ from "@emotion/styled";
4
+ import { forwardRef as f, useState as p, useCallback as h, useLayoutEffect as L, useRef as w, useEffect as m, useMemo as z } from "react";
5
+ import { jsx as d, Fragment as I } from "react/jsx-runtime";
6
6
  import F from "@emotion/is-prop-valid";
7
7
  import { system as R, background as H, border as N, borderRight as P, borderLeft as V, borderTop as A, borderBottom as j, borderColor as U, borderRadius as q, borderStyle as W, borderWidth as B, boxShadow as K, flexbox as G, overflow as J, position as Q, layout as X, zIndex as Y, left as Z, right as ee, top as te, bottom as ne } from "styled-system";
8
8
  import T from "classnames";
9
9
  import * as re from "react-dom";
10
10
  import { debounce as oe, pickBy as se } from "lodash";
11
- const ce = x.hr`
11
+ const ce = _.hr`
12
12
  display: flex;
13
13
  border: 0;
14
14
  margin: 0;
@@ -16,18 +16,18 @@ const ce = x.hr`
16
16
  background-color: ${(e) => e.color};
17
17
  height: ${(e) => e.vertical ? e.size || "100%" : e.width || "1px"};
18
18
  width: ${(e) => e.vertical ? e.width || "1px" : e.size || "100%"};
19
- `, Be = w(({
19
+ `, Be = f(({
20
20
  color: e = "var(--lhds-color-ui-300)",
21
21
  size: t = "100%",
22
22
  width: n = "1px",
23
23
  vertical: r = !1
24
- }, o) => /* @__PURE__ */ a(ce, {
24
+ }, o) => /* @__PURE__ */ d(ce, {
25
25
  color: e,
26
26
  size: t,
27
27
  width: n,
28
28
  vertical: r,
29
29
  ref: o
30
- })), ue = x.button`
30
+ })), ue = _.button`
31
31
  display: inline-block;
32
32
  user-select: none;
33
33
  border: 0;
@@ -68,7 +68,7 @@ const ce = x.hr`
68
68
  ${({
69
69
  borderRadius: e
70
70
  }) => e ? `border-radius: ${e};` : ""}
71
- `, Ke = w(({
71
+ `, Ke = f(({
72
72
  disableFocusHighlight: e,
73
73
  onClick: t,
74
74
  onDblClick: n,
@@ -78,12 +78,12 @@ const ce = x.hr`
78
78
  opacityOnHover: c,
79
79
  disabled: i,
80
80
  children: u,
81
- background: d = "transparent",
81
+ background: a = "transparent",
82
82
  hoverBackground: l,
83
83
  focusBackground: g,
84
84
  type: M = "button",
85
85
  ...O
86
- }, k) => /* @__PURE__ */ a(ue, {
86
+ }, k) => /* @__PURE__ */ d(ue, {
87
87
  opacityOnHover: c,
88
88
  title: r,
89
89
  disabled: i,
@@ -93,32 +93,32 @@ const ce = x.hr`
93
93
  disableFocusHighlight: e,
94
94
  pointer: !!(t || n) && !s,
95
95
  ref: k,
96
- background: d,
96
+ background: a,
97
97
  hoverBackground: l,
98
98
  focusBackground: g,
99
99
  type: M,
100
100
  ...O,
101
101
  children: u
102
- })), _ = (e) => e == null ? 0 : typeof e == "boolean" ? e ? 1 : 0 : e, ie = {
102
+ })), x = (e) => e == null ? 0 : typeof e == "boolean" ? e ? 1 : 0 : e, ie = {
103
103
  box: "var(--swui-shadow-box)",
104
104
  popover: "var(--swui-shadow-popover)",
105
105
  modal: "var(--swui-shadow-modal)"
106
- }, de = ["spacing", "indent", "gap", "width", "height", "overflow", "display"], ae = (e) => de.includes(e), le = R({
106
+ }, ae = ["spacing", "indent", "gap", "width", "height", "overflow", "display"], de = (e) => ae.includes(e), le = R({
107
107
  row: {
108
108
  property: "flexDirection",
109
109
  transform: (e) => e ? "row" : "column"
110
110
  },
111
111
  indent: {
112
112
  property: "--current-indent",
113
- transform: _
113
+ transform: x
114
114
  },
115
115
  spacing: {
116
116
  property: "--current-spacing",
117
- transform: _
117
+ transform: x
118
118
  },
119
119
  gap: {
120
120
  property: "--current-gap",
121
- transform: _
121
+ transform: x
122
122
  },
123
123
  shadow: {
124
124
  property: "boxShadow",
@@ -127,8 +127,8 @@ const ce = x.hr`
127
127
  return (t = ie[e]) != null ? t : e;
128
128
  }
129
129
  }
130
- }), b = x("div", {
131
- shouldForwardProp: (e) => typeof e == "string" ? ae(e) ? !1 : F(e) : !1
130
+ }), b = _("div", {
131
+ shouldForwardProp: (e) => typeof e == "string" ? de(e) ? !1 : F(e) : !1
132
132
  })`
133
133
  --current-spacing: 0;
134
134
  --current-indent: 0;
@@ -186,8 +186,8 @@ const ce = x.hr`
186
186
  focusWithinBorder: e
187
187
  }) => e ? `border: ${e};` : ""}
188
188
  }
189
- `, Ge = w(function(t, n) {
190
- return /* @__PURE__ */ a(b, {
189
+ `, Ge = f(function(t, n) {
190
+ return /* @__PURE__ */ d(b, {
191
191
  ref: n,
192
192
  ...t
193
193
  });
@@ -203,8 +203,8 @@ const ce = x.hr`
203
203
  right: u,
204
204
  bottom: s
205
205
  };
206
- }, he = (e, t) => e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height && e.bottom === t.bottom && e.top === t.top && e.left === t.left && e.right === t.right, we = (e, t) => {
207
- const [n, r] = f(), o = h(() => {
206
+ }, he = (e, t) => e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height && e.bottom === t.bottom && e.top === t.top && e.left === t.left && e.right === t.right, fe = (e, t) => {
207
+ const [n, r] = p(), o = h(() => {
208
208
  window.requestAnimationFrame(() => {
209
209
  if (e.current) {
210
210
  const s = me(e.current);
@@ -217,40 +217,40 @@ const ce = x.hr`
217
217
  }, [o]), {
218
218
  dimensions: n
219
219
  };
220
- }, Je = w(function({
220
+ }, Je = f(function({
221
221
  onResize: t,
222
222
  ...n
223
223
  }, r) {
224
- const o = p(null), s = r != null ? r : o;
225
- return we(s, t), /* @__PURE__ */ a(b, {
224
+ const o = w(null), s = r != null ? r : o;
225
+ return fe(s, t), /* @__PURE__ */ d(b, {
226
226
  ...n,
227
227
  ref: r
228
228
  });
229
- }), Qe = w(function(t, n) {
230
- return /* @__PURE__ */ a(b, {
229
+ }), Qe = f(function(t, n) {
230
+ return /* @__PURE__ */ d(b, {
231
231
  row: !0,
232
232
  ref: n,
233
233
  ...t
234
234
  });
235
- }), Xe = w(function({
235
+ }), Xe = f(function({
236
236
  num: t = 1,
237
237
  ...n
238
238
  }, r) {
239
- return /* @__PURE__ */ a(b, {
239
+ return /* @__PURE__ */ d(b, {
240
240
  indent: t,
241
241
  ref: r,
242
242
  ...n
243
243
  });
244
- }), Ye = w(function({
244
+ }), Ye = f(function({
245
245
  num: t = 1,
246
246
  ...n
247
247
  }, r) {
248
- return /* @__PURE__ */ a(b, {
248
+ return /* @__PURE__ */ d(b, {
249
249
  spacing: t,
250
250
  ref: r,
251
251
  ...n
252
252
  });
253
- }), fe = x.div`
253
+ }), pe = _.div`
254
254
  --current-size: 1;
255
255
  flex: none;
256
256
  width: calc(var(--current-size) * var(--swui-metrics-space));
@@ -262,7 +262,7 @@ const ce = x.hr`
262
262
  vertical: r = !1
263
263
  }) => {
264
264
  const o = n * (e ? 0.5 : 1);
265
- return /* @__PURE__ */ a(fe, {
265
+ return /* @__PURE__ */ d(pe, {
266
266
  style: {
267
267
  ["--current-size"]: o,
268
268
  height: t ? 1 : void 0,
@@ -273,21 +273,21 @@ const ce = x.hr`
273
273
  children: e,
274
274
  nest: t,
275
275
  render: n
276
- }) => t ? /* @__PURE__ */ a(I, {
276
+ }) => t ? /* @__PURE__ */ d(I, {
277
277
  children: n(e)
278
- }) : /* @__PURE__ */ a(I, {
278
+ }) : /* @__PURE__ */ d(I, {
279
279
  children: e
280
- }), pe = "_text_1iisw_1", ve = "_standard_1iisw_24", ge = "_bold_1iisw_27", be = "_caption_1iisw_31", $e = "_overline_1iisw_39", xe = "_large_1iisw_48", _e = "_medium_1iisw_53", ye = "_small_1iisw_58", Ee = "_smaller_1iisw_63", y = {
281
- text: pe,
280
+ }), we = "_text_1iisw_1", ve = "_standard_1iisw_24", ge = "_bold_1iisw_27", be = "_caption_1iisw_31", $e = "_overline_1iisw_39", _e = "_large_1iisw_48", xe = "_medium_1iisw_53", ye = "_small_1iisw_58", Ee = "_smaller_1iisw_63", y = {
281
+ text: we,
282
282
  standard: ve,
283
283
  bold: ge,
284
284
  caption: be,
285
285
  overline: $e,
286
- large: xe,
287
- medium: _e,
286
+ large: _e,
287
+ medium: xe,
288
288
  small: ye,
289
289
  smaller: Ee
290
- }, $ = w(({
290
+ }, $ = f(({
291
291
  children: e,
292
292
  variant: t = "standard",
293
293
  size: n = "medium",
@@ -297,8 +297,8 @@ const ce = x.hr`
297
297
  whiteSpace: c,
298
298
  wordBreak: i,
299
299
  style: u,
300
- ...d
301
- }, l) => /* @__PURE__ */ a("span", {
300
+ ...a
301
+ }, l) => /* @__PURE__ */ d("span", {
302
302
  className: T(y.text, y[t], y[n], r),
303
303
  ref: l,
304
304
  style: {
@@ -308,21 +308,21 @@ const ce = x.hr`
308
308
  wordBreak: i,
309
309
  ...u
310
310
  },
311
- ...d,
311
+ ...a,
312
312
  children: e
313
- })), tt = $, nt = (e) => /* @__PURE__ */ a($, {
313
+ })), tt = $, nt = (e) => /* @__PURE__ */ d($, {
314
314
  size: "small",
315
315
  ...e
316
- }), rt = (e) => /* @__PURE__ */ a($, {
316
+ }), rt = (e) => /* @__PURE__ */ d($, {
317
317
  size: "smaller",
318
318
  ...e
319
- }), ot = (e) => /* @__PURE__ */ a($, {
319
+ }), ot = (e) => /* @__PURE__ */ d($, {
320
320
  size: "medium",
321
321
  ...e
322
- }), st = (e) => /* @__PURE__ */ a($, {
322
+ }), st = (e) => /* @__PURE__ */ d($, {
323
323
  size: "large",
324
324
  ...e
325
- }), Ie = "_heading_1u7xw_1", Se = "_h1_1u7xw_10", Ce = "_h2_1u7xw_15", De = "_h3_1u7xw_20", Te = "_h4_1u7xw_25", Me = "_h5_1u7xw_31", Oe = "_h6_1u7xw_37", S = {
325
+ }), Ie = "_heading_8a8m8_1", Se = "_h1_8a8m8_14", Ce = "_h2_8a8m8_19", De = "_h3_8a8m8_24", Te = "_h4_8a8m8_29", Me = "_h5_8a8m8_35", Oe = "_h6_8a8m8_41", S = {
326
326
  heading: Ie,
327
327
  h1: Se,
328
328
  h2: Ce,
@@ -330,7 +330,7 @@ const ce = x.hr`
330
330
  h4: Te,
331
331
  h5: Me,
332
332
  h6: Oe
333
- }, ke = w(({
333
+ }, ke = f(({
334
334
  variant: e = "h3",
335
335
  className: t,
336
336
  color: n,
@@ -340,9 +340,9 @@ const ce = x.hr`
340
340
  children: c,
341
341
  as: i,
342
342
  ...u
343
- }, d) => {
343
+ }, a) => {
344
344
  const l = i != null ? i : e;
345
- return /* @__PURE__ */ a(l, {
345
+ return /* @__PURE__ */ d(l, {
346
346
  className: T(S.heading, S[e], t),
347
347
  style: {
348
348
  color: n,
@@ -350,35 +350,35 @@ const ce = x.hr`
350
350
  wordBreak: o,
351
351
  ...s
352
352
  },
353
- ref: d,
353
+ ref: a,
354
354
  ...u,
355
355
  children: c
356
356
  });
357
- }), ct = (e) => /* @__PURE__ */ a(ke, {
357
+ }), ct = (e) => /* @__PURE__ */ d(ke, {
358
358
  variant: "h2",
359
359
  ...e
360
360
  }), Le = (e, t) => e === t, ut = (e, t, n = Le) => {
361
361
  const r = h(
362
362
  (u) => {
363
- e.some((d) => n(d, u)) || t([...e, u]);
363
+ e.some((a) => n(a, u)) || t([...e, u]);
364
364
  },
365
365
  [e, t, n]
366
366
  ), o = h(
367
367
  (u) => {
368
368
  t(
369
- u.reduce((d, l) => d.some((g) => n(g, l)) ? d : [...d, l], e)
369
+ u.reduce((a, l) => a.some((g) => n(g, l)) ? a : [...a, l], e)
370
370
  );
371
371
  },
372
372
  [e, t, n]
373
373
  ), s = h(
374
374
  (u) => {
375
- const d = e.findIndex((l) => n(l, u));
376
- d >= 0 && t(e.filter((l, g) => g !== d));
375
+ const a = e.findIndex((l) => n(l, u));
376
+ a >= 0 && t(e.filter((l, g) => g !== a));
377
377
  },
378
378
  [e, t, n]
379
379
  ), c = h(
380
380
  (u) => {
381
- t(e.filter((d) => !u.some((l) => n(l, d))));
381
+ t(e.filter((a) => !u.some((l) => n(l, a))));
382
382
  },
383
383
  [e, t, n]
384
384
  ), i = h(
@@ -395,7 +395,7 @@ const ce = x.hr`
395
395
  toggle: i
396
396
  };
397
397
  }, E = (e) => {
398
- const [t, n] = f(e), r = h(() => {
398
+ const [t, n] = p(e), r = h(() => {
399
399
  n(!0);
400
400
  }, [n]), o = h(() => {
401
401
  n(!1);
@@ -404,7 +404,7 @@ const ce = x.hr`
404
404
  }, [n]);
405
405
  return [t, r, o, s];
406
406
  }, it = (e, t) => {
407
- const [n, r] = f(e);
407
+ const [n, r] = p(e);
408
408
  return m(() => {
409
409
  const o = setTimeout(() => {
410
410
  r(e);
@@ -413,8 +413,8 @@ const ce = x.hr`
413
413
  clearTimeout(o);
414
414
  };
415
415
  }, [e, t]), n;
416
- }, dt = (e, t) => {
417
- const [n, r] = f(e);
416
+ }, at = (e, t) => {
417
+ const [n, r] = p(e);
418
418
  return m(() => {
419
419
  e && r(!0);
420
420
  const o = setTimeout(() => {
@@ -426,11 +426,11 @@ const ce = x.hr`
426
426
  }, [e, t]), n;
427
427
  };
428
428
  let ze = 0;
429
- const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
430
- const [t, n] = f(() => C(e));
429
+ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, dt = (e) => {
430
+ const [t, n] = p(() => C(e));
431
431
  return m(() => n(C(e)), [e]), t;
432
432
  }, v = (e, t, n) => {
433
- const r = p();
433
+ const r = w();
434
434
  m(() => {
435
435
  r.current = n;
436
436
  }, [n]), m(() => {
@@ -464,8 +464,8 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
464
464
  }, ht = (e) => {
465
465
  const [t, n, r] = E(!1);
466
466
  return v(e, "mouseenter", n), v(e, "mouseleave", r), t;
467
- }, wt = (e, t) => {
468
- const n = p(() => {
467
+ }, ft = (e, t) => {
468
+ const n = w(() => {
469
469
  });
470
470
  m(() => {
471
471
  n.current = t;
@@ -477,8 +477,8 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
477
477
  document.removeEventListener("mousedown", r), document.removeEventListener("touchstart", r);
478
478
  };
479
479
  }, [...e]);
480
- }, ft = (e, t, n) => {
481
- const r = p(() => {
480
+ }, pt = (e, t, n) => {
481
+ const r = w(() => {
482
482
  });
483
483
  m(() => {
484
484
  r.current = t;
@@ -490,8 +490,8 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
490
490
  document.removeEventListener("mousedown", o, n), document.removeEventListener("touchstart", o, n);
491
491
  };
492
492
  }, [e, n]);
493
- }, D = ["mousemove", "mousedown", "keydown", "touchstart", "scroll"], pt = (e, t) => {
494
- const n = p(() => {
493
+ }, D = ["mousemove", "mousedown", "keydown", "touchstart", "scroll"], wt = (e, t) => {
494
+ const n = w(() => {
495
495
  });
496
496
  m(() => {
497
497
  n.current = e;
@@ -504,7 +504,7 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
504
504
  };
505
505
  }, [t]);
506
506
  }, vt = (e, t) => {
507
- const [n, r] = f(!1), { rootMargin: o, root: s, threshold: c } = t || {}, i = z(() => new IntersectionObserver(
507
+ const [n, r] = p(!1), { rootMargin: o, root: s, threshold: c } = t || {}, i = z(() => new IntersectionObserver(
508
508
  ([u]) => r(u.isIntersecting),
509
509
  {
510
510
  rootMargin: o,
@@ -516,12 +516,12 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
516
516
  i.disconnect();
517
517
  }), [i, e]), n;
518
518
  }, gt = (e) => {
519
- const t = p(null);
519
+ const t = w(null);
520
520
  return m(() => {
521
521
  !e || (typeof e == "function" ? e(t.current) : e.current = t.current);
522
522
  }), t;
523
523
  }, bt = (e, t, n = !0) => {
524
- const [r, o] = f(e), s = p(), c = h(
524
+ const [r, o] = p(e), s = w(), c = h(
525
525
  (i, u = t) => {
526
526
  o(i), n && clearTimeout(s.current), s.current = setTimeout(() => o(e), u);
527
527
  },
@@ -532,7 +532,7 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
532
532
  }, []), [r, c];
533
533
  }, $t = (e) => {
534
534
  throw new Error(`Switch unhandled case: ${e}`);
535
- }, xt = (e, t) => t, _t = (e) => Object.keys(e).filter((t) => e[t]), yt = (e) => se(e, Fe), Fe = (e, t) => Re(t), Re = (e) => e.startsWith("data-") || e.startsWith("aria-"), Et = (e) => {
535
+ }, _t = (e, t) => t, xt = (e) => Object.keys(e).filter((t) => e[t]), yt = (e) => se(e, Fe), Fe = (e, t) => Re(t), Re = (e) => e.startsWith("data-") || e.startsWith("aria-"), Et = (e) => {
536
536
  try {
537
537
  const t = parseFloat(e);
538
538
  return isNaN(t) || t == null ? void 0 : t;
@@ -564,28 +564,28 @@ export {
564
564
  ot as StandardText,
565
565
  $ as Text,
566
566
  tt as Txt,
567
- _ as booleanOrNumberToNumber,
568
- xt as exhaustSwitchCase,
567
+ x as booleanOrNumberToNumber,
568
+ _t as exhaustSwitchCase,
569
569
  $t as exhaustSwitchCaseElseThrow,
570
570
  yt as getDataProps,
571
571
  me as getDimensionObject,
572
572
  Et as parseFloatElseUndefined,
573
573
  It as parseIntElseUndefined,
574
- _t as truthyKeysAsList,
574
+ xt as truthyKeysAsList,
575
575
  ut as useArraySet,
576
576
  E as useBoolean,
577
577
  it as useDebounce,
578
- dt as useDelayedFalse,
579
- at as useDomId,
580
- we as useElementDimensions,
578
+ at as useDelayedFalse,
579
+ dt as useDomId,
580
+ fe as useElementDimensions,
581
581
  lt as useElementFocus,
582
582
  v as useEventListener,
583
583
  gt as useForwardedRef,
584
584
  ht as useMouseIsEntered,
585
585
  mt as useMouseIsOver,
586
- wt as useMultiOnClickOutside,
587
- ft as useOnClickOutside,
588
- pt as useOnNoMouseMovement,
586
+ ft as useMultiOnClickOutside,
587
+ pt as useOnClickOutside,
588
+ wt as useOnNoMouseMovement,
589
589
  vt as useOnScreen,
590
590
  bt as useTimeoutState
591
591
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("._text_1iisw_1{--swui-text-color: var(--swui-text-primary-color);--swui-text-color-caption: var(--lhds-color-ui-600);--swui-text-color-overline: var(--lhds-color-ui-600);--swui-text-font-family: var(--swui-font-primary);--swui-text-font-weight: var(--swui-font-weight-text);--current-color: var(--swui-text-color);--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium);--current-font-weight: var(--swui-text-font-weight);--current-letter-spacing: var(--swui-text-letter-spacing);font-size:var(--current-font-size);line-height:var(--current-line-height);color:var(--current-color);letter-spacing:var(--current-letter-spacing);font-family:var(--swui-text-font-family);font-weight:var(--current-font-weight)}._text_1iisw_1._bold_1iisw_27{--current-font-weight: var(--swui-font-weight-text-bold)}._text_1iisw_1._caption_1iisw_31{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small);--current-color: var(--swui-text-color-caption);--current-letter-spacing: 0;font-style:italic}._text_1iisw_1._overline_1iisw_39{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller);--current-color: var(--swui-text-color-overline);--current-font-weight: var(--swui-font-weight-text-bold);--current-letter-spacing: .1rem;text-transform:uppercase}._text_1iisw_1._large_1iisw_48{--current-font-size: var(--swui-font-size-large);--current-line-height: var(--swui-line-height-large)}._text_1iisw_1._medium_1iisw_53{--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium)}._text_1iisw_1._small_1iisw_58{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small)}._text_1iisw_1._smaller_1iisw_63{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller)}._heading_1u7xw_1{font-size:var(--swui-heading-font-size);color:var(--lhds-color-ui-900);letter-spacing:0;margin:0;line-height:var(--swui-heading-line-height);font-family:var(--swui-font-primary);font-weight:var(--swui-font-weight-text)}._heading_1u7xw_1._h1_1u7xw_10{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_1u7xw_1._h2_1u7xw_15{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_1u7xw_1._h3_1u7xw_20{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_1u7xw_1._h4_1u7xw_25{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 2.4rem;font-weight:var(--swui-font-weight-text-bold)}._heading_1u7xw_1._h5_1u7xw_31{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}._heading_1u7xw_1._h6_1u7xw_37{--swui-heading-font-size: 1.2rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}")),document.head.appendChild(e)}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("@stenajs-webui/theme");const L=require("@emotion/styled"),r=require("react"),l=require("react/jsx-runtime"),F=require("@emotion/is-prop-valid"),a=require("styled-system"),z=require("classnames"),N=require("react-dom"),C=require("lodash"),$=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function P(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const g=$(L),q=$(F),I=$(z),H=P(N),A=g.default.hr`
1
+ (function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("._text_1iisw_1{--swui-text-color: var(--swui-text-primary-color);--swui-text-color-caption: var(--lhds-color-ui-600);--swui-text-color-overline: var(--lhds-color-ui-600);--swui-text-font-family: var(--swui-font-primary);--swui-text-font-weight: var(--swui-font-weight-text);--current-color: var(--swui-text-color);--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium);--current-font-weight: var(--swui-text-font-weight);--current-letter-spacing: var(--swui-text-letter-spacing);font-size:var(--current-font-size);line-height:var(--current-line-height);color:var(--current-color);letter-spacing:var(--current-letter-spacing);font-family:var(--swui-text-font-family);font-weight:var(--current-font-weight)}._text_1iisw_1._bold_1iisw_27{--current-font-weight: var(--swui-font-weight-text-bold)}._text_1iisw_1._caption_1iisw_31{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small);--current-color: var(--swui-text-color-caption);--current-letter-spacing: 0;font-style:italic}._text_1iisw_1._overline_1iisw_39{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller);--current-color: var(--swui-text-color-overline);--current-font-weight: var(--swui-font-weight-text-bold);--current-letter-spacing: .1rem;text-transform:uppercase}._text_1iisw_1._large_1iisw_48{--current-font-size: var(--swui-font-size-large);--current-line-height: var(--swui-line-height-large)}._text_1iisw_1._medium_1iisw_53{--current-font-size: var(--swui-font-size-medium);--current-line-height: var(--swui-line-height-medium)}._text_1iisw_1._small_1iisw_58{--current-font-size: var(--swui-font-size-small);--current-line-height: var(--swui-line-height-small)}._text_1iisw_1._smaller_1iisw_63{--current-font-size: var(--swui-font-size-smaller);--current-line-height: var(--swui-line-height-smaller)}._heading_8a8m8_1{--swui-heading-text-color: var(--swui-text-primary-color);--swui-heading-font-family: var(--swui-font-primary);--swui-heading-font-weight: var(--swui-font-weight-text);font-size:var(--swui-heading-font-size);color:var(--swui-heading-text-color);letter-spacing:0;margin:0;line-height:var(--swui-heading-line-height);font-family:var(--swui-heading-font-family);font-weight:var(--swui-heading-font-weight)}._heading_8a8m8_1._h1_8a8m8_14{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_8a8m8_1._h2_8a8m8_19{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_8a8m8_1._h3_8a8m8_24{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_8a8m8_1._h4_8a8m8_29{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 2.4rem;font-weight:var(--swui-font-weight-text-bold)}._heading_8a8m8_1._h5_8a8m8_35{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}._heading_8a8m8_1._h6_8a8m8_41{--swui-heading-font-size: 1.2rem;--swui-heading-line-height: 1.6rem;font-weight:var(--swui-font-weight-text-bold)}")),document.head.appendChild(e)}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("@stenajs-webui/theme");const L=require("@emotion/styled"),r=require("react"),l=require("react/jsx-runtime"),F=require("@emotion/is-prop-valid"),i=require("styled-system"),z=require("classnames"),N=require("react-dom"),C=require("lodash"),$=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function P(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const x=$(L),q=$(F),I=$(z),H=P(N),A=x.default.hr`
3
3
  display: flex;
4
4
  border: 0;
5
5
  margin: 0;
@@ -7,7 +7,7 @@
7
7
  background-color: ${e=>e.color};
8
8
  height: ${e=>e.vertical?e.size||"100%":e.width||"1px"};
9
9
  width: ${e=>e.vertical?e.width||"1px":e.size||"100%"};
10
- `,V=r.forwardRef(({color:e="var(--lhds-color-ui-300)",size:t="100%",width:n="1px",vertical:s=!1},o)=>l.jsx(A,{color:e,size:t,width:n,vertical:s,ref:o})),U=g.default.button`
10
+ `,V=r.forwardRef(({color:e="var(--lhds-color-ui-300)",size:t="100%",width:n="1px",vertical:s=!1},o)=>l.jsx(A,{color:e,size:t,width:n,vertical:s,ref:o})),U=x.default.button`
11
11
  display: inline-block;
12
12
  user-select: none;
13
13
  border: 0;
@@ -30,7 +30,7 @@
30
30
  ${({width:e})=>e?`width: ${e};`:""}
31
31
  ${({height:e})=>e?`height: ${e};`:""}
32
32
  ${({borderRadius:e})=>e?`border-radius: ${e};`:""}
33
- `,B=r.forwardRef(({disableFocusHighlight:e,onClick:t,onDblClick:n,tooltip:s,disableOpacityOnClick:o,disablePointer:u,opacityOnHover:c,disabled:d,children:i,background:f="transparent",hoverBackground:m,focusBackground:x,type:T="button",...k},D)=>{const M=!!(t||n);return l.jsx(U,{opacityOnHover:c,title:s,disabled:d,disableOpacityOnClick:o,onClick:t,onDoubleClick:n,disableFocusHighlight:e,pointer:M&&!u,ref:D,background:f,hoverBackground:m,focusBackground:x,type:T,...k,children:i})}),p=e=>e==null?0:typeof e=="boolean"?e?1:0:e,K={box:"var(--swui-shadow-box)",popover:"var(--swui-shadow-popover)",modal:"var(--swui-shadow-modal)"},W=["spacing","indent","gap","width","height","overflow","display"],G=e=>W.includes(e),J=a.system({row:{property:"flexDirection",transform:e=>e?"row":"column"},indent:{property:"--current-indent",transform:p},spacing:{property:"--current-spacing",transform:p},gap:{property:"--current-gap",transform:p},shadow:{property:"boxShadow",transform:e=>{var t;return(t=K[e])!=null?t:e}}}),w=g.default("div",{shouldForwardProp:e=>typeof e=="string"?G(e)?!1:q.default(e):!1})`
33
+ `,B=r.forwardRef(({disableFocusHighlight:e,onClick:t,onDblClick:n,tooltip:s,disableOpacityOnClick:o,disablePointer:u,opacityOnHover:c,disabled:d,children:a,background:f="transparent",hoverBackground:m,focusBackground:p,type:T="button",...k},D)=>{const M=!!(t||n);return l.jsx(U,{opacityOnHover:c,title:s,disabled:d,disableOpacityOnClick:o,onClick:t,onDoubleClick:n,disableFocusHighlight:e,pointer:M&&!u,ref:D,background:f,hoverBackground:m,focusBackground:p,type:T,...k,children:a})}),g=e=>e==null?0:typeof e=="boolean"?e?1:0:e,K={box:"var(--swui-shadow-box)",popover:"var(--swui-shadow-popover)",modal:"var(--swui-shadow-modal)"},W=["spacing","indent","gap","width","height","overflow","display"],G=e=>W.includes(e),J=i.system({row:{property:"flexDirection",transform:e=>e?"row":"column"},indent:{property:"--current-indent",transform:g},spacing:{property:"--current-spacing",transform:g},gap:{property:"--current-gap",transform:g},shadow:{property:"boxShadow",transform:e=>{var t;return(t=K[e])!=null?t:e}}}),b=x.default("div",{shouldForwardProp:e=>typeof e=="string"?G(e)?!1:q.default(e):!1})`
34
34
  --current-spacing: 0;
35
35
  --current-indent: 0;
36
36
  --current-gap: 0;
@@ -38,26 +38,26 @@
38
38
  display: flex;
39
39
  flex-direction: column;
40
40
  ${J};
41
- ${a.background};
42
- ${a.border};
43
- ${a.borderRight};
44
- ${a.borderLeft};
45
- ${a.borderTop};
46
- ${a.borderBottom};
47
- ${a.borderColor};
48
- ${a.borderRadius};
49
- ${a.borderStyle};
50
- ${a.borderWidth};
51
- ${a.boxShadow};
52
- ${a.flexbox};
53
- ${a.overflow};
54
- ${a.position};
55
- ${a.layout};
56
- ${a.zIndex};
57
- ${a.left};
58
- ${a.right};
59
- ${a.top};
60
- ${a.bottom};
41
+ ${i.background};
42
+ ${i.border};
43
+ ${i.borderRight};
44
+ ${i.borderLeft};
45
+ ${i.borderTop};
46
+ ${i.borderBottom};
47
+ ${i.borderColor};
48
+ ${i.borderRadius};
49
+ ${i.borderStyle};
50
+ ${i.borderWidth};
51
+ ${i.boxShadow};
52
+ ${i.flexbox};
53
+ ${i.overflow};
54
+ ${i.position};
55
+ ${i.layout};
56
+ ${i.zIndex};
57
+ ${i.left};
58
+ ${i.right};
59
+ ${i.top};
60
+ ${i.bottom};
61
61
 
62
62
  gap: calc(var(--current-gap) * var(--swui-metrics-space));
63
63
 
@@ -75,10 +75,10 @@
75
75
  ${({focusWithinBackground:e})=>e?`background: ${e};`:""}
76
76
  ${({focusWithinBorder:e})=>e?`border: ${e};`:""}
77
77
  }
78
- `,Q=r.forwardRef(function(t,n){return l.jsx(w,{ref:n,...t})}),O=e=>{const{x:t,y:n,width:s,height:o,bottom:u,top:c,left:d,right:i}=e.getBoundingClientRect();return{width:s,height:o,top:c,left:d,x:t,y:n,right:i,bottom:u}},X=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height&&e.bottom===t.bottom&&e.top===t.top&&e.left===t.left&&e.right===t.right,R=(e,t)=>{const[n,s]=r.useState(),o=r.useCallback(()=>{window.requestAnimationFrame(()=>{if(e.current){const u=O(e.current);(!n||!X(n,u))&&t&&t(u),s(u)}})},[e,n,s,t]);return r.useLayoutEffect(()=>{o()},[o]),{dimensions:n}},Y=r.forwardRef(function({onResize:t,...n},s){const o=r.useRef(null),u=s!=null?s:o;return R(u,t),l.jsx(w,{...n,ref:s})}),Z=r.forwardRef(function(t,n){return l.jsx(w,{row:!0,ref:n,...t})}),ee=r.forwardRef(function({num:t=1,...n},s){return l.jsx(w,{indent:t,ref:s,...n})}),te=r.forwardRef(function({num:t=1,...n},s){return l.jsx(w,{spacing:t,ref:s,...n})}),ne=g.default.div`
78
+ `,Q=r.forwardRef(function(t,n){return l.jsx(b,{ref:n,...t})}),O=e=>{const{x:t,y:n,width:s,height:o,bottom:u,top:c,left:d,right:a}=e.getBoundingClientRect();return{width:s,height:o,top:c,left:d,x:t,y:n,right:a,bottom:u}},X=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height&&e.bottom===t.bottom&&e.top===t.top&&e.left===t.left&&e.right===t.right,R=(e,t)=>{const[n,s]=r.useState(),o=r.useCallback(()=>{window.requestAnimationFrame(()=>{if(e.current){const u=O(e.current);(!n||!X(n,u))&&t&&t(u),s(u)}})},[e,n,s,t]);return r.useLayoutEffect(()=>{o()},[o]),{dimensions:n}},Y=r.forwardRef(function({onResize:t,...n},s){const o=r.useRef(null),u=s!=null?s:o;return R(u,t),l.jsx(b,{...n,ref:s})}),Z=r.forwardRef(function(t,n){return l.jsx(b,{row:!0,ref:n,...t})}),ee=r.forwardRef(function({num:t=1,...n},s){return l.jsx(b,{indent:t,ref:s,...n})}),te=r.forwardRef(function({num:t=1,...n},s){return l.jsx(b,{spacing:t,ref:s,...n})}),ne=x.default.div`
79
79
  --current-size: 1;
80
80
  flex: none;
81
81
  width: calc(var(--current-size) * var(--swui-metrics-space));
82
82
  height: calc(var(--current-size) * var(--swui-metrics-space));
83
- `,se=({half:e=!1,horizontal:t=!1,num:n=1,vertical:s=!1})=>{const o=n*(e?.5:1);return l.jsx(ne,{style:{["--current-size"]:o,height:t?1:void 0,width:s?1:void 0}})},re=({children:e,nest:t,render:n})=>t?l.jsx(l.Fragment,{children:n(e)}):l.jsx(l.Fragment,{children:e}),oe="_text_1iisw_1",ue="_standard_1iisw_24",ce="_bold_1iisw_27",ie="_caption_1iisw_31",ae="_overline_1iisw_39",de="_large_1iisw_48",le="_medium_1iisw_53",fe="_small_1iisw_58",me="_smaller_1iisw_63",_={text:oe,standard:ue,bold:ce,caption:ie,overline:ae,large:de,medium:le,small:fe,smaller:me},b=r.forwardRef(({children:e,variant:t="standard",size:n="medium",className:s,color:o,userSelect:u,whiteSpace:c,wordBreak:d,style:i,...f},m)=>l.jsx("span",{className:I.default(_.text,_[t],_[n],s),ref:m,style:{color:o,userSelect:u,whiteSpace:c,wordBreak:d,...i},...f,children:e})),he=b,we=e=>l.jsx(b,{size:"small",...e}),be=e=>l.jsx(b,{size:"smaller",...e}),xe=e=>l.jsx(b,{size:"medium",...e}),pe=e=>l.jsx(b,{size:"large",...e}),ge="_heading_1u7xw_1",ve="_h1_1u7xw_10",_e="_h2_1u7xw_15",$e="_h3_1u7xw_20",Ee="_h4_1u7xw_25",ye="_h5_1u7xw_31",Se="_h6_1u7xw_37",E={heading:ge,h1:ve,h2:_e,h3:$e,h4:Ee,h5:ye,h6:Se},j=r.forwardRef(({variant:e="h3",className:t,color:n,whiteSpace:s,wordBreak:o,style:u,children:c,as:d,...i},f)=>{const m=d!=null?d:e;return l.jsx(m,{className:I.default(E.heading,E[e],t),style:{color:n,whiteSpace:s,wordBreak:o,...u},ref:f,...i,children:c})}),Ce=e=>l.jsx(j,{variant:"h2",...e}),Ie=(e,t)=>e===t,Oe=(e,t,n=Ie)=>{const s=r.useCallback(i=>{e.some(f=>n(f,i))||t([...e,i])},[e,t,n]),o=r.useCallback(i=>{t(i.reduce((f,m)=>f.some(x=>n(x,m))?f:[...f,m],e))},[e,t,n]),u=r.useCallback(i=>{const f=e.findIndex(m=>n(m,i));f>=0&&t(e.filter((m,x)=>x!==f))},[e,t,n]),c=r.useCallback(i=>{t(e.filter(f=>!i.some(m=>n(m,f))))},[e,t,n]),d=r.useCallback(i=>{e.some(m=>n(m,i))?u(i):s(i)},[e,s,u,n]);return{add:s,addMultiple:o,remove:u,removeMultiple:c,toggle:d}},v=e=>{const[t,n]=r.useState(e),s=r.useCallback(()=>{n(!0)},[n]),o=r.useCallback(()=>{n(!1)},[n]),u=r.useCallback(()=>{n(c=>!c)},[n]);return[t,s,o,u]},Re=(e,t)=>{const[n,s]=r.useState(e);return r.useEffect(()=>{const o=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(o)}},[e,t]),n},je=(e,t)=>{const[n,s]=r.useState(e);return r.useEffect(()=>{e&&s(!0);const o=setTimeout(()=>{e||s(e)},t);return()=>{clearTimeout(o)}},[e,t]),n};let Te=0;const y=e=>`webui-${e?e+"-":""}${++Te}`,ke=e=>{const[t,n]=r.useState(()=>y(e));return r.useEffect(()=>n(y(e)),[e]),t},h=(e,t,n)=>{const s=r.useRef();r.useEffect(()=>{s.current=n},[n]),r.useEffect(()=>{if(!(e.current&&e.current.addEventListener))return;const u=d=>{if(s.current)return s.current(d)};if(!e.current)return;const c=e.current;return c.addEventListener(t,u),()=>{c&&c.removeEventListener(t,u)}},[t,e])},De=e=>{const[t,n,s]=v(!1);r.useEffect(()=>{document.activeElement===H.findDOMNode(e.current)?n():s()},[e,s,n]),h(e,"focus",n),h(e,"blur",s);const o=r.useCallback(()=>{e.current&&e.current.focus()},[e]),u=r.useCallback(()=>{e.current&&e.current.blur()},[e]);return{isInFocus:t,focus:o,blur:u}},Me=e=>{const[t,n,s]=v(!1);return h(e,"mouseover",n),h(e,"mouseout",s),t},Le=e=>{const[t,n,s]=v(!1);return h(e,"mouseenter",n),h(e,"mouseleave",s),t},Fe=(e,t)=>{const n=r.useRef(()=>{});r.useEffect(()=>{n.current=t},[t]),r.useEffect(()=>{const s=o=>{!e.filter(c=>c.current).every(c=>c.current&&!c.current.contains(o.target))||n.current(o)};return document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}},[...e])},ze=(e,t,n)=>{const s=r.useRef(()=>{});r.useEffect(()=>{s.current=t},[t]),r.useEffect(()=>{const o=u=>{!e.current||e.current.contains(u.target)||s.current(u)};return document.addEventListener("mousedown",o,n),document.addEventListener("touchstart",o,n),()=>{document.removeEventListener("mousedown",o,n),document.removeEventListener("touchstart",o,n)}},[e,n])},S=["mousemove","mousedown","keydown","touchstart","scroll"],Ne=(e,t)=>{const n=r.useRef(()=>{});r.useEffect(()=>{n.current=e},[e]),r.useEffect(()=>{const s=C.debounce(n.current,t);return S.forEach(o=>window.addEventListener(o,s)),()=>{S.forEach(o=>window.removeEventListener(o,s))}},[t])},Pe=(e,t)=>{const[n,s]=r.useState(!1),{rootMargin:o,root:u,threshold:c}=t||{},d=r.useMemo(()=>new IntersectionObserver(([i])=>s(i.isIntersecting),{rootMargin:o,root:u,threshold:c}),[s,o,u,c]);return r.useEffect(()=>(e.current&&d.observe(e.current),()=>{d.disconnect()}),[d,e]),n},qe=e=>{const t=r.useRef(null);return r.useEffect(()=>{!e||(typeof e=="function"?e(t.current):e.current=t.current)}),t},He=(e,t,n=!0)=>{const[s,o]=r.useState(e),u=r.useRef(),c=r.useCallback((d,i=t)=>{o(d),n&&clearTimeout(u.current),u.current=setTimeout(()=>o(e),i)},[t,n,e]);return r.useEffect(()=>()=>{clearTimeout(u.current)},[]),[s,c]},Ae=e=>{throw new Error(`Switch unhandled case: ${e}`)},Ve=(e,t)=>t,Ue=e=>Object.keys(e).filter(t=>e[t]),Be=e=>C.pickBy(e,Ke),Ke=(e,t)=>We(t),We=e=>e.startsWith("data-")||e.startsWith("aria-"),Ge=e=>{try{const t=parseFloat(e);return isNaN(t)||t==null?void 0:t}catch{}},Je=e=>{try{const t=parseInt(e,10);return isNaN(t)||t==null?void 0:t}catch{}};exports.Box=w;exports.Clickable=B;exports.Column=Q;exports.HeaderText=Ce;exports.Heading=j;exports.Indent=ee;exports.LargeText=pe;exports.Nest=re;exports.ResizeAwareBox=Y;exports.Row=Z;exports.SeparatorLine=V;exports.SmallText=we;exports.SmallerText=be;exports.Space=se;exports.Spacing=te;exports.StandardText=xe;exports.Text=b;exports.Txt=he;exports.booleanOrNumberToNumber=p;exports.exhaustSwitchCase=Ve;exports.exhaustSwitchCaseElseThrow=Ae;exports.getDataProps=Be;exports.getDimensionObject=O;exports.parseFloatElseUndefined=Ge;exports.parseIntElseUndefined=Je;exports.truthyKeysAsList=Ue;exports.useArraySet=Oe;exports.useBoolean=v;exports.useDebounce=Re;exports.useDelayedFalse=je;exports.useDomId=ke;exports.useElementDimensions=R;exports.useElementFocus=De;exports.useEventListener=h;exports.useForwardedRef=qe;exports.useMouseIsEntered=Le;exports.useMouseIsOver=Me;exports.useMultiOnClickOutside=Fe;exports.useOnClickOutside=ze;exports.useOnNoMouseMovement=Ne;exports.useOnScreen=Pe;exports.useTimeoutState=He;
83
+ `,se=({half:e=!1,horizontal:t=!1,num:n=1,vertical:s=!1})=>{const o=n*(e?.5:1);return l.jsx(ne,{style:{["--current-size"]:o,height:t?1:void 0,width:s?1:void 0}})},re=({children:e,nest:t,render:n})=>t?l.jsx(l.Fragment,{children:n(e)}):l.jsx(l.Fragment,{children:e}),oe="_text_1iisw_1",ue="_standard_1iisw_24",ce="_bold_1iisw_27",ae="_caption_1iisw_31",ie="_overline_1iisw_39",de="_large_1iisw_48",le="_medium_1iisw_53",fe="_small_1iisw_58",me="_smaller_1iisw_63",_={text:oe,standard:ue,bold:ce,caption:ae,overline:ie,large:de,medium:le,small:fe,smaller:me},w=r.forwardRef(({children:e,variant:t="standard",size:n="medium",className:s,color:o,userSelect:u,whiteSpace:c,wordBreak:d,style:a,...f},m)=>l.jsx("span",{className:I.default(_.text,_[t],_[n],s),ref:m,style:{color:o,userSelect:u,whiteSpace:c,wordBreak:d,...a},...f,children:e})),he=w,be=e=>l.jsx(w,{size:"small",...e}),we=e=>l.jsx(w,{size:"smaller",...e}),pe=e=>l.jsx(w,{size:"medium",...e}),ge=e=>l.jsx(w,{size:"large",...e}),xe="_heading_8a8m8_1",ve="_h1_8a8m8_14",_e="_h2_8a8m8_19",$e="_h3_8a8m8_24",Ee="_h4_8a8m8_29",ye="_h5_8a8m8_35",Se="_h6_8a8m8_41",E={heading:xe,h1:ve,h2:_e,h3:$e,h4:Ee,h5:ye,h6:Se},j=r.forwardRef(({variant:e="h3",className:t,color:n,whiteSpace:s,wordBreak:o,style:u,children:c,as:d,...a},f)=>{const m=d!=null?d:e;return l.jsx(m,{className:I.default(E.heading,E[e],t),style:{color:n,whiteSpace:s,wordBreak:o,...u},ref:f,...a,children:c})}),Ce=e=>l.jsx(j,{variant:"h2",...e}),Ie=(e,t)=>e===t,Oe=(e,t,n=Ie)=>{const s=r.useCallback(a=>{e.some(f=>n(f,a))||t([...e,a])},[e,t,n]),o=r.useCallback(a=>{t(a.reduce((f,m)=>f.some(p=>n(p,m))?f:[...f,m],e))},[e,t,n]),u=r.useCallback(a=>{const f=e.findIndex(m=>n(m,a));f>=0&&t(e.filter((m,p)=>p!==f))},[e,t,n]),c=r.useCallback(a=>{t(e.filter(f=>!a.some(m=>n(m,f))))},[e,t,n]),d=r.useCallback(a=>{e.some(m=>n(m,a))?u(a):s(a)},[e,s,u,n]);return{add:s,addMultiple:o,remove:u,removeMultiple:c,toggle:d}},v=e=>{const[t,n]=r.useState(e),s=r.useCallback(()=>{n(!0)},[n]),o=r.useCallback(()=>{n(!1)},[n]),u=r.useCallback(()=>{n(c=>!c)},[n]);return[t,s,o,u]},Re=(e,t)=>{const[n,s]=r.useState(e);return r.useEffect(()=>{const o=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(o)}},[e,t]),n},je=(e,t)=>{const[n,s]=r.useState(e);return r.useEffect(()=>{e&&s(!0);const o=setTimeout(()=>{e||s(e)},t);return()=>{clearTimeout(o)}},[e,t]),n};let Te=0;const y=e=>`webui-${e?e+"-":""}${++Te}`,ke=e=>{const[t,n]=r.useState(()=>y(e));return r.useEffect(()=>n(y(e)),[e]),t},h=(e,t,n)=>{const s=r.useRef();r.useEffect(()=>{s.current=n},[n]),r.useEffect(()=>{if(!(e.current&&e.current.addEventListener))return;const u=d=>{if(s.current)return s.current(d)};if(!e.current)return;const c=e.current;return c.addEventListener(t,u),()=>{c&&c.removeEventListener(t,u)}},[t,e])},De=e=>{const[t,n,s]=v(!1);r.useEffect(()=>{document.activeElement===H.findDOMNode(e.current)?n():s()},[e,s,n]),h(e,"focus",n),h(e,"blur",s);const o=r.useCallback(()=>{e.current&&e.current.focus()},[e]),u=r.useCallback(()=>{e.current&&e.current.blur()},[e]);return{isInFocus:t,focus:o,blur:u}},Me=e=>{const[t,n,s]=v(!1);return h(e,"mouseover",n),h(e,"mouseout",s),t},Le=e=>{const[t,n,s]=v(!1);return h(e,"mouseenter",n),h(e,"mouseleave",s),t},Fe=(e,t)=>{const n=r.useRef(()=>{});r.useEffect(()=>{n.current=t},[t]),r.useEffect(()=>{const s=o=>{!e.filter(c=>c.current).every(c=>c.current&&!c.current.contains(o.target))||n.current(o)};return document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}},[...e])},ze=(e,t,n)=>{const s=r.useRef(()=>{});r.useEffect(()=>{s.current=t},[t]),r.useEffect(()=>{const o=u=>{!e.current||e.current.contains(u.target)||s.current(u)};return document.addEventListener("mousedown",o,n),document.addEventListener("touchstart",o,n),()=>{document.removeEventListener("mousedown",o,n),document.removeEventListener("touchstart",o,n)}},[e,n])},S=["mousemove","mousedown","keydown","touchstart","scroll"],Ne=(e,t)=>{const n=r.useRef(()=>{});r.useEffect(()=>{n.current=e},[e]),r.useEffect(()=>{const s=C.debounce(n.current,t);return S.forEach(o=>window.addEventListener(o,s)),()=>{S.forEach(o=>window.removeEventListener(o,s))}},[t])},Pe=(e,t)=>{const[n,s]=r.useState(!1),{rootMargin:o,root:u,threshold:c}=t||{},d=r.useMemo(()=>new IntersectionObserver(([a])=>s(a.isIntersecting),{rootMargin:o,root:u,threshold:c}),[s,o,u,c]);return r.useEffect(()=>(e.current&&d.observe(e.current),()=>{d.disconnect()}),[d,e]),n},qe=e=>{const t=r.useRef(null);return r.useEffect(()=>{!e||(typeof e=="function"?e(t.current):e.current=t.current)}),t},He=(e,t,n=!0)=>{const[s,o]=r.useState(e),u=r.useRef(),c=r.useCallback((d,a=t)=>{o(d),n&&clearTimeout(u.current),u.current=setTimeout(()=>o(e),a)},[t,n,e]);return r.useEffect(()=>()=>{clearTimeout(u.current)},[]),[s,c]},Ae=e=>{throw new Error(`Switch unhandled case: ${e}`)},Ve=(e,t)=>t,Ue=e=>Object.keys(e).filter(t=>e[t]),Be=e=>C.pickBy(e,Ke),Ke=(e,t)=>We(t),We=e=>e.startsWith("data-")||e.startsWith("aria-"),Ge=e=>{try{const t=parseFloat(e);return isNaN(t)||t==null?void 0:t}catch{}},Je=e=>{try{const t=parseInt(e,10);return isNaN(t)||t==null?void 0:t}catch{}};exports.Box=b;exports.Clickable=B;exports.Column=Q;exports.HeaderText=Ce;exports.Heading=j;exports.Indent=ee;exports.LargeText=ge;exports.Nest=re;exports.ResizeAwareBox=Y;exports.Row=Z;exports.SeparatorLine=V;exports.SmallText=be;exports.SmallerText=we;exports.Space=se;exports.Spacing=te;exports.StandardText=pe;exports.Text=w;exports.Txt=he;exports.booleanOrNumberToNumber=g;exports.exhaustSwitchCase=Ve;exports.exhaustSwitchCaseElseThrow=Ae;exports.getDataProps=Be;exports.getDimensionObject=O;exports.parseFloatElseUndefined=Ge;exports.parseIntElseUndefined=Je;exports.truthyKeysAsList=Ue;exports.useArraySet=Oe;exports.useBoolean=v;exports.useDebounce=Re;exports.useDelayedFalse=je;exports.useDomId=ke;exports.useElementDimensions=R;exports.useElementFocus=De;exports.useEventListener=h;exports.useForwardedRef=qe;exports.useMouseIsEntered=Le;exports.useMouseIsOver=Me;exports.useMultiOnClickOutside=Fe;exports.useOnClickOutside=ze;exports.useOnNoMouseMovement=Ne;exports.useOnScreen=Pe;exports.useTimeoutState=He;
84
84
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stenajs-webui/core",
3
- "version": "18.0.1",
3
+ "version": "18.0.2",
4
4
  "description": "",
5
5
  "author": "mattias800",
6
6
  "license": "MIT",
@@ -57,10 +57,10 @@
57
57
  "files": [
58
58
  "dist"
59
59
  ],
60
- "gitHead": "3b29d5277f79cfc67a462a61f27d2d586177068c",
60
+ "gitHead": "3e4bfbf528f68923646676835386cbd0fac6a589",
61
61
  "dependencies": {
62
62
  "@emotion/is-prop-valid": "^1.1.0",
63
- "@stenajs-webui/theme": "18.0.1",
63
+ "@stenajs-webui/theme": "18.0.2",
64
64
  "classnames": "^2.3.1"
65
65
  }
66
66
  }