@mekari/pixel3-input 0.0.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-62L6URRB.mjs +32 -0
- package/dist/chunk-AH5Q4AP2.mjs +81 -0
- package/dist/chunk-EF6JEV72.mjs +58 -0
- package/dist/chunk-JW2SLWRV.mjs +59 -0
- package/dist/chunk-ME6YL7P6.mjs +79 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-T766ACNL.mjs +127 -0
- package/dist/chunk-ZQ2NFCFA.mjs +83 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +483 -0
- package/dist/index.mjs +21 -0
- package/dist/input-addon.d.mts +48 -0
- package/dist/input-addon.d.ts +48 -0
- package/dist/input-addon.js +156 -0
- package/dist/input-addon.mjs +15 -0
- package/dist/input-group.d.mts +28 -0
- package/dist/input-group.d.ts +28 -0
- package/dist/input-group.js +115 -0
- package/dist/input-group.mjs +11 -0
- package/dist/input.d.mts +10 -0
- package/dist/input.d.ts +10 -0
- package/dist/input.js +304 -0
- package/dist/input.mjs +11 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/input.connects.d.mts +12 -0
- package/dist/modules/input.connects.d.ts +12 -0
- package/dist/modules/input.connects.js +150 -0
- package/dist/modules/input.connects.mjs +11 -0
- package/dist/modules/input.hooks.d.mts +9 -0
- package/dist/modules/input.hooks.d.ts +9 -0
- package/dist/modules/input.hooks.js +261 -0
- package/dist/modules/input.hooks.mjs +13 -0
- package/dist/modules/input.machines.d.mts +48 -0
- package/dist/modules/input.machines.d.ts +48 -0
- package/dist/modules/input.machines.js +81 -0
- package/dist/modules/input.machines.mjs +11 -0
- package/dist/modules/input.props.d.mts +80 -0
- package/dist/modules/input.props.d.ts +80 -0
- package/dist/modules/input.props.js +110 -0
- package/dist/modules/input.props.mjs +13 -0
- package/dist/modules/input.types.d.mts +77 -0
- package/dist/modules/input.types.d.ts +77 -0
- package/dist/modules/input.types.js +18 -0
- package/dist/modules/input.types.mjs +0 -0
- package/package.json +50 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useInputGroup
|
|
3
|
+
} from "./chunk-ME6YL7P6.mjs";
|
|
4
|
+
import {
|
|
5
|
+
inputGroupProps
|
|
6
|
+
} from "./chunk-ZQ2NFCFA.mjs";
|
|
7
|
+
|
|
8
|
+
// src/input-group.tsx
|
|
9
|
+
import { createVNode as _createVNode } from "vue";
|
|
10
|
+
import { defineComponent, computed, cloneVNode } from "vue";
|
|
11
|
+
import { objectFilterUndefined, getChildren } from "@mekari/pixel3-utils";
|
|
12
|
+
var MpInputGroup = defineComponent({
|
|
13
|
+
name: "MpInputGroup",
|
|
14
|
+
props: inputGroupProps,
|
|
15
|
+
setup(props, {
|
|
16
|
+
slots
|
|
17
|
+
}) {
|
|
18
|
+
const api = useInputGroup(props);
|
|
19
|
+
const children = computed(() => getChildren(slots));
|
|
20
|
+
const cloneChildren = computed(() => computed(() => children.value).value.map((vnode) => {
|
|
21
|
+
const overrideProps = objectFilterUndefined({
|
|
22
|
+
size: props.size
|
|
23
|
+
});
|
|
24
|
+
return cloneVNode(vnode, overrideProps);
|
|
25
|
+
}));
|
|
26
|
+
return () => _createVNode("div", api.value.rootProps, [cloneChildren.value]);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
MpInputGroup
|
|
32
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useInput
|
|
3
|
+
} from "./chunk-ME6YL7P6.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 { MpButton } from "@mekari/pixel3-button";
|
|
13
|
+
var MpInput = defineComponent({
|
|
14
|
+
name: "MpInput",
|
|
15
|
+
props: inputProps,
|
|
16
|
+
emits: inputEmits,
|
|
17
|
+
setup(props, {
|
|
18
|
+
emit
|
|
19
|
+
}) {
|
|
20
|
+
const {
|
|
21
|
+
as: Component
|
|
22
|
+
} = props;
|
|
23
|
+
const api = useInput(props, emit);
|
|
24
|
+
const calcSpacing = ref({
|
|
25
|
+
left: 12,
|
|
26
|
+
right: 12
|
|
27
|
+
});
|
|
28
|
+
const calcPosition = ref({
|
|
29
|
+
right: 12
|
|
30
|
+
});
|
|
31
|
+
onMounted(() => {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const node = (_c = (_b = (_a = getCurrentInstance()) == null ? void 0 : _a.parent) == null ? void 0 : _b.subTree) == null ? void 0 : _c.children[0].children;
|
|
34
|
+
let isClearable = false;
|
|
35
|
+
node == null ? void 0 : node.map((vnode) => {
|
|
36
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
37
|
+
if (((_a2 = vnode.type) == null ? void 0 : _a2.name) === "MpInput") {
|
|
38
|
+
if ((_b2 = vnode.props) == null ? void 0 : _b2.hasOwnProperty("isClearable")) {
|
|
39
|
+
calcSpacing.value.right += 30;
|
|
40
|
+
isClearable = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (((_c2 = vnode.type) == null ? void 0 : _c2.name) === "MpInputLeftAddon") {
|
|
44
|
+
calcSpacing.value.left += 30;
|
|
45
|
+
if ((_d = vnode.props) == null ? void 0 : _d.hasOwnProperty("hasBackground"))
|
|
46
|
+
calcSpacing.value.left += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
47
|
+
}
|
|
48
|
+
if (((_e = vnode.type) == null ? void 0 : _e.name) === "MpInputRightAddon") {
|
|
49
|
+
calcSpacing.value.right += 30;
|
|
50
|
+
if ((_f = vnode.props) == null ? void 0 : _f.hasOwnProperty("hasBackground")) {
|
|
51
|
+
calcSpacing.value.right += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
52
|
+
if (isClearable)
|
|
53
|
+
calcPosition.value.right += parseInt(getComputedStyle(vnode.el).width, 10);
|
|
54
|
+
} else {
|
|
55
|
+
if (isClearable)
|
|
56
|
+
calcPosition.value.right += 30;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return () => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return _createVNode("div", api.value.rootProps, [_createVNode(Component, _mergeProps(api.value.controlProps, {
|
|
64
|
+
"style": {
|
|
65
|
+
"--mp-input--padding-left": `${calcSpacing.value.left}px`,
|
|
66
|
+
"--mp-input--padding-right": `${calcSpacing.value.right}px`,
|
|
67
|
+
...(_a = api.value.controlProps) == null ? void 0 : _a.style
|
|
68
|
+
}
|
|
69
|
+
}), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && _createVNode(MpButton, _mergeProps(api.value.clearProps, {
|
|
70
|
+
"style": {
|
|
71
|
+
"--mp-input--right": `${calcPosition.value.right}px`,
|
|
72
|
+
...(_b = api.value.clearProps) == null ? void 0 : _b.style
|
|
73
|
+
}
|
|
74
|
+
}), null)]);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
MpInput
|
|
81
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/modules/input.machines.ts
|
|
6
|
+
import { createMachine } from "xstate";
|
|
7
|
+
function inputMachine(context) {
|
|
8
|
+
return createMachine({
|
|
9
|
+
/** @xstate-layout N4IgpgJg5mDOIC5QEsB2AHArgFwMQGUBRAFQH0A1AQQBkBVQgbQAYBdRUdAe1mW2U9TsQAD0QBGAEwA6JrLnz5AdgA0IAJ7iJAXy2q0WPMQCaABUIUa9ZmyQguPPgKGiEEiYqkBWT00UAOADZPRQBmPwAWAE4Av1UNBDExEKlwzxCxTzFw8IDIiT9FAJ1dEFROCDghfRwhe15+QVsXEICpQrFFCXDfMKjcuPEklLSMrJy8gqLioA */
|
|
10
|
+
id: "input",
|
|
11
|
+
context: {
|
|
12
|
+
modelValue: "",
|
|
13
|
+
...context
|
|
14
|
+
},
|
|
15
|
+
on: {
|
|
16
|
+
SET_VALUE: {
|
|
17
|
+
actions: "setValue"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
predictableActionArguments: true
|
|
21
|
+
}, {
|
|
22
|
+
actions: {
|
|
23
|
+
setValue(ctx, evt) {
|
|
24
|
+
set.value(ctx, evt.value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
__name(inputMachine, "inputMachine");
|
|
30
|
+
var set = {
|
|
31
|
+
value(ctx, value) {
|
|
32
|
+
ctx.modelValue = value;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function inputGroupMachine(context) {
|
|
36
|
+
return createMachine({
|
|
37
|
+
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
38
|
+
id: "input-group",
|
|
39
|
+
context,
|
|
40
|
+
predictableActionArguments: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
__name(inputGroupMachine, "inputGroupMachine");
|
|
44
|
+
function inputAddonMachine(context) {
|
|
45
|
+
return createMachine({
|
|
46
|
+
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEsMAHAVwBcBaAQwgiw3xGK1gPIIaYA9EBGAEzoAnvwHIJyIA */
|
|
47
|
+
id: "input-addon",
|
|
48
|
+
context,
|
|
49
|
+
predictableActionArguments: true
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
__name(inputAddonMachine, "inputAddonMachine");
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
inputMachine,
|
|
56
|
+
inputGroupMachine,
|
|
57
|
+
inputAddonMachine
|
|
58
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useInputAddon
|
|
3
|
+
} from "./chunk-ME6YL7P6.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
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inputAddonConnect,
|
|
3
|
+
inputConnect,
|
|
4
|
+
inputGroupConnect
|
|
5
|
+
} from "./chunk-T766ACNL.mjs";
|
|
6
|
+
import {
|
|
7
|
+
inputAddonMachine,
|
|
8
|
+
inputGroupMachine,
|
|
9
|
+
inputMachine
|
|
10
|
+
} from "./chunk-EF6JEV72.mjs";
|
|
11
|
+
import {
|
|
12
|
+
__name
|
|
13
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
14
|
+
|
|
15
|
+
// src/modules/input.hooks.ts
|
|
16
|
+
import { computed, ref } from "vue";
|
|
17
|
+
import { useMachine } from "@xstate/vue";
|
|
18
|
+
import { useId } from "@mekari/pixel3-utils";
|
|
19
|
+
import { inputSlotRecipe, inputGroupSlotRecipe, inputAddonSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
|
|
20
|
+
var useInput = /* @__PURE__ */ __name((props, emit) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const context = ref(props);
|
|
23
|
+
const {
|
|
24
|
+
state,
|
|
25
|
+
send
|
|
26
|
+
} = useMachine(inputMachine({
|
|
27
|
+
...context.value,
|
|
28
|
+
id: (_a = context.value.id) != null ? _a : `mp-input-${useId()}`,
|
|
29
|
+
onInput(evt) {
|
|
30
|
+
var _a2, _b;
|
|
31
|
+
emit("update:modelValue", (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
32
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
33
|
+
},
|
|
34
|
+
onChange(evt) {
|
|
35
|
+
var _a2;
|
|
36
|
+
emit("change", evt, (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
37
|
+
},
|
|
38
|
+
onClear(evt) {
|
|
39
|
+
emit("clear", evt);
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
const [inputProps] = inputSlotRecipe.splitVariantProps(context.value);
|
|
43
|
+
const classes = inputSlotRecipe(inputProps);
|
|
44
|
+
return computed(() => inputConnect(state.value, send, classes));
|
|
45
|
+
}, "useInput");
|
|
46
|
+
var useInputGroup = /* @__PURE__ */ __name((props) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const context = ref(props);
|
|
49
|
+
const {
|
|
50
|
+
state,
|
|
51
|
+
send
|
|
52
|
+
} = useMachine(inputGroupMachine({
|
|
53
|
+
...context.value,
|
|
54
|
+
id: (_a = context.value.id) != null ? _a : `mp-input-group-${useId()}`
|
|
55
|
+
}));
|
|
56
|
+
const [inputGroupProps] = inputGroupSlotRecipe.splitVariantProps(context.value);
|
|
57
|
+
const classes = inputGroupSlotRecipe(inputGroupProps);
|
|
58
|
+
return computed(() => inputGroupConnect(state.value, send, classes));
|
|
59
|
+
}, "useInputGroup");
|
|
60
|
+
var useInputAddon = /* @__PURE__ */ __name((props) => {
|
|
61
|
+
var _a;
|
|
62
|
+
const context = ref(props);
|
|
63
|
+
const {
|
|
64
|
+
state,
|
|
65
|
+
send
|
|
66
|
+
} = useMachine(inputAddonMachine({
|
|
67
|
+
...context.value,
|
|
68
|
+
id: (_a = context.value.id) != null ? _a : `mp-input-addon-${useId()}`
|
|
69
|
+
}));
|
|
70
|
+
const [inputAddonProps] = inputAddonSlotRecipe.splitVariantProps(context.value);
|
|
71
|
+
const classes = inputAddonSlotRecipe(inputAddonProps);
|
|
72
|
+
return computed(() => inputAddonConnect(state.value, send, classes));
|
|
73
|
+
}, "useInputAddon");
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
useInput,
|
|
77
|
+
useInputGroup,
|
|
78
|
+
useInputAddon
|
|
79
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/modules/input.connects.ts
|
|
6
|
+
import { cx } from "@mekari/pixel3-styled-system/css";
|
|
7
|
+
function inputConnect(state, send, classes) {
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
modelValue,
|
|
11
|
+
placeholder,
|
|
12
|
+
isReadOnly,
|
|
13
|
+
isDisabled,
|
|
14
|
+
isRequired,
|
|
15
|
+
isInvalid,
|
|
16
|
+
isFullWidth,
|
|
17
|
+
isClearable,
|
|
18
|
+
onInput,
|
|
19
|
+
onChange,
|
|
20
|
+
onClear
|
|
21
|
+
} = state.context;
|
|
22
|
+
return {
|
|
23
|
+
modelValue,
|
|
24
|
+
isReadOnly,
|
|
25
|
+
isDisabled,
|
|
26
|
+
isClearable,
|
|
27
|
+
rootProps: {
|
|
28
|
+
id,
|
|
29
|
+
class: cx(classes.root, "group"),
|
|
30
|
+
"data-is-full-width": isFullWidth,
|
|
31
|
+
"data-pixel-component": "MpInput"
|
|
32
|
+
},
|
|
33
|
+
controlProps: {
|
|
34
|
+
id: `${id}-control`,
|
|
35
|
+
value: modelValue,
|
|
36
|
+
placeholder,
|
|
37
|
+
readonly: isReadOnly,
|
|
38
|
+
disabled: isDisabled,
|
|
39
|
+
required: isRequired,
|
|
40
|
+
"data-value": modelValue,
|
|
41
|
+
"data-is-full-width": isFullWidth,
|
|
42
|
+
"aria-readonly": isReadOnly,
|
|
43
|
+
"aria-disabled": isDisabled,
|
|
44
|
+
"aria-invalid": isInvalid,
|
|
45
|
+
"aria-required": isRequired,
|
|
46
|
+
onInput(evt) {
|
|
47
|
+
var _a;
|
|
48
|
+
send({
|
|
49
|
+
type: "SET_VALUE",
|
|
50
|
+
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
51
|
+
});
|
|
52
|
+
if (onInput)
|
|
53
|
+
onInput(evt);
|
|
54
|
+
},
|
|
55
|
+
onChange(evt) {
|
|
56
|
+
var _a;
|
|
57
|
+
send({
|
|
58
|
+
type: "SET_VALUE",
|
|
59
|
+
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
60
|
+
});
|
|
61
|
+
if (onChange)
|
|
62
|
+
onChange(evt);
|
|
63
|
+
},
|
|
64
|
+
class: classes.control,
|
|
65
|
+
"data-pixel-component": "MpInputControl"
|
|
66
|
+
},
|
|
67
|
+
clearProps: {
|
|
68
|
+
id: `${id}-clear`,
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
size: "sm",
|
|
71
|
+
leftIcon: "reset",
|
|
72
|
+
onClick(evt) {
|
|
73
|
+
send({
|
|
74
|
+
type: "SET_VALUE",
|
|
75
|
+
value: null
|
|
76
|
+
});
|
|
77
|
+
if (onInput)
|
|
78
|
+
onInput(evt);
|
|
79
|
+
if (onClear)
|
|
80
|
+
onClear(evt);
|
|
81
|
+
},
|
|
82
|
+
class: classes.clear,
|
|
83
|
+
style: {
|
|
84
|
+
"--mp-input--visibility": modelValue ? "visible" : "hidden",
|
|
85
|
+
"--mp-input--opacity": modelValue ? "1" : "0"
|
|
86
|
+
},
|
|
87
|
+
"data-pixel-component": "MpInputClear"
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
__name(inputConnect, "inputConnect");
|
|
92
|
+
function inputGroupConnect(state, send, classes) {
|
|
93
|
+
const {
|
|
94
|
+
id
|
|
95
|
+
} = state.context;
|
|
96
|
+
return {
|
|
97
|
+
rootProps: {
|
|
98
|
+
id,
|
|
99
|
+
class: classes.root,
|
|
100
|
+
"data-pixel-component": "MpInputGroup"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
__name(inputGroupConnect, "inputGroupConnect");
|
|
105
|
+
function inputAddonConnect(state, send, classes) {
|
|
106
|
+
const {
|
|
107
|
+
id,
|
|
108
|
+
placement,
|
|
109
|
+
hasBackground
|
|
110
|
+
} = state.context;
|
|
111
|
+
return {
|
|
112
|
+
rootProps: {
|
|
113
|
+
id,
|
|
114
|
+
class: classes.root,
|
|
115
|
+
"data-placement": placement,
|
|
116
|
+
"data-has-background": hasBackground,
|
|
117
|
+
"data-pixel-component": "MpInputAddon"
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
__name(inputAddonConnect, "inputAddonConnect");
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
inputConnect,
|
|
125
|
+
inputGroupConnect,
|
|
126
|
+
inputAddonConnect
|
|
127
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// src/modules/input.props.ts
|
|
2
|
+
import { declareEmit } from "@mekari/pixel3-utils";
|
|
3
|
+
var inputProps = {
|
|
4
|
+
as: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: "input"
|
|
7
|
+
},
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: [String, Number]
|
|
10
|
+
},
|
|
11
|
+
id: {
|
|
12
|
+
type: String
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "md"
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "outline"
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: String
|
|
24
|
+
},
|
|
25
|
+
isReadOnly: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
isDisabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
isRequired: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
isInvalid: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
isFullWidth: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true
|
|
44
|
+
},
|
|
45
|
+
isClearable: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var inputGroupProps = {
|
|
51
|
+
id: {
|
|
52
|
+
type: String
|
|
53
|
+
},
|
|
54
|
+
size: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "md"
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var inputAddonProps = {
|
|
60
|
+
id: {
|
|
61
|
+
type: String
|
|
62
|
+
},
|
|
63
|
+
size: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "md"
|
|
66
|
+
},
|
|
67
|
+
placement: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "left"
|
|
70
|
+
},
|
|
71
|
+
hasBackground: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var inputEmits = declareEmit(["change", "input", "clear", "update:modelValue"]);
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
inputProps,
|
|
80
|
+
inputGroupProps,
|
|
81
|
+
inputAddonProps,
|
|
82
|
+
inputEmits
|
|
83
|
+
};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MpInput } from './input.mjs';
|
|
2
|
+
export { MpInputGroup } from './input-group.mjs';
|
|
3
|
+
export { MpInputLeftAddon, MpInputRightAddon } from './input-addon.mjs';
|
|
4
|
+
export { InputAddonPlacement, InputAddonProps, InputGroupProps, InputProps, InputSize, InputVariant } from './modules/input.types.mjs';
|
|
5
|
+
import '@mekari/pixel3-utils';
|
|
6
|
+
import 'vue';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MpInput } from './input.js';
|
|
2
|
+
export { MpInputGroup } from './input-group.js';
|
|
3
|
+
export { MpInputLeftAddon, MpInputRightAddon } from './input-addon.js';
|
|
4
|
+
export { InputAddonPlacement, InputAddonProps, InputGroupProps, InputProps, InputSize, InputVariant } from './modules/input.types.js';
|
|
5
|
+
import '@mekari/pixel3-utils';
|
|
6
|
+
import 'vue';
|