@elliemae/ds-notification-badge 3.5.0-rc.9 → 3.5.1-rc.2

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.
@@ -29,7 +29,8 @@ __export(NotificationBadge_exports, {
29
29
  });
30
30
  module.exports = __toCommonJS(NotificationBadge_exports);
31
31
  var React = __toESM(require("react"));
32
- var import_react = __toESM(require("react"));
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var import_react = require("react");
33
34
  var import_ds_utilities = require("@elliemae/ds-utilities");
34
35
  var import_react_desc_prop_types = require("./react-desc-prop-types");
35
36
  var import_style = require("./style");
@@ -57,21 +58,26 @@ const NotificationBadge = (props) => {
57
58
  if (position === "left")
58
59
  right = relatedComponentWidth / 2;
59
60
  top = relatedComponentHeight / 2;
60
- return /* @__PURE__ */ import_react.default.createElement(import_style.Wrapper, {
61
- ...globalAttributes
62
- }, renderBadge && /* @__PURE__ */ import_react.default.createElement(Badge, {
63
- "data-testid": "ds-notification-badge",
64
- color,
65
- size,
66
- value,
67
- disabled,
68
- top,
69
- left,
70
- right,
71
- charCount: getValueCharactersCount(value)
72
- }, type === "number" ? value : null), Component && /* @__PURE__ */ import_react.default.createElement(Component, {
73
- innerRef: relatedComponentRef
74
- }));
61
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_style.Wrapper, {
62
+ ...globalAttributes,
63
+ children: [
64
+ renderBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
65
+ "data-testid": "ds-notification-badge",
66
+ color,
67
+ size,
68
+ value,
69
+ disabled,
70
+ top,
71
+ left,
72
+ right,
73
+ charCount: getValueCharactersCount(value),
74
+ children: type === "number" ? value : null
75
+ }),
76
+ Component && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {
77
+ innerRef: relatedComponentRef
78
+ })
79
+ ]
80
+ });
75
81
  };
76
82
  NotificationBadge.propTypes = import_react_desc_prop_types.NotificationBadgePropTypes;
