@hero-design/rn 8.5.0-alpha.0 → 8.6.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 (34) hide show
  1. package/.turbo/turbo-build.log +9 -66
  2. package/.turbo/turbo-publish:npm.log +0 -0
  3. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  4. package/es/index.js +641 -719
  5. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  6. package/lib/index.js +641 -718
  7. package/package.json +7 -5
  8. package/rollup.config.js +1 -0
  9. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  10. package/src/components/Icon/IconList.ts +1 -0
  11. package/src/components/Swipeable/StyledSwipeable.tsx +2 -14
  12. package/src/components/Swipeable/SwipeableAction.tsx +7 -15
  13. package/src/components/Swipeable/index.tsx +136 -531
  14. package/src/components/SwipeableV2/StyledSwipeable.tsx +14 -0
  15. package/src/components/SwipeableV2/__tests__/__snapshots__/index.spec.tsx.snap +161 -0
  16. package/src/components/SwipeableV2/__tests__/index.spec.tsx +48 -0
  17. package/src/components/SwipeableV2/index.tsx +364 -0
  18. package/src/index.ts +2 -0
  19. package/types/components/Icon/IconList.d.ts +1 -1
  20. package/types/components/Icon/index.d.ts +1 -1
  21. package/types/components/Icon/utils.d.ts +1 -1
  22. package/types/components/Select/BaseOptionList.d.ts +4 -8
  23. package/types/components/Select/MultiSelect/OptionList.d.ts +4 -7
  24. package/types/components/Select/SingleSelect/OptionList.d.ts +4 -4
  25. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +1 -1
  26. package/types/components/Swipeable/StyledSwipeable.d.ts +2 -15
  27. package/types/components/Swipeable/SwipeableAction.d.ts +6 -10
  28. package/types/components/Swipeable/index.d.ts +41 -24
  29. package/types/components/SwipeableV2/StyledSwipeable.d.ts +15 -0
  30. package/types/components/SwipeableV2/index.d.ts +46 -0
  31. package/types/components/Toolbar/index.d.ts +3 -2
  32. package/types/index.d.ts +2 -1
  33. package/src/components/Swipeable/Buttons.tsx +0 -65
  34. package/types/components/Swipeable/Buttons.d.ts +0 -15
