@draftbit/core 46.9.1-e06549.2 → 46.9.1-f483d0.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 (56) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +4 -23
  2. package/lib/commonjs/components/AnimatedCircularProgress.js +1 -12
  3. package/lib/commonjs/components/BottomSheet/BottomSheet.js +88 -0
  4. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +464 -0
  5. package/lib/commonjs/components/BottomSheet/index.js +13 -0
  6. package/lib/commonjs/components/Container.js +4 -15
  7. package/lib/commonjs/components/Picker/Picker.js +13 -3
  8. package/lib/commonjs/components/YotubePlayer.js +38 -0
  9. package/lib/commonjs/index.js +14 -0
  10. package/lib/commonjs/mappings/BottomSheet.js +70 -0
  11. package/lib/commonjs/mappings/YoutubePlayer.js +44 -0
  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/components/Picker/Picker.js +13 -3
  16. package/lib/module/components/YotubePlayer.js +30 -0
  17. package/lib/module/index.js +2 -0
  18. package/lib/module/mappings/BottomSheet.js +63 -0
  19. package/lib/module/mappings/YoutubePlayer.js +37 -0
  20. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +20 -0
  21. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -0
  22. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +170 -0
  23. package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +1 -0
  24. package/lib/typescript/src/components/BottomSheet/index.d.ts +2 -0
  25. package/lib/typescript/src/components/BottomSheet/index.d.ts.map +1 -0
  26. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  27. package/lib/typescript/src/components/YotubePlayer.d.ts +12 -0
  28. package/lib/typescript/src/components/YotubePlayer.d.ts.map +1 -0
  29. package/lib/typescript/src/index.d.ts +2 -0
  30. package/lib/typescript/src/index.d.ts.map +1 -1
  31. package/lib/typescript/src/mappings/{HtmlElements.d.ts → BottomSheet.d.ts} +59 -53
  32. package/lib/typescript/src/mappings/BottomSheet.d.ts.map +1 -0
  33. package/lib/typescript/src/mappings/YoutubePlayer.d.ts +37 -0
  34. package/lib/typescript/src/mappings/YoutubePlayer.d.ts.map +1 -0
  35. package/package.json +8 -5
  36. package/src/components/BottomSheet/BottomSheet.js +56 -0
  37. package/src/components/BottomSheet/BottomSheet.tsx +120 -0
  38. package/src/components/BottomSheet/BottomSheetComponent.js +437 -0
  39. package/src/components/BottomSheet/BottomSheetComponent.tsx +895 -0
  40. package/src/components/BottomSheet/index.js +1 -0
  41. package/src/components/BottomSheet/index.ts +1 -0
  42. package/src/components/Picker/Picker.js +12 -3
  43. package/src/components/Picker/Picker.tsx +12 -3
  44. package/src/components/YotubePlayer.js +10 -0
  45. package/src/components/YotubePlayer.tsx +38 -0
  46. package/src/index.js +2 -0
  47. package/src/index.tsx +4 -0
  48. package/src/mappings/BottomSheet.js +63 -0
  49. package/src/mappings/BottomSheet.ts +77 -0
  50. package/src/mappings/YoutubePlayer.js +37 -0
  51. package/src/mappings/YoutubePlayer.ts +43 -0
  52. package/lib/commonjs/mappings/HtmlElements.js +0 -160
  53. package/lib/module/mappings/HtmlElements.js +0 -153
  54. package/lib/typescript/src/mappings/HtmlElements.d.ts.map +0 -1
  55. package/src/mappings/HtmlElements.js +0 -180
  56. package/src/mappings/HtmlElements.ts +0 -194
@@ -0,0 +1 @@
1
+ export { default as BottomSheet } from "./BottomSheet";
@@ -0,0 +1 @@
1
+ export { default as BottomSheet } from "./BottomSheet";
@@ -38,7 +38,7 @@ const disabledColor = "rgb(240, 240, 240)";
38
38
  const errorColor = "rgba(255, 69, 100, 1)";
