webcoreui 0.1.0 → 0.2.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 (66) hide show
  1. package/README.md +29 -1
  2. package/astro.d.ts +4 -0
  3. package/astro.js +4 -0
  4. package/components/Accordion/accordion.module.scss +1 -2
  5. package/components/Alert/alert.module.scss +3 -3
  6. package/components/Badge/badge.module.scss +1 -1
  7. package/components/Button/button.module.scss +2 -2
  8. package/components/Button/button.ts +1 -1
  9. package/components/Card/card.module.scss +0 -1
  10. package/components/Checkbox/checkbox.module.scss +4 -4
  11. package/components/Icon/map.ts +2 -0
  12. package/components/Input/input.module.scss +2 -2
  13. package/components/Menu/Menu.astro +7 -3
  14. package/components/Menu/Menu.svelte +11 -3
  15. package/components/Menu/Menu.tsx +7 -1
  16. package/components/Menu/menu.module.scss +4 -1
  17. package/components/Menu/menu.ts +1 -0
  18. package/components/Modal/Modal.astro +70 -0
  19. package/components/Modal/Modal.svelte +71 -0
  20. package/components/Modal/Modal.tsx +76 -0
  21. package/components/Modal/modal.module.scss +103 -0
  22. package/components/Modal/modal.ts +18 -0
  23. package/components/Progress/progress.module.scss +3 -3
  24. package/components/Radio/radio.module.scss +1 -2
  25. package/components/Rating/Rating.astro +2 -2
  26. package/components/Rating/Rating.svelte +2 -2
  27. package/components/Rating/Rating.tsx +2 -2
  28. package/components/Rating/rating.module.scss +1 -1
  29. package/components/Slider/Slider.astro +44 -0
  30. package/components/Slider/Slider.svelte +42 -0
  31. package/components/Slider/Slider.tsx +48 -0
  32. package/components/Slider/slider.module.scss +68 -0
  33. package/components/Slider/slider.ts +20 -0
  34. package/components/Switch/switch.module.scss +1 -1
  35. package/components/Table/Table.astro +6 -1
  36. package/components/Table/Table.svelte +3 -1
  37. package/components/Table/Table.tsx +7 -1
  38. package/components/Table/table.module.scss +11 -1
  39. package/components/Table/table.ts +1 -0
  40. package/components/Tabs/tabs.module.scss +6 -1
  41. package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -0
  42. package/components/ThemeSwitcher/ThemeSwitcher.svelte +2 -1
  43. package/components/ThemeSwitcher/ThemeSwitcher.tsx +2 -1
  44. package/components/Timeline/timeline.module.scss +4 -4
  45. package/components/TimelineItem/TimelineItem.tsx +1 -6
  46. package/components/TimelineItem/timelineitem.module.scss +2 -3
  47. package/components/TimelineItem/timelineitem.ts +5 -0
  48. package/icons/close.svg +3 -0
  49. package/icons.d.ts +1 -0
  50. package/icons.js +1 -0
  51. package/index.js +2 -0
  52. package/package.json +1 -1
  53. package/react.d.ts +6 -2
  54. package/react.js +4 -0
  55. package/scss/config/color-palette.scss +1 -0
  56. package/scss/config/mixins.scss +152 -155
  57. package/scss/config/typography.scss +8 -9
  58. package/scss/global/theme.scss +71 -38
  59. package/scss/global/tooltip.scss +5 -3
  60. package/scss/global/utility.scss +76 -58
  61. package/scss/resets.scss +10 -5
  62. package/scss/setup.scss +2 -2
  63. package/svelte.d.ts +4 -0
  64. package/svelte.js +4 -0
  65. package/utils/interpolate.ts +23 -0
  66. package/utils/modal.ts +59 -0
@@ -2,7 +2,6 @@
2
2
 
