hx-tomselect 1.0.6 → 1.0.12
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 +5 -0
- package/hx-tomselect.js +3 -2
- package/index.html +20 -8
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Provides a hx-ext="tomselect" htmx extention tag
|
|
4
4
|
|
|
5
|
+
<a href="https://lassebomh.github.io/htmx-playground/?url=https%253A%252F%252Fraw.githubusercontent.com%252FKiwiKid%252Fhx-tomselect%252Fmain%252Fplayground%252Fbasic.json">Playground</a>
|
|
6
|
+
|
|
7
|
+
|
|
5
8
|
<a href="https://kiwikid.github.io/hx-tomselect/">Full Examples List</a>
|
|
6
9
|
|
|
10
|
+
|
|
11
|
+
|
|
7
12
|
### Install
|
|
8
13
|
```html
|
|
9
14
|
<script src="https://cdn.jsdelivr.net/npm/hx-tomselect@latest/hx-tomselect.js"></script>
|
package/hx-tomselect.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function() {
|
|
2
2
|
/** stable build*/
|
|
3
|
-
const version = '
|
|
3
|
+
const version = '11'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} SupportedAttribute
|
|
@@ -252,6 +252,7 @@
|
|
|
252
252
|
|
|
253
253
|
let config = {
|
|
254
254
|
maxItems: 999,
|
|
255
|
+
multiple: true,
|
|
255
256
|
plugins: {}
|
|
256
257
|
};
|
|
257
258
|
|
|
@@ -286,7 +287,7 @@
|
|
|
286
287
|
if (debug) { console.info('hx-tomselect - tom-select-success - config', config) }
|
|
287
288
|
const ts = new TomSelect(s, config);
|
|
288
289
|
s.setAttribute('tom-select-success', `success`);
|
|
289
|
-
s.setAttribute('hx-tom-select-version', `
|
|
290
|
+
s.setAttribute('hx-tom-select-version', `hx_ts-${ts.version}`);
|
|
290
291
|
|
|
291
292
|
} catch (err) {
|
|
292
293
|
s.setAttribute('tom-select-error', JSON.stringify(err));
|
package/index.html
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
gtag('config', 'G-QNEWNK6T05');
|
|
23
23
|
</script>
|
|
24
|
+
<meta name="google-site-verification" content="sxjVvIPkcjCaInV5YUF01yosZnRtagwGreWlnLQ4MlE" />
|
|
24
25
|
|
|
25
26
|
</head>
|
|
26
27
|
|
|
@@ -44,17 +45,22 @@
|
|
|
44
45
|
}
|
|
45
46
|
</style>
|
|
46
47
|
<p class="p-4 text-xl mb-10">
|
|
47
|
-
<a class="underline" href="https://
|
|
48
|
+
<a class="underline" href="https://github.com/KiwiKid/hx-tomselect">hx-tomselect</a> - a <a
|
|
48
49
|
class="underline" href="https://v1.htmx.org/docs/#extensions" target="_">htmx extention</a> for <a
|
|
49
50
|
class="underline" href="https://tom-select.js.org/">tom-select.js</a>
|
|
50
51
|
</p>
|
|
52
|
+
<section class="mb-20">
|
|
53
|
+
<a href="https://lassebomh.github.io/htmx-playground/?url=https%253A%252F%252Fraw.githubusercontent.com%252FKiwiKid%252Fhx-tomselect%252Fmain%252Fplayground%252Fbasic.json" class="underline">playground</a> / <a class="underline" href="https://github.com/KiwiKid/hx-tomselect">github</a>
|
|
54
|
+
|
|
55
|
+
</section>
|
|
56
|
+
|
|
51
57
|
<section class="mb-20">
|
|
52
58
|
<h1 class="text-xl">Install:</h1>
|
|
53
59
|
|
|
54
60
|
<pre
|
|
55
61
|
class="mb-2 code-container"><code class="language-markup wrap"><script src="https://unpkg.com/hx-tomselect/hx-tomselect.js"></script></code></pre>
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
this extention relies on <a class="underline" href="https://v1.htmx.org">htmx</a> and <a class="underline"
|
|
58
64
|
href="https://tom-select.js.org/">tom-select.js</a> being loaded before it is included:
|
|
59
65
|
<pre class="mb-2 code-container"><code class="language-markup"><!DOCTYPE html>
|
|
60
66
|
<html>
|
|
@@ -87,7 +93,7 @@
|
|
|
87
93
|
|
|
88
94
|
<section class="mb-20">
|
|
89
95
|
<h2 class="text-xl font-semibold mb-3">Input</h2>
|
|
90
|
-
<p class="p-4">
|
|
96
|
+
<p class="p-4">allow creating new items and selecting multiple items</p>
|
|
91
97
|
|
|
92
98
|
<select hx-ext="tomselect" ts-create="true" ts-create-on-blur="true" ts-max-items="10" ts-remove-button-title="true" multiple
|
|
93
99
|
class="block w-full mb-2">
|
|
@@ -102,10 +108,16 @@
|
|
|
102
108
|
ts-remove-button-title="true"
|
|
103
109
|
multiple
|
|
104
110
|
>
|
|
105
|
-
<option value="">
|
|
106
|
-
<option value="1">Option 1</option>
|
|
107
|
-
<option value="2">Option 2</option>
|
|
108
|
-
<option value="3">Option 3</option>
|
|
111
|
+
<option value="">N/A</option>
|
|
112
|
+
<option selected value="1">Option 1</option>
|
|
113
|
+
<option selected value="2">Option 2</option>
|
|
114
|
+
<option selected value="3">Option 3</option>
|
|
115
|
+
<option selected value="4">Option 4</option>
|
|
116
|
+
<option selected value="5">Option 5</option>
|
|
117
|
+
<option value="6">Option 6</option>
|
|
118
|
+
<option value="7">Option 7</option>
|
|
119
|
+
<option value="8">Option 8</option>
|
|
120
|
+
<option value="9">Option 9</option>
|
|
109
121
|
</select></code></pre>
|
|
110
122
|
</section>
|
|
111
123
|
|
|
@@ -180,7 +192,7 @@
|
|
|
180
192
|
</section>
|
|
181
193
|
<section class="mb-20">
|
|
182
194
|
<h2 class="text-xl font-semibold mb-3">Create + Regex new item names</h2>
|
|
183
|
-
<p>
|
|
195
|
+
<p>allow creating new items - try typing below - ts-create-filter="true" will prevent commas in the title,
|
|
184
196
|
any other string
|
|
185
197
|
will be used as a regex match</p>
|
|
186
198
|
<select hx-ext="tomselect" ts-create="true" ts-max-items="10" ts-create-filter="^[^,]*$">
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hx-tomselect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Provides a hx-ext=\"tomselect\" htmx extention tag",
|
|
5
5
|
"main": "hx-tomselect.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
8
|
"url": "git+https://github.com/KiwiKid/hx-tomselect.git"
|