@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
MpInput: () => MpInput,
|
|
25
|
+
MpInputGroup: () => MpInputGroup,
|
|
26
|
+
MpInputLeftAddon: () => MpInputLeftAddon,
|
|
27
|
+
MpInputRightAddon: () => MpInputRightAddon
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(src_exports);
|
|
30
|
+
|
|
31
|
+
// src/input.tsx
|
|
32
|
+
var import_vue3 = require("vue");
|
|
33
|
+
var import_vue4 = require("vue");
|
|
34
|
+
|
|
35
|
+
// src/modules/input.props.ts
|
|
36
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
37
|
+
var inputProps = {
|
|
38
|
+
as: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "input"
|
|
41
|
+
},
|
|
42
|
+
modelValue: {
|
|
43
|
+
type: [String, Number]
|
|
44
|
+
},
|
|
45
|
+
id: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "md"
|
|
51
|
+
},
|
|
52
|
+
variant: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "outline"
|
|
55
|
+
},
|
|
56
|
+
placeholder: {
|
|
57
|
+
type: String
|
|
58
|
+
},
|
|
59
|
+
isReadOnly: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
isDisabled: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
isRequired: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
isInvalid: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
isFullWidth: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
78
|
+
},
|
|
79
|
+
isClearable: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var inputGroupProps = {
|
|
85
|
+
id: {
|
|
86
|
+
type: String
|
|
87
|
+
},
|
|
88
|
+
size: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: "md"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var inputAddonProps = {
|
|
94
|
+
id: {
|
|
95
|
+
type: String
|
|
96
|
+
},
|
|
97
|
+
size: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: "md"
|
|
100
|
+
},
|
|
101
|
+
placement: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: "left"
|
|
104
|
+
},
|
|
105
|
+
hasBackground: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var inputEmits = (0, import_pixel3_utils.declareEmit)(["change", "input", "clear", "update:modelValue"]);
|
|
111
|
+
|
|
112
|
+
// src/modules/input.hooks.ts
|
|
113
|
+
var import_vue = require("vue");
|
|
114
|
+
var import_vue2 = require("@xstate/vue");
|
|
115
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
116
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
117
|
+
|
|
118
|
+
// src/modules/input.machines.ts
|
|
119
|
+
var import_xstate = require("xstate");
|
|
120
|
+
function inputMachine(context) {
|
|
121
|
+
return (0, import_xstate.createMachine)({
|
|
122
|
+
/** @xstate-layout N4IgpgJg5mDOIC5QEsB2AHArgFwMQGUBRAFQH0A1AQQBkBVQgbQAYBdRUdAe1mW2U9TsQAD0QBGAEwA6JrLnz5AdgA0IAJ7iJAXy2q0WPMQCaABUIUa9ZmyQguPPgKGiEEiYqkBWT00UAOADZPRQBmPwAWAE4Av1UNBDExEKlwzxCxTzFw8IDIiT9FAJ1dEFROCDghfRwhe15+QVsXEICpQrFFCXDfMKjcuPEklLSMrJy8gqLioA */
|
|
123
|
+
id: "input",
|
|
124
|
+
context: {
|
|
125
|
+
modelValue: "",
|
|
126
|
+
...context
|
|
127
|
+
},
|
|
128
|
+
on: {
|
|
129
|
+
SET_VALUE: {
|
|
130
|
+
actions: "setValue"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
predictableActionArguments: true
|
|
134
|
+
}, {
|
|
135
|
+
actions: {
|
|
136
|
+
setValue(ctx, evt) {
|
|
137
|
+
set.value(ctx, evt.value);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
__name(inputMachine, "inputMachine");
|
|
143
|
+
var set = {
|
|
144
|
+
value(ctx, value) {
|
|
145
|
+
ctx.modelValue = value;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function inputGroupMachine(context) {
|
|
149
|
+
return (0, import_xstate.createMachine)({
|
|
150
|
+
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
151
|
+
id: "input-group",
|
|
152
|
+
context,
|
|
153
|
+
predictableActionArguments: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
__name(inputGroupMachine, "inputGroupMachine");
|
|
157
|
+
function inputAddonMachine(context) {
|
|
158
|
+
return (0, import_xstate.createMachine)({
|
|
159
|
+
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEsMAHAVwBcBaAQwgiw3xGK1gPIIaYA9EBGAEzoAnvwHIJyIA */
|
|
160
|
+
id: "input-addon",
|
|
161
|
+
context,
|
|
162
|
+
predictableActionArguments: true
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
__name(inputAddonMachine, "inputAddonMachine");
|
|
166
|
+
|
|
167
|
+
// src/modules/input.connects.ts
|
|
168
|
+
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
169
|
+
function inputConnect(state, send, classes) {
|
|
170
|
+
const {
|
|
171
|
+
id,
|
|
172
|
+
modelValue,
|
|
173
|
+
placeholder,
|
|
174
|
+
isReadOnly,
|
|
175
|
+
isDisabled,
|
|
176
|
+
isRequired,
|
|
177
|
+
isInvalid,
|
|
178
|
+
isFullWidth,
|
|
179
|
+
isClearable,
|
|
180
|
+
onInput,
|
|
181
|
+
onChange,
|
|
182
|
+
onClear
|
|
183
|
+
} = state.context;
|
|
184
|
+
return {
|
|
185
|
+
modelValue,
|
|
186
|
+
isReadOnly,
|
|
187
|
+
isDisabled,
|
|
188
|
+
isClearable,
|
|
189
|
+
rootProps: {
|
|
190
|
+
id,
|
|
191
|
+
class: (0, import_css.cx)(classes.root, "group"),
|
|
192
|
+
"data-is-full-width": isFullWidth,
|
|
193
|
+
"data-pixel-component": "MpInput"
|
|
194
|
+
},
|
|
195
|
+
controlProps: {
|
|
196
|
+
id: `${id}-control`,
|
|
197
|
+
value: modelValue,
|
|
198
|
+
placeholder,
|
|
199
|
+
readonly: isReadOnly,
|
|
200
|
+
disabled: isDisabled,
|
|
201
|
+
required: isRequired,
|
|
202
|
+
"data-value": modelValue,
|
|
203
|
+
"data-is-full-width": isFullWidth,
|
|
204
|
+
"aria-readonly": isReadOnly,
|
|
205
|
+
"aria-disabled": isDisabled,
|
|
206
|
+
"aria-invalid": isInvalid,
|
|
207
|
+
"aria-required": isRequired,
|
|
208
|
+
onInput(evt) {
|
|
209
|
+
var _a;
|
|
210
|
+
send({
|
|
211
|
+
type: "SET_VALUE",
|
|
212
|
+
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
213
|
+
});
|
|
214
|
+
if (onInput)
|
|
215
|
+
onInput(evt);
|
|
216
|
+
},
|
|
217
|
+
onChange(evt) {
|
|
218
|
+
var _a;
|
|
219
|
+
send({
|
|
220
|
+
type: "SET_VALUE",
|
|
221
|
+
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
222
|
+
});
|
|
223
|
+
if (onChange)
|
|
224
|
+
onChange(evt);
|
|
225
|
+
},
|
|
226
|
+
class: classes.control,
|
|
227
|
+
"data-pixel-component": "MpInputControl"
|
|
228
|
+
},
|
|
229
|
+
clearProps: {
|
|
230
|
+
id: `${id}-clear`,
|
|
231
|
+
variant: "ghost",
|
|
232
|
+
size: "sm",
|
|
233
|
+
leftIcon: "reset",
|
|
234
|
+
onClick(evt) {
|
|
235
|
+
send({
|
|
236
|
+
type: "SET_VALUE",
|
|
237
|
+
value: null
|
|
238
|
+
});
|
|
239
|
+
if (onInput)
|
|
240
|
+
onInput(evt);
|
|
241
|
+
if (onClear)
|
|
242
|
+
onClear(evt);
|
|
243
|
+
},
|
|
244
|
+
class: classes.clear,
|
|
245
|
+
style: {
|
|
246
|
+
"--mp-input--visibility": modelValue ? "visible" : "hidden",
|
|
247
|
+
"--mp-input--opacity": modelValue ? "1" : "0"
|
|
248
|
+
},
|
|
249
|
+
"data-pixel-component": "MpInputClear"
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
__name(inputConnect, "inputConnect");
|
|
254
|
+
function inputGroupConnect(state, send, classes) {
|
|
255
|
+
const {
|
|
256
|
+
id
|
|
257
|
+
} = state.context;
|
|
258
|
+
return {
|
|
259
|
+
rootProps: {
|
|
260
|
+
id,
|
|
261
|
+
class: classes.root,
|
|
262
|
+
"data-pixel-component": "MpInputGroup"
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
__name(inputGroupConnect, "inputGroupConnect");
|
|
267
|
+
function inputAddonConnect(state, send, classes) {
|
|
268
|
+
const {
|
|
269
|
+
id,
|
|
270
|
+
placement,
|
|
271
|
+
hasBackground
|
|
272
|
+
} = state.context;
|
|
273
|
+
return {
|
|
274
|
+
rootProps: {
|
|
275
|
+
id,
|
|
276
|
+
class: classes.root,
|
|
277
|
+
"data-placement": placement,
|
|
278
|
+
"data-has-background": hasBackground,
|
|
279
|
+
"data-pixel-component": "MpInputAddon"
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
__name(inputAddonConnect, "inputAddonConnect");
|
|
284
|
+
|
|
285
|
+
// src/modules/input.hooks.ts
|
|
286
|
+
var useInput = /* @__PURE__ */ __name((props, emit) => {
|
|
287
|
+
var _a;
|
|
288
|
+
const context = (0, import_vue.ref)(props);
|
|
289
|
+
const {
|
|
290
|
+
state,
|
|
291
|
+
send
|
|
292
|
+
} = (0, import_vue2.useMachine)(inputMachine({
|
|
293
|
+
...context.value,
|
|
294
|
+
id: (_a = context.value.id) != null ? _a : `mp-input-${(0, import_pixel3_utils2.useId)()}`,
|
|
295
|
+
onInput(evt) {
|
|
296
|
+
var _a2, _b;
|
|
297
|
+
emit("update:modelValue", (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
298
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
299
|
+
},
|
|
300
|
+
onChange(evt) {
|
|
301
|
+
var _a2;
|
|
302
|
+
emit("change", evt, (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
303
|
+
},
|
|
304
|
+
onClear(evt) {
|
|
305
|
+
emit("clear", evt);
|
|
306
|
+
}
|
|
307
|
+
}));
|
|
308
|
+
const [inputProps2] = import_recipes.inputSlotRecipe.splitVariantProps(context.value);
|
|
309
|
+
const classes = (0, import_recipes.inputSlotRecipe)(inputProps2);
|
|
310
|
+
return (0, import_vue.computed)(() => inputConnect(state.value, send, classes));
|
|
311
|
+
}, "useInput");
|
|
312
|
+
var useInputGroup = /* @__PURE__ */ __name((props) => {
|
|
313
|
+
var _a;
|
|
314
|
+
const context = (0, import_vue.ref)(props);
|
|
315
|
+
const {
|
|
316
|
+
state,
|
|
317
|
+
send
|
|
318
|
+
} = (0, import_vue2.useMachine)(inputGroupMachine({
|
|
319
|
+
...context.value,
|
|
320
|
+
id: (_a = context.value.id) != null ? _a : `mp-input-group-${(0, import_pixel3_utils2.useId)()}`
|
|
321
|
+
}));
|
|
322
|
+
const [inputGroupProps2] = import_recipes.inputGroupSlotRecipe.splitVariantProps(context.value);
|
|
323
|
+
const classes = (0, import_recipes.inputGroupSlotRecipe)(inputGroupProps2);
|
|
324
|
+
return (0, import_vue.computed)(() => inputGroupConnect(state.value, send, classes));
|
|
325
|
+
}, "useInputGroup");
|
|
326
|
+
var useInputAddon = /* @__PURE__ */ __name((props) => {
|
|
327
|
+
var _a;
|
|
328
|
+
const context = (0, import_vue.ref)(props);
|
|
329
|
+
const {
|
|
330
|
+
state,
|
|
331
|
+
send
|
|
332
|
+
} = (0, import_vue2.useMachine)(inputAddonMachine({
|
|
333
|
+
...context.value,
|
|
334
|
+
id: (_a = context.value.id) != null ? _a : `mp-input-addon-${(0, import_pixel3_utils2.useId)()}`
|
|
335
|
+
}));
|
|
336
|
+
const [inputAddonProps2] = import_recipes.inputAddonSlotRecipe.splitVariantProps(context.value);
|
|
337
|
+
const classes = (0, import_recipes.inputAddonSlotRecipe)(inputAddonProps2);
|
|
338
|
+
return (0, import_vue.computed)(() => inputAddonConnect(state.value, send, classes));
|
|
339
|
+
}, "useInputAddon");
|
|
340
|
+
|
|
341
|
+
// src/input.tsx
|
|
342
|
+
var import_pixel3_button = require("@mekari/pixel3-button");
|
|
343
|
+
var MpInput = (0, import_vue4.defineComponent)({
|
|
344
|
+
name: "MpInput",
|
|
345
|
+
props: inputProps,
|
|
346
|
+
emits: inputEmits,
|
|
347
|
+
setup(props, {
|
|
348
|
+
emit
|
|
349
|
+
}) {
|
|
350
|
+
const {
|
|
351
|
+
as: Component
|
|
352
|
+
} = props;
|
|
353
|
+
const api = useInput(props, emit);
|
|
354
|
+
const calcSpacing = (0, import_vue4.ref)({
|
|
355
|
+
left: 12,
|
|
356
|
+
right: 12
|
|
357
|
+
});
|
|
358
|
+
const calcPosition = (0, import_vue4.ref)({
|
|
359
|
+
right: 12
|
|
360
|
+
});
|
|
361
|
+
(0, import_vue4.onMounted)(() => {
|
|
362
|
+
var _a, _b, _c;
|
|
363
|
+
const node = (_c = (_b = (_a = (0, import_vue4.getCurrentInstance)()) == null ? void 0 : _a.parent) == null ? void 0 : _b.subTree) == null ? void 0 : _c.children[0].children;
|
|
364
|
+
let isClearable = false;
|
|
365
|
+
node == null ? void 0 : node.map((vnode) => {
|
|
366
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
367
|
+
if (((_a2 = vnode.type) == null ? void 0 : _a2.name) === "MpInput") {
|
|
368
|
+
if ((_b2 = vnode.props) == null ? void 0 : _b2.hasOwnProperty("isClearable")) {
|
|
369
|
+
calcSpacing.value.right += 30;
|
|
370
|
+
isClearable = true;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (((_c2 = vnode.type) == null ? void 0 : _c2.name) === "MpInputLeftAddon") {
|
|
374
|
+
calcSpacing.value.left += 30;
|
|
375
|
+
if ((_d = vnode.props) == null ? void 0 : _d.hasOwnProperty("hasBackground"))
|
|
376
|
+
calcSpacing.value.left += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
377
|
+
}
|
|
378
|
+
if (((_e = vnode.type) == null ? void 0 : _e.name) === "MpInputRightAddon") {
|
|
379
|
+
calcSpacing.value.right += 30;
|
|
380
|
+
if ((_f = vnode.props) == null ? void 0 : _f.hasOwnProperty("hasBackground")) {
|
|
381
|
+
calcSpacing.value.right += parseInt(getComputedStyle(vnode.el).width, 10) - 30;
|
|
382
|
+
if (isClearable)
|
|
383
|
+
calcPosition.value.right += parseInt(getComputedStyle(vnode.el).width, 10);
|
|
384
|
+
} else {
|
|
385
|
+
if (isClearable)
|
|
386
|
+
calcPosition.value.right += 30;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
return () => {
|
|
392
|
+
var _a, _b;
|
|
393
|
+
return (0, import_vue3.createVNode)("div", api.value.rootProps, [(0, import_vue3.createVNode)(Component, (0, import_vue3.mergeProps)(api.value.controlProps, {
|
|
394
|
+
"style": {
|
|
395
|
+
"--mp-input--padding-left": `${calcSpacing.value.left}px`,
|
|
396
|
+
"--mp-input--padding-right": `${calcSpacing.value.right}px`,
|
|
397
|
+
...(_a = api.value.controlProps) == null ? void 0 : _a.style
|
|
398
|
+
}
|
|
399
|
+
}), null), !api.value.isReadOnly && !api.value.isDisabled && api.value.isClearable && (0, import_vue3.createVNode)(import_pixel3_button.MpButton, (0, import_vue3.mergeProps)(api.value.clearProps, {
|
|
400
|
+
"style": {
|
|
401
|
+
"--mp-input--right": `${calcPosition.value.right}px`,
|
|
402
|
+
...(_b = api.value.clearProps) == null ? void 0 : _b.style
|
|
403
|
+
}
|
|
404
|
+
}), null)]);
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// src/input-group.tsx
|
|
410
|
+
var import_vue5 = require("vue");
|
|
411
|
+
var import_vue6 = require("vue");
|
|
412
|
+
var import_pixel3_utils3 = require("@mekari/pixel3-utils");
|
|
413
|
+
var MpInputGroup = (0, import_vue6.defineComponent)({
|
|
414
|
+
name: "MpInputGroup",
|
|
415
|
+
props: inputGroupProps,
|
|
416
|
+
setup(props, {
|
|
417
|
+
slots
|
|
418
|
+
}) {
|
|
419
|
+
const api = useInputGroup(props);
|
|
420
|
+
const children = (0, import_vue6.computed)(() => (0, import_pixel3_utils3.getChildren)(slots));
|
|
421
|
+
const cloneChildren = (0, import_vue6.computed)(() => (0, import_vue6.computed)(() => children.value).value.map((vnode) => {
|
|
422
|
+
const overrideProps = (0, import_pixel3_utils3.objectFilterUndefined)({
|
|
423
|
+
size: props.size
|
|
424
|
+
});
|
|
425
|
+
return (0, import_vue6.cloneVNode)(vnode, overrideProps);
|
|
426
|
+
}));
|
|
427
|
+
return () => (0, import_vue5.createVNode)("div", api.value.rootProps, [cloneChildren.value]);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
// src/input-addon.tsx
|
|
432
|
+
var import_vue7 = require("vue");
|
|
433
|
+
var import_vue8 = require("vue");
|
|
434
|
+
var MpInputAddon = (0, import_vue8.defineComponent)({
|
|
435
|
+
name: "MpInputAddon",
|
|
436
|
+
props: inputAddonProps,
|
|
437
|
+
setup(props, {
|
|
438
|
+
slots
|
|
439
|
+
}) {
|
|
440
|
+
const api = useInputAddon(props);
|
|
441
|
+
return () => {
|
|
442
|
+
var _a;
|
|
443
|
+
return (0, import_vue7.createVNode)("div", api.value.rootProps, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
var MpInputLeftAddon = (0, import_vue8.defineComponent)({
|
|
448
|
+
name: "MpInputLeftAddon",
|
|
449
|
+
setup(_, {
|
|
450
|
+
slots
|
|
451
|
+
}) {
|
|
452
|
+
return () => (0, import_vue7.createVNode)(MpInputAddon, {
|
|
453
|
+
"placement": "left"
|
|
454
|
+
}, {
|
|
455
|
+
default: () => {
|
|
456
|
+
var _a;
|
|
457
|
+
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
var MpInputRightAddon = (0, import_vue8.defineComponent)({
|
|
463
|
+
name: "MpInputRightAddon",
|
|
464
|
+
setup(_, {
|
|
465
|
+
slots
|
|
466
|
+
}) {
|
|
467
|
+
return () => (0, import_vue7.createVNode)(MpInputAddon, {
|
|
468
|
+
"placement": "right"
|
|
469
|
+
}, {
|
|
470
|
+
default: () => {
|
|
471
|
+
var _a;
|
|
472
|
+
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
478
|
+
0 && (module.exports = {
|
|
479
|
+
MpInput,
|
|
480
|
+
MpInputGroup,
|
|
481
|
+
MpInputLeftAddon,
|
|
482
|
+
MpInputRightAddon
|
|
483
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MpInputLeftAddon,
|
|
3
|
+
MpInputRightAddon
|
|
4
|
+
} from "./chunk-JW2SLWRV.mjs";
|
|
5
|
+
import {
|
|
6
|
+
MpInputGroup
|
|
7
|
+
} from "./chunk-62L6URRB.mjs";
|
|
8
|
+
import {
|
|
9
|
+
MpInput
|
|
10
|
+
} from "./chunk-AH5Q4AP2.mjs";
|
|
11
|
+
import "./chunk-ME6YL7P6.mjs";
|
|
12
|
+
import "./chunk-T766ACNL.mjs";
|
|
13
|
+
import "./chunk-EF6JEV72.mjs";
|
|
14
|
+
import "./chunk-ZQ2NFCFA.mjs";
|
|
15
|
+
import "./chunk-QZ7VFGWC.mjs";
|
|
16
|
+
export {
|
|
17
|
+
MpInput,
|
|
18
|
+
MpInputGroup,
|
|
19
|
+
MpInputLeftAddon,
|
|
20
|
+
MpInputRightAddon
|
|
21
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { InputSize, InputAddonPlacement } from './modules/input.types.mjs';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import '@mekari/pixel3-utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MpInputAddon used to append or prepend element.
|
|
7
|
+
*/
|
|
8
|
+
declare const MpInputAddon: vue.DefineComponent<{
|
|
9
|
+
id: {
|
|
10
|
+
type: vue.PropType<string | undefined>;
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
type: vue.PropType<InputSize | undefined>;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
placement: {
|
|
17
|
+
type: vue.PropType<InputAddonPlacement | undefined>;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
hasBackground: {
|
|
21
|
+
type: vue.PropType<boolean | undefined>;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
25
|
+
id: {
|
|
26
|
+
type: vue.PropType<string | undefined>;
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
type: vue.PropType<InputSize | undefined>;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
placement: {
|
|
33
|
+
type: vue.PropType<InputAddonPlacement | undefined>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
hasBackground: {
|
|
37
|
+
type: vue.PropType<boolean | undefined>;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
}>>, {
|
|
41
|
+
size: InputSize | undefined;
|
|
42
|
+
placement: InputAddonPlacement | undefined;
|
|
43
|
+
hasBackground: boolean | undefined;
|
|
44
|
+
}, {}>;
|
|
45
|
+
declare const MpInputLeftAddon: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
46
|
+
declare const MpInputRightAddon: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
47
|
+
|
|
48
|
+
export { MpInputAddon, MpInputLeftAddon, MpInputRightAddon };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { InputSize, InputAddonPlacement } from './modules/input.types.js';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import '@mekari/pixel3-utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MpInputAddon used to append or prepend element.
|
|
7
|
+
*/
|
|
8
|
+
declare const MpInputAddon: vue.DefineComponent<{
|
|
9
|
+
id: {
|
|
10
|
+
type: vue.PropType<string | undefined>;
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
type: vue.PropType<InputSize | undefined>;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
placement: {
|
|
17
|
+
type: vue.PropType<InputAddonPlacement | undefined>;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
hasBackground: {
|
|
21
|
+
type: vue.PropType<boolean | undefined>;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
25
|
+
id: {
|
|
26
|
+
type: vue.PropType<string | undefined>;
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
type: vue.PropType<InputSize | undefined>;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
placement: {
|
|
33
|
+
type: vue.PropType<InputAddonPlacement | undefined>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
hasBackground: {
|
|
37
|
+
type: vue.PropType<boolean | undefined>;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
}>>, {
|
|
41
|
+
size: InputSize | undefined;
|
|
42
|
+
placement: InputAddonPlacement | undefined;
|
|
43
|
+
hasBackground: boolean | undefined;
|
|
44
|
+
}, {}>;
|
|
45
|
+
declare const MpInputLeftAddon: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
46
|
+
declare const MpInputRightAddon: vue.DefineComponent<{}, () => JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
47
|
+
|
|
48
|
+
export { MpInputAddon, MpInputLeftAddon, MpInputRightAddon };
|