diff --git a/packages/react/src/components/CardCodeEditor/CardCodeEditor.jsx b/packages/react/src/components/CardCodeEditor/CardCodeEditor.jsx index 09726f8f45..322167d85c 100644 --- a/packages/react/src/components/CardCodeEditor/CardCodeEditor.jsx +++ b/packages/react/src/components/CardCodeEditor/CardCodeEditor.jsx @@ -10,7 +10,7 @@ import Button from '../Button'; import deprecate from '../../internal/deprecate'; import CodeEditor from '../CodeEditor/CodeEditor'; -const { iotPrefix } = settings; +const { iotPrefix, prefix } = settings; const propTypes = { ...ComposedModal.propTypes, // eslint-disable-line react/forbid-foreign-prop-types @@ -97,7 +97,7 @@ const CardCodeEditor = ({ return ( {}; @@ -658,7 +658,7 @@ const DataSeriesFormItemModal = ({ {showEditor && (
{ + onChange={(event, { value }) => { const updatedThresholds = [...thresholds]; updatedThresholds[i] = { ...updatedThresholds[i], - value: Number(imaginaryTarget.value) || imaginaryTarget.value, + value: + Number(value ?? event.imaginaryTarget.value) || + value || + event.imaginaryTarget.value, }; onChange(updatedThresholds.map((item) => omit(item, 'id'))); setThresholds(updatedThresholds); diff --git a/packages/react/src/components/CardEditor/CardEditForm/CardEditFormItems/ValueCardFormItems/ValueCardFormSettings.jsx b/packages/react/src/components/CardEditor/CardEditForm/CardEditFormItems/ValueCardFormItems/ValueCardFormSettings.jsx index cae8007bdd..58916cf68f 100644 --- a/packages/react/src/components/CardEditor/CardEditForm/CardEditFormItems/ValueCardFormItems/ValueCardFormSettings.jsx +++ b/packages/react/src/components/CardEditor/CardEditForm/CardEditFormItems/ValueCardFormItems/ValueCardFormSettings.jsx @@ -69,8 +69,8 @@ const ValueCardFormSettings = ({ cardConfig, onChange, i18n }) => { light label={mergedI18n.fontSize} value={fontSize || DEFAULT_FONT_SIZE} - onChange={(event) => { - const parsedValue = Number(event.imaginaryTarget.value); + onChange={(event, { value }) => { + const parsedValue = Number(value ?? event.imaginaryTarget.value); if (isNumberValidForMinMax(parsedValue, MIN_FONT_SIZE, MAX_FONT_SIZE)) { onChange({ ...cardConfig, diff --git a/packages/react/src/components/DashboardEditor/DashboardEditorHeader/DashboardEditorHeader.jsx b/packages/react/src/components/DashboardEditor/DashboardEditorHeader/DashboardEditorHeader.jsx index db102ecbff..612fa78c14 100644 --- a/packages/react/src/components/DashboardEditor/DashboardEditorHeader/DashboardEditorHeader.jsx +++ b/packages/react/src/components/DashboardEditor/DashboardEditorHeader/DashboardEditorHeader.jsx @@ -9,7 +9,7 @@ import { Laptop, Screen, } from '@carbon/react/icons'; -import { FileUploaderButton, Tooltip, ContentSwitcher, TextInput } from '@carbon/react'; +import { FileUploaderButton, ContentSwitcher, TextInput } from '@carbon/react'; import { isEmpty } from 'lodash-es'; import { settings } from '../../../constants/Settings'; @@ -150,6 +150,7 @@ const DashboardEditorHeader = ({ renderIcon={Maximize} index={0} testId={`${testId}-fit-to-screen-switch`} + tooltipPosition="bottom" /> )} - { - // FileUploaderButton isn't a true button so extra styling is needed to make it look like a iconOnly button - onImport && ( - - } - onChange={onImport} - disableLabelChanges - accepts={['.json']} - multiple={false} - data-testid={`${testId}-file-uploader-button`} + iconDescription={mergedI18n.headerImportButton} + tooltipPosition="bottom" + tooltipAlignment="center" + hasIconOnly + renderIcon={DocumentImport} /> - - ) - } + } + onChange={onImport} + disableLabelChanges + accepts={['.json']} + multiple={false} + data-testid={`${testId}-file-uploader-button`} + /> + )} {onExport && ( @@ -242,8 +244,7 @@ const DashboardEditorHeader = ({ disabled={isSubmitDisabled} onClick={() => onSubmit(dashboardJson)} loading={isSubmitLoading} - // TODO: pass testId in v3 to override defaults - // testId={`${testId}-submit-button`} + data-testid={`${testId}-submit-button`} > {mergedI18n.headerSubmitButton} diff --git a/packages/react/src/components/DashboardEditor/_dashboard-editor.scss b/packages/react/src/components/DashboardEditor/_dashboard-editor.scss index 41cbbf09c8..1a203f82c6 100644 --- a/packages/react/src/components/DashboardEditor/_dashboard-editor.scss +++ b/packages/react/src/components/DashboardEditor/_dashboard-editor.scss @@ -41,16 +41,7 @@ height: calc(#{$spacing-07} + #{$spacing-02}); display: flex; align-items: center; - // FileUploaderButton isn't a true button so extra styling is needed to make it look like a iconOnly button - &__import.#{$prefix}--tooltip__trigger { - // have to force the span containing the svg down to be aligned with other iconOnly buttons - span { - padding-top: 3px; - } - svg { - fill: $icon-primary; - } - } + &__switcher { margin-right: $spacing-05; diff --git a/packages/react/src/components/HotspotEditorModal/DynamicHotspotSourcePicker/DynamicHotspotSourcePicker.jsx b/packages/react/src/components/HotspotEditorModal/DynamicHotspotSourcePicker/DynamicHotspotSourcePicker.jsx index d1b009ccc5..ed1c428a78 100644 --- a/packages/react/src/components/HotspotEditorModal/DynamicHotspotSourcePicker/DynamicHotspotSourcePicker.jsx +++ b/packages/react/src/components/HotspotEditorModal/DynamicHotspotSourcePicker/DynamicHotspotSourcePicker.jsx @@ -2,10 +2,10 @@ import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import { Erase } from '@carbon/react/icons'; import classnames from 'classnames'; +import { IconButton } from '@carbon/react'; import { settings } from '../../../constants/Settings'; import { Dropdown } from '../../Dropdown'; -import Button from '../../Button/Button'; import deprecate from '../../../internal/deprecate'; const { iotPrefix } = settings; @@ -112,19 +112,17 @@ const DynamicHotspotSourcePicker = ({ onYValueChange(change.selectedItem.dataSourceId); }} /> -
); diff --git a/packages/react/src/components/HotspotEditorModal/HotspotEditorModal.jsx b/packages/react/src/components/HotspotEditorModal/HotspotEditorModal.jsx index 2a2eec89c7..993687433b 100644 --- a/packages/react/src/components/HotspotEditorModal/HotspotEditorModal.jsx +++ b/packages/react/src/components/HotspotEditorModal/HotspotEditorModal.jsx @@ -34,7 +34,7 @@ import HotspotEditorDataSourceTab from './HotspotEditorDataSourceTab/HotspotEdit import { hotspotTypes, useHotspotEditorState } from './hooks/hotspotStateHook'; import DynamicHotspotSourcePicker from './DynamicHotspotSourcePicker/DynamicHotspotSourcePicker'; -const { iotPrefix } = settings; +const { iotPrefix, prefix } = settings; /* istanbul ignore next */ const noop = () => {}; @@ -599,7 +599,7 @@ const HotspotEditorModal = ({ return ( } + renderIcon={TextBold} index={0} light={light} /> + } + renderIcon={TextItalic} index={1} light={light} /> @@ -255,7 +255,7 @@ const HotspotTextStyleTab = ({ data-testid="hotspot-underline" selected={underline} text={underlineLabelText} - renderIcon={() => } + renderIcon={TextUnderline} index={2} light={light} /> @@ -287,8 +287,8 @@ const HotspotTextStyleTab = ({ step={1} label={fontSizeLabelText} invalidText={fontSizeInvalidText} - onChange={(event) => { - const parsedValue = Number(event.imaginaryTarget.value); + onChange={(event, { value }) => { + const parsedValue = Number(value ?? event.imaginaryTarget.value); if (isNumberValidForMinMax(parsedValue, minFontSize, maxFontSize)) { onChange({ fontSize: parsedValue, @@ -324,8 +324,8 @@ const HotspotTextStyleTab = ({ step={1} light={light} invalidText={fillOpacityInvalidText} - onChange={(event) => { - const parsedValue = Number(event.imaginaryTarget.value); + onChange={(event, { value }) => { + const parsedValue = Number(value ?? event.imaginaryTarget.value); if (isNumberValidForMinMax(parsedValue, minOpacity, maxOpacity)) { onChange({ backgroundOpacity: parsedValue, @@ -359,8 +359,8 @@ const HotspotTextStyleTab = ({ step={1} light={light} invalidText={borderWidthInvalidText} - onChange={(event) => { - const parsedValue = Number(event.imaginaryTarget.value); + onChange={(event, { value }) => { + const parsedValue = Number(value ?? event.imaginaryTarget.value); if (isNumberValidForMinMax(parsedValue, minBorderWidth, maxBorderWidth)) { onChange({ borderWidth: parsedValue, @@ -373,7 +373,7 @@ const HotspotTextStyleTab = ({