@nexdom/uimed-vue 2.0.0-beta.9 → 2.0.0
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/_virtual/_rolldown/runtime.js +7 -0
- package/dist/components/app-bar/app-bar.js +5 -0
- package/dist/components/app-bar/app-bar.vue_vue_type_script_setup_true_lang.js +286 -0
- package/dist/components/app-bar/types.d.ts +96 -0
- package/dist/components/button/button.js +5 -0
- package/dist/components/button/button.vue.d.ts +31 -0
- package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/button/types.d.ts +65 -0
- package/dist/components/data-sets/data-set/data-set.js +5 -0
- package/dist/components/data-sets/data-set/data-set.vue.d.ts +47 -0
- package/dist/components/data-sets/data-set/data-set.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/data-sets/data-set/types.d.ts +93 -0
- package/dist/components/data-sets/data-set-bar.js +5 -0
- package/dist/components/data-sets/data-set-bar.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/components/data-sets/data-set-item/data-set-item.js +5 -0
- package/dist/components/data-sets/data-set-item/data-set-item.vue.d.ts +35 -0
- package/dist/components/data-sets/data-set-item/data-set-item.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/data-sets/data-set-item/types.d.ts +42 -0
- package/dist/components/details/details.js +5 -0
- package/dist/components/details/details.vue.d.ts +28 -0
- package/dist/components/details/details.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/components/details/types.d.ts +29 -0
- package/dist/components/dialogs/dialog/dialog-host-key.js +10 -0
- package/dist/components/dialogs/dialog/dialog.js +5 -0
- package/dist/components/dialogs/dialog/dialog.vue.d.ts +36 -0
- package/dist/components/dialogs/dialog/dialog.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/dialogs/dialog/types.d.ts +47 -0
- package/dist/components/dialogs/dialog-host.js +5 -0
- package/dist/components/dialogs/dialog-host.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/components/dialogs/toast.js +5 -0
- package/dist/components/dialogs/toast.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/components/footer/footer.js +5 -0
- package/dist/components/footer/footer.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/footer/types.d.ts +16 -0
- package/dist/components/form/form.js +5 -0
- package/dist/components/form/form.vue.d.ts +32 -0
- package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/form/types.d.ts +15 -0
- package/dist/components/grid/column/column.js +5 -0
- package/dist/components/grid/column/column.vue.d.ts +33 -0
- package/dist/components/grid/column/column.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/grid/column/types.d.ts +27 -0
- package/dist/components/grid/container/container.js +5 -0
- package/dist/components/grid/container/container.vue.d.ts +27 -0
- package/dist/components/grid/container/container.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/grid/container/types.d.ts +17 -0
- package/dist/components/grid/row/row.js +5 -0
- package/dist/components/grid/row/row.vue.d.ts +29 -0
- package/dist/components/grid/row/row.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/grid/row/types.d.ts +63 -0
- package/dist/components/icon-button/icon-button.js +5 -0
- package/dist/components/icon-button/icon-button.vue.d.ts +23 -0
- package/dist/components/icon-button/icon-button.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/components/icon-button/types.d.ts +32 -0
- package/dist/components/img/img.js +5 -0
- package/dist/components/img/img.vue.d.ts +23 -0
- package/dist/components/img/img.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/img/types.d.ts +43 -0
- package/dist/components/inputs/autocomplete-field/autocomplete-field.js +5 -0
- package/dist/components/inputs/autocomplete-field/autocomplete-field.vue.d.ts +33 -0
- package/dist/components/inputs/autocomplete-field/autocomplete-field.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/inputs/autocomplete-field/types.d.ts +84 -0
- package/dist/components/inputs/checkbox/checkbox.js +5 -0
- package/dist/components/inputs/checkbox/checkbox.vue.d.ts +33 -0
- package/dist/components/inputs/checkbox/checkbox.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/inputs/checkbox/types.d.ts +35 -0
- package/dist/components/inputs/date-time-field/date-time-field.js +5 -0
- package/dist/components/inputs/date-time-field/date-time-field.vue.d.ts +32 -0
- package/dist/components/inputs/date-time-field/date-time-field.vue_vue_type_script_setup_true_lang.js +205 -0
- package/dist/components/inputs/date-time-field/types.d.ts +84 -0
- package/dist/components/inputs/field-loader.js +5 -0
- package/dist/components/inputs/field-loader.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/inputs/mask-field/mask-field.js +5 -0
- package/dist/components/inputs/mask-field/mask-field.vue.d.ts +32 -0
- package/dist/components/inputs/mask-field/mask-field.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/inputs/mask-field/types.d.ts +118 -0
- package/dist/components/inputs/text-field/text-field.js +5 -0
- package/dist/components/inputs/text-field/text-field.vue.d.ts +30 -0
- package/dist/components/inputs/text-field/text-field.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/components/inputs/text-field/types.d.ts +70 -0
- package/dist/components/link/link.js +5 -0
- package/dist/components/link/link.vue.d.ts +27 -0
- package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/link/types.d.ts +18 -0
- package/dist/components/main/main.js +5 -0
- package/dist/components/main/main.vue.d.ts +33 -0
- package/dist/components/main/main.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/components/main/types.d.ts +75 -0
- package/dist/components/navigation-menu/navigation-menu.js +5 -0
- package/dist/components/navigation-menu/navigation-menu.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/navigation-menu/types.d.ts +62 -0
- package/dist/components/page-transition/page-transition.js +5 -0
- package/dist/components/page-transition/page-transition.vue.d.ts +40 -0
- package/dist/components/page-transition/page-transition.vue_vue_type_script_setup_true_lang.js +27 -0
- package/dist/components/page-transition/types.d.ts +18 -0
- package/dist/components/sections/section/section.js +5 -0
- package/dist/components/sections/section/section.vue.d.ts +28 -0
- package/dist/components/sections/section/section.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/components/sections/section/types.d.ts +80 -0
- package/dist/components/sections/section-content/section-content.js +5 -0
- package/dist/components/sections/section-content/section-content.vue.d.ts +27 -0
- package/dist/components/sections/section-content/section-content.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/components/skeleton-loader/skeleton-loader.js +5 -0
- package/dist/components/skeleton-loader/skeleton-loader.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/table/table.js +5 -0
- package/dist/components/table/table.vue.d.ts +19 -0
- package/dist/components/table/table.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/components/table/types.d.ts +51 -0
- package/dist/components.d.ts +23 -896
- package/dist/components.js +23 -1381
- package/dist/composables/alignment/alignment.js +41 -0
- package/dist/composables/alignment/types.d.ts +12 -0
- package/dist/composables/button/button.js +54 -0
- package/dist/composables/colors/constants.js +27 -0
- package/dist/composables/colors/types.d.ts +4 -0
- package/dist/composables/colors/use-vuetify-background-color.js +16 -0
- package/dist/composables/colors/use-vuetify-color.js +11 -0
- package/dist/composables/colors/use-vuetify-text-color.js +12 -0
- package/dist/composables/data-set/data-set.js +128 -0
- package/dist/composables/dialogs/types.d.ts +88 -0
- package/dist/composables/dialogs/use-confirm.d.ts +21 -0
- package/dist/composables/dialogs/use-confirm.js +55 -0
- package/dist/composables/dialogs/use-decorative-timer.js +25 -0
- package/dist/composables/dialogs/use-dialog-focus.js +64 -0
- package/dist/composables/dialogs/use-dialog-loading.js +13 -0
- package/dist/composables/dialogs/use-dialog.d.ts +36 -0
- package/dist/{use-dialog-Ck2_ZW7T.js → composables/dialogs/use-dialog.js} +2 -53
- package/dist/composables/dialogs/use-run-or-toast.d.ts +27 -0
- package/dist/composables/dialogs/use-run-or-toast.js +65 -0
- package/dist/composables/dialogs/use-toast.d.ts +25 -0
- package/dist/composables/dialogs/use-toast.js +39 -0
- package/dist/composables/dimensions/dimensions.js +18 -0
- package/dist/composables/inputs/autocomplete-field.js +39 -0
- package/dist/composables/inputs/date-time-field.js +109 -0
- package/dist/composables/inputs/fields.js +28 -0
- package/dist/composables/inputs/mask-field.js +133 -0
- package/dist/composables/inputs/rules.js +16 -0
- package/dist/composables/inputs/text-field.js +81 -0
- package/dist/composables/navigation/types.d.ts +54 -0
- package/dist/composables/navigation/use-navigation-rail.js +163 -0
- package/dist/composables/navigation/use-navigation-search-shortcut.js +96 -0
- package/dist/composables/navigation/use-route-props.js +21 -0
- package/dist/composables/navigation/use-unsaved-changes.d.ts +35 -0
- package/dist/composables/navigation/use-unsaved-changes.js +88 -0
- package/dist/composables/section/section.js +34 -0
- package/dist/composables.d.ts +6 -193
- package/dist/composables.js +6 -117
- package/dist/consts/icons.d.ts +67 -0
- package/dist/consts/icons.js +69 -0
- package/dist/consts/locale.js +12 -0
- package/dist/consts/types.d.ts +12 -0
- package/dist/index.d.ts +1 -13
- package/dist/index.js +39 -14
- package/dist/plugins.d.ts +15 -4
- package/dist/plugins.js +54 -3
- package/dist/styles/fonts/UnimedSlab-Regular.woff2 +0 -0
- package/dist/styles/fonts/fonts.css +5 -0
- package/dist/styles/settings.scss +155 -0
- package/dist/unit-test.js +11 -7
- package/package.json +11 -11
- package/skills/uimed-vue/SKILL.md +113 -0
- package/skills/uimed-vue/references/api/components/autocomplete-field.md +45 -0
- package/skills/uimed-vue/references/api/components/button.md +48 -0
- package/skills/uimed-vue/references/api/components/checkbox.md +36 -0
- package/skills/uimed-vue/references/api/components/data-sets/data-set-item.md +61 -0
- package/skills/uimed-vue/references/api/components/data-sets/data-set.md +67 -0
- package/skills/uimed-vue/references/api/components/date-time-field.md +44 -0
- package/skills/uimed-vue/references/api/components/details.md +33 -0
- package/skills/uimed-vue/references/api/components/dialog.md +70 -0
- package/skills/uimed-vue/references/api/components/form.md +43 -0
- package/skills/uimed-vue/references/api/components/grid/column.md +41 -0
- package/skills/uimed-vue/references/api/components/grid/container.md +32 -0
- package/skills/uimed-vue/references/api/components/grid/row.md +37 -0
- package/skills/uimed-vue/references/api/components/icon-button.md +37 -0
- package/skills/uimed-vue/references/api/components/img.md +34 -0
- package/skills/uimed-vue/references/api/components/link.md +31 -0
- package/skills/uimed-vue/references/api/components/main.md +174 -0
- package/skills/uimed-vue/references/api/components/mask-field.md +60 -0
- package/skills/uimed-vue/references/api/components/page-transition.md +37 -0
- package/skills/uimed-vue/references/api/components/sections/section-content.md +23 -0
- package/skills/uimed-vue/references/api/components/sections/section.md +61 -0
- package/skills/uimed-vue/references/api/components/table.md +35 -0
- package/skills/uimed-vue/references/api/components/text-field.md +42 -0
- package/skills/uimed-vue/references/api/composables/use-confirm.md +96 -0
- package/skills/uimed-vue/references/api/composables/use-dialog.md +95 -0
- package/skills/uimed-vue/references/api/composables/use-run-or-toast.md +58 -0
- package/skills/uimed-vue/references/api/composables/use-toast.md +48 -0
- package/skills/uimed-vue/references/api/composables/use-unsaved-changes.md +106 -0
- package/skills/uimed-vue/references/api/index.md +1 -0
- package/skills/uimed-vue/references/guide/components/autocomplete-field.md +256 -0
- package/skills/uimed-vue/references/guide/components/button.md +155 -0
- package/skills/uimed-vue/references/guide/components/checkbox.md +113 -0
- package/skills/uimed-vue/references/guide/components/data-set.md +370 -0
- package/skills/uimed-vue/references/guide/components/date-time-field.md +202 -0
- package/skills/uimed-vue/references/guide/components/details.md +76 -0
- package/skills/uimed-vue/references/guide/components/dialog.md +269 -0
- package/skills/uimed-vue/references/guide/components/form.md +96 -0
- package/skills/uimed-vue/references/guide/components/icon-button.md +76 -0
- package/skills/uimed-vue/references/guide/components/img.md +128 -0
- package/skills/uimed-vue/references/guide/components/layout.md +323 -0
- package/skills/uimed-vue/references/guide/components/link.md +47 -0
- package/skills/uimed-vue/references/guide/components/main.md +435 -0
- package/skills/uimed-vue/references/guide/components/mask-field.md +256 -0
- package/skills/uimed-vue/references/guide/components/page-transition.md +111 -0
- package/skills/uimed-vue/references/guide/components/section.md +232 -0
- package/skills/uimed-vue/references/guide/components/table.md +102 -0
- package/skills/uimed-vue/references/guide/components/text-field.md +172 -0
- package/skills/uimed-vue/references/guide/composables/use-confirm.md +123 -0
- package/skills/uimed-vue/references/guide/composables/use-dialog.md +102 -0
- package/skills/uimed-vue/references/guide/composables/use-run-or-toast.md +55 -0
- package/skills/uimed-vue/references/guide/composables/use-toast.md +57 -0
- package/skills/uimed-vue/references/guide/composables/use-unsaved-changes.md +129 -0
- package/skills/uimed-vue/references/guide/getting-started.md +135 -0
- package/skills/uimed-vue/references/guide/icons.md +71 -0
- package/skills/uimed-vue/references/guide/index.md +51 -0
- package/skills/uimed-vue/references/guide/migration-v1-to-v2.md +191 -0
- package/skills/uimed-vue/references/guide/unit-testing.md +85 -0
- package/AGENTS.md +0 -233
- package/CLAUDE.md +0 -1
- package/dist/types-HPMP8IrV.d.ts +0 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexdom/uimed-vue",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A ui framework for NEXDOM applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lib",
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist",
|
|
25
|
-
"
|
|
26
|
-
"CLAUDE.md"
|
|
25
|
+
"skills"
|
|
27
26
|
],
|
|
28
27
|
"type": "module",
|
|
28
|
+
"sideEffects": [
|
|
29
|
+
"*.css"
|
|
30
|
+
],
|
|
29
31
|
"exports": {
|
|
30
32
|
".": "./dist/index.js",
|
|
31
33
|
"./components": "./dist/components.js",
|
|
@@ -52,11 +54,11 @@
|
|
|
52
54
|
"postinstall": "playwright install --with-deps chromium"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
57
|
+
"@axe-core/playwright": "^4.13.0",
|
|
55
58
|
"@commitlint/cli": "^21.2.1",
|
|
56
59
|
"@commitlint/config-conventional": "^21.2.0",
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@nexdom/shared": "^2.1.1",
|
|
60
|
+
"@mdi/js": "^7.4.47",
|
|
61
|
+
"@nexdom/shared": "^2.3.0",
|
|
60
62
|
"@playwright/test": "^1.62.1",
|
|
61
63
|
"@sonar/scan": "^5.0.0",
|
|
62
64
|
"@stryker-mutator/core": "^10.0.0",
|
|
@@ -76,7 +78,6 @@
|
|
|
76
78
|
"sass-embedded": "^1.103.1",
|
|
77
79
|
"stryker-vue-ignorer": "github:davidlandais/stryker-vue-ignorer",
|
|
78
80
|
"typescript": "^6.0.3",
|
|
79
|
-
"vite-plugin-vuetify": "^2.1.3",
|
|
80
81
|
"vite-plus": "^1.0.0",
|
|
81
82
|
"vitepress": "2.0.0-alpha.19",
|
|
82
83
|
"vitepress-plugin-group-icons": "^1.7.6",
|
|
@@ -88,11 +89,10 @@
|
|
|
88
89
|
"vuetify": "^4.2.0"
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
|
-
"@
|
|
92
|
-
"@
|
|
93
|
-
"@nexdom/shared": "^2.1.1",
|
|
92
|
+
"@mdi/js": "^7.4.47",
|
|
93
|
+
"@nexdom/shared": "^2.3.0",
|
|
94
94
|
"resize-observer-polyfill": "^1.5.1",
|
|
95
|
-
"
|
|
95
|
+
"sass-embedded": "^1.103.1",
|
|
96
96
|
"vite-plus": "^1.0.0",
|
|
97
97
|
"vue": "^3.5.40",
|
|
98
98
|
"vue-component-type-helpers": "^3.3.11",
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: uimed-vue
|
|
3
|
+
description: Use when writing or changing a Vue app that uses @nexdom/uimed-vue (NEXDOM's UI library) — setting it up, choosing and configuring its components and composables, styling, unit tests and upgrading between versions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using @nexdom/uimed-vue in an app
|
|
7
|
+
|
|
8
|
+
This skill ships with the installed version of `@nexdom/uimed-vue`, so it describes exactly the components, props and rules of that version. It only covers how to _use_ the library in an app: the app's own conventions (Git workflow, agents, code style) stay in the app's instructions.
|
|
9
|
+
|
|
10
|
+
The complete guides and API pages of this version are in [`references/`](references/), in Portuguese, generated from the library's documentation:
|
|
11
|
+
|
|
12
|
+
- [`references/guide/getting-started.md`](references/guide/getting-started.md): installation and setup.
|
|
13
|
+
- [`references/guide/components/`](references/guide/components/) and [`references/guide/composables/`](references/guide/composables/): how to use each component and composable, with examples.
|
|
14
|
+
- [`references/api/`](references/api/): props, events, slots and types of each component and composable.
|
|
15
|
+
- [`references/guide/icons.md`](references/guide/icons.md): the icon names the components accept.
|
|
16
|
+
- [`references/guide/unit-testing.md`](references/guide/unit-testing.md): unit tests with Vitest and Vue Test Utils.
|
|
17
|
+
- [`references/guide/migration-v1-to-v2.md`](references/guide/migration-v1-to-v2.md): migrating from v1.
|
|
18
|
+
|
|
19
|
+
Read the page of a component or composable before using it, instead of relying on memory: the library is recent, and its API is not in most models' training data.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
vp add @nexdom/uimed-vue
|
|
25
|
+
# Or, without Vite+
|
|
26
|
+
npm i @nexdom/uimed-vue
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Its peer dependencies (`@mdi/js`, `@nexdom/shared`, `resize-observer-polyfill`, `sass-embedded`, `vite-plus`, `vue`, `vue-component-type-helpers`, `vue-router`, `vuetify`) must be installed in the app too, in the versions declared in the library's `package.json`.
|
|
30
|
+
|
|
31
|
+
## Setup
|
|
32
|
+
|
|
33
|
+
Add the Vite plugin, which compiles the components' styles with the library's font and settings. It's required: without it, the components lose the Unimed Slab font and the library's styles.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// vite.config.ts
|
|
37
|
+
import { vitePluginUimed } from "@nexdom/uimed-vue/plugins";
|
|
38
|
+
|
|
39
|
+
// ...
|
|
40
|
+
|
|
41
|
+
plugins: [vue(), vitePluginUimed()];
|
|
42
|
+
|
|
43
|
+
// ...
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Register the library in the Vue app:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// main.ts
|
|
50
|
+
import { createApp } from "vue";
|
|
51
|
+
import { createUimed } from "@nexdom/uimed-vue";
|
|
52
|
+
import App from "./App.vue";
|
|
53
|
+
|
|
54
|
+
createApp(App).use(createUimed()).mount("#app");
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Rules
|
|
58
|
+
|
|
59
|
+
- Place `UMain` at the top of `App.vue`, and build the screens with the library's components (prefixed with `U`), imported from `@nexdom/uimed-vue/components`:
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<template>
|
|
63
|
+
<u-main :app-bar="appBar">
|
|
64
|
+
<!-- the page goes here -->
|
|
65
|
+
</u-main>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import { UMain } from "@nexdom/uimed-vue/components";
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- Style only through the components' props. Never write CSS, `<style>` blocks, classes or utility classes (spacing, colors, typography) on the library's components: the library only generates the styles its components use, so other classes may not exist.
|
|
74
|
+
- The library is built on Vuetify, but that is an internal detail: don't use Vuetify's components or APIs directly in the app, and don't depend on its classes or theme variables.
|
|
75
|
+
- The library doesn't export prop types. Derive them with `ComponentProps` from `vue-component-type-helpers`:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import type { ComponentProps } from "vue-component-type-helpers";
|
|
79
|
+
import { UMain, USection } from "@nexdom/uimed-vue/components";
|
|
80
|
+
|
|
81
|
+
type MainProps = ComponentProps<typeof UMain>;
|
|
82
|
+
type AppBar = NonNullable<MainProps["appBar"]>;
|
|
83
|
+
type SectionAction = NonNullable<ComponentProps<typeof USection>["actions"]>[number];
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- Icons are passed by name (e.g. `icon="cog"`), from the list in [`references/guide/icons.md`](references/guide/icons.md).
|
|
87
|
+
- The components' internal texts, such as their messages and the names read by screen readers, are in Portuguese (pt-BR).
|
|
88
|
+
|
|
89
|
+
## Entry points
|
|
90
|
+
|
|
91
|
+
| Import | Contents |
|
|
92
|
+
| ------------------------------- | -------------------------------------------------------------------------------------- |
|
|
93
|
+
| `@nexdom/uimed-vue` | `createUimed()`, to register the library in the app |
|
|
94
|
+
| `@nexdom/uimed-vue/components` | The components (`UMain`, `USection`, `UButton`, ...) |
|
|
95
|
+
| `@nexdom/uimed-vue/composables` | The composables (`useDialog`, `useConfirm`, `useToast`, ...) |
|
|
96
|
+
| `@nexdom/uimed-vue/plugins` | `vitePluginUimed()` for Vite, and `vitestServerPluginUimed()` for Vitest |
|
|
97
|
+
| `@nexdom/uimed-vue/unit-test` | `vueTestUtilsPluginUimed()`, to mount the components in unit tests with Vue Test Utils |
|
|
98
|
+
|
|
99
|
+
## Breaking changes in 2.0
|
|
100
|
+
|
|
101
|
+
When upgrading an app from an earlier version, check each change below. The renames, imports, notifications and row alignment have before and after examples in [`references/guide/migration-v1-to-v2.md`](references/guide/migration-v1-to-v2.md).
|
|
102
|
+
|
|
103
|
+
- The components were renamed with the `U` prefix (e.g. `Root` → `UMain`, `Btn` → `UButton`, `ContentSet` → `USection`).
|
|
104
|
+
- The prop types (e.g. `AppBarConfig`, `SectionAction`) are no longer exported: derive them with `ComponentProps`.
|
|
105
|
+
- The theme is light only, with the library's own palette.
|
|
106
|
+
- `vitePluginUimed()` is required: it now provides the Unimed Slab font, which `createUimed()` no longer sets, and `sass-embedded` became a peer dependency (`vite-plugin-vuetify` no longer is).
|
|
107
|
+
- The app bar notifications take `when` (a text shown as is, e.g. `"10:30"` or `"Ontem"`) instead of `date`: the app formats the date.
|
|
108
|
+
- `URow` aligns its columns to the top by default, and its former `align` prop is now `alignY` (`align-y` in templates); `alignX` aligns them horizontally.
|
|
109
|
+
- `UMaskField` with `mask="cnpj"` accepts the alphanumeric CNPJ: its `v-model` may contain uppercase letters.
|
|
110
|
+
- The icons are inline SVGs from `@mdi/js`: the library no longer loads the Material Design Icons font, so `mdi-*` classes in the app stop working. Use the components' icon names.
|
|
111
|
+
- The items inside a navigation menu group no longer accept `icon`: only the first level items show icons.
|
|
112
|
+
- The navigation menu's first level items and groups require `icon`. From 1145px wide up, the menu is a 56px rail always visible on the left of the content, and the app bar no longer shows the button that opens it.
|
|
113
|
+
- The library only generates the utility classes its components use: the app can't rely on other utility classes (e.g. `ga-*`, `d-sm-flex`, `bg-red`).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# UAutocompleteField
|
|
2
|
+
|
|
3
|
+
Componente para campos com preenchimento automático (autocomplete/combobox).
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
8
|
+
| ------------- | ---------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `modelValue` | `T` ou `T[]` | | Valor selecionado ou digitado. Vira array automaticamente quando `multiple` é `true`. |
|
|
10
|
+
| `variant` | `"primary" \| "secondary"` | `"primary"` | Aplica uma variação de estilo distinta ao campo. |
|
|
11
|
+
| `label` | `string` | | Título dado ao campo. |
|
|
12
|
+
| `placeholder` | `string` | | Exemplo de valor para preenchimento do campo. |
|
|
13
|
+
| `hint` | `string` | | Dica, instrução ou mensagem relacionada ao campo. |
|
|
14
|
+
| `required` | `boolean` | `false` | Torna o campo obrigatório para a submissão do formulário. |
|
|
15
|
+
| `disabled` | `boolean` | `false` | Remove a possibilidade de interação com o campo. |
|
|
16
|
+
| `readonly` | `boolean` | `false` | Remove a possibilidade de edição do campo. |
|
|
17
|
+
| `loading` | `boolean` | `false` | Exibe um indicador de carregamento. O campo mantém o rótulo como nome acessível e fica marcado como ocupado, e leitores de tela ignoram o indicador. |
|
|
18
|
+
| `clearable` | `boolean` | `false` | Exibe recurso para limpar o campo. |
|
|
19
|
+
| `strict` | `boolean` | `false` | Quando `true`, força seleção de itens da lista. Quando `false`, permite digitação livre. |
|
|
20
|
+
| `multiple` | `boolean` | `false` | Permite a seleção de múltiplos valores. |
|
|
21
|
+
| `items` | `Array<string \| { label: string; value: T }>` | `[]` | Lista de itens disponíveis para seleção. Pode ser strings ou objetos com label/value. |
|
|
22
|
+
| `dataTestid` | `string` | | Aplica atributo `data-testid` para testes sobre o componente. |
|
|
23
|
+
|
|
24
|
+
## Eventos
|
|
25
|
+
|
|
26
|
+
| Event | Retorno | Descrição |
|
|
27
|
+
| ------------------- | ----------------------------------------- | --------------------------------------------------------- |
|
|
28
|
+
| `update:modelValue` | `T` (ou `T[]` quando `multiple` é `true`) | Retorna o novo valor sempre que o usuário altera o campo. |
|
|
29
|
+
|
|
30
|
+
## Exemplo
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<template>
|
|
34
|
+
<u-autocomplete-field v-model="selectedCountry" label="País" :items="countries" />
|
|
35
|
+
Selecionado: {{ selectedCountry }}
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import { ref } from "vue";
|
|
40
|
+
import { UAutocompleteField } from "@nexdom/uimed-vue/components";
|
|
41
|
+
|
|
42
|
+
const selectedCountry = ref("");
|
|
43
|
+
const countries = ["Brasil", "Portugal", "Moçambique"];
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# UButton
|
|
2
|
+
|
|
3
|
+
Componente para utilização de botões.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
8
|
+
| ------------ | ------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `variant` | `"primary" \| "secondary" \| "ghost"` | `"primary"` | Aplica uma variação de estilo distinta ao botão. |
|
|
10
|
+
| `color` | `"primary" \| "secondary" \| "positive" \| "informative" \| "caution" \| "danger"` | `"primary"` | Aplica uma cor ao botão. |
|
|
11
|
+
| `disabled` | `boolean` | `false` | Remove a possibilidade de clicar ou focar no botão. |
|
|
12
|
+
| `loading` | `boolean` | `false` | Exibe um indicador de carregamento e desabilita o botão enquanto ativa, assim como `disabled`: não é possível clicar ou focar no botão, o evento `click` não é disparado e o seu formulário não é enviado, inclusive ao pressionar `Enter` em um dos campos do formulário, quando o botão é o primeiro botão de envio do formulário. Nesse estado, o botão tem a aparência de desabilitado, com o indicador de carregamento, e, se estiver focado, perde o foco ao entrar em carregamento, como qualquer botão desabilitado. O botão mantém o texto como nome acessível e fica marcado como ocupado, e leitores de tela ignoram o indicador. |
|
|
13
|
+
| `fullWidth` | `boolean` | `false` | Faz o botão ocupar 100% da largura do elemento em que está. |
|
|
14
|
+
| `type` | `"button" \| "submit"` | `button` | Aplica atributo [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type) para modificar o comportamento do componente. Ignorado quando há `route`. |
|
|
15
|
+
| `form` | `string` | | Aplica atributo [`form`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#form), com o `id` do formulário com que o botão está relacionado. Ignorado quando há `route`. |
|
|
16
|
+
| `route` | [`RouteLocationRaw`](https://router.vuejs.org/api/type-aliases/RouteLocationRaw.html) | | Destino do botão, que passa a ser exibido como um link, com a aparência de botão. Uma rota da aplicação (exemplo: `"/pacientes"` ou `{ name: "paciente" }`) navega pelo [Vue Router](https://router.vuejs.org/) da aplicação; um endereço que começa com `http` (exemplo: `"https://google.com"`) navega pelo navegador, na mesma aba. Enquanto `disabled` ou `loading`, o botão não navega e é exibido como um botão desabilitado. |
|
|
17
|
+
| `dataTestid` | `string` | | Aplica atributo `data-testid` para testes sobre o componente. |
|
|
18
|
+
|
|
19
|
+
## Eventos
|
|
20
|
+
|
|
21
|
+
| Evento | Retorno | Descrição |
|
|
22
|
+
| ------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `click` | [`MouseEvent`](https://developer.mozilla.org/pt-BR/docs/Web/API/MouseEvent) | Disparado quando o botão é clicado. Não é disparado enquanto o botão está `disabled` ou `loading`. |
|
|
24
|
+
|
|
25
|
+
## Slots
|
|
26
|
+
|
|
27
|
+
| Slot | Descrição |
|
|
28
|
+
| --------- | --------------------------------- |
|
|
29
|
+
| `default` | Conteúdo exibido dentro do botão. |
|
|
30
|
+
|
|
31
|
+
## Exemplo
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<template>
|
|
35
|
+
<u-button variant="ghost" color="danger" :loading="loading" @click="onClick">Excluir</u-button>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import { ref } from "vue";
|
|
40
|
+
import { UButton } from "@nexdom/uimed-vue/components";
|
|
41
|
+
|
|
42
|
+
const loading = ref(false);
|
|
43
|
+
|
|
44
|
+
function onClick(event: MouseEvent) {
|
|
45
|
+
console.log("Botão clicado!", event);
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# UCheckbox
|
|
2
|
+
|
|
3
|
+
Componente para utilização de caixas de seleção.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
8
|
+
| ------------ | ---------------- | ------- | ------------------------------------------------------------------------- |
|
|
9
|
+
| `modelValue` | `T` \| `boolean` | `false` | Valor selecionado pela caixa de seleção. |
|
|
10
|
+
| `label` | `string` | | Título dado à caixa de seleção. |
|
|
11
|
+
| `disabled` | `boolean` | `false` | Remove a possibilidade de interação com a caixa de seleção. |
|
|
12
|
+
| `readonly` | `boolean` | `false` | Remove a possibilidade de alteração do valor da caixa de seleção. |
|
|
13
|
+
| `trueValue` | `T` \| `boolean` | `true` | Valor aplicado ao `modelValue` quando a caixa de seleção está marcada. |
|
|
14
|
+
| `falseValue` | `T` \| `boolean` | `false` | Valor aplicado ao `modelValue` quando a caixa de seleção está desmarcada. |
|
|
15
|
+
| `dataTestid` | `string` | | Aplica atributo `data-testid` para testes sobre o componente. |
|
|
16
|
+
|
|
17
|
+
## Eventos
|
|
18
|
+
|
|
19
|
+
| Evento | Retorno | Descrição |
|
|
20
|
+
| ------------------- | ------- | ----------------------------------------------------------------------- |
|
|
21
|
+
| `update:modelValue` | `T` | Retorna o novo valor da caixa de seleção sempre que o usuário o altera. |
|
|
22
|
+
|
|
23
|
+
## Exemplo
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<template>
|
|
27
|
+
<u-checkbox v-model="accepted" label="Aceito os termos de uso" />
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import { ref } from "vue";
|
|
32
|
+
import { UCheckbox } from "@nexdom/uimed-vue/components";
|
|
33
|
+
|
|
34
|
+
const accepted = ref(false);
|
|
35
|
+
</script>
|
|
36
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# UDataSetItem
|
|
2
|
+
|
|
3
|
+
Componente utilizado para apresentar um registro listado pelo [`UDataSet`](./data-set.md) como um cartão, baseado no [`USection`](../sections/section.md).
|
|
4
|
+
Ocupa toda a altura da sua coluna, de forma que os cartões de uma mesma linha fiquem alinhados.
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
9
|
+
| ------------ | ---------------------------------------- | ----------- | --------------------------------------------------------------------------- |
|
|
10
|
+
| `title` | `string` | | Título do registro, exibido no topo do cartão. |
|
|
11
|
+
| `subtitle` | `string` | | Breve descrição do registro, exibida abaixo do título. |
|
|
12
|
+
| `variant` | `"primary" \| "secondary"` | `"primary"` | Aplica uma variação de estilo distinta ao cartão, assim como no `USection`. |
|
|
13
|
+
| `actions` | [`action[]`](../sections/section.md#action) | | Lista de ações do registro, exibidas no rodapé do cartão. |
|
|
14
|
+
| `dataTestid` | `string` | | Id do componente para uso em testes automatizados. |
|
|
15
|
+
|
|
16
|
+
## Slots
|
|
17
|
+
|
|
18
|
+
| Slot | Descrição |
|
|
19
|
+
| --------- | ------------------------------------------------------------------------------------------------------------ |
|
|
20
|
+
| `default` | Detalhes do registro, exibidos abaixo do título, como uma [`UTable`](../table.md) `vertical` com alguns campos. |
|
|
21
|
+
|
|
22
|
+
## Exemplo
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<template>
|
|
26
|
+
<u-data-set :items="pacientes" :columns="2">
|
|
27
|
+
<template #default="{ item }">
|
|
28
|
+
<u-data-set-item
|
|
29
|
+
:title="item.nome"
|
|
30
|
+
:subtitle="item.cidade"
|
|
31
|
+
:actions="[{ label: 'Editar', variant: 'secondary', onClick: () => editar(item) }]"
|
|
32
|
+
>
|
|
33
|
+
<u-table
|
|
34
|
+
:headers="['Plano', 'Idade', 'Carteirinha']"
|
|
35
|
+
:items="[[item.plano, item.idade, item.carteirinha]]"
|
|
36
|
+
vertical
|
|
37
|
+
/>
|
|
38
|
+
</u-data-set-item>
|
|
39
|
+
</template>
|
|
40
|
+
</u-data-set>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script lang="ts" setup>
|
|
44
|
+
import { UDataSet, UDataSetItem, UTable } from "@nexdom/uimed-vue/components";
|
|
45
|
+
|
|
46
|
+
const pacientes = [
|
|
47
|
+
{
|
|
48
|
+
id: 1,
|
|
49
|
+
nome: "Ana Souza",
|
|
50
|
+
cidade: "São Paulo - SP",
|
|
51
|
+
plano: "Ouro",
|
|
52
|
+
idade: "34 anos",
|
|
53
|
+
carteirinha: "0001 2345 6789",
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
function editar(paciente: (typeof pacientes)[number]) {
|
|
58
|
+
// ...
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# UDataSet
|
|
2
|
+
|
|
3
|
+
Componente para listagem de registros em uma grade responsiva de cartões, com paginação, pesquisa e ações sobre a listagem.
|
|
4
|
+
Cada registro da página atual ocupa a sua própria coluna da grade e é apresentado pelo slot padrão, normalmente com o componente [`UDataSetItem`](./data-set-item.md).
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
9
|
+
| -------------- | ---------------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| `items` | `T[]` | `[]` | Registros a serem listados. |
|
|
11
|
+
| `columns` | `1 \| 2 \| 3 \| 4 \| 6` | `3` | Quantidade máxima de registros apresentados lado a lado em cada linha da grade. É reduzida quando não há espaço para cartões de pelo menos 240px de largura. Em telas muito pequenas, cada registro ocupa a largura inteira. |
|
|
12
|
+
| `itemsPerPage` | `number` | `10` | Quantidade máxima de registros por página. Os controles de paginação só são exibidos quando há mais de uma página. |
|
|
13
|
+
| `page` | `number` | `1` | Página atual. Utilize com `v-model:page`. |
|
|
14
|
+
| `actions` | [`action[]`](../sections/section.md#action) | | Lista de ações sobre a listagem, como "Novo paciente", exibidas como botões à esquerda da barra acima dos registros. Com o campo de pesquisa, ocupam a metade esquerda da barra, ou uma linha própria quando a listagem não tem largura para dois cartões lado a lado. Em telas muito pequenas, cada ação ocupa uma linha inteira. Sem `variant`, cada ação é `secondary`. |
|
|
15
|
+
| `searchable` | `boolean` | `false` | Exibe um campo de pesquisa à direita da barra acima dos registros, com 240px de largura, a mesma largura mínima de um cartão. Em telas muito pequenas, ocupa a largura inteira. |
|
|
16
|
+
| `search` | `string` | `""` | Texto pesquisado. Utilize com `v-model:search`. Filtra os registros mesmo quando o campo de pesquisa não é exibido. |
|
|
17
|
+
| `searchKeys` | `string[]` | | Propriedades dos registros consideradas na pesquisa. Quando não informada ou vazia, todas as propriedades são consideradas. |
|
|
18
|
+
| `noDataText` | `string` | `"Nenhum registro encontrado."` | Mensagem exibida quando não há registros para listar. |
|
|
19
|
+
| `loading` | `boolean` | `false` | Coloca a listagem em estado de carregamento. |
|
|
20
|
+
| `dataTestid` | `string` | | Id do componente para uso em testes automatizados. |
|
|
21
|
+
|
|
22
|
+
## Eventos
|
|
23
|
+
|
|
24
|
+
| Evento | Retorno | Descrição |
|
|
25
|
+
| --------------- | -------- | ---------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `update:page` | `number` | Retorna a nova página sempre que ela é alterada. Volta para a primeira página a cada pesquisa. |
|
|
27
|
+
| `update:search` | `string` | Retorna o novo texto sempre que o usuário altera o campo de pesquisa. |
|
|
28
|
+
|
|
29
|
+
## Slots
|
|
30
|
+
|
|
31
|
+
| Slot | Props | Descrição |
|
|
32
|
+
| --------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `default` | `{ item: T, index: number }` | Apresenta cada registro da página atual, em uma coluna da grade. Recebe o registro original e a sua posição dentro da página atual. |
|
|
34
|
+
|
|
35
|
+
## Exemplo
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<u-data-set
|
|
40
|
+
v-model:page="pagina"
|
|
41
|
+
:items="pacientes"
|
|
42
|
+
:columns="4"
|
|
43
|
+
:items-per-page="8"
|
|
44
|
+
:actions="[{ label: 'Novo paciente', onClick: novoPaciente }]"
|
|
45
|
+
searchable
|
|
46
|
+
>
|
|
47
|
+
<template #default="{ item }">
|
|
48
|
+
<u-data-set-item :title="item.nome" :subtitle="`Plano ${item.plano}`" />
|
|
49
|
+
</template>
|
|
50
|
+
</u-data-set>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script lang="ts" setup>
|
|
54
|
+
import { ref } from "vue";
|
|
55
|
+
import { UDataSet, UDataSetItem } from "@nexdom/uimed-vue/components";
|
|
56
|
+
|
|
57
|
+
const pagina = ref(1);
|
|
58
|
+
const pacientes = [
|
|
59
|
+
{ id: 1, nome: "Ana Souza", plano: "Ouro" },
|
|
60
|
+
{ id: 2, nome: "Bruno Lima", plano: "Prata" },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
function novoPaciente() {
|
|
64
|
+
// ...
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# UDateTimeField
|
|
2
|
+
|
|
3
|
+
Componente para utilização de campos de data e/ou hora.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
8
|
+
| ------------- | -------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `modelValue` | `string` | `""` | Valor do campo, nos formatos `YYYY-MM-DD` (`date`), `HH:mm` (`time`) ou `YYYY-MM-DDTHH:mm` (`datetime`). |
|
|
10
|
+
| `type` | `"date" \| "time" \| "datetime"` | `"datetime"` | Define os seletores apresentados (data, horário ou ambos) e o formato do valor. |
|
|
11
|
+
| `variant` | `"primary" \| "secondary"` | `"primary"` | Aplica uma variação de estilo distinta ao campo. |
|
|
12
|
+
| `min` | `string` | | Valor mínimo permitido, no mesmo formato do `modelValue`. No tipo `datetime`, o horário mínimo só se aplica à própria data do mínimo. |
|
|
13
|
+
| `max` | `string` | | Valor máximo permitido, no mesmo formato do `modelValue`. No tipo `datetime`, o horário máximo só se aplica à própria data do máximo. |
|
|
14
|
+
| `label` | `string` | | Título dado ao campo. |
|
|
15
|
+
| `placeholder` | `string` | | Exemplo de valor para preenchimento do campo. |
|
|
16
|
+
| `hint` | `string` | | Dica, instrução ou mensagem relacionada ao campo. |
|
|
17
|
+
| `required` | `boolean` | `false` | Torna o campo obrigatório para a submissão do formulário. |
|
|
18
|
+
| `disabled` | `boolean` | `false` | Remove a possibilidade de interação com o campo. |
|
|
19
|
+
| `readonly` | `boolean` | `false` | Remove a possibilidade de edição do campo. O seletor não é aberto. |
|
|
20
|
+
| `loading` | `boolean` | `false` | Exibe um indicador de carregamento. O campo mantém o rótulo como nome acessível e fica marcado como ocupado, e leitores de tela ignoram o indicador. |
|
|
21
|
+
| `clearable` | `boolean` | `false` | Exibe recurso para limpar o campo, alterando o valor para `""`. Não é exibido enquanto o campo for `readonly`. |
|
|
22
|
+
| `dataTestid` | `string` | | Aplica atributo `data-testid` para testes sobre o componente. |
|
|
23
|
+
|
|
24
|
+
## Eventos
|
|
25
|
+
|
|
26
|
+
| Event | Retorno | Descrição |
|
|
27
|
+
| ------------------- | -------- | ---------------------------------------------------------------------------------------- |
|
|
28
|
+
| `update:modelValue` | `string` | Retorna o novo valor do campo sempre que o usuário escolhe um valor completo ou o limpa. |
|
|
29
|
+
|
|
30
|
+
## Exemplo
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<template>
|
|
34
|
+
<u-date-time-field v-model="appointment" label="Data e hora da consulta" />
|
|
35
|
+
Consulta agendada para: {{ appointment }}
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import { ref } from "vue";
|
|
40
|
+
import { UDateTimeField } from "@nexdom/uimed-vue/components";
|
|
41
|
+
|
|
42
|
+
const appointment = ref("");
|
|
43
|
+
</script>
|
|
44
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# UDetails
|
|
2
|
+
|
|
3
|
+
Componente para exibir conteúdo que pode ser expandido e recolhido ao clicar no título.
|
|
4
|
+
Inicia recolhido.
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
9
|
+
| ------------ | -------------------------- | ----------- | ---------------------------------------------------------------------- |
|
|
10
|
+
| `variant` | `"primary" \| "secondary"` | `"primary"` | Aplica uma variação de estilo distinta ao conteúdo expansível. |
|
|
11
|
+
| `title` | `string` | | Título exibido no cabeçalho. Ao clicar, expande ou recolhe o conteúdo. |
|
|
12
|
+
| `loading` | `boolean` | `false` | Coloca o conteúdo expansível em estado de carregamento. |
|
|
13
|
+
| `dataTestid` | `string` | | Id do componente para uso em testes automatizados. |
|
|
14
|
+
|
|
15
|
+
## Slots
|
|
16
|
+
|
|
17
|
+
| Slot | Descrição |
|
|
18
|
+
| --------- | ------------------------------------------- |
|
|
19
|
+
| `default` | Conteúdo exibido quando o item é expandido. |
|
|
20
|
+
|
|
21
|
+
## Exemplo
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<template>
|
|
25
|
+
<u-details title="Mais informações" variant="secondary">
|
|
26
|
+
<p>Conteúdo exibido ao expandir.</p>
|
|
27
|
+
</u-details>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import { UDetails } from "@nexdom/uimed-vue/components";
|
|
32
|
+
</script>
|
|
33
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# UDialog
|
|
2
|
+
|
|
3
|
+
Componente para exibir conteúdo em uma janela modal, sobre a página, até que ela seja fechada.
|
|
4
|
+
O título e as ações ficam fixos enquanto o conteúdo rola.
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
9
|
+
| ------------ | --------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| `modelValue` | `boolean` | `false` | Indica se a janela está aberta. Use com `v-model`. Quando o usuário fecha a janela, passa a ser `false` somente ao fim da animação de fechamento. |
|
|
11
|
+
| `title` | `string` | | Título da janela, em texto simples (HTML não é interpretado), em uma única linha: títulos longos são cortados com reticências. Também é o nome acessível da janela; sem título, o nome acessível é o conteúdo. |
|
|
12
|
+
| `actions` | [`DialogButtonAction[]`](#action) | | Botões exibidos no rodapé da janela, alinhados à direita, nesta ordem. Sem ações, o rodapé não é exibido. Enquanto alguma ação está `loading`, o usuário não consegue fechar a janela; o `v-model` ainda pode fechá-la. |
|
|
13
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | Largura máxima da janela: `small` (400px), `medium` (560px) ou `large` (800px). |
|
|
14
|
+
| `dataTestid` | `string` | | Id do componente para uso em testes automatizados. |
|
|
15
|
+
|
|
16
|
+
### `Action`
|
|
17
|
+
|
|
18
|
+
Estende [`UButtonProps`](./button.md#props) com as seguintes propriedades adicionais:
|
|
19
|
+
|
|
20
|
+
| Prop | Tipo | Descrição |
|
|
21
|
+
| --------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `label` | `string` | Texto exibido no botão de ação. |
|
|
23
|
+
| `onClick` | `(event) => void` | Chamado quando o botão de ação é clicado. Não é chamado enquanto a ação está `disabled` ou `loading`. A janela continua aberta: feche-a pelo `v-model`. |
|
|
24
|
+
|
|
25
|
+
## Eventos
|
|
26
|
+
|
|
27
|
+
| Evento | Retorno | Descrição |
|
|
28
|
+
| ------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `update:modelValue` | `boolean` | Retorna `false` quando o usuário fecha a janela pela tecla `Esc`, por um clique fora dela ou pelo botão "voltar", somente ao fim da animação de fechamento. `Esc`, um clique fora ou o "voltar" feitos enquanto alguma ação está `loading` não fecham a janela nem emitem o evento. |
|
|
30
|
+
|
|
31
|
+
## Slots
|
|
32
|
+
|
|
33
|
+
| Slot | Descrição |
|
|
34
|
+
| --------- | ------------------------------------------------------------- |
|
|
35
|
+
| `default` | Conteúdo exibido dentro da janela, entre o título e as ações. |
|
|
36
|
+
|
|
37
|
+
## Exemplo
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<u-button @click="open = true">Editar paciente</u-button>
|
|
42
|
+
|
|
43
|
+
<u-dialog v-model="open" title="Editar paciente" :actions="actions">
|
|
44
|
+
<u-form id="patient-form" @submit="save">
|
|
45
|
+
<u-text-field v-model="name" label="Nome" required />
|
|
46
|
+
</u-form>
|
|
47
|
+
</u-dialog>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script lang="ts" setup>
|
|
51
|
+
import { computed, ref } from "vue";
|
|
52
|
+
import type { ComponentProps } from "vue-component-type-helpers";
|
|
53
|
+
import { UButton, UDialog, UForm, UTextField } from "@nexdom/uimed-vue/components";
|
|
54
|
+
|
|
55
|
+
type DialogAction = NonNullable<ComponentProps<typeof UDialog>["actions"]>[number];
|
|
56
|
+
|
|
57
|
+
const open = ref(false);
|
|
58
|
+
const name = ref("");
|
|
59
|
+
|
|
60
|
+
const actions = computed<DialogAction[]>(() => [
|
|
61
|
+
{ label: "Cancelar", variant: "ghost", onClick: () => (open.value = false) },
|
|
62
|
+
{ label: "Salvar", type: "submit", form: "patient-form" },
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
function save() {
|
|
66
|
+
console.log("Paciente salvo:", name.value);
|
|
67
|
+
open.value = false;
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
```
|