@useblu/ocean-react 1.115.0 → 1.117.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.
package/index.js CHANGED
@@ -5346,10 +5346,12 @@ var Checkbox = e.forwardRef(function (_a, ref) {
5346
5346
  Checkbox.displayName = 'Checkbox';
5347
5347
 
5348
5348
  var Radio = e.forwardRef(function (_a, ref) {
5349
- var className = _a.className, label = _a.label, id = _a.id, rest = __rest$1(_a, ["className", "label", "id"]);
5349
+ var className = _a.className, label = _a.label, id = _a.id, error = _a.error, rest = __rest$1(_a, ["className", "label", "id", "error"]);
5350
5350
  return (e.createElement("label", { className: "ods-radio__root", htmlFor: id },
5351
5351
  e.createElement("input", __assign$1({ ref: ref, id: id, className: classNames('ods-radio', className) }, rest, { type: "radio" })),
5352
- e.createElement("span", { className: "ods-radio__checkmark" }),
5352
+ e.createElement("span", { className: classNames('ods-radio__checkmark', {
5353
+ 'ods-radio__checkmark--error': error,
5354
+ }) }),
5353
5355
  label && (e.createElement("span", { className: "ods-typography ods-typography__description ods-radio__label" }, label))));
5354
5356
  });
5355
5357
  Radio.displayName = 'Radio';
@@ -5366,6 +5368,79 @@ var TextArea = e.forwardRef(function (_a, ref) {
5366
5368
  });
5367
5369
  TextArea.displayName = 'TextArea';
5368
5370
 
5371
+ var ContentList = function (_a) {
5372
+ var _b, _c, _d;
5373
+ var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _e = _a.inverted, inverted = _e === void 0 ? false : _e, _f = _a.type, type = _f === void 0 ? 'default' : _f;
5374
+ return (e.createElement("div", { className: "ods-content-list" },
5375
+ e.createElement("p", { className: classNames('ods-typography', (_b = {
5376
+ 'ods-typography__paragraph': !inverted,
5377
+ 'ods-typography__description': inverted
5378
+ },
5379
+ _b["ods-typography__paragraph--".concat(type)] = type && (!inverted || type === 'inactive'),
5380
+ _b)) },
5381
+ strikethroughDescription && type === 'strikethrough' && !inverted && (e.createElement("span", { className: "ods-typography__paragraph--strikethrough-text" }, strikethroughDescription)),
5382
+ title),
5383
+ description && (e.createElement("p", { className: classNames("ods-typography", (_c = {
5384
+ 'ods-typography__description': !inverted,
5385
+ 'ods-typography__paragraph': inverted
5386
+ },
5387
+ _c["ods-typography__paragraph--".concat(type)] = type && (inverted || type === 'inactive'),
5388
+ _c)) },
5389
+ strikethroughDescription && type === 'strikethrough' && inverted && (e.createElement("span", { className: "ods-typography__paragraph--strikethrough-text" }, strikethroughDescription)),
5390
+ description)),
5391
+ caption && (e.createElement("p", { className: classNames("ods-typography ods-typography__captionbold", (_d = {},
5392
+ _d["ods-typography__paragraph--".concat(type)] = type && type === 'inactive',
5393
+ _d)) }, caption))));
5394
+ };
5395
+
5396
+ var SkeletonBar = function (_a) {
5397
+ var width = _a.width, height = _a.height, props = __rest$1(_a, ["width", "height"]);
5398
+ return (e.createElement("div", __assign$1({ className: "ods-skeleton-bar", style: { width: width, height: height } }, props)));
5399
+ };
5400
+
5401
+ var ListSelectable = e.forwardRef(function (_a, ref) {
5402
+ var _b, _c;
5403
+ var title = _a.title, description = _a.description, caption = _a.caption, strikethroughDescription = _a.strikethroughDescription, inverted = _a.inverted, loading = _a.loading, disabled = _a.disabled, checkbox = _a.checkbox, radio = _a.radio, className = _a.className, showDivider = _a.showDivider, indicator = _a.indicator, _d = _a.status, status = _d === void 0 ? 'default' : _d, _e = _a.type, type = _e === void 0 ? 'card' : _e, _f = _a.platform, platform = _f === void 0 ? 'web' : _f, rest = __rest$1(_a, ["title", "description", "caption", "strikethroughDescription", "inverted", "loading", "disabled", "checkbox", "radio", "className", "showDivider", "indicator", "status", "type", "platform"]);
5404
+ var hasError = e.useMemo(function () { return (radio === null || radio === void 0 ? void 0 : radio.error) || (checkbox === null || checkbox === void 0 ? void 0 : checkbox.error); }, [radio === null || radio === void 0 ? void 0 : radio.error, checkbox === null || checkbox === void 0 ? void 0 : checkbox.error]);
5405
+ var isInputDisabled = e.useMemo(function () { return (radio === null || radio === void 0 ? void 0 : radio.disabled) || (checkbox === null || checkbox === void 0 ? void 0 : checkbox.disabled) || disabled; }, [radio === null || radio === void 0 ? void 0 : radio.disabled, checkbox === null || checkbox === void 0 ? void 0 : checkbox.disabled, disabled]);
5406
+ var internalList = e.useMemo(function () {
5407
+ var _a;
5408
+ return (e.createElement(e.Fragment, null,
5409
+ e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: disabled ? 'inactive' : status }),
5410
+ indicator && (e.createElement("div", { className: classNames('ods-list-selectable__indicator', (_a = {},
5411
+ _a["ods-list-selectable__indicator--".concat(platform)] = platform,
5412
+ _a)) }, indicator))));
5413
+ }, [
5414
+ title,
5415
+ description,
5416
+ caption,
5417
+ strikethroughDescription,
5418
+ inverted,
5419
+ status,
5420
+ indicator,
5421
+ disabled,
5422
+ platform,
5423
+ ]);
5424
+ if (loading) {
5425
+ return (e.createElement("div", { className: "ods-list-selectable--loading" },
5426
+ e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
5427
+ e.createElement(SkeletonBar, { width: "100%", height: "16px" })));
5428
+ }
5429
+ return (e.createElement("div", { className: classNames('ods-list-selectable__root', (_b = {},
5430
+ _b["ods-list-selectable__root--".concat(type)] = type,
5431
+ _b["ods-list-selectable__root--".concat(type, "--error")] = hasError,
5432
+ _b)) },
5433
+ e.createElement("div", __assign$1({ className: classNames('ods-list-selectable', className, (_c = {
5434
+ 'ods-list-selectable--disabled': isInputDisabled
5435
+ },
5436
+ _c["ods-list-selectable--".concat(platform)] = platform,
5437
+ _c)), ref: ref }, rest),
5438
+ checkbox && e.createElement(Checkbox, __assign$1({}, checkbox, { label: internalList })),
5439
+ radio && e.createElement(Radio, __assign$1({}, radio, { label: internalList }))),
5440
+ showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-selectable__root--text--divider" }))));
5441
+ });
5442
+ ListSelectable.displayName = 'ListSelectable';
5443
+
5369
5444
  var TextListItem = e.forwardRef(function (_a, ref) {
5370
5445
  var title = _a.title, description = _a.description, caption = _a.caption, tagLabel = _a.tagLabel, infoText = _a.infoText, _b = _a.infoTextType, infoTextType = _b === void 0 ? 'neutral' : _b, withAction = _a.withAction, onActionClick = _a.onActionClick, checkbox = _a.checkbox, radio = _a.radio, disabled = _a.disabled, className = _a.className, rest = __rest$1(_a, ["title", "description", "caption", "tagLabel", "infoText", "infoTextType", "withAction", "onActionClick", "checkbox", "radio", "disabled", "className"]);
5371
5446
  var buttonElementRef = e.useRef(null);
@@ -47105,36 +47180,6 @@ var WebNotification = e.forwardRef(function (_a, ref) {
47105
47180
  });
47106
47181
  WebNotification.displayName = 'WebNotification';
47107
47182
 
47108
- var ContentList = function (_a) {
47109
- var _b, _c, _d;
47110
- var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _e = _a.inverted, inverted = _e === void 0 ? false : _e, _f = _a.type, type = _f === void 0 ? 'default' : _f;
47111
- return (e.createElement("div", { className: "ods-content-list" },
47112
- e.createElement("p", { className: classNames('ods-typography', (_b = {
47113
- 'ods-typography__paragraph': !inverted,
47114
- 'ods-typography__description': inverted
47115
- },
47116
- _b["ods-typography__paragraph--".concat(type)] = type && (!inverted || type === 'inactive'),
47117
- _b)) },
47118
- strikethroughDescription && type === 'strikethrough' && !inverted && (e.createElement("span", { className: "ods-typography__paragraph--strikethrough-text" }, strikethroughDescription)),
47119
- title),
47120
- description && (e.createElement("p", { className: classNames("ods-typography", (_c = {
47121
- 'ods-typography__description': !inverted,
47122
- 'ods-typography__paragraph': inverted
47123
- },
47124
- _c["ods-typography__paragraph--".concat(type)] = type && (inverted || type === 'inactive'),
47125
- _c)) },
47126
- strikethroughDescription && type === 'strikethrough' && inverted && (e.createElement("span", { className: "ods-typography__paragraph--strikethrough-text" }, strikethroughDescription)),
47127
- description)),
47128
- caption && (e.createElement("p", { className: classNames("ods-typography ods-typography__captionbold", (_d = {},
47129
- _d["ods-typography__paragraph--".concat(type)] = type && type === 'inactive',
47130
- _d)) }, caption))));
47131
- };
47132
-
47133
- var SkeletonBar = function (_a) {
47134
- var width = _a.width, height = _a.height, props = __rest$1(_a, ["width", "height"]);
47135
- return (e.createElement("div", __assign$1({ className: "ods-skeleton-bar", style: { width: width, height: height } }, props)));
47136
- };
47137
-
47138
47183
  var SettingsListItem = function (_a) {
47139
47184
  var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, errorMessage = _a.errorMessage, button = _a.button, tag = _a.tag, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'default' : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.showDivider, showDivider = _d === void 0 ? true : _d, _e = _a.blocked, blocked = _e === void 0 ? false : _e, _f = _a.state, state = _f === void 0 ? 'default' : _f;
47140
47185
  return (e.createElement("div", { className: classNames('ods-settings-list-item', {
@@ -47330,7 +47375,7 @@ var MenuList = function (_a) {
47330
47375
  var menuContent = (e.createElement("ul", { ref: menuRef, className: classNames('ods-internal-list-actions__menu', "ods-internal-list-actions__menu--".concat(position), {
47331
47376
  'ods-internal-list-actions__menu--closing': isClosing,
47332
47377
  'ods-internal-list-actions__menu--portal': !isSwipeMode,
47333
- }), style: isSwipeMode ? undefined : menuStyle, role: "menu", "aria-orientation": isSwipeMode ? "horizontal" : "vertical", tabIndex: -1, onClick: handleMenuClick, onKeyDown: handleMenuKeyDown },
47378
+ }), style: isSwipeMode ? undefined : menuStyle, role: "menu", "aria-orientation": isSwipeMode ? 'horizontal' : 'vertical', tabIndex: -1, onClick: handleMenuClick, onKeyDown: handleMenuKeyDown },
47334
47379
  isSwipeMode && (e.createElement(DragHandle, { onClose: onClose, onKeyDown: onDragHandleKeyDown })),
47335
47380
  actions.map(function (action) { return (e.createElement(MenuItem, { key: action.label, action: action, onClick: onActionClick })); })));
47336
47381
  if (isSwipeMode || typeof document === 'undefined') {
@@ -47385,8 +47430,7 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
47385
47430
  forwardedRef(wrapperRef.current);
47386
47431
  }
47387
47432
  else {
47388
- forwardedRef.current =
47389
- wrapperRef.current;
47433
+ forwardedRef.current = wrapperRef.current;
47390
47434
  }
47391
47435
  }
47392
47436
  }, [forwardedRef]);
@@ -47423,11 +47467,12 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
47423
47467
  });
47424
47468
  InternalListActions.displayName = 'InternalListActions';
47425
47469
 
47426
- var CardListAction = e.forwardRef(function (_a, ref) {
47427
- var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _b = _a.inverted, inverted = _b === void 0 ? false : _b, _c = _a.type, type = _c === void 0 ? 'default' : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.loading, loading = _e === void 0 ? false : _e, icon = _a.icon, indicator = _a.indicator, _f = _a.actionType, actionType = _f === void 0 ? 'chevron' : _f, menuActions = _a.menuActions, _g = _a.menuPosition, menuPosition = _g === void 0 ? 'bottom-right' : _g, onClick = _a.onClick, className = _a.className, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className"]);
47470
+ var ListAction = e.forwardRef(function (_a, ref) {
47471
+ var _b;
47472
+ var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, indicator = _a.indicator, _h = _a.actionType, actionType = _h === void 0 ? 'chevron' : _h, menuActions = _a.menuActions, _j = _a.menuPosition, menuPosition = _j === void 0 ? 'bottom-right' : _j, onClick = _a.onClick, className = _a.className, _k = _a.showDivider, showDivider = _k === void 0 ? false : _k, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className", "showDivider"]);
47428
47473
  var renderActionIcon = function () {
47429
47474
  if (actionType === 'chevron') {
47430
- return (e.createElement("div", { className: 'ods-card-list-action__action' },
47475
+ return (e.createElement("div", { className: 'ods-list-action__action' },
47431
47476
  e.createElement(re, { size: 20 })));
47432
47477
  }
47433
47478
  if (actionType === 'menu' || actionType === 'swipe') {
@@ -47435,25 +47480,29 @@ var CardListAction = e.forwardRef(function (_a, ref) {
47435
47480
  }
47436
47481
  return null;
47437
47482
  };
47438
- if (loading) {
47439
- return (e.createElement("button", __assign$1({ ref: ref, type: 'button', "data-testid": 'card-list-action', className: classNames('ods-card-list-action', 'ods-card-list-action--loading', className) }, rest),
47440
- e.createElement("div", { className: 'ods-card-list-action__skeleton' },
47441
- e.createElement(SkeletonBar, { width: '40%', height: '16px' }),
47442
- e.createElement(SkeletonBar, { width: '100%', height: '16px' }))));
47443
- }
47444
- return (e.createElement("button", __assign$1({ ref: ref, type: 'button', "data-testid": 'card-list-action', className: classNames('ods-card-list-action', className, {
47445
- 'ods-card-list-action--disabled': disabled,
47446
- 'ods-card-list-action--swipe-mode': actionType === 'swipe',
47447
- }), onClick: onClick, disabled: disabled }, rest),
47448
- icon && e.createElement("div", { className: classNames('ods-card-list-action__icon', {
47449
- 'ods-card-list-action__icon--inactive': type === 'inactive',
47450
- }) }, icon),
47451
- e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: type }),
47452
- e.createElement("div", { className: 'ods-card-list-action__trailing' },
47453
- indicator && (e.createElement("div", { className: 'ods-card-list-action__indicator' }, indicator)),
47454
- renderActionIcon())));
47483
+ var renderLoadingContent = function () { return (e.createElement("div", { className: 'ods-list-action__skeleton' },
47484
+ e.createElement(SkeletonBar, { width: '40%', height: '16px' }),
47485
+ e.createElement(SkeletonBar, { width: '100%', height: '16px' }))); };
47486
+ var renderContent = function () { return (e.createElement(e.Fragment, null,
47487
+ icon && (e.createElement("div", { className: classNames('ods-list-action__icon', {
47488
+ 'ods-list-action__icon--inactive': status === 'inactive',
47489
+ }) }, icon)),
47490
+ e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
47491
+ e.createElement("div", { className: 'ods-list-action__trailing' },
47492
+ indicator && (e.createElement("div", { className: 'ods-list-action__indicator' }, indicator)),
47493
+ renderActionIcon()))); };
47494
+ var buttonClassName = classNames('ods-list-action', className, (_b = {
47495
+ 'ods-list-action--loading': loading,
47496
+ 'ods-list-action--disabled': disabled,
47497
+ 'ods-list-action--swipe-mode': actionType === 'swipe'
47498
+ },
47499
+ _b["ods-list-action--".concat(type)] = type,
47500
+ _b));
47501
+ return (e.createElement("div", { className: 'ods-list-action__container' },
47502
+ e.createElement("button", __assign$1({ ref: ref, type: 'button', "data-testid": 'list-action', className: buttonClassName, onClick: loading ? undefined : onClick, disabled: disabled || loading }, rest), loading ? renderLoadingContent() : renderContent()),
47503
+ showDivider && type === 'text' && (e.createElement("div", { className: 'ods-list-action__divider' }))));
47455
47504
  });
47456
- CardListAction.displayName = 'CardListAction';
47505
+ ListAction.displayName = 'ListAction';
47457
47506
 
47458
47507
  exports.Accordion = Accordion;
47459
47508
  exports.Alert = Alert;
@@ -47461,7 +47510,6 @@ exports.Badge = Badge;
47461
47510
  exports.Breadcrumb = Breadcrumb;
47462
47511
  exports.Button = Button$1;
47463
47512
  exports.CardGroup = CardGroup;
47464
- exports.CardListAction = CardListAction;
47465
47513
  exports.CardListItem = CardListItem;
47466
47514
  exports.Carousel = Carousel;
47467
47515
  exports.Chart = DoughnutChart;
@@ -47480,6 +47528,8 @@ exports.IconButton = IconButton;
47480
47528
  exports.Input = Input;
47481
47529
  exports.Link = Link;
47482
47530
  exports.List = List;
47531
+ exports.ListAction = ListAction;
47532
+ exports.ListSelectable = ListSelectable;
47483
47533
  exports.Modal = Modal;
47484
47534
  exports.Progress = Progress;
47485
47535
  exports.Radio = Radio;