carbon-addons-iot-react 2.155.13 → 2.156.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/es/components/Card/Card.js +17 -5
  2. package/es/components/CardEditor/CardEditForm/CardEditForm.js +17 -0
  3. package/es/components/CardEditor/CardEditForm/CardEditFormContent.js +18 -0
  4. package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +20 -3
  5. package/es/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +20 -2
  6. package/es/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +19 -2
  7. package/es/components/CardEditor/CardEditor.js +17 -0
  8. package/es/components/DashboardEditor/DashboardEditor.js +20 -1
  9. package/es/components/DashboardEditor/DashboardEditorCardRenderer.js +4 -2
  10. package/es/components/ValueCard/Attribute.js +41 -4
  11. package/es/components/ValueCard/ValueCard.js +15 -3
  12. package/es/components/ValueCard/ValueContent.js +20 -2
  13. package/es/constants/CardPropTypes.js +3 -0
  14. package/es/utils/cardUtilityFunctions.js +17 -1
  15. package/lib/components/Card/Card.js +16 -4
  16. package/lib/components/CardEditor/CardEditForm/CardEditForm.js +17 -0
  17. package/lib/components/CardEditor/CardEditForm/CardEditFormContent.js +18 -0
  18. package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.js +20 -3
  19. package/lib/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItems/DataSeriesFormContent.js +20 -2
  20. package/lib/components/CardEditor/CardEditForm/CommonCardEditFormFields.js +19 -2
  21. package/lib/components/CardEditor/CardEditor.js +17 -0
  22. package/lib/components/DashboardEditor/DashboardEditor.js +20 -1
  23. package/lib/components/DashboardEditor/DashboardEditorCardRenderer.js +4 -2
  24. package/lib/components/ValueCard/Attribute.js +41 -4
  25. package/lib/components/ValueCard/ValueCard.js +15 -3
  26. package/lib/components/ValueCard/ValueContent.js +20 -2
  27. package/lib/constants/CardPropTypes.js +3 -0
  28. package/lib/utils/cardUtilityFunctions.js +17 -0
  29. package/package.json +2 -2
  30. package/umd/carbon-addons-iot-react.js +240 -23
@@ -136863,6 +136863,9 @@
136863
136863
  defaultFilterStringPlaceholdText: PropTypes__default["default"].string,
136864
136864
  downloadIconDescription: PropTypes__default["default"].string
136865
136865
  }),
136866
+
136867
+ /** whether to use translated labels in cards */
136868
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
136866
136869
  cardVariables: PropTypes__default["default"].objectOf(PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func, PropTypes__default["default"].number, PropTypes__default["default"].bool])),
136867
136870
 
136868
136871
  /** default date format pattern that follows the dayjs formatting patterns */
@@ -140347,6 +140350,21 @@
140347
140350
  });
140348
140351
  return defaultTooltipDOM.innerHTML;
140349
140352
  };
140353
+ /**
140354
+ * Get translated label or title from i18n object, fallback to original if not found
140355
+ * @param {string} label - The label or title key to translate
140356
+ * @param {boolean} shouldUseTranslatedLabels - Flag to determine if translation should be used
140357
+ * @param {Object} i18n - The i18n object containing translations
140358
+ * @returns {string} - The translated label or original label if translation not found
140359
+ */
140360
+
140361
+ var getTranslatedLabel = function getTranslatedLabel(label, shouldUseTranslatedLabels, i18n) {
140362
+ if (!isEmpty(label) && shouldUseTranslatedLabels && i18n && i18n[label]) {
140363
+ return i18n[label];
140364
+ }
140365
+
140366
+ return label;
140367
+ };
140350
140368
 
140351
140369
  function ownKeys$1F(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
140352
140370
 
@@ -141843,7 +141861,8 @@
141843
141861
  overrides: undefined,
141844
141862
  type: null,
141845
141863
  data: null,
141846
- content: null
141864
+ content: null,
141865
+ shouldUseTranslatedLabels: false
141847
141866
  };
141848
141867
  /** Dumb component that renders the card basics */
141849
141868
 
@@ -141852,7 +141871,7 @@
141852
141871
 
141853
141872
  var size = props.size,
141854
141873
  children = props.children,
141855
- title = props.title,
141874
+ titleProp = props.title,
141856
141875
  subtitleProp = props.subtitle,
141857
141876
  hasTitleWrap = props.hasTitleWrap;
141858
141877
  props.layout;
@@ -141866,7 +141885,7 @@
141866
141885
  error = props.error,
141867
141886
  hideHeader = props.hideHeader,
141868
141887
  id = props.id,
141869
- tooltip = props.tooltip,
141888
+ tooltipProp = props.tooltip,
141870
141889
  titleTextTooltip = props.titleTextTooltip,
141871
141890
  timeRange = props.timeRange,
141872
141891
  timeRangeOptions = props.timeRangeOptions,
@@ -141890,9 +141909,13 @@
141890
141909
  type = props.type,
141891
141910
  data = props.data,
141892
141911
  content = props.content,
