@universal-material/web 3.0.27 → 3.0.29
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/app-bar/top-app-bar.styles.js +1 -1
- package/app-bar/top-app-bar.styles.js.map +1 -1
- package/button/button-set.d.ts +1 -1
- package/button/button-set.d.ts.map +1 -1
- package/button/button-set.js +2 -2
- package/button/button-set.js.map +1 -1
- package/button/button-set.styles.js +6 -6
- package/button/button-set.styles.js.map +1 -1
- package/button/button.js +1 -1
- package/button/button.js.map +1 -1
- package/button/button.styles.d.ts.map +1 -1
- package/button/button.styles.js +10 -5
- package/button/button.styles.js.map +1 -1
- package/button/icon-button.styles.d.ts.map +1 -1
- package/button/icon-button.styles.js +10 -3
- package/button/icon-button.styles.js.map +1 -1
- package/card/card.styles.d.ts.map +1 -1
- package/card/card.styles.js +0 -4
- package/card/card.styles.js.map +1 -1
- package/checkbox/checkbox-list-item.d.ts +11 -0
- package/checkbox/checkbox-list-item.d.ts.map +1 -0
- package/checkbox/checkbox-list-item.js +16 -0
- package/checkbox/checkbox-list-item.js.map +1 -0
- package/checkbox/checkbox.d.ts +13 -8
- package/checkbox/checkbox.d.ts.map +1 -1
- package/checkbox/checkbox.js +51 -52
- package/checkbox/checkbox.js.map +1 -1
- package/{container/container.styles.d.ts → checkbox/checkbox.styles.d.ts} +1 -1
- package/checkbox/checkbox.styles.d.ts.map +1 -0
- package/checkbox/checkbox.styles.js +126 -0
- package/checkbox/checkbox.styles.js.map +1 -0
- package/config.d.ts +3 -0
- package/config.d.ts.map +1 -1
- package/config.js +3 -0
- package/config.js.map +1 -1
- package/css/universal-material.css +3343 -327
- package/css/universal-material.min.css +2 -2
- package/custom-elements.json +3858 -2015
- package/field/field.d.ts +57 -0
- package/field/field.d.ts.map +1 -0
- package/field/field.js +167 -0
- package/field/field.js.map +1 -0
- package/{divider/divider.styles.d.ts → field/field.styles.d.ts} +1 -1
- package/field/field.styles.d.ts.map +1 -0
- package/field/field.styles.js +289 -0
- package/field/field.styles.js.map +1 -0
- package/index.d.ts +35 -26
- package/index.d.ts.map +1 -1
- package/index.js +35 -26
- package/index.js.map +1 -1
- package/list/list-item.d.ts +13 -0
- package/list/list-item.d.ts.map +1 -0
- package/list/list-item.js +33 -0
- package/list/list-item.js.map +1 -0
- package/{container/grid-base.styles.d.ts → list/list-item.styles.d.ts} +1 -1
- package/list/list-item.styles.d.ts.map +1 -0
- package/list/list-item.styles.js +22 -0
- package/list/list-item.styles.js.map +1 -0
- package/list/list.d.ts +11 -0
- package/list/list.d.ts.map +1 -0
- package/{container/container.js → list/list.js} +9 -16
- package/list/list.js.map +1 -0
- package/{container/grid.styles.d.ts → list/list.styles.d.ts} +1 -1
- package/list/list.styles.d.ts.map +1 -0
- package/list/list.styles.js +7 -0
- package/list/list.styles.js.map +1 -0
- package/menu/menu-item.d.ts +2 -0
- package/menu/menu-item.d.ts.map +1 -1
- package/menu/menu-item.js +6 -1
- package/menu/menu-item.js.map +1 -1
- package/menu/menu.d.ts.map +1 -1
- package/menu/menu.js +8 -4
- package/menu/menu.js.map +1 -1
- package/navigation/drawer-item.d.ts +1 -0
- package/navigation/drawer-item.d.ts.map +1 -1
- package/navigation/drawer-item.js +5 -1
- package/navigation/drawer-item.js.map +1 -1
- package/navigation/drawer-item.styles.d.ts.map +1 -1
- package/navigation/drawer-item.styles.js +3 -0
- package/navigation/drawer-item.styles.js.map +1 -1
- package/navigation/drawer.styles.js +1 -1
- package/navigation/drawer.styles.js.map +1 -1
- package/package.json +3 -3
- package/radio/radio-list-item.d.ts +11 -0
- package/radio/radio-list-item.d.ts.map +1 -0
- package/radio/radio-list-item.js +16 -0
- package/radio/radio-list-item.js.map +1 -0
- package/radio/radio.d.ts +24 -0
- package/radio/radio.d.ts.map +1 -0
- package/radio/radio.js +136 -0
- package/radio/radio.js.map +1 -0
- package/radio/radio.styles.d.ts +2 -0
- package/radio/radio.styles.d.ts.map +1 -0
- package/radio/radio.styles.js +97 -0
- package/radio/radio.styles.js.map +1 -0
- package/ripple/ripple.styles.js +1 -1
- package/ripple/ripple.styles.js.map +1 -1
- package/scss/_colors.scss +2 -0
- package/scss/_css-vars.scss +26 -12
- package/scss/_functions.scss +4 -0
- package/scss/_global.scss +23 -0
- package/scss/_layout.scss +5 -0
- package/scss/_reboot.scss +495 -0
- package/scss/_utilities.scss +3 -0
- package/scss/_variables.scss +32 -4
- package/scss/{text-bg → colors}/_text.scss +1 -22
- package/scss/layout/_container.scss +13 -0
- package/scss/layout/_grid.scss +6 -0
- package/scss/layout/_margin-and-gutters.scss +37 -0
- package/scss/mixins/_breakpoints.scss +51 -1
- package/scss/mixins/_text-bg.scss +4 -6
- package/scss/mixins/_typo.scss +18 -0
- package/scss/table/_table.scss +47 -0
- package/scss/universal-material.scss +11 -4
- package/scss/utilities/_divider.scss +13 -0
- package/scss/utilities/_spacing.scss +23 -0
- package/scss/utilities/_text.scss +21 -0
- package/shared/base.styles.js +5 -5
- package/shared/base.styles.js.map +1 -1
- package/shared/button-wrapper.d.ts +2 -1
- package/shared/button-wrapper.d.ts.map +1 -1
- package/shared/button-wrapper.js +8 -2
- package/shared/button-wrapper.js.map +1 -1
- package/shared/button-wrapper.styles.js +2 -2
- package/shared/button-wrapper.styles.js.map +1 -1
- package/shared/selection-control/selection-control-list-item.d.ts +5 -0
- package/shared/selection-control/selection-control-list-item.d.ts.map +1 -0
- package/shared/selection-control/selection-control-list-item.js +25 -0
- package/shared/selection-control/selection-control-list-item.js.map +1 -0
- package/shared/selection-control/selection-control.d.ts +25 -0
- package/shared/selection-control/selection-control.d.ts.map +1 -0
- package/shared/selection-control/selection-control.js +93 -0
- package/shared/selection-control/selection-control.js.map +1 -0
- package/shared/selection-control/selection-control.styles.d.ts +2 -0
- package/shared/selection-control/selection-control.styles.d.ts.map +1 -0
- package/shared/selection-control/selection-control.styles.js +67 -0
- package/shared/selection-control/selection-control.styles.js.map +1 -0
- package/snackbar/snackbar.d.ts +1 -1
- package/snackbar/snackbar.d.ts.map +1 -1
- package/snackbar/snackbar.js +1 -1
- package/snackbar/snackbar.js.map +1 -1
- package/switch/switch-list-item.d.ts +11 -0
- package/switch/switch-list-item.d.ts.map +1 -0
- package/switch/switch-list-item.js +16 -0
- package/switch/switch-list-item.js.map +1 -0
- package/switch/switch.d.ts +14 -0
- package/switch/switch.d.ts.map +1 -0
- package/switch/switch.js +33 -0
- package/switch/switch.js.map +1 -0
- package/switch/switch.styles.d.ts +2 -0
- package/switch/switch.styles.d.ts.map +1 -0
- package/switch/switch.styles.js +142 -0
- package/switch/switch.styles.js.map +1 -0
- package/text-field/text-field.d.ts +23 -0
- package/text-field/text-field.d.ts.map +1 -0
- package/text-field/text-field.js +91 -0
- package/text-field/text-field.js.map +1 -0
- package/text-field/text-field.styles.d.ts +2 -0
- package/text-field/text-field.styles.d.ts.map +1 -0
- package/text-field/text-field.styles.js +5 -0
- package/text-field/text-field.styles.js.map +1 -0
- package/theme/index.d.ts +1 -1
- package/theme/index.d.ts.map +1 -1
- package/theme/index.js +1 -1
- package/theme/index.js.map +1 -1
- package/theme/theme-builder.d.ts.map +1 -1
- package/theme/theme-builder.js +3 -1
- package/theme/theme-builder.js.map +1 -1
- package/container/container.d.ts +0 -12
- package/container/container.d.ts.map +0 -1
- package/container/container.js.map +0 -1
- package/container/container.styles.d.ts.map +0 -1
- package/container/container.styles.js +0 -12
- package/container/container.styles.js.map +0 -1
- package/container/grid-base.d.ts +0 -11
- package/container/grid-base.d.ts.map +0 -1
- package/container/grid-base.js +0 -33
- package/container/grid-base.js.map +0 -1
- package/container/grid-base.styles.d.ts.map +0 -1
- package/container/grid-base.styles.js +0 -114
- package/container/grid-base.styles.js.map +0 -1
- package/container/grid.d.ts +0 -32
- package/container/grid.d.ts.map +0 -1
- package/container/grid.js +0 -106
- package/container/grid.js.map +0 -1
- package/container/grid.styles.d.ts.map +0 -1
- package/container/grid.styles.js +0 -134
- package/container/grid.styles.js.map +0 -1
- package/divider/divider.d.ts +0 -14
- package/divider/divider.d.ts.map +0 -1
- package/divider/divider.js +0 -27
- package/divider/divider.js.map +0 -1
- package/divider/divider.styles.d.ts.map +0 -1
- package/divider/divider.styles.js +0 -15
- package/divider/divider.styles.js.map +0 -1
- package/scss/_common.scss +0 -12
- package/scss/data-table/_data-table.scss +0 -33
- package/scss/data-table/_variables.scss +0 -24
- /package/scss/{text-bg → colors}/_text-bg.scss +0 -0
|
@@ -1,10 +1,29 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
1
3
|
@use "../variables";
|
|
2
4
|
|
|
5
|
+
@function breakpoint-next($name) {
|
|
6
|
+
$breakpoint-names: map.keys(variables.$breakpoints);
|
|
7
|
+
|
|
8
|
+
$n: index($breakpoint-names, $name);
|
|
9
|
+
|
|
10
|
+
@if not $n {
|
|
11
|
+
@return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
@function breakpoint-min($name) {
|
|
4
|
-
$min: map
|
|
18
|
+
$min: map.get(variables.$breakpoints, $name);
|
|
5
19
|
@return if($min != 0, $min, null);
|
|
6
20
|
}
|
|
7
21
|
|
|
22
|
+
@function breakpoint-max($name) {
|
|
23
|
+
$next: breakpoint-next($name);
|
|
24
|
+
@return if($next, breakpoint-min($next) - .02px, null);
|
|
25
|
+
}
|
|
26
|
+
|
|
8
27
|
@function breakpoint-infix($name) {
|
|
9
28
|
@return if(breakpoint-min($name) == null, "", "-#{$name}");
|
|
10
29
|
}
|
|
@@ -19,3 +38,34 @@
|
|
|
19
38
|
@content;
|
|
20
39
|
}
|
|
21
40
|
}
|
|
41
|
+
|
|
42
|
+
@mixin media-breakpoint-down($name) {
|
|
43
|
+
$max: breakpoint-max($name);
|
|
44
|
+
@if $max {
|
|
45
|
+
@media (max-width: $max) {
|
|
46
|
+
@content;
|
|
47
|
+
}
|
|
48
|
+
} @else {
|
|
49
|
+
@content;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@mixin media-breakpoint-only($name) {
|
|
54
|
+
$min: breakpoint-min($name);
|
|
55
|
+
$next: breakpoint-next($name);
|
|
56
|
+
$max: breakpoint-min($next);
|
|
57
|
+
|
|
58
|
+
@if $min != null and $max != null {
|
|
59
|
+
@media (min-width: $min) and (max-width: $max) {
|
|
60
|
+
@content;
|
|
61
|
+
}
|
|
62
|
+
} @else if $max == null {
|
|
63
|
+
@include media-breakpoint-up($name) {
|
|
64
|
+
@content;
|
|
65
|
+
}
|
|
66
|
+
} @else if $min == null {
|
|
67
|
+
@include media-breakpoint-down($name) {
|
|
68
|
+
@content;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
@use "sass:string";
|
|
2
2
|
|
|
3
|
-
@mixin _current-color-vars-important($current-color-
|
|
4
|
-
--u-current-text-color
|
|
3
|
+
@mixin _current-color-vars-important($current-color-var-name) {
|
|
4
|
+
--u-current-text-color: var(#{$current-color-var-name}) !important;
|
|
5
|
+
--u-current-text-color-rgb: var(#{$current-color-var-name}-rgb) !important;
|
|
5
6
|
--u-text-opacity: 1;
|
|
6
7
|
color: rgba(var(--u-current-text-color-rgb), var(--u-text-opacity)) !important;
|
|
7
8
|
}
|
|
@@ -24,10 +25,7 @@
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.u-text-bg-#{$color-name} {
|
|
27
|
-
@include _current-color-vars-important(
|
|
28
|
+
@include _current-color-vars-important(--u-color-#{$on-color-name});
|
|
28
29
|
background-color: var(--u-color-#{$color-name}) !important;
|
|
29
|
-
|
|
30
|
-
--u-divider-color: rgb(var(--u-current-text-color-rgb)) !important;
|
|
31
|
-
--u-divider-opacity: .4 !important;
|
|
32
30
|
}
|
|
33
31
|
}
|
package/scss/mixins/_typo.scss
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
font-family: var(--u-font-family, #{functions.get-font-family-var()});
|
|
13
13
|
} @else {
|
|
14
14
|
font-family: var(--u-font-family);
|
|
15
|
+
color: rgba(var(--u-current-text-color-rgb), var(--u-text-opacity));
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
$props: map.get(variables.$typography-styles, $style);
|
|
@@ -24,3 +25,20 @@
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@mixin typo-prop($style, $prop, $target-name: null) {
|
|
31
|
+
@if not map.has-key(variables.$typography-styles, $style) {
|
|
32
|
+
@error "Invalid style specified! #{$style} doesn't exist. Choose one of #{map.keys(variables.$typography-styles)}";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
$props: map.get(variables.$typography-styles, $style);
|
|
36
|
+
|
|
37
|
+
$value: map.get($props, $prop);
|
|
38
|
+
|
|
39
|
+
@if $target-name != null {
|
|
40
|
+
#{$prop}: var(--u-#{$target-name}-#{$prop}, var(--u-#{$style}-#{$prop}, #{$value}));
|
|
41
|
+
} @else {
|
|
42
|
+
#{$prop}: var(--u-#{$style}-#{$prop});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use "../functions";
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--u-table-hover-opacity: var(--u-state-layer-hover-opacity);
|
|
5
|
+
--u-table-cell-padding: 13px 16px;
|
|
6
|
+
--u-table-cell-font-weight: #{functions.get-font-weight-var(medium)};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.u-table {
|
|
10
|
+
min-width: 100%;
|
|
11
|
+
border-collapse: collapse;
|
|
12
|
+
font-family: var(--u-font-family, #{functions.get-font-family-var()});
|
|
13
|
+
|
|
14
|
+
> tbody > tr,
|
|
15
|
+
> thead > tr,
|
|
16
|
+
> tfoot > tr,
|
|
17
|
+
> tr {
|
|
18
|
+
&:not(:first-child) {
|
|
19
|
+
border-top: 1px solid rgba(var(--u-current-text-color-rgb), var(--u-table-divider-opacity, .2));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
> td {
|
|
23
|
+
padding: var(--u-td-padding, var(--u-table-cell-padding));
|
|
24
|
+
font-size: var(--u-td-font-size, .875rem);
|
|
25
|
+
font-weight: var(--u-td-font-weight, var(--u-table-cell-font-weight));
|
|
26
|
+
text-align: start;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
> th {
|
|
30
|
+
--u-text-opacity: var(--u-low-emphasis-opacity);
|
|
31
|
+
padding: var(--u-th-padding, var(--u-table-cell-padding));
|
|
32
|
+
font-size: var(--u-th-font-size, .8125rem);
|
|
33
|
+
font-weight: var(--u-th-font-weight, var(--u-table-cell-font-weight));
|
|
34
|
+
color: rgba(var(--u-current-text-color-rgb), var(--u-text-opacity));
|
|
35
|
+
text-align: start;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.u-table-hover {
|
|
41
|
+
> tbody > tr,
|
|
42
|
+
> tr {
|
|
43
|
+
&:hover {
|
|
44
|
+
background-color: rgba(var(--u-current-text-color-rgb), var(--u-table-hover-opacity));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
@import "variables";
|
|
1
2
|
@import "css-vars";
|
|
2
|
-
@import "
|
|
3
|
-
@import "
|
|
4
|
-
@import "
|
|
5
|
-
@import "
|
|
3
|
+
@import "colors";
|
|
4
|
+
@import "layout";
|
|
5
|
+
@import "utilities";
|
|
6
|
+
@import "table/table";
|
|
6
7
|
@import "typo/font";
|
|
7
8
|
@import "typo/typo";
|
|
9
|
+
|
|
10
|
+
@import "reboot";
|
|
11
|
+
|
|
12
|
+
@if $include-reboot {
|
|
13
|
+
@include reboot;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@use "../api";
|
|
2
|
+
|
|
3
|
+
.u-divider,
|
|
4
|
+
.u-divider-no-margin {
|
|
5
|
+
display: block;
|
|
6
|
+
height: var(--u-divider-thickness, 1px);
|
|
7
|
+
background-color: var(--u-divider-color, var(--u-current-text-color));
|
|
8
|
+
opacity: var(--u-divider-opacity, .4);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.u-divider {
|
|
12
|
+
margin-block: 8px;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
@use "sass:map";
|
|
3
|
+
|
|
4
|
+
@use "../variables";
|
|
5
|
+
@use "../api";
|
|
6
|
+
|
|
7
|
+
@each $breakpoint in map.keys(variables.$breakpoints) {
|
|
8
|
+
$infix: api.breakpoint-infix($breakpoint);
|
|
9
|
+
|
|
10
|
+
@each $spacing in map.keys(variables.$spacings) {
|
|
11
|
+
@each $side, $value in variables.$spacing-sides {
|
|
12
|
+
@include api.media-breakpoint-up($breakpoint) {
|
|
13
|
+
.u-m#{$side}#{$infix}-#{$spacing} {
|
|
14
|
+
margin#{$value}: var(--u-spacing-#{$spacing});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.u-p#{$side}#{$infix}-#{$spacing} {
|
|
18
|
+
padding#{$value}: var(--u-spacing-#{$spacing});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@use "../variables";
|
|
2
|
+
|
|
3
|
+
.u-text-high-emphasis {
|
|
4
|
+
--u-text-opacity: var(--u-high-emphasis-opacity);
|
|
5
|
+
color: rgba(var(--u-current-text-color-rgb), var(--u-text-opacity)) !important;
|
|
6
|
+
}
|
|
7
|
+
.u-text-low-emphasis {
|
|
8
|
+
--u-text-opacity: var(--u-low-emphasis-opacity);
|
|
9
|
+
color: rgba(var(--u-current-text-color-rgb), var(--u-text-opacity)) !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.u-text-lower-emphasis {
|
|
13
|
+
--u-text-opacity: var(--u-lower-emphasis-opacity);
|
|
14
|
+
color: rgba(var(--u-current-text-color-rgb), var(--u-text-opacity)) !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@each $weight, $value in variables.$font-weights {
|
|
18
|
+
.u-font-weight-#{$weight} {
|
|
19
|
+
font-weight: var(--u-font-weight-#{$weight}) !important;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/shared/base.styles.js
CHANGED
|
@@ -7,21 +7,21 @@ export const styles = css `
|
|
|
7
7
|
outline: 0;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
animation: u-focus-pulse
|
|
10
|
+
.focus-ring:focus-visible {
|
|
11
|
+
animation: u-focus-pulse 500ms ease;
|
|
12
12
|
animation-fill-mode: forwards;
|
|
13
13
|
outline-offset: 2px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
@keyframes u-focus-pulse {
|
|
17
17
|
0% {
|
|
18
|
-
outline:
|
|
18
|
+
outline: 0 solid var(--u-color-primary);
|
|
19
19
|
}
|
|
20
20
|
50% {
|
|
21
|
-
outline:
|
|
21
|
+
outline: 6px solid var(--u-color-primary);
|
|
22
22
|
}
|
|
23
23
|
100% {
|
|
24
|
-
outline:
|
|
24
|
+
outline: 4px solid var(--u-color-primary);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.styles.js","sourceRoot":"","sources":["../../src/shared/base.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host,\n * {\n font-family: var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");\n box-sizing: border-box;\n outline: 0;\n }\n\n
|
|
1
|
+
{"version":3,"file":"base.styles.js","sourceRoot":"","sources":["../../src/shared/base.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host,\n * {\n font-family: var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");\n box-sizing: border-box;\n outline: 0;\n }\n\n .focus-ring:focus-visible {\n animation: u-focus-pulse 500ms ease;\n animation-fill-mode: forwards;\n outline-offset: 2px;\n }\n\n @keyframes u-focus-pulse {\n 0% {\n outline: 0 solid var(--u-color-primary);\n }\n 50% {\n outline: 6px solid var(--u-color-primary);\n }\n 100% {\n outline: 4px solid var(--u-color-primary);\n }\n }\n`;\n"]}
|
|
@@ -18,8 +18,9 @@ export declare abstract class UmButtonWrapper extends LitElement {
|
|
|
18
18
|
name: string | undefined;
|
|
19
19
|
private readonly buttonElement;
|
|
20
20
|
private readonly ripple;
|
|
21
|
+
protected innerRole: string | null;
|
|
21
22
|
get pathname(): string;
|
|
22
|
-
protected render():
|
|
23
|
+
protected render(): HTMLTemplateResult;
|
|
23
24
|
private renderButton;
|
|
24
25
|
private renderLink;
|
|
25
26
|
protected abstract renderContent(): HTMLTemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-wrapper.d.ts","sourceRoot":"","sources":["../../src/shared/button-wrapper.ts"],"names":[],"mappings":"AAAA,OAA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IAAI,kBAAkB;IAE7C,iBAAiB;IAOjB,oBAAoB;IAOpB,KAAK;IAIL,IAAI;IAKb,SAAS,CAAC,YAAY,IAAI,MAAM,GAAG,IAAI,GAAG,OAAO,OAAO;IAKxD,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,iBAAiB;IAazB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI;CAGxC"}
|
package/shared/button-wrapper.js
CHANGED
|
@@ -15,6 +15,7 @@ export class UmButtonWrapper extends LitElement {
|
|
|
15
15
|
* Whether the button is disabled or not.
|
|
16
16
|
*/
|
|
17
17
|
this.disabled = false;
|
|
18
|
+
this.innerRole = null;
|
|
18
19
|
}
|
|
19
20
|
get pathname() {
|
|
20
21
|
return this.buttonElement?.pathname;
|
|
@@ -30,7 +31,9 @@ export class UmButtonWrapper extends LitElement {
|
|
|
30
31
|
id="button"
|
|
31
32
|
class="button"
|
|
32
33
|
?disabled=${this.disabled}
|
|
33
|
-
aria-label
|
|
34
|
+
aria-label=${this.ariaLabel || nothing}
|
|
35
|
+
aria-labelledby="${this.ariaLabel ? nothing : 'text'}"
|
|
36
|
+
.role=${this.innerRole}
|
|
34
37
|
type="button">
|
|
35
38
|
<u-ripple ?disabled=${this.disabled}></u-ripple>
|
|
36
39
|
<u-elevation></u-elevation>
|
|
@@ -43,7 +46,9 @@ export class UmButtonWrapper extends LitElement {
|
|
|
43
46
|
class="button"
|
|
44
47
|
href=${this.disabled ? nothing : this.href}
|
|
45
48
|
aria-disabled=${this.disabled || nothing}
|
|
46
|
-
aria-label
|
|
49
|
+
aria-label=${this.ariaLabel || nothing}
|
|
50
|
+
aria-labelledby="${this.ariaLabel ? nothing : 'text'}"
|
|
51
|
+
.role=${this.innerRole}
|
|
47
52
|
target=${this.target || nothing}>
|
|
48
53
|
<u-elevation></u-elevation>
|
|
49
54
|
<u-ripple ?disabled=${this.disabled}></u-ripple>
|
|
@@ -67,6 +72,7 @@ export class UmButtonWrapper extends LitElement {
|
|
|
67
72
|
this.buttonElement?.blur();
|
|
68
73
|
}
|
|
69
74
|
getAriaLabel() {
|
|
75
|
+
console.log(this.ariaLabel);
|
|
70
76
|
return this.ariaLabel || nothing;
|
|
71
77
|
}
|
|
72
78
|
innerFocusHandler() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-wrapper.js","sourceRoot":"","sources":["../../src/shared/button-wrapper.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC;AAG7B,MAAM,OAAgB,eAAgB,SAAQ,UAAU;IAAxD;;QAEE;;WAEG;QACuC,aAAQ,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"button-wrapper.js","sourceRoot":"","sources":["../../src/shared/button-wrapper.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC;AAG7B,MAAM,OAAgB,eAAgB,SAAQ,UAAU;IAAxD;;QAEE;;WAEG;QACuC,aAAQ,GAAG,KAAK,CAAC;QAkBjD,cAAS,GAAkB,IAAI,CAAC;IAsG5C,CAAC;IApGC,IAAI,QAAQ;QACV,OAA2B,IAAI,CAAC,aAAc,EAAE,QAAQ,CAAA;IAC1D,CAAC;IAEkB,MAAM;QACvB,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;YAClC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE;YACnB,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC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IAC9B,CAAC;IAEQ,IAAI;QAEX,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAES,YAAY;QACpB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC;IACnC,CAAC;IAEO,iBAAiB;QACvB,MAAM,sBAAsB,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,sBAAsB,KAAK,GAAG,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QACjC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAEO,iBAAiB,CAAC,KAAiB;QAEzC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,IAAI,CAAgB,KAAM,CAAC,WAAW,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAES,WAAW,CAAC,CAAU;IAEhC,CAAC;CACF;AAxH2C;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;iDAAkB;AAK/C;IAAX,QAAQ,EAAE;6CAA0B;AAMzB;IAAX,QAAQ,EAAE;+CAA4B;AAE3B;IAAX,QAAQ,EAAE;6CAA0B;AAEF;IAAlC,KAAK,CAAC,SAAS,CAAC;sDAA8C;AAC3B;IAAnC,KAAK,CAAC,UAAU,CAAC;+CAAoC","sourcesContent":["import { html, HTMLTemplateResult, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\n\nimport '../elevation/elevation.js';\nimport '../ripple/ripple.js';\nimport { UmRipple } from '../ripple/ripple.js';\n\nexport abstract class UmButtonWrapper extends LitElement {\n\n /**\n * Whether the button is disabled or not.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href: string | undefined;\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: string | undefined;\n\n @property() name: string | undefined;\n\n @query('.button') private readonly buttonElement!: HTMLElement;\n @query('u-ripple') private readonly ripple!: UmRipple;\n\n protected innerRole: string | null = null;\n\n get pathname(): string {\n return (<HTMLAnchorElement>this.buttonElement)?.pathname\n }\n\n protected override render(): HTMLTemplateResult {\n return typeof this.href === 'string'\n ? this.renderLink()\n : this.renderButton();\n }\n\n private renderButton() {\n return html`\n <button\n id=\"button\"\n class=\"button\"\n ?disabled=${this.disabled}\n aria-label=${this.ariaLabel || nothing}\n aria-labelledby=\"${this.ariaLabel ? nothing : 'text'}\"\n .role=${this.innerRole}\n type=\"button\">\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n <u-elevation></u-elevation>\n </button>\n <div class=\"content\">${this.renderContent()}</div>`;\n\n }\n\n private renderLink() {\n return html`<a\n id=\"link\"\n class=\"button\"\n href=${this.disabled ? nothing : this.href}\n aria-disabled=${this.disabled || nothing}\n aria-label=${this.ariaLabel || nothing}\n aria-labelledby=\"${this.ariaLabel ? nothing : 'text'}\"\n .role=${this.innerRole}\n target=${this.target || nothing}>\n <u-elevation></u-elevation>\n <u-ripple ?disabled=${this.disabled}></u-ripple>\n </a>\n <div class=\"content\">${this.renderContent()}</div>`;\n }\n\n protected abstract renderContent(): HTMLTemplateResult;\n\n override connectedCallback() {\n super.connectedCallback();\n\n this.addEventListener('click', this.innerClickHandler);\n this.addEventListener('focus', this.innerFocusHandler)\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.removeEventListener('click', this.innerClickHandler);\n this.removeEventListener('focus', this.innerFocusHandler);\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n\n this.buttonElement?.blur();\n }\n\n protected getAriaLabel(): string | null | typeof nothing {\n console.log(this.ariaLabel);\n return this.ariaLabel || nothing;\n }\n\n private innerFocusHandler(): void {\n const tabIndexAttributeValue = this.getAttribute('tabindex');\n\n if (tabIndexAttributeValue !== \"0\") {\n return;\n }\n \n this.removeAttribute('tabindex');\n setTimeout(() => this.buttonElement?.focus());\n }\n\n private innerClickHandler(event: MouseEvent): void {\n\n if (this.disabled) {\n return;\n }\n\n if (!(<PointerEvent>event).pointerType) {\n this.ripple.createRipple();\n }\n\n this.handleClick(event);\n }\n\n protected handleClick(_: UIEvent): void {\n\n }\n}\n"]}
|
|
@@ -12,8 +12,8 @@ export const styles = css `
|
|
|
12
12
|
|
|
13
13
|
:host([disabled]) {
|
|
14
14
|
--u-elevation-level: 0 !important;
|
|
15
|
-
background-color: var(--u-button-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), 0.12)) !important;
|
|
16
|
-
color: var(--u-button-disabled-text-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), 0.38)) !important;
|
|
15
|
+
background-color: var(--u-button-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-button-disabled-background-opacity, 0.12))) !important;
|
|
16
|
+
color: var(--u-button-disabled-text-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-button-disabled-color, 0.38))) !important;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
:host([disabled]) .button {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-wrapper.styles.js","sourceRoot":"","sources":["../../src/shared/button-wrapper.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_color-primary: var(--u-color-primary, rgb(103, 80, 164));\n -webkit-tap-highlight-color: transparent;\n --u-elevation-level: 0;\n position: relative;\n display: inline-block;\n font-family: var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");\n appearance: none !important;\n }\n\n :host([disabled]) {\n --u-elevation-level: 0 !important;\n background-color: var(--u-button-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), 0.12)) !important;\n color: var(--u-button-disabled-text-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), 0.38)) !important;\n }\n\n :host([disabled]) .button {\n cursor: default;\n }\n\n * {\n color: inherit;\n }\n\n u-elevation {\n z-index: -1;\n }\n\n .button {\n cursor: pointer;\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n font-family: inherit;\n border-radius: inherit;\n color: inherit;\n border: none;\n margin: 0;\n padding: 0;\n text-align: center;\n white-space: nowrap;\n background: transparent;\n user-select: none;\n text-decoration: none;\n outline: 0;\n z-index: 0;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n width: 100%;\n height: 100%;\n }\n\n .button:focus-visible {\n animation: offset-pulse 400ms ease;\n animation-fill-mode: forwards;\n outline-offset: 2px;\n }\n\n .icon {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 1em;\n height: 1em;\n line-height: 1em;\n }\n\n ::slotted([slot=icon]) {\n display: inline-block;\n }\n\n @keyframes offset-pulse {\n 0% {\n outline: 4px solid var(--_color-primary);\n }\n 50% {\n outline: 8px solid var(--_color-primary);\n }\n 100% {\n outline: 4px solid var(--_color-primary);\n }\n }\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"button-wrapper.styles.js","sourceRoot":"","sources":["../../src/shared/button-wrapper.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_color-primary: var(--u-color-primary, rgb(103, 80, 164));\n -webkit-tap-highlight-color: transparent;\n --u-elevation-level: 0;\n position: relative;\n display: inline-block;\n font-family: var(--u-font-family, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"Noto Sans\", \"Liberation Sans\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");\n appearance: none !important;\n }\n\n :host([disabled]) {\n --u-elevation-level: 0 !important;\n background-color: var(--u-button-disabled-background-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-button-disabled-background-opacity, 0.12))) !important;\n color: var(--u-button-disabled-text-color, rgba(var(--u-color-on-surface-rgb, 29, 27, 32), var(--u-button-disabled-color, 0.38))) !important;\n }\n\n :host([disabled]) .button {\n cursor: default;\n }\n\n * {\n color: inherit;\n }\n\n u-elevation {\n z-index: -1;\n }\n\n .button {\n cursor: pointer;\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n font-family: inherit;\n border-radius: inherit;\n color: inherit;\n border: none;\n margin: 0;\n padding: 0;\n text-align: center;\n white-space: nowrap;\n background: transparent;\n user-select: none;\n text-decoration: none;\n outline: 0;\n z-index: 0;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n white-space: nowrap;\n width: 100%;\n height: 100%;\n }\n\n .button:focus-visible {\n animation: offset-pulse 400ms ease;\n animation-fill-mode: forwards;\n outline-offset: 2px;\n }\n\n .icon {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 1em;\n height: 1em;\n line-height: 1em;\n }\n\n ::slotted([slot=icon]) {\n display: inline-block;\n }\n\n @keyframes offset-pulse {\n 0% {\n outline: 4px solid var(--_color-primary);\n }\n 50% {\n outline: 8px solid var(--_color-primary);\n }\n 100% {\n outline: 4px solid var(--_color-primary);\n }\n }\n`;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UmSelectionControl } from './selection-control.js';
|
|
2
|
+
export type MixinBase<ExpectedBase = object> = abstract new (...args: any[]) => ExpectedBase;
|
|
3
|
+
export type MixinReturn<MixinBase, MixinClass = object> = (abstract new (...args: any[]) => MixinClass) & MixinBase;
|
|
4
|
+
export declare const mixinSelectionControlListItem: <T extends MixinBase<UmSelectionControl>>(base: T) => MixinReturn<T, object>;
|
|
5
|
+
//# sourceMappingURL=selection-control-list-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-control-list-item.d.ts","sourceRoot":"","sources":["../../../src/shared/selection-control/selection-control-list-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,SAAS,CAAC,YAAY,GAAG,MAAM,IAAI,QAAQ,MAGrD,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,YAAY,CAAC;AAElB,MAAM,MAAM,WAAW,CAAC,SAAS,EAAE,UAAU,GAAG,MAAM,IAGpD,CAAC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,CAAC,GAAG,SAAS,CAAC;AAG5D,eAAO,MAAM,6BAA6B,8EAuBzC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css, html } from 'lit';
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
export const mixinSelectionControlListItem = (base) => {
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
class SelectionControlListItem extends base {
|
|
6
|
+
render() {
|
|
7
|
+
return html `
|
|
8
|
+
<u-list-item ?selectable=${!this.disabled}>
|
|
9
|
+
<slot></slot>
|
|
10
|
+
<div slot="trailing">
|
|
11
|
+
${super.render()}
|
|
12
|
+
</div>
|
|
13
|
+
</u-list-item>`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
SelectionControlListItem.styles = [
|
|
17
|
+
base.styles ?? [],
|
|
18
|
+
css `:host {
|
|
19
|
+
--u-list-item-block-padding: 0;
|
|
20
|
+
display: block;
|
|
21
|
+
}`
|
|
22
|
+
];
|
|
23
|
+
return SelectionControlListItem;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=selection-control-list-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-control-list-item.js","sourceRoot":"","sources":["../../../src/shared/selection-control/selection-control-list-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAC;AAehE,aAAa;AACb,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAA0C,IAAO,EAAkB,EAAE;IAChH,aAAa;IACb,MAAe,wBAAyB,SAAQ,IAAI;QASzC,MAAM;YACb,OAAO,IAAI,CAAA;mCACkB,CAAC,IAAI,CAAC,QAAQ;;;cAGnC,KAAK,CAAC,MAAM,EAAE;;uBAEL,CAAC;QACpB,CAAC;;IAhBM,+BAAM,GAAG;QACb,IAAqC,CAAC,MAAM,IAAI,EAAE;QACnD,GAAG,CAAA;;;QAGD;KACH,CAAC;IAaJ,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAA","sourcesContent":["import { css, html, HTMLTemplateResult, LitElement } from 'lit';\n\nimport { UmSelectionControl } from './selection-control.js';\n\nexport type MixinBase<ExpectedBase = object> = abstract new (\n // Mixins must have a constructor with `...args: any[]`\n // @ts-ignore\n ...args: any[]\n) => ExpectedBase;\n\nexport type MixinReturn<MixinBase, MixinClass = object> =\n// Mixins must have a constructor with `...args: any[]`\n// tslint:disable-next-line:no-any\n (abstract new (...args: any[]) => MixinClass) & MixinBase;\n\n// @ts-ignore\nexport const mixinSelectionControlListItem = <T extends MixinBase<UmSelectionControl>>(base: T): MixinReturn<T> => {\n // @ts-ignore\n abstract class SelectionControlListItem extends base {\n static styles = [\n (base as unknown as typeof LitElement).styles ?? [],\n css`:host {\n --u-list-item-block-padding: 0;\n display: block;\n }`\n ];\n\n override render(): HTMLTemplateResult {\n return html`\n <u-list-item ?selectable=${!this.disabled}>\n <slot></slot>\n <div slot=\"trailing\">\n ${super.render()}\n </div>\n </u-list-item>`;\n }\n }\n\n return SelectionControlListItem;\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HTMLTemplateResult, LitElement } from 'lit';
|
|
2
|
+
import '../../ripple/ripple.js';
|
|
3
|
+
export declare abstract class UmSelectionControl extends LitElement {
|
|
4
|
+
#private;
|
|
5
|
+
static readonly formAssociated = true;
|
|
6
|
+
protected readonly elementInternals: ElementInternals;
|
|
7
|
+
name: string | undefined;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
input: HTMLInputElement;
|
|
10
|
+
get form(): HTMLFormElement | null;
|
|
11
|
+
protected inputType: 'checkbox' | 'radio';
|
|
12
|
+
protected renderRipple: boolean;
|
|
13
|
+
protected abstract renderIndicator(): HTMLTemplateResult;
|
|
14
|
+
/**
|
|
15
|
+
* The element value to use in form submission when checked.
|
|
16
|
+
*/
|
|
17
|
+
value: string;
|
|
18
|
+
get checked(): boolean;
|
|
19
|
+
set checked(value: boolean);
|
|
20
|
+
protected constructor();
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
protected render(): HTMLTemplateResult;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=selection-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-control.d.ts","sourceRoot":"","sources":["../../../src/shared/selection-control/selection-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,UAAU,EAAW,MAAM,KAAK,CAAC;AAGpE,OAAO,wBAAwB,CAAC;AAEhC,8BAAsB,kBAAmB,SAAQ,UAAU;;IACzD,MAAM,CAAC,QAAQ,CAAC,cAAc,QAAQ;IAEtC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAE1C,IAAI,EAAE,MAAM,GAAG,SAAS,CAAM;IACA,QAAQ,UAAS;IAC3C,KAAK,EAAG,gBAAgB,CAAC;IAKzC,IAAI,IAAI,IAAI,eAAe,GAAG,IAAI,CAEjC;IAGD,SAAS,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAc;IACvD,SAAS,CAAC,YAAY,UAAQ;IAE9B,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,kBAAkB;IAExD;;OAEG;IACS,KAAK,SAAQ;IAEzB,IACI,OAAO,IAGQ,OAAO,CADzB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAIzB;IAED,SAAS;IAKA,iBAAiB;IAKjB,oBAAoB;cAKV,MAAM,IAAI,kBAAkB;CAoBhD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _UmSelectionControl_instances, _UmSelectionControl_checked, _UmSelectionControl_handleClick;
|
|
19
|
+
import { html, LitElement, nothing } from 'lit';
|
|
20
|
+
import { property, query } from 'lit/decorators.js';
|
|
21
|
+
import '../../ripple/ripple.js';
|
|
22
|
+
export class UmSelectionControl extends LitElement {
|
|
23
|
+
// eslint-disable-next-line
|
|
24
|
+
// #value: any = '';
|
|
25
|
+
get form() {
|
|
26
|
+
return this.elementInternals.form;
|
|
27
|
+
}
|
|
28
|
+
get checked() {
|
|
29
|
+
return __classPrivateFieldGet(this, _UmSelectionControl_checked, "f");
|
|
30
|
+
}
|
|
31
|
+
set checked(value) {
|
|
32
|
+
console.log(value);
|
|
33
|
+
__classPrivateFieldSet(this, _UmSelectionControl_checked, value, "f");
|
|
34
|
+
this.elementInternals.setFormValue(value ? this.value : null);
|
|
35
|
+
}
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
_UmSelectionControl_instances.add(this);
|
|
39
|
+
this.name = '';
|
|
40
|
+
this.disabled = false;
|
|
41
|
+
_UmSelectionControl_checked.set(this, false);
|
|
42
|
+
this.inputType = 'checkbox';
|
|
43
|
+
this.renderRipple = true;
|
|
44
|
+
/**
|
|
45
|
+
* The element value to use in form submission when checked.
|
|
46
|
+
*/
|
|
47
|
+
this.value = 'on';
|
|
48
|
+
this.elementInternals = this.attachInternals();
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
51
|
+
super.connectedCallback();
|
|
52
|
+
this.addEventListener('click', __classPrivateFieldGet(this, _UmSelectionControl_instances, "m", _UmSelectionControl_handleClick));
|
|
53
|
+
}
|
|
54
|
+
disconnectedCallback() {
|
|
55
|
+
super.disconnectedCallback();
|
|
56
|
+
this.removeEventListener('click', __classPrivateFieldGet(this, _UmSelectionControl_instances, "m", _UmSelectionControl_handleClick));
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
const ripple = html `<u-ripple ?disabled=${this.disabled}></u-ripple>`;
|
|
60
|
+
return html `
|
|
61
|
+
<div class="container">
|
|
62
|
+
${this.renderRipple ? ripple : nothing}
|
|
63
|
+
<input
|
|
64
|
+
type=${this.inputType}
|
|
65
|
+
class="focus-ring"
|
|
66
|
+
?name=${this.name}
|
|
67
|
+
.checked=${__classPrivateFieldGet(this, _UmSelectionControl_checked, "f")}
|
|
68
|
+
.disabled=${this.disabled} />
|
|
69
|
+
<div class="indicator-container">${this.renderIndicator()}</div>
|
|
70
|
+
</div>`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_UmSelectionControl_checked = new WeakMap(), _UmSelectionControl_instances = new WeakSet(), _UmSelectionControl_handleClick = function _UmSelectionControl_handleClick() {
|
|
74
|
+
this.checked = this.inputType === 'radio' || !this.checked;
|
|
75
|
+
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
76
|
+
};
|
|
77
|
+
UmSelectionControl.formAssociated = true;
|
|
78
|
+
__decorate([
|
|
79
|
+
property()
|
|
80
|
+
], UmSelectionControl.prototype, "name", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: Boolean, reflect: true })
|
|
83
|
+
], UmSelectionControl.prototype, "disabled", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
query('input')
|
|
86
|
+
], UmSelectionControl.prototype, "input", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property()
|
|
89
|
+
], UmSelectionControl.prototype, "value", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: Boolean })
|
|
92
|
+
], UmSelectionControl.prototype, "checked", null);
|
|
93
|
+
//# sourceMappingURL=selection-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-control.js","sourceRoot":"","sources":["../../../src/shared/selection-control/selection-control.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAsB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,wBAAwB,CAAC;AAEhC,MAAM,OAAgB,kBAAmB,SAAQ,UAAU;IASzD,2BAA2B;IAC3B,oBAAoB;IAEpB,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;IACpC,CAAC;IAcD,IAAI,OAAO;QACT,OAAO,uBAAA,IAAI,mCAAS,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,CAAC,KAAc;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,uBAAA,IAAI,+BAAY,KAAK,MAAA,CAAC;QACtB,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAED;QACE,KAAK,EAAE,CAAC;;QAjCE,SAAI,GAAuB,EAAE,CAAC;QACA,aAAQ,GAAG,KAAK,CAAC;QAU3D,sCAAW,KAAK,EAAC;Q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AAC,OAAO,CAAC;iDAA0B;AAkB7B;IAAX,QAAQ,EAAE;iDAAc;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAGzB","sourcesContent":["import { html, HTMLTemplateResult, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\n\nimport '../../ripple/ripple.js';\n\nexport abstract class UmSelectionControl extends LitElement {\n static readonly formAssociated = true;\n\n protected readonly elementInternals: ElementInternals;\n\n @property() name: string | undefined = '';\n @property({type: Boolean, reflect: true}) disabled = false;\n @query('input') input!: HTMLInputElement;\n\n // eslint-disable-next-line\n // #value: any = '';\n\n get form(): HTMLFormElement | null {\n return this.elementInternals.form;\n }\n\n #checked = false;\n protected inputType: 'checkbox' | 'radio' = 'checkbox';\n protected renderRipple = true;\n\n protected abstract renderIndicator(): HTMLTemplateResult;\n\n /**\n * The element value to use in form submission when checked.\n */\n @property() value = 'on';\n\n @property({type: Boolean})\n get checked() {\n return this.#checked;\n }\n set checked(value: boolean) {\n console.log(value);\n this.#checked = value;\n this.elementInternals.setFormValue(value ? this.value : null);\n }\n\n protected constructor() {\n super();\n this.elementInternals = this.attachInternals();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.#handleClick);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.#handleClick)\n }\n\n protected override render(): HTMLTemplateResult {\n const ripple = html`<u-ripple ?disabled=${this.disabled}></u-ripple>`;\n\n return html`\n <div class=\"container\">\n ${this.renderRipple ? ripple : nothing}\n <input\n type=${this.inputType}\n class=\"focus-ring\"\n ?name=${this.name}\n .checked=${this.#checked}\n .disabled=${this.disabled} />\n <div class=\"indicator-container\">${this.renderIndicator()}</div>\n </div>`;\n }\n\n #handleClick() {\n this.checked = this.inputType === 'radio' || !this.checked;\n this.dispatchEvent(new Event('change', {bubbles: true}));\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-control.styles.d.ts","sourceRoot":"","sources":["../../../src/shared/selection-control/selection-control.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgElB,CAAC"}
|