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
|
@@ -12,14 +12,16 @@
|
|
|
12
12
|
cursor: pointer;
|
|
13
13
|
|
|
14
14
|
&[disabled] {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
@include visibility(.5);
|
|
16
|
+
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
cursor: not-allowed;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
&:hover {
|
|
20
22
|
@include background(primary-20);
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
&.secondary {
|
|
24
26
|
@include typography(primary);
|
|
25
27
|
@include background(primary-50);
|
|
@@ -30,19 +32,14 @@
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
&.outline {
|
|
33
|
-
@include typography(primary
|
|
35
|
+
@include typography(primary);
|
|
34
36
|
@include background(transparent);
|
|
35
|
-
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-
|
|
36
|
-
|
|
37
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-40);
|
|
38
|
+
|
|
37
39
|
&:hover {
|
|
38
|
-
@include
|
|
40
|
+
@include background(primary-60);
|
|
39
41
|
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
&[disabled] {
|
|
43
|
-
@include typography(primary-30);
|
|
44
|
-
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-30);
|
|
45
|
-
}
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
&.flat {
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
...rest
|
|
18
18
|
}: SvelteCardProps = $props()
|
|
19
19
|
|
|
20
|
-
const classes = classNames([
|
|
20
|
+
const classes = $derived(classNames([
|
|
21
21
|
styles.card,
|
|
22
22
|
secondary && styles.secondary,
|
|
23
23
|
className
|
|
24
|
-
])
|
|
24
|
+
]))
|
|
25
25
|
|
|
26
|
-
const bodyClasses = classNames([
|
|
26
|
+
const bodyClasses = $derived(classNames([
|
|
27
27
|
styles.body,
|
|
28
28
|
compact && styles.compact,
|
|
29
29
|
bodyClassName
|
|
30
|
-
])
|
|
30
|
+
]))
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<svelte:element this={element} class={classes} {...rest}>
|
|
@@ -5,19 +5,16 @@
|
|
|
5
5
|
@include border-radius(md);
|
|
6
6
|
@include layout(flex, column);
|
|
7
7
|
@include background(primary-70);
|
|
8
|
+
@include visibility(hidden);
|
|
8
9
|
|
|
9
|
-
&.secondary {
|
|
10
|
+
&.secondary .body {
|
|
10
11
|
@include background(primary-60);
|
|
11
|
-
|
|
12
|
-
.title {
|
|
13
|
-
@include background(primary-70);
|
|
14
|
-
}
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
.title {
|
|
18
15
|
@include spacing(p-default);
|
|
19
16
|
@include border(primary-50, bottom);
|
|
20
|
-
|
|
17
|
+
@include visibility(block);
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
.body {
|
|
@@ -28,7 +25,6 @@
|
|
|
28
25
|
&.compact {
|
|
29
26
|
@include border(20px, primary-60);
|
|
30
27
|
@include spacing(p-3xl);
|
|
31
|
-
@include background(primary-70);
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
}
|
|
@@ -59,7 +59,7 @@ const paginationClasses = classNames([
|
|
|
59
59
|
const totalPages = Math.ceil(items / getItemsPerSlide())
|
|
60
60
|
const subTextValue = subText?.match(/\{0\}|\{1\}/g) ? subText : undefined
|
|
61
61
|
const style = getItemsPerSlide() > 1
|
|
62
|
-
? `--
|
|
62
|
+
? `--width: calc(${100 / getItemsPerSlide()}% - 5px);`
|
|
63
63
|
: null
|
|
64
64
|
---
|
|
65
65
|
|
|
@@ -172,7 +172,7 @@ const style = getItemsPerSlide() > 1
|
|
|
172
172
|
carousel.dataset.currentBreakpoint = breakpoint
|
|
173
173
|
carousel.dataset.visibleItems = itemsPerSlide
|
|
174
174
|
carousel.children[0].scrollIntoView({ behavior: 'smooth', block: 'nearest' })
|
|
175
|
-
carousel.style.setProperty('--
|
|
175
|
+
carousel.style.setProperty('--width', `calc(${100 / itemsPerSlide}% - 5px)`)
|
|
176
176
|
|
|
177
177
|
pagination.dataset.totalPages = String(totalPages)
|
|
178
178
|
|
|
@@ -48,39 +48,39 @@
|
|
|
48
48
|
let progressValue = $state(0)
|
|
49
49
|
let paginated = false
|
|
50
50
|
let currentPage = $state(1)
|
|
51
|
-
let totalPages = $
|
|
51
|
+
let totalPages = $derived(Math.ceil(items / getItemsPerSlide()))
|
|
52
52
|
let style = $state(getItemsPerSlide() > 1
|
|
53
|
-
? `--
|
|
53
|
+
? `--width: calc(${100 / getItemsPerSlide()}% - 5px);`
|
|
54
54
|
: null)
|
|
55
55
|
|
|
56
|
-
const classes = classNames([
|
|
56
|
+
const classes = $derived(classNames([
|
|
57
57
|
styles.carousel,
|
|
58
58
|
className
|
|
59
|
-
])
|
|
59
|
+
]))
|
|
60
60
|
|
|
61
|
-
const containerClasses = classNames([
|
|
61
|
+
const containerClasses = $derived(classNames([
|
|
62
62
|
styles.container,
|
|
63
63
|
scrollSnap && styles.snap
|
|
64
|
-
])
|
|
64
|
+
]))
|
|
65
65
|
|
|
66
|
-
const wrapperClasses = classNames([
|
|
66
|
+
const wrapperClasses = $derived(classNames([
|
|
67
67
|
styles.wrapper,
|
|
68
68
|
effect && styles[effect],
|
|
69
69
|
getItemsPerSlide() > 1 && styles['no-snap'],
|
|
70
70
|
wrapperClassName
|
|
71
|
-
])
|
|
71
|
+
]))
|
|
72
72
|
|
|
73
|
-
const paginationWrapperClasses = classNames([
|
|
73
|
+
const paginationWrapperClasses = $derived(classNames([
|
|
74
74
|
styles['pagination-wrapper'],
|
|
75
75
|
paginationClassName
|
|
76
|
-
])
|
|
76
|
+
]))
|
|
77
77
|
|
|
78
|
-
const paginationClasses = classNames([
|
|
78
|
+
const paginationClasses = $derived(classNames([
|
|
79
79
|
styles.pagination,
|
|
80
80
|
!subText && paginationClassName
|
|
81
|
-
])
|
|
81
|
+
]))
|
|
82
82
|
|
|
83
|
-
const subTextValue = subText?.match(/\{0\}|\{1\}/g) ? subText : undefined
|
|
83
|
+
const subTextValue = $derived(subText?.match(/\{0\}|\{1\}/g) ? subText : undefined)
|
|
84
84
|
|
|
85
85
|
const updateValues = () => {
|
|
86
86
|
const activeElement = carouselItems[currentPage - 1] as HTMLLIElement
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
onScroll?.(currentPage)
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const scroll = debounceScroll((event: Event) => {
|
|
106
|
+
const scroll = $derived(debounceScroll((event: Event) => {
|
|
107
107
|
if (!paginated) {
|
|
108
108
|
const target = event.target as HTMLDivElement
|
|
109
109
|
const scrollLeft = target.scrollLeft
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
|
|
115
115
|
updateValues()
|
|
116
116
|
}
|
|
117
|
-
}, debounce)
|
|
117
|
+
}, debounce))
|
|
118
118
|
|
|
119
119
|
const paginate = (event: PaginationEventType) => {
|
|
120
120
|
const indexes = Array.from({ length: Math.ceil(items / getItemsPerSlide()) }, (_, i) => {
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
currentPage = 1
|
|
144
144
|
progressValue = 0
|
|
145
145
|
totalPages = Math.ceil(items / getItemsPerSlide())
|
|
146
|
-
style = `--
|
|
146
|
+
style = `--width: calc(${100 / getItemsPerSlide()}% - 5px);`
|
|
147
147
|
|
|
148
148
|
if (subTextValue) {
|
|
149
149
|
subText = subTextValue
|
|
@@ -50,7 +50,7 @@ const Carousel = ({
|
|
|
50
50
|
const [progressValue, setProgressValue] = useState(0)
|
|
51
51
|
const [updatedSubText, setUpdatedSubText] = useState(subText)
|
|
52
52
|
const [style, setStyle] = useState(getItemsPerSlide() > 1
|
|
53
|
-
? { '--
|
|
53
|
+
? { '--width': `calc(${100 / getItemsPerSlide()}% - 5px)` } as React.CSSProperties
|
|
54
54
|
: undefined)
|
|
55
55
|
|
|
56
56
|
const classes = classNames([
|
|
@@ -147,7 +147,7 @@ const Carousel = ({
|
|
|
147
147
|
totalPages.current = Math.ceil(items / getItemsPerSlide())
|
|
148
148
|
setStyle(prevStyle => ({
|
|
149
149
|
...prevStyle,
|
|
150
|
-
'--
|
|
150
|
+
'--width': `calc(${100 / getItemsPerSlide()}% - 5px)`
|
|
151
151
|
}) as React.CSSProperties)
|
|
152
152
|
|
|
153
153
|
if (subTextValue) {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-slide-width: 100%;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.carousel {
|
|
4
|
+
--width: 100%;
|
|
5
|
+
|
|
8
6
|
@include layout(flex, sm, column);
|
|
9
7
|
}
|
|
10
8
|
|
|
@@ -43,7 +41,7 @@ body {
|
|
|
43
41
|
@include spacing(m0);
|
|
44
42
|
@include layout(flex, h-center);
|
|
45
43
|
|
|
46
|
-
min-width: var(--
|
|
44
|
+
min-width: var(--width);
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
|
|
@@ -17,18 +17,20 @@
|
|
|
17
17
|
color,
|
|
18
18
|
className,
|
|
19
19
|
onClick,
|
|
20
|
+
onChange,
|
|
20
21
|
...rest
|
|
21
22
|
}: SvelteCheckboxProps = $props()
|
|
22
23
|
|
|
23
|
-
const classes = classNames([
|
|
24
|
+
const classes = $derived(classNames([
|
|
24
25
|
styles.checkbox,
|
|
25
26
|
label && subText && styles.col,
|
|
26
27
|
className
|
|
27
|
-
])
|
|
28
|
+
]))
|
|
28
29
|
|
|
29
|
-
const style = color
|
|
30
|
+
const style = $derived(color
|
|
30
31
|
? `--w-checkbox-color: ${color};`
|
|
31
32
|
: null
|
|
33
|
+
)
|
|
32
34
|
</script>
|
|
33
35
|
|
|
34
36
|
<label class={classes} style={style}>
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
checked={checked}
|
|
43
45
|
disabled={disabled}
|
|
44
46
|
onclick={onClick}
|
|
47
|
+
onchange={onChange}
|
|
45
48
|
{...rest}
|
|
46
49
|
/>
|
|
47
50
|
<span class={styles.check}>
|
|
@@ -16,7 +16,6 @@ const Checkbox = ({
|
|
|
16
16
|
disabled,
|
|
17
17
|
color,
|
|
18
18
|
className,
|
|
19
|
-
onClick,
|
|
20
19
|
...rest
|
|
21
20
|
}: ReactCheckboxProps) => {
|
|
22
21
|
const classes = classNames([
|
|
@@ -43,7 +42,6 @@ const Checkbox = ({
|
|
|
43
42
|
type="checkbox"
|
|
44
43
|
defaultChecked={checked}
|
|
45
44
|
disabled={disabled}
|
|
46
|
-
onClick={onClick}
|
|
47
45
|
{...rest}
|
|
48
46
|
/>
|
|
49
47
|
<span
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-checkbox-color: var(--w-color-primary);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.checkbox {
|
|
4
|
+
--color: var(--w-checkbox-color, var(--w-color-primary));
|
|
5
|
+
|
|
8
6
|
@include layout(inline-flex, sm);
|
|
9
7
|
@include typography(hmd);
|
|
10
8
|
|
|
@@ -22,7 +20,7 @@ body {
|
|
|
22
20
|
display: none;
|
|
23
21
|
|
|
24
22
|
&:checked + span {
|
|
25
|
-
@include background(var(--
|
|
23
|
+
@include background(var(--color));
|
|
26
24
|
|
|
27
25
|
svg {
|
|
28
26
|
@include position(absolute, center);
|
|
@@ -48,7 +46,7 @@ body {
|
|
|
48
46
|
|
|
49
47
|
display: inline-block;
|
|
50
48
|
min-width: 15px;
|
|
51
|
-
border: 1px solid var(--
|
|
49
|
+
border: 1px solid var(--color);
|
|
52
50
|
|
|
53
51
|
svg {
|
|
54
52
|
@include visibility(none);
|
|
@@ -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 CheckboxProps = {
|
|
4
4
|
checked?: boolean
|
|
@@ -11,9 +11,11 @@ export type CheckboxProps = {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export type SvelteCheckboxProps = {
|
|
14
|
+
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
14
15
|
onClick?: MouseEventHandler<HTMLInputElement>
|
|
15
16
|
} & CheckboxProps
|
|
16
17
|
|
|
17
18
|
export type ReactCheckboxProps = {
|
|
19
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>
|
|
18
20
|
onClick?: React.MouseEventHandler<HTMLInputElement>
|
|
19
21
|
} & CheckboxProps
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
on
|
|
17
17
|
}: SvelteCollapsibleProps = $props()
|
|
18
18
|
|
|
19
|
-
const classes = classNames([
|
|
19
|
+
const classes = $derived(classNames([
|
|
20
20
|
styles.collapsible,
|
|
21
21
|
maxHeight && styles.animated,
|
|
22
22
|
className
|
|
23
|
-
])
|
|
23
|
+
]))
|
|
24
24
|
|
|
25
|
-
const styleVariables = classNames([
|
|
25
|
+
const styleVariables = $derived(classNames([
|
|
26
26
|
initialHeight && `--w-collapsible-initial-height: ${initialHeight};`,
|
|
27
27
|
maxHeight && `--w-collapsible-max-height: ${maxHeight};`
|
|
28
|
-
])
|
|
28
|
+
]))
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<div
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
--w-collapsible-initial-height
|
|
5
|
-
--w-collapsible-max-height
|
|
3
|
+
.wrapper {
|
|
4
|
+
--initial-height: var(--w-collapsible-initial-height, 0);
|
|
5
|
+
--max-height: var(--w-collapsible-max-height, 100%);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.collapsible {
|
|
@@ -14,7 +14,7 @@ body {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
&[data-toggled="true"] .wrapper {
|
|
17
|
-
max-height: var(--
|
|
17
|
+
max-height: var(--max-height);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
&.animated .wrapper {
|
|
@@ -24,6 +24,6 @@ body {
|
|
|
24
24
|
.wrapper {
|
|
25
25
|
@include visibility(hidden);
|
|
26
26
|
|
|
27
|
-
max-height: var(--
|
|
27
|
+
max-height: var(--initial-height);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
...rest
|
|
16
16
|
}: SvelteContextMenuProps = $props()
|
|
17
17
|
|
|
18
|
-
const classes = classNames([
|
|
18
|
+
const classes = $derived(classNames([
|
|
19
19
|
styles.ctx,
|
|
20
20
|
className
|
|
21
|
-
])
|
|
21
|
+
]))
|
|
22
22
|
|
|
23
23
|
const showContext = (event: MouseEvent) => {
|
|
24
24
|
event.preventDefault()
|
|
@@ -67,10 +67,12 @@
|
|
|
67
67
|
}
|
|
68
68
|
})
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
$effect(() => {
|
|
71
|
+
if (!context) {
|
|
72
|
+
// eslint-disable-next-line no-console, max-len
|
|
73
|
+
console.error('Missing "context" slot. Attach slot="context" to one of the children of your <ContextMenu> component.')
|
|
74
|
+
}
|
|
75
|
+
})
|
|
74
76
|
</script>
|
|
75
77
|
|
|
76
78
|
<svelte:element {...rest} this={element} class={classes} bind:this={ctx}>
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
...rest
|
|
21
21
|
}: SvelteCopyProps = $props()
|
|
22
22
|
|
|
23
|
-
const classes = classNames([
|
|
23
|
+
const classes = $derived(classNames([
|
|
24
24
|
styles.copy,
|
|
25
25
|
className
|
|
26
|
-
])
|
|
26
|
+
]))
|
|
27
27
|
|
|
28
28
|
let copyButton: HTMLButtonElement | undefined = $state()
|
|
29
29
|
let copiedButton: HTMLSpanElement | undefined = $state()
|
|
@@ -25,20 +25,21 @@
|
|
|
25
25
|
...rest
|
|
26
26
|
}: SvelteCounterProps = $props()
|
|
27
27
|
|
|
28
|
-
const classes = classNames([
|
|
28
|
+
const classes = $derived(classNames([
|
|
29
29
|
styles.counter,
|
|
30
30
|
styles[type],
|
|
31
31
|
theme && styles[theme],
|
|
32
32
|
rounded && styles.rounded,
|
|
33
33
|
className
|
|
34
|
-
])
|
|
34
|
+
]))
|
|
35
35
|
|
|
36
|
-
const subtractIcon = minIcon || minusIcon
|
|
37
|
-
const addIcon = maxIcon || plusIcon
|
|
36
|
+
const subtractIcon = $derived(minIcon || minusIcon)
|
|
37
|
+
const addIcon = $derived(maxIcon || plusIcon)
|
|
38
38
|
|
|
39
|
-
const styleVariable = width
|
|
39
|
+
const styleVariable = $derived(width
|
|
40
40
|
? `--w-counter-width: ${width};`
|
|
41
41
|
: null
|
|
42
|
+
)
|
|
42
43
|
|
|
43
44
|
let intervalId: ReturnType<typeof setTimeout>
|
|
44
45
|
let timeoutId: ReturnType<typeof setTimeout>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-counter-width: 10ch;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.counter {
|
|
4
|
+
--width: var(--w-counter-width, 10ch);
|
|
5
|
+
|
|
8
6
|
@include layout(inline-flex);
|
|
9
7
|
@include border(primary-50);
|
|
10
8
|
@include border-radius();
|
|
@@ -139,7 +137,7 @@ body {
|
|
|
139
137
|
@include spacing(p-xs);
|
|
140
138
|
|
|
141
139
|
flex: 1;
|
|
142
|
-
width: var(--
|
|
140
|
+
width: var(--width);
|
|
143
141
|
appearance: none;
|
|
144
142
|
-moz-appearance: textfield;
|
|
145
143
|
|
|
@@ -149,7 +149,7 @@ const hasPagination = data?.length && itemsPerPage
|
|
|
149
149
|
{!!columnFilterItems?.length && (
|
|
150
150
|
<tfoot data-hidden="true">
|
|
151
151
|
<tr>
|
|
152
|
-
<td colspan={
|
|
152
|
+
<td colspan={headings?.length} class={styles['no-results']}>{noResultsLabel}</td>
|
|
153
153
|
</tr>
|
|
154
154
|
</tfoot>
|
|
155
155
|
)}
|
|
@@ -251,9 +251,9 @@ const hasPagination = data?.length && itemsPerPage
|
|
|
251
251
|
const sortedTableRows = Array.from(
|
|
252
252
|
table?.querySelectorAll('tbody tr') as NodeListOf<HTMLTableRowElement>
|
|
253
253
|
).sort((a, b) => {
|
|
254
|
-
let aValue: string | number = (a.querySelector(`[data-name
|
|
254
|
+
let aValue: string | number = (a.querySelector(`[data-name="${sortBy}"]`) as HTMLElement)
|
|
255
255
|
?.innerText.replace(/\s/g, '')
|
|
256
|
-
let bValue: string | number = (b.querySelector(`[data-name
|
|
256
|
+
let bValue: string | number = (b.querySelector(`[data-name="${sortBy}"]`) as HTMLElement)
|
|
257
257
|
?.innerText.replace(/\s/g, '')
|
|
258
258
|
|
|
259
259
|
if (!isNaN(aValue as any)) {
|
|
@@ -298,7 +298,7 @@ const hasPagination = data?.length && itemsPerPage
|
|
|
298
298
|
return
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
const affectedTableCells = Array.from(table.querySelectorAll(`[data-name
|
|
301
|
+
const affectedTableCells = Array.from(table.querySelectorAll(`[data-name="${eventName}"]`)) as HTMLElement[]
|
|
302
302
|
|
|
303
303
|
const columnToggleListElement = Array.from(event.list.children)
|
|
304
304
|
.find(child => (child as HTMLLIElement).dataset.name === event.name) as HTMLLIElement
|
|
@@ -38,32 +38,32 @@
|
|
|
38
38
|
children
|
|
39
39
|
}: SvelteDataTableProps = $props()
|
|
40
40
|
|
|
41
|
-
let filteredData: any = $
|
|
42
|
-
let toggledData: any = $
|
|
43
|
-
let filteredHeadings: any = $
|
|
41
|
+
let filteredData: any = $derived(data)
|
|
42
|
+
let toggledData: any = $derived(data)
|
|
43
|
+
let filteredHeadings: any = $derived(headings)
|
|
44
44
|
let page: number = $state(1)
|
|
45
45
|
let hasActiveFilter: boolean = $state(false)
|
|
46
46
|
let sortOrder = 1
|
|
47
47
|
|
|
48
|
-
const classes = classNames([
|
|
48
|
+
const classes = $derived(classNames([
|
|
49
49
|
styles.table,
|
|
50
50
|
hover && styles.hover,
|
|
51
51
|
striped && styles[`striped-${striped}s`],
|
|
52
52
|
offsetStripe && styles.offset,
|
|
53
53
|
compact && styles.compact,
|
|
54
54
|
maxHeight && styles.scroll
|
|
55
|
-
])
|
|
55
|
+
]))
|
|
56
56
|
|
|
57
|
-
const footerClasses = classNames([
|
|
57
|
+
const footerClasses = $derived(classNames([
|
|
58
58
|
styles.footer,
|
|
59
59
|
subText && styles.between
|
|
60
|
-
])
|
|
60
|
+
]))
|
|
61
61
|
|
|
62
|
-
const showColumnToggle = headings?.some(heading => {
|
|
62
|
+
const showColumnToggle = $derived(headings?.some(heading => {
|
|
63
63
|
return typeof heading === 'string' ? false : heading.toggleable
|
|
64
|
-
})
|
|
64
|
+
}))
|
|
65
65
|
|
|
66
|
-
const columnToggleItems = [{
|
|
66
|
+
const columnToggleItems = $derived([{
|
|
67
67
|
items: headings?.length ? headings
|
|
68
68
|
.filter(heading => typeof heading !== 'string' && heading.toggleable)
|
|
69
69
|
.map(heading => ({
|
|
@@ -73,15 +73,17 @@
|
|
|
73
73
|
return (h as HeadingObject).name === (heading as HeadingObject).name
|
|
74
74
|
}))
|
|
75
75
|
})) : []
|
|
76
|
-
}]
|
|
76
|
+
}])
|
|
77
77
|
|
|
78
|
-
const columnFilterIndexes = headings?.map(heading => (heading as HeadingObject).filterable)
|
|
78
|
+
const columnFilterIndexes = $derived(headings?.map(heading => (heading as HeadingObject).filterable)
|
|
79
79
|
.map((heading, index) => heading ? index : null)
|
|
80
80
|
.filter(heading => heading !== null) || []
|
|
81
|
+
)
|
|
81
82
|
|
|
82
|
-
const hasPagination = data?.length && itemsPerPage
|
|
83
|
+
const hasPagination = $derived(data?.length && itemsPerPage
|
|
83
84
|
? data.length > itemsPerPage
|
|
84
85
|
: false
|
|
86
|
+
)
|
|
85
87
|
|
|
86
88
|
const filter = debounce((event: Event) => {
|
|
87
89
|
const target = event.target as HTMLInputElement
|
|
@@ -250,7 +252,7 @@
|
|
|
250
252
|
{#if columnFilterIndexes?.length && !filteredData.length}
|
|
251
253
|
<tfoot>
|
|
252
254
|
<tr>
|
|
253
|
-
<td colspan={
|
|
255
|
+
<td colspan={headings?.length} class={styles['no-results']}>
|
|
254
256
|
{noResultsLabel}
|
|
255
257
|
</td>
|
|
256
258
|
</tr>
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
...rest
|
|
16
16
|
}: SvelteFlexProps = $props()
|
|
17
17
|
|
|
18
|
-
const classes = classNames([
|
|
18
|
+
const classes = $derived(classNames([
|
|
19
19
|
'flex',
|
|
20
20
|
getLayoutClasses({ gap, alignment, direction, wrap }),
|
|
21
21
|
className
|
|
22
|
-
])
|
|
22
|
+
]))
|
|
23
23
|
|
|
24
|
-
const componentProps = {
|
|
24
|
+
const componentProps = $derived({
|
|
25
25
|
class: classes
|
|
26
|
-
}
|
|
26
|
+
})
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<svelte:element this={element} {...componentProps} {...rest}>
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
children
|
|
18
18
|
}: SvelteFooterProps = $props()
|
|
19
19
|
|
|
20
|
-
const classes = classNames([
|
|
20
|
+
const classes = $derived(classNames([
|
|
21
21
|
styles.footer,
|
|
22
22
|
className
|
|
23
|
-
])
|
|
23
|
+
]))
|
|
24
24
|
|
|
25
|
-
const containerClasses = classNames([
|
|
25
|
+
const containerClasses = $derived(classNames([
|
|
26
26
|
styles.container,
|
|
27
27
|
wrapperClassName
|
|
28
|
-
])
|
|
28
|
+
]))
|
|
29
29
|
|
|
30
|
-
const subTextClasses = classNames([
|
|
30
|
+
const subTextClasses = $derived(classNames([
|
|
31
31
|
styles.subtext,
|
|
32
32
|
subTextClassName
|
|
33
|
-
])
|
|
33
|
+
]))
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<footer class={classes}>
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
...rest
|
|
14
14
|
}: SvelteGridProps = $props()
|
|
15
15
|
|
|
16
|
-
const classes = classNames([
|
|
16
|
+
const classes = $derived(classNames([
|
|
17
17
|
'grid',
|
|
18
18
|
getLayoutClasses({ gap, column }),
|
|
19
19
|
className
|
|
20
|
-
])
|
|
20
|
+
]))
|
|
21
21
|
|
|
22
|
-
const componentProps = {
|
|
22
|
+
const componentProps = $derived({
|
|
23
23
|
class: classes
|
|
24
|
-
}
|
|
24
|
+
})
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<svelte:element this={element} {...componentProps} {...rest}>
|