Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/base/src/hooks/usePassThroughHtmlProps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';

const PROP_WHITELIST = /^(aria-|data-|id$)/;
const PROP_WHITELIST = /^(aria-|data-|id$|on[A-Z])/;

export const usePassThroughHtmlProps = (props) => {
const passThroughPropNames = Object.keys(props).filter((name) => PROP_WHITELIST.test(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ export const AnalyticalCardHeader: FC<AnalyticalCardHeaderPropTypes> = forwardRe
return (
<div
ref={ref}
onClick={onClick}
className={headerClasses.valueOf()}
title={tooltip}
style={style}
{...passThroughProps}
onClick={onClick}
>
<div className={classes.headerContent}>
<div className={classes.headerTitles}>
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ const Avatar: FC<AvatarPropTypes> = forwardRef((props: AvatarPropTypes, ref: Ref
ref={ref}
className={cssClasses.join(' ')}
style={inlineStyle}
onClick={handleOnClick}
tabIndex={0}
onKeyDown={handleKeyDown}
title={tooltip}
slot={slot}
{...passThroughProps}
onClick={handleOnClick}
onKeyDown={handleKeyDown}
>
{initials ? initials : children}
</span>
Expand Down
7 changes: 4 additions & 3 deletions packages/main/src/components/Carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,20 @@ const Carousel: FC<CarouselPropTypes> = forwardRef((props: CarouselPropTypes, re
ref={ref}
role="list"
tabIndex={0}
onKeyDown={onKeyDown}
{...passThroughProps}
onKeyDown={onKeyDown}
>
{childElementCount > 1 && pageIndicatorPlacement === PlacementType.Top && (
<CarouselPagination
arrowsPlacement={arrowsPlacement}
showPageIndicator={showPageIndicator}
pageIndicatorPlacement={pageIndicatorPlacement}
activePage={currentlyActivePage}
children={children}
goToPreviousPage={goToPreviousPage}
goToNextPage={goToNextPage}
/>
>
{children}
</CarouselPagination>
)}
<div
className={classes.carouselInner}
Expand Down
13 changes: 13 additions & 0 deletions packages/main/src/components/FlexBox/FlexBox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { mount } from 'enzyme';
import { FlexBox } from '@ui5/webcomponents-react/lib/FlexBox';
import { FlexBoxJustifyContent } from '@ui5/webcomponents-react/lib/FlexBoxJustifyContent';
import * as React from 'react';
import sinon from 'sinon';

describe('FlexBox', () => {
test('JustifyContent: End', () => {
Expand Down Expand Up @@ -45,5 +46,17 @@ describe('FlexBox', () => {
expect(wrapper.render()).toMatchSnapshot();
});

test('pass through click handler', () => {
const callback = sinon.spy();
const wrapper = mount(
// @ts-ignore
<FlexBox onClick={callback}>
<span>Test 1</span>
</FlexBox>
);
wrapper.simulate('click');
expect(callback.called).toBe(true);
});

createPassThroughPropsTest(FlexBox);
});
5 changes: 3 additions & 2 deletions packages/main/src/components/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ const Form: FC<FormPropTypes> = forwardRef((props: FormPropTypes, ref: Ref<HTMLD
)}
<Grid
ref={ref}
children={formGroups}
defaultSpan={'XL6 L12 M12 S12'}
className={className}
slot={slot}
style={style}
tooltip={tooltip}
{...passThroughProps}
/>
>
{formGroups}
</Grid>
</CurrentViewportRangeContext.Provider>
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/components/Notification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ const Notification: FC<NotificationProptypes> = forwardRef(
<div
style={notificationContainerStyles}
className={`${classes.notificationContainer} ${className}`}
onClick={handleNotificationClick}
title={tooltip}
ref={ref}
{...passThroughProps}
onClick={handleNotificationClick}
>
<div className={`${classes.priorityIndicator} ${indicatorClass}`} style={indicatorStyles} />
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/components/SegmentedButtonItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ const SegmentedButtonItem: FC<SegmentedButtonItemPropTypes> = forwardRef(
<li
ref={ref}
className={segmentedButtonItemClasses.valueOf()}
onClick={handleOnClick}
style={inlineStyles}
title={tooltip}
data-has-own-width={!!width}
{...passThroughProps}
onClick={handleOnClick}
>
{icon && <div className={iconClasses.valueOf()}>{icon}</div>}
{children}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/components/VariantManagement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ const VariantManagement: FC<VariantManagementPropTypes> = forwardRef(
<Popover
ref={ref}
open={open}
onAfterOpen={handleAfterOpen}
headerText={popupTitle}
placementType={placement}
openBy={variantManagementButton}
Expand All @@ -166,6 +165,7 @@ const VariantManagement: FC<VariantManagementPropTypes> = forwardRef(
style={style}
tooltip={tooltip}
{...passThroughProps}
onAfterOpen={handleAfterOpen}
>
<List onItemClick={handleVariantItemSelect} mode={ListMode.SingleSelect}>
{variantItems.map((item) => (
Expand Down
49 changes: 0 additions & 49 deletions packages/main/src/webComponents/Button/demo.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,6 @@ import { Button } from '@ui5/webcomponents-react/lib/Button';
import { ButtonDesign } from '@ui5/webcomponents-react/lib/ButtonDesign';
import React from 'react';

const customStyle1 = {
color: 'red'
};

const customStyle2 = {
width: '15rem'
};

class DemoButton extends React.Component {
state = {
showCS1: false,
showCS2: false
};

render() {
const { showCS1, showCS2 } = this.state;

const innerStyles = {
...(showCS1 ? customStyle1 : {}),
...(showCS2 ? customStyle2 : {})
};

return (
<div>
<div>
<Button onClick={() => this.setState({ showCS1: !showCS1 })}>Toggle Custom Style 1</Button>
<Button onClick={() => this.setState({ showCS2: !showCS2 })}>Toggle Custom Style 2</Button>
</div>
<Button
design={select('design', ButtonDesign, ButtonDesign.Default)}
disabled={boolean('disabled', false)}
icon={'add'}
iconEnd={boolean('iconEnd', false)}
onClick={action('Button clicked')}
innerStyles={innerStyles}
>
Some Content
</Button>
</div>
);
}
}

export default {
title: 'UI5 Web Components / Button',
component: Button
Expand All @@ -67,9 +24,3 @@ export const generatedDefaultStory = () => (
generatedDefaultStory.story = {
name: 'Generated default story'
};

export const withCustomStyles = () => <DemoButton />;

withCustomStyles.story = {
name: 'With custom Styles'
};