@amboss/design-system 4.0.2 → 4.0.4-canary.1

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 (49) hide show
  1. package/build/cjs/components/Internal/Drawer/Drawer.d.ts +30 -0
  2. package/build/cjs/components/Internal/Drawer/Drawer.js +1 -0
  3. package/build/cjs/components/Internal/Drawer/useDrawerAnimation.d.ts +34 -0
  4. package/build/cjs/components/Internal/Drawer/useDrawerAnimation.js +1 -0
  5. package/build/cjs/components/Layout/-types.d.ts +5 -0
  6. package/build/cjs/components/Layout/LeftPanel.d.ts +6 -6
  7. package/build/cjs/components/Layout/LeftPanel.js +1 -1
  8. package/build/cjs/components/Layout/LeftPanelDocked.d.ts +9 -0
  9. package/build/cjs/components/Layout/LeftPanelDocked.js +1 -0
  10. package/build/cjs/components/Layout/LeftPanelDrawer.d.ts +10 -0
  11. package/build/cjs/components/Layout/LeftPanelDrawer.js +1 -0
  12. package/build/cjs/components/Lightbox/Lightbox.js +2 -2
  13. package/build/cjs/components/RangePopover/RangePopover.d.ts +61 -0
  14. package/build/cjs/components/RangePopover/RangePopover.js +1 -0
  15. package/build/cjs/index.d.ts +2 -0
  16. package/build/cjs/index.js +1 -1
  17. package/build/cjs/shared/focusableSelector.d.ts +1 -0
  18. package/build/cjs/shared/focusableSelector.js +1 -0
  19. package/build/cjs/shared/useOutsideClickDeactivatesWithinPortal.d.ts +13 -0
  20. package/build/cjs/shared/useOutsideClickDeactivatesWithinPortal.js +1 -0
  21. package/build/cjs/shared/useSelectionRange.d.ts +20 -0
  22. package/build/cjs/shared/useSelectionRange.js +1 -0
  23. package/build/cjs/web-tokens/assets/icons.json +1 -0
  24. package/build/cjs/web-tokens/assets/icons16.json +1 -0
  25. package/build/esm/components/Internal/Drawer/Drawer.d.ts +30 -0
  26. package/build/esm/components/Internal/Drawer/Drawer.js +1 -0
  27. package/build/esm/components/Internal/Drawer/useDrawerAnimation.d.ts +34 -0
  28. package/build/esm/components/Internal/Drawer/useDrawerAnimation.js +1 -0
  29. package/build/esm/components/Layout/-types.d.ts +5 -0
  30. package/build/esm/components/Layout/LeftPanel.d.ts +6 -6
  31. package/build/esm/components/Layout/LeftPanel.js +1 -1
  32. package/build/esm/components/Layout/LeftPanelDocked.d.ts +9 -0
  33. package/build/esm/components/Layout/LeftPanelDocked.js +1 -0
  34. package/build/esm/components/Layout/LeftPanelDrawer.d.ts +10 -0
  35. package/build/esm/components/Layout/LeftPanelDrawer.js +1 -0
  36. package/build/esm/components/Lightbox/Lightbox.js +2 -2
  37. package/build/esm/components/RangePopover/RangePopover.d.ts +61 -0
  38. package/build/esm/components/RangePopover/RangePopover.js +1 -0
  39. package/build/esm/index.d.ts +2 -0
  40. package/build/esm/index.js +1 -1
  41. package/build/esm/shared/focusableSelector.d.ts +1 -0
  42. package/build/esm/shared/focusableSelector.js +1 -0
  43. package/build/esm/shared/useOutsideClickDeactivatesWithinPortal.d.ts +13 -0
  44. package/build/esm/shared/useOutsideClickDeactivatesWithinPortal.js +1 -0
  45. package/build/esm/shared/useSelectionRange.d.ts +20 -0
  46. package/build/esm/shared/useSelectionRange.js +1 -0
  47. package/build/esm/web-tokens/assets/icons.json +1 -0
  48. package/build/esm/web-tokens/assets/icons16.json +1 -0
  49. package/package.json +1 -1
