webcoreui 0.0.11 → 0.1.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 +42 -11
- 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.module.scss +65 -0
- 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 +51 -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} +11 -8
- 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 +86 -0
- package/components/Badge/badge.ts +8 -1
- package/components/Button/Button.astro +9 -7
- package/components/Button/Button.svelte +13 -11
- package/components/Button/Button.tsx +10 -8
- package/components/Button/button.module.scss +87 -0
- package/components/Button/button.ts +6 -2
- 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 +38 -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.module.scss +70 -0
- package/components/Checkbox/checkbox.ts +5 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +1 -1
- package/components/Icon/Icon.astro +2 -2
- 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.module.scss +79 -0
- 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 +141 -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.module.scss +70 -0
- 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.module.scss +84 -0
- 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.module.scss +45 -0
- 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} +50 -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.module.scss +82 -0
- 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} +60 -65
- package/components/Tabs/Tabs.astro +76 -76
- package/components/Tabs/Tabs.svelte +56 -54
- package/components/Tabs/Tabs.tsx +70 -69
- package/components/Tabs/tabs.module.scss +125 -0
- 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 +76 -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} +76 -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.module.scss +29 -0
- 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.module.scss +40 -0
- package/components/Toast/toast.ts +8 -6
- package/icons/moon.svg +3 -0
- package/icons/sun.svg +3 -0
- package/icons.d.ts +11 -0
- package/icons.js +9 -0
- package/index.js +3 -0
- package/package.json +5 -1
- package/react.d.ts +4 -0
- package/react.js +4 -0
- package/scss/config/color-palette.scss +23 -0
- package/scss/config/css-values.scss +44 -0
- package/scss/config/layout.scss +41 -0
- package/scss/config/mixins.scss +395 -9
- package/scss/config/typography.scss +66 -0
- package/scss/config.scss +6 -1
- package/scss/global/elements.scss +22 -2
- package/scss/global/scrollbar.scss +24 -0
- package/scss/global/theme.scss +140 -0
- package/scss/global/tooltip.scss +47 -39
- package/scss/global/utility.scss +33 -4
- package/scss/global.scss +2 -1
- package/scss/resets.scss +64 -11
- package/scss/setup.scss +25 -31
- 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 +15 -11
- package/components/Accordion/accordion.scss +0 -63
- 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
- package/components/Checkbox/checkbox.scss +0 -85
- package/components/Input/input.scss +0 -83
- package/components/Progress/progress.scss +0 -66
- package/components/Radio/radio.scss +0 -92
- package/components/Rating/rating.scss +0 -37
- package/components/Switch/switch.scss +0 -84
- package/components/Tabs/tabs.scss +0 -134
- package/components/TimelineItem/timelineitem.scss +0 -31
- package/components/Toast/toast.scss +0 -43
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
border
|
|
3
|
+
body {
|
|
4
|
+
--w-avatar-border: var(--w-color-primary-70);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.avatar {
|
|
8
|
+
@include border-radius(max);
|
|
5
9
|
|
|
6
10
|
&:not(.borderless) {
|
|
7
11
|
border: 3px solid var(--w-avatar-border);
|
|
8
12
|
}
|
|
9
13
|
}
|
|
10
14
|
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
align-items: center;
|
|
15
|
+
.group {
|
|
16
|
+
@include layout(inline-flex, v-center);
|
|
14
17
|
|
|
15
18
|
&.reverse {
|
|
16
|
-
|
|
19
|
+
@include layout(row-reverse);
|
|
17
20
|
|
|
18
21
|
img {
|
|
19
|
-
|
|
22
|
+
@include layer(fg);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
img:not(:first-child) {
|
|
@@ -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,86 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
.badge {
|
|
4
|
+
@include transition();
|
|
5
|
+
@include spacing(py-xs, px-sm);
|
|
6
|
+
@include border-radius(xs);
|
|
7
|
+
@include layout(inline-flex, v-center, xs);
|
|
8
|
+
@include typography(xs, primary-50);
|
|
9
|
+
@include border(0);
|
|
10
|
+
@include background(primary);
|
|
11
|
+
|
|
12
|
+
&.hover {
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
@include background(primary-20);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.secondary:hover {
|
|
20
|
+
@include background(primary-40);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.outline:hover {
|
|
24
|
+
@include typography(primary);
|
|
25
|
+
@include background(transparent);
|
|
26
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.flat:hover {
|
|
30
|
+
@include background(primary-40);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.info:hover {
|
|
34
|
+
@include background(info-accent);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.success:hover {
|
|
38
|
+
@include background(success-accent);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.warning:hover {
|
|
42
|
+
@include background(warning-accent);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.alert:hover {
|
|
46
|
+
@include background(alert-accent);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
&.secondary {
|
|
52
|
+
@include typography(primary);
|
|
53
|
+
@include background(primary-50);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.outline {
|
|
57
|
+
@include typography(primary-20);
|
|
58
|
+
@include background(primary-70);
|
|
59
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-20);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.flat {
|
|
63
|
+
@include typography(primary);
|
|
64
|
+
@include background(primary-70);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.info {
|
|
68
|
+
@include typography(info-fg);
|
|
69
|
+
@include background(info);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.success {
|
|
73
|
+
@include typography(success-fg);
|
|
74
|
+
@include background(success);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.warning {
|
|
78
|
+
@include typography(warning-fg);
|
|
79
|
+
@include background(warning);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.alert {
|
|
83
|
+
@include typography(alert-fg);
|
|
84
|
+
@include background(alert);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -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,21 +1,23 @@
|
|
|
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
|
|
|
7
9
|
const {
|
|
8
10
|
theme,
|
|
9
|
-
bold,
|
|
10
11
|
href,
|
|
12
|
+
className,
|
|
11
13
|
...rest
|
|
12
14
|
} = Astro.props
|
|
13
15
|
|
|
14
|
-
const classes = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
]
|
|
16
|
+
const classes = classNames([
|
|
17
|
+
styles.button,
|
|
18
|
+
theme && styles[theme],
|
|
19
|
+
className
|
|
20
|
+
])
|
|
19
21
|
---
|
|
20
22
|
|
|
21
23
|
{href ? (
|
|
@@ -1,17 +1,19 @@
|
|
|
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 href: SvelteButtonProps['href'] = ''
|
|
9
|
+
export let className: SvelteButtonProps['className'] = ''
|
|
10
|
+
export let onClick: SvelteButtonProps['onClick'] = () => {}
|
|
11
|
+
|
|
12
|
+
const classes = classNames([
|
|
13
|
+
styles.button,
|
|
14
|
+
theme && styles[theme],
|
|
15
|
+
className
|
|
16
|
+
])
|
|
15
17
|
</script>
|
|
16
18
|
|
|
17
19
|
|
|
@@ -1,20 +1,22 @@
|
|
|
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
|
-
bold,
|
|
8
9
|
href,
|
|
9
|
-
|
|
10
|
+
className,
|
|
10
11
|
onClick,
|
|
12
|
+
children,
|
|
11
13
|
...rest
|
|
12
14
|
}: ReactButtonProps) => {
|
|
13
|
-
const classes = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
]
|
|
15
|
+
const classes = classNames([
|
|
16
|
+
styles.button,
|
|
17
|
+
theme && styles[theme],
|
|
18
|
+
className
|
|
19
|
+
])
|
|
18
20
|
|
|
19
21
|
if (href) {
|
|
20
22
|
return (
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
.button {
|
|
4
|
+
@include layout(inline-flex, v-center, xs);
|
|
5
|
+
@include typography(md, primary-50, none);
|
|
6
|
+
@include spacing(py-sm, px-md);
|
|
7
|
+
@include border-radius(xs);
|
|
8
|
+
@include border(0);
|
|
9
|
+
@include transition();
|
|
10
|
+
@include background(primary);
|
|
11
|
+
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
|
|
14
|
+
&[disabled] {
|
|
15
|
+
cursor: no-drop;
|
|
16
|
+
@include background(primary-20);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
@include background(primary-20);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.secondary {
|
|
24
|
+
@include typography(primary);
|
|
25
|
+
@include background(primary-50);
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
@include background(primary-40);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.outline {
|
|
33
|
+
@include typography(primary-20);
|
|
34
|
+
@include background(transparent);
|
|
35
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary-20);
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
@include typography(primary);
|
|
39
|
+
box-shadow: inset 0px 0px 0px 1px var(--w-color-primary);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.flat {
|
|
44
|
+
@include typography(primary);
|
|
45
|
+
@include background(transparent);
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
@include background(primary-40);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.info {
|
|
53
|
+
@include typography(info-fg);
|
|
54
|
+
@include background(info);
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
@include background(info-accent);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.success {
|
|
62
|
+
@include typography(success-fg);
|
|
63
|
+
@include background(success);
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
@include background(success-accent);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.warning {
|
|
71
|
+
@include typography(warning-fg);
|
|
72
|
+
@include background(warning);
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
@include background(warning-accent);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.alert {
|
|
80
|
+
@include typography(alert-fg);
|
|
81
|
+
@include background(alert);
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
@include background(alert-accent);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -7,12 +7,16 @@ export type ButtonProps = {
|
|
|
7
7
|
| 'warning'
|
|
8
8
|
| 'alert'
|
|
9
9
|
| null
|
|
10
|
-
bold?: boolean
|
|
11
10
|
href?: string
|
|
12
|
-
|
|
11
|
+
className?: string
|
|
13
12
|
[key: string]: any
|
|
14
13
|
}
|
|
15
14
|
|
|
15
|
+
export type SvelteButtonProps = {
|
|
16
|
+
onClick?: () => any
|
|
17
|
+
} & ButtonProps
|
|
18
|
+
|
|
16
19
|
export type ReactButtonProps = {
|
|
20
|
+
onClick?: () => any
|
|
17
21
|
children: React.ReactNode
|
|
18
22
|
} & 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,38 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
.card {
|
|
4
|
+
@include border(primary-50);
|
|
5
|
+
@include border-radius(md);
|
|
6
|
+
@include layout(flex, column);
|
|
7
|
+
|
|
8
|
+
&.secondary {
|
|
9
|
+
@include background(primary-60);
|
|
10
|
+
|
|
11
|
+
.title {
|
|
12
|
+
@include background(primary-70);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.title {
|
|
17
|
+
@include spacing(p-default);
|
|
18
|
+
@include border(primary-50, bottom);
|
|
19
|
+
@include typography(md);
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.body {
|
|
24
|
+
@include spacing(p-default);
|
|
25
|
+
@include size('h100%');
|
|
26
|
+
@include position(relative);
|
|
27
|
+
|
|
28
|
+
&.compact {
|
|
29
|
+
@include border(20px, primary-60);
|
|
30
|
+
@include spacing(p-3xl);
|
|
31
|
+
@include background(primary-70);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
a.card {
|
|
37
|
+
@include typography(none);
|
|
38
|
+
}
|