@zuzjs/ui 0.10.3 → 0.10.5

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 (35) hide show
  1. package/dist/cjs/comps/ChatBubble/index.d.ts +15 -0
  2. package/dist/cjs/comps/ChatBubble/index.js +26 -0
  3. package/dist/cjs/comps/ChatBubble/types.d.ts +30 -0
  4. package/dist/cjs/comps/ChatBubble/types.js +19 -0
  5. package/dist/cjs/comps/Crumb/index.d.ts +1 -1
  6. package/dist/cjs/comps/Dot/index.d.ts +0 -0
  7. package/dist/cjs/comps/Dot/index.js +1 -0
  8. package/dist/cjs/comps/Drawer/index.js +27 -17
  9. package/dist/cjs/comps/List/index.d.ts +1 -1
  10. package/dist/cjs/comps/index.d.ts +2 -0
  11. package/dist/cjs/comps/index.js +2 -0
  12. package/dist/cjs/comps/layer_manager.d.ts +13 -0
  13. package/dist/cjs/comps/layer_manager.js +42 -0
  14. package/dist/cjs/comps/svgicons.d.ts +3 -0
  15. package/dist/cjs/comps/svgicons.js +3 -0
  16. package/dist/css/colors.css +1 -1
  17. package/dist/css/styles.css +1 -1
  18. package/dist/esm/comps/ChatBubble/index.d.ts +15 -0
  19. package/dist/esm/comps/ChatBubble/index.js +26 -0
  20. package/dist/esm/comps/ChatBubble/types.d.ts +30 -0
  21. package/dist/esm/comps/ChatBubble/types.js +19 -0
  22. package/dist/esm/comps/Crumb/index.d.ts +1 -1
  23. package/dist/esm/comps/Dot/index.d.ts +0 -0
  24. package/dist/esm/comps/Dot/index.js +1 -0
  25. package/dist/esm/comps/Drawer/index.js +27 -17
  26. package/dist/esm/comps/List/index.d.ts +1 -1
  27. package/dist/esm/comps/index.d.ts +2 -0
  28. package/dist/esm/comps/index.js +2 -0
  29. package/dist/esm/comps/layer_manager.d.ts +13 -0
  30. package/dist/esm/comps/layer_manager.js +42 -0
  31. package/dist/esm/comps/svgicons.d.ts +3 -0
  32. package/dist/esm/comps/svgicons.js +3 -0
  33. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +2 -2
@@ -0,0 +1,13 @@
1
+ export type CloseHandler = () => void;
2
+ declare class LayerManager {
3
+ private stack;
4
+ private readonly SCROLL_CLASS;
5
+ private updateScrollLock;
6
+ isTop(closeFn: CloseHandler): boolean;
7
+ push(closeFn: CloseHandler): void;
8
+ pop(closeFn: CloseHandler): void;
9
+ handleEscape(): boolean;
10
+ get count(): number;
11
+ }
12
+ export declare const layerManager: LayerManager;
13
+ export {};
@@ -0,0 +1,42 @@
1
+ class LayerManager {
2
+ stack = [];
3
+ SCROLL_CLASS = "--no-scroll";
4
+ updateScrollLock() {
5
+ if (typeof window === "undefined")
6
+ return;
7
+ if (this.stack.length > 0) {
8
+ document.body.classList.add(this.SCROLL_CLASS);
9
+ }
10
+ else {
11
+ document.body.classList.remove(this.SCROLL_CLASS);
12
+ }
13
+ }
14
+ isTop(closeFn) {
15
+ return this.stack[this.stack.length - 1] === closeFn;
16
+ }
17
+ // Register a component and return a function to unregister it
18
+ push(closeFn) {
19
+ // Prevent duplicate registration of the same instance
20
+ if (!this.stack.includes(closeFn)) {
21
+ this.stack.push(closeFn);
22
+ this.updateScrollLock();
23
+ }
24
+ }
25
+ pop(closeFn) {
26
+ this.stack = this.stack.filter(fn => fn !== closeFn);
27
+ this.updateScrollLock();
28
+ }
29
+ // Attempt to close the top-most layer
30
+ handleEscape() {
31
+ const top = this.stack[this.stack.length - 1];
32
+ if (top) {
33
+ top();
34
+ return true; // We handled the event
35
+ }
36
+ return false;
37
+ }
38
+ get count() {
39
+ return this.stack.length;
40
+ }
41
+ }
42
+ export const layerManager = new LayerManager();
@@ -32,5 +32,8 @@ declare const SVGIcons: {
32
32
  mouse: import("react/jsx-runtime").JSX.Element;
33
33
  addKey: import("react/jsx-runtime").JSX.Element;
34
34
  calendar: import("react/jsx-runtime").JSX.Element;
35
+ done: import("react/jsx-runtime").JSX.Element;
36
+ doneAll: import("react/jsx-runtime").JSX.Element;
37
+ pending: import("react/jsx-runtime").JSX.Element;
35
38
  };
36
39
  export default SVGIcons;