@@ -0,0 +1,20 @@
1
+ import type { RefObject } from "react";
2
+ export type UseSelectionRangeResult = {
3
+ /** The user's current text selection within the container, or null when there is none. */
4
+ range: Range | null;
5
+ /** Resets the tracked range. Call this to dismiss UI anchored on the selection. */
6
+ clearRange: () => void;
7
+ };
8
+ /**
9
+ * Tracks the user's live text selection within `containerRef` and exposes it as
10
+ * a DOM {@link Range}. Selections that fall outside the container are ignored.
11
+ *
12
+ * Handy for anchoring a `RangePopover` (or any range-positioned surface) on a
13
+ * painted text selection that has no DOM node of its own. The returned
14
+ * `clearRange` lets the consumer drop the range when the anchored UI is
15
+ * dismissed, since the selection itself may still be present.
16
+ *
17
+ * @param containerRef - The element whose text selections should be tracked.
18
+ * @returns The current selection `range` (or null) and a `clearRange` resetter.
19
+ */
20
+ export declare const useSelectionRange: (containerRef: RefObject<HTMLElement | null>) => UseSelectionRangeResult;
@@ -0,0 +1 @@
1
+ import{useCallback,useEffect,useRef,useState}from"react";import{useDocument}from"./useDocument";export const useSelectionRange=containerRef=>{let doc=useDocument(),[range,setRange]=useState(null),updateTimeoutRef=useRef(),clearRange=useCallback(()=>{clearTimeout(updateTimeoutRef.current),setRange(null)},[]);return useEffect(()=>{if(!doc)return;let handleSelectionEnd=()=>{clearTimeout(updateTimeoutRef.current);let selection=doc.getSelection(),selectionRange=selection&&!selection.isCollapsed&&selection.rangeCount>0?selection.getRangeAt(0):null;if(!selectionRange||!containerRef.current?.contains(selectionRange.commonAncestorContainer))return void setRange(null);let nextRange=selectionRange.cloneRange();updateTimeoutRef.current=setTimeout(()=>setRange(nextRange),0)};return doc.addEventListener("mouseup",handleSelectionEnd),()=>{clearTimeout(updateTimeoutRef.current),doc.removeEventListener("mouseup",handleSelectionEnd)}},[doc,containerRef]),{range,clearRange}};
@@ -161,6 +161,7 @@
161
161
  "numbered-list": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill=\"currentColor\" d=\"m2 7 2-2h2v14H4V7.8L2 10zm6-1a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H9a1 1 0 0 1-1-1m1 5a1 1 0 1 0 0 2h12a1 1 0 1 0 0-2zm0 6a1 1 0 1 0 0 2h12a1 1 0 1 0 0-2z\"/></svg>",
162
162
  "open-full-screen": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M2 5a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3zm3-1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1zm1 3.685C6 6.755 6.754 6 7.685 6h8.63C17.245 6 18 6.754 18 7.685v8.63c0 .93-.754 1.685-1.685 1.685h-8.63C6.755 18 6 17.246 6 16.315zM8 8v8h8V8z\" clip-rule=\"evenodd\"/></svg>",
163
163
  "open-new-tab": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M5 2a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3zM4 5a1 1 0 0 1 1-1h6v3a3 3 0 0 0 3 3h6v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm16 3V5a1 1 0 0 0-1-1h-6v3a1 1 0 0 0 1 1z\" clip-rule=\"evenodd\"/></svg>",
164
+ "open-sidebar-left": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill-rule=\"evenodd\" d=\"M19 2a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3zm-9 18h9a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-9zM5 4a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h3V4z\" clip-rule=\"evenodd\"/></svg>",
164
165
  "open-sidebar-right": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill=\"currentColor\" d=\"M20 19a1 1 0 0 1-1 1h-3V4h3a1 1 0 0 1 1 1zM4 19V5c0-.552.449-1 1-1h9v16H5c-.551 0-1-.448-1-1M19 2H5C3.346 2 2 3.345 2 5v14c0 1.654 1.346 3 3 3h14c1.654 0 3-1.346 3-3V5c0-1.655-1.346-3-3-3\"/></svg>",
165
166
  "paperclip": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill-rule=\"evenodd\" d=\"M17.775 4.107a2.955 2.955 0 0 0-4.16 0l-9.001 8.942a4.845 4.845 0 0 0 0 6.884 4.924 4.924 0 0 0 6.93 0l9.003-8.941a.984.984 0 0 1 1.385 0 .97.97 0 0 1 0 1.376l-9.002 8.941a6.89 6.89 0 0 1-9.702 0 6.78 6.78 0 0 1 0-9.636L12.23 2.73a4.923 4.923 0 0 1 6.93 0 4.844 4.844 0 0 1 0 6.883l-9.012 8.942a2.954 2.954 0 0 1-4.157 0 2.906 2.906 0 0 1 0-4.13l8.317-8.251a.984.984 0 0 1 1.385 0 .97.97 0 0 1-.001 1.377l-8.316 8.25a.97.97 0 0 0 0 1.378.985.985 0 0 0 1.387 0l9.012-8.942a2.91 2.91 0 0 0 0-4.131\" clip-rule=\"evenodd\"/></svg>",
