@idds/js 1.2.0 → 1.2.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/dist/index.iife.js +26 -7
- package/dist/index.js +26 -7
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -2991,12 +2991,19 @@ var InaUI = (() => {
|
|
|
2991
2991
|
const isSelected = normSelected.includes(itemValue) || showCustomization && item.textContent.trim() === customizationLabel && normSelected.some(
|
|
2992
2992
|
(val) => !Array.from(items).filter((i) => i.textContent.trim() !== customizationLabel).map((i) => i.getAttribute("data-value")).includes(val) && val !== ""
|
|
2993
2993
|
);
|
|
2994
|
+
const isDisabled = item.hasAttribute("disabled");
|
|
2994
2995
|
if (isSelected) {
|
|
2995
2996
|
item.classList.add(`${PREFIX4}-chip__item--selected`);
|
|
2996
2997
|
} else {
|
|
2997
2998
|
item.classList.remove(`${PREFIX4}-chip__item--selected`);
|
|
2998
2999
|
}
|
|
2999
|
-
|
|
3000
|
+
if (isDisabled) {
|
|
3001
|
+
item.classList.add(`${PREFIX4}-chip__item--disabled`);
|
|
3002
|
+
}
|
|
3003
|
+
item.setAttribute(
|
|
3004
|
+
"tabindex",
|
|
3005
|
+
index2 === focusedIndex && !isDisabled ? "0" : "-1"
|
|
3006
|
+
);
|
|
3000
3007
|
});
|
|
3001
3008
|
if (showCustomization) {
|
|
3002
3009
|
const standardValues = Array.from(items).filter((item) => item.textContent.trim() !== customizationLabel).map((item) => item.getAttribute("data-value"));
|
|
@@ -3069,7 +3076,13 @@ var InaUI = (() => {
|
|
|
3069
3076
|
finalVal = newSelected;
|
|
3070
3077
|
selectedValue = newSelected.join(",");
|
|
3071
3078
|
} else {
|
|
3072
|
-
|
|
3079
|
+
const normSelected = getNormalizedSelected();
|
|
3080
|
+
if (normSelected.includes(val)) {
|
|
3081
|
+
selectedValue = "";
|
|
3082
|
+
finalVal = "";
|
|
3083
|
+
} else {
|
|
3084
|
+
selectedValue = val;
|
|
3085
|
+
}
|
|
3073
3086
|
}
|
|
3074
3087
|
container.setAttribute("data-selected", selectedValue);
|
|
3075
3088
|
updateUI();
|
|
@@ -3092,6 +3105,8 @@ var InaUI = (() => {
|
|
|
3092
3105
|
};
|
|
3093
3106
|
items.forEach((item, index2) => {
|
|
3094
3107
|
item.addEventListener("click", (e) => {
|
|
3108
|
+
if (item.hasAttribute("disabled")) return;
|
|
3109
|
+
currentFocusedIndex = index2;
|
|
3095
3110
|
const val = item.getAttribute("data-value");
|
|
3096
3111
|
const label = item.textContent.trim();
|
|
3097
3112
|
if (showCustomization && label === customizationLabel) {
|
|
@@ -3100,17 +3115,21 @@ var InaUI = (() => {
|
|
|
3100
3115
|
handleSelect(val);
|
|
3101
3116
|
}
|
|
3102
3117
|
});
|
|
3103
|
-
item.addEventListener("focus", () => {
|
|
3104
|
-
currentFocusedIndex = index2;
|
|
3105
|
-
});
|
|
3106
3118
|
item.addEventListener("keydown", (e) => {
|
|
3119
|
+
if (item.hasAttribute("disabled")) return;
|
|
3107
3120
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") {
|
|
3108
3121
|
e.preventDefault();
|
|
3109
|
-
|
|
3122
|
+
let nextIndex = (index2 + 1) % items.length;
|
|
3123
|
+
while (items[nextIndex].hasAttribute("disabled") && nextIndex !== index2) {
|
|
3124
|
+
nextIndex = (nextIndex + 1) % items.length;
|
|
3125
|
+
}
|
|
3110
3126
|
setItemFocus(nextIndex);
|
|
3111
3127
|
} else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
3112
3128
|
e.preventDefault();
|
|
3113
|
-
|
|
3129
|
+
let prevIndex = (index2 - 1 + items.length) % items.length;
|
|
3130
|
+
while (items[prevIndex].hasAttribute("disabled") && prevIndex !== index2) {
|
|
3131
|
+
prevIndex = (prevIndex - 1 + items.length) % items.length;
|
|
3132
|
+
}
|
|
3114
3133
|
setItemFocus(prevIndex);
|
|
3115
3134
|
}
|
|
3116
3135
|
if (e.key === " " || e.key === "Enter") {
|
package/dist/index.js
CHANGED
|
@@ -3071,12 +3071,19 @@ function initChip(rootSelector = `.${PREFIX5}-chip`) {
|
|
|
3071
3071
|
const isSelected = normSelected.includes(itemValue) || showCustomization && item.textContent.trim() === customizationLabel && normSelected.some(
|
|
3072
3072
|
(val) => !Array.from(items).filter((i) => i.textContent.trim() !== customizationLabel).map((i) => i.getAttribute("data-value")).includes(val) && val !== ""
|
|
3073
3073
|
);
|
|
3074
|
+
const isDisabled = item.hasAttribute("disabled");
|
|
3074
3075
|
if (isSelected) {
|
|
3075
3076
|
item.classList.add(`${PREFIX5}-chip__item--selected`);
|
|
3076
3077
|
} else {
|
|
3077
3078
|
item.classList.remove(`${PREFIX5}-chip__item--selected`);
|
|
3078
3079
|
}
|
|
3079
|
-
|
|
3080
|
+
if (isDisabled) {
|
|
3081
|
+
item.classList.add(`${PREFIX5}-chip__item--disabled`);
|
|
3082
|
+
}
|
|
3083
|
+
item.setAttribute(
|
|
3084
|
+
"tabindex",
|
|
3085
|
+
index2 === focusedIndex && !isDisabled ? "0" : "-1"
|
|
3086
|
+
);
|
|
3080
3087
|
});
|
|
3081
3088
|
if (showCustomization) {
|
|
3082
3089
|
const standardValues = Array.from(items).filter((item) => item.textContent.trim() !== customizationLabel).map((item) => item.getAttribute("data-value"));
|
|
@@ -3149,7 +3156,13 @@ function initChip(rootSelector = `.${PREFIX5}-chip`) {
|
|
|
3149
3156
|
finalVal = newSelected;
|
|
3150
3157
|
selectedValue = newSelected.join(",");
|
|
3151
3158
|
} else {
|
|
3152
|
-
|
|
3159
|
+
const normSelected = getNormalizedSelected();
|
|
3160
|
+
if (normSelected.includes(val)) {
|
|
3161
|
+
selectedValue = "";
|
|
3162
|
+
finalVal = "";
|
|
3163
|
+
} else {
|
|
3164
|
+
selectedValue = val;
|
|
3165
|
+
}
|
|
3153
3166
|
}
|
|
3154
3167
|
container.setAttribute("data-selected", selectedValue);
|
|
3155
3168
|
updateUI();
|
|
@@ -3172,6 +3185,8 @@ function initChip(rootSelector = `.${PREFIX5}-chip`) {
|
|
|
3172
3185
|
};
|
|
3173
3186
|
items.forEach((item, index2) => {
|
|
3174
3187
|
item.addEventListener("click", (e) => {
|
|
3188
|
+
if (item.hasAttribute("disabled")) return;
|
|
3189
|
+
currentFocusedIndex = index2;
|
|
3175
3190
|
const val = item.getAttribute("data-value");
|
|
3176
3191
|
const label = item.textContent.trim();
|
|
3177
3192
|
if (showCustomization && label === customizationLabel) {
|
|
@@ -3180,17 +3195,21 @@ function initChip(rootSelector = `.${PREFIX5}-chip`) {
|
|
|
3180
3195
|
handleSelect(val);
|
|
3181
3196
|
}
|
|
3182
3197
|
});
|
|
3183
|
-
item.addEventListener("focus", () => {
|
|
3184
|
-
currentFocusedIndex = index2;
|
|
3185
|
-
});
|
|
3186
3198
|
item.addEventListener("keydown", (e) => {
|
|
3199
|
+
if (item.hasAttribute("disabled")) return;
|
|
3187
3200
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") {
|
|
3188
3201
|
e.preventDefault();
|
|
3189
|
-
|
|
3202
|
+
let nextIndex = (index2 + 1) % items.length;
|
|
3203
|
+
while (items[nextIndex].hasAttribute("disabled") && nextIndex !== index2) {
|
|
3204
|
+
nextIndex = (nextIndex + 1) % items.length;
|
|
3205
|
+
}
|
|
3190
3206
|
setItemFocus(nextIndex);
|
|
3191
3207
|
} else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
3192
3208
|
e.preventDefault();
|
|
3193
|
-
|
|
3209
|
+
let prevIndex = (index2 - 1 + items.length) % items.length;
|
|
3210
|
+
while (items[prevIndex].hasAttribute("disabled") && prevIndex !== index2) {
|
|
3211
|
+
prevIndex = (prevIndex - 1 + items.length) % items.length;
|
|
3212
|
+
}
|
|
3194
3213
|
setItemFocus(prevIndex);
|
|
3195
3214
|
}
|
|
3196
3215
|
if (e.key === " " || e.key === "Enter") {
|