@nexdom/uimed-vue 2.0.0-beta.51 → 2.0.0-beta.53

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.
@@ -202,10 +202,15 @@ type NavigationMenuParentItem = {
202
202
  */
203
203
  icon?: Icon;
204
204
  /**
205
- * Child {@link NavigationMenuItem} list.
205
+ * Child {@link NavigationMenuChildItem} list. Unlike the first level items, they show no icon.
206
206
  */
207
- items: Array<NavigationMenuItem>;
207
+ items: Array<NavigationMenuChildItem>;
208
208
  };
209
+ /**
210
+ * Item inside a {@link NavigationMenuParentItem}. Only the first level items and groups show an
211
+ * icon, so every menu follows the same visual pattern.
212
+ */
213
+ type NavigationMenuChildItem = Omit<NavigationMenuItem, "icon">;
209
214
  interface NavigationMenuItem {
210
215
  /**
211
216
  * Text to present for the item.
@@ -3,7 +3,7 @@ import { a as messages, c as colorToVuetifyTextColor, n as owners$1, r as reques
3
3
  import { useLocale, useMask } from "vuetify";
4
4
  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";
5
5
  import { pt } from "vuetify/locale";
6
- 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";
6
+ import { VApp, VAppBar, VAppBarNavIcon, VAppBarTitle, VAutocomplete, VAvatar, VBadge, VBtn, VCard, VCardActions, VCardItem, 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";
7
7
  import { formatDateTime, isEmail, isEmpty, isPhone, isUrl, toInitials } from "@nexdom/shared/utils";
8
8
  import { VHighlight } from "vuetify/labs/VHighlight";
9
9
  import { RouterLink } from "vue-router";
@@ -272,6 +272,7 @@ var app_bar_default = /* @__PURE__ */ defineComponent({
272
272
  if (userInitials.value) return { text: userInitials.value };
273
273
  return { icon: icons.accountAlternative };
274
274
  });
275
+ const hasUserInfo = computed(() => !!props.user.title || !!props.user.subtitle);
275
276
  function isParentOption(option) {
276
277
  return "items" in option;
277
278
  }
@@ -368,51 +369,59 @@ var app_bar_default = /* @__PURE__ */ defineComponent({
368
369
  }), null, 16)]),
369
370
  _: 1
370
371
  }, 16, ["data-testid"])]),
