@hexure/ui 1.1.1 → 1.1.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.
@@ -13,7 +13,7 @@ export interface ButtonProps extends AccessibleProps {
13
13
  /** If enabled, the small button format will be used. */
14
14
  small?: boolean;
15
15
  /** Define which button type to display. By default the Primary button will be used. */
16
- type?: 'primary' | 'secondary';
16
+ type?: 'primary' | 'secondary' | 'red';
17
17
  }
18
18
  declare const Button: FC<ButtonProps>;
19
19
  export default Button;
@@ -9,8 +9,8 @@ interface ButtonProps {
9
9
  }
10
10
  export interface ModalProps extends AccessibleProps {
11
11
  primaryButton: ButtonProps;
12
- secondaryButton: ButtonProps;
13
- tertiaryButton: ButtonProps;
12
+ secondaryButton?: ButtonProps;
13
+ tertiaryButton?: ButtonProps;
14
14
  maxWidth?: string | number;
15
15
  /** It is used to pass child nodes, string values and number as child components. */
16
16
  children: ReactNode;
@@ -8,7 +8,7 @@ export interface MultiSelectProps extends AccessibleProps {
8
8
  readOnly?: boolean;
9
9
  displayCount?: number;
10
10
  invalid?: boolean;
11
- onChange: (e?: any) => void;
11
+ onChange: (e: any) => void;
12
12
  options?: OptionProps[];
13
13
  selected: (string | number)[];
14
14
  showSelectAll?: boolean;
package/dist/esm/index.js CHANGED
@@ -2035,6 +2035,23 @@ var Accordion = function (_a) {
2035
2035
  };
2036
2036
  var templateObject_1$j, templateObject_2$h;
2037
2037
 
2038
+ var button_type_mapping = {
2039
+ primary: {
2040
+ background_color: Colors.PRIMARY.Hex,
2041
+ border_color: Colors.PRIMARY.Hex,
2042
+ content_color: '#fff',
2043
+ },
2044
+ secondary: {
2045
+ background_color: 'transparent',
2046
+ border_color: Colors.PRIMARY.Hex,
2047
+ content_color: Colors.PRIMARY.Hex,
2048
+ },
2049
+ red: {
2050
+ background_color: Colors.RED.Hex,
2051
+ border_color: Colors.RED.Hex,
2052
+ content_color: '#fff',
2053
+ },
2054
+ };
2038
2055
  var StyledButton = styled.button(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n height: ", ";\n line-height: 1em;\n border-radius: ", ";\n margin: ", ";\n padding: ", ";\n outline: none;\n background: ", ";\n width: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n &:hover {\n opacity: ", ";\n }\n"], ["\n height: ", ";\n line-height: 1em;\n border-radius: ", ";\n margin: ", ";\n padding: ", ";\n outline: none;\n background: ", ";\n width: ", ";\n cursor: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: ", ";\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n box-sizing: border-box;\n &:hover {\n opacity: ", ";\n }\n"])), function (props) { return (props.$small ? '30px' : '40px'); }, function (props) { return (props.$small ? '15px' : '20px'); }, function (props) { return props.$margin || '0px'; }, function (props) {
2039
2056
  if (props.$hasChildren) {
2040
2057
  if (props.$small) {
@@ -2045,7 +2062,9 @@ var StyledButton = styled.button(templateObject_1$i || (templateObject_1$i = __m
2045
2062
  }
2046
2063
  }
2047
2064
  return '0px';
2048
- }, function (props) { return (props.$type === 'secondary' ? 'transparent' : Colors.PRIMARY.Hex); }, function (props) {
2065
+ }, function (props) {
2066
+ return props.$type ? button_type_mapping[props.$type].background_color : Colors.PRIMARY.Hex;
2067
+ }, function (props) {
2049
2068
  if (props.$hasChildren) {
2050
2069
  return 'auto';
2051
2070
  }
@@ -2053,16 +2072,18 @@ var StyledButton = styled.button(templateObject_1$i || (templateObject_1$i = __m
2053
2072
  return '30px';
2054
2073
  }
2055
2074
  return '40px';
2056
- }, function (props) { return (props.$disabled ? 'default' : 'pointer'); }, function (props) { return (props.$disabled ? 0.6 : 0.9); }, Colors.PRIMARY.Hex, function (props) { return (props.$disabled ? 0.6 : 1); });
2057
- var Label$3 = styled.span(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n font-weight: 500;\n line-height: ", ";\n"], ["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n font-weight: 500;\n line-height: ", ";\n"])), function (props) { return (props.$type === 'secondary' ? Colors.PRIMARY.Hex : '#fff'); }, function (props) { return (props.$small ? FontSizes.SMALL : FontSizes.DEFAULT); }, FontStyles.DEFAULT, function (props) { return (props.$small ? '2.2em' : '2.9em'); });
2075
+ }, function (props) { return (props.$disabled ? 'default' : 'pointer'); }, function (props) { return (props.$disabled ? 0.6 : 0.9); }, function (props) {
2076
+ return props.$type ? button_type_mapping[props.$type].border_color : Colors.PRIMARY.Hex;
2077
+ }, function (props) { return (props.$disabled ? 0.6 : 1); });
2078
+ var Label$3 = styled.span(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n font-weight: 500;\n line-height: ", ";\n"], ["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n font-weight: 500;\n line-height: ", ";\n"])), function (props) { return (props.$type ? button_type_mapping[props.$type].content_color : '#fff'); }, function (props) { return (props.$small ? FontSizes.SMALL : FontSizes.DEFAULT); }, FontStyles.DEFAULT, function (props) { return (props.$small ? '2.2em' : '2.9em'); });
2058
2079
  var StyledIcon = styled.span(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n display: flex;\n align-items: center;\n box-sizing: border-box;\n"], ["\n margin-left: ", ";\n margin-right: ", ";\n display: flex;\n align-items: center;\n box-sizing: border-box;\n"])), function (props) { return (props.$hasChildren ? '6px' : '0px'); }, function (props) { return (props.$hasChildren ? '-4px' : '0px'); });
2059
2080
  var Button = function (_a) {
2060
2081
  var children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.margin, margin = _c === void 0 ? '' : _c, onClick = _a.onClick, _d = _a.small, small = _d === void 0 ? false : _d, _e = _a.type, type = _e === void 0 ? 'primary' : _e, accessibleProps = __rest(_a, ["children", "disabled", "icon", "margin", "onClick", "small", "type"]);
2061
2082
  var has_children = children && children.length > 0;
2062
- return (React.createElement(StyledButton, __assign({ "$disabled": disabled, "$hasChildren": !!has_children, "$margin": margin, "$onClick": disabled ? undefined : onClick, "$small": small, "$type": type }, accessibleProps),
2083
+ return (React.createElement(StyledButton, __assign({ "$disabled": disabled, "$hasChildren": !!has_children, "$margin": margin, "$small": small, "$type": type, onClick: disabled ? undefined : onClick }, accessibleProps),
2063
2084
  children ? (React.createElement(Label$3, { "$small": small, "$type": type }, children)) : null,
2064
2085
  icon ? (React.createElement(StyledIcon, { "$hasChildren": !!has_children },
2065
- React.createElement(Icon, { color: type === 'secondary' ? Colors.PRIMARY.Hex : '#fff', path: icon, size: small ? '20px' : '24px' }))) : null));
2086
+ React.createElement(Icon, { color: type ? button_type_mapping[type].content_color : '#fff', path: icon, size: small ? '20px' : '24px' }))) : null));
2066
2087
  };
2067
2088
  var templateObject_1$i, templateObject_2$g, templateObject_3$b;
2068
2089
 
@@ -2322,7 +2343,7 @@ var Container = styled.dialog(templateObject_2$7 || (templateObject_2$7 = __make
2322
2343
  var Header$1 = styled.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n position: sticky;\n top: 0;\n padding: 20px;\n border-bottom: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n background: #ffffff;\n box-sizing: border-box;\n"], ["\n position: sticky;\n top: 0;\n padding: 20px;\n border-bottom: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n background: #ffffff;\n box-sizing: border-box;\n"])));
2323
2344
  var Close = styled.div(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n margin-left: auto;\n display: flex;\n align-items: center;\n padding-left: 20px;\n cursor: pointer;\n"], ["\n margin-left: auto;\n display: flex;\n align-items: center;\n padding-left: 20px;\n cursor: pointer;\n"])));
2324
2345
  var CloseMsg = styled.span(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: 400;\n font-family: ", ";\n line-height: 1em;\n color: ", ";\n"], ["\n font-size: ", ";\n font-weight: 400;\n font-family: ", ";\n line-height: 1em;\n color: ", ";\n"])), FontSizes.SMALL, FontStyles.DEFAULT, Colors.MEDIUM_GRAY.Hex);
2325
- var ContentWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n overflow: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"], ["\n overflow: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"])));
2346
+ var ContentWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n overflow-x: hidden;\n overflow-y: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"], ["\n overflow-x: hidden;\n overflow-y: auto;\n background: #ffffff;\n max-height: calc(100vh - 260px);\n box-sizing: border-box;\n"])));
2326
2347
  var ButtonBar = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: sticky;\n bottom: 0;\n background: #ffffff;\n padding: 20px;\n border-top: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n justify-self: flex-end;\n box-sizing: border-box;\n"], ["\n position: sticky;\n bottom: 0;\n background: #ffffff;\n padding: 20px;\n border-top: 1px solid #e5e5e5;\n display: flex;\n align-items: center;\n justify-self: flex-end;\n box-sizing: border-box;\n"])));
2327
2348
  var Modal = function (_a) {
2328
2349
  var children = _a.children, title = _a.title, onClose = _a.onClose, maxWidth = _a.maxWidth, primaryButton = _a.primaryButton, secondaryButton = _a.secondaryButton, tertiaryButton = _a.tertiaryButton, accessibleProps = __rest(_a, ["children", "title", "onClose", "maxWidth", "primaryButton", "secondaryButton", "tertiaryButton"]);