@fuf-stack/uniform 0.3.2 → 0.5.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.
Files changed (110) hide show
  1. package/dist/FieldArray/index.cjs +13 -0
  2. package/dist/FieldArray/index.cjs.map +1 -0
  3. package/dist/FieldArray/index.d.cts +8 -0
  4. package/dist/FieldArray/index.d.ts +8 -0
  5. package/dist/FieldArray/index.js +13 -0
  6. package/dist/FieldArray/index.js.map +1 -0
  7. package/dist/FieldArray-DUvn98Fe.d.cts +27 -0
  8. package/dist/FieldArray-DUvn98Fe.d.ts +27 -0
  9. package/dist/Form/index.cjs +2 -2
  10. package/dist/Form/index.js +1 -1
  11. package/dist/Grid/index.cjs +2 -2
  12. package/dist/Grid/index.js +1 -1
  13. package/dist/Input/index.cjs +3 -3
  14. package/dist/Input/index.d.cts +2 -2
  15. package/dist/Input/index.d.ts +2 -2
  16. package/dist/Input/index.js +2 -2
  17. package/dist/{Input-B_rP1h4X.d.cts → Input-B6dNQiiD.d.cts} +3 -1
  18. package/dist/{Input-B_rP1h4X.d.ts → Input-B6dNQiiD.d.ts} +3 -1
  19. package/dist/RadioGroup/index.cjs +13 -0
  20. package/dist/RadioGroup/index.cjs.map +1 -0
  21. package/dist/RadioGroup/index.d.cts +7 -0
  22. package/dist/RadioGroup/index.d.ts +7 -0
  23. package/dist/RadioGroup/index.js +13 -0
  24. package/dist/RadioGroup/index.js.map +1 -0
  25. package/dist/RadioGroup-BU4K9cnS.d.cts +40 -0
  26. package/dist/RadioGroup-BU4K9cnS.d.ts +40 -0
  27. package/dist/Select/index.cjs +13 -0
  28. package/dist/Select/index.cjs.map +1 -0
  29. package/dist/Select/index.d.cts +8 -0
  30. package/dist/Select/index.d.ts +8 -0
  31. package/dist/Select/index.js +13 -0
  32. package/dist/Select/index.js.map +1 -0
  33. package/dist/Select-Mp6Y00dT.d.cts +40 -0
  34. package/dist/Select-Mp6Y00dT.d.ts +40 -0
  35. package/dist/SubmitButton/index.cjs +2 -2
  36. package/dist/SubmitButton/index.js +1 -1
  37. package/dist/Switch/index.cjs +13 -0
  38. package/dist/Switch/index.cjs.map +1 -0
  39. package/dist/Switch/index.d.cts +7 -0
  40. package/dist/Switch/index.d.ts +7 -0
  41. package/dist/Switch/index.js +13 -0
  42. package/dist/Switch/index.js.map +1 -0
  43. package/dist/Switch-DmjDKgKs.d.cts +20 -0
  44. package/dist/Switch-DmjDKgKs.d.ts +20 -0
  45. package/dist/TextArea/index.cjs +13 -0
  46. package/dist/TextArea/index.cjs.map +1 -0
  47. package/dist/TextArea/index.d.cts +8 -0
  48. package/dist/TextArea/index.d.ts +8 -0
  49. package/dist/TextArea/index.js +13 -0
  50. package/dist/TextArea/index.js.map +1 -0
  51. package/dist/TextArea-B-sKvTkd.d.cts +25 -0
  52. package/dist/TextArea-B-sKvTkd.d.ts +25 -0
  53. package/dist/{chunk-3DMR7T4D.js → chunk-2Z3YMYNN.js} +8 -6
  54. package/dist/chunk-2Z3YMYNN.js.map +1 -0
  55. package/dist/chunk-4IT2WVQK.cjs +76 -0
  56. package/dist/chunk-4IT2WVQK.cjs.map +1 -0
  57. package/dist/{chunk-TEJGV6NC.js → chunk-5FMJUJ7H.js} +2 -2
  58. package/dist/chunk-5FMJUJ7H.js.map +1 -0
  59. package/dist/{chunk-ZPFKVKGV.cjs → chunk-6GN255GP.cjs} +4 -4
  60. package/dist/chunk-6GN255GP.cjs.map +1 -0
  61. package/dist/chunk-6NZVSPFX.js +76 -0
  62. package/dist/chunk-6NZVSPFX.js.map +1 -0
  63. package/dist/{chunk-XUKBLFTR.cjs → chunk-AGAYQTFD.cjs} +4 -4
  64. package/dist/chunk-AGAYQTFD.cjs.map +1 -0
  65. package/dist/chunk-BIJVBXOG.js +205 -0
  66. package/dist/chunk-BIJVBXOG.js.map +1 -0
  67. package/dist/{chunk-4BELEHDQ.cjs → chunk-BNTEIMNY.cjs} +5 -5
  68. package/dist/chunk-BNTEIMNY.cjs.map +1 -0
  69. package/dist/chunk-CRKMTDKU.js +239 -0
  70. package/dist/chunk-CRKMTDKU.js.map +1 -0
  71. package/dist/chunk-EXYTFHEJ.js +81 -0
  72. package/dist/chunk-EXYTFHEJ.js.map +1 -0
  73. package/dist/{chunk-22AA557I.cjs → chunk-HT3LKDHX.cjs} +4 -4
  74. package/dist/chunk-HT3LKDHX.cjs.map +1 -0
  75. package/dist/chunk-I22ICCUC.cjs +205 -0
  76. package/dist/chunk-I22ICCUC.cjs.map +1 -0
  77. package/dist/chunk-I26DVRVR.js +287 -0
  78. package/dist/chunk-I26DVRVR.js.map +1 -0
  79. package/dist/{chunk-6XKDXQ4A.js → chunk-KFRKKWZT.js} +3 -3
  80. package/dist/chunk-KFRKKWZT.js.map +1 -0
  81. package/dist/chunk-NVJKXQ5W.cjs +239 -0
  82. package/dist/chunk-NVJKXQ5W.cjs.map +1 -0
  83. package/dist/chunk-OS4SMYPO.cjs +287 -0
  84. package/dist/chunk-OS4SMYPO.cjs.map +1 -0
  85. package/dist/{chunk-FNVT6LS4.js → chunk-OV5RMSYD.js} +2 -2
  86. package/dist/{chunk-22AA557I.cjs.map → chunk-OV5RMSYD.js.map} +1 -1
  87. package/dist/{chunk-4MEKDDB2.js → chunk-PDCEKC3G.js} +2 -2
  88. package/dist/chunk-PDCEKC3G.js.map +1 -0
  89. package/dist/{chunk-2O53LMR3.cjs → chunk-VO7ZM3KY.cjs} +11 -9
  90. package/dist/chunk-VO7ZM3KY.cjs.map +1 -0
  91. package/dist/chunk-XY7ZZARS.cjs +81 -0
  92. package/dist/chunk-XY7ZZARS.cjs.map +1 -0
  93. package/dist/hooks/index.d.cts +2 -2
  94. package/dist/hooks/index.d.ts +2 -2
  95. package/dist/index.cjs +27 -7
  96. package/dist/index.d.cts +8 -2
  97. package/dist/index.d.ts +8 -2
  98. package/dist/index.js +29 -9
  99. package/dist/partials/FieldCopyTestIdButton/index.cjs +2 -2
  100. package/dist/partials/FieldCopyTestIdButton/index.js +1 -1
  101. package/package.json +41 -17
  102. package/dist/chunk-2O53LMR3.cjs.map +0 -1
  103. package/dist/chunk-3DMR7T4D.js.map +0 -1
  104. package/dist/chunk-4BELEHDQ.cjs.map +0 -1
  105. package/dist/chunk-4MEKDDB2.js.map +0 -1
  106. package/dist/chunk-6XKDXQ4A.js.map +0 -1
  107. package/dist/chunk-FNVT6LS4.js.map +0 -1
  108. package/dist/chunk-TEJGV6NC.js.map +0 -1
  109. package/dist/chunk-XUKBLFTR.cjs.map +0 -1
  110. package/dist/chunk-ZPFKVKGV.cjs.map +0 -1
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunk4IT2WVQKcjs = require('../chunk-4IT2WVQK.cjs');
5
+ require('../chunk-HT3LKDHX.cjs');
6
+ require('../chunk-QTL5FREE.cjs');
7
+ require('../chunk-WQRM7G4C.cjs');
8
+ require('../chunk-BBB4FEY6.cjs');
9
+
10
+
11
+
12
+ exports.TextArea = _chunk4IT2WVQKcjs.TextArea_default; exports.default = _chunk4IT2WVQKcjs.TextArea_default2;
13
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { T as TextArea } from '../TextArea-B-sKvTkd.cjs';
2
+ export { a as TextAreaProps } from '../TextArea-B-sKvTkd.cjs';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
5
+
6
+
7
+
8
+ export { TextArea, TextArea as default };
@@ -0,0 +1,8 @@
1
+ import { T as TextArea } from '../TextArea-B-sKvTkd.js';
2
+ export { a as TextAreaProps } from '../TextArea-B-sKvTkd.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
5
+
6
+
7
+
8
+ export { TextArea, TextArea as default };
@@ -0,0 +1,13 @@
1
+ import {
2
+ TextArea_default,
3
+ TextArea_default2
4
+ } from "../chunk-6NZVSPFX.js";
5
+ import "../chunk-OV5RMSYD.js";
6
+ import "../chunk-DBLODROX.js";
7
+ import "../chunk-BCMPSLSG.js";
8
+ import "../chunk-V46BHM2U.js";
9
+ export {
10
+ TextArea_default as TextArea,
11
+ TextArea_default2 as default
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface TextAreaProps {
5
+ /** Child components. The content of the textarea. */
6
+ children?: ReactNode;
7
+ /** CSS class name */
8
+ className?: string;
9
+ /** Determines if the TextArea is disabled or not. */
10
+ disabled?: boolean;
11
+ /** Label displayed above the TextArea. */
12
+ label?: ReactNode;
13
+ /** Name the TextArea is registered at in HTML forms (react-hook-form). */
14
+ name: string;
15
+ /** placeholder for the textArea content. */
16
+ placeholder?: string;
17
+ /** Id to grab element in internal tests. */
18
+ testId?: string;
19
+ }
20
+ /**
21
+ * TextArea component based on [NextUI TextArea](https://nextui.org/docs/components/textarea)
22
+ */
23
+ declare const TextArea: ({ children, className, disabled, label, name, placeholder, testId: _testId, }: TextAreaProps) => react_jsx_runtime.JSX.Element;
24
+
25
+ export { TextArea as T, type TextAreaProps as a };
@@ -0,0 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface TextAreaProps {
5
+ /** Child components. The content of the textarea. */
6
+ children?: ReactNode;
7
+ /** CSS class name */
8
+ className?: string;
9
+ /** Determines if the TextArea is disabled or not. */
10
+ disabled?: boolean;
11
+ /** Label displayed above the TextArea. */
12
+ label?: ReactNode;
13
+ /** Name the TextArea is registered at in HTML forms (react-hook-form). */
14
+ name: string;
15
+ /** placeholder for the textArea content. */
16
+ placeholder?: string;
17
+ /** Id to grab element in internal tests. */
18
+ testId?: string;
19
+ }
20
+ /**
21
+ * TextArea component based on [NextUI TextArea](https://nextui.org/docs/components/textarea)
22
+ */
23
+ declare const TextArea: ({ children, className, disabled, label, name, placeholder, testId: _testId, }: TextAreaProps) => react_jsx_runtime.JSX.Element;
24
+
25
+ export { TextArea as T, type TextAreaProps as a };
@@ -1,20 +1,21 @@
1
1
  import {
2
- FieldValidationError_default2 as FieldValidationError_default
2
+ FieldCopyTestIdButton_default
3
+ } from "./chunk-OV5RMSYD.js";
4
+ import {
5
+ FieldValidationError_default
3
6
  } from "./chunk-DBLODROX.js";
4
7
  import {
5
8
  useFormContext
6
9
  } from "./chunk-BCMPSLSG.js";
7
- import {
8
- FieldCopyTestIdButton_default2 as FieldCopyTestIdButton_default
9
- } from "./chunk-FNVT6LS4.js";
10
10
 
11
11
  // src/Input/Input.tsx
12
12
  import { Controller } from "react-hook-form";
13
13
  import { Input as NextInput } from "@nextui-org/input";
14
- import cn from "classnames";
14
+ import { cn } from "@fuf-stack/pixel-utils";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
16
  var Input = ({
17
17
  className = void 0,
18
+ disabled = false,
18
19
  endContent = void 0,
19
20
  label = void 0,
20
21
  name,
@@ -29,6 +30,7 @@ var Input = ({
29
30
  Controller,
30
31
  {
31
32
  control,
33
+ disabled,
32
34
  name,
33
35
  render: ({
34
36
  field: { disabled: isDisabled, onChange, onBlur, value, ref }
@@ -76,4 +78,4 @@ export {
76
78
  Input_default,
77
79
  Input_default2
78
80
  };
79
- //# sourceMappingURL=chunk-3DMR7T4D.js.map
81
+ //# sourceMappingURL=chunk-2Z3YMYNN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Input/Input.tsx","../src/Input/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Controller } from 'react-hook-form';\n\nimport { Input as NextInput } from '@nextui-org/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface InputProps {\n /** CSS class name */\n className?: string;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label (set to false to disable label) */\n label?: string | false;\n /** form field name */\n name: string;\n /** form field placeholder */\n placeholder?: string;\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [NextUI Input](https://nextui.org/docs/components/input)\n */\nconst Input = ({\n className = undefined,\n disabled = false,\n endContent = undefined,\n label = undefined,\n name,\n placeholder = ' ',\n startContent = undefined,\n testId: _testId = undefined,\n type = undefined,\n}: InputProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={name}\n render={({\n field: { disabled: isDisabled, onChange, onBlur, value, ref },\n }) => {\n return (\n <NextInput\n className={cn(className)}\n classNames={{\n inputWrapper: 'group-data-[focus=true]:border-primary',\n }}\n data-testid={testId}\n endContent={endContent}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n <>\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </>\n }\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n placeholder={placeholder}\n radius=\"sm\"\n ref={ref}\n startContent={startContent}\n type={type}\n value={value}\n variant=\"bordered\"\n />\n );\n }}\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,kBAAkB;AAE3B,SAAS,SAAS,iBAAiB;AAEnC,SAAS,UAAU;AA4DgB,SAKrB,UALqB,KAKrB,YALqB;AA9BnC,IAAM,QAAQ,CAAC;AAAA,EACb,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd,eAAe;AAAA,EACf,QAAQ,UAAU;AAAA,EAClB,OAAO;AACT,MAAkB;AAChB,QAAM,EAAE,SAAS,cAAc,IAAI,eAAe;AAClD,QAAM,EAAE,OAAO,SAAS,UAAU,OAAO,IAAI,cAAc,MAAM,OAAO;AAExE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC;AAAA,QACP,OAAO,EAAE,UAAU,YAAY,UAAU,QAAQ,OAAO,IAAI;AAAA,MAC9D,MAAM;AACJ,eACE;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,SAAS;AAAA,YACvB,YAAY;AAAA,cACV,cAAc;AAAA,YAChB;AAAA,YACA,eAAa;AAAA,YACb;AAAA,YACA,cAAc,SAAS,oBAAC,gCAAqB,OAAc;AAAA,YAC3D;AAAA,YACA,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,OACE,iCACG;AAAA;AAAA,cACD,oBAAC,iCAAsB,QAAgB;AAAA,eACzC;AAAA,YAEF,gBAAe;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,QAAO;AAAA,YACP;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAQ;AAAA;AAAA,QACV;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;;;ACxFf,IAAOA,iBAAQ;","names":["Input_default"]}
@@ -0,0 +1,76 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkHT3LKDHXcjs = require('./chunk-HT3LKDHX.cjs');
4
+
5
+
6
+ var _chunkQTL5FREEcjs = require('./chunk-QTL5FREE.cjs');
7
+
8
+
9
+ var _chunkWQRM7G4Ccjs = require('./chunk-WQRM7G4C.cjs');
10
+
11
+ // src/TextArea/TextArea.tsx
12
+ var _reacthookform = require('react-hook-form');
13
+ var _input = require('@nextui-org/input');
14
+ var _pixelutils = require('@fuf-stack/pixel-utils');
15
+ var _jsxruntime = require('react/jsx-runtime');
16
+ var TextArea = ({
17
+ children = null,
18
+ className = void 0,
19
+ disabled = false,
20
+ label = void 0,
21
+ name,
22
+ placeholder = " ",
23
+ testId: _testId = void 0
24
+ }) => {
25
+ const { control, getFieldState } = _chunkWQRM7G4Ccjs.useFormContext.call(void 0, );
26
+ const { error, invalid, required, testId } = getFieldState(name, _testId);
27
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
28
+ _reacthookform.Controller,
29
+ {
30
+ control,
31
+ name,
32
+ disabled,
33
+ render: ({
34
+ field: { disabled: isDisabled, onChange, onBlur, value, ref }
35
+ }) => {
36
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
37
+ _input.Textarea,
38
+ {
39
+ className: _pixelutils.cn.call(void 0, className),
40
+ classNames: {
41
+ inputWrapper: "group-data-[focus=true]:border-primary"
42
+ },
43
+ "data-testid": testId,
44
+ errorMessage: error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQTL5FREEcjs.FieldValidationError_default, { error }),
45
+ isDisabled,
46
+ isRequired: required,
47
+ isInvalid: invalid,
48
+ label: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
49
+ label,
50
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHT3LKDHXcjs.FieldCopyTestIdButton_default, { testId })
51
+ ] }),
52
+ labelPlacement: "outside",
53
+ placeholder,
54
+ name,
55
+ value,
56
+ onChange,
57
+ onBlur,
58
+ ref,
59
+ variant: "bordered",
60
+ children
61
+ }
62
+ );
63
+ }
64
+ }
65
+ );
66
+ };
67
+ var TextArea_default = TextArea;
68
+
69
+ // src/TextArea/index.ts
70
+ var TextArea_default2 = TextArea_default;
71
+
72
+
73
+
74
+
75
+ exports.TextArea_default = TextArea_default; exports.TextArea_default2 = TextArea_default2;
76
+ //# sourceMappingURL=chunk-4IT2WVQK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/TextArea/TextArea.tsx","../src/TextArea/index.ts"],"names":["TextArea_default"],"mappings":";;;;;;;;;;;AAEA,SAAS,kBAAkB;AAE3B,SAAS,YAAY,oBAAoB;AAEzC,SAAS,UAAU;AAqDgB,SAKrB,UALqB,KAKrB,YALqB;AA3BnC,IAAM,WAAW,CAAC;AAAA,EAChB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd,QAAQ,UAAU;AACpB,MAAqB;AACnB,QAAM,EAAE,SAAS,cAAc,IAAI,eAAe;AAClD,QAAM,EAAE,OAAO,SAAS,UAAU,OAAO,IAAI,cAAc,MAAM,OAAO;AAExE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC;AAAA,QACP,OAAO,EAAE,UAAU,YAAY,UAAU,QAAQ,OAAO,IAAI;AAAA,MAC9D,MAAM;AACJ,eACE;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,SAAS;AAAA,YACvB,YAAY;AAAA,cACV,cAAc;AAAA,YAChB;AAAA,YACA,eAAa;AAAA,YACb,cAAc,SAAS,oBAAC,gCAAqB,OAAc;AAAA,YAC3D;AAAA,YACA,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OACE,iCACG;AAAA;AAAA,cACD,oBAAC,iCAAsB,QAAgB;AAAA,eACzC;AAAA,YAEF,gBAAe;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAQ;AAAA,YAEP;AAAA;AAAA,QACH;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,mBAAQ;;;AChFf,IAAOA,oBAAQ","sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Controller } from 'react-hook-form';\n\nimport { Textarea as NextTextArea } from '@nextui-org/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface TextAreaProps {\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [NextUI TextArea](https://nextui.org/docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className = undefined,\n disabled = false,\n label = undefined,\n name,\n placeholder = ' ',\n testId: _testId = undefined,\n}: TextAreaProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n return (\n <Controller\n control={control}\n name={name}\n disabled={disabled}\n render={({\n field: { disabled: isDisabled, onChange, onBlur, value, ref },\n }) => {\n return (\n <NextTextArea\n className={cn(className)}\n classNames={{\n inputWrapper: 'group-data-[focus=true]:border-primary',\n }}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isRequired={required}\n isInvalid={invalid}\n label={\n <>\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </>\n }\n labelPlacement=\"outside\"\n placeholder={placeholder}\n name={name}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n ref={ref}\n variant=\"bordered\"\n >\n {children}\n </NextTextArea>\n );\n }}\n />\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { TextArea };\n\nexport default TextArea;\n"]}
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-V46BHM2U.js";
7
7
 
8
8
  // src/SubmitButton/SubmitButton.tsx
9
- import cn from "classnames";
9
+ import { cn } from "@fuf-stack/pixel-utils";
10
10
  import { Button } from "@fuf-stack/pixels";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
  var SubmitButton = ({
@@ -45,4 +45,4 @@ export {
45
45
  SubmitButton_default,
46
46
  SubmitButton_default2
47
47
  };
48
- //# sourceMappingURL=chunk-TEJGV6NC.js.map
48
+ //# sourceMappingURL=chunk-5FMJUJ7H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SubmitButton/SubmitButton.tsx","../src/SubmitButton/index.ts"],"sourcesContent":["import type { ButtonProps } from '@fuf-stack/pixels';\nimport type { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\nimport { slugify } from '../helpers';\nimport { useFormContext } from '../hooks';\n\nexport interface SubmitButtonProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** color of the button */\n color?: ButtonProps['color'];\n /** If set loading animation is shown */\n loading?: boolean;\n /** function called when the button is pressed. */\n onClick?: ButtonProps['onClick'];\n /** size of the button */\n size?: ButtonProps['size'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * From SubmitButton\n */\nconst SubmitButton = ({\n children = 'Submit',\n className = undefined,\n color = 'success',\n loading = false,\n onClick = undefined,\n size = 'md',\n testId = 'form_submit_button',\n}: SubmitButtonProps) => {\n const {\n formState: { isValid, isSubmitting, isValidating },\n } = useFormContext();\n\n return (\n <Button\n className={cn(className)}\n color={color}\n testId={slugify(testId)}\n disabled={!isValid || isSubmitting || isValidating}\n loading={loading}\n onClick={onClick}\n size={size}\n type=\"submit\"\n >\n {children}\n </Button>\n );\n};\n\nexport default SubmitButton;\n","import SubmitButton from './SubmitButton';\n\nexport type { SubmitButtonProps } from './SubmitButton';\n\nexport { SubmitButton };\n\nexport default SubmitButton;\n"],"mappings":";;;;;;;;AAGA,SAAS,UAAU;AACnB,SAAS,cAAc;AAuCnB;AAdJ,IAAM,eAAe,CAAC;AAAA,EACpB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AACX,MAAyB;AACvB,QAAM;AAAA,IACJ,WAAW,EAAE,SAAS,cAAc,aAAa;AAAA,EACnD,IAAI,eAAe;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS;AAAA,MACvB;AAAA,MACA,QAAQ,QAAQ,MAAM;AAAA,MACtB,UAAU,CAAC,WAAW,gBAAgB;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MAEJ;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,uBAAQ;;;ACpDf,IAAOA,wBAAQ;","names":["SubmitButton_default"]}
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/Grid/Grid.tsx
2
- var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/Grid/Grid.tsx
2
+ var _pixelutils = require('@fuf-stack/pixel-utils');
3
3
  var _jsxruntime = require('react/jsx-runtime');
4
4
  var Grid = ({
5
5
  children = null,
6
6
  className = void 0,
7
7
  testId = void 0
8
8
  }) => {
9
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _classnames2.default.call(void 0, "grid gap-6", className), "data-testid": testId, children });
9
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _pixelutils.cn.call(void 0, "grid gap-6", className), "data-testid": testId, children });
10
10
  };
