@plastic-js/tsumiki 0.1.78 → 0.1.80
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/components/Input.js +12 -2
- package/package.json +1 -1
package/dist/components/Input.js
CHANGED
|
@@ -160,6 +160,7 @@ var Input = (props = {}) => {
|
|
|
160
160
|
]);
|
|
161
161
|
const showPassword = createSignal(false);
|
|
162
162
|
const isPassword = read(local.type) === "password";
|
|
163
|
+
let inputEl = null;
|
|
163
164
|
const hasPrefix = () => read(local.prefix) != null;
|
|
164
165
|
const hasSuffix = () => read(local.suffix) != null || isPassword;
|
|
165
166
|
const field = useFieldContext();
|
|
@@ -187,12 +188,20 @@ var Input = (props = {}) => {
|
|
|
187
188
|
if (!isPassword) return read(local.type);
|
|
188
189
|
return showPassword() ? "text" : "password";
|
|
189
190
|
};
|
|
191
|
+
const handleAffixPointerDown = (e) => {
|
|
192
|
+
if (effectiveDisabled()) return;
|
|
193
|
+
const target = e.target;
|
|
194
|
+
if (target && target.closest && target.closest("button, a, input, select, textarea, label, [contenteditable]")) return;
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
inputEl?.focus();
|
|
197
|
+
};
|
|
190
198
|
const renderAffix = (content) => {
|
|
191
199
|
if (content == null) return null;
|
|
192
200
|
return () => {
|
|
193
201
|
const _el0 = _tmpl.cloneNode(true);
|
|
194
202
|
insert(_el0, () => content);
|
|
195
203
|
setProp(_el0, "className", () => affixClass);
|
|
204
|
+
setProp(_el0, "onPointerDown", () => handleAffixPointerDown);
|
|
196
205
|
return _el0;
|
|
197
206
|
};
|
|
198
207
|
};
|
|
@@ -206,8 +215,9 @@ var Input = (props = {}) => {
|
|
|
206
215
|
if (p == null) return null;
|
|
207
216
|
return renderAffix(p);
|
|
208
217
|
}, _el1);
|
|
209
|
-
insert(_el0, () => jsx(ark$1.input, mergeProps({
|
|
210
|
-
|
|
218
|
+
insert(_el0, () => jsx(ark$1.input, mergeProps({ ref: (el) => {
|
|
219
|
+
inputEl = el;
|
|
220
|
+
if (typeof local.ref === "function") local.ref(el);
|
|
211
221
|
} }, () => field ? field.getInputProps() : {}, rest, {
|
|
212
222
|
type: inputType,
|
|
213
223
|
"aria-invalid": () => effectiveInvalid() ? "true" : "false",
|