Skip to content

Commit

Permalink
[Breaking change]: reworked vertical padding props for ModalHeader, M…
Browse files Browse the repository at this point in the history
…odalFooter.

 Added global classes to PickerInput.
  • Loading branch information
siarhei-epam committed Mar 5, 2025
1 parent b3faccf commit 32a09f5
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 24 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 5.xx.x - xx.xx.2025
**What's New**
* [FlexRow][Breaking Change]: all logic moved from `@epam/uui-components` to `@epam/uui`, export from `@epam/uui-components` removed. Component refactored to CSS variables approach. `alignItems`, `justifyContent` props aligned with CSS.

* [ModalHeader][Breaking Change]: vertical padding props changed behavior to use direct size of padding instead divided by 2. Type changed from `'12' | '18' | '24' | '36' | '48'` to `'6' | '9' | '12' | '18' | '24'`.
* [ModalFooter][Breaking Change]: vertical padding props changed behavior to use direct size of padding instead divided by 2. Type changed from `'12' | '18' | '24' | '36' | '48'` to `'6' | '9' | '12' | '18' | '24'`.

**What's Fixed**
* [Text]: use .uui-typography-inline instead of .uui-typography class to not conflict with Text internal styles
Expand Down
8 changes: 4 additions & 4 deletions uui/components/overlays/Modals.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@

--uui-modals-footer-column-gap: 12px;
--uui-modals-footer-padding: 24px;
--uui-modals-footer-vertical-padding: 24px;
--uui-modals-footer-vertical-padding: 12px;
//
border-bottom-left-radius: var(--uui-modals-border-radius);
border-bottom-right-radius: var(--uui-modals-border-radius);
padding: calc(var(--uui-modals-footer-vertical-padding) / 2) var(--uui-modals-footer-padding);
padding: var(--uui-modals-footer-vertical-padding) var(--uui-modals-footer-padding);
column-gap: var(--uui-modals-footer-column-gap);

