@espri/vue-components 2.0.4 → 2.2.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/README.md CHANGED
@@ -24,7 +24,9 @@ import EspriInputNumber from '@espri/vue-components/input-number';
24
24
 
25
25
  ### Inputs
26
26
 
27
+ - `EspriCheckbox`
27
28
  - `EspriInputNumber`
29
+ - `EspriInputPassword`
28
30
  - `EspriInputText`
29
31
  - `EspriSelect`
30
32
 
@@ -0,0 +1 @@
1
+ .error[data-v-5b1924d3]{color:var(--p-floatlabel-invalid-color, var(--p-red-600))}
@@ -0,0 +1,57 @@
1
+ import { defineComponent as _, computed as i, openBlock as a, createElementBlock as u, normalizeClass as b, createBlock as k, unref as o, createCommentVNode as d, createElementVNode as c, createVNode as h, toDisplayString as m } from "vue";
2
+ import { Skeleton as g, Checkbox as x } from "primevue";
3
+ import { _ as y } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
4
+ import './checkbox.css';const B = { class: "flex items-center gap-2" }, C = ["for"], E = { class: "error" }, $ = /* @__PURE__ */ _({
5
+ __name: "checkbox",
6
+ props: {
7
+ label: {},
8
+ modelValue: {},
9
+ trueValue: {},
10
+ falseValue: {},
11
+ class: {},
12
+ disabled: { type: Boolean },
13
+ required: { type: Boolean },
14
+ loading: { type: Boolean },
15
+ showError: { type: Boolean },
16
+ size: {},
17
+ rules: {}
18
+ },
19
+ emits: ["update:modelValue"],
20
+ setup(p, { emit: f }) {
21
+ const e = p, v = f, s = Math.random().toString(16).slice(2), r = i({
22
+ get() {
23
+ return e.modelValue;
24
+ },
25
+ set(t) {
26
+ v("update:modelValue", t);
27
+ }
28
+ }), n = i(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
29
+ return (t, l) => (a(), u("div", {
30
+ class: b(`field ${e.class || ""}`)
31
+ }, [
32
+ e.loading ? (a(), k(o(g), {
33
+ key: 0,
34
+ class: "skeleton-input mt-3"
35
+ })) : d("", !0),
36
+ c("div", B, [
37
+ h(o(x), {
38
+ modelValue: r.value,
39
+ "onUpdate:modelValue": l[0] || (l[0] = (V) => r.value = V),
40
+ "input-id": o(s),
41
+ invalid: !!n.value,
42
+ "false-value": e.falseValue,
43
+ "true-value": e.trueValue,
44
+ binary: ""
45
+ }, null, 8, ["modelValue", "input-id", "invalid", "false-value", "true-value"]),
46
+ e.label ? (a(), u("label", {
47
+ key: 0,
48
+ for: o(s)
49
+ }, m(e.label), 9, C)) : d("", !0)
50
+ ]),
51
+ c("small", E, m(n.value), 1)
52
+ ], 2));
53
+ }
54
+ }), N = /* @__PURE__ */ y($, [["__scopeId", "data-v-5b1924d3"]]), R = N;
55
+ export {
56
+ R as default
57
+ };
package/dist/index.es.js CHANGED
@@ -1,10 +1,14 @@
1
- import { default as t } from "./input-number.es.js";
2
- import { default as p } from "./input-text.es.js";
3
- import { default as f } from "./select.es.js";
4
- import { default as u } from "./virtual-keyboard.es.js";
1
+ import { default as t } from "./checkbox.es.js";
2
+ import { default as o } from "./input-number.es.js";
3
+ import { default as s } from "./input-password.es.js";
4
+ import { default as u } from "./input-text.es.js";
5
+ import { default as l } from "./select.es.js";
6
+ import { default as i } from "./virtual-keyboard.es.js";
5
7
  export {
6
- t as EspriInputNumber,
7
- p as EspriInputText,
8
- f as EspriSelect,
9
- u as EspriVirtualKeyboard
8
+ t as EspriCheckbox,
9
+ o as EspriInputNumber,
10
+ s as EspriInputPassword,
11
+ u as EspriInputText,
12
+ l as EspriSelect,
13
+ i as EspriVirtualKeyboard
10
14
  };
@@ -0,0 +1 @@
1
+ .error[data-v-e3a9900a]{color:var(--p-floatlabel-invalid-color, var(--p-red-600))}
@@ -0,0 +1,68 @@
1
+ import { defineComponent as k, computed as r, openBlock as o, createElementBlock as i, normalizeClass as p, createBlock as c, unref as a, withCtx as y, createVNode as w, createElementVNode as u, createTextVNode as V, toDisplayString as m, createCommentVNode as v } from "vue";
2
+ import { Skeleton as B, FloatLabel as b, Password as x } from "primevue";
3
+ import { _ as C } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
4
+ import './input-password.css';const P = ["for"], E = { key: 0 }, N = { class: "error" }, $ = /* @__PURE__ */ k({
5
+ __name: "input-password",
6
+ props: {
7
+ label: {},
8
+ modelValue: {},
9
+ class: {},
10
+ inputClass: {},
11
+ disabled: { type: Boolean },
12
+ required: { type: Boolean },
13
+ loading: { type: Boolean },
14
+ showError: { type: Boolean },
15
+ rules: {},
16
+ maxlength: {},
17
+ placeholder: {},
18
+ displayPasswordFeedBack: { type: Boolean },
19
+ displayPasswordToggle: { type: Boolean }
20
+ },
21
+ emits: ["update:modelValue"],
22
+ setup(g, { emit: f }) {
23
+ const e = g, _ = f, t = Math.random().toString(16).slice(2), d = r({
24
+ get() {
25
+ return e.modelValue;
26
+ },
27
+ set(s) {
28
+ _("update:modelValue", s);
29
+ }
30
+ }), n = r(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
31
+ return (s, l) => (o(), i("div", {
32
+ class: p(`field ${e.class || ""}`)
33
+ }, [
34
+ e.loading ? (o(), c(a(B), {
35
+ key: 0,
36
+ class: "skeleton-input mt-3"
37
+ })) : (o(), c(a(b), {
38
+ key: 1,
39
+ class: "mt-3"
40
+ }, {
41
+ default: y(() => [
42
+ w(a(x), {
43
+ modelValue: d.value,
44
+ "onUpdate:modelValue": l[0] || (l[0] = (h) => d.value = h),
45
+ class: p(["w-full", e.class]),
46
+ "input-class": e.inputClass,
47
+ invalid: !!n.value,
48
+ maxlength: e.maxlength,
49
+ feedback: e.displayPasswordFeedBack,
50
+ "toggle-mask": e.displayPasswordToggle,
51
+ disabled: e.disabled,
52
+ placeholder: e.placeholder,
53
+ "input-id": a(t)
54
+ }, null, 8, ["modelValue", "class", "input-class", "invalid", "maxlength", "feedback", "toggle-mask", "disabled", "placeholder", "input-id"]),
55
+ u("label", { for: a(t) }, [
56
+ V(m(e.label), 1),
57
+ e.required ? (o(), i("span", E, " *")) : v("", !0)
58
+ ], 8, P)
59
+ ]),
60
+ _: 1
61
+ })),
62
+ u("small", N, m(n.value), 1)
63
+ ], 2));
64
+ }
65
+ }), F = /* @__PURE__ */ C($, [["__scopeId", "data-v-e3a9900a"]]), q = F;
66
+ export {
67
+ q as default
68
+ };
@@ -0,0 +1,19 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type { EspriCheckboxEmitsForDoc } from './interfaces/checkbox-emits.interface';
3
+ import type EspriCheckboxEmits from './interfaces/checkbox-emits.interface';
4
+ import type EspriCheckboxProps from './interfaces/checkbox-props.interface';
5
+ /**
6
+ * **ESPRI Digital - Input Text (Vue component)**
7
+ * --- ---
8
+ * ![ESPRIDigital](https://espridigital.fr/wp-content/uploads/2024/09/logo_espri_digital_white-100-1.png)
9
+ *
10
+ */
11
+ declare const EspriCheckbox: DefineComponent<EspriCheckboxProps, {}, // For slots if any
12
+ {}, // For methods or data if any
13
+ {}, // Computed
14
+ {}, // Methods
15
+ {}, // Mixin
16
+ {}, // Extends
17
+ EspriCheckboxEmitsForDoc>;
18
+ export default EspriCheckbox;
19
+ export type { EspriCheckboxEmits, EspriCheckboxProps };
@@ -0,0 +1,10 @@
1
+ import type { ObjectEmitsOptions } from 'vue';
2
+ export default interface EspriCheckboxEmits {
3
+ (e: 'update:modelValue', value: boolean): void;
4
+ }
5
+ export interface EspriCheckboxEmitsForDoc extends ObjectEmitsOptions {
6
+ /**
7
+ * Called when modelValue is updated.
8
+ */
9
+ 'update:modelValue': (value: boolean) => void;
10
+ }
@@ -0,0 +1,62 @@
1
+ export interface EspriSelectOption {
2
+ /**
3
+ * Display text for the option
4
+ */
5
+ label: string;
6
+ /**
7
+ * Value associated with the option
8
+ */
9
+ value: any;
10
+ }
11
+ export default interface EspriCheckboxProps {
12
+ /**
13
+ * Label displayed next to the checkbox.
14
+ */
15
+ label: string;
16
+ /**
17
+ * Model value representing the current state of the input.
18
+ */
19
+ modelValue: any;
20
+ /**
21
+ * Model value representing the current state of the input.
22
+ */
23
+ trueValue: any;
24
+ /**
25
+ * Model value representing the current state of the input.
26
+ */
27
+ falseValue: any;
28
+ /**
29
+ * Class of the component.
30
+ */
31
+ class?: any;
32
+ /**
33
+ * Disables the checkbox when true.
34
+ */
35
+ disabled?: boolean;
36
+ /**
37
+ * Marks the checkbox as required when true.
38
+ */
39
+ required?: boolean;
40
+ /**
41
+ * Indicates if the checkbox is in a loading state.
42
+ */
43
+ loading?: boolean;
44
+ /**
45
+ * Shows error messages when true.
46
+ */
47
+ showError?: boolean;
48
+ /**
49
+ * Defines the size of the component.
50
+ */
51
+ size?: 'small' | 'large';
52
+ /**
53
+ * Validation rules for the input.
54
+ * Each rule can be undefined or an object containing:
55
+ * - $invalid: whether the rule is violated
56
+ * - $message: the error message associated with the rule
57
+ */
58
+ rules?: Array<{
59
+ $invalid: boolean;
60
+ $message: string;
61
+ } | undefined>;
62
+ }
@@ -1,5 +1,7 @@
1
+ import EspriCheckbox from './checkbox';
1
2
  import EspriInputNumber from './input-number';
3
+ import EspriInputPassword from './input-password';
2
4
  import EspriInputText from './input-text';
3
5
  import EspriSelect from './select';
4
6
  import EspriVirtualKeyboard from './virtual-keyboard';
5
- export { EspriInputNumber, EspriInputText, EspriSelect, EspriVirtualKeyboard, };
7
+ export { EspriCheckbox, EspriInputNumber, EspriInputPassword, EspriInputText, EspriSelect, EspriVirtualKeyboard, };
@@ -0,0 +1,19 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type EspriInputPasswordEmits from './interfaces/input-password-emits.interface';
3
+ import type { EspriInputPasswordEmitsForDoc } from './interfaces/input-password-emits.interface';
4
+ import type EspriInputPasswordProps from './interfaces/input-password-props.interface';
5
+ /**
6
+ * **ESPRI Digital - Input Password (Vue component)**
7
+ * --- ---
8
+ * ![ESPRIDigital](https://espridigital.fr/wp-content/uploads/2024/09/logo_espri_digital_white-100-1.png)
9
+ *
10
+ */
11
+ declare const EspriInputPassword: DefineComponent<EspriInputPasswordProps, {}, // For slots if any
12
+ {}, // For methods or data if any
13
+ {}, // Computed
14
+ {}, // Methods
15
+ {}, // Mixin
16
+ {}, // Extends
17
+ EspriInputPasswordEmitsForDoc>;
18
+ export default EspriInputPassword;
19
+ export type { EspriInputPasswordEmits, EspriInputPasswordProps };
@@ -0,0 +1,10 @@
1
+ import type { ObjectEmitsOptions } from 'vue';
2
+ export default interface EspriInputPasswordEmits {
3
+ (e: 'update:modelValue', value: any): void;
4
+ }
5
+ export interface EspriInputPasswordEmitsForDoc extends ObjectEmitsOptions {
6
+ /**
7
+ * Called when modelValue is updated.
8
+ */
9
+ 'update:modelValue': (value: any) => void;
10
+ }
@@ -0,0 +1,60 @@
1
+ export default interface EspriInputPasswordProps {
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: string | null;
10
+ /**
11
+ * Class of the component.
12
+ */
13
+ class?: any;
14
+ /**
15
+ * Optional CSS class applied to the input element.
16
+ */
17
+ inputClass?: 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
+ /**
53
+ * Whether to display feedback for the password field (e.g., strength meter).
54
+ */
55
+ displayPasswordFeedBack?: boolean;
56
+ /**
57
+ * Whether to display a toggle for showing/hiding the password.
58
+ */
59
+ displayPasswordToggle?: boolean;
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@espri/vue-components",
3
- "version": "2.0.4",
3
+ "version": "2.2.0",
4
4
  "description": "ESPRI Digital - Vue components library",
5
5
  "author": "ESPRI Digital",
6
6
  "homepage": "https://github.com/ESPRI-Digital/vue-select#readme",
@@ -12,10 +12,18 @@
12
12
  "types": "./dist/types/index.d.ts",
13
13
  "import": "./dist/index.es.js"
14
14
  },
15
+ "./checkbox": {
16
+ "types": "./dist/types/checkbox/index.d.ts",
17
+ "import": "./dist/checkbox.es.js"
18
+ },
15
19
  "./input-number": {
16
20
  "types": "./dist/types/input-number/index.d.ts",
17
21
  "import": "./dist/input-number.es.js"
18
22
  },
23
+ "./input-password": {
24
+ "types": "./dist/types/input-password/index.d.ts",
25
+ "import": "./dist/input-password.es.js"
26
+ },
19
27
  "./input-text": {
20
28
  "types": "./dist/types/input-text/index.d.ts",
21
29
  "import": "./dist/input-text.es.js"