@draftbit/core 46.9.1-b17d64.2 → 46.9.1-b92e81.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 (73) hide show
  1. package/lib/commonjs/components/BottomSheet/BottomSheet.js +88 -0
  2. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +464 -0
  3. package/lib/commonjs/components/BottomSheet/index.js +13 -0
  4. package/lib/commonjs/components/CircleImage.js +15 -1
  5. package/lib/commonjs/components/Container.js +4 -15
  6. package/lib/commonjs/index.js +7 -19
  7. package/lib/commonjs/mappings/BottomSheet.js +70 -0
  8. package/lib/commonjs/mappings/FieldSearchBarFull.js +1 -3
  9. package/lib/commonjs/mappings/StarRating.js +2 -6
  10. package/lib/commonjs/styles/overlay.js +3 -1
  11. package/lib/commonjs/utilities.js +2 -1
  12. package/lib/module/components/BottomSheet/BottomSheet.js +80 -0
  13. package/lib/module/components/BottomSheet/BottomSheetComponent.js +470 -0
  14. package/lib/module/components/BottomSheet/index.js +1 -0
  15. package/lib/module/index.js +1 -1
  16. package/lib/module/mappings/BottomSheet.js +63 -0
  17. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +20 -0
  18. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  19. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +170 -0
  20. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +1 -0
  21. package/lib/typescript/src/components/BottomSheet/index.d.ts +2 -0
  22. package/lib/typescript/src/components/BottomSheet/index.d.ts.map +1 -0
  23. package/lib/typescript/src/index.d.ts +1 -1
  24. package/lib/typescript/src/index.d.ts.map +1 -1
  25. package/lib/typescript/src/mappings/BottomSheet.d.ts +115 -0
  26. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -0
  27. package/package.json +5 -3
  28. package/src/components/BottomSheet/BottomSheet.js +56 -0
  29. package/src/components/BottomSheet/BottomSheet.tsx +120 -0
  30. package/src/components/BottomSheet/BottomSheetComponent.js +437 -0
  31. package/src/components/BottomSheet/BottomSheetComponent.tsx +895 -0
  32. package/src/components/BottomSheet/index.js +1 -0
  33. package/src/components/BottomSheet/index.ts +1 -0
  34. package/src/index.js +1 -1
  35. package/src/index.tsx +1 -1
  36. package/src/mappings/BottomSheet.js +63 -0
  37. package/src/mappings/BottomSheet.ts +77 -0
  38. package/lib/commonjs/components/Table/Table.js +0 -91
  39. package/lib/commonjs/components/Table/TableCell.js +0 -49
  40. package/lib/commonjs/components/Table/TableCommon.js +0 -30
  41. package/lib/commonjs/components/Table/TableRow.js +0 -61
  42. package/lib/commonjs/components/Table/index.js +0 -27
  43. package/lib/commonjs/mappings/Table.js +0 -127
  44. package/lib/module/components/Table/Table.js +0 -83
  45. package/lib/module/components/Table/TableCell.js +0 -41
  46. package/lib/module/components/Table/TableCommon.js +0 -21
  47. package/lib/module/components/Table/TableRow.js +0 -53
  48. package/lib/module/components/Table/index.js +0 -3
  49. package/lib/module/mappings/Table.js +0 -120
  50. package/lib/typescript/src/components/Table/Table.d.ts +0 -19
  51. package/lib/typescript/src/components/Table/Table.d.ts.map +0 -1
  52. package/lib/typescript/src/components/Table/TableCell.d.ts +0 -9
  53. package/lib/typescript/src/components/Table/TableCell.d.ts.map +0 -1
  54. package/lib/typescript/src/components/Table/TableCommon.d.ts +0 -20
  55. package/lib/typescript/src/components/Table/TableCommon.d.ts.map +0 -1
  56. package/lib/typescript/src/components/Table/TableRow.d.ts +0 -14
  57. package/lib/typescript/src/components/Table/TableRow.d.ts.map +0 -1
  58. package/lib/typescript/src/components/Table/index.d.ts +0 -4
  59. package/lib/typescript/src/components/Table/index.d.ts.map +0 -1
  60. package/lib/typescript/src/mappings/Table.d.ts +0 -327
  61. package/lib/typescript/src/mappings/Table.d.ts.map +0 -1
  62. package/src/components/Table/Table.js +0 -64
  63. package/src/components/Table/Table.tsx +0 -136
  64. package/src/components/Table/TableCell.js +0 -31
  65. package/src/components/Table/TableCell.tsx +0 -63
  66. package/src/components/Table/TableCommon.js +0 -12
  67. package/src/components/Table/TableCommon.ts +0 -40
  68. package/src/components/Table/TableRow.js +0 -37
  69. package/src/components/Table/TableRow.tsx +0 -77
  70. package/src/components/Table/index.js +0 -3
  71. package/src/components/Table/index.tsx +0 -3
  72. package/src/mappings/Table.js +0 -137
  73. package/src/mappings/Table.ts +0 -156
