webcoreui 1.4.0 → 1.5.0-beta.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 +15 -1
- package/astro.d.ts +62 -56
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +1 -1
- package/components/Accordion/Accordion.svelte +60 -58
- package/components/Accordion/Accordion.tsx +3 -1
- package/components/Alert/Alert.astro +2 -1
- package/components/Alert/Alert.svelte +12 -5
- package/components/Alert/Alert.tsx +10 -3
- package/components/Alert/alert.ts +2 -18
- package/components/AspectRatio/AspectRatio.astro +1 -1
- package/components/AspectRatio/AspectRatio.svelte +27 -22
- package/components/AspectRatio/AspectRatio.tsx +6 -3
- package/components/AspectRatio/aspectratio.ts +0 -10
- package/components/Avatar/Avatar.astro +1 -1
- package/components/Avatar/Avatar.svelte +7 -5
- package/components/Avatar/Avatar.tsx +3 -2
- package/components/Avatar/avatar.module.scss +3 -5
- package/components/Badge/Badge.astro +2 -1
- package/components/Badge/Badge.svelte +11 -4
- package/components/Badge/Badge.tsx +8 -3
- package/components/Badge/badge.module.scss +5 -6
- package/components/Badge/badge.ts +11 -13
- package/components/Banner/Banner.astro +1 -1
- package/components/Banner/Banner.svelte +11 -5
- package/components/Banner/Banner.tsx +6 -2
- package/components/Banner/banner.module.scss +4 -6
- package/components/Banner/banner.ts +0 -10
- package/components/BottomNavigation/BottomNavigation.astro +1 -1
- package/components/BottomNavigation/BottomNavigation.svelte +7 -4
- package/components/BottomNavigation/BottomNavigation.tsx +3 -2
- package/components/BottomNavigation/bottomnavigation.module.scss +68 -70
- package/components/Breadcrumb/Breadcrumb.astro +1 -1
- package/components/Breadcrumb/Breadcrumb.svelte +5 -3
- package/components/Breadcrumb/Breadcrumb.tsx +3 -1
- package/components/Button/Button.astro +2 -1
- package/components/Button/Button.svelte +11 -4
- package/components/Button/Button.tsx +7 -2
- package/components/Button/button.module.scss +9 -12
- package/components/Button/button.ts +23 -20
- package/components/Card/Card.astro +9 -2
- package/components/Card/Card.svelte +21 -8
- package/components/Card/Card.tsx +23 -6
- package/components/Card/card.module.scss +12 -9
- package/components/Card/card.ts +3 -16
- package/components/Carousel/Carousel.astro +3 -3
- package/components/Carousel/Carousel.svelte +24 -19
- package/components/Carousel/Carousel.tsx +9 -4
- package/components/Carousel/carousel.module.scss +3 -5
- package/components/Carousel/carousel.ts +0 -12
- package/components/CarouselItem/CarouselItem.astro +14 -0
- package/components/CarouselItem/CarouselItem.svelte +18 -0
- package/components/CarouselItem/CarouselItem.tsx +18 -0
- package/components/CarouselItem/carouselItem.ts +4 -0
- package/components/Checkbox/Checkbox.astro +3 -6
- package/components/Checkbox/Checkbox.svelte +13 -10
- package/components/Checkbox/Checkbox.tsx +8 -5
- package/components/Checkbox/checkbox.module.scss +4 -6
- package/components/Checkbox/checkbox.ts +2 -17
- package/components/Collapsible/Collapsible.astro +1 -1
- package/components/Collapsible/Collapsible.svelte +13 -6
- package/components/Collapsible/Collapsible.tsx +8 -2
- package/components/Collapsible/collapsible.module.scss +5 -5
- package/components/Collapsible/collapsible.ts +0 -15
- package/components/ConditionalWrapper/ConditionalWrapper.astro +1 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +8 -2
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +7 -2
- package/components/ConditionalWrapper/conditionalwrapper.ts +2 -14
- package/components/ContextMenu/ContextMenu.astro +2 -1
- package/components/ContextMenu/ContextMenu.svelte +17 -9
- package/components/ContextMenu/ContextMenu.tsx +8 -2
- package/components/ContextMenu/contextmenu.ts +2 -17
- package/components/Copy/Copy.astro +2 -2
- package/components/Copy/Copy.svelte +10 -5
- package/components/Copy/Copy.tsx +7 -3
- package/components/Copy/copy.ts +2 -12
- package/components/Counter/Counter.astro +3 -2
- package/components/Counter/Counter.svelte +16 -10
- package/components/Counter/Counter.tsx +11 -7
- package/components/Counter/counter.module.scss +3 -5
- package/components/Counter/counter.ts +2 -11
- package/components/DataTable/DataTable.astro +1 -1
- package/components/DataTable/DataTable.svelte +23 -15
- package/components/DataTable/DataTable.tsx +7 -2
- package/components/DataTable/datatable.ts +0 -12
- package/components/Flex/Flex.astro +2 -1
- package/components/Flex/Flex.svelte +12 -6
- package/components/Flex/Flex.tsx +8 -3
- package/components/Flex/flex.ts +2 -15
- package/components/Footer/Footer.astro +1 -1
- package/components/Footer/Footer.svelte +13 -8
- package/components/Footer/Footer.tsx +6 -2
- package/components/Footer/footer.ts +0 -10
- package/components/Grid/Grid.astro +2 -1
- package/components/Grid/Grid.svelte +12 -6
- package/components/Grid/Grid.tsx +8 -3
- package/components/Grid/grid.ts +2 -15
- package/components/Group/Group.astro +1 -1
- package/components/Group/Group.svelte +9 -4
- package/components/Group/Group.tsx +6 -2
- package/components/Group/group.ts +0 -10
- package/components/Icon/Icon.astro +1 -1
- package/components/Icon/Icon.svelte +16 -9
- package/components/Icon/Icon.tsx +3 -2
- package/components/Image/Image.astro +2 -1
- package/components/Image/Image.svelte +54 -51
- package/components/Image/Image.tsx +3 -1
- package/components/Image/image.ts +2 -3
- package/components/ImageLoader/ImageLoader.astro +1 -1
- package/components/ImageLoader/ImageLoader.svelte +5 -3
- package/components/ImageLoader/ImageLoader.tsx +3 -1
- package/components/Input/Input.astro +3 -2
- package/components/Input/Input.svelte +19 -9
- package/components/Input/Input.tsx +11 -3
- package/components/Input/input.ts +26 -53
- package/components/Kbd/Kbd.astro +1 -1
- package/components/Kbd/Kbd.svelte +9 -4
- package/components/Kbd/Kbd.tsx +6 -2
- package/components/Kbd/kbd.ts +0 -10
- package/components/List/List.astro +1 -1
- package/components/List/List.svelte +13 -9
- package/components/List/List.tsx +10 -6
- package/components/List/list.ts +0 -8
- package/components/Masonry/Masonry.astro +1 -1
- package/components/Masonry/Masonry.svelte +14 -9
- package/components/Masonry/Masonry.tsx +7 -3
- package/components/Masonry/masonry.module.scss +4 -6
- package/components/Masonry/masonry.ts +2 -13
- package/components/Menu/Menu.astro +1 -1
- package/components/Menu/Menu.svelte +13 -7
- package/components/Menu/Menu.tsx +6 -2
- package/components/Menu/menu.ts +0 -10
- package/components/Modal/Modal.astro +2 -3
- package/components/Modal/Modal.svelte +12 -8
- package/components/Modal/Modal.tsx +6 -4
- package/components/Modal/modal.module.scss +5 -5
- package/components/Modal/modal.ts +2 -14
- package/components/OTPInput/OTPInput.astro +3 -5
- package/components/OTPInput/OTPInput.svelte +10 -10
- package/components/OTPInput/OTPInput.tsx +10 -8
- package/components/OTPInput/otpinput.module.scss +0 -12
- package/components/OTPInput/otpinput.ts +2 -4
- package/components/Pagination/Pagination.astro +1 -1
- package/components/Pagination/Pagination.svelte +8 -4
- package/components/Pagination/Pagination.tsx +6 -2
- package/components/Pagination/pagination.ts +0 -8
- package/components/Popover/Popover.astro +3 -7
- package/components/Popover/Popover.svelte +11 -10
- package/components/Popover/Popover.tsx +9 -12
- package/components/Popover/popover.ts +2 -15
- package/components/Progress/Progress.astro +1 -1
- package/components/Progress/Progress.svelte +8 -6
- package/components/Progress/Progress.tsx +3 -1
- package/components/Progress/progress.module.scss +15 -17
- package/components/Radio/Radio.astro +4 -4
- package/components/Radio/Radio.svelte +15 -8
- package/components/Radio/Radio.tsx +8 -5
- package/components/Radio/radio.module.scss +4 -6
- package/components/Radio/radio.ts +3 -14
- package/components/RangeSlider/RangeSlider.astro +5 -2
- package/components/RangeSlider/RangeSlider.svelte +20 -35
- package/components/RangeSlider/RangeSlider.tsx +11 -4
- package/components/RangeSlider/rangeslider.module.scss +14 -16
- package/components/RangeSlider/rangeslider.ts +1 -9
- package/components/Rating/Rating.astro +1 -1
- package/components/Rating/Rating.svelte +10 -7
- package/components/Rating/Rating.tsx +3 -1
- package/components/Rating/rating.module.scss +13 -15
- package/components/Ribbon/Ribbon.astro +1 -1
- package/components/Ribbon/Ribbon.svelte +9 -4
- package/components/Ribbon/Ribbon.tsx +6 -2
- package/components/Ribbon/ribbon.module.scss +9 -11
- package/components/Ribbon/ribbon.ts +0 -10
- package/components/Select/Select.astro +3 -1
- package/components/Select/Select.svelte +179 -171
- package/components/Select/Select.tsx +11 -4
- package/components/Select/select.ts +2 -12
- package/components/Sheet/Sheet.astro +2 -1
- package/components/Sheet/Sheet.svelte +7 -5
- package/components/Sheet/Sheet.tsx +5 -4
- package/components/Sheet/sheet.ts +3 -10
- package/components/Sidebar/Sidebar.astro +1 -1
- package/components/Sidebar/Sidebar.svelte +9 -4
- package/components/Sidebar/Sidebar.tsx +6 -2
- package/components/Sidebar/sidebar.ts +0 -10
- package/components/Skeleton/Skeleton.astro +1 -1
- package/components/Skeleton/Skeleton.svelte +7 -5
- package/components/Skeleton/Skeleton.tsx +3 -1
- package/components/Skeleton/skeleton.module.scss +6 -9
- package/components/Slider/Slider.astro +7 -5
- package/components/Slider/Slider.svelte +18 -10
- package/components/Slider/Slider.tsx +12 -6
- package/components/Slider/slider.module.scss +12 -14
- package/components/Slider/slider.ts +3 -12
- package/components/SpeedDial/SpeedDial.astro +1 -1
- package/components/SpeedDial/SpeedDial.svelte +6 -4
- package/components/SpeedDial/SpeedDial.tsx +4 -2
- package/components/SpeedDial/speeddial.module.scss +4 -6
- package/components/Spinner/Spinner.astro +1 -1
- package/components/Spinner/Spinner.svelte +7 -5
- package/components/Spinner/Spinner.tsx +3 -1
- package/components/Spinner/spinner.module.scss +13 -14
- package/components/Spoiler/Spoiler.astro +1 -1
- package/components/Spoiler/Spoiler.svelte +11 -5
- package/components/Spoiler/Spoiler.tsx +6 -2
- package/components/Spoiler/spoiler.module.scss +3 -5
- package/components/Spoiler/spoiler.ts +0 -10
- package/components/Stepper/Stepper.astro +1 -1
- package/components/Stepper/Stepper.svelte +7 -5
- package/components/Stepper/Stepper.tsx +3 -1
- package/components/Stepper/stepper.defaults.scss +5 -0
- package/components/Stepper/stepper.module.scss +11 -13
- package/components/Switch/Switch.astro +7 -2
- package/components/Switch/Switch.svelte +17 -8
- package/components/Switch/Switch.tsx +8 -4
- package/components/Switch/switch.module.scss +5 -7
- package/components/Switch/switch.ts +2 -16
- package/components/Tab/Tab.astro +25 -0
- package/components/Tab/Tab.svelte +28 -0
- package/components/Tab/Tab.tsx +30 -0
- package/components/Tab/tab.ts +6 -0
- package/components/Table/Table.astro +1 -1
- package/components/Table/Table.svelte +5 -3
- package/components/Table/Table.tsx +3 -1
- package/components/Tabs/Tabs.astro +58 -25
- package/components/Tabs/Tabs.svelte +47 -14
- package/components/Tabs/Tabs.tsx +42 -11
- package/components/Tabs/tabs.module.scss +7 -6
- package/components/Tabs/tabs.ts +0 -10
- package/components/Textarea/Textarea.astro +3 -6
- package/components/Textarea/Textarea.svelte +13 -10
- package/components/Textarea/Textarea.tsx +9 -7
- package/components/Textarea/textarea.ts +2 -17
- package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -1
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +14 -8
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +7 -2
- package/components/ThemeSwitcher/themeswitcher.module.scss +10 -12
- package/components/ThemeSwitcher/themeswitcher.ts +0 -13
- package/components/Timeline/Timeline.astro +1 -1
- package/components/Timeline/Timeline.svelte +11 -6
- package/components/Timeline/Timeline.tsx +6 -2
- package/components/Timeline/timeline.module.scss +6 -8
- package/components/Timeline/timeline.ts +0 -10
- package/components/TimelineItem/TimelineItem.astro +1 -1
- package/components/TimelineItem/TimelineItem.svelte +9 -4
- package/components/TimelineItem/TimelineItem.tsx +8 -3
- package/components/TimelineItem/timelineitem.module.scss +4 -4
- package/components/TimelineItem/timelineitem.ts +0 -12
- package/components/Toast/Toast.astro +2 -1
- package/components/Toast/Toast.svelte +9 -7
- package/components/Toast/Toast.tsx +5 -4
- package/components/Toast/toast.ts +3 -11
- package/package.json +19 -19
- package/react.d.ts +145 -138
- package/react.js +4 -0
- package/scss/config/functions.scss +41 -0
- package/scss/config/mixins.scss +65 -0
- package/scss/config.scss +1 -0
- package/scss/global/theme.scss +209 -194
- package/scss/setup.scss +6 -3
- package/svelte.d.ts +145 -138
- package/svelte.js +4 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { OTPInputProps } from './otpinput'
|
|
3
3
|
|
|
4
|
-
import Input from '../Input/Input.svelte'
|
|
4
|
+
import Input, { type Props as InputProps } from '../Input/Input.svelte'
|
|
5
5
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
8
|
import styles from './otpinput.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = OTPInputProps<InputProps>
|
|
11
|
+
|
|
10
12
|
let {
|
|
11
13
|
name = 'otp',
|
|
12
|
-
disabled,
|
|
13
14
|
length = 6,
|
|
14
15
|
groupLength = 0,
|
|
15
16
|
separator = '•',
|
|
@@ -18,19 +19,19 @@
|
|
|
18
19
|
className,
|
|
19
20
|
value = $bindable(''),
|
|
20
21
|
...rest
|
|
21
|
-
}:
|
|
22
|
+
}: Props = $props()
|
|
22
23
|
|
|
23
|
-
const classes = classNames([
|
|
24
|
+
const classes = $derived(classNames([
|
|
24
25
|
styles.wrapper,
|
|
25
26
|
className
|
|
26
|
-
])
|
|
27
|
+
]))
|
|
27
28
|
|
|
28
|
-
const inputs = Array.from({ length }, (_, i) => i + 1)
|
|
29
|
+
const inputs = $derived(Array.from({ length }, (_, i) => i + 1)
|
|
29
30
|
.reduce<(number | string)[]>((acc, num, i) =>
|
|
30
31
|
groupLength > 0 && i % groupLength === 0 && i !== 0
|
|
31
32
|
? [...acc, separator, num]
|
|
32
33
|
: [...acc, num]
|
|
33
|
-
, [])
|
|
34
|
+
, []))
|
|
34
35
|
|
|
35
36
|
const focus = (direction: 'next' | 'prev', wrapper: HTMLElement | null, clear?: boolean) => {
|
|
36
37
|
const index = Number(wrapper?.dataset.active)
|
|
@@ -160,11 +161,11 @@
|
|
|
160
161
|
<div class={styles.separator}>{input}</div>
|
|
161
162
|
{:else}
|
|
162
163
|
<Input
|
|
164
|
+
{...rest}
|
|
163
165
|
id={`${name}-${index}`}
|
|
164
166
|
className={styles.input}
|
|
165
167
|
type="text"
|
|
166
|
-
maxlength=
|
|
167
|
-
disabled={disabled}
|
|
168
|
+
maxlength={1}
|
|
168
169
|
inputmode="numeric"
|
|
169
170
|
autocomplete="one-time-code"
|
|
170
171
|
data-index={input}
|
|
@@ -174,7 +175,6 @@
|
|
|
174
175
|
onfocus={handleFocus}
|
|
175
176
|
onInput={handleInput}
|
|
176
177
|
onpaste={handlePaste}
|
|
177
|
-
{...rest}
|
|
178
178
|
/>
|
|
179
179
|
{/if}
|
|
180
180
|
{/each}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { OTPInputProps } from './otpinput'
|
|
3
3
|
|
|
4
|
-
import Input from '../Input/Input.tsx'
|
|
4
|
+
import Input, { type Props as InputProps } from '../Input/Input.tsx'
|
|
5
5
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
8
|
import styles from './otpinput.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = OTPInputProps<Omit<InputProps, 'onChange'>> & {
|
|
11
|
+
onChange?: (value: string) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
const OTPInput = ({
|
|
11
15
|
name = 'otp',
|
|
12
|
-
disabled,
|
|
13
16
|
length = 6,
|
|
14
17
|
groupLength = 0,
|
|
15
18
|
separator = '•',
|
|
@@ -18,7 +21,7 @@ const OTPInput = ({
|
|
|
18
21
|
className,
|
|
19
22
|
onChange,
|
|
20
23
|
...rest
|
|
21
|
-
}:
|
|
24
|
+
}: Props) => {
|
|
22
25
|
const classes = classNames([
|
|
23
26
|
styles.wrapper,
|
|
24
27
|
className
|
|
@@ -64,7 +67,7 @@ const OTPInput = ({
|
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
const handleInput = (event: React.
|
|
70
|
+
const handleInput = (event: React.InputEvent<HTMLInputElement>) => {
|
|
68
71
|
const target = event.target
|
|
69
72
|
|
|
70
73
|
if (!(target instanceof HTMLInputElement)) {
|
|
@@ -97,7 +100,7 @@ const OTPInput = ({
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
const handlePaste = (event: ClipboardEvent) => {
|
|
103
|
+
const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {
|
|
101
104
|
event.preventDefault()
|
|
102
105
|
|
|
103
106
|
const target = event.target
|
|
@@ -122,7 +125,7 @@ const OTPInput = ({
|
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
|
|
125
|
-
const handleFocus = (event:
|
|
128
|
+
const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {
|
|
126
129
|
const target = event.target
|
|
127
130
|
|
|
128
131
|
if (target instanceof HTMLInputElement) {
|
|
@@ -163,12 +166,12 @@ const OTPInput = ({
|
|
|
163
166
|
<div className={styles.separator} key={index}>{input}</div>
|
|
164
167
|
) : (
|
|
165
168
|
<Input
|
|
169
|
+
{...rest}
|
|
166
170
|
key={index}
|
|
167
171
|
id={`${name}-${index}`}
|
|
168
172
|
className={styles.input}
|
|
169
173
|
type="text"
|
|
170
174
|
maxLength={1}
|
|
171
|
-
disabled={disabled}
|
|
172
175
|
inputMode="numeric"
|
|
173
176
|
autoComplete="one-time-code"
|
|
174
177
|
data-index={input}
|
|
@@ -178,7 +181,6 @@ const OTPInput = ({
|
|
|
178
181
|
onFocus={handleFocus}
|
|
179
182
|
onInput={handleInput}
|
|
180
183
|
onPaste={handlePaste}
|
|
181
|
-
{...rest}
|
|
182
184
|
/>
|
|
183
185
|
)
|
|
184
186
|
)}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
export type OTPInputProps = {
|
|
1
|
+
export type OTPInputProps<T extends object = object> = {
|
|
2
2
|
name?: string
|
|
3
|
-
disabled?: boolean
|
|
4
3
|
length?: number
|
|
5
4
|
groupLength?: number
|
|
6
5
|
separator?: string
|
|
7
6
|
label?: string
|
|
8
7
|
subText?: string
|
|
9
8
|
className?: string
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
} & T
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { PaginationEventType, PaginationProps } from './pagination'
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.svelte'
|
|
5
5
|
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
import styles from './pagination.module.scss'
|
|
12
12
|
|
|
13
|
+
export type Props = PaginationProps & {
|
|
14
|
+
onChange?: (event: PaginationEventType) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
const {
|
|
14
18
|
type,
|
|
15
19
|
showChevrons,
|
|
@@ -26,14 +30,14 @@
|
|
|
26
30
|
currentPage,
|
|
27
31
|
onChange,
|
|
28
32
|
className
|
|
29
|
-
}:
|
|
33
|
+
}: Props = $props()
|
|
30
34
|
|
|
31
|
-
const classes = classNames([
|
|
35
|
+
const classes = $derived(classNames([
|
|
32
36
|
styles.pagination,
|
|
33
37
|
theme !== 'outline' && (theme === null || theme === undefined ? styles.primary : styles[theme]),
|
|
34
38
|
type === 'dots' && styles.dots,
|
|
35
39
|
className
|
|
36
|
-
])
|
|
40
|
+
]))
|
|
37
41
|
|
|
38
42
|
const calculatedTotalPages = $derived(totalPages
|
|
39
43
|
|| pages?.length
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { PaginationEventType, PaginationProps } from './pagination'
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.tsx'
|
|
5
5
|
|
|
@@ -10,6 +10,10 @@ import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
|
10
10
|
|
|
11
11
|
import styles from './pagination.module.scss'
|
|
12
12
|
|
|
13
|
+
export type Props = PaginationProps & {
|
|
14
|
+
onChange?: (event: PaginationEventType) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
const Pagination = ({
|
|
14
18
|
type,
|
|
15
19
|
showChevrons,
|
|
@@ -27,7 +31,7 @@ const Pagination = ({
|
|
|
27
31
|
onChange,
|
|
28
32
|
className
|
|
29
33
|
// eslint-disable-next-line complexity
|
|
30
|
-
}:
|
|
34
|
+
}: Props) => {
|
|
31
35
|
const [calculatedCurrentPage, setCalculatedCurrentPage] = useState(
|
|
32
36
|
currentPage
|
|
33
37
|
|| (pages?.findIndex(page => page.active) || -1) + 1
|
|
@@ -26,11 +26,3 @@ export type PaginationProps = {
|
|
|
26
26
|
link?: string
|
|
27
27
|
}[]
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
export type SveltePaginationProps = {
|
|
31
|
-
onChange?: (event: PaginationEventType) => void
|
|
32
|
-
} & PaginationProps
|
|
33
|
-
|
|
34
|
-
export type ReactPaginationProps = {
|
|
35
|
-
onChange?: (event: PaginationEventType) => void
|
|
36
|
-
} & PaginationProps
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { PopoverProps } from './popover'
|
|
3
4
|
|
|
4
5
|
import styles from './popover.module.scss'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
export type Props = PopoverProps<HTMLAttributes<'dialog'>>
|
|
7
8
|
|
|
8
9
|
const {
|
|
9
|
-
id,
|
|
10
10
|
className,
|
|
11
11
|
transparent,
|
|
12
12
|
...rest
|
|
@@ -19,10 +19,6 @@ const classes = [
|
|
|
19
19
|
]
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
<dialog
|
|
23
|
-
class:list={classes}
|
|
24
|
-
id={id}
|
|
25
|
-
{...rest}
|
|
26
|
-
>
|
|
22
|
+
<dialog {...rest} class:list={classes}>
|
|
27
23
|
<slot />
|
|
28
24
|
</dialog>
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLDialogAttributes } from 'svelte/elements'
|
|
4
|
+
import type { PopoverProps } from './popover'
|
|
3
5
|
|
|
4
6
|
import { classNames } from '../../utils/classNames'
|
|
5
7
|
|
|
6
8
|
import styles from './popover.module.scss'
|
|
7
9
|
|
|
10
|
+
export type Props = PopoverProps<HTMLDialogAttributes> & {
|
|
11
|
+
children: Snippet
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
const {
|
|
9
|
-
id,
|
|
10
15
|
className,
|
|
11
16
|
transparent,
|
|
12
17
|
children,
|
|
13
18
|
...rest
|
|
14
|
-
}:
|
|
19
|
+
}: Props = $props()
|
|
15
20
|
|
|
16
|
-
const classes = classNames([
|
|
21
|
+
const classes = $derived(classNames([
|
|
17
22
|
styles.popover,
|
|
18
23
|
transparent && styles.transparent,
|
|
19
24
|
className
|
|
20
|
-
])
|
|
25
|
+
]))
|
|
21
26
|
</script>
|
|
22
27
|
|
|
23
|
-
<dialog
|
|
24
|
-
class={classes}
|
|
25
|
-
id={id}
|
|
26
|
-
{...rest}
|
|
27
|
-
>
|
|
28
|
+
<dialog {...rest} class={classes}>
|
|
28
29
|
{@render children?.()}
|
|
29
30
|
</dialog>
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React, { useEffect,useState } from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
|
-
import type {
|
|
3
|
+
import type { PopoverProps } from './popover'
|
|
4
4
|
|
|
5
5
|
import { classNames } from '../../utils/classNames'
|
|
6
6
|
|
|
7
7
|
import styles from './popover.module.scss'
|
|
8
8
|
|
|
9
|
+
export type Props = PopoverProps<React.DialogHTMLAttributes<HTMLDialogElement>> & {
|
|
10
|
+
isInteractive?: boolean
|
|
11
|
+
children?: React.ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
const Popover = ({
|
|
10
15
|
id,
|
|
11
16
|
className,
|
|
@@ -13,7 +18,7 @@ const Popover = ({
|
|
|
13
18
|
isInteractive = false,
|
|
14
19
|
children,
|
|
15
20
|
...rest
|
|
16
|
-
}:
|
|
21
|
+
}: Props) => {
|
|
17
22
|
const [isMounted, setIsMounted] = useState(false)
|
|
18
23
|
|
|
19
24
|
const classes = classNames([
|
|
@@ -32,11 +37,7 @@ const Popover = ({
|
|
|
32
37
|
|
|
33
38
|
if (isInteractive) {
|
|
34
39
|
return createPortal(
|
|
35
|
-
<dialog
|
|
36
|
-
className={classes}
|
|
37
|
-
id={id}
|
|
38
|
-
{...rest}
|
|
39
|
-
>
|
|
40
|
+
<dialog {...rest} className={classes}>
|
|
40
41
|
{children}
|
|
41
42
|
</dialog>,
|
|
42
43
|
document.body
|
|
@@ -44,11 +45,7 @@ const Popover = ({
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
return (
|
|
47
|
-
<dialog
|
|
48
|
-
className={classes}
|
|
49
|
-
id={id}
|
|
50
|
-
{...rest}
|
|
51
|
-
>
|
|
48
|
+
<dialog {...rest} className={classes}>
|
|
52
49
|
{children}
|
|
53
50
|
</dialog>
|
|
54
51
|
)
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type PopoverProps = {
|
|
4
|
-
id?: string
|
|
1
|
+
export type PopoverProps<T extends object = object> = {
|
|
5
2
|
className?: string
|
|
6
3
|
transparent?: boolean
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type SveltePopoverProps = {
|
|
11
|
-
children: Snippet
|
|
12
|
-
} & PopoverProps
|
|
13
|
-
|
|
14
|
-
export type ReactPopoverProps = {
|
|
15
|
-
isInteractive?: boolean
|
|
16
|
-
children?: React.ReactNode
|
|
17
|
-
} & PopoverProps
|
|
4
|
+
} & T
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './progress.module.scss'
|
|
7
|
+
|
|
8
|
+
export type Props = ProgressProps
|
|
7
9
|
|
|
8
10
|
const {
|
|
9
11
|
value,
|
|
@@ -17,25 +19,25 @@
|
|
|
17
19
|
stripeDark,
|
|
18
20
|
indeterminate,
|
|
19
21
|
className
|
|
20
|
-
}:
|
|
22
|
+
}: Props = $props()
|
|
21
23
|
|
|
22
|
-
const classes = classNames([
|
|
24
|
+
const classes = $derived(classNames([
|
|
23
25
|
styles['w-progress'],
|
|
24
26
|
size && styles[size],
|
|
25
27
|
striped && styles.striped,
|
|
26
28
|
square && styles.square,
|
|
27
29
|
indeterminate && styles.indeterminate,
|
|
28
30
|
className
|
|
29
|
-
])
|
|
31
|
+
]))
|
|
30
32
|
|
|
31
|
-
const styleVariables = classNames([
|
|
33
|
+
const styleVariables = $derived(classNames([
|
|
32
34
|
color && `--w-progress-color: ${color};`,
|
|
33
35
|
background && `--w-progress-background: ${background};`,
|
|
34
36
|
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
35
37
|
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
36
|
-
])
|
|
38
|
+
]))
|
|
37
39
|
|
|
38
|
-
const currentValue = indeterminate && !value ? 20 : value
|
|
40
|
+
const currentValue = $derived(indeterminate && !value ? 20 : value)
|
|
39
41
|
</script>
|
|
40
42
|
|
|
41
43
|
<div class={classes} style={styleVariables || null}>
|
|
@@ -4,6 +4,8 @@ import type { ProgressProps } from './progress'
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './progress.module.scss'
|
|
7
|
+
|
|
8
|
+
export type Props = ProgressProps
|
|
7
9
|
|
|
8
10
|
const Progress = ({
|
|
9
11
|
value,
|
|
@@ -17,7 +19,7 @@ const Progress = ({
|
|
|
17
19
|
stripeDark,
|
|
18
20
|
indeterminate,
|
|
19
21
|
className
|
|
20
|
-
}:
|
|
22
|
+
}: Props) => {
|
|
21
23
|
const classes = classNames([
|
|
22
24
|
styles['w-progress'],
|
|
23
25
|
size && styles[size],
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-progress-color: var(--w-color-primary);
|
|
5
|
-
--w-progress-background: var(--w-color-primary-50);
|
|
6
|
-
--w-progress-stripe-light: var(--w-color-primary);
|
|
7
|
-
--w-progress-stripe-dark: var(--w-color-primary-10);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
3
|
.w-progress {
|
|
4
|
+
--color: var(--w-progress-color, var(--w-color-primary));
|
|
5
|
+
--bg: var(--w-progress-background, var(--w-color-primary-50));
|
|
6
|
+
--stripe-light: var(--w-progress-stripe-light, var(--w-color-primary));
|
|
7
|
+
--stripe-dark: var(--w-progress-stripe-dark, var(--w-color-primary-10));
|
|
8
|
+
|
|
11
9
|
@include size('w100%', h10px);
|
|
12
10
|
@include border-radius(xl);
|
|
13
11
|
@include visibility(hidden);
|
|
14
12
|
@include typography(bold, xs);
|
|
15
|
-
@include background(var(--
|
|
13
|
+
@include background(var(--bg));
|
|
16
14
|
|
|
17
|
-
color: var(--
|
|
15
|
+
color: var(--bg);
|
|
18
16
|
|
|
19
17
|
&.medium {
|
|
20
18
|
@include size(h15px);
|
|
@@ -39,13 +37,13 @@ body {
|
|
|
39
37
|
background-size: 10px 10px;
|
|
40
38
|
background-image: linear-gradient(
|
|
41
39
|
-45deg,
|
|
42
|
-
var(--
|
|
43
|
-
var(--
|
|
44
|
-
var(--
|
|
45
|
-
var(--
|
|
46
|
-
var(--
|
|
47
|
-
var(--
|
|
48
|
-
var(--
|
|
40
|
+
var(--stripe-light) 25%,
|
|
41
|
+
var(--stripe-dark) 25%,
|
|
42
|
+
var(--stripe-dark) 50%,
|
|
43
|
+
var(--stripe-light) 50%,
|
|
44
|
+
var(--stripe-light) 75%,
|
|
45
|
+
var(--stripe-dark) 75%,
|
|
46
|
+
var(--stripe-dark)
|
|
49
47
|
);
|
|
50
48
|
}
|
|
51
49
|
|
|
@@ -69,7 +67,7 @@ body {
|
|
|
69
67
|
@include size('h100%');
|
|
70
68
|
@include border-radius(xl);
|
|
71
69
|
@include layout(flex, center);
|
|
72
|
-
@include background(var(--
|
|
70
|
+
@include background(var(--color));
|
|
73
71
|
|
|
74
72
|
width: var(--w-progress-width);
|
|
75
73
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { RadioProps } from './radio'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
5
6
|
|
|
6
7
|
import styles from './radio.module.scss'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
export type Props = RadioProps<HTMLAttributes<'input'>>
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
|
-
name,
|
|
12
12
|
items,
|
|
13
13
|
color,
|
|
14
14
|
inline,
|
|
@@ -38,12 +38,12 @@ const style = color
|
|
|
38
38
|
children
|
|
39
39
|
</div>
|
|
40
40
|
<input
|
|
41
|
+
{...rest}
|
|
41
42
|
type="radio"
|
|
42
|
-
name={name}
|
|
43
43
|
value={item.value}
|
|
44
44
|
checked={item.selected}
|
|
45
45
|
disabled={item.disabled}
|
|
46
|
-
{
|
|
46
|
+
required={item.required}
|
|
47
47
|
/>
|
|
48
48
|
<span class={styles.icon} />
|
|
49
49
|
<span class={styles.label}>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
3
|
+
import type { RadioProps } from './radio'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
6
|
|
|
@@ -7,25 +8,31 @@
|
|
|
7
8
|
|
|
8
9
|
import styles from './radio.module.scss'
|
|
9
10
|
|
|
11
|
+
import type { InputTarget } from '../Input/input'
|
|
12
|
+
|
|
13
|
+
export type Props = RadioProps<HTMLInputAttributes> & {
|
|
14
|
+
onChange?: (event: Event & InputTarget) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
const {
|
|
11
|
-
name,
|
|
12
18
|
items,
|
|
13
19
|
color,
|
|
14
20
|
inline,
|
|
15
21
|
className,
|
|
16
22
|
onChange,
|
|
17
23
|
...rest
|
|
18
|
-
}:
|
|
24
|
+
}: Props = $props()
|
|
19
25
|
|
|
20
|
-
const classes = classNames([
|
|
26
|
+
const classes = $derived(classNames([
|
|
21
27
|
styles.radio,
|
|
22
28
|
inline && styles.inline,
|
|
23
29
|
className
|
|
24
|
-
])
|
|
30
|
+
]))
|
|
25
31
|
|
|
26
|
-
const style = color
|
|
32
|
+
const style = $derived(color
|
|
27
33
|
? `--w-radio-color: ${color};`
|
|
28
34
|
: null
|
|
35
|
+
)
|
|
29
36
|
</script>
|
|
30
37
|
|
|
31
38
|
<div class={classes} style={style}>
|
|
@@ -41,13 +48,13 @@
|
|
|
41
48
|
class={styles.wrapper}
|
|
42
49
|
>
|
|
43
50
|
<input
|
|
51
|
+
{...rest}
|
|
44
52
|
type="radio"
|
|
45
|
-
name={name}
|
|
46
53
|
value={item.value}
|
|
47
54
|
checked={item.selected}
|
|
48
55
|
disabled={item.disabled}
|
|
56
|
+
required={item.required}
|
|
49
57
|
onchange={onChange}
|
|
50
|
-
{...rest}
|
|
51
58
|
/>
|
|
52
59
|
<span class={styles.icon}></span>
|
|
53
60
|
<span class={styles.label}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { RadioProps } from './radio'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
|
|
@@ -7,15 +7,18 @@ import { classNames } from '../../utils/classNames'
|
|
|
7
7
|
|
|
8
8
|
import styles from './radio.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = RadioProps<React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
11
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
const Radio = ({
|
|
11
|
-
name,
|
|
12
15
|
items,
|
|
13
16
|
color,
|
|
14
17
|
inline,
|
|
15
18
|
className,
|
|
16
19
|
onChange,
|
|
17
20
|
...rest
|
|
18
|
-
}:
|
|
21
|
+
}: Props) => {
|
|
19
22
|
const classes = classNames([
|
|
20
23
|
styles.radio,
|
|
21
24
|
inline && styles.inline,
|
|
@@ -42,13 +45,13 @@ const Radio = ({
|
|
|
42
45
|
)}
|
|
43
46
|
>
|
|
44
47
|
<input
|
|
48
|
+
{...rest}
|
|
45
49
|
type="radio"
|
|
46
|
-
name={name}
|
|
47
50
|
value={item.value}
|
|
48
51
|
defaultChecked={item.selected}
|
|
49
52
|
disabled={item.disabled}
|
|
53
|
+
required={item.required}
|
|
50
54
|
onChange={onChange}
|
|
51
|
-
{...rest}
|
|
52
55
|
/>
|
|
53
56
|
<span className={styles.icon} />
|
|
54
57
|
<span
|