webcoreui 0.0.11 → 0.0.12
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 +33 -7
- package/astro.d.ts +4 -0
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +10 -8
- package/components/Accordion/Accordion.svelte +8 -8
- package/components/Accordion/Accordion.tsx +7 -6
- package/components/Accordion/{accordion.scss → accordion.module.scss} +18 -10
- package/components/Alert/Alert.astro +11 -7
- package/components/Alert/Alert.svelte +9 -7
- package/components/Alert/Alert.tsx +11 -7
- package/components/Alert/alert.module.scss +54 -0
- package/components/Alert/alert.ts +3 -1
- package/components/Avatar/Avatar.astro +4 -4
- package/components/Avatar/Avatar.svelte +13 -7
- package/components/Avatar/Avatar.tsx +11 -9
- package/components/Avatar/{avatar.scss → avatar.module.scss} +2 -2
- package/components/Badge/Badge.astro +8 -8
- package/components/Badge/Badge.svelte +25 -13
- package/components/Badge/Badge.tsx +26 -8
- package/components/Badge/badge.module.scss +89 -0
- package/components/Badge/badge.ts +8 -1
- package/components/Button/Button.astro +10 -6
- package/components/Button/Button.svelte +15 -11
- package/components/Button/Button.tsx +11 -7
- package/components/Button/button.module.scss +94 -0
- package/components/Button/button.ts +6 -1
- package/components/Card/Card.astro +7 -15
- package/components/Card/Card.svelte +16 -13
- package/components/Card/Card.tsx +15 -11
- package/components/Card/card.module.scss +33 -0
- package/components/Checkbox/Checkbox.astro +10 -10
- package/components/Checkbox/Checkbox.svelte +19 -18
- package/components/Checkbox/Checkbox.tsx +12 -11
- package/components/Checkbox/{checkbox.scss → checkbox.module.scss} +16 -17
- package/components/Checkbox/checkbox.ts +5 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
- package/components/Icon/Icon.svelte +1 -8
- package/components/Icon/Icon.tsx +1 -8
- package/components/Icon/map.ts +23 -0
- package/components/Input/Input.astro +50 -52
- package/components/Input/Input.svelte +52 -52
- package/components/Input/Input.tsx +59 -59
- package/components/Input/{input.scss → input.module.scss} +87 -83
- package/components/Input/input.ts +8 -2
- package/components/Menu/Menu.astro +107 -0
- package/components/Menu/Menu.svelte +88 -0
- package/components/Menu/Menu.tsx +107 -0
- package/components/Menu/menu.module.scss +144 -0
- package/components/Menu/menu.ts +21 -0
- package/components/Progress/Progress.astro +42 -40
- package/components/Progress/Progress.svelte +40 -38
- package/components/Progress/Progress.tsx +48 -47
- package/components/Progress/{progress.scss → progress.module.scss} +66 -66
- package/components/Radio/Radio.astro +57 -57
- package/components/Radio/Radio.svelte +58 -56
- package/components/Radio/Radio.tsx +69 -68
- package/components/Radio/{radio.scss → radio.module.scss} +92 -92
- package/components/Radio/radio.ts +4 -0
- package/components/Rating/Rating.astro +13 -10
- package/components/Rating/Rating.svelte +15 -15
- package/components/Rating/Rating.tsx +22 -11
- package/components/Rating/{rating.scss → rating.module.scss} +10 -9
- package/components/Rating/rating.ts +1 -1
- package/components/Spinner/Spinner.astro +44 -42
- package/components/Spinner/Spinner.svelte +40 -38
- package/components/Spinner/Spinner.tsx +45 -44
- package/components/Spinner/{spinner.scss → spinner.module.scss} +41 -41
- package/components/Switch/Switch.astro +13 -11
- package/components/Switch/Switch.svelte +26 -24
- package/components/Switch/Switch.tsx +14 -12
- package/components/Switch/{switch.scss → switch.module.scss} +4 -4
- package/components/Switch/switch.ts +8 -4
- package/components/Table/Table.astro +60 -60
- package/components/Table/Table.svelte +56 -54
- package/components/Table/Table.tsx +64 -63
- package/components/Table/{table.scss → table.module.scss} +64 -65
- package/components/Tabs/Tabs.astro +77 -76
- package/components/Tabs/Tabs.svelte +56 -54
- package/components/Tabs/Tabs.tsx +70 -69
- package/components/Tabs/{tabs.scss → tabs.module.scss} +30 -31
- package/components/ThemeSwitcher/ThemeSwitcher.astro +106 -0
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +76 -0
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +89 -0
- package/components/ThemeSwitcher/themeswitcher.module.scss +74 -0
- package/components/ThemeSwitcher/themeswitcher.ts +13 -0
- package/components/Timeline/Timeline.astro +36 -34
- package/components/Timeline/Timeline.svelte +32 -30
- package/components/Timeline/Timeline.tsx +38 -37
- package/components/Timeline/{timeline.scss → timeline.module.scss} +71 -71
- package/components/TimelineItem/TimelineItem.astro +27 -26
- package/components/TimelineItem/TimelineItem.svelte +24 -22
- package/components/TimelineItem/TimelineItem.tsx +33 -32
- package/components/TimelineItem/{timelineitem.scss → timelineitem.module.scss} +31 -31
- package/components/Toast/Toast.astro +41 -30
- package/components/Toast/Toast.svelte +32 -21
- package/components/Toast/Toast.tsx +38 -28
- package/components/Toast/{toast.scss → toast.module.scss} +44 -43
- package/components/Toast/toast.ts +3 -6
- package/icons/moon.svg +3 -0
- package/icons/sun.svg +3 -0
- package/index.js +3 -0
- package/package.json +3 -1
- package/react.d.ts +4 -0
- package/react.js +4 -0
- package/scss/global/elements.scss +1 -1
- package/scss/global/scrollbar.scss +21 -0
- package/scss/global/theme.scss +140 -0
- package/scss/global/tooltip.scss +8 -5
- package/scss/global/utility.scss +29 -0
- package/scss/global.scss +2 -0
- package/scss/resets.scss +5 -5
- package/scss/setup.scss +39 -18
- package/svelte.d.ts +16 -12
- package/svelte.js +4 -0
- package/utils/classNames.ts +4 -0
- package/utils/cookies.ts +28 -0
- package/utils/event.ts +17 -0
- package/utils/toast.ts +12 -9
- package/components/Alert/alert.scss +0 -53
- package/components/Badge/badge.scss +0 -85
- package/components/Button/button.scss +0 -91
- package/components/Card/card.scss +0 -37
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { BadgeProps } from './badge'
|
|
3
|
-
import './badge.scss'
|
|
3
|
+
import styles from './badge.module.scss'
|
|
4
4
|
|
|
5
|
-
interface Props extends BadgeProps {
|
|
6
|
-
interactive?: boolean
|
|
7
|
-
}
|
|
5
|
+
interface Props extends BadgeProps {}
|
|
8
6
|
|
|
9
7
|
const {
|
|
10
8
|
theme,
|
|
11
|
-
|
|
9
|
+
hover,
|
|
10
|
+
className,
|
|
12
11
|
...rest
|
|
13
12
|
} = Astro.props
|
|
14
13
|
|
|
15
14
|
const classes = [
|
|
16
|
-
|
|
17
|
-
theme
|
|
18
|
-
|
|
15
|
+
styles.badge,
|
|
16
|
+
theme && styles[theme],
|
|
17
|
+
hover && styles.hover,
|
|
18
|
+
className
|
|
19
19
|
]
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export let onClick: BadgeProps['onClick'] = () => {}
|
|
2
|
+
import type { SvelteBadgeProps } from './badge'
|
|
3
|
+
|
|
4
|
+
import styles from './badge.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export let theme: SvelteBadgeProps['theme'] = null
|
|
8
|
+
export let onClick: SvelteBadgeProps['onClick'] = null
|
|
9
|
+
export let hover: SvelteBadgeProps['hover'] = false
|
|
10
|
+
export let className: SvelteBadgeProps['className'] = ''
|
|
11
|
+
|
|
12
|
+
const classes = classNames([
|
|
13
|
+
styles.badge,
|
|
14
|
+
theme && styles[theme],
|
|
15
|
+
(onClick || hover) && styles.hover,
|
|
16
|
+
className
|
|
17
|
+
])
|
|
13
18
|
</script>
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
20
|
+
{#if onClick}
|
|
21
|
+
<button class={classes} on:click={onClick} {...$$restProps}>
|
|
22
|
+
<slot />
|
|
23
|
+
</button>
|
|
24
|
+
{:else}
|
|
25
|
+
<span class={classes} {...$$restProps}>
|
|
26
|
+
<slot />
|
|
27
|
+
</span>
|
|
28
|
+
{/if}
|
|
29
|
+
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactBadgeProps } from './badge'
|
|
3
|
-
import './badge.scss'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import styles from './badge.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
const Badge = ({
|
|
8
|
+
theme,
|
|
9
|
+
onClick,
|
|
10
|
+
hover,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}: ReactBadgeProps) => {
|
|
15
|
+
const classes = classNames([
|
|
16
|
+
styles.badge,
|
|
17
|
+
theme && styles[theme],
|
|
18
|
+
(onClick || hover) && styles.hover,
|
|
19
|
+
className
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
if (onClick) {
|
|
23
|
+
return (
|
|
24
|
+
<button className={classes} onClick={onClick} {...rest}>
|
|
25
|
+
{children}
|
|
26
|
+
</button>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
11
29
|
|
|
12
30
|
return (
|
|
13
|
-
<span className={classes}
|
|
31
|
+
<span className={classes} {...rest}>
|
|
14
32
|
{children}
|
|
15
33
|
</span>
|
|
16
34
|
)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.badge {
|
|
4
|
+
@include Transition();
|
|
5
|
+
padding: 5px 10px;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 5px;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
background: var(--w-color-primary);
|
|
12
|
+
color: var(--w-color-primary-50);
|
|
13
|
+
border: 0;
|
|
14
|
+
|
|
15
|
+
&.hover {
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
background: var(--w-color-primary-20);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.secondary:hover {
|
|
23
|
+
background: var(--w-color-primary-40);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.outline:hover {
|
|
27
|
+
color: var(--w-color-primary);
|
|
28
|
+
background: transparent;
|
|
29
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.flat:hover {
|
|
33
|
+
background: var(--w-color-primary-40);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.info:hover {
|
|
37
|
+
background: var(--w-color-info-accent);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.success:hover {
|
|
41
|
+
background: var(--w-color-success-accent);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.warning:hover {
|
|
45
|
+
background: var(--w-color-warning-accent);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.alert:hover {
|
|
49
|
+
background: var(--w-color-alert-accent);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
&.secondary {
|
|
55
|
+
background: var(--w-color-primary-50);
|
|
56
|
+
color: var(--w-color-primary);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.outline {
|
|
60
|
+
background: var(--w-color-primary-70);
|
|
61
|
+
color: var(--w-color-primary-20);
|
|
62
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-20);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.flat {
|
|
66
|
+
background: var(--w-color-primary-70);
|
|
67
|
+
color: var(--w-color-primary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.info {
|
|
71
|
+
background: var(--w-color-info);
|
|
72
|
+
color: var(--w-color-info-fg);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.success {
|
|
76
|
+
background: var(--w-color-success);
|
|
77
|
+
color: var(--w-color-success-fg);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.warning {
|
|
81
|
+
background: var(--w-color-warning);
|
|
82
|
+
color: var(--w-color-warning-fg);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.alert {
|
|
86
|
+
background: var(--w-color-alert);
|
|
87
|
+
color: var(--w-color-alert-fg);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -7,9 +7,16 @@ export type BadgeProps = {
|
|
|
7
7
|
| 'warning'
|
|
8
8
|
| 'alert'
|
|
9
9
|
| null
|
|
10
|
-
|
|
10
|
+
hover?: boolean
|
|
11
|
+
className?: string
|
|
12
|
+
[key: string]: any
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
export type SvelteBadgeProps = {
|
|
16
|
+
onClick?: (() => any) | null
|
|
17
|
+
} & BadgeProps
|
|
18
|
+
|
|
13
19
|
export type ReactBadgeProps = {
|
|
20
|
+
onClick?: (() => any) | null
|
|
14
21
|
children: React.ReactNode
|
|
15
22
|
} & BadgeProps
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ButtonProps } from './button'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import styles from './button.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
4
6
|
|
|
5
7
|
interface Props extends ButtonProps {}
|
|
6
8
|
|
|
@@ -8,14 +10,16 @@ const {
|
|
|
8
10
|
theme,
|
|
9
11
|
bold,
|
|
10
12
|
href,
|
|
13
|
+
className,
|
|
11
14
|
...rest
|
|
12
15
|
} = Astro.props
|
|
13
16
|
|
|
14
|
-
const classes = [
|
|
15
|
-
|
|
16
|
-
bold &&
|
|
17
|
-
theme
|
|
18
|
-
|
|
17
|
+
const classes = classNames([
|
|
18
|
+
styles.button,
|
|
19
|
+
bold && styles.bold,
|
|
20
|
+
theme && styles[theme],
|
|
21
|
+
className
|
|
22
|
+
])
|
|
19
23
|
---
|
|
20
24
|
|
|
21
25
|
{href ? (
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
import './button.scss'
|
|
2
|
+
import type { SvelteButtonProps } from './button'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let href: ButtonProps['href'] = ''
|
|
8
|
-
export let onClick: ButtonProps['onClick'] = () => {}
|
|
4
|
+
import styles from './button.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
]
|
|
7
|
+
export let theme: SvelteButtonProps['theme'] = null
|
|
8
|
+
export let bold: SvelteButtonProps['bold'] = false
|
|
9
|
+
export let href: SvelteButtonProps['href'] = ''
|
|
10
|
+
export let className: SvelteButtonProps['className'] = ''
|
|
11
|
+
export let onClick: SvelteButtonProps['onClick'] = () => {}
|
|
12
|
+
|
|
13
|
+
const classes = classNames([
|
|
14
|
+
styles.button,
|
|
15
|
+
bold && styles.bold,
|
|
16
|
+
theme && styles[theme],
|
|
17
|
+
className
|
|
18
|
+
])
|
|
15
19
|
</script>
|
|
16
20
|
|
|
17
21
|
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactButtonProps } from './button'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import styles from './button.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
4
6
|
|
|
5
7
|
const Button = ({
|
|
6
8
|
theme,
|
|
7
9
|
bold,
|
|
8
10
|
href,
|
|
9
|
-
|
|
11
|
+
className,
|
|
10
12
|
onClick,
|
|
13
|
+
children,
|
|
11
14
|
...rest
|
|
12
15
|
}: ReactButtonProps) => {
|
|
13
|
-
const classes = [
|
|
14
|
-
|
|
15
|
-
bold &&
|
|
16
|
-
theme
|
|
17
|
-
|
|
16
|
+
const classes = classNames([
|
|
17
|
+
styles.button,
|
|
18
|
+
bold && styles.bold,
|
|
19
|
+
theme && styles[theme],
|
|
20
|
+
className
|
|
21
|
+
])
|
|
18
22
|
|
|
19
23
|
if (href) {
|
|
20
24
|
return (
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.button {
|
|
4
|
+
@include Transition();
|
|
5
|
+
padding: 10px 15px;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 5px;
|
|
11
|
+
font-size: 16px;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
border: 0;
|
|
14
|
+
background: var(--w-color-primary);
|
|
15
|
+
color: var(--w-color-primary-50);
|
|
16
|
+
|
|
17
|
+
&[disabled] {
|
|
18
|
+
cursor: no-drop;
|
|
19
|
+
background: var(--w-color-primary-20);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
background: var(--w-color-primary-20);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.secondary {
|
|
27
|
+
background: var(--w-color-primary-50);
|
|
28
|
+
color: var(--w-color-primary);
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
background: var(--w-color-primary-40);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.outline {
|
|
36
|
+
background: transparent;
|
|
37
|
+
color: var(--w-color-primary-20);
|
|
38
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-20);
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
color: var(--w-color-primary);
|
|
42
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.flat {
|
|
47
|
+
background: transparent;
|
|
48
|
+
color: var(--w-color-primary);
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
background: var(--w-color-primary-40);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.info {
|
|
56
|
+
background: var(--w-color-info);
|
|
57
|
+
color: var(--w-color-info-fg);
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
background: var(--w-color-info-accent);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.success {
|
|
65
|
+
background: var(--w-color-success);
|
|
66
|
+
color: var(--w-color-success-fg);
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
background: var(--w-color-success-accent);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.warning {
|
|
74
|
+
background: var(--w-color-warning);
|
|
75
|
+
color: var(--w-color-warning-fg);
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
background: var(--w-color-warning-accent);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.alert {
|
|
83
|
+
background: var(--w-color-alert);
|
|
84
|
+
color: var(--w-color-alert-fg);
|
|
85
|
+
|
|
86
|
+
&:hover {
|
|
87
|
+
background: var(--w-color-alert-accent);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.bold {
|
|
92
|
+
font-family: Bold;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -9,10 +9,15 @@ export type ButtonProps = {
|
|
|
9
9
|
| null
|
|
10
10
|
bold?: boolean
|
|
11
11
|
href?: string
|
|
12
|
-
|
|
12
|
+
className?: string
|
|
13
13
|
[key: string]: any
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export type SvelteButtonProps = {
|
|
17
|
+
onClick?: () => any
|
|
18
|
+
} & ButtonProps
|
|
19
|
+
|
|
16
20
|
export type ReactButtonProps = {
|
|
21
|
+
onClick?: () => any
|
|
17
22
|
children: React.ReactNode
|
|
18
23
|
} & ButtonProps
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { CardProps } from './card'
|
|
3
|
-
import './card.scss'
|
|
3
|
+
import styles from './card.module.scss'
|
|
4
4
|
|
|
5
5
|
interface Props extends CardProps {}
|
|
6
6
|
|
|
@@ -15,28 +15,20 @@ const {
|
|
|
15
15
|
} = Astro.props
|
|
16
16
|
|
|
17
17
|
const classes = [
|
|
18
|
-
|
|
18
|
+
styles.card,
|
|
19
|
+
secondary && styles.secondary,
|
|
19
20
|
className,
|
|
20
|
-
secondary && 'secondary',
|
|
21
21
|
].filter(Boolean).join(' ')
|
|
22
22
|
|
|
23
|
-
const props = {
|
|
24
|
-
class: classes
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
const Component = element
|
|
28
24
|
const Title = titleTag
|
|
29
25
|
---
|
|
30
26
|
|
|
31
|
-
<Component {
|
|
27
|
+
<Component class:list={classes} {...rest}>
|
|
32
28
|
{title && (
|
|
33
|
-
<Title class:list=
|
|
29
|
+
<Title class:list={styles.title}>{title}</Title>
|
|
34
30
|
)}
|
|
35
|
-
<div class
|
|
36
|
-
|
|
37
|
-
<div class="card-wrapper"><slot /></div>
|
|
38
|
-
) : (
|
|
39
|
-
<slot />
|
|
40
|
-
)}
|
|
31
|
+
<div class:list={[styles.body, compact && styles.compact]}>
|
|
32
|
+
<slot />
|
|
41
33
|
</div>
|
|
42
34
|
</Component>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { CardProps } from './card'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import styles from './card.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
4
6
|
|
|
5
7
|
export let element: CardProps['element'] = 'section'
|
|
6
8
|
export let title: CardProps['title'] = ''
|
|
@@ -9,24 +11,25 @@
|
|
|
9
11
|
export let className: CardProps['className'] = ''
|
|
10
12
|
export let secondary: CardProps['secondary'] = false
|
|
11
13
|
|
|
12
|
-
const classes = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]
|
|
14
|
+
const classes = classNames([
|
|
15
|
+
styles.card,
|
|
16
|
+
secondary && styles.secondary,
|
|
17
|
+
className
|
|
18
|
+
])
|
|
19
|
+
|
|
20
|
+
const bodyClasses = classNames([
|
|
21
|
+
styles.body,
|
|
22
|
+
compact && styles.compact
|
|
23
|
+
])
|
|
17
24
|
</script>
|
|
18
25
|
|
|
19
26
|
<svelte:element this={element} class={classes} {...$$restProps}>
|
|
20
27
|
{#if title}
|
|
21
|
-
<svelte:element this={titleTag} class=
|
|
28
|
+
<svelte:element this={titleTag} class={styles.title}>
|
|
22
29
|
{title}
|
|
23
30
|
</svelte:element>
|
|
24
31
|
{/if}
|
|
25
|
-
<div class=
|
|
26
|
-
|
|
27
|
-
<div class="card-wrapper"><slot /></div>
|
|
28
|
-
{:else}
|
|
29
|
-
<slot />
|
|
30
|
-
{/if}
|
|
32
|
+
<div class={bodyClasses}>
|
|
33
|
+
<slot />
|
|
31
34
|
</div>
|
|
32
35
|
</svelte:element>
|
package/components/Card/Card.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { ReactCardProps } from './card'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import styles from './card.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
4
6
|
|
|
5
7
|
const Card = ({
|
|
6
8
|
Element = 'section',
|
|
@@ -12,22 +14,24 @@ const Card = ({
|
|
|
12
14
|
children,
|
|
13
15
|
...rest
|
|
14
16
|
}: ReactCardProps) => {
|
|
15
|
-
const classes = [
|
|
16
|
-
|
|
17
|
+
const classes = classNames([
|
|
18
|
+
styles.card,
|
|
17
19
|
className,
|
|
18
|
-
secondary &&
|
|
19
|
-
]
|
|
20
|
+
secondary && styles.secondary
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
const bodyClasses = classNames([
|
|
24
|
+
styles.body,
|
|
25
|
+
compact && styles.compact
|
|
26
|
+
])
|
|
20
27
|
|
|
21
28
|
return (
|
|
22
29
|
<Element className={classes} {...rest}>
|
|
23
30
|
{title && (
|
|
24
|
-
<TitleTag className=
|
|
31
|
+
<TitleTag className={styles.title}>{title}</TitleTag>
|
|
25
32
|
)}
|
|
26
|
-
<div className={
|
|
27
|
-
{
|
|
28
|
-
? <div className="card-wrapper">{children}</div>
|
|
29
|
-
: children
|
|
30
|
-
}
|
|
33
|
+
<div className={bodyClasses}>
|
|
34
|
+
{children}
|
|
31
35
|
</div>
|
|
32
36
|
</Element>
|
|
33
37
|
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
border: 1px solid var(--w-color-primary-50);
|
|
3
|
+
border-radius: 5px;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
|
|
7
|
+
&.secondary {
|
|
8
|
+
background: var(--w-color-primary-60);
|
|
9
|
+
|
|
10
|
+
.title {
|
|
11
|
+
background: var(--w-color-primary-70);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.title {
|
|
16
|
+
padding: 20px;
|
|
17
|
+
display: block;
|
|
18
|
+
border-bottom: 1px solid var(--w-color-primary-50);
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.body {
|
|
23
|
+
padding: 20px;
|
|
24
|
+
height: 100%;
|
|
25
|
+
position: relative;
|
|
26
|
+
|
|
27
|
+
&.compact {
|
|
28
|
+
border: 20px solid var(--w-color-primary-60);
|
|
29
|
+
background: var(--w-color-primary-70);
|
|
30
|
+
padding: 40px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -4,7 +4,7 @@ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
|
4
4
|
|
|
5
5
|
import check from '../../icons/check.svg?raw'
|
|
6
6
|
|
|
7
|
-
import './checkbox.scss'
|
|
7
|
+
import styles from './checkbox.module.scss'
|
|
8
8
|
|
|
9
9
|
interface Props extends CheckboxProps {}
|
|
10
10
|
|
|
@@ -13,14 +13,14 @@ const {
|
|
|
13
13
|
label,
|
|
14
14
|
subText,
|
|
15
15
|
disabled,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
color,
|
|
17
|
+
className
|
|
18
18
|
} = Astro.props
|
|
19
19
|
|
|
20
20
|
const classes = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
styles.checkbox,
|
|
22
|
+
label && subText && styles.col,
|
|
23
|
+
className
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
const style = color
|
|
@@ -30,21 +30,21 @@ const style = color
|
|
|
30
30
|
|
|
31
31
|
<label class:list={classes} style={style}>
|
|
32
32
|
<ConditionalWrapper condition={!!(label && subText)}>
|
|
33
|
-
<div class=
|
|
33
|
+
<div class={styles.wrapper} slot="wrapper">
|
|
34
34
|
children
|
|
35
35
|
</div>
|
|
36
36
|
<input type="checkbox" checked={checked} disabled={disabled} />
|
|
37
|
-
<span class=
|
|
37
|
+
<span class={styles.check}>
|
|
38
38
|
<Fragment set:html={check} />
|
|
39
39
|
</span>
|
|
40
40
|
{label && (
|
|
41
|
-
<span class=
|
|
41
|
+
<span class={styles.label}>
|
|
42
42
|
<Fragment set:html={label} />
|
|
43
43
|
</span>
|
|
44
44
|
)}
|
|
45
45
|
</ConditionalWrapper>
|
|
46
46
|
{label && subText && (
|
|
47
|
-
<span class=
|
|
47
|
+
<span class={styles.text}>
|
|
48
48
|
<Fragment set:html={subText} />
|
|
49
49
|
</span>
|
|
50
50
|
)}
|