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,40 +1,42 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { ProgressProps } from './progress'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
1
|
+
---
|
|
2
|
+
import type { ProgressProps } from './progress'
|
|
3
|
+
|
|
4
|
+
import styles from './progress.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
interface Props extends ProgressProps {}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
value,
|
|
11
|
+
size,
|
|
12
|
+
label,
|
|
13
|
+
color,
|
|
14
|
+
background,
|
|
15
|
+
square,
|
|
16
|
+
striped,
|
|
17
|
+
stripeLight,
|
|
18
|
+
stripeDark,
|
|
19
|
+
className
|
|
20
|
+
} = Astro.props
|
|
21
|
+
|
|
22
|
+
const classes = [
|
|
23
|
+
styles['w-progress'],
|
|
24
|
+
size && styles[size],
|
|
25
|
+
striped && styles.striped,
|
|
26
|
+
square && styles.square,
|
|
27
|
+
className
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
const styleVariables = classNames([
|
|
31
|
+
color && `--w-progress-color: ${color};`,
|
|
32
|
+
background && `--w-progress-background: ${background};`,
|
|
33
|
+
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
34
|
+
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
35
|
+
])
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<div class:list={classes} style={styleVariables}>
|
|
39
|
+
<div class={styles.progress} style={`--w-progress-width: ${value}%;`}>
|
|
40
|
+
{label && `${value}%`}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ProgressProps } from './progress'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ProgressProps } from './progress'
|
|
3
|
+
|
|
4
|
+
import styles from './progress.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
export let value: ProgressProps['value'] = 0
|
|
8
|
+
export let size: ProgressProps['size'] = null
|
|
9
|
+
export let label: ProgressProps['label'] = false
|
|
10
|
+
export let color: ProgressProps['color'] = ''
|
|
11
|
+
export let background: ProgressProps['background'] = ''
|
|
12
|
+
export let square: ProgressProps['square'] = false
|
|
13
|
+
export let striped: ProgressProps['striped'] = false
|
|
14
|
+
export let stripeLight: ProgressProps['stripeLight'] = ''
|
|
15
|
+
export let stripeDark: ProgressProps['stripeDark'] = ''
|
|
16
|
+
export let className: ProgressProps['className'] = ''
|
|
17
|
+
|
|
18
|
+
const classes = classNames([
|
|
19
|
+
styles['w-progress'],
|
|
20
|
+
size && styles[size],
|
|
21
|
+
striped && styles.striped,
|
|
22
|
+
square && styles.square,
|
|
23
|
+
className
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
const styleVariables = classNames([
|
|
27
|
+
color && `--w-progress-color: ${color};`,
|
|
28
|
+
background && `--w-progress-background: ${background};`,
|
|
29
|
+
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
30
|
+
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
31
|
+
])
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div class={classes} style={styleVariables || null}>
|
|
35
|
+
<div class={styles.progress} style={`--w-progress-width: ${value}%;`}>
|
|
36
|
+
{#if label}
|
|
37
|
+
{`${value}%`}
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { ProgressProps } from './progress'
|
|
3
|
-
|
|
4
|
-
import './progress.scss'
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ProgressProps } from './progress'
|
|
3
|
+
|
|
4
|
+
import styles from './progress.module.scss'
|
|
5
|
+
import { classNames } from '../../utils/classNames'
|
|
6
|
+
|
|
7
|
+
const Progress = ({
|
|
8
|
+
value,
|
|
9
|
+
size,
|
|
10
|
+
label,
|
|
11
|
+
color,
|
|
12
|
+
background,
|
|
13
|
+
square,
|
|
14
|
+
striped,
|
|
15
|
+
stripeLight,
|
|
16
|
+
stripeDark,
|
|
17
|
+
className
|
|
18
|
+
}: ProgressProps) => {
|
|
19
|
+
const classes = classNames([
|
|
20
|
+
styles['w-progress'],
|
|
21
|
+
size && styles[size],
|
|
22
|
+
striped && styles.striped,
|
|
23
|
+
square && styles.square,
|
|
24
|
+
className
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
const styleVariables = {
|
|
28
|
+
...(color && { '--w-progress-color': color }),
|
|
29
|
+
...(background && { '--w-progress-background': background }),
|
|
30
|
+
...(stripeLight && { '--w-progress-stripe-light': stripeLight }),
|
|
31
|
+
...(stripeDark && { '--w-progress-stripe-dark': stripeDark }),
|
|
32
|
+
} as React.CSSProperties
|
|
33
|
+
|
|
34
|
+
const percent = {
|
|
35
|
+
'--w-progress-width': `${value}%`
|
|
36
|
+
} as React.CSSProperties
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={classes} style={styleVariables}>
|
|
40
|
+
<div className={styles.progress} style={percent}>
|
|
41
|
+
{label && `${value}%`}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default Progress
|
|
48
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
body {
|
|
4
|
+
--w-progress-color: var(--w-color-primary);
|
|
5
|
+
--w-progress-background: var(--w-color-primary-50);
|
|
6
|
+
--w-progress-stripe-light: var(--w-color-primary);
|
|
7
|
+
--w-progress-stripe-dark: var(--w-color-primary-10);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.w-progress {
|
|
11
|
+
@include size('w100%', h10px);
|
|
12
|
+
@include border-radius(xl);
|
|
13
|
+
@include visibility(hidden);
|
|
14
|
+
@include typography(bold, xxs);
|
|
15
|
+
@include background(var(--w-progress-background));
|
|
16
|
+
|
|
17
|
+
color: var(--w-progress-background);
|
|
18
|
+
|
|
19
|
+
&.medium {
|
|
20
|
+
@include size(h15px);
|
|
21
|
+
@include typography(xs);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.large {
|
|
25
|
+
@include size(h20px);
|
|
26
|
+
@include typography(sm);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.square {
|
|
30
|
+
@include border-radius(sm);
|
|
31
|
+
|
|
32
|
+
.progress {
|
|
33
|
+
@include border-radius(sm);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.striped {
|
|
38
|
+
.progress {
|
|
39
|
+
background-size: 10px 10px;
|
|
40
|
+
background-image: linear-gradient(
|
|
41
|
+
-45deg,
|
|
42
|
+
var(--w-progress-stripe-light) 25%,
|
|
43
|
+
var(--w-progress-stripe-dark) 25%,
|
|
44
|
+
var(--w-progress-stripe-dark) 50%,
|
|
45
|
+
var(--w-progress-stripe-light) 50%,
|
|
46
|
+
var(--w-progress-stripe-light) 75%,
|
|
47
|
+
var(--w-progress-stripe-dark) 75%,
|
|
48
|
+
var(--w-progress-stripe-dark)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.medium .progress {
|
|
53
|
+
background-size: 15px 15px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.large .progress {
|
|
57
|
+
background-size: 20px 20px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.progress {
|
|
62
|
+
@include transition(width);
|
|
63
|
+
@include size('h100%');
|
|
64
|
+
@include border-radius(xl);
|
|
65
|
+
@include layout(flex, center);
|
|
66
|
+
@include background(var(--w-progress-color));
|
|
67
|
+
|
|
68
|
+
width: var(--w-progress-width);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { RadioProps } from './radio'
|
|
3
|
-
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
4
|
-
|
|
5
|
-
import './radio.scss'
|
|
6
|
-
|
|
7
|
-
interface Props extends RadioProps {}
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
name,
|
|
11
|
-
items,
|
|
12
|
-
color,
|
|
13
|
-
inline,
|
|
14
|
-
className
|
|
15
|
-
} = Astro.props
|
|
16
|
-
|
|
17
|
-
const classes = [
|
|
18
|
-
|
|
19
|
-
inline &&
|
|
20
|
-
className
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
const style = color
|
|
24
|
-
? `--w-radio-color: ${color};`
|
|
25
|
-
: null
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
<div class:list={classes} style={style}>
|
|
29
|
-
{items.map(item => (
|
|
30
|
-
<label class:list={[
|
|
31
|
-
item.subText &&
|
|
32
|
-
item.disabled &&
|
|
33
|
-
]}>
|
|
34
|
-
<ConditionalWrapper condition={!!(item.subText)}>
|
|
35
|
-
<div class=
|
|
36
|
-
children
|
|
37
|
-
</div>
|
|
38
|
-
<input
|
|
39
|
-
type="radio"
|
|
40
|
-
name={name}
|
|
41
|
-
value={item.value}
|
|
42
|
-
checked={item.selected}
|
|
43
|
-
disabled={item.disabled}
|
|
44
|
-
/>
|
|
45
|
-
<span class=
|
|
46
|
-
<span class=
|
|
47
|
-
<Fragment set:html={item.label} />
|
|
48
|
-
</span>
|
|
49
|
-
</ConditionalWrapper>
|
|
50
|
-
{item.subText && (
|
|
51
|
-
<span class=
|
|
52
|
-
<Fragment set:html={item.subText} />
|
|
53
|
-
</span>
|
|
54
|
-
)}
|
|
55
|
-
</label>
|
|
56
|
-
))}
|
|
57
|
-
</div>
|
|
1
|
+
---
|
|
2
|
+
import type { RadioProps } from './radio'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
4
|
+
|
|
5
|
+
import styles from './radio.module.scss'
|
|
6
|
+
|
|
7
|
+
interface Props extends RadioProps {}
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
items,
|
|
12
|
+
color,
|
|
13
|
+
inline,
|
|
14
|
+
className
|
|
15
|
+
} = Astro.props
|
|
16
|
+
|
|
17
|
+
const classes = [
|
|
18
|
+
styles.radio,
|
|
19
|
+
inline && styles.inline,
|
|
20
|
+
className
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const style = color
|
|
24
|
+
? `--w-radio-color: ${color};`
|
|
25
|
+
: null
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
<div class:list={classes} style={style}>
|
|
29
|
+
{items.map(item => (
|
|
30
|
+
<label class:list={[
|
|
31
|
+
item.subText && styles.col,
|
|
32
|
+
item.disabled && styles.disabled
|
|
33
|
+
]}>
|
|
34
|
+
<ConditionalWrapper condition={!!(item.subText)}>
|
|
35
|
+
<div class={styles.wrapper} slot="wrapper">
|
|
36
|
+
children
|
|
37
|
+
</div>
|
|
38
|
+
<input
|
|
39
|
+
type="radio"
|
|
40
|
+
name={name}
|
|
41
|
+
value={item.value}
|
|
42
|
+
checked={item.selected}
|
|
43
|
+
disabled={item.disabled}
|
|
44
|
+
/>
|
|
45
|
+
<span class={styles.icon} />
|
|
46
|
+
<span class={styles.label}>
|
|
47
|
+
<Fragment set:html={item.label} />
|
|
48
|
+
</span>
|
|
49
|
+
</ConditionalWrapper>
|
|
50
|
+
{item.subText && (
|
|
51
|
+
<span class={styles.subtext}>
|
|
52
|
+
<Fragment set:html={item.subText} />
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</label>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
-
|
|
5
|
-
import './radio.scss'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
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
|
-
</
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteRadioProps } from './radio'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
+
|
|
5
|
+
import styles from './radio.module.scss'
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
export let name: SvelteRadioProps['name'] = ''
|
|
9
|
+
export let items: SvelteRadioProps['items'] = []
|
|
10
|
+
export let color: SvelteRadioProps['color'] = ''
|
|
11
|
+
export let inline: SvelteRadioProps['inline'] = false
|
|
12
|
+
export let className: SvelteRadioProps['className'] = ''
|
|
13
|
+
export let onChange: SvelteRadioProps['onChange'] = () => {}
|
|
14
|
+
|
|
15
|
+
const classes = classNames([
|
|
16
|
+
styles.radio,
|
|
17
|
+
inline && styles.inline,
|
|
18
|
+
className
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
const style = color
|
|
22
|
+
? `--w-radio-color: ${color};`
|
|
23
|
+
: null
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div class={classes} style={style}>
|
|
27
|
+
{#each items as item}
|
|
28
|
+
<label class={[
|
|
29
|
+
item.subText && styles.col,
|
|
30
|
+
item.disabled && styles.disabled
|
|
31
|
+
].filter(Boolean).join(' ')}
|
|
32
|
+
>
|
|
33
|
+
<ConditionalWrapper
|
|
34
|
+
condition={!!(item.subText)}
|
|
35
|
+
element="div"
|
|
36
|
+
class={styles.wrapper}
|
|
37
|
+
>
|
|
38
|
+
<input
|
|
39
|
+
type="radio"
|
|
40
|
+
name={name}
|
|
41
|
+
value={item.value}
|
|
42
|
+
checked={item.selected}
|
|
43
|
+
disabled={item.disabled}
|
|
44
|
+
on:change={onChange}
|
|
45
|
+
/>
|
|
46
|
+
<span class={styles.icon} />
|
|
47
|
+
<span class={styles.label}>
|
|
48
|
+
{@html item.label}
|
|
49
|
+
</span>
|
|
50
|
+
</ConditionalWrapper>
|
|
51
|
+
{#if item.subText}
|
|
52
|
+
<span class={styles.subtext}>
|
|
53
|
+
{@html item.subText}
|
|
54
|
+
</span>
|
|
55
|
+
{/if}
|
|
56
|
+
</label>
|
|
57
|
+
{/each}
|
|
58
|
+
</div>
|