@payfit/unity-components 0.0.0-alpha.12 → 0.0.0-alpha.13

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.
Files changed (121) hide show
  1. package/dist/cjs/components/button/Button.d.cts +5 -2
  2. package/dist/cjs/components/checkbox/Checkbox.variants.cjs +1 -1
  3. package/dist/cjs/components/data-table/DataTable.cjs +1 -1
  4. package/dist/cjs/components/data-table/DataTable.d.cts +3 -6
  5. package/dist/cjs/components/date-calendar/DateCalendar.cjs +1 -0
  6. package/dist/cjs/components/date-calendar/DateCalendar.d.cts +23 -0
  7. package/dist/cjs/components/date-calendar/hooks/useMonthsList.d.cts +4 -0
  8. package/dist/cjs/components/date-calendar/hooks/useYearsList.d.cts +10 -0
  9. package/dist/cjs/components/date-picker/DatePicker.cjs +1 -1
  10. package/dist/cjs/components/date-picker/DatePicker.d.cts +3 -3
  11. package/dist/cjs/components/definition-tooltip/DefinitionTooltip.cjs +1 -0
  12. package/dist/cjs/components/definition-tooltip/DefinitionTooltip.d.cts +23 -0
  13. package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.cjs +1 -1
  14. package/dist/cjs/components/dialog/parts/DialogActions/DialogButton.d.cts +2 -2
  15. package/dist/cjs/components/icon-button/CircularIconButton.cjs +1 -1
  16. package/dist/cjs/components/icon-button/CircularIconButton.d.cts +0 -21
  17. package/dist/cjs/components/icon-button/IconButton.d.cts +1 -1
  18. package/dist/cjs/components/number-field/NumberField.cjs +1 -0
  19. package/dist/cjs/components/number-field/NumberField.d.cts +47 -0
  20. package/dist/cjs/components/number-input/NumberInput.cjs +1 -0
  21. package/dist/cjs/components/number-input/NumberInput.d.cts +216 -0
  22. package/dist/cjs/components/pagination/Pagination.cjs +1 -1
  23. package/dist/cjs/components/pagination/hooks/use-pagination.cjs +1 -1
  24. package/dist/cjs/components/pagination/hooks/use-pagination.d.cts +2 -1
  25. package/dist/cjs/components/popover/Popover.cjs +1 -1
  26. package/dist/cjs/components/popover/parts/PopoverHeader.cjs +1 -1
  27. package/dist/cjs/components/radio-button-group/parts/RadioButton.cjs +1 -1
  28. package/dist/cjs/components/select-field/test-utils.cjs +1 -0
  29. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.cjs +1 -1
  30. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.context.d.cts +5 -1
  31. package/dist/cjs/components/selectable-button-group/SelectableButtonGroup.d.cts +7 -1
  32. package/dist/cjs/components/selectable-button-group/parts/SelectableButton.cjs +1 -1
  33. package/dist/cjs/components/selectable-button-group/parts/SelectableButton.d.cts +35 -0
  34. package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.cjs +1 -0
  35. package/dist/cjs/components/selectable-button-group-field/SelectableButtonGroupField.d.cts +59 -0
  36. package/dist/cjs/components/side-panel/SidePanel.cjs +1 -1
  37. package/dist/cjs/components/side-panel/SidePanel.d.cts +6 -0
  38. package/dist/cjs/components/table/Table.cjs +1 -1
  39. package/dist/cjs/components/table/Table.d.cts +4 -0
  40. package/dist/cjs/components/table/parts/TableCell.cjs +1 -1
  41. package/dist/cjs/components/tabs/parts/NavigationButton.cjs +1 -1
  42. package/dist/cjs/components/tabs/parts/TabList.cjs +1 -1
  43. package/dist/cjs/components/text/Text.cjs +1 -1
  44. package/dist/cjs/components/text/Text.d.cts +1 -1
  45. package/dist/cjs/components/text/Text.variants.cjs +1 -1
  46. package/dist/cjs/components/text/Text.variants.d.cts +7 -0
  47. package/dist/cjs/components/tooltip/Tooltip.cjs +1 -1
  48. package/dist/cjs/components/tooltip/Tooltip.d.cts +4 -3
  49. package/dist/cjs/index.cjs +1 -1
  50. package/dist/cjs/index.d.cts +5 -0
  51. package/dist/cjs/index.storybook-testing.d.cts +1 -0
  52. package/dist/cjs/storybook-testing.cjs +1 -1
  53. package/dist/esm/components/button/Button.d.ts +5 -2
  54. package/dist/esm/components/checkbox/Checkbox.variants.js +4 -4
  55. package/dist/esm/components/data-table/DataTable.d.ts +3 -6
  56. package/dist/esm/components/data-table/DataTable.js +61 -56
  57. package/dist/esm/components/date-calendar/DateCalendar.d.ts +23 -0
  58. package/dist/esm/components/{date-picker/parts → date-calendar}/DateCalendar.js +62 -60
  59. package/dist/esm/components/date-calendar/hooks/useMonthsList.d.ts +4 -0
  60. package/dist/esm/components/date-calendar/hooks/useYearsList.d.ts +10 -0
  61. package/dist/esm/components/date-picker/DatePicker.d.ts +3 -3
  62. package/dist/esm/components/date-picker/DatePicker.js +22 -22
  63. package/dist/esm/components/definition-tooltip/DefinitionTooltip.d.ts +23 -0
  64. package/dist/esm/components/definition-tooltip/DefinitionTooltip.js +29 -0
  65. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.d.ts +2 -2
  66. package/dist/esm/components/dialog/parts/DialogActions/DialogButton.js +31 -27
  67. package/dist/esm/components/icon-button/CircularIconButton.d.ts +0 -21
  68. package/dist/esm/components/icon-button/CircularIconButton.js +23 -26
  69. package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
  70. package/dist/esm/components/number-field/NumberField.d.ts +47 -0
  71. package/dist/esm/components/number-field/NumberField.js +71 -0
  72. package/dist/esm/components/number-input/NumberInput.d.ts +216 -0
  73. package/dist/esm/components/number-input/NumberInput.js +214 -0
  74. package/dist/esm/components/pagination/Pagination.js +17 -16
  75. package/dist/esm/components/pagination/hooks/use-pagination.d.ts +2 -1
  76. package/dist/esm/components/pagination/hooks/use-pagination.js +12 -11
  77. package/dist/esm/components/popover/Popover.js +25 -21
  78. package/dist/esm/components/popover/parts/PopoverHeader.js +17 -15
  79. package/dist/esm/components/radio-button-group/parts/RadioButton.js +1 -1
  80. package/dist/esm/components/select-field/test-utils.js +25 -0
  81. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.context.d.ts +5 -1
  82. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +7 -1
  83. package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +23 -16
  84. package/dist/esm/components/selectable-button-group/parts/SelectableButton.d.ts +35 -0
  85. package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +44 -36
  86. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +59 -0
  87. package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.js +45 -0
  88. package/dist/esm/components/side-panel/SidePanel.d.ts +6 -0
  89. package/dist/esm/components/side-panel/SidePanel.js +38 -35
  90. package/dist/esm/components/table/Table.d.ts +4 -0
  91. package/dist/esm/components/table/Table.js +96 -71
  92. package/dist/esm/components/table/parts/TableCell.js +5 -5
  93. package/dist/esm/components/tabs/parts/NavigationButton.js +4 -4
  94. package/dist/esm/components/tabs/parts/TabList.js +44 -35
  95. package/dist/esm/components/text/Text.d.ts +1 -1
  96. package/dist/esm/components/text/Text.js +6 -5
  97. package/dist/esm/components/text/Text.variants.d.ts +7 -0
  98. package/dist/esm/components/text/Text.variants.js +2 -1
  99. package/dist/esm/components/tooltip/Tooltip.d.ts +4 -3
  100. package/dist/esm/components/tooltip/Tooltip.js +13 -12
  101. package/dist/esm/index.d.ts +5 -0
  102. package/dist/esm/index.js +237 -225
  103. package/dist/esm/index.storybook-testing.d.ts +1 -0
  104. package/dist/esm/storybook-testing.js +3 -1
  105. package/i18n/en-GB.json +2 -0
  106. package/i18n/es-ES.json +2 -0
  107. package/i18n/fr-FR.json +2 -0
  108. package/package.json +7 -6
  109. package/dist/cjs/components/date-picker/parts/DateCalendar.cjs +0 -1
  110. package/dist/cjs/components/date-picker/parts/DateCalendar.d.cts +0 -9
  111. package/dist/cjs/components/popover/parts/PopoverContent.cjs +0 -1
  112. package/dist/esm/components/date-picker/parts/DateCalendar.d.ts +0 -9
  113. package/dist/esm/components/popover/parts/PopoverContent.js +0 -9
  114. /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useMonthsList.cjs +0 -0
  115. /package/dist/cjs/components/{date-picker → date-calendar}/hooks/useYearsList.cjs +0 -0
  116. /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.cjs +0 -0
  117. /package/dist/cjs/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.cts +0 -0
  118. /package/dist/esm/components/{date-picker → date-calendar}/hooks/useMonthsList.js +0 -0
  119. /package/dist/esm/components/{date-picker → date-calendar}/hooks/useYearsList.js +0 -0
  120. /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.d.ts +0 -0
  121. /package/dist/esm/components/{date-picker → date-calendar}/parts/DateSegmentSelect.js +0 -0
