@citruslime/ui 4.1.0-beta.17 → 4.1.0-beta.18

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.
@@ -5,7 +5,7 @@ import { useFocusWithin, onKeyDown, toArray, unrefElement, tryOnScopeDispose, on
5
5
  import { useI18n, createI18n } from "vue-i18n";
6
6
  import { createFocusTrap } from "focus-trap";
7
7
  import { copy } from "@citruslime/vue-utils";
8
- import { DateTime } from "luxon";
8
+ import { DateTime, Info } from "luxon";
9
9
  import { DatePicker } from "v-calendar";
10
10
  import { useCurrencyInput } from "vue-currency-input";
11
11
  const _hoisted_1$13 = { class: "cl:overflow-hidden" };
@@ -2347,17 +2347,18 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
2347
2347
  }
2348
2348
  function formatString() {
2349
2349
  let value = props.data[props.column.field];
2350
- if (!value || typeof value !== "string") {
2350
+ if (!value) {
2351
2351
  return "";
2352
- }
2353
- if (props.column.maxLength) {
2354
- value = value.trimToLength(props.column.maxLength, props.column.format !== void 0 ? props.column.format === "ellipsis" : false);
2355
- }
2356
- if (props.searchValue && props.column.searchable) {
2357
- value = highlightText(value, props.searchValue.split(" "));
2358
- }
2359
- if (props.column.format === "wrap-text") {
2360
- value = `<span class="cl:break-words cl:whitespace-pre-wrap">${value}</span>`;
2352
+ } else if (typeof value === "string") {
2353
+ if (props.column.maxLength) {
2354
+ value = value.trimToLength(props.column.maxLength, props.column.format !== void 0 ? props.column.format === "ellipsis" : false);
2355
+ }
2356
+ if (props.searchValue && props.column.searchable) {
2357
+ value = highlightText(value, props.searchValue.split(" "));
2358
+ }
2359
+ if (props.column.format === "wrap-text") {
2360
+ value = `<span class="cl:break-words cl:whitespace-pre-wrap">${value}</span>`;
2361
+ }
2361
2362
  }
2362
2363
  return value;
2363
2364
  }
@@ -4056,7 +4057,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4056
4057
  required: { type: Boolean },
4057
4058
  disabled: { type: Boolean },
4058
4059
  rangeSelected: { type: Boolean },
4059
- forceIconDisplay: { type: Boolean }
4060
+ forceIconDisplay: { type: Boolean },
4061
+ interactiveIcon: { type: Boolean }
4060
4062
  },
4061
4063
  emits: ["clear", "reset", "togglePopover", "focus", "blur"],
4062
4064
  setup(__props, { expose: __expose }) {
@@ -4104,10 +4106,13 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4104
4106
  onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("blur"))
4105
4107
  }, toHandlers(_ctx.events, true)), null, 16, _hoisted_2$t),
4106
4108
  createVNode(unref(Icon), {
4107
- class: "cl:absolute cl:bg-transparent cl:cursor-text cl:left-2 cl:text-grey-4 cl:top-3.5 icon",
4109
+ class: normalizeClass(["cl:absolute cl:bg-transparent cl:cursor-pointer cl:hover:text-link-light cl:left-2 cl:text-grey-4 cl:top-3.5 icon", { "cl:pointer-events-none": !_ctx.interactiveIcon }]),
4108
4110
  icon: _ctx.type === "time" ? "ph-clock" : "ph:calendar",
4109
- onClick: focus
4110
- }, null, 8, ["icon"]),
4111
+ onClick: _cache[4] || (_cache[4] = ($event) => {
4112
+ focus();
4113
+ _ctx.$emit("togglePopover");
4114
+ })
4115
+ }, null, 8, ["class", "icon"]),
4111
4116
  !_ctx.disabled ? (openBlock(), createElementBlock("div", {
4112
4117
  key: 0,
4113
4118
  class: normalizeClass(["action-icon cl:absolute cl:bg-transparent cl:flex cl:right-2 cl:text-grey-4 cl:top-3.5", { "show-icons": _ctx.forceIconDisplay }])
@@ -4116,20 +4121,20 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4116
4121
  key: 0,
4117
4122
  class: "cl:cursor-pointer cl:hover:text-link-light",
4118
4123
  icon: "ph:arrow-counter-clockwise",
4119
- onClick: _cache[4] || (_cache[4] = withModifiers(($event) => _ctx.$emit("reset"), ["prevent"]))
4124
+ onClick: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.$emit("reset"), ["prevent"]))
4120
4125
  })) : createCommentVNode("", true),
4121
4126
  !_ctx.required && _ctx.date && (_ctx.type !== "time" || _ctx.date !== "00:00") ? (openBlock(), createBlock(unref(Icon), {
4122
4127
  key: 1,
4123
4128
  class: "cl:cursor-pointer cl:hover:text-link-light cl:md:ml-0.5 clear-icon",
4124
4129
  icon: "ph:x",
4125
- onClick: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.$emit("clear"), ["prevent"]))
4130
+ onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.$emit("clear"), ["prevent"]))
4126
4131
  })) : createCommentVNode("", true)
