@clubmed/trident-ui 1.0.0-beta.2 → 1.0.0-beta.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/atoms/Icons/Iconics.d.ts +1 -1
  3. package/atoms/Icons/fonts/Utilities.js +0 -6
  4. package/atoms/Icons/svg/SvgIcon.js +12 -12
  5. package/atoms/Icons/svg/Utilities.js +0 -8
  6. package/atoms/Icons/svg-use/SvgUseIcon.js +12 -12
  7. package/atoms/Icons/svg-use/Utilities.js +58 -68
  8. package/fonts/Actions/tui-actions.css +6 -6
  9. package/fonts/Actions/tui-actions.eot +0 -0
  10. package/fonts/Actions/tui-actions.less +6 -6
  11. package/fonts/Actions/tui-actions.module.less +6 -6
  12. package/fonts/Actions/tui-actions.scss +6 -6
  13. package/fonts/Actions/tui-actions.styl +6 -6
  14. package/fonts/Actions/tui-actions.ttf +0 -0
  15. package/fonts/Actions/tui-actions.woff +0 -0
  16. package/fonts/Actions/tui-actions.woff2 +0 -0
  17. package/fonts/Activities/tui-activities.css +6 -6
  18. package/fonts/Activities/tui-activities.eot +0 -0
  19. package/fonts/Activities/tui-activities.less +6 -6
  20. package/fonts/Activities/tui-activities.module.less +6 -6
  21. package/fonts/Activities/tui-activities.scss +6 -6
  22. package/fonts/Activities/tui-activities.styl +6 -6
  23. package/fonts/Activities/tui-activities.ttf +0 -0
  24. package/fonts/Activities/tui-activities.woff +0 -0
  25. package/fonts/Activities/tui-activities.woff2 +0 -0
  26. package/fonts/Brand/tui-brand.css +6 -6
  27. package/fonts/Brand/tui-brand.eot +0 -0
  28. package/fonts/Brand/tui-brand.less +6 -6
  29. package/fonts/Brand/tui-brand.module.less +6 -6
  30. package/fonts/Brand/tui-brand.scss +6 -6
  31. package/fonts/Brand/tui-brand.styl +6 -6
  32. package/fonts/Brand/tui-brand.ttf +0 -0
  33. package/fonts/Brand/tui-brand.woff +0 -0
  34. package/fonts/Brand/tui-brand.woff2 +0 -0
  35. package/fonts/Covid/tui-covid.css +6 -6
  36. package/fonts/Covid/tui-covid.eot +0 -0
  37. package/fonts/Covid/tui-covid.less +6 -6
  38. package/fonts/Covid/tui-covid.module.less +6 -6
  39. package/fonts/Covid/tui-covid.scss +6 -6
  40. package/fonts/Covid/tui-covid.styl +6 -6
  41. package/fonts/Covid/tui-covid.ttf +0 -0
  42. package/fonts/Covid/tui-covid.woff +0 -0
  43. package/fonts/Covid/tui-covid.woff2 +0 -0
  44. package/fonts/Food/tui-food.css +6 -6
  45. package/fonts/Food/tui-food.eot +0 -0
  46. package/fonts/Food/tui-food.less +6 -6
  47. package/fonts/Food/tui-food.module.less +6 -6
  48. package/fonts/Food/tui-food.scss +6 -6
  49. package/fonts/Food/tui-food.styl +6 -6
  50. package/fonts/Food/tui-food.ttf +0 -0
  51. package/fonts/Food/tui-food.woff +0 -0
  52. package/fonts/Food/tui-food.woff2 +0 -0
  53. package/fonts/HappyToCare/tui-happy-to-care.css +6 -6
  54. package/fonts/HappyToCare/tui-happy-to-care.eot +0 -0
  55. package/fonts/HappyToCare/tui-happy-to-care.less +6 -6
  56. package/fonts/HappyToCare/tui-happy-to-care.module.less +6 -6
  57. package/fonts/HappyToCare/tui-happy-to-care.scss +6 -6
  58. package/fonts/HappyToCare/tui-happy-to-care.styl +6 -6
  59. package/fonts/HappyToCare/tui-happy-to-care.ttf +0 -0
  60. package/fonts/HappyToCare/tui-happy-to-care.woff +0 -0
  61. package/fonts/HappyToCare/tui-happy-to-care.woff2 +0 -0
  62. package/fonts/Places/tui-places.css +6 -6
  63. package/fonts/Places/tui-places.eot +0 -0
  64. package/fonts/Places/tui-places.less +6 -6
  65. package/fonts/Places/tui-places.module.less +6 -6
  66. package/fonts/Places/tui-places.scss +6 -6
  67. package/fonts/Places/tui-places.styl +6 -6
  68. package/fonts/Places/tui-places.ttf +0 -0
  69. package/fonts/Places/tui-places.woff +0 -0
  70. package/fonts/Places/tui-places.woff2 +0 -0
  71. package/fonts/Room/tui-room.css +6 -6
  72. package/fonts/Room/tui-room.eot +0 -0
  73. package/fonts/Room/tui-room.less +6 -6
  74. package/fonts/Room/tui-room.module.less +6 -6
  75. package/fonts/Room/tui-room.scss +6 -6
  76. package/fonts/Room/tui-room.styl +6 -6
  77. package/fonts/Room/tui-room.ttf +0 -0
  78. package/fonts/Room/tui-room.woff +0 -0
  79. package/fonts/Room/tui-room.woff2 +0 -0
  80. package/fonts/Services/tui-services.css +6 -6
  81. package/fonts/Services/tui-services.eot +0 -0
  82. package/fonts/Services/tui-services.less +6 -6
  83. package/fonts/Services/tui-services.module.less +6 -6
  84. package/fonts/Services/tui-services.scss +6 -6
  85. package/fonts/Services/tui-services.styl +6 -6
  86. package/fonts/Services/tui-services.ttf +0 -0
  87. package/fonts/Services/tui-services.woff +0 -0
  88. package/fonts/Services/tui-services.woff2 +0 -0
  89. package/fonts/Socials/tui-socials.css +6 -6
  90. package/fonts/Socials/tui-socials.eot +0 -0
  91. package/fonts/Socials/tui-socials.less +6 -6
  92. package/fonts/Socials/tui-socials.module.less +6 -6
  93. package/fonts/Socials/tui-socials.scss +6 -6
  94. package/fonts/Socials/tui-socials.styl +6 -6
  95. package/fonts/Socials/tui-socials.ttf +0 -0
  96. package/fonts/Socials/tui-socials.woff +0 -0
  97. package/fonts/Socials/tui-socials.woff2 +0 -0
  98. package/fonts/Transports/tui-transports.css +6 -6
  99. package/fonts/Transports/tui-transports.eot +0 -0
  100. package/fonts/Transports/tui-transports.less +6 -6
  101. package/fonts/Transports/tui-transports.module.less +6 -6
  102. package/fonts/Transports/tui-transports.scss +6 -6
  103. package/fonts/Transports/tui-transports.styl +6 -6
  104. package/fonts/Transports/tui-transports.ttf +0 -0
  105. package/fonts/Transports/tui-transports.woff +0 -0
  106. package/fonts/Transports/tui-transports.woff2 +0 -0
  107. package/fonts/Utilities/tui-utilities.css +36 -38
  108. package/fonts/Utilities/tui-utilities.eot +0 -0
  109. package/fonts/Utilities/tui-utilities.less +36 -38
  110. package/fonts/Utilities/tui-utilities.module.less +36 -38
  111. package/fonts/Utilities/tui-utilities.scss +66 -70
  112. package/fonts/Utilities/tui-utilities.styl +36 -38
  113. package/fonts/Utilities/tui-utilities.svg +30 -36
  114. package/fonts/Utilities/tui-utilities.symbol.svg +0 -4
  115. package/fonts/Utilities/tui-utilities.ttf +0 -0
  116. package/fonts/Utilities/tui-utilities.woff +0 -0
  117. package/fonts/Utilities/tui-utilities.woff2 +0 -0
  118. package/hooks/useKeyboardControls.d.ts +1 -1
  119. package/hooks/useKeyboardControls.js +31 -27
  120. package/molecules/Backdrop.js +13 -12
  121. package/molecules/Buttons/ButtonAnchor.d.ts +2 -1
  122. package/molecules/Buttons/ButtonAnchor.js +17 -16
  123. package/molecules/Forms/Checkboxes/Checkbox.d.ts +3 -12
  124. package/molecules/Forms/Checkboxes/Checkbox.js +90 -60
  125. package/molecules/Forms/Checkboxes/Checkboxes.d.ts +1 -1
  126. package/molecules/Forms/Checkboxes/Checkboxes.js +33 -34
  127. package/molecules/Forms/DateField.d.ts +1 -17
  128. package/molecules/Forms/DateField.js +99 -97
  129. package/molecules/Forms/Filter.d.ts +1 -1
  130. package/molecules/Forms/Filter.js +38 -38
  131. package/molecules/Forms/FormControl.d.ts +3 -2
  132. package/molecules/Forms/FormControl.js +30 -23
  133. package/molecules/Forms/FormLabel.d.ts +4 -17
  134. package/molecules/Forms/FormLabel.js +24 -19
  135. package/molecules/Forms/NumberField.d.ts +4 -4
  136. package/molecules/Forms/NumberField.js +75 -72
  137. package/molecules/Forms/Password/Password.d.ts +1 -0
  138. package/molecules/Forms/Password/Password.js +77 -52
  139. package/molecules/Forms/Password/ValidationMessage.js +1 -1
  140. package/molecules/Forms/Radios/Radio.d.ts +1 -1
  141. package/molecules/Forms/Radios/Radio.js +31 -31
  142. package/molecules/Forms/Radios/RadioGroup.d.ts +1 -1
  143. package/molecules/Forms/Radios/RadioGroup.js +28 -29
  144. package/molecules/Forms/Range.d.ts +2 -2
  145. package/molecules/Forms/Range.js +181 -183
  146. package/molecules/Forms/Select.d.ts +10 -0
  147. package/molecules/Forms/Select.js +102 -0
  148. package/molecules/Forms/Switch.d.ts +1 -1
  149. package/molecules/Forms/Switch.js +28 -28
  150. package/molecules/Forms/TextField.d.ts +0 -4
  151. package/molecules/Forms/TextField.js +52 -52
  152. package/molecules/Link.d.ts +5 -1
  153. package/molecules/Link.js +17 -16
  154. package/molecules/Popin.d.ts +12 -4
  155. package/molecules/Popin.js +38 -34
  156. package/molecules/Tabs/TabsHeading.js +73 -74
  157. package/molecules/Tabs/context/TabControl.js +21 -21
  158. package/package.json +1 -1
  159. package/styles/globals.css +8 -0
  160. package/EyeClosed-vWGtzMgE.js +0 -5
  161. package/EyeOpened-CsQwqVMl.js +0 -5
  162. package/assets/icons/Utilities/EyeClosed.svg +0 -12
  163. package/assets/icons/Utilities/EyeOpened.svg +0 -11
