@mekari/pixel3-input 0.0.1-alpha.0 → 0.0.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/chunk-45BJFHHR.mjs +117 -0
- package/dist/{chunk-62L6URRB.mjs → chunk-4YFPKPDU.mjs} +1 -1
- package/dist/{chunk-AH5Q4AP2.mjs → chunk-6JUSM6A5.mjs} +5 -3
- package/dist/chunk-IP4RFVD7.mjs +36 -0
- package/dist/{chunk-JW2SLWRV.mjs → chunk-VD5GL77E.mjs} +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +66 -161
- package/dist/index.mjs +5 -6
- package/dist/input-addon.d.mts +4 -3
- package/dist/input-addon.d.ts +4 -3
- package/dist/input-addon.js +16 -35
- package/dist/input-addon.mjs +3 -4
- package/dist/input-group.d.mts +2 -1
- package/dist/input-group.d.ts +2 -1
- package/dist/input-group.js +15 -34
- package/dist/input-group.mjs +3 -4
- package/dist/input.js +39 -102
- package/dist/input.mjs +3 -4
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/modules/input.connects.d.mts +4 -4
- package/dist/modules/input.connects.d.ts +4 -4
- package/dist/modules/input.connects.js +33 -43
- package/dist/modules/input.connects.mjs +1 -1
- package/dist/modules/input.hooks.js +42 -139
- package/dist/modules/input.hooks.mjs +2 -3
- package/dist/modules/input.types.d.mts +4 -8
- package/dist/modules/input.types.d.ts +4 -8
- package/package.json +5 -8
- package/dist/chunk-EF6JEV72.mjs +0 -58
- package/dist/chunk-ME6YL7P6.mjs +0 -79
- package/dist/chunk-T766ACNL.mjs +0 -127
- package/dist/modules/input.machines.d.mts +0 -48
- package/dist/modules/input.machines.d.ts +0 -48
- package/dist/modules/input.machines.js +0 -81
- package/dist/modules/input.machines.mjs +0 -11
package/dist/input-addon.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import { InputSize, InputAddonPlacement } from './modules/input.types.js';
|
|
2
3
|
import * as vue from 'vue';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -21,7 +22,7 @@ declare const MpInputAddon: vue.DefineComponent<{
|
|
|
21
22
|
type: vue.PropType<boolean | undefined>;
|
|
22
23
|
default: boolean;
|
|
23
24
|
};
|
|
24
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
25
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
25
26
|
id: {
|
|
26
27
|
type: vue.PropType<string | undefined>;
|
|
27
28
|
};
|
|
@@ -42,7 +43,7 @@ declare const MpInputAddon: vue.DefineComponent<{
|
|
|
42
43
|
placement: InputAddonPlacement | undefined;
|
|
43
44
|
hasBackground: boolean | undefined;
|
|
44
45
|
}, {}>;
|
|
45
|
-
declare const MpInputLeftAddon: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
46
|
-
declare const MpInputRightAddon: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
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<{}>>, {}, {}>;
|
|
47
48
|
|
|
48
49
|
export { MpInputAddon, MpInputLeftAddon, MpInputRightAddon };
|
package/dist/input-addon.js
CHANGED
|
@@ -26,8 +26,8 @@ __export(input_addon_exports, {
|
|
|
26
26
|
MpInputRightAddon: () => MpInputRightAddon
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(input_addon_exports);
|
|
29
|
+
var import_vue2 = require("vue");
|
|
29
30
|
var import_vue3 = require("vue");
|
|
30
|
-
var import_vue4 = require("vue");
|
|
31
31
|
|
|
32
32
|
// src/modules/input.props.ts
|
|
33
33
|
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
@@ -52,33 +52,22 @@ var inputEmits = (0, import_pixel3_utils.declareEmit)(["change", "input", "clear
|
|
|
52
52
|
|
|
53
53
|
// src/modules/input.hooks.ts
|
|
54
54
|
var import_vue = require("vue");
|
|
55
|
-
var import_vue2 = require("@xstate/vue");
|
|
56
|
-
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
57
55
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
58
56
|
|
|
59
|
-
// src/modules/input.machines.ts
|
|
60
|
-
var import_xstate = require("xstate");
|
|
61
|
-
function inputAddonMachine(context) {
|
|
62
|
-
return (0, import_xstate.createMachine)({
|
|
63
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEsMAHAVwBcBaAQwgiw3xGK1gPIIaYA9EBGAEzoAnvwHIJyIA */
|
|
64
|
-
id: "input-addon",
|
|
65
|
-
context,
|
|
66
|
-
predictableActionArguments: true
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
__name(inputAddonMachine, "inputAddonMachine");
|
|
70
|
-
|
|
71
57
|
// src/modules/input.connects.ts
|
|
58
|
+
var import_pixel3_form_control = require("@mekari/pixel3-form-control");
|
|
59
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
72
60
|
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
73
|
-
function inputAddonConnect(state,
|
|
61
|
+
function inputAddonConnect(state, classes) {
|
|
74
62
|
const {
|
|
75
63
|
id,
|
|
76
64
|
placement,
|
|
77
65
|
hasBackground
|
|
78
|
-
} = state
|
|
66
|
+
} = state;
|
|
67
|
+
const idx = id != null ? id : `mp-input-addon-${(0, import_pixel3_utils2.useId)()}`;
|
|
79
68
|
return {
|
|
80
69
|
rootProps: {
|
|
81
|
-
id,
|
|
70
|
+
id: idx,
|
|
82
71
|
class: classes.root,
|
|
83
72
|
"data-placement": placement,
|
|
84
73
|
"data-has-background": hasBackground,
|
|
@@ -90,22 +79,14 @@ __name(inputAddonConnect, "inputAddonConnect");
|
|
|
90
79
|
|
|
91
80
|
// src/modules/input.hooks.ts
|
|
92
81
|
var useInputAddon = /* @__PURE__ */ __name((props) => {
|
|
93
|
-
var _a;
|
|
94
82
|
const context = (0, import_vue.ref)(props);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} = (0, import_vue2.useMachine)(inputAddonMachine({
|
|
99
|
-
...context.value,
|
|
100
|
-
id: (_a = context.value.id) != null ? _a : `mp-input-addon-${(0, import_pixel3_utils2.useId)()}`
|
|
101
|
-
}));
|
|
102
|
-
const [inputAddonProps2] = import_recipes.inputAddonSlotRecipe.splitVariantProps(context.value);
|
|
103
|
-
const classes = (0, import_recipes.inputAddonSlotRecipe)(inputAddonProps2);
|
|
104
|
-
return (0, import_vue.computed)(() => inputAddonConnect(state.value, send, classes));
|
|
83
|
+
const [value] = import_recipes.inputAddonSlotRecipe.splitVariantProps(context.value);
|
|
84
|
+
const classes = (0, import_recipes.inputAddonSlotRecipe)(value);
|
|
85
|
+
return (0, import_vue.computed)(() => inputAddonConnect(context.value, classes));
|
|
105
86
|
}, "useInputAddon");
|
|
106
87
|
|
|
107
88
|
// src/input-addon.tsx
|
|
108
|
-
var MpInputAddon = (0,
|
|
89
|
+
var MpInputAddon = (0, import_vue3.defineComponent)({
|
|
109
90
|
name: "MpInputAddon",
|
|
110
91
|
props: inputAddonProps,
|
|
111
92
|
setup(props, {
|
|
@@ -114,16 +95,16 @@ var MpInputAddon = (0, import_vue4.defineComponent)({
|
|
|
114
95
|
const api = useInputAddon(props);
|
|
115
96
|
return () => {
|
|
116
97
|
var _a;
|
|
117
|
-
return (0,
|
|
98
|
+
return (0, import_vue2.createVNode)("div", api.value.rootProps, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
118
99
|
};
|
|
119
100
|
}
|
|
120
101
|
});
|
|
121
|
-
var MpInputLeftAddon = (0,
|
|
102
|
+
var MpInputLeftAddon = (0, import_vue3.defineComponent)({
|
|
122
103
|
name: "MpInputLeftAddon",
|
|
123
104
|
setup(_, {
|
|
124
105
|
slots
|
|
125
106
|
}) {
|
|
126
|
-
return () => (0,
|
|
107
|
+
return () => (0, import_vue2.createVNode)(MpInputAddon, {
|
|
127
108
|
"placement": "left"
|
|
128
109
|
}, {
|
|
129
110
|
default: () => {
|
|
@@ -133,12 +114,12 @@ var MpInputLeftAddon = (0, import_vue4.defineComponent)({
|
|
|
133
114
|
});
|
|
134
115
|
}
|
|
135
116
|
});
|
|
136
|
-
var MpInputRightAddon = (0,
|
|
117
|
+
var MpInputRightAddon = (0, import_vue3.defineComponent)({
|
|
137
118
|
name: "MpInputRightAddon",
|
|
138
119
|
setup(_, {
|
|
139
120
|
slots
|
|
140
121
|
}) {
|
|
141
|
-
return () => (0,
|
|
122
|
+
return () => (0, import_vue2.createVNode)(MpInputAddon, {
|
|
142
123
|
"placement": "right"
|
|
143
124
|
}, {
|
|
144
125
|
default: () => {
|
package/dist/input-addon.mjs
CHANGED
|
@@ -2,10 +2,9 @@ import {
|
|
|
2
2
|
MpInputAddon,
|
|
3
3
|
MpInputLeftAddon,
|
|
4
4
|
MpInputRightAddon
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-EF6JEV72.mjs";
|
|
5
|
+
} from "./chunk-VD5GL77E.mjs";
|
|
6
|
+
import "./chunk-IP4RFVD7.mjs";
|
|
7
|
+
import "./chunk-45BJFHHR.mjs";
|
|
9
8
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
10
9
|
import "./chunk-QZ7VFGWC.mjs";
|
|
11
10
|
export {
|
package/dist/input-group.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import { InputSize } from './modules/input.types.mjs';
|
|
2
3
|
import * as vue from 'vue';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -13,7 +14,7 @@ declare const MpInputGroup: vue.DefineComponent<{
|
|
|
13
14
|
type: vue.PropType<InputSize | undefined>;
|
|
14
15
|
default: string;
|
|
15
16
|
};
|
|
16
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
17
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
17
18
|
id: {
|
|
18
19
|
type: vue.PropType<string | undefined>;
|
|
19
20
|
};
|
package/dist/input-group.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
1
2
|
import { InputSize } from './modules/input.types.js';
|
|
2
3
|
import * as vue from 'vue';
|
|
3
4
|
import '@mekari/pixel3-utils';
|
|
@@ -13,7 +14,7 @@ declare const MpInputGroup: vue.DefineComponent<{
|
|
|
13
14
|
type: vue.PropType<InputSize | undefined>;
|
|
14
15
|
default: string;
|
|
15
16
|
};
|
|
16
|
-
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.
|
|
17
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
17
18
|
id: {
|
|
18
19
|
type: vue.PropType<string | undefined>;
|
|
19
20
|
};
|
package/dist/input-group.js
CHANGED
|
@@ -24,8 +24,8 @@ __export(input_group_exports, {
|
|
|
24
24
|
MpInputGroup: () => MpInputGroup
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(input_group_exports);
|
|
27
|
+
var import_vue2 = require("vue");
|
|
27
28
|
var import_vue3 = require("vue");
|
|
28
|
-
var import_vue4 = require("vue");
|
|
29
29
|
var import_pixel3_utils3 = require("@mekari/pixel3-utils");
|
|
30
30
|
|
|
31
31
|
// src/modules/input.props.ts
|
|
@@ -43,31 +43,20 @@ var inputEmits = (0, import_pixel3_utils.declareEmit)(["change", "input", "clear
|
|
|
43
43
|
|
|
44
44
|
// src/modules/input.hooks.ts
|
|
45
45
|
var import_vue = require("vue");
|
|
46
|
-
var import_vue2 = require("@xstate/vue");
|
|
47
|
-
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
48
46
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
49
47
|
|
|
50
|
-
// src/modules/input.machines.ts
|
|
51
|
-
var import_xstate = require("xstate");
|
|
52
|
-
function inputGroupMachine(context) {
|
|
53
|
-
return (0, import_xstate.createMachine)({
|
|
54
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
55
|
-
id: "input-group",
|
|
56
|
-
context,
|
|
57
|
-
predictableActionArguments: true
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
__name(inputGroupMachine, "inputGroupMachine");
|
|
61
|
-
|
|
62
48
|
// src/modules/input.connects.ts
|
|
49
|
+
var import_pixel3_form_control = require("@mekari/pixel3-form-control");
|
|
50
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
63
51
|
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
64
|
-
function inputGroupConnect(state,
|
|
52
|
+
function inputGroupConnect(state, classes) {
|
|
65
53
|
const {
|
|
66
54
|
id
|
|
67
|
-
} = state
|
|
55
|
+
} = state;
|
|
56
|
+
const idx = id != null ? id : `mp-input-group-${(0, import_pixel3_utils2.useId)()}`;
|
|
68
57
|
return {
|
|
69
58
|
rootProps: {
|
|
70
|
-
id,
|
|
59
|
+
id: idx,
|
|
71
60
|
class: classes.root,
|
|
72
61
|
"data-pixel-component": "MpInputGroup"
|
|
73
62
|
}
|
|
@@ -77,36 +66,28 @@ __name(inputGroupConnect, "inputGroupConnect");
|
|
|
77
66
|
|
|
78
67
|
// src/modules/input.hooks.ts
|
|
79
68
|
var useInputGroup = /* @__PURE__ */ __name((props) => {
|
|
80
|
-
var _a;
|
|
81
69
|
const context = (0, import_vue.ref)(props);
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} = (0, import_vue2.useMachine)(inputGroupMachine({
|
|
86
|
-
...context.value,
|
|
87
|
-
id: (_a = context.value.id) != null ? _a : `mp-input-group-${(0, import_pixel3_utils2.useId)()}`
|
|
88
|
-
}));
|
|
89
|
-
const [inputGroupProps2] = import_recipes.inputGroupSlotRecipe.splitVariantProps(context.value);
|
|
90
|
-
const classes = (0, import_recipes.inputGroupSlotRecipe)(inputGroupProps2);
|
|
91
|
-
return (0, import_vue.computed)(() => inputGroupConnect(state.value, send, classes));
|
|
70
|
+
const [value] = import_recipes.inputGroupSlotRecipe.splitVariantProps(context.value);
|
|
71
|
+
const classes = (0, import_recipes.inputGroupSlotRecipe)(value);
|
|
72
|
+
return (0, import_vue.computed)(() => inputGroupConnect(context.value, classes));
|
|
92
73
|
}, "useInputGroup");
|
|
93
74
|
|
|
94
75
|
// src/input-group.tsx
|
|
95
|
-
var MpInputGroup = (0,
|
|
76
|
+
var MpInputGroup = (0, import_vue3.defineComponent)({
|
|
96
77
|
name: "MpInputGroup",
|
|
97
78
|
props: inputGroupProps,
|
|
98
79
|
setup(props, {
|
|
99
80
|
slots
|
|
100
81
|
}) {
|
|
101
82
|
const api = useInputGroup(props);
|
|
102
|
-
const children = (0,
|
|
103
|
-
const cloneChildren = (0,
|
|
83
|
+
const children = (0, import_vue3.computed)(() => (0, import_pixel3_utils3.getChildren)(slots));
|
|
84
|
+
const cloneChildren = (0, import_vue3.computed)(() => (0, import_vue3.computed)(() => children.value).value.map((vnode) => {
|
|
104
85
|
const overrideProps = (0, import_pixel3_utils3.objectFilterUndefined)({
|
|
105
86
|
size: props.size
|
|
106
87
|
});
|
|
107
|
-
return (0,
|
|
88
|
+
return (0, import_vue3.cloneVNode)(vnode, overrideProps);
|
|
108
89
|
}));
|
|
109
|
-
return () => (0,
|
|
90
|
+
return () => (0, import_vue2.createVNode)("div", api.value.rootProps, [cloneChildren.value]);
|
|
110
91
|
}
|
|
111
92
|
});
|
|
112
93
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/input-group.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpInputGroup
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-EF6JEV72.mjs";
|
|
3
|
+
} from "./chunk-4YFPKPDU.mjs";
|
|
4
|
+
import "./chunk-IP4RFVD7.mjs";
|
|
5
|
+
import "./chunk-45BJFHHR.mjs";
|
|
7
6
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
8
7
|
import "./chunk-QZ7VFGWC.mjs";
|
|
9
8
|
export {
|
package/dist/input.js
CHANGED
|
@@ -24,8 +24,8 @@ __export(input_exports, {
|
|
|
24
24
|
MpInput: () => MpInput
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(input_exports);
|
|
27
|
+
var import_vue2 = require("vue");
|
|
27
28
|
var import_vue3 = require("vue");
|
|
28
|
-
var import_vue4 = require("vue");
|
|
29
29
|
|
|
30
30
|
// src/modules/input.props.ts
|
|
31
31
|
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
@@ -80,44 +80,13 @@ var inputEmits = (0, import_pixel3_utils.declareEmit)(["change", "input", "clear
|
|
|
80
80
|
|
|
81
81
|
// src/modules/input.hooks.ts
|
|
82
82
|
var import_vue = require("vue");
|
|
83
|
-
var import_vue2 = require("@xstate/vue");
|
|
84
|
-
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
85
83
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
86
84
|
|
|
87
|
-
// src/modules/input.machines.ts
|
|
88
|
-
var import_xstate = require("xstate");
|
|
89
|
-
function inputMachine(context) {
|
|
90
|
-
return (0, import_xstate.createMachine)({
|
|
91
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QEsB2AHArgFwMQGUBRAFQH0A1AQQBkBVQgbQAYBdRUdAe1mW2U9TsQAD0QBGAEwA6JrLnz5AdgA0IAJ7iJAXy2q0WPMQCaABUIUa9ZmyQguPPgKGiEEiYqkBWT00UAOADZPRQBmPwAWAE4Av1UNBDExEKlwzxCxTzFw8IDIiT9FAJ1dEFROCDghfRwhe15+QVsXEICpQrFFCXDfMKjcuPEklLSMrJy8gqLioA */
|
|
92
|
-
id: "input",
|
|
93
|
-
context: {
|
|
94
|
-
modelValue: "",
|
|
95
|
-
...context
|
|
96
|
-
},
|
|
97
|
-
on: {
|
|
98
|
-
SET_VALUE: {
|
|
99
|
-
actions: "setValue"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
predictableActionArguments: true
|
|
103
|
-
}, {
|
|
104
|
-
actions: {
|
|
105
|
-
setValue(ctx, evt) {
|
|
106
|
-
set.value(ctx, evt.value);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
__name(inputMachine, "inputMachine");
|
|
112
|
-
var set = {
|
|
113
|
-
value(ctx, value) {
|
|
114
|
-
ctx.modelValue = value;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
85
|
// src/modules/input.connects.ts
|
|
86
|
+
var import_pixel3_form_control = require("@mekari/pixel3-form-control");
|
|
87
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
119
88
|
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
120
|
-
function inputConnect(state,
|
|
89
|
+
function inputConnect(state, emit, classes) {
|
|
121
90
|
const {
|
|
122
91
|
id,
|
|
123
92
|
modelValue,
|
|
@@ -127,70 +96,56 @@ function inputConnect(state, send, classes) {
|
|
|
127
96
|
isRequired,
|
|
128
97
|
isInvalid,
|
|
129
98
|
isFullWidth,
|
|
130
|
-
isClearable
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
} = state.context;
|
|
99
|
+
isClearable
|
|
100
|
+
} = state;
|
|
101
|
+
const idx = id != null ? id : `mp-input-${(0, import_pixel3_utils2.useId)()}`;
|
|
102
|
+
const formControlProp = (0, import_pixel3_form_control.useFormControlContext)();
|
|
135
103
|
return {
|
|
136
104
|
modelValue,
|
|
137
105
|
isReadOnly,
|
|
138
106
|
isDisabled,
|
|
139
107
|
isClearable,
|
|
140
108
|
rootProps: {
|
|
141
|
-
id,
|
|
109
|
+
id: idx,
|
|
142
110
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
143
111
|
"data-is-full-width": isFullWidth,
|
|
144
112
|
"data-pixel-component": "MpInput"
|
|
145
113
|
},
|
|
146
114
|
controlProps: {
|
|
147
|
-
id: `${
|
|
115
|
+
id: `${idx}-control`,
|
|
148
116
|
value: modelValue,
|
|
149
117
|
placeholder,
|
|
150
|
-
readonly: isReadOnly,
|
|
151
|
-
disabled: isDisabled,
|
|
152
|
-
required: isRequired,
|
|
118
|
+
readonly: (formControlProp == null ? void 0 : formControlProp.value.isReadOnly) || isReadOnly,
|
|
119
|
+
disabled: (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || isDisabled,
|
|
120
|
+
required: (formControlProp == null ? void 0 : formControlProp.value.isRequired) || isRequired,
|
|
153
121
|
"data-value": modelValue,
|
|
154
122
|
"data-is-full-width": isFullWidth,
|
|
155
|
-
"aria-readonly": isReadOnly,
|
|
156
|
-
"aria-disabled": isDisabled,
|
|
157
|
-
"aria-invalid": isInvalid,
|
|
158
|
-
"aria-required": isRequired,
|
|
123
|
+
"aria-readonly": (formControlProp == null ? void 0 : formControlProp.value.isReadOnly) || isReadOnly,
|
|
124
|
+
"aria-disabled": (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || isDisabled,
|
|
125
|
+
"aria-invalid": (formControlProp == null ? void 0 : formControlProp.value.isInvalid) || isInvalid,
|
|
126
|
+
"aria-required": (formControlProp == null ? void 0 : formControlProp.value.isRequired) || isRequired,
|
|
159
127
|
onInput(evt) {
|
|
160
|
-
var _a;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
164
|
-
});
|
|
165
|
-
if (onInput)
|
|
166
|
-
onInput(evt);
|
|
128
|
+
var _a, _b;
|
|
129
|
+
emit("update:modelValue", (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
130
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
167
131
|
},
|
|
168
132
|
onChange(evt) {
|
|
169
133
|
var _a;
|
|
170
|
-
|
|
171
|
-
type: "SET_VALUE",
|
|
172
|
-
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
173
|
-
});
|
|
174
|
-
if (onChange)
|
|
175
|
-
onChange(evt);
|
|
134
|
+
emit("change", evt, (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
176
135
|
},
|
|
177
136
|
class: classes.control,
|
|
178
137
|
"data-pixel-component": "MpInputControl"
|
|
179
138
|
},
|
|
180
139
|
clearProps: {
|
|
181
|
-
id: `${
|
|
140
|
+
id: `${idx}-clear`,
|
|
182
141
|
variant: "ghost",
|
|
183
142
|
size: "sm",
|
|
184
143
|
leftIcon: "reset",
|
|
185
144
|
onClick(evt) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (onInput)
|
|
191
|
-
onInput(evt);
|
|
192
|
-
if (onClear)
|
|
193
|
-
onClear(evt);
|
|
145
|
+
var _a, _b;
|
|
146
|
+
emit("update:modelValue", (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
147
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
148
|
+
emit("clear", evt);
|
|
194
149
|
},
|
|
195
150
|
class: classes.clear,
|
|
196
151
|
style: {
|
|
@@ -205,55 +160,37 @@ __name(inputConnect, "inputConnect");
|
|
|
205
160
|
|
|
206
161
|
// src/modules/input.hooks.ts
|
|
207
162
|
var useInput = /* @__PURE__ */ __name((props, emit) => {
|
|
208
|
-
var _a;
|
|
209
163
|
const context = (0, import_vue.ref)(props);
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
} = (0, import_vue2.useMachine)(inputMachine({
|
|
214
|
-
...context.value,
|
|
215
|
-
id: (_a = context.value.id) != null ? _a : `mp-input-${(0, import_pixel3_utils2.useId)()}`,
|
|
216
|
-
onInput(evt) {
|
|
217
|
-
var _a2, _b;
|
|
218
|
-
emit("update:modelValue", (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
219
|
-
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
220
|
-
},
|
|
221
|
-
onChange(evt) {
|
|
222
|
-
var _a2;
|
|
223
|
-
emit("change", evt, (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
224
|
-
},
|
|
225
|
-
onClear(evt) {
|
|
226
|
-
emit("clear", evt);
|
|
227
|
-
}
|
|
228
|
-
}));
|
|
229
|
-
const [inputProps2] = import_recipes.inputSlotRecipe.splitVariantProps(context.value);
|
|
230
|
-
const classes = (0, import_recipes.inputSlotRecipe)(inputProps2);
|
|
231
|
-
return (0, import_vue.computed)(() => inputConnect(state.value, send, classes));
|
|
164
|
+
const [value] = import_recipes.inputSlotRecipe.splitVariantProps(context.value);
|
|
165
|
+
const classes = (0, import_recipes.inputSlotRecipe)(value);
|
|
166
|
+
return (0, import_vue.computed)(() => inputConnect(context.value, emit, classes));
|
|
232
167
|
}, "useInput");
|
|
233
168
|
|
|
234
169
|
// src/input.tsx
|
|
235
170
|
var import_pixel3_button = require("@mekari/pixel3-button");
|
|
236
|
-
var MpInput = (0,
|
|
171
|
+
var MpInput = (0, import_vue3.defineComponent)({
|
|
237
172
|
name: "MpInput",
|
|
238
173
|
props: inputProps,
|
|
239
174
|
emits: inputEmits,
|
|
175
|
+
inheritAttrs: false,
|
|
240
176
|
setup(props, {
|
|
241
|
-
emit
|
|
177
|
+
emit,
|
|
178
|
+
attrs
|
|
242
179
|
}) {
|
|
243
180
|
const {
|
|
244
181
|
as: Component
|
|
245
182
|
} = props;
|
|
246
183
|
const api = useInput(props, emit);
|
|
247
|
-
const calcSpacing = (0,
|
|
184
|
+
const calcSpacing = (0, import_vue3.ref)({
|
|
248
185
|
left: 12,
|
|
249
186
|
right: 12
|
|
250
187
|
});
|
|
251
|
-
const calcPosition = (0,
|
|
188
|
+
const calcPosition = (0, import_vue3.ref)({
|
|
252
189
|
right: 12
|
|
253
190
|
});
|
|
254
|
-
(0,
|
|
191
|
+
(0, import_vue3.onMounted)(() => {
|
|
255
192
|
var _a, _b, _c;
|
|
256
|
-
const node = (_c = (_b = (_a = (0,
|
|
193
|
+
const node = (_c = (_b = (_a = (0, import_vue3.getCurrentInstance)()) == null ? void 0 : _a.parent) == null ? void 0 : _b.subTree) == null ? void 0 : _c.children[0].children;
|
|
257
194
|
let isClearable = false;
|
|
258
195
|
node == null ? void 0 : node.map((vnode) => {
|
|
259
196
|
var _a2, _b2, _c2, _d, _e, _f;
|
|
@@ -283,13 +220,13 @@ var MpInput = (0, import_vue4.defineComponent)({
|
|
|
283
220
|
});
|
|
284
221
|
return () => {
|
|
285
222
|
var _a, _b;
|
|
286
|
-
return (0,
|
|
223
|
+
return (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(Component, (0, import_vue2.mergeProps)(api.value.controlProps, attrs, {
|
|
287
224
|
"style": {
|
|
288
225
|
"--mp-input--padding-left": `${calcSpacing.value.left}px`,
|
|
289
226
|
"--mp-input--padding-right": `${calcSpacing.value.right}px`,
|
|
290
227
|
...(_a = api.value.controlProps) == null ? void 0 : _a.style
|
|
291
228
|
}
|
|
292
|
-
}), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && (0,
|
|
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, {
|
|
293
230
|
"style": {
|
|
294
231
|
"--mp-input--right": `${calcPosition.value.right}px`,
|
|
295
232
|
...(_b = api.value.clearProps) == null ? void 0 : _b.style
|
package/dist/input.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MpInput
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-EF6JEV72.mjs";
|
|
3
|
+
} from "./chunk-6JUSM6A5.mjs";
|
|
4
|
+
import "./chunk-IP4RFVD7.mjs";
|
|
5
|
+
import "./chunk-45BJFHHR.mjs";
|
|
7
6
|
import "./chunk-ZQ2NFCFA.mjs";
|
|
8
7
|
import "./chunk-QZ7VFGWC.mjs";
|
|
9
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.
|
|
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":3403,"imports":[{"path":"@mekari/pixel3-form-control","kind":"import-statement","external":true},{"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":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/input.hooks.ts":{"bytes":1340,"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":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/input.tsx":{"bytes":3104,"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-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":1097,"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":2030,"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-form-control","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-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":2907},"src/modules/input.props.ts":{"bytesInOutput":1153},"src/modules/input.hooks.ts":{"bytesInOutput":1176},"src/modules/input.connects.ts":{"bytesInOutput":3684},"src/input-group.tsx":{"bytesInOutput":825},"src/input-addon.tsx":{"bytesInOutput":1122}},"bytes":12387},"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-form-control","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":1365},"src/modules/input.props.ts":{"bytesInOutput":392},"src/modules/input.hooks.ts":{"bytesInOutput":465},"src/modules/input.connects.ts":{"bytesInOutput":646}},"bytes":4079},"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-form-control","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":533}},"bytes":3418},"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-form-control","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-button","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/input.tsx","inputs":{"src/input.tsx":{"bytesInOutput":3032},"src/modules/input.props.ts":{"bytesInOutput":819},"src/modules/input.hooks.ts":{"bytesInOutput":452},"src/modules/input.connects.ts":{"bytesInOutput":2895}},"bytes":8351},"dist/modules/input.connects.js":{"imports":[{"path":"@mekari/pixel3-form-control","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.connects.ts","inputs":{"src/modules/input.connects.ts":{"bytesInOutput":3934}},"bytes":5005},"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-form-control","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":1397},"src/modules/input.connects.ts":{"bytesInOutput":3680}},"bytes":6198},"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}}}
|