77
83
  NotificationBadge.displayName = "NotificationBadge";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/NotificationBadge.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["import React, { useState, useEffect, useRef, WeakValidationMap } from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n useGetGlobalAttributes,\n} from '@elliemae/ds-utilities';\n\nimport { NotificationBadgePropTypes, DSNotificationBadgeT, defaultProps } from './react-desc-prop-types';\nimport { Wrapper, NumericBadge, DotBadge } from './style';\n\nconst getValueCharactersCount = (val: string | number): number => String(val).length;\n\nconst NotificationBadge: React.ComponentType<DSNotificationBadgeT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes<DSNotificationBadgeT.Props>(propsWithDefaults, NotificationBadgePropTypes);\n const { type, color, value, size, disabled, position, Component, ...rest } = propsWithDefaults;\n const globalAttributes = useGetGlobalAttributes(rest);\n\n const Badge = type === 'number' ? NumericBadge : DotBadge;\n const relatedComponentRef = useRef<HTMLSpanElement>(null);\n const renderBadge = relatedComponentRef?.current || !Component;\n const [relatedComponentHeight, setRelatedComponentHeight] = useState(0);\n const [relatedComponentWidth, setRelatedComponentWidth] = useState(0);\n\n useEffect(() => {\n const relatedComponent = relatedComponentRef?.current;\n setRelatedComponentHeight(relatedComponent?.offsetHeight || 0);\n setRelatedComponentWidth(relatedComponent?.offsetWidth || 0);\n }, [relatedComponentRef]);\n\n let top = 0;\n let right = 0;\n let left = 0;\n\n if (position === 'right') left = relatedComponentWidth / 2;\n if (position === 'left') right = relatedComponentWidth / 2;\n top = relatedComponentHeight / 2;\n\n return (\n <Wrapper {...globalAttributes}>\n {renderBadge && (\n <Badge\n data-testid=\"ds-notification-badge\"\n color={color}\n size={size}\n value={value}\n disabled={disabled}\n top={top}\n left={left}\n right={right}\n charCount={getValueCharactersCount(value)}\n >\n {type === 'number' ? value : null}\n </Badge>\n )}\n {Component && <Component innerRef={relatedComponentRef} />}\n </Wrapper>\n );\n};\n\nNotificationBadge.propTypes = NotificationBadgePropTypes as WeakValidationMap<unknown>;\nNotificationBadge.displayName = 'NotificationBadge';\nconst NotificationBadgeWithSchema = describe(NotificationBadge);\nNotificationBadgeWithSchema.propTypes = NotificationBadgePropTypes as WeakValidationMap<unknown>;\n\nexport { NotificationBadge, NotificationBadgeWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsE;AACtE,0BAKO;AAEP,mCAA+E;AAC/E,mBAAgD;AAEhD,MAAM,0BAA0B,CAAC,QAAiC,OAAO,GAAG,EAAE;AAE9E,MAAM,oBAAqE,CAAC,UAAU;AACpF,QAAM,wBAAoB,kDAA6B,OAAO,yCAAY;AAC1E,0DAA2D,mBAAmB,uDAA0B;AACxG,QAAM,EAAE,MAAM,OAAO,OAAO,MAAM,UAAU,UAAU,cAAc,KAAK,IAAI;AAC7E,QAAM,uBAAmB,4CAAuB,IAAI;AAEpD,QAAM,QAAQ,SAAS,WAAW,4BAAe;AACjD,QAAM,0BAAsB,qBAAwB,IAAI;AACxD,QAAM,cAAc,qBAAqB,WAAW,CAAC;AACrD,QAAM,CAAC,wBAAwB,yBAAyB,QAAI,uBAAS,CAAC;AACtE,QAAM,CAAC,uBAAuB,wBAAwB,QAAI,uBAAS,CAAC;AAEpE,8BAAU,MAAM;AACd,UAAM,mBAAmB,qBAAqB;AAC9C,8BAA0B,kBAAkB,gBAAgB,CAAC;AAC7D,6BAAyB,kBAAkB,eAAe,CAAC;AAAA,EAC7D,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,aAAa;AAAS,WAAO,wBAAwB;AACzD,MAAI,aAAa;AAAQ,YAAQ,wBA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,CAAC;AAAA,EAC7D,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,aAAa;AAAS,WAAO,wBAAwB;AACzD,MAAI,aAAa;AAAQ,YAAQ,wBAAwB;AACzD,QAAM,yBAAyB;AAE/B,SACE,6CAAC;AAAA,IAAS,GAAG;AAAA,IACV;AAAA,qBACC,4CAAC;AAAA,QACC,eAAY;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW,wBAAwB,KAAK;AAAA,QAEvC,mBAAS,WAAW,QAAQ;AAAA,OAC/B;AAAA,MAED,aAAa,4CAAC;AAAA,QAAU,UAAU;AAAA,OAAqB;AAAA;AAAA,GAC1D;AAEJ;AAEA,kBAAkB,YAAY;AAC9B,kBAAkB,cAAc;AAChC,MAAM,kCAA8B,8BAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
+ "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import React2, { useState, useEffect, useRef } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState, useEffect, useRef } from "react";
3
4
  import {
4
5
  useMemoMergePropsWithDefault,
5
6
  useValidateTypescriptPropTypes,
@@ -32,21 +33,26 @@ const NotificationBadge = (props) => {
32
33
  if (position === "left")
33
34
  right = relatedComponentWidth / 2;
34
35
  top = relatedComponentHeight / 2;
35
- return /* @__PURE__ */ React2.createElement(Wrapper, {
36
- ...globalAttributes
37
- }, renderBadge && /* @__PURE__ */ React2.createElement(Badge, {
38
- "data-testid": "ds-notification-badge",
39
- color,
40
- size,
41
- value,
42
- disabled,
43
- top,
44
- left,
45
- right,
46
- charCount: getValueCharactersCount(value)
47
- }, type === "number" ? value : null), Component && /* @__PURE__ */ React2.createElement(Component, {
48
- innerRef: relatedComponentRef
49
- }));
36
+ return /* @__PURE__ */ jsxs(Wrapper, {
37
+ ...globalAttributes,
38
+ children: [
39
+ renderBadge && /* @__PURE__ */ jsx(Badge, {
40
+ "data-testid": "ds-notification-badge",
41
+ color,
42
+ size,
43
+ value,
44
+ disabled,
45
+ top,
46
+ left,
47
+ right,
48
+ charCount: getValueCharactersCount(value),
49
+ children: type === "number" ? value : null
50
+ }),
51
+ Component && /* @__PURE__ */ jsx(Component, {
52
+ innerRef: relatedComponentRef
53
+ })
54
+ ]
55
+ });
50
56
  };
51
57
  NotificationBadge.propTypes = NotificationBadgePropTypes;
52
58
  NotificationBadge.displayName = "NotificationBadge";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/NotificationBadge.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect, useRef, WeakValidationMap } from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n describe,\n useGetGlobalAttributes,\n} from '@elliemae/ds-utilities';\n\nimport { NotificationBadgePropTypes, DSNotificationBadgeT, defaultProps } from './react-desc-prop-types';\nimport { Wrapper, NumericBadge, DotBadge } from './style';\n\nconst getValueCharactersCount = (val: string | number): number => String(val).length;\n\nconst NotificationBadge: React.ComponentType<DSNotificationBadgeT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes<DSNotificationBadgeT.Props>(propsWithDefaults, NotificationBadgePropTypes);\n const { type, color, value, size, disabled, position, Component, ...rest } = propsWithDefaults;\n const globalAttributes = useGetGlobalAttributes(rest);\n\n const Badge = type === 'number' ? NumericBadge : DotBadge;\n const relatedComponentRef = useRef<HTMLSpanElement>(null);\n const renderBadge = relatedComponentRef?.current || !Component;\n const [relatedComponentHeight, setRelatedComponentHeight] = useState(0);\n const [relatedComponentWidth, setRelatedComponentWidth] = useState(0);\n\n useEffect(() => {\n const relatedComponent = relatedComponentRef?.current;\n setRelatedComponentHeight(relatedComponent?.offsetHeight || 0);\n setRelatedComponentWidth(relatedComponent?.offsetWidth || 0);\n }, [relatedComponentRef]);\n\n let top = 0;\n let right = 0;\n let left = 0;\n\n if (position === 'right') left = relatedComponentWidth / 2;\n if (position === 'left') right = relatedComponentWidth / 2;\n top = relatedComponentHeight / 2;\n\n return (\n <Wrapper {...globalAttributes}>\n {renderBadge && (\n <Badge\n data-testid=\"ds-notification-badge\"\n color={color}\n size={size}\n value={value}\n disabled={disabled}\n top={top}\n left={left}\n right={right}\n charCount={getValueCharactersCount(value)}\n >\n {type === 'number' ? value : null}\n </Badge>\n )}\n {Component && <Component innerRef={relatedComponentRef} />}\n </Wrapper>\n );\n};\n\nNotificationBadge.propTypes = NotificationBadgePropTypes as WeakValidationMap<unknown>;\nNotificationBadge.displayName = 'NotificationBadge';\nconst NotificationBadgeWithSchema = describe(NotificationBadge);\nNotificationBadgeWithSchema.propTypes = NotificationBadgePropTypes as WeakValidationMap<unknown>;\n\nexport { NotificationBadge, NotificationBadgeWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,UAAS,UAAU,WAAW,cAAiC;AACtE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,4BAAkD,oBAAoB;AAC/E,SAAS,SAAS,cAAc,gBAAgB;AAEhD,MAAM,0BAA0B,CAAC,QAAiC,OAAO,GAAG,EAAE;AAE9E,MAAM,oBAAqE,CAAC,UAAU;AACpF,QAAM,oBAAoB,6BAA6B,OAAO,YAAY;AAC1E,iCAA2D,mBAAmB,0BAA0B;AACxG,QAAM,EAAE,MAAM,OAAO,OAAO,MAAM,UAAU,UAAU,cAAc,KAAK,IAAI;AAC7E,QAAM,mBAAmB,uBAAuB,IAAI;AAEpD,QAAM,QAAQ,SAAS,WAAW,eAAe;AACjD,QAAM,sBAAsB,OAAwB,IAAI;AACxD,QAAM,cAAc,qBAAqB,WAAW,CAAC;AACrD,QAAM,CAAC,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AO,MAAM,UAAU,UAAU,cAAc,KAAK,IAAI;AAC7E,QAAM,mBAAmB,uBAAuB,IAAI;AAEpD,QAAM,QAAQ,SAAS,WAAW,eAAe;AACjD,QAAM,sBAAsB,OAAwB,IAAI;AACxD,QAAM,cAAc,qBAAqB,WAAW,CAAC;AACrD,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,CAAC;AACtE,QAAM,CAAC,uBAAuB,wBAAwB,IAAI,SAAS,CAAC;AAEpE,YAAU,MAAM;AACd,UAAM,mBAAmB,qBAAqB;AAC9C,8BAA0B,kBAAkB,gBAAgB,CAAC;AAC7D,6BAAyB,kBAAkB,eAAe,CAAC;AAAA,EAC7D,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,OAAO;AAEX,MAAI,aAAa;AAAS,WAAO,wBAAwB;AACzD,MAAI,aAAa;AAAQ,YAAQ,wBAAwB;AACzD,QAAM,yBAAyB;AAE/B,SACE,qBAAC;AAAA,IAAS,GAAG;AAAA,IACV;AAAA,qBACC,oBAAC;AAAA,QACC,eAAY;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW,wBAAwB,KAAK;AAAA,QAEvC,mBAAS,WAAW,QAAQ;AAAA,OAC/B;AAAA,MAED,aAAa,oBAAC;AAAA,QAAU,UAAU;AAAA,OAAqB;AAAA;AAAA,GAC1D;AAEJ;AAEA,kBAAkB,YAAY;AAC9B,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
+ "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-notification-badge",
3
- "version": "3.5.0-rc.9",
3
+ "version": "3.5.1-rc.2",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Notification Badge",
6
6
  "files": [
@@ -47,8 +47,8 @@
47
47
  "indent": 4
48
48
  },
49
49
  "dependencies": {
50
- "@elliemae/ds-system": "3.5.0-rc.9",
51
- "@elliemae/ds-utilities": "3.5.0-rc.9"
50
+ "@elliemae/ds-system": "3.5.1-rc.2",
51
+ "@elliemae/ds-utilities": "3.5.1-rc.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@testing-library/react": "~12.1.3",