@phillips/seldon 1.246.0 → 1.247.0
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/_virtual/index12.js +2 -2
- package/dist/_virtual/index13.js +2 -2
- package/dist/assets/formatted/Search.js +8 -9
- package/dist/components/Input/utils.js +5 -3
- package/dist/components/Navigation/Navigation.js +51 -27
- package/dist/components/Navigation/Navigation.stories.d.ts +1 -2
- package/dist/components/Navigation/NavigationItem/NavigationItem.d.ts +8 -0
- package/dist/components/Navigation/NavigationItem/NavigationItem.js +43 -42
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.d.ts +17 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationDesktopSubmenu.js +70 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.d.ts +31 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/NavigationItemWithSubmenu.js +68 -0
- package/dist/components/Navigation/NavigationItemWithSubmenu/index.d.ts +2 -0
- package/dist/components/Navigation/NavigationList/NavigationList.d.ts +11 -8
- package/dist/components/Navigation/NavigationList/NavigationList.js +21 -46
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.d.ts +33 -0
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.js +41 -0
- package/dist/components/Navigation/NavigationSubmenu/NavigationSubmenu.test.d.ts +1 -0
- package/dist/components/Search/Search.js +51 -47
- package/dist/components/Search/SearchButton.js +10 -10
- package/dist/components/Search/SearchResults/SearchResults.d.ts +2 -1
- package/dist/components/Search/SearchResults/SearchResults.js +22 -21
- package/dist/index.d.ts +3 -1
- package/dist/index.js +201 -197
- package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.js +597 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-collection/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
- package/dist/node_modules/@radix-ui/react-navigation-menu/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
- package/dist/node_modules/ics/dist/schema/index.js +1 -1
- package/dist/node_modules/ics/dist/utils/index.js +1 -1
- package/dist/patterns/UserManagement/UserManagement.js +45 -27
- package/dist/scss/componentStyles.scss +1 -1
- package/dist/scss/components/Accordion/_accordion.scss +6 -0
- package/dist/scss/components/Navigation/NavigationItem/_navigationItem.scss +0 -12
- package/dist/scss/components/Navigation/NavigationItemWithSubmenu/_navigationItemWithSubmenu.scss +114 -0
- package/dist/scss/components/Navigation/NavigationList/_navigationList.scss +15 -3
- package/dist/scss/components/Navigation/_navigation.scss +109 -0
- package/dist/scss/components/Search/_search.scss +1 -0
- package/dist/scss/site-furniture/Header/_header.scss +24 -0
- package/dist/site-furniture/Header/Header.d.ts +8 -4
- package/dist/site-furniture/Header/Header.js +55 -50
- package/dist/site-furniture/Header/Header.stories.d.ts +278 -0
- package/dist/site-furniture/Header/utils.js +1 -2
- package/package.json +5 -1
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.d.ts +0 -22
- package/dist/components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js +0 -80
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +0 -111
- /package/dist/components/Navigation/{NavigationItemTrigger/NavigationItemTrigger.test.d.ts → NavigationItemWithSubmenu/NavigationItemWithSubmenu.test.d.ts} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { composeEventHandlers as h } from "../../primitive/dist/index.js";
|
|
3
|
+
import { Primitive as w, dispatchDiscreteCustomEvent as k } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useComposedRefs as g } from "../../../../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { useCallbackRef as R } from "../../../../../react-use-callback-ref/dist/index.js";
|
|
6
|
+
import { useEscapeKeydown as U } from "../../../../../react-use-escape-keydown/dist/index.js";
|
|
7
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
8
|
+
var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", C, B = n.createContext({
|
|
9
|
+
layers: /* @__PURE__ */ new Set(),
|
|
10
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
11
|
+
branches: /* @__PURE__ */ new Set()
|
|
12
|
+
}), K = n.forwardRef(
|
|
13
|
+
(s, e) => {
|
|
14
|
+
const {
|
|
15
|
+
disableOutsidePointerEvents: r = !1,
|
|
16
|
+
onEscapeKeyDown: a,
|
|
17
|
+
onPointerDownOutside: i,
|
|
18
|
+
onFocusOutside: c,
|
|
19
|
+
onInteractOutside: f,
|
|
20
|
+
onDismiss: d,
|
|
21
|
+
...E
|
|
22
|
+
} = s, o = n.useContext(B), [u, F] = n.useState(null), l = u?.ownerDocument ?? globalThis?.document, [, I] = n.useState({}), S = g(e, (t) => F(t)), p = Array.from(o.layers), [W] = [...o.layersWithOutsidePointerEventsDisabled].slice(-1), A = p.indexOf(W), b = u ? p.indexOf(u) : -1, N = o.layersWithOutsidePointerEventsDisabled.size > 0, D = b >= A, _ = Y((t) => {
|
|
23
|
+
const v = t.target, P = [...o.branches].some((m) => m.contains(v));
|
|
24
|
+
!D || P || (i?.(t), f?.(t), t.defaultPrevented || d?.());
|
|
25
|
+
}, l), O = q((t) => {
|
|
26
|
+
const v = t.target;
|
|
27
|
+
[...o.branches].some((m) => m.contains(v)) || (c?.(t), f?.(t), t.defaultPrevented || d?.());
|
|
28
|
+
}, l);
|
|
29
|
+
return U((t) => {
|
|
30
|
+
b === o.layers.size - 1 && (a?.(t), !t.defaultPrevented && d && (t.preventDefault(), d()));
|
|
31
|
+
}, l), n.useEffect(() => {
|
|
32
|
+
if (u)
|
|
33
|
+
return r && (o.layersWithOutsidePointerEventsDisabled.size === 0 && (C = l.body.style.pointerEvents, l.body.style.pointerEvents = "none"), o.layersWithOutsidePointerEventsDisabled.add(u)), o.layers.add(u), L(), () => {
|
|
34
|
+
r && o.layersWithOutsidePointerEventsDisabled.size === 1 && (l.body.style.pointerEvents = C);
|
|
35
|
+
};
|
|
36
|
+
}, [u, l, r, o]), n.useEffect(() => () => {
|
|
37
|
+
u && (o.layers.delete(u), o.layersWithOutsidePointerEventsDisabled.delete(u), L());
|
|
38
|
+
}, [u, o]), n.useEffect(() => {
|
|
39
|
+
const t = () => I({});
|
|
40
|
+
return document.addEventListener(y, t), () => document.removeEventListener(y, t);
|
|
41
|
+
}, []), /* @__PURE__ */ T(
|
|
42
|
+
w.div,
|
|
43
|
+
{
|
|
44
|
+
...E,
|
|
45
|
+
ref: S,
|
|
46
|
+
style: {
|
|
47
|
+
pointerEvents: N ? D ? "auto" : "none" : void 0,
|
|
48
|
+
...s.style
|
|
49
|
+
},
|
|
50
|
+
onFocusCapture: h(s.onFocusCapture, O.onFocusCapture),
|
|
51
|
+
onBlurCapture: h(s.onBlurCapture, O.onBlurCapture),
|
|
52
|
+
onPointerDownCapture: h(
|
|
53
|
+
s.onPointerDownCapture,
|
|
54
|
+
_.onPointerDownCapture
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
K.displayName = z;
|
|
61
|
+
var j = "DismissableLayerBranch", X = n.forwardRef((s, e) => {
|
|
62
|
+
const r = n.useContext(B), a = n.useRef(null), i = g(e, a);
|
|
63
|
+
return n.useEffect(() => {
|
|
64
|
+
const c = a.current;
|
|
65
|
+
if (c)
|
|
66
|
+
return r.branches.add(c), () => {
|
|
67
|
+
r.branches.delete(c);
|
|
68
|
+
};
|
|
69
|
+
}, [r.branches]), /* @__PURE__ */ T(w.div, { ...s, ref: i });
|
|
70
|
+
});
|
|
71
|
+
X.displayName = j;
|
|
72
|
+
function Y(s, e = globalThis?.document) {
|
|
73
|
+
const r = R(s), a = n.useRef(!1), i = n.useRef(() => {
|
|
74
|
+
});
|
|
75
|
+
return n.useEffect(() => {
|
|
76
|
+
const c = (d) => {
|
|
77
|
+
if (d.target && !a.current) {
|
|
78
|
+
let E = function() {
|
|
79
|
+
x(
|
|
80
|
+
H,
|
|
81
|
+
r,
|
|
82
|
+
o,
|
|
83
|
+
{ discrete: !0 }
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const o = { originalEvent: d };
|
|
87
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = E, e.addEventListener("click", i.current, { once: !0 })) : E();
|
|
88
|
+
} else
|
|
89
|
+
e.removeEventListener("click", i.current);
|
|
90
|
+
a.current = !1;
|
|
91
|
+
}, f = window.setTimeout(() => {
|
|
92
|
+
e.addEventListener("pointerdown", c);
|
|
93
|
+
}, 0);
|
|
94
|
+
return () => {
|
|
95
|
+
window.clearTimeout(f), e.removeEventListener("pointerdown", c), e.removeEventListener("click", i.current);
|
|
96
|
+
};
|
|
97
|
+
}, [e, r]), {
|
|
98
|
+
// ensures we check React component tree (not just DOM tree)
|
|
99
|
+
onPointerDownCapture: () => a.current = !0
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function q(s, e = globalThis?.document) {
|
|
103
|
+
const r = R(s), a = n.useRef(!1);
|
|
104
|
+
return n.useEffect(() => {
|
|
105
|
+
const i = (c) => {
|
|
106
|
+
c.target && !a.current && x(M, r, { originalEvent: c }, {
|
|
107
|
+
discrete: !1
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
|
|
111
|
+
}, [e, r]), {
|
|
112
|
+
onFocusCapture: () => a.current = !0,
|
|
113
|
+
onBlurCapture: () => a.current = !1
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function L() {
|
|
117
|
+
const s = new CustomEvent(y);
|
|
118
|
+
document.dispatchEvent(s);
|
|
119
|
+
}
|
|
120
|
+
function x(s, e, r, { discrete: a }) {
|
|
121
|
+
const i = r.originalEvent.target, c = new CustomEvent(s, { bubbles: !1, cancelable: !0, detail: r });
|
|
122
|
+
e && i.addEventListener(s, e, { once: !0 }), a ? k(i, c) : i.dispatchEvent(c);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
K as DismissableLayer,
|
|
126
|
+
X as DismissableLayerBranch
|
|
127
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { useComposedRefs as O } from "../../../../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { useLayoutEffect as A } from "../../../../../react-use-layout-effect/dist/index.js";
|
|
4
|
+
function E(n, e) {
|
|
5
|
+
return i.useReducer((t, r) => e[t][r] ?? t, n);
|
|
6
|
+
}
|
|
7
|
+
var T = (n) => {
|
|
8
|
+
const { present: e, children: t } = n, r = R(e), a = typeof t == "function" ? t({ present: r.isPresent }) : i.Children.only(t), c = O(r.ref, v(a));
|
|
9
|
+
return typeof t == "function" || r.isPresent ? i.cloneElement(a, { ref: c }) : null;
|
|
10
|
+
};
|
|
11
|
+
T.displayName = "Presence";
|
|
12
|
+
function R(n) {
|
|
13
|
+
const [e, t] = i.useState(), r = i.useRef(null), a = i.useRef(n), c = i.useRef("none"), p = n ? "mounted" : "unmounted", [N, s] = E(p, {
|
|
14
|
+
mounted: {
|
|
15
|
+
UNMOUNT: "unmounted",
|
|
16
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
17
|
+
},
|
|
18
|
+
unmountSuspended: {
|
|
19
|
+
MOUNT: "mounted",
|
|
20
|
+
ANIMATION_END: "unmounted"
|
|
21
|
+
},
|
|
22
|
+
unmounted: {
|
|
23
|
+
MOUNT: "mounted"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return i.useEffect(() => {
|
|
27
|
+
const o = l(r.current);
|
|
28
|
+
c.current = N === "mounted" ? o : "none";
|
|
29
|
+
}, [N]), A(() => {
|
|
30
|
+
const o = r.current, m = a.current;
|
|
31
|
+
if (m !== n) {
|
|
32
|
+
const f = c.current, u = l(o);
|
|
33
|
+
n ? s("MOUNT") : u === "none" || o?.display === "none" ? s("UNMOUNT") : s(m && f !== u ? "ANIMATION_OUT" : "UNMOUNT"), a.current = n;
|
|
34
|
+
}
|
|
35
|
+
}, [n, s]), A(() => {
|
|
36
|
+
if (e) {
|
|
37
|
+
let o;
|
|
38
|
+
const m = e.ownerDocument.defaultView ?? window, d = (u) => {
|
|
39
|
+
const g = l(r.current).includes(CSS.escape(u.animationName));
|
|
40
|
+
if (u.target === e && g && (s("ANIMATION_END"), !a.current)) {
|
|
41
|
+
const y = e.style.animationFillMode;
|
|
42
|
+
e.style.animationFillMode = "forwards", o = m.setTimeout(() => {
|
|
43
|
+
e.style.animationFillMode === "forwards" && (e.style.animationFillMode = y);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, f = (u) => {
|
|
47
|
+
u.target === e && (c.current = l(r.current));
|
|
48
|
+
};
|
|
49
|
+
return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", d), e.addEventListener("animationend", d), () => {
|
|
50
|
+
m.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", d), e.removeEventListener("animationend", d);
|
|
51
|
+
};
|
|
52
|
+
} else
|
|
53
|
+
s("ANIMATION_END");
|
|
54
|
+
}, [e, s]), {
|
|
55
|
+
isPresent: ["mounted", "unmountSuspended"].includes(N),
|
|
56
|
+
ref: i.useCallback((o) => {
|
|
57
|
+
r.current = o ? getComputedStyle(o) : null, t(o);
|
|
58
|
+
}, [])
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function l(n) {
|
|
62
|
+
return n?.animationName || "none";
|
|
63
|
+
}
|
|
64
|
+
function v(n) {
|
|
65
|
+
let e = Object.getOwnPropertyDescriptor(n.props, "ref")?.get, t = e && "isReactWarning" in e && e.isReactWarning;
|
|
66
|
+
return t ? n.ref : (e = Object.getOwnPropertyDescriptor(n, "ref")?.get, t = e && "isReactWarning" in e && e.isReactWarning, t ? n.props.ref : n.props.ref || n.ref);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
T as Presence
|
|
70
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import * as p from "react-dom";
|
|
3
|
+
import { createSlot as c } from "../../react-slot/dist/index.js";
|
|
4
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
5
|
+
var u = [
|
|
6
|
+
"a",
|
|
7
|
+
"button",
|
|
8
|
+
"div",
|
|
9
|
+
"form",
|
|
10
|
+
"h2",
|
|
11
|
+
"h3",
|
|
12
|
+
"img",
|
|
13
|
+
"input",
|
|
14
|
+
"label",
|
|
15
|
+
"li",
|
|
16
|
+
"nav",
|
|
17
|
+
"ol",
|
|
18
|
+
"p",
|
|
19
|
+
"select",
|
|
20
|
+
"span",
|
|
21
|
+
"svg",
|
|
22
|
+
"ul"
|
|
23
|
+
], h = u.reduce((t, i) => {
|
|
24
|
+
const o = c(`Primitive.${i}`), r = f.forwardRef((e, m) => {
|
|
25
|
+
const { asChild: s, ...a } = e, n = s ? o : i;
|
|
26
|
+
return typeof window < "u" && (window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(n, { ...a, ref: m });
|
|
27
|
+
});
|
|
28
|
+
return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
|
|
29
|
+
}, {});
|
|
30
|
+
function w(t, i) {
|
|
31
|
+
t && p.flushSync(() => t.dispatchEvent(i));
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
h as Primitive,
|
|
35
|
+
w as dispatchDiscreteCustomEvent
|
|
36
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as l from "react";
|
|
2
|
+
import { composeRefs as m } from "../../../../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
4
|
+
// @__NO_SIDE_EFFECTS__
|
|
5
|
+
function b(e) {
|
|
6
|
+
const r = /* @__PURE__ */ y(e), t = l.forwardRef((o, n) => {
|
|
7
|
+
const { children: i, ...c } = o, s = l.Children.toArray(i), a = s.find(E);
|
|
8
|
+
if (a) {
|
|
9
|
+
const f = a.props.children, d = s.map((p) => p === a ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : p);
|
|
10
|
+
return /* @__PURE__ */ u(r, { ...c, ref: n, children: l.isValidElement(f) ? l.cloneElement(f, void 0, d) : null });
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ u(r, { ...c, ref: n, children: i });
|
|
13
|
+
});
|
|
14
|
+
return t.displayName = `${e}.Slot`, t;
|
|
15
|
+
}
|
|
16
|
+
// @__NO_SIDE_EFFECTS__
|
|
17
|
+
function y(e) {
|
|
18
|
+
const r = l.forwardRef((t, o) => {
|
|
19
|
+
const { children: n, ...i } = t;
|
|
20
|
+
if (l.isValidElement(n)) {
|
|
21
|
+
const c = S(n), s = C(i, n.props);
|
|
22
|
+
return n.type !== l.Fragment && (s.ref = o ? m(o, c) : c), l.cloneElement(n, s);
|
|
23
|
+
}
|
|
24
|
+
return l.Children.count(n) > 1 ? l.Children.only(null) : null;
|
|
25
|
+
});
|
|
26
|
+
return r.displayName = `${e}.SlotClone`, r;
|
|
27
|
+
}
|
|
28
|
+
var g = /* @__PURE__ */ Symbol("radix.slottable");
|
|
29
|
+
function E(e) {
|
|
30
|
+
return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === g;
|
|
31
|
+
}
|
|
32
|
+
function C(e, r) {
|
|
33
|
+
const t = { ...r };
|
|
34
|
+
for (const o in r) {
|
|
35
|
+
const n = e[o], i = r[o];
|
|
36
|
+
/^on[A-Z]/.test(o) ? n && i ? t[o] = (...s) => {
|
|
37
|
+
const a = i(...s);
|
|
38
|
+
return n(...s), a;
|
|
39
|
+
} : n && (t[o] = n) : o === "style" ? t[o] = { ...n, ...i } : o === "className" && (t[o] = [n, i].filter(Boolean).join(" "));
|
|
40
|
+
}
|
|
41
|
+
return { ...e, ...t };
|
|
42
|
+
}
|
|
43
|
+
function S(e) {
|
|
44
|
+
let r = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning;
|
|
45
|
+
return t ? e.ref : (r = Object.getOwnPropertyDescriptor(e, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
b as createSlot
|
|
49
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { useLayoutEffect as m } from "../../../../../react-use-layout-effect/dist/index.js";
|
|
3
|
+
var v = o[" useInsertionEffect ".trim().toString()] || m;
|
|
4
|
+
function w({
|
|
5
|
+
prop: e,
|
|
6
|
+
defaultProp: s,
|
|
7
|
+
onChange: t = () => {
|
|
8
|
+
},
|
|
9
|
+
caller: f
|
|
10
|
+
}) {
|
|
11
|
+
const [u, c, i] = R({
|
|
12
|
+
defaultProp: s,
|
|
13
|
+
onChange: t
|
|
14
|
+
}), n = e !== void 0, a = n ? e : u;
|
|
15
|
+
{
|
|
16
|
+
const r = o.useRef(e !== void 0);
|
|
17
|
+
o.useEffect(() => {
|
|
18
|
+
const l = r.current;
|
|
19
|
+
l !== n && console.warn(
|
|
20
|
+
`${f} is changing from ${l ? "controlled" : "uncontrolled"} to ${n ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
21
|
+
), r.current = n;
|
|
22
|
+
}, [n, f]);
|
|
23
|
+
}
|
|
24
|
+
const d = o.useCallback(
|
|
25
|
+
(r) => {
|
|
26
|
+
if (n) {
|
|
27
|
+
const l = C(r) ? r(e) : r;
|
|
28
|
+
l !== e && i.current?.(l);
|
|
29
|
+
} else
|
|
30
|
+
c(r);
|
|
31
|
+
},
|
|
32
|
+
[n, e, c, i]
|
|
33
|
+
);
|
|
34
|
+
return [a, d];
|
|
35
|
+
}
|
|
36
|
+
function R({
|
|
37
|
+
defaultProp: e,
|
|
38
|
+
onChange: s
|
|
39
|
+
}) {
|
|
40
|
+
const [t, f] = o.useState(e), u = o.useRef(t), c = o.useRef(s);
|
|
41
|
+
return v(() => {
|
|
42
|
+
c.current = s;
|
|
43
|
+
}, [s]), o.useEffect(() => {
|
|
44
|
+
u.current !== t && (c.current?.(t), u.current = t);
|
|
45
|
+
}, [t, u]), [t, f, c];
|
|
46
|
+
}
|
|
47
|
+
function C(e) {
|
|
48
|
+
return typeof e == "function";
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
w as useControllableState
|
|
52
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { Primitive as o } from "../../react-primitive/dist/index.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
var d = Object.freeze({
|
|
5
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
6
|
+
position: "absolute",
|
|
7
|
+
border: 0,
|
|
8
|
+
width: 1,
|
|
9
|
+
height: 1,
|
|
10
|
+
padding: 0,
|
|
11
|
+
margin: -1,
|
|
12
|
+
overflow: "hidden",
|
|
13
|
+
clip: "rect(0, 0, 0, 0)",
|
|
14
|
+
whiteSpace: "nowrap",
|
|
15
|
+
wordWrap: "normal"
|
|
16
|
+
}), l = "VisuallyHidden", e = a.forwardRef(
|
|
17
|
+
(r, i) => /* @__PURE__ */ t(
|
|
18
|
+
o.span,
|
|
19
|
+
{
|
|
20
|
+
...r,
|
|
21
|
+
ref: i,
|
|
22
|
+
style: { ...d, ...r.style }
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
e.displayName = l;
|
|
27
|
+
var p = e;
|
|
28
|
+
export {
|
|
29
|
+
p as Root,
|
|
30
|
+
d as VISUALLY_HIDDEN_STYLES,
|
|
31
|
+
e as VisuallyHidden
|
|
32
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as u } from "../../../../_virtual/
|
|
1
|
+
import { __exports as u } from "../../../../_virtual/index12.js";
|
|
2
2
|
import { __require as g } from "./format-date.js";
|
|
3
3
|
import { __require as b } from "./set-geolocation.js";
|
|
4
4
|
import { __require as p } from "./set-contact.js";
|
|
@@ -1,34 +1,52 @@
|
|
|
1
|
-
import { jsx as o, Fragment as x, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as o, Fragment as x, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y } from "react";
|
|
3
3
|
import { getCommonProps as w, noOp as C } from "../../utils/index.js";
|
|
4
4
|
import $ from "../../_virtual/index.js";
|
|
5
|
-
import { AuthState as
|
|
6
|
-
import { TextVariants as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
5
|
+
import { AuthState as e } from "./types.js";
|
|
6
|
+
import { TextVariants as m } from "../../components/Text/types.js";
|
|
7
|
+
import l from "../../components/Text/Text.js";
|
|
8
|
+
import g from "../../components/Icon/Icon.js";
|
|
9
|
+
const v = y(
|
|
10
10
|
({
|
|
11
|
-
accountDetailsLinkComponent:
|
|
12
|
-
className:
|
|
13
|
-
onLogin:
|
|
14
|
-
authState:
|
|
15
|
-
loginLabel:
|
|
16
|
-
accountLabel:
|
|
17
|
-
href:
|
|
18
|
-
disabled:
|
|
19
|
-
...
|
|
20
|
-
},
|
|
21
|
-
const { className: n, ...N } = w(
|
|
22
|
-
return /* @__PURE__ */ o("div", { ...N, className: $(n,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
accountDetailsLinkComponent: d = "a",
|
|
12
|
+
className: f,
|
|
13
|
+
onLogin: h = C,
|
|
14
|
+
authState: r = e.LoggedOut,
|
|
15
|
+
loginLabel: t = "Login",
|
|
16
|
+
accountLabel: a = "Account",
|
|
17
|
+
href: p = "/account",
|
|
18
|
+
disabled: c = !1,
|
|
19
|
+
...i
|
|
20
|
+
}, u) => {
|
|
21
|
+
const { className: n, ...N } = w(i, "UserManagement"), _ = r === e.LoggedIn, A = r !== e.Loading;
|
|
22
|
+
return /* @__PURE__ */ o("div", { ...N, className: $(n, f), ...i, ref: u, children: A && /* @__PURE__ */ o(x, { children: _ ? /* @__PURE__ */ s(
|
|
23
|
+
d,
|
|
24
|
+
{
|
|
25
|
+
"aria-label": typeof a == "string" ? a : "Account",
|
|
26
|
+
className: `${n}__login`,
|
|
27
|
+
href: p,
|
|
28
|
+
disabled: c,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ o(g, { icon: "Account", className: `${n}__account-icon`, height: "100%", width: "100%" }),
|
|
31
|
+
/* @__PURE__ */ o(l, { variant: m.bodySmall, children: a })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
) : /* @__PURE__ */ s(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
"aria-label": typeof t == "string" ? t : "Login",
|
|
38
|
+
className: `${n}__login`,
|
|
39
|
+
onClick: h,
|
|
40
|
+
disabled: c,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ o(g, { icon: "Account", className: `${n}__account-icon`, height: "100%", width: "100%" }),
|
|
43
|
+
/* @__PURE__ */ o(l, { variant: m.bodySmall, children: t })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) }) });
|
|
29
47
|
}
|
|
30
48
|
);
|
|
31
|
-
|
|
49
|
+
v.displayName = "UserManagement";
|
|
32
50
|
export {
|
|
33
|
-
|
|
51
|
+
v as default
|
|
34
52
|
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
@use 'components/Grid/grid';
|
|
14
14
|
@use 'components/Navigation/navigation';
|
|
15
15
|
@use 'components/Navigation/NavigationItem/navigationItem';
|
|
16
|
-
@use 'components/Navigation/
|
|
16
|
+
@use 'components/Navigation/NavigationItemWithSubmenu/navigationItemWithSubmenu';
|
|
17
17
|
@use 'components/Navigation/NavigationList/navigationList';
|
|
18
18
|
@use 'components/Input/input';
|
|
19
19
|
@use 'components/Row/row';
|
|
@@ -110,6 +110,12 @@
|
|
|
110
110
|
text-align: inherit;
|
|
111
111
|
width: 100%;
|
|
112
112
|
|
|
113
|
+
// Disabled state: keep normal appearance (no gray-out), only interaction is disabled
|
|
114
|
+
&[data-disabled] {
|
|
115
|
+
color: inherit;
|
|
116
|
+
opacity: 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
113
119
|
&--hoverable {
|
|
114
120
|
cursor: pointer;
|
|
115
121
|
|
|
@@ -71,18 +71,6 @@
|
|
|
71
71
|
display: flex;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
@include isHeaderDesktop {
|
|
76
|
-
& > .#{$px}-nav__list-item-trigger::before {
|
|
77
|
-
background: $grey-50;
|
|
78
|
-
content: '';
|
|
79
|
-
height: 2px;
|
|
80
|
-
left: 0;
|
|
81
|
-
position: absolute;
|
|
82
|
-
top: 100%;
|
|
83
|
-
width: 100%;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
74
|
}
|
|
87
75
|
|
|
88
76
|
.#{$px}-nav__list__section {
|
package/dist/scss/components/Navigation/NavigationItemWithSubmenu/_navigationItemWithSubmenu.scss
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use '../../../allPartials' as *;
|
|
2
|
+
|
|
3
|
+
.#{$px}-navigation-item-with-submenu {
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
& > button {
|
|
8
|
+
color: $pure-black;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 100%;
|
|
13
|
+
|
|
14
|
+
@include isHeaderDesktop {
|
|
15
|
+
color: unset;
|
|
16
|
+
display: block;
|
|
17
|
+
text-align: center;
|
|
18
|
+
|
|
19
|
+
// Match .nav__item .nav__link--linkStylised typography so trigger label aligns with link labels
|
|
20
|
+
@include text($linkStylised);
|
|
21
|
+
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
@include focus-ring($border-radius: $radius-xs);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@include isHeaderDesktop {
|
|
29
|
+
// Underline on button (full-width like .nav__item .nav__link--linkStylised) when open, hover or focus
|
|
30
|
+
&[data-state='open'] > button::after,
|
|
31
|
+
&--hovered > button::after,
|
|
32
|
+
& > button:hover::after,
|
|
33
|
+
& > button:focus-visible::after {
|
|
34
|
+
background-color: $pure-black;
|
|
35
|
+
bottom: -1px;
|
|
36
|
+
content: '';
|
|
37
|
+
height: 1px;
|
|
38
|
+
left: 0;
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Radix: submenu content is rendered in viewport; these styles apply when content is in viewport
|
|
44
|
+
&__submenu[data-state='open'] {
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
cursor: default;
|
|
47
|
+
left: 0;
|
|
48
|
+
max-height: calc(90vh - #{$header-height} + var(--banner-height));
|
|
49
|
+
min-width: 100%;
|
|
50
|
+
-ms-overflow-style: none;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
padding: 0;
|
|
53
|
+
scrollbar-width: none;
|
|
54
|
+
width: 100%;
|
|
55
|
+
|
|
56
|
+
&::-webkit-scrollbar {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.#{$px}-nav__list__section {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// When submenu is rendered inside nav viewport: panel and link styles (@at-root so selector is viewport → submenu)
|
|
66
|
+
@at-root .#{$px}-nav__radix-viewport .#{$px}-navigation-item-with-submenu__submenu {
|
|
67
|
+
background-color: $pure-white;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
|
|
70
|
+
.#{$px}-nav__list {
|
|
71
|
+
align-items: flex-start;
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
padding: $spacing-md;
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.#{$px}-nav__list .#{$px}-link--linkStylised {
|
|
78
|
+
padding: $snowflake-menu-padding 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Single underline on hover/focus for submenu links
|
|
82
|
+
.#{$px}-nav__list .#{$px}-nav__item {
|
|
83
|
+
.#{$px}-link--linkStylised,
|
|
84
|
+
.#{$px}-link--linkMedium,
|
|
85
|
+
.#{$px}-link--linkLarge {
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
|
|
88
|
+
&:hover,
|
|
89
|
+
&:focus-visible {
|
|
90
|
+
text-decoration: underline;
|
|
91
|
+
text-decoration-thickness: 1px;
|
|
92
|
+
text-underline-offset: 1px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// View all link: always underlined
|
|
97
|
+
.#{$px}-nav__item--view-all {
|
|
98
|
+
text-decoration: underline;
|
|
99
|
+
text-decoration-thickness: 1px;
|
|
100
|
+
text-underline-offset: 1px;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.#{$px}-nav__list .#{$px}-link--linkMedium,
|
|
105
|
+
.#{$px}-nav__list .#{$px}-link--linkLarge {
|
|
106
|
+
padding: 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__submenu--mobile.#{$px}-nav__list {
|
|
112
|
+
padding: 0 0 $snowflake-menu-padding;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -8,7 +8,8 @@ $top-transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
8
8
|
justify-content: left;
|
|
9
9
|
opacity: 1;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// Remove default outline only for mouse focus; keep it for keyboard (:focus-visible)
|
|
12
|
+
&:focus:not(:focus-visible) {
|
|
12
13
|
outline: none;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -28,16 +29,27 @@ $top-transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
28
29
|
padding: 0;
|
|
29
30
|
position: relative;
|
|
30
31
|
top: 0;
|
|
32
|
+
transform: translateY(0);
|
|
31
33
|
transition:
|
|
32
34
|
$top-transition,
|
|
35
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
33
36
|
opacity 0.5s cubic-bezier(0.65, 0, 0.35, 1);
|
|
37
|
+
z-index: 5;
|
|
34
38
|
|
|
39
|
+
@media (prefers-reduced-motion: reduce) {
|
|
40
|
+
transition: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Offscreen state (transform/opacity) driven by .nav__list-container--search-expanded in _navigation.scss
|
|
35
44
|
&--offscreen {
|
|
36
|
-
top: -100%;
|
|
37
45
|
transition:
|
|
38
46
|
$top-transition,
|
|
47
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
39
48
|
opacity 0.2s cubic-bezier(0.65, 0, 0.35, 1);
|
|
40
|
-
|
|
49
|
+
|
|
50
|
+
@media (prefers-reduced-motion: reduce) {
|
|
51
|
+
transition: none;
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
54
|
|
|
43
55
|
&__section {
|