@hyphen/hyphen-components 8.0.1 → 9.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/css/utilities.css +1 -1
  2. package/dist/css/utilities.css.map +1 -1
  3. package/dist/hyphen-components.cjs.development.js +342 -311
  4. package/dist/hyphen-components.cjs.development.js.map +1 -1
  5. package/dist/hyphen-components.cjs.production.min.js +2 -2
  6. package/dist/hyphen-components.cjs.production.min.js.map +1 -1
  7. package/dist/hyphen-components.esm.js +346 -312
  8. package/dist/hyphen-components.esm.js.map +1 -1
  9. package/dist/index.d.ts +212 -202
  10. package/package.json +6 -5
  11. package/src/components/Alert/Alert.tsx +5 -6
  12. package/src/components/Badge/Badge.test.tsx +12 -0
  13. package/src/components/Badge/Badge.tsx +52 -20
  14. package/src/components/Box/Box.mdx +1 -1
  15. package/src/components/Box/Box.stories.tsx +1 -1
  16. package/src/components/Box/Box.test.tsx +24 -1
  17. package/src/components/Box/Box.tsx +108 -82
  18. package/src/components/Card/Card.tsx +5 -1
  19. package/src/components/Card/components/CardFooter/CardFooter.tsx +0 -4
  20. package/src/components/Card/components/CardHeader/CardHeader.tsx +4 -1
  21. package/src/components/Card/components/CardSection/CardSection.tsx +4 -5
  22. package/src/components/CheckboxInput/CheckboxInput.test.tsx +17 -0
  23. package/src/components/CheckboxInput/CheckboxInput.tsx +15 -4
  24. package/src/components/CheckboxInput/components/Checkbox.test.tsx +36 -0
  25. package/src/components/CheckboxInput/components/Checkbox.tsx +8 -2
  26. package/src/components/Details/Details.test.tsx +8 -0
  27. package/src/components/Details/Details.tsx +5 -2
  28. package/src/components/Details/DetailsSummary.tsx +4 -1
  29. package/src/components/Drawer/Drawer.test.tsx +8 -0
  30. package/src/components/Drawer/Drawer.tsx +1 -1
  31. package/src/components/FormLabel/FormLabel.tsx +6 -3
  32. package/src/components/Formik/FormikCheckboxInput/FormikCheckboxInput.test.tsx +9 -0
  33. package/src/components/Formik/FormikCheckboxInput/FormikCheckboxInput.tsx +1 -0
  34. package/src/components/Formik/FormikSelectInput/FormikSelectInput.tsx +21 -11
  35. package/src/components/Formik/FormikSelectInputNative/FormikSelectInputNative.tsx +1 -1
  36. package/src/components/Formik/FormikTimePicker/FormikTimePicker.tsx +1 -1
  37. package/src/components/Heading/Heading.tsx +5 -6
  38. package/src/components/Icon/Icon.test.tsx +8 -0
  39. package/src/components/Icon/Icon.tsx +6 -7
  40. package/src/components/Modal/Modal.test.tsx +31 -1
  41. package/src/components/Modal/Modal.tsx +13 -7
  42. package/src/components/Popover/Popover.test.tsx +3 -4
  43. package/src/components/RadioGroup/RadioGroup.tsx +11 -6
  44. package/src/components/RadioGroup/RadioInput/RadioInputIcon.tsx +0 -4
  45. package/src/components/SelectInput/SelectInput.test.tsx +18 -0
  46. package/src/components/SelectInput/SelectInput.tsx +47 -27
  47. package/src/components/SelectInputInset/SelectInputInset.tsx +8 -9
  48. package/src/components/SelectInputNative/SelectInputNative.test.tsx +24 -0
  49. package/src/components/SelectInputNative/SelectInputNative.tsx +79 -14
  50. package/src/components/Switch/Switch.tsx +1 -1
  51. package/src/components/Table/Table.mdx +1 -1
  52. package/src/components/Table/Table.stories.tsx +5 -1
  53. package/src/components/Table/common/TableRow/TableRow.test.tsx +16 -0
  54. package/src/components/Table/common/TableRow/TableRow.tsx +19 -1
  55. package/src/components/TextInput/TextInput.tsx +10 -8
  56. package/src/components/TextInputInset/TextInputInset.tsx +5 -6
  57. package/src/components/TextareaInput/TextareaInput.tsx +4 -5
  58. package/src/components/TextareaInputInset/TextareaInputInset.tsx +10 -17
  59. package/src/components/Toast/Toast.stories.tsx +5 -1
  60. package/src/types/index.ts +2 -3
