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,49 +1,47 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-radio-color: var(--w-color-primary);
5
+ }
2
6
 
3
7
  .radio {
4
- display: flex;
5
- flex-direction: column;
6
- gap: 10px;
8
+ @include layout(flex, column, sm);
7
9
 
8
10
  &.inline {
9
- flex-direction: row;
11
+ @include layout(row);
10
12
  }
11
13
 
12
14
  label {
13
- display: flex;
14
- align-items: center;
15
- gap: 5px;
15
+ @include layout(flex, xs);
16
+ @include typography(md);
17
+
16
18
  cursor: pointer;
17
- font-size: 16px;
18
19
 
19
20
  &.disabled {
20
21
  cursor: no-drop;
21
22
 
22
23
  input + span::after {
23
- background: var(--w-color-primary-20);
24
+ @include background(primary-20);
24
25
  }
25
26
  }
26
27
 
27
28
  &.col {
28
- flex-direction: column;
29
- align-items: flex-start;
29
+ @include layout(column, v-start);
30
30
  }
31
31
  }
32
32
 
33
33
  input {
34
- display: none;
34
+ @include visibility(none);
35
35
 
36
36
  + span::after {
37
- @include Transition(transform);
37
+ @include transition(transform);
38
+ @include position(absolute, 't50%', 'l50%');
39
+ @include size(8px);
40
+ @include border-radius(max);
41
+ @include background(var(--w-radio-color));
42
+
38
43
  content: '';
39
- position: absolute;
40
- top: 50%;
41
- left: 50%;
42
44
  transform: translate(-50%, -50%) scale(0);
43
- width: 8px;
44
- height: 8px;
45
- border-radius: 100%;
46
- background: var(--w-radio-color);
47
45
  }
48
46
 
49
47
  &:checked + span::after {
@@ -51,41 +49,35 @@
51
49
  }
52
50
 
53
51
  &:disabled + span {
54
- background-color: var(--w-color-primary-40);
55
- border-color: var(--w-color-primary-40);
52
+ @include background(primary-40);
53
+ @include border(primary-40);
56
54
  }
57
55
  }
58
56
 
59
- a {
60
- text-decoration: underline;
61
- }
62
-
63
57
  .wrapper {
64
- display: flex;
65
- align-items: center;
66
- gap: 10px;
58
+ @include layout(flex, sm);
67
59
  }
68
-
60
+
69
61
  .icon {
62
+ @include size(16px);
63
+ @include border-radius(max);
64
+ @include position(relative);
65
+ @include spacing(mt-xxs);
66
+
70
67
  display: inline-block;
71
- width: 16px;
72
- height: 16px;
73
- border-radius: 100%;
68
+ min-width: 16px;
74
69
  border: 1px solid var(--w-radio-color);
75
- position: relative;
76
70
  }
77
71
 
78
72
  .subtext {
79
- margin-left: 25px;
80
- font-size: 14px;
81
- color: var(--w-color-primary-20);
73
+ @include spacing(ml-lg);
74
+ @include typography(sm, primary-20);
82
75
 
83
76
  a {
84
- @include Transition(color);
85
- color: var(--w-color-primary-20);
77
+ @include typography(primary-20);
86
78
 
87
79
  &:hover {
88
- color: var(--w-color-primary);
80
+ @include typography(primary);
89
81
  }
90
82
  }
91
83
  }
@@ -1,8 +1,15 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-rating-color: var(--w-color-primary);
5
+ --w-rating-empty-color: var(--w-color-primary);
6
+ --w-rating-empty-background: var(--w-color-primary-70);
7
+ --w-rating-size: 18px;
8
+ }
2
9
 
3
10
  .rating {
4
- display: inline-flex;
5
- align-items: center;
11
+ @include layout(inline-flex, v-center);
12
+
6
13
  color: var(--w-rating-color);
7
14
  font-size: var(--w-rating-size);
8
15
 
@@ -22,14 +29,14 @@
22
29
  color: var(--w-rating-empty-color);
23
30
  }
24
31
 
