@trackunit/react-components 0.0.123 → 0.0.125

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.
Files changed (30) hide show
  1. package/common/CommonProps.d.ts +1 -0
  2. package/components/Badge/Badge.d.ts +1 -1
  3. package/components/BaseInput/BaseInput.d.ts +1 -1
  4. package/components/DayPicker/DayPickerPopover.d.ts +3 -2
  5. package/components/Icon/Icon.d.ts +4 -4
  6. package/components/Menu/MenuItem.d.ts +2 -1
  7. package/components/Select/CreatableSelect.d.ts +32 -4
  8. package/components/Select/FieldContainer.d.ts +3 -3
  9. package/components/Select/Select.d.ts +132 -5
  10. package/components/Select/{Select/TagWithWidth.d.ts → TagWithWidth.d.ts} +1 -1
  11. package/components/Select/{Select/TagsContainer.d.ts → TagsContainer.d.ts} +0 -0
  12. package/components/Select/index.d.ts +4 -0
  13. package/components/Select/shared.d.ts +10 -67
  14. package/components/Select/useCustomComponents.d.ts +19 -0
  15. package/components/Select/useCustomStyles.d.ts +14 -0
  16. package/components/Spinner/Spinner.d.ts +2 -3
  17. package/components/Tag/Tag.d.ts +1 -1
  18. package/components/Text/Text.d.ts +5 -6
  19. package/components/Toggle/Toggle.d.ts +1 -1
  20. package/components/buttons/Button/Button.d.ts +3 -2
  21. package/components/buttons/IconButton/IconButton.d.ts +3 -2
  22. package/components/buttons/shared/ButtonProps.d.ts +2 -3
  23. package/components/buttons/shared/helpers.d.ts +3 -2
  24. package/index.css +1 -1
  25. package/index.js +841 -234
  26. package/package.json +1 -1
  27. package/components/Select/Select/Select.d.ts +0 -122
  28. package/components/Select/Select/useCustomComponents.d.ts +0 -20
  29. package/components/Select/Select/useCustomStyles.d.ts +0 -10
  30. package/components/Select/Select/utils.d.ts +0 -10
@@ -9,3 +9,4 @@ export interface CommonProps {
9
9
  dataTestId?: string;
10
10
  }
11
11
  export declare type Density = "none" | "compact" | "comfortable" | "spacious" | "auto";