141893
- others = objectWithoutProperties(props, ["size", "children", "title", "subtitle", "hasTitleWrap", "layout", "isLoading", "isEmpty", "isEditable", "isExpanded", "isLazyLoading", "isResizable", "resizeHandles", "error", "hideHeader", "id", "tooltip", "titleTextTooltip", "timeRange", "timeRangeOptions", "onCardAction", "availableActions", "renderExpandIcon", "renderDateDropdownInPortal", "breakpoint", "i18n", "style", "className", "values", "testID", "testId", "contentClassName", "footerContent", "dateTimeMask", "extraActions", "padding", "overrides", "type", "data", "content"]); // TODO: remove once final version of range prop is supported
141912
+ shouldUseTranslatedLabels = props.shouldUseTranslatedLabels,
141913
+ others = objectWithoutProperties(props, ["size", "children", "title", "subtitle", "hasTitleWrap", "layout", "isLoading", "isEmpty", "isEditable", "isExpanded", "isLazyLoading", "isResizable", "resizeHandles", "error", "hideHeader", "id", "tooltip", "titleTextTooltip", "timeRange", "timeRangeOptions", "onCardAction", "availableActions", "renderExpandIcon", "renderDateDropdownInPortal", "breakpoint", "i18n", "style", "className", "values", "testID", "testId", "contentClassName", "footerContent", "dateTimeMask", "extraActions", "padding", "overrides", "type", "data", "content", "shouldUseTranslatedLabels"]); // Get translated title if shouldUseTranslatedLabels is true
141894
141914
 
141895
141915
 
141916
+ var title = getTranslatedLabel(titleProp, shouldUseTranslatedLabels, i18n);
141917
+ var tooltip = getTranslatedLabel(tooltipProp, shouldUseTranslatedLabels, i18n); // TODO: remove once final version of range prop is supported
141918
+
141896
141919
  React$1.useEffect(function () {
141897
141920
  if (typeof (availableActions === null || availableActions === void 0 ? void 0 : availableActions.range) === 'string') {
141898
141921
  warning_1(false, 'The Card components availableActions.range is an experimental property and may be subject to change.') ;
@@ -142388,6 +142411,13 @@
142388
142411
  "computed": false
142389
142412
  },
142390
142413
  "required": false
142414
+ },
142415
+ "shouldUseTranslatedLabels": {
142416
+ "defaultValue": {
142417
+ "value": "false",
142418
+ "computed": false
142419
+ },
142420
+ "required": false
142391
142421
  }
142392
142422
  },
142393
142423
  "composes": ["../../constants/CardPropTypes"]
@@ -172883,6 +172913,10 @@
172883
172913
  isEditable: PropTypes__default["default"].bool,
172884
172914
  layout: PropTypes__default["default"].oneOf(Object.values(CARD_LAYOUTS)),
172885
172915
  locale: PropTypes__default["default"].string,
172916
+
172917
+ /** whether to use translated labels in cards */
172918
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
172919
+ i18n: PropTypes__default["default"].objectOf(PropTypes__default["default"].any),
172886
172920
  renderIconByName: PropTypes__default["default"].func,
172887
172921
 
172888
172922
  /** Optional trend information */
@@ -172914,6 +172948,8 @@
172914
172948
  locale: 'en',
172915
172949
  customFormatter: null,
172916
172950
  isEditable: false,
172951
+ shouldUseTranslatedLabels: false,
172952
+ i18n: {},
172917
172953
  testId: 'attribute',
172918
172954
  onValueClick: null
172919
172955
  };
@@ -172939,6 +172975,8 @@
172939
172975
  isEditable = _ref.isEditable,
172940
172976
  layout = _ref.layout,
172941
172977
  locale = _ref.locale,
172978
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
172979
+ i18n = _ref.i18n,
172942
172980
  renderIconByName = _ref.renderIconByName,
172943
172981
  secondaryValue = _ref.secondaryValue,
172944
172982
  value = _ref.value,
@@ -172954,7 +172992,10 @@
172954
172992
  var matchingThreshold = thresholds ? isEditable ? thresholds[0] : matchedThreshold : null;
172955
172993
  var valueColor = matchingThreshold && matchingThreshold.icon === undefined ? matchingThreshold.color : null; // need to reduce the width size to fit multiple attributes when card layout is horizontal
172956
172994
 
