@draftbit/core 46.8.1-c1d8e9.2 → 46.8.1-d78af9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +38 -4
  2. package/lib/commonjs/index.js +0 -7
  3. package/lib/module/components/DeckSwiper/DeckSwiper.js +38 -4
  4. package/lib/module/components/DeprecatedButton.js +3 -21
  5. package/lib/module/index.js +0 -1
  6. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +8 -2
  7. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
  8. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +2 -3
  9. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
  10. package/lib/typescript/src/index.d.ts +0 -1
  11. package/lib/typescript/src/index.d.ts.map +1 -1
  12. package/package.json +3 -4
  13. package/src/components/DeckSwiper/DeckSwiper.js +33 -3
  14. package/src/components/DeckSwiper/DeckSwiper.tsx +51 -9
  15. package/src/components/DeckSwiper/DeckSwiperCard.js +1 -1
  16. package/src/components/DeckSwiper/DeckSwiperCard.tsx +3 -6
  17. package/src/index.js +0 -1
  18. package/src/index.tsx +0 -2
  19. package/lib/commonjs/components/Markdown.js +0 -30
  20. package/lib/commonjs/mappings/Markdown.js +0 -27
  21. package/lib/module/components/Markdown.js +0 -20
  22. package/lib/module/mappings/Markdown.js +0 -20
  23. package/lib/typescript/src/components/Markdown.d.ts +0 -8
  24. package/lib/typescript/src/components/Markdown.d.ts.map +0 -1
  25. package/lib/typescript/src/mappings/Markdown.d.ts +0 -20
  26. package/lib/typescript/src/mappings/Markdown.d.ts.map +0 -1
  27. package/src/components/Markdown.js +0 -10
  28. package/src/components/Markdown.tsx +0 -22
  29. package/src/mappings/Markdown.js +0 -20
  30. package/src/mappings/Markdown.ts +0 -27
@@ -17,13 +17,47 @@ const DeckSwiper = _ref => {
17
17
  verticalEnabled = true,
18
18
  horizontalEnabled = true,
19
19
  visibleCardCount = 1,
20
+ data,
21
+ keyExtractor,
22
+ renderItem,
20
23
  style,
21
24
  children
22
25
  } = _ref;
26
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
27
+ if (data && !renderItem || renderItem && !data) {
28
+ throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
29
+ }
30
+ if (data && renderItem && children) {
31
+ console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
32
+ }
23
33
  const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
24
34
 
25
35
  // an array of indices based on children count
26
36
  const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
37
+ const cardsData = data || cardsFillerData;
38
+ const renderCard = (card, index) => {
39
+ if (renderItem) {
40
+ return renderItem({
41
+ item: card,
42
+ index
43
+ });
44
+ } else {
45
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[index]);
46
+ }
47
+ };
48
+ const renderFirstCard = () => {
49
+ if (cardsData.length) {
50
+ return renderCard(cardsData[0], 0);
51
+ }
52
+ return undefined;
53
+ };
54
+ const cardKeyExtractor = card => {
55
+ if (keyExtractor) {
56
+ return keyExtractor(card);
57
+ } else {
58
+ return card.toString();
59
+ }
60
+ };
27
61
 
