@draftbit/core 46.4.4-ae1fa9.2 → 46.4.4-b0ea41.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 (38) hide show
  1. package/lib/commonjs/components/DatePicker/DatePicker.js +18 -8
  2. package/lib/commonjs/components/Text.js +6 -2
  3. package/lib/commonjs/components/TextField.js +5 -1
  4. package/lib/commonjs/mappings/DatePicker.js +13 -0
  5. package/lib/commonjs/mappings/TextField.js +1 -1
  6. package/lib/commonjs/mappings/TextInput.js +1 -1
  7. package/lib/module/components/AspectRatio.js +2 -19
  8. package/lib/module/components/DatePicker/DatePicker.js +17 -8
  9. package/lib/module/components/Divider.js +2 -20
  10. package/lib/module/components/Text.js +6 -2
  11. package/lib/module/components/TextField.js +5 -1
  12. package/lib/module/mappings/DatePicker.js +14 -1
  13. package/lib/module/mappings/TextField.js +1 -1
  14. package/lib/module/mappings/TextInput.js +1 -1
  15. package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
  16. package/lib/typescript/src/components/Text.d.ts +2 -1
  17. package/lib/typescript/src/components/TextField.d.ts +2 -1
  18. package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
  19. package/lib/typescript/src/mappings/TextField.d.ts +2 -2
  20. package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
  21. package/package.json +3 -4
  22. package/src/components/DatePicker/DatePicker.js +14 -8
  23. package/src/components/DatePicker/DatePicker.tsx +23 -7
  24. package/src/components/Text.js +8 -2
  25. package/src/components/Text.tsx +6 -1
  26. package/src/components/TextField.js +6 -1
  27. package/src/components/TextField.tsx +7 -1
  28. package/src/mappings/DatePicker.js +21 -1
  29. package/src/mappings/DatePicker.ts +23 -0
  30. package/src/mappings/TextField.js +1 -1
  31. package/src/mappings/TextField.ts +1 -1
  32. package/src/mappings/TextInput.js +1 -1
  33. package/src/mappings/TextInput.ts +1 -1
  34. package/lib/commonjs/mappings/Elements.js +0 -127
  35. package/lib/module/mappings/Elements.js +0 -119
  36. package/lib/typescript/src/mappings/Elements.d.ts +0 -43
  37. package/src/mappings/Elements.js +0 -141
  38. package/src/mappings/Elements.ts +0 -150
@@ -6,6 +6,7 @@ import { withTheme } from "../../theming";
6
6
  import Portal from "../Portal/Portal";
7
7
  import Touchable from "../Touchable";
8
8
  import DateTimePicker from "./DatePickerComponent";
9
+ import { extractStyles } from "../../utilities";
9
10
  const AnimatedText = Animated.createAnimatedComponent(Text);
10
11
  const FOCUS_ANIMATION_DURATION = 150;
11
12
  const BLUR_ANIMATION_DURATION = 180;
@@ -24,7 +25,7 @@ const MONTHS = [
24
25
  "November",
25
26
  "December",
26
27
  ];
