webcoreui 0.9.0 → 0.10.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 +22 -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
package/README.md
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
alt="Build"
|
|
27
27
|
/>
|
|
28
28
|
</a>
|
|
29
|
+
<a href="https://www.npmjs.com/package/webcoreui">
|
|
30
|
+
<img
|
|
31
|
+
src="https://img.shields.io/npm/d18m/webcoreui.svg?color=black"
|
|
32
|
+
alt="NPM"
|
|
33
|
+
/>
|
|
34
|
+
</a>
|
|
29
35
|
</p>
|
|
30
36
|
|
|
31
37
|
> [!IMPORTANT]
|
|
@@ -58,18 +64,18 @@ Webcore can be used as a standalone project, or it can be integrated into your e
|
|
|
58
64
|
|
|
59
65
|
Webcore components use Sass for styling. To use the component library, you must have the following packages installed:
|
|
60
66
|
|
|
61
|
-
- [Sass](https://www.npmjs.com/package/sass) - `v1.
|
|
62
|
-
- [TypeScript](https://www.npmjs.com/package/typescript) - `v5.
|
|
67
|
+
- [Sass](https://www.npmjs.com/package/sass) - `v1.83`
|
|
68
|
+
- [TypeScript](https://www.npmjs.com/package/typescript) - `v5.7`
|
|
63
69
|
|
|
64
70
|
Depending on your project setup, you'll also need the following packages:
|
|
65
71
|
|
|
66
72
|
- **For Astro projects**
|
|
67
|
-
- [Astro](https://www.npmjs.com/package/astro) - `
|
|
73
|
+
- [Astro](https://www.npmjs.com/package/astro) - `v5.1`
|
|
68
74
|
- **For Svelte projects**
|
|
69
|
-
- [Svelte](https://www.npmjs.com/package/svelte) - `
|
|
75
|
+
- [Svelte](https://www.npmjs.com/package/svelte) - `v5.19`
|
|
70
76
|
- **For React projects**
|
|
71
|
-
- [React](https://www.npmjs.com/package/react) - `
|
|
72
|
-
- [React DOM](https://www.npmjs.com/package/react-dom) -`
|
|
77
|
+
- [React](https://www.npmjs.com/package/react) - `v19.0`
|
|
78
|
+
- [React DOM](https://www.npmjs.com/package/react-dom) -`v19.0`
|
|
73
79
|
|
|
74
80
|
### Installation
|
|
75
81
|
|
|
@@ -277,6 +283,7 @@ import { Accordion } from 'webcoreui/react'
|
|
|
277
283
|
|
|
278
284
|
## Blocks
|
|
279
285
|
|
|
286
|
+
- [Author](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Author)
|
|
280
287
|
- [BlogCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/BlogCard)
|
|
281
288
|
- [ComponentMap](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/ComponentMap)
|
|
282
289
|
- [DeviceMockup](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/DeviceMockup)
|
|
@@ -284,9 +291,18 @@ import { Accordion } from 'webcoreui/react'
|
|
|
284
291
|
- [FAQ](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/FAQ)
|
|
285
292
|
- [GridWithIcons](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/GridWithIcons)
|
|
286
293
|
- [Hero](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Hero)
|
|
294
|
+
- [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Icon)
|
|
287
295
|
- [IconList](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/IconList)
|
|
296
|
+
- [Layout](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Layout)
|
|
297
|
+
- [SEO](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SEO)
|
|
288
298
|
- [SettingCard](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SettingCard)
|
|
289
299
|
- [SignUp](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SignUp)
|
|
290
300
|
- [SocialProof](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/SocialProof)
|
|
301
|
+
- [Socials](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Socials)
|
|
291
302
|
- [Tiles](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/Tiles)
|
|
292
303
|
- [User](https://github.com/Frontendland/webcoreui/tree/main/src/blocks/User)
|
|
304
|
+
|
|
305
|
+
## Templates
|
|
306
|
+
|
|
307
|
+
- [Portfolio](https://github.com/Frontendland/webcoreui/tree/main/src/templates/Portfolio)
|
|
308
|
+
- [ProductPage](https://github.com/Frontendland/webcoreui/tree/main/src/templates/ProductPage)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { AccordionProps } from './accordion'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
5
5
|
import Plus from '../../icons/plus.svg?raw'
|
|
6
6
|
|
|
7
7
|
import styles from './accordion.module.scss'
|
|
@@ -32,7 +32,7 @@ const classes = [
|
|
|
32
32
|
>
|
|
33
33
|
{item.title}
|
|
34
34
|
{icon !== 'none' && (
|
|
35
|
-
<Fragment set:html={icon === 'plus' ? Plus :
|
|
35
|
+
<Fragment set:html={icon === 'plus' ? Plus : ChevronDown} />
|
|
36
36
|
)}
|
|
37
37
|
</button>
|
|
38
38
|
<div class={styles.wrapper}>
|
|
@@ -45,13 +45,18 @@ const classes = [
|
|
|
45
45
|
<script>
|
|
46
46
|
import { on } from '../../utils/DOMUtils'
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const addEventListeners = () => {
|
|
49
|
+
on('[data-id="w-accordion"]', 'click', (event: Event) => {
|
|
50
|
+
const target = event.target as HTMLDivElement
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
if (target.dataset.toggle) {
|
|
53
|
+
target.dataset.open = target.dataset.open === 'true'
|
|
54
|
+
? 'false'
|
|
55
|
+
: 'true'
|
|
56
|
+
}
|
|
57
|
+
}, true)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
on(document, 'astro:after-swap', addEventListeners)
|
|
61
|
+
addEventListeners()
|
|
57
62
|
</script>
|
|
@@ -3,22 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
7
7
|
import Plus from '../../icons/plus.svg?raw'
|
|
8
8
|
|
|
9
9
|
import styles from './accordion.module.scss'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const {
|
|
12
|
+
items,
|
|
13
|
+
icon,
|
|
14
|
+
reverse,
|
|
15
|
+
className
|
|
16
|
+
}: AccordionProps = $props()
|
|
15
17
|
|
|
16
|
-
let
|
|
18
|
+
let toggleState = $state(Array(items.length).fill(false))
|
|
17
19
|
|
|
18
20
|
const toggle = (index: number) => {
|
|
19
|
-
|
|
20
|
-
? !
|
|
21
|
-
:
|
|
21
|
+
toggleState = toggleState.map((_, i) => index === i
|
|
22
|
+
? !toggleState[i]
|
|
23
|
+
: toggleState[i]
|
|
22
24
|
)
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -38,12 +40,12 @@
|
|
|
38
40
|
styles.title,
|
|
39
41
|
item.reverse && styles.reverse
|
|
40
42
|
])}
|
|
41
|
-
data-open={
|
|
42
|
-
|
|
43
|
+
data-open={toggleState[index]}
|
|
44
|
+
onclick={() => toggle(index)}
|
|
43
45
|
>
|
|
44
46
|
{item.title}
|
|
45
47
|
{#if icon !== 'none'}
|
|
46
|
-
{@html icon === 'plus' ? Plus :
|
|
48
|
+
{@html icon === 'plus' ? Plus : ChevronDown}
|
|
47
49
|
{/if}
|
|
48
50
|
</button>
|
|
49
51
|
<div class={styles.wrapper}>
|
|
@@ -3,7 +3,7 @@ import type { AccordionProps } from './accordion'
|
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
7
7
|
import Plus from '../../icons/plus.svg?raw'
|
|
8
8
|
|
|
9
9
|
import styles from './accordion.module.scss'
|
|
@@ -43,7 +43,7 @@ const Accordion = ({
|
|
|
43
43
|
])}
|
|
44
44
|
dangerouslySetInnerHTML={{ __html: icon === 'none'
|
|
45
45
|
? item.title
|
|
46
|
-
: `${item.title} ${icon === 'plus' ? Plus :
|
|
46
|
+
: `${item.title} ${icon === 'plus' ? Plus : ChevronDown}`
|
|
47
47
|
}}
|
|
48
48
|
/>
|
|
49
49
|
<div className={styles.wrapper}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteAlertProps } from './alert'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
5
|
|
|
@@ -10,13 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
import styles from './alert.module.scss'
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const {
|
|
14
|
+
element = 'section',
|
|
15
|
+
title,
|
|
16
|
+
titleTag = 'strong',
|
|
17
|
+
titleProps,
|
|
18
|
+
bodyProps,
|
|
19
|
+
className,
|
|
20
|
+
theme,
|
|
21
|
+
icon,
|
|
22
|
+
children,
|
|
23
|
+
...rest
|
|
24
|
+
}: SvelteAlertProps = $props()
|
|
20
25
|
|
|
21
26
|
const iconMap = {
|
|
22
27
|
info,
|
|
@@ -25,7 +30,7 @@
|
|
|
25
30
|
alert
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
const hasCustomIcon =
|
|
33
|
+
const hasCustomIcon = icon
|
|
29
34
|
|
|
30
35
|
const classes = [
|
|
31
36
|
styles['w-alert'],
|
|
@@ -35,8 +40,8 @@
|
|
|
35
40
|
].filter(Boolean).join(' ')
|
|
36
41
|
</script>
|
|
37
42
|
|
|
38
|
-
<svelte:element this={element} class={classes} {
|
|
39
|
-
|
|
43
|
+
<svelte:element this={element} class={classes} {...rest}>
|
|
44
|
+
{@render icon?.()}
|
|
40
45
|
|
|
41
46
|
{#if !hasCustomIcon && theme}
|
|
42
47
|
{@html iconMap[theme]}
|
|
@@ -53,7 +58,7 @@
|
|
|
53
58
|
</svelte:element>
|
|
54
59
|
{/if}
|
|
55
60
|
<div class={styles.body} {...bodyProps}>
|
|
56
|
-
|
|
61
|
+
{@render children?.()}
|
|
57
62
|
</div>
|
|
58
63
|
</ConditionalWrapper>
|
|
59
64
|
</svelte:element>
|
|
@@ -40,7 +40,7 @@ const Alert = ({
|
|
|
40
40
|
<Element className={classes} {...rest}>
|
|
41
41
|
{icon && icon}
|
|
42
42
|
{!icon && theme && <div
|
|
43
|
-
dangerouslySetInnerHTML={{ __html: iconMap[theme] }}
|
|
43
|
+
dangerouslySetInnerHTML={{ __html: iconMap[theme as keyof typeof iconMap] }}
|
|
44
44
|
style={{ height: '20px' }}
|
|
45
45
|
/>}
|
|
46
46
|
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type AlertProps = {
|
|
2
4
|
element?: string
|
|
3
|
-
title?: string
|
|
5
|
+
title?: string
|
|
4
6
|
titleTag?: string
|
|
5
7
|
titleProps?: any
|
|
6
8
|
bodyProps?: any
|
|
7
|
-
className?: string
|
|
9
|
+
className?: string
|
|
8
10
|
theme?: 'info'
|
|
9
11
|
| 'success'
|
|
10
12
|
| 'warning'
|
|
11
13
|
| 'alert'
|
|
12
|
-
|
|
14
|
+
[key: string]: any
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
export type SvelteAlertProps = {
|
|
18
|
+
icon?: Snippet
|
|
19
|
+
children: Snippet
|
|
20
|
+
} & AlertProps
|
|
21
|
+
|
|
15
22
|
export type ReactAlertProps = {
|
|
16
23
|
Element?: keyof JSX.IntrinsicElements
|
|
17
24
|
TitleTag?: keyof JSX.IntrinsicElements
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteAspectRatioProps } from './aspectratio'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './aspect-ratio.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const {
|
|
9
|
+
ratio,
|
|
10
|
+
className,
|
|
11
|
+
children
|
|
12
|
+
}: SvelteAspectRatioProps = $props()
|
|
10
13
|
|
|
11
14
|
const classes = classNames([
|
|
12
15
|
styles.ratio,
|
|
@@ -15,5 +18,5 @@
|
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
20
|
<div class={classes} style={`aspect-ratio: ${ratio.replace(':', '/')};`}>
|
|
18
|
-
|
|
21
|
+
{@render children?.()}
|
|
19
22
|
</div>
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type AspectRatioProps = {
|
|
2
4
|
ratio: string
|
|
3
5
|
className?: string
|
|
4
6
|
}
|
|
5
7
|
|
|
8
|
+
export type SvelteAspectRatioProps = {
|
|
9
|
+
children: Snippet
|
|
10
|
+
} & AspectRatioProps
|
|
11
|
+
|
|
6
12
|
export type ReactAspectRatioProps = {
|
|
7
13
|
children: React.ReactNode
|
|
8
14
|
} & AspectRatioProps
|
|
@@ -5,15 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './avatar.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const {
|
|
9
|
+
img,
|
|
10
|
+
alt = 'Avatar',
|
|
11
|
+
size = 40,
|
|
12
|
+
lazy = true,
|
|
13
|
+
borderColor,
|
|
14
|
+
borderless,
|
|
15
|
+
reverse,
|
|
16
|
+
className,
|
|
17
|
+
groupClassName
|
|
18
|
+
}: AvatarProps = $props()
|
|
17
19
|
|
|
18
20
|
const classes = classNames([
|
|
19
21
|
styles.avatar,
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './badge.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const {
|
|
9
|
+
theme,
|
|
10
|
+
hover,
|
|
11
|
+
small,
|
|
12
|
+
rounded,
|
|
13
|
+
className,
|
|
14
|
+
onClick,
|
|
15
|
+
children,
|
|
16
|
+
...rest
|
|
17
|
+
}: SvelteBadgeProps = $props()
|
|
14
18
|
|
|
15
19
|
const classes = classNames([
|
|
16
20
|
styles.badge,
|
|
@@ -23,12 +27,12 @@
|
|
|
23
27
|
</script>
|
|
24
28
|
|
|
25
29
|
{#if onClick}
|
|
26
|
-
<button class={classes}
|
|
27
|
-
|
|
30
|
+
<button class={classes} onclick={onClick} {...rest}>
|
|
31
|
+
{@render children?.()}
|
|
28
32
|
</button>
|
|
29
33
|
{:else}
|
|
30
|
-
<span class={classes} {
|
|
31
|
-
|
|
34
|
+
<span class={classes} {...rest}>
|
|
35
|
+
{@render children?.()}
|
|
32
36
|
</span>
|
|
33
37
|
{/if}
|
|
34
38
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
1
2
|
import type { MouseEventHandler } from 'svelte/elements'
|
|
2
3
|
|
|
3
4
|
export type BadgeProps = {
|
|
@@ -8,7 +9,6 @@ export type BadgeProps = {
|
|
|
8
9
|
| 'success'
|
|
9
10
|
| 'warning'
|
|
10
11
|
| 'alert'
|
|
11
|
-
| null
|
|
12
12
|
hover?: boolean
|
|
13
13
|
small?: boolean
|
|
14
14
|
rounded?: boolean
|
|
@@ -18,6 +18,7 @@ export type BadgeProps = {
|
|
|
18
18
|
|
|
19
19
|
export type SvelteBadgeProps = {
|
|
20
20
|
onClick?: MouseEventHandler<HTMLButtonElement> | null
|
|
21
|
+
children?: Snippet
|
|
21
22
|
} & BadgeProps
|
|
22
23
|
|
|
23
24
|
export type ReactBadgeProps = {
|
|
@@ -39,6 +39,7 @@ const style = top
|
|
|
39
39
|
theme="flat"
|
|
40
40
|
className={styles.close}
|
|
41
41
|
data-id="w-banner-close"
|
|
42
|
+
aria-label="close"
|
|
42
43
|
>
|
|
43
44
|
<Fragment set:html={closeIcon} />
|
|
44
45
|
</Button>
|
|
@@ -48,9 +49,14 @@ const style = top
|
|
|
48
49
|
<script>
|
|
49
50
|
import { on } from '../../utils/DOMUtils'
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const addEventListeners = () => {
|
|
53
|
+
on('[data-id="w-banner-close"]', 'click', (event: Event) => {
|
|
54
|
+
const target = event.currentTarget as HTMLDivElement
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
target.parentElement?.remove()
|
|
57
|
+
}, true)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
on(document, 'astro:after-swap', addEventListeners)
|
|
61
|
+
addEventListeners()
|
|
56
62
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteBannerProps } from './banner'
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.svelte'
|
|
5
5
|
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
import styles from './banner.module.scss'
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const {
|
|
13
|
+
top,
|
|
14
|
+
bottom,
|
|
15
|
+
closeable,
|
|
16
|
+
padded,
|
|
17
|
+
sticky = true,
|
|
18
|
+
className,
|
|
19
|
+
children
|
|
20
|
+
}: SvelteBannerProps = $props()
|
|
20
21
|
|
|
21
22
|
const classes = classNames([
|
|
22
23
|
styles.banner,
|
|
@@ -29,16 +30,19 @@
|
|
|
29
30
|
const style = top
|
|
30
31
|
? `--w-banner-top: ${top}px;`
|
|
31
32
|
: null
|
|
33
|
+
|
|
34
|
+
let visible = $state(true)
|
|
32
35
|
</script>
|
|
33
36
|
|
|
34
37
|
{#if visible}
|
|
35
38
|
<div class={classes} style={style}>
|
|
36
|
-
|
|
39
|
+
{@render children?.()}
|
|
37
40
|
{#if closeable}
|
|
38
41
|
<Button
|
|
39
42
|
theme="flat"
|
|
40
43
|
className={styles.close}
|
|
41
44
|
onClick={() => visible = false}
|
|
45
|
+
aria-label="close"
|
|
42
46
|
>
|
|
43
47
|
{@html closeIcon}
|
|
44
48
|
</Button>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type BannerProps = {
|
|
2
4
|
top?: number
|
|
3
5
|
bottom?: boolean
|
|
@@ -7,6 +9,10 @@ export type BannerProps = {
|
|
|
7
9
|
className?: string
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
export type SvelteBannerProps = {
|
|
13
|
+
children: Snippet
|
|
14
|
+
} & BannerProps
|
|
15
|
+
|
|
10
16
|
export type ReactBannerProps = {
|
|
11
17
|
children: React.ReactNode
|
|
12
18
|
} & BannerProps
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './bottomnavigation.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const {
|
|
9
|
+
items,
|
|
10
|
+
separated,
|
|
11
|
+
floating,
|
|
12
|
+
maxWidth,
|
|
13
|
+
className
|
|
14
|
+
}: BottomNavigationProps = $props()
|
|
13
15
|
|
|
14
16
|
const classes = classNames([
|
|
15
17
|
styles.nav,
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
9
9
|
|
|
10
10
|
import styles from './breadcrumb.module.scss'
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const {
|
|
13
|
+
items,
|
|
14
|
+
separator,
|
|
15
|
+
className
|
|
16
|
+
}: BreadcrumbProps = $props()
|
|
15
17
|
|
|
16
18
|
const classes = classNames([
|
|
17
19
|
styles.breadcrumb,
|
|
@@ -36,9 +38,9 @@
|
|
|
36
38
|
{/if}
|
|
37
39
|
</ConditionalWrapper>
|
|
38
40
|
</li>
|
|
39
|
-
{#if index < items.length - 1
|
|
41
|
+
{#if index < items.length - 1}
|
|
40
42
|
<li>
|
|
41
|
-
{@html separator ||
|
|
43
|
+
{@html separator || ChevronRight}
|
|
42
44
|
</li>
|
|
43
45
|
{/if}
|
|
44
46
|
{/each}
|
|
@@ -5,7 +5,7 @@ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
|
5
5
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
9
9
|
|
|
10
10
|
import styles from './breadcrumb.module.scss'
|
|
11
11
|
|
|
@@ -38,7 +38,7 @@ const Breadcrumb = ({
|
|
|
38
38
|
<li>
|
|
39
39
|
{separator
|
|
40
40
|
? separator
|
|
41
|
-
: <span dangerouslySetInnerHTML={{ __html:
|
|
41
|
+
: <span dangerouslySetInnerHTML={{ __html: ChevronRight }} />
|
|
42
42
|
}
|
|
43
43
|
</li>
|
|
44
44
|
)}
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './button.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const {
|
|
9
|
+
theme,
|
|
10
|
+
href,
|
|
11
|
+
className,
|
|
12
|
+
onClick,
|
|
13
|
+
children,
|
|
14
|
+
...rest
|
|
15
|
+
}: SvelteButtonProps = $props()
|
|
12
16
|
|
|
13
17
|
const classes = classNames([
|
|
14
18
|
styles.button,
|
|
@@ -19,11 +23,11 @@
|
|
|
19
23
|
|
|
20
24
|
|
|
21
25
|
{#if href}
|
|
22
|
-
<a {
|
|
23
|
-
|
|
26
|
+
<a {...rest} href={href} class={classes}>
|
|
27
|
+
{@render children?.()}
|
|
24
28
|
</a>
|
|
25
29
|
{:else}
|
|
26
|
-
<button {
|
|
27
|
-
|
|
30
|
+
<button {...rest} class={classes} onclick={onClick}>
|
|
31
|
+
{@render children?.()}
|
|
28
32
|
</button>
|
|
29
33
|
{/if}
|
|
@@ -21,14 +21,14 @@ const Button = ({
|
|
|
21
21
|
|
|
22
22
|
if (href) {
|
|
23
23
|
return (
|
|
24
|
-
<a {...rest} href={href} className={classes
|
|
24
|
+
<a {...rest} href={href} className={classes}>
|
|
25
25
|
{children}
|
|
26
26
|
</a>
|
|
27
27
|
)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<button {...rest} className={classes
|
|
31
|
+
<button {...rest} className={classes} onClick={onClick}>
|
|
32
32
|
{children}
|
|
33
33
|
</button>
|
|
34
34
|
)
|