@draftbit/core 42.4.2-50ce38.2 → 42.4.2-717ab1.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 (174) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +16 -5
  2. package/lib/commonjs/components/Accordion/AccordionItem.js.map +1 -1
  3. package/lib/commonjs/components/Accordion/index.js.map +1 -1
  4. package/lib/commonjs/components/ActionSheet/ActionSheetCancel.js.map +1 -1
  5. package/lib/commonjs/components/ActionSheet/ActionSheetItem.js.map +1 -1
  6. package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
  7. package/lib/commonjs/components/AnimatedCircularProgress.js +11 -3
  8. package/lib/commonjs/components/AnimatedCircularProgress.js.map +1 -1
  9. package/lib/commonjs/components/AspectRatio.js +15 -2
  10. package/lib/commonjs/components/AspectRatio.js.map +1 -1
  11. package/lib/commonjs/components/AvatarEdit.js +16 -5
  12. package/lib/commonjs/components/AvatarEdit.js.map +1 -1
  13. package/lib/commonjs/components/Button.js +25 -11
  14. package/lib/commonjs/components/Button.js.map +1 -1
  15. package/lib/commonjs/components/CardBlock.js +17 -5
  16. package/lib/commonjs/components/CardBlock.js.map +1 -1
  17. package/lib/commonjs/components/CardContainer.js +14 -5
  18. package/lib/commonjs/components/CardContainer.js.map +1 -1
  19. package/lib/commonjs/components/CardContainerRating.js +16 -5
  20. package/lib/commonjs/components/CardContainerRating.js.map +1 -1
  21. package/lib/commonjs/components/CardInline.js.map +1 -1
  22. package/lib/commonjs/components/Carousel.js +15 -5
  23. package/lib/commonjs/components/Carousel.js.map +1 -1
  24. package/lib/commonjs/components/Checkbox/CheckboxRow.js +14 -6
  25. package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
  26. package/lib/commonjs/components/Checkbox/context.js +1 -1
  27. package/lib/commonjs/components/Checkbox/context.js.map +1 -1
  28. package/lib/commonjs/components/Checkbox/index.js.map +1 -1
  29. package/lib/commonjs/components/CircleImage.js +18 -5
  30. package/lib/commonjs/components/CircleImage.js.map +1 -1
  31. package/lib/commonjs/components/Config.js.map +1 -1
  32. package/lib/commonjs/components/Container.js +14 -5
  33. package/lib/commonjs/components/Container.js.map +1 -1
  34. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  35. package/lib/commonjs/components/DeprecatedButton.js +15 -4
  36. package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
  37. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
  38. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  39. package/lib/commonjs/components/Elevation.js +14 -3
  40. package/lib/commonjs/components/Elevation.js.map +1 -1
  41. package/lib/commonjs/components/FAB.js +16 -5
  42. package/lib/commonjs/components/FAB.js.map +1 -1
  43. package/lib/commonjs/components/FieldSearchBarFull.js +1 -1
  44. package/lib/commonjs/components/FieldSearchBarFull.js.map +1 -1
  45. package/lib/commonjs/components/FormRow.js +18 -5
  46. package/lib/commonjs/components/FormRow.js.map +1 -1
  47. package/lib/commonjs/components/Header.js.map +1 -1
  48. package/lib/commonjs/components/HeaderLarge.js.map +1 -1
  49. package/lib/commonjs/components/HeaderMedium.js.map +1 -1
  50. package/lib/commonjs/components/HeaderOverline.js.map +1 -1
  51. package/lib/commonjs/components/IconButton.js +18 -5
  52. package/lib/commonjs/components/IconButton.js.map +1 -1
  53. package/lib/commonjs/components/Image.js +16 -6
  54. package/lib/commonjs/components/Image.js.map +1 -1
  55. package/lib/commonjs/components/Justification.js +2 -1
  56. package/lib/commonjs/components/Layout.js +41 -22
  57. package/lib/commonjs/components/Layout.js.map +1 -1
  58. package/lib/commonjs/components/{MapView/MapCallout.native.js → Markdown.js} +21 -23
  59. package/lib/commonjs/components/Markdown.js.map +1 -0
  60. package/lib/commonjs/components/NumberInput.js +15 -3
  61. package/lib/commonjs/components/NumberInput.js.map +1 -1
  62. package/lib/commonjs/components/Picker/PickerTypes.js +2 -1
  63. package/lib/commonjs/components/Portal/PortalManager.js.map +1 -1
  64. package/lib/commonjs/components/ProgressBar.js +19 -6
  65. package/lib/commonjs/components/ProgressBar.js.map +1 -1
  66. package/lib/commonjs/components/ProgressCircle.js.map +1 -1
  67. package/lib/commonjs/components/ProgressIndicator.js.map +1 -1
  68. package/lib/commonjs/components/RadioButton/RadioButton.js +14 -5
  69. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
  70. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +11 -2
  71. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js.map +1 -1
  72. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +15 -5
  73. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
  74. package/lib/commonjs/components/ResizeMode.js +2 -1
  75. package/lib/commonjs/components/Row.js.map +1 -1
  76. package/lib/commonjs/components/RowBodyIcon.js.map +1 -1
  77. package/lib/commonjs/components/RowHeadlineImageCaption.js.map +1 -1
  78. package/lib/commonjs/components/RowHeadlineImageIcon.js.map +1 -1
  79. package/lib/commonjs/components/ScreenContainer.js +18 -5
  80. package/lib/commonjs/components/ScreenContainer.js.map +1 -1
  81. package/lib/commonjs/components/Slider.js +17 -5
  82. package/lib/commonjs/components/Slider.js.map +1 -1
  83. package/lib/commonjs/components/StepIndicator.js.map +1 -1
  84. package/lib/commonjs/components/Stepper.js.map +1 -1
  85. package/lib/commonjs/components/Surface.js +11 -4
  86. package/lib/commonjs/components/Surface.js.map +1 -1
  87. package/lib/commonjs/components/Swiper/Swiper.js.map +1 -1
  88. package/lib/commonjs/components/TextField.js +18 -7
  89. package/lib/commonjs/components/TextField.js.map +1 -1
  90. package/lib/commonjs/components/TextInput.js +12 -2
  91. package/lib/commonjs/components/TextInput.js.map +1 -1
  92. package/lib/commonjs/components/ToggleButton.js +17 -5
  93. package/lib/commonjs/components/ToggleButton.js.map +1 -1
  94. package/lib/commonjs/components/Touchable.js +16 -5
  95. package/lib/commonjs/components/Touchable.js.map +1 -1
  96. package/lib/commonjs/components/Touchable.web.js.map +1 -1
  97. package/lib/commonjs/components/Typography.js.map +1 -1
  98. package/lib/commonjs/index.js +8 -20
  99. package/lib/commonjs/index.js.map +1 -1
  100. package/lib/module/components/Markdown.js +26 -0
  101. package/lib/module/components/Markdown.js.map +1 -0
  102. package/lib/module/components/Surface.js +2 -4
  103. package/lib/module/components/Surface.js.map +1 -1
  104. package/lib/module/index.js +1 -1
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/typescript/src/components/Markdown.d.ts +21 -0
  107. package/lib/typescript/src/index.d.ts +1 -1
  108. package/package.json +3 -4
  109. package/src/components/Markdown.js +21 -0
  110. package/src/components/Markdown.tsx +30 -0
  111. package/src/index.js +1 -1
  112. package/src/index.tsx +1 -1
  113. package/lib/commonjs/components/MapView/MapCallout.native.js.map +0 -1
  114. package/lib/commonjs/components/MapView/MapCallout.web.js +0 -47
  115. package/lib/commonjs/components/MapView/MapCallout.web.js.map +0 -1
  116. package/lib/commonjs/components/MapView/MapMarker.native.js +0 -86
  117. package/lib/commonjs/components/MapView/MapMarker.native.js.map +0 -1
  118. package/lib/commonjs/components/MapView/MapMarker.web.js +0 -116
  119. package/lib/commonjs/components/MapView/MapMarker.web.js.map +0 -1
  120. package/lib/commonjs/components/MapView/MapView.native.js +0 -162
  121. package/lib/commonjs/components/MapView/MapView.native.js.map +0 -1
  122. package/lib/commonjs/components/MapView/MapView.web.js +0 -55
  123. package/lib/commonjs/components/MapView/MapView.web.js.map +0 -1
  124. package/lib/commonjs/components/MapView/NoApiKey.js +0 -20
  125. package/lib/commonjs/components/MapView/NoApiKey.js.map +0 -1
  126. package/lib/commonjs/components/MapView/index.js +0 -32
  127. package/lib/commonjs/components/MapView/index.js.map +0 -1
  128. package/lib/commonjs/components/MapView/types.js +0 -5
  129. package/lib/commonjs/components/MapView/types.js.map +0 -1
  130. package/lib/module/components/MapView/MapCallout.native.js +0 -32
  131. package/lib/module/components/MapView/MapCallout.native.js.map +0 -1
  132. package/lib/module/components/MapView/MapCallout.web.js +0 -32
  133. package/lib/module/components/MapView/MapCallout.web.js.map +0 -1
  134. package/lib/module/components/MapView/MapMarker.native.js +0 -71
  135. package/lib/module/components/MapView/MapMarker.native.js.map +0 -1
  136. package/lib/module/components/MapView/MapMarker.web.js +0 -96
  137. package/lib/module/components/MapView/MapMarker.web.js.map +0 -1
  138. package/lib/module/components/MapView/MapView.native.js +0 -144
  139. package/lib/module/components/MapView/MapView.native.js.map +0 -1
  140. package/lib/module/components/MapView/MapView.web.js +0 -38
  141. package/lib/module/components/MapView/MapView.web.js.map +0 -1
  142. package/lib/module/components/MapView/NoApiKey.js +0 -7
  143. package/lib/module/components/MapView/NoApiKey.js.map +0 -1
  144. package/lib/module/components/MapView/index.js +0 -7
  145. package/lib/module/components/MapView/index.js.map +0 -1
  146. package/lib/module/components/MapView/types.js +0 -2
  147. package/lib/module/components/MapView/types.js.map +0 -1
  148. package/lib/typescript/src/components/MapView/MapCallout.native.d.ts +0 -33
  149. package/lib/typescript/src/components/MapView/MapCallout.web.d.ts +0 -4
  150. package/lib/typescript/src/components/MapView/MapMarker.native.d.ts +0 -57
  151. package/lib/typescript/src/components/MapView/MapMarker.web.d.ts +0 -12
  152. package/lib/typescript/src/components/MapView/MapView.native.d.ts +0 -130
  153. package/lib/typescript/src/components/MapView/MapView.web.d.ts +0 -4
  154. package/lib/typescript/src/components/MapView/NoApiKey.d.ts +0 -2
  155. package/lib/typescript/src/components/MapView/index.d.ts +0 -3
  156. package/lib/typescript/src/components/MapView/types.d.ts +0 -35
  157. package/src/components/MapView/MapCallout.native.js +0 -22
  158. package/src/components/MapView/MapCallout.native.tsx +0 -40
  159. package/src/components/MapView/MapCallout.web.js +0 -14
  160. package/src/components/MapView/MapCallout.web.tsx +0 -31
  161. package/src/components/MapView/MapMarker.native.js +0 -52
  162. package/src/components/MapView/MapMarker.native.tsx +0 -83
  163. package/src/components/MapView/MapMarker.web.js +0 -68
  164. package/src/components/MapView/MapMarker.web.tsx +0 -105
  165. package/src/components/MapView/MapView.native.js +0 -118
  166. package/src/components/MapView/MapView.native.tsx +0 -163
  167. package/src/components/MapView/MapView.web.js +0 -18
  168. package/src/components/MapView/MapView.web.tsx +0 -42
  169. package/src/components/MapView/NoApiKey.js +0 -5
  170. package/src/components/MapView/NoApiKey.tsx +0 -10
  171. package/src/components/MapView/index.js +0 -6
  172. package/src/components/MapView/index.tsx +0 -6
  173. package/src/components/MapView/types.js +0 -1
  174. package/src/components/MapView/types.tsx +0 -38
