@material/web 2.4.2-nightly.95dd57c.0 → 2.4.2-nightly.a3379a3.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/button/internal/_touch-target.scss +1 -1
- package/button/internal/button.d.ts +0 -4
- package/button/internal/button.js.map +1 -1
- package/button/internal/shared-styles.css +1 -1
- package/button/internal/shared-styles.css.map +1 -1
- package/button/internal/shared-styles.cssresult.js +1 -1
- package/button/internal/shared-styles.cssresult.js.map +1 -1
- package/checkbox/internal/checkbox.d.ts +0 -2
- package/checkbox/internal/checkbox.js.map +1 -1
- package/icon/internal/icon.d.ts +1 -1
- package/icon/internal/icon.js +1 -1
- package/icon/internal/icon.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +0 -4
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/labs/behaviors/form-associated.d.ts +0 -22
- package/labs/behaviors/form-associated.js +0 -11
- package/labs/behaviors/form-associated.js.map +1 -1
- package/labs/gb/components/button/button.d.ts +1 -1
- package/labs/gb/components/button/button.js +5 -5
- package/labs/gb/components/button/button.js.map +1 -1
- package/labs/gb/components/button/md-button.d.ts +1 -1
- package/labs/gb/components/button/md-button.js +9 -9
- package/labs/gb/components/button/md-button.js.map +1 -1
- package/labs/gb/components/card/card.d.ts +1 -1
- package/labs/gb/components/card/card.js +3 -3
- package/labs/gb/components/card/card.js.map +1 -1
- package/labs/gb/components/card/md-card.js +6 -6
- package/labs/gb/components/card/md-card.js.map +1 -1
- package/labs/gb/components/checkbox/checkbox.d.ts +1 -1
- package/labs/gb/components/checkbox/checkbox.js +4 -4
- package/labs/gb/components/checkbox/checkbox.js.map +1 -1
- package/labs/gb/components/checkbox/md-checkbox.d.ts +4 -4
- package/labs/gb/components/checkbox/md-checkbox.js +10 -10
- package/labs/gb/components/checkbox/md-checkbox.js.map +1 -1
- package/labs/gb/components/divider/divider.d.ts +1 -1
- package/labs/gb/components/divider/divider.js +1 -1
- package/labs/gb/components/divider/divider.js.map +1 -1
- package/labs/gb/components/fab/fab.d.ts +1 -1
- package/labs/gb/components/fab/fab.js +4 -4
- package/labs/gb/components/fab/fab.js.map +1 -1
- package/labs/gb/components/fab/md-fab.js +4 -4
- package/labs/gb/components/fab/md-fab.js.map +1 -1
- package/labs/gb/components/focus/focus-ring.js +1 -1
- package/labs/gb/components/focus/focus-ring.js.map +1 -1
- package/labs/gb/components/iconbutton/icon-button.d.ts +1 -1
- package/labs/gb/components/iconbutton/icon-button.js +5 -5
- package/labs/gb/components/iconbutton/icon-button.js.map +1 -1
- package/labs/gb/components/iconbutton/md-icon-button.d.ts +1 -1
- package/labs/gb/components/iconbutton/md-icon-button.js +7 -7
- package/labs/gb/components/iconbutton/md-icon-button.js.map +1 -1
- package/labs/gb/components/list/list.d.ts +2 -2
- package/labs/gb/components/list/list.js +4 -4
- package/labs/gb/components/list/list.js.map +1 -1
- package/labs/gb/components/list/md-list-item.d.ts +1 -1
- package/labs/gb/components/list/md-list-item.js +7 -7
- package/labs/gb/components/list/md-list-item.js.map +1 -1
- package/labs/gb/components/list/md-list.d.ts +1 -1
- package/labs/gb/components/list/md-list.js +1 -1
- package/labs/gb/components/list/md-list.js.map +1 -1
- package/labs/gb/components/menu/md-menu-group.d.ts +1 -1
- package/labs/gb/components/menu/md-menu-group.js +1 -1
- package/labs/gb/components/menu/md-menu-group.js.map +1 -1
- package/labs/gb/components/menu/md-menu-item.d.ts +1 -1
- package/labs/gb/components/menu/md-menu-item.js +8 -8
- package/labs/gb/components/menu/md-menu-item.js.map +1 -1
- package/labs/gb/components/menu/md-menu.d.ts +1 -1
- package/labs/gb/components/menu/md-menu.js +2 -2
- package/labs/gb/components/menu/md-menu.js.map +1 -1
- package/labs/gb/components/menu/menu.d.ts +2 -2
- package/labs/gb/components/menu/menu.js +4 -4
- package/labs/gb/components/menu/menu.js.map +1 -1
- package/labs/gb/components/radio/md-radio.d.ts +4 -4
- package/labs/gb/components/radio/md-radio.js +11 -11
- package/labs/gb/components/radio/md-radio.js.map +1 -1
- package/labs/gb/components/radio/radio.d.ts +1 -1
- package/labs/gb/components/radio/radio.js +4 -4
- package/labs/gb/components/radio/radio.js.map +1 -1
- package/labs/gb/components/ripple/ripple.js +5 -2
- package/labs/gb/components/ripple/ripple.js.map +1 -1
- package/labs/gb/components/splitbutton/_split-button-tokens.scss +135 -0
- package/labs/gb/components/splitbutton/md-split-button.d.ts +26 -0
- package/labs/gb/components/splitbutton/md-split-button.js +119 -0
- package/labs/gb/components/splitbutton/md-split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.css +4 -0
- package/labs/gb/components/splitbutton/split-button.css.map +1 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.d.ts +3 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.js +14 -0
- package/labs/gb/components/splitbutton/split-button.cssresult.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.d.ts +47 -0
- package/labs/gb/components/splitbutton/split-button.js +46 -0
- package/labs/gb/components/splitbutton/split-button.js.map +1 -0
- package/labs/gb/components/splitbutton/split-button.scss +164 -0
- package/labs/gb/components/switch/md-switch.d.ts +4 -4
- package/labs/gb/components/switch/md-switch.js +12 -12
- package/labs/gb/components/switch/md-switch.js.map +1 -1
- package/labs/gb/components/switch/switch.d.ts +1 -1
- package/labs/gb/components/switch/switch.js +5 -5
- package/labs/gb/components/switch/switch.js.map +1 -1
- package/labs/gb/styles/icon/md-icon.css +1 -1
- package/labs/gb/styles/icon/md-icon.css.map +1 -1
- package/labs/gb/styles/icon/md-icon.cssresult.js +1 -1
- package/labs/gb/styles/icon/md-icon.cssresult.js.map +1 -1
- package/labs/gb/styles/icon/md-icon.d.ts +20 -0
- package/labs/gb/styles/icon/md-icon.js +24 -0
- package/labs/gb/styles/icon/md-icon.js.map +1 -0
- package/labs/gb/styles/icon/md-icon.scss +2 -1
- package/labs/gb/styles/m3.css +5 -2
- package/labs/gb/styles/m3.css.map +1 -1
- package/labs/gb/styles/m3.cssresult.js +5 -2
- package/labs/gb/styles/m3.cssresult.js.map +1 -1
- package/labs/gb/styles/m3.scss +1 -0
- package/labs/gb/styles/space/md-space-tokens.css +4 -0
- package/labs/gb/styles/space/md-space-tokens.css.map +1 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.d.ts +3 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.js +14 -0
- package/labs/gb/styles/space/md-space-tokens.cssresult.js.map +1 -0
- package/labs/gb/styles/space/md-space-tokens.scss +28 -0
- package/labs/gb/styles/tailwind.css +4 -0
- package/labs/gb/styles/tailwind.css.map +1 -0
- package/labs/gb/styles/tailwind.cssresult.d.ts +3 -0
- package/labs/gb/styles/tailwind.cssresult.js +14 -0
- package/labs/gb/styles/tailwind.cssresult.js.map +1 -0
- package/labs/gb/styles/tailwind.scss +349 -0
- package/labs/gb/styles/typography/internal/_typography-tokens.scss +85 -16
- package/labs/gb/styles/typography/md-typography-tokens.css +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.css.map +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.cssresult.js +1 -1
- package/labs/gb/styles/typography/md-typography-tokens.cssresult.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +4 -1
- package/list/internal/listitem/list-item.js +4 -1
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/submenu/sub-menu.d.ts +5 -1
- package/menu/internal/submenu/sub-menu.js +5 -1
- package/menu/internal/submenu/sub-menu.js.map +1 -1
- package/package.json +5 -2
- package/radio/internal/radio.d.ts +0 -2
- package/radio/internal/radio.js.map +1 -1
- package/select/internal/select.d.ts +0 -2
- package/select/internal/select.js.map +1 -1
- package/slider/internal/slider.d.ts +0 -2
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/_switch.scss +1 -0
- package/switch/internal/switch-styles.css +1 -1
- package/switch/internal/switch-styles.css.map +1 -1
- package/switch/internal/switch-styles.cssresult.js +1 -1
- package/switch/internal/switch-styles.cssresult.js.map +1 -1
- package/switch/internal/switch.d.ts +0 -2
- package/switch/internal/switch.js.map +1 -1
|
@@ -4,17 +4,24 @@
|
|
|
4
4
|
//
|
|
5
5
|
|
|
6
6
|
// go/keep-sorted start by_regex='(.+) prefix_order=sass:
|
|
7
|
+
@use 'sass:list';
|
|
7
8
|
@use 'sass:map';
|
|
8
9
|
@use 'sass:meta';
|
|
10
|
+
@use 'sass:string';
|
|
9
11
|
@use '../../../../../sass/ext/map_ext';
|
|
10
12
|
@use '../../../../../tokens/versions/latest/sass/md-ref-typeface';
|
|
11
13
|
@use '../../../../../tokens/versions/latest/sass/md-sys-typescale';
|
|
14
|
+
@use '../../../../../tokens/versions/latest/sass/md-sys-typescale-emphasized';
|
|
15
|
+
@use '../../../../../tokens/versions/latest/sass/md-sys-typescale-emphasized-meta';
|
|
12
16
|
@use '../../../../../tokens/versions/latest/sass/md-sys-typescale-meta';
|
|
13
17
|
// go/keep-sorted end
|
|
14
18
|
|
|
15
19
|
@mixin emit-custom-properties(
|
|
16
20
|
$typescale-vars: meta.module-variables(md-sys-typescale),
|
|
17
21
|
$typescale-meta: meta.module-variables(md-sys-typescale-meta),
|
|
22
|
+
$typescale-emphasized-vars: meta.module-variables(md-sys-typescale-emphasized),
|
|
23
|
+
$typescale-emphasized-meta:
|
|
24
|
+
meta.module-variables(md-sys-typescale-emphasized-meta),
|
|
18
25
|
$typeface-vars:
|
|
19
26
|
map.merge(
|
|
20
27
|
meta.module-variables(md-ref-typeface),
|
|
@@ -55,26 +62,88 @@
|
|
|
55
62
|
@each $scale in $scales {
|
|
56
63
|
@each $long-size, $short-size in $sizes {
|
|
57
64
|
$typescale: '#{$scale}-#{$long-size}';
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
$
|
|
63
|
-
|
|
64
|
-
$typescale-vars,
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
$font: _font($typescale, $typescale-vars, $typescale-meta);
|
|
67
|
+
$tracking: map_ext.get-strict($typescale-vars, '#{$typescale}-tracking');
|
|
68
|
+
$axes: _axes($typescale, $typescale-vars);
|
|
69
|
+
$emphasized-font: _font(
|
|
70
|
+
$typescale,
|
|
71
|
+
$typescale-emphasized-vars,
|
|
72
|
+
$typescale-emphasized-meta
|
|
66
73
|
);
|
|
67
|
-
$
|
|
68
|
-
$typescale
|
|
69
|
-
|
|
74
|
+
$emphasized-axes: _axes-emphasized(
|
|
75
|
+
$typescale,
|
|
76
|
+
$typescale-emphasized-vars
|
|
70
77
|
);
|
|
71
|
-
$tracking: map_ext.get-strict($typescale-vars, '#{$typescale}-tracking');
|
|
72
78
|
|
|
73
|
-
--md-sys-typescale-#{$scale}-#{$short-size}: #{$
|
|
74
|
-
#{$size} /
|
|
75
|
-
#{$line-height}
|
|
76
|
-
#{$font};
|
|
79
|
+
--md-sys-typescale-#{$scale}-#{$short-size}: #{$font};
|
|
77
80
|
--md-sys-typescale-#{$scale}-#{$short-size}-tracking: #{$tracking};
|
|
81
|
+
--md-sys-typescale-#{$scale}-#{$short-size}-axes: #{$axes};
|
|
82
|
+
--md-sys-typescale-emphasized-#{$scale}-#{$short-size}: #{$emphasized-font};
|
|
83
|
+
--md-sys-typescale-emphasized-#{$scale}-#{$short-size}-axes: #{$emphasized-axes};
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
86
|
}
|
|
87
|
+
|
|
88
|
+
/// Returns the `font` shorthand for a typescale from the provided token and
|
|
89
|
+
/// metadata variable maps.
|
|
90
|
+
@function _font($typescale, $vars, $meta) {
|
|
91
|
+
$weight: map_ext.get-strict($meta, '#{$typescale}-weight--resolved');
|
|
92
|
+
$size: map_ext.get-strict($vars, '#{$typescale}-size');
|
|
93
|
+
$line-height: map_ext.get-strict($vars, '#{$typescale}-line-height');
|
|
94
|
+
$family: map_ext.get-strict($meta, '#{$typescale}-font--resolved');
|
|
95
|
+
@return #{$weight} #{$size} / #{$line-height} #{$family};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// Returns the `font-variation-settings` value for a typescale from the
|
|
99
|
+
/// provided token variable map. Returns `normal` if no axes are changed from
|
|
100
|
+
/// their default values.
|
|
101
|
+
@function _axes($typescale, $vars) {
|
|
102
|
+
$axes: ();
|
|
103
|
+
$axes: _append-axis($axes, map_ext.get-strict($vars, '#{$typescale}-rond'));
|
|
104
|
+
$axes: _append-axis($axes, map_ext.get-strict($vars, '#{$typescale}-grad'));
|
|
105
|
+
@if list.length($axes) == 0 {
|
|
106
|
+
@return normal;
|
|
107
|
+
}
|
|
108
|
+
@return $axes;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// TODO: Remove this function once emphasized tokens are fixed to use `'ROND' 100`
|
|
112
|
+
@function _axes-emphasized($typescale, $vars) {
|
|
113
|
+
$axes: ();
|
|
114
|
+
$axes: _append-axis($axes, ('ROND' 100));
|
|
115
|
+
$axes: _append-axis($axes, map_ext.get-strict($vars, '#{$typescale}-grad'));
|
|
116
|
+
@return $axes;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// Appends a font axis to a list if it is not the default value for the axis.
|
|
120
|
+
@function _append-axis($axes, $axis) {
|
|
121
|
+
// Not all axes from Carbon are supported in gBreeze.
|
|
122
|
+
// - 'opsz': use `font-size`
|
|
123
|
+
// - 'slnt': use `font-style`
|
|
124
|
+
// - 'wdth': use `font-stretch`/`font-width`
|
|
125
|
+
// - 'wght': use `font-weight`
|
|
126
|
+
$default-axes: (
|
|
127
|
+
'ROND': 0,
|
|
128
|
+
'GRAD': 0,
|
|
129
|
+
// These axes are unused in Material, but included for Carbon completeness.
|
|
130
|
+
'CRSV': 0,
|
|
131
|
+
'FILL': 0,
|
|
132
|
+
'HEXP': 0,
|
|
133
|
+
);
|
|
134
|
+
$axis-tag: list.nth($axis, 1);
|
|
135
|
+
$axis-value: list.nth($axis, 2);
|
|
136
|
+
@if not map.has-key($default-axes, $axis-tag) {
|
|
137
|
+
// Do not append unsupported axes.
|
|
138
|
+
@return $axes;
|
|
139
|
+
}
|
|
140
|
+
@if map.get($default-axes, $axis-tag) == $axis-value {
|
|
141
|
+
// Do not append axes with default values.
|
|
142
|
+
@return $axes;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Manually add quotes since Sass removes them for custom property values,
|
|
146
|
+
// even with string.quote().
|
|
147
|
+
$axis: '"#{$axis-tag}" #{$axis-value}';
|
|
148
|
+
@return list.append($axes, $axis, $separator: comma);
|
|
149
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2026 Google LLC
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/@layer md.sys.typescale{:root{--md-ref-typeface-brand: var(--md-ref-typeface-plain);--md-ref-typeface-plain: Roboto Flex, Roboto, Noto Sans, system-ui, sans-serif;--md-ref-typeface-weight-regular: 400;--md-ref-typeface-weight-medium: 500;--md-ref-typeface-weight-bold: 700;--md-sys-typescale-label-sm: var(--md-ref-typeface-weight-medium) 0.6875rem
|
|
4
|
+
*/@layer md.sys.typescale{:root{--md-ref-typeface-brand: var(--md-ref-typeface-plain);--md-ref-typeface-plain: Roboto Flex, Roboto, Noto Sans, system-ui, sans-serif;--md-ref-typeface-weight-regular: 400;--md-ref-typeface-weight-medium: 500;--md-ref-typeface-weight-bold: 700;--md-sys-typescale-label-sm: var(--md-ref-typeface-weight-medium) 0.6875rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-label-sm-tracking: 0.03125rem;--md-sys-typescale-label-sm-axes: normal;--md-sys-typescale-emphasized-label-sm: var(--md-ref-typeface-weight-bold) 0.6875rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-sm-axes: "ROND" 100;--md-sys-typescale-label-md: var(--md-ref-typeface-weight-medium) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-label-md-tracking: 0.03125rem;--md-sys-typescale-label-md-axes: normal;--md-sys-typescale-emphasized-label-md: var(--md-ref-typeface-weight-bold) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-md-axes: "ROND" 100;--md-sys-typescale-label-lg: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-label-lg-tracking: 0.00625rem;--md-sys-typescale-label-lg-axes: normal;--md-sys-typescale-emphasized-label-lg: var(--md-ref-typeface-weight-bold) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-lg-axes: "ROND" 100;--md-sys-typescale-body-sm: var(--md-ref-typeface-weight-regular) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-body-sm-tracking: 0.025rem;--md-sys-typescale-body-sm-axes: normal;--md-sys-typescale-emphasized-body-sm: var(--md-ref-typeface-weight-medium) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-sm-axes: "ROND" 100;--md-sys-typescale-body-md: var(--md-ref-typeface-weight-regular) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-body-md-tracking: 0.015625rem;--md-sys-typescale-body-md-axes: normal;--md-sys-typescale-emphasized-body-md: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-md-axes: "ROND" 100;--md-sys-typescale-body-lg: var(--md-ref-typeface-weight-regular) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-body-lg-tracking: 0.03125rem;--md-sys-typescale-body-lg-axes: normal;--md-sys-typescale-emphasized-body-lg: var(--md-ref-typeface-weight-medium) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-lg-axes: "ROND" 100;--md-sys-typescale-title-sm: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-title-sm-tracking: 0.00625rem;--md-sys-typescale-title-sm-axes: normal;--md-sys-typescale-emphasized-title-sm: var(--md-ref-typeface-weight-bold) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-title-sm-axes: "ROND" 100;--md-sys-typescale-title-md: var(--md-ref-typeface-weight-medium) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-title-md-tracking: 0.009375rem;--md-sys-typescale-title-md-axes: normal;--md-sys-typescale-emphasized-title-md: var(--md-ref-typeface-weight-bold) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-title-md-axes: "ROND" 100;--md-sys-typescale-title-lg: var(--md-ref-typeface-weight-regular) 1.375rem/1.75rem var(--md-ref-typeface-brand);--md-sys-typescale-title-lg-tracking: 0rem;--md-sys-typescale-title-lg-axes: normal;--md-sys-typescale-emphasized-title-lg: var(--md-ref-typeface-weight-medium) 1.375rem/1.75rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-title-lg-axes: "ROND" 100;--md-sys-typescale-headline-sm: var(--md-ref-typeface-weight-regular) 1.5rem/2rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-sm-tracking: 0rem;--md-sys-typescale-headline-sm-axes: normal;--md-sys-typescale-emphasized-headline-sm: var(--md-ref-typeface-weight-medium) 1.5rem/2rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-sm-axes: "ROND" 100;--md-sys-typescale-headline-md: var(--md-ref-typeface-weight-regular) 1.75rem/2.25rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-md-tracking: 0rem;--md-sys-typescale-headline-md-axes: normal;--md-sys-typescale-emphasized-headline-md: var(--md-ref-typeface-weight-medium) 1.75rem/2.25rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-md-axes: "ROND" 100;--md-sys-typescale-headline-lg: var(--md-ref-typeface-weight-regular) 2rem/2.5rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-lg-tracking: 0rem;--md-sys-typescale-headline-lg-axes: normal;--md-sys-typescale-emphasized-headline-lg: var(--md-ref-typeface-weight-medium) 2rem/2.5rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-lg-axes: "ROND" 100;--md-sys-typescale-display-sm: var(--md-ref-typeface-weight-regular) 2.25rem/2.75rem var(--md-ref-typeface-brand);--md-sys-typescale-display-sm-tracking: 0rem;--md-sys-typescale-display-sm-axes: normal;--md-sys-typescale-emphasized-display-sm: var(--md-ref-typeface-weight-medium) 2.25rem/2.75rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-sm-axes: "ROND" 100;--md-sys-typescale-display-md: var(--md-ref-typeface-weight-regular) 2.8125rem/3.25rem var(--md-ref-typeface-brand);--md-sys-typescale-display-md-tracking: 0rem;--md-sys-typescale-display-md-axes: normal;--md-sys-typescale-emphasized-display-md: var(--md-ref-typeface-weight-medium) 2.8125rem/3.25rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-md-axes: "ROND" 100;--md-sys-typescale-display-lg: var(--md-ref-typeface-weight-regular) 3.5625rem/4rem var(--md-ref-typeface-brand);--md-sys-typescale-display-lg-tracking: -0.015625rem;--md-sys-typescale-display-lg-axes: normal;--md-sys-typescale-emphasized-display-lg: var(--md-ref-typeface-weight-medium) 3.5625rem/4rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-lg-axes: "ROND" 100}}/*# sourceMappingURL=md-typography-tokens.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["md-typography-tokens.scss","internal/_typography-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,wBACE,
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["md-typography-tokens.scss","internal/_typography-tokens.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA,GASA,wBACE,MC6BA,sDACA,+EACA,sCAIA,qCAIA,mCA6BI,8GACA,iDACA,yCACA,uHACA,wDAJA,4GACA,iDACA,yCACA,qHACA,wDAJA,gHACA,iDACA,yCACA,yHACA,wDAJA,4GACA,8CACA,wCACA,sHACA,uDAJA,gHACA,iDACA,wCACA,0HACA,uDAJA,2GACA,gDACA,wCACA,qHACA,uDAJA,gHACA,iDACA,yCACA,yHACA,wDAJA,2GACA,kDACA,yCACA,oHACA,wDAJA,iHACA,2CACA,yCACA,2HACA,wDAJA,+GACA,8CACA,4CACA,yHACA,2DAJA,mHACA,8CACA,4CACA,6HACA,2DAJA,+GACA,8CACA,4CACA,yHACA,2DAJA,kHACA,6CACA,2CACA,4HACA,0DAJA,oHACA,6CACA,2CACA,8HACA,0DAJA,iHACA,qDACA,2CACA,2HACA","file":"md-typography-tokens.css"}
|
|
@@ -8,7 +8,7 @@ import { css } from 'lit';
|
|
|
8
8
|
export const styles = css `/*!
|
|
9
9
|
* Copyright 2026 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: Apache-2.0
|
|
11
|
-
*/@layer md.sys.typescale{:root{--md-ref-typeface-brand: var(--md-ref-typeface-plain);--md-ref-typeface-plain: Roboto Flex, Roboto, Noto Sans, system-ui, sans-serif;--md-ref-typeface-weight-regular: 400;--md-ref-typeface-weight-medium: 500;--md-ref-typeface-weight-bold: 700;--md-sys-typescale-label-sm: var(--md-ref-typeface-weight-medium) 0.6875rem
|
|
11
|
+
*/@layer md.sys.typescale{:root{--md-ref-typeface-brand: var(--md-ref-typeface-plain);--md-ref-typeface-plain: Roboto Flex, Roboto, Noto Sans, system-ui, sans-serif;--md-ref-typeface-weight-regular: 400;--md-ref-typeface-weight-medium: 500;--md-ref-typeface-weight-bold: 700;--md-sys-typescale-label-sm: var(--md-ref-typeface-weight-medium) 0.6875rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-label-sm-tracking: 0.03125rem;--md-sys-typescale-label-sm-axes: normal;--md-sys-typescale-emphasized-label-sm: var(--md-ref-typeface-weight-bold) 0.6875rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-sm-axes: "ROND" 100;--md-sys-typescale-label-md: var(--md-ref-typeface-weight-medium) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-label-md-tracking: 0.03125rem;--md-sys-typescale-label-md-axes: normal;--md-sys-typescale-emphasized-label-md: var(--md-ref-typeface-weight-bold) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-md-axes: "ROND" 100;--md-sys-typescale-label-lg: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-label-lg-tracking: 0.00625rem;--md-sys-typescale-label-lg-axes: normal;--md-sys-typescale-emphasized-label-lg: var(--md-ref-typeface-weight-bold) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-lg-axes: "ROND" 100;--md-sys-typescale-body-sm: var(--md-ref-typeface-weight-regular) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-body-sm-tracking: 0.025rem;--md-sys-typescale-body-sm-axes: normal;--md-sys-typescale-emphasized-body-sm: var(--md-ref-typeface-weight-medium) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-sm-axes: "ROND" 100;--md-sys-typescale-body-md: var(--md-ref-typeface-weight-regular) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-body-md-tracking: 0.015625rem;--md-sys-typescale-body-md-axes: normal;--md-sys-typescale-emphasized-body-md: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-md-axes: "ROND" 100;--md-sys-typescale-body-lg: var(--md-ref-typeface-weight-regular) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-body-lg-tracking: 0.03125rem;--md-sys-typescale-body-lg-axes: normal;--md-sys-typescale-emphasized-body-lg: var(--md-ref-typeface-weight-medium) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-lg-axes: "ROND" 100;--md-sys-typescale-title-sm: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-title-sm-tracking: 0.00625rem;--md-sys-typescale-title-sm-axes: normal;--md-sys-typescale-emphasized-title-sm: var(--md-ref-typeface-weight-bold) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-title-sm-axes: "ROND" 100;--md-sys-typescale-title-md: var(--md-ref-typeface-weight-medium) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-title-md-tracking: 0.009375rem;--md-sys-typescale-title-md-axes: normal;--md-sys-typescale-emphasized-title-md: var(--md-ref-typeface-weight-bold) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-title-md-axes: "ROND" 100;--md-sys-typescale-title-lg: var(--md-ref-typeface-weight-regular) 1.375rem/1.75rem var(--md-ref-typeface-brand);--md-sys-typescale-title-lg-tracking: 0rem;--md-sys-typescale-title-lg-axes: normal;--md-sys-typescale-emphasized-title-lg: var(--md-ref-typeface-weight-medium) 1.375rem/1.75rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-title-lg-axes: "ROND" 100;--md-sys-typescale-headline-sm: var(--md-ref-typeface-weight-regular) 1.5rem/2rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-sm-tracking: 0rem;--md-sys-typescale-headline-sm-axes: normal;--md-sys-typescale-emphasized-headline-sm: var(--md-ref-typeface-weight-medium) 1.5rem/2rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-sm-axes: "ROND" 100;--md-sys-typescale-headline-md: var(--md-ref-typeface-weight-regular) 1.75rem/2.25rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-md-tracking: 0rem;--md-sys-typescale-headline-md-axes: normal;--md-sys-typescale-emphasized-headline-md: var(--md-ref-typeface-weight-medium) 1.75rem/2.25rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-md-axes: "ROND" 100;--md-sys-typescale-headline-lg: var(--md-ref-typeface-weight-regular) 2rem/2.5rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-lg-tracking: 0rem;--md-sys-typescale-headline-lg-axes: normal;--md-sys-typescale-emphasized-headline-lg: var(--md-ref-typeface-weight-medium) 2rem/2.5rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-lg-axes: "ROND" 100;--md-sys-typescale-display-sm: var(--md-ref-typeface-weight-regular) 2.25rem/2.75rem var(--md-ref-typeface-brand);--md-sys-typescale-display-sm-tracking: 0rem;--md-sys-typescale-display-sm-axes: normal;--md-sys-typescale-emphasized-display-sm: var(--md-ref-typeface-weight-medium) 2.25rem/2.75rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-sm-axes: "ROND" 100;--md-sys-typescale-display-md: var(--md-ref-typeface-weight-regular) 2.8125rem/3.25rem var(--md-ref-typeface-brand);--md-sys-typescale-display-md-tracking: 0rem;--md-sys-typescale-display-md-axes: normal;--md-sys-typescale-emphasized-display-md: var(--md-ref-typeface-weight-medium) 2.8125rem/3.25rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-md-axes: "ROND" 100;--md-sys-typescale-display-lg: var(--md-ref-typeface-weight-regular) 3.5625rem/4rem var(--md-ref-typeface-brand);--md-sys-typescale-display-lg-tracking: -0.015625rem;--md-sys-typescale-display-lg-axes: normal;--md-sys-typescale-emphasized-display-lg: var(--md-ref-typeface-weight-medium) 3.5625rem/4rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-lg-axes: "ROND" 100}}
|
|
12
12
|
`;
|
|
13
13
|
export default styles.styleSheet;
|
|
14
14
|
//# sourceMappingURL=md-typography-tokens.cssresult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-typography-tokens.cssresult.js","sourceRoot":"","sources":["md-typography-tokens.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iFAAiF;AACjF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;CAIxB,CAAC;AACF,eAAe,MAAM,CAAC,UAAW,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./labs/gb/styles/typography/md-typography-tokens.css.\nimport {css} from 'lit';\nexport const styles = css`/*!\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */@layer md.sys.typescale{:root{--md-ref-typeface-brand: var(--md-ref-typeface-plain);--md-ref-typeface-plain: Roboto Flex, Roboto, Noto Sans, system-ui, sans-serif;--md-ref-typeface-weight-regular: 400;--md-ref-typeface-weight-medium: 500;--md-ref-typeface-weight-bold: 700;--md-sys-typescale-label-sm: var(--md-ref-typeface-weight-medium) 0.6875rem
|
|
1
|
+
{"version":3,"file":"md-typography-tokens.cssresult.js","sourceRoot":"","sources":["md-typography-tokens.cssresult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,iFAAiF;AACjF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;CAIxB,CAAC;AACF,eAAe,MAAM,CAAC,UAAW,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Generated stylesheet for ./labs/gb/styles/typography/md-typography-tokens.css.\nimport {css} from 'lit';\nexport const styles = css`/*!\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */@layer md.sys.typescale{:root{--md-ref-typeface-brand: var(--md-ref-typeface-plain);--md-ref-typeface-plain: Roboto Flex, Roboto, Noto Sans, system-ui, sans-serif;--md-ref-typeface-weight-regular: 400;--md-ref-typeface-weight-medium: 500;--md-ref-typeface-weight-bold: 700;--md-sys-typescale-label-sm: var(--md-ref-typeface-weight-medium) 0.6875rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-label-sm-tracking: 0.03125rem;--md-sys-typescale-label-sm-axes: normal;--md-sys-typescale-emphasized-label-sm: var(--md-ref-typeface-weight-bold) 0.6875rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-sm-axes: \"ROND\" 100;--md-sys-typescale-label-md: var(--md-ref-typeface-weight-medium) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-label-md-tracking: 0.03125rem;--md-sys-typescale-label-md-axes: normal;--md-sys-typescale-emphasized-label-md: var(--md-ref-typeface-weight-bold) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-md-axes: \"ROND\" 100;--md-sys-typescale-label-lg: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-label-lg-tracking: 0.00625rem;--md-sys-typescale-label-lg-axes: normal;--md-sys-typescale-emphasized-label-lg: var(--md-ref-typeface-weight-bold) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-label-lg-axes: \"ROND\" 100;--md-sys-typescale-body-sm: var(--md-ref-typeface-weight-regular) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-body-sm-tracking: 0.025rem;--md-sys-typescale-body-sm-axes: normal;--md-sys-typescale-emphasized-body-sm: var(--md-ref-typeface-weight-medium) 0.75rem/1rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-sm-axes: \"ROND\" 100;--md-sys-typescale-body-md: var(--md-ref-typeface-weight-regular) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-body-md-tracking: 0.015625rem;--md-sys-typescale-body-md-axes: normal;--md-sys-typescale-emphasized-body-md: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-md-axes: \"ROND\" 100;--md-sys-typescale-body-lg: var(--md-ref-typeface-weight-regular) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-body-lg-tracking: 0.03125rem;--md-sys-typescale-body-lg-axes: normal;--md-sys-typescale-emphasized-body-lg: var(--md-ref-typeface-weight-medium) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-body-lg-axes: \"ROND\" 100;--md-sys-typescale-title-sm: var(--md-ref-typeface-weight-medium) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-title-sm-tracking: 0.00625rem;--md-sys-typescale-title-sm-axes: normal;--md-sys-typescale-emphasized-title-sm: var(--md-ref-typeface-weight-bold) 0.875rem/1.25rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-title-sm-axes: \"ROND\" 100;--md-sys-typescale-title-md: var(--md-ref-typeface-weight-medium) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-title-md-tracking: 0.009375rem;--md-sys-typescale-title-md-axes: normal;--md-sys-typescale-emphasized-title-md: var(--md-ref-typeface-weight-bold) 1rem/1.5rem var(--md-ref-typeface-plain);--md-sys-typescale-emphasized-title-md-axes: \"ROND\" 100;--md-sys-typescale-title-lg: var(--md-ref-typeface-weight-regular) 1.375rem/1.75rem var(--md-ref-typeface-brand);--md-sys-typescale-title-lg-tracking: 0rem;--md-sys-typescale-title-lg-axes: normal;--md-sys-typescale-emphasized-title-lg: var(--md-ref-typeface-weight-medium) 1.375rem/1.75rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-title-lg-axes: \"ROND\" 100;--md-sys-typescale-headline-sm: var(--md-ref-typeface-weight-regular) 1.5rem/2rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-sm-tracking: 0rem;--md-sys-typescale-headline-sm-axes: normal;--md-sys-typescale-emphasized-headline-sm: var(--md-ref-typeface-weight-medium) 1.5rem/2rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-sm-axes: \"ROND\" 100;--md-sys-typescale-headline-md: var(--md-ref-typeface-weight-regular) 1.75rem/2.25rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-md-tracking: 0rem;--md-sys-typescale-headline-md-axes: normal;--md-sys-typescale-emphasized-headline-md: var(--md-ref-typeface-weight-medium) 1.75rem/2.25rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-md-axes: \"ROND\" 100;--md-sys-typescale-headline-lg: var(--md-ref-typeface-weight-regular) 2rem/2.5rem var(--md-ref-typeface-brand);--md-sys-typescale-headline-lg-tracking: 0rem;--md-sys-typescale-headline-lg-axes: normal;--md-sys-typescale-emphasized-headline-lg: var(--md-ref-typeface-weight-medium) 2rem/2.5rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-headline-lg-axes: \"ROND\" 100;--md-sys-typescale-display-sm: var(--md-ref-typeface-weight-regular) 2.25rem/2.75rem var(--md-ref-typeface-brand);--md-sys-typescale-display-sm-tracking: 0rem;--md-sys-typescale-display-sm-axes: normal;--md-sys-typescale-emphasized-display-sm: var(--md-ref-typeface-weight-medium) 2.25rem/2.75rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-sm-axes: \"ROND\" 100;--md-sys-typescale-display-md: var(--md-ref-typeface-weight-regular) 2.8125rem/3.25rem var(--md-ref-typeface-brand);--md-sys-typescale-display-md-tracking: 0rem;--md-sys-typescale-display-md-axes: normal;--md-sys-typescale-emphasized-display-md: var(--md-ref-typeface-weight-medium) 2.8125rem/3.25rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-md-axes: \"ROND\" 100;--md-sys-typescale-display-lg: var(--md-ref-typeface-weight-regular) 3.5625rem/4rem var(--md-ref-typeface-brand);--md-sys-typescale-display-lg-tracking: -0.015625rem;--md-sys-typescale-display-lg-axes: normal;--md-sys-typescale-emphasized-display-lg: var(--md-ref-typeface-weight-medium) 3.5625rem/4rem var(--md-ref-typeface-brand);--md-sys-typescale-emphasized-display-lg-axes: \"ROND\" 100}}\n`;\nexport default styles.styleSheet!;\n"]}
|
|
@@ -16,7 +16,10 @@ export type ListItemType = 'text' | 'button' | 'link';
|
|
|
16
16
|
declare const listItemBaseClass: import("../../../labs/behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
17
17
|
/**
|
|
18
18
|
* @fires request-activation {Event} Requests the list to set `tabindex=0` on
|
|
19
|
-
* the item and focus it.
|
|
19
|
+
* the item and focus it. Used internally for list keyboard navigation; most
|
|
20
|
+
* applications do not need to listen for this event. It is exposed for
|
|
21
|
+
* authors building their own list-item replacements or wrapping items in a
|
|
22
|
+
* custom controller. --bubbles --composed
|
|
20
23
|
*/
|
|
21
24
|
export declare class ListItemEl extends listItemBaseClass implements ListItem {
|
|
22
25
|
/** @nocollapse */
|
|
@@ -17,7 +17,10 @@ import { createRequestActivationEvent, } from '../list-navigation-helpers.js';
|
|
|
17
17
|
const listItemBaseClass = mixinDelegatesAria(LitElement);
|
|
18
18
|
/**
|
|
19
19
|
* @fires request-activation {Event} Requests the list to set `tabindex=0` on
|
|
20
|
-
* the item and focus it.
|
|
20
|
+
* the item and focus it. Used internally for list keyboard navigation; most
|
|
21
|
+
* applications do not need to listen for this event. It is exposed for
|
|
22
|
+
* authors building their own list-item replacements or wrapping items in a
|
|
23
|
+
* custom controller. --bubbles --composed
|
|
21
24
|
*/
|
|
22
25
|
export class ListItemEl extends listItemBaseClass {
|
|
23
26
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACL,4BAA4B,GAE7B,MAAM,+BAA+B,CAAC;AAOvC,wCAAwC;AACxC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAA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KAQV,CAAC;IACJ,CAAC;IAES,OAAO;QACf,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QACD,uEAAuE;QACvE,IAAI,CAAC,aAAa,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACrD,CAAC;IAEQ,KAAK;QACZ,wEAAwE;QACxE,qDAAqD;QACrD,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAEQ,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,wEAAwE;YACxE,yBAAyB;YACzB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,2EAA2E;QAC3E,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AArLD,kBAAkB;AACF,4BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAKwC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE9B;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {\n createRequestActivationEvent,\n ListItem,\n} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text' | 'button' | 'link';\n\n// Separate variable needed for closure.\nconst listItemBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * @fires request-activation {Event} Requests the list to set `tabindex=0` on\n * the item and focus it. --bubbles --composed\n */\nexport class ListItemEl extends listItemBaseClass implements ListItem {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n\n override click() {\n if (!this.listItemRoot) {\n // If the element has not finished rendering, call super to ensure click\n // events are dispatched.\n super.click();\n return;\n }\n\n // Forward click to the element to ensure link <a>.click() works correctly.\n this.listItemRoot.click();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAY,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACL,4BAA4B,GAE7B,MAAM,+BAA+B,CAAC;AAOvC,wCAAwC;AACxC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAAjD;;QAOE;;WAEG;QACuC,aAAQ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,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QACD,uEAAuE;QACvE,IAAI,CAAC,aAAa,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACrD,CAAC;IAEQ,KAAK;QACZ,wEAAwE;QACxE,qDAAqD;QACrD,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAEQ,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,wEAAwE;YACxE,yBAAyB;YACzB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,2EAA2E;QAC3E,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;;AArLD,kBAAkB;AACF,4BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AAKwC;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE9B;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {\n createRequestActivationEvent,\n ListItem,\n} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text' | 'button' | 'link';\n\n// Separate variable needed for closure.\nconst listItemBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * @fires request-activation {Event} Requests the list to set `tabindex=0` on\n * the item and focus it. Used internally for list keyboard navigation; most\n * applications do not need to listen for this event. It is exposed for\n * authors building their own list-item replacements or wrapping items in a\n * custom controller. --bubbles --composed\n */\nexport class ListItemEl extends listItemBaseClass implements ListItem {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n\n override click() {\n if (!this.listItemRoot) {\n // If the element has not finished rendering, call super to ensure click\n // events are dispatched.\n super.click();\n return;\n }\n\n // Forward click to the element to ensure link <a>.click() works correctly.\n this.listItemRoot.click();\n }\n}\n"]}
|
|
@@ -11,7 +11,11 @@ import { Corner } from '../menu.js';
|
|
|
11
11
|
* @fires deactivate-items {Event} Requests the parent menu to deselect other
|
|
12
12
|
* items when a submenu opens. --bubbles --composed
|
|
13
13
|
* @fires request-activation {Event} Requests the parent to make the slotted item
|
|
14
|
-
* focusable and focus the item.
|
|
14
|
+
* focusable and focus the item. Used internally for menu keyboard navigation;
|
|
15
|
+
* most applications do not need to listen for this event. It is exposed for
|
|
16
|
+
* authors building their own menu-item replacements, or for advanced cases
|
|
17
|
+
* where you want to call `preventDefault`/`stopPropagation` on it to override
|
|
18
|
+
* default focus handling. --bubbles --composed
|
|
15
19
|
* @fires deactivate-typeahead {Event} Requests the parent menu to deactivate
|
|
16
20
|
* the typeahead functionality when a submenu opens. --bubbles --composed
|
|
17
21
|
* @fires activate-typeahead {Event} Requests the parent menu to activate the
|
|
@@ -13,7 +13,11 @@ import { Corner } from '../menu.js';
|
|
|
13
13
|
* @fires deactivate-items {Event} Requests the parent menu to deselect other
|
|
14
14
|
* items when a submenu opens. --bubbles --composed
|
|
15
15
|
* @fires request-activation {Event} Requests the parent to make the slotted item
|
|
16
|
-
* focusable and focus the item.
|
|
16
|
+
* focusable and focus the item. Used internally for menu keyboard navigation;
|
|
17
|
+
* most applications do not need to listen for this event. It is exposed for
|
|
18
|
+
* authors building their own menu-item replacements, or for advanced cases
|
|
19
|
+
* where you want to call `preventDefault`/`stopPropagation` on it to override
|
|
20
|
+
* default focus handling. --bubbles --composed
|
|
17
21
|
* @fires deactivate-typeahead {Event} Requests the parent menu to deactivate
|
|
18
22
|
* the typeahead functionality when a submenu opens. --bubbles --composed
|
|
19
23
|
* @fires activate-typeahead {Event} Requests the parent menu to activate the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sub-menu.js","sourceRoot":"","sources":["sub-menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAElE,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAEL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC9B,eAAe,EAEf,YAAY,EACZ,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAElC;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAQ,SAAQ,UAAU;IA0BrC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/B,CAAC;IAWD;QACE,KAAK,EAAE,CAAC;QA3CV;;WAEG;QAEH,iBAAY,GAAW,MAAM,CAAC,SAAS,CAAC;QACxC;;WAEG;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AAIF;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;2CAAyC;AAIrB;IAAxD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAC,CAAC;+CAAsB;AAK9E;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAC;gDACnC;AAMtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAC,CAAC;0CAClD;AAWA;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACjB;AAGnB;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACrB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, isServer, LitElement} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {\n createDeactivateItemsEvent,\n createRequestActivationEvent,\n deactivateActiveItem,\n getFirstActivatableItem,\n} from '../../../list/internal/list-navigation-helpers.js';\nimport {MenuItem} from '../controllers/menuItemController.js';\nimport {\n CloseMenuEvent,\n CloseReason,\n createActivateTypeaheadEvent,\n createDeactivateTypeaheadEvent,\n KeydownCloseKey,\n Menu,\n NavigableKey,\n SelectionKey,\n} from '../controllers/shared.js';\nimport {Corner} from '../menu.js';\n\n/**\n * @fires deactivate-items {Event} Requests the parent menu to deselect other\n * items when a submenu opens. --bubbles --composed\n * @fires request-activation {Event} Requests the parent to make the slotted item\n * focusable and focus the item. --bubbles --composed\n * @fires deactivate-typeahead {Event} Requests the parent menu to deactivate\n * the typeahead functionality when a submenu opens. --bubbles --composed\n * @fires activate-typeahead {Event} Requests the parent menu to activate the\n * typeahead functionality when a submenu closes. --bubbles --composed\n */\nexport class SubMenu extends LitElement {\n /**\n * The anchorCorner to set on the submenu.\n */\n @property({attribute: 'anchor-corner'})\n anchorCorner: Corner = Corner.START_END;\n /**\n * The menuCorner to set on the submenu.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = Corner.START_START;\n /**\n * The delay between mouseenter and submenu opening.\n */\n @property({type: Number, attribute: 'hover-open-delay'}) hoverOpenDelay = 400;\n /**\n * The delay between ponterleave and the submenu closing.\n */\n @property({type: Number, attribute: 'hover-close-delay'})\n hoverCloseDelay = 400;\n\n /**\n * READONLY: self-identifies as a menu item and sets its identifying attribute\n */\n @property({type: Boolean, reflect: true, attribute: 'md-sub-menu'})\n isSubMenu = true;\n\n get item() {\n return this.items[0] ?? null;\n }\n\n get menu() {\n return this.menus[0] ?? null;\n }\n\n @queryAssignedElements({slot: 'item', flatten: true})\n private readonly items!: MenuItem[];\n\n @queryAssignedElements({slot: 'menu', flatten: true})\n private readonly menus!: Menu[];\n\n private previousOpenTimeout = 0;\n private previousCloseTimeout = 0;\n\n constructor() {\n super();\n\n if (!isServer) {\n this.addEventListener('mouseenter', this.onMouseenter);\n this.addEventListener('mouseleave', this.onMouseleave);\n }\n }\n\n override render() {\n return html`\n <slot\n name=\"item\"\n @click=${this.onClick}\n @keydown=${this.onKeydown}\n @slotchange=${this.onSlotchange}>\n </slot>\n <slot\n name=\"menu\"\n @keydown=${this.onSubMenuKeydown}\n @close-menu=${this.onCloseSubmenu}\n @slotchange=${this.onSlotchange}>\n </slot>\n `;\n }\n\n protected override firstUpdated() {\n // slotchange is not fired if the contents have been SSRd\n this.onSlotchange();\n }\n\n /**\n * Shows the submenu.\n */\n async show() {\n const menu = this.menu;\n if (!menu || menu.open) return;\n\n // Ensures that we deselect items when the menu closes and reactivate\n // typeahead when the menu closes, so that we do not have dirty state of\n // `sub-menu > menu-item[selected]` when we reopen.\n //\n // This cannot happen in `close()` because the menu may close via other\n // means Additionally, this cannot happen in onCloseSubmenu because\n // `close-menu` may not be called via focusout of outside click and not\n // triggered by an item\n menu.addEventListener(\n 'closed',\n () => {\n this.item.ariaExpanded = 'false';\n this.dispatchEvent(createActivateTypeaheadEvent());\n this.dispatchEvent(createDeactivateItemsEvent());\n // aria-hidden required so ChromeVox doesn't announce the closed menu\n menu.ariaHidden = 'true';\n },\n {once: true},\n );\n\n // Parent menu is `position: absolute` – this creates a new CSS relative\n // positioning context (similar to doing `position: relative`), so the\n // submenu's `<md-menu slot=\"submenu\" positioning=\"document\">` would be\n // wrong even if we change `md-sub-menu` from `position: relative` to\n // `position: static` because the submenu it would still be positioning\n // itself relative to the parent menu.\n if (menu.positioning === 'document') {\n menu.positioning = 'absolute';\n }\n menu.quick = true;\n // Submenus are in overflow when not fixed. Can remove once we have native\n // popup support\n menu.hasOverflow = true;\n menu.anchorCorner = this.anchorCorner;\n menu.menuCorner = this.menuCorner;\n menu.anchorElement = this.item;\n menu.defaultFocus = 'first-item';\n // aria-hidden management required so ChromeVox doesn't announce the closed\n // menu. Remove it here since we are about to show and focus it.\n menu.removeAttribute('aria-hidden');\n // This is required in the case where we have a leaf menu open and and the\n // user hovers a parent menu's item which is not an md-sub-menu item.\n // If this were set to true, then the menu would close and focus would be\n // lost. That means the focusout event would have a `relatedTarget` of\n // `null` since nothing in the menu would be focused anymore due to the\n // leaf menu closing. restoring focus ensures that we keep focus in the\n // submenu tree.\n menu.skipRestoreFocus = false;\n\n // Menu could already be opened because of mouse interaction\n const menuAlreadyOpen = menu.open;\n menu.show();\n this.item.ariaExpanded = 'true';\n this.item.ariaHasPopup = 'menu';\n if (menu.id) {\n this.item.setAttribute('aria-controls', menu.id);\n }\n\n // Deactivate other items. This can be the case if the user has tabbed\n // around the menu and then mouses over an md-sub-menu.\n this.dispatchEvent(createDeactivateItemsEvent());\n this.dispatchEvent(createDeactivateTypeaheadEvent());\n this.item.selected = true;\n\n // This is the case of mouse hovering when already opened via keyboard or\n // vice versa\n if (!menuAlreadyOpen) {\n let open = (value: unknown) => {};\n const opened = new Promise((resolve) => {\n open = resolve;\n });\n menu.addEventListener('opened', open, {once: true});\n await opened;\n }\n }\n\n /**\n * Closes the submenu.\n */\n async close() {\n const menu = this.menu;\n if (!menu || !menu.open) return;\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n menu.quick = true;\n menu.close();\n this.dispatchEvent(createDeactivateItemsEvent());\n let close = (value: unknown) => {};\n const closed = new Promise((resolve) => {\n close = resolve;\n });\n menu.addEventListener('closed', close, {once: true});\n await closed;\n }\n\n protected onSlotchange() {\n if (!this.item) {\n return;\n }\n\n // TODO(b/301296618): clean up old aria values on change\n this.item.ariaExpanded = 'false';\n this.item.ariaHasPopup = 'menu';\n if (this.menu?.id) {\n this.item.setAttribute('aria-controls', this.menu.id);\n }\n this.item.keepOpen = true;\n\n const menu = this.menu;\n if (!menu) return;\n\n menu.isSubmenu = true;\n // Required for ChromeVox to not linearly navigate to the menu while closed\n menu.ariaHidden = 'true';\n }\n\n /**\n * Starts the default 400ms countdown to open the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseenter = () => {\n clearTimeout(this.previousOpenTimeout);\n clearTimeout(this.previousCloseTimeout);\n if (this.menu?.open) return;\n\n // Open synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverOpenDelay) {\n this.show();\n } else {\n this.previousOpenTimeout = setTimeout(() => {\n this.show();\n }, this.hoverOpenDelay);\n }\n };\n\n /**\n * Starts the default 400ms countdown to close the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseleave = () => {\n clearTimeout(this.previousCloseTimeout);\n clearTimeout(this.previousOpenTimeout);\n\n // Close synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverCloseDelay) {\n this.close();\n } else {\n this.previousCloseTimeout = setTimeout(() => {\n this.close();\n }, this.hoverCloseDelay);\n }\n };\n\n protected onClick() {\n this.show();\n }\n\n /**\n * On item keydown handles opening the submenu.\n */\n protected async onKeydown(event: KeyboardEvent) {\n const shouldOpenSubmenu = this.isSubmenuOpenKey(event.code);\n\n if (event.defaultPrevented) return;\n\n const openedWithLR =\n shouldOpenSubmenu &&\n (NavigableKey.LEFT === event.code || NavigableKey.RIGHT === event.code);\n\n if (event.code === SelectionKey.SPACE || openedWithLR) {\n // prevent space from scrolling and Left + Right from selecting previous /\n // next items or opening / closing parent menus. Only open the submenu.\n event.preventDefault();\n\n if (openedWithLR) {\n event.stopPropagation();\n }\n }\n\n if (!shouldOpenSubmenu) {\n return;\n }\n\n const submenu = this.menu;\n if (!submenu) return;\n\n const submenuItems = submenu.items;\n const firstActivatableItem = getFirstActivatableItem(submenuItems);\n\n if (firstActivatableItem) {\n await this.show();\n\n firstActivatableItem.tabIndex = 0;\n firstActivatableItem.focus();\n\n return;\n }\n }\n\n private onCloseSubmenu(event: CloseMenuEvent) {\n const {itemPath, reason} = event.detail;\n itemPath.push(this.item);\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n // Escape should only close one menu not all of the menus unlike space or\n // click selection which should close all menus.\n if (\n reason.kind === CloseReason.KEYDOWN &&\n reason.key === KeydownCloseKey.ESCAPE\n ) {\n event.stopPropagation();\n this.item.dispatchEvent(createRequestActivationEvent());\n return;\n }\n\n this.dispatchEvent(createDeactivateItemsEvent());\n }\n\n private async onSubMenuKeydown(event: KeyboardEvent) {\n if (event.defaultPrevented) return;\n const {close: shouldClose, keyCode} = this.isSubmenuCloseKey(event.code);\n if (!shouldClose) return;\n\n // Communicate that it's handled so that we don't accidentally close every\n // parent menu. Additionally, we want to isolate things like the typeahead\n // keydowns from bubbling up to the parent menu and confounding things.\n event.preventDefault();\n\n if (keyCode === NavigableKey.LEFT || keyCode === NavigableKey.RIGHT) {\n // Prevent this from bubbling to parents\n event.stopPropagation();\n }\n\n await this.close();\n\n deactivateActiveItem(this.menu.items);\n this.item?.focus();\n this.item.tabIndex = 0;\n this.item.focus();\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should open\n * the submenu. This is RTL-aware. By default, left, right, space, or enter.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should open the submenu.\n */\n private isSubmenuOpenKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.LEFT : NavigableKey.RIGHT;\n switch (code) {\n case arrowEnterKey:\n case SelectionKey.SPACE:\n case SelectionKey.ENTER:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should close\n * the submenu. This is RTL-aware. By default right, left, or escape.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should close the submenu.\n */\n private isSubmenuCloseKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.RIGHT : NavigableKey.LEFT;\n switch (code) {\n case arrowEnterKey:\n case KeydownCloseKey.ESCAPE:\n return {close: true, keyCode: code} as const;\n default:\n return {close: false} as const;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sub-menu.js","sourceRoot":"","sources":["sub-menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAElE,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAEL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,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gB,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC;QACzD,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;QACrE,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,aAAa,CAAC;YACnB,KAAK,eAAe,CAAC,MAAM;gBACzB,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAU,CAAC;YAC/C;gBACE,OAAO,EAAC,KAAK,EAAE,KAAK,EAAU,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AA/WC;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;6CACC;AAIF;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;2CAAyC;AAIrB;IAAxD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAC,CAAC;+CAAsB;AAK9E;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAC;gDACnC;AAMtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAC,CAAC;0CAClD;AAWA;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACjB;AAGnB;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;sCACrB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, isServer, LitElement} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {\n createDeactivateItemsEvent,\n createRequestActivationEvent,\n deactivateActiveItem,\n getFirstActivatableItem,\n} from '../../../list/internal/list-navigation-helpers.js';\nimport {MenuItem} from '../controllers/menuItemController.js';\nimport {\n CloseMenuEvent,\n CloseReason,\n createActivateTypeaheadEvent,\n createDeactivateTypeaheadEvent,\n KeydownCloseKey,\n Menu,\n NavigableKey,\n SelectionKey,\n} from '../controllers/shared.js';\nimport {Corner} from '../menu.js';\n\n/**\n * @fires deactivate-items {Event} Requests the parent menu to deselect other\n * items when a submenu opens. --bubbles --composed\n * @fires request-activation {Event} Requests the parent to make the slotted item\n * focusable and focus the item. Used internally for menu keyboard navigation;\n * most applications do not need to listen for this event. It is exposed for\n * authors building their own menu-item replacements, or for advanced cases\n * where you want to call `preventDefault`/`stopPropagation` on it to override\n * default focus handling. --bubbles --composed\n * @fires deactivate-typeahead {Event} Requests the parent menu to deactivate\n * the typeahead functionality when a submenu opens. --bubbles --composed\n * @fires activate-typeahead {Event} Requests the parent menu to activate the\n * typeahead functionality when a submenu closes. --bubbles --composed\n */\nexport class SubMenu extends LitElement {\n /**\n * The anchorCorner to set on the submenu.\n */\n @property({attribute: 'anchor-corner'})\n anchorCorner: Corner = Corner.START_END;\n /**\n * The menuCorner to set on the submenu.\n */\n @property({attribute: 'menu-corner'}) menuCorner: Corner = Corner.START_START;\n /**\n * The delay between mouseenter and submenu opening.\n */\n @property({type: Number, attribute: 'hover-open-delay'}) hoverOpenDelay = 400;\n /**\n * The delay between ponterleave and the submenu closing.\n */\n @property({type: Number, attribute: 'hover-close-delay'})\n hoverCloseDelay = 400;\n\n /**\n * READONLY: self-identifies as a menu item and sets its identifying attribute\n */\n @property({type: Boolean, reflect: true, attribute: 'md-sub-menu'})\n isSubMenu = true;\n\n get item() {\n return this.items[0] ?? null;\n }\n\n get menu() {\n return this.menus[0] ?? null;\n }\n\n @queryAssignedElements({slot: 'item', flatten: true})\n private readonly items!: MenuItem[];\n\n @queryAssignedElements({slot: 'menu', flatten: true})\n private readonly menus!: Menu[];\n\n private previousOpenTimeout = 0;\n private previousCloseTimeout = 0;\n\n constructor() {\n super();\n\n if (!isServer) {\n this.addEventListener('mouseenter', this.onMouseenter);\n this.addEventListener('mouseleave', this.onMouseleave);\n }\n }\n\n override render() {\n return html`\n <slot\n name=\"item\"\n @click=${this.onClick}\n @keydown=${this.onKeydown}\n @slotchange=${this.onSlotchange}>\n </slot>\n <slot\n name=\"menu\"\n @keydown=${this.onSubMenuKeydown}\n @close-menu=${this.onCloseSubmenu}\n @slotchange=${this.onSlotchange}>\n </slot>\n `;\n }\n\n protected override firstUpdated() {\n // slotchange is not fired if the contents have been SSRd\n this.onSlotchange();\n }\n\n /**\n * Shows the submenu.\n */\n async show() {\n const menu = this.menu;\n if (!menu || menu.open) return;\n\n // Ensures that we deselect items when the menu closes and reactivate\n // typeahead when the menu closes, so that we do not have dirty state of\n // `sub-menu > menu-item[selected]` when we reopen.\n //\n // This cannot happen in `close()` because the menu may close via other\n // means Additionally, this cannot happen in onCloseSubmenu because\n // `close-menu` may not be called via focusout of outside click and not\n // triggered by an item\n menu.addEventListener(\n 'closed',\n () => {\n this.item.ariaExpanded = 'false';\n this.dispatchEvent(createActivateTypeaheadEvent());\n this.dispatchEvent(createDeactivateItemsEvent());\n // aria-hidden required so ChromeVox doesn't announce the closed menu\n menu.ariaHidden = 'true';\n },\n {once: true},\n );\n\n // Parent menu is `position: absolute` – this creates a new CSS relative\n // positioning context (similar to doing `position: relative`), so the\n // submenu's `<md-menu slot=\"submenu\" positioning=\"document\">` would be\n // wrong even if we change `md-sub-menu` from `position: relative` to\n // `position: static` because the submenu it would still be positioning\n // itself relative to the parent menu.\n if (menu.positioning === 'document') {\n menu.positioning = 'absolute';\n }\n menu.quick = true;\n // Submenus are in overflow when not fixed. Can remove once we have native\n // popup support\n menu.hasOverflow = true;\n menu.anchorCorner = this.anchorCorner;\n menu.menuCorner = this.menuCorner;\n menu.anchorElement = this.item;\n menu.defaultFocus = 'first-item';\n // aria-hidden management required so ChromeVox doesn't announce the closed\n // menu. Remove it here since we are about to show and focus it.\n menu.removeAttribute('aria-hidden');\n // This is required in the case where we have a leaf menu open and and the\n // user hovers a parent menu's item which is not an md-sub-menu item.\n // If this were set to true, then the menu would close and focus would be\n // lost. That means the focusout event would have a `relatedTarget` of\n // `null` since nothing in the menu would be focused anymore due to the\n // leaf menu closing. restoring focus ensures that we keep focus in the\n // submenu tree.\n menu.skipRestoreFocus = false;\n\n // Menu could already be opened because of mouse interaction\n const menuAlreadyOpen = menu.open;\n menu.show();\n this.item.ariaExpanded = 'true';\n this.item.ariaHasPopup = 'menu';\n if (menu.id) {\n this.item.setAttribute('aria-controls', menu.id);\n }\n\n // Deactivate other items. This can be the case if the user has tabbed\n // around the menu and then mouses over an md-sub-menu.\n this.dispatchEvent(createDeactivateItemsEvent());\n this.dispatchEvent(createDeactivateTypeaheadEvent());\n this.item.selected = true;\n\n // This is the case of mouse hovering when already opened via keyboard or\n // vice versa\n if (!menuAlreadyOpen) {\n let open = (value: unknown) => {};\n const opened = new Promise((resolve) => {\n open = resolve;\n });\n menu.addEventListener('opened', open, {once: true});\n await opened;\n }\n }\n\n /**\n * Closes the submenu.\n */\n async close() {\n const menu = this.menu;\n if (!menu || !menu.open) return;\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n menu.quick = true;\n menu.close();\n this.dispatchEvent(createDeactivateItemsEvent());\n let close = (value: unknown) => {};\n const closed = new Promise((resolve) => {\n close = resolve;\n });\n menu.addEventListener('closed', close, {once: true});\n await closed;\n }\n\n protected onSlotchange() {\n if (!this.item) {\n return;\n }\n\n // TODO(b/301296618): clean up old aria values on change\n this.item.ariaExpanded = 'false';\n this.item.ariaHasPopup = 'menu';\n if (this.menu?.id) {\n this.item.setAttribute('aria-controls', this.menu.id);\n }\n this.item.keepOpen = true;\n\n const menu = this.menu;\n if (!menu) return;\n\n menu.isSubmenu = true;\n // Required for ChromeVox to not linearly navigate to the menu while closed\n menu.ariaHidden = 'true';\n }\n\n /**\n * Starts the default 400ms countdown to open the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseenter = () => {\n clearTimeout(this.previousOpenTimeout);\n clearTimeout(this.previousCloseTimeout);\n if (this.menu?.open) return;\n\n // Open synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverOpenDelay) {\n this.show();\n } else {\n this.previousOpenTimeout = setTimeout(() => {\n this.show();\n }, this.hoverOpenDelay);\n }\n };\n\n /**\n * Starts the default 400ms countdown to close the submenu.\n *\n * NOTE: We explicitly use mouse events and not pointer events because\n * pointer events apply to touch events. And if a user were to tap a\n * sub-menu, it would fire the \"pointerenter\", \"pointerleave\", \"click\" events\n * which would open the menu on click, and then set the timeout to close the\n * menu due to pointerleave.\n */\n protected onMouseleave = () => {\n clearTimeout(this.previousCloseTimeout);\n clearTimeout(this.previousOpenTimeout);\n\n // Close synchronously if delay is 0. (screenshot tests infra\n // would never resolve otherwise)\n if (!this.hoverCloseDelay) {\n this.close();\n } else {\n this.previousCloseTimeout = setTimeout(() => {\n this.close();\n }, this.hoverCloseDelay);\n }\n };\n\n protected onClick() {\n this.show();\n }\n\n /**\n * On item keydown handles opening the submenu.\n */\n protected async onKeydown(event: KeyboardEvent) {\n const shouldOpenSubmenu = this.isSubmenuOpenKey(event.code);\n\n if (event.defaultPrevented) return;\n\n const openedWithLR =\n shouldOpenSubmenu &&\n (NavigableKey.LEFT === event.code || NavigableKey.RIGHT === event.code);\n\n if (event.code === SelectionKey.SPACE || openedWithLR) {\n // prevent space from scrolling and Left + Right from selecting previous /\n // next items or opening / closing parent menus. Only open the submenu.\n event.preventDefault();\n\n if (openedWithLR) {\n event.stopPropagation();\n }\n }\n\n if (!shouldOpenSubmenu) {\n return;\n }\n\n const submenu = this.menu;\n if (!submenu) return;\n\n const submenuItems = submenu.items;\n const firstActivatableItem = getFirstActivatableItem(submenuItems);\n\n if (firstActivatableItem) {\n await this.show();\n\n firstActivatableItem.tabIndex = 0;\n firstActivatableItem.focus();\n\n return;\n }\n }\n\n private onCloseSubmenu(event: CloseMenuEvent) {\n const {itemPath, reason} = event.detail;\n itemPath.push(this.item);\n\n this.dispatchEvent(createActivateTypeaheadEvent());\n // Escape should only close one menu not all of the menus unlike space or\n // click selection which should close all menus.\n if (\n reason.kind === CloseReason.KEYDOWN &&\n reason.key === KeydownCloseKey.ESCAPE\n ) {\n event.stopPropagation();\n this.item.dispatchEvent(createRequestActivationEvent());\n return;\n }\n\n this.dispatchEvent(createDeactivateItemsEvent());\n }\n\n private async onSubMenuKeydown(event: KeyboardEvent) {\n if (event.defaultPrevented) return;\n const {close: shouldClose, keyCode} = this.isSubmenuCloseKey(event.code);\n if (!shouldClose) return;\n\n // Communicate that it's handled so that we don't accidentally close every\n // parent menu. Additionally, we want to isolate things like the typeahead\n // keydowns from bubbling up to the parent menu and confounding things.\n event.preventDefault();\n\n if (keyCode === NavigableKey.LEFT || keyCode === NavigableKey.RIGHT) {\n // Prevent this from bubbling to parents\n event.stopPropagation();\n }\n\n await this.close();\n\n deactivateActiveItem(this.menu.items);\n this.item?.focus();\n this.item.tabIndex = 0;\n this.item.focus();\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should open\n * the submenu. This is RTL-aware. By default, left, right, space, or enter.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should open the submenu.\n */\n private isSubmenuOpenKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.LEFT : NavigableKey.RIGHT;\n switch (code) {\n case arrowEnterKey:\n case SelectionKey.SPACE:\n case SelectionKey.ENTER:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Determines whether the given KeyboardEvent code is one that should close\n * the submenu. This is RTL-aware. By default right, left, or escape.\n *\n * @param code The native KeyboardEvent code.\n * @return Whether or not the key code should close the submenu.\n */\n private isSubmenuCloseKey(code: string) {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const arrowEnterKey = isRtl ? NavigableKey.RIGHT : NavigableKey.LEFT;\n switch (code) {\n case arrowEnterKey:\n case KeydownCloseKey.ESCAPE:\n return {close: true, keyCode: code} as const;\n default:\n return {close: false} as const;\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@material/web",
|
|
3
|
-
"version": "2.4.2-nightly.
|
|
3
|
+
"version": "2.4.2-nightly.a3379a3.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"tslib": "^2.4.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@lit-labs/analyzer": "^0.
|
|
66
|
+
"@lit-labs/analyzer": "^0.14.0",
|
|
67
67
|
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
68
68
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
69
69
|
"@rollup/plugin-terser": "^0.4.4",
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"**/*.ts",
|
|
102
102
|
"!**/*.d.ts",
|
|
103
103
|
"!**/*.cssresult.ts",
|
|
104
|
+
"!labs/gb/**",
|
|
104
105
|
"!catalog/",
|
|
105
106
|
"!scripts/"
|
|
106
107
|
],
|
|
@@ -112,6 +113,7 @@
|
|
|
112
113
|
"!web-test-runner.config.js",
|
|
113
114
|
"!commitlint.config.js",
|
|
114
115
|
"!types/",
|
|
116
|
+
"!labs/gb/**",
|
|
115
117
|
"!catalog/",
|
|
116
118
|
"!scripts/"
|
|
117
119
|
],
|
|
@@ -149,6 +151,7 @@
|
|
|
149
151
|
"**/*.cssresult.ts",
|
|
150
152
|
"!catalog/"
|
|
151
153
|
],
|
|
154
|
+
"clean": "if-file-deleted",
|
|
152
155
|
"dependencies": [
|
|
153
156
|
"build:scripts",
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2D;gBAC3D,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;YAED,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAA+B,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC;IAEQ,CAAC,iBAAiB,CAAC;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AA1IC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;oCAGzB;AAkB0B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uCAAkB;AAKhC;IAAX,QAAQ,EAAE;oCAAc;AAEa;IAArC,KAAK,CAAC,YAAY,CAAC;wCAA0C","sourcesContent":["/**\n * @license\n * Copyright 2018 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} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {isActivationClick} from '../../internal/events/form-label-activation.js';\nimport {\n createValidator,\n getValidityAnchor,\n mixinConstraintValidation,\n} from '../../labs/behaviors/constraint-validation.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../labs/behaviors/element-internals.js';\nimport {mixinFocusable} from '../../labs/behaviors/focusable.js';\nimport {\n getFormState,\n getFormValue,\n mixinFormAssociated,\n} from '../../labs/behaviors/form-associated.js';\nimport {RadioValidator} from '../../labs/behaviors/validators/radio-validator.js';\n\nimport {SingleSelectionController} from './single-selection-controller.js';\n\nconst CHECKED = Symbol('checked');\nlet maskId = 0;\n\n// Separate variable needed for closure.\nconst radioBaseClass = mixinConstraintValidation(\n mixinFormAssociated(mixinElementInternals(mixinFocusable(LitElement))),\n);\n\n/**\n * A radio component.\n *\n * @fires input {InputEvent} Dispatched when the value changes from user\n * interaction. --bubbles\n * @fires change {Event} Dispatched when the value changes from user\n * interaction. --bubbles --composed\n */\nexport class Radio extends radioBaseClass {\n // Unique maskId is required because of a Safari bug that fail to persist\n // reference to the mask. This should be removed once the bug is fixed.\n private readonly maskId = `cutout${++maskId}`;\n\n /**\n * Whether or not the radio is selected.\n */\n @property({type: Boolean})\n get checked() {\n return this[CHECKED];\n }\n set checked(checked: boolean) {\n const wasChecked = this.checked;\n if (wasChecked === checked) {\n return;\n }\n\n this[CHECKED] = checked;\n this.requestUpdate('checked', wasChecked);\n this.selectionController.handleCheckedChange();\n }\n\n [CHECKED] = false;\n\n /**\n * Whether or not the radio is required. If any radio is required in a group,\n * all radios are implicitly required.\n */\n @property({type: Boolean}) required = false;\n\n /**\n * The element value to use in form submission when checked.\n */\n @property() value = 'on';\n\n @query('.container') private readonly container!: HTMLElement;\n private readonly selectionController = new SingleSelectionController(this);\n\n constructor() {\n super();\n this.addController(this.selectionController);\n if (!isServer) {\n this[internals].role = 'radio';\n this.addEventListener('click', this.handleClick.bind(this));\n this.addEventListener('keydown', this.handleKeydown.bind(this));\n }\n }\n\n protected override render() {\n const classes = {'checked': this.checked};\n return html`\n <div class=\"container ${classMap(classes)}\" aria-hidden=\"true\">\n <md-ripple\n part=\"ripple\"\n .control=${this}\n ?disabled=${this.disabled}></md-ripple>\n <md-focus-ring part=\"focus-ring\" .control=${this}></md-focus-ring>\n <svg class=\"icon\" viewBox=\"0 0 20 20\">\n <mask id=\"${this.maskId}\">\n <rect width=\"100%\" height=\"100%\" fill=\"white\" />\n <circle cx=\"10\" cy=\"10\" r=\"8\" fill=\"black\" />\n </mask>\n <circle\n class=\"outer circle\"\n cx=\"10\"\n cy=\"10\"\n r=\"10\"\n mask=\"url(#${this.maskId})\" />\n <circle class=\"inner circle\" cx=\"10\" cy=\"10\" r=\"5\" />\n </svg>\n\n <div class=\"touch-target\"></div>\n </div>\n `;\n }\n\n protected override updated() {\n this[internals].ariaChecked = String(this.checked);\n }\n\n private async handleClick(event: Event) {\n if (this.disabled) {\n return;\n }\n\n // allow event to propagate to user code after a microtask.\n await 0;\n if (event.defaultPrevented) {\n return;\n }\n\n if (isActivationClick(event)) {\n this.focus();\n }\n\n // Per spec, clicking on a radio input always selects it.\n this.checked = true;\n this.dispatchEvent(new Event('change', {bubbles: true}));\n this.dispatchEvent(\n new InputEvent('input', {bubbles: true, composed: true}),\n );\n }\n\n private async handleKeydown(event: KeyboardEvent) {\n // allow event to propagate to user code after a microtask.\n await 0;\n if (event.key !== ' ' || event.defaultPrevented) {\n return;\n }\n\n this.click();\n }\n\n override [getFormValue]() {\n return this.checked ? this.value : null;\n }\n\n override [getFormState]() {\n return String(this.checked);\n }\n\n override formResetCallback() {\n // The checked property does not reflect, so the original attribute set by\n // the user is used to determine the default value.\n this.checked = this.hasAttribute('checked');\n }\n\n override formStateRestoreCallback(state: string) {\n this.checked = state === 'true';\n }\n\n override [createValidator]() {\n return new RadioValidator(() => {\n if (!this.selectionController) {\n // Validation runs on superclass construction, so selection controller\n // might not actually be ready until this class constructs.\n return [this];\n }\n\n return this.selectionController.controls as [Radio, ...Radio[]];\n });\n }\n\n override [getValidityAnchor]() {\n return this.container;\n }\n}\n"]}
|
|
@@ -258,8 +258,6 @@ export declare abstract class Select extends selectBaseClass {
|
|
|
258
258
|
*/
|
|
259
259
|
private dispatchInteractionEvents;
|
|
260
260
|
private getErrorText;
|
|
261
|
-
disabled: boolean;
|
|
262
|
-
name: string;
|
|
263
261
|
[getFormValue](): string;
|
|
264
262
|
formResetCallback(): void;
|
|
265
263
|
formStateRestoreCallback(state: string): void;
|