@razorpay/blade 12.0.0 → 12.0.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 (33) hide show
  1. package/build/lib/native/components/AnimateInteractions/AnimateInteractions.native.js +11 -0
  2. package/build/lib/native/components/AnimateInteractions/AnimateInteractions.native.js.map +1 -0
  3. package/build/lib/native/components/Stagger/Stagger.native.js +11 -0
  4. package/build/lib/native/components/Stagger/Stagger.native.js.map +1 -0
  5. package/build/lib/native/components/index.js +2 -0
  6. package/build/lib/native/components/index.js.map +1 -1
  7. package/build/lib/web/development/components/AnimateInteractions/AnimateInteractions.web.js +37 -0
  8. package/build/lib/web/development/components/AnimateInteractions/AnimateInteractions.web.js.map +1 -0
  9. package/build/lib/web/development/components/AnimateInteractions/index.js +2 -0
  10. package/build/lib/web/development/components/AnimateInteractions/index.js.map +1 -0
  11. package/build/lib/web/development/components/AnimateInteractions/useFocusWithin.js +30 -0
  12. package/build/lib/web/development/components/AnimateInteractions/useFocusWithin.js.map +1 -0
  13. package/build/lib/web/development/components/Stagger/Stagger.web.js +73 -0
  14. package/build/lib/web/development/components/Stagger/Stagger.web.js.map +1 -0
  15. package/build/lib/web/development/components/Stagger/index.js +2 -0
  16. package/build/lib/web/development/components/Stagger/index.js.map +1 -0
  17. package/build/lib/web/development/components/index.js +4 -0
  18. package/build/lib/web/development/components/index.js.map +1 -1
  19. package/build/lib/web/production/components/AnimateInteractions/AnimateInteractions.web.js +37 -0
  20. package/build/lib/web/production/components/AnimateInteractions/AnimateInteractions.web.js.map +1 -0
  21. package/build/lib/web/production/components/AnimateInteractions/index.js +2 -0
  22. package/build/lib/web/production/components/AnimateInteractions/index.js.map +1 -0
  23. package/build/lib/web/production/components/AnimateInteractions/useFocusWithin.js +30 -0
  24. package/build/lib/web/production/components/AnimateInteractions/useFocusWithin.js.map +1 -0
  25. package/build/lib/web/production/components/Stagger/Stagger.web.js +73 -0
  26. package/build/lib/web/production/components/Stagger/Stagger.web.js.map +1 -0
  27. package/build/lib/web/production/components/Stagger/index.js +2 -0
  28. package/build/lib/web/production/components/Stagger/index.js.map +1 -0
  29. package/build/lib/web/production/components/index.js +4 -0
  30. package/build/lib/web/production/components/index.js.map +1 -1
  31. package/build/types/components/index.d.ts +239 -145
  32. package/build/types/components/index.native.d.ts +179 -145
  33. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import '../Typography/Heading/Heading.js';
2
+ import { Text } from '../Typography/Text/Text.js';
3
+ import '../Typography/Code/Code.js';
4
+ import '../Typography/Display/Display.js';
5
+ import { throwBladeError } from '../../utils/logger/logger.js';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ var AnimateInteractions=function AnimateInteractions(_props){throwBladeError({message:'AnimateInteractions is not yet implemented for native',moduleName:'AnimateInteractions'});return jsx(Text,{children:"AnimateInteractions Component is not available for Native mobile apps."});};
9
+
10
+ export { AnimateInteractions };
11
+ //# sourceMappingURL=AnimateInteractions.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimateInteractions.native.js","sources":["../../../../../src/components/AnimateInteractions/AnimateInteractions.native.tsx"],"sourcesContent":["import type { AnimateInteractionsProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst AnimateInteractions = (_props: AnimateInteractionsProps): React.ReactElement => {\n throwBladeError({\n message: 'AnimateInteractions is not yet implemented for native',\n moduleName: 'AnimateInteractions',\n });\n\n return <Text>AnimateInteractions Component is not available for Native mobile apps.</Text>;\n};\n\nexport { AnimateInteractions };\n"],"names":["AnimateInteractions","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;;AAIM,IAAAA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAIC,MAAgC,CAAyB,CACpFC,eAAe,CAAC,CACdC,OAAO,CAAE,uDAAuD,CAChEC,UAAU,CAAE,qBACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,wEAAsE,CAAM,CAAC,CAC5F;;;;"}
@@ -0,0 +1,11 @@
1
+ import '../Typography/Heading/Heading.js';
2
+ import { Text } from '../Typography/Text/Text.js';
3
+ import '../Typography/Code/Code.js';
4
+ import '../Typography/Display/Display.js';
5
+ import { throwBladeError } from '../../utils/logger/logger.js';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ var Stagger=function Stagger(_props){throwBladeError({message:'Stagger is not yet implemented for native',moduleName:'Stagger'});return jsx(Text,{children:"Stagger Component is not available for Native mobile apps."});};
9
+
10
+ export { Stagger };
11
+ //# sourceMappingURL=Stagger.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stagger.native.js","sources":["../../../../../src/components/Stagger/Stagger.native.tsx"],"sourcesContent":["import type { StaggerProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst Stagger = (_props: StaggerProps): React.ReactElement => {\n throwBladeError({\n message: 'Stagger is not yet implemented for native',\n moduleName: 'Stagger',\n });\n\n return <Text>Stagger Component is not available for Native mobile apps.</Text>;\n};\n\nexport { Stagger };\n"],"names":["Stagger","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;;AAIM,IAAAA,OAAO,CAAG,SAAVA,OAAOA,CAAIC,MAAoB,CAAyB,CAC5DC,eAAe,CAAC,CACdC,OAAO,CAAE,2CAA2C,CACpDC,UAAU,CAAE,SACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,4DAA0D,CAAM,CAAC,CAChF;;;;"}
@@ -7,6 +7,7 @@ export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListIt
7
7
  export { ActionListItemAsset } from './ActionList/ActionListItemAsset.native.js';
8
8
  export { Alert } from './Alert/Alert.js';
9
9
  export { Amount } from './Amount/Amount.js';
10
+ export { AnimateInteractions } from './AnimateInteractions/AnimateInteractions.native.js';
10
11
  export { Avatar } from './Avatar/Avatar.native.js';
11
12
  export { AvatarGroup } from './Avatar/AvatarGroup.native.js';
12
13
  export { TrustedBadgeIcon } from './Avatar/TrustedBadgeIcon.native.js';
