webcoreui 0.0.10 → 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 +35 -7
- package/astro.d.ts +8 -0
- package/astro.js +8 -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 -0
- package/components/Input/Input.svelte +52 -0
- package/components/Input/Input.tsx +59 -0
- package/components/Input/input.module.scss +87 -0
- package/components/Input/input.ts +50 -0
- 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 -0
- package/components/Table/Table.svelte +56 -0
- package/components/Table/Table.tsx +64 -0
- package/components/Table/table.module.scss +64 -0
- package/components/Table/table.ts +10 -0
- 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 +8 -0
- package/react.js +8 -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 +18 -10
- package/svelte.js +8 -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,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
|
+
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
@import '../../scss/config.scss';
|
|
2
|
-
|
|
3
|
-
.w-progress {
|
|
4
|
-
width: 100%;
|
|
5
|
-
height: 10px;
|
|
6
|
-
background: var(--w-progress-background);
|
|
7
|
-
border-radius: 20px;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
color: var(--w-progress-background);
|
|
10
|
-
font-family: Bold;
|
|
11
|
-
font-size: 10px;
|
|
12
|
-
|
|
13
|
-
&.medium {
|
|
14
|
-
height: 15px;
|
|
15
|
-
font-size: 12px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.large {
|
|
19
|
-
height: 20px;
|
|
20
|
-
font-size: 14px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&.square {
|
|
24
|
-
border-radius: 2px;
|
|
25
|
-
|
|
26
|
-
.progress {
|
|
27
|
-
border-radius: 2px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&.striped {
|
|
32
|
-
|
|
33
|
-
.progress {
|
|
34
|
-
background-size: 10px 10px;
|
|
35
|
-
background-image: linear-gradient(
|
|
36
|
-
-45deg,
|
|
37
|
-
var(--w-progress-stripe-light) 25%,
|
|
38
|
-
var(--w-progress-stripe-dark) 25%,
|
|
39
|
-
var(--w-progress-stripe-dark) 50%,
|
|
40
|
-
var(--w-progress-stripe-light) 50%,
|
|
41
|
-
var(--w-progress-stripe-light) 75%,
|
|
42
|
-
var(--w-progress-stripe-dark) 75%,
|
|
43
|
-
var(--w-progress-stripe-dark)
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.medium .progress {
|
|
48
|
-
background-size: 15px 15px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&.large .progress {
|
|
52
|
-
background-size: 20px 20px;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.progress {
|
|
57
|
-
@include Transition(width);
|
|
58
|
-
width: var(--w-progress-width);
|
|
59
|
-
height: 100%;
|
|
60
|
-
background: var(--w-progress-color);
|
|
61
|
-
border-radius: 20px;
|
|
62
|
-
display: flex;
|
|
63
|
-
align-items: center;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-progress {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 10px;
|
|
6
|
+
background: var(--w-progress-background);
|
|
7
|
+
border-radius: 20px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
color: var(--w-progress-background);
|
|
10
|
+
font-family: Bold;
|
|
11
|
+
font-size: 10px;
|
|
12
|
+
|
|
13
|
+
&.medium {
|
|
14
|
+
height: 15px;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.large {
|
|
19
|
+
height: 20px;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.square {
|
|
24
|
+
border-radius: 2px;
|
|
25
|
+
|
|
26
|
+
.progress {
|
|
27
|
+
border-radius: 2px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.striped {
|
|
32
|
+
|
|
33
|
+
.progress {
|
|
34
|
+
background-size: 10px 10px;
|
|
35
|
+
background-image: linear-gradient(
|
|
36
|
+
-45deg,
|
|
37
|
+
var(--w-progress-stripe-light) 25%,
|
|
38
|
+
var(--w-progress-stripe-dark) 25%,
|
|
39
|
+
var(--w-progress-stripe-dark) 50%,
|
|
40
|
+
var(--w-progress-stripe-light) 50%,
|
|
41
|
+
var(--w-progress-stripe-light) 75%,
|
|
42
|
+
var(--w-progress-stripe-dark) 75%,
|
|
43
|
+
var(--w-progress-stripe-dark)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.medium .progress {
|
|
48
|
+
background-size: 15px 15px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.large .progress {
|
|
52
|
+
background-size: 20px 20px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.progress {
|
|
57
|
+
@include Transition(width);
|
|
58
|
+
width: var(--w-progress-width);
|
|
59
|
+
height: 100%;
|
|
60
|
+
background: var(--w-progress-color);
|
|
61
|
+
border-radius: 20px;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -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>
|
|
@@ -1,68 +1,69 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import type { ReactRadioProps } from './radio'
|
|
3
|
-
|
|
4
|
-
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
|
-
|
|
6
|
-
import './radio.scss'
|
|
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
|
-
item.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<span
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactRadioProps } from './radio'
|
|
3
|
+
|
|
4
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
5
|
+
|
|
6
|
+
import styles from './radio.module.scss'
|
|
7
|
+
import { classNames } from '../../utils/classNames'
|
|
8
|
+
|
|
9
|
+
const Radio = ({
|
|
10
|
+
name,
|
|
11
|
+
items,
|
|
12
|
+
color,
|
|
13
|
+
inline,
|
|
14
|
+
className,
|
|
15
|
+
onChange
|
|
16
|
+
}: ReactRadioProps) => {
|
|
17
|
+
const classes = classNames([
|
|
18
|
+
styles.radio,
|
|
19
|
+
inline && styles.inline,
|
|
20
|
+
className
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
const style = color
|
|
24
|
+
? { '--w-radio-color': color } as React.CSSProperties
|
|
25
|
+
: undefined
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className={classes} style={style}>
|
|
29
|
+
{items.map((item, index) => (
|
|
30
|
+
<label className={[
|
|
31
|
+
item.subText && styles.col,
|
|
32
|
+
item.disabled && styles.disabled
|
|
33
|
+
].filter(Boolean).join(' ')} key={index}>
|
|
34
|
+
<ConditionalWrapper
|
|
35
|
+
condition={!!(item.subText)}
|
|
36
|
+
wrapper={children => (
|
|
37
|
+
<div className={styles.wrapper}>
|
|
38
|
+
{children}
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
<input
|
|
43
|
+
type="radio"
|
|
44
|
+
name={name}
|
|
45
|
+
value={item.value}
|
|
46
|
+
defaultChecked={item.selected}
|
|
47
|
+
disabled={item.disabled}
|
|
48
|
+
onChange={onChange}
|
|
49
|
+
/>
|
|
50
|
+
<span className={styles.icon} />
|
|
51
|
+
<span
|
|
52
|
+
className={styles.label}
|
|
53
|
+
dangerouslySetInnerHTML={{ __html: item.label }}
|
|
54
|
+
/>
|
|
55
|
+
</ConditionalWrapper>
|
|
56
|
+
{item.subText && (
|
|
57
|
+
<span
|
|
58
|
+
className={styles.subtext}
|
|
59
|
+
dangerouslySetInnerHTML={{ __html: item.subText }}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
</label>
|
|
63
|
+
))}
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default Radio
|
|
69
|
+
|