@fuf-stack/uniform 0.14.5 → 0.15.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 (147) hide show
  1. package/dist/CheckboxGroup/index.cjs +7 -6
  2. package/dist/CheckboxGroup/index.cjs.map +1 -1
  3. package/dist/CheckboxGroup/index.js +6 -5
  4. package/dist/Controller/index.cjs +4 -2
  5. package/dist/Controller/index.cjs.map +1 -1
  6. package/dist/Controller/index.d.cts +7 -3
  7. package/dist/Controller/index.d.ts +7 -3
  8. package/dist/Controller/index.js +7 -5
  9. package/dist/Controller-8Nqugui5.d.cts +37 -0
  10. package/dist/Controller-8Nqugui5.d.ts +37 -0
  11. package/dist/FieldArray/index.cjs +6 -5
  12. package/dist/FieldArray/index.cjs.map +1 -1
  13. package/dist/FieldArray/index.d.cts +5 -3
  14. package/dist/FieldArray/index.d.ts +5 -3
  15. package/dist/FieldArray/index.js +5 -4
  16. package/dist/FieldArray-AqM2XKIh.d.cts +151 -0
  17. package/dist/FieldArray-AqM2XKIh.d.ts +151 -0
  18. package/dist/Form/index.cjs +5 -4
  19. package/dist/Form/index.cjs.map +1 -1
  20. package/dist/Form/index.js +4 -3
  21. package/dist/Grid/index.cjs +1 -0
  22. package/dist/Grid/index.cjs.map +1 -1
  23. package/dist/Grid/index.js +1 -0
  24. package/dist/Input/index.cjs +7 -6
  25. package/dist/Input/index.cjs.map +1 -1
  26. package/dist/Input/index.js +6 -5
  27. package/dist/RadioGroup/index.cjs +7 -6
  28. package/dist/RadioGroup/index.cjs.map +1 -1
  29. package/dist/RadioGroup/index.js +6 -5
  30. package/dist/Select/index.cjs +7 -6
  31. package/dist/Select/index.cjs.map +1 -1
  32. package/dist/Select/index.js +6 -5
  33. package/dist/SubmitButton/index.cjs +5 -4
  34. package/dist/SubmitButton/index.cjs.map +1 -1
  35. package/dist/SubmitButton/index.js +4 -3
  36. package/dist/Switch/index.cjs +7 -6
  37. package/dist/Switch/index.cjs.map +1 -1
  38. package/dist/Switch/index.js +6 -5
  39. package/dist/TextArea/index.cjs +7 -6
  40. package/dist/TextArea/index.cjs.map +1 -1
  41. package/dist/TextArea/index.js +6 -5
  42. package/dist/{chunk-DDZMDOSG.js → chunk-2LAPLELO.js} +21 -17
  43. package/dist/{chunk-DDZMDOSG.js.map → chunk-2LAPLELO.js.map} +1 -1
  44. package/dist/chunk-2NSCPLAA.cjs +133 -0
  45. package/dist/chunk-2NSCPLAA.cjs.map +1 -0
  46. package/dist/{chunk-QW44EUAH.js → chunk-3Q37222E.js} +8 -8
  47. package/dist/{chunk-QW44EUAH.js.map → chunk-3Q37222E.js.map} +1 -1
  48. package/dist/chunk-4AXNPSXG.cjs +82 -0
  49. package/dist/chunk-4AXNPSXG.cjs.map +1 -0
  50. package/dist/chunk-4DAZAO6Y.cjs +59 -0
  51. package/dist/chunk-4DAZAO6Y.cjs.map +1 -0
  52. package/dist/chunk-4EJS5FXY.js +51 -0
  53. package/dist/chunk-4EJS5FXY.js.map +1 -0
  54. package/dist/chunk-4EP3IGSK.cjs +372 -0
  55. package/dist/chunk-4EP3IGSK.cjs.map +1 -0
  56. package/dist/{chunk-Y3SFF6RN.cjs → chunk-4M6F2O2K.cjs} +10 -9
  57. package/dist/chunk-4M6F2O2K.cjs.map +1 -0
  58. package/dist/{chunk-BYKOCVCK.js → chunk-7HK64PN5.js} +19 -15
  59. package/dist/{chunk-BYKOCVCK.js.map → chunk-7HK64PN5.js.map} +1 -1
  60. package/dist/{chunk-OHJYXA6R.cjs → chunk-C4RM2JSD.cjs} +3 -3
  61. package/dist/{chunk-OHJYXA6R.cjs.map → chunk-C4RM2JSD.cjs.map} +1 -1
  62. package/dist/chunk-CRTRMMJ7.js +59 -0
  63. package/dist/chunk-CRTRMMJ7.js.map +1 -0
  64. package/dist/{chunk-EKE5URXQ.cjs → chunk-F6KTQXWG.cjs} +15 -12
  65. package/dist/chunk-F6KTQXWG.cjs.map +1 -0
  66. package/dist/{chunk-XCZKNTFT.cjs → chunk-FLX6VIO7.cjs} +23 -19
  67. package/dist/chunk-FLX6VIO7.cjs.map +1 -0
  68. package/dist/chunk-IEF2GJ22.js +82 -0
  69. package/dist/chunk-IEF2GJ22.js.map +1 -0
  70. package/dist/chunk-K43U2JVG.cjs +248 -0
  71. package/dist/chunk-K43U2JVG.cjs.map +1 -0
  72. package/dist/{chunk-XJZAS7NG.cjs → chunk-MF4JB3YT.cjs} +25 -21
  73. package/dist/chunk-MF4JB3YT.cjs.map +1 -0
  74. package/dist/{chunk-BZAPTLMC.js → chunk-MRXNKY72.js} +49 -49
  75. package/dist/chunk-MRXNKY72.js.map +1 -0
  76. package/dist/chunk-OBQDQ4RX.js +372 -0
  77. package/dist/chunk-OBQDQ4RX.js.map +1 -0
  78. package/dist/{chunk-VP7WDLJM.js → chunk-P4PRVNCH.js} +17 -13
  79. package/dist/chunk-P4PRVNCH.js.map +1 -0
  80. package/dist/{chunk-PZ4LZQI4.cjs → chunk-QLQR44AD.cjs} +19 -15
  81. package/dist/chunk-QLQR44AD.cjs.map +1 -0
  82. package/dist/{chunk-QCVTB2NI.js → chunk-U26GTLKF.js} +8 -7
  83. package/dist/{chunk-QCVTB2NI.js.map → chunk-U26GTLKF.js.map} +1 -1
  84. package/dist/{chunk-GN5NJ6ZU.js → chunk-UJYXA5AD.js} +3 -3
  85. package/dist/chunk-V5HTEMWZ.cjs +51 -0
  86. package/dist/chunk-V5HTEMWZ.cjs.map +1 -0
  87. package/dist/{chunk-VZ5MMFIF.cjs → chunk-V7LRZ5GK.cjs} +5 -5
  88. package/dist/{chunk-VZ5MMFIF.cjs.map → chunk-V7LRZ5GK.cjs.map} +1 -1
  89. package/dist/{chunk-WKM2D7LF.js → chunk-VX76MJAI.js} +2 -2
  90. package/dist/chunk-W66BVPTB.js +248 -0
  91. package/dist/{chunk-IUNDGVMC.js.map → chunk-W66BVPTB.js.map} +1 -1
  92. package/dist/{chunk-BS52M4SZ.js → chunk-WAXJ64P7.js} +14 -11
  93. package/dist/chunk-WAXJ64P7.js.map +1 -0
  94. package/dist/{chunk-RBIX6EWU.cjs → chunk-Y4AUJ2YA.cjs} +10 -10
  95. package/dist/chunk-Y4AUJ2YA.cjs.map +1 -0
  96. package/dist/helpers/index.cjs +11 -2
  97. package/dist/helpers/index.cjs.map +1 -1
  98. package/dist/helpers/index.d.cts +68 -1
  99. package/dist/helpers/index.d.ts +68 -1
  100. package/dist/helpers/index.js +12 -3
  101. package/dist/hooks/index.cjs +6 -3
  102. package/dist/hooks/index.cjs.map +1 -1
  103. package/dist/hooks/index.d.cts +3 -2
  104. package/dist/hooks/index.d.ts +3 -2
  105. package/dist/hooks/index.js +7 -4
  106. package/dist/index.cjs +26 -15
  107. package/dist/index.cjs.map +1 -1
  108. package/dist/index.d.cts +5 -3
  109. package/dist/index.d.ts +5 -3
  110. package/dist/index.js +31 -20
  111. package/dist/partials/FieldCopyTestIdButton/index.cjs +1 -0
  112. package/dist/partials/FieldCopyTestIdButton/index.cjs.map +1 -1
  113. package/dist/partials/FieldCopyTestIdButton/index.js +1 -0
  114. package/dist/partials/FieldValidationError/index.cjs +4 -3
  115. package/dist/partials/FieldValidationError/index.cjs.map +1 -1
  116. package/dist/partials/FieldValidationError/index.js +3 -2
  117. package/package.json +17 -17
  118. package/dist/FieldArray-DD9z-xZ3.d.cts +0 -37
  119. package/dist/FieldArray-DD9z-xZ3.d.ts +0 -37
  120. package/dist/chunk-BBB4FEY6.cjs +0 -22
  121. package/dist/chunk-BBB4FEY6.cjs.map +0 -1
  122. package/dist/chunk-BS52M4SZ.js.map +0 -1
  123. package/dist/chunk-BZAPTLMC.js.map +0 -1
  124. package/dist/chunk-EKE5URXQ.cjs.map +0 -1
  125. package/dist/chunk-HOETR36J.cjs +0 -299
  126. package/dist/chunk-HOETR36J.cjs.map +0 -1
  127. package/dist/chunk-HZP3EXGR.cjs +0 -241
  128. package/dist/chunk-HZP3EXGR.cjs.map +0 -1
  129. package/dist/chunk-IUNDGVMC.js +0 -241
  130. package/dist/chunk-KOKIM2ND.js +0 -9
  131. package/dist/chunk-KOKIM2ND.js.map +0 -1
  132. package/dist/chunk-PZ4LZQI4.cjs.map +0 -1
  133. package/dist/chunk-RBIX6EWU.cjs.map +0 -1
  134. package/dist/chunk-V46BHM2U.js +0 -22
  135. package/dist/chunk-V46BHM2U.js.map +0 -1
  136. package/dist/chunk-VP7WDLJM.js.map +0 -1
  137. package/dist/chunk-VQWKXSHW.cjs +0 -9
  138. package/dist/chunk-VQWKXSHW.cjs.map +0 -1
  139. package/dist/chunk-XCZKNTFT.cjs.map +0 -1
  140. package/dist/chunk-XJWEUCV3.cjs +0 -133
  141. package/dist/chunk-XJWEUCV3.cjs.map +0 -1
  142. package/dist/chunk-XJZAS7NG.cjs.map +0 -1
  143. package/dist/chunk-Y3SFF6RN.cjs.map +0 -1
  144. package/dist/chunk-Y53IHK6B.js +0 -299
  145. package/dist/chunk-Y53IHK6B.js.map +0 -1
  146. /package/dist/{chunk-GN5NJ6ZU.js.map → chunk-UJYXA5AD.js.map} +0 -0
  147. /package/dist/{chunk-WKM2D7LF.js.map → chunk-VX76MJAI.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-K43U2JVG.cjs","../src/Select/Select.tsx","../src/Select/index.ts"],"names":["Select_default"],"mappings":"AAAA;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;AACA;ACjBA,8BAAyB;AACzB,qGAAwC;AAExC,4CAA0B;AAE1B,oDAA6C;AAmGpC,+CAAA;AA3FF,IAAM,eAAA,EAAiB,4BAAA;AAAG,EAC/B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,cAAA,EACE,wGAAA;AAAA,IACF,OAAA,EACE,yNAAA;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A;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AAIA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AACE,oBAAA;AACA,oBAAA;AACF,kBAAA;AACA,kBAAA;AACE,oBAAA;AACE,sBAAA;AAAA,wBAAA;AACuD,sBAAA;AACvD,oBAAA;AAEA,sBAAA;AAAwC,oBAAA;AAE5C,kBAAA;AACA,kBAAA;AACE,oBAAA;AACF,kBAAA;AACA,kBAAA;AACA,kBAAA;AAEA,kBAAA;AACA,kBAAA;AAAQ,gBAAA;AACV,cAAA;AACC,cAAA;AAEC,8BAAA;AAKA,YAAA;AAAA,UAAA;AAEJ,QAAA;AAAA,MAAA;AAAA,IAAA;AAEJ,EAAA;AAEJ;AAEO;ADtFW;AACA;AE1OXA;AF4OW;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-K43U2JVG.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@nextui-org/select';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { Controller } from '../Controller';\nimport { slugify } from '../helpers';\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'rounded-lg border-2 border-default-200 !duration-150 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'pointer-events-auto relative bottom-1.5 ml-1 text-small subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\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: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n singleValue: '!ml-1 !leading-7',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ntype SelectOption = {\n /** option label */\n label?: React.ReactNode;\n /** option value */\n value: string;\n};\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\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']}`;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (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']}_select`;\n return (\n <div data-testid={testId}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.Control {...props} />\n </div>\n );\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']}_select_option_${slugify(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}_select_dropdown`}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.DropdownIndicator {...props} />\n </div>\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 renderOptionLabel = 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, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const [isFocused, setIsFocused] = useState(false);\n\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const {\n getBaseProps,\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getTriggerProps,\n getValueProps,\n label,\n } = useSelect({\n children: [],\n classNames,\n errorMessage: JSON.stringify(error),\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\n });\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\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\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(classNames.base)}\n data-testid={`${testId}_wrapper`}\n // See NextUI styles for group-data condition (data-invalid), e.g.: https://github.com/nextui-org/nextui/blob/main/packages/components/select/src/use-select.ts\n data-required={required}\n >\n {showLabel && (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n {showTestIdCopyButton && (\n <FieldCopyTestIdButton testId={testId} />\n )}\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n aria-invalid={invalid}\n classNames={{\n control: () =>\n cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n }),\n clearIndicator: () => classNames.clearIndicator,\n dropdownIndicator: () => classNames.dropdownIndicator,\n groupHeading: () => classNames.groupHeading,\n indicatorsContainer: () => classNames.indicatorsContainer,\n indicatorSeparator: () => classNames.indicatorSeparator,\n input: () => classNames.input,\n menu: () => classNames.menu,\n menuList: () => classNames.menuList,\n menuPortal: () => classNames.menuPortal,\n multiValue: () => classNames.multiValue,\n multiValueLabel: () =>\n cn(classNames.multiValueLabel, `${getValueProps().className}`),\n multiValueRemove: () => classNames.multiValueRemove,\n noOptionsMessage: () => classNames.noOptionsMessage,\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) =>\n cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n }),\n placeholder: () => classNames.placeholder,\n singleValue: () =>\n cn(classNames.singleValue, `${getValueProps().className}`),\n valueContainer: () => classNames.valueContainer,\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Control: ControlComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n name={name}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n options={options}\n placeholder={placeholder}\n onBlur={(_e) => {\n setIsFocused(false);\n return onBlur();\n }}\n onChange={(option) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => _option.value),\n );\n } else {\n onChange((option as SelectOption)?.value);\n }\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n onInputChange={onInputChange}\n ref={ref}\n // set complete option as value by current field value\n value={options.find((option) => option.value === value)}\n unstyled\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"]}
