webcoreui 0.0.12 → 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 (83) hide show
  1. package/README.md +39 -6
  2. package/astro.d.ts +4 -0
  3. package/astro.js +4 -0
  4. package/components/Accordion/accordion.module.scss +20 -27
  5. package/components/Alert/alert.module.scss +19 -22
  6. package/components/Avatar/avatar.module.scss +9 -6
  7. package/components/Badge/badge.module.scss +31 -34
  8. package/components/Button/Button.astro +0 -2
  9. package/components/Button/Button.svelte +0 -2
  10. package/components/Button/Button.tsx +0 -2
  11. package/components/Button/button.module.scss +32 -39
  12. package/components/Button/button.ts +1 -2
  13. package/components/Card/card.module.scss +19 -15
  14. package/components/Checkbox/checkbox.module.scss +27 -41
  15. package/components/Icon/Icon.astro +2 -2
  16. package/components/Icon/map.ts +2 -0
  17. package/components/Input/input.module.scss +28 -36
  18. package/components/Menu/Menu.astro +7 -3
  19. package/components/Menu/Menu.svelte +11 -3
  20. package/components/Menu/Menu.tsx +7 -1
  21. package/components/Menu/menu.module.scss +144 -144
  22. package/components/Menu/menu.ts +1 -0
  23. package/components/Modal/Modal.astro +70 -0
  24. package/components/Modal/Modal.svelte +71 -0
  25. package/components/Modal/Modal.tsx +76 -0
  26. package/components/Modal/modal.module.scss +103 -0
  27. package/components/Modal/modal.ts +18 -0
  28. package/components/Progress/progress.module.scss +26 -22
  29. package/components/Radio/radio.module.scss +32 -41
  30. package/components/Rating/Rating.astro +2 -2
  31. package/components/Rating/Rating.svelte +2 -2
  32. package/components/Rating/Rating.tsx +2 -2
  33. package/components/Rating/rating.module.scss +15 -8
  34. package/components/Slider/Slider.astro +44 -0
  35. package/components/Slider/Slider.svelte +42 -0
  36. package/components/Slider/Slider.tsx +48 -0
  37. package/components/Slider/slider.module.scss +68 -0
  38. package/components/Slider/slider.ts +20 -0
  39. package/components/Spinner/spinner.module.scss +11 -2
  40. package/components/Switch/switch.module.scss +28 -30
  41. package/components/Table/Table.astro +6 -1
  42. package/components/Table/Table.svelte +3 -1
  43. package/components/Table/Table.tsx +7 -1
  44. package/components/Table/table.module.scss +23 -17
  45. package/components/Table/table.ts +1 -0
  46. package/components/Tabs/Tabs.astro +0 -1
  47. package/components/Tabs/tabs.module.scss +45 -48
  48. package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -0
  49. package/components/ThemeSwitcher/ThemeSwitcher.svelte +2 -1
  50. package/components/ThemeSwitcher/ThemeSwitcher.tsx +2 -1
  51. package/components/ThemeSwitcher/themeswitcher.module.scss +28 -26
  52. package/components/Timeline/timeline.module.scss +28 -23
  53. package/components/TimelineItem/TimelineItem.tsx +1 -6
  54. package/components/TimelineItem/timelineitem.module.scss +14 -17
  55. package/components/TimelineItem/timelineitem.ts +5 -0
  56. package/components/Toast/toast.module.scss +10 -14
  57. package/components/Toast/toast.ts +6 -1
  58. package/icons/close.svg +3 -0
  59. package/icons.d.ts +12 -0
  60. package/icons.js +10 -0
  61. package/index.js +2 -0
  62. package/package.json +3 -1
  63. package/react.d.ts +6 -2
  64. package/react.js +4 -0
  65. package/scss/config/color-palette.scss +24 -0
  66. package/scss/config/css-values.scss +44 -0
  67. package/scss/config/layout.scss +41 -0
  68. package/scss/config/mixins.scss +392 -9
  69. package/scss/config/typography.scss +65 -0
  70. package/scss/config.scss +6 -1
  71. package/scss/global/elements.scss +21 -1
  72. package/scss/global/scrollbar.scss +12 -9
  73. package/scss/global/theme.scss +73 -40
  74. package/scss/global/tooltip.scss +42 -35
  75. package/scss/global/utility.scss +79 -61
  76. package/scss/global.scss +0 -1
  77. package/scss/resets.scss +67 -9
  78. package/scss/setup.scss +14 -41
  79. package/svelte.d.ts +4 -0
  80. package/svelte.js +4 -0
  81. package/utils/interpolate.ts +23 -0
  82. package/utils/modal.ts +59 -0
  83. package/utils/toast.ts +3 -2
