@material/web 1.0.0-pre.6 → 1.0.0-pre.7
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/README.md +7 -7
- package/aria/aria.d.ts +43 -0
- package/aria/aria.js +56 -0
- package/aria/aria.js.map +1 -0
- package/aria/delegate.d.ts +37 -0
- package/aria/delegate.js +53 -0
- package/aria/delegate.js.map +1 -0
- package/badge/badge.d.ts +0 -1
- package/badge/badge.js +0 -1
- package/badge/badge.js.map +1 -1
- package/badge/lib/badge.d.ts +8 -7
- package/badge/lib/badge.js +5 -6
- package/badge/lib/badge.js.map +1 -1
- package/button/lib/_elevation.scss +13 -3
- package/button/lib/button.d.ts +1 -12
- package/button/lib/button.js +29 -60
- package/button/lib/button.js.map +1 -1
- package/button/lib/shared-elevation-styles.css.js +1 -1
- package/button/lib/shared-elevation-styles.css.js.map +1 -1
- package/checkbox/lib/checkbox.d.ts +0 -1
- package/checkbox/lib/checkbox.js +33 -43
- package/checkbox/lib/checkbox.js.map +1 -1
- package/chips/_filter-chip.scss +6 -0
- package/chips/filter-chip.d.ts +20 -0
- package/chips/filter-chip.js +24 -0
- package/chips/filter-chip.js.map +1 -0
- package/chips/lib/_filter-chip.scss +141 -0
- package/chips/lib/_shared.scss +18 -14
- package/chips/lib/assist-styles.css.js +1 -1
- package/chips/lib/assist-styles.css.js.map +1 -1
- package/chips/lib/chip.d.ts +8 -3
- package/chips/lib/chip.js +29 -30
- package/chips/lib/chip.js.map +1 -1
- package/chips/lib/filter-chip.d.ts +21 -0
- package/chips/lib/filter-chip.js +47 -0
- package/chips/lib/filter-chip.js.map +1 -0
- package/chips/lib/filter-styles.css.js +9 -0
- package/chips/lib/filter-styles.css.js.map +1 -0
- package/{fab/lib/fab-extended-styles.scss → chips/lib/filter-styles.scss} +3 -3
- package/chips/lib/shared-styles.css.js +1 -1
- package/chips/lib/shared-styles.css.js.map +1 -1
- package/chips/lib/suggestion-styles.css.js +1 -1
- package/chips/lib/suggestion-styles.css.js.map +1 -1
- package/circularprogress/harness.d.ts +1 -0
- package/circularprogress/harness.js +4 -0
- package/circularprogress/harness.js.map +1 -1
- package/circularprogress/lib/circular-progress.d.ts +0 -1
- package/circularprogress/lib/circular-progress.js +16 -19
- package/circularprogress/lib/circular-progress.js.map +1 -1
- package/dialog/lib/_dialog.scss +8 -8
- package/dialog/lib/dialog-styles.css.js +1 -1
- package/dialog/lib/dialog-styles.css.js.map +1 -1
- package/dialog/lib/dialog.js +25 -49
- package/dialog/lib/dialog.js.map +1 -1
- package/divider/lib/divider.js +4 -7
- package/divider/lib/divider.js.map +1 -1
- package/elevation/lib/_elevation.scss +5 -7
- package/elevation/lib/elevation-styles.css.js +1 -1
- package/elevation/lib/elevation-styles.css.js.map +1 -1
- package/fab/_fab.scss +1 -0
- package/fab/branded-fab.d.ts +53 -0
- package/fab/branded-fab.js +56 -0
- package/fab/branded-fab.js.map +1 -0
- package/fab/fab.d.ts +25 -5
- package/fab/fab.js +27 -10
- package/fab/fab.js.map +1 -1
- package/fab/harness.d.ts +1 -2
- package/fab/harness.js +1 -1
- package/fab/harness.js.map +1 -1
- package/fab/lib/_fab-branded.scss +27 -0
- package/fab/lib/_fab.scss +144 -16
- package/fab/lib/_shared.scss +155 -130
- package/fab/lib/fab-branded-styles.css.js +9 -0
- package/fab/lib/fab-branded-styles.css.js.map +1 -0
- package/fab/lib/fab-branded-styles.scss +10 -0
- package/fab/lib/fab-styles.css.js +1 -1
- package/fab/lib/fab-styles.css.js.map +1 -1
- package/fab/lib/fab.d.ts +14 -10
- package/fab/lib/fab.js +19 -12
- package/fab/lib/fab.js.map +1 -1
- package/fab/lib/forced-colors-styles.css.d.ts +1 -0
- package/fab/lib/forced-colors-styles.css.js +9 -0
- package/fab/lib/forced-colors-styles.css.js.map +1 -0
- package/fab/lib/forced-colors-styles.scss +26 -0
- package/fab/lib/shared-styles.css.d.ts +1 -0
- package/fab/lib/shared-styles.css.js +9 -0
- package/fab/lib/shared-styles.css.js.map +1 -0
- package/fab/lib/{fab-shared-styles.scss → shared-styles.scss} +1 -1
- package/fab/lib/{fab-shared.d.ts → shared.d.ts} +24 -16
- package/fab/lib/shared.js +137 -0
- package/fab/lib/shared.js.map +1 -0
- package/field/lib/field.js +14 -27
- package/field/lib/field.js.map +1 -1
- package/focus/focus-ring.d.ts +0 -1
- package/focus/focus-ring.js +0 -1
- package/focus/focus-ring.js.map +1 -1
- package/focus/lib/focus-ring.js +2 -3
- package/focus/lib/focus-ring.js.map +1 -1
- package/focus/strong-focus.js +5 -0
- package/focus/strong-focus.js.map +1 -1
- package/icon/icon.d.ts +0 -1
- package/icon/icon.js +0 -1
- package/icon/icon.js.map +1 -1
- package/icon/lib/_icon.scss +2 -0
- package/icon/lib/icon-styles.css.js +1 -1
- package/icon/lib/icon-styles.css.js.map +1 -1
- package/icon/lib/icon.d.ts +5 -4
- package/icon/lib/icon.js +3 -2
- package/icon/lib/icon.js.map +1 -1
- package/iconbutton/lib/icon-button.d.ts +0 -4
- package/iconbutton/lib/icon-button.js +28 -48
- package/iconbutton/lib/icon-button.js.map +1 -1
- package/linearprogress/_linear-progress.scss +6 -0
- package/linearprogress/harness.d.ts +13 -0
- package/linearprogress/harness.js +18 -0
- package/linearprogress/harness.js.map +1 -0
- package/linearprogress/lib/_linear-progress.scss +380 -0
- package/linearprogress/lib/linear-progress-styles.css.d.ts +1 -0
- package/linearprogress/lib/linear-progress-styles.css.js +9 -0
- package/linearprogress/lib/linear-progress-styles.css.js.map +1 -0
- package/linearprogress/lib/linear-progress-styles.scss +8 -0
- package/linearprogress/lib/linear-progress.d.ts +35 -0
- package/linearprogress/lib/linear-progress.js +127 -0
- package/linearprogress/lib/linear-progress.js.map +1 -0
- package/linearprogress/linear-progress.d.ts +23 -0
- package/linearprogress/linear-progress.js +26 -0
- package/linearprogress/linear-progress.js.map +1 -0
- package/list/lib/_list.scss +6 -49
- package/list/lib/list-styles.css.js +1 -1
- package/list/lib/list-styles.css.js.map +1 -1
- package/list/lib/list.d.ts +1 -3
- package/list/lib/list.js +18 -34
- package/list/lib/list.js.map +1 -1
- package/list/lib/listitem/_list-item.scss +10 -69
- package/list/lib/listitem/forced-colors-styles.css.js +1 -1
- package/list/lib/listitem/forced-colors-styles.css.js.map +1 -1
- package/list/lib/listitem/list-item-styles.css.js +1 -1
- package/list/lib/listitem/list-item-styles.css.js.map +1 -1
- package/list/lib/listitem/list-item.d.ts +2 -4
- package/list/lib/listitem/list-item.js +24 -53
- package/list/lib/listitem/list-item.js.map +1 -1
- package/list/lib/listitemlink/list-item-link.js +4 -6
- package/list/lib/listitemlink/list-item-link.js.map +1 -1
- package/menu/lib/_menu.scss +6 -28
- package/menu/lib/menu-styles.css.js +1 -1
- package/menu/lib/menu-styles.css.js.map +1 -1
- package/menu/lib/menu.d.ts +1 -2
- package/menu/lib/menu.js +38 -63
- package/menu/lib/menu.js.map +1 -1
- package/menu/lib/menuitem/_menu-item.scss +13 -32
- package/menu/lib/menuitem/menu-item-styles.css.js +1 -1
- package/menu/lib/menuitem/menu-item-styles.css.js.map +1 -1
- package/menu/lib/menuitem/menu-item.d.ts +1 -1
- package/menu/lib/menuitem/menu-item.js +4 -6
- package/menu/lib/menuitem/menu-item.js.map +1 -1
- package/menu/lib/menuitemlink/menu-item-link.d.ts +0 -2
- package/menu/lib/menuitemlink/menu-item-link.js +3 -6
- package/menu/lib/menuitemlink/menu-item-link.js.map +1 -1
- package/menu/lib/shared.d.ts +6 -2
- package/menu/lib/shared.js.map +1 -1
- package/menu/lib/submenuitem/sub-menu-item.d.ts +0 -2
- package/menu/lib/submenuitem/sub-menu-item.js +7 -15
- package/menu/lib/submenuitem/sub-menu-item.js.map +1 -1
- package/navigationbar/lib/_navigation-bar.scss +7 -1
- package/navigationbar/lib/navigation-bar-styles.css.js +1 -1
- package/navigationbar/lib/navigation-bar-styles.css.js.map +1 -1
- package/navigationbar/lib/navigation-bar.d.ts +5 -5
- package/navigationbar/lib/navigation-bar.js +17 -18
- package/navigationbar/lib/navigation-bar.js.map +1 -1
- package/navigationbar/navigation-bar.d.ts +0 -1
- package/navigationbar/navigation-bar.js +0 -1
- package/navigationbar/navigation-bar.js.map +1 -1
- package/navigationdrawer/lib/navigation-drawer-modal.d.ts +5 -10
- package/navigationdrawer/lib/navigation-drawer-modal.js +19 -41
- package/navigationdrawer/lib/navigation-drawer-modal.js.map +1 -1
- package/navigationdrawer/lib/navigation-drawer.d.ts +5 -9
- package/navigationdrawer/lib/navigation-drawer.js +17 -38
- package/navigationdrawer/lib/navigation-drawer.js.map +1 -1
- package/navigationdrawer/navigation-drawer-modal.d.ts +0 -1
- package/navigationdrawer/navigation-drawer-modal.js +0 -1
- package/navigationdrawer/navigation-drawer-modal.js.map +1 -1
- package/navigationdrawer/navigation-drawer.d.ts +0 -1
- package/navigationdrawer/navigation-drawer.js +0 -1
- package/navigationdrawer/navigation-drawer.js.map +1 -1
- package/navigationtab/lib/navigation-tab.d.ts +19 -24
- package/navigationtab/lib/navigation-tab.js +48 -68
- package/navigationtab/lib/navigation-tab.js.map +1 -1
- package/navigationtab/navigation-tab.d.ts +0 -1
- package/navigationtab/navigation-tab.js +0 -1
- package/navigationtab/navigation-tab.js.map +1 -1
- package/package.json +1 -1
- package/radio/lib/radio.d.ts +0 -1
- package/radio/lib/radio.js +30 -37
- package/radio/lib/radio.js.map +1 -1
- package/ripple/lib/ripple.js +7 -13
- package/ripple/lib/ripple.js.map +1 -1
- package/segmentedbutton/lib/outlined-segmented-button.d.ts +16 -7
- package/segmentedbutton/lib/outlined-segmented-button.js +3 -3
- package/segmentedbutton/lib/outlined-segmented-button.js.map +1 -1
- package/segmentedbutton/lib/segmented-button.d.ts +27 -33
- package/segmentedbutton/lib/segmented-button.js +42 -75
- package/segmentedbutton/lib/segmented-button.js.map +1 -1
- package/segmentedbutton/outlined-segmented-button.d.ts +0 -1
- package/segmentedbutton/outlined-segmented-button.js +0 -1
- package/segmentedbutton/outlined-segmented-button.js.map +1 -1
- package/segmentedbuttonset/lib/outlined-segmented-button-set.d.ts +6 -4
- package/segmentedbuttonset/lib/outlined-segmented-button-set.js +3 -2
- package/segmentedbuttonset/lib/outlined-segmented-button-set.js.map +1 -1
- package/segmentedbuttonset/lib/segmented-button-set.d.ts +3 -9
- package/segmentedbuttonset/lib/segmented-button-set.js +14 -20
- package/segmentedbuttonset/lib/segmented-button-set.js.map +1 -1
- package/segmentedbuttonset/outlined-segmented-button-set.d.ts +0 -1
- package/segmentedbuttonset/outlined-segmented-button-set.js +0 -1
- package/segmentedbuttonset/outlined-segmented-button-set.js.map +1 -1
- package/select/_filled-select.scss +6 -0
- package/select/_outlined-select.scss +6 -0
- package/select/filled-select.d.ts +41 -0
- package/select/filled-select.js +46 -0
- package/select/filled-select.js.map +1 -0
- package/select/harness.d.ts +24 -0
- package/select/harness.js +53 -0
- package/select/harness.js.map +1 -0
- package/select/lib/_filled-select.scss +163 -0
- package/select/lib/_outlined-select.scss +146 -0
- package/select/lib/_shared.scss +48 -0
- package/select/lib/filled-forced-colors-styles.css.d.ts +1 -0
- package/select/lib/filled-forced-colors-styles.css.js +9 -0
- package/select/lib/filled-forced-colors-styles.css.js.map +1 -0
- package/select/lib/filled-forced-colors-styles.scss +29 -0
- package/select/lib/filled-select-styles.css.d.ts +1 -0
- package/select/lib/filled-select-styles.css.js +9 -0
- package/select/lib/filled-select-styles.css.js.map +1 -0
- package/select/lib/filled-select-styles.scss +10 -0
- package/select/lib/filled-select.d.ts +10 -0
- package/select/lib/filled-select.js +16 -0
- package/select/lib/filled-select.js.map +1 -0
- package/select/lib/outlined-forced-colors-styles.css.d.ts +1 -0
- package/select/lib/outlined-forced-colors-styles.css.js +9 -0
- package/select/lib/outlined-forced-colors-styles.css.js.map +1 -0
- package/select/lib/outlined-forced-colors-styles.scss +29 -0
- package/select/lib/outlined-select-styles.css.d.ts +1 -0
- package/select/lib/outlined-select-styles.css.js +9 -0
- package/select/lib/outlined-select-styles.css.js.map +1 -0
- package/select/lib/outlined-select-styles.scss +10 -0
- package/select/lib/outlined-select.d.ts +10 -0
- package/select/lib/outlined-select.js +16 -0
- package/select/lib/outlined-select.js.map +1 -0
- package/select/lib/select.d.ts +218 -0
- package/select/lib/select.js +587 -0
- package/select/lib/select.js.map +1 -0
- package/select/lib/selectoption/harness.d.ts +11 -0
- package/select/lib/selectoption/harness.js +12 -0
- package/select/lib/selectoption/harness.js.map +1 -0
- package/select/lib/selectoption/select-option.d.ts +30 -0
- package/select/lib/selectoption/select-option.js +71 -0
- package/select/lib/selectoption/select-option.js.map +1 -0
- package/select/lib/shared-styles.css.d.ts +1 -0
- package/select/lib/shared-styles.css.js +9 -0
- package/select/lib/shared-styles.css.js.map +1 -0
- package/select/lib/shared-styles.scss +10 -0
- package/select/lib/shared.d.ts +52 -0
- package/select/lib/shared.js +41 -0
- package/select/lib/shared.js.map +1 -0
- package/select/outlined-select.d.ts +41 -0
- package/select/outlined-select.js +46 -0
- package/select/outlined-select.js.map +1 -0
- package/select/select-option.d.ts +44 -0
- package/select/select-option.js +51 -0
- package/select/select-option.js.map +1 -0
- package/slider/harness.d.ts +1 -0
- package/slider/harness.js +5 -0
- package/slider/harness.js.map +1 -1
- package/slider/lib/_slider.scss +146 -164
- package/slider/lib/forced-colors-styles.css.js +1 -1
- package/slider/lib/forced-colors-styles.css.js.map +1 -1
- package/slider/lib/forced-colors-styles.scss +2 -2
- package/slider/lib/slider-styles.css.js +1 -1
- package/slider/lib/slider-styles.css.js.map +1 -1
- package/slider/lib/slider.d.ts +2 -7
- package/slider/lib/slider.js +64 -118
- package/slider/lib/slider.js.map +1 -1
- package/switch/lib/switch.d.ts +0 -2
- package/switch/lib/switch.js +32 -54
- package/switch/lib/switch.js.map +1 -1
- package/textfield/lib/text-field.d.ts +0 -10
- package/textfield/lib/text-field.js +45 -115
- package/textfield/lib/text-field.js.map +1 -1
- package/tokens/_index.scss +3 -0
- package/tokens/_md-comp-assist-chip.scss +25 -20
- package/tokens/_md-comp-elevation.scss +0 -4
- package/tokens/_md-comp-fab-branded.scss +109 -1
- package/tokens/_md-comp-fab.scss +290 -0
- package/tokens/_md-comp-filled-select.scss +150 -1
- package/tokens/_md-comp-filter-chip.scss +103 -93
- package/tokens/_md-comp-input-chip.scss +77 -85
- package/tokens/_md-comp-linear-progress-indicator.scss +14 -1
- package/tokens/_md-comp-list-item.scss +201 -0
- package/tokens/_md-comp-list.scss +107 -26
- package/tokens/_md-comp-menu-item.scss +76 -0
- package/tokens/_md-comp-menu.scss +52 -2
- package/tokens/_md-comp-outlined-select.scss +150 -1
- package/tokens/_md-comp-slider.scss +13 -1
- package/tokens/_md-comp-suggestion-chip.scss +29 -21
- package/tokens/_values.scss +5 -2
- package/types/aria.d.ts +61 -1
- package/actionelement/action-element.d.ts +0 -79
- package/actionelement/action-element.js +0 -97
- package/actionelement/action-element.js.map +0 -1
- package/button/lib/state.d.ts +0 -10
- package/button/lib/state.js +0 -7
- package/button/lib/state.js.map +0 -1
- package/controller/action-controller.d.ts +0 -147
- package/controller/action-controller.js +0 -286
- package/controller/action-controller.js.map +0 -1
- package/decorators/aria-property.d.ts +0 -32
- package/decorators/aria-property.js +0 -99
- package/decorators/aria-property.js.map +0 -1
- package/fab/_fab-extended.scss +0 -6
- package/fab/fab-extended.d.ts +0 -23
- package/fab/fab-extended.js +0 -29
- package/fab/fab-extended.js.map +0 -1
- package/fab/lib/_fab-extended.scss +0 -73
- package/fab/lib/fab-extended-styles.css.js +0 -9
- package/fab/lib/fab-extended-styles.css.js.map +0 -1
- package/fab/lib/fab-extended.d.ts +0 -19
- package/fab/lib/fab-extended.js +0 -28
- package/fab/lib/fab-extended.js.map +0 -1
- package/fab/lib/fab-shared-styles.css.js +0 -9
- package/fab/lib/fab-shared-styles.css.js.map +0 -1
- package/fab/lib/fab-shared.js +0 -121
- package/fab/lib/fab-shared.js.map +0 -1
- package/slider/lib/_tokens.scss +0 -65
- /package/{fab/lib/fab-extended-styles.css.d.ts → chips/lib/filter-styles.css.d.ts} +0 -0
- /package/fab/lib/{fab-shared-styles.css.d.ts → fab-branded-styles.css.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import '../../elevation/elevation.js';
|
|
@@ -8,34 +8,42 @@ import '../../focus/focus-ring.js';
|
|
|
8
8
|
import '../../ripple/ripple.js';
|
|
9
9
|
import { LitElement, TemplateResult } from 'lit';
|
|
10
10
|
import { ClassInfo } from 'lit/directives/class-map.js';
|
|
11
|
+
import { MdRipple } from '../../ripple/ripple.js';
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Sizes variants available to non-extended FABs.
|
|
13
14
|
*/
|
|
14
|
-
export
|
|
15
|
+
export type FabSize = 'medium' | 'small' | 'large';
|
|
16
|
+
export declare abstract class SharedFab extends LitElement {
|
|
15
17
|
static shadowRootOptions: ShadowRootInit;
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The size of the FAB.
|
|
20
|
+
*
|
|
21
|
+
* NOTE: Branded FABs cannot be sized to `small`, and Extended FABs do not
|
|
22
|
+
* have different sizes.
|
|
23
|
+
*/
|
|
24
|
+
size: FabSize;
|
|
25
|
+
/**
|
|
26
|
+
* The text to display on the FAB.
|
|
27
|
+
*/
|
|
17
28
|
label: string;
|
|
29
|
+
/**
|
|
30
|
+
* Lowers the FAB's elevation.
|
|
31
|
+
*/
|
|
18
32
|
lowered: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Lowers the FAB's elevation and places it into the `lowered` state.
|
|
35
|
+
*/
|
|
19
36
|
reducedTouchTarget: boolean;
|
|
20
|
-
private readonly ripple;
|
|
21
37
|
private showFocusRing;
|
|
22
38
|
private showRipple;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @soyClasses fabClasses: .md3-fab
|
|
26
|
-
*/
|
|
39
|
+
private readonly ripple;
|
|
40
|
+
protected getRipple: () => Promise<MdRipple>;
|
|
27
41
|
protected render(): TemplateResult;
|
|
28
|
-
/** @soyTemplate */
|
|
29
42
|
protected getRenderClasses(): ClassInfo;
|
|
30
|
-
/** @soyTemplate */
|
|
31
|
-
protected abstract renderIcon(icon: string): TemplateResult | string;
|
|
32
|
-
/** @soyTemplate */
|
|
33
43
|
protected renderTouchTarget(): TemplateResult;
|
|
34
|
-
/** @soyTemplate */
|
|
35
44
|
protected renderLabel(): TemplateResult | string;
|
|
36
|
-
|
|
45
|
+
protected renderIcon(): TemplateResult<1>;
|
|
37
46
|
protected renderElevation(): TemplateResult;
|
|
38
|
-
/** @soyTemplate */
|
|
39
47
|
protected renderFocusRing(): TemplateResult;
|
|
40
48
|
private handlePointerDown;
|
|
41
49
|
private handleFocus;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
var _a;
|
|
7
|
+
import { __decorate } from "tslib";
|
|
8
|
+
import '../../elevation/elevation.js';
|
|
9
|
+
import '../../focus/focus-ring.js';
|
|
10
|
+
import '../../ripple/ripple.js';
|
|
11
|
+
import { html, LitElement, nothing } from 'lit';
|
|
12
|
+
import { property, queryAsync, state } from 'lit/decorators.js';
|
|
13
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
14
|
+
import { when } from 'lit/directives/when.js';
|
|
15
|
+
import { requestUpdateOnAriaChange } from '../../aria/delegate.js';
|
|
16
|
+
import { pointerPress, shouldShowStrongFocus } from '../../focus/strong-focus.js';
|
|
17
|
+
import { ripple } from '../../ripple/directive.js';
|
|
18
|
+
// tslint:disable-next-line:enforce-comments-on-exported-symbols
|
|
19
|
+
export class SharedFab extends LitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
/**
|
|
23
|
+
* The size of the FAB.
|
|
24
|
+
*
|
|
25
|
+
* NOTE: Branded FABs cannot be sized to `small`, and Extended FABs do not
|
|
26
|
+
* have different sizes.
|
|
27
|
+
*/
|
|
28
|
+
this.size = 'medium';
|
|
29
|
+
/**
|
|
30
|
+
* The text to display on the FAB.
|
|
31
|
+
*/
|
|
32
|
+
this.label = '';
|
|
33
|
+
/**
|
|
34
|
+
* Lowers the FAB's elevation.
|
|
35
|
+
*/
|
|
36
|
+
this.lowered = false;
|
|
37
|
+
/**
|
|
38
|
+
* Lowers the FAB's elevation and places it into the `lowered` state.
|
|
39
|
+
*/
|
|
40
|
+
this.reducedTouchTarget = false;
|
|
41
|
+
this.showFocusRing = false;
|
|
42
|
+
this.showRipple = false;
|
|
43
|
+
this.getRipple = () => {
|
|
44
|
+
this.showRipple = true;
|
|
45
|
+
return this.ripple;
|
|
46
|
+
};
|
|
47
|
+
this.renderRipple = () => {
|
|
48
|
+
return html `<md-ripple class="ripple"></md-ripple>`;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
// Needed for closure conformance
|
|
53
|
+
const { ariaLabel } = this;
|
|
54
|
+
return html `
|
|
55
|
+
<button
|
|
56
|
+
class="fab ${classMap(this.getRenderClasses())}"
|
|
57
|
+
aria-label=${ariaLabel || nothing}
|
|
58
|
+
@focus=${this.handleFocus}
|
|
59
|
+
@blur=${this.handleBlur}
|
|
60
|
+
@pointerdown=${this.handlePointerDown}
|
|
61
|
+
${ripple(this.getRipple)}>
|
|
62
|
+
${this.renderElevation()}
|
|
63
|
+
${this.renderFocusRing()}
|
|
64
|
+
${when(this.showRipple, this.renderRipple)}
|
|
65
|
+
${this.renderTouchTarget()}
|
|
66
|
+
${this.renderIcon()}
|
|
67
|
+
${this.renderLabel()}
|
|
68
|
+
</button>`;
|
|
69
|
+
}
|
|
70
|
+
getRenderClasses() {
|
|
71
|
+
const isExtended = !!this.label;
|
|
72
|
+
return {
|
|
73
|
+
'lowered': this.lowered,
|
|
74
|
+
'small': this.size === 'small' && !isExtended,
|
|
75
|
+
'large': this.size === 'large' && !isExtended,
|
|
76
|
+
'extended': isExtended,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
renderTouchTarget() {
|
|
80
|
+
return this.reducedTouchTarget ? html `` :
|
|
81
|
+
html `<div class="touch-target"></div>`;
|
|
82
|
+
}
|
|
83
|
+
renderLabel() {
|
|
84
|
+
return this.label ? html `<span class="label">${this.label}</span>` : '';
|
|
85
|
+
}
|
|
86
|
+
renderIcon() {
|
|
87
|
+
return html `<span class="icon">
|
|
88
|
+
<slot name="icon"></slot>
|
|
89
|
+
</span>`;
|
|
90
|
+
}
|
|
91
|
+
renderElevation() {
|
|
92
|
+
return html `<md-elevation></md-elevation>`;
|
|
93
|
+
}
|
|
94
|
+
renderFocusRing() {
|
|
95
|
+
return html `<md-focus-ring .visible="${this.showFocusRing}"></md-focus-ring>`;
|
|
96
|
+
}
|
|
97
|
+
handlePointerDown(e) {
|
|
98
|
+
pointerPress();
|
|
99
|
+
this.showFocusRing = shouldShowStrongFocus();
|
|
100
|
+
}
|
|
101
|
+
handleFocus() {
|
|
102
|
+
this.showFocusRing = shouldShowStrongFocus();
|
|
103
|
+
}
|
|
104
|
+
handleBlur() {
|
|
105
|
+
this.showFocusRing = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
_a = SharedFab;
|
|
109
|
+
(() => {
|
|
110
|
+
requestUpdateOnAriaChange(_a);
|
|
111
|
+
})();
|
|
112
|
+
SharedFab.shadowRootOptions = {
|
|
113
|
+
mode: 'open',
|
|
114
|
+
delegatesFocus: true,
|
|
115
|
+
};
|
|
116
|
+
__decorate([
|
|
117
|
+
property()
|
|
118
|
+
], SharedFab.prototype, "size", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property()
|
|
121
|
+
], SharedFab.prototype, "label", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: Boolean })
|
|
124
|
+
], SharedFab.prototype, "lowered", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Boolean })
|
|
127
|
+
], SharedFab.prototype, "reducedTouchTarget", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
state()
|
|
130
|
+
], SharedFab.prototype, "showFocusRing", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
state()
|
|
133
|
+
], SharedFab.prototype, "showRipple", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
queryAsync('md-ripple')
|
|
136
|
+
], SharedFab.prototype, "ripple", void 0);
|
|
137
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AASjD,gEAAgE;AAChE,MAAM,OAAgB,SAAU,SAAQ,UAAU;IAAlD;;QAUE;;;;;WAKG;QACS,SAAI,GAAY,QAAQ,CAAC;QAErC;;WAEG;QACS,UAAK,GAAG,EAAE,CAAC;QAGvB;;WAEG;QACwB,YAAO,GAAG,KAAK,CAAC;QAE3C;;WAEG;QACwB,uBAAkB,GAAG,KAAK,CAAC;QAErC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,IAAI,CAAA,kCAAkC,CAAC;IAC1E,CAAC;IAES,WAAW;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,uBAAuB,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAA;;cAED,CAAC;IACb,CAAC;IAES,eAAe;QACvB,OAAO,IAAI,CAAA,+BAA+B,CAAC;IAC7C,CAAC;IAES,eAAe;QACvB,OAAO,IAAI,CAAA,4BACP,IAAI,CAAC,aAAa,oBAAoB,CAAC;IAC7C,CAAC;IAEO,iBAAiB,CAAC,CAAe;QACvC,YAAY,EAAE,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,qBAAqB,EAAE,CAAC;IAC/C,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,aAAa,GAAG,qBAAqB,EAAE,CAAC;IAC/C,CAAC;IAEO,UAAU;QAChB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;;;AA5GD;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAEe,2BAAiB,GAAmB;IAClD,IAAI,EAAE,MAAe;IACrB,cAAc,EAAE,IAAI;CACrB,CAAC;AAQU;IAAX,QAAQ,EAAE;uCAA0B;AAKzB;IAAX,QAAQ,EAAE;wCAAY;AAMI;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;0CAAiB;AAKhB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;qDAA4B;AAE7C;IAAR,KAAK,EAAE;gDAA+B;AAC9B;IAAR,KAAK,EAAE;6CAA4B;AAEX;IAAxB,UAAU,CAAC,WAAW,CAAC;yCAAkD","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\nimport '../../focus/focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, TemplateResult} from 'lit';\nimport {property, queryAsync, state} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {when} from 'lit/directives/when.js';\n\nimport {requestUpdateOnAriaChange} from '../../aria/delegate.js';\nimport {pointerPress, shouldShowStrongFocus} from '../../focus/strong-focus.js';\nimport {ripple} from '../../ripple/directive.js';\nimport {MdRipple} from '../../ripple/ripple.js';\nimport {ARIAMixinStrict} from '../../types/aria.js';\n\n/**\n * Sizes variants available to non-extended FABs.\n */\nexport type FabSize = 'medium'|'small'|'large';\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport abstract class SharedFab extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open' as const,\n delegatesFocus: true,\n };\n\n /**\n * The size of the FAB.\n *\n * NOTE: Branded FABs cannot be sized to `small`, and Extended FABs do not\n * have different sizes.\n */\n @property() size: FabSize = 'medium';\n\n /**\n * The text to display on the FAB.\n */\n @property() label = '';\n\n\n /**\n * Lowers the FAB's elevation.\n */\n @property({type: Boolean}) lowered = false;\n\n /**\n * Lowers the FAB's elevation and places it into the `lowered` state.\n */\n @property({type: Boolean}) reducedTouchTarget = false;\n\n @state() private showFocusRing = false;\n @state() private showRipple = false;\n\n @queryAsync('md-ripple') private readonly ripple!: Promise<MdRipple|null>;\n\n protected getRipple = () => {\n this.showRipple = true;\n return this.ripple;\n };\n\n protected override render(): TemplateResult {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <button\n class=\"fab ${classMap(this.getRenderClasses())}\"\n aria-label=${ariaLabel || nothing}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @pointerdown=${this.handlePointerDown}\n ${ripple(this.getRipple)}>\n ${this.renderElevation()}\n ${this.renderFocusRing()}\n ${when(this.showRipple, this.renderRipple)}\n ${this.renderTouchTarget()}\n ${this.renderIcon()}\n ${this.renderLabel()}\n </button>`;\n }\n\n protected getRenderClasses(): ClassInfo {\n const isExtended = !!this.label;\n return {\n 'lowered': this.lowered,\n 'small': this.size === 'small' && !isExtended,\n 'large': this.size === 'large' && !isExtended,\n 'extended': isExtended,\n };\n }\n\n protected renderTouchTarget(): TemplateResult {\n return this.reducedTouchTarget ? html`` :\n html`<div class=\"touch-target\"></div>`;\n }\n\n protected renderLabel(): TemplateResult|string {\n return this.label ? html`<span class=\"label\">${this.label}</span>` : '';\n }\n\n protected renderIcon() {\n return html`<span class=\"icon\">\n <slot name=\"icon\"></slot>\n </span>`;\n }\n\n protected renderElevation(): TemplateResult {\n return html`<md-elevation></md-elevation>`;\n }\n\n protected renderFocusRing(): TemplateResult {\n return html`<md-focus-ring .visible=\"${\n this.showFocusRing}\"></md-focus-ring>`;\n }\n\n private handlePointerDown(e: PointerEvent) {\n pointerPress();\n this.showFocusRing = shouldShowStrongFocus();\n }\n\n private handleFocus() {\n this.showFocusRing = shouldShowStrongFocus();\n }\n\n private handleBlur() {\n this.showFocusRing = false;\n }\n\n private readonly renderRipple = () => {\n return html`<md-ripple class=\"ripple\"></md-ripple>`;\n };\n}\n"]}
|
package/field/lib/field.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { __decorate
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
7
|
import { html, LitElement, nothing } from 'lit';
|
|
8
8
|
import { property, query, state } from 'lit/decorators.js';
|
|
9
9
|
import { classMap } from 'lit/directives/class-map.js';
|
|
@@ -195,55 +195,42 @@ export class Field extends LitElement {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
__decorate([
|
|
198
|
-
property({ type: Boolean })
|
|
199
|
-
__metadata("design:type", Object)
|
|
198
|
+
property({ type: Boolean })
|
|
200
199
|
], Field.prototype, "disabled", void 0);
|
|
201
200
|
__decorate([
|
|
202
|
-
property({ type: Boolean })
|
|
203
|
-
__metadata("design:type", Object)
|
|
201
|
+
property({ type: Boolean })
|
|
204
202
|
], Field.prototype, "error", void 0);
|
|
205
203
|
__decorate([
|
|
206
|
-
property({ type: Boolean })
|
|
207
|
-
__metadata("design:type", Object)
|
|
204
|
+
property({ type: Boolean })
|
|
208
205
|
], Field.prototype, "focused", void 0);
|
|
209
206
|
__decorate([
|
|
210
|
-
property(
|
|
211
|
-
__metadata("design:type", String)
|
|
207
|
+
property()
|
|
212
208
|
], Field.prototype, "label", void 0);
|
|
213
209
|
__decorate([
|
|
214
|
-
property({ type: Boolean })
|
|
215
|
-
__metadata("design:type", Object)
|
|
210
|
+
property({ type: Boolean })
|
|
216
211
|
], Field.prototype, "populated", void 0);
|
|
217
212
|
__decorate([
|
|
218
|
-
property({ type: Boolean })
|
|
219
|
-
__metadata("design:type", Object)
|
|
213
|
+
property({ type: Boolean })
|
|
220
214
|
], Field.prototype, "resizable", void 0);
|
|
221
215
|
__decorate([
|
|
222
|
-
property({ type: Boolean })
|
|
223
|
-
__metadata("design:type", Object)
|
|
216
|
+
property({ type: Boolean })
|
|
224
217
|
], Field.prototype, "required", void 0);
|
|
225
218
|
__decorate([
|
|
226
|
-
property({ type: Boolean })
|
|
227
|
-
__metadata("design:type", Object)
|
|
219
|
+
property({ type: Boolean })
|
|
228
220
|
], Field.prototype, "hasStart", void 0);
|
|
229
221
|
__decorate([
|
|
230
|
-
property({ type: Boolean })
|
|
231
|
-
__metadata("design:type", Object)
|
|
222
|
+
property({ type: Boolean })
|
|
232
223
|
], Field.prototype, "hasEnd", void 0);
|
|
233
224
|
__decorate([
|
|
234
|
-
state()
|
|
235
|
-
__metadata("design:type", Object)
|
|
225
|
+
state()
|
|
236
226
|
], Field.prototype, "isAnimating", void 0);
|
|
237
227
|
__decorate([
|
|
238
|
-
query('.label.floating')
|
|
239
|
-
__metadata("design:type", HTMLElement)
|
|
228
|
+
query('.label.floating')
|
|
240
229
|
], Field.prototype, "floatingLabelEl", void 0);
|
|
241
230
|
__decorate([
|
|
242
|
-
query('.label.resting')
|
|
243
|
-
__metadata("design:type", HTMLElement)
|
|
231
|
+
query('.label.resting')
|
|
244
232
|
], Field.prototype, "restingLabelEl", void 0);
|
|
245
233
|
__decorate([
|
|
246
|
-
query('.container')
|
|
247
|
-
__metadata("design:type", HTMLElement)
|
|
234
|
+
query('.container')
|
|
248
235
|
], Field.prototype, "containerEl", void 0);
|
|
249
236
|
//# sourceMappingURL=field.js.map
|
package/field/lib/field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["field.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,UAAU;IAArC;;QAC6B,aAAQ,GAAG,KAAK,CAAC;QACjB,UAAK,GAAG,KAAK,CAAC;QACd,YAAO,GAAG,KAAK,CAAC;QAEhB,cAAS,GAAG,KAAK,CAAC;QAClB,cAAS,GAAG,KAAK,CAAC;QAClB,aAAQ,GAAG,KAAK,CAAC;QAE5C;;WAEG;QACwB,aAAQ,GAAG,KAAK,CAAC;QAE5C;;WAEG;QACwB,WAAM,GAAG,KAAK,CAAC;QAEzB,gBAAW,GAAG,KAAK,CAAC;IAuMvC,CAAC;IAjMoB,MAAM,CAAC,KAA4B;QACpD,+BAA+B;QAE/B,kDAAkD;QAClD,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;YACjC,KA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CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;;oCAAgB;AACzC;IAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;;wCAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;;wCAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;;uCAAkB;AAK5C;IAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;;uCAAkB;AAK5C;IAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;;qCAAgB;AAE1C;IAAC,KAAK,EAAE;;0CAA6B;AAErC;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAAoC,WAAW;8CAAM;AAC9E;IAAC,KAAK,CAAC,gBAAgB,CAAC;8BAAmC,WAAW;6CAAM;AAC5E;IAAC,KAAK,CAAC,YAAY,CAAC;8BAAgC,WAAW;0CAAM","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {SurfacePositionTarget} from '../../menu/lib/surfacePositionController.js';\n\nimport {EASING} from '../../motion/animation.js';\n\n/**\n * A field component.\n */\nexport class Field extends LitElement implements SurfacePositionTarget {\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean}) error = false;\n @property({type: Boolean}) focused = false;\n @property({type: String}) label?: string;\n @property({type: Boolean}) populated = false;\n @property({type: Boolean}) resizable = false;\n @property({type: Boolean}) required = false;\n\n /**\n * Whether or not the field has leading content.\n */\n @property({type: Boolean}) hasStart = false;\n\n /**\n * Whether or not the field has trailing content.\n */\n @property({type: Boolean}) hasEnd = false;\n\n @state() private isAnimating = false;\n private labelAnimation?: Animation;\n @query('.label.floating') private readonly floatingLabelEl!: HTMLElement|null;\n @query('.label.resting') private readonly restingLabelEl!: HTMLElement|null;\n @query('.container') private readonly containerEl!: HTMLElement|null;\n\n protected override update(props: PropertyValues<Field>) {\n // Client-side property updates\n\n // When disabling, remove focus styles if focused.\n if (this.disabled && this.focused) {\n props.set('focused', true);\n this.focused = false;\n }\n\n // Animate if focused or populated change.\n this.animateLabelIfNeeded({\n wasFocused: props.get('focused'),\n wasPopulated: props.get('populated')\n });\n\n super.update(props);\n }\n\n protected override render() {\n const floatingLabel = this.renderLabel(/*isFloating*/ true);\n const restingLabel = this.renderLabel(/*isFloating*/ false);\n const outline = this.renderOutline?.(floatingLabel);\n const classes = {\n 'disabled': this.disabled,\n 'error': this.error && !this.disabled,\n 'focused': this.focused,\n 'with-start': this.hasStart,\n 'with-end': this.hasEnd,\n 'populated': this.populated,\n 'resizable': this.resizable,\n 'required': this.required,\n 'no-label': !this.label,\n };\n\n return html`\n <div class=\"field ${classMap(classes)}\">\n <div class=\"container-overflow\">\n ${outline}\n ${this.renderBackground?.()}\n ${this.renderIndicator?.()}\n <div class=\"container\">\n <div class=\"start\">\n <slot name=\"start\"></slot>\n </div>\n <div class=\"middle\">\n ${restingLabel}\n ${outline ? nothing : floatingLabel}\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n <div class=\"end\">\n <slot name=\"end\"></slot>\n </div>\n </div>\n </div>\n\n <div class=\"supporting-text\">\n <div class=\"supporting-text-start\">\n <slot name=\"supporting-text\"></slot>\n </div>\n <div class=\"supporting-text-end\">\n <slot name=\"supporting-text-end\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n\n protected renderBackground?(): TemplateResult;\n protected renderIndicator?(): TemplateResult;\n protected renderOutline?(floatingLabel: TemplateResult): TemplateResult;\n\n private renderLabel(isFloating: boolean) {\n let visible: boolean;\n if (isFloating) {\n // Floating label is visible when focused/populated or when animating.\n visible = this.focused || this.populated || this.isAnimating;\n } else {\n // Resting label is visible when unfocused. It is never visible while\n // animating.\n visible = !this.focused && !this.populated && !this.isAnimating;\n }\n\n const classes = {\n 'hidden': !visible,\n 'floating': isFloating,\n 'resting': !isFloating,\n };\n\n let labelText = this.label ?? '';\n // Add '*' if a label is present and the field is required\n labelText += this.required && labelText ? '*' : '';\n\n return html`\n <span class=\"label ${classMap(classes)}\"\n aria-hidden=${!visible}\n >${labelText}</span>\n `;\n }\n\n private animateLabelIfNeeded({wasFocused, wasPopulated}: {\n wasFocused?: boolean,\n wasPopulated?: boolean\n }) {\n if (!this.label) {\n return;\n }\n\n wasFocused ??= this.focused;\n wasPopulated ??= this.populated;\n const wasFloating = wasFocused || wasPopulated;\n const shouldBeFloating = this.focused || this.populated;\n if (wasFloating === shouldBeFloating) {\n return;\n }\n\n this.isAnimating = true;\n this.labelAnimation?.cancel();\n\n // Only one label is visible at a time for clearer text rendering.\n // The floating label is visible and used during animation. At the end of\n // the animation, it will either remain visible (if floating) or hide and\n // the resting label will be shown.\n //\n // We don't use forward filling because if the dimensions of the text field\n // change (leading icon removed, density changes, etc), then the animation\n // will be inaccurate.\n //\n // Re-calculating the animation each time will prevent any visual glitches\n // from appearing.\n // TODO(b/241113345): use animation tokens\n this.labelAnimation = this.floatingLabelEl?.animate(\n this.getLabelKeyframes(), {duration: 150, easing: EASING.STANDARD});\n\n this.labelAnimation?.addEventListener('finish', () => {\n // At the end of the animation, update the visible label.\n this.isAnimating = false;\n });\n }\n\n private getLabelKeyframes() {\n const {floatingLabelEl, restingLabelEl} = this;\n if (!floatingLabelEl || !restingLabelEl) {\n return [];\n }\n\n const {x: floatingX, y: floatingY, height: floatingHeight} =\n floatingLabelEl.getBoundingClientRect();\n const {x: restingX, y: restingY, height: restingHeight} =\n restingLabelEl.getBoundingClientRect();\n const floatingScrollWidth = floatingLabelEl.scrollWidth;\n const restingScrollWidth = restingLabelEl.scrollWidth;\n // Scale by width ratio instead of font size since letter-spacing will scale\n // incorrectly. Using the width we can better approximate the adjusted\n // scale and compensate for tracking and overflow.\n // (use scrollWidth instead of width to account for clipped labels)\n const scale = restingScrollWidth / floatingScrollWidth;\n const xDelta = restingX - floatingX;\n // The line-height of the resting and floating label are different. When\n // we move the floating label down to the resting label's position, it won't\n // exactly match because of this. We need to adjust by half of what the\n // final scaled floating label's height will be.\n const yDelta = restingY - floatingY +\n Math.round((restingHeight - floatingHeight * scale) / 2);\n\n // Create the two transforms: floating to resting (using the calculations\n // above), and resting to floating (re-setting the transform to initial\n // values).\n const restTransform =\n `translateX(${xDelta}px) translateY(${yDelta}px) scale(${scale})`;\n const floatTransform = `translateX(0) translateY(0) scale(1)`;\n\n // Constrain the floating labels width to a scaled percentage of the\n // resting label's width. This will prevent long clipped labels from\n // overflowing the container.\n const restingClientWidth = restingLabelEl.clientWidth;\n const isRestingClipped = restingScrollWidth > restingClientWidth;\n const width = isRestingClipped ? `${restingClientWidth / scale}px` : '';\n if (this.focused || this.populated) {\n return [\n {transform: restTransform, width}, {transform: floatTransform, width}\n ];\n }\n\n return [\n {transform: floatTransform, width}, {transform: restTransform, width}\n ];\n }\n\n getSurfacePositionClientRect() {\n return this.containerEl!.getBoundingClientRect();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["field.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,UAAU;IAArC;;QAC6B,aAAQ,GAAG,KAAK,CAAC;QACjB,UAAK,GAAG,KAAK,CAAC;QACd,YAAO,GAAG,KAAK,CAAC;QAEhB,cAAS,GAAG,KAAK,CAAC;QAClB,cAAS,GAAG,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AC1B,OAAO,IAAI,CAAC,WAAY,CAAC,qBAAqB,EAAE,CAAC;IACnD,CAAC;CACF;AAzN4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;oCAAe;AACd;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;sCAAiB;AAC/B;IAAX,QAAQ,EAAE;oCAAgB;AACA;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wCAAmB;AAClB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wCAAmB;AAClB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAkB;AAKjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAkB;AAKjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;qCAAgB;AAEjC;IAAR,KAAK,EAAE;0CAA6B;AAEX;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8CAAqD;AACrD;IAAxB,KAAK,CAAC,gBAAgB,CAAC;6CAAoD;AACvD;IAApB,KAAK,CAAC,YAAY,CAAC;0CAAiD","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {SurfacePositionTarget} from '../../menu/lib/surfacePositionController.js';\n\nimport {EASING} from '../../motion/animation.js';\n\n/**\n * A field component.\n */\nexport class Field extends LitElement implements SurfacePositionTarget {\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean}) error = false;\n @property({type: Boolean}) focused = false;\n @property() label?: string;\n @property({type: Boolean}) populated = false;\n @property({type: Boolean}) resizable = false;\n @property({type: Boolean}) required = false;\n\n /**\n * Whether or not the field has leading content.\n */\n @property({type: Boolean}) hasStart = false;\n\n /**\n * Whether or not the field has trailing content.\n */\n @property({type: Boolean}) hasEnd = false;\n\n @state() private isAnimating = false;\n private labelAnimation?: Animation;\n @query('.label.floating') private readonly floatingLabelEl!: HTMLElement|null;\n @query('.label.resting') private readonly restingLabelEl!: HTMLElement|null;\n @query('.container') private readonly containerEl!: HTMLElement|null;\n\n protected override update(props: PropertyValues<Field>) {\n // Client-side property updates\n\n // When disabling, remove focus styles if focused.\n if (this.disabled && this.focused) {\n props.set('focused', true);\n this.focused = false;\n }\n\n // Animate if focused or populated change.\n this.animateLabelIfNeeded({\n wasFocused: props.get('focused'),\n wasPopulated: props.get('populated')\n });\n\n super.update(props);\n }\n\n protected override render() {\n const floatingLabel = this.renderLabel(/*isFloating*/ true);\n const restingLabel = this.renderLabel(/*isFloating*/ false);\n const outline = this.renderOutline?.(floatingLabel);\n const classes = {\n 'disabled': this.disabled,\n 'error': this.error && !this.disabled,\n 'focused': this.focused,\n 'with-start': this.hasStart,\n 'with-end': this.hasEnd,\n 'populated': this.populated,\n 'resizable': this.resizable,\n 'required': this.required,\n 'no-label': !this.label,\n };\n\n return html`\n <div class=\"field ${classMap(classes)}\">\n <div class=\"container-overflow\">\n ${outline}\n ${this.renderBackground?.()}\n ${this.renderIndicator?.()}\n <div class=\"container\">\n <div class=\"start\">\n <slot name=\"start\"></slot>\n </div>\n <div class=\"middle\">\n ${restingLabel}\n ${outline ? nothing : floatingLabel}\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n <div class=\"end\">\n <slot name=\"end\"></slot>\n </div>\n </div>\n </div>\n\n <div class=\"supporting-text\">\n <div class=\"supporting-text-start\">\n <slot name=\"supporting-text\"></slot>\n </div>\n <div class=\"supporting-text-end\">\n <slot name=\"supporting-text-end\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n\n protected renderBackground?(): TemplateResult;\n protected renderIndicator?(): TemplateResult;\n protected renderOutline?(floatingLabel: TemplateResult): TemplateResult;\n\n private renderLabel(isFloating: boolean) {\n let visible: boolean;\n if (isFloating) {\n // Floating label is visible when focused/populated or when animating.\n visible = this.focused || this.populated || this.isAnimating;\n } else {\n // Resting label is visible when unfocused. It is never visible while\n // animating.\n visible = !this.focused && !this.populated && !this.isAnimating;\n }\n\n const classes = {\n 'hidden': !visible,\n 'floating': isFloating,\n 'resting': !isFloating,\n };\n\n let labelText = this.label ?? '';\n // Add '*' if a label is present and the field is required\n labelText += this.required && labelText ? '*' : '';\n\n return html`\n <span class=\"label ${classMap(classes)}\"\n aria-hidden=${!visible}\n >${labelText}</span>\n `;\n }\n\n private animateLabelIfNeeded({wasFocused, wasPopulated}: {\n wasFocused?: boolean,\n wasPopulated?: boolean\n }) {\n if (!this.label) {\n return;\n }\n\n wasFocused ??= this.focused;\n wasPopulated ??= this.populated;\n const wasFloating = wasFocused || wasPopulated;\n const shouldBeFloating = this.focused || this.populated;\n if (wasFloating === shouldBeFloating) {\n return;\n }\n\n this.isAnimating = true;\n this.labelAnimation?.cancel();\n\n // Only one label is visible at a time for clearer text rendering.\n // The floating label is visible and used during animation. At the end of\n // the animation, it will either remain visible (if floating) or hide and\n // the resting label will be shown.\n //\n // We don't use forward filling because if the dimensions of the text field\n // change (leading icon removed, density changes, etc), then the animation\n // will be inaccurate.\n //\n // Re-calculating the animation each time will prevent any visual glitches\n // from appearing.\n // TODO(b/241113345): use animation tokens\n this.labelAnimation = this.floatingLabelEl?.animate(\n this.getLabelKeyframes(), {duration: 150, easing: EASING.STANDARD});\n\n this.labelAnimation?.addEventListener('finish', () => {\n // At the end of the animation, update the visible label.\n this.isAnimating = false;\n });\n }\n\n private getLabelKeyframes() {\n const {floatingLabelEl, restingLabelEl} = this;\n if (!floatingLabelEl || !restingLabelEl) {\n return [];\n }\n\n const {x: floatingX, y: floatingY, height: floatingHeight} =\n floatingLabelEl.getBoundingClientRect();\n const {x: restingX, y: restingY, height: restingHeight} =\n restingLabelEl.getBoundingClientRect();\n const floatingScrollWidth = floatingLabelEl.scrollWidth;\n const restingScrollWidth = restingLabelEl.scrollWidth;\n // Scale by width ratio instead of font size since letter-spacing will scale\n // incorrectly. Using the width we can better approximate the adjusted\n // scale and compensate for tracking and overflow.\n // (use scrollWidth instead of width to account for clipped labels)\n const scale = restingScrollWidth / floatingScrollWidth;\n const xDelta = restingX - floatingX;\n // The line-height of the resting and floating label are different. When\n // we move the floating label down to the resting label's position, it won't\n // exactly match because of this. We need to adjust by half of what the\n // final scaled floating label's height will be.\n const yDelta = restingY - floatingY +\n Math.round((restingHeight - floatingHeight * scale) / 2);\n\n // Create the two transforms: floating to resting (using the calculations\n // above), and resting to floating (re-setting the transform to initial\n // values).\n const restTransform =\n `translateX(${xDelta}px) translateY(${yDelta}px) scale(${scale})`;\n const floatTransform = `translateX(0) translateY(0) scale(1)`;\n\n // Constrain the floating labels width to a scaled percentage of the\n // resting label's width. This will prevent long clipped labels from\n // overflowing the container.\n const restingClientWidth = restingLabelEl.clientWidth;\n const isRestingClipped = restingScrollWidth > restingClientWidth;\n const width = isRestingClipped ? `${restingClientWidth / scale}px` : '';\n if (this.focused || this.populated) {\n return [\n {transform: restTransform, width}, {transform: floatTransform, width}\n ];\n }\n\n return [\n {transform: floatTransform, width}, {transform: restTransform, width}\n ];\n }\n\n getSurfacePositionClientRect() {\n return this.containerEl!.getBoundingClientRect();\n }\n}\n"]}
|
package/focus/focus-ring.d.ts
CHANGED
package/focus/focus-ring.js
CHANGED
package/focus/focus-ring.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["focus-ring.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAQtD
|
|
1
|
+
{"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["focus-ring.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAQtD;;;GAGG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,SAAS;;AACxB,kBAAM,GAAG,CAAC,MAAM,CAAC,CAAC;AADvB,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CAEvB;SAFY,WAAW","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {FocusRing} from './lib/focus-ring.js';\nimport {styles} from './lib/focus-ring-styles.css.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-focus-ring': MdFocusRing;\n }\n}\n\n/**\n * @final\n * @suppress {visibility}\n */\n@customElement('md-focus-ring')\nexport class MdFocusRing extends FocusRing {\n static override styles = [styles];\n}\n"]}
|
package/focus/lib/focus-ring.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { __decorate
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
7
|
import { LitElement } from 'lit';
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
/**
|
|
@@ -29,7 +29,6 @@ export class FocusRing extends LitElement {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
__decorate([
|
|
32
|
-
property({ type: Boolean, reflect: true })
|
|
33
|
-
__metadata("design:type", Object)
|
|
32
|
+
property({ type: Boolean, reflect: true })
|
|
34
33
|
], FocusRing.prototype, "visible", void 0);
|
|
35
34
|
//# sourceMappingURL=focus-ring.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["focus-ring.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;IAAzC;;QACE;;WAEG;QACuC,YAAO,GAAG,KAAK,CAAC;IAC5D,CAAC;CAAA;
|
|
1
|
+
{"version":3,"file":"focus-ring.js","sourceRoot":"","sources":["focus-ring.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,SAAU,SAAQ,UAAU;IAAzC;;QACE;;WAEG;QACuC,YAAO,GAAG,KAAK,CAAC;IAC5D,CAAC;CAAA;AAD2C;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0CAAiB","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement} from 'lit';\nimport {property} from 'lit/decorators.js';\n\n/**\n * @summary An accessible, themable ring designed to be shown on\n * `:focus-visible`.\n *\n * @description\n * An accessible, themable ring designed to be shown on focus-visible.\n * Focus ring is designed to be controlled by the `strong-focus` module in the\n * same package.\n *\n * In most cases, `visible` should be set to\n * `shouldShowStrongFocus()` on `focus` and `pointerdown` (see `pointerPress()`\n * documentation in the `strong-focus` module), and `false` on `blur`.\n */\nexport class FocusRing extends LitElement {\n /**\n * Makes the focus ring visible.\n */\n @property({type: Boolean, reflect: true}) visible = false;\n}\n"]}
|
package/focus/strong-focus.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2021 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { isServer } from 'lit';
|
|
6
7
|
class FocusGlobal {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.visible = false;
|
|
@@ -45,6 +46,10 @@ export function keydownHandler(e) {
|
|
|
45
46
|
*/
|
|
46
47
|
export function setup(focusGlobal, enableKeydownHandler = false) {
|
|
47
48
|
focusObject = focusGlobal;
|
|
49
|
+
// Server doesn't have addEventListener shimmed
|
|
50
|
+
if (isServer) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
48
53
|
if (enableKeydownHandler) {
|
|
49
54
|
window.addEventListener('keydown', keydownHandler);
|
|
50
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strong-focus.js","sourceRoot":"","sources":["strong-focus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"strong-focus.js","sourceRoot":"","sources":["strong-focus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,KAAK,CAAC;AAO7B,MAAM,WAAW;IAAjB;QACE,YAAO,GAAG,KAAK,CAAC;IAIlB,CAAC;IAHC,UAAU,CAAC,OAAgB;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,IAAI,WAAW,GAAgB,IAAI,WAAW,EAAE,CAAC;AAEjD;;GAEG;AACH,MAAM,wBAAwB,GAC1B,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,CAAgB;IAC7C,IAAI,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;QACvC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAC9B;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,WAAwB,EAAE,oBAAoB,GAAG,KAAK;IAC1E,WAAW,GAAG,WAAW,CAAC;IAE1B,+CAA+C;IAC/C,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IAED,IAAI,oBAAoB,EAAE;QACxB,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;KACpD;SAAM;QACL,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;KACvD;AACH,CAAC;AAED;;;;GAIG;AACH,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,YAAY,IAAI,WAAW,CAAC,OAAO,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,YAAY,GAAG,KAAK,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC1B,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {isServer} from 'lit';\n\ninterface StrongFocus {\n visible: boolean;\n setVisible(visible: boolean): void;\n}\n\nclass FocusGlobal implements StrongFocus {\n visible = false;\n setVisible(visible: boolean) {\n this.visible = visible;\n }\n}\n\n/**\n * This object can be overwritten by the `setup()` function to use a different\n * focus coordination object.\n */\nlet focusObject: StrongFocus = new FocusGlobal();\n\n/**\n * Set of keyboard event codes that correspond to keyboard navigation\n */\nconst KEYBOARD_NAVIGATION_KEYS =\n new Set(['Tab', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']);\n\n/**\n * Components should call this when a user interacts with a component with a\n * keyboard event in the very special case that the component needs to call\n * focus inside of a keydown handler. Otherwise, this module will handle\n * keyboard events on window.\n *\n * By default, this will enable the strong focus to be shown.\n *\n * @param e The native keyboard event.\n */\nexport function keydownHandler(e: KeyboardEvent) {\n if (KEYBOARD_NAVIGATION_KEYS.has(e.key)) {\n focusObject.setVisible(true);\n }\n}\n\n/**\n * Set up integration with alternate global focus tracking object\n *\n * @param focusGlobal A global focus object to coordinate between multiple\n * systems\n * @param enableKeydownHandler Set to true to let StrongFocusService listen for\n * keyboard navigation\n */\nexport function setup(focusGlobal: StrongFocus, enableKeydownHandler = false) {\n focusObject = focusGlobal;\n\n // Server doesn't have addEventListener shimmed\n if (isServer) {\n return;\n }\n\n if (enableKeydownHandler) {\n window.addEventListener('keydown', keydownHandler);\n } else {\n window.removeEventListener('keydown', keydownHandler);\n }\n}\n\n/**\n * Setting for always showing strong focus\n *\n * Defaults to false, controlled by `setForceStrongFocus`\n */\nlet alwaysStrong = false;\n\n/**\n * Returns `true` if the component should show strong focus.\n *\n * By default, strong focus is shown only on keyboard navigation, and not on\n * pointer interaction.\n */\nexport function shouldShowStrongFocus() {\n return alwaysStrong || focusObject.visible;\n}\n\n/**\n * Control if strong focus should always be shown on component focus\n *\n * Defaults to `false`\n *\n * @param force Forces strong focus on the page. Disables strong focus if false.\n */\nexport function setForceStrongFocus(force: boolean) {\n alwaysStrong = force;\n}\n\n/**\n * If `true`, strong focus is always shown\n */\nexport function isStrongFocusForced() {\n return alwaysStrong;\n}\n\n/**\n * Components should call this when a user interacts with a component with a\n * pointing device.\n *\n * By default, this will prevent the strong focus from being shown.\n */\nexport function pointerPress() {\n focusObject.setVisible(false);\n}\n\nsetup(focusObject, true);"]}
|
package/icon/icon.d.ts
CHANGED
package/icon/icon.js
CHANGED
package/icon/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sourceRoot":"","sources":["icon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAQhD
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["icon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAQhD;;;GAGG;AAEI,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,IAAI;;AACd,aAAM,GAAG,CAAC,MAAM,CAAC,CAAC;AADvB,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAElB;SAFY,MAAM","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {Icon} from './lib/icon.js';\nimport {styles} from './lib/icon-styles.css.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-icon': MdIcon;\n }\n}\n\n/**\n * @final\n * @suppress {visibility}\n */\n@customElement('md-icon')\nexport class MdIcon extends Icon {\n static override styles = [styles];\n}\n"]}
|
package/icon/lib/_icon.scss
CHANGED
|
@@ -34,6 +34,8 @@ $_custom-property-prefix: 'icon';
|
|
|
34
34
|
font-size: var(--_size);
|
|
35
35
|
font-variation-settings: var(--_font-variation-settings);
|
|
36
36
|
line-height: 1;
|
|
37
|
+
// Avoid displaying overflowing text if font ligatures have not loaded.
|
|
38
|
+
overflow: hidden;
|
|
37
39
|
letter-spacing: normal;
|
|
38
40
|
text-transform: none;
|
|
39
41
|
white-space: nowrap;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
-
export const styles = css `:host{--_color: var(--md-icon-color, inherit);--_font: var(--md-icon-font, "Material Symbols Outlined");--_font-variation-settings: var(--md-icon-font-variation-settings, inherit);--_size: var(--md-icon-size, 24px);--_weight: var(--md-icon-weight, 400);display:inline-flex;color:var(--_color);font-family:var(--_font);font-weight:var(--_weight);font-style:normal;font-size:var(--_size);font-variation-settings:var(--_font-variation-settings);line-height:1;letter-spacing:normal;text-transform:none;white-space:nowrap;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}span ::slotted(svg){fill:currentColor}span ::slotted(*){height:var(--_size);width:var(--_size)}/*# sourceMappingURL=icon-styles.css.map */
|
|
7
|
+
export const styles = css `:host{--_color: var(--md-icon-color, inherit);--_font: var(--md-icon-font, "Material Symbols Outlined");--_font-variation-settings: var(--md-icon-font-variation-settings, inherit);--_size: var(--md-icon-size, 24px);--_weight: var(--md-icon-weight, 400);display:inline-flex;color:var(--_color);font-family:var(--_font);font-weight:var(--_weight);font-style:normal;font-size:var(--_size);font-variation-settings:var(--_font-variation-settings);line-height:1;overflow:hidden;letter-spacing:normal;text-transform:none;white-space:nowrap;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}span ::slotted(svg){fill:currentColor}span ::slotted(*){height:var(--_size);width:var(--_size)}/*# sourceMappingURL=icon-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=icon-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-styles.css.js","sourceRoot":"","sources":["icon-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_color: var(--md-icon-color, inherit);--_font: var(--md-icon-font, \"Material Symbols Outlined\");--_font-variation-settings: var(--md-icon-font-variation-settings, inherit);--_size: var(--md-icon-size, 24px);--_weight: var(--md-icon-weight, 400);display:inline-flex;color:var(--_color);font-family:var(--_font);font-weight:var(--_weight);font-style:normal;font-size:var(--_size);font-variation-settings:var(--_font-variation-settings);line-height:1;letter-spacing:normal;text-transform:none;white-space:nowrap;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}span ::slotted(svg){fill:currentColor}span ::slotted(*){height:var(--_size);width:var(--_size)}/*# sourceMappingURL=icon-styles.css.map */\n`;\n "]}
|
|
1
|
+
{"version":3,"file":"icon-styles.css.js","sourceRoot":"","sources":["icon-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_color: var(--md-icon-color, inherit);--_font: var(--md-icon-font, \"Material Symbols Outlined\");--_font-variation-settings: var(--md-icon-font-variation-settings, inherit);--_size: var(--md-icon-size, 24px);--_weight: var(--md-icon-weight, 400);display:inline-flex;color:var(--_color);font-family:var(--_font);font-weight:var(--_weight);font-style:normal;font-size:var(--_size);font-variation-settings:var(--_font-variation-settings);line-height:1;overflow:hidden;letter-spacing:normal;text-transform:none;white-space:nowrap;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}span ::slotted(svg){fill:currentColor}span ::slotted(*){height:var(--_size);width:var(--_size)}/*# sourceMappingURL=icon-styles.css.map */\n`;\n "]}
|
package/icon/lib/icon.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { LitElement
|
|
7
|
-
/**
|
|
6
|
+
import { LitElement } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* TODO(b/265336902): add docs
|
|
9
|
+
*/
|
|
8
10
|
export declare class Icon extends LitElement {
|
|
9
|
-
|
|
10
|
-
protected render(): TemplateResult;
|
|
11
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
11
12
|
}
|
package/icon/lib/icon.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { html, LitElement } from 'lit';
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* TODO(b/265336902): add docs
|
|
9
|
+
*/
|
|
8
10
|
export class Icon extends LitElement {
|
|
9
|
-
/** @soyTemplate */
|
|
10
11
|
render() {
|
|
11
12
|
return html `<span><slot></slot></span>`;
|
|
12
13
|
}
|
package/icon/lib/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sourceRoot":"","sources":["icon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["icon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,IAAK,SAAQ,UAAU;IACf,MAAM;QACvB,OAAO,IAAI,CAAA,4BAA4B,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement} from 'lit';\n\n/**\n * TODO(b/265336902): add docs\n */\nexport class Icon extends LitElement {\n protected override render() {\n return html`<span><slot></slot></span>`;\n }\n}\n"]}
|
|
@@ -9,7 +9,6 @@ import '../../ripple/ripple.js';
|
|
|
9
9
|
import { LitElement, TemplateResult } from 'lit';
|
|
10
10
|
import { ClassInfo } from 'lit/directives/class-map.js';
|
|
11
11
|
import { MdRipple } from '../../ripple/ripple.js';
|
|
12
|
-
import { ARIAExpanded, ARIAHasPopup } from '../../types/aria.js';
|
|
13
12
|
export declare class IconButton extends LitElement {
|
|
14
13
|
/**
|
|
15
14
|
* Disables the icon button and makes it non-interactive.
|
|
@@ -19,9 +18,6 @@ export declare class IconButton extends LitElement {
|
|
|
19
18
|
* Flips the icon if it is in an RTL context at startup.
|
|
20
19
|
*/
|
|
21
20
|
flipIconInRtl: boolean;
|
|
22
|
-
ariaLabel: string;
|
|
23
|
-
ariaHasPopup: ARIAHasPopup;
|
|
24
|
-
ariaExpanded: ARIAExpanded;
|
|
25
21
|
/**
|
|
26
22
|
* Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.
|
|
27
23
|
*/
|