Skip to content

Commit

Permalink
Merge pull request #1809 from epam/feature/TextArea-design-improvement
Browse files Browse the repository at this point in the history
[TextArea]: deprecated size 48
  • Loading branch information
AlekseyManetov authored Dec 8, 2023
2 parents 2d019a5 + 70d114d commit 4c85213
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 25 deletions.
2 changes: 2 additions & 0 deletions app/src/docs/TextArea.doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import * as uui from '@epam/uui';
import * as loveship from '@epam/loveship';
import * as promo from '@epam/promo';
import * as electric from '@epam/electric';
import { DocBuilder, TDocConfig, TDocContext, TSkin } from '@epam/uui-docs';
import { EditableDocContent, DocExample, BaseDocsBlock } from '../common';

Expand All @@ -15,6 +16,7 @@ export class TextAreaDoc extends BaseDocsBlock {
[TSkin.Loveship]: { type: '@epam/uui:TextAreaProps', component: loveship.TextArea },
[TSkin.Promo]: { type: '@epam/uui:TextAreaProps', component: promo.TextArea },
[TSkin.UUI]: { type: '@epam/uui:TextAreaProps', component: uui.TextArea },
[TSkin.Electric]: { type: '@epam/uui:TextAreaProps', component: electric.TextArea },
},
doc: (doc: DocBuilder<uui.TextAreaProps>) => {
doc.merge('mode', { defaultValue: 'form' });
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* Added `clearAllChecked()` method to `IDataSourceView` interface to support unchecking all without enabled `selectAll` flag.
* Reduced amount of loaded data while clearing all checked elements in `cascadeSelection: false` mode.
* [LazyDataSource]: fixed showing placeholders on `clearCache`.
* [TextArea]: size `48` is deprecated and will be removed in future release. Please, use size `42` instead.
* [TextPlaceholder]: fixed animation performance issues
* [LazyListView]: fixed backgroundReload functionality.
* Fixed showing blocker when filter/sorting changed.
Expand Down
21 changes: 10 additions & 11 deletions public/docs/docsGenOutput/docsGenOutput.json
Original file line number Diff line number Diff line change
Expand Up @@ -91056,7 +91056,10 @@
"raw": "TextAreaMods",
"print": [
"interface TextAreaMods extends types.IHasEditMode {",
" /** @default '36' */",
" /**",
" * @default '36'.",
" * Size '48' is deprecated, and will be removed in future release",
" * */",
" size?: types.ControlSize;",
"}"
]
Expand All @@ -91067,11 +91070,9 @@
"name": "size",
"comment": {
"raw": [
"@default '36'"
],
"tags": {
"@default": "36"
}
"@default '36'.",
" Size '48' is deprecated, and will be removed in future release"
]
},
"typeValue": {
"raw": "'36' | '48' | '24' | '30' | '42' | 'none'"
Expand Down Expand Up @@ -91476,11 +91477,9 @@
"name": "size",
"comment": {
"raw": [
"@default '36'"
],
"tags": {
"@default": "36"
}
"@default '36'.",
" Size '48' is deprecated, and will be removed in future release"
]
},
"typeValue": {
"raw": "'36' | '48' | '24' | '30' | '42' | 'none'"
Expand Down
10 changes: 2 additions & 8 deletions public/docs/docsGenOutput/docsGenStats.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"missingPropComment": {
"totals": {
"amountProps": 623,
"amountTypes": 211
"amountProps": 622,
"amountTypes": 210
},
"value": [
{
Expand Down Expand Up @@ -1270,12 +1270,6 @@
"color"
]
},
{
"typeRef": "@epam/uui:TextAreaMods",
"value": [
"size"
]
},
{
"typeRef": "@epam/uui:TextInputMods",
"value": [
Expand Down
30 changes: 24 additions & 6 deletions uui/components/inputs/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withMods } from '@epam/uui-core';
import { devLogger, withMods } from '@epam/uui-core';
import { TextArea as uuiTextArea, TextAreaProps as UuiTextAreaProps } from '@epam/uui-components';
import * as types from '../types';
import css from './TextArea.module.scss';
Expand All @@ -7,7 +7,10 @@ const defaultSize = '36';
const defaultMode = types.EditMode.FORM;

export interface TextAreaMods extends types.IHasEditMode {
/** @default '36' */
/**
* @default '36'.
* Size '48' is deprecated, and will be removed in future release
* */
size?: types.ControlSize;
}

Expand All @@ -19,7 +22,22 @@ export function applyTextAreaMods(mods: TextAreaMods) {

export type TextAreaProps = UuiTextAreaProps & TextAreaMods;

export const TextArea = withMods<UuiTextAreaProps, TextAreaMods>(uuiTextArea, applyTextAreaMods, (props) => ({
autoSize: props.mode === types.EditMode.CELL ? true : props.autoSize,
maxLength: props.mode === types.EditMode.CELL ? undefined : props.maxLength,
}));
export const TextArea = withMods<UuiTextAreaProps, TextAreaMods>(
uuiTextArea,
applyTextAreaMods,
(props) => {
if (__DEV__) {
devLogger.warnAboutDeprecatedPropValue<TextAreaProps, 'size'>({
component: 'TextArea',
propName: 'size',
propValue: '48',
propValueUseInstead: '42',
condition: () => props.size === '48',
});
}
return {
autoSize: props.mode === types.EditMode.CELL ? true : props.autoSize,
maxLength: props.mode === types.EditMode.CELL ? undefined : props.maxLength,
};
},
);

0 comments on commit 4c85213

Please sign in to comment.