webcoreui 0.9.0 → 0.10.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 +20 -6
- package/components/Accordion/Accordion.astro +15 -10
- package/components/Accordion/Accordion.svelte +14 -12
- package/components/Accordion/Accordion.tsx +2 -2
- package/components/Alert/Alert.svelte +17 -12
- package/components/Alert/Alert.tsx +1 -1
- package/components/Alert/alert.ts +10 -3
- package/components/AspectRatio/AspectRatio.svelte +7 -4
- package/components/AspectRatio/aspectratio.ts +6 -0
- package/components/Avatar/Avatar.svelte +11 -9
- package/components/Badge/Badge.svelte +14 -10
- package/components/Badge/badge.ts +2 -1
- package/components/Banner/Banner.astro +10 -4
- package/components/Banner/Banner.svelte +14 -10
- package/components/Banner/Banner.tsx +1 -0
- package/components/Banner/banner.ts +6 -0
- package/components/BottomNavigation/BottomNavigation.svelte +7 -5
- package/components/Breadcrumb/Breadcrumb.astro +1 -1
- package/components/Breadcrumb/Breadcrumb.svelte +8 -6
- package/components/Breadcrumb/Breadcrumb.tsx +2 -2
- package/components/Button/Button.svelte +12 -8
- package/components/Button/Button.tsx +2 -2
- package/components/Button/button.ts +2 -3
- package/components/Card/Card.svelte +14 -10
- package/components/Card/card.ts +6 -0
- package/components/Carousel/Carousel.astro +46 -41
- package/components/Carousel/carousel.ts +3 -0
- package/components/Checkbox/Checkbox.svelte +12 -9
- package/components/Checkbox/checkbox.module.scss +4 -0
- package/components/Collapsible/Collapsible.astro +8 -5
- package/components/Collapsible/Collapsible.svelte +54 -49
- package/components/Collapsible/collapsible.ts +8 -0
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +10 -6
- package/components/ConditionalWrapper/conditionalwrapper.ts +6 -0
- package/components/Copy/Copy.astro +17 -11
- package/components/Copy/Copy.svelte +68 -61
- package/components/Copy/Copy.tsx +1 -0
- package/components/Copy/copy.ts +8 -2
- package/components/DataTable/DataTable.astro +103 -93
- package/components/DataTable/DataTable.svelte +276 -272
- package/components/DataTable/datatable.ts +5 -2
- package/components/Flex/Flex.svelte +14 -10
- package/components/Flex/flex.ts +6 -0
- package/components/Footer/Footer.svelte +12 -9
- package/components/Footer/footer.ts +6 -0
- package/components/Grid/Grid.svelte +12 -8
- package/components/Grid/grid.ts +6 -0
- package/components/Group/Group.svelte +7 -4
- package/components/Group/group.ts +6 -0
- package/components/Icon/Icon.astro +19 -5
- package/components/Icon/Icon.svelte +23 -7
- package/components/Icon/Icon.tsx +19 -5
- package/components/Icon/icon.ts +9 -3
- package/components/Icon/map.ts +8 -10
- package/components/Input/Input.svelte +24 -20
- package/components/Input/input.ts +10 -3
- package/components/Kbd/Kbd.svelte +7 -4
- package/components/Kbd/kbd.ts +6 -0
- package/components/List/List.astro +65 -60
- package/components/List/List.svelte +149 -147
- package/components/List/List.tsx +1 -1
- package/components/Masonry/Masonry.svelte +12 -10
- package/components/Menu/Menu.astro +8 -3
- package/components/Menu/Menu.svelte +15 -10
- package/components/Menu/Menu.tsx +3 -1
- package/components/Menu/menu.ts +6 -0
- package/components/Modal/Modal.astro +1 -0
- package/components/Modal/Modal.svelte +18 -13
- package/components/Modal/Modal.tsx +2 -1
- package/components/Modal/modal.ts +6 -1
- package/components/Pagination/Pagination.astro +75 -69
- package/components/Pagination/Pagination.svelte +29 -26
- package/components/Pagination/Pagination.tsx +5 -4
- package/components/Pagination/pagination.module.scss +4 -0
- package/components/Popover/Popover.svelte +10 -6
- package/components/Popover/popover.ts +6 -0
- package/components/Progress/Progress.svelte +12 -10
- package/components/Progress/progress.ts +1 -1
- package/components/Radio/Radio.svelte +12 -9
- package/components/Radio/radio.ts +4 -2
- package/components/Rating/Rating.svelte +16 -14
- package/components/Ribbon/Ribbon.svelte +9 -6
- package/components/Ribbon/ribbon.ts +6 -0
- package/components/Select/Select.astro +73 -63
- package/components/Select/Select.svelte +27 -22
- package/components/Select/Select.tsx +8 -6
- package/components/Sheet/Sheet.svelte +9 -5
- package/components/Sheet/sheet.ts +6 -2
- package/components/Sidebar/Sidebar.svelte +7 -4
- package/components/Sidebar/sidebar.ts +6 -0
- package/components/Skeleton/Skeleton.svelte +9 -7
- package/components/Slider/Slider.svelte +15 -13
- package/components/Slider/slider.module.scss +4 -0
- package/components/Slider/slider.ts +4 -2
- package/components/Spinner/Spinner.svelte +7 -5
- package/components/Spoiler/Spoiler.astro +13 -8
- package/components/Spoiler/Spoiler.svelte +13 -10
- package/components/Spoiler/spoiler.ts +6 -0
- package/components/Stepper/Stepper.svelte +9 -7
- package/components/Switch/Switch.svelte +15 -12
- package/components/Table/Table.svelte +11 -9
- package/components/Table/table.ts +1 -1
- package/components/Tabs/Tabs.astro +8 -5
- package/components/Tabs/Tabs.svelte +14 -11
- package/components/Tabs/tabs.ts +7 -1
- package/components/Textarea/Textarea.svelte +14 -11
- package/components/Textarea/textarea.ts +9 -4
- package/components/ThemeSwitcher/ThemeSwitcher.astro +43 -37
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +14 -10
- package/components/ThemeSwitcher/themeswitcher.ts +7 -0
- package/components/Timeline/Timeline.svelte +12 -9
- package/components/Timeline/timeline.ts +7 -2
- package/components/TimelineItem/TimelineItem.svelte +8 -5
- package/components/TimelineItem/timelineitem.ts +6 -0
- package/components/Toast/Toast.svelte +18 -10
- package/components/Toast/toast.ts +6 -1
- package/icons/alert.svg +2 -2
- package/icons/check.svg +2 -2
- package/icons/chevron-down.svg +3 -0
- package/icons/chevron-left.svg +3 -0
- package/icons/chevron-right.svg +3 -0
- package/icons/chevron-up.svg +3 -0
- package/icons/circle-check.svg +3 -3
- package/icons/info.svg +3 -3
- package/icons.d.ts +4 -5
- package/icons.js +4 -5
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +20 -20
- package/react.d.ts +3 -3
- package/svelte.d.ts +98 -98
- package/utils/bodyFreeze.ts +13 -0
- package/utils/modal.ts +12 -0
- package/icons/arrow-down.svg +0 -3
- package/icons/arrow-left.svg +0 -3
- package/icons/arrow-right.svg +0 -3
- package/icons/components.svg +0 -3
- package/icons/file.svg +0 -3
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './switch.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const {
|
|
9
|
+
label,
|
|
10
|
+
toggled,
|
|
11
|
+
offColor,
|
|
12
|
+
onColor,
|
|
13
|
+
reverse,
|
|
14
|
+
small,
|
|
15
|
+
square,
|
|
16
|
+
disabled,
|
|
17
|
+
className,
|
|
18
|
+
onClick,
|
|
19
|
+
...rest
|
|
20
|
+
}: SvelteSwitchProps = $props()
|
|
18
21
|
|
|
19
22
|
const classes = classNames([
|
|
20
23
|
styles.switch,
|
|
@@ -36,8 +39,8 @@
|
|
|
36
39
|
type="checkbox"
|
|
37
40
|
checked={toggled}
|
|
38
41
|
disabled={disabled}
|
|
39
|
-
|
|
40
|
-
{
|
|
42
|
+
onclick={onClick}
|
|
43
|
+
{...rest}
|
|
41
44
|
/>
|
|
42
45
|
<span class={styles.toggle}></span>
|
|
43
46
|
{#if label}
|
|
@@ -5,15 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './table.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const {
|
|
9
|
+
headings,
|
|
10
|
+
footer,
|
|
11
|
+
data,
|
|
12
|
+
hover,
|
|
13
|
+
striped,
|
|
14
|
+
offsetStripe,
|
|
15
|
+
compact,
|
|
16
|
+
maxHeight,
|
|
17
|
+
className
|
|
18
|
+
}: TableProps = $props()
|
|
17
19
|
|
|
18
20
|
const classes = classNames([
|
|
19
21
|
styles.table,
|
|
@@ -42,10 +42,10 @@ const classes = [
|
|
|
42
42
|
</section>
|
|
43
43
|
|
|
44
44
|
<script>
|
|
45
|
-
|
|
45
|
+
import { on } from '../../utils/DOMUtils'
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const addEventListeners = () => {
|
|
48
|
+
on('[data-id="w-tabs"]', 'click', (event: Event) => {
|
|
49
49
|
const target = event.target as HTMLDivElement
|
|
50
50
|
|
|
51
51
|
if (target.dataset.value) {
|
|
@@ -72,6 +72,9 @@ const classes = [
|
|
|
72
72
|
}
|
|
73
73
|
})
|
|
74
74
|
}
|
|
75
|
-
})
|
|
76
|
-
}
|
|
75
|
+
}, true)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
on(document, 'astro:after-swap', addEventListeners)
|
|
79
|
+
addEventListeners()
|
|
77
80
|
</script>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteTabsProps } from './tabs'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './tabs.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const {
|
|
9
|
+
items,
|
|
10
|
+
theme,
|
|
11
|
+
vertical,
|
|
12
|
+
even,
|
|
13
|
+
className,
|
|
14
|
+
children
|
|
15
|
+
}: SvelteTabsProps = $props()
|
|
13
16
|
|
|
14
|
-
let active = ''
|
|
15
|
-
let tabContainer: HTMLDivElement
|
|
17
|
+
let active = $state('')
|
|
18
|
+
let tabContainer: HTMLDivElement | undefined = $state()
|
|
16
19
|
|
|
17
20
|
const classes = classNames([
|
|
18
21
|
styles.tabs,
|
|
@@ -23,7 +26,7 @@
|
|
|
23
26
|
])
|
|
24
27
|
|
|
25
28
|
const setTab = (tab: string) => {
|
|
26
|
-
const tabs = tabContainer
|
|
29
|
+
const tabs = tabContainer!.querySelectorAll('[data-tab]')
|
|
27
30
|
|
|
28
31
|
active = tab
|
|
29
32
|
|
|
@@ -44,7 +47,7 @@
|
|
|
44
47
|
<button
|
|
45
48
|
data-active={active ? active === item.value : item.active}
|
|
46
49
|
disabled={item.disabled}
|
|
47
|
-
|
|
50
|
+
onclick={() => setTab(item.value)}
|
|
48
51
|
>
|
|
49
52
|
{@html item.label}
|
|
50
53
|
</button>
|
|
@@ -52,6 +55,6 @@
|
|
|
52
55
|
</div>
|
|
53
56
|
</div>
|
|
54
57
|
<div class={styles.content} bind:this={tabContainer}>
|
|
55
|
-
|
|
58
|
+
{@render children?.()}
|
|
56
59
|
</div>
|
|
57
60
|
</section>
|
package/components/Tabs/tabs.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type TabsProps = {
|
|
2
4
|
items: {
|
|
3
5
|
label: string
|
|
@@ -5,12 +7,16 @@ export type TabsProps = {
|
|
|
5
7
|
active?: boolean
|
|
6
8
|
disabled?: boolean
|
|
7
9
|
}[]
|
|
8
|
-
theme?: 'boxed' | 'outline'
|
|
10
|
+
theme?: 'boxed' | 'outline'
|
|
9
11
|
vertical?: boolean
|
|
10
12
|
even?: boolean
|
|
11
13
|
className?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
export type SvelteTabsProps = {
|
|
17
|
+
children: Snippet
|
|
18
|
+
} & TabsProps
|
|
19
|
+
|
|
14
20
|
export type ReactTabsProps = {
|
|
15
21
|
children: React.ReactNode
|
|
16
22
|
} & TabsProps
|
|
@@ -7,14 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './textarea.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const {
|
|
11
|
+
label,
|
|
12
|
+
placeholder,
|
|
13
|
+
subText,
|
|
14
|
+
value = '',
|
|
15
|
+
disabled,
|
|
16
|
+
className,
|
|
17
|
+
onChange,
|
|
18
|
+
onKeyUp,
|
|
19
|
+
...rest
|
|
20
|
+
}: SvelteTextareaProps = $props()
|
|
18
21
|
|
|
19
22
|
const classes = classNames([
|
|
20
23
|
styles.textarea,
|
|
@@ -36,9 +39,9 @@
|
|
|
36
39
|
placeholder={placeholder}
|
|
37
40
|
disabled={disabled}
|
|
38
41
|
class={classes}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
+
onchange={onChange}
|
|
43
|
+
onkeyup={onKeyUp}
|
|
44
|
+
{...rest}
|
|
42
45
|
>{value}</textarea>
|
|
43
46
|
{#if subText}
|
|
44
47
|
<div class={styles.subtext}>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
type Target = {
|
|
2
|
+
target: HTMLTextAreaElement
|
|
3
|
+
currentTarget: HTMLTextAreaElement
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
export type TextareaProps = {
|
|
2
7
|
label?: string
|
|
3
8
|
placeholder?: string
|
|
@@ -9,11 +14,11 @@ export type TextareaProps = {
|
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
export type SvelteTextareaProps = {
|
|
12
|
-
onChange?: (
|
|
13
|
-
onKeyUp?: (
|
|
17
|
+
onChange?: (event: Event & Target) => void
|
|
18
|
+
onKeyUp?: (event: KeyboardEvent & Target) => void
|
|
14
19
|
} & TextareaProps
|
|
15
20
|
|
|
16
21
|
export type ReactTextareaProps = {
|
|
17
|
-
onChange?: (
|
|
18
|
-
onKeyUp?: (
|
|
22
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement> & Target) => void
|
|
23
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLTextAreaElement> & Target) => void
|
|
19
24
|
} & TextareaProps
|
|
@@ -50,59 +50,65 @@ const buttonClasses = [
|
|
|
50
50
|
|
|
51
51
|
<script>
|
|
52
52
|
import { getCookie, setCookie } from '../../utils/cookies'
|
|
53
|
+
import { on } from '../../utils/DOMUtils'
|
|
53
54
|
import { dispatch, listen } from '../../utils/event'
|
|
54
55
|
|
|
55
|
-
const
|
|
56
|
+
const addEventListeners = () => {
|
|
57
|
+
const switchers = document.querySelectorAll('[data-id="w-theme-switcher"]')
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
let currentTheme = localStorage.getItem('w-theme')
|
|
60
|
+
|| getCookie('w-theme')
|
|
61
|
+
|| (switchers[0] as HTMLDivElement).dataset.primaryTheme
|
|
62
|
+
|| ''
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
const setActiveButton = (buttons: HTMLButtonElement[]) => {
|
|
65
|
+
buttons.forEach(button => button.dataset.active = 'false')
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
buttons.forEach(button => {
|
|
68
|
+
if (button.dataset.theme === currentTheme) {
|
|
69
|
+
button.dataset.active = 'true'
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
Array.from(switchers).forEach(switcher => {
|
|
75
|
+
const buttons = Array.from(switcher.querySelectorAll('button'))
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
setActiveButton(buttons)
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
listen('theme-switched', theme => {
|
|
80
|
+
currentTheme = theme
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
setActiveButton(buttons)
|
|
83
|
+
})
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
switcher.addEventListener('click', event => {
|
|
86
|
+
const target = event.target as HTMLButtonElement
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
if (target.nodeName === 'BUTTON') {
|
|
89
|
+
const toggleTheme = (switcher as HTMLDivElement).dataset.secondaryTheme
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
const theme = toggleTheme
|
|
92
|
+
? toggleTheme === target.dataset.theme
|
|
93
|
+
? (target.previousElementSibling as HTMLButtonElement).dataset.theme as string
|
|
94
|
+
: (target.nextElementSibling as HTMLButtonElement).dataset.theme as string
|
|
95
|
+
: target.dataset.theme as string
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
document.body.classList.replace(currentTheme, theme)
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
currentTheme = theme
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
setActiveButton(buttons)
|
|
102
|
+
setCookie('w-theme', currentTheme, 30)
|
|
103
|
+
localStorage.setItem('w-theme', currentTheme)
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
dispatch('theme-switched', currentTheme)
|
|
106
|
+
}
|
|
107
|
+
})
|
|
105
108
|
})
|
|
106
|
-
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
on(document, 'astro:after-swap', addEventListeners)
|
|
112
|
+
addEventListeners()
|
|
107
113
|
</script>
|
|
108
114
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte'
|
|
3
|
-
import type {
|
|
3
|
+
import type { SvelteThemeSwitcherProps } from './themeswitcher'
|
|
4
4
|
|
|
5
5
|
import { classNames } from '../../utils/classNames'
|
|
6
6
|
import { getCookie, setCookie } from '../../utils/cookies'
|
|
@@ -8,12 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
import styles from './themeswitcher.module.scss'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const {
|
|
12
|
+
themes,
|
|
13
|
+
toggle,
|
|
14
|
+
size,
|
|
15
|
+
primaryIcon,
|
|
16
|
+
secondaryIcon,
|
|
17
|
+
className
|
|
18
|
+
}: SvelteThemeSwitcherProps = $props()
|
|
15
19
|
|
|
16
|
-
let currentTheme = ''
|
|
20
|
+
let currentTheme = $state('')
|
|
17
21
|
let toggled = false
|
|
18
22
|
|
|
19
23
|
const classes = classNames([
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
|
|
25
29
|
const primaryTheme = themes[Object.keys(themes)[0]]
|
|
26
30
|
const secondaryTheme = themes[Object.keys(themes)[1]]
|
|
27
|
-
const useIcons =
|
|
31
|
+
const useIcons = primaryIcon && secondaryIcon
|
|
28
32
|
|
|
29
33
|
const setTheme = (theme: string | number) => {
|
|
30
34
|
if (typeof theme === 'number') {
|
|
@@ -62,7 +66,7 @@
|
|
|
62
66
|
>
|
|
63
67
|
{#each Object.keys(themes) as theme, index}
|
|
64
68
|
<button
|
|
65
|
-
|
|
69
|
+
onclick={() => setTheme(toggle ? index : themes[theme])}
|
|
66
70
|
style={!useIcons ? `background:${theme};` : undefined}
|
|
67
71
|
data-active={currentTheme === themes[theme]}
|
|
68
72
|
aria-label={themes[theme]}
|
|
@@ -71,8 +75,8 @@
|
|
|
71
75
|
useIcons && styles.icons
|
|
72
76
|
])}
|
|
73
77
|
>
|
|
74
|
-
{#if index === 0}
|
|
75
|
-
{#if index !== 0}
|
|
78
|
+
{#if index === 0}{@render primaryIcon?.()}{/if}
|
|
79
|
+
{#if index !== 0}{@render secondaryIcon?.()}{/if}
|
|
76
80
|
</button>
|
|
77
81
|
{/each}
|
|
78
82
|
</div>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type ThemeSwitcherProps = {
|
|
2
4
|
themes: {
|
|
3
5
|
[key: string]: string
|
|
@@ -7,6 +9,11 @@ export type ThemeSwitcherProps = {
|
|
|
7
9
|
className?: string
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
export type SvelteThemeSwitcherProps = {
|
|
13
|
+
primaryIcon?: Snippet
|
|
14
|
+
secondaryIcon?: Snippet
|
|
15
|
+
} & ThemeSwitcherProps
|
|
16
|
+
|
|
10
17
|
export type ReactThemeSwitcherProps = {
|
|
11
18
|
primaryIcon?: React.ReactNode
|
|
12
19
|
secondaryIcon?: React.ReactNode
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteTimelineProps } from './timeline'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './timeline.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const {
|
|
9
|
+
theme,
|
|
10
|
+
counter,
|
|
11
|
+
alternate,
|
|
12
|
+
centered,
|
|
13
|
+
color,
|
|
14
|
+
textColor,
|
|
15
|
+
className,
|
|
16
|
+
children
|
|
17
|
+
}: SvelteTimelineProps = $props()
|
|
15
18
|
|
|
16
19
|
const classes = classNames([
|
|
17
20
|
styles.timeline,
|
|
@@ -29,5 +32,5 @@
|
|
|
29
32
|
</script>
|
|
30
33
|
|
|
31
34
|
<ul class={classes} style={styleVariables || null}>
|
|
32
|
-
|
|
35
|
+
{@render children?.()}
|
|
33
36
|
</ul>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type TimelineProps = {
|
|
2
|
-
theme?: 'fill' | 'stroke' | 'stroke fill'
|
|
4
|
+
theme?: 'fill' | 'stroke' | 'stroke fill'
|
|
3
5
|
alternate?: boolean
|
|
4
6
|
centered?: boolean
|
|
5
7
|
color?: string
|
|
@@ -53,9 +55,12 @@ export type TimelineProps = {
|
|
|
53
55
|
| 'upper-alpha'
|
|
54
56
|
| 'upper-armenian'
|
|
55
57
|
| 'upper-roman'
|
|
56
|
-
| null
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
export type SvelteTimelineProps = {
|
|
61
|
+
children: Snippet
|
|
62
|
+
} & TimelineProps
|
|
63
|
+
|
|
59
64
|
export type ReactTimelineProps = {
|
|
60
65
|
children: React.ReactNode
|
|
61
66
|
} & TimelineProps
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteTimelineItemProps } from './timelineitem'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './timelineitem.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const {
|
|
9
|
+
title,
|
|
10
|
+
titleTag = 'span',
|
|
11
|
+
className,
|
|
12
|
+
children
|
|
13
|
+
}: SvelteTimelineItemProps = $props()
|
|
11
14
|
|
|
12
15
|
const classes = classNames([
|
|
13
16
|
styles.item,
|
|
@@ -21,5 +24,5 @@
|
|
|
21
24
|
{title}
|
|
22
25
|
</svelte:element>
|
|
23
26
|
{/if}
|
|
24
|
-
|
|
27
|
+
{@render children?.()}
|
|
25
28
|
</li>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type TimelineItemProps = {
|
|
2
4
|
title?: string
|
|
3
5
|
titleTag?: string
|
|
4
6
|
className?: string
|
|
5
7
|
}
|
|
6
8
|
|
|
9
|
+
export type SvelteTimelineItemProps = {
|
|
10
|
+
children: Snippet
|
|
11
|
+
} & TimelineItemProps
|
|
12
|
+
|
|
7
13
|
export type ReactTimelineItemProps = {
|
|
8
14
|
TitleTag?: keyof JSX.IntrinsicElements
|
|
9
15
|
children: React.ReactNode
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteToastProps } from './toast'
|
|
3
3
|
|
|
4
4
|
import Alert from '../Alert/Alert.svelte'
|
|
5
5
|
|
|
@@ -7,8 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './toast.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const {
|
|
11
|
+
position,
|
|
12
|
+
className,
|
|
13
|
+
icon,
|
|
14
|
+
children,
|
|
15
|
+
...rest
|
|
16
|
+
}: SvelteToastProps = $props()
|
|
12
17
|
|
|
13
18
|
const classes = classNames([
|
|
14
19
|
styles.toast,
|
|
@@ -24,16 +29,19 @@
|
|
|
24
29
|
'data-id': 'body'
|
|
25
30
|
}
|
|
26
31
|
}
|
|
32
|
+
|
|
33
|
+
const iconRender = $derived(icon)
|
|
27
34
|
</script>
|
|
28
35
|
|
|
29
|
-
{#if
|
|
30
|
-
<Alert {
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
{#if icon}
|
|
37
|
+
<Alert {...rest} className={classes} {...additionalProps}>
|
|
38
|
+
{#snippet icon()}
|
|
39
|
+
{@render iconRender?.()}
|
|
40
|
+
{/snippet}
|
|
41
|
+
{@render children?.()}
|
|
33
42
|
</Alert>
|
|
34
43
|
{:else}
|
|
35
|
-
<Alert {
|
|
36
|
-
|
|
44
|
+
<Alert {...rest} className={classes} {...additionalProps}>
|
|
45
|
+
{@render children?.()}
|
|
37
46
|
</Alert>
|
|
38
47
|
{/if}
|
|
39
|
-
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AlertProps,
|
|
3
|
+
ReactAlertProps,
|
|
4
|
+
SvelteAlertProps
|
|
5
|
+
} from '../Alert/alert'
|
|
2
6
|
|
|
3
7
|
export type ToastProps = {
|
|
4
8
|
position?: 'bottom-left'
|
|
@@ -10,4 +14,5 @@ export type ToastProps = {
|
|
|
10
14
|
[key: string]: any
|
|
11
15
|
} & AlertProps
|
|
12
16
|
|
|
17
|
+
export type SvelteToastProps = ToastProps & SvelteAlertProps
|
|
13
18
|
export type ReactToastProps = ToastProps & ReactAlertProps
|
package/icons/alert.svg
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 6.65522V13.3774M12 17.3448V16.7337M6.87278 1.57322C7.30667 1.14056 7.66233 1 8.25633 1H15.7437C16.3377 1 16.6946 1.14056 17.1272 1.57322L22.4268 6.87278C22.8594 7.30544 23 7.66233 23 8.25633V15.7437C23 16.3548 22.8472 16.7068 22.4268 17.1272L17.1272 22.4268C16.6946 22.8594 16.3377 23 15.7437 23H8.25633C7.64522 23 7.29322 22.8472 6.87278 22.4268L1.57444 17.1272C1.14056 16.6933 1 16.3377 1 15.7437V8.25633C1 7.64522 1.15278 7.29322 1.57322 6.87278L6.87278 1.57322Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
</svg>
|
package/icons/check.svg
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M1 14.927L3.94433 18.0266C5.56867 19.7367 6.38083 20.5899 7.29017 20.8599C8.0895 21.0957 8.94017 21.0327 9.701 20.6799C10.5682 20.2767 11.263 19.3101 12.6563 17.375L23 3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
</svg>
|