carbon-addons-iot-react 5.14.0 → 5.15.0

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.
@@ -36,7 +36,7 @@ import CardToolbar from './CardToolbar.js';
36
36
  import { CardTitle } from './CardTitle.js';
37
37
 
38
38
  var _excluded = ["isSelected", "children", "dimensions", "id", "style", "className", "onScroll", "onMouseDown", "onMouseUp", "onTouchEnd", "onTouchStart", "onFocus", "onBlur", "tabIndex", "testID", "testId"],
39
- _excluded2 = ["size", "children", "title", "subtitle", "hasTitleWrap", "layout", "isLoading", "isEmpty", "isEditable", "isExpanded", "isLazyLoading", "isResizable", "resizeHandles", "error", "hideHeader", "hideTitle", "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", "extraHeaderContent", "timeZone", "shouldUseTranslatedLabels"];
39
+ _excluded2 = ["size", "children", "title", "subtitle", "hasTitleWrap", "layout", "isLoading", "isEmpty", "isEditable", "isExpanded", "isLazyLoading", "isResizable", "resizeHandles", "error", "hideHeader", "hideTitle", "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", "extraHeaderContent", "timeZone", "shouldUseTranslatedLabels", "backgroundGradient", "theme"];
40
40
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
41
41
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
42
42
  var prefix = settings.prefix,
