@nexdom/uimed-vue 2.0.0-beta.33 → 2.0.0-beta.35

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.
@@ -1,4 +1,4 @@
1
- import { t as ButtonProps } from "./types-DNT_odv7.js";
1
+ import { t as ButtonProps } from "./types-CjaJ2WAC.js";
2
2
  import { RouteLocationRaw } from "vue-router";
3
3
  //#region src/components/app-bar/types.d.ts
4
4
  /**
@@ -245,6 +245,10 @@ type TextFieldProps = {
245
245
  /**
246
246
  * Applies a distinct behavior to the field.
247
247
  * One of `text`, `phone`, `email`, `url`, `password` or `search`.
248
+ *
249
+ * With `password`, the field hides its value and shows a "Mostrar senha"
250
+ * button that toggles between showing and hiding it. The value hides again
251
+ * when the button is pressed again or the type changes.
248
252
  * @default "text"
249
253
  */
250
254
  type?: TextFieldType;
@@ -961,7 +965,8 @@ interface SectionAction extends ButtonProps {
961
965
  */
962
966
  label: string;
963
967
  /**
964
- * Called when the action button is clicked.
968
+ * Called when the action button is clicked. Not called while the action is `disabled` or
969
+ * `loading`.
965
970
  */
966
971
  onClick?: (event: MouseEvent) => void;
967
972
  }
@@ -1406,7 +1411,8 @@ interface DialogButtonAction extends ButtonProps {
1406
1411
  */
1407
1412
  label: string;
1408
1413
  /**
1409
- * Called when the action button is clicked. The dialog stays open.
1414
+ * Called when the action button is clicked. Not called while the action is `disabled` or
1415
+ * `loading`. The dialog stays open.
1410
1416
  */
1411
1417
  onClick?: (event: MouseEvent) => void;
1412
1418
  }
@@ -1,5 +1,5 @@
1
1
  import { a as messages, n as owners$1, r as requests, s as useVuetifyColor } from "./use-dialog-Ck2_ZW7T.js";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onScopeDispose, onUnmounted, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toValue, unref, useId, useModel, useSlots, useTemplateRef, watch, withCtx, withKeys, withModifiers } from "vue";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onScopeDispose, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toValue, unref, useId, useModel, useSlots, useTemplateRef, watch, withCtx, withKeys, withModifiers } from "vue";
3
3
  import { pt } from "vuetify/locale";
4
4
  import { VApp, VAppBar, VAppBarNavIcon, VAppBarTitle, VAutocomplete, VAvatar, VBadge, VBtn, VCard, VCardActions, VCardText, VCheckboxBtn, VCol, VCombobox, VContainer, VDataIterator, VDatePicker, VDialog, VDivider, VEmptyState, VExpansionPanel, VExpansionPanelText, VExpansionPanelTitle, VExpansionPanels, VForm, VIcon, VIconBtn, VImg, VList, VListGroup, VListItem, VListItemAction, VListSubheader, VLocaleProvider, VMain, VMenu, VNavigationDrawer, VPagination, VProgressCircular, VProgressLinear, VRow, VSkeletonLoader, VSnackbarQueue, VTable, VTextField, VTimePicker } from "vuetify/components";
5
5
  import { formatDateTime, isEmail, isEmpty, isPhone, isUrl } from "@nexdom/shared/utils";
@@ -401,12 +401,39 @@ const textFieldTypeToVuetifyRule = {
401
401
  email,
402
402
  url
403
403
  };
