webcoreui 0.0.8 → 0.0.10
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 +26 -11
- package/astro.d.ts +31 -11
- package/astro.js +23 -1
- package/components/Alert/Alert.astro +3 -5
- package/components/Alert/Alert.svelte +3 -5
- package/components/Alert/Alert.tsx +3 -3
- package/components/Alert/alert.scss +1 -0
- package/components/Alert/alert.ts +6 -1
- package/components/Avatar/Avatar.astro +51 -0
- package/components/Avatar/Avatar.svelte +48 -0
- package/components/Avatar/Avatar.tsx +64 -0
- package/components/Avatar/avatar.scss +35 -0
- package/components/Avatar/avatar.ts +10 -0
- package/components/Badge/Badge.astro +4 -7
- package/components/Badge/Badge.svelte +2 -5
- package/components/Badge/Badge.tsx +3 -3
- package/components/Badge/badge.ts +4 -1
- package/components/Button/Button.astro +1 -4
- package/components/Button/Button.svelte +1 -4
- package/components/Button/Button.tsx +2 -2
- package/components/Button/button.scss +0 -1
- package/components/Button/button.ts +4 -0
- package/components/Card/Card.astro +2 -5
- package/components/Card/Card.svelte +1 -4
- package/components/Card/Card.tsx +2 -2
- package/components/Card/card.scss +1 -0
- package/components/Card/card.ts +7 -0
- package/components/Checkbox/Checkbox.astro +51 -0
- package/components/Checkbox/Checkbox.svelte +52 -0
- package/components/Checkbox/Checkbox.tsx +65 -0
- package/components/Checkbox/checkbox.scss +85 -0
- package/components/Checkbox/checkbox.ts +12 -0
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +2 -8
- package/components/ConditionalWrapper/conditionalwrapper.ts +5 -0
- package/components/Progress/Progress.astro +40 -0
- package/components/Progress/Progress.svelte +38 -0
- package/components/Progress/Progress.tsx +47 -0
- package/components/Progress/progress.scss +66 -0
- package/components/Progress/progress.ts +12 -0
- package/components/Radio/Radio.astro +57 -0
- package/components/Radio/Radio.svelte +56 -0
- package/components/Radio/Radio.tsx +68 -0
- package/components/Radio/radio.scss +92 -0
- package/components/Radio/radio.ts +17 -0
- package/components/Rating/Rating.astro +66 -0
- package/components/Rating/Rating.svelte +70 -0
- package/components/Rating/Rating.tsx +67 -0
- package/components/Rating/rating.scss +37 -0
- package/components/Rating/rating.ts +16 -0
- package/components/Spinner/Spinner.astro +42 -0
- package/components/Spinner/Spinner.svelte +38 -0
- package/components/Spinner/Spinner.tsx +44 -0
- package/components/Spinner/spinner.scss +41 -0
- package/components/Spinner/spinner.ts +7 -0
- package/components/Switch/Switch.astro +38 -0
- package/components/Switch/Switch.svelte +42 -0
- package/components/Switch/Switch.tsx +46 -0
- package/components/Switch/switch.scss +84 -0
- package/components/Switch/switch.ts +15 -0
- package/components/Tabs/Tabs.astro +76 -0
- package/components/Tabs/Tabs.svelte +54 -0
- package/components/Tabs/Tabs.tsx +69 -0
- package/components/Tabs/tabs.scss +134 -0
- package/components/Tabs/tabs.ts +16 -0
- package/components/Timeline/Timeline.astro +34 -0
- package/components/Timeline/Timeline.svelte +30 -0
- package/components/Timeline/Timeline.tsx +37 -0
- package/components/Timeline/timeline.scss +71 -0
- package/components/Timeline/timeline.ts +61 -0
- package/components/TimelineItem/TimelineItem.astro +26 -0
- package/components/TimelineItem/TimelineItem.svelte +22 -0
- package/components/TimelineItem/TimelineItem.tsx +32 -0
- package/components/TimelineItem/timelineitem.scss +31 -0
- package/components/TimelineItem/timelineitem.ts +5 -0
- package/components/Toast/Toast.astro +30 -0
- package/components/Toast/Toast.svelte +21 -0
- package/components/Toast/Toast.tsx +28 -0
- package/components/Toast/toast.scss +43 -0
- package/components/Toast/toast.ts +11 -0
- package/icons/check.svg +1 -2
- package/icons/circle-check.svg +4 -0
- package/index.js +1 -0
- package/package.json +5 -2
- package/react.d.ts +38 -17
- package/react.js +23 -1
- package/scss/global/tooltip.scss +133 -0
- package/scss/global/utility.scss +17 -0
- package/scss/global.scss +1 -0
- package/scss/resets.scss +4 -0
- package/scss/setup.scss +31 -1
- package/svelte.d.ts +31 -11
- package/svelte.js +23 -1
- package/utils/toast.ts +65 -0
package/components/Card/card.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export type CardProps = {
|
|
2
2
|
element?: string
|
|
3
3
|
title?: string
|
|
4
|
+
titleTag?: string
|
|
4
5
|
compact?: boolean
|
|
5
6
|
className?: string
|
|
6
7
|
secondary?: boolean
|
|
7
8
|
[key: string]: any
|
|
8
9
|
}
|
|
10
|
+
|
|
11
|
+
export type ReactCardProps = {
|
|
12
|
+
Element?: keyof JSX.IntrinsicElements
|
|
13
|
+
TitleTag?: keyof JSX.IntrinsicElements
|
|
14
|
+
children: React.ReactNode
|
|
15
|
+
} & Omit<CardProps, 'titleTag' | 'element'>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CheckboxProps } from './checkbox'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.astro'
|
|
4
|
+
|
|
5
|
+
import check from '../../icons/check.svg?raw'
|
|
6
|
+
|
|
7
|
+
import './checkbox.scss'
|
|
8
|
+
|
|
9
|
+
interface Props extends CheckboxProps {}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
checked,
|
|
13
|
+
label,
|
|
14
|
+
subText,
|
|
15
|
+
disabled,
|
|
16
|
+
boxed,
|
|
17
|
+
color
|
|
18
|
+
} = Astro.props
|
|
19
|
+
|
|
20
|
+
const classes = [
|
|
21
|
+
'w-checkbox',
|
|
22
|
+
boxed && 'boxed',
|
|
23
|
+
label && subText && 'col'
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
const style = color
|
|
27
|
+
? `--w-checkbox-color: ${color};`
|
|
28
|
+
: null
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<label class:list={classes} style={style}>
|
|
32
|
+
<ConditionalWrapper condition={!!(label && subText)}>
|
|
33
|
+
<div class="checkbox-wrapper" slot="wrapper">
|
|
34
|
+
children
|
|
35
|
+
</div>
|
|
36
|
+
<input type="checkbox" checked={checked} disabled={disabled} />
|
|
37
|
+
<span class="check">
|
|
38
|
+
<Fragment set:html={check} />
|
|
39
|
+
</span>
|
|
40
|
+
{label && (
|
|
41
|
+
<span class="label">
|
|
42
|
+
<Fragment set:html={label} />
|
|
43
|
+
</span>
|
|
44
|
+
)}
|
|
45
|
+
</ConditionalWrapper>
|
|
46
|
+
{label && subText && (
|
|
47
|
+
<span class="sub-text">
|
|
48
|
+
<Fragment set:html={subText} />
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
</label>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CheckboxProps } from './checkbox'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
+
|
|
5
|
+
import check from '../../icons/check.svg?raw'
|
|
6
|
+
|
|
7
|
+
import './checkbox.scss'
|
|
8
|
+
|
|
9
|
+
export let checked: CheckboxProps['checked'] = false
|
|
10
|
+
export let label: CheckboxProps['label'] = ''
|
|
11
|
+
export let subText: CheckboxProps['subText'] = ''
|
|
12
|
+
export let disabled: CheckboxProps['disabled'] = false
|
|
13
|
+
export let boxed: CheckboxProps['boxed'] = false
|
|
14
|
+
export let color: CheckboxProps['color'] = ''
|
|
15
|
+
export let onClick: () => any = () => {}
|
|
16
|
+
|
|
17
|
+
const classes = [
|
|
18
|
+
'w-checkbox',
|
|
19
|
+
boxed && 'boxed',
|
|
20
|
+
label && subText && 'col'
|
|
21
|
+
].filter(Boolean).join(' ')
|
|
22
|
+
|
|
23
|
+
const style = color
|
|
24
|
+
? `--w-checkbox-color: ${color};`
|
|
25
|
+
: null
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<label class={classes} style={style}>
|
|
29
|
+
<ConditionalWrapper
|
|
30
|
+
condition={!!(label && subText)}
|
|
31
|
+
element="div"
|
|
32
|
+
class="checkbox-wrapper"
|
|
33
|
+
>
|
|
34
|
+
<input
|
|
35
|
+
type="checkbox"
|
|
36
|
+
checked={checked}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
on:click={onClick}
|
|
39
|
+
/>
|
|
40
|
+
<span class="check">
|
|
41
|
+
{@html check}
|
|
42
|
+
</span>
|
|
43
|
+
{#if label}
|
|
44
|
+
<span class="label">
|
|
45
|
+
{@html label}
|
|
46
|
+
</span>
|
|
47
|
+
{/if}
|
|
48
|
+
</ConditionalWrapper>
|
|
49
|
+
{#if label && subText}
|
|
50
|
+
<span class="sub-text">{@html subText}</span>
|
|
51
|
+
{/if}
|
|
52
|
+
</label>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ReactCheckboxProps } from './checkbox'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
4
|
+
|
|
5
|
+
import check from '../../icons/check.svg?raw'
|
|
6
|
+
|
|
7
|
+
import './checkbox.scss'
|
|
8
|
+
|
|
9
|
+
const Checkbox = ({
|
|
10
|
+
checked,
|
|
11
|
+
label,
|
|
12
|
+
subText,
|
|
13
|
+
disabled,
|
|
14
|
+
boxed,
|
|
15
|
+
color,
|
|
16
|
+
onClick
|
|
17
|
+
}: ReactCheckboxProps) => {
|
|
18
|
+
const classes = [
|
|
19
|
+
'w-checkbox',
|
|
20
|
+
boxed && 'boxed',
|
|
21
|
+
label && subText && 'col'
|
|
22
|
+
].filter(Boolean).join(' ')
|
|
23
|
+
|
|
24
|
+
const style = color
|
|
25
|
+
? { '--w-checkbox-color': color } as React.CSSProperties
|
|
26
|
+
: undefined
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<label className={classes} style={style}>
|
|
30
|
+
<ConditionalWrapper
|
|
31
|
+
condition={!!(label && subText)}
|
|
32
|
+
wrapper={children => (
|
|
33
|
+
<div className="checkbox-wrapper">
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
<input
|
|
39
|
+
type="checkbox"
|
|
40
|
+
defaultChecked={checked}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
onClick={onClick}
|
|
43
|
+
/>
|
|
44
|
+
<span
|
|
45
|
+
className="check"
|
|
46
|
+
dangerouslySetInnerHTML={{ __html: check }}
|
|
47
|
+
/>
|
|
48
|
+
{label && (
|
|
49
|
+
<span
|
|
50
|
+
className="label"
|
|
51
|
+
dangerouslySetInnerHTML={{ __html: label }}
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
</ConditionalWrapper>
|
|
55
|
+
{label && subText && (
|
|
56
|
+
<span
|
|
57
|
+
className="sub-text"
|
|
58
|
+
dangerouslySetInnerHTML={{ __html: subText }}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
</label>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default Checkbox
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@import '../../scss/config.scss';
|
|
2
|
+
|
|
3
|
+
.w-checkbox {
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 10px;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
|
|
10
|
+
&.col {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
gap: 5px;
|
|
15
|
+
|
|
16
|
+
.checkbox-wrapper {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 10px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.boxed {
|
|
24
|
+
border: 1px solid #252525;
|
|
25
|
+
border-radius: 5px;
|
|
26
|
+
padding: 20px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input {
|
|
30
|
+
display: none;
|
|
31
|
+
|
|
32
|
+
&:checked + span {
|
|
33
|
+
background-color: var(--w-checkbox-color);
|
|
34
|
+
|
|
35
|
+
svg {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 50%;
|
|
38
|
+
left: 50%;
|
|
39
|
+
transform: translate(-50%, -50%);
|
|
40
|
+
display: block;
|
|
41
|
+
color: #252525;
|
|
42
|
+
width: 10px;
|
|
43
|
+
height: 10px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:disabled + span {
|
|
48
|
+
background-color: #333;
|
|
49
|
+
border-color: #333;
|
|
50
|
+
cursor: no-drop;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
a {
|
|
55
|
+
text-decoration: underline;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.check {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
width: 15px;
|
|
61
|
+
height: 15px;
|
|
62
|
+
border: 1px solid var(--w-checkbox-color);
|
|
63
|
+
border-radius: 2px;
|
|
64
|
+
position: relative;
|
|
65
|
+
|
|
66
|
+
svg {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.sub-text {
|
|
72
|
+
margin-left: 25px;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
color: #BBB;
|
|
75
|
+
|
|
76
|
+
a {
|
|
77
|
+
@include Transition(color);
|
|
78
|
+
color: #BBB;
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
color: #FFF;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactConditionalWrapperProps } from './conditionalwrapper'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
condition: ConditionalWrapperProps['condition']
|
|
6
|
-
wrapper: (_: React.ReactNode) => any
|
|
7
|
-
children: React.ReactNode
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const ConditionalWrapper = ({ condition, wrapper, children }: ExtendedConditionalWrapperProps) =>
|
|
4
|
+
const ConditionalWrapper = ({ condition, wrapper, children }: ReactConditionalWrapperProps) =>
|
|
11
5
|
condition ? wrapper(children) : children
|
|
12
6
|
|
|
13
7
|
export default ConditionalWrapper
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ProgressProps } from './progress'
|
|
3
|
+
import './progress.scss'
|
|
4
|
+
|
|
5
|
+
interface Props extends ProgressProps {}
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
value,
|
|
9
|
+
size,
|
|
10
|
+
label,
|
|
11
|
+
color,
|
|
12
|
+
background,
|
|
13
|
+
square,
|
|
14
|
+
striped,
|
|
15
|
+
stripeLight,
|
|
16
|
+
stripeDark,
|
|
17
|
+
className
|
|
18
|
+
} = Astro.props
|
|
19
|
+
|
|
20
|
+
const classes = [
|
|
21
|
+
'w-progress',
|
|
22
|
+
size,
|
|
23
|
+
striped && 'striped',
|
|
24
|
+
square && 'square',
|
|
25
|
+
className
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const styles = [
|
|
29
|
+
color && `--w-progress-color: ${color};`,
|
|
30
|
+
background && `--w-progress-background: ${background};`,
|
|
31
|
+
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
32
|
+
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
33
|
+
].filter(Boolean).join('')
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<div class:list={classes} style={styles}>
|
|
37
|
+
<div class="progress" style={`--w-progress-width: ${value}%;`}>
|
|
38
|
+
{label && `${value}%`}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ProgressProps } from './progress'
|
|
3
|
+
import './progress.scss'
|
|
4
|
+
|
|
5
|
+
export let value: ProgressProps['value'] = 0
|
|
6
|
+
export let size: ProgressProps['size'] = null
|
|
7
|
+
export let label: ProgressProps['label'] = false
|
|
8
|
+
export let color: ProgressProps['color'] = ''
|
|
9
|
+
export let background: ProgressProps['background'] = ''
|
|
10
|
+
export let square: ProgressProps['square'] = false
|
|
11
|
+
export let striped: ProgressProps['striped'] = false
|
|
12
|
+
export let stripeLight: ProgressProps['stripeLight'] = ''
|
|
13
|
+
export let stripeDark: ProgressProps['stripeDark'] = ''
|
|
14
|
+
export let className: ProgressProps['className'] = ''
|
|
15
|
+
|
|
16
|
+
const classes = [
|
|
17
|
+
'w-progress',
|
|
18
|
+
size,
|
|
19
|
+
striped && 'striped',
|
|
20
|
+
square && 'square',
|
|
21
|
+
className
|
|
22
|
+
].filter(Boolean).join(' ')
|
|
23
|
+
|
|
24
|
+
const styles = [
|
|
25
|
+
color && `--w-progress-color: ${color};`,
|
|
26
|
+
background && `--w-progress-background: ${background};`,
|
|
27
|
+
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
28
|
+
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
29
|
+
].filter(Boolean).join('')
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div class={classes} style={styles}>
|
|
33
|
+
<div class="progress" style={`--w-progress-width: ${value}%;`}>
|
|
34
|
+
{#if label}
|
|
35
|
+
{`${value}%`}
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { ProgressProps } from './progress'
|
|
3
|
+
|
|
4
|
+
import './progress.scss'
|
|
5
|
+
|
|
6
|
+
const Progress = ({
|
|
7
|
+
value,
|
|
8
|
+
size,
|
|
9
|
+
label,
|
|
10
|
+
color,
|
|
11
|
+
background,
|
|
12
|
+
square,
|
|
13
|
+
striped,
|
|
14
|
+
stripeLight,
|
|
15
|
+
stripeDark,
|
|
16
|
+
className
|
|
17
|
+
}: ProgressProps) => {
|
|
18
|
+
const classes = [
|
|
19
|
+
'w-progress',
|
|
20
|
+
size,
|
|
21
|
+
striped && 'striped',
|
|
22
|
+
square && 'square',
|
|
23
|
+
className
|
|
24
|
+
].filter(Boolean).join(' ')
|
|
25
|
+
|
|
26
|
+
const styles = {
|
|
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
|
+
} as React.CSSProperties
|
|
32
|
+
|
|
33
|
+
const percent = {
|
|
34
|
+
'--w-progress-width': `${value}%`
|
|
35
|
+
} as React.CSSProperties
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className={classes} style={styles}>
|
|
39
|
+
<div className="progress" style={percent}>
|
|
40
|
+
{label && `${value}%`}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default Progress
|
|
47
|
+
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +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
|
+
'w-radio',
|
|
19
|
+
inline && '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 && 'col',
|
|
32
|
+
item.disabled && 'disabled'
|
|
33
|
+
]}>
|
|
34
|
+
<ConditionalWrapper condition={!!(item.subText)}>
|
|
35
|
+
<div class="radio-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="radio" />
|
|
46
|
+
<span class="label">
|
|
47
|
+
<Fragment set:html={item.label} />
|
|
48
|
+
</span>
|
|
49
|
+
</ConditionalWrapper>
|
|
50
|
+
{item.subText && (
|
|
51
|
+
<span class="sub-text">
|
|
52
|
+
<Fragment set:html={item.subText} />
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</label>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RadioProps } from './radio'
|
|
3
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
4
|
+
|
|
5
|
+
import './radio.scss'
|
|
6
|
+
|
|
7
|
+
export let name: RadioProps['name'] = ''
|
|
8
|
+
export let items: RadioProps['items'] = []
|
|
9
|
+
export let color: RadioProps['color'] = ''
|
|
10
|
+
export let inline: RadioProps['inline'] = false
|
|
11
|
+
export let className: RadioProps['className'] = ''
|
|
12
|
+
export let onChange: () => any = () => {}
|
|
13
|
+
|
|
14
|
+
const classes = [
|
|
15
|
+
'w-radio',
|
|
16
|
+
inline && 'inline',
|
|
17
|
+
className
|
|
18
|
+
].filter(Boolean).join(' ')
|
|
19
|
+
|
|
20
|
+
const style = color
|
|
21
|
+
? `--w-radio-color: ${color};`
|
|
22
|
+
: null
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class={classes} style={style}>
|
|
26
|
+
{#each items as item}
|
|
27
|
+
<label
|
|
28
|
+
class:col={item.subText}
|
|
29
|
+
class:disabled={item.disabled}
|
|
30
|
+
>
|
|
31
|
+
<ConditionalWrapper
|
|
32
|
+
condition={!!(item.subText)}
|
|
33
|
+
element="div"
|
|
34
|
+
class="radio-wrapper"
|
|
35
|
+
>
|
|
36
|
+
<input
|
|
37
|
+
type="radio"
|
|
38
|
+
name={name}
|
|
39
|
+
value={item.value}
|
|
40
|
+
checked={item.selected}
|
|
41
|
+
disabled={item.disabled}
|
|
42
|
+
on:change={onChange}
|
|
43
|
+
/>
|
|
44
|
+
<span class="radio" />
|
|
45
|
+
<span class="label">
|
|
46
|
+
{@html item.label}
|
|
47
|
+
</span>
|
|
48
|
+
</ConditionalWrapper>
|
|
49
|
+
{#if item.subText}
|
|
50
|
+
<span class="sub-text">
|
|
51
|
+
{@html item.subText}
|
|
52
|
+
</span>
|
|
53
|
+
{/if}
|
|
54
|
+
</label>
|
|
55
|
+
{/each}
|
|
56
|
+
</div>
|