@nexdom/uimed-vue 1.2.0-beta.1 → 1.2.0-beta.2
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/AGENTS.md +145 -0
- package/dist/components.d.ts +107 -2
- package/dist/components.js +224 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -2
package/AGENTS.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
|
|
5
|
+
`@nexdom/uimed-vue` is a Vue 3 UI component library for NEXDOM applications, built on top of [Vuetify](https://vuetifyjs.com/) and [Material Design 3](https://m3.material.io/). It's published to npm and documented via VitePress at https://nexdom-healthtech.github.io/uimed-vue/.
|
|
6
|
+
|
|
7
|
+
Tooling is built around [Vite+](https://github.com/voidzero-dev/vite-plus) (`vp`/`vpr`/`vpx` CLIs), not raw `vite`/`vitest`/`eslint` invocations.
|
|
8
|
+
|
|
9
|
+
## Using this library in an app
|
|
10
|
+
|
|
11
|
+
These steps are for developers _consuming_ `@nexdom/uimed-vue` in a Vue application (not for contributing to this repo — see the rest of this document for that).
|
|
12
|
+
|
|
13
|
+
### Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
vp add @nexdom/uimed-vue
|
|
17
|
+
# But, if you're not using Vite+ yet...
|
|
18
|
+
npm i @nexdom/uimed-vue
|
|
19
|
+
# Or
|
|
20
|
+
pnpm add @nexdom/uimed-vue
|
|
21
|
+
# Or
|
|
22
|
+
yarn add @nexdom/uimed-vue
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Peer dependencies (`@fontsource/roboto`, `@mdi/font`, `@nexdom/shared`, `resize-observer-polyfill`, `vite-plugin-vuetify`, `vite-plus`, `vue`, `vue-router`, `vuetify`) must be installed alongside it — most package managers install these automatically, but confirm versions match what's declared in `package.json`'s `peerDependencies`.
|
|
26
|
+
|
|
27
|
+
### Setup
|
|
28
|
+
|
|
29
|
+
Add the Vite plugin:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
// vite.config.ts
|
|
33
|
+
import { vitePluginUimed } from "@nexdom/uimed-vue/plugins.ts";
|
|
34
|
+
|
|
35
|
+
// ...
|
|
36
|
+
|
|
37
|
+
plugins: [vue(), vitePluginUimed()];
|
|
38
|
+
|
|
39
|
+
// ...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Register the plugin in the Vue app:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// main.js or main.ts
|
|
46
|
+
import { createApp } from "vue";
|
|
47
|
+
import { createUimed } from "@nexdom/uimed-vue";
|
|
48
|
+
|
|
49
|
+
import App from "./App.vue";
|
|
50
|
+
|
|
51
|
+
const uimed = createUimed();
|
|
52
|
+
|
|
53
|
+
createApp(App).use(uimed).mount("#app");
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Usage
|
|
57
|
+
|
|
58
|
+
Place the `Root` component at the top of `App.vue`, then add other components as needed:
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<!-- App.vue -->
|
|
62
|
+
<template>
|
|
63
|
+
<root>
|
|
64
|
+
<!-- ... -->
|
|
65
|
+
</root>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import { Root } from "@nexdom/uimed-vue/components";
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Never write CSS, classes or any kind of styling. Always use component props.
|
|
74
|
+
|
|
75
|
+
Available entry points: `@nexdom/uimed-vue` (root), `@nexdom/uimed-vue/components`, `@nexdom/uimed-vue/composables`, `@nexdom/uimed-vue/plugins`, `@nexdom/uimed-vue/unit-test` (test helpers, e.g. `vueTestUtilsPluginUimed()` for mounting components with Vuetify in Vitest).
|
|
76
|
+
|
|
77
|
+
Full component/composable reference lives in the [docs](https://nexdom-healthtech.github.io/uimed-vue/).
|
|
78
|
+
|
|
79
|
+
## Contributing to this repo
|
|
80
|
+
|
|
81
|
+
The sections below are for developers working _on_ this library itself.
|
|
82
|
+
|
|
83
|
+
### Dev environment setup
|
|
84
|
+
|
|
85
|
+
This project expects to be opened inside its devcontainer (VSCode). If commands below fail with missing shims/commands, run:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
vp env doctor # diagnose missing parts
|
|
89
|
+
vp env setup # create shims like vpr and vpx
|
|
90
|
+
vp install # install dependencies
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Commands
|
|
94
|
+
|
|
95
|
+
- `vpr check` — lint, formatter, and type-check (requires `build`/`pack` to have run first for the type-check step)
|
|
96
|
+
- `vp test --coverage` — unit tests (Vitest, jsdom, 100% coverage threshold enforced)
|
|
97
|
+
- `vpr test:mutations` — mutation tests (Stryker; thresholds: high 100, low 95, break 95)
|
|
98
|
+
- `vpr test:e2e` — E2E tests (Playwright, runs against the built docs preview site)
|
|
99
|
+
- `vpr depcruise` — architecture/dependency rules (dependency-cruiser)
|
|
100
|
+
- `vp pack` / `vpr build` — build the library
|
|
101
|
+
- `vpr docs` / `vpr docs:dev` — run docs site (imports the lib from `dist`, not `src` — run `vpr dev` in a second terminal to keep `dist` updated while iterating)
|
|
102
|
+
|
|
103
|
+
CI (`.github/workflows/ci.yml`) runs, in order: commitlint on PR commits, `vp pack`, `vpr check`, `vpr depcruise`, `vp test --coverage`, `vpr test:mutations`, `vpr test:e2e`. Match this locally before opening a PR.
|
|
104
|
+
|
|
105
|
+
## Code conventions
|
|
106
|
+
|
|
107
|
+
- All `src` code is written in English. `docs` content is written in Portuguese (aimed at Brazilian users), even though file/dir names stay in English.
|
|
108
|
+
- Never write CSS, classes or any kind of styling. Always use component props.
|
|
109
|
+
- Path aliases: `@/*` → `src/*`, `@e2e/*` → `e2e/*`.
|
|
110
|
+
- Every public component follows this pattern to block access to internals and give it an editor-hover description:
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<script lang="ts">
|
|
114
|
+
/**
|
|
115
|
+
* A short description of the component, shown when hovering it in the
|
|
116
|
+
* editor.
|
|
117
|
+
*/
|
|
118
|
+
export default {
|
|
119
|
+
inheritAttrs: false,
|
|
120
|
+
};
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<script setup lang="ts">
|
|
124
|
+
// component's implementation
|
|
125
|
+
</script>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- Component layout: `src/components/<name>/<name>.vue`, `types.ts` for prop/option types, `__tests__/<name>.test.ts` for unit tests. Composables follow the same shape under `src/composables/<name>/`.
|
|
129
|
+
- Public components/composables/types are re-exported from `src/components/index.ts` and `src/composables/index.ts`.
|
|
130
|
+
- Use [JSDoc](https://jsdoc.app/about-getting-started) on every method/prop/type intended to be part of the public API — it's the primary documentation surface and supports markdown/code examples.
|
|
131
|
+
- Known workarounds (see CONTRIBUTING.md before touching related config): `stryker-vue-ignorer` patches a Stryker/Vue macro-hoisting issue; `vue-tsc` is used for type-check instead of Vite+'s built-in one due to an oxlint/Vue support gap. Both are meant to be removed once their upstream issues are fixed — don't build further on top of them without checking if they're still needed.
|
|
132
|
+
|
|
133
|
+
## Testing conventions
|
|
134
|
+
|
|
135
|
+
- Unit tests use Vitest + `@vue/test-utils`, with `vueTestUtilsPluginUimed()` from `@/unit-test.ts` to mount a Vuetify instance.
|
|
136
|
+
- Global unit test setup (`src/__tests__/setup.ts`) stubs `visualViewport`, uses fake timers, and silences `console.error/warn/log`.
|
|
137
|
+
- Coverage threshold is 100%; mutation testing threshold is 100% (break at 100). Don't add code paths without covering tests.
|
|
138
|
+
- E2E tests (Playwright, `e2e/`) run against the built docs preview (`http://localhost:4173/uimed-vue/`). Snapshots/screenshots live under `__snapshots__`/`__screenshot__` next to each spec.
|
|
139
|
+
|
|
140
|
+
## Git workflow
|
|
141
|
+
|
|
142
|
+
- Trunk-based development. `main` is the only long-lived branch (`beta`/`alpha` exist only for pre-release/prototype work — see CONTRIBUTING.md for when to use them). `main`, `beta`, `alpha` are all protected against direct pushes.
|
|
143
|
+
- Short-lived branches are named after their intention (e.g. `fix-some-method-behavior`) and are deleted after merging back via PR.
|
|
144
|
+
- Commit messages MUST follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) — enforced by commitlint in CI. Recent examples: `feat(components): ...`, `fix(composables): ...`, `test(e2e): ...`, `docs(root): ...`, `chore: ...`.
|
|
145
|
+
- Releases are automated via `semantic-release` (conventional-commits preset) — don't hand-edit versions/changelogs.
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,97 @@
|
|
|
1
1
|
import { t as ColorVariant } from "./types-BPXXtbmW.js";
|
|
2
|
+
import { RouteLocationRaw } from "vue-router";
|
|
3
|
+
//#region src/components/app-bar/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Props exposed by the {@link AppBar} component.
|
|
6
|
+
*/
|
|
7
|
+
type AppBarProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Component id to use on automated tests.
|
|
10
|
+
*/
|
|
11
|
+
dataTestid?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Main title to be presented.
|
|
14
|
+
*/
|
|
15
|
+
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Help page route.
|
|
18
|
+
*/
|
|
19
|
+
help?: RouteLocationRaw;
|
|
20
|
+
/**
|
|
21
|
+
* Resources available to the user in the app-bar
|
|
22
|
+
*/
|
|
23
|
+
user?: AppBarUserProps;
|
|
24
|
+
/**
|
|
25
|
+
* List of notifications to show in the {@link AppBar}.
|
|
26
|
+
*/
|
|
27
|
+
notifications?: Array<AppBarNotification>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A single notification entry shown in the {@link AppBar}.
|
|
31
|
+
*/
|
|
32
|
+
interface AppBarNotification {
|
|
33
|
+
/**
|
|
34
|
+
* Main text describing the notification.
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* Complementary text with additional details.
|
|
39
|
+
*/
|
|
40
|
+
subtitle?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the notification has already been read.
|
|
43
|
+
*/
|
|
44
|
+
read?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Date the notification was generated.
|
|
47
|
+
*/
|
|
48
|
+
date?: Date;
|
|
49
|
+
}
|
|
50
|
+
interface AppBarUserProps {
|
|
51
|
+
/**
|
|
52
|
+
* Major identifier, like the user full name.
|
|
53
|
+
*/
|
|
54
|
+
title?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Complement to user identifier, like it's e-mail or username.
|
|
57
|
+
*/
|
|
58
|
+
subtitle?: string;
|
|
59
|
+
/**
|
|
60
|
+
* URL leading to a user picture.
|
|
61
|
+
*/
|
|
62
|
+
img?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Options to show the user when its menu is opened.
|
|
65
|
+
* Can be plain options, grouped or both.
|
|
66
|
+
*/
|
|
67
|
+
options?: Array<ParentOptionOrOption>;
|
|
68
|
+
}
|
|
69
|
+
type ParentOptionOrOption = ParentOption | Option;
|
|
70
|
+
type ParentOption = {
|
|
71
|
+
/**
|
|
72
|
+
* Text to present for the group.
|
|
73
|
+
*/
|
|
74
|
+
description: string;
|
|
75
|
+
/**
|
|
76
|
+
* Child {@link Option} list.
|
|
77
|
+
*/
|
|
78
|
+
items: Array<Option>;
|
|
79
|
+
};
|
|
80
|
+
interface Option {
|
|
81
|
+
/**
|
|
82
|
+
* Text to present for the action.
|
|
83
|
+
*/
|
|
84
|
+
description: string;
|
|
85
|
+
/**
|
|
86
|
+
* Route to navigate when item is clicked.
|
|
87
|
+
*/
|
|
88
|
+
route?: RouteLocationRaw;
|
|
89
|
+
/**
|
|
90
|
+
* Callback to be triggered when the item is clicked.
|
|
91
|
+
*/
|
|
92
|
+
action?: () => void;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
2
95
|
//#region src/components/root/types.d.ts
|
|
3
96
|
/**
|
|
4
97
|
* Props exposed by the {@link Root} component.
|
|
@@ -8,6 +101,10 @@ type RootProps = {
|
|
|
8
101
|
* Component id to use on automated tests.
|
|
9
102
|
*/
|
|
10
103
|
dataTestid?: string;
|
|
104
|
+
/**
|
|
105
|
+
* App bar properties.
|
|
106
|
+
*/
|
|
107
|
+
appBar?: AppBarProps;
|
|
11
108
|
};
|
|
12
109
|
//#endregion
|
|
13
110
|
//#region src/components/root/root.vue.d.ts
|
|
@@ -24,7 +121,15 @@ type RootProps = {
|
|
|
24
121
|
* @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/root | Root Guide}
|
|
25
122
|
*/
|
|
26
123
|
declare const _default$4: typeof __VLS_export$6;
|
|
27
|
-
declare const __VLS_export$6: __VLS_WithSlots$5<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<RootProps
|
|
124
|
+
declare const __VLS_export$6: __VLS_WithSlots$5<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<RootProps & {
|
|
125
|
+
notificationsOpen?: boolean;
|
|
126
|
+
}, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
|
|
127
|
+
"update:notificationsOpen": (value: boolean) => any;
|
|
128
|
+
}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<RootProps & {
|
|
129
|
+
notificationsOpen?: boolean;
|
|
130
|
+
}> & Readonly<{
|
|
131
|
+
"onUpdate:notificationsOpen"?: ((value: boolean) => any) | undefined;
|
|
132
|
+
}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>, {
|
|
28
133
|
default?: (props: {}) => any;
|
|
29
134
|
}>;
|
|
30
135
|
type __VLS_WithSlots$5<T, S> = T & {
|
|
@@ -352,4 +457,4 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
352
457
|
};
|
|
353
458
|
};
|
|
354
459
|
//#endregion
|
|
355
|
-
export { _default as Btn, _default$1 as Column, _default$2 as Container, _default$3 as Frm, _default$4 as Root, _default$5 as Row, _default$6 as TextField };
|
|
460
|
+
export { type AppBarProps as AppBarConfig, type AppBarUserProps as AppBarUserConfig, _default as Btn, _default$1 as Column, _default$2 as Container, _default$3 as Frm, _default$4 as Root, _default$5 as Row, _default$6 as TextField };
|
package/dist/components.js
CHANGED
|
@@ -1,7 +1,206 @@
|
|
|
1
1
|
import { r as useVuetifyColor, t as messages } from "./use-toast-CACuYhK_.js";
|
|
2
|
-
import { computed, createBlock, createPropsRestProxy, createVNode, defineComponent, isRef, mergeModels, mergeProps, openBlock, renderSlot, toValue, unref, useModel, withCtx, withModifiers } from "vue";
|
|
3
|
-
import { VApp, VBtn, VCol, VContainer, VForm, VIconBtn, VMain, VRow, VSnackbarQueue, VTextField } from "vuetify/components";
|
|
4
|
-
import { isEmail, isEmpty, isPhone, isUrl } from "@nexdom/shared/utils";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createSlots, createTextVNode, createVNode, defineComponent, isRef, mergeModels, mergeProps, openBlock, renderList, renderSlot, toDisplayString, toValue, unref, useModel, withCtx, withModifiers } from "vue";
|
|
3
|
+
import { VApp, VAppBar, VAvatar, VBadge, VBtn, VCard, VCardText, VCol, VContainer, VDivider, VForm, VIcon, VIconBtn, VList, VListGroup, VListItem, VListItemAction, VListSubheader, VMain, VMenu, VRow, VSnackbarQueue, VTextField } from "vuetify/components";
|
|
4
|
+
import { formatDateTime, isEmail, isEmpty, isPhone, isUrl, toPeriodInterval } from "@nexdom/shared/utils";
|
|
5
|
+
//#region src/composables/navigation/use-route-props.ts
|
|
6
|
+
function useRouteProps(route) {
|
|
7
|
+
return computed(() => routeToProps(route));
|
|
8
|
+
}
|
|
9
|
+
function routeToProps(route) {
|
|
10
|
+
const location = toValue(route);
|
|
11
|
+
return isExternalRoute(location) ? { href: location } : { to: location };
|
|
12
|
+
}
|
|
13
|
+
function isExternalRoute(route) {
|
|
14
|
+
return typeof route === "string" && route.startsWith("http");
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/components/app-bar/app-bar.vue?vue&type=script&setup=true&lang.ts
|
|
18
|
+
const _hoisted_1 = { class: "opacity-60" };
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/app-bar/app-bar.vue
|
|
21
|
+
var app_bar_default = /* @__PURE__ */ defineComponent({
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
__name: "app-bar",
|
|
24
|
+
props: /*@__PURE__*/ mergeModels({
|
|
25
|
+
dataTestid: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
help: {
|
|
34
|
+
type: null,
|
|
35
|
+
required: false
|
|
36
|
+
},
|
|
37
|
+
user: {
|
|
38
|
+
type: Object,
|
|
39
|
+
required: false
|
|
40
|
+
},
|
|
41
|
+
notifications: {
|
|
42
|
+
type: Array,
|
|
43
|
+
required: false
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
"notificationsOpen": {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
"notificationsOpenModifiers": {}
|
|
51
|
+
}),
|
|
52
|
+
emits: ["update:notificationsOpen"],
|
|
53
|
+
setup(__props) {
|
|
54
|
+
const props = __props;
|
|
55
|
+
const notificationsOpen = useModel(__props, "notificationsOpen");
|
|
56
|
+
const helpBtnDataTestid = computed(() => `${props.dataTestid}-help`);
|
|
57
|
+
const notificationsBtnDataTestid = computed(() => `${props.dataTestid}-notifications`);
|
|
58
|
+
const notificationsMenuDataTestid = computed(() => `${props.dataTestid}-notifications-menu`);
|
|
59
|
+
const userBtnDataTestid = computed(() => `${props.dataTestid}-user`);
|
|
60
|
+
const userMenuDataTestid = computed(() => `${props.dataTestid}-user-menu`);
|
|
61
|
+
const showHelp = computed(() => !!props.help);
|
|
62
|
+
const routeProps = useRouteProps(() => props.help);
|
|
63
|
+
const showNotifications = computed(() => !!props.notifications);
|
|
64
|
+
const unreadCount = computed(() => props.notifications.filter((notification) => !notification.read).length);
|
|
65
|
+
const hasUnreadNotifications = computed(() => unreadCount.value > 0);
|
|
66
|
+
const showUser = computed(() => !!props.user);
|
|
67
|
+
const userAvatarProps = computed(() => props.user.img ? { image: props.user.img } : { icon: "mdi-account-outline" });
|
|
68
|
+
function isParentOption(option) {
|
|
69
|
+
return "items" in option;
|
|
70
|
+
}
|
|
71
|
+
function formatNotificationDate(date) {
|
|
72
|
+
const interval = toPeriodInterval(date);
|
|
73
|
+
if (wasThisMonth(interval)) {
|
|
74
|
+
if (wasToday(interval)) return formatDateTime(date, "HH:mm");
|
|
75
|
+
else if (wasYesterday(interval)) return "Ontem";
|
|
76
|
+
}
|
|
77
|
+
return formatDateTime(date, "DD/MM/YYYY");
|
|
78
|
+
}
|
|
79
|
+
function wasThisMonth(interval) {
|
|
80
|
+
return interval.months === 0 && interval.years === 0;
|
|
81
|
+
}
|
|
82
|
+
function wasToday(interval) {
|
|
83
|
+
return interval.days === 0;
|
|
84
|
+
}
|
|
85
|
+
function wasYesterday(interval) {
|
|
86
|
+
return interval.days === 1;
|
|
87
|
+
}
|
|
88
|
+
return (_ctx, _cache) => {
|
|
89
|
+
return openBlock(), createBlock(unref(VAppBar), {
|
|
90
|
+
title: props.title,
|
|
91
|
+
"data-testid": props.dataTestid
|
|
92
|
+
}, {
|
|
93
|
+
append: withCtx(() => [
|
|
94
|
+
showHelp.value ? (openBlock(), createBlock(unref(VBtn), mergeProps({ key: 0 }, unref(routeProps), {
|
|
95
|
+
"data-testid": helpBtnDataTestid.value,
|
|
96
|
+
icon: "mdi-help-circle-outline"
|
|
97
|
+
}), null, 16, ["data-testid"])) : createCommentVNode("v-if", true),
|
|
98
|
+
showNotifications.value ? (openBlock(), createBlock(unref(VMenu), {
|
|
99
|
+
key: 1,
|
|
100
|
+
modelValue: notificationsOpen.value,
|
|
101
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => notificationsOpen.value = $event),
|
|
102
|
+
"close-on-content-click": false
|
|
103
|
+
}, {
|
|
104
|
+
activator: withCtx(({ props }) => [createVNode(unref(VBtn), mergeProps(props, {
|
|
105
|
+
"data-testid": notificationsBtnDataTestid.value,
|
|
106
|
+
icon: ""
|
|
107
|
+
}), {
|
|
108
|
+
default: withCtx(() => [createVNode(unref(VBadge), {
|
|
109
|
+
"model-value": hasUnreadNotifications.value,
|
|
110
|
+
content: unreadCount.value,
|
|
111
|
+
color: "error"
|
|
112
|
+
}, {
|
|
113
|
+
default: withCtx(() => [createVNode(unref(VIcon), { icon: "mdi-bell-outline" })]),
|
|
114
|
+
_: 1
|
|
115
|
+
}, 8, ["model-value", "content"])]),
|
|
116
|
+
_: 1
|
|
117
|
+
}, 16, ["data-testid"])]),
|
|
118
|
+
default: withCtx(() => [createVNode(unref(VCard), { "data-testid": notificationsMenuDataTestid.value }, {
|
|
119
|
+
default: withCtx(() => [props.notifications?.length ? (openBlock(), createBlock(unref(VList), { key: 0 }, {
|
|
120
|
+
default: withCtx(() => [createVNode(unref(VListSubheader), null, {
|
|
121
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("Notificações", -1)])]),
|
|
122
|
+
_: 1
|
|
123
|
+
}), (openBlock(true), createElementBlock(Fragment, null, renderList(props.notifications, (notification, index) => {
|
|
124
|
+
return openBlock(), createBlock(unref(VListItem), {
|
|
125
|
+
key: index,
|
|
126
|
+
active: !notification.read,
|
|
127
|
+
title: notification.title,
|
|
128
|
+
subtitle: notification.subtitle,
|
|
129
|
+
"active-class": "text-primary"
|
|
130
|
+
}, createSlots({ _: 2 }, [notification.date ? {
|
|
131
|
+
name: "append",
|
|
132
|
+
fn: withCtx(() => [createVNode(unref(VListItemAction), { end: "" }, {
|
|
133
|
+
default: withCtx(() => [createElementVNode("small", _hoisted_1, toDisplayString(formatNotificationDate(notification.date)), 1)]),
|
|
134
|
+
_: 2
|
|
135
|
+
}, 1024)]),
|
|
136
|
+
key: "0"
|
|
137
|
+
} : void 0]), 1032, [
|
|
138
|
+
"active",
|
|
139
|
+
"title",
|
|
140
|
+
"subtitle"
|
|
141
|
+
]);
|
|
142
|
+
}), 128))]),
|
|
143
|
+
_: 1
|
|
144
|
+
})) : (openBlock(), createBlock(unref(VCardText), { key: 1 }, {
|
|
145
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Nenhuma notificação", -1)])]),
|
|
146
|
+
_: 1
|
|
147
|
+
}))]),
|
|
148
|
+
_: 1
|
|
149
|
+
}, 8, ["data-testid"])]),
|
|
150
|
+
_: 1
|
|
151
|
+
}, 8, ["modelValue"])) : createCommentVNode("v-if", true),
|
|
152
|
+
showUser.value ? (openBlock(), createBlock(unref(VMenu), {
|
|
153
|
+
key: 2,
|
|
154
|
+
"close-on-content-click": false
|
|
155
|
+
}, {
|
|
156
|
+
activator: withCtx(({ props }) => [createVNode(unref(VBtn), mergeProps(props, {
|
|
157
|
+
"data-testid": userBtnDataTestid.value,
|
|
158
|
+
icon: ""
|
|
159
|
+
}), {
|
|
160
|
+
default: withCtx(() => [createVNode(unref(VAvatar), mergeProps(userAvatarProps.value, { color: "primary" }), null, 16)]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 16, ["data-testid"])]),
|
|
163
|
+
default: withCtx(() => [createVNode(unref(VCard), {
|
|
164
|
+
title: __props.user?.title,
|
|
165
|
+
subtitle: __props.user?.subtitle,
|
|
166
|
+
"data-testid": userMenuDataTestid.value
|
|
167
|
+
}, {
|
|
168
|
+
prepend: withCtx(() => [createVNode(unref(VAvatar), mergeProps(userAvatarProps.value, { color: "primary" }), null, 16)]),
|
|
169
|
+
default: withCtx(() => [createVNode(unref(VDivider)), createVNode(unref(VList), { nav: "" }, {
|
|
170
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.user?.options, (option, index) => {
|
|
171
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [index > 0 ? (openBlock(), createBlock(unref(VDivider), {
|
|
172
|
+
key: 0,
|
|
173
|
+
class: "mt-1"
|
|
174
|
+
})) : createCommentVNode("v-if", true), isParentOption(option) ? (openBlock(), createBlock(unref(VListGroup), { key: 1 }, {
|
|
175
|
+
activator: withCtx(({ props }) => [createVNode(unref(VListItem), mergeProps({ ref_for: true }, props, { title: option.description }), null, 16, ["title"])]),
|
|
176
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(option.items, (childOption, index) => {
|
|
177
|
+
return openBlock(), createBlock(unref(VListItem), mergeProps({ key: index }, { ref_for: true }, unref(routeToProps)(childOption.route), {
|
|
178
|
+
title: childOption.description,
|
|
179
|
+
onClick: childOption.action
|
|
180
|
+
}), null, 16, ["title", "onClick"]);
|
|
181
|
+
}), 128))]),
|
|
182
|
+
_: 2
|
|
183
|
+
}, 1024)) : (openBlock(), createBlock(unref(VListItem), mergeProps({
|
|
184
|
+
key: 2,
|
|
185
|
+
title: option.description
|
|
186
|
+
}, { ref_for: true }, unref(routeToProps)(option.route), { onClick: option.action }), null, 16, ["title", "onClick"]))], 64);
|
|
187
|
+
}), 128))]),
|
|
188
|
+
_: 1
|
|
189
|
+
})]),
|
|
190
|
+
_: 1
|
|
191
|
+
}, 8, [
|
|
192
|
+
"title",
|
|
193
|
+
"subtitle",
|
|
194
|
+
"data-testid"
|
|
195
|
+
])]),
|
|
196
|
+
_: 1
|
|
197
|
+
})) : createCommentVNode("v-if", true)
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
}, 8, ["title", "data-testid"]);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
});
|
|
5
204
|
//#endregion
|
|
6
205
|
//#region src/components/grid/container/container.vue
|
|
7
206
|
var container_default = /* @__PURE__ */ defineComponent({
|
|
@@ -57,15 +256,32 @@ var toast_default = /* @__PURE__ */ defineComponent({
|
|
|
57
256
|
var root_default = /* @__PURE__ */ defineComponent({
|
|
58
257
|
inheritAttrs: false,
|
|
59
258
|
__name: "root",
|
|
60
|
-
props:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
259
|
+
props: /*@__PURE__*/ mergeModels({
|
|
260
|
+
dataTestid: {
|
|
261
|
+
type: String,
|
|
262
|
+
required: false
|
|
263
|
+
},
|
|
264
|
+
appBar: {
|
|
265
|
+
type: Object,
|
|
266
|
+
required: false
|
|
267
|
+
}
|
|
268
|
+
}, {
|
|
269
|
+
"notificationsOpen": {
|
|
270
|
+
type: Boolean,
|
|
271
|
+
default: false
|
|
272
|
+
},
|
|
273
|
+
"notificationsOpenModifiers": {}
|
|
274
|
+
}),
|
|
275
|
+
emits: ["update:notificationsOpen"],
|
|
64
276
|
setup(__props) {
|
|
65
277
|
const props = __props;
|
|
278
|
+
const notificationsOpen = useModel(__props, "notificationsOpen");
|
|
66
279
|
return (_ctx, _cache) => {
|
|
67
280
|
return openBlock(), createBlock(unref(VApp), { "data-testid": props.dataTestid }, {
|
|
68
|
-
default: withCtx(() => [
|
|
281
|
+
default: withCtx(() => [props.appBar ? (openBlock(), createBlock(app_bar_default, mergeProps({ key: 0 }, props.appBar, {
|
|
282
|
+
"notifications-open": notificationsOpen.value,
|
|
283
|
+
"onUpdate:notificationsOpen": _cache[0] || (_cache[0] = ($event) => notificationsOpen.value = $event)
|
|
284
|
+
}), null, 16, ["notifications-open"])) : createCommentVNode("v-if", true), createVNode(unref(VMain), null, {
|
|
69
285
|
default: withCtx(() => [createVNode(container_default, null, {
|
|
70
286
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), createVNode(toast_default)]),
|
|
71
287
|
_: 3
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import "vuetify/styles";
|
|
|
15
15
|
import { Plugin } from "vue";
|
|
16
16
|
//#region src/index.d.ts
|
|
17
17
|
/**
|
|
18
|
-
* Create an
|
|
18
|
+
* Create an UIMed-Vue instance to be installed after [createApp](https://vuejs.org/guide/essentials/application.html#the-application-instance).
|
|
19
19
|
* @returns an instance to be used with [app.use](https://vuejs.org/guide/essentials/application.html#the-application-instance)
|
|
20
20
|
*/
|
|
21
21
|
declare function createUimed(): Plugin;
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { createVuetify } from "vuetify";
|
|
|
16
16
|
import "vue";
|
|
17
17
|
//#region src/index.ts
|
|
18
18
|
/**
|
|
19
|
-
* Create an
|
|
19
|
+
* Create an UIMed-Vue instance to be installed after [createApp](https://vuejs.org/guide/essentials/application.html#the-application-instance).
|
|
20
20
|
* @returns an instance to be used with [app.use](https://vuejs.org/guide/essentials/application.html#the-application-instance)
|
|
21
21
|
*/
|
|
22
22
|
function createUimed() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexdom/uimed-vue",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.2",
|
|
4
4
|
"description": "A ui framework for NEXDOM applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lib",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"home": "https://github.com/nexdom-healthtech/uimed-vue#readme"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
-
"dist"
|
|
24
|
+
"dist",
|
|
25
|
+
"AGENTS.md"
|
|
25
26
|
],
|
|
26
27
|
"type": "module",
|
|
27
28
|
"exports": {
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
"vitepress": "2.0.0-alpha.19",
|
|
80
81
|
"vitepress-plugin-group-icons": "^1.7.6",
|
|
81
82
|
"vue": "^3.5.40",
|
|
83
|
+
"vue-router": "^5.3.1",
|
|
82
84
|
"vue-tsc": "^3.3.9",
|
|
83
85
|
"vuetify": "^4.2.0"
|
|
84
86
|
},
|
|
@@ -90,6 +92,7 @@
|
|
|
90
92
|
"vite-plugin-vuetify": "^2.1.3",
|
|
91
93
|
"vite-plus": "^0.2.7",
|
|
92
94
|
"vue": "^3.5.40",
|
|
95
|
+
"vue-router": "^5.3.1",
|
|
93
96
|
"vuetify": "^4.2.0"
|
|
94
97
|
},
|
|
95
98
|
"commitlint": {
|