@@ -186,6 +186,7 @@ var defaultProps = {
186
186
  isExpanded: false,
187
187
  /** performance option: only render the content of the card to the ReactDOM if the card is visible on screen */
188
188
  isLazyLoading: false,
189
+ theme: 'light',
189
190
  /** For now we will hide the per card actions when we're editing */
190
191
  availableActions: {
191
192
  edit: false,
@@ -254,7 +255,8 @@ var defaultProps = {
254
255
  type: null,
255
256
  data: null,
256
257
  content: null,
257
- shouldUseTranslatedLabels: false
258
+ shouldUseTranslatedLabels: false,
259
+ backgroundGradient: null
258
260
  };
259
261
 
260
262
  /** Dumb component that renders the card basics */
@@ -304,6 +306,8 @@ var Card = function Card(props) {
304
306
  extraHeaderContent = props.extraHeaderContent,
305
307
  timeZone = props.timeZone,
306
308
  shouldUseTranslatedLabels = props.shouldUseTranslatedLabels,
309
+ backgroundGradient = props.backgroundGradient,
310
+ theme = props.theme,
307
311
  others = _objectWithoutProperties(props, _excluded2);
308
312
  var effectiveTimezone = timeZone || dayjs.tz.guess();
309
313
  dayjs.tz.setDefault(effectiveTimezone);
@@ -435,11 +439,15 @@ var Card = function Card(props) {
435
439
  id: id,
436
440
  dimensions: dimensions,
437
441
  isExpanded: isExpanded,
438
- style: !isExpanded ? style : {
442
+ style: !isExpanded ? _objectSpread(_objectSpread({}, style), backgroundGradient && {
443
+ background: backgroundGradient
444
+ }) : _objectSpread({
439
445
  height: 'calc(100% - 50px)',
440
446
  width: 'calc(100% - 50px)'
441
- },
442
- className: classnames("".concat(iotPrefix, "--card"), className, _defineProperty({}, "".concat(iotPrefix, "--card--resizing"), isResizing))
447
+ }, backgroundGradient && {
448
+ background: backgroundGradient
449
+ }),
450
+ className: classnames("".concat(iotPrefix, "--card"), "".concat(iotPrefix, "--card--").concat(theme), className, _defineProperty({}, "".concat(iotPrefix, "--card--resizing"), isResizing))
443
451
  }), !hideHeader && !hideTitle && /*#__PURE__*/React__default.createElement(CardHeader
444
452
  // TODO: remove deprecated testID prop in v3
445
453
  , {
@@ -618,6 +626,13 @@ Card.__docgenInfo = {
618
626
  },
619
627
  "required": false
620
628
  },
629
+ "theme": {
630
+ "defaultValue": {
631
+ "value": "'light'",
632
+ "computed": false
633
+ },
634
+ "required": false
635
+ },
621
636
  "availableActions": {
622
637
  "defaultValue": {
623
638
  "value": "{\n edit: false,\n clone: false,\n delete: false,\n range: false,\n expand: false,\n settings: false,\n extra: false,\n}",
@@ -813,6 +828,13 @@ Card.__docgenInfo = {
813
828
  "computed": false
814
829
  },
815
830
  "required": false
831
+ },
832
+ "backgroundGradient": {
833
+ "defaultValue": {
834
+ "value": "null",
835
+ "computed": false
836
+ },
837
+ "required": false
816
838
  }
817
839
  },
818
840
  "composes": ["../../constants/CardPropTypes"]
@@ -786,7 +786,11 @@ var CardPropTypes = {
786
786
  }),
787
787
  /** If set to true it will render outside of the current DOM in a portal, otherwise render as a child */
788
788
  renderDateDropdownInPortal: PropTypes.bool,
789
- extraHeaderContent: PropTypes.element
789
+ extraHeaderContent: PropTypes.element,
790
+ /** CSS gradient value to apply as the card background. */
791
+ backgroundGradient: PropTypes.string,
792
+ /** Theme for the card. Can be 'light' or 'dark' */
793
+ theme: PropTypes.oneOf(['light', 'dark'])
790
794
  };
791
795
 
792
796
  export { AttributePropTypes, BarChartCardPropTypes, CHART_COLORS, CardDimensionPropTypes, CardDimensionsPropTypes, CardPropTypes, CardSizesToDimensionsPropTypes, ComboChartPropTypes, DATE_PICKER_OPTIONS, DashboardBreakpointsPropTypes, DashboardColumnsPropTypes, DashboardLayoutPropTypes, GaugeCardPropTypes, ImageCardPropTypes, ImageCardValuesPropType, MapCardPropTypes, MapControlPropType, MeterChartCardPropTypes, PieCardPropTypes, RowHeightPropTypes, SparklineChartCardPropTypes, StackedAreaChartCardPropTypes, TableCardPropTypes, TimeRangeOptionsPropTypes, TruncationPropTypes, ValueContentPropTypes, ZoomBarPropTypes };
@@ -51,7 +51,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
51
51
  var warning__default = /*#__PURE__*/_interopDefault(warning);
52
52
 
53
53
  var _excluded = ["isSelected", "children", "dimensions", "id", "style", "className", "onScroll", "onMouseDown", "onMouseUp", "onTouchEnd", "onTouchStart", "onFocus", "onBlur", "tabIndex", "testID", "testId"],
54
- _excluded2 = ["size", "children", "title", "subtitle", "hasTitleWrap", "layout", "isLoading", "isEmpty", "isEditable", "isExpanded", "isLazyLoading", "isResizable", "resizeHandles", "error", "hideHeader", "hideTitle", "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", "extraHeaderContent", "timeZone", "shouldUseTranslatedLabels"];
54
+ _excluded2 = ["size", "children", "title", "subtitle", "hasTitleWrap", "layout", "isLoading", "isEmpty", "isEditable", "isExpanded", "isLazyLoading", "isResizable", "resizeHandles", "error", "hideHeader", "hideTitle", "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", "extraHeaderContent", "timeZone", "shouldUseTranslatedLabels", "backgroundGradient", "theme"];
55
55
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
56
56
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
57
57
  var prefix = Settings.settings.prefix,
@@ -201,6 +201,7 @@ var defaultProps = {
201
201
  isExpanded: false,
202
202
  /** performance option: only render the content of the card to the ReactDOM if the card is visible on screen */
203
203
  isLazyLoading: false,
204
+ theme: 'light',
204
205
  /** For now we will hide the per card actions when we're editing */
205
206
  availableActions: {
206
207
  edit: false,
@@ -269,7 +270,8 @@ var defaultProps = {
269
270
  type: null,
270
271
  data: null,
271
272
  content: null,
272
- shouldUseTranslatedLabels: false
273
+ shouldUseTranslatedLabels: false,
274
+ backgroundGradient: null
273
275
  };
274
276
 
275
277
  /** Dumb component that renders the card basics */
@@ -319,6 +321,8 @@ var Card = function Card(props) {
319
321
  extraHeaderContent = props.extraHeaderContent,
320
322
  timeZone = props.timeZone,
321
323
  shouldUseTranslatedLabels = props.shouldUseTranslatedLabels,
324
+ backgroundGradient = props.backgroundGradient,
325
+ theme = props.theme,
322
326
  others = _objectWithoutProperties__default.default(props, _excluded2);
323
327
  var effectiveTimezone = timeZone || dayjs.default.tz.guess();
324
328
  dayjs.default.tz.setDefault(effectiveTimezone);
@@ -450,11 +454,15 @@ var Card = function Card(props) {
450
454
  id: id,
451
455
  dimensions: dimensions,
452
456
  isExpanded: isExpanded,
453
- style: !isExpanded ? style : {
457
+ style: !isExpanded ? _objectSpread(_objectSpread({}, style), backgroundGradient && {
458
+ background: backgroundGradient
459
+ }) : _objectSpread({
454
460
  height: 'calc(100% - 50px)',
455
461
  width: 'calc(100% - 50px)'
456
- },
457
- className: classnames__default.default("".concat(iotPrefix, "--card"), className, _defineProperty__default.default({}, "".concat(iotPrefix, "--card--resizing"), isResizing))
462
+ }, backgroundGradient && {
463
+ background: backgroundGradient
464
+ }),
465
+ className: classnames__default.default("".concat(iotPrefix, "--card"), "".concat(iotPrefix, "--card--").concat(theme), className, _defineProperty__default.default({}, "".concat(iotPrefix, "--card--resizing"), isResizing))
458
466
  }), !hideHeader && !hideTitle && /*#__PURE__*/React__default.default.createElement(CardHeader
459
467
  // TODO: remove deprecated testID prop in v3
460
468
  , {
@@ -633,6 +641,13 @@ Card.__docgenInfo = {
633
641
  },
634
642
  "required": false
635
643
  },
644
+ "theme": {
645
+ "defaultValue": {
646
+ "value": "'light'",
647
+ "computed": false
648
+ },
649
+ "required": false
650
+ },
636
651
  "availableActions": {
637
652
  "defaultValue": {
638
653
  "value": "{\n edit: false,\n clone: false,\n delete: false,\n range: false,\n expand: false,\n settings: false,\n extra: false,\n}",
@@ -828,6 +843,13 @@ Card.__docgenInfo = {
828
843
  "computed": false
829
844
  },
830
845
  "required": false
846
+ },
847
+ "backgroundGradient": {
848
+ "defaultValue": {
849
+ "value": "null",
850
+ "computed": false
851
+ },
852
+ "required": false
831
853
  }
832
854
  },
833
855
  "composes": ["../../constants/CardPropTypes"]
@@ -793,7 +793,11 @@ var CardPropTypes = {
793
793
  }),
794
794
  /** If set to true it will render outside of the current DOM in a portal, otherwise render as a child */
795
795
  renderDateDropdownInPortal: PropTypes__default.default.bool,
796
- extraHeaderContent: PropTypes__default.default.element
796
+ extraHeaderContent: PropTypes__default.default.element,
797
+ /** CSS gradient value to apply as the card background. */
798
+ backgroundGradient: PropTypes__default.default.string,
799
+ /** Theme for the card. Can be 'light' or 'dark' */
800
+ theme: PropTypes__default.default.oneOf(['light', 'dark'])
797
801
  };
798
802
 
799
803
  exports.AttributePropTypes = AttributePropTypes;
@@ -9254,6 +9254,14 @@ html[dir=rtl] .breadcrumb--container .cds--breadcrumb-item:last-child::after {
9254
9254
  outline-offset: -2px;
9255
9255
  }
9256
9256
 
9257
+ .iot--card--dark .iot--card--toolbar button.cds--overflow-menu svg {
9258
+ fill: white;
9259
+ }
9260
+
9261
+ .iot--card--dark .iot--card--toolbar button.cds--overflow-menu.cds--overflow-menu--open svg {
9262
+ fill: var(--cds-icon-primary, #161616);
9263
+ }
9264
+
9257
9265
  .iot--card--title {
9258
9266
  align-items: center;
9259
9267
  display: flex;
@@ -9371,6 +9379,13 @@ html[dir=rtl] .iot--card--subtitle--text--padded {
9371
9379
  cursor: pointer;
9372
9380
  }
9373
9381
 
9382
+ .iot--card--dark .iot--card--title--text {
9383
+ color: var(--cds-text-on-color, #ffffff);
9384
+ }
9385
+ .iot--card--dark .iot--card--subtitle--text {
9386
+ color: var(--cds-text-on-color, #ffffff);
9387
+ }
9388
+
9374
9389
  .iot--data-state-container {
9375
9390
  padding: 0 var(--container-padding);
9376
9391
  width: inherit;