@sk-web-gui/core 0.1.37 → 0.1.39

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