@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
package/project.json
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
{
|
2
|
+
"name": "components",
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
4
|
+
"sourceRoot": "libs/components/src",
|
5
|
+
"projectType": "library",
|
6
|
+
"implicitDependencies": ["tokens"],
|
7
|
+
"targets": {
|
8
|
+
"serve": {
|
9
|
+
"executor": "nx:run-commands",
|
10
|
+
"options": {
|
11
|
+
"commands": ["cd libs/components/ && vite"],
|
12
|
+
"parallel": false
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"build": {
|
16
|
+
"executor": "nx:run-commands",
|
17
|
+
"options": {
|
18
|
+
"customWebpackConfig": {
|
19
|
+
"path": "./monaco-webpack.config.js",
|
20
|
+
"mergeRules": {
|
21
|
+
"module.rules": "prepend"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"commands": [
|
25
|
+
"mkdir -p dist/libs/components/",
|
26
|
+
"vite build --config libs/components/vite.config.js --outDir dist/libs/components",
|
27
|
+
"./node_modules/.bin/tsc --project libs/components/tsconfig.lib.json --declaration --declarationMap --emitDeclarationOnly --outDir dist/libs/components",
|
28
|
+
"cp libs/components/package.json dist/libs/components"
|
29
|
+
],
|
30
|
+
"parallel": false
|
31
|
+
},
|
32
|
+
"outputs": ["{workspaceRoot}/dist/libs/components"]
|
33
|
+
},
|
34
|
+
"build-scss": {
|
35
|
+
"executor": "nx:run-commands",
|
36
|
+
"options": {
|
37
|
+
"commands": [
|
38
|
+
"mkdir -p dist/libs/components/theme/prebuilt",
|
39
|
+
"cp libs/components/src/index.scss dist/libs/components",
|
40
|
+
"cp libs/components/src/theme/_index.scss dist/libs/components/theme",
|
41
|
+
"./node_modules/.bin/sass --trace --color --style=compressed --load-path=node_modules ./libs/components/src/theme/prebuilt:./dist/libs/components/theme/prebuilt"
|
42
|
+
],
|
43
|
+
"parallel": false
|
44
|
+
},
|
45
|
+
"outputs": ["{workspaceRoot}/dist/libs/components/theme"],
|
46
|
+
"dependsOn": ["build"]
|
47
|
+
},
|
48
|
+
"test": {
|
49
|
+
"executor": "nx:run-commands",
|
50
|
+
"options": {
|
51
|
+
"commands": ["vitest -r libs/components -c vite.config.js -w false"],
|
52
|
+
"parallel": false
|
53
|
+
},
|
54
|
+
"coverage": {
|
55
|
+
"dir": "coverage/libs/components"
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"lint": {
|
59
|
+
"executor": "@nx/eslint:lint",
|
60
|
+
"outputs": ["{options.outputFile}"],
|
61
|
+
"options": {
|
62
|
+
"lintFilePatterns": ["libs/components/**/*.ts"]
|
63
|
+
}
|
64
|
+
},
|
65
|
+
"scsslint": {
|
66
|
+
"executor": "nx:run-commands",
|
67
|
+
"options": {
|
68
|
+
"commands": [
|
69
|
+
{
|
70
|
+
"command": "./node_modules/.bin/stylelint --allow-empty-input 'libs/components/**/*.scss'"
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}
|
74
|
+
},
|
75
|
+
"storybook": {
|
76
|
+
"executor": "nx:run-commands",
|
77
|
+
"options": {
|
78
|
+
"commands": [
|
79
|
+
{
|
80
|
+
"command": "storybook dev -c libs/components/.storybook"
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"build-storybook": {
|
86
|
+
"executor": "nx:run-commands",
|
87
|
+
"options": {
|
88
|
+
"commands": [
|
89
|
+
{
|
90
|
+
"command": "storybook build -c libs/components/.storybook -o dist/storybook/components"
|
91
|
+
}
|
92
|
+
]
|
93
|
+
}
|
94
|
+
},
|
95
|
+
"build-exports": {
|
96
|
+
"executor": "nx:run-commands",
|
97
|
+
"options": {
|
98
|
+
"commands": ["node ./scripts/export-components"],
|
99
|
+
"parallel": false
|
100
|
+
}
|
101
|
+
}
|
102
|
+
},
|
103
|
+
"tags": []
|
104
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '../../icons/covalent-icons.css';
|
package/public/reset.css
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
/* http://meyerweb.com/eric/tools/css/reset/
|
2
|
+
v2.0 | 20110126
|
3
|
+
License: none (public domain)
|
4
|
+
*/
|
5
|
+
|
6
|
+
html,
|
7
|
+
body,
|
8
|
+
div,
|
9
|
+
span,
|
10
|
+
applet,
|
11
|
+
object,
|
12
|
+
iframe,
|
13
|
+
h1,
|
14
|
+
h2,
|
15
|
+
h3,
|
16
|
+
h4,
|
17
|
+
h5,
|
18
|
+
h6,
|
19
|
+
p,
|
20
|
+
blockquote,
|
21
|
+
pre,
|
22
|
+
a,
|
23
|
+
abbr,
|
24
|
+
acronym,
|
25
|
+
address,
|
26
|
+
big,
|
27
|
+
cite,
|
28
|
+
code,
|
29
|
+
del,
|
30
|
+
dfn,
|
31
|
+
em,
|
32
|
+
img,
|
33
|
+
ins,
|
34
|
+
kbd,
|
35
|
+
q,
|
36
|
+
s,
|
37
|
+
samp,
|
38
|
+
small,
|
39
|
+
strike,
|
40
|
+
strong,
|
41
|
+
sub,
|
42
|
+
sup,
|
43
|
+
tt,
|
44
|
+
var,
|
45
|
+
b,
|
46
|
+
u,
|
47
|
+
i,
|
48
|
+
center,
|
49
|
+
dl,
|
50
|
+
dt,
|
51
|
+
dd,
|
52
|
+
ol,
|
53
|
+
ul,
|
54
|
+
li,
|
55
|
+
fieldset,
|
56
|
+
form,
|
57
|
+
label,
|
58
|
+
legend,
|
59
|
+
table,
|
60
|
+
caption,
|
61
|
+
tbody,
|
62
|
+
tfoot,
|
63
|
+
thead,
|
64
|
+
tr,
|
65
|
+
th,
|
66
|
+
td,
|
67
|
+
article,
|
68
|
+
aside,
|
69
|
+
canvas,
|
70
|
+
details,
|
71
|
+
embed,
|
72
|
+
figure,
|
73
|
+
figcaption,
|
74
|
+
footer,
|
75
|
+
header,
|
76
|
+
hgroup,
|
77
|
+
menu,
|
78
|
+
nav,
|
79
|
+
output,
|
80
|
+
ruby,
|
81
|
+
section,
|
82
|
+
summary,
|
83
|
+
time,
|
84
|
+
mark,
|
85
|
+
audio,
|
86
|
+
video {
|
87
|
+
margin: 0;
|
88
|
+
padding: 0;
|
89
|
+
border: 0;
|
90
|
+
font-size: 100%;
|
91
|
+
font: inherit;
|
92
|
+
}
|
93
|
+
/* HTML5 display-role reset for older browsers */
|
94
|
+
article,
|
95
|
+
aside,
|
96
|
+
details,
|
97
|
+
figcaption,
|
98
|
+
figure,
|
99
|
+
footer,
|
100
|
+
header,
|
101
|
+
hgroup,
|
102
|
+
menu,
|
103
|
+
nav,
|
104
|
+
section {
|
105
|
+
display: block;
|
106
|
+
}
|
107
|
+
body {
|
108
|
+
line-height: 1;
|
109
|
+
}
|
110
|
+
ol,
|
111
|
+
ul {
|
112
|
+
list-style: none;
|
113
|
+
}
|
114
|
+
blockquote,
|
115
|
+
q {
|
116
|
+
quotes: none;
|
117
|
+
}
|
118
|
+
blockquote:before,
|
119
|
+
blockquote:after,
|
120
|
+
q:before,
|
121
|
+
q:after {
|
122
|
+
content: '';
|
123
|
+
content: none;
|
124
|
+
}
|
125
|
+
table {
|
126
|
+
border-collapse: collapse;
|
127
|
+
border-spacing: 0;
|
128
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
@mixin theme() {
|
2
|
+
.mdc-banner {
|
3
|
+
--cv-action-ribbon-background: transparent;
|
4
|
+
|
5
|
+
background-color: var(--cv-action-ribbon-background);
|
6
|
+
overflow: hidden;
|
7
|
+
|
8
|
+
.mdc-banner__content {
|
9
|
+
max-width: inherit;
|
10
|
+
}
|
11
|
+
|
12
|
+
.mdc-banner__graphic,
|
13
|
+
.mdc-banner__text {
|
14
|
+
--mdc-theme-on-surface: var(--cv-theme-on-surface-38);
|
15
|
+
|
16
|
+
color: var(--mdc-theme-on-surface);
|
17
|
+
}
|
18
|
+
|
19
|
+
.mdc-banner__text {
|
20
|
+
margin-left: 16px;
|
21
|
+
font-family: var(--mdc-typography-caption-font-family);
|
22
|
+
font-size: var(--mdc-typography-caption-font-size);
|
23
|
+
font-weight: var(--mdc-typography-caption-font-weight);
|
24
|
+
line-height: var(--mdc-typography-caption-line-height);
|
25
|
+
}
|
26
|
+
|
27
|
+
&.caution {
|
28
|
+
--cv-action-ribbon-background: var(--cv-theme-caution-8);
|
29
|
+
|
30
|
+
.mdc-banner__graphic,
|
31
|
+
.mdc-banner__text {
|
32
|
+
--mdc-theme-on-surface: var(--mdc-theme-caution);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
&.negative {
|
37
|
+
--cv-action-ribbon-background: var(--cv-theme-negative-8);
|
38
|
+
|
39
|
+
.mdc-banner__graphic,
|
40
|
+
.mdc-banner__text {
|
41
|
+
--mdc-theme-on-surface: var(--mdc-theme-negative);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
&.active {
|
46
|
+
--cv-action-ribbon-background: var(--cv-theme-primary-8);
|
47
|
+
|
48
|
+
.mdc-banner__graphic,
|
49
|
+
.mdc-banner__text {
|
50
|
+
--mdc-theme-on-surface: var(--cv-theme-primary);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
&.positive {
|
55
|
+
--cv-action-ribbon-background: var(--cv-theme-positive-8);
|
56
|
+
|
57
|
+
.mdc-banner__graphic,
|
58
|
+
.mdc-banner__text {
|
59
|
+
--mdc-theme-on-surface: var(--mdc-theme-positive);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
&.loading {
|
64
|
+
.mdc-banner__graphic,
|
65
|
+
.mdc-banner__text {
|
66
|
+
--mdc-theme-on-surface: var(--mdc-theme-primary);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
&.pending {
|
71
|
+
.mdc-banner__graphic,
|
72
|
+
.mdc-banner__text {
|
73
|
+
--mdc-theme-on-surface: var(--mdc-theme-on-surface-variant);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
&.checked {
|
78
|
+
--cv-action-ribbon-background: var(--cv-theme-primary-8);
|
79
|
+
|
80
|
+
.mdc-banner__graphic,
|
81
|
+
.mdc-banner__text {
|
82
|
+
--mdc-theme-on-surface: var(--mdc-theme-on-surface-variant);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
::slotted(*) {
|
88
|
+
margin-left: 8px;
|
89
|
+
}
|
90
|
+
}
|
@@ -0,0 +1,164 @@
|
|
1
|
+
import { addHasRemoveClass } from '@material/mwc-base/base-element';
|
2
|
+
import { observer } from '@material/mwc-base/observer';
|
3
|
+
import { MDCBannerAdapter } from '@material/banner/adapter';
|
4
|
+
import {
|
5
|
+
Action,
|
6
|
+
CloseReason,
|
7
|
+
events,
|
8
|
+
selectors,
|
9
|
+
} from '@material/banner/constants';
|
10
|
+
import { MDCBannerFoundation } from '@material/banner';
|
11
|
+
import { html, LitElement, TemplateResult } from 'lit';
|
12
|
+
import { classMap } from 'lit/directives/class-map.js';
|
13
|
+
import { property, query } from 'lit/decorators.js';
|
14
|
+
|
15
|
+
export class ActionRibbonBase extends LitElement {
|
16
|
+
protected mdcFoundation!: MDCBannerFoundation;
|
17
|
+
protected readonly mdcFoundationClass = MDCBannerFoundation;
|
18
|
+
|
19
|
+
@query('.mdc-banner') protected mdcRoot!: HTMLElement;
|
20
|
+
@query(selectors.CONTENT) protected mdcContent!: HTMLElement;
|
21
|
+
@query(selectors.PRIMARY_ACTION) protected primaryActionEl!: HTMLElement;
|
22
|
+
|
23
|
+
@property({ type: Boolean, reflect: true })
|
24
|
+
@observer(function (this: ActionRibbonBase, value: boolean) {
|
25
|
+
if (this.mdcFoundation) {
|
26
|
+
if (value) {
|
27
|
+
this.mdcFoundation.open();
|
28
|
+
} else {
|
29
|
+
this.mdcFoundation.close(this.reason);
|
30
|
+
this.reason = CloseReason.UNSPECIFIED;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
})
|
34
|
+
open = true;
|
35
|
+
|
36
|
+
@property({ type: String }) labelText = '';
|
37
|
+
|
38
|
+
@property({ type: String }) icon = '';
|
39
|
+
@property({ type: String }) iconAriaLabel = '';
|
40
|
+
|
41
|
+
@property({ type: Boolean }) centered = true;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* The state representation active|negative|positive|caution|loading|pending|checked
|
45
|
+
*/
|
46
|
+
@property()
|
47
|
+
state?:
|
48
|
+
| 'active'
|
49
|
+
| 'negative'
|
50
|
+
| 'positive'
|
51
|
+
| 'caution'
|
52
|
+
| 'loading'
|
53
|
+
| 'pending'
|
54
|
+
| 'checked';
|
55
|
+
|
56
|
+
protected reason: CloseReason = CloseReason.UNSPECIFIED;
|
57
|
+
|
58
|
+
protected override render() {
|
59
|
+
const classes = {
|
60
|
+
'mdc-banner': true,
|
61
|
+
negative: this.state === 'negative',
|
62
|
+
positive: this.state === 'positive',
|
63
|
+
caution: this.state === 'caution',
|
64
|
+
active: this.state === 'active',
|
65
|
+
loading: this.state === 'loading',
|
66
|
+
pending: this.state === 'pending',
|
67
|
+
checked: this.state === 'checked',
|
68
|
+
'mdc-banner--centered': this.centered,
|
69
|
+
};
|
70
|
+
return html` <div class="${classMap(classes)}" role="banner">
|
71
|
+
<div
|
72
|
+
class="mdc-banner__content"
|
73
|
+
role="alertdialog"
|
74
|
+
aria-live="assertive"
|
75
|
+
aria-label="${this.labelText}"
|
76
|
+
>
|
77
|
+
<div class="mdc-banner__graphic-text-wrapper">
|
78
|
+
${this.icon ? this.renderIcon() : ''}
|
79
|
+
<div class="mdc-banner__text">${this.labelText}</div>
|
80
|
+
</div>
|
81
|
+
<div class="mdc-banner__actions">
|
82
|
+
<slot name="action-items"></slot>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>`;
|
86
|
+
}
|
87
|
+
|
88
|
+
protected renderIcon(): TemplateResult {
|
89
|
+
return html` <div
|
90
|
+
class="mdc-banner__graphic"
|
91
|
+
role="img"
|
92
|
+
aria-label="${this.iconAriaLabel}"
|
93
|
+
>
|
94
|
+
<slot name="icon">
|
95
|
+
<cv-icon class="mdc-banner__icon"> ${this.icon} </cv-icon>
|
96
|
+
</slot>
|
97
|
+
</div>`;
|
98
|
+
}
|
99
|
+
|
100
|
+
protected createAdapter(): MDCBannerAdapter {
|
101
|
+
return {
|
102
|
+
...addHasRemoveClass(this.mdcRoot),
|
103
|
+
getContentHeight: () => this.mdcContent.offsetHeight,
|
104
|
+
setStyleProperty: (property: any, value: string) =>
|
105
|
+
this.mdcRoot.style.setProperty(property, value),
|
106
|
+
trapFocus: () => this.primaryActionEl?.focus(),
|
107
|
+
releaseFocus: () => this.primaryActionEl?.blur(),
|
108
|
+
notifyActionClicked: (action: Action) =>
|
109
|
+
this.dispatchEvent(
|
110
|
+
new CustomEvent(events.ACTION_CLICKED, {
|
111
|
+
bubbles: true,
|
112
|
+
cancelable: true,
|
113
|
+
detail: { reason: action },
|
114
|
+
}),
|
115
|
+
),
|
116
|
+
notifyClosed: (reason: CloseReason) =>
|
117
|
+
this.dispatchEvent(
|
118
|
+
new CustomEvent(events.CLOSED, {
|
119
|
+
bubbles: true,
|
120
|
+
cancelable: true,
|
121
|
+
detail: { reason: reason },
|
122
|
+
}),
|
123
|
+
),
|
124
|
+
notifyClosing: (reason: CloseReason) =>
|
125
|
+
this.dispatchEvent(
|
126
|
+
new CustomEvent(events.CLOSING, {
|
127
|
+
bubbles: true,
|
128
|
+
cancelable: true,
|
129
|
+
detail: { reason: reason },
|
130
|
+
}),
|
131
|
+
),
|
132
|
+
notifyOpened: () =>
|
133
|
+
this.dispatchEvent(
|
134
|
+
new CustomEvent(events.OPENED, { bubbles: true, cancelable: true }),
|
135
|
+
),
|
136
|
+
notifyOpening: () =>
|
137
|
+
this.dispatchEvent(
|
138
|
+
new CustomEvent(events.OPENING, { bubbles: true, cancelable: true }),
|
139
|
+
),
|
140
|
+
};
|
141
|
+
}
|
142
|
+
|
143
|
+
/** @export */
|
144
|
+
show() {
|
145
|
+
this.open = true;
|
146
|
+
}
|
147
|
+
|
148
|
+
/** @export */
|
149
|
+
close(reason = CloseReason.UNSPECIFIED) {
|
150
|
+
this.reason = reason;
|
151
|
+
this.open = false;
|
152
|
+
}
|
153
|
+
|
154
|
+
protected override async firstUpdated() {
|
155
|
+
if (this.mdcFoundation !== undefined) {
|
156
|
+
this.mdcFoundation.destroy();
|
157
|
+
}
|
158
|
+
this.mdcFoundation = new this.mdcFoundationClass(this.createAdapter());
|
159
|
+
|
160
|
+
if (this.open) {
|
161
|
+
this.mdcFoundation.open();
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
@use '@material/banner/banner' as banner-core;
|
2
|
+
@use './action-ribbon.theme';
|
3
|
+
|
4
|
+
@include banner-core.core-styles();
|
5
|
+
@include action-ribbon.theme();
|
6
|
+
|
7
|
+
.mdc-banner__content {
|
8
|
+
min-height: 56px;
|
9
|
+
}
|
10
|
+
|
11
|
+
.mdc-banner__graphic {
|
12
|
+
background-color: transparent;
|
13
|
+
margin-top: 8px;
|
14
|
+
margin-bottom: 8px;
|
15
|
+
font-variation-settings: 'FILL' 1;
|
16
|
+
}
|
17
|
+
|
18
|
+
.mdc-banner__actions {
|
19
|
+
align-self: center;
|
20
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* @vitest-environment jsdom
|
3
|
+
*/
|
4
|
+
import { it, describe, expect } from 'vitest';
|
5
|
+
import { CovalentActionRibbon } from './action-ribbon';
|
6
|
+
|
7
|
+
describe('Action ribbon', () => {
|
8
|
+
it('should work', () => {
|
9
|
+
expect(new CovalentActionRibbon()).toBeDefined();
|
10
|
+
});
|
11
|
+
});
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import './action-ribbon';
|
2
|
+
import '../button/button';
|
3
|
+
import '../icon/icon';
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'Components/Action Ribbon',
|
7
|
+
parameters: {
|
8
|
+
layout: 'fullscreen',
|
9
|
+
},
|
10
|
+
argTypes: {
|
11
|
+
label: { control: 'text' },
|
12
|
+
icon: {
|
13
|
+
control: 'text',
|
14
|
+
},
|
15
|
+
},
|
16
|
+
};
|
17
|
+
|
18
|
+
export const Neutral = ({
|
19
|
+
label = 'No changes',
|
20
|
+
color,
|
21
|
+
icon,
|
22
|
+
saveDisabled = false,
|
23
|
+
}) => {
|
24
|
+
return `
|
25
|
+
<cv-action-ribbon
|
26
|
+
labelText="${label}"
|
27
|
+
state="${color}"
|
28
|
+
${icon ? `icon="${icon}"` : null}
|
29
|
+
${icon ? `iconAriaLabel="${icon}"` : null}>
|
30
|
+
<cv-button slot="action-items" outlined>Cancel</cv-button>
|
31
|
+
<cv-button slot="action-items" ${
|
32
|
+
saveDisabled ? 'disabled' : null
|
33
|
+
} raised>Save</cv-button>
|
34
|
+
</cv-action-ribbon>`;
|
35
|
+
};
|
36
|
+
|
37
|
+
export const Active = Neutral.bind({});
|
38
|
+
Active.args = {
|
39
|
+
color: 'active',
|
40
|
+
label: 'You have unsaved changes',
|
41
|
+
};
|
42
|
+
export const Positive = Neutral.bind({});
|
43
|
+
Positive.args = {
|
44
|
+
color: 'positive',
|
45
|
+
label: '(3/3) items selected',
|
46
|
+
icon: 'check',
|
47
|
+
};
|
48
|
+
export const Negative = Neutral.bind({});
|
49
|
+
Negative.args = {
|
50
|
+
color: 'negative',
|
51
|
+
label: 'The name field may not contain numbers',
|
52
|
+
icon: 'error',
|
53
|
+
saveDisabled: true,
|
54
|
+
};
|
55
|
+
export const Caution = Neutral.bind({});
|
56
|
+
Caution.args = {
|
57
|
+
color: 'caution',
|
58
|
+
label: 'These changes will increase your monthly spending rate',
|
59
|
+
icon: 'warning',
|
60
|
+
};
|
61
|
+
export const Loading = Neutral.bind({});
|
62
|
+
Loading.args = {
|
63
|
+
color: 'loading',
|
64
|
+
label: 'These changes will increase your monthly spending rate',
|
65
|
+
icon: 'houseboat',
|
66
|
+
};
|
67
|
+
export const Pending = Neutral.bind({});
|
68
|
+
Pending.args = {
|
69
|
+
color: 'pending',
|
70
|
+
label: 'These changes will increase your monthly spending rate',
|
71
|
+
icon: 'houseboat',
|
72
|
+
};
|
73
|
+
export const Checked = Neutral.bind({});
|
74
|
+
Checked.args = {
|
75
|
+
color: 'checked',
|
76
|
+
label: 'These changes will increase your monthly spending rate',
|
77
|
+
icon: 'houseboat',
|
78
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
import { ActionRibbonBase } from './action-ribbon-base';
|
4
|
+
import styles from './action-ribbon.scss?inline';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Action ribbon
|
8
|
+
*
|
9
|
+
* @slot - This element has a slot
|
10
|
+
*/
|
11
|
+
@customElement('cv-action-ribbon')
|
12
|
+
export class CovalentActionRibbon extends ActionRibbonBase {
|
13
|
+
static override styles = [
|
14
|
+
css`
|
15
|
+
${unsafeCSS(styles)}
|
16
|
+
`,
|
17
|
+
];
|
18
|
+
}
|
19
|
+
|
20
|
+
declare global {
|
21
|
+
interface HTMLElementTagNameMap {
|
22
|
+
'cv-action-ribbon': CovalentActionRibbon;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
export default CovalentActionRibbon;
|