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
|
@@ -1,147 +1,149 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ListEventType,SvelteListProps } from './list'
|
|
3
|
-
|
|
4
|
-
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
|
-
import Input from '../Input/Input.svelte'
|
|
6
|
-
|
|
7
|
-
import { classNames } from '../../utils/classNames'
|
|
8
|
-
|
|
9
|
-
import searchIcon from '../../icons/search.svg?raw'
|
|
10
|
-
|
|
11
|
-
import styles from './list.module.scss'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
data-
|
|
112
|
-
data-
|
|
113
|
-
data-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
|
|
147
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ListEventType,SvelteListProps } from './list'
|
|
3
|
+
|
|
4
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
|
+
import Input from '../Input/Input.svelte'
|
|
6
|
+
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
import searchIcon from '../../icons/search.svg?raw'
|
|
10
|
+
|
|
11
|
+
import styles from './list.module.scss'
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
showSearchBar,
|
|
15
|
+
showSearchBarIcon,
|
|
16
|
+
searchBarPlaceholder,
|
|
17
|
+
noResultsLabel = 'No results.',
|
|
18
|
+
maxHeight,
|
|
19
|
+
id,
|
|
20
|
+
className,
|
|
21
|
+
wrapperClassName,
|
|
22
|
+
itemGroups = $bindable([]),
|
|
23
|
+
onSelect
|
|
24
|
+
}: SvelteListProps = $props()
|
|
25
|
+
|
|
26
|
+
let searchValue = $state('')
|
|
27
|
+
let numberOfResults = $state(1)
|
|
28
|
+
|
|
29
|
+
const classes = classNames([
|
|
30
|
+
styles.list,
|
|
31
|
+
!showSearchBar && styles.container,
|
|
32
|
+
className
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
const wrapperClasses = classNames([
|
|
36
|
+
styles.container,
|
|
37
|
+
wrapperClassName
|
|
38
|
+
])
|
|
39
|
+
|
|
40
|
+
const search = (event: InputEvent) => {
|
|
41
|
+
searchValue = (event.target as HTMLInputElement).value.toLowerCase()
|
|
42
|
+
|
|
43
|
+
numberOfResults = itemGroups
|
|
44
|
+
.map(group => group.items)
|
|
45
|
+
.flat()
|
|
46
|
+
.filter(item => {
|
|
47
|
+
return item.value?.toLowerCase().includes(searchValue)
|
|
48
|
+
|| item.subText?.toLowerCase().includes(searchValue)
|
|
49
|
+
|| item.name.toLowerCase().includes(searchValue)
|
|
50
|
+
}).length
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const select = (event: MouseEvent | KeyboardEvent) => {
|
|
54
|
+
const li = event.target as HTMLLIElement
|
|
55
|
+
|
|
56
|
+
itemGroups = itemGroups.map(group => {
|
|
57
|
+
group.items = group.items.map(item => {
|
|
58
|
+
item.selected = li.dataset.name === item.name
|
|
59
|
+
|
|
60
|
+
return item
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
return group
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
onSelect?.({
|
|
67
|
+
...li.dataset,
|
|
68
|
+
list: li.parentElement
|
|
69
|
+
} as ListEventType)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const selectByKey = (event: KeyboardEvent) => {
|
|
73
|
+
if (event.key === 'Enter') {
|
|
74
|
+
select(event)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<ConditionalWrapper
|
|
80
|
+
condition={!!showSearchBar}
|
|
81
|
+
class={wrapperClasses}
|
|
82
|
+
>
|
|
83
|
+
{#if showSearchBar}
|
|
84
|
+
<Input
|
|
85
|
+
type="search"
|
|
86
|
+
placeholder={searchBarPlaceholder}
|
|
87
|
+
onInput={search}
|
|
88
|
+
>
|
|
89
|
+
{#if showSearchBarIcon}
|
|
90
|
+
{@html searchIcon}
|
|
91
|
+
{/if}
|
|
92
|
+
</Input>
|
|
93
|
+
{/if}
|
|
94
|
+
<ul
|
|
95
|
+
class={classes}
|
|
96
|
+
id={id}
|
|
97
|
+
style={maxHeight ? `max-height: ${maxHeight}` : null}
|
|
98
|
+
>
|
|
99
|
+
{#each itemGroups as group}
|
|
100
|
+
{#if group.title}
|
|
101
|
+
<li class={styles.title}
|
|
102
|
+
data-hidden={searchValue ? true : null}
|
|
103
|
+
>
|
|
104
|
+
{group.title}
|
|
105
|
+
</li>
|
|
106
|
+
{/if}
|
|
107
|
+
{#each group.items as item}
|
|
108
|
+
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
109
|
+
<li
|
|
110
|
+
tabIndex={item.href || item.disabled ? undefined : 0}
|
|
111
|
+
data-value={item.value}
|
|
112
|
+
data-name={item.name}
|
|
113
|
+
data-disabled={item.disabled}
|
|
114
|
+
data-selected={item.selected ? true : undefined}
|
|
115
|
+
data-hidden={(
|
|
116
|
+
!item.value?.toLowerCase().includes(searchValue)
|
|
117
|
+
&& !item.subText?.toLowerCase().includes(searchValue)
|
|
118
|
+
&& !item.name.toLowerCase().includes(searchValue)
|
|
119
|
+
) ? true : null}
|
|
120
|
+
onclick={item.disabled ? null : select}
|
|
121
|
+
onkeyup={item.disabled ? null : selectByKey}
|
|
122
|
+
>
|
|
123
|
+
<ConditionalWrapper
|
|
124
|
+
condition={!!item.href}
|
|
125
|
+
element="a"
|
|
126
|
+
href={item.href}
|
|
127
|
+
target={item.target}
|
|
128
|
+
>
|
|
129
|
+
<ConditionalWrapper
|
|
130
|
+
condition={!!(item.icon && item.subText)}
|
|
131
|
+
>
|
|
132
|
+
{#if item.icon}
|
|
133
|
+
{@html item.icon}
|
|
134
|
+
{/if}
|
|
135
|
+
<div>{item.name}</div>
|
|
136
|
+
</ConditionalWrapper>
|
|
137
|
+
{#if item.subText}
|
|
138
|
+
<span>{item.subText}</span>
|
|
139
|
+
{/if}
|
|
140
|
+
</ConditionalWrapper>
|
|
141
|
+
</li>
|
|
142
|
+
{/each}
|
|
143
|
+
{/each}
|
|
144
|
+
|
|
145
|
+
{#if showSearchBar && !numberOfResults}
|
|
146
|
+
<li data-id="w-no-results">{noResultsLabel}</li>
|
|
147
|
+
{/if}
|
|
148
|
+
</ul>
|
|
149
|
+
</ConditionalWrapper>
|
package/components/List/List.tsx
CHANGED
|
@@ -42,7 +42,7 @@ const List = ({
|
|
|
42
42
|
: undefined
|
|
43
43
|
|
|
44
44
|
const search = (event: React.FormEvent<HTMLInputElement>) => {
|
|
45
|
-
const value = (event.target as HTMLInputElement).value
|
|
45
|
+
const value = (event.target as HTMLInputElement).value.toLowerCase()
|
|
46
46
|
|
|
47
47
|
setSearchValue(value)
|
|
48
48
|
setNumberOfResults(
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './masonry.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const {
|
|
9
|
+
items,
|
|
10
|
+
element = 'section',
|
|
11
|
+
gap,
|
|
12
|
+
columns = 3,
|
|
13
|
+
sequential,
|
|
14
|
+
className
|
|
15
|
+
}: SvelteMasonryProps = $props()
|
|
14
16
|
|
|
15
17
|
const classes = classNames([
|
|
16
18
|
styles.masonry,
|
|
@@ -36,15 +38,15 @@
|
|
|
36
38
|
<div class={styles.column}>
|
|
37
39
|
{#each group as item}
|
|
38
40
|
{#if item.component}
|
|
39
|
-
<
|
|
41
|
+
<item.component {...item.props}>
|
|
40
42
|
{#if typeof item.children === 'object' && item.children.component}
|
|
41
|
-
<
|
|
43
|
+
<item.children.component {...item.children.props}>
|
|
42
44
|
{@html item.children.children}
|
|
43
|
-
</
|
|
45
|
+
</item.children.component>
|
|
44
46
|
{:else}
|
|
45
47
|
{@html item.children}
|
|
46
48
|
{/if}
|
|
47
|
-
</
|
|
49
|
+
</item.component>
|
|
48
50
|
{:else}
|
|
49
51
|
{@html item.html}
|
|
50
52
|
{/if}
|
|
@@ -99,9 +99,10 @@ const wrapMenu = (logo?.url || logo?.html) && items?.length && Astro.slots.has('
|
|
|
99
99
|
</header>
|
|
100
100
|
|
|
101
101
|
<script>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
import { on } from '../../utils/DOMUtils'
|
|
103
|
+
|
|
104
|
+
const addToggle = () => {
|
|
105
|
+
on('[data-id="hamburger"]', 'click', (event: Event) => {
|
|
105
106
|
const hamburger = event.currentTarget as HTMLDivElement
|
|
106
107
|
const header = hamburger.parentElement?.parentElement as HTMLHeadElement
|
|
107
108
|
|
|
@@ -109,4 +110,8 @@ const wrapMenu = (logo?.url || logo?.html) && items?.length && Astro.slots.has('
|
|
|
109
110
|
? 'false'
|
|
110
111
|
: 'true'
|
|
111
112
|
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
on(document, 'astro:after-swap', addToggle)
|
|
116
|
+
addToggle()
|
|
112
117
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteMenuProps } from './menu'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
5
|
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './menu.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const {
|
|
11
|
+
items,
|
|
12
|
+
logo,
|
|
13
|
+
centerLogo,
|
|
14
|
+
className,
|
|
15
|
+
wrapperClassName,
|
|
16
|
+
children
|
|
17
|
+
}: SvelteMenuProps = $props()
|
|
15
18
|
|
|
16
19
|
const classes = classNames([
|
|
17
20
|
styles.menu,
|
|
@@ -23,9 +26,11 @@
|
|
|
23
26
|
wrapperClassName
|
|
24
27
|
])
|
|
25
28
|
|
|
26
|
-
const wrapMenu = (logo?.url || logo?.html)
|
|
29
|
+
const wrapMenu = (logo?.url || logo?.html)
|
|
30
|
+
&& items?.length
|
|
31
|
+
&& children
|
|
27
32
|
|
|
28
|
-
let active = false
|
|
33
|
+
let active = $state(false)
|
|
29
34
|
|
|
30
35
|
const toggleMenu = () => active = !active
|
|
31
36
|
</script>
|
|
@@ -70,7 +75,7 @@
|
|
|
70
75
|
{#if items?.length}
|
|
71
76
|
<button
|
|
72
77
|
class={styles.hamburger}
|
|
73
|
-
|
|
78
|
+
onclick={toggleMenu}
|
|
74
79
|
aria-label="menu"
|
|
75
80
|
>
|
|
76
81
|
<span class={styles.meat}></span>
|
|
@@ -97,6 +102,6 @@
|
|
|
97
102
|
</a>
|
|
98
103
|
{/if}
|
|
99
104
|
|
|
100
|
-
|
|
105
|
+
{@render children?.()}
|
|
101
106
|
</div>
|
|
102
107
|
</header>
|
package/components/Menu/Menu.tsx
CHANGED
package/components/Menu/menu.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
import type { ButtonProps } from '../Button/button'
|
|
2
4
|
|
|
3
5
|
export type MenuProps = {
|
|
@@ -19,6 +21,10 @@ export type MenuProps = {
|
|
|
19
21
|
wrapperClassName?: string
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
export type SvelteMenuProps = {
|
|
25
|
+
children?: Snippet
|
|
26
|
+
} & MenuProps
|
|
27
|
+
|
|
22
28
|
export type ReactMenuProps = {
|
|
23
29
|
children?: React.ReactNode
|
|
24
30
|
} & MenuProps
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteModalProps } from './modal'
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.svelte'
|
|
5
5
|
|
|
@@ -13,15 +13,19 @@
|
|
|
13
13
|
|
|
14
14
|
import styles from './modal.module.scss'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
const {
|
|
17
|
+
title,
|
|
18
|
+
subTitle,
|
|
19
|
+
showCloseIcon = true,
|
|
20
|
+
closeOnEsc = true,
|
|
21
|
+
closeOnOverlay = true,
|
|
22
|
+
transparent,
|
|
23
|
+
theme,
|
|
24
|
+
id,
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
...rest
|
|
28
|
+
}: SvelteModalProps = $props()
|
|
25
29
|
|
|
26
30
|
const iconMap = {
|
|
27
31
|
info,
|
|
@@ -48,13 +52,14 @@
|
|
|
48
52
|
class={classes}
|
|
49
53
|
id={id}
|
|
50
54
|
data-close={close.length ? close : undefined}
|
|
51
|
-
{
|
|
55
|
+
{...rest}
|
|
52
56
|
>
|
|
53
57
|
{#if showCloseIcon}
|
|
54
58
|
<Button
|
|
55
59
|
theme="flat"
|
|
56
60
|
className={styles.close}
|
|
57
61
|
data-id="close"
|
|
62
|
+
aria-label="close"
|
|
58
63
|
>
|
|
59
64
|
{@html closeIcon}
|
|
60
65
|
</Button>
|
|
@@ -70,6 +75,6 @@
|
|
|
70
75
|
{#if subTitle}
|
|
71
76
|
<div class={styles.subTitle}>{subTitle}</div>
|
|
72
77
|
{/if}
|
|
73
|
-
|
|
78
|
+
{@render children?.()}
|
|
74
79
|
</dialog>
|
|
75
|
-
<div class={styles.overlay}
|
|
80
|
+
<div class={styles.overlay}></div>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type ModalProps = {
|
|
2
4
|
title?: string
|
|
3
5
|
subTitle?: string
|
|
@@ -11,10 +13,13 @@ export type ModalProps = {
|
|
|
11
13
|
| 'success'
|
|
12
14
|
| 'warning'
|
|
13
15
|
| 'alert'
|
|
14
|
-
| null
|
|
15
16
|
[key: string]: any
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
export type SvelteModalProps = {
|
|
20
|
+
children: Snippet
|
|
21
|
+
} & ModalProps
|
|
22
|
+
|
|
18
23
|
export type ReactModalProps = {
|
|
19
24
|
children?: React.ReactNode
|
|
20
25
|
} & ModalProps
|