@hyphen/hyphen-components 2.9.0 → 2.9.2

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 (153) hide show
  1. package/dist/components/Alert/Alert.constants.d.ts +8 -0
  2. package/dist/components/Alert/Alert.d.ts +51 -0
  3. package/dist/components/Alert/Alert.stories.d.ts +8 -0
  4. package/dist/components/Alert/Alert.types.d.ts +7 -0
  5. package/dist/components/Badge/Badge.d.ts +31 -0
  6. package/dist/components/Badge/Badge.stories.d.ts +8 -0
  7. package/dist/components/Box/Box.d.ts +228 -0
  8. package/dist/components/Box/Box.stories.d.ts +42 -0
  9. package/dist/components/Button/Button.constants.d.ts +3 -0
  10. package/dist/components/Button/Button.d.ts +83 -0
  11. package/dist/components/Button/Button.stories.d.ts +14 -0
  12. package/dist/components/Card/Card.d.ts +17 -0
  13. package/dist/components/Card/Card.stories.d.ts +8 -0
  14. package/dist/components/Card/components/CardFooter/CardFooter.d.ts +13 -0
  15. package/dist/components/Card/components/CardHeader/CardHeader.d.ts +21 -0
  16. package/dist/components/Card/components/CardSection/CardSection.d.ts +46 -0
  17. package/dist/components/Card/components/index.d.ts +3 -0
  18. package/dist/components/CheckboxInput/CheckboxInput.d.ts +72 -0
  19. package/dist/components/CheckboxInput/CheckboxInput.stories.d.ts +18 -0
  20. package/dist/components/CheckboxInput/components/Checkbox.d.ts +71 -0
  21. package/dist/components/CheckboxInput/components/CheckboxIcon.d.ts +27 -0
  22. package/dist/components/DateInput/DateInput.d.ts +55 -0
  23. package/dist/components/DateInput/DateInput.stories.d.ts +11 -0
  24. package/dist/components/DatePicker/DatePicker.d.ts +86 -0
  25. package/dist/components/DatePicker/DatePicker.stories.d.ts +13 -0
  26. package/dist/components/Details/Details.d.ts +15 -0
  27. package/dist/components/Details/Details.stories.d.ts +6 -0
  28. package/dist/components/Details/DetailsSummary.d.ts +7 -0
  29. package/dist/components/Drawer/Drawer.d.ts +88 -0
  30. package/dist/components/Drawer/Drawer.stories.d.ts +15 -0
  31. package/dist/components/FormControl/FormControl.d.ts +38 -0
  32. package/dist/components/FormLabel/FormLabel.d.ts +41 -0
  33. package/dist/components/FormLabel/FormLabel.stories.d.ts +6 -0
  34. package/dist/components/Formik/Formik.stories.d.ts +18 -0
  35. package/dist/components/Formik/FormikCheckboxInput/FormikCheckboxInput.d.ts +12 -0
  36. package/dist/components/Formik/FormikRadioGroup/FormikRadioGroup.d.ts +12 -0
  37. package/dist/components/Formik/FormikSelectInput/FormikSelectInput.d.ts +12 -0
  38. package/dist/components/Formik/FormikSelectInputInset/FormikSelectInputInset.d.ts +12 -0
  39. package/dist/components/Formik/FormikSelectInputNative/FormikSelectInputNative.d.ts +12 -0
  40. package/dist/components/Formik/FormikTextInput/FormikTextInput.d.ts +12 -0
  41. package/dist/components/Formik/FormikTextInputInset/FormikTextInputInset.d.ts +12 -0
  42. package/dist/components/Formik/FormikTextareaInput/FormikTextareaInput.d.ts +12 -0
  43. package/dist/components/Formik/FormikTextareaInputInset/FormikTextareaInputInset.d.ts +12 -0
  44. package/dist/components/Formik/FormikTimePicker/FormikTimePicker.d.ts +12 -0
  45. package/dist/components/Formik/FormikTimePickerNative/FormikTimePickerNative.d.ts +12 -0
  46. package/dist/components/Formik/FormikToggle/FormikToggle.d.ts +12 -0
  47. package/dist/components/Heading/Heading.constants.d.ts +10 -0
  48. package/dist/components/Heading/Heading.d.ts +35 -0
  49. package/dist/components/Heading/Heading.stories.d.ts +9 -0
  50. package/dist/components/HelpText/HelpText.d.ts +12 -0
  51. package/dist/components/Icon/Icon.d.ts +22 -0
  52. package/dist/components/Icon/Icon.stories.d.ts +10 -0
  53. package/dist/components/InputValidationMessage/InputValidationMessage.d.ts +9 -0
  54. package/dist/components/Modal/Modal.d.ts +75 -0
  55. package/dist/components/Modal/Modal.stories.d.ts +11 -0
  56. package/dist/components/Modal/components/ModalBody/ModalBody.d.ts +4 -0
  57. package/dist/components/Modal/components/ModalFooter/ModalFooter.d.ts +4 -0
  58. package/dist/components/Modal/components/ModalHeader/ModalHeader.d.ts +16 -0
  59. package/dist/components/Modal/components/index.d.ts +4 -0
  60. package/dist/components/Pagination/Pagination.d.ts +51 -0
  61. package/dist/components/Pagination/Pagination.stories.d.ts +8 -0
  62. package/dist/components/Pagination/Pagination.utilities.d.ts +11 -0
  63. package/dist/components/Popover/Popover.d.ts +80 -0
  64. package/dist/components/Popover/Popover.stories.d.ts +14 -0
  65. package/dist/components/RadioGroup/RadioGroup.d.ts +75 -0
  66. package/dist/components/RadioGroup/RadioGroup.stories.d.ts +16 -0
  67. package/dist/components/RadioGroup/RadioInput/RadioInput.d.ts +57 -0
  68. package/dist/components/RadioGroup/RadioInput/RadioInputIcon.d.ts +27 -0
  69. package/dist/components/ResponsiveProvider/ResponsiveProvider.d.ts +17 -0
  70. package/dist/components/ResponsiveProvider/ResponsiveProvider.stories.d.ts +7 -0
  71. package/dist/components/SelectInput/SelectInput.d.ts +110 -0
  72. package/dist/components/SelectInput/SelectInput.stories.d.ts +20 -0
  73. package/dist/components/SelectInputInset/SelectInputInset.d.ts +92 -0
  74. package/dist/components/SelectInputInset/SelectInputInset.stories.d.ts +12 -0
  75. package/dist/components/SelectInputNative/SelectInputNative.d.ts +43 -0
  76. package/dist/components/SelectInputNative/SelectInputNative.stories.d.ts +16 -0
  77. package/dist/components/Spinner/Spinner.d.ts +12 -0
  78. package/dist/components/Spinner/Spinner.stories.d.ts +8 -0
  79. package/dist/components/Table/Table.d.ts +86 -0
  80. package/dist/components/Table/Table.stories.d.ts +31 -0
  81. package/dist/components/Table/TableBody/TableBody.d.ts +52 -0
  82. package/dist/components/Table/TableBody/TableBodyCell/TableBodyCell.d.ts +45 -0
  83. package/dist/components/Table/TableHead/TableHead.d.ts +46 -0
  84. package/dist/components/Table/TableHead/TableHeaderCell/TableHeaderCell.d.ts +65 -0
  85. package/dist/components/Table/common/TableRow/TableRow.d.ts +67 -0
  86. package/dist/components/TextInput/TextInput.d.ts +106 -0
  87. package/dist/components/TextInput/TextInput.stories.d.ts +19 -0
  88. package/dist/components/TextInputInset/TextInputInset.d.ts +102 -0
  89. package/dist/components/TextInputInset/TextInputInset.stories.d.ts +13 -0
  90. package/dist/components/TextareaInput/TextareaInput.d.ts +97 -0
  91. package/dist/components/TextareaInput/TextareaInput.stories.d.ts +23 -0
  92. package/dist/components/TextareaInputInset/TextareaInputInset.d.ts +105 -0
  93. package/dist/components/TextareaInputInset/TextareaInputInset.stories.d.ts +12 -0
  94. package/dist/components/ThemeProvider/ThemeProvider.d.ts +14 -0
  95. package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +6 -0
  96. package/dist/components/TimePicker/TimePicker.d.ts +35 -0
  97. package/dist/components/TimePicker/TimePicker.stories.d.ts +12 -0
  98. package/dist/components/TimePickerNative/TimePickerNative.d.ts +39 -0
  99. package/dist/components/TimePickerNative/TimePickerNative.stories.d.ts +11 -0
  100. package/dist/components/Toast/Toast.store.d.ts +36 -0
  101. package/dist/components/Toast/Toast.stories.d.ts +14 -0
  102. package/dist/components/Toast/Toast.types.d.ts +75 -0
  103. package/dist/components/Toast/ToastContainer.d.ts +43 -0
  104. package/dist/components/Toast/ToastNotification.d.ts +28 -0
  105. package/dist/components/Toast/index.d.ts +4 -0
  106. package/dist/components/Toast/toast.d.ts +20 -0
  107. package/dist/components/Toast/useToasts.d.ts +14 -0
  108. package/dist/components/Toggle/Toggle.d.ts +64 -0
  109. package/dist/components/Toggle/Toggle.stories.d.ts +12 -0
  110. package/dist/constants/keyCodes.d.ts +2 -0
  111. package/dist/css/fonts.css +33 -0
  112. package/dist/css/index.css +32 -0
  113. package/dist/css/reset.css +98 -0
  114. package/dist/css/utilities.css +6049 -0
  115. package/dist/css/variables.css +418 -0
  116. package/dist/hooks/index.d.ts +4 -0
  117. package/dist/hooks/useBreakpoint/useBreakpoint.d.ts +9 -0
  118. package/dist/hooks/useBreakpoint/useBreakpoint.stories.d.ts +6 -0
  119. package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayouEffect.d.ts +2 -0
  120. package/dist/hooks/useOpenClose/useOpenClose.d.ts +39 -0
  121. package/dist/hooks/useOpenClose/useOpenClose.stories.d.ts +6 -0
  122. package/dist/hooks/useWindowSize/useWindowSize.d.ts +7 -0
  123. package/dist/hooks/useWindowSize/useWindowSize.stories.d.ts +6 -0
  124. package/dist/hyphen-components.cjs.development.js +4724 -0
  125. package/dist/hyphen-components.cjs.development.js.map +1 -0
  126. package/dist/hyphen-components.cjs.production.min.js +2 -0
  127. package/dist/hyphen-components.cjs.production.min.js.map +1 -0
  128. package/dist/hyphen-components.esm.js +4661 -0
  129. package/dist/hyphen-components.esm.js.map +1 -0
  130. package/dist/index.d.ts +48 -0
  131. package/dist/index.js +8 -0
  132. package/dist/lib/cssShorthandToClasses.d.ts +4 -0
  133. package/dist/lib/doesStringIncludeCssUnit.d.ts +1 -0
  134. package/dist/lib/generateResponsiveClasses.d.ts +2 -0
  135. package/dist/lib/getAutoCompleteValue.d.ts +1 -0
  136. package/dist/lib/getColumnKeys.d.ts +3 -0
  137. package/dist/lib/getDimensionCss.d.ts +12 -0
  138. package/dist/lib/getElementType.d.ts +14 -0
  139. package/dist/lib/getFlexCss.d.ts +9 -0
  140. package/dist/lib/index.d.ts +15 -0
  141. package/dist/lib/isFunction.d.ts +2 -0
  142. package/dist/lib/mergeRefs.d.ts +2 -0
  143. package/dist/lib/prefersReducedMotion.d.ts +1 -0
  144. package/dist/lib/react-children-utilities/filter.d.ts +3 -0
  145. package/dist/lib/react-children-utilities/index.d.ts +1 -0
  146. package/dist/lib/reactRouterClickHandler.d.ts +12 -0
  147. package/dist/lib/resolveValue.d.ts +2 -0
  148. package/dist/lib/tokens.d.ts +22 -0
  149. package/dist/modes.d.ts +8 -0
  150. package/dist/types/index.d.ts +101 -0
  151. package/dist/types/lib.types.d.ts +3 -0
  152. package/package.json +2 -1
  153. package/src/components/Box/Box.tsx +1 -3
