@linzjs/lui 23.5.0 → 23.6.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 +14 -0
- package/dist/components/LuiFormElements/LuiTextAreaInput/LuiAutoExpandTextAreaInput.d.ts +3 -0
- package/dist/components/LuiFormElements/LuiTextAreaInput/LuiTextAreaInput.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +42 -3
- package/dist/index.js.map +1 -1
- package/dist/lui.esm.js +42 -4
- package/dist/lui.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [23.6.1](https://github.com/linz/lui/compare/v23.6.0...v23.6.1) (2025-07-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* missed export ([#1236](https://github.com/linz/lui/issues/1236)) ([5cb08c0](https://github.com/linz/lui/commit/5cb08c048f85a5a994cf0029dbeb6e8fec3cf90d))
|
|
7
|
+
|
|
8
|
+
# [23.6.0](https://github.com/linz/lui/compare/v23.5.0...v23.6.0) (2025-07-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Adds an autoexpanding TextArea. Can be replaced with native CSS in a year ([#1235](https://github.com/linz/lui/issues/1235)) ([8ec3398](https://github.com/linz/lui/commit/8ec33987889a08ef9c9eb9a4aa13c6dbbcad9e5c))
|
|
14
|
+
|
|
1
15
|
# [23.5.0](https://github.com/linz/lui/compare/v23.4.0...v23.5.0) (2025-07-02)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventHandler, InputHTMLAttributes } from 'react';
|
|
1
|
+
import React, { ChangeEventHandler, InputHTMLAttributes } from 'react';
|
|
2
2
|
export interface LuiTextAreaInputProps {
|
|
3
3
|
label: JSX.Element | string;
|
|
4
4
|
mandatory?: boolean;
|
|
@@ -7,5 +7,6 @@ export interface LuiTextAreaInputProps {
|
|
|
7
7
|
value: string;
|
|
8
8
|
error?: string | boolean;
|
|
9
9
|
warning?: string;
|
|
10
|
+
rows?: number;
|
|
10
11
|
}
|
|
11
|
-
export declare const LuiTextAreaInput:
|
|
12
|
+
export declare const LuiTextAreaInput: React.ForwardRefExoticComponent<LuiTextAreaInputProps & React.RefAttributes<HTMLTextAreaElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { LuiCheckboxInput } from './components/LuiFormElements/LuiCheckboxInput/
|
|
|
20
20
|
export { LuiFileInputBox } from './components/LuiFormElements/LuiFileInputBox/LuiFileInputBox';
|
|
21
21
|
export { LuiSelectInput } from './components/LuiFormElements/LuiSelectInput/LuiSelectInput';
|
|
22
22
|
export { LuiTextAreaInput } from './components/LuiFormElements/LuiTextAreaInput/LuiTextAreaInput';
|
|
23
|
+
export { LuiAutoExpandTextAreaInput } from './components/LuiFormElements/LuiTextAreaInput/LuiAutoExpandTextAreaInput';
|
|
23
24
|
export { LuiTextInput } from './components/LuiFormElements/LuiTextInput/LuiTextInput';
|
|
24
25
|
export { LuiDateInput } from './components/LuiFormElements/LuiDateInput/LuiDateInput';
|
|
25
26
|
export { LuiMoneyInput } from './components/LuiFormElements/LuiMoneyInput/LuiMoneyInput';
|
package/dist/index.js
CHANGED
|
@@ -7198,22 +7198,60 @@ var LuiSelectInput = function (props) {
|
|
|
7198
7198
|
props.warning)))));
|
|
7199
7199
|
};
|
|
7200
7200
|
|
|
7201
|
-
var LuiTextAreaInput = function (props) {
|
|
7201
|
+
var LuiTextAreaInput = React__default["default"].forwardRef(function (props, ref) {
|
|
7202
7202
|
var _a, _b;
|
|
7203
7203
|
var id = useGenerateOrDefaultId((_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.id);
|
|
7204
|
+
var rows = props.rows !== undefined ? props.rows : 5;
|
|
7205
|
+
console.log('🚀 ~ rows:', rows);
|
|
7204
7206
|
return (React__default["default"].createElement("div", { className: clsx('LuiTextAreaInput', ((_b = props.inputProps) === null || _b === void 0 ? void 0 : _b.disabled) ? 'isDisabled' : '', props.error ? 'hasError' : '', props.warning ? 'hasWarning' : '') },
|
|
7205
7207
|
React__default["default"].createElement("label", { htmlFor: id },
|
|
7206
7208
|
props.mandatory && (React__default["default"].createElement("span", { className: "LuiTextAreaInput-mandatory" }, "*")),
|
|
7207
7209
|
React__default["default"].createElement("span", { className: "LuiTextAreaInput-label" }, props.label),
|
|
7208
7210
|
React__default["default"].createElement("div", { className: "LuiTextAreaInput-wrapper" },
|
|
7209
|
-
|
|
7210
|
-
React__default["default"].createElement("textarea", __assign({ id: id, value: props.value, onChange: props.onChange, rows: 5 }, props.inputProps)))),
|
|
7211
|
+
React__default["default"].createElement("textarea", __assign({ id: id, value: props.value, onChange: props.onChange, ref: ref, rows: rows }, props.inputProps)))),
|
|
7211
7212
|
props.error && (React__default["default"].createElement("span", { className: "LuiTextAreaInput-error" },
|
|
7212
7213
|
React__default["default"].createElement(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextAreaInput-error-icon", size: "sm", status: "error" }),
|
|
7213
7214
|
props.error)),
|
|
7214
7215
|
props.warning && (React__default["default"].createElement("span", { className: "LuiTextAreaInput-warning" },
|
|
7215
7216
|
React__default["default"].createElement(LuiIcon, { alt: "warning", name: "ic_warning", className: "LuiTextAreaInput-warning-icon", size: "sm", status: "warning" }),
|
|
7216
7217
|
props.warning))));
|
|
7218
|
+
});
|
|
7219
|
+
|
|
7220
|
+
// Example taken from https://codesandbox.io/p/github/philals/auto-size-input/main?file=%2Fsrc%2FApp.tsx%3A54%2C53&import=true&workspaceId=ws_HCohVkSSrGceH2wAjz2JrW
|
|
7221
|
+
// Note soon this can be replaced by the new CSS class field-sizing (https://developer.mozilla.org/en-US/docs/Web/CSS/field-sizing)h
|
|
7222
|
+
var LuiAutoExpandTextAreaInput = function (props) {
|
|
7223
|
+
var _a;
|
|
7224
|
+
var handleInputChange = function (e) {
|
|
7225
|
+
if (props.onChange) {
|
|
7226
|
+
props.onChange(e);
|
|
7227
|
+
}
|
|
7228
|
+
adjustHeight(e.target);
|
|
7229
|
+
};
|
|
7230
|
+
var ref = React.useRef(null);
|
|
7231
|
+
var adjustHeight = React.useCallback(function (element) {
|
|
7232
|
+
// Reset height to auto to get proper scrollHeight
|
|
7233
|
+
element.style.height = 'auto';
|
|
7234
|
+
var height = "".concat(element.scrollHeight, "px");
|
|
7235
|
+
// Set the height to match content
|
|
7236
|
+
element.style.height = height;
|
|
7237
|
+
}, []);
|
|
7238
|
+
React.useEffect(function () {
|
|
7239
|
+
if (ref.current) {
|
|
7240
|
+
adjustHeight(ref.current);
|
|
7241
|
+
}
|
|
7242
|
+
}, [props.value, adjustHeight]); // Re-run when value changes
|
|
7243
|
+
// Since we can't directly use refs, we'll use a custom render approach
|
|
7244
|
+
// We'll handle the auto-resize via the onChange and onKeyUp events
|
|
7245
|
+
var customInputProps = __assign(__assign({}, props.inputProps), { onKeyUp: function (e) {
|
|
7246
|
+
var _a;
|
|
7247
|
+
adjustHeight(e.currentTarget);
|
|
7248
|
+
if ((_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.onKeyUp) {
|
|
7249
|
+
props.inputProps.onKeyUp(e);
|
|
7250
|
+
}
|
|
7251
|
+
}, style: __assign({ resize: 'none', overflow: 'hidden', maxHeight: '500px',
|
|
7252
|
+
// boxSizing: 'border-box',
|
|
7253
|
+
minHeight: '1px' }, (_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.style) });
|
|
7254
|
+
return (React__default["default"].createElement(LuiTextAreaInput, __assign({}, props, { rows: 1, onChange: handleInputChange, inputProps: customInputProps, ref: ref })));
|
|
7217
7255
|
};
|
|
7218
7256
|
|
|
7219
7257
|
var LuiDateInput = React__default["default"].forwardRef(function (_a, ref) {
|
|
@@ -35358,6 +35396,7 @@ exports.LuiAlertModal = LuiAlertModal;
|
|
|
35358
35396
|
exports.LuiAlertModalButtons = LuiAlertModalButtons;
|
|
35359
35397
|
exports.LuiAlertModalV2 = LuiAlertModalV2;
|
|
35360
35398
|
exports.LuiAppFooterSml = LuiAppFooterSml;
|
|
35399
|
+
exports.LuiAutoExpandTextAreaInput = LuiAutoExpandTextAreaInput;
|
|
35361
35400
|
exports.LuiBadge = LuiBadge;
|
|
35362
35401
|
exports.LuiBanner = LuiBanner;
|
|
35363
35402
|
exports.LuiBannerContent = LuiBannerContent;
|