@espri/vue-components 0.0.1

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/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @espri/vue-components
2
+
3
+ Une bibliothèque de composants Vue 3 réutilisables développés par **ESPRI Digital**.
4
+
5
+ Cette bibliothèque est conçue pour être **modulaire** : vous pouvez importer chaque composant individuellement ou installer tous les composants globalement.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @espri/vue-components
13
+ # ou
14
+ yarn add @espri/vue-components
15
+
16
+ vue-components/
17
+ ├─ package.json
18
+ ├─ vite.config.js
19
+ ├─ src/
20
+ │ ├─ select/
21
+ │ │ ├─ Select.vue
22
+ │ │ └─ index.js
23
+ │ ├─ inputtext/
24
+ │ │ ├─ InputText.vue
25
+ │ │ └─ index.js
26
+ │ └─ index.js <-- pour import global via app.use()
27
+ ├─ README.md
@@ -0,0 +1,6 @@
1
+ import { default as r } from "./inputtext.es.js";
2
+ import { default as a } from "./select.es.js";
3
+ export {
4
+ r as EspriInputText,
5
+ a as EspriSelect
6
+ };
@@ -0,0 +1,65 @@
1
+ import { defineComponent as V, computed as r, openBlock as a, createElementBlock as i, normalizeClass as u, createBlock as c, unref as t, withCtx as _, createVNode as v, createElementVNode as m, createTextVNode as b, toDisplayString as p, createCommentVNode as k } from "vue";
2
+ import { Skeleton as y, FloatLabel as B, InputText as E } from "primevue";
3
+ const w = ["for"], C = {
4
+ key: 0,
5
+ class: "text-danger"
6
+ }, I = { class: "text-danger" }, N = /* @__PURE__ */ V({
7
+ __name: "input-text",
8
+ props: {
9
+ label: {},
10
+ modelValue: {},
11
+ class: {},
12
+ classInput: {},
13
+ disabled: { type: Boolean },
14
+ required: { type: Boolean },
15
+ loading: { type: Boolean },
16
+ showError: { type: Boolean },
17
+ rules: {},
18
+ maxlength: {},
19
+ placeholder: {}
20
+ },
21
+ emits: ["update:modelValue"],
22
+ setup(h, { emit: f }) {
23
+ const e = h, g = f, s = Math.random().toString(16).slice(2), n = r({
24
+ get() {
25
+ return e.modelValue;
26
+ },
27
+ set(o) {
28
+ g("update:modelValue", o);
29
+ }
30
+ }), d = r(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
31
+ return (o, l) => (a(), i("div", {
32
+ class: u(`field ${e.class || ""}`)
33
+ }, [
34
+ e.loading ? (a(), c(t(y), {
35
+ key: 0,
36
+ class: "skeleton-input mt-3"
37
+ })) : (a(), c(t(B), {
38
+ key: 1,
39
+ class: "mt-3"
40
+ }, {
41
+ default: _(() => [
42
+ v(t(E), {
43
+ modelValue: n.value,
44
+ "onUpdate:modelValue": l[0] || (l[0] = (x) => n.value = x),
45
+ class: u(["w-full", e.classInput]),
46
+ invalid: !!d.value,
47
+ maxlength: e.maxlength,
48
+ disabled: e.disabled,
49
+ placeholder: e.placeholder,
50
+ "input-id": t(s)
51
+ }, null, 8, ["modelValue", "class", "invalid", "maxlength", "disabled", "placeholder", "input-id"]),
52
+ m("label", { for: t(s) }, [
53
+ b(p(e.label), 1),
54
+ e.required ? (a(), i("span", C, " *")) : k("", !0)
55
+ ], 8, w)
56
+ ]),
57
+ _: 1
58
+ })),
59
+ m("small", I, p(d.value), 1)
60
+ ], 2));
61
+ }
62
+ }), T = N;
63
+ export {
64
+ T as default
65
+ };
@@ -0,0 +1,69 @@
1
+ import { defineComponent as _, computed as r, openBlock as o, createElementBlock as i, normalizeClass as c, createBlock as u, unref as t, withCtx as b, createVNode as g, createElementVNode as p, createTextVNode as y, toDisplayString as m, createCommentVNode as k } from "vue";
2
+ import { Skeleton as x, FloatLabel as B, Select as E } from "primevue";
3
+ const S = ["for"], w = {
4
+ key: 0,
5
+ class: "text-danger"
6
+ }, C = { class: "text-danger" }, N = /* @__PURE__ */ _({
7
+ __name: "select",
8
+ props: {
9
+ label: {},
10
+ options: {},
11
+ classInput: {},
12
+ disabled: { type: Boolean },
13
+ required: { type: Boolean },
14
+ showError: { type: Boolean },
15
+ rules: {},
16
+ maxlength: {},
17
+ placeholder: {},
18
+ style: {},
19
+ class: {},
20
+ loading: { type: Boolean },
21
+ modelValue: {}
22
+ },
23
+ emits: ["update:modelValue"],
24
+ setup(f, { emit: v }) {
25
+ const e = f, V = v, s = Math.random().toString(16).slice(2), n = r({
26
+ get() {
27
+ return e.modelValue;
28
+ },
29
+ set(a) {
30
+ V("update:modelValue", a);
31
+ }
32
+ }), d = r(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
33
+ return (a, l) => (o(), i("div", {
34
+ class: c(`field ${e.class || ""}`)
35
+ }, [
36
+ e.loading ? (o(), u(t(x), {
37
+ key: 0,
38
+ class: "skeleton-input mt-3"
39
+ })) : (o(), u(t(B), {
40
+ key: 1,
41
+ class: "mt-3"
42
+ }, {
43
+ default: b(() => [
44
+ g(t(E), {
45
+ modelValue: n.value,
46
+ "onUpdate:modelValue": l[0] || (l[0] = (h) => n.value = h),
47
+ options: e.options,
48
+ "option-label": "label",
49
+ "option-value": "value",
50
+ class: c(["w-full", e.classInput]),
51
+ invalid: !!d.value,
52
+ disabled: e.disabled,
53
+ placeholder: e.placeholder,
54
+ "input-id": t(s)
55
+ }, null, 8, ["modelValue", "options", "class", "invalid", "disabled", "placeholder", "input-id"]),
56
+ p("label", { for: t(s) }, [
57
+ y(m(e.label), 1),
58
+ e.required ? (o(), i("span", w, " *")) : k("", !0)
59
+ ], 8, S)
60
+ ]),
61
+ _: 1
62
+ })),
63
+ p("small", C, m(d.value), 1)
64
+ ], 2));
65
+ }
66
+ }), I = N;
67
+ export {
68
+ I as default
69
+ };
@@ -0,0 +1,3 @@
1
+ import EspriInputText from './input-text';
2
+ import EspriSelect from './select';
3
+ export { EspriInputText, EspriSelect, };
@@ -0,0 +1,17 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type { InputTextEmitsForDoc } from './interfaces/input-text-emits.interface';
3
+ import type InputTextProps from './interfaces/input-text-props.interface';
4
+ /**
5
+ * **ESPRI Digital - Input Text (Vue component)**
6
+ * --- ---
7
+ * ![ESPRIDigital](https://espridigital.fr/wp-content/uploads/2024/09/logo_espri_digital_white-100-1.png)
8
+ *
9
+ */
10
+ declare const EspriInputText: DefineComponent<InputTextProps, {}, // For slots if any
11
+ {}, // For methods or data if any
12
+ {}, // Computed
13
+ {}, // Methods
14
+ {}, // Mixin
15
+ {}, // Extends
16
+ InputTextEmitsForDoc>;
17
+ export default EspriInputText;
@@ -0,0 +1,10 @@
1
+ import type { ObjectEmitsOptions } from 'vue';
2
+ export default interface InputTextEmits {
3
+ (e: 'update:modelValue', value: any): void;
4
+ }
5
+ export interface InputTextEmitsForDoc extends ObjectEmitsOptions {
6
+ /**
7
+ * Called when modelValue is updated.
8
+ */
9
+ 'update:modelValue': (value: any) => void;
10
+ }
@@ -0,0 +1,52 @@
1
+ export default interface InputTextProps {
2
+ /**
3
+ * Label displayed above the input.
4
+ */
5
+ label: string;
6
+ /**
7
+ * Model value representing the current state of the input.
8
+ */
9
+ modelValue: any;
10
+ /**
11
+ * Class of the component.
12
+ */
13
+ class?: any;
14
+ /**
15
+ * Optional CSS class applied to the input element.
16
+ */
17
+ classInput?: string;
18
+ /**
19
+ * Disables the input when true.
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * Marks the input as required when true.
24
+ */
25
+ required?: boolean;
26
+ /**
27
+ * Indicates if the input is in a loading state.
28
+ */
29
+ loading: boolean;
30
+ /**
31
+ * Shows error messages when true.
32
+ */
33
+ showError?: boolean;
34
+ /**
35
+ * Validation rules for the input.
36
+ * Each rule can be undefined or an object containing:
37
+ * - $invalid: whether the rule is violated
38
+ * - $message: the error message associated with the rule
39
+ */
40
+ rules?: Array<{
41
+ $invalid: boolean;
42
+ $message: string;
43
+ } | undefined>;
44
+ /**
45
+ * Maximum number of characters allowed in the input.
46
+ */
47
+ maxlength?: number;
48
+ /**
49
+ * Placeholder text displayed inside the input.
50
+ */
51
+ placeholder?: string;
52
+ }
@@ -0,0 +1,17 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type { SelectEmitsForDoc } from './interfaces/select-emits.interface';
3
+ import type SelectProps from './interfaces/select-props.interface';
4
+ /**
5
+ * **ESPRI Digital - Select (Vue component)**
6
+ * --- ---
7
+ * ![ESPRIDigital](https://espridigital.fr/wp-content/uploads/2024/09/logo_espri_digital_white-100-1.png)
8
+ *
9
+ */
10
+ declare const EspriSelect: DefineComponent<SelectProps, {}, // For slots if any
11
+ {}, // For methods or data if any
12
+ {}, // Computed
13
+ {}, // Methods
14
+ {}, // Mixin
15
+ {}, // Extends
16
+ SelectEmitsForDoc>;
17
+ export default EspriSelect;
@@ -0,0 +1,10 @@
1
+ import type { ObjectEmitsOptions } from 'vue';
2
+ export default interface SelectEmits {
3
+ (e: 'update:modelValue', value: any): void;
4
+ }
5
+ export interface SelectEmitsForDoc extends ObjectEmitsOptions {
6
+ /**
7
+ * Called when modelValue is updated.
8
+ */
9
+ 'update:modelValue': (value: any) => void;
10
+ }
@@ -0,0 +1,65 @@
1
+ export default interface SelectProps {
2
+ /**
3
+ * Label displayed above the input.
4
+ */
5
+ label: string;
6
+ /**
7
+ * Array of options available for selection.
8
+ */
9
+ options: Array<{
10
+ /** Display text for the option */
11
+ label: string;
12
+ /** Value associated with the option */
13
+ value: any;
14
+ }>;
15
+ /**
16
+ * Optional CSS class applied to the input element.
17
+ */
18
+ classInput?: string;
19
+ /**
20
+ * Disables the input when true.
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * Marks the input as required when true.
25
+ */
26
+ required?: boolean;
27
+ /**
28
+ * Shows error messages when true.
29
+ */
30
+ showError?: boolean;
31
+ /**
32
+ * Validation rules for the input.
33
+ * Each rule can be undefined or an object containing:
34
+ * - $invalid: whether the rule is violated
35
+ * - $message: the error message associated with the rule
36
+ */
37
+ rules?: Array<{
38
+ $invalid: boolean;
39
+ $message: string;
40
+ } | undefined>;
41
+ /**
42
+ * Maximum number of characters allowed in the input.
43
+ */
44
+ maxlength?: number;
45
+ /**
46
+ * Placeholder text displayed inside the input.
47
+ */
48
+ placeholder?: string;
49
+ /**
50
+ * CSS style of the component.
51
+ */
52
+ style?: any;
53
+ /**
54
+ * Class of the component.
55
+ */
56
+ class?: any;
57
+ /**
58
+ * Indicates if the input is in a loading state.
59
+ */
60
+ loading: boolean;
61
+ /**
62
+ * Model value representing the current state of the input.
63
+ */
64
+ modelValue: any;
65
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@espri/vue-components",
3
+ "version": "0.0.1",
4
+ "description": "ESPRI Digital - Vue components library",
5
+ "author": "ESPRI Digital",
6
+ "homepage": "https://github.com/ESPRI-Digital/vue-select#readme",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "exports": {
11
+ ".": "./dist/index.es.js",
12
+ "./select": "./dist/select.es.js",
13
+ "./inputtext": "./dist/inputtext.es.js"
14
+ },
15
+ "main": "dist/index.es.js",
16
+ "module": "dist/index.es.js",
17
+ "types": "dist/types/index.d.ts",
18
+ "files": ["dist"],
19
+ "scripts": {
20
+ "build": "vite build && tsc --emitDeclarationOnly",
21
+ "lint": "eslint .",
22
+ "ts-check": "vue-tsc --noEmit"
23
+ },
24
+ "peerDependencies": {
25
+ "primevue": ">=4.0.0 <5.0.0",
26
+ "vue": ">=3.0.0 <4.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@vitejs/plugin-vue": "^6.0.2",
30
+ "eslint": "^9.39.1",
31
+ "eslint-config-espri-front": "^3.0.0",
32
+ "typescript": "^5.9.3",
33
+ "vite": "^7.2.6",
34
+ "vue-tsc": "^3.1.5"
35
+ }
36
+ }