@stenajs-webui/core 19.0.0-next.2 → 19.0.0-next.4
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/dist/index.es.js +30 -30
- package/dist/index.js +5 -5
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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)}.
|
|
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_1us7p_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-bold);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_1us7p_1._h1_1us7p_14{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_1us7p_1._h2_1us7p_19{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_1us7p_1._h3_1us7p_24{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_1us7p_1._h4_1us7p_29{--swui-heading-font-size: 1.8rem;--swui-heading-line-height: 2.4rem}._heading_1us7p_1._h5_1us7p_34{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 1.6rem}._heading_1us7p_1._h6_1us7p_39{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem}")),document.head.appendChild(e)}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
|
|
2
2
|
import "@stenajs-webui/theme";
|
|
3
3
|
import _ from "@emotion/styled";
|
|
4
|
-
import { forwardRef as
|
|
4
|
+
import { forwardRef as p, useState as f, useCallback as h, useLayoutEffect as L, useRef as w, useEffect as m, useMemo as z } from "react";
|
|
5
5
|
import { jsx as a, Fragment as I } from "react/jsx-runtime";
|
|
6
6
|
import F from "@emotion/is-prop-valid";
|
|
7
|
-
import { system as R, background as
|
|
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";
|
|
@@ -16,7 +16,7 @@ const ce = _.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 =
|
|
19
|
+
`, Be = p(({
|
|
20
20
|
color: e = "var(--lhds-color-ui-300)",
|
|
21
21
|
size: t = "100%",
|
|
22
22
|
width: n = "1px",
|
|
@@ -68,7 +68,7 @@ const ce = _.hr`
|
|
|
68
68
|
${({
|
|
69
69
|
borderRadius: e
|
|
70
70
|
}) => e ? `border-radius: ${e};` : ""}
|
|
71
|
-
`, Ke =
|
|
71
|
+
`, Ke = p(({
|
|
72
72
|
disableFocusHighlight: e,
|
|
73
73
|
onClick: t,
|
|
74
74
|
onDblClick: n,
|
|
@@ -137,12 +137,12 @@ const ce = _.hr`
|
|
|
137
137
|
display: flex;
|
|
138
138
|
flex-direction: column;
|
|
139
139
|
${le};
|
|
140
|
-
${j};
|
|
141
140
|
${H};
|
|
142
141
|
${N};
|
|
143
142
|
${P};
|
|
144
143
|
${V};
|
|
145
144
|
${A};
|
|
145
|
+
${j};
|
|
146
146
|
${U};
|
|
147
147
|
${q};
|
|
148
148
|
${W};
|
|
@@ -186,7 +186,7 @@ const ce = _.hr`
|
|
|
186
186
|
focusWithinBorder: e
|
|
187
187
|
}) => e ? `border: ${e};` : ""}
|
|
188
188
|
}
|
|
189
|
-
`, Ge =
|
|
189
|
+
`, Ge = p(function(t, n) {
|
|
190
190
|
return /* @__PURE__ */ a(b, {
|
|
191
191
|
ref: n,
|
|
192
192
|
...t
|
|
@@ -203,8 +203,8 @@ const ce = _.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,
|
|
207
|
-
const [n, r] =
|
|
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, pe = (e, t) => {
|
|
207
|
+
const [n, r] = f(), o = h(() => {
|
|
208
208
|
window.requestAnimationFrame(() => {
|
|
209
209
|
if (e.current) {
|
|
210
210
|
const s = me(e.current);
|
|
@@ -217,22 +217,22 @@ const ce = _.hr`
|
|
|
217
217
|
}, [o]), {
|
|
218
218
|
dimensions: n
|
|
219
219
|
};
|
|
220
|
-
}, Je =
|
|
220
|
+
}, Je = p(function({
|
|
221
221
|
onResize: t,
|
|
222
222
|
...n
|
|
223
223
|
}, r) {
|
|
224
224
|
const o = w(null), s = r != null ? r : o;
|
|
225
|
-
return
|
|
225
|
+
return pe(s, t), /* @__PURE__ */ a(b, {
|
|
226
226
|
...n,
|
|
227
227
|
ref: r
|
|
228
228
|
});
|
|
229
|
-
}), Qe =
|
|
229
|
+
}), Qe = p(function(t, n) {
|
|
230
230
|
return /* @__PURE__ */ a(b, {
|
|
231
231
|
row: !0,
|
|
232
232
|
ref: n,
|
|
233
233
|
...t
|
|
234
234
|
});
|
|
235
|
-
}), Xe =
|
|
235
|
+
}), Xe = p(function({
|
|
236
236
|
num: t = 1,
|
|
237
237
|
...n
|
|
238
238
|
}, r) {
|
|
@@ -241,7 +241,7 @@ const ce = _.hr`
|
|
|
241
241
|
ref: r,
|
|
242
242
|
...n
|
|
243
243
|
});
|
|
244
|
-
}), Ye =
|
|
244
|
+
}), Ye = p(function({
|
|
245
245
|
num: t = 1,
|
|
246
246
|
...n
|
|
247
247
|
}, r) {
|
|
@@ -250,7 +250,7 @@ const ce = _.hr`
|
|
|
250
250
|
ref: r,
|
|
251
251
|
...n
|
|
252
252
|
});
|
|
253
|
-
}),
|
|
253
|
+
}), fe = _.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 = _.hr`
|
|
|
262
262
|
vertical: r = !1
|
|
263
263
|
}) => {
|
|
264
264
|
const o = n * (e ? 0.5 : 1);
|
|
265
|
-
return /* @__PURE__ */ a(
|
|
265
|
+
return /* @__PURE__ */ a(fe, {
|
|
266
266
|
style: {
|
|
267
267
|
["--current-size"]: o,
|
|
268
268
|
height: t ? 1 : void 0,
|
|
@@ -287,7 +287,7 @@ const ce = _.hr`
|
|
|
287
287
|
medium: xe,
|
|
288
288
|
small: ye,
|
|
289
289
|
smaller: Ee
|
|
290
|
-
}, $ =
|
|
290
|
+
}, $ = p(({
|
|
291
291
|
children: e,
|
|
292
292
|
variant: t = "standard",
|
|
293
293
|
size: n = "medium",
|
|
@@ -322,7 +322,7 @@ const ce = _.hr`
|
|
|
322
322
|
}), st = (e) => /* @__PURE__ */ a($, {
|
|
323
323
|
size: "large",
|
|
324
324
|
...e
|
|
325
|
-
}), Ie = "
|
|
325
|
+
}), Ie = "_heading_1us7p_1", Se = "_h1_1us7p_14", Ce = "_h2_1us7p_19", De = "_h3_1us7p_24", Te = "_h4_1us7p_29", Me = "_h5_1us7p_34", Oe = "_h6_1us7p_39", S = {
|
|
326
326
|
heading: Ie,
|
|
327
327
|
h1: Se,
|
|
328
328
|
h2: Ce,
|
|
@@ -330,7 +330,7 @@ const ce = _.hr`
|
|
|
330
330
|
h4: Te,
|
|
331
331
|
h5: Me,
|
|
332
332
|
h6: Oe
|
|
333
|
-
}, ke =
|
|
333
|
+
}, ke = p(({
|
|
334
334
|
variant: e = "h3",
|
|
335
335
|
className: t,
|
|
336
336
|
color: n,
|
|
@@ -395,7 +395,7 @@ const ce = _.hr`
|
|
|
395
395
|
toggle: i
|
|
396
396
|
};
|
|
397
397
|
}, E = (e) => {
|
|
398
|
-
const [t, n] =
|
|
398
|
+
const [t, n] = f(e), r = h(() => {
|
|
399
399
|
n(!0);
|
|
400
400
|
}, [n]), o = h(() => {
|
|
401
401
|
n(!1);
|
|
@@ -404,7 +404,7 @@ const ce = _.hr`
|
|
|
404
404
|
}, [n]);
|
|
405
405
|
return [t, r, o, s];
|
|
406
406
|
}, it = (e, t) => {
|
|
407
|
-
const [n, r] =
|
|
407
|
+
const [n, r] = f(e);
|
|
408
408
|
return m(() => {
|
|
409
409
|
const o = setTimeout(() => {
|
|
410
410
|
r(e);
|
|
@@ -414,7 +414,7 @@ const ce = _.hr`
|
|
|
414
414
|
};
|
|
415
415
|
}, [e, t]), n;
|
|
416
416
|
}, dt = (e, t) => {
|
|
417
|
-
const [n, r] =
|
|
417
|
+
const [n, r] = f(e);
|
|
418
418
|
return m(() => {
|
|
419
419
|
e && r(!0);
|
|
420
420
|
const o = setTimeout(() => {
|
|
@@ -427,7 +427,7 @@ const ce = _.hr`
|
|
|
427
427
|
};
|
|
428
428
|
let ze = 0;
|
|
429
429
|
const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
|
|
430
|
-
const [t, n] =
|
|
430
|
+
const [t, n] = f(() => C(e));
|
|
431
431
|
return m(() => n(C(e)), [e]), t;
|
|
432
432
|
}, v = (e, t, n) => {
|
|
433
433
|
const r = w();
|
|
@@ -464,7 +464,7 @@ 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
|
-
},
|
|
467
|
+
}, pt = (e, t) => {
|
|
468
468
|
const n = w(() => {
|
|
469
469
|
});
|
|
470
470
|
m(() => {
|
|
@@ -477,7 +477,7 @@ 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
|
-
},
|
|
480
|
+
}, ft = (e, t, n) => {
|
|
481
481
|
const r = w(() => {
|
|
482
482
|
});
|
|
483
483
|
m(() => {
|
|
@@ -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] =
|
|
507
|
+
const [n, r] = f(!1), { rootMargin: o, root: s, threshold: c } = t || {}, i = z(() => new IntersectionObserver(
|
|
508
508
|
([u]) => r(u.isIntersecting),
|
|
509
509
|
{
|
|
510
510
|
rootMargin: o,
|
|
@@ -521,7 +521,7 @@ const C = (e) => `webui-${e ? e + "-" : ""}${++ze}`, at = (e) => {
|
|
|
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] =
|
|
524
|
+
const [r, o] = f(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
|
},
|
|
@@ -577,14 +577,14 @@ export {
|
|
|
577
577
|
it as useDebounce,
|
|
578
578
|
dt as useDelayedFalse,
|
|
579
579
|
at as useDomId,
|
|
580
|
-
|
|
580
|
+
pe 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
|
-
|
|
587
|
-
|
|
586
|
+
pt as useMultiOnClickOutside,
|
|
587
|
+
ft as useOnClickOutside,
|
|
588
588
|
wt as useOnNoMouseMovement,
|
|
589
589
|
vt as useOnScreen,
|
|
590
590
|
bt as useTimeoutState
|
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)}.
|
|
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"),
|
|
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_1us7p_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-bold);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_1us7p_1._h1_1us7p_14{--swui-heading-font-size: 2.8rem;--swui-heading-line-height: 4rem}._heading_1us7p_1._h2_1us7p_19{--swui-heading-font-size: 2.4rem;--swui-heading-line-height: 3.2rem}._heading_1us7p_1._h3_1us7p_24{--swui-heading-font-size: 2rem;--swui-heading-line-height: 2.4rem}._heading_1us7p_1._h4_1us7p_29{--swui-heading-font-size: 1.8rem;--swui-heading-line-height: 2.4rem}._heading_1us7p_1._h5_1us7p_34{--swui-heading-font-size: 1.6rem;--swui-heading-line-height: 1.6rem}._heading_1us7p_1._h6_1us7p_39{--swui-heading-font-size: 1.4rem;--swui-heading-line-height: 1.6rem}")),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 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;
|
|
@@ -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:
|
|
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:w,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:w,type:T,...k,children:i})}),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=a.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;
|
|
@@ -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(b,{ref:n,...t})}),
|
|
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: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(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},
|
|
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},p=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=p,be=e=>l.jsx(p,{size:"small",...e}),pe=e=>l.jsx(p,{size:"smaller",...e}),we=e=>l.jsx(p,{size:"medium",...e}),ge=e=>l.jsx(p,{size:"large",...e}),xe="_heading_1us7p_1",ve="_h1_1us7p_14",_e="_h2_1us7p_19",$e="_h3_1us7p_24",Ee="_h4_1us7p_29",ye="_h5_1us7p_34",Se="_h6_1us7p_39",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,...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(w=>n(w,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,w)=>w!==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=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=pe;exports.Space=se;exports.Spacing=te;exports.StandardText=we;exports.Text=p;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": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.4",
|
|
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": "
|
|
60
|
+
"gitHead": "190ff1f04e93a4163dc613baba2899694f110e03",
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@emotion/is-prop-valid": "^1.1.0",
|
|
63
|
-
"@stenajs-webui/theme": "19.0.0-next.
|
|
63
|
+
"@stenajs-webui/theme": "19.0.0-next.4",
|
|
64
64
|
"classnames": "^2.3.1"
|
|
65
65
|
}
|
|
66
66
|
}
|