@@ -0,0 +1,29 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as r } from "react";
3
+ import { Focusable as u } from "react-aria-components";
4
+ import { tv as l } from "tailwind-variants";
5
+ import { Text as f } from "../text/Text.js";
6
+ import { Tooltip as s } from "../tooltip/Tooltip.js";
7
+ const a = l({
8
+ base: [
9
+ "uy-text-content-neutral-enabled uy-rounded-50 uy-py-75",
10
+ "hover:uy-text-content-neutral-hover",
11
+ "active:uy-text-content-neutral-active",
12
+ "focus-visible:uy-outline-2 focus-visible:uy-outline focus-visible:uy-outline-offset-2 focus-visible:uy-outline-utility-focus-ring"
13
+ ]
14
+ }), c = r(
15
+ ({ children: t, title: i, asElement: e = "span", ...n }, m) => /* @__PURE__ */ o(s, { title: i, ...n, children: /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(
16
+ f,
17
+ {
18
+ variant: "actionInfo",
19
+ asElement: e,
20
+ role: "button",
21
+ className: a(),
22
+ children: t
23
+ }
24
+ ) }) })
25
+ );
26
+ c.displayName = "DefinitionTooltip";
27
+ export {
28
+ c as DefinitionTooltip
29
+ };
@@ -3,7 +3,7 @@ import { PropsWithChildren } from 'react';
3
3
  import { ButtonProps } from '../../../button/Button.js';
