armtek-uikit-react 1.0.256 → 1.0.258
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/assets/Accordion.scss +123 -123
- package/assets/Adornment.scss +22 -22
- package/assets/Alert.scss +56 -56
- package/assets/Avatar.scss +111 -111
- package/assets/AvatarGroup.scss +47 -47
- package/assets/BackDrop.scss +33 -21
- package/assets/Badge.scss +96 -96
- package/assets/Button.scss +750 -750
- package/assets/ButtonGroup.scss +37 -37
- package/assets/ButtonIcon.scss +32 -32
- package/assets/Card.scss +13 -13
- package/assets/Checkbox.scss +313 -313
- package/assets/Chip.scss +313 -313
- package/assets/DateField.scss +2 -2
- package/assets/DatePicker.scss +72 -72
- package/assets/Dropdown.scss +42 -42
- package/assets/FormControls.scss +14 -14
- package/assets/HelperText.scss +11 -11
- package/assets/Icon.scss +30 -30
- package/assets/Interval.scss +34 -34
- package/assets/Link.scss +96 -96
- package/assets/ListItem.scss +73 -73
- package/assets/Loader.scss +56 -56
- package/assets/Logo.scss +28 -28
- package/assets/Modal.scss +93 -88
- package/assets/Pagination.scss +3 -3
- package/assets/Paper.scss +22 -22
- package/assets/Period.scss +8 -8
- package/assets/Popper.scss +2 -2
- package/assets/Rating.scss +26 -26
- package/assets/Select.scss +85 -85
- package/assets/Skeleton.scss +25 -25
- package/assets/Slider.scss +5 -5
- package/assets/Stack.scss +27 -27
- package/assets/Status.scss +69 -69
- package/assets/StepItem.scss +89 -89
- package/assets/StepItemIcon.scss +47 -47
- package/assets/Stepper.scss +30 -30
- package/assets/Switch.scss +67 -67
- package/assets/Table.scss +52 -52
- package/assets/TextArea.scss +17 -17
- package/assets/TextField.scss +197 -197
- package/assets/Tooltip.scss +17 -17
- package/assets/classes.scss +422 -422
- package/assets/fonts.scss +24 -24
- package/assets/global.scss +222 -222
- package/assets/styles.min.css +1 -1
- package/assets/styles.min.css.map +1 -1
- package/assets/styles.scss +46 -46
- package/assets/variables.scss +13 -13
- package/lib/hooks/useEnhancedEffect.js +6 -6
- package/lib/hooks/useTimeout.js +2 -2
- package/package.json +1 -1
- package/ui/BackDrop/BackDrop.d.ts +1 -1
- package/ui/BackDrop/BackDropBase.d.ts +2 -2
- package/ui/BackDrop/BackDropBase.js +6 -3
- package/ui/Form/DateField/DateField.js +2 -2
- package/ui/Form/DatePicker/styles.css +802 -802
- package/ui/Form/FormControls/FormControls.d.ts +2 -2
- package/ui/Modal/BaseModal.d.ts +11 -2
- package/ui/Modal/BaseModal.js +25 -7
- package/ui/Modal/Modal.d.ts +1 -1
- package/ui/Modal/Modal.js +28 -5
- package/ui/Slider/style.scss +346 -346
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ButtonProps } from '../../../ui/Button';
|
|
2
2
|
import { ComponentPropsWithoutRef, MouseEvent } from 'react';
|
|
3
3
|
type OwnProps = {
|
|
4
|
-
onSubmit?: (e
|
|
5
|
-
onCancel?: (e
|
|
4
|
+
onSubmit?: (e?: MouseEvent<HTMLButtonElement>) => void;
|
|
5
|
+
onCancel?: (e?: MouseEvent<HTMLButtonElement>) => void;
|
|
6
6
|
submitProps?: Omit<ButtonProps<'button'>, 'children'> & {
|
|
7
7
|
text: string;
|
|
8
8
|
};
|
package/ui/Modal/BaseModal.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { FormControlsProps } from '../../ui/Form/FormControls';
|
|
3
|
+
export type ModalClasses = Partial<{
|
|
4
|
+
root: string;
|
|
5
|
+
header: string;
|
|
6
|
+
title: string;
|
|
7
|
+
close: string;
|
|
8
|
+
body: string;
|
|
9
|
+
footer: string;
|
|
10
|
+
formControls: string;
|
|
11
|
+
}>;
|
|
3
12
|
export type BaseModalProps = Omit<ComponentPropsWithoutRef<'div'>, 'title'> & Partial<Omit<FormControlsProps, 'title'>> & {
|
|
4
|
-
onClose?: (e?: MouseEvent<any>) => void;
|
|
5
|
-
classes?:
|
|
13
|
+
onClose?: (e?: MouseEvent<any> | KeyboardEvent) => void;
|
|
14
|
+
classes?: ModalClasses;
|
|
6
15
|
title?: ReactNode;
|
|
7
16
|
};
|
|
8
17
|
export declare const BaseModal: (props: BaseModalProps) => import("react/jsx-runtime").JSX.Element;
|
package/ui/Modal/BaseModal.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.BaseModal = void 0;
|
|
6
|
+
var _react = require("react");
|
|
6
7
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
7
8
|
var _FormControls = _interopRequireDefault(require("../Form/FormControls"));
|
|
8
9
|
var _ButtonIcon = _interopRequireDefault(require("../ButtonIcon"));
|
|
@@ -22,20 +23,27 @@ const BaseModal = props => {
|
|
|
22
23
|
...divProps
|
|
23
24
|
} = props;
|
|
24
25
|
const showControls = !!onSubmit || !!onCancel;
|
|
26
|
+
const titleId = (0, _react.useId)();
|
|
27
|
+
const hasTitle = !!title;
|
|
25
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
26
29
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
27
30
|
...divProps,
|
|
28
|
-
|
|
31
|
+
role: 'dialog',
|
|
32
|
+
"aria-modal": true,
|
|
33
|
+
"aria-labelledby": hasTitle ? titleId : undefined,
|
|
34
|
+
tabIndex: -1,
|
|
35
|
+
className: (0, _clsx.default)(className, 'arm-modal', classes == null ? void 0 : classes.root),
|
|
29
36
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
30
37
|
className: 'arm-modal__inner',
|
|
31
38
|
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
32
|
-
className: (0, _clsx.default)('arm-modal__header', classes == null ? void 0 : classes
|
|
39
|
+
className: (0, _clsx.default)('arm-modal__header', classes == null ? void 0 : classes.header),
|
|
33
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
34
|
-
|
|
41
|
+
id: titleId,
|
|
42
|
+
className: (0, _clsx.default)('arm-modal__title', classes == null ? void 0 : classes.title),
|
|
35
43
|
children: [title, onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonIcon.default, {
|
|
36
44
|
variant: 'transparent',
|
|
37
45
|
onClick: onClose,
|
|
38
|
-
className: (0, _clsx.default)('arm-modal__close', classes == null ? void 0 : classes
|
|
46
|
+
className: (0, _clsx.default)('arm-modal__close', classes == null ? void 0 : classes.close),
|
|
39
47
|
color: 'neutral',
|
|
40
48
|
size: 'medium',
|
|
41
49
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
@@ -44,15 +52,25 @@ const BaseModal = props => {
|
|
|
44
52
|
})
|
|
45
53
|
})]
|
|
46
54
|
})
|
|
55
|
+
}), !title && onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonIcon.default, {
|
|
56
|
+
variant: 'transparent',
|
|
57
|
+
onClick: onClose,
|
|
58
|
+
className: (0, _clsx.default)('arm-modal__close', 'arm-modal__close_noHeader', classes == null ? void 0 : classes.close),
|
|
59
|
+
color: 'neutral',
|
|
60
|
+
size: 'medium',
|
|
61
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
62
|
+
className: 'material_icon',
|
|
63
|
+
children: "close"
|
|
64
|
+
})
|
|
47
65
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
48
|
-
className: (0, _clsx.default)(_const.MODAL_BODY_CLASSNAME, classes == null ? void 0 : classes
|
|
66
|
+
className: (0, _clsx.default)(_const.MODAL_BODY_CLASSNAME, classes == null ? void 0 : classes.body),
|
|
49
67
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
50
68
|
children: children
|
|
51
69
|
})
|
|
52
70
|
}), showControls && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
53
|
-
className: (0, _clsx.default)(_const.MODAL_FOOTER_CLASSNAME, classes == null ? void 0 : classes
|
|
71
|
+
className: (0, _clsx.default)(_const.MODAL_FOOTER_CLASSNAME, classes == null ? void 0 : classes.footer),
|
|
54
72
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControls.default, {
|
|
55
|
-
className: (0, _clsx.default)(classes == null ? void 0 : classes
|
|
73
|
+
className: (0, _clsx.default)(classes == null ? void 0 : classes.formControls, 'arm-modal__controls'),
|
|
56
74
|
onSubmit: onSubmit,
|
|
57
75
|
onCancel: onCancel,
|
|
58
76
|
submitProps: submitProps,
|
package/ui/Modal/Modal.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BaseModalProps } from './BaseModal';
|
|
|
2
2
|
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
3
|
export type ModalProps = BaseModalProps & {
|
|
4
4
|
open?: boolean;
|
|
5
|
-
width?: number;
|
|
5
|
+
width?: number | 'auto';
|
|
6
6
|
transitionProps?: Partial<CSSTransitionProps<HTMLElement>>;
|
|
7
7
|
};
|
|
8
8
|
declare const Modal: (props: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
package/ui/Modal/Modal.js
CHANGED
|
@@ -10,8 +10,19 @@ var _BackDrop = _interopRequireDefault(require("../BackDrop"));
|
|
|
10
10
|
var _reactTransitionGroup = require("react-transition-group");
|
|
11
11
|
var _const = require("../Form/FormControls/const");
|
|
12
12
|
var _const2 = require("./const");
|
|
13
|
+
var _useEventCallback = _interopRequireDefault(require("../../lib/hooks/useEventCallback"));
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
const BACKDROP_CLASSNAME = 'arm-modal__backdrop';
|
|
16
|
+
function isTopmostModal(backdropContainer) {
|
|
17
|
+
let nextElement = backdropContainer.nextElementSibling;
|
|
18
|
+
while (nextElement) {
|
|
19
|
+
if (nextElement.classList.contains(BACKDROP_CLASSNAME)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
nextElement = nextElement.nextElementSibling;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
15
26
|
function replaceControlsIfExists(container, props) {
|
|
16
27
|
var _props$classes, _props$classes2;
|
|
17
28
|
if (!container) return;
|
|
@@ -22,7 +33,7 @@ function replaceControlsIfExists(container, props) {
|
|
|
22
33
|
if (controls[0].querySelector(`.${_const.FORM_CONTROLS_SKIP_REPLACE_CLASSNAME}`)) return;
|
|
23
34
|
const footer = document.createElement("div");
|
|
24
35
|
footer.classList.add(_const2.MODAL_FOOTER_CLASSNAME);
|
|
25
|
-
if ((_props$classes = props.classes) != null && _props$classes
|
|
36
|
+
if ((_props$classes = props.classes) != null && _props$classes.footer) footer.classList.add((_props$classes2 = props.classes) == null ? void 0 : _props$classes2.footer);
|
|
26
37
|
controls[0].remove();
|
|
27
38
|
footer.appendChild(controls[0]);
|
|
28
39
|
body.after(footer);
|
|
@@ -35,18 +46,25 @@ const Modal = props => {
|
|
|
35
46
|
...modalProps
|
|
36
47
|
} = props;
|
|
37
48
|
const nodeRef = (0, _react.useRef)(null);
|
|
49
|
+
const handleClose = (0, _useEventCallback.default)(event => {
|
|
50
|
+
modalProps.onClose == null || modalProps.onClose(event);
|
|
51
|
+
});
|
|
52
|
+
const focusModal = (0, _useEventCallback.default)(() => {
|
|
53
|
+
var _nodeRef$current;
|
|
54
|
+
const modalElement = (_nodeRef$current = nodeRef.current) == null ? void 0 : _nodeRef$current.querySelector('[data-testid="base-modal"]');
|
|
55
|
+
modalElement == null || modalElement.focus();
|
|
56
|
+
});
|
|
38
57
|
(0, _react.useEffect)(() => {
|
|
39
58
|
function subscribeToEsc(e) {
|
|
40
59
|
if (e.key !== 'Escape' || !nodeRef.current) return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
modalProps.onClose == null || modalProps.onClose(e);
|
|
60
|
+
if (!isTopmostModal(nodeRef.current)) return;
|
|
61
|
+
handleClose(e);
|
|
44
62
|
}
|
|
45
63
|
document.addEventListener('keyup', subscribeToEsc);
|
|
46
64
|
return () => {
|
|
47
65
|
document.removeEventListener('keyup', subscribeToEsc);
|
|
48
66
|
};
|
|
49
|
-
}, []);
|
|
67
|
+
}, [handleClose]);
|
|
50
68
|
(0, _react.useEffect)(() => {
|
|
51
69
|
replaceControlsIfExists(nodeRef.current, modalProps);
|
|
52
70
|
}, []);
|
|
@@ -54,6 +72,10 @@ const Modal = props => {
|
|
|
54
72
|
replaceControlsIfExists(nodeRef.current, modalProps);
|
|
55
73
|
transitionProps == null || transitionProps.onEntering == null || transitionProps.onEntering(isAppearing);
|
|
56
74
|
};
|
|
75
|
+
const handleEnteredDone = isAppearing => {
|
|
76
|
+
focusModal();
|
|
77
|
+
transitionProps == null || transitionProps.onEntered == null || transitionProps.onEntered(isAppearing);
|
|
78
|
+
};
|
|
57
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
58
80
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
59
81
|
classNames: {
|
|
@@ -71,6 +93,7 @@ const Modal = props => {
|
|
|
71
93
|
unmountOnExit: true,
|
|
72
94
|
...transitionProps,
|
|
73
95
|
onEntering: handleEntered,
|
|
96
|
+
onEntered: handleEnteredDone,
|
|
74
97
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BackDrop.default, {
|
|
75
98
|
width: width,
|
|
76
99
|
ref: nodeRef,
|