172957
- var attributeWidthPercentage = layout === CARD_LAYOUTS.HORIZONTAL ? 100 / attributeCount : 100;
172995
+ var attributeWidthPercentage = layout === CARD_LAYOUTS.HORIZONTAL ? 100 / attributeCount : 100; // Get translated label if shouldUseTranslatedLabels is true
172996
+
172997
+ var displayLabel = getTranslatedLabel(label, shouldUseTranslatedLabels, i18n);
172998
+ var displayUnitLabel = getTranslatedLabel(unit, shouldUseTranslatedLabels, i18n);
172958
172999
  return /*#__PURE__*/React__default["default"].createElement("div", {
172959
173000
  className: classnames$3("".concat(BEM_BASE, "-wrapper"), (_classnames = {}, defineProperty$d(_classnames, "".concat(BEM_BASE, "-wrapper--vertical"), layout === CARD_LAYOUTS.VERTICAL), defineProperty$d(_classnames, "".concat(BEM_BASE, "-wrapper--horizontal"), layout === CARD_LAYOUTS.HORIZONTAL), _classnames)),
172960
173001
  style: {
@@ -172974,9 +173015,9 @@
172974
173015
  }) : null, tooltip ? /*#__PURE__*/React__default["default"].createElement(carbonComponentsReact.TooltipDefinition, {
172975
173016
  direction: "right",
172976
173017
  tooltipText: tooltip
172977
- }, label) : /*#__PURE__*/React__default["default"].createElement("span", {
173018
+ }, displayLabel) : /*#__PURE__*/React__default["default"].createElement("span", {
172978
173019
  "data-testid": "".concat(testId, "-threshold-label")
172979
- }, label)), /*#__PURE__*/React__default["default"].createElement("div", {
173020
+ }, displayLabel)), /*#__PURE__*/React__default["default"].createElement("div", {
172980
173021
  className: "".concat(BEM_BASE)
172981
173022
  }, /*#__PURE__*/React__default["default"].createElement(ValueRenderer$1, {
172982
173023
  value: value,
@@ -172992,7 +173033,7 @@
172992
173033
  measurementUnitLabel: measurementUnitLabel,
172993
173034
  onClick: onValueClick
172994
173035
  }), /*#__PURE__*/React__default["default"].createElement(UnitRenderer$1, {
172995
- unit: unit,
173036
+ unit: displayUnitLabel,
172996
173037
  testId: "".concat(testId, "-unit")
172997
173038
  })), !isNil(secondaryValue) ? /*#__PURE__*/React__default["default"].createElement("div", {
172998
173039
  "data-testid": "".concat(testId, "-secondary-value"),
@@ -173153,6 +173194,31 @@
173153
173194
  "required": false,
173154
173195
  "description": ""
173155
173196
  },
173197
+ "shouldUseTranslatedLabels": {
173198
+ "defaultValue": {
173199
+ "value": "false",
173200
+ "computed": false
173201
+ },
173202
+ "type": {
173203
+ "name": "bool"
173204
+ },
173205
+ "required": false,
173206
+ "description": "whether to use translated labels in cards"
173207
+ },
173208
+ "i18n": {
173209
+ "defaultValue": {
173210
+ "value": "{}",
173211
+ "computed": false
173212
+ },
173213
+ "type": {
173214
+ "name": "objectOf",
173215
+ "value": {
173216
+ "name": "any"
173217
+ }
173218
+ },
173219
+ "required": false,
173220
+ "description": ""
173221
+ },
173156
173222
  "testId": {
173157
173223
  "defaultValue": {
173158
173224
  "value": "'attribute'",
@@ -173288,7 +173354,10 @@
173288
173354
  title: PropTypes__default["default"].string,
173289
173355
  layout: PropTypes__default["default"].oneOf(['HORIZONTAL', 'VERTICAL']),
173290
173356
  locale: PropTypes__default["default"].string,
173291
- isEditable: PropTypes__default["default"].bool
173357
+ isEditable: PropTypes__default["default"].bool,
173358
+
173359
+ /** whether to use translated labels in cards */
173360
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool
173292
173361
  }, ValueContentPropTypes);
173293
173362
 
173294
173363
  var defaultProps$17 = {
@@ -173297,6 +173366,7 @@
173297
173366
  layout: 'VERTICAL',
173298
173367
  locale: 'en',
173299
173368
  isEditable: false,
173369
+ shouldUseTranslatedLabels: false,
173300
173370
  dataState: null,
173301
173371
  values: null,
173302
173372
  fontSize: DEFAULT_FONT_SIZE,
@@ -173316,13 +173386,14 @@
173316
173386
  dataState = _ref.dataState,
173317
173387
  locale = _ref.locale,
173318
173388
  isEditable = _ref.isEditable,
173389
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
173319
173390
  customFormatter = _ref.customFormatter,
173320
173391
  fontSize = _ref.fontSize,
173321
173392
  isNumberValueCompact = _ref.isNumberValueCompact,
173322
173393
  testId = _ref.testId,
173323
173394
  onAttributeClick = _ref.onAttributeClick,
173324
173395
  size = _ref.size,
173325
- others = objectWithoutProperties(_ref, ["id", "title", "content", "values", "layout", "dataState", "locale", "isEditable", "customFormatter", "fontSize", "isNumberValueCompact", "testId", "onAttributeClick", "size"]);
173396
+ others = objectWithoutProperties(_ref, ["id", "title", "content", "values", "layout", "dataState", "locale", "isEditable", "shouldUseTranslatedLabels", "customFormatter", "fontSize", "isNumberValueCompact", "testId", "onAttributeClick", "size"]);
173326
173397
 
173327
173398
  var attributeCount = content.attributes.length;
173328
173399
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -173336,6 +173407,8 @@
173336
173407
  locale: locale,
173337
173408
  isEditable: isEditable,
173338
173409
  title: title,
173410
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
173411
+ i18n: others.i18n,
173339
173412
  renderIconByName: others.renderIconByName,
173340
173413
  value: determineValue(attribute.dataSourceId, values, attribute.dataFilter),
173341
173414
  secondaryValue: attribute.secondaryValue && _objectSpread$X(_objectSpread$X({}, attribute.secondaryValue), {}, {
@@ -173424,6 +173497,17 @@
173424
173497
  "required": false,
173425
173498
  "description": ""
173426
173499
  },
173500
+ "shouldUseTranslatedLabels": {
173501
+ "defaultValue": {
173502
+ "value": "false",
173503
+ "computed": false
173504
+ },
173505
+ "type": {
173506
+ "name": "bool"
173507
+ },
173508
+ "required": false,
173509
+ "description": "whether to use translated labels in cards"
173510
+ },
173427
173511
  "dataState": {
173428
173512
  "defaultValue": {
173429
173513
  "value": "null",
@@ -173515,7 +173599,8 @@
173515
173599
  testID = _ref.testID,
173516
173600
  testId = _ref.testId,
173517
173601
  onAttributeClick = _ref.onAttributeClick,
173518
- others = objectWithoutProperties(_ref, ["title", "content", "size", "values", "isEditable", "isResizable", "i18n", "dataState", "id", "locale", "customFormatter", "children", "fontSize", "isNumberValueCompact", "testID", "testId", "onAttributeClick"]);
173602
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
173603
+ others = objectWithoutProperties(_ref, ["title", "content", "size", "values", "isEditable", "isResizable", "i18n", "dataState", "id", "locale", "customFormatter", "children", "fontSize", "isNumberValueCompact", "testID", "testId", "onAttributeClick", "shouldUseTranslatedLabels"]);
173519
173604
 
173520
173605
  var availableActions = _objectSpread$W({
173521
173606
  expand: false
@@ -173541,6 +173626,7 @@
173541
173626
  isResizable: isResizable,
173542
173627
  resizeHandles: resizeHandles,
173543
173628
  i18n: i18n,
173629
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
173544
173630
  locale: locale,
173545
173631
  id: id,
173546
173632
  className: classnames$3((_classnames = {}, defineProperty$d(_classnames, "".concat(BASE_CLASS_NAME$2, "__horizontal"), layout === CARD_LAYOUTS.HORIZONTAL), defineProperty$d(_classnames, "".concat(BASE_CLASS_NAME$2, "__vertical"), layout === CARD_LAYOUTS.VERTICAL), _classnames)) // TODO: remove deprecated 'testID' in v3.
@@ -173560,7 +173646,9 @@
173560
173646
  values: values,
173561
173647
  isEditable: isEditable,
173562
173648
  fontSize: fontSize,
173563
- isNumberValueCompact: isNumberValueCompact
173649
+ isNumberValueCompact: isNumberValueCompact,
173650
+ i18n: i18n,
173651
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels
173564
173652
  }, others)), resizeHandles);
173565
173653
  };
173566
173654
 
@@ -173577,7 +173665,8 @@
173577
173665
  isNumberValueCompact: false,
173578
173666
  // TODO: fix this default in V3, so that cards are unique not inherited from the base Card
173579
173667
  testId: 'Card',
173580
- onAttributeClick: null
173668
+ onAttributeClick: null,
173669
+ shouldUseTranslatedLabels: false
173581
173670
  };
173582
173671
  ValueCard.__docgenInfo = {
173583
173672
  "description": "This components responsibilities include:\nRendering the attribute groups\nDetermining the layout\ndetermines the data to render",
@@ -173653,6 +173742,13 @@
173653
173742
  "computed": false
173654
173743
  },
173655
173744
  "required": false
173745
+ },
173746
+ "shouldUseTranslatedLabels": {
173747
+ "defaultValue": {
173748
+ "value": "false",
173749
+ "computed": false
173750
+ },
173751
+ "required": false
173656
173752
  }
