webcoreui 0.3.0 → 0.4.0
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 +5 -2
- package/astro.d.ts +7 -1
- package/astro.js +6 -0
- package/components/Accordion/Accordion.astro +2 -0
- package/components/Accordion/Accordion.svelte +2 -0
- package/components/Accordion/Accordion.tsx +2 -0
- package/components/Alert/Alert.astro +3 -2
- package/components/Alert/Alert.svelte +4 -3
- package/components/Alert/Alert.tsx +3 -2
- package/components/Avatar/Avatar.astro +2 -1
- package/components/Avatar/Avatar.svelte +2 -1
- package/components/Avatar/Avatar.tsx +3 -3
- package/components/Badge/Badge.astro +1 -0
- package/components/Badge/Badge.svelte +3 -2
- package/components/Badge/Badge.tsx +2 -1
- package/components/Button/Button.astro +4 -5
- package/components/Button/Button.svelte +2 -1
- package/components/Button/Button.tsx +2 -1
- package/components/Button/button.ts +1 -1
- package/components/Card/Card.astro +11 -3
- package/components/Card/Card.svelte +5 -2
- package/components/Card/Card.tsx +5 -2
- package/components/Card/card.ts +1 -0
- package/components/Checkbox/Checkbox.astro +1 -0
- package/components/Checkbox/Checkbox.svelte +7 -5
- package/components/Checkbox/Checkbox.tsx +4 -2
- package/components/Collapsible/Collapsible.astro +2 -1
- package/components/Collapsible/Collapsible.svelte +2 -1
- package/components/Collapsible/Collapsible.tsx +55 -54
- package/components/ConditionalWrapper/ConditionalWrapper.astro +2 -1
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +1 -2
- package/components/Group/Group.astro +22 -0
- package/components/Group/Group.svelte +20 -0
- package/components/Group/Group.tsx +22 -0
- package/components/Group/group.module.scss +43 -0
- package/components/Group/group.ts +8 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/Input.astro +8 -1
- package/components/Input/Input.svelte +15 -3
- package/components/Input/Input.tsx +10 -3
- package/components/Input/input.module.scss +4 -1
- package/components/Input/input.ts +9 -4
- package/components/List/List.astro +169 -0
- package/components/List/List.svelte +147 -0
- package/components/List/List.tsx +168 -0
- package/components/List/list.module.scss +91 -0
- package/components/List/list.ts +37 -0
- package/components/Menu/Menu.astro +2 -1
- package/components/Menu/Menu.svelte +7 -5
- package/components/Menu/Menu.tsx +116 -113
- package/components/Modal/Modal.astro +6 -4
- package/components/Modal/Modal.svelte +8 -6
- package/components/Modal/Modal.tsx +79 -76
- package/components/Modal/modal.ts +1 -0
- package/components/Popover/Popover.astro +4 -1
- package/components/Popover/Popover.svelte +4 -2
- package/components/Popover/Popover.tsx +55 -27
- package/components/Popover/popover.module.scss +1 -0
- package/components/Popover/popover.ts +2 -0
- package/components/Progress/Progress.astro +2 -1
- package/components/Progress/Progress.svelte +2 -1
- package/components/Progress/Progress.tsx +3 -2
- package/components/Radio/Radio.astro +1 -0
- package/components/Radio/Radio.svelte +4 -2
- package/components/Radio/Radio.tsx +3 -2
- package/components/Rating/Rating.astro +3 -1
- package/components/Rating/Rating.svelte +9 -7
- package/components/Rating/Rating.tsx +4 -2
- package/components/Select/Select.astro +135 -0
- package/components/Select/Select.svelte +122 -0
- package/components/Select/Select.tsx +142 -0
- package/components/Select/select.module.scss +25 -0
- package/components/Select/select.ts +21 -0
- package/components/Sheet/Sheet.astro +2 -1
- package/components/Sheet/Sheet.svelte +2 -1
- package/components/Sheet/Sheet.tsx +33 -32
- package/components/Slider/Slider.astro +2 -1
- package/components/Slider/Slider.svelte +2 -1
- package/components/Slider/Slider.tsx +49 -48
- package/components/Spinner/Spinner.astro +4 -3
- package/components/Spinner/Spinner.svelte +3 -2
- package/components/Spinner/Spinner.tsx +4 -3
- package/components/Switch/Switch.astro +2 -1
- package/components/Switch/Switch.svelte +5 -4
- package/components/Switch/Switch.tsx +2 -2
- package/components/Switch/switch.module.scss +1 -1
- package/components/Table/Table.astro +1 -0
- package/components/Table/Table.svelte +2 -1
- package/components/Table/Table.tsx +2 -1
- package/components/Tabs/Tabs.astro +2 -1
- package/components/Tabs/Tabs.svelte +2 -1
- package/components/Tabs/Tabs.tsx +4 -3
- package/components/Textarea/Textarea.astro +1 -0
- package/components/Textarea/Textarea.svelte +3 -1
- package/components/Textarea/Textarea.tsx +52 -50
- package/components/ThemeSwitcher/ThemeSwitcher.astro +108 -107
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +5 -4
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +91 -90
- package/components/Timeline/Timeline.astro +3 -2
- package/components/Timeline/Timeline.svelte +3 -2
- package/components/Timeline/Timeline.tsx +3 -2
- package/components/TimelineItem/TimelineItem.svelte +2 -1
- package/components/TimelineItem/TimelineItem.tsx +2 -1
- package/components/Toast/Toast.astro +3 -1
- package/components/Toast/Toast.svelte +3 -1
- package/components/Toast/Toast.tsx +3 -1
- package/icons/moon.svg +1 -1
- package/icons/search.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +55 -25
- package/package.json +22 -4
- package/react.d.ts +6 -0
- package/react.js +6 -0
- package/scss/config/mixins.scss +12 -10
- package/scss/config/variables.scss +1 -0
- package/scss/config.scss +1 -0
- package/scss/global/utility.scss +2 -0
- package/svelte.d.ts +7 -1
- package/svelte.js +6 -0
- package/utils/cookies.ts +4 -4
- package/utils/debounce.ts +1 -1
- package/utils/event.ts +2 -2
- package/utils/interpolate.ts +5 -5
- package/utils/modal.ts +90 -27
- package/utils/popover.ts +30 -8
- package/utils/toast.ts +6 -2
package/components/Menu/Menu.tsx
CHANGED
|
@@ -1,113 +1,116 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import type { ReactMenuProps } from './menu'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { classNames } from '../../utils/classNames'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{item.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<span className={styles.meat}></span>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import type { ReactMenuProps } from './menu'
|
|
3
|
+
|
|
4
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
|
+
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
import styles from './menu.module.scss'
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line complexity
|
|
11
|
+
const Menu = ({
|
|
12
|
+
items,
|
|
13
|
+
logo,
|
|
14
|
+
centerLogo,
|
|
15
|
+
className,
|
|
16
|
+
wrapperClassName,
|
|
17
|
+
children
|
|
18
|
+
}: ReactMenuProps) => {
|
|
19
|
+
const [active, setActive] = useState(false)
|
|
20
|
+
|
|
21
|
+
const classes = classNames([
|
|
22
|
+
styles.menu,
|
|
23
|
+
className
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
const containerClasses = classNames([
|
|
27
|
+
styles.container,
|
|
28
|
+
wrapperClassName
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
const wrapMenu = (logo?.url || logo?.html) && items?.length && children
|
|
32
|
+
|
|
33
|
+
const toggleMenu = () => setActive(!active)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<header className={classes} data-active={active || null}>
|
|
37
|
+
<div className={containerClasses}>
|
|
38
|
+
<ConditionalWrapper
|
|
39
|
+
condition={!!wrapMenu}
|
|
40
|
+
wrapper={children => (
|
|
41
|
+
<div className={styles.wrapper}>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
{logo?.url && !centerLogo && (
|
|
47
|
+
<a href="/">
|
|
48
|
+
<img
|
|
49
|
+
src={logo.url}
|
|
50
|
+
alt={logo.alt || 'Logo'}
|
|
51
|
+
width={logo.width}
|
|
52
|
+
height={logo.height}
|
|
53
|
+
/>
|
|
54
|
+
</a>
|
|
55
|
+
)}
|
|
56
|
+
|
|
57
|
+
{!centerLogo && logo?.html && (
|
|
58
|
+
<a
|
|
59
|
+
href="/"
|
|
60
|
+
dangerouslySetInnerHTML={{ __html: logo.html }}
|
|
61
|
+
aria-label={logo.alt || 'Logo'}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
|
|
65
|
+
{!!items?.length && (
|
|
66
|
+
<ul>
|
|
67
|
+
{items.map((item, index) => (
|
|
68
|
+
<li key={index}>
|
|
69
|
+
<a
|
|
70
|
+
href={item.url}
|
|
71
|
+
target={item.target}
|
|
72
|
+
className={item.active ? styles.active : undefined}
|
|
73
|
+
>
|
|
74
|
+
{item.name}
|
|
75
|
+
</a>
|
|
76
|
+
</li>
|
|
77
|
+
))}
|
|
78
|
+
</ul>
|
|
79
|
+
)}
|
|
80
|
+
</ConditionalWrapper>
|
|
81
|
+
|
|
82
|
+
{!!items?.length && (
|
|
83
|
+
<button className={styles.hamburger} onClick={toggleMenu}>
|
|
84
|
+
<span className={styles.meat}></span>
|
|
85
|
+
<span className={styles.meat}></span>
|
|
86
|
+
<span className={styles.meat}></span>
|
|
87
|
+
<span className={styles.meat}></span>
|
|
88
|
+
</button>
|
|
89
|
+
)}
|
|
90
|
+
|
|
91
|
+
{centerLogo && logo?.html && (
|
|
92
|
+
<a
|
|
93
|
+
href="/"
|
|
94
|
+
dangerouslySetInnerHTML={{ __html: logo.html }}
|
|
95
|
+
aria-label={logo.alt || 'Logo'}
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
|
|
99
|
+
{logo?.url && centerLogo && (
|
|
100
|
+
<a href="/">
|
|
101
|
+
<img
|
|
102
|
+
src={logo.url}
|
|
103
|
+
alt={logo.alt || 'Logo'}
|
|
104
|
+
width={logo.width}
|
|
105
|
+
height={logo.height}
|
|
106
|
+
/>
|
|
107
|
+
</a>
|
|
108
|
+
)}
|
|
109
|
+
|
|
110
|
+
{children}
|
|
111
|
+
</div>
|
|
112
|
+
</header>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export default Menu
|
|
@@ -3,11 +3,11 @@ import type { ModalProps } from './modal'
|
|
|
3
3
|
|
|
4
4
|
import Button from '../Button/Button.astro'
|
|
5
5
|
|
|
6
|
-
import info from '../../icons/info.svg?raw'
|
|
7
|
-
import success from '../../icons/circle-check.svg?raw'
|
|
8
|
-
import warning from '../../icons/warning.svg?raw'
|
|
9
6
|
import alert from '../../icons/alert.svg?raw'
|
|
7
|
+
import success from '../../icons/circle-check.svg?raw'
|
|
10
8
|
import closeIcon from '../../icons/close.svg?raw'
|
|
9
|
+
import info from '../../icons/info.svg?raw'
|
|
10
|
+
import warning from '../../icons/warning.svg?raw'
|
|
11
11
|
|
|
12
12
|
import styles from './modal.module.scss'
|
|
13
13
|
|
|
@@ -28,7 +28,8 @@ const {
|
|
|
28
28
|
closeOnOverlay = true,
|
|
29
29
|
theme,
|
|
30
30
|
id,
|
|
31
|
-
className
|
|
31
|
+
className,
|
|
32
|
+
...rest
|
|
32
33
|
} = Astro.props
|
|
33
34
|
|
|
34
35
|
const close = [
|
|
@@ -48,6 +49,7 @@ const classes = [
|
|
|
48
49
|
class:list={classes}
|
|
49
50
|
id={id}
|
|
50
51
|
data-close={close.length ? close : undefined}
|
|
52
|
+
{...rest}
|
|
51
53
|
>
|
|
52
54
|
{showCloseIcon && (
|
|
53
55
|
<Button
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ModalProps } from './modal'
|
|
3
3
|
|
|
4
|
-
import styles from './modal.module.scss'
|
|
5
|
-
import { classNames } from '../../utils/classNames'
|
|
6
|
-
|
|
7
4
|
import Button from '../Button/Button.svelte'
|
|
8
5
|
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import warning from '../../icons/warning.svg?raw'
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
12
8
|
import alert from '../../icons/alert.svg?raw'
|
|
9
|
+
import success from '../../icons/circle-check.svg?raw'
|
|
13
10
|
import closeIcon from '../../icons/close.svg?raw'
|
|
11
|
+
import info from '../../icons/info.svg?raw'
|
|
12
|
+
import warning from '../../icons/warning.svg?raw'
|
|
13
|
+
|
|
14
|
+
import styles from './modal.module.scss'
|
|
14
15
|
|
|
15
16
|
export let title: ModalProps['title'] = ''
|
|
16
17
|
export let subTitle: ModalProps['subTitle'] = ''
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
class={classes}
|
|
46
47
|
id={id}
|
|
47
48
|
data-close={close.length ? close : undefined}
|
|
49
|
+
{...$$restProps}
|
|
48
50
|
>
|
|
49
51
|
{#if showCloseIcon}
|
|
50
52
|
<Button
|
|
@@ -1,76 +1,79 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { ReactModalProps } from './modal'
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactModalProps } from './modal'
|
|
3
|
+
|
|
4
|
+
import Button from '../Button/Button.tsx'
|
|
5
|
+
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
import alert from '../../icons/alert.svg?raw'
|
|
9
|
+
import success from '../../icons/circle-check.svg?raw'
|
|
10
|
+
import closeIcon from '../../icons/close.svg?raw'
|
|
11
|
+
import info from '../../icons/info.svg?raw'
|
|
12
|
+
import warning from '../../icons/warning.svg?raw'
|
|
13
|
+
|
|
14
|
+
import styles from './modal.module.scss'
|
|
15
|
+
|
|
16
|
+
const iconMap = {
|
|
17
|
+
info,
|
|
18
|
+
success,
|
|
19
|
+
warning,
|
|
20
|
+
alert
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Modal = ({
|
|
24
|
+
title,
|
|
25
|
+
subTitle,
|
|
26
|
+
showCloseIcon = true,
|
|
27
|
+
closeOnEsc = true,
|
|
28
|
+
closeOnOverlay = true,
|
|
29
|
+
theme,
|
|
30
|
+
id,
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
...rest
|
|
34
|
+
}: ReactModalProps) => {
|
|
35
|
+
const classes = classNames([
|
|
36
|
+
styles.modal,
|
|
37
|
+
theme && styles[theme],
|
|
38
|
+
className
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
const close = [
|
|
42
|
+
showCloseIcon && 'icon',
|
|
43
|
+
closeOnEsc && 'esc',
|
|
44
|
+
closeOnOverlay && 'overlay'
|
|
45
|
+
].filter(Boolean).join(',')
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<React.Fragment>
|
|
49
|
+
<dialog
|
|
50
|
+
className={classes}
|
|
51
|
+
id={id}
|
|
52
|
+
data-close={close.length ? close : undefined}
|
|
53
|
+
{...rest}
|
|
54
|
+
>
|
|
55
|
+
{showCloseIcon && (
|
|
56
|
+
<Button
|
|
57
|
+
theme="flat"
|
|
58
|
+
className={styles.close}
|
|
59
|
+
data-id="close"
|
|
60
|
+
dangerouslySetInnerHTML={{ __html: closeIcon }}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
{title && (
|
|
64
|
+
<strong
|
|
65
|
+
className={styles.title}
|
|
66
|
+
dangerouslySetInnerHTML={{
|
|
67
|
+
__html: theme ? iconMap[theme] + title : title
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
{subTitle && <div className={styles.subTitle}>{subTitle}</div>}
|
|
72
|
+
{children}
|
|
73
|
+
</dialog>
|
|
74
|
+
<div className={styles.overlay} />
|
|
75
|
+
</React.Fragment>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default Modal
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { PopoverProps } from './popover'
|
|
3
|
+
|
|
3
4
|
import styles from './popover.module.scss'
|
|
4
5
|
|
|
5
6
|
interface Props extends PopoverProps {}
|
|
6
7
|
|
|
7
8
|
const {
|
|
8
9
|
id,
|
|
9
|
-
className
|
|
10
|
+
className,
|
|
11
|
+
...rest
|
|
10
12
|
} = Astro.props
|
|
11
13
|
|
|
12
14
|
const classes = [
|
|
@@ -18,6 +20,7 @@ const classes = [
|
|
|
18
20
|
<dialog
|
|
19
21
|
class:list={classes}
|
|
20
22
|
id={id}
|
|
23
|
+
{...rest}
|
|
21
24
|
>
|
|
22
25
|
<slot />
|
|
23
26
|
</dialog>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PopoverProps } from './popover'
|
|
3
3
|
|
|
4
|
-
import styles from './popover.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './popover.module.scss'
|
|
7
|
+
|
|
7
8
|
export let id: PopoverProps['id'] = ''
|
|
8
9
|
export let className: PopoverProps['className'] = ''
|
|
9
10
|
|
|
@@ -15,7 +16,8 @@
|
|
|
15
16
|
|
|
16
17
|
<dialog
|
|
17
18
|
class={classes}
|
|
18
|
-
id={id}
|
|
19
|
+
id={id || null}
|
|
20
|
+
{...$$restProps}
|
|
19
21
|
>
|
|
20
22
|
<slot />
|
|
21
23
|
</dialog>
|
|
@@ -1,27 +1,55 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { classNames } from '../../utils/classNames'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import React, { useEffect,useState } from 'react'
|
|
2
|
+
import { createPortal } from 'react-dom'
|
|
3
|
+
import type { ReactPopoverProps } from './popover'
|
|
4
|
+
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
import styles from './popover.module.scss'
|
|
8
|
+
|
|
9
|
+
const Popover = ({
|
|
10
|
+
id,
|
|
11
|
+
className,
|
|
12
|
+
isInteractive = false,
|
|
13
|
+
children,
|
|
14
|
+
...rest
|
|
15
|
+
}: ReactPopoverProps) => {
|
|
16
|
+
const [isMounted, setIsMounted] = useState(false)
|
|
17
|
+
|
|
18
|
+
const classes = classNames([
|
|
19
|
+
styles.popover,
|
|
20
|
+
className
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setIsMounted(true)
|
|
25
|
+
}, [])
|
|
26
|
+
|
|
27
|
+
if (!isMounted && isInteractive) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isInteractive) {
|
|
32
|
+
return createPortal(
|
|
33
|
+
<dialog
|
|
34
|
+
className={classes}
|
|
35
|
+
id={id}
|
|
36
|
+
{...rest}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</dialog>,
|
|
40
|
+
document.body
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<dialog
|
|
46
|
+
className={classes}
|
|
47
|
+
id={id}
|
|
48
|
+
{...rest}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</dialog>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default Popover
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ProgressProps } from './progress'
|
|
3
3
|
|
|
4
|
-
import styles from './progress.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './progress.module.scss'
|
|
7
|
+
|
|
7
8
|
interface Props extends ProgressProps {}
|
|
8
9
|
|
|
9
10
|
const {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ProgressProps } from './progress'
|
|
3
3
|
|
|
4
|
-
import styles from './progress.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './progress.module.scss'
|
|
7
|
+
|
|
7
8
|
export let value: ProgressProps['value'] = 0
|
|
8
9
|
export let size: ProgressProps['size'] = null
|
|
9
10
|
export let label: ProgressProps['label'] = false
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ProgressProps } from './progress'
|
|
3
3
|
|
|
4
|
-
import styles from './progress.module.scss'
|
|
5
4
|
import { classNames } from '../../utils/classNames'
|
|
6
5
|
|
|
6
|
+
import styles from './progress.module.scss'
|
|
7
|
+
|
|
7
8
|
const Progress = ({
|
|
8
9
|
value,
|
|
9
10
|
size,
|
|
@@ -28,7 +29,7 @@ const Progress = ({
|
|
|
28
29
|
...(color && { '--w-progress-color': color }),
|
|
29
30
|
...(background && { '--w-progress-background': background }),
|
|
30
31
|
...(stripeLight && { '--w-progress-stripe-light': stripeLight }),
|
|
31
|
-
...(stripeDark && { '--w-progress-stripe-dark': stripeDark })
|
|
32
|
+
...(stripeDark && { '--w-progress-stripe-dark': stripeDark })
|
|
32
33
|
} as React.CSSProperties
|
|
33
34
|
|
|
34
35
|
const percent = {
|