webcoreui 0.0.12 → 0.1.0

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 (46) hide show
  1. package/README.md +10 -5
  2. package/components/Accordion/accordion.module.scss +21 -27
  3. package/components/Alert/alert.module.scss +18 -21
  4. package/components/Avatar/avatar.module.scss +9 -6
  5. package/components/Badge/badge.module.scss +31 -34
  6. package/components/Button/Button.astro +0 -2
  7. package/components/Button/Button.svelte +0 -2
  8. package/components/Button/Button.tsx +0 -2
  9. package/components/Button/button.module.scss +32 -39
  10. package/components/Button/button.ts +0 -1
  11. package/components/Card/card.module.scss +20 -15
  12. package/components/Checkbox/checkbox.module.scss +27 -41
  13. package/components/Icon/Icon.astro +2 -2
  14. package/components/Input/input.module.scss +28 -36
  15. package/components/Menu/menu.module.scss +141 -144
  16. package/components/Progress/progress.module.scss +26 -22
  17. package/components/Radio/radio.module.scss +33 -41
  18. package/components/Rating/rating.module.scss +15 -8
  19. package/components/Spinner/spinner.module.scss +11 -2
  20. package/components/Switch/switch.module.scss +28 -30
  21. package/components/Table/table.module.scss +13 -17
  22. package/components/Tabs/Tabs.astro +0 -1
  23. package/components/Tabs/tabs.module.scss +40 -48
  24. package/components/ThemeSwitcher/themeswitcher.module.scss +28 -26
  25. package/components/Timeline/timeline.module.scss +24 -19
  26. package/components/TimelineItem/timelineitem.module.scss +15 -17
  27. package/components/Toast/toast.module.scss +10 -14
  28. package/components/Toast/toast.ts +6 -1
  29. package/icons.d.ts +11 -0
  30. package/icons.js +9 -0
  31. package/package.json +3 -1
  32. package/scss/config/color-palette.scss +23 -0
  33. package/scss/config/css-values.scss +44 -0
  34. package/scss/config/layout.scss +41 -0
  35. package/scss/config/mixins.scss +395 -9
  36. package/scss/config/typography.scss +66 -0
  37. package/scss/config.scss +6 -1
  38. package/scss/global/elements.scss +21 -1
  39. package/scss/global/scrollbar.scss +12 -9
  40. package/scss/global/theme.scss +2 -2
  41. package/scss/global/tooltip.scss +40 -35
  42. package/scss/global/utility.scss +4 -4
  43. package/scss/global.scss +0 -1
  44. package/scss/resets.scss +62 -9
  45. package/scss/setup.scss +12 -39
  46. package/utils/toast.ts +3 -2
