@fuf-stack/uniform 0.4.0 → 0.6.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 (114) 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.cjs.map +1 -1
  11. package/dist/Form/index.d.cts +2 -2
  12. package/dist/Form/index.d.ts +2 -2
  13. package/dist/Form/index.js +1 -1
  14. package/dist/{Form-Bv0R3QNk.d.cts → Form-nJbG1hNH.d.cts} +1 -1
  15. package/dist/{Form-Bv0R3QNk.d.ts → Form-nJbG1hNH.d.ts} +1 -1
  16. package/dist/Grid/index.cjs.map +1 -1
  17. package/dist/Input/index.cjs +3 -3
  18. package/dist/Input/index.cjs.map +1 -1
  19. package/dist/Input/index.js +2 -2
  20. package/dist/RadioGroup/index.cjs +13 -0
  21. package/dist/RadioGroup/index.cjs.map +1 -0
  22. package/dist/RadioGroup/index.d.cts +7 -0
  23. package/dist/RadioGroup/index.d.ts +7 -0
  24. package/dist/RadioGroup/index.js +13 -0
  25. package/dist/RadioGroup/index.js.map +1 -0
  26. package/dist/RadioGroup-BU4K9cnS.d.cts +40 -0
  27. package/dist/RadioGroup-BU4K9cnS.d.ts +40 -0
  28. package/dist/Select/index.cjs +13 -0
  29. package/dist/Select/index.cjs.map +1 -0
  30. package/dist/Select/index.d.cts +8 -0
  31. package/dist/Select/index.d.ts +8 -0
  32. package/dist/Select/index.js +13 -0
  33. package/dist/Select/index.js.map +1 -0
  34. package/dist/Select-Mp6Y00dT.d.cts +40 -0
  35. package/dist/Select-Mp6Y00dT.d.ts +40 -0
  36. package/dist/SubmitButton/index.cjs +2 -2
  37. package/dist/SubmitButton/index.cjs.map +1 -1
  38. package/dist/SubmitButton/index.js +1 -1
  39. package/dist/Switch/index.cjs +13 -0
  40. package/dist/Switch/index.cjs.map +1 -0
  41. package/dist/Switch/index.d.cts +7 -0
  42. package/dist/Switch/index.d.ts +7 -0
  43. package/dist/Switch/index.js +13 -0
  44. package/dist/Switch/index.js.map +1 -0
  45. package/dist/Switch-DmjDKgKs.d.cts +20 -0
  46. package/dist/Switch-DmjDKgKs.d.ts +20 -0
  47. package/dist/TextArea/index.cjs +13 -0
  48. package/dist/TextArea/index.cjs.map +1 -0
  49. package/dist/TextArea/index.d.cts +8 -0
  50. package/dist/TextArea/index.d.ts +8 -0
  51. package/dist/TextArea/index.js +13 -0
  52. package/dist/TextArea/index.js.map +1 -0
  53. package/dist/TextArea-B-sKvTkd.d.cts +25 -0
  54. package/dist/TextArea-B-sKvTkd.d.ts +25 -0
  55. package/dist/chunk-3K4JQTPQ.js +205 -0
  56. package/dist/chunk-3K4JQTPQ.js.map +1 -0
  57. package/dist/chunk-3SSUEUB5.js +81 -0
  58. package/dist/chunk-3SSUEUB5.js.map +1 -0
  59. package/dist/chunk-53AGVLUG.cjs +287 -0
  60. package/dist/chunk-53AGVLUG.cjs.map +1 -0
  61. package/dist/chunk-57OFVPRD.js +287 -0
  62. package/dist/chunk-57OFVPRD.js.map +1 -0
  63. package/dist/chunk-6GN255GP.cjs.map +1 -1
  64. package/dist/chunk-BBB4FEY6.cjs.map +1 -1
  65. package/dist/{chunk-OYXZQOGU.js → chunk-BGSQU5EH.js} +4 -4
  66. package/dist/{chunk-2CKPLOCK.cjs → chunk-FASB7HG3.cjs} +5 -5
  67. package/dist/chunk-FASB7HG3.cjs.map +1 -0
  68. package/dist/{chunk-BNTEIMNY.cjs → chunk-JFCOC5TW.cjs} +32 -25
  69. package/dist/chunk-JFCOC5TW.cjs.map +1 -0
  70. package/dist/chunk-JR7MAHBR.cjs +81 -0
  71. package/dist/chunk-JR7MAHBR.cjs.map +1 -0
  72. package/dist/chunk-KC3PZFGE.js +76 -0
  73. package/dist/chunk-KC3PZFGE.js.map +1 -0
  74. package/dist/{chunk-HT3LKDHX.cjs → chunk-KMMS4G7A.cjs} +4 -2
  75. package/dist/chunk-KMMS4G7A.cjs.map +1 -0
  76. package/dist/chunk-OSEU4ZUE.cjs +205 -0
  77. package/dist/chunk-OSEU4ZUE.cjs.map +1 -0
  78. package/dist/{chunk-5FMJUJ7H.js → chunk-QD6IQL6U.js} +3 -3
  79. package/dist/{chunk-5FMJUJ7H.js.map → chunk-QD6IQL6U.js.map} +1 -1
  80. package/dist/chunk-QTL5FREE.cjs.map +1 -1
  81. package/dist/{chunk-OV5RMSYD.js → chunk-T3CCNJHK.js} +4 -2
  82. package/dist/chunk-T3CCNJHK.js.map +1 -0
  83. package/dist/chunk-WNESYY6E.cjs +239 -0
  84. package/dist/chunk-WNESYY6E.cjs.map +1 -0
  85. package/dist/chunk-WQRM7G4C.cjs.map +1 -1
  86. package/dist/chunk-WRYE2CF5.cjs +76 -0
  87. package/dist/chunk-WRYE2CF5.cjs.map +1 -0
  88. package/dist/{chunk-AGAYQTFD.cjs → chunk-XJ3JTLXZ.cjs} +3 -3
  89. package/dist/chunk-XJ3JTLXZ.cjs.map +1 -0
  90. package/dist/{chunk-KFRKKWZT.js → chunk-Y4CFVCUN.js} +32 -25
  91. package/dist/chunk-Y4CFVCUN.js.map +1 -0
  92. package/dist/chunk-YAVU7ZYD.js +239 -0
  93. package/dist/chunk-YAVU7ZYD.js.map +1 -0
  94. package/dist/helpers/index.cjs.map +1 -1
  95. package/dist/hooks/index.cjs.map +1 -1
  96. package/dist/hooks/index.d.cts +1 -1
  97. package/dist/hooks/index.d.ts +1 -1
  98. package/dist/index.cjs +25 -5
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.d.cts +8 -2
  101. package/dist/index.d.ts +8 -2
  102. package/dist/index.js +26 -6
  103. package/dist/partials/FieldCopyTestIdButton/index.cjs +2 -2
  104. package/dist/partials/FieldCopyTestIdButton/index.cjs.map +1 -1
  105. package/dist/partials/FieldCopyTestIdButton/index.js +1 -1
  106. package/dist/partials/FieldValidationError/index.cjs.map +1 -1
  107. package/package.json +44 -19
  108. package/dist/chunk-2CKPLOCK.cjs.map +0 -1
  109. package/dist/chunk-AGAYQTFD.cjs.map +0 -1
  110. package/dist/chunk-BNTEIMNY.cjs.map +0 -1
  111. package/dist/chunk-HT3LKDHX.cjs.map +0 -1
  112. package/dist/chunk-KFRKKWZT.js.map +0 -1
  113. package/dist/chunk-OV5RMSYD.js.map +0 -1
  114. /package/dist/{chunk-OYXZQOGU.js.map → chunk-BGSQU5EH.js.map} +0 -0
