@draftbit/core 46.9.1-7dbeee.2 → 46.9.1-bdfd4c.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 (47) 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/components/Picker/PickerComponent.android.js +20 -3
  7. package/lib/commonjs/index.js +7 -7
  8. package/lib/commonjs/mappings/BottomSheet.js +74 -0
  9. package/lib/module/components/BottomSheet/BottomSheet.js +80 -0
  10. package/lib/module/components/BottomSheet/BottomSheetComponent.js +470 -0
  11. package/lib/module/components/BottomSheet/index.js +1 -0
  12. package/lib/module/components/Text.js +50 -4
  13. package/lib/module/index.js +1 -1
  14. package/lib/module/mappings/BottomSheet.js +67 -0
  15. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +20 -0
  16. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  17. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +170 -0
  18. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +1 -0
  19. package/lib/typescript/src/components/BottomSheet/index.d.ts +2 -0
  20. package/lib/typescript/src/components/BottomSheet/index.d.ts.map +1 -0
  21. package/lib/typescript/src/index.d.ts +1 -1
  22. package/lib/typescript/src/index.d.ts.map +1 -1
  23. package/lib/typescript/src/mappings/BottomSheet.d.ts +119 -0
  24. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -0
  25. package/package.json +6 -6
  26. package/src/components/BottomSheet/BottomSheet.js +56 -0
  27. package/src/components/BottomSheet/BottomSheet.tsx +120 -0
  28. package/src/components/BottomSheet/BottomSheetComponent.js +437 -0
  29. package/src/components/BottomSheet/BottomSheetComponent.tsx +895 -0
  30. package/src/components/BottomSheet/index.js +1 -0
  31. package/src/components/BottomSheet/index.ts +1 -0
  32. package/src/index.js +1 -1
  33. package/src/index.tsx +1 -1
  34. package/src/mappings/BottomSheet.js +64 -0
  35. package/src/mappings/BottomSheet.ts +78 -0
  36. package/lib/commonjs/components/YotubePlayer.js +0 -38
  37. package/lib/commonjs/mappings/YoutubePlayer.js +0 -44
  38. package/lib/module/components/YotubePlayer.js +0 -30
  39. package/lib/module/mappings/YoutubePlayer.js +0 -37
  40. package/lib/typescript/src/components/YotubePlayer.d.ts +0 -12
  41. package/lib/typescript/src/components/YotubePlayer.d.ts.map +0 -1
  42. package/lib/typescript/src/mappings/YoutubePlayer.d.ts +0 -37
  43. package/lib/typescript/src/mappings/YoutubePlayer.d.ts.map +0 -1
  44. package/src/components/YotubePlayer.js +0 -10
  45. package/src/components/YotubePlayer.tsx +0 -38
  46. package/src/mappings/YoutubePlayer.js +0 -37
  47. package/src/mappings/YoutubePlayer.ts +0 -43
@@ -15,9 +15,7 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  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); }
17
17
  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; }
