@amboss/design-system 4.0.5 → 4.0.6

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 (93) hide show
  1. package/build/cjs/components/Internal/Drawer/Drawer.d.ts +0 -2
  2. package/build/cjs/components/Internal/Drawer/Drawer.js +8 -8
  3. package/build/cjs/components/Internal/Drawer/useExitAnimation.d.ts +21 -0
  4. package/build/cjs/components/Internal/Drawer/useExitAnimation.js +1 -0
  5. package/build/cjs/components/Internal/LayoutFloat/LayoutFloat.d.ts +14 -0
  6. package/build/cjs/components/Internal/LayoutFloat/LayoutFloat.js +1 -0
  7. package/build/cjs/components/Internal/Panel/Panel.d.ts +15 -2
  8. package/build/cjs/components/Internal/Panel/Panel.js +1 -1
  9. package/build/cjs/components/Internal/Sandwich/Sandwich.d.ts +8 -6
  10. package/build/cjs/components/Internal/Sandwich/Sandwich.js +1 -1
  11. package/build/cjs/components/Internal/Sandwich/SandwichFooter.d.ts +5 -1
  12. package/build/cjs/components/Internal/Sandwich/SandwichFooter.js +1 -1
  13. package/build/cjs/components/Internal/Sandwich/SandwichHeader.d.ts +5 -1
  14. package/build/cjs/components/Internal/Sandwich/SandwichHeader.js +1 -1
  15. package/build/cjs/components/Internal/Sandwich/useSandwichContext.d.ts +10 -1
  16. package/build/cjs/components/Internal/Sandwich/useSandwichContext.js +1 -1
  17. package/build/cjs/components/Layout/-types.d.ts +50 -13
  18. package/build/cjs/components/Layout/Layout.js +1 -1
  19. package/build/cjs/components/Layout/LayoutProvider.js +1 -1
  20. package/build/cjs/components/Layout/LeftPanel/LeftPanel.d.ts +6 -7
  21. package/build/cjs/components/Layout/LeftPanel/LeftPanel.js +1 -1
  22. package/build/cjs/components/Layout/LeftPanel/LeftPanelDocked.d.ts +20 -0
  23. package/build/cjs/components/Layout/LeftPanel/LeftPanelDocked.js +1 -0
  24. package/build/cjs/components/Layout/LeftPanel/LeftPanelDrawer.d.ts +15 -0
  25. package/build/cjs/components/Layout/LeftPanel/LeftPanelDrawer.js +1 -0
  26. package/build/cjs/components/Layout/PanelSlideBody.d.ts +18 -0
  27. package/build/cjs/components/Layout/PanelSlideBody.js +1 -0
  28. package/build/cjs/components/Layout/RightPanel/RightPanel.d.ts +7 -5
  29. package/build/cjs/components/Layout/RightPanel/RightPanel.js +1 -1
  30. package/build/cjs/components/Layout/RightPanel/RightPanelHeader.d.ts +8 -3
  31. package/build/cjs/components/Layout/RightPanel/RightPanelHeader.js +1 -1
  32. package/build/cjs/components/Layout/Split/Split.js +1 -1
  33. package/build/cjs/components/Layout/context.d.ts +14 -1
  34. package/build/cjs/components/Layout/context.js +1 -1
  35. package/build/cjs/components/Layout/registry.d.ts +38 -1
  36. package/build/cjs/components/Layout/registry.js +1 -1
  37. package/build/cjs/components/Layout/useFloatablePortalTargets.d.ts +37 -0
  38. package/build/cjs/components/Layout/useFloatablePortalTargets.js +1 -0
  39. package/build/cjs/components/Layout/usePanelDockedSlide.d.ts +28 -0
  40. package/build/cjs/components/Layout/usePanelDockedSlide.js +1 -0
  41. package/build/cjs/shared/prefersReducedMotion.d.ts +6 -0
  42. package/build/cjs/shared/prefersReducedMotion.js +1 -0
  43. package/build/esm/components/Internal/Drawer/Drawer.d.ts +0 -2
  44. package/build/esm/components/Internal/Drawer/Drawer.js +8 -8
  45. package/build/esm/components/Internal/Drawer/useExitAnimation.d.ts +21 -0
  46. package/build/esm/components/Internal/Drawer/useExitAnimation.js +1 -0
  47. package/build/esm/components/Internal/LayoutFloat/LayoutFloat.d.ts +14 -0
  48. package/build/esm/components/Internal/LayoutFloat/LayoutFloat.js +1 -0
  49. package/build/esm/components/Internal/Panel/Panel.d.ts +15 -2
  50. package/build/esm/components/Internal/Panel/Panel.js +1 -1
  51. package/build/esm/components/Internal/Sandwich/Sandwich.d.ts +8 -6
  52. package/build/esm/components/Internal/Sandwich/Sandwich.js +1 -1
  53. package/build/esm/components/Internal/Sandwich/SandwichFooter.d.ts +5 -1
  54. package/build/esm/components/Internal/Sandwich/SandwichFooter.js +1 -1
  55. package/build/esm/components/Internal/Sandwich/SandwichHeader.d.ts +5 -1
  56. package/build/esm/components/Internal/Sandwich/SandwichHeader.js +1 -1
  57. package/build/esm/components/Internal/Sandwich/useSandwichContext.d.ts +10 -1
  58. package/build/esm/components/Internal/Sandwich/useSandwichContext.js +1 -1
  59. package/build/esm/components/Layout/-types.d.ts +50 -13
  60. package/build/esm/components/Layout/Layout.js +1 -1
  61. package/build/esm/components/Layout/LayoutProvider.js +1 -1
  62. package/build/esm/components/Layout/LeftPanel/LeftPanel.d.ts +6 -7
  63. package/build/esm/components/Layout/LeftPanel/LeftPanel.js +1 -1
  64. package/build/esm/components/Layout/LeftPanel/LeftPanelDocked.d.ts +20 -0
  65. package/build/esm/components/Layout/LeftPanel/LeftPanelDocked.js +1 -0
  66. package/build/esm/components/Layout/LeftPanel/LeftPanelDrawer.d.ts +15 -0
  67. package/build/esm/components/Layout/LeftPanel/LeftPanelDrawer.js +1 -0
  68. package/build/esm/components/Layout/PanelSlideBody.d.ts +18 -0
  69. package/build/esm/components/Layout/PanelSlideBody.js +1 -0
  70. package/build/esm/components/Layout/RightPanel/RightPanel.d.ts +7 -5
  71. package/build/esm/components/Layout/RightPanel/RightPanel.js +1 -1
  72. package/build/esm/components/Layout/RightPanel/RightPanelHeader.d.ts +8 -3
  73. package/build/esm/components/Layout/RightPanel/RightPanelHeader.js +1 -1
  74. package/build/esm/components/Layout/Split/Split.js +1 -1
  75. package/build/esm/components/Layout/context.d.ts +14 -1
  76. package/build/esm/components/Layout/context.js +1 -1
  77. package/build/esm/components/Layout/registry.d.ts +38 -1
  78. package/build/esm/components/Layout/registry.js +1 -1
  79. package/build/esm/components/Layout/useFloatablePortalTargets.d.ts +37 -0
  80. package/build/esm/components/Layout/useFloatablePortalTargets.js +1 -0
  81. package/build/esm/components/Layout/usePanelDockedSlide.d.ts +28 -0
  82. package/build/esm/components/Layout/usePanelDockedSlide.js +1 -0
  83. package/build/esm/shared/prefersReducedMotion.d.ts +6 -0
  84. package/build/esm/shared/prefersReducedMotion.js +1 -0
  85. package/package.json +8 -8
  86. package/build/cjs/components/Internal/Drawer/useDrawerAnimation.d.ts +0 -26
  87. package/build/cjs/components/Internal/Drawer/useDrawerAnimation.js +0 -1
  88. package/build/cjs/components/Layout/usePortalContainerRefs.d.ts +0 -20
  89. package/build/cjs/components/Layout/usePortalContainerRefs.js +0 -1
  90. package/build/esm/components/Internal/Drawer/useDrawerAnimation.d.ts +0 -26
  91. package/build/esm/components/Internal/Drawer/useDrawerAnimation.js +0 -1
  92. package/build/esm/components/Layout/usePortalContainerRefs.d.ts +0 -20
  93. package/build/esm/components/Layout/usePortalContainerRefs.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amboss/design-system",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "the design system for AMBOSS products",