@@ -1,130 +0,0 @@
1
- import * as React from "react";
2
- import { MapViewProps } from "./types";
3
- declare const MapView: React.FC<MapViewProps>;
4
- export default MapView;
5
- export declare const SEED_DATA: {
6
- name: string;
7
- tag: string;
8
- description: string;
9
- category: string;
10
- layout: {};
11
- props: {
12
- apiKey: any;
13
- provider: any;
14
- latitudeDelta: {
15
- label: string;
16
- description: string;
17
- formType: string;
18
- propType: string;
19
- group: string;
20
- defaultValue: null;
21
- editable: boolean;
22
- required: boolean;
23
- step: number;
24
- };
25
- longitudeDelta: {
26
- label: string;
27
- description: string;
28
- formType: string;
29
- propType: string;
30
- group: string;
31
- defaultValue: null;
32
- editable: boolean;
33
- required: boolean;
34
- step: number;
35
- };
36
- latitude: {
37
- label: string;
38
- description: string;
39
- formType: string;
40
- propType: string;
41
- group: string;
42
- defaultValue: null;
43
- editable: boolean;
44
- required: boolean;
45
- step: number;
46
- };
47
- longitude: {
48
- label: string;
49
- description: string;
50
- formType: string;
51
- propType: string;
52
- group: string;
53
- defaultValue: null;
54
- editable: boolean;
55
- required: boolean;
56
- step: number;
57
- };
58
- mapType: any;
59
- zoomEnabled: {
60
- label: string;
61
- description: string;
62
- formType: string;
63
- propType: string;
64
- defaultValue: boolean;
65
- editable: boolean;
66
- required: boolean;
67
- group: string;
68
- };
69
- showsCompass: {
70
- label: string;
71
- description: string;
72
- formType: string;
73
- propType: string;
74
- defaultValue: boolean;
75
- editable: boolean;
76
- required: boolean;
77
- group: string;
78
- };
79
- rotateEnabled: {
80
- label: string;
81
- description: string;
82
- formType: string;
83
- propType: string;
84
- defaultValue: boolean;
85
- editable: boolean;
86
- required: boolean;
87
- group: string;
88
- };
89
- scrollEnabled: {
90
- label: string;
91
- description: string;
92
- formType: string;
93
- propType: string;
94
- defaultValue: boolean;
95
- editable: boolean;
96
- required: boolean;
97
- group: string;
98
- };
99
- loadingEnabled: {
100
- label: string;
101
- description: string;
102
- formType: string;
103
- propType: string;
104
- defaultValue: boolean;
105
- editable: boolean;
106
- required: boolean;
107
- group: string;
108
- };
109
- loadingIndicatorColor: {
110
- group: string;
111
- label: string;
112
- description: string;
113
- editable: boolean;
114
- required: boolean;
115
- defaultValue: null;
116
- formType: string;
117
- propType: string;
118
- };
119
- loadingBackgroundColor: {
120
- group: string;
121
- label: string;
122
- description: string;
123
- editable: boolean;
124
- required: boolean;
125
- defaultValue: null;
126
- formType: string;
127
- propType: string;
128
- };
129
- };
130
- };
@@ -1,4 +0,0 @@
1
- import * as React from "react";
2
- import { MapViewProps } from "./types";
3
- declare const MapView: React.FC<MapViewProps>;
4
- export default MapView;
@@ -1,2 +0,0 @@
1
- declare const NoApiKey: () => JSX.Element;
2
- export default NoApiKey;
@@ -1,3 +0,0 @@
1
- export { default as MapView } from "./MapView";
2
- export { default as MapMarker } from "./MapMarker";
3
- export { default as MapCallout } from "./MapCallout";
@@ -1,35 +0,0 @@
1
- import { StyleProp, ViewStyle } from "react-native";
2
- import { MapTypes } from "react-native-maps";
3
- export interface MapMarkerProps {
4
- latitude: number;
5
- longitude: number;
6
- title?: string;
7
- description?: string;
8
- pinColor?: string;
9
- flat?: boolean;
10
- style?: StyleProp<ViewStyle>;
11
- }
12
- export interface MapViewProps {
13
- apiKey: string;
14
- provider?: "google" | null;
15
- latitudeDelta?: number;
16
- longitudeDelta?: number;
17
- latitude?: number;
18
- longitude?: number;
19
- mapType?: MapTypes;
20
- zoomEnabled?: boolean;
21
- showsCompass?: boolean;
22
- rotateEnabled?: boolean;
23
- scrollEnabled?: boolean;
24
- loadingEnabled?: boolean;
25
- loadingBackgroundColor?: string;
26
- loadingIndicatorColor?: string;
27
- style?: StyleProp<ViewStyle>;
28
- }
29
- export interface CalloutProps {
30
- title?: string;
31
- description?: string;
32
- anchor: any;
33
- onPress?: (event: any) => void;
34
- showTooltip?: boolean;
35
- }
@@ -1,22 +0,0 @@
1
- import * as React from "react";
2
- import { Callout } from "react-native-maps";
3
- import { COMPONENT_TYPES, createActionProp, createBoolProp, } from "@draftbit/types";
4
- const MapCallout = ({ onPress, showTooltip, children, }) => (React.createElement(Callout, { tooltip: !showTooltip, onPress: onPress }, children));
5
- export default MapCallout;
6
- export const SEED_DATA = {
7
- name: "Callout",
8
- tag: "MapCallout",
9
- description: "An info window to display on top of a marker when it is clicked",
10
- category: COMPONENT_TYPES.container,
11
- layout: {},
12
- props: {
13
- onPress: createActionProp({
14
- description: "Action to execute when the callout is pressed",
15
- }),
16
- showTooltip: createBoolProp({
17
- label: "Show Tooltip",
18
- description: 'If false, a default "tooltip" bubble window will be drawn around this callout\'s children. If true, the child views can fully customize their appearance, including any "bubble"-like styles',
19
- defaultValue: false,
20
- }),
21
- },
22
- };
@@ -1,40 +0,0 @@
1
- import * as React from "react";
2
- import { Callout } from "react-native-maps";
3
- import { CalloutProps } from "./types";
4
- import {
5
- COMPONENT_TYPES,
6
- createActionProp,
7
- createBoolProp,
8
- } from "@draftbit/types";
9
-
10
- const MapCallout: React.FC<CalloutProps> = ({
11
- onPress,
12
- showTooltip,
13
- children,
14
- }) => (
15
- <Callout tooltip={!showTooltip} onPress={onPress}>
16
- {children}
17
- </Callout>
18
- );
19
-
20
- export default MapCallout;
21
-
22
- export const SEED_DATA = {
23
- name: "Callout",
24
- tag: "MapCallout",
25
- description:
26
- "An info window to display on top of a marker when it is clicked",
27
- category: COMPONENT_TYPES.container,
28
- layout: {},
29
- props: {
30
- onPress: createActionProp({
31
- description: "Action to execute when the callout is pressed",
32
- }),
33
- showTooltip: createBoolProp({
34
- label: "Show Tooltip",
35
- description:
36
- 'If false, a default "tooltip" bubble window will be drawn around this callout\'s children. If true, the child views can fully customize their appearance, including any "bubble"-like styles',
37
- defaultValue: false,
38
- }),
39
- },
40
- };
@@ -1,14 +0,0 @@
1
- import * as React from "react";
2
- import { TouchableOpacity } from "react-native";
3
- import { InfoWindow } from "@react-google-maps/api";
4
- import { markerContext } from "./MapMarker.web";
5
- const MapCallout = ({ anchor, onPress = () => { }, children, }) => {
6
- const { toggleCallout, position, calloutOpened } = React.useContext(markerContext);
7
- const handleClose = () => toggleCallout(false);
8
- return calloutOpened ? (React.createElement(TouchableOpacity, { onPress: onPress },
9
- React.createElement(InfoWindow, { anchor: anchor, position: {
10
- lat: position?.latitude || 0,
11
- lng: position?.longitude || 0,
12
- }, onCloseClick: handleClose }, children))) : null;
13
- };
14
- export default MapCallout;
@@ -1,31 +0,0 @@
1
- import * as React from "react";
2
- import { TouchableOpacity } from "react-native";
3
- import { InfoWindow } from "@react-google-maps/api";
4
- import { markerContext } from "./MapMarker.web";
5
- import { CalloutProps } from "./types";
6
-
7
- const MapCallout: React.FC<CalloutProps> = ({
8
- anchor,
9
- onPress = () => {},
10
- children,
11
- }) => {
12
- const { toggleCallout, position, calloutOpened } =
13
- React.useContext(markerContext);
14
- const handleClose = () => toggleCallout(false);
15
- return calloutOpened ? (
16
- <TouchableOpacity onPress={onPress}>
17
- <InfoWindow
18
- anchor={anchor}
19
- position={{
20
- lat: position?.latitude || 0,
21
- lng: position?.longitude || 0,
22
- }}
23
- onCloseClick={handleClose}
24
- >
25
- {children}
26
- </InfoWindow>
27
- </TouchableOpacity>
28
- ) : null;
29
- };
30
-
31
- export default MapCallout;
@@ -1,52 +0,0 @@
1
- import * as React from "react";
2
- import { Marker } from "react-native-maps";
3
- import { COMPONENT_TYPES, createBoolProp, createColorProp, createNumberProp, createTextProp, } from "@draftbit/types";
4
- const MapMarker = ({ latitude, longitude, title, description, pinColor, flat, style, children, }) => (React.createElement(Marker, { coordinate: {
5
- latitude,
6
- longitude,
7
- }, title: title, description: description, flat: flat, pinColor: pinColor, style: style }, children));
8
- export default MapMarker;
9
- export const SEED_DATA = {
10
- name: "Map Marker",
11
- tag: "MapMarker",
12
- description: "A marker to show inside map view",
13
- category: COMPONENT_TYPES.button,
14
- layout: {},
15
- props: {
16
- latitude: createNumberProp({
17
- label: "Latitude",
18
- description: "The longitude in which the marker is located",
19
- required: true,
20
- precision: 0.000001,
21
- min: -90,
22
- max: 90,
23
- }),
24
- longitude: createNumberProp({
25
- label: "Latitude",
26
- description: "The latitude in which the marker is located",
27
- required: true,
28
- precision: 0.000001,
29
- min: -180,
30
- max: 180,
31
- }),
32
- title: createTextProp({
33
- label: "Title",
34
- description: "Title to show along with the marker",
35
- defaultValue: null,
36
- }),
37
- description: createTextProp({
38
- label: "Description",
39
- description: "Optional description for the marker",
40
- defaultValue: null,
41
- }),
42
- flat: createBoolProp({
43
- label: "Flat",
44
- description: "Sets whether this marker should be flat against the map (if true) or a billboard facing the camera (if false)",
45
- defaultValue: false,
46
- }),
47
- pinColor: createColorProp({
48
- label: "Pin Color",
49
- description: "Sets the color of the marker",
50
- }),
51
- },
52
- };
@@ -1,83 +0,0 @@
1
- import * as React from "react";
2
- import { Marker } from "react-native-maps";
3
- import { MapMarkerProps } from "./types";
4
- import {
5
- COMPONENT_TYPES,
6
- createBoolProp,
7
- createColorProp,
8
- createNumberProp,
9
- createTextProp,
10
- } from "@draftbit/types";
11
-
12
- const MapMarker: React.FC<MapMarkerProps> = ({
13
- latitude,
14
- longitude,
15
- title,
16
- description,
17
- pinColor,
18
- flat,
19
- style,
20
- children,
21
- }) => (
22
- <Marker
23
- coordinate={{
24
- latitude,
25
- longitude,
26
- }}
27
- title={title}
28
- description={description}
29
- flat={flat}
30
- pinColor={pinColor}
31
- style={style}
32
- >
33
- {children}
34
- </Marker>
35
- );
36
-
37
- export default MapMarker;
38
-
39
- export const SEED_DATA = {
40
- name: "Map Marker",
41
- tag: "MapMarker",
42
- description: "A marker to show inside map view",
43
- category: COMPONENT_TYPES.button,
44
- layout: {},
45
- props: {
46
- latitude: createNumberProp({
47
- label: "Latitude",
48
- description: "The longitude in which the marker is located",
49
- required: true,
50
- precision: 0.000001,
51
- min: -90,
52
- max: 90,
53
- }),
54
- longitude: createNumberProp({
55
- label: "Latitude",
56
- description: "The latitude in which the marker is located",
57
- required: true,
58
- precision: 0.000001,
59
- min: -180,
60
- max: 180,
61
- }),
62
- title: createTextProp({
63
- label: "Title",
64
- description: "Title to show along with the marker",
65
- defaultValue: null,
66
- }),
67
- description: createTextProp({
68
- label: "Description",
69
- description: "Optional description for the marker",
70
- defaultValue: null,
71
- }),
72
- flat: createBoolProp({
73
- label: "Flat",
74
- description:
75
- "Sets whether this marker should be flat against the map (if true) or a billboard facing the camera (if false)",
76
- defaultValue: false,
77
- }),
78
- pinColor: createColorProp({
79
- label: "Pin Color",
80
- description: "Sets the color of the marker",
81
- }),
82
- },
83
- };
@@ -1,68 +0,0 @@
1
- import * as React from "react";
2
- import { View, Text, StyleSheet } from "react-native";
3
- import { Marker as WebMarker } from "@react-google-maps/api";
4
- import MapCallout from "./MapCallout.web";
5
- export const markerContext = React.createContext({
6
- pinColor: "#E74C3C",
7
- calloutOpened: false,
8
- position: undefined,
9
- toggleCallout: () => { },
10
- });
11
- const MapMarker = ({ pinColor, latitude, longitude, title, description, children, }) => {
12
- const { Provider } = markerContext;
13
- const [calloutOpened, toggleCallout] = React.useState(false);
14
- const [marker, setMarker] = React.useState(null);
15
- const handleMarkerClick = () => toggleCallout(true);
16
- const handleOnLoad = (m) => setMarker(m);
17
- let mappedChildren;
18
- if (!children) {
19
- if (title || description) {
20
- mappedChildren = (React.createElement(MapCallout, { showTooltip: true, anchor: marker },
21
- React.createElement(View, { style: style.tooltip },
22
- title && React.createElement(Text, { style: style.title }, title),
23
- description && (React.createElement(Text, { style: style.description }, description)))));
24
- }
25
- }
26
- else {
27
- mappedChildren = React.Children.map(children, (child, index) => {
28
- return React.cloneElement(child, {
29
- index,
30
- anchor: marker,
31
- });
32
- });
33
- }
34
- return (React.createElement(Provider, { value: {
35
- pinColor: pinColor,
36
- calloutOpened,
37
- toggleCallout: (value) => toggleCallout(value),
38
- position: {
39
- latitude,
40
- longitude,
41
- },
42
- } },
43
- React.createElement(WebMarker, { position: {
44
- lat: latitude,
45
- lng: longitude,
46
- }, onClick: handleMarkerClick, onLoad: handleOnLoad, icon: {
47
- path: "m12 0c-4.4183 2.3685e-15 -8 3.5817-8 8 0 1.421 0.3816 2.75 1.0312 3.906 0.1079 0.192 0.221 0.381 0.3438 0.563l6.625 11.531 6.625-11.531c0.102-0.151 0.19-0.311 0.281-0.469l0.063-0.094c0.649-1.156 1.031-2.485 1.031-3.906 0-4.4183-3.582-8-8-8zm0 4c2.209 0 4 1.7909 4 4 0 2.209-1.791 4-4 4-2.2091 0-4-1.791-4-4 0-2.2091 1.7909-4 4-4z",
48
- fillColor: pinColor,
49
- fillOpacity: 1,
50
- strokeWeight: 0,
51
- rotation: 0,
52
- scale: 2,
53
- } }, mappedChildren)));
54
- };
55
- const style = StyleSheet.create({
56
- tooltip: {
57
- display: "flex",
58
- flexDirection: "column",
59
- },
60
- title: {
61
- fontWeight: "600",
62
- textAlign: "center",
63
- },
64
- description: {
65
- textAlign: "center",
66
- },
67
- });
68
- export default MapMarker;
@@ -1,105 +0,0 @@
1
- import * as React from "react";
2
- import { View, Text, StyleSheet } from "react-native";
3
- import { LatLng, MarkerProps } from "react-native-maps";
4
- import { MapMarkerProps } from "./types";
5
- import { Marker as WebMarker } from "@react-google-maps/api";
6
- import MapCallout from "./MapCallout.web";
7
-
8
- interface IMarkerContext {
9
- pinColor?: string | undefined;
10
- calloutOpened: boolean;
11
- position: LatLng | undefined;
12
- toggleCallout: (value: boolean) => void;
13
- }
14
-
15
- export const markerContext = React.createContext<IMarkerContext>({
16
- pinColor: "#E74C3C",
17
- calloutOpened: false,
18
- position: undefined,
19
- toggleCallout: () => {},
20
- });
21
-
22
- const MapMarker: React.FC<MapMarkerProps> = ({
23
- pinColor,
24
- latitude,
25
- longitude,
26
- title,
27
- description,
28
- children,
29
- }) => {
30
- const { Provider } = markerContext;
31
- const [calloutOpened, toggleCallout] = React.useState(false);
32
- const [marker, setMarker] = React.useState<MarkerProps | null>(null);
33
- const handleMarkerClick = () => toggleCallout(true);
34
- const handleOnLoad = (m: any) => setMarker(m);
35
- let mappedChildren;
36
- if (!children) {
37
- if (title || description) {
38
- mappedChildren = (
39
- <MapCallout showTooltip anchor={marker}>
40
- <View style={style.tooltip}>
41
- {title && <Text style={style.title}>{title}</Text>}
42
- {description && (
43
- <Text style={style.description}>{description}</Text>
44
- )}
45
- </View>
46
- </MapCallout>
47
- );
48
- }
49
- } else {
50
- mappedChildren = React.Children.map(children, (child, index) => {
51
- return React.cloneElement(child as React.ReactElement, {
52
- index,
53
- anchor: marker,
54
- });
55
- });
56
- }
57
- return (
58
- <Provider
59
- value={{
60
- pinColor: pinColor,
61
- calloutOpened,
62
- toggleCallout: (value) => toggleCallout(value),
63
- position: {
64
- latitude,
65
- longitude,
66
- },
67
- }}
68
- >
69
- <WebMarker
70
- position={{
71
- lat: latitude,
72
- lng: longitude,
73
- }}
74
- onClick={handleMarkerClick}
75
- onLoad={handleOnLoad}
76
- icon={{
77
- path: "m12 0c-4.4183 2.3685e-15 -8 3.5817-8 8 0 1.421 0.3816 2.75 1.0312 3.906 0.1079 0.192 0.221 0.381 0.3438 0.563l6.625 11.531 6.625-11.531c0.102-0.151 0.19-0.311 0.281-0.469l0.063-0.094c0.649-1.156 1.031-2.485 1.031-3.906 0-4.4183-3.582-8-8-8zm0 4c2.209 0 4 1.7909 4 4 0 2.209-1.791 4-4 4-2.2091 0-4-1.791-4-4 0-2.2091 1.7909-4 4-4z",
78
- fillColor: pinColor,
79
- fillOpacity: 1,
80
- strokeWeight: 0,
81
- rotation: 0,
82
- scale: 2,
83
- }}
84
- >
85
- {mappedChildren}
86
- </WebMarker>
87
- </Provider>
88
- );
89
- };
90
-
91
- const style = StyleSheet.create({
92
- tooltip: {
93
- display: "flex",
94
- flexDirection: "column",
95
- },
96
- title: {
97
- fontWeight: "600",
98
- textAlign: "center",
99
- },
100
- description: {
101
- textAlign: "center",
102
- },
103
- });
104
-
105
- export default MapMarker;