173657
173753
  },
173658
173754
  "composes": ["../../constants/CardPropTypes"]
@@ -182552,6 +182648,9 @@
182552
182648
  thisYearLabel: PropTypes__default["default"].string
182553
182649
  }),
182554
182650
 
182651
+ /** whether to use translated labels in cards */
182652
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
182653
+
182555
182654
  /** if provided, returns an array of strings which are the timeRanges to be allowed
182556
182655
  * on each card
182557
182656
  * getValidTimeRanges(card, selectedDataItems)
@@ -182586,6 +182685,7 @@
182586
182685
  thisQuarterLabel: 'This quarter',
182587
182686
  thisYearLabel: 'This year'
182588
182687
  },
182688
+ shouldUseTranslatedLabels: false,
182589
182689
  selectedDataItems: [],
182590
182690
  getValidTimeRanges: null,
182591
182691
  currentBreakpoint: 'xl',
@@ -182611,6 +182711,7 @@
182611
182711
  var cardConfig = _ref.cardConfig,
182612
182712
  _onChange = _ref.onChange,
182613
182713
  i18n = _ref.i18n,
182714
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
182614
182715
  getValidTimeRanges = _ref.getValidTimeRanges,
182615
182716
  currentBreakpoint = _ref.currentBreakpoint,
182616
182717
  selectedDataItems = _ref.selectedDataItems,
@@ -182643,7 +182744,7 @@
182643
182744
  title: evt.target.value
182644
182745
  }));
182645
182746
  },
182646
- value: title
182747
+ value: getTranslatedLabel(title, shouldUseTranslatedLabels, mergedI18n)
182647
182748
  })), /*#__PURE__*/React__default["default"].createElement("div", {
182648
182749
  className: "".concat(baseClassName, "--input")
182649
182750
  }, /*#__PURE__*/React__default["default"].createElement(carbonComponentsReact.TextArea, {
@@ -182655,7 +182756,7 @@
182655
182756
  description: evt.target.value
182656
182757
  }));
182657
182758
  },