28
62
  /**
29
63
  * By default react-native-deck-swiper positions everything with absolute position.
@@ -37,10 +71,10 @@ const DeckSwiper = _ref => {
37
71
 
38
72
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
39
73
  style: styles.containerHeightFiller
40
- }, childrenArray.length && childrenArray[0]), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
41
- cards: cardsFillerData,
42
- renderCard: (_, i) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[i]),
43
- keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
74
+ }, renderFirstCard()), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
75
+ cards: cardsData,
76
+ renderCard: renderCard,
77
+ keyExtractor: cardKeyExtractor,
44
78
  containerStyle: _reactNative.StyleSheet.flatten([styles.cardsContainer, style]),
45
79
  cardStyle: styles.card,
46
80
  onSwiped: onIndexChanged,
@@ -177,12 +177,6 @@ Object.defineProperty(exports, "Link", {
177
177
  return _Text.Link;
178
178
  }
179
179
  });
180
- Object.defineProperty(exports, "Markdown", {
181
- enumerable: true,
182
- get: function () {
183
- return _Markdown.default;
184
- }
185
- });
186
180
  Object.defineProperty(exports, "NumberInput", {
187
181
  enumerable: true,
188
182
  get: function () {
@@ -420,7 +414,6 @@ var _Swiper = require("./components/Swiper");
420
414
  var _Layout = require("./components/Layout");
421
415
  var _index = require("./components/RadioButton/index");
422
416
  var _DeckSwiper = require("./components/DeckSwiper");
423
- var _Markdown = _interopRequireDefault(require("./components/Markdown"));
424
417
  var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
425
418
  var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
426
419
  var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
@@ -10,13 +10,47 @@ const DeckSwiper = _ref => {
10
10
  verticalEnabled = true,
11
11
  horizontalEnabled = true,
12
12
  visibleCardCount = 1,
13
+ data,
14
+ keyExtractor,
15
+ renderItem,
13
16
  style,
14
17
  children
15
18
  } = _ref;
19
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
20
+ if (data && !renderItem || renderItem && !data) {
21
+ throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
22
+ }
23
+ if (data && renderItem && children) {
24
+ console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
25
+ }
16
26
  const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
17
27
 
18
28
  // an array of indices based on children count
19
29
  const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
30
+ const cardsData = data || cardsFillerData;
31
+ const renderCard = (card, index) => {
32
+ if (renderItem) {
33
+ return renderItem({
34
+ item: card,
35
+ index
36
+ });
37
+ } else {
38
+ return /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[index]);
39
+ }
40
+ };
41
+ const renderFirstCard = () => {
42
+ if (cardsData.length) {
43
+ return renderCard(cardsData[0], 0);
44
+ }
45
+ return undefined;
46
+ };
47
+ const cardKeyExtractor = card => {
48
+ if (keyExtractor) {
49
+ return keyExtractor(card);
50
+ } else {
51
+ return card.toString();
52
+ }
53
+ };
20
54
 
21
55
  /**
22
56
  * By default react-native-deck-swiper positions everything with absolute position.
@@ -30,10 +64,10 @@ const DeckSwiper = _ref => {
30
64
 
31
65
  return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
32
66
  style: styles.containerHeightFiller
33
- }, childrenArray.length && childrenArray[0]), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
34
- cards: cardsFillerData,
35
- renderCard: (_, i) => /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[i]),
36
- keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
67
+ }, renderFirstCard()), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
68
+ cards: cardsData,
69
+ renderCard: renderCard,
70
+ keyExtractor: cardKeyExtractor,
37
71
  containerStyle: StyleSheet.flatten([styles.cardsContainer, style]),
38
72
  cardStyle: styles.card,
39
73
  onSwiped: onIndexChanged,
@@ -1,3 +1,4 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
2
  import * as React from "react";
2
3
  import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
3
4
  import color from "color";
@@ -74,8 +75,7 @@ const Button = _ref => {
74
75
  elevation,
75
76
  alignSelf: "stretch"
76
77
  }
77
- }, /*#__PURE__*/React.createElement(Pressable, {
78
- ...rest,
78
+ }, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
79
79
  onPress: onPress,
80
80
  accessibilityState: {
81
81
  disabled
@@ -83,7 +83,7 @@ const Button = _ref => {
83
83
  accessibilityRole: "button",
84
84
  disabled: disabled || loading,
85
85
  style: [styles.button, buttonStyle]
86
- }, /*#__PURE__*/React.createElement(View, {
86
+ }), /*#__PURE__*/React.createElement(View, {
87
87
  style: styles.content
88
88
  }, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
89
89
  style: iconStyle
@@ -114,22 +114,4 @@ const styles = StyleSheet.create({
114
114
  width: Config.buttonIconSize
115
115
  }
116
116
  });
117
- export default withTheme(Button);: 1,
118
- style: [textStyle, typography.button]
119
- }, children))));
120
- };
121
- const styles = StyleSheet.create({
122
- button: {
123
- minWidth: 64,
124
- borderStyle: "solid"
125
- },
126
- content: {
127
- flexDirection: "row",
128
- alignItems: "center",
129
- justifyContent: "center"
130
- },
131
- icon: {
132
- width: Config.buttonIconSize
133
- }
134
- });
135
117
  export default withTheme(Button);
@@ -32,7 +32,6 @@ export { Swiper, SwiperItem } from "./components/Swiper";
32
32
  export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
33
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
34
34
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
35
- export { default as Markdown } from "./components/Markdown";
36
35
 
37
36
  /* Deprecated: Fix or Delete! */
