@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/dist/lui.esm.js
CHANGED
|
@@ -7169,22 +7169,60 @@ var LuiSelectInput = function (props) {
|
|
|
7169
7169
|
props.warning)))));
|
|
7170
7170
|
};
|
|
7171
7171
|
|
|
7172
|
-
var LuiTextAreaInput = function (props) {
|
|
7172
|
+
var LuiTextAreaInput = React__default.forwardRef(function (props, ref) {
|
|
7173
7173
|
var _a, _b;
|
|
7174
7174
|
var id = useGenerateOrDefaultId((_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.id);
|
|
7175
|
+
var rows = props.rows !== undefined ? props.rows : 5;
|
|
7176
|
+
console.log('🚀 ~ rows:', rows);
|
|
7175
7177
|
return (React__default.createElement("div", { className: clsx('LuiTextAreaInput', ((_b = props.inputProps) === null || _b === void 0 ? void 0 : _b.disabled) ? 'isDisabled' : '', props.error ? 'hasError' : '', props.warning ? 'hasWarning' : '') },
|
|
7176
7178
|
React__default.createElement("label", { htmlFor: id },
|
|
7177
7179
|
props.mandatory && (React__default.createElement("span", { className: "LuiTextAreaInput-mandatory" }, "*")),
|
|
7178
7180
|
React__default.createElement("span", { className: "LuiTextAreaInput-label" }, props.label),
|
|
7179
7181
|
React__default.createElement("div", { className: "LuiTextAreaInput-wrapper" },
|
|
7180
|
-
|
|
7181
|
-
React__default.createElement("textarea", __assign({ id: id, value: props.value, onChange: props.onChange, rows: 5 }, props.inputProps)))),
|
|
7182
|
+
React__default.createElement("textarea", __assign({ id: id, value: props.value, onChange: props.onChange, ref: ref, rows: rows }, props.inputProps)))),
|
|
7182
7183
|
props.error && (React__default.createElement("span", { className: "LuiTextAreaInput-error" },
|
|
7183
7184
|
React__default.createElement(LuiIcon, { alt: "error", name: "ic_error", className: "LuiTextAreaInput-error-icon", size: "sm", status: "error" }),
|
|
7184
7185
|
props.error)),
|
|
7185
7186
|
props.warning && (React__default.createElement("span", { className: "LuiTextAreaInput-warning" },
|
|
7186
7187
|
React__default.createElement(LuiIcon, { alt: "warning", name: "ic_warning", className: "LuiTextAreaInput-warning-icon", size: "sm", status: "warning" }),
|
|
7187
7188
|
props.warning))));
|
|
7189
|
+
});
|
|
7190
|
+
|
|
7191
|
+
// Example taken from https://codesandbox.io/p/github/philals/auto-size-input/main?file=%2Fsrc%2FApp.tsx%3A54%2C53&import=true&workspaceId=ws_HCohVkSSrGceH2wAjz2JrW
|
|
7192
|
+
// 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
|
|
7193
|
+
var LuiAutoExpandTextAreaInput = function (props) {
|
|
7194
|
+
var _a;
|
|
7195
|
+
var handleInputChange = function (e) {
|
|
7196
|
+
if (props.onChange) {
|
|
7197
|
+
props.onChange(e);
|
|
7198
|
+
}
|
|
7199
|
+
adjustHeight(e.target);
|
|
7200
|
+
};
|
|
7201
|
+
var ref = useRef(null);
|
|
7202
|
+
var adjustHeight = useCallback(function (element) {
|
|
7203
|
+
// Reset height to auto to get proper scrollHeight
|
|
7204
|
+
element.style.height = 'auto';
|
|
7205
|
+
var height = "".concat(element.scrollHeight, "px");
|
|
7206
|
+
// Set the height to match content
|
|
7207
|
+
element.style.height = height;
|
|
7208
|
+
}, []);
|
|
7209
|
+
useEffect(function () {
|
|
7210
|
+
if (ref.current) {
|
|
7211
|
+
adjustHeight(ref.current);
|
|
7212
|
+
}
|
|
7213
|
+
}, [props.value, adjustHeight]); // Re-run when value changes
|
|
7214
|
+
// Since we can't directly use refs, we'll use a custom render approach
|
|
7215
|
+
// We'll handle the auto-resize via the onChange and onKeyUp events
|
|
7216
|
+
var customInputProps = __assign(__assign({}, props.inputProps), { onKeyUp: function (e) {
|
|
7217
|
+
var _a;
|
|
7218
|
+
adjustHeight(e.currentTarget);
|
|
7219
|
+
if ((_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.onKeyUp) {
|
|
7220
|
+
props.inputProps.onKeyUp(e);
|
|
7221
|
+
}
|
|
7222
|
+
}, style: __assign({ resize: 'none', overflow: 'hidden', maxHeight: '500px',
|
|
7223
|
+
// boxSizing: 'border-box',
|
|
7224
|
+
minHeight: '1px' }, (_a = props.inputProps) === null || _a === void 0 ? void 0 : _a.style) });
|
|
7225
|
+
return (React__default.createElement(LuiTextAreaInput, __assign({}, props, { rows: 1, onChange: handleInputChange, inputProps: customInputProps, ref: ref })));
|
|
7188
7226
|
};
|
|
7189
7227
|
|
|
7190
7228
|
var LuiDateInput = React__default.forwardRef(function (_a, ref) {
|
|
@@ -35317,5 +35355,5 @@ var LuiErrorPanel = forwardRef$1(function (props, ref) {
|
|
|
35317
35355
|
props.subtext && (React__default.createElement("div", { className: "lui-error-panel-container-subtext", "data-testid": "lui-error-panel-container-subtext" }, props.subtext)))));
|
|
35318
35356
|
});
|
|
35319
35357
|
|
|
35320
|
-
export { CheckboxItemRenderer, ColorBucket, ColorInput, ColorInputGroup, ColorPalette, LuiAccordicard, LuiAccordicardStatic, LuiAccordion, LuiAlertModal, LuiAlertModalButtons, LuiAlertModalV2, LuiAppFooterSml, LuiBadge, LuiBanner, LuiBannerContent, LuiBannerV2, LuiBearingInput, LuiButton, LuiButtonGroup, LuiCheckboxInput, LuiCloseableHeaderMenuContext, LuiCloseableHeaderMenuContextV2, LuiCloseableHeaderMenuItem, LuiCloseableHeaderMenuItemV2, LuiComboSelect, LuiControlledMenu, LuiCounter, LuiDateInput, LuiDrawerMenu, LuiDrawerMenuDivider, LuiDrawerMenuDividerV2, LuiDrawerMenuOption, LuiDrawerMenuOptionV2, LuiDrawerMenuOptions, LuiDrawerMenuOptionsV2, LuiDrawerMenuSection, LuiDrawerMenuSectionV2, LuiDrawerMenuV2, LuiDropdownMenu, LuiDropdownMenuV2, LuiDropdownMenuV2DropContent, LuiErrorIllustration, LuiErrorPage, LuiErrorPanel, LuiExpandableBanner, LuiFileInputBox, LuiFilterContainer, LuiFilterMenu, LuiFooter, LuiFormSectionHeader, LuiHeader, LuiHeaderMenuItem, LuiHeaderMenuItemV2, LuiHeaderV2, LuiIcon, LuiListBox, LuiLoadingSpinner, LuiMenu, LuiMenuCloseButton, LuiMenuCloseButtonV2, LuiMessagingContextProvider, LuiMiniSpinner, LuiModal, LuiModalV2, LuiMoneyInput, LuiMultiSwitch, LuiMultiSwitchYesNo, LuiPagination, LuiPassiveSearchInput, LuiProgressBar, LuiRadioInput, LuiResizableLayout, LuiSearchBox, LuiSearchInput, LuiSelectDataMenu, LuiSelectInput, LuiSelectMenu, LuiSelectMenuDivider, LuiSelectMenuHeader, LuiSelectMenuItem, LuiSelectMenuItemSwitch, LuiSelectSubMenuItem, LuiShadow, LuiSideMenu, LuiSideMenuItem, LuiSidePanel, LuiSidePanelProvider, LuiSideToolbar, LuiSplitButton, LuiSplitButtonMenuItem, LuiSplitButtonPosition, LuiStaticMessage, LuiStatusSpinner, LuiSwitchButton, LuiTab, LuiTabs, LuiTabsContext, LuiTabsGroup, LuiTabsPanel, LuiTabsPanelSwitch, LuiTextAreaInput, LuiTextInput, LuiToastMessage, LuiTooltip, LuiUpdatesSplashModal, RadioItemRenderer, SplitPanelState, Splitter, ToolbarButton, ToolbarDirection, ToolbarItem, ToolbarItemSeparator, breakpointQuery, breakpoints, defaultColours, isChromatic, useClickedOutsideElement, useEscapeFunction, useLuiCloseableHeaderMenuContextV2, useMediaQuery, usePageClickFunction, useShowLUIMessage, useSplitterRef, useToast };
|
|
35358
|
+
export { CheckboxItemRenderer, ColorBucket, ColorInput, ColorInputGroup, ColorPalette, LuiAccordicard, LuiAccordicardStatic, LuiAccordion, LuiAlertModal, LuiAlertModalButtons, LuiAlertModalV2, LuiAppFooterSml, LuiAutoExpandTextAreaInput, LuiBadge, LuiBanner, LuiBannerContent, LuiBannerV2, LuiBearingInput, LuiButton, LuiButtonGroup, LuiCheckboxInput, LuiCloseableHeaderMenuContext, LuiCloseableHeaderMenuContextV2, LuiCloseableHeaderMenuItem, LuiCloseableHeaderMenuItemV2, LuiComboSelect, LuiControlledMenu, LuiCounter, LuiDateInput, LuiDrawerMenu, LuiDrawerMenuDivider, LuiDrawerMenuDividerV2, LuiDrawerMenuOption, LuiDrawerMenuOptionV2, LuiDrawerMenuOptions, LuiDrawerMenuOptionsV2, LuiDrawerMenuSection, LuiDrawerMenuSectionV2, LuiDrawerMenuV2, LuiDropdownMenu, LuiDropdownMenuV2, LuiDropdownMenuV2DropContent, LuiErrorIllustration, LuiErrorPage, LuiErrorPanel, LuiExpandableBanner, LuiFileInputBox, LuiFilterContainer, LuiFilterMenu, LuiFooter, LuiFormSectionHeader, LuiHeader, LuiHeaderMenuItem, LuiHeaderMenuItemV2, LuiHeaderV2, LuiIcon, LuiListBox, LuiLoadingSpinner, LuiMenu, LuiMenuCloseButton, LuiMenuCloseButtonV2, LuiMessagingContextProvider, LuiMiniSpinner, LuiModal, LuiModalV2, LuiMoneyInput, LuiMultiSwitch, LuiMultiSwitchYesNo, LuiPagination, LuiPassiveSearchInput, LuiProgressBar, LuiRadioInput, LuiResizableLayout, LuiSearchBox, LuiSearchInput, LuiSelectDataMenu, LuiSelectInput, LuiSelectMenu, LuiSelectMenuDivider, LuiSelectMenuHeader, LuiSelectMenuItem, LuiSelectMenuItemSwitch, LuiSelectSubMenuItem, LuiShadow, LuiSideMenu, LuiSideMenuItem, LuiSidePanel, LuiSidePanelProvider, LuiSideToolbar, LuiSplitButton, LuiSplitButtonMenuItem, LuiSplitButtonPosition, LuiStaticMessage, LuiStatusSpinner, LuiSwitchButton, LuiTab, LuiTabs, LuiTabsContext, LuiTabsGroup, LuiTabsPanel, LuiTabsPanelSwitch, LuiTextAreaInput, LuiTextInput, LuiToastMessage, LuiTooltip, LuiUpdatesSplashModal, RadioItemRenderer, SplitPanelState, Splitter, ToolbarButton, ToolbarDirection, ToolbarItem, ToolbarItemSeparator, breakpointQuery, breakpoints, defaultColours, isChromatic, useClickedOutsideElement, useEscapeFunction, useLuiCloseableHeaderMenuContextV2, useMediaQuery, usePageClickFunction, useShowLUIMessage, useSplitterRef, useToast };
|
|
35321
35359
|
//# sourceMappingURL=lui.esm.js.map
|