@nexdom/uimed-vue 2.0.0-beta.47 → 2.0.0-beta.49
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
CHANGED
|
@@ -252,6 +252,18 @@ type MainProps = {
|
|
|
252
252
|
* @default false
|
|
253
253
|
*/
|
|
254
254
|
loading?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Applies a color to the background of the whole app, e.g. on landing pages. Text placed
|
|
257
|
+
* directly on the background takes the color the theme pairs with it (white or black), while
|
|
258
|
+
* the app bar, the footer, sections and dialogs keep their own backgrounds. When omitted, the
|
|
259
|
+
* app uses the theme's default background.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```vue
|
|
263
|
+
* <u-main background="primary" />
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
background?: ColorVariant;
|
|
255
267
|
};
|
|
256
268
|
//#endregion
|
|
257
269
|
//#region src/components/main/main.vue.d.ts
|
|
@@ -1715,6 +1727,8 @@ type DialogProps = {
|
|
|
1715
1727
|
* Buttons displayed at the bottom of the dialog, right-aligned, in the given order.
|
|
1716
1728
|
* Place the main action last. When undefined or empty, no actions area is rendered.
|
|
1717
1729
|
* Clicking an action doesn't close the dialog: set `v-model` to `false` in `onClick`.
|
|
1730
|
+
* While any action is `loading`, the user can't close the dialog with `Esc`, a click outside or
|
|
1731
|
+
* the browser's back button, but setting `v-model` to `false` still closes it.
|
|
1718
1732
|
*/
|
|
1719
1733
|
actions?: DialogButtonAction[];
|
|
1720
1734
|
/**
|
|
@@ -1730,7 +1744,7 @@ type DialogProps = {
|
|
|
1730
1744
|
};
|
|
1731
1745
|
/**
|
|
1732
1746
|
* A single action rendered inside {@link Dialog}'s actions area. Same shape as `USection`'s
|
|
1733
|
-
* actions.
|
|
1747
|
+
* actions. While it's `loading`, the user can't close the dialog, but setting `v-model` to `false` still does.
|
|
1734
1748
|
*/
|
|
1735
1749
|
interface DialogButtonAction extends ButtonProps {
|
|
1736
1750
|
/**
|
package/dist/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as messages, c as colorToVuetifyTextColor, n as owners$1, r as requests, s as useVuetifyColor } from "./use-dialog-
|
|
1
|
+
import { a as messages, c as colorToVuetifyColor, l as colorToVuetifyTextColor, n as owners$1, r as requests, s as useVuetifyColor } from "./use-dialog-C0sM_bA2.js";
|
|
2
2
|
import { useLocale, useMask } from "vuetify";
|
|
3
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";
|
|
4
4
|
import { pt } from "vuetify/locale";
|
|
@@ -100,7 +100,7 @@ function useNavigationSearchShortcut(options) {
|
|
|
100
100
|
input.select();
|
|
101
101
|
}
|
|
102
102
|
function findInput() {
|
|
103
|
-
return field
|
|
103
|
+
return toValue(field).$el.querySelector("input");
|
|
104
104
|
}
|
|
105
105
|
function close() {
|
|
106
106
|
open.value = false;
|
|
@@ -1175,23 +1175,23 @@ const focusable = [
|
|
|
1175
1175
|
function useDialogFocus(isActive, card) {
|
|
1176
1176
|
/** Focus state of this dialog, shared with the dialogs opened from it. */
|
|
1177
1177
|
const focusState = {
|
|
1178
|
-
isOpen: isActive,
|
|
1178
|
+
isOpen: () => toValue(isActive),
|
|
1179
1179
|
origin: null
|
|
1180
1180
|
};
|
|
1181
|
-
onMounted(() => onActiveChange(isActive
|
|
1182
|
-
watch(isActive, onActiveChange);
|
|
1181
|
+
onMounted(() => onActiveChange(toValue(isActive)));
|
|
1182
|
+
watch(() => toValue(isActive), onActiveChange);
|
|
1183
1183
|
function onActiveChange(active) {
|
|
1184
1184
|
if (active) {
|
|
1185
1185
|
focusState.origin = document.activeElement;
|
|
1186
1186
|
return;
|
|
1187
1187
|
}
|
|
1188
|
-
const element = card
|
|
1188
|
+
const element = toValue(card);
|
|
1189
1189
|
if (element) closedDialogs.set(element, focusState);
|
|
1190
1190
|
const target = findFocusTarget(focusState.origin);
|
|
1191
1191
|
if (hasFocus(element) && (target instanceof HTMLElement || target instanceof SVGElement)) target.focus();
|
|
1192
1192
|
}
|
|
1193
1193
|
function focusFirstElement() {
|
|
1194
|
-
card
|
|
1194
|
+
toValue(card)?.querySelector(focusable)?.focus();
|
|
1195
1195
|
}
|
|
1196
1196
|
return { focusFirstElement };
|
|
1197
1197
|
}
|
|
@@ -1214,6 +1214,17 @@ function hasFocus(card) {
|
|
|
1214
1214
|
return !!card && (card.contains(active) || active.contains(card));
|
|
1215
1215
|
}
|
|
1216
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
|
|
1217
1228
|
//#region src/components/dialogs/dialog/dialog.vue?vue&type=script&setup=true&lang.ts
|
|
1218
1229
|
const _hoisted_1$1 = ["id"];
|
|
1219
1230
|
//#endregion
|
|
@@ -1266,6 +1277,7 @@ var dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
1266
1277
|
*/
|
|
1267
1278
|
const isActive = ref(model.value);
|
|
1268
1279
|
watch(model, (value) => isActive.value = value);
|
|
1280
|
+
const { isLoading } = useDialogLoading(() => props.actions);
|
|
1269
1281
|
const { focusFirstElement } = useDialogFocus(() => isActive.value, () => card.value?.$el);
|
|
1270
1282
|
function onAfterLeave() {
|
|
1271
1283
|
model.value = false;
|
|
@@ -1275,7 +1287,7 @@ var dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
1275
1287
|
return openBlock(), createBlock(unref(VDialog), {
|
|
1276
1288
|
modelValue: isActive.value,
|
|
1277
1289
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
1278
|
-
persistent: unref(
|
|
1290
|
+
persistent: unref(isLoading),
|
|
1279
1291
|
"max-width": maxWidth.value,
|
|
1280
1292
|
role: role.value,
|
|
1281
1293
|
"aria-label": title.value,
|
|
@@ -1352,7 +1364,6 @@ var dialog_host_default = /* @__PURE__ */ defineComponent({
|
|
|
1352
1364
|
});
|
|
1353
1365
|
provide(dialogHostKey, {
|
|
1354
1366
|
role: () => request.value?.role,
|
|
1355
|
-
persistent: () => isRunning.value,
|
|
1356
1367
|
afterLeave: showNext
|
|
1357
1368
|
});
|
|
1358
1369
|
onMounted(() => owners$1.value.push(owner));
|
|
@@ -1398,6 +1409,19 @@ var dialog_host_default = /* @__PURE__ */ defineComponent({
|
|
|
1398
1409
|
}
|
|
1399
1410
|
});
|
|
1400
1411
|
//#endregion
|
|
1412
|
+
//#region src/composables/colors/use-vuetify-background-color.ts
|
|
1413
|
+
/**
|
|
1414
|
+
* Vuetify's utility class that applies a color to the background of an element, and the color the
|
|
1415
|
+
* theme pairs with it to its text, for props that color a background. No class when the color is
|
|
1416
|
+
* omitted, so the element keeps its default background.
|
|
1417
|
+
*/
|
|
1418
|
+
function useVuetifyBackgroundColor(color) {
|
|
1419
|
+
return computed(() => {
|
|
1420
|
+
const colorValue = toValue(color);
|
|
1421
|
+
return colorValue ? `bg-${colorToVuetifyColor[colorValue]}` : void 0;
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1401
1425
|
//#region src/components/main/main.vue
|
|
1402
1426
|
var main_default = /* @__PURE__ */ defineComponent({
|
|
1403
1427
|
inheritAttrs: false,
|
|
@@ -1426,6 +1450,10 @@ var main_default = /* @__PURE__ */ defineComponent({
|
|
|
1426
1450
|
loading: {
|
|
1427
1451
|
type: Boolean,
|
|
1428
1452
|
required: false
|
|
1453
|
+
},
|
|
1454
|
+
background: {
|
|
1455
|
+
type: String,
|
|
1456
|
+
required: false
|
|
1429
1457
|
}
|
|
1430
1458
|
}, {
|
|
1431
1459
|
"notificationsOpen": {
|
|
@@ -1443,10 +1471,14 @@ var main_default = /* @__PURE__ */ defineComponent({
|
|
|
1443
1471
|
navigation: props.navigationMenu !== void 0,
|
|
1444
1472
|
loading: props.loading
|
|
1445
1473
|
} : void 0);
|
|
1474
|
+
const backgroundClass = useVuetifyBackgroundColor(() => props.background);
|
|
1446
1475
|
const notificationsOpen = useModel(__props, "notificationsOpen");
|
|
1447
1476
|
const navigationMenuOpen = ref(false);
|
|
1448
1477
|
return (_ctx, _cache) => {
|
|
1449
|
-
return openBlock(), createBlock(unref(VApp), {
|
|
1478
|
+
return openBlock(), createBlock(unref(VApp), {
|
|
1479
|
+
class: normalizeClass(unref(backgroundClass)),
|
|
1480
|
+
"data-testid": props.dataTestid
|
|
1481
|
+
}, {
|
|
1450
1482
|
default: withCtx(() => [
|
|
1451
1483
|
appBarProps.value ? (openBlock(), createBlock(app_bar_default, mergeProps({ key: 0 }, appBarProps.value, {
|
|
1452
1484
|
"notifications-open": notificationsOpen.value,
|
|
@@ -1473,7 +1505,7 @@ var main_default = /* @__PURE__ */ defineComponent({
|
|
|
1473
1505
|
props.footer?.description ? (openBlock(), createBlock(footer_default, normalizeProps(mergeProps({ key: 2 }, props.footer)), null, 16)) : createCommentVNode("v-if", true)
|
|
1474
1506
|
]),
|
|
1475
1507
|
_: 3
|
|
1476
|
-
}, 8, ["data-testid"]);
|
|
1508
|
+
}, 8, ["class", "data-testid"]);
|
|
1477
1509
|
};
|
|
1478
1510
|
}
|
|
1479
1511
|
});
|
package/dist/composables.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as useDialog, o as useToast, t as openDialog } from "./use-dialog-
|
|
1
|
+
import { i as useDialog, o as useToast, t as openDialog } from "./use-dialog-C0sM_bA2.js";
|
|
2
2
|
import { computed, onActivated, onDeactivated, onMounted, onUnmounted, ref, toValue, watch } from "vue";
|
|
3
3
|
import { isDeepEqual } from "@nexdom/shared/utils";
|
|
4
4
|
import { onBeforeRouteLeave } from "vue-router";
|
|
@@ -135,4 +135,4 @@ function dialog(options) {
|
|
|
135
135
|
}, (value) => value);
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
138
|
-
export { messages as a,
|
|
138
|
+
export { messages as a, colorToVuetifyColor as c, useDialog as i, colorToVuetifyTextColor as l, owners as n, useToast as o, requests as r, useVuetifyColor as s, openDialog as t };
|