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
|
@@ -8,7 +8,7 @@ import Popover from '../Popover/Popover.astro'
|
|
|
8
8
|
|
|
9
9
|
import { classNames } from '../../utils/classNames'
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
12
12
|
|
|
13
13
|
import styles from './select.module.scss'
|
|
14
14
|
|
|
@@ -56,7 +56,7 @@ const inputRestProps = Object.fromEntries(
|
|
|
56
56
|
labelClassName={classes}
|
|
57
57
|
{...inputRestProps}
|
|
58
58
|
>
|
|
59
|
-
<Fragment set:html={
|
|
59
|
+
<Fragment set:html={ChevronDown} />
|
|
60
60
|
</Input>
|
|
61
61
|
{position === 'modal'
|
|
62
62
|
? (
|
|
@@ -81,78 +81,85 @@ const inputRestProps = Object.fromEntries(
|
|
|
81
81
|
import { modal } from '../../utils/modal'
|
|
82
82
|
import { closePopover, popover, type PopoverPosition } from '../../utils/popover'
|
|
83
83
|
|
|
84
|
-
const
|
|
85
|
-
|
|
84
|
+
const addEventListeners = () => {
|
|
85
|
+
const selects = document.querySelectorAll('[data-id^="w-select"]')
|
|
86
|
+
let focusByTab = false
|
|
86
87
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
on(document, 'mousedown', () => focusByTab = false)
|
|
94
|
-
|
|
95
|
-
Array.from(selects).forEach(select => {
|
|
96
|
-
const selectElement = select as HTMLElement
|
|
97
|
-
const name = selectElement.dataset.id!.split('w-select-')[1]
|
|
98
|
-
const position = selectElement.dataset.position
|
|
99
|
-
|
|
100
|
-
if (position === 'modal') {
|
|
101
|
-
modal({
|
|
102
|
-
trigger: `[data-id="${selectElement.dataset.id}"]`,
|
|
103
|
-
modal: `[data-id="w-options-${name}"]`,
|
|
104
|
-
onOpen: ({ modal }) => {
|
|
105
|
-
const search = modal.querySelector('input')
|
|
88
|
+
on(document, 'keydown', (event: KeyboardEvent) => {
|
|
89
|
+
if (event.key === 'Tab') {
|
|
90
|
+
focusByTab = true
|
|
91
|
+
}
|
|
92
|
+
})
|
|
106
93
|
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
on(document, 'mousedown', () => focusByTab = false)
|
|
95
|
+
|
|
96
|
+
Array.from(selects).forEach(select => {
|
|
97
|
+
const selectElement = select as HTMLElement
|
|
98
|
+
const name = selectElement.dataset.id!.split('w-select-')[1]
|
|
99
|
+
const position = selectElement.dataset.position
|
|
100
|
+
|
|
101
|
+
if (position === 'modal') {
|
|
102
|
+
modal({
|
|
103
|
+
trigger: `[data-id="${selectElement.dataset.id}"]`,
|
|
104
|
+
modal: `[data-id="w-options-${name}"]`,
|
|
105
|
+
onOpen: ({ modal }) => {
|
|
106
|
+
const search = modal.querySelector('input')
|
|
107
|
+
|
|
108
|
+
if (search) {
|
|
109
|
+
search.focus()
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
onClose(event) {
|
|
113
|
+
dispatch('selectOnClose', event)
|
|
109
114
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const dialogElement = document.querySelector(`[data-id="w-options-${name}"]`) as HTMLDialogElement
|
|
119
|
-
|
|
120
|
-
if (dialogElement) {
|
|
121
|
-
dialogElement.style.width = `${width}px`
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
new ResizeObserver(() => resize()).observe(document.body)
|
|
126
|
-
|
|
127
|
-
popover({
|
|
128
|
-
trigger: `[data-id="${selectElement.dataset.id}"]`,
|
|
129
|
-
popover: `[data-id="w-options-${name}"]`,
|
|
130
|
-
position: position as PopoverPosition || 'bottom',
|
|
131
|
-
onOpen({ popover }) {
|
|
132
|
-
const search = popover.querySelector('input')
|
|
133
|
-
|
|
134
|
-
if (search) {
|
|
135
|
-
search.focus()
|
|
136
|
-
} else {
|
|
137
|
-
popover.focus()
|
|
115
|
+
})
|
|
116
|
+
} else {
|
|
117
|
+
const resize = debounce(() => {
|
|
118
|
+
const { width } = selectElement.getBoundingClientRect()
|
|
119
|
+
const dialogElement = document.querySelector(`[data-id="w-options-${name}"]`) as HTMLDialogElement
|
|
120
|
+
|
|
121
|
+
if (dialogElement) {
|
|
122
|
+
dialogElement.style.width = `${width}px`
|
|
138
123
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
new ResizeObserver(() => resize()).observe(document.body)
|
|
127
|
+
|
|
128
|
+
popover({
|
|
129
|
+
trigger: `[data-id="${selectElement.dataset.id}"]`,
|
|
130
|
+
popover: `[data-id="w-options-${name}"]`,
|
|
131
|
+
position: position as PopoverPosition || 'bottom',
|
|
132
|
+
onOpen({ popover }) {
|
|
133
|
+
const search = popover.querySelector('input')
|
|
134
|
+
|
|
135
|
+
if (search) {
|
|
136
|
+
search.focus()
|
|
137
|
+
} else {
|
|
138
|
+
popover.focus()
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
onClose(event) {
|
|
142
|
+
dispatch('selectOnClose', event)
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
on(selectElement, 'focus', (event: Event) => {
|
|
148
|
+
if (focusByTab) {
|
|
149
|
+
(event.currentTarget as HTMLInputElement).click()
|
|
142
150
|
}
|
|
143
151
|
})
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
on(selectElement, 'focus', (event: Event) => {
|
|
147
|
-
if (focusByTab) {
|
|
148
|
-
(event.currentTarget as HTMLInputElement).click()
|
|
149
|
-
}
|
|
150
152
|
})
|
|
151
|
-
}
|
|
153
|
+
}
|
|
152
154
|
|
|
153
155
|
listen('listOnSelect', payload => {
|
|
154
156
|
const { name, list } = payload
|
|
155
157
|
const dialog = list.closest('dialog')
|
|
158
|
+
|
|
159
|
+
if (!dialog) {
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
|
|
156
163
|
const popoverId = dialog.dataset.id
|
|
157
164
|
const selectName = popoverId.split('w-options-')[1]
|
|
158
165
|
const selectId = `[data-id="w-select-${selectName}"]`
|
|
@@ -169,4 +176,7 @@ const inputRestProps = Object.fromEntries(
|
|
|
169
176
|
select: selectName
|
|
170
177
|
})
|
|
171
178
|
})
|
|
179
|
+
|
|
180
|
+
on(document, 'astro:after-swap', addEventListeners)
|
|
181
|
+
addEventListeners()
|
|
172
182
|
</script>
|
|
@@ -13,26 +13,29 @@
|
|
|
13
13
|
import { modal } from '../../utils/modal'
|
|
14
14
|
import { closePopover, popover, type PopoverPosition } from '../../utils/popover'
|
|
15
15
|
|
|
16
|
-
import
|
|
16
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
17
17
|
|
|
18
18
|
import styles from './select.module.scss'
|
|
19
19
|
|
|
20
20
|
import type { ListEventType, ListProps } from '../List/list'
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const {
|
|
23
|
+
name,
|
|
24
|
+
value,
|
|
25
|
+
placeholder,
|
|
26
|
+
label,
|
|
27
|
+
subText,
|
|
28
|
+
disabled,
|
|
29
|
+
updateValue = true,
|
|
30
|
+
position = 'bottom',
|
|
31
|
+
className,
|
|
32
|
+
onChange,
|
|
33
|
+
onClose,
|
|
34
|
+
...rest
|
|
35
|
+
}: SvelteSelectProps = $props()
|
|
33
36
|
|
|
34
37
|
let popoverInstance: any
|
|
35
|
-
let val: string
|
|
38
|
+
let val: string | undefined = $state('')
|
|
36
39
|
let focusByTab = false
|
|
37
40
|
|
|
38
41
|
const classes = classNames([
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
styles.popover
|
|
47
50
|
])
|
|
48
51
|
|
|
49
|
-
const inferredValue =
|
|
52
|
+
const inferredValue = rest.itemGroups
|
|
50
53
|
.map((group: ListProps['itemGroups'][0]) => group.items)
|
|
51
54
|
.flat()
|
|
52
55
|
.find((item: ListProps['itemGroups'][0]['items'][0]) => item.value === value)?.name
|
|
@@ -54,7 +57,7 @@
|
|
|
54
57
|
val = (value && inferredValue) ? inferredValue : value
|
|
55
58
|
|
|
56
59
|
const inputRestProps = Object.fromEntries(
|
|
57
|
-
Object.entries(
|
|
60
|
+
Object.entries(rest).filter(([key]) => key.includes('data'))
|
|
58
61
|
)
|
|
59
62
|
|
|
60
63
|
const select = (event: ListEventType) => {
|
|
@@ -100,10 +103,12 @@
|
|
|
100
103
|
const resize = debounce(() => {
|
|
101
104
|
const selectElement = document.querySelector(`.w-select-${name}`) as HTMLInputElement
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
if (selectElement) {
|
|
107
|
+
const { width } = selectElement.getBoundingClientRect()
|
|
108
|
+
const dialogElement = document.querySelector(`.w-options-${name}`) as HTMLDialogElement
|
|
105
109
|
|
|
106
|
-
|
|
110
|
+
dialogElement.style.width = `${width}px`
|
|
111
|
+
}
|
|
107
112
|
})
|
|
108
113
|
|
|
109
114
|
observer = new ResizeObserver(() => resize())
|
|
@@ -144,24 +149,24 @@
|
|
|
144
149
|
value={val}
|
|
145
150
|
readonly={true}
|
|
146
151
|
disabled={disabled}
|
|
147
|
-
placeholder={placeholder
|
|
152
|
+
placeholder={placeholder}
|
|
148
153
|
label={label}
|
|
149
154
|
subText={subText}
|
|
150
155
|
className={`w-select-${name}`}
|
|
151
156
|
labelClassName={classes}
|
|
152
157
|
{...inputRestProps}
|
|
153
158
|
>
|
|
154
|
-
{@html
|
|
159
|
+
{@html ChevronDown}
|
|
155
160
|
</Input>
|
|
156
161
|
{#if position === 'modal'}
|
|
157
162
|
<Modal
|
|
158
163
|
className={popoverClasses}
|
|
159
164
|
showCloseIcon={false}
|
|
160
165
|
>
|
|
161
|
-
<List onSelect={select} {
|
|
166
|
+
<List onSelect={select} {...rest} />
|
|
162
167
|
</Modal>
|
|
163
168
|
{:else}
|
|
164
169
|
<Popover className={popoverClasses}>
|
|
165
|
-
<List onSelect={select} {
|
|
170
|
+
<List onSelect={select} {...rest} />
|
|
166
171
|
</Popover>
|
|
167
172
|
{/if}
|
|
@@ -12,7 +12,7 @@ import { on } from '../../utils/DOMUtils'
|
|
|
12
12
|
import { modal } from '../../utils/modal'
|
|
13
13
|
import { closePopover, popover, type PopoverPosition } from '../../utils/popover'
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
16
16
|
|
|
17
17
|
import styles from './select.module.scss'
|
|
18
18
|
|
|
@@ -99,10 +99,12 @@ const Select = ({
|
|
|
99
99
|
const resize = debounce(() => {
|
|
100
100
|
const selectElement = document.querySelector(`.w-select-${name}`) as HTMLInputElement
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
if (selectElement) {
|
|
103
|
+
const { width } = selectElement.getBoundingClientRect()
|
|
104
|
+
const dialogElement = document.querySelector(`.w-options-${name}`) as HTMLDialogElement
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
dialogElement.style.width = `${width}px`
|
|
107
|
+
}
|
|
106
108
|
})
|
|
107
109
|
|
|
108
110
|
observer = new ResizeObserver(() => resize())
|
|
@@ -123,7 +125,7 @@ const Select = ({
|
|
|
123
125
|
onClose?.(event)
|
|
124
126
|
}
|
|
125
127
|
})
|
|
126
|
-
},
|
|
128
|
+
}, 1)
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
on(`.w-select-${name}`, 'focus', (event: Event) => {
|
|
@@ -153,7 +155,7 @@ const Select = ({
|
|
|
153
155
|
{...inputRestProps}
|
|
154
156
|
>
|
|
155
157
|
<span
|
|
156
|
-
dangerouslySetInnerHTML={{ __html:
|
|
158
|
+
dangerouslySetInnerHTML={{ __html: ChevronDown }}
|
|
157
159
|
style={{
|
|
158
160
|
right: 0,
|
|
159
161
|
pointerEvents: 'none'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteSheetProps } from './sheet'
|
|
3
3
|
|
|
4
4
|
import Modal from '../Modal/Modal.svelte'
|
|
5
5
|
|
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './sheet.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const {
|
|
11
|
+
position,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
...rest
|
|
15
|
+
}: SvelteSheetProps = $props()
|
|
12
16
|
|
|
13
17
|
const classes = classNames([
|
|
14
18
|
styles.sheet,
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
|
|
20
24
|
<Modal
|
|
21
25
|
className={classes}
|
|
22
|
-
{
|
|
26
|
+
{...rest}
|
|
23
27
|
>
|
|
24
|
-
|
|
28
|
+
{@render children?.()}
|
|
25
29
|
</Modal>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ModalProps,
|
|
3
|
+
ReactModalProps,
|
|
4
|
+
SvelteModalProps
|
|
5
|
+
} from '../Modal/modal'
|
|
2
6
|
|
|
3
7
|
export type SheetProps = {
|
|
4
8
|
position?: 'left'
|
|
5
9
|
| 'top'
|
|
6
10
|
| 'bottom'
|
|
7
|
-
| null
|
|
8
11
|
} & ModalProps
|
|
9
12
|
|
|
13
|
+
export type SvelteSheetProps = SheetProps & SvelteModalProps
|
|
10
14
|
export type ReactSheetProps = SheetProps & ReactModalProps
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteSidebarProps } from './sidebar'
|
|
3
3
|
|
|
4
4
|
import Badge from '../Badge/Badge.svelte'
|
|
5
5
|
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './sidebar.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const {
|
|
11
|
+
groups,
|
|
12
|
+
children,
|
|
13
|
+
className
|
|
14
|
+
}: SvelteSidebarProps = $props()
|
|
12
15
|
|
|
13
16
|
const classes = classNames([
|
|
14
17
|
styles.sidebar,
|
|
@@ -46,5 +49,5 @@
|
|
|
46
49
|
</ul>
|
|
47
50
|
{/each}
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
{@render children?.()}
|
|
50
53
|
</aside>
|
|
@@ -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 SidebarProps = {
|
|
@@ -16,6 +18,10 @@ export type SidebarProps = {
|
|
|
16
18
|
className?: string
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
export type SvelteSidebarProps = {
|
|
22
|
+
children?: Snippet
|
|
23
|
+
} & SidebarProps
|
|
24
|
+
|
|
19
25
|
export type ReactSidebarProps = {
|
|
20
26
|
children?: React.ReactNode
|
|
21
27
|
} & SidebarProps
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './skeleton.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const {
|
|
9
|
+
animate = 'wave',
|
|
10
|
+
type = 'rounded',
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
color,
|
|
14
|
+
waveColor,
|
|
15
|
+
className
|
|
16
|
+
}: SkeletonProps = $props()
|
|
15
17
|
|
|
16
18
|
const classes = classNames([
|
|
17
19
|
animate && styles[animate],
|
|
@@ -5,17 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './slider.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const {
|
|
9
|
+
min,
|
|
10
|
+
max,
|
|
11
|
+
value,
|
|
12
|
+
step,
|
|
13
|
+
disabled,
|
|
14
|
+
color,
|
|
15
|
+
background,
|
|
16
|
+
thumb,
|
|
17
|
+
id,
|
|
18
|
+
className,
|
|
19
|
+
onChange
|
|
20
|
+
}: SvelteSliderProps = $props()
|
|
19
21
|
|
|
20
22
|
const classes = classNames([
|
|
21
23
|
styles.slider,
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
step={step}
|
|
38
40
|
disabled={disabled}
|
|
39
41
|
class={classes}
|
|
40
|
-
id={id
|
|
42
|
+
id={id}
|
|
41
43
|
style={styleVariables || null}
|
|
42
|
-
|
|
44
|
+
onchange={onChange}
|
|
43
45
|
/>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { InputTarget } from '../Input/input'
|
|
2
|
+
|
|
1
3
|
export type SliderProps = {
|
|
2
4
|
min: number
|
|
3
5
|
max: number
|
|
@@ -12,9 +14,9 @@ export type SliderProps = {
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export type SvelteSliderProps = {
|
|
15
|
-
onChange?: (
|
|
17
|
+
onChange?: (event: Event & InputTarget) => void
|
|
16
18
|
} & SliderProps
|
|
17
19
|
|
|
18
20
|
export type ReactSliderProps = {
|
|
19
|
-
onChange?: (
|
|
21
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
20
22
|
} & SliderProps
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
import styles from './spinner.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const {
|
|
9
|
+
color,
|
|
10
|
+
width,
|
|
11
|
+
speed,
|
|
12
|
+
size,
|
|
13
|
+
dashArray
|
|
14
|
+
}: SpinnerProps = $props()
|
|
13
15
|
|
|
14
16
|
const classes = classNames([
|
|
15
17
|
styles.spinner,
|
|
@@ -39,12 +39,17 @@ const style = color
|
|
|
39
39
|
<script>
|
|
40
40
|
import { on } from '../../utils/DOMUtils'
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const addEventListeners = () => {
|
|
43
|
+
on('[data-id="w-spoiler"]', 'click', (event: Event) => {
|
|
44
|
+
const target = event.currentTarget as HTMLDivElement
|
|
45
|
+
|
|
46
|
+
target.dataset.visible = 'true'
|
|
47
|
+
target.removeAttribute('data-tooltip')
|
|
48
|
+
target.removeAttribute('role')
|
|
49
|
+
target.removeAttribute('tabindex')
|
|
50
|
+
}, true)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
on(document, 'astro:after-swap', addEventListeners)
|
|
54
|
+
addEventListeners()
|
|
50
55
|
</script>
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteSpoilerProps } from './spoiler'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './spoiler.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const {
|
|
9
|
+
color,
|
|
10
|
+
animated = true,
|
|
11
|
+
block,
|
|
12
|
+
tooltip,
|
|
13
|
+
tooltipPosition,
|
|
14
|
+
children
|
|
15
|
+
}: SvelteSpoilerProps = $props()
|
|
13
16
|
|
|
14
17
|
const classes = classNames([
|
|
15
18
|
styles.spoiler,
|
|
@@ -34,12 +37,12 @@
|
|
|
34
37
|
<span
|
|
35
38
|
class={classes}
|
|
36
39
|
style={style}
|
|
37
|
-
data-tooltip={tooltip
|
|
40
|
+
data-tooltip={tooltip}
|
|
38
41
|
data-position={tooltipPosition}
|
|
39
42
|
role="button"
|
|
40
43
|
tabindex="0"
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
onclick={toggle}
|
|
45
|
+
onkeyup={toggle}
|
|
43
46
|
>
|
|
44
|
-
|
|
47
|
+
{@render children?.()}
|
|
45
48
|
</span>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
1
3
|
export type SpoilerProps = {
|
|
2
4
|
color?: string
|
|
3
5
|
animated?: boolean
|
|
@@ -6,6 +8,10 @@ export type SpoilerProps = {
|
|
|
6
8
|
tooltipPosition?: 'bottom' | null
|
|
7
9
|
}
|
|
8
10
|
|
|
11
|
+
export type SvelteSpoilerProps = {
|
|
12
|
+
children: Snippet
|
|
13
|
+
} & SpoilerProps
|
|
14
|
+
|
|
9
15
|
export type ReactSpoilerProps = {
|
|
10
16
|
children: React.ReactNode
|
|
11
17
|
} & SpoilerProps
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import styles from './stepper.module.scss'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const {
|
|
11
|
+
items,
|
|
12
|
+
color,
|
|
13
|
+
completedColor,
|
|
14
|
+
activeColor,
|
|
15
|
+
borderless,
|
|
16
|
+
vertical,
|
|
17
|
+
className
|
|
18
|
+
}: StepperProps = $props()
|
|
17
19
|
|
|
18
20
|
const classes = classNames([
|
|
19
21
|
styles.stepper,
|