@linzjs/lui 19.0.0 → 20.0.1
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/CHANGELOG.md +9 -0
- package/dist/components/LuiFormElements/LuiDateInput/FireDateChange.d.ts +1 -0
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/lui.css +2 -0
- package/dist/lui.css.map +1 -1
- package/dist/lui.esm.js +16 -6
- package/dist/lui.esm.js.map +1 -1
- package/dist/scss/Elements/Forms/plain-form-common.scss +3 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [20.0.1](https://github.com/linz/lui/compare/v20.0.0...v20.0.1) (2023-09-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **LuiDateInput:** fire onChange upon valid paste ([#1009](https://github.com/linz/lui/issues/1009)) ([3b15b3e](https://github.com/linz/lui/commit/3b15b3e28b13011eacc5a06504733b5280db4c76))
|
|
7
|
+
|
|
8
|
+
# [20.0.0](https://github.com/linz/lui/compare/v19.0.0...v20.0.0) (2023-09-18)
|
|
9
|
+
|
|
1
10
|
# [19.0.0](https://github.com/linz/lui/compare/v18.11.2...v19.0.0) (2023-09-14)
|
|
2
11
|
|
|
3
12
|
## [18.11.2](https://github.com/linz/lui/compare/v18.11.1...v18.11.2) (2023-09-13)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fireDateChange: (e: React.ClipboardEvent<HTMLInputElement>) => void;
|
package/dist/index.js
CHANGED
|
@@ -28263,14 +28263,24 @@ var parseTextDate = function (value, options) {
|
|
|
28263
28263
|
}
|
|
28264
28264
|
};
|
|
28265
28265
|
|
|
28266
|
+
var fireDateChange = function (e) {
|
|
28267
|
+
var input = e.currentTarget;
|
|
28268
|
+
var clipboard = e.clipboardData.getData('text');
|
|
28269
|
+
var parsedValue = parseTextDate(clipboard, { allowTwoDigitYear: true });
|
|
28270
|
+
if (parsedValue) {
|
|
28271
|
+
var change = new InputEvent('change', {
|
|
28272
|
+
bubbles: true,
|
|
28273
|
+
cancelable: true
|
|
28274
|
+
});
|
|
28275
|
+
input.valueAsDate = new Date(parsedValue);
|
|
28276
|
+
input.dispatchEvent(change);
|
|
28277
|
+
}
|
|
28278
|
+
};
|
|
28279
|
+
|
|
28266
28280
|
var DateInput = React.forwardRef(function (props, ref) {
|
|
28267
28281
|
var valueProp = props.value, onChangeProp = props.onChange, onPasteProp = props.onPaste, inputProps = __rest(props, ["value", "onChange", "onPaste"]);
|
|
28268
|
-
return (React__default["default"].createElement("input", __assign({}, inputProps, { ref: ref, pattern: "d{2}/d{2}/d{4}", placeholder: "dd/mm/yyyy", type:
|
|
28269
|
-
|
|
28270
|
-
var parsedValue = parseTextDate(data, { allowTwoDigitYear: true });
|
|
28271
|
-
if (parsedValue) {
|
|
28272
|
-
e.currentTarget.value = parsedValue;
|
|
28273
|
-
}
|
|
28282
|
+
return (React__default["default"].createElement("input", __assign({}, inputProps, { ref: ref, pattern: "d{2}/d{2}/d{4}", placeholder: "dd/mm/yyyy", type: "date", value: valueProp, onChange: onChangeProp, onPaste: function (e) {
|
|
28283
|
+
fireDateChange(e);
|
|
28274
28284
|
onPasteProp === null || onPasteProp === void 0 ? void 0 : onPasteProp(e);
|
|
28275
28285
|
} })));
|
|
28276
28286
|
});
|