@@ -51,6 +51,12 @@ Object.defineProperty(exports, "Banner", {
51
51
  return _Banner.default;
52
52
  }
53
53
  });
54
+ Object.defineProperty(exports, "BottomSheet", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _BottomSheet.BottomSheet;
58
+ }
59
+ });
54
60
  Object.defineProperty(exports, "Button", {
55
61
  enumerable: true,
56
62
  get: function () {
@@ -363,24 +369,6 @@ Object.defineProperty(exports, "TabViewItem", {
363
369
  return _TabView.TabViewItem;
364
370
  }
365
371
  });
366
- Object.defineProperty(exports, "Table", {
367
- enumerable: true,
368
- get: function () {
369
- return _Table.Table;
370
- }
371
- });
372
- Object.defineProperty(exports, "TableCell", {
373
- enumerable: true,
374
- get: function () {
375
- return _Table.TableCell;
376
- }
377
- });
378
- Object.defineProperty(exports, "TableRow", {
379
- enumerable: true,
380
- get: function () {
381
- return _Table.TableRow;
382
- }
383
- });
384
372
  Object.defineProperty(exports, "TextField", {
385
373
  enumerable: true,
386
374
  get: function () {
@@ -459,7 +447,7 @@ var _Shadow = _interopRequireDefault(require("./components/Shadow"));
459
447
  var _DeckSwiper = require("./components/DeckSwiper");
460
448
  var _TabView = require("./components/TabView");
461
449
  var _Markdown = _interopRequireDefault(require("./components/Markdown"));
462
- var _Table = require("./components/Table");
450
+ var _BottomSheet = require("./components/BottomSheet");
463
451
  var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
464
452
  var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
465
453
  var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
@@ -0,0 +1,70 @@
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: "Bottom Sheet",
10
+ tag: "BottomSheet",
11
+ description: "A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
12
+ category: _types.COMPONENT_TYPES.bottomsheet,
13
+ stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
14
+ triggers: [_types.Triggers.OnSettle],
15
+ props: {
16
+ onSettle: (0, _types.createActionProp)({
17
+ label: "On settle",
18
+ description: "Action to execute when sheet settles on a snap point"
19
+ }),
20
+ snapPoints: (0, _types.createArrayProp)({
21
+ label: "Snap points",
22
+ description: "An array of numerical values (that represent distance from the top) where bottom sheet can snap to place. Accepts numbers and percentages (minimum 2 snap points)",
23
+ defaultValue: ["10%", "50%", "80%"]
24
+ }),
25
+ initialSnapIndex: (0, _types.createStaticNumberProp)({
26
+ label: "Initial snap index",
27
+ description: "Index of the snap point to be used as the initial point",
28
+ defaultValue: 0,
29
+ required: false
30
+ }),
31
+ showHandle: (0, _types.createStaticBoolProp)({
32
+ label: "Show handle",
33
+ description: "Whether to show the top sheet handle or not",
34
+ defaultValue: true
35
+ }),
36
+ handleColor: (0, _types.createColorProp)({
37
+ label: "Handle color",
38
+ description: "Color of the top handle",
39
+ defaultValue: "divider"
40
+ }),
41
+ topBorderRadius: (0, _types.createStaticNumberProp)({
42
+ label: "Top border radius",
43
+ description: "Border radius of top corners",
44
+ defaultValue: 20,
45
+ required: false
46
+ }),
47
+ borderWidth: (0, _types.createStaticNumberProp)({
48
+ label: "Border width",
49
+ description: "Width of bottom sheet borders",
50
+ defaultValue: 1,
51
+ required: false
52
+ }),
53
+ borderColor: (0, _types.createColorProp)({
54
+ label: "Border color",
55
+ description: "Color of bottom sheet borders",
56
+ defaultValue: "divider"
57
+ }),
58
+ showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
59
+ label: "Show Vertical Scroll Indicator",
60
+ description: "When true, shows a vertical scroll indicator. The default value is true.",
61
+ defaultValue: true
62
+ }),
63
+ bounces: (0, _types.createStaticBoolProp)({
64
+ label: "Bounce",
65
+ description: "When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction.",
66
+ defaultValue: true
67
+ })
68
+ }
69
+ };
70
+ exports.SEED_DATA = SEED_DATA;
@@ -14,6 +14,7 @@ const SEED_DATA = [{
14
14
  preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
15
15
  supports_list_render: false,
16
16
  triggers: [_types.Triggers.OnChange],
17
+ // TODO Triggers.OnSubmit for multiple triggers
17
18
  props: {
18
19
  icon: {
19
20
  group: _types.GROUPS.basic,
@@ -52,7 +53,4 @@ const SEED_DATA = [{
52
53
  },
53
54
  layout: {}
54
55
  }];
55
- exports.SEED_DATA = SEED_DATA;},
56
- layout: {}
57
- }];
58
56
  exports.SEED_DATA = SEED_DATA;
@@ -23,7 +23,9 @@ const SEED_DATA = {
23
23
  }),
24
24
  fieldName: (0, _types.createFieldNameProp)({
25
25
  defaultValue: "ratingValue",
26
+ // this is the name of the variable declared on the screen in Draftbit
26
27
  handlerPropName: "onPress",
28
+ // the change handler prop in this component
27
29
  valuePropName: "rating" // the value prop in this component
28
30
  }),
29
31
 
@@ -48,10 +50,4 @@ const SEED_DATA = {
48
50
  })