@@ -454,6 +455,7 @@ export { Spinner } from './Spinner/Spinner/Spinner.js';
454
455
  export { Tour } from './SpotlightPopoverTour/Tour.native.js';
455
456
  export { SpotlightPopoverTourFooter } from './SpotlightPopoverTour/TourFooter.native.js';
456
457
  export { SpotlightPopoverTourStep } from './SpotlightPopoverTour/TourStep.native.js';
458
+ export { Stagger } from './Stagger/Stagger.native.js';
457
459
  export { StepGroup } from './StepGroup/StepGroup.native.js';
458
460
  export { StepItem } from './StepGroup/StepItem.native.js';
459
461
  export { StepItemIcon, StepItemIndicator } from './StepGroup/StepItemMarker.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,37 @@
1
+ import React__default from 'react';
2
+ import { useAnimation } from 'framer-motion';
3
+ import { AnimateInteractionsContext } from './AnimateInteractionsProvider.js';
4
+ import { useFocusWithin } from './useFocusWithin.js';
5
+ import '../BaseMotion/index.js';
6
+ import { jsx } from 'react/jsx-runtime';
7
+ import { BaseMotionEnhancerBox } from '../BaseMotion/BaseMotion.js';
8
+
9
+ var AnimateInteractions = function AnimateInteractions(_ref) {
10
+ var children = _ref.children,
11
+ _ref$motionTriggers = _ref.motionTriggers,
12
+ motionTriggers = _ref$motionTriggers === void 0 ? ['hover'] : _ref$motionTriggers;
13
+ var baseMotionRef = React__default.useRef(null);
14
+ var controls = useAnimation();
15
+ useFocusWithin(baseMotionRef, {
16
+ onFocusWithin: function onFocusWithin() {
17
+ void controls.start('animate');
18
+ },
19
+ onBlurWithin: function onBlurWithin() {
20
+ void controls.start('exit');
21
+ }
22
+ });
23
+ return /*#__PURE__*/jsx(AnimateInteractionsContext.Provider, {
24
+ value: {
25
+ isInsideAnimateInteractionsContainer: true
26
+ },
27
+ children: /*#__PURE__*/jsx(BaseMotionEnhancerBox, {
28
+ ref: baseMotionRef,
29
+ motionTriggers: motionTriggers,
30
+ animate: controls,
31
+ children: children
32
+ })
33
+ });
34
+ };
35
+
36
+ export { AnimateInteractions };
37
+ //# sourceMappingURL=AnimateInteractions.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimateInteractions.web.js","sources":["../../../../../../src/components/AnimateInteractions/AnimateInteractions.web.tsx"],"sourcesContent":["import React from 'react';\nimport { useAnimation } from 'framer-motion';\nimport { AnimateInteractionsContext } from './AnimateInteractionsProvider';\nimport { useFocusWithin } from './useFocusWithin';\nimport type { AnimateInteractionsProps } from './types';\nimport { BaseMotionEnhancerBox } from '~components/BaseMotion';\n\n/**\n * ## AnimateInteractions\n *\n * AnimateInteractions is the utility preset that we offer to help you animate children when the parent is interacted.\n *\n * This is in a way equivalent to following CSS-\n * ```css\n * .parent:hover .child { }\n * ```\n *\n * ### Usage\n *\n * ```jsx\n * <AnimateInteractions\n * motionTriggers={['hover']}\n * > // <-- When this is hovered\n * <Box>\n * <Move\n * motionTriggers={['on-animate-interactions']}\n * > // <-- this animates in\n * <Box />\n * </Move>\n * </Box>\n * </AnimateInteractions>\n * ```\n */\nconst AnimateInteractions = ({\n children,\n motionTriggers = ['hover'],\n}: AnimateInteractionsProps): React.ReactElement => {\n const baseMotionRef = React.useRef<HTMLDivElement | null>(null);\n const controls = useAnimation();\n\n useFocusWithin(baseMotionRef, {\n onFocusWithin: () => {\n void controls.start('animate');\n },\n onBlurWithin: () => {\n void controls.start('exit');\n },\n });\n\n return (\n <AnimateInteractionsContext.Provider value={{ isInsideAnimateInteractionsContainer: true }}>\n <BaseMotionEnhancerBox ref={baseMotionRef} motionTriggers={motionTriggers} animate={controls}>\n {children}\n </BaseMotionEnhancerBox>\n </AnimateInteractionsContext.Provider>\n );\n};\n\nexport { AnimateInteractions };\n"],"names":["AnimateInteractions","_ref","children","_ref$motionTriggers","motionTriggers","baseMotionRef","React","useRef","controls","useAnimation","useFocusWithin","onFocusWithin","start","onBlurWithin","_jsx","AnimateInteractionsContext","Provider","value","isInsideAnimateInteractionsContainer","BaseMotionEnhancerBox","ref","animate"],"mappings":";;;;;;;;AAiCA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAG2B;AAAA,EAAA,IAFlDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,mBAAA,GAAAF,IAAA,CACRG,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,KAAA,CAAA,GAAG,CAAC,OAAO,CAAC,GAAAA,mBAAA,CAAA;AAE1B,EAAA,IAAME,aAAa,GAAGC,cAAK,CAACC,MAAM,CAAwB,IAAI,CAAC,CAAA;AAC/D,EAAA,IAAMC,QAAQ,GAAGC,YAAY,EAAE,CAAA;EAE/BC,cAAc,CAACL,aAAa,EAAE;IAC5BM,aAAa,EAAE,SAAAA,aAAAA,GAAM;AACnB,MAAA,KAAKH,QAAQ,CAACI,KAAK,CAAC,SAAS,CAAC,CAAA;KAC/B;IACDC,YAAY,EAAE,SAAAA,YAAAA,GAAM;AAClB,MAAA,KAAKL,QAAQ,CAACI,KAAK,CAAC,MAAM,CAAC,CAAA;AAC7B,KAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,oBACEE,GAAA,CAACC,0BAA0B,CAACC,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,oCAAoC,EAAE,IAAA;KAAO;IAAAhB,QAAA,eACzFY,GAAA,CAACK,qBAAqB,EAAA;AAACC,MAAAA,GAAG,EAAEf,aAAc;AAACD,MAAAA,cAAc,EAAEA,cAAe;AAACiB,MAAAA,OAAO,EAAEb,QAAS;AAAAN,MAAAA,QAAA,EAC1FA,QAAAA;KACoB,CAAA;AAAC,GACW,CAAC,CAAA;AAE1C;;;;"}
@@ -0,0 +1,2 @@
1
+ export { AnimateInteractions } from './AnimateInteractions.web.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { useEffect } from 'react';
2
+
3
+ var useFocusWithin = function useFocusWithin(ref, _ref) {
4
+ var onFocusWithin = _ref.onFocusWithin,
5
+ onBlurWithin = _ref.onBlurWithin;
6
+ useEffect(function () {
7
+ var element = ref.current;
8
+ if (!element) return;
9
+ var handleFocusIn = function handleFocusIn() {
10
+ onFocusWithin === null || onFocusWithin === void 0 ? void 0 : onFocusWithin();
11
+ };
12
+ var handleFocusOut = function handleFocusOut(event) {
13
+ // Ensure that focus is not still within the container
14
+ if (element && !element.contains(event.relatedTarget)) {
15
+ onBlurWithin === null || onBlurWithin === void 0 ? void 0 : onBlurWithin();
16
+ }
17
+ };
18
+ element.addEventListener('focusin', handleFocusIn);
19
+ element.addEventListener('focusout', handleFocusOut);
20
+
21
+ // eslint-disable-next-line consistent-return
22
+ return function () {
23
+ element.removeEventListener('focusin', handleFocusIn);
24
+ element.removeEventListener('focusout', handleFocusOut);
25
+ };
26
+ }, [ref, onFocusWithin, onBlurWithin]);
27
+ };
28
+
29
+ export { useFocusWithin };
30
+ //# sourceMappingURL=useFocusWithin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusWithin.js","sources":["../../../../../../src/components/AnimateInteractions/useFocusWithin.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype FocusWithinHandlers = {\n onFocusWithin?: () => void;\n onBlurWithin?: () => void;\n};\n\nexport const useFocusWithin = <T extends HTMLElement>(\n ref: React.RefObject<T>,\n { onFocusWithin, onBlurWithin }: FocusWithinHandlers,\n): void => {\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n\n const handleFocusIn = (): void => {\n onFocusWithin?.();\n };\n\n const handleFocusOut = (event: FocusEvent): void => {\n // Ensure that focus is not still within the container\n if (element && !element.contains(event.relatedTarget as Node)) {\n onBlurWithin?.();\n }\n };\n\n element.addEventListener('focusin', handleFocusIn);\n element.addEventListener('focusout', handleFocusOut);\n\n // eslint-disable-next-line consistent-return\n return () => {\n element.removeEventListener('focusin', handleFocusIn);\n element.removeEventListener('focusout', handleFocusOut);\n };\n }, [ref, onFocusWithin, onBlurWithin]);\n};\n"],"names":["useFocusWithin","ref","_ref","onFocusWithin","onBlurWithin","useEffect","element","current","handleFocusIn","handleFocusOut","event","contains","relatedTarget","addEventListener","removeEventListener"],"mappings":";;AAOO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACzBC,GAAuB,EAAAC,IAAA,EAEd;AAAA,EAAA,IADPC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY,CAAA;AAE7BC,EAAAA,SAAS,CAAC,YAAM;AACd,IAAA,IAAMC,OAAO,GAAGL,GAAG,CAACM,OAAO,CAAA;IAC3B,IAAI,CAACD,OAAO,EAAE,OAAA;AAEd,IAAA,IAAME,aAAa,GAAG,SAAhBA,aAAaA,GAAe;AAChCL,MAAAA,aAAa,KAAbA,IAAAA,IAAAA,aAAa,KAAbA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,aAAa,EAAI,CAAA;KAClB,CAAA;AAED,IAAA,IAAMM,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAiB,EAAW;AAClD;MACA,IAAIJ,OAAO,IAAI,CAACA,OAAO,CAACK,QAAQ,CAACD,KAAK,CAACE,aAAqB,CAAC,EAAE;AAC7DR,QAAAA,YAAY,KAAZA,IAAAA,IAAAA,YAAY,KAAZA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,YAAY,EAAI,CAAA;AAClB,OAAA;KACD,CAAA;AAEDE,IAAAA,OAAO,CAACO,gBAAgB,CAAC,SAAS,EAAEL,aAAa,CAAC,CAAA;AAClDF,IAAAA,OAAO,CAACO,gBAAgB,CAAC,UAAU,EAAEJ,cAAc,CAAC,CAAA;;AAEpD;AACA,IAAA,OAAO,YAAM;AACXH,MAAAA,OAAO,CAACQ,mBAAmB,CAAC,SAAS,EAAEN,aAAa,CAAC,CAAA;AACrDF,MAAAA,OAAO,CAACQ,mBAAmB,CAAC,UAAU,EAAEL,cAAc,CAAC,CAAA;KACxD,CAAA;GACF,EAAE,CAACR,GAAG,EAAEE,aAAa,EAAEC,YAAY,CAAC,CAAC,CAAA;AACxC;;;;"}
@@ -0,0 +1,73 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import _typeof from '@babel/runtime/helpers/typeof';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React__default from 'react';
5
+ import { AnimatePresence } from 'framer-motion';
6
+ import { StaggerContext } from './StaggerProvider.js';
7
+ import '../BaseMotion/index.js';
8
+ import { msToSeconds } from '../../utils/msToSeconds.js';
9
+ import '../../utils/index.js';
10
+ import { jsx } from 'react/jsx-runtime';
11
+ import useTheme from '../BladeProvider/useTheme.js';
12
+ import { BaseMotionBox } from '../BaseMotion/BaseMotion.js';
13
+
14
+ var _excluded = ["children", "isVisible", "type", "shouldUnmountWhenHidden", "delay", "motionTriggers"];
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ var Stagger = function Stagger(_ref) {
18
+ var children = _ref.children,
19
+ _ref$isVisible = _ref.isVisible,
20
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
21
+ _ref$type = _ref.type,
22
+ type = _ref$type === void 0 ? 'inout' : _ref$type,
23
+ _ref$shouldUnmountWhe = _ref.shouldUnmountWhenHidden,
24
+ shouldUnmountWhenHidden = _ref$shouldUnmountWhe === void 0 ? false : _ref$shouldUnmountWhe,
25
+ delay = _ref.delay,
26
+ motionTriggers = _ref.motionTriggers,
27
+ boxProps = _objectWithoutProperties(_ref, _excluded);
28
+ var _useTheme = useTheme(),
29
+ theme = _useTheme.theme;
30
+ // Only need AnimatePresence when we have to unmount the component
31
+ var AnimateWrapper = shouldUnmountWhenHidden ? AnimatePresence : React__default.Fragment;
32
+ // keep it always mounted when shouldUnmountWhenHidden is false
33
+ var isMounted = shouldUnmountWhenHidden ? isVisible : true;
34
+ var enterDelay = _typeof(delay) === 'object' ? delay.enter : delay;
35
+ var exitDelay = _typeof(delay) === 'object' ? delay.exit : delay;
36
+ var staggerVariants = {
37
+ initial: {},
38
+ animate: {
39
+ transition: _objectSpread(_objectSpread({}, enterDelay ? {
40
+ delayChildren: msToSeconds(theme.motion.delay[enterDelay])
41
+ } : {}), {}, {
42
+ staggerChildren: msToSeconds(theme.motion.duration['2xquick'])
43
+ })
44
+ },
45
+ exit: {
46
+ transition: _objectSpread(_objectSpread({}, exitDelay ? {
47
+ delayChildren: msToSeconds(theme.motion.delay[exitDelay])
48
+ } : {}), {}, {
49
+ staggerChildren: msToSeconds(theme.motion.duration['2xquick'])
50
+ })
51
+ }
52
+ };
53
+ return /*#__PURE__*/jsx(AnimateWrapper, {
54
+ children: isMounted ? /*#__PURE__*/jsx(BaseMotionBox, _objectSpread(_objectSpread(_objectSpread({
55
+ type: type,
56
+ motionVariants: staggerVariants,
57
+ motionTriggers: motionTriggers
58
+ }, shouldUnmountWhenHidden ? {} : {
59
+ animateVisibility: isVisible ? 'animate' : 'exit'
60
+ }), boxProps), {}, {
61
+ children: /*#__PURE__*/jsx(StaggerContext.Provider, {
62
+ value: {
63
+ isInsideStaggerContainer: true,
64
+ staggerType: type
65
+ },
66
+ children: children
67
+ })
68
+ })) : null
69
+ });
70
+ };
71
+
72
+ export { Stagger };
73
+ //# sourceMappingURL=Stagger.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stagger.web.js","sources":["../../../../../../src/components/Stagger/Stagger.web.tsx"],"sourcesContent":["import React from 'react';\nimport { AnimatePresence } from 'framer-motion';\nimport { StaggerContext } from './StaggerProvider';\nimport type { StaggerProps } from './types';\nimport { BaseMotionBox } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { useTheme } from '~utils';\n\n/**\n * ## Stagger\n *\n * Stagger is a utility motion preset we expose from blade to help you implement stagger animations.\n *\n * You can use any of the base entry / exit presets like `Fade`, `Move`, `Slide` inside of it and the components will appear one after the other instead of all at once.\n *\n * **Note:** Unlike other motion presets, Stagger is not an enhancer components and renders a Box instead. You can use BoxProps on this component.\n *\n * ### Usage\n *\n * #### Move with Stagger\n *\n * ```jsx\n * <Stagger>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * </Stagger>\n * ```\n *\n * #### Conditionally make the parent visible or invisible\n *\n * `isVisible` prop in this case should be on Stagger instead of children preset component\n *\n * ```jsx\n * <Stagger isVisible={isVisibleState}>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * </Stagger>\n * ```\n *\n */\nconst Stagger = ({\n children,\n isVisible = true,\n type = 'inout',\n shouldUnmountWhenHidden = false,\n delay,\n motionTriggers,\n ...boxProps\n}: StaggerProps): React.ReactElement => {\n const { theme } = useTheme();\n // Only need AnimatePresence when we have to unmount the component\n const AnimateWrapper = shouldUnmountWhenHidden ? AnimatePresence : React.Fragment;\n // keep it always mounted when shouldUnmountWhenHidden is false\n const isMounted = shouldUnmountWhenHidden ? isVisible : true;\n\n const enterDelay = typeof delay === 'object' ? delay.enter : delay;\n const exitDelay = typeof delay === 'object' ? delay.exit : delay;\n\n const staggerVariants: MotionVariantsType = {\n initial: {},\n animate: {\n transition: {\n ...(enterDelay ? { delayChildren: msToSeconds(theme.motion.delay[enterDelay]) } : {}),\n staggerChildren: msToSeconds(theme.motion.duration['2xquick']),\n },\n },\n exit: {\n transition: {\n ...(exitDelay ? { delayChildren: msToSeconds(theme.motion.delay[exitDelay]) } : {}),\n staggerChildren: msToSeconds(theme.motion.duration['2xquick']),\n },\n },\n };\n\n return (\n <AnimateWrapper>\n {isMounted ? (\n <BaseMotionBox\n type={type}\n motionVariants={staggerVariants}\n motionTriggers={motionTriggers}\n {...(shouldUnmountWhenHidden\n ? {}\n : { animateVisibility: isVisible ? 'animate' : 'exit' })}\n {...boxProps}\n >\n <StaggerContext.Provider value={{ isInsideStaggerContainer: true, staggerType: type }}>\n {children}\n </StaggerContext.Provider>\n </BaseMotionBox>\n ) : null}\n </AnimateWrapper>\n );\n};\n\nexport { Stagger };\n"],"names":["Stagger","_ref","children","_ref$isVisible","isVisible","_ref$type","type","_ref$shouldUnmountWhe","shouldUnmountWhenHidden","delay","motionTriggers","boxProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","AnimateWrapper","AnimatePresence","React","Fragment","isMounted","enterDelay","_typeof","enter","exitDelay","exit","staggerVariants","initial","animate","transition","_objectSpread","delayChildren","msToSeconds","motion","staggerChildren","duration","_jsx","BaseMotionBox","motionVariants","animateVisibility","StaggerContext","Provider","value","isInsideStaggerContainer","staggerType"],"mappings":";;;;;;;;;;;;;;;;AA2CA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAQ2B;AAAA,EAAA,IAPtCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,cAAA,GAAAF,IAAA,CACRG,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,cAAA;IAAAE,SAAA,GAAAJ,IAAA,CAChBK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KA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,IAAI,EAAE;AACJI,MAAAA,UAAU,EAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EACJN,SAAS,GAAG;QAAEO,aAAa,EAAEC,WAAW,CAACjB,KAAK,CAACkB,MAAM,CAACzB,KAAK,CAACgB,SAAS,CAAC,CAAA;OAAG,GAAG,EAAE,CAAA,EAAA,EAAA,EAAA;QAClFU,eAAe,EAAEF,WAAW,CAACjB,KAAK,CAACkB,MAAM,CAACE,QAAQ,CAAC,SAAS,CAAC,CAAA;AAAC,OAAA,CAAA;AAElE,KAAA;GACD,CAAA;EAED,oBACEC,GAAA,CAACpB,cAAc,EAAA;IAAAf,QAAA,EACZmB,SAAS,gBACRgB,GAAA,CAACC,aAAa,EAAAP,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACZzB,MAAAA,IAAI,EAAEA,IAAK;AACXiC,MAAAA,cAAc,EAAEZ,eAAgB;AAChCjB,MAAAA,cAAc,EAAEA,cAAAA;AAAe,KAAA,EAC1BF,uBAAuB,GACxB,EAAE,GACF;AAAEgC,MAAAA,iBAAiB,EAAEpC,SAAS,GAAG,SAAS,GAAG,MAAA;AAAO,KAAC,GACrDO,QAAQ,CAAA,EAAA,EAAA,EAAA;AAAAT,MAAAA,QAAA,eAEZmC,GAAA,CAACI,cAAc,CAACC,QAAQ,EAAA;AAACC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,wBAAwB,EAAE,IAAI;AAAEC,UAAAA,WAAW,EAAEvC,IAAAA;SAAO;AAAAJ,QAAAA,QAAA,EACnFA,QAAAA;OACsB,CAAA;AAAC,KAAA,CACb,CAAC,GACd,IAAA;AAAI,GACM,CAAC,CAAA;AAErB;;;;"}
@@ -0,0 +1,2 @@
1
+ export { Stagger } from './Stagger.web.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -2,6 +2,7 @@ import './Accordion/index.js';
2
2
  import './ActionList/index.js';