@@ -1,2 +1,2 @@
1
- declare const isHeroIcon: (x: any) => x is "number" | "swag" | "wallet" | "bold" | "menu" | "filter" | "image" | "switch" | "list" | "warning" | "activate" | "add-emoji" | "add-person" | "adjustment" | "alignment" | "antenna" | "archive" | "assignment-warning" | "bank" | "bell" | "billing" | "bookmark" | "box-check" | "box" | "buildings" | "cake" | "calendar-clock" | "calendar" | "candy-box-menu" | "caret-down-small" | "caret-down" | "caret-left-small" | "caret-left" | "caret-right-small" | "caret-right" | "caret-up-small" | "caret-up" | "check-radio" | "circle-add" | "circle-cancel" | "circle-check" | "circle-down" | "circle-info" | "circle-left" | "circle-ok" | "circle-pencil" | "circle-question" | "circle-remove" | "circle-right" | "circle-up" | "circle-warning" | "clock-3" | "clock" | "cloud-download" | "cloud-upload" | "cog" | "coin" | "contacts" | "credit-card" | "diamond" | "direction-arrows" | "directory" | "document" | "dollar-coin-shine" | "double-buildings" | "edit-template" | "envelope" | "expense" | "eye-circle" | "eye-invisible" | "eye" | "face-meh" | "face-sad" | "face-smiley" | "feed" | "feedbacks" | "file-certified" | "file-clone" | "file-copy" | "file-csv" | "file-dispose" | "file-doc" | "file-excel" | "file-export" | "file-lock" | "file-pdf" | "file-powerpoint" | "file-search" | "file-secured" | "file-sheets" | "file-slide" | "file-verified" | "file-word" | "file" | "folder-user" | "folder" | "format-bold" | "format-heading1" | "format-heading2" | "format-italic" | "format-list-bulleted" | "format-list-numbered" | "format-underlined" | "funnel-filter" | "global-dollar" | "globe" | "graduation-cap" | "graph" | "happy-sun" | "health-bag" | "heart" | "home" | "import" | "incident-siren" | "instapay" | "loading-2" | "loading" | "location" | "lock" | "looks-one" | "looks-two" | "media-content" | "moneybag" | "moon" | "multiple-stars" | "multiple-users" | "node" | "open-folder" | "paperclip" | "payment-summary" | "pencil" | "phone" | "piggy-bank" | "plane" | "play-circle" | "print" | "raising-hands" | "reply-arrow" | "reply" | "reschedule" | "rostering" | "save" | "schedule-send" | "schedule" | "search-person" | "send" | "speaker-active" | "speaker" | "star-award" | "star-badge" | "star-medal" | "star" | "steps-circle" | "stopwatch" | "suitcase" | "survey" | "tag" | "target" | "teams" | "timesheet" | "touch-id" | "trash-bin" | "unlock" | "user" | "video-1" | "video-2" | "activate-outlined" | "add-credit-card-outlined" | "add-person-outlined" | "add-section-outlined" | "add-time-outlined" | "add" | "adjustment-outlined" | "alignment-2-outlined" | "alignment-outlined" | "all-caps" | "arrow-down" | "arrow-downwards" | "arrow-left" | "arrow-leftwards" | "arrow-right" | "arrow-rightwards" | "arrow-up" | "arrow-upwards" | "at-sign" | "bell-active-outlined" | "bell-outlined" | "bell-slash-outlined" | "billing-outlined" | "body-outlined" | "bookmark-added-outlined" | "bookmark-outlined" | "box-check-outlined" | "box-outlined" | "bullet-points" | "cake-outlined" | "calendar-dates-outlined" | "calendar-star-outlined" | "camera-outlined" | "cancel" | "chat-bubble-outlined" | "chat-unread-outlined" | "checkmark" | "circle-add-outlined" | "circle-cancel-outlined" | "circle-down-outlined" | "circle-info-outlined" | "circle-left-outlined" | "circle-ok-outlined" | "circle-question-outlined" | "circle-remove-outlined" | "circle-right-outlined" | "circle-up-outlined" | "circle-warning-outlined" | "clock-2-outlined" | "clock-outlined" | "cog-outlined" | "coin-outlined" | "comment-outlined" | "contacts-outlined" | "credit-card-outlined" | "cup-outlined" | "direction-arrows-outlined" | "directory-outlined" | "document-outlined" | "dollar-card-outlined" | "dollar-coin-shine-outlined" | "dollar-sign" | "double-buildings-outlined" | "double-left-arrows" | "double-right-arrows" | "download-outlined" | "edit-template-outlined" | "email-outlined" | "enter-arrow" | "envelope-outlined" | "expense-outlined" | "explore-outlined" | "external-link" | "eye-invisible-outlined" | "eye-outlined" | "face-id" | "face-meh-outlined" | "face-open-smiley-outlined" | "face-sad-outlined" | "face-smiley-outlined" | "feed-outlined" | "file-certified-outlined" | "file-clone-outlined" | "file-copy-outlined" | "file-dispose-outlined" | "file-dollar-outlined" | "file-download-outlined" | "file-export-outlined" | "file-lock-outlined" | "file-outlined" | "file-search-outlined" | "file-secured-outlined" | "file-verified-outlined" | "filter-outlined" | "folder-outlined" | "folder-user-outlined" | "funnel-filter-outline" | "graph-outlined" | "hand-holding-user-outlined" | "happy-sun-outlined" | "health-bag-outlined" | "heart-outlined" | "home-active-outlined" | "home-outlined" | "id-card-outlined" | "image-outlined" | "import-outlined" | "instapay-outlined" | "italic" | "link-1" | "link-2" | "list-outlined" | "live-help-outlined" | "location-outlined" | "lock-outlined" | "locked-file-outlined" | "log-out" | "media-content-outlined" | "menu-close" | "menu-expand" | "menu-fold-outlined" | "menu-unfold-outlined" | "moneybag-outlined" | "moon-outlined" | "more-horizontal" | "more-vertical" | "multiple-folders-outlined" | "multiple-users-outlined" | "near-me-outlined" | "node-outlined" | "number-points" | "payment-summary-outlined" | "payslip-outlined" | "pencil-outlined" | "percentage" | "phone-outlined" | "piggy-bank-outlined" | "plane-outlined" | "play-circle-outlined" | "print-outlined" | "qr-code-outlined" | "qualification-outlined" | "re-assign" | "redeem" | "refresh" | "remove" | "reply-outlined" | "restart" | "return-arrow" | "rostering-outlined" | "save-outlined" | "schedule-outlined" | "search-outlined" | "search-secured-outlined" | "send-outlined" | "share-1" | "share-2" | "share-outlined" | "single-down-arrow" | "single-left-arrow" | "single-right-arrow" | "single-up-arrow" | "speaker-active-outlined" | "speaker-outlined" | "star-outlined" | "stopwatch-outlined" | "strikethrough" | "suitcase-clock-outlined" | "suitcase-outlined" | "survey-outlined" | "switch-outlined" | "sync" | "target-outlined" | "timesheet-outlined" | "today-outlined" | "transfer" | "trash-bin-outlined" | "umbrela-outlined" | "unavailable" | "underline" | "unlock-outlined" | "upload-outlined" | "user-circle-outlined" | "user-gear-outlined" | "user-outlined" | "user-rectangle-outlined" | "video-1-outlined" | "video-2-outlined" | "wallet-outlined";
1
+ declare const isHeroIcon: (x: any) => x is "number" | "swag" | "wallet" | "bold" | "menu" | "filter" | "image" | "switch" | "list" | "warning" | "activate" | "add-emoji" | "add-person" | "adjustment" | "alignment" | "antenna" | "archive" | "assignment-warning" | "bank" | "bell" | "billing" | "bookmark-added" | "bookmark" | "box-check" | "box" | "buildings" | "cake" | "calendar-clock" | "calendar" | "candy-box-menu" | "caret-down-small" | "caret-down" | "caret-left-small" | "caret-left" | "caret-right-small" | "caret-right" | "caret-up-small" | "caret-up" | "check-radio" | "circle-add" | "circle-cancel" | "circle-check" | "circle-down" | "circle-info" | "circle-left" | "circle-ok" | "circle-pencil" | "circle-question" | "circle-remove" | "circle-right" | "circle-up" | "circle-warning" | "clock-3" | "clock" | "cloud-download" | "cloud-upload" | "cog" | "coin" | "contacts" | "credit-card" | "diamond" | "direction-arrows" | "directory" | "document" | "dollar-coin-shine" | "double-buildings" | "edit-template" | "envelope" | "expense" | "eye-circle" | "eye-invisible" | "eye" | "face-meh" | "face-sad" | "face-smiley" | "feed" | "feedbacks" | "file-certified" | "file-clone" | "file-copy" | "file-csv" | "file-dispose" | "file-doc" | "file-excel" | "file-export" | "file-lock" | "file-pdf" | "file-powerpoint" | "file-search" | "file-secured" | "file-sheets" | "file-slide" | "file-verified" | "file-word" | "file" | "folder-user" | "folder" | "format-bold" | "format-heading1" | "format-heading2" | "format-italic" | "format-list-bulleted" | "format-list-numbered" | "format-underlined" | "funnel-filter" | "global-dollar" | "globe" | "graduation-cap" | "graph" | "happy-sun" | "health-bag" | "heart" | "home" | "import" | "incident-siren" | "instapay" | "loading-2" | "loading" | "location" | "lock" | "looks-one" | "looks-two" | "media-content" | "money-notes" | "moneybag" | "moon" | "multiple-stars" | "multiple-users" | "node" | "open-folder" | "paperclip" | "payment-summary" | "pencil" | "phone" | "piggy-bank" | "plane" | "play-circle" | "print" | "raising-hands" | "reply-arrow" | "reply" | "reschedule" | "rostering" | "save" | "schedule-send" | "schedule" | "search-person" | "send" | "speaker-active" | "speaker" | "star-award" | "star-badge" | "star-circle" | "star-medal" | "star" | "steps-circle" | "stopwatch" | "suitcase" | "survey" | "tag" | "target" | "teams" | "timesheet" | "touch-id" | "trash-bin" | "unlock" | "user" | "video-1" | "video-2" | "activate-outlined" | "add-credit-card-outlined" | "add-person-outlined" | "add-section-outlined" | "add-time-outlined" | "add" | "adjustment-outlined" | "alignment-2-outlined" | "alignment-outlined" | "all-caps" | "arrow-down" | "arrow-downwards" | "arrow-left" | "arrow-leftwards" | "arrow-right" | "arrow-rightwards" | "arrow-up" | "arrow-upwards" | "article-outlined" | "at-sign" | "auto-graph-outlined" | "bell-active-outlined" | "bell-outlined" | "bell-slash-outlined" | "billing-outlined" | "body-outlined" | "bookmark-added-outlined" | "bookmark-outlined" | "box-check-outlined" | "box-outlined" | "bullet-points" | "cake-outlined" | "calendar-dates-outlined" | "calendar-star-outlined" | "camera-outlined" | "cancel" | "chat-bubble-outlined" | "chat-unread-outlined" | "checkmark" | "circle-add-outlined" | "circle-cancel-outlined" | "circle-down-outlined" | "circle-info-outlined" | "circle-left-outlined" | "circle-ok-outlined" | "circle-question-outlined" | "circle-remove-outlined" | "circle-right-outlined" | "circle-up-outlined" | "circle-warning-outlined" | "clock-2-outlined" | "clock-outlined" | "cog-outlined" | "coin-outlined" | "comment-outlined" | "contacts-outlined" | "credit-card-outlined" | "cup-outlined" | "direction-arrows-outlined" | "directory-outlined" | "document-outlined" | "dollar-card-outlined" | "dollar-coin-shine-outlined" | "dollar-credit-card-outlined" | "dollar-sign" | "double-buildings-outlined" | "double-left-arrows" | "double-right-arrows" | "download-outlined" | "edit-template-outlined" | "email-outlined" | "enter-arrow" | "envelope-outlined" | "expense-outlined" | "explore-outlined" | "external-link" | "eye-invisible-outlined" | "eye-outlined" | "face-id" | "face-meh-outlined" | "face-open-smiley-outlined" | "face-sad-outlined" | "face-smiley-outlined" | "feed-outlined" | "file-certified-outlined" | "file-clone-outlined" | "file-copy-outlined" | "file-dispose-outlined" | "file-dollar-outlined" | "file-download-outlined" | "file-export-outlined" | "file-lock-outlined" | "file-outlined" | "file-search-outlined" | "file-secured-outlined" | "file-statutory-outlined" | "file-verified-outlined" | "filter-outlined" | "folder-outlined" | "folder-user-outlined" | "funnel-filter-outline" | "graph-outlined" | "hand-holding-user-outlined" | "happy-sun-outlined" | "health-bag-outlined" | "heart-outlined" | "home-active-outlined" | "home-outlined" | "id-card-outlined" | "image-outlined" | "import-outlined" | "instapay-outlined" | "italic" | "link-1" | "link-2" | "list-outlined" | "live-help-outlined" | "location-outlined" | "lock-outlined" | "locked-file-outlined" | "log-out" | "media-content-outlined" | "menu-close" | "menu-expand" | "menu-fold-outlined" | "menu-unfold-outlined" | "moneybag-outlined" | "moon-outlined" | "more-horizontal" | "more-vertical" | "multiple-folders-outlined" | "multiple-users-outlined" | "near-me-outlined" | "node-outlined" | "number-points" | "overview-outlined" | "payment-summary-outlined" | "payslip-outlined" | "pencil-outlined" | "percentage" | "phone-outlined" | "piggy-bank-outlined" | "plane-outlined" | "play-circle-outlined" | "print-outlined" | "qr-code-outlined" | "qualification-outlined" | "re-assign" | "redeem" | "refresh" | "remove" | "reply-outlined" | "restart" | "return-arrow" | "rostering-outlined" | "save-outlined" | "schedule-outlined" | "search-outlined" | "search-secured-outlined" | "send-outlined" | "share-1" | "share-2" | "share-outlined" | "show-chart-outlined" | "single-down-arrow" | "single-left-arrow" | "single-right-arrow" | "single-up-arrow" | "speaker-active-outlined" | "speaker-outlined" | "star-circle-outlined" | "star-outlined" | "stopwatch-outlined" | "strikethrough" | "suitcase-clock-outlined" | "suitcase-outlined" | "survey-outlined" | "switch-outlined" | "sync" | "target-outlined" | "timesheet-outlined" | "today-outlined" | "transfer" | "trash-bin-outlined" | "umbrela-outlined" | "unavailable" | "underline" | "unlock-outlined" | "upload-outlined" | "user-circle-outlined" | "user-gear-outlined" | "user-outlined" | "user-rectangle-outlined" | "video-1-outlined" | "video-2-outlined" | "wallet-outlined";
2
2
  export { isHeroIcon };
