@flux-ui/components 3.0.0-next.33 → 3.0.0-next.34

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,9 +5,5 @@ type __VLS_Props = {
5
5
  readonly name: FluxIconName;
6
6
  readonly size?: number;
7
7
  };
8
- declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
9
- click: (args_0: MouseEvent) => any;
10
- }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
11
- onClick?: (args_0: MouseEvent) => any;
12
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
8
+ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
13
9
  export default _default;
@@ -1,15 +1,11 @@
1
- import { FluxAutoCompleteType, FluxDirection } from '@flux-ui/types';
2
1
  import { DateTime } from 'luxon';
3
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, ComponentInternalInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, GlobalComponents, GlobalDirectives, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties } from 'vue';
3
+ import { FluxDirection } from '@flux-ui/types';
4
4
  import { OnCleanup } from '@vue/reactivity';
5
5
  type __VLS_Props = {
6
- readonly autoComplete?: FluxAutoCompleteType;
7
- readonly autoFocus?: boolean;
8
6
  readonly disabled?: boolean;
9
- readonly isReadonly?: boolean;
10
7
  readonly max?: DateTime;
11
8
  readonly min?: DateTime;
12
- readonly placeholder?: string;
13
9
  readonly rangeMode?: 'range' | 'week' | 'month';
14
10
  };