@@ -7,18 +7,18 @@ import {
7
7
  } from "./chunk-V46BHM2U.js";
8
8
 
9
9
  // src/Form/Form.tsx
10
- import { useEffect as useEffect2 } from "react";
11
10
  import { useForm } from "react-hook-form";
12
11
  import { cn as cn2 } from "@fuf-stack/pixel-utils";
13
12
 
14
13
  // src/Form/subcomponents/FormDebugViewer.tsx
15
14
  import { useEffect, useState } from "react";
16
15
  import { FaTimes } from "react-icons/fa";
17
- import { FaBug } from "react-icons/fa6";
16
+ import { FaBug, FaBullseye } from "react-icons/fa6";
18
17
  import { cn } from "@fuf-stack/pixel-utils";
19
18
  import { Button, Card, Json, useLocalStorage } from "@fuf-stack/pixels";
20
19
  import { jsx, jsxs } from "react/jsx-runtime";
21
20
  var LOCALSTORAGE_DEBUG_KEY = "uniform:form-debug-enabled";
21
+ var LOCALSTORAGE_COPY_TEST_ID_KEY = "uniform:form-debug-copy-test-id-enabled";
22
22
  var FormDebugViewer = ({ className = void 0 }) => {
23
23
  const {
24
24
  watch,
@@ -26,6 +26,10 @@ var FormDebugViewer = ({ className = void 0 }) => {
26
26
  validation
27
27
  } = useFormContext();
28
28
  const [debug, setDebug] = useLocalStorage(LOCALSTORAGE_DEBUG_KEY, false);
29
+ const [copyTestId, setCopyTestId] = useLocalStorage(
30
+ LOCALSTORAGE_COPY_TEST_ID_KEY,
31
+ false
32
+ );
29
33
  const [validationErrors, setValidationErrors] = useState(null);
30
34
  const formValues = watch();
31
35
  useEffect(
@@ -53,7 +57,7 @@ var FormDebugViewer = ({ className = void 0 }) => {
53
57
  }
54
58
  );
55
59
  }
56
- return /* @__PURE__ */ jsx(
60
+ return /* @__PURE__ */ jsxs(
57
61
  Card,
58
62
  {
59
63
  className: cn(className),
@@ -69,18 +73,30 @@ var FormDebugViewer = ({ className = void 0 }) => {
69
73
  }
70
74
  )
71
75
  ] }),