11
11
  var Grid_default = Grid;
12
12
 
@@ -17,4 +17,4 @@ var Grid_default2 = Grid_default;
17
17
 
18
18
 
19
19
  exports.Grid_default = Grid_default; exports.Grid_default2 = Grid_default2;
20
- //# sourceMappingURL=chunk-ZPFKVKGV.cjs.map
20
+ //# sourceMappingURL=chunk-6GN255GP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Grid/Grid.tsx","../src/Grid/index.ts"],"names":["Grid_default"],"mappings":";AAEA,SAAS,UAAU;AAoBf;AANJ,IAAM,OAAO,CAAC;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,SAAS;AACX,MAAiB;AACf,SACE,oBAAC,SAAI,WAAW,GAAG,cAAc,SAAS,GAAG,eAAa,QACvD,UACH;AAEJ;AAEA,IAAO,eAAQ;;;ACtBf,IAAOA,gBAAQ","sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nexport interface GridProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Defines the default grid for form components\n */\nconst Grid = ({\n children = null,\n className = undefined,\n testId = undefined,\n}: GridProps) => {\n return (\n <div className={cn('grid gap-6', className)} data-testid={testId}>\n {children}\n </div>\n );\n};\n\nexport default Grid;\n","import Grid from './Grid';\n\nexport type { GridProps } from './Grid';\n\nexport { Grid };\n\nexport default Grid;\n"]}
@@ -0,0 +1,76 @@
1
+ import {
2
+ FieldCopyTestIdButton_default
3
+ } from "./chunk-OV5RMSYD.js";
4
+ import {
5
+ FieldValidationError_default
6
+ } from "./chunk-DBLODROX.js";
7
+ import {
8
+ useFormContext
9
+ } from "./chunk-BCMPSLSG.js";
10
+
11
+ // src/TextArea/TextArea.tsx
12
+ import { Controller } from "react-hook-form";
13
+ import { Textarea as NextTextArea } from "@nextui-org/input";
14
+ import { cn } from "@fuf-stack/pixel-utils";
15
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
+ var TextArea = ({
17
+ children = null,
18
+ className = void 0,
19
+ disabled = false,
20
+ label = void 0,
21
+ name,
22
+ placeholder = " ",
23
+ testId: _testId = void 0
24
+ }) => {
25
+ const { control, getFieldState } = useFormContext();
26
+ const { error, invalid, required, testId } = getFieldState(name, _testId);
27
+ return /* @__PURE__ */ jsx(
28
+ Controller,
29
+ {
30
+ control,
31
+ name,
32
+ disabled,
33
+ render: ({
34
+ field: { disabled: isDisabled, onChange, onBlur, value, ref }
35
+ }) => {
36
+ return /* @__PURE__ */ jsx(
37
+ NextTextArea,
38
+ {
39
+ className: cn(className),
40
+ classNames: {
41
+ inputWrapper: "group-data-[focus=true]:border-primary"
42
+ },
43
+ "data-testid": testId,
44
+ errorMessage: error && /* @__PURE__ */ jsx(FieldValidationError_default, { error }),
45
+ isDisabled,
46
+ isRequired: required,
47
+ isInvalid: invalid,
48
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ label,
50
+ /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId })
51
+ ] }),
52
+ labelPlacement: "outside",
53
+ placeholder,
54
+ name,
55
+ value,
56
+ onChange,
57
+ onBlur,
58
+ ref,
59
+ variant: "bordered",
60
+ children
61
+ }
62
+ );
63
+ }
64
+ }
65
+ );
66
+ };
67
+ var TextArea_default = TextArea;
68
+
69
+ // src/TextArea/index.ts
70
+ var TextArea_default2 = TextArea_default;
71
+
72
+ export {
73
+ TextArea_default,
74
+ TextArea_default2
75
+ };
76
+ //# sourceMappingURL=chunk-6NZVSPFX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/TextArea/TextArea.tsx","../src/TextArea/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Controller } from 'react-hook-form';\n\nimport { Textarea as NextTextArea } from '@nextui-org/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface TextAreaProps {\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [NextUI TextArea](https://nextui.org/docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className = undefined,\n disabled = false,\n label = undefined,\n name,\n placeholder = ' ',\n testId: _testId = undefined,\n}: TextAreaProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n return (\n <Controller\n control={control}\n name={name}\n disabled={disabled}\n render={({\n field: { disabled: isDisabled, onChange, onBlur, value, ref },\n }) => {\n return (\n <NextTextArea\n className={cn(className)}\n classNames={{\n inputWrapper: 'group-data-[focus=true]:border-primary',\n }}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isRequired={required}\n isInvalid={invalid}\n label={\n <>\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </>\n }\n labelPlacement=\"outside\"\n placeholder={placeholder}\n name={name}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n ref={ref}\n variant=\"bordered\"\n >\n {children}\n </NextTextArea>\n );\n }}\n />\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { TextArea };\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,kBAAkB;AAE3B,SAAS,YAAY,oBAAoB;AAEzC,SAAS,UAAU;AAqDgB,SAKrB,UALqB,KAKrB,YALqB;AA3BnC,IAAM,WAAW,CAAC;AAAA,EAChB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd,QAAQ,UAAU;AACpB,MAAqB;AACnB,QAAM,EAAE,SAAS,cAAc,IAAI,eAAe;AAClD,QAAM,EAAE,OAAO,SAAS,UAAU,OAAO,IAAI,cAAc,MAAM,OAAO;AAExE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC;AAAA,QACP,OAAO,EAAE,UAAU,YAAY,UAAU,QAAQ,OAAO,IAAI;AAAA,MAC9D,MAAM;AACJ,eACE;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,SAAS;AAAA,YACvB,YAAY;AAAA,cACV,cAAc;AAAA,YAChB;AAAA,YACA,eAAa;AAAA,YACb,cAAc,SAAS,oBAAC,gCAAqB,OAAc;AAAA,YAC3D;AAAA,YACA,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OACE,iCACG;AAAA;AAAA,cACD,oBAAC,iCAAsB,QAAgB;AAAA,eACzC;AAAA,YAEF,gBAAe;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAQ;AAAA,YAEP;AAAA;AAAA,QACH;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,mBAAQ;;;AChFf,IAAOA,oBAAQ;","names":["TextArea_default"]}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
  var _chunkWQRM7G4Ccjs = require('./chunk-WQRM7G4C.cjs');
