@trackunit/react-components 0.0.80 → 0.0.82-alpha-5bc30eb95.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.
@@ -27,7 +27,7 @@ export interface IconProps extends CommonProps {
27
27
  * Trackunit icons might not support both outline and Solid.
28
28
  */
29
29
  type?: "solid" | "outline";
30
- onClick?: (event: React.MouseEvent<HTMLSpanElement>) => void;
30
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
31
31
  /**
32
32
  * @deprecated
33
33
  */
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from "react";
2
2
  export interface MenuItemProps {
3
3
  /**
4
4
  * The icon to be rendered in the menu item.
@@ -17,9 +17,36 @@ export interface MenuItemProps {
17
17
  */
18
18
  dataTestId?: string;
19
19
  /**
20
- * onClick event.
20
+ * An React element to render before the label.
21
+ * This is typically used to render an icon.
22
+ *
21
23
  */
22
- onClick: () => void;
24
+ prefix?: JSX.Element;
25
+ /**
26
+ * An boolean flag to turn on/off selected state
27
+ * This is typically used highlight that item is selected
28
+ *
29
+ * @memberof IMenuItemProps
30
+ */
31
+ selected?: boolean;
32
+ /**
33
+ * OnClick event handler it is thrown on root element of the component tree
34
+ *
35
+ * @memberof IMenuItemProps
36
+ */
37
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
38
+ /**
39
+ * An boolean flag to turn on/off focused state
40
+ * This is typically used for keyboard navigation
41
+ *
42
+ * @memberof IMenuItemProps
43
+ */
44
+ focused?: boolean;
45
+ /**
46
+ * A boolean prop to set menu item to disabled state
47
+ * used in disabled select options
48
+ */
49
+ disabled?: boolean;
23
50
  }
24
51
  /**
25
52
  * The MenuItem component should be used to inform the user of important information.
@@ -27,4 +54,4 @@ export interface MenuItemProps {
27
54
  * @param {MenuItemProps} props - The props for the MenuItem component
28
55
  * @returns {JSX.Element} MenuItem component
29
56
  */
30
- export declare const MenuItem: ({ className, dataTestId, label, icon, onClick }: MenuItemProps) => JSX.Element;
57
+ export declare const MenuItem: ({ className, dataTestId, label, selected, focused, prefix, icon, disabled, onClick, }: MenuItemProps) => JSX.Element;
@@ -16,6 +16,14 @@ export interface MenuListProps {
16
16
  * List of menu items to be rendered.
17
17
  */
18
18
  menuItems: MenuListItemProps[];
19
+ /**
20
+ * A component width
21
+ */
22
+ width?: string;
23
+ /**
24
+ * Custom renderer for menu items
25
+ */
26
+ itemRenderer?: (item: MenuListItemProps, key: string, index: number) => JSX.Element;
19
27
  }
20
28
  /**
21
29
  * The MenuList component is used for menus and selects.
@@ -23,4 +31,4 @@ export interface MenuListProps {
23
31
  * @param {MenuListProps} props - The props for the MenuList component
24
32
  * @returns {JSX.Element} MenuList component
25
33
  */
26
- export declare const MenuList: ({ dataTestId, className, menuItems, ...args }: MenuListProps) => JSX.Element;
34
+ export declare const MenuList: ({ dataTestId, className, menuItems, width, itemRenderer, ...args }: MenuListProps) => JSX.Element;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { GroupBase } from "react-select";
3
- import { SelectProps } from "./shared";
3
+ import { ISelectProps } from "./shared";
4
4
  /**
5
5
  * The CreatableSelect component.
6
6
  *
7
- * @param {SelectProps} props - The props for the CreatableSelect component
7
+ * @param {ISelectProps} props - The props for the CreatableSelect component
8
8
  * @returns {JSX.Element} CreatableSelect component
9
9
  */
10
- export declare const CreatableSelect: <Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ dataTestId, size, id, label, hideLabel, description, error, info, isInvalid, maxMenuHeight, styles, components, ...props }: SelectProps<Option, IsAsync, IsMulti, Group>) => JSX.Element;
10
+ export declare const CreatableSelect: <Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ dataTestId, size, id, label, hideLabel, description, error, info, isInvalid, maxMenuHeight, styles, components, ...props }: ISelectProps<Option, IsAsync, IsMulti, Group>) => JSX.Element;
@@ -0,0 +1,122 @@
1
+ /// <reference types="react" />
2
+ import { GroupBase, MultiValue, SingleValue } from "react-select";
3
+ import { SelectComponents } from "react-select/dist/declarations/src/components";
4
+ import { CommonProps } from "../../../common";
5
+ import { SelectOption } from "./useCustomComponents";
6
+ export interface SelectProps extends CommonProps {
7
+ /**
8
+ * An React element to render before the text in the select.
9
+ * This is typically used to render an icon.
10
+ *
11
+ *
12
+ * @memberof SelectProps
13
+ */
14
+ prefix?: JSX.Element;
15
+ /**
16
+ * An string to render in field when there is no value selected.
17
+ * Can be used as a description, example or a hint.
18
+ *
19
+ *
20
+ * @memberof SelectProps
21
+ */
22
+ placeholder?: string;
23
+ /**
24
+ * An boolean flag to disable field
25
+ *
26
+ *
27
+ * @memberof SelectProps
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * An field id
32
+ *
33
+ *
34
+ * @memberof SelectProps
35
+ */
36
+ id?: string;
37
+ /**
38
+ * An boolean flag to set select into async mode
39
+ * This is typically used when data is fetched after render
40
+ *
41
+ *
42
+ * @memberof SelectProps
43
+ */
44
+ isAsync?: boolean;
45
+ /**
46
+ * A custom icon to be used as a dropdown indicator
47
+ * This is typically used during style customization
48
+ *
49
+ *
50
+ * @memberof SelectProps
51
+ */
52
+ dropdownIcon?: JSX.Element;
53
+ /**
54
+ * A label to be used as a aria-label
55
+ * This is typically used for accessibility
56
+ *
57
+ *
58
+ * @memberof SelectProps
59
+ */
60
+ label?: string;
61
+ /**
62
+ * A number of pixels to limit maximal length of the select menu list
63
+ *
64
+ *
65
+ * @memberof SelectProps
66
+ */
67
+ maxMenuHeight?: number;
68
+ /**
69
+ * A flag to allow multiselect
70
+ *
71
+ *
72
+ * @memberof SelectProps
73
+ */
74
+ multiple?: boolean;
75
+ /**
76
+ * A boolean prop to set select into invalid mode
77
+ * typically used when selected value is not compliant with field requirement
78
+ * ex if it breaks validation rules
79
+ *
80
+ *
81
+ * @memberof SelectProps
82
+ */
83
+ hasError?: boolean;
84
+ /**
85
+ * A react select component prop to overide
86
+ *
87
+ *
88
+ * @memberof SelectProps
89
+ */
90
+ components?: Partial<SelectComponents<SelectOption, boolean, GroupBase<SelectOption>>>;
91
+ /**
92
+ * A single or multi value selection
93
+ *
94
+ *
95
+ * @memberof SelectProps
96
+ */
97
+ value?: SingleValue<SelectOption> | MultiValue<SelectOption>;
98
+ /**
99
+ * An array of options to select from
100
+ *
101
+ *
102
+ * @memberof SelectProps
103
+ */
104
+ options: SelectOption[];
105
+ /**
106
+ * Handle change events on the select
107
+ *
108
+ *
109
+ * @memberof SelectProps
110
+ */
111
+ onChange: (newValue: MultiValue<SelectOption> | SingleValue<SelectOption>) => void;
112
+ }
113
+ /**
114
+ * Selects are input components used to choose a value from a set.
115
+ *
116
+ * @param {SelectProps} props - The props for the Select component
117
+ * @returns {JSX.Element} Select component
118
+ */
119
+ export declare const Select: {
120
+ ({ id, className, dataTestId, prefix, isAsync, dropdownIcon, maxMenuHeight, label, hasError, disabled, multiple, components, value, options, onChange, }: SelectProps): JSX.Element;
121
+ displayName: string;
122
+ };
@@ -0,0 +1,45 @@
1
+ /// <reference types="react" />
2
+ interface TagsContainerItem {
3
+ /**
4
+ * A text value to be passed to tags inside container
5
+ */
6
+ text: string;
7
+ /**
8
+ * OnClick handler for a tags
9
+ */
10
+ onClick: () => void;
11
+ /**
12
+ * A flag to set tags to readonly mode (without close button)
13
+ */
14
+ disabled: boolean;
15
+ }
16
+ interface TagsContainerProps {
17
+ /**
18
+ * An items to be rendered inside container if they fit available space. If they overlap then the counter will be displayed.
19
+ */
20
+ items: TagsContainerItem[];
21
+ /**
22
+ * An css property to set a custom width for container
23
+ * Default behavior is to take 100% width of parent element
24
+ * You can provide a value with unit (pixels, percents, rem, etc)
25
+ *
26
+ * @memberof TagsContainerProps
27
+ */
28
+ width?: string;
29
+ /**
30
+ * In case you have a gap between items then you can provide it to be used in calculation of available space,
31
+ * default value is 5, so if you don't need it then provide 0
32
+ *
33
+ * @memberof TagsContainerProps
34
+ */
35
+ itemsGap?: number;
36
+ postFix: JSX.Element;
37
+ }
38
+ /**
39
+ * TagsContainer component to display tags in limited space when children can't fit space it displays counter
40
+ *
41
+ * @param {TagsContainerProps} props - The props for the TagContainer
42
+ * @returns {JSX.Element} TagsContainer
43
+ */
44
+ export declare const TagsContainer: ({ items, width, itemsGap, postFix }: TagsContainerProps) => JSX.Element;
45
+ export {};
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ import { GroupBase } from "react-select";
3
+ import { SelectComponents } from "react-select/dist/declarations/src/components";
4
+ export interface SelectOption {
5
+ id: string;
6
+ value: string;
7
+ label: string;
8
+ }
9
+ /**
10
+ * A hook to retrieve components override object.
11
+ * This complex object includes all the compositional components that are used in react-select. If you wish to overwrite a component, pass in an object with the appropriate namespace.
12
+ *
13
+ * @param {Partial<SelectComponents<SelectOption, boolean, GroupBase<SelectOption>>> | undefined} componentsProps a custom component prop that you can to override defaults
14
+ * @param {boolean} disabled decide to override disabled variant
15
+ * @param {boolean} menuIsClosing a flag to trigger fade out animation for the menu
16
+ * @param {React.MutableRefObject<boolean>} refMenuIsEnabled a flag to block menu from open
17
+ * @param {JSX.Element} dropdownIcon an custom dropdown icon
18
+ * @returns {Partial<SelectComponents<SelectOption, boolean, GroupBase<SelectOption>>> | undefined} components object to override react-select default components
19
+ */
20
+ export declare const useCustomComponents: (componentsProps: Partial<SelectComponents<SelectOption, boolean, GroupBase<SelectOption>>> | undefined, disabled: boolean, menuIsClosing: boolean, refMenuIsEnabled: React.MutableRefObject<boolean>, dropdownIcon?: JSX.Element) => Partial<SelectComponents<SelectOption, boolean, GroupBase<SelectOption>>>;
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { StylesConfig } from "react-select";
3
+ /**
4
+ * @param {React.RefObject<HTMLDivElement>} refContainer react ref to container element
5
+ * @param {React.RefObject<HTMLDivElement>} refPrefix react ref to prefix element
6
+ * @returns {StylesConfig<Option, boolean>} styles to override in select
7
+ */
8
+ export declare const useCustomStyles: <Option, IsMulti extends boolean = false>(refContainer: React.RefObject<HTMLDivElement>, refPrefix: React.RefObject<HTMLDivElement>) => {
9
+ customStyles: StylesConfig<Option, IsMulti, import("react-select").GroupBase<Option>>;
10
+ };
@@ -0,0 +1,10 @@
1
+ import { ActionMeta, MultiValue } from "react-select";
2
+ import { SelectOption } from "./useCustomComponents";
3
+ /**
4
+ * A basic reducer for managing selected items state in storybook
5
+ *
6
+ * @param {MultiValue<SelectOption>} state current selected state
7
+ * @param {ActionMeta<SelectOption>} action action performed by user
8
+ * @returns {MultiValue<SelectOption>} New selected state
9
+ */
10
+ export declare const reducer: (state: MultiValue<SelectOption>, action: ActionMeta<SelectOption>) => MultiValue<SelectOption>;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { GroupBase } from "react-select";
3
- import { SelectProps } from "./shared";
3
+ import { ISelectProps } from "./shared";
4
4
  /**
5
5
  * The Select component.
6
6
  *
7
- * @param {SelectProps} props - The props for the Select component
7
+ * @param {ISelectProps} props - The props for the Select component
8
8
  * @returns {JSX.Element} Select component
9
9
  */