12
+ export declare type Size = "small" | "medium" | "large";
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import { Colors } from "../../constants/colors";
4
- export declare type BadgeSize = "default" | "large";
4
+ export declare type BadgeSize = "medium" | "large";
5
5
  interface BaseBadgeProps extends CommonProps {
6
6
  /**
7
7
  * The color of the badge.
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common";
3
3
  declare type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix">;
4
- declare type FieldSize = "small" | "default";
4
+ declare type FieldSize = "small" | "medium";
5
5
  export interface BaseInputProps extends FilteredInputProps, CommonProps {
6
6
  /**
7
7
  * An React element to render before the text in the input.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Matcher } from "react-day-picker";
3
- import { ButtonIntent, ButtonSize } from "../buttons";
3
+ import { Size } from "../../common";
4
+ import { ButtonIntent } from "../buttons";
4
5
  import { PopoverPlacement } from "../Popover";
5
6
  export interface DayPickerPopoverProps {
6
7
  disabledDays?: Matcher | Matcher[] | undefined;
@@ -8,7 +9,7 @@ export interface DayPickerPopoverProps {
8
9
  onDaySelect: (day: Date) => void;
9
10
  selectedDay?: Date;
10
11
  intent?: ButtonIntent;
11
- size?: ButtonSize;
12
+ size?: Size;
12
13
  placement?: PopoverPlacement;
13
14
  buttonContent: JSX.Element;
14
15
  language: string;
@@ -1,6 +1,6 @@
1
1
  import { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
2
2
  import * as React from "react";
3
- import { CommonProps } from "../../common/CommonProps";
3
+ import { CommonProps, Size } from "../../common/CommonProps";
4
4
  import { Colors } from "../../constants/colors";
5
5
  export interface IconProps extends CommonProps {
6
6
  /**
@@ -16,14 +16,14 @@ export interface IconProps extends CommonProps {
16
16
  color?: Colors;
17
17
  /**
18
18
  * The size of the icon.
19
- * Small = 16x16px, Normal = 20x20px, Large = 24x24px.
19
+ * Small = 16x16px, medium = 20x20px, Large = 24x24px.
20
20
  * Default value is Large.
21
21
  * If a custom size is needed, set it in the className.
22
22
  */
23
- size?: "small" | "normal" | "large";
23
+ size?: Size;
24
24
  /**
25
25
  * Select if the icon should be rendered as solid or outline.
26
- * Default value depends on the Size prop, small == solid, normal == solid, large == outline.
26
+ * Default value depends on the Size prop, small == solid, medium == solid, large == outline.
27
27
  * Trackunit icons might not support both outline and Solid.
28
28
  */
29
29
  type?: "solid" | "outline";
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- export interface MenuItemProps {
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ export interface MenuItemProps extends CommonProps {
3
4
  /**
4
5
  * The icon to be rendered in the menu item.
5
6
  */
@@ -1,10 +1,38 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { GroupBase } from "react-select";
3
- import { ISelectProps } from "./shared";
3
+ import { SelectProps } from "./Select";
4
+ interface CreateableSelectProps<Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> extends SelectProps<Option, IsAsync, IsMulti, Group> {
5
+ /**
6
+ * To hide the label.
7
+ */
8
+ hideLabel?: boolean;
9
+ /**
10
+ * Description for the select component.
11
+ */
12
+ description?: string;
13
+ /**
14
+ * Whether the component is invalid.
15
+ */
16
+ isInvalid?: boolean;
17
+ /**
18
+ * Info of the select component.
19
+ */
20
+ info?: React.ReactNode;
21
+ /**
22
+ * Error of the select component.
23
+ */
24
+ error?: React.ReactNode;
25
+ /**
26
+ * Size of the component.
27
+ */
28
+ size?: SelectSize;
29
+ }
30
+ export declare type SelectSize = "small" | "default";
4
31
  /**
5
32
  * The CreatableSelect component.
6
33
  *
7
- * @param {ISelectProps} props - The props for the CreatableSelect component
34
+ * @param {CreateableSelectProps} props - The props for the CreatableSelect component
8
35
  * @returns {JSX.Element} CreatableSelect component
9
36
  */
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;
37
+ export declare const CreatableSelect: <Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ dataTestId, id, label, hideLabel, description, error, info, isInvalid, maxMenuHeight, components, disabled, async, value, onChange, isMulti, classNamePrefix, isLoading, options, onMenuOpen, styles, ...props }: CreateableSelectProps<Option, IsAsync, IsMulti, Group>) => JSX.Element;
38
+ export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- interface SelectContainerProps {
2
+ export interface SelectContainerProps {
3
3
  children: React.ReactElement;
4
4
  label?: string;
5
5
  hideLabel?: boolean;
@@ -9,6 +9,7 @@ interface SelectContainerProps {
9
9
  error?: React.ReactNode;
10
10
  info?: React.ReactNode;
11
11
  dataTestId?: string;
12
+ isDisabled?: boolean;
12
13
  }
13
14
  /**
14
15
  * The SelectContainer component.
@@ -16,5 +17,4 @@ interface SelectContainerProps {
16
17
  * @param {SelectContainerProps} props - The props for the SelectContainer component
17
18
  * @returns {JSX.Element} SelectContainer component
18
19
  */
19
- export declare const SelectContainer: ({ children, label, hideLabel, id, hasError, error, description, info, dataTestId, }: SelectContainerProps) => JSX.Element;
20
- export {};
20
+ export declare const SelectContainer: ({ children, label, hideLabel, id, hasError, error, description, info, dataTestId, isDisabled, }: SelectContainerProps) => JSX.Element;
@@ -1,10 +1,137 @@
1
1
  /// <reference types="react" />
2
- import { GroupBase } from "react-select";
3
- import { ISelectProps } from "./shared";
2
+ import { GroupBase, OptionsOrGroups, Props } from "react-select";
3
+ import { CommonProps } from "../../common";
4
+ export interface SelectOption {
5
+ label: string;
6
+ value: string;
7
+ }
8
+ export interface AsyncSelect<Option, Group extends GroupBase<Option> = GroupBase<Option>> {
9
+ loadOptions: (input: string) => void | Promise<OptionsOrGroups<Option, Group>>;
10
+ defaultOptions: OptionsOrGroups<Option, Group> | undefined;
11
+ cacheOptions: boolean;
12
+ }
13
+ export interface SelectProps<Option, IsAsync extends boolean, IsMulti extends boolean, GroupType extends GroupBase<Option>> extends CommonProps, Props<Option, IsMulti, GroupType> {
14
+ /**
15
+ * An React element to render before the text in the select.
16
+ * This is typically used to render an icon.
17
+ *
18
+ *
19
+ * @memberof SelectProps
20
+ */
21
+ prefix?: JSX.Element;
22
+ /**
23
+ * An string to render in field when there is no value selected.
24
+ * Can be used as a description, example or a hint.
25
+ *
26
+ *
27
+ * @memberof SelectProps
28
+ */
29
+ placeholder?: string;
30
+ /**
31
+ * An boolean flag to disable field
32
+ *
33
+ *
34
+ * @memberof SelectProps
35
+ */
36
+ disabled?: boolean;
37
+ /**
38
+ * An field id
39
+ *
40
+ *
41
+ * @memberof SelectProps
42
+ */
43
+ id?: string;
44
+ /**
45
+ * An boolean flag to set select into async mode
46
+ * This is typically used when data is fetched after render
47
+ *
48
+ *
49
+ * @memberof SelectProps
50
+ */
51
+ async?: AsyncSelect<Option, GroupType>;
52
+ /**
53
+ * A custom icon to be used as a dropdown indicator
54
+ * This is typically used during style customization
55
+ *
56
+ *
57
+ * @memberof SelectProps
58
+ */
59
+ dropdownIcon?: JSX.Element;
60
+ /**
61
+ * A label to be used as a aria-label
62
+ * This is typically used for accessibility
63
+ *
64
+ *
65
+ * @memberof SelectProps
66
+ */
67
+ label?: string;
68
+ /**
69
+ * A number of pixels to limit maximal length of the select menu list
70
+ *
71
+ *
72
+ * @memberof SelectProps
73
+ */
74
+ maxMenuHeight?: number;
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 boolean flag to display loading indicator
86
+ *
87
+ *
88
+ * @memberof SelectProps
89
+ */
90
+ isLoading?: boolean;
91
+ /**
92
+ * A number value to limit amount of visible tags for selected options
93
+ *
94
+ *
95
+ * @memberof SelectProps
96
+ */
97
+ maxSelectedDisplayCount?: number;
98
+ /**
99
+ * A custom handler for menu open event
100
+ * use if you want to trigger custom logic or fetch data
101
+ *
102
+ *
103
+ * @memberof SelectProps
104
+ */
105
+ onMenuOpen?: () => void;
106
+ /**
107
+ * A flag to allow user to clear value once selected
108
+ * default value is true
109
+ *
110
+ *
111
+ * @memberof SelectProps
112
+ */
113
+ isClearable?: boolean;
114
+ /**
115
+ * A flag to allow user to filter option list by key from the text input
116
+ *
117
+ *
118
+ * @memberof SelectProps
119
+ */
120
+ isSearchable?: boolean;
121
+ /**
122
+ * A flag to set select into async mode
123
+ *
124
+ * @memberof SelectProps
125
+ */
126
+ isAsync?: IsAsync;
127
+ }
4
128
  /**
5
- * The Select component.
129
+ * Selects are input components used to choose a value from a set.
6
130
  *
7
- * @param {ISelectProps} props - The props for the Select component
131
+ * @param {SelectProps} props - The props for the Select component
8
132
  * @returns {JSX.Element} Select component
9
133
  */
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;
134
+ export declare const Select: {
135
+ <Option, IsAsync extends boolean = false, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ id, className, dataTestId, prefix, async, dropdownIcon, maxMenuHeight, label, hasError, disabled, isMulti, components, value, options, onChange, isLoading, classNamePrefix, onMenuOpen, onMenuClose, maxSelectedDisplayCount, isClearable, isSearchable, onMenuScrollToBottom, styles, filterOption, onInputChange, }: SelectProps<Option, IsAsync, IsMulti, Group>): JSX.Element;
136
+ displayName: string;
137
+ };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { TagProps } from "../../Tag";
2
+ import { TagProps } from "../Tag";
3
3
  declare type TagsPropsNoRef = Omit<TagProps, "ref">;
4
4
  interface TagWithWidthProps extends TagsPropsNoRef {
5
5
  onWidthKnown?: ({ width }: {
@@ -1,3 +1,7 @@
1
+ import ValueType from "react-select";
1
2
  export * from "./CreatableSelect";
2
3
  export * from "./Select";
4
+ export * from "./SelectMenuItem/SelectMenuItem";
3
5
  export * from "./shared";
6
+ export * from "./useCustomComponents";
7
+ export { ValueType };
@@ -1,71 +1,14 @@
1
- import * as React from "react";
2
- import { GroupBase, Props, StylesConfig } from "react-select";
3
- import { AsyncProps } from "react-select/async";
4
- import { SelectComponents } from "react-select/dist/declarations/src/components";
5
- import { CommonProps } from "../../common/CommonProps";
6
- export interface SelectOption {
7
- label: string;
8
- value: string;
9
- options?: SelectOption[];
10
- }
11
- export declare type SelectSize = "small" | "default";
12
- export interface ISelectProps<Option, IsAsync extends boolean, IsMulti extends boolean, GroupType extends GroupBase<Option>> extends CommonProps, Props<Option, IsMulti, GroupType> {
13
- /**
14
- * Label to be displayed.
15
- */
16
- label?: string;
17
- /**
18
- * To hide the label.
19
- */
20
- hideLabel?: boolean;
21
- /**
22
- * Description for the select component.
23
- */
24
- description?: string;
25
- /**
26
- * Whether the component is invalid.
27
- */
28
- isInvalid?: boolean;
29
- /**
30
- * Whether the component is disabled.
31
- */
32
- isDisabled?: boolean;
33
- /**
34
- * Info of the select component.
35
- */
36
- info?: React.ReactNode;
37
- /**
38
- * Error of the select component.
39
- */
40
- error?: React.ReactNode;
41
- /**
42
- * Size of the component.
43
- */
44
- size?: SelectSize;
45
- /**
46
- * Whether component is asynchronous or not.
47
- */
48
- isAsync?: IsAsync;
49
- }
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>;
1
+ import { GroupBase, MultiValue, OptionsOrGroups, PropsValue, SingleValue } from "react-select";
51
2
  /**
52
- * The useCustomStyles hook for getting trackunit specific styling on react-select.
53
- *
54
- * @param {StylesConfig} styles -
55
- * @param {boolean} hasError -
56
- * @param {boolean} isInvalid -
57
- * @param {SelectSize} size -
58
- * @returns {{StylesConfig}} useCustomStyles hook return
3
+ * @param {MultiValue<Option> | SingleValue<Option>} arg option to check type
4
+ * @returns {arg is MultiValue<Option> } is Multivalue
59
5
  */
60
- export declare const useCustomStyles: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(styles: StylesConfig<Option, IsMulti, Group> | undefined, hasError: boolean, isInvalid: boolean | undefined, size: SelectSize) => {
61
- customStyles: StylesConfig<Option, IsMulti, Group>;
62
- };
6
+ export declare function isMultiValue<Option>(arg: MultiValue<Option> | SingleValue<Option>): arg is MultiValue<Option>;
63
7
  /**
64
- * The useCustomComponents hook for getting trackunit specific components on react-select.
65
- *
66
- * @param {SelectComponents} components -
67
- * @returns {*}} useCustomComponents hook return
8
+ * @template IsMulti
9
+ * @template Group
10
+ * @param {OptionsOrGroups<Option, Group> | undefined} options An array of options to select from
11
+ * @param {PropsValue<Option> | undefined} value Selected values
12
+ * @returns {OptionsOrGroups<Option, Group>} An array of ordered options with selected on top
68
13
  */
69
- export declare const useCustomComponents: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(components: Partial<SelectComponents<Option, IsMulti, Group>> | undefined) => {
70
- customComponents: Partial<SelectComponents<Option, IsMulti, Group>>;
71
- };
14
+ export declare const getOrderedOptions: <Option, Group extends GroupBase<Option>>(options: OptionsOrGroups<Option, Group> | undefined, value: PropsValue<Option> | undefined) => OptionsOrGroups<Option, Group>;
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { GroupBase } from "react-select";
3
+ import { SelectComponents } from "react-select/dist/declarations/src/components";
4
+ /**
5
+ * A hook to retrieve components override object.
6
+ * 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.
7
+ *
8
+ * @template IsMulti
9
+ * @template Group
10
+ * @param {Partial<SelectComponents<Option, IsMulti, Group>> | undefined} componentsProps a custom component prop that you can to override defaults
11
+ * @param {boolean} disabled decide to override disabled variant
12
+ * @param {boolean} menuIsClosing a flag to trigger fade out animation for the menu
13
+ * @param {React.MutableRefObject<boolean>} refMenuIsEnabled a flag to block menu from open
14
+ * @param {string} dataTestId a test id
15
+ * @param {number} maxSelectedDisplayCount a number of max display count
16
+ * @param {JSX.Element} dropdownIcon an custom dropdown icon
17
+ * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
18
+ */
19
+ export declare const useCustomComponents: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(componentsProps: Partial<SelectComponents<Option, IsMulti, Group>> | undefined, disabled: boolean, menuIsClosing: boolean, refMenuIsEnabled: React.MutableRefObject<boolean>, dataTestId: string, maxSelectedDisplayCount: number | undefined, dropdownIcon?: JSX.Element) => Partial<SelectComponents<Option, IsMulti, Group>>;
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { GroupBase, StylesConfig } from "react-select";
3
+ /**
4
+ * @template IsMulti
5
+ * @template Group
6
+ * @param {React.RefObject<HTMLDivElement>} refContainer react ref to container element
7
+ * @param {React.RefObject<HTMLDivElement>} refPrefix react ref to prefix element
8
+ * @param {number | undefined} maxSelectedDisplayCount a number of max display count
9
+ * @param {StylesConfig<Option, IsMulti, Group> | undefined} styles a optional object to override styles of react-select
10
+ * @returns {StylesConfig<Option, boolean>} styles to override in select
11
+ */
12
+ export declare const useCustomStyles: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(refContainer: React.RefObject<HTMLDivElement>, refPrefix: React.RefObject<HTMLDivElement>, maxSelectedDisplayCount: number | undefined, styles: StylesConfig<Option, IsMulti, Group> | undefined) => {
13
+ customStyles: StylesConfig<Option, IsMulti, Group>;
14
+ };
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { CommonProps } from "../../common/CommonProps";
3
- export declare type SpinnerSize = "small" | "regular" | "large";
2
+ import { CommonProps, Size } from "../../common/CommonProps";
4
3
  export interface SpinnerProps extends CommonProps {
5
4
  /**
6
5
  * Defines the size of the spinner.
7
6
  */
8
- size?: SpinnerSize;
7
+ size?: Size;
9
8
  /**
10
9
  * When true, the spinner will be centered in the parent element using css grid.
11
10
  */
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import { Colors } from "../../constants/colors";
4
- export declare type TagSize = "default" | "small";
4
+ export declare type TagSize = "small" | "medium";
5
5
  export interface TagProps extends CommonProps {
6
6
  /**
7
7
  * The color of the tag.
@@ -1,9 +1,8 @@
1
1
  import * as React from "react";
2
- import { CommonProps } from "../../common/CommonProps";
2
+ import { CommonProps, Size } from "../../common/CommonProps";
3
3
  export declare type TextType = "p" | "span" | "div";
4
- export declare type TextSize = "small" | "default" | "large";
5
4
  export declare type TextAlign = "left" | "center" | "right";
6
- export declare type TextWeight = "default" | "thick" | "bold";
5
+ export declare type TextWeight = "normal" | "thick" | "bold";
7
6
  export interface TextProps extends CommonProps {
8
7
  /**
9
8
  * Child nodes.
@@ -14,15 +13,15 @@ export interface TextProps extends CommonProps {
14
13
  */
15
14
  type?: TextType;
16
15
  /**
17
- * Size of element. Values can be "default", "small", or "large".
16
+ * Size of element. Values can be "small", "medium", or "large".
18
17
  */
19
- size?: TextSize;
18
+ size?: Size;
20
19
  /**
21
20
  * Alignment of the text. Values can be "left", "center", or "right".
22
21
  */
23
22
  align?: TextAlign;
24
23
  /**
25
- * Weight of the text. Values can be "default", "thick", or "bold".
24
+ * Weight of the text. Values can be "normal", "thick", or "bold".
26
25
  */
27
26
  weight?: TextWeight;
28
27
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
3
  import "./Toggle.css";
4
- export declare type ToggleSize = "small" | "default";
4
+ export declare type ToggleSize = "small" | "medium";
5
5
  export interface ToggleProps extends CommonProps {
6
6
  /**
7
7
  * ID of the toggle.
@@ -1,8 +1,9 @@
1
1
  import * as React from "react";
2
- import { ButtonCommonProps, ButtonIntent, ButtonSize, ButtonType, ButtonVariant } from "../shared/ButtonProps";
2
+ import { Size } from "../../../common";
3
+ import { ButtonCommonProps, ButtonIntent, ButtonType, ButtonVariant } from "../shared/ButtonProps";
3
4
  export interface StyledButtonProps {
4
5
  $variant: ButtonVariant;
5
- $size: ButtonSize;
6
+ $size: Size;
6
7
  $square: boolean;
7
8
  $intent: ButtonIntent;
8
9
  $fullWidth: boolean;
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
+ import { Size } from "../../../common";
2
3
  import "../shared/Button.css";
3
- import { ButtonCommonProps, ButtonSize } from "../shared/ButtonProps";
4
+ import { ButtonCommonProps } from "../shared/ButtonProps";
4
5
  export interface IconButtonProps extends ButtonCommonProps {
5
6
  /**
6
7
  * The icon to display.
@@ -19,6 +20,6 @@ export interface IconButtonProps extends ButtonCommonProps {
19
20
  /**
20
21
  * The size of the button. Defaults to "small".
21
22
  */
22
- size?: ButtonSize;
23
+ size?: Size;
23
24
  }
24
25
  export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { CommonProps } from "../../../common/CommonProps";
2
+ import { CommonProps, Size } from "../../../common/CommonProps";
3
3
  export declare type ButtonVariant = "filled" | "transparent";
4
4
  export declare type ButtonIntent = "primary" | "secondary" | "danger" | "warning" | "tertiary";
5
5
  export declare type ButtonType = "button" | "submit";
6
- export declare type ButtonSize = "small" | "normal" | "large";
7
6
  export interface ButtonCommonProps extends CommonProps {
8
7
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
9
8
  /**
@@ -29,7 +28,7 @@ export interface ButtonCommonProps extends CommonProps {
29
28
  /**
30
29
  * The size of the button.
31
30
  */
32
- size?: ButtonSize;
31
+ size?: Size;
33
32
  /**
34
33
  * The link to be used for the button.
35
34
  */
@@ -1,8 +1,9 @@
1
- import { ButtonIntent, ButtonSize, ButtonVariant } from "./ButtonProps";
1
+ import { Size } from "../../../common";
2
+ import { ButtonIntent, ButtonVariant } from "./ButtonProps";
2
3
  interface ButtonProps {
3
4
  $intent: ButtonIntent;
4
5
  $variant: ButtonVariant;
5
- $size: ButtonSize;
6
+ $size: Size;
6
7
  }
7
8
  /**
8
9
  * Helper to get the needed classname from buttonProps.
package/index.css CHANGED
@@ -242,7 +242,7 @@
242
242
  transition-all;
243
243
  }
244
244
 
245
- &--default {
245
+ &--medium {
246
246
  @apply flex
247
247
  items-center
248
248
  p-1