4
4
  type ButtonVariant = 'close' | 'confirm' | 'danger';
5
5
  type OnPressParameters = Parameters<NonNullable<ButtonProps['onPress']>>[0];
6
- export type DialogButtonProps<T extends ButtonVariant> = {
6
+ export type DialogButtonProps<T extends ButtonVariant> = Omit<ButtonProps, 'variant' | 'color'> & {
7
7
  /** the different variants for the button */
8
8
  variant: T;
9
9
  /** the icon, it is a discouraged practice, except for `danger` variant which has a `WarningCircleOutlined` as default */
@@ -16,7 +16,7 @@ export type DialogButtonProps<T extends ButtonVariant> = {
16
16
  *
17
17
  */
18
18
  declare const DialogButton: {
19
- <T extends ButtonVariant>({ children, variant, onPress, isLoading, icon, }: PropsWithChildren<DialogButtonProps<T>>): import("react/jsx-runtime").JSX.Element | undefined;
19
+ <T extends ButtonVariant>({ children, variant, onPress, isLoading, icon, ...props }: PropsWithChildren<DialogButtonProps<T>>): import("react/jsx-runtime").JSX.Element | undefined;
20
20
  displayName: string;
21
21
  };
22
22
  export { DialogButton };
@@ -1,59 +1,63 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useContext as c } from "react";
3
- import { OverlayTriggerStateContext as f } from "react-aria-components";
4
- import { Button as n } from "../../../button/Button.js";
5
- const u = ({
6
- children: o,
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useContext as p } from "react";
3
+ import { OverlayTriggerStateContext as u } from "react-aria-components";
4
+ import { Button as m } from "../../../button/Button.js";
5
+ const l = ({
6
+ children: e,
7
7
  variant: s,
8
8
  onPress: r,
9
- isLoading: m,
10
- icon: e
9
+ isLoading: c,
10
+ icon: o,
11
+ ...a
11
12
  }) => {
12
- const a = c(f);
13
+ const i = p(u);
13
14
  switch (s) {
14
15
  case "close":
15
- const p = r;
16
- return /* @__PURE__ */ i(
17
- n,
16
+ const f = r;
17
+ return /* @__PURE__ */ n(
18
+ m,
18
19
  {
19
- prefixIcon: e,
20
+ ...a,
21
+ prefixIcon: o,
20
22
  variant: "secondary",
21
23
  onPress: (t) => {
22
- p && p(t), a == null || a.close();
24
+ f && f(t), i == null || i.close();
23
25
  },
24
- children: o
26
+ children: e
25
27
  }
26
28
  );
27
29
  case "confirm":
28
- return /* @__PURE__ */ i(
29
- n,
30
+ return /* @__PURE__ */ n(
31
+ m,
30
32
  {
31
- prefixIcon: e,
33
+ ...a,
34
+ prefixIcon: o,
32
35
  variant: "primary",
33
- isLoading: m,
36
+ isLoading: c,
34
37
  onPress: (t) => {
35
38
  r && r(t);
36
39
  },
37
- children: o
40
+ children: e
38
41
  }
39
42
  );
40
43
  case "danger":
41
- return /* @__PURE__ */ i(
42
- n,
44
+ return /* @__PURE__ */ n(
45
+ m,
43
46
  {
47
+ ...a,
44
48
  variant: "primary",
45
49
  color: "danger",
46
- isLoading: m,
47
- prefixIcon: e ?? "WarningCircleOutlined",
50
+ isLoading: c,
51
+ prefixIcon: o ?? "WarningCircleOutlined",
48
52
  onPress: (t) => {
49
53
  r && r(t);
50
54
  },
51
- children: o
55
+ children: e
52
56
  }
53
57
  );
54
58
  }
55
59
  };
56
- u.displayName = "DialogButton";
60
+ l.displayName = "DialogButton";
57
61
  export {
58
- u as DialogButton
62
+ l as DialogButton
59
63
  };
@@ -10,9 +10,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
10
10
  'content.neutral': string;
11
11
  'content.neutral.low': string;
12
12
  };
13
- isDisabled: {
14
- false: string;
15
- };
16
13
  }, undefined, string[], import('tailwind-variants/dist/config.js').TVConfig<{
17
14
  size: {
18
15
  default: string;
@@ -22,9 +19,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
22
19
  'content.neutral': string;
23
20
  'content.neutral.low': string;
24
21
  };
25
- isDisabled: {
26
- false: string;
27
- };
28
22
  }, {
29
23
  size: {
30
24
  default: string;
@@ -34,9 +28,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
34
28
  'content.neutral': string;
35
29
  'content.neutral.low': string;
36
30
  };
37
- isDisabled: {
38
- false: string;
39
- };
40
31
  }>, {
41
32
  size: {
42
33
  default: string;
@@ -46,9 +37,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
46
37
  'content.neutral': string;
47
38
  'content.neutral.low': string;
48
39
  };
49
- isDisabled: {
50
- false: string;
51
- };
52
40
  }, undefined, import('tailwind-variants').TVReturnType<{
53
41
  size: {
54
42
  default: string;
@@ -58,9 +46,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
58
46
  'content.neutral': string;
59
47
  'content.neutral.low': string;
60
48
  };
61
- isDisabled: {
62
- false: string;
63
- };
64
49
  }, undefined, string[], import('tailwind-variants/dist/config.js').TVConfig<{
65
50
  size: {
66
51
  default: string;
@@ -70,9 +55,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
70
55
  'content.neutral': string;
71
56
  'content.neutral.low': string;
72
57
  };
73
- isDisabled: {
74
- false: string;
75
- };
76
58
  }, {
77
59
  size: {
78
60
  default: string;
@@ -82,9 +64,6 @@ export declare const circularIconButton: import('tailwind-variants').TVReturnTyp
82
64
  'content.neutral': string;
83
65
  'content.neutral.low': string;
84
66
  };
85
- isDisabled: {
86
- false: string;
87
- };
88
67
  }>, unknown, unknown, undefined>>;
89
68
  export interface CircularIconButtonProps extends Omit<AriaButtonProps, 'className'>, VariantProps<typeof circularIconButton> {
90
69
  icon: UnityIcon;
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { Button as g, Pressable as x } from "react-aria-components";
2
+ import { Button as v, Pressable as x } from "react-aria-components";
3
3
  import { tv as w } from "tailwind-variants";
4
4
  import z from "../../hooks/use-id.js";
5
5
  import { Icon as d } from "../icon/Icon.js";
@@ -11,7 +11,7 @@ const I = w({
11
11
  "active:uy-bg-surface-neutral-active",
12
12
  "data-[pressed]:uy-bg-surface-neutral-pressed",
13
13
  "focus-visible:uy-outline-2 focus-visible:uy-outline-offset-2 focus-visible:uy-outline-utility-focus-ring",
14
- "aria-disabled:uy-cursor-not-allowed aria-disabled:uy-text-content-neutral-disabled",
14
+ "data-[disabled]:uy-cursor-not-allowed data-[disabled]:uy-text-content-neutral-disabled",
15
15
  "aria-busy:uy-text-content-neutral-disabled aria-busy:uy-cursor-progress"
16
16
  ],
17
17
  variants: {
@@ -22,9 +22,6 @@ const I = w({
22
22
  color: {
23
23
  "content.neutral": "uy-text-content-neutral",
24
24
  "content.neutral.low": "uy-text-content-neutral-low"
25
- },
26
- isDisabled: {
27
- false: "hover:uy-bg-surface-neutral-hover"
28
25
  }
29
26
  },
30
27
  defaultVariants: {
@@ -32,40 +29,40 @@ const I = w({
32
29
  color: "content.neutral"
33
30
  }
34
31
  });
35
- function N(f) {
36
- const m = z(), {
32
+ function N(m) {
33
+ const f = z(), {
37
34
  onPress: o,
38
35
  icon: s,
39
36
  color: p,
40
- size: i,
41
- isLoading: r,
37
+ size: l,
38
+ isLoading: t,
42
39
  title: a,
43
- isDisabled: t,
40
+ isDisabled: i,
44
41
  asElement: h = "default",
45
- className: v,
42
+ className: g,
46
43
  ...n
47
- } = f, l = `icon-button-label-${m}`, u = I({ class: v, color: p, size: i, isDisabled: t });
44
+ } = m, r = `icon-button-label-${f}`, u = I({ class: g, color: p, size: l });
48
45
  return h === "button" ? /* @__PURE__ */ e(b, { title: a, children: /* @__PURE__ */ c(
49
- g,
46
+ v,
50
47
  {
51
48
  "data-dd-privacy": "allow",
52
49
  ...n,
53
50
  onPress: o,
54
- isDisabled: t || r,
55
- "aria-labelledby": l,
56
- "aria-busy": r,
51
+ isDisabled: i || t,
52
+ "aria-labelledby": r,
53
+ "aria-busy": t,
57
54
  className: u,
58
55
  children: [
59
- r ? /* @__PURE__ */ e(y, { size: "small", label: "Loading", color: "inherit" }) : /* @__PURE__ */ e(
56
+ t ? /* @__PURE__ */ e(y, { size: "small", label: "Loading", color: "inherit" }) : /* @__PURE__ */ e(
60
57
  d,
61
58
  {
62
59
  src: s,
63
- size: i === "large" ? 24 : 20,
60
+ size: l === "large" ? 24 : 20,
64
61
  color: "inherit",
65
62
  role: "presentation"
66
63
  }
67
64
  ),
68
- /* @__PURE__ */ e("span", { id: l, className: "uy-sr-only", children: a })
65
+ /* @__PURE__ */ e("span", { id: r, className: "uy-sr-only", children: a })
69
66
  ]
70
67
  }
71
68
  ) }) : /* @__PURE__ */ e(b, { title: a, children: /* @__PURE__ */ e(
@@ -74,20 +71,20 @@ function N(f) {
74
71
  "data-dd-privacy": "allow",
75
72
  ...n,
76
73
  onPress: o,
77
- isDisabled: t || r,
78
- "aria-labelledby": l,
79
- "aria-busy": r,
80
- children: /* @__PURE__ */ c("div", { role: "button", "aria-disabled": t, className: u, children: [
81
- r ? /* @__PURE__ */ e(y, { size: "small", label: "Loading", color: "inherit" }) : /* @__PURE__ */ e(
74
+ isDisabled: i || t,
75
+ "aria-labelledby": r,
76
+ "aria-busy": t,
77
+ children: /* @__PURE__ */ c("div", { role: "button", "aria-disabled": i, className: u, children: [
78
+ t ? /* @__PURE__ */ e(y, { size: "small", label: "Loading", color: "inherit" }) : /* @__PURE__ */ e(
82
79
  d,
83
80
  {
84
81
  src: s,
85
- size: i === "large" ? 24 : 20,
82
+ size: l === "large" ? 24 : 20,
86
83
  color: "inherit",
87
84
  role: "presentation"
88
85
  }
89
86
  ),
90
- /* @__PURE__ */ e("span", { id: l, className: "uy-sr-only", children: a })
87
+ /* @__PURE__ */ e("span", { id: r, className: "uy-sr-only", children: a })
91
88
  ] })
92
89
  }
93
90
  ) });
@@ -7,7 +7,7 @@ interface IconButtonBaseProps {
7
7
  /** The icon to display inside the button */
8
8
  icon: UnityIcon;
9
9
  /** The function to trigger when the button is clicked */
10
- onClick: () => void;
10
+ onClick?: () => void;
11
11
  /** Override the icon role */
12
12
  iconRole?: AriaRole;
13
13
  /** className to add to the button */
@@ -0,0 +1,47 @@
1
+ import { ForwardedRef, JSX, ReactNode } from 'react';
2
+ import { FieldPath, FieldValues } from 'react-hook-form';
3
+ import { infer as ZodInfer } from 'zod';
4
+ import { Schema } from '../../hooks/use-form.types.js';
5
+ import { LabelProps } from '../label/Label.js';
6
+ import { NumberProps } from '../number-input/NumberInput.js';
7
+ export declare const numberField: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, "uy-flex uy-flex-col uy-gap-100", import('tailwind-variants/dist/config.js').TVConfig<unknown, {} | {}>, {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, "uy-flex uy-flex-col uy-gap-100", import('tailwind-variants/dist/config.js').TVConfig<unknown, {} | {}>, unknown, unknown, undefined>>;
8
+ export interface NumberFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Pick<LabelProps, 'isRequired' | 'requiredVariant'>, Omit<NumberProps, 'name'> {
9
+ /** The name of the field, which should match the form schema. */
10
+ name: TName;
11
+ /** The label for the text field. */
12
+ label: string;
13
+ /** Helper text to display below the text field. */
14
+ helperText?: ReactNode;
15
+ /** Feedback text to display below the text field. */
16
+ feedbackText?: ReactNode;
17
+ /** A contextual link to display below the text field. */
18
+ contextualLink?: ReactNode;
19
+ }
20
+ type NumberFieldComponent = (<TSchema extends Schema>(props: NumberFieldProps<ZodInfer<TSchema>> & {
21
+ ref?: ForwardedRef<HTMLInputElement>;
22
+ }) => JSX.Element) & {
23
+ displayName?: string;
24
+ };
25
+ /**
26
+ * NumberField is a form control component that combines a number input with form field functionality.
27
+ * It integrates with React Hook Form and provides features like validation, labels, helper text, and feedback.
28
+ * @template TFieldValues - The type of the form values
29
+ * @template TName - The type of the field name (must be a key of TFieldValues)
30
+ * @example
31
+ * ```tsx
32
+ * import { NumberField } from '@payfit/unity-components'
33
+ *
34
+ * <NumberField
35
+ * name="age"
36
+ * label="Age"
37
+ * helperText="Enter your age in years"
38
+ * isRequired
39
+ * />
40
+ * ```
41
+ * @template TSchema - The Zod schema type for form validation
42
+ * @param {NumberFieldProps<ZodInfer<TSchema>>} props - The props for the NumberField component
43
+ * @param {ForwardedRef<HTMLInputElement>} ref - Ref forwarded to the underlying input element
44
+ * @returns {JSX.Element} A NumberField component
45
+ */
46
+ declare const NumberField: NumberFieldComponent;
47
+ export { NumberField };
@@ -0,0 +1,71 @@
1
+ import { jsxs as y, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as C } from "react";
3
+ import { useFormContext as I } from "react-hook-form";
4
+ import { tv as j } from "tailwind-variants";
5
+ import { FormField as B } from "../form-field/FormField.js";
6
+ import { FormControl as P } from "../form-field/parts/FormControl.js";
7
+ import { FormFeedbackText as T } from "../form-field/parts/FormFeedbackText.js";
8
+ import { FormHelperText as g } from "../form-field/parts/FormHelperText.js";
9
+ import { FormLabel as k } from "../form-field/parts/FormLabel.js";
10
+ import { NumberInput as v } from "../number-input/NumberInput.js";
11
+ const w = j({
12
+ base: "uy-flex uy-flex-col uy-gap-100"
13
+ });
14
+ function H({
15
+ name: o,
16
+ label: e,
17
+ defaultValue: t,
18
+ helperText: m,
19
+ feedbackText: n,
20
+ contextualLink: i,
21
+ isRequired: l,
22
+ isInvalid: s,
23
+ isLoading: u,
24
+ isDisabled: c,
25
+ isReadOnly: p,
26
+ requiredVariant: f,
27
+ onClearButtonPress: d,
28
+ ...a
29
+ }, F) {
30
+ const { control: b, setValue: x } = I(), N = {
31
+ isRequired: l,
32
+ isInvalid: s,
33
+ isLoading: u,
34
+ isDisabled: c,
35
+ isReadOnly: p
36
+ }, h = d ?? (() => {
37
+ x(o, NaN);
38
+ });
39
+ return /* @__PURE__ */ y(
40
+ B,
41
+ {
42
+ control: b,
43
+ name: o,
44
+ className: w(),
45
+ ...N,
46
+ children: [
47
+ /* @__PURE__ */ r(k, { requiredVariant: f, children: e }),
48
+ m && /* @__PURE__ */ r(g, { children: m }),
49
+ /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
50
+ v,
51
+ {
52
+ ref: F,
53
+ onClearButtonPress: h,
54
+ defaultValue: t,
55
+ ...a
56
+ }
57
+ ) }),
58
+ /* @__PURE__ */ r(T, { children: n }),
59
+ i
60
+ ]
61
+ }
62
+ );
63
+ }
64
+ const L = C(function(e, t) {
65
+ return H(e, t);
66
+ });
67
+ L.displayName = "NumberField";
68
+ export {
69
+ L as NumberField,
70
+ w as numberField
71
+ };
@@ -0,0 +1,216 @@
1
+ import { ReactElement } from 'react';
2
+ import { NumberFieldProps } from 'react-aria-components';
3
+ import { VariantProps } from 'tailwind-variants';
4
+ export declare const numberInput: import('tailwind-variants').TVReturnType<{
5
+ isReadOnly: {
6
+ true: {
7
+ base: string[];
8
+ prefix: string[];
9
+ wrapper: string[];
10
+ input: string[];
11
+ suffix: string[];
12
+ };
13
+ false: {
14
+ base: string[];
15
+ prefix: string[];
16
+ suffix: string[];
17
+ wrapper: string[];
18
+ input: string[];
19
+ state: string[];
20
+ button: string;
21
+ };
22
+ };
23
+ }, {
24
+ base: string[];
25
+ wrapper: string[];
26
+ input: string[];
27
+ prefix: string[];
28
+ suffix: string[];
29
+ state: string[];
30
+ controls: string[];
31
+ }, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
32
+ isReadOnly: {
33
+ true: {
34
+ base: string[];
35
+ prefix: string[];
36
+ wrapper: string[];
37
+ input: string[];
38
+ suffix: string[];
39
+ };
40
+ false: {
41
+ base: string[];
42
+ prefix: string[];
43
+ suffix: string[];
44
+ wrapper: string[];
45
+ input: string[];
46
+ state: string[];
47
+ button: string;
48
+ };
49
+ };
50
+ }, {
51
+ isReadOnly: {
52
+ true: {
53
+ base: string[];
54
+ prefix: string[];
55
+ wrapper: string[];
56
+ input: string[];
57
+ suffix: string[];
58
+ };
59
+ false: {
60
+ base: string[];
61
+ prefix: string[];
62
+ suffix: string[];
63
+ wrapper: string[];
64
+ input: string[];
65
+ state: string[];
66
+ button: string;
67
+ };
68
+ };
69
+ }>, {
70
+ isReadOnly: {
71
+ true: {
72
+ base: string[];
73
+ prefix: string[];
74
+ wrapper: string[];
75
+ input: string[];
76
+ suffix: string[];
77
+ };
78
+ false: {
79
+ base: string[];
80
+ prefix: string[];
81
+ suffix: string[];
82
+ wrapper: string[];
83
+ input: string[];
84
+ state: string[];
85
+ button: string;
86
+ };
87
+ };
88
+ }, {
89
+ base: string[];
90
+ wrapper: string[];
91
+ input: string[];
92
+ prefix: string[];
93
+ suffix: string[];
94
+ state: string[];
95
+ controls: string[];
96
+ }, import('tailwind-variants').TVReturnType<{
97
+ isReadOnly: {
98
+ true: {
99
+ base: string[];
100
+ prefix: string[];
101
+ wrapper: string[];
102
+ input: string[];
103
+ suffix: string[];
104
+ };
105
+ false: {
106
+ base: string[];
107
+ prefix: string[];
108
+ suffix: string[];
109
+ wrapper: string[];
110
+ input: string[];
111
+ state: string[];
112
+ button: string;
113
+ };
114
+ };
115
+ }, {
116
+ base: string[];
117
+ wrapper: string[];
118
+ input: string[];
119
+ prefix: string[];
120
+ suffix: string[];
121
+ state: string[];
122
+ controls: string[];
123
+ }, undefined, import('tailwind-variants/dist/config.js').TVConfig<{
124
+ isReadOnly: {
125
+ true: {
126
+ base: string[];
127
+ prefix: string[];
128
+ wrapper: string[];
129
+ input: string[];
130
+ suffix: string[];
131
+ };
132
+ false: {
133
+ base: string[];
134
+ prefix: string[];
135
+ suffix: string[];
136
+ wrapper: string[];
137
+ input: string[];
138
+ state: string[];
139
+ button: string;
140
+ };
141
+ };
142
+ }, {
143
+ isReadOnly: {
144
+ true: {
145
+ base: string[];
146
+ prefix: string[];
147
+ wrapper: string[];
148
+ input: string[];
149
+ suffix: string[];
150
+ };
151
+ false: {
152
+ base: string[];
153
+ prefix: string[];
154
+ suffix: string[];
155
+ wrapper: string[];
156
+ input: string[];
157
+ state: string[];
158
+ button: string;
159
+ };
160
+ };
161
+ }>, unknown, unknown, undefined>>;
162
+ type StyleWithoutCurrency = Exclude<Intl.NumberFormatOptions['style'], 'currency'>;
163
+ interface FormatOptions extends Omit<Intl.NumberFormatOptions, 'currency' | 'style'> {
164
+ style?: StyleWithoutCurrency;
165
+ }
166
+ export interface NumberProps extends VariantProps<typeof numberInput>, Omit<NumberFieldProps, 'className' | 'style' | 'formatOptions' | 'children'> {
167
+ withControls?: boolean;
168
+ /** Element to display before the input field */
169
+ prefix?: ReactElement;
170
+ /** Element to display after the input field */
171
+ suffix?: ReactElement;
172
+ /** Whether the field is in a loading state */
173
+ isLoading?: boolean;
174
+ /**
175
+ * Clear button click handler
176
+ */
177
+ onClearButtonPress?: () => void;
178
+ /** Format options for the number input */
179
+ formatOptions?: FormatOptions;
180
+ }
181
+ /**
182
+ * The `NumberInput` component renders an input field specifically designed for numeric values. It provides features like
183
+ * increment/decrement controls, formatting options, and various states including loading, invalid, disabled, and read-only.
184
+ * The component supports prefix and suffix elements, clear button functionality, and can be integrated with form validation.
185
+ * @param {NumberProps} props - The props for the `NumberInput` component
186
+ * @example
187
+ * ```tsx
188
+ * import { NumberInput } from '@payfit/unity-components'
189
+ *
190
+ * // Basic usage
191
+ * <NumberInput aria-label="Amount" />
192
+ *
193
+ * // With controls and formatting
194
+ * <NumberInput
195
+ * withControls
196
+ * minValue={0}
197
+ * maxValue={1000}
198
+ * step={10}
199
+ * formatOptions={{
200
+ * minimumFractionDigits: 2,
201
+ * maximumFractionDigits: 2
202
+ * }}
203
+ * aria-label="Amount"
204
+ * />
205
+ *
206
+ * // With prefix
207
+ * <NumberInput
208
+ * prefix={<Icon src="CurrencyEuroOutlined" size={20} />}
209
+ * aria-label="Amount"
210
+ * />
211
+ * ```
212
+ * @see {@link NumberProps} for all available props
213
+ * @remarks {@link https://www.payfit.design/24f360409/p/545bd2-number-field|Design docs}
214
+ */
215
+ declare const NumberInput: import('react').ForwardRefExoticComponent<NumberProps & import('react').RefAttributes<HTMLDivElement>>;
216
+ export { NumberInput };