@hyphen/hyphen-components 2.17.0 → 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.
@@ -1,4 +1,4 @@
1
- import { IconName, ResponsiveProp } from '../../types';
1
+ import { BoxShadowSize, IconName, ResponsiveProp } from '../../types';
2
2
  import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, FocusEvent, MouseEvent, ReactNode } from 'react';
3
3
  export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'danger';
4
4
  export type ButtonSize = 'sm' | 'md' | 'lg';
@@ -56,6 +56,10 @@ export interface BaseButtonProps {
56
56
  * Callback when Button receives focus.
57
57
  */
58
58
  onFocus?: (event: FocusEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
59
+ /**
60
+ * The size of the drop shadow applied to the Box
61
+ */
62
+ shadow?: BoxShadowSize | ResponsiveProp<BoxShadowSize>;
59
63
  /**
60
64
  * Specify the tabIndex of the button.
61
65
  */
@@ -11,4 +11,5 @@ export declare const Icons: () => React.JSX.Element;
11
11
  export declare const IconButton: () => React.JSX.Element;
12
12
  export declare const Loading: () => React.JSX.Element;
13
13
  export declare const Disabled: () => React.JSX.Element;
14
+ export declare const Shadow: () => React.JSX.Element;
14
15
  export declare const Anchor: () => React.JSX.Element;
@@ -754,9 +754,9 @@ var handleReactRouterClick = function handleReactRouterClick(event, onClick, tar
754
754
 
755
755
  var styles$s = {"button":"Button-module_button__18Bed","size-sm":"Button-module_size-sm__6Xrjw","size-md":"Button-module_size-md__BkuGu","size-lg":"Button-module_size-lg__JVYWV","primary":"Button-module_primary__st6yY","secondary":"Button-module_secondary__j-3rj","tertiary":"Button-module_tertiary__Nd7xM","danger":"Button-module_danger__Hxs5n","size-sm-tablet":"Button-module_size-sm-tablet__9XaSx","size-md-tablet":"Button-module_size-md-tablet__YQxaI","size-lg-tablet":"Button-module_size-lg-tablet__h3l97","size-sm-desktop":"Button-module_size-sm-desktop__8tTsg","size-md-desktop":"Button-module_size-md-desktop__OCdDi","size-lg-desktop":"Button-module_size-lg-desktop__uFc4f","size-sm-hd":"Button-module_size-sm-hd__INFfD","size-md-hd":"Button-module_size-md-hd__8e2mW","size-lg-hd":"Button-module_size-lg-hd__DH60l","loading":"Button-module_loading__QfItr","label":"Button-module_label__1PsXG","full-width":"Button-module_full-width__qDri6","spinner-wrapper":"Button-module_spinner-wrapper__rALNw"};
756
756
 
757
- var _excluded$F = ["children", "as", "className", "fullWidth", "id", "href", "iconPrefix", "iconSuffix", "isDisabled", "isLoading", "navigate", "onClick", "onFocus", "onBlur", "tabIndex", "target", "type", "size", "variant"];
757
+ var _excluded$F = ["children", "as", "className", "fullWidth", "id", "href", "iconPrefix", "iconSuffix", "isDisabled", "isLoading", "navigate", "onClick", "onFocus", "onBlur", "shadow", "size", "tabIndex", "target", "type", "variant"];
758
758
  var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
759
- var _classNames;
759
+ var _classNames, _extends2;
760
760
  var _ref$children = _ref.children,
761
761
  children = _ref$children === void 0 ? undefined : _ref$children,
762
762
  _ref$as = _ref.as,
@@ -785,14 +785,16 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
785
785
  onFocus = _ref$onFocus === void 0 ? undefined : _ref$onFocus,
786
786
  _ref$onBlur = _ref.onBlur,
787
787
  onBlur = _ref$onBlur === void 0 ? undefined : _ref$onBlur,
788
+ _ref$shadow = _ref.shadow,
789
+ shadow = _ref$shadow === void 0 ? undefined : _ref$shadow,
790
+ _ref$size = _ref.size,
791
+ size = _ref$size === void 0 ? 'md' : _ref$size,
788
792
  _ref$tabIndex = _ref.tabIndex,
789
793
  tabIndex = _ref$tabIndex === void 0 ? undefined : _ref$tabIndex,
790
794
  _ref$target = _ref.target,
791
795
  target = _ref$target === void 0 ? undefined : _ref$target,
792
796
  _ref$type = _ref.type,
793
797
  type = _ref$type === void 0 ? undefined : _ref$type,
794
- _ref$size = _ref.size,
795
- size = _ref$size === void 0 ? 'md' : _ref$size,
796
798
  _ref$variant = _ref.variant,
797
799
  variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
798
800
  restProps = _objectWithoutPropertiesLoose(_ref, _excluded$F);
@@ -800,7 +802,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
800
802
  var responsiveClasses = generateResponsiveClasses('size', size).map(function (c) {
801
803
  return styles$s[c];
802
804
  });
803
- var buttonClasses = classNames('hyphen-components__variables__form-control', styles$s.button, className, responsiveClasses, (_classNames = {}, _classNames[styles$s.loading] = isLoading, _classNames[styles$s[variant]] = variant, _classNames[styles$s['full-width']] = fullWidth, _classNames));
805
+ var buttonClasses = classNames('hyphen-components__variables__form-control', styles$s.button, className, responsiveClasses, generateResponsiveClasses('shadow', shadow), (_classNames = {}, _classNames[styles$s.loading] = isLoading, _classNames[styles$s[variant]] = variant, _classNames[styles$s['full-width']] = fullWidth, _classNames));
804
806
  var handleClick = handleReactRouterClick;
805
807
  var handleFocus = function handleFocus(event) {
806
808
  if (onFocus) onFocus(event);
@@ -844,21 +846,9 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
844
846
  var buttonElement = getElementType(Button, {
845
847
  as: as
846
848
  });
847
- return React.createElement(buttonElement, _extends({
848
- id: id,
849
- href: href,
850
- className: buttonClasses,
851
- disabled: disabled,
852
- target: as === 'a' && href ? target : null,
853
- onBlur: handleBlur,
854
- onClick: function onClick(event) {
855
- return handleClick(event, _onClick, target, navigate);
856
- },
857
- onFocus: handleFocus,
858
- ref: ref,
859
- type: type || (as !== 'a' && !href ? 'button' : undefined),
860
- tabIndex: tabIndex
861
- }, restProps), buttonContent);
849
+ return React.createElement(buttonElement, _extends((_extends2 = {}, _extends2['aria-disabled'] = disabled, _extends2.id = id, _extends2.href = href, _extends2.className = buttonClasses, _extends2.disabled = disabled, _extends2.target = as === 'a' && href ? target : null, _extends2.rel = as === 'a' && href && target === '_blank' ? 'noopener noreferrer' : null, _extends2.onBlur = handleBlur, _extends2.onClick = function onClick(event) {
850
+ return handleClick(event, _onClick, target, navigate);
851
+ }, _extends2.onFocus = handleFocus, _extends2.ref = ref, _extends2.type = type || (as !== 'a' && !href ? 'button' : undefined), _extends2.tabIndex = tabIndex, _extends2), restProps), buttonContent);
862
852
  });
863
853
 
864
854
  var _excluded$E = ["background", "borderColor", "borderWidth", "children", "display", "padding"];