4127
4132
  ], 2)) : createCommentVNode("", true)
4128
4133
  ]));
4129
4134
  };
4130
4135
  }
4131
4136
  });
4132
- const clUiCalendarInput = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-8d0a0dc4"]]);
4137
+ const clUiCalendarInput = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-384b53f2"]]);
4133
4138
  const _hoisted_1$D = {
4134
4139
  key: 0,
4135
4140
  class: "cl:px-3 cl:py-3 cl:w-full"
@@ -4193,6 +4198,29 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4193
4198
  const { locale: locale2 } = useI18n();
4194
4199
  const internalLocale = computed(() => props.dateFormatLocale ?? locale2.value);
4195
4200
  const todayButtonVisible = ref(true);
4201
+ const internalPlaceholder = computed(() => {
4202
+ if (props.placeholder) {
4203
+ return props.placeholder;
4204
+ } else {
4205
+ const formatPlaceholderDateOptions = {
4206
+ year: "numeric",
4207
+ month: "2-digit",
4208
+ day: "2-digit"
4209
+ };
4210
+ const formatPlaceholderTimeOptions = {
4211
+ hour: "2-digit",
4212
+ minute: "2-digit"
4213
+ };
4214
+ const meridiems = Info.meridiems().join(", ");
4215
+ const displayString = DateTime.parseFormatForOpts({
4216
+ ...props.type === "time" ? void 0 : formatPlaceholderDateOptions,
4217
+ ...props.type === "date" ? void 0 : formatPlaceholderTimeOptions
4218
+ }, {
4219
+ locale: internalLocale.value
4220
+ });
4221
+ return displayString?.replace("yyyyyy", "yyyy").replace("yyyyy", "yyyy").replace("a", `(${meridiems})`) ?? null;
4222
+ }
4223
+ });
4196
4224
  const showPopoverComputed = computed(() => {
4197
4225
  return props.showPopover !== void 0 ? props.showPopover : props.type !== "time";
4198
4226
  });
@@ -4276,14 +4304,16 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4276
4304
  date: inputValue,
4277
4305
  events: inputEvents,
4278
4306
  type: _ctx.type,
4279
- placeholder: _ctx.placeholder,
4307
+ placeholder: internalPlaceholder.value,
4280
4308
  required: _ctx.required,
4281
4309
  "force-icon-display": _ctx.forceIconDisplay,
4282
4310
  disabled: _ctx.disabled,
4311
+ "interactive-icon": !props.showPopover,
4283
4312
  onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("focus")),
4284
4313
  onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("blur")),
4285
- onClear: _cache[2] || (_cache[2] = ($event) => internalCurrentDateTime.value = null)
4286
- }), null, 16, ["date", "events", "type", "placeholder", "required", "force-icon-display", "disabled"])
4314
+ onClear: _cache[2] || (_cache[2] = ($event) => internalCurrentDateTime.value = null),
4315
+ onTogglePopover: calendar.value?.showPopover
4316
+ }), null, 16, ["date", "events", "type", "placeholder", "required", "force-icon-display", "disabled", "interactive-icon", "onTogglePopover"])
4287
4317
  ]),
4288
4318
  footer: withCtx(() => [
4289
4319
  todayButtonVisible.value ? (openBlock(), createElementBlock("div", _hoisted_1$D, [
@@ -4323,15 +4353,17 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4323
4353
  date: inputValue,
4324
4354
  events: inputEvents,
4325
4355
  type: _ctx.type,
4326
- placeholder: _ctx.placeholder,
4356
+ placeholder: internalPlaceholder.value,
4327
4357
  required: _ctx.required,
4328
4358
  disabled: _ctx.disabled,
4329
4359
  "force-icon-display": _ctx.forceIconDisplay,
4360
+ "interactive-icon": !props.showPopover,
4330
4361
  onFocus: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("focus")),
4331
4362
  onBlur: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("blur")),
4332
4363
  onClear: _cache[6] || (_cache[6] = ($event) => internalCurrentDateTime.value = null),
4333
- onReset: _cache[7] || (_cache[7] = ($event) => internalCurrentDateTime.value = unref(getDefaultDate)(_ctx.minDate, _ctx.maxDate, internalTimeZone.value, _ctx.type))
4334
- }), null, 16, ["date", "events", "type", "placeholder", "required", "disabled", "force-icon-display"])
4364
+ onReset: _cache[7] || (_cache[7] = ($event) => internalCurrentDateTime.value = unref(getDefaultDate)(_ctx.minDate, _ctx.maxDate, internalTimeZone.value, _ctx.type)),
4365
+ onTogglePopover: calendar.value?.showPopover
4366
+ }), null, 16, ["date", "events", "type", "placeholder", "required", "disabled", "force-icon-display", "interactive-icon", "onTogglePopover"])
4335
4367
  ]),
4336
4368
  footer: withCtx(() => [
4337
4369
  todayButtonVisible.value ? (openBlock(), createElementBlock("div", _hoisted_2$s, [