@nexdom/uimed-vue 2.0.0-beta.41 → 2.0.0-beta.42
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.d.ts +1 -1
- package/dist/components.js +28 -29
- package/package.json +1 -1
package/dist/components.d.ts
CHANGED
|
@@ -463,8 +463,8 @@ declare const __VLS_export$16: import("vue", { with: { "resolution-mode": "impor
|
|
|
463
463
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
464
464
|
}>, {
|
|
465
465
|
variant: TextFieldVariant;
|
|
466
|
-
clearable: boolean;
|
|
467
466
|
type: TextFieldType;
|
|
467
|
+
clearable: boolean;
|
|
468
468
|
}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
|
|
469
469
|
//#endregion
|
|
470
470
|
//#region src/components/inputs/checkbox/types.d.ts
|
package/dist/components.js
CHANGED
|
@@ -488,25 +488,41 @@ function useTextFieldType(type, isPasswordVisible) {
|
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
491
|
-
* Controls the
|
|
492
|
-
*
|
|
493
|
-
* `
|
|
491
|
+
* Controls the icon at the end of the field: a decorative magnifier on
|
|
492
|
+
* `search`, and the toggle that shows or hides the value on `password`. The
|
|
493
|
+
* toggle works with click, `Enter` and `Space`, does nothing while disabled,
|
|
494
|
+
* and the password hides again whenever the type stops being `password`.
|
|
494
495
|
*/
|
|
495
|
-
function
|
|
496
|
+
function useTextFieldAppendIcon(type, disabled) {
|
|
496
497
|
const isPasswordField = computed(() => toValue(type) === "password");
|
|
497
498
|
const isPasswordVisible = ref(false);
|
|
498
|
-
const icon = computed(() => isPasswordVisible.value ? "mdi-eye-off" : "mdi-eye");
|
|
499
499
|
watch(isPasswordField, () => {
|
|
500
500
|
isPasswordVisible.value = false;
|
|
501
501
|
});
|
|
502
502
|
function toggle() {
|
|
503
|
+
if (toValue(disabled)) return;
|
|
503
504
|
isPasswordVisible.value = !isPasswordVisible.value;
|
|
504
505
|
}
|
|
506
|
+
function onKeydown(event) {
|
|
507
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
event.stopPropagation();
|
|
510
|
+
toggle();
|
|
511
|
+
}
|
|
512
|
+
const iconProps = computed(() => {
|
|
513
|
+
if (toValue(type) === "search") return { icon: "mdi-magnify" };
|
|
514
|
+
if (!isPasswordField.value) return void 0;
|
|
515
|
+
return {
|
|
516
|
+
icon: isPasswordVisible.value ? "mdi-eye-off" : "mdi-eye",
|
|
517
|
+
"aria-label": "Mostrar senha",
|
|
518
|
+
"aria-pressed": isPasswordVisible.value,
|
|
519
|
+
onClick: toggle,
|
|
520
|
+
onKeydown
|
|
521
|
+
};
|
|
522
|
+
});
|
|
505
523
|
return {
|
|
506
|
-
isPasswordField,
|
|
507
524
|
isPasswordVisible: readonly(isPasswordVisible),
|
|
508
|
-
|
|
509
|
-
toggle
|
|
525
|
+
iconProps
|
|
510
526
|
};
|
|
511
527
|
}
|
|
512
528
|
function useTextFieldRules(props) {
|
|
@@ -614,12 +630,10 @@ var text_field_default = /* @__PURE__ */ defineComponent({
|
|
|
614
630
|
const modelValue = useModel(__props, "modelValue");
|
|
615
631
|
const props = __props;
|
|
616
632
|
const vuetifyVariant = useTextFieldVariant(() => props.variant);
|
|
617
|
-
const {
|
|
633
|
+
const { isPasswordVisible, iconProps: appendIconProps } = useTextFieldAppendIcon(() => props.type, () => props.disabled);
|
|
618
634
|
const vuetifyType = useTextFieldType(() => props.type, isPasswordVisible);
|
|
619
635
|
const rules = useTextFieldRules(props);
|
|
620
|
-
const
|
|
621
|
-
const computedClearable = computed(() => props.clearable ?? isSearchField.value);
|
|
622
|
-
const appendIcon = computed(() => isSearchField.value ? "mdi-magnify" : void 0);
|
|
636
|
+
const computedClearable = computed(() => props.clearable ?? props.type === "search");
|
|
623
637
|
function clear() {
|
|
624
638
|
modelValue.value = "";
|
|
625
639
|
}
|
|
@@ -629,7 +643,6 @@ var text_field_default = /* @__PURE__ */ defineComponent({
|
|
|
629
643
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
630
644
|
variant: unref(vuetifyVariant),
|
|
631
645
|
type: unref(vuetifyType),
|
|
632
|
-
"append-inner-icon": appendIcon.value,
|
|
633
646
|
rules: unref(rules),
|
|
634
647
|
"data-testid": props.dataTestid,
|
|
635
648
|
disabled: props.disabled,
|
|
@@ -644,28 +657,14 @@ var text_field_default = /* @__PURE__ */ defineComponent({
|
|
|
644
657
|
}, createSlots({
|
|
645
658
|
loader: withCtx((loader) => [createVNode(field_loader_default, normalizeProps(guardReactiveProps(loader)), null, 16)]),
|
|
646
659
|
_: 2
|
|
647
|
-
}, [unref(
|
|
660
|
+
}, [unref(appendIconProps) ? {
|
|
648
661
|
name: "append-inner",
|
|
649
|
-
fn: withCtx(() => [createVNode(unref(
|
|
650
|
-
icon: unref(passwordToggleIcon),
|
|
651
|
-
"aria-label": "Mostrar senha",
|
|
652
|
-
"aria-pressed": unref(isPasswordVisible),
|
|
653
|
-
disabled: props.disabled,
|
|
654
|
-
size: "small",
|
|
655
|
-
variant: "text",
|
|
656
|
-
onClick: unref(togglePassword)
|
|
657
|
-
}, null, 8, [
|
|
658
|
-
"icon",
|
|
659
|
-
"aria-pressed",
|
|
660
|
-
"disabled",
|
|
661
|
-
"onClick"
|
|
662
|
-
])]),
|
|
662
|
+
fn: withCtx(() => [createVNode(unref(VIcon), mergeProps(unref(appendIconProps), { disabled: props.disabled }), null, 16, ["disabled"])]),
|
|
663
663
|
key: "0"
|
|
664
664
|
} : void 0]), 1032, [
|
|
665
665
|
"modelValue",
|
|
666
666
|
"variant",
|
|
667
667
|
"type",
|
|
668
|
-
"append-inner-icon",
|
|
669
668
|
"rules",
|
|
670
669
|
"data-testid",
|
|
671
670
|
"disabled",
|