@aurodesignsystem/auro-formkit 5.9.1 → 5.9.2
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/CHANGELOG.md +16 -4
- package/components/checkbox/README.md +62 -62
- package/components/checkbox/demo/api.js +1 -1
- package/components/checkbox/demo/api.md +127 -84
- package/components/checkbox/demo/api.min.js +125 -42
- package/components/checkbox/demo/index.md +9 -281
- package/components/checkbox/demo/index.min.js +125 -42
- package/components/checkbox/demo/readme.html +3 -4
- package/components/checkbox/demo/readme.md +62 -62
- package/components/checkbox/dist/auro-checkbox-group.d.ts +7 -8
- package/components/checkbox/dist/auro-checkbox.d.ts +74 -20
- package/components/checkbox/dist/index.js +125 -42
- package/components/checkbox/dist/registered.js +125 -42
- package/components/combobox/README.md +76 -74
- package/components/combobox/demo/api.html +1 -0
- package/components/combobox/demo/api.js +11 -12
- package/components/combobox/demo/api.md +1302 -875
- package/components/combobox/demo/api.min.js +348 -420
- package/components/combobox/demo/index.html +1 -7
- package/components/combobox/demo/index.js +0 -19
- package/components/combobox/demo/index.md +43 -723
- package/components/combobox/demo/index.min.js +301 -230
- package/components/combobox/demo/readme.html +3 -4
- package/components/combobox/demo/readme.md +76 -74
- package/components/combobox/dist/auro-combobox.d.ts +39 -40
- package/components/combobox/dist/index.js +159 -143
- package/components/combobox/dist/registered.js +159 -143
- package/components/counter/README.md +81 -66
- package/components/counter/demo/api.html +1 -2
- package/components/counter/demo/api.js +2 -2
- package/components/counter/demo/api.md +777 -259
- package/components/counter/demo/api.min.js +84 -112
- package/components/counter/demo/index.html +0 -2
- package/components/counter/demo/index.md +20 -329
- package/components/counter/demo/index.min.js +82 -93
- package/components/counter/demo/readme.html +3 -4
- package/components/counter/demo/readme.md +81 -66
- package/components/counter/dist/auro-counter-group.d.ts +21 -36
- package/components/counter/dist/auro-counter-wrapper.d.ts +1 -6
- package/components/counter/dist/auro-counter.d.ts +5 -8
- package/components/counter/dist/index.js +82 -93
- package/components/counter/dist/registered.js +82 -93
- package/components/datepicker/README.md +57 -61
- package/components/datepicker/demo/api.js +8 -8
- package/components/datepicker/demo/api.md +720 -561
- package/components/datepicker/demo/api.min.js +427 -2424
- package/components/datepicker/demo/index.md +65 -117
- package/components/datepicker/demo/index.min.js +427 -2424
- package/components/datepicker/demo/readme.html +3 -4
- package/components/datepicker/demo/readme.md +57 -61
- package/components/datepicker/dist/auro-calendar.d.ts +60 -34
- package/components/datepicker/dist/auro-datepicker.d.ts +31 -31
- package/components/datepicker/dist/index.js +256 -2253
- package/components/datepicker/dist/popoverVersion.d.ts +1 -1
- package/components/datepicker/dist/registered.js +256 -2253
- package/components/dropdown/README.md +78 -62
- package/components/dropdown/demo/api.js +4 -4
- package/components/dropdown/demo/api.md +520 -478
- package/components/dropdown/demo/api.min.js +48 -39
- package/components/dropdown/demo/index.md +65 -119
- package/components/dropdown/demo/index.min.js +38 -29
- package/components/dropdown/demo/readme.html +3 -4
- package/components/dropdown/demo/readme.md +78 -62
- package/components/dropdown/dist/auro-dropdown.d.ts +42 -33
- package/components/dropdown/dist/index.js +38 -29
- package/components/dropdown/dist/registered.js +38 -29
- package/components/form/README.md +16 -58
- package/components/form/demo/api.md +16 -21
- package/components/form/demo/api.min.js +13 -8
- package/components/form/demo/index.md +38 -39
- package/components/form/demo/index.min.js +13 -8
- package/components/form/demo/readme.md +16 -58
- package/components/form/dist/auro-form.d.ts +15 -3
- package/components/form/dist/index.js +13 -8
- package/components/form/dist/registered.js +13 -8
- package/components/input/README.md +55 -60
- package/components/input/demo/api.js +3 -5
- package/components/input/demo/api.md +558 -537
- package/components/input/demo/api.min.js +100 -113
- package/components/input/demo/index.js +0 -1
- package/components/input/demo/index.md +90 -203
- package/components/input/demo/index.min.js +85 -97
- package/components/input/demo/readme.html +3 -4
- package/components/input/demo/readme.md +55 -60
- package/components/input/dist/auro-input.d.ts +6 -5
- package/components/input/dist/base-input.d.ts +67 -68
- package/components/input/dist/index.js +85 -80
- package/components/input/dist/registered.js +85 -80
- package/components/menu/README.md +61 -61
- package/components/menu/demo/api.js +6 -8
- package/components/menu/demo/api.md +520 -572
- package/components/menu/demo/api.min.js +176 -92
- package/components/menu/demo/index.js +0 -5
- package/components/menu/demo/index.md +36 -119
- package/components/menu/demo/index.min.js +141 -96
- package/components/menu/demo/readme.html +3 -4
- package/components/menu/demo/readme.md +61 -61
- package/components/menu/dist/auro-menu.d.ts +70 -37
- package/components/menu/dist/auro-menuoption.d.ts +36 -11
- package/components/menu/dist/index.js +141 -45
- package/components/menu/dist/registered.js +141 -45
- package/components/radio/README.md +61 -57
- package/components/radio/demo/api.js +2 -2
- package/components/radio/demo/api.md +241 -170
- package/components/radio/demo/api.min.js +154 -77
- package/components/radio/demo/index.md +22 -99
- package/components/radio/demo/index.min.js +145 -68
- package/components/radio/demo/readme.html +3 -4
- package/components/radio/demo/readme.md +61 -57
- package/components/radio/dist/auro-radio-group.d.ts +67 -35
- package/components/radio/dist/auro-radio.d.ts +56 -33
- package/components/radio/dist/index.js +145 -68
- package/components/radio/dist/registered.js +145 -68
- package/components/select/README.md +68 -65
- package/components/select/demo/api.html +1 -0
- package/components/select/demo/api.js +7 -7
- package/components/select/demo/api.md +1305 -625
- package/components/select/demo/api.min.js +300 -199
- package/components/select/demo/index.html +0 -2
- package/components/select/demo/index.md +25 -833
- package/components/select/demo/index.min.js +299 -167
- package/components/select/demo/readme.html +3 -4
- package/components/select/demo/readme.md +68 -65
- package/components/select/dist/auro-select.d.ts +99 -90
- package/components/select/dist/index.js +158 -122
- package/components/select/dist/registered.js +158 -122
- package/package.json +3 -3
|
@@ -21,49 +21,6 @@ function auroMenuMatchWordExample() {
|
|
|
21
21
|
matchWordInput.addEventListener('keyup', updateMatch);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function auroMenuCustomEventExample() {
|
|
25
|
-
let menuCustomEventEl = document.querySelector('auro-menu#customEvent');
|
|
26
|
-
|
|
27
|
-
if (menuCustomEventEl) {
|
|
28
|
-
menuCustomEventEl.addEventListener('mycustomevent', () => {
|
|
29
|
-
console.warn('My Custom Event Fired');
|
|
30
|
-
alert(`My Custom Event Fired`);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function auroMenuLoadingExample() {
|
|
36
|
-
document.querySelector("#loadingExampleToggleButton").addEventListener("click", () => {
|
|
37
|
-
document.querySelectorAll("#loadingExampleTable auro-menu").forEach(menu => menu.toggleAttribute("loading"));
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const initSelectAllMatchingOptionsExample = () => {
|
|
42
|
-
|
|
43
|
-
const selectAllBtn = document.getElementById('selectAllBtn');
|
|
44
|
-
const selectAllMenu = document.getElementById('selectAllMenu');
|
|
45
|
-
const selectFirstBtn = document.getElementById('selectFirstBtn');
|
|
46
|
-
const selectFirstMenu = document.getElementById('selectFirstMenu');
|
|
47
|
-
const resetAllBtn = document.getElementById('resetAllBtn');
|
|
48
|
-
const resetFirstBtn = document.getElementById('resetFirstBtn');
|
|
49
|
-
|
|
50
|
-
selectAllBtn.addEventListener('click', () => {
|
|
51
|
-
selectAllMenu.value = 'stops';
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
resetAllBtn.addEventListener('click', () => {
|
|
55
|
-
selectAllMenu.reset();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
selectFirstBtn.addEventListener('click', () => {
|
|
59
|
-
selectFirstMenu.value = 'stops';
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
resetFirstBtn.addEventListener('click', () => {
|
|
63
|
-
selectFirstMenu.reset();
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
24
|
function initKeysExample() {
|
|
68
25
|
const menu = document.getElementById('keys-menu');
|
|
69
26
|
const stopsButton = document.getElementById('stopsButton');
|
|
@@ -101,6 +58,38 @@ function initKeysExample() {
|
|
|
101
58
|
});
|
|
102
59
|
}
|
|
103
60
|
|
|
61
|
+
function auroMenuLoadingExample() {
|
|
62
|
+
document.querySelector("#loadingExampleToggleButton").addEventListener("click", () => {
|
|
63
|
+
document.querySelectorAll("#loadingExampleTable auro-menu").forEach(menu => menu.toggleAttribute("loading"));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const initSelectAllMatchingOptionsExample = () => {
|
|
68
|
+
|
|
69
|
+
const selectAllBtn = document.getElementById('selectAllBtn');
|
|
70
|
+
const selectAllMenu = document.getElementById('selectAllMenu');
|
|
71
|
+
const selectFirstBtn = document.getElementById('selectFirstBtn');
|
|
72
|
+
const selectFirstMenu = document.getElementById('selectFirstMenu');
|
|
73
|
+
const resetAllBtn = document.getElementById('resetAllBtn');
|
|
74
|
+
const resetFirstBtn = document.getElementById('resetFirstBtn');
|
|
75
|
+
|
|
76
|
+
selectAllBtn.addEventListener('click', () => {
|
|
77
|
+
selectAllMenu.value = 'stops';
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
resetAllBtn.addEventListener('click', () => {
|
|
81
|
+
selectAllMenu.reset();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
selectFirstBtn.addEventListener('click', () => {
|
|
85
|
+
selectFirstMenu.value = 'stops';
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
resetFirstBtn.addEventListener('click', () => {
|
|
89
|
+
selectFirstMenu.reset();
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
104
93
|
/**
|
|
105
94
|
* @license
|
|
106
95
|
* Copyright 2019 Google LLC
|
|
@@ -480,12 +469,9 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
480
469
|
|
|
481
470
|
|
|
482
471
|
/**
|
|
483
|
-
* The auro-
|
|
472
|
+
* The `auro-menuoption` element provides users a way to define a menu option.
|
|
473
|
+
* @customElement auro-menuoption
|
|
484
474
|
*
|
|
485
|
-
* @attr {String} value - Specifies the value to be sent to a server.
|
|
486
|
-
* @attr {String} noCheckmark - When true, selected option will not show the checkmark.
|
|
487
|
-
* @attr {Boolean} disabled - When true specifies that the menuoption is disabled.
|
|
488
|
-
* @attr {Boolean} selected - Specifies that an option is selected.
|
|
489
475
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
490
476
|
* @slot - Specifies text for an option, but is not the value.
|
|
491
477
|
*/
|
|
@@ -493,7 +479,7 @@ class AuroMenuOption extends AuroElement {
|
|
|
493
479
|
|
|
494
480
|
/**
|
|
495
481
|
* This will register this element with the browser.
|
|
496
|
-
* @param {string} [name="auro-menuoption"] - The name of element that you want to register
|
|
482
|
+
* @param {string} [name="auro-menuoption"] - The name of the element that you want to register.
|
|
497
483
|
*
|
|
498
484
|
* @example
|
|
499
485
|
* AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
|
|
@@ -557,38 +543,81 @@ class AuroMenuOption extends AuroElement {
|
|
|
557
543
|
static get properties() {
|
|
558
544
|
return {
|
|
559
545
|
...super.properties,
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* When true, disables the menu option.
|
|
549
|
+
*/
|
|
560
550
|
disabled: {
|
|
561
551
|
type: Boolean,
|
|
562
552
|
reflect: true
|
|
563
553
|
},
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* @private
|
|
557
|
+
*/
|
|
564
558
|
event: {
|
|
565
559
|
type: String,
|
|
566
560
|
reflect: true
|
|
567
561
|
},
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @private
|
|
565
|
+
*/
|
|
566
|
+
layout: {
|
|
567
|
+
type: String
|
|
568
|
+
},
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Allows users to set a unique key for the menu option for specified option selection. If no key is provided, the value property will be used.
|
|
572
|
+
*/
|
|
568
573
|
key: {
|
|
569
574
|
type: String,
|
|
570
575
|
reflect: true
|
|
571
576
|
},
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* @private
|
|
580
|
+
*/
|
|
572
581
|
menuService: {
|
|
573
582
|
type: Object,
|
|
574
583
|
state: true
|
|
575
584
|
},
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* @private
|
|
588
|
+
*/
|
|
576
589
|
matchWord: {
|
|
577
590
|
type: String,
|
|
578
591
|
state: true
|
|
579
592
|
},
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* @private
|
|
596
|
+
*/
|
|
580
597
|
noCheckmark: {
|
|
581
598
|
type: Boolean,
|
|
582
599
|
reflect: true
|
|
583
600
|
},
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Specifies that an option is selected.
|
|
604
|
+
*/
|
|
584
605
|
selected: {
|
|
585
606
|
type: Boolean,
|
|
586
607
|
reflect: true
|
|
587
608
|
},
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Specifies the tab index of the menu option.
|
|
612
|
+
*/
|
|
588
613
|
tabIndex: {
|
|
589
614
|
type: Number,
|
|
590
615
|
reflect: true
|
|
591
616
|
},
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Specifies the value to be sent to a server.
|
|
620
|
+
*/
|
|
592
621
|
value: {
|
|
593
622
|
type: String,
|
|
594
623
|
reflect: true
|
|
@@ -1539,19 +1568,9 @@ const MenuContext = n$1('menu-context');
|
|
|
1539
1568
|
|
|
1540
1569
|
|
|
1541
1570
|
/**
|
|
1542
|
-
* The auro-menu element provides users a way to select from a list of options.
|
|
1543
|
-
* @
|
|
1544
|
-
*
|
|
1545
|
-
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
1546
|
-
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
1547
|
-
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
1548
|
-
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
1549
|
-
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
1550
|
-
* @attr {boolean} selectAllMatchingOptions - When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
|
|
1551
|
-
* @attr {string} value - The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
1552
|
-
* @prop {string} size - Sets the size of the menu. Accepted values are 'sm' and 'md'. Default is 'sm'.
|
|
1553
|
-
* @prop {string} shape - Sets the shape of the menu options. Accepted values are 'box' and 'round'. Default is 'box'.
|
|
1554
|
-
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
1571
|
+
* The `auro-menu` element provides users a way to select from a list of options.
|
|
1572
|
+
* @customElement auro-menu
|
|
1573
|
+
*
|
|
1555
1574
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
1556
1575
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
1557
1576
|
* @event {CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>} auroMenu-loadingChange - Notifies when the loading attribute is changed.
|
|
@@ -1642,58 +1661,87 @@ class AuroMenu extends AuroElement {
|
|
|
1642
1661
|
type: Boolean,
|
|
1643
1662
|
reflect: true,
|
|
1644
1663
|
},
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
},
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* When true, the entire menu and all options are disabled.
|
|
1667
|
+
*/
|
|
1650
1668
|
disabled: {
|
|
1651
1669
|
type: Boolean,
|
|
1652
1670
|
reflect: true
|
|
1653
1671
|
},
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
1675
|
+
*/
|
|
1676
|
+
hasLoadingPlaceholder: {
|
|
1677
|
+
type: Boolean
|
|
1678
|
+
},
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* @private
|
|
1682
|
+
*/
|
|
1683
|
+
layout: {
|
|
1684
|
+
type: String
|
|
1685
|
+
},
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Indent level for submenus.
|
|
1689
|
+
* @private
|
|
1690
|
+
*/
|
|
1691
|
+
level: {
|
|
1692
|
+
type: Number,
|
|
1693
|
+
reflect: false,
|
|
1694
|
+
attribute: false
|
|
1695
|
+
},
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
1699
|
+
*/
|
|
1654
1700
|
loading: {
|
|
1655
1701
|
type: Boolean,
|
|
1656
1702
|
reflect: true
|
|
1657
1703
|
},
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
optionActive: {
|
|
1663
|
-
type: Object,
|
|
1664
|
-
attribute: 'optionactive'
|
|
1665
|
-
},
|
|
1704
|
+
|
|
1705
|
+
/**
|
|
1706
|
+
* Specifies a string used to highlight matched string parts in options.
|
|
1707
|
+
*/
|
|
1666
1708
|
matchWord: {
|
|
1667
1709
|
type: String,
|
|
1668
1710
|
attribute: 'matchword'
|
|
1669
1711
|
},
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* When true, the selected option can be multiple options.
|
|
1715
|
+
*/
|
|
1670
1716
|
multiSelect: {
|
|
1671
1717
|
type: Boolean,
|
|
1672
1718
|
reflect: true,
|
|
1673
1719
|
attribute: 'multiselect'
|
|
1674
1720
|
},
|
|
1675
|
-
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* When true, selected option will not show the checkmark.
|
|
1724
|
+
*/
|
|
1725
|
+
noCheckmark: {
|
|
1676
1726
|
type: Boolean,
|
|
1677
1727
|
reflect: true,
|
|
1728
|
+
attribute: 'nocheckmark'
|
|
1678
1729
|
},
|
|
1679
1730
|
|
|
1680
1731
|
/**
|
|
1681
|
-
*
|
|
1732
|
+
* Specifies the current active menuOption.
|
|
1682
1733
|
*/
|
|
1683
|
-
|
|
1684
|
-
type:
|
|
1685
|
-
|
|
1686
|
-
attribute: 'value'
|
|
1734
|
+
optionActive: {
|
|
1735
|
+
type: Object,
|
|
1736
|
+
attribute: 'optionactive'
|
|
1687
1737
|
},
|
|
1688
1738
|
|
|
1689
1739
|
/**
|
|
1690
|
-
*
|
|
1691
|
-
* @private
|
|
1740
|
+
* An array of currently selected menu options, type `HTMLElement` by default. In multi-select mode, `optionSelected` is an array of HTML elements.
|
|
1692
1741
|
*/
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
attribute: false
|
|
1742
|
+
optionSelected: {
|
|
1743
|
+
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
1744
|
+
type: Object
|
|
1697
1745
|
},
|
|
1698
1746
|
|
|
1699
1747
|
/**
|
|
@@ -1704,6 +1752,43 @@ class AuroMenu extends AuroElement {
|
|
|
1704
1752
|
type: Array,
|
|
1705
1753
|
reflect: false,
|
|
1706
1754
|
attribute: false
|
|
1755
|
+
},
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Sets the size of the menu.
|
|
1759
|
+
* @type {'sm' | 'md'}
|
|
1760
|
+
* @default 'sm'
|
|
1761
|
+
*/
|
|
1762
|
+
size: {
|
|
1763
|
+
type: String,
|
|
1764
|
+
reflect: true
|
|
1765
|
+
},
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
|
|
1769
|
+
*/
|
|
1770
|
+
selectAllMatchingOptions: {
|
|
1771
|
+
type: Boolean,
|
|
1772
|
+
reflect: true,
|
|
1773
|
+
},
|
|
1774
|
+
|
|
1775
|
+
/**
|
|
1776
|
+
* Sets the shape of the menu.
|
|
1777
|
+
* @type {'box' | 'round'}
|
|
1778
|
+
* @default 'box'
|
|
1779
|
+
*/
|
|
1780
|
+
shape: {
|
|
1781
|
+
type: String,
|
|
1782
|
+
reflect: true
|
|
1783
|
+
},
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
1787
|
+
*/
|
|
1788
|
+
value: {
|
|
1789
|
+
type: String,
|
|
1790
|
+
reflect: true,
|
|
1791
|
+
attribute: 'value'
|
|
1707
1792
|
}
|
|
1708
1793
|
};
|
|
1709
1794
|
}
|
|
@@ -1749,7 +1834,7 @@ class AuroMenu extends AuroElement {
|
|
|
1749
1834
|
|
|
1750
1835
|
/**
|
|
1751
1836
|
* This will register this element with the browser.
|
|
1752
|
-
* @param {string} [name="auro-menu"] - The name of element that you want to register
|
|
1837
|
+
* @param {string} [name="auro-menu"] - The name of the element that you want to register.
|
|
1753
1838
|
*
|
|
1754
1839
|
* @example
|
|
1755
1840
|
* AuroMenu.register("custom-menu") // this will register this element to <custom-menu/>
|
|
@@ -2167,12 +2252,11 @@ function initExamples(initCount) {
|
|
|
2167
2252
|
|
|
2168
2253
|
try {
|
|
2169
2254
|
// javascript example function calls to be added here upon creation to test examples
|
|
2170
|
-
|
|
2171
|
-
auroMenuMatchWordExample();
|
|
2172
|
-
auroMenuCustomEventExample();
|
|
2255
|
+
initKeysExample();
|
|
2173
2256
|
auroMenuLoadingExample();
|
|
2257
|
+
auroMenuMatchWordExample();
|
|
2174
2258
|
initSelectAllMatchingOptionsExample();
|
|
2175
|
-
|
|
2259
|
+
auroMenuResetExample();
|
|
2176
2260
|
} catch (err) {
|
|
2177
2261
|
if (initCount <= 20) {
|
|
2178
2262
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
|
|
2
2
|
|
|
3
|
-
// import { auroMenuResetExample } from '../apiExamples/reset';
|
|
4
|
-
|
|
5
3
|
import { AuroMenu } from '../src/auro-menu.js';
|
|
6
4
|
import { AuroMenuOption } from '../src/auro-menuoption.js';
|
|
7
|
-
import { initKeysExample } from '../apiExamples/keys.js';
|
|
8
5
|
|
|
9
6
|
AuroMenu.register();
|
|
10
7
|
AuroMenuOption.register();
|
|
@@ -16,8 +13,6 @@ export function initExamples(initCount) {
|
|
|
16
13
|
|
|
17
14
|
try {
|
|
18
15
|
// javascript example function calls to be added here upon creation to test examples
|
|
19
|
-
// auroMenuResetExample();
|
|
20
|
-
initKeysExample();
|
|
21
16
|
} catch (err) {
|
|
22
17
|
if (initCount <= 20) {
|
|
23
18
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
THIS PAGE'S CONTENT SHOULD BE KEPT MINIMAL.
|
|
3
|
+
ONLY ADD EXAMPLES THAT ARE TRULY NECESSARY FOR THE INDEX PAGE — THE BASIC EXAMPLE IS USUALLY ENOUGH.
|
|
4
|
+
ALL OTHER EXAMPLES SHOULD GO IN THE API DOCUMENTATION.
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
|
-
# Menu
|
|
8
|
-
|
|
7
|
+
# Menu
|
|
8
|
+
|
|
9
9
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
|
|
10
10
|
<!-- The below content is automatically added from ./../docs/partials/description.md -->
|
|
11
11
|
The `<auro-menu>` element provides a list of options for a user to select from.
|
|
@@ -15,8 +15,8 @@ A list of options is created within the `<slot>` of the `<auro-menu>` element by
|
|
|
15
15
|
The `<auro-menu>` element is designed for contextual menus, e.g. a dropdown menus. They are not intended to be used for navigation menus which have a different semantic meaning. The `<auro-menu>` element does not support hide/show functionality within its scope. This functionality will be managed by a wrapping element such as a drop-down menu composite element.
|
|
16
16
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
17
17
|
|
|
18
|
-
##
|
|
19
|
-
|
|
18
|
+
## Use Cases
|
|
19
|
+
|
|
20
20
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/useCases.md) -->
|
|
21
21
|
<!-- The below content is automatically added from ./../docs/partials/useCases.md -->
|
|
22
22
|
The `<auro-menu>` element should be used in situations where users may:
|
|
@@ -26,130 +26,47 @@ The `<auro-menu>` element should be used in situations where users may:
|
|
|
26
26
|
|
|
27
27
|
## Example(s)
|
|
28
28
|
|
|
29
|
-
###
|
|
30
|
-
|
|
31
|
-
A basic `auro-menu` element with nested `auro-menuoption` elements to generate a list.
|
|
32
|
-
|
|
29
|
+
### Basic
|
|
30
|
+
|
|
33
31
|
<div class="exampleWrapper">
|
|
34
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/
|
|
35
|
-
<!-- The below content is automatically added from ./../apiExamples/
|
|
32
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/preselect.html) -->
|
|
33
|
+
<!-- The below content is automatically added from ./../apiExamples/preselect.html -->
|
|
36
34
|
<auro-menu>
|
|
37
|
-
<auro-menuoption value="
|
|
38
|
-
<auro-menuoption value="
|
|
39
|
-
<auro-menuoption value="
|
|
40
|
-
<auro-menuoption value="
|
|
41
|
-
<
|
|
35
|
+
<auro-menuoption value="new tab">New tab</auro-menuoption>
|
|
36
|
+
<auro-menuoption value="new window" selected>New window</auro-menuoption>
|
|
37
|
+
<auro-menuoption value="open file">Open file</auro-menuoption>
|
|
38
|
+
<auro-menuoption value="open location">Open location</auro-menuoption>
|
|
39
|
+
<hr>
|
|
40
|
+
<auro-menuoption value="close window">Close window</auro-menuoption>
|
|
41
|
+
<auro-menuoption value="close tab" disabled>Close tab</auro-menuoption>
|
|
42
|
+
<auro-menuoption value="save page as...">Save page as...</auro-menuoption>
|
|
43
|
+
<hr>
|
|
44
|
+
<auro-menuoption value="share" disabled>Share</auro-menuoption>
|
|
45
|
+
<hr>
|
|
46
|
+
<auro-menuoption value="print">Print</auro-menuoption>
|
|
42
47
|
</auro-menu>
|
|
43
48
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
44
49
|
</div>
|
|
45
50
|
<auro-accordion alignRight>
|
|
46
51
|
<span slot="trigger">See code</span>
|
|
47
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/
|
|
48
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/
|
|
52
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/preselect.html) -->
|
|
53
|
+
<!-- The below code snippet is automatically added from ./../apiExamples/preselect.html -->
|
|
49
54
|
|
|
50
55
|
```html
|
|
51
56
|
<auro-menu>
|
|
52
|
-
<auro-menuoption value="
|
|
53
|
-
<auro-menuoption value="
|
|
54
|
-
<auro-menuoption value="
|
|
55
|
-
<auro-menuoption value="
|
|
56
|
-
<auro-menuoption value="arrival">Arrival</auro-menuoption>
|
|
57
|
-
</auro-menu>
|
|
58
|
-
```
|
|
59
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
60
|
-
</auro-accordion>
|
|
61
|
-
|
|
62
|
-
### Using Keys
|
|
63
|
-
|
|
64
|
-
When setting the `value` property, matches are actually performed on the value of the `key` property of the `auro-menuoption` and not the `value` property. By default, the value of `key` is equal to the value of the `value` property. However, for advanced use cases, the `key` value can be overriden to allow for more specific matches.
|
|
65
|
-
|
|
66
|
-
In the below example, there is a list of "popular" options at the top, with the same values repeated underneath. To allow more specific selections, we can add a `key` attribute to the top options to allow them to be more specifically selected, or to prevent them from interfering with matches on the lower options.
|
|
67
|
-
|
|
68
|
-
In the below example, setting the value of the menu `'stops'` will select the bottom-most option with the value `'stops'`, and setting the value of menu to `'stops-top'` will select the top-most option with the value `'stops'` since the key now differs from the value. In either case, the resulting value of the menu will be `'stops'` because the resulting value of the menu is based on the `value` property and not the `key` property.
|
|
69
|
-
|
|
70
|
-
Due to a limitation with Lit change detection to the `value` property, if multiple options with the same exist and one is selected, you must first clear the current value before attempting to select another option with the same value, even if the keys are unique. See code example below.
|
|
71
|
-
|
|
72
|
-
_Note: Since the value passed to the `value` property when programmatically setting it is overwritten with the proper derived value once the menu has updated, note that it will take one lifecycle before the `value` property is updated to the value that represents the actual menu state._
|
|
73
|
-
|
|
74
|
-
<div class="exampleWrapper">
|
|
75
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/keys.html) -->
|
|
76
|
-
<!-- The below content is automatically added from ./../apiExamples/keys.html -->
|
|
77
|
-
<auro-button id="stopsTopButton">Call `menu.value = 'stops-top'`</auro-button>
|
|
78
|
-
<auro-button id="stopsButton">Call `menu.value = 'stops'`</auro-button>
|
|
79
|
-
<auro-menu id="keys-menu">
|
|
80
|
-
<auro-menuoption value="stops" key="stops-top">Stops</auro-menuoption>
|
|
81
|
-
<auro-menuoption value="price" key="price-top">Price</auro-menuoption>
|
|
57
|
+
<auro-menuoption value="new tab">New tab</auro-menuoption>
|
|
58
|
+
<auro-menuoption value="new window" selected>New window</auro-menuoption>
|
|
59
|
+
<auro-menuoption value="open file">Open file</auro-menuoption>
|
|
60
|
+
<auro-menuoption value="open location">Open location</auro-menuoption>
|
|
82
61
|
<hr>
|
|
83
|
-
<auro-menuoption value="
|
|
84
|
-
<auro-menuoption value="
|
|
85
|
-
<auro-menuoption value="
|
|
86
|
-
<auro-menuoption value="stops">Stops</auro-menuoption>
|
|
87
|
-
<auro-menuoption value="price">Price</auro-menuoption>
|
|
88
|
-
</auro-menu>
|
|
89
|
-
<p id="output" class="body-sm"></p>
|
|
90
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
91
|
-
</div>
|
|
92
|
-
<auro-accordion alignRight>
|
|
93
|
-
<span slot="trigger">See code</span>
|
|
94
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/keys.html) -->
|
|
95
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/keys.html -->
|
|
96
|
-
|
|
97
|
-
```html
|
|
98
|
-
<auro-button id="stopsTopButton">Call `menu.value = 'stops-top'`</auro-button>
|
|
99
|
-
<auro-button id="stopsButton">Call `menu.value = 'stops'`</auro-button>
|
|
100
|
-
<auro-menu id="keys-menu">
|
|
101
|
-
<auro-menuoption value="stops" key="stops-top">Stops</auro-menuoption>
|
|
102
|
-
<auro-menuoption value="price" key="price-top">Price</auro-menuoption>
|
|
62
|
+
<auro-menuoption value="close window">Close window</auro-menuoption>
|
|
63
|
+
<auro-menuoption value="close tab" disabled>Close tab</auro-menuoption>
|
|
64
|
+
<auro-menuoption value="save page as...">Save page as...</auro-menuoption>
|
|
103
65
|
<hr>
|
|
104
|
-
<auro-menuoption value="
|
|
105
|
-
<
|
|
106
|
-
<auro-menuoption value="
|
|
107
|
-
<auro-menuoption value="stops">Stops</auro-menuoption>
|
|
108
|
-
<auro-menuoption value="price">Price</auro-menuoption>
|
|
66
|
+
<auro-menuoption value="share" disabled>Share</auro-menuoption>
|
|
67
|
+
<hr>
|
|
68
|
+
<auro-menuoption value="print">Print</auro-menuoption>
|
|
109
69
|
</auro-menu>
|
|
110
|
-
<p id="output" class="body-sm"></p>
|
|
111
70
|
```
|
|
112
71
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
113
|
-
|
|
114
|
-
<!-- The below code snippet is automatically added from ./../apiExamples/keys.js -->
|
|
115
|
-
|
|
116
|
-
```js
|
|
117
|
-
export function initKeysExample() {
|
|
118
|
-
const menu = document.getElementById('keys-menu');
|
|
119
|
-
const stopsButton = document.getElementById('stopsButton');
|
|
120
|
-
const stopsTopButton = document.getElementById('stopsTopButton');
|
|
121
|
-
const output = document.getElementById('output');
|
|
122
|
-
|
|
123
|
-
const createConsoleEntry = (message) => {
|
|
124
|
-
const node = document.createElement('span');
|
|
125
|
-
node.innerHTML = message;
|
|
126
|
-
output.appendChild(node);
|
|
127
|
-
output.appendChild(document.createElement('br'));
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const resetConsole = () => {
|
|
131
|
-
output.innerHTML = '';
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const updateMenuValue = (value) => {
|
|
135
|
-
resetConsole();
|
|
136
|
-
createConsoleEntry(`Setting menu.value: <em>"${value}"</em>`);
|
|
137
|
-
menu.value = '';
|
|
138
|
-
menu.value = value;
|
|
139
|
-
createConsoleEntry(`menu.value before next lifecycle: <em>"${menu.value}"</em>`);
|
|
140
|
-
setTimeout(() => {
|
|
141
|
-
createConsoleEntry(`menu.value after lifecycle: <em>"${menu.value}"</em>`);
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
stopsButton.addEventListener('click', () => {
|
|
146
|
-
updateMenuValue('stops');
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
stopsTopButton.addEventListener('click', () => {
|
|
150
|
-
updateMenuValue('stops-top');
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
```
|
|
154
|
-
<!-- AURO-GENERATED-CONTENT:END -->
|
|
155
|
-
</auro-accordion>
|
|
72
|
+
</auro-accordion>
|