@ovotech/element-native 3.8.0 → 3.8.1-canary-a8563d8-232

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 (162) hide show
  1. package/dist/components/Accordion/Accordion.js +4 -9
  2. package/dist/components/Accordion/styles.d.ts +1225 -484
  3. package/dist/components/Accordion/styles.js +4 -3
  4. package/dist/components/ActionCard/ActionCard.js +4 -3
  5. package/dist/components/ActionList/ActionList.d.ts +1 -1
  6. package/dist/components/ActionList/ActionList.js +2 -1
  7. package/dist/components/ActionList/styled.d.ts +2502 -1020
  8. package/dist/components/ActionList/styled.js +6 -5
  9. package/dist/components/Badge/Badge.d.ts +408 -161
  10. package/dist/components/Badge/Badge.js +3 -2
  11. package/dist/components/CTAButton/CTAButton.js +7 -6
  12. package/dist/components/Card/Card.d.ts +410 -161
  13. package/dist/components/Card/Card.js +5 -4
  14. package/dist/components/Checkbox/Checkbox.js +4 -3
  15. package/dist/components/DataTable/styles.d.ts +5472 -2261
  16. package/dist/components/DataTable/styles.js +14 -15
  17. package/dist/components/DateField/DateField.js +4 -3
  18. package/dist/components/DescriptionList/styled.d.ts +407 -160
  19. package/dist/components/DescriptionList/styled.js +5 -4
  20. package/dist/components/Disclosure/Disclosure.js +4 -3
  21. package/dist/components/Em/Em.d.ts +407 -160
  22. package/dist/components/ErrorText/ErrorText.d.ts +407 -160
  23. package/dist/components/ErrorText/ErrorText.js +2 -3
  24. package/dist/components/FilterSelect/FilterSelect.js +5 -4
  25. package/dist/components/Grid/Col.d.ts +407 -160
  26. package/dist/components/Grid/Col.js +3 -3
  27. package/dist/components/Grid/Row.d.ts +407 -160
  28. package/dist/components/Grid/Row.js +4 -4
  29. package/dist/components/Heading1/Heading1.d.ts +3 -1
  30. package/dist/components/Heading1/Heading1.js +6 -4
  31. package/dist/components/Heading2/Heading2.d.ts +3 -1
  32. package/dist/components/Heading2/Heading2.js +6 -4
  33. package/dist/components/Heading3/Heading3.d.ts +3 -1
  34. package/dist/components/Heading3/Heading3.js +6 -4
  35. package/dist/components/Heading4/Heading4.d.ts +3 -1
  36. package/dist/components/Heading4/Heading4.js +6 -4
  37. package/dist/components/HintText/HintText.d.ts +407 -160
  38. package/dist/components/HintText/HintText.js +2 -3
  39. package/dist/components/Input/Input.js +7 -4
  40. package/dist/components/Label/Label.d.ts +5 -241
  41. package/dist/components/Label/Label.js +17 -4
  42. package/dist/components/LabelText/LabelText.d.ts +407 -160
  43. package/dist/components/LabelText/LabelText.js +2 -1
  44. package/dist/components/Lead/Lead.d.ts +5 -241
  45. package/dist/components/Lead/Lead.js +19 -4
  46. package/dist/components/LineThrough/LineThrough.d.ts +407 -160
  47. package/dist/components/List/styled.d.ts +1636 -648
  48. package/dist/components/List/styled.js +4 -4
  49. package/dist/components/Margin/Margin.d.ts +408 -162
  50. package/dist/components/Margin/Margin.js +2 -3
  51. package/dist/components/NavHeader/NavHeader.d.ts +10 -2
  52. package/dist/components/NavHeader/NavHeader.js +25 -29
  53. package/dist/components/NavHeader/NavHeader.styles.d.ts +3845 -1387
  54. package/dist/components/NavHeader/NavHeader.styles.js +18 -17
  55. package/dist/components/Notification/Notification.d.ts +816 -322
  56. package/dist/components/Notification/Notification.js +18 -15
  57. package/dist/components/P/P.d.ts +2 -0
  58. package/dist/components/P/P.js +3 -2
  59. package/dist/components/PasswordInput/PasswordInput.styled.d.ts +407 -160
  60. package/dist/components/PasswordInput/PasswordInput.styled.js +2 -1
  61. package/dist/components/{HorizontalCarousel/HorizontalCarousel.d.ts → ProductCarousel/ProductCarousel.d.ts} +2 -2
  62. package/dist/components/ProductCarousel/ProductCarousel.js +128 -0
  63. package/dist/components/ProductCarousel/anchor-point.d.ts +10 -0
  64. package/dist/components/ProductCarousel/anchor-point.js +53 -0
  65. package/dist/components/ProductCarousel/index.d.ts +1 -0
  66. package/dist/components/ProductCarousel/index.js +5 -0
  67. package/dist/components/Radio/Radio.js +5 -4
  68. package/dist/components/RadioCard/RadioCard.d.ts +9 -0
  69. package/dist/components/RadioCard/RadioCard.js +72 -0
  70. package/dist/components/RadioCard/index.d.ts +1 -0
  71. package/dist/components/RadioCard/index.js +5 -0
  72. package/dist/components/SelectField/Select.d.ts +407 -160
  73. package/dist/components/SelectField/Select.js +8 -7
  74. package/dist/components/SkeletonCTA/SkeletonCTA.js +2 -1
  75. package/dist/components/SkeletonCircle/SkeletonCircle.js +2 -2
  76. package/dist/components/SkeletonText/SkeletonText.js +4 -1
  77. package/dist/components/Small/Small.d.ts +407 -160
  78. package/dist/components/Small/Small.js +2 -1
  79. package/dist/components/Stack/Stack.d.ts +1 -2
  80. package/dist/components/Stack/Stack.js +2 -1
  81. package/dist/components/Strong/Strong.d.ts +407 -160
  82. package/dist/components/SubLabelText/SubLabelText.d.ts +407 -160
  83. package/dist/components/SubLabelText/SubLabelText.js +2 -1
  84. package/dist/components/Tabs/Tab.js +8 -7
  85. package/dist/components/Tabs/TabList.js +2 -1
  86. package/dist/components/Tabs/TabPanel.js +2 -1
  87. package/dist/components/Tabs/Tabs.js +2 -1
  88. package/dist/components/TextareaInput/TextareaInput.js +2 -2
  89. package/dist/components/Toast/Toast.js +3 -2
  90. package/dist/components/Toggle/Toggle.js +2 -2
  91. package/dist/components/Toggle/styles.d.ts +1638 -650
  92. package/dist/components/Toggle/styles.js +5 -4
  93. package/dist/components/index.d.ts +2 -0
  94. package/dist/components/index.js +2 -0
  95. package/dist/esm/components/Accordion/Accordion.js +4 -9
  96. package/dist/esm/components/Accordion/styles.js +4 -3
  97. package/dist/esm/components/ActionCard/ActionCard.js +4 -3
  98. package/dist/esm/components/ActionList/ActionList.js +2 -1
  99. package/dist/esm/components/ActionList/styled.js +6 -5
  100. package/dist/esm/components/Badge/Badge.js +3 -2
  101. package/dist/esm/components/CTAButton/CTAButton.js +7 -6
  102. package/dist/esm/components/Card/Card.js +5 -4
  103. package/dist/esm/components/Checkbox/Checkbox.js +4 -3
  104. package/dist/esm/components/DataTable/styles.js +14 -15
  105. package/dist/esm/components/DateField/DateField.js +4 -3
  106. package/dist/esm/components/DescriptionList/styled.js +5 -4
  107. package/dist/esm/components/Disclosure/Disclosure.js +4 -3
  108. package/dist/esm/components/ErrorText/ErrorText.js +2 -3
  109. package/dist/esm/components/FilterSelect/FilterSelect.js +5 -4
  110. package/dist/esm/components/Grid/Col.js +3 -3
  111. package/dist/esm/components/Grid/Row.js +4 -4
  112. package/dist/esm/components/Heading1/Heading1.js +5 -3
  113. package/dist/esm/components/Heading2/Heading2.js +5 -3
  114. package/dist/esm/components/Heading3/Heading3.js +5 -3
  115. package/dist/esm/components/Heading4/Heading4.js +5 -3
  116. package/dist/esm/components/HintText/HintText.js +2 -3
  117. package/dist/esm/components/Input/Input.js +7 -4
  118. package/dist/esm/components/Label/Label.js +17 -4
  119. package/dist/esm/components/LabelText/LabelText.js +2 -1
  120. package/dist/esm/components/Lead/Lead.js +19 -4
  121. package/dist/esm/components/List/styled.js +4 -4
  122. package/dist/esm/components/Margin/Margin.js +2 -3
  123. package/dist/esm/components/NavHeader/NavHeader.js +26 -30
  124. package/dist/esm/components/NavHeader/NavHeader.styles.js +17 -16
  125. package/dist/esm/components/Notification/Notification.js +18 -15
  126. package/dist/esm/components/P/P.js +3 -2
  127. package/dist/esm/components/PasswordInput/PasswordInput.styled.js +2 -1
  128. package/dist/esm/components/ProductCarousel/ProductCarousel.js +98 -0
  129. package/dist/esm/components/ProductCarousel/anchor-point.js +49 -0
  130. package/dist/esm/components/ProductCarousel/index.js +1 -0
  131. package/dist/esm/components/Radio/Radio.js +5 -4
  132. package/dist/esm/components/RadioCard/RadioCard.js +66 -0
  133. package/dist/esm/components/RadioCard/index.js +1 -0
  134. package/dist/esm/components/SelectField/Select.js +8 -7
  135. package/dist/esm/components/SkeletonCTA/SkeletonCTA.js +2 -1
  136. package/dist/esm/components/SkeletonCircle/SkeletonCircle.js +1 -1
  137. package/dist/esm/components/SkeletonText/SkeletonText.js +4 -1
  138. package/dist/esm/components/Small/Small.js +2 -1
  139. package/dist/esm/components/Stack/Stack.js +2 -1
  140. package/dist/esm/components/SubLabelText/SubLabelText.js +2 -1
  141. package/dist/esm/components/Tabs/Tab.js +9 -8
  142. package/dist/esm/components/Tabs/TabList.js +2 -1
  143. package/dist/esm/components/Tabs/TabPanel.js +2 -1
  144. package/dist/esm/components/Tabs/Tabs.js +2 -1
  145. package/dist/esm/components/TextareaInput/TextareaInput.js +2 -2
  146. package/dist/esm/components/Toast/Toast.js +3 -2
  147. package/dist/esm/components/Toggle/Toggle.js +2 -2
  148. package/dist/esm/components/Toggle/styles.js +5 -4
  149. package/dist/esm/components/index.js +2 -0
  150. package/dist/esm/utils/utils.js +1 -7
  151. package/dist/styled.native.d.ts +2523 -1041
  152. package/dist/utils/utils.d.ts +1 -3
  153. package/dist/utils/utils.js +1 -9
  154. package/package.json +5 -4
  155. package/dist/components/HorizontalCarousel/HorizontalCarousel.js +0 -92
  156. package/dist/components/HorizontalCarousel/index.d.ts +0 -1
  157. package/dist/components/HorizontalCarousel/index.js +0 -17
  158. package/dist/esm/components/HorizontalCarousel/HorizontalCarousel.js +0 -62
  159. package/dist/esm/components/HorizontalCarousel/index.js +0 -1
  160. /package/dist/components/{HorizontalCarousel → ProductCarousel}/NavigationDots.d.ts +0 -0
  161. /package/dist/components/{HorizontalCarousel → ProductCarousel}/NavigationDots.js +0 -0
  162. /package/dist/esm/components/{HorizontalCarousel → ProductCarousel}/NavigationDots.js +0 -0