5
5
  "author": "AMBOSS",
6
6
  "license": "ISC",
@@ -170,12 +170,12 @@
170
170
  "@auto-it/npm": "^11.1.6",
171
171
  "@auto-it/released": "^10.13.2",
172
172
  "@emotion/jest": "^11.11.0",
173
- "@storybook/addon-a11y": "~10.4.2",
174
- "@storybook/addon-docs": "~10.4.2",
175
- "@storybook/addon-links": "~10.4.2",
176
- "@storybook/addon-mcp": "^0.6.0",
177
- "@storybook/addon-vitest": "~10.4.2",
178
- "@storybook/react-vite": "~10.4.2",
173
+ "@storybook/addon-a11y": "10.5.2",
174
+ "@storybook/addon-docs": "10.5.2",
175
+ "@storybook/addon-links": "10.5.2",
176
+ "@storybook/addon-mcp": "^0.7.0",
177
+ "@storybook/addon-vitest": "10.5.2",
178
+ "@storybook/react-vite": "10.5.2",
179
179
  "@swc/cli": "^0.1.65",
180
180
  "@swc/core": "~1.11.31",
181
181
  "@swc/plugin-emotion": "^9.0.0",
@@ -221,7 +221,7 @@
221
221
  "prettier": "^2.2.1",
