ant-float-label 1.0.3 → 1.0.5
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/README.md +16 -1
- package/dist/README.md +16 -1
- package/dist/component/FloatPassword/index.d.ts +5 -0
- package/dist/index.css +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +31 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Antd 5 form style similar to MUI
|
|
2
2
|
|
|
3
|
-
```
|
|
3
|
+
```sh
|
|
4
4
|
npm install ant-float-label
|
|
5
5
|
```
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import {
|
|
9
|
+
FloatDatePicker,
|
|
10
|
+
FloatInput,
|
|
11
|
+
FloatInputNumber,
|
|
12
|
+
FloatSelect,
|
|
13
|
+
FloatRangePicker,
|
|
14
|
+
FloatCascader,
|
|
15
|
+
FloatTreeSelect,
|
|
16
|
+
FloatAutoComplete,
|
|
17
|
+
FloatTimePicker,
|
|
18
|
+
} from "ant-float-label";
|
|
19
|
+
```
|
|
20
|
+
|
|
6
21
|

|
package/dist/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# Antd 5 form style similar to MUI
|
|
2
2
|
|
|
3
|
-
```
|
|
3
|
+
```sh
|
|
4
4
|
npm install ant-float-label
|
|
5
5
|
```
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import {
|
|
9
|
+
FloatDatePicker,
|
|
10
|
+
FloatInput,
|
|
11
|
+
FloatInputNumber,
|
|
12
|
+
FloatSelect,
|
|
13
|
+
FloatRangePicker,
|
|
14
|
+
FloatCascader,
|
|
15
|
+
FloatTreeSelect,
|
|
16
|
+
FloatAutoComplete,
|
|
17
|
+
FloatTimePicker,
|
|
18
|
+
} from "ant-float-label";
|
|
19
|
+
```
|
|
20
|
+
|
|
6
21
|

