winduum 2.0.0-next.21 → 2.0.0-next.23
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/package.json +1 -1
- package/src/components/button/spinner.css +2 -2
- package/src/components/compare/default.css +2 -2
- package/src/components/compare/index.d.ts +3 -3
- package/src/components/compare/index.js +10 -9
- package/src/components/form/index.d.ts +1 -0
- package/src/components/form/index.js +2 -1
- package/src/components/popover/index.d.ts +1 -0
- package/src/components/popover/index.js +1 -1
- package/src/utilities/ripple/index.d.ts +7 -1
- package/src/utilities/ripple/index.js +14 -14
package/package.json
CHANGED
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
>
|
|
44
|
+
> .x-button {
|
|
45
45
|
inset-inline-start: var(--x-compare-position);
|
|
46
46
|
margin-inline-start: calc(var(--x-button-inline-size) / 2 * -1);
|
|
47
47
|
margin-block: auto;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
>
|
|
50
|
+
> .x-image {
|
|
51
51
|
display: grid;
|
|
52
52
|
z-index: 0;
|
|
53
53
|
|
|
@@ -3,6 +3,6 @@ export interface SetPositionOptions {
|
|
|
3
3
|
positionProperty?: string
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export function setPosition(
|
|
7
|
-
export function setKeyboardStep(
|
|
8
|
-
export function setMouseStep(
|
|
6
|
+
export function setPosition(element: HTMLInputElement, options?: SetPositionOptions): void
|
|
7
|
+
export function setKeyboardStep(element: HTMLInputElement, key: string, step?: string): void
|
|
8
|
+
export function setMouseStep(element: HTMLInputElement, step?: string): void
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {
|
|
2
|
+
* @param {HTMLInputElement} element
|
|
3
3
|
* @param {import("./").SetPositionOptions} options
|
|
4
4
|
* @returns void
|
|
5
5
|
*/
|
|
6
|
-
export const setPosition = (
|
|
6
|
+
export const setPosition = (element, options = {}) => {
|
|
7
7
|
const { selector, positionProperty } = {
|
|
8
8
|
selector: '.x-compare',
|
|
9
9
|
positionProperty: '--x-compare-position',
|
|
10
10
|
...options
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
element?.closest(selector)?.style.setProperty(positionProperty, `${element.value}%`)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {HTMLInputElement} element
|
|
18
|
+
* @param {string} key
|
|
18
19
|
* @param {string} step
|
|
19
20
|
* @returns void
|
|
20
21
|
*/
|
|
21
|
-
export const setKeyboardStep = (
|
|
22
|
+
export const setKeyboardStep = (element, key, step = '10') => {
|
|
22
23
|
if (key?.toLowerCase() !== 'arrowright' && key?.toLowerCase() !== 'arrowleft') return
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
element.step = step
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* @param {
|
|
29
|
+
* @param {HTMLInputElement} element
|
|
29
30
|
* @param {string} step
|
|
30
31
|
* @returns void
|
|
31
32
|
*/
|
|
32
|
-
export const setMouseStep = (
|
|
33
|
-
|
|
33
|
+
export const setMouseStep = (element, step = '0.1') => {
|
|
34
|
+
element.step = step
|
|
34
35
|
}
|
|
@@ -8,6 +8,7 @@ export const validateForm = (event, options = {}) => {
|
|
|
8
8
|
validateSelectors: '.x-control, .x-check, .x-switch, .x-rating, .x-color',
|
|
9
9
|
validateOptions: {},
|
|
10
10
|
submitterLoadingAttribute: 'data-loading',
|
|
11
|
+
scrollOptions: { behavior: 'smooth', block: 'center' },
|
|
11
12
|
...options
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -15,7 +16,7 @@ export const validateForm = (event, options = {}) => {
|
|
|
15
16
|
event.preventDefault()
|
|
16
17
|
event.stopImmediatePropagation()
|
|
17
18
|
|
|
18
|
-
event.target.querySelector(':invalid').scrollIntoView(
|
|
19
|
+
event.target.querySelector(':invalid').scrollIntoView(options.scrollOptions)
|
|
19
20
|
event.target.querySelector(':invalid').focus()
|
|
20
21
|
} else {
|
|
21
22
|
event?.submitter?.setAttribute(options.submitterLoadingAttribute, '')
|
|
@@ -74,7 +74,7 @@ export const showPopover = async (element, options) => {
|
|
|
74
74
|
popoverElement._cleanup = autoUpdate(
|
|
75
75
|
element,
|
|
76
76
|
popoverElement,
|
|
77
|
-
async () => await computePopover(element, popoverElement, options)
|
|
77
|
+
async () => await computePopover(options.anchorSelector ? document.querySelector(options.anchorSelector) : element, popoverElement, options)
|
|
78
78
|
)
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shows a ripple effect.
|
|
3
|
-
* @param {
|
|
4
|
-
* @param {HTMLElement}
|
|
3
|
+
* @param {import("./").ShowRippleOptions} options
|
|
4
|
+
* @param {HTMLElement} rippleElement
|
|
5
5
|
* @returns void
|
|
6
6
|
*/
|
|
7
|
-
export const showRipple = ({
|
|
8
|
-
if (!
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export const showRipple = ({ element, x, y }, rippleElement = element.querySelector('.ripple')) => {
|
|
8
|
+
if (!rippleElement) {
|
|
9
|
+
element.insertAdjacentHTML('beforeend', "<div class='ripple'></div>")
|
|
10
|
+
rippleElement = element.querySelector('.ripple')
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
rippleElement.classList.remove('animation-ripple')
|
|
14
14
|
|
|
15
|
-
if (
|
|
16
|
-
const d = Math.max(
|
|
15
|
+
if (rippleElement.clientWidth === 0 && rippleElement.clientHeight === 0) {
|
|
16
|
+
const d = Math.max(element.offsetWidth, element.offsetHeight)
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
rippleElement.style.width = d + 'px'
|
|
19
|
+
rippleElement.style.height = d + 'px'
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
rippleElement.style.top = y - (rippleElement.clientHeight / 2) + 'px'
|
|
23
|
+
rippleElement.style.left = x - (rippleElement.clientWidth / 2) + 'px'
|
|
24
|
+
rippleElement.classList.add('animation-ripple')
|
|
25
25
|
}
|