@hyphen/hyphen-components 8.0.0 → 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 (93) hide show
  1. package/dist/css/fonts.css +5 -3
  2. package/dist/css/fonts.css.map +1 -0
  3. package/dist/css/index.css +117 -111
  4. package/dist/css/index.css.map +1 -0
  5. package/dist/css/reset.css +5 -3
  6. package/dist/css/reset.css.map +1 -0
  7. package/dist/css/utilities.css +9 -7
  8. package/dist/css/utilities.css.map +1 -0
  9. package/dist/css/variables.css +11 -9
  10. package/dist/css/variables.css.map +1 -0
  11. package/dist/hyphen-components.cjs.development.js +348 -317
  12. package/dist/hyphen-components.cjs.development.js.map +1 -1
  13. package/dist/hyphen-components.cjs.production.min.js +2 -2
  14. package/dist/hyphen-components.cjs.production.min.js.map +1 -1
  15. package/dist/hyphen-components.esm.js +352 -318
  16. package/dist/hyphen-components.esm.js.map +1 -1
  17. package/dist/index.d.ts +212 -202
  18. package/package.json +8 -7
  19. package/src/components/Alert/Alert.tsx +5 -6
  20. package/src/components/Badge/Badge.module.scss +1 -1
  21. package/src/components/Badge/Badge.test.tsx +12 -0
  22. package/src/components/Badge/Badge.tsx +52 -20
  23. package/src/components/Box/Box.mdx +1 -1
  24. package/src/components/Box/Box.stories.tsx +1 -1
  25. package/src/components/Box/Box.test.tsx +24 -1
  26. package/src/components/Box/Box.tsx +108 -82
  27. package/src/components/Button/Button.module.scss +1 -1
  28. package/src/components/Card/Card.tsx +5 -1
  29. package/src/components/Card/components/CardFooter/CardFooter.tsx +0 -4
  30. package/src/components/Card/components/CardHeader/CardHeader.tsx +4 -1
  31. package/src/components/Card/components/CardSection/CardSection.tsx +4 -5
  32. package/src/components/CheckboxInput/CheckboxInput.test.tsx +17 -0
  33. package/src/components/CheckboxInput/CheckboxInput.tsx +15 -4
  34. package/src/components/CheckboxInput/components/Checkbox.module.scss +2 -2
  35. package/src/components/CheckboxInput/components/Checkbox.test.tsx +36 -0
  36. package/src/components/CheckboxInput/components/Checkbox.tsx +8 -2
  37. package/src/components/Details/Details.test.tsx +8 -0
  38. package/src/components/Details/Details.tsx +5 -2
  39. package/src/components/Details/DetailsSummary.tsx +4 -1
  40. package/src/components/Drawer/Drawer.module.scss +1 -1
  41. package/src/components/Drawer/Drawer.test.tsx +8 -0
  42. package/src/components/Drawer/Drawer.tsx +1 -1
  43. package/src/components/DropdownMenu/DropdownMenu.tsx +6 -8
  44. package/src/components/FormLabel/FormLabel.tsx +6 -3
  45. package/src/components/Formik/FormikCheckboxInput/FormikCheckboxInput.test.tsx +9 -0
  46. package/src/components/Formik/FormikCheckboxInput/FormikCheckboxInput.tsx +1 -0
  47. package/src/components/Formik/FormikSelectInput/FormikSelectInput.tsx +21 -11
  48. package/src/components/Formik/FormikSelectInputNative/FormikSelectInputNative.tsx +1 -1
  49. package/src/components/Formik/FormikTimePicker/FormikTimePicker.tsx +1 -1
  50. package/src/components/Heading/Heading.tsx +5 -6
  51. package/src/components/Icon/Icon.test.tsx +8 -0
  52. package/src/components/Icon/Icon.tsx +6 -7
  53. package/src/components/Modal/Modal.module.scss +1 -1
  54. package/src/components/Modal/Modal.test.tsx +31 -1
  55. package/src/components/Modal/Modal.tsx +13 -7
  56. package/src/components/Popover/Popover.test.tsx +3 -4
  57. package/src/components/RadioGroup/RadioGroup.tsx +11 -6
  58. package/src/components/RadioGroup/RadioInput/RadioInput.module.scss +2 -2
  59. package/src/components/RadioGroup/RadioInput/RadioInputIcon.tsx +0 -4
  60. package/src/components/SelectInput/SelectInput.module.scss +1 -1
  61. package/src/components/SelectInput/SelectInput.test.tsx +18 -0
  62. package/src/components/SelectInput/SelectInput.tsx +47 -27
  63. package/src/components/SelectInputInset/SelectInputInset.module.scss +1 -1
  64. package/src/components/SelectInputInset/SelectInputInset.tsx +8 -9
  65. package/src/components/SelectInputNative/SelectInputNative.module.scss +1 -1
  66. package/src/components/SelectInputNative/SelectInputNative.test.tsx +24 -0
  67. package/src/components/SelectInputNative/SelectInputNative.tsx +79 -14
  68. package/src/components/Switch/Switch.module.scss +1 -1
  69. package/src/components/Switch/Switch.tsx +1 -1
  70. package/src/components/Table/Table.mdx +1 -1
  71. package/src/components/Table/Table.stories.tsx +5 -1
  72. package/src/components/Table/common/TableRow/TableRow.test.tsx +16 -0
  73. package/src/components/Table/common/TableRow/TableRow.tsx +19 -1
  74. package/src/components/TextInput/TextInput.module.scss +1 -1
  75. package/src/components/TextInput/TextInput.tsx +10 -8
  76. package/src/components/TextInputInset/TextInputInset.module.scss +1 -1
  77. package/src/components/TextInputInset/TextInputInset.tsx +5 -6
  78. package/src/components/TextareaInput/TextareaInput.module.scss +1 -1
  79. package/src/components/TextareaInput/TextareaInput.tsx +4 -5
  80. package/src/components/TextareaInputInset/TextareaInputInset.module.scss +1 -1
  81. package/src/components/TextareaInputInset/TextareaInputInset.tsx +10 -17
  82. package/src/components/Toast/Toast.stories.tsx +5 -1
  83. package/src/components/Toggle/Toggle.module.scss +1 -1
  84. package/src/components/ToggleGroup/ToggleGroup.module.scss +1 -1
  85. package/src/styles/display.scss +1 -1
  86. package/src/styles/flex.scss +1 -1
  87. package/src/styles/overflow.scss +2 -0
  88. package/src/styles/position.scss +2 -0
  89. package/src/styles/text-align.scss +2 -0
  90. package/src/styles/utilities.scss +10 -9
  91. package/src/styles/variables/index.scss +2 -1
  92. package/src/styles/white-space.scss +2 -0
  93. package/src/types/index.ts +2 -3
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  @mixin floating-label-minimize-md {
4
4
  opacity: 0.75;
@@ -6,7 +6,6 @@ import React, {
6
6
  FocusEvent,
7
7
  ForwardRefExoticComponent,
8
8
  ReactNode,
9
- HTMLProps,
10
9
  InputHTMLAttributes,
11
10
  } from 'react';
12
11
  import classNames from 'classnames';
@@ -38,6 +37,10 @@ export interface TextInputInsetProps {
38
37
  * The text value of the input. Required since our Input is a controlled component.
39
38
  */
40
39
  value: InputHTMLAttributes<HTMLInputElement>['value'];
40
+ /**
41
+ * The input's autocomplete behavior.
42
+ */
43
+ autoComplete?: boolean | string;
41
44
  /**
42
45
  * Automatically focus the input when the page is loaded.
43
46
  */
@@ -58,7 +61,7 @@ export interface TextInputInsetProps {
58
61
  /**
59
62
  * Props passed directly to the input element of the component
60
63
  */
61
- inputProps?: BoxProps & HTMLProps<HTMLInputElement>;
64
+ inputProps?: Omit<BoxProps<'input'>, 'as'>;
62
65
  /**
63
66
  * The input's disabled attribute
64
67
  */
@@ -115,10 +118,6 @@ export interface TextInputInsetProps {
115
118
  * The input 'type' value. Defaults to type 'text'.
116
119
  */
117
120
  type?: InputHTMLAttributes<HTMLInputElement>['type'];
118
- /**
119
- * Additional props to be spread to rendered element
120
- */
121
- [x: string]: any; // eslint-disable-line
122
121
  }
123
122
 
124
123
  export const TextInputInset: ForwardRefExoticComponent<TextInputInsetProps> =
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  @mixin size-sm {
4
4
  border-radius: var(
@@ -9,7 +9,7 @@ import { generateResponsiveClasses } from '../../lib/generateResponsiveClasses';
9
9
  import styles from './TextareaInput.module.scss';
10
10
 
11
11
  export type TextareaInputSize = 'sm' | 'md' | 'lg';
12
- export interface TextareaInputProps extends Omit<BoxProps, 'as' | 'width'> {
12
+ interface TextareaInputOwnProps {
13
13
  /**
14
14
  * The input's id attribute. Used to programmatically tie the input with its label.
15
15
  */
@@ -96,12 +96,11 @@ export interface TextareaInputProps extends Omit<BoxProps, 'as' | 'width'> {
96
96
  * The size of the text input.
97
97
  */
98
98
  size?: TextareaInputSize | ResponsiveProp<TextareaInputSize>;
99
- /**
100
- * Additional props to be spread to rendered element
101
- */
102
- [x: string]: any; // eslint-disable-line
103
99
  }
104
100
 
101
+ export type TextareaInputProps = TextareaInputOwnProps &
102
+ Omit<BoxProps<'div'>, keyof TextareaInputOwnProps | 'as' | 'width'>;
103
+
105
104
  export const TextareaInput: FC<TextareaInputProps> = ({
106
105
  id,
107
106
  label,
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  @mixin floating-label-minimize-md {
4
4
  opacity: 0.75;
@@ -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
  ];
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  .item {
4
4
  line-height: 1;
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  .item {
4
4
  line-height: 1;
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables.scss';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  .display-inherit {
4
4
  display: inherit;
@@ -1,4 +1,4 @@
1
- @import '@hyphen/hyphen-design-tokens/build/scss/variables.scss';
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
2
 
3
3
  // min-width and min-height needed because of this
4
4
  // https://stackoverflow.com/questions/36247140/why-doesnt-flex-item-shrink-past-content-size
@@ -1,3 +1,5 @@
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
+
1
3
  .overflow-visible { overflow: visible; }
2
4
  .overflow-hidden { overflow: hidden; }
3
5
  .overflow-clip { overflow: clip; }
@@ -1,3 +1,5 @@
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
+
1
3
  .position-absolute { position: absolute; }
2
4
  .position-fixed { position: fixed; }
3
5
  .position-relative { position: relative; }
@@ -1,3 +1,5 @@
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
+
1
3
  .text-align-left { text-align: left; }
2
4
  .text-align-right { text-align: right; }
3
5
  .text-align-center { text-align: center; }
@@ -1,13 +1,14 @@
1
+ @use './animation';
2
+ @use './cursor';
3
+ @use './display';
4
+ @use './flex';
5
+ @use './overflow';
6
+ @use './text-align';
7
+ @use './white-space';
8
+ @use './position';
9
+ @use './transform';
10
+
1
11
  @import '@hyphen/hyphen-design-tokens/build/utilities/utilities.css';
2
- @import './animation';
3
- @import './cursor';
4
- @import './display';
5
- @import './flex';
6
- @import './overflow';
7
- @import './text-align';
8
- @import './white-space';
9
- @import './position';
10
- @import './transform';
11
12
 
12
13
  .sr-only {
13
14
  position: absolute;
@@ -1,3 +1,4 @@
1
+ @use './forms';
2
+
1
3
  @import '@hyphen/hyphen-design-tokens/build/css/variables.css';
2
4
  @import '@hyphen/hyphen-design-tokens/build/css/variables-root-dark.css';
3
- @import './forms';
@@ -1,3 +1,5 @@
1
+ @use '@hyphen/hyphen-design-tokens/build/scss/variables' as *;
2
+
1
3
  .ws-normal { white-space: normal; }
2
4
  .ws-nowrap { white-space: nowrap; }
3
5
  .ws-pre { white-space: pre; }
@@ -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
  /**