@@ -0,0 +1,57 @@
1
+ import React, { ChangeEvent, FocusEvent, ReactNode } from 'react';
2
+ import { ResponsiveProp } from '../../../types';
3
+ type BaseSize = 'sm' | 'md' | 'lg';
4
+ export type RadioSize = BaseSize | ResponsiveProp<BaseSize>;
5
+ export interface RadioInputProps {
6
+ /**
7
+ * Radio input name.
8
+ */
9
+ name: string;
10
+ /**
11
+ * Callback function to call on change event.
12
+ */
13
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
14
+ /**
15
+ * Options for radio group.
16
+ */
17
+ option: {
18
+ id: string;
19
+ value: string;
20
+ label: ReactNode;
21
+ disabled?: boolean | null;
22
+ };
23
+ /**
24
+ * Additional classes to add.
25
+ */
26
+ className?: string;
27
+ /**
28
+ * If the radio group should be disabled and not focusable.
29
+ */
30
+ isDisabled?: boolean;
31
+ /**
32
+ * If the radio input should be hidden to make way for a custom radio.
33
+ */
34
+ isHidden?: boolean;
35
+ /**
36
+ * The required and aria-required attributes
37
+ */
38
+ isRequired?: boolean;
39
+ /**
40
+ * If the radio group should be disabled and not focusable.
41
+ */
42
+ isSelected?: boolean;
43
+ /**
44
+ * Callback function to call on blur event.
45
+ */
46
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
47
+ /**
48
+ * Callback function to call on focus event.
49
+ */
50
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
51
+ /**
52
+ * The size of the radio icon.
53
+ */
54
+ size: RadioSize;
55
+ }
56
+ export declare const RadioInput: React.ForwardRefExoticComponent<RadioInputProps & React.RefAttributes<HTMLDivElement>>;
57
+ export {};
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { BoxProps } from '../../Box/Box';
3
+ import { RadioInputProps } from './RadioInput';
4
+ import { RadioGroupProps } from '../RadioGroup';
5
+ export interface RadioIconProps extends BoxProps {
6
+ /**
7
+ * Custom className to be applied to root node of component.
8
+ */
9
+ className?: string;
10
+ /**
11
+ * Whether the input is in an error state. The icon will visually change accordingly.
12
+ */
13
+ error?: RadioGroupProps['error'];
14
+ /**
15
+ * Whether the radio is selected.
16
+ */
17
+ isSelected?: RadioInputProps['isSelected'];
18
+ /**
19
+ * If the input should be disabled and not focusable.
20
+ */
21
+ isDisabled?: RadioInputProps['isDisabled'];
22
+ /**
23
+ * Additional props to be spread to rendered element
24
+ */
25
+ [x: string]: any;
26
+ }
27
+ export declare const RadioInputIcon: React.FC<RadioIconProps>;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export interface ResponsiveContextShape {
3
+ isCreated: boolean;
4
+ innerWidth?: number;
5
+ innerHeight?: number;
6
+ outerWidth?: number;
7
+ outerHeight?: number;
8
+ }
9
+ export declare const ResponsiveContext: React.Context<ResponsiveContextShape>;
10
+ export interface ResponsiveProviderProps {
11
+ children?: React.ReactNode;
12
+ /**
13
+ * Time (in milliseconds) to delay execution of resize handler. Default is 50.
14
+ */
15
+ throttle?: number;
16
+ }
17
+ export declare const ResponsiveProvider: React.FC<ResponsiveProviderProps>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ResponsiveProvider } from './ResponsiveProvider';
3
+ import type { Meta } from '@storybook/react';
4
+ declare const meta: Meta<typeof ResponsiveProvider>;
5
+ export default meta;
6
+ export declare const BasicUsage: () => React.JSX.Element;
7
+ export declare const Breakpoints: () => React.JSX.Element;
@@ -0,0 +1,110 @@
1
+ import { FC, FocusEvent, ReactNode } from 'react';
2
+ import { OptionsOrGroups, OnChangeValue } from 'react-select';
3
+ import { ResponsiveProp } from '../../types';
4
+ import { GroupBase } from 'react-select/dist/declarations/src/types';
5
+ type SelectOptions = any;
6
+ type SelectGroupOptions = GroupBase<SelectOptions>;
7
+ export type SelectInputOptions = OptionsOrGroups<SelectOptions, SelectGroupOptions>;
8
+ export type SimulatedEventPayloadType = {
9
+ target: {
10
+ name: string;
11
+ value: OnChangeValue<SelectInputOptions, boolean>;
12
+ };
13
+ };
14
+ export type TextInputSize = 'sm' | 'md' | 'lg' | ResponsiveProp<'sm' | 'md' | 'lg'>;
15
+ export interface SelectInputProps {
16
+ /**
17
+ * The id attribute of the input.
18
+ */
19
+ id: string;
20
+ /**
21
+ * Custom content to be displayed above the input. If the label is hidden, will be used to set aria-label attribute.
22
+ */
23
+ label: string;
24
+ /**
25
+ * Callback function to call on change event.
26
+ */
27
+ onChange: (event: SimulatedEventPayloadType) => void;
28
+ /**
29
+ * Options for dropdown list.
30
+ */
31
+ options: SelectInputOptions;
32
+ /**
33
+ * The value(s) of select.
34
+ */
35
+ value: any | any[];
36
+ /**
37
+ * Autofocus select input on render.
38
+ */
39
+ autoFocus?: boolean;
40
+ /**
41
+ * Additional classes to add.
42
+ */
43
+ className?: string;
44
+ /**
45
+ * Mark the input field as invalid and display a validation message.
46
+ * Pass a string or node to render a validation message below the input.
47
+ */
48
+ error?: ReactNode;
49
+ /**
50
+ * Additional clarifying text to help describe the input
51
+ */
52
+ helpText?: ReactNode;
53
+ /**
54
+ * Visually hide the label.
55
+ */
56
+ hideLabel?: boolean;
57
+ /**
58
+ * If the input value is clearable programmatically.
59
+ */
60
+ isClearable?: boolean;
61
+ /**
62
+ * If the input should be disabled and not focusable.
63
+ */
64
+ isDisabled?: boolean;
65
+ /**
66
+ * Is multi select enabled.
67
+ */
68
+ isMulti?: boolean;
69
+ /**
70
+ * The required and aria-required attributes on the input
71
+ */
72
+ isRequired?: boolean;
73
+ /**
74
+ * Select 'name' attribute.
75
+ */
76
+ name?: string;
77
+ /**
78
+ * A ref to portal the dropdown menu to. This is useful when the dropdown is located in a smaller container
79
+ * and we want to avoid cutting off the menu.
80
+ */
81
+ menuPortalTarget?: HTMLElement;
82
+ /**
83
+ * Callback function to call on blur event.
84
+ */
85
+ onBlur?: (event: FocusEvent<HTMLElement>) => void;
86
+ /**
87
+ * Callback function to call on focus event.
88
+ */
89
+ onFocus?: (event: FocusEvent<HTMLElement>) => void;
90
+ /**
91
+ * Placeholder for input.
92
+ */
93
+ placeholder?: string;
94
+ /**
95
+ * Visual indicator that the field is required, that gets appended to the label
96
+ */
97
+ requiredIndicator?: ReactNode;
98
+ /**
99
+ * The size of the text input.
100
+ */
101
+ size?: TextInputSize;
102
+ /**
103
+ * Additional props to be spread. These will be applied specifically to
104
+ * the `react-select` component that powers the select. For full docs on
105
+ * react-select props, [Click Here](https://react-select.com/props)
106
+ */
107
+ [x: string]: any;
108
+ }
109
+ export declare const SelectInput: FC<SelectInputProps>;
110
+ export {};
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { SelectInput } from './SelectInput';
3
+ import type { Meta } from '@storybook/react';
4
+ declare const meta: Meta<typeof SelectInput>;
5
+ export default meta;
6
+ export declare const Default: () => React.JSX.Element;
7
+ export declare const PreSelected: () => React.JSX.Element;
8
+ export declare const HelpText: () => React.JSX.Element;
9
+ export declare const Placeholder: () => React.JSX.Element;
10
+ export declare const HiddenLabel: () => React.JSX.Element;
11
+ export declare const MultiSelect: () => React.JSX.Element;
12
+ export declare const MultiSelectAndPreSelected: () => React.JSX.Element;
13
+ export declare const Autofocus: () => React.JSX.Element;
14
+ export declare const Required: () => React.JSX.Element;
15
+ export declare const Disabled: () => React.JSX.Element;
16
+ export declare const Clearable: () => React.JSX.Element;
17
+ export declare const Error: () => React.JSX.Element;
18
+ export declare const Sizes: () => React.JSX.Element;
19
+ export declare const WithPortal: () => React.JSX.Element;
20
+ export declare const CustomClasses: () => React.JSX.Element;
@@ -0,0 +1,92 @@
1
+ import { ChangeEvent, MouseEvent, KeyboardEvent, FocusEvent, ForwardRefExoticComponent, ReactNode, HTMLProps } from 'react';
2
+ import { ResponsiveProp } from '../../types';
3
+ import { BoxProps } from '../Box/Box';
4
+ export type SelectInputInsetSize = 'md' | 'lg';
5
+ export interface SelectInputInsetProps {
6
+ /**
7
+ * The input's id attribute. Used to programmatically tie the input with its label.
8
+ */
9
+ id: string;
10
+ /**
11
+ * Custom content to be displayed above the input. If the label is hidden, will be used to set aria-label attribute.
12
+ */
13
+ label: string;
14
+ /**
15
+ * List of options for the select input.
16
+ */
17
+ options: {
18
+ value: string | number;
19
+ label: string | number;
20
+ }[];
21
+ /**
22
+ * Callback function to call on change event.
23
+ */
24
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
25
+ /**
26
+ * Value of selected option. Should match the value key in the option object.
27
+ */
28
+ value: string | number | null;
29
+ /**
30
+ * Automatically focus the input when the page is loaded.
31
+ */
32
+ autoFocus?: boolean;
33
+ /**
34
+ * Custom class to be added to standard input classes.
35
+ */
36
+ className?: string;
37
+ /**
38
+ * Mark the input field as invalid and display a validation message.
39
+ * Pass a string or node to render a validation message below the input.
40
+ */
41
+ error?: ReactNode;
42
+ /**
43
+ * Additional clarifying text to help describe the input
44
+ */
45
+ helpText?: ReactNode;
46
+ /**
47
+ * Props passed directly to the input element of the component
48
+ */
49
+ inputProps?: BoxProps & HTMLProps<HTMLInputElement>;
50
+ /**
51
+ * The input's disabled attribute
52
+ */
53
+ isDisabled?: boolean;
54
+ /**
55
+ * The required and aria-required attributes on the input
56
+ */
57
+ isRequired?: boolean;
58
+ /**
59
+ * The input's 'name' attribute.
60
+ */
61
+ name?: string;
62
+ /**
63
+ * Callback function to call on blur event.
64
+ */
65
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
66
+ /**
67
+ * Callback function to call when input us cleared. When this is passed,
68
+ * the input will display an icon on the right side, for triggering this callback.
69
+ */
70
+ onClear?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
71
+ /**
72
+ * Callback function to call on focus event.
73
+ */
74
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
75
+ /**
76
+ * The input placeholder attribute.
77
+ */
78
+ placeholder?: string;
79
+ /**
80
+ * Visual indicator that the field is required, that gets appended to the label
81
+ */
82
+ requiredIndicator?: ReactNode;
83
+ /**
84
+ * The size of the text input.
85
+ */
86
+ size?: SelectInputInsetSize | ResponsiveProp<SelectInputInsetSize>;
87
+ /**
88
+ * Additional props to be spread to rendered element
89
+ */
90
+ [x: string]: any;
91
+ }
92
+ export declare const SelectInputInset: ForwardRefExoticComponent<SelectInputInsetProps>;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { SelectInputInset } from './SelectInputInset';
3
+ import type { Meta } from '@storybook/react';
4
+ declare const meta: Meta<typeof SelectInputInset>;
5
+ export default meta;
6
+ export declare const Default: () => React.JSX.Element;
7
+ export declare const Required: () => React.JSX.Element;
8
+ export declare const HelpText: () => React.JSX.Element;
9
+ export declare const ValidationError: () => React.JSX.Element;
10
+ export declare const Disabled: () => React.JSX.Element;
11
+ export declare const Clearable: () => React.JSX.Element;
12
+ export declare const Sizes: () => React.JSX.Element;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { ResponsiveProp } from '../../types';
3
+ import { BoxProps } from '../Box/Box';
4
+ import { FormControlProps } from '../FormControl/FormControl';
5
+ export type SelectInputNativeSize = 'sm' | 'md' | 'lg';
6
+ export interface SelectInputNativeProps extends BoxProps, FormControlProps {
7
+ /**
8
+ * List of options for the select input.
9
+ */
10
+ options: {
11
+ value: string | number;
12
+ label: string | number;
13
+ }[];
14
+ /**
15
+ * onChange callback from select element.
16
+ */
17
+ onChange: (event: React.ChangeEvent<HTMLSelectElement>) => void;
18
+ /**
19
+ * Value of selected option. Should match the value key in the option object.
20
+ */
21
+ value: string | number | null;
22
+ /**
23
+ * The input's 'name' attribute.
24
+ */
25
+ name?: string;
26
+ /**
27
+ * Visual indicator that the field is required, that gets appended to the label
28
+ */
29
+ requiredIndicator?: React.ReactNode;
30
+ /**
31
+ * Size of the input. ('sm' | 'md' | 'lg')
32
+ */
33
+ size?: SelectInputNativeSize | ResponsiveProp<SelectInputNativeSize>;
34
+ /**
35
+ * Whether the input is autofocused on initial render.
36
+ */
37
+ autoFocus?: HTMLSelectElement['autofocus'];
38
+ /**
39
+ * Additional props to be spread.
40
+ */
41
+ [x: string]: any;
42
+ }
43
+ export declare const SelectInputNative: React.FC<SelectInputNativeProps>;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { SelectInputNative } from './SelectInputNative';
3
+ import type { Meta } from '@storybook/react';
4
+ declare const meta: Meta<typeof SelectInputNative>;
5
+ export default meta;
6
+ export declare const Default: () => React.JSX.Element;
7
+ export declare const PreSelected: () => React.JSX.Element;
8
+ export declare const HelpText: () => React.JSX.Element;
9
+ export declare const Placeholder: () => React.JSX.Element;
10
+ export declare const HiddenLabel: () => React.JSX.Element;
11
+ export declare const Autofocus: () => React.JSX.Element;
12
+ export declare const Required: () => React.JSX.Element;
13
+ export declare const CustomRequiredIndicator: () => React.JSX.Element;
14
+ export declare const Disabled: () => React.JSX.Element;
15
+ export declare const Error: () => React.JSX.Element;
16
+ export declare const Sizes: () => React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ export interface SpinnerProps {
3
+ /**
4
+ * Custom className to be applied to spinner container div element.
5
+ */
6
+ className?: string;
7
+ /**
8
+ * Size of the spinner.
9
+ */
10
+ size?: 'sm' | 'md' | 'lg' | 'xl';
11
+ }
12
+ export declare const Spinner: FC<SpinnerProps>;
@@ -0,0 +1,8 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import React from 'react';
3
+ import { Spinner } from './Spinner';
4
+ declare const meta: Meta<typeof Spinner>;
5
+ export default meta;
6
+ export declare const Default: () => React.JSX.Element;
7
+ export declare const Color: () => React.JSX.Element;
8
+ export declare const Sizes: () => React.JSX.Element;
@@ -0,0 +1,86 @@
1
+ import { FC } from 'react';
2
+ import { Column, Row, EventWithColumnKey } from '../../types';
3
+ export interface TableProps {
4
+ /**
5
+ * Columns for the table. See Column definition below for details.
6
+ */
7
+ columns: Column[];
8
+ /**
9
+ * The data rows to be displayed
10
+ */
11
+ rows: Row[];
12
+ /**
13
+ * Key that represents a unique value for a row. This is necessary in
14
+ * order to supply React with a node key on each row.
15
+ */
16
+ rowKey: string;
17
+ /**
18
+ * Additional classes to add.
19
+ */
20
+ className?: string;
21
+ /**
22
+ * Text alignment for all table cells. Can be superseded by passing the same prop into the `Column` object
23
+ * for a specific column.
24
+ */
25
+ align?: 'left' | 'right' | 'center';
26
+ /**
27
+ * Global placeholder for empty cells. Can be overwritten by setting the same attribute
28
+ * in the `Column` config.
29
+ */
30
+ emptyCellPlaceholder?: string | number | undefined;
31
+ /**
32
+ * Enable a hover state on table rows.
33
+ */
34
+ hoverableRows?: boolean;
35
+ /**
36
+ * Remove borders around table, thead, tbody, td, etc.
37
+ */
38
+ isBorderless?: boolean;
39
+ /**
40
+ * Make Table more compact by cutting cell padding in half.
41
+ */
42
+ isCompact?: boolean;
43
+ /**
44
+ * If table scrolls vertically, header will remain stuck to the top of the table, and not scroll away.
45
+ */
46
+ hasStickyHeader?: boolean;
47
+ /**
48
+ * Set to true if data is loading.
49
+ */
50
+ isLoading?: boolean;
51
+ /**
52
+ * Set the maximum width and height and enable scrolling within the container when the table grows
53
+ * past those values. Useful for when we want to render a large table but not force the parent container
54
+ * to grow and instead make the user scroll. Set values to boolean `true` to enable `overflow: scroll` on the table
55
+ * without specifying a width/height
56
+ */
57
+ isScrollable?: {
58
+ x?: boolean;
59
+ y?: boolean;
60
+ };
61
+ /**
62
+ * Adds zebra-striping to any table row within the table body.
63
+ */
64
+ isStriped?: boolean;
65
+ /**
66
+ * Callback function to fire on sorting one of the table headers.
67
+ */
68
+ onSort?: (event: EventWithColumnKey) => void;
69
+ /**
70
+ * The key of the sorted column and its sort direction.
71
+ */
72
+ sortedColumn?: {
73
+ dataKey: string | undefined;
74
+ sortDirection: 'none' | 'ascending' | 'descending' | undefined;
75
+ };
76
+ /**
77
+ * Control the `table-layout` css property for the table.
78
+ */
79
+ useFixedTableLayout?: boolean;
80
+ /**
81
+ * Truncate overflow inside column based on column width. Can be overwritten on specific columns,
82
+ * by passing `truncateOverflow` value on a specific Column
83
+ */
84
+ truncateOverflow?: boolean;
85
+ }
86
+ export declare const Table: FC<TableProps>;
@@ -0,0 +1,31 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import React from 'react';
3
+ import { Table } from './Table';
4
+ declare const meta: Meta<typeof Table>;
5
+ export default meta;
6
+ export declare const Column: () => React.JSX.Element;
7
+ export declare const CommonExample: () => React.JSX.Element;
8
+ export declare const Loading: () => React.JSX.Element;
9
+ export declare const Sortable: () => React.JSX.Element;
10
+ export declare const SortablewithDefaultSortedColumn: () => React.JSX.Element;
11
+ export declare const SortableAndLoading: () => React.JSX.Element;
12
+ export declare const Scrollable: () => React.JSX.Element;
13
+ export declare const ScrollablewithStickyHeader: () => React.JSX.Element;
14
+ export declare const ScrollablewithFirstColumnStuckToLeft: () => React.JSX.Element;
15
+ export declare const ScrollablewithStickyHeaderAndNthColumnStuckToLeft: () => React.JSX.Element;
16
+ export declare const ScrollableWithLastColumnStuckToRight: () => React.JSX.Element;
17
+ export declare const ScrollableWithStickyHeaderAndFirstColumnStuckToLeft: () => React.JSX.Element;
18
+ export declare const ScrollableAndLoading: () => React.JSX.Element;
19
+ export declare const FixedWidthColumns: () => React.JSX.Element;
20
+ export declare const FixedTableLayout: () => React.JSX.Element;
21
+ export declare const TruncateOverflow: () => React.JSX.Element;
22
+ export declare const CustomActions: () => React.JSX.Element;
23
+ export declare const EmptyCellPlaceholder: () => React.JSX.Element;
24
+ export declare const Borderless: () => React.JSX.Element;
25
+ export declare const Compact: () => React.JSX.Element;
26
+ export declare const Striped: () => React.JSX.Element;
27
+ export declare const Hoverable: () => React.JSX.Element;
28
+ export declare const StripedAndHoverable: () => React.JSX.Element;
29
+ export declare const AligningCellText: () => React.JSX.Element;
30
+ export declare const GlobalAlign: () => React.JSX.Element;
31
+ export declare const ComponentAsColumnHeader: () => React.JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { FC, Key } from 'react';
2
+ import { Column, Row } from '../../../types';
3
+ export interface TableBodyProps {
4
+ /**
5
+ * The table columns to be rendered
6
+ */
7
+ columns: Column[];
8
+ /**
9
+ * The unique key to identify a React node for each row.
10
+ */
11
+ rowKey: Key;
12
+ /**
13
+ * The table rows to be rendered
14
+ */
15
+ rows: Row[];
16
+ /**
17
+ * Text alignment for all table cells. Can be superseded by passing the same prop into the `Column` object
18
+ * for a specific column.
19
+ */
20
+ align?: 'left' | 'right' | 'center';
21
+ /**
22
+ * A custom class to apply to the table body.
23
+ */
24
+ className?: string;
25
+ /**
26
+ * A global placeholder for empty cells. Note: can be overwriten by
27
+ * the same attribute passed for an individual column config object.
28
+ */
29
+ emptyCellPlaceholder?: string | number | undefined;
30
+ /**
31
+ * Enable a hover state on table rows.
32
+ */
33
+ hoverableRows?: boolean;
34
+ /**
35
+ * Whether the table has borders or not.
36
+ */
37
+ isBorderless?: boolean;
38
+ /**
39
+ * Whether the table rows have smaller padding
40
+ */
41
+ isCompact?: boolean;
42
+ /**
43
+ * Whether the table rows have a striped pattern
44
+ */
45
+ isStriped?: boolean;
46
+ /**
47
+ * Truncate overflow inside column based on column width. Can be overwritten on specific columns,
48
+ * by passing `truncateOverflow` value on a specific Column
49
+ */
50
+ truncateOverflow?: boolean;
51
+ }
52
+ export declare const TableBody: FC<TableBodyProps>;
@@ -0,0 +1,45 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export interface TableBodyCellProps {
3
+ /**
4
+ * Text alignment for all table cells. Can be superseded by passing the same prop into the `Column` object
5
+ * for a specific column.
6
+ */
7
+ align?: 'left' | 'right' | 'center';
8
+ /**
9
+ * Children node to be rendered.
10
+ */
11
+ children?: ReactNode;
12
+ /**
13
+ * Custom class to be applied to `<tr>` element.
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Remove borders around td elements.
18
+ */
19
+ isBorderless?: boolean;
20
+ /**
21
+ * Reduces padding inside table cells.
22
+ */
23
+ isCompact?: boolean;
24
+ /**
25
+ * Will stick to either the left or right side of a table during horizontal scroll.
26
+ */
27
+ sticky?: 'left' | 'right';
28
+ /**
29
+ * Truncates the cell contents based on width established by `Column`
30
+ * NOTE: Truncate only on cells with primitive data types.
31
+ */
32
+ truncateOverflow?: boolean;
33
+ /**
34
+ * Placeholder for an empty cell, will be rendered when content is `null` `undefined`
35
+ * or `''`. Placeholders will not be rendered on values of `0`.
36
+ */
37
+ emptyCellPlaceholder?: ReactNode;
38
+ /**
39
+ * Fixed width for a particular cell.
40
+ * Value should be taken from column config so it matches its parent.
41
+ */
42
+ width?: number;
43
+ }
44
+ declare const TableBodyCell: FC<TableBodyCellProps>;
45
+ export default TableBodyCell;