@fuf-stack/uniform 0.4.0 → 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 (73) 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/Input/index.cjs +3 -3
  10. package/dist/Input/index.js +2 -2
  11. package/dist/RadioGroup/index.cjs +13 -0
  12. package/dist/RadioGroup/index.cjs.map +1 -0
  13. package/dist/RadioGroup/index.d.cts +7 -0
  14. package/dist/RadioGroup/index.d.ts +7 -0
  15. package/dist/RadioGroup/index.js +13 -0
  16. package/dist/RadioGroup/index.js.map +1 -0
  17. package/dist/RadioGroup-BU4K9cnS.d.cts +40 -0
  18. package/dist/RadioGroup-BU4K9cnS.d.ts +40 -0
  19. package/dist/Select/index.cjs +13 -0
  20. package/dist/Select/index.cjs.map +1 -0
  21. package/dist/Select/index.d.cts +8 -0
  22. package/dist/Select/index.d.ts +8 -0
  23. package/dist/Select/index.js +13 -0
  24. package/dist/Select/index.js.map +1 -0
  25. package/dist/Select-Mp6Y00dT.d.cts +40 -0
  26. package/dist/Select-Mp6Y00dT.d.ts +40 -0
  27. package/dist/Switch/index.cjs +13 -0
  28. package/dist/Switch/index.cjs.map +1 -0
  29. package/dist/Switch/index.d.cts +7 -0
  30. package/dist/Switch/index.d.ts +7 -0
  31. package/dist/Switch/index.js +13 -0
  32. package/dist/Switch/index.js.map +1 -0
  33. package/dist/Switch-DmjDKgKs.d.cts +20 -0
  34. package/dist/Switch-DmjDKgKs.d.ts +20 -0
  35. package/dist/TextArea/index.cjs +13 -0
  36. package/dist/TextArea/index.cjs.map +1 -0
  37. package/dist/TextArea/index.d.cts +8 -0
  38. package/dist/TextArea/index.d.ts +8 -0
  39. package/dist/TextArea/index.js +13 -0
  40. package/dist/TextArea/index.js.map +1 -0
  41. package/dist/TextArea-B-sKvTkd.d.cts +25 -0
  42. package/dist/TextArea-B-sKvTkd.d.ts +25 -0
  43. package/dist/{chunk-OYXZQOGU.js → chunk-2Z3YMYNN.js} +4 -4
  44. package/dist/chunk-4IT2WVQK.cjs +76 -0
  45. package/dist/chunk-4IT2WVQK.cjs.map +1 -0
  46. package/dist/chunk-6NZVSPFX.js +76 -0
  47. package/dist/chunk-6NZVSPFX.js.map +1 -0
  48. package/dist/chunk-BIJVBXOG.js +205 -0
  49. package/dist/chunk-BIJVBXOG.js.map +1 -0
  50. package/dist/chunk-CRKMTDKU.js +239 -0
  51. package/dist/chunk-CRKMTDKU.js.map +1 -0
  52. package/dist/chunk-EXYTFHEJ.js +81 -0
  53. package/dist/chunk-EXYTFHEJ.js.map +1 -0
  54. package/dist/chunk-I22ICCUC.cjs +205 -0
  55. package/dist/chunk-I22ICCUC.cjs.map +1 -0
  56. package/dist/chunk-I26DVRVR.js +287 -0
  57. package/dist/chunk-I26DVRVR.js.map +1 -0
  58. package/dist/chunk-NVJKXQ5W.cjs +239 -0
  59. package/dist/chunk-NVJKXQ5W.cjs.map +1 -0
  60. package/dist/chunk-OS4SMYPO.cjs +287 -0
  61. package/dist/chunk-OS4SMYPO.cjs.map +1 -0
  62. package/dist/{chunk-2CKPLOCK.cjs → chunk-VO7ZM3KY.cjs} +4 -4
  63. package/dist/chunk-XY7ZZARS.cjs +81 -0
  64. package/dist/chunk-XY7ZZARS.cjs.map +1 -0
  65. package/dist/hooks/index.d.cts +2 -2
  66. package/dist/hooks/index.d.ts +2 -2
  67. package/dist/index.cjs +24 -4
  68. package/dist/index.d.cts +7 -1
  69. package/dist/index.d.ts +7 -1
  70. package/dist/index.js +26 -6
  71. package/package.json +38 -13
  72. /package/dist/{chunk-OYXZQOGU.js.map → chunk-2Z3YMYNN.js.map} +0 -0
  73. /package/dist/{chunk-2CKPLOCK.cjs.map → chunk-VO7ZM3KY.cjs.map} +0 -0
