@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.8 → 0.0.0-pr624.80
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 +1262 -81
- package/components/bibtemplate/dist/registered.js +1262 -81
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.html +16 -10
- package/components/checkbox/demo/api.md +49 -15
- package/components/checkbox/demo/api.min.js +73 -43
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.md +2 -2
- package/components/checkbox/demo/index.min.js +73 -43
- 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 +72 -42
- package/components/checkbox/dist/registered.js +72 -42
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.md +115 -8
- package/components/combobox/demo/api.min.js +3102 -921
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.md +6 -30
- package/components/combobox/demo/index.min.js +3102 -921
- package/components/combobox/demo/readme.html +16 -9
- package/components/combobox/dist/auro-combobox.d.ts +44 -12
- package/components/combobox/dist/index.js +3080 -995
- package/components/combobox/dist/registered.js +3080 -995
- package/components/counter/demo/api.html +17 -10
- package/components/counter/demo/api.md +158 -21
- package/components/counter/demo/api.min.js +3416 -728
- package/components/counter/demo/index.html +17 -10
- package/components/counter/demo/index.md +185 -34
- package/components/counter/demo/index.min.js +3416 -728
- 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 +161 -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 +3416 -728
- package/components/counter/dist/registered.js +3416 -728
- package/components/datepicker/README.md +1 -1
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/api.md +59 -28
- package/components/datepicker/demo/api.min.js +8486 -4644
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/index.md +75 -8
- package/components/datepicker/demo/index.min.js +8486 -4644
- package/components/datepicker/demo/readme.html +16 -9
- package/components/datepicker/demo/readme.md +1 -1
- package/components/datepicker/dist/auro-datepicker.d.ts +151 -12
- package/components/datepicker/dist/buttonVersion.d.ts +1 -1
- package/components/datepicker/dist/iconVersion.d.ts +2 -0
- package/components/datepicker/dist/index.js +7033 -3191
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +7033 -3191
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/api.md +82 -275
- package/components/dropdown/demo/api.min.js +451 -260
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/index.md +92 -362
- package/components/dropdown/demo/index.min.js +451 -260
- package/components/dropdown/demo/readme.html +16 -9
- package/components/dropdown/dist/auro-dropdown.d.ts +43 -83
- package/components/dropdown/dist/auro-dropdownBib.d.ts +14 -0
- package/components/dropdown/dist/index.js +450 -259
- package/components/dropdown/dist/registered.js +450 -259
- package/components/form/demo/api.html +16 -9
- package/components/form/demo/api.min.js +2 -2
- package/components/form/demo/autocomplete.html +19 -3
- package/components/form/demo/index.html +16 -9
- package/components/form/demo/index.min.js +2 -2
- 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 +909 -247
- package/components/input/demo/index.html +16 -10
- package/components/input/demo/index.md +48 -32
- package/components/input/demo/index.min.js +909 -247
- 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 +908 -246
- package/components/input/dist/registered.js +908 -246
- 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 +239 -48
- package/components/menu/demo/index.html +16 -10
- package/components/menu/demo/index.min.js +239 -48
- 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/color-menuoption-css.d.ts +2 -0
- package/components/menu/dist/styles/default/style-menu-css.d.ts +2 -0
- 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 +39 -9
- package/components/radio/demo/api.min.js +91 -93
- package/components/radio/demo/index.html +16 -10
- package/components/radio/demo/index.min.js +91 -93
- 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 +90 -92
- package/components/radio/dist/registered.js +90 -92
- package/components/select/demo/api.html +16 -10
- package/components/select/demo/api.js +0 -2
- package/components/select/demo/api.md +150 -121
- package/components/select/demo/api.min.js +2184 -704
- package/components/select/demo/index.html +17 -11
- package/components/select/demo/index.md +1066 -259
- package/components/select/demo/index.min.js +2186 -694
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +59 -21
- package/components/select/dist/index.js +2107 -711
- package/components/select/dist/registered.js +2107 -711
- package/package.json +31 -28
- /package/components/{datepicker/dist/styles/default/color-css.d.ts → counter/dist/styles/shapeSize-css.d.ts} +0 -0
- /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/classic}/color-css.d.ts +0 -0
- /package/components/datepicker/dist/styles/{emphasized → classic}/style-css.d.ts +0 -0
- /package/components/{dropdown/dist/styles/default/bibColors-css.d.ts → 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/bibStyles-css.d.ts → classic/bibColors-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/color-menu-css.d.ts → dropdown/dist/styles/classic/bibStyles-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/color-menuoption-css.d.ts → dropdown/dist/styles/classic/color-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/style-menu-css.d.ts → dropdown/dist/styles/classic/style-css.d.ts} +0 -0
- /package/components/{menu/dist/styles/style-menuoption-css.d.ts → dropdown/dist/styles/style-css.d.ts} +0 -0
- /package/components/menu/dist/styles/{tokens-css.d.ts → default/color-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.
|
|
@@ -130,7 +225,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
130
225
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
131
226
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
132
227
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
133
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
134
228
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
135
229
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
136
230
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -143,14 +237,17 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
143
237
|
* @slot - Slot for insertion of menu options.
|
|
144
238
|
*/
|
|
145
239
|
|
|
146
|
-
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
240
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens, no-inline-comments, line-comment-position */
|
|
147
241
|
|
|
148
|
-
class AuroMenu extends
|
|
242
|
+
class AuroMenu extends AuroElement$1 {
|
|
149
243
|
constructor() {
|
|
150
244
|
super();
|
|
151
245
|
|
|
152
246
|
// State properties (reactive)
|
|
153
247
|
|
|
248
|
+
this.shape = ""; // box, rounded, pill
|
|
249
|
+
this.size = ""; // md, lg, xl
|
|
250
|
+
|
|
154
251
|
// Value of the selected options
|
|
155
252
|
this.value = undefined;
|
|
156
253
|
// Currently selected option
|
|
@@ -209,6 +306,7 @@ class AuroMenu extends LitElement {
|
|
|
209
306
|
|
|
210
307
|
static get properties() {
|
|
211
308
|
return {
|
|
309
|
+
...super.properties,
|
|
212
310
|
noCheckmark: {
|
|
213
311
|
type: Boolean,
|
|
214
312
|
reflect: true,
|
|
@@ -239,9 +337,24 @@ class AuroMenu extends LitElement {
|
|
|
239
337
|
reflect: true,
|
|
240
338
|
attribute: 'multiselect'
|
|
241
339
|
},
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Value selected for the component.
|
|
343
|
+
*/
|
|
242
344
|
value: {
|
|
243
|
-
|
|
244
|
-
|
|
345
|
+
type: String,
|
|
346
|
+
reflect: true,
|
|
347
|
+
attribute: 'value'
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Indent level for submenus.
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
level: {
|
|
355
|
+
type: Number,
|
|
356
|
+
reflect: false,
|
|
357
|
+
attribute: false
|
|
245
358
|
}
|
|
246
359
|
};
|
|
247
360
|
}
|
|
@@ -266,6 +379,25 @@ class AuroMenu extends LitElement {
|
|
|
266
379
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
267
380
|
}
|
|
268
381
|
|
|
382
|
+
/**
|
|
383
|
+
* Formatted value based on `multiSelect` state.
|
|
384
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
385
|
+
* @private
|
|
386
|
+
* @returns {String|Array<String>}
|
|
387
|
+
*/
|
|
388
|
+
get formattedValue() {
|
|
389
|
+
if (this.multiSelect) {
|
|
390
|
+
if (!this.value) {
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
if (this.value.startsWith("[")) {
|
|
394
|
+
return JSON.parse(this.value);
|
|
395
|
+
}
|
|
396
|
+
return [this.value];
|
|
397
|
+
}
|
|
398
|
+
return this.value;
|
|
399
|
+
}
|
|
400
|
+
|
|
269
401
|
// Lifecycle Methods
|
|
270
402
|
|
|
271
403
|
connectedCallback() {
|
|
@@ -275,6 +407,7 @@ class AuroMenu extends LitElement {
|
|
|
275
407
|
this.addEventListener('mousedown', this.handleMouseSelect);
|
|
276
408
|
this.addEventListener('auroMenuOption-mouseover', this.handleOptionHover);
|
|
277
409
|
this.addEventListener('slotchange', this.handleSlotChange);
|
|
410
|
+
this.setTagAttribute("auro-menu");
|
|
278
411
|
}
|
|
279
412
|
|
|
280
413
|
disconnectedCallback() {
|
|
@@ -293,13 +426,27 @@ class AuroMenu extends LitElement {
|
|
|
293
426
|
this.initializeMenu();
|
|
294
427
|
}
|
|
295
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Sets an attribute that matches the default tag name if the tag name is not the default.
|
|
431
|
+
* @param {string} tagName - The tag name to set as an attribute.
|
|
432
|
+
* @private
|
|
433
|
+
*/
|
|
434
|
+
setTagAttribute(tagName) {
|
|
435
|
+
if (this.tagName.toLowerCase() !== tagName) {
|
|
436
|
+
this.setAttribute(tagName, true);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
296
440
|
updated(changedProperties) {
|
|
297
|
-
|
|
441
|
+
super.updated(changedProperties);
|
|
442
|
+
|
|
443
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
298
444
|
// Reset selection if multiSelect mode changes
|
|
299
445
|
this.clearSelection();
|
|
300
446
|
}
|
|
301
447
|
|
|
302
|
-
|
|
448
|
+
|
|
449
|
+
if (changedProperties.has("value")) {
|
|
303
450
|
// Handle null/undefined case
|
|
304
451
|
if (this.value === undefined || this.value === null) {
|
|
305
452
|
this.optionSelected = undefined;
|
|
@@ -307,7 +454,7 @@ class AuroMenu extends LitElement {
|
|
|
307
454
|
} else {
|
|
308
455
|
if (this.multiSelect) {
|
|
309
456
|
// In multiselect mode, this.value should be an array of strings
|
|
310
|
-
const valueArray =
|
|
457
|
+
const valueArray = this.formattedValue;
|
|
311
458
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
312
459
|
|
|
313
460
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -367,6 +514,19 @@ class AuroMenu extends LitElement {
|
|
|
367
514
|
this.querySelectorAll('auro-menu, [auro-menu], auro-menuoption, [auro-menuoption]').forEach((element) => element.setAttribute('noCheckmark', ''));
|
|
368
515
|
}
|
|
369
516
|
|
|
517
|
+
// Handle layout propagation to all menus and options
|
|
518
|
+
const propagationTargets = this.querySelectorAll('auro-menu, [auro-menu], auro-menuoption, [auro-menuoption]');
|
|
519
|
+
[
|
|
520
|
+
'size',
|
|
521
|
+
'shape'
|
|
522
|
+
].forEach((prop) => {
|
|
523
|
+
if (changedProperties.has(prop)) {
|
|
524
|
+
propagationTargets.forEach((el) => {
|
|
525
|
+
el.setAttribute(prop, this[prop]);
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
|
|
370
530
|
// Regex for matchWord if needed
|
|
371
531
|
let regexWord = null;
|
|
372
532
|
|
|
@@ -461,14 +621,14 @@ class AuroMenu extends LitElement {
|
|
|
461
621
|
*/
|
|
462
622
|
handleSelectState(option) {
|
|
463
623
|
if (this.multiSelect) {
|
|
464
|
-
const currentValue = this.
|
|
624
|
+
const currentValue = this.formattedValue || [];
|
|
465
625
|
const currentSelected = this.optionSelected || [];
|
|
466
626
|
|
|
467
627
|
if (!currentValue.includes(option.value)) {
|
|
468
|
-
this.value = [
|
|
628
|
+
this.value = JSON.stringify([
|
|
469
629
|
...currentValue,
|
|
470
630
|
option.value
|
|
471
|
-
];
|
|
631
|
+
]);
|
|
472
632
|
}
|
|
473
633
|
if (!currentSelected.includes(option)) {
|
|
474
634
|
this.optionSelected = [
|
|
@@ -491,13 +651,15 @@ class AuroMenu extends LitElement {
|
|
|
491
651
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
492
652
|
*/
|
|
493
653
|
handleDeselectState(option) {
|
|
494
|
-
if (this.multiSelect
|
|
654
|
+
if (this.multiSelect) {
|
|
495
655
|
// Remove this option from array
|
|
496
|
-
|
|
656
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
497
657
|
|
|
498
658
|
// If array is empty after removal, set back to undefined
|
|
499
|
-
if (
|
|
659
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
500
660
|
this.value = undefined;
|
|
661
|
+
} else {
|
|
662
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
501
663
|
}
|
|
502
664
|
|
|
503
665
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -563,21 +725,20 @@ class AuroMenu extends LitElement {
|
|
|
563
725
|
* @param {HTMLElement} menu - Root menu element.
|
|
564
726
|
*/
|
|
565
727
|
handleNestedMenus(menu) {
|
|
566
|
-
|
|
728
|
+
menu.level = menu.parentElement.level >= 0 ? menu.parentElement.level + 1 : 0;
|
|
567
729
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
if (!
|
|
572
|
-
|
|
730
|
+
if (menu.level > 0) {
|
|
731
|
+
menu.setAttribute('role', 'group');
|
|
732
|
+
menu.removeAttribute("root");
|
|
733
|
+
if (!menu.hasAttribute('aria-label')) {
|
|
734
|
+
menu.setAttribute('aria-label', 'submenu');
|
|
573
735
|
}
|
|
736
|
+
}
|
|
574
737
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
this.handleNestedMenus(nestedMenu);
|
|
738
|
+
const options = menu.querySelectorAll(':scope > auro-menuoption, :scope > [auro-menuoption]');
|
|
739
|
+
options.forEach((option) => {
|
|
740
|
+
const regex = new RegExp(this.nestingSpacer, "gu");
|
|
741
|
+
option.innerHTML = this.nestingSpacer.repeat(menu.level) + option.innerHTML.replace(regex, '');
|
|
581
742
|
});
|
|
582
743
|
}
|
|
583
744
|
|
|
@@ -819,28 +980,39 @@ class AuroMenu extends LitElement {
|
|
|
819
980
|
}
|
|
820
981
|
|
|
821
982
|
/**
|
|
822
|
-
*
|
|
823
|
-
* @
|
|
983
|
+
* Logic to determine the layout of the component.
|
|
984
|
+
* @protected
|
|
985
|
+
* @returns {void}
|
|
824
986
|
*/
|
|
825
|
-
|
|
987
|
+
renderLayout() {
|
|
826
988
|
if (this.loading) {
|
|
827
989
|
return html`
|
|
828
|
-
<
|
|
829
|
-
<
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
990
|
+
<div class="wrapper">
|
|
991
|
+
<auro-menuoption
|
|
992
|
+
disabled
|
|
993
|
+
loadingplaceholder
|
|
994
|
+
class="${this.hasLoadingPlaceholder ? "" : "empty"}"
|
|
995
|
+
>
|
|
996
|
+
<div>
|
|
997
|
+
<slot name="loadingIcon"></slot>
|
|
998
|
+
<slot name="loadingText"></slot>
|
|
999
|
+
</div>
|
|
1000
|
+
</auro-menuoption>
|
|
1001
|
+
</div>
|
|
834
1002
|
`;
|
|
835
1003
|
}
|
|
836
1004
|
|
|
837
|
-
return html
|
|
1005
|
+
return html`
|
|
1006
|
+
<div class="wrapper">
|
|
1007
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1008
|
+
</div>
|
|
1009
|
+
`;
|
|
838
1010
|
}
|
|
839
1011
|
}
|
|
840
1012
|
|
|
841
|
-
var styleCss$1 = css`:host{display:flex;align-items:center;padding:var(--ds-size-
|
|
1013
|
+
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}`;
|
|
842
1014
|
|
|
843
|
-
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)}`;
|
|
1015
|
+
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)}`;
|
|
844
1016
|
|
|
845
1017
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
846
1018
|
// See LICENSE in the project root for license information.
|
|
@@ -1228,8 +1400,12 @@ class AuroIcon extends BaseIcon {
|
|
|
1228
1400
|
async firstUpdated() {
|
|
1229
1401
|
await super.firstUpdated();
|
|
1230
1402
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1403
|
+
/**
|
|
1404
|
+
* icons provide a description for screen readers. Icon only instances Auro-button
|
|
1405
|
+
* depend on this description to provide context for the user using a screen reader.
|
|
1406
|
+
* Removes the SVG description for screen reader if ariaHidden is set to true.
|
|
1407
|
+
*/
|
|
1408
|
+
if (this.hasAttribute('ariaHidden') && this.svg) {
|
|
1233
1409
|
const svgDesc = this.svg.querySelector('desc');
|
|
1234
1410
|
|
|
1235
1411
|
if (svgDesc) {
|
|
@@ -1273,7 +1449,7 @@ class AuroIcon extends BaseIcon {
|
|
|
1273
1449
|
}
|
|
1274
1450
|
}
|
|
1275
1451
|
|
|
1276
|
-
var iconVersion = '8.0.
|
|
1452
|
+
var iconVersion = '8.0.4';
|
|
1277
1453
|
|
|
1278
1454
|
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>"};
|
|
1279
1455
|
|
|
@@ -1291,10 +1467,13 @@ var checkmarkIcon = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlin
|
|
|
1291
1467
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
1292
1468
|
* @slot - Specifies text for an option, but is not the value.
|
|
1293
1469
|
*/
|
|
1294
|
-
class AuroMenuOption extends
|
|
1470
|
+
class AuroMenuOption extends AuroElement$1 {
|
|
1295
1471
|
constructor() {
|
|
1296
1472
|
super();
|
|
1297
1473
|
|
|
1474
|
+
this.size = ""; // md, lg, xl
|
|
1475
|
+
this.shape = ""; // box, rounded, pill
|
|
1476
|
+
|
|
1298
1477
|
/**
|
|
1299
1478
|
* Generate unique names for dependency components.
|
|
1300
1479
|
*/
|
|
@@ -1318,6 +1497,7 @@ class AuroMenuOption extends LitElement {
|
|
|
1318
1497
|
|
|
1319
1498
|
static get properties() {
|
|
1320
1499
|
return {
|
|
1500
|
+
...super.properties,
|
|
1321
1501
|
nocheckmark: {
|
|
1322
1502
|
type: Boolean,
|
|
1323
1503
|
reflect: true
|
|
@@ -1379,6 +1559,8 @@ class AuroMenuOption extends LitElement {
|
|
|
1379
1559
|
|
|
1380
1560
|
// observer for selected property changes
|
|
1381
1561
|
updated(changedProperties) {
|
|
1562
|
+
super.updated(changedProperties);
|
|
1563
|
+
|
|
1382
1564
|
if (changedProperties.has('selected')) {
|
|
1383
1565
|
this.setAttribute('aria-selected', this.selected.toString());
|
|
1384
1566
|
}
|
|
@@ -1400,10 +1582,19 @@ class AuroMenuOption extends LitElement {
|
|
|
1400
1582
|
return html$1`<${this.iconTag} customColor customSvg slot="icon">${svg}</${this.iconTag}>`;
|
|
1401
1583
|
}
|
|
1402
1584
|
|
|
1403
|
-
|
|
1585
|
+
/**
|
|
1586
|
+
* Logic to determine the layout of the component.
|
|
1587
|
+
* @protected
|
|
1588
|
+
* @returns {void}
|
|
1589
|
+
*/
|
|
1590
|
+
renderLayout() {
|
|
1404
1591
|
return html$1`
|
|
1405
|
-
|
|
1406
|
-
|
|
1592
|
+
<div class="wrapper">
|
|
1593
|
+
${this.selected && !this.nocheckmark
|
|
1594
|
+
? this.generateIconHtml(checkmarkIcon.svg)
|
|
1595
|
+
: undefined}
|
|
1596
|
+
<slot></slot>
|
|
1597
|
+
</div>
|
|
1407
1598
|
`;
|
|
1408
1599
|
}
|
|
1409
1600
|
}
|
|
@@ -15,18 +15,24 @@
|
|
|
15
15
|
<head>
|
|
16
16
|
<meta charset="UTF-8" />
|
|
17
17
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
18
|
-
<title>Auro Web Component
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css"
|
|
25
|
-
|
|
18
|
+
<title>Auro Web Component Demo | auro-radio</title>
|
|
19
|
+
|
|
20
|
+
<!-- Prism.js Stylesheet -->
|
|
21
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"/>
|
|
22
|
+
|
|
23
|
+
<!-- Legacy reference is still needed to support auro-radio's use of legacy token values at this time -->
|
|
24
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
|
|
25
|
+
|
|
26
|
+
<!-- Design Token Alaska Theme -->
|
|
27
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
|
|
28
|
+
|
|
29
|
+
<!-- Webcore Stylesheet Alaska Theme -->
|
|
30
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
|
|
31
|
+
|
|
32
|
+
<!-- Demo Specific Styles -->
|
|
26
33
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
27
34
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
|
|
28
|
-
|
|
29
|
-
</head>
|
|
35
|
+
</head>
|
|
30
36
|
<body class="auro-markdown">
|
|
31
37
|
<main></main>
|
|
32
38
|
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
|
|
37
37
|
## Slots
|
|
38
38
|
|
|
39
|
-
| Name | Description
|
|
40
|
-
|
|
41
|
-
| [helpText](#helpText) | Allows for the helper text to be overridden.
|
|
42
|
-
| [legend](#legend) | Allows for the legend to be overridden.
|
|
43
|
-
| [optionalLabel](#optionalLabel) | Allows
|
|
39
|
+
| Name | Description |
|
|
40
|
+
|-----------------|--------------------------------------------------|
|
|
41
|
+
| [helpText](#helpText) | Allows for the helper text to be overridden. |
|
|
42
|
+
| [legend](#legend) | Allows for the legend to be overridden. |
|
|
43
|
+
| [optionalLabel](#optionalLabel) | Allows overriding the optional display text "(optional)", which appears next to the label. |
|
|
44
44
|
|
|
45
45
|
## CSS Shadow Parts
|
|
46
46
|
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
| [name](#name) | `name` | `string` | | |
|
|
63
63
|
| [onDark](#onDark) | `onDark` | `Boolean` | false | If set to true, the component will render with a dark theme. |
|
|
64
64
|
| [required](#required) | `required` | `Boolean` | false | Defines element as required. |
|
|
65
|
-
| [tabIndex](#tabIndex) | `tabIndex` | `number` | -1 | |
|
|
66
65
|
| [value](#value) | `value` | `string` | | |
|
|
67
66
|
|
|
68
67
|
## Methods
|
|
@@ -303,7 +302,7 @@ Use the `disabled` attribute to disable singular `<auro-radio>` elements or the
|
|
|
303
302
|
|
|
304
303
|
Use the `error` attribute to apply a persistent custom error that supersedes the HTML5 validation logic.
|
|
305
304
|
|
|
306
|
-
A custom error message can be set using the `error` attribute, or it can be used in
|
|
305
|
+
A custom error message can be set using the `error` attribute, or it can be used in conjunction with the `setCustomValidityCustomError` attribute.
|
|
307
306
|
|
|
308
307
|
<div class="exampleWrapper">
|
|
309
308
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/error.html) -->
|
|
@@ -545,6 +544,37 @@ export function dynamicExample() {
|
|
|
545
544
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
546
545
|
</auro-accordion>
|
|
547
546
|
|
|
547
|
+
## Multiline Label
|
|
548
|
+
|
|
549
|
+
Example to show text wrapping on multiline labels.
|
|
550
|
+
|
|
551
|
+
<div class="exampleWrapper">
|
|
552
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/multilineGroup.html) -->
|
|
553
|
+
<!-- The below content is automatically added from ./../apiExamples/multilineGroup.html -->
|
|
554
|
+
<auro-radio-group>
|
|
555
|
+
<span slot="legend">Form label goes here</span>
|
|
556
|
+
<auro-radio id="basicGroupRadio1" label="Sample text" name="radioDemo" value="option1"></auro-radio>
|
|
557
|
+
<auro-radio id="basicGroupRadio2" label="This text is long enough to wrap onto multiple lines. This text is long enough to wrap onto multiple lines. This text is long enough to wrap onto multiple lines. This text is long enough to wrap onto multiple lines." name="radioDemo" value="option2"></auro-radio>
|
|
558
|
+
<auro-radio id="basicGroupRadio3" label="Sample text" name="radioDemo" value="option3"></auro-radio>
|
|
559
|
+
</auro-radio-group>
|
|
560
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
561
|
+
</div>
|
|
562
|
+
<auro-accordion alignRight>
|
|
563
|
+
<span slot="trigger">See code</span>
|
|
564
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/multilineGroup.html) -->
|
|
565
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/multilineGroup.html -->
|
|
566
|
+
|
|
567
|
+
```html
|
|
568
|
+
<auro-radio-group>
|
|
569
|
+
<span slot="legend">Form label goes here</span>
|
|
570
|
+
<auro-radio id="basicGroupRadio1" label="Sample text" name="radioDemo" value="option1"></auro-radio>
|
|
571
|
+
<auro-radio id="basicGroupRadio2" label="This text is long enough to wrap onto multiple lines. This text is long enough to wrap onto multiple lines. This text is long enough to wrap onto multiple lines. This text is long enough to wrap onto multiple lines." name="radioDemo" value="option2"></auro-radio>
|
|
572
|
+
<auro-radio id="basicGroupRadio3" label="Sample text" name="radioDemo" value="option3"></auro-radio>
|
|
573
|
+
</auro-radio-group>
|
|
574
|
+
```
|
|
575
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
576
|
+
</auro-accordion>
|
|
577
|
+
|
|
548
578
|
## Theme Support
|
|
549
579
|
|
|
550
580
|
The component may be restyled using the following code sample and changing the values of the following token(s).
|
|
@@ -553,14 +583,14 @@ The component may be restyled using the following code sample and changing the v
|
|
|
553
583
|
<!-- The below code snippet is automatically added from ./../src/styles/tokens.scss -->
|
|
554
584
|
|
|
555
585
|
```scss
|
|
556
|
-
@
|
|
586
|
+
@use "@aurodesignsystem/design-tokens/dist/themes/alaska/SCSSVariables--alaska" as v;
|
|
557
587
|
|
|
558
588
|
:host {
|
|
559
589
|
// auro-radio-group colors
|
|
560
590
|
--ds-auro-radio-group-label-color: inherit;
|
|
561
591
|
|
|
562
592
|
// auro-radio colors
|
|
563
|
-
--ds-auro-radio-btn-border-color: var(--ds-basic-color-border-bold, #{
|
|
593
|
+
--ds-auro-radio-btn-border-color: var(--ds-basic-color-border-bold, #{v.$ds-basic-color-border-bold});
|
|
564
594
|
--ds-auro-radio-btn-fill-color: transparent;
|
|
565
595
|
--ds-auro-radio-btn-inset-color: transparent;
|
|
566
596
|
--ds-auro-radio-label-color: inherit;
|