webcoreui 0.0.8 → 0.0.10
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 +26 -11
- package/astro.d.ts +31 -11
- package/astro.js +23 -1
- package/components/Alert/Alert.astro +3 -5
- package/components/Alert/Alert.svelte +3 -5
- package/components/Alert/Alert.tsx +3 -3
- package/components/Alert/alert.scss +1 -0
- package/components/Alert/alert.ts +6 -1
- package/components/Avatar/Avatar.astro +51 -0
- package/components/Avatar/Avatar.svelte +48 -0
- package/components/Avatar/Avatar.tsx +64 -0
- package/components/Avatar/avatar.scss +35 -0
- package/components/Avatar/avatar.ts +10 -0
- package/components/Badge/Badge.astro +4 -7
- package/components/Badge/Badge.svelte +2 -5
- package/components/Badge/Badge.tsx +3 -3
- package/components/Badge/badge.ts +4 -1
- package/components/Button/Button.astro +1 -4
- package/components/Button/Button.svelte +1 -4
- package/components/Button/Button.tsx +2 -2
- package/components/Button/button.scss +0 -1
- package/components/Button/button.ts +4 -0
- package/components/Card/Card.astro +2 -5
- package/components/Card/Card.svelte +1 -4
- package/components/Card/Card.tsx +2 -2
- package/components/Card/card.scss +1 -0
- package/components/Card/card.ts +7 -0
- package/components/Checkbox/Checkbox.astro +51 -0
- package/components/Checkbox/Checkbox.svelte +52 -0
- package/components/Checkbox/Checkbox.tsx +65 -0
- package/components/Checkbox/checkbox.scss +85 -0
- package/components/Checkbox/checkbox.ts +12 -0
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +2 -8
- package/components/ConditionalWrapper/conditionalwrapper.ts +5 -0
- package/components/Progress/Progress.astro +40 -0
- package/components/Progress/Progress.svelte +38 -0
- package/components/Progress/Progress.tsx +47 -0
- package/components/Progress/progress.scss +66 -0
- package/components/Progress/progress.ts +12 -0
- package/components/Radio/Radio.astro +57 -0
- package/components/Radio/Radio.svelte +56 -0
- package/components/Radio/Radio.tsx +68 -0
- package/components/Radio/radio.scss +92 -0
- package/components/Radio/radio.ts +17 -0
- package/components/Rating/Rating.astro +66 -0
- package/components/Rating/Rating.svelte +70 -0
- package/components/Rating/Rating.tsx +67 -0
- package/components/Rating/rating.scss +37 -0
- package/components/Rating/rating.ts +16 -0
- package/components/Spinner/Spinner.astro +42 -0
- package/components/Spinner/Spinner.svelte +38 -0
- package/components/Spinner/Spinner.tsx +44 -0
- package/components/Spinner/spinner.scss +41 -0
- package/components/Spinner/spinner.ts +7 -0
- package/components/Switch/Switch.astro +38 -0
- package/components/Switch/Switch.svelte +42 -0
- package/components/Switch/Switch.tsx +46 -0
- package/components/Switch/switch.scss +84 -0
- package/components/Switch/switch.ts +15 -0
- package/components/Tabs/Tabs.astro +76 -0
- package/components/Tabs/Tabs.svelte +54 -0
- package/components/Tabs/Tabs.tsx +69 -0
- package/components/Tabs/tabs.scss +134 -0
- package/components/Tabs/tabs.ts +16 -0
- package/components/Timeline/Timeline.astro +34 -0
- package/components/Timeline/Timeline.svelte +30 -0
- package/components/Timeline/Timeline.tsx +37 -0
- package/components/Timeline/timeline.scss +71 -0
- package/components/Timeline/timeline.ts +61 -0
- package/components/TimelineItem/TimelineItem.astro +26 -0
- package/components/TimelineItem/TimelineItem.svelte +22 -0
- package/components/TimelineItem/TimelineItem.tsx +32 -0
- package/components/TimelineItem/timelineitem.scss +31 -0
- package/components/TimelineItem/timelineitem.ts +5 -0
- package/components/Toast/Toast.astro +30 -0
- package/components/Toast/Toast.svelte +21 -0
- package/components/Toast/Toast.tsx +28 -0
- package/components/Toast/toast.scss +43 -0
- package/components/Toast/toast.ts +11 -0
- package/icons/check.svg +1 -2
- package/icons/circle-check.svg +4 -0
- package/index.js +1 -0
- package/package.json +5 -2
- package/react.d.ts +38 -17
- package/react.js +23 -1
- package/scss/global/tooltip.scss +133 -0
- package/scss/global/utility.scss +17 -0
- package/scss/global.scss +1 -0
- package/scss/resets.scss +4 -0
- package/scss/setup.scss +31 -1
- package/svelte.d.ts +31 -11
- package/svelte.js +23 -1
- package/utils/toast.ts +65 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactSwitchProps } from './switch'
|
|
3
|
+
import './switch.scss'
|
|
4
|
+
|
|
5
|
+
const Switch = ({
|
|
6
|
+
label,
|
|
7
|
+
toggled,
|
|
8
|
+
offColor,
|
|
9
|
+
onColor,
|
|
10
|
+
reverse,
|
|
11
|
+
small,
|
|
12
|
+
square,
|
|
13
|
+
disabled,
|
|
14
|
+
className,
|
|
15
|
+
onClick
|
|
16
|
+
}: ReactSwitchProps) => {
|
|
17
|
+
const classes = [
|
|
18
|
+
'w-switch',
|
|
19
|
+
reverse && 'reverse',
|
|
20
|
+
small && 'small',
|
|
21
|
+
square && 'square',
|
|
22
|
+
disabled && 'disabled',
|
|
23
|
+
className
|
|
24
|
+
].filter(Boolean).join(' ')
|
|
25
|
+
|
|
26
|
+
const styles = {
|
|
27
|
+
...(offColor && { '--w-switch-off-color': offColor }),
|
|
28
|
+
...(onColor && { '--w-switch-on-color': onColor })
|
|
29
|
+
} as React.CSSProperties
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<label className={classes} style={styles || null}>
|
|
33
|
+
<input
|
|
34
|
+
type="checkbox"
|
|
35
|
+
defaultChecked={toggled}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
onClick={onClick}
|
|
38
|
+
/>
|
|
39
|
+
<span className="toggle"></span>
|
|
40
|
+
{label && <span className="label">{label}</span>}
|
|
41
|
+
</label>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default Switch
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-switch {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 10px;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
|
|
9
|
+
&.reverse {
|
|
10
|
+
flex-direction: row-reverse;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&.disabled .toggle {
|
|
14
|
+
cursor: no-drop;
|
|
15
|
+
background: #333;
|
|
16
|
+
|
|
17
|
+
&::before {
|
|
18
|
+
background: #252525;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.small {
|
|
23
|
+
input:checked + span::before {
|
|
24
|
+
transform: translateX(20px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.toggle {
|
|
28
|
+
width: 40px;
|
|
29
|
+
height: 20px;
|
|
30
|
+
|
|
31
|
+
&::before {
|
|
32
|
+
height: 14px;
|
|
33
|
+
width: 14px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.label {
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.square .toggle {
|
|
43
|
+
border-radius: 5px;
|
|
44
|
+
|
|
45
|
+
&::before {
|
|
46
|
+
border-radius: 5px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
input {
|
|
51
|
+
display: none;
|
|
52
|
+
|
|
53
|
+
&:checked + span {
|
|
54
|
+
background-color: var(--w-switch-on-color);
|
|
55
|
+
|
|
56
|
+
&::before {
|
|
57
|
+
transform: translateX(30px);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.toggle {
|
|
63
|
+
@include Transition(background);
|
|
64
|
+
position: relative;
|
|
65
|
+
width: 60px;
|
|
66
|
+
height: 30px;
|
|
67
|
+
background: var(--w-switch-off-color);
|
|
68
|
+
border-radius: 30px;
|
|
69
|
+
|
|
70
|
+
&::before {
|
|
71
|
+
content: "";
|
|
72
|
+
position: absolute;
|
|
73
|
+
height: 24px;
|
|
74
|
+
width: 24px;
|
|
75
|
+
left: 3px;
|
|
76
|
+
bottom: 3px;
|
|
77
|
+
background: #000;
|
|
78
|
+
border-radius: 50%;
|
|
79
|
+
transition: 0.3s;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type SwitchProps = {
|
|
2
|
+
label?: string
|
|
3
|
+
toggled?: boolean
|
|
4
|
+
offColor?: string
|
|
5
|
+
onColor?: string
|
|
6
|
+
reverse?: boolean
|
|
7
|
+
small?: boolean
|
|
8
|
+
square?: boolean
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
className?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ReactSwitchProps = {
|
|
14
|
+
onClick?: (key: any) => any
|
|
15
|
+
} & SwitchProps
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { TabsProps } from './tabs'
|
|
3
|
+
import './tabs.scss'
|
|
4
|
+
|
|
5
|
+
interface Props extends TabsProps {}
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
items,
|
|
9
|
+
theme,
|
|
10
|
+
vertical,
|
|
11
|
+
even,
|
|
12
|
+
className
|
|
13
|
+
} = Astro.props
|
|
14
|
+
|
|
15
|
+
const classes = [
|
|
16
|
+
'w-tabs',
|
|
17
|
+
theme && theme,
|
|
18
|
+
vertical && 'vertical',
|
|
19
|
+
even && 'even',
|
|
20
|
+
className
|
|
21
|
+
]
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<section class:list={classes} data-id="w-tabs">
|
|
25
|
+
<div class="tabs-wrapper">
|
|
26
|
+
<div class="tabs">
|
|
27
|
+
{items.map(item => (
|
|
28
|
+
<button
|
|
29
|
+
data-value={item.value}
|
|
30
|
+
class:list={[item.active && 'active']}
|
|
31
|
+
disabled={item.disabled}
|
|
32
|
+
>
|
|
33
|
+
<Fragment set:html={item.label} />
|
|
34
|
+
</button>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="tab-content">
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
const tabs = document.querySelectorAll('[data-id="w-tabs"]')
|
|
45
|
+
|
|
46
|
+
Array.from(tabs).forEach(element => {
|
|
47
|
+
element.addEventListener('click', event => {
|
|
48
|
+
const target = event.target as HTMLDivElement
|
|
49
|
+
|
|
50
|
+
if (target.dataset.value) {
|
|
51
|
+
const tabContent = target.parentElement
|
|
52
|
+
?.parentElement
|
|
53
|
+
?.nextElementSibling as HTMLDivElement
|
|
54
|
+
|
|
55
|
+
Array.from(tabContent.children)
|
|
56
|
+
.forEach((element: any) => {
|
|
57
|
+
if (element.dataset.tab === target.dataset.value) {
|
|
58
|
+
element.dataset.active = true
|
|
59
|
+
} else {
|
|
60
|
+
element.dataset.active = false
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const tabs = target.parentElement?.querySelectorAll('button') as NodeListOf<HTMLButtonElement>
|
|
65
|
+
|
|
66
|
+
Array.from(tabs).forEach((tab: any) => {
|
|
67
|
+
tab.classList.remove('active')
|
|
68
|
+
|
|
69
|
+
if (tab.dataset.value === target.dataset.value) {
|
|
70
|
+
tab.classList.add('active')
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TabsProps } from './tabs'
|
|
3
|
+
import './tabs.scss'
|
|
4
|
+
|
|
5
|
+
export let items: TabsProps['items'] = []
|
|
6
|
+
export let theme: TabsProps['theme'] = null
|
|
7
|
+
export let vertical: TabsProps['vertical'] = false
|
|
8
|
+
export let even: TabsProps['even'] = false
|
|
9
|
+
export let className: TabsProps['className'] = ''
|
|
10
|
+
|
|
11
|
+
let active = ''
|
|
12
|
+
let tabContainer: HTMLDivElement
|
|
13
|
+
|
|
14
|
+
const classes = [
|
|
15
|
+
'w-tabs',
|
|
16
|
+
theme && theme,
|
|
17
|
+
vertical && 'vertical',
|
|
18
|
+
even && 'even',
|
|
19
|
+
className
|
|
20
|
+
].filter(Boolean).join(' ')
|
|
21
|
+
|
|
22
|
+
const setTab = (tab: string) => {
|
|
23
|
+
const tabs = tabContainer.querySelectorAll('[data-tab]')
|
|
24
|
+
|
|
25
|
+
active = tab
|
|
26
|
+
|
|
27
|
+
Array.from(tabs).forEach((item: any) => {
|
|
28
|
+
item.dataset.active = false
|
|
29
|
+
|
|
30
|
+
if (item.dataset.tab === active) {
|
|
31
|
+
item.dataset.active = true
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<section class={classes}>
|
|
38
|
+
<div class="tabs-wrapper">
|
|
39
|
+
<div class="tabs">
|
|
40
|
+
{#each items as item}
|
|
41
|
+
<button
|
|
42
|
+
class:active={active ? active === item.value : item.active}
|
|
43
|
+
disabled={item.disabled}
|
|
44
|
+
on:click={() => setTab(item.value)}
|
|
45
|
+
>
|
|
46
|
+
{@html item.label}
|
|
47
|
+
</button>
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="tab-content" bind:this={tabContainer}>
|
|
52
|
+
<slot />
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react'
|
|
2
|
+
import type { ReactTabsProps } from './tabs'
|
|
3
|
+
|
|
4
|
+
import './tabs.scss'
|
|
5
|
+
|
|
6
|
+
const Tabs = ({
|
|
7
|
+
items,
|
|
8
|
+
theme,
|
|
9
|
+
vertical,
|
|
10
|
+
even,
|
|
11
|
+
className,
|
|
12
|
+
children
|
|
13
|
+
}: ReactTabsProps) => {
|
|
14
|
+
const tabContainer = useRef<HTMLDivElement>(null)
|
|
15
|
+
const [active, setActive] = useState('')
|
|
16
|
+
|
|
17
|
+
const classes = [
|
|
18
|
+
'w-tabs',
|
|
19
|
+
theme && theme,
|
|
20
|
+
vertical && 'vertical',
|
|
21
|
+
even && 'even',
|
|
22
|
+
className
|
|
23
|
+
].filter(Boolean).join(' ')
|
|
24
|
+
|
|
25
|
+
const setTab = (tab: string) => {
|
|
26
|
+
const tabs = tabContainer.current!.querySelectorAll('[data-tab]')
|
|
27
|
+
|
|
28
|
+
Array.from(tabs).forEach((item: any) => {
|
|
29
|
+
item.dataset.active = false
|
|
30
|
+
|
|
31
|
+
if (item.dataset.tab === tab) {
|
|
32
|
+
item.dataset.active = true
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
setActive(tab)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const isActive = (item: ReactTabsProps['items'][0]) => {
|
|
40
|
+
if (!active) {
|
|
41
|
+
return item.active ? 'active' : undefined
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return active === item.value ? 'active' : undefined
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<section className={classes}>
|
|
49
|
+
<div className="tabs-wrapper">
|
|
50
|
+
<div className="tabs">
|
|
51
|
+
{items.map((item, index) => (
|
|
52
|
+
<button
|
|
53
|
+
key={index}
|
|
54
|
+
disabled={item.disabled}
|
|
55
|
+
dangerouslySetInnerHTML={{ __html: item.label }}
|
|
56
|
+
onClick={() => setTab(item.value)}
|
|
57
|
+
className={isActive(item)}
|
|
58
|
+
/>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div className="tab-content" ref={tabContainer}>
|
|
63
|
+
{children}
|
|
64
|
+
</div>
|
|
65
|
+
</section>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default Tabs
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-tabs {
|
|
4
|
+
|
|
5
|
+
&.boxed .tabs,
|
|
6
|
+
&.outline .tabs {
|
|
7
|
+
background: #252525;
|
|
8
|
+
border-radius: 5px;
|
|
9
|
+
padding: 5px;
|
|
10
|
+
width: fit-content;
|
|
11
|
+
|
|
12
|
+
button {
|
|
13
|
+
@include Transition();
|
|
14
|
+
border-radius: 5px;
|
|
15
|
+
padding: 10px;
|
|
16
|
+
|
|
17
|
+
&.active {
|
|
18
|
+
border: 0;
|
|
19
|
+
background: #000;
|
|
20
|
+
padding-bottom: 10px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.outline .tabs {
|
|
26
|
+
background: transparent;
|
|
27
|
+
border: 1px solid #252525;
|
|
28
|
+
|
|
29
|
+
button {
|
|
30
|
+
margin-bottom: 0;
|
|
31
|
+
|
|
32
|
+
&.active {
|
|
33
|
+
background: #252525;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.even .tabs button {
|
|
39
|
+
flex: 1;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.vertical {
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: 20px;
|
|
46
|
+
|
|
47
|
+
&.boxed .tabs button,
|
|
48
|
+
&.outline .tabs button {
|
|
49
|
+
border-bottom: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tabs {
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: 5px;
|
|
55
|
+
|
|
56
|
+
button {
|
|
57
|
+
padding: 10px;
|
|
58
|
+
border-bottom: 2px solid #252525;
|
|
59
|
+
|
|
60
|
+
&.active {
|
|
61
|
+
padding-bottom: 10px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.tab-content {
|
|
67
|
+
margin-top: 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.tabs-wrapper {
|
|
72
|
+
overflow: auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tabs {
|
|
76
|
+
border-bottom: 2px solid #252525;
|
|
77
|
+
display: flex;
|
|
78
|
+
gap: 10px;
|
|
79
|
+
|
|
80
|
+
button {
|
|
81
|
+
@include Transition(color);
|
|
82
|
+
background: transparent;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
color: #FFF;
|
|
85
|
+
border: 0;
|
|
86
|
+
font-size: 16px;
|
|
87
|
+
padding: 0;
|
|
88
|
+
margin-bottom: -2px;
|
|
89
|
+
padding: 15px 15px;
|
|
90
|
+
color: #BBB;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 10px;
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
|
|
96
|
+
svg {
|
|
97
|
+
pointer-events: none;
|
|
98
|
+
width: 20px;
|
|
99
|
+
height: 20px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&[disabled] {
|
|
103
|
+
color: #555;
|
|
104
|
+
cursor: no-drop;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.active {
|
|
108
|
+
color: #FFF;
|
|
109
|
+
border-bottom: 2px solid #FFF;
|
|
110
|
+
padding-bottom: 13px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.tab-content {
|
|
116
|
+
margin-top: 20px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[data-tab] {
|
|
120
|
+
display: none;
|
|
121
|
+
|
|
122
|
+
&[data-active="true"] {
|
|
123
|
+
display: block;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@include Media('xs') {
|
|
129
|
+
.w-tabs {
|
|
130
|
+
&.even .tabs {
|
|
131
|
+
width: auto;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TabsProps = {
|
|
2
|
+
items: {
|
|
3
|
+
label: string
|
|
4
|
+
value: string
|
|
5
|
+
active?: boolean
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
}[]
|
|
8
|
+
theme?: 'boxed' | 'outline' | null
|
|
9
|
+
vertical?: boolean
|
|
10
|
+
even?: boolean
|
|
11
|
+
className?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ReactTabsProps = {
|
|
15
|
+
children: React.ReactNode
|
|
16
|
+
} & TabsProps
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { TimelineProps } from './timeline'
|
|
3
|
+
import './timeline.scss'
|
|
4
|
+
|
|
5
|
+
interface Props extends TimelineProps {}
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
theme,
|
|
9
|
+
counter,
|
|
10
|
+
alternate,
|
|
11
|
+
centered,
|
|
12
|
+
color,
|
|
13
|
+
textColor,
|
|
14
|
+
className
|
|
15
|
+
} = Astro.props
|
|
16
|
+
|
|
17
|
+
const classes = [
|
|
18
|
+
'w-timeline',
|
|
19
|
+
theme,
|
|
20
|
+
alternate && 'alternate',
|
|
21
|
+
centered && 'centered',
|
|
22
|
+
className
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const styles = [
|
|
26
|
+
color && `--w-timeline-color: ${color};`,
|
|
27
|
+
textColor && `--w-timeline-text-color: ${textColor};`,
|
|
28
|
+
counter && `--w-timeline-counter: ${counter};`,
|
|
29
|
+
].join('')
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<ul class:list={classes} style={styles}>
|
|
33
|
+
<slot />
|
|
34
|
+
</ul>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TimelineProps } from './timeline'
|
|
3
|
+
import './timeline.scss'
|
|
4
|
+
|
|
5
|
+
export let theme: TimelineProps['theme'] = null
|
|
6
|
+
export let counter: TimelineProps['counter'] = null
|
|
7
|
+
export let alternate: TimelineProps['alternate'] = false
|
|
8
|
+
export let centered: TimelineProps['centered'] = false
|
|
9
|
+
export let color: TimelineProps['color'] = ''
|
|
10
|
+
export let textColor: TimelineProps['textColor'] = ''
|
|
11
|
+
export let className: TimelineProps['className'] = ''
|
|
12
|
+
|
|
13
|
+
const classes = [
|
|
14
|
+
'w-timeline',
|
|
15
|
+
theme,
|
|
16
|
+
alternate && 'alternate',
|
|
17
|
+
centered && 'centered',
|
|
18
|
+
className
|
|
19
|
+
].filter(Boolean).join(' ')
|
|
20
|
+
|
|
21
|
+
const styles = [
|
|
22
|
+
color && `--w-timeline-color: ${color};`,
|
|
23
|
+
textColor && `--w-timeline-text-color: ${textColor};`,
|
|
24
|
+
counter && `--w-timeline-counter: ${counter};`,
|
|
25
|
+
].join('')
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<ul class={classes} style={styles}>
|
|
29
|
+
<slot />
|
|
30
|
+
</ul>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactTimelineProps } from './timeline'
|
|
3
|
+
|
|
4
|
+
import './timeline.scss'
|
|
5
|
+
|
|
6
|
+
const Timeline = ({
|
|
7
|
+
theme,
|
|
8
|
+
counter,
|
|
9
|
+
alternate,
|
|
10
|
+
centered,
|
|
11
|
+
color,
|
|
12
|
+
textColor,
|
|
13
|
+
className,
|
|
14
|
+
children
|
|
15
|
+
}: ReactTimelineProps) => {
|
|
16
|
+
const classes = [
|
|
17
|
+
'w-timeline',
|
|
18
|
+
theme,
|
|
19
|
+
alternate && 'alternate',
|
|
20
|
+
centered && 'centered',
|
|
21
|
+
className
|
|
22
|
+
].filter(Boolean).join(' ')
|
|
23
|
+
|
|
24
|
+
const styles = {
|
|
25
|
+
...(color && { '--w-timeline-color': color }),
|
|
26
|
+
...(textColor && { '--w-timeline-text-color': textColor }),
|
|
27
|
+
...(counter && { '--w-timeline-counter': counter }),
|
|
28
|
+
} as React.CSSProperties
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ul className={classes} style={styles}>
|
|
32
|
+
{children}
|
|
33
|
+
</ul>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Timeline
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
// (circle width + border * 2) / 2 - line width
|
|
4
|
+
$leftOffset: calc(((25px + 4px) / 2) - 1px);
|
|
5
|
+
$rightOffset: calc((((25px + 4px) / 2) - 1px) * -1);
|
|
6
|
+
|
|
7
|
+
.w-timeline {
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: 20px;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
padding: 0 0 0 40px;
|
|
12
|
+
margin: 0;
|
|
13
|
+
list-style-type: none;
|
|
14
|
+
counter-reset: item;
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
17
|
+
&::before {
|
|
18
|
+
position: absolute;
|
|
19
|
+
content: '';
|
|
20
|
+
width: 1px;
|
|
21
|
+
background: var(--w-timeline-color);
|
|
22
|
+
height: 100%;
|
|
23
|
+
left: $leftOffset
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.fill li::before {
|
|
27
|
+
content: '';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.stroke li::before {
|
|
31
|
+
background: #000;
|
|
32
|
+
border: 2px solid var(--w-timeline-color);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include Media('xs') {
|
|
37
|
+
.w-timeline {
|
|
38
|
+
&.alternate {
|
|
39
|
+
padding: 0;
|
|
40
|
+
|
|
41
|
+
&::before {
|
|
42
|
+
left: calc(50% - 1px);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
li {
|
|
46
|
+
width: 50%;
|
|
47
|
+
|
|
48
|
+
&:nth-child(odd) {
|
|
49
|
+
padding-right: 40px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:nth-child(even) {
|
|
53
|
+
align-self: flex-end;
|
|
54
|
+
padding-left: 40px;
|
|
55
|
+
|
|
56
|
+
&::before {
|
|
57
|
+
left: 25px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&::before {
|
|
62
|
+
right: $rightOffset;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.centered li:nth-child(odd) {
|
|
68
|
+
text-align: right;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|