@rescui/input 0.12.4-RUI-257-collapse-prop-types-warning-dbcf0473.1 → 0.12.4-RUI-262-Migrate-to-GH-Actions-Release-dummy-8695a904.3

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/lib/index.d.ts DELETED
@@ -1,62 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * @deprecated use named import instead
4
- */
5
- declare const DefaultInput: import("react").ForwardRefExoticComponent<{
6
- id?: string;
7
- className?: string;
8
- placeholder?: string;
9
- disabled?: boolean;
10
- error?: import("react").ReactNode;
11
- busy?: boolean;
12
- onChange?: import("react").ChangeEventHandler<HTMLInputElement>;
13
- onFocus?: import("react").FocusEventHandler<HTMLInputElement>;
14
- onBlur?: import("react").FocusEventHandler<HTMLInputElement>;
15
- onClear?: import("react").MouseEventHandler<HTMLButtonElement>;
16
- onMouseEnter?: import("react").MouseEventHandler<HTMLInputElement>;
17
- onMouseLeave?: import("react").MouseEventHandler<HTMLInputElement>;
18
- mode?: import("./input").InputMode;
19
- size?: import("./input").InputSize;
20
- theme?: import("./input").InputTheme;
21
- type?: import("./input").InputType;
22
- value?: string | number | string[];
23
- icon?: import("react").ReactNode;
24
- iconType?: import("./input").InputIconType;
25
- label?: import("react").ReactNode;
26
- note?: import("react").ReactNode;
27
- name?: string;
28
- clearIcon?: import("react").ReactNode;
29
- suffix?: import("react").ReactNode;
30
- offSystemMicroelements?: boolean;
31
- boldLabel?: boolean;
32
- } & Omit<import("react").HTMLProps<HTMLInputElement>, keyof {
33
- id?: string;
34
- className?: string;
35
- placeholder?: string;
36
- disabled?: boolean;
37
- error?: import("react").ReactNode;
38
- busy?: boolean;
39
- onChange?: import("react").ChangeEventHandler<HTMLInputElement>;
40
- onFocus?: import("react").FocusEventHandler<HTMLInputElement>;
41
- onBlur?: import("react").FocusEventHandler<HTMLInputElement>;
42
- onClear?: import("react").MouseEventHandler<HTMLButtonElement>;
43
- onMouseEnter?: import("react").MouseEventHandler<HTMLInputElement>;
44
- onMouseLeave?: import("react").MouseEventHandler<HTMLInputElement>;
45
- mode?: import("./input").InputMode;
46
- size?: import("./input").InputSize;
47
- theme?: import("./input").InputTheme;
48
- type?: import("./input").InputType;
49
- value?: string | number | string[];
50
- icon?: import("react").ReactNode;
51
- iconType?: import("./input").InputIconType;
52
- label?: import("react").ReactNode;
53
- note?: import("react").ReactNode;
54
- name?: string;
55
- clearIcon?: import("react").ReactNode;
56
- suffix?: import("react").ReactNode;
57
- offSystemMicroelements?: boolean;
58
- boldLabel?: boolean;
59
- } | "ref"> & import("react").RefAttributes<HTMLInputElement>>;
60
- export default DefaultInput;
61
- export { Input } from './input';
62
- export type { InputProps } from './input';
package/lib/index.js DELETED
@@ -1,9 +0,0 @@
1
- import './index.css';
2
- import { Input } from './input.js';
3
- export { Input } from './input.js';
4
- /**
5
- * @deprecated use named import instead
6
- */
7
-
8
- const DefaultInput = Input;
9
- export { DefaultInput as default };
package/lib/input.d.ts DELETED
@@ -1,89 +0,0 @@
1
- import * as React from 'react';
2
- export declare type InputMode = 'classic' | 'rock';
3
- export declare type InputSize = 'l' | 'm' | 's';
4
- export declare type InputTheme = 'light' | 'dark';
5
- export declare type InputType = 'text' | 'email' | 'search' | 'date' | 'time' | 'password' | 'number' | 'file' | 'url' | 'tel';
6
- export declare type InputIconType = 'left' | 'right' | 'rightAction' | 'rightActionFocusable';
7
- declare type InputExclusiveProps = {
8
- id?: string;
9
- className?: string;
10
- placeholder?: string;
11
- /**
12
- * Disable input
13
- */
14
- disabled?: boolean;
15
- /**
16
- * Error state flag
17
- */
18
- error?: boolean | React.ReactNode;
19
- /**
20
- * Set busy state
21
- */
22
- busy?: boolean;
23
- /**
24
- * Change value callback. `value => ...`
25
- */
26
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
27
- /**
28
- * Focus input callback
29
- */
30
- onFocus?: React.FocusEventHandler<HTMLInputElement>;
31
- /**
32
- * Blur input callback
33
- */
34
- onBlur?: React.FocusEventHandler<HTMLInputElement>;
35
- /**
36
- * Clear input callback, clear button appears when this callback provided and input is not empty
37
- */
38
- onClear?: React.MouseEventHandler<HTMLButtonElement>;
39
- /**
40
- * `mouseEnter` input callback
41
- */
42
- onMouseEnter?: React.MouseEventHandler<HTMLInputElement>;
43
- /**
44
- * `mouseLeave` input callback
45
- */
46
- onMouseLeave?: React.MouseEventHandler<HTMLInputElement>;
47
- /**
48
- * Mode of the input - classic or rock
49
- */
50
- mode?: InputMode;
51
- /**
52
- * Size
53
- */
54
- size?: InputSize;
55
- /**
56
- * Appearance theme
57
- */
58
- theme?: InputTheme;
59
- /**
60
- * Change input behavior
61
- */
62
- type?: InputType;
63
- /**
64
- * Set value to control state of the input. `onChange` callback is required.
65
- */
66
- value?: string | number | string[];
67
- /**
68
- * Icon to place inside the input, supports only icons from `@rescui/icons` package or similar in structure
69
- */
70
- icon?: React.ReactNode;
71
- /**
72
- * Left or right decorative icon or right action (clickable) icon or right action focusable (by tab) icon.
73
- */
74
- iconType?: InputIconType;
75
- label?: React.ReactNode;
76
- note?: React.ReactNode;
77
- name?: string;
78
- /**
79
- * Clear icon customization, supports only icons from `@rescui/icons` package
80
- */
81
- clearIcon?: React.ReactNode;
82
- suffix?: React.ReactNode;
83
- /** Turns off system microelements in input. For example turns off arrows for input[type='number'] */
84
- offSystemMicroelements?: boolean;
85
- boldLabel?: boolean;
86
- };
87
- export declare type InputProps = InputExclusiveProps & Omit<React.HTMLProps<HTMLInputElement>, keyof InputExclusiveProps | 'ref'>;
88
- export declare const Input: React.ForwardRefExoticComponent<InputExclusiveProps & Omit<React.HTMLProps<HTMLInputElement>, keyof InputExclusiveProps | "ref"> & React.RefAttributes<HTMLInputElement>>;
89
- export default Input;
package/lib/input.js DELETED
@@ -1,203 +0,0 @@
1
- "use client";
2
- import * as React from 'react';
3
- import PropTypes from 'prop-types';
4
- import cn from 'classnames';
5
- import { useThemeWithUndefined } from '@rescui/ui-contexts';
6
- import WarningIcon from './_virtual/warning.js';
7
- import CloseIcon from './_virtual/close.js';
8
- import styles from './input.p.module.css.js';
9
- import { RightIcons } from './parts/right-icons.js';
10
- import { CustomIcon } from './parts/custom-icon.js';
11
- const {
12
- useEffect,
13
- useRef,
14
- useState
15
- } = React;
16
- const sizeStyles = {
17
- l: styles.sizeL,
18
- m: styles.sizeM,
19
- s: styles.sizeS
20
- };
21
- const Input = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
22
- (_ref, ref) => {
23
- let {
24
- id,
25
- className,
26
- placeholder,
27
- disabled,
28
- error,
29
- busy,
30
- onChange,
31
- onFocus,
32
- onBlur,
33
- onClear,
34
- mode = 'classic',
35
- size = 'm',
36
- theme: themeFromProps,
37
- type = 'text',
38
- value,
39
- icon,
40
- iconType = 'right',
41
- label,
42
- note,
43
- clearIcon = /*#__PURE__*/React.createElement(CloseIcon, null),
44
- suffix,
45
- offSystemMicroelements,
46
- style,
47
- boldLabel,
48
- ...restProps
49
- } = _ref;
50
- const theme = useThemeWithUndefined(themeFromProps); // replace with :focus-within when ie11 is not supported anymore
51
-
52
- const [focused, setFocused] = useState(false);
53
- const empty = !value;
54
- const filled = !empty;
55
- const enabled = !disabled;
56
- const inputMouseDown = useRef(false);
57
- const activeRef = useRef(false); // run effect only on unmount with final props
58
-
59
- const unmountPropsRef = useRef({});
60
- unmountPropsRef.current = {
61
- type,
62
- onChange
63
- };
64
- useEffect(() => () => {
65
- if (unmountPropsRef.current.type === 'file' && unmountPropsRef.current.onChange) {
66
- unmountPropsRef.current.onChange({
67
- target: {
68
- type: 'file',
69
- files: null
70
- }
71
- });
72
- }
73
- }, []);
74
- const renderLeftCustomIcon = icon && iconType === 'left';
75
- const renderRightCustomIcon = icon && (iconType === 'right' || iconType === 'rightAction' || iconType === 'rightActionFocusable');
76
- return /*#__PURE__*/React.createElement("div", {
77
- className: cn(styles.container, styles[theme], styles[mode], sizeStyles[size], {
78
- [styles.focused]: focused,
79
- [styles.filled]: filled,
80
- [styles.enabled]: enabled,
81
- [styles.error]: Boolean(error),
82
- [styles.disabled]: disabled,
83
- [styles.offSystemMicroelements]: offSystemMicroelements
84
- }, className),
85
- style: style,
86
- "data-test": "input"
87
- }, /*#__PURE__*/React.createElement("label", null, label && /*#__PURE__*/React.createElement("div", {
88
- className: styles.label,
89
- "data-rs-internal": boldLabel ? 'input__bold-label' : 'input__label'
90
- }, label), /*#__PURE__*/React.createElement("div", {
91
- className: styles.wrapper,
92
- onFocus: () => {
93
- setFocused(true);
94
- },
95
- onMouseUp: () => {
96
- if (activeRef.current) {
97
- setFocused(false);
98
- }
99
-
100
- activeRef.current = false;
101
- },
102
- onMouseDown: () => {
103
- if (inputMouseDown.current) {
104
- inputMouseDown.current = false;
105
- return;
106
- }
107
-
108
- activeRef.current = true;
109
- },
110
- onMouseLeave: () => {
111
- if (activeRef.current) {
112
- setFocused(false);
113
- }
114
-
115
- activeRef.current = false;
116
- },
117
- onBlur: () => {
118
- if (!activeRef.current) {
119
- setFocused(false);
120
- }
121
- }
122
- }, /*#__PURE__*/React.createElement("div", {
123
- className: styles.field
124
- }, renderLeftCustomIcon && /*#__PURE__*/React.createElement(CustomIcon, {
125
- icon: icon,
126
- iconIsAction: false,
127
- iconIsFocusable: false,
128
- iconPosition: "left"
129
- }), /*#__PURE__*/React.createElement("input", { ...restProps,
130
- id: id,
131
- className: styles.inner,
132
- type: type,
133
- disabled: disabled,
134
- placeholder: placeholder,
135
- onChange: onChange,
136
- onFocus: onFocus,
137
- onBlur: onBlur,
138
- onMouseDown: e => {
139
- inputMouseDown.current = true;
140
-
141
- if (restProps.onMouseDown) {
142
- restProps.onMouseDown(e);
143
- }
144
- },
145
- value: value,
146
- ref: ref,
147
- "aria-invalid": Boolean(error),
148
- "data-test": "input__inner",
149
- "data-rs-internal": "input__inner"
150
- }), /*#__PURE__*/React.createElement(RightIcons, {
151
- icon: renderRightCustomIcon && icon,
152
- iconIsAction: iconType === 'rightAction' || iconType === 'rightActionFocusable',
153
- iconIsFocusable: iconType === 'rightActionFocusable',
154
- clearIcon: clearIcon,
155
- onClear: onClear,
156
- empty: empty,
157
- busy: busy
158
- })), suffix && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
159
- className: styles.divider
160
- }), /*#__PURE__*/React.createElement("div", {
161
- className: styles.suffix,
162
- "data-test": "input__suffix",
163
- "data-rs-internal": "input__suffix"
164
- }, suffix)))), error && typeof error !== 'boolean' && /*#__PURE__*/React.createElement("div", {
165
- className: styles.errorMessage,
166
- "data-test": "input__error-message",
167
- "data-rs-internal": "input__error-message"
168
- }, /*#__PURE__*/React.createElement(WarningIcon, {
169
- className: styles.errorIcon,
170
- "data-rs-internal": "input__error-icon",
171
- "data-render-all-sizes": true
172
- }), /*#__PURE__*/React.createElement("span", null, error)), note && /*#__PURE__*/React.createElement("div", {
173
- className: styles.note,
174
- "data-rs-internal": "input__note"
175
- }, note));
176
- });
177
- Input.displayName = 'Input';
178
- Input.propTypes = {
179
- id: PropTypes.string,
180
- className: PropTypes.string,
181
- placeholder: PropTypes.string,
182
- disabled: PropTypes.bool,
183
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
184
- busy: PropTypes.bool,
185
- onChange: PropTypes.func,
186
- onFocus: PropTypes.func,
187
- onBlur: PropTypes.func,
188
- onClear: PropTypes.func,
189
- mode: PropTypes.oneOf(['classic', 'rock']),
190
- size: PropTypes.oneOf(['s', 'm', 'l']),
191
- theme: PropTypes.oneOf(['light', 'dark']),
192
- type: PropTypes.oneOf(['text', 'email', 'search', 'date', 'time', 'password', 'number', 'file', 'url', 'tel']),
193
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
194
- icon: PropTypes.node,
195
- iconType: PropTypes.oneOf(['left', 'right', 'rightAction', 'rightActionFocusable']),
196
- label: PropTypes.node,
197
- note: PropTypes.node,
198
- clearIcon: PropTypes.node,
199
- suffix: PropTypes.node,
200
- offSystemMicroelements: PropTypes.bool
201
- };
202
- Input.displayName = 'Input';
203
- export { Input, Input as default };
@@ -1,31 +0,0 @@
1
- var styles = {
2
- "light": "_light_nr308o_8",
3
- "dark": "_dark_nr308o_11",
4
- "sizeS": "_sizeS_nr308o_15",
5
- "sizeM": "_sizeM_nr308o_18",
6
- "sizeL": "_sizeL_nr308o_21",
7
- "classic": "_classic_nr308o_25",
8
- "rock": "_rock_nr308o_28",
9
- "container": "_container_nr308o_32",
10
- "wrapper": "_wrapper_nr308o_39",
11
- "disabled": "_disabled_nr308o_51",
12
- "error": "_error_nr308o_57",
13
- "enabled": "_enabled_nr308o_63",
14
- "filled": "_filled_nr308o_63",
15
- "focused": "_focused_nr308o_75",
16
- "field": "_field_nr308o_101",
17
- "inner": "_inner_nr308o_114",
18
- "offSystemMicroelements": "_offSystemMicroelements_nr308o_229",
19
- "iconWrapper": "_iconWrapper_nr308o_239",
20
- "action": "_action_nr308o_254",
21
- "right": "_right_nr308o_292",
22
- "left": "_left_nr308o_296",
23
- "icon": "_icon_nr308o_239",
24
- "divider": "_divider_nr308o_342",
25
- "suffix": "_suffix_nr308o_356",
26
- "errorMessage": "_errorMessage_nr308o_376",
27
- "errorIcon": "_errorIcon_nr308o_388",
28
- "note": "_note_nr308o_394",
29
- "label": "_label_nr308o_405"
30
- };
31
- export { styles as default };
@@ -1,26 +0,0 @@
1
- import * as React from 'react';
2
- interface MouseInteractiveProps {
3
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
4
- onContextMenu?: React.MouseEventHandler<HTMLButtonElement>;
5
- onDoubleClick?: React.MouseEventHandler<HTMLButtonElement>;
6
- onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
7
- onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
8
- onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
9
- onMouseMove?: React.MouseEventHandler<HTMLButtonElement>;
10
- onMouseOut?: React.MouseEventHandler<HTMLButtonElement>;
11
- onMouseOver?: React.MouseEventHandler<HTMLButtonElement>;
12
- onMouseUp?: React.MouseEventHandler<HTMLButtonElement>;
13
- 'aria-label'?: string;
14
- }
15
- export declare function transferInteractiveProps(iconProps: MouseInteractiveProps): {
16
- button: MouseInteractiveProps;
17
- icon: MouseInteractiveProps;
18
- };
19
- declare type CustomIconProps = {
20
- icon: React.ReactNode;
21
- iconIsAction?: boolean;
22
- iconIsFocusable?: boolean;
23
- iconPosition?: 'left' | 'right';
24
- };
25
- export declare const CustomIcon: React.FC<CustomIconProps>;
26
- export {};
@@ -1,43 +0,0 @@
1
- import * as React from 'react';
2
- import cn from 'classnames';
3
- import styles from '../input.p.module.css.js';
4
-
5
- function transferInteractiveProps(iconProps) {
6
- const props = ['onClick', 'onContextMenu', 'onDoubleClick', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'aria-label'];
7
- const button = Object.keys(iconProps).filter(key => props.indexOf(key) > -1).reduce((obj, key) => ({ ...obj,
8
- [key]: iconProps[key]
9
- }), {});
10
- const icon = Object.keys(button).reduce((obj, key) => ({ ...obj,
11
- [key]: null
12
- }), {});
13
- return {
14
- button,
15
- icon
16
- };
17
- }
18
-
19
- const CustomIcon = _ref => {
20
- let {
21
- icon,
22
- iconPosition,
23
- iconIsAction,
24
- iconIsFocusable
25
- } = _ref;
26
- const mouseEvents = transferInteractiveProps(icon.props);
27
- const iconJsx = /*#__PURE__*/React.cloneElement(icon, {
28
- focusable: false,
29
- className: cn(icon.props.className, styles.icon),
30
- 'data-render-all-sizes': true,
31
- ...mouseEvents.icon
32
- });
33
- return /*#__PURE__*/React.createElement("span", {
34
- role: iconIsAction ? 'button' : null,
35
- key: "icon",
36
- className: cn(styles.iconWrapper, styles[iconPosition], iconIsAction && styles.action),
37
- ...mouseEvents.button,
38
- "data-test": "input__icon",
39
- tabIndex: iconIsAction && iconIsFocusable ? 0 : -1
40
- }, iconJsx);
41
- };
42
-
43
- export { CustomIcon, transferInteractiveProps };
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import { InputSize } from '../input';
3
- declare type RightIconsProps = {
4
- busy?: boolean;
5
- onClear?: React.MouseEventHandler<HTMLButtonElement>;
6
- size?: InputSize;
7
- icon?: React.ReactNode;
8
- iconIsAction?: boolean;
9
- iconIsFocusable?: boolean;
10
- clearIcon?: React.ReactNode;
11
- empty: boolean;
12
- };
13
- export declare const RightIcons: React.FC<RightIconsProps>;
14
- export {};
@@ -1,57 +0,0 @@
1
- import * as React from 'react';
2
- import cn from 'classnames';
3
- import LoadingIcon from '../_virtual/loading.js';
4
- import styles from '../input.p.module.css.js';
5
- import { CustomIcon } from './custom-icon.js'; // eslint-disable-next-line complexity
6
-
7
- const RightIcons = _ref => {
8
- let {
9
- icon,
10
- busy,
11
- onClear,
12
- clearIcon,
13
- iconIsAction,
14
- iconIsFocusable,
15
- empty
16
- } = _ref;
17
- const icons = [];
18
-
19
- if (onClear && !empty) {
20
- icons.push(
21
- /*#__PURE__*/
22
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events
23
- React.createElement("span", {
24
- role: "button",
25
- key: "clear",
26
- className: cn(styles.iconWrapper, styles.right, styles.action),
27
- onClick: onClear,
28
- "data-test": "input__clear-icon",
29
- tabIndex: -1
30
- }, /*#__PURE__*/React.cloneElement(clearIcon, {
31
- focusable: false,
32
- className: cn(clearIcon.props.className, styles.icon),
33
- 'data-render-all-sizes': true
34
- })));
35
- }
36
-
37
- if (icon) {
38
- icons.push( /*#__PURE__*/React.createElement(CustomIcon, {
39
- key: "custom-icon",
40
- iconPosition: 'right',
41
- iconIsFocusable: iconIsFocusable,
42
- iconIsAction: iconIsAction,
43
- icon: icon
44
- }));
45
- }
46
-
47
- return /*#__PURE__*/React.createElement(React.Fragment, null, icons.slice(0, busy ? -1 : icons.length), busy && /*#__PURE__*/React.createElement("span", {
48
- key: "loading",
49
- className: cn(styles.iconWrapper, styles.right)
50
- }, /*#__PURE__*/React.createElement(LoadingIcon, {
51
- "data-test": "input__busy-icon",
52
- className: styles.icon,
53
- "data-render-all-sizes": true
54
- })));
55
- };
56
-
57
- export { RightIcons };