@wisemen/vue-core-design-system 0.1.1 → 0.1.2
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.js +40 -40
- package/dist/index.umd +10 -10
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -38,9 +38,9 @@ const kbdKeysMap = {
|
|
|
38
38
|
win: "⊞",
|
|
39
39
|
meta: ""
|
|
40
40
|
};
|
|
41
|
-
var IS_MACOS = isMacos();
|
|
41
|
+
var MACINTOSH_REGEX = /Macintosh;/, IS_MACOS = isMacos();
|
|
42
42
|
function isMacos() {
|
|
43
|
-
return typeof navigator > "u" || typeof navigator.userAgent != "string" ? !1 :
|
|
43
|
+
return typeof navigator > "u" || typeof navigator.userAgent != "string" ? !1 : MACINTOSH_REGEX.test(navigator.userAgent);
|
|
44
44
|
}
|
|
45
45
|
const useKbd = createSharedComposable(() => {
|
|
46
46
|
let r = reactive({
|
|
@@ -8656,33 +8656,33 @@ var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
|
8656
8656
|
}),
|
|
8657
8657
|
emits: /* @__PURE__ */ mergeModels(["blur"], ["update:modelValue"]),
|
|
8658
8658
|
setup(r, { emit: a }) {
|
|
8659
|
-
let o = r, s = a, c = useModel(r, "modelValue"),
|
|
8660
|
-
watch(() =>
|
|
8661
|
-
|
|
8659
|
+
let o = r, s = a, c = /[\s.,`]/g, f = /[\s.,`](?=\d+$)/, p = useModel(r, "modelValue"), m = computed(() => createNumberFieldStyle({ showControls: o.showControls })), g = ref(p.value), v = ref(!1);
|
|
8660
|
+
watch(() => p.value, (r) => {
|
|
8661
|
+
v.value || (g.value = r);
|
|
8662
8662
|
});
|
|
8663
|
-
let
|
|
8664
|
-
function
|
|
8665
|
-
let o = new Intl.NumberFormat(a).format(12345.6), s = o.match(
|
|
8666
|
-
return s && (
|
|
8663
|
+
let y = useAttrs(), b = useI18n(), x = o.id ?? useId(), { isError: S, ariaBusy: C, ariaDescribedBy: w, ariaInvalid: T } = useInput(x, o), E = navigator.language;
|
|
8664
|
+
function A(r, a) {
|
|
8665
|
+
let o = new Intl.NumberFormat(a).format(12345.6), s = o.match(c)?.[0], l = o.match(f)?.[0], u = r;
|
|
8666
|
+
return s && (u = u.replaceAll(s, "")), l && (u = u.replace(l, ".")), Number(u);
|
|
8667
8667
|
}
|
|
8668
|
-
function
|
|
8669
|
-
|
|
8668
|
+
function j(r) {
|
|
8669
|
+
v.value = !0;
|
|
8670
8670
|
let a = r.target.value;
|
|
8671
8671
|
if (a === "") {
|
|
8672
|
-
|
|
8672
|
+
p.value = null;
|
|
8673
8673
|
return;
|
|
8674
8674
|
}
|
|
8675
|
-
let o =
|
|
8676
|
-
Number.isNaN(o) || (
|
|
8675
|
+
let o = A(a, E);
|
|
8676
|
+
Number.isNaN(o) || (p.value = o);
|
|
8677
8677
|
}
|
|
8678
|
-
function
|
|
8679
|
-
|
|
8678
|
+
function M() {
|
|
8679
|
+
v.value = !1;
|
|
8680
8680
|
}
|
|
8681
|
-
function
|
|
8682
|
-
|
|
8681
|
+
function N(r) {
|
|
8682
|
+
v.value = !1, s("blur", r);
|
|
8683
8683
|
}
|
|
8684
|
-
return watch(
|
|
8685
|
-
|
|
8684
|
+
return watch(g, () => {
|
|
8685
|
+
p.value = g.value ?? null;
|
|
8686
8686
|
}), (r, a) => (openBlock(), createBlock(InputWrapper_default, {
|
|
8687
8687
|
"error-message": o.errorMessage,
|
|
8688
8688
|
"is-disabled": o.isDisabled,
|
|
@@ -8691,15 +8691,15 @@ var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
|
8691
8691
|
label: o.label,
|
|
8692
8692
|
class: normalizeClass(o.class),
|
|
8693
8693
|
style: normalizeStyle(o.style),
|
|
8694
|
-
for: unref(
|
|
8694
|
+
for: unref(x),
|
|
8695
8695
|
"hide-error-message": o.hideErrorMessage
|
|
8696
8696
|
}, {
|
|
8697
8697
|
"label-left": withCtx(() => [renderSlot(r.$slots, "label-left")]),
|
|
8698
8698
|
"label-right": withCtx(() => [renderSlot(r.$slots, "label-right")]),
|
|
8699
|
-
default: withCtx(() => [createVNode(unref(NumberFieldRoot), mergeProps(unref(
|
|
8700
|
-
id: unref(
|
|
8701
|
-
modelValue:
|
|
8702
|
-
"onUpdate:modelValue": a[1] ||= (r) =>
|
|
8699
|
+
default: withCtx(() => [createVNode(unref(NumberFieldRoot), mergeProps(unref(y), {
|
|
8700
|
+
id: unref(x),
|
|
8701
|
+
modelValue: g.value,
|
|
8702
|
+
"onUpdate:modelValue": a[1] ||= (r) => g.value = r,
|
|
8703
8703
|
readonly: o.isReadonly,
|
|
8704
8704
|
required: o.isRequired,
|
|
8705
8705
|
"disable-wheel-change": !0,
|
|
@@ -8708,7 +8708,7 @@ var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
|
8708
8708
|
step: o.step,
|
|
8709
8709
|
"step-snapping": !0,
|
|
8710
8710
|
"as-child": !1,
|
|
8711
|
-
locale: unref(
|
|
8711
|
+
locale: unref(E),
|
|
8712
8712
|
name: o.name ?? void 0,
|
|
8713
8713
|
max: o.max ?? void 0,
|
|
8714
8714
|
min: o.min ?? void 0
|
|
@@ -8717,21 +8717,21 @@ var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
|
8717
8717
|
"icon-left": o.iconLeft,
|
|
8718
8718
|
"icon-right": o.iconRight,
|
|
8719
8719
|
"is-loading": o.isLoading,
|
|
8720
|
-
"is-error": unref(
|
|
8720
|
+
"is-error": unref(S),
|
|
8721
8721
|
"is-disabled": o.isDisabled,
|
|
8722
8722
|
"is-readonly": o.isReadonly
|
|
8723
8723
|
}, {
|
|
8724
8724
|
left: withCtx(() => [renderSlot(r.$slots, "left", {}, () => [o.showControls ? (openBlock(), createBlock(unref(RowLayout_default), {
|
|
8725
8725
|
key: 0,
|
|
8726
|
-
class: normalizeClass(
|
|
8726
|
+
class: normalizeClass(m.value.leftControl()),
|
|
8727
8727
|
align: "center"
|
|
8728
8728
|
}, {
|
|
8729
8729
|
default: withCtx(() => [createVNode(unref(NumberFieldDecrement), { "as-child": !0 }, {
|
|
8730
8730
|
default: withCtx(() => [createVNode(IconButton_default, {
|
|
8731
8731
|
"is-tooltip-disabled": !0,
|
|
8732
|
-
"is-disabled": o.isDisabled || o.isReadonly || o.min ===
|
|
8732
|
+
"is-disabled": o.isDisabled || o.isReadonly || o.min === g.value,
|
|
8733
8733
|
icon: unref(MinusIcon_default),
|
|
8734
|
-
label: unref(
|
|
8734
|
+
label: unref(b).t("component.number_field.decrement"),
|
|
8735
8735
|
variant: "tertiary",
|
|
8736
8736
|
size: "xs"
|
|
8737
8737
|
}, null, 8, [
|
|
@@ -8745,15 +8745,15 @@ var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
|
8745
8745
|
}, 8, ["class"])) : createCommentVNode("", !0)])]),
|
|
8746
8746
|
right: withCtx(() => [renderSlot(r.$slots, "right", {}, () => [o.showControls ? (openBlock(), createBlock(unref(RowLayout_default), {
|
|
8747
8747
|
key: 0,
|
|
8748
|
-
class: normalizeClass(
|
|
8748
|
+
class: normalizeClass(m.value.rightControl()),
|
|
8749
8749
|
align: "center"
|
|
8750
8750
|
}, {
|
|
8751
8751
|
default: withCtx(() => [createVNode(unref(NumberFieldIncrement), { "as-child": !0 }, {
|
|
8752
8752
|
default: withCtx(() => [createVNode(IconButton_default, {
|
|
8753
8753
|
"is-tooltip-disabled": !0,
|
|
8754
|
-
"is-disabled": o.isDisabled || o.isReadonly || o.max ===
|
|
8754
|
+
"is-disabled": o.isDisabled || o.isReadonly || o.max === g.value,
|
|
8755
8755
|
icon: unref(PlusIcon_default),
|
|
8756
|
-
label: unref(
|
|
8756
|
+
label: unref(b).t("component.number_field.increment"),
|
|
8757
8757
|
variant: "tertiary",
|
|
8758
8758
|
size: "xs"
|
|
8759
8759
|
}, null, 8, [
|
|
@@ -8766,18 +8766,18 @@ var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
|
8766
8766
|
_: 1
|
|
8767
8767
|
}, 8, ["class"])) : createCommentVNode("", !0)])]),
|
|
8768
8768
|
default: withCtx(() => [createVNode(unref(NumberFieldInput), {
|
|
8769
|
-
"aria-describedby": unref(
|
|
8769
|
+
"aria-describedby": unref(w),
|
|
8770
8770
|
"aria-required": o.isRequired,
|
|
8771
8771
|
autocomplete: o.autocomplete ?? void 0,
|
|
8772
|
-
"aria-busy": unref(
|
|
8773
|
-
"aria-invalid": unref(
|
|
8772
|
+
"aria-busy": unref(C),
|
|
8773
|
+
"aria-invalid": unref(T),
|
|
8774
8774
|
placeholder: o.placeholder ?? void 0,
|
|
8775
|
-
class: normalizeClass(
|
|
8775
|
+
class: normalizeClass(m.value.input()),
|
|
8776
8776
|
"data-field-wrapper": "",
|
|
8777
|
-
onInput:
|
|
8778
|
-
onKeydown: withKeys(
|
|
8777
|
+
onInput: j,
|
|
8778
|
+
onKeydown: withKeys(M, ["enter"]),
|
|
8779
8779
|
onFocus: a[0] ||= withModifiers(() => {}, ["prevent"]),
|
|
8780
|
-
onBlur:
|
|
8780
|
+
onBlur: N
|
|
8781
8781
|
}, null, 8, [
|
|
8782
8782
|
"aria-describedby",
|
|
8783
8783
|
"aria-required",
|