@mekari/pixel3-input 0.0.12-dev.2 → 0.0.13-dev.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/{chunk-4WGVPYCM.mjs → chunk-4V5BHCMQ.mjs} +1 -1
- package/dist/chunk-ER4XPXI3.mjs +49 -0
- package/dist/chunk-NSHBFXM4.mjs +97 -0
- package/dist/{chunk-L2WJRDG4.mjs → chunk-QIQPVEGA.mjs} +1 -1
- package/dist/{chunk-G6HMNOLC.mjs → chunk-SCN2G4G4.mjs} +1 -0
- package/dist/index.js +53 -50
- package/dist/index.mjs +5 -5
- package/dist/input-addon.d.mts +2 -2
- package/dist/input-addon.d.ts +2 -2
- package/dist/input-addon.js +38 -0
- package/dist/input-addon.mjs +3 -3
- package/dist/input-group.mjs +3 -3
- package/dist/input.js +15 -50
- package/dist/input.mjs +3 -3
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/input.connects.js +1 -0
- package/dist/modules/input.connects.mjs +1 -1
- package/dist/modules/input.hooks.js +1 -0
- package/dist/modules/input.hooks.mjs +2 -2
- package/dist/modules/input.types.d.mts +1 -8
- package/dist/modules/input.types.d.ts +1 -8
- package/package.json +4 -4
- package/dist/chunk-575ZYGOA.mjs +0 -85
- package/dist/chunk-P44SXIBM.mjs +0 -59
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useInput
|
|
3
|
+
} from "./chunk-4V5BHCMQ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
inputEmits,
|
|
6
|
+
inputProps
|
|
7
|
+
} from "./chunk-ZQ2NFCFA.mjs";
|
|
8
|
+
|
|
9
|
+
// src/input.tsx
|
|
10
|
+
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
|
11
|
+
import { defineComponent, getCurrentInstance, onMounted } from "vue";
|
|
12
|
+
import { useFormControlContext } from "@mekari/pixel3-form-control";
|
|
13
|
+
import { MpButton } from "@mekari/pixel3-button";
|
|
14
|
+
var MpInput = defineComponent({
|
|
15
|
+
name: "MpInput",
|
|
16
|
+
props: inputProps,
|
|
17
|
+
emits: inputEmits,
|
|
18
|
+
inheritAttrs: false,
|
|
19
|
+
setup(props, {
|
|
20
|
+
emit,
|
|
21
|
+
attrs
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
as: Component
|
|
25
|
+
} = props;
|
|
26
|
+
const formControlProp = useFormControlContext();
|
|
27
|
+
const api = useInput(props, emit, formControlProp);
|
|
28
|
+
const instance = getCurrentInstance();
|
|
29
|
+
if (!instance) {
|
|
30
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
onMounted(() => {
|
|
34
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
35
|
+
const childNode = instance;
|
|
36
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
37
|
+
if ("is-clearable" in childNode.vnode.props)
|
|
38
|
+
parentNode.vnode.el.setAttribute("data-with-clearable", "true");
|
|
39
|
+
} else {
|
|
40
|
+
console.warn("[Pixel]: MpInput did not found parent MpInputGroup in the tree.");
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return () => _createVNode("div", api.value.rootProps, [_createVNode(Component, _mergeProps(api.value.controlProps, attrs), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && _createVNode(MpButton, api.value.clearProps, null)]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
MpInput
|
|
49
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useInputAddon
|
|
3
|
+
} from "./chunk-4V5BHCMQ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
inputAddonProps
|
|
6
|
+
} from "./chunk-ZQ2NFCFA.mjs";
|
|
7
|
+
|
|
8
|
+
// src/input-addon.tsx
|
|
9
|
+
import { createVNode as _createVNode } from "vue";
|
|
10
|
+
import { defineComponent, getCurrentInstance, onMounted, ref } from "vue";
|
|
11
|
+
var MpInputAddon = defineComponent({
|
|
12
|
+
name: "MpInputAddon",
|
|
13
|
+
props: inputAddonProps,
|
|
14
|
+
setup(props, {
|
|
15
|
+
slots
|
|
16
|
+
}) {
|
|
17
|
+
const api = useInputAddon(props);
|
|
18
|
+
return () => {
|
|
19
|
+
var _a;
|
|
20
|
+
return _createVNode("div", api.value.rootProps, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var MpInputLeftAddon = defineComponent({
|
|
25
|
+
name: "MpInputLeftAddon",
|
|
26
|
+
setup(_, {
|
|
27
|
+
slots
|
|
28
|
+
}) {
|
|
29
|
+
const instance = getCurrentInstance();
|
|
30
|
+
if (!instance) {
|
|
31
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const offsetValue = ref(0);
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
37
|
+
const childNode = instance;
|
|
38
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
39
|
+
offsetValue.value = parseInt(getComputedStyle(childNode == null ? void 0 : childNode.vnode.el).width, 10);
|
|
40
|
+
parentNode.vnode.el.style.setProperty("--mp-input-offset--left", `${offsetValue.value}px`);
|
|
41
|
+
parentNode.vnode.el.setAttribute("data-with-left-addon", "true");
|
|
42
|
+
if ("has-background" in childNode.attrs)
|
|
43
|
+
parentNode.vnode.el.setAttribute("data-with-left-bg-addon", "true");
|
|
44
|
+
} else {
|
|
45
|
+
console.warn("[Pixel]: MpInputLeftAddon did not found parent MpInputGroup in the tree.");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return () => _createVNode(MpInputAddon, {
|
|
49
|
+
"placement": "left"
|
|
50
|
+
}, {
|
|
51
|
+
default: () => {
|
|
52
|
+
var _a;
|
|
53
|
+
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var MpInputRightAddon = defineComponent({
|
|
59
|
+
name: "MpInputRightAddon",
|
|
60
|
+
setup(_, {
|
|
61
|
+
slots
|
|
62
|
+
}) {
|
|
63
|
+
const instance = getCurrentInstance();
|
|
64
|
+
if (!instance) {
|
|
65
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const offsetValue = ref(0);
|
|
69
|
+
onMounted(() => {
|
|
70
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
71
|
+
const childNode = instance;
|
|
72
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
73
|
+
offsetValue.value = parseInt(getComputedStyle(childNode == null ? void 0 : childNode.vnode.el).width, 10);
|
|
74
|
+
parentNode.vnode.el.style.setProperty("--mp-input-offset--right", `${offsetValue.value}px`);
|
|
75
|
+
parentNode.vnode.el.setAttribute("data-with-right-addon", "true");
|
|
76
|
+
if ("has-background" in childNode.attrs)
|
|
77
|
+
parentNode.vnode.el.setAttribute("data-with-right-bg-addon", "true");
|
|
78
|
+
} else {
|
|
79
|
+
console.warn("[Pixel]: MpInputRightAddon did not found parent MpInputGroup in the tree.");
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return () => _createVNode(MpInputAddon, {
|
|
83
|
+
"placement": "right"
|
|
84
|
+
}, {
|
|
85
|
+
default: () => {
|
|
86
|
+
var _a;
|
|
87
|
+
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
MpInputAddon,
|
|
95
|
+
MpInputLeftAddon,
|
|
96
|
+
MpInputRightAddon
|
|
97
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -138,6 +138,7 @@ function inputConnect(state, emit, classes, formControlProp) {
|
|
|
138
138
|
id: idx,
|
|
139
139
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
140
140
|
"data-is-full-width": isFullWidth,
|
|
141
|
+
"data-with-clearable": isClearable,
|
|
141
142
|
"data-pixel-component": "MpInput"
|
|
142
143
|
},
|
|
143
144
|
controlProps: {
|
|
@@ -256,58 +257,22 @@ var MpInput = (0, import_vue3.defineComponent)({
|
|
|
256
257
|
} = props;
|
|
257
258
|
const formControlProp = (0, import_pixel3_form_control.useFormControlContext)();
|
|
258
259
|
const api = useInput(props, emit, formControlProp);
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
right: 12
|
|
265
|
-
});
|
|
260
|
+
const instance = (0, import_vue3.getCurrentInstance)();
|
|
261
|
+
if (!instance) {
|
|
262
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
266
265
|
(0, import_vue3.onMounted)(() => {
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
isClearable = true;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (((_d = vnode.type) == null ? void 0 : _d.name) === "MpInputLeftAddon") {
|
|
279
|
-
calcSpacing.value.left += 30;
|
|
280
|
-
if (((_e = vnode.props) == null ? void 0 : _e.hasOwnProperty("hasBackground")) || ((_f = vnode.props) == null ? void 0 : _f.hasOwnProperty("has-background")))
|
|
281
|
-
calcSpacing.value.left += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
282
|
-
}
|
|
283
|
-
if (((_g = vnode.type) == null ? void 0 : _g.name) === "MpInputRightAddon") {
|
|
284
|
-
calcSpacing.value.right += 30;
|
|
285
|
-
if (((_h = vnode.props) == null ? void 0 : _h.hasOwnProperty("hasBackground")) || ((_i = vnode.props) == null ? void 0 : _i.hasOwnProperty("has-background"))) {
|
|
286
|
-
calcSpacing.value.right += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
287
|
-
if (isClearable)
|
|
288
|
-
calcPosition.value.right += parseInt(getComputedStyle(vnode.el).width, 10);
|
|
289
|
-
} else {
|
|
290
|
-
if (isClearable)
|
|
291
|
-
calcPosition.value.right += 30;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
});
|
|
266
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
267
|
+
const childNode = instance;
|
|
268
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
269
|
+
if ("is-clearable" in childNode.vnode.props)
|
|
270
|
+
parentNode.vnode.el.setAttribute("data-with-clearable", "true");
|
|
271
|
+
} else {
|
|
272
|
+
console.warn("[Pixel]: MpInput did not found parent MpInputGroup in the tree.");
|
|
273
|
+
}
|
|
295
274
|
});
|
|
296
|
-
return () =>
|
|
297
|
-
var _a, _b;
|
|
298
|
-
return (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(Component, (0, import_vue2.mergeProps)(api.value.controlProps, attrs, {
|
|
299
|
-
"style": {
|
|
300
|
-
"--mp-input--padding-left": `${calcSpacing.value.left}px`,
|
|
301
|
-
"--mp-input--padding-right": `${calcSpacing.value.right}px`,
|
|
302
|
-
...(_a = api.value.controlProps) == null ? void 0 : _a.style
|
|
303
|
-
}
|
|
304
|
-
}), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && (0, import_vue2.createVNode)(import_pixel3_button.MpButton, (0, import_vue2.mergeProps)(api.value.clearProps, {
|
|
305
|
-
"style": {
|
|
306
|
-
"--mp-input--right": `${calcPosition.value.right}px`,
|
|
307
|
-
...(_b = api.value.clearProps) == null ? void 0 : _b.style
|
|
308
|
-
}
|
|
309
|
-
}), null)]);
|
|
310
|
-
};
|
|
275
|
+
return () => (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(Component, (0, import_vue2.mergeProps)(api.value.controlProps, attrs), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && (0, import_vue2.createVNode)(import_pixel3_button.MpButton, api.value.clearProps, null)]);
|
|
311
276
|
}
|
|
312
277
|
});
|
|
313
278
|
|
|
@@ -354,6 +319,25 @@ var MpInputLeftAddon = (0, import_vue7.defineComponent)({
|
|
|
354
319
|
setup(_, {
|
|
355
320
|
slots
|
|
356
321
|
}) {
|
|
322
|
+
const instance = (0, import_vue7.getCurrentInstance)();
|
|
323
|
+
if (!instance) {
|
|
324
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const offsetValue = (0, import_vue7.ref)(0);
|
|
328
|
+
(0, import_vue7.onMounted)(() => {
|
|
329
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
330
|
+
const childNode = instance;
|
|
331
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
332
|
+
offsetValue.value = parseInt(getComputedStyle(childNode == null ? void 0 : childNode.vnode.el).width, 10);
|
|
333
|
+
parentNode.vnode.el.style.setProperty("--mp-input-offset--left", `${offsetValue.value}px`);
|
|
334
|
+
parentNode.vnode.el.setAttribute("data-with-left-addon", "true");
|
|
335
|
+
if ("has-background" in childNode.attrs)
|
|
336
|
+
parentNode.vnode.el.setAttribute("data-with-left-bg-addon", "true");
|
|
337
|
+
} else {
|
|
338
|
+
console.warn("[Pixel]: MpInputLeftAddon did not found parent MpInputGroup in the tree.");
|
|
339
|
+
}
|
|
340
|
+
});
|
|
357
341
|
return () => (0, import_vue6.createVNode)(MpInputAddon, {
|
|
358
342
|
"placement": "left"
|
|
359
343
|
}, {
|
|
@@ -369,6 +353,25 @@ var MpInputRightAddon = (0, import_vue7.defineComponent)({
|
|
|
369
353
|
setup(_, {
|
|
370
354
|
slots
|
|
371
355
|
}) {
|
|
356
|
+
const instance = (0, import_vue7.getCurrentInstance)();
|
|
357
|
+
if (!instance) {
|
|
358
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const offsetValue = (0, import_vue7.ref)(0);
|
|
362
|
+
(0, import_vue7.onMounted)(() => {
|
|
363
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
364
|
+
const childNode = instance;
|
|
365
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
366
|
+
offsetValue.value = parseInt(getComputedStyle(childNode == null ? void 0 : childNode.vnode.el).width, 10);
|
|
367
|
+
parentNode.vnode.el.style.setProperty("--mp-input-offset--right", `${offsetValue.value}px`);
|
|
368
|
+
parentNode.vnode.el.setAttribute("data-with-right-addon", "true");
|
|
369
|
+
if ("has-background" in childNode.attrs)
|
|
370
|
+
parentNode.vnode.el.setAttribute("data-with-right-bg-addon", "true");
|
|
371
|
+
} else {
|
|
372
|
+
console.warn("[Pixel]: MpInputRightAddon did not found parent MpInputGroup in the tree.");
|
|
373
|
+
}
|
|
374
|
+
});
|
|
372
375
|
return () => (0, import_vue6.createVNode)(MpInputAddon, {
|
|
373
376
|
"placement": "right"
|
|
374
377
|
}, {
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpInputLeftAddon,
|
|
3
3
|
MpInputRightAddon
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NSHBFXM4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
MpInputGroup
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QIQPVEGA.mjs";
|
|
8
8
|
import {
|
|
9
9
|
MpInput
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-ER4XPXI3.mjs";
|
|
11
|
+
import "./chunk-4V5BHCMQ.mjs";
|
|
12
|
+
import "./chunk-SCN2G4G4.mjs";
|
|
13
13
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
14
14
|
import "./chunk-QZ7VFGWC.mjs";
|
|
15
15
|
export {
|
package/dist/input-addon.d.mts
CHANGED
|
@@ -43,7 +43,7 @@ declare const MpInputAddon: vue.DefineComponent<{
|
|
|
43
43
|
placement: InputAddonPlacement | undefined;
|
|
44
44
|
hasBackground: boolean | undefined;
|
|
45
45
|
}, {}>;
|
|
46
|
-
declare const MpInputLeftAddon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
47
|
-
declare const MpInputRightAddon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
46
|
+
declare const MpInputLeftAddon: vue.DefineComponent<{}, (() => vue_jsx_runtime.JSX.Element) | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
47
|
+
declare const MpInputRightAddon: vue.DefineComponent<{}, (() => vue_jsx_runtime.JSX.Element) | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
48
48
|
|
|
49
49
|
export { MpInputAddon, MpInputLeftAddon, MpInputRightAddon };
|
package/dist/input-addon.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ declare const MpInputAddon: vue.DefineComponent<{
|
|
|
43
43
|
placement: InputAddonPlacement | undefined;
|
|
44
44
|
hasBackground: boolean | undefined;
|
|
45
45
|
}, {}>;
|
|
46
|
-
declare const MpInputLeftAddon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
47
|
-
declare const MpInputRightAddon: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
46
|
+
declare const MpInputLeftAddon: vue.DefineComponent<{}, (() => vue_jsx_runtime.JSX.Element) | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
47
|
+
declare const MpInputRightAddon: vue.DefineComponent<{}, (() => vue_jsx_runtime.JSX.Element) | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
48
48
|
|
|
49
49
|
export { MpInputAddon, MpInputLeftAddon, MpInputRightAddon };
|
package/dist/input-addon.js
CHANGED
|
@@ -103,6 +103,25 @@ var MpInputLeftAddon = (0, import_vue3.defineComponent)({
|
|
|
103
103
|
setup(_, {
|
|
104
104
|
slots
|
|
105
105
|
}) {
|
|
106
|
+
const instance = (0, import_vue3.getCurrentInstance)();
|
|
107
|
+
if (!instance) {
|
|
108
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const offsetValue = (0, import_vue3.ref)(0);
|
|
112
|
+
(0, import_vue3.onMounted)(() => {
|
|
113
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
114
|
+
const childNode = instance;
|
|
115
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
116
|
+
offsetValue.value = parseInt(getComputedStyle(childNode == null ? void 0 : childNode.vnode.el).width, 10);
|
|
117
|
+
parentNode.vnode.el.style.setProperty("--mp-input-offset--left", `${offsetValue.value}px`);
|
|
118
|
+
parentNode.vnode.el.setAttribute("data-with-left-addon", "true");
|
|
119
|
+
if ("has-background" in childNode.attrs)
|
|
120
|
+
parentNode.vnode.el.setAttribute("data-with-left-bg-addon", "true");
|
|
121
|
+
} else {
|
|
122
|
+
console.warn("[Pixel]: MpInputLeftAddon did not found parent MpInputGroup in the tree.");
|
|
123
|
+
}
|
|
124
|
+
});
|
|
106
125
|
return () => (0, import_vue2.createVNode)(MpInputAddon, {
|
|
107
126
|
"placement": "left"
|
|
108
127
|
}, {
|
|
@@ -118,6 +137,25 @@ var MpInputRightAddon = (0, import_vue3.defineComponent)({
|
|
|
118
137
|
setup(_, {
|
|
119
138
|
slots
|
|
120
139
|
}) {
|
|
140
|
+
const instance = (0, import_vue3.getCurrentInstance)();
|
|
141
|
+
if (!instance) {
|
|
142
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const offsetValue = (0, import_vue3.ref)(0);
|
|
146
|
+
(0, import_vue3.onMounted)(() => {
|
|
147
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
148
|
+
const childNode = instance;
|
|
149
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
150
|
+
offsetValue.value = parseInt(getComputedStyle(childNode == null ? void 0 : childNode.vnode.el).width, 10);
|
|
151
|
+
parentNode.vnode.el.style.setProperty("--mp-input-offset--right", `${offsetValue.value}px`);
|
|
152
|
+
parentNode.vnode.el.setAttribute("data-with-right-addon", "true");
|
|
153
|
+
if ("has-background" in childNode.attrs)
|
|
154
|
+
parentNode.vnode.el.setAttribute("data-with-right-bg-addon", "true");
|
|
155
|
+
} else {
|
|
156
|
+
console.warn("[Pixel]: MpInputRightAddon did not found parent MpInputGroup in the tree.");
|
|
157
|
+
}
|
|
158
|
+
});
|
|
121
159
|
return () => (0, import_vue2.createVNode)(MpInputAddon, {
|
|
122
160
|
"placement": "right"
|
|
123
161
|
}, {
|
package/dist/input-addon.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
MpInputAddon,
|
|
3
3
|
MpInputLeftAddon,
|
|
4
4
|
MpInputRightAddon
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-NSHBFXM4.mjs";
|
|
6
|
+
import "./chunk-4V5BHCMQ.mjs";
|
|
7
|
+
import "./chunk-SCN2G4G4.mjs";
|
|
8
8
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
9
9
|
import "./chunk-QZ7VFGWC.mjs";
|
|
10
10
|
export {
|
package/dist/input-group.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpInputGroup
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QIQPVEGA.mjs";
|
|
4
|
+
import "./chunk-4V5BHCMQ.mjs";
|
|
5
|
+
import "./chunk-SCN2G4G4.mjs";
|
|
6
6
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
7
7
|
import "./chunk-QZ7VFGWC.mjs";
|
|
8
8
|
export {
|
package/dist/input.js
CHANGED
|
@@ -107,6 +107,7 @@ function inputConnect(state, emit, classes, formControlProp) {
|
|
|
107
107
|
id: idx,
|
|
108
108
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
109
109
|
"data-is-full-width": isFullWidth,
|
|
110
|
+
"data-with-clearable": isClearable,
|
|
110
111
|
"data-pixel-component": "MpInput"
|
|
111
112
|
},
|
|
112
113
|
controlProps: {
|
|
@@ -181,58 +182,22 @@ var MpInput = (0, import_vue3.defineComponent)({
|
|
|
181
182
|
} = props;
|
|
182
183
|
const formControlProp = (0, import_pixel3_form_control.useFormControlContext)();
|
|
183
184
|
const api = useInput(props, emit, formControlProp);
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
right: 12
|
|
190
|
-
});
|
|
185
|
+
const instance = (0, import_vue3.getCurrentInstance)();
|
|
186
|
+
if (!instance) {
|
|
187
|
+
console.warn("[Pixel]: getCurrentInstance() returned null or undefined.");
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
191
190
|
(0, import_vue3.onMounted)(() => {
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
isClearable = true;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (((_d = vnode.type) == null ? void 0 : _d.name) === "MpInputLeftAddon") {
|
|
204
|
-
calcSpacing.value.left += 30;
|
|
205
|
-
if (((_e = vnode.props) == null ? void 0 : _e.hasOwnProperty("hasBackground")) || ((_f = vnode.props) == null ? void 0 : _f.hasOwnProperty("has-background")))
|
|
206
|
-
calcSpacing.value.left += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
207
|
-
}
|
|
208
|
-
if (((_g = vnode.type) == null ? void 0 : _g.name) === "MpInputRightAddon") {
|
|
209
|
-
calcSpacing.value.right += 30;
|
|
210
|
-
if (((_h = vnode.props) == null ? void 0 : _h.hasOwnProperty("hasBackground")) || ((_i = vnode.props) == null ? void 0 : _i.hasOwnProperty("has-background"))) {
|
|
211
|
-
calcSpacing.value.right += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
212
|
-
if (isClearable)
|
|
213
|
-
calcPosition.value.right += parseInt(getComputedStyle(vnode.el).width, 10);
|
|
214
|
-
} else {
|
|
215
|
-
if (isClearable)
|
|
216
|
-
calcPosition.value.right += 30;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
191
|
+
const parentNode = instance == null ? void 0 : instance.parent;
|
|
192
|
+
const childNode = instance;
|
|
193
|
+
if ((parentNode == null ? void 0 : parentNode.type.name) === "MpInputGroup") {
|
|
194
|
+
if ("is-clearable" in childNode.vnode.props)
|
|
195
|
+
parentNode.vnode.el.setAttribute("data-with-clearable", "true");
|
|
196
|
+
} else {
|
|
197
|
+
console.warn("[Pixel]: MpInput did not found parent MpInputGroup in the tree.");
|
|
198
|
+
}
|
|
220
199
|
});
|
|
221
|
-
return () =>
|
|
222
|
-
var _a, _b;
|
|
223
|
-
return (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(Component, (0, import_vue2.mergeProps)(api.value.controlProps, attrs, {
|
|
224
|
-
"style": {
|
|
225
|
-
"--mp-input--padding-left": `${calcSpacing.value.left}px`,
|
|
226
|
-
"--mp-input--padding-right": `${calcSpacing.value.right}px`,
|
|
227
|
-
...(_a = api.value.controlProps) == null ? void 0 : _a.style
|
|
228
|
-
}
|
|
229
|
-
}), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && (0, import_vue2.createVNode)(import_pixel3_button.MpButton, (0, import_vue2.mergeProps)(api.value.clearProps, {
|
|
230
|
-
"style": {
|
|
231
|
-
"--mp-input--right": `${calcPosition.value.right}px`,
|
|
232
|
-
...(_b = api.value.clearProps) == null ? void 0 : _b.style
|
|
233
|
-
}
|
|
234
|
-
}), null)]);
|
|
235
|
-
};
|
|
200
|
+
return () => (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(Component, (0, import_vue2.mergeProps)(api.value.controlProps, attrs), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && (0, import_vue2.createVNode)(import_pixel3_button.MpButton, api.value.clearProps, null)]);
|
|
236
201
|
}
|
|
237
202
|
});
|
|
238
203
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/input.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpInput
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-ER4XPXI3.mjs";
|
|
4
|
+
import "./chunk-4V5BHCMQ.mjs";
|
|
5
|
+
import "./chunk-SCN2G4G4.mjs";
|
|
6
6
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
7
7
|
import "./chunk-QZ7VFGWC.mjs";
|
|
8
8
|
export {
|
package/dist/metafile-cjs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/modules/input.props.ts":{"bytes":2122,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./input.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.connects.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/modules/input.props.ts":{"bytes":2122,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./input.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.connects.ts":{"bytes":3433,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"./input.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.hooks.ts":{"bytes":1465,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/input.connects.ts","kind":"import-statement","original":"./input.connects"},{"path":"./input.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/input.tsx":{"bytes":1923,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/input.props.ts","kind":"import-statement","original":"./modules/input.props"},{"path":"src/modules/input.hooks.ts","kind":"import-statement","original":"./modules/input.hooks"},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./modules/input.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true}],"format":"esm"},"src/input-group.tsx":{"bytes":1000,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"src/modules/input.props.ts","kind":"import-statement","original":"./modules/input.props"},{"path":"src/modules/input.hooks.ts","kind":"import-statement","original":"./modules/input.hooks"}],"format":"esm"},"src/input-addon.tsx":{"bytes":2999,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/input.props.ts","kind":"import-statement","original":"./modules/input.props"},{"path":"src/modules/input.hooks.ts","kind":"import-statement","original":"./modules/input.hooks"}],"format":"esm"},"src/index.ts":{"bytes":472,"imports":[{"path":"src/input.tsx","kind":"import-statement","original":"./input"},{"path":"src/input-group.tsx","kind":"import-statement","original":"./input-group"},{"path":"src/input-addon.tsx","kind":"import-statement","original":"./input-addon"}],"format":"esm"},"src/modules/input.types.ts":{"bytes":1860,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"@mekari/pixel3-form-control","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":245},"src/input.tsx":{"bytesInOutput":1581},"src/modules/input.props.ts":{"bytesInOutput":1153},"src/modules/input.hooks.ts":{"bytesInOutput":1210},"src/modules/input.connects.ts":{"bytesInOutput":3587},"src/input-group.tsx":{"bytesInOutput":825},"src/input-addon.tsx":{"bytesInOutput":3136}},"bytes":13012},"dist/input-addon.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/input-addon.tsx","inputs":{"src/input-addon.tsx":{"bytesInOutput":3379},"src/modules/input.props.ts":{"bytesInOutput":392},"src/modules/input.hooks.ts":{"bytesInOutput":465},"src/modules/input.connects.ts":{"bytesInOutput":573}},"bytes":6020},"dist/input-group.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/input-group.tsx","inputs":{"src/input-group.tsx":{"bytesInOutput":978},"src/modules/input.props.ts":{"bytesInOutput":272},"src/modules/input.hooks.ts":{"bytesInOutput":465},"src/modules/input.connects.ts":{"bytesInOutput":460}},"bytes":3345},"dist/input.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"@mekari/pixel3-form-control","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/input.tsx","inputs":{"src/input.tsx":{"bytesInOutput":1706},"src/modules/input.props.ts":{"bytesInOutput":819},"src/modules/input.hooks.ts":{"bytesInOutput":486},"src/modules/input.connects.ts":{"bytesInOutput":2798}},"bytes":6962},"dist/modules/input.connects.js":{"imports":[{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/input.connects.ts","inputs":{"src/modules/input.connects.ts":{"bytesInOutput":3837}},"bytes":4908},"dist/modules/input.hooks.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/input.hooks.ts","inputs":{"src/modules/input.hooks.ts":{"bytesInOutput":1431},"src/modules/input.connects.ts":{"bytesInOutput":3583}},"bytes":6135},"dist/modules/input.props.js":{"imports":[{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/input.props.ts","inputs":{"src/modules/input.props.ts":{"bytesInOutput":1418}},"bytes":2404},"dist/modules/input.types.js":{"imports":[],"exports":[],"entryPoint":"src/modules/input.types.ts","inputs":{"src/modules/input.types.ts":{"bytesInOutput":82}},"bytes":784}}}
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/modules/input.props.ts":{"bytes":2122,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./input.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.connects.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/modules/input.props.ts":{"bytes":2122,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./input.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.connects.ts":{"bytes":3433,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"./input.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.hooks.ts":{"bytes":1465,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/input.connects.ts","kind":"import-statement","original":"./input.connects"},{"path":"./input.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/input.tsx":{"bytes":1923,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/input.props.ts","kind":"import-statement","original":"./modules/input.props"},{"path":"src/modules/input.hooks.ts","kind":"import-statement","original":"./modules/input.hooks"},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./modules/input.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true}],"format":"esm"},"src/input-group.tsx":{"bytes":1000,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"src/modules/input.props.ts","kind":"import-statement","original":"./modules/input.props"},{"path":"src/modules/input.hooks.ts","kind":"import-statement","original":"./modules/input.hooks"}],"format":"esm"},"src/input-addon.tsx":{"bytes":2999,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/input.props.ts","kind":"import-statement","original":"./modules/input.props"},{"path":"src/modules/input.hooks.ts","kind":"import-statement","original":"./modules/input.hooks"}],"format":"esm"},"src/index.ts":{"bytes":472,"imports":[{"path":"src/input.tsx","kind":"import-statement","original":"./input"},{"path":"src/input-group.tsx","kind":"import-statement","original":"./input-group"},{"path":"src/input-addon.tsx","kind":"import-statement","original":"./input-addon"}],"format":"esm"},"src/modules/input.types.ts":{"bytes":1860,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-NSHBFXM4.mjs","kind":"import-statement"},{"path":"dist/chunk-QIQPVEGA.mjs","kind":"import-statement"},{"path":"dist/chunk-ER4XPXI3.mjs","kind":"import-statement"},{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpInput","MpInputGroup","MpInputLeftAddon","MpInputRightAddon"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":388},"dist/input-addon.mjs":{"imports":[{"path":"dist/chunk-NSHBFXM4.mjs","kind":"import-statement"},{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpInputAddon","MpInputLeftAddon","MpInputRightAddon"],"entryPoint":"src/input-addon.tsx","inputs":{},"bytes":288},"dist/chunk-NSHBFXM4.mjs":{"imports":[{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true}],"exports":["MpInputAddon","MpInputLeftAddon","MpInputRightAddon"],"inputs":{"src/input-addon.tsx":{"bytesInOutput":2993}},"bytes":3200},"dist/input-group.mjs":{"imports":[{"path":"dist/chunk-QIQPVEGA.mjs","kind":"import-statement"},{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpInputGroup"],"entryPoint":"src/input-group.tsx","inputs":{},"bytes":206},"dist/chunk-QIQPVEGA.mjs":{"imports":[{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"exports":["MpInputGroup"],"inputs":{"src/input-group.tsx":{"bytesInOutput":731}},"bytes":897},"dist/input.mjs":{"imports":[{"path":"dist/chunk-ER4XPXI3.mjs","kind":"import-statement"},{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpInput"],"entryPoint":"src/input.tsx","inputs":{},"bytes":196},"dist/chunk-ER4XPXI3.mjs":{"imports":[{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true}],"exports":["MpInput"],"inputs":{"src/input.tsx":{"bytesInOutput":1478}},"bytes":1637},"dist/modules/input.connects.mjs":{"imports":[{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["inputAddonConnect","inputConnect","inputGroupConnect"],"entryPoint":"src/modules/input.connects.ts","inputs":{},"bytes":199},"dist/modules/input.hooks.mjs":{"imports":[{"path":"dist/chunk-4V5BHCMQ.mjs","kind":"import-statement"},{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useInput","useInputAddon","useInputGroup"],"entryPoint":"src/modules/input.hooks.ts","inputs":{},"bytes":207},"dist/chunk-4V5BHCMQ.mjs":{"imports":[{"path":"dist/chunk-SCN2G4G4.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true}],"exports":["useInput","useInputAddon","useInputGroup"],"inputs":{"src/modules/input.hooks.ts":{"bytesInOutput":1059}},"bytes":1294},"dist/chunk-SCN2G4G4.mjs":{"imports":[{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true}],"exports":["inputAddonConnect","inputConnect","inputGroupConnect"],"inputs":{"src/modules/input.connects.ts":{"bytesInOutput":3472}},"bytes":3625},"dist/modules/input.props.mjs":{"imports":[{"path":"dist/chunk-ZQ2NFCFA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["inputAddonProps","inputEmits","inputGroupProps","inputProps"],"entryPoint":"src/modules/input.props.ts","inputs":{},"bytes":215},"dist/chunk-ZQ2NFCFA.mjs":{"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"exports":["inputAddonProps","inputEmits","inputGroupProps","inputProps"],"inputs":{"src/modules/input.props.ts":{"bytesInOutput":1121}},"bytes":1229},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151},"dist/modules/input.types.mjs":{"imports":[],"exports":[],"entryPoint":"src/modules/input.types.ts","inputs":{"src/modules/input.types.ts":{"bytesInOutput":0}},"bytes":0}}}
|
|
@@ -50,6 +50,7 @@ function inputConnect(state, emit, classes, formControlProp) {
|
|
|
50
50
|
id: idx,
|
|
51
51
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
52
52
|
"data-is-full-width": isFullWidth,
|
|
53
|
+
"data-with-clearable": isClearable,
|
|
53
54
|
"data-pixel-component": "MpInput"
|
|
54
55
|
},
|
|
55
56
|
controlProps: {
|
|
@@ -54,6 +54,7 @@ function inputConnect(state, emit, classes, formControlProp) {
|
|
|
54
54
|
id: idx,
|
|
55
55
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
56
56
|
"data-is-full-width": isFullWidth,
|
|
57
|
+
"data-with-clearable": isClearable,
|
|
57
58
|
"data-pixel-component": "MpInput"
|
|
58
59
|
},
|
|
59
60
|
controlProps: {
|
|
@@ -33,13 +33,6 @@ interface InputAddonProps {
|
|
|
33
33
|
placement?: InputAddonPlacement;
|
|
34
34
|
hasBackground?: boolean;
|
|
35
35
|
}
|
|
36
|
-
interface InputVNode {
|
|
37
|
-
el?: any;
|
|
38
|
-
props?: object;
|
|
39
|
-
type: {
|
|
40
|
-
[name: string]: string;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
36
|
type InputDefinedContext = Optional<InputProps, 'id'>;
|
|
44
37
|
type InputGroupDefinedContext = Optional<InputGroupProps, 'id'>;
|
|
45
38
|
type InputAddonDefinedContext = Optional<InputAddonProps, 'id'>;
|
|
@@ -70,4 +63,4 @@ interface InputClasses {
|
|
|
70
63
|
clear?: string;
|
|
71
64
|
}
|
|
72
65
|
|
|
73
|
-
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps, InputSize, InputState,
|
|
66
|
+
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps, InputSize, InputState, InputVariant };
|
|
@@ -33,13 +33,6 @@ interface InputAddonProps {
|
|
|
33
33
|
placement?: InputAddonPlacement;
|
|
34
34
|
hasBackground?: boolean;
|
|
35
35
|
}
|
|
36
|
-
interface InputVNode {
|
|
37
|
-
el?: any;
|
|
38
|
-
props?: object;
|
|
39
|
-
type: {
|
|
40
|
-
[name: string]: string;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
36
|
type InputDefinedContext = Optional<InputProps, 'id'>;
|
|
44
37
|
type InputGroupDefinedContext = Optional<InputGroupProps, 'id'>;
|
|
45
38
|
type InputAddonDefinedContext = Optional<InputAddonProps, 'id'>;
|
|
@@ -70,4 +63,4 @@ interface InputClasses {
|
|
|
70
63
|
clear?: string;
|
|
71
64
|
}
|
|
72
65
|
|
|
73
|
-
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps, InputSize, InputState,
|
|
66
|
+
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps, InputSize, InputState, InputVariant };
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mekari/pixel3-input",
|
|
3
3
|
"description": "Mekari Pixel 3 | Input component is used to get user input in a text field",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13-dev.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@mekari/pixel3-form-control": "0.0.
|
|
12
|
-
"@mekari/pixel3-button": "0.0.
|
|
13
|
-
"@mekari/pixel3-styled-system": "0.0.
|
|
11
|
+
"@mekari/pixel3-form-control": "0.0.13-dev.0",
|
|
12
|
+
"@mekari/pixel3-button": "0.0.13-dev.0",
|
|
13
|
+
"@mekari/pixel3-styled-system": "0.0.11-dev.0",
|
|
14
14
|
"@mekari/pixel3-utils": "0.0.6"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
package/dist/chunk-575ZYGOA.mjs
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useInput
|
|
3
|
-
} from "./chunk-4WGVPYCM.mjs";
|
|
4
|
-
import {
|
|
5
|
-
inputEmits,
|
|
6
|
-
inputProps
|
|
7
|
-
} from "./chunk-ZQ2NFCFA.mjs";
|
|
8
|
-
|
|
9
|
-
// src/input.tsx
|
|
10
|
-
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
|
11
|
-
import { defineComponent, getCurrentInstance, onMounted, ref } from "vue";
|
|
12
|
-
import { useFormControlContext } from "@mekari/pixel3-form-control";
|
|
13
|
-
import { MpButton } from "@mekari/pixel3-button";
|
|
14
|
-
var MpInput = defineComponent({
|
|
15
|
-
name: "MpInput",
|
|
16
|
-
props: inputProps,
|
|
17
|
-
emits: inputEmits,
|
|
18
|
-
inheritAttrs: false,
|
|
19
|
-
setup(props, {
|
|
20
|
-
emit,
|
|
21
|
-
attrs
|
|
22
|
-
}) {
|
|
23
|
-
const {
|
|
24
|
-
as: Component
|
|
25
|
-
} = props;
|
|
26
|
-
const formControlProp = useFormControlContext();
|
|
27
|
-
const api = useInput(props, emit, formControlProp);
|
|
28
|
-
const calcSpacing = ref({
|
|
29
|
-
left: 12,
|
|
30
|
-
right: 12
|
|
31
|
-
});
|
|
32
|
-
const calcPosition = ref({
|
|
33
|
-
right: 12
|
|
34
|
-
});
|
|
35
|
-
onMounted(() => {
|
|
36
|
-
var _a, _b, _c;
|
|
37
|
-
const node = (_c = (_b = (_a = getCurrentInstance()) == null ? void 0 : _a.parent) == null ? void 0 : _b.subTree) == null ? void 0 : _c.children[0].children;
|
|
38
|
-
let isClearable = false;
|
|
39
|
-
node == null ? void 0 : node.map((vnode) => {
|
|
40
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
|
|
41
|
-
if (((_a2 = vnode.type) == null ? void 0 : _a2.name) === "MpInput") {
|
|
42
|
-
if (((_b2 = vnode.props) == null ? void 0 : _b2.hasOwnProperty("isClearable")) || ((_c2 = vnode.props) == null ? void 0 : _c2.hasOwnProperty("is-clearable"))) {
|
|
43
|
-
calcSpacing.value.right += 30;
|
|
44
|
-
isClearable = true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (((_d = vnode.type) == null ? void 0 : _d.name) === "MpInputLeftAddon") {
|
|
48
|
-
calcSpacing.value.left += 30;
|
|
49
|
-
if (((_e = vnode.props) == null ? void 0 : _e.hasOwnProperty("hasBackground")) || ((_f = vnode.props) == null ? void 0 : _f.hasOwnProperty("has-background")))
|
|
50
|
-
calcSpacing.value.left += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
51
|
-
}
|
|
52
|
-
if (((_g = vnode.type) == null ? void 0 : _g.name) === "MpInputRightAddon") {
|
|
53
|
-
calcSpacing.value.right += 30;
|
|
54
|
-
if (((_h = vnode.props) == null ? void 0 : _h.hasOwnProperty("hasBackground")) || ((_i = vnode.props) == null ? void 0 : _i.hasOwnProperty("has-background"))) {
|
|
55
|
-
calcSpacing.value.right += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
56
|
-
if (isClearable)
|
|
57
|
-
calcPosition.value.right += parseInt(getComputedStyle(vnode.el).width, 10);
|
|
58
|
-
} else {
|
|
59
|
-
if (isClearable)
|
|
60
|
-
calcPosition.value.right += 30;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
return () => {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
return _createVNode("div", api.value.rootProps, [_createVNode(Component, _mergeProps(api.value.controlProps, attrs, {
|
|
68
|
-
"style": {
|
|
69
|
-
"--mp-input--padding-left": `${calcSpacing.value.left}px`,
|
|
70
|
-
"--mp-input--padding-right": `${calcSpacing.value.right}px`,
|
|
71
|
-
...(_a = api.value.controlProps) == null ? void 0 : _a.style
|
|
72
|
-
}
|
|
73
|
-
}), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && _createVNode(MpButton, _mergeProps(api.value.clearProps, {
|
|
74
|
-
"style": {
|
|
75
|
-
"--mp-input--right": `${calcPosition.value.right}px`,
|
|
76
|
-
...(_b = api.value.clearProps) == null ? void 0 : _b.style
|
|
77
|
-
}
|
|
78
|
-
}), null)]);
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
MpInput
|
|
85
|
-
};
|
package/dist/chunk-P44SXIBM.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useInputAddon
|
|
3
|
-
} from "./chunk-4WGVPYCM.mjs";
|
|
4
|
-
import {
|
|
5
|
-
inputAddonProps
|
|
6
|
-
} from "./chunk-ZQ2NFCFA.mjs";
|
|
7
|
-
|
|
8
|
-
// src/input-addon.tsx
|
|
9
|
-
import { createVNode as _createVNode } from "vue";
|
|
10
|
-
import { defineComponent } from "vue";
|
|
11
|
-
var MpInputAddon = defineComponent({
|
|
12
|
-
name: "MpInputAddon",
|
|
13
|
-
props: inputAddonProps,
|
|
14
|
-
setup(props, {
|
|
15
|
-
slots
|
|
16
|
-
}) {
|
|
17
|
-
const api = useInputAddon(props);
|
|
18
|
-
return () => {
|
|
19
|
-
var _a;
|
|
20
|
-
return _createVNode("div", api.value.rootProps, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var MpInputLeftAddon = defineComponent({
|
|
25
|
-
name: "MpInputLeftAddon",
|
|
26
|
-
setup(_, {
|
|
27
|
-
slots
|
|
28
|
-
}) {
|
|
29
|
-
return () => _createVNode(MpInputAddon, {
|
|
30
|
-
"placement": "left"
|
|
31
|
-
}, {
|
|
32
|
-
default: () => {
|
|
33
|
-
var _a;
|
|
34
|
-
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
var MpInputRightAddon = defineComponent({
|
|
40
|
-
name: "MpInputRightAddon",
|
|
41
|
-
setup(_, {
|
|
42
|
-
slots
|
|
43
|
-
}) {
|
|
44
|
-
return () => _createVNode(MpInputAddon, {
|
|
45
|
-
"placement": "right"
|
|
46
|
-
}, {
|
|
47
|
-
default: () => {
|
|
48
|
-
var _a;
|
|
49
|
-
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
MpInputAddon,
|
|
57
|
-
MpInputLeftAddon,
|
|
58
|
-
MpInputRightAddon
|
|
59
|
-
};
|