@idds/vue 1.4.0 → 1.4.4

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.es.js CHANGED
@@ -702,8 +702,16 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
702
702
  const registerItem = (item) => {
703
703
  const index2 = items.value.size;
704
704
  items.value.set(item.id, index2);
705
- if (!allowMultiple.value && item.defaultOpen && openIndexes.value.length === 0) {
706
- openIndexes.value = [index2];
705
+ if (item.defaultOpen) {
706
+ if (allowMultiple.value) {
707
+ if (!openIndexes.value.includes(index2)) {
708
+ openIndexes.value = [...openIndexes.value, index2];
709
+ }
710
+ } else {
711
+ if (openIndexes.value.length === 0) {
712
+ openIndexes.value = [index2];
713
+ }
714
+ }
707
715
  }
708
716
  return index2;
709
717
  };
@@ -763,7 +771,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
763
771
  };
764
772
  }
765
773
  });
766
- const AccordionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-b60ded7f"]]);
774
+ const AccordionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-a85c5702"]]);
767
775
  const _hoisted_1$G = ["disabled", "aria-expanded"];
768
776
  const _hoisted_2$B = { class: "ina-action-dropdown__trigger-content" };
769
777
  const _hoisted_3$x = { class: "ina-action-dropdown__menu" };
@@ -1103,6 +1111,20 @@ var IconClock = createVueComponent("outline", "clock", "Clock", [["path", { "d":
1103
1111
  * See the LICENSE file in the root directory of this source tree.
1104
1112
  */
1105
1113
  var IconCube3dSphere = createVueComponent("outline", "cube-3d-sphere", "Cube3dSphere", [["path", { "d": "M6 17.6l-2 -1.1v-2.5", "key": "svg-0" }], ["path", { "d": "M4 10v-2.5l2 -1.1", "key": "svg-1" }], ["path", { "d": "M10 4.1l2 -1.1l2 1.1", "key": "svg-2" }], ["path", { "d": "M18 6.4l2 1.1v2.5", "key": "svg-3" }], ["path", { "d": "M20 14v2.5l-2 1.12", "key": "svg-4" }], ["path", { "d": "M14 19.9l-2 1.1l-2 -1.1", "key": "svg-5" }], ["path", { "d": "M12 12l2 -1.1", "key": "svg-6" }], ["path", { "d": "M18 8.6l2 -1.1", "key": "svg-7" }], ["path", { "d": "M12 12l0 2.5", "key": "svg-8" }], ["path", { "d": "M12 18.5l0 2.5", "key": "svg-9" }], ["path", { "d": "M12 12l-2 -1.12", "key": "svg-10" }], ["path", { "d": "M6 8.6l-2 -1.1", "key": "svg-11" }]]);
1114
+ /**
1115
+ * @license @tabler/icons-vue v3.35.0 - MIT
1116
+ *
1117
+ * This source code is licensed under the MIT license.
1118
+ * See the LICENSE file in the root directory of this source tree.
1119
+ */
1120
+ var IconFileTypePdf = createVueComponent("outline", "file-type-pdf", "FileTypePdf", [["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4", "key": "svg-0" }], ["path", { "d": "M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4", "key": "svg-1" }], ["path", { "d": "M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6", "key": "svg-2" }], ["path", { "d": "M17 18h2", "key": "svg-3" }], ["path", { "d": "M20 15h-3v6", "key": "svg-4" }], ["path", { "d": "M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1z", "key": "svg-5" }]]);
1121
+ /**
1122
+ * @license @tabler/icons-vue v3.35.0 - MIT
1123
+ *
1124
+ * This source code is licensed under the MIT license.
1125
+ * See the LICENSE file in the root directory of this source tree.
1126
+ */
1127
+ var IconFile = createVueComponent("outline", "file", "File", [["path", { "d": "M14 3v4a1 1 0 0 0 1 1h4", "key": "svg-0" }], ["path", { "d": "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z", "key": "svg-1" }]]);
1106
1128
  /**
1107
1129
  * @license @tabler/icons-vue v3.35.0 - MIT
1108
1130
  *
@@ -1124,6 +1146,13 @@ var IconLoader2 = createVueComponent("outline", "loader-2", "Loader2", [["path",
1124
1146
  * See the LICENSE file in the root directory of this source tree.
1125
1147
  */
1126
1148
  var IconMoon = createVueComponent("outline", "moon", "Moon", [["path", { "d": "M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z", "key": "svg-0" }]]);
1149
+ /**
1150
+ * @license @tabler/icons-vue v3.35.0 - MIT
1151
+ *
1152
+ * This source code is licensed under the MIT license.
1153
+ * See the LICENSE file in the root directory of this source tree.
1154
+ */
1155
+ var IconPhoto = createVueComponent("outline", "photo", "Photo", [["path", { "d": "M15 8h.01", "key": "svg-0" }], ["path", { "d": "M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z", "key": "svg-1" }], ["path", { "d": "M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5", "key": "svg-2" }], ["path", { "d": "M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3", "key": "svg-3" }]]);
1127
1156
  /**
1128
1157
  * @license @tabler/icons-vue v3.35.0 - MIT
1129
1158
  *
@@ -1716,7 +1745,7 @@ const _hoisted_13$6 = {
1716
1745
  class: "ina-card__media"
1717
1746
  };
1718
1747
  const _hoisted_14$5 = ["src", "alt"];
1719
- const _hoisted_15$4 = {
1748
+ const _hoisted_15$3 = {
1720
1749
  key: 4,
1721
1750
  class: "ina-card__media"
1722
1751
  };
@@ -1888,7 +1917,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1888
1917
  }, null, 8, _hoisted_14$5)) : createCommentVNode("", true)
1889
1918
  ])
1890
1919
  ])) : createCommentVNode("", true),
1891
- __props.variant === "horizontal" && computedMediaPosition.value === "right" ? (openBlock(), createElementBlock("div", _hoisted_15$4, [
1920
+ __props.variant === "horizontal" && computedMediaPosition.value === "right" ? (openBlock(), createElementBlock("div", _hoisted_15$3, [
1892
1921
  renderSlot(_ctx.$slots, "media", {}, () => [
1893
1922
  __props.mediaSrc ? (openBlock(), createElementBlock("img", {
1894
1923
  key: 0,
@@ -3368,7 +3397,7 @@ const _hoisted_14$4 = {
3368
3397
  key: 3,
3369
3398
  class: "ina-file-upload__file-icon-wrapper ina-file-upload__file-icon-wrapper--success"
3370
3399
  };
3371
- const _hoisted_15$3 = { class: "ina-file-upload__file-info" };
3400
+ const _hoisted_15$2 = { class: "ina-file-upload__file-info" };
3372
3401
  const _hoisted_16$2 = { class: "ina-file-upload__file-name" };
3373
3402
  const _hoisted_17$2 = { class: "ina-file-upload__file-size" };
3374
3403
  const _hoisted_18$2 = {
@@ -3648,27 +3677,27 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
3648
3677
  createElementVNode("div", _hoisted_10$8, [
3649
3678
  uploadedFile.status === "uploading" ? (openBlock(), createElementBlock("div", _hoisted_11$8, [
3650
3679
  createVNode(unref(IconLoader2), {
3651
- size: 16,
3680
+ size: 20,
3652
3681
  class: "ina-file-upload__file-icon--spinning"
3653
3682
  })
3654
3683
  ])) : uploadedFile.status === "success" ? (openBlock(), createElementBlock("div", _hoisted_12$7, [
3655
3684
  createVNode(unref(IconCircleCheck), {
3656
- size: 16,
3685
+ size: 20,
3657
3686
  stroke: "2"
3658
3687
  })
3659
3688
  ])) : uploadedFile.status === "error" ? (openBlock(), createElementBlock("div", _hoisted_13$5, [
3660
3689
  createVNode(unref(IconCircleX), {
3661
- size: 16,
3690
+ size: 20,
3662
3691
  stroke: "2"
3663
3692
  })
3664
3693
  ])) : uploadedFile.status === "idle" ? (openBlock(), createElementBlock("div", _hoisted_14$4, [
3665
3694
  createVNode(unref(IconCircleCheck), {
3666
- size: 16,
3695
+ size: 20,
3667
3696
  stroke: "2"
3668
3697
  })
3669
3698
  ])) : createCommentVNode("", true)
3670
3699
  ]),
3671
- createElementVNode("div", _hoisted_15$3, [
3700
+ createElementVNode("div", _hoisted_15$2, [
3672
3701
  createElementVNode("div", _hoisted_16$2, toDisplayString(unref(sanitizeFileName)(uploadedFile.file.name)), 1),
3673
3702
  createElementVNode("div", _hoisted_17$2, toDisplayString(unref(formatFileSize)(uploadedFile.file.size)), 1),
3674
3703
  uploadedFile.error ? (openBlock(), createElementBlock("div", _hoisted_18$2, toDisplayString(uploadedFile.error), 1)) : createCommentVNode("", true)
@@ -3681,7 +3710,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
3681
3710
  class: "ina-file-upload__file-retry",
3682
3711
  onClick: ($event) => updateFileStatus(getOriginalIndex(uploadedFile), "idle")
3683
3712
  }, [
3684
- createVNode(unref(IconRotateClockwise), { size: 16 })
3713
+ createVNode(unref(IconRotateClockwise), { size: 20 })
3685
3714
  ], 8, _hoisted_20$2),
3686
3715
  createElementVNode("button", {
3687
3716
  title: "Hapus file",
@@ -3689,7 +3718,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
3689
3718
  class: "ina-file-upload__file-remove",
3690
3719
  onClick: ($event) => removeFile(getOriginalIndex(uploadedFile))
3691
3720
  }, [
3692
- createVNode(unref(IconTrash), { size: 16 })
3721
+ createVNode(unref(IconTrash), { size: 20 })
3693
3722
  ], 8, _hoisted_21$2)
3694
3723
  ], 64)) : uploadedFile.status === "uploading" ? (openBlock(), createElementBlock("button", {
3695
3724
  key: 1,
@@ -3698,7 +3727,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
3698
3727
  class: "ina-file-upload__file-remove",
3699
3728
  onClick: ($event) => removeFile(getOriginalIndex(uploadedFile))
3700
3729
  }, [
3701
- createVNode(unref(IconX), { size: 16 })
3730
+ createVNode(unref(IconX), { size: 20 })
3702
3731
  ], 8, _hoisted_22$1)) : uploadedFile.status === "success" ? (openBlock(), createElementBlock("button", {
3703
3732
  key: 2,
3704
3733
  title: "Hapus file",
@@ -3706,7 +3735,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
3706
3735
  class: "ina-file-upload__file-remove",
3707
3736
  onClick: ($event) => removeFile(getOriginalIndex(uploadedFile))
3708
3737
  }, [
3709
- createVNode(unref(IconTrash), { size: 16 })
3738
+ createVNode(unref(IconTrash), { size: 20 })
3710
3739
  ], 8, _hoisted_23$1)) : uploadedFile.status === "idle" ? (openBlock(), createElementBlock("button", {
3711
3740
  key: 3,
3712
3741
  title: "Hapus file",
@@ -3714,7 +3743,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
3714
3743
  class: "ina-file-upload__file-remove",
3715
3744
  onClick: ($event) => removeFile(getOriginalIndex(uploadedFile))
3716
3745
  }, [
3717
- createVNode(unref(IconTrash), { size: 16 })
3746
+ createVNode(unref(IconTrash), { size: 20 })
3718
3747
  ], 8, _hoisted_24$1)) : createCommentVNode("", true)
3719
3748
  ])
3720
3749
  ], 2);
@@ -5962,7 +5991,7 @@ const _hoisted_11$4 = { class: "ina-date-picker__day-number" };
5962
5991
  const _hoisted_12$3 = { class: "ina-date-picker__calendar-container" };
5963
5992
  const _hoisted_13$3 = { class: "ina-date-picker__calendar-header" };
5964
5993
  const _hoisted_14$2 = { class: "ina-date-picker__header-controls" };
5965
- const _hoisted_15$2 = { class: "ina-date-picker__dropdown-container" };
5994
+ const _hoisted_15$1 = { class: "ina-date-picker__dropdown-container" };
5966
5995
  const _hoisted_16$1 = { class: "ina-date-picker__dropdown-container" };
5967
5996
  const _hoisted_17$1 = { class: "ina-date-picker__calendar-grid" };
5968
5997
  const _hoisted_18$1 = ["disabled", "onClick"];
@@ -6880,7 +6909,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6880
6909
  })
6881
6910
  ]),
6882
6911
  createElementVNode("div", _hoisted_14$2, [
6883
- createElementVNode("div", _hoisted_15$2, [
6912
+ createElementVNode("div", _hoisted_15$1, [
6884
6913
  createVNode(MonthPicker, {
6885
6914
  "model-value": currentMonth.value,
6886
6915
  disabled: __props.disabled,
@@ -7040,7 +7069,7 @@ const _hoisted_11$3 = { class: "ina-select-dropdown__preview-item-text" };
7040
7069
  const _hoisted_12$2 = ["aria-label"];
7041
7070
  const _hoisted_13$2 = ["disabled", "onClick"];
7042
7071
  const _hoisted_14$1 = { class: "ina-select-dropdown__option-content" };
7043
- const _hoisted_15$1 = { class: "ina-select-dropdown__option-label" };
7072
+ const _hoisted_15 = { class: "ina-select-dropdown__option-label" };
7044
7073
  const _hoisted_16 = {
7045
7074
  key: 0,
7046
7075
  class: "ina-select-dropdown__option-check-indicator"
@@ -7093,7 +7122,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7093
7122
  showPreviewValue: { type: Boolean, default: true },
7094
7123
  searchable: { type: Boolean, default: true }
7095
7124
  },
7096
- emits: ["update:modelValue", "change", "clear"],
7125
+ emits: ["update:modelValue", "change", "clear", "update:selectedRaw", "selectedRawChange"],
7097
7126
  setup(__props, { emit: __emit }) {
7098
7127
  const props = __props;
7099
7128
  const emit = __emit;
@@ -7104,6 +7133,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7104
7133
  const isOpen = ref(false);
7105
7134
  const internalSearchTerm = ref("");
7106
7135
  const searchTimeoutRef = ref(null);
7136
+ const selectedLabelsCache = ref(/* @__PURE__ */ new Map());
7107
7137
  const isSearchControlled = computed(() => props.searchValue !== void 0);
7108
7138
  const searchTerm = computed(
7109
7139
  () => isSearchControlled.value ? props.searchValue || "" : internalSearchTerm.value
@@ -7185,16 +7215,94 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7185
7215
  const singleSelected = computed(
7186
7216
  () => !props.multiple ? props.modelValue : null
7187
7217
  );
7218
+ const getLabelForValue = (value) => {
7219
+ if (selectedLabelsCache.value.has(value)) {
7220
+ return selectedLabelsCache.value.get(value) || null;
7221
+ }
7222
+ const found = props.options.find((o) => o.value === value);
7223
+ if (found) {
7224
+ selectedLabelsCache.value.set(value, found.label);
7225
+ return found.label;
7226
+ }
7227
+ return null;
7228
+ };
7229
+ const getOptionLabelByValue = (value) => {
7230
+ const label = getLabelForValue(value);
7231
+ return label || value;
7232
+ };
7233
+ watch(
7234
+ () => props.options,
7235
+ (newOptions) => {
7236
+ newOptions.forEach((option) => {
7237
+ if (selectedLabelsCache.value.has(option.value)) {
7238
+ selectedLabelsCache.value.set(option.value, option.label);
7239
+ }
7240
+ });
7241
+ },
7242
+ { deep: true }
7243
+ );
7244
+ const getOptionForValue = (value) => {
7245
+ const label = getLabelForValue(value);
7246
+ if (label !== null) {
7247
+ return { label, value };
7248
+ }
7249
+ const found = props.options.find((o) => o.value === value);
7250
+ return found || null;
7251
+ };
7252
+ watch(
7253
+ () => [props.modelValue, props.multiple],
7254
+ () => {
7255
+ const cache = selectedLabelsCache.value;
7256
+ if (props.multiple && Array.isArray(props.modelValue)) {
7257
+ props.modelValue.forEach((value) => {
7258
+ if (!cache.has(value)) {
7259
+ const found = props.options.find((o) => o.value === value);
7260
+ if (found) {
7261
+ cache.set(value, found.label);
7262
+ }
7263
+ }
7264
+ });
7265
+ cache.forEach((_, value) => {
7266
+ if (!props.modelValue.includes(value)) {
7267
+ cache.delete(value);
7268
+ }
7269
+ });
7270
+ } else if (props.modelValue !== null && props.modelValue !== void 0 && props.modelValue !== "") {
7271
+ if (!cache.has(props.modelValue)) {
7272
+ const found = props.options.find((o) => o.value === props.modelValue);
7273
+ if (found) {
7274
+ cache.set(props.modelValue, found.label);
7275
+ }
7276
+ }
7277
+ } else {
7278
+ cache.clear();
7279
+ }
7280
+ let selectedRaw = null;
7281
+ if (props.multiple && Array.isArray(props.modelValue)) {
7282
+ if (props.modelValue.length > 0) {
7283
+ const rawOptions = props.modelValue.map((val) => getOptionForValue(val)).filter((opt) => opt !== null);
7284
+ selectedRaw = rawOptions.length > 0 ? rawOptions : null;
7285
+ }
7286
+ } else if (props.modelValue !== null && props.modelValue !== void 0 && props.modelValue !== "") {
7287
+ selectedRaw = getOptionForValue(props.modelValue);
7288
+ }
7289
+ emit("update:selectedRaw", selectedRaw);
7290
+ emit("selectedRawChange", selectedRaw);
7291
+ },
7292
+ { deep: true, immediate: true }
7293
+ );
7188
7294
  const triggerLabel = computed(() => {
7189
7295
  if (props.multiple) {
7190
7296
  if (!selectedArray.value.length) return props.placeholder;
7191
7297
  else if (selectedArray.value.length > 3)
7192
7298
  return `${selectedArray.value.length} data terpilih`;
7193
- else
7194
- return props.options.filter((o) => selectedArray.value.includes(o.value)).map((o) => o.label).join(", ");
7299
+ else {
7300
+ const labels = selectedArray.value.map((val) => getLabelForValue(val)).filter((label) => label !== null);
7301
+ return labels.length > 0 ? labels.join(", ") : props.placeholder;
7302
+ }
7195
7303
  } else {
7196
- const found = props.options.find((o) => o.value === singleSelected.value);
7197
- return found ? found.label : props.placeholder;
7304
+ const label = getLabelForValue(singleSelected.value);
7305
+ return label || props.placeholder;
7198
7306
  }
7199
7307
  });
7200
7308
  const filteredOptions = computed(() => {
@@ -7221,10 +7329,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7221
7329
  const getOptionLabel = (option) => {
7222
7330
  return option.label;
7223
7331
  };
7224
- const getOptionLabelByValue = (value) => {
7225
- const option = props.options.find((o) => o.value === value);
7226
- return option ? option.label : value;
7227
- };
7228
7332
  const isSelected = (option) => {
7229
7333
  if (props.multiple) {
7230
7334
  return selectedArray.value.includes(option.value);
@@ -7245,11 +7349,23 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7245
7349
  if (props.disabled) return;
7246
7350
  if (props.multiple) {
7247
7351
  const prev = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
7248
- const newValue = prev.includes(option.value) ? prev.filter((v) => v !== option.value) : [...prev, option.value];
7352
+ const isCurrentlySelected = prev.includes(option.value);
7353
+ const newValue = isCurrentlySelected ? prev.filter((v) => v !== option.value) : [...prev, option.value];
7354
+ if (isCurrentlySelected) {
7355
+ selectedLabelsCache.value.delete(option.value);
7356
+ } else {
7357
+ selectedLabelsCache.value.set(option.value, option.label);
7358
+ }
7249
7359
  emit("update:modelValue", newValue);
7250
7360
  emit("change", newValue);
7251
7361
  } else {
7252
- const newValue = isSelected(option) ? null : option.value;
7362
+ const isCurrentlySelected = isSelected(option);
7363
+ const newValue = isCurrentlySelected ? null : option.value;
7364
+ if (isCurrentlySelected) {
7365
+ selectedLabelsCache.value.delete(option.value);
7366
+ } else {
7367
+ selectedLabelsCache.value.set(option.value, option.label);
7368
+ }
7253
7369
  emit("update:modelValue", newValue);
7254
7370
  emit("change", newValue);
7255
7371
  isOpen.value = false;
@@ -7261,6 +7377,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7261
7377
  }
7262
7378
  };
7263
7379
  const removeSelectedItem = (value) => {
7380
+ selectedLabelsCache.value.delete(value);
7264
7381
  if (props.onRemoveSelected) {
7265
7382
  props.onRemoveSelected(value);
7266
7383
  } else {
@@ -7430,7 +7547,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7430
7547
  option,
7431
7548
  selected: isSelected(option)
7432
7549
  }, () => [
7433
- createElementVNode("span", _hoisted_15$1, toDisplayString(getOptionLabel(option)), 1)
7550
+ createElementVNode("span", _hoisted_15, toDisplayString(getOptionLabel(option)), 1)
7434
7551
  ], true)
7435
7552
  ]),
7436
7553
  __props.multiple ? (openBlock(), createElementBlock("div", {
@@ -7489,7 +7606,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7489
7606
  };
7490
7607
  }
7491
7608
  });
7492
- const SelectDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-5e6f9f90"]]);
7609
+ const SelectDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-e3f2a508"]]);
7493
7610
  const _hoisted_1$e = ["aria-labelledby", "aria-describedby"];
7494
7611
  const _hoisted_2$e = {
7495
7612
  key: 0,
@@ -10477,40 +10594,18 @@ if (typeof window !== "undefined") {
10477
10594
  }
10478
10595
  const _hoisted_1 = ["accept", "disabled"];
10479
10596
  const _hoisted_2 = ["tabindex", "aria-label"];
10480
- const _hoisted_3 = { class: "ina-single-file-upload__content" };
10481
- const _hoisted_4 = { class: "ina-single-file-upload__title" };
10482
- const _hoisted_5 = { class: "ina-single-file-upload__description" };
10483
- const _hoisted_6 = { class: "ina-single-file-upload__progress" };
10484
- const _hoisted_7 = { class: "ina-single-file-upload__progress-bar" };
10485
- const _hoisted_8 = { class: "ina-single-file-upload__progress-text" };
10486
- const _hoisted_9 = { class: "ina-single-file-upload__icon-wrapper ina-single-file-upload__icon-wrapper--file" };
10487
- const _hoisted_10 = {
10488
- key: 0,
10489
- width: "16",
10490
- height: "16",
10491
- viewBox: "0 0 24 24",
10492
- fill: "none",
10493
- xmlns: "http://www.w3.org/2000/svg"
10494
- };
10495
- const _hoisted_11 = {
10496
- key: 1,
10497
- width: "16",
10498
- height: "16",
10499
- viewBox: "0 0 24 24",
10500
- fill: "none",
10501
- xmlns: "http://www.w3.org/2000/svg"
10502
- };
10503
- const _hoisted_12 = {
10504
- key: 2,
10505
- width: "16",
10506
- height: "16",
10507
- viewBox: "0 0 24 24",
10508
- fill: "none",
10509
- xmlns: "http://www.w3.org/2000/svg"
10510
- };
10511
- const _hoisted_13 = { class: "ina-single-file-upload__content" };
10512
- const _hoisted_14 = { class: "ina-single-file-upload__title" };
10513
- const _hoisted_15 = { class: "ina-single-file-upload__description" };
10597
+ const _hoisted_3 = { class: "ina-single-file-upload__icon-wrapper ina-single-file-upload__icon-wrapper--default" };
10598
+ const _hoisted_4 = { class: "ina-single-file-upload__content" };
10599
+ const _hoisted_5 = { class: "ina-single-file-upload__title" };
10600
+ const _hoisted_6 = { class: "ina-single-file-upload__description" };
10601
+ const _hoisted_7 = { class: "ina-single-file-upload__icon-wrapper ina-single-file-upload__icon-wrapper--default" };
10602
+ const _hoisted_8 = { class: "ina-single-file-upload__progress" };
10603
+ const _hoisted_9 = { class: "ina-single-file-upload__progress-bar" };
10604
+ const _hoisted_10 = { class: "ina-single-file-upload__progress-text" };
10605
+ const _hoisted_11 = { class: "ina-single-file-upload__icon-wrapper ina-single-file-upload__icon-wrapper--file" };
10606
+ const _hoisted_12 = { class: "ina-single-file-upload__content" };
10607
+ const _hoisted_13 = { class: "ina-single-file-upload__title" };
10608
+ const _hoisted_14 = { class: "ina-single-file-upload__description" };
10514
10609
  const _sfc_main = /* @__PURE__ */ defineComponent({
10515
10610
  __name: "SingleFileUpload",
10516
10611
  props: {
@@ -10548,16 +10643,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10548
10643
  "ina-single-file-upload__container--disabled": props.disabled
10549
10644
  }
10550
10645
  ]);
10551
- const isPdfFile = computed(() => {
10646
+ computed(() => {
10552
10647
  if (!file.value) return false;
10553
10648
  const fileType = file.value.type;
10554
10649
  const fileName = file.value.name.toLowerCase();
10555
10650
  return fileType === "application/pdf" || fileName.endsWith(".pdf");
10556
10651
  });
10557
- const isImageFile = computed(() => {
10652
+ computed(() => {
10558
10653
  if (!file.value) return false;
10559
10654
  return file.value.type.startsWith("image/");
10560
10655
  });
10656
+ const fileIconComponent = computed(() => {
10657
+ if (!file.value) return null;
10658
+ const fileType = file.value.type;
10659
+ const fileName = file.value.name.toLowerCase();
10660
+ if (fileType === "application/pdf" || fileName.endsWith(".pdf")) {
10661
+ return IconFileTypePdf;
10662
+ }
10663
+ if (fileType.startsWith("image/")) {
10664
+ return IconPhoto;
10665
+ }
10666
+ return IconFile;
10667
+ });
10561
10668
  const triggerFileInput = () => {
10562
10669
  var _a;
10563
10670
  if (props.disabled || file.value) return;
@@ -10780,79 +10887,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10780
10887
  onDrop: handleDrop
10781
10888
  }, [
10782
10889
  !file.value && status.value === "idle" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
10783
- _cache[0] || (_cache[0] = createStaticVNode('<div class="ina-single-file-upload__icon-wrapper ina-single-file-upload__icon-wrapper--default"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 10L12 15L17 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 15V3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg></div>', 1)),
10784
10890
  createElementVNode("div", _hoisted_3, [
10785
- createElementVNode("div", _hoisted_4, toDisplayString(props.title), 1),
10786
- createElementVNode("div", _hoisted_5, toDisplayString(props.description), 1)
10891
+ createVNode(unref(IconUpload), { size: 24 })
10892
+ ]),
10893
+ createElementVNode("div", _hoisted_4, [
10894
+ createElementVNode("div", _hoisted_5, toDisplayString(props.title), 1),
10895
+ createElementVNode("div", _hoisted_6, toDisplayString(props.description), 1)
10787
10896
  ])
10788
10897
  ], 64)) : createCommentVNode("", true),
10789
10898
  !file.value && status.value === "uploading" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
10790
- _cache[1] || (_cache[1] = createStaticVNode('<div class="ina-single-file-upload__icon-wrapper ina-single-file-upload__icon-wrapper--default"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 10L12 15L17 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 15V3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg></div>', 1)),
10791
- createElementVNode("div", _hoisted_6, [
10792
- createElementVNode("div", _hoisted_7, [
10899
+ createElementVNode("div", _hoisted_7, [
10900
+ createVNode(unref(IconUpload), { size: 24 })
10901
+ ]),
10902
+ createElementVNode("div", _hoisted_8, [
10903
+ createElementVNode("div", _hoisted_9, [
10793
10904
  createElementVNode("div", {
10794
10905
  class: "ina-single-file-upload__progress-fill",
10795
10906
  style: normalizeStyle({ width: `${progress.value}%` })
10796
10907
  }, null, 4)
10797
10908
  ]),
10798
- createElementVNode("div", _hoisted_8, " Uploading... " + toDisplayString(progress.value) + "% ", 1)
10909
+ createElementVNode("div", _hoisted_10, " Uploading... " + toDisplayString(progress.value) + "% ", 1)
10799
10910
  ])
10800
10911
  ], 64)) : createCommentVNode("", true),
10801
10912
  file.value && status.value === "success" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
10802
- createElementVNode("div", _hoisted_9, [
10803
- isPdfFile.value ? (openBlock(), createElementBlock("svg", _hoisted_10, [..._cache[2] || (_cache[2] = [
10804
- createStaticVNode('<path d="M14 2H6C5.46957 2 4.96086 2.21071 4.58579 2.58579C4.21071 2.96086 4 3.46957 4 4V20C4 20.5304 4.21071 21.0391 4.58579 21.4142C4.96086 21.7893 5.46957 22 6 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V8L14 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M10 9H9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>', 5)
10805
- ])])) : isImageFile.value ? (openBlock(), createElementBlock("svg", _hoisted_11, [..._cache[3] || (_cache[3] = [
10806
- createElementVNode("path", {
10807
- d: "M21 19V5C21 4.46957 20.7893 3.96086 20.4142 3.58579C20.0391 3.21071 19.5304 3 19 3H5C4.46957 3 3.96086 3.21071 3.58579 3.58579C3.21071 3.96086 3 4.46957 3 5V19C3 19.5304 3.21071 20.0391 3.58579 20.4142C3.96086 20.7893 4.46957 21 5 21H19C19.5304 21 20.0391 20.7893 20.4142 20.4142C20.7893 20.0391 21 19.5304 21 19Z",
10808
- stroke: "currentColor",
10809
- "stroke-width": "2",
10810
- "stroke-linecap": "round",
10811
- "stroke-linejoin": "round"
10812
- }, null, -1),
10813
- createElementVNode("path", {
10814
- d: "M9 9C9.55228 9 10 8.55228 10 8C10 7.44772 9.55228 7 9 7C8.44772 7 8 7.44772 8 8C8 8.55228 8.44772 9 9 9Z",
10815
- stroke: "currentColor",
10816
- "stroke-width": "2",
10817
- "stroke-linecap": "round",
10818
- "stroke-linejoin": "round"
10819
- }, null, -1),
10820
- createElementVNode("path", {
10821
- d: "M21 15L16 10L5 21",
10822
- stroke: "currentColor",
10823
- "stroke-width": "2",
10824
- "stroke-linecap": "round",
10825
- "stroke-linejoin": "round"
10826
- }, null, -1)
10827
- ])])) : (openBlock(), createElementBlock("svg", _hoisted_12, [..._cache[4] || (_cache[4] = [
10828
- createElementVNode("path", {
10829
- d: "M14 2H6C5.46957 2 4.96086 2.21071 4.58579 2.58579C4.21071 2.96086 4 3.46957 4 4V20C4 20.5304 4.21071 21.0391 4.58579 21.4142C4.96086 21.7893 5.46957 22 6 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V8L14 2Z",
10830
- stroke: "currentColor",
10831
- "stroke-width": "2",
10832
- "stroke-linecap": "round",
10833
- "stroke-linejoin": "round"
10834
- }, null, -1),
10835
- createElementVNode("path", {
10836
- d: "M14 2V8H20",
10837
- stroke: "currentColor",
10838
- "stroke-width": "2",
10839
- "stroke-linecap": "round",
10840
- "stroke-linejoin": "round"
10841
- }, null, -1)
10842
- ])]))
10913
+ createElementVNode("div", _hoisted_11, [
10914
+ (openBlock(), createBlock(resolveDynamicComponent(fileIconComponent.value), { size: 16 }))
10843
10915
  ]),
10844
- createElementVNode("div", _hoisted_13, [
10845
- createElementVNode("div", _hoisted_14, toDisplayString(file.value.name), 1),
10846
- createElementVNode("div", _hoisted_15, toDisplayString(props.description), 1)
10916
+ createElementVNode("div", _hoisted_12, [
10917
+ createElementVNode("div", _hoisted_13, toDisplayString(file.value.name), 1),
10918
+ createElementVNode("div", _hoisted_14, toDisplayString(props.description), 1)
10847
10919
  ]),
10848
10920
  createElementVNode("button", {
10849
10921
  type: "button",
10850
10922
  class: "ina-single-file-upload__delete-button",
10851
10923
  "aria-label": "Remove file",
10852
10924
  onClick: withModifiers(handleRemove, ["stop"])
10853
- }, [..._cache[5] || (_cache[5] = [
10854
- createStaticVNode('<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 6H5H21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 6V4C8 3.46957 8.21071 2.96086 8.58579 2.58579C8.96086 2.21071 9.46957 2 10 2H14C14.5304 2 15.0391 2.21071 15.4142 2.58579C15.7893 2.96086 16 3.46957 16 4V6M19 6V20C19 20.5304 18.7893 21.0391 18.4142 21.4142C18.0391 21.7893 17.5304 22 17 22H7C6.46957 22 5.96086 21.7893 5.58579 21.4142C5.21071 21.0391 5 20.5304 5 20V6H19Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M10 11V17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M14 11V17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>', 1)
10855
- ])])
10925
+ }, [
10926
+ createVNode(unref(IconTrash), { size: 18 })
10927
+ ])
10856
10928
  ], 64)) : createCommentVNode("", true)
10857
10929
  ], 42, _hoisted_2)
10858
10930
  ], 2);