@nexdom/uimed-vue 1.1.0-beta.1 → 1.1.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.
@@ -12,9 +12,18 @@ type RootProps = {
12
12
  //#region src/components/root/root.vue.d.ts
13
13
  /**
14
14
  * Root component to be placed at the top of the component tree.
15
+ *
16
+ * @example
17
+ * ```vue
18
+ * <root>
19
+ * <!-- uimed-components -->
20
+ * </root>
21
+ * ```
22
+ *
23
+ * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/root | Root Guide}
15
24
  */
16
- declare const _default$1: typeof __VLS_export$1;
17
- declare const __VLS_export$1: __VLS_WithSlots$1<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<RootProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<RootProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>, {
25
+ declare const _default$1: typeof __VLS_export$2;
26
+ declare const __VLS_export$2: __VLS_WithSlots$1<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<RootProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {}, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<RootProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>, {
18
27
  default?: (props: {}) => any;
19
28
  }>;
20
29
  type __VLS_WithSlots$1<T, S> = T & {
@@ -24,15 +33,7 @@ type __VLS_WithSlots$1<T, S> = T & {
24
33
  };
25
34
  //#endregion
26
35
  //#region src/components/btn/types.d.ts
27
- /**
28
- * Style variation for the {@link Btn} component.
29
- * {@link btnVariantToVuetifyVariant} for the mapping applied when rendering.
30
- */
31
36
  type BtnVariant = "primary" | "secondary" | "ghost";
32
- /**
33
- * Color palette for the {@link Btn} component.
34
- * {@link btnColorToVuetifyColor} for the mapping applied when rendering.
35
- */
36
37
  type BtnColor = "primary" | "secondary" | "positive" | "informative" | "caution" | "danger";
37
38
  /**
38
39
  * Props exposed by the {@link Btn} component.
@@ -72,15 +73,15 @@ type BtnProps = {
72
73
  *
73
74
  * @example
74
75
  * ```vue
75
- * <btn variant="primary" color="danger" @click="onClick">
76
+ * <btn color="danger" @click="onClick">
76
77
  * Confirmar
77
78
  * </btn>
78
79
  * ```
79
80
  *
80
- * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/btn | Guia do Btn}
81
+ * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/btn | Btn Guide}
81
82
  */
82
- declare const _default: typeof __VLS_export;
83
- declare const __VLS_export: __VLS_WithSlots<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<BtnProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {} & {
83
+ declare const _default: typeof __VLS_export$1;
84
+ declare const __VLS_export$1: __VLS_WithSlots<import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<BtnProps, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {} & {
84
85
  click: (event: MouseEvent) => any;
85
86
  }, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<BtnProps> & Readonly<{
86
87
  onClick?: ((event: MouseEvent) => any) | undefined;
@@ -93,4 +94,85 @@ type __VLS_WithSlots<T, S> = T & {
93
94
  };
94
95
  };
95
96
  //#endregion
96
- export { _default as Btn, _default$1 as Root };
97
+ //#region src/components/text-field/types.d.ts
98
+ type TextFieldVariant = "primary" | "secondary";
99
+ type TextFieldType = "text" | "phone" | "email" | "url" | "password" | "search";
100
+ /**
101
+ * Props exposed by the {@link TextField} component.
102
+ */
103
+ type TextFieldProps = {
104
+ /**
105
+ * Applies a distinct style variation to the field.
106
+ * One of `primary` or `secondary`.
107
+ * @default "primary"
108
+ */
109
+ variant?: TextFieldVariant;
110
+ /**
111
+ * Applies a distinct behavior to the field.
112
+ * One of `text`, `phone`, `email`, `url`, `password` or `search`.
113
+ * @default "text"
114
+ */
115
+ type?: TextFieldType;
116
+ /**
117
+ * Removes the ability to click or target the field.
118
+ * @default false
119
+ */
120
+ disabled?: boolean;
121
+ /**
122
+ * Displays a loading indicator on the input.
123
+ * @default false
124
+ */
125
+ loading?: boolean;
126
+ /**
127
+ * Displays clear action.
128
+ * @default false
129
+ */
130
+ clearable?: boolean;
131
+ /**
132
+ * Prevent value changes.
133
+ * @default false
134
+ */
135
+ readonly?: boolean;
136
+ /**
137
+ * Field label.
138
+ */
139
+ label?: string;
140
+ /**
141
+ * Field placeholder.
142
+ */
143
+ placeholder?: string;
144
+ /**
145
+ * Field message to show and direct user to fill field correctly.
146
+ *
147
+ * This message will be replaced when there's an error message to be shown.
148
+ */
149
+ hint?: string;
150
+ /**
151
+ * Component id to use on automated tests.
152
+ */
153
+ dataTestid?: string;
154
+ };
155
+ //#endregion
156
+ //#region src/components/text-field/text-field.vue.d.ts
157
+ /**
158
+ * Text field component to be used throughout the application.
159
+ *
160
+ * @example
161
+ * ```vue
162
+ * <text-field label="E-mail" type="email" />
163
+ * ```
164
+ *
165
+ * @see {@link https://nexdom-healthtech.github.io/uimed-vue/guide/components/text-field | TextField Guide}
166
+ */
167
+ declare const _default$2: typeof __VLS_export;
168
+ declare const __VLS_export: import("vue", { with: { "resolution-mode": "import" } }).DefineComponent<TextFieldProps & {
169
+ modelValue?: string;
170
+ }, {}, {}, {}, {}, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, import("vue", { with: { "resolution-mode": "import" } }).ComponentOptionsMixin, {
171
+ "update:modelValue": (value: string) => any;
172
+ }, string, import("vue", { with: { "resolution-mode": "import" } }).PublicProps, Readonly<TextFieldProps & {
173
+ modelValue?: string;
174
+ }> & Readonly<{
175
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
176
+ }>, {}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
177
+ //#endregion
178
+ export { _default as Btn, _default$1 as Root, _default$2 as TextField };
@@ -1,5 +1,5 @@
1
- import { computed, createBlock, defineComponent, openBlock, renderSlot, unref, withCtx } from "vue";
2
- import { VApp, VBtn } from "vuetify/components";
1
+ import { computed, createBlock, createPropsRestProxy, defineComponent, mergeModels, openBlock, renderSlot, toValue, unref, useModel, withCtx } from "vue";
2
+ import { VApp, VBtn, VTextField } from "vuetify/components";
3
3
  //#endregion
4
4
  //#region src/components/root/root.vue
5
5
  var root_default = /* @__PURE__ */ defineComponent({
@@ -20,32 +20,12 @@ var root_default = /* @__PURE__ */ defineComponent({
20
20
  }
21
21
  });
22
22
  //#endregion
23
- //#region src/components/btn/consts.ts
24
- /**
25
- * Maps {@link BtnVariant} to the underlying Vuetify `VBtn` `variant` value.
26
- * Each value is checked against Vuetify's prop type, so a variant renamed or
27
- * removed by Vuetify fails to type-check here.
28
- */
23
+ //#region src/components/btn/composables.ts
29
24
  const btnVariantToVuetifyVariant = {
30
25
  primary: "elevated",
31
26
  secondary: "flat",
32
27
  ghost: "outlined"
33
28
  };
34
- /**
35
- * Resolves a {@link BtnVariant} to its Vuetify `VBtn` `variant` value,
36
- * defaulting to `primary`'s mapping when `variant` is `undefined` or not a
37
- * key of {@link btnVariantToVuetifyVariant} (e.g. a value that bypassed
38
- * {@link BtnVariant}'s type check at the call site).
39
- */
40
- function resolveBtnVariant(variant) {
41
- return btnVariantToVuetifyVariant[variant] ?? btnVariantToVuetifyVariant.primary;
42
- }
43
- /**
44
- * Maps {@link BtnColor} to the underlying Vuetify `VBtn` `color` value.
45
- * Vuetify types `color` as a bare `string` (it accepts any theme color or
46
- * CSS color), so this only guarantees every {@link BtnColor} has a mapped
47
- * value, not that the value is itself a valid Vuetify theme color.
48
- */
49
29
  const btnColorToVuetifyColor = {
50
30
  primary: "primary",
51
31
  secondary: "secondary",
@@ -54,14 +34,17 @@ const btnColorToVuetifyColor = {
54
34
  caution: "warning",
55
35
  danger: "error"
56
36
  };
57
- /**
58
- * Resolves a {@link BtnColor} to its Vuetify `VBtn` `color` value,
59
- * defaulting to `primary`'s mapping when `color` is `undefined` or not a key
60
- * of {@link btnColorToVuetifyColor} (e.g. a value that bypassed
61
- * {@link BtnColor}'s type check at the call site).
62
- */
63
- function resolveBtnColor(color) {
64
- return btnColorToVuetifyColor[color] ?? btnColorToVuetifyColor.primary;
37
+ function useBtnVariant(variant) {
38
+ return computed(() => {
39
+ const variantValue = toValue(variant);
40
+ return variantValue ? btnVariantToVuetifyVariant[variantValue] : btnVariantToVuetifyVariant.primary;
41
+ });
42
+ }
43
+ function useBtnColor(color) {
44
+ return computed(() => {
45
+ const colorValue = toValue(color);
46
+ return colorValue ? btnColorToVuetifyColor[colorValue] : btnColorToVuetifyColor.primary;
47
+ });
65
48
  }
66
49
  //#endregion
67
50
  //#region src/components/btn/btn.vue
@@ -94,15 +77,15 @@ var btn_default = /* @__PURE__ */ defineComponent({
94
77
  setup(__props, { emit: __emit }) {
95
78
  const props = __props;
96
79
  const emit = __emit;
97
- const vuetifyVariant = computed(() => resolveBtnVariant(props.variant));
98
- const vuetifyColor = computed(() => resolveBtnColor(props.color));
80
+ const vuetifyVariant = useBtnVariant(() => props.variant);
81
+ const vuetifyColor = useBtnColor(() => props.color);
99
82
  function onClick(event) {
100
83
  emit("click", event);
101
84
  }
102
85
  return (_ctx, _cache) => {
103
86
  return openBlock(), createBlock(unref(VBtn), {
104
- variant: vuetifyVariant.value,
105
- color: vuetifyColor.value,
87
+ variant: unref(vuetifyVariant),
88
+ color: unref(vuetifyColor),
106
89
  disabled: props.disabled,
107
90
  loading: props.loading,
108
91
  "data-testid": props.dataTestid,
@@ -121,4 +104,121 @@ var btn_default = /* @__PURE__ */ defineComponent({
121
104
  }
122
105
  });
123
106
  //#endregion
124
- export { btn_default as Btn, root_default as Root };
107
+ //#region src/components/text-field/composables.ts
108
+ const textFieldVariantToVuetifyVariant = {
109
+ primary: "underlined",
110
+ secondary: "outlined"
111
+ };
112
+ const textFieldTypeToVuetifyType = {
113
+ text: "text",
114
+ phone: "tel",
115
+ email: "email",
116
+ url: "url",
117
+ password: "password",
118
+ search: "text"
119
+ };
120
+ function useTextFieldVariant(variant) {
121
+ return computed(() => {
122
+ const variantValue = toValue(variant);
123
+ return variantValue ? textFieldVariantToVuetifyVariant[variantValue] : textFieldVariantToVuetifyVariant.primary;
124
+ });
125
+ }
126
+ function useTextFieldType(type) {
127
+ return computed(() => {
128
+ const typeValue = toValue(type);
129
+ return typeValue ? textFieldTypeToVuetifyType[typeValue] : textFieldTypeToVuetifyType.text;
130
+ });
131
+ }
132
+ //#endregion
133
+ //#region src/components/text-field/text-field.vue
134
+ var text_field_default = /* @__PURE__ */ defineComponent({
135
+ inheritAttrs: false,
136
+ __name: "text-field",
137
+ props: /*@__PURE__*/ mergeModels({
138
+ variant: {
139
+ type: String,
140
+ required: false
141
+ },
142
+ type: {
143
+ type: String,
144
+ required: false
145
+ },
146
+ disabled: {
147
+ type: Boolean,
148
+ required: false
149
+ },
150
+ loading: {
151
+ type: Boolean,
152
+ required: false
153
+ },
154
+ clearable: {
155
+ type: Boolean,
156
+ required: false,
157
+ default: () => void 0
158
+ },
159
+ readonly: {
160
+ type: Boolean,
161
+ required: false
162
+ },
163
+ label: {
164
+ type: String,
165
+ required: false
166
+ },
167
+ placeholder: {
168
+ type: String,
169
+ required: false
170
+ },
171
+ hint: {
172
+ type: String,
173
+ required: false
174
+ },
175
+ dataTestid: {
176
+ type: String,
177
+ required: false
178
+ }
179
+ }, {
180
+ "modelValue": {
181
+ type: String,
182
+ default: ""
183
+ },
184
+ "modelModifiers": {}
185
+ }),
186
+ emits: ["update:modelValue"],
187
+ setup(__props) {
188
+ const modelValue = useModel(__props, "modelValue");
189
+ const props = createPropsRestProxy(__props, ["clearable"]);
190
+ const vuetifyVariant = useTextFieldVariant(() => props.variant);
191
+ const vuetifyType = useTextFieldType(() => props.type);
192
+ const computedClearable = computed(() => __props.clearable ?? props.type === "search");
193
+ return (_ctx, _cache) => {
194
+ return openBlock(), createBlock(unref(VTextField), {
195
+ modelValue: modelValue.value,
196
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
197
+ variant: unref(vuetifyVariant),
198
+ type: unref(vuetifyType),
199
+ "data-testid": props.dataTestid,
200
+ disabled: props.disabled,
201
+ loading: props.loading,
202
+ readonly: props.readonly,
203
+ label: props.label,
204
+ placeholder: props.placeholder,
205
+ hint: props.hint,
206
+ clearable: computedClearable.value
207
+ }, null, 8, [
208
+ "modelValue",
209
+ "variant",
210
+ "type",
211
+ "data-testid",
212
+ "disabled",
213
+ "loading",
214
+ "readonly",
215
+ "label",
216
+ "placeholder",
217
+ "hint",
218
+ "clearable"
219
+ ]);
220
+ };
221
+ }
222
+ });
223
+ //#endregion
224
+ export { btn_default as Btn, root_default as Root, text_field_default as TextField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "1.1.0-beta.1",
3
+ "version": "1.1.0-beta.2",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",
@@ -40,7 +40,7 @@
40
40
  "test": "vp test",
41
41
  "test:mutations": "stryker run",
42
42
  "test:e2e": "vpx playwright test",
43
- "check": "vp check",
43
+ "check": "vp check && vpx vue-tsc",
44
44
  "prepublishOnly": "vpr build",
45
45
  "prepare": "vp config",
46
46
  "depcruise": "depcruise src --output-type err-long",
@@ -69,10 +69,12 @@
69
69
  "oxc-minify": "^0.143.0",
70
70
  "postcss": "^8.5.25",
71
71
  "resize-observer-polyfill": "^1.5.1",
72
+ "sass-embedded": "^1.103.1",
73
+ "stryker-vue-ignorer": "github:davidlandais/stryker-vue-ignorer",
72
74
  "type-fest": "^5.8.0",
73
75
  "typescript": "^6.0.3",
74
76
  "vite-plugin-vuetify": "^2.1.3",
75
- "vite-plus": "^0.2.7",
77
+ "vite-plus": "^0.2.9",
76
78
  "vitepress": "2.0.0-alpha.19",
77
79
  "vitepress-plugin-group-icons": "^1.7.6",
78
80
  "vue": "^3.5.40",