@@ -1,16 +1,402 @@
1
- @mixin Transition($property: all, $speed: .3s) {
1
+ @use 'sass:map';
2
+ @use 'sass:meta';
3
+ @use 'sass:list';
4
+ @use 'sass:string';
5
+
6
+ @mixin transition($args...) {
7
+ $property: all;
8
+ $speed: .3s;
9
+
10
+ @each $arg in $args {
11
+ @if (meta.type-of($arg) == 'number') {
12
+ $speed: $arg;
13
+ } @else {
14
+ $property: $arg;
15
+ }
16
+ }
17
+
2
18
  transition: $property $speed cubic-bezier(0.4, 0.0, 0.2, 1);
3
19
  }
4
20
 
5
- @mixin Media($size: 'xs') {
6
- $sizes: (
7
- 'xs': 600px,
8
- 'sm': 800px,
9
- 'md': 1024px,
10
- 'lg': 1200px
21
+ @mixin media($breakpoint: 'xs') {
22
+ @media (min-width: #{map.get($breakpoints, $breakpoint)}) {
23
+ @content;
24
+ }
25
+ }
26
+
27
+ @mixin background($arg) {
28
+ background: map.get($colorPalette, '#{$arg}') or $arg;
29
+ }
30
+
31
+ @mixin border($args...) {
32
+ $width: 1px;
33
+ $color: map.get($colorPalette, primary);
34
+ $position: border;
35
+ $positions: (
36
+ 'top': border-top,
37
+ 'bottom': border-bottom,
38
+ 'left': border-left,
39
+ 'right': border-right,
40
+ 'x': (border-left, border-right),
41
+ 'y': (border-top, border-bottom)
11
42
  );
12
43
 
13
- @media (min-width: #{map-get($sizes, $size)}) {
14
- @content;
44
+ @each $arg in $args {
45
+ @if (map.get($colorPalette, '#{$arg}') or meta.type-of($arg) == color) {
46
+ $color: map.get($colorPalette, '#{$arg}') or $arg;
47
+ }
48
+
49
+ @if (meta.type-of($arg) == 'number') {
50
+ $width: $arg;
51
+ }
52
+
53
+ @if (map.get($positions, $arg)) {
54
+ $position: map.get($positions, $arg);
55
+ }
56
+ }
57
+
58
+ @if ($width != 0 and $color) {
59
+ @each $key in $position {
60
+ #{$key}: $width solid $color;
61
+ }
62
+ }
63
+
64
+ @if ($width == 0) {
65
+ @each $key in $position {
66
+ #{$key}: $width;
67
+ }
68
+ }
69
+ }
70
+
71
+ @mixin border-radius($args...) {
72
+ $borderRadius: map.get($radius, 'md');
73
+ $position: null;
74
+ $side: (
75
+ top: ('top-left', 'top-right'),
76
+ bottom: ('bottom-left', 'bottom-right'),
77
+ left: ('top-left', 'bottom-left'),
78
+ right: ('top-right', 'bottom-right')
79
+ );
80
+
81
+ @each $arg in $args {
82
+ @if (map.get($radius, $arg)) {
83
+ $borderRadius: map.get($radius, $arg);
84
+ }
85
+
86
+ @if (map.get($side, $arg)) {
87
+ $position: map.get($side, $arg);
88
+ }
89
+ }
90
+
91
+ @if ($position) {
92
+ @each $key in $position {
93
+ border-#{$key}-radius: $borderRadius;
94
+ }
95
+ } @else {
96
+ border-radius: $borderRadius;
97
+ }
98
+ }
99
+
100
+ @mixin visibility($args...) {
101
+ @each $arg in $args {
102
+ @if list.index($displayValues, $arg) {
103
+ display: $arg;
104
+ }
105
+
106
+ @if list.index($overflowValues, $arg) {
107
+ overflow: $arg;
108
+ }
109
+
110
+ @if (meta.type-of($arg) == 'number') {
111
+ opacity: $arg;
112
+ }
113
+ }
114
+ }
115
+
116
+ @mixin layer($stack: 'default') {
117
+ z-index: #{map.get($layers, $stack)};
118
+ }
119
+
120
+ @mixin size($args...) {
121
+ $singlePrefix: string.slice(list.nth(#{$args}, 1), 1, 1);
122
+ $isSingle: list.length($args) == 1
123
+ and $singlePrefix != 'w'
124
+ and $singlePrefix != 'h';
125
+
126
+ @if ($isSingle) {
127
+ width: $args;
128
+ height: $args;
129
+ } @else {
130
+ @each $arg in $args {
131
+ @if (meta.type-of($arg) == string) {
132
+ $prefix: string.slice($arg, 1, 1);
133
+ $value: string.slice($arg, 2, -1);
134
+
135
+ @if ($prefix == 'w') {
136
+ width: string.unquote($value);
137
+ }
138
+
139
+ @if ($prefix == 'h') {
140
+ height: string.unquote($value);
141
+ }
142
+ } @else {
143
+ @if (index($args, $arg) == 1) {
144
+ width: $arg;
145
+ }
146
+
147
+ @if (index($args, $arg) == 2) {
148
+ height: $arg;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ @mixin typography($args...) {
156
+ @each $arg in $args {
157
+ $color: map.get($colorPalette, '#{$arg}');
158
+ $type: map.get($fontTypes, '#{$arg}');
159
+ $size: map.get($fontSizes, '#{$arg}');
160
+ $height: map.get($lineHeights, '#{$arg}');
161
+ $decoration: map.get($decorations, '#{$arg}');
162
+
163
+ @if ($color) {
164
+ color: $color;
165
+ }
166
+
167
+ @if ($type) {
168
+ font-family: $type;
169
+ }
170
+
171
+ @if ($size) {
172
+ font-size: $size;
173
+ }
174
+
175
+ @if list.index($fontWeights, $arg) {
176
+ font-weight: $arg;
177
+ }
178
+
179
+ @if list.index($textAlignValues, $arg) {
180
+ text-align: $arg;
181
+ }
182
+
183
+ @if ($decoration) {
184
+ text-decoration: $decoration;
185
+ }
186
+
187
+ @if ($height or (meta.type-of($arg) == 'number' and $arg < 100)) {
188
+ line-height: $height or $arg;
189
+ }
190
+ }
191
+ }
192
+
193
+ @mixin position($args...) {
194
+ @each $arg in $args {
195
+ @if (list.index($positionValues, $arg)) {
196
+ position: $arg;
197
+ }
198
+
199
+ @if (string.index($arg, 't') == 1) {
200
+ top: #{list.nth(string.split($arg, 't'), 2)};
201
+ }
202
+
203
+ @if (string.index($arg, 'b') == 1) {
204
+ bottom: #{list.nth(string.split($arg, 'b'), 2)};
205
+ }
206
+
207
+ @if (string.index($arg, 'l') == 1) {
208
+ left: #{list.nth(string.split($arg, 'l'), 2)};
209
+ }
210
+
211
+ @if (string.index($arg, 'r') == 1 and $arg != relative) {
212
+ right: #{list.nth(string.split($arg, 'r'), 2)};
213
+ }
214
+
215
+ @if ($arg == 'h-center') {
216
+ left: 50%;
217
+ transform: translateX(-50%);
218
+ }
219
+
220
+ @if ($arg == 'v-center') {
221
+ top: 50%;
222
+ transform: translateY(-50%);
223
+ }
224
+
225
+ @if ($arg == 'center') {
226
+ top: 50%;
227
+ left: 50%;
228
+ transform: translate(-50%, -50%);
229
+ }
230
+ }
231
+ }
232
+
233
+ @mixin spacing($args...) {
234
+ $margin: (0 0 0 0);
235
+ $padding: (0 0 0 0);
236
+ $size: 'none';
237
+ $mx: 0;
238
+ $my: 0;
239
+ $px: 0;
240
+ $py: 0;
241
+
242
+ $marginMap: (
243
+ 'mt': 1,
244
+ 'mr': 2,
245
+ 'mb': 3,
246
+ 'ml': 4
247
+ );
248
+
249
+ $paddingMap: (
250
+ 'pt': 1,
251
+ 'pr': 2,
252
+ 'pb': 3,
253
+ 'pl': 4
254
+ );
255
+
256
+ @each $arg in $args {
257
+ @if (meta.type-of($arg) == string) {
258
+ $list: string.split($arg, '-');
259
+ $marginMapKey: map.get($marginMap, string.slice($arg, 1, 2));
260
+ $paddingMapKey: map.get($paddingMap, string.slice($arg, 1, 2));
261
+
262
+ @if (list.length($list) == 2) {
263
+ $size: map.get($spacing, list.nth(string.split($arg, '-'), 2));
264
+ }
265
+
266
+ // Setting margins
267
+ @if ($marginMapKey) {
268
+ $margin: list.set-nth(
269
+ $margin,
270
+ $marginMapKey,
271
+ $size
272
+ );
273
+ }
274
+
275
+ @if (string.index($arg, 'mx-')) {
276
+ $mx: $size;
277
+ $margin: ($my $mx);
278
+ }
279
+
280
+ @if (string.index($arg, 'my-')) {
281
+ $my: $size;
282
+ $margin: ($my $mx);
283
+ }
284
+
285
+ @if (string.index($arg, 'm-')) {
286
+ $margin: $size;
287
+ }
288
+
289
+ @if (string.index($arg, 'auto')) {
290
+ margin: map.get($spacing, $size) or $size auto;
291
+ }
292
+
293
+ @if ($arg == 'm0') {
294
+ margin: 0;
295
+ }
296
+
297
+ // Setting paddings
298
+ @if ($paddingMapKey) {
299
+ $padding: list.set-nth(
300
+ $padding,
301
+ $paddingMapKey,
302
+ $size
303
+ );
304
+ }
305
+
306
+ @if (string.index($arg, 'px-')) {
307
+ $px: $size;
308
+ $padding: ($py $px);
309
+ }
310
+
311
+ @if (string.index($arg, 'py-')) {
312
+ $py: $size;
313
+ $padding: ($py $px);
314
+ }
315
+
316
+ @if (string.index($arg, 'p-')) {
317
+ $padding: $size;
318
+ }
319
+
320
+ @if ($arg == 'p0') {
321
+ padding: 0;
322
+ }
323
+ }
324
+
325
+ @if (map.get($spacing, $arg)) {
326
+ margin: map.get($spacing, $arg);
327
+ padding: map.get($spacing, $arg);
328
+ }
329
+
330
+ @if ($arg == 0) {
331
+ margin: 0;
332
+ padding: 0;
333
+ }
334
+ }
335
+
336
+ @if ($margin != (0 0 0 0)) {
337
+ margin: $margin;
338
+ }
339
+
340
+ @if ($padding != (0 0 0 0)) {
341
+ padding: $padding;
342
+ }
343
+ }
344
+
345
+ @mixin layout($args...) {
346
+ $layouts: (flex, inline-flex, grid, inline-grid);
347
+ $alignments: (
348
+ vertical: (
349
+ 'v-center': center,
350
+ 'v-start': flex-start,
351
+ 'v-end': flex-end,
352
+ 'v-baseline': baseline,
353
+ 'v-stretch': stretch
354
+ ),
355
+ horizontal: (
356
+ 'h-center': center,
357
+ 'h-start': flex-start,
358
+ 'h-end': flex-end,
359
+ 'h-between': space-between,
360
+ 'h-around': space-around,
361
+ 'h-evenly': space-evenly,
362
+ 'h-stretch': stretch
363
+ )
364
+ );
365
+
366
+ @each $arg in $args {
367
+ @if (list.index($layouts, $arg)) {
368
+ display: $arg;
369
+ }
370
+
371
+ @if (map.get($spacing, $arg)) {
372
+ gap: map.get($spacing, $arg);
373
+ }
374
+
375
+ @if (meta.type-of($arg) == 'string') {
376
+ @if (string.index($arg, 'v-')) {
377
+ align-items: map.get(map.get($alignments, vertical), $arg)
378
+ }
379
+
380
+ @if (string.index($arg, 'h-')) {
381
+ justify-content: map.get(map.get($alignments, horizontal), $arg)
382
+ }
383
+ }
384
+
385
+ @if ($arg == 'center') {
386
+ align-items: center;
387
+ justify-content: center;
388
+ }
389
+
390
+ @if (list.index($flexDirectionValues, $arg)) {
391
+ flex-direction: $arg;
392
+ }
393
+
394
+ @if (meta.type-of($arg) == 'number') {
395
+ grid-template-columns: repeat($arg, minmax(0, 1fr));
396
+ }
397
+
398
+ @if (list.index($flexWrapValues, $arg)) {
399
+ flex-wrap: $arg;
400
+ }
15
401
  }
16
402
  }
@@ -0,0 +1,66 @@
1
+ $fontTypes: (
2
+ 'regular': (Regular, sans-serif),
3
+ 'bold': (Bold, sans-serif)
4
+ ) !default;
5
+
6
+ $fontSizes: (
7
+ 'xxs': 10px,
8
+ 'xs': 12px,
9
+ 'sm': 14px,
10
+ 'md': 16px,
11
+ 'default': 18px,
12
+ 'lg': 21px,
13
+ 'xl': 24px,
14
+ '2xl': 28px,
15
+ '3xl': 32px
16
+ ) !default;
17
+
18
+ $lineHeights: (
19
+ 'normal': normal,
20
+ 'hmd': 1.5,
21
+ 'hlg': 1.7
22
+ ) !default;
23
+
24
+ $decorations: (
25
+ 'none': none,
26
+ 'underline': underline,
27
+ 'overline': overline,
28
+ 'line-through': line-through,
29
+ 'dotted': underline dotted,
30
+ 'dashed': underline dashed,
31
+ 'double': underline double,
32
+ 'wavy': underline wavy,
33
+ 'overline-dotted': overline dotted,
34
+ 'overline-dashed': overline dashed,
35
+ 'overline-double': overline double,
36
+ 'overline-wavy': overline wavy,
37
+ 'line-through-dotted': line-through dotted,
38
+ 'line-through-dashed': line-through dashed,
39
+ 'line-through-double': line-through double,
40
+ 'line-through-wavy': line-through wavy,
41
+ 'line-through-underline': underline line-through,
42
+ 'line-through-overline': overline line-through,
43
+ 'overunder': underline overline,
44
+ 'overunder-dotted': underline overline dotted,
45
+ 'overunder-dashed': underline overline dashed,
46
+ 'overunder-double': underline overline double,
47
+ 'overunder-wavy': underline overline wavy,
48
+ 'overunder-line-through': underline overline line-through,
49
+ ) !default;
50
+
51
+ $textAlignValues: left,
52
+ right,
53
+ center,
54
+ justify !default;
55
+
56
+ $fontWeights: 100,
57
+ 200,
58
+ 300,
59
+ 400,
60
+ 500,
61
+ 600,
62
+ 700,
63
+ 800,
64
+ 900,
65
+ bolder,
66
+ lighter !default;
package/scss/config.scss CHANGED
@@ -1 +1,6 @@
1
- @import './config/mixins.scss';
1
+ @import '../webcore.config.scss';
2
+ @import './config/color-palette';
3
+ @import './config/css-values';
4
+ @import './config/typography';
5
+ @import './config/layout';
6
+ @import './config/mixins';
@@ -1,6 +1,6 @@
1
1
  @import '../config';
2
2
 
3
- @mixin Elements() {
3
+ @mixin elements() {
4
4
  code {
5
5
  display: inline-block;
6
6
  padding: 2px 10px;
@@ -8,4 +8,24 @@
8
8
  border: 1px solid var(--w-color-primary-50);
9
9
  font-size: 14px;
10
10
  }
11
+
12
+ figure {
13
+ margin: 0;
14
+ }
15
+
16
+ p {
17
+ font-size: 16px;
18
+ line-height: 1.7;
19
+ margin: 20px 0;
20
+ }
21
+
22
+ ul, ol {
23
+ line-height: 1.7;
24
+ font-size: 16px;
25
+ margin: 20px 0;
26
+
27
+ li {
28
+ margin-bottom: 10px;
29
+ }
30
+ }
11
31
  }
@@ -1,21 +1,24 @@
1
- @import '../config';
1
+ @use '../config' as *;
2
+
3
+ @mixin scrollbar() {
4
+ body {
5
+ --w-scrollbar-bg: var(--w-color-primary-60);
6
+ --w-scrollbar-fg: var(--w-color-primary-50);
7
+ }
2
8
 
3
- @mixin Scrollbar() {
4
9
  ::-webkit-scrollbar {
5
- width: 10px;
6
- height: 10px;
10
+ @include size(10px);
7
11
  }
8
12
 
9
13
  ::-webkit-scrollbar-track {
10
- border-radius: 5px;
11
- background: var(--w-scrollbar-bg);
14
+ @include border-radius(md);
15
+ @include background(var(--w-scrollbar-bg));
12
16
  cursor: pointer;
13
17
  }
14
18
 
15
19
  ::-webkit-scrollbar-thumb {
16
- border-radius: 5px;
17
- background: var(--w-scrollbar-fg);
20
+ @include border-radius(md);
21
+ @include background(var(--w-scrollbar-fg));
18
22
  cursor: pointer;
19
23
  }
20
24
  }
21
-
@@ -1,6 +1,6 @@
1
- @import '../config';
1
+ @use '../config' as *;
2
2
 
3
- @mixin Theme($theme: 'dark', $selector: ':root') {
3
+ @mixin theme($theme: 'dark', $selector: ':root') {
4
4
  @if $theme == 'dark' {
5
5
  #{$selector} {
6
6
  --w-color-scheme: dark;
@@ -1,48 +1,54 @@
1
- @import '../config';
1
+ @use '../config' as *;
2
+
3
+ @mixin tooltip() {
4
+ body {
5
+ --w-tooltip-background: var(--w-color-primary);
6
+ --w-tooltip-color: var(--w-color-primary-70);
7
+ }
2
8
 
3
- @mixin Tooltip() {
4
9
  [data-tooltip] {
10
+ @include position(relative);
5
11
  display: inline-block;
6
- position: relative;
7
12
 
8
13
  &::before,
9
14
  &::after {
10
- @include Transition();
11
- opacity: 0;
15
+ @include transition();
16
+ @include visibility(0);
17
+ @include layer(header);
18
+
12
19
  left: 50%;
13
20
  transform: translate(-50%, 5px);
14
21
  pointer-events: none;
15
- z-index: 99;
16
22
  }
17
23
 
18
24
  &::before {
25
+ @include border-radius(md);
26
+ @include position(absolute);
27
+ @include typography(sm, hlg);
28
+ @include background(var(--w-tooltip-background));
29
+ @include size(wmax-content);
30
+ @include spacing(px-xs);
31
+
19
32
  content: attr(data-tooltip);
20
- border-radius: 5px;
21
- font-size: 14px;
22
- position: absolute;
23
- background: var(--w-tooltip-background);
24
33
  color: var(--w-tooltip-color);
25
- padding: 0 5px;
26
34
  bottom: calc(100% + 5px);
27
- width: max-content;
28
- line-height: 1.8;
29
35
  max-width: 300px;
30
36
  }
31
37
 
32
38
  &::after {
39
+ @include position(absolute, t-5px);
40
+ @include size(0);
41
+ @include border(5px, left, transparent);
42
+ @include border(5px, right, transparent);
43
+
33
44
  content: '';
34
- position: absolute;
35
- width: 0;
36
- height: 0;
37
- border-left: 5px solid transparent;
38
- border-right: 5px solid transparent;
39
45
  border-top: 5px solid var(--w-tooltip-background);
40
- top: -5px;
41
46
  }
42
47
 
43
48
  &:hover::before,
44
49
  &:hover::after {
45
- opacity: 1;
50
+ @include visibility(1);
51
+
46
52
  pointer-events: all;
47
53
  transform: translate(-50%, 0);
48
54
  }
@@ -59,9 +65,8 @@
59
65
  }
60
66
 
61
67
  &::after {
62
- border-left: 5px solid transparent;
63
- border-right: 5px solid transparent;
64
- border-top: 5px solid transparent;
68
+ @include border(5px, top, transparent);
69
+
65
70
  border-bottom: 5px solid var(--w-tooltip-background);
66
71
  top: auto;
67
72
  bottom: -5px;
@@ -86,12 +91,12 @@
86
91
  }
87
92
 
88
93
  &::after {
94
+ @include border(5px, top, transparent);
95
+ @include border(5px, bottom, transparent);
96
+
97
+ top: calc(50% - 2.5px);
89
98
  border-left: 5px solid var(--w-tooltip-background);
90
- border-right: 5px solid transparent;
91
- border-top: 5px solid transparent;
92
- border-bottom: 5px solid transparent;
93
- top: 50%;
94
- transform: translate(10px, -40%);
99
+ transform: translate(10px, -50%);
95
100
  }
96
101
 
97
102
  &:hover::before {
@@ -99,7 +104,7 @@
99
104
  }
100
105
 
101
106
  &:hover::after {
102
- transform: translate(5px, -40%);
107
+ transform: translate(5px, -50%);
103
108
  }
104
109
  }
105
110
 
@@ -115,12 +120,12 @@
115
120
  }
116
121
 
117
122
  &::after {
118
- border-left: 5px solid transparent;
123
+ @include border(5px, top, transparent);
124
+ @include border(5px, bottom, transparent);
125
+
126
+ top: calc(50% - 2.5px);
119
127
  border-right: 5px solid var(--w-tooltip-background);
120
- border-top: 5px solid transparent;
121
- border-bottom: 5px solid transparent;
122
- top: 50%;
123
- transform: translate(-10px, -40%);
128
+ transform: translate(-10px, -50%);
124
129
  }
125
130
 
126
131
  &:hover::before {
@@ -128,7 +133,7 @@
128
133
  }
129
134
 
130
135
  &:hover::after {
131
- transform: translate(-5px, -40%);
136
+ transform: translate(-5px, -50%);
132
137
  }
133
138
  }
134
139
  }