@@ -1,18 +1,23 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkVQWKXSHWcjs = require('./chunk-VQWKXSHW.cjs');
3
+ var _chunkV5HTEMWZcjs = require('./chunk-V5HTEMWZ.cjs');
4
4
 
5
5
 
6
6
  var _chunkJU5RT22Ycjs = require('./chunk-JU5RT22Y.cjs');
7
7
 
8
8
 
9
- var _chunkOHJYXA6Rcjs = require('./chunk-OHJYXA6R.cjs');
9
+ var _chunkC4RM2JSDcjs = require('./chunk-C4RM2JSD.cjs');
10
10
 
11
11
 
12
- var _chunkXJWEUCV3cjs = require('./chunk-XJWEUCV3.cjs');
12
+ var _chunk2NSCPLAAcjs = require('./chunk-2NSCPLAA.cjs');
13
13
 
14
14
 
15
- var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
15
+ var _chunk4AXNPSXGcjs = require('./chunk-4AXNPSXG.cjs');
16
+
17
+
18
+
19
+
20
+ var _chunk4DAZAO6Ycjs = require('./chunk-4DAZAO6Y.cjs');
16
21
 
17
22
  // src/RadioGroup/RadioGroup.tsx
18
23
  var _radio = require('@nextui-org/radio');
