@useblu/ocean-react 1.57.0 → 1.58.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/Alert/Alert.d.ts CHANGED
@@ -3,11 +3,17 @@ export declare type AlertProps = {
3
3
  type?: 'success' | 'warning' | 'error' | 'default';
4
4
  title?: string;
5
5
  icon?: React.ReactElement;
6
+ size?: 'short' | 'long';
7
+ button?: string;
8
+ buttonAction?: () => void;
6
9
  } & React.ComponentPropsWithoutRef<'div'>;
7
10
  declare const Alert: React.ForwardRefExoticComponent<{
8
11
  type?: "success" | "warning" | "error" | "default" | undefined;
9
12
  title?: string | undefined;
10
13
  icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
14
+ size?: "short" | "long" | undefined;
15
+ button?: string | undefined;
16
+ buttonAction?: (() => void) | undefined;
11
17
  } & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
12
18
  export default Alert;
13
19
  //# sourceMappingURL=Alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,oBAAY,UAAU,GAAG;IAKvB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAInD,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC3B,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;AAE1C,QAAA,MAAM,KAAK;;;;kLA4BV,CAAC;AAIF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../src/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,oBAAY,UAAU,GAAG;IAKvB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAInD,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAI1B,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAIxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;AAE1C,QAAA,MAAM,KAAK;;;;;;0BAHY,IAAI;kLAqF1B,CAAC;AAIF,eAAe,KAAK,CAAC"}
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.58.0](https://github.com/ocean-ds/ocean-web/compare/v1.57.1...v1.58.0) (2024-05-15)
7
+
8
+ ### Features
9
+
10
+ - alert button ([#1099](https://github.com/ocean-ds/ocean-web/issues/1099)) ([425e015](https://github.com/ocean-ds/ocean-web/commit/425e01503db7be486b9dbb0d43c631a891aca799))
11
+
6
12
  # [1.57.0](https://github.com/ocean-ds/ocean-web/compare/v1.56.0...v1.57.0) (2024-04-18)
7
13
 
8
14
  ### Features
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import e, { Children, useState, useCallback, useEffect, forwardRef, useContext, useMemo, useRef, useLayoutEffect, createContext as createContext$1 } from 'react';
1
+ import e, { forwardRef, Children, useState, useCallback, useEffect, useContext, useMemo, useRef, useLayoutEffect, createContext as createContext$1 } from 'react';
2
2
  import require$$1 from 'react-dom';
3
3
 
4
4
  /*! *****************************************************************************
@@ -321,17 +321,6 @@ var AlertIcon = e.memo(function (_a) {
321
321
  });
322
322
  AlertIcon.displayName = 'AlertIcon';
323
323
 
324
- var Alert = e.forwardRef(function (_a, ref) {
325
- var children = _a.children, _b = _a.type, type = _b === void 0 ? 'default' : _b, title = _a.title, className = _a.className, icon = _a.icon, rest = __rest$1(_a, ["children", "type", "title", "className", "icon"]);
326
- var alertIcon = e.createElement(AlertIcon, { type: type, icon: icon });
327
- return (e.createElement("div", __assign$1({ ref: ref, role: "alert", className: classNames('ods-alert', "ods-alert--".concat(type), title && 'ods-alert--has-header', className) }, rest),
328
- title ? (e.createElement("div", { className: "ods-alert__header" },
329
- alertIcon,
330
- e.createElement("div", { className: "ods-alert__title" }, title))) : (alertIcon),
331
- e.createElement("div", { className: "ods-alert__content" }, children)));
332
- });
333
- Alert.displayName = 'Alert';
334
-
335
324
  var IconSm = function () { return (e.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
336
325
  e.createElement("circle", { opacity: "0.4", cx: "8", cy: "8", r: "6", stroke: "#B8C3FF", strokeWidth: "4" }),
337
326
  e.createElement("path", { d: "M8 2C8.78793 2 9.56815 2.15519 10.2961 2.45672C11.0241 2.75825 11.6855 3.20021 12.2426 3.75736C12.7998 4.31451 13.2417 4.97595 13.5433 5.7039C13.8448 6.43185 14 7.21207 14 8", stroke: "#0025E0", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" }))); };
@@ -364,6 +353,50 @@ function ButtonBase(_a, ref) {
364
353
  }
365
354
  var Button$1 = e.forwardRef(ButtonBase);
366
355
 
356
+ var mapIconsByType = {
357
+ linkChevron: ee,
358
+ externalLink: Qe
359
+ };
360
+ var LinkIcons = e.memo(function (_a) {
361
+ var icon = _a.icon;
362
+ if (icon) {
363
+ var IconElement = mapIconsByType[icon];
364
+ return (e.createElement(IconElement, { size: 16, className: "ods-link__icon", "aria-hidden": true, focusable: false, "data-testid": "link-icon" }));
365
+ }
366
+ return e.createElement(e.Fragment, null);
367
+ });
368
+ LinkIcons.displayName = 'LinkIcons';
369
+
370
+ var Link = forwardRef(function (_a, ref) {
371
+ var children = _a.children, className = _a.className, _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, icon = _a.icon, rest = __rest$1(_a, ["children", "className", "variant", "size", "icon"]);
372
+ return (e.createElement("a", __assign$1({ ref: ref, className: classNames('ods-link', "ods-link--".concat(size), "ods-link--".concat(variant), icon ? 'ods-link--with-icon' : '', className) }, rest),
373
+ e.createElement("span", { className: "ods-link__content" }, children),
374
+ e.createElement(LinkIcons, { icon: icon })));
375
+ });
376
+ Link.displayName = 'Link';
377
+
378
+ var Alert = e.forwardRef(function (_a, ref) {
379
+ var children = _a.children, _b = _a.type, type = _b === void 0 ? 'default' : _b, title = _a.title, className = _a.className, icon = _a.icon, _c = _a.size, size = _c === void 0 ? 'long' : _c, button = _a.button, buttonAction = _a.buttonAction, rest = __rest$1(_a, ["children", "type", "title", "className", "icon", "size", "button", "buttonAction"]);
380
+ var alertIcon = e.createElement(AlertIcon, { type: type, icon: icon });
381
+ var longSize = size === 'long' && !button;
382
+ var marginHeader = longSize && children && title;
383
+ return (e.createElement("div", __assign$1({ ref: ref, role: "alert", className: classNames('ods-alert', "ods-alert--".concat(type), longSize && 'ods-alert--long', className) }, rest), longSize ? (e.createElement(e.Fragment, null,
384
+ e.createElement("div", { className: classNames('ods-alert__header', marginHeader && 'ods-alert__header--margin') },
385
+ alertIcon,
386
+ title ? (e.createElement("div", { className: "ods-alert__title" }, title)) : (e.createElement("div", { className: "alert__content" }, children))),
387
+ title && e.createElement("div", { className: "alert__content" }, children))) : (e.createElement(e.Fragment, null,
388
+ e.createElement("div", { className: classNames('ods-alert__header', marginHeader && 'ods-alert__header--margin') },
389
+ alertIcon,
390
+ e.createElement("div", { className: "ods-alert__text" },
391
+ title && e.createElement("div", { className: "ods-alert__title" }, title),
392
+ e.createElement("div", { className: "alert__content" }, children)),
393
+ button && (e.createElement("div", { className: "ods-alert__button" },
394
+ e.createElement(Button$1, { size: "sm", onClick: buttonAction }, button)))),
395
+ button && (e.createElement("div", { className: "ods-alert__button--mobile" },
396
+ e.createElement(Link, { size: "sm", onClick: buttonAction, icon: "externalLink" }, button)))))));
397
+ });
398
+ Alert.displayName = 'Alert';
399
+
367
400
  var lib$1 = {};
368
401
 
369
402
  var slider = {};
@@ -5058,28 +5091,6 @@ var Radio = e.forwardRef(function (_a, ref) {
5058
5091
  });
5059
5092
  Radio.displayName = 'Radio';
5060
5093
 
5061
- var mapIconsByType = {
5062
- linkChevron: ee,
5063
- externalLink: Qe
5064
- };
5065
- var LinkIcons = e.memo(function (_a) {
5066
- var icon = _a.icon;
5067
- if (icon) {
5068
- var IconElement = mapIconsByType[icon];
5069
- return (e.createElement(IconElement, { size: 16, className: "ods-link__icon", "aria-hidden": true, focusable: false, "data-testid": "link-icon" }));
5070
- }
5071
- return e.createElement(e.Fragment, null);
5072
- });
5073
- LinkIcons.displayName = 'LinkIcons';
5074
-
5075
- var Link = forwardRef(function (_a, ref) {
5076
- var children = _a.children, className = _a.className, _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, icon = _a.icon, rest = __rest$1(_a, ["children", "className", "variant", "size", "icon"]);
5077
- return (e.createElement("a", __assign$1({ ref: ref, className: classNames('ods-link', "ods-link--".concat(size), "ods-link--".concat(variant), icon ? 'ods-link--with-icon' : '', className) }, rest),
5078
- e.createElement("span", { className: "ods-link__content" }, children),
5079
- e.createElement(LinkIcons, { icon: icon })));
5080
- });
5081
- Link.displayName = 'Link';
5082
-
5083
5094
  var TextArea = e.forwardRef(function (_a, ref) {
5084
5095
  var className = _a.className, label = _a.label, placeholder = _a.placeholder, helperText = _a.helperText, error = _a.error, id = _a.id, disabled = _a.disabled, onChange = _a.onChange, value = _a.value, defaultValue = _a.defaultValue, rest = __rest$1(_a, ["className", "label", "placeholder", "helperText", "error", "id", "disabled", "onChange", "value", "defaultValue"]);
5085
5096
  var _b = useInputFilled({