winduum 3.0.0-next.4 → 3.0.0-next.6
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "winduum",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"main": "plugin/index.cjs",
|
|
@@ -23,27 +23,27 @@
|
|
|
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
28
|
"@webreflection/custom-elements-builtin": "^0.4.1",
|
|
29
|
-
"autoprefixer": "^10.5.
|
|
30
|
-
"dts-buddy": "^0.8.
|
|
31
|
-
"eslint": "^10.
|
|
29
|
+
"autoprefixer": "^10.5.2",
|
|
30
|
+
"dts-buddy": "^0.8.2",
|
|
31
|
+
"eslint": "^10.6.0",
|
|
32
32
|
"fast-glob": "^3.3.3",
|
|
33
|
-
"globals": "^17.
|
|
33
|
+
"globals": "^17.7.0",
|
|
34
34
|
"invokers-polyfill": "^1.0.3",
|
|
35
|
-
"postcss": "^8.5.
|
|
35
|
+
"postcss": "^8.5.16",
|
|
36
36
|
"postcss-custom-media": "^12.0.1",
|
|
37
37
|
"postcss-import": "^16.1.1",
|
|
38
38
|
"postcss-nesting": "^14.0.0",
|
|
39
39
|
"slide-element": "^2.3.1",
|
|
40
|
-
"stylelint": "^17.
|
|
40
|
+
"stylelint": "^17.14.0",
|
|
41
41
|
"stylelint-config-standard": "^40.0.0",
|
|
42
|
-
"tailwindcss": "^4.3.
|
|
42
|
+
"tailwindcss": "^4.3.2",
|
|
43
43
|
"typescript": "^6",
|
|
44
|
-
"vite": "^8.
|
|
45
|
-
"vue": "^3.5.
|
|
46
|
-
"webuum": "^0.1
|
|
44
|
+
"vite": "^8.1.3",
|
|
45
|
+
"vue": "^3.5.39",
|
|
46
|
+
"webuum": "^0.2.1"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"index.js",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface ValidateFormOptions {
|
|
2
|
-
|
|
2
|
+
validateSelector?: string
|
|
3
3
|
validateOptions?: ValidateFieldOptions
|
|
4
4
|
validateField?: typeof validateField
|
|
5
5
|
scrollOptions?: ScrollIntoViewOptions
|
|
@@ -10,20 +10,13 @@ export interface ValidateFieldOptions {
|
|
|
10
10
|
validate?: boolean
|
|
11
11
|
validationMessage?: string
|
|
12
12
|
selector?: string
|
|
13
|
-
ignoreMatch?: RegExp
|
|
14
13
|
validitySelector?: string
|
|
15
|
-
infoParentSelector?: string
|
|
16
|
-
infoSelector?: string
|
|
17
14
|
infoContent?: string
|
|
18
15
|
endParentSelector?: string
|
|
19
16
|
endSelector?: string
|
|
20
17
|
endContent?: string
|
|
21
|
-
validAttribute?: string
|
|
22
|
-
validIcon?: string | null
|
|
23
|
-
invalidAttribute?: string
|
|
24
18
|
invalidIcon?: string
|
|
25
|
-
activeAttribute?: string
|
|
26
19
|
}
|
|
27
20
|
|
|
28
21
|
export function validateForm(event: Event | SubmitEvent, options?: ValidateFormOptions): void
|
|
29
|
-
export function validateField(element: HTMLElement
|
|
22
|
+
export function validateField(element: HTMLElement, options?: ValidateFieldOptions): void
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export const validateForm = (event, options = {}) => {
|
|
7
7
|
options = {
|
|
8
|
-
|
|
8
|
+
validateSelector: '.x-field',
|
|
9
9
|
validateOptions: {
|
|
10
10
|
validate: true,
|
|
11
11
|
},
|
|
@@ -28,7 +28,7 @@ export const validateForm = (event, options = {}) => {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
event.target.querySelectorAll(options.
|
|
31
|
+
event.target.querySelectorAll(options.validateSelector).forEach((element) => {
|
|
32
32
|
options.validateField(element, options.validateOptions)
|
|
33
33
|
})
|
|
34
34
|
}
|
|
@@ -41,73 +41,40 @@ export const validateForm = (event, options = {}) => {
|
|
|
41
41
|
export const validateField = (element, options = {}) => {
|
|
42
42
|
options = {
|
|
43
43
|
validate: true,
|
|
44
|
-
selector: 'input:not([type="hidden"]), textarea, select',
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
infoParentSelector: '.x-field',
|
|
48
|
-
infoSelector: '.x-info',
|
|
49
|
-
infoContent: '<div class="x-info text-error validity"></div>',
|
|
44
|
+
selector: ':is(input:not([type="hidden"]), textarea, select):not([readonly], [data-novalidate])',
|
|
45
|
+
validitySelector: '[data-validity]',
|
|
46
|
+
infoContent: '<div class="x-info text-error" data-validity></div>',
|
|
50
47
|
endParentSelector: '.x-control',
|
|
51
48
|
endSelector: '.ms-auto',
|
|
52
49
|
endContent: '<div class="ms-auto"></div>',
|
|
53
|
-
|
|
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',
|
|
50
|
+
invalidIcon: '<svg class="text-error" data-validity aria-hidden="true"><use href="#icon-exclamation-circle"></use></svg>',
|
|
58
51
|
...options,
|
|
59
52
|
}
|
|
60
53
|
|
|
61
|
-
const
|
|
54
|
+
const validationElements = /** @type {HTMLInputElement[]} */ ([...element.querySelectorAll(options.selector)])
|
|
62
55
|
|
|
63
|
-
if (!
|
|
56
|
+
if (!validationElements.length || !options.validate) return
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
const infoParentElement = validationElement?.closest(options.infoParentSelector)
|
|
67
|
-
const endParentElement = validationElement.closest(options.endParentSelector)
|
|
68
|
-
const infoSelector = options.infoSelector + options.validitySelector
|
|
69
|
-
const endSelector = `${options.endSelector} ${options.validitySelector}`
|
|
58
|
+
element.querySelectorAll(options.validitySelector).forEach(el => el.remove())
|
|
70
59
|
|
|
71
|
-
const
|
|
72
|
-
if (!endParentElement || !icon) return
|
|
60
|
+
const invalidElements = validationElements.filter(validationElement => !validationElement.checkValidity())
|
|
73
61
|
|
|
74
|
-
|
|
75
|
-
element?.insertAdjacentHTML('beforeend', options.endContent)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
element.querySelector(options.endSelector).insertAdjacentHTML('afterbegin', icon)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (validationElement.value !== '') {
|
|
82
|
-
element.setAttribute(options.activeAttribute, '')
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
element.removeAttribute(options.activeAttribute)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!validationElement.outerHTML.match(options.ignoreMatch) && options.validate) {
|
|
89
|
-
element?.removeAttribute(options.validAttribute)
|
|
90
|
-
element?.removeAttribute(options.invalidAttribute)
|
|
62
|
+
if (!invalidElements.length) return
|
|
91
63
|
|
|
92
|
-
|
|
93
|
-
endParentElement
|
|
64
|
+
invalidElements.forEach((validationElement) => {
|
|
65
|
+
const endParentElement = validationElement.closest(options.endParentSelector)
|
|
94
66
|
|
|
95
|
-
if (
|
|
96
|
-
element.setAttribute(options.validAttribute, '')
|
|
67
|
+
if (!endParentElement || !options.invalidIcon) return
|
|
97
68
|
|
|
98
|
-
|
|
69
|
+
if (!endParentElement.querySelector(options.endSelector)) {
|
|
70
|
+
endParentElement.insertAdjacentHTML('beforeend', options.endContent)
|
|
99
71
|
}
|
|
100
|
-
else {
|
|
101
|
-
element.setAttribute(options.invalidAttribute, '')
|
|
102
72
|
|
|
103
|
-
|
|
73
|
+
endParentElement.querySelector(options.endSelector).insertAdjacentHTML('afterbegin', options.invalidIcon)
|
|
74
|
+
})
|
|
104
75
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
infoParentElement.querySelector(infoSelector).textContent = validationMessage
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
76
|
+
element.insertAdjacentHTML('beforeend', options.infoContent)
|
|
77
|
+
element.lastElementChild.textContent = options.validationMessage ?? invalidElements[0].dataset.validationMessage ?? invalidElements[0].validationMessage
|
|
111
78
|
}
|
|
112
79
|
|
|
113
80
|
export default {
|
|
@@ -32,7 +32,7 @@ export const closeToast = async (element, options = {}) => {
|
|
|
32
32
|
export const showToast = async (element, options = {}) => {
|
|
33
33
|
options = {
|
|
34
34
|
openAttribute: 'data-open',
|
|
35
|
-
autoHide:
|
|
35
|
+
autoHide: 7500,
|
|
36
36
|
heightProperty: '--x-toast-block-size',
|
|
37
37
|
close: {},
|
|
38
38
|
...options,
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
transform-origin: top;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/*
|
|
9
10
|
@container anchored(fallback: flip-block) {
|
|
10
11
|
> * {
|
|
11
12
|
transform-origin: bottom;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
*/
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
@utility bottom-start {
|
|
@@ -21,11 +23,13 @@
|
|
|
21
23
|
transform-origin: top left;
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/*
|
|
24
27
|
@container anchored(fallback: flip-block) {
|
|
25
28
|
> * {
|
|
26
29
|
transform-origin: bottom left;
|
|
27
30
|
}
|
|
28
31
|
}
|
|
32
|
+
*/
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
@utility bottom-end {
|
|
@@ -36,11 +40,13 @@
|
|
|
36
40
|
transform-origin: top right;
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
/*
|
|
39
44
|
@container anchored(fallback: flip-block) {
|
|
40
45
|
> * {
|
|
41
46
|
transform-origin: bottom right;
|
|
42
47
|
}
|
|
43
48
|
}
|
|
49
|
+
*/
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
@utility top {
|
|
@@ -51,11 +57,13 @@
|
|
|
51
57
|
transform-origin: bottom;
|
|
52
58
|
}
|
|
53
59
|
|
|
60
|
+
/*
|
|
54
61
|
@container anchored(fallback: flip-block) {
|
|
55
62
|
> * {
|
|
56
63
|
transform-origin: top;
|
|
57
64
|
}
|
|
58
65
|
}
|
|
66
|
+
*/
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
@utility top-start {
|
|
@@ -66,11 +74,13 @@
|
|
|
66
74
|
transform-origin: bottom left;
|
|
67
75
|
}
|
|
68
76
|
|
|
77
|
+
/*
|
|
69
78
|
@container anchored(fallback: flip-block) {
|
|
70
79
|
> * {
|
|
71
80
|
transform-origin: top left;
|
|
72
81
|
}
|
|
73
82
|
}
|
|
83
|
+
*/
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
@utility top-end {
|
|
@@ -81,11 +91,13 @@
|
|
|
81
91
|
transform-origin: bottom right;
|
|
82
92
|
}
|
|
83
93
|
|
|
94
|
+
/*
|
|
84
95
|
@container anchored(fallback: flip-block) {
|
|
85
96
|
> * {
|
|
86
97
|
transform-origin: top right;
|
|
87
98
|
}
|
|
88
99
|
}
|
|
100
|
+
*/
|
|
89
101
|
}
|
|
90
102
|
|
|
91
103
|
@utility left {
|
|
@@ -96,11 +108,13 @@
|
|
|
96
108
|
transform-origin: right;
|
|
97
109
|
}
|
|
98
110
|
|
|
111
|
+
/*
|
|
99
112
|
@container anchored(fallback: flip-block) {
|
|
100
113
|
> * {
|
|
101
114
|
transform-origin: left;
|
|
102
115
|
}
|
|
103
116
|
}
|
|
117
|
+
*/
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
@utility left-start {
|
|
@@ -111,11 +125,13 @@
|
|
|
111
125
|
transform-origin: right top;
|
|
112
126
|
}
|
|
113
127
|
|
|
128
|
+
/*
|
|
114
129
|
@container anchored(fallback: flip-block) {
|
|
115
130
|
> * {
|
|
116
131
|
transform-origin: left top;
|
|
117
132
|
}
|
|
118
133
|
}
|
|
134
|
+
*/
|
|
119
135
|
}
|
|
120
136
|
|
|
121
137
|
@utility left-end {
|
|
@@ -126,11 +142,13 @@
|
|
|
126
142
|
transform-origin: right bottom;
|
|
127
143
|
}
|
|
128
144
|
|
|
145
|
+
/*
|
|
129
146
|
@container anchored(fallback: flip-block) {
|
|
130
147
|
> * {
|
|
131
148
|
transform-origin: left bottom;
|
|
132
149
|
}
|
|
133
150
|
}
|
|
151
|
+
*/
|
|
134
152
|
}
|
|
135
153
|
|
|
136
154
|
@utility right {
|
|
@@ -141,11 +159,13 @@
|
|
|
141
159
|
transform-origin: left;
|
|
142
160
|
}
|
|
143
161
|
|
|
162
|
+
/*
|
|
144
163
|
@container anchored(fallback: flip-block) {
|
|
145
164
|
> * {
|
|
146
165
|
transform-origin: right;
|
|
147
166
|
}
|
|
148
167
|
}
|
|
168
|
+
*/
|
|
149
169
|
}
|
|
150
170
|
|
|
151
171
|
@utility right-start {
|
|
@@ -156,11 +176,13 @@
|
|
|
156
176
|
transform-origin: left top;
|
|
157
177
|
}
|
|
158
178
|
|
|
179
|
+
/*
|
|
159
180
|
@container anchored(fallback: flip-block) {
|
|
160
181
|
> * {
|
|
161
182
|
transform-origin: right top;
|
|
162
183
|
}
|
|
163
184
|
}
|
|
185
|
+
*/
|
|
164
186
|
}
|
|
165
187
|
|
|
166
188
|
@utility right-end {
|
|
@@ -171,9 +193,11 @@
|
|
|
171
193
|
transform-origin: left bottom;
|
|
172
194
|
}
|
|
173
195
|
|
|
196
|
+
/*
|
|
174
197
|
@container anchored(fallback: flip-block) {
|
|
175
198
|
> * {
|
|
176
199
|
transform-origin: right bottom;
|
|
177
200
|
}
|
|
178
201
|
}
|
|
202
|
+
*/
|
|
179
203
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ declare module 'winduum/src/components/drawer' {
|
|
|
121
121
|
|
|
122
122
|
declare module 'winduum/src/components/form' {
|
|
123
123
|
export interface ValidateFormOptions {
|
|
124
|
-
|
|
124
|
+
validateSelector?: string
|
|
125
125
|
validateOptions?: ValidateFieldOptions
|
|
126
126
|
validateField?: typeof validateField
|
|
127
127
|
scrollOptions?: ScrollIntoViewOptions
|
|
@@ -132,23 +132,16 @@ declare module 'winduum/src/components/form' {
|
|
|
132
132
|
validate?: boolean
|
|
133
133
|
validationMessage?: string
|
|
134
134
|
selector?: string
|
|
135
|
-
ignoreMatch?: RegExp
|
|
136
135
|
validitySelector?: string
|
|
137
|
-
infoParentSelector?: string
|
|
138
|
-
infoSelector?: string
|
|
139
136
|
infoContent?: string
|
|
140
137
|
endParentSelector?: string
|
|
141
138
|
endSelector?: string
|
|
142
139
|
endContent?: string
|
|
143
|
-
validAttribute?: string
|
|
144
|
-
validIcon?: string | null
|
|
145
|
-
invalidAttribute?: string
|
|
146
140
|
invalidIcon?: string
|
|
147
|
-
activeAttribute?: string
|
|
148
141
|
}
|
|
149
142
|
|
|
150
143
|
export function validateForm(event: Event | SubmitEvent, options?: ValidateFormOptions): void
|
|
151
|
-
export function validateField(element: HTMLElement
|
|
144
|
+
export function validateField(element: HTMLElement, options?: ValidateFieldOptions): void
|
|
152
145
|
|
|
153
146
|
export {};
|
|
154
147
|
}
|