@phillips/seldon 1.176.1 → 1.178.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/components/ComboBox/ComboBox.d.ts +5 -0
- package/dist/components/ComboBox/ComboBox.js +132 -130
- package/dist/components/ComboBox/ComboBox.stories.d.ts +7 -0
- package/dist/components/Navigation/NavigationList/NavigationList.js +1 -1
- package/dist/components/NotificationBanner/NotificationBanner.d.ts +18 -0
- package/dist/components/NotificationBanner/NotificationBanner.js +12 -0
- package/dist/components/NotificationBanner/NotificationBanner.stories.d.ts +19 -0
- package/dist/components/NotificationBanner/NotificationBanner.test.d.ts +1 -0
- package/dist/components/NotificationBanner/index.d.ts +1 -0
- package/dist/components/Toast/useToast.js +11 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.js +50 -48
- package/dist/scss/_vars.scss +2 -0
- package/dist/scss/_vars.scss.js +2 -0
- package/dist/scss/componentStyles.scss +1 -0
- package/dist/scss/components/ComboBox/_combobox.scss +4 -0
- package/dist/scss/components/Navigation/NavigationItemTrigger/_navigationItemTrigger.scss +5 -2
- package/dist/scss/components/NotificationBanner/_notificationBanner.scss +11 -0
- package/dist/scss/site-furniture/Header/_header.scss +1 -1
- package/dist/site-furniture/Header/Header.d.ts +4 -0
- package/dist/site-furniture/Header/Header.js +100 -80
- package/package.json +1 -1
|
@@ -80,6 +80,11 @@ export interface ComboBoxProps {
|
|
|
80
80
|
* Handler called when the combobox loses focus
|
|
81
81
|
*/
|
|
82
82
|
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
|
83
|
+
/**
|
|
84
|
+
* Number of characters required in the input before the dropdown options are shown.
|
|
85
|
+
* @default 0
|
|
86
|
+
*/
|
|
87
|
+
countOfCharsBeforeDropdown?: number;
|
|
83
88
|
}
|
|
84
89
|
/**
|
|
85
90
|
* ## Overview
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Root as
|
|
1
|
+
import { jsxs as x, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Root as ht, Trigger as _t, Portal as vt, Content as $t } from "../../node_modules/@radix-ui/react-popover/dist/index.js";
|
|
3
3
|
import d from "../../node_modules/classnames/index.js";
|
|
4
|
-
import { Command as
|
|
5
|
-
import
|
|
6
|
-
import { useOnClickOutside as
|
|
4
|
+
import { Command as yt, CommandInput as Ct, CommandList as bt, CommandGroup as wt, CommandItem as gt } from "../../node_modules/cmdk/dist/index.js";
|
|
5
|
+
import Nt, { useState as S, useCallback as g, useRef as O, useMemo as V } from "react";
|
|
6
|
+
import { useOnClickOutside as It } from "../../node_modules/usehooks-ts/dist/index.js";
|
|
7
7
|
import "../../assets/formatted/AccountActive.js";
|
|
8
8
|
import "../../assets/formatted/Account.js";
|
|
9
9
|
import "../../assets/formatted/Add.js";
|
|
@@ -29,11 +29,11 @@ import "../../assets/formatted/ArrowRight.js";
|
|
|
29
29
|
import "../../assets/formatted/ArrowUp.js";
|
|
30
30
|
import "../../assets/formatted/Bag.js";
|
|
31
31
|
import "../../assets/formatted/Calendar.js";
|
|
32
|
-
import
|
|
32
|
+
import Tt from "../../assets/formatted/ChevronDown.js";
|
|
33
33
|
import "../../assets/formatted/ChevronLeft.js";
|
|
34
34
|
import "../../assets/formatted/ChevronRight.js";
|
|
35
35
|
import "../../assets/formatted/ChevronUp.js";
|
|
36
|
-
import
|
|
36
|
+
import kt from "../../assets/formatted/CloseX.js";
|
|
37
37
|
import "../../assets/formatted/ConditionReport.js";
|
|
38
38
|
import "../../assets/formatted/Delete.js";
|
|
39
39
|
import "../../assets/formatted/Download.js";
|
|
@@ -83,133 +83,135 @@ import "../../assets/formatted/VolumeMaximum.js";
|
|
|
83
83
|
import "../../assets/formatted/VolumeMid.js";
|
|
84
84
|
import "../../assets/formatted/VolumeMinimum.js";
|
|
85
85
|
import "../../assets/formatted/WeChat.js";
|
|
86
|
-
import { getCommonProps as
|
|
87
|
-
import
|
|
88
|
-
import { ButtonVariants as
|
|
89
|
-
import { usePrevious as
|
|
90
|
-
const
|
|
86
|
+
import { getCommonProps as xt, useNormalizedInputProps as Ot } from "../../utils/index.js";
|
|
87
|
+
import H from "../IconButton/IconButton.js";
|
|
88
|
+
import { ButtonVariants as J } from "../Button/types.js";
|
|
89
|
+
import { usePrevious as Vt } from "../../utils/usePrevious.js";
|
|
90
|
+
const Dt = Nt.forwardRef(function({
|
|
91
91
|
options: a = [],
|
|
92
|
-
className:
|
|
93
|
-
id:
|
|
94
|
-
labelText:
|
|
95
|
-
placeholder:
|
|
96
|
-
name:
|
|
92
|
+
className: Q,
|
|
93
|
+
id: l,
|
|
94
|
+
labelText: Y,
|
|
95
|
+
placeholder: Z,
|
|
96
|
+
name: D,
|
|
97
97
|
value: p,
|
|
98
98
|
onChange: u,
|
|
99
|
-
onBlur:
|
|
99
|
+
onBlur: tt,
|
|
100
100
|
renderOption: j,
|
|
101
|
-
ariaLabelDropdown:
|
|
101
|
+
ariaLabelDropdown: N,
|
|
102
102
|
ariaLabelInput: q,
|
|
103
|
-
ariaLabelClear:
|
|
103
|
+
ariaLabelClear: I,
|
|
104
104
|
ariaLabelContent: z,
|
|
105
|
-
hideLabel:
|
|
106
|
-
popoverContainerRef:
|
|
107
|
-
noOptionsMessage:
|
|
108
|
-
invalid:
|
|
109
|
-
invalidText:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
hideLabel: et = !1,
|
|
106
|
+
popoverContainerRef: rt,
|
|
107
|
+
noOptionsMessage: ot = "No Options.",
|
|
108
|
+
invalid: T = !1,
|
|
109
|
+
invalidText: it,
|
|
110
|
+
countOfCharsBeforeDropdown: G = 0,
|
|
111
|
+
...lt
|
|
112
|
+
}, M) {
|
|
113
|
+
const { className: e, ...st } = xt({ id: l }, "ComboBox"), nt = Tt, at = kt, K = Ot({
|
|
114
|
+
id: l,
|
|
115
|
+
invalid: T,
|
|
116
|
+
invalidText: it,
|
|
116
117
|
type: "text"
|
|
117
|
-
}), [f,
|
|
118
|
+
}), [f, U] = S(!1), [mt, ct] = S(""), W = Vt(p), R = g((t) => t.label || t.value, []), [o, $] = S(() => {
|
|
118
119
|
if (p !== void 0) {
|
|
119
120
|
const t = a.find((r) => r.value === p);
|
|
120
121
|
return t ? t.displayValue || R(t) : "";
|
|
121
122
|
}
|
|
122
123
|
return "";
|
|
123
|
-
}), y =
|
|
124
|
-
if (!
|
|
124
|
+
}), y = O(null), C = O(null), b = O(!1), E = O(null), m = g((t) => R(t), [R]), h = p !== void 0, F = h ? p : mt, s = V(() => a.find((t) => t.value === F) || null, [a, F]), _ = V(() => s ? s.displayValue || m(s) : "", [s, m]), c = V(() => {
|
|
125
|
+
if (!o || s && o === _)
|
|
125
126
|
return a;
|
|
126
|
-
const t =
|
|
127
|
+
const t = o.toLowerCase().trim();
|
|
127
128
|
return a.filter((r) => {
|
|
128
|
-
const
|
|
129
|
+
const w = m(r).toLowerCase().includes(t), A = r.value.toLowerCase().includes(t), B = r.displayValue?.toLowerCase().includes(t) || !1;
|
|
129
130
|
let v = !1;
|
|
130
|
-
return r.filterTerms && r.filterTerms.length > 0 && (v = r.filterTerms.some((
|
|
131
|
+
return r.filterTerms && r.filterTerms.length > 0 && (v = r.filterTerms.some((dt) => dt.toLowerCase().includes(t))), w || A || B || v;
|
|
131
132
|
});
|
|
132
|
-
}, [
|
|
133
|
-
(t) => {
|
|
134
|
-
|
|
133
|
+
}, [o, _, s, m, a]), n = g(
|
|
134
|
+
(t, r) => {
|
|
135
|
+
const w = (r?.length || o.length) >= G;
|
|
136
|
+
(!t || t && w) && U(t), t && s && c.length > 5 && requestAnimationFrame(() => {
|
|
135
137
|
E.current && E.current.scrollIntoView({
|
|
136
138
|
block: "nearest",
|
|
137
139
|
behavior: "auto"
|
|
138
140
|
});
|
|
139
141
|
});
|
|
140
142
|
},
|
|
141
|
-
[
|
|
142
|
-
),
|
|
143
|
+
[G, o.length, s, c.length]
|
|
144
|
+
), k = g(
|
|
143
145
|
(t) => {
|
|
144
|
-
h ||
|
|
146
|
+
h || ct(t.value);
|
|
145
147
|
const r = t.displayValue || m(t);
|
|
146
|
-
$(r), u && u(t.value, t), n(!1),
|
|
147
|
-
|
|
148
|
+
$(r), u && u(t.value, t), n(!1), b.current = !0, requestAnimationFrame(() => {
|
|
149
|
+
b.current = !1;
|
|
148
150
|
});
|
|
149
151
|
},
|
|
150
152
|
[h, u, n, m]
|
|
151
|
-
),
|
|
152
|
-
n(!1),
|
|
153
|
-
|
|
153
|
+
), pt = (t) => {
|
|
154
|
+
n(!1), b.current = !0, t.preventDefault(), t.stopPropagation(), u && h && u("", null), $(""), C.current?.focus(), requestAnimationFrame(() => {
|
|
155
|
+
b.current = !1;
|
|
154
156
|
});
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
$(t), t !== "" && c.length > 0 && n(!0);
|
|
159
|
-
},
|
|
157
|
+
}, ut = () => {
|
|
158
|
+
U(!f), C.current?.focus();
|
|
159
|
+
}, ft = (t) => {
|
|
160
|
+
$(t), t !== "" && c.length > 0 && n(!0, t);
|
|
161
|
+
}, X = V(() => {
|
|
160
162
|
if (h) {
|
|
161
|
-
if (p !==
|
|
162
|
-
return
|
|
163
|
-
if (
|
|
163
|
+
if (p !== W)
|
|
164
|
+
return s ? _ : o;
|
|
165
|
+
if (s) {
|
|
164
166
|
const t = _;
|
|
165
|
-
return t !==
|
|
167
|
+
return t !== o ? o : t;
|
|
166
168
|
} else
|
|
167
|
-
return
|
|
169
|
+
return o;
|
|
168
170
|
}
|
|
169
|
-
return
|
|
170
|
-
}, [h,
|
|
171
|
-
if (
|
|
171
|
+
return o;
|
|
172
|
+
}, [h, o, p, W, s, _]), P = (t) => {
|
|
173
|
+
if (s) {
|
|
172
174
|
const r = _;
|
|
173
|
-
r !==
|
|
175
|
+
r !== X && !t && $(r);
|
|
174
176
|
} else
|
|
175
177
|
$("");
|
|
176
|
-
},
|
|
178
|
+
}, L = g(() => {
|
|
177
179
|
const t = a.filter((r) => {
|
|
178
|
-
const
|
|
179
|
-
return
|
|
180
|
+
const w = m(r).toLowerCase(), A = r.value.toLowerCase(), B = r.displayValue?.toLowerCase(), v = o.toLowerCase();
|
|
181
|
+
return w === v || A === v || B === v;
|
|
180
182
|
});
|
|
181
|
-
t.length === 1 &&
|
|
182
|
-
}, [
|
|
183
|
-
return
|
|
184
|
-
t.target.closest(`.${e}__item`) || t.target.closest(`.${e}__content`) || y.current?.contains(t.target) || t.target === y.current || (
|
|
185
|
-
}), /* @__PURE__ */
|
|
186
|
-
|
|
183
|
+
t.length === 1 && k(t[0]);
|
|
184
|
+
}, [o, a, k, m]);
|
|
185
|
+
return It(y, (t) => {
|
|
186
|
+
t.target.closest(`.${e}__item`) || t.target.closest(`.${e}__content`) || y.current?.contains(t.target) || t.target === y.current || (L(), P(), n(!1));
|
|
187
|
+
}), /* @__PURE__ */ x("div", { ref: M, className: d(e, Q), id: l, ...st, ...lt, children: [
|
|
188
|
+
D && /* @__PURE__ */ i(
|
|
187
189
|
"input",
|
|
188
190
|
{
|
|
189
191
|
type: "hidden",
|
|
190
|
-
name:
|
|
191
|
-
id:
|
|
192
|
+
name: D,
|
|
193
|
+
id: D,
|
|
192
194
|
value: F || "",
|
|
193
195
|
ref: (t) => {
|
|
194
|
-
typeof
|
|
196
|
+
typeof M == "function" && t && M(t);
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ x("div", { ref: y, className: `${e}__wrapper`, children: [
|
|
201
|
+
/* @__PURE__ */ i(
|
|
200
202
|
"label",
|
|
201
203
|
{
|
|
202
|
-
htmlFor: `${
|
|
204
|
+
htmlFor: `${l}-input`,
|
|
203
205
|
className: d(`${e}__label`, {
|
|
204
|
-
[`${e}__label--hidden`]:
|
|
205
|
-
[`${e}__label--invalid`]:
|
|
206
|
+
[`${e}__label--hidden`]: et,
|
|
207
|
+
[`${e}__label--invalid`]: T
|
|
206
208
|
}),
|
|
207
|
-
"data-testid": `${
|
|
208
|
-
children:
|
|
209
|
+
"data-testid": `${l}-label`,
|
|
210
|
+
children: Y
|
|
209
211
|
}
|
|
210
212
|
),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
|
|
213
|
+
/* @__PURE__ */ i(
|
|
214
|
+
yt,
|
|
213
215
|
{
|
|
214
216
|
loop: !0,
|
|
215
217
|
onKeyDown: (t) => {
|
|
@@ -219,80 +221,80 @@ const Vt = gt.forwardRef(function({
|
|
|
219
221
|
},
|
|
220
222
|
shouldFilter: !1,
|
|
221
223
|
className: `${e}__command-wrapper`,
|
|
222
|
-
children: /* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
+
children: /* @__PURE__ */ x(ht, { open: f, modal: !1, children: [
|
|
225
|
+
/* @__PURE__ */ i(_t, { asChild: !0, children: /* @__PURE__ */ x(
|
|
224
226
|
"div",
|
|
225
227
|
{
|
|
226
228
|
className: d(`${e}__input-wrapper`, {
|
|
227
|
-
[`${e}__input-wrapper--invalid`]:
|
|
229
|
+
[`${e}__input-wrapper--invalid`]: T
|
|
228
230
|
}),
|
|
229
231
|
children: [
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
232
|
+
/* @__PURE__ */ i(
|
|
233
|
+
Ct,
|
|
232
234
|
{
|
|
233
|
-
id: `${
|
|
234
|
-
placeholder:
|
|
235
|
-
value:
|
|
236
|
-
onValueChange:
|
|
235
|
+
id: `${l}-input`,
|
|
236
|
+
placeholder: Z,
|
|
237
|
+
value: X,
|
|
238
|
+
onValueChange: ft,
|
|
237
239
|
tabIndex: 0,
|
|
238
240
|
onFocus: () => {
|
|
239
|
-
c.length > 0 && !
|
|
241
|
+
c.length > 0 && !b.current && !f && n(!0);
|
|
240
242
|
},
|
|
241
243
|
onClick: (t) => {
|
|
242
244
|
n(!0), t.preventDefault(), t.currentTarget.focus();
|
|
243
245
|
},
|
|
244
246
|
onKeyDown: (t) => {
|
|
245
|
-
t.key === "Tab" ? (n(!1),
|
|
247
|
+
t.key === "Tab" ? (n(!1), L(), P()) : t.key === "Enter" && !f ? (u && u(o, null), c.length === 1 && k(c[0])) : t.key === "Escape" ? (n(!1), t.preventDefault(), L(), P()) : (t.key === "ArrowDown" || t.key === "ArrowUp") && !f && c.length > 0 && (n(!0), t.preventDefault());
|
|
246
248
|
},
|
|
247
|
-
onBlur:
|
|
249
|
+
onBlur: tt,
|
|
248
250
|
className: d(`${e}__input`, {
|
|
249
|
-
[`${e}__input--invalid`]:
|
|
251
|
+
[`${e}__input--invalid`]: T
|
|
250
252
|
}),
|
|
251
|
-
"aria-label": q || `${
|
|
252
|
-
"data-testid": `${
|
|
253
|
-
ref:
|
|
253
|
+
"aria-label": q || `${l}-input`,
|
|
254
|
+
"data-testid": `${l}-input`,
|
|
255
|
+
ref: C
|
|
254
256
|
}
|
|
255
257
|
),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
o && /* @__PURE__ */ i(
|
|
259
|
+
H,
|
|
258
260
|
{
|
|
259
261
|
className: `${e}__close-button`,
|
|
260
|
-
"data-testid": `${
|
|
261
|
-
onClick:
|
|
262
|
-
"aria-label":
|
|
262
|
+
"data-testid": `${l}-clear-button`,
|
|
263
|
+
onClick: pt,
|
|
264
|
+
"aria-label": I || `${l}-clear`,
|
|
263
265
|
tabIndex: -1,
|
|
264
|
-
variant:
|
|
265
|
-
children: /* @__PURE__ */
|
|
266
|
-
|
|
266
|
+
variant: J.tertiary,
|
|
267
|
+
children: /* @__PURE__ */ i(
|
|
268
|
+
at,
|
|
267
269
|
{
|
|
268
270
|
color: "currentColor",
|
|
269
271
|
height: 18,
|
|
270
272
|
width: 18,
|
|
271
273
|
className: `${e}__icon-button`,
|
|
272
|
-
title:
|
|
274
|
+
title: I || `${l}-clear`
|
|
273
275
|
}
|
|
274
276
|
)
|
|
275
277
|
}
|
|
276
278
|
),
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
|
|
279
|
+
/* @__PURE__ */ i(
|
|
280
|
+
H,
|
|
279
281
|
{
|
|
280
|
-
"aria-label":
|
|
282
|
+
"aria-label": N || `${l}-dropdown`,
|
|
281
283
|
className: d(`${e}__dropdown-button`, {
|
|
282
284
|
[`${e}__dropdown-button--open`]: f
|
|
283
285
|
}),
|
|
284
|
-
onClick:
|
|
285
|
-
"data-testid": `${
|
|
286
|
+
onClick: ut,
|
|
287
|
+
"data-testid": `${l}-dropdown`,
|
|
286
288
|
tabIndex: -1,
|
|
287
|
-
variant:
|
|
288
|
-
children: /* @__PURE__ */
|
|
289
|
-
|
|
289
|
+
variant: J.tertiary,
|
|
290
|
+
children: /* @__PURE__ */ i(
|
|
291
|
+
nt,
|
|
290
292
|
{
|
|
291
293
|
color: "currentColor",
|
|
292
294
|
height: 18,
|
|
293
295
|
width: 18,
|
|
294
296
|
className: `${e}__icon-button`,
|
|
295
|
-
title:
|
|
297
|
+
title: N || `${l}-dropdown`
|
|
296
298
|
}
|
|
297
299
|
)
|
|
298
300
|
}
|
|
@@ -300,44 +302,44 @@ const Vt = gt.forwardRef(function({
|
|
|
300
302
|
]
|
|
301
303
|
}
|
|
302
304
|
) }),
|
|
303
|
-
f && /* @__PURE__ */
|
|
304
|
-
|
|
305
|
+
f && /* @__PURE__ */ i(vt, { container: rt?.current || document.body, children: /* @__PURE__ */ i(
|
|
306
|
+
$t,
|
|
305
307
|
{
|
|
306
308
|
className: `${e}__content`,
|
|
307
|
-
"aria-label": z || `${
|
|
309
|
+
"aria-label": z || `${l}-content`,
|
|
308
310
|
side: "bottom",
|
|
309
311
|
sideOffset: -5,
|
|
310
312
|
align: "start",
|
|
311
313
|
alignOffset: 0,
|
|
312
314
|
onFocus: () => {
|
|
313
|
-
document.activeElement !==
|
|
315
|
+
document.activeElement !== C.current && C.current?.focus();
|
|
314
316
|
},
|
|
315
317
|
style: {
|
|
316
318
|
width: y.current?.offsetWidth || "100%"
|
|
317
319
|
},
|
|
318
|
-
children: /* @__PURE__ */
|
|
319
|
-
|
|
320
|
+
children: /* @__PURE__ */ i(bt, { className: `${e}__list`, children: c.length > 0 ? /* @__PURE__ */ i(wt, { className: `${e}__group`, children: c.map((t) => /* @__PURE__ */ i(
|
|
321
|
+
gt,
|
|
320
322
|
{
|
|
321
323
|
className: d(`${e}__item`, {
|
|
322
|
-
[`${e}__item--selected`]:
|
|
324
|
+
[`${e}__item--selected`]: s?.value === t.value
|
|
323
325
|
}),
|
|
324
326
|
value: t.value,
|
|
325
|
-
onSelect: () =>
|
|
326
|
-
...
|
|
327
|
+
onSelect: () => k(t),
|
|
328
|
+
...s?.value === t.value ? { ref: E } : {},
|
|
327
329
|
children: j ? j(t) : m(t)
|
|
328
330
|
},
|
|
329
331
|
t.value
|
|
330
|
-
)) }) : /* @__PURE__ */
|
|
332
|
+
)) }) : /* @__PURE__ */ i("div", { className: `${e}__no-options`, children: ot }) })
|
|
331
333
|
}
|
|
332
334
|
) })
|
|
333
335
|
] })
|
|
334
336
|
}
|
|
335
337
|
),
|
|
336
|
-
|
|
338
|
+
K.validation ? K.validation : /* @__PURE__ */ i("p", { className: d(`${e}__validation`), children: " " })
|
|
337
339
|
] })
|
|
338
340
|
] });
|
|
339
341
|
});
|
|
340
|
-
|
|
342
|
+
Dt.displayName = "ComboBox";
|
|
341
343
|
export {
|
|
342
|
-
|
|
344
|
+
Dt as default
|
|
343
345
|
};
|
|
@@ -12,6 +12,7 @@ export declare const Playground: {
|
|
|
12
12
|
options: ComboBoxOption[];
|
|
13
13
|
id: string;
|
|
14
14
|
labelText: string;
|
|
15
|
+
noOptionsMessage: string;
|
|
15
16
|
};
|
|
16
17
|
argTypes: {
|
|
17
18
|
options: {
|
|
@@ -53,6 +54,12 @@ export declare const Playground: {
|
|
|
53
54
|
value: {
|
|
54
55
|
control: boolean;
|
|
55
56
|
};
|
|
57
|
+
countOfCharsBeforeDropdown: {
|
|
58
|
+
control: string;
|
|
59
|
+
};
|
|
60
|
+
noOptionsMessage: {
|
|
61
|
+
control: string;
|
|
62
|
+
};
|
|
56
63
|
};
|
|
57
64
|
};
|
|
58
65
|
export declare const ComboBoxInDrawer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as r, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import o from "../../../node_modules/classnames/index.js";
|
|
2
3
|
import * as a from "react";
|
|
3
4
|
import { px as n } from "../../../utils/index.js";
|
|
4
|
-
import o from "../../../node_modules/classnames/index.js";
|
|
5
5
|
import { TextVariants as d } from "../../Text/types.js";
|
|
6
6
|
import u from "../../Text/Text.js";
|
|
7
7
|
const g = a.forwardRef(
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
export type NotificationBannerProps = ComponentProps<'div'> & {
|
|
3
|
+
/**
|
|
4
|
+
* The content to display inside the notification banner.
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* ## Overview
|
|
10
|
+
*
|
|
11
|
+
* The `NotificationBanner` component displays a prominent message at the top of the page or section to inform users about important information, updates, or alerts. It is designed to be highly visible and can contain any custom content passed as children. Use this component to draw attention to critical messages that require user awareness.
|
|
12
|
+
*
|
|
13
|
+
* [Figma Link](https://www.figma.com/design/qEd5aXjQeiboeJ8GJMOJba/Global-Notification-Banner?node-id=1-1899&m=dev)
|
|
14
|
+
*
|
|
15
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-notificationbanner--overview)
|
|
16
|
+
*/
|
|
17
|
+
declare const NotificationBanner: import('react').ForwardRefExoticComponent<Omit<NotificationBannerProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default NotificationBanner;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import e from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { forwardRef as c } from "react";
|
|
4
|
+
import { getCommonProps as f } from "../../utils/index.js";
|
|
5
|
+
const l = c(({ className: a, ...o }, i) => {
|
|
6
|
+
const { className: m, ...n } = f(o, "NotificationBanner"), { children: r, id: t } = o;
|
|
7
|
+
return /* @__PURE__ */ s("div", { ...n, ...o, className: e(m, a), ref: i, id: t, children: r });
|
|
8
|
+
});
|
|
9
|
+
l.displayName = "NotificationBanner";
|
|
10
|
+
export {
|
|
11
|
+
l as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AuthState } from '../../patterns/UserManagement/types';
|
|
3
|
+
import { HeaderProps } from '../../site-furniture/Header/Header';
|
|
4
|
+
import { NotificationBannerProps } from './NotificationBanner';
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: React.ForwardRefExoticComponent<Omit<NotificationBannerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
export declare const Playground: {
|
|
11
|
+
(props: NotificationBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
args: {
|
|
13
|
+
children: import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
};
|
|
15
|
+
argTypes: {};
|
|
16
|
+
};
|
|
17
|
+
export declare const WithHeader: ({ authState, ...props }: HeaderProps & {
|
|
18
|
+
authState?: AuthState;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NotificationBanner, type NotificationBannerProps } from './NotificationBanner';
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { useToastContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { useToastContext as a } from "./useToastContext.js";
|
|
2
|
+
import { useCallback as o } from "react";
|
|
3
|
+
const c = () => {
|
|
4
|
+
const { addToast: e } = a();
|
|
5
|
+
return o(
|
|
6
|
+
(t) => {
|
|
7
|
+
typeof t == "object" && t !== null && "title" in t ? e(t) : e({ title: t });
|
|
8
|
+
},
|
|
9
|
+
[e]
|
|
10
|
+
);
|
|
7
11
|
};
|
|
8
12
|
export {
|
|
9
|
-
|
|
13
|
+
c as useToast
|
|
10
14
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -78,10 +78,13 @@ export * from './components/AddToCalendar';
|
|
|
78
78
|
export * from './components/Article';
|
|
79
79
|
export * from './components/Countdown';
|
|
80
80
|
export * from './components/Countdown/types';
|
|
81
|
+
export * from './components/DescriptiveRadioButton';
|
|
82
|
+
export * from './components/DescriptiveRadioButtonGroup';
|
|
81
83
|
export * from './components/Divider';
|
|
82
84
|
export * from './components/FavoritingTileButton';
|
|
83
85
|
export * from './components/Filter';
|
|
84
86
|
export * from './components/Icon';
|
|
87
|
+
export * from './components/NotificationBanner';
|
|
85
88
|
export * from './components/Pictogram';
|
|
86
89
|
export * from './components/TextArea';
|
|
87
90
|
export * from './components/Toast';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PaddingTokens as a, SpacingTokens as f, defaultYear as s, emailValidation as l, encodeURLSearchParams as d, findChildrenExcludingTypes as m, findChildrenOfType as p, focusElementById as u, generatePaddingClassName as i, getCommonProps as x, noOp as n, px as c, useNormalizedInputProps as g } from "./utils/index.js";
|
|
2
2
|
import { default as C } from "./pages/Page.js";
|
|
3
|
-
import { SSRMediaQuery as
|
|
3
|
+
import { SSRMediaQuery as B, ssrMediaQueryStyle as P } from "./providers/SeldonProvider/utils.js";
|
|
4
4
|
import { usePendingState as A } from "./utils/hooks.js";
|
|
5
5
|
import { AuctionStatus as V, LotStatus as b, SupportedLanguages as y } from "./types/commonTypes.js";
|
|
6
6
|
import { default as v } from "./components/Button/Button.js";
|
|
@@ -27,7 +27,7 @@ import { default as ie } from "./components/Detail/Detail.js";
|
|
|
27
27
|
import { default as ne } from "./components/Drawer/Drawer.js";
|
|
28
28
|
import { default as ge } from "./components/Dropdown/Dropdown.js";
|
|
29
29
|
import { default as Ce } from "./components/ErrorBoundary/ErrorBoundary.js";
|
|
30
|
-
import { default as
|
|
30
|
+
import { default as Be } from "./components/Grid/Grid.js";
|
|
31
31
|
import { default as Ie } from "./components/GridItem/GridItem.js";
|
|
32
32
|
import { GridItemAlign as Le } from "./components/GridItem/types.js";
|
|
33
33
|
import { default as be } from "./components/Input/Input.js";
|
|
@@ -53,7 +53,7 @@ import { default as pt } from "./components/Tabs/TabsContent.js";
|
|
|
53
53
|
import { Tag as it, default as xt } from "./components/Tags/Tags.js";
|
|
54
54
|
import { TextAlignments as ct, TextVariants as gt } from "./components/Text/types.js";
|
|
55
55
|
import { default as Ct } from "./components/Text/Text.js";
|
|
56
|
-
import { TextSymbolVariants as
|
|
56
|
+
import { TextSymbolVariants as Bt } from "./components/TextSymbol/types.js";
|
|
57
57
|
import { default as It } from "./components/TextSymbol/TextSymbol.js";
|
|
58
58
|
import { default as Lt } from "./components/Video/Video.js";
|
|
59
59
|
import { default as bt } from "./patterns/DetailList/DetailList.js";
|
|
@@ -79,7 +79,7 @@ import { default as uo } from "./components/PageContentWrapper/PageContentWrappe
|
|
|
79
79
|
import { default as xo } from "./components/PhoneNumberPicker/PhoneNumberPicker.js";
|
|
80
80
|
import { default as co } from "./patterns/FiltersInline/FiltersInline.js";
|
|
81
81
|
import { FilterButtonIconType as So, FilterButtonType as Co } from "./patterns/FiltersInline/types.js";
|
|
82
|
-
import { default as
|
|
82
|
+
import { default as Bo } from "./patterns/SaleCard/SaleCard.js";
|
|
83
83
|
import { SaleCardActions as Io } from "./patterns/SaleCard/SaleCardActions.js";
|
|
84
84
|
import { SaleCardVariants as Lo } from "./patterns/SaleCard/types.js";
|
|
85
85
|
import { default as bo } from "./patterns/ViewingDetails/ViewingDetails.js";
|
|
@@ -90,39 +90,40 @@ import { default as Ho } from "./components/AddToCalendar/AddToCalendar.js";
|
|
|
90
90
|
import { default as No } from "./components/Article/Article.js";
|
|
91
91
|
import { default as Go } from "./components/Countdown/Countdown.js";
|
|
92
92
|
import { CountdownVariants as Uo } from "./components/Countdown/types.js";
|
|
93
|
-
import { default as Qo } from "./components/
|
|
94
|
-
import { default as zo } from "./components/
|
|
95
|
-
import { default as Yo } from "./components/
|
|
96
|
-
import { default as qo } from "./components/
|
|
97
|
-
import { default as Ko } from "./components/Filter/
|
|
98
|
-
import { default as _o } from "./components/
|
|
99
|
-
import { default as er } from "./components/
|
|
100
|
-
import { default as or } from "./components/
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import { default as dr } from "./
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import { default as
|
|
108
|
-
import { default as
|
|
109
|
-
import {
|
|
110
|
-
import { default as Ar } from "./
|
|
111
|
-
import { default as Vr } from "./
|
|
93
|
+
import { default as Qo } from "./components/DescriptiveRadioButton/DescriptiveRadioButton.js";
|
|
94
|
+
import { default as zo } from "./components/DescriptiveRadioButtonGroup/DescriptiveRadioButtonGroup.js";
|
|
95
|
+
import { default as Yo } from "./components/Divider/Divider.js";
|
|
96
|
+
import { default as qo } from "./components/FavoritingTileButton/FavoritingTileButton.js";
|
|
97
|
+
import { default as Ko } from "./components/Filter/Filter.js";
|
|
98
|
+
import { default as _o } from "./components/Filter/FilterInput.js";
|
|
99
|
+
import { default as er } from "./components/Filter/FilterHeader.js";
|
|
100
|
+
import { default as or } from "./components/NotificationBanner/NotificationBanner.js";
|
|
101
|
+
import { default as ar } from "./components/Pictogram/Pictogram.js";
|
|
102
|
+
import { default as sr } from "./components/TextArea/TextArea.js";
|
|
103
|
+
import { default as dr } from "./components/Toast/Toast.js";
|
|
104
|
+
import { ToastProvider as pr } from "./components/Toast/ToastContextProvider.js";
|
|
105
|
+
import { useToast as ir } from "./components/Toast/useToast.js";
|
|
106
|
+
import { default as nr } from "./patterns/AccountPageHeader/AccountPageHeader.js";
|
|
107
|
+
import { default as gr } from "./patterns/BidSnapshot/BidSnapshot.js";
|
|
108
|
+
import { default as Cr } from "./patterns/BidSnapshot/BidMessage.js";
|
|
109
|
+
import { BidMessageVariants as Br, BidStatusEnum as Pr } from "./patterns/BidSnapshot/types.js";
|
|
110
|
+
import { default as Ar } from "./patterns/FilterMenu/FilterMenu.js";
|
|
111
|
+
import { default as Vr } from "./patterns/ObjectTile/ObjectTile.js";
|
|
112
|
+
import { default as yr } from "./patterns/CountryPicker/CountryPicker.js";
|
|
112
113
|
export {
|
|
113
114
|
M as Accordion,
|
|
114
115
|
E as AccordionItem,
|
|
115
116
|
R as AccordionItemVariant,
|
|
116
117
|
U as AccordionVariants,
|
|
117
|
-
|
|
118
|
+
nr as AccountPageHeader,
|
|
118
119
|
Ho as AddToCalendar,
|
|
119
120
|
No as Article,
|
|
120
121
|
V as AuctionStatus,
|
|
121
122
|
Yt as AuthState,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
Cr as BidMessage,
|
|
124
|
+
Br as BidMessageVariants,
|
|
125
|
+
gr as BidSnapshot,
|
|
126
|
+
Pr as BidStatusEnum,
|
|
126
127
|
Q as Breadcrumb,
|
|
127
128
|
v as Button,
|
|
128
129
|
w as ButtonVariants,
|
|
@@ -140,28 +141,28 @@ export {
|
|
|
140
141
|
pe as ContentPeekHeightUnits,
|
|
141
142
|
Go as Countdown,
|
|
142
143
|
Uo as CountdownVariants,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
yr as CountryPicker,
|
|
145
|
+
Qo as DescriptiveRadioButton,
|
|
146
|
+
zo as DescriptiveRadioButtonGroup,
|
|
146
147
|
ie as Detail,
|
|
147
148
|
bt as DetailList,
|
|
148
149
|
kt as DetailListAlignment,
|
|
149
|
-
|
|
150
|
+
Yo as Divider,
|
|
150
151
|
ne as Drawer,
|
|
151
152
|
ge as Dropdown,
|
|
152
153
|
Ce as ErrorBoundary,
|
|
153
154
|
so as ExitGateCard,
|
|
154
155
|
ht as FavoritesCollectionTile,
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
qo as FavoritingTileButton,
|
|
157
|
+
Ko as Filter,
|
|
157
158
|
So as FilterButtonIconType,
|
|
158
159
|
Co as FilterButtonType,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
er as FilterHeader,
|
|
161
|
+
_o as FilterInput,
|
|
162
|
+
Ar as FilterMenu,
|
|
162
163
|
co as FiltersInline,
|
|
163
164
|
ho as Footer,
|
|
164
|
-
|
|
165
|
+
Be as Grid,
|
|
165
166
|
Ie as GridItem,
|
|
166
167
|
Le as GridItemAlign,
|
|
167
168
|
Do as Header,
|
|
@@ -181,18 +182,19 @@ export {
|
|
|
181
182
|
Ue as NavigationItem,
|
|
182
183
|
Qe as NavigationItemTrigger,
|
|
183
184
|
ze as NavigationList,
|
|
184
|
-
|
|
185
|
+
or as NotificationBanner,
|
|
186
|
+
Vr as ObjectTile,
|
|
185
187
|
a as PaddingTokens,
|
|
186
188
|
C as Page,
|
|
187
189
|
uo as PageContentWrapper,
|
|
188
190
|
Ye as Pagination,
|
|
189
191
|
xo as PhoneNumberPicker,
|
|
190
|
-
|
|
192
|
+
ar as Pictogram,
|
|
191
193
|
qe as PinchZoom,
|
|
192
194
|
ko as ProgressIndicator,
|
|
193
195
|
Ke as Row,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
B as SSRMediaQuery,
|
|
197
|
+
Bo as SaleCard,
|
|
196
198
|
Io as SaleCardActions,
|
|
197
199
|
Lo as SaleCardVariants,
|
|
198
200
|
Nt as SaleHeaderBanner,
|
|
@@ -215,12 +217,12 @@ export {
|
|
|
215
217
|
xt as TagsList,
|
|
216
218
|
Ct as Text,
|
|
217
219
|
ct as TextAlignments,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
sr as TextArea,
|
|
221
|
+
Bt as TextSymbolVariants,
|
|
220
222
|
It as TextSymbols,
|
|
221
223
|
gt as TextVariants,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
dr as Toast,
|
|
225
|
+
pr as ToastProvider,
|
|
224
226
|
qt as UserManagement,
|
|
225
227
|
Lt as Video,
|
|
226
228
|
bo as ViewingDetails,
|
|
@@ -235,8 +237,8 @@ export {
|
|
|
235
237
|
x as getCommonProps,
|
|
236
238
|
n as noOp,
|
|
237
239
|
c as px,
|
|
238
|
-
|
|
240
|
+
P as ssrMediaQueryStyle,
|
|
239
241
|
g as useNormalizedInputProps,
|
|
240
242
|
A as usePendingState,
|
|
241
|
-
|
|
243
|
+
ir as useToast
|
|
242
244
|
};
|
package/dist/scss/_vars.scss
CHANGED
|
@@ -397,6 +397,7 @@ $margin-xxl: var(--spacing-xxl);
|
|
|
397
397
|
:root {
|
|
398
398
|
--header-height: 56px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
|
|
399
399
|
--search-size: 2.625rem; // This should be calculated from the scaling text and scaling spacing tokens instead of hardcoding in case they change
|
|
400
|
+
--banner-height: 0px;
|
|
400
401
|
|
|
401
402
|
@media (min-width: $breakpoint-md) {
|
|
402
403
|
--header-height: 123px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
|
|
@@ -418,6 +419,7 @@ $desktop-max-width: var(--desktop-max-width);
|
|
|
418
419
|
/// z-index TOKENS:
|
|
419
420
|
///////////////////////
|
|
420
421
|
$modal-z-index: 30;
|
|
422
|
+
$z-index-notification-banner: 1000;
|
|
421
423
|
|
|
422
424
|
////////////////////////
|
|
423
425
|
/// Our tokens usually support at least 4 sizes.
|
package/dist/scss/_vars.scss.js
CHANGED
|
@@ -397,6 +397,7 @@ $margin-xxl: var(--spacing-xxl);
|
|
|
397
397
|
:root {
|
|
398
398
|
--header-height: 56px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
|
|
399
399
|
--search-size: 2.625rem; // This should be calculated from the scaling text and scaling spacing tokens instead of hardcoding in case they change
|
|
400
|
+
--banner-height: 0px;
|
|
400
401
|
|
|
401
402
|
@media (min-width: $breakpoint-md) {
|
|
402
403
|
--header-height: 123px; // ideally we would calculate the size from the current text size plus spacing components so that it scales with the text size and spacing
|
|
@@ -418,6 +419,7 @@ $desktop-max-width: var(--desktop-max-width);
|
|
|
418
419
|
/// z-index TOKENS:
|
|
419
420
|
///////////////////////
|
|
420
421
|
$modal-z-index: 30;
|
|
422
|
+
$z-index-notification-banner: 1000;
|
|
421
423
|
|
|
422
424
|
////////////////////////
|
|
423
425
|
/// Our tokens usually support at least 4 sizes.
|
|
@@ -41,7 +41,10 @@
|
|
|
41
41
|
pointer-events: none;
|
|
42
42
|
position: fixed; // has to bust out of the box containing it on desktop
|
|
43
43
|
right: 0;
|
|
44
|
-
top: calc(
|
|
44
|
+
top: calc(
|
|
45
|
+
var(--banner-height) + #{$header-height} + 1px
|
|
46
|
+
); // will be dynamically set again when notification banner is shown
|
|
47
|
+
|
|
45
48
|
transition:
|
|
46
49
|
max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
47
50
|
opacity 0.2s cubic-bezier(0.65, 0, 0.35, 1);
|
|
@@ -56,7 +59,7 @@
|
|
|
56
59
|
&--hovered &__submenu {
|
|
57
60
|
cursor: default;
|
|
58
61
|
left: 0;
|
|
59
|
-
max-height: calc(90vh - #{$header-height});
|
|
62
|
+
max-height: calc(90vh - #{$header-height} + var(--banner-height));
|
|
60
63
|
opacity: 1;
|
|
61
64
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
62
65
|
overflow-y: scroll;
|
|
@@ -24,6 +24,10 @@ export interface HeaderProps extends ComponentProps<'header'> {
|
|
|
24
24
|
* Is the header disabled
|
|
25
25
|
*/
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Reference to the notification banner
|
|
29
|
+
*/
|
|
30
|
+
bannerRef?: React.MutableRefObject<HTMLDivElement | null>;
|
|
27
31
|
}
|
|
28
32
|
export type HeaderContextType = {
|
|
29
33
|
/**
|
|
@@ -1,88 +1,108 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { useMobileMenu as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import i from "../../node_modules/classnames/index.js";
|
|
3
|
+
import t, { createContext as k, forwardRef as q, useState as c, useEffect as B } from "react";
|
|
4
|
+
import Q from "../../components/Icon/Icon.js";
|
|
5
|
+
import b from "../../components/Navigation/Navigation.js";
|
|
6
|
+
import x from "../../patterns/LanguageSelector/LanguageSelector.js";
|
|
7
|
+
import C from "../../patterns/UserManagement/UserManagement.js";
|
|
8
|
+
import { SSRMediaQuery as U } from "../../providers/SeldonProvider/utils.js";
|
|
9
|
+
import { findChildrenOfType as m, findChildrenExcludingTypes as D, px as n } from "../../utils/index.js";
|
|
10
|
+
import { useMobileMenu as F } from "./hooks.js";
|
|
11
|
+
import { defaultHeaderContext as G } from "./utils.js";
|
|
12
|
+
const J = k(G), K = q(
|
|
13
13
|
({
|
|
14
|
-
logo:
|
|
15
|
-
logoHref:
|
|
16
|
-
className:
|
|
17
|
-
children:
|
|
18
|
-
toggleOpenText:
|
|
19
|
-
toggleCloseText:
|
|
20
|
-
logoText:
|
|
21
|
-
disabled:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
setIsSearchExpanded: N,
|
|
57
|
-
closeMenu: R
|
|
58
|
-
},
|
|
59
|
-
children: [
|
|
60
|
-
e.Children.map(
|
|
61
|
-
T,
|
|
62
|
-
(r) => e.isValidElement(r) ? e.cloneElement(r, {
|
|
14
|
+
logo: s = /* @__PURE__ */ r(Q, { icon: "PhillipsLogo" }),
|
|
15
|
+
logoHref: M = "/",
|
|
16
|
+
className: y,
|
|
17
|
+
children: a,
|
|
18
|
+
toggleOpenText: H = "Open Menu",
|
|
19
|
+
toggleCloseText: S = "Close Menu",
|
|
20
|
+
logoText: $ = "Home Page",
|
|
21
|
+
disabled: h,
|
|
22
|
+
bannerRef: o,
|
|
23
|
+
...N
|
|
24
|
+
}, O) => {
|
|
25
|
+
const u = m(a, C), T = t.isValidElement(u?.[0]) ? t.cloneElement(u[0], { disabled: h }) : "", g = m(a, x), p = t.isValidElement(g?.[0]) ? t.cloneElement(g[0], { disabled: h }) : "", [f, w] = c(!1), I = m(a, b), P = D(a, [b, C, x]), { closeMenu: j, handleMenuToggle: R, isMenuOpen: d, toggleText: V } = F({ toggleOpenText: H, toggleCloseText: S }), [z, A] = c(null), L = t.useRef(null), [_, v] = c(o?.current ? o.current.clientHeight : 0);
|
|
26
|
+
return B(() => {
|
|
27
|
+
const e = o?.current;
|
|
28
|
+
if (!e) return;
|
|
29
|
+
v(e.clientHeight);
|
|
30
|
+
const E = new window.ResizeObserver(() => {
|
|
31
|
+
v(e.clientHeight);
|
|
32
|
+
});
|
|
33
|
+
return E.observe(e), () => {
|
|
34
|
+
E.disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, [o, _]), /* @__PURE__ */ l(
|
|
37
|
+
"header",
|
|
38
|
+
{
|
|
39
|
+
...N,
|
|
40
|
+
className: i(`${n}-header`, y),
|
|
41
|
+
ref: O,
|
|
42
|
+
style: { "--banner-height": `${_}px` },
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ l("div", { className: `${n}-header__top-row`, children: [
|
|
45
|
+
/* @__PURE__ */ r(U.Media, { greaterThanOrEqual: "md", children: p }),
|
|
46
|
+
/* @__PURE__ */ l(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
"aria-label": V,
|
|
50
|
+
"data-testid": "mobile-menu-toggle",
|
|
51
|
+
type: "button",
|
|
52
|
+
onClick: R,
|
|
53
|
+
className: i(`${n}-header__toggle-btn`, {
|
|
54
|
+
[`${n}-header__toggle-btn--open`]: d
|
|
55
|
+
}),
|
|
63
56
|
children: [
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
/* @__PURE__ */ r("span", {}),
|
|
58
|
+
" "
|
|
66
59
|
]
|
|
67
|
-
}
|
|
60
|
+
}
|
|
68
61
|
),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
/* @__PURE__ */ r("h1", { "data-testid": "header-logo", className: `${n}-header__logo`, children: /* @__PURE__ */ r("a", { href: M, "aria-label": $, children: typeof s == "object" ? s : /* @__PURE__ */ r("img", { alt: "Phillips", "data-testid": "header-logo-img", src: s }) }) }),
|
|
63
|
+
T
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ r("div", { className: i(`${n}-header__nav`, { [`${n}-header__nav--closed`]: !d }), children: /* @__PURE__ */ l(
|
|
66
|
+
J.Provider,
|
|
67
|
+
{
|
|
68
|
+
value: {
|
|
69
|
+
activeSubmenuId: z,
|
|
70
|
+
setActiveSubmenuId: A,
|
|
71
|
+
closeTimeoutRef: L,
|
|
72
|
+
isMenuOpen: d,
|
|
73
|
+
isSearchExpanded: f,
|
|
74
|
+
setIsSearchExpanded: w,
|
|
75
|
+
closeMenu: j
|
|
76
|
+
},
|
|
77
|
+
children: [
|
|
78
|
+
t.Children.map(
|
|
79
|
+
I,
|
|
80
|
+
(e) => t.isValidElement(e) ? t.cloneElement(e, {
|
|
81
|
+
children: [
|
|
82
|
+
...t.Children.toArray(e.props.children),
|
|
83
|
+
p
|
|
84
|
+
]
|
|
85
|
+
}) : e
|
|
86
|
+
),
|
|
87
|
+
P
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ r(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: i(`${n}-header__overlay`, {
|
|
95
|
+
[`${n}-header__overlay--active`]: f
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
82
102
|
}
|
|
83
103
|
);
|
|
84
|
-
|
|
104
|
+
K.displayName = "Header";
|
|
85
105
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
106
|
+
J as HeaderContext,
|
|
107
|
+
K as default
|
|
88
108
|
};
|