@hexure/ui 1.6.2 → 1.6.4

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.
@@ -31,6 +31,10 @@ export declare const Colors: {
31
31
  Hex: string;
32
32
  Rgb: string;
33
33
  };
34
+ SUBTLE_GRAY: {
35
+ Hex: string;
36
+ Rgb: string;
37
+ };
34
38
  };
35
39
  export declare const FontStyles: {
36
40
  DEFAULT: string;
@@ -11,9 +11,12 @@ export interface ActionDialogProps extends AccessibleProps {
11
11
  title?: string;
12
12
  /** It is used to give description. */
13
13
  description?: string;
14
+ /** Set the primary action for the dialog */
14
15
  primaryButton?: ButtonProps;
16
+ /** Set the secondary action for the dialog. This should only be defined after a primary action is defined */
15
17
  secondaryButton?: ButtonProps;
16
- onClose: (e?: any) => void;
18
+ /** Set the tertiary action for the dialog. This should only be defined after a secondary action is defined */
19
+ tertiaryButton?: ButtonProps;
17
20
  }
18
21
  declare const ActionDialog: FC<ActionDialogProps>;
19
22
  export default ActionDialog;
@@ -11,6 +11,8 @@ export interface ButtonProps extends AccessibleProps {
11
11
  icon?: string;
12
12
  /** Adjust the button to work within a <form> tag. Ignores onClick, sets type='form' */
13
13
  isForm?: boolean;
14
+ /** Displays a loading state for the button */
15
+ loading?: boolean;
14
16
  /** Set the margin of the button as needed */
15
17
  margin?: string;
16
18
  /** Prop to pass a that fires when the user does a click. */
@@ -1,10 +1,11 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { AccessibleProps } from '../../utils/Accessibility';
3
3
  export interface TagProps extends AccessibleProps {
4
4
  /** It is used to select tag-type either default or removable. */
5
- color?: 'PRIMARY' | 'GREEN' | 'RED' | 'YELLOW' | 'BLACK';
5
+ color?: 'PRIMARY' | 'GREEN' | 'RED' | 'YELLOW' | 'BLACK' | 'SUBTLE_GRAY';
6
6
  /** It is used to give label to tag. */
7
- children: string | number;
7
+ children: string | React.ReactNode;
8
+ /** Method to run when the tag is clicked */
8
9
  onClick?: (e?: any) => void;
9
10
  /** It is callback function called when user wants to close the tag. */
10
11
  removable?: boolean;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import React, { useRef, useDebugValue, useContext, createElement, useEffect, useState } from 'react';
1
+ import React, { useRef, useDebugValue, useContext, createElement, useState, useEffect } from 'react';
2
2
  import Icon from '@mdi/react';
3
- import { mdiChevronUp, mdiChevronDown, mdiInformationOutline, mdiAlertOctagonOutline, mdiAlertOutline, mdiCheckboxMarkedCircleOutline, mdiClose, mdiMinusCircle, mdiFolderPlusOutline, mdiChevronLeft, mdiChevronRight, mdiCheck } from '@mdi/js';
3
+ import { mdiChevronUp, mdiChevronDown, mdiLoading, mdiInformationOutline, mdiAlertOctagonOutline, mdiAlertOutline, mdiCheckboxMarkedCircleOutline, mdiClose, mdiMinusCircle, mdiFolderPlusOutline, mdiChevronLeft, mdiChevronRight, mdiCheck } from '@mdi/js';
4
4
  import Numeral from 'numeral';
5
5
  import 'moment';
6
6
 
@@ -2024,6 +2024,10 @@ var Colors = {
2024
2024
  Hex: '#E7E6E6',
2025
2025
  Rgb: '231, 230, 230',
2026
2026
  },
2027
+ SUBTLE_GRAY: {
2028
+ Hex: '#f5f5f5',
2029
+ Rgb: '245, 245, 245',
2030
+ },
2027
2031
  };
2028
2032
  var FontStyles = {
2029
2033
  DEFAULT: '"Roboto", Helvetica, Arial, sans-serif',
@@ -2100,12 +2104,12 @@ var Badge$1 = styled.span(templateObject_4$9 || (templateObject_4$9 = __makeTemp
2100
2104
  return props.$format ? button_type_mapping[props.$format].badge_content_color : Colors.PRIMARY.Hex;
2101
2105
  }, function (props) { return (props.$small ? '10px' : '12px'); }, FontStyles.DEFAULT, function (props) { return (props.$small ? '5px' : '10px'); }, function (props) { return (props.$small ? '-5px' : '-10px'); });
2102
2106
  var Button = function (_a) {
2103
- var badge = _a.badge, children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.isForm, isForm = _c === void 0 ? false : _c, _d = _a.margin, margin = _d === void 0 ? '' : _d, onClick = _a.onClick, _e = _a.small, small = _e === void 0 ? false : _e, _f = _a.format, format = _f === void 0 ? 'primary' : _f, accessibleProps = __rest(_a, ["badge", "children", "disabled", "icon", "isForm", "margin", "onClick", "small", "format"]);
2107
+ var badge = _a.badge, children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.isForm, isForm = _c === void 0 ? false : _c, _d = _a.loading, loading = _d === void 0 ? false : _d, _e = _a.margin, margin = _e === void 0 ? '' : _e, onClick = _a.onClick, _f = _a.small, small = _f === void 0 ? false : _f, _g = _a.format, format = _g === void 0 ? 'primary' : _g, accessibleProps = __rest(_a, ["badge", "children", "disabled", "icon", "isForm", "loading", "margin", "onClick", "small", "format"]);
2104
2108
  var has_children = children && children.length > 0;
2105
- return (React.createElement(StyledButton, __assign({ "$disabled": disabled, "$format": format, "$hasChildren": !!has_children, "$margin": margin, "$small": small, onClick: disabled ? undefined : onClick, type: isForm ? 'submit' : undefined }, accessibleProps),
2109
+ return (React.createElement(StyledButton, __assign({ "$disabled": disabled || loading, "$format": format, "$hasChildren": !!has_children, "$margin": margin, "$small": small, onClick: disabled || loading ? undefined : onClick, type: isForm ? 'submit' : undefined }, accessibleProps),
2106
2110
  children ? (React.createElement(Label$4, { "$format": format, "$small": small }, children)) : null,
2107
2111
  icon && !badge ? (React.createElement(StyledIcon$2, { "$hasChildren": !!has_children },
2108
- React.createElement(Icon, { color: format ? button_type_mapping[format].content_color : '#fff', path: icon, size: small ? '20px' : '24px' }))) : null,
2112
+ React.createElement(Icon, { color: format ? button_type_mapping[format].content_color : '#fff', path: loading ? mdiLoading : icon, size: small ? '20px' : '24px', spin: loading }))) : null,
2109
2113
  badge && !icon ? (React.createElement(Badge$1, { "$format": format, "$small": small }, badge)) : null));
2110
2114
  };
2111
2115
  var templateObject_1$o, templateObject_2$l, templateObject_3$i, templateObject_4$9;
@@ -2147,26 +2151,17 @@ var templateObject_1$m, templateObject_2$k, templateObject_3$h;
2147
2151
 
2148
2152
  var Wrapper$f = styled.div(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 9999;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n"], ["\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 9999;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n"])));
2149
2153
  var Container$3 = styled.dialog(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["\n max-width: 600px;\n width: auto;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0px 10px 30px -15px rgba(0, 0, 0, 0.2);\n outline: none;\n border: none;\n position: relative;\n padding: 40px;\n text-align: center;\n box-sizing: border-box;\n"], ["\n max-width: 600px;\n width: auto;\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0px 10px 30px -15px rgba(0, 0, 0, 0.2);\n outline: none;\n border: none;\n position: relative;\n padding: 40px;\n text-align: center;\n box-sizing: border-box;\n"])));
2150
- var Buttons = styled.div(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-top: 30px;\n box-sizing: border-box;\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-top: 30px;\n box-sizing: border-box;\n"])));
2154
+ var Buttons = styled.div(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n align-items: center;\n justify-content: center;\n margin-top: 30px;\n box-sizing: border-box;\n"], ["\n display: flex;\n gap: 10px;\n align-items: center;\n justify-content: center;\n margin-top: 30px;\n box-sizing: border-box;\n"])));
2151
2155
  var ActionDialog = function (_a) {
2152
- var description = _a.description, title = _a.title, onClose = _a.onClose, primaryButton = _a.primaryButton, secondaryButton = _a.secondaryButton, accessibleProps = __rest(_a, ["description", "title", "onClose", "primaryButton", "secondaryButton"]);
2153
- useEffect(function () {
2154
- document.onkeydown = function (e) {
2155
- if (e.key === 'Escape') {
2156
- onClose();
2157
- }
2158
- };
2159
- return function cleanup() {
2160
- document.onkeydown = null;
2161
- };
2162
- }, []);
2156
+ var description = _a.description, title = _a.title, primaryButton = _a.primaryButton, secondaryButton = _a.secondaryButton, tertiaryButton = _a.tertiaryButton, accessibleProps = __rest(_a, ["description", "title", "primaryButton", "secondaryButton", "tertiaryButton"]);
2163
2157
  return (React.createElement(Wrapper$f, __assign({}, accessibleProps),
2164
2158
  React.createElement(Container$3, { open: true },
2165
2159
  title ? (React.createElement(Heading, { margin: '0px 0px 20px 0px', type: 'secondary' }, title)) : null,
2166
2160
  description ? React.createElement(Copy, { align: 'center' }, description) : null,
2167
- primaryButton || secondaryButton ? (React.createElement(Buttons, null,
2168
- secondaryButton ? (React.createElement(Button, __assign({}, secondaryButton, { format: 'secondary', margin: '0px 5px' }))) : null,
2169
- primaryButton ? React.createElement(Button, __assign({}, primaryButton, { format: 'primary', margin: '0px 5px' })) : null)) : null)));
2161
+ primaryButton || secondaryButton || tertiaryButton ? (React.createElement(Buttons, null,
2162
+ tertiaryButton ? React.createElement(Button, __assign({}, tertiaryButton, { format: 'secondary' })) : null,
2163
+ secondaryButton ? React.createElement(Button, __assign({}, secondaryButton, { format: 'secondary' })) : null,
2164
+ primaryButton ? React.createElement(Button, __assign({}, primaryButton, { format: 'primary' })) : null)) : null)));
2170
2165
  };
2171
2166
  var templateObject_1$l, templateObject_2$j, templateObject_3$g;
2172
2167
 
@@ -3150,15 +3145,15 @@ var templateObject_1$3, templateObject_2$3, templateObject_3$2;
3150
3145
 
3151
3146
  var Wrapper$1 = styled.div(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n display: inline-block;\n border-radius: 4px;\n padding: 4px 6px;\n background: ", ";\n color: #ffffff;\n box-sizing: border-box;\n cursor: ", ";\n"], ["\n display: inline-block;\n border-radius: 4px;\n padding: 4px 6px;\n background: ", ";\n color: #ffffff;\n box-sizing: border-box;\n cursor: ", ";\n"])), function (props) { return Colors[props.$color].Hex; }, function (props) { return (props.$removable ? 'pointer' : 'default'); });
3152
3147
  var Content = styled.div(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
3153
- var Label = styled.div(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n color: #ffffff;\n font-size: ", ";\n font-weight: 500;\n font-family: ", ";\n line-height: 1.2em;\n"], ["\n color: #ffffff;\n font-size: ", ";\n font-weight: 500;\n font-family: ", ";\n line-height: 1.2em;\n"])), FontSizes.SMALL, FontStyles.DEFAULT);
3148
+ var Label = styled.div(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-weight: 500;\n font-family: ", ";\n line-height: 1.2em;\n"], ["\n color: ", ";\n font-size: ", ";\n font-weight: 500;\n font-family: ", ";\n line-height: 1.2em;\n"])), function (props) { return (props.$color === 'SUBTLE_GRAY' ? '#000000' : '#ffffff'); }, FontSizes.SMALL, FontStyles.DEFAULT);
3154
3149
  var Remove = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-left: 10px;\n display: flex;\n align-items: center;\n"], ["\n margin-left: 10px;\n display: flex;\n align-items: center;\n"])));
3155
3150
  var Tag = function (_a) {
3156
3151
  var children = _a.children, _b = _a.color, color = _b === void 0 ? 'PRIMARY' : _b, removable = _a.removable, onClick = _a.onClick, accessibleProps = __rest(_a, ["children", "color", "removable", "onClick"]);
3157
3152
  return (React.createElement(Wrapper$1, __assign({ "$color": color, "$removable": removable, onClick: onClick }, accessibleProps),
3158
3153
  React.createElement(Content, null,
3159
- React.createElement(Label, null, children),
3154
+ React.createElement(Label, { "$color": color }, children),
3160
3155
  removable ? (React.createElement(Remove, null,
3161
- React.createElement(Icon, { color: '#ffffff', path: mdiClose, size: '15px' }))) : null)));
3156
+ React.createElement(Icon, { color: color === 'SUBTLE_GRAY' ? '#000000' : '#ffffff', path: mdiClose, size: '15px' }))) : null)));
3162
3157
  };
3163
3158
  var templateObject_1$2, templateObject_2$2, templateObject_3$1, templateObject_4;
3164
3159