armtek-uikit-react 1.0.65 → 1.0.67

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.
@@ -2,10 +2,11 @@
2
2
 
3
3
  .BackDropBase {
4
4
  position: fixed;
5
+ top:0;
6
+ left: 0;
5
7
  width: 100%;
6
8
  height: 100%;
7
9
  z-index: 1000;
8
- background: rgba(0, 0, 0, 0.25);
9
10
  display: flex;
10
11
  align-items: center;
11
12
  justify-content: center;
@@ -4,7 +4,6 @@
4
4
  outline: none;
5
5
  border:1px solid transparent;
6
6
  border-radius: $radius;
7
- text-transform: uppercase;
8
7
  padding: $size-step calc(3 * $size-step);
9
8
  cursor: pointer;
10
9
  @include transition(0.3s);
@@ -4,7 +4,7 @@
4
4
  border-top: 1px solid $color-gray-200;
5
5
  padding-top: calc($size-step * 4);
6
6
  display: flex;
7
- margin:0 -$size-step;
7
+ margin:0 (-$size-step);
8
8
  }
9
9
  .FormControls__button{
10
10
  flex: 0 0 50%;
package/assets/Modal.scss CHANGED
@@ -30,4 +30,7 @@
30
30
  right: calc($size-step * 4);
31
31
  top: 50%;
32
32
  transform: translateY(-50%);
33
+ }
34
+ .Modal__backdrop{
35
+ background: rgba(0, 0, 0, 0.25);
33
36
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"armtek-uikit-react","version":"1.0.65","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":"*"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
1
+ {"name":"armtek-uikit-react","version":"1.0.67","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":"*"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
@@ -1,7 +1,5 @@
1
- import { ReactNode, MouseEvent } from 'react';
1
+ import { ComponentPropsWithoutRef } from 'react';
2
2
  export type BackDropProps = {
3
- children: ReactNode;
4
3
  width?: number;
5
- onClick?: (e: MouseEvent<HTMLDivElement>) => void;
6
- };
4
+ } & ComponentPropsWithoutRef<'div'>;
7
5
  export declare const BackDropBase: (props: BackDropProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,6 +6,7 @@ export const BackDropBase = props => {
6
6
  const {
7
7
  children,
8
8
  width = 500,
9
+ className,
9
10
  onClick
10
11
  } = props;
11
12
  const handleClick = e => {
@@ -17,7 +18,7 @@ export const BackDropBase = props => {
17
18
  };
18
19
  return /*#__PURE__*/_jsx(_Fragment, {
19
20
  children: /*#__PURE__*/_jsx("div", {
20
- className: clsx('Arm-BackDropBase', css.BackDropBase),
21
+ className: clsx('Arm-BackDropBase', className, css.BackDropBase),
21
22
  onClick: handleClick,
22
23
  children: /*#__PURE__*/_jsx("div", {
23
24
  className: css.BackDropBase__inner,
@@ -1,6 +1,6 @@
1
1
  import { ComponentPropsWithoutRef, ElementType, HTMLAttributes, ReactNode } from 'react';
2
2
  import { ColorThemeType, ColorType, SizeType, VariantType } from '../../types/theme';
3
- type OwnProps<T extends ElementType = ElementType> = {
3
+ type OwnProps<T extends ElementType = ElementType<HTMLAttributes<HTMLButtonElement>>> = {
4
4
  children: ReactNode;
5
5
  size?: SizeType;
6
6
  color?: ColorType | Exclude<ColorThemeType, 'white'>;
@@ -12,6 +12,6 @@ type OwnProps<T extends ElementType = ElementType> = {
12
12
  asIcon?: boolean;
13
13
  as?: T;
14
14
  };
15
- export type ButtonProps<T extends ElementType = ElementType<HTMLAttributes<HTMLButtonElement>>> = OwnProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof OwnProps>;
15
+ export type ButtonProps<T extends ElementType = ElementType<HTMLAttributes<HTMLButtonElement>>> = OwnProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof OwnProps<T>>;
16
16
  declare const Button: <T extends ElementType>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
17
17
  export default Button;
@@ -8,7 +8,7 @@ export type DateFieldProps = {
8
8
  showTime?: boolean;
9
9
  showTimeOnly?: boolean;
10
10
  } & Omit<TextFieldProps, 'onChange' | 'value'>;
11
- declare const DateField: import("react").ForwardRefExoticComponent<{
11
+ export declare const DateField: import("react").ForwardRefExoticComponent<{
12
12
  format?: string | undefined;
13
13
  onInput?: ((e: ChangeEvent<HTMLInputElement>) => void) | undefined;
14
14
  onChange?: ((value: Date | null) => void) | undefined;
@@ -1,35 +1,16 @@
1
1
  "use client";
2
2
 
3
3
  import TextField from "../TextField/TextField";
4
- import { forwardRef, useState } from 'react';
4
+ import { forwardRef, useRef, useState } from 'react';
5
5
  import Card from "../../Card/Card";
6
6
  import DatePicker from "../DatePicker/DatePicker";
7
7
  import ButtonIcon from "../../ButtonIcon";
8
+ import BackDrop from "../../BackDrop";
9
+ import { PopperBase } from "../../Popper/PopperBase";
8
10
  import { jsx as _jsx } from "react/jsx-runtime";
9
11
  import { Fragment as _Fragment } from "react/jsx-runtime";
10
- const DateInput = /*#__PURE__*/forwardRef((props, ref) => {
11
- let {
12
- showTime,
13
- showTimeOnly,
14
- ...restProps
15
- } = props;
16
- let inputIcon = showTime && showTimeOnly ? 'schedule' : 'calendar_today';
17
- return /*#__PURE__*/_jsx(TextField, {
18
- ref: ref,
19
- ...restProps,
20
- endAdornment: /*#__PURE__*/_jsx(ButtonIcon, {
21
- size: 'medium',
22
- variant: 'transparent',
23
- onClick: props.onClick,
24
- color: 'neutral',
25
- children: /*#__PURE__*/_jsx("span", {
26
- className: 'material_icon',
27
- children: inputIcon
28
- })
29
- })
30
- });
31
- });
32
- const DateField = /*#__PURE__*/forwardRef((props, ref) => {
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ export const DateField = /*#__PURE__*/forwardRef((props, ref) => {
33
14
  let {
34
15
  onChange,
35
16
  format = 'dd.MM.yyyy',
@@ -41,33 +22,97 @@ const DateField = /*#__PURE__*/forwardRef((props, ref) => {
41
22
  ...restProps
42
23
  } = props;
43
24
  let [date, setDate] = useState(null);
25
+ let [open, setOpen] = useState(false);
44
26
  if (showTime && !showTimeOnly) format = 'dd.MM.yyyy HH:mm';else if (showTimeOnly) format = 'HH:mm';
45
27
  const handleChange = d => {
28
+ console.log(d);
46
29
  setDate(d);
47
30
  if (onChange) onChange(d);
48
31
  };
32
+ const handleClick = e => {
33
+ setOpen(prev => !prev);
34
+ if (props.onClick) props.onClick(e);
35
+ };
49
36
  let realValue = value !== undefined ? value : date;
50
- return /*#__PURE__*/_jsx(_Fragment, {
51
- children: /*#__PURE__*/_jsx(DatePicker, {
52
- onChange: handleChange,
53
- selected: realValue,
54
- showTimeSelect: !!showTime,
55
- timeIntervals: 15,
56
- showTimeSelectOnly: !!showTimeOnly && !!showTime,
57
- customInput: /*#__PURE__*/_jsx(DateInput, {
58
- showTime: showTime,
59
- showTimeOnly: showTimeOnly,
60
- ref: ref,
61
- ...restProps
62
- }),
63
- inline: false,
64
- disabled: disabled,
65
- calendarContainer: PickerCard,
66
- popperPlacement: "top-end",
67
- dateFormat: format
68
- })
37
+ const btnRef = useRef();
38
+ const inputIcon = showTime && showTimeOnly ? 'schedule' : 'calendar_today';
39
+ return /*#__PURE__*/_jsxs(_Fragment, {
40
+ children: [/*#__PURE__*/_jsx(TextField, {
41
+ ref: ref,
42
+ ...restProps,
43
+ endAdornment: /*#__PURE__*/_jsx(ButtonIcon, {
44
+ size: 'medium',
45
+ variant: 'transparent',
46
+ onClick: handleClick,
47
+ color: 'neutral',
48
+ children: /*#__PURE__*/_jsx("span", {
49
+ ref: btnRef,
50
+ className: 'material_icon',
51
+ children: inputIcon
52
+ })
53
+ })
54
+ }), open && /*#__PURE__*/_jsx(BackDrop, {
55
+ onClick: () => setOpen(false),
56
+ children: /*#__PURE__*/_jsx(PopperBase, {
57
+ anchorEl: btnRef,
58
+ open: open,
59
+ placement: 'bottom-end',
60
+ children: /*#__PURE__*/_jsx("div", {
61
+ style: {
62
+ backgroundColor: '#fff',
63
+ width: '100%'
64
+ },
65
+ children: /*#__PURE__*/_jsx(DatePicker, {
66
+ onChange: handleChange,
67
+ selected: realValue,
68
+ showTimeSelect: !!showTime,
69
+ timeIntervals: 15,
70
+ showTimeSelectOnly: !!showTimeOnly && !!showTime,
71
+ inline: true,
72
+ disabled: disabled,
73
+ calendarContainer: PickerCard,
74
+ popperPlacement: "top-end",
75
+ dateFormat: format
76
+ })
77
+ })
78
+ })
79
+ })]
69
80
  });
70
81
  });
82
+ // const DateField = forwardRef((props: DateFieldProps, ref: any) => {
83
+ //
84
+ // let {onChange, format = 'dd.MM.yyyy', onInput, showTime, showTimeOnly, disabled, value, ...restProps} = props
85
+ // let [date, setDate] = useState<Date | null>(null)
86
+ //
87
+ // if( showTime && !showTimeOnly ) format = 'dd.MM.yyyy HH:mm'
88
+ // else if( showTimeOnly ) format = 'HH:mm'
89
+ //
90
+ // const handleChange = (d: Date | null) => {
91
+ // setDate(d)
92
+ // if( onChange )
93
+ // onChange(d)
94
+ // }
95
+ //
96
+ // let realValue = value !== undefined ? value : date
97
+ //
98
+ // return <>
99
+ // <DatePicker
100
+ // onChange={handleChange}
101
+ // selected={realValue}
102
+ // showTimeSelect={!!showTime}
103
+ // timeIntervals={15}
104
+ // showTimeSelectOnly={!!showTimeOnly && !!showTime}
105
+ // customInput={<DateInput showTime={showTime} showTimeOnly={showTimeOnly} ref={ref} {...restProps} />}
106
+ // inline={false}
107
+ // disabled={disabled}
108
+ // calendarContainer={PickerCard}
109
+ // popperPlacement="top-end"
110
+ // dateFormat={format}
111
+ // />
112
+ // </>
113
+ //
114
+ // })
115
+
71
116
  const PickerCard = props => {
72
117
  return /*#__PURE__*/_jsx(Card, {
73
118
  className: props.className,
@@ -28,7 +28,7 @@ export const TextField = /*#__PURE__*/forwardRef((props, ref) => {
28
28
  } = props;
29
29
  let [value, setValue] = useState('');
30
30
  let [focused, setFocused] = useState(false);
31
- const inputRef = useRef();
31
+ const inputRef = useRef(ref);
32
32
  const handleFocus = e => {
33
33
  setFocused(true);
34
34
  if (inputProps.onFocus) inputProps.onFocus(e);
@@ -49,7 +49,6 @@ export const TextField = /*#__PURE__*/forwardRef((props, ref) => {
49
49
  });
50
50
  let endContentExists = endAdornment || error || success;
51
51
  let Component = multiline ? 'textarea' : 'input';
52
- let realRef = ref || inputRef;
53
52
  let realFocused = props.focused !== undefined ? props.focused : focused;
54
53
  return /*#__PURE__*/_jsxs(_Fragment, {
55
54
  children: [/*#__PURE__*/_jsxs(TextFieldContainer, {
@@ -58,14 +57,14 @@ export const TextField = /*#__PURE__*/forwardRef((props, ref) => {
58
57
  disabled: inputProps.disabled,
59
58
  focused: realFocused,
60
59
  onClick: () => {
61
- var _realRef$current;
62
- return editable ? (_realRef$current = realRef.current) == null ? void 0 : _realRef$current.focus() : null;
60
+ var _inputRef$current;
61
+ return editable ? (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus() : null;
63
62
  },
64
63
  className: className,
65
64
  error: error,
66
65
  children: [/*#__PURE__*/_jsx(TextFieldInput, {
67
66
  Component: Component,
68
- ref: realRef,
67
+ ref: inputRef,
69
68
  value: value,
70
69
  onChange: e => setValue(e.target.value),
71
70
  size: size,
@@ -7,6 +7,6 @@ export type OwnProps<T extends ElementType = ElementType> = {
7
7
  startAdornment?: string | ReactNode;
8
8
  as?: T;
9
9
  } & ButtonHTMLAttributes<HTMLButtonElement>;
10
- type ListItemProps<T extends ElementType = ElementType<HTMLAttributes<HTMLButtonElement>>> = OwnProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof OwnProps>;
10
+ export type ListItemProps<T extends ElementType = ElementType<HTMLAttributes<HTMLButtonElement>>> = OwnProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof OwnProps>;
11
11
  declare function ListItem<T extends ElementType>(props: ListItemProps<T>): import("react/jsx-runtime").JSX.Element;
12
12
  export default ListItem;
package/ui/Modal/Modal.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { BaseModal } from "./BaseModal";
2
2
  import BackDrop from "../BackDrop";
3
+ import css from "./Modal.module.scss";
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  import { Fragment as _Fragment } from "react/jsx-runtime";
5
6
  const Modal = props => {
@@ -13,6 +14,7 @@ const Modal = props => {
13
14
  children: /*#__PURE__*/_jsx(BackDrop, {
14
15
  width: width,
15
16
  onClick: modalProps.onClose,
17
+ className: css.Modal__backdrop,
16
18
  children: /*#__PURE__*/_jsx(BaseModal, {
17
19
  ...modalProps
18
20
  })
@@ -1,9 +1,3 @@
1
- import { MutableRefObject, ReactNode } from 'react';
2
- type PopperProps = {
3
- children: ReactNode;
4
- anchorEl: MutableRefObject<any>;
5
- open?: boolean;
6
- placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
7
- };
8
- export declare const Popper: (props: PopperProps) => import("react/jsx-runtime").JSX.Element | null;
9
- export {};
1
+ import { PopperBaseProps } from './PopperBase';
2
+ export declare const Popper: (props: PopperBaseProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default Popper;
@@ -1,38 +1,16 @@
1
- "use client";
2
-
3
- import { useEffect, useRef } from 'react';
4
1
  import { createPortal } from 'react-dom';
5
- import { createPopper } from '@popperjs/core';
2
+ import { PopperBase } from "./PopperBase";
3
+
4
+ //TODO TESTS
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
8
7
  export const Popper = props => {
9
- const {
10
- anchorEl,
11
- children,
12
- placement,
13
- open
14
- } = props;
15
- const tooltipRef = useRef(null);
16
- useEffect(() => {
17
- const popper = createPopper(anchorEl.current, tooltipRef.current, {
18
- placement: placement,
19
- modifiers: [{
20
- name: 'offset',
21
- options: {
22
- offset: [0, 5]
23
- }
24
- }]
25
- });
26
- return () => {
27
- popper.destroy();
28
- // handlePopperRefRef.current!(null)
29
- };
30
- }, [open, placement]);
31
- if (!open) return null;
8
+ if (!props.open) return null;
32
9
  return /*#__PURE__*/_jsx(_Fragment, {
33
- children: /*#__PURE__*/createPortal( /*#__PURE__*/_jsx("div", {
34
- ref: tooltipRef,
35
- children: children
10
+ children: /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(PopperBase, {
11
+ ...props,
12
+ children: props.children
36
13
  }), document.body)
37
14
  });
38
- };
15
+ };
16
+ export default Popper;
@@ -0,0 +1,8 @@
1
+ import { MutableRefObject, ReactNode } from 'react';
2
+ export type PopperBaseProps = {
3
+ children: ReactNode;
4
+ anchorEl: MutableRefObject<any>;
5
+ open?: boolean;
6
+ placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
7
+ };
8
+ export declare const PopperBase: (props: PopperBaseProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+
3
+ import { useEffect, useRef } from 'react';
4
+ import { createPopper } from '@popperjs/core';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ export const PopperBase = props => {
8
+ const {
9
+ anchorEl,
10
+ children,
11
+ placement,
12
+ open
13
+ } = props;
14
+ const tooltipRef = useRef(null);
15
+ useEffect(() => {
16
+ const popper = createPopper(anchorEl.current, tooltipRef.current, {
17
+ placement: placement,
18
+ modifiers: [{
19
+ name: 'offset',
20
+ options: {
21
+ offset: [0, 5]
22
+ }
23
+ }]
24
+ });
25
+ return () => {
26
+ popper.destroy();
27
+ // handlePopperRefRef.current!(null)
28
+ };
29
+ }, [open, placement]);
30
+ return /*#__PURE__*/_jsx(_Fragment, {
31
+ children: /*#__PURE__*/_jsx("div", {
32
+ ref: tooltipRef,
33
+ children: children
34
+ })
35
+ });
36
+ };
@@ -1 +1,2 @@
1
- export { Popper } from './Popper';
1
+ export { default } from './Popper';
2
+ export * from './PopperBase';
@@ -1 +1,2 @@
1
- export { Popper } from "./Popper";
1
+ export { default } from "./Popper";
2
+ export * from "./PopperBase";
@@ -3,7 +3,7 @@
3
3
  import { cloneElement, isValidElement, useRef, useState } from 'react';
4
4
  import useTimeout from "../../lib/hooks/useTimeout";
5
5
  import useEventCallback from "../../lib/hooks/useEventCallback";
6
- import { Popper } from "../Popper";
6
+ import Popper from "../Popper";
7
7
  import css from "./Tooltip.module.scss";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { Fragment as _Fragment } from "react/jsx-runtime";