@fkui/vue 5.42.0 → 5.43.0
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/cjs/index.cjs.js +41 -10
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/esm/index.esm.js +41 -10
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/types/index.d.ts +101 -0
- package/package.json +2 -2
package/dist/esm/index.esm.js
CHANGED
|
@@ -3810,6 +3810,19 @@ const _sfc_main$1b = defineComponent({
|
|
|
3810
3810
|
validator(value) {
|
|
3811
3811
|
return sizes.includes(value);
|
|
3812
3812
|
}
|
|
3813
|
+
},
|
|
3814
|
+
/**
|
|
3815
|
+
* Default behavior is that the modal will restore focus to previous element once closed.
|
|
3816
|
+
* - "on" (default) - component will set focus both when opened and closed
|
|
3817
|
+
* - "off" - focus strategy disabled
|
|
3818
|
+
* - "open" - focus will only be applied once modal is opened
|
|
3819
|
+
*/
|
|
3820
|
+
focus: {
|
|
3821
|
+
type: String,
|
|
3822
|
+
default: "on",
|
|
3823
|
+
validator(value) {
|
|
3824
|
+
return ["on", "off", "open"].includes(value);
|
|
3825
|
+
}
|
|
3813
3826
|
}
|
|
3814
3827
|
},
|
|
3815
3828
|
emits: ["close"],
|
|
@@ -3862,8 +3875,12 @@ const _sfc_main$1b = defineComponent({
|
|
|
3862
3875
|
root.style.top = `-${scroll}px`;
|
|
3863
3876
|
root.classList.add("modal__open");
|
|
3864
3877
|
const focusElement2 = this.resolveFocusElement();
|
|
3865
|
-
this.
|
|
3866
|
-
|
|
3878
|
+
if (this.focus === "on") {
|
|
3879
|
+
this.savedFocus = pushFocus(focusElement2);
|
|
3880
|
+
this.savedScroll = scroll;
|
|
3881
|
+
} else if (this.focus === "open") {
|
|
3882
|
+
focus$1(focusElement2);
|
|
3883
|
+
}
|
|
3867
3884
|
},
|
|
3868
3885
|
/**
|
|
3869
3886
|
* Prioritises what element to initially focus on in the following order:
|
|
@@ -3883,15 +3900,15 @@ const _sfc_main$1b = defineComponent({
|
|
|
3883
3900
|
return firstTabbableChildElement !== null && firstTabbableChildElement !== void 0 ? firstTabbableChildElement : contentElement;
|
|
3884
3901
|
},
|
|
3885
3902
|
restoreState() {
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3903
|
+
var _this$savedScroll;
|
|
3904
|
+
const root = document.documentElement;
|
|
3905
|
+
root.classList.remove("modal__open");
|
|
3906
|
+
root.style.removeProperty("top");
|
|
3907
|
+
root.scrollTop = (_this$savedScroll = this.savedScroll) !== null && _this$savedScroll !== void 0 ? _this$savedScroll : 0;
|
|
3908
|
+
this.savedScroll = null;
|
|
3909
|
+
if (this.focus === "on" && this.savedFocus) {
|
|
3892
3910
|
popFocus(this.savedFocus);
|
|
3893
3911
|
this.savedFocus = null;
|
|
3894
|
-
this.savedScroll = null;
|
|
3895
3912
|
}
|
|
3896
3913
|
},
|
|
3897
3914
|
onFocusFirst() {
|
|
@@ -4065,6 +4082,19 @@ const _sfc_main$1a = defineComponent({
|
|
|
4065
4082
|
default: () => {
|
|
4066
4083
|
return defaultButtons;
|
|
4067
4084
|
}
|
|
4085
|
+
},
|
|
4086
|
+
/**
|
|
4087
|
+
* Default behavior is that the modal will restore focus to previous element once closed.
|
|
4088
|
+
* - "on" (default) - component will set focus both when opened and closed
|
|
4089
|
+
* - "off" - focus strategy disabled
|
|
4090
|
+
* - "open" - focus will only be applied once modal is opened
|
|
4091
|
+
*/
|
|
4092
|
+
focus: {
|
|
4093
|
+
type: String,
|
|
4094
|
+
default: "on",
|
|
4095
|
+
validator(value) {
|
|
4096
|
+
return ["on", "off", "open"].includes(value);
|
|
4097
|
+
}
|
|
4068
4098
|
}
|
|
4069
4099
|
},
|
|
4070
4100
|
emits: ["close", ...defaultButtons.map((it) => {
|
|
@@ -4106,6 +4136,7 @@ function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4106
4136
|
"aria-close-text": _ctx.ariaCloseText,
|
|
4107
4137
|
type: "warning",
|
|
4108
4138
|
size: _ctx.size,
|
|
4139
|
+
focus: _ctx.focus,
|
|
4109
4140
|
onClose: _ctx.onClose
|
|
4110
4141
|
}, {
|
|
4111
4142
|
header: withCtx(() => [renderSlot(_ctx.$slots, "heading", {}, () => [createTextVNode(toDisplayString(_ctx.heading), 1)])]),
|
|
@@ -4119,7 +4150,7 @@ function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4119
4150
|
}, [createElementVNode("span", null, toDisplayString(button.label), 1), _cache[0] || (_cache[0] = createTextVNode()), button.screenreader ? (openBlock(), createElementBlock("span", _hoisted_3$v, " " + toDisplayString(button.screenreader), 1)) : createCommentVNode("", true)], 10, _hoisted_2$D);
|
|
4120
4151
|
}), 128))])]),
|
|
4121
4152
|
_: 3
|
|
4122
|
-
}, 8, ["fullscreen", "is-open", "aria-close-text", "size", "onClose"]);
|
|
4153
|
+
}, 8, ["fullscreen", "is-open", "aria-close-text", "size", "focus", "onClose"]);
|
|
4123
4154
|
}
|
|
4124
4155
|
const FConfirmModal = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$_]]);
|
|
4125
4156
|
const GAP = ["1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x"];
|