@cdx-ui/primitives 0.3.2 → 0.3.3
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/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/insight/InsightRoot.js +159 -0
- package/lib/commonjs/insight/InsightRoot.js.map +1 -0
- package/lib/commonjs/insight/context.js +11 -0
- package/lib/commonjs/insight/context.js.map +1 -0
- package/lib/commonjs/insight/index.js +26 -0
- package/lib/commonjs/insight/index.js.map +1 -0
- package/lib/commonjs/insight/types.js +6 -0
- package/lib/commonjs/insight/types.js.map +1 -0
- package/lib/commonjs/list-item/ListItemRoot.js +2 -18
- package/lib/commonjs/list-item/ListItemRoot.js.map +1 -1
- package/lib/commonjs/utils/splitContainerProps.js +26 -0
- package/lib/commonjs/utils/splitContainerProps.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/insight/InsightRoot.js +154 -0
- package/lib/module/insight/InsightRoot.js.map +1 -0
- package/lib/module/insight/context.js +5 -0
- package/lib/module/insight/context.js.map +1 -0
- package/lib/module/insight/index.js +5 -0
- package/lib/module/insight/index.js.map +1 -0
- package/lib/module/insight/types.js +4 -0
- package/lib/module/insight/types.js.map +1 -0
- package/lib/module/list-item/ListItemRoot.js +1 -17
- package/lib/module/list-item/ListItemRoot.js.map +1 -1
- package/lib/module/utils/splitContainerProps.js +22 -0
- package/lib/module/utils/splitContainerProps.js.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/insight/InsightRoot.d.ts +6 -0
- package/lib/typescript/insight/InsightRoot.d.ts.map +1 -0
- package/lib/typescript/insight/context.d.ts +6 -0
- package/lib/typescript/insight/context.d.ts.map +1 -0
- package/lib/typescript/insight/index.d.ts +4 -0
- package/lib/typescript/insight/index.d.ts.map +1 -0
- package/lib/typescript/insight/types.d.ts +44 -0
- package/lib/typescript/insight/types.d.ts.map +1 -0
- package/lib/typescript/list-item/ListItemRoot.d.ts.map +1 -1
- package/lib/typescript/utils/splitContainerProps.d.ts +9 -0
- package/lib/typescript/utils/splitContainerProps.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/insight/InsightRoot.tsx +162 -0
- package/src/insight/context.tsx +5 -0
- package/src/insight/index.ts +11 -0
- package/src/insight/types.ts +51 -0
- package/src/list-item/ListItemRoot.tsx +1 -14
- package/src/utils/splitContainerProps.ts +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useMemo","Pressable","View","composeEventHandlers","useFocus","useFocusRing","useHover","usePress","Slot","dataAttributes","mergeDataAttributes","splitContainerProps","InsightProvider","jsx","_jsx","jsxs","_jsxs","InsightRoot","props","ref","layout","asChild","children","onPress","isDisabled","accessory","pressableClassName","style","role","onPressIn","onPressInProp","onPressOut","onPressOutProp","onHoverIn","onHoverInProp","onHoverOut","onHoverOutProp","restProps","isPressable","asChildElement","isValidElement","isSplit","pressState","isPressed","pressProps","hoverProps","isHovered","isFocused","focusProps","isFocusVisible","focusRingProps","contextValue","interactionAttributes","active","hover","focus","focusVisible","disabled","undefined","onFocus","onFocusProp","onBlur","onBlurProp","accessibilityState","accessibilityStateProp","pressRegionProps","container","region","regionProps","className","RegionComp","value","Comp","displayName"],"sourceRoot":"../../../src","sources":["insight/InsightRoot.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAA2B,OAAO;AACrE,SAASC,SAAS,EAAEC,IAAI,QAA6C,cAAc;AACnF,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,QAAQ,EAAEC,YAAY,QAAQ,0BAA0B;AACjE,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,iCAAiC;AACpE,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,yBAAyB;AAC7E,S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AuB;QAC5BQ,KAAK,EAAEA,KAAM;QAAA,GACTjB,mBAAmB,CAAC2B,SAAS,EAAEe,qBAAqB,CAAC;QAAA9B,QAAA,EAExDA;MAAQ,CACL;IAAC,CACQ,CAAC;EAEtB;EAEA,IAAIiB,cAAc,EAAE;IAClB,oBACEzB,IAAA,CAACF,eAAe;MAAC2D,KAAK,EAAEpB,YAAa;MAAA7B,QAAA,eACnCR,IAAA,CAACN,IAAI;QAAA,GAAM6B,SAAS;QAAgBlB,GAAG,EAAEA,GAAuB;QAACQ,KAAK,EAAEA,KAAM;QAACC,IAAI,EAAEA,IAAK;QAAAN,QAAA,EACvFA;MAAQ,CACL;IAAC,CACQ,CAAC;EAEtB;EAEA,oBACER,IAAA,CAACF,eAAe;IAAC2D,KAAK,EAAEpB,YAAa;IAAA7B,QAAA,eACnCN,KAAA,CAACd,IAAI;MAAA,GAAMmC,SAAS;MAAgBlB,GAAG,EAAEA,GAAI;MAACQ,KAAK,EAAEA,KAAM;MAACC,IAAI,EAAEA,IAAK;MAAAN,QAAA,GACpEA,QAAQ,EACRG,SAAS;IAAA,CACN;EAAC,CACQ,CAAC;AAEtB,CAAC,CAAC;AAEFR,WAAW,CAACwD,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","InsightProvider","useInsightContext"],"sourceRoot":"../../../src","sources":["insight/context.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,eAAe;AAG7C,OAAO,MAAM,CAACC,eAAe,EAAEC,iBAAiB,CAAC,GAC/CF,aAAa,CAAuB,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InsightProvider","useInsightContext","InsightRoot"],"sourceRoot":"../../../src","sources":["insight/index.ts"],"mappings":";;AASA,SAASA,eAAe,EAAEC,iBAAiB,QAAQ,WAAW;AAC9D,SAASC,WAAW,QAA+B,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["insight/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ import { useFocus, useFocusRing } from '@react-native-aria/focus';
|
|
|
7
7
|
import { useHover, usePress } from '@react-native-aria/interactions';
|
|
8
8
|
import { Slot } from '../slot';
|
|
9
9
|
import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
|
|
10
|
+
import { splitContainerProps } from '../utils/splitContainerProps';
|
|
10
11
|
import { ListItemProvider } from './context';
|
|
11
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
function rowStyleForCrossAlign(crossAlign) {
|
|
@@ -16,23 +17,6 @@ function rowStyleForCrossAlign(crossAlign) {
|
|
|
16
17
|
alignItems: crossAlign === 'start' ? 'flex-start' : 'center'
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
/** Splits the props a split row's container keeps (`className`, data attributes) from the rest. */
|
|
21
|
-
function splitContainerProps(props) {
|
|
22
|
-
const container = {};
|
|
23
|
-
const region = {};
|
|
24
|
-
for (const key in props) {
|
|
25
|
-
if (key === 'className' || key === 'dataSet' || key.startsWith('data-')) {
|
|
26
|
-
container[key] = props[key];
|
|
27
|
-
} else {
|
|
28
|
-
region[key] = props[key];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
container,
|
|
33
|
-
region
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
20
|
export const ListItemRoot = /*#__PURE__*/forwardRef(({
|
|
37
21
|
asChild = false,
|
|
38
22
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useMemo","Pressable","View","composeEventHandlers","useFocus","useFocusRing","useHover","usePress","Slot","dataAttributes","mergeDataAttributes","ListItemProvider","jsx","_jsx","jsxs","_jsxs","rowStyleForCrossAlign","crossAlign","flexDirection","alignSelf","alignItems","
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useMemo","Pressable","View","composeEventHandlers","useFocus","useFocusRing","useHover","usePress","Slot","dataAttributes","mergeDataAttributes","splitContainerProps","ListItemProvider","jsx","_jsx","jsxs","_jsxs","rowStyleForCrossAlign","crossAlign","flexDirection","alignSelf","alignItems","ListItemRoot","asChild","children","onPress","isDisabled","style","accessory","accessoryPosition","pressableClassName","pressableStyle","restProps","ref","asChildInteractive","isValidElement","isPressableRoot","isSplit","tracksState","childDisabled","props","disabled","resolvedDisabled","pressState","isPressed","pressProps","hoverProps","isHovered","isFocused","focusProps","isFocusVisible","focusRingProps","contextValue","hover","focus","active","focusVisible","onPressIn","onPressInProp","onPressOut","onPressOutProp","onHoverIn","onHoverInProp","onHoverOut","onHoverOutProp","onFocus","onFocusProp","onBlur","onBlurProp","otherProps","container","region","regionProps","accessibilityState","className","pressable","value","slotMergeProps","undefined","displayName"],"sourceRoot":"../../../src","sources":["list-item/ListItemRoot.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAA2B,OAAO;AACrE,SAASC,SAAS,EAAEC,IAAI,QAA6C,cAAc;AACnF,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,QAAQ,EAAEC,YAAY,QAAQ,0BAA0B;AACjE,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,iCAAiC;AAEpE,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,yBAAyB;AAC7E,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,gBAAgB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG7C,SAASC,qBAAqBA,CAACC,UAA8B,EAAE;EAC7D,OAAO;IACLC,aAAa,EAAE,KAAc;IAC7BC,SAAS,EAAE,SAAkB;IAC7BC,UAAU,EAAEH,UAAU,KAAK,OAAO,GAAI,YAAY,GAAc;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BAAmB,CACrBsB,SAAS,EACTN,UAAU,GAAGjB,cAAc,CAAC;QAAEgC,QAAQ,EAAE;MAAK,CAAC,CAAC,GAAGqC,SACpD,CAAC;MAAAtD,QAAA,GAEAK,iBAAiB,KAAK,OAAO,GAAGD,SAAS,GAAG,IAAI,EAChDJ,QAAQ,EACRK,iBAAiB,KAAK,KAAK,GAAGD,SAAS,GAAG,IAAI;IAAA,CAC3C;EAAC,CACS,CAAC;AAEvB,CACF,CAAC;AAEDN,YAAY,CAACyD,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Splits the props a split root's container keeps (`className`, data attributes) from the ones
|
|
5
|
+
* its press region receives.
|
|
6
|
+
*/
|
|
7
|
+
export function splitContainerProps(props) {
|
|
8
|
+
const container = {};
|
|
9
|
+
const region = {};
|
|
10
|
+
for (const key in props) {
|
|
11
|
+
if (key === 'className' || key === 'dataSet' || key.startsWith('data-')) {
|
|
12
|
+
container[key] = props[key];
|
|
13
|
+
} else {
|
|
14
|
+
region[key] = props[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
container,
|
|
19
|
+
region
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=splitContainerProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["splitContainerProps","props","container","region","key","startsWith"],"sourceRoot":"../../../src","sources":["utils/splitContainerProps.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAACC,KAA8B,EAAE;EAClE,MAAMC,SAAkC,GAAG,CAAC,CAAC;EAC7C,MAAMC,MAA+B,GAAG,CAAC,CAAC;EAC1C,KAAK,MAAMC,GAAG,IAAIH,KAAK,EAAE;IACvB,IAAIG,GAAG,KAAK,WAAW,IAAIA,GAAG,KAAK,SAAS,IAAIA,G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MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { IInsightProps } from './types';
|
|
4
|
+
export type InsightRootProps = IInsightProps;
|
|
5
|
+
export declare const InsightRoot: React.ForwardRefExoticComponent<IInsightProps & React.RefAttributes<View>>;
|
|
6
|
+
//# sourceMappingURL=InsightRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightRoot.d.ts","sourceRoot":"","sources":["../../../src/insight/InsightRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,EAAa,IAAI,EAAuC,MAAM,cAAc,CAAC;AAQpF,OAAO,KAAK,EAEV,aAAa,EAGd,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAM7C,eAAO,MAAM,WAAW,4EAyItB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IInsightContextValue } from './types';
|
|
2
|
+
export declare const InsightProvider: import("react").FunctionComponent<{
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
value: IInsightContextValue;
|
|
5
|
+
}>, useInsightContext: () => IInsightContextValue;
|
|
6
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/insight/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAO,eAAe;;;IAAE,iBAAiB,4BACO,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { IInsightContextValue, IInsightDetailProps, IInsightPressablePassthrough, IInsightProps, IInsightSummaryProps, InsightLayout, } from './types';
|
|
2
|
+
export { InsightProvider, useInsightContext } from './context';
|
|
3
|
+
export { InsightRoot, type InsightRootProps } from './InsightRoot';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/insight/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,aAAa,EACb,oBAAoB,EACpB,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
|
+
export type InsightLayout = 'summary' | 'detail';
|
|
4
|
+
export type IInsightPressablePassthrough = Partial<Pick<PressableProps, 'onPressIn' | 'onPressOut' | 'onHoverIn' | 'onHoverOut'>>;
|
|
5
|
+
interface IInsightBaseProps extends ViewProps {
|
|
6
|
+
/** Merge props onto a single child instead of rendering `View` or `Pressable`. */
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Interactive control that must sit beside the press region, never inside it (the styled
|
|
10
|
+
* layer's close button). On a pressable summary the root renders a non-interactive container
|
|
11
|
+
* holding the press region and the accessory as siblings. The container receives
|
|
12
|
+
* `className`, `style`, and data attributes, and mirrors the region's interaction state as
|
|
13
|
+
* `data-*`; the region receives `ref` and every other prop, so `ref` always targets the
|
|
14
|
+
* focusable press region of a pressable root. A static root renders the accessory after
|
|
15
|
+
* `children` and keeps `ref` on its `View`.
|
|
16
|
+
*/
|
|
17
|
+
accessory?: ReactNode;
|
|
18
|
+
/** Class names for the press region when `accessory` splits the root. */
|
|
19
|
+
pressableClassName?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IInsightSummaryProps extends IInsightBaseProps, IInsightPressablePassthrough {
|
|
22
|
+
/**
|
|
23
|
+
* Inline card that navigates elsewhere when pressed.
|
|
24
|
+
* @default 'summary'
|
|
25
|
+
*/
|
|
26
|
+
layout?: 'summary';
|
|
27
|
+
/** When set, the root renders a press region with `role="button"`. */
|
|
28
|
+
onPress?: PressableProps['onPress'];
|
|
29
|
+
/** Suppresses `onPress` and marks the press region disabled. */
|
|
30
|
+
isDisabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface IInsightDetailProps extends IInsightBaseProps {
|
|
33
|
+
/** Static container. It holds its own actions, so it is never pressable. */
|
|
34
|
+
layout: 'detail';
|
|
35
|
+
}
|
|
36
|
+
/** Discriminated union: `layout` narrows the press props to the summary layout. */
|
|
37
|
+
export type IInsightProps = IInsightSummaryProps | IInsightDetailProps;
|
|
38
|
+
export interface IInsightContextValue {
|
|
39
|
+
layout: InsightLayout;
|
|
40
|
+
isPressed: boolean;
|
|
41
|
+
isPressable: boolean;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/insight/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAChD,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC,CAC9E,CAAC;AAEF,UAAU,iBAAkB,SAAQ,SAAS;IAC3C,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB,EAAE,4BAA4B;IAC3F;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,4EAA4E;IAC5E,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED,mFAAmF;AACnF,MAAM,MAAM,aAAa,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemRoot.d.ts","sourceRoot":"","sources":["../../../src/list-item/ListItemRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,EAAa,IAAI,EAAuC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ListItemRoot.d.ts","sourceRoot":"","sources":["../../../src/list-item/ListItemRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,EAAa,IAAI,EAAuC,MAAM,cAAc,CAAC;AASpF,OAAO,KAAK,EAAiC,cAAc,EAAsB,MAAM,SAAS,CAAC;AAUjG,MAAM,WAAW,iBAAkB,SAAQ,cAAc;CAAG;AAE5D,eAAO,MAAM,YAAY,gFA6OxB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits the props a split root's container keeps (`className`, data attributes) from the ones
|
|
3
|
+
* its press region receives.
|
|
4
|
+
*/
|
|
5
|
+
export declare function splitContainerProps(props: Record<string, unknown>): {
|
|
6
|
+
container: Record<string, unknown>;
|
|
7
|
+
region: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=splitContainerProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitContainerProps.d.ts","sourceRoot":"","sources":["../../../src/utils/splitContainerProps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;EAWjE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/primitives",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@react-stately/disclosure": "3.1.1",
|
|
70
70
|
"@react-stately/radio": "3.12.0",
|
|
71
71
|
"@react-stately/toggle": "3.9.4",
|
|
72
|
-
"@cdx-ui/formatters": "0.3.
|
|
73
|
-
"@cdx-ui/utils": "0.3.
|
|
72
|
+
"@cdx-ui/formatters": "0.3.3",
|
|
73
|
+
"@cdx-ui/utils": "0.3.3"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/react": "19.2.14",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo, type ComponentRef } from 'react';
|
|
2
|
+
import { Pressable, View, type PressableProps, type ViewProps } from 'react-native';
|
|
3
|
+
import { composeEventHandlers } from '@cdx-ui/utils';
|
|
4
|
+
import { useFocus, useFocusRing } from '@react-native-aria/focus';
|
|
5
|
+
import { useHover, usePress } from '@react-native-aria/interactions';
|
|
6
|
+
import { Slot } from '../slot';
|
|
7
|
+
import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
|
|
8
|
+
import { splitContainerProps } from '../utils/splitContainerProps';
|
|
9
|
+
import { InsightProvider } from './context';
|
|
10
|
+
import type {
|
|
11
|
+
IInsightContextValue,
|
|
12
|
+
IInsightProps,
|
|
13
|
+
IInsightSummaryProps,
|
|
14
|
+
InsightLayout,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
export type InsightRootProps = IInsightProps;
|
|
18
|
+
|
|
19
|
+
type InsightRootRuntimeProps = Omit<IInsightSummaryProps, 'layout'> & {
|
|
20
|
+
layout?: InsightLayout;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const InsightRoot = forwardRef<ComponentRef<typeof View>, InsightRootProps>((props, ref) => {
|
|
24
|
+
const {
|
|
25
|
+
layout = 'summary',
|
|
26
|
+
asChild = false,
|
|
27
|
+
children,
|
|
28
|
+
onPress,
|
|
29
|
+
isDisabled = false,
|
|
30
|
+
accessory,
|
|
31
|
+
pressableClassName,
|
|
32
|
+
style,
|
|
33
|
+
role,
|
|
34
|
+
onPressIn: onPressInProp,
|
|
35
|
+
onPressOut: onPressOutProp,
|
|
36
|
+
onHoverIn: onHoverInProp,
|
|
37
|
+
onHoverOut: onHoverOutProp,
|
|
38
|
+
...restProps
|
|
39
|
+
} = props as InsightRootRuntimeProps;
|
|
40
|
+
|
|
41
|
+
const isPressable = layout === 'summary' && !!onPress;
|
|
42
|
+
const asChildElement = asChild && React.isValidElement(children);
|
|
43
|
+
const isSplit = accessory != null && (isPressable || asChildElement);
|
|
44
|
+
|
|
45
|
+
const pressState = usePress({ isDisabled: !isPressable || isDisabled });
|
|
46
|
+
const isPressed = isPressable && pressState.isPressed;
|
|
47
|
+
const pressProps = pressState.pressProps as Pick<PressableProps, 'onPressIn' | 'onPressOut'>;
|
|
48
|
+
const { hoverProps, isHovered } = useHover();
|
|
49
|
+
const { isFocused, focusProps } = useFocus();
|
|
50
|
+
const { isFocusVisible, focusProps: focusRingProps } = useFocusRing() as {
|
|
51
|
+
isFocusVisible: boolean;
|
|
52
|
+
focusProps: typeof focusProps;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const contextValue = useMemo<IInsightContextValue>(
|
|
56
|
+
() => ({ layout, isPressed, isPressable }),
|
|
57
|
+
[layout, isPressed, isPressable],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const interactionAttributes = isPressable
|
|
61
|
+
? dataAttributes({
|
|
62
|
+
active: isPressed,
|
|
63
|
+
hover: isHovered,
|
|
64
|
+
focus: isFocused,
|
|
65
|
+
focusVisible: isFocusVisible,
|
|
66
|
+
disabled: isDisabled,
|
|
67
|
+
})
|
|
68
|
+
: undefined;
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
onFocus: onFocusProp,
|
|
72
|
+
onBlur: onBlurProp,
|
|
73
|
+
accessibilityState: accessibilityStateProp,
|
|
74
|
+
} = restProps as Pick<PressableProps, 'onFocus' | 'onBlur' | 'accessibilityState'>;
|
|
75
|
+
|
|
76
|
+
const pressRegionProps = (): Record<string, unknown> => ({
|
|
77
|
+
role: role ?? 'button',
|
|
78
|
+
...(isDisabled && { accessibilityState: { ...accessibilityStateProp, disabled: true } }),
|
|
79
|
+
disabled: isDisabled,
|
|
80
|
+
onPress: isDisabled ? undefined : onPress,
|
|
81
|
+
onPressIn: composeEventHandlers(onPressInProp, pressProps.onPressIn),
|
|
82
|
+
onPressOut: composeEventHandlers(onPressOutProp, pressProps.onPressOut),
|
|
83
|
+
onHoverIn: composeEventHandlers(onHoverInProp, hoverProps.onHoverIn),
|
|
84
|
+
onHoverOut: composeEventHandlers(onHoverOutProp, hoverProps.onHoverOut),
|
|
85
|
+
onFocus: composeEventHandlers(
|
|
86
|
+
composeEventHandlers(onFocusProp, focusProps.onFocus),
|
|
87
|
+
focusRingProps.onFocus,
|
|
88
|
+
),
|
|
89
|
+
onBlur: composeEventHandlers(
|
|
90
|
+
composeEventHandlers(onBlurProp, focusProps.onBlur),
|
|
91
|
+
focusRingProps.onBlur,
|
|
92
|
+
),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (isSplit) {
|
|
96
|
+
const { container, region } = splitContainerProps(restProps);
|
|
97
|
+
const regionProps: Record<string, unknown> = {
|
|
98
|
+
...region,
|
|
99
|
+
...(role != null && { role }),
|
|
100
|
+
className: pressableClassName,
|
|
101
|
+
...(isPressable && { ...pressRegionProps(), ...interactionAttributes }),
|
|
102
|
+
};
|
|
103
|
+
const RegionComp = asChildElement ? Slot : isPressable ? Pressable : View;
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<InsightProvider value={contextValue}>
|
|
107
|
+
<View
|
|
108
|
+
{...(container as ViewProps)}
|
|
109
|
+
ref={isPressable ? undefined : ref}
|
|
110
|
+
style={style}
|
|
111
|
+
{...mergeDataAttributes(container, interactionAttributes)}
|
|
112
|
+
>
|
|
113
|
+
<RegionComp
|
|
114
|
+
{...(regionProps as PressableProps)}
|
|
115
|
+
ref={isPressable ? (ref as React.Ref<View>) : undefined}
|
|
116
|
+
>
|
|
117
|
+
{children}
|
|
118
|
+
</RegionComp>
|
|
119
|
+
{accessory}
|
|
120
|
+
</View>
|
|
121
|
+
</InsightProvider>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (isPressable) {
|
|
126
|
+
const Comp = asChildElement ? Slot : Pressable;
|
|
127
|
+
return (
|
|
128
|
+
<InsightProvider value={contextValue}>
|
|
129
|
+
<Comp
|
|
130
|
+
{...(restProps as PressableProps)}
|
|
131
|
+
{...(pressRegionProps() as PressableProps)}
|
|
132
|
+
ref={ref as React.Ref<View>}
|
|
133
|
+
style={style}
|
|
134
|
+
{...mergeDataAttributes(restProps, interactionAttributes)}
|
|
135
|
+
>
|
|
136
|
+
{children}
|
|
137
|
+
</Comp>
|
|
138
|
+
</InsightProvider>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (asChildElement) {
|
|
143
|
+
return (
|
|
144
|
+
<InsightProvider value={contextValue}>
|
|
145
|
+
<Slot {...(restProps as ViewProps)} ref={ref as React.Ref<View>} style={style} role={role}>
|
|
146
|
+
{children}
|
|
147
|
+
</Slot>
|
|
148
|
+
</InsightProvider>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<InsightProvider value={contextValue}>
|
|
154
|
+
<View {...(restProps as ViewProps)} ref={ref} style={style} role={role}>
|
|
155
|
+
{children}
|
|
156
|
+
{accessory}
|
|
157
|
+
</View>
|
|
158
|
+
</InsightProvider>
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
InsightRoot.displayName = 'InsightRoot';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
IInsightContextValue,
|
|
3
|
+
IInsightDetailProps,
|
|
4
|
+
IInsightPressablePassthrough,
|
|
5
|
+
IInsightProps,
|
|
6
|
+
IInsightSummaryProps,
|
|
7
|
+
InsightLayout,
|
|
8
|
+
} from './types';
|
|
9
|
+
|
|
10
|
+
export { InsightProvider, useInsightContext } from './context';
|
|
11
|
+
export { InsightRoot, type InsightRootProps } from './InsightRoot';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type InsightLayout = 'summary' | 'detail';
|
|
5
|
+
|
|
6
|
+
export type IInsightPressablePassthrough = Partial<
|
|
7
|
+
Pick<PressableProps, 'onPressIn' | 'onPressOut' | 'onHoverIn' | 'onHoverOut'>
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
interface IInsightBaseProps extends ViewProps {
|
|
11
|
+
/** Merge props onto a single child instead of rendering `View` or `Pressable`. */
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Interactive control that must sit beside the press region, never inside it (the styled
|
|
15
|
+
* layer's close button). On a pressable summary the root renders a non-interactive container
|
|
16
|
+
* holding the press region and the accessory as siblings. The container receives
|
|
17
|
+
* `className`, `style`, and data attributes, and mirrors the region's interaction state as
|
|
18
|
+
* `data-*`; the region receives `ref` and every other prop, so `ref` always targets the
|
|
19
|
+
* focusable press region of a pressable root. A static root renders the accessory after
|
|
20
|
+
* `children` and keeps `ref` on its `View`.
|
|
21
|
+
*/
|
|
22
|
+
accessory?: ReactNode;
|
|
23
|
+
/** Class names for the press region when `accessory` splits the root. */
|
|
24
|
+
pressableClassName?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IInsightSummaryProps extends IInsightBaseProps, IInsightPressablePassthrough {
|
|
28
|
+
/**
|
|
29
|
+
* Inline card that navigates elsewhere when pressed.
|
|
30
|
+
* @default 'summary'
|
|
31
|
+
*/
|
|
32
|
+
layout?: 'summary';
|
|
33
|
+
/** When set, the root renders a press region with `role="button"`. */
|
|
34
|
+
onPress?: PressableProps['onPress'];
|
|
35
|
+
/** Suppresses `onPress` and marks the press region disabled. */
|
|
36
|
+
isDisabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface IInsightDetailProps extends IInsightBaseProps {
|
|
40
|
+
/** Static container. It holds its own actions, so it is never pressable. */
|
|
41
|
+
layout: 'detail';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Discriminated union: `layout` narrows the press props to the summary layout. */
|
|
45
|
+
export type IInsightProps = IInsightSummaryProps | IInsightDetailProps;
|
|
46
|
+
|
|
47
|
+
export interface IInsightContextValue {
|
|
48
|
+
layout: InsightLayout;
|
|
49
|
+
isPressed: boolean;
|
|
50
|
+
isPressable: boolean;
|
|
51
|
+
}
|
|
@@ -6,6 +6,7 @@ import { useHover, usePress } from '@react-native-aria/interactions';
|
|
|
6
6
|
import type { InteractionState } from '../types';
|
|
7
7
|
import { Slot } from '../slot';
|
|
8
8
|
import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
|
|
9
|
+
import { splitContainerProps } from '../utils/splitContainerProps';
|
|
9
10
|
import { ListItemProvider } from './context';
|
|
10
11
|
import type { IListItemPressablePassthrough, IListItemProps, ListItemCrossAlign } from './types';
|
|
11
12
|
|
|
@@ -17,20 +18,6 @@ function rowStyleForCrossAlign(crossAlign: ListItemCrossAlign) {
|
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
/** Splits the props a split row's container keeps (`className`, data attributes) from the rest. */
|
|
21
|
-
function splitContainerProps(props: Record<string, unknown>) {
|
|
22
|
-
const container: Record<string, unknown> = {};
|
|
23
|
-
const region: Record<string, unknown> = {};
|
|
24
|
-
for (const key in props) {
|
|
25
|
-
if (key === 'className' || key === 'dataSet' || key.startsWith('data-')) {
|
|
26
|
-
container[key] = props[key];
|
|
27
|
-
} else {
|
|
28
|
-
region[key] = props[key];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return { container, region };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
21
|
export interface ListItemRootProps extends IListItemProps {}
|
|
35
22
|
|
|
36
23
|
export const ListItemRoot = forwardRef<ComponentRef<typeof View>, ListItemRootProps>(
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits the props a split root's container keeps (`className`, data attributes) from the ones
|
|
3
|
+
* its press region receives.
|
|
4
|
+
*/
|
|
5
|
+
export function splitContainerProps(props: Record<string, unknown>) {
|
|
6
|
+
const container: Record<string, unknown> = {};
|
|
7
|
+
const region: Record<string, unknown> = {};
|
|
8
|
+
for (const key in props) {
|
|
9
|
+
if (key === 'className' || key === 'dataSet' || key.startsWith('data-')) {
|
|
10
|
+
container[key] = props[key];
|
|
11
|
+
} else {
|
|
12
|
+
region[key] = props[key];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return { container, region };
|
|
16
|
+
}
|