@cdx-ui/components 0.0.1-beta.79 → 0.0.1-beta.80
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/lib/commonjs/animation/hooks/index.js +17 -0
- package/lib/commonjs/animation/hooks/index.js.map +1 -0
- package/lib/commonjs/animation/hooks/useCombinedAnimationDisabledState.js +50 -0
- package/lib/commonjs/animation/hooks/useCombinedAnimationDisabledState.js.map +1 -0
- package/lib/commonjs/animation/index.js +39 -0
- package/lib/commonjs/animation/index.js.map +1 -0
- package/lib/commonjs/animation/types.js +6 -0
- package/lib/commonjs/animation/types.js.map +1 -0
- package/lib/commonjs/animation/utils.js +223 -0
- package/lib/commonjs/animation/utils.js.map +1 -0
- package/lib/commonjs/components/CLAUDE.md +1 -1
- package/lib/commonjs/components/Card/index.js +45 -17
- package/lib/commonjs/components/Card/index.js.map +1 -1
- package/lib/commonjs/components/Toast/animation.js +329 -0
- package/lib/commonjs/components/Toast/animation.js.map +1 -0
- package/lib/commonjs/components/Toast/hooks.js +66 -0
- package/lib/commonjs/components/Toast/hooks.js.map +1 -0
- package/lib/commonjs/components/Toast/index.js +493 -0
- package/lib/commonjs/components/Toast/index.js.map +1 -0
- package/lib/commonjs/components/Toast/styles.js +141 -0
- package/lib/commonjs/components/Toast/styles.js.map +1 -0
- package/lib/commonjs/components/Toast/types.js +6 -0
- package/lib/commonjs/components/Toast/types.js.map +1 -0
- package/lib/commonjs/components/index.js +12 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +15 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/providers/animation-settings/index.js +31 -0
- package/lib/commonjs/providers/animation-settings/index.js.map +1 -0
- package/lib/commonjs/providers/animation-settings/provider.js +59 -0
- package/lib/commonjs/providers/animation-settings/provider.js.map +1 -0
- package/lib/commonjs/providers/animation-settings/types.js +6 -0
- package/lib/commonjs/providers/animation-settings/types.js.map +1 -0
- package/lib/commonjs/providers/forge-design/index.js +29 -0
- package/lib/commonjs/providers/forge-design/index.js.map +1 -0
- package/lib/commonjs/providers/forge-design/provider.js +71 -0
- package/lib/commonjs/providers/forge-design/provider.js.map +1 -0
- package/lib/commonjs/providers/forge-design/types.js +6 -0
- package/lib/commonjs/providers/forge-design/types.js.map +1 -0
- package/lib/commonjs/providers/text-component/index.js +28 -0
- package/lib/commonjs/providers/text-component/index.js.map +1 -0
- package/lib/commonjs/providers/text-component/provider.js +11 -0
- package/lib/commonjs/providers/text-component/provider.js.map +1 -0
- package/lib/commonjs/providers/text-component/types.js +6 -0
- package/lib/commonjs/providers/text-component/types.js.map +1 -0
- package/lib/commonjs/providers/toast/index.js +33 -0
- package/lib/commonjs/providers/toast/index.js.map +1 -0
- package/lib/commonjs/providers/toast/insets-container.js +160 -0
- package/lib/commonjs/providers/toast/insets-container.js.map +1 -0
- package/lib/commonjs/providers/toast/lifecycle.context.js +36 -0
- package/lib/commonjs/providers/toast/lifecycle.context.js.map +1 -0
- package/lib/commonjs/providers/toast/provider.js +508 -0
- package/lib/commonjs/providers/toast/provider.js.map +1 -0
- package/lib/commonjs/providers/toast/reducer.js +46 -0
- package/lib/commonjs/providers/toast/reducer.js.map +1 -0
- package/lib/commonjs/providers/toast/toast-config.context.js +29 -0
- package/lib/commonjs/providers/toast/toast-config.context.js.map +1 -0
- package/lib/commonjs/providers/toast/toast-item-renderer.js +43 -0
- package/lib/commonjs/providers/toast/toast-item-renderer.js.map +1 -0
- package/lib/commonjs/providers/toast/types.js +6 -0
- package/lib/commonjs/providers/toast/types.js.map +1 -0
- package/lib/module/animation/hooks/index.js +4 -0
- package/lib/module/animation/hooks/index.js.map +1 -0
- package/lib/module/animation/hooks/useCombinedAnimationDisabledState.js +47 -0
- package/lib/module/animation/hooks/useCombinedAnimationDisabledState.js.map +1 -0
- package/lib/module/animation/index.js +6 -0
- package/lib/module/animation/index.js.map +1 -0
- package/lib/module/animation/types.js +4 -0
- package/lib/module/animation/types.js.map +1 -0
- package/lib/module/animation/utils.js +212 -0
- package/lib/module/animation/utils.js.map +1 -0
- package/lib/module/components/CLAUDE.md +1 -1
- package/lib/module/components/Card/index.js +47 -19
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/Toast/animation.js +324 -0
- package/lib/module/components/Toast/animation.js.map +1 -0
- package/lib/module/components/Toast/hooks.js +61 -0
- package/lib/module/components/Toast/hooks.js.map +1 -0
- package/lib/module/components/Toast/index.js +487 -0
- package/lib/module/components/Toast/index.js.map +1 -0
- package/lib/module/components/Toast/styles.js +138 -0
- package/lib/module/components/Toast/styles.js.map +1 -0
- package/lib/module/components/Toast/types.js +4 -0
- package/lib/module/components/Toast/types.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/providers/animation-settings/index.js +4 -0
- package/lib/module/providers/animation-settings/index.js.map +1 -0
- package/lib/module/providers/animation-settings/provider.js +52 -0
- package/lib/module/providers/animation-settings/provider.js.map +1 -0
- package/lib/module/providers/animation-settings/types.js +4 -0
- package/lib/module/providers/animation-settings/types.js.map +1 -0
- package/lib/module/providers/forge-design/index.js +5 -0
- package/lib/module/providers/forge-design/index.js.map +1 -0
- package/lib/module/providers/forge-design/provider.js +66 -0
- package/lib/module/providers/forge-design/provider.js.map +1 -0
- package/lib/module/providers/forge-design/types.js +4 -0
- package/lib/module/providers/forge-design/types.js.map +1 -0
- package/lib/module/providers/text-component/index.js +5 -0
- package/lib/module/providers/text-component/index.js.map +1 -0
- package/lib/module/providers/text-component/provider.js +6 -0
- package/lib/module/providers/text-component/provider.js.map +1 -0
- package/lib/module/providers/text-component/types.js +4 -0
- package/lib/module/providers/text-component/types.js.map +1 -0
- package/lib/module/providers/toast/index.js +6 -0
- package/lib/module/providers/toast/index.js.map +1 -0
- package/lib/module/providers/toast/insets-container.js +156 -0
- package/lib/module/providers/toast/insets-container.js.map +1 -0
- package/lib/module/providers/toast/lifecycle.context.js +32 -0
- package/lib/module/providers/toast/lifecycle.context.js.map +1 -0
- package/lib/module/providers/toast/provider.js +503 -0
- package/lib/module/providers/toast/provider.js.map +1 -0
- package/lib/module/providers/toast/reducer.js +42 -0
- package/lib/module/providers/toast/reducer.js.map +1 -0
- package/lib/module/providers/toast/toast-config.context.js +25 -0
- package/lib/module/providers/toast/toast-config.context.js.map +1 -0
- package/lib/module/providers/toast/toast-item-renderer.js +39 -0
- package/lib/module/providers/toast/toast-item-renderer.js.map +1 -0
- package/lib/module/providers/toast/types.js +4 -0
- package/lib/module/providers/toast/types.js.map +1 -0
- package/lib/typescript/animation/hooks/index.d.ts +2 -0
- package/lib/typescript/animation/hooks/index.d.ts.map +1 -0
- package/lib/typescript/animation/hooks/useCombinedAnimationDisabledState.d.ts +22 -0
- package/lib/typescript/animation/hooks/useCombinedAnimationDisabledState.d.ts.map +1 -0
- package/lib/typescript/animation/index.d.ts +4 -0
- package/lib/typescript/animation/index.d.ts.map +1 -0
- package/lib/typescript/animation/types.d.ts +105 -0
- package/lib/typescript/animation/types.d.ts.map +1 -0
- package/lib/typescript/animation/utils.d.ts +120 -0
- package/lib/typescript/animation/utils.d.ts.map +1 -0
- package/lib/typescript/components/Card/index.d.ts +4 -0
- package/lib/typescript/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/components/Toast/animation.d.ts +21 -0
- package/lib/typescript/components/Toast/animation.d.ts.map +1 -0
- package/lib/typescript/components/Toast/hooks.d.ts +17 -0
- package/lib/typescript/components/Toast/hooks.d.ts.map +1 -0
- package/lib/typescript/components/Toast/index.d.ts +28 -0
- package/lib/typescript/components/Toast/index.d.ts.map +1 -0
- package/lib/typescript/components/Toast/styles.d.ts +73 -0
- package/lib/typescript/components/Toast/styles.d.ts.map +1 -0
- package/lib/typescript/components/Toast/types.d.ts +303 -0
- package/lib/typescript/components/Toast/types.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/providers/animation-settings/index.d.ts +3 -0
- package/lib/typescript/providers/animation-settings/index.d.ts.map +1 -0
- package/lib/typescript/providers/animation-settings/provider.d.ts +28 -0
- package/lib/typescript/providers/animation-settings/provider.d.ts.map +1 -0
- package/lib/typescript/providers/animation-settings/types.d.ts +35 -0
- package/lib/typescript/providers/animation-settings/types.d.ts.map +1 -0
- package/lib/typescript/providers/forge-design/index.d.ts +3 -0
- package/lib/typescript/providers/forge-design/index.d.ts.map +1 -0
- package/lib/typescript/providers/forge-design/provider.d.ts +24 -0
- package/lib/typescript/providers/forge-design/provider.d.ts.map +1 -0
- package/lib/typescript/providers/forge-design/types.d.ts +82 -0
- package/lib/typescript/providers/forge-design/types.d.ts.map +1 -0
- package/lib/typescript/providers/text-component/index.d.ts +3 -0
- package/lib/typescript/providers/text-component/index.d.ts.map +1 -0
- package/lib/typescript/providers/text-component/provider.d.ts +7 -0
- package/lib/typescript/providers/text-component/provider.d.ts.map +1 -0
- package/lib/typescript/providers/text-component/types.d.ts +51 -0
- package/lib/typescript/providers/text-component/types.d.ts.map +1 -0
- package/lib/typescript/providers/toast/index.d.ts +5 -0
- package/lib/typescript/providers/toast/index.d.ts.map +1 -0
- package/lib/typescript/providers/toast/insets-container.d.ts +72 -0
- package/lib/typescript/providers/toast/insets-container.d.ts.map +1 -0
- package/lib/typescript/providers/toast/lifecycle.context.d.ts +32 -0
- package/lib/typescript/providers/toast/lifecycle.context.d.ts.map +1 -0
- package/lib/typescript/providers/toast/provider.d.ts +32 -0
- package/lib/typescript/providers/toast/provider.d.ts.map +1 -0
- package/lib/typescript/providers/toast/reducer.d.ts +14 -0
- package/lib/typescript/providers/toast/reducer.d.ts.map +1 -0
- package/lib/typescript/providers/toast/toast-config.context.d.ts +20 -0
- package/lib/typescript/providers/toast/toast-config.context.d.ts.map +1 -0
- package/lib/typescript/providers/toast/toast-item-renderer.d.ts +7 -0
- package/lib/typescript/providers/toast/toast-item-renderer.d.ts.map +1 -0
- package/lib/typescript/providers/toast/types.d.ts +422 -0
- package/lib/typescript/providers/toast/types.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/animation/hooks/index.ts +1 -0
- package/src/animation/hooks/useCombinedAnimationDisabledState.ts +46 -0
- package/src/animation/index.ts +3 -0
- package/src/animation/types.ts +128 -0
- package/src/animation/utils.ts +249 -0
- package/src/components/CLAUDE.md +1 -1
- package/src/components/Card/index.tsx +58 -28
- package/src/components/Toast/animation.ts +387 -0
- package/src/components/Toast/hooks.ts +92 -0
- package/src/components/Toast/index.tsx +520 -0
- package/src/components/Toast/styles.ts +186 -0
- package/src/components/Toast/types.ts +332 -0
- package/src/components/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/providers/animation-settings/index.ts +11 -0
- package/src/providers/animation-settings/provider.tsx +54 -0
- package/src/providers/animation-settings/types.ts +37 -0
- package/src/providers/forge-design/index.ts +2 -0
- package/src/providers/forge-design/provider.tsx +61 -0
- package/src/providers/forge-design/types.ts +84 -0
- package/src/providers/text-component/index.ts +2 -0
- package/src/providers/text-component/provider.tsx +7 -0
- package/src/providers/text-component/types.ts +52 -0
- package/src/providers/toast/index.ts +4 -0
- package/src/providers/toast/insets-container.tsx +230 -0
- package/src/providers/toast/lifecycle.context.tsx +37 -0
- package/src/providers/toast/provider.tsx +567 -0
- package/src/providers/toast/reducer.ts +40 -0
- package/src/providers/toast/toast-config.context.ts +25 -0
- package/src/providers/toast/toast-item-renderer.tsx +40 -0
- package/src/providers/toast/types.ts +431 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToastItemRenderer = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Memoized toast item component to prevent unnecessary re-renders
|
|
10
|
+
* Only re-renders when the toast item itself changes
|
|
11
|
+
*/
|
|
12
|
+
const ToastItemRenderer = exports.ToastItemRenderer = /*#__PURE__*/(0, _react.memo)(({
|
|
13
|
+
toastItem,
|
|
14
|
+
show,
|
|
15
|
+
hide,
|
|
16
|
+
index,
|
|
17
|
+
total,
|
|
18
|
+
heights,
|
|
19
|
+
maxVisibleToasts
|
|
20
|
+
}) => {
|
|
21
|
+
if (typeof toastItem.component !== 'function') {
|
|
22
|
+
throw new Error('Toast component must be a function that receives ToastComponentProps');
|
|
23
|
+
}
|
|
24
|
+
const content = toastItem.component({
|
|
25
|
+
id: toastItem.id,
|
|
26
|
+
index,
|
|
27
|
+
total,
|
|
28
|
+
heights,
|
|
29
|
+
maxVisibleToasts,
|
|
30
|
+
show,
|
|
31
|
+
hide
|
|
32
|
+
});
|
|
33
|
+
return content;
|
|
34
|
+
}, (prevProps, nextProps) => {
|
|
35
|
+
// Only re-render if the toast ID, component reference, index, or
|
|
36
|
+
// pending-removal flag changed. `pendingRemoval` flips when the
|
|
37
|
+
// provider marks a toast closed on web so the Toast component can
|
|
38
|
+
// play its exit transition — the renderer must propagate that
|
|
39
|
+
// change even though the id and component reference are unchanged.
|
|
40
|
+
// show, hide, total, and heights are stable references.
|
|
41
|
+
return prevProps.toastItem.id === nextProps.toastItem.id && prevProps.toastItem.component === nextProps.toastItem.component && prevProps.toastItem.pendingRemoval === nextProps.toastItem.pendingRemoval && prevProps.index === nextProps.index;
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=toast-item-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","ToastItemRenderer","exports","memo","toastItem","show","hide","index","total","heights","maxVisibleToasts","component","Error","content","id","prevProps","nextProps","pendingRemoval"],"sourceRoot":"../../../../src","sources":["providers/toast/toast-item-renderer.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,gBAAG,IAAAE,WAAI,EACnC,CAAC;EAAEC,SAAS;EAAEC,IAAI;EAAEC,IAAI;EAAEC,KAAK;EAAEC,KAAK;EAAEC,OAAO;EAAEC;AAAyC,CAAC,KAAK;EAC9F,IAAI,OAAON,SAAS,CAACO,SAAS,KAAK,UAAU,EAAE;IAC7C,MAAM,IAAIC,KAAK,CAAC,sEAAsE,CAAC;EACzF;EAEA,MAAMC,OAAO,GAAGT,SAAS,CAACO,SAAS,CAAC;IAClCG,EAAE,EAAEV,SAAS,CAACU,EAAE;IAChBP,KAAK;IACLC,KAAK;IACLC,OAAO;IACPC,gBAAgB;IAChBL,IAAI;IACJC;EACF,CAAC,CAAC;EAEF,OAAOO,OAAO;AAChB,CAAC,EACD,CAACE,SAAS,EAAEC,SAAS,KAAK;EACxB;EACA;EACA;EACA;EACA;EACA;EACA,OACED,SAAS,CAACX,SAAS,CAACU,EAAE,KAAKE,SAAS,CAACZ,SAAS,CAACU,EAAE,IACjDC,SAAS,CAACX,SAAS,CAACO,SAAS,KAAKK,SAAS,CAACZ,SAAS,CAACO,SAAS,IAC/DI,SAAS,CAACX,SAAS,CAACa,cAAc,KAAKD,SAAS,CAACZ,SAAS,CAACa,cAAc,IACzEF,SAAS,CAACR,KAAK,KAAKS,SAAS,CAACT,KAAK;AAEvC,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["providers/toast/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["animation/hooks/index.ts"],"mappings":";;AAAA,cAAc,qCAAqC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useGlobalAnimationSettings, useAnimationSettings } from '../../providers/animation-settings';
|
|
4
|
+
import { getCombinedAnimationDisabledState, getRootAnimationState } from '../utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hook to combine global, parent, and own animation disabled states
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* This hook combines three sources of animation disabled state:
|
|
11
|
+
* 1. Global state from GlobalAnimationSettingsProvider
|
|
12
|
+
* 2. Parent state from AnimationSettingsContext (component tree cascading)
|
|
13
|
+
* 3. Own state from the component's animation prop
|
|
14
|
+
*
|
|
15
|
+
* Priority: Global > Parent > Own (global wins if enabled)
|
|
16
|
+
*
|
|
17
|
+
* @param animation - Root animation configuration for the component
|
|
18
|
+
* @returns Combined isAllAnimationsDisabled value
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const isAllAnimationsDisabled = useCombinedAnimationDisabledState(animation);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function useCombinedAnimationDisabledState(animation) {
|
|
26
|
+
// Get global animation disabled state
|
|
27
|
+
const {
|
|
28
|
+
globalIsAllAnimationsDisabled
|
|
29
|
+
} = useGlobalAnimationSettings();
|
|
30
|
+
|
|
31
|
+
// Read parent animation disabled state from global context
|
|
32
|
+
const parentAnimationSettingsContext = useAnimationSettings();
|
|
33
|
+
const parentIsAllAnimationsDisabled = parentAnimationSettingsContext?.isAllAnimationsDisabled;
|
|
34
|
+
|
|
35
|
+
// Get own animation disabled state
|
|
36
|
+
const {
|
|
37
|
+
isAllAnimationsDisabled: ownIsAllAnimationsDisabled
|
|
38
|
+
} = getRootAnimationState(animation);
|
|
39
|
+
|
|
40
|
+
// Combine global, parent, and own disable-all states (global > parent > own)
|
|
41
|
+
return getCombinedAnimationDisabledState({
|
|
42
|
+
globalIsAllAnimationsDisabled,
|
|
43
|
+
parentIsAllAnimationsDisabled,
|
|
44
|
+
ownIsAllAnimationsDisabled
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=useCombinedAnimationDisabledState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useGlobalAnimationSettings","useAnimationSettings","getCombinedAnimationDisabledState","getRootAnimationState","useCombinedAnimationDisabledState","animation","globalIsAllAnimationsDisabled","parentAnimationSettingsContext","parentIsAllAnimationsDisabled","isAllAnimationsDisabled","ownIsAllAnimationsDisabled"],"sourceRoot":"../../../../src","sources":["animation/hooks/useCombinedAnimationDisabledState.ts"],"mappings":";;AAAA,SACEA,0BAA0B,EAC1BC,oBAAoB,QACf,oCAAoC;AAE3C,SAASC,iCAAiC,EAAEC,qBAAqB,QAAQ,UAAU;;AAEnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iCAAiCA,CAC/CC,SAA6C,EACpC;EACT;EACA,MAAM;IAAEC;EAA8B,CAAC,GAAGN,0BAA0B,CAAC,CAAC;;EAEtE;EACA,MAAMO,8BAA8B,GAAGN,oBAAoB,CAAC,CAAC;EAC7D,MAAMO,6BAA6B,GAAGD,8BAA8B,EAAEE,uBAAuB;;EAE7F;EACA,MAAM;IAAEA,uBAAuB,EAAEC;EAA2B,CAAC,GAAGP,qBAAqB,CAACE,SAAS,CAAC;;EAEhG;EACA,OAAOH,iCAAiC,CAAC;IACvCI,6BAA6B;IAC7BE,6BAA6B;IAC7BE;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["animation/index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["animation/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if the entire animation is disabled
|
|
5
|
+
* @param animation - Animation configuration
|
|
6
|
+
* @returns true if animation is disabled
|
|
7
|
+
*/
|
|
8
|
+
export function isAnimationDisabled(animation) {
|
|
9
|
+
// Check top-level disabled values
|
|
10
|
+
if (animation === false || animation === 'disabled') {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Check state property in config objects
|
|
15
|
+
if (typeof animation === 'object' && animation !== null && 'state' in animation) {
|
|
16
|
+
const state = animation.state;
|
|
17
|
+
return state === false || state === 'disabled';
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Check if root animation should cascade disable to all children
|
|
24
|
+
* @param animation - Root animation configuration
|
|
25
|
+
* @returns true if all animations should be disabled (including children)
|
|
26
|
+
*/
|
|
27
|
+
export function shouldDisableAll(animation) {
|
|
28
|
+
// Check top-level disable-all value
|
|
29
|
+
if (animation === 'disable-all') {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check state property in config objects
|
|
34
|
+
if (typeof animation === 'object' && animation !== null && 'state' in animation) {
|
|
35
|
+
const state = animation.state;
|
|
36
|
+
return state === 'disable-all';
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get animation state including config and disabled status
|
|
43
|
+
* @param animation - Animation configuration
|
|
44
|
+
* @returns Object with animationConfig and isAnimationDisabled
|
|
45
|
+
*/
|
|
46
|
+
export function getAnimationState(animation) {
|
|
47
|
+
const isDisabled = isAnimationDisabled(animation);
|
|
48
|
+
// Always extract config when it's an object, regardless of disabled state
|
|
49
|
+
// This allows users to customize colors/properties even when animations are disabled
|
|
50
|
+
const config = typeof animation === 'object' && animation !== null ? animation : undefined;
|
|
51
|
+
return {
|
|
52
|
+
animationConfig: config,
|
|
53
|
+
isAnimationDisabled: isDisabled
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get root animation state including config, disabled status, and cascade flag
|
|
59
|
+
* @param animation - Root animation configuration
|
|
60
|
+
* @returns Object with animationConfig, isAnimationDisabled, and isAllAnimationsDisabled
|
|
61
|
+
*/
|
|
62
|
+
export function getRootAnimationState(animation) {
|
|
63
|
+
const shouldCascade = shouldDisableAll(animation);
|
|
64
|
+
const isDisabled = isAnimationDisabled(animation) || shouldCascade;
|
|
65
|
+
// Always extract config when it's an object, regardless of disabled state
|
|
66
|
+
// This allows users to customize colors/properties even when animations are disabled
|
|
67
|
+
const config = typeof animation === 'object' && animation !== null ? animation : undefined;
|
|
68
|
+
return {
|
|
69
|
+
animationConfig: config,
|
|
70
|
+
isAnimationDisabled: isDisabled,
|
|
71
|
+
isAllAnimationsDisabled: shouldCascade
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get animation value property or return default
|
|
77
|
+
* Extracts a property from the animation value config object
|
|
78
|
+
*
|
|
79
|
+
* @param options - Object containing animationValue, property, and defaultValue
|
|
80
|
+
* @param options.animationValue - The animation value configuration
|
|
81
|
+
* @param options.property - Property name to extract
|
|
82
|
+
* @param options.defaultValue - Default value if property is not found
|
|
83
|
+
* @returns The property value or default (never undefined)
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* const scaleValue = getAnimationValueProperty({
|
|
87
|
+
* animationValue: animation?.scale,
|
|
88
|
+
* property: 'value',
|
|
89
|
+
* defaultValue: 0.95
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
92
|
+
export function getAnimationValueProperty(options) {
|
|
93
|
+
// If animation value is undefined, return default
|
|
94
|
+
if (options.animationValue === undefined) {
|
|
95
|
+
return options.defaultValue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Return the property value if it exists, otherwise return default
|
|
99
|
+
return options.animationValue[options.property] ?? options.defaultValue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get animation value merged config or return default
|
|
104
|
+
* Merges the animation value config with defaults, useful when you need multiple properties
|
|
105
|
+
*
|
|
106
|
+
* @param options - Object containing animationValue, property, and defaultValue
|
|
107
|
+
* @param options.animationValue - The animation value configuration
|
|
108
|
+
* @param options.property - Property name to extract from the config
|
|
109
|
+
* @param options.defaultValue - Default configuration object
|
|
110
|
+
* @returns The merged config object or default
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* const scaleConfig = getAnimationValueMergedConfig({
|
|
114
|
+
* animationValue: animation?.scale,
|
|
115
|
+
* property: 'timingConfig',
|
|
116
|
+
* defaultValue: { duration: 150 }
|
|
117
|
+
* });
|
|
118
|
+
*/
|
|
119
|
+
export function getAnimationValueMergedConfig(options) {
|
|
120
|
+
// If animation value is undefined, return default
|
|
121
|
+
if (options.animationValue === undefined) {
|
|
122
|
+
return options.defaultValue;
|
|
123
|
+
}
|
|
124
|
+
const value = options.animationValue[options.property];
|
|
125
|
+
|
|
126
|
+
// If the specific property value is undefined or not an object, return default
|
|
127
|
+
if (value === undefined || typeof value !== 'object') {
|
|
128
|
+
return options.defaultValue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Merge with defaults to ensure all properties exist
|
|
132
|
+
return {
|
|
133
|
+
...options.defaultValue,
|
|
134
|
+
...value
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Determine if animations should be disabled based on disabled flags
|
|
140
|
+
* Priority: isAllAnimationsDisabled > isAnimationDisabled
|
|
141
|
+
*
|
|
142
|
+
* @param options - Object containing isAnimationDisabled and isAllAnimationsDisabled
|
|
143
|
+
* @param options.isAnimationDisabled - Whether animation is explicitly disabled
|
|
144
|
+
* @param options.isAllAnimationsDisabled - Whether all animations should be disabled (cascading from root/global)
|
|
145
|
+
* @returns true if animations should be disabled, false otherwise
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const isDisabled = getIsAnimationDisabledValue({
|
|
149
|
+
* isAnimationDisabled: false,
|
|
150
|
+
* isAllAnimationsDisabled: true
|
|
151
|
+
* });
|
|
152
|
+
* // Returns: true (all animations disabled takes priority)
|
|
153
|
+
*/
|
|
154
|
+
export function getIsAnimationDisabledValue(options) {
|
|
155
|
+
const {
|
|
156
|
+
isAnimationDisabled: isDisabled,
|
|
157
|
+
isAllAnimationsDisabled
|
|
158
|
+
} = options;
|
|
159
|
+
|
|
160
|
+
// First priority: if all animations are disabled, return true
|
|
161
|
+
if (isAllAnimationsDisabled === true) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Second priority: if this animation is disabled, return true
|
|
166
|
+
if (isDisabled) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Default: animations are enabled
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Combine global, parent, and own animation disabled states
|
|
176
|
+
* Priority: Global > Parent > Own (global wins if enabled)
|
|
177
|
+
*
|
|
178
|
+
* @param options - Object containing globalIsAllAnimationsDisabled, parentIsAllAnimationsDisabled, and ownIsAllAnimationsDisabled
|
|
179
|
+
* @param options.globalIsAllAnimationsDisabled - Whether global provider has disable-all (from GlobalAnimationSettingsProvider)
|
|
180
|
+
* @param options.parentIsAllAnimationsDisabled - Whether parent context has disable-all (from AnimationSettingsContext)
|
|
181
|
+
* @param options.ownIsAllAnimationsDisabled - Whether own animation prop has disable-all
|
|
182
|
+
* @returns Combined isAllAnimationsDisabled value (global || parent || own)
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* const combined = getCombinedAnimationDisabledState({
|
|
186
|
+
* globalIsAllAnimationsDisabled: true,
|
|
187
|
+
* parentIsAllAnimationsDisabled: false,
|
|
188
|
+
* ownIsAllAnimationsDisabled: false
|
|
189
|
+
* });
|
|
190
|
+
* // Returns: true (global wins)
|
|
191
|
+
*/
|
|
192
|
+
export function getCombinedAnimationDisabledState(options) {
|
|
193
|
+
const {
|
|
194
|
+
globalIsAllAnimationsDisabled,
|
|
195
|
+
parentIsAllAnimationsDisabled,
|
|
196
|
+
ownIsAllAnimationsDisabled
|
|
197
|
+
} = options;
|
|
198
|
+
|
|
199
|
+
// Global always wins if it has disable-all
|
|
200
|
+
if (globalIsAllAnimationsDisabled === true) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Parent wins if it has disable-all
|
|
205
|
+
if (parentIsAllAnimationsDisabled === true) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Otherwise use own value
|
|
210
|
+
return ownIsAllAnimationsDisabled;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isAnimationDisabled","animation","state","shouldDisableAll","getAnimationState","isDisabled","config","undefined","animationConfig","getRootAnimationState","shouldCascade","isAllAnimationsDisabled","getAnimationValueProperty","options","animationValue","defaultValue","property","getAnimationValueMergedConfig","value","getIsAnimationDisabledValue","getCombinedAnimationDisabledState","globalIsAllAnimationsDisabled","parentIsAllAnimationsDisabled","ownIsAllAnimationsDisabled"],"sourceRoot":"../../../src","sources":["animation/utils.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CACjCC,SAAkE,EACzD;EACT;EACA,IAAIA,SAAS,KAAK,KAAK,IAAIA,SAAS,KAAK,UAAU,EAAE;IACnD,OAAO,IAAI;EACb;;EAEA;EACA,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAIA,SAAS,KAAK,IAAI,IAAI,OAAO,IAAIA,SAAS,EAAE;IAC/E,MAAMC,KAAK,GAAGD,SAAS,CAACC,KAAK;IAC7B,OAAOA,KAAK,KAAK,KAAK,IAAIA,KAAK,KAAK,UA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C7BC;EACF,CAAC,GAAGV,OAAO;;EAEX;EACA,IAAIQ,6BAA6B,KAAK,IAAI,EAAE;IAC1C,OAAO,IAAI;EACb;;EAEA;EACA,IAAIC,6BAA6B,KAAK,IAAI,EAAE;IAC1C,OAAO,IAAI;EACb;;EAEA;EACA,OAAOC,0BAA0B;AACnC","ignoreList":[]}
|
|
@@ -120,7 +120,7 @@ Where: **styled layer.** Pure styling hint with no behavior or a11y semantics
|
|
|
120
120
|
Each component follows this structure (see `Button/index.tsx`):
|
|
121
121
|
|
|
122
122
|
1. **Imports** — RN base components, primitive `Root` and `Slot` from `@cdx-ui/primitives`, `cn` + style context from `@cdx-ui/utils`, variant functions from `./styles`
|
|
123
|
-
2. **Scope constant** — `const SCOPE = 'COMPONENT_NAME'` for `
|
|
123
|
+
2. **Scope constant** — `const SCOPE = 'COMPONENT_NAME'` for `useStyleContext` with a `ParentContext.Provider` wrapper for static variant context
|
|
124
124
|
3. **Root component** — renders the primitive Root (or a host element directly when no primitive exists), spreads `dataAttributes({ slot: '<component>' })`
|
|
125
125
|
4. **Sub-slots** — each accepts `asChild`, renders a host element via `const Comp = asChild ? Slot : DefaultElement`, spreads `dataAttributes({ slot: '<component>-<slot>' })`. Sub-slots **do not** call `useButtonContext()` (or its equivalent) unless their own styling reacts to interaction state.
|
|
126
126
|
5. **Position-aware sub-slots** — icon/spinner-style slots accept `position?: 'leading' | 'trailing'` and emit `data-icon` via `dataAttributes({ icon: '...' })`.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
4
|
import { View } from 'react-native';
|
|
5
|
-
import {
|
|
5
|
+
import { Slot, dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn, ParentContext, useParentContext, useStyleContext } from '@cdx-ui/utils';
|
|
6
7
|
import { cardContentVariants, cardFooterVariants, cardHeaderVariants, cardRootVariants } from './styles';
|
|
7
8
|
|
|
8
9
|
// =============================================================================
|
|
@@ -10,25 +11,36 @@ import { cardContentVariants, cardFooterVariants, cardHeaderVariants, cardRootVa
|
|
|
10
11
|
// =============================================================================
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const SCOPE = 'CARD';
|
|
13
|
-
const Root = withStyleContext(View, SCOPE);
|
|
14
14
|
const useCardStyleContext = () => useStyleContext(SCOPE);
|
|
15
15
|
const CardRoot = /*#__PURE__*/forwardRef(({
|
|
16
|
+
asChild,
|
|
16
17
|
className,
|
|
17
18
|
children,
|
|
18
19
|
style,
|
|
19
20
|
fullBleed,
|
|
20
21
|
...props
|
|
21
22
|
}, ref) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
style: style,
|
|
27
|
-
context: {
|
|
23
|
+
const parent = useParentContext();
|
|
24
|
+
const ctx = useMemo(() => ({
|
|
25
|
+
...parent,
|
|
26
|
+
[SCOPE]: {
|
|
28
27
|
fullBleed
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
}
|
|
29
|
+
}), [parent, fullBleed]);
|
|
30
|
+
const computedClassName = cn(cardRootVariants(), className);
|
|
31
|
+
const Comp = asChild ? Slot : View;
|
|
32
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
33
|
+
value: ctx,
|
|
34
|
+
children: /*#__PURE__*/_jsx(Comp, {
|
|
35
|
+
ref: ref,
|
|
36
|
+
className: computedClassName,
|
|
37
|
+
style: style,
|
|
38
|
+
...props,
|
|
39
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
40
|
+
slot: 'card'
|
|
41
|
+
})),
|
|
42
|
+
children: children
|
|
43
|
+
})
|
|
32
44
|
});
|
|
33
45
|
});
|
|
34
46
|
CardRoot.displayName = 'Card';
|
|
@@ -38,17 +50,22 @@ CardRoot.displayName = 'Card';
|
|
|
38
50
|
// =============================================================================
|
|
39
51
|
|
|
40
52
|
const CardHeader = /*#__PURE__*/forwardRef(({
|
|
53
|
+
asChild,
|
|
41
54
|
className,
|
|
42
55
|
children,
|
|
43
56
|
style,
|
|
44
57
|
...props
|
|
45
58
|
}, ref) => {
|
|
46
59
|
const computedClassName = cn(cardHeaderVariants(), className);
|
|
47
|
-
|
|
60
|
+
const Comp = asChild ? Slot : View;
|
|
61
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
48
62
|
ref: ref,
|
|
49
63
|
className: computedClassName,
|
|
50
64
|
style: style,
|
|
51
65
|
...props,
|
|
66
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
67
|
+
slot: 'card-header'
|
|
68
|
+
})),
|
|
52
69
|
children: children
|
|
53
70
|
});
|
|
54
71
|
});
|
|
@@ -59,6 +76,7 @@ CardHeader.displayName = 'Card.Header';
|
|
|
59
76
|
// =============================================================================
|
|
60
77
|
|
|
61
78
|
const CardContent = /*#__PURE__*/forwardRef(({
|
|
79
|
+
asChild,
|
|
62
80
|
className,
|
|
63
81
|
children,
|
|
64
82
|
style,
|
|
@@ -71,11 +89,15 @@ const CardContent = /*#__PURE__*/forwardRef(({
|
|
|
71
89
|
const computedClassName = cn(cardContentVariants({
|
|
72
90
|
fullBleed: fullBleed ?? fullBleedFromContext
|
|
73
91
|
}), className);
|
|
74
|
-
|
|
92
|
+
const Comp = asChild ? Slot : View;
|
|
93
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
75
94
|
ref: ref,
|
|
76
95
|
className: computedClassName,
|
|
77
96
|
style: style,
|
|
78
97
|
...props,
|
|
98
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
99
|
+
slot: 'card-content'
|
|
100
|
+
})),
|
|
79
101
|
children: children
|
|
80
102
|
});
|
|
81
103
|
});
|
|
@@ -86,6 +108,7 @@ CardContent.displayName = 'Card.Content';
|
|
|
86
108
|
// =============================================================================
|
|
87
109
|
|
|
88
110
|
const CardFooter = /*#__PURE__*/forwardRef(({
|
|
111
|
+
asChild,
|
|
89
112
|
className,
|
|
90
113
|
children,
|
|
91
114
|
style,
|
|
@@ -98,11 +121,15 @@ const CardFooter = /*#__PURE__*/forwardRef(({
|
|
|
98
121
|
const computedClassName = cn(cardFooterVariants({
|
|
99
122
|
fullBleed: fullBleed ?? fullBleedFromContext
|
|
100
123
|
}), className);
|
|
101
|
-
|
|
124
|
+
const Comp = asChild ? Slot : View;
|
|
125
|
+
return /*#__PURE__*/_jsx(Comp, {
|
|
102
126
|
ref: ref,
|
|
103
127
|
className: computedClassName,
|
|
104
128
|
style: style,
|
|
105
129
|
...props,
|
|
130
|
+
...mergeDataAttributes(props, dataAttributes({
|
|
131
|
+
slot: 'card-footer'
|
|
132
|
+
})),
|
|
106
133
|
children: children
|
|
107
134
|
});
|
|
108
135
|
});
|
|
@@ -112,8 +139,9 @@ CardFooter.displayName = 'Card.Footer';
|
|
|
112
139
|
// COMPOUND COMPONENT
|
|
113
140
|
// =============================================================================
|
|
114
141
|
|
|
115
|
-
export const Card = CardRoot
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
142
|
+
export const Card = Object.assign(CardRoot, {
|
|
143
|
+
Header: CardHeader,
|
|
144
|
+
Content: CardContent,
|
|
145
|
+
Footer: CardFooter
|
|
146
|
+
});
|
|
119
147
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","View","cn","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","View","Slot","dataAttributes","mergeDataAttributes","cn","ParentContext","useParentContext","useStyleContext","cardContentVariants","cardFooterVariants","cardHeaderVariants","cardRootVariants","jsx","_jsx","SCOPE","useCardStyleContext","CardRoot","asChild","className","children","style","fullBleed","props","ref","parent","ctx","computedClassName","Comp","Provider","value","slot","displayName","CardHeader","CardContent","fullBleedFromContext","CardFooter","Card","Object","assign","Header","Content","Footer"],"sourceRoot":"../../../../src","sources":["components/Card/index.tsx"],"mappings":";;AAAA,SAASA,UAA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