@covalent/components 0.0.0-COVALENT
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/.babelrc +10 -0
- package/.eslintrc.json +18 -0
- package/.storybook/main.js +34 -0
- package/.storybook/manager-head.html +62 -0
- package/.storybook/manager.js +1 -0
- package/.storybook/preview-head.html +20 -0
- package/.storybook/preview.js +20 -0
- package/README.md +179 -0
- package/component-config.json +313 -0
- package/index.html +288 -0
- package/jest.config.js +18 -0
- package/package.json +315 -0
- package/project.json +104 -0
- package/public/index.scss +1 -0
- package/public/reset.css +128 -0
- package/src/action-ribbon/_action-ribbon.theme.scss +90 -0
- package/src/action-ribbon/action-ribbon-base.ts +164 -0
- package/src/action-ribbon/action-ribbon.scss +20 -0
- package/src/action-ribbon/action-ribbon.spec.ts +11 -0
- package/src/action-ribbon/action-ribbon.stories.js +78 -0
- package/src/action-ribbon/action-ribbon.ts +26 -0
- package/src/alert/_alert.theme.scss +116 -0
- package/src/alert/alert-base.ts +175 -0
- package/src/alert/alert.scss +55 -0
- package/src/alert/alert.spec.ts +26 -0
- package/src/alert/alert.stories.js +76 -0
- package/src/alert/alert.ts +26 -0
- package/src/app-shell/app-shell.scss +387 -0
- package/src/app-shell/app-shell.stories.js +323 -0
- package/src/app-shell/app-shell.ts +388 -0
- package/src/badge/badge.scss +60 -0
- package/src/badge/badge.spec.ts +40 -0
- package/src/badge/badge.stories.js +88 -0
- package/src/badge/badge.ts +122 -0
- package/src/button/Overview.mdx +160 -0
- package/src/button/button.scss +28 -0
- package/src/button/button.spec.ts +11 -0
- package/src/button/button.stories.js +102 -0
- package/src/button/button.ts +17 -0
- package/src/card/card-base.ts +69 -0
- package/src/card/card.scss +45 -0
- package/src/card/card.spec.ts +11 -0
- package/src/card/card.ts +21 -0
- package/src/card/cards.stories.js +40 -0
- package/src/checkbox/checkbox.scss +8 -0
- package/src/checkbox/checkbox.spec.ts +11 -0
- package/src/checkbox/checkbox.stories.js +61 -0
- package/src/checkbox/checkbox.ts +18 -0
- package/src/chips/chip-base.ts +276 -0
- package/src/chips/chip-set-base.ts +184 -0
- package/src/chips/chip-set.scss +15 -0
- package/src/chips/chip-set.spec.ts +11 -0
- package/src/chips/chip-set.ts +27 -0
- package/src/chips/chip.scss +40 -0
- package/src/chips/chip.spec.ts +11 -0
- package/src/chips/chip.ts +26 -0
- package/src/chips/chips.stories.js +81 -0
- package/src/circular-progress/circular-progress.spec.ts +11 -0
- package/src/circular-progress/circular-progress.stories.js +40 -0
- package/src/circular-progress/circular-progress.ts +16 -0
- package/src/code-editor/code-editor.scss +20 -0
- package/src/code-editor/code-editor.spec.ts +11 -0
- package/src/code-editor/code-editor.stories.js +44 -0
- package/src/code-editor/code-editor.theme.ts +199 -0
- package/src/code-editor/code-editor.ts +231 -0
- package/src/code-snippet/code-snippet.scss +126 -0
- package/src/code-snippet/code-snippet.spec.ts +11 -0
- package/src/code-snippet/code-snippet.stories.js +134 -0
- package/src/code-snippet/code-snippet.ts +93 -0
- package/src/data-table/_data-table.theme.scss +39 -0
- package/src/data-table/data-table.stories.js +24 -0
- package/src/data-table/data-table.stories.scss +11 -0
- package/src/dialog/Overview.mdx +39 -0
- package/src/dialog/dialog.scss +17 -0
- package/src/dialog/dialog.spec.ts +11 -0
- package/src/dialog/dialog.stories.js +89 -0
- package/src/dialog/dialog.ts +44 -0
- package/src/drawer/drawer.scss +4 -0
- package/src/drawer/drawer.spec.ts +11 -0
- package/src/drawer/drawer.ts +18 -0
- package/src/empty-state/_empty-state.theme.scss +0 -0
- package/src/empty-state/empty-state.scss +67 -0
- package/src/empty-state/empty-state.spec.ts +11 -0
- package/src/empty-state/empty-state.stories.js +117 -0
- package/src/empty-state/empty-state.ts +61 -0
- package/src/expansion-panel/Overview.mdx +108 -0
- package/src/expansion-panel/expansion-panel-incorrect-example.png +0 -0
- package/src/expansion-panel/expansion-panel-item.scss +243 -0
- package/src/expansion-panel/expansion-panel-item.ts +95 -0
- package/src/expansion-panel/expansion-panel.spec.ts +11 -0
- package/src/expansion-panel/expansion-panel.stories.js +76 -0
- package/src/expansion-panel/expansion-panel.ts +94 -0
- package/src/focused-page/focused-page.scss +113 -0
- package/src/focused-page/focused-page.spec.ts +11 -0
- package/src/focused-page/focused-page.stories.js +167 -0
- package/src/focused-page/focused-page.ts +201 -0
- package/src/formfield/formfield.scss +8 -0
- package/src/formfield/formfield.spec.ts +11 -0
- package/src/formfield/formfield.ts +24 -0
- package/src/full-screen-dialog/full-screen-dialog.scss +37 -0
- package/src/full-screen-dialog/full-screen-dialog.spec.ts +11 -0
- package/src/full-screen-dialog/full-screen-dialog.stories.js +172 -0
- package/src/full-screen-dialog/full-screen-dialog.ts +84 -0
- package/src/icon/_icon-list.ts +316 -0
- package/src/icon/icon-demo.scss +25 -0
- package/src/icon/icon-demo.ts +37 -0
- package/src/icon/icon.spec.ts +11 -0
- package/src/icon/icon.stories.js +55 -0
- package/src/icon/icon.ts +16 -0
- package/src/icon-button/_icon-button.theme.scss +9 -0
- package/src/icon-button/icon-button.scss +12 -0
- package/src/icon-button/icon-button.spec.ts +11 -0
- package/src/icon-button/icon-button.stories.js +24 -0
- package/src/icon-button/icon-button.ts +19 -0
- package/src/icon-button-toggle/icon-button-toggle.scss +19 -0
- package/src/icon-button-toggle/icon-button-toggle.spec.ts +11 -0
- package/src/icon-button-toggle/icon-button-toggle.stories.js +32 -0
- package/src/icon-button-toggle/icon-button-toggle.ts +50 -0
- package/src/icon-checkbox/icon-check-toggle.ts +64 -0
- package/src/icon-checkbox/icon-check.spec.ts +11 -0
- package/src/icon-checkbox/icon-checkbox.scss +95 -0
- package/src/icon-checkbox/icon-checkbox.stories.js +77 -0
- package/src/icon-lockup/icon-lockup.scss +47 -0
- package/src/icon-lockup/icon-lockup.spec.ts +11 -0
- package/src/icon-lockup/icon-lockup.stories.js +93 -0
- package/src/icon-lockup/icon-lockup.ts +125 -0
- package/src/icon-radio/icon-radio-toggle.ts +43 -0
- package/src/icon-radio/icon-radio.scss +63 -0
- package/src/icon-radio/icon-radio.spec.ts +11 -0
- package/src/icon-radio/icon-radio.stories.js +23 -0
- package/src/index.scss +1 -0
- package/src/index.ts +57 -0
- package/src/linear-progress/linear-progress.scss +4 -0
- package/src/linear-progress/linear-progress.spec.ts +11 -0
- package/src/linear-progress/linear-progress.stories.js +43 -0
- package/src/linear-progress/linear-progress.ts +18 -0
- package/src/list/Overview.mdx +91 -0
- package/src/list/_list.theme.scss +100 -0
- package/src/list/check-list-item.spec.ts +11 -0
- package/src/list/check-list-item.ts +25 -0
- package/src/list/list-item.scss +56 -0
- package/src/list/list-item.spec.ts +11 -0
- package/src/list/list-item.ts +31 -0
- package/src/list/list.scss +25 -0
- package/src/list/list.stories.js +120 -0
- package/src/list/list.ts +23 -0
- package/src/list/nav-list-item.scss +159 -0
- package/src/list/nav-list-item.ts +223 -0
- package/src/list/radio-list-item.ts +25 -0
- package/src/menu/menu.scss +3 -0
- package/src/menu/menu.spec.ts +11 -0
- package/src/menu/menu.stories.js +110 -0
- package/src/menu/menu.ts +23 -0
- package/src/notebook-cell/notebook-cell.scss +185 -0
- package/src/notebook-cell/notebook-cell.spec.ts +11 -0
- package/src/notebook-cell/notebook-cell.stories.js +87 -0
- package/src/notebook-cell/notebook-cell.ts +300 -0
- package/src/radio/radio.scss +3 -0
- package/src/radio/radio.spec.ts +11 -0
- package/src/radio/radio.stories.js +56 -0
- package/src/radio/radio.ts +18 -0
- package/src/select/select.scss +16 -0
- package/src/select/select.spec.ts +11 -0
- package/src/select/select.stories.js +57 -0
- package/src/select/select.ts +18 -0
- package/src/side-sheet/side-sheet.scss +49 -0
- package/src/side-sheet/side-sheet.spec.ts +11 -0
- package/src/side-sheet/side-sheet.stories.js +96 -0
- package/src/side-sheet/side-sheet.ts +37 -0
- package/src/skeleton/_skeleton.styles.scss +24 -0
- package/src/skeleton/skeleton.stories.js +77 -0
- package/src/slider/slider-range.ts +16 -0
- package/src/slider/slider.spec.ts +11 -0
- package/src/slider/slider.stories.js +54 -0
- package/src/slider/slider.ts +16 -0
- package/src/snackbar/snackbar.scss +8 -0
- package/src/snackbar/snackbar.spec.ts +11 -0
- package/src/snackbar/snackbar.stories.js +42 -0
- package/src/snackbar/snackbar.ts +18 -0
- package/src/status-dialog/status-dialog.scss +204 -0
- package/src/status-dialog/status-dialog.spec.ts +48 -0
- package/src/status-dialog/status-dialog.stories.js +136 -0
- package/src/status-dialog/status-dialog.ts +188 -0
- package/src/status-header/_status-header.theme.scss +79 -0
- package/src/status-header/status-header-base.ts +42 -0
- package/src/status-header/status-header-item.scss +17 -0
- package/src/status-header/status-header-item.spec.ts +11 -0
- package/src/status-header/status-header-item.ts +32 -0
- package/src/status-header/status-header.scss +57 -0
- package/src/status-header/status-header.spec.ts +11 -0
- package/src/status-header/status-header.stories.js +114 -0
- package/src/status-header/status-header.ts +26 -0
- package/src/switch/switch.scss +17 -0
- package/src/switch/switch.spec.ts +11 -0
- package/src/switch/switch.stories.js +41 -0
- package/src/switch/switch.ts +18 -0
- package/src/tab/Overview.mdx +38 -0
- package/src/tab/tab-bar.spec.ts +11 -0
- package/src/tab/tab-bar.ts +16 -0
- package/src/tab/tab.scss +10 -0
- package/src/tab/tab.spec.ts +11 -0
- package/src/tab/tab.stories.js +30 -0
- package/src/tab/tab.ts +18 -0
- package/src/text-lockup/text-lockup.scss +66 -0
- package/src/text-lockup/text-lockup.spec.ts +11 -0
- package/src/text-lockup/text-lockup.stories.js +67 -0
- package/src/text-lockup/text-lockup.ts +55 -0
- package/src/textarea/textarea.spec.ts +11 -0
- package/src/textarea/textarea.stories.js +39 -0
- package/src/textarea/textarea.ts +19 -0
- package/src/textfield/textfield.scss +34 -0
- package/src/textfield/textfield.spec.ts +11 -0
- package/src/textfield/textfield.stories.js +60 -0
- package/src/textfield/textfield.ts +25 -0
- package/src/theme/_index.scss +46 -0
- package/src/theme/prebuilt/dark-theme.scss +17 -0
- package/src/theme/prebuilt/light-theme.scss +17 -0
- package/src/toolbar/toolbar.scss +37 -0
- package/src/toolbar/toolbar.spec.ts +11 -0
- package/src/toolbar/toolbar.stories.js +66 -0
- package/src/toolbar/toolbar.ts +27 -0
- package/src/tooltip/tooltip.scss +16 -0
- package/src/tooltip/tooltip.spec.ts +11 -0
- package/src/tooltip/tooltip.stories.js +72 -0
- package/src/tooltip/tooltip.ts +185 -0
- package/src/top-app-bar/top-app-bar-fixed.ts +23 -0
- package/src/top-app-bar/top-app-bar.scss +14 -0
- package/src/top-app-bar/top-app-bar.spec.ts +11 -0
- package/src/top-app-bar/top-app-bar.stories.js +41 -0
- package/src/top-app-bar/top-app-bar.ts +23 -0
- package/src/tree-list/tree-list-item.scss +96 -0
- package/src/tree-list/tree-list-item.spec.ts +11 -0
- package/src/tree-list/tree-list-item.ts +87 -0
- package/src/tree-list/tree-list.scss +13 -0
- package/src/tree-list/tree-list.spec.ts +11 -0
- package/src/tree-list/tree-list.stories.js +151 -0
- package/src/tree-list/tree-list.ts +53 -0
- package/src/typography/typography.scss +45 -0
- package/src/typography/typography.spec.ts +11 -0
- package/src/typography/typography.stories.js +23 -0
- package/src/typography/typography.ts +27 -0
- package/stories/Introduction.mdx +47 -0
- package/stories/color-use.mdx +509 -0
- package/stories/demos/dialog.component.html +187 -0
- package/stories/demos/dialog.component.js +57 -0
- package/stories/demos/grid.content.html +99 -0
- package/stories/demos/lorem-ipsum.content.html +338 -0
- package/stories/demos/material-web.content.html +2125 -0
- package/stories/demos/table-column-sorting.content.html +92 -0
- package/stories/demos/table-pagination.content.html +139 -0
- package/stories/demos/table-progress-indicator.content.html +77 -0
- package/stories/demos/table-row-selection.content.html +219 -0
- package/stories/demos/table.content.html +64 -0
- package/stories/demos/top-app-bar.component.js +57 -0
- package/stories/guide-representing-state.mdx +282 -0
- package/stories/info-and-help.mdx +484 -0
- package/stories/item-detail-and-editing.mdx +529 -0
- package/stories/markdown-elements.mdx +194 -0
- package/stories/writing-and-naming.mdx +157 -0
- package/tsconfig.json +34 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.spec.json +14 -0
- package/types.d.ts +15 -0
- package/vite.config.js +58 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { LitElement, html, css, unsafeCSS, PropertyValues } from 'lit';
|
|
2
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import styles from './icon-lockup.scss?inline';
|
|
5
|
+
import '../typography/typography';
|
|
6
|
+
import '../icon/icon';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Icon lockup
|
|
10
|
+
*
|
|
11
|
+
* @slot icon - Slot for a custom icon. If provided, this slot content replaces the `icon` property.
|
|
12
|
+
*/
|
|
13
|
+
@customElement('cv-icon-lockup')
|
|
14
|
+
export class CovalentIconLockup extends LitElement {
|
|
15
|
+
static override styles = [
|
|
16
|
+
css`
|
|
17
|
+
${unsafeCSS(styles)}
|
|
18
|
+
`,
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether the icon is a covalent icon.
|
|
23
|
+
*/
|
|
24
|
+
@property({ type: Boolean, reflect: true })
|
|
25
|
+
covalentIcon = false;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Whether the icon is filled.
|
|
29
|
+
*/
|
|
30
|
+
@property({ type: Boolean, reflect: true })
|
|
31
|
+
filledIcon = false;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The icon to display.
|
|
35
|
+
*/
|
|
36
|
+
@property({ type: String })
|
|
37
|
+
icon = '';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Scale of the component, controlling font-size and icon size.
|
|
41
|
+
* Default is "1", but it can be set to other values to scale the component.
|
|
42
|
+
*/
|
|
43
|
+
@property({ type: String })
|
|
44
|
+
scale = 'body1';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* State of the component, used to apply different styles based on status.
|
|
48
|
+
* Example values might include "success", "error", etc.
|
|
49
|
+
*/
|
|
50
|
+
@property({ type: String })
|
|
51
|
+
state = 'neutral';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* If true, the icon is displayed after the text (trailing).
|
|
55
|
+
* If false, the icon is displayed before the text.
|
|
56
|
+
*/
|
|
57
|
+
@property({ type: Boolean })
|
|
58
|
+
trailingIcon = false;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Tracks if the icon slot has content.
|
|
62
|
+
*/
|
|
63
|
+
@state() private _hasIconSlot = false;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Checks if there is content in the icon slot and updates `hasIconSlot`.
|
|
67
|
+
*/
|
|
68
|
+
private checkIconSlot() {
|
|
69
|
+
const slot = this.shadowRoot?.querySelector(
|
|
70
|
+
'slot[name="icon"]'
|
|
71
|
+
) as HTMLSlotElement;
|
|
72
|
+
this._hasIconSlot = slot && slot.assignedNodes().length > 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Template method for rendering the icon. If content is provided in the
|
|
77
|
+
* `icon` slot, it is displayed instead of the `icon` property.
|
|
78
|
+
*/
|
|
79
|
+
private iconTemplate() {
|
|
80
|
+
const classes = {
|
|
81
|
+
'covalent-icon': this.covalentIcon,
|
|
82
|
+
filled: this.filledIcon,
|
|
83
|
+
hidden: this._hasIconSlot,
|
|
84
|
+
};
|
|
85
|
+
return html`<slot name="icon"></slot>
|
|
86
|
+
<cv-icon
|
|
87
|
+
class=${classMap(classes)}
|
|
88
|
+
style="${`font-size: var(--cv-typography-${this.scale}-line-height, 16px)`}"
|
|
89
|
+
>
|
|
90
|
+
${this.icon}
|
|
91
|
+
</cv-icon>`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Renders the component with icon and text. If `trailingIcon` is true,
|
|
96
|
+
* the icon is displayed after the text. Otherwise, it is displayed before.
|
|
97
|
+
*/
|
|
98
|
+
render() {
|
|
99
|
+
const classes = {
|
|
100
|
+
'icon-lockup': true,
|
|
101
|
+
[`icon-lockup--${this.state}`]: this.state,
|
|
102
|
+
'trailing-icon': this.trailingIcon,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return html`
|
|
106
|
+
<cv-typography class=${classMap(classes)} scale="${this.scale}">
|
|
107
|
+
${this.iconTemplate()}
|
|
108
|
+
<div class="text"><slot></slot></div>
|
|
109
|
+
</cv-typography>
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
protected override updated(_changedProperties: PropertyValues): void {
|
|
114
|
+
super.updated(_changedProperties);
|
|
115
|
+
this.checkIconSlot();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare global {
|
|
120
|
+
interface HTMLElementTagNameMap {
|
|
121
|
+
'cv-icon-lockup': CovalentIconLockup;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default CovalentIconLockup;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { css, html, TemplateResult, unsafeCSS } from 'lit';
|
|
2
|
+
import { RadioBase } from '@material/mwc-radio/mwc-radio-base';
|
|
3
|
+
import { styles as radioStyle } from '@material/mwc-radio/mwc-radio.css';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import styles from './icon-radio.scss?inline';
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'cv-icon-radio-item': CovalentIconRadioToggle;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@customElement('cv-radio-icon')
|
|
14
|
+
export class CovalentIconRadioToggle extends RadioBase {
|
|
15
|
+
static override styles = [
|
|
16
|
+
radioStyle,
|
|
17
|
+
css`
|
|
18
|
+
${unsafeCSS(styles)}
|
|
19
|
+
`,
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
@property({ type: Boolean }) iconOnly = false;
|
|
23
|
+
|
|
24
|
+
// Override the renderRipple method to minimally introduce the icon & text slots without overwritting the render method
|
|
25
|
+
protected override renderRipple(): TemplateResult | string {
|
|
26
|
+
const iconSlot = html`<slot name="icon"></slot>`;
|
|
27
|
+
const textSlot = this.iconOnly
|
|
28
|
+
? ''
|
|
29
|
+
: html`<div><slot name="text"></slot></div>`;
|
|
30
|
+
const ripple = this.shouldRenderRipple
|
|
31
|
+
? html`<mwc-ripple
|
|
32
|
+
accent
|
|
33
|
+
.internalUseStateLayerCustomProperties="${this
|
|
34
|
+
.useStateLayerCustomProperties}"
|
|
35
|
+
.disabled="${this.disabled}"
|
|
36
|
+
></mwc-ripple>`
|
|
37
|
+
: '';
|
|
38
|
+
|
|
39
|
+
return html`${iconSlot}${textSlot}${ripple}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default CovalentIconRadioToggle;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--mdc-radio-unchecked-color: var(--mdc-theme-text-icon-on-background);
|
|
3
|
+
|
|
4
|
+
.mdc-radio__background {
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 8px;
|
|
7
|
+
right: 8px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([width='fill']) {
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mdc-radio {
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
text-align: center;
|
|
21
|
+
row-gap: 8px;
|
|
22
|
+
width: var(--cv-icon-radio-width, 200px);
|
|
23
|
+
height: var(--cv-icon-radio-height, 160px);
|
|
24
|
+
border: solid 2px var(--mdc-theme-border);
|
|
25
|
+
border-radius: 8px;
|
|
26
|
+
color: var(--mdc-theme-text-primary-on-background);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.mdc-radio--touch .mdc-radio__native-control {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([checked]) .mdc-radio {
|
|
35
|
+
border: solid 2px var(--mdc-theme-primary);
|
|
36
|
+
background-color: var(--mdc-theme-surface-primary-highlight);
|
|
37
|
+
|
|
38
|
+
&:hover {
|
|
39
|
+
background-color: var(--mdc-theme-surface-primary-highlight-hover);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[name='icon']::slotted(*) {
|
|
44
|
+
font-size: 40px;
|
|
45
|
+
color: var(--mdc-theme-text-icon-on-background);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[name='text']::slotted(*) {
|
|
49
|
+
color: var(--mdc-theme-text-primary-on-background);
|
|
50
|
+
font-family: var(--mdc-typography-body1-font-family);
|
|
51
|
+
font-size: var(--mdc-typography-body1-font-size);
|
|
52
|
+
font-weight: var(--mdc-typography-body1-font-weight);
|
|
53
|
+
line-height: var(--mdc-typography-body1-line-height);
|
|
54
|
+
letter-spacing: 0.4px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[name='text']::slotted(*:last-child) {
|
|
58
|
+
color: var(--mdc-theme-text-secondary-on-background);
|
|
59
|
+
font-family: var(--mdc-typography-body2-font-family);
|
|
60
|
+
font-size: var(--mdc-typography-body2-font-size);
|
|
61
|
+
font-weight: var(--mdc-typography-body2-font-weight);
|
|
62
|
+
line-height: var(--mdc-typography-body2-line-height);
|
|
63
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import { it, describe, expect } from 'vitest';
|
|
5
|
+
import { CovalentIconRadioToggle } from './icon-radio-toggle';
|
|
6
|
+
|
|
7
|
+
describe('Icon radio', () => {
|
|
8
|
+
it('should work', () => {
|
|
9
|
+
expect(new CovalentIconRadioToggle()).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import './icon-radio-toggle';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Icon Radio',
|
|
5
|
+
args: {
|
|
6
|
+
iconOnly: false,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Template = ({ iconOnly }) => {
|
|
11
|
+
return `
|
|
12
|
+
<cv-radio-icon ${iconOnly ? 'iconOnly' : ''}>
|
|
13
|
+
<cv-icon slot="icon">work</cv-icon>
|
|
14
|
+
<div slot="text">Balanced</div>
|
|
15
|
+
<div slot="text">Every week</div>
|
|
16
|
+
</cv-radio-icon>
|
|
17
|
+
<cv-radio-icon ${iconOnly ? 'iconOnly' : ''}>
|
|
18
|
+
<cv-icon slot="icon">work</cv-icon>
|
|
19
|
+
<div slot="text">Balanced</div>
|
|
20
|
+
<div slot="text">Every week</div>
|
|
21
|
+
</cv-radio-icon>
|
|
22
|
+
`;
|
|
23
|
+
};
|
package/src/index.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward './theme' show components-theme;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export * from './action-ribbon/action-ribbon';
|
|
2
|
+
export * from './alert/alert';
|
|
3
|
+
export * from './app-shell/app-shell';
|
|
4
|
+
export * from './badge/badge';
|
|
5
|
+
export * from './button/button';
|
|
6
|
+
export * from './card/card';
|
|
7
|
+
export * from './checkbox/checkbox';
|
|
8
|
+
export * from './list/check-list-item';
|
|
9
|
+
export * from './chips/chip';
|
|
10
|
+
export * from './chips/chip-set';
|
|
11
|
+
export * from './circular-progress/circular-progress';
|
|
12
|
+
export * from './code-editor/code-editor';
|
|
13
|
+
export * from './code-snippet/code-snippet';
|
|
14
|
+
export * from './dialog/dialog';
|
|
15
|
+
export * from './drawer/drawer';
|
|
16
|
+
export * from './empty-state/empty-state';
|
|
17
|
+
export * from './expansion-panel/expansion-panel';
|
|
18
|
+
export * from './expansion-panel/expansion-panel-item';
|
|
19
|
+
export * from './focused-page/focused-page';
|
|
20
|
+
export * from './formfield/formfield';
|
|
21
|
+
export * from './full-screen-dialog/full-screen-dialog';
|
|
22
|
+
export * from './icon/icon';
|
|
23
|
+
export * from './icon/icon-demo';
|
|
24
|
+
export * from './icon-button/icon-button';
|
|
25
|
+
export * from './icon-button-toggle/icon-button-toggle';
|
|
26
|
+
export * from './icon-checkbox/icon-check-toggle';
|
|
27
|
+
export * from './icon-lockup/icon-lockup';
|
|
28
|
+
export * from './icon-radio/icon-radio-toggle';
|
|
29
|
+
export * from './linear-progress/linear-progress';
|
|
30
|
+
export * from './list/list';
|
|
31
|
+
export * from './list/list-item';
|
|
32
|
+
export * from './menu/menu';
|
|
33
|
+
export * from './list/nav-list-item';
|
|
34
|
+
export * from './notebook-cell/notebook-cell';
|
|
35
|
+
export * from './radio/radio';
|
|
36
|
+
export * from './list/radio-list-item';
|
|
37
|
+
export * from './select/select';
|
|
38
|
+
export * from './side-sheet/side-sheet';
|
|
39
|
+
export * from './slider/slider';
|
|
40
|
+
export * from './slider/slider-range';
|
|
41
|
+
export * from './snackbar/snackbar';
|
|
42
|
+
export * from './status-dialog/status-dialog';
|
|
43
|
+
export * from './status-header/status-header';
|
|
44
|
+
export * from './status-header/status-header-item';
|
|
45
|
+
export * from './switch/switch';
|
|
46
|
+
export * from './tab/tab';
|
|
47
|
+
export * from './tab/tab-bar';
|
|
48
|
+
export * from './textarea/textarea';
|
|
49
|
+
export * from './textfield/textfield';
|
|
50
|
+
export * from './text-lockup/text-lockup';
|
|
51
|
+
export * from './toolbar/toolbar';
|
|
52
|
+
export * from './tooltip/tooltip';
|
|
53
|
+
export * from './top-app-bar/top-app-bar';
|
|
54
|
+
export * from './top-app-bar/top-app-bar-fixed';
|
|
55
|
+
export * from './tree-list/tree-list';
|
|
56
|
+
export * from './tree-list/tree-list-item';
|
|
57
|
+
export * from './typography/typography';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import { it, describe, expect } from 'vitest';
|
|
5
|
+
import { CovalentLinearProgress } from './linear-progress';
|
|
6
|
+
|
|
7
|
+
describe('Linear progress', () => {
|
|
8
|
+
it('should work', () => {
|
|
9
|
+
expect(new CovalentLinearProgress()).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import './linear-progress';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Linear Progress',
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: 'padded',
|
|
7
|
+
// disables Chromatic's snapshotting on a story level
|
|
8
|
+
chromatic: { disableSnapshot: true },
|
|
9
|
+
},
|
|
10
|
+
argTypes: {
|
|
11
|
+
progress: {
|
|
12
|
+
control: { type: 'range', max: 1, min: 0, step: 0.1 },
|
|
13
|
+
},
|
|
14
|
+
buffer: {
|
|
15
|
+
control: { type: 'range', max: 1, min: 0, step: 0.1 },
|
|
16
|
+
},
|
|
17
|
+
reverse: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = ({ indeterminate, buffer, progress, reverse }) => {
|
|
24
|
+
const progressBar = document.createElement('cv-linear-progress');
|
|
25
|
+
progressBar.indeterminate = indeterminate;
|
|
26
|
+
progressBar.buffer = buffer;
|
|
27
|
+
progressBar.progress = progress;
|
|
28
|
+
progressBar.reverse = reverse;
|
|
29
|
+
progressBar.ariaLabel = 'Example progress bar'
|
|
30
|
+
|
|
31
|
+
return progressBar;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Indeterminate = Template.bind({});
|
|
35
|
+
Indeterminate.args = {
|
|
36
|
+
indeterminate: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Determinate = Template.bind({});
|
|
40
|
+
Determinate.args = {
|
|
41
|
+
progress: 0.5,
|
|
42
|
+
buffer: 0.5,
|
|
43
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { LinearProgressBase } from '@material/mwc-linear-progress/mwc-linear-progress-base';
|
|
4
|
+
import { styles as baseStyles } from '@material/mwc-linear-progress/mwc-linear-progress.css';
|
|
5
|
+
import styles from './linear-progress.scss?inline';
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'cv-linear-progress': CovalentLinearProgress;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@customElement('cv-linear-progress')
|
|
14
|
+
export class CovalentLinearProgress extends LinearProgressBase {
|
|
15
|
+
static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default CovalentLinearProgress;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Canvas, DocsContainer, Meta, Story } from '@storybook/blocks';
|
|
2
|
+
import * as ListStories from './list.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={ListStories} />
|
|
5
|
+
|
|
6
|
+
<style>
|
|
7
|
+
{`
|
|
8
|
+
.docs-story > div:first-of-type .innerZoomElementWrapper > div {
|
|
9
|
+
border: none !important;
|
|
10
|
+
}
|
|
11
|
+
.docs-story mwc-list {
|
|
12
|
+
margin: 0 auto;
|
|
13
|
+
max-width: 30rem;
|
|
14
|
+
}
|
|
15
|
+
`}
|
|
16
|
+
</style>
|
|
17
|
+
|
|
18
|
+
# Lists
|
|
19
|
+
|
|
20
|
+
## Anatomy
|
|
21
|
+
|
|
22
|
+
A list item may contain:
|
|
23
|
+
|
|
24
|
+
- 1, 2 or 3 lines of text
|
|
25
|
+
- A leading icon or avatar image
|
|
26
|
+
- A trailing icon
|
|
27
|
+
|
|
28
|
+
<Canvas>
|
|
29
|
+
<cv-list>
|
|
30
|
+
<cv-list-item graphic="avatar" hasMeta twoline>
|
|
31
|
+
<span>Two-line list item</span>
|
|
32
|
+
<span slot="secondary">Secondary line</span>
|
|
33
|
+
<cv-icon slot="graphic">folder</cv-icon>
|
|
34
|
+
<cv-icon slot="meta">help</cv-icon>
|
|
35
|
+
</cv-list-item>
|
|
36
|
+
</cv-list>
|
|
37
|
+
</Canvas>
|
|
38
|
+
|
|
39
|
+
## Displaying status
|
|
40
|
+
|
|
41
|
+
Show as a byline in your list item. Do not use the main icon or avatar - this is reserved for showing object type.
|
|
42
|
+
|
|
43
|
+
<Canvas>
|
|
44
|
+
<cv-list>
|
|
45
|
+
<cv-list-item twoline graphic="avatar">
|
|
46
|
+
<span>User Name</span>
|
|
47
|
+
|
|
48
|
+
<span slot="secondary" class="status-caution">
|
|
49
|
+
<cv-icon>warning</cv-icon>
|
|
50
|
+
Warning
|
|
51
|
+
</span>
|
|
52
|
+
|
|
53
|
+
<cv-icon slot="graphic" class="inverted">
|
|
54
|
+
tag\_faces
|
|
55
|
+
</cv-icon>
|
|
56
|
+
</cv-list-item>
|
|
57
|
+
|
|
58
|
+
<li divider role="separator" />
|
|
59
|
+
|
|
60
|
+
<cv-list-item twoline graphic="avatar">
|
|
61
|
+
<span>User Name</span>
|
|
62
|
+
|
|
63
|
+
<span slot="secondary" class="status-negative">
|
|
64
|
+
<cv-icon>error</cv-icon>
|
|
65
|
+
Error
|
|
66
|
+
</span>
|
|
67
|
+
|
|
68
|
+
<cv-icon slot="graphic" class="inverted">
|
|
69
|
+
tag\_faces
|
|
70
|
+
</cv-icon>
|
|
71
|
+
</cv-list-item>
|
|
72
|
+
|
|
73
|
+
<li divider role="separator" />
|
|
74
|
+
|
|
75
|
+
<cv-list-item twoline graphic="avatar">
|
|
76
|
+
<span>User Name</span>
|
|
77
|
+
|
|
78
|
+
<span slot="secondary" class="status-positive">
|
|
79
|
+
<cv-icon>check</cv-icon>
|
|
80
|
+
Successful
|
|
81
|
+
</span>
|
|
82
|
+
|
|
83
|
+
<cv-icon slot="graphic" class="inverted">
|
|
84
|
+
tag\_faces
|
|
85
|
+
</cv-icon>
|
|
86
|
+
</cv-list-item>
|
|
87
|
+
|
|
88
|
+
<li divider role="separator" />
|
|
89
|
+
|
|
90
|
+
</cv-list>
|
|
91
|
+
</Canvas>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@use '@material/list' as list;
|
|
2
|
+
@use '@material/list/evolution-mixins' as evolution-mixins;
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
$border: var(--mdc-theme-border);
|
|
6
|
+
$text: var(--mdc-theme-on-surface-variant);
|
|
7
|
+
|
|
8
|
+
--mdc-list-single-line-height: 48px;
|
|
9
|
+
--mdc-list-two-line-height: 72px;
|
|
10
|
+
|
|
11
|
+
// --- web component --- //
|
|
12
|
+
|
|
13
|
+
@include list.deprecated-divider-color($border);
|
|
14
|
+
@include evolution-mixins.divider-color($border);
|
|
15
|
+
|
|
16
|
+
// Menu
|
|
17
|
+
.mdc-menu .mdc-deprecated-list {
|
|
18
|
+
@include list.deprecated-item-primary-text-ink-color($text);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// --- non-web component --- //
|
|
22
|
+
|
|
23
|
+
.mdc-list {
|
|
24
|
+
@include evolution-mixins.one-line-item-height(
|
|
25
|
+
var(--mdc-list-single-line-height, 48px)
|
|
26
|
+
);
|
|
27
|
+
@include evolution-mixins.two-line-item-height(
|
|
28
|
+
var(--mdc-list-two-line-height, 72px)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
.mdc-list-item {
|
|
32
|
+
height: var(--mdc-list-single-line-height, 48px);
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.mdc-list--two-line .mdc-list-item {
|
|
39
|
+
height: var(--mdc-list-two-line-height, 72px);
|
|
40
|
+
|
|
41
|
+
.mdc-list-item__primary-text {
|
|
42
|
+
display: block;
|
|
43
|
+
margin-bottom: -8px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.mdc-deprecated-list.mdc-deprecated-list--avatar-list
|
|
49
|
+
.mdc-deprecated-list-item__graphic,
|
|
50
|
+
cv-list-item[graphic='avatar'] cv-icon[slot='graphic'] {
|
|
51
|
+
background-color: var(--mdc-theme-surface-neutral-highlight);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
cv-list-item,
|
|
55
|
+
cv-check-list-item,
|
|
56
|
+
.mdc-list,
|
|
57
|
+
.cv-list-item,
|
|
58
|
+
.mdc-deprecated-list,
|
|
59
|
+
.mdc-deprecated-list-item__text,
|
|
60
|
+
.mdc-list-item__primary-text {
|
|
61
|
+
font-family: var(--mdc-typography-font-family);
|
|
62
|
+
font-size: var(--mdc-typography-body1-font-size);
|
|
63
|
+
font-weight: var(--mdc-typography-body1-font-weight);
|
|
64
|
+
line-height: var(--mdc-typography-body1-line-height);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
cv-list-item {
|
|
68
|
+
span[slot='secondary'] {
|
|
69
|
+
cv-icon {
|
|
70
|
+
font-size: 1rem;
|
|
71
|
+
margin-right: 0.25rem;
|
|
72
|
+
position: relative;
|
|
73
|
+
top: 3px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.status-caution {
|
|
77
|
+
color: var(--mdc-theme-caution);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.status-negative {
|
|
81
|
+
color: var(--mdc-theme-negative);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.status-positive {
|
|
85
|
+
color: var(--mdc-theme-positive);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.beta-list-item {
|
|
91
|
+
--mdc-theme-primary: #{var(--mdc-theme-surface-caution)};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Divider
|
|
95
|
+
[divider] {
|
|
96
|
+
border-bottom: 1px solid;
|
|
97
|
+
list-style: none;
|
|
98
|
+
border-color: var(--mdc-theme-border, rgba(black, 0.12));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import { it, describe, expect } from 'vitest';
|
|
5
|
+
import { CovalentCheckListItem } from './check-list-item';
|
|
6
|
+
|
|
7
|
+
describe('Check list expansion item', () => {
|
|
8
|
+
it('should work', () => {
|
|
9
|
+
expect(new CovalentCheckListItem()).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CheckListItemBase } from '@material/mwc-list/mwc-check-list-item-base';
|
|
2
|
+
import { styles as controlStyle } from '@material/mwc-list/mwc-control-list-item.css';
|
|
3
|
+
import { styles } from '@material/mwc-list/mwc-list-item.css';
|
|
4
|
+
import covalentStyles from './list-item.scss?inline';
|
|
5
|
+
import { customElement } from 'lit/decorators.js';
|
|
6
|
+
import { css, unsafeCSS } from 'lit';
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'cv-check-list-item': CovalentCheckListItem;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@customElement('cv-check-list-item')
|
|
15
|
+
export class CovalentCheckListItem extends CheckListItemBase {
|
|
16
|
+
static override styles = [
|
|
17
|
+
styles,
|
|
18
|
+
controlStyle,
|
|
19
|
+
css`
|
|
20
|
+
${unsafeCSS(covalentStyles)}
|
|
21
|
+
`,
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default CovalentCheckListItem;
|