@trackunit/react-form-components 1.3.140 → 1.3.141

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 CHANGED
@@ -2005,8 +2005,8 @@ const cvaSelectMenu = cssClassVarianceUtilities.cvaMerge(["relative", "p-1", "gr
2005
2005
  * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
2006
2006
  * @returns {ReactElement} SingleSelectMenuItem
2007
2007
  */
2008
- const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2009
- return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, prefix: icon, selected: selected, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : undefined }));
2008
+ const SingleSelectMenuItem = ({ label, icon, onClick, selected, focused, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2009
+ return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, prefix: icon, selected: selected, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : undefined }));
2010
2010
  };
2011
2011
  /**
2012
2012
  * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
@@ -2014,8 +2014,8 @@ const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, disa
2014
2014
  * @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
2015
2015
  * @returns {ReactElement} multi select menu item
2016
2016
  */
2017
- const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2018
- return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, label: label, onClick: e => {
2017
+ const MultiSelectMenuItem = ({ label, onClick, selected, focused, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2018
+ return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: e => {
2019
2019
  e.stopPropagation();
2020
2020
  onClick && onClick(e);
2021
2021
  }, optionLabelDescription: optionLabelDescription, prefix: jsxRuntime.jsx(Checkbox, { checked: selected, disabled: disabled, onChange: () => null, onClick: e => {
@@ -2486,7 +2486,7 @@ const ReactSyncSelect = ReactSelect.default || ReactSelect;
2486
2486
  * @returns {ReactElement} Select component
2487
2487
  */
2488
2488
  const Select = (props) => {
2489
- const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
2489
+ const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = false, hideSelectedOptions = false, } = props;
2490
2490
  const { refContainer, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler } = useSelect(props);
2491
2491
  const reactSelectProps = react.useMemo(() => ({
2492
2492
  value,
@@ -2498,7 +2498,7 @@ const Select = (props) => {
2498
2498
  components: customComponents,
2499
2499
  styles: customStyles,
2500
2500
  tabSelectsValue: false,
2501
- blurInputOnSelect: !isMulti,
2501
+ blurInputOnSelect: false,
2502
2502
  // This configuration allows for more flexible positioning control of the dropdown.
2503
2503
  // Setting menuPortalTarget to 'null' specifies that the dropdown should be rendered within
2504
2504
  // the parent element instead of 'document.body'.
@@ -2509,7 +2509,7 @@ const Select = (props) => {
2509
2509
  openMenuOnFocus,
2510
2510
  menuIsOpen: !readOnly ? menuIsOpen : false,
2511
2511
  openMenuOnClick,
2512
- closeMenuOnSelect: false,
2512
+ closeMenuOnSelect: !isMulti,
2513
2513
  isMulti,
2514
2514
  classNamePrefix,
2515
2515
  isLoading,
package/index.esm.js CHANGED
@@ -2004,8 +2004,8 @@ const cvaSelectMenu = cvaMerge(["relative", "p-1", "grid", "gap-1"]);
2004
2004
  * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
2005
2005
  * @returns {ReactElement} SingleSelectMenuItem
2006
2006
  */
2007
- const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2008
- return (jsx(MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, prefix: icon, selected: selected, suffix: selected ? jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : undefined }));
2007
+ const SingleSelectMenuItem = ({ label, icon, onClick, selected, focused, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2008
+ return (jsx(MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, prefix: icon, selected: selected, suffix: selected ? jsx(Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : undefined }));
2009
2009
  };
2010
2010
  /**
2011
2011
  * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
@@ -2013,8 +2013,8 @@ const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, disa
2013
2013
  * @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
2014
2014
  * @returns {ReactElement} multi select menu item
2015
2015
  */
2016
- const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2017
- return (jsx(MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, label: label, onClick: e => {
2016
+ const MultiSelectMenuItem = ({ label, onClick, selected, focused, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
2017
+ return (jsx(MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, focused: focused, label: label, onClick: e => {
2018
2018
  e.stopPropagation();
2019
2019
  onClick && onClick(e);
2020
2020
  }, optionLabelDescription: optionLabelDescription, prefix: jsx(Checkbox, { checked: selected, disabled: disabled, onChange: () => null, onClick: e => {
@@ -2485,7 +2485,7 @@ const ReactSyncSelect = ReactSelect.default || ReactSelect;
2485
2485
  * @returns {ReactElement} Select component
2486
2486
  */
2487
2487
  const Select = (props) => {
2488
- const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
2488
+ const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = false, hideSelectedOptions = false, } = props;
2489
2489
  const { refContainer, customStyles, menuIsOpen, customComponents, menuPlacement, openMenuHandler, closeMenuHandler } = useSelect(props);
2490
2490
  const reactSelectProps = useMemo(() => ({
2491
2491
  value,
@@ -2497,7 +2497,7 @@ const Select = (props) => {
2497
2497
  components: customComponents,
2498
2498
  styles: customStyles,
2499
2499
  tabSelectsValue: false,
2500
- blurInputOnSelect: !isMulti,
2500
+ blurInputOnSelect: false,
2501
2501
  // This configuration allows for more flexible positioning control of the dropdown.
2502
2502
  // Setting menuPortalTarget to 'null' specifies that the dropdown should be rendered within
2503
2503
  // the parent element instead of 'document.body'.
@@ -2508,7 +2508,7 @@ const Select = (props) => {
2508
2508
  openMenuOnFocus,
2509
2509
  menuIsOpen: !readOnly ? menuIsOpen : false,
2510
2510
  openMenuOnClick,
2511
- closeMenuOnSelect: false,
2511
+ closeMenuOnSelect: !isMulti,
2512
2512
  isMulti,
2513
2513
  classNamePrefix,
2514
2514
  isLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "1.3.140",
3
+ "version": "1.3.141",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -18,11 +18,11 @@
18
18
  "react-hook-form": "7.53.1",
19
19
  "tailwind-merge": "^2.0.0",
20
20
  "@trackunit/css-class-variance-utilities": "1.3.103",
21
- "@trackunit/react-components": "1.4.124",
21
+ "@trackunit/react-components": "1.4.125",
22
22
  "@trackunit/ui-icons": "1.3.105",
23
23
  "@trackunit/shared-utils": "1.5.103",
24
24
  "@trackunit/ui-design-tokens": "1.3.103",
25
- "@trackunit/i18n-library-translation": "1.3.114",
25
+ "@trackunit/i18n-library-translation": "1.3.116",
26
26
  "string-ts": "^2.0.0"
27
27
  },
28
28
  "module": "./index.esm.js",
@@ -3,18 +3,22 @@ import { MouseEventHandler, ReactElement } from "react";
3
3
  import { FormComponentSizes } from "../../../types";
4
4
  interface SelectMenuItemProps extends CommonProps {
5
5
  /**
6
- * An string to render as a item label.
6
+ * A string to render as an item label.
7
7
  *
8
8
  */
9
9
  label: string;
10
10
  /**
11
- * An handler for click on element
11
+ * A handler for click on element
12
12
  */
13
13
  onClick?: MouseEventHandler<HTMLDivElement>;
14
14
  /**
15
15
  * A boolean prop to set menu item to selected state
16
16
  */
17
17
  selected?: boolean;
18
+ /**
19
+ * A boolean prop to set menu item to focused state
20
+ */
21
+ focused?: boolean;
18
22
  /**
19
23
  * A boolean prop to set menu item to disabled state
20
24
  * used in disabled select options
@@ -32,7 +36,7 @@ interface SelectMenuItemProps extends CommonProps {
32
36
  }
33
37
  export interface SingleSelectMenuItemProps extends SelectMenuItemProps {
34
38
  /**
35
- * An React element to render before the text in the select.
39
+ * A React element to render before the text in the select.
36
40
  * This is typically used to render an icon.
37
41
  */
38
42
  icon?: ReactElement;
@@ -43,12 +47,12 @@ export interface SingleSelectMenuItemProps extends SelectMenuItemProps {
43
47
  * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
44
48
  * @returns {ReactElement} SingleSelectMenuItem
45
49
  */
46
- export declare const SingleSelectMenuItem: ({ label, icon, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }: SingleSelectMenuItemProps) => import("react/jsx-runtime").JSX.Element;
50
+ export declare const SingleSelectMenuItem: ({ label, icon, onClick, selected, focused, dataTestId, disabled, optionLabelDescription, fieldSize, }: SingleSelectMenuItemProps) => import("react/jsx-runtime").JSX.Element;
47
51
  /**
48
52
  * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
49
53
  *
50
54
  * @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
51
55
  * @returns {ReactElement} multi select menu item
52
56
  */
53
- export declare const MultiSelectMenuItem: ({ label, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }: SelectMenuItemProps) => import("react/jsx-runtime").JSX.Element;
57
+ export declare const MultiSelectMenuItem: ({ label, onClick, selected, focused, dataTestId, disabled, optionLabelDescription, fieldSize, }: SelectMenuItemProps) => import("react/jsx-runtime").JSX.Element;
54
58
  export {};