@media (max-width: 720px) {
Expand All @@ -88,11 +88,11 @@

--uui-modals-header-column-gap: 12px;
--uui-modals-header-padding: 24px;
--uui-modals-header-vertical-padding: 36px;
--uui-modals-header-vertical-padding: 18px;
//
border-top-left-radius: var(--uui-modals-border-radius);
border-top-right-radius: var(--uui-modals-border-radius);
padding: calc(var(--uui-modals-header-vertical-padding) / 2) var(--uui-modals-header-padding);
padding: var(--uui-modals-header-vertical-padding) var(--uui-modals-header-padding);
column-gap: var(--uui-modals-header-column-gap);

&.border-bottom {
Expand Down
4 changes: 2 additions & 2 deletions uui/components/overlays/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface ModalHeaderMods {
/** Defines horizontal row padding */
padding?: '6' | '12' | '18' | '24';
/** Defines vertical row padding */
vPadding?: '12' | '18' | '24' | '36' | '48';
vPadding?: '6' | '9' | '12' | '18' | '24';
/** Pass true, to enable row bottom border */
borderBottom?: boolean;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ export interface ModalFooterMods {
/** Defines horizontal row padding */
padding?: '6' | '12' | '18' | '24';
/** Defines vertical row padding */
vPadding?: '12' | '18' | '24' | '36' | '48';
vPadding?: '6' | '9' | '12' | '18' | '24';
/** Pass true, to enable row top border */
borderTop?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion uui/components/pickers/DataPickerBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class DataPickerBody extends PickerBodyBase<DataPickerBodyProps> {
return (
<>
{this.showSearch() && (
<div key="search" className={ css.searchWrapper }>
<div key="search" className={ cx(css.searchWrapper, 'uui-picker_input-body-search') }>
<FlexCell grow={ 1 }>
<SearchInput
ref={ this.searchRef }
Expand Down
1 change: 1 addition & 0 deletions uui/components/pickers/DataPickerCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function DataPickerCell<TItem, TId>(props: DataPickerCellProps<TItem, TId
cx={ [
css.root,
props.cx,
'uui-picker_input-cell',
'data-picker-cell',
props.size && `uui-size-${props.size}`,
css[`align-widgets-${props.alignActions || 'top'}`],
Expand Down
18 changes: 16 additions & 2 deletions uui/components/pickers/DataPickerHeader.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.header {
--uui-data-picker-header-close-icon-padding: 24px;
--uui-data-picker-header-title: var(--uui-text-primary);
--uui-data-picker-header-title-font: var(--uui-font);
--uui-data-picker-header-title-font-style: normal;
--uui-data-picker-header-title-font-size: 16px;
--uui-data-picker-header-title-line-height: 24px;
--uui-data-picker-header-title-font-weight: 600;
--uui-data-picker-header-title-vertical-pading: 12px;

--uui-data-picker-header-close-icon-padding: 24px;
//
display: none;
justify-content: center;
Expand All @@ -11,7 +18,14 @@
}

.title {
--uui-text-font-weight: var(--uui-data-picker-header-title-font-weight);
color: var(--uui-data-picker-header-title);
font-family: var(--uui-data-picker-header-title-font);
font-size: var(--uui-data-picker-header-title-font-size);
line-height: var(--uui-data-picker-header-title-line-height);
font-style: var(--uui-data-picker-header-title-font-style);
font-weight: var(--uui-data-picker-header-title-font-weight);
padding-bottom: var(--uui-data-picker-header-title-vertical-pading);
padding-top: var(--uui-data-picker-header-title-vertical-pading);
}
}

Expand Down
10 changes: 3 additions & 7 deletions uui/components/pickers/DataPickerHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { Text } from '../typography';
import { IconButton } from '../buttons';
import { FlexRow } from '../layout';
import { settings } from '../../settings';
Expand All @@ -15,13 +14,10 @@ const DataPickerHeaderImpl: React.FC<DataPickerHeaderProps> = (props) => {
const title = props.title && typeof props.title === 'string' ? props.title.charAt(0).toUpperCase() + props.title.slice(1) : '';

return (
<FlexRow alignItems="center" borderBottom cx={ css.header }>
<Text
size={ settings.pickerInput.sizes.body.mobileHeaderTitleSize }
cx={ css.title }
>
<FlexRow alignItems="center" borderBottom cx={ [css.header, 'uui-picker_input-body-header'] }>
<div className={ css.title }>
{title}
</Text>
</div>
<IconButton
icon={ settings.pickerInput.icons.body.pickerBodyMobileHeaderCloseIcon }
onClick={ () => props.close?.() }
Expand Down
2 changes: 1 addition & 1 deletion uui/components/pickers/DataPickerRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class DataPickerRow<TItem, TId> extends React.Component<DataPickerRowProp
return (
<UUIDataPickerRow
{ ...this.props }
cx={ [css.pickerRow, this.props.cx] }
cx={ [css.pickerRow, 'uui-picker_input-row', this.props.cx] }
renderContent={ this.renderContent }
/>
);
Expand Down
4 changes: 2 additions & 2 deletions uui/components/pickers/PickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PickerInputElement, isMobile, Overwrite, PickerInputBaseProps,
} from '@epam/uui-core';
import { PickerTogglerRenderItemParams, PickerBodyBaseProps, PickerTogglerProps, usePickerInput } from '@epam/uui-components';
import { Dropdown } from '../overlays/Dropdown';
import { Dropdown } from '../overlays';
import { PickerModal } from './PickerModal';
import { PickerToggler, PickerTogglerMods } from './PickerToggler';
import { PickerBodyMobileView } from './PickerBodyMobileView';
Expand Down Expand Up @@ -173,7 +173,7 @@ function PickerInputComponent<TItem, TId>({ highlightSearchMatches = true, ...pr
<PickerBodyMobileView
title={ props.entityName }
onClose={ () => toggleBodyOpening(false) }
cx={ [props.bodyCx] }
cx={ [props.bodyCx, 'uui-picker_input-body-wrapper'] }
onKeyDown={ bodyProps.onKeyDown }
width={ bodyProps.togglerWidth > minBodyWidth ? bodyProps.togglerWidth : minBodyWidth }
focusLock={ getSearchPosition() === 'body' }
Expand Down
2 changes: 1 addition & 1 deletion uui/components/pickers/PickerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function PickerItem<TItem, TId>(props: PickerItemProps<TItem, TId>) {
const subtitle = highlightSearchMatches ? getHighlightedSearchMatches(props.subtitle, search) : props.subtitle;

return (
<FlexCell width="auto" cx={ [css.root, 'uui-typography', cx] }>
<FlexCell width="auto" cx={ [css.root, 'uui-picker_input-item', 'uui-typography', cx] }>
<FlexRow
size={ itemSize }
cx={ [isMultiline && css.multiline, css.columnGap] }
Expand Down
2 changes: 1 addition & 1 deletion uui/components/tables/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { settings } from '../../settings';
import './variables.scss';
import css from './DataTable.module.scss';

export interface DataTableCoreProps<TItem, TId, TFilter = any> extends IEditable<DataTableState>, DataSourceListProps, DataTableColumnsConfigOptions, Pick<VirtualListProps, 'onScroll'> {
interface DataTableCoreProps<TItem, TId, TFilter = any> extends IEditable<DataTableState>, DataSourceListProps, DataTableColumnsConfigOptions, Pick<VirtualListProps, 'onScroll'> {
/** Callback to get rows that will be rendered in table */
getRows?(): DataRowProps<TItem, TId>[];

Expand Down
2 changes: 0 additions & 2 deletions uui/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ interface PickerInputSizes {
itemVerticalPaddingMap: Sizes<PickerItemProps<unknown, unknown>['size'], string>;
selectIconMap: Sizes<DataPickerCellProps<unknown, unknown>['size'], string>;
footerSwitchMap: Sizes<DataPickerFooterProps<unknown, unknown>['size'], SwitchProps['size']>;
mobileHeaderTitleSize: TextProps['size'];
mobileFooterLinkButton: LinkButtonProps['size'];
mobileRow: DataPickerRowProps<unknown, unknown>['size'];
mobileSearchInput: SearchInputProps['size'];
Expand Down Expand Up @@ -727,7 +726,6 @@ const pickerInputSettings: PickerInputSettings = {
42: '24',
48: '24',
},
mobileHeaderTitleSize: '48',
mobileFooterLinkButton: '48',
mobileRow: '48',
mobileSearchInput: '48',
Expand Down

0 comments on commit 32a09f5

Please sign in to comment.