Skip to content

Commit

Permalink
Merge branch 'next' into feat-3710
Browse files Browse the repository at this point in the history
  • Loading branch information
erzhan-temir-mamyrov committed Feb 14, 2023
2 parents 5000736 + d0878c1 commit 5e37040
Show file tree
Hide file tree
Showing 20 changed files with 430 additions and 197 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,54 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.152.0-next.29](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.28...v2.152.0-next.29) (2023-02-14)


### Bug Fixes

* **table:** decrease css selector spec in overflow menu ([1cb6533](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/1cb6533eea555b39f44962bc89b485a9c1a02184))
* **tabletoolbar:** overflow menu icon color ([a4d6cae](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/a4d6caee721770c4be2ea0797cba271bd5dcc6d8))


### Features

* **overflowmenu:** add support for button label ([7f2fe4b](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/7f2fe4b6d4060d040483b56aea1b9d0edcbaa9c5)), closes [#3714](https://github.com/carbon-design-system/carbon-addons-iot-react/issues/3714)





# [2.152.0-next.28](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.27...v2.152.0-next.28) (2023-02-07)

**Note:** Version bump only for package ibm-ai-applications





# [2.152.0-next.27](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.26...v2.152.0-next.27) (2023-02-07)


### Bug Fixes

* **dashboardeditor:** added comment for dependency exclusion ([a2f661b](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/a2f661b79335b9ea018529e586cac13dd528a969))
* **dashboardeditor:** fixed issue when removing image from image card ([b1164c7](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/b1164c7deb001ae4a0c55cc0ab3e221d29776455))





# [2.152.0-next.26](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.25...v2.152.0-next.26) (2023-02-06)


### Bug Fixes

* **suiteheader:** Fixing the useUiResources promise flow (it was missing an await in the cached flow) ([c1c2f8a](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/c1c2f8a01021d73126e77046af0fffebc10b3f7c))





# [2.152.0-next.25](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.24...v2.152.0-next.25) (2023-02-02)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"packages/*"
],
"useWorkspaces": true,
"version": "2.152.0-next.25",
"version": "2.152.0-next.29",
"npmClient": "yarn"
}
48 changes: 48 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,54 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.152.0-next.29](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.28...v2.152.0-next.29) (2023-02-14)


### Bug Fixes

* **table:** decrease css selector spec in overflow menu ([1cb6533](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/1cb6533eea555b39f44962bc89b485a9c1a02184))
* **tabletoolbar:** overflow menu icon color ([a4d6cae](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/a4d6caee721770c4be2ea0797cba271bd5dcc6d8))


### Features

