@mattilsynet/design 0.2.18 → 0.2.20
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/mtds/index.iife.js +1 -1
- package/mtds/index.iife.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +31 -31
- package/mtds/styles.module.css.js +35 -35
- package/mtds/tooltip.js +12 -12
- package/mtds/tooltip.js.map +1 -1
- package/mtds/utils.js +1 -1
- package/mtds/utils.js.map +1 -1
- package/package.json +1 -1
package/mtds/styles.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
"validation": "
|
|
3
|
-
"tag": "
|
|
4
|
-
"tabs": "
|
|
5
|
-
"table": "
|
|
6
|
-
"scrollShadow": "
|
|
7
|
-
"skeleton": "
|
|
8
|
-
"popover": "
|
|
9
|
-
"pagination": "
|
|
10
|
-
"modal": "
|
|
11
|
-
"logo": "
|
|
12
|
-
"link": "
|
|
13
|
-
"grid": "
|
|
14
|
-
"flex": "
|
|
15
|
-
"input": "
|
|
16
|
-
"fieldset": "
|
|
17
|
-
"field": "
|
|
18
|
-
"affixes": "
|
|
19
|
-
"count": "
|
|
20
|
-
"errorsummary": "
|
|
21
|
-
"details": "
|
|
22
|
-
"chip": "
|
|
23
|
-
"card": "
|
|
24
|
-
"info": "
|
|
25
|
-
"button": "
|
|
26
|
-
"breadcrumbs": "
|
|
27
|
-
"badge": "
|
|
28
|
-
"avatar": "
|
|
29
|
-
"alert": "
|
|
30
|
-
"heading": "
|
|
31
|
-
"body": "
|
|
32
|
-
"tooltip": "
|
|
2
|
+
"validation": "_validation_1rgmg_1 _ds-validation-message_1w6ss_1",
|
|
3
|
+
"tag": "_tag_1rgmg_1 _ds-tag_1w6ss_1",
|
|
4
|
+
"tabs": "_tabs_1rgmg_1 _ds-tabs_1w6ss_1",
|
|
5
|
+
"table": "_table_1rgmg_1 _ds-table_1w6ss_1",
|
|
6
|
+
"scrollShadow": "_scrollShadow_1rgmg_1",
|
|
7
|
+
"skeleton": "_skeleton_1rgmg_1 _ds-skeleton_1w6ss_1",
|
|
8
|
+
"popover": "_popover_1rgmg_1",
|
|
9
|
+
"pagination": "_pagination_1rgmg_1 _ds-pagination_1w6ss_1",
|
|
10
|
+
"modal": "_modal_1rgmg_1 _ds-modal_1w6ss_1",
|
|
11
|
+
"logo": "_logo_1rgmg_1 _ds-focus_1w6ss_1",
|
|
12
|
+
"link": "_link_1rgmg_1",
|
|
13
|
+
"grid": "_grid_1rgmg_1",
|
|
14
|
+
"flex": "_flex_1rgmg_1",
|
|
15
|
+
"input": "_input_1rgmg_1 _ds-input_1w6ss_1",
|
|
16
|
+
"fieldset": "_fieldset_1rgmg_1 _ds-fieldset_1w6ss_1",
|
|
17
|
+
"field": "_field_1rgmg_1 _ds-field_1w6ss_1",
|
|
18
|
+
"affixes": "_affixes_1rgmg_1 _ds-field-affixes_1w6ss_1",
|
|
19
|
+
"count": "_count_1rgmg_1",
|
|
20
|
+
"errorsummary": "_errorsummary_1rgmg_1 _ds-error-summary_1w6ss_1",
|
|
21
|
+
"details": "_details_1rgmg_1 _ds-details_1w6ss_1",
|
|
22
|
+
"chip": "_chip_1rgmg_1 _ds-chip_1w6ss_1",
|
|
23
|
+
"card": "_card_1rgmg_1",
|
|
24
|
+
"info": "_info_1rgmg_1",
|
|
25
|
+
"button": "_button_1rgmg_1 _ds-button_1w6ss_1",
|
|
26
|
+
"breadcrumbs": "_breadcrumbs_1rgmg_1 _ds-breadcrumbs_1w6ss_1",
|
|
27
|
+
"badge": "_badge_1rgmg_1",
|
|
28
|
+
"avatar": "_avatar_1rgmg_1 _ds-avatar_1w6ss_1",
|
|
29
|
+
"alert": "_alert_1rgmg_1 _ds-alert_1w6ss_1",
|
|
30
|
+
"heading": "_heading_1rgmg_1 _ds-heading_1w6ss_1",
|
|
31
|
+
"body": "_body_1rgmg_116",
|
|
32
|
+
"tooltip": "_tooltip_1rgmg_131"
|
|
33
33
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const _ = "
|
|
1
|
+
const _ = "_validation_1rgmg_1 _ds-validation-message_1w6ss_1", s = "_tag_1rgmg_1 _ds-tag_1w6ss_1", t = "_tabs_1rgmg_1 _ds-tabs_1w6ss_1", o = "_table_1rgmg_1 _ds-table_1w6ss_1", g = "_scrollShadow_1rgmg_1", a = "_skeleton_1rgmg_1 _ds-skeleton_1w6ss_1", r = "_popover_1rgmg_1", n = "_pagination_1rgmg_1 _ds-pagination_1w6ss_1", d = "_modal_1rgmg_1 _ds-modal_1w6ss_1", e = "_logo_1rgmg_1 _ds-focus_1w6ss_1", i = "_link_1rgmg_1", l = "_grid_1rgmg_1", c = "_flex_1rgmg_1", m = "_input_1rgmg_1 _ds-input_1w6ss_1", b = "_fieldset_1rgmg_1 _ds-fieldset_1w6ss_1", f = "_field_1rgmg_1 _ds-field_1w6ss_1", w = "_affixes_1rgmg_1 _ds-field-affixes_1w6ss_1", p = "_count_1rgmg_1", u = "_errorsummary_1rgmg_1 _ds-error-summary_1w6ss_1", h = "_details_1rgmg_1 _ds-details_1w6ss_1", v = "_chip_1rgmg_1 _ds-chip_1w6ss_1", x = "_card_1rgmg_1", y = "_info_1rgmg_1", k = "_button_1rgmg_1 _ds-button_1w6ss_1", S = "_breadcrumbs_1rgmg_1 _ds-breadcrumbs_1w6ss_1", j = "_badge_1rgmg_1", q = "_avatar_1rgmg_1 _ds-avatar_1w6ss_1", z = "_alert_1rgmg_1 _ds-alert_1w6ss_1", A = "_heading_1rgmg_1 _ds-heading_1w6ss_1", B = "_body_1rgmg_116", C = "_tooltip_1rgmg_131", D = {
|
|
2
2
|
validation: _,
|
|
3
3
|
tag: s,
|
|
4
|
-
tabs:
|
|
5
|
-
table:
|
|
6
|
-
scrollShadow:
|
|
7
|
-
skeleton:
|
|
8
|
-
popover:
|
|
9
|
-
pagination:
|
|
10
|
-
modal:
|
|
11
|
-
logo:
|
|
12
|
-
link:
|
|
13
|
-
grid:
|
|
14
|
-
flex:
|
|
15
|
-
input:
|
|
16
|
-
fieldset:
|
|
17
|
-
field:
|
|
18
|
-
affixes:
|
|
4
|
+
tabs: t,
|
|
5
|
+
table: o,
|
|
6
|
+
scrollShadow: g,
|
|
7
|
+
skeleton: a,
|
|
8
|
+
popover: r,
|
|
9
|
+
pagination: n,
|
|
10
|
+
modal: d,
|
|
11
|
+
logo: e,
|
|
12
|
+
link: i,
|
|
13
|
+
grid: l,
|
|
14
|
+
flex: c,
|
|
15
|
+
input: m,
|
|
16
|
+
fieldset: b,
|
|
17
|
+
field: f,
|
|
18
|
+
affixes: w,
|
|
19
19
|
count: p,
|
|
20
20
|
errorsummary: u,
|
|
21
|
-
details:
|
|
22
|
-
chip:
|
|
21
|
+
details: h,
|
|
22
|
+
chip: v,
|
|
23
23
|
card: x,
|
|
24
24
|
info: y,
|
|
25
25
|
button: k,
|
|
@@ -32,7 +32,7 @@ const _ = "_validation_14niv_1 _ds-validation-message_1w6ss_1", s = "_tag_14niv_
|
|
|
32
32
|
tooltip: C
|
|
33
33
|
};
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
w as affixes,
|
|
36
36
|
z as alert,
|
|
37
37
|
q as avatar,
|
|
38
38
|
j as badge,
|
|
@@ -40,27 +40,27 @@ export {
|
|
|
40
40
|
S as breadcrumbs,
|
|
41
41
|
k as button,
|
|
42
42
|
x as card,
|
|
43
|
-
|
|
43
|
+
v as chip,
|
|
44
44
|
p as count,
|
|
45
45
|
D as default,
|
|
46
|
-
|
|
46
|
+
h as details,
|
|
47
47
|
u as errorsummary,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
f as field,
|
|
49
|
+
b as fieldset,
|
|
50
|
+
c as flex,
|
|
51
|
+
l as grid,
|
|
52
52
|
A as heading,
|
|
53
53
|
y as info,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
m as input,
|
|
55
|
+
i as link,
|
|
56
|
+
e as logo,
|
|
57
|
+
d as modal,
|
|
58
|
+
n as pagination,
|
|
59
|
+
r as popover,
|
|
60
|
+
g as scrollShadow,
|
|
61
|
+
a as skeleton,
|
|
62
|
+
o as table,
|
|
63
|
+
t as tabs,
|
|
64
64
|
s as tag,
|
|
65
65
|
C as tooltip,
|
|
66
66
|
_ as validation
|
package/mtds/tooltip.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IS_BROWSER as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
const t =
|
|
8
|
-
clearTimeout(a), a = setTimeout(
|
|
1
|
+
import r from "./styles.module.css.js";
|
|
2
|
+
import { IS_BROWSER as b, attr as c, on as u, QUICK_EVENT as d, useId as f, anchorPosition as s } from "./utils.js";
|
|
3
|
+
const E = "--mtds-tooltip-position", I = 100;
|
|
4
|
+
let l = null, m = Number.NEGATIVE_INFINITY, a = 0, e = null;
|
|
5
|
+
b && (e = document.body.appendChild(document.createElement("div")), e.classList.add(...r.tooltip.split(" ")), c(e, "popover", "manual"), u(document, "blur,focus,mouseout,mouseover", p, d), u(window, "blur", p, d));
|
|
6
|
+
function p({ target: o }) {
|
|
7
|
+
const t = m + I - Date.now();
|
|
8
|
+
clearTimeout(a), a = setTimeout(L, Math.max(t, 0), o);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function L(o) {
|
|
11
11
|
var n;
|
|
12
|
-
if (
|
|
12
|
+
if (m = Date.now(), !e || o === e) return;
|
|
13
13
|
let t = ((n = o == null ? void 0 : o.closest) == null ? void 0 : n.call(o, "[data-tooltip],[data-expanded]")) || null;
|
|
14
14
|
if (t === l) return;
|
|
15
|
-
const i = (t == null ? void 0 : t.getAttribute("data-tooltip")) || (t == null ? void 0 : t.getAttribute("data-expanded")) || "";
|
|
16
|
-
(!i || i === "false" || i === "true") && (t = null), l == null || l.removeAttribute("aria-labelledby"), l = t, l == null || l.setAttribute("aria-labelledby",
|
|
15
|
+
const i = (t == null ? void 0 : t.getAttribute("data-tooltip")) || (t == null ? void 0 : t.getAttribute("data-expanded")) || "", T = (t == null ? void 0 : t.getAttribute("data-tooltip-position")) || window.getComputedStyle(t || document.body).getPropertyValue(E) || "top";
|
|
16
|
+
(!i || i === "false" || i === "true") && (t = null), t && (e.textContent = i), l == null || l.removeAttribute("aria-labelledby"), l = t, l == null || l.setAttribute("aria-labelledby", f(e)), e.togglePopover(!!t), s(e, !1), s(e, t, T);
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=tooltip.js.map
|
package/mtds/tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../designsystem/tooltip.ts"],"sourcesContent":["import styles from './styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, anchorPosition, attr, on, useId } from \"./utils\";\n\
|
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../designsystem/tooltip.ts"],"sourcesContent":["import styles from './styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, anchorPosition, attr, on, useId } from \"./utils\";\n\nconst POSITION_CSS_PROPERTY = '--mtds-tooltip-position';\nconst THROTTLE_DELAY = 100;\nlet ANCHOR: Element | null = null;\nlet LAST_CALL = Number.NEGATIVE_INFINITY;\nlet THROTTLE: number | ReturnType<typeof setTimeout> = 0;\nlet TOOLTIP: HTMLElement | null = null;\n\nif (IS_BROWSER) {\n TOOLTIP = document.body.appendChild(document.createElement('div'));\n TOOLTIP.classList.add(...styles.tooltip.split(' '));\n attr(TOOLTIP, 'popover', 'manual');\n on(document, 'blur,focus,mouseout,mouseover', handleMove, QUICK_EVENT);\n on(window, 'blur', handleMove, QUICK_EVENT);\n}\n\nfunction handleMove({ target }: Event) {\n const wait = LAST_CALL + THROTTLE_DELAY - Date.now();\n clearTimeout(THROTTLE);\n THROTTLE = setTimeout(handleMoveThrottled, Math.max(wait, 0), target);\n}\n\n// Using a throttled function to avoid performance issues\nfunction handleMoveThrottled(target: Element | null) {\n LAST_CALL = Date.now();\n\n if (!TOOLTIP || target === TOOLTIP) return; // Allow tooltip to be hovered, following https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus\n let anchor = target?.closest?.<HTMLElement>('[data-tooltip],[data-expanded]') || null;\n \n // No need to update\n if (anchor === ANCHOR) return;\n\n // Do not show tooltip if boolish value\n const content = anchor?.getAttribute('data-tooltip') || anchor?.getAttribute('data-expanded') || '';\n const position = anchor?.getAttribute('data-tooltip-position') || window.getComputedStyle(anchor || document.body).getPropertyValue(POSITION_CSS_PROPERTY) || 'top';\n if (!content || content === 'false' || content === 'true') anchor = null;\n if (anchor) TOOLTIP.textContent = content; // Only update content if new anchor\n \n ANCHOR?.removeAttribute('aria-labelledby'); // Unbind previous anchor\n ANCHOR = anchor; // Store new anchor - might be null if no new anchor\n\n ANCHOR?.setAttribute('aria-labelledby', useId(TOOLTIP));\n TOOLTIP.togglePopover(!!anchor);\n anchorPosition(TOOLTIP, false); // Reset anchor position\n anchorPosition(TOOLTIP, anchor, position);\n}"],"names":["POSITION_CSS_PROPERTY","THROTTLE_DELAY","ANCHOR","LAST_CALL","THROTTLE","TOOLTIP","IS_BROWSER","styles","attr","on","handleMove","QUICK_EVENT","target","wait","handleMoveThrottled","anchor","_a","content","position","useId","anchorPosition"],"mappings":";;AAGA,MAAMA,IAAwB,2BACxBC,IAAiB;AACvB,IAAIC,IAAyB,MACzBC,IAAY,OAAO,mBACnBC,IAAmD,GACnDC,IAA8B;AAE9BC,MACFD,IAAU,SAAS,KAAK,YAAY,SAAS,cAAc,KAAK,CAAC,GACjEA,EAAQ,UAAU,IAAI,GAAGE,EAAO,QAAQ,MAAM,GAAG,CAAC,GAC7CC,EAAAH,GAAS,WAAW,QAAQ,GAC9BI,EAAA,UAAU,iCAAiCC,GAAYC,CAAW,GAClEF,EAAA,QAAQ,QAAQC,GAAYC,CAAW;AAG5C,SAASD,EAAW,EAAE,QAAAE,KAAiB;AACrC,QAAMC,IAAOV,IAAYF,IAAiB,KAAK,IAAI;AACnD,eAAaG,CAAQ,GACrBA,IAAW,WAAWU,GAAqB,KAAK,IAAID,GAAM,CAAC,GAAGD,CAAM;AACtE;AAGA,SAASE,EAAoBF,GAAwB;;AAG/C,MAFJT,IAAY,KAAK,IAAI,GAEjB,CAACE,KAAWO,MAAWP,EAAS;AACpC,MAAIU,MAASC,IAAAJ,KAAA,gBAAAA,EAAQ,YAAR,gBAAAI,EAAA,KAAAJ,GAA+B,sCAAqC;AAGjF,MAAIG,MAAWb,EAAQ;AAGjB,QAAAe,KAAUF,KAAA,gBAAAA,EAAQ,aAAa,qBAAmBA,KAAA,gBAAAA,EAAQ,aAAa,qBAAoB,IAC3FG,KAAWH,KAAA,gBAAAA,EAAQ,aAAa,6BAA4B,OAAO,iBAAiBA,KAAU,SAAS,IAAI,EAAE,iBAAiBf,CAAqB,KAAK;AAC9J,GAAI,CAACiB,KAAWA,MAAY,WAAWA,MAAY,YAAiBF,IAAA,OAChEA,QAAgB,cAAcE,IAElCf,KAAA,QAAAA,EAAQ,gBAAgB,oBACfA,IAAAa,GAETb,KAAA,QAAAA,EAAQ,aAAa,mBAAmBiB,EAAMd,CAAO,IAC7CA,EAAA,cAAc,CAAC,CAACU,CAAM,GAC9BK,EAAef,GAAS,EAAK,GACde,EAAAf,GAASU,GAAQG,CAAQ;AAC1C;"}
|
package/mtds/utils.js
CHANGED
|
@@ -19,7 +19,7 @@ const c = { top: 0, right: 1, bottom: 2, left: 3, none: 4 };
|
|
|
19
19
|
function _(t, e, n) {
|
|
20
20
|
var p;
|
|
21
21
|
if (!e || !e.isConnected || !t.isConnected) return l.delete(t);
|
|
22
|
-
if (s != null && s.isConnected || document.body.append(s || ""), !l.has(t)
|
|
22
|
+
if (s != null && s.isConnected || document.body.append(s || ""), !l.has(t)) {
|
|
23
23
|
const C = c[n] ?? c.bottom;
|
|
24
24
|
return (p = l.set(t, () => _(t, e, C)).get(t)) == null ? void 0 : p();
|
|
25
25
|
}
|
package/mtds/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../designsystem/utils.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to use as EventTarget\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport function attr(\n\tel: Element,\n\tname: string,\n\tvalue?: string | null,\n): string | null {\n\tif (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n\tif (value === null) el.removeAttribute(name);\n\telse if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n\treturn null;\n}\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\telement[`${action}EventListener`](...rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n\nconst TARGETS = new Map<Element, () => void>(); // Store current open poppers and their update functions\nconst SCROLLER = IS_BROWSER ? document.createElement('div') : null // Used to ensure we have scrollability under\nif (SCROLLER) attr(SCROLLER, 'style', 'position:absolute;padding:1px;top:0;left:0px');\n\nif (IS_BROWSER){\n\ton(window, 'load,resize,scroll', () => {\n\t\tfor (const [_, update] of TARGETS) update();\n\t}, QUICK_EVENT);}\n\t\n/**\n * anchorPosition\n * @param target The Element to position\n * @param anchor The Element to use as anchor\n */\ntype AnchorKeys = keyof typeof ANCHOR;\nconst ANCHOR = { top: 0, right: 1, bottom: 2, left: 3, none: 4 }; // Speed up by using a const map\n\nexport function anchorPosition (target: HTMLElement, anchor: HTMLElement | null | false, position?: string | number) {\n\tif (!anchor || !anchor.isConnected || !target.isConnected) return TARGETS.delete(target); // Stop watchning if anchor is removed from DOM\n\tif (!SCROLLER?.isConnected) document.body.append(SCROLLER || ''); // Ensure we have t´he scroller\n\tif (!TARGETS.has(target) || ANCHOR[position as AnchorKeys] === undefined) { // Setup new target or update position\n\t\tconst place = ANCHOR[position as keyof typeof ANCHOR] ?? ANCHOR.bottom; // Use CSS property to store position for more flexibility\n\t\treturn TARGETS.set(target, () => anchorPosition(target, anchor, place)).get(target)?.(); // Start watching if not already watching\n\t}\n\tif (position === ANCHOR.none) return target.style.setProperty('left', '-100vw'); // Hide target if anchor is set to none\n\n const { offsetWidth: targetW, offsetHeight: targetH } = target;\n const { offsetWidth: anchorW, offsetHeight: anchorH } = anchor;\n const { width, height, left, top } = anchor.getBoundingClientRect();\n\tconst anchorX = Math.round(left - (anchorW - width) / 2); // Correct for CSS transform scale\n const anchorY = Math.round(top - (anchorH - height) / 2); // Correct for CSS transform scale\n\n\tconst hasSpaceLeft = anchorX - targetW > 0\n\tconst hasSpaceRight = anchorW + anchorW + targetW < window.innerWidth;\n\tconst hasSpaceOver = anchorY - targetH > 0\n\tconst hasSpaceUnder = anchorY + anchorH + targetH < window.innerHeight;\n\tconst positionRight = (position === ANCHOR.bottom && hasSpaceRight) || !hasSpaceLeft // Always position right when no hasSpaceLeft, as no OS scrolls further up than 0\n\tconst positionUnder = (position === ANCHOR.bottom && hasSpaceUnder) || !hasSpaceOver // Always position under when no hasSpaceOver, as no OS scrolls further up than 0\n\tconst centerX = Math.min(Math.max(10, anchorX - (targetW - anchorW) / 2), window.innerWidth - targetW - 10);\n\tconst centerY = Math.min(Math.max(10, anchorY - (targetH - anchorH) / 2), window.innerHeight - targetH - 10);\n\tconst isVertical = position === ANCHOR.top || position === ANCHOR.bottom;\n\n\ttarget.style.left = `${Math.round(isVertical ? centerX : (positionRight ? anchorX + anchorW : anchorX - targetW))}px`\n target.style.top = `${Math.round(isVertical ? (positionUnder ? anchorY + anchorH : anchorY - targetH) : centerY)}px`\n SCROLLER?.style.setProperty('translate', `${Math.round(window.scrollX + anchorX + anchorW + targetW + 30)} ${Math.round(window.scrollY + anchorY + anchorH + targetH + 30)}px`);\n}\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n let queue = 0;\n\n\tconst onFrame = () => setTimeout(onTimer, 200); // Use both requestAnimationFrame and setTimeout to debounce and only run when visible\n\tconst onTimer = () => {\n\t\tcallback([], observer);\n\t\tqueue = 0;\n\t};\n const observer = new MutationObserver(() => {\n if (!queue) queue = requestAnimationFrame(onFrame);\n });\n\n return observer;\n}\n\ntype Mutator = { observer: MutationObserver, collections: Map<string, () => void> };\nconst MUTATORS = new WeakMap<Element, Mutator>();\nconst MUTATORS_CALLBACK = (element: Element) => {\n\tconst mutator = MUTATORS.get(element);\n\n\tif (!mutator || !element.isConnected) {\n\t\tmutator?.observer?.disconnect();\n\t\tMUTATORS.delete(element);\n\t} else for(const [, callback] of mutator.collections) callback();\n};\n\n/**\n * onMutation\n * @description Utility to quickly observe mutations on a specific class name\n * @param element The Element to use as EventTarget\n * @param className The class name to observe\n * @param callback The callback to run when mutations are detected or false to stop observing\n */\nexport const onMutation = (\n\telement: Element,\n\tclassName: string,\n\tcallback: ((collection: HTMLCollection) => void) | false\n) => {\n\tconst collection = element.getElementsByClassName(className);\n\tlet mutator = MUTATORS.get(element);\n\n\tif (!mutator) {\n\t\tmutator = { collections: new Map(), observer: createOptimizedMutationObserver(() => MUTATORS_CALLBACK(element)) };\n\t\tmutator.observer.observe(element, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });\n\t\tMUTATORS.set(element, mutator);\n\t}\n\tif (callback) mutator.collections.set(className, () => callback(collection));\n\telse mutator.collections.delete(className);\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ntype Popover = \"\" | \"auto\" | \"manual\" | undefined;\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n}"],"names":["IS_BROWSER","QUICK_EVENT","attr","el","name","value","id","UUID","useId","events","action","element","rest","type","on","off","TARGETS","SCROLLER","_","update","ANCHOR","anchorPosition","target","anchor","position","_a","place","targetW","targetH","anchorW","anchorH","width","height","left","top","anchorX","anchorY","hasSpaceLeft","hasSpaceRight","hasSpaceOver","hasSpaceUnder","positionRight","positionUnder","centerX","centerY","isVertical","createOptimizedMutationObserver","callback","queue","onFrame","onTimer","observer","MUTATORS","MUTATORS_CALLBACK","mutator","onMutation","className","collection","isInputLike"],"mappings":"AAAO,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,WAAa,KAClEC,IAAc,EAAE,SAAS,IAAM,SAAS,GAAK;AAS1C,SAAAC,EACfC,GACAC,GAC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YAAY,IAAM,iBAAiB,CAAC,OAAO,GAAG,GACzGyC,EAAA,IAAIzC,GAAS2C,CAAO,IAE1BP,MAAkB,YAAY,IAAIS,GAAW,MAAMT,EAASU,CAAU,CAAC,IACtEH,EAAQ,YAAY,OAAOE,CAAS;AAC1C,GAEaE,IAAc,CAACvD,MAC3BA,aAAc,eAAe,cAAcA,KAAM,EAAEA,aAAc;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../designsystem/utils.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to use as EventTarget\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport function attr(\n\tel: Element,\n\tname: string,\n\tvalue?: string | null,\n): string | null {\n\tif (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n\tif (value === null) el.removeAttribute(name);\n\telse if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n\treturn null;\n}\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\telement[`${action}EventListener`](...rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n\nconst TARGETS = new Map<Element, () => void>(); // Store current open poppers and their update functions\nconst SCROLLER = IS_BROWSER ? document.createElement('div') : null // Used to ensure we have scrollability under\nif (SCROLLER) attr(SCROLLER, 'style', 'position:absolute;padding:1px;top:0;left:0px');\n\nif (IS_BROWSER){\n\ton(window, 'load,resize,scroll', () => {\n\t\tfor (const [_, update] of TARGETS) update();\n\t}, QUICK_EVENT);}\n\t\n/**\n * anchorPosition\n * @param target The Element to position\n * @param anchor The Element to use as anchor\n */\nconst ANCHOR = { top: 0, right: 1, bottom: 2, left: 3, none: 4 }; // Speed up by using a const map\n\nexport function anchorPosition (target: HTMLElement, anchor: HTMLElement | null | false, position?: string | number) {\n\tif (!anchor || !anchor.isConnected || !target.isConnected) return TARGETS.delete(target); // Stop watchning if anchor is removed from DOM\n\tif (!SCROLLER?.isConnected) document.body.append(SCROLLER || ''); // Ensure we have t´he scroller\n\tif (!TARGETS.has(target)) { // Setup new target or update position\n\t\tconst place = ANCHOR[position as keyof typeof ANCHOR] ?? ANCHOR.bottom; // Use CSS property to store position for more flexibility\n\t\treturn TARGETS.set(target, () => anchorPosition(target, anchor, place)).get(target)?.(); // Start watching if not already watching\n\t}\n\tif (position === ANCHOR.none) return target.style.setProperty('left', '-100vw'); // Hide target if anchor is set to none\n\n const { offsetWidth: targetW, offsetHeight: targetH } = target;\n const { offsetWidth: anchorW, offsetHeight: anchorH } = anchor;\n const { width, height, left, top } = anchor.getBoundingClientRect();\n\tconst anchorX = Math.round(left - (anchorW - width) / 2); // Correct for CSS transform scale\n const anchorY = Math.round(top - (anchorH - height) / 2); // Correct for CSS transform scale\n\n\tconst hasSpaceLeft = anchorX - targetW > 0\n\tconst hasSpaceRight = anchorW + anchorW + targetW < window.innerWidth;\n\tconst hasSpaceOver = anchorY - targetH > 0\n\tconst hasSpaceUnder = anchorY + anchorH + targetH < window.innerHeight;\n\tconst positionRight = (position === ANCHOR.bottom && hasSpaceRight) || !hasSpaceLeft // Always position right when no hasSpaceLeft, as no OS scrolls further up than 0\n\tconst positionUnder = (position === ANCHOR.bottom && hasSpaceUnder) || !hasSpaceOver // Always position under when no hasSpaceOver, as no OS scrolls further up than 0\n\tconst centerX = Math.min(Math.max(10, anchorX - (targetW - anchorW) / 2), window.innerWidth - targetW - 10);\n\tconst centerY = Math.min(Math.max(10, anchorY - (targetH - anchorH) / 2), window.innerHeight - targetH - 10);\n\tconst isVertical = position === ANCHOR.top || position === ANCHOR.bottom;\n\n\ttarget.style.left = `${Math.round(isVertical ? centerX : (positionRight ? anchorX + anchorW : anchorX - targetW))}px`\n target.style.top = `${Math.round(isVertical ? (positionUnder ? anchorY + anchorH : anchorY - targetH) : centerY)}px`\n SCROLLER?.style.setProperty('translate', `${Math.round(window.scrollX + anchorX + anchorW + targetW + 30)} ${Math.round(window.scrollY + anchorY + anchorH + targetH + 30)}px`);\n}\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n let queue = 0;\n\n\tconst onFrame = () => setTimeout(onTimer, 200); // Use both requestAnimationFrame and setTimeout to debounce and only run when visible\n\tconst onTimer = () => {\n\t\tcallback([], observer);\n\t\tqueue = 0;\n\t};\n const observer = new MutationObserver(() => {\n if (!queue) queue = requestAnimationFrame(onFrame);\n });\n\n return observer;\n}\n\ntype Mutator = { observer: MutationObserver, collections: Map<string, () => void> };\nconst MUTATORS = new WeakMap<Element, Mutator>();\nconst MUTATORS_CALLBACK = (element: Element) => {\n\tconst mutator = MUTATORS.get(element);\n\n\tif (!mutator || !element.isConnected) {\n\t\tmutator?.observer?.disconnect();\n\t\tMUTATORS.delete(element);\n\t} else for(const [, callback] of mutator.collections) callback();\n};\n\n/**\n * onMutation\n * @description Utility to quickly observe mutations on a specific class name\n * @param element The Element to use as EventTarget\n * @param className The class name to observe\n * @param callback The callback to run when mutations are detected or false to stop observing\n */\nexport const onMutation = (\n\telement: Element,\n\tclassName: string,\n\tcallback: ((collection: HTMLCollection) => void) | false\n) => {\n\tconst collection = element.getElementsByClassName(className);\n\tlet mutator = MUTATORS.get(element);\n\n\tif (!mutator) {\n\t\tmutator = { collections: new Map(), observer: createOptimizedMutationObserver(() => MUTATORS_CALLBACK(element)) };\n\t\tmutator.observer.observe(element, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] });\n\t\tMUTATORS.set(element, mutator);\n\t}\n\tif (callback) mutator.collections.set(className, () => callback(collection));\n\telse mutator.collections.delete(className);\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ntype Popover = \"\" | \"auto\" | \"manual\" | undefined;\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: Popover;\n\t\t}\n\t}\n}"],"names":["IS_BROWSER","QUICK_EVENT","attr","el","name","value","id","UUID","useId","events","action","element","rest","type","on","off","TARGETS","SCROLLER","_","update","ANCHOR","anchorPosition","target","anchor","position","_a","place","targetW","targetH","anchorW","anchorH","width","height","left","top","anchorX","anchorY","hasSpaceLeft","hasSpaceRight","hasSpaceOver","hasSpaceUnder","positionRight","positionUnder","centerX","centerY","isVertical","createOptimizedMutationObserver","callback","queue","onFrame","onTimer","observer","MUTATORS","MUTATORS_CALLBACK","mutator","onMutation","className","collection","isInputLike"],"mappings":"AAAO,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,WAAa,KAClEC,IAA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