armtek-uikit-react 1.0.258 → 1.0.259
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 +0 -10
- package/assets/Avatar.scss +1 -7
- package/assets/BackDrop.scss +6 -18
- package/assets/Chip.scss +18 -37
- package/assets/ListItem.scss +9 -7
- package/assets/Modal.scss +10 -15
- package/assets/Paper.scss +4 -7
- package/assets/Status.scss +1 -19
- package/assets/Table.scss +0 -15
- package/assets/global.scss +0 -1
- package/assets/styles.min.css +1 -1
- package/assets/styles.min.css.map +1 -1
- package/package.json +1 -1
- package/ui/Avatar/Avatar.d.ts +0 -1
- package/ui/Avatar/Avatar.js +1 -2
- package/ui/BackDrop/BackDrop.d.ts +1 -1
- package/ui/BackDrop/BackDropBase.d.ts +2 -2
- package/ui/BackDrop/BackDropBase.js +3 -6
- package/ui/Button/Button.d.ts +1 -1
- package/ui/ButtonIcon/ButtonIcon.d.ts +1 -1
- package/ui/Chip/Chip.d.ts +3 -2
- package/ui/Chip/Chip.js +20 -2
- package/ui/Form/DateField/DateField.js +0 -4
- package/ui/Form/FormControls/FormControls.d.ts +2 -2
- package/ui/Form/FormControls/FormControls.js +1 -1
- package/ui/Form/FormControls/const.d.ts +0 -1
- package/ui/Form/FormControls/const.js +2 -3
- package/ui/Form/Period/Period.d.ts +1 -12
- package/ui/Form/Period/Period.js +4 -16
- package/ui/Form/Select/Select.d.ts +2 -2
- package/ui/Form/Select/Select.js +4 -8
- package/ui/Form/Select/SelectSummary.d.ts +3 -3
- package/ui/Form/TimeField/TimeField.d.ts +1 -1
- package/ui/Modal/BaseModal.d.ts +2 -11
- package/ui/Modal/BaseModal.js +7 -25
- package/ui/Modal/Modal.d.ts +1 -1
- package/ui/Modal/Modal.js +5 -29
- package/ui/Table/Table.js +1 -4
|
@@ -13,7 +13,6 @@ const BackDropBase = exports.BackDropBase = (0, _helpers.fixedForwardRef)((props
|
|
|
13
13
|
className,
|
|
14
14
|
onClick
|
|
15
15
|
} = props;
|
|
16
|
-
const isAutoWidth = width === 'auto';
|
|
17
16
|
const handleClick = e => {
|
|
18
17
|
e.stopPropagation();
|
|
19
18
|
if (onClick) onClick(e);
|
|
@@ -26,12 +25,10 @@ const BackDropBase = exports.BackDropBase = (0, _helpers.fixedForwardRef)((props
|
|
|
26
25
|
className: 'arm-backdrop__overlay',
|
|
27
26
|
onClick: handleClick
|
|
28
27
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
29
|
-
className:
|
|
30
|
-
|
|
31
|
-
}),
|
|
32
|
-
style: !isAutoWidth ? {
|
|
28
|
+
className: 'arm-backdrop__inner',
|
|
29
|
+
style: {
|
|
33
30
|
maxWidth: width + 'px'
|
|
34
|
-
}
|
|
31
|
+
},
|
|
35
32
|
children: children
|
|
36
33
|
})]
|
|
37
34
|
})
|
package/ui/Button/Button.d.ts
CHANGED
|
@@ -35,5 +35,5 @@ declare const _default: <T extends ElementType = "button">(props: {
|
|
|
35
35
|
as?: T | undefined;
|
|
36
36
|
} & {
|
|
37
37
|
[dataAttibute: `data-${string}`]: string;
|
|
38
|
-
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<T>>, "color" | "
|
|
38
|
+
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<T>>, `data-${string}` | "color" | "group" | "size" | "variant" | "startAdornment" | "endAdornment" | "radius" | "asIcon" | "theme" | "fullWidth" | "disablestyles" | "disabled" | "as"> & import("react").RefAttributes<any>) => JSX.Element;
|
|
39
39
|
export default _default;
|
|
@@ -21,5 +21,5 @@ declare const _default: <T extends ElementType = "button">(props: ButtonIconProp
|
|
|
21
21
|
as?: T | undefined;
|
|
22
22
|
} & {
|
|
23
23
|
[dataAttibute: `data-${string}`]: string;
|
|
24
|
-
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<T>>, "color" | "
|
|
24
|
+
} & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<T>>, `data-${string}` | "color" | "group" | "size" | "variant" | "startAdornment" | "endAdornment" | "radius" | "asIcon" | "theme" | "fullWidth" | "disablestyles" | "disabled" | "as"> & import("react").RefAttributes<T>) => JSX.Element;
|
|
25
25
|
export default _default;
|
package/ui/Chip/Chip.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ElementType, MouseEvent, HTMLAttributes } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ElementType, MouseEvent, HTMLAttributes, KeyboardEvent } from 'react';
|
|
2
2
|
import { ColorStatusType, ColorThemeType, ColorType, SizeType, VariantType, ShapeType } from '../../types/theme';
|
|
3
3
|
type OwnProps<T extends ElementType = ElementType<HTMLAttributes<HTMLSpanElement>>> = Omit<ComponentPropsWithoutRef<T>, 'color'> & {
|
|
4
4
|
size?: Exclude<SizeType, 'large' | 'extraLarge'>;
|
|
5
5
|
color?: ColorType | ColorThemeType | ColorStatusType;
|
|
6
6
|
text?: string;
|
|
7
|
-
onClose?: (e: MouseEvent) => void;
|
|
7
|
+
onClose?: (e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
|
|
8
|
+
closeAriaLabel?: string;
|
|
8
9
|
icon?: string;
|
|
9
10
|
variant?: Exclude<VariantType, 'transparent'>;
|
|
10
11
|
shape?: ShapeType;
|
package/ui/Chip/Chip.js
CHANGED
|
@@ -11,6 +11,7 @@ function Chip(props) {
|
|
|
11
11
|
text,
|
|
12
12
|
icon,
|
|
13
13
|
onClose,
|
|
14
|
+
closeAriaLabel,
|
|
14
15
|
shape = 'circle',
|
|
15
16
|
as,
|
|
16
17
|
variant = 'contained',
|
|
@@ -21,9 +22,15 @@ function Chip(props) {
|
|
|
21
22
|
...restProps
|
|
22
23
|
} = props;
|
|
23
24
|
let Component = as || 'span';
|
|
25
|
+
let isComponentButton = Component === 'button';
|
|
24
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
25
27
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
26
28
|
...restProps,
|
|
29
|
+
...(isComponentButton ? {
|
|
30
|
+
disabled
|
|
31
|
+
} : {}),
|
|
32
|
+
"aria-disabled": disabled ? true : undefined,
|
|
33
|
+
tabIndex: disabled && !isComponentButton ? -1 : restProps.tabIndex,
|
|
27
34
|
className: (0, _clsx.default)('arm-chip', className, {
|
|
28
35
|
'arm-chip_disabled': !!disabled,
|
|
29
36
|
['arm-chip_' + size]: !!size
|
|
@@ -36,13 +43,24 @@ function Chip(props) {
|
|
|
36
43
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
37
44
|
className: 'arm-chip__text',
|
|
38
45
|
children: text || children
|
|
39
|
-
}), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)("
|
|
46
|
+
}), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
47
|
+
type: 'button',
|
|
48
|
+
"aria-label": closeAriaLabel,
|
|
49
|
+
disabled: !!disabled,
|
|
40
50
|
className: (0, _clsx.default)('material_icon_solid', {
|
|
41
51
|
'arm-chip__close_disabled': !!disabled
|
|
42
52
|
}, ['arm-chip__close_' + size], ['arm-chip__close_' + color], 'arm-chip__close'),
|
|
43
|
-
onClick:
|
|
53
|
+
onClick: e => {
|
|
54
|
+
if (disabled) return;
|
|
55
|
+
onClose(e);
|
|
56
|
+
},
|
|
57
|
+
onKeyDown: e => {
|
|
58
|
+
if (disabled) return;
|
|
59
|
+
if (e.key === 'Enter' || e.key === ' ') onClose(e);
|
|
60
|
+
},
|
|
44
61
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
45
62
|
className: 'mis',
|
|
63
|
+
"aria-hidden": true,
|
|
46
64
|
children: "cancel"
|
|
47
65
|
})
|
|
48
66
|
})]
|
|
@@ -31,10 +31,6 @@ const dateToText = (d, format) => {
|
|
|
31
31
|
if (typeof d === 'string') d = new Date(d);
|
|
32
32
|
return d.toLocaleString('ru-RU', getDateFormat(format));
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
/*
|
|
36
|
-
TODO: Не отрабатывает ...register из react-hook-form при предзаполненном поле
|
|
37
|
-
*/
|
|
38
34
|
const DateField = exports.DateField = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
39
35
|
let {
|
|
40
36
|
onChange,
|
|
@@ -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
|
};
|
|
@@ -18,7 +18,7 @@ const FormControls = props => {
|
|
|
18
18
|
...divProps
|
|
19
19
|
} = props;
|
|
20
20
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21
|
-
className:
|
|
21
|
+
className: _const.FORM_CONTROLS_CLASSNAME,
|
|
22
22
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
23
23
|
...divProps,
|
|
24
24
|
className: (0, _clsx.default)(className, 'arm-form-controls__stack'),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
5
|
-
const FORM_CONTROLS_CLASSNAME = exports.FORM_CONTROLS_CLASSNAME = 'arm-form-controls';
|
|
6
|
-
const FORM_CONTROLS_SKIP_REPLACE_CLASSNAME = exports.FORM_CONTROLS_SKIP_REPLACE_CLASSNAME = '_skip_replace';
|
|
4
|
+
exports.FORM_CONTROLS_CLASSNAME = void 0;
|
|
5
|
+
const FORM_CONTROLS_CLASSNAME = exports.FORM_CONTROLS_CLASSNAME = 'arm-form-controls';
|
|
@@ -6,17 +6,6 @@ export type PeriodChangeEvent = (Event & {
|
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
8
|
});
|
|
9
|
-
export type PeriodProps = {
|
|
10
|
-
onChange?: (e: PeriodChangeEvent) => void;
|
|
11
|
-
value?: [Date | null, Date | null];
|
|
12
|
-
defaultValue?: [Date | null, Date | null];
|
|
13
|
-
disableSameDate?: boolean;
|
|
14
|
-
minDate?: Date | null;
|
|
15
|
-
maxDate?: Date | null;
|
|
16
|
-
showMonthDropdown?: boolean;
|
|
17
|
-
showYearDropdown?: boolean;
|
|
18
|
-
datePickerProps?: DatePickerProps;
|
|
19
|
-
} & Omit<TextFieldProps, 'value' | 'onChange' | 'defaultValue'>;
|
|
20
9
|
export declare function getPeriodDisplay(date1: Date | null | undefined, date2: Date | null | undefined): string;
|
|
21
10
|
declare const Period: import("react").ForwardRefExoticComponent<{
|
|
22
11
|
onChange?: (e: PeriodChangeEvent) => void;
|
|
@@ -28,5 +17,5 @@ declare const Period: import("react").ForwardRefExoticComponent<{
|
|
|
28
17
|
showMonthDropdown?: boolean;
|
|
29
18
|
showYearDropdown?: boolean;
|
|
30
19
|
datePickerProps?: DatePickerProps;
|
|
31
|
-
} & Omit<TextFieldProps, "
|
|
20
|
+
} & Omit<TextFieldProps, "defaultValue" | "onChange" | "value"> & import("react").RefAttributes<unknown>>;
|
|
32
21
|
export default Period;
|
package/ui/Form/Period/Period.js
CHANGED
|
@@ -114,22 +114,9 @@ const Period = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
if (startDateValid && endDateValid
|
|
117
|
+
if (startDateValid && endDateValid) {
|
|
118
118
|
handleSelect([startDateValid, endDateValid]);
|
|
119
|
-
}
|
|
120
|
-
// else
|
|
121
|
-
// {
|
|
122
|
-
// handleSelect([null, null])
|
|
123
|
-
// }
|
|
124
|
-
};
|
|
125
|
-
const handleBlur = e => {
|
|
126
|
-
setActive(false);
|
|
127
|
-
const value = e.target.value;
|
|
128
|
-
const valueParts = value.split(DELIMITER);
|
|
129
|
-
const startDateValid = valueParts[0] ? validateDate(valueParts[0], minDate, maxDate) : null;
|
|
130
|
-
const endDateValid = valueParts[1] ? validateDate(valueParts[1], minDate, maxDate) : null;
|
|
131
|
-
if (!startDateValid || !endDateValid || startDateValid && endDateValid && endDateValid.getTime() < startDateValid.getTime()) {
|
|
132
|
-
setTextValue('');
|
|
119
|
+
} else {
|
|
133
120
|
handleSelect([null, null]);
|
|
134
121
|
}
|
|
135
122
|
};
|
|
@@ -160,8 +147,9 @@ const Period = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
160
147
|
placeholder: 'дд.мм.гггг - дд.мм.гггг',
|
|
161
148
|
...restProps,
|
|
162
149
|
disabled: disabled,
|
|
150
|
+
id: 'period',
|
|
163
151
|
value: textValue,
|
|
164
|
-
onBlur:
|
|
152
|
+
onBlur: () => setActive(false),
|
|
165
153
|
onChange: handleChange,
|
|
166
154
|
onFocus: () => setActive(false),
|
|
167
155
|
autoComplete: 'off',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextFieldProps } from '../TextField/TextField';
|
|
2
|
-
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { MouseEvent, KeyboardEvent, ReactNode } from 'react';
|
|
3
3
|
export type OptionType = {
|
|
4
4
|
text: string;
|
|
5
5
|
value: string;
|
|
@@ -42,7 +42,7 @@ export type SelectOptionsType<T extends boolean> = {
|
|
|
42
42
|
value?: T extends true ? string[] : string;
|
|
43
43
|
inline?: boolean;
|
|
44
44
|
multiple?: T;
|
|
45
|
-
onClick: (e: MouseEvent
|
|
45
|
+
onClick: (e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>, option: OptionType) => void;
|
|
46
46
|
listStyle?: 'checkbox' | 'default';
|
|
47
47
|
onSelectAll?: (e: MouseEvent) => void;
|
|
48
48
|
onClear?: (e: MouseEvent) => void;
|
package/ui/Form/Select/Select.js
CHANGED
|
@@ -59,19 +59,12 @@ function Select(props, ref) {
|
|
|
59
59
|
return inputRef.current;
|
|
60
60
|
}, []);
|
|
61
61
|
const handleOpen = () => {
|
|
62
|
-
if (open !== undefined) return;
|
|
63
62
|
if (!inputProps.disabled) {
|
|
64
63
|
setActive(true);
|
|
65
64
|
// if( e.target instanceof HTMLDivElement )
|
|
66
65
|
// setAnchorEl(e.currentTarget)
|
|
67
66
|
}
|
|
68
67
|
};
|
|
69
|
-
function handleClose() {
|
|
70
|
-
if (onClose) onClose();else {
|
|
71
|
-
if (open !== undefined) return;
|
|
72
|
-
setActive(false);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
68
|
const handleSelect = (e, option) => {
|
|
76
69
|
if (e.target.classList.contains(_const.CHECKBOX_LABEL_CLASSNAME)) {
|
|
77
70
|
e.stopPropagation();
|
|
@@ -97,7 +90,7 @@ function Select(props, ref) {
|
|
|
97
90
|
if (search && !multiple) {
|
|
98
91
|
setQ(options.find(item => getOptionValue(item) === newValueS).text);
|
|
99
92
|
}
|
|
100
|
-
if (!multiple)
|
|
93
|
+
if (!multiple) setActive(false);
|
|
101
94
|
};
|
|
102
95
|
const handleSearch = e => {
|
|
103
96
|
setQ(e.target.value);
|
|
@@ -155,6 +148,9 @@ function Select(props, ref) {
|
|
|
155
148
|
if (!!search) options = options.filter(item => item.text.toLowerCase().includes(q.toLowerCase()));
|
|
156
149
|
let valueArr = realValue ? Array.isArray(realValue) ? realValue : [realValue] : [];
|
|
157
150
|
let selectedOptions = options.filter(item => valueArr.includes(getOptionValue(item)));
|
|
151
|
+
function handleClose() {
|
|
152
|
+
if (onClose) onClose();else setActive(false);
|
|
153
|
+
}
|
|
158
154
|
let displayClear = clear && (multiple ? realValue && realValue.length > 0 : !!realValue);
|
|
159
155
|
let selectEndAdornment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
160
156
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Adornment.default, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MouseEvent } from 'react';
|
|
1
|
+
import { MouseEvent, KeyboardEvent } from 'react';
|
|
2
2
|
import { OptionType } from '../../../ui/Form/Select/Select';
|
|
3
3
|
export type SelectSummaryProps = {
|
|
4
|
-
onClose: (e: MouseEvent
|
|
4
|
+
onClose: (e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>, option: OptionType) => void;
|
|
5
5
|
options: OptionType[];
|
|
6
6
|
value: string[];
|
|
7
7
|
} & Omit<SelectSummaryControlsProps, 'countSelected' | 'countTotal'>;
|
|
@@ -9,7 +9,7 @@ export declare const SelectSummary: (props: SelectSummaryProps) => import("react
|
|
|
9
9
|
type SelectSummaryChipsProps = {
|
|
10
10
|
options: OptionType[];
|
|
11
11
|
disabled?: boolean;
|
|
12
|
-
onDelete: (e: MouseEvent
|
|
12
|
+
onDelete: (e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>, option: OptionType) => void;
|
|
13
13
|
};
|
|
14
14
|
export declare const SelectSummaryChips: (props: SelectSummaryChipsProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
type SelectSummaryControlsProps = {
|
|
@@ -9,10 +9,10 @@ declare const TimeField: import("react").ForwardRefExoticComponent<{
|
|
|
9
9
|
showMonthYearPicker?: boolean;
|
|
10
10
|
showYearPicker?: boolean;
|
|
11
11
|
} & {
|
|
12
|
+
error?: boolean | undefined;
|
|
12
13
|
label?: string | undefined;
|
|
13
14
|
className?: string | undefined | undefined;
|
|
14
15
|
placeholder?: string | undefined | undefined;
|
|
15
|
-
error?: boolean | undefined;
|
|
16
16
|
helperText?: import("react").ReactNode;
|
|
17
17
|
} & Omit<import("react-datepicker").DatePickerProps, keyof {
|
|
18
18
|
onClick?: (e: import("react").MouseEvent) => void;
|
package/ui/Modal/BaseModal.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
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
|
-
}>;
|
|
12
3
|
export type BaseModalProps = Omit<ComponentPropsWithoutRef<'div'>, 'title'> & Partial<Omit<FormControlsProps, 'title'>> & {
|
|
13
|
-
onClose?: (e?: MouseEvent<any>
|
|
14
|
-
classes?:
|
|
4
|
+
onClose?: (e?: MouseEvent<any>) => void;
|
|
5
|
+
classes?: Record<string, string>;
|
|
15
6
|
title?: ReactNode;
|
|
16
7
|
};
|
|
17
8
|
export declare const BaseModal: (props: BaseModalProps) => import("react/jsx-runtime").JSX.Element;
|
package/ui/Modal/BaseModal.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
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");
|
|
7
6
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
8
7
|
var _FormControls = _interopRequireDefault(require("../Form/FormControls"));
|
|
9
8
|
var _ButtonIcon = _interopRequireDefault(require("../ButtonIcon"));
|
|
@@ -23,27 +22,20 @@ const BaseModal = props => {
|
|
|
23
22
|
...divProps
|
|
24
23
|
} = props;
|
|
25
24
|
const showControls = !!onSubmit || !!onCancel;
|
|
26
|
-
const titleId = (0, _react.useId)();
|
|
27
|
-
const hasTitle = !!title;
|
|
28
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
29
26
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
30
27
|
...divProps,
|
|
31
|
-
|
|
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),
|
|
28
|
+
className: (0, _clsx.default)(className, 'arm-modal', classes == null ? void 0 : classes['Arm-Modal']),
|
|
36
29
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
37
30
|
className: 'arm-modal__inner',
|
|
38
31
|
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
39
|
-
className: (0, _clsx.default)('arm-modal__header', classes == null ? void 0 : classes
|
|
32
|
+
className: (0, _clsx.default)('arm-modal__header', classes == null ? void 0 : classes['Arm-Modal__header']),
|
|
40
33
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
41
|
-
|
|
42
|
-
className: (0, _clsx.default)('arm-modal__title', classes == null ? void 0 : classes.title),
|
|
34
|
+
className: (0, _clsx.default)('arm-modal__title', classes == null ? void 0 : classes['Arm-Modal__title']),
|
|
43
35
|
children: [title, onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonIcon.default, {
|
|
44
36
|
variant: 'transparent',
|
|
45
37
|
onClick: onClose,
|
|
46
|
-
className: (0, _clsx.default)('arm-modal__close', classes == null ? void 0 : classes
|
|
38
|
+
className: (0, _clsx.default)('arm-modal__close', classes == null ? void 0 : classes['Arm-Modal__close']),
|
|
47
39
|
color: 'neutral',
|
|
48
40
|
size: 'medium',
|
|
49
41
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
@@ -52,25 +44,15 @@ const BaseModal = props => {
|
|
|
52
44
|
})
|
|
53
45
|
})]
|
|
54
46
|
})
|
|
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
|
-
})
|
|
65
47
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
66
|
-
className: (0, _clsx.default)(_const.MODAL_BODY_CLASSNAME, classes == null ? void 0 : classes
|
|
48
|
+
className: (0, _clsx.default)(_const.MODAL_BODY_CLASSNAME, classes == null ? void 0 : classes['Arm-Modal__body']),
|
|
67
49
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
68
50
|
children: children
|
|
69
51
|
})
|
|
70
52
|
}), showControls && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
71
|
-
className: (0, _clsx.default)(_const.MODAL_FOOTER_CLASSNAME, classes == null ? void 0 : classes
|
|
53
|
+
className: (0, _clsx.default)(_const.MODAL_FOOTER_CLASSNAME, classes == null ? void 0 : classes['Arm-Modal__footer']),
|
|
72
54
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControls.default, {
|
|
73
|
-
className: (0, _clsx.default)(classes == null ? void 0 : classes
|
|
55
|
+
className: (0, _clsx.default)(classes == null ? void 0 : classes['Arm-FormControls'], 'arm-modal__controls'),
|
|
74
56
|
onSubmit: onSubmit,
|
|
75
57
|
onCancel: onCancel,
|
|
76
58
|
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;
|
|
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,19 +10,8 @@ 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"));
|
|
14
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
14
|
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
|
-
}
|
|
26
15
|
function replaceControlsIfExists(container, props) {
|
|
27
16
|
var _props$classes, _props$classes2;
|
|
28
17
|
if (!container) return;
|
|
@@ -30,10 +19,9 @@ function replaceControlsIfExists(container, props) {
|
|
|
30
19
|
if (!body) return;
|
|
31
20
|
const controls = body.querySelectorAll(`.${_const.FORM_CONTROLS_CLASSNAME}`);
|
|
32
21
|
if (controls.length !== 1) return;
|
|
33
|
-
if (controls[0].querySelector(`.${_const.FORM_CONTROLS_SKIP_REPLACE_CLASSNAME}`)) return;
|
|
34
22
|
const footer = document.createElement("div");
|
|
35
23
|
footer.classList.add(_const2.MODAL_FOOTER_CLASSNAME);
|
|
36
|
-
if ((_props$classes = props.classes) != null && _props$classes
|
|
24
|
+
if ((_props$classes = props.classes) != null && _props$classes['Arm-Modal__footer']) footer.classList.add((_props$classes2 = props.classes) == null ? void 0 : _props$classes2['Arm-Modal__footer']);
|
|
37
25
|
controls[0].remove();
|
|
38
26
|
footer.appendChild(controls[0]);
|
|
39
27
|
body.after(footer);
|
|
@@ -46,25 +34,18 @@ const Modal = props => {
|
|
|
46
34
|
...modalProps
|
|
47
35
|
} = props;
|
|
48
36
|
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
|
-
});
|
|
57
37
|
(0, _react.useEffect)(() => {
|
|
58
38
|
function subscribeToEsc(e) {
|
|
59
39
|
if (e.key !== 'Escape' || !nodeRef.current) return;
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
const nextElement = nodeRef.current.nextElementSibling;
|
|
41
|
+
if (nextElement && nextElement.classList.contains(BACKDROP_CLASSNAME)) return;
|
|
42
|
+
modalProps.onClose == null || modalProps.onClose(e);
|
|
62
43
|
}
|
|
63
44
|
document.addEventListener('keyup', subscribeToEsc);
|
|
64
45
|
return () => {
|
|
65
46
|
document.removeEventListener('keyup', subscribeToEsc);
|
|
66
47
|
};
|
|
67
|
-
}, [
|
|
48
|
+
}, []);
|
|
68
49
|
(0, _react.useEffect)(() => {
|
|
69
50
|
replaceControlsIfExists(nodeRef.current, modalProps);
|
|
70
51
|
}, []);
|
|
@@ -72,10 +53,6 @@ const Modal = props => {
|
|
|
72
53
|
replaceControlsIfExists(nodeRef.current, modalProps);
|
|
73
54
|
transitionProps == null || transitionProps.onEntering == null || transitionProps.onEntering(isAppearing);
|
|
74
55
|
};
|
|
75
|
-
const handleEnteredDone = isAppearing => {
|
|
76
|
-
focusModal();
|
|
77
|
-
transitionProps == null || transitionProps.onEntered == null || transitionProps.onEntered(isAppearing);
|
|
78
|
-
};
|
|
79
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
80
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
|
|
81
58
|
classNames: {
|
|
@@ -93,7 +70,6 @@ const Modal = props => {
|
|
|
93
70
|
unmountOnExit: true,
|
|
94
71
|
...transitionProps,
|
|
95
72
|
onEntering: handleEntered,
|
|
96
|
-
onEntered: handleEnteredDone,
|
|
97
73
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BackDrop.default, {
|
|
98
74
|
width: width,
|
|
99
75
|
ref: nodeRef,
|
package/ui/Table/Table.js
CHANGED
|
@@ -20,9 +20,6 @@ function TableInit(props, ref) {
|
|
|
20
20
|
getRow,
|
|
21
21
|
...tableProps
|
|
22
22
|
} = props;
|
|
23
|
-
const handleRowClick = row => {
|
|
24
|
-
return onClick ? e => onClick(row, e) : undefined;
|
|
25
|
-
};
|
|
26
23
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
27
24
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TableBase.TableBase, {
|
|
28
25
|
...tableProps,
|
|
@@ -45,7 +42,7 @@ function TableInit(props, ref) {
|
|
|
45
42
|
children: getRow(row, index)
|
|
46
43
|
}, index) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TableRow.TableRow, {
|
|
47
44
|
className: rowClass,
|
|
48
|
-
onClick:
|
|
45
|
+
onClick: e => onClick ? onClick(row, e) : null,
|
|
49
46
|
children: structure.map((item, itemIndex) => {
|
|
50
47
|
let cellClass = !!(classes != null && classes.tableCell) ? typeof classes.tableCell === 'string' ? classes.tableCell : classes.tableCell(row, item.code) : '';
|
|
51
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TableCell.TableCell, {
|