3
3
  import './Alert/index.js';
4
4
  import './Amount/index.js';
5
+ import './AnimateInteractions/index.js';
5
6
  import './Avatar/index.js';
6
7
  import './Badge/index.js';
7
8
  import './BladeProvider/index.js';
@@ -49,6 +50,7 @@ import './Skeleton/index.js';
49
50
  import './SkipNav/index.web.js';
50
51
  import './Spinner/index.js';
51
52
  import './SpotlightPopoverTour/index.js';
53
+ import './Stagger/index.js';
52
54
  import './StepGroup/index.js';
53
55
  import './Slide/index.js';
54
56
  import './Switch/index.js';
@@ -70,6 +72,7 @@ export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListIt
70
72
  export { ActionListItemAsset } from './ActionList/ActionListItemAsset.web.js';
71
73
  export { Alert } from './Alert/Alert.js';
72
74
  export { Amount } from './Amount/Amount.js';
75
+ export { AnimateInteractions } from './AnimateInteractions/AnimateInteractions.web.js';
73
76
  export { Avatar } from './Avatar/Avatar.web.js';
74
77
  export { AvatarGroup } from './Avatar/AvatarGroup.web.js';
75
78
  export { TrustedBadgeIcon } from './Avatar/TrustedBadgeIcon.web.js';