371
- default: withCtx(() => [createVNode(unref(VCard), {
372
- title: __props.user?.title,
373
- subtitle: __props.user?.subtitle,
374
- "data-testid": userMenuDataTestid.value
375
- }, {
376
- prepend: withCtx(() => [createCommentVNode(" Decorative: the user's name, when given, is already the card's title "), createVNode(unref(VAvatar), mergeProps(userAvatarProps.value, {
377
- color: "primary",
378
- "aria-hidden": "true"
379
- }), null, 16)]),
380
- default: withCtx(() => [createVNode(unref(VDivider)), createVNode(unref(VList), {
381
- nav: "",
382
- role: "group"
383
- }, {
384
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.user?.options, (option, index) => {
385
- return openBlock(), createElementBlock(Fragment, { key: index }, [index > 0 ? (openBlock(), createBlock(unref(VDivider), {
386
- key: 0,
387
- class: "mt-1"
388
- })) : createCommentVNode("v-if", true), isParentOption(option) ? (openBlock(), createBlock(unref(VListGroup), { key: 1 }, {
389
- activator: withCtx(({ props, isOpen }) => [createVNode(unref(VListItem), mergeProps({ ref_for: true }, props, {
390
- title: option.description,
391
- "aria-expanded": isOpen,
392
- role: void 0,
393
- tag: "button",
394
- type: "button"
395
- }), null, 16, ["title", "aria-expanded"])]),
396
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(option.items, (childOption, index) => {
397
- return openBlock(), createBlock(unref(VListItem), mergeProps({ key: index }, { ref_for: true }, unref(routeToListItemProps)(childOption.route), {
398
- title: childOption.description,
399
- onClick: childOption.action
400
- }), null, 16, ["title", "onClick"]);
401
- }), 128))]),
402
- _: 2
403
- }, 1024)) : (openBlock(), createBlock(unref(VListItem), mergeProps({
404
- key: 2,
405
- title: option.description
406
- }, { ref_for: true }, unref(routeToListItemProps)(option.route), { onClick: option.action }), null, 16, ["title", "onClick"]))], 64);
407
- }), 128))]),
408
- _: 1
409
- })]),
372
+ default: withCtx(() => [createVNode(unref(VCard), { "data-testid": userMenuDataTestid.value }, {
373
+ default: withCtx(() => [
374
+ createCommentVNode(" The card's header puts the avatar beside the title, and no prop stacks or centers\n them: the avatar and the user's info get an item each, centered by a class, as USection\n and UFooter center their text. The options below stay aligned to the start "),
375
+ createVNode(unref(VCardItem), { class: "text-center" }, {
376
+ default: withCtx(() => [createCommentVNode(" Decorative: the user's name, when given, is already the title below "), createVNode(unref(VAvatar), mergeProps(userAvatarProps.value, {
377
+ size: "x-large",
378
+ color: "primary",
379
+ "aria-hidden": "true"
380
+ }), null, 16)]),
381
+ _: 1
382
+ }),
383
+ hasUserInfo.value ? (openBlock(), createBlock(unref(VCardItem), {
384
+ key: 0,
385
+ title: __props.user?.title,
386
+ subtitle: __props.user?.subtitle,
387
+ class: "text-center"
388
+ }, null, 8, ["title", "subtitle"])) : createCommentVNode("v-if", true),
389
+ createVNode(unref(VDivider)),
390
+ createCommentVNode(" Vuetify's `list` role only allows list items, but the options are links and\n separators "),
391
+ createVNode(unref(VList), {
392
+ nav: "",
393
+ role: "group"
394
+ }, {
395
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.user?.options, (option, index) => {
396
+ return openBlock(), createElementBlock(Fragment, { key: index }, [index > 0 ? (openBlock(), createBlock(unref(VDivider), {
397
+ key: 0,
398
+ class: "mt-1"
399
+ })) : createCommentVNode("v-if", true), isParentOption(option) ? (openBlock(), createBlock(unref(VListGroup), { key: 1 }, {
400
+ activator: withCtx(({ props, isOpen }) => [createVNode(unref(VListItem), mergeProps({ ref_for: true }, props, {
401
+ title: option.description,
402
+ "aria-expanded": isOpen,
403
+ role: void 0,
404
+ tag: "button",
405
+ type: "button",
406
+ class: "w-100 text-start"
407
+ }), null, 16, ["title", "aria-expanded"])]),
408
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(option.items, (childOption, index) => {
409
+ return openBlock(), createBlock(unref(VListItem), mergeProps({ key: index }, { ref_for: true }, unref(routeToListItemProps)(childOption.route), {
410
+ title: childOption.description,
411
+ onClick: childOption.action
412
+ }), null, 16, ["title", "onClick"]);
413
+ }), 128))]),
414
+ _: 2
415
+ }, 1024)) : (openBlock(), createBlock(unref(VListItem), mergeProps({
416
+ key: 2,
417
+ title: option.description
418
+ }, { ref_for: true }, unref(routeToListItemProps)(option.route), { onClick: option.action }), null, 16, ["title", "onClick"]))], 64);
419
+ }), 128))]),
420
+ _: 1
421
+ })
422
+ ]),
410
423
  _: 1
411
- }, 8, [
412
- "title",
413
- "subtitle",
414
- "data-testid"
415
- ])]),
424
+ }, 8, ["data-testid"])]),
416
425
  _: 1
417
426
  })) : createCommentVNode("v-if", true)
418
427
  ]),
@@ -812,7 +821,8 @@ var navigation_menu_default = /* @__PURE__ */ defineComponent({
812
821
  "aria-expanded": isOpen,
813
822
  role: void 0,
814
823
  tag: "button",
815
- type: "button"
824
+ type: "button",
825
+ class: "w-100 text-start"
816
826
  }), null, 16, [
817
827
  "title",
818
828
  "prepend-icon",
@@ -821,13 +831,8 @@ var navigation_menu_default = /* @__PURE__ */ defineComponent({
821
831
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(item.items, (childItem, childIndex) => {
822
832
  return openBlock(), createBlock(unref(VListItem), mergeProps({ key: childIndex }, { ref_for: true }, unref(routeToListItemProps)(childItem.route), {
823
833
  title: childItem.description,
824
- "prepend-icon": childItem.icon && unref(icons)[childItem.icon],
825
834
  onClick: childItem.action
826
- }), null, 16, [
827
- "title",
828
- "prepend-icon",
829
- "onClick"
830
- ]);
835
+ }), null, 16, ["title", "onClick"]);
831
836
  }), 128))]),
832
837
  _: 2
833
838
  }, 1024)) : (openBlock(), createBlock(unref(VListItem), mergeProps({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.51",
3
+ "version": "2.0.0-beta.53",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",