@@ -4,8 +4,7 @@ import React, {
4
4
  FocusEvent,
5
5
  ForwardRefExoticComponent,
6
6
  ReactNode,
7
- HTMLProps,
8
- InputHTMLAttributes,
7
+ TextareaHTMLAttributes,
9
8
  } from 'react';
10
9
  import classNames from 'classnames';
11
10
  import { ResponsiveProp } from '../../types';
@@ -30,11 +29,15 @@ export interface TextareaInputInsetProps {
30
29
  /**
31
30
  * Callback function to call on change event.
32
31
  */
33
- onChange: (event: ChangeEvent<HTMLInputElement>) => void;
32
+ onChange: (event: ChangeEvent<HTMLTextAreaElement>) => void;
34
33
  /**
35
34
  * The text value of the input. Required since our Input is a controlled component.
36
35
  */
37
- value: InputHTMLAttributes<HTMLInputElement>['value'];
36
+ value: TextareaHTMLAttributes<HTMLTextAreaElement>['value'];
37
+ /**
38
+ * The textarea's autocomplete behavior.
39
+ */
40
+ autoComplete?: boolean | string;
38
41
  /**
39
42
  * Automatically focus the input when the page is loaded.
40
43
  */
@@ -55,7 +58,7 @@ export interface TextareaInputInsetProps {
55
58
  /**
56
59
  * Props passed directly to the input element of the component
57
60
  */
58
- inputProps?: BoxProps & HTMLProps<HTMLInputElement>;
61
+ inputProps?: Omit<BoxProps<'textarea'>, 'as'>;
59
62
  /**
60
63
  * The input's disabled attribute
61
64
  */
@@ -76,11 +79,11 @@ export interface TextareaInputInsetProps {
76
79
  /**
77
80
  * Callback function to call on blur event.
78
81
  */
79
- onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
82
+ onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
80
83
  /**
81
84
  * Callback function to call on focus event.
82
85
  */
83
- onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
86
+ onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
84
87
  /**
85
88
  * The input placeholder attribute.
86
89
  */
@@ -109,14 +112,6 @@ export interface TextareaInputInsetProps {
109
112
  * An input helper rendered after the input field value
110
113
  */
111
114
  suffix?: ReactNode;
112
- /**
113
- * The input 'type' value. Defaults to type 'text'.
114
- */
115
- type?: InputHTMLAttributes<HTMLInputElement>['type'];
116
- /**
117
- * Additional props to be spread to rendered element
118
- */
119
- [x: string]: any; // eslint-disable-line
120
115
  }
121
116
 
122
117
  export const TextareaInputInset: ForwardRefExoticComponent<TextareaInputInsetProps> =
@@ -144,7 +139,6 @@ export const TextareaInputInset: ForwardRefExoticComponent<TextareaInputInsetPro
144
139
  resize = 'vertical',
145
140
  rows = 5,
146
141
  size = 'md',
147
- type = 'text',
148
142
  },
149
143
  ref
150
144
  ) => {
@@ -180,7 +174,6 @@ export const TextareaInputInset: ForwardRefExoticComponent<TextareaInputInsetPro
180
174
  placeholder,
181
175
  required: isRequired,
182
176
  rows,
183
- type,
184
177
  value,
185
178
  };
186
179
 
@@ -90,7 +90,11 @@ export const Column = () =>
90
90
  {
91
91
  heading: 'Type',
92
92
  dataKey: 'type',
93
- render: (cell?: Cell) => <code style={codePreviewStyle}>{cell}</code>,
93
+ render: (cell?: Cell) => (
94
+ <code style={codePreviewStyle}>
95
+ {typeof cell === 'string' || typeof cell === 'number' ? cell : null}
96
+ </code>
97
+ ),
94
98
  },
95
99
  { heading: 'Description', dataKey: 'description' },
96
100
  ];
@@ -44,8 +44,7 @@ export type Breakpoint = {
44
44
 
45
45
  export type DimensionSize = WidthSize | HeightSize;
46
46
 
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- export type UnknownPropertiesObjType = { [key: string]: any };
47
+ export type UnknownPropertiesObjType = Record<string, unknown>;
49
48
 
50
49
  export interface FlexProperty {
51
50
  flexGrow?: number | string;
@@ -148,7 +147,7 @@ export declare type ResponsiveProp<T> = {
148
147
 
149
148
  export type Row = UnknownPropertiesObjType;
150
149
 
151
- export type Cell = string | number | { [key: string]: unknown } | unknown[];
150
+ export type Cell = Row[string];
152
151
 
153
152
  export declare type Column = {
154
153
  /**