@@ -1,12 +1,8 @@
1
1
  import React from 'react';
2
- import { SectionList } from 'react-native';
3
- import type { ReactElement } from 'react';
4
- import type { SectionListRenderItemInfo } from 'react-native';
5
- import type { SectionData, OptionType, SelectProps, SectionType } from './types';
2
+ import { SectionList, SectionListProps } from 'react-native';
3
+ import type { OptionType, SelectProps, SectionType } from './types';
6
4
  export declare type BaseOptionListProps<V, T extends OptionType<V>> = Pick<SelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange'> & {
7
- sections: SectionData<V, T>[];
8
- renderItem: (info: SectionListRenderItemInfo<T, SectionType>) => ReactElement;
9
5
  sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
10
- };
11
- declare const BaseOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, sectionListRef, }: BaseOptionListProps<V, T>) => JSX.Element;
6
+ } & SectionListProps<T, SectionType>;
7
+ declare const BaseOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, sectionListRef, ...rest }: BaseOptionListProps<V, T>) => JSX.Element;
12
8
  export default BaseOptionList;
@@ -1,11 +1,8 @@
1
- import React from 'react';
2
- import type { SectionList } from 'react-native';
1
+ import { BaseOptionListProps } from '../BaseOptionList';
3
2
  import type { MultiSelectProps } from '.';
