winduum 2.2.9 → 2.2.11
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/dist/main.css +1 -1
- package/package.json +13 -14
- package/plugin/index.cjs +219 -217
- package/plugin/index.js +94 -94
- package/plugin/utilities/color.js +52 -50
- package/plugin/utilities/common.js +60 -60
- package/plugin/utilities/divide-gap.js +19 -19
- package/plugin/utilities/dot.js +10 -10
- package/src/base/defaults.css +2 -2
- package/src/base/reset.css +4 -2
- package/src/common.js +6 -6
- package/src/components/badge/props/default.css +2 -1
- package/src/components/breadcrumb/default.css +2 -1
- package/src/components/breadcrumb/props/default.css +2 -1
- package/src/components/button/interactive.css +3 -1
- package/src/components/button/props/default.css +2 -1
- package/src/components/button/props/interactive.css +2 -1
- package/src/components/card/props/default.css +2 -1
- package/src/components/carousel/content.css +2 -1
- package/src/components/carousel/index.js +128 -126
- package/src/components/check/default.css +1 -1
- package/src/components/check/props/default.css +4 -3
- package/src/components/color/default.css +2 -1
- package/src/components/color/interactive.css +2 -1
- package/src/components/color/props/default.css +3 -2
- package/src/components/compare/default.css +2 -1
- package/src/components/compare/index.js +9 -9
- package/src/components/control/icon.css +4 -2
- package/src/components/control/interactive.css +2 -1
- package/src/components/control/props/color.css +2 -1
- package/src/components/control/props/default.css +5 -4
- package/src/components/control/props/floating.css +2 -1
- package/src/components/control/props/icon.css +2 -1
- package/src/components/control/props/select-picker.css +4 -3
- package/src/components/control/props/select.css +2 -1
- package/src/components/control/select-picker.css +4 -2
- package/src/components/control/select.css +1 -1
- package/src/components/details/index.js +39 -38
- package/src/components/dialog/default.css +2 -1
- package/src/components/dialog/index.d.ts +1 -1
- package/src/components/dialog/index.js +42 -40
- package/src/components/dialog/props/content.css +2 -1
- package/src/components/dialog/props/default.css +2 -1
- package/src/components/drawer/default.css +2 -1
- package/src/components/drawer/index.js +29 -29
- package/src/components/drawer/props/content.css +2 -1
- package/src/components/drawer/props/default.css +2 -1
- package/src/components/form/index.js +83 -80
- package/src/components/heading/props/default.css +2 -1
- package/src/components/info/props/default.css +2 -1
- package/src/components/label/props/default.css +2 -1
- package/src/components/link/props/default.css +2 -1
- package/src/components/notice/props/default.css +2 -1
- package/src/components/popover/content.css +4 -2
- package/src/components/popover/index.js +45 -44
- package/src/components/popover/props/content.css +2 -1
- package/src/components/progress/props/default.css +2 -1
- package/src/components/range/index.js +37 -37
- package/src/components/range/props/default.css +2 -1
- package/src/components/rating/default.css +1 -1
- package/src/components/rating/props/default.css +2 -1
- package/src/components/switch/props/default.css +4 -3
- package/src/components/table/interactive.css +10 -5
- package/src/components/table/props/default.css +2 -1
- package/src/components/tabs/index.js +5 -5
- package/src/components/text/default.css +16 -1
- package/src/components/text/props/default.css +2 -1
- package/src/components/title/props/default.css +2 -1
- package/src/components/toast/index.js +25 -25
- package/src/components/toast/props/content.css +2 -1
- package/src/components/toast/props/default.css +2 -1
- package/src/components/toaster/index.js +3 -3
- package/src/components/toaster/props/default.css +2 -1
- package/src/components/tooltip/default.css +4 -2
- package/src/components/tooltip/props/default.css +2 -1
- package/src/theme/config/font.css +2 -1
- package/src/theme/config/radius.css +2 -1
- package/src/theme/config/spacing.css +2 -1
- package/src/theme/config/transition.css +2 -1
- package/src/theme/config/z.css +2 -1
- package/src/theme/dark-rgb.css +2 -1
- package/src/theme/dark.css +2 -1
- package/src/theme/default-p3.css +2 -1
- package/src/theme/default-rgb.css +3 -2
- package/src/theme/default.css +3 -2
- package/src/utilities/container/props/default.css +2 -1
- package/src/utilities/divider.css +5 -3
- package/src/utilities/dot.css +1 -1
- package/src/utilities/ripple/index.js +13 -13
- package/src/utilities/skeleton/props/default.css +2 -1
- package/src/utilities/spinner/default.css +4 -4
- package/src/utilities/spinner/ring.css +1 -1
- package/src/utilities/swap/index.js +4 -4
- package/tailwind.config.js +16 -17
- package/tailwindcss/base/defaults.css +3 -2
- package/tailwindcss/theme/config/transition.css +2 -1
- package/tailwindcss/theme/default.css +1 -1
- package/tailwindcss/utilities/divider.css +4 -2
- package/tailwindcss/utilities/dot.css +1 -1
- package/tailwindcss/utilities/spinner.css +5 -5
- package/types/index.d.ts +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @type {import("./").DefaultOptions}
|
|
3
3
|
*/
|
|
4
4
|
export const defaultOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
selector: 'details',
|
|
6
|
+
summarySelector: 'summary',
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -12,21 +12,21 @@ export const defaultOptions = {
|
|
|
12
12
|
* @returns Promise<void>
|
|
13
13
|
*/
|
|
14
14
|
export const showDetails = async (element, options = {}) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
options = {
|
|
16
|
+
...defaultOptions,
|
|
17
|
+
...options,
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const details = element.closest(options.selector)
|
|
21
|
+
const { down } = await import('slide-element')
|
|
22
|
+
const content = details.querySelector(options.summarySelector).nextElementSibling
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
details._isHiding = false
|
|
25
|
+
details.open = true
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
await down(content, {
|
|
28
|
+
display: '',
|
|
29
|
+
})
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -35,23 +35,23 @@ export const showDetails = async (element, options = {}) => {
|
|
|
35
35
|
* @returns Promise<void>
|
|
36
36
|
*/
|
|
37
37
|
export const closeDetails = async (element, options = {}) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
options = {
|
|
39
|
+
...defaultOptions,
|
|
40
|
+
...options,
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const details = element.closest(options.selector)
|
|
44
|
+
const { up } = await import('slide-element')
|
|
45
|
+
const content = details.querySelector(options.summarySelector).nextElementSibling
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
details._isHiding = true
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
await up(content, {
|
|
50
|
+
display: '',
|
|
51
|
+
})
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
details._isHiding && (details.open = false)
|
|
54
|
+
details._isHiding = false
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -60,18 +60,19 @@ export const closeDetails = async (element, options = {}) => {
|
|
|
60
60
|
* @returns Promise<void>
|
|
61
61
|
*/
|
|
62
62
|
export const toggleDetails = async (element, options = {}) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
options = {
|
|
64
|
+
...defaultOptions,
|
|
65
|
+
...options,
|
|
66
|
+
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
const details = element.closest(options.selector)
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
if (details._isHiding && !element.checked) return
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
if (element.checked ?? !details.open) {
|
|
73
|
+
await showDetails(element, options)
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
await closeDetails(element, options)
|
|
77
|
+
}
|
|
77
78
|
}
|
|
@@ -4,12 +4,12 @@ import { animationsFinished, nextRepaint } from '../../common.js'
|
|
|
4
4
|
* @type {import("./").DefaultOptions}
|
|
5
5
|
*/
|
|
6
6
|
export const defaultOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
closedAttribute: 'data-closed',
|
|
8
|
+
openAttribute: 'data-open',
|
|
9
|
+
scrollbarWidthProperty: '--default-scrollbar-width',
|
|
10
|
+
contentSelector: '.x-dialog-content',
|
|
11
|
+
closable: true,
|
|
12
|
+
modal: true,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -19,38 +19,40 @@ export const defaultOptions = {
|
|
|
19
19
|
* @returns Promise<void>
|
|
20
20
|
*/
|
|
21
21
|
export const showDialog = async (element, options = {}) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
options = {
|
|
23
|
+
...defaultOptions,
|
|
24
|
+
...options,
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
+
if (options.scrollbarWidthProperty) {
|
|
27
28
|
document.documentElement.style.setProperty(options.scrollbarWidthProperty, `${window.innerWidth - document.body.clientWidth}px`)
|
|
29
|
+
}
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (!element?._dialogHasEvents) {
|
|
32
|
+
element.addEventListener('cancel', (e) => {
|
|
33
|
+
e.preventDefault()
|
|
34
|
+
options.closable && closeDialog(element, options)
|
|
35
|
+
})
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
element.addEventListener('click', ({ target }) => {
|
|
38
|
+
if (target.nodeName === 'DIALOG' && options.closable) {
|
|
39
|
+
closeDialog(element, options)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
element._dialogHasEvents = true
|
|
44
|
+
}
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
element.setAttribute(options.closedAttribute, '')
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
options.modal ? element.showModal() : element.show()
|
|
49
|
+
element.scroll(0, 0)
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
element.removeAttribute(options.closedAttribute)
|
|
52
|
+
await animationsFinished(element.querySelector(options.contentSelector))
|
|
53
|
+
element.setAttribute(options.openAttribute, '')
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
element.dispatchEvent(new CustomEvent('x-dialog:show'))
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/**
|
|
@@ -60,21 +62,21 @@ export const showDialog = async (element, options = {}) => {
|
|
|
60
62
|
* @returns Promise<void>
|
|
61
63
|
*/
|
|
62
64
|
export const closeDialog = async (element, options = {}) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
options = {
|
|
66
|
+
...defaultOptions,
|
|
67
|
+
...options,
|
|
68
|
+
}
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
element.dispatchEvent(new CustomEvent('x-dialog:close'))
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
element.removeAttribute(options.openAttribute)
|
|
73
|
+
element.setAttribute(options.closedAttribute, '')
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
await animationsFinished(element.querySelector(options.contentSelector))
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
element.close()
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
await nextRepaint()
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
options.remove && element.remove()
|
|
80
82
|
}
|
|
@@ -7,7 +7,7 @@ import { nextRepaint } from '../../common.js'
|
|
|
7
7
|
* @returns void
|
|
8
8
|
*/
|
|
9
9
|
export const showDrawer = async (element, distance = 0, direction = 'left') => {
|
|
10
|
-
|
|
10
|
+
element.scroll({ [direction]: distance })
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -17,7 +17,7 @@ export const showDrawer = async (element, distance = 0, direction = 'left') => {
|
|
|
17
17
|
* @returns void
|
|
18
18
|
*/
|
|
19
19
|
export const closeDrawer = (element, distance = element.scrollWidth, direction = 'left') => {
|
|
20
|
-
|
|
20
|
+
element.scroll({ [direction]: distance })
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -27,8 +27,8 @@ export const closeDrawer = (element, distance = element.scrollWidth, direction =
|
|
|
27
27
|
* @returns void
|
|
28
28
|
*/
|
|
29
29
|
export const scrollInitDrawer = async (element, distance = element.scrollWidth, direction = 'left') => {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
element.scroll({ [direction]: distance, behavior: 'instant' })
|
|
31
|
+
await nextRepaint()
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -38,9 +38,9 @@ export const scrollInitDrawer = async (element, distance = element.scrollWidth,
|
|
|
38
38
|
* @returns void
|
|
39
39
|
*/
|
|
40
40
|
export const toggleDrawerAttributes = (element, state = 'open', snapClass) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
element.classList[state === 'open' ? 'add' : 'remove'](...snapClass.split(/\s/))
|
|
42
|
+
element.inert = state === 'close'
|
|
43
|
+
element.dispatchEvent(new CustomEvent(`x-drawer:${state}`))
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -49,7 +49,7 @@ export const toggleDrawerAttributes = (element, state = 'open', snapClass) => {
|
|
|
49
49
|
* @returns boolean
|
|
50
50
|
*/
|
|
51
51
|
export const scrollDrawerState = (scrollState, scrollDirection) => {
|
|
52
|
-
|
|
52
|
+
return scrollState ? Math.ceil(scrollDirection) >= scrollState : Math.floor(scrollDirection) <= scrollState
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -58,28 +58,28 @@ export const scrollDrawerState = (scrollState, scrollDirection) => {
|
|
|
58
58
|
* @returns void
|
|
59
59
|
*/
|
|
60
60
|
export const scrollDrawer = (element, options = {}) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
options = {
|
|
62
|
+
snapClass: 'snap-x snap-mandatory',
|
|
63
|
+
opacityProperty: '--background-color-opacity',
|
|
64
|
+
opacityRatio: 1,
|
|
65
|
+
scrollOpen: 0,
|
|
66
|
+
scrollClose: element.scrollWidth - element.clientWidth,
|
|
67
|
+
scrollSize: element.scrollWidth - element.clientWidth,
|
|
68
|
+
scrollDirection: element.scrollLeft,
|
|
69
|
+
...options,
|
|
70
|
+
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
element.style.setProperty(
|
|
73
|
+
options.opacityProperty,
|
|
74
|
+
`${Math.min(Math.abs((options.scrollDirection / options.scrollSize) - options.opacityRatio), 1)}`,
|
|
75
|
+
)
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (scrollDrawerState(options.scrollOpen, options.scrollDirection)) {
|
|
78
|
+
toggleDrawerAttributes(element, 'open', options.snapClass)
|
|
79
|
+
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if (scrollDrawerState(options.scrollClose, options.scrollDirection) && !element.inert) {
|
|
82
|
+
toggleDrawerAttributes(element, 'close', options.snapClass)
|
|
83
|
+
element.close && element.close()
|
|
84
|
+
}
|
|
85
85
|
}
|
|
@@ -4,32 +4,33 @@
|
|
|
4
4
|
* @returns void
|
|
5
5
|
*/
|
|
6
6
|
export const validateForm = (event, options = {}) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
options = {
|
|
8
|
+
validateSelectors: '.x-control, .x-check, .x-switch, .x-rating, .x-color',
|
|
9
|
+
validateOptions: {
|
|
10
|
+
validate: true,
|
|
11
|
+
},
|
|
12
|
+
validateField,
|
|
13
|
+
submitterLoadingAttribute: 'data-loading',
|
|
14
|
+
scrollOptions: { behavior: 'smooth', block: 'center' },
|
|
15
|
+
...options,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (options.validateOptions.validate) {
|
|
19
|
+
if (!event.target.checkValidity()) {
|
|
20
|
+
event.preventDefault()
|
|
21
|
+
event.stopImmediatePropagation()
|
|
22
|
+
|
|
23
|
+
event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
|
|
24
|
+
event.target.querySelector(':invalid').focus()
|
|
16
25
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!event.target.checkValidity()) {
|
|
20
|
-
event.preventDefault()
|
|
21
|
-
event.stopImmediatePropagation()
|
|
22
|
-
|
|
23
|
-
event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
|
|
24
|
-
event.target.querySelector(':invalid').focus()
|
|
25
|
-
} else {
|
|
26
|
-
event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
|
|
27
|
-
}
|
|
26
|
+
else {
|
|
27
|
+
event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
|
|
28
28
|
}
|
|
29
|
+
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
event.target.querySelectorAll(options.validateSelectors).forEach((element) => {
|
|
32
|
+
options.validateField(element, options.validateOptions)
|
|
33
|
+
})
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -38,75 +39,77 @@ export const validateForm = (event, options = {}) => {
|
|
|
38
39
|
* @returns void
|
|
39
40
|
*/
|
|
40
41
|
export const validateField = (element, options = {}) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
options = {
|
|
43
|
+
validate: true,
|
|
44
|
+
selector: 'input:not([type="hidden"]), textarea, select',
|
|
45
|
+
ignoreMatch: /(data-novalidate|readonly)/,
|
|
46
|
+
validitySelector: '.validity',
|
|
47
|
+
infoParentSelector: '.x-field',
|
|
48
|
+
infoSelector: '.x-info',
|
|
49
|
+
infoContent: '<div class="x-info text-error validity"></div>',
|
|
50
|
+
endParentSelector: '.x-control',
|
|
51
|
+
endSelector: '.ms-auto',
|
|
52
|
+
endContent: '<div class="ms-auto"></div>',
|
|
53
|
+
validAttribute: 'data-valid',
|
|
54
|
+
validIcon: null,
|
|
55
|
+
invalidAttribute: 'data-invalid',
|
|
56
|
+
invalidIcon: '<svg class="text-error validity" aria-hidden="true"><use href="#icon-exclamation-circle"></use></svg>',
|
|
57
|
+
activeAttribute: 'data-active',
|
|
58
|
+
...options,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!element.querySelector(options.selector)) return
|
|
62
|
+
|
|
63
|
+
const validationElement = element.querySelector(options.selector)
|
|
64
|
+
const validationMessage = options.validationMessage ?? validationElement.dataset.validationMessage ?? validationElement.validationMessage
|
|
65
|
+
const infoParentElement = validationElement?.closest(options.infoParentSelector)
|
|
66
|
+
const endParentElement = validationElement.closest(options.endParentSelector)
|
|
67
|
+
const infoSelector = options.infoSelector + options.validitySelector
|
|
68
|
+
const endSelector = `${options.endSelector} ${options.validitySelector}`
|
|
69
|
+
|
|
70
|
+
const insertIcon = (icon) => {
|
|
71
|
+
if (!endParentElement || !icon) return
|
|
72
|
+
|
|
73
|
+
if (!element?.querySelector(options.endSelector)) {
|
|
74
|
+
element?.insertAdjacentHTML('beforeend', options.endContent)
|
|
58
75
|
}
|
|
59
76
|
|
|
60
|
-
|
|
77
|
+
element.querySelector(options.endSelector).insertAdjacentHTML('afterbegin', icon)
|
|
78
|
+
}
|
|
61
79
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
if (validationElement.value !== '') {
|
|
81
|
+
element.setAttribute(options.activeAttribute, '')
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
element.removeAttribute(options.activeAttribute)
|
|
85
|
+
}
|
|
68
86
|
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
if (!validationElement.outerHTML.match(options.ignoreMatch) && options.validate) {
|
|
88
|
+
element?.removeAttribute(options.validAttribute)
|
|
89
|
+
element?.removeAttribute(options.invalidAttribute)
|
|
71
90
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
91
|
+
infoParentElement?.querySelector(infoSelector)?.remove()
|
|
92
|
+
endParentElement?.querySelector(endSelector)?.remove()
|
|
75
93
|
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
if (validationElement.checkValidity()) {
|
|
95
|
+
element.setAttribute(options.validAttribute, '')
|
|
78
96
|
|
|
79
|
-
|
|
80
|
-
element.setAttribute(options.activeAttribute, '')
|
|
81
|
-
} else {
|
|
82
|
-
element.removeAttribute(options.activeAttribute)
|
|
97
|
+
insertIcon(options.validIcon)
|
|
83
98
|
}
|
|
99
|
+
else {
|
|
100
|
+
element.setAttribute(options.invalidAttribute, '')
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
element?.removeAttribute(options.validAttribute)
|
|
87
|
-
element?.removeAttribute(options.invalidAttribute)
|
|
88
|
-
|
|
89
|
-
infoParentElement?.querySelector(infoSelector)?.remove()
|
|
90
|
-
endParentElement?.querySelector(endSelector)?.remove()
|
|
91
|
-
|
|
92
|
-
if (validationElement.checkValidity()) {
|
|
93
|
-
element.setAttribute(options.validAttribute, '')
|
|
94
|
-
|
|
95
|
-
insertIcon(options.validIcon)
|
|
96
|
-
} else {
|
|
97
|
-
element.setAttribute(options.invalidAttribute, '')
|
|
98
|
-
|
|
99
|
-
insertIcon(options.invalidIcon)
|
|
102
|
+
insertIcon(options.invalidIcon)
|
|
100
103
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
104
|
+
if (infoParentElement) {
|
|
105
|
+
infoParentElement.insertAdjacentHTML('beforeend', options.infoContent)
|
|
106
|
+
infoParentElement.querySelector(infoSelector).textContent = validationMessage
|
|
107
|
+
}
|
|
106
108
|
}
|
|
109
|
+
}
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
export default {
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
validateForm,
|
|
114
|
+
validateField,
|
|
112
115
|
}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
inline-size: max-content;
|
|
14
14
|
position: absolute;
|
|
15
15
|
|
|
16
|
-
&:where(.bottom),
|
|
16
|
+
&:where(.bottom),
|
|
17
|
+
& {
|
|
17
18
|
transform-origin: top;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -91,7 +92,8 @@
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
&:not([popover]) {
|
|
94
|
-
.trigger-focus:not(:focus, :focus-within) > &,
|
|
95
|
+
.trigger-focus:not(:focus, :focus-within) > &,
|
|
96
|
+
.trigger-hover:not(:hover) > & {
|
|
95
97
|
--tw-scale-x: var(--x-popover-content-scale-x);
|
|
96
98
|
--tw-scale-y: var(--x-popover-content-scale-y);
|
|
97
99
|
|