@hexure/ui 1.6.3 → 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.
- package/dist/cjs/index.js +9 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ActionDialog/ActionDialog.d.ts +4 -1
- package/dist/cjs/types/components/Button/Button.d.ts +2 -0
- package/dist/esm/index.js +11 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ActionDialog/ActionDialog.d.ts +4 -1
- package/dist/esm/types/components/Button/Button.d.ts +2 -0
- package/dist/index.d.ts +6 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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. */
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useRef, useDebugValue, useContext, createElement,
|
|
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
|
|
|
@@ -2104,12 +2104,12 @@ var Badge$1 = styled.span(templateObject_4$9 || (templateObject_4$9 = __makeTemp
|
|
|
2104
2104
|
return props.$format ? button_type_mapping[props.$format].badge_content_color : Colors.PRIMARY.Hex;
|
|
2105
2105
|
}, function (props) { return (props.$small ? '10px' : '12px'); }, FontStyles.DEFAULT, function (props) { return (props.$small ? '5px' : '10px'); }, function (props) { return (props.$small ? '-5px' : '-10px'); });
|
|
2106
2106
|
var Button = function (_a) {
|
|
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.margin, margin =
|
|
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"]);
|
|
2108
2108
|
var has_children = children && children.length > 0;
|
|
2109
|
-
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),
|
|
2110
2110
|
children ? (React.createElement(Label$4, { "$format": format, "$small": small }, children)) : null,
|
|
2111
2111
|
icon && !badge ? (React.createElement(StyledIcon$2, { "$hasChildren": !!has_children },
|
|
2112
|
-
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,
|
|
2113
2113
|
badge && !icon ? (React.createElement(Badge$1, { "$format": format, "$small": small }, badge)) : null));
|
|
2114
2114
|
};
|
|
2115
2115
|
var templateObject_1$o, templateObject_2$l, templateObject_3$i, templateObject_4$9;
|
|
@@ -2151,26 +2151,17 @@ var templateObject_1$m, templateObject_2$k, templateObject_3$h;
|
|
|
2151
2151
|
|
|
2152
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"])));
|
|
2153
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"])));
|
|
2154
|
-
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"])));
|
|
2155
2155
|
var ActionDialog = function (_a) {
|
|
2156
|
-
var description = _a.description, title = _a.title,
|
|
2157
|
-
useEffect(function () {
|
|
2158
|
-
document.onkeydown = function (e) {
|
|
2159
|
-
if (e.key === 'Escape') {
|
|
2160
|
-
onClose();
|
|
2161
|
-
}
|
|
2162
|
-
};
|
|
2163
|
-
return function cleanup() {
|
|
2164
|
-
document.onkeydown = null;
|
|
2165
|
-
};
|
|
2166
|
-
}, []);
|
|
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"]);
|
|
2167
2157
|
return (React.createElement(Wrapper$f, __assign({}, accessibleProps),
|
|
2168
2158
|
React.createElement(Container$3, { open: true },
|
|
2169
2159
|
title ? (React.createElement(Heading, { margin: '0px 0px 20px 0px', type: 'secondary' }, title)) : null,
|
|
2170
2160
|
description ? React.createElement(Copy, { align: 'center' }, description) : null,
|
|
2171
|
-
primaryButton || secondaryButton ? (React.createElement(Buttons, null,
|
|
2172
|
-
|
|
2173
|
-
|
|
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)));
|
|
2174
2165
|
};
|
|
2175
2166
|
var templateObject_1$l, templateObject_2$j, templateObject_3$g;
|
|
2176
2167
|
|