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,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ListEventType,
|
|
2
|
+
import type { ListEventType, ListProps } from './list'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
5
|
import Input from '../Input/Input.svelte'
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
import styles from './list.module.scss'
|
|
12
12
|
|
|
13
|
+
export type Props = ListProps & {
|
|
14
|
+
onSelect?: (event: ListEventType) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
let {
|
|
14
18
|
showSearchBar,
|
|
15
19
|
showSearchBarIcon,
|
|
@@ -22,25 +26,25 @@
|
|
|
22
26
|
secondary,
|
|
23
27
|
itemGroups = $bindable([]),
|
|
24
28
|
onSelect
|
|
25
|
-
}:
|
|
29
|
+
}: Props = $props()
|
|
26
30
|
|
|
27
31
|
let searchValue = $state('')
|
|
28
32
|
let numberOfResults = $state(1)
|
|
29
33
|
|
|
30
|
-
const classes = classNames([
|
|
34
|
+
const classes = $derived(classNames([
|
|
31
35
|
styles.list,
|
|
32
36
|
(secondary && !showSearchBar) && styles.secondary,
|
|
33
37
|
!showSearchBar && styles.container,
|
|
34
38
|
className
|
|
35
|
-
])
|
|
39
|
+
]))
|
|
36
40
|
|
|
37
|
-
const wrapperClasses = classNames([
|
|
41
|
+
const wrapperClasses = $derived(classNames([
|
|
38
42
|
styles.container,
|
|
39
43
|
secondary && styles.secondary,
|
|
40
44
|
wrapperClassName
|
|
41
|
-
])
|
|
45
|
+
]))
|
|
42
46
|
|
|
43
|
-
const search = (event:
|
|
47
|
+
const search = (event: Event) => {
|
|
44
48
|
searchValue = (event.target as HTMLInputElement).value.toLowerCase()
|
|
45
49
|
|
|
46
50
|
numberOfResults = itemGroups
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
.filter(item => {
|
|
50
54
|
return item.value?.toLowerCase().includes(searchValue)
|
|
51
55
|
|| item.subText?.toLowerCase().includes(searchValue)
|
|
52
|
-
|| item.name
|
|
56
|
+
|| item.name?.toLowerCase().includes(searchValue)
|
|
53
57
|
}).length
|
|
54
58
|
}
|
|
55
59
|
|
|
@@ -118,7 +122,7 @@
|
|
|
118
122
|
data-hidden={(
|
|
119
123
|
!item.value?.toLowerCase().includes(searchValue)
|
|
120
124
|
&& !item.subText?.toLowerCase().includes(searchValue)
|
|
121
|
-
&& !item.name
|
|
125
|
+
&& !item.name?.toLowerCase().includes(searchValue)
|
|
122
126
|
) ? true : null}
|
|
123
127
|
onclick={item.disabled ? null : select}
|
|
124
128
|
onkeyup={item.disabled ? null : selectByKey}
|
package/components/List/List.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import type { ListEventType,
|
|
2
|
+
import type { ListEventType, ListProps } from './list'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
import Input from '../Input/Input.tsx'
|
|
@@ -10,6 +10,10 @@ import searchIcon from '../../icons/search.svg?raw'
|
|
|
10
10
|
|
|
11
11
|
import styles from './list.module.scss'
|
|
12
12
|
|
|
13
|
+
export type Props = ListProps & {
|
|
14
|
+
onSelect?: (event: ListEventType) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
const List = ({
|
|
14
18
|
showSearchBar,
|
|
15
19
|
showSearchBarIcon,
|
|
@@ -22,7 +26,7 @@ const List = ({
|
|
|
22
26
|
secondary,
|
|
23
27
|
itemGroups,
|
|
24
28
|
onSelect
|
|
25
|
-
}:
|
|
29
|
+
}: Props) => {
|
|
26
30
|
const [searchValue, setSearchValue] = useState('')
|
|
27
31
|
const [numberOfResults, setNumberOfResults] = useState(1)
|
|
28
32
|
const [itemGroupsWithActive, setItemGroups] = useState(itemGroups)
|
|
@@ -44,7 +48,7 @@ const List = ({
|
|
|
44
48
|
? { maxHeight } as React.CSSProperties
|
|
45
49
|
: undefined
|
|
46
50
|
|
|
47
|
-
const search = (event: React.
|
|
51
|
+
const search = (event: React.InputEvent<HTMLInputElement>) => {
|
|
48
52
|
const value = (event.target as HTMLInputElement).value.toLowerCase()
|
|
49
53
|
|
|
50
54
|
setSearchValue(value)
|
|
@@ -55,7 +59,7 @@ const List = ({
|
|
|
55
59
|
.filter(item => {
|
|
56
60
|
return item.value?.toLowerCase().includes(value)
|
|
57
61
|
|| item.subText?.toLowerCase().includes(value)
|
|
58
|
-
|| item.name
|
|
62
|
+
|| item.name?.toLowerCase().includes(value)
|
|
59
63
|
}).length
|
|
60
64
|
)
|
|
61
65
|
}
|
|
@@ -107,7 +111,7 @@ const List = ({
|
|
|
107
111
|
</div>
|
|
108
112
|
)}>
|
|
109
113
|
<ul className={classes} id={id} style={style}>
|
|
110
|
-
{itemGroupsWithActive.map((group:
|
|
114
|
+
{itemGroupsWithActive.map((group: Props['itemGroups'][0], index) => (
|
|
111
115
|
<React.Fragment key={index}>
|
|
112
116
|
{group.title && (
|
|
113
117
|
<li className={styles.title}
|
|
@@ -127,7 +131,7 @@ const List = ({
|
|
|
127
131
|
data-hidden={(
|
|
128
132
|
!item.value?.toLowerCase().includes(searchValue)
|
|
129
133
|
&& !item.subText?.toLowerCase().includes(searchValue)
|
|
130
|
-
&& !item.name
|
|
134
|
+
&& !item.name?.toLowerCase().includes(searchValue)
|
|
131
135
|
) ? true : null}
|
|
132
136
|
onClick={item.disabled ? undefined : select}
|
|
133
137
|
onKeyUp={item.disabled ? undefined : selectByKey}
|
package/components/List/list.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SvelteComponent } from 'svelte'
|
|
3
|
+
import type { Items, MasonryProps } from './masonry'
|
|
3
4
|
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
import styles from './masonry.module.scss'
|
|
7
8
|
|
|
9
|
+
export type Props = Omit<MasonryProps, 'items'> & {
|
|
10
|
+
items: Items<typeof SvelteComponent<any>>[]
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
items,
|
|
10
15
|
element = 'section',
|
|
@@ -12,24 +17,24 @@
|
|
|
12
17
|
columns = 3,
|
|
13
18
|
sequential,
|
|
14
19
|
className
|
|
15
|
-
}:
|
|
20
|
+
}: Props = $props()
|
|
16
21
|
|
|
17
|
-
const classes = classNames([
|
|
22
|
+
const classes = $derived(classNames([
|
|
18
23
|
styles.masonry,
|
|
19
24
|
className
|
|
20
|
-
])
|
|
25
|
+
]))
|
|
21
26
|
|
|
22
|
-
const componentProps = {
|
|
27
|
+
const componentProps = $derived({
|
|
23
28
|
class: classes,
|
|
24
29
|
style: gap ? `--w-masonry-gap: ${gap};` : null
|
|
25
|
-
}
|
|
30
|
+
})
|
|
26
31
|
|
|
27
|
-
const chunkSize = Math.ceil(items.length / columns!)
|
|
28
|
-
const columnGroups = Array.from({ length: columns! }, (_, i) => {
|
|
32
|
+
const chunkSize = $derived(Math.ceil(items.length / columns!))
|
|
33
|
+
const columnGroups = $derived(Array.from({ length: columns! }, (_, i) => {
|
|
29
34
|
return sequential
|
|
30
35
|
? items.slice(i * chunkSize, (i + 1) * chunkSize)
|
|
31
36
|
: items.filter((_, index) => index % columns! === i)
|
|
32
|
-
})
|
|
37
|
+
}))
|
|
33
38
|
</script>
|
|
34
39
|
|
|
35
40
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import React, { type JSX } from 'react'
|
|
2
|
-
import type {
|
|
1
|
+
import React, { type FC, type JSX } from 'react'
|
|
2
|
+
import type { Items,MasonryProps } from './masonry'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './masonry.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = Omit<MasonryProps, 'items'> & {
|
|
9
|
+
items: Items<FC<any>>[]
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
const Masonry = ({
|
|
9
13
|
items,
|
|
10
14
|
element = 'section',
|
|
@@ -12,7 +16,7 @@ const Masonry = ({
|
|
|
12
16
|
columns = 3,
|
|
13
17
|
sequential,
|
|
14
18
|
className
|
|
15
|
-
}:
|
|
19
|
+
}: Props) => {
|
|
16
20
|
const classes = classNames([
|
|
17
21
|
styles.masonry,
|
|
18
22
|
className
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-masonry-gap: 5px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.masonry {
|
|
4
|
+
--gap: var(--w-masonry-gap, 5px);
|
|
5
|
+
|
|
8
6
|
@include layout(flex);
|
|
9
7
|
|
|
10
|
-
gap: var(--
|
|
8
|
+
gap: var(--gap);
|
|
11
9
|
overflow-x: auto;
|
|
12
10
|
|
|
13
11
|
.column {
|
|
14
12
|
@include layout(flex, column);
|
|
15
13
|
|
|
16
|
-
gap: var(--
|
|
14
|
+
gap: var(--gap);
|
|
17
15
|
}
|
|
18
16
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SvelteComponent } from 'svelte'
|
|
3
|
-
|
|
4
|
-
type ChildrenProps<ComponentType> = {
|
|
1
|
+
export type ChildrenProps<ComponentType> = {
|
|
5
2
|
component: ComponentType
|
|
6
3
|
children?: string | number
|
|
7
4
|
props?: {
|
|
@@ -9,7 +6,7 @@ type ChildrenProps<ComponentType> = {
|
|
|
9
6
|
}
|
|
10
7
|
} | string | number
|
|
11
8
|
|
|
12
|
-
type Items<ComponentType> = {
|
|
9
|
+
export type Items<ComponentType> = {
|
|
13
10
|
component?: ComponentType;
|
|
14
11
|
children?: ChildrenProps<ComponentType>
|
|
15
12
|
html?: string
|
|
@@ -26,11 +23,3 @@ export type MasonryProps = {
|
|
|
26
23
|
sequential?: boolean
|
|
27
24
|
className?: string
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
export type SvelteMasonryProps = {
|
|
31
|
-
items: Items<typeof SvelteComponent<any>>[]
|
|
32
|
-
} & Omit<MasonryProps, 'items'>
|
|
33
|
-
|
|
34
|
-
export type ReactMasonryProps = {
|
|
35
|
-
items: Items<FC<any>>[]
|
|
36
|
-
} & Omit<MasonryProps, 'items'>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { MenuProps } from './menu'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
6
|
|
|
@@ -7,6 +8,10 @@
|
|
|
7
8
|
|
|
8
9
|
import styles from './menu.module.scss'
|
|
9
10
|
|
|
11
|
+
export type Props = MenuProps & {
|
|
12
|
+
children?: Snippet
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
const {
|
|
11
16
|
items,
|
|
12
17
|
logo,
|
|
@@ -14,21 +19,22 @@
|
|
|
14
19
|
className,
|
|
15
20
|
wrapperClassName,
|
|
16
21
|
children
|
|
17
|
-
}:
|
|
22
|
+
}: Props = $props()
|
|
18
23
|
|
|
19
|
-
const classes = classNames([
|
|
24
|
+
const classes = $derived(classNames([
|
|
20
25
|
styles.menu,
|
|
21
26
|
className
|
|
22
|
-
])
|
|
27
|
+
]))
|
|
23
28
|
|
|
24
|
-
const containerClasses = classNames([
|
|
29
|
+
const containerClasses = $derived(classNames([
|
|
25
30
|
styles.container,
|
|
26
31
|
wrapperClassName
|
|
27
|
-
])
|
|
32
|
+
]))
|
|
28
33
|
|
|
29
|
-
const wrapMenu = (logo?.url || logo?.html)
|
|
34
|
+
const wrapMenu = $derived((logo?.url || logo?.html)
|
|
30
35
|
&& items?.length
|
|
31
36
|
&& children
|
|
37
|
+
)
|
|
32
38
|
|
|
33
39
|
let active = $state(false)
|
|
34
40
|
|
package/components/Menu/Menu.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { MenuProps } from './menu'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
|
|
@@ -7,6 +7,10 @@ import { classNames } from '../../utils/classNames'
|
|
|
7
7
|
|
|
8
8
|
import styles from './menu.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = MenuProps & {
|
|
11
|
+
children?: React.ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
const Menu = ({
|
|
11
15
|
items,
|
|
12
16
|
logo,
|
|
@@ -15,7 +19,7 @@ const Menu = ({
|
|
|
15
19
|
wrapperClassName,
|
|
16
20
|
children
|
|
17
21
|
// eslint-disable-next-line complexity
|
|
18
|
-
}:
|
|
22
|
+
}: Props) => {
|
|
19
23
|
const [active, setActive] = useState(false)
|
|
20
24
|
|
|
21
25
|
const classes = classNames([
|
package/components/Menu/menu.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
import type { ButtonProps } from '../Button/button'
|
|
4
2
|
|
|
5
3
|
export type MenuProps = {
|
|
@@ -20,11 +18,3 @@ export type MenuProps = {
|
|
|
20
18
|
className?: string
|
|
21
19
|
wrapperClassName?: string
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
export type SvelteMenuProps = {
|
|
25
|
-
children?: Snippet
|
|
26
|
-
} & MenuProps
|
|
27
|
-
|
|
28
|
-
export type ReactMenuProps = {
|
|
29
|
-
children?: React.ReactNode
|
|
30
|
-
} & MenuProps
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { ModalProps } from './modal'
|
|
3
4
|
|
|
4
5
|
import Button from '../Button/Button.astro'
|
|
@@ -11,7 +12,7 @@ import warning from '../../icons/warning.svg?raw'
|
|
|
11
12
|
|
|
12
13
|
import styles from './modal.module.scss'
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
export type Props = ModalProps<HTMLAttributes<'dialog'>>
|
|
15
16
|
|
|
16
17
|
const iconMap = {
|
|
17
18
|
info,
|
|
@@ -28,7 +29,6 @@ const {
|
|
|
28
29
|
closeOnOverlay = true,
|
|
29
30
|
transparent,
|
|
30
31
|
theme,
|
|
31
|
-
id,
|
|
32
32
|
className,
|
|
33
33
|
...rest
|
|
34
34
|
} = Astro.props
|
|
@@ -49,7 +49,6 @@ const classes = [
|
|
|
49
49
|
|
|
50
50
|
<dialog
|
|
51
51
|
class:list={classes}
|
|
52
|
-
id={id}
|
|
53
52
|
data-close={close.length ? close : undefined}
|
|
54
53
|
{...rest}
|
|
55
54
|
>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { HTMLDialogAttributes } from 'svelte/elements'
|
|
4
|
+
import type { ModalProps } from './modal'
|
|
3
5
|
|
|
4
6
|
import Button from '../Button/Button.svelte'
|
|
5
7
|
|
|
@@ -13,6 +15,10 @@
|
|
|
13
15
|
|
|
14
16
|
import styles from './modal.module.scss'
|
|
15
17
|
|
|
18
|
+
export type Props = ModalProps<HTMLDialogAttributes> & {
|
|
19
|
+
children?: Snippet
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
const {
|
|
17
23
|
title,
|
|
18
24
|
subTitle,
|
|
@@ -21,11 +27,10 @@
|
|
|
21
27
|
closeOnOverlay = true,
|
|
22
28
|
transparent,
|
|
23
29
|
theme,
|
|
24
|
-
id,
|
|
25
30
|
className,
|
|
26
31
|
children,
|
|
27
32
|
...rest
|
|
28
|
-
}:
|
|
33
|
+
}: Props = $props()
|
|
29
34
|
|
|
30
35
|
const iconMap = {
|
|
31
36
|
info,
|
|
@@ -34,23 +39,22 @@
|
|
|
34
39
|
alert
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
const classes = classNames([
|
|
42
|
+
const classes = $derived(classNames([
|
|
38
43
|
styles.modal,
|
|
39
44
|
transparent && styles.transparent,
|
|
40
45
|
theme && styles[theme],
|
|
41
46
|
className
|
|
42
|
-
])
|
|
47
|
+
]))
|
|
43
48
|
|
|
44
|
-
const close = [
|
|
49
|
+
const close = $derived([
|
|
45
50
|
showCloseIcon && 'icon',
|
|
46
51
|
closeOnEsc && 'esc',
|
|
47
52
|
closeOnOverlay && 'overlay'
|
|
48
|
-
].filter(Boolean).join(',')
|
|
53
|
+
].filter(Boolean).join(','))
|
|
49
54
|
</script>
|
|
50
55
|
|
|
51
56
|
<dialog
|
|
52
57
|
class={classes}
|
|
53
|
-
id={id}
|
|
54
58
|
data-close={close.length ? close : undefined}
|
|
55
59
|
{...rest}
|
|
56
60
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModalProps } from './modal'
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.tsx'
|
|
5
5
|
|
|
@@ -13,6 +13,10 @@ import warning from '../../icons/warning.svg?raw'
|
|
|
13
13
|
|
|
14
14
|
import styles from './modal.module.scss'
|
|
15
15
|
|
|
16
|
+
export type Props = ModalProps<React.DialogHTMLAttributes<HTMLDialogElement>> & {
|
|
17
|
+
children?: React.ReactNode
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
const iconMap = {
|
|
17
21
|
info,
|
|
18
22
|
success,
|
|
@@ -28,11 +32,10 @@ const Modal = ({
|
|
|
28
32
|
closeOnOverlay = true,
|
|
29
33
|
transparent,
|
|
30
34
|
theme,
|
|
31
|
-
id,
|
|
32
35
|
className,
|
|
33
36
|
children,
|
|
34
37
|
...rest
|
|
35
|
-
}:
|
|
38
|
+
}: Props) => {
|
|
36
39
|
const classes = classNames([
|
|
37
40
|
styles.modal,
|
|
38
41
|
theme && styles[theme],
|
|
@@ -50,7 +53,6 @@ const Modal = ({
|
|
|
50
53
|
<React.Fragment>
|
|
51
54
|
<dialog
|
|
52
55
|
className={classes}
|
|
53
|
-
id={id}
|
|
54
56
|
data-close={close.length ? close : undefined}
|
|
55
57
|
{...rest}
|
|
56
58
|
>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
&.info {
|
|
39
|
-
@include border(info);
|
|
39
|
+
@include border(3px, top, info-accent);
|
|
40
40
|
|
|
41
41
|
.title {
|
|
42
42
|
@include typography(info);
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
&.success {
|
|
47
|
-
@include border(success);
|
|
47
|
+
@include border(3px, top, success-accent);
|
|
48
48
|
|
|
49
49
|
.title {
|
|
50
50
|
@include typography(success);
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&.warning {
|
|
55
|
-
@include border(warning);
|
|
55
|
+
@include border(3px, top, warning-accent);
|
|
56
56
|
|
|
57
57
|
.title {
|
|
58
58
|
@include typography(warning);
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&.alert {
|
|
63
|
-
@include border(alert);
|
|
63
|
+
@include border(3px, top, alert-accent);
|
|
64
64
|
|
|
65
65
|
.title {
|
|
66
66
|
@include typography(alert);
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
.subTitle {
|
|
90
|
-
@include typography(primary-20);
|
|
90
|
+
@include typography(primary-20, hmd);
|
|
91
91
|
@include spacing(mb-xs);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type ModalProps = {
|
|
1
|
+
export type ModalProps<T extends object = object> = {
|
|
4
2
|
title?: string
|
|
5
3
|
subTitle?: string
|
|
6
4
|
showCloseIcon?: boolean
|
|
7
5
|
closeOnEsc?: boolean
|
|
8
6
|
closeOnOverlay?: boolean
|
|
9
7
|
transparent?: boolean
|
|
10
|
-
id?: string
|
|
11
8
|
className?: string
|
|
12
9
|
theme?: 'info'
|
|
13
10
|
| 'success'
|
|
14
11
|
| 'warning'
|
|
15
12
|
| 'alert'
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type SvelteModalProps = {
|
|
20
|
-
children: Snippet
|
|
21
|
-
} & ModalProps
|
|
22
|
-
|
|
23
|
-
export type ReactModalProps = {
|
|
24
|
-
children?: React.ReactNode
|
|
25
|
-
} & ModalProps
|
|
13
|
+
} & T
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { OTPInputProps } from './otpinput'
|
|
3
3
|
|
|
4
|
-
import Input from '../Input/Input.astro'
|
|
4
|
+
import Input, { type Props as InputProps } from '../Input/Input.astro'
|
|
5
5
|
|
|
6
6
|
import styles from './otpinput.module.scss'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export type Props = OTPInputProps<InputProps>
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
11
|
name = 'otp',
|
|
12
|
-
disabled,
|
|
13
12
|
length = 6,
|
|
14
13
|
groupLength = 0,
|
|
15
14
|
separator = '•',
|
|
@@ -47,17 +46,16 @@ const inputs = Array.from({ length }, (_, i) => i + 1)
|
|
|
47
46
|
<div class={styles.separator}>{input}</div>
|
|
48
47
|
) : (
|
|
49
48
|
<Input
|
|
49
|
+
{...rest}
|
|
50
50
|
id={`${name}-${index}`}
|
|
51
51
|
class={styles.input}
|
|
52
52
|
type="text"
|
|
53
53
|
maxlength="1"
|
|
54
|
-
disabled={disabled}
|
|
55
54
|
inputmode="numeric"
|
|
56
55
|
autocomplete="one-time-code"
|
|
57
56
|
data-id="w-input-otp"
|
|
58
57
|
data-index={input}
|
|
59
58
|
aria-label={`OTP digit ${input + 1}`}
|
|
60
|
-
{...rest}
|
|
61
59
|
/>
|
|
62
60
|
)
|
|
63
61
|
)}
|