zidan-select 2.3.0 → 2.3.1
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 +75 -40
- package/dist/file/plugin-file-core.css +8 -1
- package/dist/file/plugin-file-core.min.css +2 -2
- package/dist/file/plugin-file-theme.css +1 -1
- package/dist/file/plugin-file-theme.min.css +1 -1
- package/dist/file/zidan-file.d.ts +1 -1
- package/dist/file/zidan-file.js +94 -25
- package/dist/file/zidan-file.min.js +2 -2
- package/dist/plugin-core.css +109 -1
- package/dist/plugin-core.min.css +2 -2
- package/dist/plugin-theme.css +1 -1
- package/dist/plugin-theme.min.css +1 -1
- package/dist/select/plugin-select-core.css +1 -1
- package/dist/select/plugin-select-core.min.css +1 -1
- package/dist/select/plugin-select-theme.css +1 -1
- package/dist/select/plugin-select-theme.min.css +1 -1
- package/dist/select/zidan-select.d.ts +1 -1
- package/dist/select/zidan-select.js +102 -8
- package/dist/select/zidan-select.min.js +2 -2
- package/dist/zidan-form.js +252 -55
- package/dist/zidan-form.min.js +2 -2
- package/docs/build.md +11 -5
- package/docs/html-and-wordpress.md +20 -20
- package/docs/index.html +8 -0
- package/docs/options.md +44 -11
- package/docs/validation.md +8 -0
- package/package.json +5 -2
- package/plugin-core.css +109 -1
- package/plugin-theme.css +1 -1
- package/zidan-form.d.ts +10 -1
- package/zidan-form.js +252 -55
package/docs/build.md
CHANGED
|
@@ -13,8 +13,11 @@ zidan-select/
|
|
|
13
13
|
├─ plugin-core.css # structure only
|
|
14
14
|
├─ plugin-theme.css # tokens, presets, layouts, framework adapters
|
|
15
15
|
├─ index.html # tabbed demo + theme showcase
|
|
16
|
+
├─ advanced.html # advanced options + HTML/JS reference
|
|
17
|
+
├─ advanced.css/js # advanced-page-only assets
|
|
16
18
|
├─ playground.html # per-field option builder
|
|
17
19
|
├─ playground.css/js # playground-only assets
|
|
20
|
+
├─ nav.css / nav.js # shared demo header and mobile menu
|
|
18
21
|
├─ robots.txt # Pages crawler directives + sitemap pointer
|
|
19
22
|
├─ sitemap.xml # public Pages URLs
|
|
20
23
|
├─ demo.css / demo.js # demo-only assets
|
|
@@ -96,7 +99,7 @@ Without esbuild the build still succeeds and prints that minification was skippe
|
|
|
96
99
|
| Select-only | `/dist/select/zidan-select.min.js` | `/dist/select/plugin-select-core.min.css` | `/dist/select/plugin-select-theme.min.css` |
|
|
97
100
|
| File-only | `/dist/file/zidan-file.min.js` | `/dist/file/plugin-file-core.min.css` | `/dist/file/plugin-file-theme.min.css` |
|
|
98
101
|
|
|
99
|
-
Prepend `https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
102
|
+
Prepend `https://cdn.jsdelivr.net/npm/zidan-select@2.3.1` to each path (or your own origin).
|
|
100
103
|
These are real files in the npm tarball, so unpkg and self-hosted CDNs serve the same bytes;
|
|
101
104
|
jsDelivr additionally auto-minifies the readable root files, but do not rely on that trick.
|
|
102
105
|
Check the three you use with `curl -I` before changing a version, then update the URLs in the
|
|
@@ -119,7 +122,7 @@ Both theme stylesheets keep the token set, the five preset themes (`default`, `m
|
|
|
119
122
|
adapters, so `data-zidan-theme`, `data-zidan-layout` and `data-zidan-framework` behave the same
|
|
120
123
|
as in the full build.
|
|
121
124
|
|
|
122
|
-
Approximate v2.3.
|
|
125
|
+
Approximate v2.3.1 sizes (readable → minified): select ≈104 → 62 kB JS, 12 → 9 kB core CSS,
|
|
123
126
|
32 → 27 kB theme; file ≈82 → 49 kB JS, 9 → 7 kB core, 34 → 29 kB theme; full ≈208 → 123 kB
|
|
124
127
|
JS, 38 → 29 kB core, 47 → 39 kB theme.
|
|
125
128
|
|
|
@@ -201,8 +204,9 @@ import 'zidan-select/file/css/theme';
|
|
|
201
204
|
## GitHub Pages
|
|
202
205
|
|
|
203
206
|
The demo is static and needs no build. `.github/workflows/pages.yml` assembles `_site/` on every
|
|
204
|
-
push to `main` — `index.html`, `
|
|
205
|
-
`
|
|
207
|
+
push to `main` — `index.html`, `advanced.html`, `playground.html`, `shopify.html`, `advanced.css`,
|
|
208
|
+
`advanced.js`, `playground.css`, `playground.js`, `demo.css`, `demo.js`, `nav.css`, `nav.js`, `robots.txt`,
|
|
209
|
+
`sitemap.xml`, the four library files and `docs/` — then uploads it with
|
|
206
210
|
`actions/upload-pages-artifact` and publishes it with `actions/deploy-pages`.
|
|
207
211
|
|
|
208
212
|
One-time setup: **Settings → Pages → Build and deployment → Source: GitHub Actions**.
|
|
@@ -210,11 +214,13 @@ One-time setup: **Settings → Pages → Build and deployment → Source: GitHub
|
|
|
210
214
|
| URL | Serves |
|
|
211
215
|
| --- | --- |
|
|
212
216
|
| `https://akhtar1985.github.io/zidan-select/` | The tabbed demo |
|
|
217
|
+
| `https://akhtar1985.github.io/zidan-select/advanced.html` | Advanced options and API reference |
|
|
213
218
|
| `https://akhtar1985.github.io/zidan-select/playground.html` | Per-field option playground |
|
|
219
|
+
| `https://akhtar1985.github.io/zidan-select/shopify.html` | Shopify product-page demo |
|
|
214
220
|
| `https://akhtar1985.github.io/zidan-select/docs/` | Documentation index |
|
|
215
221
|
| `/#select`, `/#check`, `/#file`, `/#inputs`, `/#themes` | Deep links to a demo tab |
|
|
216
222
|
| `/playground.html#select`, `#file`, `#checkbox`, `#radio`, `#text` | Deep links to a playground control |
|
|
217
|
-
| `/robots.txt`, `/sitemap.xml` | Crawler directives and the
|
|
223
|
+
| `/robots.txt`, `/sitemap.xml` | Crawler directives and the public page URLs |
|
|
218
224
|
|
|
219
225
|
The workflow only copies demo assets, so `scripts/`, `dist/`, `package.json` and local scratch
|
|
220
226
|
files are never published.
|
|
@@ -33,15 +33,15 @@ colours), `plugin-theme.css` carries colours, presets and skins.
|
|
|
33
33
|
| File uploads only | `dist/file/zidan-file.js` + `plugin-file-core.css` + `plugin-file-theme.css` |
|
|
34
34
|
| Several control types together | `zidan-form.js` + `plugin-core.css` + `plugin-theme.css` |
|
|
35
35
|
|
|
36
|
-
Pinned CDN URLs (replace `2.3.
|
|
36
|
+
Pinned CDN URLs (replace `2.3.1` when you upgrade):
|
|
37
37
|
|
|
38
38
|
| Build | JavaScript | CSS |
|
|
39
39
|
| --- | --- | --- |
|
|
40
|
-
| Full | `https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
41
|
-
| Select-only | `https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
42
|
-
| File-only | `https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
40
|
+
| Full | `https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/zidan-form.js` | `…@2.3.1/plugin-core.css` + `…@2.3.1/plugin-theme.css` |
|
|
41
|
+
| Select-only | `https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/select/zidan-select.js` | `…@2.3.1/dist/select/plugin-select-core.css` + `…plugin-select-theme.css` |
|
|
42
|
+
| File-only | `https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/file/zidan-file.js` | `…@2.3.1/dist/file/plugin-file-core.css` + `…plugin-file-theme.css` |
|
|
43
43
|
|
|
44
|
-
Prefer self-hosting? Download the same files (`npm pack zidan-select@2.3.
|
|
44
|
+
Prefer self-hosting? Download the same files (`npm pack zidan-select@2.3.1`, or the raw files
|
|
45
45
|
from GitHub) and keep them next to your page:
|
|
46
46
|
|
|
47
47
|
```
|
|
@@ -174,8 +174,8 @@ see the native `FormData`.
|
|
|
174
174
|
<title>ZidanForm static example</title>
|
|
175
175
|
|
|
176
176
|
<!-- structure first, theme second -->
|
|
177
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
178
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
177
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/plugin-core.css">
|
|
178
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/plugin-theme.css">
|
|
179
179
|
</head>
|
|
180
180
|
<body>
|
|
181
181
|
|
|
@@ -251,7 +251,7 @@ see the native `FormData`.
|
|
|
251
251
|
</form>
|
|
252
252
|
</main>
|
|
253
253
|
|
|
254
|
-
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
254
|
+
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/zidan-form.js"></script>
|
|
255
255
|
<script>
|
|
256
256
|
// Demo only: show the native FormData instead of navigating away.
|
|
257
257
|
document.querySelector('.zidan-form').addEventListener('submit', function (event) {
|
|
@@ -289,9 +289,9 @@ and `ZidanSelect`; `zidanField` does not exist here.
|
|
|
289
289
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
290
290
|
<title>Select-only example</title>
|
|
291
291
|
<link rel="stylesheet"
|
|
292
|
-
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
292
|
+
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/select/plugin-select-core.css">
|
|
293
293
|
<link rel="stylesheet"
|
|
294
|
-
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
294
|
+
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/select/plugin-select-theme.css">
|
|
295
295
|
</head>
|
|
296
296
|
<body style="max-width:520px;margin:40px auto;padding:0 20px">
|
|
297
297
|
|
|
@@ -311,7 +311,7 @@ and `ZidanSelect`; `zidanField` does not exist here.
|
|
|
311
311
|
</select>
|
|
312
312
|
</p>
|
|
313
313
|
|
|
314
|
-
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
314
|
+
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/select/zidan-select.js"></script>
|
|
315
315
|
<script>
|
|
316
316
|
zidanSelect('#country', {
|
|
317
317
|
mode: 'combobox',
|
|
@@ -342,9 +342,9 @@ Only uploads on this page? Load the file-only build. It exposes `zidanField`,
|
|
|
342
342
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
343
343
|
<title>File upload example</title>
|
|
344
344
|
<link rel="stylesheet"
|
|
345
|
-
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
345
|
+
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/file/plugin-file-core.css">
|
|
346
346
|
<link rel="stylesheet"
|
|
347
|
-
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
347
|
+
href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/file/plugin-file-theme.css">
|
|
348
348
|
</head>
|
|
349
349
|
<body style="max-width:520px;margin:40px auto;padding:0 20px">
|
|
350
350
|
|
|
@@ -356,7 +356,7 @@ Only uploads on this page? Load the file-only build. It exposes `zidanField`,
|
|
|
356
356
|
<input id="shots" type="file" name="shots" multiple accept="image/*">
|
|
357
357
|
</form>
|
|
358
358
|
|
|
359
|
-
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
359
|
+
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/dist/file/zidan-file.js"></script>
|
|
360
360
|
<script>
|
|
361
361
|
zidanField('#cv', {
|
|
362
362
|
variant: 'dropzone',
|
|
@@ -475,9 +475,9 @@ add_action('wp_enqueue_scripts', function () {
|
|
|
475
475
|
|
|
476
476
|
$base = get_stylesheet_directory_uri() . '/assets/zidan';
|
|
477
477
|
|
|
478
|
-
wp_enqueue_style('zidan-core', $base . '/plugin-core.css', array(), '2.3.
|
|
479
|
-
wp_enqueue_style('zidan-theme', $base . '/plugin-theme.css', array('zidan-core'), '2.3.
|
|
480
|
-
wp_enqueue_script('zidan-form', $base . '/zidan-form.js', array(), '2.3.
|
|
478
|
+
wp_enqueue_style('zidan-core', $base . '/plugin-core.css', array(), '2.3.1');
|
|
479
|
+
wp_enqueue_style('zidan-theme', $base . '/plugin-theme.css', array('zidan-core'), '2.3.1');
|
|
480
|
+
wp_enqueue_script('zidan-form', $base . '/zidan-form.js', array(), '2.3.1', true);
|
|
481
481
|
|
|
482
482
|
// Optional: configure fields by ID/class without inline HTML scripts.
|
|
483
483
|
wp_add_inline_script('zidan-form', "window.ZIDAN_FORM_CONFIG = {
|
|
@@ -552,9 +552,9 @@ Shopify has its own section: [9. Shopify](#9-shopify).
|
|
|
552
552
|
```html
|
|
553
553
|
<!-- inside one embed block: markup first, script last -->
|
|
554
554
|
<select class="zidan-select" data-zidan-options='{"mode":"combobox"}'>…</select>
|
|
555
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
556
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
557
|
-
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.
|
|
555
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/plugin-core.css">
|
|
556
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/plugin-theme.css">
|
|
557
|
+
<script src="https://cdn.jsdelivr.net/npm/zidan-select@2.3.1/zidan-form.js"></script>
|
|
558
558
|
```
|
|
559
559
|
|
|
560
560
|
For the single-select case, the select-only build is smaller: swap in the
|
package/docs/index.html
CHANGED
|
@@ -56,10 +56,18 @@
|
|
|
56
56
|
style="display:block;width:100%;max-width:640px;margin:0 0 28px;border-radius:14px;border:1px solid #e4e8f1;box-shadow:0 1px 2px rgba(16,19,36,.05)">
|
|
57
57
|
</a>
|
|
58
58
|
<ul>
|
|
59
|
+
<li>
|
|
60
|
+
<strong><a href="../advanced.html">Advanced options & API reference</a></strong>
|
|
61
|
+
<span>Initialization and option precedence, async select pagination, tags, Promise validation, uploads, events, lifecycle, RTL, TypeScript and copyable HTML/JavaScript examples.</span>
|
|
62
|
+
</li>
|
|
59
63
|
<li>
|
|
60
64
|
<strong><a href="../playground.html">Field playground</a></strong>
|
|
61
65
|
<span>Pick one control, toggle its options, preview it live and copy the matching HTML attributes or vanilla JavaScript call.</span>
|
|
62
66
|
</li>
|
|
67
|
+
<li>
|
|
68
|
+
<strong><a href="../index.html#controls">Controls & options reference</a></strong>
|
|
69
|
+
<span>Every control family in one place: the options you reach for most, the two ways to initialise a field, and live examples — with links into the playground for the remaining options and the advanced reference for callbacks and the API.</span>
|
|
70
|
+
</li>
|
|
63
71
|
<li>
|
|
64
72
|
<strong><a href="https://github.com/akhtar1985/zidan-select/blob/main/docs/html-and-wordpress.md">Static HTML & WordPress cookbook</a></strong>
|
|
65
73
|
<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>
|
package/docs/options.md
CHANGED
|
@@ -135,9 +135,9 @@ Applies to `ZidanCheckbox`, `ZidanRadioGroup`, `ZidanFileUpload`, `ZidanTextFiel
|
|
|
135
135
|
| `layout` | `data-zidan-layout` | string | `stacked` | `stacked`, `inline`, `compact`, `floating`, `outlined`, `card`. |
|
|
136
136
|
| `theme` | `data-zidan-theme`, `data-zs-theme` | string | `default` | `default`, `modern`, `minimal`, `dark`, `glass`. Resolves element → ancestor → `<html>`. |
|
|
137
137
|
| `framework` | `data-zidan-framework`, `data-zs-framework` | string | `none` | `none`, `bootstrap`, `tailwind`, `bulma`, `foundation`, `vanilla`. |
|
|
138
|
-
| `label` | `data-zidan-label` | string | — | Used when the markup has no `<label>`; a generated label is `<label for>`. |
|
|
138
|
+
| `label` | `data-zidan-label` | string | — | Used when the markup has no `<label>`; a generated label is `<label for>`. If the markup already has a `<label>`, the generated one replaces it and the original is hidden until `destroy()`. |
|
|
139
139
|
| `hint` | `data-zidan-hint` | string | — | Rendered under the control and linked via `aria-describedby`. |
|
|
140
|
-
| `validation` | `data-zidan-validation` | `valid` \| `invalid` | — | Initial state; later states come from validity or `setValidation()`. |
|
|
140
|
+
| `validation` | `data-zidan-validation` | `valid` \| `invalid` | — | Initial state; later states come from validity or `setValidation()`. A preset `invalid` is pinned: it survives initialisation and programmatic `update()`/`refresh()`/`setValue()` until the user edits the control or you pass `setValidation(null)`. |
|
|
141
141
|
| `alwaysValidate` | — | boolean | `false` | Mark invalid as soon as native validity fails instead of on blur. |
|
|
142
142
|
| `indeterminate` | `data-zidan-indeterminate` | boolean | `false` | Checkbox starts mixed. |
|
|
143
143
|
| `clearable` | `data-zidan-clear` | boolean | `search` only | Clear button for text inputs and textarea. |
|
|
@@ -145,7 +145,7 @@ Applies to `ZidanCheckbox`, `ZidanRadioGroup`, `ZidanFileUpload`, `ZidanTextFiel
|
|
|
145
145
|
| `prefix` | `data-zidan-prefix` | string | — | Static text before the input. |
|
|
146
146
|
| `suffix` | `data-zidan-suffix` | string | — | Static text after the input. |
|
|
147
147
|
| `counter` | `data-zidan-counter` | number | `maxlength` | Counter maximum; wins over the `maxlength` default. |
|
|
148
|
-
| `output` | `data-zidan-output` | selector | — | Range value is mirrored into this element. |
|
|
148
|
+
| `output` | `data-zidan-output` | selector | — | Range display value (formatted when `rangeFormat` is set) is mirrored into this element. |
|
|
149
149
|
| `title` | `data-zidan-title` | string | `Choose a file` | Dropzone headline. |
|
|
150
150
|
| `dropHint` | `data-zidan-drop-hint` | string | — | Dropzone subtitle. |
|
|
151
151
|
| `accept` | native `accept` | string | — | Validated on top of the native picker filter and shown in the dropzone hint. |
|
|
@@ -291,13 +291,17 @@ national `0` is dropped in international/E.164 output.
|
|
|
291
291
|
| JS option | Data attribute | Type | Default | Notes |
|
|
292
292
|
| --- | --- | --- | --- | --- |
|
|
293
293
|
| `rangeVariant` | `data-zidan-range-variant` | `default` \| `gradient` \| `stepped` \| `minimal` | `default` | Visual skin. |
|
|
294
|
-
| `rangeBubble` | `data-zidan-range-bubble` | boolean | `true` |
|
|
295
|
-
| `
|
|
296
|
-
| `
|
|
297
|
-
| `
|
|
294
|
+
| `rangeBubble` | `data-zidan-range-bubble` | boolean | `true` | Master switch for the floating value bubble. |
|
|
295
|
+
| `rangeBubbleMode` | `data-zidan-range-bubble-mode` | `always` \| `active` \| `never` | `always` | `active` shows the bubble only on hover, focus or drag. |
|
|
296
|
+
| `rangeBubblePosition` | `data-zidan-range-bubble-position` | `top` \| `bottom` | `top` | Bubble above the track or below the ticks/scale. |
|
|
297
|
+
| `rangeFill` | `data-zidan-range-fill` | boolean | `true` | Coloured progress fill; `false` keeps the neutral track (gradient skin keeps its gradient). |
|
|
298
|
+
| `rangeMinMax` | `data-zidan-range-minmax` | boolean | `true` | Min/max scale under the track. Hidden automatically when labeled ticks cover both ends, so 0 and the max print once. |
|
|
299
|
+
| `rangeMinLabel` / `rangeMaxLabel` | `data-zidan-range-min-label` / `-range-max-label` | string | — | Custom text for the scale ends (e.g. `Low` / `High`); `rangeFormat` is used when unset. |
|
|
300
|
+
| `rangeTicks` | `data-zidan-range-ticks` | number \| array \| string | `0` | Count, JS array, JSON array or comma list (`0,250,500`). Values are absolute and out-of-range ones sit at the nearest end. |
|
|
301
|
+
| `rangeTickLabels` | `data-zidan-range-tick-labels` | boolean | `false` | Text labels on ticks. Labels at both ends replace the min/max scale. |
|
|
298
302
|
| `rangeLabels` | — | object | — | Map `{ value: 'Label' }` used with labeled ticks. |
|
|
299
303
|
| `rangeFormat` | `data-zidan-range-format` | string \| function | — | Template with `{value}`, `{min}`, `{max}` (or `%s`), or `function(value, field)` in JS. |
|
|
300
|
-
| `output` | `data-zidan-output` | selector | — | Mirrors the
|
|
304
|
+
| `output` | `data-zidan-output` | selector | — | Mirrors the display value (formatted when `rangeFormat` is set) into a `<output>`/element; `input.value` keeps the raw value. |
|
|
301
305
|
|
|
302
306
|
```html
|
|
303
307
|
<input type="range" min="0" max="1000" step="50" value="400"
|
|
@@ -313,12 +317,36 @@ zidanField('#price', {
|
|
|
313
317
|
rangeLabels: { 0: 'Free', 1000: 'Top' },
|
|
314
318
|
rangeFormat: value => '€' + Number(value).toLocaleString('en-US')
|
|
315
319
|
});
|
|
320
|
+
|
|
321
|
+
zidanField('#delivery', {
|
|
322
|
+
rangeBubbleMode: 'active', // 'always' | 'active' | 'never'
|
|
323
|
+
rangeBubblePosition: 'bottom', // 'top' | 'bottom'
|
|
324
|
+
rangeFill: false, // neutral track, no progress colour
|
|
325
|
+
rangeTicks: '0,10,20,30', // count, array, JSON or comma list
|
|
326
|
+
rangeTickLabels: true,
|
|
327
|
+
rangeMinLabel: 'Low',
|
|
328
|
+
rangeMaxLabel: 'High'
|
|
329
|
+
});
|
|
316
330
|
```
|
|
317
331
|
|
|
318
332
|
The range keeps `input.value` native; only the visual chrome and bubble are added. Instance
|
|
319
333
|
properties `range`, `rangeBubble`, `rangeTicksEl` and `rangeScale` are exposed if you need to
|
|
320
334
|
re-render custom ticks.
|
|
321
335
|
|
|
336
|
+
Labeled ticks and the scale do not stack: when `rangeTickLabels` is on and the tick values
|
|
337
|
+
include both `min` and `max`, the scale row (`.zs-range-scale`) gets `zs-range-scale--hidden`
|
|
338
|
+
and the tick labels are the single endpoint readout. `rangeLabels` entries win over
|
|
339
|
+
`rangeFormat` for that value. Endpoint labels carry `zs-range-tick--start` / `--end` and the
|
|
340
|
+
bubble gets `zs-range-bubble--start` / `--end`, so both stay inside the track at 0 and max,
|
|
341
|
+
including in RTL. Without a scale row (`.zs-range--labels-no-scale`) the label height is
|
|
342
|
+
reserved so labels cannot overlap the next element.
|
|
343
|
+
|
|
344
|
+
Bubble behaviour is controlled by `rangeBubbleMode` (`always` / `active` / `never`) and
|
|
345
|
+
`rangeBubblePosition` (`top` / `bottom`), the coloured progress by `rangeFill`, and the scale
|
|
346
|
+
ends by `rangeMinLabel` / `rangeMaxLabel`. `rangeFill: false` keeps the neutral track but not
|
|
347
|
+
the gradient skin, and `rangeFormat` also feeds `aria-valuetext` so assistive tech reads the
|
|
348
|
+
formatted value.
|
|
349
|
+
|
|
322
350
|
## Date & time pickers
|
|
323
351
|
|
|
324
352
|
| JS option | Data attribute | Type | Default | Notes |
|
|
@@ -495,7 +523,7 @@ Callbacks: `onUploadStart`, `onUploadProgress`, `onUploadSuccess` / `onUpload`,
|
|
|
495
523
|
| `options` | — | Array of strings or `{value,label,disabled,group}`. |
|
|
496
524
|
| `suggestions` | — | Tags suggestions. |
|
|
497
525
|
| `value` | — | Initial value(s). |
|
|
498
|
-
| `label` | `data-zidan-label` | Floating label text. |
|
|
526
|
+
| `label` | `data-zidan-label` | Floating label text. An author `<label>` for the same control is hidden while the field is enhanced and restored by `destroy()`. |
|
|
499
527
|
| `placeholder` | `data-zidan-placeholder` | Trigger placeholder. |
|
|
500
528
|
|
|
501
529
|
### Behaviour
|
|
@@ -503,7 +531,7 @@ Callbacks: `onUploadStart`, `onUploadProgress`, `onUploadSuccess` / `onUpload`,
|
|
|
503
531
|
| Option | Data attribute | Default | Description |
|
|
504
532
|
| --- | --- | --- | --- |
|
|
505
533
|
| `multiple` | `data-zidan-multiple` | from `multiple` | Multi-select. |
|
|
506
|
-
| `searchable` | `data-zidan-searchable` | `true` except plain select | Type-to-filter. |
|
|
534
|
+
| `searchable` | `data-zidan-searchable` | `true` except plain select | Type-to-filter. With `searchable: false` in `select` mode the text field is `readOnly`, so typing can never filter or hide the list — open it with a click, `Space`, `Enter` or `↓`. |
|
|
507
535
|
| `clearable` | `data-zidan-clearable` | `false` | Clear button. |
|
|
508
536
|
| `closeOnSelect` | — | single: `true` | Close after choosing. |
|
|
509
537
|
| `maxDropdownHeight` | — | `280` | Listbox max height in px. |
|
|
@@ -573,6 +601,11 @@ The cache size is global: `ZidanSelect.cacheLimit = 50` pages (least-recently-us
|
|
|
573
601
|
| `commitOnTab` / `commitOnBlur` | — | `false` |
|
|
574
602
|
| `valueDelimiter` | — | `,` |
|
|
575
603
|
|
|
604
|
+
With `allowFreeText: false` a tag you type must match an option or a `suggestions` entry by
|
|
605
|
+
value or label (`caseSensitive` respected). Anything else is rejected: no tag is added and the
|
|
606
|
+
control shows `"…" is not in the list.` through the tag error slot. Leave the option at its
|
|
607
|
+
`true` default for free-form tags.
|
|
608
|
+
|
|
576
609
|
### Rendering hooks
|
|
577
610
|
|
|
578
611
|
| Option | Signature |
|
|
@@ -717,7 +750,7 @@ to any field that should span the row) rather than putting it on a single field.
|
|
|
717
750
|
| `getValue()` | Text/textarea value, checked value, radio value or selected files. |
|
|
718
751
|
| `setValue(v)` | Writes to the native control and re-renders. |
|
|
719
752
|
| `update()` / `refresh()` | Re-read native state (checked, disabled, validity, value). |
|
|
720
|
-
| `setValidation('valid'\|'invalid'\|null)` | Mirrors state to classes and `aria-invalid`. |
|
|
753
|
+
| `setValidation('valid'\|'invalid'\|null)` | Mirrors state to classes and `aria-invalid`. A public `'invalid'` call pins the state, so `update()`/`refresh()`/`setValue()` keep it until the user edits the control or you clear it. |
|
|
721
754
|
| `getValidation()` | Current validation state. |
|
|
722
755
|
| `setTheme(name)`, `setFramework(name)`, `setLayout(name)` | Scoped restyling. |
|
|
723
756
|
| `destroy()` | Restores the original DOM and removes every listener. |
|
package/docs/validation.md
CHANGED
|
@@ -29,6 +29,14 @@ It clears the state on `input`/`change` once validity passes, on `form.reset()`,
|
|
|
29
29
|
`setValidation(null)` is called. `data-zidan-validation="invalid"` forces the state without
|
|
30
30
|
native validity.
|
|
31
31
|
|
|
32
|
+
A state set through the public `setValidation('invalid')` (and a preset
|
|
33
|
+
`data-zidan-validation="invalid"`) is **pinned**: re-rendering the field — `update()`,
|
|
34
|
+
`refresh()`, `setValue()`, an option chosen in a select, an async rule that resolves clean —
|
|
35
|
+
will not clear it. That is what makes a server-side error survive until the user actually
|
|
36
|
+
touches the control. The pin is released by the next `input`, `change` or `blur` from the user,
|
|
37
|
+
or by `setValidation(null)` / `setValidation('valid')`. Internal mirrors pass a second argument
|
|
38
|
+
(`setValidation(state, true)`) so they never pin a state themselves.
|
|
39
|
+
|
|
32
40
|
## Built-in rules (written into native validity)
|
|
33
41
|
|
|
34
42
|
These rules call `input.setCustomValidity(message)`, so `form.checkValidity()`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidan-select",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
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",
|
|
@@ -101,7 +101,9 @@
|
|
|
101
101
|
"build": "node scripts/build.mjs",
|
|
102
102
|
"test": "node scripts/test.mjs",
|
|
103
103
|
"types": "tsc -p tsconfig.types.json",
|
|
104
|
-
"
|
|
104
|
+
"prepublishOnly": "npm run types && npm run build && npm test",
|
|
105
|
+
"lint": "node --check zidan-form.js && node --check demo.js && node --check advanced.js && node --check playground.js && node --check nav.js && node --check zidan-form.mjs",
|
|
106
|
+
"search": "node scripts/exa-search.mjs"
|
|
105
107
|
},
|
|
106
108
|
"engines": {
|
|
107
109
|
"node": ">=18"
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
},
|
|
112
114
|
"devDependencies": {
|
|
113
115
|
"esbuild": "^0.21.5",
|
|
116
|
+
"exa-js": "2.29.0",
|
|
114
117
|
"jsdom": "^24.1.3",
|
|
115
118
|
"typescript": "^5.9.3"
|
|
116
119
|
}
|
package/plugin-core.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ZidanForm v2.3.
|
|
2
|
+
* ZidanForm v2.3.1 — 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
|
|
@@ -536,6 +536,13 @@
|
|
|
536
536
|
letter-spacing: 0.01em;
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
/* The plugin renders its own label and hides the author's original one. Author
|
|
540
|
+
rules such as `.field-label { display:block }` would otherwise beat the
|
|
541
|
+
browser's [hidden] default and show both labels at once. */
|
|
542
|
+
[data-zs-hidden-label] {
|
|
543
|
+
display: none !important;
|
|
544
|
+
}
|
|
545
|
+
|
|
539
546
|
.zs-field__hint {
|
|
540
547
|
margin: 0;
|
|
541
548
|
font-size: 0.75rem;
|
|
@@ -1552,6 +1559,26 @@ textarea.zs-input-native {
|
|
|
1552
1559
|
font-variant-numeric: tabular-nums;
|
|
1553
1560
|
}
|
|
1554
1561
|
|
|
1562
|
+
/* labeled endpoint ticks already show min and max: keep the row for layout,
|
|
1563
|
+
hide its text so the endpoints are printed once */
|
|
1564
|
+
.zs-range-scale--hidden {
|
|
1565
|
+
visibility: hidden;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/* labeled ticks without a scale row need the label height reserved */
|
|
1569
|
+
.zs-range--labels-no-scale {
|
|
1570
|
+
padding-bottom: 18px;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
/* keep endpoint tick labels inside the track instead of half outside it */
|
|
1574
|
+
.zs-range-tick--labeled.zs-range-tick--start {
|
|
1575
|
+
transform: translateX(0);
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
.zs-range-tick--labeled.zs-range-tick--end {
|
|
1579
|
+
transform: translateX(-100%);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1555
1582
|
.zs-range-bubble {
|
|
1556
1583
|
position: absolute;
|
|
1557
1584
|
top: 0;
|
|
@@ -1568,6 +1595,46 @@ textarea.zs-input-native {
|
|
|
1568
1595
|
pointer-events: none;
|
|
1569
1596
|
}
|
|
1570
1597
|
|
|
1598
|
+
/* bubble and fill options */
|
|
1599
|
+
.zs-range--no-bubble {
|
|
1600
|
+
padding-top: 4px;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
.zs-range--bubble-active .zs-range-bubble {
|
|
1604
|
+
opacity: 0;
|
|
1605
|
+
visibility: hidden;
|
|
1606
|
+
transition: opacity 140ms ease;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
.zs-range--bubble-active:hover .zs-range-bubble,
|
|
1610
|
+
.zs-range--bubble-active:focus-within .zs-range-bubble,
|
|
1611
|
+
.zs-field--focused .zs-range--bubble-active .zs-range-bubble {
|
|
1612
|
+
opacity: 1;
|
|
1613
|
+
visibility: visible;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
.zs-range--bubble-bottom {
|
|
1617
|
+
padding-bottom: 30px;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/* labels sit above the bubble, so both need room */
|
|
1621
|
+
.zs-range--bubble-bottom.zs-range--labels-no-scale {
|
|
1622
|
+
padding-bottom: 38px;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
.zs-range--bubble-bottom .zs-range-bubble {
|
|
1626
|
+
top: auto;
|
|
1627
|
+
bottom: 0;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
.zs-range--fill-off .zs-input-native::-webkit-slider-runnable-track {
|
|
1631
|
+
background: var(--zs-range-track);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
.zs-range--fill-off .zs-input-native::-moz-range-progress {
|
|
1635
|
+
background: var(--zs-range-track);
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1571
1638
|
[dir="rtl"] .zs-range-tick,
|
|
1572
1639
|
[dir="rtl"] .zs-range-tick--labeled {
|
|
1573
1640
|
transform: translateX(50%);
|
|
@@ -1586,6 +1653,47 @@ textarea.zs-input-native {
|
|
|
1586
1653
|
transform: translateX(50%);
|
|
1587
1654
|
}
|
|
1588
1655
|
|
|
1656
|
+
[dir="rtl"] .zs-range-tick--labeled.zs-range-tick--start {
|
|
1657
|
+
transform: translateX(-100%);
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
[dir="rtl"] .zs-range-tick--labeled.zs-range-tick--end {
|
|
1661
|
+
transform: translateX(0);
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
.zs-field[dir="rtl"] .zs-range-tick--labeled.zs-range-tick--start {
|
|
1665
|
+
transform: translateX(-100%);
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
.zs-field[dir="rtl"] .zs-range-tick--labeled.zs-range-tick--end {
|
|
1669
|
+
transform: translateX(0);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
/* keep the value bubble inside the track at both ends */
|
|
1673
|
+
.zs-range-bubble--start {
|
|
1674
|
+
transform: translateX(0);
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
.zs-range-bubble--end {
|
|
1678
|
+
transform: translateX(-100%);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
[dir="rtl"] .zs-range-bubble--start {
|
|
1682
|
+
transform: translateX(-100%);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
[dir="rtl"] .zs-range-bubble--end {
|
|
1686
|
+
transform: translateX(0);
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
.zs-field[dir="rtl"] .zs-range-bubble--start {
|
|
1690
|
+
transform: translateX(-100%);
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
.zs-field[dir="rtl"] .zs-range-bubble--end {
|
|
1694
|
+
transform: translateX(0);
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1589
1697
|
/* validation state icons */
|
|
1590
1698
|
.zs-input-validation {
|
|
1591
1699
|
display: none;
|
package/plugin-theme.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ZidanForm v2.3.
|
|
2
|
+
* ZidanForm v2.3.1 — 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).
|
package/zidan-form.d.ts
CHANGED
|
@@ -220,8 +220,17 @@ export interface TextFieldOptions extends FieldOptions {
|
|
|
220
220
|
phone?: boolean;
|
|
221
221
|
phoneCountry?: string;
|
|
222
222
|
phoneFormat?: PhoneFormat;
|
|
223
|
+
rangeVariant?: 'default' | 'gradient' | 'stepped' | 'minimal';
|
|
224
|
+
rangeBubble?: boolean;
|
|
225
|
+
rangeBubbleMode?: 'always' | 'active' | 'never';
|
|
226
|
+
rangeBubblePosition?: 'top' | 'bottom';
|
|
227
|
+
rangeFill?: boolean;
|
|
228
|
+
rangeMinMax?: boolean;
|
|
229
|
+
rangeTicks?: number[] | number | string;
|
|
230
|
+
rangeTickLabels?: boolean;
|
|
231
|
+
rangeMinLabel?: string;
|
|
232
|
+
rangeMaxLabel?: string;
|
|
223
233
|
rangeFormat?: string | ((value: number, field: ZidanTextField) => string);
|
|
224
|
-
rangeTicks?: number[];
|
|
225
234
|
rangeLabels?: Record<string, string>;
|
|
226
235
|
disableWeekends?: boolean;
|
|
227
236
|
disabledDates?: string[] | string | ((value: string, date: Date) => boolean);
|