webcoreui 1.3.0 → 1.5.0-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.
- package/README.md +21 -4
- package/astro.d.ts +6 -0
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +1 -0
- package/components/Accordion/Accordion.svelte +3 -3
- package/components/Accordion/Accordion.tsx +1 -1
- package/components/Accordion/accordion.ts +1 -0
- package/components/Alert/Alert.svelte +3 -3
- package/components/AspectRatio/AspectRatio.svelte +22 -22
- package/components/Avatar/Avatar.astro +4 -2
- package/components/Avatar/Avatar.svelte +10 -8
- package/components/Avatar/Avatar.tsx +4 -2
- package/components/Avatar/avatar.module.scss +3 -5
- package/components/Badge/Badge.svelte +2 -2
- package/components/Badge/badge.module.scss +5 -6
- package/components/Banner/Banner.svelte +4 -3
- package/components/Banner/banner.module.scss +4 -6
- package/components/BottomNavigation/BottomNavigation.svelte +4 -3
- package/components/BottomNavigation/bottomnavigation.module.scss +68 -70
- package/components/Breadcrumb/Breadcrumb.svelte +2 -2
- package/components/Button/Button.svelte +2 -2
- package/components/Button/button.module.scss +9 -12
- package/components/Card/Card.svelte +4 -4
- package/components/Card/card.module.scss +3 -7
- package/components/Carousel/Carousel.astro +2 -2
- package/components/Carousel/Carousel.svelte +16 -16
- package/components/Carousel/Carousel.tsx +2 -2
- package/components/Carousel/carousel.module.scss +3 -5
- package/components/Checkbox/Checkbox.svelte +6 -3
- package/components/Checkbox/Checkbox.tsx +0 -2
- package/components/Checkbox/checkbox.module.scss +4 -6
- package/components/Checkbox/checkbox.ts +3 -1
- package/components/Collapsible/Collapsible.svelte +4 -4
- package/components/Collapsible/collapsible.module.scss +5 -5
- package/components/Collapsible/collapsible.ts +1 -1
- package/components/ContextMenu/ContextMenu.svelte +8 -6
- package/components/Copy/Copy.svelte +2 -2
- package/components/Counter/Counter.svelte +6 -5
- package/components/Counter/counter.module.scss +3 -5
- package/components/DataTable/DataTable.astro +4 -4
- package/components/DataTable/DataTable.svelte +16 -14
- package/components/DataTable/DataTable.tsx +1 -1
- package/components/Flex/Flex.svelte +4 -4
- package/components/Footer/Footer.svelte +6 -6
- package/components/Grid/Grid.svelte +4 -4
- package/components/Group/Group.svelte +2 -2
- package/components/Icon/Icon.svelte +13 -8
- package/components/Image/Image.astro +45 -0
- package/components/Image/Image.svelte +51 -0
- package/components/Image/Image.tsx +52 -0
- package/components/Image/image.module.scss +47 -0
- package/components/Image/image.ts +13 -0
- package/components/ImageLoader/ImageLoader.astro +82 -0
- package/components/ImageLoader/ImageLoader.svelte +72 -0
- package/components/ImageLoader/ImageLoader.tsx +82 -0
- package/components/ImageLoader/imageloader.module.scss +13 -0
- package/components/ImageLoader/imageloader.ts +6 -0
- package/components/Input/Input.svelte +5 -5
- package/components/Input/input.ts +2 -2
- package/components/Kbd/Kbd.svelte +2 -2
- package/components/List/List.svelte +7 -7
- package/components/List/List.tsx +2 -2
- package/components/Masonry/Masonry.svelte +7 -7
- package/components/Masonry/masonry.module.scss +4 -6
- package/components/Menu/Menu.svelte +6 -5
- package/components/Modal/Modal.svelte +4 -4
- package/components/Modal/modal.module.scss +5 -5
- package/components/OTPInput/OTPInput.svelte +4 -4
- package/components/OTPInput/otpinput.module.scss +0 -12
- package/components/Pagination/Pagination.svelte +2 -2
- package/components/Popover/Popover.svelte +2 -2
- package/components/Popover/popover.module.scss +4 -2
- package/components/Progress/Progress.svelte +5 -5
- package/components/Progress/progress.module.scss +15 -17
- package/components/Radio/Radio.astro +1 -0
- package/components/Radio/Radio.svelte +5 -3
- package/components/Radio/Radio.tsx +1 -0
- package/components/Radio/radio.module.scss +4 -6
- package/components/Radio/radio.ts +1 -0
- package/components/RangeSlider/RangeSlider.astro +4 -1
- package/components/RangeSlider/RangeSlider.svelte +17 -36
- package/components/RangeSlider/RangeSlider.tsx +5 -2
- package/components/RangeSlider/rangeslider.module.scss +14 -16
- package/components/RangeSlider/rangeslider.ts +1 -0
- package/components/Rating/Rating.svelte +7 -6
- package/components/Rating/rating.module.scss +13 -15
- package/components/Ribbon/Ribbon.svelte +2 -2
- package/components/Ribbon/ribbon.module.scss +9 -11
- package/components/Select/Select.astro +2 -0
- package/components/Select/Select.svelte +175 -172
- package/components/Select/Select.tsx +2 -0
- package/components/Select/select.ts +1 -0
- package/components/Sheet/Sheet.svelte +2 -2
- package/components/Sidebar/Sidebar.svelte +2 -2
- package/components/Skeleton/Skeleton.svelte +4 -4
- package/components/Skeleton/skeleton.module.scss +6 -9
- package/components/Slider/Slider.astro +6 -4
- package/components/Slider/Slider.svelte +10 -8
- package/components/Slider/Slider.tsx +6 -4
- package/components/Slider/slider.module.scss +12 -14
- package/components/Slider/slider.ts +3 -2
- package/components/SpeedDial/SpeedDial.svelte +3 -3
- package/components/SpeedDial/SpeedDial.tsx +1 -1
- package/components/SpeedDial/speeddial.module.scss +4 -6
- package/components/Spinner/Spinner.svelte +4 -4
- package/components/Spinner/spinner.module.scss +13 -14
- package/components/Spoiler/Spoiler.svelte +4 -3
- package/components/Spoiler/spoiler.module.scss +3 -5
- package/components/Stepper/Stepper.svelte +4 -4
- package/components/Stepper/stepper.defaults.scss +5 -0
- package/components/Stepper/stepper.module.scss +11 -13
- package/components/Switch/Switch.svelte +6 -4
- package/components/Switch/Switch.tsx +0 -2
- package/components/Switch/switch.module.scss +6 -7
- package/components/Switch/switch.ts +3 -1
- package/components/Table/Table.svelte +2 -2
- package/components/Tabs/Tabs.svelte +2 -2
- package/components/Textarea/Textarea.svelte +5 -3
- package/components/Textarea/textarea.ts +7 -6
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +5 -5
- package/components/ThemeSwitcher/themeswitcher.module.scss +11 -12
- package/components/ThemeSwitcher/themeswitcher.ts +1 -0
- package/components/Timeline/Timeline.svelte +4 -4
- package/components/Timeline/timeline.module.scss +6 -8
- package/components/TimelineItem/TimelineItem.svelte +2 -2
- package/components/TimelineItem/timelineitem.module.scss +4 -4
- package/components/Toast/Toast.svelte +4 -4
- package/index.d.ts +12 -5
- package/package.json +22 -22
- package/react.d.ts +6 -0
- package/react.js +4 -0
- package/scss/config/functions.scss +41 -0
- package/scss/config/mixins.scss +65 -0
- package/scss/config.scss +1 -0
- package/scss/global/theme.scss +209 -194
- package/scss/resets.scss +2 -0
- package/scss/setup.scss +6 -3
- package/svelte.d.ts +6 -0
- package/svelte.js +4 -0
- package/utils/DOMUtils.ts +3 -3
- package/utils/modal.ts +2 -2
- package/utils/popover.ts +87 -46
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import styles from './slider.module.scss'
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
|
-
min,
|
|
10
|
-
max,
|
|
11
|
-
value,
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
11
|
+
value = 0,
|
|
12
12
|
step,
|
|
13
13
|
disabled,
|
|
14
14
|
color,
|
|
@@ -16,19 +16,20 @@
|
|
|
16
16
|
thumb,
|
|
17
17
|
id,
|
|
18
18
|
className,
|
|
19
|
-
onChange
|
|
19
|
+
onChange,
|
|
20
|
+
...rest
|
|
20
21
|
}: SvelteSliderProps = $props()
|
|
21
22
|
|
|
22
|
-
const classes = classNames([
|
|
23
|
+
const classes = $derived(classNames([
|
|
23
24
|
styles.slider,
|
|
24
25
|
className
|
|
25
|
-
])
|
|
26
|
+
]))
|
|
26
27
|
|
|
27
|
-
const styleVariables = classNames([
|
|
28
|
+
const styleVariables = $derived(classNames([
|
|
28
29
|
color && `--w-slider-color: ${color};`,
|
|
29
30
|
background && `--w-slider-background: ${background};`,
|
|
30
31
|
thumb && `--w-slider-thumb: ${thumb};`
|
|
31
|
-
])
|
|
32
|
+
]))
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
35
|
<input
|
|
@@ -42,4 +43,5 @@
|
|
|
42
43
|
id={id}
|
|
43
44
|
style={styleVariables || null}
|
|
44
45
|
onchange={onChange}
|
|
46
|
+
{...rest}
|
|
45
47
|
/>
|
|
@@ -6,9 +6,9 @@ import { classNames } from '../../utils/classNames'
|
|
|
6
6
|
import styles from './slider.module.scss'
|
|
7
7
|
|
|
8
8
|
const Slider = ({
|
|
9
|
-
min,
|
|
10
|
-
max,
|
|
11
|
-
value,
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
11
|
+
value = 0,
|
|
12
12
|
step,
|
|
13
13
|
disabled,
|
|
14
14
|
color,
|
|
@@ -16,7 +16,8 @@ const Slider = ({
|
|
|
16
16
|
thumb,
|
|
17
17
|
id,
|
|
18
18
|
className,
|
|
19
|
-
onChange
|
|
19
|
+
onChange,
|
|
20
|
+
...rest
|
|
20
21
|
}: ReactSliderProps) => {
|
|
21
22
|
const classes = classNames([
|
|
22
23
|
styles.slider,
|
|
@@ -41,6 +42,7 @@ const Slider = ({
|
|
|
41
42
|
id={id}
|
|
42
43
|
style={styleVariables}
|
|
43
44
|
onChange={onChange}
|
|
45
|
+
{...rest}
|
|
44
46
|
/>
|
|
45
47
|
|
|
46
48
|
)
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-slider-background: var(--w-color-primary-50);
|
|
5
|
-
--w-slider-color: var(--w-color-primary);
|
|
6
|
-
--w-slider-thumb: var(--w-color-primary-50);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
3
|
.slider {
|
|
4
|
+
--bg: var(--w-slider-background, var(--w-color-primary-50));
|
|
5
|
+
--color: var(--w-slider-color, var(--w-color-primary));
|
|
6
|
+
--thumb: var(--w-slider-thumb, var(--w-color-primary-50));
|
|
7
|
+
|
|
10
8
|
@include border-radius(xl);
|
|
11
9
|
@include size('w100%');
|
|
12
10
|
@include visibility(hidden);
|
|
@@ -43,30 +41,30 @@ body {
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
.slider::-webkit-slider-runnable-track {
|
|
46
|
-
@include background(var(--
|
|
44
|
+
@include background(var(--bg));
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
.slider::-moz-range-track {
|
|
50
|
-
@include background(var(--
|
|
48
|
+
@include background(var(--bg));
|
|
51
49
|
@include size(h10px);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
.slider::-webkit-slider-thumb {
|
|
55
|
-
@include background(var(--
|
|
53
|
+
@include background(var(--thumb));
|
|
56
54
|
@include size(10px);
|
|
57
55
|
@include border-radius(max);
|
|
58
|
-
@include border(var(--
|
|
56
|
+
@include border(var(--color));
|
|
59
57
|
|
|
60
58
|
-webkit-appearance: none;
|
|
61
59
|
appearance: none;
|
|
62
|
-
box-shadow: -995px 0 0 990px var(--
|
|
60
|
+
box-shadow: -995px 0 0 990px var(--color);
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
.slider::-moz-range-thumb {
|
|
66
|
-
@include background(var(--
|
|
64
|
+
@include background(var(--thumb));
|
|
67
65
|
@include size(9px);
|
|
68
66
|
@include border-radius(max);
|
|
69
|
-
@include border(var(--
|
|
67
|
+
@include border(var(--color));
|
|
70
68
|
|
|
71
|
-
box-shadow: -995px 0 0 990px var(--
|
|
69
|
+
box-shadow: -995px 0 0 990px var(--color);
|
|
72
70
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { InputTarget } from '../Input/input'
|
|
2
2
|
|
|
3
3
|
export type SliderProps = {
|
|
4
|
-
min
|
|
5
|
-
max
|
|
4
|
+
min?: number
|
|
5
|
+
max?: number
|
|
6
6
|
value?: number
|
|
7
7
|
step?: number
|
|
8
8
|
disabled?: boolean
|
|
9
|
+
required?: boolean
|
|
9
10
|
color?: string
|
|
10
11
|
background?: string
|
|
11
12
|
thumb?: string
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
|
|
23
23
|
let show = $state(false)
|
|
24
24
|
|
|
25
|
-
const classes = classNames([
|
|
25
|
+
const classes = $derived(classNames([
|
|
26
26
|
styles.dial,
|
|
27
27
|
position && styles[position],
|
|
28
28
|
horizontal && styles.horizontal,
|
|
29
29
|
circular && styles.circular,
|
|
30
30
|
className
|
|
31
|
-
])
|
|
31
|
+
]))
|
|
32
32
|
|
|
33
33
|
const getTooltipPosition = () => {
|
|
34
34
|
const positionMap = {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
const speedDial = get('[data-id="w-speed-dial"] button') as HTMLButtonElement
|
|
52
52
|
|
|
53
53
|
const eventListener = (event: Event) => {
|
|
54
|
-
if (!speedDial
|
|
54
|
+
if (!speedDial?.contains((event.target || event.currentTarget) as HTMLElement)) {
|
|
55
55
|
show = false
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -51,7 +51,7 @@ const SpeedDial = ({
|
|
|
51
51
|
const speedDial = get('[data-id="w-speed-dial"] button') as HTMLButtonElement
|
|
52
52
|
|
|
53
53
|
const eventListener = (event: Event) => {
|
|
54
|
-
if (!speedDial
|
|
54
|
+
if (!speedDial?.contains((event.target || event.currentTarget) as HTMLElement)) {
|
|
55
55
|
setShow(false)
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-speed-dial-size: 40px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.dial {
|
|
4
|
+
--size: var(--w-speed-dial-size, 40px);
|
|
5
|
+
|
|
8
6
|
@include layout(flex, column-reverse, center, xs);
|
|
9
7
|
@include position(fixed, b20px, r20px);
|
|
10
8
|
|
|
@@ -54,7 +52,7 @@ body {
|
|
|
54
52
|
.trigger {
|
|
55
53
|
@include layout(flex, column);
|
|
56
54
|
@include typography(bold);
|
|
57
|
-
@include size(var(--
|
|
55
|
+
@include size(var(--size));
|
|
58
56
|
|
|
59
57
|
user-select: none;
|
|
60
58
|
|
|
@@ -85,7 +83,7 @@ body {
|
|
|
85
83
|
|
|
86
84
|
.button {
|
|
87
85
|
@include layout(flex, column, xs);
|
|
88
|
-
@include size(var(--
|
|
86
|
+
@include size(var(--size));
|
|
89
87
|
|
|
90
88
|
svg {
|
|
91
89
|
@include size(16px);
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
dashArray
|
|
14
14
|
}: SpinnerProps = $props()
|
|
15
15
|
|
|
16
|
-
const classes = classNames([
|
|
16
|
+
const classes = $derived(classNames([
|
|
17
17
|
styles.spinner,
|
|
18
18
|
dashArray && styles.dashed
|
|
19
|
-
])
|
|
19
|
+
]))
|
|
20
20
|
|
|
21
|
-
const styleVariables = classNames([
|
|
21
|
+
const styleVariables = $derived(classNames([
|
|
22
22
|
color && `--w-spinner-color: ${color};`,
|
|
23
23
|
width && `--w-spinner-width: ${width}px;`,
|
|
24
24
|
speed && `--w-spinner-speed: ${speed}s;`,
|
|
25
25
|
size && `--w-spinner-size: ${size}px;`,
|
|
26
26
|
dashArray && `--w-spinner-dash: ${dashArray}`
|
|
27
|
-
])
|
|
27
|
+
]))
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
30
|
<svg
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
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
|
-
}
|
|
10
|
-
|
|
11
3
|
.spinner {
|
|
4
|
+
--color: var(--w-spinner-color, var(--w-color-primary));
|
|
5
|
+
--width: var(--w-spinner-width, 2px);
|
|
6
|
+
--speed: var(--w-spinner-speed, 2s);
|
|
7
|
+
--size: var(--w-spinner-size, 30px);
|
|
8
|
+
--dash: var(--w-spinner-dash, 8);
|
|
9
|
+
|
|
12
10
|
@include spacing(auto-none);
|
|
13
11
|
|
|
14
|
-
width: var(--
|
|
15
|
-
height: var(--
|
|
16
|
-
animation: rotate var(--
|
|
12
|
+
width: var(--size);
|
|
13
|
+
height: var(--size);
|
|
14
|
+
animation: rotate var(--speed) linear infinite;
|
|
17
15
|
|
|
18
16
|
&.dashed .path {
|
|
19
|
-
stroke-dasharray: var(--
|
|
17
|
+
stroke-dasharray: var(--dash);
|
|
20
18
|
animation: none;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.path {
|
|
24
|
-
stroke: var(--
|
|
25
|
-
stroke-width: var(--
|
|
22
|
+
stroke: var(--color);
|
|
23
|
+
stroke-width: var(--width);
|
|
26
24
|
animation: dash 1.5s ease-in-out infinite;
|
|
27
25
|
stroke-linecap: round;
|
|
28
26
|
}
|
|
@@ -48,3 +46,4 @@ body {
|
|
|
48
46
|
stroke-dashoffset: -124;
|
|
49
47
|
}
|
|
50
48
|
}
|
|
49
|
+
|
|
@@ -14,15 +14,16 @@
|
|
|
14
14
|
children
|
|
15
15
|
}: SvelteSpoilerProps = $props()
|
|
16
16
|
|
|
17
|
-
const classes = classNames([
|
|
17
|
+
const classes = $derived(classNames([
|
|
18
18
|
styles.spoiler,
|
|
19
19
|
animated && styles.anim,
|
|
20
20
|
block && styles.block
|
|
21
|
-
])
|
|
21
|
+
]))
|
|
22
22
|
|
|
23
|
-
const style = color
|
|
23
|
+
const style = $derived(color
|
|
24
24
|
? `--w-spoiler-color: ${color};`
|
|
25
25
|
: null
|
|
26
|
+
)
|
|
26
27
|
|
|
27
28
|
const toggle = (event: MouseEvent | KeyboardEvent) => {
|
|
28
29
|
const target = event.currentTarget as HTMLSpanElement
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-spoiler-color: var(--w-color-primary);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
span.spoiler {
|
|
4
|
+
--color: var(--w-spoiler-color, var(--w-color-primary));
|
|
5
|
+
|
|
8
6
|
@include border-radius();
|
|
9
|
-
@include background(var(--
|
|
7
|
+
@include background(var(--color));
|
|
10
8
|
@include typography(hmd);
|
|
11
9
|
@include visibility(inline);
|
|
12
10
|
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
className
|
|
18
18
|
}: StepperProps = $props()
|
|
19
19
|
|
|
20
|
-
const classes = classNames([
|
|
20
|
+
const classes = $derived(classNames([
|
|
21
21
|
styles.stepper,
|
|
22
22
|
borderless && styles.borderless,
|
|
23
23
|
vertical && styles.vertical,
|
|
24
24
|
className
|
|
25
|
-
])
|
|
25
|
+
]))
|
|
26
26
|
|
|
27
|
-
const styleVariables = [
|
|
27
|
+
const styleVariables = $derived([
|
|
28
28
|
color && `--w-stepper-color-border: ${color}`,
|
|
29
29
|
completedColor && `--w-stepper-color-complete: ${completedColor}`,
|
|
30
30
|
activeColor && `--w-stepper-color-active: ${activeColor}`
|
|
31
|
-
].filter(Boolean).join(';')
|
|
31
|
+
].filter(Boolean).join(';'))
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<ol class={classes} style={styleVariables || null}>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-stepper-color-border: var(--w-color-primary-50);
|
|
5
|
-
--w-stepper-color-active: var(--w-color-info);
|
|
6
|
-
--w-stepper-color-complete: var(--w-color-success);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
3
|
$size: 20px;
|
|
10
4
|
|
|
11
5
|
.stepper {
|
|
6
|
+
--border: var(--w-stepper-color-border, var(--w-color-primary-50));
|
|
7
|
+
--active: var(--w-stepper-color-active, var(--w-color-info));
|
|
8
|
+
--complete: var(--w-stepper-color-complete, var(--w-color-success));
|
|
9
|
+
|
|
12
10
|
@include layout(flex, default, column);
|
|
13
11
|
@include spacing(0);
|
|
14
12
|
@include size('w100%');
|
|
@@ -16,7 +14,7 @@ $size: 20px;
|
|
|
16
14
|
list-style-type: none;
|
|
17
15
|
|
|
18
16
|
&:not(.borderless) .number {
|
|
19
|
-
border: 2px solid var(--
|
|
17
|
+
border: 2px solid var(--border);
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
li {
|
|
@@ -31,7 +29,7 @@ $size: 20px;
|
|
|
31
29
|
|
|
32
30
|
&::before {
|
|
33
31
|
@include position(absolute, l16px);
|
|
34
|
-
@include background(var(--
|
|
32
|
+
@include background(var(--border));
|
|
35
33
|
@include size(w2px);
|
|
36
34
|
|
|
37
35
|
top: -50%;
|
|
@@ -42,18 +40,18 @@ $size: 20px;
|
|
|
42
40
|
|
|
43
41
|
&.completed::before,
|
|
44
42
|
&.active::before {
|
|
45
|
-
@include background(var(--
|
|
43
|
+
@include background(var(--complete));
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
&.active .number {
|
|
50
|
-
border-color: var(--
|
|
51
|
-
color: var(--
|
|
48
|
+
border-color: var(--active);
|
|
49
|
+
color: var(--active);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
&.completed .number {
|
|
55
|
-
border-color: var(--
|
|
56
|
-
color: var(--
|
|
53
|
+
border-color: var(--complete);
|
|
54
|
+
color: var(--complete);
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
.number {
|
|
@@ -16,22 +16,23 @@
|
|
|
16
16
|
disabled,
|
|
17
17
|
className,
|
|
18
18
|
onClick,
|
|
19
|
+
onChange,
|
|
19
20
|
...rest
|
|
20
21
|
}: SvelteSwitchProps = $props()
|
|
21
22
|
|
|
22
|
-
const classes = classNames([
|
|
23
|
+
const classes = $derived(classNames([
|
|
23
24
|
styles.switch,
|
|
24
25
|
reverse && styles.reverse,
|
|
25
26
|
small && styles.small,
|
|
26
27
|
square && styles.square,
|
|
27
28
|
disabled && styles.disabled,
|
|
28
29
|
className
|
|
29
|
-
])
|
|
30
|
+
]))
|
|
30
31
|
|
|
31
|
-
const styleVariables = classNames([
|
|
32
|
+
const styleVariables = $derived(classNames([
|
|
32
33
|
offColor && `--w-switch-off-color: ${offColor};`,
|
|
33
34
|
onColor && `--w-switch-on-color: ${onColor};`
|
|
34
|
-
])
|
|
35
|
+
]))
|
|
35
36
|
</script>
|
|
36
37
|
|
|
37
38
|
<label class={classes} style={styleVariables || null}>
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
checked={toggled}
|
|
41
42
|
disabled={disabled}
|
|
42
43
|
onclick={onClick}
|
|
44
|
+
onchange={onChange}
|
|
43
45
|
{...rest}
|
|
44
46
|
/>
|
|
45
47
|
<span class={styles.toggle}></span>
|
|
@@ -15,7 +15,6 @@ const Switch = ({
|
|
|
15
15
|
square,
|
|
16
16
|
disabled,
|
|
17
17
|
className,
|
|
18
|
-
onClick,
|
|
19
18
|
...rest
|
|
20
19
|
}: ReactSwitchProps) => {
|
|
21
20
|
const classes = classNames([
|
|
@@ -38,7 +37,6 @@ const Switch = ({
|
|
|
38
37
|
type="checkbox"
|
|
39
38
|
defaultChecked={toggled}
|
|
40
39
|
disabled={disabled}
|
|
41
|
-
onClick={onClick}
|
|
42
40
|
{...rest}
|
|
43
41
|
/>
|
|
44
42
|
<span className={styles.toggle}></span>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-switch-off-color: var(--w-color-primary-50);
|
|
5
|
-
--w-switch-on-color: var(--w-color-primary);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
.switch {
|
|
4
|
+
--off-color: var(--w-switch-off-color, var(--w-color-primary-50));
|
|
5
|
+
--on-color: var(--w-switch-on-color, var(--w-color-primary));
|
|
6
|
+
|
|
9
7
|
@include layout(inline-flex, v-center, sm);
|
|
10
8
|
cursor: pointer;
|
|
9
|
+
user-select: none;
|
|
11
10
|
|
|
12
11
|
&.reverse {
|
|
13
12
|
@include layout(row-reverse);
|
|
@@ -52,7 +51,7 @@ body {
|
|
|
52
51
|
@include visibility(none);
|
|
53
52
|
|
|
54
53
|
&:checked + span {
|
|
55
|
-
@include background(var(--
|
|
54
|
+
@include background(var(--on-color));
|
|
56
55
|
|
|
57
56
|
&::before {
|
|
58
57
|
transform: translateX(30px);
|
|
@@ -65,7 +64,7 @@ body {
|
|
|
65
64
|
@include position(relative);
|
|
66
65
|
@include size(w60px, h30px);
|
|
67
66
|
@include border-radius(xl);
|
|
68
|
-
@include background(var(--
|
|
67
|
+
@include background(var(--off-color));
|
|
69
68
|
|
|
70
69
|
&::before {
|
|
71
70
|
@include transition(transform);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MouseEventHandler } from 'svelte/elements'
|
|
1
|
+
import type { ChangeEventHandler, MouseEventHandler } from 'svelte/elements'
|
|
2
2
|
|
|
3
3
|
export type SwitchProps = {
|
|
4
4
|
label?: string
|
|
@@ -14,9 +14,11 @@ export type SwitchProps = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type SvelteSwitchProps = {
|
|
17
|
+
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
17
18
|
onClick?: MouseEventHandler<HTMLInputElement>
|
|
18
19
|
} & SwitchProps
|
|
19
20
|
|
|
20
21
|
export type ReactSwitchProps = {
|
|
22
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>
|
|
21
23
|
onClick?: React.MouseEventHandler<HTMLInputElement>
|
|
22
24
|
} & SwitchProps
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
className
|
|
18
18
|
}: TableProps = $props()
|
|
19
19
|
|
|
20
|
-
const classes = classNames([
|
|
20
|
+
const classes = $derived(classNames([
|
|
21
21
|
styles.table,
|
|
22
22
|
hover && styles.hover,
|
|
23
23
|
striped && styles[`striped-${striped}s`],
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
compact && styles.compact,
|
|
26
26
|
maxHeight && styles.scroll,
|
|
27
27
|
className
|
|
28
|
-
])
|
|
28
|
+
]))
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<div class={classes} style={maxHeight ? `max-height:${maxHeight}` : null}>
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
let active = $state('')
|
|
18
18
|
let tabContainer: HTMLDivElement | undefined = $state()
|
|
19
19
|
|
|
20
|
-
const classes = classNames([
|
|
20
|
+
const classes = $derived(classNames([
|
|
21
21
|
styles.tabs,
|
|
22
22
|
theme && styles[theme],
|
|
23
23
|
vertical && styles.vertical,
|
|
24
24
|
even && styles.even,
|
|
25
25
|
className
|
|
26
|
-
])
|
|
26
|
+
]))
|
|
27
27
|
|
|
28
28
|
const setTab = (tab: string) => {
|
|
29
29
|
const tabs = tabContainer!.querySelectorAll('[data-tab]')
|
|
@@ -16,15 +16,16 @@
|
|
|
16
16
|
className,
|
|
17
17
|
onChange,
|
|
18
18
|
onKeyUp,
|
|
19
|
+
onInput,
|
|
19
20
|
...rest
|
|
20
21
|
}: SvelteTextareaProps = $props()
|
|
21
22
|
|
|
22
|
-
const classes = classNames([
|
|
23
|
+
const classes = $derived(classNames([
|
|
23
24
|
styles.textarea,
|
|
24
25
|
className
|
|
25
|
-
])
|
|
26
|
+
]))
|
|
26
27
|
|
|
27
|
-
const useLabel = !!(label || subText)
|
|
28
|
+
const useLabel = $derived(!!(label || subText))
|
|
28
29
|
</script>
|
|
29
30
|
|
|
30
31
|
<ConditionalWrapper
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
placeholder={placeholder}
|
|
40
41
|
disabled={disabled}
|
|
41
42
|
class={classes}
|
|
43
|
+
oninput={onInput}
|
|
42
44
|
onchange={onChange}
|
|
43
45
|
onkeyup={onKeyUp}
|
|
44
46
|
{...rest}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
type
|
|
2
|
-
target: HTMLTextAreaElement
|
|
1
|
+
export type TextareaTarget = {
|
|
3
2
|
currentTarget: HTMLTextAreaElement
|
|
4
3
|
}
|
|
5
4
|
|
|
@@ -14,11 +13,13 @@ export type TextareaProps = {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export type SvelteTextareaProps = {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
onInput?: (event: Event & TextareaTarget) => void
|
|
17
|
+
onChange?: (event: Event & TextareaTarget) => void
|
|
18
|
+
onKeyUp?: (event: KeyboardEvent & TextareaTarget) => void
|
|
19
19
|
} & TextareaProps
|
|
20
20
|
|
|
21
21
|
export type ReactTextareaProps = {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
onInput?: (event: React.InputEvent<HTMLTextAreaElement>) => void
|
|
23
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void
|
|
24
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void
|
|
24
25
|
} & TextareaProps
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
let currentTheme = $state('')
|
|
21
21
|
let toggled = false
|
|
22
22
|
|
|
23
|
-
const classes = classNames([
|
|
23
|
+
const classes = $derived(classNames([
|
|
24
24
|
styles.switcher,
|
|
25
25
|
toggle && styles.toggle,
|
|
26
26
|
className
|
|
27
|
-
])
|
|
27
|
+
]))
|
|
28
28
|
|
|
29
|
-
const primaryTheme = themes[Object.keys(themes)[0]]
|
|
30
|
-
const secondaryTheme = themes[Object.keys(themes)[1]]
|
|
31
|
-
const useIcons = primaryIcon && secondaryIcon
|
|
29
|
+
const primaryTheme = $derived(themes[Object.keys(themes)[0]])
|
|
30
|
+
const secondaryTheme = $derived(themes[Object.keys(themes)[1]])
|
|
31
|
+
const useIcons = $derived(primaryIcon && secondaryIcon)
|
|
32
32
|
|
|
33
33
|
const setTheme = (theme: string | number) => {
|
|
34
34
|
if (typeof theme === 'number') {
|