@@ -35,6 +35,9 @@ const SVGIcons = {
35
35
  mouse: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "100%", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M13.2978 2.11468C13.0064 2.06339 12.75 2.29593 12.75 2.59185V5.45262C12.75 5.65098 12.8709 5.82564 13.0359 5.93583C13.5391 6.27202 13.87 6.84597 13.87 7.49906V9.49906C13.87 10.5291 13.03 11.3791 12 11.3791C10.96 11.3791 10.12 10.5291 10.12 9.49906V7.49906C10.12 6.84578 10.4583 6.27168 10.9639 5.93554C11.1291 5.82572 11.25 5.65098 11.25 5.45262V2.59249C11.25 2.29634 10.9935 2.0637 10.7019 2.11513C9.15243 2.38834 7.76579 3.13327 6.7 4.19906C5.34 5.55906 4.5 7.43906 4.5 9.49906V14.4991C4.5 18.6291 7.87 21.9991 12 21.9991C16.13 21.9991 19.5 18.6291 19.5 14.4991V9.49906C19.5 5.80857 16.813 2.73328 13.2978 2.11468Z", fill: "#292D32" }) }),
36
36
  addKey: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "100%", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M20.9498 14.55L14.5598 20.94C13.1598 22.34 10.8598 22.34 9.44977 20.94L3.05977 14.55C1.65977 13.15 1.65977 10.85 3.05977 9.44L9.44977 3.05C10.8498 1.65 13.1498 1.65 14.5598 3.05L20.9498 9.44C22.3498 10.85 22.3498 13.15 20.9498 14.55Z", fill: "#292D32" }) }),
37
37
  calendar: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("path", { fill: "#292D32", d: "M8.25 5.75c-.41 0-.75-.34-.75-.75V2c0-.41.34-.75.75-.75S9 1.59 9 2v3c0 .41-.34.75-.75.75M15.75 5.75c-.41 0-.75-.34-.75-.75V2c0-.41.34-.75.75-.75s.75.34.75.75v3c0 .41-.34.75-.75.75M12 14.09c.52 0 .9-.31.9-.8 0-.5-.38-.79-.9-.79s-.9.29-.9.79c0 .49.38.8.9.8M12 17c.629 0 1.14-.416 1.14-.93 0-.513-.511-.93-1.14-.93-.63 0-1.14.417-1.14.93s.51.93 1.14.93" }), _jsx("path", { fill: "#292D32", d: "M19.57 4.5c-.66-.49-1.61-.02-1.61.81v.1c0 1.17-.84 2.25-2.01 2.37-1.35.14-2.49-.92-2.49-2.24V4.5c0-.55-.45-1-1-1h-.92c-.55 0-1 .45-1 1v1.04c0 .79-.41 1.49-1.03 1.88-.09.06-.19.11-.29.16q-.135.075-.3.12c-.12.04-.25.07-.39.08q-.24.03-.48 0c-.14-.01-.27-.04-.39-.08q-.15-.045-.3-.12c-.1-.05-.2-.1-.29-.16-.63-.44-1.03-1.2-1.03-2.01v-.1c0-.77-.82-1.23-1.47-.9-.01.01-.02.01-.03.02-.04.02-.07.04-.11.07-.03.03-.07.05-.1.08-.28.22-.53.47-.74.74-.11.12-.2.25-.28.38a3.498 3.498 0 0 0-.27.46c-.02.02-.03.03-.03.05-.06.12-.12.24-.16.37-.03.05-.04.09-.06.14-.06.15-.1.3-.14.45-.04.14-.07.29-.09.44a5.902 5.902 0 0 0-.06.76v8.76A4.87 4.87 0 0 0 7.37 22h9.26a4.87 4.87 0 0 0 4.87-4.87V8.37c0-1.59-.76-2.98-1.93-3.87M12 18.25c-1.55 0-2.5-.77-2.5-2.01 0-.68.35-1.27.96-1.62-.44-.31-.73-.77-.73-1.4 0-1.3 1.04-1.97 2.27-1.97s2.26.67 2.26 1.97c0 .63-.28 1.09-.73 1.4.62.35.97.94.97 1.62 0 1.24-.96 2.01-2.5 2.01" })] }),
38
+ done: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: _jsx("path", { d: "M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z" }) }),
39
+ doneAll: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: _jsx("path", { d: "m18 7-1.41-1.41-6.34 6.34 1.41 1.41zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12zM.41 13.41 6 19l1.41-1.41L1.83 12z" }) }),
40
+ pending: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [_jsx("path", { d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8" }), _jsx("path", { d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" })] }),
38
41
  // animation: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
39
42
  // <path fill="#292D32" d="m15.39 5.211 1.41 2.82c.19.39.7.76 1.13.84l2.55.42c1.63.27 2.01 1.45.84 2.63l-1.99 1.99c-.33.33-.52.98-.41 1.45l.57 2.46c.45 1.94-.59 2.7-2.3 1.68l-2.39-1.42c-.43-.26-1.15-.26-1.58 0l-2.39 1.42c-1.71 1.01-2.75.26-2.3-1.68l.57-2.46c.09-.48-.1-1.13-.43-1.46l-1.99-1.99c-1.17-1.17-.79-2.35.84-2.63l2.55-.42c.43-.07.94-.45 1.13-.84l1.41-2.82c.77-1.52 2.01-1.52 2.78.01M8 5.75H2c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h6c.41 0 .75.34.75.75s-.34.75-.75.75M5 19.75H2c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h3c.41 0 .75.34.75.75s-.34.75-.75.75M3 12.75H2c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h1c.41 0 .75.34.75.75s-.34.75-.75.75" />
40
43
  // </svg>,