bard-tag_field 0.4.0 → 0.4.2
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/input-tag.js +37 -20
- data/bard-tag/bun.lockb +0 -0
- data/bard-tag/package.json +4 -4
- data/lib/bard/tag_field/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a90b26ef508ec001cae14170b6ce96c543d6610c984622a1a2f3d9722c3e713
|
|
4
|
+
data.tar.gz: 5bafffc31b38325321042c768d96cb9d4b7f829a8d05f803d9f6bb96d38c85e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca88e6931e551b19f280e6ecec610251c44b7778ebc88b93693ce3b9a3f05df800d9743b5bf58bf9d97f45bb542be0fae5e8a64ad6d04a5dbd813dac455eeb79
|
|
7
|
+
data.tar.gz: 61013f52ca3daadefc24a4d1a7f3346d392a31ebefd2c144ddd2490975d4a51a6d27d840fb818bdbdf463256661f1dd655915e7e6f2c237c5b4f99f16ad7e402
|
|
@@ -1015,7 +1015,7 @@ class TagOption extends HTMLElement {
|
|
|
1015
1015
|
display: inline-flex;
|
|
1016
1016
|
align-items: center;
|
|
1017
1017
|
float: none;
|
|
1018
|
-
font-size:
|
|
1018
|
+
font-size: 14px;
|
|
1019
1019
|
line-height: 1;
|
|
1020
1020
|
min-height: 32px;
|
|
1021
1021
|
color: #fff;
|
|
@@ -1028,7 +1028,7 @@ class TagOption extends HTMLElement {
|
|
|
1028
1028
|
z-index: 1;
|
|
1029
1029
|
border: none;
|
|
1030
1030
|
background: none;
|
|
1031
|
-
font-size:
|
|
1031
|
+
font-size: 20px;
|
|
1032
1032
|
display: inline-block;
|
|
1033
1033
|
color: rgba(255, 255, 255, 0.6);
|
|
1034
1034
|
right: 10px;
|
|
@@ -1120,8 +1120,17 @@ class InputTag extends HTMLElement {
|
|
|
1120
1120
|
|
|
1121
1121
|
processTagOptions() {
|
|
1122
1122
|
if(!this._taggle || !this._taggle.tag) return
|
|
1123
|
-
|
|
1124
|
-
|
|
1123
|
+
let tagOptions = Array.from(this.children).filter(e => e.tagName === 'TAG-OPTION');
|
|
1124
|
+
let values = tagOptions.map(e => e.value).filter(value => value !== null && value !== undefined);
|
|
1125
|
+
|
|
1126
|
+
// Enforce maxTags constraint for single mode
|
|
1127
|
+
if (!this.multiple && values.length > 1) {
|
|
1128
|
+
// Remove excess tag-options from DOM (keep only the first one)
|
|
1129
|
+
tagOptions.slice(1).forEach(el => el.remove());
|
|
1130
|
+
tagOptions = tagOptions.slice(0, 1);
|
|
1131
|
+
values = values.slice(0, 1);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1125
1134
|
this._taggle.tag.elements = tagOptions;
|
|
1126
1135
|
this._taggle.tag.values = values;
|
|
1127
1136
|
this._inputPosition = this._taggle.tag.values.length;
|
|
@@ -1136,6 +1145,9 @@ class InputTag extends HTMLElement {
|
|
|
1136
1145
|
|
|
1137
1146
|
// Update internal value to match
|
|
1138
1147
|
this.updateValue();
|
|
1148
|
+
|
|
1149
|
+
// Ensure input visibility is updated when tags change via DOM
|
|
1150
|
+
this.updateInputVisibility();
|
|
1139
1151
|
}
|
|
1140
1152
|
|
|
1141
1153
|
get form() {
|
|
@@ -1146,9 +1158,13 @@ class InputTag extends HTMLElement {
|
|
|
1146
1158
|
return this.getAttribute("name");
|
|
1147
1159
|
}
|
|
1148
1160
|
|
|
1161
|
+
get multiple() {
|
|
1162
|
+
return this.hasAttribute('multiple');
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1149
1165
|
get value() {
|
|
1150
1166
|
const internalValue = this._internals.value;
|
|
1151
|
-
if (this.
|
|
1167
|
+
if (this.multiple) {
|
|
1152
1168
|
return internalValue; // Return array for multiple mode
|
|
1153
1169
|
} else {
|
|
1154
1170
|
return internalValue.length > 0 ? internalValue[0] : ''; // Return string for single mode
|
|
@@ -1173,7 +1189,7 @@ class InputTag extends HTMLElement {
|
|
|
1173
1189
|
values.forEach(value => formData.append(this.name, value));
|
|
1174
1190
|
// For single mode, append empty string when no values (like standard HTML inputs)
|
|
1175
1191
|
// For multiple mode, leave empty (like standard HTML multiple selects)
|
|
1176
|
-
if (values.length === 0 && !this.
|
|
1192
|
+
if (values.length === 0 && !this.multiple) {
|
|
1177
1193
|
formData.append(this.name, "");
|
|
1178
1194
|
}
|
|
1179
1195
|
this._internals.setFormValue(formData);
|
|
@@ -1281,14 +1297,14 @@ class InputTag extends HTMLElement {
|
|
|
1281
1297
|
}
|
|
1282
1298
|
input {
|
|
1283
1299
|
display: block;
|
|
1284
|
-
height:
|
|
1300
|
+
height: 38px;
|
|
1285
1301
|
float: none;
|
|
1286
1302
|
margin: 0;
|
|
1287
1303
|
padding-left: 10px !important;
|
|
1288
1304
|
padding-right: 30px !important;
|
|
1289
1305
|
width: auto !important;
|
|
1290
1306
|
min-width: 70px;
|
|
1291
|
-
font-size:
|
|
1307
|
+
font-size: 14px;
|
|
1292
1308
|
width: 100%;
|
|
1293
1309
|
line-height: 2;
|
|
1294
1310
|
padding: 0 0 0 10px;
|
|
@@ -1301,11 +1317,11 @@ class InputTag extends HTMLElement {
|
|
|
1301
1317
|
color: #333;
|
|
1302
1318
|
}
|
|
1303
1319
|
button {
|
|
1304
|
-
width:
|
|
1320
|
+
width: 38px;
|
|
1305
1321
|
text-align: center;
|
|
1306
|
-
line-height:
|
|
1322
|
+
line-height: 36px;
|
|
1307
1323
|
border: 1px solid #e0e0e0;
|
|
1308
|
-
font-size:
|
|
1324
|
+
font-size: 20px;
|
|
1309
1325
|
color: #666;
|
|
1310
1326
|
position: absolute !important;
|
|
1311
1327
|
z-index: 10;
|
|
@@ -1337,7 +1353,7 @@ class InputTag extends HTMLElement {
|
|
|
1337
1353
|
flex-wrap: wrap;
|
|
1338
1354
|
background: #fff;
|
|
1339
1355
|
list-style: none;
|
|
1340
|
-
font-size:
|
|
1356
|
+
font-size: 14px;
|
|
1341
1357
|
min-width: 200px;
|
|
1342
1358
|
}
|
|
1343
1359
|
.ui-menu .ui-menu-item{
|
|
@@ -1379,7 +1395,6 @@ class InputTag extends HTMLElement {
|
|
|
1379
1395
|
this.inputTarget = this.shadowRoot.querySelector("#inputTarget");
|
|
1380
1396
|
|
|
1381
1397
|
this.required = this.hasAttribute("required");
|
|
1382
|
-
this.multiple = this.hasAttribute("multiple");
|
|
1383
1398
|
|
|
1384
1399
|
const maxTags = this.multiple ? undefined : 1;
|
|
1385
1400
|
const placeholder = this.inputTarget.getAttribute("placeholder");
|
|
@@ -1443,6 +1458,12 @@ class InputTag extends HTMLElement {
|
|
|
1443
1458
|
},
|
|
1444
1459
|
render: item => h(`<li class="ui-menu-item" data-value="${item.value}">${item.label}</li>`),
|
|
1445
1460
|
onSelect: item => {
|
|
1461
|
+
// Prevent adding multiple tags in single mode
|
|
1462
|
+
if (!this.multiple && this._taggle.getTagValues().length > 0) {
|
|
1463
|
+
this._taggleInputTarget.value = '';
|
|
1464
|
+
return
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1446
1467
|
// Create a tag-option element with proper value/label separation
|
|
1447
1468
|
const tagOption = document.createElement('tag-option');
|
|
1448
1469
|
tagOption.setAttribute('value', item.value);
|
|
@@ -1580,7 +1601,7 @@ class InputTag extends HTMLElement {
|
|
|
1580
1601
|
values.forEach(value => formData.append(this.name, value));
|
|
1581
1602
|
// For single mode, append empty string when no values (like standard HTML inputs)
|
|
1582
1603
|
// For multiple mode, leave empty (like standard HTML multiple selects)
|
|
1583
|
-
if (values.length === 0 && !this.
|
|
1604
|
+
if (values.length === 0 && !this.multiple) {
|
|
1584
1605
|
formData.append(this.name, "");
|
|
1585
1606
|
}
|
|
1586
1607
|
this._internals.setFormValue(formData);
|
|
@@ -1643,10 +1664,9 @@ class InputTag extends HTMLElement {
|
|
|
1643
1664
|
updateInputVisibility() {
|
|
1644
1665
|
if (!this._taggleInputTarget || !this.buttonTarget) return;
|
|
1645
1666
|
|
|
1646
|
-
const isMultiple = this.hasAttribute('multiple');
|
|
1647
1667
|
const hasTags = this._taggle && this._taggle.getTagValues().length > 0;
|
|
1648
1668
|
|
|
1649
|
-
if (
|
|
1669
|
+
if (this.multiple) {
|
|
1650
1670
|
// Multiple mode: always show input and button
|
|
1651
1671
|
this._taggleInputTarget.style.display = '';
|
|
1652
1672
|
this.buttonTarget.style.display = '';
|
|
@@ -1715,9 +1735,6 @@ class InputTag extends HTMLElement {
|
|
|
1715
1735
|
handleMultipleChange(isMultiple) {
|
|
1716
1736
|
if (!this._taggle) return;
|
|
1717
1737
|
|
|
1718
|
-
// Update the internal multiple state
|
|
1719
|
-
this.multiple = isMultiple;
|
|
1720
|
-
|
|
1721
1738
|
// Get current tags
|
|
1722
1739
|
const currentTags = this._taggle.getTagValues();
|
|
1723
1740
|
|
|
@@ -1816,7 +1833,7 @@ class InputTag extends HTMLElement {
|
|
|
1816
1833
|
values.forEach(value => formData.append(this.name, value));
|
|
1817
1834
|
// For single mode, append empty string when no values (like standard HTML inputs)
|
|
1818
1835
|
// For multiple mode, leave empty (like standard HTML multiple selects)
|
|
1819
|
-
if (values.length === 0 && !this.
|
|
1836
|
+
if (values.length === 0 && !this.multiple) {
|
|
1820
1837
|
formData.append(this.name, "");
|
|
1821
1838
|
}
|
|
1822
1839
|
this._internals.setFormValue(formData);
|
data/bard-tag/bun.lockb
CHANGED
|
Binary file
|
data/bard-tag/package.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"build": "rollup -c"
|
|
6
6
|
},
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@rollup/plugin-commonjs": "^
|
|
9
|
-
"@rollup/plugin-node-resolve": "^
|
|
10
|
-
"rollup": "^4.5
|
|
8
|
+
"@rollup/plugin-commonjs": "^28.0.8",
|
|
9
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
10
|
+
"rollup": "^4.52.5"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@botandrose/input-tag": "0.
|
|
13
|
+
"@botandrose/input-tag": "0.4.2"
|
|
14
14
|
}
|
|
15
15
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bard-tag_field
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Geisel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-10-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|