@vuu-ui/vuu-popups 0.13.90 → 0.13.91

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.
Files changed (45) hide show
  1. package/cjs/index.js +0 -10
  2. package/cjs/index.js.map +1 -1
  3. package/cjs/popup/useAnchoredPosition.js +5 -5
  4. package/cjs/popup-menu/usePopupMenu.js +7 -7
  5. package/cjs/portal/Portal.js +5 -5
  6. package/cjs/tooltip/useTooltip.js +15 -15
  7. package/cjs/tooltip/useTooltipAnchoredPosition.js +2 -2
  8. package/esm/index.js +0 -3
  9. package/esm/index.js.map +1 -1
  10. package/package.json +8 -8
  11. package/types/index.d.ts +0 -1
  12. package/cjs/notifications/NotificationsCenter.js +0 -63
  13. package/cjs/notifications/NotificationsCenter.js.map +0 -1
  14. package/cjs/notifications/NotificationsContext.js +0 -20
  15. package/cjs/notifications/NotificationsContext.js.map +0 -1
  16. package/cjs/notifications/NotificationsProvider.js +0 -50
  17. package/cjs/notifications/NotificationsProvider.js.map +0 -1
  18. package/cjs/notifications/ToastNotification.css.js +0 -6
  19. package/cjs/notifications/ToastNotification.css.js.map +0 -1
  20. package/cjs/notifications/ToastNotification.js +0 -66
  21. package/cjs/notifications/ToastNotification.js.map +0 -1
  22. package/cjs/notifications/WorkspaceNotification.css.js +0 -6
  23. package/cjs/notifications/WorkspaceNotification.css.js.map +0 -1
  24. package/cjs/notifications/WorkspaceNotification.js +0 -52
  25. package/cjs/notifications/WorkspaceNotification.js.map +0 -1
  26. package/esm/notifications/NotificationsCenter.js +0 -61
  27. package/esm/notifications/NotificationsCenter.js.map +0 -1
  28. package/esm/notifications/NotificationsContext.js +0 -15
  29. package/esm/notifications/NotificationsContext.js.map +0 -1
  30. package/esm/notifications/NotificationsProvider.js +0 -47
  31. package/esm/notifications/NotificationsProvider.js.map +0 -1
  32. package/esm/notifications/ToastNotification.css.js +0 -4
  33. package/esm/notifications/ToastNotification.css.js.map +0 -1
  34. package/esm/notifications/ToastNotification.js +0 -64
  35. package/esm/notifications/ToastNotification.js.map +0 -1
  36. package/esm/notifications/WorkspaceNotification.css.js +0 -4
  37. package/esm/notifications/WorkspaceNotification.css.js.map +0 -1
  38. package/esm/notifications/WorkspaceNotification.js +0 -50
  39. package/esm/notifications/WorkspaceNotification.js.map +0 -1
  40. package/types/notifications/NotificationsCenter.d.ts +0 -5
  41. package/types/notifications/NotificationsContext.d.ts +0 -36
  42. package/types/notifications/NotificationsProvider.d.ts +0 -9
  43. package/types/notifications/ToastNotification.d.ts +0 -7
  44. package/types/notifications/WorkspaceNotification.d.ts +0 -5
  45. package/types/notifications/index.d.ts +0 -3
package/cjs/index.js CHANGED
@@ -6,9 +6,6 @@ var PopupMenu = require('./popup-menu/PopupMenu.js');
6
6
  var Portal = require('./portal/Portal.js');
7
7
  var Tooltip = require('./tooltip/Tooltip.js');
8
8
  var useTooltip = require('./tooltip/useTooltip.js');
9
- var NotificationsContext = require('./notifications/NotificationsContext.js');
10
- var NotificationsProvider = require('./notifications/NotificationsProvider.js');
11
- var ToastNotification = require('./notifications/ToastNotification.js');
12
9
 
13
10
 
14
11
 
@@ -18,11 +15,4 @@ exports.PopupMenu = PopupMenu.PopupMenu;
18
15
  exports.Portal = Portal.Portal;
19
16
  exports.Tooltip = Tooltip.Tooltip;
20
17
  exports.useTooltip = useTooltip.useTooltip;
21
- exports.NotificationLevel = NotificationsContext.NotificationLevel;
22
- exports.NotificationType = NotificationsContext.NotificationType;
23
- exports.isToastNotification = NotificationsContext.isToastNotification;
24
- exports.isWorkspaceNotification = NotificationsContext.isWorkspaceNotification;
25
- exports.NotificationsProvider = NotificationsProvider.NotificationsProvider;
26
- exports.useNotifications = NotificationsProvider.useNotifications;
27
- exports.ToastNotification = ToastNotification.ToastNotification;
28
18
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var react = require('react');
4
4
  var getPositionRelativeToAnchor = require('./getPositionRelativeToAnchor.js');
5
5
 
