@platform-blocks/ui 0.6.0 → 0.7.0
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/README.md +0 -24
- package/lib/cjs/index.js +476 -720
- package/lib/cjs/index.js.map +1 -1
- package/lib/components/Accordion/types.d.ts +5 -5
- package/lib/components/AutoComplete/types.d.ts +3 -3
- package/lib/components/Avatar/types.d.ts +3 -3
- package/lib/components/Badge/types.d.ts +3 -3
- package/lib/components/Block/types.d.ts +2 -2
- package/lib/components/Blockquote/types.d.ts +2 -2
- package/lib/components/Breadcrumbs/types.d.ts +4 -4
- package/lib/components/Calendar/types.d.ts +2 -2
- package/lib/components/Carousel/types.d.ts +3 -3
- package/lib/components/Chip/types.d.ts +3 -3
- package/lib/components/CodeBlock/types.d.ts +4 -4
- package/lib/components/ColorPicker/types.d.ts +4 -4
- package/lib/components/CopyButton/types.d.ts +2 -2
- package/lib/components/DatePicker/types.d.ts +2 -2
- package/lib/components/Dialog/Dialog.d.ts +1 -1
- package/lib/components/Dialog/types.d.ts +23 -2
- package/lib/components/Divider/types.d.ts +2 -2
- package/lib/components/Grid/types.d.ts +3 -3
- package/lib/components/HoverCard/types.d.ts +3 -3
- package/lib/components/Image/Image.d.ts +1 -1
- package/lib/components/Image/types.d.ts +6 -6
- package/lib/components/Indicator/types.d.ts +2 -2
- package/lib/components/Input/styles.d.ts +1 -12
- package/lib/components/Knob/components/SurfaceLayers.d.ts +2 -2
- package/lib/components/Knob/components/ThumbLayer.d.ts +1 -1
- package/lib/components/Knob/components/TickLayers.d.ts +2 -2
- package/lib/components/Knob/types.d.ts +11 -11
- package/lib/components/Layout/Layout.d.ts +1 -0
- package/lib/components/ListGroup/types.d.ts +4 -4
- package/lib/components/Loader/types.d.ts +2 -2
- package/lib/components/Masonry/types.d.ts +4 -4
- package/lib/components/Menu/types.d.ts +2 -2
- package/lib/components/Navigation/types.d.ts +2 -2
- package/lib/components/Notice/types.d.ts +2 -2
- package/lib/components/Pagination/types.d.ts +6 -6
- package/lib/components/Popover/types.d.ts +5 -5
- package/lib/components/Progress/types.d.ts +3 -3
- package/lib/components/QRCode/types.d.ts +2 -2
- package/lib/components/Rating/types.d.ts +2 -2
- package/lib/components/Ring/types.d.ts +7 -7
- package/lib/components/SegmentedControl/types.d.ts +4 -4
- package/lib/components/Select/Select.types.d.ts +1 -1
- package/lib/components/Skeleton/types.d.ts +4 -4
- package/lib/components/Slider/types.d.ts +7 -7
- package/lib/components/Spotlight/types.d.ts +6 -6
- package/lib/components/Table/Table.d.ts +4 -4
- package/lib/components/Tabs/types.d.ts +5 -5
- package/lib/components/TextArea/types.d.ts +2 -2
- package/lib/components/Timeline/types.d.ts +20 -0
- package/lib/components/Toast/types.d.ts +2 -2
- package/lib/components/Tooltip/types.d.ts +2 -2
- package/lib/components/Video/NativeVideoPlayer.d.ts +2 -2
- package/lib/components/Video/VideoControls.d.ts +2 -2
- package/lib/components/Video/YouTubePlayer.d.ts +2 -2
- package/lib/components/Video/types.d.ts +6 -6
- package/lib/components/Waveform/WaveformSkeleton.d.ts +2 -2
- package/lib/components/Waveform/types.d.ts +2 -2
- package/lib/components/index.d.ts +0 -2
- package/lib/components/types.d.ts +0 -1
- package/lib/core/utils/layout.d.ts +13 -16
- package/lib/core/utils/positioning-enhanced.d.ts +2 -0
- package/lib/esm/index.js +478 -720
- package/lib/esm/index.js.map +1 -1
- package/lib/index.d.ts +0 -4
- package/package.json +67 -57
- package/lib/components/Lottie/Lottie.d.ts +0 -30
- package/lib/components/Lottie/index.d.ts +0 -2
- package/lib/components/RichTextEditor/RichTextEditor.d.ts +0 -3
- package/lib/components/RichTextEditor/index.d.ts +0 -2
- package/lib/components/RichTextEditor/styles.d.ts +0 -61
- package/lib/components/RichTextEditor/types.d.ts +0 -150
package/lib/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { createContext, useContext, useMemo, useEffect, useState, useRef, useCallback, forwardRef, memo, useReducer, isValidElement, cloneElement, useImperativeHandle } from 'react';
|
|
4
|
-
import { Platform, Modal, StyleSheet, View, Pressable, I18nManager, Keyboard, Dimensions, Text as Text$1, AccessibilityInfo, findNodeHandle, Animated as Animated$1, Easing, AppState, useWindowDimensions, PanResponder, BackHandler, Appearance, PixelRatio, NativeModules, TextInput, ScrollView, KeyboardAvoidingView, TouchableOpacity, FlatList, Linking, Image as Image$1, InteractionManager, StatusBar as StatusBar$1
|
|
4
|
+
import { Platform, Modal, StyleSheet, View, Pressable, I18nManager, Keyboard, Dimensions, Text as Text$1, AccessibilityInfo, findNodeHandle, Animated as Animated$1, Easing, AppState, useWindowDimensions, PanResponder, BackHandler, Appearance, PixelRatio, NativeModules, TextInput, ScrollView, KeyboardAvoidingView, TouchableOpacity, FlatList, Linking, Image as Image$1, InteractionManager, StatusBar as StatusBar$1 } from 'react-native';
|
|
5
5
|
import Animated, { useSharedValue, withRepeat, withTiming, cancelAnimation, useAnimatedStyle, interpolate, Extrapolation, withSpring, Easing as Easing$1, runOnJS, withSequence, withDelay, interpolateColor, useDerivedValue, ReduceMotion } from 'react-native-reanimated';
|
|
6
6
|
import { useSafeAreaInsets, SafeAreaInsetsContext, SafeAreaView, SafeAreaProvider } from 'react-native-safe-area-context';
|
|
7
7
|
import Svg, { Path, Defs, LinearGradient, Stop, Circle, Line, G, Text as Text$2, Rect, RadialGradient, ClipPath } from 'react-native-svg';
|
|
@@ -706,16 +706,16 @@ const DARK_THEME = {
|
|
|
706
706
|
'#F2F2F7'
|
|
707
707
|
],
|
|
708
708
|
highlight: [
|
|
709
|
-
'#
|
|
710
|
-
'#
|
|
711
|
-
'#
|
|
712
|
-
'#
|
|
713
|
-
'#
|
|
714
|
-
'#
|
|
715
|
-
'#
|
|
716
|
-
'#
|
|
717
|
-
'#
|
|
718
|
-
'#
|
|
709
|
+
'#1E3A5F', // Deep blue
|
|
710
|
+
'#1E4976', //
|
|
711
|
+
'#1D5A8F', //
|
|
712
|
+
'#2563EB', // Bright blue
|
|
713
|
+
'#3B82F6', // Primary blue
|
|
714
|
+
'#60A5FA', // Light blue
|
|
715
|
+
'#93C5FD', //
|
|
716
|
+
'#BFDBFE', //
|
|
717
|
+
'#DBEAFE', //
|
|
718
|
+
'#EFF6FF' // Very light blue
|
|
719
719
|
],
|
|
720
720
|
pink: [
|
|
721
721
|
'#831843', '#9D174D', '#BE185D', '#DB2777', '#EC4899',
|
|
@@ -771,9 +771,9 @@ const DARK_THEME = {
|
|
|
771
771
|
},
|
|
772
772
|
states: {
|
|
773
773
|
focusRing: 'rgba(10,132,255,0.55)',
|
|
774
|
-
textSelection: 'rgba(
|
|
775
|
-
highlightText: '#
|
|
776
|
-
highlightBackground: 'rgba(
|
|
774
|
+
textSelection: 'rgba(10, 132, 255, 0.25)', // Primary blue for selection
|
|
775
|
+
highlightText: '#60A5FA', // primary[4] - bright blue for good contrast on dark
|
|
776
|
+
highlightBackground: 'rgba(59, 130, 246, 0.35)' // primary[5] with transparency
|
|
777
777
|
},
|
|
778
778
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
|
|
779
779
|
fontSizes: {
|
|
@@ -862,6 +862,8 @@ const DARK_THEME = {
|
|
|
862
862
|
const optionalModuleCache = new Map();
|
|
863
863
|
const isDev = typeof __DEV__ !== 'undefined' ? __DEV__ : process.env.NODE_ENV !== 'production';
|
|
864
864
|
// Metro bundler requires static string literals for require; keep all optional modules here.
|
|
865
|
+
// NOTE: Do NOT add react-syntax-highlighter here - it causes Metro to fail on native
|
|
866
|
+
// when the package isn't installed. Instead, pass the loader dynamically from web-only code.
|
|
865
867
|
const optionalModuleLoaders = {
|
|
866
868
|
'react-native': () => require('react-native'),
|
|
867
869
|
'expo-clipboard': () => require('expo-clipboard'),
|
|
@@ -870,21 +872,9 @@ const optionalModuleLoaders = {
|
|
|
870
872
|
'expo-document-picker': () => require('expo-document-picker'),
|
|
871
873
|
'react-native-webview': () => require('react-native-webview'),
|
|
872
874
|
'lodash.debounce': () => require('lodash.debounce'),
|
|
873
|
-
'react-syntax-highlighter': () => require('react-syntax-highlighter'),
|
|
874
|
-
'react-syntax-highlighter/dist/esm/languages/prism/jsx': () => require('react-syntax-highlighter/dist/esm/languages/prism/jsx'),
|
|
875
|
-
'react-syntax-highlighter/dist/esm/languages/prism/tsx': () => require('react-syntax-highlighter/dist/esm/languages/prism/tsx'),
|
|
876
|
-
'react-syntax-highlighter/dist/esm/languages/prism/typescript': () => require('react-syntax-highlighter/dist/esm/languages/prism/typescript'),
|
|
877
|
-
'react-syntax-highlighter/dist/esm/languages/prism/javascript': () => require('react-syntax-highlighter/dist/esm/languages/prism/javascript'),
|
|
878
|
-
'react-syntax-highlighter/dist/esm/languages/prism/json': () => require('react-syntax-highlighter/dist/esm/languages/prism/json'),
|
|
879
|
-
'react-syntax-highlighter/dist/esm/languages/prism/bash': () => require('react-syntax-highlighter/dist/esm/languages/prism/bash'),
|
|
880
|
-
'react-syntax-highlighter/dist/esm/styles/prism/prism': () => require('react-syntax-highlighter/dist/esm/styles/prism/prism'),
|
|
881
|
-
'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus': () => require('react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus'),
|
|
882
875
|
'expo-audio': () => require('expo-audio'),
|
|
883
876
|
'react-native-gesture-handler': () => require('react-native-gesture-handler'),
|
|
884
877
|
'expo-status-bar': () => require('expo-status-bar'),
|
|
885
|
-
'lottie-react': () => require('lottie-react'),
|
|
886
|
-
'@lottiefiles/dotlottie-react': () => require('@lottiefiles/dotlottie-react'),
|
|
887
|
-
'lottie-react-native': () => require('lottie-react-native'),
|
|
888
878
|
'expo-navigation-bar': () => require('expo-navigation-bar'),
|
|
889
879
|
};
|
|
890
880
|
/**
|
|
@@ -1972,7 +1962,6 @@ function resolveComponentSize(value, scale, options = {}) {
|
|
|
1972
1962
|
}
|
|
1973
1963
|
const firstAvailable = allowed.find(key => scale[key] !== undefined);
|
|
1974
1964
|
if (firstAvailable && scale[firstAvailable] !== undefined) {
|
|
1975
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1976
1965
|
return scale[firstAvailable];
|
|
1977
1966
|
}
|
|
1978
1967
|
throw new Error('resolveComponentSize: no matching size found in provided scale.');
|
|
@@ -2334,18 +2323,17 @@ function extractSpacingProps(props) {
|
|
|
2334
2323
|
*
|
|
2335
2324
|
* @param props - The layout properties object
|
|
2336
2325
|
* @param props.fullWidth - When true, sets width to 100%
|
|
2337
|
-
* @param props.w -
|
|
2338
|
-
* @param props.
|
|
2339
|
-
* @param props.
|
|
2340
|
-
* @param props.
|
|
2341
|
-
* @param props.
|
|
2342
|
-
* @param props.
|
|
2343
|
-
* @param props.minHeight - Minimum height constraint
|
|
2326
|
+
* @param props.w - Width property (overrides fullWidth)
|
|
2327
|
+
* @param props.h - Height value
|
|
2328
|
+
* @param props.maxW - Maximum width constraint
|
|
2329
|
+
* @param props.minW - Minimum width constraint
|
|
2330
|
+
* @param props.maxH - Maximum height constraint
|
|
2331
|
+
* @param props.minH - Minimum height constraint
|
|
2344
2332
|
*
|
|
2345
2333
|
* @returns A partial ViewStyle object containing the computed layout styles
|
|
2346
2334
|
*
|
|
2347
2335
|
* @remarks
|
|
2348
|
-
* Property precedence for width:
|
|
2336
|
+
* Property precedence for width: w > fullWidth
|
|
2349
2337
|
* The function processes width properties in order of specificity, with more specific
|
|
2350
2338
|
* properties overriding more general ones.
|
|
2351
2339
|
*/
|
|
@@ -2355,43 +2343,38 @@ function getLayoutStyles(props) {
|
|
|
2355
2343
|
if (props.fullWidth) {
|
|
2356
2344
|
styles.width = '100%';
|
|
2357
2345
|
}
|
|
2358
|
-
// Handle
|
|
2346
|
+
// Handle width prop (overrides fullWidth)
|
|
2359
2347
|
if (props.w !== undefined) {
|
|
2360
2348
|
styles.width = props.w;
|
|
2361
2349
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
styles.width = props.width;
|
|
2365
|
-
}
|
|
2366
|
-
if (props.height !== undefined) {
|
|
2367
|
-
styles.height = props.height;
|
|
2350
|
+
if (props.h !== undefined) {
|
|
2351
|
+
styles.height = props.h;
|
|
2368
2352
|
}
|
|
2369
|
-
if (props.
|
|
2370
|
-
styles.maxWidth = props.
|
|
2353
|
+
if (props.maxW !== undefined) {
|
|
2354
|
+
styles.maxWidth = props.maxW;
|
|
2371
2355
|
}
|
|
2372
|
-
if (props.
|
|
2373
|
-
styles.minWidth = props.
|
|
2356
|
+
if (props.minW !== undefined) {
|
|
2357
|
+
styles.minWidth = props.minW;
|
|
2374
2358
|
}
|
|
2375
|
-
if (props.
|
|
2376
|
-
styles.maxHeight = props.
|
|
2359
|
+
if (props.maxH !== undefined) {
|
|
2360
|
+
styles.maxHeight = props.maxH;
|
|
2377
2361
|
}
|
|
2378
|
-
if (props.
|
|
2379
|
-
styles.minHeight = props.
|
|
2362
|
+
if (props.minH !== undefined) {
|
|
2363
|
+
styles.minHeight = props.minH;
|
|
2380
2364
|
}
|
|
2381
2365
|
return styles;
|
|
2382
2366
|
}
|
|
2383
2367
|
// Helper to extract layout props from component props
|
|
2384
2368
|
function extractLayoutProps(props) {
|
|
2385
|
-
const { fullWidth, w,
|
|
2369
|
+
const { fullWidth, w, h, maxW, minW, maxH, minH, ...otherProps } = props;
|
|
2386
2370
|
const layoutProps = {
|
|
2387
2371
|
fullWidth,
|
|
2388
2372
|
w,
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
minHeight
|
|
2373
|
+
h,
|
|
2374
|
+
maxW,
|
|
2375
|
+
minW,
|
|
2376
|
+
maxH,
|
|
2377
|
+
minH
|
|
2395
2378
|
};
|
|
2396
2379
|
return { layoutProps, otherProps };
|
|
2397
2380
|
}
|
|
@@ -2660,7 +2643,7 @@ async function measureAsyncPerformance(name, fn) {
|
|
|
2660
2643
|
const OVERLAY_CACHE_LIMIT = 200;
|
|
2661
2644
|
const overlayPositionCache = new Map();
|
|
2662
2645
|
const formatNumber = (value) => Number.isFinite(value) ? Math.round(value * 100) / 100 : 0;
|
|
2663
|
-
const createOverlayCacheKey = (anchorX, anchorY, anchorWidth, anchorHeight, overlayWidth, overlayHeight, placement, offset, viewport, strategy, flip, shift, boundary) => {
|
|
2646
|
+
const createOverlayCacheKey = (anchorX, anchorY, anchorWidth, anchorHeight, overlayWidth, overlayHeight, placement, offset, viewport, strategy, flip, shift, boundary, matchAnchorWidth) => {
|
|
2664
2647
|
return [
|
|
2665
2648
|
formatNumber(anchorX),
|
|
2666
2649
|
formatNumber(anchorY),
|
|
@@ -2677,6 +2660,7 @@ const createOverlayCacheKey = (anchorX, anchorY, anchorWidth, anchorHeight, over
|
|
|
2677
2660
|
flip ? '1' : '0',
|
|
2678
2661
|
shift ? '1' : '0',
|
|
2679
2662
|
formatNumber(boundary),
|
|
2663
|
+
matchAnchorWidth ? '1' : '0',
|
|
2680
2664
|
Platform.OS,
|
|
2681
2665
|
].join('|');
|
|
2682
2666
|
};
|
|
@@ -2722,11 +2706,12 @@ registerViewportListeners();
|
|
|
2722
2706
|
* Enhanced overlay positioning that prevents off-screen rendering with intelligent caching
|
|
2723
2707
|
*/
|
|
2724
2708
|
function calculateOverlayPositionEnhanced(anchor, overlay, options = {}) {
|
|
2725
|
-
const { placement = 'auto', offset = 8, viewport = getViewport(), strategy = 'fixed', flip = true, shift = true, boundary = 8, fallbackPlacements = ['bottom', 'top', 'right', 'left'] } = options;
|
|
2709
|
+
const { placement = 'auto', offset = 8, viewport = getViewport(), strategy = 'fixed', flip = true, shift = true, boundary = 8, fallbackPlacements = ['bottom', 'top', 'right', 'left'], matchAnchorWidth = false, } = options;
|
|
2726
2710
|
// If overlay height is unknown/small (pre-measure), use a heuristic height for decision-making
|
|
2727
2711
|
// This helps avoid choosing "bottom" when near the bottom of the viewport.
|
|
2728
2712
|
const heuristicHeight = Math.max(overlay.height || 0, 240);
|
|
2729
|
-
|
|
2713
|
+
// When matchAnchorWidth is true, use anchor width for overlay width calculations
|
|
2714
|
+
const overlayWidth = matchAnchorWidth ? anchor.width : overlay.width;
|
|
2730
2715
|
const overlayHeight = overlay.height > 0 ? overlay.height : heuristicHeight;
|
|
2731
2716
|
// Account for scroll if using absolute positioning
|
|
2732
2717
|
const scrollX = (Platform.OS === 'web' && strategy === 'absolute')
|
|
@@ -2737,7 +2722,7 @@ function calculateOverlayPositionEnhanced(anchor, overlay, options = {}) {
|
|
|
2737
2722
|
const anchorX = anchor.x + scrollX;
|
|
2738
2723
|
const anchorY = anchor.y + scrollY;
|
|
2739
2724
|
// Check cache first
|
|
2740
|
-
const cacheKey = createOverlayCacheKey(anchorX, anchorY, anchor.width, anchor.height, overlayWidth, overlayHeight, placement, offset, viewport, strategy, flip, shift, boundary);
|
|
2725
|
+
const cacheKey = createOverlayCacheKey(anchorX, anchorY, anchor.width, anchor.height, overlayWidth, overlayHeight, placement, offset, viewport, strategy, flip, shift, boundary, matchAnchorWidth);
|
|
2741
2726
|
const cached = getCachedOverlayPosition(cacheKey);
|
|
2742
2727
|
if (cached) {
|
|
2743
2728
|
return cached;
|
|
@@ -2805,10 +2790,14 @@ function calculateOverlayPositionEnhanced(anchor, overlay, options = {}) {
|
|
|
2805
2790
|
// If enforcement moved the overlay to the opposite vertical side to avoid covering the anchor,
|
|
2806
2791
|
// reflect that in the returned placement so arrows/styles are consistent.
|
|
2807
2792
|
const resolvedPlacement = adjustPlacementIfMoved(finalPlacement, result, anchorRect);
|
|
2793
|
+
// When matchAnchorWidth is true, preserve anchor width without constraining to maxWidth
|
|
2794
|
+
const computedFinalWidth = matchAnchorWidth
|
|
2795
|
+
? anchor.width
|
|
2796
|
+
: Math.min(result.finalWidth || overlay.width, result.maxWidth || overlay.width);
|
|
2808
2797
|
const finalResult = {
|
|
2809
2798
|
...result,
|
|
2810
2799
|
placement: resolvedPlacement,
|
|
2811
|
-
finalWidth:
|
|
2800
|
+
finalWidth: computedFinalWidth,
|
|
2812
2801
|
finalHeight: Math.min(result.finalHeight || overlay.height, result.maxHeight || overlay.height),
|
|
2813
2802
|
};
|
|
2814
2803
|
// Cache the result
|
|
@@ -3565,9 +3554,14 @@ const Text = (allProps) => {
|
|
|
3565
3554
|
}
|
|
3566
3555
|
// Platform-specific rendering
|
|
3567
3556
|
if (Platform.OS === 'web' && isHTMLVariant(htmlTag)) {
|
|
3568
|
-
const
|
|
3569
|
-
|
|
3570
|
-
|
|
3557
|
+
const styleArray = Array.isArray(style) ? style : [style];
|
|
3558
|
+
const hasDisplayOverride = styleArray.some((item) => item && ((item.display !== undefined) || (item.whiteSpace !== undefined)));
|
|
3559
|
+
const webStyles = convertToWebStyles([
|
|
3560
|
+
textStyles,
|
|
3561
|
+
spacingStyles,
|
|
3562
|
+
style,
|
|
3563
|
+
// default to inline unless caller explicitly requests display/whitespace behavior
|
|
3564
|
+
...(hasDisplayOverride ? [] : [{ display: 'inline' }]),
|
|
3571
3565
|
]);
|
|
3572
3566
|
// Handle text selection for web
|
|
3573
3567
|
if (!selectable) {
|
|
@@ -6243,7 +6237,7 @@ const Button = (allProps) => {
|
|
|
6243
6237
|
// Use the actual measured width instead of character-based estimates
|
|
6244
6238
|
const layoutStyles = {
|
|
6245
6239
|
...baseLayoutStyles,
|
|
6246
|
-
...(loading && measuredWidth && !layoutProps.
|
|
6240
|
+
...(loading && measuredWidth && !layoutProps.w && !layoutProps.fullWidth
|
|
6247
6241
|
? { width: measuredWidth, minWidth: measuredWidth }
|
|
6248
6242
|
: {})
|
|
6249
6243
|
};
|
|
@@ -6677,18 +6671,22 @@ const useSafeSafeAreaInsets = () => {
|
|
|
6677
6671
|
return { top: 0, bottom: 0, left: 0, right: 0 };
|
|
6678
6672
|
}
|
|
6679
6673
|
};
|
|
6680
|
-
function Dialog({ visible, variant = 'modal', title, children, closable = true, backdrop = true, backdropClosable = true, shouldClose = false, onClose,
|
|
6674
|
+
function Dialog({ visible, variant = 'modal', title, children, closable = true, backdrop = true, backdropClosable = true, shouldClose = false, onClose, w, h, radius, style, showHeader = true, bottomSheetSwipeZone = 'container', }) {
|
|
6681
6675
|
const theme = useTheme();
|
|
6682
6676
|
const { isRTL } = useDirection();
|
|
6683
6677
|
const insets = useSafeSafeAreaInsets();
|
|
6684
6678
|
const { width: screenWidth, height: screenHeight } = useWindowDimensions();
|
|
6685
6679
|
const horizontalMargin = 32; // safety margin so dialog never touches edges
|
|
6686
6680
|
const isNativePlatform = Platform.OS === 'ios' || Platform.OS === 'android';
|
|
6687
|
-
const defaultModalMaxWidth = Math.min((
|
|
6681
|
+
const defaultModalMaxWidth = Math.min((w || 500), Math.max(200, screenWidth - horizontalMargin));
|
|
6688
6682
|
const modalEffectiveWidth = variant !== 'modal'
|
|
6689
6683
|
? undefined
|
|
6690
6684
|
: Math.min(defaultModalMaxWidth, screenWidth - horizontalMargin);
|
|
6691
|
-
const bottomSheetMaxWidth = Math.min(
|
|
6685
|
+
const bottomSheetMaxWidth = Math.min(w ? w : (isNativePlatform ? 720 : Math.min(600, screenWidth - horizontalMargin)), screenWidth);
|
|
6686
|
+
const resolvedRadius = radius !== null && radius !== void 0 ? radius : (variant === 'bottomsheet' ? 20 : 16);
|
|
6687
|
+
const resolvedMaxHeight = variant === 'bottomsheet'
|
|
6688
|
+
? (h !== null && h !== void 0 ? h : Math.max(200, screenHeight - insets.top - 24))
|
|
6689
|
+
: (variant === 'fullscreen' ? '100%' : (h || '90%'));
|
|
6692
6690
|
const invokeOnClose = useCallback(() => {
|
|
6693
6691
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
6694
6692
|
}, [onClose]);
|
|
@@ -6704,23 +6702,25 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
6704
6702
|
}, visible && closable);
|
|
6705
6703
|
// Pan responder for bottomsheet swipe-to-dismiss
|
|
6706
6704
|
const panResponder = useRef(PanResponder.create({
|
|
6705
|
+
onStartShouldSetPanResponderCapture: () => {
|
|
6706
|
+
// Never capture on touch start — let events reach children (buttons) first
|
|
6707
|
+
return false;
|
|
6708
|
+
},
|
|
6707
6709
|
onStartShouldSetPanResponder: () => {
|
|
6708
|
-
//
|
|
6710
|
+
// Claim in bubble phase (after children had their chance to claim).
|
|
6711
|
+
// If a Button/Pressable already claimed the touch, this won't fire.
|
|
6712
|
+
// If nothing claimed (e.g. drag handle, empty space), we take over for swipe tracking.
|
|
6709
6713
|
return variant === 'bottomsheet' && bottomSheetSwipeZone !== 'none';
|
|
6710
6714
|
},
|
|
6711
|
-
|
|
6712
|
-
//
|
|
6713
|
-
return
|
|
6715
|
+
onMoveShouldSetPanResponderCapture: () => {
|
|
6716
|
+
// Never capture moves — let children handle their own gestures
|
|
6717
|
+
return false;
|
|
6714
6718
|
},
|
|
6715
6719
|
onMoveShouldSetPanResponder: (_, gestureState) => {
|
|
6716
|
-
//
|
|
6720
|
+
// Claim the gesture when there's a clear vertical swipe movement
|
|
6717
6721
|
return variant === 'bottomsheet' && bottomSheetSwipeZone !== 'none' && (Math.abs(gestureState.dy) > Math.abs(gestureState.dx) &&
|
|
6718
6722
|
Math.abs(gestureState.dy) > 2);
|
|
6719
6723
|
},
|
|
6720
|
-
onMoveShouldSetPanResponderCapture: () => {
|
|
6721
|
-
// Already captured on start; keep returning true for consistency
|
|
6722
|
-
return variant === 'bottomsheet' && bottomSheetSwipeZone !== 'none';
|
|
6723
|
-
},
|
|
6724
6724
|
onPanResponderGrant: (evt) => {
|
|
6725
6725
|
// Prevent default browser behavior (text selection, etc.) on web
|
|
6726
6726
|
if (Platform.OS === 'web') {
|
|
@@ -6744,20 +6744,12 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
6744
6744
|
event.preventDefault();
|
|
6745
6745
|
}
|
|
6746
6746
|
}
|
|
6747
|
-
//
|
|
6748
|
-
const dragDistance = gestureState.dy;
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
slideAnim.value = resistedDistance;
|
|
6754
|
-
}
|
|
6755
|
-
else {
|
|
6756
|
-
// Upward movement - apply rubber band effect
|
|
6757
|
-
const upwardResistance = 0.3;
|
|
6758
|
-
const rubberBandDistance = dragDistance * upwardResistance;
|
|
6759
|
-
slideAnim.value = rubberBandDistance;
|
|
6760
|
-
}
|
|
6747
|
+
// Only allow downward movement (dismiss gesture)
|
|
6748
|
+
const dragDistance = Math.max(0, gestureState.dy);
|
|
6749
|
+
// Downward movement - apply subtle resistance for better feel
|
|
6750
|
+
const resistance = 0.8;
|
|
6751
|
+
const resistedDistance = dragDistance * resistance + (dragDistance > 100 ? (dragDistance - 100) * 0.2 : 0);
|
|
6752
|
+
slideAnim.value = resistedDistance;
|
|
6761
6753
|
}
|
|
6762
6754
|
},
|
|
6763
6755
|
onPanResponderRelease: (_, gestureState) => {
|
|
@@ -6914,8 +6906,8 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
6914
6906
|
}, [shouldClose]);
|
|
6915
6907
|
const isDark = theme.colorScheme === 'dark';
|
|
6916
6908
|
const surfaceColor = isDark ? theme.backgrounds.surface : '#FFFFFF';
|
|
6917
|
-
|
|
6918
|
-
const headerBg =
|
|
6909
|
+
isDark ? theme.colors.gray[6] : '#E1E3E6';
|
|
6910
|
+
const headerBg = surfaceColor;
|
|
6919
6911
|
const contentBg = surfaceColor;
|
|
6920
6912
|
const dynamicStyles = StyleSheet.create({
|
|
6921
6913
|
backdrop: {
|
|
@@ -6926,24 +6918,28 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
6926
6918
|
}, // Allow backdropFilter on web
|
|
6927
6919
|
modalContainer: {
|
|
6928
6920
|
backgroundColor: contentBg,
|
|
6929
|
-
borderRadius: variant === 'fullscreen' ? 0 :
|
|
6930
|
-
|
|
6931
|
-
|
|
6921
|
+
borderRadius: variant === 'fullscreen' ? 0 : resolvedRadius,
|
|
6922
|
+
...(variant === 'bottomsheet' ? {
|
|
6923
|
+
borderBottomLeftRadius: 0,
|
|
6924
|
+
borderBottomRightRadius: 0,
|
|
6925
|
+
} : {}),
|
|
6926
|
+
overflow: 'hidden', // Clip content to border radius
|
|
6932
6927
|
// Clamp width to viewport (minus margins) while respecting provided width
|
|
6933
6928
|
maxWidth: variant === 'fullscreen'
|
|
6934
6929
|
? '100%'
|
|
6935
6930
|
: variant === 'bottomsheet'
|
|
6936
6931
|
? bottomSheetMaxWidth
|
|
6937
6932
|
: defaultModalMaxWidth,
|
|
6938
|
-
maxHeight:
|
|
6933
|
+
maxHeight: resolvedMaxHeight,
|
|
6939
6934
|
width: variant === 'fullscreen'
|
|
6940
6935
|
? '100%'
|
|
6941
6936
|
: variant === 'modal'
|
|
6942
6937
|
? modalEffectiveWidth || 'auto'
|
|
6943
6938
|
: '100%',
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6939
|
+
// Fullscreen uses 100% height, others auto-size to content
|
|
6940
|
+
height: variant === 'fullscreen' ? '100%' : undefined,
|
|
6941
|
+
// Only fullscreen should stretch to fill
|
|
6942
|
+
...(variant === 'fullscreen' ? { flex: 1 } : {}),
|
|
6947
6943
|
// Ensure minWidth never exceeds viewport clamp
|
|
6948
6944
|
minWidth: variant === 'modal' ? Math.min(300, Math.max(200, screenWidth - horizontalMargin)) : undefined,
|
|
6949
6945
|
alignSelf: variant === 'bottomsheet' ? 'center' : 'center',
|
|
@@ -6969,24 +6965,27 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
6969
6965
|
}
|
|
6970
6966
|
: Platform.OS === 'android' && variant !== 'fullscreen'
|
|
6971
6967
|
? { elevation: 16, }
|
|
6972
|
-
:
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6968
|
+
: variant === 'fullscreen'
|
|
6969
|
+
? {
|
|
6970
|
+
boxShadow: 'none',
|
|
6971
|
+
height: '100%',
|
|
6972
|
+
position: 'absolute',
|
|
6973
|
+
}
|
|
6974
|
+
: { boxShadow: 'none' }),
|
|
6977
6975
|
}, // Allow boxShadow on web
|
|
6978
6976
|
header: {
|
|
6979
6977
|
alignItems: 'center',
|
|
6980
|
-
backgroundColor: headerBg,
|
|
6981
|
-
borderBottomColor: borderColor,
|
|
6982
|
-
borderBottomWidth: variant
|
|
6978
|
+
backgroundColor: showHeader ? headerBg : 'transparent',
|
|
6979
|
+
// borderBottomColor: showHeader ? borderColor : 'transparent',
|
|
6980
|
+
// borderBottomWidth: showHeader && variant !== 'fullscreen' ? 1 : 0,
|
|
6983
6981
|
flexDirection: isRTL ? 'row-reverse' : 'row',
|
|
6984
6982
|
justifyContent: 'space-between',
|
|
6985
6983
|
padding: 20,
|
|
6984
|
+
paddingBottom: title ? 0 : 20,
|
|
6986
6985
|
},
|
|
6987
6986
|
content: {
|
|
6988
|
-
//
|
|
6989
|
-
...(variant === '
|
|
6987
|
+
// Only fullscreen content should stretch
|
|
6988
|
+
...(variant === 'fullscreen' ? { flex: 1 } : {}),
|
|
6990
6989
|
alignSelf: 'stretch',
|
|
6991
6990
|
backgroundColor: contentBg,
|
|
6992
6991
|
padding: variant === 'fullscreen' ? 0 : 20,
|
|
@@ -7042,8 +7041,10 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
7042
7041
|
});
|
|
7043
7042
|
const bottomSheetAnimatedStyle = useAnimatedStyle(() => {
|
|
7044
7043
|
if (variant === 'bottomsheet') {
|
|
7044
|
+
// Clamp to 0 minimum to prevent seeing "under" the sheet
|
|
7045
|
+
const clampedY = Math.max(0, slideAnim.value);
|
|
7045
7046
|
return {
|
|
7046
|
-
transform: [{ translateY:
|
|
7047
|
+
transform: [{ translateY: clampedY }],
|
|
7047
7048
|
};
|
|
7048
7049
|
}
|
|
7049
7050
|
return {};
|
|
@@ -7060,7 +7061,7 @@ function Dialog({ visible, variant = 'modal', title, children, closable = true,
|
|
|
7060
7061
|
animatedStyle = bottomSheetAnimatedStyle;
|
|
7061
7062
|
}
|
|
7062
7063
|
return (jsxs(Animated.View, { style: [dynamicStyles.modalContainer, animatedStyle], ...(variant === 'bottomsheet' && bottomSheetSwipeZone === 'container' && panHandlers ? panHandlers : {}), children: [variant === 'bottomsheet' && (jsx(View, { style: dynamicStyles.dragHandleContainer, ...(bottomSheetSwipeZone === 'handle' && panHandlers ? panHandlers : {}), children: jsx(View, { style: dynamicStyles.dragHandle }) })), (title !== null &&
|
|
7063
|
-
title && closable) && (jsxs(View, { style: dynamicStyles.header, children: [jsx(Text, { variant: "h3", color: "text", children: title || '' }), closable && (jsx(Button, { variant: "ghost", onPress: handleClose, style: dynamicStyles.closeButton, children: jsx(Icon, { name: "x", size: "md" }) }))] })), jsx(View, { style: [dynamicStyles.content, style], children: children })] }));
|
|
7064
|
+
title && closable) && (jsxs(View, { style: dynamicStyles.header, children: [jsx(Text, { variant: "h3", color: "text", children: title || '' }), closable && variant !== 'bottomsheet' && (jsx(Button, { variant: "ghost", onPress: handleClose, style: dynamicStyles.closeButton, children: jsx(Icon, { name: "x", size: "md" }) }))] })), jsx(View, { style: [dynamicStyles.content, style], children: children })] }));
|
|
7064
7065
|
};
|
|
7065
7066
|
return (jsx(Modal, { visible: visible, transparent: true, animationType: "none", statusBarTranslucent: variant === 'fullscreen', children: jsxs(Animated.View, { style: [
|
|
7066
7067
|
dynamicStyles.backdrop,
|
|
@@ -7269,7 +7270,7 @@ function DialogRenderer() {
|
|
|
7269
7270
|
return null;
|
|
7270
7271
|
// Render the topmost dialog
|
|
7271
7272
|
const topDialog = dialogs[dialogs.length - 1];
|
|
7272
|
-
return (jsx(Dialog, { visible: true, variant: topDialog.variant, title: topDialog.title, closable: topDialog.closable, backdrop: topDialog.backdrop, backdropClosable: topDialog.backdropClosable, shouldClose: topDialog.isClosing, onClose: () => removeDialog(topDialog.id), children: topDialog.content }));
|
|
7273
|
+
return (jsx(Dialog, { visible: true, variant: topDialog.variant, title: topDialog.title, closable: topDialog.closable, backdrop: topDialog.backdrop, backdropClosable: topDialog.backdropClosable, shouldClose: topDialog.isClosing, onClose: () => removeDialog(topDialog.id), w: topDialog.w, h: topDialog.h, radius: topDialog.radius, style: topDialog.style, showHeader: topDialog.showHeader, children: topDialog.content }));
|
|
7273
7274
|
}
|
|
7274
7275
|
|
|
7275
7276
|
const Flex = factory((props, ref) => {
|
|
@@ -8354,7 +8355,14 @@ const getContrastPreference = () => {
|
|
|
8354
8355
|
return 'less';
|
|
8355
8356
|
return 'no-preference';
|
|
8356
8357
|
};
|
|
8357
|
-
const getColorScheme = () => {
|
|
8358
|
+
const getColorScheme = () => {
|
|
8359
|
+
var _a;
|
|
8360
|
+
const scheme = (_a = Appearance === null || Appearance === void 0 ? void 0 : Appearance.getColorScheme) === null || _a === void 0 ? void 0 : _a.call(Appearance);
|
|
8361
|
+
// Handle 'unspecified' from newer React Native versions
|
|
8362
|
+
if (scheme === 'light' || scheme === 'dark')
|
|
8363
|
+
return scheme;
|
|
8364
|
+
return 'no-preference';
|
|
8365
|
+
};
|
|
8358
8366
|
const getReducedMotion = async () => {
|
|
8359
8367
|
if (Platform.OS === 'web') {
|
|
8360
8368
|
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
@@ -8579,7 +8587,13 @@ function useDeviceInfo(options = {}) {
|
|
|
8579
8587
|
useEffect(() => {
|
|
8580
8588
|
var _a;
|
|
8581
8589
|
const colorSubscription = (_a = Appearance === null || Appearance === void 0 ? void 0 : Appearance.addChangeListener) === null || _a === void 0 ? void 0 : _a.call(Appearance, ({ colorScheme: scheme }) => {
|
|
8582
|
-
|
|
8590
|
+
// Handle 'unspecified' from newer React Native versions
|
|
8591
|
+
if (scheme === 'light' || scheme === 'dark') {
|
|
8592
|
+
setColorScheme(scheme);
|
|
8593
|
+
}
|
|
8594
|
+
else {
|
|
8595
|
+
setColorScheme('no-preference');
|
|
8596
|
+
}
|
|
8583
8597
|
});
|
|
8584
8598
|
const mediaListeners = [];
|
|
8585
8599
|
let boldSubscription;
|
|
@@ -9124,7 +9138,7 @@ function SpotlightRoot({ query, onQueryChange, children, opened = false, onClose
|
|
|
9124
9138
|
const targetWidth = Math.min(560, Math.max(280, screenWidth - horizontalMargin));
|
|
9125
9139
|
// (Hotkey registration moved to main Spotlight component for access to store.toggle())
|
|
9126
9140
|
const fullscreen = shouldUseModal;
|
|
9127
|
-
return (jsx(Dialog, { visible: opened, onClose: onClose, variant: fullscreen ? 'fullscreen' : 'modal', backdrop: true, backdropClosable: true,
|
|
9141
|
+
return (jsx(Dialog, { visible: opened, onClose: onClose, variant: fullscreen ? 'fullscreen' : 'modal', backdrop: true, backdropClosable: true, w: fullscreen ? undefined : targetWidth, title: null, style: [
|
|
9128
9142
|
styles$e.spotlightModal,
|
|
9129
9143
|
fullscreen && { width: '100%', height: '100%', maxHeight: '100%', borderRadius: 0, position: 'fixed', top: 0, left: 0 },
|
|
9130
9144
|
!fullscreen && {
|
|
@@ -9686,6 +9700,23 @@ function generateUniversalCSS() {
|
|
|
9686
9700
|
xl: '88em'
|
|
9687
9701
|
};
|
|
9688
9702
|
const universalCSS = `
|
|
9703
|
+
/* Reset browser default input styles to prevent double borders */
|
|
9704
|
+
input, textarea, select {
|
|
9705
|
+
outline: none !important;
|
|
9706
|
+
-webkit-appearance: none !important;
|
|
9707
|
+
-moz-appearance: none !important;
|
|
9708
|
+
appearance: none !important;
|
|
9709
|
+
}
|
|
9710
|
+
|
|
9711
|
+
input:focus, textarea:focus, select:focus {
|
|
9712
|
+
outline: none !important;
|
|
9713
|
+
}
|
|
9714
|
+
|
|
9715
|
+
/* Ensure React Native Web focusable elements don't show browser outlines */
|
|
9716
|
+
[data-focusable="true"]:focus {
|
|
9717
|
+
outline: none !important;
|
|
9718
|
+
}
|
|
9719
|
+
|
|
9689
9720
|
/* Color scheme based visibility */
|
|
9690
9721
|
.platform-blocks-light-hidden {
|
|
9691
9722
|
display: none !important;
|
|
@@ -9732,12 +9763,14 @@ function UniversalCSS() {
|
|
|
9732
9763
|
return;
|
|
9733
9764
|
}
|
|
9734
9765
|
// Check if styles are already injected
|
|
9735
|
-
|
|
9736
|
-
if (
|
|
9766
|
+
let styleElement = document.getElementById('platform-blocks-universal-css');
|
|
9767
|
+
if (styleElement) {
|
|
9768
|
+
// Update content if it exists (in case CSS changed)
|
|
9769
|
+
styleElement.textContent = css;
|
|
9737
9770
|
return;
|
|
9738
9771
|
}
|
|
9739
9772
|
// Create and inject styles
|
|
9740
|
-
|
|
9773
|
+
styleElement = document.createElement('style');
|
|
9741
9774
|
styleElement.id = 'platform-blocks-universal-css';
|
|
9742
9775
|
styleElement.textContent = css;
|
|
9743
9776
|
document.head.appendChild(styleElement);
|
|
@@ -10791,7 +10824,7 @@ const Masonry = factory((props, ref) => {
|
|
|
10791
10824
|
};
|
|
10792
10825
|
const containerStyle = {
|
|
10793
10826
|
...spacingStyle,
|
|
10794
|
-
...style,
|
|
10827
|
+
...StyleSheet.flatten(style),
|
|
10795
10828
|
};
|
|
10796
10829
|
// Show loading state
|
|
10797
10830
|
if (loading) {
|
|
@@ -11861,9 +11894,10 @@ const Row = ({ direction = 'row', gap = 'sm', ...props }) => {
|
|
|
11861
11894
|
};
|
|
11862
11895
|
/**
|
|
11863
11896
|
* Column component - alias for Flex with direction="column"
|
|
11897
|
+
* Defaults to fullWidth={true} since vertical layouts typically fill available width
|
|
11864
11898
|
*/
|
|
11865
|
-
const Column = ({ direction = 'column', gap = 'sm', ...props }) => {
|
|
11866
|
-
return jsx(Flex, { direction: direction, gap: gap, ...props });
|
|
11899
|
+
const Column = ({ direction = 'column', gap = 'sm', fullWidth = true, ...props }) => {
|
|
11900
|
+
return jsx(Flex, { direction: direction, gap: gap, fullWidth: fullWidth, ...props });
|
|
11867
11901
|
};
|
|
11868
11902
|
Row.displayName = 'Row';
|
|
11869
11903
|
|
|
@@ -13978,35 +14012,101 @@ function createNativeHighlighter(theme, isDark, variant = 'code', overrides) {
|
|
|
13978
14012
|
};
|
|
13979
14013
|
}
|
|
13980
14014
|
|
|
13981
|
-
//
|
|
14015
|
+
// Syntax highlighter - only loaded on web, native uses built-in tokenizer
|
|
14016
|
+
// These are initialized lazily on first use to avoid Metro bundling issues
|
|
13982
14017
|
let PrismSyntaxHighlighter = null;
|
|
13983
14018
|
let prismLightTheme = null;
|
|
13984
14019
|
let prismDarkTheme = null;
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
14020
|
+
let syntaxHighlighterInitialized = false;
|
|
14021
|
+
// Use indirect require via new Function to prevent Metro from statically analyzing imports
|
|
14022
|
+
// Metro bundles ALL require() calls it finds, even in try-catch blocks
|
|
14023
|
+
// new Function() creates a runtime-evaluated require that Metro can't see
|
|
14024
|
+
const safeRequire = (() => {
|
|
14025
|
+
try {
|
|
14026
|
+
// This creates: function(moduleName) { return require(moduleName); }
|
|
14027
|
+
// The string 'require' is not statically analyzable by Metro
|
|
14028
|
+
return new Function('moduleName', 'return require(moduleName)');
|
|
14029
|
+
}
|
|
14030
|
+
catch (_a) {
|
|
14031
|
+
return null;
|
|
14032
|
+
}
|
|
14033
|
+
})();
|
|
14034
|
+
function initSyntaxHighlighter() {
|
|
14035
|
+
if (syntaxHighlighterInitialized)
|
|
14036
|
+
return;
|
|
14037
|
+
syntaxHighlighterInitialized = true;
|
|
14038
|
+
// Only attempt to load on web
|
|
14039
|
+
if (Platform.OS !== 'web')
|
|
14040
|
+
return;
|
|
14041
|
+
if (!safeRequire)
|
|
14042
|
+
return;
|
|
14043
|
+
try {
|
|
14044
|
+
const rsh = safeRequire('react-syntax-highlighter');
|
|
14045
|
+
PrismSyntaxHighlighter = rsh.PrismLight;
|
|
14046
|
+
if (PrismSyntaxHighlighter) {
|
|
14047
|
+
// Register languages
|
|
14048
|
+
try {
|
|
14049
|
+
const jsx = safeRequire('react-syntax-highlighter/dist/esm/languages/prism/jsx').default;
|
|
14050
|
+
PrismSyntaxHighlighter.registerLanguage('jsx', jsx);
|
|
13995
14051
|
}
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14052
|
+
catch (_a) {
|
|
14053
|
+
// Language not available
|
|
14054
|
+
}
|
|
14055
|
+
try {
|
|
14056
|
+
const tsx = safeRequire('react-syntax-highlighter/dist/esm/languages/prism/tsx').default;
|
|
14057
|
+
PrismSyntaxHighlighter.registerLanguage('tsx', tsx);
|
|
14058
|
+
}
|
|
14059
|
+
catch (_b) {
|
|
14060
|
+
// Language not available
|
|
14061
|
+
}
|
|
14062
|
+
try {
|
|
14063
|
+
const ts = safeRequire('react-syntax-highlighter/dist/esm/languages/prism/typescript').default;
|
|
14064
|
+
PrismSyntaxHighlighter.registerLanguage('typescript', ts);
|
|
14065
|
+
}
|
|
14066
|
+
catch (_c) {
|
|
14067
|
+
// Language not available
|
|
14068
|
+
}
|
|
14069
|
+
try {
|
|
14070
|
+
const js = safeRequire('react-syntax-highlighter/dist/esm/languages/prism/javascript').default;
|
|
14071
|
+
PrismSyntaxHighlighter.registerLanguage('javascript', js);
|
|
14072
|
+
}
|
|
14073
|
+
catch (_d) {
|
|
14074
|
+
// Language not available
|
|
14075
|
+
}
|
|
14076
|
+
try {
|
|
14077
|
+
const json = safeRequire('react-syntax-highlighter/dist/esm/languages/prism/json').default;
|
|
14078
|
+
PrismSyntaxHighlighter.registerLanguage('json', json);
|
|
14079
|
+
}
|
|
14080
|
+
catch (_e) {
|
|
14081
|
+
// Language not available
|
|
14082
|
+
}
|
|
14083
|
+
try {
|
|
14084
|
+
const bash = safeRequire('react-syntax-highlighter/dist/esm/languages/prism/bash').default;
|
|
14085
|
+
PrismSyntaxHighlighter.registerLanguage('bash', bash);
|
|
14086
|
+
}
|
|
14087
|
+
catch (_f) {
|
|
14088
|
+
// Language not available
|
|
14089
|
+
}
|
|
14090
|
+
// Load themes
|
|
14091
|
+
try {
|
|
14092
|
+
prismLightTheme = safeRequire('react-syntax-highlighter/dist/esm/styles/prism/prism').default;
|
|
14093
|
+
}
|
|
14094
|
+
catch (_g) {
|
|
14095
|
+
// Theme not available
|
|
14096
|
+
}
|
|
14097
|
+
try {
|
|
14098
|
+
prismDarkTheme = safeRequire('react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus').default;
|
|
14099
|
+
}
|
|
14100
|
+
catch (_h) {
|
|
14101
|
+
// Theme not available
|
|
14102
|
+
}
|
|
14103
|
+
}
|
|
14104
|
+
}
|
|
14105
|
+
catch (_j) {
|
|
14106
|
+
// react-syntax-highlighter not installed, will use native fallback
|
|
14107
|
+
if (__DEV__) {
|
|
14108
|
+
console.warn('[platform-blocks] react-syntax-highlighter not found, CodeBlock will use basic formatting');
|
|
14109
|
+
}
|
|
14010
14110
|
}
|
|
14011
14111
|
}
|
|
14012
14112
|
const NO_HIGHLIGHTS = new Set();
|
|
@@ -14230,6 +14330,8 @@ const FloatingCopyControls = ({ visible, code, onCopy, topOffset, isWeb }) => (j
|
|
|
14230
14330
|
}, children: jsx(CopyButton, { value: code, onCopy: onCopy, iconOnly: true, size: "sm", tooltip: "Copy code", tooltipPosition: "left", style: { minHeight: 32, minWidth: 32 } }) }));
|
|
14231
14331
|
const CodeBlock = (props) => {
|
|
14232
14332
|
var _a, _b, _c;
|
|
14333
|
+
// Initialize syntax highlighter on first render (web only)
|
|
14334
|
+
React__default.useMemo(() => initSyntaxHighlighter(), []);
|
|
14233
14335
|
const { children, title, fileName, fileIcon, language = 'tsx', showLineNumbers = false, highlight = true, fullWidth = true, showCopyButton = true, onCopy, style, textStyle, titleStyle, highlightLines, spoiler = false, spoilerMaxHeight = 160, variant = 'code', promptSymbol = '$', githubUrl, fileHeader = false, colors, wrap = true, ...rest } = props;
|
|
14234
14336
|
const { spacingProps, otherProps } = extractSpacingProps(rest);
|
|
14235
14337
|
const spacingStyles = getSpacingStyles(spacingProps);
|
|
@@ -14244,6 +14346,7 @@ const CodeBlock = (props) => {
|
|
|
14244
14346
|
const [hovered, setHovered] = React__default.useState(false);
|
|
14245
14347
|
const [codeHeight, setCodeHeight] = React__default.useState(null);
|
|
14246
14348
|
const isWeb = Platform.OS === 'web';
|
|
14349
|
+
const webWhitespaceStyle = React__default.useMemo(() => (isWeb ? { whiteSpace: wrap ? 'pre-wrap' : 'pre', display: 'block' } : null), [isWeb, wrap]);
|
|
14247
14350
|
const showFloatingCopy = showCopyButton && !title && !fileName;
|
|
14248
14351
|
const showCopyVisible = !isWeb ? showFloatingCopy : showFloatingCopy && hovered;
|
|
14249
14352
|
const codeData = React__default.useMemo(() => {
|
|
@@ -14277,6 +14380,7 @@ const CodeBlock = (props) => {
|
|
|
14277
14380
|
boxSizing: 'border-box',
|
|
14278
14381
|
paddingLeft: showLineNumbers ? 0 : 12,
|
|
14279
14382
|
paddingRight: showLineNumbers ? 0 : 12,
|
|
14383
|
+
whiteSpace: wrap ? 'pre-wrap' : 'pre',
|
|
14280
14384
|
}), [showLineNumbers, wrap]);
|
|
14281
14385
|
const highlightedLineStyle = React__default.useMemo(() => ({
|
|
14282
14386
|
backgroundColor: highlightBackgroundColor,
|
|
@@ -14288,6 +14392,18 @@ const CodeBlock = (props) => {
|
|
|
14288
14392
|
const tokenLines = React__default.useMemo(() => (highlight ? nativeHighlighter(codeData.transformed) : null), [highlight, nativeHighlighter, codeData.transformed]);
|
|
14289
14393
|
const shouldVirtualizeNative = !isWeb && codeData.lineCount >= LONG_LIST_THRESHOLD;
|
|
14290
14394
|
const lineHeight = (_c = styles.codeText.lineHeight) !== null && _c !== void 0 ? _c : 18;
|
|
14395
|
+
const normalizeTokenText = React__default.useCallback((text, tokenIndex) => {
|
|
14396
|
+
if (!isWeb || !text)
|
|
14397
|
+
return text;
|
|
14398
|
+
const replaceSpaces = (value) => value.replace(/\t/g, ' ').replace(/ /g, '\u00A0');
|
|
14399
|
+
if (tokenIndex === 0) {
|
|
14400
|
+
return text.replace(/^[\t ]+/, (match) => replaceSpaces(match));
|
|
14401
|
+
}
|
|
14402
|
+
if (text.trim().length === 0) {
|
|
14403
|
+
return replaceSpaces(text);
|
|
14404
|
+
}
|
|
14405
|
+
return text;
|
|
14406
|
+
}, [isWeb]);
|
|
14291
14407
|
const buildNativeLine = React__default.useCallback((line, index, appendNewline, includeKey) => {
|
|
14292
14408
|
var _a;
|
|
14293
14409
|
const lineNumber = index + 1;
|
|
@@ -14296,13 +14412,14 @@ const CodeBlock = (props) => {
|
|
|
14296
14412
|
const lineStyles = [
|
|
14297
14413
|
styles.codeText,
|
|
14298
14414
|
textStyle,
|
|
14415
|
+
webWhitespaceStyle,
|
|
14299
14416
|
wrap ? { flexWrap: 'wrap' } : { flexWrap: 'nowrap', width: 'auto' },
|
|
14300
14417
|
];
|
|
14301
14418
|
if (isLineHighlighted) {
|
|
14302
14419
|
lineStyles.push(styles.highlightedLine(isDark, highlightColors));
|
|
14303
14420
|
}
|
|
14304
|
-
return (jsxs(Text, { selectable: true, style: lineStyles, children: [showLineNumbers ? (jsx(Text, { style: { color: lineNumberColor, opacity: 0.7 }, children: `${String(lineNumber).padStart(lineNumberWidth, ' ')} | ` })) : null, tokens.map((token, tokenIdx) => (jsx(Text, { style: { color: token.color }, children: token.text || ' ' }, `${lineNumber}-${tokenIdx}`))), appendNewline ? '\n' : null] }, includeKey ? `line-${lineNumber}` : undefined));
|
|
14305
|
-
}, [fallbackColor, highlightColors, highlightSet, isDark, lineNumberColor, lineNumberWidth, showLineNumbers, styles.codeText, styles.highlightedLine, textStyle, tokenLines, wrap]);
|
|
14421
|
+
return (jsxs(Text, { selectable: true, style: lineStyles, children: [showLineNumbers ? (jsx(Text, { style: { color: lineNumberColor, opacity: 0.7 }, children: `${String(lineNumber).padStart(lineNumberWidth, ' ')} | ` })) : null, tokens.map((token, tokenIdx) => (jsx(Text, { style: { color: token.color }, children: normalizeTokenText(token.text || ' ', tokenIdx) }, `${lineNumber}-${tokenIdx}`))), appendNewline ? '\n' : null] }, includeKey ? `line-${lineNumber}` : undefined));
|
|
14422
|
+
}, [fallbackColor, highlightColors, highlightSet, isDark, lineNumberColor, lineNumberWidth, normalizeTokenText, showLineNumbers, styles.codeText, styles.highlightedLine, textStyle, tokenLines, webWhitespaceStyle, wrap]);
|
|
14306
14423
|
const renderWebCode = React__default.useMemo(() => {
|
|
14307
14424
|
if (!(isWeb && highlight && PrismSyntaxHighlighter)) {
|
|
14308
14425
|
return null;
|
|
@@ -14316,7 +14433,13 @@ const CodeBlock = (props) => {
|
|
|
14316
14433
|
lineHeight: '18px',
|
|
14317
14434
|
display: 'block',
|
|
14318
14435
|
width: '100%',
|
|
14319
|
-
|
|
14436
|
+
whiteSpace: wrap ? 'pre-wrap' : 'pre',
|
|
14437
|
+
}, codeTagProps: {
|
|
14438
|
+
style: {
|
|
14439
|
+
fontFamily: styles.codeText.fontFamily,
|
|
14440
|
+
whiteSpace: wrap ? 'pre-wrap' : 'pre',
|
|
14441
|
+
},
|
|
14442
|
+
}, wrapLongLines: wrap, wrapLines: wrap, showLineNumbers: prismShowLineNumbers, lineNumberStyle: hideLineNumbersVisually
|
|
14320
14443
|
? { display: 'none' }
|
|
14321
14444
|
: { opacity: 0.55, paddingRight: 12, userSelect: 'none' }, lineProps: (lineNumber) => {
|
|
14322
14445
|
const style = { ...baseLineStyle };
|
|
@@ -14349,20 +14472,21 @@ const CodeBlock = (props) => {
|
|
|
14349
14472
|
]);
|
|
14350
14473
|
const renderNativeCode = React__default.useMemo(() => {
|
|
14351
14474
|
if (!codeData.lineCount) {
|
|
14352
|
-
return (jsx(Text, { selectable: true, style: [styles.codeText, textStyle], children: ' ' }));
|
|
14475
|
+
return (jsx(Text, { selectable: true, style: [styles.codeText, textStyle, webWhitespaceStyle], children: ' ' }));
|
|
14353
14476
|
}
|
|
14354
14477
|
if (shouldVirtualizeNative) {
|
|
14355
14478
|
return (jsx(FlatList, { data: codeData.lines, keyExtractor: (_, index) => `line-${index}`, renderItem: ({ item, index }) => buildNativeLine(item, index, false, false), initialNumToRender: 20, maxToRenderPerBatch: 40, windowSize: 7, removeClippedSubviews: true, getItemLayout: (_, index) => ({ length: lineHeight, offset: lineHeight * index, index }) }));
|
|
14356
14479
|
}
|
|
14357
|
-
return (jsx(Text, { selectable: true, style: [styles.codeText, textStyle], children: codeData.lines.map((line, idx) => buildNativeLine(line, idx, idx < codeData.lineCount - 1, true)) }));
|
|
14358
|
-
}, [buildNativeLine, codeData.lineCount, codeData.lines, lineHeight, shouldVirtualizeNative, styles.codeText, textStyle]);
|
|
14480
|
+
return (jsx(Text, { selectable: true, style: [styles.codeText, textStyle, webWhitespaceStyle], children: codeData.lines.map((line, idx) => buildNativeLine(line, idx, idx < codeData.lineCount - 1, true)) }));
|
|
14481
|
+
}, [buildNativeLine, codeData.lineCount, codeData.lines, lineHeight, shouldVirtualizeNative, styles.codeText, textStyle, webWhitespaceStyle]);
|
|
14359
14482
|
const codeContent = renderWebCode !== null && renderWebCode !== void 0 ? renderWebCode : renderNativeCode;
|
|
14360
14483
|
const scrollableCodeContent = wrap ? (codeContent) : (jsx(ScrollView, { horizontal: true, bounces: false, showsHorizontalScrollIndicator: true, showsVerticalScrollIndicator: false, contentContainerStyle: { flexGrow: 1 }, style: { width: '100%' }, children: jsx(View, { style: { flexGrow: 1 }, children: codeContent }) }));
|
|
14361
14484
|
let wrappedCodeContent = scrollableCodeContent;
|
|
14362
14485
|
if (spoiler) {
|
|
14363
14486
|
wrappedCodeContent = (jsx(Spoiler, { maxHeight: spoilerMaxHeight, children: scrollableCodeContent }));
|
|
14364
14487
|
}
|
|
14365
|
-
const
|
|
14488
|
+
const flatStyle = StyleSheet.flatten(style);
|
|
14489
|
+
const userHasWidth = Boolean(flatStyle && (flatStyle.width !== undefined || flatStyle.flex !== undefined));
|
|
14366
14490
|
const containerStyle = userHasWidth ? [{ marginBottom: 20 }, style, spacingStyles] : [styles.container, spacingStyles, style];
|
|
14367
14491
|
const showHeaderBar = fileHeader && fileName && variant !== 'terminal';
|
|
14368
14492
|
const inlineTitleVisible = variant === 'code' && (title || fileName);
|
|
@@ -15960,11 +16084,13 @@ const BrandButton = (props) => {
|
|
|
15960
16084
|
return {
|
|
15961
16085
|
backgroundColor: 'transparent',
|
|
15962
16086
|
borderColor: brandConfig.borderColor || brandConfig.backgroundColor,
|
|
16087
|
+
paddingHorizontal: 16,
|
|
15963
16088
|
};
|
|
15964
16089
|
case 'ghost':
|
|
15965
16090
|
return {
|
|
15966
16091
|
backgroundColor: 'transparent',
|
|
15967
16092
|
borderColor: 'transparent',
|
|
16093
|
+
paddingHorizontal: 16,
|
|
15968
16094
|
};
|
|
15969
16095
|
case 'link':
|
|
15970
16096
|
return { backgroundColor: 'transparent', borderColor: 'transparent' };
|
|
@@ -15972,7 +16098,7 @@ const BrandButton = (props) => {
|
|
|
15972
16098
|
return {
|
|
15973
16099
|
backgroundColor: 'white',
|
|
15974
16100
|
borderColor: 'transparent',
|
|
15975
|
-
paddingHorizontal:
|
|
16101
|
+
paddingHorizontal: 16,
|
|
15976
16102
|
minWidth: 0,
|
|
15977
16103
|
height: 'auto',
|
|
15978
16104
|
color: 'black'
|
|
@@ -15981,6 +16107,7 @@ const BrandButton = (props) => {
|
|
|
15981
16107
|
return {
|
|
15982
16108
|
backgroundColor: brandConfig.backgroundColor,
|
|
15983
16109
|
borderColor: brandConfig.borderColor || brandConfig.backgroundColor,
|
|
16110
|
+
paddingHorizontal: 16,
|
|
15984
16111
|
};
|
|
15985
16112
|
}
|
|
15986
16113
|
})();
|
|
@@ -16557,8 +16684,12 @@ const createInputStyles = (theme, isRTL = false) => {
|
|
|
16557
16684
|
// Remove any web-specific styling that could interfere
|
|
16558
16685
|
...(typeof window !== 'undefined' && {
|
|
16559
16686
|
outlineWidth: 0,
|
|
16687
|
+
outlineStyle: 'none',
|
|
16560
16688
|
border: 'none',
|
|
16689
|
+
borderWidth: 0,
|
|
16690
|
+
boxShadow: 'none',
|
|
16561
16691
|
backgroundColor: 'transparent',
|
|
16692
|
+
boxSizing: 'border-box',
|
|
16562
16693
|
}),
|
|
16563
16694
|
},
|
|
16564
16695
|
inputContainer: {
|
|
@@ -17486,7 +17617,7 @@ const TextArea = factory((props, ref) => {
|
|
|
17486
17617
|
const { spacingProps, otherProps: propsAfterSpacing } = extractSpacingProps(props);
|
|
17487
17618
|
const { layoutProps, otherProps } = extractLayoutProps(propsAfterSpacing);
|
|
17488
17619
|
const { value, defaultValue = '', onChangeText, label, disabled = false, required = false, placeholder, error, helperText, description, size = 'md', radius = 'md', rows = 3, minRows = 1, maxRows, autoResize = false, maxLength, showCharCounter = false, resize = 'none', textInputProps = {}, style, testID, clearable, clearButtonLabel, onClear, ...rest } = otherProps;
|
|
17489
|
-
const {
|
|
17620
|
+
const { h } = layoutProps;
|
|
17490
17621
|
const theme = useTheme();
|
|
17491
17622
|
const { getTextAreaStyles } = useTextAreaStyles({ theme });
|
|
17492
17623
|
const [focused, setFocused] = useState(false);
|
|
@@ -17550,11 +17681,11 @@ const TextArea = factory((props, ref) => {
|
|
|
17550
17681
|
const inputContainerStyles = [
|
|
17551
17682
|
styles.inputContainer,
|
|
17552
17683
|
radiusStyles,
|
|
17553
|
-
{ height }
|
|
17684
|
+
{ height: h }
|
|
17554
17685
|
];
|
|
17555
17686
|
const textInputStyles = [
|
|
17556
17687
|
styles.textInput,
|
|
17557
|
-
{ height:
|
|
17688
|
+
{ height: h || (autoResize ? currentRows * 24 : rows * 24), // Approximate row height
|
|
17558
17689
|
textAlignVertical: resize === 'none' ? 'top' : undefined,
|
|
17559
17690
|
// Disable resizing by user if resize is 'none'
|
|
17560
17691
|
...(resize === 'none' ? { resizeMode: 'none' } : {})
|
|
@@ -17582,7 +17713,7 @@ const TextArea = factory((props, ref) => {
|
|
|
17582
17713
|
const clearLabel = clearButtonLabel || 'Clear input';
|
|
17583
17714
|
return (jsxs(View, { style: containerStyles, testID: testID, children: [(label || description) && (jsx(FieldHeader, { label: label, description: description, required: required, disabled: disabled, error: !!error })), jsxs(View, { style: [inputContainerStyles, { position: 'relative' }], children: [jsx(TextInput, { ref: assignRef,
|
|
17584
17715
|
// style={]}
|
|
17585
|
-
style: { height:
|
|
17716
|
+
style: { height: h || (autoResize ? currentRows * 24 : rows * 24), // Approximate row height
|
|
17586
17717
|
...textInputStyles.reduce((acc, style) => ({ ...acc, ...style }), {}),
|
|
17587
17718
|
textAlignVertical: resize === 'none' ? 'top' : undefined,
|
|
17588
17719
|
// Disable resizing by user if resize is 'none'
|
|
@@ -23908,7 +24039,7 @@ const Select = factory((allProps, ref) => {
|
|
|
23908
24039
|
var _a;
|
|
23909
24040
|
const { spacingProps, otherProps: propsAfterSpacing } = extractSpacingProps(allProps);
|
|
23910
24041
|
const { layoutProps, otherProps } = extractLayoutProps(propsAfterSpacing);
|
|
23911
|
-
const { value: valueProp, defaultValue, onChange, options, placeholder = 'Select…', size = 'md', radius = 'md', disabled, label, helperText, description, error, renderOption, fullWidth,
|
|
24042
|
+
const { value: valueProp, defaultValue, onChange, options, placeholder = 'Select…', size = 'md', radius = 'md', disabled, label, helperText, description, error, renderOption, fullWidth, maxH = 260, closeOnSelect = true, clearable, clearButtonLabel, onClear, refocusAfterSelect, keyboardAvoidance = true, } = otherProps;
|
|
23912
24043
|
const theme = useTheme();
|
|
23913
24044
|
const { shouldUseModal, shouldUseOverlay } = useOverlayMode();
|
|
23914
24045
|
const menuStyles = useMenuStyles();
|
|
@@ -23930,6 +24061,7 @@ const Select = factory((allProps, ref) => {
|
|
|
23930
24061
|
keyboardAvoidance,
|
|
23931
24062
|
closeOnClickOutside: true,
|
|
23932
24063
|
closeOnEscape: true,
|
|
24064
|
+
matchAnchorWidth: true,
|
|
23933
24065
|
onClose: () => setOpen(false),
|
|
23934
24066
|
});
|
|
23935
24067
|
const hasMeasuredDropdownRef = useRef(false);
|
|
@@ -24063,11 +24195,11 @@ const Select = factory((allProps, ref) => {
|
|
|
24063
24195
|
}, [position === null || position === void 0 ? void 0 : position.finalWidth, triggerWidth]);
|
|
24064
24196
|
const resolvedDropdownMaxHeight = useMemo(() => {
|
|
24065
24197
|
const keyboardMax = typeof (position === null || position === void 0 ? void 0 : position.maxHeight) === 'number' ? position.maxHeight : undefined;
|
|
24066
|
-
if (typeof
|
|
24067
|
-
return keyboardMax ? Math.min(
|
|
24198
|
+
if (typeof maxH === 'number') {
|
|
24199
|
+
return keyboardMax ? Math.min(maxH, keyboardMax) : maxH;
|
|
24068
24200
|
}
|
|
24069
|
-
return keyboardMax !== null && keyboardMax !== void 0 ? keyboardMax :
|
|
24070
|
-
}, [
|
|
24201
|
+
return keyboardMax !== null && keyboardMax !== void 0 ? keyboardMax : maxH;
|
|
24202
|
+
}, [maxH, position === null || position === void 0 ? void 0 : position.maxHeight]);
|
|
24071
24203
|
const handleSelect = useCallback((opt) => {
|
|
24072
24204
|
if (opt.disabled)
|
|
24073
24205
|
return;
|
|
@@ -24089,7 +24221,7 @@ const Select = factory((allProps, ref) => {
|
|
|
24089
24221
|
close();
|
|
24090
24222
|
}
|
|
24091
24223
|
}, [closeOnSelect, close, onChange, valueProp, refocusAfterSelect, keyboardManager, focusTrigger, blurTrigger]);
|
|
24092
|
-
const listMaxHeight = resolvedDropdownMaxHeight !== null && resolvedDropdownMaxHeight !== void 0 ? resolvedDropdownMaxHeight :
|
|
24224
|
+
const listMaxHeight = resolvedDropdownMaxHeight !== null && resolvedDropdownMaxHeight !== void 0 ? resolvedDropdownMaxHeight : maxH;
|
|
24093
24225
|
const menu = useMemo(() => {
|
|
24094
24226
|
const widthStyle = resolvedDropdownWidth && resolvedDropdownWidth > 0
|
|
24095
24227
|
? { width: resolvedDropdownWidth, minWidth: resolvedDropdownWidth }
|
|
@@ -24102,18 +24234,17 @@ const Select = factory((allProps, ref) => {
|
|
|
24102
24234
|
...(maxHeightStyle !== null && maxHeightStyle !== void 0 ? maxHeightStyle : {}),
|
|
24103
24235
|
...(widthStyle !== null && widthStyle !== void 0 ? widthStyle : {}),
|
|
24104
24236
|
}, children: jsx(FlatList, { data: options, keyExtractor: o => String(o.value), renderItem: ({ item }) => {
|
|
24105
|
-
var _a;
|
|
24106
24237
|
const selected = item.value === value;
|
|
24107
24238
|
if (renderOption) {
|
|
24108
24239
|
return jsx(View, { children: renderOption(item, false, selected) });
|
|
24109
24240
|
}
|
|
24110
24241
|
const primaryPalette = theme.colors.primary || [];
|
|
24111
24242
|
const highlightColor = theme.colorScheme === 'dark'
|
|
24112
|
-
? primaryPalette[
|
|
24113
|
-
: primaryPalette[6] || primaryPalette[5] ||
|
|
24243
|
+
? primaryPalette[5] || primaryPalette[4] || '#60A5FA'
|
|
24244
|
+
: primaryPalette[6] || primaryPalette[5] || '#3B82F6';
|
|
24114
24245
|
const baseTextColor = item.disabled ? theme.text.disabled : theme.text.primary;
|
|
24115
|
-
|
|
24116
|
-
return (jsx(MenuItemButton, { onPress: () => handleSelect(item), disabled: !!item.disabled, active:
|
|
24246
|
+
item.disabled ? theme.text.disabled : highlightColor;
|
|
24247
|
+
return (jsx(MenuItemButton, { onPress: () => handleSelect(item), disabled: !!item.disabled, active: false, tone: "default", hoverTone: "default", activeTone: "default", textColor: baseTextColor, hoverTextColor: baseTextColor, activeTextColor: baseTextColor, startIcon: selected ? jsx(Icon, { name: "check", size: 16, color: highlightColor }) : jsx(View, { style: { width: 16 } }), compact: true, rounded: false, style: { borderRadius: 0 }, children: item.label }));
|
|
24117
24248
|
}, ItemSeparatorComponent: renderOption ? undefined : ListGroupDivider, style: maxHeightStyle, bounces: false }) }) }));
|
|
24118
24249
|
}, [resolvedDropdownWidth, listMaxHeight, menuStyles.dropdown, options, value, renderOption, theme.colors.primary, theme.colors.secondary, theme.colorScheme, theme.text.disabled, theme.text.primary, theme.text.onPrimary, handleSelect]);
|
|
24119
24250
|
useEffect(() => {
|
|
@@ -24295,6 +24426,7 @@ const AutoComplete = factory((props, ref) => {
|
|
|
24295
24426
|
offset,
|
|
24296
24427
|
autoUpdate: autoReposition,
|
|
24297
24428
|
fallbackPlacements,
|
|
24429
|
+
matchAnchorWidth: true,
|
|
24298
24430
|
});
|
|
24299
24431
|
// Guard: remember last popover size to avoid re-triggering updatePosition on position-only changes
|
|
24300
24432
|
const lastPopoverSizeRef = useRef(null);
|
|
@@ -24318,13 +24450,12 @@ const AutoComplete = factory((props, ref) => {
|
|
|
24318
24450
|
}, radiusStyles), [inputStyleFactory, size, focused, error, disabled, showClearButton, radiusStyles]);
|
|
24319
24451
|
const clearLabel = clearButtonLabel || 'Clear input';
|
|
24320
24452
|
const menuHighlightColor = useMemo(() => {
|
|
24321
|
-
var _a;
|
|
24322
24453
|
const primaryPalette = theme.colors.primary || [];
|
|
24323
24454
|
if (theme.colorScheme === 'dark') {
|
|
24324
|
-
return primaryPalette[
|
|
24455
|
+
return primaryPalette[5] || primaryPalette[4] || '#60A5FA';
|
|
24325
24456
|
}
|
|
24326
|
-
return primaryPalette[6] || primaryPalette[5] ||
|
|
24327
|
-
}, [theme.colors.primary, theme.
|
|
24457
|
+
return primaryPalette[6] || primaryPalette[5] || '#3B82F6';
|
|
24458
|
+
}, [theme.colors.primary, theme.colorScheme]);
|
|
24328
24459
|
const selectedCount = (_a = selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.length) !== null && _a !== void 0 ? _a : 0;
|
|
24329
24460
|
const hasSelectedValues = multiSelect && selectedCount > 0;
|
|
24330
24461
|
const currentQueryRef = useRef(query);
|
|
@@ -24642,8 +24773,8 @@ const AutoComplete = factory((props, ref) => {
|
|
|
24642
24773
|
const defaultRenderItem = useCallback((item, index, isSelected = false) => {
|
|
24643
24774
|
const highlightQuery = highlightMatches ? currentQueryRef.current : undefined;
|
|
24644
24775
|
const baseTextColor = item.disabled ? theme.text.disabled : theme.text.primary;
|
|
24645
|
-
|
|
24646
|
-
return (jsx(MenuItemButton, { onPress: () => handleSelectSuggestion(item), disabled: item.disabled, active:
|
|
24776
|
+
item.disabled ? theme.text.disabled : menuHighlightColor;
|
|
24777
|
+
return (jsx(MenuItemButton, { onPress: () => handleSelectSuggestion(item), disabled: item.disabled, active: false, tone: "default", hoverTone: "default", activeTone: "default", textColor: baseTextColor, hoverTextColor: baseTextColor, activeTextColor: baseTextColor, startIcon: isSelected ? jsx(Icon, { name: "check", size: 16, color: menuHighlightColor }) : jsx(View, { style: { width: 16 } }), compact: true, rounded: false, style: [styles.menuItemButton, suggestionItemStyle], ...(Platform.OS === 'web' ? {
|
|
24647
24778
|
onMouseDown: (event) => {
|
|
24648
24779
|
if (event === null || event === void 0 ? void 0 : event.preventDefault) {
|
|
24649
24780
|
event.preventDefault();
|
|
@@ -27152,7 +27283,7 @@ const DatePickerInput = forwardRef(function DatePickerInputInner({ value, defaul
|
|
|
27152
27283
|
} }));
|
|
27153
27284
|
}
|
|
27154
27285
|
if (dropdownType === 'modal') {
|
|
27155
|
-
return (jsxs(View, { ref: ref, children: [renderInput(), jsx(Dialog, { visible: isOpen, variant: "modal", onClose: handleClose,
|
|
27286
|
+
return (jsxs(View, { ref: ref, children: [renderInput(), jsx(Dialog, { visible: isOpen, variant: "modal", onClose: handleClose, w: numberOfMonths > 1 ? Math.min(700, 380 * numberOfMonths + 40) : 400, title: type === 'range'
|
|
27156
27287
|
? 'Select Date Range'
|
|
27157
27288
|
: type === 'multiple'
|
|
27158
27289
|
? 'Select Dates'
|
|
@@ -27181,7 +27312,7 @@ const DatePickerInput = forwardRef(function DatePickerInputInner({ value, defaul
|
|
|
27181
27312
|
backgroundColor: pressed ? theme.colors.primary[6] : theme.colors.primary[5],
|
|
27182
27313
|
}), children: jsx(Text, { size: "sm", weight: "semibold", style: { color: 'white' }, children: "Done" }) })] })] }) }))] }) })] }));
|
|
27183
27314
|
}
|
|
27184
|
-
return (jsxs(View, { ref: ref, children: [renderInput(), jsx(Dialog, { visible: isOpen, variant: "modal", onClose: handleClose,
|
|
27315
|
+
return (jsxs(View, { ref: ref, children: [renderInput(), jsx(Dialog, { visible: isOpen, variant: "modal", onClose: handleClose, w: numberOfMonths > 1 ? Math.min(600, 320 * numberOfMonths + 40) : 350, children: jsxs(View, { ref: focusTrapRef, style: { padding: DESIGN_TOKENS.spacing.lg }, accessible: true, accessibilityLabel: type === 'range'
|
|
27185
27316
|
? 'Date range picker dialog'
|
|
27186
27317
|
: type === 'multiple'
|
|
27187
27318
|
? 'Multiple date picker dialog'
|
|
@@ -27276,7 +27407,7 @@ const MonthPickerInput = forwardRef(function MonthPickerInput({ value, defaultVa
|
|
|
27276
27407
|
pointerEvents: 'none',
|
|
27277
27408
|
accessible: false,
|
|
27278
27409
|
focusable: false,
|
|
27279
|
-
} }) }), jsx(Dialog, { visible: opened, variant: "modal", onClose: handleClose, title: modalTitle,
|
|
27410
|
+
} }) }), jsx(Dialog, { visible: opened, variant: "modal", onClose: handleClose, title: modalTitle, w: 360, children: jsx(View, { style: {
|
|
27280
27411
|
padding: DESIGN_TOKENS.spacing.lg,
|
|
27281
27412
|
}, children: jsx(MonthPicker, { ...restMonthPickerProps, value: currentValue, onChange: handleMonthChange, locale: resolvedLocale, size: resolvedSize }) }) })] }));
|
|
27282
27413
|
});
|
|
@@ -27339,7 +27470,7 @@ const YearPickerInput = forwardRef(function YearPickerInput({ value, defaultValu
|
|
|
27339
27470
|
pointerEvents: 'none',
|
|
27340
27471
|
accessible: false,
|
|
27341
27472
|
focusable: false,
|
|
27342
|
-
} }) }), jsx(Dialog, { visible: opened, variant: "modal", onClose: handleClose, title: modalTitle,
|
|
27473
|
+
} }) }), jsx(Dialog, { visible: opened, variant: "modal", onClose: handleClose, title: modalTitle, w: 360, children: jsx(View, { style: {
|
|
27343
27474
|
padding: DESIGN_TOKENS.spacing.lg,
|
|
27344
27475
|
}, children: jsx(YearPicker, { ...restYearPickerProps, value: currentValue, onChange: handleYearChange, size: resolvedSize }) }) })] }));
|
|
27345
27476
|
});
|
|
@@ -27504,7 +27635,7 @@ const TimePickerInput = ({ value, defaultValue, onChange, format = 24, withSecon
|
|
|
27504
27635
|
}
|
|
27505
27636
|
}, label: label, placeholder: is12h ? 'hh:mm AM' : 'hh:mm', endSection: jsx(Icon, { name: "clock", size: 16, color: disabled ? theme.text.disabled : theme.text.muted }), disabled: disabled, error: error, helperText: helperText, size: size, fullWidth: fullWidth, clearable: clearable && hasValue, clearButtonLabel: clearButtonLabel, onClear: clearValue }) }), jsx(Dialog, { visible: open,
|
|
27506
27637
|
// variant="fullscreen"
|
|
27507
|
-
onClose: handleClose,
|
|
27638
|
+
onClose: handleClose, w: typeof computedPanelWidth === 'number' ? computedPanelWidth : 360, title: title || 'Select Time', children: jsxs(Pressable, { style: {
|
|
27508
27639
|
flex: 1,
|
|
27509
27640
|
width: '100%',
|
|
27510
27641
|
justifyContent: 'center',
|
|
@@ -28456,303 +28587,6 @@ const EmojiPicker = factory((props, ref) => {
|
|
|
28456
28587
|
});
|
|
28457
28588
|
EmojiPicker.displayName = 'EmojiPicker';
|
|
28458
28589
|
|
|
28459
|
-
function useRichTextEditorStyles() {
|
|
28460
|
-
const theme = useTheme();
|
|
28461
|
-
return useMemo(() => StyleSheet.create({
|
|
28462
|
-
characterCount: {
|
|
28463
|
-
fontSize: 12,
|
|
28464
|
-
marginTop: 4,
|
|
28465
|
-
textAlign: 'right',
|
|
28466
|
-
},
|
|
28467
|
-
container: {
|
|
28468
|
-
width: '100%',
|
|
28469
|
-
},
|
|
28470
|
-
disabled: {
|
|
28471
|
-
opacity: 0.5,
|
|
28472
|
-
},
|
|
28473
|
-
editorContainer: {
|
|
28474
|
-
backgroundColor: theme.backgrounds.surface,
|
|
28475
|
-
borderColor: theme.backgrounds.border,
|
|
28476
|
-
borderRadius: parseInt(theme.radii.md, 10),
|
|
28477
|
-
borderWidth: 1,
|
|
28478
|
-
overflow: 'hidden',
|
|
28479
|
-
},
|
|
28480
|
-
errorText: {
|
|
28481
|
-
fontSize: 12,
|
|
28482
|
-
marginTop: 4,
|
|
28483
|
-
},
|
|
28484
|
-
helperText: {
|
|
28485
|
-
fontSize: 12,
|
|
28486
|
-
marginTop: 4,
|
|
28487
|
-
},
|
|
28488
|
-
textInput: {
|
|
28489
|
-
fontSize: 16,
|
|
28490
|
-
lineHeight: 24,
|
|
28491
|
-
padding: parseInt(theme.spacing.md, 10),
|
|
28492
|
-
},
|
|
28493
|
-
toolButton: {
|
|
28494
|
-
alignItems: 'center',
|
|
28495
|
-
backgroundColor: 'transparent',
|
|
28496
|
-
borderColor: theme.backgrounds.border,
|
|
28497
|
-
borderRadius: parseInt(theme.radii.sm, 10),
|
|
28498
|
-
borderWidth: 1,
|
|
28499
|
-
height: 32,
|
|
28500
|
-
justifyContent: 'center',
|
|
28501
|
-
width: 32,
|
|
28502
|
-
},
|
|
28503
|
-
toolSeparator: {
|
|
28504
|
-
backgroundColor: theme.backgrounds.border,
|
|
28505
|
-
height: 24,
|
|
28506
|
-
marginHorizontal: 4,
|
|
28507
|
-
width: 1,
|
|
28508
|
-
},
|
|
28509
|
-
toolbar: {
|
|
28510
|
-
backgroundColor: theme.backgrounds.elevated,
|
|
28511
|
-
borderBottomColor: theme.backgrounds.border,
|
|
28512
|
-
borderBottomWidth: 1,
|
|
28513
|
-
},
|
|
28514
|
-
toolbarContent: {
|
|
28515
|
-
alignItems: 'center',
|
|
28516
|
-
flexDirection: 'row',
|
|
28517
|
-
gap: 4,
|
|
28518
|
-
paddingHorizontal: parseInt(theme.spacing.sm, 10),
|
|
28519
|
-
paddingVertical: parseInt(theme.spacing.xs, 10),
|
|
28520
|
-
},
|
|
28521
|
-
}), [theme]);
|
|
28522
|
-
}
|
|
28523
|
-
|
|
28524
|
-
// Default toolbar configuration
|
|
28525
|
-
const DEFAULT_TOOLBAR_TOOLS = [
|
|
28526
|
-
'bold',
|
|
28527
|
-
'italic',
|
|
28528
|
-
'underline',
|
|
28529
|
-
'separator',
|
|
28530
|
-
'heading',
|
|
28531
|
-
'separator',
|
|
28532
|
-
'align',
|
|
28533
|
-
'separator',
|
|
28534
|
-
'list',
|
|
28535
|
-
'separator',
|
|
28536
|
-
'link',
|
|
28537
|
-
'separator',
|
|
28538
|
-
'color',
|
|
28539
|
-
];
|
|
28540
|
-
const RichTextEditor = React__default.memo(({ defaultValue, value, onChange, onSelectionChange, onFocus, onBlur, placeholder = 'Start typing...', readOnly = false, disabled = false, toolbar = {
|
|
28541
|
-
enabled: true,
|
|
28542
|
-
position: 'top',
|
|
28543
|
-
tools: DEFAULT_TOOLBAR_TOOLS,
|
|
28544
|
-
}, formats = {
|
|
28545
|
-
fontFamilies: ['Arial', 'Georgia', 'Times New Roman', 'Courier New'],
|
|
28546
|
-
fontSizes: [12, 14, 16, 18, 20, 24, 28, 32],
|
|
28547
|
-
colors: ['#000000', '#333333', '#666666', '#999999', '#CCCCCC', '#FF0000', '#00FF00', '#0000FF'],
|
|
28548
|
-
headings: [1, 2, 3, 4, 5, 6],
|
|
28549
|
-
}, images = { enabled: true }, links = { enabled: true, openInNewTab: true }, plugins = [], autosave, spellCheck = true, maxLength, minHeight = 200, maxHeight = 600, className, theme: themeOverride = 'auto', error, helperText, style, ...props }) => {
|
|
28550
|
-
const theme = useTheme();
|
|
28551
|
-
const styles = useRichTextEditorStyles();
|
|
28552
|
-
const [content, setContent] = useState(value || defaultValue || { html: '', text: '' });
|
|
28553
|
-
const [selection, setSelection] = useState({
|
|
28554
|
-
index: 0,
|
|
28555
|
-
length: 0,
|
|
28556
|
-
});
|
|
28557
|
-
const [activeFormats, setActiveFormats] = useState({});
|
|
28558
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
28559
|
-
const editorRef = useRef(null);
|
|
28560
|
-
const autosaveTimerRef = useRef(null);
|
|
28561
|
-
// Update content when value prop changes
|
|
28562
|
-
useEffect(() => {
|
|
28563
|
-
if (value && value !== content) {
|
|
28564
|
-
setContent(value);
|
|
28565
|
-
}
|
|
28566
|
-
}, [value]);
|
|
28567
|
-
// Autosave functionality
|
|
28568
|
-
useEffect(() => {
|
|
28569
|
-
if ((autosave === null || autosave === void 0 ? void 0 : autosave.enabled) && autosave.onSave) {
|
|
28570
|
-
if (autosaveTimerRef.current) {
|
|
28571
|
-
clearTimeout(autosaveTimerRef.current);
|
|
28572
|
-
}
|
|
28573
|
-
autosaveTimerRef.current = setTimeout(() => {
|
|
28574
|
-
autosave.onSave(content);
|
|
28575
|
-
}, autosave.interval || 5000);
|
|
28576
|
-
return () => {
|
|
28577
|
-
if (autosaveTimerRef.current) {
|
|
28578
|
-
clearTimeout(autosaveTimerRef.current);
|
|
28579
|
-
}
|
|
28580
|
-
};
|
|
28581
|
-
}
|
|
28582
|
-
}, [content, autosave]);
|
|
28583
|
-
const handleContentChange = useCallback((text) => {
|
|
28584
|
-
const newContent = {
|
|
28585
|
-
text,
|
|
28586
|
-
html: text, // For now, treating as plain text
|
|
28587
|
-
};
|
|
28588
|
-
setContent(newContent);
|
|
28589
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newContent);
|
|
28590
|
-
}, [onChange]);
|
|
28591
|
-
const handleSelectionChange = useCallback((selection) => {
|
|
28592
|
-
const newSelection = {
|
|
28593
|
-
index: selection.start,
|
|
28594
|
-
length: selection.end - selection.start,
|
|
28595
|
-
format: activeFormats,
|
|
28596
|
-
};
|
|
28597
|
-
setSelection(newSelection);
|
|
28598
|
-
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(newSelection);
|
|
28599
|
-
}, [activeFormats, onSelectionChange]);
|
|
28600
|
-
const handleFocus = useCallback(() => {
|
|
28601
|
-
setIsFocused(true);
|
|
28602
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
28603
|
-
}, [onFocus]);
|
|
28604
|
-
const handleBlur = useCallback(() => {
|
|
28605
|
-
setIsFocused(false);
|
|
28606
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
28607
|
-
}, [onBlur]);
|
|
28608
|
-
const applyFormat = useCallback((format) => {
|
|
28609
|
-
if (readOnly || disabled)
|
|
28610
|
-
return;
|
|
28611
|
-
const newFormats = { ...activeFormats, ...format };
|
|
28612
|
-
setActiveFormats(newFormats);
|
|
28613
|
-
// In a real implementation, this would apply formatting to the selected text
|
|
28614
|
-
// For this demo, we'll just track the format state
|
|
28615
|
-
}, [activeFormats, readOnly, disabled]);
|
|
28616
|
-
const toggleFormat = useCallback((formatKey) => {
|
|
28617
|
-
if (readOnly || disabled)
|
|
28618
|
-
return;
|
|
28619
|
-
const currentValue = activeFormats[formatKey];
|
|
28620
|
-
applyFormat({ [formatKey]: !currentValue });
|
|
28621
|
-
}, [activeFormats, applyFormat, readOnly, disabled]);
|
|
28622
|
-
const insertText = useCallback((text) => {
|
|
28623
|
-
if (readOnly || disabled)
|
|
28624
|
-
return;
|
|
28625
|
-
const currentText = content.text;
|
|
28626
|
-
const { index } = selection;
|
|
28627
|
-
const newText = currentText.slice(0, index) + text + currentText.slice(index);
|
|
28628
|
-
handleContentChange(newText);
|
|
28629
|
-
}, [content.text, selection, handleContentChange, readOnly, disabled]);
|
|
28630
|
-
const insertLink = useCallback(() => {
|
|
28631
|
-
if (!(links === null || links === void 0 ? void 0 : links.enabled) || readOnly || disabled)
|
|
28632
|
-
return;
|
|
28633
|
-
// In a real implementation, this would show a link dialog
|
|
28634
|
-
const url = prompt('Enter URL:');
|
|
28635
|
-
if (url && (!links.validate || links.validate(url))) {
|
|
28636
|
-
applyFormat({ link: url });
|
|
28637
|
-
}
|
|
28638
|
-
}, [links, applyFormat, readOnly, disabled]);
|
|
28639
|
-
useCallback(async () => {
|
|
28640
|
-
if (!(images === null || images === void 0 ? void 0 : images.enabled) || readOnly || disabled)
|
|
28641
|
-
return;
|
|
28642
|
-
// In a real implementation, this would show a file picker
|
|
28643
|
-
// For now, we'll just insert a placeholder
|
|
28644
|
-
insertText('[Image]');
|
|
28645
|
-
}, [images, insertText, readOnly, disabled]);
|
|
28646
|
-
useCallback((level) => {
|
|
28647
|
-
applyFormat({ heading: level });
|
|
28648
|
-
}, [applyFormat]);
|
|
28649
|
-
const setAlignment = useCallback((align) => {
|
|
28650
|
-
applyFormat({ align });
|
|
28651
|
-
}, [applyFormat]);
|
|
28652
|
-
const setList = useCallback((listType) => {
|
|
28653
|
-
applyFormat({ list: listType });
|
|
28654
|
-
}, [applyFormat]);
|
|
28655
|
-
const getToolButtonStyle = useCallback((isActive) => [
|
|
28656
|
-
styles.toolButton,
|
|
28657
|
-
{
|
|
28658
|
-
backgroundColor: isActive
|
|
28659
|
-
? (theme.colorScheme === 'dark' ? theme.colors.primary[7] : theme.colors.primary[1])
|
|
28660
|
-
: 'transparent',
|
|
28661
|
-
borderColor: isActive ? theme.colors.primary[4] : theme.backgrounds.border,
|
|
28662
|
-
},
|
|
28663
|
-
(disabled || readOnly) && styles.disabled,
|
|
28664
|
-
], [styles.toolButton, theme, disabled, readOnly]);
|
|
28665
|
-
const renderToolButton = useCallback((tool, icon, onPress, isActive = false) => (jsx(TouchableOpacity, { onPress: onPress, disabled: disabled || readOnly, style: getToolButtonStyle(isActive), children: jsx(Icon, { name: icon, size: 16, color: isActive ? theme.colors.primary[5] : theme.text.secondary }) }, tool)), [theme, disabled, readOnly, getToolButtonStyle]);
|
|
28666
|
-
const renderToolSeparator = useCallback((index) => (jsx(View, { style: styles.toolSeparator }, `separator-${index}`)), [styles.toolSeparator]);
|
|
28667
|
-
const renderToolbar = useCallback(() => {
|
|
28668
|
-
if (!(toolbar === null || toolbar === void 0 ? void 0 : toolbar.enabled))
|
|
28669
|
-
return null;
|
|
28670
|
-
const tools = toolbar.tools || DEFAULT_TOOLBAR_TOOLS;
|
|
28671
|
-
return (jsx(View, { style: styles.toolbar, children: jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.toolbarContent, children: tools.map((tool, index) => {
|
|
28672
|
-
if (tool === 'separator') {
|
|
28673
|
-
return renderToolSeparator(index);
|
|
28674
|
-
}
|
|
28675
|
-
switch (tool) {
|
|
28676
|
-
case 'bold':
|
|
28677
|
-
return renderToolButton('bold', 'bold', () => toggleFormat('bold'), !!activeFormats.bold);
|
|
28678
|
-
case 'italic':
|
|
28679
|
-
return renderToolButton('italic', 'italic', () => toggleFormat('italic'), !!activeFormats.italic);
|
|
28680
|
-
case 'underline':
|
|
28681
|
-
return renderToolButton('underline', 'underline', () => toggleFormat('underline'), !!activeFormats.underline);
|
|
28682
|
-
case 'strikethrough':
|
|
28683
|
-
return renderToolButton('strikethrough', 'strikethrough', () => toggleFormat('strikethrough'), !!activeFormats.strikethrough);
|
|
28684
|
-
case 'heading':
|
|
28685
|
-
return renderToolButton('heading', 'heading', () => applyFormat({ heading: activeFormats.heading ? null : 2 }), !!activeFormats.heading);
|
|
28686
|
-
case 'align':
|
|
28687
|
-
return renderToolButton('align', 'alignLeft', // Default to left align icon, could be dynamic based on current align
|
|
28688
|
-
() => setAlignment(activeFormats.align === 'left' ? 'center' : 'left'), !!activeFormats.align);
|
|
28689
|
-
case 'list':
|
|
28690
|
-
return renderToolButton('list', 'listUnordered', // Default to unordered list icon, could be dynamic
|
|
28691
|
-
() => setList(activeFormats.list === 'unordered' ? 'ordered' : 'unordered'), !!activeFormats.list);
|
|
28692
|
-
case 'link':
|
|
28693
|
-
return renderToolButton('link', 'link', insertLink, !!activeFormats.link);
|
|
28694
|
-
case 'image':
|
|
28695
|
-
return renderToolButton('image', 'image', () => { }, // TODO: Implement image insertion
|
|
28696
|
-
false);
|
|
28697
|
-
case 'code':
|
|
28698
|
-
return renderToolButton('code', 'code', () => toggleFormat('code'), !!activeFormats.code);
|
|
28699
|
-
case 'quote':
|
|
28700
|
-
return renderToolButton('quote', 'quote', () => toggleFormat('quote'), !!activeFormats.quote);
|
|
28701
|
-
case 'color':
|
|
28702
|
-
return renderToolButton('color', 'color', () => { }, // TODO: Implement color picker
|
|
28703
|
-
!!activeFormats.color);
|
|
28704
|
-
default:
|
|
28705
|
-
return null;
|
|
28706
|
-
}
|
|
28707
|
-
}) }) }));
|
|
28708
|
-
}, [toolbar, theme, activeFormats, renderToolButton, renderToolSeparator, toggleFormat, insertLink, styles.toolbar, styles.toolbarContent]);
|
|
28709
|
-
const renderEditor = useCallback(() => (jsx(View, { style: [
|
|
28710
|
-
styles.editorContainer,
|
|
28711
|
-
{
|
|
28712
|
-
borderColor: isFocused ? theme.colors.primary[5] : theme.backgrounds.border,
|
|
28713
|
-
minHeight,
|
|
28714
|
-
maxHeight,
|
|
28715
|
-
},
|
|
28716
|
-
error && { borderColor: theme.colors.error[5] },
|
|
28717
|
-
(disabled || readOnly) && styles.disabled,
|
|
28718
|
-
], children: jsx(TextInput, { ref: editorRef, value: content.text, onChangeText: handleContentChange, onSelectionChange: (event) => handleSelectionChange(event.nativeEvent.selection), onFocus: handleFocus, onBlur: handleBlur, placeholder: placeholder, placeholderTextColor: theme.text.muted, multiline: true, textAlignVertical: "top", editable: !disabled && !readOnly, spellCheck: spellCheck, maxLength: maxLength, style: [
|
|
28719
|
-
styles.textInput,
|
|
28720
|
-
Platform.OS === 'web' ? { outlineWidth: 0 } : null,
|
|
28721
|
-
{
|
|
28722
|
-
color: theme.text.primary,
|
|
28723
|
-
fontSize: activeFormats.fontSize || 16,
|
|
28724
|
-
fontFamily: activeFormats.fontFamily || theme.fontFamily,
|
|
28725
|
-
fontWeight: activeFormats.bold ? 'bold' : 'normal',
|
|
28726
|
-
fontStyle: activeFormats.italic ? 'italic' : 'normal',
|
|
28727
|
-
textDecorationLine: activeFormats.underline ? 'underline' : 'none',
|
|
28728
|
-
textAlign: activeFormats.align || 'left',
|
|
28729
|
-
},
|
|
28730
|
-
], ...props }) })), [
|
|
28731
|
-
content.text,
|
|
28732
|
-
handleContentChange,
|
|
28733
|
-
handleSelectionChange,
|
|
28734
|
-
handleFocus,
|
|
28735
|
-
handleBlur,
|
|
28736
|
-
placeholder,
|
|
28737
|
-
disabled,
|
|
28738
|
-
readOnly,
|
|
28739
|
-
spellCheck,
|
|
28740
|
-
maxLength,
|
|
28741
|
-
isFocused,
|
|
28742
|
-
theme,
|
|
28743
|
-
minHeight,
|
|
28744
|
-
maxHeight,
|
|
28745
|
-
error,
|
|
28746
|
-
activeFormats,
|
|
28747
|
-
props,
|
|
28748
|
-
styles.editorContainer,
|
|
28749
|
-
styles.disabled,
|
|
28750
|
-
styles.textInput,
|
|
28751
|
-
]);
|
|
28752
|
-
return (jsxs(View, { style: [styles.container, style], children: [(toolbar === null || toolbar === void 0 ? void 0 : toolbar.position) === 'top' && renderToolbar(), renderEditor(), (toolbar === null || toolbar === void 0 ? void 0 : toolbar.position) === 'bottom' && renderToolbar(), maxLength && (jsxs(Text$1, { style: [styles.characterCount, { color: theme.text.secondary }], children: [content.text.length, "/", maxLength] })), error && (jsx(Text$1, { style: [styles.errorText, { color: theme.colors.error[5] }], children: error })), helperText && !error && (jsx(Text$1, { style: [styles.helperText, { color: theme.text.secondary }], children: helperText }))] }));
|
|
28753
|
-
});
|
|
28754
|
-
RichTextEditor.displayName = 'RichTextEditor';
|
|
28755
|
-
|
|
28756
28590
|
function RatingBase(rawProps, ref) {
|
|
28757
28591
|
const { disclaimerProps: disclaimerData, otherProps: propsAfterDisclaimer } = extractDisclaimerProps(rawProps);
|
|
28758
28592
|
const { spacingProps, otherProps: props } = extractSpacingProps(propsAfterDisclaimer);
|
|
@@ -29504,7 +29338,7 @@ function useMenuContext() {
|
|
|
29504
29338
|
return context;
|
|
29505
29339
|
}
|
|
29506
29340
|
function MenuBase(props, ref) {
|
|
29507
|
-
const { opened: controlledOpened, trigger = 'click', position = 'auto', offset = 4, closeOnClickOutside = true, closeOnEscape = true, onOpen, onClose,
|
|
29341
|
+
const { opened: controlledOpened, trigger = 'click', position = 'auto', offset = 4, closeOnClickOutside = true, closeOnEscape = true, onOpen, onClose, w = 'auto', maxH = 300, shadow = 'md', radius = 'md', children, testID, disabled = false, strategy = Platform.OS === 'web' ? 'fixed' : 'portal', ...spacingProps } = props;
|
|
29508
29342
|
const [internalOpened, setInternalOpened] = useState(false);
|
|
29509
29343
|
// Derive menu dropdown items from children each render for reactivity
|
|
29510
29344
|
const { menuItems, menuDropdownProps } = useMemo(() => {
|
|
@@ -29579,11 +29413,11 @@ function MenuBase(props, ref) {
|
|
|
29579
29413
|
const listGroupStyle = {
|
|
29580
29414
|
...styles.dropdown,
|
|
29581
29415
|
...(dropdownSpacingStyles || {}),
|
|
29582
|
-
maxHeight,
|
|
29416
|
+
maxHeight: maxH,
|
|
29583
29417
|
width: resolvedWidth,
|
|
29584
29418
|
};
|
|
29585
|
-
return (jsx(MenuContext.Provider, { value: menuContextValueOpened, children: jsx(ListGroup, { variant: "default", size: "sm", style: listGroupStyle, children: scrollable ? (jsx(ScrollView, { showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", style: { maxHeight }, children: jsx(ListGroupBody, { children: menuItems }) })) : (jsx(View, { style: { maxHeight, overflow: 'hidden' }, children: jsx(ListGroupBody, { children: menuItems }) })) }) }));
|
|
29586
|
-
}, [menuItems, menuDropdownProps, styles.dropdown, dropdownSpacingStyles,
|
|
29419
|
+
return (jsx(MenuContext.Provider, { value: menuContextValueOpened, children: jsx(ListGroup, { variant: "default", size: "sm", style: listGroupStyle, children: scrollable ? (jsx(ScrollView, { showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", style: { maxHeight: maxH }, children: jsx(ListGroupBody, { children: menuItems }) })) : (jsx(View, { style: { maxHeight: maxH, overflow: 'hidden' }, children: jsx(ListGroupBody, { children: menuItems }) })) }) }));
|
|
29420
|
+
}, [menuItems, menuDropdownProps, styles.dropdown, dropdownSpacingStyles, maxH, menuContextValueOpened]);
|
|
29587
29421
|
const handleOpen = useCallback(async (opts) => {
|
|
29588
29422
|
var _a, _b, _c, _d, _e, _f;
|
|
29589
29423
|
// Use ref to avoid stale isOpened value after async close from backdrop click
|
|
@@ -29615,7 +29449,7 @@ function MenuBase(props, ref) {
|
|
|
29615
29449
|
}
|
|
29616
29450
|
// Calculate base overlay size
|
|
29617
29451
|
const estimatedMenuHeight = 120; // Estimate for typical menu with 3-4 items
|
|
29618
|
-
const resolvedWidth =
|
|
29452
|
+
const resolvedWidth = w === 'target' ? triggerRect.width : (typeof w === 'number' ? w : (w === 'auto' ? 200 : 200));
|
|
29619
29453
|
const overlaySize = {
|
|
29620
29454
|
width: resolvedWidth,
|
|
29621
29455
|
height: estimatedMenuHeight,
|
|
@@ -29683,7 +29517,7 @@ function MenuBase(props, ref) {
|
|
|
29683
29517
|
catch (error) {
|
|
29684
29518
|
console.warn('Failed to open menu:', error);
|
|
29685
29519
|
}
|
|
29686
|
-
}, [disabled,
|
|
29520
|
+
}, [disabled, w, position, offset, strategy, closeOnClickOutside, closeOnEscape, onOpen, menuItems, trigger, buildMenuDropdown, onClose]);
|
|
29687
29521
|
// When menu content changes while open, update overlay content in place
|
|
29688
29522
|
useEffect(() => {
|
|
29689
29523
|
var _a;
|
|
@@ -29695,14 +29529,14 @@ function MenuBase(props, ref) {
|
|
|
29695
29529
|
return; // no structural change
|
|
29696
29530
|
lastSignatureRef.current = menuItemsSignature;
|
|
29697
29531
|
const currentId = overlayIdRef.current;
|
|
29698
|
-
const resolvedWidth = (_a = lastResolvedWidthRef.current) !== null && _a !== void 0 ? _a : (typeof
|
|
29532
|
+
const resolvedWidth = (_a = lastResolvedWidthRef.current) !== null && _a !== void 0 ? _a : (typeof w === 'number' ? w : undefined);
|
|
29699
29533
|
const menuDropdown = buildMenuDropdown(resolvedWidth);
|
|
29700
29534
|
if (!menuDropdown)
|
|
29701
29535
|
return;
|
|
29702
29536
|
updateOverlay(currentId, {
|
|
29703
29537
|
content: menuDropdown,
|
|
29704
29538
|
});
|
|
29705
|
-
}, [menuItemsSignature, menuItems, updateOverlay,
|
|
29539
|
+
}, [menuItemsSignature, menuItems, updateOverlay, w, buildMenuDropdown]);
|
|
29706
29540
|
const handleToggle = useCallback(() => {
|
|
29707
29541
|
if (isOpenedRef.current) {
|
|
29708
29542
|
handleClose();
|
|
@@ -31125,7 +30959,7 @@ function Avatar({ size = 'md', src, fallback, backgroundColor, textColor = 'whit
|
|
|
31125
30959
|
};
|
|
31126
30960
|
const containerStyle = {
|
|
31127
30961
|
position: 'relative',
|
|
31128
|
-
...style,
|
|
30962
|
+
...StyleSheet.flatten(style),
|
|
31129
30963
|
};
|
|
31130
30964
|
const content = (jsxs(View, { style: containerStyle, children: [jsx(View, { style: avatarStyle, children: src ? (jsx(Image$1, { source: { uri: src }, style: {
|
|
31131
30965
|
width: avatarSize,
|
|
@@ -31146,7 +30980,7 @@ function AvatarGroup({ children, limit, spacing = -8, style, size, bordered = tr
|
|
|
31146
30980
|
const containerStyle = {
|
|
31147
30981
|
flexDirection: 'row',
|
|
31148
30982
|
alignItems: 'center',
|
|
31149
|
-
...style,
|
|
30983
|
+
...StyleSheet.flatten(style),
|
|
31150
30984
|
};
|
|
31151
30985
|
const avatarWrapperStyle = (index) => ({
|
|
31152
30986
|
marginLeft: index > 0 ? spacing : 0,
|
|
@@ -31634,7 +31468,7 @@ const DEFAULT_ARROW_SIZE = 7;
|
|
|
31634
31468
|
const PopoverBase = (props, ref) => {
|
|
31635
31469
|
var _a;
|
|
31636
31470
|
const { children, opened: controlledOpened, defaultOpened = false, onChange, onOpen, onClose, onDismiss, trigger = 'click', disabled = false, closeOnClickOutside = true, closeOnEscape = true, clickOutsideEvents, // currently not implemented
|
|
31637
|
-
trapFocus = false, keepMounted = false, returnFocus = false, withinPortal = true, withOverlay = false, overlayProps,
|
|
31471
|
+
trapFocus = false, keepMounted = false, returnFocus = false, withinPortal = true, withOverlay = false, overlayProps, w, minW, minH, maxW, maxH, radius, shadow, zIndex = 300, position = 'bottom', offset = 8, floatingStrategy = 'fixed', middlewares, preventPositionChangeWhenVisible = false, hideDetached = true, viewport, keyboardAvoidance = true, fallbackPlacements, boundary, withRoles = true, id, withArrow = false, arrowSize = DEFAULT_ARROW_SIZE, arrowRadius = 0, arrowOffset = 5, arrowPosition = 'center', onPositionChange, testID, ...rest } = props;
|
|
31638
31472
|
const theme = useTheme();
|
|
31639
31473
|
const { spacingProps } = extractSpacingProps(rest);
|
|
31640
31474
|
const spacingStyles = getSpacingStyles(spacingProps);
|
|
@@ -31851,29 +31685,29 @@ const PopoverBase = (props, ref) => {
|
|
|
31851
31685
|
: undefined;
|
|
31852
31686
|
const widthOverride = (() => {
|
|
31853
31687
|
var _a, _b;
|
|
31854
|
-
if (typeof
|
|
31855
|
-
return
|
|
31856
|
-
if (
|
|
31688
|
+
if (typeof w === 'number')
|
|
31689
|
+
return w;
|
|
31690
|
+
if (w === 'target') {
|
|
31857
31691
|
return (_b = (_a = anchorMeasurementsRef.current) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : computedFinalWidth;
|
|
31858
31692
|
}
|
|
31859
31693
|
return computedFinalWidth;
|
|
31860
31694
|
})();
|
|
31861
31695
|
const sizeStyles = {};
|
|
31862
|
-
if (typeof
|
|
31863
|
-
sizeStyles.minWidth =
|
|
31864
|
-
if (typeof
|
|
31865
|
-
sizeStyles.minHeight =
|
|
31866
|
-
if (typeof
|
|
31867
|
-
sizeStyles.maxWidth =
|
|
31696
|
+
if (typeof minW === 'number')
|
|
31697
|
+
sizeStyles.minWidth = minW;
|
|
31698
|
+
if (typeof minH === 'number')
|
|
31699
|
+
sizeStyles.minHeight = minH;
|
|
31700
|
+
if (typeof maxW === 'number')
|
|
31701
|
+
sizeStyles.maxWidth = maxW;
|
|
31868
31702
|
const computedMaxHeight = positioningResult.maxHeight;
|
|
31869
31703
|
const resolvedMaxHeight = (() => {
|
|
31870
|
-
if (typeof
|
|
31704
|
+
if (typeof maxH === 'number') {
|
|
31871
31705
|
if (typeof computedMaxHeight === 'number') {
|
|
31872
|
-
return Math.min(
|
|
31706
|
+
return Math.min(maxH, computedMaxHeight);
|
|
31873
31707
|
}
|
|
31874
|
-
return
|
|
31708
|
+
return maxH;
|
|
31875
31709
|
}
|
|
31876
|
-
return typeof computedMaxHeight === 'number' ? computedMaxHeight :
|
|
31710
|
+
return typeof computedMaxHeight === 'number' ? computedMaxHeight : maxH;
|
|
31877
31711
|
})();
|
|
31878
31712
|
if (typeof resolvedMaxHeight === 'number')
|
|
31879
31713
|
sizeStyles.maxHeight = resolvedMaxHeight;
|
|
@@ -31897,7 +31731,7 @@ const PopoverBase = (props, ref) => {
|
|
|
31897
31731
|
zIndex,
|
|
31898
31732
|
});
|
|
31899
31733
|
onPositionChange === null || onPositionChange === void 0 ? void 0 : onPositionChange(positioningResult.placement);
|
|
31900
|
-
}, [opened, dropdownState, positioningResult, popoverRef, showOverlay, hideOverlay, popoverStyles.dropdown, popoverStyles.wrapper,
|
|
31734
|
+
}, [opened, dropdownState, positioningResult, popoverRef, showOverlay, hideOverlay, popoverStyles.dropdown, popoverStyles.wrapper, w, maxH, minW, minH, maxW, withArrow, arrowSize, arrowRadius, arrowOffset, arrowPosition, theme, zIndex, onPositionChange, schedulePositionUpdate, trigger, isPositioning]);
|
|
31901
31735
|
useEffect(() => {
|
|
31902
31736
|
return () => {
|
|
31903
31737
|
hideOverlay();
|
|
@@ -32185,7 +32019,7 @@ const getSpacingValue = (spacing, theme) => {
|
|
|
32185
32019
|
// Table Cell Components
|
|
32186
32020
|
const TableTh = (allProps) => {
|
|
32187
32021
|
const { spacingProps, otherProps } = extractSpacingProps(allProps);
|
|
32188
|
-
const { children, w, align = 'left',
|
|
32022
|
+
const { children, w, align = 'left', minW, maxW, flex, widthStrategy = 'auto', style } = otherProps;
|
|
32189
32023
|
const theme = useTheme();
|
|
32190
32024
|
const { isRTL } = useDirection();
|
|
32191
32025
|
// Swap alignment in RTL
|
|
@@ -32216,10 +32050,10 @@ const TableTh = (allProps) => {
|
|
|
32216
32050
|
else if (widthStrategy === 'auto') {
|
|
32217
32051
|
widthStyle.flex = 1;
|
|
32218
32052
|
}
|
|
32219
|
-
if (
|
|
32220
|
-
widthStyle.minWidth =
|
|
32221
|
-
if (
|
|
32222
|
-
widthStyle.maxWidth =
|
|
32053
|
+
if (minW)
|
|
32054
|
+
widthStyle.minWidth = minW;
|
|
32055
|
+
if (maxW)
|
|
32056
|
+
widthStyle.maxWidth = maxW;
|
|
32223
32057
|
return widthStyle;
|
|
32224
32058
|
};
|
|
32225
32059
|
const cellStyle = [
|
|
@@ -32240,7 +32074,7 @@ const TableTh = (allProps) => {
|
|
|
32240
32074
|
};
|
|
32241
32075
|
const TableTd = (allProps) => {
|
|
32242
32076
|
const { spacingProps, otherProps } = extractSpacingProps(allProps);
|
|
32243
|
-
const { children, w, align = 'left',
|
|
32077
|
+
const { children, w, align = 'left', minW, maxW, flex, widthStrategy = 'auto', style } = otherProps;
|
|
32244
32078
|
const theme = useTheme();
|
|
32245
32079
|
const { isRTL } = useDirection();
|
|
32246
32080
|
// Swap alignment in RTL
|
|
@@ -32271,10 +32105,10 @@ const TableTd = (allProps) => {
|
|
|
32271
32105
|
else if (widthStrategy === 'auto') {
|
|
32272
32106
|
widthStyle.flex = 1;
|
|
32273
32107
|
}
|
|
32274
|
-
if (
|
|
32275
|
-
widthStyle.minWidth =
|
|
32276
|
-
if (
|
|
32277
|
-
widthStyle.maxWidth =
|
|
32108
|
+
if (minW)
|
|
32109
|
+
widthStyle.minWidth = minW;
|
|
32110
|
+
if (maxW)
|
|
32111
|
+
widthStyle.maxWidth = maxW;
|
|
32278
32112
|
return widthStyle;
|
|
32279
32113
|
};
|
|
32280
32114
|
const cellStyle = [
|
|
@@ -32353,16 +32187,16 @@ const TableCaption = (allProps) => {
|
|
|
32353
32187
|
// Scroll Container Component
|
|
32354
32188
|
const TableScrollContainer = (allProps) => {
|
|
32355
32189
|
const { spacingProps, otherProps } = extractSpacingProps(allProps);
|
|
32356
|
-
const { children,
|
|
32190
|
+
const { children, minW = 500, maxH, type = 'native', style } = otherProps;
|
|
32357
32191
|
const containerStyle = [
|
|
32358
32192
|
{
|
|
32359
32193
|
width: '100%',
|
|
32360
|
-
maxHeight
|
|
32194
|
+
maxHeight: maxH
|
|
32361
32195
|
},
|
|
32362
32196
|
getSpacingStyles(spacingProps),
|
|
32363
32197
|
style
|
|
32364
32198
|
];
|
|
32365
|
-
const scrollViewStyle =
|
|
32199
|
+
const scrollViewStyle = minW ? { minWidth: minW } : undefined;
|
|
32366
32200
|
return (jsx(View, { style: containerStyle, children: jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: Platform.OS === 'web', contentContainerStyle: scrollViewStyle, children: jsx(ScrollView, { style: { flex: 1 }, showsVerticalScrollIndicator: Platform.OS === 'web', children: children }) }) }));
|
|
32367
32201
|
};
|
|
32368
32202
|
// Main Table Component
|
|
@@ -33300,7 +33134,7 @@ expandableRowRender, initialExpandedRows = [], expandedRows: controlledExpandedR
|
|
|
33300
33134
|
alignItems: 'center',
|
|
33301
33135
|
marginBottom: DESIGN_TOKENS.spacing.md,
|
|
33302
33136
|
paddingHorizontal: DESIGN_TOKENS.spacing.xs
|
|
33303
|
-
}, children: [jsx(Flex, { gap: DESIGN_TOKENS.spacing.md, align: "center", children: selectedRows.length > 0 && bulkActions.length > 0 && (jsxs(Flex, { gap: 8, children: [jsxs(Text, { variant: "small", colorVariant: "muted", children: [selectedRows.length, " selected"] }), bulkActions.map(action => (jsx(Button, { variant: "outline", size: "sm", startIcon: action.icon, onPress: () => action.action(selectedRows, data), children: action.label }, action.key)))] })) }), jsxs(Flex, { gap: 8, children: [(searchable || columns.some(c => c.filterable)) && (jsxs(Popover, { position: "bottom-end", offset: { mainAxis: 12 },
|
|
33137
|
+
}, children: [jsx(Flex, { gap: DESIGN_TOKENS.spacing.md, align: "center", children: selectedRows.length > 0 && bulkActions.length > 0 && (jsxs(Flex, { gap: 8, children: [jsxs(Text, { variant: "small", colorVariant: "muted", children: [selectedRows.length, " selected"] }), bulkActions.map(action => (jsx(Button, { variant: "outline", size: "sm", startIcon: action.icon, onPress: () => action.action(selectedRows, data), children: action.label }, action.key)))] })) }), jsxs(Flex, { gap: 8, children: [(searchable || columns.some(c => c.filterable)) && (jsxs(Popover, { position: "bottom-end", offset: { mainAxis: 12 }, w: 320, trapFocus: true, children: [jsx(Popover.Target, { children: jsxs(Button, { variant: "outline", size: "sm", startIcon: jsx(Icon, { name: "search", size: 14 }), children: ["Search", (searchValue || activeFilters.length > 0) && (jsx(View, { style: {
|
|
33304
33138
|
width: 6,
|
|
33305
33139
|
height: 6,
|
|
33306
33140
|
borderRadius: 3,
|
|
@@ -33330,7 +33164,7 @@ expandableRowRender, initialExpandedRows = [], expandedRows: controlledExpandedR
|
|
|
33330
33164
|
}) })), jsx(Flex, { direction: "column", gap: DESIGN_TOKENS.spacing.sm, children: columns.filter(c => c.filterable).map(column => {
|
|
33331
33165
|
const currentFilter = getColumnFilter(column.key);
|
|
33332
33166
|
return (jsx(View, { children: renderFilterControl(column) }, `${column.key}-${(currentFilter === null || currentFilter === void 0 ? void 0 : currentFilter.value) || 'no-filter'}`));
|
|
33333
|
-
}) })] }))] }) })] })), onEditModeChange && (jsx(Button, { variant: editMode ? 'filled' : 'outline', size: "sm", onPress: () => onEditModeChange(!editMode), children: editMode ? 'Exit Edit' : 'Edit' })), showColumnVisibilityManager && (jsxs(Popover, { position: "bottom-end", offset: { mainAxis: 12 },
|
|
33167
|
+
}) })] }))] }) })] })), onEditModeChange && (jsx(Button, { variant: editMode ? 'filled' : 'outline', size: "sm", onPress: () => onEditModeChange(!editMode), children: editMode ? 'Exit Edit' : 'Edit' })), showColumnVisibilityManager && (jsxs(Popover, { position: "bottom-end", offset: { mainAxis: 12 }, w: 280, trapFocus: true, children: [jsx(Popover.Target, { children: jsx(Button, { variant: "outline", size: "sm", startIcon: jsx(Icon, { name: "eye", size: 14 }), children: "Columns" }) }), jsx(Popover.Dropdown, { children: jsxs(View, { style: { padding: 8, maxHeight: 300, width: 260 }, children: [jsx(ComponentWithDisclaimer, { disclaimer: "Selected view determines the layout style", disclaimerProps: { colorVariant: 'muted', size: 'sm' }, children: jsxs(Row, { children: [jsx(Button, { size: "xs", title: "Deselect All", variant: hiddenColumns.length === columns.length ? 'filled' : 'outline', onPress: () => setHiddenColumns(columns.map(c => c.key)), style: { marginBottom: 8 } }), jsx(Button, { size: "xs", title: "Select All", variant: hiddenColumns.length === 0 ? 'filled' : 'outline', onPress: () => setHiddenColumns([]), style: { marginBottom: 8 } })] }) }), jsx(ScrollView, { style: { maxHeight: 200 }, children: columns.map(col => (jsx(Checkbox, { label: tempHeaderEdits[col.key] || col.header, onChange: () => {
|
|
33334
33168
|
if (hiddenColumns.includes(col.key)) {
|
|
33335
33169
|
setHiddenColumns(prev => prev.filter(h => h !== col.key));
|
|
33336
33170
|
}
|
|
@@ -33704,9 +33538,9 @@ const resolveTokenColor = (token, theme) => {
|
|
|
33704
33538
|
return token; // assume raw color string
|
|
33705
33539
|
};
|
|
33706
33540
|
// Item
|
|
33707
|
-
const TimelineItem = forwardRef(({ children, title, bullet, colorVariant, lineVariant = 'solid', color, active, itemIndex = 0, isLastItem = false, itemAlign, ...rest }, ref) => {
|
|
33541
|
+
const TimelineItem = forwardRef(({ children, title, timestamp, bullet, colorVariant, lineVariant = 'solid', color, titleColor, descriptionColor, timestampColor, active, itemIndex = 0, isLastItem = false, itemAlign, ...rest }, ref) => {
|
|
33708
33542
|
const theme = useTheme();
|
|
33709
|
-
const { active: timelineActive, color: timelineColor, lineWidth, bulletSize: contextBulletSize, align, reverseActive, size, centerMode, metrics, } = useTimelineContext();
|
|
33543
|
+
const { active: timelineActive, color: timelineColor, lineWidth, bulletSize: contextBulletSize, align, reverseActive, size, centerMode, metrics, titleColor: timelineTitleColor, descriptionColor: timelineDescriptionColor, timestampColor: timelineTimestampColor, } = useTimelineContext();
|
|
33710
33544
|
const sizeConfig = metrics;
|
|
33711
33545
|
const finalBulletSize = contextBulletSize || sizeConfig.bulletSize;
|
|
33712
33546
|
const showAllColored = timelineActive === undefined;
|
|
@@ -33721,6 +33555,9 @@ const TimelineItem = forwardRef(({ children, title, bullet, colorVariant, lineVa
|
|
|
33721
33555
|
const resolvedItemColor = color
|
|
33722
33556
|
? color
|
|
33723
33557
|
: (colorVariant ? resolveTokenColor(colorVariant, theme) : timelineColor);
|
|
33558
|
+
const resolvedTitleColor = titleColor !== null && titleColor !== void 0 ? titleColor : timelineTitleColor;
|
|
33559
|
+
const resolvedDescriptionColor = descriptionColor !== null && descriptionColor !== void 0 ? descriptionColor : timelineDescriptionColor;
|
|
33560
|
+
const resolvedTimestampColor = timestampColor !== null && timestampColor !== void 0 ? timestampColor : timelineTimestampColor;
|
|
33724
33561
|
// Active logic
|
|
33725
33562
|
const isActive = showAllColored
|
|
33726
33563
|
? true
|
|
@@ -33806,10 +33643,16 @@ const TimelineItem = forwardRef(({ children, title, bullet, colorVariant, lineVa
|
|
|
33806
33643
|
const getTitleStyle = () => ({
|
|
33807
33644
|
fontSize: sizeConfig.fontSize,
|
|
33808
33645
|
fontWeight: '600',
|
|
33809
|
-
color: theme.text.primary,
|
|
33646
|
+
color: resolvedTitleColor !== null && resolvedTitleColor !== void 0 ? resolvedTitleColor : theme.text.primary,
|
|
33810
33647
|
marginBottom: title && children ? 4 : 0,
|
|
33811
33648
|
textAlign: effectiveAlign === 'right' ? 'right' : 'left',
|
|
33812
33649
|
});
|
|
33650
|
+
const getTimestampStyle = () => ({
|
|
33651
|
+
fontSize: Math.max(10, Math.round(sizeConfig.fontSize * 0.8)),
|
|
33652
|
+
color: resolvedTimestampColor !== null && resolvedTimestampColor !== void 0 ? resolvedTimestampColor : theme.text.secondary,
|
|
33653
|
+
marginBottom: (title || children) ? 4 : 0,
|
|
33654
|
+
textAlign: effectiveAlign === 'right' ? 'right' : 'left',
|
|
33655
|
+
});
|
|
33813
33656
|
const getItemWrapperStyle = () => {
|
|
33814
33657
|
if (centerMode) {
|
|
33815
33658
|
return {
|
|
@@ -33825,36 +33668,53 @@ const TimelineItem = forwardRef(({ children, title, bullet, colorVariant, lineVa
|
|
|
33825
33668
|
alignItems: 'flex-start',
|
|
33826
33669
|
};
|
|
33827
33670
|
};
|
|
33671
|
+
const applyTextStyle = (nodes, styleOverride) => {
|
|
33672
|
+
if (!styleOverride)
|
|
33673
|
+
return nodes;
|
|
33674
|
+
return React__default.Children.map(nodes, (child) => {
|
|
33675
|
+
var _a;
|
|
33676
|
+
if (typeof child === 'string' || typeof child === 'number') {
|
|
33677
|
+
return jsx(Text$1, { style: styleOverride, children: child });
|
|
33678
|
+
}
|
|
33679
|
+
if (!React__default.isValidElement(child))
|
|
33680
|
+
return child;
|
|
33681
|
+
const props = child.props || {};
|
|
33682
|
+
const isTextLike = ((_a = child.type) === null || _a === void 0 ? void 0 : _a.displayName) === 'Text' || child.type === Text$1 || typeof props.children === 'string';
|
|
33683
|
+
if (isTextLike) {
|
|
33684
|
+
const mergedStyle = Array.isArray(props.style)
|
|
33685
|
+
? [...props.style, styleOverride]
|
|
33686
|
+
: [props.style, styleOverride];
|
|
33687
|
+
return React__default.cloneElement(child, { style: mergedStyle });
|
|
33688
|
+
}
|
|
33689
|
+
if (props.children) {
|
|
33690
|
+
return React__default.cloneElement(child, { children: applyTextStyle(props.children, styleOverride) });
|
|
33691
|
+
}
|
|
33692
|
+
return child;
|
|
33693
|
+
});
|
|
33694
|
+
};
|
|
33828
33695
|
if (centerMode) {
|
|
33829
33696
|
// Three column layout: left content | bullet/line | right content
|
|
33830
33697
|
const leftContent = effectiveAlign === 'left' && (title || children);
|
|
33831
33698
|
const rightContent = effectiveAlign === 'right' && (title || children);
|
|
33832
33699
|
// Helper to clone Text children with alignment
|
|
33833
33700
|
const alignChildText = (nodes, side) => {
|
|
33834
|
-
|
|
33835
|
-
|
|
33836
|
-
|
|
33837
|
-
|
|
33838
|
-
|
|
33839
|
-
const isTextLike = ((_a = child.type) === null || _a === void 0 ? void 0 : _a.displayName) === 'Text' || (typeof props.children === 'string');
|
|
33840
|
-
if (isTextLike) {
|
|
33841
|
-
const mergedStyle = Array.isArray(props.style)
|
|
33842
|
-
? [...props.style, { textAlign: side }]
|
|
33843
|
-
: [props.style, { textAlign: side }];
|
|
33844
|
-
return React__default.cloneElement(child, { style: mergedStyle });
|
|
33845
|
-
}
|
|
33846
|
-
if (props.children) {
|
|
33847
|
-
return React__default.cloneElement(child, { children: alignChildText(props.children, side) });
|
|
33848
|
-
}
|
|
33849
|
-
return child;
|
|
33850
|
-
});
|
|
33701
|
+
const styleOverride = {
|
|
33702
|
+
textAlign: side,
|
|
33703
|
+
...(resolvedDescriptionColor ? { color: resolvedDescriptionColor } : {}),
|
|
33704
|
+
};
|
|
33705
|
+
return applyTextStyle(nodes, styleOverride);
|
|
33851
33706
|
};
|
|
33852
|
-
return (jsxs(View, { ref: ref, style: getItemWrapperStyle(), ...rest, children: [jsx(View, { style: { flex: 1, paddingRight: sizeConfig.spacing, alignItems: 'flex-end' }, children: leftContent && (jsxs(View, { style: { width: '100%', alignItems: 'flex-end' }, children: [title && jsx(Text$1, { style: [getTitleStyle(), { textAlign: 'right' }], children: title }), alignChildText(children, 'right')] })) }), jsxs(View, { style: { width: finalBulletSize, alignItems: 'center', position: 'relative' }, children: [getLine(), jsx(View, { style: getBulletStyle(), children: bullet })] }), jsx(View, { style: { flex: 1, paddingLeft: sizeConfig.spacing, alignItems: 'flex-start' }, children: rightContent && (jsxs(View, { style: { width: '100%', alignItems: 'flex-start' }, children: [title && jsx(Text$1, { style: [getTitleStyle(), { textAlign: 'left' }], children: title }), alignChildText(children, 'left')] })) })] }));
|
|
33707
|
+
return (jsxs(View, { ref: ref, style: getItemWrapperStyle(), ...rest, children: [jsx(View, { style: { flex: 1, paddingRight: sizeConfig.spacing, alignItems: 'flex-end' }, children: leftContent && (jsxs(View, { style: { width: '100%', alignItems: 'flex-end' }, children: [timestamp && (jsx(Text$1, { style: [getTimestampStyle(), { textAlign: 'right' }], children: timestamp })), title && jsx(Text$1, { style: [getTitleStyle(), { textAlign: 'right' }], children: title }), alignChildText(children, 'right')] })) }), jsxs(View, { style: { width: finalBulletSize, alignItems: 'center', position: 'relative' }, children: [getLine(), jsx(View, { style: getBulletStyle(), children: bullet })] }), jsx(View, { style: { flex: 1, paddingLeft: sizeConfig.spacing, alignItems: 'flex-start' }, children: rightContent && (jsxs(View, { style: { width: '100%', alignItems: 'flex-start' }, children: [timestamp && (jsx(Text$1, { style: [getTimestampStyle(), { textAlign: 'left' }], children: timestamp })), title && jsx(Text$1, { style: [getTitleStyle(), { textAlign: 'left' }], children: title }), alignChildText(children, 'left')] })) })] }));
|
|
33853
33708
|
}
|
|
33854
|
-
return (jsxs(View, { ref: ref, style: getItemWrapperStyle(), ...rest, children: [getLine(), jsx(View, { style: getBulletStyle(), children: bullet }), (title || children) && (jsxs(View, { style: getContentStyle(), children: [
|
|
33709
|
+
return (jsxs(View, { ref: ref, style: getItemWrapperStyle(), ...rest, children: [getLine(), jsx(View, { style: getBulletStyle(), children: bullet }), (title || children) && (jsxs(View, { style: getContentStyle(), children: [timestamp && jsx(Text$1, { style: getTimestampStyle(), children: timestamp }), title && jsx(Text$1, { style: getTitleStyle(), children: title }), resolvedDescriptionColor
|
|
33710
|
+
? applyTextStyle(children, {
|
|
33711
|
+
color: resolvedDescriptionColor,
|
|
33712
|
+
textAlign: effectiveAlign === 'right' ? 'right' : 'left',
|
|
33713
|
+
})
|
|
33714
|
+
: children] }))] }));
|
|
33855
33715
|
});
|
|
33856
33716
|
// Root Timeline
|
|
33857
|
-
const Timeline = forwardRef(({ children, active, color, colorVariant, lineWidth, bulletSize, align = 'left', reverseActive = false, size = 'md', centerMode = false, ...rest }, ref) => {
|
|
33717
|
+
const Timeline = forwardRef(({ children, active, color, colorVariant, titleColor, descriptionColor, timestampColor, lineWidth, bulletSize, align = 'left', reverseActive = false, size = 'md', centerMode = false, ...rest }, ref) => {
|
|
33858
33718
|
const theme = useTheme();
|
|
33859
33719
|
const clampedSize = clampComponentSize(size, TIMELINE_ALLOWED_SIZES);
|
|
33860
33720
|
const baseMetrics = resolveTimelineMetrics(clampedSize);
|
|
@@ -33876,6 +33736,9 @@ const Timeline = forwardRef(({ children, active, color, colorVariant, lineWidth,
|
|
|
33876
33736
|
size: clampedSize,
|
|
33877
33737
|
metrics,
|
|
33878
33738
|
centerMode,
|
|
33739
|
+
titleColor,
|
|
33740
|
+
descriptionColor,
|
|
33741
|
+
timestampColor,
|
|
33879
33742
|
};
|
|
33880
33743
|
const items = [];
|
|
33881
33744
|
React__default.Children.forEach(children, (child, index) => {
|
|
@@ -34593,7 +34456,7 @@ const Notice = factory(NoticeBase);
|
|
|
34593
34456
|
Notice.displayName = 'Notice';
|
|
34594
34457
|
|
|
34595
34458
|
function SkeletonBase(props, ref) {
|
|
34596
|
-
const { shape = 'rectangle',
|
|
34459
|
+
const { shape = 'rectangle', w, h, size = 'md', radius, animate = true, animationDuration = 1500, colors, style, testID, ...rest } = props;
|
|
34597
34460
|
const { spacingProps, otherProps } = extractSpacingProps(rest);
|
|
34598
34461
|
const spacingStyles = getSpacingStyles(spacingProps);
|
|
34599
34462
|
const theme = useTheme();
|
|
@@ -34614,36 +34477,36 @@ function SkeletonBase(props, ref) {
|
|
|
34614
34477
|
switch (shape) {
|
|
34615
34478
|
case 'text':
|
|
34616
34479
|
return {
|
|
34617
|
-
width:
|
|
34618
|
-
height:
|
|
34480
|
+
width: w || '100%',
|
|
34481
|
+
height: h || getSpacing('md')
|
|
34619
34482
|
};
|
|
34620
34483
|
case 'chip':
|
|
34621
34484
|
return {
|
|
34622
|
-
width:
|
|
34623
|
-
height:
|
|
34485
|
+
width: w || (sizeValue * 3),
|
|
34486
|
+
height: h || sizeValue
|
|
34624
34487
|
};
|
|
34625
34488
|
case 'avatar':
|
|
34626
34489
|
case 'circle':
|
|
34627
34490
|
return {
|
|
34628
|
-
width:
|
|
34629
|
-
height:
|
|
34491
|
+
width: w || sizeValue,
|
|
34492
|
+
height: h || sizeValue
|
|
34630
34493
|
};
|
|
34631
34494
|
case 'button':
|
|
34632
34495
|
return {
|
|
34633
|
-
width:
|
|
34634
|
-
height:
|
|
34496
|
+
width: w || (sizeValue * 4),
|
|
34497
|
+
height: h || sizeValue
|
|
34635
34498
|
};
|
|
34636
34499
|
case 'card':
|
|
34637
34500
|
return {
|
|
34638
|
-
width:
|
|
34639
|
-
height:
|
|
34501
|
+
width: w || '100%',
|
|
34502
|
+
height: h || (sizeValue * 6)
|
|
34640
34503
|
};
|
|
34641
34504
|
case 'rectangle':
|
|
34642
34505
|
case 'rounded':
|
|
34643
34506
|
default:
|
|
34644
34507
|
return {
|
|
34645
|
-
width:
|
|
34646
|
-
height:
|
|
34508
|
+
width: w || '100%',
|
|
34509
|
+
height: h || sizeValue
|
|
34647
34510
|
};
|
|
34648
34511
|
}
|
|
34649
34512
|
};
|
|
@@ -35711,7 +35574,7 @@ const styles$6 = StyleSheet.create({
|
|
|
35711
35574
|
},
|
|
35712
35575
|
});
|
|
35713
35576
|
|
|
35714
|
-
const WaveformSkeleton = ({
|
|
35577
|
+
const WaveformSkeleton = ({ w = 300, h = 60, fullWidth = false, barsCount = 20, }) => {
|
|
35715
35578
|
const theme = useTheme();
|
|
35716
35579
|
const styles = StyleSheet.create({
|
|
35717
35580
|
animatedBar: {
|
|
@@ -35727,18 +35590,18 @@ const WaveformSkeleton = ({ width = 300, height = 60, fullWidth = false, barsCou
|
|
|
35727
35590
|
backgroundColor: theme.colors.gray[1],
|
|
35728
35591
|
borderRadius: 4,
|
|
35729
35592
|
flexDirection: 'row',
|
|
35730
|
-
height,
|
|
35593
|
+
height: h,
|
|
35731
35594
|
justifyContent: 'space-between',
|
|
35732
35595
|
paddingHorizontal: 4,
|
|
35733
|
-
width: fullWidth ? '100%' :
|
|
35596
|
+
width: fullWidth ? '100%' : w,
|
|
35734
35597
|
},
|
|
35735
35598
|
});
|
|
35736
35599
|
// Generate random heights for skeleton bars
|
|
35737
35600
|
const barHeights = Array.from({ length: barsCount }, () => Math.random() * 0.6 + 0.2 // Heights between 20% and 80% of container
|
|
35738
35601
|
);
|
|
35739
|
-
const barWidth = fullWidth ? 'auto' : Math.max(1, (
|
|
35602
|
+
const barWidth = fullWidth ? 'auto' : Math.max(1, (w - 40) / barsCount - 2);
|
|
35740
35603
|
return (jsx(View, { style: styles.container, children: barHeights.map((heightRatio, index) => {
|
|
35741
|
-
const barHeight =
|
|
35604
|
+
const barHeight = h * heightRatio;
|
|
35742
35605
|
const isAnimated = index % 3 === 0; // Animate every 3rd bar for shimmer effect
|
|
35743
35606
|
return (jsx(View, { style: [
|
|
35744
35607
|
styles.bar,
|
|
@@ -35753,7 +35616,7 @@ const WaveformSkeleton = ({ width = 300, height = 60, fullWidth = false, barsCou
|
|
|
35753
35616
|
}) }));
|
|
35754
35617
|
};
|
|
35755
35618
|
|
|
35756
|
-
const Waveform = React__default.memo(({ peaks,
|
|
35619
|
+
const Waveform = React__default.memo(({ peaks, w = 300, h = 60, color = 'primary', barWidth = 2, barGap = 1, strokeWidth = 2, minBarHeight = 1, variant = 'bars', gradientColors, progress = 0, progressColor, interactive = false, normalize = false, fullWidth = false, onSeek, onDragStart, onDrag, onDragEnd, accessibilityLabel, accessibilityHint, style, maxVisibleBars, showProgressLine = false, progressLineStyle, showTimeStamps = false, duration, timeStampInterval,
|
|
35757
35620
|
// New features
|
|
35758
35621
|
loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel = 1, zoomCenter = 0.5, onZoomChange, enableAnimations = true, showRMS = false, rmsData, markers = [], enablePerformanceMonitoring = false, onPerformanceMetrics, ...restProps }) => {
|
|
35759
35622
|
const theme = useTheme();
|
|
@@ -35840,12 +35703,12 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
35840
35703
|
targetBars = maxVisibleBars || peaks.length;
|
|
35841
35704
|
}
|
|
35842
35705
|
else {
|
|
35843
|
-
// For fixed
|
|
35844
|
-
const maxBars = Math.floor(
|
|
35706
|
+
// For fixed w, calculate how many bars fit
|
|
35707
|
+
const maxBars = Math.floor(w / totalBarSpace);
|
|
35845
35708
|
targetBars = maxVisibleBars ? Math.min(maxBars, maxVisibleBars) : maxBars;
|
|
35846
35709
|
}
|
|
35847
35710
|
if (targetBars <= 0) {
|
|
35848
|
-
console.warn('Waveform: Not enough
|
|
35711
|
+
console.warn('Waveform: Not enough w to render any bars');
|
|
35849
35712
|
return [];
|
|
35850
35713
|
}
|
|
35851
35714
|
// If we have fewer peaks than target bars, return all peaks
|
|
@@ -35868,7 +35731,7 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
35868
35731
|
downsampled.push(maxValue);
|
|
35869
35732
|
}
|
|
35870
35733
|
return downsampled;
|
|
35871
|
-
}, [peaks,
|
|
35734
|
+
}, [peaks, w, barWidth, barGap, fullWidth, maxVisibleBars]);
|
|
35872
35735
|
// Normalize peaks if requested
|
|
35873
35736
|
const normalizedPeaks = useMemo(() => {
|
|
35874
35737
|
if (!normalize || processedPeaks.length === 0) {
|
|
@@ -35891,16 +35754,16 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
35891
35754
|
if (fullWidth) {
|
|
35892
35755
|
return {
|
|
35893
35756
|
width: '100%',
|
|
35894
|
-
height:
|
|
35895
|
-
viewBox: `0 0 ${actualWaveformWidth} ${
|
|
35757
|
+
height: h,
|
|
35758
|
+
viewBox: `0 0 ${actualWaveformWidth} ${h}`,
|
|
35896
35759
|
preserveAspectRatio: 'none'
|
|
35897
35760
|
};
|
|
35898
35761
|
}
|
|
35899
35762
|
return {
|
|
35900
|
-
width:
|
|
35901
|
-
height:
|
|
35763
|
+
width: w,
|
|
35764
|
+
height: h
|
|
35902
35765
|
};
|
|
35903
|
-
}, [fullWidth, actualWaveformWidth,
|
|
35766
|
+
}, [fullWidth, actualWaveformWidth, h, w]);
|
|
35904
35767
|
const handleLayout = useCallback((event) => {
|
|
35905
35768
|
const { width: containerWidth, height: containerHeight } = event.nativeEvent.layout;
|
|
35906
35769
|
setContainerDimensions({ width: containerWidth, height: containerHeight });
|
|
@@ -35915,7 +35778,7 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
35915
35778
|
}
|
|
35916
35779
|
else {
|
|
35917
35780
|
// Fallback if container hasn't been measured yet
|
|
35918
|
-
position = locationX / (
|
|
35781
|
+
position = locationX / (w || 300);
|
|
35919
35782
|
}
|
|
35920
35783
|
}
|
|
35921
35784
|
else {
|
|
@@ -35923,7 +35786,7 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
35923
35786
|
position = Math.min(locationX, actualWaveformWidth) / actualWaveformWidth;
|
|
35924
35787
|
}
|
|
35925
35788
|
return Math.max(0, Math.min(1, position));
|
|
35926
|
-
}, [fullWidth, containerDimensions.width,
|
|
35789
|
+
}, [fullWidth, containerDimensions.width, w, actualWaveformWidth]);
|
|
35927
35790
|
const handleResponderGrant = useCallback((event) => {
|
|
35928
35791
|
var _a, _b, _c;
|
|
35929
35792
|
if (!interactive)
|
|
@@ -36010,8 +35873,8 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36010
35873
|
const renderBars = () => {
|
|
36011
35874
|
return normalizedPeaks.map((peak, index) => {
|
|
36012
35875
|
const x = index * (barWidth + barGap);
|
|
36013
|
-
const barHeight = Math.max(minBarHeight, Math.abs(peak) *
|
|
36014
|
-
const y = (
|
|
35876
|
+
const barHeight = Math.max(minBarHeight, Math.abs(peak) * h * 0.8);
|
|
35877
|
+
const y = (h - barHeight) / 2;
|
|
36015
35878
|
const isProgress = x < progressX;
|
|
36016
35879
|
const fillColor = isProgress ? actualProgressColor : waveformColor;
|
|
36017
35880
|
return (jsx(Rect, { x: x, y: y, width: barWidth, height: barHeight, fill: fillColor, rx: variant === 'rounded' ? barWidth / 2 : 0 }, index));
|
|
@@ -36025,7 +35888,7 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36025
35888
|
const stepX = actualWaveformWidth / (normalizedPeaks.length - 1);
|
|
36026
35889
|
normalizedPeaks.forEach((peak, index) => {
|
|
36027
35890
|
const x = index * stepX;
|
|
36028
|
-
const y =
|
|
35891
|
+
const y = h / 2 + (peak * h * 0.4);
|
|
36029
35892
|
const lineCommand = index === 0 ? `M ${x} ${y}` : ` L ${x} ${y}`;
|
|
36030
35893
|
pathData += lineCommand;
|
|
36031
35894
|
// Build progress path up to the progress position
|
|
@@ -36039,8 +35902,8 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36039
35902
|
const renderGradient = () => {
|
|
36040
35903
|
return (jsxs(Fragment, { children: [jsx(Defs, { children: jsx(LinearGradient, { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: resolvedGradientColors.map((color, index) => (jsx(Stop, { offset: `${(index / (resolvedGradientColors.length - 1 || 1)) * 100}%`, stopColor: color }, index))) }) }), normalizedPeaks.map((peak, index) => {
|
|
36041
35904
|
const x = index * (barWidth + barGap);
|
|
36042
|
-
const barHeight = Math.max(minBarHeight, Math.abs(peak) *
|
|
36043
|
-
const y = (
|
|
35905
|
+
const barHeight = Math.max(minBarHeight, Math.abs(peak) * h * 0.8);
|
|
35906
|
+
const y = (h - barHeight) / 2;
|
|
36044
35907
|
return (jsx(Rect, { x: x, y: y, width: barWidth, height: barHeight, fill: `url(#${gradientId})` }, index));
|
|
36045
35908
|
})] }));
|
|
36046
35909
|
};
|
|
@@ -36050,8 +35913,8 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36050
35913
|
return null;
|
|
36051
35914
|
const clampedProgress = Math.max(0, Math.min(1, progress));
|
|
36052
35915
|
const progressX = clampedProgress * actualWaveformWidth;
|
|
36053
|
-
return (jsx(Line, { x1: progressX, y1: 0, x2: progressX, y2:
|
|
36054
|
-
}, [showProgressLine, progress, actualWaveformWidth,
|
|
35916
|
+
return (jsx(Line, { x1: progressX, y1: 0, x2: progressX, y2: h, stroke: (progressLineStyle === null || progressLineStyle === void 0 ? void 0 : progressLineStyle.color) || theme.colors.gray[7], strokeWidth: (progressLineStyle === null || progressLineStyle === void 0 ? void 0 : progressLineStyle.width) || 2, strokeOpacity: (progressLineStyle === null || progressLineStyle === void 0 ? void 0 : progressLineStyle.opacity) || 0.8 }));
|
|
35917
|
+
}, [showProgressLine, progress, actualWaveformWidth, h, progressLineStyle, theme.colors.gray]);
|
|
36055
35918
|
// Timestamp markers component
|
|
36056
35919
|
const TimeStamps = useMemo(() => {
|
|
36057
35920
|
if (!showTimeStamps || !duration || !timeStampInterval)
|
|
@@ -36072,10 +35935,10 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36072
35935
|
}
|
|
36073
35936
|
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
36074
35937
|
};
|
|
36075
|
-
timestamps.push(jsxs(G, { children: [jsx(Line, { x1: x, y1:
|
|
35938
|
+
timestamps.push(jsxs(G, { children: [jsx(Line, { x1: x, y1: h - 10, x2: x, y2: h, stroke: theme.colors.gray[5], strokeWidth: 1, strokeOpacity: 0.6 }), jsx(Text$2, { x: x, y: h + 15, fill: theme.colors.gray[6], fontSize: 10, textAnchor: "middle", opacity: 0.8, children: formatTime(time) })] }, i));
|
|
36076
35939
|
}
|
|
36077
35940
|
return jsx(G, { children: timestamps });
|
|
36078
|
-
}, [showTimeStamps, duration, timeStampInterval, actualWaveformWidth,
|
|
35941
|
+
}, [showTimeStamps, duration, timeStampInterval, actualWaveformWidth, h, theme.colors]);
|
|
36079
35942
|
// Selection overlay component
|
|
36080
35943
|
const SelectionOverlay = useMemo(() => {
|
|
36081
35944
|
if (!selection || selection[0] === selection[1])
|
|
@@ -36084,8 +35947,8 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36084
35947
|
const startX = start * actualWaveformWidth;
|
|
36085
35948
|
const endX = end * actualWaveformWidth;
|
|
36086
35949
|
const selectionWidth = endX - startX;
|
|
36087
|
-
return (jsx(Rect, { x: startX, y: 0, width: selectionWidth, height:
|
|
36088
|
-
}, [selection, actualWaveformWidth,
|
|
35950
|
+
return (jsx(Rect, { x: startX, y: 0, width: selectionWidth, height: h, fill: theme.colors.primary[3], opacity: 0.3, stroke: theme.colors.primary[5], strokeWidth: 1, strokeOpacity: 0.8 }));
|
|
35951
|
+
}, [selection, actualWaveformWidth, h, theme.colors.primary]);
|
|
36089
35952
|
// Markers component
|
|
36090
35953
|
const Markers = useMemo(() => {
|
|
36091
35954
|
if (!markers || markers.length === 0)
|
|
@@ -36095,16 +35958,16 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36095
35958
|
const markerColor = marker.color || theme.colors.warning[5];
|
|
36096
35959
|
switch (marker.type || 'line') {
|
|
36097
35960
|
case 'line':
|
|
36098
|
-
return (jsxs(G, { children: [jsx(Line, { x1: x, y1: 0, x2: x, y2:
|
|
35961
|
+
return (jsxs(G, { children: [jsx(Line, { x1: x, y1: 0, x2: x, y2: h, stroke: markerColor, strokeWidth: 2, strokeOpacity: 0.8 }), marker.label && (jsx(Text$2, { x: x, y: -5, fill: markerColor, fontSize: 10, textAnchor: "middle", fontWeight: "bold", children: marker.label }))] }, index));
|
|
36099
35962
|
case 'flag':
|
|
36100
|
-
return (jsxs(G, { children: [jsx(Line, { x1: x, y1: 0, x2: x, y2:
|
|
35963
|
+
return (jsxs(G, { children: [jsx(Line, { x1: x, y1: 0, x2: x, y2: h, stroke: markerColor, strokeWidth: 1, strokeOpacity: 0.6 }), jsx(Rect, { x: x + 2, y: 2, width: marker.label ? marker.label.length * 6 + 4 : 20, height: 14, fill: markerColor, rx: 2 }), marker.label && (jsx(Text$2, { x: x + 4, y: 12, fill: "white", fontSize: 9, fontWeight: "bold", children: marker.label }))] }, index));
|
|
36101
35964
|
case 'dot':
|
|
36102
|
-
return (jsxs(G, { children: [jsx("circle", { cx: x, cy:
|
|
35965
|
+
return (jsxs(G, { children: [jsx("circle", { cx: x, cy: h / 2, r: 4, fill: markerColor, stroke: "white", strokeWidth: 1 }), marker.label && (jsx(Text$2, { x: x, y: h / 2 + 20, fill: markerColor, fontSize: 10, textAnchor: "middle", fontWeight: "bold", children: marker.label }))] }, index));
|
|
36103
35966
|
default:
|
|
36104
35967
|
return null;
|
|
36105
35968
|
}
|
|
36106
35969
|
}) }));
|
|
36107
|
-
}, [markers, actualWaveformWidth,
|
|
35970
|
+
}, [markers, actualWaveformWidth, h, theme.colors.warning]);
|
|
36108
35971
|
// RMS visualization component
|
|
36109
35972
|
const RMSBars = useMemo(() => {
|
|
36110
35973
|
if (!showRMS || !rmsData || rmsData.length === 0)
|
|
@@ -36112,11 +35975,11 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36112
35975
|
const processedRMS = rmsData.slice(0, normalizedPeaks.length);
|
|
36113
35976
|
return (jsx(G, { opacity: 0.5, children: processedRMS.map((rms, index) => {
|
|
36114
35977
|
const x = index * (barWidth + barGap);
|
|
36115
|
-
const rmsHeight = Math.max(minBarHeight, Math.abs(rms) *
|
|
36116
|
-
const y = (
|
|
35978
|
+
const rmsHeight = Math.max(minBarHeight, Math.abs(rms) * h * 0.4); // RMS bars are shorter
|
|
35979
|
+
const y = (h - rmsHeight) / 2;
|
|
36117
35980
|
return (jsx(Rect, { x: x, y: y, width: barWidth, height: rmsHeight, fill: theme.colors.gray[4], rx: variant === 'rounded' ? barWidth / 2 : 0 }, `rms-${index}`));
|
|
36118
35981
|
}) }));
|
|
36119
|
-
}, [showRMS, rmsData, normalizedPeaks, barWidth, barGap, minBarHeight,
|
|
35982
|
+
}, [showRMS, rmsData, normalizedPeaks, barWidth, barGap, minBarHeight, h, variant, theme.colors.gray]);
|
|
36120
35983
|
const renderWaveform = () => {
|
|
36121
35984
|
switch (variant) {
|
|
36122
35985
|
case 'line':
|
|
@@ -36153,17 +36016,17 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36153
36016
|
};
|
|
36154
36017
|
// Early return for empty state
|
|
36155
36018
|
if (normalizedPeaks.length === 0) {
|
|
36156
|
-
return (jsx(View, { style: [style, fullWidth ? { width: '100%' } : { width }, { height, justifyContent: 'center', alignItems: 'center' }], accessibilityRole: "image", accessibilityLabel: accessibilityLabel || 'Empty waveform', ...restProps, children: jsx(Svg, { ...svgProps, children: jsx(Rect, { x: 0, y:
|
|
36019
|
+
return (jsx(View, { style: [style, fullWidth ? { width: '100%' } : { width: w }, { height: h, justifyContent: 'center', alignItems: 'center' }], accessibilityRole: "image", accessibilityLabel: accessibilityLabel || 'Empty waveform', ...restProps, children: jsx(Svg, { ...svgProps, children: jsx(Rect, { x: 0, y: h / 2 - 1, width: fullWidth ? '100%' : w, height: 2, fill: waveformColor, opacity: 0.3 }) }) }));
|
|
36157
36020
|
}
|
|
36158
36021
|
if (loading) {
|
|
36159
|
-
return (jsx(WaveformSkeleton, {
|
|
36022
|
+
return (jsx(WaveformSkeleton, { w: w, h: h, fullWidth: fullWidth, barsCount: maxVisibleBars || 20 }));
|
|
36160
36023
|
}
|
|
36161
36024
|
if (error) {
|
|
36162
36025
|
return (jsx(View, { style: [
|
|
36163
36026
|
style,
|
|
36164
|
-
fullWidth ? { width: '100%' } : { width },
|
|
36027
|
+
fullWidth ? { width: '100%' } : { width: w },
|
|
36165
36028
|
{
|
|
36166
|
-
height,
|
|
36029
|
+
height: h,
|
|
36167
36030
|
justifyContent: 'center',
|
|
36168
36031
|
alignItems: 'center',
|
|
36169
36032
|
backgroundColor: theme.colors.error[1],
|
|
@@ -36173,7 +36036,7 @@ loading = false, error, loadingProgress, selection, onSelectionChange, zoomLevel
|
|
|
36173
36036
|
}
|
|
36174
36037
|
], accessibilityRole: "alert", accessibilityLabel: `Waveform error: ${error}`, ...restProps, children: jsx(Text$1, { style: { color: theme.colors.error[7], fontSize: 12, textAlign: 'center' }, children: error }) }));
|
|
36175
36038
|
}
|
|
36176
|
-
return (jsx(WrapperComponent, { ref: containerRef, style: [style, fullWidth ? { width: '100%' } : { width }], accessible: true, focusable: interactive, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), ...wrapperProps, ...restProps, children: jsxs(Svg, { ...svgProps, children: [SelectionOverlay, RMSBars, renderWaveform(), ProgressLine, TimeStamps, Markers] }) }));
|
|
36039
|
+
return (jsx(WrapperComponent, { ref: containerRef, style: [style, fullWidth ? { width: '100%' } : { width: w }], accessible: true, focusable: interactive, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), ...wrapperProps, ...restProps, children: jsxs(Svg, { ...svgProps, children: [SelectionOverlay, RMSBars, renderWaveform(), ProgressLine, TimeStamps, Markers] }) }));
|
|
36177
36040
|
});
|
|
36178
36041
|
Waveform.displayName = 'Waveform';
|
|
36179
36042
|
|
|
@@ -36195,7 +36058,7 @@ const AudioPlayer = forwardRef(({ source, peaks: providedPeaks, autoPlay = false
|
|
|
36195
36058
|
channel: 'mix',
|
|
36196
36059
|
}, showTime = true, timeFormat = 'mm:ss', showMetadata = false, metadata, showSpectrum = false, spectrumOptions, enableKeyboardShortcuts = true, enableGestures = true, onLoad, onPlaybackStateChange, onProgress, onEnd, onError, onBuffer,
|
|
36197
36060
|
// Waveform props
|
|
36198
|
-
|
|
36061
|
+
w = 300, h = 60, color = 'primary', interactive = true, onSeek, style, ...waveformProps }, ref) => {
|
|
36199
36062
|
const theme = useTheme();
|
|
36200
36063
|
const { playSound } = useSound();
|
|
36201
36064
|
// Refs
|
|
@@ -36542,7 +36405,7 @@ width = 300, height = 60, color = 'primary', interactive = true, onSeek, style,
|
|
|
36542
36405
|
alignSelf: 'flex-start',
|
|
36543
36406
|
}, children: jsx(Text$1, { style: { color: 'white', fontSize: DESIGN_TOKENS.typography.fontSize.sm }, children: "Retry" }) }))] }));
|
|
36544
36407
|
}
|
|
36545
|
-
return (jsxs(View, { style: [{ width: '100%' }, style], children: [controlsPosition === 'top' && renderMetadata(), controlsPosition === 'top' && renderControls(), controls.waveform && peaks.length > 0 && (jsx(View, { style: { marginVertical: DESIGN_TOKENS.spacing.sm }, children: jsx(Waveform, { peaks: peaks,
|
|
36408
|
+
return (jsxs(View, { style: [{ width: '100%' }, style], children: [controlsPosition === 'top' && renderMetadata(), controlsPosition === 'top' && renderControls(), controls.waveform && peaks.length > 0 && (jsx(View, { style: { marginVertical: DESIGN_TOKENS.spacing.sm }, children: jsx(Waveform, { peaks: peaks, w: w, h: h, color: color, progress: progress, interactive: interactive, onSeek: handleWaveformSeek, showProgressLine: true, progressLineStyle: {
|
|
36546
36409
|
color: theme.colors.primary[5],
|
|
36547
36410
|
width: 2,
|
|
36548
36411
|
opacity: 0.8,
|
|
@@ -37271,14 +37134,14 @@ const IMAGE_SIZES = {
|
|
|
37271
37134
|
'2xl': 80,
|
|
37272
37135
|
'3xl': 96,
|
|
37273
37136
|
};
|
|
37274
|
-
function Image({ src, source, alt, accessibilityLabel, resizeMode = 'cover', size,
|
|
37137
|
+
function Image({ src, source, alt, accessibilityLabel, resizeMode = 'cover', size, w, h, aspectRatio, borderWidth, borderColor, rounded, circle, fallback, loading, onLoad, onError, onLoadStart, onLoadEnd, containerStyle, imageStyle, testID, style, ...rest }) {
|
|
37275
37138
|
const theme = useTheme();
|
|
37276
37139
|
const [loadError, setLoadError] = useState(false);
|
|
37277
37140
|
const [isLoading, setIsLoading] = useState(true);
|
|
37278
37141
|
const { spacingProps } = extractSpacingProps(rest);
|
|
37279
37142
|
// Determine dimensions
|
|
37280
|
-
let finalWidth =
|
|
37281
|
-
let finalHeight =
|
|
37143
|
+
let finalWidth = w;
|
|
37144
|
+
let finalHeight = h;
|
|
37282
37145
|
if (size && typeof size === 'string' && IMAGE_SIZES[size]) {
|
|
37283
37146
|
finalWidth = finalWidth || IMAGE_SIZES[size];
|
|
37284
37147
|
finalHeight = finalHeight || IMAGE_SIZES[size];
|
|
@@ -37303,7 +37166,7 @@ function Image({ src, source, alt, accessibilityLabel, resizeMode = 'cover', siz
|
|
|
37303
37166
|
const spacingStyles = getSpacingStyles(spacingProps);
|
|
37304
37167
|
const containerStyles = {
|
|
37305
37168
|
...spacingStyles,
|
|
37306
|
-
...containerStyle,
|
|
37169
|
+
...StyleSheet.flatten(containerStyle),
|
|
37307
37170
|
};
|
|
37308
37171
|
const imageStyles = {
|
|
37309
37172
|
width: finalWidth,
|
|
@@ -37312,7 +37175,7 @@ function Image({ src, source, alt, accessibilityLabel, resizeMode = 'cover', siz
|
|
|
37312
37175
|
borderWidth,
|
|
37313
37176
|
borderColor: borderColor || theme.colors.gray[3],
|
|
37314
37177
|
borderRadius,
|
|
37315
|
-
...imageStyle,
|
|
37178
|
+
...StyleSheet.flatten(imageStyle),
|
|
37316
37179
|
};
|
|
37317
37180
|
if (finalWidth !== undefined) {
|
|
37318
37181
|
containerStyles.width = finalWidth;
|
|
@@ -39086,7 +38949,7 @@ function QRCode(props) {
|
|
|
39086
38949
|
});
|
|
39087
38950
|
}
|
|
39088
38951
|
}, [copy, copyValue, toast, otherProps.copyToastMessage, otherProps.copyToastTitle]);
|
|
39089
|
-
const content = (jsxs(View, { style: { borderRadius: 8, overflow: 'hidden' }, children: [jsx(QRCodeSVG, { value: value, size: size,
|
|
38952
|
+
const content = (jsxs(View, { style: { borderRadius: 8, overflow: 'hidden' }, children: [jsx(QRCodeSVG, { value: value, size: size, maxW: '100%', backgroundColor: backgroundColor, color: resolvedColor, errorCorrectionLevel: errorCorrectionLevel, quietZone: quietZone, logo: logo, style: style, testID: testID, accessibilityLabel: accessibilityLabel, onError: onError, ...spacingProps, ...layoutProps, ...rest }), otherProps.showCopyButton && (jsx(CopyButton, { value: copyValue, iconOnly: true, size: "sm", style: { position: 'absolute', top: 8, right: 8 }, onCopy: () => { } }))] }));
|
|
39090
38953
|
if (shouldCopyOnPress) {
|
|
39091
38954
|
return (jsx(Pressable, { onPress: handleCopy, accessibilityLabel: accessibilityLabel || 'QR code', children: content }));
|
|
39092
38955
|
}
|
|
@@ -39736,111 +39599,6 @@ const styles$2 = StyleSheet.create({
|
|
|
39736
39599
|
},
|
|
39737
39600
|
});
|
|
39738
39601
|
|
|
39739
|
-
// Optional imports for web compatibility
|
|
39740
|
-
const LottieReact = Platform.OS === 'web'
|
|
39741
|
-
? resolveOptionalModule('lottie-react', {
|
|
39742
|
-
accessor: mod => { var _a; return (_a = mod.default) !== null && _a !== void 0 ? _a : mod; },
|
|
39743
|
-
})
|
|
39744
|
-
: null;
|
|
39745
|
-
const DotLottieReact = Platform.OS === 'web'
|
|
39746
|
-
? resolveOptionalModule('@lottiefiles/dotlottie-react', {
|
|
39747
|
-
accessor: mod => mod.DotLottieReact,
|
|
39748
|
-
})
|
|
39749
|
-
: null;
|
|
39750
|
-
let cachedNativeStatus = null;
|
|
39751
|
-
let nativeLottieComponent;
|
|
39752
|
-
let nativeModuleLoadWarningLogged = false;
|
|
39753
|
-
let nativeModuleConfigWarningLogged = false;
|
|
39754
|
-
const loadNativeLottieComponent = () => {
|
|
39755
|
-
if (nativeLottieComponent !== undefined) {
|
|
39756
|
-
return nativeLottieComponent;
|
|
39757
|
-
}
|
|
39758
|
-
const module = resolveOptionalModule('lottie-react-native', {
|
|
39759
|
-
accessor: mod => { var _a; return (_a = mod === null || mod === void 0 ? void 0 : mod.default) !== null && _a !== void 0 ? _a : mod; },
|
|
39760
|
-
});
|
|
39761
|
-
if (!module && !nativeModuleLoadWarningLogged && __DEV__) {
|
|
39762
|
-
console.warn('[Lottie] Failed to load lottie-react-native module. Rendering fallback instead.');
|
|
39763
|
-
nativeModuleLoadWarningLogged = true;
|
|
39764
|
-
}
|
|
39765
|
-
nativeLottieComponent = module !== null && module !== void 0 ? module : null;
|
|
39766
|
-
return nativeLottieComponent;
|
|
39767
|
-
};
|
|
39768
|
-
const getNativeLottieStatus = () => {
|
|
39769
|
-
var _a, _b, _c;
|
|
39770
|
-
if (cachedNativeStatus) {
|
|
39771
|
-
return cachedNativeStatus;
|
|
39772
|
-
}
|
|
39773
|
-
if (Platform.OS === 'web') {
|
|
39774
|
-
cachedNativeStatus = { component: null, available: false };
|
|
39775
|
-
return cachedNativeStatus;
|
|
39776
|
-
}
|
|
39777
|
-
const component = loadNativeLottieComponent();
|
|
39778
|
-
if (!component) {
|
|
39779
|
-
cachedNativeStatus = { component: null, available: false };
|
|
39780
|
-
return cachedNativeStatus;
|
|
39781
|
-
}
|
|
39782
|
-
let viewManagerAvailable = false;
|
|
39783
|
-
try {
|
|
39784
|
-
const viewManager = (_c = (_b = (_a = UIManager === null || UIManager === void 0 ? void 0 : UIManager.getViewManagerConfig) === null || _a === void 0 ? void 0 : _a.call(UIManager, 'LottieAnimationView')) !== null && _b !== void 0 ? _b : UIManager === null || UIManager === void 0 ? void 0 : UIManager.LottieAnimationView) !== null && _c !== void 0 ? _c : NativeModules === null || NativeModules === void 0 ? void 0 : NativeModules.LottieAnimationView;
|
|
39785
|
-
viewManagerAvailable = !!viewManager;
|
|
39786
|
-
}
|
|
39787
|
-
catch (error) {
|
|
39788
|
-
viewManagerAvailable = false;
|
|
39789
|
-
}
|
|
39790
|
-
if (!viewManagerAvailable && !nativeModuleConfigWarningLogged && __DEV__) {
|
|
39791
|
-
console.warn('[Lottie] Native LottieAnimationView is unavailable. Run `npx expo install lottie-react-native` and rebuild to enable animations.');
|
|
39792
|
-
nativeModuleConfigWarningLogged = true;
|
|
39793
|
-
}
|
|
39794
|
-
cachedNativeStatus = {
|
|
39795
|
-
component,
|
|
39796
|
-
available: viewManagerAvailable,
|
|
39797
|
-
};
|
|
39798
|
-
return cachedNativeStatus;
|
|
39799
|
-
};
|
|
39800
|
-
/**
|
|
39801
|
-
* Lottie component with safe fallback when native module not present or on unsupported platforms.
|
|
39802
|
-
*/
|
|
39803
|
-
const Lottie = forwardRef(function LottieCmp(props, ref) {
|
|
39804
|
-
const { source, autoPlay = true, loop = true, progress, speed = 1, style, testID, paused, resizeMode = 'contain', onAnimationFinish } = props;
|
|
39805
|
-
const internalRef = useRef(null);
|
|
39806
|
-
const nativeStatus = getNativeLottieStatus();
|
|
39807
|
-
const NativeLottieView = nativeStatus.component;
|
|
39808
|
-
useImperativeHandle(ref, () => ({
|
|
39809
|
-
play: (...args) => { var _a, _b; return (_b = (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.play) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
|
|
39810
|
-
pause: () => { var _a, _b; return (_b = (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.pause) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
39811
|
-
reset: () => { var _a, _b; return (_b = (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
39812
|
-
setProgress: (p) => { var _a, _b; return (_b = (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.setProgress) === null || _b === void 0 ? void 0 : _b.call(_a, p); },
|
|
39813
|
-
}), []);
|
|
39814
|
-
useEffect(() => {
|
|
39815
|
-
var _a;
|
|
39816
|
-
if (progress != null && ((_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.setProgress)) {
|
|
39817
|
-
internalRef.current.setProgress(progress);
|
|
39818
|
-
}
|
|
39819
|
-
}, [progress]);
|
|
39820
|
-
// Web implementation
|
|
39821
|
-
if (Platform.OS === 'web') {
|
|
39822
|
-
// Check if source is a string (URL) and ends with .lottie
|
|
39823
|
-
const isLottieFile = typeof source === 'string' && source.endsWith('.lottie');
|
|
39824
|
-
if (isLottieFile && DotLottieReact) {
|
|
39825
|
-
// Use DotLottieReact for .lottie files
|
|
39826
|
-
return (jsx(DotLottieReact, { src: source, autoplay: autoPlay, loop: loop, speed: speed, style: style, "data-testid": testID }));
|
|
39827
|
-
}
|
|
39828
|
-
else if (LottieReact) {
|
|
39829
|
-
// Use lottie-react for standard Lottie JSON
|
|
39830
|
-
return (jsx(LottieReact, { animationData: source, autoplay: autoPlay, loop: loop, style: style, "data-testid": testID }));
|
|
39831
|
-
}
|
|
39832
|
-
else {
|
|
39833
|
-
return jsx(Text, { children: "Lottie not available on web" });
|
|
39834
|
-
}
|
|
39835
|
-
}
|
|
39836
|
-
// Native implementation using lottie-react-native
|
|
39837
|
-
if (!nativeStatus.available || !NativeLottieView) {
|
|
39838
|
-
return (jsx(View, { style: [{ justifyContent: 'center', alignItems: 'center' }, style], testID: testID, children: jsx(Text, { style: { textAlign: 'center', opacity: 0.7 }, children: "Lottie animations require the native `lottie-react-native` module. Install it and rebuild the app, or view this example on the web." }) }));
|
|
39839
|
-
}
|
|
39840
|
-
return (jsx(NativeLottieView, { ref: internalRef, source: source, autoPlay: autoPlay, loop: loop, speed: speed, progress: progress, style: style, testID: testID, resizeMode: resizeMode, onAnimationFinish: onAnimationFinish, ...(paused != null ? { paused } : {}) }));
|
|
39841
|
-
});
|
|
39842
|
-
Lottie.displayName = 'Lottie';
|
|
39843
|
-
|
|
39844
39602
|
const PLAYBACK_RATES = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
|
39845
39603
|
function formatTime(seconds) {
|
|
39846
39604
|
const hours = Math.floor(seconds / 3600);
|
|
@@ -40788,7 +40546,7 @@ const DEFAULT_CONTROLS = {
|
|
|
40788
40546
|
autoHide: true,
|
|
40789
40547
|
autoHideTimeout: 3000,
|
|
40790
40548
|
};
|
|
40791
|
-
const Video = forwardRef(({ source,
|
|
40549
|
+
const Video = forwardRef(({ source, w, h, aspectRatio = 16 / 9, poster, autoPlay = false, loop = false, muted = false, volume = 1, playbackRate = 1, quality = 'auto', controls = true, timeline = [], youtubeOptions, onPlay, onPause, onSeek, onTimeUpdate, onDurationChange, onVolumeChange, onPlaybackRateChange, onQualityChange, onFullscreenChange, onError, onLoad, onLoadStart, onBuffer, onTimelineEvent, style, videoStyle, controlsStyle, accessibilityLabel, testID, ...rest }, ref) => {
|
|
40792
40550
|
const theme = useTheme();
|
|
40793
40551
|
const { spacingProps } = extractSpacingProps(rest);
|
|
40794
40552
|
// Internal state
|
|
@@ -41038,24 +40796,24 @@ const Video = forwardRef(({ source, width, height, aspectRatio = 16 / 9, poster,
|
|
|
41038
40796
|
// overflow: 'hidden',
|
|
41039
40797
|
// position: 'relative',
|
|
41040
40798
|
};
|
|
41041
|
-
if (
|
|
41042
|
-
baseStyle.width =
|
|
41043
|
-
baseStyle.height =
|
|
40799
|
+
if (w && h) {
|
|
40800
|
+
baseStyle.width = w;
|
|
40801
|
+
baseStyle.height = h;
|
|
41044
40802
|
}
|
|
41045
|
-
else if (
|
|
41046
|
-
baseStyle.width =
|
|
41047
|
-
baseStyle.height = typeof
|
|
40803
|
+
else if (w) {
|
|
40804
|
+
baseStyle.width = w;
|
|
40805
|
+
baseStyle.height = typeof w === 'number' ? w / aspectRatio : '100%';
|
|
41048
40806
|
}
|
|
41049
|
-
else if (
|
|
41050
|
-
baseStyle.height =
|
|
41051
|
-
baseStyle.width = typeof
|
|
40807
|
+
else if (h) {
|
|
40808
|
+
baseStyle.height = h;
|
|
40809
|
+
baseStyle.width = typeof h === 'number' ? h * aspectRatio : '100%';
|
|
41052
40810
|
}
|
|
41053
40811
|
else {
|
|
41054
40812
|
baseStyle.width = '100%';
|
|
41055
40813
|
baseStyle.aspectRatio = aspectRatio;
|
|
41056
40814
|
}
|
|
41057
40815
|
return baseStyle;
|
|
41058
|
-
}, [theme.colors.surface,
|
|
40816
|
+
}, [theme.colors.surface, w, h, aspectRatio]);
|
|
41059
40817
|
// Handle touch events for control visibility
|
|
41060
40818
|
const handleContainerPress = useCallback(() => {
|
|
41061
40819
|
if (controlsConfig && controlsConfig.autoHide) {
|
|
@@ -41159,5 +40917,5 @@ function withPressAnimation(Component, animationProps) {
|
|
|
41159
40917
|
*/
|
|
41160
40918
|
const AnimatedPressable = PressAnimation;
|
|
41161
40919
|
|
|
41162
|
-
export { AccessibilityProvider, Accordion, AmazonAppstoreBadge, AmazonAppstoreButton, AmazonMusicListenBadge, AmazonPrimeVideoBadge, AmazonStoreBadge, AnimatedPressable, AppLayoutProvider, AppLayoutRenderer, AppShell, AppShellAside, AppShellBottomNav, AppShellFooter, AppShellHeader, AppShellMain, AppShellNavbar, AppShellSection, AppStoreBadge, AppStoreButton, AppStoreDownloadBadge, AppleAppStoreButton, AppleMusicListenBadge, ApplePodcastsListenBadge, AutoComplete, Avatar, AvatarGroup, Badge, Block, Blockquote, Bold, BottomAppBar, BrandButton, BrandIcon, Breadcrumbs, Button, COMPONENT_SIZES$1 as COMPONENT_SIZES, COMPONENT_SIZE_ORDER, Calendar, Card, Carousel, Checkbox, Chip, ChromeWebStoreBadge, Cite, Code, CodeBlock, Collapse, ColorPicker, ColorSwatch, Column, ComponentWithDisclaimer, ContextMenu, CopyButton, DARK_THEME, DEFAULT_BREAKPOINTS, DEFAULT_COMPONENT_SIZE, DEFAULT_SOUND_IDS, DEFAULT_THEME, DataTable, DatePicker, DatePickerInput, Day, Dialog, DialogProvider, DialogRenderer, DirectionProvider, Disclaimer, DiscordJoinBadge, Divider, EmojiPicker, Emphasis, FDroidButton, FileInput, Flex, FloatingActions, Form, GalaxyStoreDownloadBadge, Gallery, Gauge, GitHubViewBadge, GooglePlayButton, GooglePlayDownloadBadge, Grid, GridItem, H1, H2, H3, H4, H5, H6, HapticsProvider, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Highlight, HuaweiAppGalleryBadge, I18nProvider, Icon, IconButton, Image, Indicator, Input, Italic, Kbd, KeyCap, KeyboardAwareLayout, KeyboardManagerProvider, Knob, Link, ListGroup, ListGroupBody, ListGroupDivider, ListGroupItem, Loader, LoadingOverlay,
|
|
40920
|
+
export { AccessibilityProvider, Accordion, AmazonAppstoreBadge, AmazonAppstoreButton, AmazonMusicListenBadge, AmazonPrimeVideoBadge, AmazonStoreBadge, AnimatedPressable, AppLayoutProvider, AppLayoutRenderer, AppShell, AppShellAside, AppShellBottomNav, AppShellFooter, AppShellHeader, AppShellMain, AppShellNavbar, AppShellSection, AppStoreBadge, AppStoreButton, AppStoreDownloadBadge, AppleAppStoreButton, AppleMusicListenBadge, ApplePodcastsListenBadge, AutoComplete, Avatar, AvatarGroup, Badge, Block, Blockquote, Bold, BottomAppBar, BrandButton, BrandIcon, Breadcrumbs, Button, COMPONENT_SIZES$1 as COMPONENT_SIZES, COMPONENT_SIZE_ORDER, Calendar, Card, Carousel, Checkbox, Chip, ChromeWebStoreBadge, Cite, Code, CodeBlock, Collapse, ColorPicker, ColorSwatch, Column, ComponentWithDisclaimer, ContextMenu, CopyButton, DARK_THEME, DEFAULT_BREAKPOINTS, DEFAULT_COMPONENT_SIZE, DEFAULT_SOUND_IDS, DEFAULT_THEME, DataTable, DatePicker, DatePickerInput, Day, Dialog, DialogProvider, DialogRenderer, DirectionProvider, Disclaimer, DiscordJoinBadge, Divider, EmojiPicker, Emphasis, FDroidButton, FileInput, Flex, FloatingActions, Form, GalaxyStoreDownloadBadge, Gallery, Gauge, GitHubViewBadge, GooglePlayButton, GooglePlayDownloadBadge, Grid, GridItem, H1, H2, H3, H4, H5, H6, HapticsProvider, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Highlight, HuaweiAppGalleryBadge, I18nProvider, Icon, IconButton, Image, Indicator, Input, Italic, Kbd, KeyCap, KeyboardAwareLayout, KeyboardManagerProvider, Knob, Link, ListGroup, ListGroupBody, ListGroupDivider, ListGroupItem, Loader, LoadingOverlay, MacAppStoreButton, Mark, Markdown, Masonry, Menu, MenuDivider, MenuDropdown, MenuItem, MenuItemButton, MenuLabel, MicrosoftStoreButton, MicrosoftStoreDownloadBadge, MiniCalendar, Month, MonthPicker, MonthPickerInput, Notice, NumberInput, Overlay, OverlayProvider, P, Pagination, PasswordInput, PhoneInput, PinInput, PlatformBlocksProvider, Popover, PressAnimation, Progress, QRCode, Radio, RadioGroup, RangeSlider, Rating, RedditJoinBadge, Ring, Row, SIZE_SCALES, Search, SegmentedControl, Select, ShimmerText, Skeleton, Slider, Small, SoundCloudListenBadge, SoundProvider, Space, Spoiler, SpotifyListenBadge, Spotlight, SpotlightProvider, StatusBarManager, StepperWithSubComponents as Stepper, Strong, Sub, Sup, Switch, Table, TableOfContents, Tabs, Text, TextArea, TextInputBase, ThemeModeProvider, TikTokWatchBadge, TimePickerInput as TimePicker, TimePickerInput, TimelineWithItems as Timeline, Title, TitleRegistryProvider, Toast, ToastProvider, ToggleBar, ToggleButton, ToggleGroup, Tooltip, Tree, TwitchWatchBadge, Underline, Video, Waveform, YearPicker, YearPickerInput, YouTubeMusicListenBadge, YouTubeWatchBadge, calculateOverlayPositionEnhanced, clampComponentSize, clearOverlayPositionCache, createSound, createSpotlightStore, createTheme, debounce$1 as debounce, defineAppLayout, directSpotlight, extractDisclaimerProps, factory, getAllSounds, getColor, getFontSize, getHeight, getIconSize$1 as getIconSize, getLineHeight, getRadius$1 as getRadius, getScrollPosition, getShadow$1 as getShadow, getSize, getSoundsByCategory, getSpacing, getViewport, globalHotkeys, measureAsyncPerformance, measureElement, measurePerformance, onDialogsRequested, onSpotlightRequested, onToastsRequested, pointInRect, polymorphicFactory, px, rem, resolveComponentSize, resolveResponsiveProp, resolveResponsiveValue, resolveSize, spotlight, throttle, useAccessibility, useAppLayoutContext, useAppShell, useAppShellApi, useAppShellLayout, useBreakpoint, useColorScheme, useDialog, useDialogApi, useDialogs, useDirectSpotlightState, useDirection, useDirectionSafe, useDisclaimer, useDropdownPositioning, useEscapeKey, useFormContext, useGlobalHotkeys, useHaptics, useHapticsSettings, useHotkeys, useI18n, useKeyboardManager, useKeyboardManagerOptional, useNavbarHover, useOptionalFormContext, useOverlay, useOverlayApi, useOverlays, usePopoverPositioning, useSimpleDialog, useSound, useSpotlightStore, useSpotlightStoreInstance, useSpotlightToggle, useTheme, useThemeMode, useTitleRegistry, useTitleRegistryOptional, useToast, useToastApi, useToggleColorScheme, useTooltipPositioning, withDisclaimer, withPressAnimation };
|
|
41163
40921
|
//# sourceMappingURL=index.js.map
|