166
167
  "paragraph": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"none\" viewBox=\"0 0 24 24\" focusable=\"false\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M7 5h6.25c1.281 0 2.496.544 3.381 1.488A5.14 5.14 0 0 1 18 10c0 2.7-2.067 5-4.75 5H9v5H7zm2 8h4.25c1.459 0 2.75-1.281 2.75-3a3.14 3.14 0 0 0-.828-2.144A2.64 2.64 0 0 0 13.25 7H9z\" clip-rule=\"evenodd\"/></svg>",
@@ -161,6 +161,7 @@
161
161
  "numbered-list": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\" focusable=\"false\"><path fill=\"currentColor\" d=\"m1 5 2-2h2v10H3V5.5l-2 2zm13 0H7V3h7a1 1 0 1 1 0 2M7 9h7a1 1 0 1 0 0-2H7zm0 4h7a1 1 0 1 0 0-2H7z\"/></svg>",
162
162
  "open-full-screen": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\" focusable=\"false\"><g clip-path=\"url(#a)\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M3 3h10v10H3zM1 3a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2zm5 7V6h4v4zM4 4.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5z\" clip-rule=\"evenodd\"/></g><defs><clipPath id=\"a\"><path d=\"M0 0h16v16H0z\"/></clipPath></defs></svg>",
163
163
  "open-new-tab": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\" focusable=\"false\"><g clip-path=\"url(#a)\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M9 3h4v2H9zM7 3H3v10h10V7H9a2 2 0 0 1-2-2zM1 3a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2z\" clip-rule=\"evenodd\"/></g><defs><clipPath id=\"a\"><path d=\"M0 0h16v16H0z\"/></clipPath></defs></svg>",
164
+ "open-sidebar-left": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" focusable=\"false\"><path fill-rule=\"evenodd\" d=\"M12.667 1A2.333 2.333 0 0 1 15 3.333v9.334A2.333 2.333 0 0 1 12.667 15H3.333A2.333 2.333 0 0 1 1 12.667V3.333A2.333 2.333 0 0 1 3.333 1zM7 13h5.667c.184 0 .333-.15.333-.333V3.333A.333.333 0 0 0 12.667 3H7zM3.333 3A.333.333 0 0 0 3 3.333v9.334c0 .184.15.333.333.333H5V3z\" clip-rule=\"evenodd\"/></svg>",
164
165
  "open-sidebar-right": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\" focusable=\"false\"><g clip-path=\"url(#a)\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M11 3h2v10h-2zM9 3H3v10h6zM1 3a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2z\" clip-rule=\"evenodd\"/></g><defs><clipPath id=\"a\"><path d=\"M0 0h16v16H0z\"/></clipPath></defs></svg>",
165
166
  "paperclip": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 16 16\" focusable=\"false\"><path d=\"M12.294 3.74c0-.442-.18-.866-.5-1.179a1.73 1.73 0 0 0-1.207-.488 1.73 1.73 0 0 0-1.207.488l-6.354 6.21a3 3 0 0 0-.905 2.137c0 .8.325 1.569.905 2.135s1.366.884 2.185.884c.82 0 1.606-.318 2.185-.884L14.501 6.1 16 7.566l-7.104 6.942A5.27 5.27 0 0 1 5.21 16a5.27 5.27 0 0 1-3.685-1.492A5.04 5.04 0 0 1 0 10.908C0 9.557.549 8.26 1.526 7.306l6.354-6.21A3.87 3.87 0 0 1 10.587 0c1.015 0 1.989.394 2.706 1.096a3.7 3.7 0 0 1 1.122 2.644 3.7 3.7 0 0 1-1.122 2.646l-6.362 6.21c-.458.447-1.079.7-1.727.7s-1.27-.252-1.728-.7a2.36 2.36 0 0 1-.715-1.688c0-.634.257-1.242.715-1.69l6.62-6.463 1.5 1.466-6.62 6.463a.313.313 0 0 0 0 .446.33.33 0 0 0 .457 0l6.36-6.21.114-.122c.249-.297.387-.67.387-1.058\"/></svg>",
166
167
  "paragraph": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\" focusable=\"false\"><g stroke=\"currentColor\" stroke-width=\"2\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5 4h3.5a2.5 2.5 0 0 1 0 5H5\"/><path d=\"M5 3v10\"/></g></svg>",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amboss/design-system",
3
- "version": "4.0.2",
3
+ "version": "4.0.4-canary.1",
4
4
  "description": "the design system for AMBOSS products",
5
5
  "author": "AMBOSS",
6
6
  "license": "ISC",