25
- a {
26
- text-decoration: underline;
32
+ a:hover .text {
33
+ @include typography(primary);
27
34
  }
28
35
 
29
36
  .text {
30
- font-size: 16px;
31
- color: var(--w-color-primary-20);
32
- margin-left: 5px;
37
+ @include transition(color);
38
+ @include typography(md, primary-20);
39
+ @include spacing(ml-xs);
33
40
 
34
41
  &.m {
35
42
  margin-right: 5px;
@@ -1,7 +1,16 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-spinner-color: var(--w-color-primary);
5
+ --w-spinner-width: 2px;
6
+ --w-spinner-speed: 2s;
7
+ --w-spinner-size: 30px;
8
+ --w-spinner-dash: 8;
9
+ }
2
10
 
3
11
  .spinner {
4
- margin: 0px auto;
12
+ @include spacing(auto-none);
13
+
5
14
  width: var(--w-spinner-size);
6
15
  height: var(--w-spinner-size);
7
16
  animation: rotate var(--w-spinner-speed) linear infinite;
@@ -1,21 +1,24 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-switch-off-color: var(--w-color-primary-50);
5
+ --w-switch-on-color: var(--w-color-primary);
6
+ }
2
7
 
3
8
  .switch {
4
- display: inline-flex;
5
- align-items: center;
6
- gap: 10px;
9
+ @include layout(inline-flex, v-center, sm);
7
10
  cursor: pointer;
8
11
 
9
12
  &.reverse {
10
- flex-direction: row-reverse;
13
+ @include layout(row-reverse);
11
14
  }
12
15
 
13
16
  &.disabled .toggle {
17
+ @include background(primary-40);
14
18
  cursor: no-drop;
15
- background: var(--w-color-primary-40);
16
19
 
17
20
  &::before {
18
- background: var(--w-color-primary-50);
21
+ @include background(primary-50);
19
22
  }
20
23
  }
21
24
 
@@ -25,33 +28,31 @@
25
28
  }
26
29
 
27
30
  .toggle {
28
- width: 40px;
29
- height: 20px;
31
+ @include size(w40px, h20px);
30
32
 
31
33
  &::before {
32
- height: 14px;
33
- width: 14px;
34
+ @include size(14px);
34
35
  }
35
36
  }
36
37
 
37
38
  .label {
38
- font-size: 14px;
39
+ @include typography(sm);
39
40
  }
40
41
  }
41
42
 
42
43
  &.square .toggle {
43
- border-radius: 5px;
44
+ @include border-radius(md);
44
45
 
45
46
  &::before {
46
- border-radius: 5px;
47
+ @include border-radius(md);
47
48
  }
48
49
  }
49
50
 
50
51
  input {
51
- display: none;
52
+ @include visibility(none);
52
53
 
53
54
  &:checked + span {
54
- background-color: var(--w-switch-on-color);
55
+ @include background(var(--w-switch-on-color));
55
56
 
56
57
  &::before {
57
58
  transform: translateX(30px);
@@ -60,22 +61,19 @@
60
61
  }
61
62
 
62
63
  .toggle {
63
- @include Transition(background);
64
- position: relative;
65
- width: 60px;
66
- height: 30px;
67
- background: var(--w-switch-off-color);
68
- border-radius: 30px;
64
+ @include transition(background);
65
+ @include position(relative);
66
+ @include size(w60px, h30px);
67
+ @include border-radius(xl);
68
+ @include background(var(--w-switch-off-color));
69
69
 
70
70
  &::before {
71
- content: "";
72
- position: absolute;
73
- height: 24px;
74
- width: 24px;
75
- left: 3px;
76
- bottom: 3px;
77
- background: var(--w-color-primary-70);
78
- border-radius: 50%;
71
+ @include position(absolute, l3px, b3px);
72
+ @include size(24px);
73
+ @include border-radius(max);
74
+ @include background(primary-70);
75
+
76
+ content: '';
79
77
  transition: 0.3s;
80
78
  }
81
79
  }
@@ -1,38 +1,34 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
2
 
3
3
  .table {
4
- overflow-x: auto;
4
+ @include visibility(auto);
5
5
 
6
6
  table {
7
- width: 100%;
7
+ @include size('w100%');
8
+ @include typography(md, left);
9
+
8
10
  border-collapse: collapse;
9
- text-align: left;
10
- font-size: 16px;
11
11
  }
12
12
 
13
13
  thead,
14
14
  tfoot {
15
- font-family: Bold;
15
+ @include typography(bold);
16
16
  }
17
17
 
18
18
  th,
19
19
  td {
20
- padding: 5px 10px;
20
+ @include spacing(py-xs, px-sm);
21
21
  }
22
22
 
23
23
  thead,
24
24
  tr {
25
- border-bottom: 1px solid var(--w-color-primary-50);
25
+ @include border(bottom, primary-50);
26
26
 
27
27
  &:last-child {
28
- border-bottom: 0;
28
+ @include border(bottom, 0);
29
29
  }
30
30
  }
31
31
 
32
- a {
33
- text-decoration: underline;
34
- }
35
-
36
32
  tfoot,
37
33
  &.hover tr:hover,
38
34
  &.striped-rows tbody tr:nth-child(odd),
@@ -40,25 +36,25 @@
40
36
  &.striped-columns td:nth-child(odd),
41
37
  &.striped-columns.offset td:nth-child(even),
42
38
  &.hover.striped-rows.offset tbody tr:nth-child(odd):hover {
43
- background: var(--w-color-primary-60);
39
+ @include background(primary-60);
44
40
  }
45
41
 
46
42
  &.striped-rows tr,
47
43
  &.striped-columns tr,
48
44
  &.striped-columns thead {
49
- border-bottom: 0;
45
+ @include border(bottom, 0);
50
46
  }
51
47
 
52
48
  &.striped-rows.offset tbody tr:nth-child(odd),
53
49
  &.striped-rows.offset tfoot,
54
50
  &.striped-columns.offset td:nth-child(odd),
55
51
  &.striped-columns tfoot {
56
- background: transparent;
52
+ @include background(transparent);
57
53
  }
58
54
 
59
55
  &.compact {
60
56
  th, td {
61
- padding: 3px 10px;
57
+ @include spacing(py-xxs, px-sm);
62
58
  }
63
59
  }
64
60
  }
@@ -63,7 +63,6 @@ const classes = [
63
63
 
64
64
  const tabs = target.parentElement?.querySelectorAll('button') as NodeListOf<HTMLButtonElement>
65
65
 
66
- // TODO - update logic
67
66
  Array.from(tabs).forEach((tab: any) => {
68
67
  tab.dataset.active = 'false'
69
68
 
@@ -1,60 +1,58 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
2
 
3
3
  .tabs {
4
4
  &.boxed .items,
5
5
  &.outline .items {
6
- background: var(--w-color-primary-50);
7
- border-radius: 5px;
8
- padding: 5px;
9
- width: max-content;
6
+ @include background(primary-50);
7
+ @include border-radius(md);
8
+ @include spacing(p-xs);
9
+ @include size(wmax-content);
10
10
 
11
11
  button {
12
- @include Transition();
13
- border-radius: 5px;
14
- padding: 10px;
12
+ @include transition();
13
+ @include border-radius(md);
14
+ @include spacing(p-sm);
15
15
 
16
16
  &[data-active="true"] {
17
- border: 0;
18
- background: var(--w-color-primary-70);
17
+ @include border(0);
18
+ @include background(primary-70);
19
19
  padding-bottom: 10px;
20
20
  }
21
21
  }
22
22
  }
23
23
 
24
24
  &.outline .items {
25
- background: transparent;
26
- border: 1px solid var(--w-color-primary-50);
25
+ @include background(transparent);
26
+ @include border(primary-50);
27
27
 
28
28
  button {
29
29
  margin-bottom: 0;
30
30
 
31
31
  &[data-active="true"] {
32
- background: var(--w-color-primary-50);
32
+ @include background(primary-50);
33
33
  }
34
34
  }
35
35
  }
36
36
 
37
37
  &.even .items button {
38
+ @include layout(h-center);
38
39
  flex: 1;
39
- justify-content: center;
40
40
  }
41
41
 
42
42
  &.vertical {
43
- display: flex;
44
- gap: 20px;
43
+ @include layout(flex, default);
45
44
 
46
45
  &.boxed .items button,
47
46
  &.outline .items button {
48
- border-bottom: 0;
47
+ @include border(bottom, 0);
49
48
  }
50
49
 
51
50
  .items {
52
- flex-direction: column;
53
- gap: 5px;
51
+ @include layout(column, xs);
54
52
 
55
53
  button {
56
- padding: 10px;
57
- border-bottom: 2px solid var(--w-color-primary-50);
54
+ @include spacing(p-sm);
55
+ @include border(2px, bottom, primary-50);
58
56
 
59
57
  &[data-active="true"] {
60
58
  padding-bottom: 10px;
@@ -63,71 +61,65 @@
63
61
  }
64
62
 
65
63
  .content {
66
- margin-top: 0;
64
+ @include spacing(m0);
67
65
  }
68
66
  }
69
67
 
70
68
  .wrapper {
71
- overflow: auto;
69
+ @include visibility(auto);
72
70
  }
73
71
 
74
72
  .items {
75
- border-bottom: 2px solid var(--w-color-primary-50);
76
- display: flex;
77
- gap: 10px;
73
+ @include border(2px, bottom, primary-50);
74
+ @include layout(flex, sm);
78
75
 
79
76
  button {
80
- @include Transition(color);
81
- background: transparent;
77
+ @include transition(color);
78
+ @include background(transparent);
79
+ @include typography(md, primary-20);
80
+ @include border(0);
81
+ @include spacing(p-md);
82
+ @include layout(flex, v-center, sm);
83
+
82
84
  cursor: pointer;
83
- color: var(--w-color-primary);
84
- border: 0;
85
- font-size: 16px;
86
- padding: 0;
87
- margin-bottom: -2px;
88
- padding: 15px 15px;
89
- color: var(--w-color-primary-20);
90
- display: flex;
91
- align-items: center;
92
- gap: 10px;
93
85
  flex-shrink: 0;
94
86
 
95
87
  svg {
88
+ @include size(20px);
96
89
  pointer-events: none;
97
- width: 20px;
98
- height: 20px;
99
90
  }
100
91
 
101
92
  &[disabled] {
102
- color: var(--w-color-primary-30);
93
+ @include typography(primary-30);
103
94
  cursor: no-drop;
104
95
  }
105
96
 
106
97
  &[data-active="true"] {
107
- color: var(--w-color-primary);
108
- border-bottom: 2px solid var(--w-color-primary);
98
+ @include typography(primary);
99
+ @include border(2px, bottom, primary);
100
+
109
101
  padding-bottom: 13px;
110
102
  }
111
103
  }
112
104
  }
113
105
 
114
106
  .content {
115
- margin-top: 20px;
107
+ @include spacing(mt-default);
116
108
  }
117
109
 
118
110
  [data-tab] {
119
- display: none;
111
+ @include visibility(none);
120
112
 
121
113
  &[data-active="true"] {
122
- display: block;
114
+ @include visibility(block);
123
115
  }
124
116
  }
125
117
  }
126
118
 
127
- @include Media('xs') {
119
+ @include media('xs') {
128
120
  .tabs {
129
121
  &.even .items {
130
- width: auto;
122
+ @include size(wauto);
131
123
  }
132
124
  }
133
125
  }
@@ -1,11 +1,14 @@
1
- @import '../../scss/config.scss';
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ body {
4
+ --w-theme-switcher-size: 20px;
5
+ }
2
6
 
3
7
  .switcher {
4
- display: flex;
5
- gap: 10px;
8
+ @include layout(flex, sm);
6
9
 
7
10
  &.toggle {
8
- position: relative;
11
+ @include position(relative);
9
12
  width: var(--w-theme-switcher-size);
10
13
  height: var(--w-theme-switcher-size);
11
14
 
@@ -13,37 +16,38 @@
13
16
  position: absolute;
14
17
 
15
18
  &:first-child {
16
- z-index: 2;
19
+ @include layer(overlay);
17
20
  }
18
21
 
19
22
  &:nth-child(2) {
20
- z-index: 1;
23
+ @include layer(fg);
21
24
  }
22
25
 
23
26
  &[data-active="true"] {
24
- z-index: 3;
27
+ @include layer(popup);
25
28
  }
26
29
  }
27
30
  }
28
31
  }
29
32
 
30
33
  .switch {
34
+ @include border(0);
35
+ @include border-radius(max);
36
+ @include position(relative);
37
+
31
38
  width: var(--w-theme-switcher-size);
32
39
  height: var(--w-theme-switcher-size);
33
- border-radius: 100%;
34
40
  cursor: pointer;
35
- position: relative;
36
- border: 0;
37
41
 
38
42
  &.icons {
39
- @include Transition(opacity);
40
- color: var(--w-color-primary);
41
- background: transparent;
42
- padding: 0;
43
- opacity: 0;
43
+ @include transition(opacity);
44
+ @include typography(primary);
45
+ @include background(transparent);
46
+ @include spacing(p0);
47
+ @include visibility(0);
44
48
 
45
49
  &[data-active="true"] {
46
- opacity: 1;
50
+ @include visibility(1);
47
51
  }
48
52
 
49
53
  svg, img {
@@ -54,20 +58,18 @@
54
58
  }
55
59
 
56
60
  &:not(.icons)::after {
57
- @include Transition();
61
+ @include position(absolute, center);
62
+ @include border(primary);
63
+ @include border-radius(max);
64
+ @include layer(bg);
65
+ @include transition();
66
+ @include size(0);
67
+
58
68
  content: '';
59
- position: absolute;
60
- top: 50%;
61
- left: 50%;
62
- transform: translate(-50%, -50%);
63
- border: 1px solid var(--w-color-primary);
64
- border-radius: 100%;
65
- width: 0;
66
- height: 0;
67
- z-index: -1;
68
69
  }
69
70
 
70
71
  &[data-active="true"]::after {
72
+ @include layer(default);
71
73
  width: calc(var(--w-theme-switcher-size) + 5px);
72
74
  height: calc(var(--w-theme-switcher-size) + 5px);
73
75
  }