@availity/mui-controlled-form 1.2.10 → 1.3.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.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +39 -24
- package/dist/index.d.ts +39 -24
- package/dist/index.js +192 -196
- package/dist/index.mjs +192 -196
- package/package.json +5 -5
- package/src/lib/AsyncAutocomplete.tsx +13 -6
- package/src/lib/Autocomplete.tsx +10 -6
- package/src/lib/Checkbox.tsx +8 -7
- package/src/lib/CodesAutocomplete.tsx +15 -20
- package/src/lib/Datepicker.stories.tsx +61 -5
- package/src/lib/Datepicker.tsx +13 -7
- package/src/lib/Input.tsx +9 -5
- package/src/lib/OrganizationAutocomplete.tsx +15 -20
- package/src/lib/ProviderAutocomplete.tsx +12 -20
- package/src/lib/RadioGroup.tsx +12 -5
- package/src/lib/Select.tsx +12 -5
- package/src/lib/TextField.tsx +9 -5
- package/src/lib/Types.tsx +15 -1
package/src/lib/Types.tsx
CHANGED
|
@@ -33,9 +33,22 @@ export type ControllerProps = {
|
|
|
33
33
|
shouldUnregister?: MuiControllerProps['shouldUnregister'];
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
export type TransformProp<Input = string, Output = string> = {
|
|
37
|
+
/** Object containing functions to parse the input value and format the output value. Useful for converting values from API responses to display values and back.
|
|
38
|
+
* - `input`: Function to transform the value from the underlying data to the input value.
|
|
39
|
+
* - `output`: Function to transform the value from the input to the underlying data.
|
|
40
|
+
*
|
|
41
|
+
* Example: The input always expects a dayjs object, but your endpoint expects and returns a string:
|
|
42
|
+
* `{ input: (value) => value ? dayjs(value) : null, output: (value) => value.format('YYYY-MM-DD') }`
|
|
43
|
+
*/
|
|
44
|
+
transform?: { input?: (value: Output) => Input; output?: (value: Input) => Output };
|
|
45
|
+
};
|
|
46
|
+
|
|
36
47
|
// Storybook Categories
|
|
37
48
|
|
|
38
|
-
type AllControllerProps = ControllerProps &
|
|
49
|
+
type AllControllerProps = ControllerProps &
|
|
50
|
+
Pick<RegisterOptions<FieldValues, string>, 'onBlur' | 'onChange' | 'value'> &
|
|
51
|
+
TransformProp;
|
|
39
52
|
|
|
40
53
|
type CategorizedControllerPropsObject = Record<keyof AllControllerProps, { table: { category: 'Controller Props' } }>;
|
|
41
54
|
|
|
@@ -185,6 +198,7 @@ export const AllControllerPropertiesCategorized: CategorizedControllerPropsObjec
|
|
|
185
198
|
value: { table: { category: 'Controller Props' } },
|
|
186
199
|
rules: { table: { category: 'Controller Props' } },
|
|
187
200
|
shouldUnregister: { table: { category: 'Controller Props' } },
|
|
201
|
+
transform: { table: { category: 'Controller Props' } },
|
|
188
202
|
};
|
|
189
203
|
|
|
190
204
|
export const TextFieldPropsCategorized: TextFieldPropsObject = {
|