@trackunit/react-form-components 1.8.63 → 1.8.65
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/index.cjs.js +1394 -1326
- package/index.esm.js +1395 -1328
- package/package.json +2 -2
- package/src/components/{Select/Select.d.ts → BaseSelect/BaseSelect.d.ts} +3 -2
- package/src/components/{Select → BaseSelect}/index.d.ts +2 -2
- package/src/components/MultiSelectField/FormFieldSelectAdapterMulti.d.ts +59 -0
- package/src/components/MultiSelectField/MultiSelectField.d.ts +10 -0
- package/src/components/MultiSelectField/index.d.ts +1 -0
- package/src/components/SelectField/CreatableSelectField.d.ts +1 -1
- package/src/components/SelectField/FormFieldSelectAdapter.d.ts +1 -1
- package/src/index.d.ts +2 -1
- /package/src/components/{Select/Select.variants.d.ts → BaseSelect/BaseSelect.variants.d.ts} +0 -0
- /package/src/components/{Select → BaseSelect}/CreatableSelect.d.ts +0 -0
- /package/src/components/{Select → BaseSelect}/SelectMenuItem/SelectMenuItem.d.ts +0 -0
- /package/src/components/{Select → BaseSelect}/TagWithWidth.d.ts +0 -0
- /package/src/components/{Select → BaseSelect}/TagsContainer.d.ts +0 -0
- /package/src/components/{Select → BaseSelect}/useCustomComponents.d.ts +0 -0
- /package/src/components/{Select → BaseSelect}/useCustomStyles.d.ts +0 -0
- /package/src/components/{Select → BaseSelect}/useSelect.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.65",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@trackunit/ui-icons": "1.7.44",
|
|
22
22
|
"@trackunit/shared-utils": "1.9.43",
|
|
23
23
|
"@trackunit/ui-design-tokens": "1.7.43",
|
|
24
|
-
"@trackunit/i18n-library-translation": "1.7.
|
|
24
|
+
"@trackunit/i18n-library-translation": "1.7.52",
|
|
25
25
|
"string-ts": "^2.0.0",
|
|
26
26
|
"@trackunit/react-test-setup": "1.4.43",
|
|
27
27
|
"@js-temporal/polyfill": "^0.5.1"
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
1
2
|
import { GroupBase } from "react-select";
|
|
2
3
|
import { SelectProps } from "./useSelect";
|
|
3
4
|
export interface SelectOption<TValue extends string> {
|
|
@@ -11,7 +12,7 @@ export interface SelectOption<TValue extends string> {
|
|
|
11
12
|
* @param {SelectProps} props - The props for the Select component
|
|
12
13
|
* @returns {ReactElement} Select component
|
|
13
14
|
*/
|
|
14
|
-
export declare const
|
|
15
|
-
<Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: SelectProps<Option, IsAsync, IsMulti, Group>):
|
|
15
|
+
export declare const BaseSelect: {
|
|
16
|
+
<Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: SelectProps<Option, IsAsync, IsMulti, Group>): ReactElement;
|
|
16
17
|
displayName: string;
|
|
17
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ValueType from "react-select";
|
|
2
|
+
export * from "./BaseSelect";
|
|
3
|
+
export * from "./BaseSelect.variants";
|
|
2
4
|
export * from "./CreatableSelect";
|
|
3
|
-
export * from "./Select";
|
|
4
|
-
export * from "./Select.variants";
|
|
5
5
|
export * from "./SelectMenuItem/SelectMenuItem";
|
|
6
6
|
export * from "./useCustomComponents";
|
|
7
7
|
export { ValueType };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
+
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
|
+
import { FocusEvent, ReactNode, Ref } from "react";
|
|
4
|
+
import { GroupBase, MultiValue } from "react-select";
|
|
5
|
+
import { SelectProps } from "../BaseSelect/useSelect";
|
|
6
|
+
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
7
|
+
/**
|
|
8
|
+
* NOTE: Single and multi adapters are intentionally separate.
|
|
9
|
+
* Single uses a primitive value model and a real hidden <select> with <option>s,
|
|
10
|
+
* dispatching native "change" events for RHF/native forms and supporting a backup option.
|
|
11
|
+
* Multi uses MultiValue<Option> and different hidden inputs semantics.
|
|
12
|
+
* Unifying would increase conditional logic and reduce clarity.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Generic over `Option` to mirror BaseSelect typing.
|
|
16
|
+
* Multi-value uses `MultiValue<Option>` from react-select.
|
|
17
|
+
*/
|
|
18
|
+
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon" | "isInvalid">;
|
|
19
|
+
/** Allow all BaseSelect props except those we adapt/wrap here */
|
|
20
|
+
type SelectExposedProps<Option> = MappedOmit<SelectProps<Option, false, true, GroupBase<Option>>, "label" | "hasError" | "onBlur" | "options" | "value" | "defaultValue" | "onChange" | "isMulti" | "id">;
|
|
21
|
+
export type MultiSelectFieldProps<Option> = CommonProps & FormGroupExposedProps & SelectExposedProps<Option> & {
|
|
22
|
+
/** RHF/native-friendly blur signature */
|
|
23
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
24
|
+
/** Options to render (same shape as BaseSelect) */
|
|
25
|
+
options: Array<Option>;
|
|
26
|
+
/** Multi-value from react-select */
|
|
27
|
+
value?: MultiValue<Option> | null;
|
|
28
|
+
/** Default selected options (MultiValue) */
|
|
29
|
+
defaultValue?: MultiValue<Option>;
|
|
30
|
+
/** onChange passes MultiValue<Option> (or null when cleared) */
|
|
31
|
+
onChange?: (value: MultiValue<Option> | null) => void;
|
|
32
|
+
/** Invalid state message rendered via FormGroup */
|
|
33
|
+
errorMessage?: string;
|
|
34
|
+
/** External ref target (points to the hidden <select /> below) */
|
|
35
|
+
ref?: Ref<HTMLSelectElement>;
|
|
36
|
+
/** Name used for optional hidden inputs when `getOptionValue` is provided */
|
|
37
|
+
name?: string;
|
|
38
|
+
/** Field id; also propagated to BaseSelect via child props */
|
|
39
|
+
id?: string;
|
|
40
|
+
};
|
|
41
|
+
interface FormFieldSelectAdapterMultiProps<Option> extends MultiSelectFieldProps<Option> {
|
|
42
|
+
/**
|
|
43
|
+
* Child render-prop receives exact BaseSelect props specialized for multi.
|
|
44
|
+
*/
|
|
45
|
+
children: (props: SelectProps<Option, false, true, GroupBase<Option>>) => ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Multi adapter:
|
|
49
|
+
* - keeps Option[] semantics (via `MultiValue<Option>`)
|
|
50
|
+
* - renders FormGroup chrome (label, help, error)
|
|
51
|
+
* - exposes a hidden <select> for a stable ref target
|
|
52
|
+
* - optionally renders one hidden <input> per selected option IF `getOptionValue` is provided
|
|
53
|
+
* - passes through all remaining BaseSelect props with isMulti=true
|
|
54
|
+
*/
|
|
55
|
+
export declare const FormFieldSelectAdapterMulti: {
|
|
56
|
+
<Option>(props: FormFieldSelectAdapterMultiProps<Option>): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
displayName: string;
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MultiSelectFieldProps } from "./FormFieldSelectAdapterMulti";
|
|
2
|
+
/**
|
|
3
|
+
* MultiSelectField — validated multi-select field.
|
|
4
|
+
* Types mirror BaseSelect: options: Option[], value/defaultValue: Option[], onChange: (Option[] | null) => void
|
|
5
|
+
* Implemented as a generic const component (no forwardRef, no assertions).
|
|
6
|
+
*/
|
|
7
|
+
export declare const MultiSelectField: {
|
|
8
|
+
<Option>({ ref, ...props }: MultiSelectFieldProps<Option>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MultiSelectField";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreatableSelectProps } from "../
|
|
1
|
+
import { CreatableSelectProps } from "../BaseSelect/CreatableSelect";
|
|
2
2
|
import { BaseOptionType, SelectFieldProps } from "./FormFieldSelectAdapter";
|
|
3
3
|
interface CreatableSelectFieldProps extends SelectFieldProps<BaseOptionType>, CreatableSelectProps {
|
|
4
4
|
}
|
|
@@ -2,8 +2,8 @@ import { CommonProps } from "@trackunit/react-components";
|
|
|
2
2
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
3
|
import { FocusEvent, ReactNode, Ref } from "react";
|
|
4
4
|
import { GroupBase } from "react-select";
|
|
5
|
+
import { SelectProps } from "../BaseSelect/useSelect";
|
|
5
6
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
6
|
-
import { SelectProps } from "../Select/useSelect";
|
|
7
7
|
export type BaseOptionType = {
|
|
8
8
|
label: string;
|
|
9
9
|
value: string | number;
|
package/src/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./components/TextAreaField/TextArea/TextAreaBaseInput";
|
|
|
5
5
|
export * from "./components/TextField/TextBaseInput/TextBaseInput";
|
|
6
6
|
export * from "./components/ActionButton";
|
|
7
7
|
export * from "./components/BaseInput";
|
|
8
|
+
export * from "./components/BaseSelect";
|
|
8
9
|
export * from "./components/Checkbox";
|
|
9
10
|
export * from "./components/CheckboxField/CheckboxField";
|
|
10
11
|
export * from "./components/ColorField/ColorField";
|
|
@@ -14,6 +15,7 @@ export * from "./components/DropZone/DropZoneDefaultLabel";
|
|
|
14
15
|
export * from "./components/EmailField/EmailField";
|
|
15
16
|
export * from "./components/FormGroup/FormGroup";
|
|
16
17
|
export * from "./components/Label";
|
|
18
|
+
export * from "./components/MultiSelectField";
|
|
17
19
|
export * from "./components/NumberField/NumberField";
|
|
18
20
|
export * from "./components/OptionCard/OptionCard";
|
|
19
21
|
export * from "./components/PasswordField/PasswordBaseInput/PasswordBaseInput";
|
|
@@ -26,7 +28,6 @@ export * from "./components/RadioGroup";
|
|
|
26
28
|
export * from "./components/Schedule/Schedule";
|
|
27
29
|
export * from "./components/Schedule/ScheduleParser";
|
|
28
30
|
export * from "./components/Search";
|
|
29
|
-
export * from "./components/Select";
|
|
30
31
|
export * from "./components/SelectField/CreatableSelectField";
|
|
31
32
|
export * from "./components/SelectField/FormFieldSelectAdapter";
|
|
32
33
|
export * from "./components/SelectField/SelectField";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|