10
- export declare const Select: <Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ dataTestId, size, id, label, hideLabel, description, error, info, isInvalid, maxMenuHeight, styles, components, ...props }: SelectProps<Option, IsAsync, IsMulti, Group>) => JSX.Element;
10
+ export declare const Select: <Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ dataTestId, size, id, label, hideLabel, description, error, info, isInvalid, maxMenuHeight, styles, components, ...props }: ISelectProps<Option, IsAsync, IsMulti, Group>) => JSX.Element;
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { CommonProps } from "../../../common";
3
+ interface SelectMenuItemProps extends CommonProps {
4
+ /**
5
+ * An string to render as a item label.
6
+ *
7
+ */
8
+ label: string;
9
+ /**
10
+ * An handler for click on element
11
+ */
12
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
13
+ /**
14
+ * A boolean prop to set menu item to selected state
15
+ */
16
+ selected?: boolean;
17
+ /**
18
+ * A boolean prop to set menu item to focused state
19
+ * used for keyboard navigation
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
+ export interface SingleSelectMenuItemProps extends SelectMenuItemProps {
29
+ /**
30
+ * An React element to render before the text in the select.
31
+ * This is typically used to render an icon.
32
+ */
33
+ icon?: JSX.Element;
34
+ }
35
+ /**
36
+ * A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
37
+ *
38
+ * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
39
+ * @returns {JSX.Element} SingleSelectMenuItem
40
+ */
41
+ export declare const SingleSelectMenuItem: ({ label, icon, onClick, selected, dataTestId, focused, }: SingleSelectMenuItemProps) => JSX.Element;
42
+ /**
43
+ * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
44
+ *
45
+ * @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
46
+ * @returns {JSX.Element} multi select menu item
47
+ */
48
+ export declare const MultiSelectMenuItem: ({ label, onClick, selected, dataTestId, focused, disabled, }: SelectMenuItemProps) => JSX.Element;
49
+ export {};
@@ -47,7 +47,7 @@ export interface ISelectProps<Option, IsAsync extends boolean, IsMulti extends b
47
47
  */