38
37
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { StyleProp, ViewStyle } from "react-native";
3
- export interface DeckSwiperProps {
3
+ export interface DeckSwiperProps<T> {
4
4
  onIndexChanged?: (index: number) => void;
5
5
  onEndReached?: () => void;
6
6
  startCardIndex?: number;
@@ -8,8 +8,14 @@ export interface DeckSwiperProps {
8
8
  verticalEnabled?: boolean;
9
9
  horizontalEnabled?: boolean;
10
10
  visibleCardCount?: number;
11
+ data?: Array<T>;
12
+ keyExtractor?: (item: T) => string;
13
+ renderItem?: ({ item, index }: {
14
+ item: T;
15
+ index: number;
16
+ }) => JSX.Element;
11
17
  style?: StyleProp<ViewStyle>;
12
18
  }
13
- declare const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>>;
19
+ declare const DeckSwiper: <T extends object>({ onIndexChanged, onEndReached, startCardIndex, infiniteSwiping, verticalEnabled, horizontalEnabled, visibleCardCount, data, keyExtractor, renderItem, style, children, }: React.PropsWithChildren<DeckSwiperProps<T>>) => JSX.Element;
14
20
  export default DeckSwiper;
15
21
  //# sourceMappingURL=DeckSwiper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA6DlE,CAAC;AAiBF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,2PAoGf,CAAC;AAiBF,eAAe,UAAU,CAAC"}
@@ -3,11 +3,10 @@ import { StyleProp, ViewStyle } from "react-native";
3
3
  import type { Theme } from "../../styles/DefaultTheme";
4
4
  export interface DeckSwiperCardProps {
5
5
  style?: StyleProp<ViewStyle>;
6
- children: React.ReactNode;
7
6
  theme: Theme;
8
7
  }
9
- declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<DeckSwiperCardProps, "theme"> & {
8
+ declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<DeckSwiperCardProps>, "theme"> & {
10
9
  theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
11
- }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<DeckSwiperCardProps> & React.FC<DeckSwiperCardProps>, {}>;
10
+ }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<DeckSwiperCardProps>> & React.FC<React.PropsWithChildren<DeckSwiperCardProps>>, {}>;
12
11
  export default _default;
13
12
  //# sourceMappingURL=DeckSwiperCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA+BD,wBAAyC"}
1
+ {"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA6BD,wBAAyC"}
@@ -32,7 +32,6 @@ export { Swiper, SwiperItem } from "./components/Swiper";
32
32
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
34
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
35
- export { default as Markdown } from "./components/Markdown";
36
35
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
37
36
  export { default as Picker } from "./components/Picker/Picker";
38
37
  export { default as ProgressBar } from "./components/ProgressBar";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OA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O,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.8.1-c1d8e9.2+c1d8e9f",
3
+ "version": "46.8.1-d78af9.2+d78af9a",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.8.1-c1d8e9.2+c1d8e9f",
44
+ "@draftbit/types": "^46.8.1-d78af9.2+d78af9a",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -54,7 +54,6 @@
54
54
  "lodash.omit": "^4.5.0",
55
55
  "lodash.tonumber": "^4.0.3",
56
56
  "react-native-deck-swiper": "^2.0.12",
57
- "react-native-markdown-display": "^7.0.0-alpha.2",
58
57
  "react-native-modal-datetime-picker": "^13.0.0",
59
58
  "react-native-svg": "12.3.0",
60
59
  "react-native-typography": "^1.4.1",
@@ -93,5 +92,5 @@
93
92
  ]
94
93
  ]
95
94
  },
96
- "gitHead": "c1d8e9fc142bf557fb1ae20dff52b8de218703db"
95
+ "gitHead": "d78af9a6345ef51986bcac3f5667917d61582f82"
97
96
  }
@@ -1,10 +1,40 @@
1
1
  import React from "react";
2
2
  import { StyleSheet, View } from "react-native";
3
3
  import DeckSwiperComponent from "react-native-deck-swiper";
