@sk-web-gui/core 0.1.3 → 0.1.6
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 +21 -21
- package/README.md +4 -4
- package/package.json +2 -2
- package/src/colors.js +77 -77
- package/src/components/accordion.js +42 -42
- package/src/components/alert.js +98 -98
- package/src/components/avatar.js +85 -85
- package/src/components/badge.js +61 -61
- package/src/components/breadcrumb.js +13 -13
- package/src/components/button-group.js +46 -46
- package/src/components/button.js +295 -295
- package/src/components/card.js +55 -55
- package/src/components/checkbox.js +128 -128
- package/src/components/code.js +9 -9
- package/src/components/cookie-consent.js +26 -26
- package/src/components/divider.js +12 -12
- package/src/components/dot.js +84 -84
- package/src/components/forms.js +246 -246
- package/src/components/icon-button.js +5 -5
- package/src/components/icon.js +9 -9
- package/src/components/kbd.js +9 -9
- package/src/components/link.js +13 -13
- package/src/components/message.js +29 -29
- package/src/components/modal.js +29 -29
- package/src/components/notification.js +56 -56
- package/src/components/radio.js +103 -103
- package/src/components/switch.js +112 -112
- package/src/components/table.js +13 -13
- package/src/components/tag.js +109 -109
- package/src/components/user-menu.js +40 -0
- package/src/index.js +241 -235
- package/src/with-opacity.js +6 -6
package/src/index.js
CHANGED
|
@@ -1,235 +1,241 @@
|
|
|
1
|
-
const plugin = require("tailwindcss/plugin");
|
|
2
|
-
|
|
3
|
-
const colors = require("./colors");
|
|
4
|
-
const withOpacity = require("./with-opacity");
|
|
5
|
-
// components
|
|
6
|
-
const Alert = require("./components/alert");
|
|
7
|
-
const Breadcrumb = require("./components/breadcrumb");
|
|
8
|
-
const ButtonGroup = require("./components/button-group");
|
|
9
|
-
|
|
10
|
-
const Checkbox = require("./components/checkbox");
|
|
11
|
-
const Dot = require("./components/dot");
|
|
12
|
-
const Forms = require("./components/forms");
|
|
13
|
-
const IconButton = require("./components/icon-button");
|
|
14
|
-
const Icon = require("./components/icon");
|
|
15
|
-
const Link = require("./components/link");
|
|
16
|
-
const Message = require("./components/message");
|
|
17
|
-
const Notification = require("./components/notification");
|
|
18
|
-
const Radio = require("./components/radio");
|
|
19
|
-
const Switch = require("./components/switch");
|
|
20
|
-
|
|
21
|
-
const Button = require("./components/button");
|
|
22
|
-
const Accordion = require("./components/accordion");
|
|
23
|
-
const Card = require(
|
|
24
|
-
const Table = require(
|
|
25
|
-
|
|
26
|
-
const Modal = require(
|
|
27
|
-
const CookieConsent = require(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
"@apply
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
h4
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
DEFAULT: "#
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
})
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
})
|
|
235
|
-
}
|
|
1
|
+
const plugin = require("tailwindcss/plugin");
|
|
2
|
+
|
|
3
|
+
const colors = require("./colors");
|
|
4
|
+
const withOpacity = require("./with-opacity");
|
|
5
|
+
// components
|
|
6
|
+
const Alert = require("./components/alert");
|
|
7
|
+
const Breadcrumb = require("./components/breadcrumb");
|
|
8
|
+
const ButtonGroup = require("./components/button-group");
|
|
9
|
+
|
|
10
|
+
const Checkbox = require("./components/checkbox");
|
|
11
|
+
const Dot = require("./components/dot");
|
|
12
|
+
const Forms = require("./components/forms");
|
|
13
|
+
const IconButton = require("./components/icon-button");
|
|
14
|
+
const Icon = require("./components/icon");
|
|
15
|
+
const Link = require("./components/link");
|
|
16
|
+
const Message = require("./components/message");
|
|
17
|
+
const Notification = require("./components/notification");
|
|
18
|
+
const Radio = require("./components/radio");
|
|
19
|
+
const Switch = require("./components/switch");
|
|
20
|
+
|
|
21
|
+
const Button = require("./components/button");
|
|
22
|
+
const Accordion = require("./components/accordion");
|
|
23
|
+
const Card = require("./components/card");
|
|
24
|
+
const Table = require("./components/table");
|
|
25
|
+
|
|
26
|
+
const Modal = require("./components/modal");
|
|
27
|
+
const CookieConsent = require("./components/cookie-consent");
|
|
28
|
+
const Divider = require("./components/divider");
|
|
29
|
+
|
|
30
|
+
const UserMenu = require("./components/user-menu");
|
|
31
|
+
|
|
32
|
+
const components = [
|
|
33
|
+
Alert,
|
|
34
|
+
Breadcrumb,
|
|
35
|
+
ButtonGroup,
|
|
36
|
+
Button,
|
|
37
|
+
Checkbox,
|
|
38
|
+
Dot,
|
|
39
|
+
Forms,
|
|
40
|
+
IconButton,
|
|
41
|
+
Icon,
|
|
42
|
+
Link,
|
|
43
|
+
Message,
|
|
44
|
+
Notification,
|
|
45
|
+
Radio,
|
|
46
|
+
Switch,
|
|
47
|
+
|
|
48
|
+
Table,
|
|
49
|
+
CookieConsent,
|
|
50
|
+
Modal,
|
|
51
|
+
|
|
52
|
+
Accordion,
|
|
53
|
+
Card,
|
|
54
|
+
Divider,
|
|
55
|
+
|
|
56
|
+
UserMenu,
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const defaultColors = ["primary", "secondary"];
|
|
60
|
+
|
|
61
|
+
module.exports = plugin.withOptions(
|
|
62
|
+
function (options = { colors: [], cssBase: true }) {
|
|
63
|
+
return function ({
|
|
64
|
+
addComponents,
|
|
65
|
+
addVariant,
|
|
66
|
+
addBase,
|
|
67
|
+
variants,
|
|
68
|
+
e,
|
|
69
|
+
theme,
|
|
70
|
+
addUtilities,
|
|
71
|
+
}) {
|
|
72
|
+
const optionColors = [...defaultColors, ...(options.colors || [])];
|
|
73
|
+
|
|
74
|
+
active({ addVariant, variants, e, theme, addUtilities });
|
|
75
|
+
selected({ addVariant, variants, e, theme, addUtilities });
|
|
76
|
+
disabled({ addVariant, variants, e, theme, addUtilities });
|
|
77
|
+
|
|
78
|
+
addComponents(
|
|
79
|
+
components.map((component) => component(optionColors, theme)),
|
|
80
|
+
{
|
|
81
|
+
respectPrefix: false,
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (options.cssBase) {
|
|
86
|
+
addBase({
|
|
87
|
+
html: {
|
|
88
|
+
"@apply text-foreground antialiased bg-base": {},
|
|
89
|
+
fontSize: "62.5%",
|
|
90
|
+
lineHeight: "1.5",
|
|
91
|
+
textRendering: "optimizeLegibility",
|
|
92
|
+
textSizeAdjust: "100%",
|
|
93
|
+
touchAction: "manipulation",
|
|
94
|
+
},
|
|
95
|
+
body: {
|
|
96
|
+
"@apply text-base leading-base": {},
|
|
97
|
+
position: "relative",
|
|
98
|
+
minHeight: "100%",
|
|
99
|
+
fontFeatureSettings: "'kern'",
|
|
100
|
+
},
|
|
101
|
+
"h1,h2,h3,h4,h5,h6": {
|
|
102
|
+
"@apply font-bold": {},
|
|
103
|
+
},
|
|
104
|
+
h1: { "@apply text-5xl leading-5xl": {} },
|
|
105
|
+
h2: { "@apply text-4xl leading-4xl": {} },
|
|
106
|
+
h3: { "@apply text-3xl leading-3xl": {} },
|
|
107
|
+
h4: { "@apply text-2xl leading-2xl": {} },
|
|
108
|
+
h5: { "@apply text-xl leading-xl": {} },
|
|
109
|
+
h6: { "@apply text-lg leading-lg": {} },
|
|
110
|
+
p: { "@apply my-4": {} },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
function () {
|
|
116
|
+
return {
|
|
117
|
+
theme: {
|
|
118
|
+
fontSize: {
|
|
119
|
+
tiny: "1rem",
|
|
120
|
+
xs: "1.2rem",
|
|
121
|
+
sm: "1.4rem",
|
|
122
|
+
base: "1.6rem",
|
|
123
|
+
lg: "1.8rem",
|
|
124
|
+
xl: "2.0rem",
|
|
125
|
+
"2xl": "2.4rem",
|
|
126
|
+
"3xl": "3.2rem",
|
|
127
|
+
"4xl": "4.0rem",
|
|
128
|
+
"5xl": "5.2rem",
|
|
129
|
+
},
|
|
130
|
+
extend: {
|
|
131
|
+
colors: {
|
|
132
|
+
...colors,
|
|
133
|
+
gray: {
|
|
134
|
+
DEFAULT: "#4b4b4b",
|
|
135
|
+
stroke: "#939393",
|
|
136
|
+
light: "#F4F4F4",
|
|
137
|
+
lighter: "#F9F9F9",
|
|
138
|
+
},
|
|
139
|
+
hover: {
|
|
140
|
+
DEFAULT: "#2B76B0",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
cursor: {
|
|
144
|
+
base: "var(--vc-cursor)",
|
|
145
|
+
},
|
|
146
|
+
spacing: {
|
|
147
|
+
sm: "8px",
|
|
148
|
+
md: "16px",
|
|
149
|
+
lg: "24px",
|
|
150
|
+
xl: "48px",
|
|
151
|
+
},
|
|
152
|
+
lineHeight: {
|
|
153
|
+
tiny: "1.4rem",
|
|
154
|
+
xs: "1.6rem",
|
|
155
|
+
sm: "2rem",
|
|
156
|
+
base: "2.4rem",
|
|
157
|
+
lg: "2.4rem",
|
|
158
|
+
xl: "3.2rem",
|
|
159
|
+
"2xl": "3.2rem",
|
|
160
|
+
"3xl": "4rem",
|
|
161
|
+
"4xl": "4.8rem",
|
|
162
|
+
"5xl": "5.8rem",
|
|
163
|
+
},
|
|
164
|
+
opacity: {
|
|
165
|
+
15: "0.15",
|
|
166
|
+
},
|
|
167
|
+
backgroundColor: {
|
|
168
|
+
base: withOpacity("--vc-colors-bg-base"),
|
|
169
|
+
fill: withOpacity("--vc-colors-bg-fill"),
|
|
170
|
+
},
|
|
171
|
+
textColor: {
|
|
172
|
+
foreground: withOpacity("--vc-colors-text-foreground"),
|
|
173
|
+
muted: withOpacity("--vc-colors-text-muted"),
|
|
174
|
+
},
|
|
175
|
+
borderRadius: {
|
|
176
|
+
base: "var(--vc-rounded)",
|
|
177
|
+
},
|
|
178
|
+
zIndex: {
|
|
179
|
+
hide: -1,
|
|
180
|
+
none: 0,
|
|
181
|
+
base: 1,
|
|
182
|
+
docked: 10,
|
|
183
|
+
dropdown: 1000,
|
|
184
|
+
sticky: 1100,
|
|
185
|
+
banner: 1200,
|
|
186
|
+
overlay: 1300,
|
|
187
|
+
modal: 1400,
|
|
188
|
+
popover: 1500,
|
|
189
|
+
skipLink: 1600,
|
|
190
|
+
toast: 1700,
|
|
191
|
+
tooltip: 1800,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
variants: {
|
|
196
|
+
extend: {
|
|
197
|
+
boxShadow: ["disabled"],
|
|
198
|
+
cursor: ["disabled"],
|
|
199
|
+
opacity: ["active", "disabled"],
|
|
200
|
+
textColor: ["active", "disabled:hover"],
|
|
201
|
+
textDecoration: ["disabled"],
|
|
202
|
+
backgroundColor: ["disabled"],
|
|
203
|
+
borderColor: ["disabled"],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
function active({ addVariant, e }) {
|
|
211
|
+
addVariant("active", ({ modifySelectors, separator }) => {
|
|
212
|
+
modifySelectors(({ className }) => {
|
|
213
|
+
return `.${e(`active${separator}${className}`)}:active, .${e(
|
|
214
|
+
`active${separator}${className}`
|
|
215
|
+
)}[data-active=true]`;
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function selected({ addVariant, e }) {
|
|
221
|
+
addVariant("selected", ({ modifySelectors, separator }) => {
|
|
222
|
+
modifySelectors(({ className }) => {
|
|
223
|
+
return `.${e(`selected${separator}${className}`)}[aria-selected=true]`;
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function disabled({ addVariant, e }) {
|
|
229
|
+
addVariant("disabled", ({ modifySelectors, separator }) => {
|
|
230
|
+
modifySelectors(({ className }) => {
|
|
231
|
+
return `.${e(`disabled${separator}${className}`)}[aria-disabled=true]`;
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
addVariant("disabled:hover", ({ modifySelectors, separator }) => {
|
|
235
|
+
modifySelectors(({ className }) => {
|
|
236
|
+
return `.${e(
|
|
237
|
+
`disabled:hover${separator}${className}`
|
|
238
|
+
)}[aria-disabled=true]`;
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
}
|
package/src/with-opacity.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
module.exports = function withOpacity(variableName) {
|
|
2
|
-
return ({ opacityValue }) => {
|
|
3
|
-
if (opacityValue) return `rgba(var(${variableName}), ${opacityValue})`;
|
|
4
|
-
return `rgb(var(${variableName}))`;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
1
|
+
module.exports = function withOpacity(variableName) {
|
|
2
|
+
return ({ opacityValue }) => {
|
|
3
|
+
if (opacityValue) return `rgba(var(${variableName}), ${opacityValue})`;
|
|
4
|
+
return `rgb(var(${variableName}))`;
|
|
5
|
+
};
|
|
6
|
+
};
|