4
4
 
@@ -6,7 +6,7 @@ var _chunkWQRM7G4Ccjs = require('./chunk-WQRM7G4C.cjs');
6
6
  var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
7
7
 
8
8
  // src/SubmitButton/SubmitButton.tsx
9
- var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
9
+ var _pixelutils = require('@fuf-stack/pixel-utils');
10
10
  var _pixels = require('@fuf-stack/pixels');
11
11
  var _jsxruntime = require('react/jsx-runtime');
12
12
  var SubmitButton = ({
@@ -24,7 +24,7 @@ var SubmitButton = ({
24
24
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
25
25
  _pixels.Button,
26
26
  {
27
- className: _classnames2.default.call(void 0, className),
27
+ className: _pixelutils.cn.call(void 0, className),
28
28
  color,
29
29
  testId: _chunkBBB4FEY6cjs.slugify.call(void 0, testId),
30
30
  disabled: !isValid || isSubmitting || isValidating,
@@ -45,4 +45,4 @@ var SubmitButton_default2 = SubmitButton_default;
45
45
 
46
46
 
47
47
  exports.SubmitButton_default = SubmitButton_default; exports.SubmitButton_default2 = SubmitButton_default2;
48
- //# sourceMappingURL=chunk-XUKBLFTR.cjs.map
48
+ //# sourceMappingURL=chunk-AGAYQTFD.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SubmitButton/SubmitButton.tsx","../src/SubmitButton/index.ts"],"names":["SubmitButton_default"],"mappings":";;;;;;;;AAGA,SAAS,UAAU;AACnB,SAAS,cAAc;AAuCnB;AAdJ,IAAM,eAAe,CAAC;AAAA,EACpB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AACX,MAAyB;AACvB,QAAM;AAAA,IACJ,WAAW,EAAE,SAAS,cAAc,aAAa;AAAA,EACnD,IAAI,eAAe;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS;AAAA,MACvB;AAAA,MACA,QAAQ,QAAQ,MAAM;AAAA,MACtB,UAAU,CAAC,WAAW,gBAAgB;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MAEJ;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,uBAAQ;;;ACpDf,IAAOA,wBAAQ","sourcesContent":["import type { ButtonProps } from '@fuf-stack/pixels';\nimport type { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\nimport { slugify } from '../helpers';\nimport { useFormContext } from '../hooks';\n\nexport interface SubmitButtonProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** color of the button */\n color?: ButtonProps['color'];\n /** If set loading animation is shown */\n loading?: boolean;\n /** function called when the button is pressed. */\n onClick?: ButtonProps['onClick'];\n /** size of the button */\n size?: ButtonProps['size'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * From SubmitButton\n */\nconst SubmitButton = ({\n children = 'Submit',\n className = undefined,\n color = 'success',\n loading = false,\n onClick = undefined,\n size = 'md',\n testId = 'form_submit_button',\n}: SubmitButtonProps) => {\n const {\n formState: { isValid, isSubmitting, isValidating },\n } = useFormContext();\n\n return (\n <Button\n className={cn(className)}\n color={color}\n testId={slugify(testId)}\n disabled={!isValid || isSubmitting || isValidating}\n loading={loading}\n onClick={onClick}\n size={size}\n type=\"submit\"\n >\n {children}\n </Button>\n );\n};\n\nexport default SubmitButton;\n","import SubmitButton from './SubmitButton';\n\nexport type { SubmitButtonProps } from './SubmitButton';\n\nexport { SubmitButton };\n\nexport default SubmitButton;\n"]}
@@ -0,0 +1,205 @@
1
+ import {
2
+ FieldCopyTestIdButton_default
3
+ } from "./chunk-OV5RMSYD.js";
4
+ import {
5
+ FieldValidationError_default
6
+ } from "./chunk-DBLODROX.js";
7
+ import {
8
+ useFormContext
9
+ } from "./chunk-BCMPSLSG.js";
10
+ import {
11
+ slugify
12
+ } from "./chunk-V46BHM2U.js";
13
+
14
+ // src/RadioGroup/RadioGroup.tsx
15
+ import { Controller } from "react-hook-form";
16
+ import { ButtonGroup as NextButtonGroup } from "@nextui-org/button";
17
+ import { RadioGroup as NextRadioGroup, Radio } from "@nextui-org/radio";
18
+ import { cn as cn3 } from "@fuf-stack/pixel-utils";
19
+
20
+ // src/RadioGroup/Variants/RadioBox.tsx
21
+ import { useRadio } from "@nextui-org/radio";
22
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
23
+ import { cn } from "@fuf-stack/pixel-utils";
24
+ import { jsx, jsxs } from "react/jsx-runtime";
25
+ var RadioBox = ({ icon = void 0, ...props }) => {
26
+ const {
27
+ children,
28
+ Component,
29
+ description,
30
+ getBaseProps,
31
+ getControlProps,
32
+ getInputProps,
33
+ getLabelProps,
34
+ getLabelWrapperProps,
35
+ getWrapperProps,
36
+ isDisabled
37
+ } = useRadio(props);
38
+ return /* @__PURE__ */ jsxs(
39
+ Component,
40
+ {
41
+ ...getBaseProps(),
42
+ className: cn(
43
+ "group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-primary",
44
+ {
45
+ // disabled styles
46
+ "pointer-events-none opacity-disabled": isDisabled
47
+ }
48
+ ),
49
+ children: [
50
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", { ...getInputProps() }) }),
51
+ /* @__PURE__ */ jsx("span", { ...getWrapperProps(), children: /* @__PURE__ */ jsx("span", { ...getControlProps() }) }),
52
+ icon,
53
+ /* @__PURE__ */ jsxs(
54
+ "div",
55
+ {
56
+ ...getLabelWrapperProps(),
57
+ className: cn(getLabelWrapperProps().className, "grow"),
58
+ children: [
59
+ children && /* @__PURE__ */ jsx("span", { ...getLabelProps(), children }),
60
+ description && /* @__PURE__ */ jsx("span", { className: "text-small text-foreground opacity-70", children: description })
61
+ ]
62
+ }
63
+ )
64
+ ]
65
+ }
66
+ );
67
+ };
68
+
69
+ // src/RadioGroup/Variants/RadioButton.tsx
70
+ import { cn as cn2 } from "@fuf-stack/pixel-utils";
71
+ import { Button } from "@fuf-stack/pixels";
72
+ import { jsx as jsx2 } from "react/jsx-runtime";
73
+ var RadioButton = ({
74
+ className = void 0,
75
+ value,
76
+ isDisabled = false,
77
+ onChange,
78
+ children
79
+ }) => {
80
+ return /* @__PURE__ */ jsx2(
81
+ Button,
82
+ {
83
+ className: cn2(className),
84
+ disabled: isDisabled,
85
+ onClick: () => {
86
+ return onChange(value);
87
+ },
88
+ children
89
+ },
90
+ `index_${value}`
91
+ );
92
+ };
93
+
94
+ // src/RadioGroup/RadioGroup.tsx
95
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
96
+ var RadioGroup = ({
97
+ className = void 0,
98
+ disabled = false,
99
+ inline = false,
100
+ label = void 0,
101
+ name,
102
+ options,
103
+ testId: _testId = void 0,
104
+ variant = "default"
105
+ }) => {
106
+ const { control, getFieldState, getValues } = useFormContext();
107
+ const { error, invalid, required, testId } = getFieldState(name, _testId);
108
+ return /* @__PURE__ */ jsx3(
109
+ Controller,
110
+ {
111
+ control,
112
+ disabled,
113
+ name,
114
+ render: ({ field: { onChange, disabled: isDisabled, onBlur, ref } }) => {
115
+ let RadioComponents;
116
+ switch (variant) {
117
+ case "radioBox":
118
+ RadioComponents = options.map((option) => /* @__PURE__ */ jsx3(
119
+ RadioBox,
120
+ {
121
+ "data-testid": slugify(
122
+ `${testId}_option_${option.testId || option.value}`
123
+ ),
124
+ isDisabled: isDisabled || option.disabled,
125
+ value: option.value,
126
+ onChange,
127
+ description: option.description,
128
+ icon: option.icon,
129
+ children: option.label ? option.label : option.value
130
+ },
131
+ option.value
132
+ ));
133
+ break;
134
+ case "radioButton":
135
+ RadioComponents = options.map((option) => /* @__PURE__ */ jsx3(
136
+ RadioButton,
137
+ {
138
+ "data-testid": slugify(
139
+ `${testId}_option_${option.testId || option.value}`
140
+ ),
141
+ isDisabled: isDisabled || option.disabled,
142
+ value: option.value,
143
+ onChange,
144
+ className: cn3(
145
+ `${getValues()[name] !== option.value ? "bg-opacity-50" : ""}`
146
+ ),
147
+ children: option.label ? option.label : option.value
148
+ },
149
+ option.value
150
+ ));
151
+ break;
152
+ default:
153
+ RadioComponents = options.map((option) => /* @__PURE__ */ jsx3(
154
+ Radio,
155
+ {
156
+ "data-testid": slugify(
157
+ `${testId}_option_${option.testId || option.value}`
158
+ ),
159
+ isDisabled: isDisabled || option.disabled,
160
+ value: option.value,
161
+ onChange,
162
+ children: option.label ? option.label : option.value
163
+ },
164
+ option.value
165
+ ));
166
+ }
167
+ return /* @__PURE__ */ jsx3(
168
+ NextRadioGroup,
169
+ {
170
+ className,
171
+ "data-testid": testId,
172
+ errorMessage: error && /* @__PURE__ */ jsx3(FieldValidationError_default, { error }),
173
+ isDisabled,
174
+ isInvalid: invalid,
175
+ isRequired: required,
176
+ label: label && // eslint-disable-next-line jsx-a11y/label-has-associated-control
177
+ /* @__PURE__ */ jsxs2("label", { className: `${invalid ? "text-danger" : ""}`, children: [
178
+ label,
179
+ /* @__PURE__ */ jsx3(FieldCopyTestIdButton_default, { testId })
180
+ ] }),
181
+ orientation: inline ? "horizontal" : "vertical",
182
+ onBlur,
183
+ onChange,
184
+ name,
185
+ ref,
186
+ children: variant === "radioButton" ? (
187
+ // TODO: NextButtonGroup uses ref to modify Button style, but we wrap it, so it does not work at the moment.
188
+ /* @__PURE__ */ jsx3(NextButtonGroup, { children: RadioComponents })
189
+ ) : RadioComponents
190
+ }
191
+ );
192
+ }
193
+ }
194
+ );
195
+ };
196
+ var RadioGroup_default = RadioGroup;
197
+
198
+ // src/RadioGroup/index.ts
199
+ var RadioGroup_default2 = RadioGroup_default;
200
+
201
+ export {
202
+ RadioGroup_default,
203
+ RadioGroup_default2
204
+ };
205
+ //# sourceMappingURL=chunk-BIJVBXOG.js.map