48
48
  isAsync?: IsAsync;
49
49
  }
50
- export declare type SelectProps<Option, IsAsync extends boolean, IsMulti extends boolean, GroupType extends GroupBase<Option>> = IsAsync extends true ? AsyncProps<Option, IsMulti, GroupType> & ISelectProps<Option, IsAsync, IsMulti, GroupType> : ISelectProps<Option, IsAsync, IsMulti, GroupType>;
50
+ export declare type SelectProps<Option, IsAsync extends boolean, IsMulti extends boolean, GroupType extends GroupBase<Option>> = IsAsync extends true ? AsyncProps<Option, IsMulti, GroupType> & SelectProps<Option, IsAsync, IsMulti, GroupType> : SelectProps<Option, IsAsync, IsMulti, GroupType>;
51
51
  /**
52
52
  * The useCustomStyles hook for getting trackunit specific styling on react-select.
53
53
  *
@@ -31,6 +31,9 @@ interface TagProps extends CommonProps {
31
31
  *
32
32
  */
33
33
  size?: TagSize;
34
+ onWidthKnown?: ({ width }: {
35
+ width: number;
36
+ }) => void;
34
37
  }
35
38
  /**
36
39
  * Tags allow users to enter information and filter content.
@@ -40,5 +43,5 @@ interface TagProps extends CommonProps {
40
43
  * @param {TagProps} props - The props for the tag component
41
44
  * @returns {JSX.Element} tag component
42
45
  */