4
- import type { OptionType, SectionData, SectionType } from '../types';
3
+ import type { OptionType } from '../types';
5
4
  declare type OptionListProps<V, T extends OptionType<V>> = Pick<MultiSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
6
5
  onPress: (value: V[]) => void;
7
- sections: SectionData<V, T>[];
8
- sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
9
- };
10
- declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, }: OptionListProps<V, T>) => JSX.Element;
6
+ } & BaseOptionListProps<V, T>;
7
+ declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, ...rest }: OptionListProps<V, T>) => JSX.Element;
11
8
  export default OptionList;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { SectionList } from 'react-native';
3
3
  import type { SingleSelectProps } from '.';
4
- import type { OptionType, SectionData, SectionType } from '../types';
4
+ import type { OptionType, SectionType } from '../types';
5
+ import { BaseOptionListProps } from '../BaseOptionList';
5
6
  declare type OptionListProps<V, T extends OptionType<V>> = Pick<SingleSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
6
7
  onPress: (value: V | null) => void;
7
- sections: SectionData<V, T>[];
8
8
  sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
9
- };
10
- declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, }: OptionListProps<V, T>) => JSX.Element;
9
+ } & BaseOptionListProps<V, T>;
10
+ declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, ...rest }: OptionListProps<V, T>) => JSX.Element;
11
11
  export default OptionList;
