@nexdom/uimed-vue 2.0.0-beta.7 → 2.0.0-beta.9

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,6 +1,6 @@
1
- import { r as useVuetifyColor, t as messages } from "./use-toast-CACuYhK_.js";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, isRef, mergeModels, mergeProps, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, toValue, unref, useModel, withCtx, withModifiers } from "vue";
3
- import { VApp, VAppBar, VAppBarNavIcon, VAppBarTitle, VAvatar, VBadge, VBtn, VCard, VCardActions, VCardText, VCheckboxBtn, VCol, VContainer, VDivider, VExpansionPanel, VExpansionPanelText, VExpansionPanelTitle, VExpansionPanels, VForm, VIcon, VIconBtn, VImg, VList, VListGroup, VListItem, VListItemAction, VListSubheader, VMain, VMenu, VNavigationDrawer, VRow, VSkeletonLoader, VSnackbarQueue, VTable, VTextField } from "vuetify/components";
1
+ import { a as messages, n as owners, r as requests, s as useVuetifyColor } from "./use-dialog-Ck2_ZW7T.js";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, isRef, mergeModels, mergeProps, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toValue, unref, useId, useModel, useTemplateRef, watch, withCtx, withModifiers } from "vue";
3
+ import { VApp, VAppBar, VAppBarNavIcon, VAppBarTitle, VAutocomplete, VAvatar, VBadge, VBtn, VCard, VCardActions, VCardItem, VCardText, VCardTitle, VCheckboxBtn, VCol, VCombobox, VContainer, VDialog, VDivider, VExpansionPanel, VExpansionPanelText, VExpansionPanelTitle, VExpansionPanels, VForm, VIcon, VIconBtn, VImg, VList, VListGroup, VListItem, VListItemAction, VListSubheader, VMain, VMenu, VNavigationDrawer, VRow, VSkeletonLoader, VSnackbarQueue, VTable, VTextField } from "vuetify/components";
4
4
  import { formatDateTime, isEmail, isEmpty, isPhone, isUrl, toPeriodInterval } from "@nexdom/shared/utils";
5
5
  //#region src/composables/navigation/use-route-props.ts