@@ -25,7 +30,8 @@ var _Tabs = require('@fuf-stack/pixels/Tabs'); var _Tabs2 = _interopRequireDefau
25
30
  var _visuallyhidden = require('@react-aria/visually-hidden');
26
31
 
27
32
  var _jsxruntime = require('react/jsx-runtime');
28
- var RadioBox = ({ icon = void 0, ...props }) => {
33
+ var RadioBox = (_a) => {
34
+ var _b = _a, { icon = void 0 } = _b, props = _chunk4DAZAO6Ycjs.__objRest.call(void 0, _b, ["icon"]);
29
35
  const {
30
36
  children,
31
37
  Component,
@@ -40,8 +46,7 @@ var RadioBox = ({ icon = void 0, ...props }) => {
40
46
  } = _radio.useRadio.call(void 0, props);
41
47
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
42
48
  Component,
43
- {
44
- ...getBaseProps(),
49
+ _chunk4DAZAO6Ycjs.__spreadProps.call(void 0, _chunk4DAZAO6Ycjs.__spreadValues.call(void 0, {}, getBaseProps()), {
45
50
  className: _pixelutils.cn.call(void 0,
46
51
  "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-focus",
47
52
  {
@@ -50,22 +55,21 @@ var RadioBox = ({ icon = void 0, ...props }) => {
50
55
  }
51
56
  ),
52
57
  children: [
53
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _visuallyhidden.VisuallyHidden, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { ...getInputProps() }) }),
54
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...getWrapperProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...getControlProps() }) }),
58
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _visuallyhidden.VisuallyHidden, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", _chunk4DAZAO6Ycjs.__spreadValues.call(void 0, {}, getInputProps())) }),
59
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", _chunk4DAZAO6Ycjs.__spreadProps.call(void 0, _chunk4DAZAO6Ycjs.__spreadValues.call(void 0, {}, getWrapperProps()), { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", _chunk4DAZAO6Ycjs.__spreadValues.call(void 0, {}, getControlProps())) })),
55
60
  icon,
