@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,94 @@
|
|
1
|
+
import { LitElement, html } from 'lit';
|
2
|
+
import {
|
3
|
+
customElement,
|
4
|
+
property,
|
5
|
+
queryAssignedElements,
|
6
|
+
} from 'lit/decorators.js';
|
7
|
+
import { CovalentExpansionPanelItem } from './expansion-panel-item';
|
8
|
+
|
9
|
+
@customElement('cv-expansion-panel')
|
10
|
+
export class CovalentExpansionPanel extends LitElement {
|
11
|
+
@property({ type: Boolean, reflect: true }) noSurface = false;
|
12
|
+
@property({ type: String }) titleWidth = '150px';
|
13
|
+
@queryAssignedElements() panelItems!: CovalentExpansionPanelItem[];
|
14
|
+
|
15
|
+
render() {
|
16
|
+
return html`
|
17
|
+
<div class="container">
|
18
|
+
<div class="content">
|
19
|
+
<slot id="mainSlot"></slot>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
`;
|
23
|
+
}
|
24
|
+
|
25
|
+
private _handleToggle = (e: CustomEvent): void => {
|
26
|
+
const toggledPanelIndex = e.detail.index;
|
27
|
+
const panel = this.panelItems[toggledPanelIndex];
|
28
|
+
const open = panel.open;
|
29
|
+
|
30
|
+
// close the currently open panel if there is one
|
31
|
+
this.panelItems.forEach((item) => {
|
32
|
+
item.resetPanel();
|
33
|
+
});
|
34
|
+
|
35
|
+
if (open) {
|
36
|
+
panel.open = true;
|
37
|
+
this.panelItems.forEach((item) => {
|
38
|
+
// Format the panel above and below the opened panel
|
39
|
+
if (item.index == toggledPanelIndex - 1) {
|
40
|
+
if (item.index == 0) {
|
41
|
+
// if this is the top panel
|
42
|
+
item.separateSinglePanel = true;
|
43
|
+
} else {
|
44
|
+
item.aboveOpenInnerPanel = true;
|
45
|
+
}
|
46
|
+
} else if (item.index == toggledPanelIndex + 1) {
|
47
|
+
if (item.index == this.panelItems.length - 1) {
|
48
|
+
item.separateSinglePanel = true;
|
49
|
+
}
|
50
|
+
item.belowOpenInnerPanel = true;
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
firstUpdated() {
|
57
|
+
window.addEventListener('cv-expansionPanel-togglePanel', (e) =>
|
58
|
+
this._handleToggle(<CustomEvent>e),
|
59
|
+
);
|
60
|
+
|
61
|
+
this.style.setProperty(
|
62
|
+
'--cv-expansion-panel-item-title-width',
|
63
|
+
this.titleWidth,
|
64
|
+
);
|
65
|
+
|
66
|
+
if (this.noSurface) {
|
67
|
+
this.style.setProperty('--cv-theme-surface-container', 'transparent');
|
68
|
+
}
|
69
|
+
|
70
|
+
if (this.panelItems.length == 1) {
|
71
|
+
this.panelItems[0].isSinglePanel = true;
|
72
|
+
} else {
|
73
|
+
// set index and type of each panel
|
74
|
+
let i = 0;
|
75
|
+
this.panelItems.forEach((item) => {
|
76
|
+
if (i == 0) {
|
77
|
+
item.isTopPanel = true;
|
78
|
+
} else if (i == this.panelItems.length - 1) {
|
79
|
+
item.isBottomPanel = true;
|
80
|
+
} else {
|
81
|
+
item.isInnerPanel = true;
|
82
|
+
}
|
83
|
+
item.index = i;
|
84
|
+
i++;
|
85
|
+
});
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
declare global {
|
91
|
+
interface HTMLElementTagNameMap {
|
92
|
+
'cv-expansion-panel': CovalentExpansionPanel;
|
93
|
+
}
|
94
|
+
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
:host {
|
2
|
+
height: 100%;
|
3
|
+
left: 0;
|
4
|
+
position: fixed;
|
5
|
+
top: 0;
|
6
|
+
width: 100%;
|
7
|
+
}
|
8
|
+
|
9
|
+
.action-items {
|
10
|
+
padding: 0.5rem 0.75rem;
|
11
|
+
text-align: right;
|
12
|
+
}
|
13
|
+
|
14
|
+
.content {
|
15
|
+
box-sizing: border-box;
|
16
|
+
display: flex;
|
17
|
+
flex: 1;
|
18
|
+
max-height: 100vh;
|
19
|
+
overflow: auto;
|
20
|
+
transition: visibility 0.3s ease;
|
21
|
+
}
|
22
|
+
|
23
|
+
.fullscreen-container {
|
24
|
+
border-top: 4px solid var(--cv-theme-tertiary);
|
25
|
+
box-sizing: border-box;
|
26
|
+
display: flex;
|
27
|
+
height: 100%;
|
28
|
+
width: 100%;
|
29
|
+
|
30
|
+
&:not(.help-open) .help-panel {
|
31
|
+
width: 0;
|
32
|
+
|
33
|
+
.resize-handle {
|
34
|
+
display: none;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
.fullscreen-container.hide-border {
|
40
|
+
border: none;
|
41
|
+
}
|
42
|
+
|
43
|
+
.help {
|
44
|
+
--mdc-theme-surface: var(--cv-theme-surface-container-low);
|
45
|
+
|
46
|
+
box-sizing: border-box;
|
47
|
+
flex: 1;
|
48
|
+
max-height: 100vh;
|
49
|
+
overflow-y: auto;
|
50
|
+
}
|
51
|
+
|
52
|
+
.help-panel {
|
53
|
+
background: var(--cv-theme-surface-container-low);
|
54
|
+
box-sizing: border-box;
|
55
|
+
display: flex;
|
56
|
+
flex: 0 0 auto;
|
57
|
+
max-width: 100%;
|
58
|
+
position: relative;
|
59
|
+
resize: none;
|
60
|
+
transition: width 200ms;
|
61
|
+
width: var(--cv-focused-page-help-width, 320px);
|
62
|
+
z-index: 5;
|
63
|
+
|
64
|
+
.resize-handle {
|
65
|
+
cursor: ew-resize;
|
66
|
+
height: 100%;
|
67
|
+
opacity: 0;
|
68
|
+
position: absolute;
|
69
|
+
transition: opacity 0.3s ease;
|
70
|
+
user-select: none;
|
71
|
+
width: 8px;
|
72
|
+
z-index: 9;
|
73
|
+
|
74
|
+
&::before {
|
75
|
+
background-color: var(--mdc-theme-primary);
|
76
|
+
content: '';
|
77
|
+
height: 100%;
|
78
|
+
left: 0;
|
79
|
+
position: absolute;
|
80
|
+
top: 0;
|
81
|
+
transform: translateX(-50%);
|
82
|
+
width: 2px;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
.resize-handle:hover,
|
87
|
+
&.resizing .resize-handle {
|
88
|
+
opacity: 1;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
.main {
|
93
|
+
box-sizing: border-box;
|
94
|
+
flex: 1;
|
95
|
+
height: 100%;
|
96
|
+
}
|
97
|
+
|
98
|
+
@media only screen and (max-width: 479.98px) {
|
99
|
+
.help-open .help-panel {
|
100
|
+
width: 100%;
|
101
|
+
z-index: 100;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
@media only screen and (max-width: 959.98px) {
|
106
|
+
.help-open .help-panel {
|
107
|
+
box-shadow: 0 8px 12px 6px rgba(0, 0, 0, 15%),
|
108
|
+
0 4px 4px 0 rgba(0, 0, 0, 30%);
|
109
|
+
height: 100%;
|
110
|
+
position: absolute;
|
111
|
+
right: 0;
|
112
|
+
}
|
113
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @vitest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { it, describe, expect } from 'vitest';
|
5
|
+
import { CovalentFocusedPage } from './focused-page';
|
6
|
+
|
7
|
+
describe('Covalent Focused Page', () => {
|
8
|
+
it('should work', () => {
|
9
|
+
expect(new CovalentFocusedPage()).toBeDefined();
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,167 @@
|
|
1
|
+
import './focused-page';
|
2
|
+
import '../button/button';
|
3
|
+
import '../toolbar/toolbar';
|
4
|
+
import '../icon-button/icon-button';
|
5
|
+
import '../icon-button-toggle/icon-button-toggle';
|
6
|
+
import '../icon-radio/icon-radio-toggle';
|
7
|
+
import '../typography/typography';
|
8
|
+
import '../icon/icon';
|
9
|
+
|
10
|
+
export default {
|
11
|
+
title: 'Components/Focused page',
|
12
|
+
argTypes: {},
|
13
|
+
args: {
|
14
|
+
helpOpen: false,
|
15
|
+
helpResizable: false,
|
16
|
+
hideTopBorder: false,
|
17
|
+
},
|
18
|
+
parameters: {
|
19
|
+
layout: 'fullscreen',
|
20
|
+
},
|
21
|
+
};
|
22
|
+
|
23
|
+
const Template = ({ helpOpen, helpResizable, hideTopBorder }) => {
|
24
|
+
document.addEventListener(
|
25
|
+
'DOMContentLoaded',
|
26
|
+
() => {
|
27
|
+
const helpToggleButton = document.body.querySelector('.help-toggle');
|
28
|
+
|
29
|
+
helpToggleButton.addEventListener('click', () => {
|
30
|
+
const dialog = document.body.querySelector('#focused-page');
|
31
|
+
dialog.helpOpen = !dialog.helpOpen;
|
32
|
+
});
|
33
|
+
},
|
34
|
+
{ once: true }
|
35
|
+
);
|
36
|
+
|
37
|
+
return `
|
38
|
+
<cv-focused-page id="focused-page" scrimClickAction="" ${
|
39
|
+
helpResizable ? ' helpResizable' : ''
|
40
|
+
}${helpOpen ? ' helpOpen' : ''}${hideTopBorder ? ' hideTopBorder' : ''}>
|
41
|
+
<!-- Content to be rendered in the focused page component -->
|
42
|
+
<!-- Replace with any content as desired -->
|
43
|
+
|
44
|
+
<cv-toolbar>
|
45
|
+
<span slot="title">
|
46
|
+
Connect data source
|
47
|
+
</span>
|
48
|
+
<cv-icon-button-toggle onIcon="help" offIcon="help" class="help-toggle"
|
49
|
+
slot="actionItems"></cv-icon-button-toggle>
|
50
|
+
</cv-toolbar>
|
51
|
+
<div style="display:flex; gap: 3rem; flex-wrap: wrap; padding: 2rem 1rem 1.5rem; max-width: 1200px">
|
52
|
+
<div>
|
53
|
+
<div style="display:flex;">
|
54
|
+
<span>
|
55
|
+
<cv-icon-button-toggle onIcon="info" offIcon="info" toggledOn></cv-icon-button-toggle>
|
56
|
+
</span>
|
57
|
+
<div style="display: inline-block; margin: 0 0 1rem 1rem;">
|
58
|
+
<cv-typography scale="subtitle1">
|
59
|
+
Select model
|
60
|
+
</cv-typography>
|
61
|
+
<cv-typography scale="caption">
|
62
|
+
Select the industry data model for your organization
|
63
|
+
</cv-typography>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
<div style="display:flex; margin-top: 1rem;">
|
67
|
+
<span>
|
68
|
+
<cv-icon-button-toggle onIcon="info" offIcon="info" toggledOn></cv-icon-button-toggle>
|
69
|
+
</span>
|
70
|
+
<div style="display: inline-block; margin: 0 0 1rem 1rem;">
|
71
|
+
<cv-typography scale="subtitle1">
|
72
|
+
Review details
|
73
|
+
</cv-typography>
|
74
|
+
<cv-typography scale="caption">
|
75
|
+
Preview the selected model and sample schema
|
76
|
+
</cv-typography>
|
77
|
+
</div>
|
78
|
+
</div>
|
79
|
+
<div style="display:flex; margin-top: 1rem;">
|
80
|
+
<span>
|
81
|
+
<cv-icon-button-toggle onIcon="info" offIcon="info" toggledOn></cv-icon-button-toggle>
|
82
|
+
</span>
|
83
|
+
<div style="display: inline-block; margin: 0 0 1rem 1rem;">
|
84
|
+
<cv-typography scale="subtitle1">
|
85
|
+
Install
|
86
|
+
</cv-typography>
|
87
|
+
<cv-typography scale="caption">
|
88
|
+
Acknowledge creation of database and install
|
89
|
+
</cv-typography>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<div
|
94
|
+
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 1rem; flex: 1">
|
95
|
+
<cv-radio-icon>
|
96
|
+
<cv-icon slot="icon">work</cv-icon>
|
97
|
+
<div slot="text">Balanced</div>
|
98
|
+
<div slot="text">Every week</div>
|
99
|
+
</cv-radio-icon>
|
100
|
+
<cv-radio-icon>
|
101
|
+
<cv-icon slot="icon">work</cv-icon>
|
102
|
+
<div slot="text">Balanced</div>
|
103
|
+
<div slot="text">Every week</div>
|
104
|
+
</cv-radio-icon>
|
105
|
+
<cv-radio-icon>
|
106
|
+
<cv-icon slot="icon">work</cv-icon>
|
107
|
+
<div slot="text">Balanced</div>
|
108
|
+
<div slot="text">Every week</div>
|
109
|
+
</cv-radio-icon>
|
110
|
+
<cv-radio-icon>
|
111
|
+
<cv-icon slot="icon">work</cv-icon>
|
112
|
+
<div slot="text">Balanced</div>
|
113
|
+
<div slot="text">Every week</div>
|
114
|
+
</cv-radio-icon>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<!-- Content rendered in the help section of the component -->
|
118
|
+
<!-- Replace with any content as desired -->
|
119
|
+
<div slot="help">
|
120
|
+
<cv-toolbar sticky>
|
121
|
+
<span slot="title" style="padding-left: 4px;">Help</span>
|
122
|
+
<cv-icon-button slot="actionItems" icon="undock" covalent-icons></cv-icon-button>
|
123
|
+
</cv-toolbar>
|
124
|
+
<div style="padding: 16px">
|
125
|
+
<cv-typography scale="headline5">
|
126
|
+
Ultricies nunc massa, id ut felis sed varius accumsan platea.
|
127
|
+
</cv-typography>
|
128
|
+
<br />
|
129
|
+
<cv-typography scale="body1">
|
130
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam
|
131
|
+
tincidunt lectus risus, id aliquet mi congue sed.
|
132
|
+
</cv-typography>
|
133
|
+
<br />
|
134
|
+
<cv-typography scale="body1">
|
135
|
+
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
|
136
|
+
pouere cubilia curae; Phasellus tincidunt eros arcu, sollicitudin
|
137
|
+
laoreet urna aliquet eget.
|
138
|
+
</cv-typography>
|
139
|
+
<br />
|
140
|
+
<cv-typography scale="body1">
|
141
|
+
Phasellus porta sed libero vel vulputate. Quisque non nisl sem.
|
142
|
+
Pellentesque nec pretium magna, et vestibulum neque. Mauris molestie
|
143
|
+
eros quis nisi pretium,
|
144
|
+
</cv-typography>
|
145
|
+
<br />
|
146
|
+
<cv-typography scale="body1">
|
147
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam
|
148
|
+
tincidunt lectus risus, id aliquet mi congue sed.
|
149
|
+
</cv-typography>
|
150
|
+
<br />
|
151
|
+
<cv-typography scale="body1">
|
152
|
+
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
|
153
|
+
pouere cubilia curae; Phasellus tincidunt eros arcu, sollicitudin
|
154
|
+
laoreet urna aliquet eget.
|
155
|
+
</cv-typography>
|
156
|
+
<br />
|
157
|
+
<cv-typography scale="body1">
|
158
|
+
Phasellus porta sed libero vel vulputate. Quisque non nisl sem.
|
159
|
+
Pellentesque nec pretium magna, et vestibulum neque. Mauris molestie
|
160
|
+
eros quis nisi pretium,
|
161
|
+
</cv-typography>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
</cv-focused-page>`;
|
165
|
+
};
|
166
|
+
|
167
|
+
export const Basic = Template.bind({});
|
@@ -0,0 +1,201 @@
|
|
1
|
+
import {
|
2
|
+
css,
|
3
|
+
html,
|
4
|
+
LitElement,
|
5
|
+
nothing,
|
6
|
+
PropertyValues,
|
7
|
+
TemplateResult,
|
8
|
+
unsafeCSS,
|
9
|
+
} from 'lit';
|
10
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
11
|
+
import styles from './focused-page.scss?inline';
|
12
|
+
import { classMap } from 'lit/directives/class-map.js';
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Focused page
|
16
|
+
*
|
17
|
+
* @slot - This element has a slot
|
18
|
+
*/
|
19
|
+
|
20
|
+
@customElement('cv-focused-page')
|
21
|
+
export class CovalentFocusedPage extends LitElement {
|
22
|
+
static override styles = [
|
23
|
+
css`
|
24
|
+
${unsafeCSS(styles)}
|
25
|
+
`,
|
26
|
+
];
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Whether the help section is open or not
|
30
|
+
*/
|
31
|
+
@property({ type: Boolean, reflect: true })
|
32
|
+
helpOpen = false;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Whether the help section is resizable
|
36
|
+
*/
|
37
|
+
@property({ type: Boolean, reflect: true })
|
38
|
+
helpResizable = false;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Whether the top border is hidden
|
42
|
+
*/
|
43
|
+
@property({ type: Boolean, reflect: true })
|
44
|
+
hideTopBorder = false;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* DOM element of the container div
|
48
|
+
*/
|
49
|
+
@query('.fullscreen-container')
|
50
|
+
container!: HTMLDivElement;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* DOM element of the help panel
|
54
|
+
*/
|
55
|
+
@query('#help-panel')
|
56
|
+
helpPanel!: HTMLElement;
|
57
|
+
|
58
|
+
/**
|
59
|
+
* DOM element of the resize handler
|
60
|
+
*/
|
61
|
+
@query('.resize-handle')
|
62
|
+
resizeHandle!: HTMLElement;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Whether the help section is being resized
|
66
|
+
*/
|
67
|
+
private _isResizing = false;
|
68
|
+
|
69
|
+
constructor() {
|
70
|
+
super();
|
71
|
+
this._resizerMouseMove = this._resizerMouseMove.bind(this);
|
72
|
+
this._resizerMouseUp = this._resizerMouseUp.bind(this);
|
73
|
+
this._startResizing = this._startResizing.bind(this);
|
74
|
+
this.resetHelpPanelWidth = this.resetHelpPanelWidth.bind(this);
|
75
|
+
}
|
76
|
+
|
77
|
+
protected firstUpdated(): void {
|
78
|
+
this.openHelpPanel();
|
79
|
+
}
|
80
|
+
|
81
|
+
openHelpPanel(): void {
|
82
|
+
// Set width of the help panel
|
83
|
+
const savedWidth =
|
84
|
+
parseInt(localStorage.getItem('focusedPageHelpWidth') || '') || 320;
|
85
|
+
this.setHelpPanelWidth(this.helpOpen ? `${savedWidth}px` : '0');
|
86
|
+
}
|
87
|
+
|
88
|
+
closeHelpPanel() {
|
89
|
+
this.setHelpPanelWidth('0');
|
90
|
+
this.helpOpen = false;
|
91
|
+
}
|
92
|
+
|
93
|
+
resetHelpPanelWidth() {
|
94
|
+
this.setHelpPanelWidth('320px');
|
95
|
+
localStorage.setItem('focusedPageHelpWidth', `320`);
|
96
|
+
}
|
97
|
+
|
98
|
+
setHelpPanelWidth(width: string) {
|
99
|
+
this.container?.style.setProperty('--cv-focused-page-help-width', width);
|
100
|
+
}
|
101
|
+
|
102
|
+
protected updated(_changedProperties: PropertyValues): void {
|
103
|
+
super.updated(_changedProperties);
|
104
|
+
if (_changedProperties.has('helpOpen')) {
|
105
|
+
if (this.helpOpen) {
|
106
|
+
this.openHelpPanel();
|
107
|
+
} else {
|
108
|
+
this.closeHelpPanel();
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
// Called when the resize handler is dragged to resize the help panel
|
114
|
+
private _resizerMouseMove(e: MouseEvent): void {
|
115
|
+
if (!this.container || !this.helpPanel || !this._isResizing) return;
|
116
|
+
const viewportWidth = window.innerWidth;
|
117
|
+
|
118
|
+
const containerRect = this.container.getBoundingClientRect();
|
119
|
+
let newWidth;
|
120
|
+
|
121
|
+
if (viewportWidth < 960) {
|
122
|
+
// Calculate new width based on absolute positioning
|
123
|
+
const helpPanelRect = this.helpPanel.getBoundingClientRect();
|
124
|
+
newWidth = helpPanelRect.right - e.clientX;
|
125
|
+
} else {
|
126
|
+
// Calculate new width based on normal positioning
|
127
|
+
newWidth = containerRect.right - e.clientX;
|
128
|
+
}
|
129
|
+
|
130
|
+
if (
|
131
|
+
viewportWidth < 960 &&
|
132
|
+
newWidth > 320 &&
|
133
|
+
newWidth < viewportWidth - 40
|
134
|
+
) {
|
135
|
+
this.setHelpPanelWidth(`${newWidth}px`);
|
136
|
+
localStorage.setItem('focusedPageHelpWidth', `${newWidth}`);
|
137
|
+
} else if (newWidth > 320 && newWidth < containerRect.width - 600) {
|
138
|
+
this.setHelpPanelWidth(`${newWidth}px`);
|
139
|
+
localStorage.setItem('focusedPageHelpWidth', `${newWidth}`);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
// Called when dragging is finished (i.e. mouse up event on resize handler)
|
144
|
+
private _resizerMouseUp(): void {
|
145
|
+
this._isResizing = false;
|
146
|
+
this.helpPanel.classList.remove('resizing');
|
147
|
+
this.helpPanel.style.transition = 'width 200ms';
|
148
|
+
document.removeEventListener('mouseup', this._resizerMouseUp);
|
149
|
+
document.removeEventListener('mousemove', this._resizerMouseMove);
|
150
|
+
}
|
151
|
+
|
152
|
+
// Called when dragging starts (i.e. mouse down event on resize handler)
|
153
|
+
private _startResizing(e: MouseEvent): void {
|
154
|
+
if (e.target !== this.resizeHandle) return;
|
155
|
+
this._isResizing = true;
|
156
|
+
this.helpPanel.classList.add('resizing');
|
157
|
+
this.helpPanel.style.transition = 'none';
|
158
|
+
document.addEventListener('mouseup', this._resizerMouseUp);
|
159
|
+
document.addEventListener('mousemove', this._resizerMouseMove);
|
160
|
+
}
|
161
|
+
|
162
|
+
protected render(): TemplateResult<1> {
|
163
|
+
const classes = {
|
164
|
+
'fullscreen-container': true,
|
165
|
+
'help-open': this.helpOpen,
|
166
|
+
'hide-border': this.hideTopBorder,
|
167
|
+
};
|
168
|
+
const helpClasses = {
|
169
|
+
'help-panel': true,
|
170
|
+
'help-resizable': this.helpResizable,
|
171
|
+
};
|
172
|
+
return html`<div class="${classMap(classes)}">
|
173
|
+
<div class="content">
|
174
|
+
<section class="main">
|
175
|
+
<slot></slot>
|
176
|
+
</section>
|
177
|
+
</div>
|
178
|
+
<aside
|
179
|
+
class="${classMap(helpClasses)}"
|
180
|
+
id="help-panel"
|
181
|
+
@mousedown="${(e: MouseEvent) => this._startResizing(e)}"
|
182
|
+
>
|
183
|
+
${this.helpResizable
|
184
|
+
? html`<div
|
185
|
+
class="resize-handle"
|
186
|
+
@dblclick="${() => this.helpOpen && this.resetHelpPanelWidth()}"
|
187
|
+
></div>`
|
188
|
+
: nothing}
|
189
|
+
<div class="help"><slot name="help"></slot></div>
|
190
|
+
</aside>
|
191
|
+
</div>`;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
declare global {
|
196
|
+
interface HTMLElementTagNameMap {
|
197
|
+
'cv-focused-page': CovalentFocusedPage;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
export default CovalentFocusedPage;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @vitest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { it, describe, expect } from 'vitest';
|
5
|
+
import { CovalentFormfield } from './formfield';
|
6
|
+
|
7
|
+
describe('Form field', () => {
|
8
|
+
it('should work', () => {
|
9
|
+
expect(new CovalentFormfield()).toBeDefined();
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
2
|
+
import { FormfieldBase } from '@material/mwc-formfield/mwc-formfield-base';
|
3
|
+
import { styles as baseStyles } from '@material/mwc-formfield/mwc-formfield.css';
|
4
|
+
import styles from './formfield.scss?inline';
|
5
|
+
|
6
|
+
import { customElement } from 'lit/decorators.js';
|
7
|
+
|
8
|
+
declare global {
|
9
|
+
interface HTMLElementTagNameMap {
|
10
|
+
'cv-formfield': CovalentFormfield;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
@customElement('cv-formfield')
|
15
|
+
export class CovalentFormfield extends FormfieldBase {
|
16
|
+
static override styles = [
|
17
|
+
css`
|
18
|
+
${unsafeCSS(styles)}
|
19
|
+
`,
|
20
|
+
baseStyles,
|
21
|
+
];
|
22
|
+
}
|
23
|
+
|
24
|
+
export default CovalentFormfield
|
@@ -0,0 +1,37 @@
|
|
1
|
+
:host {
|
2
|
+
--cv-dialog-border-radius: 0;
|
3
|
+
--cv-dialog-horizontal-padding: 0;
|
4
|
+
--cv-dialog-vertical-padding: 0;
|
5
|
+
--mdc-dialog-scrim-color: transparent;
|
6
|
+
--mdc-dialog-min-width: 100vw;
|
7
|
+
--mdc-dialog-max-width: 100vw;
|
8
|
+
--mdc-dialog-min-height: 100vh;
|
9
|
+
--mdc-dialog-max-height: 100vh;
|
10
|
+
}
|
11
|
+
|
12
|
+
.mdc-dialog .mdc-dialog__container {
|
13
|
+
opacity: 1;
|
14
|
+
transform: translateX(100%);
|
15
|
+
transition: transform 300ms ease;
|
16
|
+
}
|
17
|
+
|
18
|
+
.mdc-dialog--opening {
|
19
|
+
.mdc-dialog__container {
|
20
|
+
transform: translateX(100%);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
.mdc-dialog--open {
|
25
|
+
.mdc-dialog__container {
|
26
|
+
transform: translateX(0);
|
27
|
+
transition: transform 300ms ease;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
.mdc-dialog--closing {
|
32
|
+
.mdc-dialog__container {
|
33
|
+
opacity: 1;
|
34
|
+
transform: translateX(100%);
|
35
|
+
transition: transform 300ms ease;
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @vitest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { it, describe, expect } from 'vitest';
|
5
|
+
import { CovalentFullscreenDialog } from './full-screen-dialog';
|
6
|
+
|
7
|
+
describe('Covalent Fullscreen Dialog', () => {
|
8
|
+
it('should work', () => {
|
9
|
+
expect(new CovalentFullscreenDialog()).toBeDefined();
|
10
|
+
});
|
11
|
+
});
|