@limetech/lime-elements 37.2.7 → 37.3.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/CHANGELOG.md +16 -0
- package/dist/cjs/{component-6c4222b7.js → component-cba208a8.js} +137 -18
- package/dist/cjs/component-cba208a8.js.map +1 -0
- package/dist/cjs/{get-icon-props-d74b10c9.js → get-icon-props-50be7440.js} +1 -19
- package/dist/cjs/get-icon-props-50be7440.js.map +1 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-action-bar-item_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js +2 -3
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +608 -0
- package/dist/cjs/limel-chip_2.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-header.cjs.entry.js +1 -1
- package/dist/cjs/limel-input-field_3.cjs.entry.js +2 -3
- package/dist/cjs/limel-input-field_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +33 -24
- package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/limel-progress-flow.cjs.entry.js +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +1 -1
- package/dist/cjs/limel-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/chip/chip.js +41 -14
- package/dist/collection/components/chip/chip.js.map +1 -1
- package/dist/collection/components/chip-set/chip-set.css +19 -723
- package/dist/collection/components/chip-set/chip-set.js +83 -108
- package/dist/collection/components/chip-set/chip-set.js.map +1 -1
- package/dist/collection/components/chip-set/chip.types.js.map +1 -1
- package/dist/collection/components/picker/picker.js +36 -26
- package/dist/collection/components/picker/picker.js.map +1 -1
- package/dist/esm/{component-703e23db.js → component-db286494.js} +121 -2
- package/dist/esm/component-db286494.js.map +1 -0
- package/dist/esm/{get-icon-props-f581151a.js → get-icon-props-0b65f85e.js} +2 -19
- package/dist/esm/get-icon-props-0b65f85e.js.map +1 -0
- package/dist/esm/{keycodes-22fb659d.js → keycodes-bf11a644.js} +2 -2
- package/dist/esm/{keycodes-22fb659d.js.map → keycodes-bf11a644.js.map} +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-action-bar-item_2.entry.js +1 -1
- package/dist/esm/limel-breadcrumbs_3.entry.js +3 -4
- package/dist/esm/limel-breadcrumbs_3.entry.js.map +1 -1
- package/dist/esm/limel-chip_2.entry.js +603 -0
- package/dist/esm/limel-chip_2.entry.js.map +1 -0
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-header.entry.js +1 -1
- package/dist/esm/limel-input-field_3.entry.js +3 -4
- package/dist/esm/limel-input-field_3.entry.js.map +1 -1
- package/dist/esm/limel-picker.entry.js +34 -25
- package/dist/esm/limel-picker.entry.js.map +1 -1
- package/dist/esm/limel-popover_2.entry.js +1 -1
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-progress-flow.entry.js +1 -1
- package/dist/esm/limel-select.entry.js +2 -2
- package/dist/esm/limel-tab-bar.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/{p-854343a1.entry.js → p-27d64a5a.entry.js} +2 -2
- package/dist/lime-elements/p-2f777fdb.js +2 -0
- package/dist/lime-elements/p-2f777fdb.js.map +1 -0
- package/dist/lime-elements/{p-4a8ac53b.entry.js → p-54c9b7b1.entry.js} +4 -4
- package/dist/lime-elements/{p-4a8ac53b.entry.js.map → p-54c9b7b1.entry.js.map} +1 -1
- package/dist/lime-elements/{p-af53d049.entry.js → p-71282352.entry.js} +2 -2
- package/dist/lime-elements/p-8d13a44f.entry.js +2 -0
- package/dist/lime-elements/p-8d13a44f.entry.js.map +1 -0
- package/dist/lime-elements/{p-bccf626e.entry.js → p-91aaa8b4.entry.js} +2 -2
- package/dist/lime-elements/{p-acd589ef.entry.js → p-b03c1b71.entry.js} +2 -2
- package/dist/lime-elements/{p-85a770a4.entry.js → p-b51fd0c7.entry.js} +2 -2
- package/dist/lime-elements/{p-e53b7ccf.entry.js → p-b89d2cc3.entry.js} +2 -2
- package/dist/lime-elements/{p-93c6d561.js → p-e03dfe70.js} +2 -2
- package/dist/lime-elements/{p-c022dd0d.entry.js → p-e41d6636.entry.js} +2 -2
- package/dist/lime-elements/{p-38151879.js → p-f764b655.js} +32 -10
- package/dist/lime-elements/p-f764b655.js.map +1 -0
- package/dist/lime-elements/p-fc423e66.entry.js +2 -0
- package/dist/lime-elements/p-fc423e66.entry.js.map +1 -0
- package/dist/lime-elements/p-fd69d7ad.entry.js +2 -0
- package/dist/lime-elements/{p-711c8538.entry.js.map → p-fd69d7ad.entry.js.map} +1 -1
- package/dist/lime-elements/{p-bbe3ce51.entry.js → p-fdae60a1.entry.js} +2 -2
- package/dist/types/components/chip/chip.d.ts +17 -4
- package/dist/types/components/chip-set/chip-set.d.ts +15 -15
- package/dist/types/components/chip-set/chip.types.d.ts +7 -1
- package/dist/types/components/picker/picker.d.ts +10 -2
- package/dist/types/components.d.ts +40 -12
- package/package.json +2 -2
- package/dist/cjs/component-6c4222b7.js.map +0 -1
- package/dist/cjs/get-icon-props-d74b10c9.js.map +0 -1
- package/dist/cjs/keyboard-9477d3a8.js +0 -133
- package/dist/cjs/keyboard-9477d3a8.js.map +0 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js +0 -2095
- package/dist/cjs/limel-chip-set.cjs.entry.js.map +0 -1
- package/dist/cjs/limel-chip.cjs.entry.js +0 -105
- package/dist/cjs/limel-chip.cjs.entry.js.map +0 -1
- package/dist/esm/component-703e23db.js.map +0 -1
- package/dist/esm/get-icon-props-f581151a.js.map +0 -1
- package/dist/esm/keyboard-4b9e12e3.js +0 -129
- package/dist/esm/keyboard-4b9e12e3.js.map +0 -1
- package/dist/esm/limel-chip-set.entry.js +0 -2091
- package/dist/esm/limel-chip-set.entry.js.map +0 -1
- package/dist/esm/limel-chip.entry.js +0 -101
- package/dist/esm/limel-chip.entry.js.map +0 -1
- package/dist/lime-elements/p-38151879.js.map +0 -1
- package/dist/lime-elements/p-48aa89a6.entry.js +0 -2
- package/dist/lime-elements/p-48aa89a6.entry.js.map +0 -1
- package/dist/lime-elements/p-4d92b6fb.js +0 -2
- package/dist/lime-elements/p-4d92b6fb.js.map +0 -1
- package/dist/lime-elements/p-6e219bb4.js +0 -24
- package/dist/lime-elements/p-6e219bb4.js.map +0 -1
- package/dist/lime-elements/p-711c8538.entry.js +0 -2
- package/dist/lime-elements/p-8a9d91cf.entry.js +0 -222
- package/dist/lime-elements/p-8a9d91cf.entry.js.map +0 -1
- package/dist/lime-elements/p-f70a9044.entry.js +0 -2
- package/dist/lime-elements/p-f70a9044.entry.js.map +0 -1
- /package/dist/lime-elements/{p-854343a1.entry.js.map → p-27d64a5a.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-af53d049.entry.js.map → p-71282352.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-bccf626e.entry.js.map → p-91aaa8b4.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-acd589ef.entry.js.map → p-b03c1b71.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-85a770a4.entry.js.map → p-b51fd0c7.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-e53b7ccf.entry.js.map → p-b89d2cc3.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-93c6d561.js.map → p-e03dfe70.js.map} +0 -0
- /package/dist/lime-elements/{p-c022dd0d.entry.js.map → p-e41d6636.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-bbe3ce51.entry.js.map → p-fdae60a1.entry.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c as u}from"./p-dcc97cc2.js";import{
|
|
1
|
+
import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c as u}from"./p-dcc97cc2.js";import{g as o}from"./p-9faad6eb.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2018 Google Inc.
|
|
@@ -20,7 +20,7 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
22
|
* THE SOFTWARE.
|
|
23
|
-
*/var
|
|
23
|
+
*/var f={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",IS_OPEN_BELOW:"mdc-menu-surface--is-open-below",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"};var a={CLOSED_EVENT:"MDCMenuSurface:closed",CLOSING_EVENT:"MDCMenuSurface:closing",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")};var h={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67,TOUCH_EVENT_WAIT_MS:30};var c;(function(t){t[t["BOTTOM"]=1]="BOTTOM";t[t["CENTER"]=2]="CENTER";t[t["RIGHT"]=4]="RIGHT";t[t["FLIP_RTL"]=8]="FLIP_RTL"})(c||(c={}));var d;(function(t){t[t["TOP_LEFT"]=0]="TOP_LEFT";t[t["TOP_RIGHT"]=4]="TOP_RIGHT";t[t["BOTTOM_LEFT"]=1]="BOTTOM_LEFT";t[t["BOTTOM_RIGHT"]=5]="BOTTOM_RIGHT";t[t["TOP_START"]=8]="TOP_START";t[t["TOP_END"]=12]="TOP_END";t[t["BOTTOM_START"]=9]="BOTTOM_START";t[t["BOTTOM_END"]=13]="BOTTOM_END"})(d||(d={}));
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2018 Google Inc.
|
|
@@ -42,7 +42,7 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
42
42
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
43
43
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
44
44
|
* THE SOFTWARE.
|
|
45
|
-
*/var v
|
|
45
|
+
*/var l,v;var m={LIST_ITEM_ACTIVATED_CLASS:"mdc-list-item--activated",LIST_ITEM_CLASS:"mdc-list-item",LIST_ITEM_DISABLED_CLASS:"mdc-list-item--disabled",LIST_ITEM_SELECTED_CLASS:"mdc-list-item--selected",LIST_ITEM_TEXT_CLASS:"mdc-list-item__text",LIST_ITEM_PRIMARY_TEXT_CLASS:"mdc-list-item__primary-text",ROOT:"mdc-list"};var E=(l={},l[""+m.LIST_ITEM_ACTIVATED_CLASS]="mdc-list-item--activated",l[""+m.LIST_ITEM_CLASS]="mdc-list-item",l[""+m.LIST_ITEM_DISABLED_CLASS]="mdc-list-item--disabled",l[""+m.LIST_ITEM_SELECTED_CLASS]="mdc-list-item--selected",l[""+m.LIST_ITEM_PRIMARY_TEXT_CLASS]="mdc-list-item__primary-text",l[""+m.ROOT]="mdc-list",l);var A=(v={},v[""+m.LIST_ITEM_ACTIVATED_CLASS]="mdc-deprecated-list-item--activated",v[""+m.LIST_ITEM_CLASS]="mdc-deprecated-list-item",v[""+m.LIST_ITEM_DISABLED_CLASS]="mdc-deprecated-list-item--disabled",v[""+m.LIST_ITEM_SELECTED_CLASS]="mdc-deprecated-list-item--selected",v[""+m.LIST_ITEM_TEXT_CLASS]="mdc-deprecated-list-item__text",v[""+m.LIST_ITEM_PRIMARY_TEXT_CLASS]="mdc-deprecated-list-item__primary-text",v[""+m.ROOT]="mdc-deprecated-list",v);var I={ACTION_EVENT:"MDCList:action",ARIA_CHECKED:"aria-checked",ARIA_CHECKED_CHECKBOX_SELECTOR:'[role="checkbox"][aria-checked="true"]',ARIA_CHECKED_RADIO_SELECTOR:'[role="radio"][aria-checked="true"]',ARIA_CURRENT:"aria-current",ARIA_DISABLED:"aria-disabled",ARIA_ORIENTATION:"aria-orientation",ARIA_ORIENTATION_HORIZONTAL:"horizontal",ARIA_ROLE_CHECKBOX_SELECTOR:'[role="checkbox"]',ARIA_SELECTED:"aria-selected",ARIA_INTERACTIVE_ROLES_SELECTOR:'[role="listbox"], [role="menu"]',ARIA_MULTI_SELECTABLE_SELECTOR:'[aria-multiselectable="true"]',CHECKBOX_RADIO_SELECTOR:'input[type="checkbox"], input[type="radio"]',CHECKBOX_SELECTOR:'input[type="checkbox"]',CHILD_ELEMENTS_TO_TOGGLE_TABINDEX:"\n ."+m.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+m.LIST_ITEM_CLASS+" a,\n ."+A[m.LIST_ITEM_CLASS]+" button:not(:disabled),\n ."+A[m.LIST_ITEM_CLASS]+" a\n ",DEPRECATED_SELECTOR:".mdc-deprecated-list",FOCUSABLE_CHILD_ELEMENTS:"\n ."+m.LIST_ITEM_CLASS+" button:not(:disabled),\n ."+m.LIST_ITEM_CLASS+" a,\n ."+m.LIST_ITEM_CLASS+' input[type="radio"]:not(:disabled),\n .'+m.LIST_ITEM_CLASS+' input[type="checkbox"]:not(:disabled),\n .'+A[m.LIST_ITEM_CLASS]+" button:not(:disabled),\n ."+A[m.LIST_ITEM_CLASS]+" a,\n ."+A[m.LIST_ITEM_CLASS]+' input[type="radio"]:not(:disabled),\n .'+A[m.LIST_ITEM_CLASS]+' input[type="checkbox"]:not(:disabled)\n ',RADIO_SELECTOR:'input[type="radio"]',SELECTED_ITEM_SELECTOR:'[aria-selected="true"], [aria-current="true"]'};var b={UNSET_INDEX:-1,TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS:300};var T="evolution";
|
|
46
46
|
/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2020 Google Inc.
|
|
@@ -64,7 +64,7 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
64
64
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
65
65
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
66
66
|
* THE SOFTWARE.
|
|
67
|
-
*/var
|
|
67
|
+
*/var C={UNKNOWN:"Unknown",BACKSPACE:"Backspace",ENTER:"Enter",SPACEBAR:"Spacebar",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",END:"End",HOME:"Home",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",DELETE:"Delete",ESCAPE:"Escape",TAB:"Tab"};var _=new Set;_.add(C.BACKSPACE);_.add(C.ENTER);_.add(C.SPACEBAR);_.add(C.PAGE_UP);_.add(C.PAGE_DOWN);_.add(C.END);_.add(C.HOME);_.add(C.ARROW_LEFT);_.add(C.ARROW_UP);_.add(C.ARROW_RIGHT);_.add(C.ARROW_DOWN);_.add(C.DELETE);_.add(C.ESCAPE);_.add(C.TAB);var O={BACKSPACE:8,ENTER:13,SPACEBAR:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,DELETE:46,ESCAPE:27,TAB:9};var x=new Map;x.set(O.BACKSPACE,C.BACKSPACE);x.set(O.ENTER,C.ENTER);x.set(O.SPACEBAR,C.SPACEBAR);x.set(O.PAGE_UP,C.PAGE_UP);x.set(O.PAGE_DOWN,C.PAGE_DOWN);x.set(O.END,C.END);x.set(O.HOME,C.HOME);x.set(O.ARROW_LEFT,C.ARROW_LEFT);x.set(O.ARROW_UP,C.ARROW_UP);x.set(O.ARROW_RIGHT,C.ARROW_RIGHT);x.set(O.ARROW_DOWN,C.ARROW_DOWN);x.set(O.DELETE,C.DELETE);x.set(O.ESCAPE,C.ESCAPE);x.set(O.TAB,C.TAB);var p=new Set;p.add(C.PAGE_UP);p.add(C.PAGE_DOWN);p.add(C.END);p.add(C.HOME);p.add(C.ARROW_LEFT);p.add(C.ARROW_UP);p.add(C.ARROW_RIGHT);p.add(C.ARROW_DOWN);function R(t){var i=t.key;if(_.has(i)){return i}var n=x.get(t.keyCode);if(n){return n}return C.UNKNOWN}
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
70
70
|
* Copyright 2020 Google Inc.
|
|
@@ -86,7 +86,29 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
86
86
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
87
87
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
88
88
|
* THE SOFTWARE.
|
|
89
|
-
*/
|
|
89
|
+
*/var g=["input","button","textarea","select"];var S=function(t){var i=t.target;if(!i){return}var n=(""+i.tagName).toLowerCase();if(g.indexOf(n)===-1){t.preventDefault()}};
|
|
90
|
+
/**
|
|
91
|
+
* @license
|
|
92
|
+
* Copyright 2020 Google Inc.
|
|
93
|
+
*
|
|
94
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
95
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
96
|
+
* in the Software without restriction, including without limitation the rights
|
|
97
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
98
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
99
|
+
* furnished to do so, subject to the following conditions:
|
|
100
|
+
*
|
|
101
|
+
* The above copyright notice and this permission notice shall be included in
|
|
102
|
+
* all copies or substantial portions of the Software.
|
|
103
|
+
*
|
|
104
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
110
|
+
* THE SOFTWARE.
|
|
111
|
+
*/function L(){var t={bufferClearTimeout:0,currentFirstChar:"",sortedIndexCursor:0,typeaheadBuffer:""};return t}function w(t,i){var n=new Map;for(var e=0;e<t;e++){var r=i(e).trim();if(!r){continue}var s=r[0].toLowerCase();if(!n.has(s)){n.set(s,[])}n.get(s).push({text:r.toLowerCase(),index:e})}n.forEach((function(t){t.sort((function(t,i){return t.index-i.index}))}));return n}function D(t,i){var n=t.nextChar,e=t.focusItemAtIndex,r=t.sortedIndexByFirstChar,s=t.focusedItemIndex,u=t.skipFocus,o=t.isItemAtIndexDisabled;clearTimeout(i.bufferClearTimeout);i.bufferClearTimeout=setTimeout((function(){M(i)}),b.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);i.typeaheadBuffer=i.typeaheadBuffer+n;var f;if(i.typeaheadBuffer.length===1){f=y(r,s,o,i)}else{f=N(r,o,i)}if(f!==-1&&!u){e(f)}return f}function y(t,i,n,e){var r=e.typeaheadBuffer[0];var s=t.get(r);if(!s){return-1}if(r===e.currentFirstChar&&s[e.sortedIndexCursor].index===i){e.sortedIndexCursor=(e.sortedIndexCursor+1)%s.length;var u=s[e.sortedIndexCursor].index;if(!n(u)){return u}}e.currentFirstChar=r;var o=-1;var f;for(f=0;f<s.length;f++){if(!n(s[f].index)){o=f;break}}for(;f<s.length;f++){if(s[f].index>i&&!n(s[f].index)){o=f;break}}if(o!==-1){e.sortedIndexCursor=o;return s[e.sortedIndexCursor].index}return-1}function N(t,i,n){var e=n.typeaheadBuffer[0];var r=t.get(e);if(!r){return-1}var s=r[n.sortedIndexCursor];if(s.text.lastIndexOf(n.typeaheadBuffer,0)===0&&!i(s.index)){return s.index}var u=(n.sortedIndexCursor+1)%r.length;var o=-1;while(u!==n.sortedIndexCursor){var f=r[u];var a=f.text.lastIndexOf(n.typeaheadBuffer,0)===0;var h=!i(f.index);if(a&&h){o=u;break}u=(u+1)%r.length}if(o!==-1){n.sortedIndexCursor=o;return r[n.sortedIndexCursor].index}return-1}function F(t){return t.typeaheadBuffer.length>0}function M(t){t.typeaheadBuffer=""}function k(t,i){var n=t.event,e=t.isTargetListItem,r=t.focusedItemIndex,s=t.focusItemAtIndex,u=t.sortedIndexByFirstChar,o=t.isItemAtIndexDisabled;var f=R(n)==="ArrowLeft";var a=R(n)==="ArrowUp";var h=R(n)==="ArrowRight";var c=R(n)==="ArrowDown";var d=R(n)==="Home";var l=R(n)==="End";var v=R(n)==="Enter";var m=R(n)==="Spacebar";if(n.ctrlKey||n.metaKey||f||a||h||c||d||l||v){return-1}var E=!m&&n.key.length===1;if(E){S(n);var A={focusItemAtIndex:s,focusedItemIndex:r,nextChar:n.key.toLowerCase(),sortedIndexByFirstChar:u,skipFocus:false,isItemAtIndexDisabled:o};return D(A,i)}if(!m){return-1}if(e){S(n)}var I=e&&F(i);if(I){var A={focusItemAtIndex:s,focusedItemIndex:r,nextChar:" ",sortedIndexByFirstChar:u,skipFocus:false,isItemAtIndexDisabled:o};return D(A,i)}return-1}
|
|
90
112
|
/**
|
|
91
113
|
* @license
|
|
92
114
|
* Copyright 2018 Google Inc.
|
|
@@ -108,7 +130,7 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
108
130
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
131
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
110
132
|
* THE SOFTWARE.
|
|
111
|
-
*/function D(t){return t instanceof Array}var F=function(n){t(e,n);function e(t){var r=n.call(this,i(i({},e.defaultAdapter),t))||this;r.wrapFocus=false;r.isVertical=true;r.isSingleSelectionList=false;r.selectedIndex=T.UNSET_INDEX;r.focusedItemIndex=T.UNSET_INDEX;r.useActivatedClass=false;r.useSelectedAttr=false;r.ariaCurrentAttrValue=null;r.isCheckboxList=false;r.isRadioList=false;r.hasTypeahead=false;r.typeaheadState=O();r.sortedIndexByFirstChar=new Map;return r}Object.defineProperty(e,"strings",{get:function(){return A},enumerable:false,configurable:true});Object.defineProperty(e,"cssClasses",{get:function(){return b},enumerable:false,configurable:true});Object.defineProperty(e,"numbers",{get:function(){return T},enumerable:false,configurable:true});Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClassForElementIndex:function(){return undefined},focusItemAtIndex:function(){return undefined},getAttributeForElementIndex:function(){return null},getFocusedElementIndex:function(){return 0},getListItemCount:function(){return 0},hasCheckboxAtIndex:function(){return false},hasRadioAtIndex:function(){return false},isCheckboxCheckedAtIndex:function(){return false},isFocusInsideList:function(){return false},isRootFocused:function(){return false},listItemAtIndexHasClass:function(){return false},notifyAction:function(){return undefined},removeClassForElementIndex:function(){return undefined},setAttributeForElementIndex:function(){return undefined},setCheckedCheckboxOrRadioAtIndex:function(){return undefined},setTabIndexForListItemChildren:function(){return undefined},getPrimaryTextAtIndex:function(){return""}}},enumerable:false,configurable:true});e.prototype.layout=function(){if(this.adapter.getListItemCount()===0){return}if(this.adapter.hasCheckboxAtIndex(0)){this.isCheckboxList=true}else if(this.adapter.hasRadioAtIndex(0)){this.isRadioList=true}else{this.maybeInitializeSingleSelection()}if(this.hasTypeahead){this.sortedIndexByFirstChar=this.typeaheadInitSortedIndex()}};e.prototype.getFocusedItemIndex=function(){return this.focusedItemIndex};e.prototype.setWrapFocus=function(t){this.wrapFocus=t};e.prototype.setVerticalOrientation=function(t){this.isVertical=t};e.prototype.setSingleSelection=function(t){this.isSingleSelectionList=t;if(t){this.maybeInitializeSingleSelection();this.selectedIndex=this.getSelectedIndexFromDOM()}};e.prototype.maybeInitializeSingleSelection=function(){var t=this.getSelectedIndexFromDOM();if(t===T.UNSET_INDEX)return;var i=this.adapter.listItemAtIndexHasClass(t,b.LIST_ITEM_ACTIVATED_CLASS);if(i){this.setUseActivatedClass(true)}this.isSingleSelectionList=true;this.selectedIndex=t};e.prototype.getSelectedIndexFromDOM=function(){var t=T.UNSET_INDEX;var i=this.adapter.getListItemCount();for(var n=0;n<i;n++){var e=this.adapter.listItemAtIndexHasClass(n,b.LIST_ITEM_SELECTED_CLASS);var r=this.adapter.listItemAtIndexHasClass(n,b.LIST_ITEM_ACTIVATED_CLASS);if(!(e||r)){continue}t=n;break}return t};e.prototype.setHasTypeahead=function(t){this.hasTypeahead=t;if(t){this.sortedIndexByFirstChar=this.typeaheadInitSortedIndex()}};e.prototype.isTypeaheadInProgress=function(){return this.hasTypeahead&&L(this.typeaheadState)};e.prototype.setUseActivatedClass=function(t){this.useActivatedClass=t};e.prototype.setUseSelectedAttribute=function(t){this.useSelectedAttr=t};e.prototype.getSelectedIndex=function(){return this.selectedIndex};e.prototype.setSelectedIndex=function(t,i){var n=i===void 0?{}:i,e=n.forceUpdate;if(!this.isIndexValid(t)){return}if(this.isCheckboxList){this.setCheckboxAtIndex(t)}else if(this.isRadioList){this.setRadioAtIndex(t)}else{this.setSingleSelectionAtIndex(t,{forceUpdate:e})}};e.prototype.handleFocusIn=function(t){if(t>=0){this.focusedItemIndex=t;this.adapter.setAttributeForElementIndex(t,"tabindex","0");this.adapter.setTabIndexForListItemChildren(t,"0")}};e.prototype.handleFocusOut=function(t){var i=this;if(t>=0){this.adapter.setAttributeForElementIndex(t,"tabindex","-1");this.adapter.setTabIndexForListItemChildren(t,"-1")}setTimeout((function(){if(!i.adapter.isFocusInsideList()){i.setTabindexToFirstSelectedOrFocusedItem()}}),0)};e.prototype.handleKeydown=function(t,i,n){var e=this;var r=f(t)==="ArrowLeft";var s=f(t)==="ArrowUp";var u=f(t)==="ArrowRight";var o=f(t)==="ArrowDown";var h=f(t)==="Home";var a=f(t)==="End";var c=f(t)==="Enter";var d=f(t)==="Spacebar";var l=t.key==="A"||t.key==="a";if(this.adapter.isRootFocused()){if(s||a){t.preventDefault();this.focusLastElement()}else if(o||h){t.preventDefault();this.focusFirstElement()}if(this.hasTypeahead){var v={event:t,focusItemAtIndex:function(t){e.focusItemAtIndex(t)},focusedItemIndex:-1,isTargetListItem:i,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return e.adapter.listItemAtIndexHasClass(t,b.LIST_ITEM_DISABLED_CLASS)}};w(v,this.typeaheadState)}return}var m=this.adapter.getFocusedElementIndex();if(m===-1){m=n;if(m<0){return}}if(this.isVertical&&o||!this.isVertical&&u){_(t);this.focusNextElement(m)}else if(this.isVertical&&s||!this.isVertical&&r){_(t);this.focusPrevElement(m)}else if(h){_(t);this.focusFirstElement()}else if(a){_(t);this.focusLastElement()}else if(l&&t.ctrlKey&&this.isCheckboxList){t.preventDefault();this.toggleAll(this.selectedIndex===T.UNSET_INDEX?[]:this.selectedIndex)}else if(c||d){if(i){var I=t.target;if(I&&I.tagName==="A"&&c){return}_(t);if(this.adapter.listItemAtIndexHasClass(m,b.LIST_ITEM_DISABLED_CLASS)){return}if(!this.isTypeaheadInProgress()){if(this.isSelectableList()){this.setSelectedIndexOnAction(m)}this.adapter.notifyAction(m)}}}if(this.hasTypeahead){var v={event:t,focusItemAtIndex:function(t){e.focusItemAtIndex(t)},focusedItemIndex:this.focusedItemIndex,isTargetListItem:i,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return e.adapter.listItemAtIndexHasClass(t,b.LIST_ITEM_DISABLED_CLASS)}};w(v,this.typeaheadState)}};e.prototype.handleClick=function(t,i){if(t===T.UNSET_INDEX){return}if(this.adapter.listItemAtIndexHasClass(t,b.LIST_ITEM_DISABLED_CLASS)){return}if(this.isSelectableList()){this.setSelectedIndexOnAction(t,i)}this.adapter.notifyAction(t)};e.prototype.focusNextElement=function(t){var i=this.adapter.getListItemCount();var n=t+1;if(n>=i){if(this.wrapFocus){n=0}else{return t}}this.focusItemAtIndex(n);return n};e.prototype.focusPrevElement=function(t){var i=t-1;if(i<0){if(this.wrapFocus){i=this.adapter.getListItemCount()-1}else{return t}}this.focusItemAtIndex(i);return i};e.prototype.focusFirstElement=function(){this.focusItemAtIndex(0);return 0};e.prototype.focusLastElement=function(){var t=this.adapter.getListItemCount()-1;this.focusItemAtIndex(t);return t};e.prototype.focusInitialElement=function(){var t=this.getFirstSelectedOrFocusedItemIndex();this.focusItemAtIndex(t);return t};e.prototype.setEnabled=function(t,i){if(!this.isIndexValid(t)){return}if(i){this.adapter.removeClassForElementIndex(t,b.LIST_ITEM_DISABLED_CLASS);this.adapter.setAttributeForElementIndex(t,A.ARIA_DISABLED,"false")}else{this.adapter.addClassForElementIndex(t,b.LIST_ITEM_DISABLED_CLASS);this.adapter.setAttributeForElementIndex(t,A.ARIA_DISABLED,"true")}};e.prototype.setSingleSelectionAtIndex=function(t,i){var n=i===void 0?{}:i,e=n.forceUpdate;if(this.selectedIndex===t&&!e){return}var r=b.LIST_ITEM_SELECTED_CLASS;if(this.useActivatedClass){r=b.LIST_ITEM_ACTIVATED_CLASS}if(this.selectedIndex!==T.UNSET_INDEX){this.adapter.removeClassForElementIndex(this.selectedIndex,r)}this.setAriaForSingleSelectionAtIndex(t);this.setTabindexAtIndex(t);if(t!==T.UNSET_INDEX){this.adapter.addClassForElementIndex(t,r)}this.selectedIndex=t};e.prototype.setAriaForSingleSelectionAtIndex=function(t){if(this.selectedIndex===T.UNSET_INDEX){this.ariaCurrentAttrValue=this.adapter.getAttributeForElementIndex(t,A.ARIA_CURRENT)}var i=this.ariaCurrentAttrValue!==null;var n=i?A.ARIA_CURRENT:A.ARIA_SELECTED;if(this.selectedIndex!==T.UNSET_INDEX){this.adapter.setAttributeForElementIndex(this.selectedIndex,n,"false")}if(t!==T.UNSET_INDEX){var e=i?this.ariaCurrentAttrValue:"true";this.adapter.setAttributeForElementIndex(t,n,e)}};e.prototype.getSelectionAttribute=function(){return this.useSelectedAttr?A.ARIA_SELECTED:A.ARIA_CHECKED};e.prototype.setRadioAtIndex=function(t){var i=this.getSelectionAttribute();this.adapter.setCheckedCheckboxOrRadioAtIndex(t,true);if(this.selectedIndex!==T.UNSET_INDEX){this.adapter.setAttributeForElementIndex(this.selectedIndex,i,"false")}this.adapter.setAttributeForElementIndex(t,i,"true");this.selectedIndex=t};e.prototype.setCheckboxAtIndex=function(t){var i=this.getSelectionAttribute();for(var n=0;n<this.adapter.getListItemCount();n++){var e=false;if(t.indexOf(n)>=0){e=true}this.adapter.setCheckedCheckboxOrRadioAtIndex(n,e);this.adapter.setAttributeForElementIndex(n,i,e?"true":"false")}this.selectedIndex=t};e.prototype.setTabindexAtIndex=function(t){if(this.focusedItemIndex===T.UNSET_INDEX&&t!==0){this.adapter.setAttributeForElementIndex(0,"tabindex","-1")}else if(this.focusedItemIndex>=0&&this.focusedItemIndex!==t){this.adapter.setAttributeForElementIndex(this.focusedItemIndex,"tabindex","-1")}if(!(this.selectedIndex instanceof Array)&&this.selectedIndex!==t){this.adapter.setAttributeForElementIndex(this.selectedIndex,"tabindex","-1")}if(t!==T.UNSET_INDEX){this.adapter.setAttributeForElementIndex(t,"tabindex","0")}};e.prototype.isSelectableList=function(){return this.isSingleSelectionList||this.isCheckboxList||this.isRadioList};e.prototype.setTabindexToFirstSelectedOrFocusedItem=function(){var t=this.getFirstSelectedOrFocusedItemIndex();this.setTabindexAtIndex(t)};e.prototype.getFirstSelectedOrFocusedItemIndex=function(){if(!this.isSelectableList()){return Math.max(this.focusedItemIndex,0)}if(typeof this.selectedIndex==="number"&&this.selectedIndex!==T.UNSET_INDEX){return this.selectedIndex}if(D(this.selectedIndex)&&this.selectedIndex.length>0){return this.selectedIndex.reduce((function(t,i){return Math.min(t,i)}))}return 0};e.prototype.isIndexValid=function(t){var i=this;if(t instanceof Array){if(!this.isCheckboxList){throw new Error("MDCListFoundation: Array of index is only supported for checkbox based list")}if(t.length===0){return true}else{return t.some((function(t){return i.isIndexInRange(t)}))}}else if(typeof t==="number"){if(this.isCheckboxList){throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: "+t)}return this.isIndexInRange(t)||this.isSingleSelectionList&&t===T.UNSET_INDEX}else{return false}};e.prototype.isIndexInRange=function(t){var i=this.adapter.getListItemCount();return t>=0&&t<i};e.prototype.setSelectedIndexOnAction=function(t,i){if(i===void 0){i=true}if(this.isCheckboxList){this.toggleCheckboxAtIndex(t,i)}else{this.setSelectedIndex(t)}};e.prototype.toggleCheckboxAtIndex=function(t,i){var n=this.getSelectionAttribute();var e=this.adapter.isCheckboxCheckedAtIndex(t);if(i){e=!e;this.adapter.setCheckedCheckboxOrRadioAtIndex(t,e)}this.adapter.setAttributeForElementIndex(t,n,e?"true":"false");var r=this.selectedIndex===T.UNSET_INDEX?[]:this.selectedIndex.slice();if(e){r.push(t)}else{r=r.filter((function(i){return i!==t}))}this.selectedIndex=r};e.prototype.focusItemAtIndex=function(t){this.adapter.focusItemAtIndex(t);this.focusedItemIndex=t};e.prototype.toggleAll=function(t){var i=this.adapter.getListItemCount();if(t.length===i){this.setCheckboxAtIndex([])}else{var n=[];for(var e=0;e<i;e++){if(!this.adapter.listItemAtIndexHasClass(e,b.LIST_ITEM_DISABLED_CLASS)||t.indexOf(e)>-1){n.push(e)}}this.setCheckboxAtIndex(n)}};e.prototype.typeaheadMatchItem=function(t,i,n){var e=this;if(n===void 0){n=false}var r={focusItemAtIndex:function(t){e.focusItemAtIndex(t)},focusedItemIndex:i?i:this.focusedItemIndex,nextChar:t,sortedIndexByFirstChar:this.sortedIndexByFirstChar,skipFocus:n,isItemAtIndexDisabled:function(t){return e.adapter.listItemAtIndexHasClass(t,b.LIST_ITEM_DISABLED_CLASS)}};return g(r,this.typeaheadState)};e.prototype.typeaheadInitSortedIndex=function(){return p(this.adapter.getListItemCount(),this.adapter.getPrimaryTextAtIndex)};e.prototype.clearTypeaheadBuffer=function(){y(this.typeaheadState)};return e}(n);
|
|
133
|
+
*/function P(t){return t instanceof Array}var B=function(n){t(e,n);function e(t){var r=n.call(this,i(i({},e.defaultAdapter),t))||this;r.wrapFocus=false;r.isVertical=true;r.isSingleSelectionList=false;r.selectedIndex=b.UNSET_INDEX;r.focusedItemIndex=b.UNSET_INDEX;r.useActivatedClass=false;r.useSelectedAttr=false;r.ariaCurrentAttrValue=null;r.isCheckboxList=false;r.isRadioList=false;r.hasTypeahead=false;r.typeaheadState=L();r.sortedIndexByFirstChar=new Map;return r}Object.defineProperty(e,"strings",{get:function(){return I},enumerable:false,configurable:true});Object.defineProperty(e,"cssClasses",{get:function(){return m},enumerable:false,configurable:true});Object.defineProperty(e,"numbers",{get:function(){return b},enumerable:false,configurable:true});Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClassForElementIndex:function(){return undefined},focusItemAtIndex:function(){return undefined},getAttributeForElementIndex:function(){return null},getFocusedElementIndex:function(){return 0},getListItemCount:function(){return 0},hasCheckboxAtIndex:function(){return false},hasRadioAtIndex:function(){return false},isCheckboxCheckedAtIndex:function(){return false},isFocusInsideList:function(){return false},isRootFocused:function(){return false},listItemAtIndexHasClass:function(){return false},notifyAction:function(){return undefined},removeClassForElementIndex:function(){return undefined},setAttributeForElementIndex:function(){return undefined},setCheckedCheckboxOrRadioAtIndex:function(){return undefined},setTabIndexForListItemChildren:function(){return undefined},getPrimaryTextAtIndex:function(){return""}}},enumerable:false,configurable:true});e.prototype.layout=function(){if(this.adapter.getListItemCount()===0){return}if(this.adapter.hasCheckboxAtIndex(0)){this.isCheckboxList=true}else if(this.adapter.hasRadioAtIndex(0)){this.isRadioList=true}else{this.maybeInitializeSingleSelection()}if(this.hasTypeahead){this.sortedIndexByFirstChar=this.typeaheadInitSortedIndex()}};e.prototype.getFocusedItemIndex=function(){return this.focusedItemIndex};e.prototype.setWrapFocus=function(t){this.wrapFocus=t};e.prototype.setVerticalOrientation=function(t){this.isVertical=t};e.prototype.setSingleSelection=function(t){this.isSingleSelectionList=t;if(t){this.maybeInitializeSingleSelection();this.selectedIndex=this.getSelectedIndexFromDOM()}};e.prototype.maybeInitializeSingleSelection=function(){var t=this.getSelectedIndexFromDOM();if(t===b.UNSET_INDEX)return;var i=this.adapter.listItemAtIndexHasClass(t,m.LIST_ITEM_ACTIVATED_CLASS);if(i){this.setUseActivatedClass(true)}this.isSingleSelectionList=true;this.selectedIndex=t};e.prototype.getSelectedIndexFromDOM=function(){var t=b.UNSET_INDEX;var i=this.adapter.getListItemCount();for(var n=0;n<i;n++){var e=this.adapter.listItemAtIndexHasClass(n,m.LIST_ITEM_SELECTED_CLASS);var r=this.adapter.listItemAtIndexHasClass(n,m.LIST_ITEM_ACTIVATED_CLASS);if(!(e||r)){continue}t=n;break}return t};e.prototype.setHasTypeahead=function(t){this.hasTypeahead=t;if(t){this.sortedIndexByFirstChar=this.typeaheadInitSortedIndex()}};e.prototype.isTypeaheadInProgress=function(){return this.hasTypeahead&&F(this.typeaheadState)};e.prototype.setUseActivatedClass=function(t){this.useActivatedClass=t};e.prototype.setUseSelectedAttribute=function(t){this.useSelectedAttr=t};e.prototype.getSelectedIndex=function(){return this.selectedIndex};e.prototype.setSelectedIndex=function(t,i){var n=i===void 0?{}:i,e=n.forceUpdate;if(!this.isIndexValid(t)){return}if(this.isCheckboxList){this.setCheckboxAtIndex(t)}else if(this.isRadioList){this.setRadioAtIndex(t)}else{this.setSingleSelectionAtIndex(t,{forceUpdate:e})}};e.prototype.handleFocusIn=function(t){if(t>=0){this.focusedItemIndex=t;this.adapter.setAttributeForElementIndex(t,"tabindex","0");this.adapter.setTabIndexForListItemChildren(t,"0")}};e.prototype.handleFocusOut=function(t){var i=this;if(t>=0){this.adapter.setAttributeForElementIndex(t,"tabindex","-1");this.adapter.setTabIndexForListItemChildren(t,"-1")}setTimeout((function(){if(!i.adapter.isFocusInsideList()){i.setTabindexToFirstSelectedOrFocusedItem()}}),0)};e.prototype.handleKeydown=function(t,i,n){var e=this;var r=R(t)==="ArrowLeft";var s=R(t)==="ArrowUp";var u=R(t)==="ArrowRight";var o=R(t)==="ArrowDown";var f=R(t)==="Home";var a=R(t)==="End";var h=R(t)==="Enter";var c=R(t)==="Spacebar";var d=t.key==="A"||t.key==="a";if(this.adapter.isRootFocused()){if(s||a){t.preventDefault();this.focusLastElement()}else if(o||f){t.preventDefault();this.focusFirstElement()}if(this.hasTypeahead){var l={event:t,focusItemAtIndex:function(t){e.focusItemAtIndex(t)},focusedItemIndex:-1,isTargetListItem:i,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return e.adapter.listItemAtIndexHasClass(t,m.LIST_ITEM_DISABLED_CLASS)}};k(l,this.typeaheadState)}return}var v=this.adapter.getFocusedElementIndex();if(v===-1){v=n;if(v<0){return}}if(this.isVertical&&o||!this.isVertical&&u){S(t);this.focusNextElement(v)}else if(this.isVertical&&s||!this.isVertical&&r){S(t);this.focusPrevElement(v)}else if(f){S(t);this.focusFirstElement()}else if(a){S(t);this.focusLastElement()}else if(d&&t.ctrlKey&&this.isCheckboxList){t.preventDefault();this.toggleAll(this.selectedIndex===b.UNSET_INDEX?[]:this.selectedIndex)}else if(h||c){if(i){var E=t.target;if(E&&E.tagName==="A"&&h){return}S(t);if(this.adapter.listItemAtIndexHasClass(v,m.LIST_ITEM_DISABLED_CLASS)){return}if(!this.isTypeaheadInProgress()){if(this.isSelectableList()){this.setSelectedIndexOnAction(v)}this.adapter.notifyAction(v)}}}if(this.hasTypeahead){var l={event:t,focusItemAtIndex:function(t){e.focusItemAtIndex(t)},focusedItemIndex:this.focusedItemIndex,isTargetListItem:i,sortedIndexByFirstChar:this.sortedIndexByFirstChar,isItemAtIndexDisabled:function(t){return e.adapter.listItemAtIndexHasClass(t,m.LIST_ITEM_DISABLED_CLASS)}};k(l,this.typeaheadState)}};e.prototype.handleClick=function(t,i){if(t===b.UNSET_INDEX){return}if(this.adapter.listItemAtIndexHasClass(t,m.LIST_ITEM_DISABLED_CLASS)){return}if(this.isSelectableList()){this.setSelectedIndexOnAction(t,i)}this.adapter.notifyAction(t)};e.prototype.focusNextElement=function(t){var i=this.adapter.getListItemCount();var n=t+1;if(n>=i){if(this.wrapFocus){n=0}else{return t}}this.focusItemAtIndex(n);return n};e.prototype.focusPrevElement=function(t){var i=t-1;if(i<0){if(this.wrapFocus){i=this.adapter.getListItemCount()-1}else{return t}}this.focusItemAtIndex(i);return i};e.prototype.focusFirstElement=function(){this.focusItemAtIndex(0);return 0};e.prototype.focusLastElement=function(){var t=this.adapter.getListItemCount()-1;this.focusItemAtIndex(t);return t};e.prototype.focusInitialElement=function(){var t=this.getFirstSelectedOrFocusedItemIndex();this.focusItemAtIndex(t);return t};e.prototype.setEnabled=function(t,i){if(!this.isIndexValid(t)){return}if(i){this.adapter.removeClassForElementIndex(t,m.LIST_ITEM_DISABLED_CLASS);this.adapter.setAttributeForElementIndex(t,I.ARIA_DISABLED,"false")}else{this.adapter.addClassForElementIndex(t,m.LIST_ITEM_DISABLED_CLASS);this.adapter.setAttributeForElementIndex(t,I.ARIA_DISABLED,"true")}};e.prototype.setSingleSelectionAtIndex=function(t,i){var n=i===void 0?{}:i,e=n.forceUpdate;if(this.selectedIndex===t&&!e){return}var r=m.LIST_ITEM_SELECTED_CLASS;if(this.useActivatedClass){r=m.LIST_ITEM_ACTIVATED_CLASS}if(this.selectedIndex!==b.UNSET_INDEX){this.adapter.removeClassForElementIndex(this.selectedIndex,r)}this.setAriaForSingleSelectionAtIndex(t);this.setTabindexAtIndex(t);if(t!==b.UNSET_INDEX){this.adapter.addClassForElementIndex(t,r)}this.selectedIndex=t};e.prototype.setAriaForSingleSelectionAtIndex=function(t){if(this.selectedIndex===b.UNSET_INDEX){this.ariaCurrentAttrValue=this.adapter.getAttributeForElementIndex(t,I.ARIA_CURRENT)}var i=this.ariaCurrentAttrValue!==null;var n=i?I.ARIA_CURRENT:I.ARIA_SELECTED;if(this.selectedIndex!==b.UNSET_INDEX){this.adapter.setAttributeForElementIndex(this.selectedIndex,n,"false")}if(t!==b.UNSET_INDEX){var e=i?this.ariaCurrentAttrValue:"true";this.adapter.setAttributeForElementIndex(t,n,e)}};e.prototype.getSelectionAttribute=function(){return this.useSelectedAttr?I.ARIA_SELECTED:I.ARIA_CHECKED};e.prototype.setRadioAtIndex=function(t){var i=this.getSelectionAttribute();this.adapter.setCheckedCheckboxOrRadioAtIndex(t,true);if(this.selectedIndex!==b.UNSET_INDEX){this.adapter.setAttributeForElementIndex(this.selectedIndex,i,"false")}this.adapter.setAttributeForElementIndex(t,i,"true");this.selectedIndex=t};e.prototype.setCheckboxAtIndex=function(t){var i=this.getSelectionAttribute();for(var n=0;n<this.adapter.getListItemCount();n++){var e=false;if(t.indexOf(n)>=0){e=true}this.adapter.setCheckedCheckboxOrRadioAtIndex(n,e);this.adapter.setAttributeForElementIndex(n,i,e?"true":"false")}this.selectedIndex=t};e.prototype.setTabindexAtIndex=function(t){if(this.focusedItemIndex===b.UNSET_INDEX&&t!==0){this.adapter.setAttributeForElementIndex(0,"tabindex","-1")}else if(this.focusedItemIndex>=0&&this.focusedItemIndex!==t){this.adapter.setAttributeForElementIndex(this.focusedItemIndex,"tabindex","-1")}if(!(this.selectedIndex instanceof Array)&&this.selectedIndex!==t){this.adapter.setAttributeForElementIndex(this.selectedIndex,"tabindex","-1")}if(t!==b.UNSET_INDEX){this.adapter.setAttributeForElementIndex(t,"tabindex","0")}};e.prototype.isSelectableList=function(){return this.isSingleSelectionList||this.isCheckboxList||this.isRadioList};e.prototype.setTabindexToFirstSelectedOrFocusedItem=function(){var t=this.getFirstSelectedOrFocusedItemIndex();this.setTabindexAtIndex(t)};e.prototype.getFirstSelectedOrFocusedItemIndex=function(){if(!this.isSelectableList()){return Math.max(this.focusedItemIndex,0)}if(typeof this.selectedIndex==="number"&&this.selectedIndex!==b.UNSET_INDEX){return this.selectedIndex}if(P(this.selectedIndex)&&this.selectedIndex.length>0){return this.selectedIndex.reduce((function(t,i){return Math.min(t,i)}))}return 0};e.prototype.isIndexValid=function(t){var i=this;if(t instanceof Array){if(!this.isCheckboxList){throw new Error("MDCListFoundation: Array of index is only supported for checkbox based list")}if(t.length===0){return true}else{return t.some((function(t){return i.isIndexInRange(t)}))}}else if(typeof t==="number"){if(this.isCheckboxList){throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: "+t)}return this.isIndexInRange(t)||this.isSingleSelectionList&&t===b.UNSET_INDEX}else{return false}};e.prototype.isIndexInRange=function(t){var i=this.adapter.getListItemCount();return t>=0&&t<i};e.prototype.setSelectedIndexOnAction=function(t,i){if(i===void 0){i=true}if(this.isCheckboxList){this.toggleCheckboxAtIndex(t,i)}else{this.setSelectedIndex(t)}};e.prototype.toggleCheckboxAtIndex=function(t,i){var n=this.getSelectionAttribute();var e=this.adapter.isCheckboxCheckedAtIndex(t);if(i){e=!e;this.adapter.setCheckedCheckboxOrRadioAtIndex(t,e)}this.adapter.setAttributeForElementIndex(t,n,e?"true":"false");var r=this.selectedIndex===b.UNSET_INDEX?[]:this.selectedIndex.slice();if(e){r.push(t)}else{r=r.filter((function(i){return i!==t}))}this.selectedIndex=r};e.prototype.focusItemAtIndex=function(t){this.adapter.focusItemAtIndex(t);this.focusedItemIndex=t};e.prototype.toggleAll=function(t){var i=this.adapter.getListItemCount();if(t.length===i){this.setCheckboxAtIndex([])}else{var n=[];for(var e=0;e<i;e++){if(!this.adapter.listItemAtIndexHasClass(e,m.LIST_ITEM_DISABLED_CLASS)||t.indexOf(e)>-1){n.push(e)}}this.setCheckboxAtIndex(n)}};e.prototype.typeaheadMatchItem=function(t,i,n){var e=this;if(n===void 0){n=false}var r={focusItemAtIndex:function(t){e.focusItemAtIndex(t)},focusedItemIndex:i?i:this.focusedItemIndex,nextChar:t,sortedIndexByFirstChar:this.sortedIndexByFirstChar,skipFocus:n,isItemAtIndexDisabled:function(t){return e.adapter.listItemAtIndexHasClass(t,m.LIST_ITEM_DISABLED_CLASS)}};return D(r,this.typeaheadState)};e.prototype.typeaheadInitSortedIndex=function(){return w(this.adapter.getListItemCount(),this.adapter.getPrimaryTextAtIndex)};e.prototype.clearTypeaheadBuffer=function(){M(this.typeaheadState)};return e}(n);
|
|
112
134
|
/**
|
|
113
135
|
* @license
|
|
114
136
|
* Copyright 2018 Google Inc.
|
|
@@ -130,7 +152,7 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
130
152
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
131
153
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
132
154
|
* THE SOFTWARE.
|
|
133
|
-
*/var
|
|
155
|
+
*/var H=function(i){t(n,i);function n(){return i!==null&&i.apply(this,arguments)||this}Object.defineProperty(n.prototype,"vertical",{set:function(t){this.foundation.setVerticalOrientation(t)},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"listElements",{get:function(){return Array.from(this.root.querySelectorAll("."+this.classNameMap[m.LIST_ITEM_CLASS]))},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"wrapFocus",{set:function(t){this.foundation.setWrapFocus(t)},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"typeaheadInProgress",{get:function(){return this.foundation.isTypeaheadInProgress()},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"hasTypeahead",{set:function(t){this.foundation.setHasTypeahead(t)},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"singleSelection",{set:function(t){this.foundation.setSingleSelection(t)},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"selectedIndex",{get:function(){return this.foundation.getSelectedIndex()},set:function(t){this.foundation.setSelectedIndex(t)},enumerable:false,configurable:true});n.attachTo=function(t){return new n(t)};n.prototype.initialSyncWithDOM=function(){this.isEvolutionEnabled=T in this.root.dataset;if(this.isEvolutionEnabled){this.classNameMap=E}else if(s(this.root,I.DEPRECATED_SELECTOR)){this.classNameMap=A}else{this.classNameMap=Object.values(m).reduce((function(t,i){t[i]=i;return t}),{})}this.handleClick=this.handleClickEvent.bind(this);this.handleKeydown=this.handleKeydownEvent.bind(this);this.focusInEventListener=this.handleFocusInEvent.bind(this);this.focusOutEventListener=this.handleFocusOutEvent.bind(this);this.listen("keydown",this.handleKeydown);this.listen("click",this.handleClick);this.listen("focusin",this.focusInEventListener);this.listen("focusout",this.focusOutEventListener);this.layout();this.initializeListType();this.ensureFocusable()};n.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown);this.unlisten("click",this.handleClick);this.unlisten("focusin",this.focusInEventListener);this.unlisten("focusout",this.focusOutEventListener)};n.prototype.layout=function(){var t=this.root.getAttribute(I.ARIA_ORIENTATION);this.vertical=t!==I.ARIA_ORIENTATION_HORIZONTAL;var i="."+this.classNameMap[m.LIST_ITEM_CLASS]+":not([tabindex])";var n=I.FOCUSABLE_CHILD_ELEMENTS;var e=this.root.querySelectorAll(i);if(e.length){Array.prototype.forEach.call(e,(function(t){t.setAttribute("tabindex","-1")}))}var r=this.root.querySelectorAll(n);if(r.length){Array.prototype.forEach.call(r,(function(t){t.setAttribute("tabindex","-1")}))}if(this.isEvolutionEnabled){this.foundation.setUseSelectedAttribute(true)}this.foundation.layout()};n.prototype.getPrimaryText=function(t){var i;var n=t.querySelector("."+this.classNameMap[m.LIST_ITEM_PRIMARY_TEXT_CLASS]);if(this.isEvolutionEnabled||n){return(i=n===null||n===void 0?void 0:n.textContent)!==null&&i!==void 0?i:""}var e=t.querySelector("."+this.classNameMap[m.LIST_ITEM_TEXT_CLASS]);return e&&e.textContent||""};n.prototype.initializeListType=function(){var t=this;this.isInteractive=s(this.root,I.ARIA_INTERACTIVE_ROLES_SELECTOR);if(this.isEvolutionEnabled&&this.isInteractive){var i=Array.from(this.root.querySelectorAll(I.SELECTED_ITEM_SELECTOR),(function(i){return t.listElements.indexOf(i)}));if(s(this.root,I.ARIA_MULTI_SELECTABLE_SELECTOR)){this.selectedIndex=i}else if(i.length>0){this.selectedIndex=i[0]}return}var n=this.root.querySelectorAll(I.ARIA_ROLE_CHECKBOX_SELECTOR);var e=this.root.querySelector(I.ARIA_CHECKED_RADIO_SELECTOR);if(n.length){var r=this.root.querySelectorAll(I.ARIA_CHECKED_CHECKBOX_SELECTOR);this.selectedIndex=Array.from(r,(function(i){return t.listElements.indexOf(i)}))}else if(e){this.selectedIndex=this.listElements.indexOf(e)}};n.prototype.setEnabled=function(t,i){this.foundation.setEnabled(t,i)};n.prototype.typeaheadMatchItem=function(t,i){return this.foundation.typeaheadMatchItem(t,i,true)};n.prototype.getDefaultFoundation=function(){var t=this;var i={addClassForElementIndex:function(i,n){var e=t.listElements[i];if(e){e.classList.add(t.classNameMap[n])}},focusItemAtIndex:function(i){var n=t.listElements[i];if(n){n.focus()}},getAttributeForElementIndex:function(i,n){return t.listElements[i].getAttribute(n)},getFocusedElementIndex:function(){return t.listElements.indexOf(document.activeElement)},getListItemCount:function(){return t.listElements.length},getPrimaryTextAtIndex:function(i){return t.getPrimaryText(t.listElements[i])},hasCheckboxAtIndex:function(i){var n=t.listElements[i];return!!n.querySelector(I.CHECKBOX_SELECTOR)},hasRadioAtIndex:function(i){var n=t.listElements[i];return!!n.querySelector(I.RADIO_SELECTOR)},isCheckboxCheckedAtIndex:function(i){var n=t.listElements[i];var e=n.querySelector(I.CHECKBOX_SELECTOR);return e.checked},isFocusInsideList:function(){return t.root!==document.activeElement&&t.root.contains(document.activeElement)},isRootFocused:function(){return document.activeElement===t.root},listItemAtIndexHasClass:function(i,n){return t.listElements[i].classList.contains(t.classNameMap[n])},notifyAction:function(i){t.emit(I.ACTION_EVENT,{index:i},true)},removeClassForElementIndex:function(i,n){var e=t.listElements[i];if(e){e.classList.remove(t.classNameMap[n])}},setAttributeForElementIndex:function(i,n,e){var r=t.listElements[i];if(r){r.setAttribute(n,e)}},setCheckedCheckboxOrRadioAtIndex:function(i,n){var e=t.listElements[i];var r=e.querySelector(I.CHECKBOX_RADIO_SELECTOR);r.checked=n;var s=document.createEvent("Event");s.initEvent("change",true,true);r.dispatchEvent(s)},setTabIndexForListItemChildren:function(i,n){var e=t.listElements[i];var r=I.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;Array.prototype.forEach.call(e.querySelectorAll(r),(function(t){t.setAttribute("tabindex",n)}))}};return new B(i)};n.prototype.ensureFocusable=function(){if(this.isEvolutionEnabled&&this.isInteractive){if(!this.root.querySelector("."+this.classNameMap[m.LIST_ITEM_CLASS]+'[tabindex="0"]')){var t=this.initialFocusIndex();if(t!==-1){this.listElements[t].tabIndex=0}}}};n.prototype.initialFocusIndex=function(){if(this.selectedIndex instanceof Array&&this.selectedIndex.length>0){return this.selectedIndex[0]}if(typeof this.selectedIndex==="number"&&this.selectedIndex!==b.UNSET_INDEX){return this.selectedIndex}var t=this.root.querySelector("."+this.classNameMap[m.LIST_ITEM_CLASS]+":not(."+this.classNameMap[m.LIST_ITEM_DISABLED_CLASS]+")");if(t===null){return-1}return this.getListItemIndex(t)};n.prototype.getListItemIndex=function(t){var i=u(t,"."+this.classNameMap[m.LIST_ITEM_CLASS]+", ."+this.classNameMap[m.ROOT]);if(i&&s(i,"."+this.classNameMap[m.LIST_ITEM_CLASS])){return this.listElements.indexOf(i)}return-1};n.prototype.handleFocusInEvent=function(t){var i=this.getListItemIndex(t.target);this.foundation.handleFocusIn(i)};n.prototype.handleFocusOutEvent=function(t){var i=this.getListItemIndex(t.target);this.foundation.handleFocusOut(i)};n.prototype.handleKeydownEvent=function(t){var i=this.getListItemIndex(t.target);var n=t.target;this.foundation.handleKeydown(t,n.classList.contains(this.classNameMap[m.LIST_ITEM_CLASS]),i)};n.prototype.handleClickEvent=function(t){var i=this.getListItemIndex(t.target);var n=t.target;var e=!s(n,I.CHECKBOX_RADIO_SELECTOR);this.foundation.handleClick(i,e)};return n}(e);
|
|
134
156
|
/**
|
|
135
157
|
* @license
|
|
136
158
|
* Copyright 2018 Google Inc.
|
|
@@ -152,7 +174,7 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
152
174
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
153
175
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
154
176
|
* THE SOFTWARE.
|
|
155
|
-
*/var
|
|
177
|
+
*/var U=function(n){t(e,n);function e(t){var r=n.call(this,i(i({},e.defaultAdapter),t))||this;r.isSurfaceOpen=false;r.isQuickOpen=false;r.isHoistedElement=false;r.isFixedPosition=false;r.isHorizontallyCenteredOnViewport=false;r.maxHeight=0;r.openAnimationEndTimerId=0;r.closeAnimationEndTimerId=0;r.animationRequestId=0;r.anchorCorner=d.TOP_START;r.originCorner=d.TOP_START;r.anchorMargin={top:0,right:0,bottom:0,left:0};r.position={x:0,y:0};return r}Object.defineProperty(e,"cssClasses",{get:function(){return f},enumerable:false,configurable:true});Object.defineProperty(e,"strings",{get:function(){return a},enumerable:false,configurable:true});Object.defineProperty(e,"numbers",{get:function(){return h},enumerable:false,configurable:true});Object.defineProperty(e,"Corner",{get:function(){return d},enumerable:false,configurable:true});Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){return undefined},removeClass:function(){return undefined},hasClass:function(){return false},hasAnchor:function(){return false},isElementInContainer:function(){return false},isFocused:function(){return false},isRtl:function(){return false},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){return undefined},setMaxHeight:function(){return undefined},setTransformOrigin:function(){return undefined},saveFocus:function(){return undefined},restoreFocus:function(){return undefined},notifyClose:function(){return undefined},notifyOpen:function(){return undefined},notifyClosing:function(){return undefined}}},enumerable:false,configurable:true});e.prototype.init=function(){var t=e.cssClasses,i=t.ROOT,n=t.OPEN;if(!this.adapter.hasClass(i)){throw new Error(i+" class required in root element.")}if(this.adapter.hasClass(n)){this.isSurfaceOpen=true}};e.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId);clearTimeout(this.closeAnimationEndTimerId);cancelAnimationFrame(this.animationRequestId)};e.prototype.setAnchorCorner=function(t){this.anchorCorner=t};e.prototype.flipCornerHorizontally=function(){this.originCorner=this.originCorner^c.RIGHT};e.prototype.setAnchorMargin=function(t){this.anchorMargin.top=t.top||0;this.anchorMargin.right=t.right||0;this.anchorMargin.bottom=t.bottom||0;this.anchorMargin.left=t.left||0};e.prototype.setIsHoisted=function(t){this.isHoistedElement=t};e.prototype.setFixedPosition=function(t){this.isFixedPosition=t};e.prototype.isFixed=function(){return this.isFixedPosition};e.prototype.setAbsolutePosition=function(t,i){this.position.x=this.isFinite(t)?t:0;this.position.y=this.isFinite(i)?i:0};e.prototype.setIsHorizontallyCenteredOnViewport=function(t){this.isHorizontallyCenteredOnViewport=t};e.prototype.setQuickOpen=function(t){this.isQuickOpen=t};e.prototype.setMaxHeight=function(t){this.maxHeight=t};e.prototype.isOpen=function(){return this.isSurfaceOpen};e.prototype.open=function(){var t=this;if(this.isSurfaceOpen){return}this.adapter.saveFocus();if(this.isQuickOpen){this.isSurfaceOpen=true;this.adapter.addClass(e.cssClasses.OPEN);this.dimensions=this.adapter.getInnerDimensions();this.autoposition();this.adapter.notifyOpen()}else{this.adapter.addClass(e.cssClasses.ANIMATING_OPEN);this.animationRequestId=requestAnimationFrame((function(){t.dimensions=t.adapter.getInnerDimensions();t.autoposition();t.adapter.addClass(e.cssClasses.OPEN);t.openAnimationEndTimerId=setTimeout((function(){t.openAnimationEndTimerId=0;t.adapter.removeClass(e.cssClasses.ANIMATING_OPEN);t.adapter.notifyOpen()}),h.TRANSITION_OPEN_DURATION)}));this.isSurfaceOpen=true}};e.prototype.close=function(t){var i=this;if(t===void 0){t=false}if(!this.isSurfaceOpen){return}this.adapter.notifyClosing();if(this.isQuickOpen){this.isSurfaceOpen=false;if(!t){this.maybeRestoreFocus()}this.adapter.removeClass(e.cssClasses.OPEN);this.adapter.removeClass(e.cssClasses.IS_OPEN_BELOW);this.adapter.notifyClose();return}this.adapter.addClass(e.cssClasses.ANIMATING_CLOSED);requestAnimationFrame((function(){i.adapter.removeClass(e.cssClasses.OPEN);i.adapter.removeClass(e.cssClasses.IS_OPEN_BELOW);i.closeAnimationEndTimerId=setTimeout((function(){i.closeAnimationEndTimerId=0;i.adapter.removeClass(e.cssClasses.ANIMATING_CLOSED);i.adapter.notifyClose()}),h.TRANSITION_CLOSE_DURATION)}));this.isSurfaceOpen=false;if(!t){this.maybeRestoreFocus()}};e.prototype.handleBodyClick=function(t){var i=t.target;if(this.adapter.isElementInContainer(i)){return}this.close()};e.prototype.handleKeydown=function(t){var i=t.keyCode,n=t.key;var e=n==="Escape"||i===27;if(e){this.close()}};e.prototype.autoposition=function(){var t;this.measurements=this.getAutoLayoutmeasurements();var i=this.getoriginCorner();var n=this.getMenuSurfaceMaxHeight(i);var r=this.hasBit(i,c.BOTTOM)?"bottom":"top";var s=this.hasBit(i,c.RIGHT)?"right":"left";var u=this.getHorizontalOriginOffset(i);var o=this.getVerticalOriginOffset(i);var f=this.measurements,a=f.anchorSize,d=f.surfaceSize;var l=(t={},t[s]=u,t[r]=o,t);if(a.width/d.width>h.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO){s="center"}if(this.isHoistedElement||this.isFixedPosition){this.adjustPositionForHoistedElement(l)}this.adapter.setTransformOrigin(s+" "+r);this.adapter.setPosition(l);this.adapter.setMaxHeight(n?n+"px":"");if(!this.hasBit(i,c.BOTTOM)){this.adapter.addClass(e.cssClasses.IS_OPEN_BELOW)}};e.prototype.getAutoLayoutmeasurements=function(){var t=this.adapter.getAnchorDimensions();var i=this.adapter.getBodyDimensions();var n=this.adapter.getWindowDimensions();var e=this.adapter.getWindowScroll();if(!t){t={top:this.position.y,right:this.position.x,bottom:this.position.y,left:this.position.x,width:0,height:0}}return{anchorSize:t,bodySize:i,surfaceSize:this.dimensions,viewportDistance:{top:t.top,right:n.width-t.right,bottom:n.height-t.bottom,left:t.left},viewportSize:n,windowScroll:e}};e.prototype.getoriginCorner=function(){var t=this.originCorner;var i=this.measurements,n=i.viewportDistance,r=i.anchorSize,s=i.surfaceSize;var u=e.numbers.MARGIN_TO_EDGE;var o=this.hasBit(this.anchorCorner,c.BOTTOM);var f;var a;if(o){f=n.top-u+this.anchorMargin.bottom;a=n.bottom-u-this.anchorMargin.bottom}else{f=n.top-u+this.anchorMargin.top;a=n.bottom-u+r.height-this.anchorMargin.top}var h=a-s.height>0;if(!h&&f>a){t=this.setBit(t,c.BOTTOM)}var d=this.adapter.isRtl();var l=this.hasBit(this.anchorCorner,c.FLIP_RTL);var v=this.hasBit(this.anchorCorner,c.RIGHT)||this.hasBit(t,c.RIGHT);var m=false;if(d&&l){m=!v}else{m=v}var E;var A;if(m){E=n.left+r.width+this.anchorMargin.right;A=n.right-this.anchorMargin.right}else{E=n.left+this.anchorMargin.left;A=n.right+r.width-this.anchorMargin.left}var I=E-s.width>0;var b=A-s.width>0;var T=this.hasBit(t,c.FLIP_RTL)&&this.hasBit(t,c.RIGHT);if(b&&T&&d||!I&&T){t=this.unsetBit(t,c.RIGHT)}else if(I&&m&&d||I&&!m&&v||!b&&E>=A){t=this.setBit(t,c.RIGHT)}return t};e.prototype.getMenuSurfaceMaxHeight=function(t){if(this.maxHeight>0){return this.maxHeight}var i=this.measurements.viewportDistance;var n=0;var r=this.hasBit(t,c.BOTTOM);var s=this.hasBit(this.anchorCorner,c.BOTTOM);var u=e.numbers.MARGIN_TO_EDGE;if(r){n=i.top+this.anchorMargin.top-u;if(!s){n+=this.measurements.anchorSize.height}}else{n=i.bottom-this.anchorMargin.bottom+this.measurements.anchorSize.height-u;if(s){n-=this.measurements.anchorSize.height}}return n};e.prototype.getHorizontalOriginOffset=function(t){var i=this.measurements.anchorSize;var n=this.hasBit(t,c.RIGHT);var e=this.hasBit(this.anchorCorner,c.RIGHT);if(n){var r=e?i.width-this.anchorMargin.left:this.anchorMargin.right;if(this.isHoistedElement||this.isFixedPosition){return r-(this.measurements.viewportSize.width-this.measurements.bodySize.width)}return r}return e?i.width-this.anchorMargin.right:this.anchorMargin.left};e.prototype.getVerticalOriginOffset=function(t){var i=this.measurements.anchorSize;var n=this.hasBit(t,c.BOTTOM);var e=this.hasBit(this.anchorCorner,c.BOTTOM);var r=0;if(n){r=e?i.height-this.anchorMargin.top:-this.anchorMargin.bottom}else{r=e?i.height+this.anchorMargin.bottom:this.anchorMargin.top}return r};e.prototype.adjustPositionForHoistedElement=function(t){var i,n;var e=this.measurements,s=e.windowScroll,u=e.viewportDistance,o=e.surfaceSize,f=e.viewportSize;var a=Object.keys(t);try{for(var h=r(a),c=h.next();!c.done;c=h.next()){var d=c.value;var l=t[d]||0;if(this.isHorizontallyCenteredOnViewport&&(d==="left"||d==="right")){t[d]=(f.width-o.width)/2;continue}l+=u[d];if(!this.isFixedPosition){if(d==="top"){l+=s.y}else if(d==="bottom"){l-=s.y}else if(d==="left"){l+=s.x}else{l-=s.x}}t[d]=l}}catch(t){i={error:t}}finally{try{if(c&&!c.done&&(n=h.return))n.call(h)}finally{if(i)throw i.error}}};e.prototype.maybeRestoreFocus=function(){var t=this;var i=this.adapter.isFocused();var n=document.activeElement&&this.adapter.isElementInContainer(document.activeElement);if(i||n){setTimeout((function(){t.adapter.restoreFocus()}),h.TOUCH_EVENT_WAIT_MS)}};e.prototype.hasBit=function(t,i){return Boolean(t&i)};e.prototype.setBit=function(t,i){return t|i};e.prototype.unsetBit=function(t,i){return t^i};e.prototype.isFinite=function(t){return typeof t==="number"&&isFinite(t)};return e}(n);
|
|
156
178
|
/**
|
|
157
179
|
* @license
|
|
158
180
|
* Copyright 2018 Google Inc.
|
|
@@ -174,5 +196,5 @@ import{_ as t,a as i,M as n,b as e,c as r}from"./p-2ff3f85e.js";import{m as s,c
|
|
|
174
196
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
175
197
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
176
198
|
* THE SOFTWARE.
|
|
177
|
-
*/var
|
|
178
|
-
//# sourceMappingURL=p-
|
|
199
|
+
*/var j=function(i){t(n,i);function n(){return i!==null&&i.apply(this,arguments)||this}n.attachTo=function(t){return new n(t)};n.prototype.initialSyncWithDOM=function(){var t=this;var i=this.root.parentElement;this.anchorElement=i&&i.classList.contains(f.ANCHOR)?i:null;if(this.root.classList.contains(f.FIXED)){this.setFixedPosition(true)}this.handleKeydown=function(i){t.foundation.handleKeydown(i)};this.handleBodyClick=function(i){t.foundation.handleBodyClick(i)};this.registerBodyClickListener=function(){document.body.addEventListener("click",t.handleBodyClick,{capture:true})};this.deregisterBodyClickListener=function(){document.body.removeEventListener("click",t.handleBodyClick,{capture:true})};this.listen("keydown",this.handleKeydown);this.listen(a.OPENED_EVENT,this.registerBodyClickListener);this.listen(a.CLOSED_EVENT,this.deregisterBodyClickListener)};n.prototype.destroy=function(){this.unlisten("keydown",this.handleKeydown);this.unlisten(a.OPENED_EVENT,this.registerBodyClickListener);this.unlisten(a.CLOSED_EVENT,this.deregisterBodyClickListener);i.prototype.destroy.call(this)};n.prototype.isOpen=function(){return this.foundation.isOpen()};n.prototype.open=function(){this.foundation.open()};n.prototype.close=function(t){if(t===void 0){t=false}this.foundation.close(t)};Object.defineProperty(n.prototype,"quickOpen",{set:function(t){this.foundation.setQuickOpen(t)},enumerable:false,configurable:true});n.prototype.setIsHoisted=function(t){this.foundation.setIsHoisted(t)};n.prototype.setMenuSurfaceAnchorElement=function(t){this.anchorElement=t};n.prototype.setFixedPosition=function(t){if(t){this.root.classList.add(f.FIXED)}else{this.root.classList.remove(f.FIXED)}this.foundation.setFixedPosition(t)};n.prototype.setAbsolutePosition=function(t,i){this.foundation.setAbsolutePosition(t,i);this.setIsHoisted(true)};n.prototype.setAnchorCorner=function(t){this.foundation.setAnchorCorner(t)};n.prototype.setAnchorMargin=function(t){this.foundation.setAnchorMargin(t)};n.prototype.getDefaultFoundation=function(){var t=this;var i={addClass:function(i){return t.root.classList.add(i)},removeClass:function(i){return t.root.classList.remove(i)},hasClass:function(i){return t.root.classList.contains(i)},hasAnchor:function(){return!!t.anchorElement},notifyClose:function(){return t.emit(U.strings.CLOSED_EVENT,{})},notifyClosing:function(){t.emit(U.strings.CLOSING_EVENT,{})},notifyOpen:function(){return t.emit(U.strings.OPENED_EVENT,{})},isElementInContainer:function(i){return t.root.contains(i)},isRtl:function(){return getComputedStyle(t.root).getPropertyValue("direction")==="rtl"},setTransformOrigin:function(i){var n=o(window,"transform")+"-origin";t.root.style.setProperty(n,i)},isFocused:function(){return document.activeElement===t.root},saveFocus:function(){t.previousFocus=document.activeElement},restoreFocus:function(){if(t.root.contains(document.activeElement)){if(t.previousFocus&&t.previousFocus.focus){t.previousFocus.focus()}}},getInnerDimensions:function(){return{width:t.root.offsetWidth,height:t.root.offsetHeight}},getAnchorDimensions:function(){return t.anchorElement?t.anchorElement.getBoundingClientRect():null},getWindowDimensions:function(){return{width:window.innerWidth,height:window.innerHeight}},getBodyDimensions:function(){return{width:document.body.clientWidth,height:document.body.clientHeight}},getWindowScroll:function(){return{x:window.pageXOffset,y:window.pageYOffset}},setPosition:function(i){var n=t.root;n.style.left="left"in i?i.left+"px":"";n.style.right="right"in i?i.right+"px":"";n.style.top="top"in i?i.top+"px":"";n.style.bottom="bottom"in i?i.bottom+"px":""},setMaxHeight:function(i){t.root.style.maxHeight=i}};return new U(i)};return n}(e);export{d as C,U as M,B as a,j as b,m as c,H as d,b as n,I as s};
|
|
200
|
+
//# sourceMappingURL=p-f764b655.js.map
|