cpk-ui 0.1.15 → 0.2.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.
Files changed (37) hide show
  1. package/components/modals/AlertDialog/AlertDialog.stories.tsx +1 -1
  2. package/components/modals/AlertDialog/AlertDialog.tsx +4 -4
  3. package/components/modals/Snackbar/Snackbar.stories.tsx +1 -1
  4. package/components/modals/Snackbar/Snackbar.tsx +1 -1
  5. package/components/uis/Accordion/Accordion.test.tsx +1 -1
  6. package/components/uis/Accordion/Accordion.tsx +4 -4
  7. package/components/uis/Accordion/AccordionItem.tsx +1 -1
  8. package/components/uis/Button/Button.test.tsx +1 -1
  9. package/components/uis/Button/Button.tsx +8 -8
  10. package/components/uis/Checkbox/Checkbox.test.tsx +1 -1
  11. package/components/uis/Checkbox/Checkbox.tsx +3 -3
  12. package/components/uis/CustomPressable/CustomPressable.tsx +1 -1
  13. package/components/uis/EditText/EditText.test.tsx +3 -3
  14. package/components/uis/EditText/EditText.tsx +12 -12
  15. package/components/uis/Fab/Fab.test.tsx +1 -1
  16. package/components/uis/Fab/Fab.tsx +1 -1
  17. package/components/uis/Hr/Hr.test.tsx +1 -1
  18. package/components/uis/Icon/Icon.test.tsx +1 -1
  19. package/components/uis/IconButton/IconButton.test.tsx +1 -1
  20. package/components/uis/IconButton/IconButton.tsx +3 -3
  21. package/components/uis/LoadingIndicator/LoadingIndicator.tsx +2 -2
  22. package/components/uis/RadioGroup/RadioButton.tsx +3 -3
  23. package/components/uis/RadioGroup/RadioGroup.test.tsx +1 -1
  24. package/components/uis/RadioGroup/RadioGroup.tsx +1 -1
  25. package/components/uis/Rating/Rating.test.tsx +1 -1
  26. package/components/uis/Rating/Rating.tsx +2 -2
  27. package/components/uis/StatusbarBrightness/StatusBarBrightness.test.tsx +1 -1
  28. package/components/uis/StatusbarBrightness/StatusBarBrightness.tsx +1 -1
  29. package/components/uis/SwitchToggle/SwitchToggle.test.tsx +1 -1
  30. package/components/uis/SwitchToggle/SwitchToggle.tsx +1 -1
  31. package/components/uis/Typography/Typography.test.tsx +1 -1
  32. package/package.json +1 -1
  33. package/providers/ThemeProvider.tsx +2 -2
  34. package/providers/index.js +3 -3
  35. package/providers/index.tsx +13 -7
  36. package/utils/guards.js +1 -1
  37. package/utils/guards.ts +4 -4
@@ -12,7 +12,7 @@ const Container = styled.SafeAreaView`
12
12
  background-color: ${({theme}) => theme.bg.basic};
13
13
  `;
14
14
 
