webcoreui 0.0.10 → 0.0.12
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.
- package/README.md +35 -7
- package/astro.d.ts +8 -0
- package/astro.js +8 -0
- package/components/Accordion/Accordion.astro +10 -8
- package/components/Accordion/Accordion.svelte +8 -8
- package/components/Accordion/Accordion.tsx +7 -6
- package/components/Accordion/{accordion.scss → accordion.module.scss} +18 -10
- package/components/Alert/Alert.astro +11 -7
- package/components/Alert/Alert.svelte +9 -7
- package/components/Alert/Alert.tsx +11 -7
- package/components/Alert/alert.module.scss +54 -0
- package/components/Alert/alert.ts +3 -1
- package/components/Avatar/Avatar.astro +4 -4
- package/components/Avatar/Avatar.svelte +13 -7
- package/components/Avatar/Avatar.tsx +11 -9
- package/components/Avatar/{avatar.scss → avatar.module.scss} +2 -2
- package/components/Badge/Badge.astro +8 -8
- package/components/Badge/Badge.svelte +25 -13
- package/components/Badge/Badge.tsx +26 -8
- package/components/Badge/badge.module.scss +89 -0
- package/components/Badge/badge.ts +8 -1
- package/components/Button/Button.astro +10 -6
- package/components/Button/Button.svelte +15 -11
- package/components/Button/Button.tsx +11 -7
- package/components/Button/button.module.scss +94 -0
- package/components/Button/button.ts +6 -1
- package/components/Card/Card.astro +7 -15
- package/components/Card/Card.svelte +16 -13
- package/components/Card/Card.tsx +15 -11
- package/components/Card/card.module.scss +33 -0
- package/components/Checkbox/Checkbox.astro +10 -10
- package/components/Checkbox/Checkbox.svelte +19 -18
- package/components/Checkbox/Checkbox.tsx +12 -11
- package/components/Checkbox/{checkbox.scss → checkbox.module.scss} +16 -17
- package/components/Checkbox/checkbox.ts +5 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
- package/components/Icon/Icon.svelte +1 -8
- package/components/Icon/Icon.tsx +1 -8
- package/components/Icon/map.ts +23 -0
- package/components/Input/Input.astro +50 -0
- package/components/Input/Input.svelte +52 -0
- package/components/Input/Input.tsx +59 -0
- package/components/Input/input.module.scss +87 -0
- package/components/Input/input.ts +50 -0
- package/components/Menu/Menu.astro +107 -0
- package/components/Menu/Menu.svelte +88 -0
- package/components/Menu/Menu.tsx +107 -0
- package/components/Menu/menu.module.scss +144 -0
- package/components/Menu/menu.ts +21 -0
- package/components/Progress/Progress.astro +42 -40
- package/components/Progress/Progress.svelte +40 -38
- package/components/Progress/Progress.tsx +48 -47
- package/components/Progress/{progress.scss → progress.module.scss} +66 -66
- package/components/Radio/Radio.astro +57 -57
- package/components/Radio/Radio.svelte +58 -56
- package/components/Radio/Radio.tsx +69 -68
- package/components/Radio/{radio.scss → radio.module.scss} +92 -92
- package/components/Radio/radio.ts +4 -0
- package/components/Rating/Rating.astro +13 -10
- package/components/Rating/Rating.svelte +15 -15
- package/components/Rating/Rating.tsx +22 -11
- package/components/Rating/{rating.scss → rating.module.scss} +10 -9
- package/components/Rating/rating.ts +1 -1
- package/components/Spinner/Spinner.astro +44 -42
- package/components/Spinner/Spinner.svelte +40 -38
- package/components/Spinner/Spinner.tsx +45 -44
- package/components/Spinner/{spinner.scss → spinner.module.scss} +41 -41
- package/components/Switch/Switch.astro +13 -11
- package/components/Switch/Switch.svelte +26 -24
- package/components/Switch/Switch.tsx +14 -12
- package/components/Switch/{switch.scss → switch.module.scss} +4 -4
- package/components/Switch/switch.ts +8 -4
- package/components/Table/Table.astro +60 -0
- package/components/Table/Table.svelte +56 -0
- package/components/Table/Table.tsx +64 -0
- package/components/Table/table.module.scss +64 -0
- package/components/Table/table.ts +10 -0
- package/components/Tabs/Tabs.astro +77 -76
- package/components/Tabs/Tabs.svelte +56 -54
- package/components/Tabs/Tabs.tsx +70 -69
- package/components/Tabs/{tabs.scss → tabs.module.scss} +30 -31
- package/components/ThemeSwitcher/ThemeSwitcher.astro +106 -0
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +76 -0
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +89 -0
- package/components/ThemeSwitcher/themeswitcher.module.scss +74 -0
- package/components/ThemeSwitcher/themeswitcher.ts +13 -0
- package/components/Timeline/Timeline.astro +36 -34
- package/components/Timeline/Timeline.svelte +32 -30
- package/components/Timeline/Timeline.tsx +38 -37
- package/components/Timeline/{timeline.scss → timeline.module.scss} +71 -71
- package/components/TimelineItem/TimelineItem.astro +27 -26
- package/components/TimelineItem/TimelineItem.svelte +24 -22
- package/components/TimelineItem/TimelineItem.tsx +33 -32
- package/components/TimelineItem/{timelineitem.scss → timelineitem.module.scss} +31 -31
- package/components/Toast/Toast.astro +41 -30
- package/components/Toast/Toast.svelte +32 -21
- package/components/Toast/Toast.tsx +38 -28
- package/components/Toast/{toast.scss → toast.module.scss} +44 -43
- package/components/Toast/toast.ts +3 -6
- package/icons/moon.svg +3 -0
- package/icons/sun.svg +3 -0
- package/index.js +3 -0
- package/package.json +3 -1
- package/react.d.ts +8 -0
- package/react.js +8 -0
- package/scss/global/elements.scss +1 -1
- package/scss/global/scrollbar.scss +21 -0
- package/scss/global/theme.scss +140 -0
- package/scss/global/tooltip.scss +8 -5
- package/scss/global/utility.scss +29 -0
- package/scss/global.scss +2 -0
- package/scss/resets.scss +5 -5
- package/scss/setup.scss +39 -18
- package/svelte.d.ts +18 -10
- package/svelte.js +8 -0
- package/utils/classNames.ts +4 -0
- package/utils/cookies.ts +28 -0
- package/utils/event.ts +17 -0
- package/utils/toast.ts +12 -9
- package/components/Alert/alert.scss +0 -53
- package/components/Badge/badge.scss +0 -85
- package/components/Button/button.scss +0 -91
- package/components/Card/card.scss +0 -37
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
@import '../config';
|
|
2
|
+
|
|
3
|
+
@mixin Theme($theme: 'dark', $selector: ':root') {
|
|
4
|
+
@if $theme == 'dark' {
|
|
5
|
+
#{$selector} {
|
|
6
|
+
--w-color-scheme: dark;
|
|
7
|
+
--w-color-primary: #FFF;
|
|
8
|
+
--w-color-primary-10: #DDD;
|
|
9
|
+
--w-color-primary-20: #BBB;
|
|
10
|
+
--w-color-primary-30: #555;
|
|
11
|
+
--w-color-primary-40: #333;
|
|
12
|
+
--w-color-primary-50: #252525;
|
|
13
|
+
--w-color-primary-60: #111;
|
|
14
|
+
--w-color-primary-70: #000;
|
|
15
|
+
|
|
16
|
+
--w-color-info: #0ABDE3;
|
|
17
|
+
--w-color-info-accent: #48DBFB;
|
|
18
|
+
--w-color-info-fg: #000;
|
|
19
|
+
--w-color-success: #10AC84;
|
|
20
|
+
--w-color-success-accent: #1DD1A1;
|
|
21
|
+
--w-color-success-fg: #000;
|
|
22
|
+
--w-color-warning: #FF9F43;
|
|
23
|
+
--w-color-warning-accent: #f7AA61;
|
|
24
|
+
--w-color-warning-fg: #000;
|
|
25
|
+
--w-color-alert: #E73F40;
|
|
26
|
+
--w-color-alert-accent: #EE5253;
|
|
27
|
+
--w-color-alert-fg: #FFF;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@if $theme == 'light' {
|
|
32
|
+
#{$selector} {
|
|
33
|
+
--w-color-scheme: light;
|
|
34
|
+
--w-color-primary: #000;
|
|
35
|
+
--w-color-primary-10: #111;
|
|
36
|
+
--w-color-primary-20: #333;
|
|
37
|
+
--w-color-primary-30: #555;
|
|
38
|
+
--w-color-primary-40: #EEE;
|
|
39
|
+
--w-color-primary-50: #DDD;
|
|
40
|
+
--w-color-primary-60: #FAFAFA;
|
|
41
|
+
--w-color-primary-70: #FFF;
|
|
42
|
+
|
|
43
|
+
--w-color-info: #0ABDE3;
|
|
44
|
+
--w-color-info-accent: #48DBFB;
|
|
45
|
+
--w-color-info-fg: #000;
|
|
46
|
+
--w-color-success: #10AC84;
|
|
47
|
+
--w-color-success-accent: #1DD1A1;
|
|
48
|
+
--w-color-success-fg: #000;
|
|
49
|
+
--w-color-warning: #FF9F43;
|
|
50
|
+
--w-color-warning-accent: #f7AA61;
|
|
51
|
+
--w-color-warning-fg: #000;
|
|
52
|
+
--w-color-alert: #E73F40;
|
|
53
|
+
--w-color-alert-accent: #EE5253;
|
|
54
|
+
--w-color-alert-fg: #FFF;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@if $theme == 'midnight' {
|
|
59
|
+
#{$selector} {
|
|
60
|
+
--w-color-scheme: dark;
|
|
61
|
+
--w-color-primary: #FFF;
|
|
62
|
+
--w-color-primary-10: #EEE;
|
|
63
|
+
--w-color-primary-20: #a5b7cf;
|
|
64
|
+
--w-color-primary-30: #516580;
|
|
65
|
+
--w-color-primary-40: #2d4463;
|
|
66
|
+
--w-color-primary-50: #20344e;
|
|
67
|
+
--w-color-primary-60: #101a2d;
|
|
68
|
+
--w-color-primary-70: #061321;
|
|
69
|
+
|
|
70
|
+
--w-color-info: #1058b6;
|
|
71
|
+
--w-color-info-accent: #176ee0;
|
|
72
|
+
--w-color-info-fg: #FFF;
|
|
73
|
+
--w-color-success: #10ac95;
|
|
74
|
+
--w-color-success-accent: #1DD1A1;
|
|
75
|
+
--w-color-success-fg: #000;
|
|
76
|
+
--w-color-warning: #FF9F43;
|
|
77
|
+
--w-color-warning-accent: #f7AA61;
|
|
78
|
+
--w-color-warning-fg: #000;
|
|
79
|
+
--w-color-alert: #E73F40;
|
|
80
|
+
--w-color-alert-accent: #EE5253;
|
|
81
|
+
--w-color-alert-fg: #FFF;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@if $theme == green {
|
|
86
|
+
#{$selector} {
|
|
87
|
+
--w-color-scheme: dark;
|
|
88
|
+
--w-color-primary: #FFF;
|
|
89
|
+
--w-color-primary-10: #EEE;
|
|
90
|
+
--w-color-primary-20: #b7ffe4;
|
|
91
|
+
--w-color-primary-30: #dad7cd;
|
|
92
|
+
--w-color-primary-40: #10AC84;
|
|
93
|
+
--w-color-primary-50: #4d6e4c;
|
|
94
|
+
--w-color-primary-60: #315037;
|
|
95
|
+
--w-color-primary-70: #22392d;
|
|
96
|
+
|
|
97
|
+
--w-color-info: #0ABDE3;
|
|
98
|
+
--w-color-info-accent: #48DBFB;
|
|
99
|
+
--w-color-info-fg: #000;
|
|
100
|
+
--w-color-success: #10AC84;
|
|
101
|
+
--w-color-success-accent: #1DD1A1;
|
|
102
|
+
--w-color-success-fg: #000;
|
|
103
|
+
--w-color-warning: #FF9F43;
|
|
104
|
+
--w-color-warning-accent: #f7AA61;
|
|
105
|
+
--w-color-warning-fg: #000;
|
|
106
|
+
--w-color-alert: #E73F40;
|
|
107
|
+
--w-color-alert-accent: #EE5253;
|
|
108
|
+
--w-color-alert-fg: #FFF;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@if $theme == beige {
|
|
113
|
+
#{$selector} {
|
|
114
|
+
--w-color-scheme: dark;
|
|
115
|
+
--w-color-primary: #000;
|
|
116
|
+
--w-color-primary-10: #111;
|
|
117
|
+
--w-color-primary-20: #97725c;
|
|
118
|
+
--w-color-primary-30: #d6ccc2;
|
|
119
|
+
--w-color-primary-40: #e3d5ca;
|
|
120
|
+
--w-color-primary-50: #ecddcd;
|
|
121
|
+
--w-color-primary-60: #f1e6da;
|
|
122
|
+
--w-color-primary-70: #f5ebe0;
|
|
123
|
+
|
|
124
|
+
--w-color-info: #0ABDE3;
|
|
125
|
+
--w-color-info-accent: #48DBFB;
|
|
126
|
+
--w-color-info-fg: #000;
|
|
127
|
+
--w-color-success: #10AC84;
|
|
128
|
+
--w-color-success-accent: #1DD1A1;
|
|
129
|
+
--w-color-success-fg: #000;
|
|
130
|
+
--w-color-warning: #FF9F43;
|
|
131
|
+
--w-color-warning-accent: #f7AA61;
|
|
132
|
+
--w-color-warning-fg: #000;
|
|
133
|
+
--w-color-alert: #E73F40;
|
|
134
|
+
--w-color-alert-accent: #EE5253;
|
|
135
|
+
--w-color-alert-fg: #FFF;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
package/scss/global/tooltip.scss
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
opacity: 0;
|
|
12
12
|
left: 50%;
|
|
13
13
|
transform: translate(-50%, 5px);
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
z-index: 99;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
&::before {
|
|
@@ -21,7 +23,7 @@
|
|
|
21
23
|
background: var(--w-tooltip-background);
|
|
22
24
|
color: var(--w-tooltip-color);
|
|
23
25
|
padding: 0 5px;
|
|
24
|
-
|
|
26
|
+
bottom: calc(100% + 5px);
|
|
25
27
|
width: max-content;
|
|
26
28
|
line-height: 1.8;
|
|
27
29
|
max-width: 300px;
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
&:hover::before,
|
|
42
44
|
&:hover::after {
|
|
43
45
|
opacity: 1;
|
|
46
|
+
pointer-events: all;
|
|
44
47
|
transform: translate(-50%, 0);
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -51,8 +54,8 @@
|
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
&::before {
|
|
54
|
-
top:
|
|
55
|
-
bottom:
|
|
57
|
+
top: calc(100% + 5px);
|
|
58
|
+
bottom: auto;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
&::after {
|
|
@@ -79,7 +82,7 @@
|
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
&::before {
|
|
82
|
-
|
|
85
|
+
bottom: auto;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
&::after {
|
|
@@ -108,7 +111,7 @@
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
&::before {
|
|
111
|
-
|
|
114
|
+
bottom: auto;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
&::after {
|
package/scss/global/utility.scss
CHANGED
|
@@ -10,19 +10,48 @@
|
|
|
10
10
|
.grid {
|
|
11
11
|
display: grid;
|
|
12
12
|
gap: 20px;
|
|
13
|
+
|
|
14
|
+
&.col-2 {
|
|
15
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
.flex {
|
|
16
20
|
display: flex;
|
|
17
21
|
gap: 20px;
|
|
18
22
|
|
|
23
|
+
&.column {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
&.xs {
|
|
20
28
|
gap: 5px;
|
|
21
29
|
}
|
|
22
30
|
|
|
31
|
+
&.sm {
|
|
32
|
+
gap: 10px;
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
&.wrap {
|
|
24
36
|
flex-wrap: wrap;
|
|
25
37
|
}
|
|
38
|
+
|
|
39
|
+
&.center {
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.justify-center {
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.items-center {
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.items-start {
|
|
53
|
+
align-items: flex-start;
|
|
54
|
+
}
|
|
26
55
|
}
|
|
27
56
|
|
|
28
57
|
.my {
|
package/scss/global.scss
CHANGED
package/scss/resets.scss
CHANGED
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
body {
|
|
23
|
-
background:
|
|
24
|
-
color:
|
|
23
|
+
background: var(--w-color-primary-70);
|
|
24
|
+
color: var(--w-color-primary);
|
|
25
25
|
margin: 0;
|
|
26
26
|
font-size: 18px;
|
|
27
|
-
font-family: Regular, sans-serif;
|
|
27
|
+
font-family: Regular, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
h1,
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
h5,
|
|
35
35
|
h6,
|
|
36
36
|
strong {
|
|
37
|
-
font-family: Bold, sans-serif;
|
|
37
|
+
font-family: Bold, 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
a {
|
|
41
|
-
color:
|
|
41
|
+
color: var(--w-color-primary);
|
|
42
42
|
text-decoration: none;
|
|
43
43
|
}
|
|
44
44
|
|
package/scss/setup.scss
CHANGED
|
@@ -4,32 +4,37 @@ $config: (
|
|
|
4
4
|
includeResets: true,
|
|
5
5
|
includeHelperClasses: true,
|
|
6
6
|
includeElementStyles: true,
|
|
7
|
-
includeTooltip: true
|
|
7
|
+
includeTooltip: true,
|
|
8
|
+
includeScrollbarStyles: true
|
|
8
9
|
);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
--w-avatar-border:
|
|
12
|
-
--w-
|
|
13
|
-
--w-
|
|
11
|
+
body {
|
|
12
|
+
--w-avatar-border: var(--w-color-primary-70);
|
|
13
|
+
--w-checkbox-color: var(--w-color-primary);
|
|
14
|
+
--w-progress-color: var(--w-color-primary);
|
|
15
|
+
--w-progress-background: var(--w-color-primary-50);
|
|
16
|
+
--w-progress-stripe-light: var(--w-color-primary);
|
|
17
|
+
--w-progress-stripe-dark: var(--w-color-primary-10);
|
|
18
|
+
--w-radio-color: var(--w-color-primary);
|
|
19
|
+
--w-rating-color: var(--w-color-primary);
|
|
20
|
+
--w-rating-empty-color: var(--w-color-primary);
|
|
21
|
+
--w-rating-empty-background: var(--w-color-primary-70);
|
|
14
22
|
--w-rating-size: 18px;
|
|
15
|
-
--w-
|
|
16
|
-
--w-
|
|
17
|
-
--w-
|
|
18
|
-
--w-radio-color: #FFF;
|
|
19
|
-
--w-spinner-color: #FFF;
|
|
23
|
+
--w-scrollbar-bg: var(--w-color-primary-60);
|
|
24
|
+
--w-scrollbar-fg: var(--w-color-primary-50);
|
|
25
|
+
--w-spinner-color: var(--w-color-primary);
|
|
20
26
|
--w-spinner-width: 2px;
|
|
21
27
|
--w-spinner-speed: 2s;
|
|
22
28
|
--w-spinner-size: 30px;
|
|
23
29
|
--w-spinner-dash: 8;
|
|
24
|
-
--w-
|
|
25
|
-
--w-
|
|
26
|
-
--w-
|
|
27
|
-
--w-timeline-
|
|
30
|
+
--w-switch-off-color: var(--w-color-primary-50);
|
|
31
|
+
--w-switch-on-color: var(--w-color-primary);
|
|
32
|
+
--w-theme-switcher-size: 20px;
|
|
33
|
+
--w-timeline-color: var(--w-color-primary-50);
|
|
34
|
+
--w-timeline-text-color: var(--w-color-primary);
|
|
28
35
|
--w-timeline-counter: decimal;
|
|
29
|
-
--w-
|
|
30
|
-
--w-
|
|
31
|
-
--w-progress-stripe-light: #FFF;
|
|
32
|
-
--w-progress-stripe-dark: #DDD;
|
|
36
|
+
--w-tooltip-background: var(--w-color-primary);
|
|
37
|
+
--w-tooltip-color: var(--w-color-primary-70);
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
@function config($key) {
|
|
@@ -51,7 +56,23 @@ $config: (
|
|
|
51
56
|
@include Elements();
|
|
52
57
|
}
|
|
53
58
|
|
|
59
|
+
@if (config('includeScrollbarStyles')) {
|
|
60
|
+
@include Scrollbar();
|
|
61
|
+
}
|
|
62
|
+
|
|
54
63
|
@if (config('includeTooltip')) {
|
|
55
64
|
@include Tooltip();
|
|
56
65
|
}
|
|
66
|
+
|
|
67
|
+
@if (config('theme')) {
|
|
68
|
+
@include Theme(config('theme'));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@if (config('themes')) {
|
|
72
|
+
@each $theme, $selector in config('themes') {
|
|
73
|
+
@include Theme($theme, $selector);
|
|
74
|
+
}
|
|
75
|
+
} @else if (not config('theme')) {
|
|
76
|
+
@include Theme('dark');
|
|
77
|
+
}
|
|
57
78
|
}
|
package/svelte.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { AccordionProps } from './components/Accordion/accordion'
|
|
2
2
|
import type { AlertProps } from './components/Alert/alert'
|
|
3
3
|
import type { AvatarProps } from './components/Avatar/avatar'
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { SvelteBadgeProps } from './components/Badge/badge'
|
|
5
|
+
import type { SvelteButtonProps } from './components/Button/button'
|
|
6
6
|
import type { CardProps } from './components/Card/card'
|
|
7
|
-
import type {
|
|
7
|
+
import type { SvelteCheckboxProps } from './components/Checkbox/checkbox'
|
|
8
8
|
import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
|
|
9
9
|
import type { IconProps } from './components/Icon/icon'
|
|
10
|
+
import type { SvelteInputProps } from './components/Input/input'
|
|
11
|
+
import type { MenuProps } from './components/Menu/menu'
|
|
10
12
|
import type { ProgressProps } from './components/Progress/progress'
|
|
11
|
-
import type {
|
|
13
|
+
import type { SvelteRadioProps } from './components/Radio/radio'
|
|
12
14
|
import type { RatingProps } from './components/Rating/rating'
|
|
13
15
|
import type { SpinnerProps } from './components/Spinner/spinner'
|
|
14
|
-
import type {
|
|
16
|
+
import type { SvelteSwitchProps } from './components/Switch/switch'
|
|
17
|
+
import type { TableProps } from './components/Table/table'
|
|
15
18
|
import type { TabsProps } from './components/Tabs/tabs'
|
|
19
|
+
import type { ThemeSwitcherProps } from './components/ThemeSwitcher/themeswitcher'
|
|
16
20
|
import type { TimelineProps } from './components/Timeline/timeline'
|
|
17
21
|
import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
|
|
18
22
|
import type { ToastProps } from './components/Toast/toast'
|
|
@@ -21,18 +25,22 @@ declare module 'webcoreui/svelte' {
|
|
|
21
25
|
export function Accordion(_props: AccordionProps): any
|
|
22
26
|
export function Alert(_props: AlertProps): any
|
|
23
27
|
export function Avatar(_props: AvatarProps): any
|
|
24
|
-
export function Badge(_props:
|
|
25
|
-
export function Button(_props:
|
|
28
|
+
export function Badge(_props: SvelteBadgeProps): any
|
|
29
|
+
export function Button(_props: SvelteButtonProps): any
|
|
26
30
|
export function Card(_props: CardProps): any
|
|
27
|
-
export function Checkbox(_props:
|
|
31
|
+
export function Checkbox(_props: SvelteCheckboxProps): any
|
|
28
32
|
export function ConditionalWrapper(_props: ConditionalWrapperProps): any
|
|
29
33
|
export function Icon(_props: IconProps): any
|
|
34
|
+
export function Input(_props: SvelteInputProps): any
|
|
35
|
+
export function Menu(_props: MenuProps): any
|
|
30
36
|
export function Progress(_props: ProgressProps): any
|
|
31
|
-
export function Radio(_props:
|
|
37
|
+
export function Radio(_props: SvelteRadioProps): any
|
|
32
38
|
export function Rating(_props: RatingProps): any
|
|
33
39
|
export function Spinner(_props: SpinnerProps): any
|
|
34
|
-
export function Switch(_props:
|
|
40
|
+
export function Switch(_props: SvelteSwitchProps): any
|
|
41
|
+
export function Table(_props: TableProps): any
|
|
35
42
|
export function Tabs(_props: TabsProps): any
|
|
43
|
+
export function ThemeSwitcher(_props: ThemeSwitcherProps): any
|
|
36
44
|
export function Timeline(_props: TimelineProps): any
|
|
37
45
|
export function TimelineItem(_props: TimelineItemProps): any
|
|
38
46
|
export function Toast(_props: ToastProps): any
|
package/svelte.js
CHANGED
|
@@ -7,12 +7,16 @@ import CardComponent from './components/Card/Card.svelte'
|
|
|
7
7
|
import CheckboxComponent from './components/Checkbox/Checkbox.svelte'
|
|
8
8
|
import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.svelte'
|
|
9
9
|
import IconComponent from './components/Icon/Icon.svelte'
|
|
10
|
+
import InputComponent from './components/Input/Input.svelte'
|
|
11
|
+
import MenuComponent from './components/Menu/Menu.svelte'
|
|
10
12
|
import ProgressComponent from './components/Progress/Progress.svelte'
|
|
11
13
|
import RadioComponent from './components/Radio/Radio.svelte'
|
|
12
14
|
import RatingComponent from './components/Rating/Rating.svelte'
|
|
13
15
|
import SpinnerComponent from './components/Spinner/Spinner.svelte'
|
|
14
16
|
import SwitchComponent from './components/Switch/Switch.svelte'
|
|
17
|
+
import TableComponent from './components/Table/Table.svelte'
|
|
15
18
|
import TabsComponent from './components/Tabs/Tabs.svelte'
|
|
19
|
+
import ThemeSwitcherComponent from './components/ThemeSwitcher/ThemeSwitcher.svelte'
|
|
16
20
|
import TimelineComponent from './components/Timeline/Timeline.svelte'
|
|
17
21
|
import TimelineItemComponent from './components/TimelineItem/TimelineItem.svelte'
|
|
18
22
|
import ToastComponent from './components/Toast/Toast.svelte'
|
|
@@ -26,12 +30,16 @@ export const Card = CardComponent
|
|
|
26
30
|
export const Checkbox = CheckboxComponent
|
|
27
31
|
export const ConditionalWrapper = ConditionalWrapperComponent
|
|
28
32
|
export const Icon = IconComponent
|
|
33
|
+
export const Input = InputComponent
|
|
34
|
+
export const Menu = MenuComponent
|
|
29
35
|
export const Progress = ProgressComponent
|
|
30
36
|
export const Radio = RadioComponent
|
|
31
37
|
export const Rating = RatingComponent
|
|
32
38
|
export const Spinner = SpinnerComponent
|
|
33
39
|
export const Switch = SwitchComponent
|
|
40
|
+
export const Table = TableComponent
|
|
34
41
|
export const Tabs = TabsComponent
|
|
42
|
+
export const ThemeSwitcher = ThemeSwitcherComponent
|
|
35
43
|
export const Timeline = TimelineComponent
|
|
36
44
|
export const TimelineItem = TimelineItemComponent
|
|
37
45
|
export const Toast = ToastComponent
|
package/utils/cookies.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const setCookie = (name: string, value: string, days: number) => {
|
|
2
|
+
let expires = ''
|
|
3
|
+
|
|
4
|
+
if (days) {
|
|
5
|
+
const date = new Date()
|
|
6
|
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
|
|
7
|
+
expires = '; expires=' + date.toUTCString()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const getCookie = (name: string) => {
|
|
14
|
+
const cookies = document.cookie.split(';')
|
|
15
|
+
|
|
16
|
+
for (const cookie of cookies) {
|
|
17
|
+
if (cookie.indexOf(name + '=') > -1) {
|
|
18
|
+
return cookie.split('=')[1]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const removeCookie = (name: string) => {
|
|
26
|
+
document.cookie = name + '=; Max-Age=-1;'
|
|
27
|
+
}
|
|
28
|
+
|
package/utils/event.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const dispatch = (event: string, detail: any) => {
|
|
2
|
+
document.dispatchEvent(new CustomEvent(event, {
|
|
3
|
+
detail
|
|
4
|
+
}))
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const listen = (event: string, callback: (e: any) => any) => {
|
|
8
|
+
const fn = (e: any) => callback(e.detail)
|
|
9
|
+
|
|
10
|
+
document.addEventListener(event, fn)
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
remove() {
|
|
14
|
+
document.removeEventListener(event, fn)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/utils/toast.ts
CHANGED
|
@@ -26,40 +26,43 @@ export const toast = (config: Toast | string) => {
|
|
|
26
26
|
position
|
|
27
27
|
} = (typeof config === 'string' ? {} : config) as Toast
|
|
28
28
|
|
|
29
|
-
const htmlElement = document.querySelector(element)
|
|
29
|
+
const htmlElement = document.querySelector(element) as HTMLElement
|
|
30
30
|
|
|
31
31
|
if (htmlElement) {
|
|
32
32
|
if (theme) {
|
|
33
|
-
htmlElement.
|
|
33
|
+
htmlElement.dataset.theme = theme
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (position) {
|
|
37
|
-
htmlElement.
|
|
37
|
+
htmlElement.dataset.position = position
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (title) {
|
|
41
|
-
const titleElement = htmlElement.querySelector('
|
|
41
|
+
const titleElement = htmlElement.querySelector('[data-id="title"]')
|
|
42
42
|
|
|
43
43
|
titleElement ? titleElement.innerHTML = title : null
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (content) {
|
|
47
|
-
const contentElement = htmlElement.querySelector('
|
|
47
|
+
const contentElement = htmlElement.querySelector('[data-id="body"]')
|
|
48
48
|
|
|
49
49
|
contentElement ? contentElement.innerHTML = content : null
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
setTimeout(() => {
|
|
53
|
-
htmlElement.
|
|
54
|
-
htmlElement.classList.add('show')
|
|
53
|
+
htmlElement.dataset.show = 'true'
|
|
55
54
|
}, 0)
|
|
56
55
|
|
|
57
56
|
setTimeout(() => {
|
|
58
|
-
htmlElement.
|
|
57
|
+
htmlElement.dataset.show = ''
|
|
59
58
|
}, timeout || defaultTimeout)
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
export const hideToast = (element: string) => {
|
|
64
|
-
document.querySelector(element)
|
|
63
|
+
const htmlElement = document.querySelector(element) as HTMLElement
|
|
64
|
+
|
|
65
|
+
if (htmlElement) {
|
|
66
|
+
htmlElement.dataset.show = ''
|
|
67
|
+
}
|
|
65
68
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
@import '../../scss/config.scss';
|
|
2
|
-
|
|
3
|
-
.w-alert {
|
|
4
|
-
border: 1px solid #252525;
|
|
5
|
-
border-radius: 5px;
|
|
6
|
-
padding: 15px;
|
|
7
|
-
display: flex;
|
|
8
|
-
|
|
9
|
-
&.col {
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
&:not(.col) {
|
|
14
|
-
gap: 10px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&.info {
|
|
18
|
-
border: 1px solid #0abde3;
|
|
19
|
-
color: #0abde3;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.success {
|
|
23
|
-
border: 1px solid #1dd1a1;
|
|
24
|
-
color: #1dd1a1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&.warning {
|
|
28
|
-
border: 1px solid #ff9f43;
|
|
29
|
-
color: #ff9f43;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&.alert {
|
|
33
|
-
border: 1px solid #e73f40;
|
|
34
|
-
color: #e73f40;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
svg {
|
|
38
|
-
width: 20px;
|
|
39
|
-
height: 20px;
|
|
40
|
-
margin-top: 1px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.alert-title {
|
|
44
|
-
display: block;
|
|
45
|
-
margin-bottom: 5px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.alert-body {
|
|
49
|
-
font-size: 16px;
|
|
50
|
-
color: #BBB;
|
|
51
|
-
line-height: 1.5;
|
|
52
|
-
}
|
|
53
|
-
}
|