56
61
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
57
62
  "div",
58
- {
59
- ...getLabelWrapperProps(),
63
+ _chunk4DAZAO6Ycjs.__spreadProps.call(void 0, _chunk4DAZAO6Ycjs.__spreadValues.call(void 0, {}, getLabelWrapperProps()), {
60
64
  className: _pixelutils.cn.call(void 0, getLabelWrapperProps().className, "grow"),
61
65
  children: [
62
- children && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...getLabelProps(), children }),
66
+ children && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", _chunk4DAZAO6Ycjs.__spreadProps.call(void 0, _chunk4DAZAO6Ycjs.__spreadValues.call(void 0, {}, getLabelProps()), { children })),
63
67
  description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-small text-foreground opacity-70", children: description })
64
68
  ]
65
- }
69
+ })
66
70
  )
67
71
  ]
68
- }
72
+ })
69
73
  );
70
74
  };
71
75
 
@@ -134,14 +138,14 @@ var RadioGroup = ({
134
138
  testId: _testId = void 0,
135
139
  variant = "default"
136
140
  }) => {
137
- const { control, debugMode, getFieldState, getValues } = _chunkXJWEUCV3cjs.useFormContext.call(void 0, );
141
+ const { control, debugMode, getFieldState, getValues } = _chunk2NSCPLAAcjs.useFormContext.call(void 0, );
138
142
  const { error, invalid, required, testId } = getFieldState(name, _testId);
139
143
  const showTestIdCopyButton = debugMode === "debug-testids";
140
144
  const showLabel = label || showTestIdCopyButton;
141
145
  const variants = radioGroupVariants();
142
146
  const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
143
147
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
144
- _chunkVQWKXSHWcjs.Controller,
148
+ _chunkV5HTEMWZcjs.Controller_default,
145
149
  {
146
150
  control,
147
151
  disabled,
@@ -169,7 +173,7 @@ var RadioGroup = ({
169
173
  RadioBox,
170
174
  {
171
175
  classNames: itemClassNames,
172
- "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
176
+ "data-testid": _chunk4AXNPSXGcjs.slugify.call(void 0,
173
177
  `${testId}_option_${option.testId || option.value}`
174
178
  ),
175
179
  description: option.description,
@@ -195,7 +199,7 @@ var RadioGroup = ({
195
199
  [classNames.itemBaseActive]: getValues()[name] !== option.value
196
200
  }),
197
201
  isDisabled: isDisabled || option.disabled,
198
- testID: _chunkBBB4FEY6cjs.slugify.call(void 0,
202
+ testID: _chunk4AXNPSXGcjs.slugify.call(void 0,
199
203
  `${testId}_option_${option.testId || option.value}`
200
204
  ),
201
205
  onChange,
@@ -225,7 +229,7 @@ var RadioGroup = ({
225
229
  _radio.Radio,
226
230
  {
227
231
  classNames: itemClassNames,
228
- "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
232
+ "data-testid": _chunk4AXNPSXGcjs.slugify.call(void 0,
229
233
  `${testId}_option_${option.testId || option.value}`
230
234
  ),
231
235
  isDisabled: isDisabled || option.disabled,
@@ -246,7 +250,7 @@ var RadioGroup = ({
246
250
  "data-invalid": invalid,
247
251
  "data-required": required,
248
252
  "data-testid": testId,
249
- errorMessage: error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkOHJYXA6Rcjs.FieldValidationError_default, { error }),
253
+ errorMessage: error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkC4RM2JSDcjs.FieldValidationError_default, { error }),
250
254
  isDisabled,
251
255
  isInvalid: invalid,
252
256
  isRequired: required,
@@ -276,4 +280,4 @@ var RadioGroup_default2 = RadioGroup_default;
276
280
 
277
281
 
278
282
  exports.RadioGroup_default = RadioGroup_default; exports.RadioGroup_default2 = RadioGroup_default2;
279
- //# sourceMappingURL=chunk-XJZAS7NG.cjs.map
283
+ //# sourceMappingURL=chunk-MF4JB3YT.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-MF4JB3YT.cjs","../src/RadioGroup/RadioGroup.tsx","../src/RadioGroup/Variants/RadioBox.tsx","../src/RadioG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oBAAA;AAEzB,sBAAA;AAC2C,oBAAA;AACnD,oBAAA;AACA,oBAAA;AACc,oBAAA;AAGwB,kBAAA;AAAA,kBAAA;AAR1B,gBAAA;AASd,cAAA;AAGJ,cAAA;AAAO,YAAA;AAET,YAAA;AAAA,UAAA;AAGA,YAAA;AACE,cAAA;AAAC,cAAA;AAAA,gBAAA;AACY,gBAAA;AACL,gBAAA;AACa,cAAA;AAAA,YAAA;AAGvB,YAAA;AAAA,UAAA;AAEA,YAAA;AACE,cAAA;AACE,gBAAA;AACE,kBAAA;AAAC,kBAAA;AAAA,oBAAA;AACa,oBAAA;AACC,sBAAA;AACsC,oBAAA;AACnD,oBAAA;AACiC,oBAAA;AAEjC,oBAAA;AACc,oBAAA;AAEwB,kBAAA;AAAA,kBAAA;AAJ1B,gBAAA;AAKd,cAAA;AAGJ,cAAA;AAAO,YAAA;AACR,QAAA;AAGL,QAAA;AACE,UAAA;AAAC,UAAA;AAAA,YAAA;AACC,YAAA;AAEc,YAAA;AACC,YAAA;AACF,YAAA;AAC8C,YAAA;AAC3D,YAAA;AACW,YAAA;AACC,YAAA;AAEV,4BAAA;AAGK,cAAA;AAAA,cAAA;AAEwC,YAAA;AAE3C,YAAA;AAGJ,YAAA;AACqC,YAAA;AACrC,YAAA;AACA,YAAA;AACA,YAAA;AAOE,UAAA;AAAA,QAAA;AAEJ,MAAA;AAEJ,IAAA;AAAA,EAAA;AAGN;AAEA;ADmBA;AACA;AI7QA;AJ+QA;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-MF4JB3YT.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { RadioGroup as NextRadioGroup, Radio } from '@nextui-org/radio';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport { ButtonGroup } from '@fuf-stack/pixels';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { Controller } from '../Controller';\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 const radioGroupVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n buttonGroup:\n 'rounded-xl group-data-[invalid=true]:border group-data-[invalid=true]:border-danger', // optional if a button group is used\n itemBase: '',\n itemBaseActive: 'bg-opacity-50', // optional if a button group is used\n itemControl: 'bg-focus group-data-[invalid=true]:bg-danger',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper:\n 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid=\"true\"]):not(group-data-[selected=\"false\"])]:border-focus', // TODO: get rid of !.\n // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n // Tabs\n tabList: '',\n tab: '',\n tabContent: '',\n cursor: '',\n panel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioGroupVariants>;\ntype ClassName = TVClassName<typeof radioGroupVariants>;\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 V extends 'default' | 'radioBox' | 'radioButton' | 'tabs',\n> extends VariantProps {\n /** CSS class name */\n className?: ClassName;\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: V extends 'default' | 'radioBox' | 'radioButton'\n ? RadioGroupOption[]\n : TabProps[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioGroup should look like. */\n variant?: V;\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<\n 'default' | 'radioBox' | 'radioButton' | 'tabs'\n>): ReactElement => {\n const { control, debugMode, getFieldState, getValues } = useFormContext();\n\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = radioGroupVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\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\n const itemClassNames = {\n base: classNames.itemBase,\n control: classNames.itemControl,\n description: classNames.itemDescription,\n label: classNames.itemLabel,\n labelWrapper: classNames.itemLabelWrapper,\n wrapper: classNames.itemWrapper,\n tabList: classNames.tabList,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n cursor: classNames.cursor,\n panel: classNames.panel,\n };\n\n switch (variant) {\n case 'radioBox':\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <RadioBox\n classNames={itemClassNames}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n description={option.description}\n icon={option.icon}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n onChange={onChange}\n value={option.value}\n >\n {option.label ? option.label : option.value}\n </RadioBox>\n );\n }\n return null;\n });\n break;\n case 'radioButton':\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <RadioButton\n className={cn(classNames.itemBase, {\n [classNames.itemBaseActive]:\n getValues()[name] !== option.value,\n })}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n testID={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n onChange={onChange}\n value={option.value}\n // TODO: how to do the classNames properly (make selected option darker with same color)\n >\n {option.label ? option.label : option.value}\n </RadioButton>\n );\n }\n return null;\n });\n break;\n\n case 'tabs':\n RadioComponents = (\n <Tabs\n fullWidth={false}\n tabs={options as TabProps[]}\n onSelectionChange={onChange}\n />\n );\n break;\n default:\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <Radio\n classNames={itemClassNames}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n onChange={onChange}\n value={option.value}\n >\n {option.label ? option.label : option.value}\n </Radio>\n );\n }\n return null;\n });\n }\n\n return (\n <NextRadioGroup\n classNames={classNames}\n // See NextUI styles for group-data condition (data-invalid), e.g.: https://github.com/nextui-org/nextui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label>\n {label}\n {showTestIdCopyButton && (\n <FieldCopyTestIdButton testId={testId} />\n )}\n </label>\n )\n }\n name={name}\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n onChange={onChange}\n ref={ref}\n >\n {variant === 'radioButton' ? (\n <ButtonGroup className={classNames.buttonGroup}>\n {RadioComponents}\n </ButtonGroup>\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-focus',\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 /** HTML data-testid attribute of the option */\n testID?: string;\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 children,\n className = undefined,\n isDisabled = false,\n onChange,\n testID = undefined,\n value,\n}: RadioButtonProps) => {\n return (\n <Button\n className={cn(className)}\n testId={testID}\n disabled={isDisabled}\n key={`index_${value}`}\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"]}
@@ -1,6 +1,13 @@
1
1
  import {
2
- slugify
3
- } from "./chunk-V46BHM2U.js";
2
+ slugify,
3
+ toValidationFormat
4
+ } from "./chunk-IEF2GJ22.js";
5
+ import {
6
+ __async,
7
+ __objRest,
8
+ __spreadProps,
9
+ __spreadValues
10
+ } from "./chunk-CRTRMMJ7.js";
4
11
 
5
12
  // src/hooks/useFieldArray/useFieldArray.ts
6
13
  import { useFieldArray } from "react-hook-form";
@@ -14,13 +21,6 @@ import React, { useMemo, useState } from "react";
14
21
  import { FormProvider as HookFormProvider, useForm } from "react-hook-form";
15
22
  import { useLocalStorage } from "@fuf-stack/pixels";
16
23
  import { jsx } from "react/jsx-runtime";
17
- var removeNullishFields = (obj) => {
18
- return JSON.parse(
19
- JSON.stringify(obj, (_key, value) => {
20
- return value === "" || value === null ? void 0 : value;
21
- })
22
- );
23
- };
24
24
  var DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT = "uniform:debug-mode";
25
25
  var UniformContext = React.createContext({
26
26
  debugMode: "off",
@@ -38,14 +38,14 @@ var FormProvider = ({
38
38
  }) => {
39
39
  const [preventSubmit, setPreventSubmit] = useState(false);
40
40
  const [debugMode, setDebugMode] = useLocalStorage(
41
- debugModeSettings?.localStorageKey || DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT,
41
+ (debugModeSettings == null ? void 0 : debugModeSettings.localStorageKey) || DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT,
42
42
  "off"
43
43
  );
44
44
  const contextValue = useMemo(
45
45
  () => ({
46
46
  // set debugMode to disabled when debugModeSettings.disable is true
47
47
  // otherwise use current debug mode from localStorage
48
- debugMode: debugModeSettings?.disable ? "disabled" : debugMode,
48
+ debugMode: (debugModeSettings == null ? void 0 : debugModeSettings.disable) ? "disabled" : debugMode,
49
49
  preventSubmit: (prevent) => {
50
50
  setPreventSubmit(prevent);
51
51
  },
@@ -53,41 +53,39 @@ var FormProvider = ({
53
53
  validation
54
54
  }),
55
55
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
- [debugMode, debugModeSettings?.disable]
56
+ [debugMode, debugModeSettings == null ? void 0 : debugModeSettings.disable]
57
57
  );
58
- const methods = useForm({
59
- defaultValues: initialValues,
60
- // add validation config when validation schema provided
61
- ...validation ? {
62
- // set rhf mode
63
- // see: https://react-hook-form.com/docs/useform#mode
64
- mode: validationTrigger,
65
- resolver: async (values) => {
66
- const { data, errors, ...rest } = await validation.validateAsync(
67
- removeNullishFields(values)
68
- );
69
- return { values: data || {}, errors: errors || {}, ...rest };
70
- }
71
- } : {}
72
- });
73
- const handleSubmit = async (e) => {
58
+ const methods = useForm(__spreadValues({
59
+ defaultValues: initialValues
60
+ }, validation ? {
61
+ // set rhf mode
62
+ // see: https://react-hook-form.com/docs/useform#mode
63
+ mode: validationTrigger,
64
+ resolver: (values) => __async(void 0, null, function* () {
65
+ const _a = yield validation.validateAsync(
66
+ toValidationFormat(values)
67
+ ), { data, errors } = _a, rest = __objRest(_a, ["data", "errors"]);
68
+ return __spreadValues({ values: data || {}, errors: errors || {} }, rest);
69
+ })
70
+ } : {}));
71
+ const handleSubmit = (e) => __async(void 0, null, function* () {
74
72
  if (methods.formState.isValid && preventSubmit) {
75
73
  console.warn(
76
74
  "[FormProvider] form submit was prevented because preventSubmit is true..."
77
75
  );
78
- e?.preventDefault();
76
+ e == null ? void 0 : e.preventDefault();
79
77
  return Promise.resolve();
80
78
  }
81
- await methods.handleSubmit(onSubmit)(e);
82
- };
83
- return /* @__PURE__ */ jsx(UniformContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(HookFormProvider, { ...methods, children: children({ handleSubmit }) }) });
79
+ yield methods.handleSubmit(onSubmit)(e);
80
+ });
81
+ return /* @__PURE__ */ jsx(UniformContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(HookFormProvider, __spreadProps(__spreadValues({}, methods), { children: children({ handleSubmit }) })) });
84
82
  };
85
83
  var FormContext_default = FormProvider;
86
84
 
87
85
  // src/hooks/useFormContext/useFormContext.ts
88
86
  var checkFieldIsRequired = (validation, path) => {
89
87
  const checkRequired = (schema) => {
90
- if (schema.type === "array" && schema?.minLength) {
88
+ if (schema.type === "array" && (schema == null ? void 0 : schema.minLength)) {
91
89
  return true;
92
90
  }
93
91
  return !schema.isOptional && !schema.isNullable;
@@ -95,39 +93,41 @@ var checkFieldIsRequired = (validation, path) => {
95
93
  return validation.checkSchemaPath(checkRequired, path);
96
94
  };
97
95
  var useFormContext = () => {
98
- const {
96
+ const _a = useHookFormContext(), {
99
97
  formState,
98
+ getFieldState: getFieldStateOrig
99
+ } = _a, otherMethods = __objRest(_a, [
100
+ "formState",
100
101
  // https://react-hook-form.com/docs/useform/getfieldstate
101
102
  // for getFieldState a subscription to formState properties is needed!
102
- getFieldState: getFieldStateOrig,
103
- ...otherMethods
104
- } = useHookFormContext();
103
+ "getFieldState"
104
+ ]);
105
105
  const uniformContext = useContext(UniformContext);
106
106
  const getFieldState = (name, testId) => {
107
107
  const fieldPath = typeof name === "string" ? name.replace(/\[\d+\]/g, "").split(".") : name;
108
- const required = uniformContext?.validation ? checkFieldIsRequired(uniformContext.validation, fieldPath) : false;
109
- const { error, ...rest } = getFieldStateOrig(name, formState);
110
- return {
111
- ...rest,
108
+ const required = (uniformContext == null ? void 0 : uniformContext.validation) ? checkFieldIsRequired(uniformContext.validation, fieldPath) : false;
109
+ const _a2 = getFieldStateOrig(name, formState), { error } = _a2, rest = __objRest(_a2, ["error"]);
110
+ return __spreadProps(__spreadValues({}, rest), {
112
111
  error,
113
112
  // Ensure correct type for error
114
113
  required,
115
114
  testId: slugify(testId || name)
116
- };
115
+ });
117
116
  };
118
- return {
119
- ...otherMethods,
120
- ...uniformContext,
117
+ return __spreadProps(__spreadValues(__spreadValues({}, otherMethods), uniformContext), {
121
118
  getFieldState,
122
119
  formState
123
- };
120
+ });
124
121
  };
125
122
 
123
+ // src/hooks/useInput/useInput.ts
124
+ import { useInput } from "@nextui-org/input";
125
+
126
126
  export {
127
127
  useFieldArray,
128
- removeNullishFields,
129
128
  FormContext_default,
130
129
  checkFieldIsRequired,
131
- useFormContext
130
+ useFormContext,
131
+ useInput
132
132
  };
133
- //# sourceMappingURL=chunk-BZAPTLMC.js.map
133
+ //# sourceMappingURL=chunk-MRXNKY72.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useFieldArray/useFieldArray.ts","../src/hooks/useFormContext/useFormContext.ts","../src/Form/subcomponents/FormContext.tsx","../src/hooks/useInput/useInput.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n\n/** @see https://react-hook-form.com/docs/usefieldarray */\nexport { useFieldArray } from 'react-hook-form';\n","import type { VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { slugify } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const checkRequired = (schema: any) => {\n // arrays with minLength are required\n if (schema.type === 'array' && schema?.minLength) {\n return true;\n }\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, path);\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n */\nexport const useFormContext = () => {\n const {\n formState,\n // https://react-hook-form.com/docs/useform/getfieldstate\n // for getFieldState a subscription to formState properties is needed!\n getFieldState: getFieldStateOrig,\n ...otherMethods\n } = useHookFormContext();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n */\n const getFieldState = (name: string, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Check if the field is required using the validation schema\n const required = uniformContext?.validation\n ? checkFieldIsRequired(uniformContext.validation, fieldPath)\n : false;\n\n // Get the original field state (errors, etc.) from react-hook-form\n const { error, ...rest } = getFieldStateOrig(name, formState);\n\n return {\n ...rest,\n error: error as FieldError[] | undefined, // Ensure correct type for error\n required,\n testId: slugify(testId || name),\n };\n };\n\n return {\n ...otherMethods,\n ...uniformContext,\n getFieldState,\n formState,\n };\n};\n","import type { VetoInstance } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\n\nimport React, { useMemo, useState } from 'react';\nimport { FormProvider as HookFormProvider, useForm } from 'react-hook-form';\n\nimport { useLocalStorage } from '@fuf-stack/pixels';\n\nimport { toValidationFormat } from '../../helpers';\n\ntype DebugMode = 'debug' | 'debug-testids' | 'off' | 'disabled';\n\nexport type DebugModeSettings = {\n /** disable form debug completely */\n disable?: boolean;\n /** custom localStorage key to save debug mode state */\n localStorageKey?: string;\n};\n\nconst DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT = 'uniform:debug-mode';\n\n/**\n * The `UniformContext` provides control over the form's submission behavior and may optionally include\n * a Veto validation schema for form validation.\n *\n * Specifically, this context offers:\n * 1. **Form Submission Control**: The `preventSubmit` function allows components to enable or disable\n * form submissions.\n * 2. **Optional Validation Schema**: The `validation` property may hold a Veto validation schema instance\n * that can be used to validate form fields and handle validation logic.\n *\n * This context is useful for components that need to interact with or control the form submission state,\n * or access the validation schema for managing form validation logic.\n */\nexport const UniformContext = React.createContext<{\n /** Form debug mode enabled or not */\n debugMode: DebugMode;\n /** settings for from debug mode */\n debugModeSettings?: DebugModeSettings;\n /** Function to update if the form can currently be submitted */\n preventSubmit: (prevent: boolean) => void;\n /** Setter to enable or disable form debug mode */\n setDebugMode: (debugMode: DebugMode) => void;\n /** Optional Veto validation schema instance for form validation */\n validation?: VetoInstance;\n}>({\n debugMode: 'off',\n preventSubmit: () => undefined,\n setDebugMode: () => undefined,\n validation: undefined,\n});\n\n// Define props for the FormProvider component, extending HookForm's props\ninterface FormProviderProps {\n /** children form render function */\n children: (childProps: {\n handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;\n }) => ReactNode;\n /** settings for from debug mode */\n debugModeSettings?: DebugModeSettings;\n /** initial form values */\n initialValues?: FieldValues;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** Veto validation schema instance */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * FormProvider component provides:\n * - The veto validation schema context\n * - Submit handler creation and submission control with preventSubmit\n * - Form Debug Mode state\n * - React Hook Form context\n */\nconst FormProvider: React.FC<FormProviderProps> = ({\n children,\n debugModeSettings = undefined,\n initialValues = undefined,\n onSubmit,\n validation = undefined,\n validationTrigger,\n}) => {\n // Control if the form can currently be submitted\n const [preventSubmit, setPreventSubmit] = useState(false);\n\n // Form Debug mode state is handled in the form context\n const [debugMode, setDebugMode] = useLocalStorage<DebugMode>(\n debugModeSettings?.localStorageKey || DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT,\n 'off',\n );\n\n // Memoize the context value to prevent re-renders\n const contextValue = useMemo(\n () => ({\n // set debugMode to disabled when debugModeSettings.disable is true\n // otherwise use current debug mode from localStorage\n debugMode: debugModeSettings?.disable ? 'disabled' : debugMode,\n preventSubmit: (prevent: boolean) => {\n setPreventSubmit(prevent);\n },\n setDebugMode,\n validation,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [debugMode, debugModeSettings?.disable],\n );\n\n // Initialize react hook form\n const methods = useForm({\n defaultValues: initialValues,\n // add validation config when validation schema provided\n ...(validation\n ? {\n // set rhf mode\n // see: https://react-hook-form.com/docs/useform#mode\n mode: validationTrigger,\n resolver: async (values) => {\n const { data, errors, ...rest } = await validation.validateAsync(\n toValidationFormat(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 }\n : {}),\n });\n\n // Create submit handler\n // eslint-disable-next-line consistent-return\n const handleSubmit = async (e?: React.BaseSyntheticEvent) => {\n // only prevent submit when form state is valid, because otherwise\n // submit will only trigger validation and add errors / focus invalid fields\n if (methods.formState.isValid && preventSubmit) {\n console.warn(\n '[FormProvider] form submit was prevented because preventSubmit is true...',\n );\n e?.preventDefault();\n return Promise.resolve();\n }\n await methods.handleSubmit(onSubmit)(e);\n };\n\n return (\n <UniformContext.Provider value={contextValue}>\n {/* Spread all hook form props into HookFormProvider */}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <HookFormProvider {...methods}>\n {children({ handleSubmit })}\n </HookFormProvider>\n </UniformContext.Provider>\n );\n};\n\nexport default FormProvider;\n","/* eslint-disable import/prefer-default-export */\nexport { useInput } from '@nextui-org/input';\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,qBAAqB;;;ACA9B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB,0BAA0B;;;ACArD,OAAO,SAAS,SAAS,gBAAgB;AACzC,SAAS,gBAAgB,kBAAkB,eAAe;AAE1D,SAAS,uBAAuB;AA+I1B;AAlIN,IAAM,uCAAuC;AAetC,IAAM,iBAAiB,MAAM,cAWjC;AAAA,EACD,WAAW;AAAA,EACX,eAAe,MAAM;AAAA,EACrB,cAAc,MAAM;AAAA,EACpB,YAAY;AACd,CAAC;AA2BD,IAAM,eAA4C,CAAC;AAAA,EACjD;AAAA,EACA,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB;AAAA,EACA,aAAa;AAA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