@toss/tds-react-native 1.3.8 → 2.0.0-next.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/CHANGELOG.md +6 -0
- package/dist/cjs/components/agreement/Collapsible/AgreementCollapsibleTrigger.d.ts +10 -3
- package/dist/cjs/components/agreement/Collapsible/CollapsibleTrigger.d.ts +9 -3
- package/dist/cjs/components/dropdown/components/FixedFloatingDropdown.js +1 -1
- package/dist/cjs/components/dropdown/components/Trigger.js +1 -1
- package/dist/cjs/components/dropdown/contexts/DropdownContext.d.ts +2 -2
- package/dist/cjs/components/dropdown/types.d.ts +1 -1
- package/dist/cjs/components/highlight/hooks/useTimestampRef.d.ts +1 -1
- package/dist/cjs/components/icon-button/IconButton.d.ts +1 -1
- package/dist/cjs/components/keypad/FullSecureKeypad/SecureKeyButton.js +1 -1
- package/dist/cjs/components/keypad/FullSecureKeypad/index.d.ts +1 -1
- package/dist/cjs/components/navbar/ReactNavigationHelper/HeaderLeft.d.ts +1 -1
- package/dist/cjs/components/navbar/ReactNavigationHelper/HeaderRight.d.ts +1 -1
- package/dist/cjs/components/navbar/ReactNavigationHelper/HeaderTitle.d.ts +1 -1
- package/dist/cjs/components/navbar/ReactNavigationHelper/Right.d.ts +5 -2
- package/dist/cjs/components/navbar/ReactNavigationHelper/Right.js +1 -1
- package/dist/cjs/components/navbar/ReactNavigationHelper/index.d.ts +2 -2
- package/dist/cjs/components/numeric-spinner/useAccelerateInterval.js +1 -1
- package/dist/cjs/components/post/Header.d.ts +4 -4
- package/dist/cjs/components/post/List/PostList.js +1 -1
- package/dist/cjs/components/post/Post.d.ts +4 -4
- package/dist/cjs/components/radio/Radio.d.ts +0 -31
- package/dist/cjs/components/radio/Radio.js +1 -1
- package/dist/cjs/components/radio/index.d.ts +1 -1
- package/dist/cjs/components/radio/index.js +1 -1
- package/dist/cjs/components/search-field/SearchField.d.ts +1 -1
- package/dist/cjs/components/segmented-control/components/Item/Item.js +1 -1
- package/dist/cjs/components/segmented-control/contexts/ScrollContext.d.ts +1 -1
- package/dist/cjs/components/slider/Slider.js +1 -1
- package/dist/cjs/components/text-field/OldTextField/TDSTextField.d.ts +1 -1
- package/dist/cjs/components/text-field/OldTextField/hooks.d.ts +5 -5
- package/dist/cjs/components/text-field/OldTextField/index.d.ts +1 -1
- package/dist/cjs/components/text-field/OldTextField/styles.d.ts +3 -3
- package/dist/cjs/components/text-field/TextField/hooks/useTextFieldClearButtonControls.js +1 -1
- package/dist/cjs/components/text-field/TextField/variants/TextFieldBig/TextFieldBig.Button.js +1 -1
- package/dist/cjs/components/text-field/TextField/variants/TextFieldBig/TextFieldBig.js +1 -1
- package/dist/cjs/components/text-field/TextField/variants/TextFieldHero/TextFieldHero.Button.js +1 -1
- package/dist/cjs/components/text-field/TextField/variants/TextFieldHero/TextFieldHero.js +1 -1
- package/dist/cjs/components/text-field/TextField/variants/TextFieldLine/TextFieldLine.Button.js +1 -1
- package/dist/cjs/components/text-field/TextField/variants/TextFieldLine/TextFieldLine.js +1 -1
- package/dist/cjs/components/toast/hooks/useTextLine.d.ts +1 -1
- package/dist/cjs/components/tooltip/components/Tooltip/FloatingTooltip.js +1 -1
- package/dist/cjs/components/tooltip/contexts/TooltipContext.d.ts +2 -2
- package/dist/cjs/components/tooltip/hooks/useCloseTooltip.js +1 -1
- package/dist/cjs/components/tooltip/hooks/useOnPressOutside.d.ts +1 -1
- package/dist/cjs/components/tooltip/hooks/useOnPressOutside.js +1 -1
- package/dist/cjs/components/txt/Txt.js +2 -1
- package/dist/cjs/core/color/Color.js +1 -1
- package/dist/cjs/core/color/ColorPreference.js +1 -1
- package/dist/cjs/core/contexts/AdaptiveColorProvider.js +1 -1
- package/dist/cjs/core/contexts/ColorPreferenceProvider.js +1 -1
- package/dist/cjs/core/contexts/GlobalEventProvider.js +1 -15
- package/dist/cjs/core/contexts/HideAccessibility.js +1 -1
- package/dist/cjs/core/contexts/SafeAreaProvider.js +1 -1
- package/dist/cjs/core/contexts/TDSProvider.js +1 -1
- package/dist/cjs/core/contexts/TypographyProvider.js +2 -2
- package/dist/cjs/core/contexts/index.js +1 -1
- package/dist/cjs/core/hooks/index.js +1 -1
- package/dist/cjs/core/hooks/useA11yCondition.js +1 -1
- package/dist/cjs/core/hooks/useTypographyLevel.js +1 -1
- package/dist/cjs/core/index.js +1 -1
- package/dist/cjs/core/overlay/OverlayController.js +1 -1
- package/dist/cjs/core/overlay/OverlayProvider.js +1 -1
- package/dist/cjs/core/overlay/_OverlayProvider.js +1 -1
- package/dist/cjs/core/overlay/index.js +1 -1
- package/dist/cjs/core/overlay/types.d.ts +1 -0
- package/dist/cjs/core/overlay/types.js +1 -1
- package/dist/cjs/core/overlay/useOverlay.js +1 -1
- package/dist/cjs/core/overlay/useOverlayBase.js +4 -1
- package/dist/cjs/core/overlay/useOverlayCache.js +1 -1
- package/dist/cjs/core/theme/ThemeProvider.js +1 -1
- package/dist/cjs/core/theme/deriveToken/BaseDerivedTokenGenerator.js +1 -1
- package/dist/cjs/core/theme/deriveToken/batchDerivedTokenGenerators.js +1 -1
- package/dist/cjs/core/theme/deriveToken/deriveToken.js +1 -1
- package/dist/cjs/core/theme/deriveToken/index.js +1 -1
- package/dist/cjs/core/theme/index.js +1 -1
- package/dist/cjs/core/theme/seedToken/index.js +1 -1
- package/dist/cjs/core/theme/seedToken/seedToken.js +1 -1
- package/dist/cjs/extensions/bridge/components/Icon.d.ts +2 -2
- package/dist/cjs/extensions/bridge/useBridge.js +1 -1
- package/dist/cjs/extensions/navigation/Navigation.d.ts +5 -4
- package/dist/cjs/extensions/navigation/Navigation.js +1 -1
- package/dist/cjs/extensions/overlay-extension/components/CapturePress.d.ts +1 -1
- package/dist/cjs/extensions/overlay-extension/components/CapturePress.js +1 -1
- package/dist/cjs/extensions/page-navbar/PageNavbar.d.ts +1 -1
- package/dist/cjs/extensions/tab-view/TabsContext.d.ts +1 -1
- package/dist/cjs/extensions/tab-view/TabsList.js +1 -1
- package/dist/cjs/extensions/tab-view/TabsViews.d.ts +1 -1
- package/dist/cjs/extensions/tab-view/TabsViews.js +1 -1
- package/dist/cjs/extensions/tab-view/hooks/useScrollStateChangedHandler.d.ts +1 -1
- package/dist/cjs/extensions/tab-view/utils/getTabData.js +1 -1
- package/dist/cjs/extensions/top-navigation/TopNavigation.d.ts +4 -16
- package/dist/cjs/extensions/top-navigation/TopNavigation.js +1 -1
- package/dist/cjs/extensions/top-navigation/constants.d.ts +15 -0
- package/dist/cjs/extensions/top-navigation/constants.js +1 -0
- package/dist/cjs/extensions/top-navigation/index.d.ts +1 -0
- package/dist/cjs/extensions/top-navigation/index.js +1 -1
- package/dist/cjs/interactions/pressable-effect/PressableEffect.d.ts +3 -1
- package/dist/cjs/utils/compat.d.ts +17 -0
- package/dist/cjs/utils/compat.js +1 -0
- package/dist/cjs/utils/isReactText.d.ts +2 -2
- package/dist/cjs/utils/mergeRefs.d.ts +2 -1
- package/dist/cjs/utils/testing/index.d.ts +1 -0
- package/dist/cjs/utils/testing/index.js +1 -1
- package/dist/cjs/utils/testing/mockAccessibilityInfo.d.ts +5 -2
- package/dist/cjs/utils/testing/mockAccessibilityInfo.js +1 -1
- package/dist/cjs/utils/testing/mockViewLayout.d.ts +27 -0
- package/dist/cjs/utils/testing/mockViewLayout.js +1 -0
- package/dist/esm/components/agreement/Collapsible/AgreementCollapsibleTrigger.d.ts +10 -3
- package/dist/esm/components/agreement/Collapsible/CollapsibleTrigger.d.ts +9 -3
- package/dist/esm/components/dropdown/components/FixedFloatingDropdown.js +1 -1
- package/dist/esm/components/dropdown/components/Trigger.js +1 -1
- package/dist/esm/components/dropdown/contexts/DropdownContext.d.ts +2 -2
- package/dist/esm/components/dropdown/types.d.ts +1 -1
- package/dist/esm/components/highlight/hooks/useTimestampRef.d.ts +1 -1
- package/dist/esm/components/icon-button/IconButton.d.ts +1 -1
- package/dist/esm/components/keypad/FullSecureKeypad/SecureKeyButton.js +1 -1
- package/dist/esm/components/keypad/FullSecureKeypad/index.d.ts +1 -1
- package/dist/esm/components/navbar/ReactNavigationHelper/HeaderLeft.d.ts +1 -1
- package/dist/esm/components/navbar/ReactNavigationHelper/HeaderRight.d.ts +1 -1
- package/dist/esm/components/navbar/ReactNavigationHelper/HeaderTitle.d.ts +1 -1
- package/dist/esm/components/navbar/ReactNavigationHelper/Right.d.ts +5 -2
- package/dist/esm/components/navbar/ReactNavigationHelper/Right.js +1 -1
- package/dist/esm/components/navbar/ReactNavigationHelper/index.d.ts +2 -2
- package/dist/esm/components/numeric-spinner/useAccelerateInterval.js +1 -1
- package/dist/esm/components/post/Header.d.ts +4 -4
- package/dist/esm/components/post/List/PostList.js +1 -1
- package/dist/esm/components/post/Post.d.ts +4 -4
- package/dist/esm/components/radio/Radio.d.ts +0 -31
- package/dist/esm/components/radio/Radio.js +1 -1
- package/dist/esm/components/radio/index.d.ts +1 -1
- package/dist/esm/components/radio/index.js +1 -1
- package/dist/esm/components/search-field/SearchField.d.ts +1 -1
- package/dist/esm/components/segmented-control/components/Item/Item.js +1 -1
- package/dist/esm/components/segmented-control/contexts/ScrollContext.d.ts +1 -1
- package/dist/esm/components/slider/Slider.js +1 -1
- package/dist/esm/components/text-field/OldTextField/TDSTextField.d.ts +1 -1
- package/dist/esm/components/text-field/OldTextField/hooks.d.ts +5 -5
- package/dist/esm/components/text-field/OldTextField/index.d.ts +1 -1
- package/dist/esm/components/text-field/OldTextField/styles.d.ts +3 -3
- package/dist/esm/components/text-field/TextField/hooks/useTextFieldClearButtonControls.js +1 -1
- package/dist/esm/components/text-field/TextField/variants/TextFieldBig/TextFieldBig.Button.js +1 -1
- package/dist/esm/components/text-field/TextField/variants/TextFieldBig/TextFieldBig.js +1 -1
- package/dist/esm/components/text-field/TextField/variants/TextFieldHero/TextFieldHero.Button.js +1 -1
- package/dist/esm/components/text-field/TextField/variants/TextFieldHero/TextFieldHero.js +1 -1
- package/dist/esm/components/text-field/TextField/variants/TextFieldLine/TextFieldLine.Button.js +1 -1
- package/dist/esm/components/text-field/TextField/variants/TextFieldLine/TextFieldLine.js +1 -1
- package/dist/esm/components/toast/hooks/useTextLine.d.ts +1 -1
- package/dist/esm/components/tooltip/components/Tooltip/FloatingTooltip.js +1 -1
- package/dist/esm/components/tooltip/contexts/TooltipContext.d.ts +2 -2
- package/dist/esm/components/tooltip/hooks/useCloseTooltip.js +1 -1
- package/dist/esm/components/tooltip/hooks/useOnPressOutside.d.ts +1 -1
- package/dist/esm/components/tooltip/hooks/useOnPressOutside.js +1 -1
- package/dist/esm/components/txt/Txt.js +2 -1
- package/dist/esm/core/color/Color.js +1 -3
- package/dist/esm/core/contexts/AdaptiveColorProvider.js +1 -1
- package/dist/esm/core/contexts/ColorPreferenceProvider.js +1 -3
- package/dist/esm/core/contexts/GlobalEventProvider.js +2 -1
- package/dist/esm/core/contexts/HideAccessibility.js +3 -1
- package/dist/esm/core/contexts/SafeAreaProvider.js +2 -1
- package/dist/esm/core/contexts/TDSProvider.js +1 -1
- package/dist/esm/core/contexts/TypographyProvider.js +1 -1
- package/dist/esm/core/hooks/useA11yCondition.js +2 -1
- package/dist/esm/core/hooks/useTypographyLevel.js +1 -1
- package/dist/esm/core/overlay/OverlayController.js +1 -1
- package/dist/esm/core/overlay/OverlayProvider.js +1 -1
- package/dist/esm/core/overlay/_OverlayProvider.js +1 -1
- package/dist/esm/core/overlay/types.d.ts +1 -0
- package/dist/esm/core/overlay/useOverlay.js +1 -1
- package/dist/esm/core/overlay/useOverlayBase.js +1 -1
- package/dist/esm/core/theme/ThemeProvider.js +1 -1
- package/dist/esm/core/theme/deriveToken/deriveToken.js +1 -1
- package/dist/esm/core/theme/seedToken/seedToken.js +1 -1
- package/dist/esm/extensions/bridge/components/Icon.d.ts +2 -2
- package/dist/esm/extensions/bridge/useBridge.js +1 -1
- package/dist/esm/extensions/navigation/Navigation.d.ts +5 -4
- package/dist/esm/extensions/navigation/Navigation.js +1 -1
- package/dist/esm/extensions/overlay-extension/components/CapturePress.d.ts +1 -1
- package/dist/esm/extensions/overlay-extension/components/CapturePress.js +1 -1
- package/dist/esm/extensions/page-navbar/PageNavbar.d.ts +1 -1
- package/dist/esm/extensions/tab-view/TabsContext.d.ts +1 -1
- package/dist/esm/extensions/tab-view/TabsList.js +1 -1
- package/dist/esm/extensions/tab-view/TabsViews.d.ts +1 -1
- package/dist/esm/extensions/tab-view/TabsViews.js +1 -1
- package/dist/esm/extensions/tab-view/hooks/useScrollStateChangedHandler.d.ts +1 -1
- package/dist/esm/extensions/tab-view/utils/getTabData.js +1 -1
- package/dist/esm/extensions/top-navigation/TopNavigation.d.ts +4 -16
- package/dist/esm/extensions/top-navigation/TopNavigation.js +1 -1
- package/dist/esm/extensions/top-navigation/constants.d.ts +15 -0
- package/dist/esm/extensions/top-navigation/constants.js +1 -0
- package/dist/esm/extensions/top-navigation/index.d.ts +1 -0
- package/dist/esm/extensions/top-navigation/index.js +1 -1
- package/dist/esm/interactions/pressable-effect/PressableEffect.d.ts +3 -1
- package/dist/esm/utils/compat.d.ts +17 -0
- package/dist/esm/utils/compat.js +1 -0
- package/dist/esm/utils/isReactText.d.ts +2 -2
- package/dist/esm/utils/mergeRefs.d.ts +2 -1
- package/dist/esm/utils/testing/index.d.ts +1 -0
- package/dist/esm/utils/testing/index.js +1 -1
- package/dist/esm/utils/testing/mockAccessibilityInfo.d.ts +5 -2
- package/dist/esm/utils/testing/mockAccessibilityInfo.js +1 -1
- package/dist/esm/utils/testing/mockViewLayout.d.ts +27 -0
- package/dist/esm/utils/testing/mockViewLayout.js +1 -0
- package/package.json +21 -19
- package/dist/cjs/components/checkbox/utils/useId.d.ts +0 -1
- package/dist/cjs/components/checkbox/utils/useId.js +0 -1
- package/dist/esm/components/checkbox/utils/useId.d.ts +0 -1
- package/dist/esm/components/checkbox/utils/useId.js +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
3
|
import type { Icon } from '../../components/icon';
|
|
4
|
+
import type { NavigationTheme } from './constants';
|
|
5
|
+
import { COLOR_PALETTE } from './constants';
|
|
4
6
|
type Icon = {
|
|
5
7
|
source: {
|
|
6
8
|
uri: string;
|
|
@@ -30,29 +32,15 @@ export interface TopNavigationProps {
|
|
|
30
32
|
leftVisible?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export declare function TopNavigation({ title, icon, onPressTitle, onPressDots, onPressClose, fixedRightButton, children, withHome, contentVisible, theme, leftVisible, }: TopNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
export type NavigationTheme
|
|
35
|
+
export type { NavigationTheme };
|
|
34
36
|
export interface NavigationRightContentProps extends ViewProps {
|
|
35
37
|
fixedRightButton: TopNavigationProps['fixedRightButton'];
|
|
36
38
|
onPressDots?: () => void;
|
|
37
39
|
onPressClose?: () => void;
|
|
38
40
|
theme?: NavigationTheme;
|
|
39
41
|
}
|
|
40
|
-
export
|
|
41
|
-
light: {
|
|
42
|
-
titleTextColor: string;
|
|
43
|
-
backgroundColor: string;
|
|
44
|
-
iconTintColor: string;
|
|
45
|
-
dividerColor: string;
|
|
46
|
-
};
|
|
47
|
-
dark: {
|
|
48
|
-
titleTextColor: string;
|
|
49
|
-
backgroundColor: string;
|
|
50
|
-
iconTintColor: string;
|
|
51
|
-
dividerColor: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
42
|
+
export { COLOR_PALETTE };
|
|
54
43
|
export declare function NavigationRightContent({ fixedRightButton, onPressDots, onPressClose, theme, ...viewProps }: NavigationRightContentProps): import("react/jsx-runtime").JSX.Element;
|
|
55
44
|
export declare function CloseWithDotsMono({ onPressDots, onPressClose, theme, }: Pick<TopNavigationProps, 'onPressDots' | 'onPressClose'> & {
|
|
56
45
|
theme?: NavigationTheme;
|
|
57
46
|
}): import("react/jsx-runtime").JSX.Element;
|
|
58
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{jsx as o,jsxs as a,Fragment as
|
|
1
|
+
"use strict";import{jsx as o,jsxs as a,Fragment as y}from"react/jsx-runtime";import{useNavigation as T}from"@granite-js/native/@react-navigation/native";import{closeView as N}from"@granite-js/react-native";import{useLayoutEffect as P}from"react";import{View as r}from"react-native";import{Navigation as k,NavigationBackButton as w,NavigationContent as _,NavigationLeft as E,NavigationRight as I,NavigationTitleIcon as v,NavigationTitleText as L}from"../navigation";import{tdsEvent as x}from"../partner-navigation/event";import{COLOR_PALETTE as e}from"./constants";import{IconButton as h}from"./IconButton";const C=157,A=C+44+4;export function TopNavigation({title:i,icon:t,onPressTitle:n,onPressDots:s,onPressClose:d,fixedRightButton:l,children:g,withHome:u=!1,contentVisible:m=!0,theme:c="light",leftVisible:f=!0}){const p=T(),b=p.canGoBack();return P(()=>{if(!m){p.setOptions({headerBackVisible:!1,headerTitle:()=>null,headerLeft:()=>null});return}},[m,p]),a(k,{children:[m&&a(y,{children:[o(E,{visible:f,children:o(w,{theme:c,canGoBack:b})}),a(_,{onPressTitle:n,horizontalSafeMargin:l!=null?A:C,withHome:u,theme:c,leftVisible:f,children:[o(v,{...t}),i!=null&&o(L,{theme:c,children:i}),u&&o(v,{name:"icon-home-mono"})]})]}),o(I,{children:o(NavigationRightContent,{fixedRightButton:l,onPressDots:s,onPressClose:d,theme:c})}),g]})}export{e as COLOR_PALETTE};export function NavigationRightContent({fixedRightButton:i,onPressDots:t,onPressClose:n,theme:s="light",...d}){const{style:l,...g}=d;return a(r,{style:[{flexDirection:"row",gap:4},l],...g,children:[i!=null?o(r,{style:{borderRadius:99,overflow:"hidden"},children:o(h,{name:i.icon.name??"",accessibilityLabel:i.title,onPress:()=>{i.onPress?.(),x.emit("navigationAccessoryEvent",{id:i.id})},style:{paddingVertical:7,paddingHorizontal:12,backgroundColor:e[s].backgroundColor},color:e[s].iconTintColor,disabled:i.disabled})}):o(r,{style:{width:44,height:34}}),o(CloseWithDotsMono,{onPressDots:t,onPressClose:n,theme:s})]})}export function CloseWithDotsMono({onPressDots:i,onPressClose:t=N,theme:n="light"}){return o(r,{style:{borderRadius:99,overflow:"hidden"},children:a(r,{style:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:12,height:34,paddingHorizontal:12,backgroundColor:e[n].backgroundColor},children:[o(h,{name:"icon-dots-mono",accessibilityLabel:"\uB354\uBCF4\uAE30",onPress:i,color:e[n].iconTintColor}),o(r,{style:{width:1,height:16,backgroundColor:e[n].dividerColor}}),o(h,{name:"icon-appsintoss-close-mono",accessibilityLabel:"\uB2EB\uAE30",color:e[n].iconTintColor,onPress:()=>{t()}})]})})}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type NavigationTheme = 'light' | 'dark';
|
|
2
|
+
export declare const COLOR_PALETTE: {
|
|
3
|
+
light: {
|
|
4
|
+
titleTextColor: string;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
iconTintColor: string;
|
|
7
|
+
dividerColor: string;
|
|
8
|
+
};
|
|
9
|
+
dark: {
|
|
10
|
+
titleTextColor: string;
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
iconTintColor: string;
|
|
13
|
+
dividerColor: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{colors as o}from"@toss/tds-colors";export const COLOR_PALETTE={light:{titleTextColor:"#191F28",backgroundColor:o.greyOpacity50,iconTintColor:o.greyOpacity600,dividerColor:o.greyOpacity200},dark:{titleTextColor:"#FFFFFF",backgroundColor:"rgba(2, 3, 7, 0.58)",iconTintColor:"rgba(253, 253, 255, 0.75))",dividerColor:"rgba(222, 222, 255, 0.19)"}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export*from"./TopNavigation";export*from"./useTopNavigation";
|
|
1
|
+
"use strict";export*from"./constants";export*from"./TopNavigation";export*from"./useTopNavigation";
|
|
@@ -4,7 +4,9 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { PressableUnderlay } from './PressableUnderlay';
|
|
5
5
|
interface PressableEffectProps extends PressableProps {
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
|
-
underlay?: ReactElement
|
|
7
|
+
underlay?: ReactElement<{
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
}> | null;
|
|
8
10
|
children?: ReactNode;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RNVersionBranch<T> {
|
|
2
|
+
'0.72': T;
|
|
3
|
+
'0.84': T;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* React Native 버전에 따라 적절한 값을 선택합니다.
|
|
7
|
+
* @param options - 버전별 값 객체
|
|
8
|
+
* @returns 현재 RN 버전에 맞는 값
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const Component = selectByRNVersion({
|
|
12
|
+
* '0.72': LegacyComponent,
|
|
13
|
+
* '0.84': ModernComponent,
|
|
14
|
+
* });
|
|
15
|
+
*/
|
|
16
|
+
export declare function selectByRNVersion<T>(options: RNVersionBranch<T>): T;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{Platform as e}from"react-native";export function selectByRNVersion(r){const t=e.constants.reactNativeVersion;return t&&t.minor>=84?r["0.84"]:r["0.72"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ReactNode
|
|
2
|
-
export declare function isReactText(node: ReactNode): node is
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare function isReactText(node: ReactNode): node is string | number;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export declare function mergeRefs<T = any>(...refs: Array<RefObject<T | null> | React.LegacyRef<T>>): React.Ref<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{mockAccessibilityInfo}from"./mockAccessibilityInfo";
|
|
1
|
+
"use strict";export{mockAccessibilityInfo}from"./mockAccessibilityInfo";export{mockViewLayout}from"./mockViewLayout";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AccessibilityInfo } from 'react-native';
|
|
2
2
|
type EnableAccessibilityInfoKey = keyof Pick<AccessibilityInfo, 'isReduceMotionEnabled' | 'isScreenReaderEnabled'>;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function setupAccessibilityMock(): void;
|
|
4
|
+
export declare function mockAccessibilityInfo(accessibilityInfo: {
|
|
4
5
|
[key in EnableAccessibilityInfoKey]?: boolean;
|
|
5
|
-
}):
|
|
6
|
+
}): {
|
|
7
|
+
expectAnnounced: (message: string) => void;
|
|
8
|
+
};
|
|
6
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{AccessibilityInfo as e}from"react-native";export function mockAccessibilityInfo(
|
|
1
|
+
"use strict";import{AccessibilityInfo as e}from"react-native";export function setupAccessibilityMock(){jest.mocked(e.isReduceMotionEnabled).mockReturnValue(Promise.resolve(!1)),jest.mocked(e.addEventListener).mockReturnValue({remove:jest.fn()}),e.announceForAccessibilityWithOptions||=jest.fn()}export function mockAccessibilityInfo(t){Object.entries(t).forEach(([n,s])=>{jest.mocked(e[n]).mockReturnValue(Promise.resolve(s))}),jest.spyOn(e,"addEventListener").mockReturnValue({remove:jest.fn()});const o=jest.spyOn(e,"announceForAccessibilityWithOptions");function c(n){expect(o).toHaveBeenCalledWith(n,expect.anything())}return{expectAnnounced:c}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fireEvent } from '@testing-library/react-native';
|
|
2
|
+
interface LayoutRect {
|
|
3
|
+
x?: number;
|
|
4
|
+
y?: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* jest 환경에서 View의 레이아웃 측정을 모킹합니다.
|
|
10
|
+
* `measure`, `measureInWindow`, `onLayout` 세 가지가 동일한 dimensions를 사용합니다.
|
|
11
|
+
*
|
|
12
|
+
* jest.restoreAllMocks()가 afterEach에서 호출되어야 spy가 정리됩니다.
|
|
13
|
+
* 또는 반환된 `restore()`를 직접 호출할 수 있습니다.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const { fireLayout } = mockViewLayout({ width: 200, height: 50 });
|
|
18
|
+
* render(<Component />);
|
|
19
|
+
* await act(async () => { jest.advanceTimersByTime(16); }); // requestAnimationFrame
|
|
20
|
+
* await act(async () => { fireLayout(element); }); // onLayout
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function mockViewLayout(layout?: LayoutRect): {
|
|
24
|
+
fireLayout: (element: Parameters<typeof fireEvent>[0], overrides?: LayoutRect) => void;
|
|
25
|
+
restore: () => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{View as o}from"react-native";import{fireEvent as y}from"@testing-library/react-native";const p={x:0,y:0,width:100,height:40};export function mockViewLayout(n){const t={...p,...n},i=jest.spyOn(o.prototype,"measure").mockImplementation(function(e){e(t.x,t.y,t.width,t.height,t.x,t.y)}),r=jest.spyOn(o.prototype,"measureInWindow").mockImplementation(function(e){e(t.x,t.y,t.width,t.height)});function m(e,c){const u={...t,...c};y(e,"layout",{nativeEvent:{layout:u}})}function s(){i.mockRestore(),r.mockRestore()}return{fireLayout:m,restore:s}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toss/tds-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.0",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"prepack": "yarn build",
|
|
35
35
|
"build": "./scripts/build.sh",
|
|
36
36
|
"test": "jest",
|
|
37
|
-
"typecheck": "tsc --noEmit",
|
|
37
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.spec.json",
|
|
38
38
|
"lint": "eslint ./src/**/*.{js,jsx,ts,tsx}"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -42,49 +42,51 @@
|
|
|
42
42
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
43
43
|
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
44
44
|
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
|
45
|
-
"@babel/plugin-transform-flow-strip-types": "
|
|
45
|
+
"@babel/plugin-transform-flow-strip-types": "7.27.1",
|
|
46
46
|
"@babel/preset-env": "^7.15.0",
|
|
47
47
|
"@babel/preset-react": "^7.16.7",
|
|
48
48
|
"@babel/preset-typescript": "^7.16.7",
|
|
49
49
|
"@babel/runtime": "7.18.9",
|
|
50
|
-
"@granite-js/native": "0.
|
|
51
|
-
"@granite-js/react-native": "0.
|
|
50
|
+
"@granite-js/native": "1.0.4",
|
|
51
|
+
"@granite-js/react-native": "1.0.4",
|
|
52
52
|
"@jest/globals": "^28",
|
|
53
|
-
"@testing-library/react-native": "^
|
|
54
|
-
"@tools/javascript-obfuscator": "0.0.
|
|
55
|
-
"@tools/obfuscator": "0.0.
|
|
53
|
+
"@testing-library/react-native": "^12.4.1",
|
|
54
|
+
"@tools/javascript-obfuscator": "0.0.1",
|
|
55
|
+
"@tools/obfuscator": "0.0.1",
|
|
56
56
|
"@types/culori": "^2.1.1",
|
|
57
57
|
"@types/jest": "^29",
|
|
58
|
-
"@types/react": "
|
|
58
|
+
"@types/react": "19.2.3",
|
|
59
|
+
"babel-preset-granite": "1.0.4",
|
|
60
|
+
"brick-module": "0.5.0",
|
|
59
61
|
"esbuild": "^0.25.8",
|
|
60
62
|
"jest": "^29.7.0",
|
|
61
63
|
"jest-cli": "^29.7.0",
|
|
62
64
|
"jest-react-native": "^18.0.0",
|
|
63
|
-
"react": "
|
|
64
|
-
"react-native": "0.
|
|
65
|
-
"react-test-renderer": "
|
|
65
|
+
"react": "19.2.3",
|
|
66
|
+
"react-native": "0.84.0",
|
|
67
|
+
"react-test-renderer": "19.2.3",
|
|
66
68
|
"typescript": "5.9.2"
|
|
67
69
|
},
|
|
68
70
|
"peerDependencies": {
|
|
69
|
-
"@granite-js/native": ">=
|
|
70
|
-
"@granite-js/react-native": "
|
|
71
|
+
"@granite-js/native": ">=1",
|
|
72
|
+
"@granite-js/react-native": ">=1",
|
|
73
|
+
"brick-module": "*",
|
|
71
74
|
"react": "*",
|
|
72
75
|
"react-native": "*"
|
|
73
76
|
},
|
|
74
77
|
"dependencies": {
|
|
75
|
-
"@react-spring/native": "
|
|
76
|
-
"@react-stately/radio": "^3.
|
|
78
|
+
"@react-spring/native": "10.0.3",
|
|
79
|
+
"@react-stately/radio": "^3.11.3",
|
|
77
80
|
"@toss/tds-color-utils": "0.0.2",
|
|
78
81
|
"@toss/tds-colors": "^0.1.0",
|
|
79
82
|
"@toss/tds-easings": "^0.0.1",
|
|
80
83
|
"@toss/tds-spring-easing": "^0.0.1",
|
|
81
84
|
"@toss/tds-typography": "0.0.3",
|
|
82
85
|
"@toss/utils": "^1.6.1",
|
|
86
|
+
"@types/node": "22.15.0",
|
|
83
87
|
"culori": "^4.0.1",
|
|
84
88
|
"es-hangul": "^2.3.0",
|
|
85
|
-
"hex-to-rgba": "^2.0.1"
|
|
86
|
-
"react-hook-form": "^7.33.1",
|
|
87
|
-
"react-uid": "^2.3.2"
|
|
89
|
+
"hex-to-rgba": "^2.0.1"
|
|
88
90
|
},
|
|
89
91
|
"sideEffects": false,
|
|
90
92
|
"packageManager": "yarn@3.2.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useId(prefix?: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=useId;const react_uid_1=require("react-uid");function useId(e){const t=(0,react_uid_1.useUID)();return e!==void 0?`${e}-${t}`:t}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useId(prefix?: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";import{useUID as t}from"react-uid";export default function u(e){const n=t();return e!==void 0?`${e}-${n}`:n}
|