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
package/components/Tabs/Tabs.tsx
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import React, { useRef,useState } from 'react'
|
|
2
|
-
import type {
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import type { TabsProps } from './tabs'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './tabs.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = TabsProps & {
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
const Tabs = ({
|
|
9
13
|
items,
|
|
10
14
|
theme,
|
|
@@ -12,9 +16,12 @@ const Tabs = ({
|
|
|
12
16
|
even,
|
|
13
17
|
className,
|
|
14
18
|
children
|
|
15
|
-
}:
|
|
19
|
+
}: Props) => {
|
|
16
20
|
const tabContainer = useRef<HTMLDivElement>(null)
|
|
21
|
+
const usedInAstro = useRef(false)
|
|
22
|
+
|
|
17
23
|
const [active, setActive] = useState('')
|
|
24
|
+
const hasActive = items.some(item => item.active)
|
|
18
25
|
|
|
19
26
|
const classes = classNames([
|
|
20
27
|
styles.tabs,
|
|
@@ -24,21 +31,25 @@ const Tabs = ({
|
|
|
24
31
|
className
|
|
25
32
|
])
|
|
26
33
|
|
|
27
|
-
const setTab = (tab: string) => {
|
|
28
|
-
const
|
|
34
|
+
const setTab = (tab: string, index: number) => {
|
|
35
|
+
const contentChildren = usedInAstro.current
|
|
36
|
+
? Array.from(tabContainer.current!.children[0].children) as HTMLElement[]
|
|
37
|
+
: Array.from(tabContainer.current!.children) as HTMLElement[]
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
item.dataset.active = false
|
|
39
|
+
const hasExplicitTabs = contentChildren.some((el: HTMLElement) => el.dataset.tab)
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
contentChildren.forEach((item: HTMLElement, i: number) => {
|
|
42
|
+
if (hasExplicitTabs) {
|
|
43
|
+
item.dataset.active = item.dataset.tab === tab ? 'true' : 'false'
|
|
44
|
+
} else {
|
|
45
|
+
item.dataset.active = i === index ? 'true' : 'false'
|
|
35
46
|
}
|
|
36
47
|
})
|
|
37
48
|
|
|
38
49
|
setActive(tab)
|
|
39
50
|
}
|
|
40
51
|
|
|
41
|
-
const isActive = (item:
|
|
52
|
+
const isActive = (item: Props['items'][0]) => {
|
|
42
53
|
if (!active) {
|
|
43
54
|
return item.active ? 'true' : undefined
|
|
44
55
|
}
|
|
@@ -46,6 +57,26 @@ const Tabs = ({
|
|
|
46
57
|
return active === item.value ? 'true' : undefined
|
|
47
58
|
}
|
|
48
59
|
|
|
60
|
+
if (!hasActive) {
|
|
61
|
+
items[0].active = true
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
usedInAstro.current = tabContainer.current?.children[0]?.nodeName === 'ASTRO-SLOT'
|
|
66
|
+
|
|
67
|
+
const contentChildren = usedInAstro.current
|
|
68
|
+
? Array.from(tabContainer.current!.children[0].children) as HTMLElement[]
|
|
69
|
+
: Array.from(tabContainer.current!.children) as HTMLElement[]
|
|
70
|
+
|
|
71
|
+
if (!contentChildren.some(element => element.dataset.active === 'true')) {
|
|
72
|
+
const index = items.findIndex(item => item.active)
|
|
73
|
+
|
|
74
|
+
if (contentChildren[index]) {
|
|
75
|
+
contentChildren[index].dataset.active = 'true'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, [])
|
|
79
|
+
|
|
49
80
|
return (
|
|
50
81
|
<section className={classes}>
|
|
51
82
|
<div className={styles.wrapper}>
|
|
@@ -55,7 +86,7 @@ const Tabs = ({
|
|
|
55
86
|
key={index}
|
|
56
87
|
disabled={item.disabled}
|
|
57
88
|
dangerouslySetInnerHTML={{ __html: item.label }}
|
|
58
|
-
onClick={() => setTab(item.value)}
|
|
89
|
+
onClick={() => setTab(item.value, index)}
|
|
59
90
|
data-active={isActive(item)}
|
|
60
91
|
/>
|
|
61
92
|
))}
|
|
@@ -110,13 +110,14 @@
|
|
|
110
110
|
|
|
111
111
|
.content {
|
|
112
112
|
@include spacing(mt-default);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
[data-tab] {
|
|
116
|
-
@include visibility(none);
|
|
117
113
|
|
|
118
|
-
&
|
|
119
|
-
|
|
114
|
+
& > *:not(astro-slot),
|
|
115
|
+
& > astro-slot > * {
|
|
116
|
+
@include visibility(none);
|
|
117
|
+
|
|
118
|
+
&[data-active="true"] {
|
|
119
|
+
@include visibility(block);
|
|
120
|
+
}
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
}
|
package/components/Tabs/tabs.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type TabsProps = {
|
|
4
2
|
items: {
|
|
5
3
|
label: string
|
|
@@ -12,11 +10,3 @@ export type TabsProps = {
|
|
|
12
10
|
even?: boolean
|
|
13
11
|
className?: string
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
export type SvelteTabsProps = {
|
|
17
|
-
children: Snippet
|
|
18
|
-
} & TabsProps
|
|
19
|
-
|
|
20
|
-
export type ReactTabsProps = {
|
|
21
|
-
children: React.ReactNode
|
|
22
|
-
} & TabsProps
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
2
3
|
import type { TextareaProps } from './textarea'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
5
6
|
|
|
6
7
|
import styles from './textarea.module.scss'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
export type Props = TextareaProps<HTMLAttributes<'textarea'>>
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
12
|
label,
|
|
12
|
-
placeholder,
|
|
13
13
|
subText,
|
|
14
14
|
value = '',
|
|
15
|
-
disabled,
|
|
16
15
|
className,
|
|
17
16
|
...rest
|
|
18
17
|
} = Astro.props
|
|
@@ -39,9 +38,7 @@ const useLabel = !!(label || subText)
|
|
|
39
38
|
</label>
|
|
40
39
|
|
|
41
40
|
<textarea
|
|
42
|
-
placeholder={placeholder}
|
|
43
|
-
disabled={disabled}
|
|
44
|
-
class:list={classes}
|
|
45
41
|
{...rest}
|
|
42
|
+
class:list={classes}
|
|
46
43
|
>{value}</textarea>
|
|
47
44
|
</ConditionalWrapper>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements'
|
|
3
|
+
import type { TextareaProps, TextareaTarget } from './textarea'
|
|
3
4
|
|
|
4
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
6
|
|
|
@@ -7,25 +8,29 @@
|
|
|
7
8
|
|
|
8
9
|
import styles from './textarea.module.scss'
|
|
9
10
|
|
|
11
|
+
export type Props = TextareaProps<HTMLTextareaAttributes> & {
|
|
12
|
+
onInput?: (event: Event & TextareaTarget) => void
|
|
13
|
+
onChange?: (event: Event & TextareaTarget) => void
|
|
14
|
+
onKeyUp?: (event: KeyboardEvent & TextareaTarget) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
const {
|
|
11
18
|
label,
|
|
12
|
-
placeholder,
|
|
13
19
|
subText,
|
|
14
20
|
value = '',
|
|
15
|
-
disabled,
|
|
16
21
|
className,
|
|
17
22
|
onChange,
|
|
18
23
|
onKeyUp,
|
|
19
24
|
onInput,
|
|
20
25
|
...rest
|
|
21
|
-
}:
|
|
26
|
+
}: Props = $props()
|
|
22
27
|
|
|
23
|
-
const classes = classNames([
|
|
28
|
+
const classes = $derived(classNames([
|
|
24
29
|
styles.textarea,
|
|
25
30
|
className
|
|
26
|
-
])
|
|
31
|
+
]))
|
|
27
32
|
|
|
28
|
-
const useLabel = !!(label || subText)
|
|
33
|
+
const useLabel = $derived(!!(label || subText))
|
|
29
34
|
</script>
|
|
30
35
|
|
|
31
36
|
<ConditionalWrapper
|
|
@@ -37,13 +42,11 @@
|
|
|
37
42
|
<div class={styles.label}>{label}</div>
|
|
38
43
|
{/if}
|
|
39
44
|
<textarea
|
|
40
|
-
|
|
41
|
-
disabled={disabled}
|
|
45
|
+
{...rest}
|
|
42
46
|
class={classes}
|
|
43
47
|
oninput={onInput}
|
|
44
48
|
onchange={onChange}
|
|
45
49
|
onkeyup={onKeyUp}
|
|
46
|
-
{...rest}
|
|
47
50
|
>{value}</textarea>
|
|
48
51
|
{#if subText}
|
|
49
52
|
<div class={styles.subtext}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextareaProps } from './textarea'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
5
|
|
|
@@ -7,15 +7,19 @@ import { classNames } from '../../utils/classNames'
|
|
|
7
7
|
|
|
8
8
|
import styles from './textarea.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = TextareaProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>> & {
|
|
11
|
+
onInput?: (event: React.InputEvent<HTMLTextAreaElement>) => void
|
|
12
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void
|
|
13
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
const Textarea = ({
|
|
11
17
|
label,
|
|
12
|
-
placeholder,
|
|
13
18
|
subText,
|
|
14
19
|
value = '',
|
|
15
|
-
disabled,
|
|
16
20
|
className,
|
|
17
21
|
...rest
|
|
18
|
-
}:
|
|
22
|
+
}: Props) => {
|
|
19
23
|
const classes = classNames([
|
|
20
24
|
styles.textarea,
|
|
21
25
|
className
|
|
@@ -39,11 +43,9 @@ const Textarea = ({
|
|
|
39
43
|
</label>
|
|
40
44
|
)}>
|
|
41
45
|
<textarea
|
|
42
|
-
|
|
43
|
-
disabled={disabled}
|
|
46
|
+
{...rest}
|
|
44
47
|
className={classes}
|
|
45
48
|
defaultValue={value}
|
|
46
|
-
{...rest}
|
|
47
49
|
/>
|
|
48
50
|
</ConditionalWrapper>
|
|
49
51
|
)
|
|
@@ -2,24 +2,9 @@ export type TextareaTarget = {
|
|
|
2
2
|
currentTarget: HTMLTextAreaElement
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
export type TextareaProps = {
|
|
5
|
+
export type TextareaProps<T extends object = object> = {
|
|
6
6
|
label?: string
|
|
7
|
-
placeholder?: string
|
|
8
7
|
subText?: string
|
|
9
8
|
value?: string
|
|
10
|
-
disabled?: boolean
|
|
11
9
|
className?: string
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type SvelteTextareaProps = {
|
|
16
|
-
onInput?: (event: Event & TextareaTarget) => void
|
|
17
|
-
onChange?: (event: Event & TextareaTarget) => void
|
|
18
|
-
onKeyUp?: (event: KeyboardEvent & TextareaTarget) => void
|
|
19
|
-
} & TextareaProps
|
|
20
|
-
|
|
21
|
-
export type ReactTextareaProps = {
|
|
22
|
-
onInput?: (event: React.InputEvent<HTMLTextAreaElement>) => void
|
|
23
|
-
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void
|
|
24
|
-
onKeyUp?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void
|
|
25
|
-
} & TextareaProps
|
|
10
|
+
} & T
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount } from 'svelte'
|
|
3
|
-
import type {
|
|
2
|
+
import { onMount, type Snippet } from 'svelte'
|
|
3
|
+
import type { ThemeSwitcherProps } from './themeswitcher'
|
|
4
4
|
|
|
5
5
|
import { classNames } from '../../utils/classNames'
|
|
6
6
|
import { getCookie, setCookie } from '../../utils/cookies'
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
import styles from './themeswitcher.module.scss'
|
|
10
10
|
|
|
11
|
+
export type Props = ThemeSwitcherProps & {
|
|
12
|
+
primaryIcon?: Snippet
|
|
13
|
+
secondaryIcon?: Snippet
|
|
14
|
+
children?: Snippet
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
const {
|
|
12
18
|
themes,
|
|
13
19
|
toggle,
|
|
@@ -15,20 +21,20 @@
|
|
|
15
21
|
primaryIcon,
|
|
16
22
|
secondaryIcon,
|
|
17
23
|
className
|
|
18
|
-
}:
|
|
24
|
+
}: Props = $props()
|
|
19
25
|
|
|
20
26
|
let currentTheme = $state('')
|
|
21
27
|
let toggled = false
|
|
22
28
|
|
|
23
|
-
const classes = classNames([
|
|
29
|
+
const classes = $derived(classNames([
|
|
24
30
|
styles.switcher,
|
|
25
31
|
toggle && styles.toggle,
|
|
26
32
|
className
|
|
27
|
-
])
|
|
33
|
+
]))
|
|
28
34
|
|
|
29
|
-
const primaryTheme = themes[Object.keys(themes)[0]]
|
|
30
|
-
const secondaryTheme = themes[Object.keys(themes)[1]]
|
|
31
|
-
const useIcons = primaryIcon && secondaryIcon
|
|
35
|
+
const primaryTheme = $derived(themes[Object.keys(themes)[0]])
|
|
36
|
+
const secondaryTheme = $derived(themes[Object.keys(themes)[1]])
|
|
37
|
+
const useIcons = $derived(primaryIcon && secondaryIcon)
|
|
32
38
|
|
|
33
39
|
const setTheme = (theme: string | number) => {
|
|
34
40
|
if (typeof theme === 'number') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeSwitcherProps } from './themeswitcher'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
import { getCookie, setCookie } from '../../utils/cookies'
|
|
@@ -7,6 +7,11 @@ import { dispatch, listen } from '../../utils/event'
|
|
|
7
7
|
|
|
8
8
|
import styles from './themeswitcher.module.scss'
|
|
9
9
|
|
|
10
|
+
export type Props = ThemeSwitcherProps & {
|
|
11
|
+
primaryIcon?: React.ReactNode
|
|
12
|
+
secondaryIcon?: React.ReactNode
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
const ThemeSwitcher = ({
|
|
11
16
|
themes,
|
|
12
17
|
toggle,
|
|
@@ -14,7 +19,7 @@ const ThemeSwitcher = ({
|
|
|
14
19
|
primaryIcon,
|
|
15
20
|
secondaryIcon,
|
|
16
21
|
className
|
|
17
|
-
}:
|
|
22
|
+
}: Props) => {
|
|
18
23
|
const [currentTheme, setCurrentTheme] = useState('')
|
|
19
24
|
const [toggled, setToggled] = useState(false)
|
|
20
25
|
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-theme-switcher-size: 20px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.switcher {
|
|
4
|
+
--size: var(--w-theme-switcher-size, 20px);
|
|
5
|
+
|
|
8
6
|
@include layout(flex, sm);
|
|
9
7
|
|
|
10
8
|
&.toggle {
|
|
11
9
|
@include position(relative);
|
|
12
|
-
width: var(--
|
|
13
|
-
height: var(--
|
|
10
|
+
width: var(--size);
|
|
11
|
+
height: var(--size);
|
|
14
12
|
|
|
15
13
|
.switch {
|
|
16
14
|
position: absolute;
|
|
@@ -35,8 +33,8 @@ body {
|
|
|
35
33
|
@include border-radius(max);
|
|
36
34
|
@include position(relative);
|
|
37
35
|
|
|
38
|
-
width: var(--
|
|
39
|
-
height: var(--
|
|
36
|
+
width: var(--size);
|
|
37
|
+
height: var(--size);
|
|
40
38
|
cursor: pointer;
|
|
41
39
|
user-select: none;
|
|
42
40
|
|
|
@@ -53,8 +51,8 @@ body {
|
|
|
53
51
|
|
|
54
52
|
svg, img {
|
|
55
53
|
pointer-events: none;
|
|
56
|
-
width: var(--
|
|
57
|
-
height: var(--
|
|
54
|
+
width: var(--size);
|
|
55
|
+
height: var(--size);
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -71,7 +69,7 @@ body {
|
|
|
71
69
|
|
|
72
70
|
&[data-active="true"]::after {
|
|
73
71
|
@include layer(default);
|
|
74
|
-
width: calc(var(--
|
|
75
|
-
height: calc(var(--
|
|
72
|
+
width: calc(var(--size) + 5px);
|
|
73
|
+
height: calc(var(--size) + 5px);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type ThemeSwitcherProps = {
|
|
4
2
|
themes: {
|
|
5
3
|
[key: string]: string
|
|
@@ -8,14 +6,3 @@ export type ThemeSwitcherProps = {
|
|
|
8
6
|
size?: number
|
|
9
7
|
className?: string
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
export type SvelteThemeSwitcherProps = {
|
|
13
|
-
primaryIcon?: Snippet
|
|
14
|
-
secondaryIcon?: Snippet
|
|
15
|
-
children?: Snippet
|
|
16
|
-
} & ThemeSwitcherProps
|
|
17
|
-
|
|
18
|
-
export type ReactThemeSwitcherProps = {
|
|
19
|
-
primaryIcon?: React.ReactNode
|
|
20
|
-
secondaryIcon?: React.ReactNode
|
|
21
|
-
} & ThemeSwitcherProps
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { TimelineProps } from './timeline'
|
|
3
4
|
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
import styles from './timeline.module.scss'
|
|
7
8
|
|
|
9
|
+
export type Props = TimelineProps & {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
theme,
|
|
10
15
|
counter,
|
|
@@ -14,21 +19,21 @@
|
|
|
14
19
|
textColor,
|
|
15
20
|
className,
|
|
16
21
|
children
|
|
17
|
-
}:
|
|
22
|
+
}: Props = $props()
|
|
18
23
|
|
|
19
|
-
const classes = classNames([
|
|
24
|
+
const classes = $derived(classNames([
|
|
20
25
|
styles.timeline,
|
|
21
26
|
theme && theme.split(' ').map(style => styles[style]),
|
|
22
27
|
alternate && styles.alternate,
|
|
23
28
|
centered && styles.centered,
|
|
24
29
|
className
|
|
25
|
-
])
|
|
30
|
+
]))
|
|
26
31
|
|
|
27
|
-
const styleVariables = classNames([
|
|
32
|
+
const styleVariables = $derived(classNames([
|
|
28
33
|
color && `--w-timeline-color: ${color};`,
|
|
29
34
|
textColor && `--w-timeline-text-color: ${textColor};`,
|
|
30
35
|
counter && `--w-timeline-counter: ${counter};`
|
|
31
|
-
])
|
|
36
|
+
]))
|
|
32
37
|
</script>
|
|
33
38
|
|
|
34
39
|
<ul class={classes} style={styleVariables || null}>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { TimelineProps } from './timeline'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './timeline.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = TimelineProps & {
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
const Timeline = ({
|
|
9
13
|
theme,
|
|
10
14
|
counter,
|
|
@@ -14,7 +18,7 @@ const Timeline = ({
|
|
|
14
18
|
textColor,
|
|
15
19
|
className,
|
|
16
20
|
children
|
|
17
|
-
}:
|
|
21
|
+
}: Props) => {
|
|
18
22
|
const classes = classNames([
|
|
19
23
|
styles.timeline,
|
|
20
24
|
theme && theme.split(' ').map(style => styles[style]),
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
$leftOffset: calc(((25px + 4px) / 2) - 1px);
|
|
5
5
|
$rightOffset: calc((((25px + 4px) / 2) - 1px) * -1);
|
|
6
6
|
|
|
7
|
-
body {
|
|
8
|
-
--w-timeline-color: var(--w-color-primary-50);
|
|
9
|
-
--w-timeline-text-color: var(--w-color-primary);
|
|
10
|
-
--w-timeline-counter: decimal;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
7
|
.timeline {
|
|
8
|
+
--color: var(--w-timeline-color, var(--w-color-primary-50));
|
|
9
|
+
--text-color: var(--w-timeline-text-color, var(--w-color-primary));
|
|
10
|
+
--counter: var(--w-timeline-counter, decimal);
|
|
11
|
+
|
|
14
12
|
@include layout(flex, default, column);
|
|
15
13
|
@include spacing(pl-3xl, m0);
|
|
16
14
|
@include position(relative);
|
|
@@ -22,7 +20,7 @@ body {
|
|
|
22
20
|
&::before {
|
|
23
21
|
@include position(absolute);
|
|
24
22
|
@include size(w2px, 'h100%');
|
|
25
|
-
@include background(var(--
|
|
23
|
+
@include background(var(--color));
|
|
26
24
|
|
|
27
25
|
content: '';
|
|
28
26
|
left: $leftOffset
|
|
@@ -34,7 +32,7 @@ body {
|
|
|
34
32
|
|
|
35
33
|
&.stroke > li::before {
|
|
36
34
|
@include background(primary-70);
|
|
37
|
-
border: 2px solid var(--
|
|
35
|
+
border: 2px solid var(--color);
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type TimelineProps = {
|
|
4
2
|
theme?: 'fill' | 'stroke' | 'stroke fill' | 'icons'
|
|
5
3
|
alternate?: boolean
|
|
@@ -56,11 +54,3 @@ export type TimelineProps = {
|
|
|
56
54
|
| 'upper-armenian'
|
|
57
55
|
| 'upper-roman'
|
|
58
56
|
}
|
|
59
|
-
|
|
60
|
-
export type SvelteTimelineProps = {
|
|
61
|
-
children: Snippet
|
|
62
|
-
} & TimelineProps
|
|
63
|
-
|
|
64
|
-
export type ReactTimelineProps = {
|
|
65
|
-
children: React.ReactNode
|
|
66
|
-
} & TimelineProps
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { TimelineItemProps } from './timelineitem'
|
|
3
4
|
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
import styles from './timelineitem.module.scss'
|
|
7
8
|
|
|
9
|
+
export type Props = TimelineItemProps & {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
title,
|
|
10
15
|
titleTag = 'span',
|
|
11
16
|
icon,
|
|
12
17
|
className,
|
|
13
18
|
children
|
|
14
|
-
}:
|
|
19
|
+
}: Props = $props()
|
|
15
20
|
|
|
16
|
-
const classes = classNames([
|
|
21
|
+
const classes = $derived(classNames([
|
|
17
22
|
styles.item,
|
|
18
23
|
icon && styles['with-icon'],
|
|
19
24
|
className
|
|
20
|
-
])
|
|
25
|
+
]))
|
|
21
26
|
</script>
|
|
22
27
|
|
|
23
28
|
<li class={classes}>
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type {
|
|
1
|
+
import React, { type JSX } from 'react'
|
|
2
|
+
import type { TimelineItemProps } from './timelineitem'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './timelineitem.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = Omit<TimelineItemProps, 'titleTag'> & {
|
|
9
|
+
TitleTag?: keyof JSX.IntrinsicElements
|
|
10
|
+
children: React.ReactNode
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const TimelineItem = ({
|
|
9
14
|
title,
|
|
10
15
|
TitleTag = 'span',
|
|
11
16
|
icon,
|
|
12
17
|
className,
|
|
13
18
|
children
|
|
14
|
-
}:
|
|
19
|
+
}: Props) => {
|
|
15
20
|
const classes = classNames([
|
|
16
21
|
styles.item,
|
|
17
22
|
icon && styles['with-icon'],
|