182658
- value: description
182759
+ value: getTranslatedLabel(description, shouldUseTranslatedLabels, mergedI18n)
182659
182760
  })), /*#__PURE__*/React__default["default"].createElement("div", {
182660
182761
  className: "".concat(baseClassName, "--input")
182661
182762
  }, /*#__PURE__*/React__default["default"].createElement(carbonComponentsReact.Dropdown, {
@@ -182938,6 +183039,17 @@
182938
183039
  "required": false,
182939
183040
  "description": ""
182940
183041
  },
183042
+ "shouldUseTranslatedLabels": {
183043
+ "defaultValue": {
183044
+ "value": "false",
183045
+ "computed": false
183046
+ },
183047
+ "type": {
183048
+ "name": "bool"
183049
+ },
183050
+ "required": false,
183051
+ "description": "whether to use translated labels in cards"
183052
+ },
182941
183053
  "selectedDataItems": {
182942
183054
  "defaultValue": {
182943
183055
  "value": "[]",
@@ -184289,6 +184401,9 @@
184289
184401
  primaryButtonLabelText: PropTypes__default["default"].string,
184290
184402
  secondaryButtonLabelText: PropTypes__default["default"].string
184291
184403
  }),
184404
+
184405
+ /** whether to use translated labels in cards */
184406
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
184292
184407
  actions: DashboardEditorActionsPropTypes,
184293
184408
 
184294
184409
  /**
@@ -184343,6 +184458,7 @@
184343
184458
  secondaryButtonLabelText: 'Cancel',
184344
184459
  decimalPlacesLabel: 'Decimal places'
184345
184460
  },
184461
+ shouldUseTranslatedLabels: false,
184346
184462
  editDataSeries: [],
184347
184463
  showEditor: false,
184348
184464
  setShowEditor: null,
@@ -184425,6 +184541,7 @@
184425
184541
  availableDimensions = _ref.availableDimensions,
184426
184542
  onChange = _ref.onChange,
184427
184543
  i18n = _ref.i18n,
184544
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
184428
184545
  isLarge = _ref.isLarge,
184429
184546
  testId = _ref.testId,
184430
184547
  _ref$actions$dataSeri = _ref.actions.dataSeriesFormActions,
@@ -184595,7 +184712,7 @@
184595
184712
  label: evt.target.value
184596
184713
  }));
184597
184714
  },
184598
- value: editDataItem.label,
184715
+ value: getTranslatedLabel(editDataItem.label, shouldUseTranslatedLabels, i18n),
184599
184716
  helperText: mergedI18n.dataItemEditorDataItemHelperText(mergedI18n.dataItemSource, editDataItem.dataItemId)
184600
184717
  })), hasColorDropdown &&
184601
184718
  /*#__PURE__*/
@@ -184642,7 +184759,7 @@
184642
184759
  unit: evt.target.value
184643
184760
  }));
184644
184761
  },
184645
- value: editDataItem.unit
184762
+ value: getTranslatedLabel(editDataItem.unit, shouldUseTranslatedLabels, i18n)
184646
184763
  })), hasDecimalPlacesDropdown && /*#__PURE__*/React__default["default"].createElement("div", {
184647
184764
  className: "".concat(baseClassName, "--input-group--item-end")
184648
184765
  }, /*#__PURE__*/React__default["default"].createElement(carbonComponentsReact.Dropdown, {
@@ -184729,7 +184846,7 @@
184729
184846
  },
184730
184847
  columnType: editDataItem.columnType || editDataItem.type
184731
184848
  }));
184732
- }, [availableDimensions, availableGrains, baseClassName, cardConfig, editDataItem, handleTranslation, hasAggregationsDropDown, hasColorDropdown, hasDataFilterDropdown, hasDecimalPlacesDropdown, hasThresholds, hasTooltip, hasUnit, id, initialAggregation, initialGrain, isSummaryDashboard, isTimeBasedCard, mergedI18n, onAddAggregations, selectedDimensionFilter, setEditDataItem, testId, type]);
184849
+ }, [availableDimensions, availableGrains, baseClassName, cardConfig, editDataItem, handleTranslation, hasAggregationsDropDown, hasColorDropdown, hasDataFilterDropdown, hasDecimalPlacesDropdown, hasThresholds, hasTooltip, hasUnit, i18n, id, initialAggregation, initialGrain, isSummaryDashboard, isTimeBasedCard, mergedI18n, onAddAggregations, selectedDimensionFilter, setEditDataItem, shouldUseTranslatedLabels, testId, type]);
184733
184850
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showEditor && /*#__PURE__*/React__default["default"].createElement("div", {
184734
184851
  className: "".concat(baseClassName, "--modal-wrapper")
184735
184852
  }, /*#__PURE__*/React__default["default"].createElement(ComposedModal$1, {
@@ -184959,6 +185076,17 @@
184959
185076
  "required": false,
184960
185077
  "description": ""
184961
185078
  },
185079
+ "shouldUseTranslatedLabels": {
185080
+ "defaultValue": {
185081
+ "value": "false",
185082
+ "computed": false
185083
+ },
185084
+ "type": {
185085
+ "name": "bool"
185086
+ },
185087
+ "required": false,
185088
+ "description": "whether to use translated labels in cards"
185089
+ },
184962
185090
  "editDataSeries": {
184963
185091
  "defaultValue": {
184964
185092
  "value": "[]",
@@ -185806,6 +185934,9 @@
185806
185934
  incrementNumberText: PropTypes__default["default"].string,
185807
185935
  decrementNumberText: PropTypes__default["default"].string
185808
185936
  }),
185937
+
185938
+ /** whether to use translated labels in cards */
185939
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
185809
185940
  translateWithId: PropTypes__default["default"].func.isRequired,
185810
185941
  actions: DashboardEditorActionsPropTypes
185811
185942
  };
@@ -185839,6 +185970,7 @@
185839
185970
  incrementNumberText: 'Increment number',
185840
185971
  decrementNumberText: 'Decrement number'
185841
185972
  },
185973
+ shouldUseTranslatedLabels: false,
185842
185974
  getValidDataItems: null,
185843
185975
  dataItems: [],
185844
185976
  selectedDataItems: [],
@@ -185940,6 +186072,7 @@
185940
186072
  selectedTimeRange = _ref2.selectedTimeRange,
185941
186073
  availableDimensions = _ref2.availableDimensions,
185942
186074
  i18n = _ref2.i18n,
186075
+ shouldUseTranslatedLabels = _ref2.shouldUseTranslatedLabels,
185943
186076
  dataSeriesItemLinks = _ref2.dataSeriesItemLinks,
