@hyphen/hyphen-components 2.16.3 → 2.18.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.
- package/dist/components/Button/Button.d.ts +5 -1
- package/dist/components/Button/Button.stories.d.ts +1 -0
- package/dist/css/utilities.css +19 -1
- package/dist/css/variables.css +5 -2
- package/dist/hyphen-components.cjs.development.js +10 -20
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +10 -20
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/lib/tokens.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/Button/Button.mdx +7 -0
- package/src/components/Button/Button.stories.tsx +19 -3
- package/src/components/Button/Button.test.tsx +241 -293
- package/src/components/Button/Button.tsx +13 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IconName, ResponsiveProp } from '../../types';
|
|
1
|
+
import { BoxShadowSize, IconName, ResponsiveProp } from '../../types';
|
|
2
2
|
import React, {
|
|
3
3
|
AnchorHTMLAttributes,
|
|
4
4
|
ButtonHTMLAttributes,
|
|
@@ -76,6 +76,10 @@ export interface BaseButtonProps {
|
|
|
76
76
|
* Callback when Button receives focus.
|
|
77
77
|
*/
|
|
78
78
|
onFocus?: (event: FocusEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
79
|
+
/**
|
|
80
|
+
* The size of the drop shadow applied to the Box
|
|
81
|
+
*/
|
|
82
|
+
shadow?: BoxShadowSize | ResponsiveProp<BoxShadowSize>;
|
|
79
83
|
/**
|
|
80
84
|
* Specify the tabIndex of the button.
|
|
81
85
|
*/
|
|
@@ -137,10 +141,11 @@ export const Button = forwardRef<
|
|
|
137
141
|
onClick = undefined,
|
|
138
142
|
onFocus = undefined,
|
|
139
143
|
onBlur = undefined,
|
|
144
|
+
shadow = undefined,
|
|
145
|
+
size = 'md',
|
|
140
146
|
tabIndex = undefined,
|
|
141
147
|
target = undefined,
|
|
142
148
|
type = undefined,
|
|
143
|
-
size = 'md',
|
|
144
149
|
variant = 'primary',
|
|
145
150
|
...restProps
|
|
146
151
|
},
|
|
@@ -157,6 +162,7 @@ export const Button = forwardRef<
|
|
|
157
162
|
styles.button,
|
|
158
163
|
className,
|
|
159
164
|
responsiveClasses,
|
|
165
|
+
generateResponsiveClasses('shadow', shadow),
|
|
160
166
|
{
|
|
161
167
|
[styles.loading]: isLoading,
|
|
162
168
|
[styles[variant]]: variant,
|
|
@@ -221,11 +227,16 @@ export const Button = forwardRef<
|
|
|
221
227
|
return createElement(
|
|
222
228
|
buttonElement,
|
|
223
229
|
{
|
|
230
|
+
['aria-disabled']: disabled,
|
|
224
231
|
id,
|
|
225
232
|
href,
|
|
226
233
|
className: buttonClasses,
|
|
227
234
|
disabled,
|
|
228
235
|
target: as === 'a' && href ? target : null,
|
|
236
|
+
rel:
|
|
237
|
+
as === 'a' && href && target === '_blank'
|
|
238
|
+
? 'noopener noreferrer'
|
|
239
|
+
: null,
|
|
229
240
|
onBlur: handleBlur,
|
|
230
241
|
onClick: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) =>
|
|
231
242
|
handleClick(event, onClick, target, navigate),
|