@idds/js 1.0.69 → 1.0.70
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 +125 -0
- package/dist/index.js +124 -0
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -36,6 +36,7 @@ var InaUI = (() => {
|
|
|
36
36
|
initRangeDatepicker: () => initRangeDatepicker,
|
|
37
37
|
initSelectDropdown: () => initSelectDropdown,
|
|
38
38
|
initSingleFileUpload: () => initSingleFileUpload,
|
|
39
|
+
initStepper: () => initStepper,
|
|
39
40
|
initTab: () => initTab,
|
|
40
41
|
initTimepicker: () => initTimepicker,
|
|
41
42
|
initToggle: () => initToggle,
|
|
@@ -1024,6 +1025,129 @@ var InaUI = (() => {
|
|
|
1024
1025
|
});
|
|
1025
1026
|
}
|
|
1026
1027
|
|
|
1028
|
+
// src/js/components/stateful/stepper.js
|
|
1029
|
+
function initStepper() {
|
|
1030
|
+
const steppers = document.querySelectorAll(`.${PREFIX}-stepper`);
|
|
1031
|
+
steppers.forEach((stepper) => {
|
|
1032
|
+
if (stepper.dataset.initialized === "true") return;
|
|
1033
|
+
stepper.dataset.initialized = "true";
|
|
1034
|
+
const stepperId = stepper.id;
|
|
1035
|
+
const items = stepper.querySelectorAll(`.${PREFIX}-stepper__item`);
|
|
1036
|
+
const separators = stepper.querySelectorAll(
|
|
1037
|
+
`.${PREFIX}-stepper__separator`
|
|
1038
|
+
);
|
|
1039
|
+
const totalSteps = items.length;
|
|
1040
|
+
let currentStep = parseInt(stepper.dataset.currentStep || "0", 10);
|
|
1041
|
+
const nextBtns = document.querySelectorAll(
|
|
1042
|
+
`[data-stepper-next="${stepperId}"]`
|
|
1043
|
+
);
|
|
1044
|
+
const prevBtns = document.querySelectorAll(
|
|
1045
|
+
`[data-stepper-prev="${stepperId}"]`
|
|
1046
|
+
);
|
|
1047
|
+
const displayTargetId = stepper.dataset.displayTarget;
|
|
1048
|
+
const displayTarget = displayTargetId ? document.getElementById(displayTargetId) : null;
|
|
1049
|
+
const checkIcon = `
|
|
1050
|
+
<svg
|
|
1051
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1052
|
+
class="${PREFIX}-stepper__check-icon"
|
|
1053
|
+
width="16"
|
|
1054
|
+
height="16"
|
|
1055
|
+
viewBox="0 0 24 24"
|
|
1056
|
+
stroke-width="2.5"
|
|
1057
|
+
stroke="currentColor"
|
|
1058
|
+
fill="none"
|
|
1059
|
+
stroke-linecap="round"
|
|
1060
|
+
stroke-linejoin="round"
|
|
1061
|
+
>
|
|
1062
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
1063
|
+
<path d="M5 12l5 5l10 -10" />
|
|
1064
|
+
</svg>
|
|
1065
|
+
`;
|
|
1066
|
+
const updateUI = () => {
|
|
1067
|
+
stepper.dataset.currentStep = currentStep;
|
|
1068
|
+
items.forEach((item, index) => {
|
|
1069
|
+
const iconWrapper = item.querySelector(
|
|
1070
|
+
`.${PREFIX}-stepper__icon-wrapper`
|
|
1071
|
+
);
|
|
1072
|
+
const itemNumber = index + 1;
|
|
1073
|
+
item.classList.remove(
|
|
1074
|
+
`${PREFIX}-stepper__item--completed`,
|
|
1075
|
+
`${PREFIX}-stepper__item--active`
|
|
1076
|
+
);
|
|
1077
|
+
if (iconWrapper) iconWrapper.innerHTML = "";
|
|
1078
|
+
if (index < currentStep) {
|
|
1079
|
+
item.classList.add(`${PREFIX}-stepper__item--completed`);
|
|
1080
|
+
if (iconWrapper) iconWrapper.innerHTML = checkIcon;
|
|
1081
|
+
} else if (index === currentStep) {
|
|
1082
|
+
item.classList.add(`${PREFIX}-stepper__item--active`);
|
|
1083
|
+
if (iconWrapper)
|
|
1084
|
+
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
1085
|
+
} else {
|
|
1086
|
+
if (iconWrapper)
|
|
1087
|
+
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
separators.forEach((separator, index) => {
|
|
1091
|
+
if (index < currentStep) {
|
|
1092
|
+
separator.classList.add(`${PREFIX}-stepper__separator--completed`);
|
|
1093
|
+
} else {
|
|
1094
|
+
separator.classList.remove(`${PREFIX}-stepper__separator--completed`);
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
prevBtns.forEach((btn) => {
|
|
1098
|
+
if (currentStep === 0) {
|
|
1099
|
+
btn.setAttribute("disabled", "true");
|
|
1100
|
+
} else {
|
|
1101
|
+
btn.removeAttribute("disabled");
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
nextBtns.forEach((btn) => {
|
|
1105
|
+
if (currentStep === totalSteps - 1) {
|
|
1106
|
+
btn.setAttribute("disabled", "true");
|
|
1107
|
+
} else {
|
|
1108
|
+
btn.removeAttribute("disabled");
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
if (displayTarget) {
|
|
1112
|
+
displayTarget.textContent = `Current Step: ${currentStep + 1}`;
|
|
1113
|
+
}
|
|
1114
|
+
stepper.dispatchEvent(
|
|
1115
|
+
new CustomEvent("stepper:change", {
|
|
1116
|
+
bubbles: true,
|
|
1117
|
+
detail: { currentStep, totalSteps }
|
|
1118
|
+
})
|
|
1119
|
+
);
|
|
1120
|
+
};
|
|
1121
|
+
nextBtns.forEach((btn) => {
|
|
1122
|
+
btn.addEventListener("click", () => {
|
|
1123
|
+
if (currentStep < totalSteps - 1) {
|
|
1124
|
+
currentStep++;
|
|
1125
|
+
updateUI();
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
});
|
|
1129
|
+
prevBtns.forEach((btn) => {
|
|
1130
|
+
btn.addEventListener("click", () => {
|
|
1131
|
+
if (currentStep > 0) {
|
|
1132
|
+
currentStep--;
|
|
1133
|
+
updateUI();
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
});
|
|
1137
|
+
items.forEach((item, index) => {
|
|
1138
|
+
if (item.classList.contains(`${PREFIX}-stepper__item--clickable`) || item.hasAttribute("data-clickable")) {
|
|
1139
|
+
item.addEventListener("click", () => {
|
|
1140
|
+
if (!item.classList.contains(`${PREFIX}-stepper__item--disabled`)) {
|
|
1141
|
+
currentStep = index;
|
|
1142
|
+
updateUI();
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
updateUI();
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1027
1151
|
// src/js/components/stateful/file-upload.js
|
|
1028
1152
|
var ICONS = {
|
|
1029
1153
|
upload: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"></path><polyline points="16 6 12 2 8 6"></polyline><line x1="12" y1="2" x2="12" y2="16"></line></svg>`,
|
|
@@ -2690,6 +2814,7 @@ var InaUI = (() => {
|
|
|
2690
2814
|
initModal();
|
|
2691
2815
|
initRangeDatepicker();
|
|
2692
2816
|
initRadioButton();
|
|
2817
|
+
initStepper();
|
|
2693
2818
|
initTab();
|
|
2694
2819
|
initTimepicker();
|
|
2695
2820
|
initToggle();
|
package/dist/index.js
CHANGED
|
@@ -1187,6 +1187,129 @@ function initRadioButton() {
|
|
|
1187
1187
|
});
|
|
1188
1188
|
}
|
|
1189
1189
|
|
|
1190
|
+
// src/js/components/stateful/stepper.js
|
|
1191
|
+
function initStepper() {
|
|
1192
|
+
const steppers = document.querySelectorAll(`.${PREFIX}-stepper`);
|
|
1193
|
+
steppers.forEach((stepper) => {
|
|
1194
|
+
if (stepper.dataset.initialized === "true") return;
|
|
1195
|
+
stepper.dataset.initialized = "true";
|
|
1196
|
+
const stepperId = stepper.id;
|
|
1197
|
+
const items = stepper.querySelectorAll(`.${PREFIX}-stepper__item`);
|
|
1198
|
+
const separators = stepper.querySelectorAll(
|
|
1199
|
+
`.${PREFIX}-stepper__separator`
|
|
1200
|
+
);
|
|
1201
|
+
const totalSteps = items.length;
|
|
1202
|
+
let currentStep = parseInt(stepper.dataset.currentStep || "0", 10);
|
|
1203
|
+
const nextBtns = document.querySelectorAll(
|
|
1204
|
+
`[data-stepper-next="${stepperId}"]`
|
|
1205
|
+
);
|
|
1206
|
+
const prevBtns = document.querySelectorAll(
|
|
1207
|
+
`[data-stepper-prev="${stepperId}"]`
|
|
1208
|
+
);
|
|
1209
|
+
const displayTargetId = stepper.dataset.displayTarget;
|
|
1210
|
+
const displayTarget = displayTargetId ? document.getElementById(displayTargetId) : null;
|
|
1211
|
+
const checkIcon = `
|
|
1212
|
+
<svg
|
|
1213
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1214
|
+
class="${PREFIX}-stepper__check-icon"
|
|
1215
|
+
width="16"
|
|
1216
|
+
height="16"
|
|
1217
|
+
viewBox="0 0 24 24"
|
|
1218
|
+
stroke-width="2.5"
|
|
1219
|
+
stroke="currentColor"
|
|
1220
|
+
fill="none"
|
|
1221
|
+
stroke-linecap="round"
|
|
1222
|
+
stroke-linejoin="round"
|
|
1223
|
+
>
|
|
1224
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
1225
|
+
<path d="M5 12l5 5l10 -10" />
|
|
1226
|
+
</svg>
|
|
1227
|
+
`;
|
|
1228
|
+
const updateUI = () => {
|
|
1229
|
+
stepper.dataset.currentStep = currentStep;
|
|
1230
|
+
items.forEach((item, index) => {
|
|
1231
|
+
const iconWrapper = item.querySelector(
|
|
1232
|
+
`.${PREFIX}-stepper__icon-wrapper`
|
|
1233
|
+
);
|
|
1234
|
+
const itemNumber = index + 1;
|
|
1235
|
+
item.classList.remove(
|
|
1236
|
+
`${PREFIX}-stepper__item--completed`,
|
|
1237
|
+
`${PREFIX}-stepper__item--active`
|
|
1238
|
+
);
|
|
1239
|
+
if (iconWrapper) iconWrapper.innerHTML = "";
|
|
1240
|
+
if (index < currentStep) {
|
|
1241
|
+
item.classList.add(`${PREFIX}-stepper__item--completed`);
|
|
1242
|
+
if (iconWrapper) iconWrapper.innerHTML = checkIcon;
|
|
1243
|
+
} else if (index === currentStep) {
|
|
1244
|
+
item.classList.add(`${PREFIX}-stepper__item--active`);
|
|
1245
|
+
if (iconWrapper)
|
|
1246
|
+
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
1247
|
+
} else {
|
|
1248
|
+
if (iconWrapper)
|
|
1249
|
+
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
separators.forEach((separator, index) => {
|
|
1253
|
+
if (index < currentStep) {
|
|
1254
|
+
separator.classList.add(`${PREFIX}-stepper__separator--completed`);
|
|
1255
|
+
} else {
|
|
1256
|
+
separator.classList.remove(`${PREFIX}-stepper__separator--completed`);
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
prevBtns.forEach((btn) => {
|
|
1260
|
+
if (currentStep === 0) {
|
|
1261
|
+
btn.setAttribute("disabled", "true");
|
|
1262
|
+
} else {
|
|
1263
|
+
btn.removeAttribute("disabled");
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
nextBtns.forEach((btn) => {
|
|
1267
|
+
if (currentStep === totalSteps - 1) {
|
|
1268
|
+
btn.setAttribute("disabled", "true");
|
|
1269
|
+
} else {
|
|
1270
|
+
btn.removeAttribute("disabled");
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
if (displayTarget) {
|
|
1274
|
+
displayTarget.textContent = `Current Step: ${currentStep + 1}`;
|
|
1275
|
+
}
|
|
1276
|
+
stepper.dispatchEvent(
|
|
1277
|
+
new CustomEvent("stepper:change", {
|
|
1278
|
+
bubbles: true,
|
|
1279
|
+
detail: { currentStep, totalSteps }
|
|
1280
|
+
})
|
|
1281
|
+
);
|
|
1282
|
+
};
|
|
1283
|
+
nextBtns.forEach((btn) => {
|
|
1284
|
+
btn.addEventListener("click", () => {
|
|
1285
|
+
if (currentStep < totalSteps - 1) {
|
|
1286
|
+
currentStep++;
|
|
1287
|
+
updateUI();
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
});
|
|
1291
|
+
prevBtns.forEach((btn) => {
|
|
1292
|
+
btn.addEventListener("click", () => {
|
|
1293
|
+
if (currentStep > 0) {
|
|
1294
|
+
currentStep--;
|
|
1295
|
+
updateUI();
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
});
|
|
1299
|
+
items.forEach((item, index) => {
|
|
1300
|
+
if (item.classList.contains(`${PREFIX}-stepper__item--clickable`) || item.hasAttribute("data-clickable")) {
|
|
1301
|
+
item.addEventListener("click", () => {
|
|
1302
|
+
if (!item.classList.contains(`${PREFIX}-stepper__item--disabled`)) {
|
|
1303
|
+
currentStep = index;
|
|
1304
|
+
updateUI();
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
updateUI();
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1190
1313
|
// src/js/components/stateful/file-upload.js
|
|
1191
1314
|
var ICONS = {
|
|
1192
1315
|
upload: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"></path><polyline points="16 6 12 2 8 6"></polyline><line x1="12" y1="2" x2="12" y2="16"></line></svg>`,
|
|
@@ -2660,6 +2783,7 @@ function initAll() {
|
|
|
2660
2783
|
initActionDropdown();
|
|
2661
2784
|
initSelectDropdown();
|
|
2662
2785
|
initRadioButton();
|
|
2786
|
+
initStepper();
|
|
2663
2787
|
initFileUpload();
|
|
2664
2788
|
initSingleFileUpload();
|
|
2665
2789
|
initFileUploadBase();
|