webcoreui 0.1.0 → 0.3.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 +37 -1
- package/astro.d.ts +12 -0
- package/astro.js +12 -0
- package/components/Accordion/accordion.module.scss +1 -2
- package/components/Alert/Alert.tsx +4 -1
- package/components/Alert/alert.module.scss +3 -3
- package/components/Avatar/avatar.module.scss +2 -0
- package/components/Badge/badge.module.scss +1 -1
- package/components/Button/button.module.scss +2 -2
- package/components/Button/button.ts +1 -1
- package/components/Card/card.module.scss +0 -1
- package/components/Checkbox/checkbox.module.scss +4 -4
- package/components/Collapsible/Collapsible.astro +63 -0
- package/components/Collapsible/Collapsible.svelte +48 -0
- package/components/Collapsible/Collapsible.tsx +54 -0
- package/components/Collapsible/collapsible.module.scss +29 -0
- package/components/Collapsible/collapsible.ts +14 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/input.module.scss +2 -2
- package/components/Menu/Menu.astro +7 -3
- package/components/Menu/Menu.svelte +11 -3
- package/components/Menu/Menu.tsx +7 -1
- package/components/Menu/menu.module.scss +4 -1
- package/components/Menu/menu.ts +1 -0
- package/components/Modal/Modal.astro +70 -0
- package/components/Modal/Modal.svelte +71 -0
- package/components/Modal/Modal.tsx +76 -0
- package/components/Modal/modal.module.scss +103 -0
- package/components/Modal/modal.ts +18 -0
- package/components/Popover/Popover.astro +23 -0
- package/components/Popover/Popover.svelte +21 -0
- package/components/Popover/Popover.tsx +27 -0
- package/components/Popover/popover.module.scss +51 -0
- package/components/Popover/popover.ts +8 -0
- package/components/Progress/progress.module.scss +3 -3
- package/components/Radio/radio.module.scss +1 -2
- package/components/Rating/Rating.astro +2 -2
- package/components/Rating/Rating.svelte +2 -2
- package/components/Rating/Rating.tsx +2 -2
- package/components/Rating/rating.module.scss +1 -1
- package/components/Sheet/Sheet.astro +29 -0
- package/components/Sheet/Sheet.svelte +24 -0
- package/components/Sheet/Sheet.tsx +32 -0
- package/components/Sheet/sheet.module.scss +68 -0
- package/components/Sheet/sheet.ts +10 -0
- package/components/Slider/Slider.astro +44 -0
- package/components/Slider/Slider.svelte +42 -0
- package/components/Slider/Slider.tsx +48 -0
- package/components/Slider/slider.module.scss +68 -0
- package/components/Slider/slider.ts +20 -0
- package/components/Switch/switch.module.scss +1 -1
- package/components/Table/Table.astro +6 -1
- package/components/Table/Table.svelte +3 -1
- package/components/Table/Table.tsx +7 -1
- package/components/Table/table.module.scss +11 -1
- package/components/Table/table.ts +1 -0
- package/components/Tabs/tabs.module.scss +6 -1
- package/components/Textarea/Textarea.astro +44 -0
- package/components/Textarea/Textarea.svelte +45 -0
- package/components/Textarea/Textarea.tsx +50 -0
- package/components/Textarea/textarea.module.scss +36 -0
- package/components/Textarea/textarea.ts +18 -0
- package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -0
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +2 -1
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +2 -1
- package/components/Timeline/timeline.module.scss +4 -4
- package/components/TimelineItem/TimelineItem.tsx +1 -6
- package/components/TimelineItem/timelineitem.module.scss +2 -3
- package/components/TimelineItem/timelineitem.ts +5 -0
- package/components/Toast/Toast.svelte +11 -6
- package/icons/close.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +69 -0
- package/index.js +4 -0
- package/package.json +2 -1
- package/react.d.ts +14 -2
- package/react.js +12 -0
- package/scss/config/color-palette.scss +1 -0
- package/scss/config/mixins.scss +152 -155
- package/scss/config/typography.scss +8 -9
- package/scss/global/theme.scss +71 -38
- package/scss/global/tooltip.scss +5 -3
- package/scss/global/utility.scss +76 -58
- package/scss/resets.scss +10 -5
- package/scss/setup.scss +2 -2
- package/svelte.d.ts +12 -0
- package/svelte.js +12 -0
- package/utils/debounce.ts +24 -0
- package/utils/interpolate.ts +23 -0
- package/utils/modal.ts +59 -0
- package/utils/popover.ts +201 -0
- package/utils/toast.ts +0 -6
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
.menu {
|
|
4
4
|
@include background(primary-70);
|
|
5
5
|
@include spacing(p-md);
|
|
6
|
-
@include typography(md);
|
|
7
6
|
@include border(bottom, primary-50);
|
|
8
7
|
@include position(sticky, t0);
|
|
9
8
|
@include layer(header);
|
|
@@ -75,6 +74,10 @@
|
|
|
75
74
|
&:hover {
|
|
76
75
|
@include typography(primary);
|
|
77
76
|
}
|
|
77
|
+
|
|
78
|
+
&.active {
|
|
79
|
+
@include typography(primary);
|
|
80
|
+
}
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
|
package/components/Menu/menu.ts
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ModalProps } from './modal'
|
|
3
|
+
|
|
4
|
+
import Button from '../Button/Button.astro'
|
|
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
|
+
import alert from '../../icons/alert.svg?raw'
|
|
10
|
+
import closeIcon from '../../icons/close.svg?raw'
|
|
11
|
+
|
|
12
|
+
import styles from './modal.module.scss'
|
|
13
|
+
|
|
14
|
+
interface Props extends ModalProps {}
|
|
15
|
+
|
|
16
|
+
const iconMap = {
|
|
17
|
+
info,
|
|
18
|
+
success,
|
|
19
|
+
warning,
|
|
20
|
+
alert
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
title,
|
|
25
|
+
subTitle,
|
|
26
|
+
showCloseIcon = true,
|
|
27
|
+
closeOnEsc = true,
|
|
28
|
+
closeOnOverlay = true,
|
|
29
|
+
theme,
|
|
30
|
+
id,
|
|
31
|
+
className
|
|
32
|
+
} = Astro.props
|
|
33
|
+
|
|
34
|
+
const close = [
|
|
35
|
+
showCloseIcon && 'icon',
|
|
36
|
+
closeOnEsc && 'esc',
|
|
37
|
+
closeOnOverlay && 'overlay'
|
|
38
|
+
].filter(Boolean).join(',')
|
|
39
|
+
|
|
40
|
+
const classes = [
|
|
41
|
+
styles.modal,
|
|
42
|
+
theme && styles[theme],
|
|
43
|
+
className
|
|
44
|
+
]
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
<dialog
|
|
48
|
+
class:list={classes}
|
|
49
|
+
id={id}
|
|
50
|
+
data-close={close.length ? close : undefined}
|
|
51
|
+
>
|
|
52
|
+
{showCloseIcon && (
|
|
53
|
+
<Button
|
|
54
|
+
theme="flat"
|
|
55
|
+
className={styles.close}
|
|
56
|
+
data-id="close"
|
|
57
|
+
>
|
|
58
|
+
<Fragment set:html={closeIcon} />
|
|
59
|
+
</Button>
|
|
60
|
+
)}
|
|
61
|
+
{title && (
|
|
62
|
+
<strong class={styles.title}>
|
|
63
|
+
{theme && <Fragment set:html={iconMap[theme]} />}
|
|
64
|
+
{title}
|
|
65
|
+
</strong>
|
|
66
|
+
)}
|
|
67
|
+
{subTitle && <div class={styles.subTitle}>{subTitle}</div>}
|
|
68
|
+
<slot />
|
|
69
|
+
</dialog>
|
|
70
|
+
<div class={styles.overlay} />
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ModalProps } from './modal'
|
|
3
|
+
|
|
4
|
+
import styles from './modal.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
import Button from '../Button/Button.svelte'
|
|
8
|
+
|
|
9
|
+
import info from '../../icons/info.svg?raw'
|
|
10
|
+
import success from '../../icons/circle-check.svg?raw'
|
|
11
|
+
import warning from '../../icons/warning.svg?raw'
|
|
12
|
+
import alert from '../../icons/alert.svg?raw'
|
|
13
|
+
import closeIcon from '../../icons/close.svg?raw'
|
|
14
|
+
|
|
15
|
+
export let title: ModalProps['title'] = ''
|
|
16
|
+
export let subTitle: ModalProps['subTitle'] = ''
|
|
17
|
+
export let showCloseIcon: ModalProps['showCloseIcon'] = true
|
|
18
|
+
export let closeOnEsc: ModalProps['closeOnEsc'] = true
|
|
19
|
+
export let closeOnOverlay: ModalProps['closeOnOverlay'] = true
|
|
20
|
+
export let theme: ModalProps['theme'] = null
|
|
21
|
+
export let id : ModalProps['className'] = ''
|
|
22
|
+
export let className: ModalProps['className'] = ''
|
|
23
|
+
|
|
24
|
+
const iconMap = {
|
|
25
|
+
info,
|
|
26
|
+
success,
|
|
27
|
+
warning,
|
|
28
|
+
alert
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const classes = classNames([
|
|
32
|
+
styles.modal,
|
|
33
|
+
theme && styles[theme],
|
|
34
|
+
className
|
|
35
|
+
])
|
|
36
|
+
|
|
37
|
+
const close = [
|
|
38
|
+
showCloseIcon && 'icon',
|
|
39
|
+
closeOnEsc && 'esc',
|
|
40
|
+
closeOnOverlay && 'overlay'
|
|
41
|
+
].filter(Boolean).join(',')
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<dialog
|
|
45
|
+
class={classes}
|
|
46
|
+
id={id}
|
|
47
|
+
data-close={close.length ? close : undefined}
|
|
48
|
+
>
|
|
49
|
+
{#if showCloseIcon}
|
|
50
|
+
<Button
|
|
51
|
+
theme="flat"
|
|
52
|
+
className={styles.close}
|
|
53
|
+
data-id="close"
|
|
54
|
+
>
|
|
55
|
+
{@html closeIcon}
|
|
56
|
+
</Button>
|
|
57
|
+
{/if}
|
|
58
|
+
{#if title}
|
|
59
|
+
<strong class={styles.title}>
|
|
60
|
+
{#if theme}
|
|
61
|
+
{@html iconMap[theme]}
|
|
62
|
+
{/if}
|
|
63
|
+
{title}
|
|
64
|
+
</strong>
|
|
65
|
+
{/if}
|
|
66
|
+
{#if subTitle}
|
|
67
|
+
<div class={styles.subTitle}>{subTitle}</div>
|
|
68
|
+
{/if}
|
|
69
|
+
<slot />
|
|
70
|
+
</dialog>
|
|
71
|
+
<div class={styles.overlay} />
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactModalProps } from './modal'
|
|
3
|
+
|
|
4
|
+
import styles from './modal.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
import Button from '../Button/Button.tsx'
|
|
8
|
+
|
|
9
|
+
import info from '../../icons/info.svg?raw'
|
|
10
|
+
import success from '../../icons/circle-check.svg?raw'
|
|
11
|
+
import warning from '../../icons/warning.svg?raw'
|
|
12
|
+
import alert from '../../icons/alert.svg?raw'
|
|
13
|
+
import closeIcon from '../../icons/close.svg?raw'
|
|
14
|
+
|
|
15
|
+
const iconMap = {
|
|
16
|
+
info,
|
|
17
|
+
success,
|
|
18
|
+
warning,
|
|
19
|
+
alert
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Modal = ({
|
|
23
|
+
title,
|
|
24
|
+
subTitle,
|
|
25
|
+
showCloseIcon = true,
|
|
26
|
+
closeOnEsc = true,
|
|
27
|
+
closeOnOverlay = true,
|
|
28
|
+
theme,
|
|
29
|
+
id,
|
|
30
|
+
className,
|
|
31
|
+
children
|
|
32
|
+
}: ReactModalProps) => {
|
|
33
|
+
const classes = classNames([
|
|
34
|
+
styles.modal,
|
|
35
|
+
theme && styles[theme],
|
|
36
|
+
className
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
const close = [
|
|
40
|
+
showCloseIcon && 'icon',
|
|
41
|
+
closeOnEsc && 'esc',
|
|
42
|
+
closeOnOverlay && 'overlay'
|
|
43
|
+
].filter(Boolean).join(',')
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<React.Fragment>
|
|
47
|
+
<dialog
|
|
48
|
+
className={classes}
|
|
49
|
+
id={id}
|
|
50
|
+
data-close={close.length ? close : undefined}
|
|
51
|
+
>
|
|
52
|
+
{showCloseIcon && (
|
|
53
|
+
<Button
|
|
54
|
+
theme="flat"
|
|
55
|
+
className={styles.close}
|
|
56
|
+
data-id="close"
|
|
57
|
+
dangerouslySetInnerHTML={{ __html: closeIcon }}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
60
|
+
{title && (
|
|
61
|
+
<strong
|
|
62
|
+
className={styles.title}
|
|
63
|
+
dangerouslySetInnerHTML={{
|
|
64
|
+
__html: theme ? iconMap[theme] + title : title
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
{subTitle && <div className={styles.subTitle}>{subTitle}</div>}
|
|
69
|
+
{children}
|
|
70
|
+
</dialog>
|
|
71
|
+
<div className={styles.overlay} />
|
|
72
|
+
</React.Fragment>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default Modal
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.modal {
|
|
4
|
+
@include transition();
|
|
5
|
+
@include position(fixed, 't50%', 'l50%');
|
|
6
|
+
@include spacing(m0, p-default);
|
|
7
|
+
@include layer(modal);
|
|
8
|
+
@include visibility(block, 0);
|
|
9
|
+
@include border(primary-50);
|
|
10
|
+
@include background(primary-70);
|
|
11
|
+
@include typography(primary);
|
|
12
|
+
@include border-radius(md);
|
|
13
|
+
@include size('w90%');
|
|
14
|
+
|
|
15
|
+
transform: translate(-50%, calc(-50% + 15px));
|
|
16
|
+
max-width: 500px;
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
|
|
19
|
+
&[data-show="true"] {
|
|
20
|
+
@include visibility(1);
|
|
21
|
+
|
|
22
|
+
transform: translate(-50%, -50%);
|
|
23
|
+
pointer-events: all;
|
|
24
|
+
|
|
25
|
+
+ .overlay {
|
|
26
|
+
@include visibility(1);
|
|
27
|
+
pointer-events: all;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.close {
|
|
32
|
+
@include position(absolute, t10px, r10px);
|
|
33
|
+
@include spacing(p-xs);
|
|
34
|
+
|
|
35
|
+
svg {
|
|
36
|
+
@include size(10px);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.title {
|
|
41
|
+
@include typography(lg);
|
|
42
|
+
@include spacing(mb-xs);
|
|
43
|
+
@include layout(flex, v-center, xs);
|
|
44
|
+
|
|
45
|
+
svg {
|
|
46
|
+
@include size(20px);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.subTitle {
|
|
51
|
+
@include typography(primary-20);
|
|
52
|
+
@include spacing(mb-xs);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.info {
|
|
56
|
+
@include border(info);
|
|
57
|
+
|
|
58
|
+
.title {
|
|
59
|
+
@include typography(info);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.success {
|
|
64
|
+
@include border(success);
|
|
65
|
+
|
|
66
|
+
.title {
|
|
67
|
+
@include typography(success);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.warning {
|
|
72
|
+
@include border(warning);
|
|
73
|
+
|
|
74
|
+
.title {
|
|
75
|
+
@include typography(warning);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.alert {
|
|
80
|
+
@include border(alert);
|
|
81
|
+
|
|
82
|
+
.title {
|
|
83
|
+
@include typography(alert);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.overlay {
|
|
89
|
+
@include transition(opacity);
|
|
90
|
+
@include position(fixed);
|
|
91
|
+
@include background(overlay);
|
|
92
|
+
@include layer(header);
|
|
93
|
+
@include visibility(0);
|
|
94
|
+
|
|
95
|
+
inset: 0;
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@include media(xs) {
|
|
100
|
+
.modal {
|
|
101
|
+
@include size('wauto');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ModalProps = {
|
|
2
|
+
title?: string
|
|
3
|
+
subTitle?: string
|
|
4
|
+
showCloseIcon?: boolean
|
|
5
|
+
closeOnEsc?: boolean
|
|
6
|
+
closeOnOverlay?: boolean
|
|
7
|
+
id?: string
|
|
8
|
+
className?: string
|
|
9
|
+
theme?: 'info'
|
|
10
|
+
| 'success'
|
|
11
|
+
| 'warning'
|
|
12
|
+
| 'alert'
|
|
13
|
+
| null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type ReactModalProps = {
|
|
17
|
+
children?: React.ReactNode
|
|
18
|
+
} & ModalProps
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PopoverProps } from './popover'
|
|
3
|
+
import styles from './popover.module.scss'
|
|
4
|
+
|
|
5
|
+
interface Props extends PopoverProps {}
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
id,
|
|
9
|
+
className
|
|
10
|
+
} = Astro.props
|
|
11
|
+
|
|
12
|
+
const classes = [
|
|
13
|
+
styles.popover,
|
|
14
|
+
className
|
|
15
|
+
]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<dialog
|
|
19
|
+
class:list={classes}
|
|
20
|
+
id={id}
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</dialog>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PopoverProps } from './popover'
|
|
3
|
+
|
|
4
|
+
import styles from './popover.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
export let id: PopoverProps['id'] = ''
|
|
8
|
+
export let className: PopoverProps['className'] = ''
|
|
9
|
+
|
|
10
|
+
const classes = classNames([
|
|
11
|
+
styles.popover,
|
|
12
|
+
className
|
|
13
|
+
])
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<dialog
|
|
17
|
+
class={classes}
|
|
18
|
+
id={id}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</dialog>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactPopoverProps } from './popover'
|
|
3
|
+
|
|
4
|
+
import styles from './popover.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
const Popover = ({
|
|
8
|
+
id,
|
|
9
|
+
className,
|
|
10
|
+
children
|
|
11
|
+
}: ReactPopoverProps) => {
|
|
12
|
+
const classes = classNames([
|
|
13
|
+
styles.popover,
|
|
14
|
+
className
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<dialog
|
|
19
|
+
className={classes}
|
|
20
|
+
id={id}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</dialog>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default Popover
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.popover {
|
|
4
|
+
@include spacing(m0, p-default);
|
|
5
|
+
@include layer(modal);
|
|
6
|
+
@include visibility(block, 0);
|
|
7
|
+
@include border(primary-50);
|
|
8
|
+
@include background(primary-70);
|
|
9
|
+
@include typography(primary);
|
|
10
|
+
@include border-radius(md);
|
|
11
|
+
@include size(w300px);
|
|
12
|
+
|
|
13
|
+
transform: translateY(-5px);
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
|
|
16
|
+
&[data-show] {
|
|
17
|
+
@include transition();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&[data-show="true"] {
|
|
21
|
+
@include visibility(1);
|
|
22
|
+
|
|
23
|
+
transform: translateY(0);
|
|
24
|
+
pointer-events: all;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&[data-position="top"] {
|
|
28
|
+
transform: translateY(5px);
|
|
29
|
+
|
|
30
|
+
&[data-show="true"] {
|
|
31
|
+
transform: translate(0);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[data-position="left"] {
|
|
36
|
+
transform: translateY(0) translateX(5px);
|
|
37
|
+
|
|
38
|
+
&[data-show="true"] {
|
|
39
|
+
transform: translate(0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
&[data-position="right"] {
|
|
45
|
+
transform: translateY(0) translateX(-5px);
|
|
46
|
+
|
|
47
|
+
&[data-show="true"] {
|
|
48
|
+
transform: translate(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -11,19 +11,19 @@ body {
|
|
|
11
11
|
@include size('w100%', h10px);
|
|
12
12
|
@include border-radius(xl);
|
|
13
13
|
@include visibility(hidden);
|
|
14
|
-
@include typography(bold,
|
|
14
|
+
@include typography(bold, xs);
|
|
15
15
|
@include background(var(--w-progress-background));
|
|
16
16
|
|
|
17
17
|
color: var(--w-progress-background);
|
|
18
18
|
|
|
19
19
|
&.medium {
|
|
20
20
|
@include size(h15px);
|
|
21
|
-
@include typography(
|
|
21
|
+
@include typography(sm);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&.large {
|
|
25
25
|
@include size(h20px);
|
|
26
|
-
@include typography(
|
|
26
|
+
@include typography(md);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&.square {
|
|
@@ -13,7 +13,6 @@ body {
|
|
|
13
13
|
|
|
14
14
|
label {
|
|
15
15
|
@include layout(flex, xs);
|
|
16
|
-
@include typography(md);
|
|
17
16
|
|
|
18
17
|
cursor: pointer;
|
|
19
18
|
|
|
@@ -71,7 +70,7 @@ body {
|
|
|
71
70
|
|
|
72
71
|
.subtext {
|
|
73
72
|
@include spacing(ml-lg);
|
|
74
|
-
@include typography(
|
|
73
|
+
@include typography(md, primary-20);
|
|
75
74
|
|
|
76
75
|
a {
|
|
77
76
|
@include typography(primary-20);
|
|
@@ -45,11 +45,11 @@ const translatedReviewText = reviewText.replace('{0}', `${reviewCount}`)
|
|
|
45
45
|
|
|
46
46
|
<span class:list={classes} style={styleVariables}>
|
|
47
47
|
{score > 0 && (
|
|
48
|
-
<span class={styles.score}>{Array(score).fill('★').join('')}</span>
|
|
48
|
+
<span class={styles.score}>{Array(Math.round(score)).fill('★').join('')}</span>
|
|
49
49
|
)}
|
|
50
50
|
{showEmpty && (
|
|
51
51
|
<span class={styles.empty}>
|
|
52
|
-
{Array(total - score).fill('★').join('')}
|
|
52
|
+
{Array(total - Math.round(score)).fill('★').join('')}
|
|
53
53
|
</span>
|
|
54
54
|
)}
|
|
55
55
|
{showText && (
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
|
|
43
43
|
<span class={classes} style={styleVariables}>
|
|
44
44
|
{#if score}
|
|
45
|
-
<span class={styles.score}>{Array(score).fill('★').join('')}</span>
|
|
45
|
+
<span class={styles.score}>{Array(Math.round(score)).fill('★').join('')}</span>
|
|
46
46
|
{/if}
|
|
47
47
|
{#if showEmpty}
|
|
48
48
|
<span class={styles.empty}>
|
|
49
|
-
{Array((total || 5) - score).fill('★').join('')}
|
|
49
|
+
{Array((total || 5) - Math.round(score)).fill('★').join('')}
|
|
50
50
|
</span>
|
|
51
51
|
{/if}
|
|
52
52
|
|
|
@@ -43,12 +43,12 @@ const Rating = ({
|
|
|
43
43
|
<span className={classes} style={styleVariables}>
|
|
44
44
|
{score > 0 && (
|
|
45
45
|
<span className={styles.score}>
|
|
46
|
-
{Array(score).fill('★').join('')}
|
|
46
|
+
{Array(Math.round(score)).fill('★').join('')}
|
|
47
47
|
</span>
|
|
48
48
|
)}
|
|
49
49
|
{showEmpty && (
|
|
50
50
|
<span className={styles.empty}>
|
|
51
|
-
{Array(total - score).fill('★').join('')}
|
|
51
|
+
{Array(total - Math.round(score)).fill('★').join('')}
|
|
52
52
|
</span>
|
|
53
53
|
)}
|
|
54
54
|
{showText && (
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { SheetProps } from './sheet'
|
|
3
|
+
|
|
4
|
+
import Modal from '../Modal/Modal.astro'
|
|
5
|
+
|
|
6
|
+
import styles from './sheet.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
interface Props extends SheetProps {}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
position,
|
|
13
|
+
className,
|
|
14
|
+
...rest
|
|
15
|
+
} = Astro.props
|
|
16
|
+
|
|
17
|
+
const classes = classNames([
|
|
18
|
+
styles.sheet,
|
|
19
|
+
position && styles[position],
|
|
20
|
+
className
|
|
21
|
+
])
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<Modal
|
|
25
|
+
className={classes}
|
|
26
|
+
{...rest}
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
</Modal>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SheetProps } from './sheet'
|
|
3
|
+
|
|
4
|
+
import Modal from '../Modal/Modal.svelte'
|
|
5
|
+
|
|
6
|
+
import styles from './sheet.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
export let position: SheetProps['position'] = null
|
|
10
|
+
export let className: SheetProps['className'] = ''
|
|
11
|
+
|
|
12
|
+
const classes = classNames([
|
|
13
|
+
styles.sheet,
|
|
14
|
+
position && styles[position],
|
|
15
|
+
className
|
|
16
|
+
])
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Modal
|
|
20
|
+
className={classes}
|
|
21
|
+
{...$$restProps}
|
|
22
|
+
>
|
|
23
|
+
<slot />
|
|
24
|
+
</Modal>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactSheetProps } from './sheet'
|
|
3
|
+
|
|
4
|
+
import Modal from '../Modal/Modal.tsx'
|
|
5
|
+
|
|
6
|
+
import styles from './sheet.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
const Sheet = ({
|
|
10
|
+
position,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}: ReactSheetProps) => {
|
|
15
|
+
const classes = classNames([
|
|
16
|
+
styles.sheet,
|
|
17
|
+
position && styles[position],
|
|
18
|
+
className
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Modal
|
|
23
|
+
className={classes}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</Modal>
|
|
28
|
+
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Sheet
|