43
- export declare const Tag: ({ className, dataTestId, children, size, onClose, color, ...rest }: TagProps) => JSX.Element;
46
+ export declare const Tag: ({ className, dataTestId, children, size, onClose, color, onWidthKnown, ...rest }: TagProps) => JSX.Element;
44
47
  export {};
package/index.js CHANGED
@@ -685,7 +685,7 @@ const Alert = ({
685
685
  "$inline": inline
686
686
  }, {
687
687
  children: getIconFromIntent()
688
- })), jsxs(Content$2, Object.assign({
688
+ })), jsxs(Content$1, Object.assign({
689
689
  "$inline": inline
690
690
  }, {
691
691
  children: [body, (primaryAction || secondaryAction) && jsxs(RightAligned, Object.assign({
@@ -747,7 +747,7 @@ const Container$7 = tw.div`
747
747
  ${p => p.$inline ? tws`tu-alert--inline` : null}
748
748
  ${getBackgroundColor()}
749
749
  `;
750
- const Content$2 = tw.div`
750
+ const Content$1 = tw.div`
751
751
  ${p => p.$inline ? tws`tu-alert__content--inline` : tws`tu-alert__content`}
752
752
  `;
753
753
  const Description$2 = tw(Text)`
@@ -2340,7 +2340,7 @@ const Tooltip = ({
2340
2340
  dataTestId: dataTestId,
2341
2341
  enableBackdrop: false
2342
2342
  }, {
2343
- children: jsx(Content$1, Object.assign({
2343
+ children: jsx(Content, Object.assign({
2344
2344
  "$mode": mode
2345
2345
  }, {
2346
2346
  children: jsx(Text, Object.assign({
@@ -2359,7 +2359,7 @@ const Flex$1 = tw.div`
2359
2359
  const Container$4 = tw(AnimatedPopover)`
2360
2360
  tu-tooltip__container
2361
2361
  `;
2362
- const Content$1 = tw.div`
2362
+ const Content = tw.div`
2363
2363
  tu-tooltip__content
2364
2364
  ${p => p.$mode === "light" ? tws`tu-tooltip--light` : null}
2365
2365
  `;
@@ -2721,33 +2721,64 @@ const MenuItem = ({
2721
2721
  className,
2722
2722
  dataTestId,
2723
2723
  label,
2724
+ selected,
2725
+ focused,
2726
+ prefix,
2724
2727
  icon,
2728
+ disabled,
2725
2729
  onClick
2726
2730
  }) => {
2727
2731
  const containerProps = useContainerProps({
2728
2732
  className,
2729
2733
  dataTestId
2730
2734
  });
2731
- return jsx(Container$2, Object.assign({}, containerProps, {
2732
- onClick: onClick
2735
+ return jsxs(Container$2, Object.assign({}, containerProps, {
2736
+ onClick: e => {
2737
+ e.stopPropagation();
2738
+ onClick && onClick(e);
2739
+ },
2740
+ "$selected": selected,
2741
+ "$focused": focused,
2742
+ tabIndex: 0,
2743
+ "$disabled": disabled
2733
2744
  }, {
2734
- children: jsxs(Content, {
2735
- children: [jsx(Label$1, {
2736
- children: label
2737
- }), icon && jsx(Icon, {
2738
- children: icon
2739
- })]
2740
- })
2745
+ children: [prefix && jsx(Prefix, Object.assign({
2746
+ "$selected": selected
2747
+ }, {
2748
+ children: prefix
2749
+ })), jsx(Label$1, {
2750
+ children: label
2751
+ }), icon && jsx(Icon, Object.assign({
2752
+ "$selected": selected
2753
+ }, {
2754
+ children: icon
2755
+ }))]
2741
2756
  }));
2742
2757
  };
2743
2758
  const Container$2 = tw.div`
2744
2759
  group tu-menu-item
2745
- `;
2746
- const Content = tw.div`
2747
- tu-menu-item__content
2760
+ ${({
2761
+ $selected
2762
+ }) => $selected ? tws`tu-menu-item--selected ` : "tu-menu-item--unselected"}
2763
+ ${({
2764
+ $focused
2765
+ }) => $focused ? tws`tu-menu-item--focused ` : ""}
2766
+ ${({
2767
+ $disabled
2768
+ }) => $disabled ? tws`tu-menu-item--disabled ` : ""}
2769
+
2748
2770
  `;
2749
2771
  const Icon = tw.div`
2750
2772
  tu-menu-item__icon
2773
+ ${({
2774
+ $selected
2775
+ }) => $selected ? tws`tu-menu-item__icon--selected ` : ""}
2776
+ `;
2777
+ const Prefix = tw.div`
2778
+ tu-menu-item__prefix
2779
+ ${({
2780
+ $selected
2781
+ }) => $selected ? tws`tu-menu-item__prefix--selected ` : ""}
2751
2782
  `;
2752
2783
  const Label$1 = tw.div`
2753
2784
  tu-menu-item__label
@@ -2764,9 +2795,11 @@ const MenuList = _a => {
2764
2795
  var {
2765
2796
  dataTestId,
2766
2797
  className,
2767
- menuItems
2798
+ menuItems,
2799
+ width,
2800
+ itemRenderer
2768
2801
  } = _a,
2769
- args = __rest(_a, ["dataTestId", "className", "menuItems"]);
2802
+ args = __rest(_a, ["dataTestId", "className", "menuItems", "width", "itemRenderer"]);
2770
2803
 
2771
2804
  const containerProps = useContainerProps(Object.assign({
2772
2805
  className,
@@ -2774,15 +2807,20 @@ const MenuList = _a => {
2774
2807
  }, args));
2775
2808
  return jsx(Wrapper, {
2776
2809
  children: jsx(Container$1, Object.assign({}, containerProps, {
2810
+ style: width ? {
2811
+ width
2812
+ } : undefined,
2813
+ tabIndex: 0
2814
+ }, {
2777
2815
  children: menuItems.map((props, index) => {
2778
- const item = createElement(MenuItem, Object.assign({}, props, {
2779
- key: `${index}-${props.label}`,
2816
+ const key = `${index}-${props.label}`;
2817
+ const item = itemRenderer ? itemRenderer(props, key, index) : createElement(MenuItem, Object.assign({}, props, {
2818
+ key: key,
2780
2819
  onClick: props.onClick
2781
2820
  }));
2782
-
2783
- return props.showDivider ? jsxs(Fragment, {
2821
+ return props.showDivider ? jsxs("div", {
2784
2822
  children: [jsx(Divider, {}), " ", item]
2785
- }) : item;
2823
+ }, key) : item;
2786
2824
  })
2787
2825
  }))
2788
2826
  });
@@ -3741,7 +3779,7 @@ const useCustomComponents = components => {
3741
3779
  /**
3742
3780
  * The CreatableSelect component.
3743
3781
  *
3744
- * @param {SelectProps} props - The props for the CreatableSelect component
3782
+ * @param {ISelectProps} props - The props for the CreatableSelect component
3745
3783
  * @returns {JSX.Element} CreatableSelect component
3746
3784
  */
3747
3785
 
@@ -3798,7 +3836,7 @@ const CreatableSelect = _a => {
3798
3836
  /**
3799
3837
  * The Select component.
3800
3838
  *
3801
- * @param {SelectProps} props - The props for the Select component
3839
+ * @param {ISelectProps} props - The props for the Select component
3802
3840
  * @returns {JSX.Element} Select component
3803
3841
  */
3804
3842
 
@@ -3926,20 +3964,31 @@ const Tag = _a => {
3926
3964
  children,
3927
3965
  size = "default",
3928
3966
  onClose,
3929
- color = "primary"
3967
+ color = "primary",
3968
+ onWidthKnown
3930
3969
  } = _a;
3931
- __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
3970
+ __rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "onWidthKnown"]);
3932
3971
 
3972
+ const ref = React.useRef(null);
3973
+ React.useLayoutEffect(() => {
3974
+ var _a;
3975
+
3976
+ onWidthKnown && onWidthKnown({
3977
+ width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0
3978
+ });
3979
+ }, [ref, onWidthKnown]);
3933
3980
  return jsxs(StyledText, Object.assign({
3934
3981
  className: className,
3935
3982
  "$size": size,
3936
3983
  "data-testid": dataTestId,
3937
3984
  "$as": "span",
3938
3985
  "$color": color,
3939
- "$withXIcon": !!onClose
3986
+ "$withXIcon": !!onClose,
3987
+ ref: ref
3940
3988
  }, {
3941
- children: [children, onClose && jsx(IconContainer, Object.assign({
3942
- onClick: onClose
3989
+ children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
3990
+ jsx(IconContainer, Object.assign({
3991
+ onMouseDown: onClose
3943
3992
  }, {
3944
3993
  children: jsx(Icon$1, {
3945
3994
  name: "XCircleIcon",
package/package.json CHANGED
@@ -1,27 +1,26 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.80",
3
+ "version": "0.0.82-alpha-5bc30eb95.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "UNLICENSED",
6
6
  "dependencies": {
7
- "@trackunit/css-core": "0.0.45",
8
- "@trackunit/tailwind-styled-components": "0.0.40",
7
+ "@trackunit/css-core": "0.0.47-alpha-5bc30eb95.0",
8
+ "@trackunit/tailwind-styled-components": "0.0.41-alpha-5bc30eb95.0",
9
9
  "react": "17.0.1",
10
- "@trackunit/ui-design-tokens": "0.0.39",
10
+ "@trackunit/ui-design-tokens": "0.0.40-alpha-5bc30eb95.0",
11
11
  "echarts-for-react": "^3.0.2",
12
12
  "uuid": "^8.3.2",
13
13
  "@react-spring/web": "^9.4.5",
14
14
  "react-use": "^17.3.2",
15
15
  "react-day-picker": "^8.0.3",
16
16
  "date-fns": "^2.28.0",
17
- "@trackunit/ui-icons": "0.0.41",
17
+ "@trackunit/ui-icons": "0.0.42-alpha-5bc30eb95.0",
18
18
  "react-useportal": "^1.0.16",
19
19
  "react-helmet": "^6.1.0",
20
20
  "@popperjs/core": "^2.11.4",
21
21
  "history": "^5.3.0",
22
22
  "react-router-dom": "^6.2.2",
23
- "react-select": "^5.2.2",
24
- "faker": "^5.5.3",
23
+ "react-select": "^5.4.0",
25
24
  "react-moment": "^1.1.2"
26
25
  },
27
26
  "module": "./index.js",