72
- children: /* @__PURE__ */ jsx(
73
- Json,
74
- {
75
- value: {
76
- values: formValues,
77
- errors: validationErrors,
78
- dirtyFields,
79
- isValid,
80
- isSubmitting
76
+ children: [
77
+ /* @__PURE__ */ jsx(
78
+ Button,
79
+ {
80
+ variant: copyTestId ? "solid" : "light",
81
+ icon: /* @__PURE__ */ jsx(FaBullseye, {}),
82
+ className: "mb-4 ml-auto mr-auto",
83
+ onClick: () => setCopyTestId(!copyTestId),
84
+ children: copyTestId ? "Hide CopyButton" : "Show CopyButton"
81
85
  }
82
- }
83
- )
86
+ ),
87
+ /* @__PURE__ */ jsx(
88
+ Json,
89
+ {
90
+ value: {
91
+ values: formValues,
92
+ errors: validationErrors,
93
+ dirtyFields,
94
+ isValid,
95
+ isSubmitting
96
+ }
97
+ }
98
+ )
99
+ ]
84
100
  }
85
101
  );
86
102
  };
@@ -116,20 +132,11 @@ var Form = ({
116
132
  },
117
133
  // set rhf mode
118
134
  // see: https://react-hook-form.com/docs/useform#mode
119
- mode: validationTrigger === "all-instant" ? "all" : validationTrigger
135
+ mode: validationTrigger
120
136
  } : {
121
137
  defaultValues: initialValues
122
138
  }
123
139
  );
