@nexdom/uimed-vue 2.0.0-beta.46 → 2.0.0-beta.48

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.
@@ -575,8 +575,8 @@ declare const __VLS_export$16: import("vue", { with: { "resolution-mode": "impor
575
575
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
576
576
  }>, {
577
577
  variant: TextFieldVariant;
578
- type: TextFieldType;
579
578
  clearable: boolean;
579
+ type: TextFieldType;
580
580
  }, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
581
581
  //#endregion
582
582
  //#region src/components/inputs/checkbox/types.d.ts
@@ -1715,6 +1715,8 @@ type DialogProps = {
1715
1715
  * Buttons displayed at the bottom of the dialog, right-aligned, in the given order.
1716
1716
  * Place the main action last. When undefined or empty, no actions area is rendered.
1717
1717
  * Clicking an action doesn't close the dialog: set `v-model` to `false` in `onClick`.
1718
+ * While any action is `loading`, the user can't close the dialog with `Esc`, a click outside or
1719
+ * the browser's back button, but setting `v-model` to `false` still closes it.
1718
1720
  */
1719
1721
  actions?: DialogButtonAction[];
1720
1722
  /**
@@ -1730,7 +1732,7 @@ type DialogProps = {
1730
1732
  };
1731
1733
  /**
1732
1734
  * A single action rendered inside {@link Dialog}'s actions area. Same shape as `USection`'s
1733
- * actions.
1735
+ * actions. While it's `loading`, the user can't close the dialog, but setting `v-model` to `false` still does.
1734
1736
  */
1735
1737
  interface DialogButtonAction extends ButtonProps {
1736
1738
  /**
@@ -100,7 +100,7 @@ function useNavigationSearchShortcut(options) {
100
100
  input.select();
101
101
  }
102
102
  function findInput() {
103
- return field.value.$el.querySelector("input");
103
+ return toValue(field).$el.querySelector("input");
104
104
  }
105
105
  function close() {
106
106
  open.value = false;
@@ -1005,7 +1005,7 @@ function useVuetifyTextColor(color) {
1005
1005
  //#region src/composables/button/button.ts
1006
1006
  const buttonVariantToVuetifyVariant = {
1007
1007
  primary: "elevated",
1008
- secondary: "flat",
1008
+ secondary: "outlined",
1009
1009
  ghost: "text"
1010
1010
  };
1011
1011
  function useButtonVariant(variant) {
@@ -1034,13 +1034,15 @@ function useButtonType(type, route, blocked) {
1034
1034
  });
1035
1035
  }
1036
1036
  /**
1037
- * Maps the button's color to Vuetify's. A ghost button has no fill, so its color is the text's,
1038
- * which takes the color's text shade to keep WCAG AA's contrast.
1037
+ * Maps the button's color to Vuetify's. Secondary (outlined) and ghost buttons have no fill, so
1038
+ * their color is the text's, which takes the color's text shade to keep WCAG AA's contrast.
1039
1039
  */
1040
1040
  function useButtonColor(color, variant) {
1041
1041
  const fillColor = useVuetifyColor(color);
1042
1042
  const textColor = useVuetifyTextColor(color);
1043
- return computed(() => toValue(variant) === "ghost" ? textColor.value : fillColor.value);
1043
+ return computed(() => {
1044
+ return toValue(variant) === "secondary" || toValue(variant) === "ghost" ? textColor.value : fillColor.value;
1045
+ });
1044
1046
  }
1045
1047
  /**
1046
1048
  * The button's `form`, or `undefined` when it has a `route`, even while blocked, since `form`
@@ -1173,23 +1175,23 @@ const focusable = [
1173
1175
  function useDialogFocus(isActive, card) {
1174
1176
  /** Focus state of this dialog, shared with the dialogs opened from it. */
1175
1177
  const focusState = {
1176
- isOpen: isActive,
1178
+ isOpen: () => toValue(isActive),
1177
1179
  origin: null
1178
1180
  };
1179
- onMounted(() => onActiveChange(isActive()));
1180
- watch(isActive, onActiveChange);
1181
+ onMounted(() => onActiveChange(toValue(isActive)));
1182
+ watch(() => toValue(isActive), onActiveChange);
1181
1183
  function onActiveChange(active) {
1182
1184
  if (active) {
1183
1185
  focusState.origin = document.activeElement;
1184
1186
  return;
1185
1187
  }
1186
- const element = card();
1188
+ const element = toValue(card);
1187
1189
  if (element) closedDialogs.set(element, focusState);
1188
1190
  const target = findFocusTarget(focusState.origin);
1189
1191
  if (hasFocus(element) && (target instanceof HTMLElement || target instanceof SVGElement)) target.focus();
1190
1192
  }
1191
1193
  function focusFirstElement() {
1192
- card()?.querySelector(focusable)?.focus();
1194
+ toValue(card)?.querySelector(focusable)?.focus();
1193
1195
  }
1194
1196
  return { focusFirstElement };
1195
1197
  }
@@ -1212,6 +1214,17 @@ function hasFocus(card) {
1212
1214
  return !!card && (card.contains(active) || active.contains(card));
1213
1215
  }
1214
1216
  //#endregion
1217
+ //#region src/composables/dialogs/use-dialog-loading.ts
1218
+ /**
1219
+ * Tells whether any action of a dialog is loading, during which the user can't close it with
1220
+ * `Esc`, a click outside or the browser's back button. Internal to the dialog components.
1221
+ * @param actions - The dialog's actions, if any.
1222
+ * @returns `isLoading`, which is `true` while at least one action is `loading`.
1223
+ */
1224
+ function useDialogLoading(actions) {
1225
+ return { isLoading: computed(() => toValue(actions)?.some((action) => action.loading) ?? false) };
1226
+ }
1227
+ //#endregion
1215
1228
  //#region src/components/dialogs/dialog/dialog.vue?vue&type=script&setup=true&lang.ts
1216
1229
  const _hoisted_1$1 = ["id"];
1217
1230
  //#endregion
@@ -1264,6 +1277,7 @@ var dialog_default = /* @__PURE__ */ defineComponent({
1264
1277
  */
1265
1278
  const isActive = ref(model.value);
1266
1279
  watch(model, (value) => isActive.value = value);
1280
+ const { isLoading } = useDialogLoading(() => props.actions);
1267
1281
  const { focusFirstElement } = useDialogFocus(() => isActive.value, () => card.value?.$el);
1268
1282
  function onAfterLeave() {
1269
1283
  model.value = false;
@@ -1273,7 +1287,7 @@ var dialog_default = /* @__PURE__ */ defineComponent({
1273
1287
  return openBlock(), createBlock(unref(VDialog), {
1274
1288
  modelValue: isActive.value,
1275
1289
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
1276
- persistent: unref(host)?.persistent(),
1290
+ persistent: unref(isLoading),
1277
1291
  "max-width": maxWidth.value,
1278
1292
  role: role.value,
1279
1293
  "aria-label": title.value,
@@ -1350,7 +1364,6 @@ var dialog_host_default = /* @__PURE__ */ defineComponent({
1350
1364
  });
1351
1365
  provide(dialogHostKey, {
1352
1366
  role: () => request.value?.role,
1353
- persistent: () => isRunning.value,
1354
1367
  afterLeave: showNext
1355
1368
  });
1356
1369
  onMounted(() => owners$1.value.push(owner));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.46",
3
+ "version": "2.0.0-beta.48",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",