@mekari/pixel3-input 0.0.0 → 0.0.1
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.js +66 -161
- package/dist/index.mjs +5 -6
- package/dist/input-addon.js +16 -35
- package/dist/input-addon.mjs +3 -4
- 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 -6
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { InputState,
|
|
1
|
+
import { InputState, InputClasses, InputApiMachine, InputGroupState, InputGroupApiMachine, InputAddonState, InputAddonApiMachine } from './input.types.mjs';
|
|
2
2
|
import '@mekari/pixel3-utils';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Exported input connects.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare function inputConnect(state: InputState,
|
|
9
|
-
declare function inputGroupConnect(state: InputGroupState,
|
|
10
|
-
declare function inputAddonConnect(state: InputAddonState,
|
|
8
|
+
declare function inputConnect(state: InputState, emit: CallableFunction, classes: InputClasses): InputApiMachine;
|
|
9
|
+
declare function inputGroupConnect(state: InputGroupState, classes: InputClasses): InputGroupApiMachine;
|
|
10
|
+
declare function inputAddonConnect(state: InputAddonState, classes: InputClasses): InputAddonApiMachine;
|
|
11
11
|
|
|
12
12
|
export { inputAddonConnect, inputConnect, inputGroupConnect };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { InputState,
|
|
1
|
+
import { InputState, InputClasses, InputApiMachine, InputGroupState, InputGroupApiMachine, InputAddonState, InputAddonApiMachine } from './input.types.js';
|
|
2
2
|
import '@mekari/pixel3-utils';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Exported input connects.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare function inputConnect(state: InputState,
|
|
9
|
-
declare function inputGroupConnect(state: InputGroupState,
|
|
10
|
-
declare function inputAddonConnect(state: InputAddonState,
|
|
8
|
+
declare function inputConnect(state: InputState, emit: CallableFunction, classes: InputClasses): InputApiMachine;
|
|
9
|
+
declare function inputGroupConnect(state: InputGroupState, classes: InputClasses): InputGroupApiMachine;
|
|
10
|
+
declare function inputAddonConnect(state: InputAddonState, classes: InputClasses): InputAddonApiMachine;
|
|
11
11
|
|
|
12
12
|
export { inputAddonConnect, inputConnect, inputGroupConnect };
|
|
@@ -26,8 +26,10 @@ __export(input_connects_exports, {
|
|
|
26
26
|
inputGroupConnect: () => inputGroupConnect
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(input_connects_exports);
|
|
29
|
+
var import_pixel3_form_control = require("@mekari/pixel3-form-control");
|
|
30
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
29
31
|
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
30
|
-
function inputConnect(state,
|
|
32
|
+
function inputConnect(state, emit, classes) {
|
|
31
33
|
const {
|
|
32
34
|
id,
|
|
33
35
|
modelValue,
|
|
@@ -37,70 +39,56 @@ function inputConnect(state, send, classes) {
|
|
|
37
39
|
isRequired,
|
|
38
40
|
isInvalid,
|
|
39
41
|
isFullWidth,
|
|
40
|
-
isClearable
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} = state.context;
|
|
42
|
+
isClearable
|
|
43
|
+
} = state;
|
|
44
|
+
const idx = id != null ? id : `mp-input-${(0, import_pixel3_utils.useId)()}`;
|
|
45
|
+
const formControlProp = (0, import_pixel3_form_control.useFormControlContext)();
|
|
45
46
|
return {
|
|
46
47
|
modelValue,
|
|
47
48
|
isReadOnly,
|
|
48
49
|
isDisabled,
|
|
49
50
|
isClearable,
|
|
50
51
|
rootProps: {
|
|
51
|
-
id,
|
|
52
|
+
id: idx,
|
|
52
53
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
53
54
|
"data-is-full-width": isFullWidth,
|
|
54
55
|
"data-pixel-component": "MpInput"
|
|
55
56
|
},
|
|
56
57
|
controlProps: {
|
|
57
|
-
id: `${
|
|
58
|
+
id: `${idx}-control`,
|
|
58
59
|
value: modelValue,
|
|
59
60
|
placeholder,
|
|
60
|
-
readonly: isReadOnly,
|
|
61
|
-
disabled: isDisabled,
|
|
62
|
-
required: isRequired,
|
|
61
|
+
readonly: (formControlProp == null ? void 0 : formControlProp.value.isReadOnly) || isReadOnly,
|
|
62
|
+
disabled: (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || isDisabled,
|
|
63
|
+
required: (formControlProp == null ? void 0 : formControlProp.value.isRequired) || isRequired,
|
|
63
64
|
"data-value": modelValue,
|
|
64
65
|
"data-is-full-width": isFullWidth,
|
|
65
|
-
"aria-readonly": isReadOnly,
|
|
66
|
-
"aria-disabled": isDisabled,
|
|
67
|
-
"aria-invalid": isInvalid,
|
|
68
|
-
"aria-required": isRequired,
|
|
66
|
+
"aria-readonly": (formControlProp == null ? void 0 : formControlProp.value.isReadOnly) || isReadOnly,
|
|
67
|
+
"aria-disabled": (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || isDisabled,
|
|
68
|
+
"aria-invalid": (formControlProp == null ? void 0 : formControlProp.value.isInvalid) || isInvalid,
|
|
69
|
+
"aria-required": (formControlProp == null ? void 0 : formControlProp.value.isRequired) || isRequired,
|
|
69
70
|
onInput(evt) {
|
|
70
|
-
var _a;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
74
|
-
});
|
|
75
|
-
if (onInput)
|
|
76
|
-
onInput(evt);
|
|
71
|
+
var _a, _b;
|
|
72
|
+
emit("update:modelValue", (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
73
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
77
74
|
},
|
|
78
75
|
onChange(evt) {
|
|
79
76
|
var _a;
|
|
80
|
-
|
|
81
|
-
type: "SET_VALUE",
|
|
82
|
-
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
83
|
-
});
|
|
84
|
-
if (onChange)
|
|
85
|
-
onChange(evt);
|
|
77
|
+
emit("change", evt, (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
86
78
|
},
|
|
87
79
|
class: classes.control,
|
|
88
80
|
"data-pixel-component": "MpInputControl"
|
|
89
81
|
},
|
|
90
82
|
clearProps: {
|
|
91
|
-
id: `${
|
|
83
|
+
id: `${idx}-clear`,
|
|
92
84
|
variant: "ghost",
|
|
93
85
|
size: "sm",
|
|
94
86
|
leftIcon: "reset",
|
|
95
87
|
onClick(evt) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (onInput)
|
|
101
|
-
onInput(evt);
|
|
102
|
-
if (onClear)
|
|
103
|
-
onClear(evt);
|
|
88
|
+
var _a, _b;
|
|
89
|
+
emit("update:modelValue", (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
90
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
91
|
+
emit("clear", evt);
|
|
104
92
|
},
|
|
105
93
|
class: classes.clear,
|
|
106
94
|
style: {
|
|
@@ -112,28 +100,30 @@ function inputConnect(state, send, classes) {
|
|
|
112
100
|
};
|
|
113
101
|
}
|
|
114
102
|
__name(inputConnect, "inputConnect");
|
|
115
|
-
function inputGroupConnect(state,
|
|
103
|
+
function inputGroupConnect(state, classes) {
|
|
116
104
|
const {
|
|
117
105
|
id
|
|
118
|
-
} = state
|
|
106
|
+
} = state;
|
|
107
|
+
const idx = id != null ? id : `mp-input-group-${(0, import_pixel3_utils.useId)()}`;
|
|
119
108
|
return {
|
|
120
109
|
rootProps: {
|
|
121
|
-
id,
|
|
110
|
+
id: idx,
|
|
122
111
|
class: classes.root,
|
|
123
112
|
"data-pixel-component": "MpInputGroup"
|
|
124
113
|
}
|
|
125
114
|
};
|
|
126
115
|
}
|
|
127
116
|
__name(inputGroupConnect, "inputGroupConnect");
|
|
128
|
-
function inputAddonConnect(state,
|
|
117
|
+
function inputAddonConnect(state, classes) {
|
|
129
118
|
const {
|
|
130
119
|
id,
|
|
131
120
|
placement,
|
|
132
121
|
hasBackground
|
|
133
|
-
} = state
|
|
122
|
+
} = state;
|
|
123
|
+
const idx = id != null ? id : `mp-input-addon-${(0, import_pixel3_utils.useId)()}`;
|
|
134
124
|
return {
|
|
135
125
|
rootProps: {
|
|
136
|
-
id,
|
|
126
|
+
id: idx,
|
|
137
127
|
class: classes.root,
|
|
138
128
|
"data-placement": placement,
|
|
139
129
|
"data-has-background": hasBackground,
|
|
@@ -27,62 +27,13 @@ __export(input_hooks_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(input_hooks_exports);
|
|
29
29
|
var import_vue = require("vue");
|
|
30
|
-
var import_vue2 = require("@xstate/vue");
|
|
31
|
-
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
32
30
|
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
33
31
|
|
|
34
|
-
// src/modules/input.machines.ts
|
|
35
|
-
var import_xstate = require("xstate");
|
|
36
|
-
function inputMachine(context) {
|
|
37
|
-
return (0, import_xstate.createMachine)({
|
|
38
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QEsB2AHArgFwMQGUBRAFQH0A1AQQBkBVQgbQAYBdRUdAe1mW2U9TsQAD0QBGAEwA6JrLnz5AdgA0IAJ7iJAXy2q0WPMQCaABUIUa9ZmyQguPPgKGiEEiYqkBWT00UAOADZPRQBmPwAWAE4Av1UNBDExEKlwzxCxTzFw8IDIiT9FAJ1dEFROCDghfRwhe15+QVsXEICpQrFFCXDfMKjcuPEklLSMrJy8gqLioA */
|
|
39
|
-
id: "input",
|
|
40
|
-
context: {
|
|
41
|
-
modelValue: "",
|
|
42
|
-
...context
|
|
43
|
-
},
|
|
44
|
-
on: {
|
|
45
|
-
SET_VALUE: {
|
|
46
|
-
actions: "setValue"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
predictableActionArguments: true
|
|
50
|
-
}, {
|
|
51
|
-
actions: {
|
|
52
|
-
setValue(ctx, evt) {
|
|
53
|
-
set.value(ctx, evt.value);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
__name(inputMachine, "inputMachine");
|
|
59
|
-
var set = {
|
|
60
|
-
value(ctx, value) {
|
|
61
|
-
ctx.modelValue = value;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
function inputGroupMachine(context) {
|
|
65
|
-
return (0, import_xstate.createMachine)({
|
|
66
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEMA3AgFwICcBaKCrAVwAd8RGtYBLUjrDFgD0QBGAEzoAnsJHIZyIA */
|
|
67
|
-
id: "input-group",
|
|
68
|
-
context,
|
|
69
|
-
predictableActionArguments: true
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
__name(inputGroupMachine, "inputGroupMachine");
|
|
73
|
-
function inputAddonMachine(context) {
|
|
74
|
-
return (0, import_xstate.createMachine)({
|
|
75
|
-
/** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgEsMAHAVwBcBaAQwgiw3xGK1gPIIaYA9EBGAEzoAnvwHIJyIA */
|
|
76
|
-
id: "input-addon",
|
|
77
|
-
context,
|
|
78
|
-
predictableActionArguments: true
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
__name(inputAddonMachine, "inputAddonMachine");
|
|
82
|
-
|
|
83
32
|
// src/modules/input.connects.ts
|
|
33
|
+
var import_pixel3_form_control = require("@mekari/pixel3-form-control");
|
|
34
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
84
35
|
var import_css = require("@mekari/pixel3-styled-system/css");
|
|
85
|
-
function inputConnect(state,
|
|
36
|
+
function inputConnect(state, emit, classes) {
|
|
86
37
|
const {
|
|
87
38
|
id,
|
|
88
39
|
modelValue,
|
|
@@ -92,70 +43,56 @@ function inputConnect(state, send, classes) {
|
|
|
92
43
|
isRequired,
|
|
93
44
|
isInvalid,
|
|
94
45
|
isFullWidth,
|
|
95
|
-
isClearable
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
} = state.context;
|
|
46
|
+
isClearable
|
|
47
|
+
} = state;
|
|
48
|
+
const idx = id != null ? id : `mp-input-${(0, import_pixel3_utils.useId)()}`;
|
|
49
|
+
const formControlProp = (0, import_pixel3_form_control.useFormControlContext)();
|
|
100
50
|
return {
|
|
101
51
|
modelValue,
|
|
102
52
|
isReadOnly,
|
|
103
53
|
isDisabled,
|
|
104
54
|
isClearable,
|
|
105
55
|
rootProps: {
|
|
106
|
-
id,
|
|
56
|
+
id: idx,
|
|
107
57
|
class: (0, import_css.cx)(classes.root, "group"),
|
|
108
58
|
"data-is-full-width": isFullWidth,
|
|
109
59
|
"data-pixel-component": "MpInput"
|
|
110
60
|
},
|
|
111
61
|
controlProps: {
|
|
112
|
-
id: `${
|
|
62
|
+
id: `${idx}-control`,
|
|
113
63
|
value: modelValue,
|
|
114
64
|
placeholder,
|
|
115
|
-
readonly: isReadOnly,
|
|
116
|
-
disabled: isDisabled,
|
|
117
|
-
required: isRequired,
|
|
65
|
+
readonly: (formControlProp == null ? void 0 : formControlProp.value.isReadOnly) || isReadOnly,
|
|
66
|
+
disabled: (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || isDisabled,
|
|
67
|
+
required: (formControlProp == null ? void 0 : formControlProp.value.isRequired) || isRequired,
|
|
118
68
|
"data-value": modelValue,
|
|
119
69
|
"data-is-full-width": isFullWidth,
|
|
120
|
-
"aria-readonly": isReadOnly,
|
|
121
|
-
"aria-disabled": isDisabled,
|
|
122
|
-
"aria-invalid": isInvalid,
|
|
123
|
-
"aria-required": isRequired,
|
|
70
|
+
"aria-readonly": (formControlProp == null ? void 0 : formControlProp.value.isReadOnly) || isReadOnly,
|
|
71
|
+
"aria-disabled": (formControlProp == null ? void 0 : formControlProp.value.isDisabled) || isDisabled,
|
|
72
|
+
"aria-invalid": (formControlProp == null ? void 0 : formControlProp.value.isInvalid) || isInvalid,
|
|
73
|
+
"aria-required": (formControlProp == null ? void 0 : formControlProp.value.isRequired) || isRequired,
|
|
124
74
|
onInput(evt) {
|
|
125
|
-
var _a;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
129
|
-
});
|
|
130
|
-
if (onInput)
|
|
131
|
-
onInput(evt);
|
|
75
|
+
var _a, _b;
|
|
76
|
+
emit("update:modelValue", (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
77
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
132
78
|
},
|
|
133
79
|
onChange(evt) {
|
|
134
80
|
var _a;
|
|
135
|
-
|
|
136
|
-
type: "SET_VALUE",
|
|
137
|
-
value: (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value
|
|
138
|
-
});
|
|
139
|
-
if (onChange)
|
|
140
|
-
onChange(evt);
|
|
81
|
+
emit("change", evt, (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
141
82
|
},
|
|
142
83
|
class: classes.control,
|
|
143
84
|
"data-pixel-component": "MpInputControl"
|
|
144
85
|
},
|
|
145
86
|
clearProps: {
|
|
146
|
-
id: `${
|
|
87
|
+
id: `${idx}-clear`,
|
|
147
88
|
variant: "ghost",
|
|
148
89
|
size: "sm",
|
|
149
90
|
leftIcon: "reset",
|
|
150
91
|
onClick(evt) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (onInput)
|
|
156
|
-
onInput(evt);
|
|
157
|
-
if (onClear)
|
|
158
|
-
onClear(evt);
|
|
92
|
+
var _a, _b;
|
|
93
|
+
emit("update:modelValue", (_a = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a.value);
|
|
94
|
+
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
95
|
+
emit("clear", evt);
|
|
159
96
|
},
|
|
160
97
|
class: classes.clear,
|
|
161
98
|
style: {
|
|
@@ -167,28 +104,30 @@ function inputConnect(state, send, classes) {
|
|
|
167
104
|
};
|
|
168
105
|
}
|
|
169
106
|
__name(inputConnect, "inputConnect");
|
|
170
|
-
function inputGroupConnect(state,
|
|
107
|
+
function inputGroupConnect(state, classes) {
|
|
171
108
|
const {
|
|
172
109
|
id
|
|
173
|
-
} = state
|
|
110
|
+
} = state;
|
|
111
|
+
const idx = id != null ? id : `mp-input-group-${(0, import_pixel3_utils.useId)()}`;
|
|
174
112
|
return {
|
|
175
113
|
rootProps: {
|
|
176
|
-
id,
|
|
114
|
+
id: idx,
|
|
177
115
|
class: classes.root,
|
|
178
116
|
"data-pixel-component": "MpInputGroup"
|
|
179
117
|
}
|
|
180
118
|
};
|
|
181
119
|
}
|
|
182
120
|
__name(inputGroupConnect, "inputGroupConnect");
|
|
183
|
-
function inputAddonConnect(state,
|
|
121
|
+
function inputAddonConnect(state, classes) {
|
|
184
122
|
const {
|
|
185
123
|
id,
|
|
186
124
|
placement,
|
|
187
125
|
hasBackground
|
|
188
|
-
} = state
|
|
126
|
+
} = state;
|
|
127
|
+
const idx = id != null ? id : `mp-input-addon-${(0, import_pixel3_utils.useId)()}`;
|
|
189
128
|
return {
|
|
190
129
|
rootProps: {
|
|
191
|
-
id,
|
|
130
|
+
id: idx,
|
|
192
131
|
class: classes.root,
|
|
193
132
|
"data-placement": placement,
|
|
194
133
|
"data-has-background": hasBackground,
|
|
@@ -200,58 +139,22 @@ __name(inputAddonConnect, "inputAddonConnect");
|
|
|
200
139
|
|
|
201
140
|
// src/modules/input.hooks.ts
|
|
202
141
|
var useInput = /* @__PURE__ */ __name((props, emit) => {
|
|
203
|
-
var _a;
|
|
204
142
|
const context = (0, import_vue.ref)(props);
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
} = (0, import_vue2.useMachine)(inputMachine({
|
|
209
|
-
...context.value,
|
|
210
|
-
id: (_a = context.value.id) != null ? _a : `mp-input-${(0, import_pixel3_utils.useId)()}`,
|
|
211
|
-
onInput(evt) {
|
|
212
|
-
var _a2, _b;
|
|
213
|
-
emit("update:modelValue", (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
214
|
-
emit("input", evt, (_b = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _b.value);
|
|
215
|
-
},
|
|
216
|
-
onChange(evt) {
|
|
217
|
-
var _a2;
|
|
218
|
-
emit("change", evt, (_a2 = evt == null ? void 0 : evt.currentTarget) == null ? void 0 : _a2.value);
|
|
219
|
-
},
|
|
220
|
-
onClear(evt) {
|
|
221
|
-
emit("clear", evt);
|
|
222
|
-
}
|
|
223
|
-
}));
|
|
224
|
-
const [inputProps] = import_recipes.inputSlotRecipe.splitVariantProps(context.value);
|
|
225
|
-
const classes = (0, import_recipes.inputSlotRecipe)(inputProps);
|
|
226
|
-
return (0, import_vue.computed)(() => inputConnect(state.value, send, classes));
|
|
143
|
+
const [value] = import_recipes.inputSlotRecipe.splitVariantProps(context.value);
|
|
144
|
+
const classes = (0, import_recipes.inputSlotRecipe)(value);
|
|
145
|
+
return (0, import_vue.computed)(() => inputConnect(context.value, emit, classes));
|
|
227
146
|
}, "useInput");
|
|
228
147
|
var useInputGroup = /* @__PURE__ */ __name((props) => {
|
|
229
|
-
var _a;
|
|
230
148
|
const context = (0, import_vue.ref)(props);
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
} = (0, import_vue2.useMachine)(inputGroupMachine({
|
|
235
|
-
...context.value,
|
|
236
|
-
id: (_a = context.value.id) != null ? _a : `mp-input-group-${(0, import_pixel3_utils.useId)()}`
|
|
237
|
-
}));
|
|
238
|
-
const [inputGroupProps] = import_recipes.inputGroupSlotRecipe.splitVariantProps(context.value);
|
|
239
|
-
const classes = (0, import_recipes.inputGroupSlotRecipe)(inputGroupProps);
|
|
240
|
-
return (0, import_vue.computed)(() => inputGroupConnect(state.value, send, classes));
|
|
149
|
+
const [value] = import_recipes.inputGroupSlotRecipe.splitVariantProps(context.value);
|
|
150
|
+
const classes = (0, import_recipes.inputGroupSlotRecipe)(value);
|
|
151
|
+
return (0, import_vue.computed)(() => inputGroupConnect(context.value, classes));
|
|
241
152
|
}, "useInputGroup");
|
|
242
153
|
var useInputAddon = /* @__PURE__ */ __name((props) => {
|
|
243
|
-
var _a;
|
|
244
154
|
const context = (0, import_vue.ref)(props);
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
} = (0, import_vue2.useMachine)(inputAddonMachine({
|
|
249
|
-
...context.value,
|
|
250
|
-
id: (_a = context.value.id) != null ? _a : `mp-input-addon-${(0, import_pixel3_utils.useId)()}`
|
|
251
|
-
}));
|
|
252
|
-
const [inputAddonProps] = import_recipes.inputAddonSlotRecipe.splitVariantProps(context.value);
|
|
253
|
-
const classes = (0, import_recipes.inputAddonSlotRecipe)(inputAddonProps);
|
|
254
|
-
return (0, import_vue.computed)(() => inputAddonConnect(state.value, send, classes));
|
|
155
|
+
const [value] = import_recipes.inputAddonSlotRecipe.splitVariantProps(context.value);
|
|
156
|
+
const classes = (0, import_recipes.inputAddonSlotRecipe)(value);
|
|
157
|
+
return (0, import_vue.computed)(() => inputAddonConnect(context.value, classes));
|
|
255
158
|
}, "useInputAddon");
|
|
256
159
|
// Annotate the CommonJS export names for ESM import in node:
|
|
257
160
|
0 && (module.exports = {
|
|
@@ -2,9 +2,8 @@ import {
|
|
|
2
2
|
useInput,
|
|
3
3
|
useInputAddon,
|
|
4
4
|
useInputGroup
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-EF6JEV72.mjs";
|
|
5
|
+
} from "../chunk-IP4RFVD7.mjs";
|
|
6
|
+
import "../chunk-45BJFHHR.mjs";
|
|
8
7
|
import "../chunk-QZ7VFGWC.mjs";
|
|
9
8
|
export {
|
|
10
9
|
useInput,
|
|
@@ -58,20 +58,16 @@ interface InputGroupApiMachine<T extends PropTypes = PropTypes> {
|
|
|
58
58
|
interface InputAddonApiMachine<T extends PropTypes = PropTypes> {
|
|
59
59
|
rootProps?: T['element'];
|
|
60
60
|
}
|
|
61
|
-
interface InputState {
|
|
62
|
-
context: InputProps;
|
|
61
|
+
interface InputState extends InputProps {
|
|
63
62
|
}
|
|
64
|
-
interface InputGroupState {
|
|
65
|
-
context: InputGroupProps;
|
|
63
|
+
interface InputGroupState extends InputGroupProps {
|
|
66
64
|
}
|
|
67
|
-
interface InputAddonState {
|
|
68
|
-
context: InputAddonProps;
|
|
65
|
+
interface InputAddonState extends InputAddonProps {
|
|
69
66
|
}
|
|
70
|
-
type InputSend = CallableFunction;
|
|
71
67
|
interface InputClasses {
|
|
72
68
|
root?: string;
|
|
73
69
|
control?: string;
|
|
74
70
|
clear?: string;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
|
-
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps,
|
|
73
|
+
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps, InputSize, InputState, InputVNode, InputVariant };
|
|
@@ -58,20 +58,16 @@ interface InputGroupApiMachine<T extends PropTypes = PropTypes> {
|
|
|
58
58
|
interface InputAddonApiMachine<T extends PropTypes = PropTypes> {
|
|
59
59
|
rootProps?: T['element'];
|
|
60
60
|
}
|
|
61
|
-
interface InputState {
|
|
62
|
-
context: InputProps;
|
|
61
|
+
interface InputState extends InputProps {
|
|
63
62
|
}
|
|
64
|
-
interface InputGroupState {
|
|
65
|
-
context: InputGroupProps;
|
|
63
|
+
interface InputGroupState extends InputGroupProps {
|
|
66
64
|
}
|
|
67
|
-
interface InputAddonState {
|
|
68
|
-
context: InputAddonProps;
|
|
65
|
+
interface InputAddonState extends InputAddonProps {
|
|
69
66
|
}
|
|
70
|
-
type InputSend = CallableFunction;
|
|
71
67
|
interface InputClasses {
|
|
72
68
|
root?: string;
|
|
73
69
|
control?: string;
|
|
74
70
|
clear?: string;
|
|
75
71
|
}
|
|
76
72
|
|
|
77
|
-
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps,
|
|
73
|
+
export { InputAddonApiMachine, InputAddonDefinedContext, InputAddonPlacement, InputAddonProps, InputAddonState, InputApiMachine, InputClasses, InputDefinedContext, InputGroupApiMachine, InputGroupDefinedContext, InputGroupProps, InputGroupState, InputProps, InputSize, InputState, InputVNode, InputVariant };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.1",
|
|
5
5
|
"license": "LGPL-3.0",
|
|
6
6
|
"author": "Dirga Prakesha <dirga.prakesha@mekari.com>",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@
|
|
14
|
-
"
|
|
15
|
-
"@mekari/pixel3-button": "0.0.
|
|
16
|
-
"@mekari/pixel3-
|
|
17
|
-
"@mekari/pixel3-utils": "0.0.0"
|
|
13
|
+
"@mekari/pixel3-form-control": "0.0.1",
|
|
14
|
+
"@mekari/pixel3-styled-system": "0.0.1",
|
|
15
|
+
"@mekari/pixel3-button": "0.0.1",
|
|
16
|
+
"@mekari/pixel3-utils": "0.0.1"
|
|
18
17
|
},
|
|
19
18
|
"peerDependencies": {
|
|
20
19
|
"vue": "^3.3.7"
|
package/dist/chunk-EF6JEV72.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
};
|