27
- const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, placeholder, ...props }) => {
28
+ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
28
29
  const [value, setValue] = React.useState(date || defaultValue);
29
30
  React.useEffect(() => {
30
31
  if (defaultValue != null) {
@@ -36,6 +37,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
36
37
  const [placeholder1, setPlaceholder1] = React.useState("");
37
38
  const [focused, setFocused] = React.useState(false);
38
39
  const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
40
+ const { textStyles } = extractStyles(style);
39
41
  const getValidDate = () => {
40
42
  if (!value) {
41
43
  return new Date();
@@ -125,8 +127,10 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
125
127
  };
126
128
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
127
129
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
128
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
129
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
130
+ const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
131
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize
132
+ ? labelSize
133
+ : typography.caption.fontSize;
130
134
  const hasActiveOutline = focused;
131
135
  let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
132
136
  inputTextColor = colors.strong;
@@ -138,9 +142,9 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
138
142
  backgroundColor = colors.divider;
139
143
  }
140
144
  else {
141
- activeColor = colors.primary;
142
- placeholderColor = borderColor = colors.light;
143
- underlineColor = colors.light;
145
+ activeColor = inputBorderColorActive || colors.primary;
146
+ placeholderColor = borderColor = inputBorderColor || colors.light;
147
+ underlineColor = inputBorderColor || colors.light;
144
148
  backgroundColor = colors.background;
145
149
  }
146
150
  const { lineHeight, ...subtitle1 } = typography.subtitle1;
@@ -202,6 +206,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
202
206
  const labelStyle = {
203
207
  ...typography.subtitle1,
204
208
  top: type === "solid" ? 16 : 0,
209
+ fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
205
210
  left: leftIconName && leftIconMode === "inset"
206
211
  ? ICON_SIZE + (type === "solid" ? 16 : 12)
207
212
  : 0,
@@ -245,6 +250,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
245
250
  styles.input,
246
251
  inputStyle,
247
252
  type === "solid" ? { marginHorizontal: 12 } : {},
253
+ textStyles,
248
254
  ];
249
255
  // const render = (props) => <NativeTextInput {...props} />;
250
256
  return (React.createElement(View, { style: [styles.container, style] },
@@ -282,7 +288,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
282
288
  type === "solid" ? { paddingHorizontal: 12 } : {},
283
289
  labelStyle,
284
290
  {
285
- color: colors.light,
291
+ color: labelColor || colors.light,
286
292
  opacity: labeled.interpolate({
287
293
  inputRange: [0, 1],
288
294
  outputRange: [hasActiveOutline ? 1 : 0, 0],
@@ -294,7 +300,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
294
300
  type === "solid" ? { paddingHorizontal: 12 } : {},
295
301
  labelStyle,
296
302
  {
297
- color: placeholderColor,
303
+ color: labelColor || placeholder,
298
304
  opacity: hasActiveOutline ? labeled : 1,
299
305
  },
300
306
  ], numberOfLines: 1 }, label))) : null,
@@ -23,6 +23,7 @@ import DateTimePicker from "./DatePickerComponent";
23
23
 
24
24
  import type { Theme } from "../../styles/DefaultTheme";
25
25
  import type { IconSlot } from "../../interfaces/Icon";
26
+ import { extractStyles } from "../../utilities";
26
27
 
27
28
  const AnimatedText = Animated.createAnimatedComponent(Text);
28
29
 
@@ -47,10 +48,14 @@ type Props = {
47
48
  mode?: "date" | "time" | "datetime";
48
49
  type?: "solid" | "underline";
49
50
  label?: string;
51
+ labelSize?: number;
52
+ labelColor: string;
50
53
  placeholder?: string;
51
54
  leftIconName?: string;
52
55
  leftIconMode?: "outset" | "inset";
53
56
  rightIconName?: string;
57
+ borderColor?: string;
58
+ borderColorActive?: string;
54
59
  } & IconSlot &
55
60
  TextInputProps;
56
61
 
@@ -84,7 +89,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
84
89
  rightIconName,
85
90
  leftIconMode = "inset",
86
91
  label,
92
+ labelSize,
93
+ labelColor,
87
94
  placeholder,
95
+ borderColor: inputBorderColor,
96
+ borderColorActive: inputBorderColorActive,
88
97
  ...props
89
98
  }) => {
90
99
  const [value, setValue] = React.useState<any>(date || defaultValue);
@@ -106,6 +115,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
106
115
  width: number;
107
116
  }>({ measured: false, width: 0 });
108
117
 
118
+ const { textStyles } = extractStyles(style);
119
+
109
120
  const getValidDate = (): Date => {
110
121
  if (!value) {
111
122
  return new Date();
@@ -211,8 +222,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
211
222
 
212
223
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
213
224
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
214
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
215
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
225
+ const MAXIMIZED_LABEL_FONT_SIZE =
226
+ textStyles?.fontSize || typography.subtitle1.fontSize;
227
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize
228
+ ? labelSize
229
+ : typography.caption.fontSize;
216
230
 
217
231
  const hasActiveOutline = focused;
218
232
 
@@ -233,9 +247,9 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
233
247
  underlineColor = "transparent";
234
248
  backgroundColor = colors.divider;
235
249
  } else {
236
- activeColor = colors.primary;
237
- placeholderColor = borderColor = colors.light;
238
- underlineColor = colors.light;
250
+ activeColor = inputBorderColorActive || colors.primary;
251
+ placeholderColor = borderColor = inputBorderColor || colors.light;
252
+ underlineColor = inputBorderColor || colors.light;
239
253
  backgroundColor = colors.background;
240
254
  }
241
255
 
@@ -306,6 +320,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
306
320
  const labelStyle = {
307
321
  ...typography.subtitle1,
308
322
  top: type === "solid" ? 16 : 0,
323
+ fontFamily: textStyles?.fontFamily,
309
324
  left:
310
325
  leftIconName && leftIconMode === "inset"
311
326
  ? ICON_SIZE + (type === "solid" ? 16 : 12)
@@ -351,6 +366,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
351
366
  styles.input,
352
367
  inputStyle,
353
368
  type === "solid" ? { marginHorizontal: 12 } : {},
369
+ textStyles,
354
370
  ];
355
371
 
356
372
  // const render = (props) => <NativeTextInput {...props} />;
@@ -406,7 +422,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
406
422
  type === "solid" ? { paddingHorizontal: 12 } : {},
407
423
  labelStyle,
408
424
  {
409
- color: colors.light,
425
+ color: labelColor || colors.light,
410
426
  opacity: labeled.interpolate({
411
427
  inputRange: [0, 1],
412
428
  outputRange: [hasActiveOutline ? 1 : 0, 0],
@@ -423,7 +439,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
423
439
  type === "solid" ? { paddingHorizontal: 12 } : {},
424
440
  labelStyle,
425
441
  {
426
- color: placeholderColor,
442
+ color: labelColor || placeholder,
427
443
  opacity: hasActiveOutline ? labeled : 1,
428
444
  },
429
445
  ]}
@@ -2,13 +2,19 @@ import * as React from "react";
2
2
  import { Text as NativeText, I18nManager } from "react-native";
3
3
  import { withTheme } from "../theming";
4
4
  class Text extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.state = {
8
+ nativeProps: {},
9
+ };
10
+ }
5
11
  setNativeProps(args) {
6
- return this._root && this._root.setNativeProps(args);
12
+ this.state.nativeProps = args || {};
7
13
  }
8
14
  render() {
9
15
  const { style, ...rest } = this.props;
10
16
  const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
11
- return (React.createElement(NativeText, { ...rest, ref: (c) => {
17
+ return (React.createElement(NativeText, { ...rest, ...this.state.nativeProps, ref: (c) => {
12
18
  this._root = c;
13
19
  }, style: [
14
20
  {
@@ -10,8 +10,12 @@ type Props = {
10
10
  class Text extends React.Component<Props> {
11
11
  _root: any;
12
12
 
13
+ state: any = {
14
+ nativeProps: {},
15
+ };
16
+
13
17
  setNativeProps(args: TextProps) {
14
- return this._root && this._root.setNativeProps(args);
18
+ this.state.nativeProps = args || {};
15
19
  }
16
20
 
17
21
  render() {
@@ -21,6 +25,7 @@ class Text extends React.Component<Props> {
21
25
  return (
22
26
  <NativeText
23
27
  {...rest}
28
+ {...this.state.nativeProps}
24
29
  ref={(c) => {
25
30
  this._root = c;
26
31
  }}
@@ -10,6 +10,7 @@ class TextField extends React.Component {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  this.state = {
13
+ nativeProps: {},
13
14
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
14
15
  focused: false,
15
16
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -121,7 +122,10 @@ class TextField extends React.Component {
121
122
  * @internal
122
123
  */
123
124
  setNativeProps(args) {
124
- return this._root && this._root.setNativeProps(args);
125
+ this.setState((state) => ({
126
+ ...state,
127
+ nativeState: args || {},
128
+ }));
125
129
  }
126
130
  isFocused() {
127
131
  return this._root && this._root.isFocused();
@@ -381,6 +385,7 @@ class TextField extends React.Component {
381
385
  underlineColorAndroid: "transparent",
382
386
  style: inputStyles,
383
387
  ...rest,
388
+ ...this.state.nativeProps,
384
389
  value: this.state.value,
385
390
  })),
386
391
  rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
@@ -52,6 +52,7 @@ export type Props = {
52
52
  IconSlot;
53
53
 
54
54
  interface State {
55
+ nativeProps: any;
55
56
  labeled: Animated.Value;
56
57
  focused?: boolean;
57
58
  placeholder?: string | undefined;
@@ -73,6 +74,7 @@ class TextField extends React.Component<Props, State> {
73
74
  }
74
75
 
75
76
  state: State = {
77
+ nativeProps: {},
76
78
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
77
79
  focused: false,
78
80
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -207,7 +209,10 @@ class TextField extends React.Component<Props, State> {
207
209
  * @internal
208
210
  */
209
211
  setNativeProps(args: Props) {
210
- return this._root && this._root.setNativeProps(args);
212
+ this.setState((state) => ({
213
+ ...state,
214
+ nativeState: args || {},
215
+ }));
211
216
  }
212
217
 
213
218
  isFocused() {
@@ -566,6 +571,7 @@ class TextField extends React.Component<Props, State> {
566
571
  underlineColorAndroid: "transparent",
567
572
  style: inputStyles,
568
573
  ...rest,
574
+ ...this.state.nativeProps,
569
575
  value: this.state.value,
570
576
  })}
571
577
  </View>
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
2
2
  const SEED_DATA_PROPS = {
3
3
  label: {
4
4
  label: "Label",
@@ -10,6 +10,12 @@ const SEED_DATA_PROPS = {
10
10
  required: true,
11
11
  group: GROUPS.data,
12
12
  },
13
+ labelSize: createNumberProp({
14
+ label: "Label Size",
15
+ }),
16
+ labelColor: createColorProp({
17
+ label: "Label Color",
18
+ }),
13
19
  mode: {
14
20
  label: "Mode",
15
21
  description: "Choose between date, time and datetime",
@@ -21,6 +27,12 @@ const SEED_DATA_PROPS = {
21
27
  options: ["date", "time", "datetime"],
22
28
  group: GROUPS.basic,
23
29
  },
30
+ borderColor: createColorProp({
31
+ label: "Border Color",
32
+ }),
33
+ borderColorActive: createColorProp({
34
+ label: "Border Color",
35
+ }),
24
36
  format: {
25
37
  label: "Format",
26
38
  description: "Create an output format for the date.",
@@ -139,6 +151,14 @@ export const SEED_DATA = [
139
151
  category: COMPONENT_TYPES.input,
140
152
  layout: null,
141
153
  triggers: [Triggers.OnDateChange],
154
+ StylesPanelSections: [
155
+ StylesPanelSections.Background,
156
+ StylesPanelSections.Borders,
157
+ StylesPanelSections.MarginsAndPaddings,
158
+ StylesPanelSections.Position,
159
+ StylesPanelSections.Size,
160
+ StylesPanelSections.Typography,
161
+ ],
142
162
  props: {
143
163
  ...SEED_DATA_PROPS,
144
164
  type: {
@@ -5,6 +5,9 @@ import {
5
5
  FIELD_NAME,
6
6
  GROUPS,
7
7
  Triggers,
8
+ StylesPanelSections,
9
+ createNumberProp,
10
+ createColorProp,
8
11
  } from "@draftbit/types";
9
12
 
10
13
  const SEED_DATA_PROPS = {
@@ -18,6 +21,12 @@ const SEED_DATA_PROPS = {
18
21
  required: true,
19
22
  group: GROUPS.data,
20
23
  },
24
+ labelSize: createNumberProp({
25
+ label: "Label Size",
26
+ }),
27
+ labelColor: createColorProp({
28
+ label: "Label Color",
29
+ }),
21
30
  mode: {
22
31
  label: "Mode",
23
32
  description: "Choose between date, time and datetime",
@@ -29,6 +38,12 @@ const SEED_DATA_PROPS = {
29
38
  options: ["date", "time", "datetime"],
30
39
  group: GROUPS.basic,
31
40
  },
41
+ borderColor: createColorProp({
42
+ label: "Border Color",
43
+ }),
44
+ borderColorActive: createColorProp({
45
+ label: "Border Color",
46
+ }),
32
47
  format: {
33
48
  label: "Format",
34
49
  description: "Create an output format for the date.",
@@ -150,6 +165,14 @@ export const SEED_DATA = [
150
165
  category: COMPONENT_TYPES.input,
151
166
  layout: null,
152
167
  triggers: [Triggers.OnDateChange],
168
+ StylesPanelSections: [
169
+ StylesPanelSections.Background,
170
+ StylesPanelSections.Borders,
171
+ StylesPanelSections.MarginsAndPaddings,
172
+ StylesPanelSections.Position,
173
+ StylesPanelSections.Size,
174
+ StylesPanelSections.Typography,
175
+ ],
153
176
  props: {
154
177
  ...SEED_DATA_PROPS,
155
178
  type: {
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
16
16
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
17
17
  editable: true,
18
18
  required: false,
19
- defaultValue: null,
19
+ defaultValue: "none",
20
20
  options: ["none", "sentences", "words", "characters"],
21
21
  formType: FORM_TYPES.flatArray,
22
22
  propType: PROP_TYPES.STRING,
@@ -30,7 +30,7 @@ const SEED_DATA_PROPS = {
30
30
  "Can automatically capitalize sentences, words, and characters (Default: none).",
31
31
  editable: true,
32
32
  required: false,
33
- defaultValue: null,
33
+ defaultValue: "none",
34
34
  options: ["none", "sentences", "words", "characters"],
35
35
  formType: FORM_TYPES.flatArray,
36
36
  propType: PROP_TYPES.STRING,
@@ -104,7 +104,7 @@ export const SEED_DATA = [
104
104
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
105
105
  editable: true,
106
106
  required: false,
107
- defaultValue: null,
107
+ defaultValue: "none",
108
108
  options: ["none", "sentences", "words", "characters"],
109
109
  formType: FORM_TYPES.flatArray,
110
110
  propType: PROP_TYPES.STRING,
@@ -121,7 +121,7 @@ export const SEED_DATA = [
121
121
  "Can automatically capitalize sentences, words, and characters (Default: none).",
122
122
  editable: true,
123
123
  required: false,
124
- defaultValue: null,
124
+ defaultValue: "none",
125
125
  options: ["none", "sentences", "words", "characters"],
126
126
  formType: FORM_TYPES.flatArray,
127
127
  propType: PROP_TYPES.STRING,
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
-
8
- var _types = require("@draftbit/types");
9
-
10
- const SEED_DATA_TRIGGERS = [_types.Triggers.OnValueChange];
11
- const ELEMENT_PROPS = {
12
- category: _types.COMPONENT_TYPES.element,
13
- stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
14
- layout: {
15
- margin: 0
16
- },
17
- triggers: SEED_DATA_TRIGGERS
18
- };
19
- const HEADING_PROPS = { ...ELEMENT_PROPS
20
- };
21
- const SEED_DATA = [{
22
- name: "H1",
23
- tag: "H1",
24
- ...HEADING_PROPS
25
- }, {
26
- name: "H2",
27
- tag: "H2",
28
- ...HEADING_PROPS
29
- }, {
30
- name: "H3",
31
- tag: "H3",
32
- ...HEADING_PROPS
33
- }, {
34
- name: "H4",
35
- tag: "H4",
36
- ...HEADING_PROPS
37
- }, {
38
- name: "H5",
39
- tag: "H5",
40
- ...HEADING_PROPS
41
- }, {
42
- name: "H6",
43
- tag: "H6",
44
- ...HEADING_PROPS
45
- }, {
46
- name: "Anchor",
47
- tag: "A",
48
- ...ELEMENT_PROPS,
49
- props: {
50
- href: (0, _types.createTextProp)({
51
- label: "href",
52
- description: "Specify the URL",
53
- defaultValue: ""
54
- }),
55
- target: {
56
- group: _types.GROUPS.basic,
57
- label: "target",
58
- description: "decide where link should open",
59
- formType: _types.FORM_TYPES.flatArray,
60
- defaultValue: "_blank",
61
- options: ["_blank", "_self", "_parent", "_top"]
62
- }
63
- }
64
- }, {
65
- name: "Paragraph",
66
- tag: "P",
67
- ...ELEMENT_PROPS,
68
- props: {// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
69
- // strong: createBoolProp({
70
- // label: "Strong",
71
- // description: "Strong",
72
- // }),
73
- // strike: createBoolProp({
74
- // label: "Strike",
75
- // description: "Strike through",
76
- // }),
77
- // italic: createBoolProp({
78
- // label: "Italic",
79
- // description: "Italic Fonts",
80
- // }),
81
- // bold: createBoolProp({
82
- // label: "Bold",
83
- // description: "Bold",
84
- // }),
85
- }
86
- }, {
87
- name: "Code",
88
- tag: "Code",
89
- ...ELEMENT_PROPS
90
- }, {
91
- name: "Pre",
92
- tag: "Pre",
93
- ...ELEMENT_PROPS
94
- }, {
95
- name: "Mark",
96
- tag: "Mark",
97
- ...ELEMENT_PROPS
98
- }, {
99
- name: "BR",
100
- tag: "BR",
101
- ...ELEMENT_PROPS
102
- }, {
103
- name: "Quote",
104
- tag: "Q",
105
- ...ELEMENT_PROPS
106
- }, {
107
- name: "BlockQuote",
108
- tag: "BlockQuote",
109
- ...ELEMENT_PROPS
110
- }, {
111
- name: "Time",
112
- tag: "Time",
113
- ...ELEMENT_PROPS
114
- }, {
115
- name: "UL",
116
- tag: "UL",
117
- ...ELEMENT_PROPS
118
- }, {
119
- name: "LI",
120
- tag: "LI",
121
- ...ELEMENT_PROPS
122
- }, {
123
- name: "HR",
124
- tag: "HR",
125
- ...ELEMENT_PROPS
126
- }];
127
- exports.SEED_DATA = SEED_DATA;
@@ -1,119 +0,0 @@
1
- import { BLOCK_STYLES_SECTIONS, COMPONENT_TYPES, // createBoolProp,
2
- createTextProp, FORM_TYPES, GROUPS, Triggers } from "@draftbit/types";
3
- const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
4
- const ELEMENT_PROPS = {
5
- category: COMPONENT_TYPES.element,
6
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
7
- layout: {
8
- margin: 0
9
- },
10
- triggers: SEED_DATA_TRIGGERS
11
- };
12
- const HEADING_PROPS = { ...ELEMENT_PROPS
13
- };
14
- export const SEED_DATA = [{
15
- name: "H1",
16
- tag: "H1",
17
- ...HEADING_PROPS
18
- }, {
19
- name: "H2",
20
- tag: "H2",
21
- ...HEADING_PROPS
22
- }, {
23
- name: "H3",
24
- tag: "H3",
25
- ...HEADING_PROPS
26
- }, {
27
- name: "H4",
28
- tag: "H4",
29
- ...HEADING_PROPS
30
- }, {
31
- name: "H5",
32
- tag: "H5",
33
- ...HEADING_PROPS
34
- }, {
35
- name: "H6",
36
- tag: "H6",
37
- ...HEADING_PROPS
38
- }, {
39
- name: "Anchor",
40
- tag: "A",
41
- ...ELEMENT_PROPS,
42
- props: {
43
- href: createTextProp({
44
- label: "href",
45
- description: "Specify the URL",
46
- defaultValue: ""
47
- }),
48
- target: {
49
- group: GROUPS.basic,
50
- label: "target",
51
- description: "decide where link should open",
52
- formType: FORM_TYPES.flatArray,
53
- defaultValue: "_blank",
54
- options: ["_blank", "_self", "_parent", "_top"]
55
- }
56
- }
57
- }, {
58
- name: "Paragraph",
59
- tag: "P",
60
- ...ELEMENT_PROPS,
61
- props: {// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
62
- // strong: createBoolProp({
63
- // label: "Strong",
64
- // description: "Strong",
65
- // }),
66
- // strike: createBoolProp({
67
- // label: "Strike",
68
- // description: "Strike through",
69
- // }),
70
- // italic: createBoolProp({
71
- // label: "Italic",
72
- // description: "Italic Fonts",
73
- // }),
74
- // bold: createBoolProp({
75
- // label: "Bold",
76
- // description: "Bold",
77
- // }),
78
- }
79
- }, {
80
- name: "Code",
81
- tag: "Code",
82
- ...ELEMENT_PROPS
83
- }, {
84
- name: "Pre",
85
- tag: "Pre",
86
- ...ELEMENT_PROPS
87
- }, {
88
- name: "Mark",
89
- tag: "Mark",
90
- ...ELEMENT_PROPS
91
- }, {
92
- name: "BR",
93
- tag: "BR",
94
- ...ELEMENT_PROPS
95
- }, {
96
- name: "Quote",
97
- tag: "Q",
98
- ...ELEMENT_PROPS
99
- }, {
100
- name: "BlockQuote",
101
- tag: "BlockQuote",
102
- ...ELEMENT_PROPS
103
- }, {
104
- name: "Time",
105
- tag: "Time",
106
- ...ELEMENT_PROPS
107
- }, {
108
- name: "UL",
109
- tag: "UL",
110
- ...ELEMENT_PROPS
111
- }, {
112
- name: "LI",
113
- tag: "LI",
114
- ...ELEMENT_PROPS
115
- }, {
116
- name: "HR",
117
- tag: "HR",
118
- ...ELEMENT_PROPS
119
- }];