|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PasswordProps } from "antd/es/input";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
export interface FloatPasswordProps extends PasswordProps {
|
|
4
|
+
}
|
|
5
|
+
export declare function FloatPassword({ placeholder, onFocus, onBlur, value, defaultValue, style, size, ...restProps }: FloatPasswordProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
.ant-float-label-box{position:relative;line-height:normal;}.ant-float-label-box-label{position:absolute;max-width:99%;overflow:hidden;text-overflow:ellipsis;left:0;top:0;font-size:0.85rem;white-space:nowrap;font-weight:400;transform-origin:top left;pointer-events:none;height:100%;display:flex;align-items:center;transition:color 200ms cubic-bezier(0,0,0.2,1) 0ms,transform 200ms cubic-bezier(0,0,0.2,1) 0ms,max-width 200ms cubic-bezier(0,0,0.2,1) 0ms;}.ant-float-label-box-fieldset{padding:0 8px;position:absolute;top:-5px;left:0;right:0;bottom:0;margin:0;pointer-events:none;text-align:left;box-sizing:border-box;min-width:0%;}.ant-float-label-box-legend{width:auto;overflow:hidden;display:block;padding:0;height:11px;font-size:0.85rem;visibility:hidden;transition:max-width 100ms cubic-bezier(0.0,0,0.2,1) 50ms;white-space:nowrap;padding-inline:0;}
|
|
1
|
+
.ant-float-label-box{position:relative;line-height:normal;}.ant-float-label-box-label{position:absolute;max-width:99%;overflow:hidden;text-overflow:ellipsis;left:0;top:0;font-size:0.85rem;white-space:nowrap;font-weight:400;transform-origin:top left;pointer-events:none;height:100%;display:flex;align-items:center;transition:color 200ms cubic-bezier(0,0,0.2,1) 0ms,transform 200ms cubic-bezier(0,0,0.2,1) 0ms,max-width 200ms cubic-bezier(0,0,0.2,1) 0ms;}.ant-float-label-box-fieldset{padding:0 8px;position:absolute;top:-5px;left:0;right:0;bottom:0;margin:0;pointer-events:none;text-align:left;box-sizing:border-box;min-width:0%;}.ant-float-label-box-legend{width:auto!important;overflow:hidden;display:block;padding:0!important;height:11px!important;font-size:0.85rem!important;visibility:hidden;transition:max-width 100ms cubic-bezier(0.0,0,0.2,1) 50ms;white-space:nowrap;padding-inline:0!important;}
|
|
2
2
|
.ant-float-label-form-auto-complete .ant-select-selector {border:none!important;box-shadow:none!important;}
|
|
3
3
|
.ant-float-label-form-picker {border:none!important;box-shadow:none!important;}
|
|
4
4
|
.ant-float-label-form-input-number {border:none!important;box-shadow:none!important;}
|
|
5
5
|
.ant-float-label-form-picker {border:none!important;box-shadow:none!important;}
|
|
6
|
-
.ant-float-label-form-select .ant-select-selector {border:none!important;box-shadow:none!important;}.ant-float-label-form-select{height:auto!important;}
|
|
6
|
+
.ant-float-label-form-select .ant-select-selector {border:none!important;box-shadow:none!important;}.ant-float-label-form-select{height:auto!important;}
|
|
7
|
+
.ant-float-label-form-input-password{position:static;}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -388,4 +388,34 @@ function FloatTreeSelect({ placeholder, onFocus, onBlur, value, defaultValue, st
|
|
|
388
388
|
}, ...restProps, onFocus: handleFocus, onBlur: handleBlur, value: value, defaultValue: defaultValue, size: size, onChange: handleChange, rootClassName: "ant-float-label-form-select" }) }));
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
|
|
391
|
+
const { Password } = Input;
|
|
392
|
+
function FloatPassword({ placeholder, onFocus, onBlur, value, defaultValue, style, size, ...restProps }) {
|
|
393
|
+
const initFlag = useRef(false);
|
|
394
|
+
const [isFocus, setIsFocus] = useState(false);
|
|
395
|
+
const [inputValue, setInputValue] = useState(defaultValue ?? value);
|
|
396
|
+
const handleFocus = useCallback((e) => {
|
|
397
|
+
setIsFocus(true);
|
|
398
|
+
if (onFocus) {
|
|
399
|
+
onFocus(e);
|
|
400
|
+
}
|
|
401
|
+
}, [onFocus]);
|
|
402
|
+
const handleBlur = useCallback((e) => {
|
|
403
|
+
setIsFocus(false);
|
|
404
|
+
setInputValue(e.target.value);
|
|
405
|
+
if (onBlur) {
|
|
406
|
+
onBlur(e);
|
|
407
|
+
}
|
|
408
|
+
}, [onBlur]);
|
|
409
|
+
useEffect(() => {
|
|
410
|
+
if (initFlag.current) {
|
|
411
|
+
setInputValue(value);
|
|
412
|
+
}
|
|
413
|
+
initFlag.current = true;
|
|
414
|
+
return () => {
|
|
415
|
+
initFlag.current = false;
|
|
416
|
+
};
|
|
417
|
+
}, [value]);
|
|
418
|
+
return (jsx(FloattingLabelBox, { label: placeholder, focused: isFocus, haveValue: !!inputValue, width: style?.width, height: style?.height, status: restProps.status, children: jsx(Password, { style: { ...style, width: "100%", border: "none" }, ...restProps, onFocus: handleFocus, onBlur: handleBlur, value: value, defaultValue: defaultValue, size: size, rootClassName: "ant-float-label-form-input-password" }) }));
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export { FloatAutoComplete, FloatCascader, FloatDatePicker, FloatInput, FloatInputNumber, FloatPassword, FloatRangePicker, FloatSelect, FloatTimePicker, FloatTreeSelect, FloattingLabelBox };
|
package/dist/package.json
CHANGED