@sk-web-gui/core 0.1.4 → 0.1.5

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