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,21 +1,26 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { GroupProps } from './group'
|
|
3
4
|
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
import styles from './group.module.scss'
|
|
7
8
|
|
|
9
|
+
export type Props = GroupProps & {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
withSeparator,
|
|
10
15
|
className,
|
|
11
16
|
children
|
|
12
|
-
}:
|
|
17
|
+
}: Props = $props()
|
|
13
18
|
|
|
14
|
-
const classes = classNames([
|
|
19
|
+
const classes = $derived(classNames([
|
|
15
20
|
styles.group,
|
|
16
21
|
withSeparator && styles.separator,
|
|
17
22
|
className
|
|
18
|
-
])
|
|
23
|
+
]))
|
|
19
24
|
</script>
|
|
20
25
|
|
|
21
26
|
<div class={classes}>
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupProps } from './group'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './group.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = GroupProps & {
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
const Group = ({
|
|
9
13
|
withSeparator,
|
|
10
14
|
className,
|
|
11
15
|
children
|
|
12
|
-
}:
|
|
16
|
+
}: Props) => {
|
|
13
17
|
const classes = classNames([
|
|
14
18
|
styles.group,
|
|
15
19
|
withSeparator && styles.separator,
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type GroupProps = {
|
|
4
2
|
withSeparator?: boolean
|
|
5
3
|
className?: string
|
|
6
4
|
}
|
|
7
|
-
|
|
8
|
-
export type SvelteGroupProps = {
|
|
9
|
-
children: Snippet
|
|
10
|
-
} & GroupProps
|
|
11
|
-
|
|
12
|
-
export type ReactGroupProps = {
|
|
13
|
-
children: React.ReactNode
|
|
14
|
-
} & GroupProps
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconProps } from './icon'
|
|
3
3
|
import iconMap from './map'
|
|
4
|
+
|
|
5
|
+
export type Props = IconProps
|
|
4
6
|
|
|
5
7
|
const {
|
|
6
8
|
type,
|
|
@@ -8,25 +10,30 @@
|
|
|
8
10
|
color,
|
|
9
11
|
theme,
|
|
10
12
|
iconSet
|
|
11
|
-
}:
|
|
13
|
+
}: Props = $props()
|
|
12
14
|
|
|
13
|
-
const icons = {
|
|
15
|
+
const icons = $derived({
|
|
14
16
|
...iconMap,
|
|
15
17
|
...(iconSet || {})
|
|
16
|
-
}
|
|
18
|
+
})
|
|
17
19
|
|
|
18
|
-
const svg =
|
|
20
|
+
const svg = $derived.by(() => {
|
|
21
|
+
const icon = icons[type as keyof typeof iconMap]
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
if (!icon) {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.error('Cannot find icon type:', type)
|
|
26
|
+
}
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
return icon
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const icon = $derived(svg
|
|
26
32
|
?.replace('width="24"', `width=${size}`)
|
|
27
33
|
?.replace('height="24"', color || theme
|
|
28
34
|
? `height=${size} color=${color || `var(--w-color-${theme})`}`
|
|
29
35
|
: `height=${size}`)
|
|
36
|
+
)
|
|
30
37
|
</script>
|
|
31
38
|
|
|
32
39
|
{@html icon}
|
package/components/Icon/Icon.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import type { IconProps } from './icon'
|
|
3
2
|
import iconMap from './map'
|
|
3
|
+
|
|
4
|
+
export type Props = IconProps
|
|
4
5
|
|
|
5
6
|
const Icon = ({
|
|
6
7
|
type,
|
|
@@ -8,7 +9,7 @@ const Icon = ({
|
|
|
8
9
|
color,
|
|
9
10
|
theme,
|
|
10
11
|
iconSet
|
|
11
|
-
}:
|
|
12
|
+
}: Props) => {
|
|
12
13
|
const icons = {
|
|
13
14
|
...iconMap,
|
|
14
15
|
...(iconSet || {})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { ImageProps } from './image'
|
|
3
4
|
|
|
4
5
|
import AspectRatio from '../AspectRatio/AspectRatio.astro'
|
|
@@ -6,7 +7,7 @@ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
|
6
7
|
|
|
7
8
|
import styles from './image.module.scss'
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
export type Props = ImageProps<HTMLAttributes<'img'>>
|
|
10
11
|
|
|
11
12
|
const {
|
|
12
13
|
src,
|
|
@@ -1,51 +1,54 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLImgAttributes } from 'svelte/elements'
|
|
3
|
+
import type { ImageProps } from './image'
|
|
4
|
+
|
|
5
|
+
import AspectRatio from '../AspectRatio/AspectRatio.svelte'
|
|
6
|
+
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
import styles from './image.module.scss'
|
|
10
|
+
|
|
11
|
+
export type Props = ImageProps<HTMLImgAttributes>
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
src,
|
|
15
|
+
alt,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
lazy,
|
|
19
|
+
ratio,
|
|
20
|
+
center,
|
|
21
|
+
full,
|
|
22
|
+
rounded,
|
|
23
|
+
className,
|
|
24
|
+
...rest
|
|
25
|
+
}: Props = $props()
|
|
26
|
+
|
|
27
|
+
const classes = $derived(classNames([
|
|
28
|
+
styles.img,
|
|
29
|
+
center && styles.center,
|
|
30
|
+
full && styles[full],
|
|
31
|
+
rounded && styles[rounded],
|
|
32
|
+
className
|
|
33
|
+
]))
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
{#snippet img()}
|
|
37
|
+
<img
|
|
38
|
+
{...rest}
|
|
39
|
+
src={src}
|
|
40
|
+
alt={alt || ''}
|
|
41
|
+
width={width}
|
|
42
|
+
height={height}
|
|
43
|
+
loading={lazy ? 'lazy' : null}
|
|
44
|
+
class={classes}
|
|
45
|
+
/>
|
|
46
|
+
{/snippet}
|
|
47
|
+
|
|
48
|
+
{#if ratio}
|
|
49
|
+
<AspectRatio ratio={ratio}>
|
|
50
|
+
{@render img()}
|
|
51
|
+
</AspectRatio>
|
|
52
|
+
{:else}
|
|
53
|
+
{@render img()}
|
|
54
|
+
{/if}
|
|
@@ -8,6 +8,8 @@ import { classNames } from '../../utils/classNames'
|
|
|
8
8
|
|
|
9
9
|
import styles from './image.module.scss'
|
|
10
10
|
|
|
11
|
+
export type Props = ImageProps<React.ImgHTMLAttributes<HTMLImageElement>>
|
|
12
|
+
|
|
11
13
|
const Image = ({
|
|
12
14
|
src,
|
|
13
15
|
alt,
|
|
@@ -20,7 +22,7 @@ const Image = ({
|
|
|
20
22
|
rounded,
|
|
21
23
|
className,
|
|
22
24
|
...rest
|
|
23
|
-
}:
|
|
25
|
+
}: Props) => {
|
|
24
26
|
const classes = classNames([
|
|
25
27
|
styles.img,
|
|
26
28
|
center && styles.center,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ImageProps = {
|
|
1
|
+
export type ImageProps<T extends object = object> = {
|
|
2
2
|
src: string
|
|
3
3
|
alt: string
|
|
4
4
|
width: number | string
|
|
@@ -9,5 +9,4 @@ export type ImageProps = {
|
|
|
9
9
|
full?: 'width' | 'height' | 'both'
|
|
10
10
|
rounded?: 'top' | 'bottom' | 'left' | 'right' | 'diagonal' | 'reverse-diagonal' | 'none'
|
|
11
11
|
className?: string
|
|
12
|
-
|
|
13
|
-
}
|
|
12
|
+
} & T
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import styles from './imageloader.module.scss'
|
|
11
11
|
|
|
12
|
+
export type Props = ImageLoaderProps
|
|
13
|
+
|
|
12
14
|
const {
|
|
13
15
|
fallback,
|
|
14
16
|
animate,
|
|
@@ -19,14 +21,14 @@
|
|
|
19
21
|
waveColor,
|
|
20
22
|
className,
|
|
21
23
|
...rest
|
|
22
|
-
}:
|
|
24
|
+
}: Props = $props()
|
|
23
25
|
|
|
24
26
|
let container: HTMLDivElement
|
|
25
27
|
|
|
26
|
-
const styleVariables = classNames([
|
|
28
|
+
const styleVariables = $derived(classNames([
|
|
27
29
|
`width: ${width}px;`,
|
|
28
30
|
`height: ${height}px;`
|
|
29
|
-
])
|
|
31
|
+
]))
|
|
30
32
|
|
|
31
33
|
onMount(() => {
|
|
32
34
|
const img = container.querySelector<HTMLImageElement>('img')
|
|
@@ -6,6 +6,8 @@ import Skeleton from '../Skeleton/Skeleton.tsx'
|
|
|
6
6
|
|
|
7
7
|
import styles from './imageloader.module.scss'
|
|
8
8
|
|
|
9
|
+
export type Props = ImageLoaderProps
|
|
10
|
+
|
|
9
11
|
const ImageLoader = ({
|
|
10
12
|
fallback,
|
|
11
13
|
animate,
|
|
@@ -16,7 +18,7 @@ const ImageLoader = ({
|
|
|
16
18
|
waveColor,
|
|
17
19
|
className,
|
|
18
20
|
...rest
|
|
19
|
-
}:
|
|
21
|
+
}: Props) => {
|
|
20
22
|
const containerRef = useRef<HTMLDivElement>(null)
|
|
21
23
|
const styleVariables = {
|
|
22
24
|
width,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { InputProps } from './input'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
5
6
|
|
|
6
7
|
import styles from './input.module.scss'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
export type Props = InputProps<HTMLAttributes<'input'>>
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
12
|
type = 'text',
|
|
@@ -50,8 +51,8 @@ const useLabel = !!(label || subText || Astro.slots.has('default'))
|
|
|
50
51
|
)}
|
|
51
52
|
</label>
|
|
52
53
|
<input
|
|
54
|
+
{...rest}
|
|
53
55
|
type={type}
|
|
54
56
|
class:list={classes}
|
|
55
|
-
{...rest}
|
|
56
57
|
/>
|
|
57
58
|
</ConditionalWrapper>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
4
|
+
import type { InputProps, InputTarget } from './input'
|
|
3
5
|
|
|
4
6
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
7
|
|
|
@@ -7,6 +9,14 @@
|
|
|
7
9
|
|
|
8
10
|
import styles from './input.module.scss'
|
|
9
11
|
|
|
12
|
+
export type Props = InputProps<HTMLInputAttributes> & {
|
|
13
|
+
onChange?: (event: Event & InputTarget) => void
|
|
14
|
+
onKeyUp?: (event: KeyboardEvent & InputTarget) => void
|
|
15
|
+
onInput?: (event: Event & InputTarget) => void
|
|
16
|
+
onClick?: (event: MouseEvent & InputTarget) => void
|
|
17
|
+
children?: Snippet
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
let {
|
|
11
21
|
type = 'text',
|
|
12
22
|
theme,
|
|
@@ -21,20 +31,20 @@
|
|
|
21
31
|
onClick,
|
|
22
32
|
children,
|
|
23
33
|
...rest
|
|
24
|
-
}:
|
|
34
|
+
}: Props = $props()
|
|
25
35
|
|
|
26
|
-
const classes = classNames([
|
|
36
|
+
const classes = $derived(classNames([
|
|
27
37
|
styles.input,
|
|
28
38
|
theme && styles[theme],
|
|
29
39
|
className
|
|
30
|
-
])
|
|
40
|
+
]))
|
|
31
41
|
|
|
32
|
-
const labelClasses = classNames([
|
|
42
|
+
const labelClasses = $derived(classNames([
|
|
33
43
|
styles['input-label'],
|
|
34
44
|
labelClassName
|
|
35
|
-
])
|
|
45
|
+
]))
|
|
36
46
|
|
|
37
|
-
const useLabel = !!(label || subText || children)
|
|
47
|
+
const useLabel = $derived(!!(label || subText || children))
|
|
38
48
|
</script>
|
|
39
49
|
|
|
40
50
|
<ConditionalWrapper
|
|
@@ -52,14 +62,14 @@
|
|
|
52
62
|
>
|
|
53
63
|
{@render children?.()}
|
|
54
64
|
<input
|
|
65
|
+
{...rest}
|
|
66
|
+
{...{ type }}
|
|
55
67
|
bind:value
|
|
56
68
|
class={classes}
|
|
57
69
|
onchange={onChange}
|
|
58
70
|
onkeyup={onKeyUp}
|
|
59
71
|
oninput={onInput}
|
|
60
72
|
onclick={onClick}
|
|
61
|
-
{...{ type }}
|
|
62
|
-
{...rest}
|
|
63
73
|
/>
|
|
64
74
|
</ConditionalWrapper>
|
|
65
75
|
{#if subText}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { InputProps } from './input'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
|
|
@@ -7,6 +7,14 @@ import { classNames } from '../../utils/classNames'
|
|
|
7
7
|
|
|
8
8
|
import styles from './input.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = InputProps<React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
11
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
12
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
13
|
+
onInput?: (event: React.InputEvent<HTMLInputElement>) => void
|
|
14
|
+
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void
|
|
15
|
+
children?: React.ReactNode
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
const Input = ({
|
|
11
19
|
type = 'text',
|
|
12
20
|
theme,
|
|
@@ -17,7 +25,7 @@ const Input = ({
|
|
|
17
25
|
labelClassName,
|
|
18
26
|
children,
|
|
19
27
|
...rest
|
|
20
|
-
}:
|
|
28
|
+
}: Props) => {
|
|
21
29
|
const classes = classNames([
|
|
22
30
|
styles.input,
|
|
23
31
|
theme && styles[theme],
|
|
@@ -50,10 +58,10 @@ const Input = ({
|
|
|
50
58
|
)}>
|
|
51
59
|
{children}
|
|
52
60
|
<input
|
|
61
|
+
{...rest}
|
|
53
62
|
type={type}
|
|
54
63
|
className={classes}
|
|
55
64
|
defaultValue={value}
|
|
56
|
-
{...rest}
|
|
57
65
|
/>
|
|
58
66
|
</ConditionalWrapper>
|
|
59
67
|
{subText && (
|
|
@@ -1,62 +1,35 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type InputTarget = {
|
|
4
2
|
currentTarget: HTMLInputElement
|
|
5
3
|
}
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
type InputType = 'text'
|
|
6
|
+
| 'email'
|
|
7
|
+
| 'password'
|
|
8
|
+
| 'number'
|
|
9
|
+
| 'tel'
|
|
10
|
+
| 'url'
|
|
11
|
+
| 'search'
|
|
12
|
+
| 'file'
|
|
13
|
+
| 'date'
|
|
14
|
+
| 'datetime-local'
|
|
15
|
+
| 'month'
|
|
16
|
+
| 'week'
|
|
17
|
+
| 'time'
|
|
18
|
+
| 'color'
|
|
19
|
+
|
|
20
|
+
type InputTheme = 'info'
|
|
21
|
+
| 'success'
|
|
22
|
+
| 'warning'
|
|
23
|
+
| 'alert'
|
|
24
|
+
| 'fill'
|
|
25
|
+
| null
|
|
26
|
+
|
|
27
|
+
export type InputProps<T extends object = object> = {
|
|
28
|
+
type?: InputType
|
|
29
|
+
theme?: InputTheme
|
|
28
30
|
value?: string | number
|
|
29
|
-
name?: string
|
|
30
|
-
placeholder?: string
|
|
31
31
|
label?: string
|
|
32
|
-
disabled?: boolean
|
|
33
32
|
subText?: string
|
|
34
|
-
maxLength?: number
|
|
35
|
-
min?: number
|
|
36
|
-
max?: number
|
|
37
|
-
step?: number
|
|
38
|
-
multiple?: boolean
|
|
39
|
-
pattern?: string
|
|
40
|
-
required?: boolean
|
|
41
|
-
autofocus?: boolean
|
|
42
|
-
autocomplete?: 'on' | 'off' | 'one-time-code'
|
|
43
33
|
className?: string
|
|
44
34
|
labelClassName?: string
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type SvelteInputProps = {
|
|
49
|
-
onChange?: (event: Event & InputTarget) => void
|
|
50
|
-
onKeyUp?: (event: KeyboardEvent & InputTarget) => void
|
|
51
|
-
onInput?: (event: Event & InputTarget) => void
|
|
52
|
-
onClick?: (event: MouseEvent & InputTarget) => void
|
|
53
|
-
children?: Snippet
|
|
54
|
-
} & InputProps
|
|
55
|
-
|
|
56
|
-
export type ReactInputProps = {
|
|
57
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
58
|
-
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
59
|
-
onInput?: (event: React.InputEvent<HTMLInputElement>) => void
|
|
60
|
-
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void
|
|
61
|
-
children?: React.ReactNode
|
|
62
|
-
} & InputProps
|
|
35
|
+
} & T
|
package/components/Kbd/Kbd.astro
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { KbdProps } from './kbd'
|
|
3
4
|
import { keyMap } from './keyMap'
|
|
4
5
|
|
|
5
6
|
import { classNames } from '../../utils/classNames'
|
|
6
7
|
|
|
7
8
|
import styles from './kbd.module.scss'
|
|
8
9
|
|
|
10
|
+
export type Props = KbdProps & {
|
|
11
|
+
children?: Snippet
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
const {
|
|
10
15
|
keys,
|
|
11
16
|
className,
|
|
12
17
|
children
|
|
13
|
-
}:
|
|
18
|
+
}: Props = $props()
|
|
14
19
|
|
|
15
|
-
const classes = classNames([
|
|
20
|
+
const classes = $derived(classNames([
|
|
16
21
|
styles.kbd,
|
|
17
22
|
className
|
|
18
|
-
])
|
|
23
|
+
]))
|
|
19
24
|
</script>
|
|
20
25
|
|
|
21
26
|
<kbd class={classes}>{keys?.map(key => keyMap[key]).join('')}{@render children?.()}</kbd>
|
package/components/Kbd/Kbd.tsx
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { KbdProps } from './kbd'
|
|
3
3
|
import { keyMap } from './keyMap'
|
|
4
4
|
|
|
5
5
|
import { classNames } from '../../utils/classNames'
|
|
6
6
|
|
|
7
7
|
import styles from './kbd.module.scss'
|
|
8
8
|
|
|
9
|
+
export type Props = KbdProps & {
|
|
10
|
+
children?: React.ReactNode
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
const Kbd = ({
|
|
10
14
|
keys,
|
|
11
15
|
className,
|
|
12
16
|
children
|
|
13
|
-
}:
|
|
17
|
+
}: Props) => {
|
|
14
18
|
const classes = classNames([
|
|
15
19
|
styles.kbd,
|
|
16
20
|
className
|
package/components/Kbd/kbd.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type KbdProps = {
|
|
4
2
|
keys?: ('cmd'
|
|
5
3
|
| 'shift'
|
|
@@ -22,11 +20,3 @@ export type KbdProps = {
|
|
|
22
20
|
| 'space')[]
|
|
23
21
|
className?: string
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
export type SvelteKbdProps = {
|
|
27
|
-
children?: Snippet
|
|
28
|
-
} & KbdProps
|
|
29
|
-
|
|
30
|
-
export type ReactKbdProps = {
|
|
31
|
-
children?: React.ReactNode
|
|
32
|
-
} & KbdProps
|