404
- function useTextFieldType(type) {
404
+ /**
405
+ * Maps the field type to the input type, showing as plain text a password
406
+ * the user chose to make visible.
407
+ */
408
+ function useTextFieldType(type, isPasswordVisible) {
405
409
  return computed(() => {
406
410
  const typeValue = toValue(type);
411
+ if (typeValue === "password" && toValue(isPasswordVisible)) return "text";
407
412
  return textFieldTypeToVuetifyType[typeValue];
408
413
  });
409
414
  }
415
+ /**
416
+ * Controls the button that shows or hides a password field's value. The
417
+ * password starts hidden and hides again whenever the type stops being
418
+ * `password`.
419
+ */
420
+ function useTextFieldPasswordToggle(type) {
421
+ const isPasswordField = computed(() => toValue(type) === "password");
422
+ const isPasswordVisible = ref(false);
423
+ const icon = computed(() => isPasswordVisible.value ? "mdi-eye-off" : "mdi-eye");
424
+ watch(isPasswordField, () => {
425
+ isPasswordVisible.value = false;
426
+ });
427
+ function toggle() {
428
+ isPasswordVisible.value = !isPasswordVisible.value;
429
+ }
430
+ return {
431
+ isPasswordField,
432
+ isPasswordVisible: readonly(isPasswordVisible),
433
+ icon,
434
+ toggle
435
+ };
436
+ }
410
437
  function useTextFieldRules(props) {
411
438
  const defaultRules = useRules(props);
412
439
  return computed(() => {
@@ -512,7 +539,8 @@ var text_field_default = /* @__PURE__ */ defineComponent({
512
539
  const modelValue = useModel(__props, "modelValue");
513
540
  const props = __props;
514
541
  const vuetifyVariant = useTextFieldVariant(() => props.variant);
515
- const vuetifyType = useTextFieldType(() => props.type);
542
+ const { isPasswordField, isPasswordVisible, icon: passwordToggleIcon, toggle: togglePassword } = useTextFieldPasswordToggle(() => props.type);
543
+ const vuetifyType = useTextFieldType(() => props.type, isPasswordVisible);
516
544
  const rules = useTextFieldRules(props);
517
545
  const isSearchField = computed(() => props.type === "search");
518
546
  const computedClearable = computed(() => props.clearable ?? isSearchField.value);
@@ -538,10 +566,27 @@ var text_field_default = /* @__PURE__ */ defineComponent({
538
566
  hint: props.hint,
539
567
  clearable: computedClearable.value,
540
568
  "onClick:clear": clear
541
- }, {
569
+ }, createSlots({
542
570
  loader: withCtx((loader) => [createVNode(field_loader_default, normalizeProps(guardReactiveProps(loader)), null, 16)]),
543
- _: 1
544
- }, 8, [
571
+ _: 2
572
+ }, [unref(isPasswordField) ? {
573
+ name: "append-inner",
574
+ fn: withCtx(() => [createVNode(unref(VBtn), {
575
+ icon: unref(passwordToggleIcon),
576
+ "aria-label": "Mostrar senha",
577
+ "aria-pressed": unref(isPasswordVisible),
578
+ disabled: props.disabled,
579
+ size: "small",
580
+ variant: "text",
581
+ onClick: unref(togglePassword)
582
+ }, null, 8, [
583
+ "icon",
584
+ "aria-pressed",
585
+ "disabled",
586
+ "onClick"
587
+ ])]),
588
+ key: "0"
589
+ } : void 0]), 1032, [
545
590
  "modelValue",
546
591
  "variant",
547
592
  "type",
@@ -822,12 +867,13 @@ var button_default = /* @__PURE__ */ defineComponent({
822
867
  const type = useButtonType(() => props.type);
823
868
  const form = useButtonForm(() => props.form);
824
869
  const widthClass = useFullWidth(() => props.fullWidth);
870
+ const isDisabled = computed(() => props.disabled || props.loading);
825
871
  function onClick(event) {
826
872
  emit("click", event);
827
873
  }
828
874
  return (_ctx, _cache) => {
829
875
  return openBlock(), createBlock(unref(VBtn), {
830
- disabled: props.disabled,
876
+ disabled: isDisabled.value,
831
877
  loading: props.loading,
832
878
  "data-testid": props.dataTestid,
833
879
  variant: unref(variant),
@@ -1084,7 +1130,6 @@ var dialog_host_default = /* @__PURE__ */ defineComponent({
1084
1130
  show();
1085
1131
  }
1086
1132
  async function select(current, action) {
1087
- if (isRunning.value) return;
1088
1133
  requests.value.shift();
1089
1134
  selected.value = action;
1090
1135
  await current.select(action?.value);
@@ -1,4 +1,4 @@
1
- import { i as FeedbackColorVariant, n as ButtonVariant, r as ColorVariant } from "./types-DNT_odv7.js";
1
+ import { i as FeedbackColorVariant, n as ButtonVariant, r as ColorVariant } from "./types-CjaJ2WAC.js";
2
2
  import { ComputedRef, MaybeRefOrGetter } from "vue";
3
3
  //#region src/composables/dialogs/types.d.ts
4
4
  interface ToastOptions {
@@ -32,8 +32,11 @@ type ButtonProps = {
32
32
  */
33
33
  disabled?: boolean;
34
34
  /**
35
- * Displays a loading indicator on the button, disabling interaction.
36
- * The button keeps its text as accessible name and is marked as busy, and
35
+ * Displays a loading indicator on the button and disables it while active, as `disabled` does:
36
+ * it can't be clicked or focused, `click` isn't emitted and its form isn't submitted, including
37
+ * by pressing `Enter` in one of the form's fields when it's the form's first submit button. It
38
+ * looks disabled, with the indicator, and loses focus if focused when loading starts, as any
39
+ * disabled button does. The button keeps its text as accessible name and is marked as busy, and
37
40
  * assistive technologies ignore the indicator.
38
41
  * @default false
39
42
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.33",
3
+ "version": "2.0.0-beta.35",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",