@@ -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"]}
@@ -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"]}
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/RadioGroup/RadioGroup.tsx","../src/RadioGroup/Variants/RadioBox.tsx","../src/RadioGroup/Variants/RadioButton.tsx","../src/RadioGroup/index.ts"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react';\n\nimport { Controller } from 'react-hook-form';\n\nimport { ButtonGroup as NextButtonGroup } from '@nextui-org/button';\nimport { RadioGroup as NextRadioGroup, Radio } from '@nextui-org/radio';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { slugify } from '../helpers';\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\nimport { RadioBox } from './Variants/RadioBox';\nimport { RadioButton } from './Variants/RadioButton';\n\nexport interface RadioGroupOption {\n /** Description of the value. Works with variant radioBox. */\n description?: React.ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: React.ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string;\n}\n\nexport interface RadioGroupProps {\n /** CSS class name */\n className?: string;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioGroupOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioGroup should look like. */\n variant?: 'default' | 'radioBox' | 'radioButton';\n}\n\n/**\n * RadioGroup component based on [NextUI RadioGroup](https://nextui.org/docs/components/radio-group)\n */\nconst RadioGroup = ({\n className = undefined,\n disabled = false,\n inline = false,\n label = undefined,\n name,\n options,\n testId: _testId = undefined,\n variant = 'default',\n}: RadioGroupProps): ReactElement => {\n const { control, getFieldState, getValues } = useFormContext();\n\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={({ field: { onChange, disabled: isDisabled, onBlur, ref } }) => {\n let RadioComponents: ReactNode;\n switch (variant) {\n case 'radioBox':\n RadioComponents = options.map((option) => (\n <RadioBox\n key={option.value}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n isDisabled={isDisabled || option.disabled}\n value={option.value}\n onChange={onChange}\n description={option.description}\n icon={option.icon}\n >\n {option.label ? option.label : option.value}\n </RadioBox>\n ));\n break;\n case 'radioButton':\n RadioComponents = options.map((option) => (\n <RadioButton\n key={option.value}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n isDisabled={isDisabled || option.disabled}\n value={option.value}\n onChange={onChange}\n // TODO: how to do the classNames properly (make selected option darker with same color)\n className={cn(\n `${getValues()[name] !== option.value ? 'bg-opacity-50' : ''}`,\n )}\n >\n {option.label ? option.label : option.value}\n </RadioButton>\n ));\n break;\n default:\n RadioComponents = options.map((option) => (\n <Radio\n key={option.value}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n isDisabled={isDisabled || option.disabled}\n value={option.value}\n onChange={onChange}\n >\n {option.label ? option.label : option.value}\n </Radio>\n ));\n }\n\n return (\n <NextRadioGroup\n className={className}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n label && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label className={`${invalid ? 'text-danger' : ''}`}>\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )\n }\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n onChange={onChange}\n name={name}\n ref={ref}\n >\n {variant === 'radioButton' ? (\n // TODO: NextButtonGroup uses ref to modify Button style, but we wrap it, so it does not work at the moment.\n <NextButtonGroup>{RadioComponents}</NextButtonGroup>\n ) : (\n RadioComponents\n )}\n </NextRadioGroup>\n );\n }}\n />\n );\n};\n\nexport default RadioGroup;\n","import type { RadioProps as NextRadioProps } from '@nextui-org/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@nextui-org/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface RadioProps extends NextRadioProps {\n /** icon for the option */\n icon?: ReactNode;\n}\n\nexport const RadioBox = ({ icon = undefined, ...props }: RadioProps) => {\n const {\n children,\n Component,\n description,\n getBaseProps,\n getControlProps,\n getInputProps,\n getLabelProps,\n getLabelWrapperProps,\n getWrapperProps,\n isDisabled,\n } = useRadio(props);\n\n return (\n <Component\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(\n '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',\n {\n // disabled styles\n 'pointer-events-none opacity-disabled': isDisabled,\n },\n )}\n >\n <VisuallyHidden>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <input {...getInputProps()} />\n </VisuallyHidden>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <span {...getWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <span {...getControlProps()} />\n </span>\n {icon}\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getLabelWrapperProps()}\n className={cn(getLabelWrapperProps().className, 'grow')}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {children && <span {...getLabelProps()}>{children}</span>}\n {description && (\n <span className=\"text-small text-foreground opacity-70\">\n {description}\n </span>\n )}\n </div>\n </Component>\n );\n};\n\nexport default RadioBox;\n","import { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface RadioButtonProps {\n /** label of the value. */\n children: React.ReactNode;\n /** CSS class name */\n className?: string;\n /** disables the option */\n isDisabled?: boolean;\n /** Callback function. Executed if the option is clicked. */\n onChange: (...event: unknown[]) => void;\n /** value of the option. */\n value: string;\n}\n\nexport const RadioButton = ({\n className = undefined,\n value,\n isDisabled = false,\n onChange,\n children,\n}: RadioButtonProps) => {\n return (\n <Button\n key={`index_${value}`}\n className={cn(className)}\n disabled={isDisabled}\n onClick={() => {\n return onChange(value);\n }}\n >\n {children}\n </Button>\n );\n};\n\nexport default RadioButton;\n","import RadioGroup from './RadioGroup';\n\nexport type { RadioGroupProps } from './RadioGroup';\n\nexport { RadioGroup };\n\nexport default RadioGroup;\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAE3B,SAAS,eAAe,uBAAuB;AAC/C,SAAS,cAAc,gBAAgB,aAAa;AAEpD,SAAS,MAAAA,WAAU;;;ACJnB,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAE/B,SAAS,UAAU;AAmCX,cAQF,YARE;AA5BD,IAAM,WAAW,CAAC,EAAE,OAAO,QAAW,GAAG,MAAM,MAAkB;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,SAAS,KAAK;AAElB,SACE;AAAA,IAAC;AAAA;AAAA,MAEE,GAAG,aAAa;AAAA,MACjB,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA,UAEE,wCAAwC;AAAA,QAC1C;AAAA,MACF;AAAA,MAEA;AAAA,4BAAC,kBAEC,8BAAC,WAAO,GAAG,cAAc,GAAG,GAC9B;AAAA,QAEA,oBAAC,UAAM,GAAG,gBAAgB,GAExB,8BAAC,UAAM,GAAG,gBAAgB,GAAG,GAC/B;AAAA,QACC;AAAA,QACD;AAAA,UAAC;AAAA;AAAA,YAEE,GAAG,qBAAqB;AAAA,YACzB,WAAW,GAAG,qBAAqB,EAAE,WAAW,MAAM;AAAA,YAGrD;AAAA,0BAAY,oBAAC,UAAM,GAAG,cAAc,GAAI,UAAS;AAAA,cACjD,eACC,oBAAC,UAAK,WAAU,yCACb,uBACH;AAAA;AAAA;AAAA,QAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;;;AChEA,SAAS,MAAAC,WAAU;AACnB,SAAS,cAAc;AAuBnB,gBAAAC,YAAA;AARG,IAAM,cAAc,CAAC;AAAA,EAC1B,YAAY;AAAA,EACZ;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AACF,MAAwB;AACtB,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MAEC,WAAWD,IAAG,SAAS;AAAA,MACvB,UAAU;AAAA,MACV,SAAS,MAAM;AACb,eAAO,SAAS,KAAK;AAAA,MACvB;AAAA,MAEC;AAAA;AAAA,IAPI,SAAS,KAAK;AAAA,EAQrB;AAEJ;;;AF0Cc,gBAAAE,MA6DE,QAAAC,aA7DF;AAxBd,IAAM,aAAa,CAAC;AAAA,EAClB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ,UAAU;AAAA,EAClB,UAAU;AACZ,MAAqC;AACnC,QAAM,EAAE,SAAS,eAAe,UAAU,IAAI,eAAe;AAE7D,QAAM,EAAE,OAAO,SAAS,UAAU,OAAO,IAAI,cAAc,MAAM,OAAO;AAExE,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,UAAU,YAAY,QAAQ,IAAI,EAAE,MAAM;AACtE,YAAI;AACJ,gBAAQ,SAAS;AAAA,UACf,KAAK;AACH,8BAAkB,QAAQ,IAAI,CAAC,WAC7B,gBAAAA;AAAA,cAAC;AAAA;AAAA,gBAEC,eAAa;AAAA,kBACX,GAAG,MAAM,WAAW,OAAO,UAAU,OAAO,KAAK;AAAA,gBACnD;AAAA,gBACA,YAAY,cAAc,OAAO;AAAA,gBACjC,OAAO,OAAO;AAAA,gBACd;AAAA,gBACA,aAAa,OAAO;AAAA,gBACpB,MAAM,OAAO;AAAA,gBAEZ,iBAAO,QAAQ,OAAO,QAAQ,OAAO;AAAA;AAAA,cAVjC,OAAO;AAAA,YAWd,CACD;AACD;AAAA,UACF,KAAK;AACH,8BAAkB,QAAQ,IAAI,CAAC,WAC7B,gBAAAA;AAAA,cAAC;AAAA;AAAA,gBAEC,eAAa;AAAA,kBACX,GAAG,MAAM,WAAW,OAAO,UAAU,OAAO,KAAK;AAAA,gBACnD;AAAA,gBACA,YAAY,cAAc,OAAO;AAAA,gBACjC,OAAO,OAAO;AAAA,gBACd;AAAA,gBAEA,WAAWE;AAAA,kBACT,GAAG,UAAU,EAAE,IAAI,MAAM,OAAO,QAAQ,kBAAkB,EAAE;AAAA,gBAC9D;AAAA,gBAEC,iBAAO,QAAQ,OAAO,QAAQ,OAAO;AAAA;AAAA,cAZjC,OAAO;AAAA,YAad,CACD;AACD;AAAA,UACF;AACE,8BAAkB,QAAQ,IAAI,CAAC,WAC7B,gBAAAF;AAAA,cAAC;AAAA;AAAA,gBAEC,eAAa;AAAA,kBACX,GAAG,MAAM,WAAW,OAAO,UAAU,OAAO,KAAK;AAAA,gBACnD;AAAA,gBACA,YAAY,cAAc,OAAO;AAAA,gBACjC,OAAO,OAAO;AAAA,gBACd;AAAA,gBAEC,iBAAO,QAAQ,OAAO,QAAQ,OAAO;AAAA;AAAA,cARjC,OAAO;AAAA,YASd,CACD;AAAA,QACL;AAEA,eACE,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,eAAa;AAAA,YACb,cAAc,SAAS,gBAAAA,KAAC,gCAAqB,OAAc;AAAA,YAC3D;AAAA,YACA,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,OACE;AAAA,YAEE,gBAAAC,MAAC,WAAM,WAAW,GAAG,UAAU,gBAAgB,EAAE,IAC9C;AAAA;AAAA,cACD,gBAAAD,KAAC,iCAAsB,QAAgB;AAAA,eACzC;AAAA,YAGJ,aAAa,SAAS,eAAe;AAAA,YACrC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEC,sBAAY;AAAA;AAAA,cAEX,gBAAAA,KAAC,mBAAiB,2BAAgB;AAAA,gBAElC;AAAA;AAAA,QAEJ;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,qBAAQ;;;AG7Jf,IAAOG,sBAAQ;","names":["cn","cn","jsx","jsx","jsxs","cn","RadioGroup_default"]}
@@ -0,0 +1,239 @@
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/Select/Select.tsx
12
+ import { Controller } from "react-hook-form";
13
+ import ReactSelect, { components } from "react-select";
14
+ import { useSelect } from "@nextui-org/select";
15
+ import { cn, tv } from "@fuf-stack/pixel-utils";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ var InputComponent = (props) => {
18
+ const testId = `${props.selectProps["data-testid"]}_input`;
19
+ return /* @__PURE__ */ jsx(components.Input, { "data-testid": testId, ...props });
20
+ };
21
+ var OptionComponent = (props) => {
22
+ const testId = `${props.selectProps["data-testid"]}_option_${props?.data?.testId ?? props?.data?.value}`;
23
+ return /* @__PURE__ */ jsx("div", { "data-testid": testId, children: /* @__PURE__ */ jsx(components.Option, { ...props }) });
24
+ };
25
+ var DropdownIndicatorComponent = (props) => {
26
+ const testId = props?.selectProps["data-testid"];
27
+ return /* @__PURE__ */ jsx("div", { "data-testid": `${testId}_dropdown`, children: /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props }) });
28
+ };
29
+ var selectVariants = tv({
30
+ slots: {
31
+ clearIndicator: "rounded-md p-1 text-neutral-500 hover:cursor-pointer hover:bg-gray-200 hover:text-neutral-800 hover:dark:bg-default-200 hover:dark:text-default-500",
32
+ control: "rounded-lg border-2 border-gray-200 shadow-sm !duration-150 transition-background hover:border-gray-400 motion-reduce:transition-none dark:border-default-200 hover:dark:border-default-400 focus:dark:border-default-400",
33
+ crossIcon: "",
34
+ downChevron: "",
35
+ dropdownIndicator: "rounded-md p-1 text-neutral-500 hover:cursor-pointer hover:bg-gray-200 hover:text-black hover:dark:bg-default-200 hover:dark:text-default-500",
36
+ group: "",
37
+ groupHeading: "mb-1 ml-3 mt-2 text-sm text-neutral-500",
38
+ indicatorsContainer: "gap-1 p-1",
39
+ indicatorSeparator: "bg-gray-300 dark:bg-default-300",
40
+ input: "py-0.5 pl-1",
41
+ loadingIndicator: "",
42
+ loadingMessage: "",
43
+ menu: "mt-2 rounded-xl border border-gray-200 bg-default-50 p-1 shadow-sm dark:border-gray-900 dark:bg-default-50",
44
+ menuList: "",
45
+ // ensure menu has same z-index as modal so it is visible when rendered in modal
46
+ // see: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)
47
+ menuPortal: "!z-50",
48
+ multiValue: "items-center gap-1.5 rounded bg-gray-100 py-0.5 pl-2 pr-1 dark:bg-default-100",
49
+ multiValueContainer: "",
50
+ multiValueLabel: "py-0.5 leading-6",
51
+ multiValueRemove: "rounded text-neutral-500 hover:cursor-pointer hover:border-gray-300 hover:text-neutral-800 hover:dark:bg-default-200 hover:dark:text-default-500",
52
+ noOptionsMessage: "rounded-sm bg-gray-50 p-2 text-neutral-500 dark:bg-default-100",
53
+ option: "rounded px-3 py-2 hover:cursor-pointer",
54
+ placeholder: "py-0.5 pl-1 text-neutral-500",
55
+ selectContainer: "",
56
+ singleValue: "!ml-1 !leading-7",
57
+ valueContainer: "gap-1 p-1"
58
+ },
59
+ variants: {
60
+ invalid: {
61
+ true: {
62
+ control: "border-danger hover:border-danger dark:border-danger hover:dark:border-danger"
63
+ }
64
+ },
65
+ focused: {
66
+ true: {
67
+ option: "bg-gray-100 active:bg-gray-200 dark:bg-default-100 dark:active:bg-default-200"
68
+ }
69
+ },
70
+ optionSelected: {
71
+ true: { option: "bg-gray-300 dark:bg-default-300" }
72
+ }
73
+ }
74
+ });
75
+ var Select = ({
76
+ className = void 0,
77
+ clearable = true,
78
+ disabled = false,
79
+ filterOption = void 0,
80
+ inputValue = void 0,
81
+ label: _label = void 0,
82
+ loading = false,
83
+ multiSelect = false,
84
+ name,
85
+ onInputChange = void 0,
86
+ options,
87
+ placeholder = void 0,
88
+ testId: _testId = void 0
89
+ }) => {
90
+ const { control, getFieldState } = useFormContext();
91
+ const { error, invalid, required, testId } = getFieldState(name, _testId);
92
+ const {
93
+ label,
94
+ getLabelProps,
95
+ getTriggerProps,
96
+ getValueProps,
97
+ getHelperWrapperProps,
98
+ getErrorMessageProps
99
+ } = useSelect({
100
+ isLoading: loading,
101
+ isInvalid: invalid,
102
+ isRequired: required,
103
+ isDisabled: disabled,
104
+ errorMessage: JSON.stringify(error),
105
+ label: _label,
106
+ labelPlacement: "outside",
107
+ children: []
108
+ });
109
+ const {
110
+ clearIndicator: clearIndicatorSlot,
111
+ control: controlSlot,
112
+ dropdownIndicator: dropdownIndicatorSlot,
113
+ groupHeading: groupHeadingSlot,
114
+ indicatorsContainer: indicatorContainerSlot,
115
+ indicatorSeparator: indicatorSeparatorSlot,
116
+ input: inputSlot,
117
+ menu: menuSlot,
118
+ menuPortal: menuPortalSlot,
119
+ multiValue: multiValueSlot,
120
+ multiValueLabel: multiValueLabelSlot,
121
+ multiValueRemove: multiValueRemoveSlot,
122
+ noOptionsMessage: noOptionsMessageSlot,
123
+ option: optionSlot,
124
+ placeholder: placeholderSlot,
125
+ singleValue: singleValueSlot,
126
+ valueContainer: valueContainerSlot
127
+ } = selectVariants({ invalid });
128
+ return /* @__PURE__ */ jsx(
129
+ Controller,
130
+ {
131
+ control,
132
+ name,
133
+ render: ({
134
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
135
+ field: { onChange, value, ref, onBlur }
136
+ }) => /* @__PURE__ */ jsxs("div", { className: cn(className, "mt-2"), "data-testid": `${testId}_select`, children: [
137
+ label && /* @__PURE__ */ jsxs(
138
+ "label",
139
+ {
140
+ htmlFor: `react-select-${name}-input`,
141
+ className: `${getLabelProps().className} !pointer-events-auto !static -mb-1 ml-1`,
142
+ children: [
143
+ label,
144
+ /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId })
145
+ ]
146
+ }
147
+ ),
148
+ /* @__PURE__ */ jsx(
149
+ ReactSelect,
150
+ {
151
+ "aria-errormessage": "",
152
+ "aria-invalid": invalid,
153
+ "data-testid": `${testId}_select`,
154
+ ...() => {
155
+ const { className: _className, ...rest } = getTriggerProps();
156
+ return rest;
157
+ },
158
+ "aria-labelledby": getTriggerProps()["aria-labelledby"]?.split(" ")[1],
159
+ classNames: {
160
+ control: ({ isFocused }) => (
161
+ // border focus style
162
+ controlSlot({
163
+ className: !invalid && isFocused && "!border-primary"
164
+ })
165
+ ),
166
+ placeholder: () => placeholderSlot(),
167
+ input: () => inputSlot(),
168
+ valueContainer: () => valueContainerSlot(),
169
+ singleValue: () => singleValueSlot({
170
+ className: `${getValueProps().className}`
171
+ }),
172
+ multiValue: () => multiValueSlot(),
173
+ multiValueLabel: () => multiValueLabelSlot({
174
+ className: `${getValueProps().className}`
175
+ }),
176
+ multiValueRemove: () => multiValueRemoveSlot(),
177
+ indicatorsContainer: () => indicatorContainerSlot(),
178
+ clearIndicator: () => clearIndicatorSlot(),
179
+ indicatorSeparator: () => indicatorSeparatorSlot(),
180
+ dropdownIndicator: () => dropdownIndicatorSlot(),
181
+ menu: () => menuSlot(),
182
+ groupHeading: () => groupHeadingSlot(),
183
+ option: ({ isFocused, isSelected }) => optionSlot({
184
+ focused: isFocused,
185
+ optionSelected: isSelected
186
+ }),
187
+ noOptionsMessage: () => noOptionsMessageSlot(),
188
+ menuPortal: () => menuPortalSlot()
189
+ },
190
+ components: {
191
+ Input: InputComponent,
192
+ Option: OptionComponent,
193
+ DropdownIndicator: DropdownIndicatorComponent
194
+ },
195
+ filterOption,
196
+ instanceId: name,
197
+ inputValue,
198
+ isClearable: clearable,
199
+ isDisabled: disabled,
200
+ isLoading: loading,
201
+ isMulti: multiSelect,
202
+ options,
203
+ placeholder,
204
+ unstyled: true,
205
+ onChange: (option) => {
206
+ if (multiSelect) {
207
+ const transformedOptions = [];
208
+ option?.forEach((o) => {
209
+ transformedOptions.push(o.value);
210
+ });
211
+ onChange(transformedOptions);
212
+ } else {
213
+ onChange(option && option.value);
214
+ }
215
+ },
216
+ onInputChange,
217
+ menuPortalTarget: document.getElementById("modal_body")?.parentNode?.parentNode || document.body,
218
+ value: options.find((option) => option.value === value),
219
+ onBlur,
220
+ name,
221
+ ref
222
+ }
223
+ ),
224
+ error && // eslint-disable-next-line react/jsx-props-no-spreading
225
+ /* @__PURE__ */ jsx("div", { ...getHelperWrapperProps(), children: /* @__PURE__ */ jsx("div", { ...getErrorMessageProps(), children: /* @__PURE__ */ jsx(FieldValidationError_default, { error }) }) })
226
+ ] })
227
+ }
228
+ );
229
+ };
230
+ var Select_default = Select;
231
+
232
+ // src/Select/index.ts
233
+ var Select_default2 = Select_default;
234
+
235
+ export {
236
+ Select_default,
237
+ Select_default2
238
+ };
239
+ //# sourceMappingURL=chunk-CRKMTDKU.js.map