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
|
@@ -3,8 +3,8 @@ import type { PaginationProps } from './pagination'
|
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.astro'
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import ChevronLeft from '../../icons/chevron-left.svg?raw'
|
|
7
|
+
import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
8
8
|
|
|
9
9
|
import styles from './pagination.module.scss'
|
|
10
10
|
|
|
@@ -58,11 +58,12 @@ const generatedPages = pages?.length
|
|
|
58
58
|
>
|
|
59
59
|
{type === 'dots' ? (
|
|
60
60
|
<Fragment>
|
|
61
|
-
{generatedPages?.map(page => (
|
|
61
|
+
{generatedPages?.map((page, index) => (
|
|
62
62
|
<li>
|
|
63
63
|
<button
|
|
64
64
|
data-active={page.active ? 'true' : undefined}
|
|
65
65
|
data-page={page.label}
|
|
66
|
+
aria-label={`page ${index + 1}`}
|
|
66
67
|
/>
|
|
67
68
|
</li>
|
|
68
69
|
))}
|
|
@@ -75,7 +76,7 @@ const generatedPages = pages?.length
|
|
|
75
76
|
theme={theme}
|
|
76
77
|
data-page="prev"
|
|
77
78
|
>
|
|
78
|
-
{(showChevrons || type === 'arrows') && <Fragment set:html={
|
|
79
|
+
{(showChevrons || type === 'arrows') && <Fragment set:html={ChevronLeft} />}
|
|
79
80
|
{type !== 'arrows' && previousPageLabel}
|
|
80
81
|
</Button>
|
|
81
82
|
</li>
|
|
@@ -108,7 +109,7 @@ const generatedPages = pages?.length
|
|
|
108
109
|
data-page="next"
|
|
109
110
|
>
|
|
110
111
|
{type !== 'arrows' && nextPageLabel}
|
|
111
|
-
{(showChevrons || type === 'arrows') && <Fragment set:html={
|
|
112
|
+
{(showChevrons || type === 'arrows') && <Fragment set:html={ChevronRight} />}
|
|
112
113
|
</Button>
|
|
113
114
|
</li>
|
|
114
115
|
)}
|
|
@@ -117,75 +118,80 @@ const generatedPages = pages?.length
|
|
|
117
118
|
<script>
|
|
118
119
|
import { dispatch } from '../../utils/event'
|
|
119
120
|
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (next === 'next') {
|
|
126
|
-
return current + 1
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return pageElements?.findIndex(child => {
|
|
130
|
-
const button = child.children[0] as HTMLButtonElement
|
|
131
|
-
|
|
132
|
-
return button.dataset.page === next
|
|
133
|
-
}) + 1
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const paginations = document.querySelectorAll('[data-id="w-pagination"]')
|
|
137
|
-
|
|
138
|
-
Array.from(paginations).forEach(element => {
|
|
139
|
-
const pagination = element as HTMLUListElement
|
|
140
|
-
const totalPages = Number(pagination.dataset.totalPages)
|
|
141
|
-
let currentPage = Number(pagination.dataset.currentPage)
|
|
121
|
+
const addEventListeners = () => {
|
|
122
|
+
const getCurrentPage = (pageElements: Element[], current: number, next: string) => {
|
|
123
|
+
if (next === 'prev') {
|
|
124
|
+
return current - 1
|
|
125
|
+
}
|
|
142
126
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
&& !target.dataset.active
|
|
147
|
-
&& !target.disabled
|
|
127
|
+
if (next === 'next') {
|
|
128
|
+
return current + 1
|
|
129
|
+
}
|
|
148
130
|
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const nextPageButton = element.querySelector('[data-page="next"]') as HTMLButtonElement
|
|
152
|
-
const currentPageButton = element.querySelector('[data-active]') as HTMLButtonElement
|
|
153
|
-
const previousPage = currentPage
|
|
131
|
+
return pageElements?.findIndex(child => {
|
|
132
|
+
const button = child.children[0] as HTMLButtonElement
|
|
154
133
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const button = child.children[0] as HTMLButtonElement
|
|
134
|
+
return button.dataset.page === next
|
|
135
|
+
}) + 1
|
|
136
|
+
}
|
|
159
137
|
|
|
160
|
-
|
|
138
|
+
const paginations = document.querySelectorAll('[data-id="w-pagination"]')
|
|
139
|
+
|
|
140
|
+
Array.from(paginations).forEach(element => {
|
|
141
|
+
const pagination = element as HTMLUListElement
|
|
142
|
+
const totalPages = Number(pagination.dataset.totalPages)
|
|
143
|
+
let currentPage = Number(pagination.dataset.currentPage)
|
|
144
|
+
|
|
145
|
+
element.addEventListener('click', event => {
|
|
146
|
+
const target = event.target as HTMLButtonElement
|
|
147
|
+
const navigated = target.nodeName === 'BUTTON'
|
|
148
|
+
&& !target.dataset.active
|
|
149
|
+
&& !target.disabled
|
|
150
|
+
|
|
151
|
+
if (navigated) {
|
|
152
|
+
const prevPageButton = element.querySelector('[data-page="prev"]') as HTMLButtonElement
|
|
153
|
+
const nextPageButton = element.querySelector('[data-page="next"]') as HTMLButtonElement
|
|
154
|
+
const currentPageButton = element.querySelector('[data-active]') as HTMLButtonElement
|
|
155
|
+
const previousPage = currentPage
|
|
156
|
+
|
|
157
|
+
const pageElements = Array
|
|
158
|
+
.from(pagination.children)
|
|
159
|
+
.filter(child => {
|
|
160
|
+
const button = child.children[0] as HTMLButtonElement
|
|
161
|
+
|
|
162
|
+
return button.dataset.page && !['prev', 'next'].includes(button.dataset.page)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
currentPage = getCurrentPage(pageElements, currentPage, target.dataset.page || '')
|
|
166
|
+
currentPageButton?.removeAttribute('data-active')
|
|
167
|
+
|
|
168
|
+
pagination.dataset.currentPage = String(currentPage)
|
|
169
|
+
|
|
170
|
+
const activeButton = pageElements
|
|
171
|
+
.find((_, index) => index + 1 === currentPage)
|
|
172
|
+
?.children[0] as HTMLButtonElement
|
|
173
|
+
|
|
174
|
+
if (activeButton) {
|
|
175
|
+
activeButton.dataset.active = 'true'
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (prevPageButton && nextPageButton) {
|
|
179
|
+
prevPageButton.disabled = currentPage === 1
|
|
180
|
+
nextPageButton.disabled = currentPage === totalPages
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
dispatch('paginate', {
|
|
184
|
+
page: currentPage,
|
|
185
|
+
direction: previousPage > currentPage ? 'prev' : 'next',
|
|
186
|
+
...(activeButton?.dataset.page && { label: activeButton?.dataset.page }),
|
|
187
|
+
target: element,
|
|
188
|
+
trusted: event.isTrusted
|
|
161
189
|
})
|
|
162
|
-
|
|
163
|
-
currentPage = getCurrentPage(pageElements, currentPage, target.dataset.page || '')
|
|
164
|
-
currentPageButton?.removeAttribute('data-active')
|
|
165
|
-
|
|
166
|
-
pagination.dataset.currentPage = String(currentPage)
|
|
167
|
-
|
|
168
|
-
const activeButton = pageElements
|
|
169
|
-
.find((_, index) => index + 1 === currentPage)
|
|
170
|
-
?.children[0] as HTMLButtonElement
|
|
171
|
-
|
|
172
|
-
if (activeButton) {
|
|
173
|
-
activeButton.dataset.active = 'true'
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (prevPageButton && nextPageButton) {
|
|
177
|
-
prevPageButton.disabled = currentPage === 1
|
|
178
|
-
nextPageButton.disabled = currentPage === totalPages
|
|
179
190
|
}
|
|
180
|
-
|
|
181
|
-
dispatch('paginate', {
|
|
182
|
-
page: currentPage,
|
|
183
|
-
direction: previousPage > currentPage ? 'prev' : 'next',
|
|
184
|
-
...(activeButton?.dataset.page && { label: activeButton?.dataset.page }),
|
|
185
|
-
target: element,
|
|
186
|
-
trusted: event.isTrusted
|
|
187
|
-
})
|
|
188
|
-
}
|
|
191
|
+
})
|
|
189
192
|
})
|
|
190
|
-
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
document.addEventListener('astro:after-swap', addEventListeners)
|
|
196
|
+
addEventListeners()
|
|
191
197
|
</script>
|
|
@@ -5,26 +5,28 @@
|
|
|
5
5
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import ChevronLeft from '../../icons/chevron-left.svg?raw'
|
|
9
|
+
import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
10
10
|
|
|
11
11
|
import styles from './pagination.module.scss'
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
const {
|
|
14
|
+
type,
|
|
15
|
+
showChevrons,
|
|
16
|
+
showDots,
|
|
17
|
+
disablePrevious,
|
|
18
|
+
disableNext,
|
|
19
|
+
previousLink,
|
|
20
|
+
nextLink,
|
|
21
|
+
previousPageLabel = 'Previous',
|
|
22
|
+
nextPageLabel = 'Next',
|
|
23
|
+
pages,
|
|
24
|
+
theme = 'outline',
|
|
25
|
+
totalPages,
|
|
26
|
+
currentPage,
|
|
27
|
+
onChange,
|
|
28
|
+
className
|
|
29
|
+
}: SveltePaginationProps = $props()
|
|
28
30
|
|
|
29
31
|
const classes = classNames([
|
|
30
32
|
styles.pagination,
|
|
@@ -64,9 +66,11 @@
|
|
|
64
66
|
})
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
let calculatedCurrentPage = $state(
|
|
70
|
+
currentPage
|
|
71
|
+
|| (pages?.findIndex(page => page.active) || -1) + 1
|
|
72
|
+
|| 1
|
|
73
|
+
)
|
|
70
74
|
</script>
|
|
71
75
|
|
|
72
76
|
<ul class={classes}>
|
|
@@ -76,11 +80,10 @@
|
|
|
76
80
|
<button
|
|
77
81
|
aria-label={`page ${index + 1}`}
|
|
78
82
|
data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
|
|
79
|
-
|
|
83
|
+
onclick={calculatedCurrentPage !== index + 1
|
|
80
84
|
? () => paginate(index + 1)
|
|
81
|
-
: null
|
|
82
|
-
|
|
83
|
-
/>
|
|
85
|
+
: null}
|
|
86
|
+
></button>
|
|
84
87
|
</li>
|
|
85
88
|
{/each}
|
|
86
89
|
{:else}
|
|
@@ -95,7 +98,7 @@
|
|
|
95
98
|
}
|
|
96
99
|
>
|
|
97
100
|
{#if showChevrons || type === 'arrows'}
|
|
98
|
-
{@html
|
|
101
|
+
{@html ChevronLeft}
|
|
99
102
|
{/if}
|
|
100
103
|
{#if type !== 'arrows'}
|
|
101
104
|
{previousPageLabel}
|
|
@@ -140,7 +143,7 @@
|
|
|
140
143
|
{nextPageLabel}
|
|
141
144
|
{/if}
|
|
142
145
|
{#if showChevrons || type === 'arrows'}
|
|
143
|
-
{@html
|
|
146
|
+
{@html ChevronRight}
|
|
144
147
|
{/if}
|
|
145
148
|
</Button>
|
|
146
149
|
</li>
|
|
@@ -5,8 +5,8 @@ import Button from '../Button/Button.tsx'
|
|
|
5
5
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import ChevronLeft from '../../icons/chevron-left.svg?raw'
|
|
9
|
+
import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
10
10
|
|
|
11
11
|
import styles from './pagination.module.scss'
|
|
12
12
|
|
|
@@ -88,6 +88,7 @@ const Pagination = ({
|
|
|
88
88
|
{generatedPages?.map((_, index) => (
|
|
89
89
|
<li key={index}>
|
|
90
90
|
<button
|
|
91
|
+
aria-label={`page ${index + 1}`}
|
|
91
92
|
data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
|
|
92
93
|
onClick={calculatedCurrentPage !== index + 1
|
|
93
94
|
? () => paginate(index + 1)
|
|
@@ -110,7 +111,7 @@ const Pagination = ({
|
|
|
110
111
|
}
|
|
111
112
|
>
|
|
112
113
|
{(showChevrons || type === 'arrows') && (
|
|
113
|
-
<span dangerouslySetInnerHTML={{ __html:
|
|
114
|
+
<span dangerouslySetInnerHTML={{ __html: ChevronLeft }} />
|
|
114
115
|
)}
|
|
115
116
|
{type !== 'arrows' && previousPageLabel}
|
|
116
117
|
</Button>
|
|
@@ -151,7 +152,7 @@ const Pagination = ({
|
|
|
151
152
|
>
|
|
152
153
|
{type !== 'arrows' && nextPageLabel}
|
|
153
154
|
{(showChevrons || type === 'arrows') && (
|
|
154
|
-
<span dangerouslySetInnerHTML={{ __html:
|
|
155
|
+
<span dangerouslySetInnerHTML={{ __html: ChevronRight }} />
|
|
155
156
|
)}
|
|
156
157
|
</Button>
|
|
157
158
|
</li>
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SveltePopoverProps } from './popover'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './popover.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
...rest
|
|
13
|
+
}: SveltePopoverProps = $props()
|
|
10
14
|
|
|
11
15
|
const classes = classNames([
|
|
12
16
|
styles.popover,
|
|
@@ -16,8 +20,8 @@
|
|
|
16
20
|
|
|
17
21
|
<dialog
|
|
18
22
|
class={classes}
|
|
19
|
-
id={id
|
|
20
|
-
{
|
|
23
|
+
id={id}
|
|
24
|
+
{...rest}
|
|
21
25
|
>
|
|
22
|
-
|
|
26
|
+
{@render children?.()}
|
|
23
27
|
</dialog>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type PopoverProps = {
|
|
2
4
|
id?: string
|
|
3
5
|
className?: string
|
|
4
6
|
[key: string]: any
|
|
5
7
|
}
|
|
6
8
|
|
|
9
|
+
export type SveltePopoverProps = {
|
|
10
|
+
children: Snippet
|
|
11
|
+
} & PopoverProps
|
|
12
|
+
|
|
7
13
|
export type ReactPopoverProps = {
|
|
8
14
|
isInteractive?: boolean
|
|
9
15
|
children?: React.ReactNode
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './progress.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
size,
|
|
11
|
+
label,
|
|
12
|
+
color,
|
|
13
|
+
background,
|
|
14
|
+
square,
|
|
15
|
+
striped,
|
|
16
|
+
stripeLight,
|
|
17
|
+
stripeDark,
|
|
18
|
+
className
|
|
19
|
+
}: ProgressProps = $props()
|
|
18
20
|
|
|
19
21
|
const classes = classNames([
|
|
20
22
|
styles['w-progress'],
|
|
@@ -7,12 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './radio.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const {
|
|
11
|
+
name,
|
|
12
|
+
items,
|
|
13
|
+
color,
|
|
14
|
+
inline,
|
|
15
|
+
className,
|
|
16
|
+
onChange,
|
|
17
|
+
...rest
|
|
18
|
+
}: SvelteRadioProps = $props()
|
|
16
19
|
|
|
17
20
|
const classes = classNames([
|
|
18
21
|
styles.radio,
|
|
@@ -43,10 +46,10 @@
|
|
|
43
46
|
value={item.value}
|
|
44
47
|
checked={item.selected}
|
|
45
48
|
disabled={item.disabled}
|
|
46
|
-
|
|
47
|
-
{
|
|
49
|
+
onchange={onChange}
|
|
50
|
+
{...rest}
|
|
48
51
|
/>
|
|
49
|
-
<span class={styles.icon}
|
|
52
|
+
<span class={styles.icon}></span>
|
|
50
53
|
<span class={styles.label}>
|
|
51
54
|
{@html item.label}
|
|
52
55
|
</span>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { InputTarget } from '../Input/input'
|
|
2
|
+
|
|
1
3
|
export type RadioProps = {
|
|
2
4
|
items: {
|
|
3
5
|
label: string
|
|
@@ -14,9 +16,9 @@ export type RadioProps = {
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export type SvelteRadioProps = {
|
|
17
|
-
onChange?: (
|
|
19
|
+
onChange?: (event: Event & InputTarget) => void
|
|
18
20
|
} & RadioProps
|
|
19
21
|
|
|
20
22
|
export type ReactRadioProps = {
|
|
21
|
-
onChange?: (
|
|
23
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
22
24
|
} & RadioProps
|
|
@@ -7,20 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './rating.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const {
|
|
11
|
+
score,
|
|
12
|
+
total = 5,
|
|
13
|
+
showText,
|
|
14
|
+
text = '{0} out of {1}',
|
|
15
|
+
showEmpty = true,
|
|
16
|
+
outline = true,
|
|
17
|
+
reviewCount,
|
|
18
|
+
reviewText = '{0} reviews',
|
|
19
|
+
reviewLink,
|
|
20
|
+
reviewTarget,
|
|
21
|
+
color,
|
|
22
|
+
emptyColor,
|
|
23
|
+
size,
|
|
24
|
+
className
|
|
25
|
+
}: RatingProps = $props()
|
|
24
26
|
|
|
25
27
|
const classes = classNames([
|
|
26
28
|
styles.rating,
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteRibbonProps } from './ribbon'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './ribbon.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const {
|
|
9
|
+
offset,
|
|
10
|
+
type,
|
|
11
|
+
theme,
|
|
12
|
+
className,
|
|
13
|
+
children
|
|
14
|
+
}: SvelteRibbonProps = $props()
|
|
12
15
|
|
|
13
16
|
const classes = classNames([
|
|
14
17
|
styles.ribbon,
|
|
@@ -22,5 +25,5 @@
|
|
|
22
25
|
class={classes}
|
|
23
26
|
style={offset ? `top:${offset}px;left:${offset}px` : null}
|
|
24
27
|
>
|
|
25
|
-
|
|
28
|
+
{@render children?.()}
|
|
26
29
|
</span>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type RibbonProps = {
|
|
2
4
|
offset?: number
|
|
3
5
|
type?: 'folded' | null
|
|
@@ -11,6 +13,10 @@ export type RibbonProps = {
|
|
|
11
13
|
className?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
export type SvelteRibbonProps = {
|
|
17
|
+
children: Snippet
|
|
18
|
+
} & RibbonProps
|
|
19
|
+
|
|
14
20
|
export type ReactRibbonProps = {
|
|
15
21
|
children: React.ReactNode
|
|
16
22
|
} & RibbonProps
|