@aurodesignsystem-dev/auro-formkit 0.0.0-pr741.0 → 0.0.0-pr750.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/components/bibtemplate/dist/index.js +1 -1
- package/components/bibtemplate/dist/registered.js +1 -1
- package/components/checkbox/demo/api.html +16 -10
- package/components/checkbox/demo/api.min.js +11 -11
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.min.js +11 -11
- package/components/checkbox/demo/readme.html +16 -9
- package/components/checkbox/dist/index.js +11 -11
- package/components/checkbox/dist/registered.js +11 -11
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.md +12 -6
- package/components/combobox/demo/api.min.js +411 -103
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.min.js +411 -103
- package/components/combobox/demo/readme.html +16 -9
- package/components/combobox/dist/index.js +374 -91
- package/components/combobox/dist/registered.js +374 -91
- package/components/counter/demo/api.html +16 -10
- package/components/counter/demo/api.md +140 -7
- package/components/counter/demo/api.min.js +1145 -987
- package/components/counter/demo/index.html +16 -10
- package/components/counter/demo/index.md +82 -0
- package/components/counter/demo/index.min.js +1145 -987
- package/components/counter/demo/readme.html +16 -9
- package/components/counter/dist/auro-counter-group.d.ts +64 -23
- package/components/counter/dist/auro-counter.d.ts +10 -0
- package/components/counter/dist/index.js +1145 -987
- package/components/counter/dist/registered.js +1145 -987
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/api.min.js +374 -91
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/index.min.js +374 -91
- package/components/datepicker/demo/readme.html +16 -9
- package/components/datepicker/dist/auro-datepicker.d.ts +6 -0
- package/components/datepicker/dist/index.js +374 -91
- package/components/datepicker/dist/registered.js +374 -91
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/api.md +77 -267
- package/components/dropdown/demo/api.min.js +331 -64
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/index.md +45 -363
- package/components/dropdown/demo/index.min.js +331 -64
- package/components/dropdown/demo/readme.html +16 -9
- package/components/dropdown/dist/auro-dropdown.d.ts +35 -67
- package/components/dropdown/dist/index.js +331 -64
- package/components/dropdown/dist/registered.js +331 -64
- package/components/form/demo/api.html +16 -9
- package/components/form/demo/autocomplete.html +19 -3
- package/components/form/demo/index.html +16 -9
- package/components/form/demo/readme.html +16 -9
- package/components/form/demo/working.html +19 -13
- package/components/helptext/dist/index.js +1 -1
- package/components/helptext/dist/registered.js +1 -1
- package/components/input/demo/api.html +16 -10
- package/components/input/demo/api.md +1 -1
- package/components/input/demo/api.min.js +14 -14
- package/components/input/demo/index.html +16 -10
- package/components/input/demo/index.min.js +14 -14
- package/components/input/demo/readme.html +16 -9
- package/components/input/dist/base-input.d.ts +1 -1
- package/components/input/dist/index.js +14 -14
- package/components/input/dist/registered.js +14 -14
- package/components/menu/demo/api.html +16 -32
- package/components/menu/demo/api.md +1 -1
- package/components/menu/demo/api.min.js +37 -12
- package/components/menu/demo/index.html +16 -10
- package/components/menu/demo/index.min.js +37 -12
- package/components/menu/demo/readme.html +16 -9
- package/components/menu/dist/auro-menu.d.ts +13 -2
- package/components/menu/dist/index.js +37 -12
- package/components/menu/dist/registered.js +37 -12
- package/components/radio/demo/api.html +16 -10
- package/components/radio/demo/api.md +0 -1
- package/components/radio/demo/api.min.js +61 -76
- package/components/radio/demo/index.html +16 -10
- package/components/radio/demo/index.min.js +61 -76
- package/components/radio/demo/readme.html +16 -9
- package/components/radio/dist/auro-radio.d.ts +8 -11
- package/components/radio/dist/index.js +61 -76
- package/components/radio/dist/registered.js +61 -76
- package/components/select/demo/api.html +16 -10
- package/components/select/demo/api.js +0 -2
- package/components/select/demo/api.md +53 -51
- package/components/select/demo/api.min.js +491 -326
- package/components/select/demo/index.html +16 -11
- package/components/select/demo/index.md +6 -158
- package/components/select/demo/index.min.js +491 -314
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +33 -8
- package/components/select/dist/index.js +454 -302
- package/components/select/dist/registered.js +454 -302
- package/package.json +26 -25
|
@@ -286,7 +286,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
286
286
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
287
287
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
288
288
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
289
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
290
289
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
291
290
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
292
291
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -399,9 +398,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
399
398
|
reflect: true,
|
|
400
399
|
attribute: 'multiselect'
|
|
401
400
|
},
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Value selected for the component.
|
|
404
|
+
*/
|
|
402
405
|
value: {
|
|
403
|
-
|
|
404
|
-
|
|
406
|
+
type: String,
|
|
407
|
+
reflect: true,
|
|
408
|
+
attribute: 'value'
|
|
405
409
|
},
|
|
406
410
|
|
|
407
411
|
/**
|
|
@@ -436,6 +440,25 @@ class AuroMenu extends AuroElement$1 {
|
|
|
436
440
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
437
441
|
}
|
|
438
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Formatted value based on `multiSelect` state.
|
|
445
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
446
|
+
* @private
|
|
447
|
+
* @returns {String|Array<String>}
|
|
448
|
+
*/
|
|
449
|
+
get formattedValue() {
|
|
450
|
+
if (this.multiSelect) {
|
|
451
|
+
if (!this.value) {
|
|
452
|
+
return undefined;
|
|
453
|
+
}
|
|
454
|
+
if (this.value.startsWith("[")) {
|
|
455
|
+
return JSON.parse(this.value);
|
|
456
|
+
}
|
|
457
|
+
return [this.value];
|
|
458
|
+
}
|
|
459
|
+
return this.value;
|
|
460
|
+
}
|
|
461
|
+
|
|
439
462
|
// Lifecycle Methods
|
|
440
463
|
|
|
441
464
|
connectedCallback() {
|
|
@@ -478,7 +501,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
478
501
|
updated(changedProperties) {
|
|
479
502
|
super.updated(changedProperties);
|
|
480
503
|
|
|
481
|
-
if (changedProperties.has('multiSelect')) {
|
|
504
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
482
505
|
// Reset selection if multiSelect mode changes
|
|
483
506
|
this.clearSelection();
|
|
484
507
|
}
|
|
@@ -492,7 +515,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
492
515
|
} else {
|
|
493
516
|
if (this.multiSelect) {
|
|
494
517
|
// In multiselect mode, this.value should be an array of strings
|
|
495
|
-
const valueArray =
|
|
518
|
+
const valueArray = this.formattedValue;
|
|
496
519
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
497
520
|
|
|
498
521
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -659,14 +682,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
659
682
|
*/
|
|
660
683
|
handleSelectState(option) {
|
|
661
684
|
if (this.multiSelect) {
|
|
662
|
-
const currentValue = this.
|
|
685
|
+
const currentValue = this.formattedValue || [];
|
|
663
686
|
const currentSelected = this.optionSelected || [];
|
|
664
687
|
|
|
665
688
|
if (!currentValue.includes(option.value)) {
|
|
666
|
-
this.value = [
|
|
689
|
+
this.value = JSON.stringify([
|
|
667
690
|
...currentValue,
|
|
668
691
|
option.value
|
|
669
|
-
];
|
|
692
|
+
]);
|
|
670
693
|
}
|
|
671
694
|
if (!currentSelected.includes(option)) {
|
|
672
695
|
this.optionSelected = [
|
|
@@ -689,13 +712,15 @@ class AuroMenu extends AuroElement$1 {
|
|
|
689
712
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
690
713
|
*/
|
|
691
714
|
handleDeselectState(option) {
|
|
692
|
-
if (this.multiSelect
|
|
715
|
+
if (this.multiSelect) {
|
|
693
716
|
// Remove this option from array
|
|
694
|
-
|
|
717
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
695
718
|
|
|
696
719
|
// If array is empty after removal, set back to undefined
|
|
697
|
-
if (
|
|
720
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
698
721
|
this.value = undefined;
|
|
722
|
+
} else {
|
|
723
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
699
724
|
}
|
|
700
725
|
|
|
701
726
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -1053,7 +1078,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
1053
1078
|
*/
|
|
1054
1079
|
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i$1=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$1(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
|
|
1055
1080
|
|
|
1056
|
-
var styleCss$1 = i$5`: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) +
|
|
1081
|
+
var styleCss$1 = i$5`: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-150, 0.75rem) + 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-150, 0.75rem) + 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}`;
|
|
1057
1082
|
|
|
1058
1083
|
var colorCss$1 = i$5`: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)}`;
|
|
1059
1084
|
|
|
@@ -16,18 +16,24 @@
|
|
|
16
16
|
<head>
|
|
17
17
|
<meta charset="UTF-8" />
|
|
18
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
19
|
-
<title>Auro Web Component
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css"
|
|
26
|
-
|
|
19
|
+
<title>Auro Web Component Demo | auro-menu</title>
|
|
20
|
+
|
|
21
|
+
<!-- Prism.js Stylesheet -->
|
|
22
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"/>
|
|
23
|
+
|
|
24
|
+
<!-- Legacy reference is still needed to support auro-menu's use of legacy token values at this time -->
|
|
25
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
|
|
26
|
+
|
|
27
|
+
<!-- Design Token Alaska Theme -->
|
|
28
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
|
|
29
|
+
|
|
30
|
+
<!-- Webcore Stylesheet Alaska Theme -->
|
|
31
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
|
|
32
|
+
|
|
33
|
+
<!-- Demo Specific Styles -->
|
|
27
34
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
28
35
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
|
|
29
|
-
|
|
30
|
-
</head>
|
|
36
|
+
</head>
|
|
31
37
|
<body class="auro-markdown">
|
|
32
38
|
<main></main>
|
|
33
39
|
|
|
@@ -246,7 +246,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
246
246
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
247
247
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
248
248
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
249
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
250
249
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
251
250
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
252
251
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -359,9 +358,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
359
358
|
reflect: true,
|
|
360
359
|
attribute: 'multiselect'
|
|
361
360
|
},
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Value selected for the component.
|
|
364
|
+
*/
|
|
362
365
|
value: {
|
|
363
|
-
|
|
364
|
-
|
|
366
|
+
type: String,
|
|
367
|
+
reflect: true,
|
|
368
|
+
attribute: 'value'
|
|
365
369
|
},
|
|
366
370
|
|
|
367
371
|
/**
|
|
@@ -396,6 +400,25 @@ class AuroMenu extends AuroElement$1 {
|
|
|
396
400
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
397
401
|
}
|
|
398
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Formatted value based on `multiSelect` state.
|
|
405
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
406
|
+
* @private
|
|
407
|
+
* @returns {String|Array<String>}
|
|
408
|
+
*/
|
|
409
|
+
get formattedValue() {
|
|
410
|
+
if (this.multiSelect) {
|
|
411
|
+
if (!this.value) {
|
|
412
|
+
return undefined;
|
|
413
|
+
}
|
|
414
|
+
if (this.value.startsWith("[")) {
|
|
415
|
+
return JSON.parse(this.value);
|
|
416
|
+
}
|
|
417
|
+
return [this.value];
|
|
418
|
+
}
|
|
419
|
+
return this.value;
|
|
420
|
+
}
|
|
421
|
+
|
|
399
422
|
// Lifecycle Methods
|
|
400
423
|
|
|
401
424
|
connectedCallback() {
|
|
@@ -438,7 +461,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
438
461
|
updated(changedProperties) {
|
|
439
462
|
super.updated(changedProperties);
|
|
440
463
|
|
|
441
|
-
if (changedProperties.has('multiSelect')) {
|
|
464
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
442
465
|
// Reset selection if multiSelect mode changes
|
|
443
466
|
this.clearSelection();
|
|
444
467
|
}
|
|
@@ -452,7 +475,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
452
475
|
} else {
|
|
453
476
|
if (this.multiSelect) {
|
|
454
477
|
// In multiselect mode, this.value should be an array of strings
|
|
455
|
-
const valueArray =
|
|
478
|
+
const valueArray = this.formattedValue;
|
|
456
479
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
457
480
|
|
|
458
481
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -619,14 +642,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
619
642
|
*/
|
|
620
643
|
handleSelectState(option) {
|
|
621
644
|
if (this.multiSelect) {
|
|
622
|
-
const currentValue = this.
|
|
645
|
+
const currentValue = this.formattedValue || [];
|
|
623
646
|
const currentSelected = this.optionSelected || [];
|
|
624
647
|
|
|
625
648
|
if (!currentValue.includes(option.value)) {
|
|
626
|
-
this.value = [
|
|
649
|
+
this.value = JSON.stringify([
|
|
627
650
|
...currentValue,
|
|
628
651
|
option.value
|
|
629
|
-
];
|
|
652
|
+
]);
|
|
630
653
|
}
|
|
631
654
|
if (!currentSelected.includes(option)) {
|
|
632
655
|
this.optionSelected = [
|
|
@@ -649,13 +672,15 @@ class AuroMenu extends AuroElement$1 {
|
|
|
649
672
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
650
673
|
*/
|
|
651
674
|
handleDeselectState(option) {
|
|
652
|
-
if (this.multiSelect
|
|
675
|
+
if (this.multiSelect) {
|
|
653
676
|
// Remove this option from array
|
|
654
|
-
|
|
677
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
655
678
|
|
|
656
679
|
// If array is empty after removal, set back to undefined
|
|
657
|
-
if (
|
|
680
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
658
681
|
this.value = undefined;
|
|
682
|
+
} else {
|
|
683
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
659
684
|
}
|
|
660
685
|
|
|
661
686
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -1013,7 +1038,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
1013
1038
|
*/
|
|
1014
1039
|
const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i$1=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$1(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
|
|
1015
1040
|
|
|
1016
|
-
var styleCss$1 = i$5`: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) +
|
|
1041
|
+
var styleCss$1 = i$5`: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-150, 0.75rem) + 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-150, 0.75rem) + 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}`;
|
|
1017
1042
|
|
|
1018
1043
|
var colorCss$1 = i$5`: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)}`;
|
|
1019
1044
|
|
|
@@ -16,17 +16,24 @@
|
|
|
16
16
|
<head>
|
|
17
17
|
<meta charset="UTF-8" />
|
|
18
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
19
|
-
<title>Auro Web Component
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css"
|
|
26
|
-
|
|
19
|
+
<title>Auro Web Component Demo | auro-menu</title>
|
|
20
|
+
|
|
21
|
+
<!-- Prism.js Stylesheet -->
|
|
22
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"/>
|
|
23
|
+
|
|
24
|
+
<!-- Legacy reference is still needed to support auro-menu's use of legacy token values at this time -->
|
|
25
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
|
|
26
|
+
|
|
27
|
+
<!-- Design Token Alaska Theme -->
|
|
28
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
|
|
29
|
+
|
|
30
|
+
<!-- Webcore Stylesheet Alaska Theme -->
|
|
31
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
|
|
32
|
+
|
|
33
|
+
<!-- Demo Specific Styles -->
|
|
27
34
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
28
35
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
|
|
29
|
-
|
|
36
|
+
</head>
|
|
30
37
|
<body class="auro-markdown">
|
|
31
38
|
<main></main>
|
|
32
39
|
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
8
8
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
9
9
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
10
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
11
10
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
12
11
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
13
12
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -50,8 +49,13 @@ export class AuroMenu extends AuroElement {
|
|
|
50
49
|
reflect: boolean;
|
|
51
50
|
attribute: string;
|
|
52
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Value selected for the component.
|
|
54
|
+
*/
|
|
53
55
|
value: {
|
|
54
|
-
type:
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
reflect: boolean;
|
|
58
|
+
attribute: string;
|
|
55
59
|
};
|
|
56
60
|
/**
|
|
57
61
|
* Indent level for submenus.
|
|
@@ -110,6 +114,13 @@ export class AuroMenu extends AuroElement {
|
|
|
110
114
|
* @private
|
|
111
115
|
*/
|
|
112
116
|
private handleSlotChange;
|
|
117
|
+
/**
|
|
118
|
+
* Formatted value based on `multiSelect` state.
|
|
119
|
+
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
120
|
+
* @private
|
|
121
|
+
* @returns {String|Array<String>}
|
|
122
|
+
*/
|
|
123
|
+
private get formattedValue();
|
|
113
124
|
firstUpdated(): void;
|
|
114
125
|
loadingSlots: NodeListOf<Element>;
|
|
115
126
|
/**
|
|
@@ -266,7 +266,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
266
266
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
267
267
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
268
268
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
269
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
270
269
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
271
270
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
272
271
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -379,9 +378,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
379
378
|
reflect: true,
|
|
380
379
|
attribute: 'multiselect'
|
|
381
380
|
},
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Value selected for the component.
|
|
384
|
+
*/
|
|
382
385
|
value: {
|
|
383
|
-
|
|
384
|
-
|
|
386
|
+
type: String,
|
|
387
|
+
reflect: true,
|
|
388
|
+
attribute: 'value'
|
|
385
389
|
},
|
|
386
390
|
|
|
387
391
|
/**
|
|
@@ -416,6 +420,25 @@ class AuroMenu extends AuroElement$1 {
|
|
|
416
420
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
417
421
|
}
|
|
418
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
|
+
|
|
419
442
|
// Lifecycle Methods
|
|
420
443
|
|
|
421
444
|
connectedCallback() {
|
|
@@ -458,7 +481,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
458
481
|
updated(changedProperties) {
|
|
459
482
|
super.updated(changedProperties);
|
|
460
483
|
|
|
461
|
-
if (changedProperties.has('multiSelect')) {
|
|
484
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
462
485
|
// Reset selection if multiSelect mode changes
|
|
463
486
|
this.clearSelection();
|
|
464
487
|
}
|
|
@@ -472,7 +495,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
472
495
|
} else {
|
|
473
496
|
if (this.multiSelect) {
|
|
474
497
|
// In multiselect mode, this.value should be an array of strings
|
|
475
|
-
const valueArray =
|
|
498
|
+
const valueArray = this.formattedValue;
|
|
476
499
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
477
500
|
|
|
478
501
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -639,14 +662,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
639
662
|
*/
|
|
640
663
|
handleSelectState(option) {
|
|
641
664
|
if (this.multiSelect) {
|
|
642
|
-
const currentValue = this.
|
|
665
|
+
const currentValue = this.formattedValue || [];
|
|
643
666
|
const currentSelected = this.optionSelected || [];
|
|
644
667
|
|
|
645
668
|
if (!currentValue.includes(option.value)) {
|
|
646
|
-
this.value = [
|
|
669
|
+
this.value = JSON.stringify([
|
|
647
670
|
...currentValue,
|
|
648
671
|
option.value
|
|
649
|
-
];
|
|
672
|
+
]);
|
|
650
673
|
}
|
|
651
674
|
if (!currentSelected.includes(option)) {
|
|
652
675
|
this.optionSelected = [
|
|
@@ -669,13 +692,15 @@ class AuroMenu extends AuroElement$1 {
|
|
|
669
692
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
670
693
|
*/
|
|
671
694
|
handleDeselectState(option) {
|
|
672
|
-
if (this.multiSelect
|
|
695
|
+
if (this.multiSelect) {
|
|
673
696
|
// Remove this option from array
|
|
674
|
-
|
|
697
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
675
698
|
|
|
676
699
|
// If array is empty after removal, set back to undefined
|
|
677
|
-
if (
|
|
700
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
678
701
|
this.value = undefined;
|
|
702
|
+
} else {
|
|
703
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
679
704
|
}
|
|
680
705
|
|
|
681
706
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -1026,7 +1051,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
1026
1051
|
}
|
|
1027
1052
|
}
|
|
1028
1053
|
|
|
1029
|
-
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) +
|
|
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-150, 0.75rem) + 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-150, 0.75rem) + 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}`;
|
|
1030
1055
|
|
|
1031
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)}`;
|
|
1032
1057
|
|
|
@@ -225,7 +225,6 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
225
225
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
226
226
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
227
227
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
228
|
-
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
229
228
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
230
229
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
231
230
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -338,9 +337,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
338
337
|
reflect: true,
|
|
339
338
|
attribute: 'multiselect'
|
|
340
339
|
},
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Value selected for the component.
|
|
343
|
+
*/
|
|
341
344
|
value: {
|
|
342
|
-
|
|
343
|
-
|
|
345
|
+
type: String,
|
|
346
|
+
reflect: true,
|
|
347
|
+
attribute: 'value'
|
|
344
348
|
},
|
|
345
349
|
|
|
346
350
|
/**
|
|
@@ -375,6 +379,25 @@ class AuroMenu extends AuroElement$1 {
|
|
|
375
379
|
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
376
380
|
}
|
|
377
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
|
+
|
|
378
401
|
// Lifecycle Methods
|
|
379
402
|
|
|
380
403
|
connectedCallback() {
|
|
@@ -417,7 +440,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
417
440
|
updated(changedProperties) {
|
|
418
441
|
super.updated(changedProperties);
|
|
419
442
|
|
|
420
|
-
if (changedProperties.has('multiSelect')) {
|
|
443
|
+
if (changedProperties.has('multiSelect') && !changedProperties.has("value")) {
|
|
421
444
|
// Reset selection if multiSelect mode changes
|
|
422
445
|
this.clearSelection();
|
|
423
446
|
}
|
|
@@ -431,7 +454,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
431
454
|
} else {
|
|
432
455
|
if (this.multiSelect) {
|
|
433
456
|
// In multiselect mode, this.value should be an array of strings
|
|
434
|
-
const valueArray =
|
|
457
|
+
const valueArray = this.formattedValue;
|
|
435
458
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
436
459
|
|
|
437
460
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -598,14 +621,14 @@ class AuroMenu extends AuroElement$1 {
|
|
|
598
621
|
*/
|
|
599
622
|
handleSelectState(option) {
|
|
600
623
|
if (this.multiSelect) {
|
|
601
|
-
const currentValue = this.
|
|
624
|
+
const currentValue = this.formattedValue || [];
|
|
602
625
|
const currentSelected = this.optionSelected || [];
|
|
603
626
|
|
|
604
627
|
if (!currentValue.includes(option.value)) {
|
|
605
|
-
this.value = [
|
|
628
|
+
this.value = JSON.stringify([
|
|
606
629
|
...currentValue,
|
|
607
630
|
option.value
|
|
608
|
-
];
|
|
631
|
+
]);
|
|
609
632
|
}
|
|
610
633
|
if (!currentSelected.includes(option)) {
|
|
611
634
|
this.optionSelected = [
|
|
@@ -628,13 +651,15 @@ class AuroMenu extends AuroElement$1 {
|
|
|
628
651
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
629
652
|
*/
|
|
630
653
|
handleDeselectState(option) {
|
|
631
|
-
if (this.multiSelect
|
|
654
|
+
if (this.multiSelect) {
|
|
632
655
|
// Remove this option from array
|
|
633
|
-
|
|
656
|
+
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
634
657
|
|
|
635
658
|
// If array is empty after removal, set back to undefined
|
|
636
|
-
if (
|
|
659
|
+
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
637
660
|
this.value = undefined;
|
|
661
|
+
} else {
|
|
662
|
+
this.value = JSON.stringify(newFormattedValue);
|
|
638
663
|
}
|
|
639
664
|
|
|
640
665
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -985,7 +1010,7 @@ class AuroMenu extends AuroElement$1 {
|
|
|
985
1010
|
}
|
|
986
1011
|
}
|
|
987
1012
|
|
|
988
|
-
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) +
|
|
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-150, 0.75rem) + 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-150, 0.75rem) + 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}`;
|
|
989
1014
|
|
|
990
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)}`;
|
|
991
1016
|
|
|
@@ -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
|
|
|
@@ -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
|