webcoreui 1.4.0 → 1.5.0-beta.1
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 +15 -1
- package/astro.d.ts +62 -56
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +1 -1
- package/components/Accordion/Accordion.svelte +60 -58
- package/components/Accordion/Accordion.tsx +3 -1
- package/components/Alert/Alert.astro +2 -1
- package/components/Alert/Alert.svelte +12 -5
- package/components/Alert/Alert.tsx +10 -3
- package/components/Alert/alert.ts +2 -18
- package/components/AspectRatio/AspectRatio.astro +1 -1
- package/components/AspectRatio/AspectRatio.svelte +27 -22
- package/components/AspectRatio/AspectRatio.tsx +6 -3
- package/components/AspectRatio/aspectratio.ts +0 -10
- package/components/Avatar/Avatar.astro +1 -1
- package/components/Avatar/Avatar.svelte +7 -5
- package/components/Avatar/Avatar.tsx +3 -2
- package/components/Avatar/avatar.module.scss +3 -5
- package/components/Badge/Badge.astro +2 -1
- package/components/Badge/Badge.svelte +11 -4
- package/components/Badge/Badge.tsx +8 -3
- package/components/Badge/badge.module.scss +5 -6
- package/components/Badge/badge.ts +11 -13
- package/components/Banner/Banner.astro +1 -1
- package/components/Banner/Banner.svelte +11 -5
- package/components/Banner/Banner.tsx +6 -2
- package/components/Banner/banner.module.scss +4 -6
- package/components/Banner/banner.ts +0 -10
- package/components/BottomNavigation/BottomNavigation.astro +1 -1
- package/components/BottomNavigation/BottomNavigation.svelte +7 -4
- package/components/BottomNavigation/BottomNavigation.tsx +3 -2
- package/components/BottomNavigation/bottomnavigation.module.scss +68 -70
- package/components/Breadcrumb/Breadcrumb.astro +1 -1
- package/components/Breadcrumb/Breadcrumb.svelte +5 -3
- package/components/Breadcrumb/Breadcrumb.tsx +3 -1
- package/components/Button/Button.astro +2 -1
- package/components/Button/Button.svelte +11 -4
- package/components/Button/Button.tsx +7 -2
- package/components/Button/button.module.scss +9 -12
- package/components/Button/button.ts +23 -20
- package/components/Card/Card.astro +9 -2
- package/components/Card/Card.svelte +21 -8
- package/components/Card/Card.tsx +23 -6
- package/components/Card/card.module.scss +12 -9
- package/components/Card/card.ts +3 -16
- package/components/Carousel/Carousel.astro +3 -3
- package/components/Carousel/Carousel.svelte +24 -19
- package/components/Carousel/Carousel.tsx +9 -4
- package/components/Carousel/carousel.module.scss +3 -5
- package/components/Carousel/carousel.ts +0 -12
- package/components/CarouselItem/CarouselItem.astro +14 -0
- package/components/CarouselItem/CarouselItem.svelte +18 -0
- package/components/CarouselItem/CarouselItem.tsx +18 -0
- package/components/CarouselItem/carouselItem.ts +4 -0
- package/components/Checkbox/Checkbox.astro +3 -6
- package/components/Checkbox/Checkbox.svelte +13 -10
- package/components/Checkbox/Checkbox.tsx +8 -5
- package/components/Checkbox/checkbox.module.scss +4 -6
- package/components/Checkbox/checkbox.ts +2 -17
- package/components/Collapsible/Collapsible.astro +1 -1
- package/components/Collapsible/Collapsible.svelte +13 -6
- package/components/Collapsible/Collapsible.tsx +8 -2
- package/components/Collapsible/collapsible.module.scss +5 -5
- package/components/Collapsible/collapsible.ts +0 -15
- package/components/ConditionalWrapper/ConditionalWrapper.astro +1 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +8 -2
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +7 -2
- package/components/ConditionalWrapper/conditionalwrapper.ts +2 -14
- package/components/ContextMenu/ContextMenu.astro +2 -1
- package/components/ContextMenu/ContextMenu.svelte +17 -9
- package/components/ContextMenu/ContextMenu.tsx +8 -2
- package/components/ContextMenu/contextmenu.ts +2 -17
- package/components/Copy/Copy.astro +2 -2
- package/components/Copy/Copy.svelte +10 -5
- package/components/Copy/Copy.tsx +7 -3
- package/components/Copy/copy.ts +2 -12
- package/components/Counter/Counter.astro +3 -2
- package/components/Counter/Counter.svelte +16 -10
- package/components/Counter/Counter.tsx +11 -7
- package/components/Counter/counter.module.scss +3 -5
- package/components/Counter/counter.ts +2 -11
- package/components/DataTable/DataTable.astro +1 -1
- package/components/DataTable/DataTable.svelte +23 -15
- package/components/DataTable/DataTable.tsx +7 -2
- package/components/DataTable/datatable.ts +0 -12
- package/components/Flex/Flex.astro +2 -1
- package/components/Flex/Flex.svelte +12 -6
- package/components/Flex/Flex.tsx +8 -3
- package/components/Flex/flex.ts +2 -15
- package/components/Footer/Footer.astro +1 -1
- package/components/Footer/Footer.svelte +13 -8
- package/components/Footer/Footer.tsx +6 -2
- package/components/Footer/footer.ts +0 -10
- package/components/Grid/Grid.astro +2 -1
- package/components/Grid/Grid.svelte +12 -6
- package/components/Grid/Grid.tsx +8 -3
- package/components/Grid/grid.ts +2 -15
- package/components/Group/Group.astro +1 -1
- package/components/Group/Group.svelte +9 -4
- package/components/Group/Group.tsx +6 -2
- package/components/Group/group.ts +0 -10
- package/components/Icon/Icon.astro +1 -1
- package/components/Icon/Icon.svelte +16 -9
- package/components/Icon/Icon.tsx +3 -2
- package/components/Image/Image.astro +2 -1
- package/components/Image/Image.svelte +54 -51
- package/components/Image/Image.tsx +3 -1
- package/components/Image/image.ts +2 -3
- package/components/ImageLoader/ImageLoader.astro +1 -1
- package/components/ImageLoader/ImageLoader.svelte +5 -3
- package/components/ImageLoader/ImageLoader.tsx +3 -1
- package/components/Input/Input.astro +3 -2
- package/components/Input/Input.svelte +19 -9
- package/components/Input/Input.tsx +11 -3
- package/components/Input/input.ts +26 -53
- package/components/Kbd/Kbd.astro +1 -1
- package/components/Kbd/Kbd.svelte +9 -4
- package/components/Kbd/Kbd.tsx +6 -2
- package/components/Kbd/kbd.ts +0 -10
- package/components/List/List.astro +1 -1
- package/components/List/List.svelte +13 -9
- package/components/List/List.tsx +10 -6
- package/components/List/list.ts +0 -8
- package/components/Masonry/Masonry.astro +1 -1
- package/components/Masonry/Masonry.svelte +14 -9
- package/components/Masonry/Masonry.tsx +7 -3
- package/components/Masonry/masonry.module.scss +4 -6
- package/components/Masonry/masonry.ts +2 -13
- package/components/Menu/Menu.astro +1 -1
- package/components/Menu/Menu.svelte +13 -7
- package/components/Menu/Menu.tsx +6 -2
- package/components/Menu/menu.ts +0 -10
- package/components/Modal/Modal.astro +2 -3
- package/components/Modal/Modal.svelte +12 -8
- package/components/Modal/Modal.tsx +6 -4
- package/components/Modal/modal.module.scss +5 -5
- package/components/Modal/modal.ts +2 -14
- package/components/OTPInput/OTPInput.astro +3 -5
- package/components/OTPInput/OTPInput.svelte +10 -10
- package/components/OTPInput/OTPInput.tsx +10 -8
- package/components/OTPInput/otpinput.module.scss +0 -12
- package/components/OTPInput/otpinput.ts +2 -4
- package/components/Pagination/Pagination.astro +1 -1
- package/components/Pagination/Pagination.svelte +8 -4
- package/components/Pagination/Pagination.tsx +6 -2
- package/components/Pagination/pagination.ts +0 -8
- package/components/Popover/Popover.astro +3 -7
- package/components/Popover/Popover.svelte +11 -10
- package/components/Popover/Popover.tsx +9 -12
- package/components/Popover/popover.ts +2 -15
- package/components/Progress/Progress.astro +1 -1
- package/components/Progress/Progress.svelte +8 -6
- package/components/Progress/Progress.tsx +3 -1
- package/components/Progress/progress.module.scss +15 -17
- package/components/Radio/Radio.astro +4 -4
- package/components/Radio/Radio.svelte +15 -8
- package/components/Radio/Radio.tsx +8 -5
- package/components/Radio/radio.module.scss +4 -6
- package/components/Radio/radio.ts +3 -14
- package/components/RangeSlider/RangeSlider.astro +5 -2
- package/components/RangeSlider/RangeSlider.svelte +20 -35
- package/components/RangeSlider/RangeSlider.tsx +11 -4
- package/components/RangeSlider/rangeslider.module.scss +14 -16
- package/components/RangeSlider/rangeslider.ts +1 -9
- package/components/Rating/Rating.astro +1 -1
- package/components/Rating/Rating.svelte +10 -7
- package/components/Rating/Rating.tsx +3 -1
- package/components/Rating/rating.module.scss +13 -15
- package/components/Ribbon/Ribbon.astro +1 -1
- package/components/Ribbon/Ribbon.svelte +9 -4
- package/components/Ribbon/Ribbon.tsx +6 -2
- package/components/Ribbon/ribbon.module.scss +9 -11
- package/components/Ribbon/ribbon.ts +0 -10
- package/components/Select/Select.astro +3 -1
- package/components/Select/Select.svelte +179 -171
- package/components/Select/Select.tsx +11 -4
- package/components/Select/select.ts +2 -12
- package/components/Sheet/Sheet.astro +2 -1
- package/components/Sheet/Sheet.svelte +7 -5
- package/components/Sheet/Sheet.tsx +5 -4
- package/components/Sheet/sheet.ts +3 -10
- package/components/Sidebar/Sidebar.astro +1 -1
- package/components/Sidebar/Sidebar.svelte +9 -4
- package/components/Sidebar/Sidebar.tsx +6 -2
- package/components/Sidebar/sidebar.ts +0 -10
- package/components/Skeleton/Skeleton.astro +1 -1
- package/components/Skeleton/Skeleton.svelte +7 -5
- package/components/Skeleton/Skeleton.tsx +3 -1
- package/components/Skeleton/skeleton.module.scss +6 -9
- package/components/Slider/Slider.astro +7 -5
- package/components/Slider/Slider.svelte +18 -10
- package/components/Slider/Slider.tsx +12 -6
- package/components/Slider/slider.module.scss +12 -14
- package/components/Slider/slider.ts +3 -12
- package/components/SpeedDial/SpeedDial.astro +1 -1
- package/components/SpeedDial/SpeedDial.svelte +6 -4
- package/components/SpeedDial/SpeedDial.tsx +4 -2
- package/components/SpeedDial/speeddial.module.scss +4 -6
- package/components/Spinner/Spinner.astro +1 -1
- package/components/Spinner/Spinner.svelte +7 -5
- package/components/Spinner/Spinner.tsx +3 -1
- package/components/Spinner/spinner.module.scss +13 -14
- package/components/Spoiler/Spoiler.astro +1 -1
- package/components/Spoiler/Spoiler.svelte +11 -5
- package/components/Spoiler/Spoiler.tsx +6 -2
- package/components/Spoiler/spoiler.module.scss +3 -5
- package/components/Spoiler/spoiler.ts +0 -10
- package/components/Stepper/Stepper.astro +1 -1
- package/components/Stepper/Stepper.svelte +7 -5
- package/components/Stepper/Stepper.tsx +3 -1
- package/components/Stepper/stepper.defaults.scss +5 -0
- package/components/Stepper/stepper.module.scss +11 -13
- package/components/Switch/Switch.astro +7 -2
- package/components/Switch/Switch.svelte +17 -8
- package/components/Switch/Switch.tsx +8 -4
- package/components/Switch/switch.module.scss +5 -7
- package/components/Switch/switch.ts +2 -16
- package/components/Tab/Tab.astro +25 -0
- package/components/Tab/Tab.svelte +28 -0
- package/components/Tab/Tab.tsx +30 -0
- package/components/Tab/tab.ts +6 -0
- package/components/Table/Table.astro +1 -1
- package/components/Table/Table.svelte +5 -3
- package/components/Table/Table.tsx +3 -1
- package/components/Tabs/Tabs.astro +58 -25
- package/components/Tabs/Tabs.svelte +47 -14
- package/components/Tabs/Tabs.tsx +42 -11
- package/components/Tabs/tabs.module.scss +7 -6
- package/components/Tabs/tabs.ts +0 -10
- package/components/Textarea/Textarea.astro +3 -6
- package/components/Textarea/Textarea.svelte +13 -10
- package/components/Textarea/Textarea.tsx +9 -7
- package/components/Textarea/textarea.ts +2 -17
- package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -1
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +14 -8
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +7 -2
- package/components/ThemeSwitcher/themeswitcher.module.scss +10 -12
- package/components/ThemeSwitcher/themeswitcher.ts +0 -13
- package/components/Timeline/Timeline.astro +1 -1
- package/components/Timeline/Timeline.svelte +11 -6
- package/components/Timeline/Timeline.tsx +6 -2
- package/components/Timeline/timeline.module.scss +6 -8
- package/components/Timeline/timeline.ts +0 -10
- package/components/TimelineItem/TimelineItem.astro +1 -1
- package/components/TimelineItem/TimelineItem.svelte +9 -4
- package/components/TimelineItem/TimelineItem.tsx +8 -3
- package/components/TimelineItem/timelineitem.module.scss +4 -4
- package/components/TimelineItem/timelineitem.ts +0 -12
- package/components/Toast/Toast.astro +2 -1
- package/components/Toast/Toast.svelte +9 -7
- package/components/Toast/Toast.tsx +5 -4
- package/components/Toast/toast.ts +3 -11
- package/package.json +19 -19
- package/react.d.ts +145 -138
- 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/setup.scss +6 -3
- package/svelte.d.ts +145 -138
- package/svelte.js +4 -0
|
@@ -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 {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { MouseEventHandler } from 'svelte/elements'
|
|
3
|
-
|
|
4
|
-
export type ButtonProps = {
|
|
1
|
+
export type ButtonBase = {
|
|
5
2
|
theme?: 'secondary'
|
|
6
3
|
| 'outline'
|
|
7
4
|
| 'flat'
|
|
@@ -9,23 +6,29 @@ export type ButtonProps = {
|
|
|
9
6
|
| 'success'
|
|
10
7
|
| 'warning'
|
|
11
8
|
| 'alert'
|
|
12
|
-
target?: '_self'
|
|
13
|
-
| '_blank'
|
|
14
|
-
| '_parent'
|
|
15
|
-
| '_top'
|
|
16
|
-
| '_unfencedTop'
|
|
17
|
-
| ''
|
|
18
|
-
href?: string
|
|
19
9
|
className?: string
|
|
20
|
-
[key: string]: any
|
|
21
10
|
}
|
|
22
11
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
type AsButton<T extends object = object> = ButtonBase & {
|
|
13
|
+
href?: never
|
|
14
|
+
target?: never
|
|
15
|
+
rel?: never
|
|
16
|
+
download?: never
|
|
17
|
+
hreflang?: never
|
|
18
|
+
ping?: never
|
|
19
|
+
referrerpolicy?: never
|
|
20
|
+
} & T
|
|
21
|
+
|
|
22
|
+
type AsAnchor<T extends object = object> = ButtonBase & {
|
|
23
|
+
href?: string
|
|
24
|
+
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop' | ''
|
|
25
|
+
rel?: string
|
|
26
|
+
download?: string | boolean
|
|
27
|
+
hreflang?: string
|
|
28
|
+
ping?: string
|
|
29
|
+
referrerpolicy?: ReferrerPolicy
|
|
30
|
+
} & T
|
|
27
31
|
|
|
28
|
-
export type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} & ButtonProps
|
|
32
|
+
export type ButtonProps<T extends object = object> =
|
|
33
|
+
| AsButton<T>
|
|
34
|
+
| AsAnchor<T>
|
|
@@ -3,7 +3,7 @@ import type { CardProps } from './card'
|
|
|
3
3
|
|
|
4
4
|
import styles from './card.module.scss'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export type Props = CardProps
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
element = 'section',
|
|
@@ -13,12 +13,14 @@ const {
|
|
|
13
13
|
className,
|
|
14
14
|
bodyClassName,
|
|
15
15
|
secondary,
|
|
16
|
+
flat,
|
|
16
17
|
...rest
|
|
17
18
|
} = Astro.props
|
|
18
19
|
|
|
19
20
|
const classes = [
|
|
20
21
|
styles.card,
|
|
21
22
|
secondary && styles.secondary,
|
|
23
|
+
(flat && (compact || secondary)) && styles.flat,
|
|
22
24
|
className
|
|
23
25
|
]
|
|
24
26
|
|
|
@@ -28,13 +30,18 @@ const bodyClasses = [
|
|
|
28
30
|
bodyClassName
|
|
29
31
|
]
|
|
30
32
|
|
|
33
|
+
const titleClasses = [
|
|
34
|
+
styles.title,
|
|
35
|
+
flat && styles.flat
|
|
36
|
+
]
|
|
37
|
+
|
|
31
38
|
const Component = element
|
|
32
39
|
const Title = titleTag
|
|
33
40
|
---
|
|
34
41
|
|
|
35
42
|
<Component class:list={classes} {...rest}>
|
|
36
43
|
{title && (
|
|
37
|
-
<Title class:list={
|
|
44
|
+
<Title class:list={titleClasses} set:html={title} />
|
|
38
45
|
)}
|
|
39
46
|
<div class:list={bodyClasses}>
|
|
40
47
|
<slot />
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { CardProps } from './card'
|
|
3
4
|
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
import styles from './card.module.scss'
|
|
7
8
|
|
|
9
|
+
export type Props = CardProps & {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
element = 'section',
|
|
10
15
|
title,
|
|
@@ -13,27 +18,35 @@
|
|
|
13
18
|
className,
|
|
14
19
|
bodyClassName,
|
|
15
20
|
secondary,
|
|
21
|
+
flat,
|
|
16
22
|
children,
|
|
17
23
|
...rest
|
|
18
|
-
}:
|
|
24
|
+
}: Props = $props()
|
|
19
25
|
|
|
20
|
-
const classes = classNames([
|
|
26
|
+
const classes = $derived(classNames([
|
|
21
27
|
styles.card,
|
|
22
28
|
secondary && styles.secondary,
|
|
29
|
+
(flat && (compact || secondary)) && styles.flat,
|
|
23
30
|
className
|
|
24
|
-
])
|
|
31
|
+
]))
|
|
25
32
|
|
|
26
|
-
const bodyClasses = classNames([
|
|
33
|
+
const bodyClasses = $derived(classNames([
|
|
27
34
|
styles.body,
|
|
28
35
|
compact && styles.compact,
|
|
29
36
|
bodyClassName
|
|
30
|
-
])
|
|
37
|
+
]))
|
|
38
|
+
|
|
39
|
+
const titleClasses = $derived(classNames([
|
|
40
|
+
styles.title,
|
|
41
|
+
flat && styles.flat,
|
|
42
|
+
(flat && compact) && styles.compact
|
|
43
|
+
]))
|
|
31
44
|
</script>
|
|
32
45
|
|
|
33
46
|
<svelte:element this={element} class={classes} {...rest}>
|
|
34
47
|
{#if title}
|
|
35
|
-
<svelte:element this={titleTag} class={
|
|
36
|
-
{title}
|
|
48
|
+
<svelte:element this={titleTag} class={titleClasses}>
|
|
49
|
+
{@html title}
|
|
37
50
|
</svelte:element>
|
|
38
51
|
{/if}
|
|
39
52
|
<div class={bodyClasses}>
|
package/components/Card/Card.tsx
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type {
|
|
1
|
+
import React, { type JSX } from 'react'
|
|
2
|
+
import type { CardProps } from './card'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './card.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = Omit<CardProps<any>, 'titleTag' | 'element'> & {
|
|
9
|
+
Element?: keyof JSX.IntrinsicElements
|
|
10
|
+
TitleTag?: keyof JSX.IntrinsicElements
|
|
11
|
+
children: React.ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
const Card = ({
|
|
9
15
|
Element = 'section',
|
|
10
16
|
title,
|
|
@@ -13,13 +19,15 @@ const Card = ({
|
|
|
13
19
|
className,
|
|
14
20
|
bodyClassName,
|
|
15
21
|
secondary,
|
|
22
|
+
flat,
|
|
16
23
|
children,
|
|
17
24
|
...rest
|
|
18
|
-
}:
|
|
25
|
+
}: Props) => {
|
|
19
26
|
const classes = classNames([
|
|
20
27
|
styles.card,
|
|
21
|
-
|
|
22
|
-
secondary && styles.
|
|
28
|
+
secondary && styles.secondary,
|
|
29
|
+
(flat && (compact || secondary)) && styles.flat,
|
|
30
|
+
className
|
|
23
31
|
])
|
|
24
32
|
|
|
25
33
|
const bodyClasses = classNames([
|
|
@@ -28,10 +36,19 @@ const Card = ({
|
|
|
28
36
|
bodyClassName
|
|
29
37
|
])
|
|
30
38
|
|
|
39
|
+
const titleClasses = classNames([
|
|
40
|
+
styles.title,
|
|
41
|
+
flat && styles.flat,
|
|
42
|
+
(flat && compact) && styles.compact
|
|
43
|
+
])
|
|
44
|
+
|
|
31
45
|
return (
|
|
32
46
|
<Element className={classes} {...rest}>
|
|
33
47
|
{title && (
|
|
34
|
-
<TitleTag
|
|
48
|
+
<TitleTag
|
|
49
|
+
className={titleClasses}
|
|
50
|
+
dangerouslySetInnerHTML={{ __html: title }}
|
|
51
|
+
/>
|
|
35
52
|
)}
|
|
36
53
|
<div className={bodyClasses}>
|
|
37
54
|
{children}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
3
|
.card {
|
|
4
|
-
@include border(primary-50);
|
|
5
4
|
@include border-radius(md);
|
|
6
5
|
@include layout(flex, column);
|
|
7
6
|
@include background(primary-70);
|
|
7
|
+
@include visibility(hidden);
|
|
8
|
+
|
|
9
|
+
&:not(.flat) {
|
|
10
|
+
@include border(primary-50);
|
|
11
|
+
}
|
|
8
12
|
|
|
9
|
-
&.secondary
|
|
13
|
+
&.secondary .body,
|
|
14
|
+
&.flat .title {
|
|
10
15
|
@include background(primary-60);
|
|
11
|
-
|
|
12
|
-
.title {
|
|
13
|
-
@include background(primary-70);
|
|
14
|
-
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.title {
|
|
19
|
+
@include visibility(block);
|
|
18
20
|
@include spacing(p-default);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
&:not(.flat) {
|
|
23
|
+
@include border(primary-50, bottom);
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
.body {
|
|
@@ -28,7 +32,6 @@
|
|
|
28
32
|
&.compact {
|
|
29
33
|
@include border(20px, primary-60);
|
|
30
34
|
@include spacing(p-3xl);
|
|
31
|
-
@include background(primary-70);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
}
|
package/components/Card/card.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Snippet } from 'svelte'
|
|
3
|
-
|
|
4
|
-
export type CardProps = {
|
|
1
|
+
export type CardProps<T extends object = Record<string, unknown>> = {
|
|
5
2
|
element?: string
|
|
6
3
|
title?: string
|
|
7
4
|
titleTag?: string
|
|
@@ -9,15 +6,5 @@ export type CardProps = {
|
|
|
9
6
|
className?: string
|
|
10
7
|
bodyClassName?: string
|
|
11
8
|
secondary?: boolean
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type SvelteCardProps = {
|
|
16
|
-
children: Snippet
|
|
17
|
-
} & CardProps
|
|
18
|
-
|
|
19
|
-
export type ReactCardProps = {
|
|
20
|
-
Element?: keyof JSX.IntrinsicElements
|
|
21
|
-
TitleTag?: keyof JSX.IntrinsicElements
|
|
22
|
-
children: React.ReactNode
|
|
23
|
-
} & Omit<CardProps, 'titleTag' | 'element'>
|
|
9
|
+
flat?: boolean
|
|
10
|
+
} & T
|
|
@@ -9,7 +9,7 @@ import { classNames } from '../../utils/classNames'
|
|
|
9
9
|
|
|
10
10
|
import styles from './carousel.module.scss'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export type Props = CarouselProps
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
items,
|
|
@@ -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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte'
|
|
3
|
-
import type {
|
|
2
|
+
import { onMount, type Snippet } from 'svelte'
|
|
3
|
+
import type { CarouselProps } from './carousel'
|
|
4
4
|
|
|
5
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
6
6
|
import Pagination from '../Pagination/Pagination.svelte'
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
import type { PaginationEventType } from '../Pagination/pagination'
|
|
16
16
|
|
|
17
|
+
export type Props = CarouselProps & {
|
|
18
|
+
onScroll?: (event: number) => void
|
|
19
|
+
children: Snippet
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
let {
|
|
18
23
|
items = 0,
|
|
19
24
|
itemsPerSlide = 1,
|
|
@@ -28,7 +33,7 @@
|
|
|
28
33
|
paginationClassName,
|
|
29
34
|
children,
|
|
30
35
|
onScroll
|
|
31
|
-
}:
|
|
36
|
+
}: Props = $props()
|
|
32
37
|
|
|
33
38
|
const getItemsPerSlide = () => {
|
|
34
39
|
if (carousel) {
|
|
@@ -48,39 +53,39 @@
|
|
|
48
53
|
let progressValue = $state(0)
|
|
49
54
|
let paginated = false
|
|
50
55
|
let currentPage = $state(1)
|
|
51
|
-
let totalPages = $
|
|
56
|
+
let totalPages = $derived(Math.ceil(items / getItemsPerSlide()))
|
|
52
57
|
let style = $state(getItemsPerSlide() > 1
|
|
53
|
-
? `--
|
|
58
|
+
? `--width: calc(${100 / getItemsPerSlide()}% - 5px);`
|
|
54
59
|
: null)
|
|
55
60
|
|
|
56
|
-
const classes = classNames([
|
|
61
|
+
const classes = $derived(classNames([
|
|
57
62
|
styles.carousel,
|
|
58
63
|
className
|
|
59
|
-
])
|
|
64
|
+
]))
|
|
60
65
|
|
|
61
|
-
const containerClasses = classNames([
|
|
66
|
+
const containerClasses = $derived(classNames([
|
|
62
67
|
styles.container,
|
|
63
68
|
scrollSnap && styles.snap
|
|
64
|
-
])
|
|
69
|
+
]))
|
|
65
70
|
|
|
66
|
-
const wrapperClasses = classNames([
|
|
71
|
+
const wrapperClasses = $derived(classNames([
|
|
67
72
|
styles.wrapper,
|
|
68
73
|
effect && styles[effect],
|
|
69
74
|
getItemsPerSlide() > 1 && styles['no-snap'],
|
|
70
75
|
wrapperClassName
|
|
71
|
-
])
|
|
76
|
+
]))
|
|
72
77
|
|
|
73
|
-
const paginationWrapperClasses = classNames([
|
|
78
|
+
const paginationWrapperClasses = $derived(classNames([
|
|
74
79
|
styles['pagination-wrapper'],
|
|
75
80
|
paginationClassName
|
|
76
|
-
])
|
|
81
|
+
]))
|
|
77
82
|
|
|
78
|
-
const paginationClasses = classNames([
|
|
83
|
+
const paginationClasses = $derived(classNames([
|
|
79
84
|
styles.pagination,
|
|
80
85
|
!subText && paginationClassName
|
|
81
|
-
])
|
|
86
|
+
]))
|
|
82
87
|
|
|
83
|
-
const subTextValue = subText?.match(/\{0\}|\{1\}/g) ? subText : undefined
|
|
88
|
+
const subTextValue = $derived(subText?.match(/\{0\}|\{1\}/g) ? subText : undefined)
|
|
84
89
|
|
|
85
90
|
const updateValues = () => {
|
|
86
91
|
const activeElement = carouselItems[currentPage - 1] as HTMLLIElement
|
|
@@ -103,7 +108,7 @@
|
|
|
103
108
|
onScroll?.(currentPage)
|
|
104
109
|
}
|
|
105
110
|
|
|
106
|
-
const scroll = debounceScroll((event: Event) => {
|
|
111
|
+
const scroll = $derived(debounceScroll((event: Event) => {
|
|
107
112
|
if (!paginated) {
|
|
108
113
|
const target = event.target as HTMLDivElement
|
|
109
114
|
const scrollLeft = target.scrollLeft
|
|
@@ -114,7 +119,7 @@
|
|
|
114
119
|
|
|
115
120
|
updateValues()
|
|
116
121
|
}
|
|
117
|
-
}, debounce)
|
|
122
|
+
}, debounce))
|
|
118
123
|
|
|
119
124
|
const paginate = (event: PaginationEventType) => {
|
|
120
125
|
const indexes = Array.from({ length: Math.ceil(items / getItemsPerSlide()) }, (_, i) => {
|
|
@@ -143,7 +148,7 @@
|
|
|
143
148
|
currentPage = 1
|
|
144
149
|
progressValue = 0
|
|
145
150
|
totalPages = Math.ceil(items / getItemsPerSlide())
|
|
146
|
-
style = `--
|
|
151
|
+
style = `--width: calc(${100 / getItemsPerSlide()}% - 5px);`
|
|
147
152
|
|
|
148
153
|
if (subTextValue) {
|
|
149
154
|
subText = subTextValue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { CarouselProps } from './carousel'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
import Pagination from '../Pagination/Pagination.tsx'
|
|
@@ -13,6 +13,11 @@ import styles from './carousel.module.scss'
|
|
|
13
13
|
|
|
14
14
|
import type { PaginationEventType } from '../Pagination/pagination'
|
|
15
15
|
|
|
16
|
+
export type Props = CarouselProps & {
|
|
17
|
+
onScroll?: (event: number) => void
|
|
18
|
+
children?: React.ReactNode
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
const Carousel = ({
|
|
17
22
|
items,
|
|
18
23
|
itemsPerSlide = 1,
|
|
@@ -27,7 +32,7 @@ const Carousel = ({
|
|
|
27
32
|
paginationClassName,
|
|
28
33
|
onScroll,
|
|
29
34
|
children
|
|
30
|
-
}:
|
|
35
|
+
}: Props) => {
|
|
31
36
|
const getItemsPerSlide = () => {
|
|
32
37
|
if (carousel.current) {
|
|
33
38
|
return typeof itemsPerSlide === 'number'
|
|
@@ -50,7 +55,7 @@ const Carousel = ({
|
|
|
50
55
|
const [progressValue, setProgressValue] = useState(0)
|
|
51
56
|
const [updatedSubText, setUpdatedSubText] = useState(subText)
|
|
52
57
|
const [style, setStyle] = useState(getItemsPerSlide() > 1
|
|
53
|
-
? { '--
|
|
58
|
+
? { '--width': `calc(${100 / getItemsPerSlide()}% - 5px)` } as React.CSSProperties
|
|
54
59
|
: undefined)
|
|
55
60
|
|
|
56
61
|
const classes = classNames([
|
|
@@ -147,7 +152,7 @@ const Carousel = ({
|
|
|
147
152
|
totalPages.current = Math.ceil(items / getItemsPerSlide())
|
|
148
153
|
setStyle(prevStyle => ({
|
|
149
154
|
...prevStyle,
|
|
150
|
-
'--
|
|
155
|
+
'--width': `calc(${100 / getItemsPerSlide()}% - 5px)`
|
|
151
156
|
}) as React.CSSProperties)
|
|
152
157
|
|
|
153
158
|
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
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
import type { Responsive } from '../../utils/getLayoutClasses'
|
|
4
2
|
|
|
5
3
|
import type { PaginationProps } from '../Pagination/pagination'
|
|
@@ -19,13 +17,3 @@ export type CarouselProps = {
|
|
|
19
17
|
wrapperClassName?: string
|
|
20
18
|
paginationClassName?: string
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
export type SvelteCarouselProps = {
|
|
24
|
-
onScroll?: (event: number) => void
|
|
25
|
-
children: Snippet
|
|
26
|
-
} & CarouselProps
|
|
27
|
-
|
|
28
|
-
export type ReactCarouselProps = {
|
|
29
|
-
onScroll?: (event: number) => void
|
|
30
|
-
children?: React.ReactNode
|
|
31
|
-
} & CarouselProps
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { CarouselItemProps } from './carouselItem'
|
|
4
|
+
|
|
5
|
+
export type Props = CarouselItemProps & {
|
|
6
|
+
children: Snippet
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
active,
|
|
11
|
+
className,
|
|
12
|
+
children
|
|
13
|
+
}: Props = $props()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<li class={className} data-active={active}>
|
|
17
|
+
{@render children?.()}
|
|
18
|
+
</li>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { CarouselItemProps } from './carouselItem'
|
|
3
|
+
|
|
4
|
+
export type Props = CarouselItemProps & {
|
|
5
|
+
children: React.ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const CarouselItem = ({
|
|
9
|
+
active,
|
|
10
|
+
className,
|
|
11
|
+
children
|
|
12
|
+
}: Props) => (
|
|
13
|
+
<li className={className} data-active={active}>
|
|
14
|
+
{children}
|
|
15
|
+
</li>
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export default CarouselItem
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { CheckboxProps } from './checkbox'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
@@ -7,13 +8,11 @@ import check from '../../icons/check.svg?raw'
|
|
|
7
8
|
|
|
8
9
|
import styles from './checkbox.module.scss'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
export type Props = CheckboxProps<HTMLAttributes<'input'>>
|
|
11
12
|
|
|
12
13
|
const {
|
|
13
|
-
checked,
|
|
14
14
|
label,
|
|
15
15
|
subText,
|
|
16
|
-
disabled,
|
|
17
16
|
color,
|
|
18
17
|
className,
|
|
19
18
|
...rest
|
|
@@ -36,10 +35,8 @@ const style = color
|
|
|
36
35
|
children
|
|
37
36
|
</div>
|
|
38
37
|
<input
|
|
39
|
-
type="checkbox"
|
|
40
|
-
checked={checked}
|
|
41
|
-
disabled={disabled}
|
|
42
38
|
{...rest}
|
|
39
|
+
type="checkbox"
|
|
43
40
|
/>
|
|
44
41
|
<span class={styles.check}>
|
|
45
42
|
<Fragment set:html={check} />
|