@trackunit/react-form-components 2.1.60 → 2.1.62
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 +12 -17
- package/index.esm.js +12 -17
- package/package.json +8 -8
- package/src/components/BaseSelect/custom-components/SelectMenuItem/MultiSelectMenuItem.d.ts +6 -0
- package/src/components/BaseSelect/custom-components/SelectMenuItem/SelectMenuItem.d.ts +2 -64
- package/src/components/BaseSelect/custom-components/SelectMenuItem/selectMenuItemTypes.d.ts +29 -0
package/index.cjs.js
CHANGED
|
@@ -1964,25 +1964,8 @@ const Checkbox = ({ className, "data-testid": dataTestId = "checkbox", onChange,
|
|
|
1964
1964
|
};
|
|
1965
1965
|
Checkbox.displayName = "Checkbox";
|
|
1966
1966
|
|
|
1967
|
-
/**
|
|
1968
|
-
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
1969
|
-
*
|
|
1970
|
-
* @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
|
|
1971
|
-
* @returns {ReactElement} SingleSelectMenuItem
|
|
1972
|
-
*/
|
|
1973
|
-
const SingleSelectMenuItem = ({ label, icon, onClick, selected = false, focused = false, disabled = false, "data-testid": dataTestId, optionLabelDescription, optionPrefix, optionContent, fieldSize = "medium", }) => {
|
|
1974
|
-
return (jsxRuntime.jsx(reactComponents.MenuItem, { "data-testid": dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, optionPrefix: react.isValidElement(optionPrefix)
|
|
1975
|
-
? react.cloneElement(optionPrefix, {
|
|
1976
|
-
className: "mr-1 flex items-center",
|
|
1977
|
-
size: "medium",
|
|
1978
|
-
})
|
|
1979
|
-
: optionPrefix, prefix: icon, selected: selected, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { color: "primary", name: "Check", size: fieldSize === "large" ? "medium" : "small" }) : undefined, children: optionContent }));
|
|
1980
|
-
};
|
|
1981
1967
|
/**
|
|
1982
1968
|
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
1983
|
-
*
|
|
1984
|
-
* @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
|
|
1985
|
-
* @returns {ReactElement} multi select menu item
|
|
1986
1969
|
*/
|
|
1987
1970
|
const MultiSelectMenuItem = ({ label, onClick, selected, focused, "data-testid": dataTestId, disabled, optionLabelDescription, optionPrefix, optionContent, fieldSize, }) => {
|
|
1988
1971
|
return (jsxRuntime.jsx(reactComponents.MenuItem, { "data-testid": dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: e => {
|
|
@@ -1996,6 +1979,18 @@ const MultiSelectMenuItem = ({ label, onClick, selected, focused, "data-testid":
|
|
|
1996
1979
|
: optionPrefix, prefix: jsxRuntime.jsx(Checkbox, { checked: selected, className: "gap-x-0", disabled: disabled, onChange: () => null, readOnly: false }), selected: selected, children: optionContent }));
|
|
1997
1980
|
};
|
|
1998
1981
|
|
|
1982
|
+
/**
|
|
1983
|
+
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
1984
|
+
*/
|
|
1985
|
+
const SingleSelectMenuItem = ({ label, icon, onClick, selected = false, focused = false, disabled = false, "data-testid": dataTestId, optionLabelDescription, optionPrefix, optionContent, fieldSize = "medium", }) => {
|
|
1986
|
+
return (jsxRuntime.jsx(reactComponents.MenuItem, { "data-testid": dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, optionPrefix: react.isValidElement(optionPrefix)
|
|
1987
|
+
? react.cloneElement(optionPrefix, {
|
|
1988
|
+
className: "mr-1 flex items-center",
|
|
1989
|
+
size: "medium",
|
|
1990
|
+
})
|
|
1991
|
+
: optionPrefix, prefix: icon, selected: selected, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { color: "primary", name: "Check", size: fieldSize === "large" ? "medium" : "small" }) : undefined, children: optionContent }));
|
|
1992
|
+
};
|
|
1993
|
+
|
|
1999
1994
|
/**
|
|
2000
1995
|
* Custom hook to measure the geometry of multiple elements indexed by number.
|
|
2001
1996
|
* Similar to useMeasure but handles multiple elements efficiently with a single ResizeObserver.
|
package/index.esm.js
CHANGED
|
@@ -1963,25 +1963,8 @@ const Checkbox = ({ className, "data-testid": dataTestId = "checkbox", onChange,
|
|
|
1963
1963
|
};
|
|
1964
1964
|
Checkbox.displayName = "Checkbox";
|
|
1965
1965
|
|
|
1966
|
-
/**
|
|
1967
|
-
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
1968
|
-
*
|
|
1969
|
-
* @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
|
|
1970
|
-
* @returns {ReactElement} SingleSelectMenuItem
|
|
1971
|
-
*/
|
|
1972
|
-
const SingleSelectMenuItem = ({ label, icon, onClick, selected = false, focused = false, disabled = false, "data-testid": dataTestId, optionLabelDescription, optionPrefix, optionContent, fieldSize = "medium", }) => {
|
|
1973
|
-
return (jsx(MenuItem, { "data-testid": dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, optionPrefix: isValidElement(optionPrefix)
|
|
1974
|
-
? cloneElement(optionPrefix, {
|
|
1975
|
-
className: "mr-1 flex items-center",
|
|
1976
|
-
size: "medium",
|
|
1977
|
-
})
|
|
1978
|
-
: optionPrefix, prefix: icon, selected: selected, suffix: selected ? jsx(Icon, { color: "primary", name: "Check", size: fieldSize === "large" ? "medium" : "small" }) : undefined, children: optionContent }));
|
|
1979
|
-
};
|
|
1980
1966
|
/**
|
|
1981
1967
|
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
1982
|
-
*
|
|
1983
|
-
* @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
|
|
1984
|
-
* @returns {ReactElement} multi select menu item
|
|
1985
1968
|
*/
|
|
1986
1969
|
const MultiSelectMenuItem = ({ label, onClick, selected, focused, "data-testid": dataTestId, disabled, optionLabelDescription, optionPrefix, optionContent, fieldSize, }) => {
|
|
1987
1970
|
return (jsx(MenuItem, { "data-testid": dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: e => {
|
|
@@ -1995,6 +1978,18 @@ const MultiSelectMenuItem = ({ label, onClick, selected, focused, "data-testid":
|
|
|
1995
1978
|
: optionPrefix, prefix: jsx(Checkbox, { checked: selected, className: "gap-x-0", disabled: disabled, onChange: () => null, readOnly: false }), selected: selected, children: optionContent }));
|
|
1996
1979
|
};
|
|
1997
1980
|
|
|
1981
|
+
/**
|
|
1982
|
+
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
1983
|
+
*/
|
|
1984
|
+
const SingleSelectMenuItem = ({ label, icon, onClick, selected = false, focused = false, disabled = false, "data-testid": dataTestId, optionLabelDescription, optionPrefix, optionContent, fieldSize = "medium", }) => {
|
|
1985
|
+
return (jsx(MenuItem, { "data-testid": dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, optionPrefix: isValidElement(optionPrefix)
|
|
1986
|
+
? cloneElement(optionPrefix, {
|
|
1987
|
+
className: "mr-1 flex items-center",
|
|
1988
|
+
size: "medium",
|
|
1989
|
+
})
|
|
1990
|
+
: optionPrefix, prefix: icon, selected: selected, suffix: selected ? jsx(Icon, { color: "primary", name: "Check", size: fieldSize === "large" ? "medium" : "small" }) : undefined, children: optionContent }));
|
|
1991
|
+
};
|
|
1992
|
+
|
|
1998
1993
|
/**
|
|
1999
1994
|
* Custom hook to measure the geometry of multiple elements indexed by number.
|
|
2000
1995
|
* Similar to useMeasure but handles multiple elements efficiently with a single ResizeObserver.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.62",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"migrations": "./migrations.json",
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"react-calendar": "^6.0.0",
|
|
12
12
|
"react-select": "^5.10.2",
|
|
13
|
-
"@trackunit/date-and-time-utils": "1.13.
|
|
13
|
+
"@trackunit/date-and-time-utils": "1.13.59",
|
|
14
14
|
"usehooks-ts": "^3.1.0",
|
|
15
15
|
"libphonenumber-js": "^1.13.6",
|
|
16
16
|
"zod": "^3.25.76",
|
|
17
17
|
"tailwind-merge": "^2.0.0",
|
|
18
|
-
"@trackunit/css-class-variance-utilities": "1.13.
|
|
19
|
-
"@trackunit/react-components": "2.1.
|
|
20
|
-
"@trackunit/ui-icons": "1.13.
|
|
21
|
-
"@trackunit/shared-utils": "1.15.
|
|
22
|
-
"@trackunit/ui-design-tokens": "1.13.
|
|
23
|
-
"@trackunit/i18n-library-translation": "2.0.
|
|
18
|
+
"@trackunit/css-class-variance-utilities": "1.13.56",
|
|
19
|
+
"@trackunit/react-components": "2.1.59",
|
|
20
|
+
"@trackunit/ui-icons": "1.13.57",
|
|
21
|
+
"@trackunit/shared-utils": "1.15.57",
|
|
22
|
+
"@trackunit/ui-design-tokens": "1.13.55",
|
|
23
|
+
"@trackunit/i18n-library-translation": "2.0.58",
|
|
24
24
|
"string-ts": "^2.0.0",
|
|
25
25
|
"es-toolkit": "^1.39.10"
|
|
26
26
|
},
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { SelectMenuItemProps } from "./selectMenuItemTypes";
|
|
3
|
+
/**
|
|
4
|
+
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
5
|
+
*/
|
|
6
|
+
export declare const MultiSelectMenuItem: ({ label, onClick, selected, focused, "data-testid": dataTestId, disabled, optionLabelDescription, optionPrefix, optionContent, fieldSize, }: SelectMenuItemProps) => ReactElement;
|
|
@@ -1,68 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { FormComponentSizes } from "../../../../types";
|
|
4
|
-
interface SelectMenuItemProps extends CommonProps {
|
|
5
|
-
/**
|
|
6
|
-
* A string to render as an item label.
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
label: string;
|
|
10
|
-
/**
|
|
11
|
-
* A handler for click on element
|
|
12
|
-
*/
|
|
13
|
-
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
14
|
-
/**
|
|
15
|
-
* A boolean prop to set menu item to selected state
|
|
16
|
-
*/
|
|
17
|
-
selected?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* A boolean prop to set menu item to focused state
|
|
20
|
-
*/
|
|
21
|
-
focused?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* A boolean prop to set menu item to disabled state
|
|
24
|
-
* used in disabled select options
|
|
25
|
-
*/
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* A value to be displayed after the label value itself
|
|
29
|
-
* Such as a description or a hint for the option
|
|
30
|
-
*/
|
|
31
|
-
optionLabelDescription?: string;
|
|
32
|
-
/**
|
|
33
|
-
* A React element to render before the label value itself
|
|
34
|
-
* This is typically used to render an icon.
|
|
35
|
-
*/
|
|
36
|
-
optionPrefix?: ReactNode;
|
|
37
|
-
/**
|
|
38
|
-
* Rich content to render in place of the default label/description layout.
|
|
39
|
-
* This keeps the surrounding menu item chrome while allowing custom content.
|
|
40
|
-
*/
|
|
41
|
-
optionContent?: ReactNode;
|
|
42
|
-
/**
|
|
43
|
-
* The size of the selected item
|
|
44
|
-
*/
|
|
45
|
-
fieldSize?: FormComponentSizes;
|
|
46
|
-
}
|
|
47
|
-
export interface SingleSelectMenuItemProps extends SelectMenuItemProps {
|
|
48
|
-
/**
|
|
49
|
-
* A React element to render before the text in the select.
|
|
50
|
-
* This is typically used to render an icon.
|
|
51
|
-
*/
|
|
52
|
-
icon?: ReactElement;
|
|
53
|
-
}
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { SingleSelectMenuItemProps } from "./selectMenuItemTypes";
|
|
54
3
|
/**
|
|
55
4
|
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
56
|
-
*
|
|
57
|
-
* @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
|
|
58
|
-
* @returns {ReactElement} SingleSelectMenuItem
|
|
59
5
|
*/
|
|
60
6
|
export declare const SingleSelectMenuItem: ({ label, icon, onClick, selected, focused, disabled, "data-testid": dataTestId, optionLabelDescription, optionPrefix, optionContent, fieldSize, }: SingleSelectMenuItemProps) => ReactElement;
|
|
61
|
-
/**
|
|
62
|
-
* A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
|
|
63
|
-
*
|
|
64
|
-
* @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
|
|
65
|
-
* @returns {ReactElement} multi select menu item
|
|
66
|
-
*/
|
|
67
|
-
export declare const MultiSelectMenuItem: ({ label, onClick, selected, focused, "data-testid": dataTestId, disabled, optionLabelDescription, optionPrefix, optionContent, fieldSize, }: SelectMenuItemProps) => ReactElement;
|
|
68
|
-
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
+
import { MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { FormComponentSizes } from "../../../../types";
|
|
4
|
+
/** Props shared by select menu item renderers in BaseSelect. */
|
|
5
|
+
export interface SelectMenuItemProps extends CommonProps {
|
|
6
|
+
/** A string to render as an item label. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** A handler for click on element */
|
|
9
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
10
|
+
/** A boolean prop to set menu item to selected state */
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
/** A boolean prop to set menu item to focused state */
|
|
13
|
+
focused?: boolean;
|
|
14
|
+
/** A boolean prop to set menu item to disabled state */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** A value to be displayed after the label value itself */
|
|
17
|
+
optionLabelDescription?: string;
|
|
18
|
+
/** A React element to render before the label value itself */
|
|
19
|
+
optionPrefix?: ReactNode;
|
|
20
|
+
/** Rich content to render in place of the default label/description layout. */
|
|
21
|
+
optionContent?: ReactNode;
|
|
22
|
+
/** The size of the selected item */
|
|
23
|
+
fieldSize?: FormComponentSizes;
|
|
24
|
+
}
|
|
25
|
+
/** Props for a single-select menu item in BaseSelect. */
|
|
26
|
+
export interface SingleSelectMenuItemProps extends SelectMenuItemProps {
|
|
27
|
+
/** A React element to render before the text in the select. */
|
|
28
|
+
icon?: ReactElement;
|
|
29
|
+
}
|