18
- 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); }
19
18
  const Picker = _ref => {
20
- var _options$find$label, _options$find;
21
19
  let {
22
20
  style,
23
21
  options,
@@ -27,6 +25,7 @@ const Picker = _ref => {
27
25
  onValueChange: onValueChangeOverride = () => {},
28
26
  ...props
29
27
  } = _ref;
28
+ var _a, _b;
30
29
  const {
31
30
  viewStyles: {
32
31
  borderRadius,
@@ -71,7 +70,7 @@ const Picker = _ref => {
71
70
  };
72
71
 
73
72
  const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
74
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
73
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
75
74
  return /*#__PURE__*/React.createElement(_Touchable.default, {
76
75
  disabled: disabled,
77
76
  onPress: toggleFocus,
@@ -95,6 +94,24 @@ const Picker = _ref => {
95
94
  key: o.value
96
95
  }))), /*#__PURE__*/React.createElement(_reactNative.View, {
97
96
  pointerEvents: "none"
97
+ }, /*#__PURE__*/React.createElement(_TextField.default, {
98
+ ...props,
99
+ value: selectedLabel,
100
+ placeholder: placeholder,
101
+ // @ts-ignore
102
+ ref: textField,
103
+ disabled: disabled,
104
+ // @ts-expect-error
105
+ style: stylesWithoutMargin
106
+ }))));
107
+ };
108
+ const styles = _reactNative.StyleSheet.create({
109
+ container: {
110
+ alignSelf: "stretch"
111
+ }
112
+ });
113
+ var _default = (0, _theming.withTheme)(Picker);
114
+ exports.default = _default;pointerEvents: "none"
98
115
  }, /*#__PURE__*/React.createElement(_TextField.default, _extends({}, props, {
99
116
  value: selectedLabel,
100
117
  placeholder: placeholder
@@ -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 () {
@@ -387,12 +393,6 @@ Object.defineProperty(exports, "Touchable", {
387
393
  return _Touchable.default;
388
394
  }
389
395
  });
390
- Object.defineProperty(exports, "YoutubePlayer", {
391
- enumerable: true,
392
- get: function () {
393
- return _YotubePlayer.default;
394
- }
395
- });
396
396
  Object.defineProperty(exports, "injectIcon", {
397
397
  enumerable: true,
398
398
  get: function () {
@@ -447,7 +447,7 @@ var _Shadow = _interopRequireDefault(require("./components/Shadow"));
447
447
  var _DeckSwiper = require("./components/DeckSwiper");
448
448
  var _TabView = require("./components/TabView");
449
449
  var _Markdown = _interopRequireDefault(require("./components/Markdown"));
450
- var _YotubePlayer = _interopRequireDefault(require("./components/YotubePlayer"));
450
+ var _BottomSheet = require("./components/BottomSheet");
451
451
  var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
452
452
  var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
453
453
  var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
@@ -0,0 +1,74 @@
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
+ layout: {
15
+ paddingHorizontal: 16,
16
+ paddingVertical: 10
17
+ },
18
+ triggers: [_types.Triggers.OnSettle],
19
+ props: {
20
+ onSettle: (0, _types.createActionProp)({
21
+ label: "On settle",
22
+ description: "Action to execute when sheet settles on a snap point"
23
+ }),
24
+ snapPoints: (0, _types.createStaticArrayProp)({
25
+ label: "Snap points",
26
+ 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)",
27
+ defaultValue: ["10%", "50%", "80%"]
28
+ }),
29
+ initialSnapIndex: (0, _types.createStaticNumberProp)({
30
+ label: "Initial snap index",
31
+ description: "Index of the snap point to be used as the initial point",
32
+ defaultValue: 0,
33
+ required: false
34
+ }),
35
+ showHandle: (0, _types.createStaticBoolProp)({
36
+ label: "Show handle",
37
+ description: "Whether to show the sheet handle or not",
38
+ defaultValue: true
39
+ }),
40
+ handleColor: (0, _types.createColorProp)({
41
+ label: "Handle color",
42
+ description: "Color of the top handle",
43
+ defaultValue: "divider"
44
+ }),
45
+ topBorderRadius: (0, _types.createStaticNumberProp)({
46
+ label: "Top border radius",
47
+ description: "Border radius of top corners",
48
+ defaultValue: 20,
49
+ required: false
50
+ }),
51
+ borderWidth: (0, _types.createStaticNumberProp)({
52
+ label: "Border width",
53
+ description: "Width of bottom sheet borders",
54
+ defaultValue: 1,
55
+ required: false
56
+ }),
57
+ borderColor: (0, _types.createColorProp)({
58
+ label: "Border color",
59
+ description: "Color of bottom sheet borders",
60
+ defaultValue: "divider"
61
+ }),
62
+ showsVerticalScrollIndicator: (0, _types.createStaticBoolProp)({
63
+ label: "Show Vertical Scroll Indicator",
64
+ description: "When true, shows a vertical scroll indicator. The default value is true.",
65
+ defaultValue: true
66
+ }),
67
+ bounces: (0, _types.createStaticBoolProp)({
68
+ label: "Bounce",
69
+ 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.",
70
+ defaultValue: true
71
+ })
72
+ }
73
+ };
74
+ exports.SEED_DATA = SEED_DATA;
@@ -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);