@@ -1,144 +1,144 @@
1
- @import '../../scss/config.scss';
2
-
3
- .menu {
4
- background: var(--w-color-primary-70);
5
- padding: 15px;
6
- font-size: 16px;
7
- border-bottom: 1px solid var(--w-color-primary-50);
8
- position: sticky;
9
- top: 0;
10
- z-index: 99;
11
-
12
- &[data-active="true"] {
13
- .hamburger {
14
- box-shadow: 0 0 0 1000px var(--w-color-primary-70);
15
-
16
- .meat:first-child,
17
- .meat:last-child {
18
- opacity: 0;
19
- }
20
-
21
- .meat:first-child {
22
- transform: translateY(20px) scale(0);
23
- }
24
-
25
- .meat:last-child {
26
- transform: translateY(-20px) scale(0);
27
- }
28
-
29
- .meat:nth-child(2) {
30
- transform: rotate(45deg);
31
- }
32
-
33
- .meat:nth-child(3) {
34
- transform: rotate(-45deg);
35
- }
36
- }
37
-
38
- ul {
39
- @include Transition(opacity);
40
- opacity: 1;
41
- z-index: 99;
42
- pointer-events: all;
43
- }
44
- }
45
-
46
- .wrapper {
47
- display: flex;
48
- align-items: center;
49
- gap: 20px;
50
- }
51
-
52
- img,
53
- svg {
54
- display: block;
55
- }
56
-
57
- ul {
58
- margin: 0;
59
- padding: 0;
60
- list-style-type: none;
61
- display: flex;
62
- gap: 20px;
63
- position: fixed;
64
- top: 20px;
65
- left: 20px;
66
- flex-direction: column;
67
- opacity: 0;
68
- pointer-events: none;
69
-
70
- a {
71
- @include Transition(color);
72
- color: var(--w-color-primary-20);
73
-
74
- &:hover {
75
- color: var(--w-color-primary);
76
- }
77
- }
78
- }
79
-
80
- .hamburger {
81
- @include Transition(box-shadow);
82
- position: relative;
83
- width: 30px;
84
- height: 20px;
85
- box-shadow: 0 0 0 0 var(--w-color-primary-70);
86
- border-radius: 50%;
87
- padding: 0;
88
- border: 0;
89
- background: transparent;
90
- z-index: 98;
91
- cursor: pointer;
92
-
93
- .meat {
94
- @include Transition();
95
- width: 100%;
96
- position: absolute;
97
- height: 2px;
98
- background: var(--w-color-primary);
99
- display: block;
100
- border-radius: 5px;
101
-
102
- &:first-child {
103
- top: 0;
104
- }
105
-
106
- &:nth-child(2),
107
- &:nth-child(3) {
108
- top: 50%;
109
- transform: translateY(-50%);
110
- }
111
-
112
- &:last-child {
113
- bottom: 0;
114
- }
115
- }
116
- }
117
- }
118
-
119
- .container {
120
- display: flex;
121
- align-items: center;
122
- gap: 20px;
123
- justify-content: space-between;
124
- flex-wrap: wrap;
125
- max-width: 1200px;
126
- margin: 0 auto;
127
- padding: 0 20px;
128
- }
129
-
130
- @include Media('sm') {
131
- .menu {
132
- .hamburger {
133
- display: none;
134
- }
135
-
136
- ul {
137
- position: static;
138
- opacity: 1;
139
- flex-direction: row;
140
- pointer-events: all;
141
- transform: none;
142
- }
143
- }
144
- }
1
+ @use '../../scss/config.scss' as *;
2
+
3
+ .menu {
4
+ @include background(primary-70);
5
+ @include spacing(p-md);
6
+ @include border(bottom, primary-50);
7
+ @include position(sticky, t0);
8
+ @include layer(header);
9
+
10
+ &[data-active="true"] {
11
+ .hamburger {
12
+ box-shadow: 0 0 0 1000px var(--w-color-primary-70);
13
+
14
+ .meat:first-child,
15
+ .meat:last-child {
16
+ @include visibility(0);
17
+ }
18
+
19
+ .meat:first-child {
20
+ transform: translateY(20px) scale(0);
21
+ }
22
+
23
+ .meat:last-child {
24
+ transform: translateY(-20px) scale(0);
25
+ }
26
+
27
+ .meat:nth-child(2) {
28
+ transform: rotate(45deg);
29
+ }
30
+
31
+ .meat:nth-child(3) {
32
+ transform: rotate(-45deg);
33
+ }
34
+ }
35
+
36
+ ul {
37
+ @include transition(opacity);
38
+ @include visibility(1);
39
+ @include layer(header);
40
+ pointer-events: all;
41
+ }
42
+ }
43
+
44
+ .wrapper {
45
+ @include layout(flex, v-center, default);
46
+ }
47
+
48
+ a {
49
+ @include typography(none);
50
+ }
51
+
52
+ img,
53
+ svg {
54
+ display: block;
55
+ }
56
+
57
+ ul {
58
+ @include spacing(0);
59
+ @include layout(flex, default, column);
60
+ @include position(fixed, t20px, l20px);
61
+ @include visibility(0);
62
+ @include typography(normal);
63
+
64
+ list-style-type: none;
65
+ pointer-events: none;
66
+
67
+ li {
68
+ @include spacing(m0);
69
+ }
70
+
71
+ a {
72
+ @include typography(primary-20);
73
+
74
+ &:hover {
75
+ @include typography(primary);
76
+ }
77
+
78
+ &.active {
79
+ @include typography(primary);
80
+ }
81
+ }
82
+ }
83
+
84
+ .hamburger {
85
+ @include transition(box-shadow);
86
+ @include position(relative);
87
+ @include size(w30px, h20px);
88
+ @include border-radius(max);
89
+ @include spacing(p0);
90
+ @include border(0);
91
+ @include background(transparent);
92
+ @include layer(top);
93
+
94
+ box-shadow: 0 0 0 0 var(--w-color-primary-70);
95
+ cursor: pointer;
96
+
97
+ .meat {
98
+ @include transition();
99
+ @include size('w100%', h2px);
100
+ @include position(absolute);
101
+ @include background(primary);
102
+ @include border-radius(md);
103
+
104
+ display: block;
105
+
106
+ &:first-child {
107
+ @include position(t0);
108
+ }
109
+
110
+ &:nth-child(2),
111
+ &:nth-child(3) {
112
+ @include position(v-center);
113
+ }
114
+
115
+ &:last-child {
116
+ @include position(b0);
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ .container {
123
+ @include layout(flex, v-center, default, h-between, wrap);
124
+ @include spacing(auto-none, px-default);
125
+
126
+ max-width: 1200px;
127
+ }
128
+
129
+ @include media('sm') {
130
+ .menu {
131
+ .hamburger {
132
+ @include visibility(none);
133
+ }
134
+
135
+ ul {
136
+ @include position(static);
137
+ @include visibility(1);
138
+ @include layout(row);
139
+
140
+ pointer-events: all;
141
+ transform: none;
142
+ }
143
+ }
144
+ }
@@ -3,6 +3,7 @@ export type MenuProps = {
3
3
  url: string
4
4
  name: string
5
5
  target?: string
6
+ active?: boolean
6
7
  }[]
7
8
  logo?: {
8
9
  url?: string
@@ -0,0 +1,70 @@
1
+ ---
2
+ import type { ModalProps } from './modal'
3
+
4
+ import Button from '../Button/Button.astro'
5
+
6
+ import info from '../../icons/info.svg?raw'
7
+ import success from '../../icons/circle-check.svg?raw'
8
+ import warning from '../../icons/warning.svg?raw'
9
+ import alert from '../../icons/alert.svg?raw'
10
+ import closeIcon from '../../icons/close.svg?raw'
11
+
12
+ import styles from './modal.module.scss'
13
+
14
+ interface Props extends ModalProps {}
15
+
16
+ const iconMap = {
17
+ info,
18
+ success,
19
+ warning,
20
+ alert
21
+ }
22
+
23
+ const {
24
+ title,
25
+ subTitle,
26
+ showCloseIcon = true,
27
+ closeOnEsc = true,
28
+ closeOnOverlay = true,
29
+ theme,
30
+ id,
31
+ className
32
+ } = Astro.props
33
+
34
+ const close = [
35
+ showCloseIcon && 'icon',
36
+ closeOnEsc && 'esc',
37
+ closeOnOverlay && 'overlay'
38
+ ].filter(Boolean).join(',')
39
+
40
+ const classes = [
41
+ styles.modal,
42
+ theme && styles[theme],
43
+ className
44
+ ]
45
+ ---
46
+
47
+ <dialog
48
+ class:list={classes}
49
+ id={id}
50
+ data-close={close.length ? close : undefined}
51
+ >
52
+ {showCloseIcon && (
53
+ <Button
54
+ theme="flat"
55
+ className={styles.close}
56
+ data-id="close"
57
+ >
58
+ <Fragment set:html={closeIcon} />
59
+ </Button>
60
+ )}
61
+ {title && (
62
+ <strong class={styles.title}>
63
+ {theme && <Fragment set:html={iconMap[theme]} />}
64
+ {title}
65
+ </strong>
66
+ )}
67
+ {subTitle && <div class={styles.subTitle}>{subTitle}</div>}
68
+ <slot />
69
+ </dialog>
70
+ <div class={styles.overlay} />
@@ -0,0 +1,71 @@
1
+ <script lang="ts">
2
+ import type { ModalProps } from './modal'
3
+
4
+ import styles from './modal.module.scss'
5
+ import { classNames } from '../../utils/classNames'
6
+
7
+ import Button from '../Button/Button.svelte'
8
+
9
+ import info from '../../icons/info.svg?raw'
10
+ import success from '../../icons/circle-check.svg?raw'
11
+ import warning from '../../icons/warning.svg?raw'
12
+ import alert from '../../icons/alert.svg?raw'
13
+ import closeIcon from '../../icons/close.svg?raw'
14
+
15
+ export let title: ModalProps['title'] = ''
16
+ export let subTitle: ModalProps['subTitle'] = ''
17
+ export let showCloseIcon: ModalProps['showCloseIcon'] = true
18
+ export let closeOnEsc: ModalProps['closeOnEsc'] = true
19
+ export let closeOnOverlay: ModalProps['closeOnOverlay'] = true
20
+ export let theme: ModalProps['theme'] = null
21
+ export let id : ModalProps['className'] = ''
22
+ export let className: ModalProps['className'] = ''
23
+
24
+ const iconMap = {
25
+ info,
26
+ success,
27
+ warning,
28
+ alert
29
+ }
30
+
31
+ const classes = classNames([
32
+ styles.modal,
33
+ theme && styles[theme],
34
+ className
35
+ ])
36
+
37
+ const close = [
38
+ showCloseIcon && 'icon',
39
+ closeOnEsc && 'esc',
40
+ closeOnOverlay && 'overlay'
41
+ ].filter(Boolean).join(',')
42
+ </script>
43
+
44
+ <dialog
45
+ class={classes}
46
+ id={id}
47
+ data-close={close.length ? close : undefined}
48
+ >
49
+ {#if showCloseIcon}
50
+ <Button
51
+ theme="flat"
52
+ className={styles.close}
53
+ data-id="close"
54
+ >
55
+ {@html closeIcon}
56
+ </Button>
57
+ {/if}
58
+ {#if title}
59
+ <strong class={styles.title}>
60
+ {#if theme}
61
+ {@html iconMap[theme]}
62
+ {/if}
63
+ {title}
64
+ </strong>
65
+ {/if}
66
+ {#if subTitle}
67
+ <div class={styles.subTitle}>{subTitle}</div>
68
+ {/if}
69
+ <slot />
70
+ </dialog>
71
+ <div class={styles.overlay} />
@@ -0,0 +1,76 @@
1
+ import React from 'react'
2
+ import type { ReactModalProps } from './modal'
3
+
4
+ import styles from './modal.module.scss'
5
+ import { classNames } from '../../utils/classNames'
6
+
7
+ import Button from '../Button/Button.tsx'
8
+
9
+ import info from '../../icons/info.svg?raw'
10
+ import success from '../../icons/circle-check.svg?raw'
11
+ import warning from '../../icons/warning.svg?raw'
12
+ import alert from '../../icons/alert.svg?raw'
13
+ import closeIcon from '../../icons/close.svg?raw'
14
+
15
+ const iconMap = {
16
+ info,
17
+ success,
18
+ warning,
19
+ alert
20
+ }
21
+
22
+ const Modal = ({
23
+ title,
24
+ subTitle,
25
+ showCloseIcon = true,
26
+ closeOnEsc = true,
27
+ closeOnOverlay = true,
28
+ theme,
29
+ id,
30
+ className,
31
+ children
32
+ }: ReactModalProps) => {
33
+ const classes = classNames([
34
+ styles.modal,
35
+ theme && styles[theme],
36
+ className
37
+ ])
38
+
39
+ const close = [
40
+ showCloseIcon && 'icon',
41
+ closeOnEsc && 'esc',
42
+ closeOnOverlay && 'overlay'
43
+ ].filter(Boolean).join(',')
44
+
45
+ return (
46
+ <React.Fragment>
47
+ <dialog
48
+ className={classes}
49
+ id={id}
50
+ data-close={close.length ? close : undefined}
51
+ >
52
+ {showCloseIcon && (
53
+ <Button
54
+ theme="flat"
55
+ className={styles.close}
56
+ data-id="close"
57
+ dangerouslySetInnerHTML={{ __html: closeIcon }}
58
+ />
59
+ )}
60
+ {title && (
61
+ <strong
62
+ className={styles.title}
63
+ dangerouslySetInnerHTML={{
64
+ __html: theme ? iconMap[theme] + title : title
65
+ }}
66
+ />
67
+ )}
68
+ {subTitle && <div className={styles.subTitle}>{subTitle}</div>}
69
+ {children}
70
+ </dialog>
71
+ <div className={styles.overlay} />
72
+ </React.Fragment>
73
+ )
74
+ }
75
+
76
+ export default Modal
@@ -0,0 +1,103 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .modal {
4
+ @include transition();
5
+ @include position(fixed, 't50%', 'l50%');
6
+ @include spacing(0, p-default);
7
+ @include layer(modal);
8
+ @include visibility(block, 0);
9
+ @include border(primary-50);
10
+ @include background(primary-70);
11
+ @include typography(primary);
12
+ @include border-radius(md);
13
+ @include size('w90%');
14
+
15
+ transform: translate(-50%, calc(-50% + 15px));
16
+ max-width: 500px;
17
+ pointer-events: none;
18
+
19
+ &[data-show="true"] {
20
+ @include visibility(1);
21
+
22
+ transform: translate(-50%, -50%);
23
+ pointer-events: all;
24
+
25
+ + .overlay {
26
+ @include visibility(1);
27
+ pointer-events: all;
28
+ }
29
+ }
30
+
31
+ .close {
32
+ @include position(absolute, t10px, r10px);
33
+ @include spacing(p-xs);
34
+
35
+ svg {
36
+ @include size(10px);
37
+ }
38
+ }
39
+
40
+ .title {
41
+ @include typography(lg);
42
+ @include spacing(mb-xs);
43
+ @include layout(flex, v-center, xs);
44
+
45
+ svg {
46
+ @include size(20px);
47
+ }
48
+ }
49
+
50
+ .subTitle {
51
+ @include typography(primary-20);
52
+ @include spacing(mb-xs);
53
+ }
54
+
55
+ &.info {
56
+ @include border(info);
57
+
58
+ .title {
59
+ @include typography(info);
60
+ }
61
+ }
62
+
63
+ &.success {
64
+ @include border(success);
65
+
66
+ .title {
67
+ @include typography(success);
68
+ }
69
+ }
70
+
71
+ &.warning {
72
+ @include border(warning);
73
+
74
+ .title {
75
+ @include typography(warning);
76
+ }
77
+ }
78
+
79
+ &.alert {
80
+ @include border(alert);
81
+
82
+ .title {
83
+ @include typography(alert);
84
+ }
85
+ }
86
+ }
87
+
88
+ .overlay {
89
+ @include transition(opacity);
90
+ @include position(fixed);
91
+ @include background(overlay);
92
+ @include layer(header);
93
+ @include visibility(0);
94
+
95
+ inset: 0;
96
+ pointer-events: none;
97
+ }
98
+
99
+ @include media(xs) {
100
+ .modal {
101
+ @include size('wauto');
102
+ }
103
+ }
@@ -0,0 +1,18 @@
1
+ export type ModalProps = {
2
+ title?: string
3
+ subTitle?: string
4
+ showCloseIcon?: boolean
5
+ closeOnEsc?: boolean
6
+ closeOnOverlay?: boolean
7
+ id?: string
8
+ className?: string
9
+ theme?: 'info'
10
+ | 'success'
11
+ | 'warning'
12
+ | 'alert'
13
+ | null
14
+ }
15
+
16
+ export type ReactModalProps = {
17
+ children?: React.ReactNode
18
+ } & ModalProps