ant-float-label 1.0.3 → 1.0.4

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 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
  ![Alt text](image.png)
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
  ![Alt text](image.png)
@@ -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
@@ -3,4 +3,5 @@
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
@@ -8,3 +8,4 @@ export * from "./component/FloatSelect";
8
8
  export * from "./component/FloatTimePicker";
9
9
  export * from "./component/FloattingLabelBox";
10
10
  export * from "./component/FloatTreeSelect";
11
+ export * from "./component/FloatPassword";
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
- export { FloatAutoComplete, FloatCascader, FloatDatePicker, FloatInput, FloatInputNumber, FloatRangePicker, FloatSelect, FloatTimePicker, FloatTreeSelect, FloattingLabelBox };
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ant-float-label",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Antd 5 form style similar to MUI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ant-float-label",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Antd 5 form style similar to MUI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",