armtek-uikit-react 1.0.138 → 1.0.139
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/package.json +1 -1
- package/types/theme.d.ts +1 -1
- package/ui/Chip/Chip.d.ts +2 -2
- package/ui/Chip/Chip.js +3 -1
- package/ui/Form/Select/Select.d.ts +2 -2
- package/ui/Form/Select/Select.js +30 -8
- package/ui/Form/Select/SelectSummary.d.ts +3 -3
- package/ui/Popover/Popover.d.ts +1 -1
- package/ui/Popover/Popover.js +6 -6
- package/ui/Popper/PopperBase.d.ts +1 -0
- package/ui/Popper/PopperBase.js +2 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.139","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
package/types/theme.d.ts
CHANGED
package/ui/Chip/Chip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ElementType, MouseEvent, HTMLAttributes } 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;
|
|
@@ -10,7 +10,7 @@ export type ChipProps<T extends ElementType = ElementType<HTMLAttributes<HTMLSpa
|
|
|
10
10
|
shape?: ShapeType;
|
|
11
11
|
as?: T;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
-
className?: string;
|
|
14
13
|
};
|
|
14
|
+
export type ChipProps<T extends ElementType = 'span'> = OwnProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof OwnProps<T>>;
|
|
15
15
|
declare function Chip<T extends ElementType>(props: ChipProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export default Chip;
|
package/ui/Chip/Chip.js
CHANGED
|
@@ -14,11 +14,13 @@ function Chip(props) {
|
|
|
14
14
|
color,
|
|
15
15
|
className,
|
|
16
16
|
children,
|
|
17
|
-
disabled
|
|
17
|
+
disabled,
|
|
18
|
+
...restProps
|
|
18
19
|
} = props;
|
|
19
20
|
let Component = as || 'span';
|
|
20
21
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
21
22
|
children: /*#__PURE__*/_jsx(Component, {
|
|
23
|
+
...restProps,
|
|
22
24
|
className: clsx('arm-chip', className, {
|
|
23
25
|
'arm-chip_disabled': !!disabled
|
|
24
26
|
}, ['arm-chip_' + size], ['arm-chip_' + variant], ['arm-chip_' + color], ['arm-chip_' + shape]),
|
|
@@ -35,8 +35,8 @@ type SelectOptionsType<T extends boolean> = {
|
|
|
35
35
|
multiple?: T;
|
|
36
36
|
onClick: (e: MouseEvent, option: OptionType) => void;
|
|
37
37
|
listStyle?: 'checkbox' | 'default';
|
|
38
|
-
onSelectAll?: () => void;
|
|
39
|
-
onClearAll?: () => void;
|
|
38
|
+
onSelectAll?: (e: MouseEvent) => void;
|
|
39
|
+
onClearAll?: (e: MouseEvent) => void;
|
|
40
40
|
onSubmit?: () => void;
|
|
41
41
|
disabled?: boolean;
|
|
42
42
|
};
|
package/ui/Form/Select/Select.js
CHANGED
|
@@ -8,7 +8,7 @@ import useClickOutside from "../../../lib/hooks/useClickOutside";
|
|
|
8
8
|
import ButtonIcon from "../../ButtonIcon";
|
|
9
9
|
import Adornment from "../../Adornment";
|
|
10
10
|
import { SelectSummary, SelectSummaryChips } from "./SelectSummary";
|
|
11
|
-
import Popover from "../../Popover";
|
|
11
|
+
import Popover from "../../Popover/Popover";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -52,8 +52,10 @@ function Select(props) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
const handleSelect = (e, option) => {
|
|
55
|
+
if (option.disabled || props.disabled) return;
|
|
55
56
|
let v = getOptionValue(option);
|
|
56
|
-
|
|
57
|
+
const realSelected = value !== undefined ? value : selected;
|
|
58
|
+
let mSelected = Array.isArray(realSelected) ? realSelected : [realSelected];
|
|
57
59
|
let newValueS = v;
|
|
58
60
|
let newValueM = mSelected.includes(v) ? mSelected.filter(item => item !== v) : mSelected.concat(v);
|
|
59
61
|
setSelected(multiple ? newValueM : newValueS);
|
|
@@ -94,14 +96,34 @@ function Select(props) {
|
|
|
94
96
|
})
|
|
95
97
|
})]
|
|
96
98
|
});
|
|
97
|
-
const handleSelectAll =
|
|
98
|
-
|
|
99
|
+
const handleSelectAll = e => {
|
|
100
|
+
if (props.disabled) return;
|
|
101
|
+
let value = options.filter(item => !item.disabled).map(item => getOptionValue(item));
|
|
99
102
|
setSelected(value);
|
|
100
|
-
if (onChange)
|
|
103
|
+
if (onChange) {
|
|
104
|
+
Object.defineProperty(e, 'target', {
|
|
105
|
+
writable: false,
|
|
106
|
+
value: {
|
|
107
|
+
name: props.name,
|
|
108
|
+
value
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
onChange(e);
|
|
112
|
+
}
|
|
101
113
|
};
|
|
102
|
-
const handleResetAll =
|
|
114
|
+
const handleResetAll = e => {
|
|
115
|
+
if (props.disabled) return;
|
|
103
116
|
setSelected([]);
|
|
104
|
-
if (onChange)
|
|
117
|
+
if (onChange) {
|
|
118
|
+
Object.defineProperty(e, 'target', {
|
|
119
|
+
writable: false,
|
|
120
|
+
value: {
|
|
121
|
+
name: props.name,
|
|
122
|
+
value: []
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
onChange(e);
|
|
126
|
+
}
|
|
105
127
|
};
|
|
106
128
|
const handleSubmit = () => {
|
|
107
129
|
if (open === undefined) setActive(false);else if (onSubmit) {
|
|
@@ -206,7 +228,7 @@ const SelectOptions = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
206
228
|
let active = multiple === true && value ? value.includes(optValue) : optValue === value;
|
|
207
229
|
let checked = listStyle === 'checkbox' && !!multiple ? active : undefined;
|
|
208
230
|
return /*#__PURE__*/_jsx(ListItem, {
|
|
209
|
-
disabled: disabled,
|
|
231
|
+
disabled: disabled || !!item.disabled,
|
|
210
232
|
checked: checked,
|
|
211
233
|
active: active,
|
|
212
234
|
onClick: e => onClick(e, item),
|
|
@@ -5,9 +5,9 @@ export type SelectSummaryProps = {
|
|
|
5
5
|
label_uncheck_all?: string;
|
|
6
6
|
label_submit?: string;
|
|
7
7
|
onClose: (e: MouseEvent, option: OptionType) => void;
|
|
8
|
-
onSelectAll?: () => void;
|
|
9
|
-
onClearAll?: () => void;
|
|
10
|
-
onSubmit?: () => void;
|
|
8
|
+
onSelectAll?: (e: MouseEvent) => void;
|
|
9
|
+
onClearAll?: (e: MouseEvent) => void;
|
|
10
|
+
onSubmit?: (e: MouseEvent) => void;
|
|
11
11
|
options: OptionType[];
|
|
12
12
|
value: string[];
|
|
13
13
|
disabled?: boolean;
|
package/ui/Popover/Popover.d.ts
CHANGED
package/ui/Popover/Popover.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BackDrop from "../BackDrop";
|
|
2
|
-
import { PopperBase } from "../Popper";
|
|
2
|
+
import { PopperBase } from "../Popper/PopperBase";
|
|
3
3
|
import Paper from "../Paper";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -9,19 +9,19 @@ export const Popover = props => {
|
|
|
9
9
|
matchWidth = false,
|
|
10
10
|
children,
|
|
11
11
|
classes,
|
|
12
|
-
...
|
|
12
|
+
...popperProps
|
|
13
13
|
} = props;
|
|
14
|
-
if (!props.open || !
|
|
14
|
+
if (!props.open || !popperProps.anchorEl) return null;
|
|
15
15
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
16
16
|
children: /*#__PURE__*/_jsx(BackDrop, {
|
|
17
17
|
onClick: onClose,
|
|
18
18
|
children: /*#__PURE__*/_jsx(PopperBase, {
|
|
19
|
-
...
|
|
20
|
-
anchorEl:
|
|
19
|
+
...popperProps,
|
|
20
|
+
anchorEl: popperProps.anchorEl,
|
|
21
21
|
children: /*#__PURE__*/_jsx(Paper, {
|
|
22
22
|
className: classes == null ? void 0 : classes.paper,
|
|
23
23
|
style: matchWidth ? {
|
|
24
|
-
width:
|
|
24
|
+
width: popperProps.anchorEl.clientWidth
|
|
25
25
|
} : undefined,
|
|
26
26
|
children: children
|
|
27
27
|
})
|
|
@@ -11,3 +11,4 @@ export type PopperBaseProps = {
|
|
|
11
11
|
placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
12
12
|
};
|
|
13
13
|
export declare const PopperBase: (props: PopperBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default PopperBase;
|
package/ui/Popper/PopperBase.js
CHANGED