zidan-select 2.2.4 → 2.3.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 +95 -50
- package/dist/file/plugin-file-core.css +31 -5
- package/dist/file/plugin-file-core.min.css +9 -0
- package/dist/file/plugin-file-theme.css +23 -6
- package/dist/file/plugin-file-theme.min.css +9 -0
- package/dist/file/zidan-file.d.ts +32 -0
- package/dist/file/zidan-file.js +196 -23
- package/dist/file/zidan-file.min.js +11 -0
- package/dist/plugin-core.css +106 -15
- package/dist/plugin-core.min.css +10 -0
- package/dist/plugin-theme.css +36 -6
- package/dist/plugin-theme.min.css +13 -0
- package/dist/select/plugin-select-core.css +22 -3
- package/dist/select/plugin-select-core.min.css +9 -0
- package/dist/select/plugin-select-theme.css +28 -4
- package/dist/select/plugin-select-theme.min.css +9 -0
- package/dist/select/zidan-select.d.ts +33 -0
- package/dist/select/zidan-select.js +277 -26
- package/dist/select/zidan-select.min.js +11 -0
- package/dist/zidan-form.js +448 -58
- package/dist/zidan-form.min.js +14 -0
- package/docs/build.md +11 -10
- package/docs/comparison.md +11 -6
- package/docs/html-and-wordpress.md +893 -0
- package/docs/index.html +13 -3
- package/docs/options.md +57 -9
- package/docs/validation.md +36 -1
- package/package.json +21 -1
- package/plugin-core.css +106 -15
- package/plugin-theme.css +36 -6
- package/zidan-form.d.ts +422 -0
- package/zidan-form.js +448 -58
package/docs/index.html
CHANGED
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
<h1>ZidanForm documentation</h1>
|
|
47
47
|
<p class="lead">
|
|
48
48
|
Zero-dependency form enhancement: select, checkbox, switch, radio, file upload, text,
|
|
49
|
-
number, phone, date and range inputs — with input icons, steppers
|
|
49
|
+
number, phone, date and range inputs — with input icons, steppers, upload progress,
|
|
50
|
+
async validation, remote select pagination, RTL support and TypeScript declarations.
|
|
50
51
|
Start with the <a href="../index.html">interactive demo</a> or the
|
|
51
52
|
<a href="../playground.html">field playground</a>, then dive into the reference.
|
|
52
53
|
</p>
|
|
@@ -59,6 +60,14 @@
|
|
|
59
60
|
<strong><a href="../playground.html">Field playground</a></strong>
|
|
60
61
|
<span>Pick one control, toggle its options, preview it live and copy the matching HTML attributes or vanilla JavaScript call.</span>
|
|
61
62
|
</li>
|
|
63
|
+
<li>
|
|
64
|
+
<strong><a href="https://github.com/akhtar1985/zidan-select/blob/main/docs/html-and-wordpress.md">Static HTML & WordPress cookbook</a></strong>
|
|
65
|
+
<span>Complete copy-paste pages for plain HTML, select-only and file-only builds, ID/class targeting, WordPress <code>functions.php</code>, Shopify <code>asset_url</code> + Liquid sections, and troubleshooting for page builders and caching plugins.</span>
|
|
66
|
+
</li>
|
|
67
|
+
<li>
|
|
68
|
+
<strong><a href="../shopify.html">Shopify product-page demo</a></strong>
|
|
69
|
+
<span>A mock storefront product form: variant combobox, stepper, gift-wrap switch, tile radios and an upload dropzone — with the Liquid snippets to install it in a theme, and what Shopify's checkout does not allow.</span>
|
|
70
|
+
</li>
|
|
62
71
|
<li>
|
|
63
72
|
<strong><a href="https://github.com/akhtar1985/zidan-select#which-files-should-you-load">Which files should I load?</a></strong>
|
|
64
73
|
<span>Only want a select, or only a file upload? Load only that build — you do not need the full bundle. The complete form JS and CSS is for forms that enhance every input at once.</span>
|
|
@@ -69,7 +78,7 @@
|
|
|
69
78
|
</li>
|
|
70
79
|
<li>
|
|
71
80
|
<strong><a href="https://github.com/akhtar1985/zidan-select/blob/main/docs/options.md">Options & data attributes</a></strong>
|
|
72
|
-
<span>Every JS option, data attribute, callback, event and instance method —
|
|
81
|
+
<span>Every JS option, data attribute, callback, event and instance method — remote pagination and cache controls, no-JS init by marker class, form scope, <code>data-zidan-options</code> JSON and config targets, in the full build and both subsets. TypeScript declarations ship with the package.</span>
|
|
73
82
|
</li>
|
|
74
83
|
<li>
|
|
75
84
|
<strong><a href="https://github.com/akhtar1985/zidan-select/blob/main/docs/validation.md">Validation compatibility</a></strong>
|
|
@@ -94,7 +103,8 @@
|
|
|
94
103
|
</ul>
|
|
95
104
|
<footer>
|
|
96
105
|
Markdown guides open rendered on GitHub; <a href="../index.html">the demo</a>, the
|
|
97
|
-
<a href="../playground.html">field playground</a
|
|
106
|
+
<a href="../playground.html">field playground</a>, the
|
|
107
|
+
<a href="../shopify.html">Shopify product-page demo</a> and the
|
|
98
108
|
<a href="validation.html">validation bench</a> run here on GitHub Pages.
|
|
99
109
|
Source: <a href="https://github.com/akhtar1985/zidan-select">github.com/akhtar1985/zidan-select</a>.
|
|
100
110
|
</footer>
|
package/docs/options.md
CHANGED
|
@@ -14,7 +14,9 @@ passed to `initZidanSelects()` / `initZidanForms()` / `zidanSelect()` / `zidanFi
|
|
|
14
14
|
## Direct init by ID or class
|
|
15
15
|
|
|
16
16
|
The first argument of `zidanSelect()` accepts a CSS selector, an element, or a NodeList. Plain
|
|
17
|
-
selects are not auto-initialised, so you can enhance exactly the field you want
|
|
17
|
+
selects are not auto-initialised, so you can enhance exactly the field you want. For complete
|
|
18
|
+
copy-paste pages (static HTML, WordPress, page builders) see the
|
|
19
|
+
[static HTML & WordPress cookbook](html-and-wordpress.md).
|
|
18
20
|
|
|
19
21
|
```html
|
|
20
22
|
<select id="mymov">…</select>
|
|
@@ -402,7 +404,7 @@ const upload = zidanField('#files', {
|
|
|
402
404
|
replaceTitle: 'Change image',
|
|
403
405
|
|
|
404
406
|
/* Upload pipeline */
|
|
405
|
-
// upload: function (context) { … },
|
|
407
|
+
// upload: function (file, context) { … }, // custom uploader, contract below
|
|
406
408
|
// uploadUrl: '/api/files', // or XHR endpoint
|
|
407
409
|
uploadField: 'file',
|
|
408
410
|
// uploadData: function (file, field) { return { folder: 'avatars' }; },
|
|
@@ -434,7 +436,8 @@ Custom uploader contract:
|
|
|
434
436
|
|
|
435
437
|
```js
|
|
436
438
|
zidanField('#files', {
|
|
437
|
-
upload(context) {
|
|
439
|
+
upload(file, context) {
|
|
440
|
+
// file: the File being uploaded
|
|
438
441
|
// context: { file, field, formData, signal, onProgress, complete, fail }
|
|
439
442
|
const xhr = new XMLHttpRequest();
|
|
440
443
|
// ...or return a promise / call context.complete(result) / context.fail(error)
|
|
@@ -513,12 +516,50 @@ Callbacks: `onUploadStart`, `onUploadProgress`, `onUploadSuccess` / `onUpload`,
|
|
|
513
516
|
|
|
514
517
|
| Option | Default | Description |
|
|
515
518
|
| --- | --- | --- |
|
|
516
|
-
| `fetchOptions(query, signal)` | — | Return
|
|
519
|
+
| `fetchOptions(query, signal, context)` | — | Return an array of items, or a page `{ items, hasMore }` (or `{ items, total }`). `signal` aborts stale requests; `context` is `{ page, pageSize, append, instance }`. |
|
|
520
|
+
| `fetchPageSize` | `0` | Page size handed to `fetchOptions`. `0` keeps the legacy single-request behaviour. |
|
|
521
|
+
| `autoLoadMore` | `true` | Scrolling near the dropdown bottom fetches the next page automatically. |
|
|
522
|
+
| `loadMoreText` | `Load more` | Label of the footer button rendered while `hasMore` is true. |
|
|
523
|
+
| `cacheResults` | `true` | Cache pages per query + page. Clear with `select.clearCache()`. |
|
|
524
|
+
| `onLoadMore` | — | Called when a follow-up page starts loading: `{ page, query, instance }`. |
|
|
517
525
|
| `debounce` | `250` | Async debounce in ms. |
|
|
518
526
|
| `minChars` | `0` | Characters before fetching. |
|
|
519
527
|
| `allowFreeText` | tags only | Allow values not in the list. |
|
|
520
528
|
| `searchValues` | `true` | Match against values as well as labels. |
|
|
521
529
|
|
|
530
|
+
Remote results are **not** filtered again on the client, so a server that already applied
|
|
531
|
+
the query is never double-filtered. Use `renderOption` for custom rows; keep values stable
|
|
532
|
+
across pages so the merge can de-duplicate them.
|
|
533
|
+
|
|
534
|
+
```js
|
|
535
|
+
const users = zidanSelect('#owner', {
|
|
536
|
+
mode: 'combobox',
|
|
537
|
+
fetchPageSize: 20,
|
|
538
|
+
fetchOptions: async (query, signal, { page, pageSize }) => {
|
|
539
|
+
const res = await fetch('/api/users?q=' + encodeURIComponent(query)
|
|
540
|
+
+ '&page=' + page + '&size=' + pageSize, { signal });
|
|
541
|
+
const data = await res.json();
|
|
542
|
+
return {
|
|
543
|
+
items: data.rows.map(u => ({ value: u.id, label: u.name })),
|
|
544
|
+
hasMore: data.page + 1 < data.pages
|
|
545
|
+
};
|
|
546
|
+
},
|
|
547
|
+
onLoadMore: ({ page }) => console.log('loaded page', page)
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
users.loadMore(); // manual next page
|
|
551
|
+
users.hasMoreResults(); // boolean
|
|
552
|
+
users.getAsyncState(); // { query, page, hasMore, loading, fetchingMore, error }
|
|
553
|
+
users.refreshOptions(); // clears the cache and refetches page 0
|
|
554
|
+
users.clearCache(); // drop cached pages only
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
`fetchOptions` may also reject: the current list stays on screen, the footer shows the error
|
|
558
|
+
and clicking it retries. Appended fetches emit `zidan:load-more` with `{ page, query }`;
|
|
559
|
+
failures emit the usual `zidan:error`.
|
|
560
|
+
|
|
561
|
+
The cache size is global: `ZidanSelect.cacheLimit = 50` pages (least-recently-used eviction).
|
|
562
|
+
|
|
522
563
|
### Tags
|
|
523
564
|
|
|
524
565
|
| Option | Data attribute | Default |
|
|
@@ -545,7 +586,7 @@ Callbacks: `onUploadStart`, `onUploadProgress`, `onUploadSuccess` / `onUpload`,
|
|
|
545
586
|
|
|
546
587
|
### Select callbacks
|
|
547
588
|
|
|
548
|
-
`onInit`, `onChange`, `onSelect`, `onOpen`, `onClose`, `onTagAdd`, `onTagRemove`, `onError`.
|
|
589
|
+
`onInit`, `onChange`, `onSelect`, `onOpen`, `onClose`, `onTagAdd`, `onTagRemove`, `onLoadMore`, `onError`.
|
|
549
590
|
Every callback receives a single payload object with `instance` and the relevant value(s).
|
|
550
591
|
|
|
551
592
|
### Every select option in one object
|
|
@@ -591,10 +632,14 @@ const picker = zidanSelect('#mymov', {
|
|
|
591
632
|
clearText: 'Clear selection',
|
|
592
633
|
|
|
593
634
|
/* Combobox / async */
|
|
594
|
-
// fetchOptions: function (query, signal) {
|
|
595
|
-
// return fetch('/api/movies?q=' + encodeURIComponent(query), { signal: signal })
|
|
596
|
-
// .then(function (response) { return response.json(); });
|
|
635
|
+
// fetchOptions: function (query, signal, context) {
|
|
636
|
+
// return fetch('/api/movies?q=' + encodeURIComponent(query) + '&page=' + context.page, { signal: signal })
|
|
637
|
+
// .then(function (response) { return response.json(); }); // items[] or { items, hasMore }
|
|
597
638
|
// },
|
|
639
|
+
fetchPageSize: 0, // >0 enables paged responses, load-more and scroll auto-load
|
|
640
|
+
autoLoadMore: true,
|
|
641
|
+
cacheResults: true, // ZidanSelect.cacheLimit = 50 pages, LRU
|
|
642
|
+
loadMoreText: 'Load more',
|
|
598
643
|
debounce: 250, // ms
|
|
599
644
|
minChars: 0,
|
|
600
645
|
searchValues: true, // match labels and values
|
|
@@ -618,12 +663,15 @@ const picker = zidanSelect('#mymov', {
|
|
|
618
663
|
// validateTag: function (tag) { return tag.length <= 24 || 'Use 24 characters or fewer'; },
|
|
619
664
|
// formatTag: function (tag) { return tag.toUpperCase(); },
|
|
620
665
|
|
|
621
|
-
/* Callbacks — also: onSelect, onOpen, onClose, onTagAdd, onTagRemove, onError */
|
|
666
|
+
/* Callbacks — also: onSelect, onOpen, onClose, onTagAdd, onTagRemove, onLoadMore, onError */
|
|
622
667
|
onInit: function (event) { console.log('init', event.instance); },
|
|
623
668
|
onChange: function (event) { console.log('value', event.value); }
|
|
624
669
|
});
|
|
625
670
|
```
|
|
626
671
|
|
|
672
|
+
Methods for paged data: `loadMore()`, `hasMoreResults()`, `getAsyncState()`,
|
|
673
|
+
`refreshOptions()`, `clearCache()`.
|
|
674
|
+
|
|
627
675
|
Data attributes remain available as a 1:1 fallback; the tables above list the matching
|
|
628
676
|
`data-zidan-*` name for each option, and `data-zidan-options` accepts any literal-value subset
|
|
629
677
|
as JSON.
|
package/docs/validation.md
CHANGED
|
@@ -16,7 +16,8 @@ native validation, `FormData` and third-party validators keep working.
|
|
|
16
16
|
| `input.setCustomValidity()` | plugin | phone length, weekends, blocked dates, custom `validate`, file limits |
|
|
17
17
|
| `aria-invalid` | plugin (`setValidation`) or your validator | screen readers and CSS |
|
|
18
18
|
| `.zs-field--invalid` / `.zs-field--valid` | plugin | theme states |
|
|
19
|
-
|
|
|
19
|
+
| `.zs-field--pending` / `aria-busy` | plugin | in-flight async rule |
|
|
20
|
+
| `data-zs-validation="valid\|invalid\|pending"` | plugin | attribute-based styling |
|
|
20
21
|
|
|
21
22
|
The plugin marks a field invalid when:
|
|
22
23
|
|
|
@@ -63,6 +64,40 @@ Object.assign(ZidanForm.messages, {
|
|
|
63
64
|
});
|
|
64
65
|
```
|
|
65
66
|
|
|
67
|
+
## Async rules
|
|
68
|
+
|
|
69
|
+
`validate` and `validateDate` may return a Promise. The field then:
|
|
70
|
+
|
|
71
|
+
1. shows a `.zs-field--pending` spinner and `aria-busy="true"`,
|
|
72
|
+
2. writes `messages.pending` (`Checking…`) into native validity, so `form.checkValidity()`
|
|
73
|
+
and any submit handler wait for the answer,
|
|
74
|
+
3. aborts the previous request when the value changes and ignores stale resolutions,
|
|
75
|
+
4. resolves `validate()` to `true`/`false` instead of a boolean,
|
|
76
|
+
5. emits `zidan:async-validation` with `{ valid, message }`.
|
|
77
|
+
|
|
78
|
+
Validators receive an `AbortSignal` as their third argument (after `value`/`checked` and the
|
|
79
|
+
field) and may reject — the rejection message is shown as the error.
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
const email = zidanField('#email', {
|
|
83
|
+
alwaysValidate: true,
|
|
84
|
+
showValidState: true,
|
|
85
|
+
validate: async (value, field, { signal }) => {
|
|
86
|
+
if (!value) return true;
|
|
87
|
+
const res = await fetch('/api/check-email?e=' + encodeURIComponent(value), { signal });
|
|
88
|
+
const { taken } = await res.json();
|
|
89
|
+
return taken ? 'This address is already registered.' : true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
await email.validate(); // Promise<boolean>
|
|
94
|
+
email.isPending(); // true while the request is in flight
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Submission is blocked while pending because the native control carries the pending message;
|
|
98
|
+
listen for `zidan:async-validation` if you need your own spinner or toast. `destroy()` aborts
|
|
99
|
+
any in-flight check, and `field.reset()` clears the pending state.
|
|
100
|
+
|
|
66
101
|
## The hidden-input trap
|
|
67
102
|
|
|
68
103
|
jQuery Validation's default `ignore: ":hidden"` checks `offsetWidth`/`offsetHeight`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidan-select",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Zero-dependency form enhancement library: select/combobox/tags, checkboxes, switches, radio groups, drag & drop file upload with progress, text/number/phone/date/range inputs and textarea with input icons and steppers. Split core/theme CSS, 5 themes, 11 layouts, framework adapters. Load only the select-only or file-only build if that is all you need, or the full form bundle to enhance every input at once.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"select",
|
|
@@ -36,31 +36,44 @@
|
|
|
36
36
|
},
|
|
37
37
|
"main": "zidan-form.js",
|
|
38
38
|
"module": "zidan-form.mjs",
|
|
39
|
+
"types": "zidan-form.d.ts",
|
|
39
40
|
"unpkg": "zidan-form.js",
|
|
40
41
|
"jsdelivr": "zidan-form.js",
|
|
41
42
|
"style": "plugin-theme.css",
|
|
42
43
|
"exports": {
|
|
43
44
|
".": {
|
|
45
|
+
"types": "./zidan-form.d.ts",
|
|
44
46
|
"import": "./zidan-form.mjs",
|
|
45
47
|
"require": "./zidan-form.js",
|
|
46
48
|
"default": "./zidan-form.js"
|
|
47
49
|
},
|
|
48
50
|
"./select": {
|
|
51
|
+
"types": "./dist/select/zidan-select.d.ts",
|
|
49
52
|
"import": "./dist/select/zidan-select.mjs",
|
|
50
53
|
"require": "./dist/select/zidan-select.js",
|
|
51
54
|
"default": "./dist/select/zidan-select.js"
|
|
52
55
|
},
|
|
56
|
+
"./select/min": "./dist/select/zidan-select.min.js",
|
|
53
57
|
"./select/css/core": "./dist/select/plugin-select-core.css",
|
|
54
58
|
"./select/css/theme": "./dist/select/plugin-select-theme.css",
|
|
59
|
+
"./select/css/core.min": "./dist/select/plugin-select-core.min.css",
|
|
60
|
+
"./select/css/theme.min": "./dist/select/plugin-select-theme.min.css",
|
|
55
61
|
"./file": {
|
|
62
|
+
"types": "./dist/file/zidan-file.d.ts",
|
|
56
63
|
"import": "./dist/file/zidan-file.mjs",
|
|
57
64
|
"require": "./dist/file/zidan-file.js",
|
|
58
65
|
"default": "./dist/file/zidan-file.js"
|
|
59
66
|
},
|
|
67
|
+
"./file/min": "./dist/file/zidan-file.min.js",
|
|
60
68
|
"./file/css/core": "./dist/file/plugin-file-core.css",
|
|
61
69
|
"./file/css/theme": "./dist/file/plugin-file-theme.css",
|
|
70
|
+
"./file/css/core.min": "./dist/file/plugin-file-core.min.css",
|
|
71
|
+
"./file/css/theme.min": "./dist/file/plugin-file-theme.min.css",
|
|
72
|
+
"./min": "./dist/zidan-form.min.js",
|
|
62
73
|
"./css/core": "./plugin-core.css",
|
|
63
74
|
"./css/theme": "./plugin-theme.css",
|
|
75
|
+
"./css/core.min": "./dist/plugin-core.min.css",
|
|
76
|
+
"./css/theme.min": "./dist/plugin-theme.min.css",
|
|
64
77
|
"./core.css": "./plugin-core.css",
|
|
65
78
|
"./theme.css": "./plugin-theme.css",
|
|
66
79
|
"./package.json": "./package.json"
|
|
@@ -68,6 +81,7 @@
|
|
|
68
81
|
"files": [
|
|
69
82
|
"zidan-form.js",
|
|
70
83
|
"zidan-form.mjs",
|
|
84
|
+
"zidan-form.d.ts",
|
|
71
85
|
"plugin-core.css",
|
|
72
86
|
"plugin-theme.css",
|
|
73
87
|
"dist",
|
|
@@ -86,6 +100,7 @@
|
|
|
86
100
|
"dev": "node scripts/serve.mjs",
|
|
87
101
|
"build": "node scripts/build.mjs",
|
|
88
102
|
"test": "node scripts/test.mjs",
|
|
103
|
+
"types": "tsc -p tsconfig.types.json",
|
|
89
104
|
"lint": "node --check zidan-form.js && node --check demo.js && node --check playground.js && node --check zidan-form.mjs"
|
|
90
105
|
},
|
|
91
106
|
"engines": {
|
|
@@ -93,5 +108,10 @@
|
|
|
93
108
|
},
|
|
94
109
|
"publishConfig": {
|
|
95
110
|
"access": "public"
|
|
111
|
+
},
|
|
112
|
+
"devDependencies": {
|
|
113
|
+
"esbuild": "^0.21.5",
|
|
114
|
+
"jsdom": "^24.1.3",
|
|
115
|
+
"typescript": "^5.9.3"
|
|
96
116
|
}
|
|
97
117
|
}
|
package/plugin-core.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ZidanForm v2.
|
|
2
|
+
* ZidanForm v2.3.0 — plugin-core.css
|
|
3
3
|
* Structure and mechanics only: layout, positioning, visibility, focus
|
|
4
4
|
* plumbing and accessible native-input handling. No colours, borders colours,
|
|
5
5
|
* shadows or decorative skin — load plugin-theme.css (or your own theme) for
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
flex: 0 0 auto;
|
|
302
302
|
width: 14px;
|
|
303
303
|
height: 14px;
|
|
304
|
-
margin-
|
|
304
|
+
margin-inline-start: auto;
|
|
305
305
|
background-color: currentColor;
|
|
306
306
|
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
307
307
|
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
@@ -338,6 +338,25 @@
|
|
|
338
338
|
to { transform: rotate(360deg); }
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
.zs-root .zs-more {
|
|
342
|
+
display: flex;
|
|
343
|
+
align-items: center;
|
|
344
|
+
justify-content: center;
|
|
345
|
+
gap: 8px;
|
|
346
|
+
width: 100%;
|
|
347
|
+
padding: 10px 12px;
|
|
348
|
+
border: 0;
|
|
349
|
+
border-top: 1px solid transparent;
|
|
350
|
+
background: none;
|
|
351
|
+
font: inherit;
|
|
352
|
+
font-size: 0.8125rem;
|
|
353
|
+
cursor: pointer;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.zs-root .zs-more[disabled] {
|
|
357
|
+
cursor: default;
|
|
358
|
+
}
|
|
359
|
+
|
|
341
360
|
@media (max-width: 480px) {
|
|
342
361
|
.zs-root .zs-dropdown {
|
|
343
362
|
max-height: min(280px, 45vh);
|
|
@@ -378,7 +397,7 @@
|
|
|
378
397
|
|
|
379
398
|
.zs-root[data-zs-layout="floating-label"] .zs-label {
|
|
380
399
|
position: absolute;
|
|
381
|
-
|
|
400
|
+
inset-inline-start: calc(var(--zs-padding-x, 12px) + 1px);
|
|
382
401
|
top: 50%;
|
|
383
402
|
margin: 0;
|
|
384
403
|
padding: 0 4px;
|
|
@@ -472,11 +491,37 @@
|
|
|
472
491
|
================================================================== */
|
|
473
492
|
|
|
474
493
|
.zs-field {
|
|
494
|
+
position: relative;
|
|
475
495
|
display: flex;
|
|
476
496
|
flex-direction: column;
|
|
477
497
|
gap: var(--zs-field-gap, 6px);
|
|
478
498
|
}
|
|
479
499
|
|
|
500
|
+
.zs-field--pending::after {
|
|
501
|
+
content: "";
|
|
502
|
+
position: absolute;
|
|
503
|
+
top: 2px;
|
|
504
|
+
inset-inline-end: 0;
|
|
505
|
+
width: 0.85em;
|
|
506
|
+
height: 0.85em;
|
|
507
|
+
border-width: 2px;
|
|
508
|
+
border-style: solid;
|
|
509
|
+
border-color: transparent;
|
|
510
|
+
border-radius: 50%;
|
|
511
|
+
animation: zs-field-spin 0.7s linear infinite;
|
|
512
|
+
pointer-events: none;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
@keyframes zs-field-spin {
|
|
516
|
+
to { transform: rotate(360deg); }
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
@media (prefers-reduced-motion: reduce) {
|
|
520
|
+
.zs-field--pending::after {
|
|
521
|
+
animation-duration: 2s;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
480
525
|
.zs-field[data-zs-layout="inline"] {
|
|
481
526
|
flex-direction: row;
|
|
482
527
|
align-items: center;
|
|
@@ -514,7 +559,7 @@
|
|
|
514
559
|
}
|
|
515
560
|
|
|
516
561
|
.zs-counter {
|
|
517
|
-
margin-
|
|
562
|
+
margin-inline-start: auto;
|
|
518
563
|
font-size: 0.75rem;
|
|
519
564
|
font-variant-numeric: tabular-nums;
|
|
520
565
|
white-space: nowrap;
|
|
@@ -629,7 +674,7 @@
|
|
|
629
674
|
content: "";
|
|
630
675
|
position: absolute;
|
|
631
676
|
top: 50%;
|
|
632
|
-
|
|
677
|
+
inset-inline-start: 2px;
|
|
633
678
|
width: calc(var(--zs-switch-height, 22px) - 6px);
|
|
634
679
|
height: calc(var(--zs-switch-height, 22px) - 6px);
|
|
635
680
|
transform: translateY(-50%);
|
|
@@ -656,11 +701,11 @@
|
|
|
656
701
|
}
|
|
657
702
|
|
|
658
703
|
.zs-switch-on {
|
|
659
|
-
|
|
704
|
+
inset-inline-start: 5px;
|
|
660
705
|
}
|
|
661
706
|
|
|
662
707
|
.zs-switch-off {
|
|
663
|
-
|
|
708
|
+
inset-inline-end: 5px;
|
|
664
709
|
}
|
|
665
710
|
|
|
666
711
|
.zs-check--checked .zs-switch-on {
|
|
@@ -680,7 +725,7 @@
|
|
|
680
725
|
.zs-field[data-zs-switch-style="material"] .zs-switch-track::after {
|
|
681
726
|
width: 22px;
|
|
682
727
|
height: 22px;
|
|
683
|
-
|
|
728
|
+
inset-inline-start: -2px;
|
|
684
729
|
border-radius: 50%;
|
|
685
730
|
}
|
|
686
731
|
|
|
@@ -730,6 +775,33 @@
|
|
|
730
775
|
font-size: 0.625rem;
|
|
731
776
|
}
|
|
732
777
|
|
|
778
|
+
/* right-to-left: the knob travels from the inline start towards the inline end */
|
|
779
|
+
[dir="rtl"] .zs-check--checked .zs-switch-track::after {
|
|
780
|
+
transform: translate(calc(-1 * (var(--zs-switch-width, 40px) - var(--zs-switch-height, 22px))), -50%);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
[dir="rtl"] .zs-field[data-zs-switch-style="material"] .zs-check--checked .zs-switch-track::after {
|
|
784
|
+
transform: translate(-26px, -50%);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
[dir="rtl"] .zs-field[data-zs-switch-style="labeled"] .zs-check--checked .zs-switch-track::after,
|
|
788
|
+
[dir="rtl"] .zs-field[data-zs-switch-style="icon"] .zs-check--checked .zs-switch-track::after {
|
|
789
|
+
transform: translate(-32px, -50%);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.zs-field[dir="rtl"] .zs-check--checked .zs-switch-track::after {
|
|
793
|
+
transform: translate(calc(-1 * (var(--zs-switch-width, 40px) - var(--zs-switch-height, 22px))), -50%);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.zs-field[dir="rtl"][data-zs-switch-style="material"] .zs-check--checked .zs-switch-track::after {
|
|
797
|
+
transform: translate(-26px, -50%);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.zs-field[dir="rtl"][data-zs-switch-style="labeled"] .zs-check--checked .zs-switch-track::after,
|
|
801
|
+
.zs-field[dir="rtl"][data-zs-switch-style="icon"] .zs-check--checked .zs-switch-track::after {
|
|
802
|
+
transform: translate(-32px, -50%);
|
|
803
|
+
}
|
|
804
|
+
|
|
733
805
|
/* card variant */
|
|
734
806
|
.zs-field[data-zs-variant="card"] .zs-check {
|
|
735
807
|
width: 100%;
|
|
@@ -1013,7 +1085,7 @@
|
|
|
1013
1085
|
}
|
|
1014
1086
|
|
|
1015
1087
|
.zs-file-clear {
|
|
1016
|
-
margin-
|
|
1088
|
+
margin-inline-start: auto;
|
|
1017
1089
|
padding: 2px 8px;
|
|
1018
1090
|
border-width: 1px;
|
|
1019
1091
|
border-style: solid;
|
|
@@ -1036,7 +1108,7 @@
|
|
|
1036
1108
|
gap: 8px;
|
|
1037
1109
|
min-height: 0;
|
|
1038
1110
|
padding: 10px 14px;
|
|
1039
|
-
text-align:
|
|
1111
|
+
text-align: start;
|
|
1040
1112
|
border-style: solid;
|
|
1041
1113
|
}
|
|
1042
1114
|
|
|
@@ -1053,7 +1125,7 @@
|
|
|
1053
1125
|
|
|
1054
1126
|
.zs-field--file .zs-file-drop--button .zs-file-drop-hint,
|
|
1055
1127
|
.zs-field--file .zs-file-drop--compact .zs-file-drop-hint {
|
|
1056
|
-
margin-
|
|
1128
|
+
margin-inline-start: auto;
|
|
1057
1129
|
}
|
|
1058
1130
|
|
|
1059
1131
|
.zs-field--file .zs-file-drop--avatar {
|
|
@@ -1344,8 +1416,8 @@ textarea.zs-input-native {
|
|
|
1344
1416
|
color: inherit;
|
|
1345
1417
|
background: transparent;
|
|
1346
1418
|
border: 0;
|
|
1347
|
-
border-
|
|
1348
|
-
border-
|
|
1419
|
+
border-inline-end-width: 1px;
|
|
1420
|
+
border-inline-end-style: solid;
|
|
1349
1421
|
cursor: pointer;
|
|
1350
1422
|
}
|
|
1351
1423
|
|
|
@@ -1456,6 +1528,7 @@ textarea.zs-input-native {
|
|
|
1456
1528
|
|
|
1457
1529
|
.zs-range-tick {
|
|
1458
1530
|
position: absolute;
|
|
1531
|
+
inset-inline-start: var(--zs-range-tick-pct, 0);
|
|
1459
1532
|
top: 0;
|
|
1460
1533
|
width: 2px;
|
|
1461
1534
|
height: 6px;
|
|
@@ -1482,7 +1555,7 @@ textarea.zs-input-native {
|
|
|
1482
1555
|
.zs-range-bubble {
|
|
1483
1556
|
position: absolute;
|
|
1484
1557
|
top: 0;
|
|
1485
|
-
|
|
1558
|
+
inset-inline-start: calc(var(--zs-range-pct, 0) * 100%);
|
|
1486
1559
|
min-width: 28px;
|
|
1487
1560
|
padding: 1px 6px;
|
|
1488
1561
|
text-align: center;
|
|
@@ -1495,6 +1568,24 @@ textarea.zs-input-native {
|
|
|
1495
1568
|
pointer-events: none;
|
|
1496
1569
|
}
|
|
1497
1570
|
|
|
1571
|
+
[dir="rtl"] .zs-range-tick,
|
|
1572
|
+
[dir="rtl"] .zs-range-tick--labeled {
|
|
1573
|
+
transform: translateX(50%);
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
[dir="rtl"] .zs-range-bubble {
|
|
1577
|
+
transform: translateX(50%);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
.zs-field[dir="rtl"] .zs-range-tick,
|
|
1581
|
+
.zs-field[dir="rtl"] .zs-range-tick--labeled {
|
|
1582
|
+
transform: translateX(50%);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
.zs-field[dir="rtl"] .zs-range-bubble {
|
|
1586
|
+
transform: translateX(50%);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1498
1589
|
/* validation state icons */
|
|
1499
1590
|
.zs-input-validation {
|
|
1500
1591
|
display: none;
|
|
@@ -1524,7 +1615,7 @@ textarea.zs-input-native {
|
|
|
1524
1615
|
.zs-field[data-zs-layout="floating"] .zs-field__label,
|
|
1525
1616
|
.zs-field[data-zs-layout="outlined"] .zs-field__label {
|
|
1526
1617
|
position: absolute;
|
|
1527
|
-
|
|
1618
|
+
inset-inline-start: calc(var(--zs-padding-x, 12px) + 2px);
|
|
1528
1619
|
top: 50%;
|
|
1529
1620
|
margin: 0;
|
|
1530
1621
|
padding: 0 4px;
|
package/plugin-theme.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ZidanForm v2.
|
|
2
|
+
* ZidanForm v2.3.0 — plugin-theme.css
|
|
3
3
|
* Design tokens, paint, state colours, preset themes (default, modern,
|
|
4
4
|
* minimal, dark, glass), the five select layouts and framework adapters
|
|
5
5
|
* (bootstrap, tailwind, bulma, foundation).
|
|
@@ -103,7 +103,8 @@
|
|
|
103
103
|
/* range */
|
|
104
104
|
--zs-range-track: #e7eaf0;
|
|
105
105
|
--zs-range-fill: var(--zs-primary);
|
|
106
|
-
--zs-range-
|
|
106
|
+
--zs-range-angle: 90deg;
|
|
107
|
+
--zs-range-gradient: linear-gradient(var(--zs-range-angle, 90deg), #f59e0b, #ef4444, #8b5cf6);
|
|
107
108
|
--zs-range-thumb-bg: #ffffff;
|
|
108
109
|
--zs-range-thumb-border: var(--zs-primary);
|
|
109
110
|
--zs-range-tick: #c3c9d2;
|
|
@@ -134,6 +135,15 @@
|
|
|
134
135
|
--zs-shadow: none;
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
[dir="rtl"] .zs-root,
|
|
139
|
+
[dir="rtl"] .zs-field,
|
|
140
|
+
[dir="rtl"] .zs-radio-group,
|
|
141
|
+
.zs-root[dir="rtl"],
|
|
142
|
+
.zs-field[dir="rtl"],
|
|
143
|
+
.zs-radio-group[dir="rtl"] {
|
|
144
|
+
--zs-range-angle: 270deg;
|
|
145
|
+
}
|
|
146
|
+
|
|
137
147
|
/* @zidan-build:select-paint */
|
|
138
148
|
/* ==================================================================
|
|
139
149
|
2. Select paint
|
|
@@ -281,6 +291,19 @@
|
|
|
281
291
|
border-top-color: var(--zs-primary);
|
|
282
292
|
}
|
|
283
293
|
|
|
294
|
+
.zs-root .zs-more {
|
|
295
|
+
border-top-color: var(--zs-border-color);
|
|
296
|
+
color: var(--zs-primary);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.zs-root .zs-more:hover:not([disabled]) {
|
|
300
|
+
background: var(--zs-primary-soft);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.zs-root .zs-more--error {
|
|
304
|
+
color: var(--zs-border-color-invalid);
|
|
305
|
+
}
|
|
306
|
+
|
|
284
307
|
/* floating label mask */
|
|
285
308
|
.zs-root[data-zs-layout="floating-label"] .zs-label {
|
|
286
309
|
color: var(--zs-text-muted);
|
|
@@ -883,6 +906,12 @@
|
|
|
883
906
|
color: var(--zs-border-color-invalid);
|
|
884
907
|
}
|
|
885
908
|
|
|
909
|
+
/* async validation spinner */
|
|
910
|
+
.zs-field--pending::after {
|
|
911
|
+
border-color: var(--zs-border-color);
|
|
912
|
+
border-inline-end-color: var(--zs-primary);
|
|
913
|
+
}
|
|
914
|
+
|
|
886
915
|
.zs-check-desc,
|
|
887
916
|
.zs-radio-desc {
|
|
888
917
|
color: var(--zs-text-muted);
|
|
@@ -912,7 +941,7 @@
|
|
|
912
941
|
|
|
913
942
|
/* phone */
|
|
914
943
|
.zs-phone-country {
|
|
915
|
-
border-
|
|
944
|
+
border-inline-end-color: var(--zs-phone-border);
|
|
916
945
|
}
|
|
917
946
|
|
|
918
947
|
.zs-phone-country:focus-visible {
|
|
@@ -951,7 +980,7 @@
|
|
|
951
980
|
height: 6px;
|
|
952
981
|
border-radius: 999px;
|
|
953
982
|
background:
|
|
954
|
-
linear-gradient(
|
|
983
|
+
linear-gradient(var(--zs-range-angle, 90deg),
|
|
955
984
|
var(--zs-range-fill) 0 var(--zs-range-fill),
|
|
956
985
|
var(--zs-range-track) var(--zs-range-fill) 100%);
|
|
957
986
|
}
|
|
@@ -1506,13 +1535,14 @@
|
|
|
1506
1535
|
background-image: none;
|
|
1507
1536
|
appearance: none;
|
|
1508
1537
|
-webkit-appearance: none;
|
|
1509
|
-
padding-
|
|
1538
|
+
padding-inline-end: var(--zs-padding-x);
|
|
1510
1539
|
}
|
|
1511
1540
|
|
|
1512
1541
|
.zs-root[data-zs-framework="bootstrap"] .zs-chip {
|
|
1513
1542
|
font-size: 0.8125rem;
|
|
1514
1543
|
font-weight: 500;
|
|
1515
|
-
padding: 0.2rem
|
|
1544
|
+
padding-block: 0.2rem;
|
|
1545
|
+
padding-inline: 0.55rem 0.4rem;
|
|
1516
1546
|
}
|
|
1517
1547
|
|
|
1518
1548
|
.zs-root[data-zs-framework="bootstrap"] .zs-chip.badge {
|