@sk-web-gui/core 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Sundsvalls Kommun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Installation
2
+
3
+ ```sh
4
+ yarn add @sk-web-gui/core
5
+ ```
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@sk-web-gui/core",
3
+ "version": "0.1.2",
4
+ "license": "MIT",
5
+ "main": "src/index.js",
6
+ "files": [
7
+ "src/",
8
+ "dist/"
9
+ ],
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/vechai/sk-web-gui.git"
16
+ },
17
+ "scripts": {
18
+ "build": "node scripts/build.js",
19
+ "version": "yarn build"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/vechai/sk-web-gui/issues"
23
+ },
24
+ "peerDependencies": {
25
+ "tailwindcss": ">=2.1.0"
26
+ },
27
+ "devDependencies": {
28
+ "autoprefixer": "^10.2.6",
29
+ "clean-css": "^5.1.2",
30
+ "postcss": "^8.3.4",
31
+ "postcss-import": "^14.0.2",
32
+ "tailwindcss": "^2.2.4"
33
+ },
34
+ "gitHead": "f048e706321e9d44b425a55cc44e261a248e01c2"
35
+ }
package/src/colors.js ADDED
@@ -0,0 +1,77 @@
1
+ const withOpacity = require("./with-opacity");
2
+
3
+ module.exports = {
4
+ primary: {
5
+ DEFAULT: withOpacity("--vc-colors-primary-DEFAULT"),
6
+ dark: withOpacity("--vc-colors-primary-dark"),
7
+ light: withOpacity("--vc-colors-primary-light"),
8
+ active: withOpacity("--vc-colors-primary-active"),
9
+ 50: withOpacity("--vc-colors-primary-DEFAULT"),
10
+ 100: withOpacity("--vc-colors-primary-DEFAULT"),
11
+ 200: withOpacity("--vc-colors-primary-DEFAULT"),
12
+ 300: withOpacity("--vc-colors-primary-DEFAULT"),
13
+ 400: withOpacity("--vc-colors-primary-DEFAULT"),
14
+ 500: withOpacity("--vc-colors-primary-DEFAULT"),
15
+ 600: withOpacity("--vc-colors-primary-DEFAULT"),
16
+ 700: withOpacity("--vc-colors-primary-DEFAULT"),
17
+ 800: withOpacity("--vc-colors-primary-DEFAULT"),
18
+ 900: withOpacity("--vc-colors-primary-DEFAULT"),
19
+ },
20
+
21
+ secondary: {
22
+ DEFAULT: withOpacity("--vc-colors-secondary-DEFAULT"),
23
+ dark: withOpacity("--vc-colors-secondary-dark"),
24
+ light: withOpacity("--vc-colors-secondary-light"),
25
+ active: withOpacity("--vc-colors-secondary-active"),
26
+ 50: withOpacity("--vc-colors-secondary-DEFAULT"),
27
+ 100: withOpacity("--vc-colors-secondary-DEFAULT"),
28
+ 200: withOpacity("--vc-colors-secondary-DEFAULT"),
29
+ 300: withOpacity("--vc-colors-secondary-DEFAULT"),
30
+ 400: withOpacity("--vc-colors-secondary-DEFAULT"),
31
+ 500: withOpacity("--vc-colors-secondary-DEFAULT"),
32
+ 600: withOpacity("--vc-colors-secondary-DEFAULT"),
33
+ 700: withOpacity("--vc-colors-secondary-DEFAULT"),
34
+ 800: withOpacity("--vc-colors-secondary-DEFAULT"),
35
+ 900: withOpacity("--vc-colors-secondary-DEFAULT"),
36
+ },
37
+
38
+ neutral: {
39
+ DEFAULT: withOpacity("--vc-colors-neutral"),
40
+ 50: withOpacity("--vc-colors-neutral-50"),
41
+ 100: withOpacity("--vc-colors-neutral-100"),
42
+ 200: withOpacity("--vc-colors-neutral-200"),
43
+ 300: withOpacity("--vc-colors-neutral-300"),
44
+ 400: withOpacity("--vc-colors-neutral-400"),
45
+ 500: withOpacity("--vc-colors-neutral-500"),
46
+ 600: withOpacity("--vc-colors-neutral-600"),
47
+ 700: withOpacity("--vc-colors-neutral-700"),
48
+ 800: withOpacity("--vc-colors-neutral-800"),
49
+ 900: withOpacity("--vc-colors-neutral-900"),
50
+ },
51
+
52
+ whiteAlpha: {
53
+ 50: "rgba(255, 255, 255, 0.04)",
54
+ 100: "rgba(255, 255, 255, 0.06)",
55
+ 200: "rgba(255, 255, 255, 0.08)",
56
+ 300: "rgba(255, 255, 255, 0.16)",
57
+ 400: "rgba(255, 255, 255, 0.24)",
58
+ 500: "rgba(255, 255, 255, 0.36)",
59
+ 600: "rgba(255, 255, 255, 0.48)",
60
+ 700: "rgba(255, 255, 255, 0.64)",
61
+ 800: "rgba(255, 255, 255, 0.80)",
62
+ 900: "rgba(255, 255, 255, 0.92)",
63
+ },
64
+
65
+ blackAlpha: {
66
+ 50: "rgba(0, 0, 0, 0.04)",
67
+ 100: "rgba(0, 0, 0, 0.06)",
68
+ 200: "rgba(0, 0, 0, 0.08)",
69
+ 300: "rgba(0, 0, 0, 0.16)",
70
+ 400: "rgba(0, 0, 0, 0.24)",
71
+ 500: "rgba(0, 0, 0, 0.36)",
72
+ 600: "rgba(0, 0, 0, 0.48)",
73
+ 700: "rgba(0, 0, 0, 0.64)",
74
+ 800: "rgba(0, 0, 0, 0.80)",
75
+ 900: "rgba(0, 0, 0, 0.92)",
76
+ },
77
+ };
@@ -0,0 +1,42 @@
1
+ module.exports = Accordion = () => ({
2
+
3
+ ".accordion": {
4
+ //"@apply": {},
5
+ //padding: "2.4rem",
6
+
7
+ "@apply border border-gray-stroke": {},
8
+
9
+ "&-header": {
10
+ "@apply flex flex-col text-left bg-primary text-white": {},
11
+
12
+ "[aria-expanded=\"true\"] &": {
13
+ "@apply bg-hover": {}
14
+ }
15
+ },
16
+
17
+ "&-is-open &-header": {
18
+ "@apply bg-hover": {}
19
+ },
20
+
21
+ "&-toggle": {
22
+ "@apply flex text-left text-lg m-4 inline-block": {},
23
+ //"@apply focus-visible:shadow shadow-lg": {},
24
+ "&:focus-visible, &:focus": {
25
+ boxShadow: "0 0 0 0.4rem #fff!important",
26
+ outline: "0",
27
+ //"@apply border-4": {},
28
+ }
29
+ },
30
+
31
+ "&-body": {
32
+ "@apply transition-all h-0 hidden overflow-hidden": {},
33
+ transitionProperty: "height",
34
+ transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)",
35
+ transitionDuration: "150m",
36
+
37
+ "&[aria-hidden=\"false\"], &[data-hidden=\"false\"]": {
38
+ "@apply block h-auto p-lg": {},
39
+ },
40
+ },
41
+ },
42
+ });
@@ -0,0 +1,98 @@
1
+ function alertSubtle(colors) {
2
+ return {
3
+ ".alert-subtle": {
4
+ "@apply border rounded-base": {},
5
+ "@apply text-neutral-900": {},
6
+
7
+ ...colors.reduce(
8
+ (styles, color) => ({
9
+ ...styles,
10
+ [`&[data-color="${color}"]`]: {
11
+ [`@apply bg-${color}-50 border-${color}-500`]: {},
12
+
13
+ [`@apply dark:text-${color}-300 dark:bg-${color}-500`]: {},
14
+ "@apply dark:bg-opacity-15": {},
15
+ "@apply dark:border-opacity-40": {},
16
+ },
17
+ }),
18
+ {}
19
+ ),
20
+ },
21
+ };
22
+ }
23
+
24
+ function alertSolid(colors) {
25
+ return {
26
+ ".alert-solid": {
27
+ "@apply border rounded-base": {},
28
+ "@apply text-white": {},
29
+
30
+ ...colors.reduce(
31
+ (styles, color) => ({
32
+ ...styles,
33
+ [`&[data-color="${color}"]`]: {
34
+ [`@apply bg-${color}-500 border-${color}-700 border-opacity-20`]: {},
35
+
36
+ [`@apply dark:bg-${color}-600 dark:border-${color}-500`]: {},
37
+ "@apply dark:border-opacity-40": {},
38
+ },
39
+ }),
40
+ {}
41
+ ),
42
+ },
43
+ };
44
+ }
45
+
46
+ function alertLeftAccent(colors) {
47
+ return {
48
+ ".alert-left-accent": {
49
+ "@apply border-l-2 rounded-none": {},
50
+ "@apply text-neutral-900": {},
51
+
52
+ ...colors.reduce(
53
+ (styles, color) => ({
54
+ ...styles,
55
+ [`&[data-color="${color}"]`]: {
56
+ [`@apply bg-transparent border-${color}-500`]: {},
57
+
58
+ [`@apply dark:text-${color}-300`]: {},
59
+ },
60
+ }),
61
+ {}
62
+ ),
63
+ },
64
+ };
65
+ }
66
+
67
+ function alertCloseButton(colors) {
68
+ return {
69
+ ".alert-close-button": {
70
+ "@apply absolute right-4 cursor-base focus-visible:outline-none": {},
71
+ "@apply text-neutral-600 hover:text-neutral-700": {},
72
+
73
+ ...colors.reduce(
74
+ (styles, color) => ({
75
+ ...styles,
76
+ [`&[data-color="${color}"]`]: {
77
+ [`@apply dark:text-${color}-300 dark:hover:text-${color}-400`]: {},
78
+ },
79
+ }),
80
+ {}
81
+ ),
82
+ },
83
+ };
84
+ }
85
+
86
+ module.exports = Alert = (colors) => ({
87
+ ".alert": {
88
+ "@apply w-full flex items-center px-4 py-3 relative overflow-hidden text-sm": {},
89
+ },
90
+
91
+ // variants
92
+ ...alertSubtle(colors),
93
+ ...alertSolid(colors),
94
+ ...alertLeftAccent(colors),
95
+
96
+ // close button
97
+ ...alertCloseButton(colors),
98
+ });
@@ -0,0 +1,85 @@
1
+ module.exports = Avatar = () => ({
2
+ ".avatar": {
3
+ "@apply relative inline-flex items-center justify-center flex-shrink-0 align-top rounded-full": {},
4
+ "@apply bg-neutral-300 text-neutral-800": {},
5
+ // dark colors
6
+ "@apply dark:bg-neutral-600 dark:text-neutral-100": {},
7
+
8
+ "&-2xs": {
9
+ "@apply w-4 h-4": {},
10
+ },
11
+
12
+ "&-xs": {
13
+ "@apply w-5 h-5": {},
14
+ },
15
+
16
+ "&-sm": {
17
+ "@apply w-6 h-6": {},
18
+ },
19
+
20
+ "&-md": {
21
+ "@apply w-7 h-7": {},
22
+ },
23
+
24
+ "&-lg": {
25
+ "@apply w-8 h-8": {},
26
+ },
27
+
28
+ "&-xl": {
29
+ "@apply w-10 h-10": {},
30
+ },
31
+
32
+ "&-2xl": {
33
+ "@apply w-12 h-12": {},
34
+ },
35
+
36
+ "&-3xl": {
37
+ "@apply w-16 h-16": {},
38
+ },
39
+ },
40
+
41
+ ".avatar-bordered": {
42
+ "@apply border-2 border-white": {},
43
+ "@apply dark:border-neutral-800": {},
44
+ },
45
+
46
+ ".avatar-name": {
47
+ "@apply font-medium text-center uppercase": {},
48
+
49
+ "&-2xs": {
50
+ "@apply w-4 h-4": {},
51
+ },
52
+
53
+ "&-xs": {
54
+ "@apply w-5 h-5": {},
55
+ },
56
+
57
+ "&-sm": {
58
+ "@apply w-6 h-6": {},
59
+ },
60
+
61
+ "&-md": {
62
+ "@apply w-7 h-7": {},
63
+ },
64
+
65
+ "&-lg": {
66
+ "@apply w-8 h-8": {},
67
+ },
68
+
69
+ "&-xl": {
70
+ "@apply w-10 h-10": {},
71
+ },
72
+
73
+ "&-2xl": {
74
+ "@apply w-12 h-12": {},
75
+ },
76
+
77
+ "&-3xl": {
78
+ "@apply w-16 h-16": {},
79
+ },
80
+ },
81
+
82
+ ".avatar-group": {
83
+ "@apply flex items-center justify-end flex-row-reverse": {},
84
+ },
85
+ });
@@ -0,0 +1,61 @@
1
+ module.exports = Badge = (colors) => ({
2
+ ".badge": {
3
+ "@apply inline-block text-xs font-medium leading-4 text-center whitespace-nowrap": {},
4
+
5
+ "&-light": {
6
+ "@apply text-neutral-900 bg-neutral-200 border border-transparent": {},
7
+ "@apply dark:text-neutral-100 dark:bg-neutral-700": {},
8
+
9
+ ...colors.reduce(
10
+ (styles, color) => ({
11
+ ...styles,
12
+ [`&[data-color="${color}"]`]: {
13
+ [`@apply text-${color}-800 bg-${color}-100`]: {},
14
+ [`@apply dark:text-${color}-400 dark:bg-${color}-500`]: {},
15
+ "@apply dark:bg-opacity-15": {},
16
+ },
17
+ }),
18
+ {}
19
+ ),
20
+ },
21
+
22
+ "&-solid": {
23
+ "@apply text-white bg-neutral-500 border border-transparent": {},
24
+ "@apply dark:border-neutral-600 dark:text-neutral-100 dark:bg-neutral-700": {},
25
+ ...colors.reduce(
26
+ (styles, color) => ({
27
+ ...styles,
28
+ [`&[data-color="${color}"]`]: {
29
+ [`@apply bg-${color}-500`]: {},
30
+ [`@apply dark:text-${color}-400 dark:border-${color}-500 dark:bg-${color}-500`]: {},
31
+ "@apply dark:bg-opacity-15": {},
32
+ "@apply dark:border-opacity-40": {},
33
+ },
34
+ }),
35
+ {}
36
+ ),
37
+
38
+ },
39
+
40
+ "&-sm": {
41
+ minWidth: "14px",
42
+ height: "14px",
43
+ padding: 0,
44
+ lineHeight: "12px",
45
+ borderRadius: "2em",
46
+ },
47
+
48
+ "&-md": {
49
+ "@apply px-1.5 py-0": {},
50
+ minWidth: "20px",
51
+ height: "20px",
52
+ lineHeight: "18px",
53
+ borderRadius: "2em",
54
+ },
55
+
56
+ "&-shadow": {
57
+ "@apply ring-1 ring-white": {},
58
+ "@apply dark:ring-black": {},
59
+ },
60
+ },
61
+ });
@@ -0,0 +1,13 @@
1
+ module.exports = Breadcrumb = () => ({
2
+ ".breadcrumb": {
3
+ "@apply relative": {},
4
+
5
+ "&-item": {
6
+ "@apply inline-flex items-center whitespace-nowrap": {},
7
+ },
8
+
9
+ "&-separator": {
10
+ "@apply mx-2 text-neutral-500": {},
11
+ },
12
+ },
13
+ });
@@ -0,0 +1,46 @@
1
+ // TODO: how it works with prefix?
2
+ module.exports = ButtonGroup = () => ({
3
+ ".btn-group": {
4
+ "@apply inline-block": {},
5
+
6
+ "&.btn-group-attached": {
7
+ "> .btn-icon": {
8
+ boxSizing: "content-box",
9
+ },
10
+ "> *:first-of-type:not(:last-of-type)": {
11
+ borderTopRightRadius: "0px",
12
+ borderBottomRightRadius: "0px",
13
+ },
14
+
15
+ "> *:not(:first-of-type):not(:last-of-type)": {
16
+ borderRadius: "0px",
17
+ },
18
+
19
+ "> *:not(:first-of-type):last-of-type": {
20
+ borderTopLeftRadius: "0px",
21
+ borderBottomLeftRadius: "0px",
22
+ },
23
+
24
+ "> .btn-solid:not(:last-child), > .btn-outline:not(:last-child)": {
25
+ borderRightWidth: "0px",
26
+ },
27
+
28
+ "> .btn-solid:hover, > .btn-outline:hover": {
29
+ borderRightWidth: "1px",
30
+ },
31
+
32
+ "> *:not(:last-of-type):hover + .btn-solid, > *:not(:last-of-type):hover + .btn-outline": {
33
+ borderLeftWidth: "0px",
34
+ },
35
+
36
+ "> .btn-solid:focus, > .btn-outline:focus": {
37
+ zIndex: "1px",
38
+ borderRightWidth: "1px",
39
+ },
40
+
41
+ "> *:not(:last-of-type):focus + .btn-solid, > *:not(:last-of-type):focus + .btn-outline": {
42
+ borderLeftWidth: "0px",
43
+ },
44
+ },
45
+ },
46
+ });