4
- const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, style, children, }) => {
4
+ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, data, keyExtractor, renderItem, style, children, }) => {
5
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
6
+ if ((data && !renderItem) || (renderItem && !data)) {
7
+ throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
8
+ }
9
+ if (data && renderItem && children) {
10
+ console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
11
+ }
5
12
  const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
6
13
  // an array of indices based on children count
7
14
  const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
15
+ const cardsData = data || cardsFillerData;
16
+ const renderCard = (card, index) => {
17
+ if (renderItem) {
18
+ return renderItem({ item: card, index });
19
+ }
20
+ else {
21
+ return React.createElement(React.Fragment, null, childrenArray[index]);
22
+ }
23
+ };
24
+ const renderFirstCard = () => {
25
+ if (cardsData.length) {
26
+ return renderCard(cardsData[0], 0);
27
+ }
28
+ return undefined;
29
+ };
30
+ const cardKeyExtractor = (card) => {
31
+ if (keyExtractor) {
32
+ return keyExtractor(card);
33
+ }
34
+ else {
35
+ return card.toString();
36
+ }
37
+ };
8
38
  /**
9
39
  * By default react-native-deck-swiper positions everything with absolute position.
10
40
  * To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
@@ -15,8 +45,8 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
15
45
  * This effectivley makes the default height of the container be the height of the first card.
16
46
  */
17
47
  return (React.createElement(View, null,
18
- React.createElement(View, { style: styles.containerHeightFiller }, childrenArray.length && childrenArray[0]),
19
- React.createElement(DeckSwiperComponent, { cards: cardsFillerData, renderCard: (_, i) => React.createElement(React.Fragment, null, childrenArray[i]), keyExtractor: (card) => card === null || card === void 0 ? void 0 : card.toString(), containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
48
+ React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard()),
49
+ React.createElement(DeckSwiperComponent, { cards: cardsData, renderCard: renderCard, keyExtractor: cardKeyExtractor, containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
20
50
  };
21
51
  const styles = StyleSheet.create({
22
52
  cardsContainer: {
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
3
3
  import DeckSwiperComponent from "react-native-deck-swiper";
4
4
 
5
- export interface DeckSwiperProps {
5
+ export interface DeckSwiperProps<T> {
6
6
  onIndexChanged?: (index: number) => void;
7
7
  onEndReached?: () => void;
8
8
  startCardIndex?: number;
@@ -10,10 +10,13 @@ export interface DeckSwiperProps {
10
10
  verticalEnabled?: boolean;
11
11
  horizontalEnabled?: boolean;
12
12
  visibleCardCount?: number;
13
+ data?: Array<T>;
14
+ keyExtractor?: (item: T) => string;
15
+ renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
13
16
  style?: StyleProp<ViewStyle>;
14
17
  }
15
18
 
16
- const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
19
+ const DeckSwiper = <T extends object>({
17
20
  onIndexChanged,
18
21
  onEndReached,
19
22
  startCardIndex = 0,
@@ -21,9 +24,25 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
21
24
  verticalEnabled = true,
22
25
  horizontalEnabled = true,
23
26
  visibleCardCount = 1,
27
+ data,
28
+ keyExtractor,
29
+ renderItem,
24
30
  style,
25
31
  children,
26
- }) => {
32
+ }: React.PropsWithChildren<DeckSwiperProps<T>>) => {
33
+ //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
34
+ if ((data && !renderItem) || (renderItem && !data)) {
35
+ throw new Error(
36
+ "'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both"
37
+ );
38
+ }
39
+
40
+ if (data && renderItem && children) {
41
+ console.warn(
42
+ "'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'"
43
+ );
44
+ }
45
+
27
46
  const childrenArray = React.useMemo(
28
47
  () => React.Children.toArray(children),
29
48
  [children]
@@ -35,6 +54,31 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
35
54
  [childrenArray]
36
55
  );
37
56
 
57
+ const cardsData = data || cardsFillerData;
58
+
59
+ const renderCard = (card: any, index: number): JSX.Element => {
60
+ if (renderItem) {
61
+ return renderItem({ item: card, index });
62
+ } else {
63
+ return <>{childrenArray[index]}</>;
64
+ }
65
+ };
66
+
67
+ const renderFirstCard = (): JSX.Element | undefined => {
68
+ if (cardsData.length) {
69
+ return renderCard(cardsData[0], 0);
70
+ }
71
+ return undefined;
72
+ };
73
+
74
+ const cardKeyExtractor = (card: any) => {
75
+ if (keyExtractor) {
76
+ return keyExtractor(card);
77
+ } else {
78
+ return card.toString();
79
+ }
80
+ };
81
+
38
82
  /**
39
83
  * By default react-native-deck-swiper positions everything with absolute position.
40
84
  * To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
@@ -47,13 +91,11 @@ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
47
91
 
48
92
  return (
49
93
  <View>
50
- <View style={styles.containerHeightFiller}>
51
- {childrenArray.length && childrenArray[0]}
52
- </View>
94
+ <View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
53
95
  <DeckSwiperComponent
54
- cards={cardsFillerData}
55
- renderCard={(_, i) => <>{childrenArray[i]}</>}
56
- keyExtractor={(card) => card?.toString()}
96
+ cards={cardsData as any[]}
97
+ renderCard={renderCard}
98
+ keyExtractor={cardKeyExtractor}
57
99
  containerStyle={
58
100
  StyleSheet.flatten([styles.cardsContainer, style]) as
59
101
  | object
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
3
  import { withTheme } from "../../theming";
4
- const DeckSwiperCard = ({ style, children, theme, }) => (React.createElement(View, { style: [
4
+ const DeckSwiperCard = ({ style, children, theme }) => (React.createElement(View, { style: [
5
5
  styles.card,
6
6
  {
7
7
  backgroundColor: theme.colors.background,
@@ -5,15 +5,12 @@ import { withTheme } from "../../theming";
5
5
 
6
6
  export interface DeckSwiperCardProps {
7
7
  style?: StyleProp<ViewStyle>;
8
- children: React.ReactNode;
9
8
  theme: Theme;
10
9
  }
11
10
 
12
- const DeckSwiperCard: React.FC<DeckSwiperCardProps> = ({
13
- style,
14
- children,
15
- theme,
16
- }) => (
11
+ const DeckSwiperCard: React.FC<
12
+ React.PropsWithChildren<DeckSwiperCardProps>
13
+ > = ({ style, children, theme }) => (
17
14
  <View
18
15
  style={[
19
16
  styles.card,
package/src/index.js CHANGED
@@ -32,7 +32,6 @@ export { Swiper, SwiperItem } from "./components/Swiper";
32
32
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
33
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
34
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
35
- export { default as Markdown } from "./components/Markdown";
36
35
  /* Deprecated: Fix or Delete! */
37
36
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
38
37
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -53,8 +53,6 @@ export {
53
53
 
54
54
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
55
55
 
56
- export { default as Markdown } from "./components/Markdown";
57
-
58
56
  /* Deprecated: Fix or Delete! */
59
57
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
60
58
  export { default as Picker } from "./components/Picker/Picker";
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var React = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _reactNativeMarkdownDisplay = _interopRequireDefault(require("react-native-markdown-display"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- const Markdown = _ref => {
14
- let {
15
- children,
16
- style
17
- } = _ref;
18
- return (
19
- /*#__PURE__*/
20
- //'body' style used for main parent container
21
- //@ts-ignore TS does not like the type of this named style for some reason
22
- React.createElement(_reactNativeMarkdownDisplay.default, {
23
- style: {
24
- body: _reactNative.StyleSheet.flatten(style)
25
- }
26
- }, children)
27
- );
28
- };
29
- var _default = Markdown;
30
- exports.default = _default;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
- var _types = require("@draftbit/types");
8
- const SEED_DATA = {
9
- name: "Markdown",
10
- tag: "Markdown",
11
- description: "A component that renders markdown",
12
- category: _types.COMPONENT_TYPES.basic,
13
- stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
14
- props: {
15
- children: {
16
- group: _types.GROUPS.data,
17
- label: "Markdown Text",
18
- description: "Markdownt text to be rendered ",
19
- editable: true,
20
- required: true,
21
- formType: _types.FORM_TYPES.string,
22
- propType: _types.PROP_TYPES.STRING,
23
- defaultValue: "## Double click me to edit 👀"
24
- }
25
- }
26
- };
27
- exports.SEED_DATA = SEED_DATA;
@@ -1,20 +0,0 @@
1
- import * as React from "react";
2
- import { StyleSheet } from "react-native";
3
- import MarkdownComponent from "react-native-markdown-display";
4
- const Markdown = _ref => {
5
- let {
6
- children,
7
- style
8
- } = _ref;
9
- return (
10
- /*#__PURE__*/
11
- //'body' style used for main parent container
12
- //@ts-ignore TS does not like the type of this named style for some reason
13
- React.createElement(MarkdownComponent, {
14
- style: {
15
- body: StyleSheet.flatten(style)
16
- }
17
- }, children)
18
- );
19
- };
20
- export default Markdown;
@@ -1,20 +0,0 @@
1
- import { BLOCK_STYLES_SECTIONS, COMPONENT_TYPES, FORM_TYPES, GROUPS, PROP_TYPES } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "Markdown",
4
- tag: "Markdown",
5
- description: "A component that renders markdown",
6
- category: COMPONENT_TYPES.basic,
7
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
8
- props: {
9
- children: {
10
- group: GROUPS.data,
11
- label: "Markdown Text",
12
- description: "Markdownt text to be rendered ",
13
- editable: true,
14
- required: true,
15
- formType: FORM_TYPES.string,
16
- propType: PROP_TYPES.STRING,
17
- defaultValue: "## Double click me to edit 👀"
18
- }
19
- }
20
- };
@@ -1,8 +0,0 @@
1
- import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- declare type MarkdownProps = {
4
- style?: StyleProp<ViewStyle>;
5
- };
6
- declare const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>>;
7
- export default Markdown;
8
- //# sourceMappingURL=Markdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAGhE,aAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAW9D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,20 +0,0 @@
1
- export declare const SEED_DATA: {
2
- name: string;
3
- tag: string;
4
- description: string;
5
- category: string;
6
- stylesPanelSections: string[];
7
- props: {
8
- children: {
9
- group: string;
10
- label: string;
11
- description: string;
12
- editable: boolean;
13
- required: boolean;
14
- formType: string;
15
- propType: string;
16
- defaultValue: string;
17
- };
18
- };
19
- };
20
- //# sourceMappingURL=Markdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Markdown.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAkBrB,CAAC"}
@@ -1,10 +0,0 @@
1
- import * as React from "react";
2
- import { StyleSheet } from "react-native";
3
- import MarkdownComponent from "react-native-markdown-display";
4
- const Markdown = ({ children, style, }) => {
5
- return (
6
- //'body' style used for main parent container
7
- //@ts-ignore TS does not like the type of this named style for some reason
8
- React.createElement(MarkdownComponent, { style: { body: StyleSheet.flatten(style) } }, children));
9
- };
10
- export default Markdown;
@@ -1,22 +0,0 @@
1
- import * as React from "react";
2
- import { StyleProp, ViewStyle, StyleSheet } from "react-native";
3
- import MarkdownComponent from "react-native-markdown-display";
4
-
5
- type MarkdownProps = {
6
- style?: StyleProp<ViewStyle>;
7
- };
8
-
9
- const Markdown: React.FC<React.PropsWithChildren<MarkdownProps>> = ({
10
- children,
11
- style,
12
- }) => {
13
- return (
14
- //'body' style used for main parent container
15
- //@ts-ignore TS does not like the type of this named style for some reason
16
- <MarkdownComponent style={{ body: StyleSheet.flatten(style) }}>
17
- {children}
18
- </MarkdownComponent>
19
- );
20
- };
21
-
22
- export default Markdown;
@@ -1,20 +0,0 @@
1
- import { BLOCK_STYLES_SECTIONS, COMPONENT_TYPES, FORM_TYPES, GROUPS, PROP_TYPES, } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "Markdown",
4
- tag: "Markdown",
5
- description: "A component that renders markdown",
6
- category: COMPONENT_TYPES.basic,
7
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
8
- props: {
9
- children: {
10
- group: GROUPS.data,
11
- label: "Markdown Text",
12
- description: "Markdownt text to be rendered ",
13
- editable: true,
14
- required: true,
15
- formType: FORM_TYPES.string,
16
- propType: PROP_TYPES.STRING,
17
- defaultValue: "## Double click me to edit 👀",
18
- },
19
- },
20
- };
@@ -1,27 +0,0 @@
1
- import {
2
- BLOCK_STYLES_SECTIONS,
3
- COMPONENT_TYPES,
4
- FORM_TYPES,
5
- GROUPS,
6
- PROP_TYPES,
7
- } from "@draftbit/types";
8
-
9
- export const SEED_DATA = {
10
- name: "Markdown",
11
- tag: "Markdown",
12
- description: "A component that renders markdown",
13
- category: COMPONENT_TYPES.basic,
14
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
15
- props: {
16
- children: {
17
- group: GROUPS.data,
18
- label: "Markdown Text",
19
- description: "Markdownt text to be rendered ",
20
- editable: true,
21
- required: true,
22
- formType: FORM_TYPES.string,
23
- propType: PROP_TYPES.STRING,
24
- defaultValue: "## Double click me to edit 👀",
25
- },
26
- },
27
- };