@ankhorage/zora 3.1.1 → 3.3.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.
- package/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/components/card/meta.d.ts +1 -1
- package/dist/components/progress/ProgressRing.d.ts +7 -0
- package/dist/components/progress/ProgressRing.d.ts.map +1 -0
- package/dist/components/progress/ProgressRing.js +100 -0
- package/dist/components/progress/ProgressRing.js.map +1 -0
- package/dist/components/progress/index.d.ts +2 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/meta.d.ts +116 -0
- package/dist/components/progress/meta.d.ts.map +1 -1
- package/dist/components/progress/meta.js +97 -0
- package/dist/components/progress/meta.js.map +1 -1
- package/dist/components/progress/resolveProgressRingGeometry.d.ts +12 -0
- package/dist/components/progress/resolveProgressRingGeometry.d.ts.map +1 -0
- package/dist/components/progress/resolveProgressRingGeometry.js +27 -0
- package/dist/components/progress/resolveProgressRingGeometry.js.map +1 -0
- package/dist/components/progress/types.d.ts +12 -0
- package/dist/components/progress/types.d.ts.map +1 -1
- package/dist/components/progress/types.js.map +1 -1
- package/dist/foundation/meta.d.ts +4 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/screen/meta.d.ts +1 -1
- package/dist/layout/screen-section/meta.d.ts +1 -1
- package/dist/metadata/allowedChildren.d.ts +4 -3
- package/dist/metadata/allowedChildren.d.ts.map +1 -1
- package/dist/metadata/allowedChildren.js +13 -0
- package/dist/metadata/allowedChildren.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +2 -2
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +4 -1
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/content-rail/ContentRail.d.ts +10 -0
- package/dist/patterns/content-rail/ContentRail.d.ts.map +1 -0
- package/dist/patterns/content-rail/ContentRail.js +175 -0
- package/dist/patterns/content-rail/ContentRail.js.map +1 -0
- package/dist/patterns/content-rail/index.d.ts +3 -0
- package/dist/patterns/content-rail/index.d.ts.map +1 -0
- package/dist/patterns/content-rail/index.js +2 -0
- package/dist/patterns/content-rail/index.js.map +1 -0
- package/dist/patterns/content-rail/meta.d.ts +143 -0
- package/dist/patterns/content-rail/meta.d.ts.map +1 -0
- package/dist/patterns/content-rail/meta.js +130 -0
- package/dist/patterns/content-rail/meta.js.map +1 -0
- package/dist/patterns/content-rail/resolveContentRailItemWidth.d.ts +10 -0
- package/dist/patterns/content-rail/resolveContentRailItemWidth.d.ts.map +1 -0
- package/dist/patterns/content-rail/resolveContentRailItemWidth.js +25 -0
- package/dist/patterns/content-rail/resolveContentRailItemWidth.js.map +1 -0
- package/dist/patterns/content-rail/resolveContentRailPhysicalOffset.d.ts +6 -0
- package/dist/patterns/content-rail/resolveContentRailPhysicalOffset.d.ts.map +1 -0
- package/dist/patterns/content-rail/resolveContentRailPhysicalOffset.js +5 -0
- package/dist/patterns/content-rail/resolveContentRailPhysicalOffset.js.map +1 -0
- package/dist/patterns/content-rail/resolveContentRailState.d.ts +18 -0
- package/dist/patterns/content-rail/resolveContentRailState.d.ts.map +1 -0
- package/dist/patterns/content-rail/resolveContentRailState.js +21 -0
- package/dist/patterns/content-rail/resolveContentRailState.js.map +1 -0
- package/dist/patterns/content-rail/types.d.ts +31 -0
- package/dist/patterns/content-rail/types.d.ts.map +1 -0
- package/dist/patterns/content-rail/types.js +2 -0
- package/dist/patterns/content-rail/types.js.map +1 -0
- package/dist/patterns/content-rail/useContentRailReducedMotion.d.ts +3 -0
- package/dist/patterns/content-rail/useContentRailReducedMotion.d.ts.map +1 -0
- package/dist/patterns/content-rail/useContentRailReducedMotion.js +21 -0
- package/dist/patterns/content-rail/useContentRailReducedMotion.js.map +1 -0
- package/dist/patterns/message-bubble/meta.d.ts +1 -1
- package/dist/patterns/notice/meta.d.ts +1 -1
- package/dist/patterns/panel/meta.d.ts +1 -1
- package/dist/patterns/post-card/meta.d.ts +1 -1
- package/dist/patterns/reader/meta.d.ts +2 -2
- package/dist/patterns/scanner/meta.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -1
- package/dist/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/components/progress/ProgressRing.test.ts +48 -0
- package/src/components/progress/ProgressRing.tsx +151 -0
- package/src/components/progress/index.ts +2 -1
- package/src/components/progress/meta.ts +99 -0
- package/src/components/progress/resolveProgressRingGeometry.test.ts +30 -0
- package/src/components/progress/resolveProgressRingGeometry.ts +44 -0
- package/src/components/progress/types.ts +13 -0
- package/src/index.ts +12 -2
- package/src/interactionPolicy.test.ts +22 -0
- package/src/metadata/allowedChildren.ts +14 -0
- package/src/metadata/componentMeta.test.ts +51 -0
- package/src/metadata/componentMeta.ts +4 -1
- package/src/patterns/content-rail/ContentRail.test.ts +44 -0
- package/src/patterns/content-rail/ContentRail.tsx +245 -0
- package/src/patterns/content-rail/index.ts +10 -0
- package/src/patterns/content-rail/meta.ts +133 -0
- package/src/patterns/content-rail/resolveContentRailItemWidth.test.ts +77 -0
- package/src/patterns/content-rail/resolveContentRailItemWidth.ts +39 -0
- package/src/patterns/content-rail/resolveContentRailPhysicalOffset.test.ts +29 -0
- package/src/patterns/content-rail/resolveContentRailPhysicalOffset.ts +12 -0
- package/src/patterns/content-rail/resolveContentRailState.test.ts +68 -0
- package/src/patterns/content-rail/resolveContentRailState.ts +36 -0
- package/src/patterns/content-rail/types.ts +35 -0
- package/src/patterns/content-rail/useContentRailReducedMotion.ts +28 -0
- package/src/registry.ts +4 -1
- package/src/showcaseCoverage.test.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentRail.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/ContentRail.tsx"],"names":[],"mappings":"AAAA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AK,CAAC,CACT,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAEhE,SAAS,mBAAmB,CAC1B,OAAkF,EAClF,KAA2C;IAE3C,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC1C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,EAAE,CAAC;IACtC,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,EAAE,CAAC;IACtC,OAAO,OAAO,CAAC,CAAC,CAAC;AACnB,CAAC","sourcesContent":["import React from 'react';\nimport {\n I18nManager,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n ScrollView,\n type ViewStyle,\n} from 'react-native';\n\nimport { IconButton } from '../../components/icon-button';\nimport { Text } from '../../components/text';\nimport { Box, Inline, Stack } from '../../foundation';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { resolveContentRailItemWidth } from './resolveContentRailItemWidth';\nimport { resolveContentRailPhysicalOffset } from './resolveContentRailPhysicalOffset';\nimport { resolveContentRailState } from './resolveContentRailState';\nimport type { ContentRailProps, ContentRailVisibleRangeChangeEvent } from './types';\nimport { useContentRailReducedMotion } from './useContentRailReducedMotion';\n\nfunction ContentRailInner({\n themeId: _themeId,\n mode: _mode,\n interactionPolicy,\n children,\n itemSize = 'responsive',\n gap = 'm',\n padding = 'm',\n peek = 32,\n showControls = true,\n direction = 'auto',\n motion = 'system',\n accessibilityLabel = 'Content rail',\n previousLabel = 'Previous items',\n nextLabel = 'Next items',\n onControlPress,\n onVisibleRangeChange,\n testID,\n}: ContentRailProps) {\n const { theme } = useZoraTheme();\n const items = React.Children.toArray(children);\n const scrollViewRef = React.useRef<ScrollView>(null);\n const lastRangeRef = React.useRef<ContentRailVisibleRangeChangeEvent | null>(null);\n const logicalOffsetRef = React.useRef(0);\n const rtlInitializedRef = React.useRef(false);\n const [viewportWidth, setViewportWidth] = React.useState(0);\n const [contentWidth, setContentWidth] = React.useState(0);\n const [logicalOffset, setLogicalOffset] = React.useState(0);\n const reducedMotion = useContentRailReducedMotion(motion);\n const isRtl = direction === 'rtl' || (direction === 'auto' && I18nManager.isRTL);\n const gapValue = resolveSpacingValue(theme.spacing, gap);\n const paddingValue = resolveSpacingValue(theme.spacing, padding);\n const itemWidth = resolveContentRailItemWidth({\n gap: gapValue,\n itemCount: items.length,\n itemSize,\n padding: paddingValue,\n peek,\n viewportWidth,\n });\n const railState = resolveContentRailState({\n contentWidth,\n gap: gapValue,\n itemCount: items.length,\n itemWidth,\n logicalOffset,\n viewportWidth,\n });\n const passive = interactionPolicy === 'passive';\n const hasOverflow = railState.maxOffset > 1;\n\n const emitVisibleRange = React.useCallback(\n (nextOffset: number) => {\n const next = resolveContentRailState({\n contentWidth,\n gap: gapValue,\n itemCount: items.length,\n itemWidth,\n logicalOffset: nextOffset,\n viewportWidth,\n });\n const event = {\n firstVisibleIndex: next.firstVisibleIndex,\n lastVisibleIndex: next.lastVisibleIndex,\n itemCount: items.length,\n };\n const previous = lastRangeRef.current;\n if (\n previous?.firstVisibleIndex === event.firstVisibleIndex &&\n previous.lastVisibleIndex === event.lastVisibleIndex &&\n previous.itemCount === event.itemCount\n ) {\n return;\n }\n lastRangeRef.current = event;\n void onVisibleRangeChange?.(event);\n },\n [contentWidth, gapValue, itemWidth, items.length, onVisibleRangeChange, viewportWidth],\n );\n\n React.useEffect(() => {\n emitVisibleRange(railState.offset);\n }, [emitVisibleRange, railState.offset]);\n\n React.useEffect(() => {\n rtlInitializedRef.current = !isRtl;\n }, [isRtl]);\n\n React.useEffect(() => {\n if (viewportWidth === 0 || contentWidth === 0) return;\n const nextOffset = Math.min(logicalOffsetRef.current, railState.maxOffset);\n scrollViewRef.current?.scrollTo({\n animated: false,\n x: resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: nextOffset,\n maxOffset: railState.maxOffset,\n }),\n y: 0,\n });\n rtlInitializedRef.current = true;\n }, [contentWidth, isRtl, itemWidth, railState.maxOffset, viewportWidth]);\n\n const scrollToIndex = (targetIndex: number, controlDirection: 'previous' | 'next') => {\n if (passive || !hasOverflow) return;\n const clampedIndex = Math.min(Math.max(0, targetIndex), Math.max(0, items.length - 1));\n const targetOffset = Math.min(clampedIndex * railState.stride, railState.maxOffset);\n logicalOffsetRef.current = targetOffset;\n setLogicalOffset(targetOffset);\n scrollViewRef.current?.scrollTo({\n animated: !reducedMotion,\n x: resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: targetOffset,\n maxOffset: railState.maxOffset,\n }),\n y: 0,\n });\n emitVisibleRange(targetOffset);\n void onControlPress?.({ direction: controlDirection, targetIndex: clampedIndex });\n };\n\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n if (isRtl && !rtlInitializedRef.current) return;\n const physicalOffset = event.nativeEvent.contentOffset.x;\n const nextOffset = resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset: physicalOffset,\n maxOffset: railState.maxOffset,\n });\n const clampedOffset = Math.min(Math.max(0, nextOffset), railState.maxOffset);\n logicalOffsetRef.current = clampedOffset;\n setLogicalOffset(clampedOffset);\n emitVisibleRange(clampedOffset);\n };\n\n const rangeLabel =\n items.length === 0\n ? 'No items'\n : `Items ${railState.firstVisibleIndex + 1}–${railState.lastVisibleIndex + 1} of ${items.length}`;\n const contentStyle: ViewStyle = {\n direction: isRtl ? 'rtl' : 'ltr',\n flexDirection: 'row',\n gap: gapValue,\n paddingHorizontal: paddingValue,\n };\n\n return (\n <Stack gap=\"s\" testID={testID}>\n {showControls && hasOverflow ? (\n <Inline justify=\"space-between\" wrap=\"nowrap\">\n <Text accessibilityLiveRegion=\"polite\" emphasis=\"muted\" variant=\"caption\">\n {rangeLabel}\n </Text>\n <Inline gap=\"xs\" wrap=\"nowrap\">\n <IconButton\n disabled={passive || !railState.canGoPrevious}\n icon={{ name: isRtl ? 'chevron-forward' : 'chevron-back' }}\n interactionPolicy={interactionPolicy}\n label={previousLabel}\n onPress={() => scrollToIndex(railState.anchorIndex - 1, 'previous')}\n size=\"l\"\n />\n <IconButton\n disabled={passive || !railState.canGoNext}\n icon={{ name: isRtl ? 'chevron-back' : 'chevron-forward' }}\n interactionPolicy={interactionPolicy}\n label={nextLabel}\n onPress={() => scrollToIndex(railState.anchorIndex + 1, 'next')}\n size=\"l\"\n />\n </Inline>\n </Inline>\n ) : null}\n <ScrollView\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"list\"\n contentContainerStyle={contentStyle}\n decelerationRate=\"fast\"\n disableIntervalMomentum\n horizontal\n onContentSizeChange={(width) => {\n if (isRtl) rtlInitializedRef.current = false;\n setContentWidth(width);\n }}\n onLayout={(event) => {\n if (isRtl) rtlInitializedRef.current = false;\n setViewportWidth(event.nativeEvent.layout.width);\n }}\n onScroll={handleScroll}\n ref={scrollViewRef}\n scrollEnabled={!passive}\n scrollEventThrottle={16}\n showsHorizontalScrollIndicator={false}\n snapToInterval={itemWidth > 0 ? itemWidth + gapValue : undefined}\n >\n {items.map((item, index) => (\n <Box key={index} style={{ flexShrink: 0, width: itemWidth || undefined }}>\n {item}\n </Box>\n ))}\n </ScrollView>\n </Stack>\n );\n}\n\n/**\n * Horizontally browsable, manifest-authorable content with responsive item sizing.\n *\n * ContentRail owns only presentation and scrolling. Apps retain ownership of item data,\n * navigation, recommendations, and route behavior.\n */\nexport const ContentRail = withZoraThemeScope(ContentRailInner);\n\nfunction resolveSpacingValue(\n spacing: { none: number; xs: number; s: number; m: number; l: number; xl: number },\n token: NonNullable<ContentRailProps['gap']>,\n): number {\n if (token === 'none') return spacing.none;\n if (token === 'xs') return spacing.xs;\n if (token === 's') return spacing.s;\n if (token === 'l') return spacing.l;\n if (token === 'xl') return spacing.xl;\n return spacing.m;\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ContentRail } from './ContentRail';
|
|
2
|
+
export type { ContentRailControlPressEvent, ContentRailDirection, ContentRailItemSize, ContentRailMotion, ContentRailProps, ContentRailSpacing, ContentRailVisibleRangeChangeEvent, } from './types';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kCAAkC,GACnC,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { ContentRail } from './ContentRail';\nexport type {\n ContentRailControlPressEvent,\n ContentRailDirection,\n ContentRailItemSize,\n ContentRailMotion,\n ContentRailProps,\n ContentRailSpacing,\n ContentRailVisibleRangeChangeEvent,\n} from './types';\n"]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export declare const contentRailMeta: {
|
|
2
|
+
readonly name: "ContentRail";
|
|
3
|
+
readonly category: "pattern";
|
|
4
|
+
readonly description: "Horizontally browsable child content with responsive sizing, partial-next affordance, and accessible controls.";
|
|
5
|
+
readonly directManifestNode: true;
|
|
6
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Card", "Panel", "Image", "ProductCard", "PostCard", "ChatListItem", "MessageBubble"];
|
|
7
|
+
readonly blueprint: {
|
|
8
|
+
readonly label: "Content rail";
|
|
9
|
+
readonly icon: {
|
|
10
|
+
readonly name: "albums-outline";
|
|
11
|
+
};
|
|
12
|
+
readonly defaultProps: {
|
|
13
|
+
readonly itemSize: "responsive";
|
|
14
|
+
readonly gap: "m";
|
|
15
|
+
readonly padding: "m";
|
|
16
|
+
readonly peek: 32;
|
|
17
|
+
readonly showControls: true;
|
|
18
|
+
readonly direction: "auto";
|
|
19
|
+
readonly motion: "system";
|
|
20
|
+
readonly accessibilityLabel: "Content rail";
|
|
21
|
+
readonly previousLabel: "Previous items";
|
|
22
|
+
readonly nextLabel: "Next items";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly events: {
|
|
26
|
+
readonly controlPress: {
|
|
27
|
+
readonly label: "Control press";
|
|
28
|
+
readonly eventType: "contentRail.controlPress";
|
|
29
|
+
readonly description: "Emitted after a previous or next control requests a target item.";
|
|
30
|
+
readonly payloadFields: readonly [{
|
|
31
|
+
readonly path: "direction";
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly label: "Direction";
|
|
34
|
+
}, {
|
|
35
|
+
readonly path: "targetIndex";
|
|
36
|
+
readonly type: "number";
|
|
37
|
+
readonly label: "Target index";
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
40
|
+
readonly visibleRangeChange: {
|
|
41
|
+
readonly label: "Visible range change";
|
|
42
|
+
readonly eventType: "contentRail.visibleRangeChange";
|
|
43
|
+
readonly description: "Emitted when the zero-based visible item range changes.";
|
|
44
|
+
readonly payloadFields: readonly [{
|
|
45
|
+
readonly path: "firstVisibleIndex";
|
|
46
|
+
readonly type: "number";
|
|
47
|
+
readonly label: "First visible index";
|
|
48
|
+
}, {
|
|
49
|
+
readonly path: "lastVisibleIndex";
|
|
50
|
+
readonly type: "number";
|
|
51
|
+
readonly label: "Last visible index";
|
|
52
|
+
}, {
|
|
53
|
+
readonly path: "itemCount";
|
|
54
|
+
readonly type: "number";
|
|
55
|
+
readonly label: "Item count";
|
|
56
|
+
}];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly slots: {
|
|
60
|
+
readonly children: {
|
|
61
|
+
readonly label: "Rail items";
|
|
62
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Card", "Panel", "Image", "ProductCard", "PostCard", "ChatListItem", "MessageBubble"];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly props: {
|
|
66
|
+
readonly itemSize: {
|
|
67
|
+
readonly type: "enum";
|
|
68
|
+
readonly category: "Layout";
|
|
69
|
+
readonly label: "Item size";
|
|
70
|
+
readonly enum: readonly ["compact", "regular", "wide", "responsive"];
|
|
71
|
+
readonly default: "responsive";
|
|
72
|
+
};
|
|
73
|
+
readonly gap: {
|
|
74
|
+
readonly type: "enum";
|
|
75
|
+
readonly category: "Layout";
|
|
76
|
+
readonly label: "Gap";
|
|
77
|
+
readonly enum: readonly ["none", "xs", "s", "m", "l", "xl"];
|
|
78
|
+
readonly default: "m";
|
|
79
|
+
};
|
|
80
|
+
readonly padding: {
|
|
81
|
+
readonly type: "enum";
|
|
82
|
+
readonly category: "Layout";
|
|
83
|
+
readonly label: "Horizontal padding";
|
|
84
|
+
readonly enum: readonly ["none", "xs", "s", "m", "l", "xl"];
|
|
85
|
+
readonly default: "m";
|
|
86
|
+
};
|
|
87
|
+
readonly peek: {
|
|
88
|
+
readonly type: "number";
|
|
89
|
+
readonly category: "Layout";
|
|
90
|
+
readonly label: "Partial next item";
|
|
91
|
+
readonly default: 32;
|
|
92
|
+
};
|
|
93
|
+
readonly showControls: {
|
|
94
|
+
readonly type: "boolean";
|
|
95
|
+
readonly category: "Controls";
|
|
96
|
+
readonly label: "Show controls";
|
|
97
|
+
readonly default: true;
|
|
98
|
+
};
|
|
99
|
+
readonly direction: {
|
|
100
|
+
readonly type: "enum";
|
|
101
|
+
readonly category: "Layout";
|
|
102
|
+
readonly label: "Reading direction";
|
|
103
|
+
readonly enum: readonly ["auto", "ltr", "rtl"];
|
|
104
|
+
readonly default: "auto";
|
|
105
|
+
};
|
|
106
|
+
readonly motion: {
|
|
107
|
+
readonly type: "enum";
|
|
108
|
+
readonly category: "Accessibility";
|
|
109
|
+
readonly label: "Motion";
|
|
110
|
+
readonly enum: readonly ["system", "animated", "reduced"];
|
|
111
|
+
readonly default: "system";
|
|
112
|
+
};
|
|
113
|
+
readonly accessibilityLabel: {
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
readonly category: "Accessibility";
|
|
116
|
+
readonly label: "Rail label";
|
|
117
|
+
readonly default: "Content rail";
|
|
118
|
+
};
|
|
119
|
+
readonly previousLabel: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
readonly category: "Accessibility";
|
|
122
|
+
readonly label: "Previous control label";
|
|
123
|
+
readonly default: "Previous items";
|
|
124
|
+
};
|
|
125
|
+
readonly nextLabel: {
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
readonly category: "Accessibility";
|
|
128
|
+
readonly label: "Next control label";
|
|
129
|
+
readonly default: "Next items";
|
|
130
|
+
};
|
|
131
|
+
readonly onControlPress: {
|
|
132
|
+
readonly type: "action";
|
|
133
|
+
readonly category: "Events";
|
|
134
|
+
readonly label: "Control press action";
|
|
135
|
+
};
|
|
136
|
+
readonly onVisibleRangeChange: {
|
|
137
|
+
readonly type: "action";
|
|
138
|
+
readonly category: "Events";
|
|
139
|
+
readonly label: "Visible range change action";
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/meta.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+HU,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { CONTENT_RAIL_ALLOWED_CHILDREN } from '../../metadata/allowedChildren';
|
|
2
|
+
const spacingValues = ['none', 'xs', 's', 'm', 'l', 'xl'];
|
|
3
|
+
export const contentRailMeta = {
|
|
4
|
+
name: 'ContentRail',
|
|
5
|
+
category: 'pattern',
|
|
6
|
+
description: 'Horizontally browsable child content with responsive sizing, partial-next affordance, and accessible controls.',
|
|
7
|
+
directManifestNode: true,
|
|
8
|
+
allowedChildren: [...CONTENT_RAIL_ALLOWED_CHILDREN],
|
|
9
|
+
blueprint: {
|
|
10
|
+
label: 'Content rail',
|
|
11
|
+
icon: { name: 'albums-outline' },
|
|
12
|
+
defaultProps: {
|
|
13
|
+
itemSize: 'responsive',
|
|
14
|
+
gap: 'm',
|
|
15
|
+
padding: 'm',
|
|
16
|
+
peek: 32,
|
|
17
|
+
showControls: true,
|
|
18
|
+
direction: 'auto',
|
|
19
|
+
motion: 'system',
|
|
20
|
+
accessibilityLabel: 'Content rail',
|
|
21
|
+
previousLabel: 'Previous items',
|
|
22
|
+
nextLabel: 'Next items',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
events: {
|
|
26
|
+
controlPress: {
|
|
27
|
+
label: 'Control press',
|
|
28
|
+
eventType: 'contentRail.controlPress',
|
|
29
|
+
description: 'Emitted after a previous or next control requests a target item.',
|
|
30
|
+
payloadFields: [
|
|
31
|
+
{ path: 'direction', type: 'string', label: 'Direction' },
|
|
32
|
+
{ path: 'targetIndex', type: 'number', label: 'Target index' },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
visibleRangeChange: {
|
|
36
|
+
label: 'Visible range change',
|
|
37
|
+
eventType: 'contentRail.visibleRangeChange',
|
|
38
|
+
description: 'Emitted when the zero-based visible item range changes.',
|
|
39
|
+
payloadFields: [
|
|
40
|
+
{ path: 'firstVisibleIndex', type: 'number', label: 'First visible index' },
|
|
41
|
+
{ path: 'lastVisibleIndex', type: 'number', label: 'Last visible index' },
|
|
42
|
+
{ path: 'itemCount', type: 'number', label: 'Item count' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
slots: {
|
|
47
|
+
children: {
|
|
48
|
+
label: 'Rail items',
|
|
49
|
+
allowedChildren: [...CONTENT_RAIL_ALLOWED_CHILDREN],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
itemSize: {
|
|
54
|
+
type: 'enum',
|
|
55
|
+
category: 'Layout',
|
|
56
|
+
label: 'Item size',
|
|
57
|
+
enum: ['compact', 'regular', 'wide', 'responsive'],
|
|
58
|
+
default: 'responsive',
|
|
59
|
+
},
|
|
60
|
+
gap: {
|
|
61
|
+
type: 'enum',
|
|
62
|
+
category: 'Layout',
|
|
63
|
+
label: 'Gap',
|
|
64
|
+
enum: spacingValues,
|
|
65
|
+
default: 'm',
|
|
66
|
+
},
|
|
67
|
+
padding: {
|
|
68
|
+
type: 'enum',
|
|
69
|
+
category: 'Layout',
|
|
70
|
+
label: 'Horizontal padding',
|
|
71
|
+
enum: spacingValues,
|
|
72
|
+
default: 'm',
|
|
73
|
+
},
|
|
74
|
+
peek: {
|
|
75
|
+
type: 'number',
|
|
76
|
+
category: 'Layout',
|
|
77
|
+
label: 'Partial next item',
|
|
78
|
+
default: 32,
|
|
79
|
+
},
|
|
80
|
+
showControls: {
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
category: 'Controls',
|
|
83
|
+
label: 'Show controls',
|
|
84
|
+
default: true,
|
|
85
|
+
},
|
|
86
|
+
direction: {
|
|
87
|
+
type: 'enum',
|
|
88
|
+
category: 'Layout',
|
|
89
|
+
label: 'Reading direction',
|
|
90
|
+
enum: ['auto', 'ltr', 'rtl'],
|
|
91
|
+
default: 'auto',
|
|
92
|
+
},
|
|
93
|
+
motion: {
|
|
94
|
+
type: 'enum',
|
|
95
|
+
category: 'Accessibility',
|
|
96
|
+
label: 'Motion',
|
|
97
|
+
enum: ['system', 'animated', 'reduced'],
|
|
98
|
+
default: 'system',
|
|
99
|
+
},
|
|
100
|
+
accessibilityLabel: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
category: 'Accessibility',
|
|
103
|
+
label: 'Rail label',
|
|
104
|
+
default: 'Content rail',
|
|
105
|
+
},
|
|
106
|
+
previousLabel: {
|
|
107
|
+
type: 'string',
|
|
108
|
+
category: 'Accessibility',
|
|
109
|
+
label: 'Previous control label',
|
|
110
|
+
default: 'Previous items',
|
|
111
|
+
},
|
|
112
|
+
nextLabel: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
category: 'Accessibility',
|
|
115
|
+
label: 'Next control label',
|
|
116
|
+
default: 'Next items',
|
|
117
|
+
},
|
|
118
|
+
onControlPress: {
|
|
119
|
+
type: 'action',
|
|
120
|
+
category: 'Events',
|
|
121
|
+
label: 'Control press action',
|
|
122
|
+
},
|
|
123
|
+
onVisibleRangeChange: {
|
|
124
|
+
type: 'action',
|
|
125
|
+
category: 'Events',
|
|
126
|
+
label: 'Visible range change action',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,SAAS;IACnB,WAAW,EACT,gHAAgH;IAClH,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,CAAC,GAAG,6BAA6B,CAAC;IACnD,SAAS,EAAE;QACT,KAAK,EA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e;YACzB,KAAK,EAAE,wBAAwB;YAC/B,OAAO,EAAE,gBAAgB;SAC1B;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,eAAe;YACzB,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,YAAY;SACtB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,sBAAsB;SAC9B;QACD,oBAAoB,EAAE;YACpB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,6BAA6B;SACrC;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\nimport { CONTENT_RAIL_ALLOWED_CHILDREN } from '../../metadata/allowedChildren';\n\nconst spacingValues = ['none', 'xs', 's', 'm', 'l', 'xl'] as const;\n\nexport const contentRailMeta = {\n name: 'ContentRail',\n category: 'pattern',\n description:\n 'Horizontally browsable child content with responsive sizing, partial-next affordance, and accessible controls.',\n directManifestNode: true,\n allowedChildren: [...CONTENT_RAIL_ALLOWED_CHILDREN],\n blueprint: {\n label: 'Content rail',\n icon: { name: 'albums-outline' },\n defaultProps: {\n itemSize: 'responsive',\n gap: 'm',\n padding: 'm',\n peek: 32,\n showControls: true,\n direction: 'auto',\n motion: 'system',\n accessibilityLabel: 'Content rail',\n previousLabel: 'Previous items',\n nextLabel: 'Next items',\n },\n },\n events: {\n controlPress: {\n label: 'Control press',\n eventType: 'contentRail.controlPress',\n description: 'Emitted after a previous or next control requests a target item.',\n payloadFields: [\n { path: 'direction', type: 'string', label: 'Direction' },\n { path: 'targetIndex', type: 'number', label: 'Target index' },\n ],\n },\n visibleRangeChange: {\n label: 'Visible range change',\n eventType: 'contentRail.visibleRangeChange',\n description: 'Emitted when the zero-based visible item range changes.',\n payloadFields: [\n { path: 'firstVisibleIndex', type: 'number', label: 'First visible index' },\n { path: 'lastVisibleIndex', type: 'number', label: 'Last visible index' },\n { path: 'itemCount', type: 'number', label: 'Item count' },\n ],\n },\n },\n slots: {\n children: {\n label: 'Rail items',\n allowedChildren: [...CONTENT_RAIL_ALLOWED_CHILDREN],\n },\n },\n props: {\n itemSize: {\n type: 'enum',\n category: 'Layout',\n label: 'Item size',\n enum: ['compact', 'regular', 'wide', 'responsive'],\n default: 'responsive',\n },\n gap: {\n type: 'enum',\n category: 'Layout',\n label: 'Gap',\n enum: spacingValues,\n default: 'm',\n },\n padding: {\n type: 'enum',\n category: 'Layout',\n label: 'Horizontal padding',\n enum: spacingValues,\n default: 'm',\n },\n peek: {\n type: 'number',\n category: 'Layout',\n label: 'Partial next item',\n default: 32,\n },\n showControls: {\n type: 'boolean',\n category: 'Controls',\n label: 'Show controls',\n default: true,\n },\n direction: {\n type: 'enum',\n category: 'Layout',\n label: 'Reading direction',\n enum: ['auto', 'ltr', 'rtl'],\n default: 'auto',\n },\n motion: {\n type: 'enum',\n category: 'Accessibility',\n label: 'Motion',\n enum: ['system', 'animated', 'reduced'],\n default: 'system',\n },\n accessibilityLabel: {\n type: 'string',\n category: 'Accessibility',\n label: 'Rail label',\n default: 'Content rail',\n },\n previousLabel: {\n type: 'string',\n category: 'Accessibility',\n label: 'Previous control label',\n default: 'Previous items',\n },\n nextLabel: {\n type: 'string',\n category: 'Accessibility',\n label: 'Next control label',\n default: 'Next items',\n },\n onControlPress: {\n type: 'action',\n category: 'Events',\n label: 'Control press action',\n },\n onVisibleRangeChange: {\n type: 'action',\n category: 'Events',\n label: 'Visible range change action',\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ContentRailItemSize } from './types';
|
|
2
|
+
export declare function resolveContentRailItemWidth({ gap, itemCount, itemSize, padding, peek, viewportWidth, }: {
|
|
3
|
+
gap: number;
|
|
4
|
+
itemCount: number;
|
|
5
|
+
itemSize: ContentRailItemSize;
|
|
6
|
+
padding: number;
|
|
7
|
+
peek: number;
|
|
8
|
+
viewportWidth: number;
|
|
9
|
+
}): number;
|
|
10
|
+
//# sourceMappingURL=resolveContentRailItemWidth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveContentRailItemWidth.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/resolveContentRailItemWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,2BAA2B,CAAC,EAC1C,GAAG,EACH,SAAS,EACT,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,aAAa,GACd,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAeT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function resolveContentRailItemWidth({ gap, itemCount, itemSize, padding, peek, viewportWidth, }) {
|
|
2
|
+
const availableWidth = Math.max(0, viewportWidth - padding * 2);
|
|
3
|
+
if (availableWidth === 0 || itemCount === 0)
|
|
4
|
+
return 0;
|
|
5
|
+
const fixedWidth = resolveFixedItemWidth(itemSize);
|
|
6
|
+
if (fixedWidth !== undefined)
|
|
7
|
+
return Math.min(fixedWidth, availableWidth);
|
|
8
|
+
const slots = viewportWidth >= 1024 ? 4 : viewportWidth >= 768 ? 3 : viewportWidth >= 480 ? 2 : 1;
|
|
9
|
+
const fullItems = Math.min(slots, itemCount);
|
|
10
|
+
const overflows = itemCount > fullItems;
|
|
11
|
+
const resolvedPeek = overflows ? Math.min(Math.max(0, peek), availableWidth / 2) : 0;
|
|
12
|
+
const gaps = overflows ? fullItems : Math.max(0, fullItems - 1);
|
|
13
|
+
const resolved = (availableWidth - resolvedPeek - gap * gaps) / fullItems;
|
|
14
|
+
return Math.min(280, Math.max(Math.min(96, availableWidth), Math.floor(resolved)));
|
|
15
|
+
}
|
|
16
|
+
function resolveFixedItemWidth(itemSize) {
|
|
17
|
+
if (itemSize === 'compact')
|
|
18
|
+
return 144;
|
|
19
|
+
if (itemSize === 'regular')
|
|
20
|
+
return 200;
|
|
21
|
+
if (itemSize === 'wide')
|
|
22
|
+
return 280;
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=resolveContentRailItemWidth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveContentRailItemWidth.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/resolveContentRailItemWidth.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,2BAA2B,CAAC,EAC1C,GAAG,EACH,SAAS,EACT,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,aAAa,GAQd;IACC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAChE,IAAI,cAAc,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEtD,MAAM,UAAU,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAE1E,MAAM,KAAK,GAAG,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClG,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7C,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACxC,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,CAAC,cAAc,GAAG,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAE1E,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,SAAS,qBAAqB,CAAC,QAA6B;IAC1D,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IACvC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IACvC,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,GAAG,CAAC;IACpC,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { ContentRailItemSize } from './types';\n\nexport function resolveContentRailItemWidth({\n gap,\n itemCount,\n itemSize,\n padding,\n peek,\n viewportWidth,\n}: {\n gap: number;\n itemCount: number;\n itemSize: ContentRailItemSize;\n padding: number;\n peek: number;\n viewportWidth: number;\n}): number {\n const availableWidth = Math.max(0, viewportWidth - padding * 2);\n if (availableWidth === 0 || itemCount === 0) return 0;\n\n const fixedWidth = resolveFixedItemWidth(itemSize);\n if (fixedWidth !== undefined) return Math.min(fixedWidth, availableWidth);\n\n const slots = viewportWidth >= 1024 ? 4 : viewportWidth >= 768 ? 3 : viewportWidth >= 480 ? 2 : 1;\n const fullItems = Math.min(slots, itemCount);\n const overflows = itemCount > fullItems;\n const resolvedPeek = overflows ? Math.min(Math.max(0, peek), availableWidth / 2) : 0;\n const gaps = overflows ? fullItems : Math.max(0, fullItems - 1);\n const resolved = (availableWidth - resolvedPeek - gap * gaps) / fullItems;\n\n return Math.min(280, Math.max(Math.min(96, availableWidth), Math.floor(resolved)));\n}\n\nfunction resolveFixedItemWidth(itemSize: ContentRailItemSize): number | undefined {\n if (itemSize === 'compact') return 144;\n if (itemSize === 'regular') return 200;\n if (itemSize === 'wide') return 280;\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveContentRailPhysicalOffset.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/resolveContentRailPhysicalOffset.ts"],"names":[],"mappings":"AAAA,wBAAgB,gCAAgC,CAAC,EAC/C,KAAK,EACL,aAAa,EACb,SAAS,GACV,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAGT"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function resolveContentRailPhysicalOffset({ isRtl, logicalOffset, maxOffset, }) {
|
|
2
|
+
const clampedOffset = Math.min(Math.max(0, logicalOffset), Math.max(0, maxOffset));
|
|
3
|
+
return isRtl ? Math.max(0, maxOffset) - clampedOffset : clampedOffset;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=resolveContentRailPhysicalOffset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveContentRailPhysicalOffset.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/resolveContentRailPhysicalOffset.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gCAAgC,CAAC,EAC/C,KAAK,EACL,aAAa,EACb,SAAS,GAKV;IACC,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IACnF,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;AACxE,CAAC","sourcesContent":["export function resolveContentRailPhysicalOffset({\n isRtl,\n logicalOffset,\n maxOffset,\n}: {\n isRtl: boolean;\n logicalOffset: number;\n maxOffset: number;\n}): number {\n const clampedOffset = Math.min(Math.max(0, logicalOffset), Math.max(0, maxOffset));\n return isRtl ? Math.max(0, maxOffset) - clampedOffset : clampedOffset;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function resolveContentRailState({ contentWidth, gap, itemCount, itemWidth, logicalOffset, viewportWidth, }: {
|
|
2
|
+
contentWidth: number;
|
|
3
|
+
gap: number;
|
|
4
|
+
itemCount: number;
|
|
5
|
+
itemWidth: number;
|
|
6
|
+
logicalOffset: number;
|
|
7
|
+
viewportWidth: number;
|
|
8
|
+
}): {
|
|
9
|
+
anchorIndex: number;
|
|
10
|
+
canGoNext: boolean;
|
|
11
|
+
canGoPrevious: boolean;
|
|
12
|
+
firstVisibleIndex: number;
|
|
13
|
+
lastVisibleIndex: number;
|
|
14
|
+
maxOffset: number;
|
|
15
|
+
offset: number;
|
|
16
|
+
stride: number;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=resolveContentRailState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveContentRailState.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/resolveContentRailState.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,GAAG,EACH,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,GACd,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;;;;;;;;;EAqBA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function resolveContentRailState({ contentWidth, gap, itemCount, itemWidth, logicalOffset, viewportWidth, }) {
|
|
2
|
+
const maxOffset = Math.max(0, contentWidth - viewportWidth);
|
|
3
|
+
const offset = Math.min(Math.max(0, logicalOffset), maxOffset);
|
|
4
|
+
const stride = itemWidth + gap;
|
|
5
|
+
const firstVisibleIndex = stride > 0 ? Math.min(itemCount - 1, Math.floor(offset / stride)) : 0;
|
|
6
|
+
const lastVisibleIndex = stride > 0
|
|
7
|
+
? Math.min(itemCount - 1, Math.max(0, Math.ceil((offset + viewportWidth) / stride) - 1))
|
|
8
|
+
: 0;
|
|
9
|
+
const anchorIndex = stride > 0 ? Math.round(offset / stride) : 0;
|
|
10
|
+
return {
|
|
11
|
+
anchorIndex: Math.min(Math.max(0, anchorIndex), Math.max(0, itemCount - 1)),
|
|
12
|
+
canGoNext: itemCount > 0 && offset < maxOffset - 1,
|
|
13
|
+
canGoPrevious: itemCount > 0 && offset > 1,
|
|
14
|
+
firstVisibleIndex: itemCount === 0 ? -1 : firstVisibleIndex,
|
|
15
|
+
lastVisibleIndex: itemCount === 0 ? -1 : lastVisibleIndex,
|
|
16
|
+
maxOffset,
|
|
17
|
+
offset,
|
|
18
|
+
stride,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=resolveContentRailState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveContentRailState.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/resolveContentRailState.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAC,EACtC,YAAY,EACZ,GAAG,EAC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iB,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB;QAC3D,gBAAgB,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB;QACzD,SAAS;QACT,MAAM;QACN,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["export function resolveContentRailState({\n contentWidth,\n gap,\n itemCount,\n itemWidth,\n logicalOffset,\n viewportWidth,\n}: {\n contentWidth: number;\n gap: number;\n itemCount: number;\n itemWidth: number;\n logicalOffset: number;\n viewportWidth: number;\n}) {\n const maxOffset = Math.max(0, contentWidth - viewportWidth);\n const offset = Math.min(Math.max(0, logicalOffset), maxOffset);\n const stride = itemWidth + gap;\n const firstVisibleIndex = stride > 0 ? Math.min(itemCount - 1, Math.floor(offset / stride)) : 0;\n const lastVisibleIndex =\n stride > 0\n ? Math.min(itemCount - 1, Math.max(0, Math.ceil((offset + viewportWidth) / stride) - 1))\n : 0;\n const anchorIndex = stride > 0 ? Math.round(offset / stride) : 0;\n\n return {\n anchorIndex: Math.min(Math.max(0, anchorIndex), Math.max(0, itemCount - 1)),\n canGoNext: itemCount > 0 && offset < maxOffset - 1,\n canGoPrevious: itemCount > 0 && offset > 1,\n firstVisibleIndex: itemCount === 0 ? -1 : firstVisibleIndex,\n lastVisibleIndex: itemCount === 0 ? -1 : lastVisibleIndex,\n maxOffset,\n offset,\n stride,\n };\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
3
|
+
export type ContentRailDirection = 'auto' | 'ltr' | 'rtl';
|
|
4
|
+
export type ContentRailItemSize = 'compact' | 'regular' | 'wide' | 'responsive';
|
|
5
|
+
export type ContentRailMotion = 'system' | 'animated' | 'reduced';
|
|
6
|
+
export type ContentRailSpacing = 'none' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
7
|
+
export interface ContentRailControlPressEvent {
|
|
8
|
+
direction: 'previous' | 'next';
|
|
9
|
+
targetIndex: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ContentRailVisibleRangeChangeEvent {
|
|
12
|
+
firstVisibleIndex: number;
|
|
13
|
+
lastVisibleIndex: number;
|
|
14
|
+
itemCount: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ContentRailProps extends ZoraBaseProps {
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
itemSize?: ContentRailItemSize;
|
|
19
|
+
gap?: ContentRailSpacing;
|
|
20
|
+
padding?: ContentRailSpacing;
|
|
21
|
+
peek?: number;
|
|
22
|
+
showControls?: boolean;
|
|
23
|
+
direction?: ContentRailDirection;
|
|
24
|
+
motion?: ContentRailMotion;
|
|
25
|
+
accessibilityLabel?: string;
|
|
26
|
+
previousLabel?: string;
|
|
27
|
+
nextLabel?: string;
|
|
28
|
+
onControlPress?: (event: ContentRailControlPressEvent) => void | Promise<void>;
|
|
29
|
+
onVisibleRangeChange?: (event: ContentRailVisibleRangeChangeEvent) => void | Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;AAChF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAExE,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,UAAU,GAAG,MAAM,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kCAAkC;IACjD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,GAAG,CAAC,EAAE,kBAAkB,CAAC;IACzB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,kCAAkC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport type ContentRailDirection = 'auto' | 'ltr' | 'rtl';\nexport type ContentRailItemSize = 'compact' | 'regular' | 'wide' | 'responsive';\nexport type ContentRailMotion = 'system' | 'animated' | 'reduced';\nexport type ContentRailSpacing = 'none' | 'xs' | 's' | 'm' | 'l' | 'xl';\n\nexport interface ContentRailControlPressEvent {\n direction: 'previous' | 'next';\n targetIndex: number;\n}\n\nexport interface ContentRailVisibleRangeChangeEvent {\n firstVisibleIndex: number;\n lastVisibleIndex: number;\n itemCount: number;\n}\n\nexport interface ContentRailProps extends ZoraBaseProps {\n children?: ReactNode;\n itemSize?: ContentRailItemSize;\n gap?: ContentRailSpacing;\n padding?: ContentRailSpacing;\n peek?: number;\n showControls?: boolean;\n direction?: ContentRailDirection;\n motion?: ContentRailMotion;\n accessibilityLabel?: string;\n previousLabel?: string;\n nextLabel?: string;\n onControlPress?: (event: ContentRailControlPressEvent) => void | Promise<void>;\n onVisibleRangeChange?: (event: ContentRailVisibleRangeChangeEvent) => void | Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContentRailReducedMotion.d.ts","sourceRoot":"","sources":["../../../src/patterns/content-rail/useContentRailReducedMotion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAsB9E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccessibilityInfo } from 'react-native';
|
|
3
|
+
export function useContentRailReducedMotion(motion) {
|
|
4
|
+
const [systemReducedMotion, setSystemReducedMotion] = React.useState(false);
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
if (motion !== 'system')
|
|
7
|
+
return;
|
|
8
|
+
let active = true;
|
|
9
|
+
void AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {
|
|
10
|
+
if (active)
|
|
11
|
+
setSystemReducedMotion(enabled);
|
|
12
|
+
});
|
|
13
|
+
const subscription = AccessibilityInfo.addEventListener('reduceMotionChanged', setSystemReducedMotion);
|
|
14
|
+
return () => {
|
|
15
|
+
active = false;
|
|
16
|
+
subscription.remove();
|
|
17
|
+
};
|
|
18
|
+
}, [motion]);
|
|
19
|
+
return motion === 'reduced' || (motion === 'system' && systemReducedMotion);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=useContentRailReducedMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContentRailReducedMotion.js","sourceRoot":"","sources":["../../../src/patterns/content-rail/useContentRailReducedMotion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIjD,MAAM,UAAU,2BAA2B,CAAC,MAAyB;IACnE,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,MAAM,KAAK,QAAQ;YAAE,OAAO;QAEhC,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,KAAK,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9D,IAAI,MAAM;gBAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,iBAAiB,CAAC,gBAAgB,CACrD,qBAAqB,EACrB,sBAAsB,CACvB,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,MAAM,GAAG,KAAK,CAAC;YACf,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,mBAAmB,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import React from 'react';\nimport { AccessibilityInfo } from 'react-native';\n\nimport type { ContentRailMotion } from './types';\n\nexport function useContentRailReducedMotion(motion: ContentRailMotion): boolean {\n const [systemReducedMotion, setSystemReducedMotion] = React.useState(false);\n\n React.useEffect(() => {\n if (motion !== 'system') return;\n\n let active = true;\n void AccessibilityInfo.isReduceMotionEnabled().then((enabled) => {\n if (active) setSystemReducedMotion(enabled);\n });\n const subscription = AccessibilityInfo.addEventListener(\n 'reduceMotionChanged',\n setSystemReducedMotion,\n );\n\n return () => {\n active = false;\n subscription.remove();\n };\n }, [motion]);\n\n return motion === 'reduced' || (motion === 'system' && systemReducedMotion);\n}\n"]}
|
|
@@ -3,7 +3,7 @@ export declare const messageBubbleMeta: {
|
|
|
3
3
|
readonly category: "pattern";
|
|
4
4
|
readonly description: "Chat/message bubble with direction, author, text, meta, and delivery status presentation.";
|
|
5
5
|
readonly directManifestNode: true;
|
|
6
|
-
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ReaderSurface"];
|
|
6
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "ReaderSurface", "ContentRail"];
|
|
7
7
|
readonly blueprint: {
|
|
8
8
|
readonly label: "Message bubble";
|
|
9
9
|
readonly icon: {
|
|
@@ -2,7 +2,7 @@ export declare const noticeMeta: {
|
|
|
2
2
|
readonly name: "Notice";
|
|
3
3
|
readonly category: "pattern";
|
|
4
4
|
readonly directManifestNode: true;
|
|
5
|
-
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ReaderSurface"];
|
|
5
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "ReaderSurface", "ContentRail"];
|
|
6
6
|
readonly blueprint: {
|
|
7
7
|
readonly label: "Notice";
|
|
8
8
|
readonly defaultProps: {
|
|
@@ -2,7 +2,7 @@ export declare const panelMeta: {
|
|
|
2
2
|
readonly name: "Panel";
|
|
3
3
|
readonly category: "pattern";
|
|
4
4
|
readonly directManifestNode: true;
|
|
5
|
-
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ReaderSurface"];
|
|
5
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "ReaderSurface", "ContentRail"];
|
|
6
6
|
readonly blueprint: {
|
|
7
7
|
readonly label: "Panel";
|
|
8
8
|
readonly defaultProps: {
|
|
@@ -3,7 +3,7 @@ export declare const postCardMeta: {
|
|
|
3
3
|
readonly category: "pattern";
|
|
4
4
|
readonly description: "Social/content post card with author identity, body, media, actions, and comment previews.";
|
|
5
5
|
readonly directManifestNode: true;
|
|
6
|
-
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ReaderSurface"];
|
|
6
|
+
readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "ButtonGroup", "ThemeModeToggle", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "ReaderSurface", "ContentRail"];
|
|
7
7
|
readonly blueprint: {
|
|
8
8
|
readonly label: "Post card";
|
|
9
9
|
readonly icon: {
|