@@ -1 +1 @@
1
- export declare const StyledOptionList: <V, T extends import("../types").OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, sectionListRef, }: import("../BaseOptionList").BaseOptionListProps<V, T>) => JSX.Element;
1
+ export declare const StyledOptionList: <V, T extends import("../types").OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, sectionListRef, ...rest }: import("../BaseOptionList").BaseOptionListProps<V, T>) => JSX.Element;
@@ -1,6 +1,6 @@
1
- import { Animated, TouchableOpacity, View } from 'react-native';
1
+ import { TouchableOpacity } from 'react-native';
2
2
  export declare type ActionIntent = 'primary' | 'success' | 'danger';
3
- declare const StyledRectButton: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & {
3
+ export declare const StyledRectButton: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & {
4
4
  theme?: import("@emotion/react").Theme | undefined;
5
5
  as?: import("react").ElementType<any> | undefined;
6
6
  } & {
@@ -8,16 +8,3 @@ declare const StyledRectButton: import("@emotion/native").StyledComponent<import
8
8
  }, {}, {
9
9
  ref?: import("react").Ref<TouchableOpacity> | undefined;
10
10
  }>;
11
- declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
12
- theme?: import("@emotion/react").Theme | undefined;
13
- as?: import("react").ElementType<any> | undefined;
14
- }, {}, {
15
- ref?: import("react").Ref<View> | undefined;
16
- }>;
17
- declare const StyledContent: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<View>> & {
18
- children?: import("react").ReactNode;
19
- } & {
20
- theme?: import("@emotion/react").Theme | undefined;
21
- as?: import("react").ElementType<any> | undefined;
22
- }, {}, {}>;
23
- export { StyledRectButton, StyledWrapper, StyledContent };
@@ -1,5 +1,5 @@
1
+ import { ReactNode } from 'react';
1
2
  import { StyleProp, ViewStyle } from 'react-native';