@@ -523,6 +526,7 @@ export { Spinner } from './Spinner/Spinner/Spinner.js';
523
526
  export { SpotlightPopoverTour } from './SpotlightPopoverTour/Tour.web.js';
524
527
  export { SpotlightPopoverTourFooter } from './SpotlightPopoverTour/TourFooter.web.js';
525
528
  export { SpotlightPopoverTourStep } from './SpotlightPopoverTour/TourStep.web.js';
529
+ export { Stagger } from './Stagger/Stagger.web.js';
526
530
  export { StepGroup } from './StepGroup/StepGroup.web.js';
527
531
  export { StepItem } from './StepGroup/StepItem.web.js';
528
532
  export { StepItemIcon, StepItemIndicator } from './StepGroup/StepItemMarker.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,37 @@
1
+ import React__default from 'react';
2
+ import { useAnimation } from 'framer-motion';
3
+ import { AnimateInteractionsContext } from './AnimateInteractionsProvider.js';
4
+ import { useFocusWithin } from './useFocusWithin.js';
5
+ import '../BaseMotion/index.js';
6
+ import { jsx } from 'react/jsx-runtime';
7
+ import { BaseMotionEnhancerBox } from '../BaseMotion/BaseMotion.js';
8
+
9
+ var AnimateInteractions = function AnimateInteractions(_ref) {
10
+ var children = _ref.children,
11
+ _ref$motionTriggers = _ref.motionTriggers,
12
+ motionTriggers = _ref$motionTriggers === void 0 ? ['hover'] : _ref$motionTriggers;
13
+ var baseMotionRef = React__default.useRef(null);
14
+ var controls = useAnimation();
15
+ useFocusWithin(baseMotionRef, {
16
+ onFocusWithin: function onFocusWithin() {
17
+ void controls.start('animate');
18
+ },
19
+ onBlurWithin: function onBlurWithin() {
20
+ void controls.start('exit');
21
+ }
22
+ });
23
+ return /*#__PURE__*/jsx(AnimateInteractionsContext.Provider, {
24
+ value: {
25
+ isInsideAnimateInteractionsContainer: true
26
+ },
27
+ children: /*#__PURE__*/jsx(BaseMotionEnhancerBox, {
28
+ ref: baseMotionRef,
29
+ motionTriggers: motionTriggers,
30
+ animate: controls,
31
+ children: children
32
+ })
33
+ });
34
+ };
35
+
36
+ export { AnimateInteractions };
37
+ //# sourceMappingURL=AnimateInteractions.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimateInteractions.web.js","sources":["../../../../../../src/components/AnimateInteractions/AnimateInteractions.web.tsx"],"sourcesContent":["import React from 'react';\nimport { useAnimation } from 'framer-motion';\nimport { AnimateInteractionsContext } from './AnimateInteractionsProvider';\nimport { useFocusWithin } from './useFocusWithin';\nimport type { AnimateInteractionsProps } from './types';\nimport { BaseMotionEnhancerBox } from '~components/BaseMotion';\n\n/**\n * ## AnimateInteractions\n *\n * AnimateInteractions is the utility preset that we offer to help you animate children when the parent is interacted.\n *\n * This is in a way equivalent to following CSS-\n * ```css\n * .parent:hover .child { }\n * ```\n *\n * ### Usage\n *\n * ```jsx\n * <AnimateInteractions\n * motionTriggers={['hover']}\n * > // <-- When this is hovered\n * <Box>\n * <Move\n * motionTriggers={['on-animate-interactions']}\n * > // <-- this animates in\n * <Box />\n * </Move>\n * </Box>\n * </AnimateInteractions>\n * ```\n */\nconst AnimateInteractions = ({\n children,\n motionTriggers = ['hover'],\n}: AnimateInteractionsProps): React.ReactElement => {\n const baseMotionRef = React.useRef<HTMLDivElement | null>(null);\n const controls = useAnimation();\n\n useFocusWithin(baseMotionRef, {\n onFocusWithin: () => {\n void controls.start('animate');\n },\n onBlurWithin: () => {\n void controls.start('exit');\n },\n });\n\n return (\n <AnimateInteractionsContext.Provider value={{ isInsideAnimateInteractionsContainer: true }}>\n <BaseMotionEnhancerBox ref={baseMotionRef} motionTriggers={motionTriggers} animate={controls}>\n {children}\n </BaseMotionEnhancerBox>\n </AnimateInteractionsContext.Provider>\n );\n};\n\nexport { AnimateInteractions };\n"],"names":["AnimateInteractions","_ref","children","_ref$motionTriggers","motionTriggers","baseMotionRef","React","useRef","controls","useAnimation","useFocusWithin","onFocusWithin","start","onBlurWithin","_jsx","AnimateInteractionsContext","Provider","value","isInsideAnimateInteractionsContainer","BaseMotionEnhancerBox","ref","animate"],"mappings":";;;;;;;;AAiCA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAG2B;AAAA,EAAA,IAFlDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,mBAAA,GAAAF,IAAA,CACRG,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,KAAA,CAAA,GAAG,CAAC,OAAO,CAAC,GAAAA,mBAAA,CAAA;AAE1B,EAAA,IAAME,aAAa,GAAGC,cAAK,CAACC,MAAM,CAAwB,IAAI,CAAC,CAAA;AAC/D,EAAA,IAAMC,QAAQ,GAAGC,YAAY,EAAE,CAAA;EAE/BC,cAAc,CAACL,aAAa,EAAE;IAC5BM,aAAa,EAAE,SAAAA,aAAAA,GAAM;AACnB,MAAA,KAAKH,QAAQ,CAACI,KAAK,CAAC,SAAS,CAAC,CAAA;KAC/B;IACDC,YAAY,EAAE,SAAAA,YAAAA,GAAM;AAClB,MAAA,KAAKL,QAAQ,CAACI,KAAK,CAAC,MAAM,CAAC,CAAA;AAC7B,KAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,oBACEE,GAAA,CAACC,0BAA0B,CAACC,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,oCAAoC,EAAE,IAAA;KAAO;IAAAhB,QAAA,eACzFY,GAAA,CAACK,qBAAqB,EAAA;AAACC,MAAAA,GAAG,EAAEf,aAAc;AAACD,MAAAA,cAAc,EAAEA,cAAe;AAACiB,MAAAA,OAAO,EAAEb,QAAS;AAAAN,MAAAA,QAAA,EAC1FA,QAAAA;KACoB,CAAA;AAAC,GACW,CAAC,CAAA;AAE1C;;;;"}
@@ -0,0 +1,2 @@
1
+ export { AnimateInteractions } from './AnimateInteractions.web.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { useEffect } from 'react';
2
+
3
+ var useFocusWithin = function useFocusWithin(ref, _ref) {
4
+ var onFocusWithin = _ref.onFocusWithin,
5
+ onBlurWithin = _ref.onBlurWithin;
6
+ useEffect(function () {
7
+ var element = ref.current;
8
+ if (!element) return;
9
+ var handleFocusIn = function handleFocusIn() {
10
+ onFocusWithin === null || onFocusWithin === void 0 ? void 0 : onFocusWithin();
11
+ };
12
+ var handleFocusOut = function handleFocusOut(event) {
13
+ // Ensure that focus is not still within the container
14
+ if (element && !element.contains(event.relatedTarget)) {
15
+ onBlurWithin === null || onBlurWithin === void 0 ? void 0 : onBlurWithin();
16
+ }
17
+ };
18
+ element.addEventListener('focusin', handleFocusIn);
19
+ element.addEventListener('focusout', handleFocusOut);
20
+
21
+ // eslint-disable-next-line consistent-return
22
+ return function () {
23
+ element.removeEventListener('focusin', handleFocusIn);
24
+ element.removeEventListener('focusout', handleFocusOut);
25
+ };
26
+ }, [ref, onFocusWithin, onBlurWithin]);
27
+ };
28
+
29
+ export { useFocusWithin };
30
+ //# sourceMappingURL=useFocusWithin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusWithin.js","sources":["../../../../../../src/components/AnimateInteractions/useFocusWithin.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype FocusWithinHandlers = {\n onFocusWithin?: () => void;\n onBlurWithin?: () => void;\n};\n\nexport const useFocusWithin = <T extends HTMLElement>(\n ref: React.RefObject<T>,\n { onFocusWithin, onBlurWithin }: FocusWithinHandlers,\n): void => {\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n\n const handleFocusIn = (): void => {\n onFocusWithin?.();\n };\n\n const handleFocusOut = (event: FocusEvent): void => {\n // Ensure that focus is not still within the container\n if (element && !element.contains(event.relatedTarget as Node)) {\n onBlurWithin?.();\n }\n };\n\n element.addEventListener('focusin', handleFocusIn);\n element.addEventListener('focusout', handleFocusOut);\n\n // eslint-disable-next-line consistent-return\n return () => {\n element.removeEventListener('focusin', handleFocusIn);\n element.removeEventListener('focusout', handleFocusOut);\n };\n }, [ref, onFocusWithin, onBlurWithin]);\n};\n"],"names":["useFocusWithin","ref","_ref","onFocusWithin","onBlurWithin","useEffect","element","current","handleFocusIn","handleFocusOut","event","contains","relatedTarget","addEventListener","removeEventListener"],"mappings":";;AAOO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACzBC,GAAuB,EAAAC,IAAA,EAEd;AAAA,EAAA,IADPC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY,CAAA;AAE7BC,EAAAA,SAAS,CAAC,YAAM;AACd,IAAA,IAAMC,OAAO,GAAGL,GAAG,CAACM,OAAO,CAAA;IAC3B,IAAI,CAACD,OAAO,EAAE,OAAA;AAEd,IAAA,IAAME,aAAa,GAAG,SAAhBA,aAAaA,GAAe;AAChCL,MAAAA,aAAa,KAAbA,IAAAA,IAAAA,aAAa,KAAbA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,aAAa,EAAI,CAAA;KAClB,CAAA;AAED,IAAA,IAAMM,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAiB,EAAW;AAClD;MACA,IAAIJ,OAAO,IAAI,CAACA,OAAO,CAACK,QAAQ,CAACD,KAAK,CAACE,aAAqB,CAAC,EAAE;AAC7DR,QAAAA,YAAY,KAAZA,IAAAA,IAAAA,YAAY,KAAZA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,YAAY,EAAI,CAAA;AAClB,OAAA;KACD,CAAA;AAEDE,IAAAA,OAAO,CAACO,gBAAgB,CAAC,SAAS,EAAEL,aAAa,CAAC,CAAA;AAClDF,IAAAA,OAAO,CAACO,gBAAgB,CAAC,UAAU,EAAEJ,cAAc,CAAC,CAAA;;AAEpD;AACA,IAAA,OAAO,YAAM;AACXH,MAAAA,OAAO,CAACQ,mBAAmB,CAAC,SAAS,EAAEN,aAAa,CAAC,CAAA;AACrDF,MAAAA,OAAO,CAACQ,mBAAmB,CAAC,UAAU,EAAEL,cAAc,CAAC,CAAA;KACxD,CAAA;GACF,EAAE,CAACR,GAAG,EAAEE,aAAa,EAAEC,YAAY,CAAC,CAAC,CAAA;AACxC;;;;"}
@@ -0,0 +1,73 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import _typeof from '@babel/runtime/helpers/typeof';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React__default from 'react';
5
+ import { AnimatePresence } from 'framer-motion';
6
+ import { StaggerContext } from './StaggerProvider.js';
7
+ import '../BaseMotion/index.js';
8
+ import { msToSeconds } from '../../utils/msToSeconds.js';
9
+ import '../../utils/index.js';
10
+ import { jsx } from 'react/jsx-runtime';
11
+ import useTheme from '../BladeProvider/useTheme.js';
12
+ import { BaseMotionBox } from '../BaseMotion/BaseMotion.js';
13
+
14
+ var _excluded = ["children", "isVisible", "type", "shouldUnmountWhenHidden", "delay", "motionTriggers"];
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ var Stagger = function Stagger(_ref) {
18
+ var children = _ref.children,
19
+ _ref$isVisible = _ref.isVisible,
20
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
21
+ _ref$type = _ref.type,
22
+ type = _ref$type === void 0 ? 'inout' : _ref$type,
23
+ _ref$shouldUnmountWhe = _ref.shouldUnmountWhenHidden,
24
+ shouldUnmountWhenHidden = _ref$shouldUnmountWhe === void 0 ? false : _ref$shouldUnmountWhe,
25
+ delay = _ref.delay,
26
+ motionTriggers = _ref.motionTriggers,
27
+ boxProps = _objectWithoutProperties(_ref, _excluded);
28
+ var _useTheme = useTheme(),
29
+ theme = _useTheme.theme;
30
+ // Only need AnimatePresence when we have to unmount the component
31
+ var AnimateWrapper = shouldUnmountWhenHidden ? AnimatePresence : React__default.Fragment;
32
+ // keep it always mounted when shouldUnmountWhenHidden is false
33
+ var isMounted = shouldUnmountWhenHidden ? isVisible : true;
34
+ var enterDelay = _typeof(delay) === 'object' ? delay.enter : delay;
35
+ var exitDelay = _typeof(delay) === 'object' ? delay.exit : delay;
36
+ var staggerVariants = {
37
+ initial: {},
38
+ animate: {
39
+ transition: _objectSpread(_objectSpread({}, enterDelay ? {
40
+ delayChildren: msToSeconds(theme.motion.delay[enterDelay])
41
+ } : {}), {}, {
42
+ staggerChildren: msToSeconds(theme.motion.duration['2xquick'])
43
+ })
44
+ },
45
+ exit: {
46
+ transition: _objectSpread(_objectSpread({}, exitDelay ? {
47
+ delayChildren: msToSeconds(theme.motion.delay[exitDelay])
48
+ } : {}), {}, {
49
+ staggerChildren: msToSeconds(theme.motion.duration['2xquick'])
50
+ })
51
+ }
52
+ };
53
+ return /*#__PURE__*/jsx(AnimateWrapper, {
54
+ children: isMounted ? /*#__PURE__*/jsx(BaseMotionBox, _objectSpread(_objectSpread(_objectSpread({
55
+ type: type,
56
+ motionVariants: staggerVariants,
57
+ motionTriggers: motionTriggers
58
+ }, shouldUnmountWhenHidden ? {} : {
59
+ animateVisibility: isVisible ? 'animate' : 'exit'
60
+ }), boxProps), {}, {
61
+ children: /*#__PURE__*/jsx(StaggerContext.Provider, {
62
+ value: {
63
+ isInsideStaggerContainer: true,
64
+ staggerType: type
65
+ },
66
+ children: children
67
+ })
68
+ })) : null
69
+ });
70
+ };
71
+
72
+ export { Stagger };
73
+ //# sourceMappingURL=Stagger.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stagger.web.js","sources":["../../../../../../src/components/Stagger/Stagger.web.tsx"],"sourcesContent":["import React from 'react';\nimport { AnimatePresence } from 'framer-motion';\nimport { StaggerContext } from './StaggerProvider';\nimport type { StaggerProps } from './types';\nimport { BaseMotionBox } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { useTheme } from '~utils';\n\n/**\n * ## Stagger\n *\n * Stagger is a utility motion preset we expose from blade to help you implement stagger animations.\n *\n * You can use any of the base entry / exit presets like `Fade`, `Move`, `Slide` inside of it and the components will appear one after the other instead of all at once.\n *\n * **Note:** Unlike other motion presets, Stagger is not an enhancer components and renders a Box instead. You can use BoxProps on this component.\n *\n * ### Usage\n *\n * #### Move with Stagger\n *\n * ```jsx\n * <Stagger>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * </Stagger>\n * ```\n *\n * #### Conditionally make the parent visible or invisible\n *\n * `isVisible` prop in this case should be on Stagger instead of children preset component\n *\n * ```jsx\n * <Stagger isVisible={isVisibleState}>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * <Move><Chip /></Move>\n * </Stagger>\n * ```\n *\n */\nconst Stagger = ({\n children,\n isVisible = true,\n type = 'inout',\n shouldUnmountWhenHidden = false,\n delay,\n motionTriggers,\n ...boxProps\n}: StaggerProps): React.ReactElement => {\n const { theme } = useTheme();\n // Only need AnimatePresence when we have to unmount the component\n const AnimateWrapper = shouldUnmountWhenHidden ? AnimatePresence : React.Fragment;\n // keep it always mounted when shouldUnmountWhenHidden is false\n const isMounted = shouldUnmountWhenHidden ? isVisible : true;\n\n const enterDelay = typeof delay === 'object' ? delay.enter : delay;\n const exitDelay = typeof delay === 'object' ? delay.exit : delay;\n\n const staggerVariants: MotionVariantsType = {\n initial: {},\n animate: {\n transition: {\n ...(enterDelay ? { delayChildren: msToSeconds(theme.motion.delay[enterDelay]) } : {}),\n staggerChildren: msToSeconds(theme.motion.duration['2xquick']),\n },\n },\n exit: {\n transition: {\n ...(exitDelay ? { delayChildren: msToSeconds(theme.motion.delay[exitDelay]) } : {}),\n staggerChildren: msToSeconds(theme.motion.duration['2xquick']),\n },\n },\n };\n\n return (\n <AnimateWrapper>\n {isMounted ? (\n <BaseMotionBox\n type={type}\n motionVariants={staggerVariants}\n motionTriggers={motionTriggers}\n {...(shouldUnmountWhenHidden\n ? {}\n : { animateVisibility: isVisible ? 'animate' : 'exit' })}\n {...boxProps}\n >\n <StaggerContext.Provider value={{ isInsideStaggerContainer: true, staggerType: type }}>\n {children}\n </StaggerContext.Provider>\n </BaseMotionBox>\n ) : null}\n </AnimateWrapper>\n );\n};\n\nexport { Stagger };\n"],"names":["Stagger","_ref","children","_ref$isVisible","isVisible","_ref$type","type","_ref$shouldUnmountWhe","shouldUnmountWhenHidden","delay","motionTriggers","boxProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","AnimateWrapper","AnimatePresence","React","Fragment","isMounted","enterDelay","_typeof","enter","exitDelay","exit","staggerVariants","initial","animate","transition","_objectSpread","delayChildren","msToSeconds","motion","staggerChildren","duration","_jsx","BaseMotionBox","motionVariants","animateVisibility","StaggerContext","Provider","value","isInsideStaggerContainer","staggerType"],"mappings":";;;;;;;;;;;;;;;;AA2CA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAQ2B;AAAA,EAAA,IAPtCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,cAAA,GAAAF,IAAA,CACRG,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,cAAA;IAAAE,SAAA,GAAAJ,IAAA,CAChBK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,SAAA;IAAAE,qBAAA,GAAAN,IAAA,CACdO,uBAAuB;AAAvBA,IAAAA,uBAAuB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;IAC/BE,KAAK,GAAAR,IAAA,CAALQ,KAAK;IACLC,cAAc,GAAAT,IAAA,CAAdS,cAAc;AACXC,IAAAA,QAAQ,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA,CAAA,CAAA;AAEX,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;AACb;EACA,IAAMC,cAAc,GAAGT,uBAAuB,GAAGU,eAAe,GAAGC,cAAK,CAACC,QAAQ,CAAA;AACjF;AACA,EAAA,IA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EA,IAAK;AACXiC,MAAAA,cAAc,EAAEZ,eAAgB;AAChCjB,MAAAA,cAAc,EAAEA,cAAAA;AAAe,KAAA,EAC1BF,uBAAuB,GACxB,EAAE,GACF;AAAEgC,MAAAA,iBAAiB,EAAEpC,SAAS,GAAG,SAAS,GAAG,MAAA;AAAO,KAAC,GACrDO,QAAQ,CAAA,EAAA,EAAA,EAAA;AAAAT,MAAAA,QAAA,eAEZmC,GAAA,CAACI,cAAc,CAACC,QAAQ,EAAA;AAACC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,wBAAwB,EAAE,IAAI;AAAEC,UAAAA,WAAW,EAAEvC,IAAAA;SAAO;AAAAJ,QAAAA,QAAA,EACnFA,QAAAA;OACsB,CAAA;AAAC,KAAA,CACb,CAAC,GACd,IAAA;AAAI,GACM,CAAC,CAAA;AAErB;;;;"}
@@ -0,0 +1,2 @@
1
+ export { Stagger } from './Stagger.web.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -2,6 +2,7 @@ import './Accordion/index.js';
2
2
  import './ActionList/index.js';
