webcoreui 1.1.0-beta.3 → 1.2.0-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 +47 -4
- package/astro.d.ts +5 -0
- package/astro.js +2 -0
- package/components/BottomNavigation/BottomNavigation.astro +1 -3
- package/components/Breadcrumb/Breadcrumb.astro +1 -3
- package/components/Carousel/Carousel.astro +79 -9
- package/components/Carousel/Carousel.svelte +40 -9
- package/components/Carousel/Carousel.tsx +46 -11
- package/components/Carousel/carousel.ts +3 -1
- package/components/ContextMenu/ContextMenu.astro +8 -3
- package/components/ContextMenu/ContextMenu.svelte +7 -2
- package/components/ContextMenu/ContextMenu.tsx +7 -2
- package/components/Copy/Copy.astro +3 -5
- package/components/Copy/Copy.svelte +1 -1
- package/components/Copy/Copy.tsx +1 -1
- package/components/Input/input.ts +62 -62
- package/components/Modal/Modal.astro +75 -75
- package/components/Modal/modal.ts +25 -25
- package/components/OTPInput/OTPInput.astro +194 -96
- package/components/OTPInput/OTPInput.svelte +141 -26
- package/components/OTPInput/OTPInput.tsx +140 -36
- package/components/OTPInput/otpinput.module.scss +59 -85
- package/components/Pagination/Pagination.astro +3 -3
- package/components/Pagination/Pagination.svelte +4 -4
- package/components/Pagination/pagination.module.scss +3 -3
- package/components/RangeSlider/RangeSlider.astro +270 -0
- package/components/RangeSlider/RangeSlider.svelte +188 -0
- package/components/RangeSlider/RangeSlider.tsx +205 -0
- package/components/RangeSlider/rangeslider.module.scss +143 -0
- package/components/RangeSlider/rangeslider.ts +37 -0
- package/components/Sidebar/Sidebar.astro +1 -3
- package/components/Stepper/Stepper.astro +1 -3
- package/index.d.ts +23 -4
- package/index.js +2 -0
- package/package.json +109 -103
- package/react.d.ts +5 -0
- package/react.js +2 -0
- package/scss/global/breakpoints.scss +15 -0
- package/scss/setup.scss +7 -1
- package/svelte.d.ts +5 -0
- package/svelte.js +2 -0
- package/utils/DOMUtils.ts +27 -2
- package/utils/bodyFreeze.ts +1 -1
- package/utils/context.ts +2 -2
- package/utils/getBreakpoint.ts +17 -0
- package/utils/isOneOf.ts +5 -0
- package/utils/modal.ts +54 -55
- package/utils/toast.ts +1 -1
- package/utils/webcore.ts +0 -28
|
@@ -24,8 +24,13 @@ const ContextMenu = ({
|
|
|
24
24
|
event.preventDefault()
|
|
25
25
|
|
|
26
26
|
if (content.current) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const target = event.currentTarget as HTMLElement
|
|
28
|
+
const rect = target.getBoundingClientRect()
|
|
29
|
+
const x = event.clientX - rect.left
|
|
30
|
+
const y = event.clientY - rect.top
|
|
31
|
+
|
|
32
|
+
content.current.style.top = `${y}px`
|
|
33
|
+
content.current.style.left = `${x}px`
|
|
29
34
|
content.current.dataset.show = 'true'
|
|
30
35
|
}
|
|
31
36
|
}
|
|
@@ -8,8 +8,6 @@ import { classNames } from '../../utils/classNames'
|
|
|
8
8
|
|
|
9
9
|
import styles from './copy.module.scss'
|
|
10
10
|
|
|
11
|
-
import type { IconProps } from '../Icon/icon'
|
|
12
|
-
|
|
13
11
|
interface Props extends CopyProps {}
|
|
14
12
|
|
|
15
13
|
const {
|
|
@@ -42,13 +40,13 @@ const classes = classNames([
|
|
|
42
40
|
>
|
|
43
41
|
{copyIcon?.startsWith('<svg')
|
|
44
42
|
? <Fragment set:html={copyIcon} />
|
|
45
|
-
: <Icon type={copyIcon
|
|
43
|
+
: <Icon type={copyIcon} />
|
|
46
44
|
}
|
|
47
45
|
</button>
|
|
48
46
|
<span class={styles.copied}>
|
|
49
47
|
{copiedIcon?.startsWith('<svg')
|
|
50
48
|
? <Fragment set:html={copiedIcon} />
|
|
51
|
-
: <Icon type={copiedIcon
|
|
49
|
+
: <Icon type={copiedIcon} />
|
|
52
50
|
}
|
|
53
51
|
</span>
|
|
54
52
|
</div>
|
|
@@ -71,7 +69,7 @@ const classes = classNames([
|
|
|
71
69
|
copied.style.opacity = '1'
|
|
72
70
|
badge.removeAttribute('data-tooltip')
|
|
73
71
|
|
|
74
|
-
navigator.clipboard.writeText(text
|
|
72
|
+
navigator.clipboard.writeText(text || '')
|
|
75
73
|
}, true)
|
|
76
74
|
}
|
|
77
75
|
|
package/components/Copy/Copy.tsx
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
|
-
export type InputTarget = {
|
|
4
|
-
currentTarget: HTMLInputElement
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type InputProps = {
|
|
8
|
-
type?: 'text'
|
|
9
|
-
| 'email'
|
|
10
|
-
| 'password'
|
|
11
|
-
| 'number'
|
|
12
|
-
| 'tel'
|
|
13
|
-
| 'url'
|
|
14
|
-
| 'search'
|
|
15
|
-
| 'file'
|
|
16
|
-
| 'date'
|
|
17
|
-
| 'datetime-local'
|
|
18
|
-
| 'month'
|
|
19
|
-
| 'week'
|
|
20
|
-
| 'time'
|
|
21
|
-
| 'color'
|
|
22
|
-
theme?: 'info'
|
|
23
|
-
| 'success'
|
|
24
|
-
| 'warning'
|
|
25
|
-
| 'alert'
|
|
26
|
-
| 'fill'
|
|
27
|
-
| null
|
|
28
|
-
value?: string | number
|
|
29
|
-
name?: string
|
|
30
|
-
placeholder?: string
|
|
31
|
-
label?: string
|
|
32
|
-
disabled?: boolean
|
|
33
|
-
subText?: string
|
|
34
|
-
maxLength?: number
|
|
35
|
-
min?: number
|
|
36
|
-
max?: number
|
|
37
|
-
step?: number
|
|
38
|
-
multiple?: boolean
|
|
39
|
-
pattern?: string
|
|
40
|
-
required?: boolean
|
|
41
|
-
autofocus?: boolean
|
|
42
|
-
autocomplete?: 'on' | 'off'
|
|
43
|
-
className?: string
|
|
44
|
-
labelClassName?: string
|
|
45
|
-
[key: string]: any
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type SvelteInputProps = {
|
|
49
|
-
onChange?: (event: Event & InputTarget) => void
|
|
50
|
-
onKeyUp?: (event: KeyboardEvent & InputTarget) => void
|
|
51
|
-
onInput?: (event: any) => void
|
|
52
|
-
onClick?: (event: MouseEvent & InputTarget) => void
|
|
53
|
-
children?: Snippet
|
|
54
|
-
} & InputProps
|
|
55
|
-
|
|
56
|
-
export type ReactInputProps = {
|
|
57
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
58
|
-
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
59
|
-
onInput?: (event: React.FormEvent<HTMLInputElement>) => void
|
|
60
|
-
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void
|
|
61
|
-
children?: React.ReactNode
|
|
62
|
-
} & InputProps
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
3
|
+
export type InputTarget = {
|
|
4
|
+
currentTarget: HTMLInputElement
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type InputProps = {
|
|
8
|
+
type?: 'text'
|
|
9
|
+
| 'email'
|
|
10
|
+
| 'password'
|
|
11
|
+
| 'number'
|
|
12
|
+
| 'tel'
|
|
13
|
+
| 'url'
|
|
14
|
+
| 'search'
|
|
15
|
+
| 'file'
|
|
16
|
+
| 'date'
|
|
17
|
+
| 'datetime-local'
|
|
18
|
+
| 'month'
|
|
19
|
+
| 'week'
|
|
20
|
+
| 'time'
|
|
21
|
+
| 'color'
|
|
22
|
+
theme?: 'info'
|
|
23
|
+
| 'success'
|
|
24
|
+
| 'warning'
|
|
25
|
+
| 'alert'
|
|
26
|
+
| 'fill'
|
|
27
|
+
| null
|
|
28
|
+
value?: string | number
|
|
29
|
+
name?: string
|
|
30
|
+
placeholder?: string
|
|
31
|
+
label?: string
|
|
32
|
+
disabled?: boolean
|
|
33
|
+
subText?: string
|
|
34
|
+
maxLength?: number
|
|
35
|
+
min?: number
|
|
36
|
+
max?: number
|
|
37
|
+
step?: number
|
|
38
|
+
multiple?: boolean
|
|
39
|
+
pattern?: string
|
|
40
|
+
required?: boolean
|
|
41
|
+
autofocus?: boolean
|
|
42
|
+
autocomplete?: 'on' | 'off' | 'one-time-code'
|
|
43
|
+
className?: string
|
|
44
|
+
labelClassName?: string
|
|
45
|
+
[key: string]: any
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type SvelteInputProps = {
|
|
49
|
+
onChange?: (event: Event & InputTarget) => void
|
|
50
|
+
onKeyUp?: (event: KeyboardEvent & InputTarget) => void
|
|
51
|
+
onInput?: (event: any) => void
|
|
52
|
+
onClick?: (event: MouseEvent & InputTarget) => void
|
|
53
|
+
children?: Snippet
|
|
54
|
+
} & InputProps
|
|
55
|
+
|
|
56
|
+
export type ReactInputProps = {
|
|
57
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
58
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
59
|
+
onInput?: (event: React.FormEvent<HTMLInputElement>) => void
|
|
60
|
+
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void
|
|
61
|
+
children?: React.ReactNode
|
|
62
|
+
} & InputProps
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
---
|
|
2
|
-
import type { ModalProps } from './modal'
|
|
3
|
-
|
|
4
|
-
import Button from '../Button/Button.astro'
|
|
5
|
-
|
|
6
|
-
import alert from '../../icons/alert.svg?raw'
|
|
7
|
-
import success from '../../icons/circle-check.svg?raw'
|
|
8
|
-
import closeIcon from '../../icons/close.svg?raw'
|
|
9
|
-
import info from '../../icons/info.svg?raw'
|
|
10
|
-
import warning from '../../icons/warning.svg?raw'
|
|
11
|
-
|
|
12
|
-
import styles from './modal.module.scss'
|
|
13
|
-
|
|
14
|
-
interface Props extends ModalProps {}
|
|
15
|
-
|
|
16
|
-
const iconMap = {
|
|
17
|
-
info,
|
|
18
|
-
success,
|
|
19
|
-
warning,
|
|
20
|
-
alert
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
title,
|
|
25
|
-
subTitle,
|
|
26
|
-
showCloseIcon = true,
|
|
27
|
-
closeOnEsc = true,
|
|
28
|
-
closeOnOverlay = true,
|
|
29
|
-
transparent,
|
|
30
|
-
theme,
|
|
31
|
-
id,
|
|
32
|
-
className,
|
|
33
|
-
...rest
|
|
34
|
-
} = Astro.props
|
|
35
|
-
|
|
36
|
-
const close = [
|
|
37
|
-
showCloseIcon && 'icon',
|
|
38
|
-
closeOnEsc && 'esc',
|
|
39
|
-
closeOnOverlay && 'overlay'
|
|
40
|
-
].filter(Boolean).join(',')
|
|
41
|
-
|
|
42
|
-
const classes = [
|
|
43
|
-
styles.modal,
|
|
44
|
-
transparent && styles.transparent,
|
|
45
|
-
theme && styles[theme],
|
|
46
|
-
className
|
|
47
|
-
]
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
<dialog
|
|
51
|
-
class:list={classes}
|
|
52
|
-
id={id}
|
|
53
|
-
data-close={close.length ? close : undefined}
|
|
54
|
-
{...rest}
|
|
55
|
-
>
|
|
56
|
-
{showCloseIcon && (
|
|
57
|
-
<Button
|
|
58
|
-
theme="flat"
|
|
59
|
-
className={styles.close}
|
|
60
|
-
data-id="close"
|
|
61
|
-
aria-label="close"
|
|
62
|
-
>
|
|
63
|
-
<Fragment set:html={closeIcon} />
|
|
64
|
-
</Button>
|
|
65
|
-
)}
|
|
66
|
-
{title && (
|
|
67
|
-
<strong class={styles.title}>
|
|
68
|
-
{theme && <Fragment set:html={iconMap[theme]} />}
|
|
69
|
-
{title}
|
|
70
|
-
</strong>
|
|
71
|
-
)}
|
|
72
|
-
{subTitle && <div class={styles.subTitle}>{subTitle}</div>}
|
|
73
|
-
<slot />
|
|
74
|
-
</dialog>
|
|
75
|
-
<div class={styles.overlay} />
|
|
1
|
+
---
|
|
2
|
+
import type { ModalProps } from './modal'
|
|
3
|
+
|
|
4
|
+
import Button from '../Button/Button.astro'
|
|
5
|
+
|
|
6
|
+
import alert from '../../icons/alert.svg?raw'
|
|
7
|
+
import success from '../../icons/circle-check.svg?raw'
|
|
8
|
+
import closeIcon from '../../icons/close.svg?raw'
|
|
9
|
+
import info from '../../icons/info.svg?raw'
|
|
10
|
+
import warning from '../../icons/warning.svg?raw'
|
|
11
|
+
|
|
12
|
+
import styles from './modal.module.scss'
|
|
13
|
+
|
|
14
|
+
interface Props extends ModalProps {}
|
|
15
|
+
|
|
16
|
+
const iconMap = {
|
|
17
|
+
info,
|
|
18
|
+
success,
|
|
19
|
+
warning,
|
|
20
|
+
alert
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
title,
|
|
25
|
+
subTitle,
|
|
26
|
+
showCloseIcon = true,
|
|
27
|
+
closeOnEsc = true,
|
|
28
|
+
closeOnOverlay = true,
|
|
29
|
+
transparent,
|
|
30
|
+
theme,
|
|
31
|
+
id,
|
|
32
|
+
className,
|
|
33
|
+
...rest
|
|
34
|
+
} = Astro.props
|
|
35
|
+
|
|
36
|
+
const close = [
|
|
37
|
+
showCloseIcon && 'icon',
|
|
38
|
+
closeOnEsc && 'esc',
|
|
39
|
+
closeOnOverlay && 'overlay'
|
|
40
|
+
].filter(Boolean).join(',')
|
|
41
|
+
|
|
42
|
+
const classes = [
|
|
43
|
+
styles.modal,
|
|
44
|
+
transparent && styles.transparent,
|
|
45
|
+
theme && styles[theme],
|
|
46
|
+
className
|
|
47
|
+
]
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
<dialog
|
|
51
|
+
class:list={classes}
|
|
52
|
+
id={id}
|
|
53
|
+
data-close={close.length ? close : undefined}
|
|
54
|
+
{...rest}
|
|
55
|
+
>
|
|
56
|
+
{showCloseIcon && (
|
|
57
|
+
<Button
|
|
58
|
+
theme="flat"
|
|
59
|
+
className={styles.close}
|
|
60
|
+
data-id="close"
|
|
61
|
+
aria-label="close"
|
|
62
|
+
>
|
|
63
|
+
<Fragment set:html={closeIcon} />
|
|
64
|
+
</Button>
|
|
65
|
+
)}
|
|
66
|
+
{title && (
|
|
67
|
+
<strong class={styles.title}>
|
|
68
|
+
{theme && <Fragment set:html={iconMap[theme]} />}
|
|
69
|
+
{title}
|
|
70
|
+
</strong>
|
|
71
|
+
)}
|
|
72
|
+
{subTitle && <div class={styles.subTitle}>{subTitle}</div>}
|
|
73
|
+
<slot />
|
|
74
|
+
</dialog>
|
|
75
|
+
<div class={styles.overlay} />
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
|
-
export type ModalProps = {
|
|
4
|
-
title?: string
|
|
5
|
-
subTitle?: string
|
|
6
|
-
showCloseIcon?: boolean
|
|
7
|
-
closeOnEsc?: boolean
|
|
8
|
-
closeOnOverlay?: boolean
|
|
9
|
-
transparent?: boolean
|
|
10
|
-
id?: string
|
|
11
|
-
className?: string
|
|
12
|
-
theme?: 'info'
|
|
13
|
-
| 'success'
|
|
14
|
-
| 'warning'
|
|
15
|
-
| 'alert'
|
|
16
|
-
[key: string]: any
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type SvelteModalProps = {
|
|
20
|
-
children: Snippet
|
|
21
|
-
} & ModalProps
|
|
22
|
-
|
|
23
|
-
export type ReactModalProps = {
|
|
24
|
-
children?: React.ReactNode
|
|
25
|
-
} & ModalProps
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
3
|
+
export type ModalProps = {
|
|
4
|
+
title?: string
|
|
5
|
+
subTitle?: string
|
|
6
|
+
showCloseIcon?: boolean
|
|
7
|
+
closeOnEsc?: boolean
|
|
8
|
+
closeOnOverlay?: boolean
|
|
9
|
+
transparent?: boolean
|
|
10
|
+
id?: string
|
|
11
|
+
className?: string
|
|
12
|
+
theme?: 'info'
|
|
13
|
+
| 'success'
|
|
14
|
+
| 'warning'
|
|
15
|
+
| 'alert'
|
|
16
|
+
[key: string]: any
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SvelteModalProps = {
|
|
20
|
+
children: Snippet
|
|
21
|
+
} & ModalProps
|
|
22
|
+
|
|
23
|
+
export type ReactModalProps = {
|
|
24
|
+
children?: React.ReactNode
|
|
25
|
+
} & ModalProps
|