* **overflowmenu:** add support for button label ([7f2fe4b](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/7f2fe4b6d4060d040483b56aea1b9d0edcbaa9c5)), closes [#3714](https://github.com/carbon-design-system/carbon-addons-iot-react/issues/3714)





# [2.152.0-next.28](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.27...v2.152.0-next.28) (2023-02-07)

**Note:** Version bump only for package carbon-addons-iot-react





# [2.152.0-next.27](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.26...v2.152.0-next.27) (2023-02-07)


### Bug Fixes

* **dashboardeditor:** added comment for dependency exclusion ([a2f661b](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/a2f661b79335b9ea018529e586cac13dd528a969))
* **dashboardeditor:** fixed issue when removing image from image card ([b1164c7](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/b1164c7deb001ae4a0c55cc0ab3e221d29776455))





# [2.152.0-next.26](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.25...v2.152.0-next.26) (2023-02-06)


### Bug Fixes

* **suiteheader:** Fixing the useUiResources promise flow (it was missing an await in the cached flow) ([c1c2f8a](https://github.com/carbon-design-system/carbon-addons-iot-react/commit/c1c2f8a01021d73126e77046af0fffebc10b3f7c))





# [2.152.0-next.25](https://github.com/carbon-design-system/carbon-addons-iot-react/compare/v2.152.0-next.24...v2.152.0-next.25) (2023-02-02)


Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
"@testing-library/react": "^10.4.8",
"@testing-library/react-hooks": "^5.1.2",
"@testing-library/user-event": "12.8.3",
"accessibility-checker": "^3.0.6",
"accessibility-checker": "3.1.38",
"autoprefixer": "^9.4.4",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
Expand Down Expand Up @@ -340,7 +340,7 @@
"whatwg-fetch": "^3.0.0"
},
"sideEffects": false,
"version": "2.152.0-next.25",
"version": "2.152.0-next.29",
"resolutions": {
"chokidar": "3.3.1",
"react-grid-layout": "1.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,49 +446,7 @@ const DataSeriesFormItemModal = ({
)}
</div>

{type === CARD_TYPES.IMAGE && (
<div className={`${baseClassName}--input-group`}>
<div className={`${baseClassName}--input-group--item`}>
<TextInput
id={`${id}_attribute-unit`}
labelText={mergedI18n.dataItemEditorDataItemUnit}
light
placeholder={`${mergedI18n.example}: %`}
onChange={(evt) =>
setEditDataItem({
...editDataItem,
unit: evt.target.value,
})
}
value={editDataItem.unit}
/>
</div>
<div className={`${baseClassName}--input-group--item-end`}>
<Dropdown
id={`${id}_value-card-decimal-place`}
titleText={mergedI18n.decimalPlacesLabel}
direction="bottom"
label=""
items={[mergedI18n.notSet, '0', '1', '2', '3', '4']}
light
selectedItem={editDataItem.precision?.toString() || mergedI18n.notSet}
onChange={({ selectedItem }) => {
const isSet = selectedItem !== mergedI18n.notSet;
if (isSet) {
setEditDataItem({
...editDataItem,
precision: Number(selectedItem),
});
} else {
setEditDataItem(omit(editDataItem, 'precision'));
}
}}
/>
</div>
</div>
)}

{type === CARD_TYPES.VALUE && (
{(type === CARD_TYPES.VALUE || type === CARD_TYPES.IMAGE) && (
<div className={`${baseClassName}--input-group`}>
<div className={`${baseClassName}--input-group--item`}>
<TextInput
Expand Down
19 changes: 19 additions & 0 deletions packages/react/src/components/DashboardEditor/DashboardEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,25 @@ const DashboardEditor = ({
: LAYOUTS.FIT_TO_SCREEN.breakpoint
);

// update imagesToUpload whenever images are removed from dashboardJson cards
useEffect(() => {
const dashboardJsonImages = dashboardJson?.cards
?.filter((card) => card?.type === CARD_TYPES.IMAGE)
.map((card) => ({ id: card?.content?.id, src: card?.content?.src }));

if (imagesToUpload?.length) {
setImagesToUpload((prevImagesToUpload) =>
prevImagesToUpload.filter((image) =>
dashboardJsonImages.some(
(dashboardImage) => dashboardImage.id === image?.id && dashboardImage.src === image?.src
)
)
);
}
// this should only execute when dashboardJson is updated; imagesToUpload is not needed as dependency
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dashboardJson]);

useEffect(() => {
// if the loaded template changes, we need to update the state
setDashboardJson(initialValue);
Expand Down
10 changes: 10 additions & 0 deletions packages/react/src/components/OverflowMenu/OverflowMenu.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,14 @@ describe('IotOverflowMenu', () => {
userEvent.type(baseElement, '{escape}');
expect(baseElement.querySelector('ul')).toBeNull();
});

it('should render button with label', () => {
render(
<OverflowMenu testId={testId} withCarbonTooltip buttonLabel="More">
<OverflowMenuItem itemText="Option 1" />
</OverflowMenu>
);

expect(screen.getByRole('button')).toHaveTextContent('More');
});
});
11 changes: 10 additions & 1 deletion packages/react/src/components/OverflowMenu/_overflow-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ button.#{$iot-prefix}--overflow-menu-icon {
}

&.#{$prefix}--btn--icon-only.#{$prefix}--tooltip__trigger {
& svg,
& svg {
fill: $ui-05;
margin-left: 0;
}

&:hover svg,
&:focus svg {
fill: $ui-05;
}
}
}

.#{$iot-prefix}--overflow-menu--with-label {
width: unset;
font-size: 0.875rem;
}
15 changes: 14 additions & 1 deletion packages/react/src/components/OverflowMenu/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ class IotOverflowMenu extends Component {
* Language direction
*/
langDir: PropTypes.oneOf(['ltr', 'rtl']),

/**
* Label for the overflow menu button
*/
buttonLabel: PropTypes.string,
};

// eslint-disable-next-line react/sort-comp
Expand All @@ -208,6 +213,7 @@ class IotOverflowMenu extends Component {
tooltipPosition: 'top',
size: 'md',
langDir: 'ltr',
buttonLabel: '',
};

/**
Expand Down Expand Up @@ -488,6 +494,7 @@ class IotOverflowMenu extends Component {
tooltipPosition,
className,
langDir, // Not to pollute DOM
buttonLabel,
...other
} = this.props;

Expand All @@ -497,6 +504,7 @@ class IotOverflowMenu extends Component {
[`${prefix}--overflow-menu--open`]: open,
[`${prefix}--overflow-menu--light`]: light,
[`${prefix}--overflow-menu--${size}`]: size,
[`${iotPrefix}--overflow-menu--with-label`]: buttonLabel,
});

const overflowMenuOptionsClasses = classNames(
Expand Down Expand Up @@ -560,7 +568,7 @@ class IotOverflowMenu extends Component {
[`${iotPrefix}--table-toolbar-button-active`]: false, // https://github.com/carbon-design-system/carbon/issues/6160
}
)}
kind="icon-selection"
kind={buttonLabel ? 'primary' : 'icon-selection'}
iconDescription={ariaLabel}
onKeyDown={this.handleKeyPress}
onClick={this.handleClick}
Expand All @@ -571,6 +579,7 @@ class IotOverflowMenu extends Component {
aria-haspopup
aria-expanded={open}
>
{buttonLabel || null}
{open && wrappedMenuBody}
</Button>
</ClickListener>
Expand All @@ -585,6 +594,7 @@ export const OverflowMenu = ({
flipped,
testId,
withCarbonTooltip,
buttonLabel,
...props
}) => {
const [calculateMenuOffset, { adjustedDirection, adjustedFlipped }] = usePopoverPositioning({
Expand All @@ -607,6 +617,7 @@ export const OverflowMenu = ({
menuOffset={calculateMenuOffset}
menuOffsetFlip={calculateMenuOffset}
langDir={langDir}
buttonLabel={buttonLabel}
/>
);
}
Expand All @@ -628,13 +639,15 @@ OverflowMenu.propTypes = {
useAutoPositioning: PropTypes.bool,
testId: PropTypes.string,
withCarbonTooltip: PropTypes.bool,
buttonLabel: PropTypes.string,
};

OverflowMenu.defaultProps = {
...CarbonOverflowMenu.defaultProps,
useAutoPositioning: false,
testId: 'overflow-menu',
withCarbonTooltip: false,
buttonLabel: '',
};

export default OverflowMenu;
10 changes: 10 additions & 0 deletions packages/react/src/components/SuiteHeader/_suite-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,16 @@
display: flex;
align-items: center;
}

.#{$prefix}--header-action-btn {
.#{$prefix}--btn--primary {
background-color: unset;
}

.#{$prefix}--header__menu-item span {
display: flex;
}
}
}

.#{$iot-prefix}--header__subtitle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const useUiResources = ({
setIsLoading(true);
if (useCache) {
// Set cached and then non-cached data
getCachedUiResourcesData(
await getCachedUiResourcesData(
{ ...options },
(cachedData) => {
setData(cachedData);
Expand Down
Loading

0 comments on commit 5e37040

Please sign in to comment.