@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,46 @@
1
+ import { FC } from 'react';
2
+ import { Column, EventWithColumnKey } from '../../../types';
3
+ export interface TableHeadProps {
4
+ /**
5
+ * The table columns to be rendered
6
+ */
7
+ columns: Column[];
8
+ /**
9
+ * Text alignment for all table cells. Can be superseded by passing the same prop into the `Column` object
10
+ * for a specific column.
11
+ */
12
+ align?: 'left' | 'right' | 'center';
13
+ /**
14
+ * Custom class to be applied to the `<thead>` element.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Whether the table has borders or not.
19
+ */
20
+ isBorderless?: boolean;
21
+ /**
22
+ * Whether the table rows have smaller padding
23
+ */
24
+ isCompact?: boolean;
25
+ /**
26
+ * If table scrolls vertically, header will remain stuck to the top of the table, and not scroll away.
27
+ */
28
+ hasStickyHeader?: boolean;
29
+ /**
30
+ * Callback function to fire on sorting one of the table headers.
31
+ */
32
+ onSort?: (event: EventWithColumnKey) => void;
33
+ /**
34
+ * The key of the sorted column and its sort direction.
35
+ */
36
+ sortedColumn?: {
37
+ dataKey: string | undefined;
38
+ sortDirection: 'none' | 'ascending' | 'descending' | undefined;
39
+ };
40
+ /**
41
+ * Truncate overflow inside column based on column width. Can be overwritten on specific columns,
42
+ * by passing `truncateOverflow` value on a specific Column
43
+ */
44
+ truncateOverflow?: boolean;
45
+ }
46
+ export declare const TableHead: FC<TableHeadProps>;
@@ -0,0 +1,65 @@
1
+ import { FC, Key } from 'react';
2
+ import { Column, EventWithColumnKey } from '../../../../types';
3
+ export interface TableHeaderCellProps {
4
+ /**
5
+ * Title to display for the column.
6
+ */
7
+ column: Column;
8
+ /**
9
+ * Text alignment for all table cells. Can be superseded by passing the same prop into the `Column` object
10
+ * for a specific column.
11
+ */
12
+ align?: 'left' | 'right' | 'center';
13
+ /**
14
+ * Custom class to apply to the `<th>` element.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Key of corresponding data value in the table.
19
+ */
20
+ dataKey?: Key;
21
+ /**
22
+ * Remove borders around th elements.
23
+ */
24
+ isBorderless?: boolean;
25
+ /**
26
+ * Determines if table header cells should render as compact (less padding);
27
+ */
28
+ isCompact?: boolean;
29
+ /**
30
+ * If table scrolls vertically, header will remain stuck to the top of the table, and not scroll away.
31
+ */
32
+ hasStickyHeader?: boolean;
33
+ /**
34
+ * Boolean to mark if a column is sortable. This will show the sorting icons. Use
35
+ * in conjunction with the `sortDirection` prop to determine which icon is shown.
36
+ */
37
+ isSortable?: boolean;
38
+ /**
39
+ * Callback function to execute when a sortable column's header is clicked.
40
+ * Column can be sorted without providing an onSort method, it means that the arrows
41
+ * will not be clickable, but they will still represent the sort state
42
+ * of a column as determined by the `sortDirection` prop.
43
+ */
44
+ onSort?: (event: EventWithColumnKey) => void;
45
+ /**
46
+ * The key of the sorted column and its sort direction.
47
+ */
48
+ sortedColumn?: {
49
+ dataKey: string | undefined;
50
+ sortDirection: 'none' | 'ascending' | 'descending' | undefined;
51
+ };
52
+ /**
53
+ * Will stick to either the left or right side of a table during horizontal scroll.
54
+ */
55
+ sticky?: 'left' | 'right';
56
+ /**
57
+ * Whether the text should be cut off with ellipsis if it exceeds the width of the column.
58
+ */
59
+ truncateOverflow?: boolean;
60
+ /**
61
+ * Width of the column, if using the `useFixedWidthColumns` prop is set to true.
62
+ */
63
+ width?: number;
64
+ }
65
+ export declare const TableHeaderCell: FC<TableHeaderCellProps>;
@@ -0,0 +1,67 @@
1
+ import { FC } from 'react';
2
+ import { Column, EventWithColumnKey, Row } from '../../../../types';
3
+ export interface TableRowProps {
4
+ /**
5
+ * The table columns to be rendered
6
+ */
7
+ columns: Column[];
8
+ /**
9
+ * Text alignment for all table cells. Can be superseded by passing the same prop into the `Column` object
10
+ * for a specific column.
11
+ */
12
+ align?: 'left' | 'right' | 'center';
13
+ /**
14
+ * Custom class to be applied to `<tr>` element.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * A global placeholder for empty cells. Note: can be overwriten by
19
+ * the same attribute passed for an individual column config object.
20
+ */
21
+ emptyCellPlaceholder?: string | number | undefined;
22
+ /**
23
+ * Whether the table has borders or not.
24
+ */
25
+ isBorderless?: boolean;
26
+ /**
27
+ * Whether the table rows have smaller padding
28
+ */
29
+ isCompact?: boolean;
30
+ /**
31
+ * If table scrolls vertically, header will remain stuck to the top of the table, and not scroll away.
32
+ */
33
+ hasStickyHeader?: boolean;
34
+ /**
35
+ * Determine whether row is hoverable
36
+ */
37
+ isHoverable?: boolean;
38
+ /**
39
+ * Whether the row is inside the table head (thead).
40
+ */
41
+ isTableHead?: boolean;
42
+ /**
43
+ * Callback function to fire on sorting one of the table headers.
44
+ */
45
+ onSort?: (event: EventWithColumnKey) => void;
46
+ /**
47
+ * The specific row to be rendered.
48
+ */
49
+ row?: Row;
50
+ /**
51
+ * The unique key to identify a React node for each row.
52
+ */
53
+ rowIndex?: number;
54
+ /**
55
+ * The key of the sorted column and its sort direction.
56
+ */
57
+ sortedColumn?: {
58
+ dataKey: string | undefined;
59
+ sortDirection: 'none' | 'ascending' | 'descending' | undefined;
60
+ };
61
+ /**
62
+ * Truncate overflow inside column based on column width. Can be overwritten on specific columns,
63
+ * by passing `truncateOverflow` value on a specific Column
64
+ */
65
+ truncateOverflow?: boolean;
66
+ }
67
+ export declare const TableRow: FC<TableRowProps>;
@@ -0,0 +1,106 @@
1
+ import { BoxProps } from '../Box/Box';
2
+ import { ChangeEvent, FocusEvent, ForwardRefExoticComponent, HTMLProps, InputHTMLAttributes, KeyboardEvent, MouseEvent, ReactNode } from 'react';
3
+ import { ResponsiveProp } from '../../types';
4
+ export type TextInputSizeType = 'sm' | 'md' | 'lg';
5
+ export interface TextInputProps {
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
+ * Callback function to call on change event.
16
+ */
17
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
18
+ /**
19
+ * The text value of the input. Required since our Input is a controlled component.
20
+ */
21
+ value: InputHTMLAttributes<HTMLInputElement>['value'];
22
+ /**
23
+ * Automatically focus the input when the page is loaded.
24
+ */
25
+ autoFocus?: boolean;
26
+ /**
27
+ * Custom class to be added to standard input classes.
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Mark the input field as invalid and display a validation message.
32
+ * Pass a string or node to render a validation message below the input.
33
+ */
34
+ error?: ReactNode;
35
+ /**
36
+ * Visually hide the label.
37
+ */
38
+ hideLabel?: boolean;
39
+ /**
40
+ * Additional clarifying text to help describe the input
41
+ */
42
+ helpText?: ReactNode;
43
+ /**
44
+ * Props passed directly to the input element of the component
45
+ */
46
+ inputProps?: BoxProps & HTMLProps<HTMLInputElement>;
47
+ /**
48
+ * The input's disabled attribute
49
+ */
50
+ isDisabled?: boolean;
51
+ /**
52
+ * The required and aria-required attributes on the input
53
+ */
54
+ isRequired?: boolean;
55
+ /**
56
+ * The input's 'maxlength' attribute.
57
+ * NOTE: initializing the input with a value longer than the desired maxlength will not trim this value.
58
+ */
59
+ maxLength?: number;
60
+ /**
61
+ * The input's 'name' attribute.
62
+ */
63
+ name?: string;
64
+ /**
65
+ * Callback function to call on blur event.
66
+ */
67
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
68
+ /**
69
+ * Callback function to call when input us cleared. When this is passed,
70
+ * the input will display an icon on the right side, for triggering this callback.
71
+ */
72
+ onClear?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
73
+ /**
74
+ * Callback function to call on focus event.
75
+ */
76
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
77
+ /**
78
+ * The input placeholder attribute.
79
+ */
80
+ placeholder?: string;
81
+ /**
82
+ * An input helper rendered before the input field value
83
+ */
84
+ prefix?: ReactNode;
85
+ /**
86
+ * Visual indicator that the field is required, that gets appended to the label
87
+ */
88
+ requiredIndicator?: ReactNode;
89
+ /**
90
+ * The size of the text input.
91
+ */
92
+ size?: TextInputSizeType | ResponsiveProp<TextInputSizeType>;
93
+ /**
94
+ * An input helper rendered after the input field value
95
+ */
96
+ suffix?: ReactNode;
97
+ /**
98
+ * The input 'type' value. Defaults to type 'text'.
99
+ */
100
+ type?: InputHTMLAttributes<HTMLInputElement>['type'];
101
+ /**
102
+ * Additional props to be spread to rendered element
103
+ */
104
+ [x: string]: any;
105
+ }
106
+ export declare const TextInput: ForwardRefExoticComponent<TextInputProps>;
@@ -0,0 +1,19 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import React from 'react';
3
+ import { TextInput } from './TextInput';
4
+ declare const meta: Meta<typeof TextInput>;
5
+ export default meta;
6
+ export declare const Basic: () => React.JSX.Element;
7
+ export declare const Examples: () => React.JSX.Element;
8
+ export declare const Required: () => React.JSX.Element;
9
+ export declare const CustomRequiredIndicator: () => React.JSX.Element;
10
+ export declare const WithHelpText: () => React.JSX.Element;
11
+ export declare const Placeholder: () => React.JSX.Element;
12
+ export declare const Autofocus: () => React.JSX.Element;
13
+ export declare const HiddenLabel: () => React.JSX.Element;
14
+ export declare const Disabled: () => React.JSX.Element;
15
+ export declare const PrefixAndSuffix: () => React.JSX.Element;
16
+ export declare const Clearable: () => React.JSX.Element;
17
+ export declare const Sizes: () => React.JSX.Element;
18
+ export declare const MaxLength: () => React.JSX.Element;
19
+ export declare const ValidationError: () => React.JSX.Element;
@@ -0,0 +1,102 @@
1
+ import { ChangeEvent, MouseEvent, KeyboardEvent, FocusEvent, ForwardRefExoticComponent, ReactNode, HTMLProps, InputHTMLAttributes } from 'react';
2
+ import { ResponsiveProp } from '../../types';
3
+ import { BoxProps } from '../Box/Box';
4
+ export type TextInputInsetSize = 'md' | 'lg';
5
+ export interface TextInputInsetProps {
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
+ * Callback function to call on change event.
16
+ */
17
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
18
+ /**
19
+ * The text value of the input. Required since our Input is a controlled component.
20
+ */
21
+ value: InputHTMLAttributes<HTMLInputElement>['value'];
22
+ /**
23
+ * Automatically focus the input when the page is loaded.
24
+ */
25
+ autoFocus?: boolean;
26
+ /**
27
+ * Custom class to be added to standard input classes.
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Mark the input field as invalid and display a validation message.
32
+ * Pass a string or node to render a validation message below the input.
33
+ */
34
+ error?: ReactNode;
35
+ /**
36
+ * Additional clarifying text to help describe the input
37
+ */
38
+ helpText?: ReactNode;
39
+ /**
40
+ * Props passed directly to the input element of the component
41
+ */
42
+ inputProps?: BoxProps & HTMLProps<HTMLInputElement>;
43
+ /**
44
+ * The input's disabled attribute
45
+ */
46
+ isDisabled?: boolean;
47
+ /**
48
+ * The required and aria-required attributes on the input
49
+ */
50
+ isRequired?: boolean;
51
+ /**
52
+ * The input's 'maxlength' attribute.
53
+ * NOTE: initializing the input with a value longer than the desired maxlength will not trim this value.
54
+ */
55
+ maxLength?: number;
56
+ /**
57
+ * The input's 'name' attribute.
58
+ */
59
+ name?: string;
60
+ /**
61
+ * Callback function to call on blur event.
62
+ */
63
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
64
+ /**
65
+ * Callback function to call when input us cleared. When this is passed,
66
+ * the input will display an icon on the right side, for triggering this callback.
67
+ */
68
+ onClear?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
69
+ /**
70
+ * Callback function to call on focus event.
71
+ */
72
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
73
+ /**
74
+ * The input placeholder attribute.
75
+ */
76
+ placeholder?: string;
77
+ /**
78
+ * An input helper rendered before the input field value
79
+ */
80
+ prefix?: ReactNode;
81
+ /**
82
+ * Visual indicator that the field is required, that gets appended to the label
83
+ */
84
+ requiredIndicator?: ReactNode;
85
+ /**
86
+ * The size of the text input.
87
+ */
88
+ size?: TextInputInsetSize | ResponsiveProp<TextInputInsetSize>;
89
+ /**
90
+ * An input helper rendered after the input field value
91
+ */
92
+ suffix?: ReactNode;
93
+ /**
94
+ * The input 'type' value. Defaults to type 'text'.
95
+ */
96
+ type?: InputHTMLAttributes<HTMLInputElement>['type'];
97
+ /**
98
+ * Additional props to be spread to rendered element
99
+ */
100
+ [x: string]: any;
101
+ }
102
+ export declare const TextInputInset: ForwardRefExoticComponent<TextInputInsetProps>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { TextInputInset } from './TextInputInset';
3
+ import type { Meta } from '@storybook/react';
4
+ declare const meta: Meta<typeof TextInputInset>;
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 PrefixAndSuffix: () => React.JSX.Element;
13
+ export declare const Sizes: () => React.JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { FC, ChangeEvent, FocusEvent, ReactNode } from 'react';
2
+ import { ResponsiveProp } from '../../types';
3
+ import { BoxProps } from '../Box/Box';
4
+ export type TextareaInputSize = 'sm' | 'md' | 'lg';
5
+ export interface TextareaInputProps extends Omit<BoxProps, 'as' | 'width'> {
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
+ * Callback function to call on change event.
16
+ */
17
+ onChange: (event: ChangeEvent<HTMLTextAreaElement>) => void;
18
+ /**
19
+ * The text value of the input. Required since our Input is a controlled component.
20
+ */
21
+ value: string;
22
+ /**
23
+ * The input's 'autocomplete' attribute.
24
+ */
25
+ autoComplete?: boolean | string;
26
+ /**
27
+ * Automatically focus the input when the page is loaded.
28
+ */
29
+ autoFocus?: boolean;
30
+ /**
31
+ * Custom class to be added to standard input classes.
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Mark the input field as invalid and display a validation message.
36
+ * Pass a string or node to render a validation message below the input.
37
+ */
38
+ error?: ReactNode;
39
+ /**
40
+ * Additional clarifying text to help describe the input
41
+ */
42
+ helpText?: ReactNode;
43
+ /**
44
+ * Visually hide the label.
45
+ */
46
+ hideLabel?: boolean;
47
+ /**
48
+ * The input's disabled attribute
49
+ */
50
+ isDisabled?: boolean;
51
+ /**
52
+ * The required and aria-required attributes on the input
53
+ */
54
+ isRequired?: boolean;
55
+ /**
56
+ * The input's 'maxlength' attribute.
57
+ * NOTE: initializing the input with a value longer than the desired maxlength will not trim this value.
58
+ */
59
+ maxLength?: number;
60
+ /**
61
+ * The input's 'name' attribute.
62
+ */
63
+ name?: string;
64
+ /**
65
+ * Callback function to call on blur event.
66
+ */
67
+ onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
68
+ /**
69
+ * Callback function to call on focus event.
70
+ */
71
+ onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
72
+ /**
73
+ * The input placeholder attribute.
74
+ */
75
+ placeholder?: string;
76
+ /**
77
+ * Visual indicator that the field is required, that gets appended to the label
78
+ */
79
+ requiredIndicator?: ReactNode;
80
+ /**
81
+ * Textarea resize behavior
82
+ */
83
+ resize?: 'vertical' | 'horizontal' | 'none' | 'both';
84
+ /**
85
+ * number of visible text lines for the control.
86
+ */
87
+ rows?: number;
88
+ /**
89
+ * The size of the text input.
90
+ */
91
+ size?: TextareaInputSize | ResponsiveProp<TextareaInputSize>;
92
+ /**
93
+ * Additional props to be spread to rendered element
94
+ */
95
+ [x: string]: any;
96
+ }
97
+ export declare const TextareaInput: FC<TextareaInputProps>;
@@ -0,0 +1,23 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import React from 'react';
3
+ import { TextareaInput } from './TextareaInput';
4
+ declare const meta: Meta<typeof TextareaInput>;
5
+ export default meta;
6
+ export declare const Basic: () => React.JSX.Element;
7
+ export declare const Default: () => React.JSX.Element;
8
+ export declare const Required: () => React.JSX.Element;
9
+ export declare const CustomRequiredIndicator: () => React.JSX.Element;
10
+ export declare const HelpText: () => React.JSX.Element;
11
+ export declare const Resize: () => React.JSX.Element;
12
+ export declare const Sizes: () => React.JSX.Element;
13
+ export declare const Placeholder: () => React.JSX.Element;
14
+ export declare const Autofocus: () => React.JSX.Element;
15
+ export declare const HiddenLabel: () => React.JSX.Element;
16
+ export declare const Disabled: () => React.JSX.Element;
17
+ export declare const DisabledWithValue: () => React.JSX.Element;
18
+ export declare const DisabledWithPlaceholder: () => React.JSX.Element;
19
+ export declare const MaxLength: () => React.JSX.Element;
20
+ export declare const RequiredWithError: () => React.JSX.Element;
21
+ export declare const RequiredWithErrorAndValidationMessage: () => React.JSX.Element;
22
+ export declare const NotRequiredWithErrorAndValidationMessage: () => React.JSX.Element;
23
+ export declare const ErrorWithHiddenLabel: () => React.JSX.Element;
@@ -0,0 +1,105 @@
1
+ import { ChangeEvent, FocusEvent, ForwardRefExoticComponent, ReactNode, HTMLProps, InputHTMLAttributes } from 'react';
2
+ import { ResponsiveProp } from '../../types';
3
+ import { BoxProps } from '../Box/Box';
4
+ export type TextareaInputInsetSize = 'md' | 'lg';
5
+ export interface TextareaInputInsetProps {
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
+ * Callback function to call on change event.
16
+ */
17
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
18
+ /**
19
+ * The text value of the input. Required since our Input is a controlled component.
20
+ */
21
+ value: InputHTMLAttributes<HTMLInputElement>['value'];
22
+ /**
23
+ * Automatically focus the input when the page is loaded.
24
+ */
25
+ autoFocus?: boolean;
26
+ /**
27
+ * Custom class to be added to standard input classes.
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Mark the input field as invalid and display a validation message.
32
+ * Pass a string or node to render a validation message below the input.
33
+ */
34
+ error?: ReactNode;
35
+ /**
36
+ * Additional clarifying text to help describe the input
37
+ */
38
+ helpText?: ReactNode;
39
+ /**
40
+ * Props passed directly to the input element of the component
41
+ */
42
+ inputProps?: BoxProps & HTMLProps<HTMLInputElement>;
43
+ /**
44
+ * The input's disabled attribute
45
+ */
46
+ isDisabled?: boolean;
47
+ /**
48
+ * The required and aria-required attributes on the input
49
+ */
50
+ isRequired?: boolean;
51
+ /**
52
+ * The input's 'maxlength' attribute.
53
+ * NOTE: initializing the input with a value longer than the desired maxlength will not trim this value.
54
+ */
55
+ maxLength?: number;
56
+ /**
57
+ * The input's 'name' attribute.
58
+ */
59
+ name?: string;
60
+ /**
61
+ * Callback function to call on blur event.
62
+ */
63
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
64
+ /**
65
+ * Callback function to call on focus event.
66
+ */
67
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
68
+ /**
69
+ * The input placeholder attribute.
70
+ */
71
+ placeholder?: string;
72
+ /**
73
+ * An input helper rendered before the input field value
74
+ */
75
+ prefix?: ReactNode;
76
+ /**
77
+ * Visual indicator that the field is required, that gets appended to the label
78
+ */
79
+ requiredIndicator?: ReactNode;
80
+ /**
81
+ * Textarea resize behavior
82
+ */
83
+ resize?: 'vertical' | 'horizontal' | 'none' | 'both';
84
+ /**
85
+ * number of visible text lines for the control.
86
+ */
87
+ rows?: number;
88
+ /**
89
+ * The size of the text input.
90
+ */
91
+ size?: TextareaInputInsetSize | ResponsiveProp<TextareaInputInsetSize>;
92
+ /**
93
+ * An input helper rendered after the input field value
94
+ */
95
+ suffix?: ReactNode;
96
+ /**
97
+ * The input 'type' value. Defaults to type 'text'.
98
+ */
99
+ type?: InputHTMLAttributes<HTMLInputElement>['type'];
100
+ /**
101
+ * Additional props to be spread to rendered element
102
+ */
103
+ [x: string]: any;
104
+ }
105
+ export declare const TextareaInputInset: ForwardRefExoticComponent<TextareaInputInsetProps>;
@@ -0,0 +1,12 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import React from 'react';
3
+ import { TextareaInputInset } from './TextareaInputInset';
4
+ declare const meta: Meta<typeof TextareaInputInset>;
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 Sizes: () => React.JSX.Element;
12
+ export declare const Resize: () => React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export type Theme = 'dark' | 'light' | 'system';
3
+ type ThemeProviderProps = {
4
+ children: React.ReactNode;
5
+ defaultTheme?: Theme;
6
+ storageKey?: string;
7
+ };
8
+ type ThemeProviderState = {
9
+ theme: Theme;
10
+ setTheme: (theme: Theme) => void;
11
+ };
12
+ export declare function ThemeProvider({ children, defaultTheme, storageKey, ...props }: ThemeProviderProps): React.JSX.Element;
13
+ export declare const useTheme: () => ThemeProviderState;
14
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { ThemeProvider } from './ThemeProvider';
3
+ import type { Meta } from '@storybook/react';
4
+ declare const meta: Meta<typeof ThemeProvider>;
5
+ export default meta;
6
+ export declare const BasicUsage: () => React.JSX.Element;