@darajs/ui-notifications 1.4.0 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-notifications.d.ts","sourceRoot":"","sources":["../src/use-notifications.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAM1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,yBAAyB;IACtC,qBAAqB,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7D,gBAAgB,EAAE,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC9D,uBAAuB,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;CAClE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,yBAAyB,CAmB5D"}
1
+ {"version":3,"file":"use-notifications.d.ts","sourceRoot":"","sources":["../src/use-notifications.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAM1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,yBAAyB;IACtC,qBAAqB,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7D,gBAAgB,EAAE,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC9D,uBAAuB,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;CAClE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,yBAAyB,CAyB5D"}
@@ -1,5 +1,5 @@
1
1
  import curry from 'lodash/curry';
2
- import { useContext } from 'react';
2
+ import React, { useContext } from 'react';
3
3
  import { Status } from '@darajs/ui-utils';
4
4
  import { NotificationContext } from './notification-wrapper';
5
5
  /**
@@ -9,7 +9,7 @@ import { NotificationContext } from './notification-wrapper';
9
9
  */
10
10
  export function useNotifications() {
11
11
  const { push } = useContext(NotificationContext);
12
- const notificationFromError = (status) => curry((title, err) => {
12
+ const curriedPush = React.useCallback((status) => curry((title, err) => {
13
13
  const message = (err === null || err === void 0 ? void 0 : err.status) ? `${err.status}: ${err.message}` : err.message;
14
14
  push({
15
15
  key: title,
@@ -17,11 +17,13 @@ export function useNotifications() {
17
17
  status,
18
18
  title: `${status.toUpperCase()}: ${title}`,
19
19
  });
20
- });
20
+ }), [push]);
21
+ const pushErrorNotification = React.useMemo(() => curriedPush(Status.ERROR), [curriedPush]);
22
+ const pushWarningNotification = React.useMemo(() => curriedPush(Status.WARNING), [curriedPush]);
21
23
  return {
22
- pushErrorNotification: notificationFromError(Status.ERROR),
24
+ pushErrorNotification,
23
25
  pushNotification: push,
24
- pushWarningNotification: notificationFromError(Status.WARNING),
26
+ pushWarningNotification,
25
27
  };
26
28
  }
27
29
  //# sourceMappingURL=use-notifications.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-notifications.js","sourceRoot":"","sources":["../src/use-notifications.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAY7D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAEjD,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAuC,EAAE,CAClF,KAAK,CAAC,CAAC,KAAa,EAAE,GAAa,EAAQ,EAAE;QAC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O,CAAC;QAC5E,IAAI,CAAC;YACD,GAAG,EAAE,KAAK;YACV,OAAO;YACP,MAAM;YACN,KAAK,EAAE,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;SAC7C,CAAC,CAAC;IACP,CAAC,CAAC,EACN,CAAC,IAAI,CAAC,CACT,CAAC;IAEF,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5F,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAEhG,OAAO;QACH,qBAAqB;QACrB,gBAAgB,EAAE,IAAI;QACtB,uBAAuB;KAC1B,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darajs/ui-notifications",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Notification system for the Dara UI Framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -18,9 +18,9 @@
18
18
  "license": "Apache-2.0",
19
19
  "prettier": "@darajs/prettier-config",
20
20
  "devDependencies": {
21
- "@darajs/eslint-config": "^1.4.0",
22
- "@darajs/prettier-config": "^1.4.0",
23
- "@darajs/stylelint-config": "^1.4.0",
21
+ "@darajs/eslint-config": "^1.4.2",
22
+ "@darajs/prettier-config": "^1.4.2",
23
+ "@darajs/stylelint-config": "^1.4.2",
24
24
  "@storybook/addon-a11y": "^6.5.16",
25
25
  "@storybook/addon-actions": "^6.5.16",
26
26
  "@storybook/addon-essentials": "^6.5.16",
@@ -45,9 +45,9 @@
45
45
  "typescript": "^5.0.4"
46
46
  },
47
47
  "dependencies": {
48
- "@darajs/styled-components": "^1.4.0",
49
- "@darajs/ui-icons": "^1.4.0",
50
- "@darajs/ui-utils": "^1.4.0",
48
+ "@darajs/styled-components": "^1.4.2",
49
+ "@darajs/ui-icons": "^1.4.2",
50
+ "@darajs/ui-utils": "^1.4.2",
51
51
  "lodash": "4.17.21",
52
52
  "polished": "^4.1.1",
53
53
  "react": "^18.0",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "f4c167e94dc5109cd1f7f8ad32eab928de13749b"
62
+ "gitHead": "b642977979735fcd06021ac49daa7f6bdda89832"
63
63
  }