@phillips/seldon 1.245.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/index10.js +2 -2
- package/dist/_virtual/index11.js +2 -2
- package/dist/_virtual/index6.js +5 -3
- package/dist/_virtual/index7.js +3 -5
- package/dist/_virtual/index8.js +2 -2
- package/dist/_virtual/index9.js +2 -2
- package/dist/assets/formatted/Search.js +8 -9
- package/dist/components/Accordion/Accordion.stories.d.ts +0 -1
- package/dist/components/Accordion/AccordionItem.d.ts +0 -5
- package/dist/components/Accordion/AccordionItem.js +66 -94
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Accordion/types.d.ts +0 -12
- package/dist/components/Accordion/types.js +1 -2
- package/dist/components/Accordion/utils.d.ts +2 -3
- package/dist/components/Accordion/utils.js +7 -9
- package/dist/components/AddToCalendar/calendarLinks.js +1 -1
- 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 +236 -233
- 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/index.js +1 -1
- package/dist/node_modules/ics/dist/pipeline/index.js +1 -1
- package/dist/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/react-transition-group/esm/CSSTransition.js +1 -1
- package/dist/node_modules/react-transition-group/esm/Transition.js +1 -1
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.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 -12
- 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
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 {
|
|
@@ -32,7 +32,22 @@
|
|
|
32
32
|
|
|
33
33
|
@include isHeaderDesktop {
|
|
34
34
|
flex-direction: row;
|
|
35
|
+
overflow: visible; // allow nav list to slide up/down when search opens/closes
|
|
35
36
|
padding-right: $search-size;
|
|
37
|
+
|
|
38
|
+
// When search is open, slide nav list up and fade out (transform so slide is visible; list keeps position relative)
|
|
39
|
+
&--search-expanded .#{$px}-nav__list {
|
|
40
|
+
opacity: 0;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
transform: translateY(-100%);
|
|
43
|
+
transition:
|
|
44
|
+
transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
45
|
+
opacity 0.2s cubic-bezier(0.65, 0, 0.35, 1);
|
|
46
|
+
|
|
47
|
+
@media (prefers-reduced-motion: reduce) {
|
|
48
|
+
transition: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
36
51
|
}
|
|
37
52
|
}
|
|
38
53
|
|
|
@@ -50,4 +65,98 @@
|
|
|
50
65
|
&__close-btn:focus {
|
|
51
66
|
background-color: $grey-50;
|
|
52
67
|
}
|
|
68
|
+
|
|
69
|
+
// Mobile: list has horizontal padding (original behaviour). Use descendant selector so it
|
|
70
|
+
// still applies when list is wrapped by SSRMediaQuery. Links and accordion labels get vertical padding.
|
|
71
|
+
@include isHeaderMobile {
|
|
72
|
+
&__list-container .#{$px}-nav__list {
|
|
73
|
+
padding: 0 $spacing-md;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__list-container .#{$px}-nav__list .#{$px}-link--linkStylised {
|
|
77
|
+
padding: $snowflake-menu-padding 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// linkMedium and linkLarge: same compact padding as linkLarge had (no snowflake padding)
|
|
81
|
+
&__list-container .#{$px}-nav__list .#{$px}-link--linkMedium,
|
|
82
|
+
&__list-container .#{$px}-nav__list .#{$px}-link--linkLarge {
|
|
83
|
+
padding: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__list-container .#{$px}-nav__list .#{$px}-accordion-item-label {
|
|
87
|
+
padding: $snowflake-menu-padding 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Radix Navigation Menu (desktop only) – viewport hosts submenu content
|
|
92
|
+
@include isHeaderDesktop {
|
|
93
|
+
&__radix-root {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
overflow: visible; // allow nav list to slide up/down when search opens/closes
|
|
97
|
+
position: relative;
|
|
98
|
+
|
|
99
|
+
// Keep fit-content so search button stays next to nav list (position: absolute relative to list-container)
|
|
100
|
+
width: fit-content;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__radix-viewport {
|
|
104
|
+
height: 0;
|
|
105
|
+
left: 0;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
pointer-events: none; // allow clicks to reach search when viewport is closed or when search is open
|
|
108
|
+
position: fixed;
|
|
109
|
+
right: 0;
|
|
110
|
+
top: calc(var(--banner-height, 0px) + var(--header-height));
|
|
111
|
+
transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
112
|
+
|
|
113
|
+
@media (prefers-reduced-motion: reduce) {
|
|
114
|
+
transition: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&[data-state='open'] {
|
|
118
|
+
animation: nav-viewport-enter 0.3s cubic-bezier(0.33, 1, 0.68, 1);
|
|
119
|
+
height: var(--radix-navigation-menu-viewport-height, auto);
|
|
120
|
+
pointer-events: auto; // submenu content must receive clicks when open
|
|
121
|
+
|
|
122
|
+
@media (prefers-reduced-motion: reduce) {
|
|
123
|
+
animation: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&[data-state='closed'] {
|
|
128
|
+
animation: nav-viewport-exit 0.2s cubic-bezier(0.65, 0, 0.35, 1);
|
|
129
|
+
|
|
130
|
+
@media (prefers-reduced-motion: reduce) {
|
|
131
|
+
animation: none;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@include isHeaderDesktop {
|
|
139
|
+
@keyframes nav-viewport-enter {
|
|
140
|
+
from {
|
|
141
|
+
opacity: 0;
|
|
142
|
+
transform: translateY(-16px);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
to {
|
|
146
|
+
opacity: 1;
|
|
147
|
+
transform: translateY(0);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@keyframes nav-viewport-exit {
|
|
152
|
+
from {
|
|
153
|
+
opacity: 1;
|
|
154
|
+
transform: translateY(0);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
to {
|
|
158
|
+
opacity: 0;
|
|
159
|
+
transform: translateY(-16px);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
53
162
|
}
|
|
@@ -11,6 +11,23 @@
|
|
|
11
11
|
width: 100%;
|
|
12
12
|
z-index: 10;
|
|
13
13
|
|
|
14
|
+
// Skip link: visually hidden until focused so keyboard users can skip to main content
|
|
15
|
+
&__skip-link {
|
|
16
|
+
left: -9999px;
|
|
17
|
+
position: absolute;
|
|
18
|
+
z-index: 100;
|
|
19
|
+
|
|
20
|
+
&:focus {
|
|
21
|
+
@include focus-ring($border-radius: $radius-xs);
|
|
22
|
+
|
|
23
|
+
background-color: $white-100;
|
|
24
|
+
box-shadow: 0 0 0 4px $white-100; // fills outline-offset gap so content behind doesn’t show through
|
|
25
|
+
left: $spacing-sm;
|
|
26
|
+
padding: $spacing-micro $spacing-sm;
|
|
27
|
+
top: $spacing-sm;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
&__toggle-btn {
|
|
15
32
|
align-items: center;
|
|
16
33
|
background: none;
|
|
@@ -74,13 +91,19 @@
|
|
|
74
91
|
|
|
75
92
|
&__logo {
|
|
76
93
|
align-self: center;
|
|
94
|
+
display: inline-block; // so focus ring has a clear box to wrap
|
|
77
95
|
margin: 0;
|
|
96
|
+
outline: none;
|
|
97
|
+
vertical-align: middle; // keep aligned with top-row flex items
|
|
78
98
|
|
|
99
|
+
&:focus,
|
|
79
100
|
&:focus-visible {
|
|
80
101
|
@include focus-ring($border-radius: $radius-xs);
|
|
81
102
|
}
|
|
82
103
|
|
|
104
|
+
img,
|
|
83
105
|
svg {
|
|
106
|
+
display: block; // avoid baseline gap so logo doesn’t slide up
|
|
84
107
|
height: 20.58px; // 20.58px is the height of the logo's container to make logo 16px
|
|
85
108
|
width: 100%;
|
|
86
109
|
}
|
|
@@ -88,6 +111,7 @@
|
|
|
88
111
|
@include isHeaderDesktop {
|
|
89
112
|
padding-top: 0;
|
|
90
113
|
|
|
114
|
+
img,
|
|
91
115
|
svg {
|
|
92
116
|
height: 25.73px; // 25.73px is the height of the logo's container to make logo 20px
|
|
93
117
|
width: 100%;
|
|
@@ -28,6 +28,14 @@ export interface HeaderProps extends ComponentProps<'header'> {
|
|
|
28
28
|
* Reference to the notification banner
|
|
29
29
|
*/
|
|
30
30
|
bannerRef?: React.MutableRefObject<HTMLDivElement | null>;
|
|
31
|
+
/**
|
|
32
|
+
* ID of the main content element for the skip link target (e.g. "main"). When set, a "Skip to main content" link is rendered for keyboard users.
|
|
33
|
+
*/
|
|
34
|
+
skipToContentId?: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Accessible label for the skip link. Defaults to "Skip to main content".
|
|
37
|
+
*/
|
|
38
|
+
skipLinkLabel?: string;
|
|
31
39
|
}
|
|
32
40
|
export type HeaderContextType = {
|
|
33
41
|
/**
|
|
@@ -54,10 +62,6 @@ export type HeaderContextType = {
|
|
|
54
62
|
* Set the active submenu ID
|
|
55
63
|
*/
|
|
56
64
|
setActiveSubmenuId: (id: string | null) => void;
|
|
57
|
-
/**
|
|
58
|
-
* Reference to timeout for submenu closing
|
|
59
|
-
*/
|
|
60
|
-
closeTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>;
|
|
61
65
|
};
|
|
62
66
|
export declare const HeaderContext: React.Context<HeaderContextType>;
|
|
63
67
|
/**
|
|
@@ -1,74 +1,80 @@
|
|
|
1
1
|
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import c from "../../_virtual/index.js";
|
|
3
|
-
import t, { createContext as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import t, { createContext as F, forwardRef as G, useState as h, useEffect as $ } from "react";
|
|
4
|
+
import J from "../../components/Icon/Icon.js";
|
|
5
|
+
import C from "../../components/Navigation/Navigation.js";
|
|
6
6
|
import M from "../../patterns/LanguageSelector/LanguageSelector.js";
|
|
7
|
-
import
|
|
8
|
-
import { SSRMediaQuery as
|
|
9
|
-
import { findChildrenOfType as
|
|
10
|
-
import { useMobileMenu as
|
|
11
|
-
import { defaultHeaderContext as
|
|
12
|
-
const
|
|
7
|
+
import S from "../../patterns/UserManagement/UserManagement.js";
|
|
8
|
+
import { SSRMediaQuery as K } from "../../providers/SeldonProvider/utils.js";
|
|
9
|
+
import { findChildrenOfType as u, findChildrenExcludingTypes as W, px as n } from "../../utils/index.js";
|
|
10
|
+
import { useMobileMenu as X } from "./hooks.js";
|
|
11
|
+
import { defaultHeaderContext as Y } from "./utils.js";
|
|
12
|
+
const Z = F(Y), ee = G(
|
|
13
13
|
({
|
|
14
|
-
logo: d = /* @__PURE__ */ r(
|
|
15
|
-
logoHref:
|
|
14
|
+
logo: d = /* @__PURE__ */ r(J, { icon: "PhillipsLogo" }),
|
|
15
|
+
logoHref: N = "/",
|
|
16
16
|
className: w,
|
|
17
|
-
children:
|
|
18
|
-
toggleOpenText:
|
|
19
|
-
toggleCloseText:
|
|
20
|
-
logoText:
|
|
17
|
+
children: i,
|
|
18
|
+
toggleOpenText: O = "Open Menu",
|
|
19
|
+
toggleCloseText: k = "Close Menu",
|
|
20
|
+
logoText: P = "Home Page",
|
|
21
21
|
disabled: g,
|
|
22
|
-
bannerRef:
|
|
23
|
-
|
|
22
|
+
bannerRef: s,
|
|
23
|
+
skipToContentId: p = "main",
|
|
24
|
+
skipLinkLabel: R = "Skip to main content",
|
|
25
|
+
...z
|
|
24
26
|
}, a) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const f = u(i, S), T = t.isValidElement(f?.[0]) ? t.cloneElement(f[0], { disabled: g }) : "", v = u(i, M), _ = t.isValidElement(v?.[0]) ? t.cloneElement(v[0], { disabled: g }) : "", [b, j] = h(!1), I = u(i, C), V = W(i, [C, S, M]), { closeMenu: A, handleMenuToggle: L, isMenuOpen: m, toggleText: q } = X({
|
|
28
|
+
toggleOpenText: O,
|
|
29
|
+
toggleCloseText: k
|
|
30
|
+
}), [B, Q] = h(null), [E, x] = h(s?.current ? s.current.clientHeight : 0), y = t.useRef(null);
|
|
31
|
+
$(() => {
|
|
32
|
+
const e = s?.current;
|
|
28
33
|
if (!e) return;
|
|
29
|
-
|
|
34
|
+
x(e.clientHeight);
|
|
30
35
|
const o = new window.ResizeObserver(() => {
|
|
31
|
-
|
|
36
|
+
x(e.clientHeight);
|
|
32
37
|
});
|
|
33
38
|
return o.observe(e), () => {
|
|
34
39
|
o.disconnect();
|
|
35
40
|
};
|
|
36
|
-
}, [
|
|
37
|
-
const e =
|
|
41
|
+
}, [s, E]), $(() => {
|
|
42
|
+
const e = y.current;
|
|
38
43
|
if (!e) return;
|
|
39
44
|
const o = () => {
|
|
40
|
-
const
|
|
41
|
-
document.documentElement.style.setProperty("--header-height", `${
|
|
45
|
+
const D = e.offsetHeight;
|
|
46
|
+
document.documentElement.style.setProperty("--header-height", `${D}px`);
|
|
42
47
|
};
|
|
43
48
|
o();
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
|
|
49
|
+
const H = new window.ResizeObserver(o);
|
|
50
|
+
return H.observe(e), () => {
|
|
51
|
+
H.disconnect();
|
|
47
52
|
};
|
|
48
53
|
}, []);
|
|
49
|
-
const
|
|
54
|
+
const U = t.useCallback(
|
|
50
55
|
(e) => {
|
|
51
|
-
|
|
56
|
+
y.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
|
|
52
57
|
},
|
|
53
58
|
[a]
|
|
54
59
|
);
|
|
55
60
|
return /* @__PURE__ */ l(
|
|
56
61
|
"header",
|
|
57
62
|
{
|
|
58
|
-
...
|
|
63
|
+
...z,
|
|
59
64
|
className: c(`${n}-header`, w),
|
|
60
|
-
ref:
|
|
61
|
-
style: { "--banner-height": `${
|
|
65
|
+
ref: U,
|
|
66
|
+
style: { "--banner-height": `${E}px` },
|
|
62
67
|
children: [
|
|
68
|
+
p && /* @__PURE__ */ r("a", { href: `#${p}`, className: `${n}-header__skip-link`, "data-testid": "skip-to-content", children: R }),
|
|
63
69
|
/* @__PURE__ */ l("div", { className: `${n}-header__top-row`, children: [
|
|
64
|
-
/* @__PURE__ */ r(
|
|
70
|
+
/* @__PURE__ */ r(K.Media, { greaterThanOrEqual: "md", children: _ }),
|
|
65
71
|
/* @__PURE__ */ l(
|
|
66
72
|
"button",
|
|
67
73
|
{
|
|
68
|
-
"aria-label":
|
|
74
|
+
"aria-label": q,
|
|
69
75
|
"data-testid": "mobile-menu-toggle",
|
|
70
76
|
type: "button",
|
|
71
|
-
onClick:
|
|
77
|
+
onClick: L,
|
|
72
78
|
className: c(`${n}-header__toggle-btn`, {
|
|
73
79
|
[`${n}-header__toggle-btn--open`]: m
|
|
74
80
|
}),
|
|
@@ -78,20 +84,19 @@ const Y = D(X), Z = F(
|
|
|
78
84
|
]
|
|
79
85
|
}
|
|
80
86
|
),
|
|
81
|
-
/* @__PURE__ */ r("a", { href:
|
|
82
|
-
|
|
87
|
+
/* @__PURE__ */ r("a", { href: N, "aria-label": P, "data-testid": "header-logo", className: `${n}-header__logo`, children: typeof d == "object" ? d : /* @__PURE__ */ r("img", { alt: "Phillips", "data-testid": "header-logo-img", src: d }) }),
|
|
88
|
+
T
|
|
83
89
|
] }),
|
|
84
90
|
/* @__PURE__ */ r("div", { className: c(`${n}-header__nav`, { [`${n}-header__nav--closed`]: !m }), children: /* @__PURE__ */ l(
|
|
85
|
-
|
|
91
|
+
Z.Provider,
|
|
86
92
|
{
|
|
87
93
|
value: {
|
|
88
|
-
activeSubmenuId:
|
|
89
|
-
setActiveSubmenuId:
|
|
90
|
-
closeTimeoutRef: B,
|
|
94
|
+
activeSubmenuId: B,
|
|
95
|
+
setActiveSubmenuId: Q,
|
|
91
96
|
isMenuOpen: m,
|
|
92
97
|
isSearchExpanded: b,
|
|
93
|
-
setIsSearchExpanded:
|
|
94
|
-
closeMenu:
|
|
98
|
+
setIsSearchExpanded: j,
|
|
99
|
+
closeMenu: A
|
|
95
100
|
},
|
|
96
101
|
children: [
|
|
97
102
|
t.Children.map(
|
|
@@ -99,11 +104,11 @@ const Y = D(X), Z = F(
|
|
|
99
104
|
(e) => t.isValidElement(e) ? t.cloneElement(e, {
|
|
100
105
|
children: [
|
|
101
106
|
...t.Children.toArray(e.props.children),
|
|
102
|
-
|
|
107
|
+
_
|
|
103
108
|
]
|
|
104
109
|
}) : e
|
|
105
110
|
),
|
|
106
|
-
|
|
111
|
+
V
|
|
107
112
|
]
|
|
108
113
|
}
|
|
109
114
|
) }),
|
|
@@ -120,8 +125,8 @@ const Y = D(X), Z = F(
|
|
|
120
125
|
);
|
|
121
126
|
}
|
|
122
127
|
);
|
|
123
|
-
|
|
128
|
+
ee.displayName = "Header";
|
|
124
129
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
Z as HeaderContext,
|
|
131
|
+
ee as default
|
|
127
132
|
};
|