15
- function AlertDialogBasicStory(): JSX.Element {
15
+ function AlertDialogBasicStory(): React.JSX.Element {
16
16
  const {alertDialog} = useCPK();
17
17
 
18
18
  return (
@@ -66,11 +66,11 @@ export type AlertDialogStyles = {
66
66
 
67
67
  export type AlertDialogOptions = {
68
68
  styles?: AlertDialogStyles;
69
- title?: string | JSX.Element;
70
- body?: string | JSX.Element;
69
+ title?: string | React.JSX.Element;
70
+ body?: string | React.JSX.Element;
71
71
  backdropOpacity?: number;
72
72
  closeOnTouchOutside?: boolean;
73
- actions?: JSX.Element[];
73
+ actions?: React.JSX.Element[];
74
74
  showCloseButton?: boolean;
75
75
  };
76
76
 
@@ -82,7 +82,7 @@ export type AlertDialogContext = {
82
82
  function AlertDialog(
83
83
  {style}: AlertDialogProps,
84
84
  ref: React.Ref<AlertDialogContext>,
85
- ): JSX.Element {
85
+ ): React.JSX.Element {
86
86
  const [options, setOptions] = useState<AlertDialogOptions | null>(null);
87
87
  const [visible, setVisible] = useState(false);
88
88
  const {theme, themeType} = useTheme();
@@ -11,7 +11,7 @@ const Container = styled.SafeAreaView`
11
11
  background-color: ${({theme}) => theme.bg.basic};
12
12
  `;
13
13
 
14
- function SnackbarBasicStory(): JSX.Element {
14
+ function SnackbarBasicStory(): React.JSX.Element {
15
15
  const {snackbar} = useCPK();
16
16
 
17
17
  return (
@@ -75,7 +75,7 @@ function clearTimer(): void {
75
75
  function Snackbar(
76
76
  {style}: SnackbarProps,
77
77
  ref: React.Ref<SnackbarContext>,
78
- ): JSX.Element {
78
+ ): React.JSX.Element {
79
79
  const [options, setOptions] = useState<SnackbarOptions | null>(null);
80
80
  const [visible, setVisible] = useState(false);
81
81
  const {theme} = useTheme();
@@ -7,7 +7,7 @@ import {createComponent, createTestProps} from '../../../../test/testUtils';
7
7
  import {Accordion} from './Accordion';
8
8
 
9
9
  let props: any;
10
- let component: JSX.Element;
10
+ let component: React.JSX.Element;
11
11
  let testingLib: RenderAPI;
12
12
 
13
13
  const data: any[] = [
@@ -26,9 +26,9 @@ export type AccordionBaseProps<T = string, K = string> = {
26
26
  animDuration?: number;
27
27
  activeOpacity?: number;
28
28
  toggleElementPosition?: 'left' | 'right';
29
- toggleElement?: JSX.Element | null;
30
- renderTitle?: (title: T) => JSX.Element;
31
- renderItem?: (body: K) => JSX.Element;
29
+ toggleElement?: React.JSX.Element | null;
30
+ renderTitle?: (title: T) => React.JSX.Element;
31
+ renderItem?: (body: K) => React.JSX.Element;
32
32
  onPressItem?: (title: T | string, body: K | string) => void;
33
33
  };
34
34
 
@@ -39,7 +39,7 @@ export function Accordion<T, K>({
39
39
  toggleElementPosition = 'right',
40
40
  data,
41
41
  ...rest
42
- }: AccordionProps<T, K>): JSX.Element {
42
+ }: AccordionProps<T, K>): React.JSX.Element {
43
43
  return (
44
44
  <Container style={style}>
45
45
  {data.map((datum, titleKey) => {
@@ -54,7 +54,7 @@ export function AccordionItem<T, K>({
54
54
  renderTitle,
55
55
  renderItem,
56
56
  styles,
57
- }: Props<T, K>): JSX.Element {
57
+ }: Props<T, K>): React.JSX.Element {
58
58
  const dropDownAnimValueRef = useRef(new Animated.Value(0));
59
59
  const rotateAnimValueRef = useRef(new Animated.Value(0));
60
60
  const fadeItemAnim = useRef(new Animated.Value(0)).current;
@@ -25,7 +25,7 @@ const Component = ({
25
25
  }: {
26
26
  props?: ButtonProps;
27
27
  themeType?: ThemeType;
28
- }): JSX.Element =>
28
+ }): React.JSX.Element =>
29
29
  createComponent(<Button onPress={jest.fn} {...props} />, themeType);
30
30
 
31
31
  describe('[Button]', () => {
@@ -36,11 +36,11 @@ export type Props = {
36
36
  disabled?: boolean;
37
37
  loading?: boolean;
38
38
  loadingColor?: string;
39
- loadingElement?: JSX.Element;
40
- text?: string | JSX.Element;
39
+ loadingElement?: React.JSX.Element;
40
+ text?: string | React.JSX.Element;
41
41
  borderRadius?: number;
42
- startElement?: JSX.Element;
43
- endElement?: JSX.Element;
42
+ startElement?: React.JSX.Element;
43
+ endElement?: React.JSX.Element;
44
44
  style?: StyleProp<Omit<ViewStyle, 'borderRadius' | 'padding'>>;
45
45
  styles?: Styles;
46
46
  onPress?: TouchableHighlightProps['onPress'];
@@ -218,7 +218,7 @@ export function Button({
218
218
  loadingColor,
219
219
  hitSlop = {top: 8, bottom: 8, left: 8, right: 8},
220
220
  hapticFeedback,
221
- }: Props): JSX.Element {
221
+ }: Props): React.JSX.Element {
222
222
  const ref = useRef<React.ElementRef<typeof TouchableHighlight>>(null);
223
223
  const hovered = useHover(ref);
224
224
  const {theme} = useTheme();
@@ -254,9 +254,9 @@ export function Button({
254
254
  children,
255
255
  loadingView,
256
256
  }: {
257
- children: JSX.Element;
258
- loadingView: JSX.Element;
259
- }): JSX.Element => (
257
+ children: React.JSX.Element;
258
+ loadingView: React.JSX.Element;
259
+ }): React.JSX.Element => (
260
260
  <ButtonContainer
261
261
  disabled={innerDisabled}
262
262
  size={size}
@@ -9,7 +9,7 @@ import {light} from '../../../utils/colors';
9
9
 
10
10
  let testingLib: RenderAPI;
11
11
 
12
- const Component = (props?: CheckboxProps): JSX.Element =>
12
+ const Component = (props?: CheckboxProps): React.JSX.Element =>
13
13
  createComponent(<Checkbox {...props} />);
14
14
 
15
15
  describe('[Checkbox]', () => {
@@ -31,8 +31,8 @@ export interface CheckboxProps {
31
31
  color?: CheckboxColor;
32
32
  disabled?: boolean;
33
33
  checked?: boolean;
34
- endElement?: JSX.Element;
35
- startElement?: JSX.Element;
34
+ endElement?: React.JSX.Element;
35
+ startElement?: React.JSX.Element;
36
36
  }
37
37
 
38
38
  const Container = styled.TouchableOpacity`
@@ -73,7 +73,7 @@ export function Checkbox({
73
73
  disabled = false,
74
74
  checked = false,
75
75
  onPress,
76
- }: CheckboxProps): JSX.Element {
76
+ }: CheckboxProps): React.JSX.Element {
77
77
  const animatedValue = new Animated.Value(0);
78
78
  const fadeAnim = useRef(animatedValue).current;
79
79
  const scaleAnim = useRef(animatedValue).current;
@@ -5,7 +5,7 @@ import {useCPK} from '../../../providers';
5
5
 
6
6
  export function CustomPressable(
7
7
  props: PressableProps & {style?: StyleProp<ViewStyle>},
8
- ): JSX.Element {
8
+ ): React.JSX.Element {
9
9
  const {children, style, hitSlop} = props;
10
10
  const {theme} = useCPK();
11
11
 
@@ -17,7 +17,7 @@ jest.mock('react-native-web-hooks', () => ({
17
17
 
18
18
  let testingLib: RenderAPI;
19
19
 
20
- const Component = (editProps?: EditTextProps): JSX.Element =>
20
+ const Component = (editProps?: EditTextProps): React.JSX.Element =>
21
21
  createComponent(<EditText {...editProps} />);
22
22
 
23
23
  describe('[EditText]', () => {
@@ -60,7 +60,7 @@ describe('[EditText]', () => {
60
60
  });
61
61
 
62
62
  it('renders custom label style', async () => {
63
- const renderCustomLabel = (): JSX.Element => {
63
+ const renderCustomLabel = (): React.JSX.Element => {
64
64
  return (
65
65
  <Text
66
66
  style={{
@@ -279,7 +279,7 @@ describe('[EditText]', () => {
279
279
  });
280
280
 
281
281
  it('should have render custom error', () => {
282
- const renderCustomError = (): JSX.Element => <Text>custom error</Text>;
282
+ const renderCustomError = (): React.JSX.Element => <Text>custom error</Text>;
283
283
 
284
284
  testingLib = render(
285
285
  Component({
@@ -46,10 +46,10 @@ export type EditTextStatus =
46
46
  | 'hovered'
47
47
  | 'basic';
48
48
 
49
- type RenderType = (stats: EditTextStatus) => JSX.Element;
49
+ type RenderType = (stats: EditTextStatus) => React.JSX.Element;
50
50
 
51
51
  type CustomRenderType =
52
- | (({color, status}: {color: string; status: EditTextStatus}) => JSX.Element)
52
+ | (({color, status}: {color: string; status: EditTextStatus}) => React.JSX.Element)
53
53
  | null;
54
54
 
55
55
  export type EditTextProps = {
@@ -59,8 +59,8 @@ export type EditTextProps = {
59
59
  styles?: EditTextStyles;
60
60
 
61
61
  // Component
62
- startElement?: JSX.Element | CustomRenderType;
63
- endElement?: JSX.Element | CustomRenderType;
62
+ startElement?: React.JSX.Element | CustomRenderType;
63
+ endElement?: React.JSX.Element | CustomRenderType;
64
64
  required?: boolean;
65
65
  label?: string | RenderType;
66
66
  error?: string | RenderType;
@@ -146,7 +146,7 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
146
146
  required = false,
147
147
  }: EditTextProps,
148
148
  ref,
149
- ): JSX.Element => {
149
+ ): React.JSX.Element => {
150
150
  EditText.displayName = 'EditText';
151
151
 
152
152
  const {theme} = useTheme();
@@ -194,9 +194,9 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
194
194
  ? 'focused'
195
195
  : 'basic';
196
196
 
197
- const renderLabel = useCallback((): JSX.Element | null => {
197
+ const renderLabel = useCallback((): React.JSX.Element | null => {
198
198
  // eslint-disable-next-line react/no-unstable-nested-components
199
- function Wrapper({children}: {children: ReactNode}): JSX.Element {
199
+ function Wrapper({children}: {children: ReactNode}): React.JSX.Element {
200
200
  return (
201
201
  <View
202
202
  style={[
@@ -256,7 +256,7 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
256
256
  ]);
257
257
 
258
258
  const renderContainer = useCallback(
259
- (children: ReactNode): JSX.Element => {
259
+ (children: ReactNode): React.JSX.Element => {
260
260
  return (
261
261
  <TouchableWithoutFeedback
262
262
  onPress={() => inputRef.current?.focus()}
@@ -305,7 +305,7 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
305
305
  ],
306
306
  );
307
307
 
308
- const renderInput = useCallback((): JSX.Element | null => {
308
+ const renderInput = useCallback((): React.JSX.Element | null => {
309
309
  return (
310
310
  <View
311
311
  style={[
@@ -432,7 +432,7 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
432
432
  value,
433
433
  ]);
434
434
 
435
- const renderError = useCallback((): JSX.Element | null => {
435
+ const renderError = useCallback((): React.JSX.Element | null => {
436
436
  return error ? (
437
437
  typeof error === 'string' ? (
438
438
  <Text
@@ -453,7 +453,7 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
453
453
  ) : null;
454
454
  }, [error, status, styles?.error, theme.text.validation]);
455
455
 
456
- const renderCounter = useCallback((): JSX.Element | null => {
456
+ const renderCounter = useCallback((): React.JSX.Element | null => {
457
457
  if (hideCounter) {
458
458
  return null;
459
459
  }
@@ -513,7 +513,7 @@ export const EditText = forwardRef<TextInput, EditTextProps>(
513
513
  },
514
514
  );
515
515
 
516
- function WebStyles(): JSX.Element {
516
+ function WebStyles(): React.JSX.Element {
517
517
  return (
518
518
  <Global
519
519
  // @ts-ignore
@@ -5,7 +5,7 @@ import {createComponent} from '../../../../test/testUtils';
5
5
  import type {IconName} from '../../..';
6
6
  import {Fab} from './Fab';
7
7
 
8
- const Component = (props): JSX.Element => createComponent(<Fab {...props} />);
8
+ const Component = (props): React.JSX.Element => createComponent(<Fab {...props} />);
9
9
 
10
10
  describe('[Fab]', () => {
11
11
  it('should render', async () => {
@@ -42,7 +42,7 @@ function FloatingActionButtons({
42
42
  }),
43
43
  animationDuration = 200,
44
44
  iconButtonProps,
45
- }: FabProps): JSX.Element {
45
+ }: FabProps): React.JSX.Element {
46
46
  const {Fab, FabItem} = styles ?? {};
47
47
 
48
48
  const spinValue = useRef(new Animated.Value(0));
@@ -8,7 +8,7 @@ import {Hr} from './Hr';
8
8
 
9
9
  let testingLib: RenderAPI;
10
10
 
11
- const Component = (): JSX.Element =>
11
+ const Component = (): React.JSX.Element =>
12
12
  createComponent(
13
13
  <View>
14
14
  <Hr />
@@ -6,7 +6,7 @@ import {Icon} from './Icon';
6
6
 
7
7
  let testingLib: RenderAPI;
8
8
 
9
- const Component = (): JSX.Element => createComponent(<Icon name="Person" />);
9
+ const Component = (): React.JSX.Element => createComponent(<Icon name="Person" />);
10
10
 
11
11
  describe('[Icon]', () => {
12
12
  it('should render without crashing', () => {
@@ -12,7 +12,7 @@ jest.mock('react-native-web-hooks', () => ({
12
12
  useHover: () => true,
13
13
  }));
14
14
 
15
- const Component = (props?: IconButtonProps): JSX.Element =>
15
+ const Component = (props?: IconButtonProps): React.JSX.Element =>
16
16
  createComponent(<IconButton {...props} />);
17
17
 
18
18
  describe('[IconButton]', () => {
@@ -92,9 +92,9 @@ export type IconButtonProps = {
92
92
  size?: ButtonSizeType | number;
93
93
  disabled?: boolean;
94
94
  loading?: boolean;
95
- loadingElement?: JSX.Element;
95
+ loadingElement?: React.JSX.Element;
96
96
  icon?: IconName;
97
- iconElement?: JSX.Element;
97
+ iconElement?: React.JSX.Element;
98
98
  style?: StyleProp<Omit<ViewStyle, 'borderRadius' | 'padding'>>;
99
99
  styles?: Styles;
100
100
  onPress?: TouchableHighlightProps['onPress'];
@@ -119,7 +119,7 @@ export function IconButton({
119
119
  activeOpacity = 0.95,
120
120
  touchableHighlightProps,
121
121
  hapticFeedback,
122
- }: IconButtonProps): JSX.Element {
122
+ }: IconButtonProps): React.JSX.Element {
123
123
  const ref = useRef<React.ElementRef<typeof TouchableHighlight>>(null);
124
124
  const hovered = useHover(ref);
125
125
  const {theme} = useTheme();
@@ -20,7 +20,7 @@ type Props = {
20
20
  color?: string;
21
21
  size?: ActivityIndicator["props"]["size"];
22
22
  imgSource?: string | ImageSourcePropType;
23
- customElement?: JSX.Element | (() => JSX.Element);
23
+ customElement?: React.JSX.Element | (() => React.JSX.Element);
24
24
  };
25
25
 
26
26
  const Container = styled.View``;
@@ -32,7 +32,7 @@ export function LoadingIndicator({
32
32
  size = "large",
33
33
  color,
34
34
  imgSource,
35
- }: Props): JSX.Element {
35
+ }: Props): React.JSX.Element {
36
36
  const { theme } = useTheme();
37
37
 
38
38
  const handleImgSourceType = (
@@ -33,8 +33,8 @@ export type RadioButtonProps = {
33
33
  type?: RadioButtonType;
34
34
  disabled?: boolean;
35
35
  selected?: boolean;
36
- endElement?: JSX.Element;
37
- startElement?: JSX.Element;
36
+ endElement?: React.JSX.Element;
37
+ startElement?: React.JSX.Element;
38
38
  };
39
39
 
40
40
  const Container = styled.TouchableOpacity`
@@ -82,7 +82,7 @@ export default function RadioButton({
82
82
  onPress,
83
83
  label,
84
84
  labelPosition = 'right',
85
- }: RadioButtonProps): JSX.Element {
85
+ }: RadioButtonProps): React.JSX.Element {
86
86
  const [innerLayout, setInnerLayout] = useState<LayoutRectangle>();
87
87
  const animatedValue = new Animated.Value(0);
88
88
  const fadeAnim = useRef(animatedValue).current;
@@ -8,7 +8,7 @@ import RadioButton from './RadioButton';
8
8
  import {type RadioButtonType, RadioGroup} from './RadioGroup';
9
9
 
10
10
  let props: any;
11
- let component: JSX.Element;
11
+ let component: React.JSX.Element;
12
12
  let testingLib: RenderAPI;
13
13
 
14
14
  const data = ['Person', 'Animal', 'Bird', 'Other'];
@@ -55,7 +55,7 @@ function RadioGroupContainer<T>({
55
55
  labels,
56
56
  labelPosition,
57
57
  radioType,
58
- }: Omit<Props<T>, 'selected'>): JSX.Element {
58
+ }: Omit<Props<T>, 'selected'>): React.JSX.Element {
59
59
  return (
60
60
  <Container style={style}>
61
61
  <Typography.Heading3 style={styles?.title}>{title}</Typography.Heading3>
@@ -5,7 +5,7 @@ import type {RatingProps} from './Rating';
5
5
  import {Rating} from './Rating';
6
6
  import {createComponent} from '../../../../test/testUtils';
7
7
 
8
- const Component = (props?: RatingProps): JSX.Element =>
8
+ const Component = (props?: RatingProps): React.JSX.Element =>
9
9
  createComponent(<Rating {...props} />);
10
10
 
11
11
  describe('Rating', () => {
@@ -47,7 +47,7 @@ export function Rating({
47
47
  allowHalfRating = true,
48
48
  disabled = false,
49
49
  color,
50
- }: RatingProps): JSX.Element {
50
+ }: RatingProps): React.JSX.Element {
51
51
  const [rating, setRating] = useState(initialRating);
52
52
  const iconPrefix = iconType === 'star' ? 'Star' : 'QuestBox';
53
53
 
@@ -67,7 +67,7 @@ export function Rating({
67
67
  }: {
68
68
  key: string;
69
69
  position: number;
70
- }): JSX.Element => {
70
+ }): React.JSX.Element => {
71
71
  const filled = rating >= position + (allowHalfRating ? 0.5 : 0);
72
72
  const iconName: IconName = filled ? `${iconPrefix}Fill` : `${iconPrefix}`;
73
73
  const halfFilled =
@@ -9,7 +9,7 @@ import {ThemeProvider} from '../../../providers/ThemeProvider';
9
9
 
10
10
  let testingLib: RenderAPI;
11
11
 
12
- const Component = (): JSX.Element =>
12
+ const Component = (): React.JSX.Element =>
13
13
  createComponent(
14
14
  <View>
15
15
  <StatusBarBrightness />
@@ -2,7 +2,7 @@ import type {StatusBarStyle} from 'react-native';
2
2
  import {StatusBar} from 'react-native';
3
3
  import {useTheme} from '../../../providers/ThemeProvider';
4
4
 
5
- function StatusBarBrightness({type}: {type?: StatusBarStyle}): JSX.Element {
5
+ function StatusBarBrightness({type}: {type?: StatusBarStyle}): React.JSX.Element {
6
6
  const {themeType} = useTheme();
7
7
 
8
8
  const statusColor: StatusBarStyle = type
@@ -27,7 +27,7 @@ describe('[SwitchToggle]', () => {
27
27
  expect(handlePress).toBeCalled();
28
28
  });
29
29
 
30
- const getSwitchToggle = ({isOn}: {isOn: boolean}): JSX.Element =>
30
+ const getSwitchToggle = ({isOn}: {isOn: boolean}): React.JSX.Element =>
31
31
  createComponent(
32
32
  <SwitchToggle
33
33
  isOn={isOn}
@@ -84,7 +84,7 @@ export function SwitchToggle({
84
84
  size = 'medium',
85
85
  offElement,
86
86
  onPress,
87
- }: Props): JSX.Element {
87
+ }: Props): React.JSX.Element {
88
88
  const {theme} = useTheme();
89
89
 
90
90
  const {
@@ -9,7 +9,7 @@ import {ThemeProvider} from '../../../providers/ThemeProvider';
9
9
 
10
10
  let testingLib: RenderAPI;
11
11
 
12
- const Component = (): JSX.Element =>
12
+ const Component = (): React.JSX.Element =>
13
13
  createComponent(
14
14
  <View>
15
15
  <Typography.Title />,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cpk-ui",
3
- "version": "0.1.15",
3
+ "version": "0.2.0",
4
4
  "main": "index",
5
5
  "react-native": "index",
6
6
  "module": "index",
@@ -32,7 +32,7 @@ export type ThemeContext = {
32
32
  const [useCtx, CpkProvider] = createCtx<ThemeContext>();
33
33
 
34
34
  export type ThemeProps = {
35
- children?: JSX.Element;
35
+ children?: React.JSX.Element;
36
36
  initialThemeType?: ThemeType;
37
37
  customTheme?: ThemeParam;
38
38
  /*
@@ -104,7 +104,7 @@ export function ThemeProvider({
104
104
  initialThemeType,
105
105
  customTheme = {},
106
106
  responsiveDesignMode = "mobile-first",
107
- }: ThemeProps): JSX.Element {
107
+ }: ThemeProps): React.JSX.Element {
108
108
  const isPortrait = useMediaQuery({ orientation: "portrait" });
109
109
 
110
110
  const isMobile = useMediaQuery(
@@ -9,7 +9,7 @@ import Snackbar from '../components/modals/Snackbar/Snackbar';
9
9
  import AlertDialog from '../components/modals/AlertDialog/AlertDialog';
10
10
  import { LoadingIndicator } from '../components/uis/LoadingIndicator/LoadingIndicator';
11
11
  const [useCtx, Provider] = createCtx();
12
- function AppProvider({ children }) {
12
+ function AppProvider({ children, }) {
13
13
  const [assetLoaded] = useFonts({
14
14
  cpk: require('../components/uis/Icon/cpk.ttf'),
15
15
  'Pretendard-Bold': require('../components/uis/Icon/Pretendard-Bold.otf'),
@@ -17,8 +17,8 @@ function AppProvider({ children }) {
17
17
  'Pretendard-Thin': require('../components/uis/Icon/Pretendard-Thin.otf'),
18
18
  });
19
19
  const themeContext = useTheme();
20
- const snackbar = useRef();
21
- const alertDialog = useRef();
20
+ const snackbar = useRef(undefined);
21
+ const alertDialog = useRef(undefined);
22
22
  /**
23
23
  ** Snackbar
24
24
  */
@@ -31,7 +31,11 @@ export type CpkContext = {
31
31
 
32
32
  const [useCtx, Provider] = createCtx<CpkContext>();
33
33
 
34
- function AppProvider({children}: {children: JSX.Element}): JSX.Element {
34
+ function AppProvider({
35
+ children,
36
+ }: {
37
+ children: React.JSX.Element;
38
+ }): React.JSX.Element {
35
39
  const [assetLoaded] = useFonts({
36
40
  cpk: require('../components/uis/Icon/cpk.ttf'),
37
41
  'Pretendard-Bold': require('../components/uis/Icon/Pretendard-Bold.otf'),
@@ -41,11 +45,13 @@ function AppProvider({children}: {children: JSX.Element}): JSX.Element {
41
45
 
42
46
  const themeContext = useTheme();
43
47
 
44
- const snackbar =
45
- useRef<SnackbarContext>() as MutableRefObject<SnackbarContext>;
48
+ const snackbar = useRef<SnackbarContext>(
49
+ undefined,
50
+ ) as MutableRefObject<SnackbarContext>;
46
51
 
47
- const alertDialog =
48
- useRef<AlertDialogContext>() as MutableRefObject<AlertDialogContext>;
52
+ const alertDialog = useRef<AlertDialogContext>(
53
+ undefined,
54
+ ) as MutableRefObject<AlertDialogContext>;
49
55
 
50
56
  /**
51
57
  ** Snackbar
@@ -109,10 +115,10 @@ function AppProvider({children}: {children: JSX.Element}): JSX.Element {
109
115
  export type CpkProviderProps = {
110
116
  themeConfig?: Omit<ThemeProps, 'children'>;
111
117
  snackbarConfig?: SnackbarOptions;
112
- children: JSX.Element;
118
+ children: React.JSX.Element;
113
119
  };
114
120
 
115
- function CpkWithThemeProvider(props: CpkProviderProps): JSX.Element {
121
+ function CpkWithThemeProvider(props: CpkProviderProps): React.JSX.Element {
116
122
  const {themeConfig} = props;
117
123
 
118
124
  return (
package/utils/guards.js CHANGED
@@ -24,7 +24,7 @@ const getRootElementStyleType = (element) => {
24
24
  * This function applies default colors to cloned element.
25
25
  *
26
26
  * @param {CloneElemColorsParams} params
27
- * @returns {JSX.Element} - Cloned element with default colors if exists. Otherwise, null.
27
+ * @returns {React.JSX.Element} - Cloned element with default colors if exists. Otherwise, null.
28
28
  */
29
29
  export const cloneElemWithDefaultColors = ({ element, color, backgroundColor, style, }) => {
30
30
  return element
package/utils/guards.ts CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  import {Icon} from '../components/uis/Icon/Icon';
15
15
 
16
16
  const getRootElementStyleType = (
17
- element: JSX.Element,
17
+ element: React.JSX.Element,
18
18
  ): 'TextStyle' | 'ViewStyle' | 'unknown' => {
19
19
  if (React.isValidElement(element)) {
20
20
  if (
@@ -45,7 +45,7 @@ type CloneElemColorsParams = {
45
45
  /**
46
46
  * ReactElement to be cloned to shape default colors.
47
47
  */
48
- element?: JSX.Element;
48
+ element?: React.JSX.Element;
49
49
  /**
50
50
  * Text color to be applied.
51
51
  * If not passed, default color will be applied.
@@ -68,14 +68,14 @@ type CloneElemColorsParams = {
68
68
  * This function applies default colors to cloned element.
69
69
  *
70
70
  * @param {CloneElemColorsParams} params
71
- * @returns {JSX.Element} - Cloned element with default colors if exists. Otherwise, null.
71
+ * @returns {React.JSX.Element} - Cloned element with default colors if exists. Otherwise, null.
72
72
  */
73
73
  export const cloneElemWithDefaultColors = ({
74
74
  element,
75
75
  color,
76
76
  backgroundColor,
77
77
  style,
78
- }: CloneElemColorsParams): JSX.Element | null => {
78
+ }: CloneElemColorsParams): React.JSX.Element | null => {
79
79
  return element
80
80
  ? cloneElement(element, {
81
81
  style: [