@platform-blocks/ui 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +37 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +37 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -3507,6 +3507,35 @@ const containsPlatformText = (node) => {
|
|
|
3507
3507
|
return false;
|
|
3508
3508
|
});
|
|
3509
3509
|
};
|
|
3510
|
+
/**
|
|
3511
|
+
* Check if children contain block-level elements (View, Pressable, etc.)
|
|
3512
|
+
* that would render as <div> on web, causing invalid nesting inside <p>.
|
|
3513
|
+
*/
|
|
3514
|
+
const containsBlockElement = (node) => {
|
|
3515
|
+
return React__default.Children.toArray(node).some(child => {
|
|
3516
|
+
if (React__default.isValidElement(child)) {
|
|
3517
|
+
const childType = child.type;
|
|
3518
|
+
// Check for native RN components that render as div on web
|
|
3519
|
+
const displayName = (childType === null || childType === void 0 ? void 0 : childType.displayName) || (childType === null || childType === void 0 ? void 0 : childType.name) || '';
|
|
3520
|
+
const blockNames = new Set([
|
|
3521
|
+
'View', 'Pressable', 'TouchableOpacity', 'TouchableHighlight',
|
|
3522
|
+
'TouchableWithoutFeedback', 'ScrollView', 'FlatList', 'SectionList',
|
|
3523
|
+
'SafeAreaView', 'KeyboardAvoidingView', 'Modal',
|
|
3524
|
+
]);
|
|
3525
|
+
if (blockNames.has(displayName))
|
|
3526
|
+
return true;
|
|
3527
|
+
// Also check if it's a native 'div' element
|
|
3528
|
+
if (childType === 'div')
|
|
3529
|
+
return true;
|
|
3530
|
+
// Recurse into children
|
|
3531
|
+
const childProps = child.props;
|
|
3532
|
+
if (childProps === null || childProps === void 0 ? void 0 : childProps.children) {
|
|
3533
|
+
return containsBlockElement(childProps.children);
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
return false;
|
|
3537
|
+
});
|
|
3538
|
+
};
|
|
3510
3539
|
const Text = (allProps) => {
|
|
3511
3540
|
const { spacingProps, otherProps } = extractSpacingProps(allProps);
|
|
3512
3541
|
const { children, tx, txParams, variant = 'p', size, weight, align = 'left', color, colorVariant, lineHeight, tracking, uppercase, style, fontFamily, as, selectable = true, onPress, onLayout, value, numberOfLines, ellipsizeMode } = otherProps;
|
|
@@ -3551,6 +3580,10 @@ const Text = (allProps) => {
|
|
|
3551
3580
|
// Avoid nested paragraphs when Text components are nested
|
|
3552
3581
|
htmlTag = 'div';
|
|
3553
3582
|
}
|
|
3583
|
+
if (htmlTag === 'p' && containsBlockElement(children)) {
|
|
3584
|
+
// Avoid <div> inside <p> when children contain View, Pressable, etc.
|
|
3585
|
+
htmlTag = 'div';
|
|
3586
|
+
}
|
|
3554
3587
|
}
|
|
3555
3588
|
// Platform-specific rendering
|
|
3556
3589
|
if (Platform.OS === 'web' && isHTMLVariant(htmlTag)) {
|
|
@@ -16096,12 +16129,12 @@ const BrandButton = (props) => {
|
|
|
16096
16129
|
return { backgroundColor: 'transparent', borderColor: 'transparent' };
|
|
16097
16130
|
case 'plain':
|
|
16098
16131
|
return {
|
|
16099
|
-
backgroundColor: 'white',
|
|
16132
|
+
backgroundColor: theme.colorScheme === 'dark' ? theme.backgrounds.elevated : 'white',
|
|
16100
16133
|
borderColor: 'transparent',
|
|
16101
16134
|
paddingHorizontal: 16,
|
|
16102
16135
|
minWidth: 0,
|
|
16103
16136
|
height: 'auto',
|
|
16104
|
-
color: 'black'
|
|
16137
|
+
color: theme.colorScheme === 'dark' ? theme.text.primary : 'black'
|
|
16105
16138
|
};
|
|
16106
16139
|
default: // primary/filled/secondary/gradient etc treat as filled brand color
|
|
16107
16140
|
return {
|
|
@@ -16112,7 +16145,7 @@ const BrandButton = (props) => {
|
|
|
16112
16145
|
}
|
|
16113
16146
|
})();
|
|
16114
16147
|
// Compute textColor override: outline/link use brand color, ghost uses default text color, filled-like use contrasting light text
|
|
16115
|
-
const textColor = effectiveVariant === 'plain' ? 'black' :
|
|
16148
|
+
const textColor = effectiveVariant === 'plain' ? (theme.colorScheme === 'dark' ? theme.text.primary : 'black') :
|
|
16116
16149
|
effectiveVariant === 'ghost'
|
|
16117
16150
|
? theme.text.primary
|
|
16118
16151
|
: (effectiveVariant === 'outline' || effectiveVariant === 'link')
|
|
@@ -40917,5 +40950,5 @@ function withPressAnimation(Component, animationProps) {
|
|
|
40917
40950
|
*/
|
|
40918
40951
|
const AnimatedPressable = PressAnimation;
|
|
40919
40952
|
|
|
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 };
|
|
40953
|
+
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, useDeviceInfo, 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 };
|
|
40921
40954
|
//# sourceMappingURL=index.js.map
|