carbon-addons-iot-react 5.13.1 → 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.
@@ -10,7 +10,7 @@ import { settings } from '../../constants/Settings.js';
10
10
  import deprecate from '../../internal/deprecate.js';
11
11
 
12
12
  var _excluded = ["children", "loading", "disabled", "className", "onClick", "kind", "recommended", "hasIconOnly", "selected", "testID", "testId"];
13
- var ButtonKinds = ['primary', 'secondary', 'tertiary', 'ghost', 'danger', 'danger--primary', 'danger--ghost', 'danger--tertiary'];
13
+ var ButtonKinds = ['primary', 'secondary', 'tertiary', 'tertiary--light', 'ghost', 'danger', 'danger--primary', 'danger--ghost', 'danger--tertiary'];
14
14
  var iotPrefix = settings.iotPrefix;
15
15
  var propTypes = {
16
16
  /** Show loading spinner, only new prop */
@@ -135,6 +135,9 @@ Button.__docgenInfo = {
135
135
  }, {
136
136
  "value": "'tertiary'",
137
137
  "computed": false
138
+ }, {
139
+ "value": "'tertiary--light'",
140
+ "computed": false
138
141
  }, {
139
142
  "value": "'ghost'",
140
143
  "computed": false
@@ -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 };
@@ -21,7 +21,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
21
21
  var classnames__default = /*#__PURE__*/_interopDefault(classnames);
22
22
 
23
23
  var _excluded = ["children", "loading", "disabled", "className", "onClick", "kind", "recommended", "hasIconOnly", "selected", "testID", "testId"];
24
- var ButtonKinds = ['primary', 'secondary', 'tertiary', 'ghost', 'danger', 'danger--primary', 'danger--ghost', 'danger--tertiary'];
24
+ var ButtonKinds = ['primary', 'secondary', 'tertiary', 'tertiary--light', 'ghost', 'danger', 'danger--primary', 'danger--ghost', 'danger--tertiary'];
25
25
  var iotPrefix = Settings.settings.iotPrefix;
26
26
  var propTypes = {
27
27
  /** Show loading spinner, only new prop */
@@ -146,6 +146,9 @@ Button.__docgenInfo = {
146
146
  }, {
147
147
  "value": "'tertiary'",
148
148
  "computed": false
149
+ }, {
150
+ "value": "'tertiary--light'",
151
+ "computed": false
149
152
  }, {
150
153
  "value": "'ghost'",
151
154
  "computed": false
@@ -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;
@@ -8247,6 +8247,36 @@ li.cds--accordion__item--disabled:last-of-type {
8247
8247
  box-shadow: 0.0625rem 0 0 0 var(--cds-button-separator, #e0e0e0);
8248
8248
  }
8249
8249
 
8250
+ .cds--btn--tertiary--light {
8251
+ border-width: 1px;
8252
+ border-style: solid;
8253
+ border-color: #ffffff;
8254
+ background-color: transparent;
8255
+ color: #ffffff;
8256
+ }
8257
+ .cds--btn--tertiary--light:hover {
8258
+ background-color: var(--cds-background-hover, rgba(141, 141, 141, 0.12));
8259
+ }
8260
+ .cds--btn--tertiary--light:focus {
8261
+ border-color: var(--cds-button-focus-color, var(--cds-focus, #0f62fe));
8262
+ box-shadow: inset 0 0 0 1px var(--cds-button-focus-color, var(--cds-focus, #0f62fe)), inset 0 0 0 2px var(--cds-background, #ffffff);
8263
+ }
8264
+ .cds--btn--tertiary--light:active {
8265
+ background-color: var(--cds-background-active, rgba(141, 141, 141, 0.5));
8266
+ }
8267
+ .cds--btn--tertiary--light .cds--btn__icon,
8268
+ .cds--btn--tertiary--light .cds--btn__icon path:not([data-icon-path]):not([fill=none]) {
8269
+ fill: #ffffff;
8270
+ }
8271
+ .cds--btn--tertiary--light:focus {
8272
+ border-color: #ffffff;
8273
+ box-shadow: inset 0 0 0 1px #ffffff, inset 0 0 0 2px var(--cds-background-active, rgba(141, 141, 141, 0.5));
8274
+ }
8275
+ .cds--btn--tertiary--light:hover, .cds--btn--tertiary--light:active {
8276
+ background-color: var(--cds-background-active, rgba(141, 141, 141, 0.5));
8277
+ border-color: #ffffff;
8278
+ }
8279
+
8250
8280
  .cds--overflow-menu,
8251
8281
  .cds--overflow-menu__trigger {
8252
8282
  display: inline-block;
@@ -9224,6 +9254,14 @@ html[dir=rtl] .breadcrumb--container .cds--breadcrumb-item:last-child::after {
9224
9254
  outline-offset: -2px;
9225
9255
  }
9226
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
+
9227
9265
  .iot--card--title {
9228
9266
  align-items: center;
9229
9267
  display: flex;
@@ -9341,6 +9379,13 @@ html[dir=rtl] .iot--card--subtitle--text--padded {
9341
9379
  cursor: pointer;
9342
9380
  }
9343
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
+
9344
9389
  .iot--data-state-container {
9345
9390
  padding: 0 var(--container-padding);
9346
9391
  width: inherit;