winduum 2.2.28 → 3.0.0-next.10
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 +19 -12
- package/src/base/defaults.css +3 -0
- package/src/base/reset.css +4 -0
- package/src/common.d.ts +4 -0
- package/src/common.js +9 -1
- package/src/components/carousel/content.css +1 -0
- package/src/components/carousel/index.d.ts +14 -35
- package/src/components/carousel/index.js +75 -194
- package/src/components/check/props/default.css +1 -1
- package/src/components/control/props/select-picker.css +4 -4
- package/src/components/control/props/select.css +2 -2
- package/src/components/control/tel-country-code.css +24 -0
- package/src/components/details/default.css +14 -0
- package/src/components/details/index.css +1 -0
- package/src/components/details/index.d.ts +2 -6
- package/src/components/details/index.js +7 -72
- package/src/components/details/readme.md +2 -5
- package/src/components/dialog/content.css +8 -2
- package/src/components/dialog/default.css +16 -2
- package/src/components/dialog/drawer.css +20 -0
- package/src/components/dialog/index.css +1 -0
- package/src/components/dialog/index.js +8 -79
- package/src/components/dialog/readme.md +1 -5
- package/src/components/drawer/content.css +2 -1
- package/src/components/drawer/default.css +13 -31
- package/src/components/drawer/index.css +3 -0
- package/src/components/drawer/index.d.ts +8 -15
- package/src/components/drawer/index.js +67 -50
- package/src/components/drawer/keyframes/default.css +9 -0
- package/src/components/drawer/noscript.css +32 -0
- package/src/components/drawer/nosnap.css +32 -0
- package/src/components/drawer/props/content.css +2 -2
- package/src/components/drawer/props/default.css +6 -0
- package/src/components/drawer/scroller.css +32 -0
- package/src/components/form/index.d.ts +5 -12
- package/src/components/form/index.js +35 -70
- package/src/components/heading/lg.css +1 -1
- package/src/components/heading/props/default.css +1 -1
- package/src/components/heading/sm.css +1 -1
- package/src/components/index.css +1 -0
- package/src/components/label/props/default.css +3 -2
- package/src/components/popover/content.css +7 -94
- package/src/components/popover/default.css +16 -3
- package/src/components/popover/index.css +2 -0
- package/src/components/popover/index.d.ts +14 -18
- package/src/components/popover/index.js +40 -80
- package/src/components/popover/props/content.css +1 -2
- package/src/components/popover/props/default.css +4 -0
- package/src/components/popover/readme.md +1 -2
- package/src/components/popover/tooltip.css +11 -0
- package/src/components/tabs/index.d.ts +2 -2
- package/src/components/text/content.css +241 -0
- package/src/components/text/default.css +0 -238
- package/src/components/text/index.css +2 -0
- package/src/components/text/props/content.css +9 -0
- package/src/components/text/props/default.css +1 -7
- package/src/components/toast/default.css +6 -0
- package/src/components/toast/index.js +2 -1
- package/src/components/toaster/index.d.ts +1 -0
- package/src/components/toaster/index.js +18 -0
- package/src/components/tooltip/default.css +8 -8
- package/src/polyfill.js +13 -0
- package/src/supports.js +15 -0
- package/src/utilities/container/props/default.css +3 -3
- package/tailwindcss/utilities/animation-trigger-fallback.css +18 -0
- package/tailwindcss/utilities/index.css +1 -0
- package/tailwindcss/utilities/position.css +203 -0
- package/types/index.d.ts +20 -58
- package/src/components/dialog/index.d.ts +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "winduum",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"main": "plugin/index.cjs",
|
|
@@ -23,24 +23,29 @@
|
|
|
23
23
|
"@floating-ui/dom": "^1.7.6",
|
|
24
24
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
25
25
|
"@stylistic/stylelint-config": "^5.0.0",
|
|
26
|
-
"@tailwindcss/vite": "^4.3.
|
|
26
|
+
"@tailwindcss/vite": "^4.3.2",
|
|
27
27
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"@webreflection/custom-elements-builtin": "^0.4.1",
|
|
29
|
+
"autoprefixer": "^10.5.2",
|
|
30
|
+
"dts-buddy": "^0.8.2",
|
|
31
|
+
"eslint": "^10.6.0",
|
|
31
32
|
"fast-glob": "^3.3.3",
|
|
32
|
-
"globals": "^17.
|
|
33
|
-
"
|
|
33
|
+
"globals": "^17.7.0",
|
|
34
|
+
"interestfor": "^1.0.8",
|
|
35
|
+
"invokers-polyfill": "^1.0.3",
|
|
36
|
+
"postcss": "^8.5.16",
|
|
34
37
|
"postcss-custom-media": "^12.0.1",
|
|
35
38
|
"postcss-import": "^16.1.1",
|
|
36
39
|
"postcss-nesting": "^14.0.0",
|
|
40
|
+
"scrollsnap-events": "^0.1.1",
|
|
37
41
|
"slide-element": "^2.3.1",
|
|
38
|
-
"stylelint": "^17.
|
|
42
|
+
"stylelint": "^17.14.0",
|
|
39
43
|
"stylelint-config-standard": "^40.0.0",
|
|
40
|
-
"tailwindcss": "^4.3.
|
|
44
|
+
"tailwindcss": "^4.3.2",
|
|
41
45
|
"typescript": "^6",
|
|
42
|
-
"vite": "^8.
|
|
43
|
-
"vue": "^3.5.
|
|
46
|
+
"vite": "^8.1.3",
|
|
47
|
+
"vue": "^3.5.39",
|
|
48
|
+
"webuum": "^0.2.1"
|
|
44
49
|
},
|
|
45
50
|
"files": [
|
|
46
51
|
"index.js",
|
|
@@ -62,6 +67,9 @@
|
|
|
62
67
|
"types": "./types/index.d.ts",
|
|
63
68
|
"default": "./src/supports.js"
|
|
64
69
|
},
|
|
70
|
+
"./polyfill": {
|
|
71
|
+
"default": "./src/polyfill.js"
|
|
72
|
+
},
|
|
65
73
|
"./src/*": "./src/*",
|
|
66
74
|
"./tailwindcss/*": "./tailwindcss/*",
|
|
67
75
|
"./dist/*": "./dist/*",
|
|
@@ -79,7 +87,6 @@
|
|
|
79
87
|
"default": "./src/components/details/index.js"
|
|
80
88
|
},
|
|
81
89
|
"./src/components/dialog": {
|
|
82
|
-
"types": "./src/components/dialog/index.d.ts",
|
|
83
90
|
"default": "./src/components/dialog/index.js"
|
|
84
91
|
},
|
|
85
92
|
"./src/components/drawer": {
|
package/src/base/defaults.css
CHANGED
|
@@ -53,12 +53,14 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
:where(html) {
|
|
56
|
+
scroll-padding-top: var(--scroll-padding-top);
|
|
56
57
|
color-scheme: var(--default-color-scheme);
|
|
57
58
|
font-family: var(--font-primary);
|
|
58
59
|
font-weight: var(--font-weight-normal);
|
|
59
60
|
block-size: 100%;
|
|
60
61
|
line-height: 1.5;
|
|
61
62
|
text-size-adjust: 100%;
|
|
63
|
+
container-type: scroll-state;
|
|
62
64
|
|
|
63
65
|
@media (prefers-reduced-motion: no-preference) {
|
|
64
66
|
scroll-behavior: smooth;
|
|
@@ -73,6 +75,7 @@
|
|
|
73
75
|
display: flex;
|
|
74
76
|
flex-direction: column;
|
|
75
77
|
overflow-x: clip;
|
|
78
|
+
container-type: inline-size;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
[hidden] {
|
package/src/base/reset.css
CHANGED
package/src/common.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export function nextRepaint(): Promise<void>;
|
|
2
2
|
export function animationsFinished(element: HTMLElement): Promise<any>;
|
|
3
|
+
export const supportsAnchor: boolean;
|
|
4
|
+
export const supportsAnchoredContainer: boolean;
|
|
5
|
+
export const supportsAnchor: boolean;
|
|
6
|
+
export const supportsAnchoredContainer: boolean;
|
package/src/common.js
CHANGED
|
@@ -8,4 +8,12 @@ export const nextRepaint = () => {
|
|
|
8
8
|
})
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const animationsFinished = async
|
|
11
|
+
export const animationsFinished = async (element) => {
|
|
12
|
+
const animations = element?.getAnimations?.() || []
|
|
13
|
+
const results = await Promise.allSettled(animations.map(a => a.finished))
|
|
14
|
+
|
|
15
|
+
return results.filter(r => r.status === 'fulfilled').map(r => r.value)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const supportsAnchor = CSS.supports('anchor-name', '--')
|
|
19
|
+
export const supportsAnchoredContainer = CSS.supports('container-type: anchored')
|
|
@@ -1,40 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
visibleAttribute?: string
|
|
3
|
-
observerOptions?: {
|
|
4
|
-
rootMargin?: string
|
|
5
|
-
threshold?: number | number[]
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface PaginationCarouselOptions {
|
|
10
|
-
element?: HTMLElement | Element
|
|
11
|
-
itemContent?: string
|
|
12
|
-
activeAttribute?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ScrollCarouselOptions {
|
|
16
|
-
observe?: ObserveCarouselOptions
|
|
17
|
-
pagination?: PaginationCarouselOptions
|
|
18
|
-
progressElement?: HTMLProgressElement | Element
|
|
19
|
-
counterMinElement?: HTMLElement | Element
|
|
20
|
-
counterMaxElement?: HTMLElement | Element
|
|
21
|
-
}
|
|
1
|
+
export type CarouselPlacement = 'left' | 'right' | 'top' | 'bottom'
|
|
22
2
|
|
|
23
|
-
export interface
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
export interface ScrollByOptions {
|
|
4
|
+
direction?: number
|
|
5
|
+
vertical?: boolean
|
|
6
|
+
ratio?: number
|
|
26
7
|
}
|
|
27
8
|
|
|
28
|
-
export interface
|
|
29
|
-
|
|
9
|
+
export interface ToggleScrollStateOptions {
|
|
10
|
+
prevElement?: HTMLButtonElement | null
|
|
11
|
+
nextElement?: HTMLButtonElement | null
|
|
12
|
+
vertical?: boolean
|
|
30
13
|
}
|
|
31
14
|
|
|
32
|
-
export function
|
|
33
|
-
export function
|
|
34
|
-
export function
|
|
35
|
-
export function
|
|
36
|
-
export function
|
|
37
|
-
export function scrollCarousel(element: HTMLElement | Element, options?: ScrollCarouselOptions): void
|
|
38
|
-
export function paginationCarousel(element: HTMLElement | Element, options?: PaginationCarouselOptions): void
|
|
39
|
-
export function autoplayCarousel(element: HTMLElement | Element, options?: AutoplayCarouselOptions): void
|
|
40
|
-
export function dragCarousel(element: HTMLElement | Element, options?: DragCarouselOptions): void
|
|
15
|
+
export function scrollBy(element: HTMLElement, options?: ScrollByOptions): void
|
|
16
|
+
export function toggleScrollState(element: HTMLElement, options?: ToggleScrollStateOptions): void
|
|
17
|
+
export function setCurrentAttribute(element: HTMLElement, index: number, attributeName?: string): void
|
|
18
|
+
export function setSnappedAttribute(element: HTMLElement, target: HTMLElement, markerGroupElement?: HTMLElement | null): void
|
|
19
|
+
export function scrollToMarker(element: HTMLElement, target: HTMLElement, markerGroupElement: HTMLElement, scrollIntoViewOptions?: ScrollIntoViewOptions): void
|
|
@@ -1,227 +1,108 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {HTMLElement
|
|
3
|
-
* @param {
|
|
4
|
-
* @
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const scrollPaddingLeft = parseInt(getComputedStyle(element).scrollPaddingLeft)
|
|
8
|
-
|
|
9
|
-
element.scroll({ left: element?.children[index]?.offsetLeft - (isNaN(scrollPaddingLeft) ? 0 : scrollPaddingLeft) })
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {HTMLElement | Element & { _activeIndex: number }} element
|
|
14
|
-
* @returns void
|
|
15
|
-
*/
|
|
16
|
-
export const scrollPrev = (element) => {
|
|
17
|
-
scrollTo(element, element._activeIndex - 1)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {HTMLElement | Element & { _activeIndex: number }} element
|
|
2
|
+
* @param {HTMLElement} element
|
|
3
|
+
* @param {object} options
|
|
4
|
+
* @param {number} [options.direction=1]
|
|
5
|
+
* @param {boolean} [options.vertical=false]
|
|
6
|
+
* @param {number} [options.ratio=0.85]
|
|
22
7
|
* @returns void
|
|
23
8
|
*/
|
|
24
|
-
export const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return [...element.children].reduce((count, children) => {
|
|
39
|
-
if (mathRound(scrollWidth / (children.offsetWidth + (isNaN(gap) ? 0 : gap)), mathFloor) > count) {
|
|
40
|
-
return count + 1
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return count
|
|
44
|
-
}
|
|
45
|
-
}, 0) + 1
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @param {HTMLElement | Element} element
|
|
50
|
-
* @param {import("./").ObserveCarouselOptions} options
|
|
51
|
-
* @returns IntersectionObserver
|
|
52
|
-
*/
|
|
53
|
-
export const observeCarousel = (element, options = {}) => {
|
|
54
|
-
options = {
|
|
55
|
-
visibleAttribute: 'data-visible',
|
|
56
|
-
observerOptions: {},
|
|
57
|
-
...options,
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
element._observer = new IntersectionObserver((entries) => {
|
|
61
|
-
entries.forEach((entry) => {
|
|
62
|
-
entry.target.toggleAttribute(options.visibleAttribute, entry.isIntersecting)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const activeElement = [...element.children].find(children => children.hasAttribute(options.visibleAttribute))
|
|
66
|
-
|
|
67
|
-
if (activeElement) {
|
|
68
|
-
element._activeIndex = [...element.children].indexOf(activeElement)
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
root: element,
|
|
72
|
-
threshold: 0.75,
|
|
73
|
-
...options.observerOptions,
|
|
9
|
+
export const scrollBy = (element, { direction = 1, vertical = false, ratio = 0.85 }) => {
|
|
10
|
+
const { distance, position } = vertical
|
|
11
|
+
? {
|
|
12
|
+
distance: element.clientHeight * ratio,
|
|
13
|
+
position: 'top',
|
|
14
|
+
}
|
|
15
|
+
: {
|
|
16
|
+
distance: element.clientWidth * ratio,
|
|
17
|
+
position: 'left',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
element.scrollBy({
|
|
21
|
+
[position]: (distance ?? element.clientWidth * ratio) * direction,
|
|
74
22
|
})
|
|
75
|
-
|
|
76
|
-
;[...element.children].forEach(children => element._observer.observe(children))
|
|
77
|
-
|
|
78
|
-
return element._observer
|
|
79
23
|
}
|
|
80
24
|
|
|
81
25
|
/**
|
|
82
|
-
* @param {HTMLElement
|
|
83
|
-
* @param {
|
|
26
|
+
* @param {HTMLElement} element
|
|
27
|
+
* @param {object} options
|
|
28
|
+
* @param {HTMLButtonElement | null} [options.prevElement]
|
|
29
|
+
* @param {HTMLButtonElement | null} [options.nextElement]
|
|
30
|
+
* @param {boolean} vertical
|
|
84
31
|
* @returns void
|
|
85
32
|
*/
|
|
86
|
-
export const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (options.counterMinElement) {
|
|
106
|
-
options.counterMinElement.innerHTML = `${activeItem}`
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (options.counterMaxElement) {
|
|
110
|
-
options.counterMaxElement.innerHTML = `${activeItemMax}`
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
element._lastScrollLeft = element.scrollLeft <= 0 ? 0 : element.scrollLeft
|
|
33
|
+
export const toggleScrollState = (element, { prevElement, nextElement, vertical = false }) => {
|
|
34
|
+
const { scrollStart, scrollEnd, scrollNone } = vertical
|
|
35
|
+
? {
|
|
36
|
+
scrollStart: element.scrollTop <= 0,
|
|
37
|
+
scrollEnd: element.scrollTop >= element.scrollHeight - element.clientHeight,
|
|
38
|
+
scrollNone: !(element.scrollHeight - element.clientHeight),
|
|
39
|
+
}
|
|
40
|
+
: {
|
|
41
|
+
scrollStart: element.scrollLeft <= 0,
|
|
42
|
+
scrollEnd: element.scrollLeft >= element.scrollWidth - element.clientWidth,
|
|
43
|
+
scrollNone: !(element.scrollWidth - element.clientWidth),
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (prevElement) prevElement.disabled = scrollStart
|
|
47
|
+
if (nextElement) nextElement.disabled = scrollEnd
|
|
48
|
+
|
|
49
|
+
element.toggleAttribute('data-scroll-start', scrollStart)
|
|
50
|
+
element.toggleAttribute('data-scroll-end', scrollEnd)
|
|
51
|
+
element.toggleAttribute('data-scroll-none', scrollNone)
|
|
114
52
|
}
|
|
115
53
|
|
|
116
54
|
/**
|
|
117
|
-
* @param {HTMLElement
|
|
118
|
-
* @param {
|
|
55
|
+
* @param {HTMLElement} element
|
|
56
|
+
* @param {number} index
|
|
57
|
+
* @param {string} [attributeName='data-current']
|
|
119
58
|
* @returns void
|
|
120
59
|
*/
|
|
121
|
-
export const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
activeAttribute: 'data-active',
|
|
125
|
-
...options,
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (!options.element) return
|
|
129
|
-
|
|
130
|
-
options.element.insertAdjacentHTML('beforeend', [...Array(getItemCount(element))].map(
|
|
131
|
-
() => options.itemContent,
|
|
132
|
-
).join(''))
|
|
133
|
-
|
|
134
|
-
;[...options.element.children].forEach((children, i) => {
|
|
135
|
-
(i === 0) && children.setAttribute(options.activeAttribute, '')
|
|
136
|
-
children.addEventListener('click', ({ currentTarget }) => {
|
|
137
|
-
scrollTo(element, [...options.element.children].indexOf(currentTarget))
|
|
138
|
-
})
|
|
139
|
-
})
|
|
60
|
+
export const setCurrentAttribute = (element, index, attributeName = 'aria-current') => {
|
|
61
|
+
element.querySelector(`[${attributeName}]`)?.removeAttribute(attributeName)
|
|
62
|
+
element.children[index].setAttribute(attributeName, 'true')
|
|
140
63
|
}
|
|
141
64
|
|
|
142
65
|
/**
|
|
143
|
-
* @param {HTMLElement |
|
|
144
|
-
* @param {
|
|
66
|
+
* @param {HTMLElement & { _markerIndex?: number | null }} element
|
|
67
|
+
* @param {HTMLElement} target
|
|
68
|
+
* @param {HTMLElement | null} markerGroupElement
|
|
145
69
|
* @returns void
|
|
146
70
|
*/
|
|
147
|
-
export const
|
|
148
|
-
|
|
149
|
-
delay: 4000,
|
|
150
|
-
pauseElements: [],
|
|
151
|
-
...options,
|
|
152
|
-
}
|
|
71
|
+
export const setSnappedAttribute = (element, target, markerGroupElement) => {
|
|
72
|
+
const snappedIndex = [...element.children].indexOf(target)
|
|
153
73
|
|
|
154
|
-
|
|
74
|
+
setCurrentAttribute(element, snappedIndex, 'data-snapped')
|
|
155
75
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
element
|
|
159
|
-
})
|
|
76
|
+
if (markerGroupElement) {
|
|
77
|
+
const markerTarget = markerGroupElement.querySelector(`[href="#${target.id}"]`)
|
|
78
|
+
const index = element._markerIndex ?? (markerTarget && [...markerGroupElement.children].indexOf(markerTarget)) ?? snappedIndex
|
|
160
79
|
|
|
161
|
-
|
|
162
|
-
if (paused) return
|
|
80
|
+
setCurrentAttribute(markerGroupElement, index)
|
|
163
81
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
scrollTo(element, 0)
|
|
169
|
-
}
|
|
170
|
-
}, options.delay)
|
|
82
|
+
element._markerIndex = null
|
|
83
|
+
}
|
|
171
84
|
}
|
|
172
85
|
|
|
173
86
|
/**
|
|
174
|
-
* @param {HTMLElement
|
|
175
|
-
* @param {
|
|
87
|
+
* @param {HTMLElement & { _markerIndex?: number | null }} element
|
|
88
|
+
* @param {HTMLElement | HTMLLinkElement} target
|
|
89
|
+
* @param {HTMLElement} markerGroupElement
|
|
90
|
+
* @param {ScrollIntoViewOptions} scrollIntoViewOptions
|
|
176
91
|
* @returns void
|
|
177
92
|
*/
|
|
178
|
-
export const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (!matchMedia('(hover: hover) and (pointer: fine)').matches) {
|
|
185
|
-
return
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
let isDown
|
|
189
|
-
let startX
|
|
190
|
-
let scrollLeft
|
|
191
|
-
let timeout
|
|
192
|
-
|
|
193
|
-
const endGrabbing = () => {
|
|
194
|
-
isDown = false
|
|
195
|
-
element.removeAttribute(options.activeAttribute)
|
|
196
|
-
|
|
197
|
-
scrollTo(element, element._activeIndex)
|
|
198
|
-
|
|
199
|
-
clearTimeout(timeout)
|
|
200
|
-
|
|
201
|
-
timeout = setTimeout(() => {
|
|
202
|
-
element.style.scrollSnapType = ''
|
|
203
|
-
}, 300)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
element.addEventListener('mouseleave', endGrabbing)
|
|
207
|
-
|
|
208
|
-
element.addEventListener('mouseup', endGrabbing)
|
|
209
|
-
|
|
210
|
-
element.addEventListener('mousedown', ({ pageX }) => {
|
|
211
|
-
isDown = true
|
|
212
|
-
startX = pageX - element.offsetLeft
|
|
213
|
-
scrollLeft = element.scrollLeft
|
|
214
|
-
})
|
|
93
|
+
export const scrollToMarker = (element, target, markerGroupElement, scrollIntoViewOptions = {}) => {
|
|
94
|
+
const snappedTarget = document.getElementById(target.getAttribute('href').slice(1))
|
|
95
|
+
const markerTargetIndex = [...markerGroupElement.children].indexOf(target)
|
|
96
|
+
const index = snappedTarget ? [...element.children].indexOf(snappedTarget) : markerTargetIndex
|
|
215
97
|
|
|
216
|
-
element.
|
|
217
|
-
if (!isDown) return
|
|
218
|
-
e.preventDefault()
|
|
98
|
+
element._markerIndex = markerTargetIndex
|
|
219
99
|
|
|
220
|
-
|
|
100
|
+
setCurrentAttribute(markerGroupElement, markerTargetIndex)
|
|
221
101
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
102
|
+
element.children[index]?.scrollIntoView({
|
|
103
|
+
inline: 'start',
|
|
104
|
+
block: 'nearest',
|
|
105
|
+
container: 'nearest',
|
|
106
|
+
...scrollIntoViewOptions,
|
|
226
107
|
})
|
|
227
108
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
--x-check-size: 1.25rem;
|
|
4
4
|
--x-check-gap: calc(var(--spacing) * 3);
|
|
5
5
|
--x-check-font-size: var(--text-sm);
|
|
6
|
-
--x-check-line-height:
|
|
6
|
+
--x-check-line-height: 1.25rem;
|
|
7
7
|
--x-check-border-radius: var(--radius-md);
|
|
8
8
|
--x-check-border-width: 1px;
|
|
9
9
|
--x-check-background-color: currentcolor;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
--x-control-select-picker-border-color: currentcolor;
|
|
6
6
|
--x-control-select-picker-background-color: var(--color-body-primary);
|
|
7
7
|
--x-control-select-picker-margin-block: 0.375rem;
|
|
8
|
-
--x-control-select-picker-padding-block:
|
|
9
|
-
--x-control-select-picker-padding-inline:
|
|
8
|
+
--x-control-select-picker-padding-block: calc(var(--spacing) * 1);
|
|
9
|
+
--x-control-select-picker-padding-inline: calc(var(--spacing) * 1);
|
|
10
10
|
--x-control-select-picker-gap: 0.25rem;
|
|
11
11
|
--x-control-select-picker-scrollbar-color: currentcolor var(--color-body-primary);
|
|
12
|
-
--x-control-select-option-padding-block:
|
|
13
|
-
--x-control-select-option-padding-inline:
|
|
12
|
+
--x-control-select-option-padding-block: calc(var(--spacing) * 2.5);
|
|
13
|
+
--x-control-select-option-padding-inline: calc(var(--spacing) * 3);
|
|
14
14
|
--x-control-select-option-border-radius: var(--radius-md);
|
|
15
15
|
--x-control-select-option-hocus-background-color: var(--color-body-secondary);
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:root,
|
|
2
2
|
:host {
|
|
3
|
-
--x-control-select-icon-size:
|
|
4
|
-
--x-control-select-icon-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="
|
|
3
|
+
--x-control-select-icon-size: 1rem;
|
|
4
|
+
--x-control-select-icon-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.75" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></svg>');
|
|
5
5
|
--x-control-select-icon-margin-inline-end: -0.25rem;
|
|
6
6
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.x-control {
|
|
2
|
+
&:has([autocomplete="tel-country-code"]) {
|
|
3
|
+
:where(select) {
|
|
4
|
+
@media not (scripting: none) {
|
|
5
|
+
font-size: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
+ :where(span) {
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
|
|
11
|
+
@media (scripting: none) {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:where(option) {
|
|
17
|
+
&::before {
|
|
18
|
+
content: attr(data-icon);
|
|
19
|
+
margin-inline-end: 0.5ch;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.x-details {
|
|
2
|
+
&::details-content {
|
|
3
|
+
transition:
|
|
4
|
+
height var(--default-transition-duration) var(--default-transition-timing-function),
|
|
5
|
+
content-visibility var(--default-transition-duration) var(--default-transition-timing-function) allow-discrete;
|
|
6
|
+
height: 0;
|
|
7
|
+
overflow: clip;
|
|
8
|
+
interpolate-size: allow-keywords;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&[open]::details-content {
|
|
12
|
+
height: auto;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./default.css";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ToggleDetailsOptions {
|
|
2
2
|
selector?: string
|
|
3
|
-
summarySelector?: string
|
|
4
3
|
}
|
|
5
4
|
|
|
6
|
-
export
|
|
7
|
-
export function showDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
|
|
8
|
-
export function closeDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
|
|
9
|
-
export function toggleDetails(selector: HTMLInputElement | HTMLElement, options?: DefaultOptions): Promise<void>
|
|
5
|
+
export function toggleDetails(element: HTMLInputElement, options?: ToggleDetailsOptions): void
|