Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyManetov committed Oct 18, 2024
2 parents 687739b + e405899 commit d10a16a
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 39 deletions.
10 changes: 5 additions & 5 deletions app/src/data/apiDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ export function getApi({
form: {
validateForm: <FormState>(formState: FormState) =>
processRequestLocal(
origin.concat('api/form/validate-form'),
origin.concat('/api/form/validate-form'),
'POST',
formState,
),
},
errors: {
status: (status: number) => processRequestLocal(origin.concat(`api/error/status/${status}`), 'POST'),
setServerStatus: (status: number) => processRequestLocal(origin.concat(`api//error/set-server-status/${status}`), "'POST'"),
mock: () => processRequestLocal(origin.concat('api/error/mock'), 'GET'),
authLost: () => processRequestLocal(origin.concat('api/error/auth-lost'), 'POST'),
status: (status: number) => processRequestLocal(origin.concat(`/api/error/status/${status}`), 'POST'),
setServerStatus: (status: number) => processRequestLocal(origin.concat(`/api//error/set-server-status/${status}`), "'POST'"),
mock: () => processRequestLocal(origin.concat('/api/error/mock'), 'GET'),
authLost: () => processRequestLocal(origin.concat('/api/error/auth-lost'), 'POST'),
},
getChangelog() {
return processRequestLocal(origin.concat('/api/get-changelog'), 'GET');
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 5.10.2 - xx.xx.2024

**What's Fixed**
* [Text]: fixed bug when passed rawProps override Text internal styles

# 5.10.1 - 16.10.2024

**What's Fixed**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Array [
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography title container"
style={Object {}}
>
Status:
</div>
Expand All @@ -48,6 +49,7 @@ Array [
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography selection container"
style={Object {}}
>
Unknown
</div>
Expand Down Expand Up @@ -101,6 +103,7 @@ Array [
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography title container"
style={Object {}}
>
Position
</div>
Expand Down Expand Up @@ -153,6 +156,7 @@ Array [
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography title container"
style={Object {}}
>
Age
</div>
Expand Down Expand Up @@ -205,6 +209,7 @@ Array [
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography title container"
style={Object {}}
>
Hire Date
</div>
Expand Down Expand Up @@ -257,6 +262,7 @@ Array [
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography title container"
style={Object {}}
>
Exit Date
</div>
Expand Down
25 changes: 9 additions & 16 deletions uui/components/pickers/DataPickerFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ function DataPickerFooterImpl<TItem, TId>(props: PropsWithChildren<DataPickerFoo
const size = isMobile() ? settings.sizes.pickerInput.body.mobile.footer.linkButton as LinkButtonProps['size'] : props.size;
const hasSelection = view.getSelectedRowsCount() > 0;
const rowsCount = view.getListProps().rowsCount;
const isEmptyRowsAndHasNoSelection = (rowsCount === 0 && !hasSelection);

const isSinglePicker = selectionMode === 'single';

const clearAllText = i18n.pickerInput.clearSelectionButton;
const clearSingleText = i18n.pickerInput.clearSelectionButtonSingle;
const selectAllText = i18n.pickerInput.selectAllButton;

// show always for multi picker and for single only in case if search not disabled and doesn't searching.
const isSearching = search && search?.length;
const hideFooter = isSearchTooShort || rowsCount === 0 || (isSinglePicker ? (isSearching && props.disableClear) : isSearching);
const isSearching = search?.length;
const hideFooter = isSearchTooShort || rowsCount === 0 || isSearching || (isSinglePicker && props.disableClear);

const showClear = !props.disableClear && (isSinglePicker ? true : (!view.selectAll || hasSelection));

return !hideFooter && (
<FlexRow cx={ css.footer }>
Expand All @@ -58,26 +58,19 @@ function DataPickerFooterImpl<TItem, TId>(props: PropsWithChildren<DataPickerFoo
<FlexSpacer />

<FlexCell width="auto" alignSelf="center">
{view.selectAll && (
{view.selectAll && !hasSelection && (
<LinkButton
size={ size }
caption={ hasSelection ? clearAllText : selectAllText }
onClick={ hasSelection ? clearSelection : () => view.selectAll.onValueChange(true) }
rawProps={ {
'aria-label': hasSelection ? clearAllText : selectAllText,
} }
isDisabled={ isEmptyRowsAndHasNoSelection }
caption={ selectAllText }
onClick={ () => view.selectAll.onValueChange(true) }
/>
)}
{!view.selectAll && (
{ showClear && (
<LinkButton
isDisabled={ !hasSelection }
size={ size }
caption={ isSinglePicker ? clearSingleText : clearAllText }
onClick={ clearSelection }
rawProps={ {
'aria-label': isSinglePicker ? clearSingleText : clearAllText,
} }
isDisabled={ !hasSelection }
/>
)}
</FlexCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ exports[`PickerInput should open body 1`] = `
>
<button
aria-disabled="true"
aria-label="CLEAR"
class="uui-button-box uui-disabled uui-link_button root uui-size-36 uui-no-left-icon uui-no-right-icon uui-color-primary"
tabindex="-1"
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ exports[`PickerModal should be rendered correctly 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
Elementary
</div>
Expand Down Expand Up @@ -346,6 +347,7 @@ exports[`PickerModal should be rendered correctly 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
Elementary+
</div>
Expand Down Expand Up @@ -746,6 +748,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
C2
</div>
Expand Down Expand Up @@ -846,6 +849,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
C1+
</div>
Expand Down Expand Up @@ -946,6 +950,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
C1
</div>
Expand Down Expand Up @@ -1046,6 +1051,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
B2+
</div>
Expand Down Expand Up @@ -1146,6 +1152,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
B2
</div>
Expand Down Expand Up @@ -1246,6 +1253,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
B1+
</div>
Expand Down Expand Up @@ -1346,6 +1354,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
B1
</div>
Expand Down Expand Up @@ -1446,6 +1455,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
A2+
</div>
Expand Down Expand Up @@ -1546,6 +1556,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
A2
</div>
Expand Down Expand Up @@ -1646,6 +1657,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
A1+
</div>
Expand Down Expand Up @@ -1746,6 +1758,7 @@ exports[`PickerModal should be rendered correctly with maximum props 1`] = `
>
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography text container"
style={Object {}}
>
A1
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ exports[`ColumnsConfigurationModal should be rendered correctly 1`] = `
>
<div
className="root uui-text uui-size-none uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography groupTitle container"
style={Object {}}
>
Displayed in table
</div>
Expand Down Expand Up @@ -220,6 +221,7 @@ exports[`ColumnsConfigurationModal should be rendered correctly 1`] = `
</div>
<div
className="root uui-text uui-size-none uui-color-tertiary uui-font-weight-400 uui-font-style-normal uui-typography subgroupTitle container"
style={Object {}}
>
Pinned to the left
</div>
Expand Down Expand Up @@ -370,6 +372,7 @@ exports[`ColumnsConfigurationModal should be rendered correctly 1`] = `
</div>
<div
className="root uui-text uui-size-none uui-color-tertiary uui-font-weight-400 uui-font-style-normal uui-typography subgroupTitle container"
style={Object {}}
>
Not pinned
</div>
Expand Down
25 changes: 11 additions & 14 deletions uui/components/typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,16 @@ export const Text = withMods<uuiComponents.TextProps, TextProps>(
uuiComponents.Text,
applyTextMods,
(props) => {
if (props.fontSize || props.lineHeight) {
const style: any = {};
props.fontSize && (style['--uui-text-font-size'] = `${props.fontSize}px`);
props.lineHeight && (style['--uui-text-line-height'] = `${props.lineHeight}px`);
return {
rawProps: {
style: {
...style,
...props?.rawProps?.style,
},
...props?.rawProps,
},
};
}
const style: any = props?.rawProps?.style || {};

props.fontSize && (style['--uui-text-font-size'] = `${props.fontSize}px`);
props.lineHeight && (style['--uui-text-line-height'] = `${props.lineHeight}px`);

return {
rawProps: {
...props?.rawProps,
style: style,
},
};
},
);
4 changes: 2 additions & 2 deletions uui/components/typography/__tests__/Text.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ describe('Text', () => {
expect(tree).toMatchSnapshot();
});

it('should be rendered correctly', () => {
it('should be rendered correctly with props', () => {
const tree = renderer
.create(
<Text color="primary" size="48" fontSize="24" lineHeight="30" onClick={ jest.fn }>
<Text color="primary" size="48" fontSize="24" lineHeight="30" onClick={ jest.fn } rawProps={ { style: { marginRight: '12' } } }>
Test
</Text>,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
exports[`Text should be rendered correctly 1`] = `
<div
className="root uui-text uui-size-36 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography container"
style={Object {}}
>
Test
</div>
`;

exports[`Text should be rendered correctly 2`] = `
exports[`Text should be rendered correctly with props 1`] = `
<div
className="root uui-text uui-size-48 lineHeight fontSize uui-color-primary uui-font-weight-400 uui-font-style-normal uui-typography container"
onClick={[Function]}
style={
Object {
"--uui-text-font-size": "24px",
"--uui-text-line-height": "30px",
"marginRight": "12",
}
}
>
Expand Down

0 comments on commit d10a16a

Please sign in to comment.