6
6
  function useRouteProps(route) {
@@ -244,7 +244,23 @@ function url(value) {
244
244
  return isEmpty(value) || isUrl(value) || "URL inválida";
245
245
  }
246
246
  //#endregion
247
- //#region src/composables/inputs/use-rules.ts
247
+ //#region src/composables/inputs/fields.ts
248
+ const textFieldVariantToVuetifyVariant = {
249
+ primary: "underlined",
250
+ secondary: "outlined"
251
+ };
252
+ function useTextFieldVariant(variant) {
253
+ return computed(() => {
254
+ const variantValue = toValue(variant);
255
+ return textFieldVariantToVuetifyVariant[variantValue];
256
+ });
257
+ }
258
+ function createRequiredRule(required, isPresent) {
259
+ return (value) => {
260
+ if (!required) return true;
261
+ return isPresent(value) || "Campo obrigatório";
262
+ };
263
+ }
248
264
  function useRules(options) {
249
265
  return computed(() => {
250
266
  const rules = [];
@@ -254,10 +270,6 @@ function useRules(options) {
254
270
  }
255
271
  //#endregion
256
272
  //#region src/composables/inputs/text-field.ts
257
- const textFieldVariantToVuetifyVariant = {
258
- primary: "underlined",
259
- secondary: "outlined"
260
- };
261
273
  const textFieldTypeToVuetifyType = {
262
274
  text: "text",
263
275
  phone: "tel",
@@ -271,12 +283,6 @@ const textFieldTypeToVuetifyRule = {
271
283
  email,
272
284
  url
273
285
  };
274
- function useTextFieldVariant(variant) {
275
- return computed(() => {
276
- const variantValue = toValue(variant);
277
- return textFieldVariantToVuetifyVariant[variantValue];
278
- });
279
- }
280
286
  function useTextFieldType(type) {
281
287
  return computed(() => {
282
288
  const typeValue = toValue(type);
@@ -543,6 +549,221 @@ var toast_default = /* @__PURE__ */ defineComponent({
543
549
  }
544
550
  });
545
551
  //#endregion
552
+ //#region src/composables/button/button.ts
553
+ const buttonVariantToVuetifyVariant = {
554
+ primary: "elevated",
555
+ secondary: "flat",
556
+ ghost: "outlined"
557
+ };
558
+ function useButtonVariant(variant) {
559
+ return computed(() => {
560
+ const variantValue = toValue(variant);
561
+ return variantValue ? buttonVariantToVuetifyVariant[variantValue] : buttonVariantToVuetifyVariant.primary;
562
+ });
563
+ }
564
+ function useButtonType(type) {
565
+ return computed(() => {
566
+ return toValue(type) ?? "button";
567
+ });
568
+ }
569
+ function useButtonForm(form) {
570
+ return computed(() => toValue(form));
571
+ }
572
+ //#endregion
573
+ //#region src/components/button/button.vue
574
+ var button_default = /* @__PURE__ */ defineComponent({
575
+ inheritAttrs: false,
576
+ __name: "button",
577
+ props: {
578
+ variant: {
579
+ type: String,
580
+ required: false
581
+ },
582
+ type: {
583
+ type: String,
584
+ required: false
585
+ },
586
+ color: {
587
+ type: String,
588
+ required: false
589
+ },
590
+ disabled: {
591
+ type: Boolean,
592
+ required: false
593
+ },
594
+ loading: {
595
+ type: Boolean,
596
+ required: false
597
+ },
598
+ form: {
599
+ type: String,
600
+ required: false
601
+ },
602
+ dataTestid: {
603
+ type: String,
604
+ required: false
605
+ }
606
+ },
607
+ emits: ["click"],
608
+ setup(__props, { emit: __emit }) {
609
+ const props = __props;
610
+ const emit = __emit;
611
+ const variant = useButtonVariant(() => props.variant);
612
+ const color = useVuetifyColor(() => props.color);
613
+ const type = useButtonType(() => props.type);
614
+ const form = useButtonForm(() => props.form);
615
+ function onClick(event) {
616
+ emit("click", event);
617
+ }
618
+ return (_ctx, _cache) => {
619
+ return openBlock(), createBlock(unref(VBtn), {
620
+ disabled: props.disabled,
621
+ loading: props.loading,
622
+ "data-testid": props.dataTestid,
623
+ variant: unref(variant),
624
+ color: unref(color),
625
+ type: unref(type),
626
+ form: unref(form),
627
+ onClick
628
+ }, {
629
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
630
+ _: 3
631
+ }, 8, [
632
+ "disabled",
633
+ "loading",
634
+ "data-testid",
635
+ "variant",
636
+ "color",
637
+ "type",
638
+ "form"
639
+ ]);
640
+ };
641
+ }
642
+ });
643
+ //#endregion
644
+ //#region src/components/dialogs/dialog.vue
645
+ var dialog_default = /* @__PURE__ */ defineComponent({
646
+ inheritAttrs: false,
647
+ __name: "dialog",
648
+ setup(__props) {
649
+ const owner = Symbol("dialog");
650
+ const titleId = useId();
651
+ const messageId = useId();
652
+ const actions = useTemplateRef("actions");
653
+ const isOwner = computed(() => owners.value[0] === owner);
654
+ const next = computed(() => isOwner.value ? requests.value[0] : void 0);
655
+ /** Dialog on display, kept until its leave transition ends. */
656
+ const request = shallowRef();
657
+ const isOpen = ref(false);
658
+ const selected = shallowRef();
659
+ const isRunning = computed(() => selected.value !== void 0);
660
+ /** Element focused before the dialog opened, which gets the focus back when it closes. */
661
+ let origin = null;
662
+ onMounted(() => owners.value.push(owner));
663
+ onUnmounted(() => owners.value = owners.value.filter((item) => item !== owner));
664
+ watch(next, show);
665
+ function show() {
666
+ if (request.value) return;
667
+ origin = document.activeElement;
668
+ request.value = next.value;
669
+ isOpen.value = next.value !== void 0;
670
+ }
671
+ function showNext() {
672
+ request.value = void 0;
673
+ show();
674
+ }
675
+ async function select(current, action) {
676
+ if (isRunning.value) return;
677
+ requests.value.shift();
678
+ selected.value = action;
679
+ await current.select(action?.value);
680
+ selected.value = void 0;
681
+ isOpen.value = false;
682
+ if (origin instanceof HTMLElement || origin instanceof SVGElement) origin.focus();
683
+ }
684
+ function dismiss() {
685
+ if (request.value) select(request.value);
686
+ }
687
+ function focusFirstAction() {
688
+ actions.value?.$el.querySelector("button").focus();
689
+ }
690
+ return (_ctx, _cache) => {
691
+ return openBlock(), createBlock(unref(VDialog), {
692
+ "model-value": isOpen.value,
693
+ persistent: isRunning.value,
694
+ role: request.value?.role,
695
+ "aria-labelledby": request.value?.title ? unref(titleId) : unref(messageId),
696
+ "aria-describedby": unref(messageId),
697
+ "max-width": "560",
698
+ "onUpdate:modelValue": dismiss,
699
+ onAfterEnter: focusFirstAction,
700
+ onAfterLeave: showNext
701
+ }, {
702
+ default: withCtx(() => [createCommentVNode("\n MD3 dialogs have a 24px padding, 16px between title and message, 24px between message and\n actions, and 8px between the end-aligned actions. Inside a dialog, the card parts already\n have 24px sides, 16px below the title, 24px below the message, and end-aligned actions 8px\n apart, but no prop sets the remaining paddings, hence the spacing classes.\n "), request.value ? (openBlock(), createBlock(unref(VCard), { key: 0 }, {
703
+ default: withCtx(() => [
704
+ request.value.title ? (openBlock(), createBlock(unref(VCardItem), {
705
+ key: 0,
706
+ class: "pt-6"
707
+ }, {
708
+ default: withCtx(() => [createCommentVNode(" Titles wrap instead of being truncated, since they're part of the message "), createVNode(unref(VCardTitle), {
709
+ id: unref(titleId),
710
+ class: "text-wrap"
711
+ }, {
712
+ default: withCtx(() => [createTextVNode(toDisplayString(request.value.title), 1)]),
713
+ _: 1
714
+ }, 8, ["id"])]),
715
+ _: 1
716
+ })) : createCommentVNode("v-if", true),
717
+ createCommentVNode(" Below a title, the card already removes the message's top padding "),
718
+ createVNode(unref(VCardText), {
719
+ id: unref(messageId),
720
+ class: normalizeClass({ "pt-6": !request.value.title })
721
+ }, {
722
+ default: withCtx(() => [createTextVNode(toDisplayString(request.value.message), 1)]),
723
+ _: 1
724
+ }, 8, ["id", "class"]),
725
+ request.value.actions.length > 0 ? (openBlock(), createBlock(unref(VCardActions), {
726
+ key: 1,
727
+ ref_key: "actions",
728
+ ref: actions,
729
+ class: "px-6 pt-0 pb-6"
730
+ }, {
731
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(request.value.actions, (action, index) => {
732
+ return openBlock(), createBlock(button_default, {
733
+ key: index,
734
+ variant: action.variant,
735
+ color: action.color,
736
+ loading: selected.value === action,
737
+ disabled: isRunning.value && selected.value !== action,
738
+ onClick: ($event) => select(request.value, action)
739
+ }, {
740
+ default: withCtx(() => [createTextVNode(toDisplayString(action.text), 1)]),
741
+ _: 2
742
+ }, 1032, [
743
+ "variant",
744
+ "color",
745
+ "loading",
746
+ "disabled",
747
+ "onClick"
748
+ ]);
749
+ }), 128))]),
750
+ _: 1
751
+ }, 512)) : createCommentVNode("v-if", true)
752
+ ]),
753
+ _: 1
754
+ })) : createCommentVNode("v-if", true)]),
755
+ _: 1
756
+ }, 8, [
757
+ "model-value",
758
+ "persistent",
759
+ "role",
760
+ "aria-labelledby",
761
+ "aria-describedby"
762
+ ]);
763
+ };
764
+ }
765
+ });
766
+ //#endregion
546
767
  //#region src/components/main/main.vue
547
768
  var main_default = /* @__PURE__ */ defineComponent({
548
769
  inheritAttrs: false,
@@ -596,7 +817,11 @@ var main_default = /* @__PURE__ */ defineComponent({
596
817
  }), null, 16, ["modelValue"])) : createCommentVNode("v-if", true),
597
818
  createVNode(unref(VMain), null, {
598
819
  default: withCtx(() => [createVNode(container_default, null, {
599
- default: withCtx(() => [renderSlot(_ctx.$slots, "default"), createVNode(toast_default)]),
820
+ default: withCtx(() => [
821
+ renderSlot(_ctx.$slots, "default"),
822
+ createVNode(toast_default),
823
+ createVNode(dialog_default)
824
+ ]),
600
825
  _: 3
601
826
  })]),
602
827
  _: 3
@@ -608,93 +833,137 @@ var main_default = /* @__PURE__ */ defineComponent({
608
833
  }
609
834
  });
610
835
  //#endregion
611
- //#region src/composables/button/button.ts
612
- const buttonVariantToVuetifyVariant = {
613
- primary: "elevated",
614
- secondary: "flat",
615
- ghost: "outlined"
616
- };
617
- function useButtonVariant(variant) {
618
- return computed(() => {
619
- const variantValue = toValue(variant);
620
- return variantValue ? buttonVariantToVuetifyVariant[variantValue] : buttonVariantToVuetifyVariant.primary;
836
+ //#region src/composables/inputs/autocomplete-field.ts
837
+ function createAutocompleteRequiredRule(options) {
838
+ return createRequiredRule(options.required, (value) => {
839
+ if (options.multiple) return (Array.isArray(value) ? value : []).length > 0;
840
+ return !isEmpty(String(value ?? ""));
621
841
  });
622
842
  }
623
- function useButtonType(type) {
843
+ function useAutocompleteRules(options) {
624
844
  return computed(() => {
625
- return toValue(type) ?? "button";
845
+ const opts = toValue(options);
846
+ const rules = [];
847
+ if (opts.required) rules.push(createAutocompleteRequiredRule(opts));
848
+ return rules;
626
849
  });
627
850
  }
628
- function useButtonForm(form) {
629
- return computed(() => toValue(form));
630
- }
631
851
  //#endregion
632
- //#region src/components/button/button.vue
633
- var button_default = /* @__PURE__ */ defineComponent({
852
+ //#region src/components/inputs/autocomplete-field/autocomplete-field.vue
853
+ var autocomplete_field_default = /* @__PURE__ */ defineComponent({
634
854
  inheritAttrs: false,
635
- __name: "button",
636
- props: {
855
+ __name: "autocomplete-field",
856
+ props: /*@__PURE__*/ mergeModels({
637
857
  variant: {
638
858
  type: String,
859
+ required: false,
860
+ default: "primary"
861
+ },
862
+ disabled: {
863
+ type: Boolean,
639
864
  required: false
640
865
  },
641
- type: {
642
- type: String,
866
+ loading: {
867
+ type: Boolean,
643
868
  required: false
644
869
  },
645
- color: {
646
- type: String,
870
+ clearable: {
871
+ type: Boolean,
647
872
  required: false
648
873
  },
649
- disabled: {
874
+ readonly: {
650
875
  type: Boolean,
651
876
  required: false
652
877
  },
653
- loading: {
878
+ required: {
654
879
  type: Boolean,
655
880
  required: false
656
881
  },
657
- form: {
882
+ label: {
883
+ type: String,
884
+ required: false
885
+ },
886
+ placeholder: {
887
+ type: String,
888
+ required: false
889
+ },
890
+ hint: {
658
891
  type: String,
659
892
  required: false
660
893
  },
661
894
  dataTestid: {
662
895
  type: String,
663
896
  required: false
897
+ },
898
+ strict: {
899
+ type: Boolean,
900
+ required: false
901
+ },
902
+ multiple: {
903
+ type: null,
904
+ required: false
905
+ },
906
+ items: {
907
+ type: Array,
908
+ required: false,
909
+ default: () => []
664
910
  }
665
- },
666
- emits: ["click"],
667
- setup(__props, { emit: __emit }) {
911
+ }, {
912
+ "modelValue": { type: null },
913
+ "modelModifiers": {}
914
+ }),
915
+ emits: ["update:modelValue"],
916
+ setup(__props) {
917
+ const modelValue = useModel(__props, "modelValue");
668
918
  const props = __props;
669
- const emit = __emit;
670
- const variant = useButtonVariant(() => props.variant);
671
- const color = useVuetifyColor(() => props.color);
672
- const type = useButtonType(() => props.type);
673
- const form = useButtonForm(() => props.form);
674
- function onClick(event) {
675
- emit("click", event);
676
- }
919
+ const vuetifyVariant = useTextFieldVariant(() => props.variant);
920
+ const isMultiple = computed(() => props.multiple ?? false);
921
+ const rules = useAutocompleteRules(() => ({
922
+ required: props.required,
923
+ multiple: isMultiple.value
924
+ }));
925
+ const vuetifyComponent = computed(() => props.strict ? VAutocomplete : VCombobox);
926
+ const normalizedItems = computed(() => {
927
+ return props.items.map((item) => {
928
+ if (typeof item === "string") return {
929
+ label: item,
930
+ value: item
931
+ };
932
+ return item;
933
+ });
934
+ });
677
935
  return (_ctx, _cache) => {
678
- return openBlock(), createBlock(unref(VBtn), {
936
+ return openBlock(), createBlock(resolveDynamicComponent(vuetifyComponent.value), {
937
+ modelValue: modelValue.value,
938
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
939
+ variant: unref(vuetifyVariant),
940
+ items: normalizedItems.value,
941
+ "data-testid": props.dataTestid,
679
942
  disabled: props.disabled,
680
943
  loading: props.loading,
681
- "data-testid": props.dataTestid,
682
- variant: unref(variant),
683
- color: unref(color),
684
- type: unref(type),
685
- form: unref(form),
686
- onClick
687
- }, {
688
- default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
689
- _: 3
690
- }, 8, [
944
+ readonly: props.readonly,
945
+ label: props.label,
946
+ placeholder: props.placeholder,
947
+ hint: props.hint,
948
+ clearable: props.clearable,
949
+ multiple: isMultiple.value,
950
+ "item-title": "label",
951
+ rules: unref(rules),
952
+ chips: ""
953
+ }, null, 8, [
954
+ "modelValue",
955
+ "variant",
956
+ "items",
957
+ "data-testid",
691
958
  "disabled",
692
959
  "loading",
693
- "data-testid",
694
- "variant",
695
- "color",
696
- "type",
697
- "form"
960
+ "readonly",
961
+ "label",
962
+ "placeholder",
963
+ "hint",
964
+ "clearable",
965
+ "multiple",
966
+ "rules"
698
967
  ]);
699
968
  };
700
969
  }
@@ -944,7 +1213,7 @@ var section_default = /* @__PURE__ */ defineComponent({
944
1213
  }, {
945
1214
  default: withCtx(() => [renderSlot(_ctx.$slots, "default"), showActions.value ? (openBlock(), createBlock(unref(VCardActions), {
946
1215
  key: 0,
947
- class: "mt-auto"
1216
+ class: "mt-auto justify-end"
948
1217
  }, {
949
1218
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.actions, ({ label, onClick, ...action }, index) => {
950
1219
  return openBlock(), createBlock(button_default, mergeProps({ key: index }, { ref_for: true }, action, { onClick }), {
@@ -1109,4 +1378,4 @@ var details_default = /* @__PURE__ */ defineComponent({
1109
1378
  }
1110
1379
  });
1111
1380
  //#endregion
1112
- export { button_default as UButton, checkbox_default as UCheckbox, column_default as UColumn, container_default as UContainer, details_default as UDetails, form_default as UForm, 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 };
1381
+ export { autocomplete_field_default as UAutocompleteField, button_default as UButton, checkbox_default as UCheckbox, column_default as UColumn, container_default as UContainer, details_default as UDetails, form_default as UForm, 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 };
@@ -1,4 +1,4 @@
1
- import { n as FeedbackColorVariant } from "./types-BPXXtbmW.js";
1
+ import { i as FeedbackColorVariant, n as ButtonVariant, r as ColorVariant } from "./types-HPMP8IrV.js";
2
2
  //#region src/composables/dialogs/types.d.ts
3
3
  interface ToastOptions {
4
4
  /**
@@ -6,12 +6,84 @@ interface ToastOptions {
6
6
  */
7
7
  message: string;
8
8
  /**
9
- * Applies a color to the button.
9
+ * Applies a color to the toast.
10
10
  * One of `positive`, `informative`, `caution`, or `danger`.
11
11
  * @default "informative"
12
12
  */
13
13
  color?: FeedbackColorVariant;
14
14
  }
15
+ /**
16
+ * A button displayed at the bottom of a dialog opened by `useDialog`'s `dialog`.
17
+ */
18
+ interface DialogAction<T extends string = string> {
19
+ /**
20
+ * Text displayed on the button.
21
+ */
22
+ text: string;
23
+ /**
24
+ * Value the dialog resolves with when the button is clicked.
25
+ */
26
+ value: T;
27
+ /**
28
+ * Applies a distinct style variation to the button.
29
+ * One of `primary`, `secondary`, or `ghost`.
30
+ * @default "ghost", or "primary" for the last action
31
+ */
32
+ variant?: ButtonVariant;
33
+ /**
34
+ * Applies a color to the button.
35
+ * One of `primary`, `secondary`, `positive`, `informative`, `caution`, or `danger`.
36
+ * @default "primary"
37
+ */
38
+ color?: ColorVariant;
39
+ }
40
+ /**
41
+ * Options of a dialog opened by `useDialog`'s `dialog`.
42
+ */
43
+ interface DialogOptions<T extends string = string> {
44
+ /**
45
+ * Plain text displayed as the dialog's title. HTML isn't interpreted.
46
+ */
47
+ title?: string;
48
+ /**
49
+ * Plain text displayed as the dialog's message. HTML isn't interpreted.
50
+ */
51
+ message: string;
52
+ /**
53
+ * Buttons displayed at the bottom of the dialog, right-aligned, in the given order.
54
+ * @default [{ text: "Fechar" }], which resolves `undefined`
55
+ */
56
+ actions?: DialogAction<T>[];
57
+ }
58
+ /**
59
+ * Options of a dialog opened by `useConfirm`'s `confirm`.
60
+ */
61
+ interface ConfirmOptions {
62
+ /**
63
+ * Plain text displayed as the dialog's title. HTML isn't interpreted.
64
+ */
65
+ title?: string;
66
+ /**
67
+ * Plain text displayed as the dialog's message. HTML isn't interpreted.
68
+ */
69
+ message: string;
70
+ /**
71
+ * Text displayed on the confirm button.
72
+ * @default "Confirmar"
73
+ */
74
+ confirmText?: string;
75
+ /**
76
+ * Text displayed on the cancel button.
77
+ * @default "Cancelar"
78
+ */
79
+ cancelText?: string;
80
+ /**
81
+ * Applies a color to the confirm button.
82
+ * One of `primary`, `secondary`, `positive`, `informative`, `caution`, or `danger`.
83
+ * @default "primary"
84
+ */
85
+ color?: ColorVariant;
86
+ }
15
87
  //#endregion
16
88
  //#region src/composables/dialogs/use-toast.d.ts
17
89
  /**
@@ -37,7 +109,7 @@ declare function useToast(): {
37
109
  */
38
110
  declare function toast(options: ToastOptions): void;
39
111
  //#endregion
40
- //#region src/composables/dialogs/use-run-or-toast..d.ts
112
+ //#region src/composables/dialogs/use-run-or-toast.d.ts
41
113
  /**
42
114
  * Generate `run` method and a computed property `isRunning`.
43
115
  * Calling `run` will reactively update `isRunning`.
@@ -64,4 +136,58 @@ declare function useRunOrToast(): {
64
136
  isRunning: import("vue").ComputedRef<boolean>;
65
137
  };
66
138
  //#endregion
67
- export { useRunOrToast, useToast };
139
+ //#region src/composables/dialogs/use-dialog.d.ts
140
+ /**
141
+ * Composable which returns a function to display dialogs.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const { dialog } = useDialog();
146
+ *
147
+ * const answer = await dialog({
148
+ * title: "Sessão expirando",
149
+ * message: "Deseja continuar conectado?",
150
+ * actions: [
151
+ * { text: "Sair", value: "leave" },
152
+ * { text: "Continuar", value: "stay" },
153
+ * ],
154
+ * });
155
+ * ```
156
+ */
157
+ declare function useDialog(): {
158
+ dialog: typeof dialog;
159
+ };
160
+ /**
161
+ * Displays a dialog. Dialogs are displayed one at a time, in the order they were requested.
162
+ * @param {DialogOptions} options - Options for the dialog.
163
+ * @returns the `value` of the clicked action, or `undefined` when the dialog is closed by the
164
+ * default action, the `Esc` key, a click outside it or the browser's back button.
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * await dialog({ title: "Aviso", message: "Seu cadastro foi enviado para análise." });
169
+ * ```
170
+ */
171
+ declare function dialog<T extends string = never>(options: DialogOptions<T>): Promise<T | undefined>;
172
+ //#endregion
173
+ //#region src/composables/dialogs/use-confirm.d.ts
174
+ /**
175
+ * Composable which returns a function to run actions only after the user confirms them in a
176
+ * dialog, and a computed property `isRunning`.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const { confirm, isRunning } = useConfirm();
181
+ *
182
+ * const removed = await confirm(
183
+ * { title: "Excluir paciente", message: "Esta ação não pode ser desfeita.", confirmText: "Excluir", color: "danger" },
184
+ * () => api.deletePatient(id),
185
+ * );
186
+ * ```
187
+ */
188
+ declare function useConfirm(): {
189
+ confirm: <F extends (...args: Parameters<F>) => PromiseLike<Awaited<ReturnType<F>>>>(options: ConfirmOptions, action: F, ...params: Parameters<F>) => Promise<Awaited<ReturnType<F>> | false>;
190
+ isRunning: import("vue").ComputedRef<boolean>;
191
+ };
192
+ //#endregion
193
+ export { useConfirm, useDialog, useRunOrToast, useToast };