49
51
  }
50
52
  };
51
- exports.SEED_DATA = SEED_DATA;pes.createColorProp)({
52
- label: "Inactive Color",
53
- defaultValue: "divider"
54
- })
55
- }
56
- };
57
53
  exports.SEED_DATA = SEED_DATA;
@@ -15,6 +15,7 @@ function overlay(elevation) {
15
15
  let surfaceColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _DarkTheme.default.colors.surface;
16
16
  if (isAnimatedValue(elevation)) {
17
17
  const inputRange = [0, 1, 2, 3, 8, 24];
18
+
18
19
  // @ts-expect-error: TS doesn't seem to refine the type correctly
19
20
  return elevation.interpolate({
20
21
  inputRange,
@@ -23,6 +24,7 @@ function overlay(elevation) {
23
24
  })
24
25
  });
25
26
  }
27
+
26
28
  // @ts-expect-error: TS doesn't seem to refine the type correctly
27
29
  return calculateColor(surfaceColor, elevation);
28
30
  }
@@ -63,4 +65,4 @@ const elevationOverlayTransparency = {
63
65
  22: 15.72,
64
66
  23: 15.84,
65
67
  24: 16
66
- };};
68
+ };
@@ -57,6 +57,7 @@ function extractBorderAndMarginStyles(style, additionalBorderStyles, additionalM
57
57
  marginStyles
58
58
  };
59
59
  }
60
+
60
61
  /**
61
62
  * Merges a style object on top of another style object. In React Native,
62
63
  * keys with undefined values in a style object will still override styles
@@ -89,4 +90,4 @@ function getValueForRadioButton(value) {
89
90
  } else {
90
91
  throw new Error("Invalid value: ".concat(value));
91
92
  }
92
- }}
93
+ }
@@ -0,0 +1,80 @@
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); }
2
+ import React from "react";
3
+ import { StyleSheet, View } from "react-native";
4
+ import BottomSheetComponent from "./BottomSheetComponent";
5
+ import { withTheme } from "../../theming";
6
+ const BottomSheet = _ref => {
7
+ let {
8
+ theme,
9
+ snapPoints = ["10%", "50%", "80%"],
10
+ initialSnapIndex = 0,
11
+ showHandle = true,
12
+ handleColor = theme.colors.divider,
13
+ topBorderRadius = 20,
14
+ borderWidth = 1,
15
+ borderColor = theme.colors.divider,
16
+ onSettle,
17
+ style,
18
+ children,
19
+ ...rest
20
+ } = _ref;
21
+ const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
22
+ return /*#__PURE__*/React.createElement(View, {
23
+ style: styles.parentContainer,
24
+ pointerEvents: "box-none"
25
+ }, /*#__PURE__*/React.createElement(BottomSheetComponent, _extends({
26
+ componentType: "ScrollView",
27
+ snapPoints: snapPoints,
28
+ initialSnapIndex: initialSnapIndex,
29
+ renderHandle: () => /*#__PURE__*/React.createElement(React.Fragment, null, showHandle && /*#__PURE__*/React.createElement(View, {
30
+ style: [styles.handleContainer, {
31
+ backgroundColor,
32
+ borderTopLeftRadius: topBorderRadius,
33
+ borderTopRightRadius: topBorderRadius
34
+ }]
35
+ }, /*#__PURE__*/React.createElement(View, {
36
+ style: [styles.handle, {
37
+ backgroundColor: handleColor
38
+ }]
39
+ }))),
40
+ contentContainerStyle: [styles.contentContainerStyle, style],
41
+ containerStyle: StyleSheet.flatten([styles.containerStyle, {
42
+ backgroundColor,
43
+ borderTopLeftRadius: topBorderRadius,
44
+ borderTopRightRadius: topBorderRadius,
45
+ borderWidth,
46
+ borderColor
47
+ }]),
48
+ onSettle: onSettle
49
+ }, rest), children));
50
+ };
51
+ const styles = StyleSheet.create({
52
+ //Render on top of everything
53
+ parentContainer: {
54
+ position: "absolute",
55
+ left: 0,
56
+ right: 0,
57
+ top: 0,
58
+ bottom: 0,
59
+ zIndex: 10,
60
+ overflow: "hidden"
61
+ },
62
+ contentContainerStyle: {
63
+ paddingHorizontal: 16,
64
+ paddingVertical: 10
65
+ },
66
+ containerStyle: {
67
+ flex: 1,
68
+ overflow: "hidden"
69
+ },
70
+ handleContainer: {
71
+ alignItems: "center",
72
+ paddingVertical: 20
73
+ },
74
+ handle: {
75
+ width: 40,
76
+ height: 2,
77
+ borderRadius: 4
78
+ }
79
+ });
80
+ export default withTheme(BottomSheet);