armtek-uikit-react 1.0.104 → 1.0.106
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/Checkbox.scss
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.106","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"}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { ColorType, SizeType, ThemeType, VariantType } from '../../../types/theme';
|
|
3
|
-
type
|
|
3
|
+
type BaseCheckboxProps = {
|
|
4
4
|
label?: string | ReactNode;
|
|
5
5
|
size?: Exclude<SizeType, 'extraLarge'>;
|
|
6
6
|
color?: ColorType;
|
|
@@ -8,6 +8,6 @@ type BaseCheckboxPropsType = {
|
|
|
8
8
|
variant?: Exclude<VariantType, 'transparent'>;
|
|
9
9
|
intermediate?: boolean;
|
|
10
10
|
};
|
|
11
|
-
export type
|
|
12
|
-
declare const Checkbox: (props:
|
|
11
|
+
export type CheckboxProps = BaseCheckboxProps & Omit<InputHTMLAttributes<any>, 'size'>;
|
|
12
|
+
declare const Checkbox: (props: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default Checkbox;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import clsx from 'clsx';
|
|
4
3
|
import { useState } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
import css from "./Checkbox.module.scss";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -22,34 +22,31 @@ const Checkbox = props => {
|
|
|
22
22
|
...inputProps
|
|
23
23
|
} = props;
|
|
24
24
|
let [checked, setChecked] = useState(!!props.defaultChecked);
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
if (onChange) onChange(e);
|
|
29
|
-
}
|
|
25
|
+
const handleChange = e => {
|
|
26
|
+
if (inputProps.checked === undefined) setChecked(prev => !prev);
|
|
27
|
+
if (onChange) onChange(e);
|
|
30
28
|
};
|
|
31
29
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
32
|
-
children: /*#__PURE__*/
|
|
30
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
33
31
|
className: clsx(css.checkbox, className),
|
|
34
|
-
children:
|
|
35
|
-
...inputProps,
|
|
36
|
-
className: clsx(css.checkbox__input, {
|
|
37
|
-
'_checked': !!inputProps.checked
|
|
38
|
-
}),
|
|
39
|
-
onChange: onChange,
|
|
40
|
-
type: props.type || 'checkbox'
|
|
41
|
-
}), /*#__PURE__*/_jsx("label", {
|
|
42
|
-
onClick: handleClick,
|
|
32
|
+
children: /*#__PURE__*/_jsxs("label", {
|
|
43
33
|
className: clsx(css.checkbox__label, css['checkbox_' + size], css['checkbox_' + variant], css['checkbox_' + color], {
|
|
44
34
|
[css.checkbox__label_checked]: inputProps.checked !== undefined ? inputProps.checked : checked,
|
|
45
35
|
[css.checkbox__label_intermediate]: !!intermediate,
|
|
46
36
|
[css.checkbox__label_disabled]: !!inputProps.disabled
|
|
47
37
|
}),
|
|
48
|
-
children:
|
|
38
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
39
|
+
...inputProps,
|
|
40
|
+
className: clsx(css.checkbox__input, {
|
|
41
|
+
'_checked': !!inputProps.checked
|
|
42
|
+
}),
|
|
43
|
+
onChange: handleChange,
|
|
44
|
+
type: props.type || 'checkbox'
|
|
45
|
+
}), label && /*#__PURE__*/_jsx("span", {
|
|
49
46
|
className: css.checkbox__text,
|
|
50
47
|
children: label
|
|
51
|
-
})
|
|
52
|
-
})
|
|
48
|
+
})]
|
|
49
|
+
})
|
|
53
50
|
})
|
|
54
51
|
});
|
|
55
52
|
};
|
package/ui/Form/Radio/Radio.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Radio: (props:
|
|
1
|
+
import { CheckboxProps } from '../Checkbox/Checkbox';
|
|
2
|
+
declare const Radio: (props: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Radio;
|
|
@@ -3,6 +3,10 @@ export type PopperBaseProps = {
|
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
anchorEl: Element;
|
|
5
5
|
open?: boolean;
|
|
6
|
+
anchorPosition?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
6
10
|
placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
|
|
7
11
|
};
|
|
8
12
|
export declare const PopperBase: (props: PopperBaseProps) => import("react/jsx-runtime").JSX.Element;
|
package/ui/Popper/PopperBase.js
CHANGED
|
@@ -9,18 +9,33 @@ export const PopperBase = props => {
|
|
|
9
9
|
anchorEl,
|
|
10
10
|
children,
|
|
11
11
|
placement,
|
|
12
|
+
anchorPosition,
|
|
12
13
|
open
|
|
13
14
|
} = props;
|
|
14
15
|
const tooltipRef = useRef(null);
|
|
15
16
|
useEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
let modifiers = [{
|
|
18
|
+
name: 'offset',
|
|
19
|
+
options: {
|
|
20
|
+
offset: [0, 5]
|
|
21
|
+
}
|
|
22
|
+
}];
|
|
23
|
+
if (anchorPosition) {
|
|
24
|
+
modifiers.push({
|
|
25
|
+
name: 'computeStyles',
|
|
20
26
|
options: {
|
|
21
|
-
|
|
27
|
+
gpuAcceleration: false,
|
|
28
|
+
// true by default
|
|
29
|
+
roundOffsets: () => ({
|
|
30
|
+
x: anchorPosition.x,
|
|
31
|
+
y: anchorPosition.y
|
|
32
|
+
})
|
|
22
33
|
}
|
|
23
|
-
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const popper = createPopper(anchorEl, tooltipRef.current, {
|
|
37
|
+
placement: placement,
|
|
38
|
+
modifiers: modifiers
|
|
24
39
|
});
|
|
25
40
|
return () => {
|
|
26
41
|
popper.destroy();
|