@universal-material/web 3.0.7 → 3.0.9
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/.editorconfig +8 -0
- package/.eleventy.cjs +21 -0
- package/.eslintignore +6 -0
- package/.eslintrc.json +98 -0
- package/.prettierrc.json +7 -0
- package/.vscode/extensions.json +9 -0
- package/CHANGELOG.md +98 -0
- package/LICENSE +28 -0
- package/docs/.nojekyll +0 -0
- package/docs/api/index.html +149 -0
- package/docs/docs.css +185 -0
- package/docs/examples/index.html +75 -0
- package/docs/examples/name-property/index.html +65 -0
- package/docs/index.html +75 -0
- package/docs/install/index.html +53 -0
- package/docs/prism-okaidia.css +123 -0
- package/docs/src/_api-section.pug +27 -0
- package/docs/src/_layout.pug +182 -0
- package/docs/src/components/button-set/alignment.html +29 -0
- package/docs/src/components/button-set/stack.html +5 -0
- package/docs/src/components/button-set/usage.html +35 -0
- package/docs/src/components/button-set.pug +16 -0
- package/docs/src/components/cards/card-media.html +39 -0
- package/docs/src/components/cards/card-with-actions.html +38 -0
- package/docs/src/components/cards/simple-card.html +3 -0
- package/docs/src/components/cards.pug +15 -0
- package/docs/src/components/checkbox/usage.html +33 -0
- package/docs/src/components/checkbox.pug +7 -0
- package/docs/src/components/chips/chip-input.html +73 -0
- package/docs/src/components/chips/default-chips.html +25 -0
- package/docs/src/components/chips/elevated-chips.html +25 -0
- package/docs/src/components/chips/selected-chips.html +50 -0
- package/docs/src/components/chips.pug +16 -0
- package/docs/src/components/common-buttons/anchor-buttons.html +6 -0
- package/docs/src/components/common-buttons/buttons-icons.html +24 -0
- package/docs/src/components/common-buttons/buttons-trailing-icons.html +25 -0
- package/docs/src/components/common-buttons/buttons-variants.html +6 -0
- package/docs/src/components/common-buttons/filled-colors.html +4 -0
- package/docs/src/components/common-buttons.pug +22 -0
- package/docs/src/components/data-tables/simple-table.html +47 -0
- package/docs/src/components/data-tables/table-footer.html +59 -0
- package/docs/src/components/data-tables/table-header.html +43 -0
- package/docs/src/components/data-tables.pug +15 -0
- package/docs/src/components/datepicker.pug +133 -0
- package/docs/src/components/dialogs/example.html +44 -0
- package/docs/src/components/dialogs.pug +19 -0
- package/docs/src/components/dividers/no-margin.html +7 -0
- package/docs/src/components/dividers/usage.html +7 -0
- package/docs/src/components/dividers.pug +13 -0
- package/docs/src/components/dropdown-menus/down-end.html +10 -0
- package/docs/src/components/dropdown-menus/down-left.html +10 -0
- package/docs/src/components/dropdown-menus/down-right.html +10 -0
- package/docs/src/components/dropdown-menus/down-start.html +10 -0
- package/docs/src/components/dropdown-menus/down.html +10 -0
- package/docs/src/components/dropdown-menus/up-end.html +10 -0
- package/docs/src/components/dropdown-menus/up-left.html +10 -0
- package/docs/src/components/dropdown-menus/up-right.html +10 -0
- package/docs/src/components/dropdown-menus/up-start.html +10 -0
- package/docs/src/components/dropdown-menus/up.html +10 -0
- package/docs/src/components/expansion-panel.pug +33 -0
- package/docs/src/components/fab/button-colors.html +18 -0
- package/docs/src/components/fab/button-sizes.html +11 -0
- package/docs/src/components/fab/extended-buttons.html +18 -0
- package/docs/src/components/fab/floating-action-area.html +5 -0
- package/docs/src/components/fab/floating-menu.html +10 -0
- package/docs/src/components/fab/lowered-buttons.html +6 -0
- package/docs/src/components/fab.pug +25 -0
- package/docs/src/components/icon-buttons/anchor-buttons.html +15 -0
- package/docs/src/components/icon-buttons/buttons-variants.html +15 -0
- package/docs/src/components/icon-buttons/toggle-buttons-manual.html +44 -0
- package/docs/src/components/icon-buttons/toggle-buttons.html +48 -0
- package/docs/src/components/icon-buttons.pug +18 -0
- package/docs/src/components/lists/list-avatars.html +14 -0
- package/docs/src/components/lists/list-custom-dividers.html +23 -0
- package/docs/src/components/lists/list-dividers.html +17 -0
- package/docs/src/components/lists/list-dynamic.html +26 -0
- package/docs/src/components/lists/list-hover.html +17 -0
- package/docs/src/components/lists/list-icons.html +17 -0
- package/docs/src/components/lists/list-indexed.html +123 -0
- package/docs/src/components/lists/list-sections.html +16 -0
- package/docs/src/components/lists/list-three-lines.html +20 -0
- package/docs/src/components/lists/list-two-lines.html +20 -0
- package/docs/src/components/lists/list-with-action.html +26 -0
- package/docs/src/components/lists/list-with-activated-item.html +17 -0
- package/docs/src/components/lists/simple-list.html +17 -0
- package/docs/src/components/lists.pug +94 -0
- package/docs/src/components/menus.pug +55 -0
- package/docs/src/components/progress/circular-progress.html +13 -0
- package/docs/src/components/progress/determinate-progress.html +3 -0
- package/docs/src/components/progress/indeterminate-progress.html +3 -0
- package/docs/src/components/progress/progress-color.html +3 -0
- package/docs/src/components/progress.pug +18 -0
- package/docs/src/components/ripple/usage.html +9 -0
- package/docs/src/components/ripple.pug +10 -0
- package/docs/src/components/selection-controls/checkbox.html +22 -0
- package/docs/src/components/selection-controls/radio-button.html +36 -0
- package/docs/src/components/selection-controls/switch.html +12 -0
- package/docs/src/components/selection-controls.pug +13 -0
- package/docs/src/components/sliders/example.html +42 -0
- package/docs/src/components/sliders.pug +7 -0
- package/docs/src/components/snackbar/example.html +35 -0
- package/docs/src/components/snackbars.pug +21 -0
- package/docs/src/components/steppers.pug +57 -0
- package/docs/src/components/tabs/example.html +45 -0
- package/docs/src/components/tabs.pug +8 -0
- package/docs/src/components/text-fields.pug +88 -0
- package/docs/src/components/toolbars/simple-toolbar.html +33 -0
- package/docs/src/components/toolbars.pug +7 -0
- package/docs/src/content/typography/example.html +15 -0
- package/docs/src/content/typography.pug +8 -0
- package/docs/src/css/docs.scss +189 -0
- package/docs/src/index.pug +10 -0
- package/docs/src/js/docs.js +161 -0
- package/docs/src/js/universal-material.js +757 -0
- package/docs/src/js/universal-material.js.map +1 -0
- package/docs/src/js/universal-material.min.js +17 -0
- package/docs/src/js/universal-material.min.js.map +1 -0
- package/docs/src/layout/grid.pug +15 -0
- package/docs/src/utilities/background-colors/common-colors.html +7 -0
- package/docs/src/utilities/background-colors/theme-colors.html +16 -0
- package/docs/src/utilities/background-colors.pug +10 -0
- package/docs/src/utilities/text-and-background-colors/common-colors.html +80 -0
- package/docs/src/utilities/text-and-background-colors/theme-colors.html +208 -0
- package/docs/src/utilities/text-and-background-colors.pug +10 -0
- package/docs/src/utilities/text-colors/common-colors.html +12 -0
- package/docs/src/utilities/text-colors/emphasis-colors.html +26 -0
- package/docs/src/utilities/text-colors/theme-colors.html +37 -0
- package/docs/src/utilities/text-colors.pug +13 -0
- package/gulpfile.js +225 -0
- package/index.html +11 -0
- package/package.json +1 -1
- package/rollup.config.js +42 -0
- package/src/_utils.scss +20 -0
- package/src/_variables.scss +68 -0
- package/src/button/button-base.styles.scss +75 -0
- package/src/button/button-base.ts +147 -0
- package/src/button/button-set.styles.scss +35 -0
- package/src/button/button-set.ts +33 -0
- package/src/button/button.styles.scss +97 -0
- package/src/button/button.ts +64 -0
- package/src/button/fab.styles.scss +90 -0
- package/src/button/fab.ts +55 -0
- package/src/button/icon-button.styles.scss +74 -0
- package/src/button/icon-button.ts +72 -0
- package/src/card/card-content.styles.scss +11 -0
- package/src/card/card-content.ts +45 -0
- package/src/card/card-media.styles.scss +9 -0
- package/src/card/card-media.ts +24 -0
- package/src/card/card.styles.scss +27 -0
- package/src/card/card.ts +37 -0
- package/src/checkbox/checkbox.ts +77 -0
- package/src/container/container.styles.scss +39 -0
- package/src/container/container.ts +24 -0
- package/src/divider/divider.styles.scss +13 -0
- package/src/divider/divider.ts +21 -0
- package/src/elevation/elevation.styles.scss +31 -0
- package/src/elevation/elevation.ts +17 -0
- package/{index.js → src/index.ts} +1 -1
- package/src/ripple/ripple.styles.scss +80 -0
- package/src/ripple/ripple.ts +150 -0
- package/src/shared/base.styles.scss +5 -0
- package/src/table/table-body.styles.scss +9 -0
- package/src/table/table-body.ts +21 -0
- package/src/table/table-cell.styles.scss +9 -0
- package/src/table/table-cell.ts +21 -0
- package/src/table/table-head.styles.scss +9 -0
- package/src/table/table-head.ts +21 -0
- package/src/table/table-header-cell.styles.scss +10 -0
- package/src/table/table-header-cell.ts +21 -0
- package/src/table/table-row.styles.scss +3 -0
- package/src/table/table-row.ts +21 -0
- package/src/table/table.styles.scss +12 -0
- package/{table/table.js → src/table/table.ts} +15 -6
- package/src/theme/color.ts +6 -0
- package/src/theme/css-var-builder.ts +36 -0
- package/{theme/index.js → src/theme/index.ts} +0 -1
- package/src/theme/neutral-colors.ts +21 -0
- package/src/theme/rgb-color.ts +19 -0
- package/src/theme/theme-builder.ts +201 -0
- package/{theme/theme-color.d.ts → src/theme/theme-color.ts} +3 -2
- package/tsconfig.json +36 -0
- package/web-dev-server.config.js +25 -0
- package/web-test-runner.config.js +120 -0
- package/button/button-base.d.ts +0 -43
- package/button/button-base.d.ts.map +0 -1
- package/button/button-base.js +0 -152
- package/button/button-base.js.map +0 -1
- package/button/button-base.styles.d.ts +0 -2
- package/button/button-base.styles.d.ts.map +0 -1
- package/button/button-base.styles.js +0 -75
- package/button/button-base.styles.js.map +0 -1
- package/button/button-set.d.ts +0 -20
- package/button/button-set.d.ts.map +0 -1
- package/button/button-set.js +0 -38
- package/button/button-set.js.map +0 -1
- package/button/button-set.styles.d.ts +0 -2
- package/button/button-set.styles.d.ts.map +0 -1
- package/button/button-set.styles.js +0 -39
- package/button/button-set.styles.js.map +0 -1
- package/button/button.d.ts +0 -34
- package/button/button.d.ts.map +0 -1
- package/button/button.js +0 -64
- package/button/button.js.map +0 -1
- package/button/button.styles.d.ts +0 -2
- package/button/button.styles.d.ts.map +0 -1
- package/button/button.styles.js +0 -94
- package/button/button.styles.js.map +0 -1
- package/button/fab.d.ts +0 -31
- package/button/fab.d.ts.map +0 -1
- package/button/fab.js +0 -63
- package/button/fab.js.map +0 -1
- package/button/fab.styles.d.ts +0 -2
- package/button/fab.styles.d.ts.map +0 -1
- package/button/fab.styles.js +0 -89
- package/button/fab.styles.js.map +0 -1
- package/button/icon-button.d.ts +0 -35
- package/button/icon-button.d.ts.map +0 -1
- package/button/icon-button.js +0 -79
- package/button/icon-button.js.map +0 -1
- package/button/icon-button.styles.d.ts +0 -2
- package/button/icon-button.styles.d.ts.map +0 -1
- package/button/icon-button.styles.js +0 -70
- package/button/icon-button.styles.js.map +0 -1
- package/card/card-content.d.ts +0 -13
- package/card/card-content.d.ts.map +0 -1
- package/card/card-content.js +0 -44
- package/card/card-content.js.map +0 -1
- package/card/card-content.styles.d.ts +0 -2
- package/card/card-content.styles.d.ts.map +0 -1
- package/card/card-content.styles.js +0 -15
- package/card/card-content.styles.js.map +0 -1
- package/card/card-media.d.ts +0 -12
- package/card/card-media.d.ts.map +0 -1
- package/card/card-media.js +0 -29
- package/card/card-media.js.map +0 -1
- package/card/card-media.styles.d.ts +0 -2
- package/card/card-media.styles.d.ts.map +0 -1
- package/card/card-media.styles.js +0 -13
- package/card/card-media.styles.js.map +0 -1
- package/card/card.d.ts +0 -19
- package/card/card.d.ts.map +0 -1
- package/card/card.js +0 -40
- package/card/card.js.map +0 -1
- package/card/card.styles.d.ts +0 -2
- package/card/card.styles.d.ts.map +0 -1
- package/card/card.styles.js +0 -28
- package/card/card.styles.js.map +0 -1
- package/checkbox/checkbox.d.ts +0 -16
- package/checkbox/checkbox.d.ts.map +0 -1
- package/checkbox/checkbox.js +0 -75
- package/checkbox/checkbox.js.map +0 -1
- package/container/container.d.ts +0 -13
- package/container/container.d.ts.map +0 -1
- package/container/container.js +0 -23
- package/container/container.js.map +0 -1
- package/container/container.styles.d.ts +0 -2
- package/container/container.styles.d.ts.map +0 -1
- package/container/container.styles.js +0 -43
- package/container/container.styles.js.map +0 -1
- package/custom-elements.json +0 -3706
- 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 +0 -2
- 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/elevation/elevation.d.ts +0 -11
- package/elevation/elevation.d.ts.map +0 -1
- package/elevation/elevation.js +0 -21
- package/elevation/elevation.js.map +0 -1
- package/elevation/elevation.styles.d.ts +0 -2
- package/elevation/elevation.styles.d.ts.map +0 -1
- package/elevation/elevation.styles.js +0 -28
- package/elevation/elevation.styles.js.map +0 -1
- package/index.d.ts +0 -27
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/ripple/ripple.d.ts +0 -25
- package/ripple/ripple.d.ts.map +0 -1
- package/ripple/ripple.js +0 -119
- package/ripple/ripple.js.map +0 -1
- package/ripple/ripple.styles.d.ts +0 -2
- package/ripple/ripple.styles.d.ts.map +0 -1
- package/ripple/ripple.styles.js +0 -74
- package/ripple/ripple.styles.js.map +0 -1
- package/shared/base.styles.d.ts +0 -2
- package/shared/base.styles.d.ts.map +0 -1
- package/shared/base.styles.js +0 -9
- package/shared/base.styles.js.map +0 -1
- package/table/table-body.d.ts +0 -11
- package/table/table-body.d.ts.map +0 -1
- package/table/table-body.js +0 -21
- package/table/table-body.js.map +0 -1
- package/table/table-body.styles.d.ts +0 -2
- package/table/table-body.styles.d.ts.map +0 -1
- package/table/table-body.styles.js +0 -11
- package/table/table-body.styles.js.map +0 -1
- package/table/table-cell.d.ts +0 -11
- package/table/table-cell.d.ts.map +0 -1
- package/table/table-cell.js +0 -21
- package/table/table-cell.js.map +0 -1
- package/table/table-cell.styles.d.ts +0 -2
- package/table/table-cell.styles.d.ts.map +0 -1
- package/table/table-cell.styles.js +0 -11
- package/table/table-cell.styles.js.map +0 -1
- package/table/table-head.d.ts +0 -11
- package/table/table-head.d.ts.map +0 -1
- package/table/table-head.js +0 -21
- package/table/table-head.js.map +0 -1
- package/table/table-head.styles.d.ts +0 -2
- package/table/table-head.styles.d.ts.map +0 -1
- package/table/table-head.styles.js +0 -11
- package/table/table-head.styles.js.map +0 -1
- package/table/table-header-cell.d.ts +0 -11
- package/table/table-header-cell.d.ts.map +0 -1
- package/table/table-header-cell.js +0 -21
- package/table/table-header-cell.js.map +0 -1
- package/table/table-header-cell.styles.d.ts +0 -2
- package/table/table-header-cell.styles.d.ts.map +0 -1
- package/table/table-header-cell.styles.js +0 -12
- package/table/table-header-cell.styles.js.map +0 -1
- package/table/table-row.d.ts +0 -11
- package/table/table-row.d.ts.map +0 -1
- package/table/table-row.js +0 -21
- package/table/table-row.js.map +0 -1
- package/table/table-row.styles.d.ts +0 -2
- package/table/table-row.styles.d.ts.map +0 -1
- package/table/table-row.styles.js +0 -7
- package/table/table-row.styles.js.map +0 -1
- package/table/table.d.ts +0 -16
- package/table/table.d.ts.map +0 -1
- package/table/table.js.map +0 -1
- package/table/table.styles.d.ts +0 -2
- package/table/table.styles.d.ts.map +0 -1
- package/table/table.styles.js +0 -16
- package/table/table.styles.js.map +0 -1
- package/theme/color.d.ts +0 -7
- package/theme/color.d.ts.map +0 -1
- package/theme/color.js +0 -2
- package/theme/color.js.map +0 -1
- package/theme/css-var-builder.d.ts +0 -9
- package/theme/css-var-builder.d.ts.map +0 -1
- package/theme/css-var-builder.js +0 -25
- package/theme/css-var-builder.js.map +0 -1
- package/theme/index.d.ts +0 -2
- package/theme/index.d.ts.map +0 -1
- package/theme/index.js.map +0 -1
- package/theme/neutral-colors.d.ts +0 -4
- package/theme/neutral-colors.d.ts.map +0 -1
- package/theme/neutral-colors.js +0 -19
- package/theme/neutral-colors.js.map +0 -1
- package/theme/rgb-color.d.ts +0 -9
- package/theme/rgb-color.d.ts.map +0 -1
- package/theme/rgb-color.js +0 -13
- package/theme/rgb-color.js.map +0 -1
- package/theme/theme-builder.d.ts +0 -27
- package/theme/theme-builder.d.ts.map +0 -1
- package/theme/theme-builder.js +0 -146
- package/theme/theme-builder.js.map +0 -1
- package/theme/theme-color.d.ts.map +0 -1
- package/theme/theme-color.js +0 -2
- package/theme/theme-color.js.map +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@import "../utils";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--u-common-button-line-height: var(--u-label-large-line-height, 1.25rem);
|
|
5
|
+
--u-common-button-font-size: var(--u-label-large-font-size, 0.875rem);
|
|
6
|
+
--u-common-button-font-weight: #{get-font-weight-var(medium)};
|
|
7
|
+
--_common-button-height: var(--u-common-button-height, 2.5rem);
|
|
8
|
+
--_common-button-padding: var(--u-common-button-padding, 24px);
|
|
9
|
+
--_common-button-icon-padding: var(--u-common-button-icon-padding, 16px);
|
|
10
|
+
|
|
11
|
+
border-radius: var(--u-common-button-shape-corner, #{get-shaper-corner-var(full)});
|
|
12
|
+
font-family: var(--u-font-family-base, system-ui);
|
|
13
|
+
height: var(--u-common-button-height, 40px);
|
|
14
|
+
font-size: var(--u-common-button-font-size);
|
|
15
|
+
font-weight: var(--u-common-button-font-weight);
|
|
16
|
+
padding-inline: var(--_common-button-padding);
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([variant=filled]),
|
|
21
|
+
:host([variant=filled][color=primary]) {
|
|
22
|
+
background-color: var(--u-filled-button-primary-container-color, var(--_color-primary));
|
|
23
|
+
color: var(--u-filled-button-primary-text-color, #{get-color-var(on-primary)});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([variant=filled][color=secondary]) {
|
|
27
|
+
background-color: var(--u-filled-button-secondary-container-color, #{get-color-var(secondary)});
|
|
28
|
+
color: var(--u-filled-button-secondary-text-color, #{get-color-var(on-secondary)});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([variant=filled][color=tertiary]) {
|
|
32
|
+
background-color: var(--u-filled-button-tertiary-container-color, #{get-color-var(tertiary)});
|
|
33
|
+
color: var(--u-filled-button-tertiary-text-color, #{get-color-var(on-tertiary)});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host([variant=filled][color=error]) {
|
|
37
|
+
background-color: var(--u-filled-button-error-container-color, #{get-color-var(error)});
|
|
38
|
+
color: var(--u-filled-button-error-text-color, #{get-color-var(on-error)});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([variant=tonal]) {
|
|
42
|
+
background-color: var(--u-tonal-button-background-color, #{get-color-var(secondary-container)});
|
|
43
|
+
color: var(--u-tonal-button-text-color, #{get-color-var(on-secondary-container)});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([variant=elevated]) {
|
|
47
|
+
background-color: var(--u-elevated-button-background-color, #{get-color-var(surface-container-low)});
|
|
48
|
+
color: var(--u-tonal-button-text-color, #{get-color-var(on-secondary-container)});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media (hover: hover) {
|
|
52
|
+
:host([variant=filled]:hover:not(:focus-within):not(:active)),
|
|
53
|
+
:host([variant=tonal]:hover:not(:focus-within):not(:active)) {
|
|
54
|
+
--u-elevation-level: var(--u-filled-button-hover-elevation-level, 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([variant=outlined]),
|
|
59
|
+
:host([variant=text]),
|
|
60
|
+
:host([variant=elevated]) {
|
|
61
|
+
color: var(--_color-primary);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([variant=outlined]) {
|
|
65
|
+
border: 1px solid #{get-color-var(outline-color)};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([variant=elevated]) {
|
|
69
|
+
--u-elevation-level: var(--u-elevated-button-elevation-level, 1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media (hover: hover) {
|
|
73
|
+
:host([variant=elevated]:hover) {
|
|
74
|
+
--u-elevation-level: var(--u-elevated-button-hover-elevation-level, 2);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([has-icon]) {
|
|
79
|
+
padding-inline: var(--_common-button-icon-padding) var(--_common-button-padding);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([has-icon][trailing-icon]) {
|
|
83
|
+
padding-inline: var(--_common-button-padding) var(--_common-button-icon-padding);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
::slotted([slot=icon]) {
|
|
87
|
+
display: inline-block;
|
|
88
|
+
width: var(--u-common-button-icon-size, 1.125rem);
|
|
89
|
+
height: var(--u-common-button-icon-size, 1.125rem);
|
|
90
|
+
margin-inline-end: 8px;
|
|
91
|
+
font-size: var(--u-common-button-icon-size, 1.125rem);
|
|
92
|
+
line-height: var(--u-common-button-icon-size, 1.125rem);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:host([trailing-icon]) ::slotted([slot=icon]) {
|
|
96
|
+
margin-inline: 8px 0;
|
|
97
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';
|
|
2
|
+
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { UmButtonBase } from './button-base';
|
|
5
|
+
import { styles as buttonBaseStyles } from './button-base.styles';
|
|
6
|
+
import { styles } from './button.styles';
|
|
7
|
+
import '../ripple/ripple.js';
|
|
8
|
+
|
|
9
|
+
export type UmButtonVariant = 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';
|
|
10
|
+
export type UmButtonColor = 'primary' | 'secondary' | 'tertiary' | 'error' | undefined;
|
|
11
|
+
|
|
12
|
+
@customElement('u-button')
|
|
13
|
+
export class UmButton extends UmButtonBase {
|
|
14
|
+
|
|
15
|
+
static override styles: CSSResult | CSSResult[] = [buttonBaseStyles, styles];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The Button variant to render
|
|
19
|
+
*/
|
|
20
|
+
@property({reflect: true}) variant: UmButtonVariant = 'filled';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The Button color
|
|
24
|
+
*
|
|
25
|
+
* _Note:_ Filled buttons only
|
|
26
|
+
*/
|
|
27
|
+
@property({reflect: true}) color: UmButtonColor;
|
|
28
|
+
|
|
29
|
+
@property({type: Boolean, attribute: 'trailing-icon', reflect: true}) trailingIcon = false;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the button has icon or not
|
|
33
|
+
*
|
|
34
|
+
* _Note:_ Readonly
|
|
35
|
+
*/
|
|
36
|
+
@property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon = false;
|
|
37
|
+
|
|
38
|
+
@queryAssignedElements({slot: 'icon', flatten: true})
|
|
39
|
+
private readonly assignedIcons!: HTMLElement[];
|
|
40
|
+
|
|
41
|
+
protected override renderContent(): HTMLTemplateResult {
|
|
42
|
+
const icon = html`
|
|
43
|
+
<slot
|
|
44
|
+
name="icon"
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
@slotchange="${this.handleSlotChange}"></slot>`;
|
|
47
|
+
|
|
48
|
+
return html`
|
|
49
|
+
${this.trailingIcon ? nothing : icon}
|
|
50
|
+
<span><slot></slot></span>
|
|
51
|
+
${this.trailingIcon ? icon : nothing}
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private handleSlotChange() {
|
|
56
|
+
this.hasIcon = this.assignedIcons.length > 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare global {
|
|
61
|
+
interface HTMLElementTagNameMap {
|
|
62
|
+
'u-button': UmButton;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@import "../utils";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
aspect-ratio: 1;
|
|
5
|
+
--u-elevation-level: var(--u-fab-button-elevation-level, 3);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:host([lowered]) {
|
|
9
|
+
--u-elevation-level: var(--u-fab-button-elevation-level, 1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@media (hover: hover) {
|
|
13
|
+
:host(:hover:not(:focus-within):not(:active)) {
|
|
14
|
+
--u-elevation-level: var(--u-fab-button-hover-elevation-level, 4);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host(:hover:not(:focus-within):not(:active)[lowered]) {
|
|
18
|
+
--u-elevation-level: var(--u-fab-button-elevation-level, 2);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (hover: hover) {
|
|
23
|
+
:host(:hover:not(:focus-within):not(:active)) {
|
|
24
|
+
--u-elevation-level: var(--u-fab-button-hover-elevation-level, 4);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([size="small"]) {
|
|
29
|
+
width: var(--u-fab-button-small-size, 40px);
|
|
30
|
+
border-radius: var(--u-fab-button-medium-shape-corner, #{get-shaper-corner-var(medium)});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([size="large"]) {
|
|
34
|
+
width: var(--u-fab-button-medium-size, 96px);
|
|
35
|
+
border-radius: var(--u-fab-button-medium-shape-corner, #{get-shaper-corner-var(extra-large)});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([extended]),
|
|
39
|
+
:host([size="medium"]) {
|
|
40
|
+
width: var(--u-fab-button-medium-size, 56px);
|
|
41
|
+
border-radius: var(--u-fab-button-medium-shape-corner, #{get-shaper-corner-var(large)});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([size="large"]) .icon {
|
|
45
|
+
font-size: var(--u-fab-button-icon-size, 2rem);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([extended]) .icon,
|
|
49
|
+
:host([size="small"]) .icon,
|
|
50
|
+
:host([size="medium"]) .icon {
|
|
51
|
+
font-size: var(--u-fab-button-icon-size, 1.5rem);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host([extended]) {
|
|
55
|
+
width: auto;
|
|
56
|
+
height: var(--u-extended-fab-button-height, 56px);
|
|
57
|
+
aspect-ratio: auto;
|
|
58
|
+
min-width: var(--u-extended-fab-button-min-width, 80px);
|
|
59
|
+
padding-inline: var(--u-extended-fab-button-padding, 16px 24px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([extended]) .icon {
|
|
63
|
+
margin-inline-end: var(--u-extended-fab-button-icon-margin, 12px);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([color="primary"]) {
|
|
67
|
+
background-color: var(--u-fab-button-primary-background-color, #{get-color-var(primary-container)});
|
|
68
|
+
color: var(--u-fab-button-primary-text-color, #{get-color-var(on-primary-container)});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([color="secondary"]) {
|
|
72
|
+
background-color: var(--u-fab-button-secondary-background-color, #{get-color-var(secondary-container)});
|
|
73
|
+
color: var(--u-fab-button-secondary-text-color, #{get-color-var(on-secondary-container)});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([color="tertiary"]) {
|
|
77
|
+
background-color: var(--u-fab-button-tertiary-background-color, #{get-color-var(tertiary-container)});
|
|
78
|
+
color: var(--u-fab-button-tertiary-text-color, #{get-color-var(on-tertiary-container)});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([color="branded"]),
|
|
82
|
+
:host([color="surface"]) {
|
|
83
|
+
background-color: var(--u-fab-button-surface-background-color, #{get-color-var(surface-container-high)});
|
|
84
|
+
color: var(--u-fab-button-surface-text-color, var(--_color-primary));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([color="branded"][lowered]),
|
|
88
|
+
:host([color="surface"][lowered]) {
|
|
89
|
+
background-color: var(--u-fab-button-surface-background-color, #{get-color-var(surface-container-low)});
|
|
90
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { UmButtonBase } from './button-base';
|
|
5
|
+
import { styles as buttonBaseStyles } from './button-base.styles';
|
|
6
|
+
import { styles } from './fab.styles';
|
|
7
|
+
|
|
8
|
+
export type UmFabColor = 'primary' | 'secondary' | 'tertiary' | 'surface' | 'branded';
|
|
9
|
+
export type UmFabSize = 'small' | 'medium' | 'large';
|
|
10
|
+
|
|
11
|
+
@customElement('u-fab')
|
|
12
|
+
export class UmFab extends UmButtonBase {
|
|
13
|
+
|
|
14
|
+
static override styles: CSSResult | CSSResult[] = [buttonBaseStyles, styles];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The FAB color variant to render.
|
|
18
|
+
*/
|
|
19
|
+
@property({reflect: true}) color: UmFabColor = 'primary';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The size of the FAB.
|
|
23
|
+
*/
|
|
24
|
+
@property({reflect: true}) size: UmFabSize = 'medium';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The text to display the FAB.
|
|
28
|
+
*/
|
|
29
|
+
@property({reflect: true}) label: string | null = null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Lowers the FAB's elevation.
|
|
33
|
+
*/
|
|
34
|
+
@property({type: Boolean, reflect: true}) lowered = false;
|
|
35
|
+
|
|
36
|
+
@property({type: Boolean, reflect: true})
|
|
37
|
+
get extended(): boolean {
|
|
38
|
+
return !!this.label;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected override renderContent(): HTMLTemplateResult {
|
|
42
|
+
const labelTag = html`<span>${this.label}</span>`;
|
|
43
|
+
|
|
44
|
+
return html`
|
|
45
|
+
<span class="icon" aria-hidden="true"><slot></slot></span>
|
|
46
|
+
${this.label ? labelTag : nothing}
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare global {
|
|
52
|
+
interface HTMLElementTagNameMap {
|
|
53
|
+
'u-fab': UmFab;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
@import "../utils";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--_surface-container-highest-color: #{get-color-var(surface-container-highest)};
|
|
5
|
+
|
|
6
|
+
width: var(--u-icon-button-size, 2.5rem);
|
|
7
|
+
height: var(--u-icon-button-size, 2.5rem);
|
|
8
|
+
border-radius: var(--u-icon-button-shape-corner, 9999px);
|
|
9
|
+
font-family: var(--u-font-family-base, system-ui);
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.icon {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
font-size: var(--u-icon-button-icon-size, 1.5rem);
|
|
18
|
+
line-height: var(--u-icon-button-icon-size, 1.5rem);
|
|
19
|
+
|
|
20
|
+
&.icon-selected {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([selected]) {
|
|
26
|
+
.icon:not(.icon-selected) {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon.icon-selected {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([variant="filled"]) {
|
|
36
|
+
background-color: var(--u-filled-icon-button-unselected-background-color, var(--_surface-container-highest-color));
|
|
37
|
+
color: var(--u-filled-icon-button-unselected-text-color, var(--_color-primary));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host([variant="tonal"]) {
|
|
41
|
+
background-color: var(--u-total-icon-button-unselected-background-color, var(--_surface-container-highest-color));
|
|
42
|
+
color: var(--u-tonal-icon-button-unselected-text-color, #{get-color-var(on-surface-variant)});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([selected][variant="filled"]),
|
|
46
|
+
:host([variant="filled"]:not([has-selection-icon])) {
|
|
47
|
+
background-color: var(--u-filled-icon-button-background-color, var(--_color-primary));
|
|
48
|
+
color: var(--u-filled-icon-button-text-color, #{get-color-var(on-primary)});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([selected][variant="tonal"]),
|
|
52
|
+
:host([variant="tonal"]:not([has-selection-icon])) {
|
|
53
|
+
background-color: var(--u-tonal-icon-button-background-color, #{get-color-var(secondary-container)});
|
|
54
|
+
color: var(--u-tonal-icon-button-text-color, #{get-color-var(on-secondary-container)});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([variant="standard"]),
|
|
58
|
+
:host([variant="outlined"]) {
|
|
59
|
+
color: #{get-color-var(on-surface-variant)};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([variant="outlined"]) {
|
|
63
|
+
border: 1px solid #{get-color-var(outline)};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([selected][variant="outlined"]) {
|
|
67
|
+
border: none;
|
|
68
|
+
background-color: var(--u-outlined-icon-button-selected-background-color, #{get-color-var(inverse-surface)});
|
|
69
|
+
color: var(--u-outlined-icon-button-selected-text-color, #{get-color-var(inverse-on-surface)});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([selected][variant="standard"]) {
|
|
73
|
+
color: var(--u-standard-icon-button-selected-text-color, var(--_color-primary));
|
|
74
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CSSResult, html, HTMLTemplateResult, nothing } from 'lit';
|
|
2
|
+
import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import '../ripple/ripple.js';
|
|
5
|
+
import { UmButtonBase } from './button-base';
|
|
6
|
+
import { styles as buttonBaseStyles } from './button-base.styles';
|
|
7
|
+
import { styles } from './icon-button.styles';
|
|
8
|
+
|
|
9
|
+
export type UmIconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
|
|
10
|
+
|
|
11
|
+
@customElement('u-icon-button')
|
|
12
|
+
export class UmIconButton extends UmButtonBase {
|
|
13
|
+
|
|
14
|
+
static override styles: CSSResult | CSSResult[] = [buttonBaseStyles, styles];
|
|
15
|
+
|
|
16
|
+
@property({reflect: true}) variant: UmIconButtonVariant = 'standard';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* When true, the button will toggle between selected and unselected
|
|
20
|
+
* states
|
|
21
|
+
*/
|
|
22
|
+
@property({type: Boolean}) toggle = false;
|
|
23
|
+
|
|
24
|
+
@property({type: Boolean, attribute: 'has-selection-icon', reflect: true}) hasSelectionIcon = false;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Sets the selected state. When false, displays the default icon. When true,
|
|
28
|
+
* displays the selected icon, or the default icon If no `slot="selected"`
|
|
29
|
+
* icon is provided.
|
|
30
|
+
*/
|
|
31
|
+
@property({type: Boolean, reflect: true}) selected = false;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The `aria-label` of the button when the button is toggleable and selected.
|
|
35
|
+
*/
|
|
36
|
+
@property({attribute: 'aria-label-selected'}) ariaLabelSelected = '';
|
|
37
|
+
|
|
38
|
+
@queryAssignedElements({slot: 'selected', flatten: true})
|
|
39
|
+
private readonly selectedIcons!: HTMLElement[];
|
|
40
|
+
|
|
41
|
+
protected override renderContent(): HTMLTemplateResult {
|
|
42
|
+
|
|
43
|
+
return html`
|
|
44
|
+
<span class="icon" aria-hidden="true"><slot></slot></span>
|
|
45
|
+
<span class="icon icon-selected" aria-hidden="true">
|
|
46
|
+
<slot name="selected" @slotchange="${this.handleSlotChange}"></slot>
|
|
47
|
+
</span>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected override handleClick(_: UIEvent): void {
|
|
52
|
+
if (this.toggle) {
|
|
53
|
+
this.selected = !this.selected;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override getAriaLabel(): string | null | typeof nothing {
|
|
58
|
+
return this.selected
|
|
59
|
+
? this.ariaLabelSelected || super.getAriaLabel()
|
|
60
|
+
: super.getAriaLabel();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private handleSlotChange() {
|
|
64
|
+
this.hasSelectionIcon = this.selectedIcons.length > 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare global {
|
|
69
|
+
interface HTMLElementTagNameMap {
|
|
70
|
+
'u-icon-button': UmIconButton;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { HTMLTemplateResult, LitElement, html } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { styles as baseStyles } from '../shared/base.styles';
|
|
5
|
+
import { styles } from './card-content.styles';
|
|
6
|
+
|
|
7
|
+
@customElement('u-card-content')
|
|
8
|
+
export class UmCardContent extends LitElement {
|
|
9
|
+
|
|
10
|
+
static override styles = [baseStyles, styles];
|
|
11
|
+
|
|
12
|
+
@property({type: Boolean, attribute: 'has-content', reflect: true}) hasContent = false;
|
|
13
|
+
|
|
14
|
+
override render(): HTMLTemplateResult {
|
|
15
|
+
return html`
|
|
16
|
+
<slot @slotchange="${this.handleSlotChange}"></slot>`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private handleSlotChange(e: Event) {
|
|
20
|
+
const slot = <HTMLSlotElement>e.target;
|
|
21
|
+
|
|
22
|
+
this.hasContent = slot.assignedElements({flatten: true}).length > 0;
|
|
23
|
+
|
|
24
|
+
if (this.hasContent) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const nodes = slot.assignedNodes({flatten: true});
|
|
29
|
+
|
|
30
|
+
for (const node of nodes) {
|
|
31
|
+
if (node.nodeValue?.trim()) {
|
|
32
|
+
this.hasContent = true;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.hasContent = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
'u-card-content': UmCardContent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HTMLTemplateResult, LitElement, html } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { styles as baseStyles } from '../shared/base.styles';
|
|
5
|
+
import { styles } from './card-media.styles';
|
|
6
|
+
|
|
7
|
+
@customElement('u-card-media')
|
|
8
|
+
export class UmCardMedia extends LitElement {
|
|
9
|
+
|
|
10
|
+
static override styles = [baseStyles, styles];
|
|
11
|
+
|
|
12
|
+
@property({type: Boolean, reflect: true}) wide = false;
|
|
13
|
+
|
|
14
|
+
override render(): HTMLTemplateResult {
|
|
15
|
+
return html`
|
|
16
|
+
<slot></slot>`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'u-card-media': UmCardMedia;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import "../utils";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
border-radius: var(--u-card-shape-corner, #{get-shaper-corner-var(medium)});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host(:not(:first-child)) {
|
|
10
|
+
margin-top: 8px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([variant=elevated]) {
|
|
14
|
+
background-color: #{get-color-var(surface-container-low)};
|
|
15
|
+
|
|
16
|
+
u-elevation {
|
|
17
|
+
--u-elevation-level: var(--u-elevated-card-elevation-level, 1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([variant=filled]) {
|
|
22
|
+
background-color: #{get-color-var(surface-container-highest)};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([variant=outlined]) {
|
|
26
|
+
border: var(--u-outlined-card-outline-width, 1px) solid var(--u-outlined-card-outline-color, #{get-color-var(outline-variant)});
|
|
27
|
+
}
|
package/src/card/card.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { html, HTMLTemplateResult, LitElement } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { styles as baseStyles } from '../shared/base.styles';
|
|
5
|
+
import { styles } from './card.styles';
|
|
6
|
+
import './card-content.js';
|
|
7
|
+
import './card-media.js';
|
|
8
|
+
import '../elevation/elevation.js';
|
|
9
|
+
|
|
10
|
+
export type UmCardVariant = 'filled' | 'elevated' | 'outlined';
|
|
11
|
+
|
|
12
|
+
@customElement('u-card')
|
|
13
|
+
export class UmCard extends LitElement {
|
|
14
|
+
|
|
15
|
+
static override styles = [baseStyles, styles];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The Card variant to render.
|
|
19
|
+
*/
|
|
20
|
+
@property({reflect: true}) variant: UmCardVariant = 'elevated';
|
|
21
|
+
|
|
22
|
+
override render(): HTMLTemplateResult {
|
|
23
|
+
return html`
|
|
24
|
+
<u-elevation></u-elevation>
|
|
25
|
+
<slot name="before-content"></slot>
|
|
26
|
+
<u-card-content>
|
|
27
|
+
<slot></slot>
|
|
28
|
+
</u-card-content>
|
|
29
|
+
<slot name="after-content"></slot>`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
'u-card': UmCard;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { css, html, HTMLTemplateResult, LitElement } from 'lit';
|
|
2
|
+
import { customElement, query, queryAssignedElements } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { UmRipple } from '../ripple/ripple';
|
|
5
|
+
import { styles as baseStyles } from '../shared/base.styles';
|
|
6
|
+
|
|
7
|
+
@customElement('u-checkbox')
|
|
8
|
+
export class UmCheckbox extends LitElement {
|
|
9
|
+
static override styles = [
|
|
10
|
+
baseStyles,
|
|
11
|
+
css`
|
|
12
|
+
:host {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
width: 48px;
|
|
18
|
+
height: 48px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
::slotted(input) {
|
|
22
|
+
position: relative;
|
|
23
|
+
padding: 0;
|
|
24
|
+
margin: 0;
|
|
25
|
+
aspect-ratio: 1;
|
|
26
|
+
height: 100%;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
appearance: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.touch {
|
|
32
|
+
position: absolute;
|
|
33
|
+
inset: 0;
|
|
34
|
+
border-radius: 9999px;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
@query('u-ripple') private readonly ripple!: UmRipple;
|
|
40
|
+
@queryAssignedElements({selector: 'input', flatten: true})
|
|
41
|
+
private readonly assignedInputs!: HTMLInputElement[];
|
|
42
|
+
|
|
43
|
+
private input: HTMLInputElement | undefined;
|
|
44
|
+
|
|
45
|
+
override render(): HTMLTemplateResult {
|
|
46
|
+
return html`
|
|
47
|
+
<div class="touch">
|
|
48
|
+
<u-ripple><slot @slotchange="${this.handleSlotChange}"></slot></u-ripple>
|
|
49
|
+
</div>`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private handleSlotChange(): void {
|
|
53
|
+
console.log('slotchange');
|
|
54
|
+
|
|
55
|
+
if (this.input) {
|
|
56
|
+
this.input.removeEventListener('click', this.handleInputChange);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.input = this.assignedInputs[0];
|
|
60
|
+
|
|
61
|
+
if (this.input) {
|
|
62
|
+
this.input.addEventListener('click', this.handleInputChange);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private handleInputChange = (e: MouseEvent) => {
|
|
67
|
+
if (this.input !== document.elementFromPoint(e.clientX, e.clientY)) {
|
|
68
|
+
this.ripple.createRipple();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare global {
|
|
74
|
+
interface HTMLElementTagNameMap {
|
|
75
|
+
'u-checkbox': UmCheckbox;
|
|
76
|
+
}
|
|
77
|
+
}
|