fds-vue-core 4.4.1 → 4.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/fds-vue-core.cjs.js +88 -38
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.css +1 -1
- package/dist/fds-vue-core.es.js +88 -38
- package/dist/fds-vue-core.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Buttons/ButtonBaseProps.ts +1 -0
- package/src/components/Buttons/FdsButtonMinor/FdsButtonMinor.vue +2 -1
- package/src/components/Buttons/FdsButtonPrimary/FdsButtonPrimary.vue +2 -1
- package/src/components/Buttons/FdsButtonSecondary/FdsButtonSecondary.vue +2 -1
- package/src/components/FdsModal/FdsModal.vue +31 -23
- package/src/components/Form/FdsInput/FdsInput.vue +3 -1
- package/src/composables/useModalDragResize.ts +42 -0
package/dist/fds-vue-core.cjs.js
CHANGED
|
@@ -1332,6 +1332,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
1332
1332
|
state: { default: void 0 },
|
|
1333
1333
|
icon: { default: void 0 },
|
|
1334
1334
|
iconPos: { default: "left" },
|
|
1335
|
+
iconSize: { default: 24 },
|
|
1335
1336
|
size: {},
|
|
1336
1337
|
textSelection: { type: Boolean, default: false },
|
|
1337
1338
|
as: { default: "button" },
|
|
@@ -1410,8 +1411,8 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
1410
1411
|
vue.createVNode(_sfc_main$D, {
|
|
1411
1412
|
class: vue.normalizeClass(iconFillClass2.value),
|
|
1412
1413
|
name: __props.icon,
|
|
1413
|
-
size:
|
|
1414
|
-
}, null, 8, ["class", "name"])
|
|
1414
|
+
size: __props.iconSize
|
|
1415
|
+
}, null, 8, ["class", "name", "size"])
|
|
1415
1416
|
], 2)) : vue.createCommentVNode("", true),
|
|
1416
1417
|
vue.createElementVNode("span", _hoisted_2$f, vue.toDisplayString(__props.text), 1)
|
|
1417
1418
|
]),
|
|
@@ -4256,6 +4257,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
4256
4257
|
state: { default: void 0 },
|
|
4257
4258
|
icon: { default: void 0 },
|
|
4258
4259
|
iconPos: { default: "left" },
|
|
4260
|
+
iconSize: { default: 24 },
|
|
4259
4261
|
size: { default: "md" },
|
|
4260
4262
|
textSelection: { type: Boolean, default: false },
|
|
4261
4263
|
as: { default: "button" },
|
|
@@ -4333,8 +4335,8 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
|
4333
4335
|
vue.createVNode(_sfc_main$D, {
|
|
4334
4336
|
class: vue.normalizeClass(iconFillClass$1),
|
|
4335
4337
|
name: __props.icon,
|
|
4336
|
-
size:
|
|
4337
|
-
}, null, 8, ["name"])
|
|
4338
|
+
size: __props.iconSize
|
|
4339
|
+
}, null, 8, ["name", "size"])
|
|
4338
4340
|
], 2)) : vue.createCommentVNode("", true),
|
|
4339
4341
|
__props.text ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$e, vue.toDisplayString(__props.text), 1)) : vue.createCommentVNode("", true)
|
|
4340
4342
|
]),
|
|
@@ -4362,6 +4364,7 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
|
4362
4364
|
state: { default: void 0 },
|
|
4363
4365
|
icon: { default: void 0 },
|
|
4364
4366
|
iconPos: { default: "left" },
|
|
4367
|
+
iconSize: { default: 24 },
|
|
4365
4368
|
size: { default: "md" },
|
|
4366
4369
|
textSelection: { type: Boolean, default: false },
|
|
4367
4370
|
as: { default: "button" },
|
|
@@ -4440,8 +4443,8 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
|
4440
4443
|
vue.createVNode(_sfc_main$D, {
|
|
4441
4444
|
class: vue.normalizeClass(iconFillClass),
|
|
4442
4445
|
name: __props.icon,
|
|
4443
|
-
size:
|
|
4444
|
-
}, null, 8, ["name"])
|
|
4446
|
+
size: __props.iconSize
|
|
4447
|
+
}, null, 8, ["name", "size"])
|
|
4445
4448
|
], 2)) : vue.createCommentVNode("", true),
|
|
4446
4449
|
__props.text ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$d, vue.toDisplayString(__props.text), 1)) : vue.createCommentVNode("", true)
|
|
4447
4450
|
]),
|
|
@@ -4580,6 +4583,7 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
|
4580
4583
|
});
|
|
4581
4584
|
const MIN_WIDTH = 288;
|
|
4582
4585
|
const MIN_HEIGHT = 200;
|
|
4586
|
+
const getStorageKey = (key) => `fds-modal-${key}`;
|
|
4583
4587
|
function useModalDragResize(options) {
|
|
4584
4588
|
const isDragging = vue.ref(false);
|
|
4585
4589
|
const isResizing = vue.ref(false);
|
|
@@ -4592,6 +4596,36 @@ function useModalDragResize(options) {
|
|
|
4592
4596
|
const resizeStart = vue.ref({ x: 0, y: 0, width: 0, height: 0, left: 0, top: 0 });
|
|
4593
4597
|
const lastInteractionEnd = vue.ref(0);
|
|
4594
4598
|
const isCustomPositioned = vue.computed(() => hasBeenDragged.value || hasBeenResized.value);
|
|
4599
|
+
const canPersist = () => (options.movable.value || options.resizable.value) && !!options.heading.value && typeof window !== "undefined";
|
|
4600
|
+
const save = () => {
|
|
4601
|
+
if (!canPersist()) return;
|
|
4602
|
+
const data = {};
|
|
4603
|
+
if (modalPosition.value) data.position = modalPosition.value;
|
|
4604
|
+
if (modalSize.value) data.size = modalSize.value;
|
|
4605
|
+
try {
|
|
4606
|
+
window.localStorage.setItem(getStorageKey(options.heading.value), JSON.stringify(data));
|
|
4607
|
+
} catch {
|
|
4608
|
+
}
|
|
4609
|
+
};
|
|
4610
|
+
const restore = () => {
|
|
4611
|
+
if (!canPersist()) return false;
|
|
4612
|
+
try {
|
|
4613
|
+
const raw = window.localStorage.getItem(getStorageKey(options.heading.value));
|
|
4614
|
+
if (!raw) return false;
|
|
4615
|
+
const data = JSON.parse(raw);
|
|
4616
|
+
if (data.position) {
|
|
4617
|
+
modalPosition.value = data.position;
|
|
4618
|
+
hasBeenDragged.value = true;
|
|
4619
|
+
}
|
|
4620
|
+
if (data.size) {
|
|
4621
|
+
modalSize.value = data.size;
|
|
4622
|
+
hasBeenResized.value = true;
|
|
4623
|
+
}
|
|
4624
|
+
return true;
|
|
4625
|
+
} catch {
|
|
4626
|
+
return false;
|
|
4627
|
+
}
|
|
4628
|
+
};
|
|
4595
4629
|
const style = vue.computed(() => {
|
|
4596
4630
|
if (!isCustomPositioned.value) return void 0;
|
|
4597
4631
|
const s = {};
|
|
@@ -4647,6 +4681,7 @@ function useModalDragResize(options) {
|
|
|
4647
4681
|
document.removeEventListener("selectstart", preventSelection);
|
|
4648
4682
|
document.removeEventListener("mousemove", onDragMove);
|
|
4649
4683
|
document.removeEventListener("mouseup", onDragEnd);
|
|
4684
|
+
save();
|
|
4650
4685
|
};
|
|
4651
4686
|
const onResizeStart = (e, direction) => {
|
|
4652
4687
|
if (!options.resizable.value) return;
|
|
@@ -4700,6 +4735,7 @@ function useModalDragResize(options) {
|
|
|
4700
4735
|
document.removeEventListener("selectstart", preventSelection);
|
|
4701
4736
|
document.removeEventListener("mousemove", onResizeMove);
|
|
4702
4737
|
document.removeEventListener("mouseup", onResizeEnd);
|
|
4738
|
+
save();
|
|
4703
4739
|
};
|
|
4704
4740
|
const reset = () => {
|
|
4705
4741
|
hasBeenDragged.value = false;
|
|
@@ -4723,6 +4759,7 @@ function useModalDragResize(options) {
|
|
|
4723
4759
|
onDragStart,
|
|
4724
4760
|
onResizeStart,
|
|
4725
4761
|
reset,
|
|
4762
|
+
restore,
|
|
4726
4763
|
cleanup,
|
|
4727
4764
|
shouldBlockBackdropClick
|
|
4728
4765
|
};
|
|
@@ -4762,17 +4799,20 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
|
4762
4799
|
onDragStart,
|
|
4763
4800
|
onResizeStart,
|
|
4764
4801
|
reset: resetDragResize,
|
|
4802
|
+
restore: restoreDragResize,
|
|
4765
4803
|
cleanup: cleanupDragResize,
|
|
4766
4804
|
shouldBlockBackdropClick
|
|
4767
4805
|
} = useModalDragResize({
|
|
4768
4806
|
movable: vue.computed(() => props.movable),
|
|
4769
4807
|
resizable: vue.computed(() => props.resizable),
|
|
4770
|
-
elementRef: modalInnerRef
|
|
4808
|
+
elementRef: modalInnerRef,
|
|
4809
|
+
heading: vue.computed(() => props.heading)
|
|
4771
4810
|
});
|
|
4772
4811
|
const modalOuterClasses = vue.computed(() => ["fixed top-0 left-0 w-full h-full overflow-auto z-100"]);
|
|
4773
4812
|
const modalInnerClasses = vue.computed(() => {
|
|
4774
4813
|
const base = [
|
|
4775
|
-
"bg-white rounded-lg
|
|
4814
|
+
"bg-white rounded-lg z-[99999] shadow-lg px-6 pt-6.5",
|
|
4815
|
+
props.resizable ? "overflow-hidden flex flex-col" : "overflow-auto",
|
|
4776
4816
|
props.stickyFooter ? "pb-0" : "pb-8"
|
|
4777
4817
|
];
|
|
4778
4818
|
if (isCustomPositioned.value) {
|
|
@@ -4885,6 +4925,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
|
4885
4925
|
isOpen.value = newValue;
|
|
4886
4926
|
if (newValue) {
|
|
4887
4927
|
previouslyFocusedElement.value = document.activeElement;
|
|
4928
|
+
restoreDragResize();
|
|
4888
4929
|
if (props.lockScroll) {
|
|
4889
4930
|
setHtmlOverflow("hidden");
|
|
4890
4931
|
}
|
|
@@ -4909,6 +4950,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
|
4909
4950
|
document.addEventListener("keydown", handleKeyDown, true);
|
|
4910
4951
|
if (props.open) {
|
|
4911
4952
|
previouslyFocusedElement.value = document.activeElement;
|
|
4953
|
+
restoreDragResize();
|
|
4912
4954
|
if (props.lockScroll) {
|
|
4913
4955
|
setHtmlOverflow("hidden");
|
|
4914
4956
|
}
|
|
@@ -4951,36 +4993,40 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
|
4951
4993
|
onMousedown: _cache[10] || (_cache[10] = //@ts-ignore
|
|
4952
4994
|
(...args) => vue.unref(onDragStart) && vue.unref(onDragStart)(...args))
|
|
4953
4995
|
}), [
|
|
4954
|
-
vue.createElementVNode("div",
|
|
4955
|
-
vue.
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4996
|
+
vue.createElementVNode("div", {
|
|
4997
|
+
class: vue.normalizeClass(__props.resizable ? "overflow-auto flex-1 min-h-0" : "")
|
|
4998
|
+
}, [
|
|
4999
|
+
vue.createElementVNode("div", _hoisted_1$d, [
|
|
5000
|
+
vue.createElementVNode("h3", {
|
|
5001
|
+
tabindex: "-1",
|
|
5002
|
+
class: vue.normalizeClass(headerTitleClasses.value)
|
|
5003
|
+
}, [
|
|
5004
|
+
iconName.value ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
|
|
5005
|
+
key: 0,
|
|
5006
|
+
name: iconName.value,
|
|
5007
|
+
size: 24,
|
|
5008
|
+
class: vue.normalizeClass(iconClasses.value)
|
|
5009
|
+
}, null, 8, ["name", "class"])) : vue.createCommentVNode("", true),
|
|
5010
|
+
vue.createTextVNode(" " + vue.toDisplayString(__props.heading), 1)
|
|
5011
|
+
], 2),
|
|
5012
|
+
!__props.strict ? (vue.openBlock(), vue.createBlock(_sfc_main$C, vue.mergeProps({
|
|
4960
5013
|
key: 0,
|
|
4961
|
-
|
|
4962
|
-
size:
|
|
4963
|
-
|
|
4964
|
-
},
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5014
|
+
icon: "cross",
|
|
5015
|
+
size: 28,
|
|
5016
|
+
onClick: _cache[0] || (_cache[0] = ($event) => handleClose())
|
|
5017
|
+
}, { "aria-label": closeLabel.value }, { class: "ml-4" }), null, 16)) : vue.createCommentVNode("", true)
|
|
5018
|
+
]),
|
|
5019
|
+
vue.createElementVNode("div", _hoisted_2$c, [
|
|
5020
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
5021
|
+
]),
|
|
5022
|
+
vue.unref(hasFooterSlot) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4968
5023
|
key: 0,
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
]),
|
|
4974
|
-
vue.
|
|
4975
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
4976
|
-
]),
|
|
4977
|
-
vue.unref(hasFooterSlot) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4978
|
-
key: 0,
|
|
4979
|
-
class: vue.normalizeClass(footerClasses.value)
|
|
4980
|
-
}, [
|
|
4981
|
-
vue.renderSlot(_ctx.$slots, "modal-footer")
|
|
4982
|
-
], 2)) : vue.createCommentVNode("", true),
|
|
4983
|
-
__props.resizable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
5024
|
+
class: vue.normalizeClass(footerClasses.value)
|
|
5025
|
+
}, [
|
|
5026
|
+
vue.renderSlot(_ctx.$slots, "modal-footer")
|
|
5027
|
+
], 2)) : vue.createCommentVNode("", true)
|
|
5028
|
+
], 2),
|
|
5029
|
+
__props.resizable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
4984
5030
|
vue.createElementVNode("div", {
|
|
4985
5031
|
class: "absolute top-0 left-3 right-3 h-1.5 cursor-n-resize z-100000",
|
|
4986
5032
|
onMousedown: _cache[1] || (_cache[1] = ($event) => vue.unref(onResizeStart)($event, "n"))
|
|
@@ -8362,7 +8408,8 @@ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
|
8362
8408
|
return {};
|
|
8363
8409
|
});
|
|
8364
8410
|
const rightIconsContainerClasses = vue.computed(() => [
|
|
8365
|
-
"absolute flex gap-2
|
|
8411
|
+
"absolute flex gap-2 top-1/2 -translate-y-1/2 items-center justify-end",
|
|
8412
|
+
showClearButton.value ? "right-2" : "right-3"
|
|
8366
8413
|
]);
|
|
8367
8414
|
const internalValue = vue.computed({
|
|
8368
8415
|
get: () => modelValue.value !== void 0 ? modelValue.value : props.value ?? "",
|
|
@@ -8526,7 +8573,10 @@ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
|
8526
8573
|
showClearButton.value ? (vue.openBlock(), vue.createBlock(_sfc_main$C, vue.mergeProps({
|
|
8527
8574
|
key: 3,
|
|
8528
8575
|
icon: "cross"
|
|
8529
|
-
}, { "aria-label": clearButtonLabel.value }, {
|
|
8576
|
+
}, { "aria-label": clearButtonLabel.value }, {
|
|
8577
|
+
onClick: onClear,
|
|
8578
|
+
size: 30
|
|
8579
|
+
}), null, 16)) : vue.createCommentVNode("", true),
|
|
8530
8580
|
showPasswordToggle.value ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
|
|
8531
8581
|
key: 4,
|
|
8532
8582
|
icon: showPassword.value ? "viewOff" : "viewOn",
|