x-ui-design 1.0.31 → 1.0.33
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/dist/esm/types/components/Input/Input.d.ts +3 -7
- package/dist/esm/types/index.d.ts +1 -7
- package/dist/esm/types/types/input.d.ts +2 -2
- package/dist/index.d.ts +1 -7
- package/dist/index.esm.js +26 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +1 -1
- package/lib/components/Input/Input.tsx +9 -19
- package/lib/components/Select/Select.tsx +3 -3
- package/lib/components/Switch/Switch.tsx +2 -2
- package/lib/types/input.ts +2 -2
- package/package.json +5 -5
- package/src/app/page.tsx +14 -13
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React, {
|
|
4
|
-
ForwardedRef,
|
|
5
4
|
KeyboardEvent,
|
|
6
5
|
MouseEvent,
|
|
7
6
|
useEffect,
|
|
@@ -18,15 +17,7 @@ import { ErrorIcon } from '../Icons/Icons';
|
|
|
18
17
|
import { applyMask, MASK_CHAR, MASK_REGEX, stripMask } from '../../helpers/mask';
|
|
19
18
|
import './style.css';
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
focus: () => void;
|
|
23
|
-
input: HTMLInputElement | null;
|
|
24
|
-
blur: () => void;
|
|
25
|
-
nativeElement: HTMLInputElement | null;
|
|
26
|
-
setSelectionRange: (start: number, end: number) => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const InputComponent = React.forwardRef<InputHandle, InputProps>(({
|
|
20
|
+
const InputComponent = ({
|
|
30
21
|
size = 'large',
|
|
31
22
|
error,
|
|
32
23
|
suffix,
|
|
@@ -54,8 +45,9 @@ const InputComponent = React.forwardRef<InputHandle, InputProps>(({
|
|
|
54
45
|
defaultValue,
|
|
55
46
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
56
47
|
child,
|
|
48
|
+
ref,
|
|
57
49
|
...props
|
|
58
|
-
}
|
|
50
|
+
}: InputProps) => {
|
|
59
51
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
60
52
|
const lastKeyPressed = useRef<string | null>(null);
|
|
61
53
|
const internalValue = mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : value ?? '';
|
|
@@ -64,20 +56,18 @@ const InputComponent = React.forwardRef<InputHandle, InputProps>(({
|
|
|
64
56
|
const animationRef = useRef<number | null>(null);
|
|
65
57
|
|
|
66
58
|
useImperativeHandle(ref, () => ({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
focus: inputRef.current?.focus,
|
|
70
62
|
input: inputRef.current,
|
|
71
|
-
blur: (
|
|
72
|
-
inputRef.current?.blur()
|
|
73
|
-
},
|
|
63
|
+
blur: (inputRef.current as HTMLInputElement).blur,
|
|
74
64
|
nativeElement: inputRef.current,
|
|
75
65
|
setSelectionRange: (start: number, end: number) => {
|
|
76
66
|
if (inputRef.current) {
|
|
77
67
|
inputRef.current.setSelectionRange(start, end);
|
|
78
68
|
}
|
|
79
69
|
}
|
|
80
|
-
})
|
|
70
|
+
}));
|
|
81
71
|
|
|
82
72
|
useEffect(() => {
|
|
83
73
|
setMaskValue(mask ? applyMask(stripMask(`${value ?? ''}`, mask, maskChar), mask, maskChar).masked : (value ?? ''));
|
|
@@ -215,7 +205,7 @@ const InputComponent = React.forwardRef<InputHandle, InputProps>(({
|
|
|
215
205
|
) : null}
|
|
216
206
|
</div>
|
|
217
207
|
);
|
|
218
|
-
}
|
|
208
|
+
};
|
|
219
209
|
|
|
220
210
|
InputComponent.displayName = 'Input';
|
|
221
211
|
|
|
@@ -749,7 +749,7 @@ const Select = ({
|
|
|
749
749
|
className={`${prefixCls}-tag-input`}
|
|
750
750
|
/>
|
|
751
751
|
{!hasMode && !searchQuery.length ? (selected === ''
|
|
752
|
-
? placeholder
|
|
752
|
+
? <div style={{ display: 'contents' }}>{placeholder}</div>
|
|
753
753
|
: selectedOption) : null}
|
|
754
754
|
</div>
|
|
755
755
|
) : !hasMode ? (
|
|
@@ -758,7 +758,7 @@ const Select = ({
|
|
|
758
758
|
style={{ opacity: isOpen || selected === '' ? '0.6' : '1' }}
|
|
759
759
|
>
|
|
760
760
|
{selected === ''
|
|
761
|
-
? placeholder
|
|
761
|
+
? <div style={{ display: 'contents' }}>{placeholder}</div>
|
|
762
762
|
: selectedOption}
|
|
763
763
|
</div>
|
|
764
764
|
) : null}
|
|
@@ -770,7 +770,7 @@ const Select = ({
|
|
|
770
770
|
style={{ opacity: isOpen || selected === '' ? '0.6' : '1' }}
|
|
771
771
|
>
|
|
772
772
|
{selected === ''
|
|
773
|
-
? placeholder
|
|
773
|
+
? <div style={{ display: 'contents' }}>{placeholder}</div>
|
|
774
774
|
: selectedOption}
|
|
775
775
|
</div>
|
|
776
776
|
) : null}
|
|
@@ -48,12 +48,12 @@ const Switch = ({
|
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<div
|
|
51
|
+
tabIndex={0}
|
|
52
|
+
role="button"
|
|
51
53
|
className={`${prefixCls}-wrapper ${prefixClsV3}-wrapper ${className} ${disabled ? `${prefixCls}__disabled ${prefixClsV3}__disabled` : ''}`}
|
|
52
54
|
style={style}
|
|
53
55
|
>
|
|
54
56
|
<div
|
|
55
|
-
tabIndex={0}
|
|
56
|
-
role="button"
|
|
57
57
|
className={`${prefixCls} ${prefixClsV3} ${internalChecked ? `${prefixCls}__checked ${prefixClsV3}__checked` : ''}`}
|
|
58
58
|
onClick={handleClick}
|
|
59
59
|
>
|
package/lib/types/input.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ReactNode,
|
|
10
10
|
TextareaHTMLAttributes
|
|
11
11
|
} from 'react';
|
|
12
|
-
import { DefaultProps,
|
|
12
|
+
import { DefaultProps, SizeType, SyntheticBaseEvent } from '.';
|
|
13
13
|
|
|
14
14
|
export type InputProps = Omit<
|
|
15
15
|
InputHTMLAttributes<HTMLInputElement>,
|
|
@@ -38,7 +38,7 @@ export type InputProps = Omit<
|
|
|
38
38
|
mask?: string;
|
|
39
39
|
maskChar?: string;
|
|
40
40
|
maskRegex?: RegExp;
|
|
41
|
-
ref?:
|
|
41
|
+
ref?: ForwardedRef<HTMLInputElement>,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export type TextareaProps = Omit<
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-ui-design",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": "Gabriel Boyajyan",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
30
30
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
31
31
|
"@types/node": "^20",
|
|
32
|
-
"@types/react": "^19
|
|
33
|
-
"@types/react-dom": "^19
|
|
32
|
+
"@types/react": "^19",
|
|
33
|
+
"@types/react-dom": "^19",
|
|
34
34
|
"eslint": "^9",
|
|
35
35
|
"eslint-config-next": "15.2.0",
|
|
36
36
|
"postcss": "^8.5.3",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "^5.8.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"react": "^19.
|
|
45
|
-
"react-dom": "^19.
|
|
44
|
+
"react": "^19.1.0",
|
|
45
|
+
"react-dom": "^19.1.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/app/page.tsx
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { Result } from "../../lib/components/Result";
|
|
4
|
+
import { Button } from '../../lib/components/Button';
|
|
5
|
+
import { Popover } from '../../lib/components/Popover';
|
|
6
|
+
import { Select } from "../../lib/components/Select";
|
|
7
|
+
import Option from "../../lib/components/Select/Option/Option";
|
|
8
|
+
import Tag from "../../lib/components/Select/Tag/Tag";
|
|
5
9
|
|
|
6
10
|
export default function Home() {
|
|
7
|
-
const ref = useRef<any>(null);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (ref.current) {
|
|
11
|
-
console.log(ref.current);
|
|
12
|
-
|
|
13
|
-
ref.current?.focus();
|
|
14
|
-
}
|
|
15
|
-
}, [])
|
|
16
|
-
|
|
17
11
|
return (
|
|
18
|
-
<
|
|
12
|
+
<Select mode="tags"
|
|
13
|
+
tagRender={(tagProps) => {
|
|
14
|
+
return <Tag {...tagProps}>{tagProps.value}</Tag>
|
|
15
|
+
}}
|
|
16
|
+
options={[{ value: 'tag_1', label: 'Tag 1' }]}
|
|
17
|
+
/>
|
|
18
|
+
// {/* <Option value={'tag_1'}>tag 1</Option> */}
|
|
19
|
+
// </Select>
|
|
19
20
|
)
|
|
20
21
|
}
|
|
21
22
|
|