@aurora-ds/components 1.7.11 → 1.7.13
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.
- package/dist/cjs/index.css +1 -0
- package/dist/cjs/index.js +20 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.js +20 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");*,:after,:before{box-sizing:border-box}body{font-family:Inter,sans-serif}
|
package/dist/cjs/index.js
CHANGED
|
@@ -274,7 +274,7 @@ const skeletonShimmerAnimation = theme.keyframes({
|
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
/** Default duration in milliseconds for mount/unmount transition animations. */
|
|
277
|
-
const DEFAULT_TRANSITION_DURATION_MS =
|
|
277
|
+
const DEFAULT_TRANSITION_DURATION_MS = 150;
|
|
278
278
|
const DEFAULT_BUTTON_HEIGHT = 40;
|
|
279
279
|
const DEFAULT_DRAWER_ITEM_SIZE = 40;
|
|
280
280
|
/** Drawer widths (px) — single source of truth for both the Drawer and its items. */
|
|
@@ -5668,7 +5668,7 @@ const DRAWER_STYLES = theme.createStyles((theme) => ({
|
|
|
5668
5668
|
display: 'flex',
|
|
5669
5669
|
flexDirection: 'column',
|
|
5670
5670
|
width: isExpanded ? EXPANDED_DRAWER_WIDTH : COLLAPSED_DRAWER_WIDTH,
|
|
5671
|
-
transition: `width ${theme.transition.
|
|
5671
|
+
transition: `width ${theme.transition.normal}`,
|
|
5672
5672
|
overflow: 'hidden',
|
|
5673
5673
|
backgroundColor: theme.colors.surfacePaper,
|
|
5674
5674
|
borderRight: `1px solid ${theme.colors.borderMain}`,
|
|
@@ -5776,6 +5776,12 @@ const BACKDROP_STYLES = theme.createStyles((theme) => ({
|
|
|
5776
5776
|
const Backdrop = ({ visible, onClick }) => (jsxRuntime.jsx("div", { className: theme.cx(BACKDROP_STYLES.root, visible && BACKDROP_STYLES.visible), onClick: onClick, "aria-hidden": true }));
|
|
5777
5777
|
Backdrop.displayName = 'Backdrop';
|
|
5778
5778
|
|
|
5779
|
+
/**
|
|
5780
|
+
* Returns `true` if the user has requested reduced motion at the OS/browser level.
|
|
5781
|
+
* Falls back to `false` in environments where `matchMedia` is unavailable (SSR, tests).
|
|
5782
|
+
*/
|
|
5783
|
+
const getPrefersReducedMotion = () => typeof window !== 'undefined' &&
|
|
5784
|
+
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
5779
5785
|
/**
|
|
5780
5786
|
* Manages mount/unmount transitions with a two-phase approach (visible → fading-in).
|
|
5781
5787
|
*
|
|
@@ -5789,10 +5795,15 @@ Backdrop.displayName = 'Backdrop';
|
|
|
5789
5795
|
* Closing sequence:
|
|
5790
5796
|
* `isFadingIn=false` → CSS transition plays → after `duration` ms → `isVisible=false`.
|
|
5791
5797
|
*
|
|
5798
|
+
* When `prefers-reduced-motion: reduce` is active the effective duration is forced to
|
|
5799
|
+
* `0` so the element is removed from the DOM immediately after hiding, in sync with
|
|
5800
|
+
* the near-instant CSS transition set by the global `globals.css` rule.
|
|
5801
|
+
*
|
|
5792
5802
|
* @param isOpen - Whether the element should be shown.
|
|
5793
5803
|
* @param duration - Transition duration in milliseconds (defaults to `DEFAULT_TRANSITION_DURATION_MS`).
|
|
5794
5804
|
*/
|
|
5795
5805
|
const useTransitionRender = (isOpen, duration = DEFAULT_TRANSITION_DURATION_MS) => {
|
|
5806
|
+
const effectiveDuration = getPrefersReducedMotion() ? 0 : duration;
|
|
5796
5807
|
const [isVisible, setIsVisible] = React.useState(isOpen);
|
|
5797
5808
|
const [isFadingIn, setIsFadingIn] = React.useState(isOpen);
|
|
5798
5809
|
// Mount synchronously before paint so the element is in the DOM at opacity:0
|
|
@@ -5817,10 +5828,10 @@ const useTransitionRender = (isOpen, duration = DEFAULT_TRANSITION_DURATION_MS)
|
|
|
5817
5828
|
}
|
|
5818
5829
|
else {
|
|
5819
5830
|
setIsFadingIn(false);
|
|
5820
|
-
const timeout = setTimeout(() => setIsVisible(false),
|
|
5831
|
+
const timeout = setTimeout(() => setIsVisible(false), effectiveDuration);
|
|
5821
5832
|
return () => clearTimeout(timeout);
|
|
5822
5833
|
}
|
|
5823
|
-
}, [isOpen,
|
|
5834
|
+
}, [isOpen, effectiveDuration]);
|
|
5824
5835
|
return { isVisible, isFadingIn };
|
|
5825
5836
|
};
|
|
5826
5837
|
|
|
@@ -5853,7 +5864,7 @@ const DRAWER_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
|
5853
5864
|
outline: 'none',
|
|
5854
5865
|
textDecoration: 'none',
|
|
5855
5866
|
boxSizing: 'border-box',
|
|
5856
|
-
transition: `width ${theme.transition.
|
|
5867
|
+
transition: `width ${theme.transition.normal}, background-color ${theme.transition.fast}, color ${theme.transition.fast}`,
|
|
5857
5868
|
whiteSpace: 'nowrap',
|
|
5858
5869
|
overflow: 'hidden',
|
|
5859
5870
|
height: DEFAULT_DRAWER_ITEM_SIZE,
|
|
@@ -5917,7 +5928,7 @@ const DRAWER_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
|
5917
5928
|
*/
|
|
5918
5929
|
const DrawerItem = ({ startIcon, label, selected = false, endContent, href, onClick, disabled = false, ariaLabel, ariaLabelledBy, ariaDescribedBy, ariaControls, ariaExpanded, ariaHasPopup, ariaCurrent, }) => {
|
|
5919
5930
|
const { isExpanded } = useDrawerContext();
|
|
5920
|
-
const { isVisible: isLabelVisible, isFadingIn: isLabelFadingIn } = useTransitionRender(isExpanded);
|
|
5931
|
+
const { isVisible: isLabelVisible, isFadingIn: isLabelFadingIn } = useTransitionRender(isExpanded, 200);
|
|
5921
5932
|
const rootClassName = DRAWER_ITEM_STYLES.root({ selected, isExpanded });
|
|
5922
5933
|
const computedAriaLabel = ariaLabel ?? (!isExpanded ? label : undefined);
|
|
5923
5934
|
const computedAriaCurrent = ariaCurrent ?? (selected ? 'page' : undefined);
|
|
@@ -7208,9 +7219,9 @@ const themeSpacing = {
|
|
|
7208
7219
|
* Default transition tokens
|
|
7209
7220
|
*/
|
|
7210
7221
|
const themeTransition = {
|
|
7211
|
-
fast: '
|
|
7212
|
-
normal: '
|
|
7213
|
-
slow: '
|
|
7222
|
+
fast: '100ms ease-in-out',
|
|
7223
|
+
normal: '200ms ease-in-out',
|
|
7224
|
+
slow: '300ms ease-in-out',
|
|
7214
7225
|
};
|
|
7215
7226
|
|
|
7216
7227
|
/**
|