2
- import { IconName } from '../Icon';
3
3
  import { ActionIntent } from './StyledSwipeable';
4
4
  export interface SwipeableActionProps {
5
5
  /**
@@ -10,6 +10,10 @@ export interface SwipeableActionProps {
10
10
  * Callback when the action button is pressed.
11
11
  */
12
12
  onPress?: () => void;
13
+ /**
14
+ * Action button's content
15
+ */
16
+ children?: ReactNode;
13
17
  /**
14
18
  * Additional style.
15
19
  */
@@ -18,14 +22,6 @@ export interface SwipeableActionProps {
18
22
  * Testing id of the component.
19
23
  */
20
24
  testID?: string;
21
- /**
22
- * Name of the Icon.
23
- */
24
- icon: IconName;
25
- /**
26
- * Action label of the component.
27
- */
28
- label: string;
29
25
  }
30
- declare const SwipeableAction: ({ intent, onPress, style, testID, label, icon, }: SwipeableActionProps) => JSX.Element;
26
+ declare const SwipeableAction: ({ intent, onPress, style, children, testID, }: SwipeableActionProps) => JSX.Element;
31
27
  export default SwipeableAction;
@@ -1,28 +1,45 @@
1
- import React from 'react';
2
- import { GestureResponderEvent, PanResponderGestureState, StyleProp, ViewStyle } from 'react-native';
3
- import SwipeableAction from './SwipeableAction';
4
- export declare type SwipeState = 'closed' | 'leftOpen' | 'rightOpen';
5
- export declare type SwipeableProps = {
6
- leftContent?: React.ReactNode;
7
- rightContent?: React.ReactNode;
8
- leftActions?: [typeof SwipeableAction][];
9
- rightActions?: [typeof SwipeableAction][];
10
- onSwipeLeftStart?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
11
- onSwipeLeftEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { Swipeable as RnghSwipeable, RectButton } from 'react-native-gesture-handler';
3
+ declare type State = 'closed' | 'leftOpen' | 'rightOpen';
4
+ declare type RnghSwipeableProps = ComponentProps<typeof RnghSwipeable>;
5
+ export interface SwipeableProps extends Pick<RnghSwipeableProps, 'enableTrackpadTwoFingerGesture' | 'friction' | 'leftThreshold' | 'rightThreshold' | 'overshootLeft' | 'overshootRight' | 'overshootFriction' | 'useNativeAnimations' | 'containerStyle' | 'childrenContainerStyle'> {
6
+ /**
7
+ * React node that is swipeable.
8
+ */
9
+ children: ReactNode;
10
+ /**
11
+ * State of the component.
12
+ */
13
+ state?: 'closed' | 'leftOpen' | 'rightOpen';
14
+ /**
15
+ * Callback when the state of the component changes.
16
+ */
17
+ onStateChange?: (state: State) => void;
18
+ /**
19
+ * Action panel that is going to be revealed from the left side when user swipes right.
20
+ */
21
+ leftActions?: ReactNode;
22
+ /**
23
+ * Width of the left action panel.
24
+ * By default, it will take up the whole width of the device.
25
+ */
12
26
  leftActionsWidth?: number;
27
+ /**
28
+ * Action panel that is going to be revealed from the right side when user swipes left.
29
+ */
30
+ rightActions?: ReactNode;
31
+ /**
32
+ * Width of the right action panel.
33
+ * By default, it will take up the whole width of the device.
34
+ */
13
35
  rightActionsWidth?: number;
14
- onStateChange?: (state: SwipeState) => void;
15
- onSwipeRightStart?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
16
- onSwipeRightEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
17
- leftButtonWidth?: number;
18
- rightButtonWidth?: number;
19
- swipeState?: SwipeState;
20
- style?: StyleProp<ViewStyle>;
21
- children: React.ReactNode;
22
- };
23
- declare const _default: React.NamedExoticComponent<SwipeableProps> & {
24
- readonly type: ({ children, leftActions, leftContent, rightActions, rightContent, style, leftActionsWidth, leftButtonWidth, onSwipeLeftStart, onSwipeLeftEnd, rightActionsWidth, rightButtonWidth, onSwipeRightStart, onSwipeRightEnd, swipeState, onStateChange, ...rest }: SwipeableProps) => JSX.Element;
25
- } & {
26
- Action: ({ intent, onPress, style, testID, label, icon, }: import("./SwipeableAction").SwipeableActionProps) => JSX.Element;
36
+ /**
37
+ * Testing ID of the component
38
+ */
39
+ testID?: string;
40
+ }
41
+ declare const _default: (({ children, state, onStateChange, leftActions, leftActionsWidth, rightActions, rightActionsWidth, ...swipeableProps }: SwipeableProps) => JSX.Element) & {
42
+ Action: ({ intent, onPress, style, children, testID, }: import("./SwipeableAction").SwipeableActionProps) => JSX.Element;
43
+ Content: typeof RectButton;
27
44
  };
28
45
  export default _default;
@@ -0,0 +1,15 @@
1
+ import { Animated, View } from 'react-native';
2
+ export declare type ActionIntent = 'primary' | 'success' | 'danger';
3
+ declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
4
+ theme?: import("@emotion/react").Theme | undefined;
5
+ as?: import("react").ElementType<any> | undefined;
6
+ }, {}, {
7
+ ref?: import("react").Ref<View> | undefined;
8
+ }>;
9
+ declare const StyledContent: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<View>> & {
10
+ children?: import("react").ReactNode;
11
+ } & {
12
+ theme?: import("@emotion/react").Theme | undefined;
13
+ as?: import("react").ElementType<any> | undefined;
14
+ }, {}, {}>;
15
+ export { StyledWrapper, StyledContent };
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { GestureResponderEvent, PanResponderGestureState, StyleProp, ViewStyle } from 'react-native';
3
+ export declare type SwipeableV2Props = {
4
+ /**
5
+ * Content panel that is going to be revealed from the left side when user swipes right.
6
+ */
7
+ leftContent?: React.ReactNode;
8
+ /**
9
+ * Content panel that is going to be revealed from the right side when user swipes left.
10
+ */
11
+ rightContent?: React.ReactNode;
12
+ /**
13
+ * If the user swipe a distance greater than this value, the callback onSwipeRightEnd is called.
14
+ */
15
+ leftActionsWidth?: number;
16
+ /**
17
+ * If the user swipe a distance greater than this value, the callback onSwipeLeftEnd is called.
18
+ */
19
+ rightActionsWidth?: number;
20
+ /**
21
+ * Callback when start swiping to left.
22
+ */
23
+ onSwipeLeftStart?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
24
+ /**
25
+ * Callback when end swiping to left.
26
+ */
27
+ onSwipeLeftEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
28
+ /**
29
+ * Callback when start swiping to right.
30
+ */
31
+ onSwipeRightStart?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
32
+ /**
33
+ * Callback when end swiping to right.
34
+ */
35
+ onSwipeRightEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => void;
36
+ /**
37
+ * additional styles
38
+ */
39
+ style?: StyleProp<ViewStyle>;
40
+ /**
41
+ * React node that is swipeable.
42
+ */
43
+ children: React.ReactNode;
44
+ };
45
+ declare const SwipeableV2: ({ children, leftContent, rightContent, style, leftActionsWidth, onSwipeLeftStart, onSwipeLeftEnd, rightActionsWidth, onSwipeRightStart, onSwipeRightEnd, ...rest }: SwipeableV2Props) => JSX.Element;
46
+ export default SwipeableV2;
@@ -1,11 +1,12 @@
1
1
  import type { ReactNode } from 'react';
2
- export interface ToolbarProps {
2
+ import { ViewProps } from 'react-native';
3
+ export interface ToolbarProps extends Omit<ViewProps, 'style'> {
3
4
  /**
4
5
  * Toolbar's content.
5
6
  */
6
7
  children?: ReactNode;
7
8
  }
8
- declare const _default: (({ children }: ToolbarProps) => JSX.Element) & {
9
+ declare const _default: (({ children, ...rest }: ToolbarProps) => JSX.Element) & {
9
10
  Group: ({ align, items }: import("./ToolbarGroup").ToolbarGroupProps) => JSX.Element;
10
11
  };
11
12
  export default _default;
package/types/index.d.ts CHANGED
@@ -28,6 +28,7 @@ import Progress from './components/Progress';
28
28
  import Slider from './components/Slider';
29
29
  import Spinner from './components/Spinner';
30
30
  import Swipeable from './components/Swipeable';
31
+ import SwipeableV2 from './components/SwipeableV2';
31
32
  import Radio from './components/Radio';
32
33
  import SectionHeading from './components/SectionHeading';
33
34
  import Select from './components/Select';
@@ -41,5 +42,5 @@ import Toolbar from './components/Toolbar';
41
42
  import Typography from './components/Typography';
42
43
  import RefreshControl from './components/RefreshControl';
43
44
  import RichTextEditor from './components/RichTextEditor';
44
- export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, swagSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, Image, List, PinInput, Progress, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RefreshControl, RichTextEditor, };
45
+ export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, swagSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, Image, List, PinInput, Progress, Slider, Spinner, Swipeable, SwipeableV2, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RefreshControl, RichTextEditor, };
45
46
  export * from './types';
@@ -1,65 +0,0 @@
1
- import React from 'react';
2
- import { Animated, StyleProp, StyleSheet, ViewStyle } from 'react-native';
3
-
4
- type Props = {
5
- buttons?: React.ReactNode[];
6
- isLeftButtons: boolean;
7
- leftButtonContainerStyle?: StyleProp<ViewStyle>;
8
- rightButtonContainerStyle?: StyleProp<ViewStyle>;
9
- panAnimatedValue: Animated.ValueXY;
10
- width: number;
11
- canSwipeLeft?: boolean;
12
- canSwipeRight?: boolean;
13
- buttonWidth: number;
14
- };
15
-
16
- const Buttons = ({
17
- buttons,
18
- isLeftButtons,
19
- leftButtonContainerStyle,
20
- rightButtonContainerStyle,
21
- panAnimatedValue,
22
- width,
23
- canSwipeLeft,
24
- canSwipeRight,
25
- buttonWidth,
26
- }: Props): JSX.Element => {
27
- const count = buttons?.length ?? 0;
28
- const leftEnd = canSwipeLeft ? -width : 0;
29
- const rightEnd = canSwipeRight ? width : 0;
30
- const inputRange = isLeftButtons ? [0, rightEnd] : [leftEnd, 0];
31
-
32
- return (
33
- <>
34
- {buttons?.map((buttonContent, index) => {
35
- const outputMultiplier = -index / count;
36
- const outputRange = isLeftButtons
37
- ? [0, rightEnd * outputMultiplier]
38
- : [leftEnd * outputMultiplier, 0];
39
-
40
- const transform = [
41
- {
42
- translateX: panAnimatedValue.x.interpolate({
43
- inputRange,
44
- outputRange,
45
- extrapolate: 'clamp',
46
- }),
47
- },
48
- ];
49
- const buttonStyle = [
50
- StyleSheet.absoluteFill,
51
- { width: buttonWidth, transform },
52
- isLeftButtons ? leftButtonContainerStyle : rightButtonContainerStyle,
53
- ];
54
-
55
- return (
56
- <Animated.View key={index} style={buttonStyle}>
57
- {buttonContent}
58
- </Animated.View>
59
- );
60
- })}
61
- </>
62
- );
63
- };
64
-
65
- export default Buttons;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { Animated, StyleProp, ViewStyle } from 'react-native';
3
- declare type Props = {
4
- buttons?: React.ReactNode[];
5
- isLeftButtons: boolean;
6
- leftButtonContainerStyle?: StyleProp<ViewStyle>;
7
- rightButtonContainerStyle?: StyleProp<ViewStyle>;
8
- panAnimatedValue: Animated.ValueXY;
9
- width: number;
10
- canSwipeLeft?: boolean;
11
- canSwipeRight?: boolean;
12
- buttonWidth: number;
13
- };
14
- declare const Buttons: ({ buttons, isLeftButtons, leftButtonContainerStyle, rightButtonContainerStyle, panAnimatedValue, width, canSwipeLeft, canSwipeRight, buttonWidth, }: Props) => JSX.Element;
15
- export default Buttons;