185944
186077
  translateWithId = _ref2.translateWithId,
185945
186078
  actions = _ref2.actions;
@@ -186081,7 +186214,7 @@
186081
186214
  return {
186082
186215
  id: dataItem.dataSourceId,
186083
186216
  content: {
186084
- value: dataItem.label || dataItem.dataItemId,
186217
+ value: getTranslatedLabel(dataItem.label || dataItem.dataItemId, shouldUseTranslatedLabels, i18n),
186085
186218
  icon: cardConfig.type === CARD_TYPES.TIMESERIES || cardConfig.type === CARD_TYPES.BAR ? /*#__PURE__*/React__default["default"].createElement("div", {
186086
186219
  className: "".concat(baseClassName$3, "--data-item-list--item-color-icon"),
186087
186220
  style: {
@@ -186118,7 +186251,7 @@
186118
186251
  }
186119
186252
  };
186120
186253
  });
186121
- }, [cardConfig.type, dataSection, handleEditButton, handleRemoveButton, mergedI18n.edit, mergedI18n.remove]);
186254
+ }, [cardConfig.type, dataSection, handleEditButton, handleRemoveButton, i18n, mergedI18n.edit, mergedI18n.remove, shouldUseTranslatedLabels]);
186122
186255
  return !isEmpty(validDataItems) ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(DataSeriesFormItemModal$1, {
186123
186256
  cardConfig: cardConfig,
186124
186257
  isSummaryDashboard: isSummaryDashboard,
@@ -186133,6 +186266,7 @@
186133
186266
  dataSection: dataSection,
186134
186267
  onChange: _onChange,
186135
186268
  i18n: mergedI18n,
186269
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
186136
186270
  actions: actions,
186137
186271
  options: {
186138
186272
  hasColorDropdown: type === CARD_TYPES.TIMESERIES || type === CARD_TYPES.BAR,
@@ -186445,6 +186579,17 @@
186445
186579
  "required": false,
186446
186580
  "description": ""
186447
186581
  },
186582
+ "shouldUseTranslatedLabels": {
186583
+ "defaultValue": {
186584
+ "value": "false",
186585
+ "computed": false
186586
+ },
186587
+ "type": {
186588
+ "name": "bool"
186589
+ },
186590
+ "required": false,
186591
+ "description": "whether to use translated labels in cards"
186592
+ },
186448
186593
  "getValidDataItems": {
186449
186594
  "defaultValue": {
186450
186595
  "value": "null",
@@ -192027,6 +192172,9 @@
192027
192172
  thisYearLabel: PropTypes__default["default"].string
192028
192173
  }),
192029
192174
 
192175
+ /** whether to use translated labels in cards */
192176
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
192177
+
192030
192178
  /** if provided, returns an array of strings which are the timeRanges to be allowed
192031
192179
  * on each card
192032
192180
  * getValidTimeRanges(card, selectedDataItems)
@@ -192067,6 +192215,7 @@
192067
192215
  var defaultProps$G = {
192068
192216
  cardConfig: {},
192069
192217
  i18n: {},
192218
+ shouldUseTranslatedLabels: false,
192070
192219
  getValidDataItems: null,
192071
192220
  getValidTimeRanges: null,
192072
192221
  dataItems: [],
@@ -192108,6 +192257,7 @@
192108
192257
  isSummaryDashboard = _ref.isSummaryDashboard,
192109
192258
  onChange = _ref.onChange,
192110
192259
  i18n = _ref.i18n,
192260
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
192111
192261
  dataItems = _ref.dataItems,
192112
192262
  getValidDataItems = _ref.getValidDataItems,
192113
192263
  getValidTimeRanges = _ref.getValidTimeRanges,
@@ -192145,6 +192295,7 @@
192145
192295
  ,
192146
192296
  onChange: onChange,
192147
192297
  i18n: mergedI18n,
192298
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
192148
192299
  getValidTimeRanges: getValidTimeRanges,
192149
192300
  currentBreakpoint: currentBreakpoint,
192150
192301
  selectedDataItems: selectedDataItems,
@@ -192191,6 +192342,7 @@
192191
192342
  getValidDataItems: getValidDataItems,
192192
192343
  availableDimensions: availableDimensions,
192193
192344
  i18n: mergedI18n,
192345
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
192194
192346
  dataSeriesItemLinks: dataSeriesItemLinks,
192195
192347
  translateWithId: handleTranslation,
192196
192348
  actions: actions
@@ -192432,6 +192584,17 @@
192432
192584
  "required": false,
192433
192585
  "description": ""
192434
192586
  },
192587
+ "shouldUseTranslatedLabels": {
192588
+ "defaultValue": {
192589
+ "value": "false",
192590
+ "computed": false
192591
+ },
192592
+ "type": {
192593
+ "name": "bool"
192594
+ },
192595
+ "required": false,
192596
+ "description": "whether to use translated labels in cards"
192597
+ },
192435
192598
  "getValidDataItems": {
192436
192599
  "defaultValue": {
192437
192600
  "value": "null",
@@ -194461,6 +194624,9 @@
194461
194624
  modalIconDescription: PropTypes__default["default"].string
194462
194625
  }),
194463
194626
 
194627
+ /** whether to use translated labels in cards */
194628
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
194629
+
194464
194630
  /** if provided, returns an array of strings which are the dataItems to be allowed
194465
194631
  * on each card
194466
194632
  * getValidDataItems(card, selectedTimeRange)
@@ -194526,6 +194692,7 @@
194526
194692
  modalHelpText: 'The JSON definition for this card is provided below. You can modify this data directly to update the card configuration.',
194527
194693
  modalIconDescription: 'Close'
194528
194694
  },
194695
+ shouldUseTranslatedLabels: false,
194529
194696
  getValidDataItems: null,
194530
194697
  getValidTimeRanges: null,
194531
194698
  dataItems: [],
@@ -194555,6 +194722,7 @@
194555
194722
  availableDimensions = _ref.availableDimensions,
194556
194723
  dataSeriesItemLinks = _ref.dataSeriesItemLinks,
194557
194724
  onFetchDynamicDemoHotspots = _ref.onFetchDynamicDemoHotspots,
194725
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
194558
194726
  actions = _ref.actions;
194559
194727
  var mergedI18n = React$1.useMemo(function () {
194560
194728
  return _objectSpread$p(_objectSpread$p({}, defaultProps$z.i18n), i18n);
@@ -194572,6 +194740,7 @@
194572
194740
  onChange: onChange,
194573
194741
  isSummaryDashboard: isSummaryDashboard,
194574
194742
  i18n: mergedI18n,
194743
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
194575
194744
  dataItems: dataItems,
194576
194745
  availableDimensions: availableDimensions,
194577
194746
  getValidDataItems: getValidDataItems,
@@ -194722,6 +194891,17 @@
194722
194891
  "required": false,
194723
194892
  "description": ""
194724
194893
  },
194894
+ "shouldUseTranslatedLabels": {
194895
+ "defaultValue": {
194896
+ "value": "false",
194897
+ "computed": false
194898
+ },
194899
+ "type": {
194900
+ "name": "bool"
194901
+ },
194902
+ "required": false,
194903
+ "description": "whether to use translated labels in cards"
194904
+ },
194725
194905
  "getValidDataItems": {
194726
194906
  "defaultValue": {
194727
194907
  "value": "null",
@@ -194983,6 +195163,9 @@
194983
195163
  searchPlaceHolderText: PropTypes__default["default"].string,
194984
195164
  editDataItems: PropTypes__default["default"].string
194985
195165
  }),
195166
+
195167
+ /** whether to use translated labels in cards */
195168
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
194986
195169
  currentBreakpoint: PropTypes__default["default"].string,
194987
195170
  isSummaryDashboard: PropTypes__default["default"].bool,
194988
195171
 
@@ -195018,6 +195201,7 @@
195018
195201
  modalHelpText: 'The JSON definition for this card is provided below. You can modify this data directly to update the card configuration.',
195019
195202
  modalIconDescription: 'Close'
195020
195203
  },
195204
+ shouldUseTranslatedLabels: false,
195021
195205
  getValidDimensions: null,
195022
195206
  getValidDataItems: null,
195023
195207
  getValidTimeRanges: null,
@@ -195183,6 +195367,7 @@
195183
195367
  onRenderCardEditForm = _ref.onRenderCardEditForm,
195184
195368
  icons = _ref.icons,
195185
195369
  i18n = _ref.i18n,
195370
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
195186
195371
  currentBreakpoint = _ref.currentBreakpoint,
195187
195372
  testId = _ref.testId,
195188
195373
  dataSeriesItemLinks = _ref.dataSeriesItemLinks,
@@ -195251,6 +195436,7 @@
195251
195436
  getValidTimeRanges: getValidTimeRanges,
195252
195437
  availableDimensions: availableDimensions,
195253
195438
  i18n: mergedI18n,
195439
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
195254
195440
  currentBreakpoint: currentBreakpoint,
195255
195441
  dataSeriesItemLinks: dataSeriesItemLinks,
195256
195442
  onFetchDynamicDemoHotspots: onFetchDynamicDemoHotspots,
@@ -195417,6 +195603,17 @@
195417
195603
  "required": false,
195418
195604
  "description": "i18n must include the label for each `supportedCardTypes`\nex:\n[\n TIMESERIES: 'ITEM 1',\n ALERT: 'ITEM 8',\n CUSTOM: 'ITEM 10',\n COOL_NEW_CARD: 'Missing Icon',\n]"
195419
195605
  },