124
- useEffect2(
125
- () => {
126
- if (validationTrigger === "all-instant") {
127
- methods.trigger();
128
- }
129
- },
130
- // eslint-disable-next-line react-hooks/exhaustive-deps
131
- [validationTrigger]
132
- );
133
140
  return (
134
141
  // eslint-disable-next-line react/jsx-props-no-spreading
135
142
  /* @__PURE__ */ jsx2(FormContext_default, { ...methods, validation, children: /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-row justify-between gap-6", children: [
@@ -156,4 +163,4 @@ export {
156
163
  Form_default,
157
164
  Form_default2
158
165
  };
159
- //# sourceMappingURL=chunk-KFRKKWZT.js.map
166
+ //# sourceMappingURL=chunk-Y4CFVCUN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Form/Form.tsx","../src/Form/subcomponents/FormDebugViewer.tsx","../src/Form/index.ts"],"sourcesContent":["import type { VetoInstance } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\n\nimport { useForm } from 'react-hook-form';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { slugify } from '../helpers';\nimport FormProvider from './subcomponents/FormContext';\nimport FormDebugViewer from './subcomponents/FormDebugViewer';\n\n/**\n * recursively removes all fields that are null or undefined before\n * the form data is passed to the veto validation function\n */\nexport const removeNullishFields = (obj: Record<string, unknown>) => {\n return JSON.parse(\n JSON.stringify(obj, (_key, value) => {\n return value === null ? undefined : value;\n }),\n );\n};\n\nexport interface FormProps {\n /** form children */\n children: ReactNode | ReactNode[];\n /** CSS class name */\n className?: string | string[];\n /** initial form values */\n initialValues?: FieldValues;\n /** name of the form */\n name?: string;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** veto validation schema */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * Form component that has to wrap every uniform\n */\nconst Form = ({\n children,\n className = undefined,\n initialValues = undefined,\n name = undefined,\n onSubmit,\n testId = undefined,\n validation = undefined,\n validationTrigger = 'all',\n}: FormProps) => {\n const methods = useForm(\n validation\n ? {\n defaultValues: initialValues,\n resolver: async (values) => {\n const { data, errors, ...rest } = await validation.validateAsync(\n removeNullishFields(values),\n );\n // https://github.com/react-hook-form/resolvers/blob/master/zod/src/zod.ts\n return { values: data || {}, errors: errors || {}, ...rest };\n },\n // set rhf mode\n // see: https://react-hook-form.com/docs/useform#mode\n mode: validationTrigger,\n }\n : {\n defaultValues: initialValues,\n },\n );\n\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <FormProvider {...methods} validation={validation}>\n <div className=\"flex w-full flex-row justify-between gap-6\">\n <form\n className={cn('flex-grow', className)}\n data-testid={slugify(testId || name || '')}\n name={name}\n onSubmit={methods.handleSubmit(onSubmit)}\n >\n {children}\n </form>\n <FormDebugViewer className=\"w-96 flex-shrink\" />\n </div>\n </FormProvider>\n );\n};\n\nexport default Form;\n","import type { VetoError } from '@fuf-stack/veto';\n\nimport { useEffect, useState } from 'react';\nimport { FaTimes } from 'react-icons/fa';\nimport { FaBug, FaBullseye } from 'react-icons/fa6';\n\nimport { cn } from '@fuf-stack/pixel-utils';\nimport { Button, Card, Json, useLocalStorage } from '@fuf-stack/pixels';\n\nimport { useFormContext } from '../../hooks';\n\ninterface FormDebugViewerProps {\n /** CSS class name */\n className?: string;\n}\n\nconst LOCALSTORAGE_DEBUG_KEY = 'uniform:form-debug-enabled';\nconst LOCALSTORAGE_COPY_TEST_ID_KEY = 'uniform:form-debug-copy-test-id-enabled';\n\n/** Renders a form debug panel with information about the current form state */\nconst FormDebugViewer = ({ className = undefined }: FormDebugViewerProps) => {\n const {\n watch,\n formState: { dirtyFields, isValid, isSubmitting },\n validation,\n } = useFormContext();\n\n const [debug, setDebug] = useLocalStorage(LOCALSTORAGE_DEBUG_KEY, false);\n const [copyTestId, setCopyTestId] = useLocalStorage(\n LOCALSTORAGE_COPY_TEST_ID_KEY,\n false,\n );\n\n const [validationErrors, setValidationErrors] = useState<\n VetoError['errors'] | null\n >(null);\n\n const formValues = watch();\n\n useEffect(\n () => {\n const updateValidationErrors = async () => {\n if (validation) {\n const validateResult = await validation?.validateAsync(formValues);\n setValidationErrors(validateResult?.errors);\n }\n };\n updateValidationErrors();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [JSON.stringify(formValues)],\n );\n\n if (!debug) {\n return (\n <Button\n ariaLabel=\"Enable form debug mode\"\n onClick={() => setDebug(!debug)}\n className=\"absolute bottom-2.5 right-2.5 w-5 text-default-400\"\n variant=\"light\"\n icon={<FaBug />}\n />\n );\n }\n\n return (\n <Card\n className={cn(className)}\n header={\n <div className=\"flex w-full flex-row justify-between\">\n <span className=\"text-lg\">Debug Mode</span>\n <Button\n icon={<FaTimes className=\"text-danger\" />}\n onClick={() => setDebug(false)}\n size=\"sm\"\n variant=\"flat\"\n />\n </div>\n }\n >\n <Button\n variant={copyTestId ? 'solid' : 'light'}\n icon={<FaBullseye />}\n className=\"mb-4 ml-auto mr-auto\"\n onClick={() => setCopyTestId(!copyTestId)}\n >\n {copyTestId ? 'Hide CopyButton' : 'Show CopyButton'}\n </Button>\n <Json\n value={{\n values: formValues,\n errors: validationErrors,\n dirtyFields,\n isValid,\n isSubmitting,\n }}\n />\n </Card>\n );\n};\nexport default FormDebugViewer;\n","import Form from './Form';\n\nexport type { FormProps } from './Form';\n\nexport { Form };\n\nexport default Form;\n"],"mappings":";;;;;;;;;AAIA,SAAS,eAAe;AAExB,SAAS,MAAAA,WAAU;;;ACJnB,SAAS,WAAW,gBAAgB;AACpC,SAAS,eAAe;AACxB,SAAS,OAAO,kBAAkB;AAElC,SAAS,UAAU;AACnB,SAAS,QAAQ,MAAM,MAAM,uBAAuB;AAqDtC,cASN,YATM;AA5Cd,IAAM,yBAAyB;AAC/B,IAAM,gCAAgC;AAGtC,IAAM,kBAAkB,CAAC,EAAE,YAAY,OAAU,MAA4B;AAC3E,QAAM;AAAA,IACJ;AAAA,IACA,WAAW,EAAE,aAAa,SAAS,aAAa;AAAA,IAChD;AAAA,EACF,IAAI,eAAe;AAEnB,QAAM,CAAC,OAAO,QAAQ,IAA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Ff,IAAOG,gBAAQ;","names":["cn","jsx","jsxs","cn","Form_default"]}
@@ -0,0 +1,239 @@
1
+ import {
2
+ FieldCopyTestIdButton_default
3
+ } from "./chunk-T3CCNJHK.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-YAVU7ZYD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { Props } from 'react-select';\n\nimport { Controller } from 'react-hook-form';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@nextui-org/select';\n\nimport { cn, tv } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\ntype SelectOption = {\n /** option label */\n label?: React.ReactNode;\n /** option value */\n value: string;\n};\n\nexport interface SelectProps {\n /** CSS class name */\n className?: string; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: React.ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_input`;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_option_${props?.data?.testId ?? props?.data?.value}`;\n return (\n <div data-testid={testId}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_dropdown`}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\nexport const selectVariants = tv({\n slots: {\n clearIndicator:\n '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',\n control:\n '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',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n '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',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-neutral-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-gray-300 dark:bg-default-300',\n input: 'py-0.5 pl-1',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-gray-200 bg-default-50 p-1 shadow-sm dark:border-gray-900 dark:bg-default-50',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: '!z-50',\n multiValue:\n 'items-center gap-1.5 rounded bg-gray-100 py-0.5 pl-2 pr-1 dark:bg-default-100',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n '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',\n noOptionsMessage:\n 'rounded-sm bg-gray-50 p-2 text-neutral-500 dark:bg-default-100',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n placeholder: 'py-0.5 pl-1 text-neutral-500',\n selectContainer: '',\n singleValue: '!ml-1 !leading-7',\n valueContainer: 'gap-1 p-1',\n },\n variants: {\n invalid: {\n true: {\n control:\n 'border-danger hover:border-danger dark:border-danger hover:dark:border-danger',\n },\n },\n focused: {\n true: {\n option:\n 'bg-gray-100 active:bg-gray-200 dark:bg-default-100 dark:active:bg-default-200',\n },\n },\n optionSelected: {\n true: { option: 'bg-gray-300 dark:bg-default-300' },\n },\n },\n});\n\n/** Select component based on [NextUI Select](https://nextui.org/docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n disabled = false,\n filterOption = undefined,\n inputValue = undefined,\n label: _label = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n testId: _testId = undefined,\n}: SelectProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const {\n label,\n getLabelProps,\n getTriggerProps,\n getValueProps,\n getHelperWrapperProps,\n getErrorMessageProps,\n } = useSelect({\n isLoading: loading,\n isInvalid: invalid,\n isRequired: required,\n isDisabled: disabled,\n errorMessage: JSON.stringify(error),\n label: _label,\n labelPlacement: 'outside',\n children: [],\n });\n\n const {\n clearIndicator: clearIndicatorSlot,\n control: controlSlot,\n dropdownIndicator: dropdownIndicatorSlot,\n groupHeading: groupHeadingSlot,\n indicatorsContainer: indicatorContainerSlot,\n indicatorSeparator: indicatorSeparatorSlot,\n input: inputSlot,\n menu: menuSlot,\n menuPortal: menuPortalSlot,\n multiValue: multiValueSlot,\n multiValueLabel: multiValueLabelSlot,\n multiValueRemove: multiValueRemoveSlot,\n noOptionsMessage: noOptionsMessageSlot,\n option: optionSlot,\n placeholder: placeholderSlot,\n singleValue: singleValueSlot,\n valueContainer: valueContainerSlot,\n } = selectVariants({ invalid });\n\n return (\n <Controller\n control={control}\n name={name}\n render={({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n field: { onChange, value, ref, onBlur },\n }) => (\n <div className={cn(className, 'mt-2')} data-testid={`${testId}_select`}>\n {label && (\n <label\n htmlFor={`react-select-${name}-input`} // {getTriggerProps().id}\n className={`${getLabelProps().className} !pointer-events-auto !static -mb-1 ml-1`}\n >\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-invalid={invalid}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={`${testId}_select`}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention\n const { className: _className, ...rest } = getTriggerProps();\n return rest;\n }}\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n classNames={{\n control: ({ isFocused }) =>\n // border focus style\n controlSlot({\n className: !invalid && isFocused && '!border-primary',\n }),\n placeholder: () => placeholderSlot(),\n input: () => inputSlot(),\n valueContainer: () => valueContainerSlot(),\n singleValue: () =>\n singleValueSlot({\n className: `${getValueProps().className}`,\n }),\n multiValue: () => multiValueSlot(),\n multiValueLabel: () =>\n multiValueLabelSlot({\n className: `${getValueProps().className}`,\n }),\n multiValueRemove: () => multiValueRemoveSlot(),\n indicatorsContainer: () => indicatorContainerSlot(),\n clearIndicator: () => clearIndicatorSlot(),\n indicatorSeparator: () => indicatorSeparatorSlot(),\n dropdownIndicator: () => dropdownIndicatorSlot(),\n menu: () => menuSlot(),\n groupHeading: () => groupHeadingSlot(),\n option: ({ isFocused, isSelected }) =>\n optionSlot({\n focused: isFocused,\n optionSelected: isSelected,\n }),\n noOptionsMessage: () => noOptionsMessageSlot(),\n menuPortal: () => menuPortalSlot(),\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n }}\n filterOption={filterOption}\n instanceId={name}\n inputValue={inputValue}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n options={options}\n placeholder={placeholder}\n unstyled\n onChange={(option) => {\n if (multiSelect) {\n const transformedOptions: string[] = [];\n // @ts-expect-error in this case option is an array.\n option?.forEach((o: { value: string }) => {\n transformedOptions.push(o.value);\n });\n onChange(transformedOptions);\n } else {\n // @ts-expect-error in this case option is of type SelectOption and has the property value.\n onChange(option && option.value);\n }\n }}\n onInputChange={onInputChange}\n // attach menu modal or body so it works in card and modal\n menuPortalTarget={\n (document.getElementById('modal_body')?.parentNode\n ?.parentNode as HTMLElement) || document.body\n }\n value={options.find((option) => option.value === value)}\n onBlur={onBlur}\n name={name}\n ref={ref}\n />\n {error && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <div {...getHelperWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <div {...getErrorMessageProps()}>\n <FieldValidationError error={error} />\n </div>\n </div>\n )}\n </div>\n )}\n />\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC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""}
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/helpers/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B;AACE;AACF,4CAAC","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/helpers/index.cjs"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/hooks/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACF,uIAAC","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/hooks/index.cjs"}
@@ -19,7 +19,7 @@ declare const useFormContext: () => {
19
19
  validation: {
20
20
  schema: _fuf_stack_veto_dist_types_d_DhQiwhXl.a;
21
21
  validate: <InputType extends _fuf_stack_veto.VetoInput>(input: InputType) => _fuf_stack_veto.VetoError | _fuf_stack_veto.VetoSuccess<any>;
22
- validateAsync: <InputType_1 extends _fuf_stack_veto.VetoInput>(input: InputType_1) => Promise<_fuf_stack_veto.VetoError | _fuf_stack_veto.VetoSuccess<any>>;
22
+ validateAsync: <InputType extends _fuf_stack_veto.VetoInput>(input: InputType) => Promise<_fuf_stack_veto.VetoError | _fuf_stack_veto.VetoSuccess<any>>;
23
23
  } | undefined;
24
24
  formState: react_hook_form.FormState<react_hook_form.FieldValues>;
25
25
  watch: react_hook_form.UseFormWatch<react_hook_form.FieldValues>;
@@ -19,7 +19,7 @@ declare const useFormContext: () => {
19
19
  validation: {
20
20
  schema: _fuf_stack_veto_dist_types_d_DhQiwhXl.a;
21
21
  validate: <InputType extends _fuf_stack_veto.VetoInput>(input: InputType) => _fuf_stack_veto.VetoError | _fuf_stack_veto.VetoSuccess<any>;
22
- validateAsync: <InputType_1 extends _fuf_stack_veto.VetoInput>(input: InputType_1) => Promise<_fuf_stack_veto.VetoError | _fuf_stack_veto.VetoSuccess<any>>;
22
+ validateAsync: <InputType extends _fuf_stack_veto.VetoInput>(input: InputType) => Promise<_fuf_stack_veto.VetoError | _fuf_stack_veto.VetoSuccess<any>>;
23
23
  } | undefined;
24
24
  formState: react_hook_form.FormState<react_hook_form.FieldValues>;
25
25
  watch: react_hook_form.UseFormWatch<react_hook_form.FieldValues>;
package/dist/index.cjs CHANGED
@@ -1,18 +1,36 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkBNTEIMNYcjs = require('./chunk-BNTEIMNY.cjs');
3
+ var _chunkWRYE2CF5cjs = require('./chunk-WRYE2CF5.cjs');
4
+
5
+
6
+ var _chunkJR7MAHBRcjs = require('./chunk-JR7MAHBR.cjs');
7
+
8
+
9
+ var _chunk53AGVLUGcjs = require('./chunk-53AGVLUG.cjs');
10
+
11
+
12
+ var _chunkJFCOC5TWcjs = require('./chunk-JFCOC5TW.cjs');
4
13
 
5
14
 
6
15
  var _chunk6GN255GPcjs = require('./chunk-6GN255GP.cjs');
7
16
 
8
17
 
9
- var _chunk2CKPLOCKcjs = require('./chunk-2CKPLOCK.cjs');
18
+ var _chunkFASB7HG3cjs = require('./chunk-FASB7HG3.cjs');
19
+
20
+
21
+ var _chunkOSEU4ZUEcjs = require('./chunk-OSEU4ZUE.cjs');
22
+
23
+
24
+ var _chunkWNESYY6Ecjs = require('./chunk-WNESYY6E.cjs');
25
+
26
+
27
+ var _chunkKMMS4G7Acjs = require('./chunk-KMMS4G7A.cjs');
10
28
 
11
29
 
12
30
  var _chunkQTL5FREEcjs = require('./chunk-QTL5FREE.cjs');
13
31
 
14
32
 
15
- var _chunkAGAYQTFDcjs = require('./chunk-AGAYQTFD.cjs');
33
+ var _chunkXJ3JTLXZcjs = require('./chunk-XJ3JTLXZ.cjs');
16
34
 
17
35
 
18
36
 
@@ -22,7 +40,6 @@ var _chunkWQRM7G4Ccjs = require('./chunk-WQRM7G4C.cjs');
22
40
  var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
23
41
 
24
42
 
25
- var _chunkHT3LKDHXcjs = require('./chunk-HT3LKDHX.cjs');
26
43
 
27
44
 
28
45
 
@@ -33,5 +50,8 @@ var _chunkHT3LKDHXcjs = require('./chunk-HT3LKDHX.cjs');
33
50
 
34
51
 
35
52
 
36
- exports.FieldCopyTestIdButton = _chunkHT3LKDHXcjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkQTL5FREEcjs.FieldValidationError_default; exports.Form = _chunkBNTEIMNYcjs.Form_default; exports.Grid = _chunk6GN255GPcjs.Grid_default; exports.Input = _chunk2CKPLOCKcjs.Input_default; exports.SubmitButton = _chunkAGAYQTFDcjs.SubmitButton_default; exports.recursiveFieldKeySearch = _chunkWQRM7G4Ccjs.recursiveFieldKeySearch; exports.slugify = _chunkBBB4FEY6cjs.slugify; exports.useFormContext = _chunkWQRM7G4Ccjs.useFormContext;
53
+
54
+
55
+
56
+ exports.FieldArray = _chunk53AGVLUGcjs.FieldArray_default; exports.FieldCopyTestIdButton = _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkQTL5FREEcjs.FieldValidationError_default; exports.Form = _chunkJFCOC5TWcjs.Form_default; exports.Grid = _chunk6GN255GPcjs.Grid_default; exports.Input = _chunkFASB7HG3cjs.Input_default; exports.RadioGroup = _chunkOSEU4ZUEcjs.RadioGroup_default; exports.Select = _chunkWNESYY6Ecjs.Select_default; exports.SubmitButton = _chunkXJ3JTLXZcjs.SubmitButton_default; exports.Switch = _chunkJR7MAHBRcjs.Switch_default; exports.TextArea = _chunkWRYE2CF5cjs.TextArea_default; exports.recursiveFieldKeySearch = _chunkWQRM7G4Ccjs.recursiveFieldKeySearch; exports.slugify = _chunkBBB4FEY6cjs.slugify; exports.useFormContext = _chunkWQRM7G4Ccjs.useFormContext;
37
57
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,qzBAAC","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/index.cjs"}
package/dist/index.d.cts CHANGED
@@ -1,15 +1,21 @@
1
- export { F as Form, a as FormProps } from './Form-Bv0R3QNk.cjs';
1
+ export { F as FieldArray, c as FieldArrayFieldChildren, b as FieldArrayHideOption, a as FieldArrayProps } from './FieldArray-DUvn98Fe.cjs';
2
+ export { F as Form, a as FormProps } from './Form-nJbG1hNH.cjs';
2
3
  export { G as Grid, a as GridProps } from './Grid-DF3L9NF3.cjs';
3
4
  export { slugify } from './helpers/index.cjs';
4
5
  export { recursiveFieldKeySearch, useFormContext } from './hooks/index.cjs';
5
6
  export { I as Input, a as InputProps } from './Input-B6dNQiiD.cjs';
6
7
  export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-D-z1usqE.cjs';
7
8
  export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-BSXedjCA.cjs';
9
+ export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-BU4K9cnS.cjs';
10
+ export { S as Select, a as SelectProps } from './Select-Mp6Y00dT.cjs';
8
11
  export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-BEp_zzwf.cjs';
12
+ export { S as Switch, a as SwitchProps } from './Switch-DmjDKgKs.cjs';
13
+ export { T as TextArea, a as TextAreaProps } from './TextArea-B-sKvTkd.cjs';
9
14
  import 'react/jsx-runtime';
15
+ import 'react-hook-form';
10
16
  import '@fuf-stack/veto';
11
17
  import 'react';
12
- import 'react-hook-form';
13
18
  import 'slug';
14
19
  import '@fuf-stack/veto/dist/types.d-DhQiwhXl';
20
+ import 'react-select';
15
21
  import '@fuf-stack/pixels';
package/dist/index.d.ts CHANGED
@@ -1,15 +1,21 @@
1
- export { F as Form, a as FormProps } from './Form-Bv0R3QNk.js';
1
+ export { F as FieldArray, c as FieldArrayFieldChildren, b as FieldArrayHideOption, a as FieldArrayProps } from './FieldArray-DUvn98Fe.js';
2
+ export { F as Form, a as FormProps } from './Form-nJbG1hNH.js';
2
3
  export { G as Grid, a as GridProps } from './Grid-DF3L9NF3.js';
3
4
  export { slugify } from './helpers/index.js';
4
5
  export { recursiveFieldKeySearch, useFormContext } from './hooks/index.js';
5
6
  export { I as Input, a as InputProps } from './Input-B6dNQiiD.js';
6
7
  export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-D-z1usqE.js';
7
8
  export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-BSXedjCA.js';
9
+ export { R as RadioGroup, a as RadioGroupProps } from './RadioGroup-BU4K9cnS.js';
10
+ export { S as Select, a as SelectProps } from './Select-Mp6Y00dT.js';
8
11
  export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-BEp_zzwf.js';
12
+ export { S as Switch, a as SwitchProps } from './Switch-DmjDKgKs.js';
13
+ export { T as TextArea, a as TextAreaProps } from './TextArea-B-sKvTkd.js';
9
14
  import 'react/jsx-runtime';
15
+ import 'react-hook-form';
10
16
  import '@fuf-stack/veto';
11
17
  import 'react';
12
- import 'react-hook-form';
13
18
  import 'slug';
14
19
  import '@fuf-stack/veto/dist/types.d-DhQiwhXl';
20
+ import 'react-select';
15
21
  import '@fuf-stack/pixels';
package/dist/index.js CHANGED
@@ -1,18 +1,36 @@
1
+ import {
2
+ TextArea_default
3
+ } from "./chunk-KC3PZFGE.js";
4
+ import {
5
+ Switch_default
6
+ } from "./chunk-3SSUEUB5.js";
7
+ import {
8
+ FieldArray_default
9
+ } from "./chunk-57OFVPRD.js";
1
10
  import {
2
11
  Form_default
3
- } from "./chunk-KFRKKWZT.js";
12
+ } from "./chunk-Y4CFVCUN.js";
4
13
  import {
5
14
  Grid_default
6
15
  } from "./chunk-PDCEKC3G.js";
7
16
  import {
8
17
  Input_default
9
- } from "./chunk-OYXZQOGU.js";
18
+ } from "./chunk-BGSQU5EH.js";
19
+ import {
20
+ RadioGroup_default
21
+ } from "./chunk-3K4JQTPQ.js";
22
+ import {
23
+ Select_default
24
+ } from "./chunk-YAVU7ZYD.js";
25
+ import {
26
+ FieldCopyTestIdButton_default
27
+ } from "./chunk-T3CCNJHK.js";
10
28
  import {
11
29
  FieldValidationError_default
12
30
  } from "./chunk-DBLODROX.js";
13
31
  import {
14
32
  SubmitButton_default
15
- } from "./chunk-5FMJUJ7H.js";
33
+ } from "./chunk-QD6IQL6U.js";
16
34
  import {
17
35
  recursiveFieldKeySearch,
18
36
  useFormContext
@@ -20,16 +38,18 @@ import {
20
38
  import {
21
39
  slugify
22
40
  } from "./chunk-V46BHM2U.js";
23
- import {
24
- FieldCopyTestIdButton_default
25
- } from "./chunk-OV5RMSYD.js";
26
41
  export {
42
+ FieldArray_default as FieldArray,
27
43
  FieldCopyTestIdButton_default as FieldCopyTestIdButton,
28
44
  FieldValidationError_default as FieldValidationError,
29
45
  Form_default as Form,
30
46
  Grid_default as Grid,
31
47
  Input_default as Input,
48
+ RadioGroup_default as RadioGroup,
49
+ Select_default as Select,
32
50
  SubmitButton_default as SubmitButton,
51
+ Switch_default as Switch,
52
+ TextArea_default as TextArea,
33
53
  recursiveFieldKeySearch,
34
54
  slugify,
35
55
  useFormContext
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkHT3LKDHXcjs = require('../../chunk-HT3LKDHX.cjs');
4
+ var _chunkKMMS4G7Acjs = require('../../chunk-KMMS4G7A.cjs');
5
5
 
6
6
 
7
7
 
8
- exports.FieldCopyTestIdButton = _chunkHT3LKDHXcjs.FieldCopyTestIdButton_default; exports.default = _chunkHT3LKDHXcjs.FieldCopyTestIdButton_default2;
8
+ exports.FieldCopyTestIdButton = _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default; exports.default = _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default2;
9
9
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/partials/FieldCopyTestIdButton/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,4DAAiC;AACjC;AACE;AACA;AACF,oJAAC","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/partials/FieldCopyTestIdButton/index.cjs"}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FieldCopyTestIdButton_default,
3
3
  FieldCopyTestIdButton_default2
4
- } from "../../chunk-OV5RMSYD.js";
4
+ } from "../../chunk-T3CCNJHK.js";
5
5
  export {
6
6
  FieldCopyTestIdButton_default as FieldCopyTestIdButton,
7
7
  FieldCopyTestIdButton_default2 as default
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/partials/FieldValidationError/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,4DAAiC;AACjC,oCAAiC;AACjC;AACE;AACA;AACF,iJAAC","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/partials/FieldValidationError/index.cjs"}