zuii 1.4.25 → 1.4.27

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.
@@ -70,7 +70,7 @@ const O = (t) => (t || (typeof document < "u" ? document.documentElement.lang :
70
70
  const a = document.createElement("div");
71
71
  a.dataset.zuiiUppyActions = "true", a.className = "group group--gap-none group--center", a.style.marginRight = "8px";
72
72
  const p = (h, d, g) => {
73
- const u = document.createElement("button");
73
+ const u = document.createElement("a");
74
74
  return u.type = "button", u.title = d, u.setAttribute("aria-label", d), u.className = "btn btn-light uppy-Dashboard-Item-action btn-xs btn-icon btn-transparent", u.innerHTML = `<div class="btn-content"><span class="icon icon--size-xs"><i class="${h}"></i></span></div>`, u.addEventListener("click", (L) => {
75
75
  L.stopPropagation();
76
76
  const m = c.getFile(r);
@@ -2,6 +2,14 @@
2
2
  * Propriétés du composant NumberInput.
3
3
  */
4
4
  export interface NumberInputProps {
5
+ /**
6
+ * Id de l'input.
7
+ */
8
+ id?: string;
9
+ /**
10
+ * Name de l'input.
11
+ */
12
+ name?: string;
5
13
  /**
6
14
  * Valeur actuelle de l'input.
7
15
  */
@@ -10,7 +18,7 @@ export interface NumberInputProps {
10
18
  * Callback lors du changement de valeur.
11
19
  * @param {number} value - La nouvelle valeur.
12
20
  */
13
- onChange: (value: number) => void;
21
+ onChange?: (value: number) => void;
14
22
  /**
15
23
  * Valeur minimale (défaut: undefined).
16
24
  */
@@ -31,6 +39,10 @@ export interface NumberInputProps {
31
39
  * Texte d'aide ou de placeholder.
32
40
  */
33
41
  placeholder?: string;
42
+ /**
43
+ * Indique si le champ est requis.
44
+ */
45
+ required?: boolean;
34
46
  }
35
47
  /**
36
48
  * Composant NumberInput avec boutons +/- personnalisés.
@@ -38,4 +50,4 @@ export interface NumberInputProps {
38
50
  * @param {NumberInputProps} props - Les propriétés du composant.
39
51
  * @returns {JSX.Element} Le composant NumberInput rendu.
40
52
  */
41
- export declare const NumberInput: ({ value, onChange, min, max, step, className, placeholder, }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
53
+ export declare const NumberInput: ({ value: propsValue, onChange, min, max, step, className, placeholder, id, name, required, }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,54 +1,67 @@
1
- import { jsxs as I, jsx as n } from "react/jsx-runtime";
2
- import { InputGroup as m, Form as _ } from "react-bootstrap";
3
- import { calculateDecrement as $, calculateIncrement as b } from "../js/form.js";
4
- import { Icon as i } from "../../Icon/react/index.js";
5
- const D = ({
6
- value: s = 0,
7
- onChange: e,
8
- min: r,
9
- max: t,
10
- step: l = 1,
11
- className: a = "",
12
- placeholder: u
1
+ import { jsxs as j, jsx as n } from "react/jsx-runtime";
2
+ import { useState as k, useEffect as y } from "react";
3
+ import { InputGroup as m, Form as z } from "react-bootstrap";
4
+ import { calculateIncrement as D, calculateDecrement as T } from "../js/form.js";
5
+ import { Icon as h } from "../../Icon/react/index.js";
6
+ const q = ({
7
+ value: e,
8
+ onChange: u,
9
+ min: t,
10
+ max: c,
11
+ step: s = 1,
12
+ className: I = "",
13
+ placeholder: N,
14
+ id: _,
15
+ name: d,
16
+ required: C
13
17
  }) => {
14
- const c = "number-input", d = () => {
15
- e(b(s, l, t));
18
+ const r = "number-input", [$, f] = k(e ?? 0);
19
+ y(() => {
20
+ e !== void 0 && f(e);
21
+ }, [e]);
22
+ const i = e !== void 0 ? e : $, a = (l) => {
23
+ e === void 0 && f(l), u && u(l);
24
+ }, b = () => {
25
+ a(D(i, s, c));
16
26
  }, p = () => {
17
- e($(s, l, r));
18
- }, f = (N) => {
19
- const o = parseInt(N.target.value);
20
- if (isNaN(o)) {
21
- e(0);
27
+ a(T(i, s, t));
28
+ }, g = (l) => {
29
+ const v = parseInt(l.target.value);
30
+ if (isNaN(v)) {
31
+ a(0);
22
32
  return;
23
33
  }
24
- if (r !== void 0 && o < r) {
25
- e(r);
26
- return;
27
- }
28
- if (t !== void 0 && o > t) {
29
- e(t);
30
- return;
31
- }
32
- e(o);
34
+ let o = v;
35
+ t !== void 0 && o < t && (o = t), c !== void 0 && o > c && (o = c), a(o);
33
36
  };
34
- return /* @__PURE__ */ I(m, { className: `${c} ${a}`.trim(), children: [
35
- /* @__PURE__ */ n(m.Text, { className: `${c}__addon`, onClick: p, children: /* @__PURE__ */ n(i, { name: "icon-minus", size: "sm" }) }),
37
+ return /* @__PURE__ */ j(m, { className: `${r} ${I}`.trim(), children: [
38
+ /* @__PURE__ */ n(m.Text, { className: `${r}__addon`, onClick: p, children: /* @__PURE__ */ n(h, { name: "icon-minus", size: "sm" }) }),
36
39
  /* @__PURE__ */ n(
37
- _.Control,
40
+ z.Control,
38
41
  {
42
+ id: _,
39
43
  type: "number",
40
- className: `${c}__control`,
41
- value: s,
42
- onChange: f,
43
- placeholder: u,
44
- min: r,
45
- max: t,
46
- step: l
44
+ className: `${r}__control`,
45
+ value: i,
46
+ onChange: g,
47
+ placeholder: N,
48
+ min: t,
49
+ max: c,
50
+ step: s,
51
+ required: C
47
52
  }
48
53
  ),
49
- /* @__PURE__ */ n(m.Text, { className: `${c}__addon`, onClick: d, children: /* @__PURE__ */ n(i, { name: "icon-plus", size: "sm" }) })
54
+ /* @__PURE__ */ n(m.Text, { className: `${r}__addon`, onClick: b, children: /* @__PURE__ */ n(h, { name: "icon-plus", size: "sm" }) }),
55
+ d && /* @__PURE__ */ n(
56
+ "input",
57
+ {
58
+ type: "hidden",
59
+ name: d,
60
+ value: i
61
+ }
62
+ )
50
63
  ] });
51
64
  };
52
65
  export {
53
- D as NumberInput
66
+ q as NumberInput
54
67
  };
@@ -33,6 +33,7 @@ export const FormsElements = () => {
33
33
  <Form.Control id="search" type="search" placeholder="Enter search" name="search" icon="icon-search" />
34
34
  <Form.Control id="email" type="email" placeholder="Enter email" name="email" icon="icon-at-sign" />
35
35
  <Form.Control id="number" type="number" placeholder="Enter number" name="number" icon="icon-number" />
36
+ <Form.Number id="number-button" placeholder="Enter number" name="number-button" onChange={(val) => console.log(val)} step={1} min={0} max={10} required={true} className='fees-field__input' />
36
37
  {/* <Form.File id="file-simple" label="Upload simple" name="file_simple" />
37
38
  <Form.File
38
39
  id="simple-upload"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuii",
3
- "version": "1.4.25",
3
+ "version": "1.4.27",
4
4
  "description": "Bibliothèque de composants UI légère, intuitive et modulaire pour les interfaces web modernes.",
5
5
  "type": "module",
6
6
  "repository": {