15
11
  type __VLS_PublicProps = {
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ var FluxFormFieldInjectionKey = Symbol();
70
70
  var FluxTableInjectionKey = Symbol();
71
71
  var FluxTooltipInjectionKey = Symbol();
72
72
  //#endregion
73
- //#region ../../node_modules/.bun/@basmilius+utils@3.11.1/node_modules/@basmilius/utils/dist/index.mjs
73
+ //#region ../../node_modules/.bun/@basmilius+utils@3.12.1/node_modules/@basmilius/utils/dist/index.mjs
74
74
  function t(e, t) {
75
75
  return Math.round(e / t) * t;
76
76
  }
@@ -254,7 +254,7 @@ function useFormSelect_default(modelValue, isMultiple, options, searchQuery) {
254
254
  const groups = computed(() => {
255
255
  const groups = [];
256
256
  const search = unref(searchQuery)?.trim().toLowerCase();
257
- const available = unref(options).filter((o) => !("value" in o) || !search || o.label.toLowerCase().includes(search)).filter((o) => !("value" in o) || !isMultiple || !unref(selected).find((s) => s.value === o.value));
257
+ const available = unref(options).filter((o) => isFluxFormSelectGroup(o) || !search || o.label.toLowerCase().includes(search)).filter((o) => isFluxFormSelectGroup(o) || !isMultiple || !unref(selected).find((s) => s.value === o.value));
258
258
  if (available.length === 0) return [];
259
259
  if (!available.find(isFluxFormSelectGroup)) return [[null, available]];
260
260
  for (let i = 0; i < available.length;) {
@@ -4295,7 +4295,7 @@ useMode(definition$2);
4295
4295
  useMode(definition$1);
4296
4296
  useMode(definition);
4297
4297
  //#endregion
4298
- //#region ../../node_modules/.bun/@basmilius+http-client@3.11.1+1fb4c65d43e298b9/node_modules/@basmilius/http-client/dist/index.mjs
4298
+ //#region ../../node_modules/.bun/@basmilius+http-client@3.12.1+1fb4c65d43e298b9/node_modules/@basmilius/http-client/dist/index.mjs
4299
4299
  function c(e) {
4300
4300
  return class extends e {
4301
4301
  constructor(...e) {
@@ -7843,13 +7843,13 @@ var FluxButton_default = /* @__PURE__ */ defineComponent({
7843
7843
  });
7844
7844
  //#endregion
7845
7845
  //#region src/css/component/Action.module.scss
7846
- var { "button": _0$15, "buttonIcon": _1$8, "buttonLabel": _2$5 } = Button_module_default$1;
7846
+ var { "buttonLabel": _0$15, "button": _1$8, "buttonIcon": _2$5 } = Button_module_default$1;
7847
7847
  var Action_module_default = {
7848
- action: `action ${_0$15}`,
7848
+ action: `action ${_1$8}`,
7849
7849
  spinner: `spinner`,
7850
- actionIcon: `action-icon ${_1$8}`,
7850
+ actionIcon: `action-icon ${_2$5}`,
7851
7851
  isDestructive: `is-destructive`,
7852
- actionLabel: `action-label ${_2$5}`,
7852
+ actionLabel: `action-label ${_0$15}`,
7853
7853
  actionBar: `action-bar`,
7854
7854
  separator: `separator`,
7855
7855
  formInput: `form-input`,
@@ -9352,7 +9352,6 @@ var FluxBoxedIcon_default = /* @__PURE__ */ defineComponent({
9352
9352
  name: {},
9353
9353
  size: {}
9354
9354
  },
9355
- emits: ["click"],
9356
9355
  setup(__props) {
9357
9356
  return (_ctx, _cache) => {
9358
9357
  return openBlock(), createElementBlock("div", {
@@ -9749,8 +9748,13 @@ var FilterItem_default = /* @__PURE__ */ defineComponent({
9749
9748
  function onClick(evt) {
9750
9749
  emit("click", evt);
9751
9750
  }
9752
- watch(() => __props.item, async () => {
9753
- valueLabel.value = await unref(getValueLabel)(__props.value) ?? void 0;
9751
+ watch([() => __props.item, () => __props.value], async ([, nextValue], _prev, onCleanup) => {
9752
+ let cancelled = false;
9753
+ onCleanup(() => {
9754
+ cancelled = true;
9755
+ });
9756
+ const nextLabel = await unref(getValueLabel)(nextValue);
9757
+ if (!cancelled) valueLabel.value = nextLabel ?? void 0;
9754
9758
  }, {
9755
9759
  deep: true,
9756
9760
  immediate: true
@@ -10348,7 +10352,7 @@ var SelectBase_default = /* @__PURE__ */ defineComponent({
10348
10352
  isPopupOpen.value = false;
10349
10353
  return;
10350
10354
  default:
10351
- if (evt.key.match(/[a-z]/)) highlightedIndex.value = unref(rawOptions).findIndex((o) => o.label.toLowerCase().startsWith(evt.key));
10355
+ if (evt.key.length === 1) highlightedIndex.value = unref(rawOptions).findIndex((o) => o.label.toLowerCase().startsWith(evt.key.toLowerCase()));
10352
10356
  else highlightedIndex.value = -1;
10353
10357
  return;
10354
10358
  }
@@ -10589,17 +10593,11 @@ var SliderBase_default = /* @__PURE__ */ defineComponent({
10589
10593
  const emit = __emit;
10590
10594
  const disabled = useDisabled_default(toRef(() => __props.disabled));
10591
10595
  const rootRef = useTemplateRef("root");
10592
- onMounted(() => {
10593
- document.addEventListener("pointermove", onPointerMove);
10594
- document.addEventListener("pointerup", onPointerUp, { passive: true });
10595
- });
10596
- onUnmounted(() => {
10597
- document.removeEventListener("pointermove", onPointerMove);
10598
- document.removeEventListener("pointerup", onPointerUp);
10599
- });
10600
10596
  function onPointerDown(evt) {
10601
10597
  if (unref(disabled)) return;
10602
10598
  emit("dragging", true);
10599
+ document.addEventListener("pointermove", onPointerMove);
10600
+ document.addEventListener("pointerup", onPointerUp, { passive: true });
10603
10601
  requestAnimationFrame(() => onPointerMove(evt));
10604
10602
  }
10605
10603
  function onPointerMove(evt) {
@@ -10608,13 +10606,18 @@ var SliderBase_default = /* @__PURE__ */ defineComponent({
10608
10606
  let { left, width } = root.getBoundingClientRect();
10609
10607
  left += 6;
10610
10608
  width -= 12;
10611
- emit("update", Math.max(0, Math.min(1, (evt.pageX - left) / width)));
10609
+ emit("update", Math.max(0, Math.min(1, (evt.clientX - left) / width)));
10612
10610
  evt.preventDefault();
10613
10611
  }
10614
10612
  function onPointerUp() {
10615
10613
  emit("dragging", false);
10614
+ document.removeEventListener("pointermove", onPointerMove);
10615
+ document.removeEventListener("pointerup", onPointerUp);
10616
10616
  }
10617
- watch(() => __props.isDragging, () => emit("dragging", __props.isDragging));
10617
+ onUnmounted(() => {
10618
+ document.removeEventListener("pointermove", onPointerMove);
10619
+ document.removeEventListener("pointerup", onPointerUp);
10620
+ });
10618
10621
  return (_ctx, _cache) => {
10619
10622
  return openBlock(), createElementBlock("div", {
10620
10623
  ref: "root",
@@ -10947,6 +10950,7 @@ var FluxCalendar_default = /* @__PURE__ */ defineComponent({
10947
10950
  role: "gridcell"
10948
10951
  }, [createElementVNode("div", { class: normalizeClass(unref(Calendar_module_default).calendarEvents) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(getEventsForDate(date), (event) => {
10949
10952
  return openBlock(), createBlock(unref(VNodeRenderer), {
10953
+ key: event.index,
10950
10954
  class: normalizeClass(unref(clsx)(event.type === "single" && unref(Calendar_module_default).isSingle, event.type === "start" && unref(Calendar_module_default).isStart, event.type === "end" && unref(Calendar_module_default).isEnd, event.type === "middle" && unref(Calendar_module_default).isMiddle)),
10951
10955
  style: normalizeStyle({ gridRow: event.index }),
10952
10956
  vnode: event.vnode
@@ -10955,7 +10959,7 @@ var FluxCalendar_default = /* @__PURE__ */ defineComponent({
10955
10959
  "style",
10956
10960
  "vnode"
10957
10961
  ]);
10958
- }), 256))], 2), createElementVNode("span", { class: normalizeClass(unref(Calendar_module_default).calendarEntryDate) }, toDisplayString(date.toLocaleString({ day: "numeric" })), 3)], 2);
10962
+ }), 128))], 2), createElementVNode("span", { class: normalizeClass(unref(Calendar_module_default).calendarEntryDate) }, toDisplayString(date.toLocaleString({ day: "numeric" })), 3)], 2);
10959
10963
  }), 256))], 2))]),
10960
10964
  _: 1
10961
10965
  }, 8, ["is-back"]),
@@ -11310,14 +11314,6 @@ var CoordinatePicker_default = /* @__PURE__ */ defineComponent({
11310
11314
  const min = computed(() => Array.isArray(__props.min) ? __props.min : [__props.min, __props.min]);
11311
11315
  const step = computed(() => Array.isArray(__props.step) ? __props.step : [__props.step, __props.step]);
11312
11316
  const thumbPosition = computed(() => [(unref(modelValue)[0] - unref(min)[0]) / (unref(max)[0] - unref(min)[0]), (unref(modelValue)[1] - unref(min)[1]) / (unref(max)[1] - unref(min)[1])]);
11313
- onMounted(() => {
11314
- document.addEventListener("pointermove", onPointerMove);
11315
- document.addEventListener("pointerup", onPointerUp, { passive: true });
11316
- });
11317
- onUnmounted(() => {
11318
- document.removeEventListener("pointermove", onPointerMove);
11319
- document.removeEventListener("pointerup", onPointerUp);
11320
- });
11321
11317
  function onDecrement(x, y) {
11322
11318
  if (unref(disabled)) return;
11323
11319
  let [valueX, valueY] = unref(modelValue);
@@ -11341,6 +11337,8 @@ var CoordinatePicker_default = /* @__PURE__ */ defineComponent({
11341
11337
  function onPointerDown(evt) {
11342
11338
  if (unref(disabled)) return;
11343
11339
  isDragging.value = true;
11340
+ document.addEventListener("pointermove", onPointerMove);
11341
+ document.addEventListener("pointerup", onPointerUp, { passive: true });
11344
11342
  requestAnimationFrame(() => onPointerMove(evt));
11345
11343
  }
11346
11344
  function onPointerMove(evt) {
@@ -11361,8 +11359,14 @@ var CoordinatePicker_default = /* @__PURE__ */ defineComponent({
11361
11359
  }
11362
11360
  function onPointerUp() {
11363
11361
  isDragging.value = false;
11362
+ document.removeEventListener("pointermove", onPointerMove);
11363
+ document.removeEventListener("pointerup", onPointerUp);
11364
11364
  }
11365
11365
  watch(isDragging, (isDragging) => emit("dragging", isDragging));
11366
+ onUnmounted(() => {
11367
+ document.removeEventListener("pointermove", onPointerMove);
11368
+ document.removeEventListener("pointerup", onPointerUp);
11369
+ });
11366
11370
  return (_ctx, _cache) => {
11367
11371
  return openBlock(), createElementBlock("div", {
11368
11372
  ref: "root",
@@ -11705,7 +11709,7 @@ var FluxColorPicker_default = /* @__PURE__ */ defineComponent({
11705
11709
  return computed({
11706
11710
  get: () => fromHSV?.(...unref(hsv))[index] ?? unref(hsv)[index],
11707
11711
  set: (value) => {
11708
- const values = fromHSV?.(...unref(hsv)) ?? unref(hsv);
11712
+ const values = [...fromHSV?.(...unref(hsv)) ?? unref(hsv)];
11709
11713
  values[index] = value;
11710
11714
  hsv.value = toHSV?.(...values) ?? values;
11711
11715
  }
@@ -12001,7 +12005,7 @@ var FluxColorSelect_default = /* @__PURE__ */ defineComponent({
12001
12005
  emits: ["update:modelValue"],
12002
12006
  setup(__props) {
12003
12007
  const modelValue = useModel(__props, "modelValue");
12004
- const t = useTranslate_default();
12008
+ const translate = useTranslate_default();
12005
12009
  const customColor = ref("#000000");
12006
12010
  function select(color, close) {
12007
12011
  modelValue.value = color;
@@ -12033,10 +12037,10 @@ var FluxColorSelect_default = /* @__PURE__ */ defineComponent({
12033
12037
  class: normalizeClass(unref(Color_module_default).colorSelectCustomPicker)
12034
12038
  }, null, 8, ["modelValue", "class"]), createVNode(FluxPaneBody_default, { class: normalizeClass(unref(Color_module_default).colorSelectButtons) }, {
12035
12039
  default: withCtx(() => [createVNode(FluxSecondaryButton_default, {
12036
- label: unref(t)("flux.cancel"),
12040
+ label: unref(translate)("flux.cancel"),
12037
12041
  onClick: ($event) => close()
12038
12042
  }, null, 8, ["label", "onClick"]), createVNode(FluxPrimaryButton_default, {
12039
- label: unref(t)("flux.ok"),
12043
+ label: unref(translate)("flux.ok"),
12040
12044
  onClick: ($event) => select(customColor.value, close)
12041
12045
  }, null, 8, ["label", "onClick"])]),
12042
12046
  _: 2
@@ -12083,10 +12087,10 @@ var FluxFormSelect_default = /* @__PURE__ */ defineComponent({
12083
12087
  const disabled = useDisabled_default(toRef(() => __props.disabled));
12084
12088
  const { groups, selected, values } = useFormSelect_default(modelValue, __props.isMultiple, toRef(() => __props.options), modelSearch);
12085
12089
  function onDeselect(id) {
12086
- if (unref(__props.isMultiple)) modelValue.value = unref(values).filter((v) => v !== id);
12090
+ if (__props.isMultiple) modelValue.value = unref(values).filter((v) => v !== id);
12087
12091
  }
12088
12092
  function onSelect(id) {
12089
- if (unref(__props.isMultiple)) modelValue.value = [...unref(values), id];
12093
+ if (__props.isMultiple) modelValue.value = [...unref(values), id];
12090
12094
  else modelValue.value = id;
12091
12095
  }
12092
12096
  return (_ctx, _cache) => {
@@ -12672,10 +12676,7 @@ var FluxDatePicker_default = /* @__PURE__ */ defineComponent({
12672
12676
  min: {},
12673
12677
  rangeMode: {}
12674
12678
  }, {
12675
- "modelValue": {
12676
- default: null,
12677
- required: true
12678
- },
12679
+ "modelValue": { required: true },
12679
12680
  "modelModifiers": {}
12680
12681
  }),
12681
12682
  emits: ["update:modelValue"],
@@ -13334,11 +13335,11 @@ var FluxFader_default = /* @__PURE__ */ defineComponent({
13334
13335
  current.value = unref(current) + 1 >= unref(count) ? 0 : unref(current) + 1;
13335
13336
  }
13336
13337
  function previous() {
13337
- current.value = unref(current) - 1 <= -1 ? unref(count) - 1 : unref(current) + 1;
13338
+ current.value = unref(current) - 1 <= -1 ? unref(count) - 1 : unref(current) - 1;
13338
13339
  }
13339
13340
  watch(current, (current) => {
13340
13341
  const fader = T(faderRef);
13341
- if (!fader || fader.children.length === 0) return;
13342
+ if (!fader || fader.children.length === 0 || current < 0) return;
13342
13343
  Array.from(fader.children).forEach((item) => item.classList.remove(Fader_module_default.isCurrent));
13343
13344
  fader.children[current].classList.add(Fader_module_default.isCurrent);
13344
13345
  emit("update", current);
@@ -14355,8 +14356,8 @@ var FluxFocalPointEditor_default = /* @__PURE__ */ defineComponent({
14355
14356
  const image = unref(imageRef);
14356
14357
  if (!image || !dragging.value) return;
14357
14358
  const { top, left, width, height } = image.getBoundingClientRect();
14358
- const { pageX, pageY } = evt;
14359
- dragging.value = [Math.max(0, Math.min(1, (pageX - left) / width)) * 100, Math.max(0, Math.min(1, (pageY - top) / height)) * 100];
14359
+ const { clientX, clientY } = evt;
14360
+ dragging.value = [Math.max(0, Math.min(1, (clientX - left) / width)) * 100, Math.max(0, Math.min(1, (clientY - top) / height)) * 100];
14360
14361
  }
14361
14362
  function onPointerUp() {
14362
14363
  if (!dragging.value) return;
@@ -14581,13 +14582,9 @@ var FluxFormDateInput_default = /* @__PURE__ */ defineComponent({
14581
14582
  var FluxFormDateRangeInput_default = /* @__PURE__ */ defineComponent({
14582
14583
  __name: "FluxFormDateRangeInput",
14583
14584
  props: /* @__PURE__ */ mergeModels({
14584
- autoComplete: {},
14585
- autoFocus: { type: Boolean },
14586
14585
  disabled: { type: Boolean },
14587
- isReadonly: { type: Boolean },
14588
14586
  max: {},
14589
14587
  min: {},
14590
- placeholder: {},
14591
14588
  rangeMode: { default: "range" }
14592
14589
  }, {
14593
14590
  "modelValue": { required: true },
@@ -14678,8 +14675,8 @@ var FluxFormDateTimeInput_default = /* @__PURE__ */ defineComponent({
14678
14675
  if (!DateTime.isDateTime(dateTime)) return;
14679
14676
  localValue.value = (localValue.value ?? DateTime.now()).set({
14680
14677
  hour: dateTime.hour,
14681
- minute: unref(__props.isHourOnly) ? 0 : dateTime.minute,
14682
- second: unref(__props.isHourOnly) ? 0 : dateTime.second
14678
+ minute: __props.isHourOnly ? 0 : dateTime.minute,
14679
+ second: __props.isHourOnly ? 0 : dateTime.second
14683
14680
  });
14684
14681
  }
14685
14682
  watch(() => __props.isHourOnly, () => __props.isHourOnly && (localValue.value = unref(localValue)?.startOf("hour") ?? null), { immediate: true });
@@ -15171,6 +15168,7 @@ var _hoisted_1$18 = [
15171
15168
  "autocomplete",
15172
15169
  "autofocus",
15173
15170
  "disabled",
15171
+ "readonly",
15174
15172
  "maxlength",
15175
15173
  "placeholder",
15176
15174
  "aria-disabled"
@@ -15209,6 +15207,7 @@ var FluxFormTextArea_default = /* @__PURE__ */ defineComponent({
15209
15207
  autocomplete: __props.autoComplete,
15210
15208
  autofocus: __props.autoFocus,
15211
15209
  disabled: unref(disabled),
15210
+ readonly: __props.isReadonly,
15212
15211
  maxlength: __props.maxLength,
15213
15212
  placeholder: __props.placeholder,
15214
15213
  style: normalizeStyle({ "--rows": __props.rows }),
@@ -17554,12 +17553,9 @@ var FluxQuantitySelector_default = /* @__PURE__ */ defineComponent({
17554
17553
  });
17555
17554
  }
17556
17555
  watchEffect(() => {
17557
- if (unref(modelValue) > __props.max) {
17558
- increment();
17559
- return;
17560
- }
17561
- if (unref(modelValue) < __props.min) {
17562
- decrement();
17556
+ const value = unref(modelValue);
17557
+ if (value > __props.max || value < __props.min) {
17558
+ modelValue.value = Math.min(__props.max, Math.max(__props.min, value));
17563
17559
  return;
17564
17560
  }
17565
17561
  sizeToContent();
@@ -17680,10 +17676,11 @@ var FluxSnackbar_default = /* @__PURE__ */ defineComponent({
17680
17676
  if (id.value) removeSnackbar(id.value);
17681
17677
  return;
17682
17678
  }
17683
- let spec = instance.props;
17684
- spec.onAction = onAction;
17685
- spec.onClose = onClose;
17686
- id.value = addSnackbar(spec);
17679
+ id.value = addSnackbar({
17680
+ ...instance.props,
17681
+ onAction,
17682
+ onClose
17683
+ });
17687
17684
  }, { immediate: true });
17688
17685
  return (_ctx, _cache) => {
17689
17686
  return __props.isRendered ? (openBlock(), createElementBlock("div", {