222
222
  "react": "^18.3.1",
223
223
  "react-dom": "^18.3.1",
224
- "storybook": "~10.4.2",
224
+ "storybook": "10.5.2",
225
225
  "style-dictionary": "^3.8.0",
226
226
  "svg-to-pdfkit": "^0.1.8",
227
227
  "svg2vectordrawable": "^2.9.1",
@@ -1,26 +0,0 @@
1
- import { type AnimationEventHandler } from "react";
2
- export type DrawerAnimation = {
3
- /** Whether the node should render at all (entering, present, or mid-exit). */
4
- isMounted: boolean;
5
- /** True while the exit animation is playing; drives enter vs exit keyframes. */
6
- isLeaving: boolean;
7
- /** Attach to the animated content node; tears it down once its exit animation ends. */
8
- onAnimationEnd: AnimationEventHandler<HTMLElement>;
9
- };
10
- /**
11
- * Manages the drawer's presence across the enter/exit lifecycle. Styling
12
- * (keyframes, timing) lives in the component; this hook only decides whether
13
- * the node is mounted and which direction it is animating.
14
- *
15
- * The enter animation is pure CSS that plays on mount, so it needs no state.
16
- * The exit does: the consumer drives `isVisible`, and when it flips to `false`
17
- * the node stays mounted (`isLeaving === true`, tracked internally) until the
18
- * exit animation ends, then `onUnmount` fires. A `useLayoutEffect` flips into
19
- * the closing state before paint so the node isn't dropped for a frame.
20
- * Reduced motion tears down immediately, since with no animation there is no
21
- * `animationend` to wait for.
22
- */
23
- export declare function useDrawerAnimation({ isVisible, onUnmount, }: {
24
- isVisible: boolean;
25
- onUnmount?: () => void;
26
- }): DrawerAnimation;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useDrawerAnimation",{enumerable:!0,get:function(){return useDrawerAnimation}});const _react=require("react"),_useWindow=require("../../../shared/useWindow");function useDrawerAnimation({isVisible,onUnmount}){let window=(0,_useWindow.useWindow)(),[isClosing,setIsClosing]=(0,_react.useState)(!1),wasVisible=(0,_react.useRef)(isVisible),isLeaving=isClosing&&!isVisible;(0,_react.useLayoutEffect)(()=>{if(isVisible)setIsClosing(!1);else wasVisible.current&&(window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches?onUnmount?.():setIsClosing(!0));wasVisible.current=isVisible},[isVisible,onUnmount,window]);let onAnimationEnd=(0,_react.useCallback)(event=>{event.target===event.currentTarget&&isLeaving&&(setIsClosing(!1),onUnmount?.())},[isLeaving,onUnmount]);return{isMounted:isVisible||isClosing,isLeaving,onAnimationEnd}}
@@ -1,20 +0,0 @@
1
- /**
2
- * Track portal-container DOM elements by key, with stable per-key ref callbacks.
3
- * Used by `Layout` to capture each panel's host `<div>` (the `createPortal`
4
- * container) so markers can portal their content into it.
5
- *
6
- * Given a fixed list of keys, returns `[elements, refs]`:
7
- * - `refs[key]` - a ref callback to attach to an element; captures it into
8
- * `elements[key]` (and clears it to `null` on unmount).
9
- * - `elements[key]` - the currently-attached element (undefined until set).
10
- *
11
- * The callbacks are **stable** across renders, so React invokes them only on
12
- * mount/unmount - not detach/attach every render. (An inline `ref={el => …}`
13
- * that calls setState would get a new identity each render and loop.)
14
- *
15
- * Generic over the key type, so it works for any fixed key set.
16
- */
17
- export declare function usePortalContainerRefs<K extends string>(keys: readonly K[]): [
18
- Partial<Record<K, HTMLElement | null>>,
19
- Record<K, (el: HTMLElement | null) => void>
20
- ];
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"usePortalContainerRefs",{enumerable:!0,get:function(){return usePortalContainerRefs}});const _react=require("react");function usePortalContainerRefs(keys){let[elements,setElements]=(0,_react.useState)({});return[elements,(0,_react.useMemo)(()=>{let map={};return keys.forEach(key=>{map[key]=el=>setElements(prev=>prev[key]===el?prev:{...prev,[key]:el})}),map},[keys])]}
@@ -1,26 +0,0 @@
1
- import { type AnimationEventHandler } from "react";
2
- export type DrawerAnimation = {
3
- /** Whether the node should render at all (entering, present, or mid-exit). */
4
- isMounted: boolean;
5
- /** True while the exit animation is playing; drives enter vs exit keyframes. */
6
- isLeaving: boolean;
7
- /** Attach to the animated content node; tears it down once its exit animation ends. */
8
- onAnimationEnd: AnimationEventHandler<HTMLElement>;
9
- };
10
- /**
11
- * Manages the drawer's presence across the enter/exit lifecycle. Styling
12
- * (keyframes, timing) lives in the component; this hook only decides whether
13
- * the node is mounted and which direction it is animating.
14
- *
15
- * The enter animation is pure CSS that plays on mount, so it needs no state.
16
- * The exit does: the consumer drives `isVisible`, and when it flips to `false`
17
- * the node stays mounted (`isLeaving === true`, tracked internally) until the
18
- * exit animation ends, then `onUnmount` fires. A `useLayoutEffect` flips into
19
- * the closing state before paint so the node isn't dropped for a frame.
20
- * Reduced motion tears down immediately, since with no animation there is no
21
- * `animationend` to wait for.
22
- */
23
- export declare function useDrawerAnimation({ isVisible, onUnmount, }: {
24
- isVisible: boolean;
25
- onUnmount?: () => void;
26
- }): DrawerAnimation;
@@ -1 +0,0 @@
1
- import{useCallback,useLayoutEffect,useRef,useState}from"react";import{useWindow}from"../../../shared/useWindow";export function useDrawerAnimation({isVisible,onUnmount}){let window=useWindow(),[isClosing,setIsClosing]=useState(!1),wasVisible=useRef(isVisible),isLeaving=isClosing&&!isVisible;useLayoutEffect(()=>{if(isVisible)setIsClosing(!1);else wasVisible.current&&(window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches?onUnmount?.():setIsClosing(!0));wasVisible.current=isVisible},[isVisible,onUnmount,window]);let onAnimationEnd=useCallback(event=>{event.target===event.currentTarget&&isLeaving&&(setIsClosing(!1),onUnmount?.())},[isLeaving,onUnmount]);return{isMounted:isVisible||isClosing,isLeaving,onAnimationEnd}}
@@ -1,20 +0,0 @@
1
- /**
2
- * Track portal-container DOM elements by key, with stable per-key ref callbacks.
3
- * Used by `Layout` to capture each panel's host `<div>` (the `createPortal`
4
- * container) so markers can portal their content into it.
5
- *
6
- * Given a fixed list of keys, returns `[elements, refs]`:
7
- * - `refs[key]` - a ref callback to attach to an element; captures it into
8
- * `elements[key]` (and clears it to `null` on unmount).
9
- * - `elements[key]` - the currently-attached element (undefined until set).
10
- *
11
- * The callbacks are **stable** across renders, so React invokes them only on
12
- * mount/unmount - not detach/attach every render. (An inline `ref={el => …}`
13
- * that calls setState would get a new identity each render and loop.)
14
- *
15
- * Generic over the key type, so it works for any fixed key set.
16
- */
17
- export declare function usePortalContainerRefs<K extends string>(keys: readonly K[]): [
18
- Partial<Record<K, HTMLElement | null>>,
19
- Record<K, (el: HTMLElement | null) => void>
20
- ];
@@ -1 +0,0 @@
1
- import{useMemo,useState}from"react";export function usePortalContainerRefs(keys){let[elements,setElements]=useState({});return[elements,useMemo(()=>{let map={};return keys.forEach(key=>{map[key]=el=>setElements(prev=>prev[key]===el?prev:{...prev,[key]:el})}),map},[keys])]}