armtek-uikit-react 1.0.75 → 1.0.77
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 +12 -0
- package/assets/Dropdown.scss +4 -1
- package/assets/Paper.scss +20 -0
- package/package.json +1 -1
- package/ui/Accordion/Accordion.d.ts +15 -0
- package/ui/Accordion/Accordion.js +91 -0
- package/ui/Accordion/Accordion.module.scss +1 -0
- package/ui/Accordion/index.d.ts +2 -0
- package/ui/Accordion/index.js +2 -0
- package/ui/Dropdown/Dropdown.d.ts +4 -3
- package/ui/Dropdown/Dropdown.js +21 -16
- package/ui/Paper/Paper.d.ts +9 -0
- package/ui/Paper/Paper.js +25 -0
- package/ui/Paper/Paper.module.scss +1 -0
- package/ui/Paper/index.d.ts +2 -0
- package/ui/Paper/index.js +2 -0
- package/ui/Popper/Popper.d.ts +2 -1
package/assets/Dropdown.scss
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@import "variables";
|
|
2
|
+
|
|
3
|
+
.Paper{
|
|
4
|
+
border-radius: var(--border-radius);
|
|
5
|
+
background-color: #fff;
|
|
6
|
+
padding: calc(var(--size-step) * 2);
|
|
7
|
+
}
|
|
8
|
+
.Paper_elevation{
|
|
9
|
+
box-shadow: var(--box-shadow);
|
|
10
|
+
}
|
|
11
|
+
.Paper_outlined{
|
|
12
|
+
border: 1px solid var(--color-gray-300)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.Paper_dark{
|
|
16
|
+
background-color: var(--color-gray-700);
|
|
17
|
+
&.Paper_outlined{
|
|
18
|
+
border: 1px solid rgba(255, 255, 255, 0.2)
|
|
19
|
+
}
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.77","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"}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { DropDownProps } from '../Dropdown';
|
|
3
|
+
type ClassNames = 'AccordionHead' | 'AccordionBody' | 'AccordionTitle' | 'AccordionToggle';
|
|
4
|
+
type OwnProps = {
|
|
5
|
+
title: string | ReactNode;
|
|
6
|
+
classNames?: Record<ClassNames, string>;
|
|
7
|
+
expanded?: boolean;
|
|
8
|
+
defaultExpanded?: boolean;
|
|
9
|
+
onChange?: () => void;
|
|
10
|
+
transitionProps?: DropDownProps['transitionProps'];
|
|
11
|
+
triggerOnIcon?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type AccordionProps = OwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof OwnProps>;
|
|
14
|
+
declare const Accordion: (props: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default Accordion;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import css from "./Accordion.module.scss";
|
|
6
|
+
import Dropdown from "../Dropdown";
|
|
7
|
+
import ButtonIcon from "../ButtonIcon";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
const Accordion = props => {
|
|
12
|
+
let {
|
|
13
|
+
title,
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
classNames,
|
|
17
|
+
expanded,
|
|
18
|
+
defaultExpanded,
|
|
19
|
+
onChange,
|
|
20
|
+
triggerOnIcon,
|
|
21
|
+
transitionProps,
|
|
22
|
+
...divPops
|
|
23
|
+
} = props;
|
|
24
|
+
const [isExpanded, setIsExpanded] = useState(!!defaultExpanded);
|
|
25
|
+
const openProp = expanded !== undefined ? expanded : isExpanded;
|
|
26
|
+
const [contentHidden, setContentHidden] = useState(!openProp);
|
|
27
|
+
const iconCode = openProp ? 'expand_less' : 'expand_more';
|
|
28
|
+
const handleExpand = () => {
|
|
29
|
+
if (expanded === undefined) setIsExpanded(prev => !prev);
|
|
30
|
+
if (onChange) onChange();
|
|
31
|
+
};
|
|
32
|
+
const handleHeadClick = () => {
|
|
33
|
+
if (!triggerOnIcon) handleExpand();
|
|
34
|
+
};
|
|
35
|
+
const handleIconClick = e => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
handleExpand();
|
|
38
|
+
};
|
|
39
|
+
const handleExit = () => {
|
|
40
|
+
if (!(transitionProps != null && transitionProps.unmountOnExit)) setContentHidden(true);
|
|
41
|
+
if (transitionProps != null && transitionProps.onExit) transitionProps.onExit();
|
|
42
|
+
};
|
|
43
|
+
const handleEnter = isAppearing => {
|
|
44
|
+
if (!(transitionProps != null && transitionProps.unmountOnExit)) setContentHidden(false);
|
|
45
|
+
if (transitionProps != null && transitionProps.onEnter) transitionProps.onEnter(isAppearing);
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
48
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
49
|
+
...divPops,
|
|
50
|
+
className: clsx(css.Accordion, className),
|
|
51
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
52
|
+
className: clsx(css.AccordionHead, classNames == null ? void 0 : classNames.AccordionHead),
|
|
53
|
+
onClick: handleHeadClick,
|
|
54
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
55
|
+
className: clsx(classNames == null ? void 0 : classNames.AccordionTitle),
|
|
56
|
+
children: title
|
|
57
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
58
|
+
className: clsx(classNames == null ? void 0 : classNames.AccordionTitle, css.AccordionToggle),
|
|
59
|
+
children: /*#__PURE__*/_jsx(ButtonIcon, {
|
|
60
|
+
onClick: handleIconClick,
|
|
61
|
+
size: 'small',
|
|
62
|
+
color: 'neutral',
|
|
63
|
+
variant: 'transparent',
|
|
64
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
65
|
+
className: "mi",
|
|
66
|
+
children: iconCode
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})]
|
|
70
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
71
|
+
className: clsx(classNames == null ? void 0 : classNames.AccordionBody),
|
|
72
|
+
children: /*#__PURE__*/_jsx(Dropdown, {
|
|
73
|
+
transitionProps: {
|
|
74
|
+
unmountOnExit: true,
|
|
75
|
+
...transitionProps,
|
|
76
|
+
onExit: handleExit,
|
|
77
|
+
onEnter: handleEnter
|
|
78
|
+
},
|
|
79
|
+
expanded: openProp,
|
|
80
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
81
|
+
style: {
|
|
82
|
+
display: contentHidden ? 'none' : 'block'
|
|
83
|
+
},
|
|
84
|
+
children: children
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
export default Accordion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./../../assets/Accordion";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
|
|
2
|
+
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
|
+
export type DropDownProps = {
|
|
3
4
|
expanded?: boolean;
|
|
4
|
-
|
|
5
|
+
transitionProps?: Partial<CSSTransitionProps<HTMLElement>>;
|
|
5
6
|
} & ComponentPropsWithoutRef<'div'>;
|
|
6
|
-
declare function Dropdown(props:
|
|
7
|
+
declare function Dropdown(props: DropDownProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export default Dropdown;
|
package/ui/Dropdown/Dropdown.js
CHANGED
|
@@ -12,7 +12,7 @@ function Dropdown(props) {
|
|
|
12
12
|
children,
|
|
13
13
|
className,
|
|
14
14
|
expanded,
|
|
15
|
-
|
|
15
|
+
transitionProps,
|
|
16
16
|
...divProps
|
|
17
17
|
} = props;
|
|
18
18
|
const nodeRef = useRef(null);
|
|
@@ -25,22 +25,27 @@ function Dropdown(props) {
|
|
|
25
25
|
children: /*#__PURE__*/_jsx("div", {
|
|
26
26
|
...divProps,
|
|
27
27
|
className: clsx('Arm-dropdown', css.Dropdown, className),
|
|
28
|
-
children: /*#__PURE__*/_jsx(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
29
|
+
className: clsx({
|
|
30
|
+
// [css.Dropdown__ContentWrapper_hidden]: !expanded
|
|
31
|
+
}),
|
|
32
|
+
children: /*#__PURE__*/_jsx(CSSTransition, {
|
|
33
|
+
classNames: {
|
|
34
|
+
'enter': css.Dropdown__ContentWrapperEnter,
|
|
35
|
+
'enterActive': css.Dropdown__ContentWrapperEnterActive,
|
|
36
|
+
'exit': css.Dropdown__ContentWrapperExit,
|
|
37
|
+
'exitActive': css.Dropdown__ContentWrapperExitActive
|
|
38
|
+
},
|
|
39
|
+
in: expanded,
|
|
40
|
+
timeout: duration,
|
|
41
|
+
nodeRef: nodeRef,
|
|
42
|
+
...transitionProps,
|
|
41
43
|
children: /*#__PURE__*/_jsx("div", {
|
|
42
|
-
|
|
43
|
-
children:
|
|
44
|
+
ref: nodeRef,
|
|
45
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: css.Dropdown__Content,
|
|
47
|
+
children: children
|
|
48
|
+
})
|
|
44
49
|
})
|
|
45
50
|
})
|
|
46
51
|
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { ThemeType } from '../../types/theme';
|
|
3
|
+
type OwnProps = {
|
|
4
|
+
variant?: 'elevation' | 'outlined';
|
|
5
|
+
theme?: ThemeType;
|
|
6
|
+
};
|
|
7
|
+
export type PaperProps = OwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof OwnProps>;
|
|
8
|
+
declare const Paper: (props: PaperProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default Paper;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import css from "./Paper.module.scss";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
const Paper = props => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
theme,
|
|
10
|
+
variant = 'elevation',
|
|
11
|
+
...divPops
|
|
12
|
+
} = props;
|
|
13
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
14
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
15
|
+
className: clsx(css.Paper, 'Arm-Paper', className, {
|
|
16
|
+
[css.Paper_elevation]: variant === 'elevation',
|
|
17
|
+
[css.Paper_outlined]: variant === 'outlined',
|
|
18
|
+
[css.Paper_dark]: theme === 'dark'
|
|
19
|
+
}),
|
|
20
|
+
...divPops,
|
|
21
|
+
children: children
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export default Paper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./../../assets/Paper";
|
package/ui/Popper/Popper.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { PopperBaseProps } from './PopperBase';
|
|
2
|
-
export
|
|
2
|
+
export type PopperProps = {} & PopperBaseProps;
|
|
3
|
+
export declare const Popper: (props: PopperProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
4
|
export default Popper;
|