39
39
  //Empty string for 'value' is treated as a non-value
40
40
  //reason: Draftbit uses empty string as initial value for string state*/
41
- const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
41
+ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder = "Select an option", value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
42
42
  var _a, _b;
43
43
  const androidPickerRef = React.useRef(undefined);
44
44
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
@@ -67,7 +67,12 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
67
67
  Keyboard.dismiss();
68
68
  }
69
69
  }, [pickerVisible, autoDismissKeyboard]);
70
- const pickerOptions = normalizeOptions(options);
70
+ const normalizedOptions = normalizeOptions(options);
71
+ //Underlying Picker component defaults selection to first element when value is not provided (or undefined)
72
+ //Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
73
+ const pickerOptions = placeholder
74
+ ? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
75
+ : normalizedOptions;
71
76
  const { viewStyles, textStyles } = extractStyles(style);
72
77
  const additionalBorderStyles = ["backgroundColor"];
73
78
  const additionalMarginStyles = [
@@ -162,10 +167,14 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
162
167
  ...(disabled ? { color: unstyledColor } : {}),
163
168
  };
164
169
  const handleValueChange = (newValue, itemIndex) => {
165
- if (newValue !== "") {
170
+ if (newValue !== "" && newValue !== placeholder) {
166
171
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
167
172
  setInternalValue(newValue);
168
173
  }
174
+ else if (newValue === placeholder) {
175
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
176
+ setInternalValue(undefined);
177
+ }
169
178
  };
170
179
  return (
171
180
  /* marginsContainer */
@@ -101,7 +101,7 @@ const Picker: React.FC<PickerProps> = ({
101
101
  defaultValue,
102
102
  Icon,
103
103
  style,
104
- placeholder,
104
+ placeholder = "Select an option",
105
105
  value,
106
106
  disabled = false,
107
107
  assistiveText,
@@ -151,7 +151,13 @@ const Picker: React.FC<PickerProps> = ({
151
151
  }
152
152
  }, [pickerVisible, autoDismissKeyboard]);
153
153
 
154
- const pickerOptions = normalizeOptions(options);
154
+ const normalizedOptions = normalizeOptions(options);
155
+
156
+ //Underlying Picker component defaults selection to first element when value is not provided (or undefined)
157
+ //Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
158
+ const pickerOptions = placeholder
159
+ ? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
160
+ : normalizedOptions;
155
161
 
156
162
  const { viewStyles, textStyles } = extractStyles(style);
157
163
 
@@ -302,9 +308,12 @@ const Picker: React.FC<PickerProps> = ({
302
308
  };
303
309
 
304
310
  const handleValueChange = (newValue: string, itemIndex: number) => {
305
- if (newValue !== "") {
311
+ if (newValue !== "" && newValue !== placeholder) {
306
312
  onValueChange?.(newValue, itemIndex);
307
313
  setInternalValue(newValue);
314
+ } else if (newValue === placeholder) {
315
+ onValueChange?.("", 0);
316
+ setInternalValue(undefined);
308
317
  }
309
318
  };
310
319
 
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import YoutubePlayerComponent from "react-native-youtube-iframe";
3
+ import { extractStyles } from "../utilities";
4
+ const YoutubePlayer = ({ videoId, playlist, mute = false, autoplay = false, style, }) => {
5
+ const { viewStyles } = extractStyles(style);
6
+ const { height, width } = viewStyles;
7
+ const defaultVideoId = "nwMUpDESXrI";
8
+ return (React.createElement(YoutubePlayerComponent, { height: height, width: width, play: autoplay, videoId: !videoId && !playlist ? defaultVideoId : videoId, playList: playlist, mute: mute, webViewStyle: style }));
9
+ };
10
+ export default YoutubePlayer;
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import YoutubePlayerComponent from "react-native-youtube-iframe";
4
+ import { extractStyles } from "../utilities";
5
+
6
+ interface YoutubePlayerProps {
7
+ videoId?: string;
8
+ playlist?: string;
9
+ mute?: boolean;
10
+ autoplay?: boolean;
11
+ style?: StyleProp<ViewStyle>;
12
+ }
13
+
14
+ const YoutubePlayer: React.FC<YoutubePlayerProps> = ({
15
+ videoId,
16
+ playlist,
17
+ mute = false,
18
+ autoplay = false,
19
+ style,
20
+ }) => {
21
+ const { viewStyles } = extractStyles(style);
22
+ const { height, width } = viewStyles;
23
+ const defaultVideoId = "nwMUpDESXrI";
24
+
25
+ return (
26
+ <YoutubePlayerComponent
27
+ height={height}
28
+ width={width}
29
+ play={autoplay}
30
+ videoId={!videoId && !playlist ? defaultVideoId : videoId}
31
+ playList={playlist}
32
+ mute={mute}
33
+ webViewStyle={style}
34
+ />
35
+ );
36
+ };
37
+
38
+ export default YoutubePlayer;
package/src/index.js CHANGED
@@ -35,6 +35,8 @@ export { default as Shadow } from "./components/Shadow";
35
35
  export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
36
36
  export { TabView, TabViewItem } from "./components/TabView";
37
37
  export { default as Markdown } from "./components/Markdown";
38
+ export { BottomSheet } from "./components/BottomSheet";
39
+ export { default as YoutubePlayer } from "./components/YotubePlayer";
38
40
  /* Deprecated: Fix or Delete! */
39
41
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
40
42
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -58,6 +58,10 @@ export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
58
58
  export { TabView, TabViewItem } from "./components/TabView";
59
59
  export { default as Markdown } from "./components/Markdown";
60
60
 
61
+ export { BottomSheet } from "./components/BottomSheet";
62
+
63
+ export { default as YoutubePlayer } from "./components/YotubePlayer";
64
+
61
65
  /* Deprecated: Fix or Delete! */
62
66
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
63
67
  export { default as Picker } from "./components/Picker/Picker";
@@ -0,0 +1,63 @@
1
+ import { COMPONENT_TYPES, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, createColorProp, createStaticNumberProp, createArrayProp, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Bottom Sheet",
4
+ tag: "BottomSheet",
5
+ description: "A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
6
+ category: COMPONENT_TYPES.bottomsheet,
7
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
+ triggers: [Triggers.OnSettle],
9
+ props: {
10
+ onSettle: createActionProp({
11
+ label: "On settle",
12
+ description: "Action to execute when sheet settles on a snap point",
13
+ }),
14
+ snapPoints: createArrayProp({
15
+ label: "Snap points",
16
+ 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)",
17
+ defaultValue: ["10%", "50%", "80%"],
18
+ }),
19
+ initialSnapIndex: createStaticNumberProp({
20
+ label: "Initial snap index",
21
+ description: "Index of the snap point to be used as the initial point",
22
+ defaultValue: 0,
23
+ required: false,
24
+ }),
25
+ showHandle: createStaticBoolProp({
26
+ label: "Show handle",
27
+ description: "Whether to show the top sheet handle or not",
28
+ defaultValue: true,
29
+ }),
30
+ handleColor: createColorProp({
31
+ label: "Handle color",
32
+ description: "Color of the top handle",
33
+ defaultValue: "divider",
34
+ }),
35
+ topBorderRadius: createStaticNumberProp({
36
+ label: "Top border radius",
37
+ description: "Border radius of top corners",
38
+ defaultValue: 20,
39
+ required: false,
40
+ }),
41
+ borderWidth: createStaticNumberProp({
42
+ label: "Border width",
43
+ description: "Width of bottom sheet borders",
44
+ defaultValue: 1,
45
+ required: false,
46
+ }),
47
+ borderColor: createColorProp({
48
+ label: "Border color",
49
+ description: "Color of bottom sheet borders",
50
+ defaultValue: "divider",
51
+ }),
52
+ showsVerticalScrollIndicator: createStaticBoolProp({
53
+ label: "Show Vertical Scroll Indicator",
54
+ description: "When true, shows a vertical scroll indicator. The default value is true.",
55
+ defaultValue: true,
56
+ }),
57
+ bounces: createStaticBoolProp({
58
+ label: "Bounce",
59
+ 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.",
60
+ defaultValue: true,
61
+ }),
62
+ },
63
+ };
@@ -0,0 +1,77 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createStaticBoolProp,
4
+ CONTAINER_COMPONENT_STYLES_SECTIONS,
5
+ Triggers,
6
+ createActionProp,
7
+ createColorProp,
8
+ createStaticNumberProp,
9
+ createArrayProp,
10
+ } from "@draftbit/types";
11
+
12
+ export const SEED_DATA = {
13
+ name: "Bottom Sheet",
14
+ tag: "BottomSheet",
15
+ description:
16
+ "A draggable Bottom sheet that snaps to specific points. Renders children in ScrollView",
17
+ category: COMPONENT_TYPES.bottomsheet,
18
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
19
+ triggers: [Triggers.OnSettle],
20
+ props: {
21
+ onSettle: createActionProp({
22
+ label: "On settle",
23
+ description: "Action to execute when sheet settles on a snap point",
24
+ }),
25
+ snapPoints: createArrayProp({
26
+ label: "Snap points",
27
+ description:
28
+ "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)",
29
+ defaultValue: ["10%", "50%", "80%"],
30
+ }),
31
+ initialSnapIndex: createStaticNumberProp({
32
+ label: "Initial snap index",
33
+ description: "Index of the snap point to be used as the initial point",
34
+ defaultValue: 0,
35
+ required: false,
36
+ }),
37
+ showHandle: createStaticBoolProp({
38
+ label: "Show handle",
39
+ description: "Whether to show the top sheet handle or not",
40
+ defaultValue: true,
41
+ }),
42
+ handleColor: createColorProp({
43
+ label: "Handle color",
44
+ description: "Color of the top handle",
45
+ defaultValue: "divider",
46
+ }),
47
+ topBorderRadius: createStaticNumberProp({
48
+ label: "Top border radius",
49
+ description: "Border radius of top corners",
50
+ defaultValue: 20,
51
+ required: false,
52
+ }),
53
+ borderWidth: createStaticNumberProp({
54
+ label: "Border width",
55
+ description: "Width of bottom sheet borders",
56
+ defaultValue: 1,
57
+ required: false,
58
+ }),
59
+ borderColor: createColorProp({
60
+ label: "Border color",
61
+ description: "Color of bottom sheet borders",
62
+ defaultValue: "divider",
63
+ }),
64
+ showsVerticalScrollIndicator: createStaticBoolProp({
65
+ label: "Show Vertical Scroll Indicator",
66
+ description:
67
+ "When true, shows a vertical scroll indicator. The default value is true.",
68
+ defaultValue: true,
69
+ }),
70
+ bounces: createStaticBoolProp({
71
+ label: "Bounce",
72
+ description:
73
+ "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.",
74
+ defaultValue: true,
75
+ }),
76
+ },
77
+ };
@@ -0,0 +1,37 @@
1
+ import { BLOCK_STYLES_SECTIONS, COMPONENT_TYPES, createStaticBoolProp, createTextProp, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Youtube Player",
4
+ tag: "YoutubePlayer",
5
+ description: "Plays a youtube video form a Youtube video or playlist id",
6
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
7
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
8
+ category: COMPONENT_TYPES.media,
9
+ stylesPanelSections: BLOCK_STYLES_SECTIONS,
10
+ layout: {
11
+ height: 250,
12
+ },
13
+ props: {
14
+ videoId: createTextProp({
15
+ label: "Video ID",
16
+ description: "VideoId of the Youtube video.",
17
+ defaultValue: null,
18
+ }),
19
+ playlist: createTextProp({
20
+ label: "Playlist",
21
+ description: "Playlist of the Youtube videos.",
22
+ defaultValue: null,
23
+ }),
24
+ mute: createStaticBoolProp({
25
+ label: "Mute Audio",
26
+ description: "Mute the audio of the video.",
27
+ defaultValue: false,
28
+ required: false,
29
+ }),
30
+ autoplay: createStaticBoolProp({
31
+ label: "Auto Play",
32
+ description: "Autoplay the video on load.",
33
+ defaultValue: false,
34
+ required: false,
35
+ }),
36
+ },
37
+ };
@@ -0,0 +1,43 @@
1
+ import {
2
+ BLOCK_STYLES_SECTIONS,
3
+ COMPONENT_TYPES,
4
+ createStaticBoolProp,
5
+ createTextProp,
6
+ } from "@draftbit/types";
7
+
8
+ export const SEED_DATA = {
9
+ name: "Youtube Player",
10
+ tag: "YoutubePlayer",
11
+ description: "Plays a youtube video form a Youtube video or playlist id",
12
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
13
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
14
+ category: COMPONENT_TYPES.media,
15
+ stylesPanelSections: BLOCK_STYLES_SECTIONS,
16
+ layout: {
17
+ height: 250,
18
+ },
19
+ props: {
20
+ videoId: createTextProp({
21
+ label: "Video ID",
22
+ description: "VideoId of the Youtube video.",
23
+ defaultValue: null,
24
+ }),
25
+ playlist: createTextProp({
26
+ label: "Playlist",
27
+ description: "Playlist of the Youtube videos.",
28
+ defaultValue: null,
29
+ }),
30
+ mute: createStaticBoolProp({
31
+ label: "Mute Audio",
32
+ description: "Mute the audio of the video.",
33
+ defaultValue: false,
34
+ required: false,
35
+ }),
36
+ autoplay: createStaticBoolProp({
37
+ label: "Auto Play",
38
+ description: "Autoplay the video on load.",
39
+ defaultValue: false,
40
+ required: false,
41
+ }),
42
+ },
43
+ };
@@ -1,160 +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 ELEMENT_SEED_DATA = {
9
- doc_link: "https://www.npmjs.com/package/@expo/html-elements",
10
- code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
11
- packageName: "@expo/html-elements",
12
- stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
13
- category: _types.COMPONENT_TYPES.webelement
14
- };
15
- const TEXT_SEED_DATA = {
16
- ...ELEMENT_SEED_DATA,
17
- category: _types.COMPONENT_TYPES.text,
18
- stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Effects],
19
- layout: {
20
- color: "strong"
21
- },
22
- props: {
23
- children: {
24
- group: _types.GROUPS.data,
25
- label: "Text",
26
- description: "Text",
27
- defaultValue: "Double click me to edit 👀",
28
- editable: true,
29
- required: true,
30
- formType: _types.FORM_TYPES.string,
31
- propType: _types.PROP_TYPES.STRING
32
- },
33
- accessibilityLabel: {
34
- group: _types.GROUPS.accessibility,
35
- name: "accessibilityLabel",
36
- label: "accessibilityLabel",
37
- description: "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
38
- editable: true,
39
- required: false,
40
- formType: _types.FORM_TYPES.string,
41
- propType: _types.PROP_TYPES.STRING,
42
- defaultValue: null
43
- },
44
- selectable: {
45
- group: _types.GROUPS.advanced,
46
- name: "selectable",
47
- label: "selectable",
48
- description: "Lets the user select text, to use the native copy and paste functionality.",
49
- editable: true,
50
- required: false,
51
- formType: _types.FORM_TYPES.boolean,
52
- propType: _types.PROP_TYPES.BOOLEAN,
53
- defaultValue: true
54
- }
55
- }
56
- };
57
- const SEED_DATA = [{
58
- name: "Heading 1",
59
- tag: "H1",
60
- ...TEXT_SEED_DATA
61
- }, {
62
- name: "Heading 2",
63
- tag: "H2",
64
- ...TEXT_SEED_DATA
65
- }, {
66
- name: "Heading 3",
67
- tag: "H3",
68
- ...TEXT_SEED_DATA
69
- }, {
70
- name: "Heading 4",
71
- tag: "H4",
72
- ...TEXT_SEED_DATA
73
- }, {
74
- name: "Heading 5",
75
- tag: "H5",
76
- ...TEXT_SEED_DATA
77
- }, {
78
- name: "Heading 6",
79
- tag: "H6",
80
- ...TEXT_SEED_DATA
81
- }, {
82
- name: "Paragraph",
83
- tag: "P",
84
- ...TEXT_SEED_DATA
85
- }, {
86
- name: "Bold",
87
- tag: "B",
88
- ...TEXT_SEED_DATA
89
- }, {
90
- name: "Strikethrough",
91
- tag: "S",
92
- ...TEXT_SEED_DATA
93
- }, {
94
- name: "Italic",
95
- tag: "I",
96
- ...TEXT_SEED_DATA
97
- }, {
98
- name: "Code",
99
- tag: "Code",
100
- ...TEXT_SEED_DATA
101
- }, {
102
- name: "Preformatted",
103
- tag: "Pre",
104
- ...TEXT_SEED_DATA
105
- }, {
106
- name: "Mark",
107
- tag: "Mark",
108
- ...TEXT_SEED_DATA
109
- }, {
110
- name: "Block Quote",
111
- tag: "BlockQuote",
112
- ...TEXT_SEED_DATA
113
- }, {
114
- name: "Quoted",
115
- tag: "Q",
116
- ...TEXT_SEED_DATA
117
- }, {
118
- name: "Time",
119
- tag: "Time",
120
- ...TEXT_SEED_DATA
121
- }, {
122
- name: "Unordered List",
123
- tag: "UL",
124
- ...ELEMENT_SEED_DATA
125
- }, {
126
- name: "List Item",
127
- tag: "LI",
128
- ...TEXT_SEED_DATA,
129
- category: _types.COMPONENT_TYPES.webelement
130
- }, {
131
- name: "Line Break",
132
- tag: "BR",
133
- ...ELEMENT_SEED_DATA
134
- }, {
135
- name: "Horizontal Rule",
136
- tag: "HR",
137
- ...ELEMENT_SEED_DATA
138
- }, {
139
- name: "Anchor",
140
- tag: "A",
141
- ...TEXT_SEED_DATA,
142
- props: {
143
- ...TEXT_SEED_DATA.props,
144
- href: (0, _types.createTextProp)({
145
- label: "href",
146
- description: "Specify the URL",
147
- defaultValue: ""
148
- }),
149
- target: {
150
- group: _types.GROUPS.basic,
151
- label: "target",
152
- description: "decide where link should open",
153
- formType: _types.FORM_TYPES.flatArray,
154
- defaultValue: "_blank",
155
- options: ["_blank", "_self", "_parent", "_top"]
156
- }
157
- },
158
- category: _types.COMPONENT_TYPES.webelement
159
- }];
160
- exports.SEED_DATA = SEED_DATA;
@@ -1,153 +0,0 @@
1
- import { COMPONENT_TYPES, createTextProp, FORM_TYPES, PROP_TYPES, GROUPS, StylesPanelSections, BLOCK_STYLES_SECTIONS } from "@draftbit/types";
2
- const ELEMENT_SEED_DATA = {
3
- doc_link: "https://www.npmjs.com/package/@expo/html-elements",
4
- code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
5
- packageName: "@expo/html-elements",
6
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
7
- category: COMPONENT_TYPES.webelement
8
- };
9
- const TEXT_SEED_DATA = {
10
- ...ELEMENT_SEED_DATA,
11
- category: COMPONENT_TYPES.text,
12
- stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.LayoutSelectedItem, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Effects],
13
- layout: {
14
- color: "strong"
15
- },
16
- props: {
17
- children: {
18
- group: GROUPS.data,
19
- label: "Text",
20
- description: "Text",
21
- defaultValue: "Double click me to edit 👀",
22
- editable: true,
23
- required: true,
24
- formType: FORM_TYPES.string,
25
- propType: PROP_TYPES.STRING
26
- },
27
- accessibilityLabel: {
28
- group: GROUPS.accessibility,
29
- name: "accessibilityLabel",
30
- label: "accessibilityLabel",
31
- description: "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
32
- editable: true,
33
- required: false,
34
- formType: FORM_TYPES.string,
35
- propType: PROP_TYPES.STRING,
36
- defaultValue: null
37
- },
38
- selectable: {
39
- group: GROUPS.advanced,
40
- name: "selectable",
41
- label: "selectable",
42
- description: "Lets the user select text, to use the native copy and paste functionality.",
43
- editable: true,
44
- required: false,
45
- formType: FORM_TYPES.boolean,
46
- propType: PROP_TYPES.BOOLEAN,
47
- defaultValue: true
48
- }
49
- }
50
- };
51
- export const SEED_DATA = [{
52
- name: "Heading 1",
53
- tag: "H1",
54
- ...TEXT_SEED_DATA
55
- }, {
56
- name: "Heading 2",
57
- tag: "H2",
58
- ...TEXT_SEED_DATA
59
- }, {
60
- name: "Heading 3",
61
- tag: "H3",
62
- ...TEXT_SEED_DATA
63
- }, {
64
- name: "Heading 4",
65
- tag: "H4",
66
- ...TEXT_SEED_DATA
67
- }, {
68
- name: "Heading 5",
69
- tag: "H5",
70
- ...TEXT_SEED_DATA
71
- }, {
72
- name: "Heading 6",
73
- tag: "H6",
74
- ...TEXT_SEED_DATA
75
- }, {
76
- name: "Paragraph",
77
- tag: "P",
78
- ...TEXT_SEED_DATA
79
- }, {
80
- name: "Bold",
81
- tag: "B",
82
- ...TEXT_SEED_DATA
83
- }, {
84
- name: "Strikethrough",
85
- tag: "S",
86
- ...TEXT_SEED_DATA
87
- }, {
88
- name: "Italic",
89
- tag: "I",
90
- ...TEXT_SEED_DATA
91
- }, {
92
- name: "Code",
93
- tag: "Code",
94
- ...TEXT_SEED_DATA
95
- }, {
96
- name: "Preformatted",
97
- tag: "Pre",
98
- ...TEXT_SEED_DATA
99
- }, {
100
- name: "Mark",
101
- tag: "Mark",
102
- ...TEXT_SEED_DATA
103
- }, {
104
- name: "Block Quote",
105
- tag: "BlockQuote",
106
- ...TEXT_SEED_DATA
107
- }, {
108
- name: "Quoted",
109
- tag: "Q",
110
- ...TEXT_SEED_DATA
111
- }, {
112
- name: "Time",
113
- tag: "Time",
114
- ...TEXT_SEED_DATA
115
- }, {
116
- name: "Unordered List",
117
- tag: "UL",
118
- ...ELEMENT_SEED_DATA
119
- }, {
120
- name: "List Item",
121
- tag: "LI",
122
- ...TEXT_SEED_DATA,
123
- category: COMPONENT_TYPES.webelement
124
- }, {
125
- name: "Line Break",
126
- tag: "BR",
127
- ...ELEMENT_SEED_DATA
128
- }, {
129
- name: "Horizontal Rule",
130
- tag: "HR",
131
- ...ELEMENT_SEED_DATA
132
- }, {
133
- name: "Anchor",
134
- tag: "A",
135
- ...TEXT_SEED_DATA,
136
- props: {
137
- ...TEXT_SEED_DATA.props,
138
- href: createTextProp({
139
- label: "href",
140
- description: "Specify the URL",
141
- defaultValue: ""
142
- }),
143
- target: {
144
- group: GROUPS.basic,
145
- label: "target",
146
- description: "decide where link should open",
147
- formType: FORM_TYPES.flatArray,
148
- defaultValue: "_blank",
149
- options: ["_blank", "_self", "_parent", "_top"]
150
- }
151
- },
152
- category: COMPONENT_TYPES.webelement
153
- }];