@nexdom/uimed-vue 2.0.0-beta.38 → 2.0.0-beta.39

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.
@@ -208,8 +208,8 @@ type MainProps = {
208
208
  *
209
209
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/main | Main Guide}
210
210
  */
211
- declare const _default$13: typeof __VLS_export$18;
212
- declare const __VLS_export$18: __VLS_WithSlots$11<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<MainProps & {
211
+ declare const _default$13: typeof __VLS_export$19;
212
+ declare const __VLS_export$19: __VLS_WithSlots$11<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<MainProps & {
213
213
  notificationsOpen?: boolean;
214
214
  }, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
215
215
  "update:notificationsOpen": (value: boolean) => any;
@@ -241,8 +241,8 @@ type __VLS_WithSlots$11<T, S> = T & {
241
241
  *
242
242
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/button | Button Guide}
243
243
  */
244
- declare const _default$1: typeof __VLS_export$17;
245
- declare const __VLS_export$17: __VLS_WithSlots$10<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {} & {
244
+ declare const _default$1: typeof __VLS_export$18;
245
+ declare const __VLS_export$18: __VLS_WithSlots$10<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {} & {
246
246
  click: (event: MouseEvent) => any;
247
247
  }, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<ButtonProps> & Readonly<{
248
248
  onClick?: ((event: MouseEvent) => any) | undefined;
@@ -421,8 +421,8 @@ type AutocompleteFieldProps<T = string, Multiple extends boolean = false> = {
421
421
  *
422
422
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/autocomplete-field | AutocompleteField Guide}
423
423
  */
424
- declare const _default: typeof __VLS_export$16;
425
- declare const __VLS_export$16: <T = string, Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
424
+ declare const _default: typeof __VLS_export$17;
425
+ declare const __VLS_export$17: <T = string, Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$2<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
426
426
  props: import("vue").PublicProps & __VLS_PrettifyLocal$2<(AutocompleteFieldProps<T, Multiple> & {
427
427
  modelValue?: Multiple extends true ? T[] : T;
428
428
  }) & {
@@ -452,8 +452,8 @@ type __VLS_PrettifyLocal$2<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [
452
452
  *
453
453
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/text-field | TextField Guide}
454
454
  */
455
- declare const _default$18: typeof __VLS_export$15;
456
- declare const __VLS_export$15: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<TextFieldProps & {
455
+ declare const _default$19: typeof __VLS_export$16;
456
+ declare const __VLS_export$16: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<TextFieldProps & {
457
457
  modelValue?: string;
458
458
  }, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
459
459
  "update:modelValue": (value: string) => any;
@@ -463,8 +463,8 @@ declare const __VLS_export$15: import("vue", { with: { "resolution-mode": "impor
463
463
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
464
464
  }>, {
465
465
  variant: TextFieldVariant;
466
- type: TextFieldType;
467
466
  clearable: boolean;
467
+ type: TextFieldType;
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
@@ -515,8 +515,8 @@ type CheckboxProps<T = boolean> = {
515
515
  *
516
516
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/checkbox | Checkbox Guide}
517
517
  */
518
- declare const _default$2: typeof __VLS_export$14;
519
- declare const __VLS_export$14: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
518
+ declare const _default$2: typeof __VLS_export$15;
519
+ declare const __VLS_export$15: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
520
520
  props: import("vue").PublicProps & __VLS_PrettifyLocal$1<(CheckboxProps<boolean | T> & {
521
521
  modelValue?: T;
522
522
  }) & {
@@ -632,8 +632,8 @@ type DateTimeFieldProps = {
632
632
  *
633
633
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/date-time-field | DateTimeField Guide}
634
634
  */
635
- declare const _default$7: typeof __VLS_export$13;
636
- declare const __VLS_export$13: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<DateTimeFieldProps & {
635
+ declare const _default$7: typeof __VLS_export$14;
636
+ declare const __VLS_export$14: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<DateTimeFieldProps & {
637
637
  modelValue?: string;
638
638
  }, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
639
639
  "update:modelValue": (value: string) => any;
@@ -646,6 +646,142 @@ declare const __VLS_export$13: import("vue", { with: { "resolution-mode": "impor
646
646
  type: DateTimeFieldType;
647
647
  }, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
648
648
  //#endregion
649
+ //#region src/components/inputs/mask-field/types.d.ts
650
+ type MaskFieldVariant = TextFieldVariant;
651
+ /**
652
+ * Masks the library provides:
653
+ *
654
+ * - `cpf`: `###.###.###-##` (e.g. `123.456.789-09`);
655
+ * - `cnpj`: `##.###.###/####-##` (e.g. `12.345.678/0001-95`);
656
+ * - `cep`: `#####-###` (e.g. `01310-100`);
657
+ * - `phone`: `(##) #####-####` (e.g. `(11) 91234-5678`);
658
+ * - `date`: `##/##/####` (e.g. `31/12/2026`), formatting only.
659
+ */
660
+ type MaskFieldPreset = "cpf" | "cnpj" | "cep" | "phone" | "date";
661
+ /**
662
+ * A preset name, or the mask itself, where `#` is a digit (0–9) and any other
663
+ * character, letters included, is a literal inserted automatically (e.g.
664
+ * `####-##/####` or `Nº ####`).
665
+ *
666
+ * A custom mask must contain at least one `#`, so a misspelled preset (e.g.
667
+ * `"cpff"`) is a type error.
668
+ *
669
+ * @example
670
+ * ```ts
671
+ * const preset: MaskFieldMask = "cpf";
672
+ * const custom: MaskFieldMask = "####-##/####";
673
+ * const withLetters: MaskFieldMask = "Nº ####";
674
+ * ```
675
+ */
676
+ type MaskFieldMask = MaskFieldPreset | `${string}#${string}`;
677
+ /**
678
+ * Props exposed by the {@link MaskField} component.
679
+ */
680
+ type MaskFieldProps = {
681
+ /**
682
+ * Applies a distinct style variation to the field.
683
+ * One of `primary` or `secondary`.
684
+ * @default "primary"
685
+ */
686
+ variant?: MaskFieldVariant;
687
+ /**
688
+ * Mask applied to the value while the user types. One of the presets
689
+ * (`cpf`, `cnpj`, `cep`, `phone` or `date`), or the mask itself, where `#`
690
+ * is a digit (0–9) and any other character, letters included, is a literal
691
+ * inserted automatically (e.g. `####-##/####` or `Nº ####`). A custom mask
692
+ * must contain at least one `#`.
693
+ *
694
+ * Only digits are accepted, up to the number of `#` in the mask, and the
695
+ * `v-model` holds only the digits (e.g. `12345678909` for `cpf`). A literal
696
+ * the user could also type, such as a fixed digit (`0800 ###-####`), isn't
697
+ * supported: where the literal is expected, the same character is read as
698
+ * the literal.
699
+ *
700
+ * The `cpf` and `cnpj` masks don't validate check digits, and `cnpj` only
701
+ * accepts digits (not the alphanumeric CNPJ).
702
+ *
703
+ * Changing it keeps the `v-model`: a value that doesn't fit the new mask
704
+ * (e.g. longer than it) is displayed cut and fails validation with "Valor
705
+ * inválido".
706
+ */
707
+ mask: MaskFieldMask;
708
+ /**
709
+ * Removes the ability to click or target the field.
710
+ * @default false
711
+ */
712
+ disabled?: boolean;
713
+ /**
714
+ * Displays a loading indicator on the input. The field keeps its label as
715
+ * accessible name and is marked as busy, and assistive technologies ignore
716
+ * the indicator.
717
+ * @default false
718
+ */
719
+ loading?: boolean;
720
+ /**
721
+ * Displays clear action.
722
+ * @default false
723
+ */
724
+ clearable?: boolean;
725
+ /**
726
+ * Prevent value changes.
727
+ * @default false
728
+ */
729
+ readonly?: boolean;
730
+ /**
731
+ * Add `rules` to require field to be filled before form submission.
732
+ * @default false
733
+ */
734
+ required?: boolean;
735
+ /**
736
+ * Field label.
737
+ */
738
+ label?: string;
739
+ /**
740
+ * Field placeholder. Defaults to the mask, with `0` in place of each `#`,
741
+ * e.g. `000.000.000-00` for `cpf` and `Nº 0000` for `Nº ####`.
742
+ */
743
+ placeholder?: string;
744
+ /**
745
+ * Field message to show and direct user to fill field correctly.
746
+ *
747
+ * This message will be replaced when there's an error message to be shown.
748
+ */
749
+ hint?: string;
750
+ /**
751
+ * Component id to use on automated tests.
752
+ */
753
+ dataTestid?: string;
754
+ };
755
+ //#endregion
756
+ //#region src/components/inputs/mask-field/mask-field.vue.d.ts
757
+ /**
758
+ * Text field that masks the value while the user types, such as CPF, CNPJ,
759
+ * CEP, phone or a custom mask. Its value holds only the digits, without the
760
+ * mask's literals.
761
+ *
762
+ * @example
763
+ * ```vue
764
+ * <template>
765
+ * <u-mask-field v-model="cpf" label="CPF" mask="cpf" />
766
+ * <u-mask-field v-model="protocol" label="Protocolo" mask="####-##/####" />
767
+ * </template>
768
+ * ```
769
+ *
770
+ * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/mask-field | MaskField Guide}
771
+ */
772
+ declare const _default$14: typeof __VLS_export$13;
773
+ declare const __VLS_export$13: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<MaskFieldProps & {
774
+ modelValue?: string;
775
+ }, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
776
+ "update:modelValue": (value: string) => any;
777
+ }, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<MaskFieldProps & {
778
+ modelValue?: string;
779
+ }> & Readonly<{
780
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
781
+ }>, {
782
+ variant: MaskFieldVariant;
783
+ }, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
784
+ //#endregion
649
785
  //#region src/components/grid/container/types.d.ts
650
786
  /**
651
787
  * Props exposed by the {@link Container} component.
@@ -779,7 +915,7 @@ type RowProps = {
779
915
  *
780
916
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/layout | Row Guide}
781
917
  */
782
- declare const _default$14: typeof __VLS_export$11;
918
+ declare const _default$15: typeof __VLS_export$11;
783
919
  declare const __VLS_export$11: __VLS_WithSlots$8<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<RowProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<RowProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>, {
784
920
  default?: (props: {}) => any;
785
921
  }>;
@@ -908,7 +1044,7 @@ type __VLS_WithSlots$6<T, S> = T & {
908
1044
  *
909
1045
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/section | Section Guide}
910
1046
  */
911
- declare const _default$16: typeof __VLS_export$8;
1047
+ declare const _default$17: typeof __VLS_export$8;
912
1048
  declare const __VLS_export$8: __VLS_WithSlots$5<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<{}, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, true, {}, any>, {
913
1049
  default?: (props: {}) => any;
914
1050
  }>;
@@ -1013,7 +1149,7 @@ interface SectionAction extends ButtonProps {
1013
1149
  *
1014
1150
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/section | Section Guide}
1015
1151
  */
1016
- declare const _default$15: typeof __VLS_export$7;
1152
+ declare const _default$16: typeof __VLS_export$7;
1017
1153
  declare const __VLS_export$7: __VLS_WithSlots$4<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<SectionProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<SectionProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>, {
1018
1154
  default?: (props: {}) => any;
1019
1155
  }>;
@@ -1088,7 +1224,7 @@ type TableProps = {
1088
1224
  *
1089
1225
  * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/table | Table Guide}
1090
1226
  */
1091
- declare const _default$17: typeof __VLS_export$6;
1227
+ declare const _default$18: typeof __VLS_export$6;
1092
1228
  declare const __VLS_export$6: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<TableProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<TableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
1093
1229
  //#endregion
1094
1230
  //#region src/components/details/types.d.ts
@@ -1519,4 +1655,4 @@ type __VLS_WithSlots<T, S> = T & {
1519
1655
  };
1520
1656
  };
1521
1657
  //#endregion
1522
- export { _default as UAutocompleteField, _default$1 as UButton, _default$2 as UCheckbox, _default$3 as UColumn, _default$4 as UContainer, _default$5 as UDataSet, _default$6 as UDataSetItem, _default$7 as UDateTimeField, _default$8 as UDetails, _default$9 as UDialog, _default$10 as UForm, _default$11 as UImg, _default$12 as ULink, _default$13 as UMain, _default$14 as URow, _default$15 as USection, _default$16 as USectionContent, _default$17 as UTable, _default$18 as UTextField };
1658
+ export { _default as UAutocompleteField, _default$1 as UButton, _default$2 as UCheckbox, _default$3 as UColumn, _default$4 as UContainer, _default$5 as UDataSet, _default$6 as UDataSetItem, _default$7 as UDateTimeField, _default$8 as UDetails, _default$9 as UDialog, _default$10 as UForm, _default$11 as UImg, _default$12 as ULink, _default$13 as UMain, _default$14 as UMaskField, _default$15 as URow, _default$16 as USection, _default$17 as USectionContent, _default$18 as UTable, _default$19 as UTextField };
@@ -1,4 +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 { useMask } from "vuetify";
2
3
  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
4
  import { pt } from "vuetify/locale";
4
5
  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, VFooter, 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";
@@ -1833,6 +1834,228 @@ var date_time_field_default = /* @__PURE__ */ defineComponent({
1833
1834
  }
1834
1835
  });
1835
1836
  //#endregion
1837
+ //#region src/composables/inputs/mask-field.ts
1838
+ /**
1839
+ * Masks of the presets. Our preset names always map to these masks, never to
1840
+ * Vuetify's own presets (e.g. its American `phone`).
1841
+ */
1842
+ const maskFieldPresets = {
1843
+ cpf: "###.###.###-##",
1844
+ cnpj: "##.###.###/####-##",
1845
+ cep: "#####-###",
1846
+ phone: "(##) #####-####",
1847
+ date: "##/##/####"
1848
+ };
1849
+ /**
1850
+ * Returns the mask of a preset, or the given mask itself when it's a custom
1851
+ * one.
1852
+ *
1853
+ * It takes any string, as the `mask` prop may get one through a cast or from
1854
+ * JavaScript: a string that isn't a preset is taken as the mask.
1855
+ */
1856
+ function resolveMask(mask) {
1857
+ return isMaskFieldPreset(mask) ? maskFieldPresets[mask] : mask;
1858
+ }
1859
+ /**
1860
+ * Returns a mask as Vuetify reads it. `#` is our only token, but Vuetify always
1861
+ * adds its own tokens (`A`, `a`, `N`, `n` and `X`) and its escape (`\`), so
1862
+ * these characters are escaped to stay literals.
1863
+ */
1864
+ function toVuetifyMask(mask) {
1865
+ return mask.replaceAll(/[AaNnX\\]/g, String.raw`\$&`);
1866
+ }
1867
+ /**
1868
+ * Returns the default placeholder of a mask: the mask with `0` in place of each
1869
+ * `#`, keeping its literals (e.g. `000.000.000-00` for `cpf`).
1870
+ */
1871
+ function getMaskPlaceholder(mask) {
1872
+ return mask.replaceAll("#", "0");
1873
+ }
1874
+ function isMaskFieldPreset(mask) {
1875
+ return Object.hasOwn(maskFieldPresets, mask);
1876
+ }
1877
+ /**
1878
+ * Keeps the input masked while the user edits it, emitting only the digits
1879
+ * (Vuetify's `unmask`).
1880
+ *
1881
+ * A `v-model` out of the mask's format (masked, or with characters or length
1882
+ * the mask doesn't accept) is displayed normalized, without being emitted, and
1883
+ * validated as it is, so a value that doesn't fit the mask fails validation.
1884
+ */
1885
+ function useMaskField(props, model) {
1886
+ const mask = computed(() => resolveMask(props.mask));
1887
+ const digitCount = computed(() => mask.value.split("#").length - 1);
1888
+ const vuetifyMask = useMask({ get mask() {
1889
+ return {
1890
+ mask: toVuetifyMask(mask.value),
1891
+ tokens: {}
1892
+ };
1893
+ } });
1894
+ const displayValue = computed(() => vuetifyMask.mask(unmask(model.value)));
1895
+ const placeholder = computed(() => props.placeholder ?? getMaskPlaceholder(mask.value));
1896
+ const defaultRules = useRules(props);
1897
+ const rules = computed(() => [
1898
+ ...defaultRules.value,
1899
+ (value) => !value || !vuetifyMask.isValid(value) || isComplete(value) || "Valor incompleto",
1900
+ (value) => !value || vuetifyMask.isValid(value) || "Valor inválido"
1901
+ ]);
1902
+ function unmask(text) {
1903
+ return vuetifyMask.unmask(text) ?? "";
1904
+ }
1905
+ function isComplete(value) {
1906
+ return unmask(vuetifyMask.mask(value)).length === digitCount.value;
1907
+ }
1908
+ /**
1909
+ * Returns the position in a masked text right after the given number of
1910
+ * digits, skipping the literals after it unless the user deleted backwards
1911
+ * (as Vuetify's mask input does).
1912
+ */
1913
+ function findCaret(masked, valueLength, deletedBackwards) {
1914
+ let caret = 0;
1915
+ let found = 0;
1916
+ while (found < valueLength) {
1917
+ if (!vuetifyMask.isDelimiter(masked, caret)) found++;
1918
+ caret++;
1919
+ }
1920
+ if (!deletedBackwards) while (vuetifyMask.isDelimiter(masked, caret)) caret++;
1921
+ return caret;
1922
+ }
1923
+ function update(input, deletedBackwards) {
1924
+ const caret = input.selectionStart ?? input.value.length;
1925
+ const masked = vuetifyMask.mask(unmask(input.value));
1926
+ const newCaret = findCaret(masked, unmask(vuetifyMask.mask(unmask(input.value.slice(0, caret)))).length, deletedBackwards);
1927
+ const value = unmask(masked);
1928
+ input.value = masked;
1929
+ input.setSelectionRange(newCaret, newCaret);
1930
+ if (value !== unmask(displayValue.value)) model.value = value;
1931
+ }
1932
+ function onInput(event) {
1933
+ if (!event.isComposing) update(event.target, event.inputType.endsWith("Backward"));
1934
+ }
1935
+ function onCompositionEnd(event) {
1936
+ update(event.target, false);
1937
+ }
1938
+ return {
1939
+ displayValue,
1940
+ placeholder,
1941
+ rules,
1942
+ onInput,
1943
+ onCompositionEnd
1944
+ };
1945
+ }
1946
+ //#endregion
1947
+ //#region src/components/inputs/mask-field/mask-field.vue
1948
+ var mask_field_default = /* @__PURE__ */ defineComponent({
1949
+ inheritAttrs: false,
1950
+ __name: "mask-field",
1951
+ props: /*@__PURE__*/ mergeModels({
1952
+ variant: {
1953
+ type: String,
1954
+ required: false,
1955
+ default: "primary"
1956
+ },
1957
+ mask: {
1958
+ type: null,
1959
+ required: true
1960
+ },
1961
+ disabled: {
1962
+ type: Boolean,
1963
+ required: false
1964
+ },
1965
+ loading: {
1966
+ type: Boolean,
1967
+ required: false
1968
+ },
1969
+ clearable: {
1970
+ type: Boolean,
1971
+ required: false
1972
+ },
1973
+ readonly: {
1974
+ type: Boolean,
1975
+ required: false
1976
+ },
1977
+ required: {
1978
+ type: Boolean,
1979
+ required: false
1980
+ },
1981
+ label: {
1982
+ type: String,
1983
+ required: false
1984
+ },
1985
+ placeholder: {
1986
+ type: String,
1987
+ required: false
1988
+ },
1989
+ hint: {
1990
+ type: String,
1991
+ required: false
1992
+ },
1993
+ dataTestid: {
1994
+ type: String,
1995
+ required: false
1996
+ }
1997
+ }, {
1998
+ "modelValue": {
1999
+ type: String,
2000
+ default: ""
2001
+ },
2002
+ "modelModifiers": {}
2003
+ }),
2004
+ emits: ["update:modelValue"],
2005
+ setup(__props) {
2006
+ const modelValue = useModel(__props, "modelValue");
2007
+ const props = __props;
2008
+ const vuetifyVariant = useTextFieldVariant(() => props.variant);
2009
+ const { displayValue, placeholder, rules, onInput, onCompositionEnd } = useMaskField(props, modelValue);
2010
+ function keepFieldControlled() {}
2011
+ function clear() {
2012
+ modelValue.value = "";
2013
+ }
2014
+ return (_ctx, _cache) => {
2015
+ return openBlock(), createBlock(unref(VTextField), {
2016
+ "model-value": unref(displayValue),
2017
+ "validation-value": modelValue.value,
2018
+ variant: unref(vuetifyVariant),
2019
+ rules: unref(rules),
2020
+ "data-testid": props.dataTestid,
2021
+ disabled: props.disabled,
2022
+ loading: props.loading,
2023
+ "aria-busy": props.loading || void 0,
2024
+ readonly: props.readonly,
2025
+ label: props.label,
2026
+ placeholder: unref(placeholder),
2027
+ hint: props.hint,
2028
+ clearable: props.clearable,
2029
+ type: "text",
2030
+ inputmode: "numeric",
2031
+ "onUpdate:modelValue": keepFieldControlled,
2032
+ onInput: unref(onInput),
2033
+ onCompositionend: unref(onCompositionEnd),
2034
+ "onClick:clear": clear
2035
+ }, {
2036
+ loader: withCtx((loader) => [createVNode(field_loader_default, normalizeProps(guardReactiveProps(loader)), null, 16)]),
2037
+ _: 1
2038
+ }, 8, [
2039
+ "model-value",
2040
+ "validation-value",
2041
+ "variant",
2042
+ "rules",
2043
+ "data-testid",
2044
+ "disabled",
2045
+ "loading",
2046
+ "aria-busy",
2047
+ "readonly",
2048
+ "label",
2049
+ "placeholder",
2050
+ "hint",
2051
+ "clearable",
2052
+ "onInput",
2053
+ "onCompositionend"
2054
+ ]);
2055
+ };
2056
+ }
2057
+ });
2058
+ //#endregion
1836
2059
  //#region src/composables/alignment/alignment.ts
1837
2060
  const alignXToClass = {
1838
2061
  start: "justify-start",
@@ -2679,4 +2902,4 @@ var data_set_item_default = /* @__PURE__ */ defineComponent({
2679
2902
  }
2680
2903
  });
2681
2904
  //#endregion
2682
- export { autocomplete_field_default as UAutocompleteField, button_default as UButton, checkbox_default as UCheckbox, column_default as UColumn, container_default as UContainer, data_set_default as UDataSet, data_set_item_default as UDataSetItem, date_time_field_default as UDateTimeField, details_default as UDetails, dialog_default as UDialog, form_default as UForm, img_default as UImg, link_default as ULink, main_default as UMain, row_default as URow, section_default as USection, section_content_default as USectionContent, table_default as UTable, text_field_default as UTextField };
2905
+ export { autocomplete_field_default as UAutocompleteField, button_default as UButton, checkbox_default as UCheckbox, column_default as UColumn, container_default as UContainer, data_set_default as UDataSet, data_set_item_default as UDataSetItem, date_time_field_default as UDateTimeField, details_default as UDetails, dialog_default as UDialog, form_default as UForm, img_default as UImg, link_default as ULink, main_default as UMain, mask_field_default as UMaskField, row_default as URow, section_default as USection, section_content_default as USectionContent, table_default as UTable, text_field_default as UTextField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.38",
3
+ "version": "2.0.0-beta.39",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",