@spw-ds/spw-stencil-library 1.17.2 → 1.17.3-alpha.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/cem.json +167 -0
- package/dist/cjs/index-D3lyhQSW.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/spw-alert.cjs.entry.js +55 -0
- package/dist/cjs/spw-date-picker.cjs.entry.js +5 -2
- package/dist/cjs/spw-field-label_8.cjs.entry.js +8 -13
- package/dist/cjs/spw-header-lang.cjs.entry.js +14 -5
- package/dist/cjs/spw-header-navigation-item.cjs.entry.js +127 -2
- package/dist/cjs/spw-header-persona.cjs.entry.js +16 -7
- package/dist/cjs/spw-search-field.cjs.entry.js +1 -1
- package/dist/cjs/spw-stencil-library.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/spw-alert/spw-alert.css +446 -0
- package/dist/collection/components/spw-alert/spw-alert.js +202 -0
- package/dist/collection/components/spw-date-picker/spw-date-picker.js +5 -2
- package/dist/collection/components/spw-group/spw-group.js +8 -13
- package/dist/collection/components/spw-header/spw-header-lang/spw-header-lang.js +14 -5
- package/dist/collection/components/spw-header/spw-header-navigation-item/spw-header-navigation-item.css +8 -8
- package/dist/collection/components/spw-header/spw-header-navigation-item/spw-header-navigation-item.js +128 -2
- package/dist/collection/components/spw-header/spw-header-persona/spw-header-persona.css +9 -5
- package/dist/collection/components/spw-header/spw-header-persona/spw-header-persona.js +15 -6
- package/dist/collection/components/spw-search-field/spw-search-field.css +3 -1
- package/dist/components/spw-alert.d.ts +11 -0
- package/dist/components/spw-alert.js +1 -0
- package/dist/components/spw-date-picker.js +1 -1
- package/dist/components/spw-group.js +1 -1
- package/dist/components/spw-header-lang.js +1 -1
- package/dist/components/spw-header-navigation-item.js +1 -1
- package/dist/components/spw-header-persona.js +1 -1
- package/dist/components/spw-search-field.js +1 -1
- package/dist/components_json.json +223 -2
- package/dist/components_vscode.json +25 -0
- package/dist/esm/index-DkNryMko.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/spw-alert.entry.js +53 -0
- package/dist/esm/spw-date-picker.entry.js +5 -2
- package/dist/esm/spw-field-label_8.entry.js +8 -13
- package/dist/esm/spw-header-lang.entry.js +14 -5
- package/dist/esm/spw-header-navigation-item.entry.js +127 -2
- package/dist/esm/spw-header-persona.entry.js +16 -7
- package/dist/esm/spw-search-field.entry.js +1 -1
- package/dist/esm/spw-stencil-library.js +1 -1
- package/dist/spw-stencil-library/p-00c70684.entry.js +1 -0
- package/dist/spw-stencil-library/p-0bf3f71f.entry.js +1 -0
- package/dist/spw-stencil-library/{p-6cfcab87.entry.js → p-1fdace00.entry.js} +1 -1
- package/dist/spw-stencil-library/p-550df37a.entry.js +1 -0
- package/dist/spw-stencil-library/p-7807d0c0.entry.js +1 -0
- package/dist/spw-stencil-library/p-7ab7181d.entry.js +1 -0
- package/dist/spw-stencil-library/{p-d38ec8b1.entry.js → p-d1917f78.entry.js} +1 -1
- package/dist/spw-stencil-library/spw-stencil-library.esm.js +1 -1
- package/dist/stats.json +639 -55
- package/dist/types/components/spw-alert/spw-alert.d.ts +31 -0
- package/dist/types/components/spw-group/spw-group.d.ts +2 -0
- package/dist/types/components/spw-header/spw-header-lang/spw-header-lang.d.ts +1 -0
- package/dist/types/components/spw-header/spw-header-navigation-item/spw-header-navigation-item.d.ts +14 -0
- package/dist/types/components/spw-header/spw-header-persona/spw-header-persona.d.ts +1 -0
- package/dist/types/components.d.ts +84 -0
- package/hydrate/index.js +241 -31
- package/hydrate/index.mjs +241 -31
- package/package.json +1 -1
- package/dist/spw-stencil-library/p-0043c2f4.entry.js +0 -1
- package/dist/spw-stencil-library/p-7e2bf8ad.entry.js +0 -1
- package/dist/spw-stencil-library/p-8a8faafd.entry.js +0 -1
- package/dist/spw-stencil-library/p-feca6945.entry.js +0 -1
|
@@ -50,20 +50,14 @@ export class SpwGroup {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
get hostUserClasses() {
|
|
54
|
+
return Array.from(this.el.classList)
|
|
55
|
+
.filter(className => className !== 'hydrated' && !className.startsWith('spw-group'))
|
|
56
|
+
.reduce((classes, className) => (Object.assign(Object.assign({}, classes), { [className]: true })), {});
|
|
57
|
+
}
|
|
53
58
|
get groupClasses() {
|
|
54
|
-
return {
|
|
55
|
-
'spw-group': true,
|
|
56
|
-
'spw-group--horizontal': this.orientation === 'horizontal',
|
|
57
|
-
'spw-group--vertical': this.orientation === 'vertical',
|
|
58
|
-
'spw-group--reversed': this.isReversed,
|
|
59
|
-
'spw-group--disabled': this.disabled,
|
|
60
|
-
'spw-group--is-error': !!(this.error && this.isCheckboxOrRadio),
|
|
61
|
-
'spw-group--is-full-width': this.isFullWidth,
|
|
62
|
-
[`spw-group--${this.type}`]: true,
|
|
63
|
-
[`spw-group--align-${this.alignment}`]: true,
|
|
64
|
-
};
|
|
59
|
+
return Object.assign(Object.assign({}, this.hostUserClasses), { 'spw-group': true, 'spw-group--horizontal': this.orientation === 'horizontal', 'spw-group--vertical': this.orientation === 'vertical', 'spw-group--reversed': this.isReversed, 'spw-group--disabled': this.disabled, 'spw-group--is-error': !!(this.error && this.isCheckboxOrRadio), 'spw-group--is-full-width': this.isFullWidth, [`spw-group--${this.type}`]: true, [`spw-group--align-${this.alignment}`]: true });
|
|
65
60
|
}
|
|
66
|
-
// isExpandable (details slot) uniquement sur le dernier message affiché
|
|
67
61
|
renderMessages() {
|
|
68
62
|
if (!this.isCheckboxOrRadio)
|
|
69
63
|
return;
|
|
@@ -82,7 +76,7 @@ export class SpwGroup {
|
|
|
82
76
|
});
|
|
83
77
|
}
|
|
84
78
|
render() {
|
|
85
|
-
return (h(Host, { key: '
|
|
79
|
+
return (h(Host, { key: '8e723c566d057f2065d8413b39b18a5ea6e6cb10' }, h("div", { key: '116cc3248305bc69493158fed70416fbd17d4f00', class: this.groupClasses }, this.label && (h("spw-field-label", { key: '73f4eddaf6a03ae568683b689a065d7850f02f7e', class: "spw-group__field-label", label: this.label, name: this.name, required: this.required, tooltipTitle: this.tooltipTitle, tooltipText: this.tooltipText, tooltipMaxWidth: this.tooltipMaxWidth, tooltipDirection: this.tooltipDirection, tooltipCursor: this.tooltipCursor })), this.isCheckboxOrRadio && this.assistiveText && (h("spw-field-message", { key: '65019f86b9a9ab9fce90939e22819c231b47357e', class: "spw-group__field-message", variant: "hint", showIcon: false }, this.assistiveText)), h("div", { key: '5bbc7d3caf73910db8c94ec5aa2d4a239ec6f00e', class: "spw-group__container", style: { flexWrap: this.flexWrap } }, h("slot", { key: 'd5694afab8878b5f4e0cd7f97a603c7b331592a2', ref: el => (this.slotEl = el) })), this.renderMessages())));
|
|
86
80
|
}
|
|
87
81
|
static get is() { return "spw-group"; }
|
|
88
82
|
static get originalStyleUrls() {
|
|
@@ -551,6 +545,7 @@ export class SpwGroup {
|
|
|
551
545
|
}
|
|
552
546
|
};
|
|
553
547
|
}
|
|
548
|
+
static get elementRef() { return "el"; }
|
|
554
549
|
static get watchers() {
|
|
555
550
|
return [{
|
|
556
551
|
"propName": "error",
|
|
@@ -4,15 +4,13 @@ export class SpwHeaderLang {
|
|
|
4
4
|
this.activeLang = '';
|
|
5
5
|
this.options = [];
|
|
6
6
|
this.handleButtonKeyDown = (event) => {
|
|
7
|
-
var _a;
|
|
8
7
|
if (event.key === ' ' || event.key === 'Enter') {
|
|
9
8
|
event.preventDefault();
|
|
10
|
-
|
|
9
|
+
this.openSelect();
|
|
11
10
|
}
|
|
12
11
|
};
|
|
13
12
|
this.handleButtonClick = () => {
|
|
14
|
-
|
|
15
|
-
(_a = this.selectEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
13
|
+
this.openSelect();
|
|
16
14
|
};
|
|
17
15
|
this.handleOptionClick = (option) => {
|
|
18
16
|
this.setActiveLangAndRedirect(option);
|
|
@@ -48,8 +46,19 @@ export class SpwHeaderLang {
|
|
|
48
46
|
window.location.href = link;
|
|
49
47
|
}
|
|
50
48
|
}
|
|
49
|
+
openSelect() {
|
|
50
|
+
if (!this.selectEl) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof this.selectEl.showPicker === 'function') {
|
|
54
|
+
this.selectEl.showPicker();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.selectEl.click();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
51
60
|
render() {
|
|
52
|
-
return (h(Host, { key: '
|
|
61
|
+
return (h(Host, { key: '813de586237af395bdf05ae734618b6b61d176f9' }, h("div", { key: 'd40f0c056143cddd6b6246ef9e31759a29b8051e', class: "spw-header-lang" }, h("spw-button", { key: '9325ee9bac02011a3964022bd8084735b4f989e4', variant: "tertiary", surface: "light", icon: "fa-chevron-down", class: "spw-header-lang__active-lang", onKeyDown: this.handleButtonKeyDown, onClick: this.handleButtonClick }, this.activeLang), h("select", { key: '0d1b35a3a2767b7150cf8892b2b5f13e7722c880', "aria-label": this.accAriaLabel || 'Lang', class: "spw-header-lang__select", onChange: e => this.handleChange(e), ref: el => (this.selectEl = el), tabIndex: -1 }), h("ul", { key: '4c4450370618798e7cebff0cd8cac158f95bb029', class: "spw-header-lang__options" }, this.options.map(option => {
|
|
53
62
|
var _a;
|
|
54
63
|
const label = ((_a = option.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
55
64
|
const value = option.getAttribute('value') || '';
|
|
@@ -414,17 +414,17 @@ template {
|
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
@media (min-width: 1024px) {
|
|
417
|
-
:host([data-level="1"]) .spw-header-navigation-item:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="1"]) .spw-header-navigation-item
|
|
417
|
+
:host([data-level="1"]) .spw-header-navigation-item:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="1"]) .spw-header-navigation-item.spw-header-navigation-item--is-desktop-open ::slotted(spw-header-navigation-dropdown) {
|
|
418
418
|
pointer-events: auto;
|
|
419
419
|
opacity: 1;
|
|
420
420
|
top: 100%;
|
|
421
421
|
margin-left: 16px !important;
|
|
422
422
|
transition: opacity 0.1s ease-in;
|
|
423
423
|
}
|
|
424
|
-
:host([data-level="1"]) .spw-header-navigation-item:hover ::slotted(a), :host([data-level="1"]) .spw-header-navigation-item
|
|
424
|
+
:host([data-level="1"]) .spw-header-navigation-item:hover ::slotted(a), :host([data-level="1"]) .spw-header-navigation-item.spw-header-navigation-item--is-desktop-open ::slotted(a) {
|
|
425
425
|
color: var(--spw-ds-primary) !important;
|
|
426
426
|
}
|
|
427
|
-
:host([data-level="1"]) .spw-header-navigation-item:hover ::slotted(a):before, :host([data-level="1"]) .spw-header-navigation-item
|
|
427
|
+
:host([data-level="1"]) .spw-header-navigation-item:hover ::slotted(a):before, :host([data-level="1"]) .spw-header-navigation-item.spw-header-navigation-item--is-desktop-open ::slotted(a):before {
|
|
428
428
|
width: calc(100% - 32px);
|
|
429
429
|
height: 3px;
|
|
430
430
|
}
|
|
@@ -469,7 +469,7 @@ template {
|
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
@media (min-width: 1024px) {
|
|
472
|
-
:host([data-level="2"]) .spw-header-navigation-item:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="2"]) .spw-header-navigation-item
|
|
472
|
+
:host([data-level="2"]) .spw-header-navigation-item:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="2"]) .spw-header-navigation-item.spw-header-navigation-item--is-desktop-open ::slotted(spw-header-navigation-dropdown) {
|
|
473
473
|
pointer-events: auto;
|
|
474
474
|
opacity: 1;
|
|
475
475
|
left: 100%;
|
|
@@ -477,11 +477,11 @@ template {
|
|
|
477
477
|
transition: opacity 0.1s ease-in;
|
|
478
478
|
z-index: 38;
|
|
479
479
|
}
|
|
480
|
-
:host([data-level="2"]) .spw-header-navigation-item:hover ::slotted(a), :host([data-level="2"]) .spw-header-navigation-item
|
|
480
|
+
:host([data-level="2"]) .spw-header-navigation-item:hover ::slotted(a), :host([data-level="2"]) .spw-header-navigation-item.spw-header-navigation-item--is-desktop-open ::slotted(a) {
|
|
481
481
|
color: var(--spw-ds-primary) !important;
|
|
482
482
|
background: var(--spw-colors-support-grey-grey-100);
|
|
483
483
|
}
|
|
484
|
-
:host([data-level="2"]) .spw-header-navigation-item:hover ::slotted(a):before, :host([data-level="2"]) .spw-header-navigation-item
|
|
484
|
+
:host([data-level="2"]) .spw-header-navigation-item:hover ::slotted(a):before, :host([data-level="2"]) .spw-header-navigation-item.spw-header-navigation-item--is-desktop-open ::slotted(a):before {
|
|
485
485
|
display: none;
|
|
486
486
|
}
|
|
487
487
|
}
|
|
@@ -698,7 +698,7 @@ template {
|
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
700
|
@media (min-width: 1024px) {
|
|
701
|
-
:host([data-level="1"]) .spw-header-navigation-item--is-megamenu:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="1"]) .spw-header-navigation-item--is-megamenu
|
|
701
|
+
:host([data-level="1"]) .spw-header-navigation-item--is-megamenu:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="1"]) .spw-header-navigation-item--is-megamenu.spw-header-navigation-item--is-desktop-open ::slotted(spw-header-navigation-dropdown) {
|
|
702
702
|
margin-left: 0 !important;
|
|
703
703
|
pointer-events: auto;
|
|
704
704
|
}
|
|
@@ -732,7 +732,7 @@ template {
|
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
@media (min-width: 1024px) {
|
|
735
|
-
:host([data-level="2"]) .spw-header-navigation-item--is-megamenu:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="2"]) .spw-header-navigation-item--is-megamenu
|
|
735
|
+
:host([data-level="2"]) .spw-header-navigation-item--is-megamenu:hover ::slotted(spw-header-navigation-dropdown), :host([data-level="2"]) .spw-header-navigation-item--is-megamenu.spw-header-navigation-item--is-desktop-open ::slotted(spw-header-navigation-dropdown) {
|
|
736
736
|
position: relative;
|
|
737
737
|
left: 0;
|
|
738
738
|
}
|
|
@@ -11,6 +11,45 @@ export class SpwHeaderNavigationItem {
|
|
|
11
11
|
this.isSubnavVisible = false;
|
|
12
12
|
this.lastClickedLevel1Item = null;
|
|
13
13
|
this.isMobile = window.innerWidth < 1024;
|
|
14
|
+
this.isDesktopOpen = false;
|
|
15
|
+
this.handleDesktopKeyDown = (event) => {
|
|
16
|
+
if (this.isMobile || !this.hasSubnav || this.isInsideMegamenu())
|
|
17
|
+
return;
|
|
18
|
+
const ownLink = this.getOwnLink();
|
|
19
|
+
if (event.key === 'Enter' && !this.isDesktopOpen && event.target === ownLink) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
this.openDesktop();
|
|
22
|
+
}
|
|
23
|
+
else if (event.key === 'Escape' && this.isDesktopOpen) {
|
|
24
|
+
const target = event.target;
|
|
25
|
+
const isOwnLinkOrDirectChildLink = target === ownLink || this.getManagedLinks().includes(target);
|
|
26
|
+
if (isOwnLinkOrDirectChildLink) {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
this.closeDesktop(true);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.handleFocusOut = (event) => {
|
|
34
|
+
if (this.isMobile || !this.hasSubnav || this.isInsideMegamenu())
|
|
35
|
+
return;
|
|
36
|
+
const relatedTarget = event.relatedTarget;
|
|
37
|
+
if (!relatedTarget || !this.el.contains(relatedTarget)) {
|
|
38
|
+
this.closeDesktop(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.handleMouseEnter = () => {
|
|
42
|
+
if (this.isMobile || !this.hasSubnav || this.isInsideMegamenu())
|
|
43
|
+
return;
|
|
44
|
+
this.openDesktop();
|
|
45
|
+
};
|
|
46
|
+
this.handleMouseLeave = () => {
|
|
47
|
+
if (this.isMobile || !this.hasSubnav || this.isInsideMegamenu())
|
|
48
|
+
return;
|
|
49
|
+
if (this.el.matches(':focus-within'))
|
|
50
|
+
return;
|
|
51
|
+
this.closeDesktop(false);
|
|
52
|
+
};
|
|
14
53
|
}
|
|
15
54
|
componentWillLoad() {
|
|
16
55
|
this.internalIsActive = this.isActive;
|
|
@@ -36,6 +75,87 @@ export class SpwHeaderNavigationItem {
|
|
|
36
75
|
this.hasSubnav = hasSubnav;
|
|
37
76
|
}
|
|
38
77
|
}
|
|
78
|
+
this.syncFocusability();
|
|
79
|
+
}
|
|
80
|
+
isMegamenu() {
|
|
81
|
+
return this.variant === 'megamenu' && this.level === 1;
|
|
82
|
+
}
|
|
83
|
+
isInsideMegamenu() {
|
|
84
|
+
if (this.level === 1)
|
|
85
|
+
return false;
|
|
86
|
+
let parent = this.el.parentElement;
|
|
87
|
+
while (parent) {
|
|
88
|
+
if (parent.tagName === 'SPW-HEADER-NAVIGATION-ITEM' && parent.getAttribute('data-level') === '1') {
|
|
89
|
+
return parent.getAttribute('variant') === 'megamenu';
|
|
90
|
+
}
|
|
91
|
+
parent = parent.parentElement;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
getOwnLink() {
|
|
96
|
+
return this.el.querySelector(':scope > a');
|
|
97
|
+
}
|
|
98
|
+
getViewMoreLink(dropdown) {
|
|
99
|
+
var _a;
|
|
100
|
+
const shadowRoot = dropdown.shadowRoot;
|
|
101
|
+
return (_a = shadowRoot === null || shadowRoot === void 0 ? void 0 : shadowRoot.querySelector('spw-link')) !== null && _a !== void 0 ? _a : null;
|
|
102
|
+
}
|
|
103
|
+
getManagedLinks() {
|
|
104
|
+
if (!this.el.querySelector('spw-header-navigation-dropdown'))
|
|
105
|
+
return [];
|
|
106
|
+
if (this.isMegamenu()) {
|
|
107
|
+
const links = Array.from(this.el.querySelectorAll('spw-header-navigation-dropdown a'));
|
|
108
|
+
const dropdowns = Array.from(this.el.querySelectorAll('spw-header-navigation-dropdown'));
|
|
109
|
+
dropdowns.forEach(dropdown => {
|
|
110
|
+
const viewMore = this.getViewMoreLink(dropdown);
|
|
111
|
+
if (viewMore)
|
|
112
|
+
links.push(viewMore);
|
|
113
|
+
});
|
|
114
|
+
return links;
|
|
115
|
+
}
|
|
116
|
+
const dropdown = this.el.querySelector(':scope > spw-header-navigation-dropdown');
|
|
117
|
+
if (!dropdown)
|
|
118
|
+
return [];
|
|
119
|
+
const links = [];
|
|
120
|
+
Array.from(dropdown.children).forEach(child => {
|
|
121
|
+
if (child.tagName === 'SPW-HEADER-NAVIGATION-ITEM') {
|
|
122
|
+
const link = child.querySelector(':scope > a');
|
|
123
|
+
if (link)
|
|
124
|
+
links.push(link);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const viewMore = this.getViewMoreLink(dropdown);
|
|
128
|
+
if (viewMore)
|
|
129
|
+
links.push(viewMore);
|
|
130
|
+
return links;
|
|
131
|
+
}
|
|
132
|
+
syncFocusability() {
|
|
133
|
+
if (this.isMobile)
|
|
134
|
+
return;
|
|
135
|
+
this.getManagedLinks().forEach(link => {
|
|
136
|
+
if (this.isDesktopOpen) {
|
|
137
|
+
link.removeAttribute('tabindex');
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
link.setAttribute('tabindex', '-1');
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
openDesktop() {
|
|
145
|
+
if (this.isMobile || !this.el.querySelector('spw-header-navigation-dropdown'))
|
|
146
|
+
return;
|
|
147
|
+
this.isDesktopOpen = true;
|
|
148
|
+
this.syncFocusability();
|
|
149
|
+
}
|
|
150
|
+
closeDesktop(refocusOwnLink) {
|
|
151
|
+
var _a;
|
|
152
|
+
if (!this.isDesktopOpen)
|
|
153
|
+
return;
|
|
154
|
+
this.isDesktopOpen = false;
|
|
155
|
+
this.syncFocusability();
|
|
156
|
+
if (refocusOwnLink) {
|
|
157
|
+
(_a = this.getOwnLink()) === null || _a === void 0 ? void 0 : _a.focus();
|
|
158
|
+
}
|
|
39
159
|
}
|
|
40
160
|
calculateLevel() {
|
|
41
161
|
let level = 1;
|
|
@@ -151,6 +271,10 @@ export class SpwHeaderNavigationItem {
|
|
|
151
271
|
});
|
|
152
272
|
mutationObserver.observe(slot, { childList: true, subtree: true });
|
|
153
273
|
}
|
|
274
|
+
this.el.addEventListener('focusout', this.handleFocusOut);
|
|
275
|
+
}
|
|
276
|
+
disconnectedCallback() {
|
|
277
|
+
this.el.removeEventListener('focusout', this.handleFocusOut);
|
|
154
278
|
}
|
|
155
279
|
render() {
|
|
156
280
|
const pageTitle = this.getPageTitle();
|
|
@@ -161,8 +285,9 @@ export class SpwHeaderNavigationItem {
|
|
|
161
285
|
'spw-header-navigation-item--is-active': this.internalIsActive,
|
|
162
286
|
'spw-header-navigation-item--is-subnav-visible': this.isSubnavVisible,
|
|
163
287
|
'spw-header-navigation-item--is-megamenu': this.variant === 'megamenu',
|
|
288
|
+
'spw-header-navigation-item--is-desktop-open': this.isDesktopOpen,
|
|
164
289
|
};
|
|
165
|
-
return (h(Host, { key: '
|
|
290
|
+
return (h(Host, { key: '7a47eaa623fbb4ffaaf0f710a92e245c95aa53c6', "data-level": this.level }, h("div", { key: 'bd8106c8ba69ccc15742d16868c15bd7caedd0a2', class: elementClass, onKeyDown: this.handleDesktopKeyDown, onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("div", { key: 'ae7bda0d0ed78280a0a0ae9f21441605c45a56b9', class: "spw-header-navigation-item__content", onClick: event => this.toggleSubnavVisibility(event) }, this.isSubnavVisible && (h("div", { key: '0b6fa3115a8ade17c361d46c1ef3e745984c9865', class: `spw-header-navigation-item__top spw-header-navigation-item__top--${this.level}` }, h("div", { key: '70b76cae3997545f4836d5e9e3fb9ad2e09287dc', class: "spw-header-navigation-item__top-back", onClick: event => this.handleBackClick(event) }, h("spw-icon", { key: '2ebe9be3d4ae84d13221cfbd4abaa6470ebb32bf', icon: "fa-chevron-left" }), " ", h("span", { key: 'f69f17bf47233a7983d6fac66127936f51ada7df' }, this.level === 1 ? '' : this.level === 2 ? 'Menu principal' : storedTitle)), h("div", { key: '4064a6ebdb694ecf10900efba3efcb178dabb2bf', class: "spw-header-navigation-item__top-title" }, h("a", { key: '633ebe15619f8b1749c2c35525e1f51c0ff676fc', href: (pageTitle === null || pageTitle === void 0 ? void 0 : pageTitle.link) || '#', target: (pageTitle === null || pageTitle === void 0 ? void 0 : pageTitle.target) || '_self' }, (pageTitle === null || pageTitle === void 0 ? void 0 : pageTitle.title) || '')))), h("slot", { key: '302c088b314bd52cd98979af67dce472cdc98a86' })))));
|
|
166
291
|
}
|
|
167
292
|
static get is() { return "spw-header-navigation-item"; }
|
|
168
293
|
static get encapsulation() { return "shadow"; }
|
|
@@ -227,7 +352,8 @@ export class SpwHeaderNavigationItem {
|
|
|
227
352
|
"level": {},
|
|
228
353
|
"isSubnavVisible": {},
|
|
229
354
|
"lastClickedLevel1Item": {},
|
|
230
|
-
"isMobile": {}
|
|
355
|
+
"isMobile": {},
|
|
356
|
+
"isDesktopOpen": {}
|
|
231
357
|
};
|
|
232
358
|
}
|
|
233
359
|
static get events() {
|
|
@@ -386,6 +386,15 @@ template {
|
|
|
386
386
|
border-left: 1px solid var(--spw-colors-support-grey-grey-300);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
+
.spw-header-persona:focus-visible {
|
|
390
|
+
outline: none;
|
|
391
|
+
}
|
|
392
|
+
.spw-header-persona:focus-visible .spw-header-persona__active-persona {
|
|
393
|
+
outline: 3px solid white;
|
|
394
|
+
outline-offset: -1px;
|
|
395
|
+
box-shadow: 0 0 0 5px black;
|
|
396
|
+
border-radius: var(--spw-ds-border-radius-full);
|
|
397
|
+
}
|
|
389
398
|
.spw-header-persona__label {
|
|
390
399
|
font-size: 14px;
|
|
391
400
|
display: block;
|
|
@@ -420,11 +429,6 @@ template {
|
|
|
420
429
|
background: var(--spw-colors-support-grey-grey-300);
|
|
421
430
|
}
|
|
422
431
|
}
|
|
423
|
-
.spw-header-persona__active-persona:focus-visible {
|
|
424
|
-
outline: 2px solid var(--spw-ds-focus);
|
|
425
|
-
outline-offset: 2px;
|
|
426
|
-
border-radius: var(--spw-ds-border-radius-full);
|
|
427
|
-
}
|
|
428
432
|
.spw-header-persona__trigger {
|
|
429
433
|
display: block;
|
|
430
434
|
}
|
|
@@ -6,14 +6,12 @@ export class SpwHeaderPersona {
|
|
|
6
6
|
this.activePersona = '';
|
|
7
7
|
this.options = [];
|
|
8
8
|
this.handleButtonClick = () => {
|
|
9
|
-
|
|
10
|
-
(_a = this.selectEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
9
|
+
this.openSelect();
|
|
11
10
|
};
|
|
12
11
|
this.handleButtonKeyDown = (event) => {
|
|
13
|
-
var _a;
|
|
14
12
|
if (event.key === ' ' || event.key === 'Enter') {
|
|
15
13
|
event.preventDefault();
|
|
16
|
-
|
|
14
|
+
this.openSelect();
|
|
17
15
|
}
|
|
18
16
|
};
|
|
19
17
|
}
|
|
@@ -41,12 +39,23 @@ export class SpwHeaderPersona {
|
|
|
41
39
|
const selectedOption = select.selectedOptions[0];
|
|
42
40
|
this.activePersona = ((_a = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
43
41
|
const link = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.getAttribute('data-link');
|
|
44
|
-
if (link) {
|
|
42
|
+
if (link && link !== '#') {
|
|
45
43
|
window.location.href = link;
|
|
46
44
|
}
|
|
47
45
|
}
|
|
46
|
+
openSelect() {
|
|
47
|
+
if (!this.selectEl) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (typeof this.selectEl.showPicker === 'function') {
|
|
51
|
+
this.selectEl.showPicker();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.selectEl.click();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
48
57
|
render() {
|
|
49
|
-
return (h(Host, { key: '
|
|
58
|
+
return (h(Host, { key: '3f57dc62f05ccb31f1a35efa9ca41cbaeb1fa630' }, h("div", { key: '25d89e8a209421a1d77105cb853cc9aefaeb8913', class: "spw-header-persona", onClick: this.handleButtonClick, onKeyDown: this.handleButtonKeyDown, tabIndex: 0 }, h("span", { key: 'e365f8db45bb738ef92b7ff6c865dcdc683cd970', class: "spw-header-persona__label" }, this.personaLabel), h("div", { key: '6fb0485e32554b1b09c40bdcc552b1ed549c25c9', class: "spw-header-persona__active-persona" }, this.activePersona, " ", h("spw-icon", { key: '42b2730c44b36346fb0ee9e15590785db7208553', icon: "fa-chevron-down" })), h("select", { key: 'd9634f9542ffc050893f33fb30c177c58f560f91', "aria-label": this.accAriaLabel || this.personaLabel, class: "spw-header-persona__select", ref: el => (this.selectEl = el), onChange: e => this.handleChange(e), tabIndex: -1 }))));
|
|
50
59
|
}
|
|
51
60
|
static get is() { return "spw-header-persona"; }
|
|
52
61
|
static get encapsulation() { return "shadow"; }
|
|
@@ -362,6 +362,8 @@ template {
|
|
|
362
362
|
|
|
363
363
|
:host {
|
|
364
364
|
display: block;
|
|
365
|
+
/** @prop --spw-search-field-options-max-height: Hauteur maximale de la liste d'options avant scroll */
|
|
366
|
+
--spw-search-field-options-max-height: 200px;
|
|
365
367
|
}
|
|
366
368
|
|
|
367
369
|
.spw-search-field {
|
|
@@ -421,7 +423,7 @@ template {
|
|
|
421
423
|
background-color: #fff;
|
|
422
424
|
border: 1px solid var(--spw-color-themes-grey-grey-800);
|
|
423
425
|
border-radius: 0 0 4px 4px;
|
|
424
|
-
max-height:
|
|
426
|
+
max-height: var(--spw-search-field-options-max-height);
|
|
425
427
|
overflow-y: auto;
|
|
426
428
|
}
|
|
427
429
|
.spw-search-field__options::-webkit-scrollbar {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SpwAlert extends Components.SpwAlert, HTMLElement {}
|
|
4
|
+
export const SpwAlert: {
|
|
5
|
+
prototype: SpwAlert;
|
|
6
|
+
new (): SpwAlert;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as e,c as i,h as s,a as n,t as a}from"./index.js";import{d as o}from"./p-YvGDRmTV.js";import{d as r}from"./p-BG8eSnGj.js";const l=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.spwDismiss=i(this,"spwDismiss",7),this.isDismissable=!0,this.dismissableText="Masquer",this.alertTitle="Notification",this.isVisible=!0,this.hasSlotContent=!1,this.handleKeyDown=t=>{"Enter"===t.key&&(t.preventDefault(),this.handleDismiss())},this.handleDismiss=()=>{this.spwDismiss.emit({alertId:this.alertId}),this.isVisible=!1},this.handleSlotChange=()=>{if(this.slotElement){const t=this.slotElement.assignedNodes({flatten:!0});this.hasSlotContent=t.some((t=>{var e;return t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&""!==(null===(e=t.textContent)||void 0===e?void 0:e.trim())}))}}}async showAlert(){this.isVisible=!0}async hideAlert(){this.isVisible=!1}render(){return this.isVisible?s(n,null,s("div",{class:"spw-alert",role:"alert","aria-live":"polite","aria-label":this.alertTitle},s("div",{class:"spw-alert__container"},s("div",{class:"spw-alert__title-container"},s("strong",{class:"spw-alert__title"},this.alertTitle),this.isDismissable&&s("spw-link",{tabindex:"0",icon:"fa-close",class:"spw-alert__close","aria-label":this.dismissableText,onClick:this.handleDismiss,onKeyDown:this.handleKeyDown},s("span",{class:"spw-alert__close-text"},this.dismissableText))),s("div",{class:{"spw-alert__text":!0,"spw-alert__text--hidden":!this.hasSlotContent}},s("slot",{ref:t=>this.slotElement=t,onSlotchange:this.handleSlotChange}))))):null}get el(){return this}static get style(){return"html{line-height:1.3;-webkit-text-size-adjust:100%;}h1,h2,h3,h4,h5,h6,p,ul,li{padding:0;margin:0}ul{list-style:none}:host{box-sizing:border-box;line-height:1.3;-webkit-text-size-adjust:100%;font-size:100%}:host *,:host *::before,:host *::after{box-sizing:inherit;font-family:var(--spw-ds-font-main);letter-spacing:-0.18px}body{margin:0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0;}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px;}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}:root{--spw-ds-container-xl:1200px;--spw-ds-container-lg:1024px;--spw-ds-container-md:768px;--spw-ds-container-sm:640px}.spw-ds-container{width:100%;padding-left:16px;padding-right:16px;margin-left:auto;margin-right:auto}@media (min-width: 360px){.spw-ds-container{max-width:var(--spw-ds-container-sm)}}@media (min-width: 768px){.spw-ds-container{max-width:var(--spw-ds-container-md)}}@media (min-width: 1024px){.spw-ds-container{max-width:var(--spw-ds-container-lg)}}@media (min-width: 1200px){.spw-ds-container{max-width:var(--spw-ds-container-xl)}}:host{display:block;--spw-alert-font-size:14px;--spw-alert-background-color:var(--spw-ds-primary)}.spw-alert{width:100%;padding-top:24px;padding-bottom:24px;background:var(--spw-alert-background-color);color:var(--spw-ds-white);font-size:var(--spw-alert-font-size)}.spw-alert__container{display:flex;flex-direction:column;width:100%;padding-left:16px;padding-right:16px;margin-left:auto;margin-right:auto}@media (min-width: 360px){.spw-alert__container{max-width:var(--spw-ds-container-sm)}}@media (min-width: 768px){.spw-alert__container{max-width:var(--spw-ds-container-md)}}@media (min-width: 1024px){.spw-alert__container{max-width:var(--spw-ds-container-lg)}}@media (min-width: 1200px){.spw-alert__container{max-width:var(--spw-ds-container-xl)}}.spw-alert__title-container{display:flex;align-items:center;gap:16px;flex-wrap:nowrap;flex-direction:row;justify-content:space-between}.spw-alert__title{font-size:16px;flex:1;display:block}.spw-alert__text{color:var(--spw-ds-white);margin-top:12px;line-height:1.4}.spw-alert__text--hidden{display:none;margin-top:0}.spw-alert spw-link{font-size:14px;--spw-link-color:var(--spw-ds-white);--spw-link-hover-color:var(--spw-ds-white);--spw-link-active-color:var(--spw-ds-white);--spw-link-padding:8px}.spw-alert spw-link:focus-visible{outline:3px solid white;outline-offset:0;box-shadow:0 0 0 6px black}@media (max-width: 1023px){.spw-alert spw-link .spw-alert__close-text{display:none}}"}},[257,"spw-alert",{alertId:[1,"alert-id"],isDismissable:[4,"is-dismissable"],dismissableText:[1,"dismissable-text"],alertTitle:[1,"alert-title"],isVisible:[32],hasSlotContent:[32],showAlert:[64],hideAlert:[64]}]),p=l,d=function(){"undefined"!=typeof customElements&&["spw-alert","spw-icon","spw-link"].forEach((t=>{switch(t){case"spw-alert":customElements.get(a(t))||customElements.define(a(t),l);break;case"spw-icon":customElements.get(a(t))||o();break;case"spw-link":customElements.get(a(t))||r()}}))};export{p as SpwAlert,d as defineCustomElement}
|