195606
+ "shouldUseTranslatedLabels": {
195607
+ "defaultValue": {
195608
+ "value": "false",
195609
+ "computed": false
195610
+ },
195611
+ "type": {
195612
+ "name": "bool"
195613
+ },
195614
+ "required": false,
195615
+ "description": "whether to use translated labels in cards"
195616
+ },
195420
195617
  "getValidDimensions": {
195421
195618
  "defaultValue": {
195422
195619
  "value": "null",
@@ -196449,7 +196646,8 @@
196449
196646
  baseClassName = _ref2.baseClassName,
196450
196647
  renderCardPreview = _ref2.renderCardPreview,
196451
196648
  style = _ref2.style,
196452
- cardConfig = objectWithoutProperties(_ref2, ["isSelected", "availableDimensions", "i18n", "onRemove", "onDuplicate", "onCardChange", "setSelectedCardId", "renderIconByName", "onShowImageGallery", "onValidateUploadedImage", "baseClassName", "renderCardPreview", "style"]);
196649
+ shouldUseTranslatedLabels = _ref2.shouldUseTranslatedLabels,
196650
+ cardConfig = objectWithoutProperties(_ref2, ["isSelected", "availableDimensions", "i18n", "onRemove", "onDuplicate", "onCardChange", "setSelectedCardId", "renderIconByName", "onShowImageGallery", "onValidateUploadedImage", "baseClassName", "renderCardPreview", "style", "shouldUseTranslatedLabels"]);
196453
196651
 
196454
196652
  // We have to keep track of our dynamic hotspots here
196455
196653
  var _useState5 = React$1.useState([]),
@@ -196484,6 +196682,7 @@
196484
196682
  key: cardConfig.id,
196485
196683
  tooltip: cardConfig.description,
196486
196684
  i18n: i18n,
196685
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
196487
196686
  availableActions: availableActions,
196488
196687
  onCardAction: handleOnCardAction,
196489
196688
  renderIconByName: renderIconByName,
@@ -196496,7 +196695,7 @@
196496
196695
  onBrowseClick: cardConfig.type === CARD_TYPES.IMAGE && isNil((_cardConfig$content = cardConfig.content) === null || _cardConfig$content === void 0 ? void 0 : _cardConfig$content.src) ? onShowImageGallery : undefined,
196497
196696
  validateUploadedImage: cardConfig.type === CARD_TYPES.IMAGE ? onValidateUploadedImage : undefined
196498
196697
  });
