@material/web 1.5.0 → 1.5.1-nightly.17aa21a.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/dialog/internal/_dialog.scss +1 -0
- package/dialog/internal/dialog-styles.css +1 -1
- package/dialog/internal/dialog-styles.css.map +1 -1
- package/dialog/internal/dialog-styles.js +1 -1
- package/dialog/internal/dialog-styles.js.map +1 -1
- package/package.json +2 -2
- package/select/internal/select.d.ts +1 -1
- package/select/internal/select.js +1 -1
- package/select/internal/select.js.map +1 -1
- package/switch/internal/switch.js +22 -6
- package/switch/internal/switch.js.map +1 -1
- package/tabs/internal/tabs.d.ts +9 -9
- package/tabs/internal/tabs.js +9 -9
- package/tabs/internal/tabs.js.map +1 -1
|
@@ -183,6 +183,7 @@
|
|
|
183
183
|
font-family: map.get($tokens, 'supporting-text-font');
|
|
184
184
|
font-size: map.get($tokens, 'supporting-text-size');
|
|
185
185
|
line-height: map.get($tokens, 'supporting-text-line-height');
|
|
186
|
+
flex: 1;
|
|
186
187
|
font-weight: map.get($tokens, 'supporting-text-weight');
|
|
187
188
|
height: min-content; // Needed for Safari
|
|
188
189
|
position: relative;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{border-start-start-radius:var(--md-dialog-container-shape-start-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-height:140px;min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:none;overflow:visible;padding:0;width:inherit}dialog[open]{display:flex}::backdrop{background:none}.scrim{background:var(--md-sys-color-scrim, #000);display:none;inset:0;opacity:32%;pointer-events:none;position:fixed;z-index:1}:host([open]) .scrim{display:flex}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color, var(--md-sys-color-on-surface, #1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font, var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, Roboto)));font-size:var(--md-dialog-headline-size, var(--md-sys-typescale-headline-small-size, 1.5rem));line-height:var(--md-dialog-headline-line-height, var(--md-sys-typescale-headline-small-line-height, 2rem));font-weight:var(--md-dialog-headline-weight, var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));fill:currentColor;font-size:var(--md-dialog-icon-size, 24px);margin-top:24px;height:var(--md-dialog-icon-size, 24px);width:var(--md-dialog-icon-size, 24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color, var(--md-sys-color-surface-container-high, #ece6f0));border-radius:inherit;content:"";inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:hidden;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--md-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-dialog-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-dialog-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-dialog-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-dialog-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)));height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-headline.show-top-divider .headline md-divider,.has-actions.show-bottom-divider .actions md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media(forced-colors: active){dialog{outline:2px solid WindowText}}/*# sourceMappingURL=dialog-styles.css.map */
|
|
1
|
+
:host{border-start-start-radius:var(--md-dialog-container-shape-start-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-height:140px;min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:none;overflow:visible;padding:0;width:inherit}dialog[open]{display:flex}::backdrop{background:none}.scrim{background:var(--md-sys-color-scrim, #000);display:none;inset:0;opacity:32%;pointer-events:none;position:fixed;z-index:1}:host([open]) .scrim{display:flex}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color, var(--md-sys-color-on-surface, #1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font, var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, Roboto)));font-size:var(--md-dialog-headline-size, var(--md-sys-typescale-headline-small-size, 1.5rem));line-height:var(--md-dialog-headline-line-height, var(--md-sys-typescale-headline-small-line-height, 2rem));font-weight:var(--md-dialog-headline-weight, var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));fill:currentColor;font-size:var(--md-dialog-icon-size, 24px);margin-top:24px;height:var(--md-dialog-icon-size, 24px);width:var(--md-dialog-icon-size, 24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color, var(--md-sys-color-surface-container-high, #ece6f0));border-radius:inherit;content:"";inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:hidden;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--md-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-dialog-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-dialog-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-dialog-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));flex:1;font-weight:var(--md-dialog-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)));height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-headline.show-top-divider .headline md-divider,.has-actions.show-bottom-divider .actions md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media(forced-colors: active){dialog{outline:2px solid WindowText}}/*# sourceMappingURL=dialog-styles.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["_dialog.scss"],"names":[],"mappings":"AAiCE,MACE,uJACA,mJACA,+IACA,mJACA,iBACA,YACA,kCACA,iCACA,iBACA,gBACA,eACA,mBACA,kBAGF,OACE,yBACA,YACA,sBACA,sBACA,eACA,eACA,mBACA,kBACA,mBACA,kBACA,aACA,iBACA,UACA,cAGF,aACE,aAGF,WAEE,gBAGF,OACE,2CACA,aACA,QACA,YACA,oBACA,eACA,UAGF,qBACE,aAGF,GACE,UACA,mBAGF,UACE,mBACA,+EACA,aACA,sBACA,8HACA,8FACA,4GACA,wIACA,kBAGF,gCACE,mBACA,mBACA,sBACA,aACA,QACA,oBAGF,MACE,aAGF,4BACE,0EACA,kBACA,2CACA,gBACA,wCACA,uCAGF,0CACE,uBACA,iBAGF,4CACE,oBAGF,wDACE,gBAGF,WACE,sBACA,aACA,sBAGA,YACA,gBACA,kBACA,qBAGF,mBACE,iGACA,sBACA,WACA,QACA,kBAGF,UACE,aACA,OACA,sBACA,gBAIA,UAGF,sBAKE,kBAGF,SACE,8FACA,kIACA,oGACA,mHACA,4IACA,mBACA,kBAGF,+BACE,sBACA,aAKF,QACE,kBAGF,YACE,MAGF,eACE,SAGF,SACE,kBAGF,+BACE,sBACA,aACA,QACA,yBACA,uBAGF,4CACE,mBAGF,WACE,aACA,kBAGF,yGAEE,aAGF,qBACE,SAGF,oBACE,MAGF,8BACE,OACE","file":"dialog-styles.css"}
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["_dialog.scss"],"names":[],"mappings":"AAiCE,MACE,uJACA,mJACA,+IACA,mJACA,iBACA,YACA,kCACA,iCACA,iBACA,gBACA,eACA,mBACA,kBAGF,OACE,yBACA,YACA,sBACA,sBACA,eACA,eACA,mBACA,kBACA,mBACA,kBACA,aACA,iBACA,UACA,cAGF,aACE,aAGF,WAEE,gBAGF,OACE,2CACA,aACA,QACA,YACA,oBACA,eACA,UAGF,qBACE,aAGF,GACE,UACA,mBAGF,UACE,mBACA,+EACA,aACA,sBACA,8HACA,8FACA,4GACA,wIACA,kBAGF,gCACE,mBACA,mBACA,sBACA,aACA,QACA,oBAGF,MACE,aAGF,4BACE,0EACA,kBACA,2CACA,gBACA,wCACA,uCAGF,0CACE,uBACA,iBAGF,4CACE,oBAGF,wDACE,gBAGF,WACE,sBACA,aACA,sBAGA,YACA,gBACA,kBACA,qBAGF,mBACE,iGACA,sBACA,WACA,QACA,kBAGF,UACE,aACA,OACA,sBACA,gBAIA,UAGF,sBAKE,kBAGF,SACE,8FACA,kIACA,oGACA,mHACA,OACA,4IACA,mBACA,kBAGF,+BACE,sBACA,aAKF,QACE,kBAGF,YACE,MAGF,eACE,SAGF,SACE,kBAGF,+BACE,sBACA,aACA,QACA,yBACA,uBAGF,4CACE,mBAGF,WACE,aACA,kBAGF,yGAEE,aAGF,qBACE,SAGF,oBACE,MAGF,8BACE,OACE","file":"dialog-styles.css"}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
// Generated stylesheet for ./dialog/internal/dialog-styles.css.
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
-
export const styles = css `:host{border-start-start-radius:var(--md-dialog-container-shape-start-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-height:140px;min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:none;overflow:visible;padding:0;width:inherit}dialog[open]{display:flex}::backdrop{background:none}.scrim{background:var(--md-sys-color-scrim, #000);display:none;inset:0;opacity:32%;pointer-events:none;position:fixed;z-index:1}:host([open]) .scrim{display:flex}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color, var(--md-sys-color-on-surface, #1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font, var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, Roboto)));font-size:var(--md-dialog-headline-size, var(--md-sys-typescale-headline-small-size, 1.5rem));line-height:var(--md-dialog-headline-line-height, var(--md-sys-typescale-headline-small-line-height, 2rem));font-weight:var(--md-dialog-headline-weight, var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));fill:currentColor;font-size:var(--md-dialog-icon-size, 24px);margin-top:24px;height:var(--md-dialog-icon-size, 24px);width:var(--md-dialog-icon-size, 24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color, var(--md-sys-color-surface-container-high, #ece6f0));border-radius:inherit;content:"";inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:hidden;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--md-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-dialog-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-dialog-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-dialog-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-dialog-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)));height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-headline.show-top-divider .headline md-divider,.has-actions.show-bottom-divider .actions md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media(forced-colors: active){dialog{outline:2px solid WindowText}}
|
|
8
|
+
export const styles = css `:host{border-start-start-radius:var(--md-dialog-container-shape-start-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-height:140px;min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:none;overflow:visible;padding:0;width:inherit}dialog[open]{display:flex}::backdrop{background:none}.scrim{background:var(--md-sys-color-scrim, #000);display:none;inset:0;opacity:32%;pointer-events:none;position:fixed;z-index:1}:host([open]) .scrim{display:flex}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color, var(--md-sys-color-on-surface, #1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font, var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, Roboto)));font-size:var(--md-dialog-headline-size, var(--md-sys-typescale-headline-small-size, 1.5rem));line-height:var(--md-dialog-headline-line-height, var(--md-sys-typescale-headline-small-line-height, 2rem));font-weight:var(--md-dialog-headline-weight, var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));fill:currentColor;font-size:var(--md-dialog-icon-size, 24px);margin-top:24px;height:var(--md-dialog-icon-size, 24px);width:var(--md-dialog-icon-size, 24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color, var(--md-sys-color-surface-container-high, #ece6f0));border-radius:inherit;content:"";inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:hidden;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--md-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-dialog-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-dialog-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-dialog-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));flex:1;font-weight:var(--md-dialog-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)));height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-headline.show-top-divider .headline md-divider,.has-actions.show-bottom-divider .actions md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media(forced-colors: active){dialog{outline:2px solid WindowText}}
|
|
9
9
|
`;
|
|
10
10
|
//# sourceMappingURL=dialog-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-styles.js","sourceRoot":"","sources":["dialog-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gEAAgE;AAChE,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./dialog/internal/dialog-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{border-start-start-radius:var(--md-dialog-container-shape-start-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-height:140px;min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:none;overflow:visible;padding:0;width:inherit}dialog[open]{display:flex}::backdrop{background:none}.scrim{background:var(--md-sys-color-scrim, #000);display:none;inset:0;opacity:32%;pointer-events:none;position:fixed;z-index:1}:host([open]) .scrim{display:flex}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color, var(--md-sys-color-on-surface, #1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font, var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, Roboto)));font-size:var(--md-dialog-headline-size, var(--md-sys-typescale-headline-small-size, 1.5rem));line-height:var(--md-dialog-headline-line-height, var(--md-sys-typescale-headline-small-line-height, 2rem));font-weight:var(--md-dialog-headline-weight, var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));fill:currentColor;font-size:var(--md-dialog-icon-size, 24px);margin-top:24px;height:var(--md-dialog-icon-size, 24px);width:var(--md-dialog-icon-size, 24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color, var(--md-sys-color-surface-container-high, #ece6f0));border-radius:inherit;content:\"\";inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:hidden;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--md-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-dialog-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-dialog-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-dialog-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-dialog-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)));height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-headline.show-top-divider .headline md-divider,.has-actions.show-bottom-divider .actions md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media(forced-colors: active){dialog{outline:2px solid WindowText}}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"dialog-styles.js","sourceRoot":"","sources":["dialog-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gEAAgE;AAChE,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2024 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./dialog/internal/dialog-styles.css.\nimport {css} from 'lit';\nexport const styles = css`:host{border-start-start-radius:var(--md-dialog-container-shape-start-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start, var(--md-dialog-container-shape, var(--md-sys-shape-corner-extra-large, 28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-height:140px;min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:none;overflow:visible;padding:0;width:inherit}dialog[open]{display:flex}::backdrop{background:none}.scrim{background:var(--md-sys-color-scrim, #000);display:none;inset:0;opacity:32%;pointer-events:none;position:fixed;z-index:1}:host([open]) .scrim{display:flex}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color, var(--md-sys-color-on-surface, #1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font, var(--md-sys-typescale-headline-small-font, var(--md-ref-typeface-brand, Roboto)));font-size:var(--md-dialog-headline-size, var(--md-sys-typescale-headline-small-size, 1.5rem));line-height:var(--md-dialog-headline-line-height, var(--md-sys-typescale-headline-small-line-height, 2rem));font-weight:var(--md-dialog-headline-weight, var(--md-sys-typescale-headline-small-weight, var(--md-ref-typeface-weight-regular, 400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));fill:currentColor;font-size:var(--md-dialog-icon-size, 24px);margin-top:24px;height:var(--md-dialog-icon-size, 24px);width:var(--md-dialog-icon-size, 24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color, var(--md-sys-color-surface-container-high, #ece6f0));border-radius:inherit;content:\"\";inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:hidden;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--md-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-dialog-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-dialog-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-dialog-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));flex:1;font-weight:var(--md-dialog-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)));height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-headline.show-top-divider .headline md-divider,.has-actions.show-bottom-divider .actions md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media(forced-colors: active){dialog{outline:2px solid WindowText}}\n`;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@material/web",
|
|
3
|
-
"version": "1.5.0",
|
|
3
|
+
"version": "1.5.1-nightly.17aa21a.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tslib": "^2.4.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@lit-labs/analyzer": "^0.
|
|
63
|
+
"@lit-labs/analyzer": "^0.12.1",
|
|
64
64
|
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
66
66
|
"@rollup/plugin-terser": "^0.4.4",
|
|
@@ -125,7 +125,7 @@ export declare abstract class Select extends selectBaseClass {
|
|
|
125
125
|
/**
|
|
126
126
|
* Returns an array of selected options.
|
|
127
127
|
*
|
|
128
|
-
* NOTE: md-select only
|
|
128
|
+
* NOTE: md-select only supports single selection.
|
|
129
129
|
*/
|
|
130
130
|
get selectedOptions(): SelectOption[];
|
|
131
131
|
protected abstract readonly fieldTag: StaticValue;
|
|
@@ -79,7 +79,7 @@ export class Select extends selectBaseClass {
|
|
|
79
79
|
/**
|
|
80
80
|
* Returns an array of selected options.
|
|
81
81
|
*
|
|
82
|
-
* NOTE: md-select only
|
|
82
|
+
* NOTE: md-select only supports single selection.
|
|
83
83
|
*/
|
|
84
84
|
get selectedOptions() {
|
|
85
85
|
return (this.getSelectedOptions() ?? []).map(([option]) => option);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["select.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AACxE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B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AACb;IAAhB,KAAK,EAAE;4CAAoD;AAC1B;IAAjC,KAAK,CAAC,QAAQ,CAAC;qCAAuC;AACpB;IAAlC,KAAK,CAAC,SAAS,CAAC;oCAAqC;AACpB;IAAjC,KAAK,CAAC,QAAQ,CAAC;uCAAwC;AAEvC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CACnB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../menu/menu.js';\n\nimport {html, isServer, LitElement, nothing, PropertyValues} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\nimport {html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {Field} from '../../field/internal/field.js';\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../labs/behaviors/element-internals.js';\nimport {\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {\n mixinOnReportValidity,\n onReportValidity,\n} from '../../labs/behaviors/on-report-validity.js';\nimport {SelectValidator} from '../../labs/behaviors/validators/select-validator.js';\nimport {getActiveItem} from '../../list/internal/list-navigation-helpers.js';\nimport {\n CloseMenuEvent,\n FocusState,\n isElementInSubtree,\n isSelectableKey,\n} from '../../menu/internal/controllers/shared.js';\nimport {TYPEAHEAD_RECORD} from '../../menu/internal/controllers/typeaheadController.js';\nimport {DEFAULT_TYPEAHEAD_BUFFER_TIME, Menu} from '../../menu/internal/menu.js';\nimport {SelectOption} from './selectoption/select-option.js';\nimport {\n createRequestDeselectionEvent,\n createRequestSelectionEvent,\n} from './selectoption/selectOptionController.js';\nimport {getSelectedItems, SelectOptionRecord} from './shared.js';\n\nconst VALUE = Symbol('value');\n\n// Separate variable needed for closure.\nconst selectBaseClass = mixinOnReportValidity(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n);\n\n/**\n * @fires change {Event} The native `change` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)\n * --bubbles\n * @fires input {InputEvent} The native `input` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)\n * --bubbles --composed\n * @fires opening {Event} Fired when the select's menu is about to open.\n * @fires opened {Event} Fired when the select's menu has finished animations\n * and opened.\n * @fires closing {Event} Fired when the select's menu is about to close.\n * @fires closed {Event} Fired when the select's menu has finished animations\n * and closed.\n */\nexport abstract class Select extends selectBaseClass {\n static {\n requestUpdateOnAriaChange(Select);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Opens the menu synchronously with no animation.\n */\n @property({type: Boolean}) quick = false;\n\n /**\n * Whether or not the select is required.\n */\n @property({type: Boolean}) required = false;\n\n /**\n * The error message that replaces supporting text when `error` is true. If\n * `errorText` is an empty string, then the supporting text will continue to\n * show.\n *\n * This error message overrides the error message displayed by\n * `reportValidity()`.\n */\n @property({type: String, attribute: 'error-text'}) errorText = '';\n\n /**\n * The floating label for the field.\n */\n @property() label = '';\n\n /**\n * Disables the asterisk on the floating label, when the select is\n * required.\n */\n @property({type: Boolean, attribute: 'no-asterisk'}) noAsterisk = false;\n\n /**\n * Conveys additional information below the select, such as how it should\n * be used.\n */\n @property({type: String, attribute: 'supporting-text'}) supportingText = '';\n\n /**\n * Gets or sets whether or not the select is in a visually invalid state.\n *\n * This error state overrides the error state controlled by\n * `reportValidity()`.\n */\n @property({type: Boolean, reflect: true}) error = false;\n\n /**\n * Whether or not the underlying md-menu should be position: fixed to display\n * in a top-level manner, or position: absolute.\n *\n * position:fixed is useful for cases where select is inside of another\n * element with stacking context and hidden overflows such as `md-dialog`.\n */\n @property({attribute: 'menu-positioning'})\n menuPositioning: 'absolute' | 'fixed' | 'popover' = 'popover';\n\n /**\n * Clamps the menu-width to the width of the select.\n */\n @property({type: Boolean, attribute: 'clamp-menu-width'})\n clampMenuWidth = false;\n\n /**\n * The max time between the keystrokes of the typeahead select / menu behavior\n * before it clears the typeahead buffer.\n */\n @property({type: Number, attribute: 'typeahead-delay'})\n typeaheadDelay = DEFAULT_TYPEAHEAD_BUFFER_TIME;\n\n /**\n * Whether or not the text field has a leading icon. Used for SSR.\n */\n @property({type: Boolean, attribute: 'has-leading-icon'})\n hasLeadingIcon = false;\n\n /**\n * Text to display in the field. Only set for SSR.\n */\n @property({attribute: 'display-text'}) displayText = '';\n\n /**\n * Whether the menu should be aligned to the start or the end of the select's\n * textbox.\n */\n @property({attribute: 'menu-align'}) menuAlign: 'start' | 'end' = 'start';\n\n /**\n * The value of the currently selected option.\n *\n * Note: For SSR, set `[selected]` on the requested option and `displayText`\n * rather than setting `value` setting `value` will incur a DOM query.\n */\n @property()\n get value(): string {\n return this[VALUE];\n }\n\n set value(value: string) {\n if (isServer) return;\n this.lastUserSetValue = value;\n this.select(value);\n }\n\n [VALUE] = '';\n\n get options() {\n // NOTE: this does a DOM query.\n return (this.menu?.items ?? []) as SelectOption[];\n }\n\n /**\n * The index of the currently selected option.\n *\n * Note: For SSR, set `[selected]` on the requested option and `displayText`\n * rather than setting `selectedIndex` setting `selectedIndex` will incur a\n * DOM query.\n */\n @property({type: Number, attribute: 'selected-index'})\n get selectedIndex(): number {\n // tslint:disable-next-line:enforce-name-casing\n const [_option, index] = (this.getSelectedOptions() ?? [])[0] ?? [];\n return index ?? -1;\n }\n\n set selectedIndex(index: number) {\n this.lastUserSetSelectedIndex = index;\n this.selectIndex(index);\n }\n\n /**\n * Returns an array of selected options.\n *\n * NOTE: md-select only suppoprts single selection.\n */\n get selectedOptions() {\n return (this.getSelectedOptions() ?? []).map(([option]) => option);\n }\n\n protected abstract readonly fieldTag: StaticValue;\n\n /**\n * Used for initializing select when the user sets the `value` directly.\n */\n private lastUserSetValue: string | null = null;\n\n /**\n * Used for initializing select when the user sets the `selectedIndex`\n * directly.\n */\n private lastUserSetSelectedIndex: number | null = null;\n\n /**\n * Used for `input` and `change` event change detection.\n */\n private lastSelectedOption: SelectOption | null = null;\n\n // tslint:disable-next-line:enforce-name-casing\n private lastSelectedOptionRecords: SelectOptionRecord[] = [];\n\n /**\n * Whether or not a native error has been reported via `reportValidity()`.\n */\n @state() private nativeError = false;\n\n /**\n * The validation message displayed from a native error via\n * `reportValidity()`.\n */\n @state() private nativeErrorText = '';\n private get hasError() {\n return this.error || this.nativeError;\n }\n\n @state() private focused = false;\n @state() private open = false;\n @state() private defaultFocus: FocusState = FocusState.NONE;\n @query('.field') private readonly field!: Field | null;\n @query('md-menu') private readonly menu!: Menu | null;\n @query('#label') private readonly labelEl!: HTMLElement;\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly leadingIcons!: Element[];\n // Have to keep track of previous open because it's state and private and thus\n // cannot be tracked in PropertyValues<this> map.\n private prevOpen = this.open;\n private selectWidth = 0;\n\n constructor() {\n super();\n if (isServer) {\n return;\n }\n\n this.addEventListener('focus', this.handleFocus.bind(this));\n this.addEventListener('blur', this.handleBlur.bind(this));\n }\n\n /**\n * Selects an option given the value of the option, and updates MdSelect's\n * value.\n */\n select(value: string) {\n const optionToSelect = this.options.find(\n (option) => option.value === value,\n );\n if (optionToSelect) {\n this.selectItem(optionToSelect);\n }\n }\n\n /**\n * Selects an option given the index of the option, and updates MdSelect's\n * value.\n */\n selectIndex(index: number) {\n const optionToSelect = this.options[index];\n if (optionToSelect) {\n this.selectItem(optionToSelect);\n }\n }\n\n /**\n * Reset the select to its default value.\n */\n reset() {\n for (const option of this.options) {\n option.selected = option.hasAttribute('selected');\n }\n\n this.updateValueAndDisplayText();\n this.nativeError = false;\n this.nativeErrorText = '';\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n // Prevent default pop-up behavior.\n invalidEvent?.preventDefault();\n\n const prevMessage = this.getErrorText();\n this.nativeError = !!invalidEvent;\n this.nativeErrorText = this.validationMessage;\n\n if (prevMessage === this.getErrorText()) {\n this.field?.reannounceError();\n }\n }\n\n protected override update(changed: PropertyValues<Select>) {\n // In SSR the options will be ready to query, so try to figure out what\n // the value and display text should be.\n if (!this.hasUpdated) {\n this.initUserSelection();\n }\n\n // We have just opened the menu.\n // We are only able to check for the select's rect in `update()` instead of\n // having to wait for `updated()` because the menu can never be open on\n // first render since it is not settable and Lit SSR does not support click\n // events which would open the menu.\n if (this.prevOpen !== this.open && this.open) {\n const selectRect = this.getBoundingClientRect();\n this.selectWidth = selectRect.width;\n }\n\n this.prevOpen = this.open;\n super.update(changed);\n }\n\n protected override render() {\n return html`\n <span\n class=\"select ${classMap(this.getRenderClasses())}\"\n @focusout=${this.handleFocusout}>\n ${this.renderField()} ${this.renderMenu()}\n </span>\n `;\n }\n\n protected override async firstUpdated(changed: PropertyValues<Select>) {\n await this.menu?.updateComplete;\n // If this has been handled on update already due to SSR, try again.\n if (!this.lastSelectedOptionRecords.length) {\n this.initUserSelection();\n }\n\n // Case for when the DOM is streaming, there are no children, and a child\n // has [selected] set on it, we need to wait for DOM to render something.\n if (\n !this.lastSelectedOptionRecords.length &&\n !isServer &&\n !this.options.length\n ) {\n setTimeout(() => {\n this.updateValueAndDisplayText();\n });\n }\n\n super.firstUpdated(changed);\n }\n\n private getRenderClasses(): ClassInfo {\n return {\n 'disabled': this.disabled,\n 'error': this.error,\n 'open': this.open,\n };\n }\n\n private renderField() {\n return staticHtml`\n <${this.fieldTag}\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n part=\"field\"\n id=\"field\"\n tabindex=${this.disabled ? '-1' : '0'}\n aria-label=${(this as ARIAMixinStrict).ariaLabel || nothing}\n aria-describedby=\"description\"\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-controls=\"listbox\"\n class=\"field\"\n label=${this.label}\n ?no-asterisk=${this.noAsterisk}\n .focused=${this.focused || this.open}\n .populated=${!!this.displayText}\n .disabled=${this.disabled}\n .required=${this.required}\n .error=${this.hasError}\n ?has-start=${this.hasLeadingIcon}\n has-end\n supporting-text=${this.supportingText}\n error-text=${this.getErrorText()}\n @keydown=${this.handleKeydown}\n @click=${this.handleClick}>\n ${this.renderFieldContent()}\n <div id=\"description\" slot=\"aria-describedby\"></div>\n </${this.fieldTag}>`;\n }\n\n private renderFieldContent() {\n return [\n this.renderLeadingIcon(),\n this.renderLabel(),\n this.renderTrailingIcon(),\n ];\n }\n\n private renderLeadingIcon() {\n return html`\n <span class=\"icon leading\" slot=\"start\">\n <slot name=\"leading-icon\" @slotchange=${this.handleIconChange}></slot>\n </span>\n `;\n }\n\n private renderTrailingIcon() {\n return html`\n <span class=\"icon trailing\" slot=\"end\">\n <slot name=\"trailing-icon\" @slotchange=${this.handleIconChange}>\n <svg height=\"5\" viewBox=\"7 10 10 5\" focusable=\"false\">\n <polygon\n class=\"down\"\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 10 12 15 17 10\"></polygon>\n <polygon\n class=\"up\"\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 15 12 10 17 15\"></polygon>\n </svg>\n </slot>\n </span>\n `;\n }\n\n private renderLabel() {\n // need to render so that line-height can apply and give it a\n // non-zero height\n return html`<div id=\"label\">${this.displayText || html` `}</div>`;\n }\n\n private renderMenu() {\n const ariaLabel = this.label || (this as ARIAMixinStrict).ariaLabel;\n return html`<div class=\"menu-wrapper\">\n <md-menu\n id=\"listbox\"\n .defaultFocus=${this.defaultFocus}\n role=\"listbox\"\n tabindex=\"-1\"\n aria-label=${ariaLabel || nothing}\n stay-open-on-focusout\n part=\"menu\"\n exportparts=\"focus-ring: menu-focus-ring\"\n anchor=\"field\"\n style=${styleMap({\n '--__menu-min-width': `${this.selectWidth}px`,\n '--__menu-max-width': this.clampMenuWidth\n ? `${this.selectWidth}px`\n : undefined,\n })}\n no-navigation-wrap\n .open=${this.open}\n .quick=${this.quick}\n .positioning=${this.menuPositioning}\n .typeaheadDelay=${this.typeaheadDelay}\n .anchorCorner=${this.menuAlign === 'start' ? 'end-start' : 'end-end'}\n .menuCorner=${this.menuAlign === 'start' ? 'start-start' : 'start-end'}\n @opening=${this.handleOpening}\n @opened=${this.redispatchEvent}\n @closing=${this.redispatchEvent}\n @closed=${this.handleClosed}\n @close-menu=${this.handleCloseMenu}\n @request-selection=${this.handleRequestSelection}\n @request-deselection=${this.handleRequestDeselection}>\n ${this.renderMenuContent()}\n </md-menu>\n </div>`;\n }\n\n private renderMenuContent() {\n return html`<slot></slot>`;\n }\n\n /**\n * Handles opening the select on keydown and typahead selection when the menu\n * is closed.\n */\n private handleKeydown(event: KeyboardEvent) {\n if (this.open || this.disabled || !this.menu) {\n return;\n }\n\n const typeaheadController = this.menu.typeaheadController;\n const isOpenKey =\n event.code === 'Space' ||\n event.code === 'ArrowDown' ||\n event.code === 'ArrowUp' ||\n event.code === 'End' ||\n event.code === 'Home' ||\n event.code === 'Enter';\n\n // Do not open if currently typing ahead because the user may be typing the\n // spacebar to match a word with a space\n if (!typeaheadController.isTypingAhead && isOpenKey) {\n event.preventDefault();\n this.open = true;\n\n // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/#kbd_label\n switch (event.code) {\n case 'Space':\n case 'ArrowDown':\n case 'Enter':\n // We will handle focusing last selected item in this.handleOpening()\n this.defaultFocus = FocusState.NONE;\n break;\n case 'End':\n this.defaultFocus = FocusState.LAST_ITEM;\n break;\n case 'ArrowUp':\n case 'Home':\n this.defaultFocus = FocusState.FIRST_ITEM;\n break;\n default:\n break;\n }\n return;\n }\n\n const isPrintableKey = event.key.length === 1;\n\n // Handles typing ahead when the menu is closed by delegating the event to\n // the underlying menu's typeaheadController\n if (isPrintableKey) {\n typeaheadController.onKeydown(event);\n event.preventDefault();\n\n const {lastActiveRecord} = typeaheadController;\n\n if (!lastActiveRecord) {\n return;\n }\n\n this.labelEl?.setAttribute?.('aria-live', 'polite');\n const hasChanged = this.selectItem(\n lastActiveRecord[TYPEAHEAD_RECORD.ITEM] as SelectOption,\n );\n\n if (hasChanged) {\n this.dispatchInteractionEvents();\n }\n }\n }\n\n private handleClick() {\n this.open = !this.open;\n }\n\n private handleFocus() {\n this.focused = true;\n }\n\n private handleBlur() {\n this.focused = false;\n }\n\n /**\n * Handles closing the menu when the focus leaves the select's subtree.\n */\n private handleFocusout(event: FocusEvent) {\n // Don't close the menu if we are switching focus between menu,\n // select-option, and field\n if (event.relatedTarget && isElementInSubtree(event.relatedTarget, this)) {\n return;\n }\n\n this.open = false;\n }\n\n /**\n * Gets a list of all selected select options as a list item record array.\n *\n * @return An array of selected list option records.\n */\n private getSelectedOptions() {\n if (!this.menu) {\n this.lastSelectedOptionRecords = [];\n return null;\n }\n\n const items = this.menu.items as SelectOption[];\n this.lastSelectedOptionRecords = getSelectedItems(items);\n return this.lastSelectedOptionRecords;\n }\n\n override async getUpdateComplete() {\n await this.menu?.updateComplete;\n return super.getUpdateComplete();\n }\n\n /**\n * Gets the selected options from the DOM, and updates the value and display\n * text to the first selected option's value and headline respectively.\n *\n * @return Whether or not the selected option has changed since last update.\n */\n private updateValueAndDisplayText() {\n const selectedOptions = this.getSelectedOptions() ?? [];\n // Used to determine whether or not we need to fire an input / change event\n // which fire whenever the option element changes (value or selectedIndex)\n // on user interaction.\n let hasSelectedOptionChanged = false;\n\n if (selectedOptions.length) {\n const [firstSelectedOption] = selectedOptions[0];\n hasSelectedOptionChanged =\n this.lastSelectedOption !== firstSelectedOption;\n this.lastSelectedOption = firstSelectedOption;\n this[VALUE] = firstSelectedOption.value;\n this.displayText = firstSelectedOption.displayText;\n } else {\n hasSelectedOptionChanged = this.lastSelectedOption !== null;\n this.lastSelectedOption = null;\n this[VALUE] = '';\n this.displayText = '';\n }\n\n return hasSelectedOptionChanged;\n }\n\n /**\n * Focuses and activates the last selected item upon opening, and resets other\n * active items.\n */\n private async handleOpening(e: Event) {\n this.labelEl?.removeAttribute?.('aria-live');\n this.redispatchEvent(e);\n\n // FocusState.NONE means we want to handle focus ourselves and focus the\n // last selected item.\n if (this.defaultFocus !== FocusState.NONE) {\n return;\n }\n\n const items = this.menu!.items as SelectOption[];\n const activeItem = getActiveItem(items)?.item;\n let [selectedItem] = this.lastSelectedOptionRecords[0] ?? [null];\n\n // This is true if the user keys through the list but clicks out of the menu\n // thus no close-menu event is fired by an item and we can't clean up in\n // handleCloseMenu.\n if (activeItem && activeItem !== selectedItem) {\n activeItem.tabIndex = -1;\n }\n\n // in the case that nothing is selected, focus the first item\n selectedItem = selectedItem ?? items[0];\n\n if (selectedItem) {\n selectedItem.tabIndex = 0;\n selectedItem.focus();\n }\n }\n\n private redispatchEvent(e: Event) {\n redispatchEvent(this, e);\n }\n\n private handleClosed(e: Event) {\n this.open = false;\n this.redispatchEvent(e);\n }\n\n /**\n * Determines the reason for closing, and updates the UI accordingly.\n */\n private handleCloseMenu(event: CloseMenuEvent) {\n const reason = event.detail.reason;\n const item = event.detail.itemPath[0] as SelectOption;\n this.open = false;\n let hasChanged = false;\n\n if (reason.kind === 'click-selection') {\n hasChanged = this.selectItem(item);\n } else if (reason.kind === 'keydown' && isSelectableKey(reason.key)) {\n hasChanged = this.selectItem(item);\n } else {\n // This can happen on ESC being pressed\n item.tabIndex = -1;\n item.blur();\n }\n\n // Dispatch interaction events since selection has been made via keyboard\n // or mouse.\n if (hasChanged) {\n this.dispatchInteractionEvents();\n }\n }\n\n /**\n * Selects a given option, deselects other options, and updates the UI.\n *\n * @return Whether the last selected option has changed.\n */\n private selectItem(item: SelectOption) {\n const selectedOptions = this.getSelectedOptions() ?? [];\n selectedOptions.forEach(([option]) => {\n if (item !== option) {\n option.selected = false;\n }\n });\n item.selected = true;\n\n return this.updateValueAndDisplayText();\n }\n\n /**\n * Handles updating selection when an option element requests selection via\n * property / attribute change.\n */\n private handleRequestSelection(\n event: ReturnType<typeof createRequestSelectionEvent>,\n ) {\n const requestingOptionEl = event.target as SelectOption & HTMLElement;\n\n // No-op if this item is already selected.\n if (\n this.lastSelectedOptionRecords.some(\n ([option]) => option === requestingOptionEl,\n )\n ) {\n return;\n }\n\n this.selectItem(requestingOptionEl);\n }\n\n /**\n * Handles updating selection when an option element requests deselection via\n * property / attribute change.\n */\n private handleRequestDeselection(\n event: ReturnType<typeof createRequestDeselectionEvent>,\n ) {\n const requestingOptionEl = event.target as SelectOption & HTMLElement;\n\n // No-op if this item is not even in the list of tracked selected items.\n if (\n !this.lastSelectedOptionRecords.some(\n ([option]) => option === requestingOptionEl,\n )\n ) {\n return;\n }\n\n this.updateValueAndDisplayText();\n }\n\n /**\n * Attempts to initialize the selected option from user-settable values like\n * SSR, setting `value`, or `selectedIndex` at startup.\n */\n private initUserSelection() {\n // User has set `.value` directly, but internals have not yet booted up.\n if (this.lastUserSetValue && !this.lastSelectedOptionRecords.length) {\n this.select(this.lastUserSetValue);\n\n // User has set `.selectedIndex` directly, but internals have not yet\n // booted up.\n } else if (\n this.lastUserSetSelectedIndex !== null &&\n !this.lastSelectedOptionRecords.length\n ) {\n this.selectIndex(this.lastUserSetSelectedIndex);\n\n // Regular boot up!\n } else {\n this.updateValueAndDisplayText();\n }\n }\n\n private handleIconChange() {\n this.hasLeadingIcon = this.leadingIcons.length > 0;\n }\n\n /**\n * Dispatches the `input` and `change` events.\n */\n private dispatchInteractionEvents() {\n this.dispatchEvent(new Event('input', {bubbles: true, composed: true}));\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n\n private getErrorText() {\n return this.error ? this.errorText : this.nativeErrorText;\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n declare name: string;\n\n override [getFormValue]() {\n return this.value;\n }\n\n override formResetCallback() {\n this.reset();\n }\n\n override formStateRestoreCallback(state: string) {\n this.value = state;\n }\n\n override click() {\n this.field?.click();\n }\n\n [createValidator]() {\n return new SelectValidator(() => this);\n }\n\n [getValidityAnchor]() {\n return this.field;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["select.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AACxE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,IAAI,IAAI,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAInE,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,eAAe,EAAC,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAC,qBAAqB,EAAC,MAAM,2CAA2C,CAAC;AAChF,OAAO,EACL,YAAY,EACZ,mBAAmB,GACpB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,qDAAqD,CAAC;AACpF,OAAO,EAAC,aAAa,EAAC,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAEL,UAAU,EACV,kBAAkB,EAClB,eAAe,GAChB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAC,6BAA6B,EAAO,MAAM,6BAA6B,CAAC;AAMhF,OAAO,EAAC,gBAAgB,E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EAAC,CAAC;8CAClC;AAKgB;IAAtC,QAAQ,CAAC,EAAC,SAAS,EAAE,cAAc,EAAC,CAAC;2CAAkB;AAMnB;IAApC,QAAQ,CAAC,EAAC,SAAS,EAAE,YAAY,EAAC,CAAC;yCAAsC;AAS1E;IADC,QAAQ,EAAE;mCAGV;AAuBD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC;2CAKrD;AAwCgB;IAAhB,KAAK,EAAE;2CAA6B;AAMpB;IAAhB,KAAK,EAAE;+CAA8B;AAKrB;IAAhB,KAAK,EAAE;uCAAyB;AAChB;IAAhB,KAAK,EAAE;oCAAsB;AACb;IAAhB,KAAK,EAAE;4CAAoD;AAC1B;IAAjC,KAAK,CAAC,QAAQ,CAAC;qCAAuC;AACpB;IAAlC,KAAK,CAAC,SAAS,CAAC;oCAAqC;AACpB;IAAjC,KAAK,CAAC,QAAQ,CAAC;uCAAwC;AAEvC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CACnB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../menu/menu.js';\n\nimport {html, isServer, LitElement, nothing, PropertyValues} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\nimport {html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {Field} from '../../field/internal/field.js';\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../labs/behaviors/element-internals.js';\nimport {\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {\n mixinOnReportValidity,\n onReportValidity,\n} from '../../labs/behaviors/on-report-validity.js';\nimport {SelectValidator} from '../../labs/behaviors/validators/select-validator.js';\nimport {getActiveItem} from '../../list/internal/list-navigation-helpers.js';\nimport {\n CloseMenuEvent,\n FocusState,\n isElementInSubtree,\n isSelectableKey,\n} from '../../menu/internal/controllers/shared.js';\nimport {TYPEAHEAD_RECORD} from '../../menu/internal/controllers/typeaheadController.js';\nimport {DEFAULT_TYPEAHEAD_BUFFER_TIME, Menu} from '../../menu/internal/menu.js';\nimport {SelectOption} from './selectoption/select-option.js';\nimport {\n createRequestDeselectionEvent,\n createRequestSelectionEvent,\n} from './selectoption/selectOptionController.js';\nimport {getSelectedItems, SelectOptionRecord} from './shared.js';\n\nconst VALUE = Symbol('value');\n\n// Separate variable needed for closure.\nconst selectBaseClass = mixinOnReportValidity(\n mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n ),\n);\n\n/**\n * @fires change {Event} The native `change` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event)\n * --bubbles\n * @fires input {InputEvent} The native `input` event on\n * [`<input>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event)\n * --bubbles --composed\n * @fires opening {Event} Fired when the select's menu is about to open.\n * @fires opened {Event} Fired when the select's menu has finished animations\n * and opened.\n * @fires closing {Event} Fired when the select's menu is about to close.\n * @fires closed {Event} Fired when the select's menu has finished animations\n * and closed.\n */\nexport abstract class Select extends selectBaseClass {\n static {\n requestUpdateOnAriaChange(Select);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Opens the menu synchronously with no animation.\n */\n @property({type: Boolean}) quick = false;\n\n /**\n * Whether or not the select is required.\n */\n @property({type: Boolean}) required = false;\n\n /**\n * The error message that replaces supporting text when `error` is true. If\n * `errorText` is an empty string, then the supporting text will continue to\n * show.\n *\n * This error message overrides the error message displayed by\n * `reportValidity()`.\n */\n @property({type: String, attribute: 'error-text'}) errorText = '';\n\n /**\n * The floating label for the field.\n */\n @property() label = '';\n\n /**\n * Disables the asterisk on the floating label, when the select is\n * required.\n */\n @property({type: Boolean, attribute: 'no-asterisk'}) noAsterisk = false;\n\n /**\n * Conveys additional information below the select, such as how it should\n * be used.\n */\n @property({type: String, attribute: 'supporting-text'}) supportingText = '';\n\n /**\n * Gets or sets whether or not the select is in a visually invalid state.\n *\n * This error state overrides the error state controlled by\n * `reportValidity()`.\n */\n @property({type: Boolean, reflect: true}) error = false;\n\n /**\n * Whether or not the underlying md-menu should be position: fixed to display\n * in a top-level manner, or position: absolute.\n *\n * position:fixed is useful for cases where select is inside of another\n * element with stacking context and hidden overflows such as `md-dialog`.\n */\n @property({attribute: 'menu-positioning'})\n menuPositioning: 'absolute' | 'fixed' | 'popover' = 'popover';\n\n /**\n * Clamps the menu-width to the width of the select.\n */\n @property({type: Boolean, attribute: 'clamp-menu-width'})\n clampMenuWidth = false;\n\n /**\n * The max time between the keystrokes of the typeahead select / menu behavior\n * before it clears the typeahead buffer.\n */\n @property({type: Number, attribute: 'typeahead-delay'})\n typeaheadDelay = DEFAULT_TYPEAHEAD_BUFFER_TIME;\n\n /**\n * Whether or not the text field has a leading icon. Used for SSR.\n */\n @property({type: Boolean, attribute: 'has-leading-icon'})\n hasLeadingIcon = false;\n\n /**\n * Text to display in the field. Only set for SSR.\n */\n @property({attribute: 'display-text'}) displayText = '';\n\n /**\n * Whether the menu should be aligned to the start or the end of the select's\n * textbox.\n */\n @property({attribute: 'menu-align'}) menuAlign: 'start' | 'end' = 'start';\n\n /**\n * The value of the currently selected option.\n *\n * Note: For SSR, set `[selected]` on the requested option and `displayText`\n * rather than setting `value` setting `value` will incur a DOM query.\n */\n @property()\n get value(): string {\n return this[VALUE];\n }\n\n set value(value: string) {\n if (isServer) return;\n this.lastUserSetValue = value;\n this.select(value);\n }\n\n [VALUE] = '';\n\n get options() {\n // NOTE: this does a DOM query.\n return (this.menu?.items ?? []) as SelectOption[];\n }\n\n /**\n * The index of the currently selected option.\n *\n * Note: For SSR, set `[selected]` on the requested option and `displayText`\n * rather than setting `selectedIndex` setting `selectedIndex` will incur a\n * DOM query.\n */\n @property({type: Number, attribute: 'selected-index'})\n get selectedIndex(): number {\n // tslint:disable-next-line:enforce-name-casing\n const [_option, index] = (this.getSelectedOptions() ?? [])[0] ?? [];\n return index ?? -1;\n }\n\n set selectedIndex(index: number) {\n this.lastUserSetSelectedIndex = index;\n this.selectIndex(index);\n }\n\n /**\n * Returns an array of selected options.\n *\n * NOTE: md-select only supports single selection.\n */\n get selectedOptions() {\n return (this.getSelectedOptions() ?? []).map(([option]) => option);\n }\n\n protected abstract readonly fieldTag: StaticValue;\n\n /**\n * Used for initializing select when the user sets the `value` directly.\n */\n private lastUserSetValue: string | null = null;\n\n /**\n * Used for initializing select when the user sets the `selectedIndex`\n * directly.\n */\n private lastUserSetSelectedIndex: number | null = null;\n\n /**\n * Used for `input` and `change` event change detection.\n */\n private lastSelectedOption: SelectOption | null = null;\n\n // tslint:disable-next-line:enforce-name-casing\n private lastSelectedOptionRecords: SelectOptionRecord[] = [];\n\n /**\n * Whether or not a native error has been reported via `reportValidity()`.\n */\n @state() private nativeError = false;\n\n /**\n * The validation message displayed from a native error via\n * `reportValidity()`.\n */\n @state() private nativeErrorText = '';\n private get hasError() {\n return this.error || this.nativeError;\n }\n\n @state() private focused = false;\n @state() private open = false;\n @state() private defaultFocus: FocusState = FocusState.NONE;\n @query('.field') private readonly field!: Field | null;\n @query('md-menu') private readonly menu!: Menu | null;\n @query('#label') private readonly labelEl!: HTMLElement;\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly leadingIcons!: Element[];\n // Have to keep track of previous open because it's state and private and thus\n // cannot be tracked in PropertyValues<this> map.\n private prevOpen = this.open;\n private selectWidth = 0;\n\n constructor() {\n super();\n if (isServer) {\n return;\n }\n\n this.addEventListener('focus', this.handleFocus.bind(this));\n this.addEventListener('blur', this.handleBlur.bind(this));\n }\n\n /**\n * Selects an option given the value of the option, and updates MdSelect's\n * value.\n */\n select(value: string) {\n const optionToSelect = this.options.find(\n (option) => option.value === value,\n );\n if (optionToSelect) {\n this.selectItem(optionToSelect);\n }\n }\n\n /**\n * Selects an option given the index of the option, and updates MdSelect's\n * value.\n */\n selectIndex(index: number) {\n const optionToSelect = this.options[index];\n if (optionToSelect) {\n this.selectItem(optionToSelect);\n }\n }\n\n /**\n * Reset the select to its default value.\n */\n reset() {\n for (const option of this.options) {\n option.selected = option.hasAttribute('selected');\n }\n\n this.updateValueAndDisplayText();\n this.nativeError = false;\n this.nativeErrorText = '';\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n // Prevent default pop-up behavior.\n invalidEvent?.preventDefault();\n\n const prevMessage = this.getErrorText();\n this.nativeError = !!invalidEvent;\n this.nativeErrorText = this.validationMessage;\n\n if (prevMessage === this.getErrorText()) {\n this.field?.reannounceError();\n }\n }\n\n protected override update(changed: PropertyValues<Select>) {\n // In SSR the options will be ready to query, so try to figure out what\n // the value and display text should be.\n if (!this.hasUpdated) {\n this.initUserSelection();\n }\n\n // We have just opened the menu.\n // We are only able to check for the select's rect in `update()` instead of\n // having to wait for `updated()` because the menu can never be open on\n // first render since it is not settable and Lit SSR does not support click\n // events which would open the menu.\n if (this.prevOpen !== this.open && this.open) {\n const selectRect = this.getBoundingClientRect();\n this.selectWidth = selectRect.width;\n }\n\n this.prevOpen = this.open;\n super.update(changed);\n }\n\n protected override render() {\n return html`\n <span\n class=\"select ${classMap(this.getRenderClasses())}\"\n @focusout=${this.handleFocusout}>\n ${this.renderField()} ${this.renderMenu()}\n </span>\n `;\n }\n\n protected override async firstUpdated(changed: PropertyValues<Select>) {\n await this.menu?.updateComplete;\n // If this has been handled on update already due to SSR, try again.\n if (!this.lastSelectedOptionRecords.length) {\n this.initUserSelection();\n }\n\n // Case for when the DOM is streaming, there are no children, and a child\n // has [selected] set on it, we need to wait for DOM to render something.\n if (\n !this.lastSelectedOptionRecords.length &&\n !isServer &&\n !this.options.length\n ) {\n setTimeout(() => {\n this.updateValueAndDisplayText();\n });\n }\n\n super.firstUpdated(changed);\n }\n\n private getRenderClasses(): ClassInfo {\n return {\n 'disabled': this.disabled,\n 'error': this.error,\n 'open': this.open,\n };\n }\n\n private renderField() {\n return staticHtml`\n <${this.fieldTag}\n aria-haspopup=\"listbox\"\n role=\"combobox\"\n part=\"field\"\n id=\"field\"\n tabindex=${this.disabled ? '-1' : '0'}\n aria-label=${(this as ARIAMixinStrict).ariaLabel || nothing}\n aria-describedby=\"description\"\n aria-expanded=${this.open ? 'true' : 'false'}\n aria-controls=\"listbox\"\n class=\"field\"\n label=${this.label}\n ?no-asterisk=${this.noAsterisk}\n .focused=${this.focused || this.open}\n .populated=${!!this.displayText}\n .disabled=${this.disabled}\n .required=${this.required}\n .error=${this.hasError}\n ?has-start=${this.hasLeadingIcon}\n has-end\n supporting-text=${this.supportingText}\n error-text=${this.getErrorText()}\n @keydown=${this.handleKeydown}\n @click=${this.handleClick}>\n ${this.renderFieldContent()}\n <div id=\"description\" slot=\"aria-describedby\"></div>\n </${this.fieldTag}>`;\n }\n\n private renderFieldContent() {\n return [\n this.renderLeadingIcon(),\n this.renderLabel(),\n this.renderTrailingIcon(),\n ];\n }\n\n private renderLeadingIcon() {\n return html`\n <span class=\"icon leading\" slot=\"start\">\n <slot name=\"leading-icon\" @slotchange=${this.handleIconChange}></slot>\n </span>\n `;\n }\n\n private renderTrailingIcon() {\n return html`\n <span class=\"icon trailing\" slot=\"end\">\n <slot name=\"trailing-icon\" @slotchange=${this.handleIconChange}>\n <svg height=\"5\" viewBox=\"7 10 10 5\" focusable=\"false\">\n <polygon\n class=\"down\"\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 10 12 15 17 10\"></polygon>\n <polygon\n class=\"up\"\n stroke=\"none\"\n fill-rule=\"evenodd\"\n points=\"7 15 12 10 17 15\"></polygon>\n </svg>\n </slot>\n </span>\n `;\n }\n\n private renderLabel() {\n // need to render so that line-height can apply and give it a\n // non-zero height\n return html`<div id=\"label\">${this.displayText || html` `}</div>`;\n }\n\n private renderMenu() {\n const ariaLabel = this.label || (this as ARIAMixinStrict).ariaLabel;\n return html`<div class=\"menu-wrapper\">\n <md-menu\n id=\"listbox\"\n .defaultFocus=${this.defaultFocus}\n role=\"listbox\"\n tabindex=\"-1\"\n aria-label=${ariaLabel || nothing}\n stay-open-on-focusout\n part=\"menu\"\n exportparts=\"focus-ring: menu-focus-ring\"\n anchor=\"field\"\n style=${styleMap({\n '--__menu-min-width': `${this.selectWidth}px`,\n '--__menu-max-width': this.clampMenuWidth\n ? `${this.selectWidth}px`\n : undefined,\n })}\n no-navigation-wrap\n .open=${this.open}\n .quick=${this.quick}\n .positioning=${this.menuPositioning}\n .typeaheadDelay=${this.typeaheadDelay}\n .anchorCorner=${this.menuAlign === 'start' ? 'end-start' : 'end-end'}\n .menuCorner=${this.menuAlign === 'start' ? 'start-start' : 'start-end'}\n @opening=${this.handleOpening}\n @opened=${this.redispatchEvent}\n @closing=${this.redispatchEvent}\n @closed=${this.handleClosed}\n @close-menu=${this.handleCloseMenu}\n @request-selection=${this.handleRequestSelection}\n @request-deselection=${this.handleRequestDeselection}>\n ${this.renderMenuContent()}\n </md-menu>\n </div>`;\n }\n\n private renderMenuContent() {\n return html`<slot></slot>`;\n }\n\n /**\n * Handles opening the select on keydown and typahead selection when the menu\n * is closed.\n */\n private handleKeydown(event: KeyboardEvent) {\n if (this.open || this.disabled || !this.menu) {\n return;\n }\n\n const typeaheadController = this.menu.typeaheadController;\n const isOpenKey =\n event.code === 'Space' ||\n event.code === 'ArrowDown' ||\n event.code === 'ArrowUp' ||\n event.code === 'End' ||\n event.code === 'Home' ||\n event.code === 'Enter';\n\n // Do not open if currently typing ahead because the user may be typing the\n // spacebar to match a word with a space\n if (!typeaheadController.isTypingAhead && isOpenKey) {\n event.preventDefault();\n this.open = true;\n\n // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/#kbd_label\n switch (event.code) {\n case 'Space':\n case 'ArrowDown':\n case 'Enter':\n // We will handle focusing last selected item in this.handleOpening()\n this.defaultFocus = FocusState.NONE;\n break;\n case 'End':\n this.defaultFocus = FocusState.LAST_ITEM;\n break;\n case 'ArrowUp':\n case 'Home':\n this.defaultFocus = FocusState.FIRST_ITEM;\n break;\n default:\n break;\n }\n return;\n }\n\n const isPrintableKey = event.key.length === 1;\n\n // Handles typing ahead when the menu is closed by delegating the event to\n // the underlying menu's typeaheadController\n if (isPrintableKey) {\n typeaheadController.onKeydown(event);\n event.preventDefault();\n\n const {lastActiveRecord} = typeaheadController;\n\n if (!lastActiveRecord) {\n return;\n }\n\n this.labelEl?.setAttribute?.('aria-live', 'polite');\n const hasChanged = this.selectItem(\n lastActiveRecord[TYPEAHEAD_RECORD.ITEM] as SelectOption,\n );\n\n if (hasChanged) {\n this.dispatchInteractionEvents();\n }\n }\n }\n\n private handleClick() {\n this.open = !this.open;\n }\n\n private handleFocus() {\n this.focused = true;\n }\n\n private handleBlur() {\n this.focused = false;\n }\n\n /**\n * Handles closing the menu when the focus leaves the select's subtree.\n */\n private handleFocusout(event: FocusEvent) {\n // Don't close the menu if we are switching focus between menu,\n // select-option, and field\n if (event.relatedTarget && isElementInSubtree(event.relatedTarget, this)) {\n return;\n }\n\n this.open = false;\n }\n\n /**\n * Gets a list of all selected select options as a list item record array.\n *\n * @return An array of selected list option records.\n */\n private getSelectedOptions() {\n if (!this.menu) {\n this.lastSelectedOptionRecords = [];\n return null;\n }\n\n const items = this.menu.items as SelectOption[];\n this.lastSelectedOptionRecords = getSelectedItems(items);\n return this.lastSelectedOptionRecords;\n }\n\n override async getUpdateComplete() {\n await this.menu?.updateComplete;\n return super.getUpdateComplete();\n }\n\n /**\n * Gets the selected options from the DOM, and updates the value and display\n * text to the first selected option's value and headline respectively.\n *\n * @return Whether or not the selected option has changed since last update.\n */\n private updateValueAndDisplayText() {\n const selectedOptions = this.getSelectedOptions() ?? [];\n // Used to determine whether or not we need to fire an input / change event\n // which fire whenever the option element changes (value or selectedIndex)\n // on user interaction.\n let hasSelectedOptionChanged = false;\n\n if (selectedOptions.length) {\n const [firstSelectedOption] = selectedOptions[0];\n hasSelectedOptionChanged =\n this.lastSelectedOption !== firstSelectedOption;\n this.lastSelectedOption = firstSelectedOption;\n this[VALUE] = firstSelectedOption.value;\n this.displayText = firstSelectedOption.displayText;\n } else {\n hasSelectedOptionChanged = this.lastSelectedOption !== null;\n this.lastSelectedOption = null;\n this[VALUE] = '';\n this.displayText = '';\n }\n\n return hasSelectedOptionChanged;\n }\n\n /**\n * Focuses and activates the last selected item upon opening, and resets other\n * active items.\n */\n private async handleOpening(e: Event) {\n this.labelEl?.removeAttribute?.('aria-live');\n this.redispatchEvent(e);\n\n // FocusState.NONE means we want to handle focus ourselves and focus the\n // last selected item.\n if (this.defaultFocus !== FocusState.NONE) {\n return;\n }\n\n const items = this.menu!.items as SelectOption[];\n const activeItem = getActiveItem(items)?.item;\n let [selectedItem] = this.lastSelectedOptionRecords[0] ?? [null];\n\n // This is true if the user keys through the list but clicks out of the menu\n // thus no close-menu event is fired by an item and we can't clean up in\n // handleCloseMenu.\n if (activeItem && activeItem !== selectedItem) {\n activeItem.tabIndex = -1;\n }\n\n // in the case that nothing is selected, focus the first item\n selectedItem = selectedItem ?? items[0];\n\n if (selectedItem) {\n selectedItem.tabIndex = 0;\n selectedItem.focus();\n }\n }\n\n private redispatchEvent(e: Event) {\n redispatchEvent(this, e);\n }\n\n private handleClosed(e: Event) {\n this.open = false;\n this.redispatchEvent(e);\n }\n\n /**\n * Determines the reason for closing, and updates the UI accordingly.\n */\n private handleCloseMenu(event: CloseMenuEvent) {\n const reason = event.detail.reason;\n const item = event.detail.itemPath[0] as SelectOption;\n this.open = false;\n let hasChanged = false;\n\n if (reason.kind === 'click-selection') {\n hasChanged = this.selectItem(item);\n } else if (reason.kind === 'keydown' && isSelectableKey(reason.key)) {\n hasChanged = this.selectItem(item);\n } else {\n // This can happen on ESC being pressed\n item.tabIndex = -1;\n item.blur();\n }\n\n // Dispatch interaction events since selection has been made via keyboard\n // or mouse.\n if (hasChanged) {\n this.dispatchInteractionEvents();\n }\n }\n\n /**\n * Selects a given option, deselects other options, and updates the UI.\n *\n * @return Whether the last selected option has changed.\n */\n private selectItem(item: SelectOption) {\n const selectedOptions = this.getSelectedOptions() ?? [];\n selectedOptions.forEach(([option]) => {\n if (item !== option) {\n option.selected = false;\n }\n });\n item.selected = true;\n\n return this.updateValueAndDisplayText();\n }\n\n /**\n * Handles updating selection when an option element requests selection via\n * property / attribute change.\n */\n private handleRequestSelection(\n event: ReturnType<typeof createRequestSelectionEvent>,\n ) {\n const requestingOptionEl = event.target as SelectOption & HTMLElement;\n\n // No-op if this item is already selected.\n if (\n this.lastSelectedOptionRecords.some(\n ([option]) => option === requestingOptionEl,\n )\n ) {\n return;\n }\n\n this.selectItem(requestingOptionEl);\n }\n\n /**\n * Handles updating selection when an option element requests deselection via\n * property / attribute change.\n */\n private handleRequestDeselection(\n event: ReturnType<typeof createRequestDeselectionEvent>,\n ) {\n const requestingOptionEl = event.target as SelectOption & HTMLElement;\n\n // No-op if this item is not even in the list of tracked selected items.\n if (\n !this.lastSelectedOptionRecords.some(\n ([option]) => option === requestingOptionEl,\n )\n ) {\n return;\n }\n\n this.updateValueAndDisplayText();\n }\n\n /**\n * Attempts to initialize the selected option from user-settable values like\n * SSR, setting `value`, or `selectedIndex` at startup.\n */\n private initUserSelection() {\n // User has set `.value` directly, but internals have not yet booted up.\n if (this.lastUserSetValue && !this.lastSelectedOptionRecords.length) {\n this.select(this.lastUserSetValue);\n\n // User has set `.selectedIndex` directly, but internals have not yet\n // booted up.\n } else if (\n this.lastUserSetSelectedIndex !== null &&\n !this.lastSelectedOptionRecords.length\n ) {\n this.selectIndex(this.lastUserSetSelectedIndex);\n\n // Regular boot up!\n } else {\n this.updateValueAndDisplayText();\n }\n }\n\n private handleIconChange() {\n this.hasLeadingIcon = this.leadingIcons.length > 0;\n }\n\n /**\n * Dispatches the `input` and `change` events.\n */\n private dispatchInteractionEvents() {\n this.dispatchEvent(new Event('input', {bubbles: true, composed: true}));\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n\n private getErrorText() {\n return this.error ? this.errorText : this.nativeErrorText;\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n declare name: string;\n\n override [getFormValue]() {\n return this.value;\n }\n\n override formResetCallback() {\n this.reset();\n }\n\n override formStateRestoreCallback(state: string) {\n this.value = state;\n }\n\n override click() {\n this.field?.click();\n }\n\n [createValidator]() {\n return new SelectValidator(() => this);\n }\n\n [getValidityAnchor]() {\n return this.field;\n }\n}\n"]}
|
|
@@ -10,6 +10,7 @@ import { html, isServer, LitElement, nothing } from 'lit';
|
|
|
10
10
|
import { property, query } from 'lit/decorators.js';
|
|
11
11
|
import { classMap } from 'lit/directives/class-map.js';
|
|
12
12
|
import { requestUpdateOnAriaChange } from '../../internal/aria/delegate.js';
|
|
13
|
+
import { afterDispatch, setupDispatchHooks, } from '../../internal/events/dispatch-hooks.js';
|
|
13
14
|
import { dispatchActivationClick, isActivationClick, } from '../../internal/events/form-label-activation.js';
|
|
14
15
|
import { redispatchEvent } from '../../internal/events/redispatch-event.js';
|
|
15
16
|
import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '../../labs/behaviors/constraint-validation.js';
|
|
@@ -53,15 +54,30 @@ export class Switch extends switchBaseClass {
|
|
|
53
54
|
* submitted when `selected` is `false`.
|
|
54
55
|
*/
|
|
55
56
|
this.value = 'on';
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (isServer) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// This click listener does not currently need dispatch hooks since it does
|
|
61
|
+
// not check `event.defaultPrevented`.
|
|
62
|
+
this.addEventListener('click', (event) => {
|
|
63
|
+
if (!isActivationClick(event) || !this.input) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.focus();
|
|
67
|
+
dispatchActivationClick(this.input);
|
|
68
|
+
});
|
|
69
|
+
// Add the aria keyboard interaction pattern for switch and the Enter key.
|
|
70
|
+
// See https://www.w3.org/WAI/ARIA/apg/patterns/switch/.
|
|
71
|
+
setupDispatchHooks(this, 'keydown');
|
|
72
|
+
this.addEventListener('keydown', (event) => {
|
|
73
|
+
afterDispatch(event, () => {
|
|
74
|
+
const ignoreEvent = event.defaultPrevented || event.key !== 'Enter';
|
|
75
|
+
if (ignoreEvent || this.disabled || !this.input) {
|
|
59
76
|
return;
|
|
60
77
|
}
|
|
61
|
-
this.
|
|
62
|
-
dispatchActivationClick(this.input);
|
|
78
|
+
this.input.click();
|
|
63
79
|
});
|
|
64
|
-
}
|
|
80
|
+
});
|
|
65
81
|
}
|
|
66
82
|
render() {
|
|
67
83
|
return html `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["switch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AACxE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,+CAA+C,CAAC;A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,EAAE,SAAS,EAAE,yBAAyB,EAAC,CAAC;oDACnC;AAQF;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wCAAkB;AAMhC;IAAX,QAAQ,EAAE;qCAAc;AAEQ;IAAhC,KAAK,CAAC,OAAO,CAAC;qCAAkD","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/md-focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\n\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '../../internal/events/form-label-activation.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../labs/behaviors/element-internals.js';\nimport {\n getFormState,\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {CheckboxValidator} from '../../labs/behaviors/validators/checkbox-validator.js';\n\n// Separate variable needed for closure.\nconst switchBaseClass = mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n);\n\n/**\n * @fires input {InputEvent} Fired whenever `selected` changes due to user\n * interaction (bubbles and composed).\n * @fires change {Event} Fired whenever `selected` changes due to user\n * interaction (bubbles).\n */\nexport class Switch extends switchBaseClass {\n static {\n requestUpdateOnAriaChange(Switch);\n }\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n /**\n * Puts the switch in the selected state and sets the form submission value to\n * the `value` property.\n */\n @property({type: Boolean}) selected = false;\n\n /**\n * Shows both the selected and deselected icons.\n */\n @property({type: Boolean}) icons = false;\n\n /**\n * Shows only the selected icon, and not the deselected icon. If `true`,\n * overrides the behavior of the `icons` property.\n */\n @property({type: Boolean, attribute: 'show-only-selected-icon'})\n showOnlySelectedIcon = false;\n\n /**\n * When true, require the switch to be selected when participating in\n * form submission.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#validation\n */\n @property({type: Boolean}) required = false;\n\n /**\n * The value associated with this switch on form submission. `null` is\n * submitted when `selected` is `false`.\n */\n @property() value = 'on';\n\n @query('input') private readonly input!: HTMLInputElement | null;\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('click', (event: MouseEvent) => {\n if (!isActivationClick(event) || !this.input) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.input);\n });\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"switch ${classMap(this.getRenderClasses())}\">\n <input\n id=\"switch\"\n class=\"touch\"\n type=\"checkbox\"\n role=\"switch\"\n aria-label=${(this as ARIAMixin).ariaLabel || nothing}\n ?checked=${this.selected}\n ?disabled=${this.disabled}\n ?required=${this.required}\n @input=${this.handleInput}\n @change=${this.handleChange} />\n\n <md-focus-ring part=\"focus-ring\" for=\"switch\"></md-focus-ring>\n <span class=\"track\"> ${this.renderHandle()} </span>\n </div>\n `;\n }\n\n private getRenderClasses(): ClassInfo {\n return {\n 'selected': this.selected,\n 'unselected': !this.selected,\n 'disabled': this.disabled,\n };\n }\n\n private renderHandle() {\n const classes = {\n 'with-icon': this.showOnlySelectedIcon ? this.selected : this.icons,\n };\n return html`\n ${this.renderTouchTarget()}\n <span class=\"handle-container\">\n <md-ripple for=\"switch\" ?disabled=\"${this.disabled}\"></md-ripple>\n <span class=\"handle ${classMap(classes)}\">\n ${this.shouldShowIcons() ? this.renderIcons() : html``}\n </span>\n </span>\n `;\n }\n\n private renderIcons() {\n return html`\n <div class=\"icons\">\n ${this.renderOnIcon()}\n ${this.showOnlySelectedIcon ? html`` : this.renderOffIcon()}\n </div>\n `;\n }\n\n /**\n * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024\n */\n private renderOnIcon() {\n return html`\n <slot class=\"icon icon--on\" name=\"on-icon\">\n <svg viewBox=\"0 0 24 24\">\n <path\n d=\"M9.55 18.2 3.65 12.3 5.275 10.675 9.55 14.95 18.725 5.775 20.35 7.4Z\" />\n </svg>\n </slot>\n `;\n }\n\n /**\n * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aclose%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024\n */\n private renderOffIcon() {\n return html`\n <slot class=\"icon icon--off\" name=\"off-icon\">\n <svg viewBox=\"0 0 24 24\">\n <path\n d=\"M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z\" />\n </svg>\n </slot>\n `;\n }\n\n private renderTouchTarget() {\n return html`<span class=\"touch\"></span>`;\n }\n\n private shouldShowIcons(): boolean {\n return this.icons || this.showOnlySelectedIcon;\n }\n\n private handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n this.selected = target.checked;\n // <input> 'input' event bubbles and is composed, don't re-dispatch it.\n }\n\n private handleChange(event: Event) {\n // <input> 'change' event is not composed, re-dispatch it.\n redispatchEvent(this, event);\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n declare name: string;\n\n override [getFormValue]() {\n return this.selected ? this.value : null;\n }\n\n override [getFormState]() {\n return String(this.selected);\n }\n\n override formResetCallback() {\n // The selected property does not reflect, so the original attribute set by\n // the user is used to determine the default value.\n this.selected = this.hasAttribute('selected');\n }\n\n override formStateRestoreCallback(state: string) {\n this.selected = state === 'true';\n }\n\n [createValidator]() {\n return new CheckboxValidator(() => ({\n checked: this.selected,\n required: this.required,\n }));\n }\n\n [getValidityAnchor]() {\n return this.input;\n }\n}\n"]}
|
|
1
|
+
{"version":3,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E,OAAO,EAAC,CAAC;wCAAkB;AAMhC;IAAX,QAAQ,EAAE;qCAAc;AAEQ;IAAhC,KAAK,CAAC,OAAO,CAAC;qCAAkD","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/md-focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\n\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {\n afterDispatch,\n setupDispatchHooks,\n} from '../../internal/events/dispatch-hooks.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '../../internal/events/form-label-activation.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {mixinElementInternals} from '../../labs/behaviors/element-internals.js';\nimport {\n getFormState,\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {CheckboxValidator} from '../../labs/behaviors/validators/checkbox-validator.js';\n\n// Separate variable needed for closure.\nconst switchBaseClass = mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(LitElement)),\n);\n\n/**\n * @fires input {InputEvent} Fired whenever `selected` changes due to user\n * interaction (bubbles and composed).\n * @fires change {Event} Fired whenever `selected` changes due to user\n * interaction (bubbles).\n */\nexport class Switch extends switchBaseClass {\n static {\n requestUpdateOnAriaChange(Switch);\n }\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n /**\n * Puts the switch in the selected state and sets the form submission value to\n * the `value` property.\n */\n @property({type: Boolean}) selected = false;\n\n /**\n * Shows both the selected and deselected icons.\n */\n @property({type: Boolean}) icons = false;\n\n /**\n * Shows only the selected icon, and not the deselected icon. If `true`,\n * overrides the behavior of the `icons` property.\n */\n @property({type: Boolean, attribute: 'show-only-selected-icon'})\n showOnlySelectedIcon = false;\n\n /**\n * When true, require the switch to be selected when participating in\n * form submission.\n *\n * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#validation\n */\n @property({type: Boolean}) required = false;\n\n /**\n * The value associated with this switch on form submission. `null` is\n * submitted when `selected` is `false`.\n */\n @property() value = 'on';\n\n @query('input') private readonly input!: HTMLInputElement | null;\n\n constructor() {\n super();\n if (isServer) {\n return;\n }\n\n // This click listener does not currently need dispatch hooks since it does\n // not check `event.defaultPrevented`.\n this.addEventListener('click', (event: MouseEvent) => {\n if (!isActivationClick(event) || !this.input) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.input);\n });\n\n // Add the aria keyboard interaction pattern for switch and the Enter key.\n // See https://www.w3.org/WAI/ARIA/apg/patterns/switch/.\n setupDispatchHooks(this, 'keydown');\n this.addEventListener('keydown', (event: KeyboardEvent) => {\n afterDispatch(event, () => {\n const ignoreEvent = event.defaultPrevented || event.key !== 'Enter';\n if (ignoreEvent || this.disabled || !this.input) {\n return;\n }\n\n this.input.click();\n });\n });\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"switch ${classMap(this.getRenderClasses())}\">\n <input\n id=\"switch\"\n class=\"touch\"\n type=\"checkbox\"\n role=\"switch\"\n aria-label=${(this as ARIAMixin).ariaLabel || nothing}\n ?checked=${this.selected}\n ?disabled=${this.disabled}\n ?required=${this.required}\n @input=${this.handleInput}\n @change=${this.handleChange} />\n\n <md-focus-ring part=\"focus-ring\" for=\"switch\"></md-focus-ring>\n <span class=\"track\"> ${this.renderHandle()} </span>\n </div>\n `;\n }\n\n private getRenderClasses(): ClassInfo {\n return {\n 'selected': this.selected,\n 'unselected': !this.selected,\n 'disabled': this.disabled,\n };\n }\n\n private renderHandle() {\n const classes = {\n 'with-icon': this.showOnlySelectedIcon ? this.selected : this.icons,\n };\n return html`\n ${this.renderTouchTarget()}\n <span class=\"handle-container\">\n <md-ripple for=\"switch\" ?disabled=\"${this.disabled}\"></md-ripple>\n <span class=\"handle ${classMap(classes)}\">\n ${this.shouldShowIcons() ? this.renderIcons() : html``}\n </span>\n </span>\n `;\n }\n\n private renderIcons() {\n return html`\n <div class=\"icons\">\n ${this.renderOnIcon()}\n ${this.showOnlySelectedIcon ? html`` : this.renderOffIcon()}\n </div>\n `;\n }\n\n /**\n * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Acheck%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024\n */\n private renderOnIcon() {\n return html`\n <slot class=\"icon icon--on\" name=\"on-icon\">\n <svg viewBox=\"0 0 24 24\">\n <path\n d=\"M9.55 18.2 3.65 12.3 5.275 10.675 9.55 14.95 18.725 5.775 20.35 7.4Z\" />\n </svg>\n </slot>\n `;\n }\n\n /**\n * https://fonts.google.com/icons?selected=Material%20Symbols%20Outlined%3Aclose%3AFILL%400%3Bwght%40500%3BGRAD%400%3Bopsz%4024\n */\n private renderOffIcon() {\n return html`\n <slot class=\"icon icon--off\" name=\"off-icon\">\n <svg viewBox=\"0 0 24 24\">\n <path\n d=\"M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z\" />\n </svg>\n </slot>\n `;\n }\n\n private renderTouchTarget() {\n return html`<span class=\"touch\"></span>`;\n }\n\n private shouldShowIcons(): boolean {\n return this.icons || this.showOnlySelectedIcon;\n }\n\n private handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n this.selected = target.checked;\n // <input> 'input' event bubbles and is composed, don't re-dispatch it.\n }\n\n private handleChange(event: Event) {\n // <input> 'change' event is not composed, re-dispatch it.\n redispatchEvent(this, event);\n }\n\n // Writable mixin properties for lit-html binding, needed for lit-analyzer\n declare disabled: boolean;\n declare name: string;\n\n override [getFormValue]() {\n return this.selected ? this.value : null;\n }\n\n override [getFormState]() {\n return String(this.selected);\n }\n\n override formResetCallback() {\n // The selected property does not reflect, so the original attribute set by\n // the user is used to determine the default value.\n this.selected = this.hasAttribute('selected');\n }\n\n override formStateRestoreCallback(state: string) {\n this.selected = state === 'true';\n }\n\n [createValidator]() {\n return new CheckboxValidator(() => ({\n checked: this.selected,\n required: this.required,\n }));\n }\n\n [getValidityAnchor]() {\n return this.input;\n }\n}\n"]}
|
package/tabs/internal/tabs.d.ts
CHANGED
|
@@ -7,25 +7,25 @@ import '../../divider/divider.js';
|
|
|
7
7
|
import { LitElement } from 'lit';
|
|
8
8
|
import { Tab } from './tab.js';
|
|
9
9
|
/**
|
|
10
|
-
* @fires change {Event} Fired when the selected tab changes. The target's
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* @fires change {Event} Fired when the selected tab changes. The target's
|
|
11
|
+
* `activeTabIndex` or `activeTab` provide information about the selection
|
|
12
|
+
* change. The change event is fired when a user interaction like a space/enter
|
|
13
|
+
* key or click cause a selection change. The tab selection based on these
|
|
14
|
+
* actions can be cancelled by calling preventDefault on the triggering
|
|
15
|
+
* `keydown` or `click` event. --bubbles
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* // perform an action if a tab is clicked
|
|
19
19
|
* tabs.addEventListener('change', (event: Event) => {
|
|
20
|
-
* if (event.target.
|
|
21
|
-
*
|
|
20
|
+
* if (event.target.activeTabIndex === 2)
|
|
21
|
+
* takeAction();
|
|
22
22
|
* }
|
|
23
23
|
* });
|
|
24
24
|
*
|
|
25
25
|
* // prevent a click from triggering tab selection under some condition
|
|
26
26
|
* tabs.addEventListener('click', (event: Event) => {
|
|
27
27
|
* if (notReady)
|
|
28
|
-
*
|
|
28
|
+
* event.preventDefault();
|
|
29
29
|
* }
|
|
30
30
|
* });
|
|
31
31
|
*
|
package/tabs/internal/tabs.js
CHANGED
|
@@ -9,25 +9,25 @@ import { html, isServer, LitElement } from 'lit';
|
|
|
9
9
|
import { property, query, queryAssignedElements } from 'lit/decorators.js';
|
|
10
10
|
import { ANIMATE_INDICATOR } from './tab.js';
|
|
11
11
|
/**
|
|
12
|
-
* @fires change {Event} Fired when the selected tab changes. The target's
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* @fires change {Event} Fired when the selected tab changes. The target's
|
|
13
|
+
* `activeTabIndex` or `activeTab` provide information about the selection
|
|
14
|
+
* change. The change event is fired when a user interaction like a space/enter
|
|
15
|
+
* key or click cause a selection change. The tab selection based on these
|
|
16
|
+
* actions can be cancelled by calling preventDefault on the triggering
|
|
17
|
+
* `keydown` or `click` event. --bubbles
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* // perform an action if a tab is clicked
|
|
21
21
|
* tabs.addEventListener('change', (event: Event) => {
|
|
22
|
-
* if (event.target.
|
|
23
|
-
*
|
|
22
|
+
* if (event.target.activeTabIndex === 2)
|
|
23
|
+
* takeAction();
|
|
24
24
|
* }
|
|
25
25
|
* });
|
|
26
26
|
*
|
|
27
27
|
* // prevent a click from triggering tab selection under some condition
|
|
28
28
|
* tabs.addEventListener('click', (event: Event) => {
|
|
29
29
|
* if (notReady)
|
|
30
|
-
*
|
|
30
|
+
* event.preventDefault();
|
|
31
31
|
* }
|
|
32
32
|
* });
|
|
33
33
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["tabs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAC,iBAAiB,EAAM,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;;;;;;;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O,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;0CAAsB;AAE3C;IAAhC,KAAK,CAAC,OAAO,CAAC;iDAA2D;AAC1C;IAA/B,KAAK,CAAC,MAAM,CAAC;yCAAuD;AAiNvE,SAAS,KAAK,CAAC,OAAgB;IAC7B,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../divider/divider.js';\n\nimport {html, isServer, LitElement} from 'lit';\nimport {property, query, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ANIMATE_INDICATOR, Tab} from './tab.js';\n\n/**\n * @fires change {Event} Fired when the selected tab changes. The target's selected or\n * selectedItem and previousSelected or previousSelectedItem provide information\n * about the selection change. The change event is fired when a user interaction\n * like a space/enter key or click cause a selection change. The tab selection\n * based on these actions can be cancelled by calling preventDefault on the\n * triggering `keydown` or `click` event. --bubbles\n *\n * @example\n * // perform an action if a tab is clicked\n * tabs.addEventListener('change', (event: Event) => {\n * if (event.target.selected === 2)\n * takeAction();\n * }\n * });\n *\n * // prevent a click from triggering tab selection under some condition\n * tabs.addEventListener('click', (event: Event) => {\n * if (notReady)\n * event.preventDefault();\n * }\n * });\n *\n */\nexport class Tabs extends LitElement {\n /**\n * The tabs of this tab bar.\n */\n @queryAssignedElements({flatten: true, selector: '[md-tab]'})\n readonly tabs!: Tab[];\n\n /**\n * The currently selected tab, `null` only when there are no tab children.\n *\n * @export\n */\n get activeTab() {\n return this.tabs.find((tab) => tab.active) ?? null;\n }\n set activeTab(tab: Tab | null) {\n // Ignore setting activeTab to null. As long as there are children, one tab\n // must be selected.\n if (tab) {\n this.activateTab(tab);\n }\n }\n\n /**\n * The index of the currently selected tab.\n *\n * @export\n */\n @property({type: Number, attribute: 'active-tab-index'})\n get activeTabIndex() {\n return this.tabs.findIndex((tab) => tab.active);\n }\n set activeTabIndex(index: number) {\n const activateTabAtIndex = () => {\n const tab = this.tabs[index];\n // Ignore out-of-bound indices.\n if (tab) {\n this.activateTab(tab);\n }\n };\n\n if (!this.slotElement) {\n // This is needed to support setting the activeTabIndex via a lit property\n // binding.\n //\n // ```ts\n // html`\n // <md-tabs .activeTabIndex=${1}>\n // <md-tab>First</md-tab>\n // <md-tab>Second</md-tab>\n // </md-tabs>\n // `;\n // ```\n //\n // It's needed since lit's rendering lifecycle is asynchronous, and the\n // `<slot>` element hasn't rendered, so `tabs` is empty.\n this.updateComplete.then(activateTabAtIndex);\n return;\n }\n\n activateTabAtIndex();\n }\n\n /**\n * Whether or not to automatically select a tab when it is focused.\n */\n @property({type: Boolean, attribute: 'auto-activate'}) autoActivate = false;\n\n @query('.tabs') private readonly tabsScrollerElement!: HTMLElement | null;\n @query('slot') private readonly slotElement!: HTMLSlotElement | null;\n\n private get focusedTab() {\n return this.tabs.find((tab) => tab.matches(':focus-within'));\n }\n\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'tablist';\n this.addEventListener('keydown', this.handleKeydown.bind(this));\n this.addEventListener('keyup', this.handleKeyup.bind(this));\n this.addEventListener('focusout', this.handleFocusout.bind(this));\n }\n }\n\n /**\n * Scrolls the toolbar, if overflowing, to the active tab, or the provided\n * tab.\n *\n * @param tabToScrollTo The tab that should be scrolled to. Defaults to the\n * active tab.\n * @return A Promise that resolves after the tab has been scrolled to.\n */\n async scrollToTab(tabToScrollTo?: Tab | null) {\n await this.updateComplete;\n const {tabs} = this;\n tabToScrollTo ??= this.activeTab;\n if (\n !tabToScrollTo ||\n !tabs.includes(tabToScrollTo) ||\n !this.tabsScrollerElement\n ) {\n return;\n }\n\n // wait for tabs to render.\n for (const tab of this.tabs) {\n await tab.updateComplete;\n }\n\n const offset = tabToScrollTo.offsetLeft;\n const extent = tabToScrollTo.offsetWidth;\n const scroll = this.scrollLeft;\n const hostExtent = this.offsetWidth;\n const scrollMargin = 48;\n const min = offset - scrollMargin;\n const max = offset + extent - hostExtent + scrollMargin;\n const to = Math.min(min, Math.max(max, scroll));\n // When a tab is focused, use 'auto' to use the CSS `scroll-behavior`. The\n // default behavior is smooth scrolling. However, when there is not a tab\n // focused on initialization, use 'instant' to immediately bring the focused\n // tab into view.\n const behavior: ScrollBehavior = !this.focusedTab ? 'instant' : 'auto';\n this.tabsScrollerElement.scrollTo({behavior, top: 0, left: to});\n }\n\n protected override render() {\n return html`\n <div class=\"tabs\">\n <slot\n @slotchange=${this.handleSlotChange}\n @click=${this.handleTabClick}></slot>\n </div>\n <md-divider part=\"divider\"></md-divider>\n `;\n }\n\n private async handleTabClick(event: Event) {\n const tab = event.target;\n // Allow event to bubble\n await 0;\n if (event.defaultPrevented || !isTab(tab) || tab.active) {\n return;\n }\n\n this.activateTab(tab);\n }\n\n private activateTab(activeTab: Tab) {\n const {tabs} = this;\n const previousTab = this.activeTab;\n if (!tabs.includes(activeTab) || previousTab === activeTab) {\n // Ignore setting activeTab to a tab element that is not a child.\n return;\n }\n\n for (const tab of tabs) {\n tab.active = tab === activeTab;\n }\n\n if (previousTab) {\n // Don't dispatch a change event if activating a tab when no previous tabs\n // were selected, such as when md-tabs auto-selects the first tab.\n const defaultPrevented = !this.dispatchEvent(\n new Event('change', {bubbles: true, cancelable: true}),\n );\n if (defaultPrevented) {\n for (const tab of tabs) {\n tab.active = tab === previousTab;\n }\n return;\n }\n\n activeTab[ANIMATE_INDICATOR](previousTab);\n }\n\n this.updateFocusableTab(activeTab);\n this.scrollToTab(activeTab);\n }\n\n private updateFocusableTab(focusableTab: Tab) {\n for (const tab of this.tabs) {\n tab.tabIndex = tab === focusableTab ? 0 : -1;\n }\n }\n\n // focus item on keydown and optionally select it\n private async handleKeydown(event: KeyboardEvent) {\n // Allow event to bubble.\n await 0;\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n const isHome = event.key === 'Home';\n const isEnd = event.key === 'End';\n // Ignore non-navigation keys\n if (event.defaultPrevented || (!isLeft && !isRight && !isHome && !isEnd)) {\n return;\n }\n\n const {tabs} = this;\n // Don't try to select another tab if there aren't any.\n if (tabs.length < 2) {\n return;\n }\n\n // Prevent default interactions, such as scrolling.\n event.preventDefault();\n\n let indexToFocus: number;\n if (isHome || isEnd) {\n indexToFocus = isHome ? 0 : tabs.length - 1;\n } else {\n // Check if moving forwards or backwards\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const forwards = isRtl ? isLeft : isRight;\n const {focusedTab} = this;\n if (!focusedTab) {\n // If there is not already a tab focused, select the first or last tab\n // based on the direction we're traveling.\n indexToFocus = forwards ? 0 : tabs.length - 1;\n } else {\n const focusedIndex = this.tabs.indexOf(focusedTab);\n indexToFocus = forwards ? focusedIndex + 1 : focusedIndex - 1;\n if (indexToFocus >= tabs.length) {\n // Return to start if moving past the last item.\n indexToFocus = 0;\n } else if (indexToFocus < 0) {\n // Go to end if moving before the first item.\n indexToFocus = tabs.length - 1;\n }\n }\n }\n\n const tabToFocus = tabs[indexToFocus];\n tabToFocus.focus();\n if (this.autoActivate) {\n this.activateTab(tabToFocus);\n } else {\n this.updateFocusableTab(tabToFocus);\n }\n }\n\n // scroll to item on keyup.\n private handleKeyup() {\n this.scrollToTab(this.focusedTab ?? this.activeTab);\n }\n\n private handleFocusout() {\n // restore focus to selected item when blurring the tab bar.\n if (this.matches(':focus-within')) {\n return;\n }\n\n const {activeTab} = this;\n if (activeTab) {\n this.updateFocusableTab(activeTab);\n }\n }\n\n private handleSlotChange() {\n const firstTab = this.tabs[0];\n if (!this.activeTab && firstTab) {\n // If the active tab was removed, auto-select the first one. There should\n // always be a selected tab while the bar has children.\n this.activateTab(firstTab);\n }\n\n // When children shift, ensure the active tab is visible. For example, if\n // many children are added before the active tab, it'd be pushed off screen.\n // This ensures it stays visible.\n this.scrollToTab(this.activeTab);\n }\n}\n\nfunction isTab(element: unknown): element is Tab {\n return element instanceof HTMLElement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;SAC5B;QAED,yEAAyE;QACzE,4EAA4E;QAC5E,iCAAiC;QACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;CACF;AA/QU;IADR,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,CAAC;kCACvC;AAwBtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAC,CAAC;0CAGvD;AAmCsD;IAAtD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;0CAAsB;AAE3C;IAAhC,KAAK,CAAC,OAAO,CAAC;iDAA2D;AAC1C;IAA/B,KAAK,CAAC,MAAM,CAAC;yCAAuD;AAiNvE,SAAS,KAAK,CAAC,OAAgB;IAC7B,OAAO,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../divider/divider.js';\n\nimport {html, isServer, LitElement} from 'lit';\nimport {property, query, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ANIMATE_INDICATOR, Tab} from './tab.js';\n\n/**\n * @fires change {Event} Fired when the selected tab changes. The target's\n * `activeTabIndex` or `activeTab` provide information about the selection\n * change. The change event is fired when a user interaction like a space/enter\n * key or click cause a selection change. The tab selection based on these\n * actions can be cancelled by calling preventDefault on the triggering\n * `keydown` or `click` event. --bubbles\n *\n * @example\n * // perform an action if a tab is clicked\n * tabs.addEventListener('change', (event: Event) => {\n * if (event.target.activeTabIndex === 2)\n * takeAction();\n * }\n * });\n *\n * // prevent a click from triggering tab selection under some condition\n * tabs.addEventListener('click', (event: Event) => {\n * if (notReady)\n * event.preventDefault();\n * }\n * });\n *\n */\nexport class Tabs extends LitElement {\n /**\n * The tabs of this tab bar.\n */\n @queryAssignedElements({flatten: true, selector: '[md-tab]'})\n readonly tabs!: Tab[];\n\n /**\n * The currently selected tab, `null` only when there are no tab children.\n *\n * @export\n */\n get activeTab() {\n return this.tabs.find((tab) => tab.active) ?? null;\n }\n set activeTab(tab: Tab | null) {\n // Ignore setting activeTab to null. As long as there are children, one tab\n // must be selected.\n if (tab) {\n this.activateTab(tab);\n }\n }\n\n /**\n * The index of the currently selected tab.\n *\n * @export\n */\n @property({type: Number, attribute: 'active-tab-index'})\n get activeTabIndex() {\n return this.tabs.findIndex((tab) => tab.active);\n }\n set activeTabIndex(index: number) {\n const activateTabAtIndex = () => {\n const tab = this.tabs[index];\n // Ignore out-of-bound indices.\n if (tab) {\n this.activateTab(tab);\n }\n };\n\n if (!this.slotElement) {\n // This is needed to support setting the activeTabIndex via a lit property\n // binding.\n //\n // ```ts\n // html`\n // <md-tabs .activeTabIndex=${1}>\n // <md-tab>First</md-tab>\n // <md-tab>Second</md-tab>\n // </md-tabs>\n // `;\n // ```\n //\n // It's needed since lit's rendering lifecycle is asynchronous, and the\n // `<slot>` element hasn't rendered, so `tabs` is empty.\n this.updateComplete.then(activateTabAtIndex);\n return;\n }\n\n activateTabAtIndex();\n }\n\n /**\n * Whether or not to automatically select a tab when it is focused.\n */\n @property({type: Boolean, attribute: 'auto-activate'}) autoActivate = false;\n\n @query('.tabs') private readonly tabsScrollerElement!: HTMLElement | null;\n @query('slot') private readonly slotElement!: HTMLSlotElement | null;\n\n private get focusedTab() {\n return this.tabs.find((tab) => tab.matches(':focus-within'));\n }\n\n private readonly internals =\n // Cast needed for closure\n (this as HTMLElement).attachInternals();\n\n constructor() {\n super();\n if (!isServer) {\n this.internals.role = 'tablist';\n this.addEventListener('keydown', this.handleKeydown.bind(this));\n this.addEventListener('keyup', this.handleKeyup.bind(this));\n this.addEventListener('focusout', this.handleFocusout.bind(this));\n }\n }\n\n /**\n * Scrolls the toolbar, if overflowing, to the active tab, or the provided\n * tab.\n *\n * @param tabToScrollTo The tab that should be scrolled to. Defaults to the\n * active tab.\n * @return A Promise that resolves after the tab has been scrolled to.\n */\n async scrollToTab(tabToScrollTo?: Tab | null) {\n await this.updateComplete;\n const {tabs} = this;\n tabToScrollTo ??= this.activeTab;\n if (\n !tabToScrollTo ||\n !tabs.includes(tabToScrollTo) ||\n !this.tabsScrollerElement\n ) {\n return;\n }\n\n // wait for tabs to render.\n for (const tab of this.tabs) {\n await tab.updateComplete;\n }\n\n const offset = tabToScrollTo.offsetLeft;\n const extent = tabToScrollTo.offsetWidth;\n const scroll = this.scrollLeft;\n const hostExtent = this.offsetWidth;\n const scrollMargin = 48;\n const min = offset - scrollMargin;\n const max = offset + extent - hostExtent + scrollMargin;\n const to = Math.min(min, Math.max(max, scroll));\n // When a tab is focused, use 'auto' to use the CSS `scroll-behavior`. The\n // default behavior is smooth scrolling. However, when there is not a tab\n // focused on initialization, use 'instant' to immediately bring the focused\n // tab into view.\n const behavior: ScrollBehavior = !this.focusedTab ? 'instant' : 'auto';\n this.tabsScrollerElement.scrollTo({behavior, top: 0, left: to});\n }\n\n protected override render() {\n return html`\n <div class=\"tabs\">\n <slot\n @slotchange=${this.handleSlotChange}\n @click=${this.handleTabClick}></slot>\n </div>\n <md-divider part=\"divider\"></md-divider>\n `;\n }\n\n private async handleTabClick(event: Event) {\n const tab = event.target;\n // Allow event to bubble\n await 0;\n if (event.defaultPrevented || !isTab(tab) || tab.active) {\n return;\n }\n\n this.activateTab(tab);\n }\n\n private activateTab(activeTab: Tab) {\n const {tabs} = this;\n const previousTab = this.activeTab;\n if (!tabs.includes(activeTab) || previousTab === activeTab) {\n // Ignore setting activeTab to a tab element that is not a child.\n return;\n }\n\n for (const tab of tabs) {\n tab.active = tab === activeTab;\n }\n\n if (previousTab) {\n // Don't dispatch a change event if activating a tab when no previous tabs\n // were selected, such as when md-tabs auto-selects the first tab.\n const defaultPrevented = !this.dispatchEvent(\n new Event('change', {bubbles: true, cancelable: true}),\n );\n if (defaultPrevented) {\n for (const tab of tabs) {\n tab.active = tab === previousTab;\n }\n return;\n }\n\n activeTab[ANIMATE_INDICATOR](previousTab);\n }\n\n this.updateFocusableTab(activeTab);\n this.scrollToTab(activeTab);\n }\n\n private updateFocusableTab(focusableTab: Tab) {\n for (const tab of this.tabs) {\n tab.tabIndex = tab === focusableTab ? 0 : -1;\n }\n }\n\n // focus item on keydown and optionally select it\n private async handleKeydown(event: KeyboardEvent) {\n // Allow event to bubble.\n await 0;\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n const isHome = event.key === 'Home';\n const isEnd = event.key === 'End';\n // Ignore non-navigation keys\n if (event.defaultPrevented || (!isLeft && !isRight && !isHome && !isEnd)) {\n return;\n }\n\n const {tabs} = this;\n // Don't try to select another tab if there aren't any.\n if (tabs.length < 2) {\n return;\n }\n\n // Prevent default interactions, such as scrolling.\n event.preventDefault();\n\n let indexToFocus: number;\n if (isHome || isEnd) {\n indexToFocus = isHome ? 0 : tabs.length - 1;\n } else {\n // Check if moving forwards or backwards\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const forwards = isRtl ? isLeft : isRight;\n const {focusedTab} = this;\n if (!focusedTab) {\n // If there is not already a tab focused, select the first or last tab\n // based on the direction we're traveling.\n indexToFocus = forwards ? 0 : tabs.length - 1;\n } else {\n const focusedIndex = this.tabs.indexOf(focusedTab);\n indexToFocus = forwards ? focusedIndex + 1 : focusedIndex - 1;\n if (indexToFocus >= tabs.length) {\n // Return to start if moving past the last item.\n indexToFocus = 0;\n } else if (indexToFocus < 0) {\n // Go to end if moving before the first item.\n indexToFocus = tabs.length - 1;\n }\n }\n }\n\n const tabToFocus = tabs[indexToFocus];\n tabToFocus.focus();\n if (this.autoActivate) {\n this.activateTab(tabToFocus);\n } else {\n this.updateFocusableTab(tabToFocus);\n }\n }\n\n // scroll to item on keyup.\n private handleKeyup() {\n this.scrollToTab(this.focusedTab ?? this.activeTab);\n }\n\n private handleFocusout() {\n // restore focus to selected item when blurring the tab bar.\n if (this.matches(':focus-within')) {\n return;\n }\n\n const {activeTab} = this;\n if (activeTab) {\n this.updateFocusableTab(activeTab);\n }\n }\n\n private handleSlotChange() {\n const firstTab = this.tabs[0];\n if (!this.activeTab && firstTab) {\n // If the active tab was removed, auto-select the first one. There should\n // always be a selected tab while the bar has children.\n this.activateTab(firstTab);\n }\n\n // When children shift, ensure the active tab is visible. For example, if\n // many children are added before the active tab, it'd be pushed off screen.\n // This ensures it stays visible.\n this.scrollToTab(this.activeTab);\n }\n}\n\nfunction isTab(element: unknown): element is Tab {\n return element instanceof HTMLElement && element.hasAttribute('md-tab');\n}\n"]}
|