webcoreui 0.8.1 → 0.9.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 +16 -0
- package/astro.d.ts +23 -0
- package/astro.js +8 -0
- package/components/Accordion/accordion.module.scss +1 -0
- package/components/Badge/Badge.svelte +1 -1
- package/components/Badge/badge.ts +1 -1
- package/components/BottomNavigation/BottomNavigation.astro +51 -0
- package/components/BottomNavigation/BottomNavigation.svelte +45 -0
- package/components/BottomNavigation/BottomNavigation.tsx +63 -0
- package/components/BottomNavigation/bottomnavigation.module.scss +70 -0
- package/components/BottomNavigation/bottomnavigation.ts +16 -0
- package/components/Card/card.module.scss +1 -0
- package/components/Checkbox/Checkbox.astro +8 -2
- package/components/Checkbox/Checkbox.svelte +1 -0
- package/components/Checkbox/Checkbox.tsx +3 -1
- package/components/Checkbox/checkbox.ts +1 -0
- package/components/Copy/Copy.astro +74 -0
- package/components/Copy/Copy.svelte +61 -0
- package/components/Copy/Copy.tsx +73 -0
- package/components/Copy/copy.module.scss +37 -0
- package/components/Copy/copy.ts +14 -0
- package/components/DataTable/DataTable.astro +1 -1
- package/components/Flex/Flex.astro +34 -0
- package/components/Flex/Flex.svelte +27 -0
- package/components/Flex/Flex.tsx +30 -0
- package/components/Flex/flex.ts +22 -0
- package/components/Grid/Grid.astro +32 -0
- package/components/Grid/Grid.svelte +25 -0
- package/components/Grid/Grid.tsx +28 -0
- package/components/Grid/grid.ts +18 -0
- package/components/Icon/icon.ts +1 -0
- package/components/Icon/map.ts +2 -0
- package/components/Input/Input.astro +1 -1
- package/components/Input/Input.svelte +4 -2
- package/components/Input/Input.tsx +4 -1
- package/components/List/list.module.scss +3 -0
- package/components/Menu/Menu.svelte +5 -1
- package/components/Pagination/Pagination.svelte +1 -0
- package/components/Radio/Radio.astro +3 -1
- package/components/Radio/Radio.svelte +3 -2
- package/components/Radio/Radio.tsx +5 -3
- package/components/Radio/radio.ts +1 -0
- package/components/Select/Select.astro +34 -1
- package/components/Select/Select.svelte +40 -4
- package/components/Select/Select.tsx +33 -1
- package/components/Select/select.ts +4 -1
- package/components/Skeleton/Skeleton.astro +2 -2
- package/components/Skeleton/Skeleton.svelte +2 -2
- package/components/Skeleton/Skeleton.tsx +2 -2
- package/components/Switch/Switch.astro +3 -2
- package/components/Switch/Switch.svelte +1 -0
- package/components/Switch/Switch.tsx +3 -1
- package/components/Switch/switch.ts +1 -0
- package/components/Textarea/Textarea.astro +3 -1
- package/components/Textarea/Textarea.svelte +48 -47
- package/components/Textarea/textarea.ts +19 -18
- package/icons/copy.svg +3 -0
- package/icons.d.ts +1 -0
- package/icons.js +1 -0
- package/index.d.ts +74 -2
- package/index.js +1 -0
- package/package.json +24 -15
- package/react.d.ts +23 -0
- package/react.js +8 -0
- package/scss/global/utility.scss +48 -3
- package/svelte.d.ts +23 -0
- package/svelte.js +8 -0
- package/utils/DOMUtils.ts +2 -2
- package/utils/classNames.ts +1 -1
- package/utils/getLayoutClasses.ts +141 -0
- package/utils/modal.ts +4 -4
- package/utils/popover.ts +30 -4
- package/scss/webcore.config.scss +0 -0
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { classNames } from '../../utils/classNames'
|
|
11
11
|
import { debounce } from '../../utils/debounce'
|
|
12
|
+
import { on } from '../../utils/DOMUtils'
|
|
12
13
|
import { modal } from '../../utils/modal'
|
|
13
14
|
import { closePopover, popover, type PopoverPosition } from '../../utils/popover'
|
|
14
15
|
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
|
|
17
18
|
import styles from './select.module.scss'
|
|
18
19
|
|
|
19
|
-
import type { ListEventType } from '../List/list'
|
|
20
|
+
import type { ListEventType, ListProps } from '../List/list'
|
|
20
21
|
|
|
21
22
|
export let name: SvelteSelectProps['name'] = ''
|
|
22
23
|
export let value: SvelteSelectProps['value'] = ''
|
|
@@ -28,8 +29,11 @@
|
|
|
28
29
|
export let position: SvelteSelectProps['position'] = 'bottom'
|
|
29
30
|
export let className: SvelteSelectProps['className'] = ''
|
|
30
31
|
export let onChange: SvelteSelectProps['onChange'] = () => {}
|
|
32
|
+
export let onClose: SvelteSelectProps['onClose'] = () => {}
|
|
31
33
|
|
|
32
34
|
let popoverInstance: any
|
|
35
|
+
let val: string
|
|
36
|
+
let focusByTab = false
|
|
33
37
|
|
|
34
38
|
const classes = classNames([
|
|
35
39
|
styles.select,
|
|
@@ -42,11 +46,22 @@
|
|
|
42
46
|
styles.popover
|
|
43
47
|
])
|
|
44
48
|
|
|
49
|
+
const inferredValue = $$restProps.itemGroups
|
|
50
|
+
.map((group: ListProps['itemGroups'][0]) => group.items)
|
|
51
|
+
.flat()
|
|
52
|
+
.find((item: ListProps['itemGroups'][0]['items'][0]) => item.value === value)?.name
|
|
53
|
+
|
|
54
|
+
val = (value && inferredValue) ? inferredValue : value
|
|
55
|
+
|
|
56
|
+
const inputRestProps = Object.fromEntries(
|
|
57
|
+
Object.entries($$restProps).filter(([key]) => key.includes('data'))
|
|
58
|
+
)
|
|
59
|
+
|
|
45
60
|
const select = (event: ListEventType) => {
|
|
46
61
|
closePopover(`.w-options-${name}`)
|
|
47
62
|
|
|
48
63
|
if (updateValue) {
|
|
49
|
-
|
|
64
|
+
val = event.name
|
|
50
65
|
}
|
|
51
66
|
|
|
52
67
|
onChange?.({
|
|
@@ -58,6 +73,14 @@
|
|
|
58
73
|
onMount(() => {
|
|
59
74
|
let observer: ResizeObserver | undefined
|
|
60
75
|
|
|
76
|
+
on(document, 'keydown', (event: KeyboardEvent) => {
|
|
77
|
+
if (event.key === 'Tab') {
|
|
78
|
+
focusByTab = true
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
on(document, 'mousedown', () => focusByTab = false)
|
|
83
|
+
|
|
61
84
|
if (position === 'modal') {
|
|
62
85
|
modal({
|
|
63
86
|
trigger: `.w-select-${name}`,
|
|
@@ -68,6 +91,9 @@
|
|
|
68
91
|
if (search) {
|
|
69
92
|
search.focus()
|
|
70
93
|
}
|
|
94
|
+
},
|
|
95
|
+
onClose(event) {
|
|
96
|
+
onClose?.(event)
|
|
71
97
|
}
|
|
72
98
|
})
|
|
73
99
|
} else {
|
|
@@ -93,10 +119,19 @@
|
|
|
93
119
|
if (search) {
|
|
94
120
|
search.focus()
|
|
95
121
|
}
|
|
122
|
+
},
|
|
123
|
+
onClose(event) {
|
|
124
|
+
onClose?.(event)
|
|
96
125
|
}
|
|
97
126
|
})
|
|
98
127
|
}
|
|
99
128
|
|
|
129
|
+
on(`.w-select-${name}`, 'focus', (event: Event) => {
|
|
130
|
+
if (focusByTab) {
|
|
131
|
+
(event.currentTarget as HTMLInputElement).click()
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
100
135
|
return () => {
|
|
101
136
|
popoverInstance?.remove()
|
|
102
137
|
observer?.unobserve(document.body)
|
|
@@ -106,14 +141,15 @@
|
|
|
106
141
|
|
|
107
142
|
<Input
|
|
108
143
|
type="text"
|
|
109
|
-
value={
|
|
144
|
+
value={val}
|
|
110
145
|
readonly={true}
|
|
111
146
|
disabled={disabled}
|
|
112
|
-
placeholder={placeholder}
|
|
147
|
+
placeholder={placeholder || null}
|
|
113
148
|
label={label}
|
|
114
149
|
subText={subText}
|
|
115
150
|
className={`w-select-${name}`}
|
|
116
151
|
labelClassName={classes}
|
|
152
|
+
{...inputRestProps}
|
|
117
153
|
>
|
|
118
154
|
{@html ArrowDown}
|
|
119
155
|
</Input>
|
|
@@ -8,6 +8,7 @@ import Popover from '../Popover/Popover.tsx'
|
|
|
8
8
|
|
|
9
9
|
import { classNames } from '../../utils/classNames'
|
|
10
10
|
import { debounce } from '../../utils/debounce'
|
|
11
|
+
import { on } from '../../utils/DOMUtils'
|
|
11
12
|
import { modal } from '../../utils/modal'
|
|
12
13
|
import { closePopover, popover, type PopoverPosition } from '../../utils/popover'
|
|
13
14
|
|
|
@@ -28,9 +29,14 @@ const Select = ({
|
|
|
28
29
|
position = 'bottom',
|
|
29
30
|
className,
|
|
30
31
|
onChange,
|
|
32
|
+
onClose,
|
|
31
33
|
...rest
|
|
32
34
|
}: ReactSelectProps) => {
|
|
33
|
-
const
|
|
35
|
+
const inferredValue = rest.itemGroups.map(group => group.items)
|
|
36
|
+
.flat()
|
|
37
|
+
.find(item => item.value === value)?.name
|
|
38
|
+
|
|
39
|
+
const [val, setValue] = useState((value && inferredValue) ? inferredValue : value)
|
|
34
40
|
|
|
35
41
|
const classes = classNames([
|
|
36
42
|
styles.select,
|
|
@@ -42,7 +48,12 @@ const Select = ({
|
|
|
42
48
|
styles.popover
|
|
43
49
|
])
|
|
44
50
|
|
|
51
|
+
const inputRestProps = Object.fromEntries(
|
|
52
|
+
Object.entries(rest).filter(([key]) => key.includes('data'))
|
|
53
|
+
)
|
|
54
|
+
|
|
45
55
|
let popoverInstance: any
|
|
56
|
+
let focusByTab = false
|
|
46
57
|
|
|
47
58
|
const select = (event: ListEventType) => {
|
|
48
59
|
closePopover(`.w-options-${name}`)
|
|
@@ -60,6 +71,14 @@ const Select = ({
|
|
|
60
71
|
useEffect(() => {
|
|
61
72
|
let observer: ResizeObserver | undefined
|
|
62
73
|
|
|
74
|
+
on(document, 'keydown', (event: KeyboardEvent) => {
|
|
75
|
+
if (event.key === 'Tab') {
|
|
76
|
+
focusByTab = true
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
on(document, 'mousedown', () => focusByTab = false)
|
|
81
|
+
|
|
63
82
|
if (position === 'modal') {
|
|
64
83
|
modal({
|
|
65
84
|
trigger: `.w-select-${name}`,
|
|
@@ -70,6 +89,9 @@ const Select = ({
|
|
|
70
89
|
if (search) {
|
|
71
90
|
search.focus()
|
|
72
91
|
}
|
|
92
|
+
},
|
|
93
|
+
onClose(event) {
|
|
94
|
+
onClose?.(event)
|
|
73
95
|
}
|
|
74
96
|
})
|
|
75
97
|
} else {
|
|
@@ -96,11 +118,20 @@ const Select = ({
|
|
|
96
118
|
if (search) {
|
|
97
119
|
search.focus()
|
|
98
120
|
}
|
|
121
|
+
},
|
|
122
|
+
onClose(event) {
|
|
123
|
+
onClose?.(event)
|
|
99
124
|
}
|
|
100
125
|
})
|
|
101
126
|
}, 0)
|
|
102
127
|
}
|
|
103
128
|
|
|
129
|
+
on(`.w-select-${name}`, 'focus', (event: Event) => {
|
|
130
|
+
if (focusByTab) {
|
|
131
|
+
(event.currentTarget as HTMLInputElement).click()
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
104
135
|
return () => {
|
|
105
136
|
popoverInstance?.remove()
|
|
106
137
|
observer?.unobserve(document.body)
|
|
@@ -119,6 +150,7 @@ const Select = ({
|
|
|
119
150
|
subText={subText}
|
|
120
151
|
className={`w-select-${name}`}
|
|
121
152
|
labelClassName={classes}
|
|
153
|
+
{...inputRestProps}
|
|
122
154
|
>
|
|
123
155
|
<span
|
|
124
156
|
dangerouslySetInnerHTML={{ __html: ArrowDown }}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModalCallback } from '../../utils/modal'
|
|
2
|
+
import type { PopoverCallback, PopoverPosition } from '../../utils/popover'
|
|
2
3
|
|
|
3
4
|
import type { ListEventType, ListProps } from '../List/list'
|
|
4
5
|
|
|
@@ -19,8 +20,10 @@ export type SelectProps = {
|
|
|
19
20
|
|
|
20
21
|
export type SvelteSelectProps = {
|
|
21
22
|
onChange?: (event: SelectEventType) => void
|
|
23
|
+
onClose?: (event: ModalCallback | PopoverCallback) => void
|
|
22
24
|
} & SelectProps
|
|
23
25
|
|
|
24
26
|
export type ReactSelectProps = {
|
|
25
27
|
onChange?: (event: SelectEventType) => void
|
|
28
|
+
onClose?: (event: ModalCallback | PopoverCallback) => void
|
|
26
29
|
} & SelectProps
|
|
@@ -25,8 +25,8 @@ const classes = [
|
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
const styleVariables = classNames([
|
|
28
|
-
width && `width: ${width}px;`,
|
|
29
|
-
height && `height: ${height}px;`,
|
|
28
|
+
width && `max-width: ${width}px;`,
|
|
29
|
+
height && `max-height: ${height}px;`,
|
|
30
30
|
color && `--w-skeleton-color: ${color};`,
|
|
31
31
|
waveColor && `--w-skeleton-wave-color: ${waveColor};`
|
|
32
32
|
])
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
])
|
|
22
22
|
|
|
23
23
|
const styleVariables = classNames([
|
|
24
|
-
width && `width: ${width}px;`,
|
|
25
|
-
height && `height: ${height}px;`,
|
|
24
|
+
width && `max-width: ${width}px;`,
|
|
25
|
+
height && `max-height: ${height}px;`,
|
|
26
26
|
color && `--w-skeleton-color: ${color};`,
|
|
27
27
|
waveColor && `--w-skeleton-wave-color: ${waveColor};`
|
|
28
28
|
])
|
|
@@ -22,8 +22,8 @@ const Skeleton = ({
|
|
|
22
22
|
])
|
|
23
23
|
|
|
24
24
|
const styleVariables = {
|
|
25
|
-
...(width && {
|
|
26
|
-
...(height && {
|
|
25
|
+
...(width && { maxWidth: `${width}px` }),
|
|
26
|
+
...(height && { maxHeight: `${height}px` }),
|
|
27
27
|
...(color && { '--w-skeleton-color': color }),
|
|
28
28
|
...(waveColor && { '--w-skeleton-wave-color': waveColor })
|
|
29
29
|
} as React.CSSProperties
|
|
@@ -16,7 +16,8 @@ const {
|
|
|
16
16
|
small,
|
|
17
17
|
square,
|
|
18
18
|
disabled,
|
|
19
|
-
className
|
|
19
|
+
className,
|
|
20
|
+
...rest
|
|
20
21
|
} = Astro.props
|
|
21
22
|
|
|
22
23
|
const classes = [
|
|
@@ -35,7 +36,7 @@ const styleVariables = classNames([
|
|
|
35
36
|
---
|
|
36
37
|
|
|
37
38
|
<label class:list={classes} style={styleVariables}>
|
|
38
|
-
<input type="checkbox" checked={toggled} disabled={disabled} />
|
|
39
|
+
<input type="checkbox" checked={toggled} disabled={disabled} {...rest} />
|
|
39
40
|
<span class={styles.toggle}></span>
|
|
40
41
|
{label && <span class={styles.label}>{label}</span>}
|
|
41
42
|
</label>
|
|
@@ -15,7 +15,8 @@ const Switch = ({
|
|
|
15
15
|
square,
|
|
16
16
|
disabled,
|
|
17
17
|
className,
|
|
18
|
-
onClick
|
|
18
|
+
onClick,
|
|
19
|
+
...rest
|
|
19
20
|
}: ReactSwitchProps) => {
|
|
20
21
|
const classes = classNames([
|
|
21
22
|
styles.switch,
|
|
@@ -38,6 +39,7 @@ const Switch = ({
|
|
|
38
39
|
defaultChecked={toggled}
|
|
39
40
|
disabled={disabled}
|
|
40
41
|
onClick={onClick}
|
|
42
|
+
{...rest}
|
|
41
43
|
/>
|
|
42
44
|
<span className={styles.toggle}></span>
|
|
43
45
|
{label && <span className={styles.label}>{label}</span>}
|
|
@@ -13,7 +13,8 @@ const {
|
|
|
13
13
|
subText,
|
|
14
14
|
value = '',
|
|
15
15
|
disabled,
|
|
16
|
-
className
|
|
16
|
+
className,
|
|
17
|
+
...rest
|
|
17
18
|
} = Astro.props
|
|
18
19
|
|
|
19
20
|
const classes = [
|
|
@@ -41,5 +42,6 @@ const useLabel = !!(label || subText)
|
|
|
41
42
|
placeholder={placeholder}
|
|
42
43
|
disabled={disabled}
|
|
43
44
|
class:list={classes}
|
|
45
|
+
{...rest}
|
|
44
46
|
>{value}</textarea>
|
|
45
47
|
</ConditionalWrapper>
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { SvelteTextareaProps } from './textarea'
|
|
3
|
-
|
|
4
|
-
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
|
-
|
|
6
|
-
import { classNames } from '../../utils/classNames'
|
|
7
|
-
|
|
8
|
-
import styles from './textarea.module.scss'
|
|
9
|
-
|
|
10
|
-
export let label: SvelteTextareaProps['label'] = ''
|
|
11
|
-
export let placeholder: SvelteTextareaProps['placeholder'] = ''
|
|
12
|
-
export let subText: SvelteTextareaProps['subText'] = ''
|
|
13
|
-
export let value: SvelteTextareaProps['value'] = ''
|
|
14
|
-
export let disabled: SvelteTextareaProps['disabled'] = false
|
|
15
|
-
export let className: SvelteTextareaProps['className'] = ''
|
|
16
|
-
export let onChange: SvelteTextareaProps['onChange'] = () => {}
|
|
17
|
-
export let onKeyUp: SvelteTextareaProps['onKeyUp'] = () => {}
|
|
18
|
-
|
|
19
|
-
const classes = classNames([
|
|
20
|
-
styles.textarea,
|
|
21
|
-
className
|
|
22
|
-
])
|
|
23
|
-
|
|
24
|
-
const useLabel = !!(label || subText)
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<ConditionalWrapper
|
|
28
|
-
condition={useLabel}
|
|
29
|
-
element="label"
|
|
30
|
-
class={styles['label-wrapper']}
|
|
31
|
-
>
|
|
32
|
-
{#if label}
|
|
33
|
-
<div class={styles.label}>{label}</div>
|
|
34
|
-
{/if}
|
|
35
|
-
<textarea
|
|
36
|
-
placeholder={placeholder}
|
|
37
|
-
disabled={disabled}
|
|
38
|
-
class={classes}
|
|
39
|
-
on:change={onChange}
|
|
40
|
-
on:keyup={onKeyUp}
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteTextareaProps } from './textarea'
|
|
3
|
+
|
|
4
|
+
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
|
+
|
|
6
|
+
import { classNames } from '../../utils/classNames'
|
|
7
|
+
|
|
8
|
+
import styles from './textarea.module.scss'
|
|
9
|
+
|
|
10
|
+
export let label: SvelteTextareaProps['label'] = ''
|
|
11
|
+
export let placeholder: SvelteTextareaProps['placeholder'] = ''
|
|
12
|
+
export let subText: SvelteTextareaProps['subText'] = ''
|
|
13
|
+
export let value: SvelteTextareaProps['value'] = ''
|
|
14
|
+
export let disabled: SvelteTextareaProps['disabled'] = false
|
|
15
|
+
export let className: SvelteTextareaProps['className'] = ''
|
|
16
|
+
export let onChange: SvelteTextareaProps['onChange'] = () => {}
|
|
17
|
+
export let onKeyUp: SvelteTextareaProps['onKeyUp'] = () => {}
|
|
18
|
+
|
|
19
|
+
const classes = classNames([
|
|
20
|
+
styles.textarea,
|
|
21
|
+
className
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
const useLabel = !!(label || subText)
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<ConditionalWrapper
|
|
28
|
+
condition={useLabel}
|
|
29
|
+
element="label"
|
|
30
|
+
class={styles['label-wrapper']}
|
|
31
|
+
>
|
|
32
|
+
{#if label}
|
|
33
|
+
<div class={styles.label}>{label}</div>
|
|
34
|
+
{/if}
|
|
35
|
+
<textarea
|
|
36
|
+
placeholder={placeholder}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
class={classes}
|
|
39
|
+
on:change={onChange}
|
|
40
|
+
on:keyup={onKeyUp}
|
|
41
|
+
{...$$restProps}
|
|
42
|
+
>{value}</textarea>
|
|
43
|
+
{#if subText}
|
|
44
|
+
<div class={styles.subtext}>
|
|
45
|
+
{@html subText}
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
</ConditionalWrapper>
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export type TextareaProps = {
|
|
2
|
-
label?: string
|
|
3
|
-
placeholder?: string
|
|
4
|
-
subText?: string
|
|
5
|
-
value?: string
|
|
6
|
-
disabled?: boolean
|
|
7
|
-
className?: string
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
export type TextareaProps = {
|
|
2
|
+
label?: string
|
|
3
|
+
placeholder?: string
|
|
4
|
+
subText?: string
|
|
5
|
+
value?: string
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
className?: string
|
|
8
|
+
[key: string]: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type SvelteTextareaProps = {
|
|
12
|
+
onChange?: (e: any) => any
|
|
13
|
+
onKeyUp?: (e: any) => any
|
|
14
|
+
} & TextareaProps
|
|
15
|
+
|
|
16
|
+
export type ReactTextareaProps = {
|
|
17
|
+
onChange?: (e: any) => any
|
|
18
|
+
onKeyUp?: (e: any) => any
|
|
19
|
+
} & TextareaProps
|
package/icons/copy.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M22.791 13.0523C23 12.5476 23 11.9059 23 10.625C23 9.34411 23 8.70244 22.791 8.19767C22.6528 7.86392 22.4502 7.56066 22.1948 7.30524C21.9393 7.04981 21.6361 6.8472 21.3023 6.709C20.7976 6.5 20.1559 6.5 18.875 6.5H10.9C9.36 6.5 8.59 6.5 8.00211 6.79944C7.48421 7.06318 7.06318 7.48421 6.79944 8.00211C6.5 8.58878 6.5 9.35878 6.5 10.9V18.875C6.5 20.1559 6.5 20.7976 6.709 21.3023C6.98889 21.9758 7.52422 22.5123 8.19767 22.791C8.70244 23 9.34411 23 10.625 23C11.9059 23 12.5476 23 13.0523 22.791M22.791 13.0523C22.6528 13.3861 22.4502 13.6893 22.1948 13.9448C21.9393 14.2002 21.6361 14.4028 21.3023 14.541C20.7976 14.75 20.1559 14.75 18.875 14.75C17.5941 14.75 16.9524 14.75 16.4477 14.959C16.1139 15.0972 15.8107 15.2998 15.5552 15.5552C15.2998 15.8107 15.0972 16.1139 14.959 16.4477C14.75 16.9524 14.75 17.5941 14.75 18.875C14.75 20.1559 14.75 20.7976 14.541 21.3023C14.4028 21.6361 14.2002 21.9393 13.9448 22.1948C13.6893 22.4502 13.3861 22.6528 13.0523 22.791M22.791 13.0523C22.1337 15.3195 20.9244 17.3883 19.2713 19.0734C17.6182 20.7585 15.573 22.0073 13.3188 22.7079L13.0523 22.791M17.5 6.5V5.4C17.5 3.86 17.5 3.09 17.2006 2.50211C16.9371 1.98439 16.5166 1.56338 15.9991 1.29944C15.41 1 14.64 1 13.1 1H5.4C3.86 1 3.09 1 2.50211 1.29944C1.98421 1.56318 1.56318 1.98421 1.29944 2.50211C1 3.08878 1 3.85878 1 5.4V13.1C1 14.64 1 15.41 1.29944 15.9979C1.56344 16.5161 1.98389 16.9366 2.50211 17.2006C3.08878 17.5 3.86 17.5 5.40122 17.5H6.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
package/icons.d.ts
CHANGED
package/icons.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as circleCheck } from './icons/circle-check.svg?raw'
|
|
|
7
7
|
export { default as circleClose } from './icons/circle-close.svg?raw'
|
|
8
8
|
export { default as close } from './icons/close.svg?raw'
|
|
9
9
|
export { default as components } from './icons/components.svg?raw'
|
|
10
|
+
export { default as copy } from './icons/copy.svg?raw'
|
|
10
11
|
export { default as file } from './icons/file.svg?raw'
|
|
11
12
|
export { default as github } from './icons/github.svg?raw'
|
|
12
13
|
export { default as home } from './icons/home.svg?raw'
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,73 @@
|
|
|
1
1
|
|
|
2
|
+
export type Gap = 'none'
|
|
3
|
+
| 'xxs'
|
|
4
|
+
| 'xs'
|
|
5
|
+
| 'sm'
|
|
6
|
+
| 'md'
|
|
7
|
+
| 'default'
|
|
8
|
+
| 'lg'
|
|
9
|
+
| 'xl'
|
|
10
|
+
| 'xl2'
|
|
11
|
+
| 'xl3'
|
|
12
|
+
| 'xl4'
|
|
13
|
+
| 'xl5'
|
|
14
|
+
| ''
|
|
15
|
+
|
|
16
|
+
export type VerticalAlignment = 'center'
|
|
17
|
+
| 'start'
|
|
18
|
+
| 'end'
|
|
19
|
+
| 'baseline'
|
|
20
|
+
| 'stretch'
|
|
21
|
+
| ''
|
|
22
|
+
|
|
23
|
+
export type HorizontalAlignment = 'center'
|
|
24
|
+
| 'start'
|
|
25
|
+
| 'end'
|
|
26
|
+
| 'between'
|
|
27
|
+
| 'around'
|
|
28
|
+
| 'evenly'
|
|
29
|
+
| 'stretch'
|
|
30
|
+
| ''
|
|
31
|
+
|
|
32
|
+
export type Direction = 'row'
|
|
33
|
+
| 'column'
|
|
34
|
+
| 'row-reverse'
|
|
35
|
+
| 'column-reverse'
|
|
36
|
+
| ''
|
|
37
|
+
|
|
38
|
+
export type Wrap = 'wrap'
|
|
39
|
+
| 'nowrap'
|
|
40
|
+
| 'wrap-reverse'
|
|
41
|
+
| ''
|
|
42
|
+
|
|
43
|
+
export type Column = (2 | 3) | {
|
|
44
|
+
default?: 2 | 3
|
|
45
|
+
xs?: 2 | 3 | 4
|
|
46
|
+
sm?: 2 | 3 | 4
|
|
47
|
+
md?: 2 | 3 | 4 | 5 | 6
|
|
48
|
+
lg?: 2 | 3 | 4 | 5 | 6 | 7 | 8
|
|
49
|
+
} | null
|
|
50
|
+
|
|
51
|
+
export type Responsive<T> = T | {
|
|
52
|
+
default?: T
|
|
53
|
+
xs?: T
|
|
54
|
+
sm?: T
|
|
55
|
+
md?: T
|
|
56
|
+
lg?: T
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type Alignment = {
|
|
60
|
+
horizontal?: HorizontalAlignment
|
|
61
|
+
vertical?: VerticalAlignment
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type getLayoutClassesConfig = {
|
|
65
|
+
gap?: Responsive<Gap>
|
|
66
|
+
alignment?: Responsive<Alignment>
|
|
67
|
+
direction?: Responsive<Direction>
|
|
68
|
+
wrap?: Responsive<Wrap>
|
|
69
|
+
}
|
|
70
|
+
|
|
2
71
|
export type ModalCallback = {
|
|
3
72
|
trigger: Element | null
|
|
4
73
|
modal: HTMLElement
|
|
@@ -36,6 +105,7 @@ export type Popover = {
|
|
|
36
105
|
position?: PopoverPosition
|
|
37
106
|
offset?: number
|
|
38
107
|
closeOnBlur?: boolean
|
|
108
|
+
closeOnEsc?: boolean
|
|
39
109
|
onOpen?: (args: PopoverCallback) => unknown
|
|
40
110
|
onClose?: (args: PopoverCallback) => unknown
|
|
41
111
|
}
|
|
@@ -68,9 +138,9 @@ declare module 'webcoreui' {
|
|
|
68
138
|
cancel: () => void
|
|
69
139
|
}
|
|
70
140
|
|
|
71
|
-
export const get: (selector: string, all
|
|
141
|
+
export const get: (selector: string, all?: boolean) => Element | NodeListOf<Element> | null
|
|
72
142
|
export const on: (
|
|
73
|
-
selector: string | HTMLElement,
|
|
143
|
+
selector: string | HTMLElement | Document,
|
|
74
144
|
event: string,
|
|
75
145
|
callback: any,
|
|
76
146
|
all?: boolean
|
|
@@ -81,6 +151,8 @@ declare module 'webcoreui' {
|
|
|
81
151
|
remove: () => void
|
|
82
152
|
}
|
|
83
153
|
|
|
154
|
+
export const getLayoutClasses: (config: getLayoutClassesConfig) => string
|
|
155
|
+
|
|
84
156
|
export const clamp: (num: number, min: number, max: number) => number
|
|
85
157
|
export const lerp: (start: number, end: number, value: number) => number
|
|
86
158
|
export const invlerp: (start: number, end: number, value: number) => number
|
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './utils/cookies.ts'
|
|
|
3
3
|
export * from './utils/debounce.ts'
|
|
4
4
|
export * from './utils/DOMUtils.ts'
|
|
5
5
|
export * from './utils/event.ts'
|
|
6
|
+
export * from './utils/getLayoutClasses.ts'
|
|
6
7
|
export * from './utils/interpolate.ts'
|
|
7
8
|
export * from './utils/modal.ts'
|
|
8
9
|
export * from './utils/popover.ts'
|
package/package.json
CHANGED
|
@@ -1,40 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcoreui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky",
|
|
7
7
|
"pre-commit": "lint-staged",
|
|
8
8
|
"dev": "astro dev",
|
|
9
9
|
"build": "astro check && astro build",
|
|
10
10
|
"build:package": "node scripts/build.js",
|
|
11
|
-
"
|
|
11
|
+
"build:local": "node scripts/build.js --local",
|
|
12
|
+
"compile": "node scripts/sass.js",
|
|
13
|
+
"test": "cd .. && vitest run && npm run test:sass",
|
|
14
|
+
"test:dev": "vitest",
|
|
15
|
+
"test:run": "vitest run",
|
|
16
|
+
"test:sass": "vitest run src/tests/scss.test.js --config astro.config.mjs",
|
|
12
17
|
"create-component": "node scripts/createComponent.js",
|
|
13
18
|
"lint": "eslint src/**/* --fix"
|
|
14
19
|
},
|
|
15
20
|
"devDependencies": {
|
|
16
21
|
"@astrojs/check": "0.9.4",
|
|
17
|
-
"@astrojs/node": "
|
|
22
|
+
"@astrojs/node": "9.0.0",
|
|
18
23
|
"@astrojs/react": "3.6.2",
|
|
19
|
-
"@astrojs/svelte": "
|
|
20
|
-
"@eslint/js": "9.
|
|
21
|
-
"@typescript-eslint/parser": "8.
|
|
22
|
-
"astro": "
|
|
23
|
-
"astro-eslint-parser": "1.0
|
|
24
|
+
"@astrojs/svelte": "7.0.1",
|
|
25
|
+
"@eslint/js": "9.16.0",
|
|
26
|
+
"@typescript-eslint/parser": "8.18.0",
|
|
27
|
+
"astro": "5.0.5",
|
|
28
|
+
"astro-eslint-parser": "1.1.0",
|
|
24
29
|
"eslint": "9.9.1",
|
|
25
|
-
"eslint-plugin-astro": "1.
|
|
30
|
+
"eslint-plugin-astro": "1.3.1",
|
|
26
31
|
"eslint-plugin-react": "7.35.0",
|
|
27
32
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
28
33
|
"eslint-plugin-svelte": "2.43.0",
|
|
29
|
-
"husky": "9.1.
|
|
30
|
-
"
|
|
34
|
+
"husky": "9.1.7",
|
|
35
|
+
"jsdom": "25.0.1",
|
|
36
|
+
"lint-staged": "15.2.11",
|
|
31
37
|
"react": "18.3.1",
|
|
32
38
|
"react-dom": "18.3.1",
|
|
33
|
-
"sass": "1.
|
|
34
|
-
"
|
|
39
|
+
"sass": "1.82.0",
|
|
40
|
+
"sass-true": "8.1.0",
|
|
41
|
+
"svelte": "5.12.0",
|
|
35
42
|
"svelte-eslint-parser": "0.41.0",
|
|
36
|
-
"typescript": "5.
|
|
37
|
-
"typescript-eslint": "8.
|
|
43
|
+
"typescript": "5.7.2",
|
|
44
|
+
"typescript-eslint": "8.18.0",
|
|
45
|
+
"vite-tsconfig-paths": "5.1.4",
|
|
46
|
+
"vitest": "2.1.8"
|
|
38
47
|
},
|
|
39
48
|
"exports": {
|
|
40
49
|
".": "./index.js",
|