3
3
  import './Alert/index.js';
4
4
  import './Amount/index.js';
5
+ import './AnimateInteractions/index.js';
5
6
  import './Avatar/index.js';
6
7
  import './Badge/index.js';
7
8
  import './BladeProvider/index.js';
@@ -49,6 +50,7 @@ import './Skeleton/index.js';
49
50
  import './SkipNav/index.web.js';
50
51
  import './Spinner/index.js';
51
52
  import './SpotlightPopoverTour/index.js';
53
+ import './Stagger/index.js';
52
54
  import './StepGroup/index.js';
53
55
  import './Slide/index.js';
54
56
  import './Switch/index.js';
@@ -70,6 +72,7 @@ export { ActionListItem, ActionListItemAvatar, ActionListItemBadge, ActionListIt
70
72
  export { ActionListItemAsset } from './ActionList/ActionListItemAsset.web.js';
71
73
  export { Alert } from './Alert/Alert.js';
72
74
  export { Amount } from './Amount/Amount.js';
75
+ export { AnimateInteractions } from './AnimateInteractions/AnimateInteractions.web.js';
73
76
  export { Avatar } from './Avatar/Avatar.web.js';
74
77
  export { AvatarGroup } from './Avatar/AvatarGroup.web.js';
75
78
  export { TrustedBadgeIcon } from './Avatar/TrustedBadgeIcon.web.js';
@@ -523,6 +526,7 @@ export { Spinner } from './Spinner/Spinner/Spinner.js';
523
526
  export { SpotlightPopoverTour } from './SpotlightPopoverTour/Tour.web.js';
524
527
  export { SpotlightPopoverTourFooter } from './SpotlightPopoverTour/TourFooter.web.js';
525
528
  export { SpotlightPopoverTourStep } from './SpotlightPopoverTour/TourStep.web.js';
529
+ export { Stagger } from './Stagger/Stagger.web.js';
526
530
  export { StepGroup } from './StepGroup/StepGroup.web.js';
527
531
  export { StepItem } from './StepGroup/StepItem.web.js';
528
532
  export { StepItemIcon, StepItemIndicator } from './StepGroup/StepItemMarker.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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