3
3
  .item {
4
4
  @include position(relative);
5
- @include typography(md);
6
5
  @include spacing(m0);
7
6
 
8
7
  &::before {
@@ -10,7 +9,7 @@
10
9
  @include size(25px);
11
10
  @include border-radius(max);
12
11
  @include background(var(--w-timeline-color));
13
- @include typography(sm);
12
+ @include typography(md);
14
13
  @include layout(inline-flex, center);
15
14
  @include border(2px, primary-70);
16
15
 
@@ -21,7 +20,7 @@
21
20
  }
22
21
 
23
22
  .title {
24
- @include typography(bold, default);
23
+ @include typography(bold, lg);
25
24
  @include spacing(mb-sm);
26
25
 
27
26
  display: block;
@@ -3,3 +3,8 @@ export type TimelineItemProps = {
3
3
  titleTag?: string
4
4
  className?: string
5
5
  }
6
+
7
+ export type ReactTimelineItemProps = {
8
+ TitleTag?: keyof JSX.IntrinsicElements
9
+ children: React.ReactNode
10
+ } & Omit<TimelineItemProps, 'titleTag'>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0.390524 0.390524C0.911223 -0.130175 1.75544 -0.130175 2.27614 0.390524L12 10.1144L21.7239 0.390524C22.2446 -0.130175 23.0888 -0.130175 23.6095 0.390524C24.1302 0.911223 24.1302 1.75544 23.6095 2.27614L13.8856 12L23.6095 21.7239C24.1302 22.2446 24.1302 23.0888 23.6095 23.6095C23.0888 24.1302 22.2446 24.1302 21.7239 23.6095L12 13.8856L2.27614 23.6095C1.75544 24.1302 0.911223 24.1302 0.390524 23.6095C-0.130175 23.0888 -0.130175 22.2446 0.390524 21.7239L10.1144 12L0.390524 2.27614C-0.130175 1.75544 -0.130175 0.911223 0.390524 0.390524Z" fill="currentColor"/>
3
+ </svg>
package/icons.d.ts CHANGED
@@ -3,6 +3,7 @@ declare module 'webcoreui/icons' {
3
3
  export const arrowDown: string
4
4
  export const check: string
5
5
  export const circleCheck: string
6
+ export const close: string
6
7
  export const github: string
7
8
  export const info: string
8
9
  export const moon: string
package/icons.js CHANGED
@@ -2,6 +2,7 @@ export { default as alert } from './icons/alert.svg?raw'
2
2
  export { default as arrowDown } from './icons/arrow-down.svg?raw'
3
3
  export { default as check } from './icons/check.svg?raw'
4
4
  export { default as circleCheck } from './icons/circle-check.svg?raw'
5
+ export { default as close } from './icons/close.svg?raw'
5
6
  export { default as github } from './icons/github.svg?raw'
6
7
  export { default as info } from './icons/info.svg?raw'
7
8
  export { default as moon } from './icons/moon.svg?raw'
package/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './utils/classNames.ts'
2
2
  export * from './utils/cookies.ts'
3
3
  export * from './utils/event.ts'
4
+ export * from './utils/interpolate.ts'
5
+ export * from './utils/modal.ts'
4
6
  export * from './utils/toast.ts'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webcoreui",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "scripts": {
6
6
  "dev": "astro dev",
7
7
  "build": "astro check && astro build",
package/react.d.ts CHANGED
@@ -10,16 +10,18 @@ import type { ReactConditionalWrapperProps } from './components/ConditionalWrapp
10
10
  import type { IconProps } from './components/Icon/icon'
11
11
  import type { ReactInputProps } from './components/Input/input'
12
12
  import type { ReactMenuProps } from './components/Menu/menu'
13
+ import type { ReactModalProps } from './components/Modal/modal'
13
14
  import type { ProgressProps } from './components/Progress/progress'
14
15
  import type { ReactRadioProps } from './components/Radio/radio'
15
16
  import type { RatingProps } from './components/Rating/rating'
17
+ import type { ReactSliderProps } from './components/Slider/slider'
16
18
  import type { SpinnerProps } from './components/Spinner/spinner'
17
19
  import type { ReactSwitchProps } from './components/Switch/switch'
18
20
  import type { TableProps } from './components/Table/table'
19
21
  import type { ReactTabsProps } from './components/Tabs/tabs'
20
22
  import type { ReactThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
21
23
  import type { ReactTimelineProps } from './components/Timeline/timeline'
22
- import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
24
+ import type { ReactTimelineItemProps } from './components/TimelineItem/timelineitem'
23
25
  import type { ReactToastProps } from './components/Toast/toast'
24
26
 
25
27
  declare module 'webcoreui/react' {
@@ -34,15 +36,17 @@ declare module 'webcoreui/react' {
34
36
  export const Icon: FC<IconProps>
35
37
  export const Input: FC<ReactInputProps>
36
38
  export const Menu: FC<ReactMenuProps>
39
+ export const Modal: FC<ReactModalProps>
37
40
  export const Progress: FC<ProgressProps>
38
41
  export const Radio: FC<ReactRadioProps>
39
42
  export const Rating: FC<RatingProps>
43
+ export const Slider: FC<ReactSliderProps>
40
44
  export const Spinner: FC<SpinnerProps>
41
45
  export const Switch: FC<ReactSwitchProps>
42
46
  export const Table: FC<TableProps>
43
47
  export const Tabs: FC<ReactTabsProps>
44
48
  export const ThemeSwitcher: FC<ReactThemeSwitcherProps>
45
49
  export const Timeline: FC<ReactTimelineProps>
46
- export const TimelineItem: FC<TimelineItemProps>
50
+ export const TimelineItem: FC<ReactTimelineItemProps>
47
51
  export const Toast: FC<ReactToastProps>
48
52
  }
package/react.js CHANGED
@@ -9,9 +9,11 @@ import ConditionalWrapperComponent from './components/ConditionalWrapper/Conditi
9
9
  import IconComponent from './components/Icon/Icon.tsx'
10
10
  import InputComponent from './components/Input/Input.tsx'
11
11
  import MenuComponent from './components/Menu/Menu.tsx'
12
+ import ModalComponent from './components/Modal/Modal.tsx'
12
13
  import ProgressComponent from './components/Progress/Progress.tsx'
13
14
  import RadioComponent from './components/Radio/Radio.tsx'
14
15
  import RatingComponent from './components/Rating/Rating.tsx'
16
+ import SliderComponent from './components/Slider/Slider.tsx'
15
17
  import SpinnerComponent from './components/Spinner/Spinner.tsx'
16
18
  import SwitchComponent from './components/Switch/Switch.tsx'
17
19
  import TableComponent from './components/Table/Table.tsx'
@@ -32,9 +34,11 @@ export const ConditionalWrapper = ConditionalWrapperComponent
32
34
  export const Icon = IconComponent
33
35
  export const Input = InputComponent
34
36
  export const Menu = MenuComponent
37
+ export const Modal = ModalComponent
35
38
  export const Progress = ProgressComponent
36
39
  export const Radio = RadioComponent
37
40
  export const Rating = RatingComponent
41
+ export const Slider = SliderComponent
38
42
  export const Spinner = SpinnerComponent
39
43
  export const Switch = SwitchComponent
40
44
  export const Table = TableComponent
@@ -20,4 +20,5 @@ $colorPalette: (
20
20
  'alert': var(--w-color-alert),
21
21
  'alert-accent': var(--w-color-alert-accent),
22
22
  'alert-fg': var(--w-color-alert-fg),
23
+ 'overlay': var(--w-color-overlay)
23
24
  ) !default;
@@ -3,27 +3,6 @@
3
3
  @use 'sass:list';
4
4
  @use 'sass:string';
5
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
-
18
- transition: $property $speed cubic-bezier(0.4, 0.0, 0.2, 1);
19
- }
20
-
21
- @mixin media($breakpoint: 'xs') {
22
- @media (min-width: #{map.get($breakpoints, $breakpoint)}) {
23
- @content;
24
- }
25
- }
26
-
27
6
  @mixin background($arg) {
28
7
  background: map.get($colorPalette, '#{$arg}') or $arg;
29
8
  }
@@ -71,122 +50,95 @@
71
50
  @mixin border-radius($args...) {
72
51
  $borderRadius: map.get($radius, 'md');
73
52
  $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
-
53
+
81
54
  @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
- }
55
+ @if (map.get($radius, $arg)) {
56
+ $borderRadius: map.get($radius, $arg);
57
+ }
58
+
59
+ $side: (
60
+ top: $borderRadius $borderRadius 0 0,
61
+ bottom: 0 0 $borderRadius $borderRadius,
62
+ left: $borderRadius 0 0 $borderRadius,
63
+ right: 0 $borderRadius $borderRadius 0,
64
+ diagonal: $borderRadius 0,
65
+ reverse-diagonal: 0 $borderRadius
66
+ );
67
+
68
+ @if (map.get($side, $arg)) {
69
+ $position: map.get($side, $arg);
70
+ }
89
71
  }
72
+
73
+ border-radius: $position or $borderRadius;
74
+ }
90
75
 
91
- @if ($position) {
92
- @each $key in $position {
93
- border-#{$key}-radius: $borderRadius;
94
- }
95
- } @else {
96
- border-radius: $borderRadius;
97
- }
76
+ @mixin layer($stack: 'default') {
77
+ z-index: #{map.get($layers, $stack)};
98
78
  }
99
79
 
100
- @mixin visibility($args...) {
80
+ @mixin layout($args...) {
81
+ $layouts: (flex, inline-flex, grid, inline-grid);
82
+ $alignments: (
83
+ vertical: (
84
+ 'v-center': center,
85
+ 'v-start': flex-start,
86
+ 'v-end': flex-end,
87
+ 'v-baseline': baseline,
88
+ 'v-stretch': stretch
89
+ ),
90
+ horizontal: (
91
+ 'h-center': center,
92
+ 'h-start': flex-start,
93
+ 'h-end': flex-end,
94
+ 'h-between': space-between,
95
+ 'h-around': space-around,
96
+ 'h-evenly': space-evenly,
97
+ 'h-stretch': stretch
98
+ )
99
+ );
100
+
101
101
  @each $arg in $args {
102
- @if list.index($displayValues, $arg) {
102
+ @if (list.index($layouts, $arg)) {
103
103
  display: $arg;
104
104
  }
105
105
 
106
- @if list.index($overflowValues, $arg) {
107
- overflow: $arg;
108
- }
109
-
110
- @if (meta.type-of($arg) == 'number') {
111
- opacity: $arg;
106
+ @if (map.get($spacing, $arg)) {
107
+ gap: map.get($spacing, $arg);
112
108
  }
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
109
 
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
- }
110
+ @if (meta.type-of($arg) == 'string') {
111
+ @if (string.index($arg, 'v-')) {
112
+ align-items: map.get(map.get($alignments, vertical), $arg)
113
+ }
146
114
 
147
- @if (index($args, $arg) == 2) {
148
- height: $arg;
149
- }
115
+ @if (string.index($arg, 'h-')) {
116
+ justify-content: map.get(map.get($alignments, horizontal), $arg)
150
117
  }
151
118
  }
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
119
 
171
- @if ($size) {
172
- font-size: $size;
120
+ @if ($arg == 'center') {
121
+ align-items: center;
122
+ justify-content: center;
173
123
  }
174
124
 
175
- @if list.index($fontWeights, $arg) {
176
- font-weight: $arg;
125
+ @if (list.index($flexDirectionValues, $arg)) {
126
+ flex-direction: $arg;
177
127
  }
178
128
 
179
- @if list.index($textAlignValues, $arg) {
180
- text-align: $arg;
129
+ @if (meta.type-of($arg) == 'number') {
130
+ grid-template-columns: repeat($arg, minmax(0, 1fr));
181
131
  }
182
132
 
183
- @if ($decoration) {
184
- text-decoration: $decoration;
133
+ @if (list.index($flexWrapValues, $arg)) {
134
+ flex-wrap: $arg;
185
135
  }
136
+ }
137
+ }
186
138
 
187
- @if ($height or (meta.type-of($arg) == 'number' and $arg < 100)) {
188
- line-height: $height or $arg;
189
- }
139
+ @mixin media($breakpoint: 'xs') {
140
+ @media (min-width: #{map.get($breakpoints, $breakpoint)}) {
141
+ @content;
190
142
  }
191
143
  }
192
144
 
@@ -230,6 +182,41 @@
230
182
  }
231
183
  }
232
184
 
185
+ @mixin size($args...) {
186
+ $singlePrefix: string.slice(list.nth(#{$args}, 1), 1, 1);
187
+ $isSingle: list.length($args) == 1
188
+ and $singlePrefix != 'w'
189
+ and $singlePrefix != 'h';
190
+
191
+ @if ($isSingle) {
192
+ width: $args;
193
+ height: $args;
194
+ } @else {
195
+ @each $arg in $args {
196
+ @if (meta.type-of($arg) == string) {
197
+ $prefix: string.slice($arg, 1, 1);
198
+ $value: string.slice($arg, 2, -1);
199
+
200
+ @if ($prefix == 'w') {
201
+ width: string.unquote($value);
202
+ }
203
+
204
+ @if ($prefix == 'h') {
205
+ height: string.unquote($value);
206
+ }
207
+ } @else {
208
+ @if (index($args, $arg) == 1) {
209
+ width: $arg;
210
+ }
211
+
212
+ @if (index($args, $arg) == 2) {
213
+ height: $arg;
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+
233
220
  @mixin spacing($args...) {
234
221
  $margin: (0 0 0 0);
235
222
  $padding: (0 0 0 0);
@@ -342,61 +329,71 @@
342
329
  }
343
330
  }
344
331
 
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
- );
332
+ @mixin transition($args...) {
333
+ $property: all;
334
+ $speed: .3s;
365
335
 
366
336
  @each $arg in $args {
367
- @if (list.index($layouts, $arg)) {
368
- display: $arg;
337
+ @if (meta.type-of($arg) == 'number') {
338
+ $speed: $arg;
339
+ } @else {
340
+ $property: $arg;
369
341
  }
342
+ }
370
343
 
371
- @if (map.get($spacing, $arg)) {
372
- gap: map.get($spacing, $arg);
344
+ transition: $property $speed cubic-bezier(0.4, 0.0, 0.2, 1);
345
+ }
346
+
347
+ @mixin typography($args...) {
348
+ @each $arg in $args {
349
+ $color: map.get($colorPalette, '#{$arg}');
350
+ $type: map.get($fontTypes, '#{$arg}');
351
+ $size: map.get($fontSizes, '#{$arg}');
352
+ $height: map.get($lineHeights, '#{$arg}');
353
+ $decoration: map.get($decorations, '#{$arg}');
354
+
355
+ @if ($color) {
356
+ color: $color;
373
357
  }
374
358
 
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
- }
359
+ @if ($type) {
360
+ font-family: $type;
383
361
  }
384
362
 
385
- @if ($arg == 'center') {
386
- align-items: center;
387
- justify-content: center;
363
+ @if ($size) {
364
+ font-size: $size;
388
365
  }
389
366
 
390
- @if (list.index($flexDirectionValues, $arg)) {
391
- flex-direction: $arg;
367
+ @if list.index($fontWeights, $arg) {
368
+ font-weight: $arg;
392
369
  }
393
370
 
394
- @if (meta.type-of($arg) == 'number') {
395
- grid-template-columns: repeat($arg, minmax(0, 1fr));
371
+ @if list.index($textAlignValues, $arg) {
372
+ text-align: $arg;
396
373
  }
397
374
 
398
- @if (list.index($flexWrapValues, $arg)) {
399
- flex-wrap: $arg;
375
+ @if ($decoration) {
376
+ text-decoration: $decoration;
377
+ }
378
+
379
+ @if ($height or (meta.type-of($arg) == 'number' and $arg < 100)) {
380
+ line-height: $height or $arg;
381
+ }
382
+ }
383
+ }
384
+
385
+ @mixin visibility($args...) {
386
+ @each $arg in $args {
387
+ @if list.index($displayValues, $arg) {
388
+ display: $arg;
389
+ }
390
+
391
+ @if list.index($overflowValues, $arg) {
392
+ overflow: $arg;
393
+ }
394
+
395
+ @if (meta.type-of($arg) == 'number') {
396
+ opacity: $arg;
400
397
  }
401
398
  }
402
399
  }
@@ -4,15 +4,14 @@ $fontTypes: (
4
4
  ) !default;
5
5
 
6
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
7
+ 'xs': 10px,
8
+ 'sm': 12px,
9
+ 'md': 14px,
10
+ 'default': 16px,
11
+ 'lg': 18px,
12
+ 'xl': 21px,
13
+ '2xl': 24px,
14
+ '3xl': 28px
16
15
  ) !default;
17
16
 
18
17
  $lineHeights: (