6
6
  const useAnchoredPosition = ({
@@ -11,9 +11,9 @@ const useAnchoredPosition = ({
11
11
  placement,
12
12
  position: positionProp
13
13
  }) => {
14
- const popupRef = React.useRef(null);
15
- const [position, setPosition] = React.useState(positionProp);
16
- React.useLayoutEffect(() => {
14
+ const popupRef = react.useRef(null);
15
+ const [position, setPosition] = react.useState(positionProp);
16
+ react.useLayoutEffect(() => {
17
17
  if (placement === "absolute" && positionProp) {
18
18
  setPosition(positionProp);
19
19
  } else if (anchorElement.current && placement !== "auto") {
@@ -29,7 +29,7 @@ const useAnchoredPosition = ({
29
29
  setPosition(position2);
30
30
  }
31
31
  }, [anchorElement, minWidth, offsetLeft, offsetTop, placement, positionProp]);
32
- const popupCallbackRef = React.useCallback(
32
+ const popupCallbackRef = react.useCallback(
33
33
  (el) => {
34
34
  popupRef.current = el;
35
35
  if (el && placement === "center" && anchorElement.current) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var react = require('react');
4
4
  var getPositionRelativeToAnchor = require('../popup/getPositionRelativeToAnchor.js');
5
5
  var vuuContextMenu = require('@vuu-ui/vuu-context-menu');
6
6
 
@@ -16,10 +16,10 @@ const usePopupMenu = ({
16
16
  popupPlacement,
17
17
  tabIndex
18
18
  }) => {
19
- const [menuOpen, _setMenuOpen] = React.useState(false);
20
- const suppressShowMenuRef = React.useRef(false);
21
- const rootRef = React.useRef(null);
22
- const setMenuOpen = React.useCallback(
19
+ const [menuOpen, _setMenuOpen] = react.useState(false);
20
+ const suppressShowMenuRef = react.useRef(false);
21
+ const rootRef = react.useRef(null);
22
+ const setMenuOpen = react.useCallback(
23
23
  (isOpen) => {
24
24
  _setMenuOpen(isOpen);
25
25
  if (isOpen) {
@@ -29,7 +29,7 @@ const usePopupMenu = ({
29
29
  [onMenuOpen]
30
30
  );
31
31
  const showContextMenu = vuuContextMenu.useContextMenu(menuBuilder, menuActionHandler);
32
- const handleMenuOpenChange = React.useCallback(
32
+ const handleMenuOpenChange = react.useCallback(
33
33
  (isOpen) => {
34
34
  if (isOpen === false) {
35
35
  setMenuOpen(false);
@@ -38,7 +38,7 @@ const usePopupMenu = ({
38
38
  },
39
39
  [onMenuClose, setMenuOpen]
40
40
  );
41
- const showMenu = React.useCallback(
41
+ const showMenu = react.useCallback(
42
42
  (e) => {
43
43
  if (suppressShowMenuRef.current) {
44
44
  suppressShowMenuRef.current = false;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var vuuUtils = require('@vuu-ui/vuu-utils');
4
- var React = require('react');
4
+ var react = require('react');
5
5
  var reactDom = require('react-dom');
6
6
  var styles = require('@salt-ds/styles');
7
7
  var window = require('@salt-ds/window');
@@ -38,11 +38,11 @@ const Portal = ({
38
38
  css: Portal$1,
39
39
  window: targetWindow
40
40
  });
41
- const [mounted, setMounted] = React.useState(false);
42
- const portalRef = React.useRef(null);
41
+ const [mounted, setMounted] = react.useState(false);
42
+ const portalRef = react.useRef(null);
43
43
  const container = getContainer(containerProp) ?? document.body;
44
44
  const [themeClass, densityClass, dataMode] = vuuUtils.useThemeAttributes(themeAttributes);
45
- React.useLayoutEffect(() => {
45
+ react.useLayoutEffect(() => {
46
46
  const root = getFirstAvailableElementById(id);
47
47
  if (root) {
48
48
  portalRef.current = root;
@@ -58,7 +58,7 @@ const Portal = ({
58
58
  el.dataset.mode = dataMode;
59
59
  setMounted(true);
60
60
  }, [id, container, themeClass, densityClass, dataMode]);
61
- React.useLayoutEffect(() => {
61
+ react.useLayoutEffect(() => {
62
62
  requestAnimationFrame(() => {
63
63
  onRender?.();
64
64
  });
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var vuuUtils = require('@vuu-ui/vuu-utils');
4
- var React = require('react');
4
+ var react = require('react');
5
5
 
6
6
  const useTooltip = ({
7
7
  anchorQuery = "*",
@@ -9,29 +9,29 @@ const useTooltip = ({
9
9
  placement = ["right", "above", "below"],
10
10
  tooltipContent
11
11
  }) => {
12
- const hideTooltipRef = React.useRef(void 0);
13
- const isHoveringRef = React.useRef(false);
14
- const anchorElementRef = React.useRef(null);
15
- const mouseEnterTimerRef = React.useRef(void 0);
16
- const mouseLeaveTimerRef = React.useRef(void 0);
17
- const [tooltipProps, setTooltipProps] = React.useState();
12
+ const hideTooltipRef = react.useRef(void 0);
13
+ const isHoveringRef = react.useRef(false);
14
+ const anchorElementRef = react.useRef(null);
15
+ const mouseEnterTimerRef = react.useRef(void 0);
16
+ const mouseLeaveTimerRef = react.useRef(void 0);
17
+ const [tooltipProps, setTooltipProps] = react.useState();
18
18
  const id = vuuUtils.useId(idProp);
19
- const escapeListener = React.useCallback((evt) => {
19
+ const escapeListener = react.useCallback((evt) => {
20
20
  if (evt.key === "Escape") {
21
21
  hideTooltipRef.current?.();
22
22
  }
23
23
  }, []);
24
- hideTooltipRef.current = React.useCallback(() => {
24
+ hideTooltipRef.current = react.useCallback(() => {
25
25
  setTooltipProps(void 0);
26
26
  document.removeEventListener("keydown", escapeListener);
27
27
  }, [escapeListener]);
28
- const handleMouseEnterTooltip = React.useCallback(() => {
28
+ const handleMouseEnterTooltip = react.useCallback(() => {
29
29
  window.clearTimeout(mouseLeaveTimerRef.current);
30
30
  }, []);
31
- const handleMouseLeaveTooltip = React.useCallback(() => {
31
+ const handleMouseLeaveTooltip = react.useCallback(() => {
32
32
  hideTooltipRef.current?.();
33
33
  }, []);
34
- const hideTooltip = React.useCallback((defer = 0) => {
34
+ const hideTooltip = react.useCallback((defer = 0) => {
35
35
  if (mouseEnterTimerRef.current) {
36
36
  window.clearTimeout(mouseEnterTimerRef.current);
37
37
  mouseEnterTimerRef.current = void 0;
@@ -46,7 +46,7 @@ const useTooltip = ({
46
46
  }
47
47
  }
48
48
  }, []);
49
- const showTooltip = React.useCallback(
49
+ const showTooltip = react.useCallback(
50
50
  (ref = anchorElementRef) => {
51
51
  const { current: anchorEl } = ref;
52
52
  if (anchorEl) {
@@ -73,7 +73,7 @@ const useTooltip = ({
73
73
  tooltipContent
74
74
  ]
75
75
  );
76
- const handleMouseEnter = React.useCallback(
76
+ const handleMouseEnter = react.useCallback(
77
77
  (evt) => {
78
78
  isHoveringRef.current = true;
79
79
  const el = vuuUtils.queryClosest(evt.target, anchorQuery);
@@ -85,7 +85,7 @@ const useTooltip = ({
85
85
  },
86
86
  [anchorQuery, showTooltip]
87
87
  );
88
- const handleMouseLeave = React.useCallback(() => {
88
+ const handleMouseLeave = react.useCallback(() => {
89
89
  isHoveringRef.current = false;
90
90
  hideTooltip(200);
91
91
  }, [hideTooltip]);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var react = require('react');
4
4
 
5
5
  const pointerSize = 12;
6
6
  const roomAbove = (anchor, tooltip) => tooltip.height + pointerSize < anchor.top;
@@ -84,7 +84,7 @@ const useTooltipAnchoredPosition = ({
84
84
  anchorElement,
85
85
  placement
86
86
  }) => {
87
- const ref = React.useCallback(
87
+ const ref = react.useCallback(
88
88
  (el) => {
89
89
  if (el && anchorElement.current) {
90
90
  const anchorRect = anchorElement.current.getBoundingClientRect();
package/esm/index.js CHANGED
@@ -4,7 +4,4 @@ export { PopupMenu } from './popup-menu/PopupMenu.js';
4
4
  export { Portal } from './portal/Portal.js';
5
5
  export { Tooltip } from './tooltip/Tooltip.js';
6
6
  export { useTooltip } from './tooltip/useTooltip.js';
7
- export { NotificationLevel, NotificationType, isToastNotification, isWorkspaceNotification } from './notifications/NotificationsContext.js';
8
- export { NotificationsProvider, useNotifications } from './notifications/NotificationsProvider.js';
9
- export { ToastNotification } from './notifications/ToastNotification.js';
10
7
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.13.90",
2
+ "version": "0.13.91",
3
3
  "description": "VUU popup components - Context Menu, Dialog etc",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
@@ -7,16 +7,16 @@
7
7
  "@salt-ds/core": "1.48.0",
8
8
  "@salt-ds/styles": "0.2.1",
9
9
  "@salt-ds/window": "0.1.1",
10
- "@vuu-ui/vuu-context-menu": "0.13.90",
11
- "@vuu-ui/vuu-data-types": "0.13.90",
12
- "@vuu-ui/vuu-layout": "0.13.90",
13
- "@vuu-ui/vuu-utils": "0.13.90",
14
- "@vuu-ui/vuu-ui-controls": "0.13.90"
10
+ "@vuu-ui/vuu-context-menu": "0.13.91",
11
+ "@vuu-ui/vuu-data-types": "0.13.91",
12
+ "@vuu-ui/vuu-layout": "0.13.91",
13
+ "@vuu-ui/vuu-utils": "0.13.91",
14
+ "@vuu-ui/vuu-ui-controls": "0.13.91"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "clsx": "^2.0.0",
18
- "react": "^19.2.1",
19
- "react-dom": "^19.2.1"
18
+ "react": "^19.2.3",
19
+ "react-dom": "^19.2.3"
20
20
  },
21
21
  "sideEffects": false,
22
22
  "files": [
package/types/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from "./popup";
2
2
  export * from "./popup-menu";
3
3
  export * from "./portal";
4
4
  export * from "./tooltip";
5
- export * from "./notifications";
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var vuuUtils = require('@vuu-ui/vuu-utils');
5
- var React = require('react');
6
- var NotificationsContext = require('./NotificationsContext.js');
7
- var ToastNotification = require('./ToastNotification.js');
8
- var WorkspaceNotification = require('./WorkspaceNotification.js');
9
-
10
- const toastOffsetTop = 60;
11
- const toastDisplayDuration = 6e3;
12
- const horizontalTransitionDuration = 1e3;
13
- const toastHeight = 56;
14
- const toastContainerContentGap = 10;
15
- const NotificationsCenter = ({
16
- notificationsContext
17
- }) => {
18
- const [workspaceNotification, setWorkspaceNotification] = React.useState(null);
19
- const [notifications, setNotifications] = React.useState(
20
- []
21
- );
22
- const showNotification = React.useCallback((notification) => {
23
- if (NotificationsContext.isToastNotification(notification)) {
24
- const newNotification = {
25
- ...notification,
26
- id: vuuUtils.getUniqueId()
27
- };
28
- setNotifications((prev) => prev.concat(newNotification));
29
- setTimeout(
30
- () => {
31
- setNotifications((prev) => prev.filter((n) => n !== newNotification));
32
- },
33
- toastDisplayDuration + horizontalTransitionDuration * 2
34
- );
35
- } else if (NotificationsContext.isWorkspaceNotification(notification)) {
36
- setWorkspaceNotification(
37
- /* @__PURE__ */ jsxRuntime.jsx(WorkspaceNotification.WorkspaceNotification, { children: notification.content })
38
- );
39
- } else {
40
- throw Error("[NotificationsCenter] invalid notification received");
41
- }
42
- }, []);
43
- const hideNotification = React.useCallback(() => {
44
- setWorkspaceNotification(null);
45
- }, []);
46
- React.useMemo(() => {
47
- notificationsContext.setNotify(showNotification, hideNotification);
48
- }, [hideNotification, notificationsContext, showNotification]);
49
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
50
- workspaceNotification,
51
- notifications.map((notification, i) => /* @__PURE__ */ jsxRuntime.jsx(
52
- ToastNotification.ToastNotification,
53
- {
54
- top: toastOffsetTop + (toastHeight + toastContainerContentGap) * i,
55
- notification
56
- },
57
- notification.id
58
- ))
59
- ] });
60
- };
61
-
62
- exports.NotificationsCenter = NotificationsCenter;
63
- //# sourceMappingURL=NotificationsCenter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsCenter.js","sources":["../../../../packages/vuu-popups/src/notifications/NotificationsCenter.tsx"],"sourcesContent":["import { getUniqueId } from \"@vuu-ui/vuu-utils\";\nimport { ReactNode, useCallback, useMemo, useState } from \"react\";\nimport {\n isToastNotification,\n isWorkspaceNotification,\n Notification,\n NotificationsContext,\n ToastNotificationDescriptor as ToastNotificationType,\n} from \"./NotificationsContext\";\nimport { ToastNotification } from \"./ToastNotification\";\nimport { WorkspaceNotification } from \"./WorkspaceNotification\";\n\nexport interface NotificationsCenterProps {\n notificationsContext: NotificationsContext;\n}\n\ninterface ToastNotificationWithId extends ToastNotificationType {\n id: string;\n}\n\n// animation times in milliseconds\nconst toastOffsetTop = 60;\nconst toastDisplayDuration = 6000;\nconst horizontalTransitionDuration = 1000;\n\n// toast size in pixels\nconst toastHeight = 56;\nconst toastContainerContentGap = 10;\n// rightPadding is used together with the toastWidth to compute the toast position\n// at the beginning and at the end of the animation\n\nexport const NotificationsCenter = ({\n notificationsContext,\n}: NotificationsCenterProps) => {\n const [workspaceNotification, setWorkspaceNotification] =\n useState<ReactNode>(null);\n const [notifications, setNotifications] = useState<ToastNotificationWithId[]>(\n [],\n );\n\n const showNotification = useCallback((notification: Notification) => {\n if (isToastNotification(notification)) {\n const newNotification: ToastNotificationWithId = {\n ...notification,\n id: getUniqueId(),\n };\n setNotifications((prev) => prev.concat(newNotification));\n setTimeout(\n () => {\n setNotifications((prev) => prev.filter((n) => n !== newNotification));\n },\n toastDisplayDuration + horizontalTransitionDuration * 2,\n );\n } else if (isWorkspaceNotification(notification)) {\n setWorkspaceNotification(\n <WorkspaceNotification>{notification.content}</WorkspaceNotification>,\n );\n } else {\n throw Error(\"[NotificationsCenter] invalid notification received\");\n }\n }, []);\n\n const hideNotification = useCallback(() => {\n setWorkspaceNotification(null);\n }, []);\n\n useMemo(() => {\n notificationsContext.setNotify(showNotification, hideNotification);\n }, [hideNotification, notificationsContext, showNotification]);\n\n return (\n <>\n {workspaceNotification}\n {notifications.map((notification, i) => (\n <ToastNotification\n top={toastOffsetTop + (toastHeight + toastContainerContentGap) * i}\n notification={notification}\n key={notification.id}\n />\n ))}\n </>\n );\n};\n"],"names":["useState","useCallback","isToastNotification","getUniqueId","isWorkspaceNotification","jsx","WorkspaceNotification","useMemo","jsxs","Fragment","ToastNotification"],"mappings":";;;;;;;;;AAqBA,MAAM,cAAiB,GAAA,EAAA;AACvB,MAAM,oBAAuB,GAAA,GAAA;AAC7B,MAAM,4BAA+B,GAAA,GAAA;AAGrC,MAAM,WAAc,GAAA,EAAA;AACpB,MAAM,wBAA2B,GAAA,EAAA;AAI1B,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,CAAgC,KAAA;AAC9B,EAAA,MAAM,CAAC,qBAAA,EAAuB,wBAAwB,CAAA,GACpDA,eAAoB,IAAI,CAAA;AAC1B,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAAA,cAAA;AAAA,IACxC;AAAC,GACH;AAEA,EAAM,MAAA,gBAAA,GAAmBC,iBAAY,CAAA,CAAC,YAA+B,KAAA;AACnE,IAAI,IAAAC,wCAAA,CAAoB,YAAY,CAAG,EAAA;AACrC,MAAA,MAAM,eAA2C,GAAA;AAAA,QAC/C,GAAG,YAAA;AAAA,QACH,IAAIC,oBAAY;AAAA,OAClB;AACA,MAAA,gBAAA,CAAiB,CAAC,IAAA,KAAS,IAAK,CAAA,MAAA,CAAO,eAAe,CAAC,CAAA;AACvD,MAAA,UAAA;AAAA,QACE,MAAM;AACJ,UAAiB,gBAAA,CAAA,CAAC,SAAS,IAAK,CAAA,MAAA,CAAO,CAAC,CAAM,KAAA,CAAA,KAAM,eAAe,CAAC,CAAA;AAAA,SACtE;AAAA,QACA,uBAAuB,4BAA+B,GAAA;AAAA,OACxD;AAAA,KACF,MAAA,IAAWC,4CAAwB,CAAA,YAAY,CAAG,EAAA;AAChD,MAAA,wBAAA;AAAA,wBACEC,cAAA,CAACC,2CAAuB,EAAA,EAAA,QAAA,EAAA,YAAA,CAAa,OAAQ,EAAA;AAAA,OAC/C;AAAA,KACK,MAAA;AACL,MAAA,MAAM,MAAM,qDAAqD,CAAA;AAAA;AACnE,GACF,EAAG,EAAE,CAAA;AAEL,EAAM,MAAA,gBAAA,GAAmBL,kBAAY,MAAM;AACzC,IAAA,wBAAA,CAAyB,IAAI,CAAA;AAAA,GAC/B,EAAG,EAAE,CAAA;AAEL,EAAAM,aAAA,CAAQ,MAAM;AACZ,IAAqB,oBAAA,CAAA,SAAA,CAAU,kBAAkB,gBAAgB,CAAA;AAAA,GAChE,EAAA,CAAC,gBAAkB,EAAA,oBAAA,EAAsB,gBAAgB,CAAC,CAAA;AAE7D,EAAA,uBAEKC,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,qBAAA;AAAA,IACA,aAAc,CAAA,GAAA,CAAI,CAAC,YAAA,EAAc,CAChC,qBAAAJ,cAAA;AAAA,MAACK,mCAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,cAAkB,GAAA,CAAA,WAAA,GAAc,wBAA4B,IAAA,CAAA;AAAA,QACjE;AAAA,OAAA;AAAA,MACK,YAAa,CAAA;AAAA,KAErB;AAAA,GACH,EAAA,CAAA;AAEJ;;;;"}
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- const NotificationLevel = {
4
- Error: "error",
5
- Info: "info",
6
- Success: "success",
7
- Warning: "warning"
8
- };
9
- const NotificationType = {
10
- Toast: "toast",
11
- Workspace: "workspace"
12
- };
13
- const isToastNotification = (n) => n.type === NotificationType.Toast;
14
- const isWorkspaceNotification = (n) => n.type === NotificationType.Workspace;
15
-
16
- exports.NotificationLevel = NotificationLevel;
17
- exports.NotificationType = NotificationType;
18
- exports.isToastNotification = isToastNotification;
19
- exports.isWorkspaceNotification = isWorkspaceNotification;
20
- //# sourceMappingURL=NotificationsContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsContext.js","sources":["../../../../packages/vuu-popups/src/notifications/NotificationsContext.tsx"],"sourcesContent":["import { ValueOf } from \"@vuu-ui/vuu-utils\";\nimport { ReactNode } from \"react\";\n\nexport type DispatchShowNotification = (notification: Notification) => void;\nexport type DispatchHideNotification = () => void;\n\nexport const NotificationLevel = {\n Error: \"error\",\n Info: \"info\",\n Success: \"success\",\n Warning: \"warning\",\n} as const;\n\nexport type NotificationLevel = ValueOf<typeof NotificationLevel>;\n\nexport const NotificationType = {\n Toast: \"toast\",\n Workspace: \"workspace\",\n} as const;\n\nexport type NotificationType = ValueOf<typeof NotificationType>;\n\ninterface NotificationDescriptorBase<T extends NotificationType> {\n level: NotificationLevel;\n type: T;\n}\n\nexport interface ToastNotificationDescriptor\n extends NotificationDescriptorBase<\"toast\"> {\n content: string;\n header: string;\n}\n\nexport interface WorkspaceNotificationDescriptor\n extends NotificationDescriptorBase<\"workspace\"> {\n content: ReactNode;\n}\n\nexport type Notification =\n | ToastNotificationDescriptor\n | WorkspaceNotificationDescriptor;\n\nexport const isToastNotification = (\n n: Notification,\n): n is ToastNotificationDescriptor => n.type === NotificationType.Toast;\n\nexport const isWorkspaceNotification = (\n n: Notification,\n): n is WorkspaceNotificationDescriptor =>\n n.type === NotificationType.Workspace;\n\nexport type NotificationsContext = {\n hideNotification: DispatchHideNotification;\n showNotification: DispatchShowNotification;\n setNotify: (\n showNotificationDispatcher: DispatchShowNotification,\n hideNotificationDispatcher: DispatchHideNotification,\n ) => void;\n};\n"],"names":[],"mappings":";;AAMO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,OAAS,EAAA,SAAA;AAAA,EACT,OAAS,EAAA;AACX;AAIO,MAAM,gBAAmB,GAAA;AAAA,EAC9B,KAAO,EAAA,OAAA;AAAA,EACP,SAAW,EAAA;AACb;AAwBO,MAAM,mBAAsB,GAAA,CACjC,CACqC,KAAA,CAAA,CAAE,SAAS,gBAAiB,CAAA;AAE5D,MAAM,uBAA0B,GAAA,CACrC,CAEA,KAAA,CAAA,CAAE,SAAS,gBAAiB,CAAA;;;;;;;"}
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var NotificationsCenter = require('./NotificationsCenter.js');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __typeError = (msg) => {
9
- throw TypeError(msg);
10
- };
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
14
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
15
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
16
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
17
- var _showNotification, _hideNotification;
18
- class NotificationsContextObject {
19
- constructor() {
20
- __privateAdd(this, _showNotification, () => console.log("have you forgotten to provide a NotificationsCenter?"));
21
- __privateAdd(this, _hideNotification, () => console.log("have you forgotten to provide a NotificationsCenter?"));
22
- // We want the public notify method to be stable, setNotify call should not trigger re-renders
23
- __publicField(this, "showNotification", (notification) => __privateGet(this, _showNotification).call(this, notification));
24
- __publicField(this, "hideNotification", () => __privateGet(this, _hideNotification).call(this));
25
- __publicField(this, "setNotify", (showNotificationDispatcher, hideNotificationDispatcher) => {
26
- __privateSet(this, _showNotification, showNotificationDispatcher);
27
- __privateSet(this, _hideNotification, hideNotificationDispatcher);
28
- });
29
- }
30
- }
31
- _showNotification = new WeakMap();
32
- _hideNotification = new WeakMap();
33
- const NotificationsContext = React.createContext(
34
- new NotificationsContextObject()
35
- );
36
- const NotificationsProvider = (props) => {
37
- const context = React.useContext(NotificationsContext);
38
- return /* @__PURE__ */ jsxRuntime.jsxs(NotificationsContext.Provider, { value: context, children: [
39
- /* @__PURE__ */ jsxRuntime.jsx(NotificationsCenter.NotificationsCenter, { notificationsContext: context }),
40
- props.children
41
- ] });
42
- };
43
- const useNotifications = () => {
44
- const { hideNotification, showNotification } = React.useContext(NotificationsContext);
45
- return { hideNotification, showNotification };
46
- };
47
-
48
- exports.NotificationsProvider = NotificationsProvider;
49
- exports.useNotifications = useNotifications;
50
- //# sourceMappingURL=NotificationsProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.js","sources":["../../../../packages/vuu-popups/src/notifications/NotificationsProvider.tsx"],"sourcesContent":["import React, { ReactElement, useContext } from \"react\";\nimport { NotificationsCenter } from \"./NotificationsCenter\";\nimport {\n DispatchHideNotification,\n DispatchShowNotification,\n NotificationsContext,\n} from \"./NotificationsContext\";\n\n/*\n The Context is not exposed outside this module, only the notify\n prop can be accessed via the useNotifications hook.\n The NotificationsCenter receives the full context object and\n sets the notify method. State management around dispatched\n notifications is handled entirely within the NotificationsCenter,\n avoiding rerendering our children when notifications are \n dispatched.\n*/\nclass NotificationsContextObject implements NotificationsContext {\n #showNotification: DispatchShowNotification = () =>\n console.log(\"have you forgotten to provide a NotificationsCenter?\");\n #hideNotification: DispatchHideNotification = () =>\n console.log(\"have you forgotten to provide a NotificationsCenter?\");\n // We want the public notify method to be stable, setNotify call should not trigger re-renders\n showNotification: DispatchShowNotification = (notification) =>\n this.#showNotification(notification);\n hideNotification: DispatchHideNotification = () => this.#hideNotification();\n setNotify = (\n showNotificationDispatcher: DispatchShowNotification,\n hideNotificationDispatcher: DispatchHideNotification,\n ) => {\n this.#showNotification = showNotificationDispatcher;\n this.#hideNotification = hideNotificationDispatcher;\n };\n}\n\nconst NotificationsContext = React.createContext<NotificationsContext>(\n new NotificationsContextObject(),\n);\n\nexport const NotificationsProvider = (props: {\n children: ReactElement | ReactElement[];\n}) => {\n const context = useContext(NotificationsContext);\n return (\n <NotificationsContext.Provider value={context}>\n <NotificationsCenter notificationsContext={context} />\n {props.children}\n </NotificationsContext.Provider>\n );\n};\n\nexport const useNotifications = () => {\n const { hideNotification, showNotification } =\n useContext(NotificationsContext);\n return { hideNotification, showNotification };\n};\n"],"names":["useContext","jsxs","jsx","NotificationsCenter"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAA,iBAAA,EAAA,iBAAA;AAiBA,MAAM,0BAA2D,CAAA;AAAA,EAAjE,WAAA,GAAA;AACE,IAA8C,YAAA,CAAA,IAAA,EAAA,iBAAA,EAAA,MAC5C,OAAQ,CAAA,GAAA,CAAI,sDAAsD,CAAA,CAAA;AACpE,IAA8C,YAAA,CAAA,IAAA,EAAA,iBAAA,EAAA,MAC5C,OAAQ,CAAA,GAAA,CAAI,sDAAsD,CAAA,CAAA;AAEpE;AAAA,IAAA,aAAA,CAAA,IAAA,EAAA,kBAAA,EAA6C,CAAC,YAAA,KAC5C,YAAK,CAAA,IAAA,EAAA,iBAAA,CAAA,CAAL,IAAuB,CAAA,IAAA,EAAA,YAAA,CAAA,CAAA;AACzB,IAA6C,aAAA,CAAA,IAAA,EAAA,kBAAA,EAAA,MAAM,mBAAK,iBAAL,CAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AACnD,IAAY,aAAA,CAAA,IAAA,EAAA,WAAA,EAAA,CACV,4BACA,0BACG,KAAA;AACH,MAAA,YAAA,CAAA,IAAA,EAAK,iBAAoB,EAAA,0BAAA,CAAA;AACzB,MAAA,YAAA,CAAA,IAAA,EAAK,iBAAoB,EAAA,0BAAA,CAAA;AAAA,KAC3B,CAAA;AAAA;AACF;AAfE,iBAAA,GAAA,IAAA,OAAA,EAAA;AAEA,iBAAA,GAAA,IAAA,OAAA,EAAA;AAeF,MAAM,uBAAuB,KAAM,CAAA,aAAA;AAAA,EACjC,IAAI,0BAA2B;AACjC,CAAA;AAEa,MAAA,qBAAA,GAAwB,CAAC,KAEhC,KAAA;AACJ,EAAM,MAAA,OAAA,GAAUA,iBAAW,oBAAoB,CAAA;AAC/C,EAAA,uBACGC,eAAA,CAAA,oBAAA,CAAqB,QAArB,EAAA,EAA8B,OAAO,OACpC,EAAA,QAAA,EAAA;AAAA,oBAACC,cAAA,CAAAC,uCAAA,EAAA,EAAoB,sBAAsB,OAAS,EAAA,CAAA;AAAA,IACnD,KAAM,CAAA;AAAA,GACT,EAAA,CAAA;AAEJ;AAEO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,EAAE,gBAAA,EAAkB,gBAAiB,EAAA,GACzCH,iBAAW,oBAAoB,CAAA;AACjC,EAAO,OAAA,EAAE,kBAAkB,gBAAiB,EAAA;AAC9C;;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var toastNotificationCss = ".vuuToastNotification {\n --notification-color: var(--salt-content-primary-foreground);\n --vuu-icon-size: 24px;\n\n color: var(--notification-color);\n position: absolute;\n display: flex;\n padding: 8px 32px 8px 8px;\n align-items: center;\n gap: 8px;\n box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.4);\n z-index: 100000;\n}\n\n.vuuToastNotification-toastContent {\n display: flex;\n flex-direction: column;\n gap: var(--salt-spacing-100);\n}\n\n.vuuToastNotification-toastHeader {\n font-size: 16px;\n font-weight: 700;\n}\n\n.vuuToastNotification-error {\n --notification-color: var(--salt-status-error-foreground);\n background: var(--salt-status-error-background);\n}\n\n.vuuToastNotification-success {\n background: var(--salt-status-success-background);\n}\n\n.vuuToastNotification-info {\n --notification-color: var(--salt-status-info-foreground);\n background: var(--salt-status-info-background);\n}\n\n.vuuToastNotification-warning {\n --notification-color: var(--salt-status-warning-foreground);\n background: var(--salt-status-warning-background);\n}\n";
4
-
5
- module.exports = toastNotificationCss;
6
- //# sourceMappingURL=ToastNotification.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToastNotification.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,66 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var vuuUiControls = require('@vuu-ui/vuu-ui-controls');
5
- var cx = require('clsx');
6
- var styles = require('@salt-ds/styles');
7
- var window = require('@salt-ds/window');
8
- var React = require('react');
9
- var Portal = require('../portal/Portal.js');
10
- var ToastNotification$1 = require('./ToastNotification.css.js');
11
-
12
- const toastWidth = 300;
13
- const toastContainerRightPadding = 50;
14
- const toastDisplayDuration = 6e3;
15
- const horizontalTransitionDuration = 1e3;
16
- const toastHeight = 56;
17
- const verticalTransitionDuration = 300;
18
- const classBase = "vuuToastNotification";
19
- const icon = {
20
- error: "error",
21
- info: "info-circle",
22
- success: "tick",
23
- warning: "warn-triangle"
24
- };
25
- const ToastNotification = (props) => {
26
- const { top, notification, animated = true } = props;
27
- const targetWindow = window.useWindow();
28
- styles.useComponentCssInjection({
29
- testId: "vuu-toast-notification",
30
- css: ToastNotification$1,
31
- window: targetWindow
32
- });
33
- const [right, setRight] = React.useState(-toastWidth - toastContainerRightPadding);
34
- React.useEffect(() => {
35
- setTimeout(() => setRight(toastContainerRightPadding));
36
- if (animated) {
37
- setTimeout(
38
- () => setRight(-toastWidth - toastContainerRightPadding),
39
- toastDisplayDuration + horizontalTransitionDuration
40
- );
41
- }
42
- }, [animated]);
43
- return /* @__PURE__ */ jsxRuntime.jsx(Portal.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
44
- "div",
45
- {
46
- className: cx(classBase, `${classBase}-${notification.type}`),
47
- style: {
48
- height: toastHeight,
49
- right,
50
- width: toastWidth,
51
- top,
52
- transition: animated ? `right ${horizontalTransitionDuration}ms, top ${verticalTransitionDuration}ms ` : "none"
53
- },
54
- children: [
55
- /* @__PURE__ */ jsxRuntime.jsx(vuuUiControls.Icon, { name: icon[notification.level] }),
56
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classBase}-toastContent`, children: [
57
- /* @__PURE__ */ jsxRuntime.jsx("strong", { className: `${classBase}-toastHeader`, children: notification.header }),
58
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: notification.content })
59
- ] })
60
- ]
61
- }
62
- ) });
63
- };
64
-
65
- exports.ToastNotification = ToastNotification;
66
- //# sourceMappingURL=ToastNotification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToastNotification.js","sources":["../../../../packages/vuu-popups/src/notifications/ToastNotification.tsx"],"sourcesContent":["import { Icon } from \"@vuu-ui/vuu-ui-controls\";\nimport cx from \"clsx\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useEffect, useState } from \"react\";\nimport { Portal } from \"../portal\";\nimport type { ToastNotificationDescriptor } from \"./NotificationsContext\";\n\nimport toastNotificationCss from \"./ToastNotification.css\";\n\nconst toastWidth = 300;\nconst toastContainerRightPadding = 50;\nconst toastDisplayDuration = 6000;\nconst horizontalTransitionDuration = 1000;\nconst toastHeight = 56;\nconst verticalTransitionDuration = 300;\n\nexport type ToastNotificationProps = {\n top: number;\n notification: ToastNotificationDescriptor;\n animated?: boolean;\n};\n\nconst classBase = \"vuuToastNotification\";\n\nconst icon = {\n error: \"error\",\n info: \"info-circle\",\n success: \"tick\",\n warning: \"warn-triangle\",\n};\n\nexport const ToastNotification = (props: ToastNotificationProps) => {\n const { top, notification, animated = true } = props;\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-toast-notification\",\n css: toastNotificationCss,\n window: targetWindow,\n });\n\n const [right, setRight] = useState(-toastWidth - toastContainerRightPadding);\n\n useEffect(() => {\n setTimeout(() => setRight(toastContainerRightPadding));\n\n if (animated) {\n setTimeout(\n () => setRight(-toastWidth - toastContainerRightPadding),\n toastDisplayDuration + horizontalTransitionDuration,\n );\n }\n }, [animated]);\n\n return (\n <Portal>\n <div\n className={cx(classBase, `${classBase}-${notification.type}`)}\n style={{\n height: toastHeight,\n right,\n width: toastWidth,\n top,\n transition: animated\n ? `right ${horizontalTransitionDuration}ms, top ${verticalTransitionDuration}ms `\n : \"none\",\n }}\n >\n <Icon name={icon[notification.level]} />\n <div className={`${classBase}-toastContent`}>\n <strong className={`${classBase}-toastHeader`}>\n {notification.header}\n </strong>\n <div>{notification.content}</div>\n </div>\n </div>\n </Portal>\n );\n};\n"],"names":["useWindow","useComponentCssInjection","toastNotificationCss","useState","useEffect","Portal","jsxs","jsx","Icon"],"mappings":";;;;;;;;;;;AAUA,MAAM,UAAa,GAAA,GAAA;AACnB,MAAM,0BAA6B,GAAA,EAAA;AACnC,MAAM,oBAAuB,GAAA,GAAA;AAC7B,MAAM,4BAA+B,GAAA,GAAA;AACrC,MAAM,WAAc,GAAA,EAAA;AACpB,MAAM,0BAA6B,GAAA,GAAA;AAQnC,MAAM,SAAY,GAAA,sBAAA;AAElB,MAAM,IAAO,GAAA;AAAA,EACX,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,aAAA;AAAA,EACN,OAAS,EAAA,MAAA;AAAA,EACT,OAAS,EAAA;AACX,CAAA;AAEa,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAA,MAAM,EAAE,GAAA,EAAK,YAAc,EAAA,QAAA,GAAW,MAAS,GAAA,KAAA;AAC/C,EAAA,MAAM,eAAeA,gBAAU,EAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,wBAAA;AAAA,IACR,GAAK,EAAAC,mBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,IAAIC,cAAS,CAAA,CAAC,aAAa,0BAA0B,CAAA;AAE3E,EAAAC,eAAA,CAAU,MAAM;AACd,IAAW,UAAA,CAAA,MAAM,QAAS,CAAA,0BAA0B,CAAC,CAAA;AAErD,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,UAAA;AAAA,QACE,MAAM,QAAA,CAAS,CAAC,UAAA,GAAa,0BAA0B,CAAA;AAAA,QACvD,oBAAuB,GAAA;AAAA,OACzB;AAAA;AACF,GACF,EAAG,CAAC,QAAQ,CAAC,CAAA;AAEb,EAAA,sCACGC,aACC,EAAA,EAAA,QAAA,kBAAAC,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,GAAG,SAAW,EAAA,CAAA,EAAG,SAAS,CAAI,CAAA,EAAA,YAAA,CAAa,IAAI,CAAE,CAAA,CAAA;AAAA,MAC5D,KAAO,EAAA;AAAA,QACL,MAAQ,EAAA,WAAA;AAAA,QACR,KAAA;AAAA,QACA,KAAO,EAAA,UAAA;AAAA,QACP,GAAA;AAAA,QACA,YAAY,QACR,GAAA,CAAA,MAAA,EAAS,4BAA4B,CAAA,QAAA,EAAW,0BAA0B,CAC1E,GAAA,CAAA,GAAA;AAAA,OACN;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAAC,cAAA,CAACC,kBAAK,EAAA,EAAA,IAAA,EAAM,IAAK,CAAA,YAAA,CAAa,KAAK,CAAG,EAAA,CAAA;AAAA,wBACrCF,eAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,CAAA,EAAG,SAAS,CAC1B,aAAA,CAAA,EAAA,QAAA,EAAA;AAAA,0BAAAC,cAAA,CAAC,YAAO,SAAW,EAAA,CAAA,EAAG,SAAS,CAAA,YAAA,CAAA,EAC5B,uBAAa,MAChB,EAAA,CAAA;AAAA,0BACAA,cAAA,CAAC,KAAK,EAAA,EAAA,QAAA,EAAA,YAAA,CAAa,OAAQ,EAAA;AAAA,SAC7B,EAAA;AAAA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var workspaceNotificationCss = ".vuuWorkspaceNotification {\n position: absolute;\n z-index: var(--salt-zIndex-notification);\n\n .vuuWorkspaceNotification-content {\n align-items: center;\n background: var(--salt-container-primary-background);\n display: flex;\n justify-content: center\n }\n}";
4
-
5
- module.exports = workspaceNotificationCss;
6
- //# sourceMappingURL=WorkspaceNotification.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkspaceNotification.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var styles = require('@salt-ds/styles');
6
- var window = require('@salt-ds/window');
7
- var cx = require('clsx');
8
- var WorkspaceNotification$1 = require('./WorkspaceNotification.css.js');
9
- var vuuUtils = require('@vuu-ui/vuu-utils');
10
- var core = require('@salt-ds/core');
11
-
12
- const classBase = "vuuWorkspaceNotification";
13
- const WorkspaceNotification = ({
14
- children,
15
- className,
16
- style: styleProp,
17
- ...htmlAttributes
18
- }) => {
19
- const targetWindow = window.useWindow();
20
- styles.useComponentCssInjection({
21
- testId: "vuu-toast-notification",
22
- css: WorkspaceNotification$1,
23
- window: targetWindow
24
- });
25
- const { Component: FloatingComponent } = core.useFloatingComponent();
26
- const [left, top, width, height] = React.useMemo(() => {
27
- const target = document.querySelector(
28
- `#${vuuUtils.VuuShellLocation.WorkspaceContainer}`
29
- );
30
- if (target) {
31
- const { left: left2, top: top2, width: width2, height: height2 } = target.getBoundingClientRect();
32
- return [left2, top2, width2, height2];
33
- } else {
34
- return [0, 0, 200, 200];
35
- }
36
- }, []);
37
- return /* @__PURE__ */ jsxRuntime.jsx(
38
- FloatingComponent,
39
- {
40
- ...htmlAttributes,
41
- className: cx(classBase, className),
42
- open: true,
43
- role: "alert",
44
- left,
45
- top,
46
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase}-content`, style: { height, width }, children })
47
- }
48
- );
49
- };
50
-
51
- exports.WorkspaceNotification = WorkspaceNotification;
52
- //# sourceMappingURL=WorkspaceNotification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkspaceNotification.js","sources":["../../../../packages/vuu-popups/src/notifications/WorkspaceNotification.tsx"],"sourcesContent":["import { HTMLAttributes, ReactNode, useMemo } from \"react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport cx from \"clsx\";\n\nimport workspaceNotificationCss from \"./WorkspaceNotification.css\";\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { useFloatingComponent } from \"@salt-ds/core\";\n\nconst classBase = \"vuuWorkspaceNotification\";\n\nexport interface WorkspaceNotificationProps\n extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const WorkspaceNotification = ({\n children,\n className,\n style: styleProp,\n ...htmlAttributes\n}: WorkspaceNotificationProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-toast-notification\",\n css: workspaceNotificationCss,\n window: targetWindow,\n });\n\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const [left, top, width, height] = useMemo<\n [number, number, number, number]\n >(() => {\n const target = document.querySelector(\n `#${VuuShellLocation.WorkspaceContainer}`,\n );\n if (target) {\n const { left, top, width, height } = target.getBoundingClientRect();\n return [left, top, width, height];\n } else {\n return [0, 0, 200, 200];\n }\n }, []);\n\n return (\n <FloatingComponent\n {...htmlAttributes}\n className={cx(classBase, className)}\n open\n role=\"alert\"\n left={left}\n top={top}\n >\n <div className={`${classBase}-content`} style={{ height, width }}>\n {children}\n </div>\n </FloatingComponent>\n );\n};\n"],"names":["useWindow","useComponentCssInjection","workspaceNotificationCss","useFloatingComponent","useMemo","VuuShellLocation","left","top","width","height","jsx"],"mappings":";;;;;;;;;;;AASA,MAAM,SAAY,GAAA,0BAAA;AAOX,MAAM,wBAAwB,CAAC;AAAA,EACpC,QAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAO,EAAA,SAAA;AAAA,EACP,GAAG;AACL,CAAkC,KAAA;AAChC,EAAA,MAAM,eAAeA,gBAAU,EAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,wBAAA;AAAA,IACR,GAAK,EAAAC,uBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,EAAE,SAAA,EAAW,iBAAkB,EAAA,GAAIC,yBAAqB,EAAA;AAE9D,EAAA,MAAM,CAAC,IAAM,EAAA,GAAA,EAAK,OAAO,MAAM,CAAA,GAAIC,cAEjC,MAAM;AACN,IAAA,MAAM,SAAS,QAAS,CAAA,aAAA;AAAA,MACtB,CAAA,CAAA,EAAIC,0BAAiB,kBAAkB,CAAA;AAAA,KACzC;AACA,IAAA,IAAI,MAAQ,EAAA;AACV,MAAM,MAAA,EAAE,IAAAC,EAAAA,KAAAA,EAAM,GAAAC,EAAAA,IAAAA,EAAK,KAAAC,EAAAA,MAAAA,EAAO,MAAAC,EAAAA,OAAAA,EAAW,GAAA,MAAA,CAAO,qBAAsB,EAAA;AAClE,MAAA,OAAO,CAACH,KAAAA,EAAMC,IAAKC,EAAAA,MAAAA,EAAOC,OAAM,CAAA;AAAA,KAC3B,MAAA;AACL,MAAA,OAAO,CAAC,CAAA,EAAG,CAAG,EAAA,GAAA,EAAK,GAAG,CAAA;AAAA;AACxB,GACF,EAAG,EAAE,CAAA;AAEL,EACE,uBAAAC,cAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,SAAS,CAAA;AAAA,MAClC,IAAI,EAAA,IAAA;AAAA,MACJ,IAAK,EAAA,OAAA;AAAA,MACL,IAAA;AAAA,MACA,GAAA;AAAA,MAEA,QAAA,kBAAAA,cAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,CAAG,EAAA,SAAS,CAAY,QAAA,CAAA,EAAA,KAAA,EAAO,EAAE,MAAA,EAAQ,KAAM,EAAA,EAC5D,QACH,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,61 +0,0 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { getUniqueId } from '@vuu-ui/vuu-utils';
3
- import { useState, useCallback, useMemo } from 'react';
4
- import { isToastNotification, isWorkspaceNotification } from './NotificationsContext.js';
5
- import { ToastNotification } from './ToastNotification.js';
6
- import { WorkspaceNotification } from './WorkspaceNotification.js';
7
-
8
- const toastOffsetTop = 60;
9
- const toastDisplayDuration = 6e3;
10
- const horizontalTransitionDuration = 1e3;
11
- const toastHeight = 56;
12
- const toastContainerContentGap = 10;
13
- const NotificationsCenter = ({
14
- notificationsContext
15
- }) => {
16
- const [workspaceNotification, setWorkspaceNotification] = useState(null);
17
- const [notifications, setNotifications] = useState(
18
- []
19
- );
20
- const showNotification = useCallback((notification) => {
21
- if (isToastNotification(notification)) {
22
- const newNotification = {
23
- ...notification,
24
- id: getUniqueId()
25
- };
26
- setNotifications((prev) => prev.concat(newNotification));
27
- setTimeout(
28
- () => {
29
- setNotifications((prev) => prev.filter((n) => n !== newNotification));
30
- },
31
- toastDisplayDuration + horizontalTransitionDuration * 2
32
- );
33
- } else if (isWorkspaceNotification(notification)) {
34
- setWorkspaceNotification(
35
- /* @__PURE__ */ jsx(WorkspaceNotification, { children: notification.content })
36
- );
37
- } else {
38
- throw Error("[NotificationsCenter] invalid notification received");
39
- }
40
- }, []);
41
- const hideNotification = useCallback(() => {
42
- setWorkspaceNotification(null);
43
- }, []);
44
- useMemo(() => {
45
- notificationsContext.setNotify(showNotification, hideNotification);
46
- }, [hideNotification, notificationsContext, showNotification]);
47
- return /* @__PURE__ */ jsxs(Fragment, { children: [
48
- workspaceNotification,
49
- notifications.map((notification, i) => /* @__PURE__ */ jsx(
50
- ToastNotification,
51
- {
52
- top: toastOffsetTop + (toastHeight + toastContainerContentGap) * i,
53
- notification
54
- },
55
- notification.id
56
- ))
57
- ] });
58
- };
59
-
60
- export { NotificationsCenter };
61
- //# sourceMappingURL=NotificationsCenter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsCenter.js","sources":["../../../../packages/vuu-popups/src/notifications/NotificationsCenter.tsx"],"sourcesContent":["import { getUniqueId } from \"@vuu-ui/vuu-utils\";\nimport { ReactNode, useCallback, useMemo, useState } from \"react\";\nimport {\n isToastNotification,\n isWorkspaceNotification,\n Notification,\n NotificationsContext,\n ToastNotificationDescriptor as ToastNotificationType,\n} from \"./NotificationsContext\";\nimport { ToastNotification } from \"./ToastNotification\";\nimport { WorkspaceNotification } from \"./WorkspaceNotification\";\n\nexport interface NotificationsCenterProps {\n notificationsContext: NotificationsContext;\n}\n\ninterface ToastNotificationWithId extends ToastNotificationType {\n id: string;\n}\n\n// animation times in milliseconds\nconst toastOffsetTop = 60;\nconst toastDisplayDuration = 6000;\nconst horizontalTransitionDuration = 1000;\n\n// toast size in pixels\nconst toastHeight = 56;\nconst toastContainerContentGap = 10;\n// rightPadding is used together with the toastWidth to compute the toast position\n// at the beginning and at the end of the animation\n\nexport const NotificationsCenter = ({\n notificationsContext,\n}: NotificationsCenterProps) => {\n const [workspaceNotification, setWorkspaceNotification] =\n useState<ReactNode>(null);\n const [notifications, setNotifications] = useState<ToastNotificationWithId[]>(\n [],\n );\n\n const showNotification = useCallback((notification: Notification) => {\n if (isToastNotification(notification)) {\n const newNotification: ToastNotificationWithId = {\n ...notification,\n id: getUniqueId(),\n };\n setNotifications((prev) => prev.concat(newNotification));\n setTimeout(\n () => {\n setNotifications((prev) => prev.filter((n) => n !== newNotification));\n },\n toastDisplayDuration + horizontalTransitionDuration * 2,\n );\n } else if (isWorkspaceNotification(notification)) {\n setWorkspaceNotification(\n <WorkspaceNotification>{notification.content}</WorkspaceNotification>,\n );\n } else {\n throw Error(\"[NotificationsCenter] invalid notification received\");\n }\n }, []);\n\n const hideNotification = useCallback(() => {\n setWorkspaceNotification(null);\n }, []);\n\n useMemo(() => {\n notificationsContext.setNotify(showNotification, hideNotification);\n }, [hideNotification, notificationsContext, showNotification]);\n\n return (\n <>\n {workspaceNotification}\n {notifications.map((notification, i) => (\n <ToastNotification\n top={toastOffsetTop + (toastHeight + toastContainerContentGap) * i}\n notification={notification}\n key={notification.id}\n />\n ))}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAqBA,MAAM,cAAiB,GAAA,EAAA;AACvB,MAAM,oBAAuB,GAAA,GAAA;AAC7B,MAAM,4BAA+B,GAAA,GAAA;AAGrC,MAAM,WAAc,GAAA,EAAA;AACpB,MAAM,wBAA2B,GAAA,EAAA;AAI1B,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,CAAgC,KAAA;AAC9B,EAAA,MAAM,CAAC,qBAAA,EAAuB,wBAAwB,CAAA,GACpD,SAAoB,IAAI,CAAA;AAC1B,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAA,QAAA;AAAA,IACxC;AAAC,GACH;AAEA,EAAM,MAAA,gBAAA,GAAmB,WAAY,CAAA,CAAC,YAA+B,KAAA;AACnE,IAAI,IAAA,mBAAA,CAAoB,YAAY,CAAG,EAAA;AACrC,MAAA,MAAM,eAA2C,GAAA;AAAA,QAC/C,GAAG,YAAA;AAAA,QACH,IAAI,WAAY;AAAA,OAClB;AACA,MAAA,gBAAA,CAAiB,CAAC,IAAA,KAAS,IAAK,CAAA,MAAA,CAAO,eAAe,CAAC,CAAA;AACvD,MAAA,UAAA;AAAA,QACE,MAAM;AACJ,UAAiB,gBAAA,CAAA,CAAC,SAAS,IAAK,CAAA,MAAA,CAAO,CAAC,CAAM,KAAA,CAAA,KAAM,eAAe,CAAC,CAAA;AAAA,SACtE;AAAA,QACA,uBAAuB,4BAA+B,GAAA;AAAA,OACxD;AAAA,KACF,MAAA,IAAW,uBAAwB,CAAA,YAAY,CAAG,EAAA;AAChD,MAAA,wBAAA;AAAA,wBACE,GAAA,CAAC,qBAAuB,EAAA,EAAA,QAAA,EAAA,YAAA,CAAa,OAAQ,EAAA;AAAA,OAC/C;AAAA,KACK,MAAA;AACL,MAAA,MAAM,MAAM,qDAAqD,CAAA;AAAA;AACnE,GACF,EAAG,EAAE,CAAA;AAEL,EAAM,MAAA,gBAAA,GAAmB,YAAY,MAAM;AACzC,IAAA,wBAAA,CAAyB,IAAI,CAAA;AAAA,GAC/B,EAAG,EAAE,CAAA;AAEL,EAAA,OAAA,CAAQ,MAAM;AACZ,IAAqB,oBAAA,CAAA,SAAA,CAAU,kBAAkB,gBAAgB,CAAA;AAAA,GAChE,EAAA,CAAC,gBAAkB,EAAA,oBAAA,EAAsB,gBAAgB,CAAC,CAAA;AAE7D,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,qBAAA;AAAA,IACA,aAAc,CAAA,GAAA,CAAI,CAAC,YAAA,EAAc,CAChC,qBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,cAAkB,GAAA,CAAA,WAAA,GAAc,wBAA4B,IAAA,CAAA;AAAA,QACjE;AAAA,OAAA;AAAA,MACK,YAAa,CAAA;AAAA,KAErB;AAAA,GACH,EAAA,CAAA;AAEJ;;;;"}
@@ -1,15 +0,0 @@
1
- const NotificationLevel = {
2
- Error: "error",
3
- Info: "info",
4
- Success: "success",
5
- Warning: "warning"
6
- };
7
- const NotificationType = {
8
- Toast: "toast",
9
- Workspace: "workspace"
10
- };
11
- const isToastNotification = (n) => n.type === NotificationType.Toast;
12
- const isWorkspaceNotification = (n) => n.type === NotificationType.Workspace;
13
-
14
- export { NotificationLevel, NotificationType, isToastNotification, isWorkspaceNotification };
15
- //# sourceMappingURL=NotificationsContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsContext.js","sources":["../../../../packages/vuu-popups/src/notifications/NotificationsContext.tsx"],"sourcesContent":["import { ValueOf } from \"@vuu-ui/vuu-utils\";\nimport { ReactNode } from \"react\";\n\nexport type DispatchShowNotification = (notification: Notification) => void;\nexport type DispatchHideNotification = () => void;\n\nexport const NotificationLevel = {\n Error: \"error\",\n Info: \"info\",\n Success: \"success\",\n Warning: \"warning\",\n} as const;\n\nexport type NotificationLevel = ValueOf<typeof NotificationLevel>;\n\nexport const NotificationType = {\n Toast: \"toast\",\n Workspace: \"workspace\",\n} as const;\n\nexport type NotificationType = ValueOf<typeof NotificationType>;\n\ninterface NotificationDescriptorBase<T extends NotificationType> {\n level: NotificationLevel;\n type: T;\n}\n\nexport interface ToastNotificationDescriptor\n extends NotificationDescriptorBase<\"toast\"> {\n content: string;\n header: string;\n}\n\nexport interface WorkspaceNotificationDescriptor\n extends NotificationDescriptorBase<\"workspace\"> {\n content: ReactNode;\n}\n\nexport type Notification =\n | ToastNotificationDescriptor\n | WorkspaceNotificationDescriptor;\n\nexport const isToastNotification = (\n n: Notification,\n): n is ToastNotificationDescriptor => n.type === NotificationType.Toast;\n\nexport const isWorkspaceNotification = (\n n: Notification,\n): n is WorkspaceNotificationDescriptor =>\n n.type === NotificationType.Workspace;\n\nexport type NotificationsContext = {\n hideNotification: DispatchHideNotification;\n showNotification: DispatchShowNotification;\n setNotify: (\n showNotificationDispatcher: DispatchShowNotification,\n hideNotificationDispatcher: DispatchHideNotification,\n ) => void;\n};\n"],"names":[],"mappings":"AAMO,MAAM,iBAAoB,GAAA;AAAA,EAC/B,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,OAAS,EAAA,SAAA;AAAA,EACT,OAAS,EAAA;AACX;AAIO,MAAM,gBAAmB,GAAA;AAAA,EAC9B,KAAO,EAAA,OAAA;AAAA,EACP,SAAW,EAAA;AACb;AAwBO,MAAM,mBAAsB,GAAA,CACjC,CACqC,KAAA,CAAA,CAAE,SAAS,gBAAiB,CAAA;AAE5D,MAAM,uBAA0B,GAAA,CACrC,CAEA,KAAA,CAAA,CAAE,SAAS,gBAAiB,CAAA;;;;"}
@@ -1,47 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import React, { useContext } from 'react';
3
- import { NotificationsCenter } from './NotificationsCenter.js';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __typeError = (msg) => {
7
- throw TypeError(msg);
8
- };
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
12
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
13
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
14
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
15
- var _showNotification, _hideNotification;
16
- class NotificationsContextObject {
17
- constructor() {
18
- __privateAdd(this, _showNotification, () => console.log("have you forgotten to provide a NotificationsCenter?"));
19
- __privateAdd(this, _hideNotification, () => console.log("have you forgotten to provide a NotificationsCenter?"));
20
- // We want the public notify method to be stable, setNotify call should not trigger re-renders
21
- __publicField(this, "showNotification", (notification) => __privateGet(this, _showNotification).call(this, notification));
22
- __publicField(this, "hideNotification", () => __privateGet(this, _hideNotification).call(this));
23
- __publicField(this, "setNotify", (showNotificationDispatcher, hideNotificationDispatcher) => {
24
- __privateSet(this, _showNotification, showNotificationDispatcher);
25
- __privateSet(this, _hideNotification, hideNotificationDispatcher);
26
- });
27
- }
28
- }
29
- _showNotification = new WeakMap();
30
- _hideNotification = new WeakMap();
31
- const NotificationsContext = React.createContext(
32
- new NotificationsContextObject()
33
- );
34
- const NotificationsProvider = (props) => {
35
- const context = useContext(NotificationsContext);
36
- return /* @__PURE__ */ jsxs(NotificationsContext.Provider, { value: context, children: [
37
- /* @__PURE__ */ jsx(NotificationsCenter, { notificationsContext: context }),
38
- props.children
39
- ] });
40
- };
41
- const useNotifications = () => {
42
- const { hideNotification, showNotification } = useContext(NotificationsContext);
43
- return { hideNotification, showNotification };
44
- };
45
-
46
- export { NotificationsProvider, useNotifications };
47
- //# sourceMappingURL=NotificationsProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.js","sources":["../../../../packages/vuu-popups/src/notifications/NotificationsProvider.tsx"],"sourcesContent":["import React, { ReactElement, useContext } from \"react\";\nimport { NotificationsCenter } from \"./NotificationsCenter\";\nimport {\n DispatchHideNotification,\n DispatchShowNotification,\n NotificationsContext,\n} from \"./NotificationsContext\";\n\n/*\n The Context is not exposed outside this module, only the notify\n prop can be accessed via the useNotifications hook.\n The NotificationsCenter receives the full context object and\n sets the notify method. State management around dispatched\n notifications is handled entirely within the NotificationsCenter,\n avoiding rerendering our children when notifications are \n dispatched.\n*/\nclass NotificationsContextObject implements NotificationsContext {\n #showNotification: DispatchShowNotification = () =>\n console.log(\"have you forgotten to provide a NotificationsCenter?\");\n #hideNotification: DispatchHideNotification = () =>\n console.log(\"have you forgotten to provide a NotificationsCenter?\");\n // We want the public notify method to be stable, setNotify call should not trigger re-renders\n showNotification: DispatchShowNotification = (notification) =>\n this.#showNotification(notification);\n hideNotification: DispatchHideNotification = () => this.#hideNotification();\n setNotify = (\n showNotificationDispatcher: DispatchShowNotification,\n hideNotificationDispatcher: DispatchHideNotification,\n ) => {\n this.#showNotification = showNotificationDispatcher;\n this.#hideNotification = hideNotificationDispatcher;\n };\n}\n\nconst NotificationsContext = React.createContext<NotificationsContext>(\n new NotificationsContextObject(),\n);\n\nexport const NotificationsProvider = (props: {\n children: ReactElement | ReactElement[];\n}) => {\n const context = useContext(NotificationsContext);\n return (\n <NotificationsContext.Provider value={context}>\n <NotificationsCenter notificationsContext={context} />\n {props.children}\n </NotificationsContext.Provider>\n );\n};\n\nexport const useNotifications = () => {\n const { hideNotification, showNotification } =\n useContext(NotificationsContext);\n return { hideNotification, showNotification };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,IAAA,iBAAA,EAAA,iBAAA;AAiBA,MAAM,0BAA2D,CAAA;AAAA,EAAjE,WAAA,GAAA;AACE,IAA8C,YAAA,CAAA,IAAA,EAAA,iBAAA,EAAA,MAC5C,OAAQ,CAAA,GAAA,CAAI,sDAAsD,CAAA,CAAA;AACpE,IAA8C,YAAA,CAAA,IAAA,EAAA,iBAAA,EAAA,MAC5C,OAAQ,CAAA,GAAA,CAAI,sDAAsD,CAAA,CAAA;AAEpE;AAAA,IAAA,aAAA,CAAA,IAAA,EAAA,kBAAA,EAA6C,CAAC,YAAA,KAC5C,YAAK,CAAA,IAAA,EAAA,iBAAA,CAAA,CAAL,IAAuB,CAAA,IAAA,EAAA,YAAA,CAAA,CAAA;AACzB,IAA6C,aAAA,CAAA,IAAA,EAAA,kBAAA,EAAA,MAAM,mBAAK,iBAAL,CAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;AACnD,IAAY,aAAA,CAAA,IAAA,EAAA,WAAA,EAAA,CACV,4BACA,0BACG,KAAA;AACH,MAAA,YAAA,CAAA,IAAA,EAAK,iBAAoB,EAAA,0BAAA,CAAA;AACzB,MAAA,YAAA,CAAA,IAAA,EAAK,iBAAoB,EAAA,0BAAA,CAAA;AAAA,KAC3B,CAAA;AAAA;AACF;AAfE,iBAAA,GAAA,IAAA,OAAA,EAAA;AAEA,iBAAA,GAAA,IAAA,OAAA,EAAA;AAeF,MAAM,uBAAuB,KAAM,CAAA,aAAA;AAAA,EACjC,IAAI,0BAA2B;AACjC,CAAA;AAEa,MAAA,qBAAA,GAAwB,CAAC,KAEhC,KAAA;AACJ,EAAM,MAAA,OAAA,GAAU,WAAW,oBAAoB,CAAA;AAC/C,EAAA,uBACG,IAAA,CAAA,oBAAA,CAAqB,QAArB,EAAA,EAA8B,OAAO,OACpC,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,mBAAA,EAAA,EAAoB,sBAAsB,OAAS,EAAA,CAAA;AAAA,IACnD,KAAM,CAAA;AAAA,GACT,EAAA,CAAA;AAEJ;AAEO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,EAAE,gBAAA,EAAkB,gBAAiB,EAAA,GACzC,WAAW,oBAAoB,CAAA;AACjC,EAAO,OAAA,EAAE,kBAAkB,gBAAiB,EAAA;AAC9C;;;;"}
@@ -1,4 +0,0 @@
1
- var toastNotificationCss = ".vuuToastNotification {\n --notification-color: var(--salt-content-primary-foreground);\n --vuu-icon-size: 24px;\n\n color: var(--notification-color);\n position: absolute;\n display: flex;\n padding: 8px 32px 8px 8px;\n align-items: center;\n gap: 8px;\n box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.4);\n z-index: 100000;\n}\n\n.vuuToastNotification-toastContent {\n display: flex;\n flex-direction: column;\n gap: var(--salt-spacing-100);\n}\n\n.vuuToastNotification-toastHeader {\n font-size: 16px;\n font-weight: 700;\n}\n\n.vuuToastNotification-error {\n --notification-color: var(--salt-status-error-foreground);\n background: var(--salt-status-error-background);\n}\n\n.vuuToastNotification-success {\n background: var(--salt-status-success-background);\n}\n\n.vuuToastNotification-info {\n --notification-color: var(--salt-status-info-foreground);\n background: var(--salt-status-info-background);\n}\n\n.vuuToastNotification-warning {\n --notification-color: var(--salt-status-warning-foreground);\n background: var(--salt-status-warning-background);\n}\n";
2
-
3
- export { toastNotificationCss as default };
4
- //# sourceMappingURL=ToastNotification.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToastNotification.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,64 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Icon } from '@vuu-ui/vuu-ui-controls';
3
- import cx from 'clsx';
4
- import { useComponentCssInjection } from '@salt-ds/styles';
5
- import { useWindow } from '@salt-ds/window';
6
- import { useState, useEffect } from 'react';
7
- import { Portal } from '../portal/Portal.js';
8
- import toastNotificationCss from './ToastNotification.css.js';
9
-
10
- const toastWidth = 300;
11
- const toastContainerRightPadding = 50;
12
- const toastDisplayDuration = 6e3;
13
- const horizontalTransitionDuration = 1e3;
14
- const toastHeight = 56;
15
- const verticalTransitionDuration = 300;
16
- const classBase = "vuuToastNotification";
17
- const icon = {
18
- error: "error",
19
- info: "info-circle",
20
- success: "tick",
21
- warning: "warn-triangle"
22
- };
23
- const ToastNotification = (props) => {
24
- const { top, notification, animated = true } = props;
25
- const targetWindow = useWindow();
26
- useComponentCssInjection({
27
- testId: "vuu-toast-notification",
28
- css: toastNotificationCss,
29
- window: targetWindow
30
- });
31
- const [right, setRight] = useState(-toastWidth - toastContainerRightPadding);
32
- useEffect(() => {
33
- setTimeout(() => setRight(toastContainerRightPadding));
34
- if (animated) {
35
- setTimeout(
36
- () => setRight(-toastWidth - toastContainerRightPadding),
37
- toastDisplayDuration + horizontalTransitionDuration
38
- );
39
- }
40
- }, [animated]);
41
- return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(
42
- "div",
43
- {
44
- className: cx(classBase, `${classBase}-${notification.type}`),
45
- style: {
46
- height: toastHeight,
47
- right,
48
- width: toastWidth,
49
- top,
50
- transition: animated ? `right ${horizontalTransitionDuration}ms, top ${verticalTransitionDuration}ms ` : "none"
51
- },
52
- children: [
53
- /* @__PURE__ */ jsx(Icon, { name: icon[notification.level] }),
54
- /* @__PURE__ */ jsxs("div", { className: `${classBase}-toastContent`, children: [
55
- /* @__PURE__ */ jsx("strong", { className: `${classBase}-toastHeader`, children: notification.header }),
56
- /* @__PURE__ */ jsx("div", { children: notification.content })
57
- ] })
58
- ]
59
- }
60
- ) });
61
- };
62
-
63
- export { ToastNotification };
64
- //# sourceMappingURL=ToastNotification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToastNotification.js","sources":["../../../../packages/vuu-popups/src/notifications/ToastNotification.tsx"],"sourcesContent":["import { Icon } from \"@vuu-ui/vuu-ui-controls\";\nimport cx from \"clsx\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useEffect, useState } from \"react\";\nimport { Portal } from \"../portal\";\nimport type { ToastNotificationDescriptor } from \"./NotificationsContext\";\n\nimport toastNotificationCss from \"./ToastNotification.css\";\n\nconst toastWidth = 300;\nconst toastContainerRightPadding = 50;\nconst toastDisplayDuration = 6000;\nconst horizontalTransitionDuration = 1000;\nconst toastHeight = 56;\nconst verticalTransitionDuration = 300;\n\nexport type ToastNotificationProps = {\n top: number;\n notification: ToastNotificationDescriptor;\n animated?: boolean;\n};\n\nconst classBase = \"vuuToastNotification\";\n\nconst icon = {\n error: \"error\",\n info: \"info-circle\",\n success: \"tick\",\n warning: \"warn-triangle\",\n};\n\nexport const ToastNotification = (props: ToastNotificationProps) => {\n const { top, notification, animated = true } = props;\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-toast-notification\",\n css: toastNotificationCss,\n window: targetWindow,\n });\n\n const [right, setRight] = useState(-toastWidth - toastContainerRightPadding);\n\n useEffect(() => {\n setTimeout(() => setRight(toastContainerRightPadding));\n\n if (animated) {\n setTimeout(\n () => setRight(-toastWidth - toastContainerRightPadding),\n toastDisplayDuration + horizontalTransitionDuration,\n );\n }\n }, [animated]);\n\n return (\n <Portal>\n <div\n className={cx(classBase, `${classBase}-${notification.type}`)}\n style={{\n height: toastHeight,\n right,\n width: toastWidth,\n top,\n transition: animated\n ? `right ${horizontalTransitionDuration}ms, top ${verticalTransitionDuration}ms `\n : \"none\",\n }}\n >\n <Icon name={icon[notification.level]} />\n <div className={`${classBase}-toastContent`}>\n <strong className={`${classBase}-toastHeader`}>\n {notification.header}\n </strong>\n <div>{notification.content}</div>\n </div>\n </div>\n </Portal>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAUA,MAAM,UAAa,GAAA,GAAA;AACnB,MAAM,0BAA6B,GAAA,EAAA;AACnC,MAAM,oBAAuB,GAAA,GAAA;AAC7B,MAAM,4BAA+B,GAAA,GAAA;AACrC,MAAM,WAAc,GAAA,EAAA;AACpB,MAAM,0BAA6B,GAAA,GAAA;AAQnC,MAAM,SAAY,GAAA,sBAAA;AAElB,MAAM,IAAO,GAAA;AAAA,EACX,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,aAAA;AAAA,EACN,OAAS,EAAA,MAAA;AAAA,EACT,OAAS,EAAA;AACX,CAAA;AAEa,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAA,MAAM,EAAE,GAAA,EAAK,YAAc,EAAA,QAAA,GAAW,MAAS,GAAA,KAAA;AAC/C,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,wBAAA;AAAA,IACR,GAAK,EAAA,oBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,IAAI,QAAS,CAAA,CAAC,aAAa,0BAA0B,CAAA;AAE3E,EAAA,SAAA,CAAU,MAAM;AACd,IAAW,UAAA,CAAA,MAAM,QAAS,CAAA,0BAA0B,CAAC,CAAA;AAErD,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,UAAA;AAAA,QACE,MAAM,QAAA,CAAS,CAAC,UAAA,GAAa,0BAA0B,CAAA;AAAA,QACvD,oBAAuB,GAAA;AAAA,OACzB;AAAA;AACF,GACF,EAAG,CAAC,QAAQ,CAAC,CAAA;AAEb,EAAA,2BACG,MACC,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,GAAG,SAAW,EAAA,CAAA,EAAG,SAAS,CAAI,CAAA,EAAA,YAAA,CAAa,IAAI,CAAE,CAAA,CAAA;AAAA,MAC5D,KAAO,EAAA;AAAA,QACL,MAAQ,EAAA,WAAA;AAAA,QACR,KAAA;AAAA,QACA,KAAO,EAAA,UAAA;AAAA,QACP,GAAA;AAAA,QACA,YAAY,QACR,GAAA,CAAA,MAAA,EAAS,4BAA4B,CAAA,QAAA,EAAW,0BAA0B,CAC1E,GAAA,CAAA,GAAA;AAAA,OACN;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAM,IAAK,CAAA,YAAA,CAAa,KAAK,CAAG,EAAA,CAAA;AAAA,wBACrC,IAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,CAAA,EAAG,SAAS,CAC1B,aAAA,CAAA,EAAA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,YAAO,SAAW,EAAA,CAAA,EAAG,SAAS,CAAA,YAAA,CAAA,EAC5B,uBAAa,MAChB,EAAA,CAAA;AAAA,0BACA,GAAA,CAAC,KAAK,EAAA,EAAA,QAAA,EAAA,YAAA,CAAa,OAAQ,EAAA;AAAA,SAC7B,EAAA;AAAA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +0,0 @@
1
- var workspaceNotificationCss = ".vuuWorkspaceNotification {\n position: absolute;\n z-index: var(--salt-zIndex-notification);\n\n .vuuWorkspaceNotification-content {\n align-items: center;\n background: var(--salt-container-primary-background);\n display: flex;\n justify-content: center\n }\n}";
2
-
3
- export { workspaceNotificationCss as default };
4
- //# sourceMappingURL=WorkspaceNotification.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkspaceNotification.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,50 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useMemo } from 'react';
3
- import { useComponentCssInjection } from '@salt-ds/styles';
4
- import { useWindow } from '@salt-ds/window';
5
- import cx from 'clsx';
6
- import workspaceNotificationCss from './WorkspaceNotification.css.js';
7
- import { VuuShellLocation } from '@vuu-ui/vuu-utils';
8
- import { useFloatingComponent } from '@salt-ds/core';
9
-
10
- const classBase = "vuuWorkspaceNotification";
11
- const WorkspaceNotification = ({
12
- children,
13
- className,
14
- style: styleProp,
15
- ...htmlAttributes
16
- }) => {
17
- const targetWindow = useWindow();
18
- useComponentCssInjection({
19
- testId: "vuu-toast-notification",
20
- css: workspaceNotificationCss,
21
- window: targetWindow
22
- });
23
- const { Component: FloatingComponent } = useFloatingComponent();
24
- const [left, top, width, height] = useMemo(() => {
25
- const target = document.querySelector(
26
- `#${VuuShellLocation.WorkspaceContainer}`
27
- );
28
- if (target) {
29
- const { left: left2, top: top2, width: width2, height: height2 } = target.getBoundingClientRect();
30
- return [left2, top2, width2, height2];
31
- } else {
32
- return [0, 0, 200, 200];
33
- }
34
- }, []);
35
- return /* @__PURE__ */ jsx(
36
- FloatingComponent,
37
- {
38
- ...htmlAttributes,
39
- className: cx(classBase, className),
40
- open: true,
41
- role: "alert",
42
- left,
43
- top,
44
- children: /* @__PURE__ */ jsx("div", { className: `${classBase}-content`, style: { height, width }, children })
45
- }
46
- );
47
- };
48
-
49
- export { WorkspaceNotification };
50
- //# sourceMappingURL=WorkspaceNotification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkspaceNotification.js","sources":["../../../../packages/vuu-popups/src/notifications/WorkspaceNotification.tsx"],"sourcesContent":["import { HTMLAttributes, ReactNode, useMemo } from \"react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport cx from \"clsx\";\n\nimport workspaceNotificationCss from \"./WorkspaceNotification.css\";\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { useFloatingComponent } from \"@salt-ds/core\";\n\nconst classBase = \"vuuWorkspaceNotification\";\n\nexport interface WorkspaceNotificationProps\n extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const WorkspaceNotification = ({\n children,\n className,\n style: styleProp,\n ...htmlAttributes\n}: WorkspaceNotificationProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-toast-notification\",\n css: workspaceNotificationCss,\n window: targetWindow,\n });\n\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const [left, top, width, height] = useMemo<\n [number, number, number, number]\n >(() => {\n const target = document.querySelector(\n `#${VuuShellLocation.WorkspaceContainer}`,\n );\n if (target) {\n const { left, top, width, height } = target.getBoundingClientRect();\n return [left, top, width, height];\n } else {\n return [0, 0, 200, 200];\n }\n }, []);\n\n return (\n <FloatingComponent\n {...htmlAttributes}\n className={cx(classBase, className)}\n open\n role=\"alert\"\n left={left}\n top={top}\n >\n <div className={`${classBase}-content`} style={{ height, width }}>\n {children}\n </div>\n </FloatingComponent>\n );\n};\n"],"names":["left","top","width","height"],"mappings":";;;;;;;;;AASA,MAAM,SAAY,GAAA,0BAAA;AAOX,MAAM,wBAAwB,CAAC;AAAA,EACpC,QAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAO,EAAA,SAAA;AAAA,EACP,GAAG;AACL,CAAkC,KAAA;AAChC,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,wBAAA;AAAA,IACR,GAAK,EAAA,wBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,EAAE,SAAA,EAAW,iBAAkB,EAAA,GAAI,oBAAqB,EAAA;AAE9D,EAAA,MAAM,CAAC,IAAM,EAAA,GAAA,EAAK,OAAO,MAAM,CAAA,GAAI,QAEjC,MAAM;AACN,IAAA,MAAM,SAAS,QAAS,CAAA,aAAA;AAAA,MACtB,CAAA,CAAA,EAAI,iBAAiB,kBAAkB,CAAA;AAAA,KACzC;AACA,IAAA,IAAI,MAAQ,EAAA;AACV,MAAM,MAAA,EAAE,IAAAA,EAAAA,KAAAA,EAAM,GAAAC,EAAAA,IAAAA,EAAK,KAAAC,EAAAA,MAAAA,EAAO,MAAAC,EAAAA,OAAAA,EAAW,GAAA,MAAA,CAAO,qBAAsB,EAAA;AAClE,MAAA,OAAO,CAACH,KAAAA,EAAMC,IAAKC,EAAAA,MAAAA,EAAOC,OAAM,CAAA;AAAA,KAC3B,MAAA;AACL,MAAA,OAAO,CAAC,CAAA,EAAG,CAAG,EAAA,GAAA,EAAK,GAAG,CAAA;AAAA;AACxB,GACF,EAAG,EAAE,CAAA;AAEL,EACE,uBAAA,GAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,SAAS,CAAA;AAAA,MAClC,IAAI,EAAA,IAAA;AAAA,MACJ,IAAK,EAAA,OAAA;AAAA,MACL,IAAA;AAAA,MACA,GAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,CAAG,EAAA,SAAS,CAAY,QAAA,CAAA,EAAA,KAAA,EAAO,EAAE,MAAA,EAAQ,KAAM,EAAA,EAC5D,QACH,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,5 +0,0 @@
1
- import { NotificationsContext } from "./NotificationsContext";
2
- export interface NotificationsCenterProps {
3
- notificationsContext: NotificationsContext;
4
- }
5
- export declare const NotificationsCenter: ({ notificationsContext, }: NotificationsCenterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,36 +0,0 @@
1
- import { ValueOf } from "@vuu-ui/vuu-utils";
2
- import { ReactNode } from "react";
3
- export type DispatchShowNotification = (notification: Notification) => void;
4
- export type DispatchHideNotification = () => void;
5
- export declare const NotificationLevel: {
6
- readonly Error: "error";
7
- readonly Info: "info";
8
- readonly Success: "success";
9
- readonly Warning: "warning";
10
- };
11
- export type NotificationLevel = ValueOf<typeof NotificationLevel>;
12
- export declare const NotificationType: {
13
- readonly Toast: "toast";
14
- readonly Workspace: "workspace";
15
- };
16
- export type NotificationType = ValueOf<typeof NotificationType>;
17
- interface NotificationDescriptorBase<T extends NotificationType> {
18
- level: NotificationLevel;
19
- type: T;
20
- }
21
- export interface ToastNotificationDescriptor extends NotificationDescriptorBase<"toast"> {
22
- content: string;
23
- header: string;
24
- }
25
- export interface WorkspaceNotificationDescriptor extends NotificationDescriptorBase<"workspace"> {
26
- content: ReactNode;
27
- }
28
- export type Notification = ToastNotificationDescriptor | WorkspaceNotificationDescriptor;
29
- export declare const isToastNotification: (n: Notification) => n is ToastNotificationDescriptor;
30
- export declare const isWorkspaceNotification: (n: Notification) => n is WorkspaceNotificationDescriptor;
31
- export type NotificationsContext = {
32
- hideNotification: DispatchHideNotification;
33
- showNotification: DispatchShowNotification;
34
- setNotify: (showNotificationDispatcher: DispatchShowNotification, hideNotificationDispatcher: DispatchHideNotification) => void;
35
- };
36
- export {};
@@ -1,9 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { DispatchHideNotification, DispatchShowNotification } from "./NotificationsContext";
3
- export declare const NotificationsProvider: (props: {
4
- children: ReactElement | ReactElement[];
5
- }) => import("react/jsx-runtime").JSX.Element;
6
- export declare const useNotifications: () => {
7
- hideNotification: DispatchHideNotification;
8
- showNotification: DispatchShowNotification;
9
- };
@@ -1,7 +0,0 @@
1
- import type { ToastNotificationDescriptor } from "./NotificationsContext";
2
- export type ToastNotificationProps = {
3
- top: number;
4
- notification: ToastNotificationDescriptor;
5
- animated?: boolean;
6
- };
7
- export declare const ToastNotification: (props: ToastNotificationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { HTMLAttributes, ReactNode } from "react";
2
- export interface WorkspaceNotificationProps extends HTMLAttributes<HTMLDivElement> {
3
- children: ReactNode;
4
- }
5
- export declare const WorkspaceNotification: ({ children, className, style: styleProp, ...htmlAttributes }: WorkspaceNotificationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +0,0 @@
1
- export * from "./NotificationsContext";
2
- export * from "./NotificationsProvider";
3
- export * from "./ToastNotification";