@espri/vue-components 2.2.1 → 2.4.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 CHANGED
@@ -33,3 +33,12 @@ import EspriInputNumber from '@espri/vue-components/input-number';
33
33
  ### Others
34
34
 
35
35
  - `EspriVirtualKeyboard`
36
+
37
+ ### Demo
38
+
39
+ You can use the playground demo to test your espri components. To get started:
40
+
41
+ 1. Navigate to the `demo` folder
42
+ 2. Run `docker-compose up -d` to start the development environment
43
+ 3. Visit http://localhost:5173 in your browser
44
+ 4. Edit `App.vue` to add and test your components
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .error[data-v-702f97d9],.error[data-v-6cb5331a]{color:var(--p-floatlabel-invalid-color, var(--p-red-600))}
package/dist/index.es.js CHANGED
@@ -1,14 +1,156 @@
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";
1
+ import { default as A } from "./checkbox.es.js";
2
+ import { defineComponent as _, computed as c, openBlock as a, createElementBlock as m, normalizeClass as p, createBlock as u, unref as t, withCtx as v, createVNode as V, createElementVNode as f, createTextVNode as g, toDisplayString as h, createCommentVNode as x } from "vue";
3
+ import { Skeleton as k, FloatLabel as E, DatePicker as w, MultiSelect as C } from "primevue";
4
+ import { _ as B } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
5
+ import { default as H } from "./input-number.es.js";
6
+ import { default as Q } from "./input-password.es.js";
7
+ import { default as X } from "./input-text.es.js";
8
+ import { default as Z } from "./select.es.js";
9
+ import { default as le } from "./virtual-keyboard.es.js";
10
+ import './index.css';const $ = ["for"], M = { key: 0 }, S = { class: "error" }, L = /* @__PURE__ */ _({
11
+ __name: "date-picker",
12
+ props: {
13
+ label: {},
14
+ modelValue: {},
15
+ class: {},
16
+ disabled: { type: Boolean },
17
+ required: { type: Boolean },
18
+ loading: { type: Boolean },
19
+ showError: { type: Boolean },
20
+ rules: {},
21
+ dateFormat: {},
22
+ placeholder: {}
23
+ },
24
+ emits: ["update:modelValue"],
25
+ setup(b, { emit: y }) {
26
+ const e = b, r = y, i = Math.random().toString(16).slice(2), d = c({
27
+ get() {
28
+ return e.modelValue;
29
+ },
30
+ set(o) {
31
+ r("update:modelValue", o);
32
+ }
33
+ }), n = c(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
34
+ return (o, l) => (a(), m("div", {
35
+ class: p(`field ${e.class || ""}`)
36
+ }, [
37
+ e.loading ? (a(), u(t(k), {
38
+ key: 0,
39
+ class: "skeleton-input mt-3"
40
+ })) : (a(), u(t(E), {
41
+ key: 1,
42
+ class: "mt-3"
43
+ }, {
44
+ default: v(() => [
45
+ V(t(w), {
46
+ modelValue: d.value,
47
+ "onUpdate:modelValue": l[0] || (l[0] = (s) => d.value = s),
48
+ class: p(["w-full", e.class]),
49
+ invalid: !!n.value,
50
+ disabled: e.disabled,
51
+ placeholder: e.placeholder,
52
+ "input-id": t(i),
53
+ "date-format": e.dateFormat || "dd/mm/yy"
54
+ }, null, 8, ["modelValue", "class", "invalid", "disabled", "placeholder", "input-id", "date-format"]),
55
+ f("label", { for: t(i) }, [
56
+ g(h(e.label), 1),
57
+ e.required ? (a(), m("span", M, " *")) : x("", !0)
58
+ ], 8, $)
59
+ ]),
60
+ _: 1
61
+ })),
62
+ f("small", S, h(n.value), 1)
63
+ ], 2));
64
+ }
65
+ }), F = /* @__PURE__ */ B(L, [["__scopeId", "data-v-702f97d9"]]), U = F, I = ["for"], P = { key: 0 }, N = { class: "error" }, q = /* @__PURE__ */ _({
66
+ __name: "multi-select",
67
+ props: {
68
+ label: {},
69
+ options: {},
70
+ modelValue: {},
71
+ class: {},
72
+ disabled: { type: Boolean },
73
+ required: { type: Boolean },
74
+ showClear: { type: Boolean },
75
+ loading: { type: Boolean },
76
+ showError: { type: Boolean },
77
+ rules: {},
78
+ placeholder: {},
79
+ maxSelectedLabels: {},
80
+ selectionLimit: {},
81
+ emptyMessage: {},
82
+ selectedItemsLabel: {},
83
+ resetFilterOnClear: { type: Boolean },
84
+ filter: { type: Boolean },
85
+ filterPlaceholder: {},
86
+ filterLocale: {},
87
+ filterMatchMode: {},
88
+ filterFields: {}
89
+ },
90
+ emits: ["update:modelValue", "filter", "selectall-change"],
91
+ setup(b, { emit: y }) {
92
+ const e = b, r = y, i = Math.random().toString(16).slice(2), d = c({
93
+ get() {
94
+ return e.modelValue;
95
+ },
96
+ set(o) {
97
+ r("update:modelValue", o);
98
+ }
99
+ }), n = c(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
100
+ return (o, l) => (a(), m("div", {
101
+ class: p(`field ${e.class || ""}`)
102
+ }, [
103
+ e.loading ? (a(), u(t(k), {
104
+ key: 0,
105
+ class: "skeleton-input mt-3"
106
+ })) : (a(), u(t(E), {
107
+ key: 1,
108
+ class: "mt-3"
109
+ }, {
110
+ default: v(() => [
111
+ V(t(C), {
112
+ modelValue: d.value,
113
+ "onUpdate:modelValue": l[0] || (l[0] = (s) => d.value = s),
114
+ options: e.options,
115
+ "option-label": "label",
116
+ "option-value": "value",
117
+ class: p(["w-full", e.class]),
118
+ invalid: !!n.value,
119
+ disabled: e.disabled,
120
+ placeholder: e.placeholder,
121
+ "show-clear": e.showClear,
122
+ "max-selected-labels": e.maxSelectedLabels,
123
+ "empty-message": e.emptyMessage,
124
+ "selection-limit": e.selectionLimit,
125
+ "selected-items-label": e.selectedItemsLabel,
126
+ "reset-filter-on-clear": e.resetFilterOnClear,
127
+ filter: e.filter,
128
+ "filter-placeholder": e.filterPlaceholder,
129
+ "filter-locale": e.filterLocale,
130
+ "filter-match-mode": e.filterMatchMode,
131
+ "filter-fields": e.filterFields,
132
+ "input-id": t(i),
133
+ onFilter: l[1] || (l[1] = (s) => r("filter", s)),
134
+ onSelectallChange: l[2] || (l[2] = (s) => r("selectall-change", s))
135
+ }, null, 8, ["modelValue", "options", "class", "invalid", "disabled", "placeholder", "show-clear", "max-selected-labels", "empty-message", "selection-limit", "selected-items-label", "reset-filter-on-clear", "filter", "filter-placeholder", "filter-locale", "filter-match-mode", "filter-fields", "input-id"]),
136
+ f("label", { for: t(i) }, [
137
+ g(h(e.label), 1),
138
+ e.required ? (a(), m("span", P, " *")) : x("", !0)
139
+ ], 8, I)
140
+ ]),
141
+ _: 1
142
+ })),
143
+ f("small", N, h(n.value), 1)
144
+ ], 2));
145
+ }
146
+ }), D = /* @__PURE__ */ B(q, [["__scopeId", "data-v-6cb5331a"]]), z = D;
7
147
  export {
8
- t as EspriCheckbox,
9
- o as EspriInputNumber,
10
- s as EspriInputPassword,
11
- u as EspriInputText,
12
- l as EspriSelect,
13
- i as EspriVirtualKeyboard
148
+ A as EspriCheckbox,
149
+ U as EspriDatePicker,
150
+ H as EspriInputNumber,
151
+ Q as EspriInputPassword,
152
+ X as EspriInputText,
153
+ z as EspriMultiSelect,
154
+ Z as EspriSelect,
155
+ le as EspriVirtualKeyboard
14
156
  };
package/dist/select.css CHANGED
@@ -1 +1 @@
1
- .error[data-v-5a8f854e]{color:var(--p-floatlabel-invalid-color, var(--p-red-600))}
1
+ .error[data-v-55a0f12b]{color:var(--p-floatlabel-invalid-color, var(--p-red-600))}
package/dist/select.es.js CHANGED
@@ -1,13 +1,14 @@
1
- import { defineComponent as h, computed as i, openBlock as t, createElementBlock as d, normalizeClass as c, createBlock as p, unref as o, withCtx as b, createVNode as y, createElementVNode as u, createTextVNode as g, toDisplayString as m, createCommentVNode as k } from "vue";
2
- import { Skeleton as B, FloatLabel as x, Select as E } from "primevue";
3
- import { _ as S } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
4
- import './select.css';const C = ["for"], w = { key: 0 }, N = { class: "error" }, $ = /* @__PURE__ */ h({
1
+ import { defineComponent as V, computed as i, openBlock as t, createElementBlock as d, normalizeClass as c, createBlock as p, unref as o, withCtx as b, createVNode as y, createElementVNode as u, createTextVNode as g, toDisplayString as m, createCommentVNode as k } from "vue";
2
+ import { Skeleton as w, FloatLabel as B, Select as C } from "primevue";
3
+ import { _ as x } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
4
+ import './select.css';const E = ["for"], S = { key: 0 }, N = { class: "error" }, $ = /* @__PURE__ */ V({
5
5
  __name: "select",
6
6
  props: {
7
7
  label: {},
8
8
  options: {},
9
9
  disabled: { type: Boolean },
10
10
  required: { type: Boolean },
11
+ showClear: { type: Boolean },
11
12
  showError: { type: Boolean },
12
13
  rules: {},
13
14
  maxlength: {},
@@ -19,28 +20,28 @@ import './select.css';const C = ["for"], w = { key: 0 }, N = { class: "error" },
19
20
  },
20
21
  emits: ["update:modelValue"],
21
22
  setup(f, { emit: _ }) {
22
- const e = f, v = _, s = Math.random().toString(16).slice(2), n = i({
23
+ const e = f, h = _, s = Math.random().toString(16).slice(2), n = i({
23
24
  get() {
24
25
  return e.modelValue;
25
26
  },
26
27
  set(a) {
27
- v("update:modelValue", a);
28
+ h("update:modelValue", a);
28
29
  }
29
30
  }), r = i(() => e.showError && e.rules?.find((l) => l?.$invalid && l?.$message)?.$message || "");
30
31
  return (a, l) => (t(), d("div", {
31
32
  class: c(`field ${e.class || ""}`)
32
33
  }, [
33
- e.loading ? (t(), p(o(B), {
34
+ e.loading ? (t(), p(o(w), {
34
35
  key: 0,
35
36
  class: "skeleton-input mt-3"
36
- })) : (t(), p(o(x), {
37
+ })) : (t(), p(o(B), {
37
38
  key: 1,
38
39
  class: "mt-3"
39
40
  }, {
40
41
  default: b(() => [
41
- y(o(E), {
42
+ y(o(C), {
42
43
  modelValue: n.value,
43
- "onUpdate:modelValue": l[0] || (l[0] = (V) => n.value = V),
44
+ "onUpdate:modelValue": l[0] || (l[0] = (v) => n.value = v),
44
45
  options: e.options,
45
46
  "option-label": "label",
46
47
  "option-value": "value",
@@ -48,19 +49,20 @@ import './select.css';const C = ["for"], w = { key: 0 }, N = { class: "error" },
48
49
  invalid: !!r.value,
49
50
  disabled: e.disabled,
50
51
  placeholder: e.placeholder,
52
+ "show-clear": e.showClear,
51
53
  "input-id": o(s)
52
- }, null, 8, ["modelValue", "options", "class", "invalid", "disabled", "placeholder", "input-id"]),
54
+ }, null, 8, ["modelValue", "options", "class", "invalid", "disabled", "placeholder", "show-clear", "input-id"]),
53
55
  u("label", { for: o(s) }, [
54
56
  g(m(e.label), 1),
55
- e.required ? (t(), d("span", w, " *")) : k("", !0)
56
- ], 8, C)
57
+ e.required ? (t(), d("span", S, " *")) : k("", !0)
58
+ ], 8, E)
57
59
  ]),
58
60
  _: 1
59
61
  })),
60
62
  u("small", N, m(r.value), 1)
61
63
  ], 2));
62
64
  }
63
- }), q = /* @__PURE__ */ S($, [["__scopeId", "data-v-5a8f854e"]]), F = q;
65
+ }), q = /* @__PURE__ */ x($, [["__scopeId", "data-v-55a0f12b"]]), F = q;
64
66
  export {
65
67
  F as default
66
68
  };
@@ -0,0 +1,19 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type EspriDatePickerEmits from './interfaces/date-picker-emits.interface';
3
+ import type { EspriDatePickerEmitsForDoc } from './interfaces/date-picker-emits.interface';
4
+ import type EspriDatePickerProps from './interfaces/date-picker-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 EspriDatePicker: DefineComponent<EspriDatePickerProps, {}, // For slots if any
12
+ {}, // For methods or data if any
13
+ {}, // Computed
14
+ {}, // Methods
15
+ {}, // Mixin
16
+ {}, // Extends
17
+ EspriDatePickerEmitsForDoc>;
18
+ export default EspriDatePicker;
19
+ export type { EspriDatePickerEmits, EspriDatePickerProps };
@@ -0,0 +1,10 @@
1
+ import type { ObjectEmitsOptions } from 'vue';
2
+ export default interface EspriDatePickerEmits {
3
+ (e: 'update:modelValue', value: Date | null): void;
4
+ }
5
+ export interface EspriDatePickerEmitsForDoc extends ObjectEmitsOptions {
6
+ /**
7
+ * Called when modelValue is updated.
8
+ */
9
+ 'update:modelValue': (value: Date | null) => void;
10
+ }
@@ -0,0 +1,48 @@
1
+ export default interface EspriDatePickerProps {
2
+ /**
3
+ * Label displayed above the date picker.
4
+ */
5
+ label: string;
6
+ /**
7
+ * Model value representing the selected date.
8
+ */
9
+ modelValue: Date | null;
10
+ /**
11
+ * Class of the component.
12
+ */
13
+ class?: any;
14
+ /**
15
+ * Disables the date picker when true.
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * Marks the input as required when true.
20
+ */
21
+ required?: boolean;
22
+ /**
23
+ * Indicates if the component is in a loading state.
24
+ */
25
+ loading?: boolean;
26
+ /**
27
+ * Shows error messages when true.
28
+ */
29
+ showError?: boolean;
30
+ /**
31
+ * Validation rules for the date picker.
32
+ * Each rule can be undefined or an object containing:
33
+ * - $invalid: whether the rule is violated
34
+ * - $message: the error message associated with the rule
35
+ */
36
+ rules?: Array<{
37
+ $invalid: boolean;
38
+ $message: string;
39
+ } | undefined>;
40
+ /**
41
+ * Date format pattern.
42
+ */
43
+ dateFormat?: string;
44
+ /**
45
+ * Placeholder text for the date picker.
46
+ */
47
+ placeholder?: string;
48
+ }
@@ -1,7 +1,9 @@
1
1
  import EspriCheckbox from './checkbox';
2
+ import EspriDatePicker from './date-picker';
2
3
  import EspriInputNumber from './input-number';
3
4
  import EspriInputPassword from './input-password';
4
5
  import EspriInputText from './input-text';
6
+ import EspriMultiSelect from './multi-select';
5
7
  import EspriSelect from './select';
6
8
  import EspriVirtualKeyboard from './virtual-keyboard';
7
- export { EspriCheckbox, EspriInputNumber, EspriInputPassword, EspriInputText, EspriSelect, EspriVirtualKeyboard, };
9
+ export { EspriCheckbox, EspriDatePicker, EspriInputNumber, EspriInputPassword, EspriInputText, EspriMultiSelect, EspriSelect, EspriVirtualKeyboard, };
@@ -22,7 +22,7 @@ export default interface EspriInputTextProps {
22
22
  /**
23
23
  * Indicates if the input is in a loading state.
24
24
  */
25
- loading: boolean;
25
+ loading?: boolean;
26
26
  /**
27
27
  * Shows error messages when true.
28
28
  */
@@ -0,0 +1,19 @@
1
+ import type { DefineComponent } from 'vue';
2
+ import type EspriMultiSelectEmits from './interfaces/multi-select-emits.interface';
3
+ import type { EspriMultiSelectEmitsForDoc } from './interfaces/multi-select-emits.interface';
4
+ import type EspriMultiSelectProps from './interfaces/multi-select-props.interface';
5
+ /**
6
+ * **ESPRI Digital - Multi Select (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 EspriMultiSelect: DefineComponent<EspriMultiSelectProps, {}, // For slots if any
12
+ {}, // For methods or data if any
13
+ {}, // Computed
14
+ {}, // Methods
15
+ {}, // Mixin
16
+ {}, // Extends
17
+ EspriMultiSelectEmitsForDoc>;
18
+ export default EspriMultiSelect;
19
+ export type { EspriMultiSelectEmits, EspriMultiSelectProps };
@@ -0,0 +1,21 @@
1
+ import type { MultiSelectAllChangeEvent, MultiSelectFilterEvent } from 'primevue/multiselect';
2
+ import type { ObjectEmitsOptions } from 'vue';
3
+ export default interface EspriMultiSelectEmits {
4
+ (e: 'update:modelValue', value: any[]): void;
5
+ (e: 'filter', event: MultiSelectFilterEvent): void;
6
+ (e: 'selectall-change', event: MultiSelectAllChangeEvent): void;
7
+ }
8
+ export interface EspriMultiSelectEmitsForDoc extends ObjectEmitsOptions {
9
+ /**
10
+ * Called when modelValue is updated.
11
+ */
12
+ 'update:modelValue': (value: any[]) => void;
13
+ /**
14
+ * Callback to invoke on filter input.
15
+ */
16
+ 'filter': (event: MultiSelectFilterEvent) => void;
17
+ /**
18
+ * Callback to invoke when all data is selected.
19
+ */
20
+ 'selectall-change': (event: MultiSelectAllChangeEvent) => void;
21
+ }
@@ -0,0 +1,112 @@
1
+ export interface EspriMultiSelectOption {
2
+ /**
3
+ * Display text for the option
4
+ */
5
+ label: string;
6
+ /**
7
+ * Value associated with the option
8
+ */
9
+ value: any;
10
+ }
11
+ type HintedString<T extends string> = T | (string & {});
12
+ export default interface EspriMultiSelectProps {
13
+ /**
14
+ * Label displayed above the input.
15
+ */
16
+ label: string;
17
+ /**
18
+ * Array of options available for selection.
19
+ */
20
+ options: Array<EspriMultiSelectOption>;
21
+ /**
22
+ * Array of selected values.
23
+ */
24
+ modelValue: any[];
25
+ /**
26
+ * Class of the component.
27
+ */
28
+ class?: any;
29
+ /**
30
+ * Disables the input when true.
31
+ */
32
+ disabled?: boolean;
33
+ /**
34
+ * Marks the input as required when true.
35
+ */
36
+ required?: boolean;
37
+ /**
38
+ * When enabled, a clear icon is displayed to clear the value.
39
+ */
40
+ showClear?: boolean;
41
+ /**
42
+ * Indicates if the component is in a loading state.
43
+ */
44
+ loading?: boolean;
45
+ /**
46
+ * Shows error messages when true.
47
+ */
48
+ showError?: boolean;
49
+ /**
50
+ * Validation rules for the input.
51
+ * Each rule can be undefined or an object containing:
52
+ * - $invalid: whether the rule is violated
53
+ * - $message: the error message associated with the rule
54
+ */
55
+ rules?: Array<{
56
+ $invalid: boolean;
57
+ $message: string;
58
+ } | undefined>;
59
+ /**
60
+ * Placeholder text displayed inside the input.
61
+ */
62
+ placeholder?: string;
63
+ /**
64
+ * Decides how many selected item labels to show at most.
65
+ */
66
+ maxSelectedLabels?: number;
67
+ /**
68
+ * Maximum number of selectable items.
69
+ */
70
+ selectionLimit?: number;
71
+ /**
72
+ * Text to display when there are no options available. Defaults to value from PrimeVue locale configuration.
73
+ */
74
+ emptyMessage?: string;
75
+ /**
76
+ * Label to display after exceeding max selected labels.
77
+ */
78
+ selectedItemsLabel?: string;
79
+ /**
80
+ * Clears the filter value when clicking on the clear icon.
81
+ * @default false
82
+ */
83
+ resetFilterOnClear?: boolean;
84
+ /**
85
+ * When specified, displays a filter input at header.
86
+ * @default false
87
+ */
88
+ filter?: boolean;
89
+ /**
90
+ * Placeholder text to show when filter input is empty.
91
+ * @default null
92
+ */
93
+ filterPlaceholder?: string;
94
+ /**
95
+ * Locale to use in filtering.
96
+ * Defaults to the host environment's current locale.
97
+ * @default null
98
+ */
99
+ filterLocale?: string;
100
+ /**
101
+ * Defines the filtering algorithm to use when searching options.
102
+ * @default 'contains'
103
+ */
104
+ filterMatchMode?: HintedString<'startsWith' | 'contains' | 'endsWith'>;
105
+ /**
106
+ * Fields used when filtering options.
107
+ * Defaults to optionLabel.
108
+ * @default null
109
+ */
110
+ filterFields?: string[];
111
+ }
112
+ export {};
@@ -25,6 +25,10 @@ export default interface EspriSelectProps {
25
25
  * Marks the input as required when true.
26
26
  */
27
27
  required?: boolean;
28
+ /**
29
+ * When enabled, a clear icon is displayed to clear the value.
30
+ */
31
+ showClear?: boolean;
28
32
  /**
29
33
  * Shows error messages when true.
30
34
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@espri/vue-components",
3
- "version": "2.2.1",
3
+ "version": "2.4.1",
4
4
  "description": "ESPRI Digital - Vue components library",
5
5
  "author": "ESPRI Digital",
6
6
  "homepage": "https://github.com/ESPRI-Digital/vue-select#readme",
@@ -44,6 +44,7 @@
44
44
  "scripts": {
45
45
  "build": "vite build && tsc --emitDeclarationOnly",
46
46
  "lint": "eslint .",
47
+ "lint:fix": "eslint . --fix",
47
48
  "ts-check": "vue-tsc --noEmit"
48
49
  },
49
50
  "peerDependencies": {