@@ -3,8 +3,6 @@ import { ViewProps, View } from 'react-native';
3
3
  import { BreakpointNames, Breakpoints } from '../hooks';
4
4
  declare function mergeRefs<T>(ref1: undefined | Ref<T>, ref2: undefined | Ref<T>): (element: T) => void;
5
5
  declare function getText(children: ReactNode): string;
6
- declare function pxToNumber(px: string): number;
7
- declare function numToPx(num: number): string;
8
6
  declare function styledComponentWithBreakpoints<T = ViewProps, C = View>(Component: ComponentType<T>): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Omit<T, BreakpointNames>> & import("react").RefAttributes<C>>;
9
7
  declare function responsiveStyle(property: string, value: any, breakpoints: Breakpoints, formatter?: (v: any) => string): any;
10
8
  declare function getErrorMessage(id: string, errors: Array<{
@@ -13,4 +11,4 @@ declare function getErrorMessage(id: string, errors: Array<{
13
11
  }>): null | ReactNode;
14
12
  declare function callAll(...fns: Array<Function | undefined>): (...args: any[]) => void;
15
13
  declare function filterChildrenByType(children: ReactNode, type: ComponentType): ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
16
- export { styledComponentWithBreakpoints, responsiveStyle, pxToNumber, numToPx, mergeRefs, getText, getErrorMessage, callAll, filterChildrenByType, };
14
+ export { styledComponentWithBreakpoints, responsiveStyle, mergeRefs, getText, getErrorMessage, callAll, filterChildrenByType, };
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.filterChildrenByType = exports.callAll = exports.getErrorMessage = exports.getText = exports.mergeRefs = exports.numToPx = exports.pxToNumber = exports.responsiveStyle = exports.styledComponentWithBreakpoints = void 0;
14
+ exports.filterChildrenByType = exports.callAll = exports.getErrorMessage = exports.getText = exports.mergeRefs = exports.responsiveStyle = exports.styledComponentWithBreakpoints = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_1 = require("react");
17
17
  var hooks_1 = require("../hooks");
@@ -43,14 +43,6 @@ function getText(children) {
43
43
  return String(children);
44
44
  }
45
45
  exports.getText = getText;
46
- function pxToNumber(px) {
47
- return parseFloat(px);
48
- }
49
- exports.pxToNumber = pxToNumber;
50
- function numToPx(num) {
51
- return "".concat(num, "px");
52
- }
53
- exports.numToPx = numToPx;
54
46
  function styledComponentWithBreakpoints(Component) {
55
47
  return (0, react_1.forwardRef)(function (props, ref) {
56
48
  var breakpoints = (0, hooks_1.useBreakpoint)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovotech/element-native",
3
- "version": "3.8.0",
3
+ "version": "3.8.1-canary-a8563d8-232",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,9 +14,10 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@backpackapp-io/react-native-toast": "^0.10.0",
17
- "@ovotech/element-core": "^2.2.0",
17
+ "@ovotech/element-core": "*-canary-a8563d8-232",
18
18
  "deepmerge": "^4.2.2",
19
- "lodash.groupby": "^4.6.0"
19
+ "lodash.groupby": "^4.6.0",
20
+ "react-native-reanimated-carousel": "^3.5.1"
20
21
  },
21
22
  "devDependencies": {
22
23
  "@babel/core": "^7.11.5",
@@ -45,7 +46,7 @@
45
46
  "react-native-reanimated": "^2.10.0",
46
47
  "react-native-safe-area-context": "^4.7.4",
47
48
  "react-native-svg": "9.2.4",
48
- "react-router-dom": "^5.1.2",
49
+ "react-router-dom": "^6.0.0",
49
50
  "react-test-renderer": "^18.2.0",
50
51
  "styled-components": "^5.1.3",
51
52
  "ts-jest": "^28.0.5",
@@ -1,92 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.HorizontalCarousel = void 0;
45
- var jsx_runtime_1 = require("react/jsx-runtime");
46
- var react_1 = require("react");
47
- var react_native_1 = require("react-native");
48
- var react_native_reanimated_1 = require("react-native-reanimated");
49
- var react_native_reanimated_carousel_1 = __importDefault(require("react-native-reanimated-carousel"));
50
- var styled_native_1 = __importStar(require("../../styled.native"));
51
- var Icon_1 = require("../Icon");
52
- var NavigationDots_1 = require("./NavigationDots");
53
- function HorizontalCarousel(_a) {
54
- var data = _a.data, children = _a.children, width = _a.width, height = _a.height, fullWidth = _a.fullWidth, _b = _a.showArrows, showArrows = _b === void 0 ? true : _b, _c = _a.showDots, showDots = _c === void 0 ? true : _c, _d = _a.loop, loop = _d === void 0 ? true : _d, arrowsDistanceFromTop = _a.arrowsDistanceFromTop;
55
- var theme = (0, styled_native_1.useTheme)();
56
- var carouselRef = (0, react_1.useRef)(null);
57
- var progressValue = (0, react_native_reanimated_1.useSharedValue)(0);
58
- var windowWidth = (0, react_native_1.useWindowDimensions)().width;
59
- var carouselWidth = fullWidth ? windowWidth : width || windowWidth;
60
- return ((0, jsx_runtime_1.jsxs)(SCarouselContainer, { children: [(0, jsx_runtime_1.jsx)(react_native_reanimated_carousel_1.default, { ref: carouselRef, data: data, renderItem: function (_a) {
61
- var item = _a.item;
62
- return ((0, jsx_runtime_1.jsx)(SItemContainer, __assign({ "$itemWidth": carouselWidth }, { children: children(item) })));
63
- }, vertical: false, width: carouselWidth, height: height, onProgressChange: function (_, absoluteProgress) {
64
- return (progressValue.value = absoluteProgress);
65
- }, panGestureHandlerProps: {
66
- activeOffsetX: [-20, 20],
67
- }, loop: loop, testID: "carousel" }), showArrows && data.length > 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SActionPressable, __assign({ onPress: function () { var _a; return (_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.prev(); }, "$top": arrowsDistanceFromTop, hitSlop: {
68
- top: 32,
69
- bottom: 32,
70
- left: 16,
71
- right: 16,
72
- } }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "arrow-left", size: 16, color: theme.core.color.brand.white }) })), (0, jsx_runtime_1.jsx)(SActionPressable, __assign({ "$next": true, onPress: function () { var _a; return (_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.next(); }, "$top": arrowsDistanceFromTop, hitSlop: {
73
- top: 32,
74
- bottom: 32,
75
- left: 16,
76
- right: 16,
77
- } }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "arrow-right", size: 16, color: theme.core.color.brand.white }) }))] })), showDots && data.length > 1 && ((0, jsx_runtime_1.jsx)(NavigationDots_1.NavigationDots, { data: data, animatedValue: progressValue }))] }));
78
- }
79
- exports.HorizontalCarousel = HorizontalCarousel;
80
- var SCarouselContainer = styled_native_1.default.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n"], ["\n align-items: center;\n"])));
81
- var SItemContainer = styled_native_1.default.View(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n width: ", "px;\n height: 100%;\n justify-content: center;\n align-items: center;\n"], ["\n position: relative;\n width: ", "px;\n height: 100%;\n justify-content: center;\n align-items: center;\n"])), function (_a) {
82
- var $itemWidth = _a.$itemWidth;
83
- return $itemWidth;
84
- });
85
- var SActionPressable = styled_native_1.default.Pressable(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: ", ";\n ", ";\n"], ["\n position: absolute;\n top: ", ";\n ", ";\n"])), function (_a) {
86
- var $top = _a.$top;
87
- return ($top ? "".concat($top, "px") : '50%');
88
- }, function (_a) {
89
- var theme = _a.theme, $next = _a.$next;
90
- return $next ? "right: ".concat(theme.core.space[6]) : "left: ".concat(theme.core.space[6]);
91
- });
92
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1 +0,0 @@
1
- export * from './HorizontalCarousel';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./HorizontalCarousel"), exports);
@@ -1,62 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
- import { useRef } from 'react';
18
- import { useWindowDimensions } from 'react-native';
19
- import { useSharedValue } from 'react-native-reanimated';
20
- import Carousel from 'react-native-reanimated-carousel';
21
- import styled, { useTheme } from '../../styled.native';
22
- import { Icon } from '../Icon';
23
- import { NavigationDots } from './NavigationDots';
24
- export function HorizontalCarousel(_a) {
25
- var data = _a.data, children = _a.children, width = _a.width, height = _a.height, fullWidth = _a.fullWidth, _b = _a.showArrows, showArrows = _b === void 0 ? true : _b, _c = _a.showDots, showDots = _c === void 0 ? true : _c, _d = _a.loop, loop = _d === void 0 ? true : _d, arrowsDistanceFromTop = _a.arrowsDistanceFromTop;
26
- var theme = useTheme();
27
- var carouselRef = useRef(null);
28
- var progressValue = useSharedValue(0);
29
- var windowWidth = useWindowDimensions().width;
30
- var carouselWidth = fullWidth ? windowWidth : width || windowWidth;
31
- return (_jsxs(SCarouselContainer, { children: [_jsx(Carousel, { ref: carouselRef, data: data, renderItem: function (_a) {
32
- var item = _a.item;
33
- return (_jsx(SItemContainer, __assign({ "$itemWidth": carouselWidth }, { children: children(item) })));
34
- }, vertical: false, width: carouselWidth, height: height, onProgressChange: function (_, absoluteProgress) {
35
- return (progressValue.value = absoluteProgress);
36
- }, panGestureHandlerProps: {
37
- activeOffsetX: [-20, 20],
38
- }, loop: loop, testID: "carousel" }), showArrows && data.length > 1 && (_jsxs(_Fragment, { children: [_jsx(SActionPressable, __assign({ onPress: function () { var _a; return (_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.prev(); }, "$top": arrowsDistanceFromTop, hitSlop: {
39
- top: 32,
40
- bottom: 32,
41
- left: 16,
42
- right: 16,
43
- } }, { children: _jsx(Icon, { name: "arrow-left", size: 16, color: theme.core.color.brand.white }) })), _jsx(SActionPressable, __assign({ "$next": true, onPress: function () { var _a; return (_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.next(); }, "$top": arrowsDistanceFromTop, hitSlop: {
44
- top: 32,
45
- bottom: 32,
46
- left: 16,
47
- right: 16,
48
- } }, { children: _jsx(Icon, { name: "arrow-right", size: 16, color: theme.core.color.brand.white }) }))] })), showDots && data.length > 1 && (_jsx(NavigationDots, { data: data, animatedValue: progressValue }))] }));
49
- }
50
- var SCarouselContainer = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n"], ["\n align-items: center;\n"])));
51
- var SItemContainer = styled.View(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n width: ", "px;\n height: 100%;\n justify-content: center;\n align-items: center;\n"], ["\n position: relative;\n width: ", "px;\n height: 100%;\n justify-content: center;\n align-items: center;\n"])), function (_a) {
52
- var $itemWidth = _a.$itemWidth;
53
- return $itemWidth;
54
- });
55
- var SActionPressable = styled.Pressable(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: ", ";\n ", ";\n"], ["\n position: absolute;\n top: ", ";\n ", ";\n"])), function (_a) {
56
- var $top = _a.$top;
57
- return ($top ? "".concat($top, "px") : '50%');
58
- }, function (_a) {
59
- var theme = _a.theme, $next = _a.$next;
60
- return $next ? "right: ".concat(theme.core.space[6]) : "left: ".concat(theme.core.space[6]);
61
- });
62
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1 +0,0 @@
1
- export * from './HorizontalCarousel';