@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,56 @@
|
|
1
|
+
import './radio';
|
2
|
+
import '../formfield/formfield';
|
3
|
+
|
4
|
+
export default {
|
5
|
+
title: 'Components/Radio',
|
6
|
+
argTypes: {},
|
7
|
+
};
|
8
|
+
|
9
|
+
const Template = ({ disabled }) => {
|
10
|
+
return `<cv-radio
|
11
|
+
${disabled ? `disabled` : null}>
|
12
|
+
</cv-radio>
|
13
|
+
<cv-radio
|
14
|
+
checked
|
15
|
+
${disabled ? `disabled` : null}>
|
16
|
+
</cv-radio>
|
17
|
+
<cv-radio
|
18
|
+
indeterminate
|
19
|
+
${disabled ? `disabled` : null}>
|
20
|
+
</cv-radio>`;
|
21
|
+
};
|
22
|
+
|
23
|
+
const LabelTemplate = ({ label = 'Bananas', indeterminate }) => {
|
24
|
+
return `
|
25
|
+
<style>
|
26
|
+
cv-formfield {
|
27
|
+
display: block;
|
28
|
+
}
|
29
|
+
.child {
|
30
|
+
margin-left: 20px;
|
31
|
+
}
|
32
|
+
</style>
|
33
|
+
<cv-formfield label="${label}">
|
34
|
+
<cv-radio ${indeterminate ? `indeterminate` : null}></cv-radio>
|
35
|
+
</cv-formfield>
|
36
|
+
|
37
|
+
<cv-formfield label="${label}">
|
38
|
+
<cv-radio class="child"></cv-radio>
|
39
|
+
</cv-formfield>
|
40
|
+
|
41
|
+
<cv-formfield label="${label}">
|
42
|
+
<cv-radio class="child" checked></cv-radio>
|
43
|
+
</cv-formfield>`;
|
44
|
+
};
|
45
|
+
|
46
|
+
export const Basic = Template.bind({});
|
47
|
+
|
48
|
+
export const Disabled = Template.bind({});
|
49
|
+
Disabled.args = {
|
50
|
+
disabled: true,
|
51
|
+
};
|
52
|
+
|
53
|
+
export const WithLabel = LabelTemplate.bind({});
|
54
|
+
WithLabel.args = {
|
55
|
+
indeterminate: true,
|
56
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
import { RadioBase } from '@material/mwc-radio/mwc-radio-base';
|
4
|
+
import { styles as baseStyles } from '@material/mwc-radio/mwc-radio.css';
|
5
|
+
import styles from './radio.scss?inline';
|
6
|
+
|
7
|
+
declare global {
|
8
|
+
interface HTMLElementTagNameMap {
|
9
|
+
'cv-radio': CovalentRadio;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
@customElement('cv-radio')
|
14
|
+
export class CovalentRadio extends RadioBase {
|
15
|
+
static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
|
16
|
+
}
|
17
|
+
|
18
|
+
export default CovalentRadio;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
:host {
|
2
|
+
--mdc-select-idle-line-color: var(--mdc-theme-border);
|
3
|
+
--mdc-select-hover-line-color: var(--mdc-theme-text-icon-on-background);
|
4
|
+
--mdc-select-fill-color: var(--mdc-theme-surface-canvas);
|
5
|
+
--mdc-select-ink-color: var(--mdc-theme-text-primary-on-background);
|
6
|
+
--mdc-select-label-ink-color: var(--mdc-theme-text-secondary-on-background);
|
7
|
+
--mdc-select-outlined-idle-border-color: var(--mdc-theme-border);
|
8
|
+
--mdc-select-outlined-hover-border-color: var(
|
9
|
+
--mdc-theme-text-icon-on-background
|
10
|
+
);
|
11
|
+
--mdc-select-dropdown-icon-color: var(--mdc-theme-text-icon-on-background);
|
12
|
+
|
13
|
+
.mdc-select:not(.mdc-select--disabled) .mdc-select__icon {
|
14
|
+
color: var(--mdc-select-dropdown-icon-color);
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import './select';
|
2
|
+
import '../list/list-item';
|
3
|
+
|
4
|
+
export default {
|
5
|
+
title: 'Components/Select',
|
6
|
+
argTypes: {
|
7
|
+
style: {
|
8
|
+
options: ['outlined', 'filled'],
|
9
|
+
control: { type: 'radio' },
|
10
|
+
},
|
11
|
+
},
|
12
|
+
args: {
|
13
|
+
style: 'outlined',
|
14
|
+
},
|
15
|
+
};
|
16
|
+
|
17
|
+
const Template = ({ icon, style, required, helper }) => {
|
18
|
+
return `
|
19
|
+
<cv-select
|
20
|
+
label="${style}"
|
21
|
+
validationMessage="This Field is Required"
|
22
|
+
${style}
|
23
|
+
${icon ? `icon="${icon}"` : null}
|
24
|
+
${helper ? `helper="${helper}"` : null}
|
25
|
+
${required ? `required` : null}>
|
26
|
+
<cv-list-item selected></cv-list-item>
|
27
|
+
<cv-list-item ${
|
28
|
+
icon ? `graphic="icon"` : null
|
29
|
+
} value="0">Item 0</cv-list-item>
|
30
|
+
<cv-list-item ${
|
31
|
+
icon ? `graphic="icon"` : null
|
32
|
+
} value="1">Item 1</cv-list-item>
|
33
|
+
<cv-list-item ${
|
34
|
+
icon ? `graphic="icon"` : null
|
35
|
+
} value="2">Item 2</cv-list-item>
|
36
|
+
<cv-list-item ${
|
37
|
+
icon ? `graphic="icon"` : null
|
38
|
+
} value="3">Item 3</cv-list-item>
|
39
|
+
</cv-select>`;
|
40
|
+
};
|
41
|
+
|
42
|
+
export const Basic = Template.bind({});
|
43
|
+
|
44
|
+
export const Required = Template.bind({});
|
45
|
+
Required.args = {
|
46
|
+
required: true,
|
47
|
+
};
|
48
|
+
|
49
|
+
export const Icon = Template.bind({});
|
50
|
+
Icon.args = {
|
51
|
+
icon: 'event',
|
52
|
+
};
|
53
|
+
|
54
|
+
export const HelperText = Template.bind({});
|
55
|
+
HelperText.args = {
|
56
|
+
helper: 'Helper Text',
|
57
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
import { SelectBase } from '@material/mwc-select/mwc-select-base';
|
4
|
+
import { styles as baseStyles } from '@material/mwc-select/mwc-select.css';
|
5
|
+
import styles from './select.scss?inline';
|
6
|
+
|
7
|
+
declare global {
|
8
|
+
interface HTMLElementTagNameMap {
|
9
|
+
'cv-select': CovalentSelect;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
@customElement('cv-select')
|
14
|
+
export class CovalentSelect extends SelectBase {
|
15
|
+
static override styles = [css`${unsafeCSS(styles)}`, baseStyles];
|
16
|
+
}
|
17
|
+
|
18
|
+
export default CovalentSelect;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
:host {
|
2
|
+
--cv-side-sheet-width: 800px;
|
3
|
+
--mdc-dialog-heading-ink-color: var(--mdc-theme-text-primary-on-background);
|
4
|
+
}
|
5
|
+
|
6
|
+
.mdc-dialog {
|
7
|
+
justify-content: flex-end;
|
8
|
+
|
9
|
+
.mdc-dialog__surface {
|
10
|
+
border-radius: 0;
|
11
|
+
height: 100%;
|
12
|
+
min-height: inherit;
|
13
|
+
max-height: inherit;
|
14
|
+
min-width: var(--cv-side-sheet-width, 400px);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
.mdc-dialog--opening {
|
19
|
+
.mdc-dialog__container {
|
20
|
+
transform: translate(100%, 0);
|
21
|
+
transition: transform 150ms cubic-bezier(0.4, 0, 1, 1);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
.mdc-dialog--open {
|
26
|
+
.mdc-dialog__container {
|
27
|
+
transform: translate(0);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
.mdc-dialog--closing {
|
32
|
+
.mdc-dialog__container {
|
33
|
+
opacity: 1;
|
34
|
+
transform: translate(100%, 0);
|
35
|
+
transition: transform 150ms cubic-bezier(0, 0, 0.2, 1);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
:host([pushed]) {
|
40
|
+
.mdc-dialog__surface {
|
41
|
+
min-width: 100vw;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
:host([noPadding]) {
|
46
|
+
.mdc-dialog .mdc-dialog__content {
|
47
|
+
padding: 0;
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @vitest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { it, describe, expect } from 'vitest';
|
5
|
+
import { CovalentSideSheet } from './side-sheet';
|
6
|
+
|
7
|
+
describe('Side sheet', () => {
|
8
|
+
it('should work', () => {
|
9
|
+
expect(new CovalentSideSheet()).toBeDefined();
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import './side-sheet';
|
2
|
+
import '../button/button';
|
3
|
+
import { Active as ActiveStatusHeader } from '../status-header/status-header.stories';
|
4
|
+
import tableRowSelectionContent from '../../stories/demos/table-row-selection.content.html?raw';
|
5
|
+
import '../data-table/data-table.stories.scss';
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'Components/Side sheet',
|
9
|
+
argTypes: { onClick: { action: 'clicked' } },
|
10
|
+
parameters: {
|
11
|
+
actions: {
|
12
|
+
handles: ['click cv-button'],
|
13
|
+
},
|
14
|
+
},
|
15
|
+
};
|
16
|
+
|
17
|
+
export const Basic = () => {
|
18
|
+
document.addEventListener(
|
19
|
+
'DOMContentLoaded',
|
20
|
+
() => {
|
21
|
+
const sideSheet = document.querySelector('cv-side-sheet');
|
22
|
+
document
|
23
|
+
.querySelector('cv-button')
|
24
|
+
?.addEventListener('click', () =>
|
25
|
+
sideSheet?.open ? sideSheet.close() : sideSheet?.show()
|
26
|
+
);
|
27
|
+
},
|
28
|
+
{ once: true }
|
29
|
+
);
|
30
|
+
return `
|
31
|
+
<cv-button raised>Open side sheet</cv-button>
|
32
|
+
<cv-side-sheet heading="Sample side sheet">
|
33
|
+
</cv-side-sheet>
|
34
|
+
`;
|
35
|
+
};
|
36
|
+
|
37
|
+
export const Multiple = () => {
|
38
|
+
document.addEventListener(
|
39
|
+
'DOMContentLoaded',
|
40
|
+
() => {
|
41
|
+
const sideSheet = document.querySelector('#parentSideSheet');
|
42
|
+
const childSideSheet = document.querySelector('#childSideSheet');
|
43
|
+
|
44
|
+
document
|
45
|
+
.querySelector('#parentTarget')
|
46
|
+
?.addEventListener('click', () =>
|
47
|
+
sideSheet?.open ? sideSheet.close() : sideSheet?.show()
|
48
|
+
);
|
49
|
+
document
|
50
|
+
.querySelector('#childTarget')
|
51
|
+
?.addEventListener('click', () =>
|
52
|
+
childSideSheet?.open ? childSideSheet.close() : childSideSheet?.show()
|
53
|
+
);
|
54
|
+
},
|
55
|
+
{ once: true }
|
56
|
+
);
|
57
|
+
return `
|
58
|
+
<cv-button id="parentTarget" raised>Open side sheet</cv-button>
|
59
|
+
<cv-side-sheet id="parentSideSheet" heading="Sample side sheet">
|
60
|
+
<cv-button id="childTarget" raised>Open child</cv-button>
|
61
|
+
</cv-side-sheet>
|
62
|
+
<cv-side-sheet id="childSideSheet" heading="Child side sheet" >
|
63
|
+
</cv-side-sheet>
|
64
|
+
`;
|
65
|
+
};
|
66
|
+
|
67
|
+
export const StatusHeader = () => {
|
68
|
+
document.addEventListener(
|
69
|
+
'DOMContentLoaded',
|
70
|
+
() => {
|
71
|
+
const sideSheet = document.querySelector('cv-side-sheet');
|
72
|
+
console.log(sideSheet);
|
73
|
+
document
|
74
|
+
.querySelector('cv-button')
|
75
|
+
?.addEventListener('click', () =>
|
76
|
+
sideSheet?.open ? sideSheet.close() : sideSheet?.show()
|
77
|
+
);
|
78
|
+
},
|
79
|
+
{ once: true }
|
80
|
+
);
|
81
|
+
return `
|
82
|
+
<style>
|
83
|
+
cv-side-sheet {
|
84
|
+
--cv-side-sheet-width: 800px;
|
85
|
+
}
|
86
|
+
</style>
|
87
|
+
<cv-button raised>Open side sheet</cv-button>
|
88
|
+
<cv-side-sheet noPadding>
|
89
|
+
${ActiveStatusHeader({
|
90
|
+
state: 'active',
|
91
|
+
title: 'Example status from a side sheet',
|
92
|
+
})}
|
93
|
+
${tableRowSelectionContent}
|
94
|
+
</cv-side-sheet>
|
95
|
+
`;
|
96
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
3
|
+
import { styles } from '@material/mwc-dialog/mwc-dialog.css';
|
4
|
+
import { CovalentDialog } from '../dialog/dialog';
|
5
|
+
import baseStyles from './side-sheet.scss?inline';
|
6
|
+
|
7
|
+
declare global {
|
8
|
+
interface HTMLElementTagNameMap {
|
9
|
+
'cv-side-sheet': CovalentSideSheet;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Side sheet element.
|
15
|
+
*
|
16
|
+
* @slot - This element has a slot
|
17
|
+
*/
|
18
|
+
@customElement('cv-side-sheet')
|
19
|
+
export class CovalentSideSheet extends CovalentDialog {
|
20
|
+
static override styles = [
|
21
|
+
styles,
|
22
|
+
css`
|
23
|
+
${unsafeCSS(baseStyles)}
|
24
|
+
`,
|
25
|
+
];
|
26
|
+
|
27
|
+
@property({ type: Boolean, reflect: true })
|
28
|
+
pushed = false;
|
29
|
+
|
30
|
+
@property({ type: Boolean, reflect: true })
|
31
|
+
noPadding = false;
|
32
|
+
|
33
|
+
constructor() {
|
34
|
+
super();
|
35
|
+
this.hideActions = true;
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@mixin core-styles() {
|
2
|
+
.skeleton-text * {
|
3
|
+
font-family: skeleton, sans-serif !important;
|
4
|
+
}
|
5
|
+
|
6
|
+
.skeleton-text {
|
7
|
+
--mdc-typography-headline1-font-family: 'skeleton';
|
8
|
+
--mdc-typography-headline2-font-family: 'skeleton';
|
9
|
+
--mdc-typography-headline3-font-family: 'skeleton';
|
10
|
+
--mdc-typography-headline4-font-family: 'skeleton';
|
11
|
+
--mdc-typography-headline5-font-family: 'skeleton';
|
12
|
+
--mdc-typography-headline6-font-family: 'skeleton';
|
13
|
+
--mdc-typography-subtitle1-font-family: 'skeleton';
|
14
|
+
--mdc-typography-subtitle2-font-family: 'skeleton';
|
15
|
+
--mdc-typography-button-font-family: 'skeleton';
|
16
|
+
--mdc-typography-caption-font-family: 'skeleton';
|
17
|
+
--mdc-typography-overline-font-family: 'skeleton';
|
18
|
+
--mdc-typography-body1-font-family: 'skeleton';
|
19
|
+
--mdc-typography-body2-font-family: 'skeleton';
|
20
|
+
--mdc-typography-body2-letter-spacing: -0.03em;
|
21
|
+
--mdc-theme-text-primary-on-background: #cccccc;
|
22
|
+
--skeleton-color: #cccccc;
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import '../checkbox/checkbox';
|
2
|
+
import '../formfield/formfield';
|
3
|
+
|
4
|
+
import { Basic } from '../typography/typography.stories';
|
5
|
+
import loremIpsumContent from '../../stories/demos/lorem-ipsum.content.html?raw';
|
6
|
+
import tableProgressContent from '../../stories/demos/table-progress-indicator.content.html?raw';
|
7
|
+
|
8
|
+
import 'skeleton-elements/css';
|
9
|
+
|
10
|
+
export default {
|
11
|
+
title: 'Components/Skeleton',
|
12
|
+
};
|
13
|
+
|
14
|
+
const skeletonClsName = 'skeleton-text';
|
15
|
+
const skeletonEffect = 'skeleton-effect-fade';
|
16
|
+
|
17
|
+
export const DataTable = () => {
|
18
|
+
const container = document.createElement('div');
|
19
|
+
container.innerHTML = tableProgressContent;
|
20
|
+
const tableCell = container.getElementsByClassName('mdc-data-table__cell');
|
21
|
+
Array.from(tableCell).forEach((cell) => {
|
22
|
+
cell.classList.add(skeletonClsName);
|
23
|
+
cell.classList.add(skeletonEffect);
|
24
|
+
});
|
25
|
+
|
26
|
+
return container;
|
27
|
+
};
|
28
|
+
|
29
|
+
export const Typography = () => {
|
30
|
+
const container = document.createElement('div');
|
31
|
+
container.classList.add(skeletonClsName);
|
32
|
+
container.classList.add(skeletonEffect);
|
33
|
+
container.innerHTML = `${Basic()}`;
|
34
|
+
|
35
|
+
return container;
|
36
|
+
};
|
37
|
+
|
38
|
+
export const Content = () => {
|
39
|
+
const container = document.createElement('div');
|
40
|
+
container.classList.add(skeletonClsName);
|
41
|
+
container.classList.add(skeletonEffect);
|
42
|
+
container.innerHTML = loremIpsumContent;
|
43
|
+
|
44
|
+
return container;
|
45
|
+
};
|
46
|
+
|
47
|
+
export const Checkbox = ({ label = 'Bananas', indeterminate }) => {
|
48
|
+
const container = document.createElement('div');
|
49
|
+
container.innerHTML = `
|
50
|
+
<style>
|
51
|
+
cv-formfield {
|
52
|
+
display: block;
|
53
|
+
}
|
54
|
+
.child {
|
55
|
+
margin-left: 20px;
|
56
|
+
}
|
57
|
+
</style>
|
58
|
+
<cv-formfield label="${label}">
|
59
|
+
<cv-checkbox ${indeterminate ? `indeterminate` : null}></cv-checkbox>
|
60
|
+
</cv-formfield>
|
61
|
+
|
62
|
+
<cv-formfield label="${label}">
|
63
|
+
<cv-checkbox class="child"></cv-checkbox>
|
64
|
+
</cv-formfield>
|
65
|
+
|
66
|
+
<cv-formfield label="${label}">
|
67
|
+
<cv-checkbox class="child" checked></cv-checkbox>
|
68
|
+
</cv-formfield>`;
|
69
|
+
|
70
|
+
const labels = container.getElementsByTagName('cv-formfield');
|
71
|
+
Array.from(labels).forEach((label) => {
|
72
|
+
label.classList.add(skeletonClsName);
|
73
|
+
label.classList.add(skeletonEffect);
|
74
|
+
});
|
75
|
+
|
76
|
+
return container;
|
77
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { SliderRangeBase } from '@material/mwc-slider/slider-range-base';
|
2
|
+
import { styles } from '@material/mwc-slider/mwc-slider.css';
|
3
|
+
import { customElement } from 'lit/decorators.js';
|
4
|
+
|
5
|
+
declare global {
|
6
|
+
interface HTMLElementTagNameMap {
|
7
|
+
'cv-slider-range': CovalentSliderRange;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
@customElement('cv-slider-range')
|
12
|
+
export class CovalentSliderRange extends SliderRangeBase {
|
13
|
+
static override styles = [styles];
|
14
|
+
}
|
15
|
+
|
16
|
+
export default CovalentSliderRange;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import './slider';
|
2
|
+
import './slider-range';
|
3
|
+
|
4
|
+
export default {
|
5
|
+
title: 'Components/Slider',
|
6
|
+
parameters: {
|
7
|
+
layout: 'padded',
|
8
|
+
},
|
9
|
+
args: {
|
10
|
+
discrete: false,
|
11
|
+
disabled: false,
|
12
|
+
markers: false,
|
13
|
+
},
|
14
|
+
};
|
15
|
+
|
16
|
+
const SingleTemplate = ({ discrete, disabled, markers, value = 10 }) => {
|
17
|
+
const progressBar = document.createElement('cv-slider');
|
18
|
+
progressBar.discrete = discrete;
|
19
|
+
progressBar.disabled = disabled;
|
20
|
+
progressBar.markers = markers;
|
21
|
+
progressBar.value = value;
|
22
|
+
progressBar.max = 50;
|
23
|
+
progressBar.min = 5;
|
24
|
+
|
25
|
+
if (markers) {
|
26
|
+
progressBar.step = 5;
|
27
|
+
}
|
28
|
+
|
29
|
+
return progressBar;
|
30
|
+
};
|
31
|
+
|
32
|
+
const RangeTemplate = ({ discrete, disabled, markers, value = 10 }) => {
|
33
|
+
const progressBar = document.createElement('cv-slider-range');
|
34
|
+
progressBar.discrete = discrete;
|
35
|
+
progressBar.disabled = disabled;
|
36
|
+
progressBar.markers = markers;
|
37
|
+
progressBar.valueStart = value;
|
38
|
+
progressBar.valueEnd = value + 10;
|
39
|
+
|
40
|
+
progressBar.max = 50;
|
41
|
+
progressBar.min = 5;
|
42
|
+
|
43
|
+
if (markers) {
|
44
|
+
progressBar.step = 5;
|
45
|
+
}
|
46
|
+
|
47
|
+
return progressBar;
|
48
|
+
};
|
49
|
+
|
50
|
+
export const Basic = SingleTemplate.bind({});
|
51
|
+
Basic.args = {};
|
52
|
+
|
53
|
+
export const Range = RangeTemplate.bind({});
|
54
|
+
Range.args = {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { SliderSingleBase } from '@material/mwc-slider/slider-single-base';
|
2
|
+
import { styles } from '@material/mwc-slider/mwc-slider.css';
|
3
|
+
import { customElement } from 'lit/decorators.js';
|
4
|
+
|
5
|
+
declare global {
|
6
|
+
interface HTMLElementTagNameMap {
|
7
|
+
'cv-slider': CovalentSlider;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
@customElement('cv-slider')
|
12
|
+
export class CovalentSlider extends SliderSingleBase {
|
13
|
+
static override styles = [styles];
|
14
|
+
}
|
15
|
+
|
16
|
+
export default CovalentSlider;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @vitest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { it, describe, expect } from 'vitest';
|
5
|
+
import { CovalentSnackbar } from './snackbar';
|
6
|
+
|
7
|
+
describe('Snackbar', () => {
|
8
|
+
it('should work', () => {
|
9
|
+
expect(new CovalentSnackbar()).toBeDefined();
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import './snackbar';
|
2
|
+
import '../button/button';
|
3
|
+
import '../icon-button/icon-button';
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'Components/Snackbar',
|
7
|
+
args: {
|
8
|
+
stacked: false,
|
9
|
+
leading: false,
|
10
|
+
label: "Can't send photo. Retry in 5 seconds.",
|
11
|
+
},
|
12
|
+
};
|
13
|
+
|
14
|
+
const Template = ({ label, leading, stacked }) => {
|
15
|
+
document.addEventListener(
|
16
|
+
'DOMContentLoaded',
|
17
|
+
() => {
|
18
|
+
const snackbar = document.querySelector('cv-snackbar');
|
19
|
+
const snackbarTarget = document.querySelector('.show-snackbar-button');
|
20
|
+
|
21
|
+
snackbarTarget.addEventListener('click', () => {
|
22
|
+
return snackbar.open ? snackbar.close() : snackbar.show();
|
23
|
+
});
|
24
|
+
},
|
25
|
+
{ once: true }
|
26
|
+
);
|
27
|
+
|
28
|
+
return `
|
29
|
+
<cv-button class="show-snackbar-button">Toggle snackbar</cv-button>
|
30
|
+
<cv-snackbar
|
31
|
+
class="my-snackbar"
|
32
|
+
labelText="${label}"
|
33
|
+
${leading ? 'leading' : ''}
|
34
|
+
${stacked ? 'stacked' : ''}
|
35
|
+
open>
|
36
|
+
<cv-button slot="action">Retry</cv-button>
|
37
|
+
<cv-icon-button icon="close" slot="dismiss"></cv-icon-button>
|
38
|
+
</cv-snackbar>`;
|
39
|
+
};
|
40
|
+
|
41
|
+
export const Basic = Template.bind({});
|
42
|
+
Basic.args = {};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
import { SnackbarBase } from '@material/mwc-snackbar/mwc-snackbar-base';
|
4
|
+
import { styles as baseStyles } from '@material/mwc-snackbar/mwc-snackbar.css';
|
5
|
+
import styles from './snackbar.scss?inline';
|
6
|
+
|
7
|
+
declare global {
|
8
|
+
interface HTMLElementTagNameMap {
|
9
|
+
'cv-snackbar': CovalentSnackbar;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
@customElement('cv-snackbar')
|
14
|
+
export class CovalentSnackbar extends SnackbarBase {
|
15
|
+
static override styles = [baseStyles, css`${unsafeCSS(styles)}`];
|
16
|
+
}
|
17
|
+
|
18
|
+
export default CovalentSnackbar;
|