196499
- }, [baseClassName, cardConfig, handleOnCardAction, handleOnCardKeyDown, handleOnCardMouseDown, i18n, isSelected, onShowImageGallery, onValidateUploadedImage, renderIconByName, style]);
196698
+ }, [baseClassName, cardConfig, handleOnCardAction, handleOnCardKeyDown, handleOnCardMouseDown, i18n, isSelected, onShowImageGallery, onValidateUploadedImage, renderIconByName, shouldUseTranslatedLabels, style]);
196500
196699
  React$1.useEffect(function () {
196501
196700
  var _cardProps$values, _cardProps$values$hot;
196502
196701
 
@@ -196855,6 +197054,9 @@
196855
197054
  editDataItems: PropTypes__default["default"].string
196856
197055
  }),
196857
197056
 
197057
+ /** whether to use translated labels in cards */
197058
+ shouldUseTranslatedLabels: PropTypes__default["default"].bool,
197059
+
196858
197060
  /** locale data */
196859
197061
  locale: PropTypes__default["default"].string,
196860
197062
 
@@ -196948,6 +197150,7 @@
196948
197150
  saveTitleButton: 'Save title',
196949
197151
  editDataItems: 'Edit data items'
196950
197152
  },
197153
+ shouldUseTranslatedLabels: false,
196951
197154
  locale: 'en',
196952
197155
  dataSeriesItemLinks: null,
196953
197156
  onFetchDynamicDemoHotspots: function onFetchDynamicDemoHotspots() {
@@ -197026,6 +197229,7 @@
197026
197229
  isSummaryDashboard = _ref.isSummaryDashboard,
197027
197230
  isLoading = _ref.isLoading,
197028
197231
  i18n = _ref.i18n,
197232
+ shouldUseTranslatedLabels = _ref.shouldUseTranslatedLabels,
197029
197233
  locale = _ref.locale,
197030
197234
  dataSeriesItemLinks = _ref.dataSeriesItemLinks,
197031
197235
  isTitleEditable = _ref.isTitleEditable,
@@ -197292,7 +197496,7 @@
197292
197496
  className: classnames$3("".concat(baseClassName$1, "--content"), defineProperty$d({}, "".concat(baseClassName$1, "__overflow"), selectedBreakpointIndex !== LAYOUTS.FIT_TO_SCREEN.index)),
197293
197497
  ref: scrollContainerRef
197294
197498
  }, renderHeader ? renderHeader() : /*#__PURE__*/React__default["default"].createElement(DashboardEditorHeader$1, {
197295
- title: (dashboardJson === null || dashboardJson === void 0 ? void 0 : dashboardJson.title) || title,
197499
+ title: getTranslatedLabel(dashboardJson === null || dashboardJson === void 0 ? void 0 : dashboardJson.title, shouldUseTranslatedLabels, i18n) || title,
197296
197500
  breadcrumbs: headerBreadcrumbs,
197297
197501
  onImport: onImport,
197298
197502
  onExport: function onExport() {
@@ -197376,6 +197580,7 @@
197376
197580
  key: cardConfig.id,
197377
197581
  isResizable: isCardResizable,
197378
197582
  i18n: mergedI18n,
197583
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
197379
197584
  isSelected: isSelected,
197380
197585
  availableDimensions: availableDimensions,
197381
197586
  onFetchDynamicDemoHotspots: onFetchDynamicDemoHotspots,
@@ -197420,6 +197625,7 @@
197420
197625
  getValidDimensions: getValidDimensions,
197421
197626
  availableDimensions: availableDimensions,
197422
197627
  i18n: mergedI18n,
197628
+ shouldUseTranslatedLabels: shouldUseTranslatedLabels,
197423
197629
  currentBreakpoint: currentBreakpoint,
197424
197630
  dataSeriesItemLinks: dataSeriesItemLinks,
197425
197631
  onFetchDynamicDemoHotspots: onFetchDynamicDemoHotspots,
@@ -198343,6 +198549,17 @@
198343
198549
  "required": false,
198344
198550
  "description": "internationalization strings"
198345
198551
  },
198552
+ "shouldUseTranslatedLabels": {
198553
+ "defaultValue": {
198554
+ "value": "false",
198555
+ "computed": false
198556
+ },
198557
+ "type": {
198558
+ "name": "bool"
198559
+ },
198560
+ "required": false,
198561
+ "description": "whether to use translated labels in cards"
198562
+ },
198346
198563
  "locale": {
198347
198564
  "defaultValue": {
198348
198565
  "value": "'en'",