@fuf-stack/uniform 0.21.1 → 0.21.2
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.
- package/dist/CheckboxGroup/index.cjs +3 -3
- package/dist/CheckboxGroup/index.js +2 -2
- package/dist/FieldArray/index.cjs +3 -3
- package/dist/FieldArray/index.js +2 -2
- package/dist/Form/index.cjs +3 -3
- package/dist/Form/index.js +2 -2
- package/dist/Input/index.cjs +3 -3
- package/dist/Input/index.js +2 -2
- package/dist/RadioBoxes/index.cjs +3 -3
- package/dist/RadioBoxes/index.js +2 -2
- package/dist/RadioGroup/index.cjs +3 -3
- package/dist/RadioGroup/index.js +2 -2
- package/dist/RadioTabs/index.cjs +3 -3
- package/dist/RadioTabs/index.js +2 -2
- package/dist/Select/index.cjs +3 -3
- package/dist/Select/index.js +2 -2
- package/dist/SubmitButton/index.cjs +3 -3
- package/dist/SubmitButton/index.js +2 -2
- package/dist/Switch/index.cjs +3 -3
- package/dist/Switch/index.js +2 -2
- package/dist/TextArea/index.cjs +3 -3
- package/dist/TextArea/index.js +2 -2
- package/dist/{chunk-WGUKDO53.cjs → chunk-34SC6752.cjs} +7 -7
- package/dist/{chunk-WGUKDO53.cjs.map → chunk-34SC6752.cjs.map} +1 -1
- package/dist/{chunk-DOU4QUFP.cjs → chunk-3CZLX3GW.cjs} +4 -4
- package/dist/{chunk-DOU4QUFP.cjs.map → chunk-3CZLX3GW.cjs.map} +1 -1
- package/dist/{chunk-H7X5Q6SW.js → chunk-4YF424NV.js} +2 -2
- package/dist/{chunk-YLAMHHJB.cjs → chunk-6DZMJL6A.cjs} +4 -4
- package/dist/{chunk-YLAMHHJB.cjs.map → chunk-6DZMJL6A.cjs.map} +1 -1
- package/dist/{chunk-SXYWWUMK.cjs → chunk-EHQPOPGR.cjs} +4 -4
- package/dist/{chunk-SXYWWUMK.cjs.map → chunk-EHQPOPGR.cjs.map} +1 -1
- package/dist/{chunk-5PNXBS5K.cjs → chunk-G4GCGAMX.cjs} +3 -3
- package/dist/{chunk-5PNXBS5K.cjs.map → chunk-G4GCGAMX.cjs.map} +1 -1
- package/dist/{chunk-C5LVVYXY.js → chunk-GFXPCQYY.js} +2 -2
- package/dist/{chunk-33BKBYR2.js → chunk-HJDFEGSC.js} +2 -2
- package/dist/{chunk-UTKY3KL2.js → chunk-HUYCOUFA.js} +2 -2
- package/dist/{chunk-JQGCMXUB.js → chunk-L4F26TIF.js} +2 -2
- package/dist/{chunk-P44L3XR4.js → chunk-LASW5L3O.js} +2 -2
- package/dist/{chunk-KNP3VJSM.js → chunk-LUHX3EP6.js} +2 -2
- package/dist/{chunk-4AWDOV7M.js → chunk-MC56FOMX.js} +1 -1
- package/dist/chunk-MC56FOMX.js.map +1 -0
- package/dist/{chunk-EQXSFBZW.cjs → chunk-MQFKDXKT.cjs} +4 -4
- package/dist/{chunk-EQXSFBZW.cjs.map → chunk-MQFKDXKT.cjs.map} +1 -1
- package/dist/{chunk-DUXD4EBJ.js → chunk-N4V3GR6P.js} +2 -2
- package/dist/{chunk-ZZ4Q3FLC.cjs → chunk-NFMNQHP7.cjs} +1 -1
- package/dist/chunk-NFMNQHP7.cjs.map +1 -0
- package/dist/{chunk-K2B7NTWK.cjs → chunk-RJ4DYKAV.cjs} +4 -4
- package/dist/{chunk-K2B7NTWK.cjs.map → chunk-RJ4DYKAV.cjs.map} +1 -1
- package/dist/{chunk-J7NVQTEW.cjs → chunk-T7PSOKMV.cjs} +5 -5
- package/dist/{chunk-J7NVQTEW.cjs.map → chunk-T7PSOKMV.cjs.map} +1 -1
- package/dist/{chunk-CK5D6TE5.cjs → chunk-TPID3SYN.cjs} +4 -4
- package/dist/{chunk-CK5D6TE5.cjs.map → chunk-TPID3SYN.cjs.map} +1 -1
- package/dist/{chunk-IIWHSNQG.cjs → chunk-XB3XIDVB.cjs} +4 -4
- package/dist/{chunk-IIWHSNQG.cjs.map → chunk-XB3XIDVB.cjs.map} +1 -1
- package/dist/{chunk-BUNJMA4O.cjs → chunk-YCM5J5E4.cjs} +4 -4
- package/dist/{chunk-BUNJMA4O.cjs.map → chunk-YCM5J5E4.cjs.map} +1 -1
- package/dist/{chunk-4WCWNYCA.js → chunk-YQQ3DYKS.js} +2 -2
- package/dist/{chunk-KF57IEIV.js → chunk-ZRI45CRF.js} +2 -2
- package/dist/{chunk-IWHBCTIB.js → chunk-ZZ72IA34.js} +2 -2
- package/dist/hooks/index.cjs +2 -2
- package/dist/hooks/index.d.cts +18 -18
- package/dist/hooks/index.d.ts +18 -18
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.js +12 -12
- package/package.json +6 -6
- package/dist/chunk-4AWDOV7M.js.map +0 -1
- package/dist/chunk-ZZ4Q3FLC.cjs.map +0 -1
- /package/dist/{chunk-H7X5Q6SW.js.map → chunk-4YF424NV.js.map} +0 -0
- /package/dist/{chunk-C5LVVYXY.js.map → chunk-GFXPCQYY.js.map} +0 -0
- /package/dist/{chunk-33BKBYR2.js.map → chunk-HJDFEGSC.js.map} +0 -0
- /package/dist/{chunk-UTKY3KL2.js.map → chunk-HUYCOUFA.js.map} +0 -0
- /package/dist/{chunk-JQGCMXUB.js.map → chunk-L4F26TIF.js.map} +0 -0
- /package/dist/{chunk-P44L3XR4.js.map → chunk-LASW5L3O.js.map} +0 -0
- /package/dist/{chunk-KNP3VJSM.js.map → chunk-LUHX3EP6.js.map} +0 -0
- /package/dist/{chunk-DUXD4EBJ.js.map → chunk-N4V3GR6P.js.map} +0 -0
- /package/dist/{chunk-4WCWNYCA.js.map → chunk-YQQ3DYKS.js.map} +0 -0
- /package/dist/{chunk-KF57IEIV.js.map → chunk-ZRI45CRF.js.map} +0 -0
- /package/dist/{chunk-IWHBCTIB.js.map → chunk-ZZ72IA34.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels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AAA;AACqC,MAAA;AACrC,MAAA;AACA,MAAA;AAEA,MAAA;AAAC,QAAA;AAAA,QAAA;AAC4C,UAAA;AAChC,UAAA;AACQ,UAAA;AACN,UAAA;AACP,UAAA;AACN,UAAA;AACA,UAAA;AAAA,QAAA;AACF,MAAA;AAAA,IAAA;AACF,EAAA;AAEJ;AAEe;ADnDqG;AACA;AE1FrG;AF4FqG;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-RJ4DYKAV.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n tabList: '',\n tab: '',\n tabContent: '',\n cursor: '',\n panel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabsOption {\n /** Optional content inside of the tab */\n content?: 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 RadioTabsProps 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: RadioTabsOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n disabled = false,\n inline = false,\n label = undefined,\n name,\n options,\n testId: _testId = undefined,\n variant = undefined,\n}: RadioTabsProps): ReactElement => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({ control, disabled, name });\n const { disabled: isDisabled, onBlur, onChange, ref, value } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = radioTabsVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const tabOptions = options.map<TabProps>((option) => ({\n content: option?.content,\n disabled: option?.disabled,\n key: option.value,\n label: option?.label || option?.value,\n testId: slugify(`option_${option?.testId || option?.value}`, {\n replaceDots: true,\n }),\n }));\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map(\n (option) => option.key as string,\n );\n\n return (\n <HeroRadioGroup\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\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 && <FieldCopyTestIdButton testId={testId} />}\n </label>\n )\n }\n name={name}\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n ref={ref}\n >\n <Tabs\n disabledKeys={disabled ? disabledAllKeys : undefined}\n fullWidth={false}\n onSelectionChange={onChange}\n selectedKey={value}\n tabs={tabOptions as TabProps[]}\n testId={testId}\n variant={variant}\n />\n </HeroRadioGroup>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"]}
|
|
@@ -8,7 +8,7 @@ var _chunkPA2DQCBYcjs = require('./chunk-PA2DQCBY.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkNFMNQHP7cjs = require('./chunk-NFMNQHP7.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -40,11 +40,11 @@ var Switch = ({
|
|
|
40
40
|
name,
|
|
41
41
|
testId: _testId = void 0
|
|
42
42
|
}) => {
|
|
43
|
-
const { control, debugMode, getFieldState } =
|
|
43
|
+
const { control, debugMode, getFieldState } = _chunkNFMNQHP7cjs.useFormContext.call(void 0, );
|
|
44
44
|
const { error, required, testId, invalid } = getFieldState(name, _testId);
|
|
45
|
-
const { field } =
|
|
45
|
+
const { field } = _chunkNFMNQHP7cjs.useController.call(void 0, { name, control, disabled });
|
|
46
46
|
const { disabled: isDisabled, value, ref, onBlur, onChange } = field;
|
|
47
|
-
const { label, getInputProps, getErrorMessageProps } =
|
|
47
|
+
const { label, getInputProps, getErrorMessageProps } = _chunkNFMNQHP7cjs.useInput.call(void 0, {
|
|
48
48
|
errorMessage: JSON.stringify(error),
|
|
49
49
|
isInvalid: invalid,
|
|
50
50
|
isRequired: required,
|
|
@@ -95,4 +95,4 @@ var Switch_default2 = Switch_default;
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
exports.Switch_default = Switch_default; exports.Switch_default2 = Switch_default2;
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
98
|
+
//# sourceMappingURL=chunk-T7PSOKMV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-T7PSOKMV.cjs","../src/Switch/Switch.tsx","../src/Switch/index.ts"],"names":["Switch_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACdA,wCAAqC;AAErC,oDAAyC;AAuEnC,+CAAA;AAjEC,IAAM,eAAA,EAAiB,4BAAA;AAAG,EAC/B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,EAAA;AAAA,IACN,UAAA,EAAY,EAAA;AAAA,IACZ,YAAA,EAAc,WAAA;AAAA;AAAA;AAAA,IAGd,KAAA,EACE,yNAAA;AAAA,IACF,YAAA,EAAc,sBAAA;AAAA,IACd,YAAA,EAAc,EAAA;AAAA,IACd,KAAA,EAAO,EAAA;AAAA,IACP,SAAA,EAAW,EAAA;AAAA,IACX,OAAA,EAAS;AAAA,EACX;AACF,CAAC,CAAA;AAqBD,IAAM,OAAA,EAAS,CAAC;AAAA,EACd,UAAA,EAAY,KAAA,CAAA;AAAA,EACZ,SAAA,EAAW,KAAA;AAAA,EACX,KAAA,EAAO,OAAA,EAAS,KAAA,CAAA;AAAA,EAChB,IAAA;AAAA,EACA,MAAA,EAAQ,QAAA,EAAU,KAAA;AACpB,CAAA,EAAA,GAAmB;AACjB,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,cAAc,EAAA,EAAI,8CAAA,CAAe;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,QAAA,EAAU,MAAA,EAAQ,QAAQ,EAAA,EAAI,aAAA,CAAc,IAAA,EAAM,OAAO,CAAA;AAExE,EAAA,MAAM,EAAE,MAAM,EAAA,EA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A,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAClE,CAAA;AAAA,IACC,MAAA,mBACC,6BAAA,KAAC,EAAA,EAAI,SAAA,EAAW,UAAA,CAAW,YAAA,EACzB,QAAA,kBAAA,6BAAA;AAAA,MAAC,KAAA;AAAA,MAAA,6CAAA,8CAAA,CAAA,CAAA,EAEK,oBAAA,CAAqB,CAAA,CAAA,EAF1B;AAAA,QAIC,QAAA,kBAAA,6BAAA,8CAAC,EAAA,EAAqB,KAAA,EAAc,OAAA,CAAgB;AAAA,MAAA,CAAA;AAAA,IACtD,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,CAAA;AAEJ,CAAA;AAEA,IAAO,eAAA,EAAQ,MAAA;ADpBf;AACA;AEpFA,IAAOA,gBAAAA,EAAQ,cAAA;AFsFf;AACA;AACE;AACA;AACF,mFAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-T7PSOKMV.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { Switch as HeroSwitch } from '@heroui/switch';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext, useInput } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const switchVariants = tv({\n slots: {\n base: '',\n endContent: '',\n errorMessage: 'ml-1 mt-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground 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 outerWrapper: 'place-content-center',\n startContent: '',\n thumb: '',\n thumbIcon: '',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof switchVariants>;\ntype ClassName = TVClassName<typeof switchVariants>;\n\nexport interface SwitchProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** whether the select should be disabled */\n disabled?: boolean;\n /** component displayed next to the switch. */\n label?: React.ReactNode;\n /** name the field is registered under */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Switch component based on [HeroUI Switch](https://www.heroui.com//docs/components/switch)\n */\nconst Switch = ({\n className = undefined,\n disabled = false,\n label: _label = undefined,\n name,\n testId: _testId = undefined,\n}: SwitchProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, required, testId, invalid } = getFieldState(name, _testId);\n\n const { field } = useController({ name, control, disabled });\n const { disabled: isDisabled, value, ref, onBlur, onChange } = field;\n\n const { label, getInputProps, getErrorMessageProps } = useInput({\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\n });\n\n const variants = switchVariants();\n const classNames = variantsToClassNames(variants, className, 'outerWrapper');\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n\n return (\n <div className={classNames.outerWrapper}>\n <HeroSwitch\n aria-describedby={getInputProps()['aria-describedby']}\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n isDisabled={isDisabled}\n isSelected={!!value}\n name={name}\n onBlur={onBlur}\n onValueChange={onChange}\n ref={ref}\n required={required}\n value={value}\n >\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </HeroSwitch>\n {error && (\n <div className={classNames.errorMessage}>\n <div\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...getErrorMessageProps()}\n >\n <FieldValidationError error={error} testId={testId} />\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport default Switch;\n","import Switch from './Switch';\n\nexport type { SwitchProps } from './Switch';\n\nexport { Switch };\n\nexport default Switch;\n"]}
|
|
@@ -7,7 +7,7 @@ var _chunkPA2DQCBYcjs = require('./chunk-PA2DQCBY.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkNFMNQHP7cjs = require('./chunk-NFMNQHP7.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -94,9 +94,9 @@ var RadioBoxes = ({
|
|
|
94
94
|
options,
|
|
95
95
|
testId: _testId = void 0
|
|
96
96
|
}) => {
|
|
97
|
-
const { control, debugMode, getFieldState, getValues } =
|
|
97
|
+
const { control, debugMode, getFieldState, getValues } = _chunkNFMNQHP7cjs.useFormContext.call(void 0, );
|
|
98
98
|
const { error, invalid, required, testId } = getFieldState(name, _testId);
|
|
99
|
-
const { field } =
|
|
99
|
+
const { field } = _chunkNFMNQHP7cjs.useController.call(void 0, { control, disabled, name });
|
|
100
100
|
const { onChange, disabled: isDisabled, onBlur, ref } = field;
|
|
101
101
|
const showTestIdCopyButton = debugMode === "debug-testids";
|
|
102
102
|
const showLabel = label || showTestIdCopyButton;
|
|
@@ -166,4 +166,4 @@ var RadioBoxes_default2 = RadioBoxes_default;
|
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
exports.RadioBoxes_default = RadioBoxes_default; exports.RadioBoxes_default2 = RadioBoxes_default2;
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-TPID3SYN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-CK5D6TE5.cjs","../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/RadioBox.tsx","../src/RadioBoxes/index.ts"],"names":["jsx","jsxs","RadioBoxes_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;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AA,MACZ,KAAA,EACE,UAAA;AAAA,sBAEEC,8BAAAA,OAAC,EAAA,EACE,QAAA,EAAA;AAAA,QAAA,KAAA;AAAA,QACA,qBAAA,mBAAwBD,6BAAAA,+CAAC,EAAA,EAAsB,OAAA,CAAgB;AAAA,MAAA,EAAA,CAClE,CAAA;AAAA,MAGJ,IAAA;AAAA,MACA,WAAA,EAAa,OAAA,EAAS,aAAA,EAAe,UAAA;AAAA,MACrC,MAAA;AAAA,MACA,GAAA;AAAA,MAEC,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,EAAA,GAAW;AACvB,QAAA,GAAA,CAAI,QAAA,GAAW,MAAA,EAAQ;AACrB,UAAA,MAAM,aAAA,EAAe,iCAAA;AAAA,YACnB,CAAA,EAAA;AACA,YAAA;AACF,UAAA;AACA,UAAA;AACG,YAAA;AAAA,YAAA;AAAA,cAAA;AACa,cAAA;AACC,cAAA;AACO,cAAA;AACP,cAAA;AACoB,cAAA;AAEjC,cAAA;AACc,cAAA;AAEwB,YAAA;AAJjC,YAAA;AAKP,UAAA;AAEJ,QAAA;AACA,QAAA;AACD,MAAA;AAAA,IAAA;AACH,EAAA;AAEJ;AAEO;ADKM;AACA;AG3JNE;AH6JM;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-CK5D6TE5.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n itemBase: '',\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 HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/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 },\n});\n\ntype VariantProps = TVProps<typeof radioBoxesVariants>;\ntype ClassName = TVClassName<typeof radioBoxesVariants>;\n\nexport interface RadioBoxesOption {\n /** Description of the value. Works with variant radioBox. */\n description?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: 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 RadioBoxesProps 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: RadioBoxesOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst RadioBoxes = ({\n className = undefined,\n disabled = false,\n inline = false,\n label = undefined,\n name,\n options,\n testId: _testId = undefined,\n}: RadioBoxesProps): ReactElement => {\n const { control, debugMode, getFieldState, getValues } = useFormContext();\n\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({ control, disabled, name });\n const { onChange, disabled: isDisabled, onBlur, ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\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 };\n\n return (\n <HeroRadioGroup\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultValue={getValues()[name]}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\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 && <FieldCopyTestIdButton testId={testId} />}\n </label>\n )\n }\n name={name}\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n ref={ref}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId || option.value}`,\n { replaceDots: true },\n );\n return (\n <RadioBox\n classNames={itemClassNames}\n data-testid={optionTestId}\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 </HeroRadioGroup>\n );\n};\n\nexport default RadioBoxes;\n","import type { RadioProps as HeroRadioProps } from '@heroui/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface RadioProps extends HeroRadioProps {\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 RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps } from './RadioBoxes';\n\nexport { RadioBoxes };\n\nexport default RadioBoxes;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-TPID3SYN.cjs","../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/RadioBox.tsx","../src/RadioBoxes/index.ts"],"names":["jsx","jsxs","RadioBoxes_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACbA,sCAA6C;AAE7C,oDAAkD;ADclD;AACA;AEjBA;AACA,6DAA+B;AAE/B;AAmCQ,+CAAA;AA5BD,IAAM,SAAA,EAAW,CAAC,EAAA,EAAA,GAA+C;AAA/C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EAAA,EAAsB,OAAA,CAAgB;AAAA,MAAA,EAAA,CAClE,CAAA;AAAA,MAGJ,IAAA;AAAA,MACA,WAAA,EAAa,OAAA,EAAS,aAAA,EAAe,UAAA;AAAA,MACrC,MAAA;AAAA,MACA,GAAA;AAAA,MAEC,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,EAAA,GAAW;AACvB,QAAA,GAAA,CAAI,QAAA,GAAW,MAAA,EAAQ;AACrB,UAAA,MAAM,aAAA,EAAe,iCAAA;AAAA,YACnB,CAAA,EAAA;AACA,YAAA;AACF,UAAA;AACA,UAAA;AACG,YAAA;AAAA,YAAA;AAAA,cAAA;AACa,cAAA;AACC,cAAA;AACO,cAAA;AACP,cAAA;AACoB,cAAA;AAEjC,cAAA;AACc,cAAA;AAEwB,YAAA;AAJjC,YAAA;AAKP,UAAA;AAEJ,QAAA;AACA,QAAA;AACD,MAAA;AAAA,IAAA;AACH,EAAA;AAEJ;AAEO;ADKM;AACA;AG3JNE;AH6JM;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-TPID3SYN.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n itemBase: '',\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 HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/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 },\n});\n\ntype VariantProps = TVProps<typeof radioBoxesVariants>;\ntype ClassName = TVClassName<typeof radioBoxesVariants>;\n\nexport interface RadioBoxesOption {\n /** Description of the value. Works with variant radioBox. */\n description?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: 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 RadioBoxesProps 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: RadioBoxesOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst RadioBoxes = ({\n className = undefined,\n disabled = false,\n inline = false,\n label = undefined,\n name,\n options,\n testId: _testId = undefined,\n}: RadioBoxesProps): ReactElement => {\n const { control, debugMode, getFieldState, getValues } = useFormContext();\n\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({ control, disabled, name });\n const { onChange, disabled: isDisabled, onBlur, ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\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 };\n\n return (\n <HeroRadioGroup\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultValue={getValues()[name]}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\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 && <FieldCopyTestIdButton testId={testId} />}\n </label>\n )\n }\n name={name}\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n ref={ref}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId || option.value}`,\n { replaceDots: true },\n );\n return (\n <RadioBox\n classNames={itemClassNames}\n data-testid={optionTestId}\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 </HeroRadioGroup>\n );\n};\n\nexport default RadioBoxes;\n","import type { RadioProps as HeroRadioProps } from '@heroui/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface RadioProps extends HeroRadioProps {\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 RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps } from './RadioBoxes';\n\nexport { RadioBoxes };\n\nexport default RadioBoxes;\n"]}
|
|
@@ -7,7 +7,7 @@ var _chunkPA2DQCBYcjs = require('./chunk-PA2DQCBY.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkNFMNQHP7cjs = require('./chunk-NFMNQHP7.cjs');
|
|
11
11
|
|
|
12
12
|
// src/Input/Input.tsx
|
|
13
13
|
var _input = require('@heroui/input');
|
|
@@ -26,9 +26,9 @@ var Input = ({
|
|
|
26
26
|
transformValue = void 0,
|
|
27
27
|
type = void 0
|
|
28
28
|
}) => {
|
|
29
|
-
const { control, debugMode, getFieldState } =
|
|
29
|
+
const { control, debugMode, getFieldState } = _chunkNFMNQHP7cjs.useFormContext.call(void 0, );
|
|
30
30
|
const { error, invalid, required, testId } = getFieldState(name, _testId);
|
|
31
|
-
const { field } =
|
|
31
|
+
const { field } = _chunkNFMNQHP7cjs.useController.call(void 0, {
|
|
32
32
|
control,
|
|
33
33
|
disabled,
|
|
34
34
|
name
|
|
@@ -88,4 +88,4 @@ var Input_default2 = Input_default;
|
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
exports.Input_default = Input_default; exports.Input_default2 = Input_default2;
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-XB3XIDVB.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-XB3XIDVB.cjs","../src/Input/Input.tsx","../src/Input/index.ts"],"names":["Input_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,sCAAmC;AAEnC,oDAAmB;AA2HF,+CAAA;AApFjB,IAAM,MAAA,EAAQ,CAAC;AAAA,EACb,UAAA,EAAY,KAAA,CAAA;AAAA,EACZ,SAAA,EAAW,KAAA;AAAA,EACX,WAAA,EAAa,KAAA,CAAA;AAAA,EACb,MAAA,EAAQ,KAAA,CAAA;AAAA,EACR,IAAA;AAAA,EACA,YAAA,EAAc,GAAA;AAAA,EACd,KAAA,EAAO,KAAA,CAAA;AAAA,EACP,aAAA,EAAe,KAAA,CAAA;AAAA,EACf,MAAA,EAAQ,QAAA,EAAU,KAAA,CAAA;AAAA,EAClB,eAAA,EAAiB,KAAA,CAAA;AAAA,EACjB,KAAA,EAAO,KAAA;AACT,CAAA,EAAA,GAAkB;AAChB,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,cAAc,EAAA,EAAI,8CAAA,CAAe;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,QAAA,EAAU,OAAO,EAAA,EAAI,aAAA,CAAc,IAAA,EAAM,OAAO,CAAA;AAExE,EAAA,MAAM,EAAE,MAAM,EAAA,EAAI,6CAAA;AAAc,IA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AC,EAAA,EAAqB,KAAA,EAAc,OAAA,CAAgB,CAAA;AAAA,MAE/D,UAAA;AAAA,MACA,SAAA,EAAW,OAAA;AAAA,MACX,UAAA,EAAY,QAAA;AAAA,MACZ,KAAA,EACE,UAAA,mBACE,8BAAA,oBAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,KAAA;AAAA,QACA,qBAAA,mBAAwB,6BAAA,+CAAC,EAAA,EAAsB,OAAA,CAAgB;AAAA,MAAA,EAAA,CAClE,CAAA;AAAA,MAGJ,cAAA,EAAe,SAAA;AAAA,MACf,IAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA,EAAU,YAAA;AAAA,MACV,WAAA;AAAA,MACA,MAAA,EAAO,IAAA;AAAA,MACP,GAAA;AAAA,MACA,IAAA;AAAA,MACA,YAAA;AAAA,MACA,IAAA;AAAA,MAEA,KAAA,EAAO,YAAA;AAAA,MACP,OAAA,EAAQ;AAAA,IAAA;AAAA,EACV,CAAA;AAEJ,CAAA;AAEA,IAAO,cAAA,EAAQ,KAAA;AD3Ef;AACA;AE7EA,IAAOA,eAAAA,EAAQ,aAAA;AF+Ef;AACA;AACE;AACA;AACF,+EAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-XB3XIDVB.cjs","sourcesContent":[null,"import type { ReactNode } from 'react';\n\nimport { Input as HeroInput } from '@heroui/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface InputProps {\n /** CSS class name */\n className?: string;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label (set to false to disable label) */\n label?: string | false;\n /** form field name */\n name: string;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transformValue?: {\n /** transforms the formValue of the field to the display value of the field */\n displayValue: (value: string | number) => string | number;\n /** transforms the displayValue of the field to the form value of the field */\n formValue: (value: string) => string | number;\n };\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className = undefined,\n disabled = false,\n endContent = undefined,\n label = undefined,\n name,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n testId: _testId = undefined,\n transformValue = undefined,\n type = undefined,\n}: InputProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const { field } = useController({\n control,\n disabled,\n name,\n });\n\n const { disabled: isDisabled, onChange, onBlur, value, ref } = field;\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n /**\n * Determines the display value for the input field:\n * 1. If transformValue.displayValue is provided, applies the transform to the current value\n * (useful for formatting like adding currency symbols, date formatting, etc.)\n * 2. Falls back to the raw value if no transform is provided\n * 3. Ensures a defined value by using empty string as fallback (prevents uncontrolled input warnings)\n *\n * Examples:\n * - With transform: value \"1000\" → displayValue \"$1,000\"\n * - Without transform: value \"1000\" → displayValue \"1000\"\n * - Undefined value: value undefined → displayValue \"\"\n */\n const displayValue = transformValue?.displayValue\n ? transformValue.displayValue(value ?? '')\n : (value ?? '');\n\n /**\n * Handles input value changes with special processing:\n * 1. For number inputs:\n * - Preserves empty string (prevents NaN in the form state)\n * - Converts non-empty values to numbers\n * Example: \"\" → \"\" (empty stays empty)\n * \"42\" → 42 (converts to number)\n *\n * 2. For text inputs with transformValue.formValue:\n * - Applies custom transform before updating form state\n * - Useful for converting display format to storage format\n * Example: \"$1,000\" → \"1000\" (strips formatting)\n *\n * 3. For regular text inputs:\n * - Passes through the raw input value\n * Example: \"hello\" → \"hello\" (no transformation)\n *\n * @param e The input change event\n */\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n if (type === 'number') {\n onChange(inputValue === '' ? '' : Number(inputValue));\n } else {\n onChange(\n transformValue?.formValue\n ? transformValue.formValue(inputValue)\n : inputValue,\n );\n }\n };\n\n return (\n <HeroInput\n className={cn(className)}\n classNames={{\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n }}\n data-testid={testId}\n endContent={endContent}\n errorMessage={\n error && <FieldValidationError error={error} testId={testId} />\n }\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n <>\n {label}\n {showTestIdCopyButton && <FieldCopyTestIdButton testId={testId} />}\n </>\n )\n }\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholder={placeholder}\n radius=\"sm\"\n ref={ref}\n size={size}\n startContent={startContent}\n type={type}\n // @ts-expect-error number is ok here\n value={displayValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkNFMNQHP7cjs = require('./chunk-NFMNQHP7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkCESGUF6Fcjs = require('./chunk-CESGUF6F.cjs');
|
|
@@ -27,7 +27,7 @@ var FormDebugViewer = ({ className = void 0 }) => {
|
|
|
27
27
|
setDebugMode,
|
|
28
28
|
subscribe,
|
|
29
29
|
validation: { errors }
|
|
30
|
-
} =
|
|
30
|
+
} = _chunkNFMNQHP7cjs.useFormContext.call(void 0, );
|
|
31
31
|
const showDebugButton = debugMode === "off";
|
|
32
32
|
const showDebugCard = debugMode === "debug" || debugMode === "debug-testids";
|
|
33
33
|
const showDebugTestIds = debugMode === "debug-testids";
|
|
@@ -119,7 +119,7 @@ var Form = ({
|
|
|
119
119
|
validationTrigger = "all"
|
|
120
120
|
}) => {
|
|
121
121
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
122
|
-
|
|
122
|
+
_chunkNFMNQHP7cjs.FormContext_default,
|
|
123
123
|
{
|
|
124
124
|
debugModeSettings: debug,
|
|
125
125
|
initialValues,
|
|
@@ -152,4 +152,4 @@ var Form_default2 = Form_default;
|
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
exports.Form_default = Form_default; exports.Form_default2 = Form_default2;
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-YCM5J5E4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-YCM5J5E4.cjs","../src/Form/Form.tsx","../src/Form/subcomponents/FormDebugViewer.tsx","../src/Form/index.ts"],"names":["jsx","jsxs","cn","Form_default"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACHA,oDAA4B;ADK5B;AACA;AEVA,8BAAoC;AACpC,oCAAwB;AACxB,sCAAkC;AAElC;AACA,kDAAuB;AACvB,8CAAqB;AACrB,8CAAqB;AAMrB,sCAAO;AAkDO,+CAAA;AA1Cd,IAAM,gBAAA,EAAkB,CAAC,EAAE,UAAA,EAAY,KAAA,EAAU,CAAA,EAAA,GAA4B;AAC3E,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,SAAA,EAAW,EAAE,OAAA,EAAS,aAAa,CAAA;AAAA,IACnC,SAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA,EAAY,EAAE,OAAO;AAAA,EACvB,EAAA,EAAI,8CAAA,CAAe;AAEnB,EAAA,MA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IAAO,aAAA,EAAQ,IAAA;ADsEf;AACA;AG7IA,IAAOG,cAAAA,EAAQ,YAAA;AH+If;AACA;AACE;AACA;AACF,2EAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-YCM5J5E4.cjs","sourcesContent":[null,"import type { VetoInstance } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\nimport type { DebugModeSettings } from './subcomponents/FormContext';\n\nimport { cn, slugify } from '@fuf-stack/pixel-utils';\n\nimport FormProvider from './subcomponents/FormContext';\nimport FormDebugViewer from './subcomponents/FormDebugViewer';\n\nconst IS_TEST = process.env.NODE_ENV === 'test';\n\nexport interface FormProps {\n /** form children */\n children: ReactNode | ReactNode[];\n /** CSS class name */\n className?: string | string[];\n /** settings for from debug mode */\n debug?: DebugModeSettings;\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 debug = undefined,\n initialValues = undefined,\n name = undefined,\n onSubmit,\n testId = undefined,\n validation = undefined,\n validationTrigger = 'all',\n}: FormProps) => {\n return (\n <FormProvider\n debugModeSettings={debug}\n initialValues={initialValues}\n onSubmit={onSubmit}\n validation={validation}\n validationTrigger={validationTrigger}\n >\n {({ handleSubmit, isValid }) => (\n <div className=\"flex w-full flex-row justify-between gap-6\">\n <form\n className={cn('flex-grow', className)}\n data-form-is-valid={isValid}\n data-testid={slugify(testId || name || '')}\n name={name}\n onSubmit={handleSubmit}\n >\n {children}\n </form>\n {/* render debug viewer when not in test environment and debug not disabled */}\n {!IS_TEST && !debug?.disable && (\n <FormDebugViewer className=\"w-96 flex-shrink\" />\n )}\n </div>\n )}\n </FormProvider>\n );\n};\n\nexport default Form;\n","/* eslint-disable react/prop-types */\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 } from '@fuf-stack/pixels/Button';\nimport { Card } from '@fuf-stack/pixels/Card';\nimport { Json } from '@fuf-stack/pixels/Json';\n\nimport { toValidationFormat } from '../../helpers';\nimport { useFormContext } from '../../hooks';\n\n// import Json css (theme)\nimport '@fuf-stack/pixels/Json.css';\n\ninterface FormDebugViewerProps {\n /** CSS class name */\n className?: string;\n}\n\n/** Renders a form debug panel with information about the current form state */\nconst FormDebugViewer = ({ className = undefined }: FormDebugViewerProps) => {\n const {\n debugMode,\n formState: { isValid, isSubmitting },\n getValues,\n setDebugMode,\n subscribe,\n validation: { errors },\n } = useFormContext();\n\n const showDebugButton = debugMode === 'off';\n const showDebugCard = debugMode === 'debug' || debugMode === 'debug-testids';\n const showDebugTestIds = debugMode === 'debug-testids';\n\n const [validationValues, setValidationValues] = useState<Record<\n string,\n unknown\n > | null>(getValues() || null);\n\n // Subscribe to value updates only when needed and cleanup properly\n useEffect(() => {\n if (!showDebugCard) {\n return undefined;\n }\n\n const unsubscribe = subscribe({\n formState: { values: true },\n callback: ({ values }) => {\n setValidationValues(toValidationFormat(values));\n },\n });\n\n return unsubscribe;\n }, [showDebugCard, subscribe]);\n\n if (showDebugButton) {\n return (\n <Button\n ariaLabel=\"Enable form debug mode\"\n onClick={() => setDebugMode('debug')}\n className=\"fixed bottom-2.5 right-2.5 w-5 text-default-400\"\n variant=\"light\"\n icon={<FaBug />}\n />\n );\n }\n\n // do not show card\n if (!showDebugCard) {\n return null;\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 color=\"danger\"\n icon={<FaTimes />}\n onClick={() => setDebugMode('off')}\n size=\"sm\"\n variant=\"light\"\n />\n </div>\n }\n >\n <Button\n variant={showDebugTestIds ? 'solid' : 'light'}\n icon={<FaBullseye />}\n className=\"mb-4 ml-auto mr-auto\"\n onClick={() =>\n setDebugMode(debugMode === 'debug' ? 'debug-testids' : 'debug')\n }\n >\n {showDebugTestIds ? 'Hide CopyButton' : 'Show CopyButton'}\n </Button>\n <Json\n value={{\n values: validationValues,\n errors: errors || null,\n isValid,\n isSubmitting,\n }}\n />\n </Card>\n );\n};\n\nexport default FormDebugViewer;\n","import Form from './Form';\n\nexport type { FormProps } from './Form';\n\nexport { Form };\n\nexport default Form;\n"]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
useController,
|
|
9
9
|
useFormContext
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MC56FOMX.js";
|
|
11
11
|
|
|
12
12
|
// src/RadioGroup/RadioGroup.tsx
|
|
13
13
|
import { RadioGroup as HeroRadioGroup, Radio } from "@heroui/radio";
|
|
@@ -109,4 +109,4 @@ export {
|
|
|
109
109
|
RadioGroup_default,
|
|
110
110
|
RadioGroup_default2
|
|
111
111
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
112
|
+
//# sourceMappingURL=chunk-YQQ3DYKS.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
useController,
|
|
9
9
|
useFormContext
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MC56FOMX.js";
|
|
11
11
|
import {
|
|
12
12
|
__objRest,
|
|
13
13
|
__spreadProps,
|
|
@@ -166,4 +166,4 @@ export {
|
|
|
166
166
|
RadioBoxes_default,
|
|
167
167
|
RadioBoxes_default2
|
|
168
168
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-ZRI45CRF.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useFieldArray,
|
|
12
12
|
useFormContext,
|
|
13
13
|
useInput
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MC56FOMX.js";
|
|
15
15
|
import {
|
|
16
16
|
toNullishString
|
|
17
17
|
} from "./chunk-UAV6PVB4.js";
|
|
@@ -383,4 +383,4 @@ export {
|
|
|
383
383
|
FieldArray_default,
|
|
384
384
|
FieldArray_default2
|
|
385
385
|
};
|
|
386
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-ZZ72IA34.js.map
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkNFMNQHP7cjs = require('../chunk-NFMNQHP7.cjs');
|
|
9
9
|
require('../chunk-CESGUF6F.cjs');
|
|
10
10
|
require('../chunk-555JRYCS.cjs');
|
|
11
11
|
|
|
@@ -15,5 +15,5 @@ require('../chunk-555JRYCS.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.checkFieldIsRequired =
|
|
18
|
+
exports.checkFieldIsRequired = _chunkNFMNQHP7cjs.checkFieldIsRequired; exports.useClientValidation = _chunkNFMNQHP7cjs.useClientValidation; exports.useController = _chunkNFMNQHP7cjs.useController; exports.useFieldArray = _chunkNFMNQHP7cjs.useFieldArray; exports.useFormContext = _chunkNFMNQHP7cjs.useFormContext; exports.useInput = _chunkNFMNQHP7cjs.useInput;
|
|
19
19
|
//# sourceMappingURL=index.cjs.map
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _fuf_stack_veto from '@fuf-stack/veto';
|
|
2
2
|
import { VetoTypeAny, VetoInstance } from '@fuf-stack/veto';
|
|
3
3
|
import * as react_hook_form from 'react-hook-form';
|
|
4
|
-
import { UseControllerProps as UseControllerProps$1, ControllerRenderProps, UseFormStateReturn, ControllerFieldState, FieldError } from 'react-hook-form';
|
|
4
|
+
import { UseControllerProps as UseControllerProps$1, ControllerRenderProps, UseFormStateReturn, ControllerFieldState, FieldValues, Path, FieldError } from 'react-hook-form';
|
|
5
5
|
export { useFieldArray } from 'react-hook-form';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { D as DebugModeSettings } from '../FormContext-ldCpxKnY.cjs';
|
|
@@ -65,8 +65,8 @@ declare const checkFieldIsRequired: (validation: VetoInstance, path: string[]) =
|
|
|
65
65
|
/**
|
|
66
66
|
* Custom hook that extends react-hook-form's useFormContext to add validation and state management.
|
|
67
67
|
*/
|
|
68
|
-
declare const useFormContext: () => {
|
|
69
|
-
getFieldState: (name:
|
|
68
|
+
declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>() => {
|
|
69
|
+
getFieldState: (name: Path<TFieldValues>, testId?: string) => {
|
|
70
70
|
error: FieldError[] | undefined;
|
|
71
71
|
required: boolean;
|
|
72
72
|
testId: string;
|
|
@@ -75,7 +75,7 @@ declare const useFormContext: () => {
|
|
|
75
75
|
isTouched: boolean;
|
|
76
76
|
isValidating: boolean;
|
|
77
77
|
};
|
|
78
|
-
formState: react_hook_form.FormState<
|
|
78
|
+
formState: react_hook_form.FormState<TFieldValues>;
|
|
79
79
|
debugMode: "debug" | "debug-testids" | "off" | "disabled";
|
|
80
80
|
debugModeSettings?: DebugModeSettings;
|
|
81
81
|
preventSubmit: (prevent: boolean) => void;
|
|
@@ -86,20 +86,20 @@ declare const useFormContext: () => {
|
|
|
86
86
|
errors?: _fuf_stack_veto.VetoFormattedError;
|
|
87
87
|
setClientValidationSchema: (key: string, schema: _fuf_stack_veto.VetoTypeAny | null) => void;
|
|
88
88
|
};
|
|
89
|
-
watch: react_hook_form.UseFormWatch<
|
|
90
|
-
getValues: react_hook_form.UseFormGetValues<
|
|
91
|
-
setError: react_hook_form.UseFormSetError<
|
|
92
|
-
clearErrors: react_hook_form.UseFormClearErrors<
|
|
93
|
-
setValue: react_hook_form.UseFormSetValue<
|
|
94
|
-
trigger: react_hook_form.UseFormTrigger<
|
|
95
|
-
resetField: react_hook_form.UseFormResetField<
|
|
96
|
-
reset: react_hook_form.UseFormReset<
|
|
97
|
-
handleSubmit: react_hook_form.UseFormHandleSubmit<
|
|
98
|
-
unregister: react_hook_form.UseFormUnregister<
|
|
99
|
-
control: react_hook_form.Control<
|
|
100
|
-
register: react_hook_form.UseFormRegister<
|
|
101
|
-
setFocus: react_hook_form.UseFormSetFocus<
|
|
102
|
-
subscribe: react_hook_form.UseFromSubscribe<
|
|
89
|
+
watch: react_hook_form.UseFormWatch<TFieldValues>;
|
|
90
|
+
getValues: react_hook_form.UseFormGetValues<TFieldValues>;
|
|
91
|
+
setError: react_hook_form.UseFormSetError<TFieldValues>;
|
|
92
|
+
clearErrors: react_hook_form.UseFormClearErrors<TFieldValues>;
|
|
93
|
+
setValue: react_hook_form.UseFormSetValue<TFieldValues>;
|
|
94
|
+
trigger: react_hook_form.UseFormTrigger<TFieldValues>;
|
|
95
|
+
resetField: react_hook_form.UseFormResetField<TFieldValues>;
|
|
96
|
+
reset: react_hook_form.UseFormReset<TFieldValues>;
|
|
97
|
+
handleSubmit: react_hook_form.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
98
|
+
unregister: react_hook_form.UseFormUnregister<TFieldValues>;
|
|
99
|
+
control: react_hook_form.Control<TFieldValues, TContext, TTransformedValues>;
|
|
100
|
+
register: react_hook_form.UseFormRegister<TFieldValues>;
|
|
101
|
+
setFocus: react_hook_form.UseFormSetFocus<TFieldValues>;
|
|
102
|
+
subscribe: react_hook_form.UseFromSubscribe<TFieldValues>;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
export { type UseControllerProps, type UseControllerReturn, checkFieldIsRequired, useClientValidation, useController, useFormContext };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _fuf_stack_veto from '@fuf-stack/veto';
|
|
2
2
|
import { VetoTypeAny, VetoInstance } from '@fuf-stack/veto';
|
|
3
3
|
import * as react_hook_form from 'react-hook-form';
|
|
4
|
-
import { UseControllerProps as UseControllerProps$1, ControllerRenderProps, UseFormStateReturn, ControllerFieldState, FieldError } from 'react-hook-form';
|
|
4
|
+
import { UseControllerProps as UseControllerProps$1, ControllerRenderProps, UseFormStateReturn, ControllerFieldState, FieldValues, Path, FieldError } from 'react-hook-form';
|
|
5
5
|
export { useFieldArray } from 'react-hook-form';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { D as DebugModeSettings } from '../FormContext-ldCpxKnY.js';
|
|
@@ -65,8 +65,8 @@ declare const checkFieldIsRequired: (validation: VetoInstance, path: string[]) =
|
|
|
65
65
|
/**
|
|
66
66
|
* Custom hook that extends react-hook-form's useFormContext to add validation and state management.
|
|
67
67
|
*/
|
|
68
|
-
declare const useFormContext: () => {
|
|
69
|
-
getFieldState: (name:
|
|
68
|
+
declare const useFormContext: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>() => {
|
|
69
|
+
getFieldState: (name: Path<TFieldValues>, testId?: string) => {
|
|
70
70
|
error: FieldError[] | undefined;
|
|
71
71
|
required: boolean;
|
|
72
72
|
testId: string;
|
|
@@ -75,7 +75,7 @@ declare const useFormContext: () => {
|
|
|
75
75
|
isTouched: boolean;
|
|
76
76
|
isValidating: boolean;
|
|
77
77
|
};
|
|
78
|
-
formState: react_hook_form.FormState<
|
|
78
|
+
formState: react_hook_form.FormState<TFieldValues>;
|
|
79
79
|
debugMode: "debug" | "debug-testids" | "off" | "disabled";
|
|
80
80
|
debugModeSettings?: DebugModeSettings;
|
|
81
81
|
preventSubmit: (prevent: boolean) => void;
|
|
@@ -86,20 +86,20 @@ declare const useFormContext: () => {
|
|
|
86
86
|
errors?: _fuf_stack_veto.VetoFormattedError;
|
|
87
87
|
setClientValidationSchema: (key: string, schema: _fuf_stack_veto.VetoTypeAny | null) => void;
|
|
88
88
|
};
|
|
89
|
-
watch: react_hook_form.UseFormWatch<
|
|
90
|
-
getValues: react_hook_form.UseFormGetValues<
|
|
91
|
-
setError: react_hook_form.UseFormSetError<
|
|
92
|
-
clearErrors: react_hook_form.UseFormClearErrors<
|
|
93
|
-
setValue: react_hook_form.UseFormSetValue<
|
|
94
|
-
trigger: react_hook_form.UseFormTrigger<
|
|
95
|
-
resetField: react_hook_form.UseFormResetField<
|
|
96
|
-
reset: react_hook_form.UseFormReset<
|
|
97
|
-
handleSubmit: react_hook_form.UseFormHandleSubmit<
|
|
98
|
-
unregister: react_hook_form.UseFormUnregister<
|
|
99
|
-
control: react_hook_form.Control<
|
|
100
|
-
register: react_hook_form.UseFormRegister<
|
|
101
|
-
setFocus: react_hook_form.UseFormSetFocus<
|
|
102
|
-
subscribe: react_hook_form.UseFromSubscribe<
|
|
89
|
+
watch: react_hook_form.UseFormWatch<TFieldValues>;
|
|
90
|
+
getValues: react_hook_form.UseFormGetValues<TFieldValues>;
|
|
91
|
+
setError: react_hook_form.UseFormSetError<TFieldValues>;
|
|
92
|
+
clearErrors: react_hook_form.UseFormClearErrors<TFieldValues>;
|
|
93
|
+
setValue: react_hook_form.UseFormSetValue<TFieldValues>;
|
|
94
|
+
trigger: react_hook_form.UseFormTrigger<TFieldValues>;
|
|
95
|
+
resetField: react_hook_form.UseFormResetField<TFieldValues>;
|
|
96
|
+
reset: react_hook_form.UseFormReset<TFieldValues>;
|
|
97
|
+
handleSubmit: react_hook_form.UseFormHandleSubmit<TFieldValues, TTransformedValues>;
|
|
98
|
+
unregister: react_hook_form.UseFormUnregister<TFieldValues>;
|
|
99
|
+
control: react_hook_form.Control<TFieldValues, TContext, TTransformedValues>;
|
|
100
|
+
register: react_hook_form.UseFormRegister<TFieldValues>;
|
|
101
|
+
setFocus: react_hook_form.UseFormSetFocus<TFieldValues>;
|
|
102
|
+
subscribe: react_hook_form.UseFromSubscribe<TFieldValues>;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
export { type UseControllerProps, type UseControllerReturn, checkFieldIsRequired, useClientValidation, useController, useFormContext };
|