webcoreui 1.2.0 → 1.3.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 +11 -6
- package/astro.d.ts +3 -0
- package/astro.js +2 -0
- package/components/Badge/Badge.astro +2 -0
- package/components/Badge/Badge.svelte +2 -0
- package/components/Badge/Badge.tsx +2 -0
- package/components/Badge/badge.module.scss +26 -0
- package/components/Badge/badge.ts +1 -0
- package/components/Counter/Counter.astro +164 -0
- package/components/Counter/Counter.svelte +141 -0
- package/components/Counter/Counter.tsx +161 -0
- package/components/Counter/counter.module.scss +155 -0
- package/components/Counter/counter.ts +21 -0
- package/components/DataTable/DataTable.tsx +1 -1
- package/components/Icon/map.ts +2 -0
- package/components/List/List.astro +3 -0
- package/components/List/List.svelte +12 -9
- package/components/List/List.tsx +3 -0
- package/components/List/list.module.scss +5 -0
- package/components/List/list.ts +40 -39
- package/components/Menu/Menu.tsx +1 -1
- package/components/Pagination/Pagination.tsx +1 -1
- package/components/Pagination/pagination.module.scss +1 -0
- package/components/Popover/Popover.astro +28 -26
- package/components/Popover/Popover.svelte +2 -0
- package/components/Popover/Popover.tsx +2 -0
- package/components/Popover/popover.module.scss +6 -0
- package/components/Popover/popover.ts +17 -16
- package/components/Progress/Progress.astro +6 -2
- package/components/Progress/Progress.svelte +6 -2
- package/components/Progress/Progress.tsx +6 -2
- package/components/Progress/progress.module.scss +15 -0
- package/components/Progress/progress.ts +1 -0
- package/components/RangeSlider/RangeSlider.astro +5 -0
- package/components/RangeSlider/rangeslider.ts +1 -0
- package/icons/minus.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/package.json +111 -109
- package/react.d.ts +3 -0
- package/react.js +2 -0
- package/svelte.d.ts +3 -0
- package/svelte.js +2 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
@use '../../scss/config.scss' as *;
|
|
2
|
+
|
|
3
|
+
body {
|
|
4
|
+
--w-counter-width: 10ch;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.counter {
|
|
8
|
+
@include layout(inline-flex);
|
|
9
|
+
@include border(primary-50);
|
|
10
|
+
@include border-radius();
|
|
11
|
+
|
|
12
|
+
&.rounded {
|
|
13
|
+
@include border-radius(xl);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.compact button {
|
|
17
|
+
@include border(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.buttons {
|
|
21
|
+
button {
|
|
22
|
+
@include border(0);
|
|
23
|
+
|
|
24
|
+
&:first-child {
|
|
25
|
+
@include border(right, primary-50);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:last-child {
|
|
29
|
+
@include border(left, primary-50);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.info button {
|
|
34
|
+
border-color: var(--w-color-info);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.success button {
|
|
38
|
+
border-color: var(--w-color-success);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.warning button {
|
|
42
|
+
border-color: var(--w-color-warning);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.alert button {
|
|
46
|
+
border-color: var(--w-color-alert);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:not(.buttons) button {
|
|
51
|
+
@include border-radius();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.separated {
|
|
55
|
+
@include layout(xs);
|
|
56
|
+
@include border(0);
|
|
57
|
+
|
|
58
|
+
input {
|
|
59
|
+
@include border(primary-50);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.info input,
|
|
63
|
+
&.info button {
|
|
64
|
+
border-color: var(--w-color-info);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.success input,
|
|
68
|
+
&.success button {
|
|
69
|
+
border-color: var(--w-color-success);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.warning input,
|
|
73
|
+
&.warning button {
|
|
74
|
+
border-color: var(--w-color-warning);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.alert input,
|
|
78
|
+
&.alert button {
|
|
79
|
+
border-color: var(--w-color-alert);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.info:not(.separated) {
|
|
84
|
+
border-color: var(--w-color-info);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.success:not(.separated) {
|
|
88
|
+
border-color: var(--w-color-success);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.warning:not(.separated) {
|
|
92
|
+
border-color: var(--w-color-warning);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&.alert:not(.separated) {
|
|
96
|
+
border-color: var(--w-color-alert);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.info button svg {
|
|
100
|
+
@include typography(info);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.success button svg {
|
|
104
|
+
@include typography(success);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.warning button svg {
|
|
108
|
+
@include typography(warning);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.alert button svg {
|
|
112
|
+
@include typography(alert);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
button {
|
|
116
|
+
@include background(transparent);
|
|
117
|
+
@include border(primary-50);
|
|
118
|
+
@include typography(primary);
|
|
119
|
+
@include spacing(p-xs);
|
|
120
|
+
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
|
|
123
|
+
&[disabled] {
|
|
124
|
+
@include typography(primary-50);
|
|
125
|
+
|
|
126
|
+
cursor: default;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
svg {
|
|
130
|
+
@include size(w18px, 'h100%');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
input {
|
|
135
|
+
@include background(transparent);
|
|
136
|
+
@include border(0);
|
|
137
|
+
@include border-radius();
|
|
138
|
+
@include typography(primary, center);
|
|
139
|
+
@include spacing(p-xs);
|
|
140
|
+
|
|
141
|
+
flex: 1;
|
|
142
|
+
width: var(--w-counter-width);
|
|
143
|
+
appearance: none;
|
|
144
|
+
-moz-appearance: textfield;
|
|
145
|
+
|
|
146
|
+
&::-webkit-inner-spin-button,
|
|
147
|
+
&::-webkit-outer-spin-button {
|
|
148
|
+
appearance: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&[disabled] {
|
|
152
|
+
@include typography(primary-50);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ButtonProps } from '../Button/button'
|
|
2
|
+
import type { IconProps } from '../Icon/icon'
|
|
3
|
+
|
|
4
|
+
export type CounterProps = {
|
|
5
|
+
type?: 'compact' | 'buttons' | 'separated'
|
|
6
|
+
theme?: ButtonProps['theme']
|
|
7
|
+
rounded?: boolean
|
|
8
|
+
minIcon?: IconProps['type'] | string
|
|
9
|
+
maxIcon?: IconProps['type'] | string
|
|
10
|
+
width?: string
|
|
11
|
+
className?: string
|
|
12
|
+
[key: string]: any
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type SvelteCounterProps = {
|
|
16
|
+
onChange?: (value: number) => void
|
|
17
|
+
} & CounterProps
|
|
18
|
+
|
|
19
|
+
export type ReactCounterProps = {
|
|
20
|
+
onChange?: (value: number) => void
|
|
21
|
+
} & CounterProps
|
|
@@ -18,7 +18,6 @@ import styles from './datatable.module.scss'
|
|
|
18
18
|
|
|
19
19
|
import type { ListEventType } from '../List/list'
|
|
20
20
|
|
|
21
|
-
// eslint-disable-next-line complexity
|
|
22
21
|
const DataTable = ({
|
|
23
22
|
headings,
|
|
24
23
|
filterPlaceholder = 'Filter entries',
|
|
@@ -38,6 +37,7 @@ const DataTable = ({
|
|
|
38
37
|
id,
|
|
39
38
|
onFilter,
|
|
40
39
|
children
|
|
40
|
+
// eslint-disable-next-line complexity
|
|
41
41
|
}: ReactDataTableProps) => {
|
|
42
42
|
const [filteredData, setFilteredData] = useState<any>(data)
|
|
43
43
|
const [toggledData, setToggledData] = useState(filteredData)
|
package/components/Icon/map.ts
CHANGED
|
@@ -11,6 +11,7 @@ import Copy from '../../icons/copy.svg?raw'
|
|
|
11
11
|
import Github from '../../icons/github.svg?raw'
|
|
12
12
|
import Home from '../../icons/home.svg?raw'
|
|
13
13
|
import Info from '../../icons/info.svg?raw'
|
|
14
|
+
import Minus from '../../icons/minus.svg?raw'
|
|
14
15
|
import Moon from '../../icons/moon.svg?raw'
|
|
15
16
|
import Order from '../../icons/order.svg?raw'
|
|
16
17
|
import Plus from '../../icons/plus.svg?raw'
|
|
@@ -32,6 +33,7 @@ const iconMap = {
|
|
|
32
33
|
'github': Github,
|
|
33
34
|
'home': Home,
|
|
34
35
|
'info': Info,
|
|
36
|
+
'minus': Minus,
|
|
35
37
|
'moon': Moon,
|
|
36
38
|
'order': Order,
|
|
37
39
|
'plus': Plus,
|
|
@@ -19,17 +19,20 @@ const {
|
|
|
19
19
|
id,
|
|
20
20
|
className,
|
|
21
21
|
wrapperClassName,
|
|
22
|
+
secondary,
|
|
22
23
|
itemGroups
|
|
23
24
|
} = Astro.props
|
|
24
25
|
|
|
25
26
|
const classes = [
|
|
26
27
|
styles.list,
|
|
28
|
+
(secondary && !showSearchBar) && styles.secondary,
|
|
27
29
|
!showSearchBar && styles.container,
|
|
28
30
|
className
|
|
29
31
|
]
|
|
30
32
|
|
|
31
33
|
const wrapperClasses = [
|
|
32
34
|
styles.container,
|
|
35
|
+
secondary && styles.secondary,
|
|
33
36
|
wrapperClassName
|
|
34
37
|
]
|
|
35
38
|
---
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
id,
|
|
20
20
|
className,
|
|
21
21
|
wrapperClassName,
|
|
22
|
+
secondary,
|
|
22
23
|
itemGroups = $bindable([]),
|
|
23
24
|
onSelect
|
|
24
25
|
}: SvelteListProps = $props()
|
|
@@ -28,12 +29,14 @@
|
|
|
28
29
|
|
|
29
30
|
const classes = classNames([
|
|
30
31
|
styles.list,
|
|
32
|
+
(secondary && !showSearchBar) && styles.secondary,
|
|
31
33
|
!showSearchBar && styles.container,
|
|
32
34
|
className
|
|
33
35
|
])
|
|
34
36
|
|
|
35
37
|
const wrapperClasses = classNames([
|
|
36
38
|
styles.container,
|
|
39
|
+
secondary && styles.secondary,
|
|
37
40
|
wrapperClassName
|
|
38
41
|
])
|
|
39
42
|
|
|
@@ -81,15 +84,15 @@
|
|
|
81
84
|
class={wrapperClasses}
|
|
82
85
|
>
|
|
83
86
|
{#if showSearchBar}
|
|
84
|
-
|
|
85
|
-
type="search"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
{
|
|
92
|
-
|
|
87
|
+
{#if showSearchBarIcon}
|
|
88
|
+
<Input type="search" placeholder={searchBarPlaceholder} onInput={search}>
|
|
89
|
+
{#if showSearchBarIcon}
|
|
90
|
+
{@html searchIcon}
|
|
91
|
+
{/if}
|
|
92
|
+
</Input>
|
|
93
|
+
{:else}
|
|
94
|
+
<Input type="search" placeholder={searchBarPlaceholder} onInput={search} />
|
|
95
|
+
{/if}
|
|
93
96
|
{/if}
|
|
94
97
|
<ul
|
|
95
98
|
class={classes}
|
package/components/List/List.tsx
CHANGED
|
@@ -19,6 +19,7 @@ const List = ({
|
|
|
19
19
|
id,
|
|
20
20
|
className,
|
|
21
21
|
wrapperClassName,
|
|
22
|
+
secondary,
|
|
22
23
|
itemGroups,
|
|
23
24
|
onSelect
|
|
24
25
|
}: ReactListProps) => {
|
|
@@ -28,12 +29,14 @@ const List = ({
|
|
|
28
29
|
|
|
29
30
|
const classes = classNames([
|
|
30
31
|
styles.list,
|
|
32
|
+
(secondary && !showSearchBar) && styles.secondary,
|
|
31
33
|
!showSearchBar && styles.container,
|
|
32
34
|
className
|
|
33
35
|
])
|
|
34
36
|
|
|
35
37
|
const wrapperClasses = classNames([
|
|
36
38
|
styles.container,
|
|
39
|
+
secondary && styles.secondary,
|
|
37
40
|
wrapperClassName
|
|
38
41
|
])
|
|
39
42
|
|
package/components/List/list.ts
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import type { ButtonProps } from '../Button/button'
|
|
2
|
-
|
|
3
|
-
export type ListEventType = {
|
|
4
|
-
value: string
|
|
5
|
-
name: string
|
|
6
|
-
list: HTMLUListElement
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type ListProps = {
|
|
10
|
-
showSearchBar?: boolean
|
|
11
|
-
showSearchBarIcon?: boolean
|
|
12
|
-
searchBarPlaceholder?: string
|
|
13
|
-
noResultsLabel?: string
|
|
14
|
-
maxHeight?: string
|
|
15
|
-
id?: string
|
|
16
|
-
className?: string
|
|
17
|
-
wrapperClassName?: string
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import type { ButtonProps } from '../Button/button'
|
|
2
|
+
|
|
3
|
+
export type ListEventType = {
|
|
4
|
+
value: string
|
|
5
|
+
name: string
|
|
6
|
+
list: HTMLUListElement
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type ListProps = {
|
|
10
|
+
showSearchBar?: boolean
|
|
11
|
+
showSearchBarIcon?: boolean
|
|
12
|
+
searchBarPlaceholder?: string
|
|
13
|
+
noResultsLabel?: string
|
|
14
|
+
maxHeight?: string
|
|
15
|
+
id?: string
|
|
16
|
+
className?: string
|
|
17
|
+
wrapperClassName?: string
|
|
18
|
+
secondary?: boolean
|
|
19
|
+
itemGroups: {
|
|
20
|
+
title?: string
|
|
21
|
+
items: {
|
|
22
|
+
name: string
|
|
23
|
+
value?: string
|
|
24
|
+
href?: string
|
|
25
|
+
target?: ButtonProps['target']
|
|
26
|
+
selected?: boolean
|
|
27
|
+
disabled?: boolean
|
|
28
|
+
icon?: string
|
|
29
|
+
subText?: string
|
|
30
|
+
}[]
|
|
31
|
+
}[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type SvelteListProps = {
|
|
35
|
+
onSelect?: (event: ListEventType) => void
|
|
36
|
+
} & ListProps
|
|
37
|
+
|
|
38
|
+
export type ReactListProps = {
|
|
39
|
+
onSelect?: (event: ListEventType) => void
|
|
40
|
+
} & ListProps
|
package/components/Menu/Menu.tsx
CHANGED
|
@@ -7,7 +7,6 @@ import { classNames } from '../../utils/classNames'
|
|
|
7
7
|
|
|
8
8
|
import styles from './menu.module.scss'
|
|
9
9
|
|
|
10
|
-
// eslint-disable-next-line complexity
|
|
11
10
|
const Menu = ({
|
|
12
11
|
items,
|
|
13
12
|
logo,
|
|
@@ -15,6 +14,7 @@ const Menu = ({
|
|
|
15
14
|
className,
|
|
16
15
|
wrapperClassName,
|
|
17
16
|
children
|
|
17
|
+
// eslint-disable-next-line complexity
|
|
18
18
|
}: ReactMenuProps) => {
|
|
19
19
|
const [active, setActive] = useState(false)
|
|
20
20
|
|
|
@@ -10,7 +10,6 @@ import ChevronRight from '../../icons/chevron-right.svg?raw'
|
|
|
10
10
|
|
|
11
11
|
import styles from './pagination.module.scss'
|
|
12
12
|
|
|
13
|
-
// eslint-disable-next-line complexity
|
|
14
13
|
const Pagination = ({
|
|
15
14
|
type,
|
|
16
15
|
showChevrons,
|
|
@@ -27,6 +26,7 @@ const Pagination = ({
|
|
|
27
26
|
currentPage,
|
|
28
27
|
onChange,
|
|
29
28
|
className
|
|
29
|
+
// eslint-disable-next-line complexity
|
|
30
30
|
}: ReactPaginationProps) => {
|
|
31
31
|
const [calculatedCurrentPage, setCalculatedCurrentPage] = useState(
|
|
32
32
|
currentPage
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { PopoverProps } from './popover'
|
|
3
|
-
|
|
4
|
-
import styles from './popover.module.scss'
|
|
5
|
-
|
|
6
|
-
interface Props extends PopoverProps {}
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
id,
|
|
10
|
-
className,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
---
|
|
2
|
+
import type { PopoverProps } from './popover'
|
|
3
|
+
|
|
4
|
+
import styles from './popover.module.scss'
|
|
5
|
+
|
|
6
|
+
interface Props extends PopoverProps {}
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
className,
|
|
11
|
+
transparent,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props
|
|
14
|
+
|
|
15
|
+
const classes = [
|
|
16
|
+
styles.popover,
|
|
17
|
+
transparent && styles.transparent,
|
|
18
|
+
className
|
|
19
|
+
]
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<dialog
|
|
23
|
+
class:list={classes}
|
|
24
|
+
id={id}
|
|
25
|
+
{...rest}
|
|
26
|
+
>
|
|
27
|
+
<slot />
|
|
28
|
+
</dialog>
|
|
@@ -9,6 +9,7 @@ import styles from './popover.module.scss'
|
|
|
9
9
|
const Popover = ({
|
|
10
10
|
id,
|
|
11
11
|
className,
|
|
12
|
+
transparent,
|
|
12
13
|
isInteractive = false,
|
|
13
14
|
children,
|
|
14
15
|
...rest
|
|
@@ -17,6 +18,7 @@ const Popover = ({
|
|
|
17
18
|
|
|
18
19
|
const classes = classNames([
|
|
19
20
|
styles.popover,
|
|
21
|
+
transparent && styles.transparent,
|
|
20
22
|
className
|
|
21
23
|
])
|
|
22
24
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
|
-
export type PopoverProps = {
|
|
4
|
-
id?: string
|
|
5
|
-
className?: string
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
3
|
+
export type PopoverProps = {
|
|
4
|
+
id?: string
|
|
5
|
+
className?: string
|
|
6
|
+
transparent?: boolean
|
|
7
|
+
[key: string]: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type SveltePopoverProps = {
|
|
11
|
+
children: Snippet
|
|
12
|
+
} & PopoverProps
|
|
13
|
+
|
|
14
|
+
export type ReactPopoverProps = {
|
|
15
|
+
isInteractive?: boolean
|
|
16
|
+
children?: React.ReactNode
|
|
17
|
+
} & PopoverProps
|
|
@@ -17,6 +17,7 @@ const {
|
|
|
17
17
|
striped,
|
|
18
18
|
stripeLight,
|
|
19
19
|
stripeDark,
|
|
20
|
+
indeterminate,
|
|
20
21
|
className
|
|
21
22
|
} = Astro.props
|
|
22
23
|
|
|
@@ -25,6 +26,7 @@ const classes = [
|
|
|
25
26
|
size && styles[size],
|
|
26
27
|
striped && styles.striped,
|
|
27
28
|
square && styles.square,
|
|
29
|
+
indeterminate && styles.indeterminate,
|
|
28
30
|
className
|
|
29
31
|
]
|
|
30
32
|
|
|
@@ -34,10 +36,12 @@ const styleVariables = classNames([
|
|
|
34
36
|
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
35
37
|
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
36
38
|
])
|
|
39
|
+
|
|
40
|
+
const currentValue = indeterminate && !value ? 20 : value
|
|
37
41
|
---
|
|
38
42
|
|
|
39
43
|
<div class:list={classes} style={styleVariables}>
|
|
40
|
-
<div class={styles.progress} style={`--w-progress-width: ${
|
|
41
|
-
{label && `${
|
|
44
|
+
<div class={styles.progress} style={`--w-progress-width: ${currentValue}%;`}>
|
|
45
|
+
{label && `${currentValue}%`}
|
|
42
46
|
</div>
|
|
43
47
|
</div>
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
striped,
|
|
16
16
|
stripeLight,
|
|
17
17
|
stripeDark,
|
|
18
|
+
indeterminate,
|
|
18
19
|
className
|
|
19
20
|
}: ProgressProps = $props()
|
|
20
21
|
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
size && styles[size],
|
|
24
25
|
striped && styles.striped,
|
|
25
26
|
square && styles.square,
|
|
27
|
+
indeterminate && styles.indeterminate,
|
|
26
28
|
className
|
|
27
29
|
])
|
|
28
30
|
|
|
@@ -32,12 +34,14 @@
|
|
|
32
34
|
stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
|
|
33
35
|
stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
|
|
34
36
|
])
|
|
37
|
+
|
|
38
|
+
const currentValue = indeterminate && !value ? 20 : value
|
|
35
39
|
</script>
|
|
36
40
|
|
|
37
41
|
<div class={classes} style={styleVariables || null}>
|
|
38
|
-
<div class={styles.progress} style={`--w-progress-width: ${
|
|
42
|
+
<div class={styles.progress} style={`--w-progress-width: ${currentValue}%;`}>
|
|
39
43
|
{#if label}
|
|
40
|
-
{`${
|
|
44
|
+
{`${currentValue}%`}
|
|
41
45
|
{/if}
|
|
42
46
|
</div>
|
|
43
47
|
</div>
|
|
@@ -15,6 +15,7 @@ const Progress = ({
|
|
|
15
15
|
striped,
|
|
16
16
|
stripeLight,
|
|
17
17
|
stripeDark,
|
|
18
|
+
indeterminate,
|
|
18
19
|
className
|
|
19
20
|
}: ProgressProps) => {
|
|
20
21
|
const classes = classNames([
|
|
@@ -22,6 +23,7 @@ const Progress = ({
|
|
|
22
23
|
size && styles[size],
|
|
23
24
|
striped && styles.striped,
|
|
24
25
|
square && styles.square,
|
|
26
|
+
indeterminate && styles.indeterminate,
|
|
25
27
|
className
|
|
26
28
|
])
|
|
27
29
|
|
|
@@ -32,14 +34,16 @@ const Progress = ({
|
|
|
32
34
|
...(stripeDark && { '--w-progress-stripe-dark': stripeDark })
|
|
33
35
|
} as React.CSSProperties
|
|
34
36
|
|
|
37
|
+
const currentValue = indeterminate && !value ? 20 : value
|
|
38
|
+
|
|
35
39
|
const percent = {
|
|
36
|
-
'--w-progress-width': `${
|
|
40
|
+
'--w-progress-width': `${currentValue}%`
|
|
37
41
|
} as React.CSSProperties
|
|
38
42
|
|
|
39
43
|
return (
|
|
40
44
|
<div className={classes} style={styleVariables}>
|
|
41
45
|
<div className={styles.progress} style={percent}>
|
|
42
|
-
{label && `${
|
|
46
|
+
{label && `${currentValue}%`}
|
|
43
47
|
</div>
|
|
44
48
|
</div>
|
|
45
49
|
)
|