@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.6 → 0.0.0-pr624.61
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/components/bibtemplate/dist/auro-bibtemplate.d.ts +12 -2
- package/components/bibtemplate/dist/buttonVersion.d.ts +2 -0
- package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
- package/components/bibtemplate/dist/index.js +1214 -83
- package/components/bibtemplate/dist/registered.js +1214 -83
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.html +16 -10
- package/components/checkbox/demo/api.md +47 -14
- package/components/checkbox/demo/api.min.js +65 -42
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.md +2 -2
- package/components/checkbox/demo/index.min.js +65 -42
- package/components/checkbox/demo/readme.html +16 -9
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/auro-checkbox-group.d.ts +1 -1
- package/components/checkbox/dist/auro-checkbox.d.ts +3 -3
- package/components/checkbox/dist/index.js +65 -42
- package/components/checkbox/dist/registered.js +65 -42
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.md +113 -8
- package/components/combobox/demo/api.min.js +3052 -926
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.md +6 -30
- package/components/combobox/demo/index.min.js +3052 -926
- package/components/combobox/demo/readme.html +16 -9
- package/components/combobox/dist/auro-combobox.d.ts +42 -8
- package/components/combobox/dist/index.js +2773 -743
- package/components/combobox/dist/registered.js +2773 -743
- package/components/counter/demo/api.html +17 -10
- package/components/counter/demo/api.md +156 -21
- package/components/counter/demo/api.min.js +6728 -4118
- package/components/counter/demo/index.html +17 -10
- package/components/counter/demo/index.md +185 -34
- package/components/counter/demo/index.min.js +6728 -4118
- package/components/counter/demo/readme.html +16 -9
- package/components/counter/dist/auro-counter-button.d.ts +2 -0
- package/components/counter/dist/auro-counter-group.d.ts +151 -11
- package/components/counter/dist/auro-counter.d.ts +16 -0
- package/components/counter/dist/helptextVersion.d.ts +2 -0
- package/components/counter/dist/iconVersion.d.ts +1 -1
- package/components/counter/dist/index.js +6728 -4118
- package/components/counter/dist/registered.js +6728 -4118
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/api.md +25 -16
- package/components/datepicker/demo/api.min.js +11540 -7985
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/index.md +71 -4
- package/components/datepicker/demo/index.min.js +11540 -7985
- package/components/datepicker/demo/readme.html +16 -9
- package/components/datepicker/dist/auro-datepicker.d.ts +89 -11
- package/components/datepicker/dist/buttonVersion.d.ts +1 -1
- package/components/datepicker/dist/iconVersion.d.ts +2 -0
- package/components/datepicker/dist/index.js +11603 -8048
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +11603 -8048
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/api.md +81 -274
- package/components/dropdown/demo/api.min.js +429 -195
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/index.md +92 -362
- package/components/dropdown/demo/index.min.js +429 -195
- package/components/dropdown/demo/readme.html +16 -9
- package/components/dropdown/dist/auro-dropdown.d.ts +41 -76
- package/components/dropdown/dist/auro-dropdownBib.d.ts +14 -0
- package/components/dropdown/dist/index.js +429 -195
- package/components/dropdown/dist/registered.js +429 -195
- package/components/form/demo/api.html +16 -9
- package/components/form/demo/api.min.js +1 -1
- package/components/form/demo/autocomplete.html +19 -3
- package/components/form/demo/index.html +16 -9
- package/components/form/demo/index.min.js +1 -1
- package/components/form/demo/readme.html +16 -9
- package/components/form/demo/working.html +19 -13
- package/components/form/dist/index.js +1 -1
- package/components/form/dist/registered.js +1 -1
- package/components/helptext/dist/index.js +2 -2
- package/components/helptext/dist/registered.js +2 -2
- package/components/input/README.md +5 -2
- package/components/input/demo/api.html +16 -10
- package/components/input/demo/api.md +228 -130
- package/components/input/demo/api.min.js +853 -241
- package/components/input/demo/index.html +16 -10
- package/components/input/demo/index.md +48 -32
- package/components/input/demo/index.min.js +853 -241
- package/components/input/demo/readme.html +16 -9
- package/components/input/demo/readme.md +5 -2
- package/components/input/dist/auro-input.d.ts +3 -3
- package/components/input/dist/base-input.d.ts +38 -10
- package/components/input/dist/buttonVersion.d.ts +1 -1
- package/components/input/dist/iconVersion.d.ts +1 -1
- package/components/input/dist/index.js +853 -241
- package/components/input/dist/registered.js +853 -241
- package/components/layoutElement/dist/index.js +13 -10
- package/components/menu/demo/api.html +32 -10
- package/components/menu/demo/api.md +69 -8
- package/components/menu/demo/api.min.js +238 -47
- package/components/menu/demo/index.html +16 -10
- package/components/menu/demo/index.min.js +238 -47
- package/components/menu/demo/readme.html +16 -9
- package/components/menu/dist/auro-menu.d.ts +41 -7
- package/components/menu/dist/auro-menuoption.d.ts +15 -3
- package/components/menu/dist/iconVersion.d.ts +1 -1
- package/components/menu/dist/index.js +238 -47
- package/components/menu/dist/registered.js +238 -47
- package/components/menu/dist/styles/default/style-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/default/tokens-css.d.ts +2 -0
- package/components/radio/demo/api.html +16 -10
- package/components/radio/demo/api.md +7 -8
- package/components/radio/demo/api.min.js +88 -90
- package/components/radio/demo/index.html +16 -10
- package/components/radio/demo/index.min.js +88 -90
- package/components/radio/demo/readme.html +16 -9
- package/components/radio/dist/auro-radio-group.d.ts +1 -1
- package/components/radio/dist/auro-radio.d.ts +9 -12
- package/components/radio/dist/index.js +88 -90
- package/components/radio/dist/registered.js +88 -90
- package/components/select/demo/api.html +16 -10
- package/components/select/demo/api.js +0 -2
- package/components/select/demo/api.md +104 -57
- package/components/select/demo/api.min.js +2123 -644
- package/components/select/demo/index.html +16 -11
- package/components/select/demo/index.md +45 -158
- package/components/select/demo/index.min.js +2123 -632
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +57 -16
- package/components/select/dist/index.js +2047 -652
- package/components/select/dist/registered.js +2047 -652
- package/package.json +29 -26
- /package/components/{datepicker/dist/styles/emphasized/style-css.d.ts → counter/dist/styles/shapeSize-css.d.ts} +0 -0
- /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/snowflake}/color-css.d.ts +0 -0
- /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/snowflake}/style-css.d.ts +0 -0
- /package/components/dropdown/dist/styles/{default → classic}/bibColors-css.d.ts +0 -0
- /package/components/dropdown/dist/styles/{default → classic}/bibStyles-css.d.ts +0 -0
- /package/components/{menu/dist/styles/color-menu-css.d.ts → dropdown/dist/styles/classic/color-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/color-menuoption-css.d.ts → dropdown/dist/styles/classic/style-css.d.ts} +0 -0
- /package/components/menu/dist/styles/{style-menu-css.d.ts → default/color-menu-css.d.ts} +0 -0
- /package/components/menu/dist/styles/{style-menuoption-css.d.ts → default/color-menuoption-css.d.ts} +0 -0
- /package/components/menu/dist/styles/{tokens-css.d.ts → default/style-menu-css.d.ts} +0 -0
|
@@ -3,11 +3,106 @@ import { unsafeStatic, literal, html as html$1 } from 'lit/static-html.js';
|
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
5
|
|
|
6
|
-
var styleCss$2 = css`:focus:not(:focus-visible){outline:3px solid transparent}:host{display:
|
|
6
|
+
var styleCss$2 = css`:focus:not(:focus-visible){outline:3px solid transparent}:host{display:block;vertical-align:middle}:host .wrapper{box-sizing:border-box;display:inline-block;width:100%;margin:0;padding:0}:host ::slotted(hr){box-sizing:content-box !important;height:0 !important;overflow:visible !important;margin:var(--ds-size-100, 0.5rem) 0 !important;border-width:0 !important;border-top-width:1px !important;border-top-style:solid !important}:host [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;line-height:1;display:inline-block}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]){overflow-y:auto}:host([root]) .wrapper[class*=-lg]{padding:var(--ds-size-150, 0.75rem)}:host([root]) .wrapper[class*=-xl]{padding:var(--ds-size-200, 1rem)}`;
|
|
7
7
|
|
|
8
8
|
var colorCss$2 = css`:host ::slotted(hr){border-top-color:var(--ds-auro-menu-divider-color)}[loadingplaceholder] slot[name=loadingIcon]{color:var(--ds-auro-menu-loader-color)}[loadingplaceholder] slot[name=loadingText]{color:var(--ds-auro-menu-loader-text-color)}`;
|
|
9
9
|
|
|
10
|
-
var tokensCss$1 = css`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-border-divider, rgba(0, 0, 0, 0.15));--ds-auro-menu-loader-color: var(--ds-basic-color-brand-primary, #01426a);--ds-auro-menu-loader-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-container-color: transparent;--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
10
|
+
var tokensCss$1 = css`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-border-divider, rgba(0, 0, 0, 0.15));--ds-auro-menu-loader-color: var(--ds-basic-color-brand-primary, #01426a);--ds-auro-menu-loader-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-container-color: transparent;--ds-auro-menuoption-container-border-color: var(--ds-auro-menuoption-container-color);--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
11
|
+
|
|
12
|
+
let AuroElement$1 = class AuroElement extends LitElement {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Defines the language of an element.
|
|
18
|
+
* @default {'default'}
|
|
19
|
+
*/
|
|
20
|
+
layout: {
|
|
21
|
+
type: String,
|
|
22
|
+
attribute: "layout",
|
|
23
|
+
reflect: true
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
shape: {
|
|
27
|
+
type: String,
|
|
28
|
+
attribute: "shape",
|
|
29
|
+
reflect: true
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
size: {
|
|
33
|
+
type: String,
|
|
34
|
+
attribute: "size",
|
|
35
|
+
reflect: true
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
onDark: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
attribute: "ondark",
|
|
41
|
+
reflect: true
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
resetShapeClasses() {
|
|
47
|
+
const wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
48
|
+
|
|
49
|
+
if (wrapper) {
|
|
50
|
+
wrapper.classList.forEach((className) => {
|
|
51
|
+
if (className.startsWith('shape-')) {
|
|
52
|
+
wrapper.classList.remove(className);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (this.shape && this.size) {
|
|
59
|
+
wrapper.classList.add(`shape-${this.shape.toLowerCase()}-${this.size.toLowerCase()}`);
|
|
60
|
+
} else {
|
|
61
|
+
wrapper.classList.add('shape-none');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
resetLayoutClasses() {
|
|
66
|
+
if (this.layout) {
|
|
67
|
+
const wrapper = this.shadowRoot.querySelector('.wrapper');
|
|
68
|
+
|
|
69
|
+
if (wrapper) {
|
|
70
|
+
wrapper.classList.forEach((className) => {
|
|
71
|
+
if (className.startsWith('layout-')) {
|
|
72
|
+
wrapper.classList.remove(className);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
wrapper.classList.add(`layout-${this.layout.toLowerCase()}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
updateComponentArchitecture() {
|
|
82
|
+
this.resetLayoutClasses();
|
|
83
|
+
this.resetShapeClasses();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
updated(changedProperties) {
|
|
87
|
+
if (changedProperties.has('layout') || changedProperties.has('shape') || changedProperties.has('size')) {
|
|
88
|
+
this.updateComponentArchitecture();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Try to render the defined `this.layout` layout. If that fails, fall back to the default layout.
|
|
93
|
+
// This will catch if an invalid layout value is passed in and render the default layout if so.
|
|
94
|
+
render() {
|
|
95
|
+
try {
|
|
96
|
+
return this.renderLayout();
|
|
97
|
+
} catch (error) {
|
|
98
|
+
// failed to get the defined layout
|
|
99
|
+
console.error('Failed to get the defined layout - using the default layout', error); // eslint-disable-line no-console
|
|
100
|
+
|
|
101
|
+
// fallback to the default layout
|
|
102
|
+
return this.getLayout('default');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
11
106
|
|
|
12
107
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
13
108
|
// See LICENSE in the project root for license information.
|
|
@@ -171,7 +266,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
171
266
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
172
267
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
173
268
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
174
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
175
269
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
176
270
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
177
271
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -184,14 +278,17 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
184
278
|
* @slot - Slot for insertion of menu options.
|
|
185
279
|
*/
|
|
186
280
|
|
|
187
|
-
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
281
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens, no-inline-comments, line-comment-position */
|
|
188
282
|
|
|
189
|
-
class AuroMenu extends
|
|
283
|
+
class AuroMenu extends AuroElement$1 {
|
|
190
284
|
constructor() {
|
|
191
285
|
super();
|
|
192
286
|
|
|
193
287
|
// State properties (reactive)
|
|
194
288
|
|
|
289
|
+
this.shape = ""; // box, rounded, pill
|
|
290
|
+
this.size = ""; // md, lg, xl
|
|
291
|
+
|
|
195
292
|
// Value of the selected options
|
|
196
293
|
this.value = undefined;
|
|
197
294
|
// Currently selected option
|
|
@@ -250,6 +347,7 @@ class AuroMenu extends LitElement {
|
|
|
250
347
|
|
|
251
348
|
static get properties() {
|
|
252
349
|
return {
|
|
350
|
+
...super.properties,
|
|
253
351
|
noCheckmark: {
|
|
254
352
|
type: Boolean,
|
|
255
353
|
reflect: true,
|
|
@@ -280,9 +378,24 @@ class AuroMenu extends LitElement {
|
|
|
280
378
|
reflect: true,
|
|
281
379
|
attribute: 'multiselect'
|
|
282
380
|
},
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Value selected for the component.
|
|
384
|
+
*/
|
|
283
385
|
value: {
|
|
284
|
-
|
|
285
|
-
|
|
386
|
+
type: String,
|
|
387
|
+
reflect: true,
|
|
388
|
+
attribute: 'value'
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Indent level for submenus.
|
|
393
|
+
* @private
|
|
394
|
+
*/
|
|
395
|
+
level: {
|
|
396
|
+
type: Number,
|
|
397
|
+
reflect: false,
|
|
398
|
+
attribute: false
|
|
286
399
|
}
|
|
287
400
|
};
|
|
288
401
|
}
|
|
@@ -307,6 +420,25 @@ class AuroMenu extends LitElement {
|
|
|
307
420
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
308
421
|
}
|
|
309
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Formatted value based on `multiSelect` state.
|
|
425
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
426
|
+
* @private
|
|
427
|
+
* @returns {String|Array<String>}
|
|
428
|
+
*/
|
|
429
|
+
get formattedValue() {
|
|
430
|
+
if (this.multiSelect) {
|
|
431
|
+
if (!this.value) {
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
if (this.value.startsWith("[")) {
|
|
435
|
+
return JSON.parse(this.value);
|
|
436
|
+
}
|
|
437
|
+
return [this.value];
|
|
438
|
+
}
|
|
439
|
+
return this.value;
|
|
440
|
+
}
|
|
441
|
+
|
|
310
442
|
// Lifecycle Methods
|
|
311
443
|
|
|
312
444
|
connectedCallback() {
|
|
@@ -316,6 +448,7 @@ class AuroMenu extends LitElement {
|
|
|
316
448
|
this.addEventListener('mousedown', this.handleMouseSelect);
|
|
317
449
|
this.addEventListener('auroMenuOption-mouseover', this.handleOptionHover);
|
|
318
450
|
this.addEventListener('slotchange', this.handleSlotChange);
|
|
451
|
+
this.setTagAttribute("auro-menu");
|
|
319
452
|
}
|
|
320
453
|
|
|
321
454
|
disconnectedCallback() {
|
|
@@ -334,13 +467,27 @@ class AuroMenu extends LitElement {
|
|
|
334
467
|
this.initializeMenu();
|
|
335
468
|
}
|
|
336
469
|
|
|
470
|
+
/**
|
|
471
|
+
* Sets an attribute that matches the default tag name if the tag name is not the default.
|
|
472
|
+
* @param {string} tagName - The tag name to set as an attribute.
|
|
473
|
+
* @private
|
|
474
|
+
*/
|
|
475
|
+
setTagAttribute(tagName) {
|
|
476
|
+
if (this.tagName.toLowerCase() !== tagName) {
|
|
477
|
+
this.setAttribute(tagName, true);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
337
481
|
updated(changedProperties) {
|
|
338
|
-
|
|
482
|
+
super.updated(changedProperties);
|
|
483
|
+
|
|
484
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
339
485
|
// Reset selection if multiSelect mode changes
|
|
340
486
|
this.clearSelection();
|
|
341
487
|
}
|
|
342
488
|
|
|
343
|
-
|
|
489
|
+
|
|
490
|
+
if (changedProperties.has("value")) {
|
|
344
491
|
// Handle null/undefined case
|
|
345
492
|
if (this.value === undefined || this.value === null) {
|
|
346
493
|
this.optionSelected = undefined;
|
|
@@ -348,7 +495,7 @@ class AuroMenu extends LitElement {
|
|
|
348
495
|
} else {
|
|
349
496
|
if (this.multiSelect) {
|
|
350
497
|
// In multiselect mode, this.value should be an array of strings
|
|
351
|
-
const valueArray =
|
|
498
|
+
const valueArray = this.formattedValue;
|
|
352
499
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
353
500
|
|
|
354
501
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -408,6 +555,19 @@ class AuroMenu extends LitElement {
|
|
|
408
555
|
this.querySelectorAll('auro-menu, [auro-menu], auro-menuoption, [auro-menuoption]').forEach((element) => element.setAttribute('noCheckmark', ''));
|
|
409
556
|
}
|
|
410
557
|
|
|
558
|
+
// Handle layout propagation to all menus and options
|
|
559
|
+
const propagationTargets = this.querySelectorAll('auro-menu, [auro-menu], auro-menuoption, [auro-menuoption]');
|
|
560
|
+
[
|
|
561
|
+
'size',
|
|
562
|
+
'shape'
|
|
563
|
+
].forEach((prop) => {
|
|
564
|
+
if (changedProperties.has(prop)) {
|
|
565
|
+
propagationTargets.forEach((el) => {
|
|
566
|
+
el.setAttribute(prop, this[prop]);
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
|
|
411
571
|
// Regex for matchWord if needed
|
|
412
572
|
let regexWord = null;
|
|
413
573
|
|
|
@@ -502,14 +662,14 @@ class AuroMenu extends LitElement {
|
|
|
502
662
|
*/
|
|
503
663
|
handleSelectState(option) {
|
|
504
664
|
if (this.multiSelect) {
|
|
505
|
-
const currentValue = this.
|
|
665
|
+
const currentValue = this.formattedValue || [];
|
|
506
666
|
const currentSelected = this.optionSelected || [];
|
|
507
667
|
|
|
508
668
|
if (!currentValue.includes(option.value)) {
|
|
509
|
-
this.value = [
|
|
669
|
+
this.value = JSON.stringify([
|
|
510
670
|
...currentValue,
|
|
511
671
|
option.value
|
|
512
|
-
];
|
|
672
|
+
]);
|
|
513
673
|
}
|
|
514
674
|
if (!currentSelected.includes(option)) {
|
|
515
675
|
this.optionSelected = [
|
|
@@ -532,13 +692,15 @@ class AuroMenu extends LitElement {
|
|
|
532
692
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
533
693
|
*/
|
|
534
694
|
handleDeselectState(option) {
|
|
535
|
-
if (this.multiSelect
|
|
695
|
+
if (this.multiSelect) {
|
|
536
696
|
// Remove this option from array
|
|
537
|
-
|
|
697
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
538
698
|
|
|
539
699
|
// If array is empty after removal, set back to undefined
|
|
540
|
-
if (
|
|
700
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
541
701
|
this.value = undefined;
|
|
702
|
+
} else {
|
|
703
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
542
704
|
}
|
|
543
705
|
|
|
544
706
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -604,21 +766,20 @@ class AuroMenu extends LitElement {
|
|
|
604
766
|
* @param {HTMLElement} menu - Root menu element.
|
|
605
767
|
*/
|
|
606
768
|
handleNestedMenus(menu) {
|
|
607
|
-
|
|
769
|
+
menu.level = menu.parentElement.level >= 0 ? menu.parentElement.level + 1 : 0;
|
|
608
770
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
if (!
|
|
613
|
-
|
|
771
|
+
if (menu.level > 0) {
|
|
772
|
+
menu.setAttribute('role', 'group');
|
|
773
|
+
menu.removeAttribute("root");
|
|
774
|
+
if (!menu.hasAttribute('aria-label')) {
|
|
775
|
+
menu.setAttribute('aria-label', 'submenu');
|
|
614
776
|
}
|
|
777
|
+
}
|
|
615
778
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
this.handleNestedMenus(nestedMenu);
|
|
779
|
+
const options = menu.querySelectorAll(':scope > auro-menuoption, :scope > [auro-menuoption]');
|
|
780
|
+
options.forEach((option) => {
|
|
781
|
+
const regex = new RegExp(this.nestingSpacer, "gu");
|
|
782
|
+
option.innerHTML = this.nestingSpacer.repeat(menu.level) + option.innerHTML.replace(regex, '');
|
|
622
783
|
});
|
|
623
784
|
}
|
|
624
785
|
|
|
@@ -860,28 +1021,39 @@ class AuroMenu extends LitElement {
|
|
|
860
1021
|
}
|
|
861
1022
|
|
|
862
1023
|
/**
|
|
863
|
-
*
|
|
864
|
-
* @
|
|
1024
|
+
* Logic to determine the layout of the component.
|
|
1025
|
+
* @protected
|
|
1026
|
+
* @returns {void}
|
|
865
1027
|
*/
|
|
866
|
-
|
|
1028
|
+
renderLayout() {
|
|
867
1029
|
if (this.loading) {
|
|
868
1030
|
return html`
|
|
869
|
-
<
|
|
870
|
-
<
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1031
|
+
<div class="wrapper">
|
|
1032
|
+
<auro-menuoption
|
|
1033
|
+
disabled
|
|
1034
|
+
loadingplaceholder
|
|
1035
|
+
class="${this.hasLoadingPlaceholder ? "" : "empty"}"
|
|
1036
|
+
>
|
|
1037
|
+
<div>
|
|
1038
|
+
<slot name="loadingIcon"></slot>
|
|
1039
|
+
<slot name="loadingText"></slot>
|
|
1040
|
+
</div>
|
|
1041
|
+
</auro-menuoption>
|
|
1042
|
+
</div>
|
|
875
1043
|
`;
|
|
876
1044
|
}
|
|
877
1045
|
|
|
878
|
-
return html
|
|
1046
|
+
return html`
|
|
1047
|
+
<div class="wrapper">
|
|
1048
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1049
|
+
</div>
|
|
1050
|
+
`;
|
|
879
1051
|
}
|
|
880
1052
|
}
|
|
881
1053
|
|
|
882
|
-
var styleCss$1 = css`:host{display:flex;align-items:center;padding:var(--ds-size-
|
|
1054
|
+
var styleCss$1 = css`:host{cursor:pointer;user-select:none}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box],:host .wrapper[class*=shape-snowflake]{border-radius:unset}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem)}:host .wrapper[class*=-lg]:not(:last-child){margin-bottom:var(--ds-size-50, 0.25rem)}:host .wrapper[class*=-xl]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem)}:host .wrapper[class*=-xl]:not(:last-child){margin-bottom:var(--ds-size-100, 0.5rem)}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}:host ::slotted(strong){font-weight:700}:host([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + var(--ds-size-300, 1.5rem) + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
883
1055
|
|
|
884
|
-
var colorCss$1 = css`:host{background-color:var(--ds-auro-menuoption-container-color);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected, #01426a);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([selected]):host(:hover),:host([selected]):host(.active){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected-hover, #00274a)}`;
|
|
1056
|
+
var colorCss$1 = css`:host .wrapper{border:1px solid var(--ds-auro-menuoption-container-border-color);background-color:var(--ds-auro-menuoption-container-color);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected, #01426a);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([selected]):host(:hover),:host([selected]):host(.active){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected-hover, #00274a)}`;
|
|
885
1057
|
|
|
886
1058
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
887
1059
|
// See LICENSE in the project root for license information.
|
|
@@ -1269,8 +1441,12 @@ class AuroIcon extends BaseIcon {
|
|
|
1269
1441
|
async firstUpdated() {
|
|
1270
1442
|
await super.firstUpdated();
|
|
1271
1443
|
|
|
1272
|
-
|
|
1273
|
-
|
|
1444
|
+
/**
|
|
1445
|
+
* icons provide a description for screen readers. Icon only instances Auro-button
|
|
1446
|
+
* depend on this description to provide context for the user using a screen reader.
|
|
1447
|
+
* Removes the SVG description for screen reader if ariaHidden is set to true.
|
|
1448
|
+
*/
|
|
1449
|
+
if (this.hasAttribute('ariaHidden') && this.svg) {
|
|
1274
1450
|
const svgDesc = this.svg.querySelector('desc');
|
|
1275
1451
|
|
|
1276
1452
|
if (svgDesc) {
|
|
@@ -1314,7 +1490,7 @@ class AuroIcon extends BaseIcon {
|
|
|
1314
1490
|
}
|
|
1315
1491
|
}
|
|
1316
1492
|
|
|
1317
|
-
var iconVersion = '8.0.
|
|
1493
|
+
var iconVersion = '8.0.4';
|
|
1318
1494
|
|
|
1319
1495
|
var checkmarkIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"checkmark-sm__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"checkmark-sm__desc\">a small check mark.</desc><path d=\"M8.461 11.84a.625.625 0 1 0-.922.844l2.504 2.738c.247.27.674.27.922 0l5.496-6a.625.625 0 1 0-.922-.844l-5.035 5.496z\"/></svg>"};
|
|
1320
1496
|
|
|
@@ -1332,10 +1508,13 @@ var checkmarkIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlin
|
|
|
1332
1508
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
1333
1509
|
* @slot - Specifies text for an option, but is not the value.
|
|
1334
1510
|
*/
|
|
1335
|
-
class AuroMenuOption extends
|
|
1511
|
+
class AuroMenuOption extends AuroElement$1 {
|
|
1336
1512
|
constructor() {
|
|
1337
1513
|
super();
|
|
1338
1514
|
|
|
1515
|
+
this.size = ""; // md, lg, xl
|
|
1516
|
+
this.shape = ""; // box, rounded, pill
|
|
1517
|
+
|
|
1339
1518
|
/**
|
|
1340
1519
|
* Generate unique names for dependency components.
|
|
1341
1520
|
*/
|
|
@@ -1359,6 +1538,7 @@ class AuroMenuOption extends LitElement {
|
|
|
1359
1538
|
|
|
1360
1539
|
static get properties() {
|
|
1361
1540
|
return {
|
|
1541
|
+
...super.properties,
|
|
1362
1542
|
nocheckmark: {
|
|
1363
1543
|
type: Boolean,
|
|
1364
1544
|
reflect: true
|
|
@@ -1420,6 +1600,8 @@ class AuroMenuOption extends LitElement {
|
|
|
1420
1600
|
|
|
1421
1601
|
// observer for selected property changes
|
|
1422
1602
|
updated(changedProperties) {
|
|
1603
|
+
super.updated(changedProperties);
|
|
1604
|
+
|
|
1423
1605
|
if (changedProperties.has('selected')) {
|
|
1424
1606
|
this.setAttribute('aria-selected', this.selected.toString());
|
|
1425
1607
|
}
|
|
@@ -1441,10 +1623,19 @@ class AuroMenuOption extends LitElement {
|
|
|
1441
1623
|
return html$1`<${this.iconTag} customColor customSvg slot="icon">${svg}</${this.iconTag}>`;
|
|
1442
1624
|
}
|
|
1443
1625
|
|
|
1444
|
-
|
|
1626
|
+
/**
|
|
1627
|
+
* Logic to determine the layout of the component.
|
|
1628
|
+
* @protected
|
|
1629
|
+
* @returns {void}
|
|
1630
|
+
*/
|
|
1631
|
+
renderLayout() {
|
|
1445
1632
|
return html$1`
|
|
1446
|
-
|
|
1447
|
-
|
|
1633
|
+
<div class="wrapper">
|
|
1634
|
+
${this.selected && !this.nocheckmark
|
|
1635
|
+
? this.generateIconHtml(checkmarkIcon.svg)
|
|
1636
|
+
: undefined}
|
|
1637
|
+
<slot></slot>
|
|
1638
|
+
</div>
|
|
1448
1639
|
`;
|
|
1449
1640
|
}
|
|
1450
1641
|
}
|