@espri/vue-components 2.1.0 → 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,6 +24,7 @@ import EspriInputNumber from '@espri/vue-components/input-number';
24
24
 
25
25
  ### Inputs
26
26
 
27
+ - `EspriCheckbox`
27
28
  - `EspriInputNumber`
28
29
  - `EspriInputPassword`
29
30
  - `EspriInputText`
@@ -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,12 +1,14 @@
1
- import { default as e } from "./input-number.es.js";
2
- import { default as p } from "./input-password.es.js";
3
- import { default as s } from "./input-text.es.js";
4
- import { default as u } from "./select.es.js";
5
- import { default as l } 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";
6
7
  export {
7
- e as EspriInputNumber,
8
- p as EspriInputPassword,
9
- s as EspriInputText,
10
- u as EspriSelect,
11
- l 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
12
14
  };
@@ -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,6 +1,7 @@
1
+ import EspriCheckbox from './checkbox';
1
2
  import EspriInputNumber from './input-number';
2
3
  import EspriInputPassword from './input-password';
3
4
  import EspriInputText from './input-text';
4
5
  import EspriSelect from './select';
5
6
  import EspriVirtualKeyboard from './virtual-keyboard';
6
- export { EspriInputNumber, EspriInputPassword, EspriInputText, EspriSelect, EspriVirtualKeyboard, };
7
+ export { EspriCheckbox, EspriInputNumber, EspriInputPassword, EspriInputText, EspriSelect, EspriVirtualKeyboard, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@espri/vue-components",
3
- "version": "2.1.0",
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,6 +12,10 @@
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"