@trackunit/react-components 0.0.36

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 (126) hide show
  1. package/README.md +36 -0
  2. package/common/CommonProps.d.ts +17 -0
  3. package/common/StorybookProps.d.ts +6 -0
  4. package/common/index.d.ts +3 -0
  5. package/common/useContainerProps.d.ts +8 -0
  6. package/components/NumberField/NumberField.d.ts +15 -0
  7. package/components/NumberInput/NumberInput.d.ts +12 -0
  8. package/components/TextInput/TextInput.d.ts +12 -0
  9. package/components/alert/Alert.d.ts +69 -0
  10. package/components/alert/index.d.ts +1 -0
  11. package/components/badge/Badge.d.ts +74 -0
  12. package/components/badge/index.d.ts +1 -0
  13. package/components/baseInput/BaseInput.d.ts +82 -0
  14. package/components/baseInput/index.d.ts +1 -0
  15. package/components/buttons/button/Button.d.ts +55 -0
  16. package/components/buttons/icon-button/IconButton.d.ts +33 -0
  17. package/components/buttons/index.d.ts +4 -0
  18. package/components/buttons/shared/ButtonProps.d.ts +61 -0
  19. package/components/buttons/shared/helpers.d.ts +9 -0
  20. package/components/buttons/star-button/StarButton.d.ts +7 -0
  21. package/components/card/Card.d.ts +33 -0
  22. package/components/card/CardBody.d.ts +21 -0
  23. package/components/card/CardFooter.d.ts +16 -0
  24. package/components/card/CardHeader.d.ts +39 -0
  25. package/components/card/DensityContainer.d.ts +36 -0
  26. package/components/card/index.d.ts +5 -0
  27. package/components/chart/Chart.d.ts +105 -0
  28. package/components/chart/index.d.ts +1 -0
  29. package/components/checkbox/CheckIcon.d.ts +4 -0
  30. package/components/checkbox/Checkbox.d.ts +53 -0
  31. package/components/checkbox/IndeterminateIcon.d.ts +4 -0
  32. package/components/checkbox/index.d.ts +1 -0
  33. package/components/collapse/Collapse.d.ts +33 -0
  34. package/components/collapse/index.d.ts +1 -0
  35. package/components/copyableText/CopyableText.d.ts +8 -0
  36. package/components/copyableText/index.d.ts +1 -0
  37. package/components/dateField/DateField.d.ts +46 -0
  38. package/components/dateField/index.d.ts +1 -0
  39. package/components/dayPicker/DayPicker.d.ts +9 -0
  40. package/components/dayPicker/DayPickerPopover.d.ts +16 -0
  41. package/components/dayPicker/DayRangePicker.d.ts +11 -0
  42. package/components/dayPicker/index.d.ts +21 -0
  43. package/components/dayPicker/useLocale.d.ts +2 -0
  44. package/components/drawer/Drawer.d.ts +32 -0
  45. package/components/drawer/index.d.ts +1 -0
  46. package/components/formGroup/FormGroup.d.ts +42 -0
  47. package/components/heading/Heading.d.ts +34 -0
  48. package/components/heading/index.d.ts +1 -0
  49. package/components/icon/Icon.d.ts +49 -0
  50. package/components/index.d.ts +37 -0
  51. package/components/indicator/Indicator.d.ts +34 -0
  52. package/components/indicator/index.d.ts +1 -0
  53. package/components/label/Label.d.ts +33 -0
  54. package/components/label/index.d.ts +1 -0
  55. package/components/legendItem/LegendItem.d.ts +11 -0
  56. package/components/legendItem/index.d.ts +1 -0
  57. package/components/menu/MenuButton.d.ts +7 -0
  58. package/components/menu/MenuItem.d.ts +9 -0
  59. package/components/menu/MenuList.d.ts +11 -0
  60. package/components/menu/index.d.ts +3 -0
  61. package/components/modal/Modal.d.ts +42 -0
  62. package/components/modal/ModalBackdrop.d.ts +7 -0
  63. package/components/modal/index.d.ts +3 -0
  64. package/components/modal/useModal.d.ts +15 -0
  65. package/components/multiRowTableCell/MultiRowTableCell.d.ts +30 -0
  66. package/components/multiRowTableCell/index.d.ts +1 -0
  67. package/components/pageHeading/PageHeading.d.ts +9 -0
  68. package/components/pageHeading/index.d.ts +1 -0
  69. package/components/popover/AnimatedPopover.d.ts +15 -0
  70. package/components/popover/PopoverList.d.ts +6 -0
  71. package/components/popover/PopoverListItem.d.ts +16 -0
  72. package/components/popover/PopoverTitle.d.ts +8 -0
  73. package/components/popover/index.d.ts +5 -0
  74. package/components/popover/usePopover.d.ts +24 -0
  75. package/components/prompt/Prompt.d.ts +10 -0
  76. package/components/prompt/index.d.ts +1 -0
  77. package/components/radioGroup/RadioGroup.d.ts +14 -0
  78. package/components/radioGroup/RadioGroupContext.d.ts +10 -0
  79. package/components/radioGroup/RadioItem.d.ts +8 -0
  80. package/components/radioGroup/index.d.ts +2 -0
  81. package/components/select/CreatableSelect.d.ts +4 -0
  82. package/components/select/FieldContainer.d.ts +14 -0
  83. package/components/select/Select.d.ts +4 -0
  84. package/components/select/index.d.ts +3 -0
  85. package/components/select/shared.d.ts +83 -0
  86. package/components/skeletonLines/SkeletonLines.d.ts +41 -0
  87. package/components/skeletonLines/index.d.ts +1 -0
  88. package/components/spacer/Spacer.d.ts +21 -0
  89. package/components/spacer/index.d.ts +1 -0
  90. package/components/spinner/Spinner.d.ts +24 -0
  91. package/components/spinner/index.d.ts +1 -0
  92. package/components/text/Text.d.ts +79 -0
  93. package/components/text/index.d.ts +1 -0
  94. package/components/textArea/TextArea.d.ts +25 -0
  95. package/components/textArea/index.d.ts +1 -0
  96. package/components/textField/TextField.d.ts +23 -0
  97. package/components/textField/TextLenghtIndicator.d.ts +6 -0
  98. package/components/textField/index.d.ts +1 -0
  99. package/components/theme/DefaultTheme.d.ts +2 -0
  100. package/components/theme/index.d.ts +1 -0
  101. package/components/tip/Tip.d.ts +13 -0
  102. package/components/tip/index.d.ts +1 -0
  103. package/components/toggle/Toggle.d.ts +15 -0
  104. package/components/toggle/index.d.ts +1 -0
  105. package/components/tooltip/Tooltip.d.ts +69 -0
  106. package/components/tooltip/index.d.ts +1 -0
  107. package/constants/colors.d.ts +65 -0
  108. package/constants/index.d.ts +1 -0
  109. package/hooks/index.d.ts +3 -0
  110. package/hooks/useDebounce.d.ts +1 -0
  111. package/hooks/useLocalStorage.d.ts +2 -0
  112. package/hooks/useTimeout.d.ts +9 -0
  113. package/index.d.ts +5 -0
  114. package/index.js +3829 -0
  115. package/layout/helper/MinTopFullContentLayout.d.ts +12 -0
  116. package/layout/index.d.ts +7 -0
  117. package/layout/responsive/FilterListMapLayout.d.ts +19 -0
  118. package/layout/responsive/FullWidthRepeatingLayout.d.ts +16 -0
  119. package/layout/responsive/GridArea.d.ts +12 -0
  120. package/layout/responsive/IntrinsicallyResponsiveGrid.d.ts +26 -0
  121. package/layout/responsive/TitleNavContentLayout.d.ts +6 -0
  122. package/layout/responsive/TwoColumnLayout.d.ts +6 -0
  123. package/package.json +32 -0
  124. package/test-config/jest.setup.d.ts +1 -0
  125. package/test-utils/hooks.d.ts +4 -0
  126. package/test-utils/test-utils.d.ts +5 -0
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # React components
2
+
3
+ The React Components library should be the home for reuseable React components in the manager.
4
+ This library is (going to be) exposed publibly and should therfore be treated accordingly.
5
+
6
+ ### Component generation command example
7
+ `yarn nx workspace-generator react-component MyTestComponent --directory=components --project=react-components --no-interactive`
8
+
9
+ ## Rules for this library
10
+ _Not all current components lives up the these standards but any new component should_
11
+ _We are working on updating all existing components_
12
+
13
+ All Components in this lib:
14
+ - Must be exposed in our storybook.
15
+ - Must have sufficient test coverage.
16
+ - Must extend CommonProps (Have ClassName and DataTestId).
17
+ - Must expose their styles in a .css file using @apply and be exposed in our css-components library.
18
+ - Should be reviewed by @patr2275.
19
+ - May only depend on other Buildable, Publishable and visibility:public tagged libs.
20
+
21
+ ## Stories for components
22
+
23
+ **Component.stories.tsx**
24
+ Used for holding the code for the individual stories and configuring the story parameters.
25
+ Keeping these in the .tsx file allows for Typescript and auto completion.
26
+
27
+ Prefixing a story with Hidden removes it form the sidebar navigation, but they can still be referenced in the docs mdx.
28
+
29
+ **Component.docs.mdx**
30
+ Handles the layout of the docs page shown in storybook.
31
+ References stories from the tsx file.
32
+
33
+ ## TODO:
34
+ 1. Update Introduction and Fundamentals documentation.
35
+ 2. Enable docs autogen to generate props and controls from typescript and jsdocs.
36
+ 3. Update stories on existing components and move them away from Legacy Components.
@@ -0,0 +1,17 @@
1
+ export interface CommonProps {
2
+ /**
3
+ * A custom class name to be attached to root element
4
+ *
5
+ * @type string
6
+ * @memberof CommonProps
7
+ */
8
+ className?: string;
9
+ /**
10
+ * A id that can be used in tests to get the component
11
+ *
12
+ * @type string
13
+ * @memberof CommonProps
14
+ */
15
+ dataTestId?: string;
16
+ }
17
+ export declare type Density = "none" | "compact" | "comfortable" | "spacious" | "auto";
@@ -0,0 +1,6 @@
1
+ export declare const docs: {
2
+ source: {
3
+ type: string;
4
+ excludeDecorators: boolean;
5
+ };
6
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./CommonProps";
2
+ export * from "./StorybookProps";
3
+ export * from "./useContainerProps";
@@ -0,0 +1,8 @@
1
+ export interface IUseContainerProps {
2
+ className?: string;
3
+ dataTestId?: string;
4
+ }
5
+ export declare const useContainerProps: ({ className, dataTestId }: IUseContainerProps) => {
6
+ className: string | undefined;
7
+ "data-testid": string | undefined;
8
+ };
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { FormGroupProps } from "../formGroup/FormGroup";
3
+ import { NumberInputProps } from "../NumberInput/NumberInput";
4
+ declare type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
5
+ export interface NumberFieldProps extends NumberInputProps, FormGroupExposedProps {
6
+ /**
7
+ * If a value is set, the field is rendered in its invalid state.
8
+ *
9
+ * @type string
10
+ * @memberof NumberFieldProps
11
+ */
12
+ errorMessage?: string;
13
+ }
14
+ export declare const NumberField: import("react").ForwardRefExoticComponent<NumberFieldProps & import("react").RefAttributes<HTMLInputElement>>;
15
+ export {};
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputProps } from "../baseInput";
3
+ declare type BaseInputExposedProps = Omit<BaseInputProps, "type">;
4
+ export interface NumberInputProps extends BaseInputExposedProps {
5
+ }
6
+ /**
7
+ * A thin wrapper arround the `BaseInput` component for number input fields.
8
+ *
9
+ * *NOTE: If shown with a label, please use the `NumberField` component instead.*
10
+ */
11
+ export declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputProps } from "../baseInput/BaseInput";
3
+ declare type BaseInputExposedProps = Omit<BaseInputProps, "type">;
4
+ export interface TextInputProps extends BaseInputExposedProps {
5
+ }
6
+ /**
7
+ * A thin wrapper arround the `BaseInput` component for text input fields.
8
+ *
9
+ * *NOTE: If shown with a label, please use the `TextField` component instead.*
10
+ */
11
+ export declare const TextInput: import("react").ForwardRefExoticComponent<TextInputProps & import("react").RefAttributes<HTMLInputElement>>;
12
+ export {};
@@ -0,0 +1,69 @@
1
+ import * as React from "react";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ export declare type AlertIntent = "info" | "warning" | "danger" | "success";
4
+ export declare type AlertActionType = "primary" | "secondary";
5
+ export declare type AlertAction = {
6
+ label: string;
7
+ onClick: () => void;
8
+ loading?: boolean;
9
+ };
10
+ export interface AlertProps extends CommonProps {
11
+ /**
12
+ * Child nodes.
13
+ *
14
+ * @type React.ReactNode
15
+ * @memberof AlertProps
16
+ */
17
+ children: React.ReactNode;
18
+ /**
19
+ * Intent of the alert component.
20
+ *
21
+ * @type {AlertIntent}
22
+ * @memberof AlertProps
23
+ */
24
+ intent?: AlertIntent;
25
+ /**
26
+ * Title of the alert component.
27
+ *
28
+ * @type string
29
+ * @memberof AlertProps
30
+ */
31
+ title?: string;
32
+ /**
33
+ * Action to be performed on clicking the primary button.
34
+ *
35
+ * @type AlertAction
36
+ * @memberof AlertProps
37
+ */
38
+ primaryAction?: AlertAction;
39
+ /**
40
+ * Action to be performed on clicking the secondary button.
41
+ *
42
+ * @type AlertAction
43
+ * @memberof AlertProps
44
+ */
45
+ secondaryAction?: AlertAction;
46
+ /**
47
+ * OnClose Event.
48
+ *
49
+ * @memberof AlertProps
50
+ */
51
+ onClose?: () => void;
52
+ /**
53
+ * Whether the contents should be displayed inline or not.
54
+ *
55
+ * @type boolean
56
+ * @memberof AlertProps
57
+ */
58
+ inline?: boolean;
59
+ /**
60
+ * A prop to enable autoscroll to alert element
61
+ *
62
+ * could be used for displaying errors on long scrollable forms
63
+ *
64
+ * @type boolean
65
+ * @memberof AlertProps
66
+ */
67
+ autoScroll?: boolean;
68
+ }
69
+ export declare const Alert: ({ intent, title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline, }: AlertProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./Alert";
@@ -0,0 +1,74 @@
1
+ import * as React from "react";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ export declare type BadgeIntent = "primary" | "secondary" | "success" | "danger" | "warning";
4
+ export declare type BadgeSize = "default" | "large";
5
+ declare type BadgeVariant = "badge" | "pill" | "tag";
6
+ export interface TagProps extends BaseBadgeProps {
7
+ /**
8
+ * The name of the variant.
9
+ *
10
+ * @type string}
11
+ * @memberof TagProps
12
+ */
13
+ variant: "tag";
14
+ /**
15
+ * A handler for a click event triggered on x icon
16
+ * if not passed then x icon won't be visible
17
+ * @type {() => void}
18
+ * @memberof TagProps
19
+ */
20
+ onClose?: () => void;
21
+ }
22
+ export interface BaseBadgeProps extends CommonProps {
23
+ /**
24
+ * The intent of the badge.
25
+ *
26
+ * @type {BadgeIntent}
27
+ * @memberof BadgeProps
28
+ */
29
+ intent?: BadgeIntent;
30
+ /**
31
+ * Specifies whether the intent style should be subtle or not.
32
+ *
33
+ * @type {boolean}
34
+ * @memberof BadgeProps
35
+ */
36
+ subtle?: boolean;
37
+ /**
38
+ * Whether badge should be displayed as a pill, tag or badge
39
+ * pill numeric values above 99 will be displayed as 99+.
40
+ * tag will display x icon, you have to provide onClose handler
41
+ *
42
+ * Badge will use subtle intent by default.
43
+ *
44
+ * @type {BadgeVariant}
45
+ * @memberof BadgeProps
46
+ */
47
+ variant?: BadgeVariant;
48
+ /**
49
+ * Custom classNames can be added to make adjustments where needed.
50
+ * Example: Set a maximum width of the badge by adding the className "max-w-[your-max-width]" or similar tailwind max-w class.
51
+ * This will make the badge truncate the text if it is too long.
52
+ *
53
+ * @type string
54
+ * @memberof BadgeProps
55
+ */
56
+ className?: string;
57
+ /**
58
+ * Child nodes of the Badge.
59
+ *
60
+ * @type React.ReactNode
61
+ * @memberof BadgeProps
62
+ */
63
+ children?: React.ReactNode;
64
+ /**
65
+ * Size of the badge.
66
+ *
67
+ * @type {BadgeSize}
68
+ * @memberof BadgeProps
69
+ */
70
+ size?: BadgeSize;
71
+ }
72
+ export declare type BadgeProps = BaseBadgeProps | TagProps;
73
+ export declare const Badge: ({ intent, subtle, className, variant, dataTestId, children, size, ...rest }: BadgeProps) => JSX.Element;
74
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Badge";
@@ -0,0 +1,82 @@
1
+ import * as React from "react";
2
+ import { CommonProps } from "../../common";
3
+ declare type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix">;
4
+ declare type FieldSize = "small" | "default";
5
+ export interface BaseInputProps extends FilteredInputProps, CommonProps {
6
+ /**
7
+ * An React element to render before the text in the input.
8
+ * This is typically used to render an icon.
9
+ * For other elements than icons, please concider using the addonBefore prop.
10
+ *
11
+ * @type React.ReactNode
12
+ * @memberof BaseInputProps
13
+ */
14
+ prefix?: React.ReactNode;
15
+ /**
16
+ * An React element to render after the text in the input.
17
+ * This is typically used to render an icon.
18
+ * For other elements than icons, please concider using the addonAfter prop.
19
+ *
20
+ * @type React.ReactNode
21
+ * @memberof BaseInputProps
22
+ */
23
+ suffix?: React.ReactNode;
24
+ /**
25
+ * An React element to render in a seperate container before the text in the input.
26
+ * This is typically used to render text.
27
+ * For icons, please concider using the prefix prop.
28
+ *
29
+ * @type React.ReactNode
30
+ * @memberof BaseInputProps
31
+ */
32
+ addonBefore?: React.ReactNode;
33
+ /**
34
+ * An React element to render in a seperate container after the text in the input.
35
+ * This is typically used to render text.
36
+ * For icons, please concider using the suffix prop.
37
+ *
38
+ * @type React.ReactNode
39
+ * @memberof BaseInputProps
40
+ */
41
+ addonAfter?: React.ReactNode;
42
+ /**
43
+ * An ReactNode to render at the end of the input field befire the addonAfter.
44
+ * Mainly meant for the icon button actions for special input types.
45
+ *
46
+ * @type React.ReactNode
47
+ * @memberof BaseInputProps
48
+ */
49
+ actions?: React.ReactNode;
50
+ /**
51
+ * The size of the input.
52
+ * Default == 40px, Small == 32px.
53
+ *
54
+ * @type "small" | "default"
55
+ * @memberof BaseInputProps
56
+ */
57
+ fieldSize?: FieldSize;
58
+ /**
59
+ * If ture the field is rendered in its invalid state.
60
+ *
61
+ * @type boolean
62
+ * @memberof BaseInputProps
63
+ */
64
+ isInvalid?: boolean;
65
+ /**
66
+ * The Placeholder text for the input.
67
+ *
68
+ * @type string
69
+ * @memberof BaseInputProps
70
+ */
71
+ placeholder?: string;
72
+ }
73
+ /**
74
+ * A base input component that can be used for text inputs, password inputs, etc.
75
+ * A reference to the input element is provided as the `ref` prop.
76
+ * Extends props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
77
+ *
78
+ * For specific input types make sure to use the corresponding input component.
79
+ * This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
80
+ */
81
+ export declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HTMLInputElement>>;
82
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./BaseInput";
@@ -0,0 +1,55 @@
1
+ import * as React from "react";
2
+ import { ButtonCommonProps, ButtonIntent, ButtonSize, ButtonType, ButtonVariant } from "../shared/ButtonProps";
3
+ export interface StyledButtonProps {
4
+ $variant: ButtonVariant;
5
+ $size: ButtonSize;
6
+ $square: boolean;
7
+ $intent: ButtonIntent;
8
+ $fullWidth: boolean;
9
+ }
10
+ export interface ButtonProps extends ButtonCommonProps {
11
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
12
+ /**
13
+ * Child nodes. Can be used to pass in text to be displayed on the button.
14
+ *
15
+ * @type React.ReactNode
16
+ * @memberof ButtonProps
17
+ */
18
+ children?: React.ReactNode;
19
+ /**
20
+ * Whether button is fullWidth or not.
21
+ *
22
+ * @type {boolean}
23
+ * @memberof ButtonProps
24
+ */
25
+ fullWidth?: boolean;
26
+ /**
27
+ * The button prefix.
28
+ *
29
+ * @type React.ReactNode
30
+ * @memberof ButtonProps
31
+ */
32
+ prefix?: React.ReactNode;
33
+ /**
34
+ * The button suffix.
35
+ *
36
+ * @type React.ReactNode
37
+ * @memberof ButtonProps
38
+ */
39
+ suffix?: React.ReactNode;
40
+ /**
41
+ * The type of the button. Values can be "submit" or "button".
42
+ *
43
+ * @type {ButtonType}
44
+ * @memberof ButtonProps
45
+ */
46
+ type?: ButtonType;
47
+ /**
48
+ * The element type the button will be rendered as.
49
+ *
50
+ * @type {(keyof JSX.IntrinsicElements | React.ComponentType<any>)}
51
+ * @memberof ButtonProps
52
+ */
53
+ renderAs?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
54
+ }
55
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { ButtonCommonProps, ButtonSize } from "../shared/ButtonProps";
3
+ export interface IconButtonProps extends ButtonCommonProps {
4
+ /**
5
+ * The icon to display.
6
+ *
7
+ * @type React.ReactNode
8
+ * @memberof IconButtonProps
9
+ */
10
+ icon: React.ReactNode;
11
+ /**
12
+ * Whether the button is circular or not.
13
+ *
14
+ * @type {boolean}
15
+ * @memberof IconButtonProps
16
+ */
17
+ circular?: boolean;
18
+ /**
19
+ * The element type the button will be rendered as.
20
+ *
21
+ * @type {(keyof JSX.IntrinsicElements | React.ComponentType<any>)}
22
+ * @memberof IconButtonProps
23
+ */
24
+ renderAs?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
25
+ /**
26
+ * The size of the button. Defaults to "small".
27
+ *
28
+ * @type {("small" | "normal" | "large")}
29
+ * @memberof IconButtonProps
30
+ */
31
+ size?: ButtonSize;
32
+ }
33
+ export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,4 @@
1
+ export * from "./button/Button";
2
+ export * from "./icon-button/IconButton";
3
+ export * from "./shared/ButtonProps";
4
+ export * from "./star-button/StarButton";
@@ -0,0 +1,61 @@
1
+ /// <reference types="react" />
2
+ import { CommonProps } from "../../../common/CommonProps";
3
+ export declare type ButtonVariant = "filled" | "transparent";
4
+ export declare type ButtonIntent = "primary" | "secondary" | "danger" | "warning" | "tertiary";
5
+ export declare type ButtonType = "button" | "submit";
6
+ export declare type ButtonSize = "small" | "normal" | "large";
7
+ export interface ButtonCommonProps extends CommonProps {
8
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
9
+ /**
10
+ * Whether the button is loading.
11
+ *
12
+ * @type {boolean}
13
+ * @memberof ButtonCommonProps
14
+ */
15
+ loading?: boolean;
16
+ /**
17
+ * Whether the button is disabled.
18
+ *
19
+ * @type {boolean}
20
+ * @memberof ButtonCommonProps
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * Button with square aspect ratio.
25
+ *
26
+ * @type {boolean}
27
+ * @memberof ButtonCommonProps
28
+ */
29
+ square?: boolean;
30
+ /**
31
+ * The button's variant. Values are filled, transparent, plain.
32
+ *
33
+ * @type {"primary" | "secondary" | "danger" | "warning" | "tertiary"}
34
+ * @memberof ButtonCommonProps
35
+ */
36
+ intent?: ButtonIntent;
37
+ /**
38
+ * The variant of the button.
39
+ *
40
+ * @type {"filled" | "transparent"}
41
+ * @memberof ButtonCommonProps
42
+ */
43
+ variant?: ButtonVariant;
44
+ /**
45
+ * The size of the button.
46
+ *
47
+ * @type {"small" | "normal" | "large"}
48
+ * @memberof ButtonCommonProps
49
+ */
50
+ size?: ButtonSize;
51
+ /**
52
+ * The link to be used for the button.
53
+ *
54
+ * @type string
55
+ * @memberof ButtonCommonProps
56
+ */
57
+ to?: string;
58
+ title?: string;
59
+ tabIndex?: number;
60
+ role?: string;
61
+ }
@@ -0,0 +1,9 @@
1
+ import { ButtonIntent, ButtonSize, ButtonVariant } from "../shared/ButtonProps";
2
+ interface ButtonProps {
3
+ $intent: ButtonIntent;
4
+ $variant: ButtonVariant;
5
+ $size: ButtonSize;
6
+ }
7
+ export declare const getStyles: () => ({ $intent, $variant }: ButtonProps) => string;
8
+ export declare const getPadding: () => ({ $size }: ButtonProps) => string;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ interface StarButtonProps {
3
+ starred: boolean;
4
+ onClick: (e: React.MouseEvent) => void;
5
+ }
6
+ export declare const StarButton: ({ starred, onClick }: StarButtonProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ export declare const ROLE_CARD = "region";
4
+ declare type Overflow = "visible" | "hidden" | "scroll" | "auto";
5
+ export interface CardProps extends CommonProps {
6
+ children?: React.ReactNode;
7
+ onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
8
+ onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
9
+ onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
10
+ /**
11
+ * Whether the card should have full height or not.
12
+ *
13
+ * @type {boolean}
14
+ * @memberof CardProps
15
+ */
16
+ fullHeight?: boolean;
17
+ /**
18
+ * Whether the card should overflow contents.
19
+ *
20
+ * @type {Overflow}
21
+ * @memberof CardProps
22
+ */
23
+ overflow?: Overflow;
24
+ /**
25
+ *
26
+ * @deprecated Use tailwind based grid layouts instead.
27
+ * @type {string}
28
+ * @memberof CardProps
29
+ */
30
+ gridArea?: string;
31
+ }
32
+ export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, overflow, gridArea, }: CardProps) => JSX.Element;
33
+ export {};
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ import { CommonProps, Density } from "../../common/CommonProps";
3
+ declare type Overflow = "visible" | "hidden" | "scroll" | "auto" | "inherit";
4
+ interface CardContentProps extends CommonProps {
5
+ overflow?: Overflow;
6
+ density?: Density;
7
+ /**
8
+ * Set gap to be 0px (not preferable)
9
+ */
10
+ disableGap?: boolean;
11
+ children: React.ReactNode | null;
12
+ }
13
+ /**
14
+ * @summary
15
+ * For applying padding and gap to a Card.
16
+ *
17
+ * @description
18
+ * The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
19
+ */
20
+ export declare const CardBody: ({ density, overflow, children, dataTestId, className, disableGap, }: CardContentProps) => JSX.Element;
21
+ export {};
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { CommonProps, Density } from "../../common/CommonProps";
3
+ interface CardFooterProps extends CommonProps {
4
+ children?: React.ReactNode | null;
5
+ density?: Density;
6
+ }
7
+ /**
8
+ * A simple footer intended to use with Cards and Modals.
9
+ * Currently only intended to contain Buttons.
10
+ * The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
11
+ *
12
+ * @param {CardFooterProps} { dataTestId, className, children, density }
13
+ * @return {*}
14
+ */
15
+ export declare const CardFooter: ({ dataTestId, className, children, density }: CardFooterProps) => JSX.Element;
16
+ export {};
@@ -0,0 +1,39 @@
1
+ import * as React from "react";
2
+ import { CommonProps, Density } from "../../common/CommonProps";
3
+ import { HeadingVariant } from "../heading/Heading";
4
+ interface CardHeaderProps extends CommonProps {
5
+ /** The text to show in the modal main heading */
6
+ heading: string;
7
+ /**
8
+ * The variant/size of the heading.
9
+ * Same as the `Heading` component.
10
+ * @default "primary"
11
+ */
12
+ headingVariant?: HeadingVariant;
13
+ /** Adds an extra heading below the main heading. */
14
+ subHeading?: string;
15
+ /** Function to call when the close button is clicked */
16
+ onClose?: () => void;
17
+ children?: React.ReactNode | null;
18
+ accessories?: React.ReactNode;
19
+ density?: Density;
20
+ showSeparator?: boolean;
21
+ }
22
+ /**
23
+ * Header for Cards and Models.
24
+ *
25
+ *
26
+ * @param {CardHeaderProps} {
27
+ * heading,
28
+ * headingVariant = "primary",
29
+ * subHeading,
30
+ * onClose,
31
+ * dataTestId,
32
+ * className,
33
+ * children,
34
+ * density,
35
+ * }
36
+ * @return {*}
37
+ */
38
+ export declare const CardHeader: ({ heading, headingVariant, subHeading, onClose, dataTestId, className, children, accessories, density, }: CardHeaderProps) => JSX.Element;
39
+ export {};