webcoreui 0.0.9 → 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 +8 -10
- package/astro.d.ts +26 -16
- package/astro.js +13 -1
- package/components/Alert/Alert.tsx +1 -8
- package/components/Alert/alert.scss +1 -0
- package/components/Alert/alert.ts +6 -0
- package/components/Avatar/Avatar.tsx +1 -0
- package/components/Badge/Badge.astro +3 -2
- package/components/Badge/Badge.svelte +1 -1
- package/components/Badge/Badge.tsx +3 -7
- package/components/Badge/badge.ts +4 -0
- package/components/Button/Button.tsx +1 -5
- package/components/Button/button.scss +0 -1
- package/components/Button/button.ts +5 -1
- package/components/Card/Card.tsx +1 -7
- package/components/Card/card.scss +1 -0
- package/components/Card/card.ts +6 -0
- package/components/Checkbox/Checkbox.tsx +2 -6
- package/components/Checkbox/checkbox.ts +4 -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.tsx +2 -6
- package/components/Radio/radio.ts +4 -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.tsx +2 -6
- package/components/Switch/switch.ts +4 -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/index.js +1 -0
- package/package.json +3 -1
- package/react.d.ts +38 -27
- package/react.js +13 -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 +20 -1
- package/svelte.d.ts +26 -16
- package/svelte.js +13 -1
- package/utils/toast.ts +65 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SpinnerProps } from './spinner'
|
|
3
|
+
import './spinner.scss'
|
|
4
|
+
|
|
5
|
+
export let color: SpinnerProps['color'] = ''
|
|
6
|
+
export let width: SpinnerProps['width'] = 0
|
|
7
|
+
export let speed: SpinnerProps['speed'] = 0
|
|
8
|
+
export let size: SpinnerProps['size'] = 0
|
|
9
|
+
export let dashArray: SpinnerProps['dashArray'] = 0
|
|
10
|
+
|
|
11
|
+
const classes = [
|
|
12
|
+
'w-spinner',
|
|
13
|
+
dashArray && 'dashed'
|
|
14
|
+
].filter(Boolean).join(' ')
|
|
15
|
+
|
|
16
|
+
const styles = [
|
|
17
|
+
color && `--w-spinner-color: ${color};`,
|
|
18
|
+
width && `--w-spinner-width: ${width}px;`,
|
|
19
|
+
speed && `--w-spinner-speed: ${speed}s;`,
|
|
20
|
+
size && `--w-spinner-size: ${size}px;`,
|
|
21
|
+
dashArray && `--w-spinner-dash: ${dashArray}`,
|
|
22
|
+
].filter(Boolean).join(' ')
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<svg
|
|
26
|
+
class={classes}
|
|
27
|
+
viewBox="25 25 50 50"
|
|
28
|
+
role="status"
|
|
29
|
+
style={styles}
|
|
30
|
+
>
|
|
31
|
+
<circle
|
|
32
|
+
class="spinner-path"
|
|
33
|
+
cx="50"
|
|
34
|
+
cy="50"
|
|
35
|
+
r="20"
|
|
36
|
+
fill="none"
|
|
37
|
+
/>
|
|
38
|
+
</svg>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { SpinnerProps } from './spinner'
|
|
3
|
+
|
|
4
|
+
import './spinner.scss'
|
|
5
|
+
|
|
6
|
+
const Spinner = ({
|
|
7
|
+
color,
|
|
8
|
+
width,
|
|
9
|
+
speed,
|
|
10
|
+
size,
|
|
11
|
+
dashArray
|
|
12
|
+
}: SpinnerProps) => {
|
|
13
|
+
const classes = [
|
|
14
|
+
'w-spinner',
|
|
15
|
+
dashArray && 'dashed'
|
|
16
|
+
].filter(Boolean).join(' ')
|
|
17
|
+
|
|
18
|
+
const styles = {
|
|
19
|
+
...(color && { '--w-spinner-color': color }),
|
|
20
|
+
...(width && { '--w-spinner-width': `${width}px;` }),
|
|
21
|
+
...(speed && { '--w-spinner-speed': `${speed}s;` }),
|
|
22
|
+
...(size && { '--w-spinner-size': `${size}px;` }),
|
|
23
|
+
...(dashArray && { '--w-spinner-dash': dashArray }),
|
|
24
|
+
} as React.CSSProperties
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<svg
|
|
28
|
+
className={classes}
|
|
29
|
+
viewBox="25 25 50 50"
|
|
30
|
+
role="status"
|
|
31
|
+
style={styles}
|
|
32
|
+
>
|
|
33
|
+
<circle
|
|
34
|
+
className="spinner-path"
|
|
35
|
+
cx="50"
|
|
36
|
+
cy="50"
|
|
37
|
+
r="20"
|
|
38
|
+
fill="none"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default Spinner
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-spinner {
|
|
4
|
+
margin: 0px auto;
|
|
5
|
+
width: var(--w-spinner-size);
|
|
6
|
+
height: var(--w-spinner-size);
|
|
7
|
+
animation: rotate var(--w-spinner-speed) linear infinite;
|
|
8
|
+
|
|
9
|
+
&.dashed .spinner-path {
|
|
10
|
+
stroke-dasharray: var(--w-spinner-dash);
|
|
11
|
+
animation: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.spinner-path {
|
|
15
|
+
stroke: var(--w-spinner-color);
|
|
16
|
+
stroke-width: var(--w-spinner-width);
|
|
17
|
+
animation: dash 1.5s ease-in-out infinite;
|
|
18
|
+
stroke-linecap: round;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes rotate {
|
|
23
|
+
100% {
|
|
24
|
+
transform: rotate(360deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes dash {
|
|
29
|
+
0% {
|
|
30
|
+
stroke-dasharray: 1, 200;
|
|
31
|
+
stroke-dashoffset: 0;
|
|
32
|
+
}
|
|
33
|
+
50% {
|
|
34
|
+
stroke-dasharray: 89, 200;
|
|
35
|
+
stroke-dashoffset: -35;
|
|
36
|
+
}
|
|
37
|
+
100% {
|
|
38
|
+
stroke-dasharray: 89, 200;
|
|
39
|
+
stroke-dashoffset: -124;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactSwitchProps } from './switch'
|
|
3
3
|
import './switch.scss'
|
|
4
4
|
|
|
5
|
-
type ReactSwitchProps = {
|
|
6
|
-
onClick?: () => any
|
|
7
|
-
} & SwitchProps
|
|
8
|
-
|
|
9
5
|
const Switch = ({
|
|
10
6
|
label,
|
|
11
7
|
toggled,
|
|
@@ -36,7 +32,7 @@ const Switch = ({
|
|
|
36
32
|
<label className={classes} style={styles || null}>
|
|
37
33
|
<input
|
|
38
34
|
type="checkbox"
|
|
39
|
-
|
|
35
|
+
defaultChecked={toggled}
|
|
40
36
|
disabled={disabled}
|
|
41
37
|
onClick={onClick}
|
|
42
38
|
/>
|
|
@@ -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
|
+
}
|