@@ -1,56 +1,56 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { c } from "../../index-Cu0xwYjD.js";
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { c as r } from "../../index-Cu0xwYjD.js";
3
+ import { useId as D } from "react";
3
4
  import "../../controls-l0sNRNKZ.js";
4
- import { Icon as m } from "../../atoms/Icons/Icon.js";
5
+ import { Icon as c } from "../../atoms/Icons/Icon.js";
5
6
  import "../../atoms/Icons/contexts/IconsContext.js";
6
- import { useValue as D } from "../../hooks/useValue.js";
7
- let N = 0;
8
- function I({
9
- id: n = "filter-" + N++,
10
- name: a = n,
11
- className: p,
12
- dataTestId: u,
13
- disabled: r,
14
- checked: f = !1,
15
- value: e,
16
- tabIndex: d = 0,
17
- onChange: l,
18
- hasDropdown: x,
19
- children: b,
20
- ...h
21
- }) {
22
- const { value: i, setValue: k } = D({
23
- name: a,
7
+ import { useValue as N } from "../../hooks/useValue.js";
8
+ function T(m) {
9
+ const d = D(), {
10
+ id: p = d,
11
+ name: l = p,
12
+ className: u,
13
+ dataTestId: h,
14
+ disabled: o,
15
+ checked: f = !1,
16
+ value: a,
17
+ tabIndex: b = 0,
18
+ onChange: t,
19
+ hasDropdown: x,
20
+ children: k,
21
+ ...w
22
+ } = m, { value: n, setValue: I } = N({
23
+ name: l,
24
24
  initialValue: f,
25
- onChange(w, o) {
26
- l == null || l(w, o ? e !== void 0 ? e : o : null);
25
+ onChange(v, s) {
26
+ t == null || t(v, s ? a !== void 0 ? a : s : null);
27
27
  }
28
28
  });
29
- return /* @__PURE__ */ s("label", { className: c(p, "relative"), children: [
30
- /* @__PURE__ */ t(
29
+ return /* @__PURE__ */ i("label", { className: r(u, "relative"), children: [
30
+ /* @__PURE__ */ e(
31
31
  "input",
32
32
  {
33
- ...h,
34
- name: a,
35
- "data-testid": u,
33
+ ...w,
34
+ name: l,
35
+ "data-testid": h,
36
36
  type: "checkbox",
37
- tabIndex: d,
37
+ tabIndex: b,
38
38
  onChange: () => {
39
- !r && k(!i);
39
+ !o && I(!n);
40
40
  },
41
- checked: i,
41
+ checked: n,
42
42
  "data-name": "Filter",
43
- disabled: r,
44
- value: e
43
+ disabled: o,
44
+ value: a
45
45
  }
46
46
  ),
47
- /* @__PURE__ */ s("span", { children: [
48
- /* @__PURE__ */ t("span", { className: c("text-b3 font-semibold"), children: b }),
49
- /* @__PURE__ */ t(m, { width: null, name: "CheckDefault", color: "black" }),
50
- x && /* @__PURE__ */ t(m, { name: "ArrowDefaultDown", className: "ml-8", width: "24px", color: "black" })
47
+ /* @__PURE__ */ i("span", { children: [
48
+ /* @__PURE__ */ e("span", { className: r("text-b3 font-semibold"), children: k }),
49
+ /* @__PURE__ */ e(c, { width: null, name: "CheckDefault", color: "black" }),
50
+ x && /* @__PURE__ */ e(c, { name: "ArrowDefaultDown", className: "ml-8", width: "24px", color: "black" })
51
51
  ] })
52
52
  ] });
53
53
  }
54
54
  export {
55
- I as Filter
55
+ T as Filter
56
56
  };
@@ -1,12 +1,13 @@
1
- import { HTMLAttributes, InputHTMLAttributes, PropsWithChildren } from 'react';
1
+ import { HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
2
2
  import { ValidationStatus } from '../../hooks/useInternalStatus';
3
3
  import { FormLabelProps } from './FormLabel';
4
4
  export type FormControlProps<Value = unknown, Attributes extends HTMLAttributes<HTMLElement> = InputHTMLAttributes<HTMLInputElement>> = {
5
5
  value?: Value;
6
+ label?: ReactNode;
6
7
  validationStatus?: ValidationStatus;
7
8
  onChange?: (name: string, value: Value) => void;
8
9
  dataTestId?: string;
9
10
  dataName?: string;
10
11
  errorMessage?: string;
11
12
  } & Omit<Attributes & Partial<FormLabelProps>, 'onChange' | 'value'>;
12
- export declare const FormControl: <Value = string>({ id, label, description, disabled, className, validationStatus, children, errorMessage, dataTestId, dataName, layout, }: PropsWithChildren<FormControlProps<Value, InputHTMLAttributes<HTMLInputElement>>>) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const FormControl: <Value = string>({ id, label, description, disabled, required, className, validationStatus, children, errorMessage, dataTestId, dataName, layout, }: FormControlProps<Value, InputHTMLAttributes<HTMLInputElement>>) => import("react/jsx-runtime").JSX.Element;
@@ -1,37 +1,44 @@
1
1
  import { jsxs as e, jsx as o } from "react/jsx-runtime";
2
- import { useInternalStatus as f } from "../../hooks/useInternalStatus.js";
3
- import { FormLabel as u } from "./FormLabel.js";
4
- import { Icon as h } from "../../atoms/Icons/Icon.js";
2
+ import { useInternalStatus as u } from "../../hooks/useInternalStatus.js";
3
+ import { FormLabel as h } from "./FormLabel.js";
4
+ import { Icon as b } from "../../atoms/Icons/Icon.js";
5
5
  import "../../atoms/Icons/contexts/IconsContext.js";
6
- import { c as b } from "../../index-Cu0xwYjD.js";
6
+ import { c as S } from "../../index-Cu0xwYjD.js";
7
7
  const v = ({
8
8
  id: t,
9
9
  label: r,
10
- description: s,
11
- disabled: m,
12
- className: n,
13
- validationStatus: i = "default",
14
- children: l,
10
+ description: m,
11
+ disabled: n,
12
+ required: i,
13
+ className: l,
14
+ validationStatus: p = "default",
15
+ children: c,
15
16
  errorMessage: a,
16
- dataTestId: p,
17
- dataName: c,
18
- layout: x
17
+ dataTestId: d,
18
+ dataName: x,
19
+ layout: f
19
20
  }) => {
20
- const d = f({
21
- isDisabled: !!m,
22
- validationStatus: i
23
- });
21
+ const s = u({
22
+ isDisabled: !!n,
23
+ validationStatus: p
24
+ }) === "error" && a;
24
25
  return /* @__PURE__ */ e(
25
26
  "div",
26
27
  {
27
- className: b("flex flex-col gap-4", n),
28
- "data-name": c,
29
- "data-testid": p,
28
+ className: S(
29
+ "flex flex-col gap-4",
30
+ {
31
+ "mb-24": !s
32
+ },
33
+ l
34
+ ),
35
+ "data-name": x,
36
+ "data-testid": d,
30
37
  children: [
31
- r && t && /* @__PURE__ */ o(u, { description: s, id: t, layout: x, children: r }),
32
- l,
33
- d === "error" && a && /* @__PURE__ */ e("span", { className: "text-red text-b4 flex items-start gap-x-4 px-20", children: [
34
- /* @__PURE__ */ o(h, { name: "Error", width: "20px" }),
38
+ r && t && /* @__PURE__ */ o(h, { description: m, id: t, layout: f, required: i, children: r }),
39
+ c,
40
+ s && /* @__PURE__ */ e("span", { className: "text-red text-b4 flex items-start gap-x-4 px-20", children: [
41
+ /* @__PURE__ */ o(b, { name: "Error", width: "20px" }),
35
42
  a
36
43
  ] })
37
44
  ]
@@ -1,20 +1,7 @@
1
- import { FunctionComponent, LabelHTMLAttributes, PropsWithChildren, ReactNode } from 'react';
2
- export interface FormLabelProps extends PropsWithChildren<LabelHTMLAttributes<HTMLLabelElement>> {
3
- /**
4
- * Label text or use Children
5
- */
6
- label?: string | ReactNode | undefined;
7
- /**
8
- * Description text
9
- */
1
+ import { LabelHTMLAttributes } from 'react';
2
+ export interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
10
3
  description?: string;
11
- /**
12
- * Layout of the label
13
- */
14
4
  layout?: 'horizontal' | 'vertical';
15
- /**
16
- * Additional class names
17
- */
18
- className?: string;
5
+ required?: boolean;
19
6
  }
20
- export declare const FormLabel: FunctionComponent<FormLabelProps>;
7
+ export declare const FormLabel: ({ id, description, layout, required, className, children, ...rest }: FormLabelProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,29 +1,34 @@
1
- import { jsxs as n, jsx as m } from "react/jsx-runtime";
2
- import { c as x } from "../../index-Cu0xwYjD.js";
3
- const c = {
4
- horizontal: "flex flex-wrap items-center gap-x-12 px-20",
5
- vertical: "flex flex-col items-start"
6
- }, f = ({
7
- children: t,
8
- label: l,
1
+ import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
+ import { c } from "../../index-Cu0xwYjD.js";
3
+ const b = ({
4
+ id: l,
9
5
  description: e,
10
- id: a,
11
- layout: o = "horizontal",
12
- className: r,
13
- ...s
14
- }) => /* @__PURE__ */ n(
6
+ layout: t = "horizontal",
7
+ required: r,
8
+ className: s,
9
+ children: m,
10
+ ...n
11
+ }) => /* @__PURE__ */ o(
15
12
  "label",
16
13
  {
17
- ...s,
18
- htmlFor: a,
19
- className: x("text-b3 font-semibold text-black", c[o], r),
14
+ ...n,
15
+ htmlFor: l,
16
+ className: c(
17
+ "text-b3 font-semibold text-black flex",
18
+ {
19
+ "flex-wrap items-center ps-20": t === "horizontal",
20
+ "flex-col items-start": t === "vertical"
21
+ },
22
+ s
23
+ ),
20
24
  "data-name": "InputLabel",
21
25
  children: [
22
- l || t,
23
- e && /* @__PURE__ */ m("span", { className: "text-b4 text-middleGrey inline-block font-normal", children: e })
26
+ m,
27
+ r && /* @__PURE__ */ a("span", { children: "*" }),
28
+ e && /* @__PURE__ */ a("span", { className: "ms-12 text-b4 text-grey font-normal", children: e })
24
29
  ]
25
30
  }
26
31
  );
27
32
  export {
28
- f as FormLabel
33
+ b as FormLabel
29
34
  };
@@ -1,10 +1,10 @@
1
- import { ChangeEvent, FunctionComponent } from 'react';
1
+ import { ChangeEvent } from 'react';
2
2
  import { FormControlProps } from './FormControl.js';
3
3
  interface NumberFieldProps extends FormControlProps<number> {
4
4
  min?: number;
5
5
  max?: number;
6
6
  }
7
- export declare function useNumberField({ id, name, value: initialValue, onChange, min, max, disabled, dataTestId, ...props }: NumberFieldProps): {
7
+ export declare function useNumberField(props: NumberFieldProps): {
8
8
  id: string;
9
9
  min: number;
10
10
  max: number;
@@ -15,6 +15,7 @@ export declare function useNumberField({ id, name, value: initialValue, onChange
15
15
  handleChange: (e: ChangeEvent<HTMLInputElement>) => void;
16
16
  increase: () => void;
17
17
  decrease: () => void;
18
+ label?: import("react").ReactNode;
18
19
  validationStatus?: import("../../hooks/useInternalStatus").ValidationStatus | undefined;
19
20
  dataName?: string | undefined;
20
21
  errorMessage?: string | undefined;
@@ -28,7 +29,6 @@ export declare function useNumberField({ id, name, value: initialValue, onChange
28
29
  form?: string | undefined;
29
30
  list?: string | undefined;
30
31
  role?: import("react").AriaRole | undefined;
31
- label?: import("react").ReactNode;
32
32
  slot?: string | undefined;
33
33
  title?: string | undefined;
34
34
  pattern?: string | undefined;
@@ -314,5 +314,5 @@ export declare function useNumberField({ id, name, value: initialValue, onChange
314
314
  layout?: "horizontal" | "vertical" | undefined;
315
315
  description?: string | undefined;
316
316
  };
317
- export declare const NumberField: FunctionComponent<NumberFieldProps>;
317
+ export declare const NumberField: (props: NumberFieldProps) => import("react/jsx-runtime").JSX.Element;
318
318
  export {};
@@ -1,114 +1,117 @@
1
- import { jsx as c, jsxs as g } from "react/jsx-runtime";
2
- import { c as x } from "../../index-Cu0xwYjD.js";
3
- import { useValue as v } from "../../hooks/useValue.js";
1
+ import { jsx as o, jsxs as v } from "react/jsx-runtime";
2
+ import { c as C } from "../../index-Cu0xwYjD.js";
3
+ import { useId as y } from "react";
4
+ import { useValue as I } from "../../hooks/useValue.js";
4
5
  import { Button as N } from "../Buttons/Button.js";
5
- import { FormControl as y } from "./FormControl.js";
6
- const C = { width: "28px", height: "28px" };
7
- let w = 0;
8
- function F({
9
- id: s = `field-number-${++w}`,
10
- name: e = s,
11
- value: i = 0,
12
- onChange: o,
13
- min: a = 0,
14
- max: l = 10,
15
- disabled: u = !1,
16
- dataTestId: d = "NumberField",
17
- ...r
18
- }) {
19
- const { value: t, setValue: n } = v({
20
- name: e,
21
- defaultValue: i,
6
+ import { FormControl as w } from "./FormControl.js";
7
+ const F = { width: "28px", height: "28px" };
8
+ function V(m) {
9
+ const e = y(), {
10
+ id: n = e,
11
+ name: r = n,
12
+ value: c = 0,
13
+ onChange: d,
14
+ min: t = 0,
15
+ max: l = 10,
16
+ disabled: i = !1,
17
+ dataTestId: u = "NumberField",
18
+ ...f
19
+ } = m, { value: a, setValue: s } = I({
20
+ name: r,
21
+ defaultValue: c,
22
22
  formatter: Number,
23
- onChange: o
23
+ onChange: d
24
24
  });
25
25
  return {
26
- ...r,
27
- id: s,
28
- min: a,
26
+ ...f,
27
+ id: n,
28
+ min: t,
29
29
  max: l,
30
- name: e,
31
- value: t,
32
- dataTestId: d,
33
- disabled: u,
34
- handleChange: (m) => {
35
- const f = Number(m.target.value);
36
- f >= a && f <= l && n(Number(f));
30
+ name: r,
31
+ value: a,
32
+ dataTestId: u,
33
+ disabled: i,
34
+ handleChange: (g) => {
35
+ const h = Number(g.target.value);
36
+ h >= t && h <= l && s(Number(h));
37
37
  },
38
38
  increase: () => {
39
- t < l && n(t + 1);
39
+ a < l && s(a + 1);
40
40
  },
41
41
  decrease: () => {
42
- t > a && n(t - 1);
42
+ a > t && s(a - 1);
43
43
  }
44
44
  };
45
45
  }
46
- const P = (s) => {
46
+ const k = (m) => {
47
47
  const {
48
48
  disabled: e,
49
- min: i,
50
- max: o,
51
- label: a,
52
- description: l,
53
- id: u,
54
- dataTestId: d,
55
- value: r,
56
- handleChange: t,
57
- increase: n,
58
- decrease: b,
59
- errorMessage: h,
49
+ min: n,
50
+ max: r,
51
+ label: c,
52
+ description: d,
53
+ id: t,
54
+ dataTestId: l,
55
+ value: i,
56
+ handleChange: u,
57
+ increase: f,
58
+ decrease: a,
59
+ errorMessage: s,
60
60
  validationStatus: p,
61
- ...m
62
- } = F(s);
63
- return /* @__PURE__ */ c(
64
- y,
61
+ required: b,
62
+ ...x
63
+ } = V(m);
64
+ return /* @__PURE__ */ o(
65
+ w,
65
66
  {
66
- id: u,
67
- label: a,
68
- description: l,
67
+ id: t,
68
+ label: c,
69
+ description: d,
69
70
  className: "flex items-center justify-between",
70
71
  dataName: "NumberField",
71
- dataTestId: d,
72
- errorMessage: h,
72
+ dataTestId: l,
73
+ errorMessage: s,
73
74
  validationStatus: p,
74
75
  disabled: e,
76
+ required: b,
75
77
  layout: "vertical",
76
- children: /* @__PURE__ */ g("div", { className: "flex items-center gap-x-8", children: [
77
- /* @__PURE__ */ c(
78
+ children: /* @__PURE__ */ v("div", { className: "flex items-center gap-x-8", children: [
79
+ /* @__PURE__ */ o(
78
80
  N,
79
81
  {
80
82
  theme: "yellow",
81
- onClick: b,
83
+ onClick: a,
82
84
  variant: "icon",
83
- disabled: r <= i || e,
85
+ disabled: i <= n || e,
84
86
  icon: "MinusDefault",
85
87
  label: "MINUS"
86
88
  }
87
89
  ),
88
- /* @__PURE__ */ c(
90
+ /* @__PURE__ */ o(
89
91
  "input",
90
92
  {
91
- ...m,
92
- className: x("text-b2 text-center font-normal outline-none", {
93
+ ...x,
94
+ className: C("text-b2 text-center font-normal outline-none", {
93
95
  "bg-pearl text-grey": e
94
96
  }),
95
- style: C,
97
+ style: F,
96
98
  type: "number",
97
- id: u,
98
- onChange: t,
99
+ id: t,
100
+ onChange: u,
99
101
  disabled: e,
100
- value: r,
101
- min: i,
102
- max: o
102
+ required: b,
103
+ value: i,
104
+ min: n,
105
+ max: r
103
106
  }
104
107
  ),
105
- /* @__PURE__ */ c(
108
+ /* @__PURE__ */ o(
106
109
  N,
107
110
  {
108
111
  theme: "yellow",
109
- onClick: n,
112
+ onClick: f,
110
113
  variant: "icon",
111
- disabled: r >= o || e,
114
+ disabled: i >= r || e,
112
115
  icon: "PlusDefault",
113
116
  label: "PLUS"
114
117
  }
@@ -118,6 +121,6 @@ const P = (s) => {
118
121
  );
119
122
  };
120
123
  export {
121
- P as NumberField,
122
- F as useNumberField
124
+ k as NumberField,
125
+ V as useNumberField
123
126
  };
@@ -2,5 +2,6 @@ import { FormControlProps } from '../FormControl';
2
2
  import { ValidationMessage } from './ValidationMessage';
3
3
  export interface PasswordProps<Value> extends FormControlProps<Value> {
4
4
  validationMessages?: ValidationMessage[];
5
+ withoutFieldValidation?: boolean;
5
6
  }
6
7
  export declare function Password<Value = string>(props: PasswordProps<Value>): import("react/jsx-runtime").JSX.Element;
@@ -1,73 +1,98 @@
1
- import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
- import { c as y } from "../../../index-Cu0xwYjD.js";
3
- import { useState as N, useEffect as C } from "react";
4
- import { useValue as k } from "../../../hooks/useValue.js";
5
- import { FormControl as V } from "../FormControl.js";
6
- import { Icon as E } from "../../../atoms/Icons/Icon.js";
1
+ import { jsxs as i, jsx as a } from "react/jsx-runtime";
2
+ import { c as m } from "../../../index-Cu0xwYjD.js";
3
+ import { useId as M, useState as P, useEffect as S } from "react";
4
+ import { useValue as T } from "../../../hooks/useValue.js";
5
+ import { FormControl as D } from "../FormControl.js";
6
+ import { Icon as n } from "../../../atoms/Icons/Icon.js";
7
7
  import "../../../atoms/Icons/contexts/IconsContext.js";
8
- import { ValidationMessage as P } from "./ValidationMessage.js";
9
- let T = 0;
10
- function $(p) {
11
- const {
12
- id: t = `password-${++T}`,
13
- name: s = t,
14
- label: d,
15
- value: m,
16
- disabled: l = !1,
17
- validationMessages: r = [],
18
- className: c,
19
- onChange: u,
20
- dataTestId: b = "Password",
21
- ...f
22
- } = p, { value: g, setValue: x } = k({
23
- name: s,
24
- initialValue: m,
25
- onChange: u
26
- }), [e, i] = N("password");
27
- C(() => i(e), [e]);
28
- const h = () => i(e === "password" ? "text" : "password");
29
- return /* @__PURE__ */ n(
30
- V,
8
+ import { ValidationMessage as F } from "./ValidationMessage.js";
9
+ function K(f) {
10
+ const b = M(), {
11
+ id: r = b,
12
+ name: o = r,
13
+ label: x,
14
+ value: g,
15
+ disabled: d = !1,
16
+ required: c = !1,
17
+ validationStatus: e = "default",
18
+ errorMessage: h,
19
+ validationMessages: p = [],
20
+ withoutFieldValidation: s = !1,
21
+ className: v,
22
+ onChange: w,
23
+ dataTestId: y = "Password",
24
+ ...N
25
+ } = f, { value: C, setValue: V } = T({
26
+ name: o,
27
+ initialValue: g,
28
+ onChange: w
29
+ }), [t, u] = P("password");
30
+ S(() => u(t), [t]);
31
+ const k = () => u(t === "password" ? "text" : "password");
32
+ return /* @__PURE__ */ i(
33
+ D,
31
34
  {
32
- id: t,
33
- label: d,
35
+ id: r,
36
+ label: x,
34
37
  dataName: "Password",
35
- dataTestId: b,
36
- disabled: l,
38
+ dataTestId: y,
39
+ disabled: d,
40
+ required: c,
41
+ validationStatus: s ? "default" : e,
42
+ errorMessage: h,
37
43
  children: [
38
- /* @__PURE__ */ n("div", { className: "relative", children: [
44
+ /* @__PURE__ */ i("div", { className: "relative", children: [
39
45
  /* @__PURE__ */ a(
40
46
  "input",
41
47
  {
42
- ...f,
43
- id: t,
44
- name: s,
45
- type: e,
46
- value: g,
47
- disabled: l,
48
- onChange: (o) => x(o.target.value),
49
- className: y(
50
- "text-b3 rounded-pill w-full border ps-20 py-[11px] font-normal outline-none bg-white text-black pe-[52px] border-lightGrey focus:border-black active:border-black",
51
- c
48
+ ...N,
49
+ id: r,
50
+ name: o,
51
+ type: t,
52
+ value: C,
53
+ disabled: d,
54
+ required: c,
55
+ onChange: (l) => V(l.target.value),
56
+ className: m(
57
+ "text-b3 rounded-pill w-full border ps-20 py-[11px] font-normal outline-none bg-white text-black",
58
+ {
59
+ "border-lightGrey focus:border-black active:border-black pe-[52px]": s || e === "default",
60
+ "pe-[84px]": !s && (e === "error" || e === "success"),
61
+ "border-red": !s && e === "error",
62
+ "border-green": !s && e === "success"
63
+ },
64
+ v
52
65
  ),
53
- "aria-label": s
66
+ "aria-label": o
54
67
  }
55
68
  ),
56
69
  /* @__PURE__ */ a(
57
- "button",
70
+ "div",
58
71
  {
59
- type: "button",
60
- className: "pointer-events-auto ms-auto absolute right-20 top-12 size-24",
61
- onClick: h,
62
- children: /* @__PURE__ */ a(E, { name: e === "password" ? "EyeClosed" : "EyeOpened", width: "24px", type: "svg" })
72
+ className: m(
73
+ "pointer-events-none absolute inset-0 flex items-center justify-between px-20 py-12"
74
+ ),
75
+ children: /* @__PURE__ */ i("span", { className: "ms-auto flex gap-x-8", children: [
76
+ !s && e === "error" && /* @__PURE__ */ a(n, { name: "CrossDefault", color: "red", width: "24px" }),
77
+ !s && e === "success" && /* @__PURE__ */ a(n, { name: "CheckDefault", color: "green", width: "24px" }),
78
+ /* @__PURE__ */ a(
79
+ "button",
80
+ {
81
+ type: "button",
82
+ className: "pointer-events-auto size-24 inline-flex",
83
+ onClick: k,
84
+ children: /* @__PURE__ */ a(n, { name: t === "password" ? "Invisible" : "Visible", width: "24px", type: "svg" })
85
+ }
86
+ )
87
+ ] })
63
88
  }
64
89
  )
65
90
  ] }),
66
- !!r.length && /* @__PURE__ */ a("div", { className: "flex flex-col gap-[10px] mt-8", children: r.map(({ label: o, status: w }, v) => /* @__PURE__ */ a(P, { label: o, status: w }, v)) })
91
+ p.length > 0 && /* @__PURE__ */ a("div", { className: "flex flex-col gap-[10px] mt-8", children: p.map(({ label: l, status: I }, j) => /* @__PURE__ */ a(F, { label: l, status: I }, j)) })
67
92
  ]
68
93
  }
69
94
  );
70
95
  }
71
96
  export {
72
- $ as Password
97
+ K as Password
73
98
  };