@draftbit/core 46.4.4-d73221.2 → 46.4.4-dc9728.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.
@@ -21,6 +21,8 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
21
21
 
22
22
  var _DatePickerComponent = _interopRequireDefault(require("./DatePickerComponent"));
23
23
 
24
+ var _utilities = require("../../utilities");
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
28
  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); }
@@ -57,7 +59,11 @@ const DatePicker = _ref => {
57
59
  rightIconName,
58
60
  leftIconMode = "inset",
59
61
  label,
62
+ labelSize,
63
+ labelColor,
60
64
  placeholder,
65
+ borderColor: inputBorderColor,
66
+ borderColorActive: inputBorderColorActive,
61
67
  ...props
62
68
  } = _ref;
63
69
  const [value, setValue] = React.useState(date || defaultValue);
@@ -74,6 +80,9 @@ const DatePicker = _ref => {
74
80
  measured: false,
75
81
  width: 0
76
82
  });
83
+ const {
84
+ textStyles
85
+ } = (0, _utilities.extractStyles)(style);
77
86
 
78
87
  const getValidDate = () => {
79
88
  if (!value) {
@@ -175,8 +184,8 @@ const DatePicker = _ref => {
175
184
 
176
185
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
177
186
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
178
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
179
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
187
+ const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
188
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
180
189
  const hasActiveOutline = focused;
181
190
  let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
182
191
  inputTextColor = colors.strong;
@@ -188,9 +197,9 @@ const DatePicker = _ref => {
188
197
  underlineColor = "transparent";
189
198
  backgroundColor = colors.divider;
190
199
  } else {
191
- activeColor = colors.primary;
192
- placeholderColor = borderColor = colors.light;
193
- underlineColor = colors.light;
200
+ activeColor = inputBorderColorActive || colors.primary;
201
+ placeholderColor = borderColor = inputBorderColor || colors.light;
202
+ underlineColor = inputBorderColor || colors.light;
194
203
  backgroundColor = colors.background;
195
204
  }
196
205
 
@@ -250,6 +259,7 @@ const DatePicker = _ref => {
250
259
  };
251
260
  const labelStyle = { ...typography.subtitle1,
252
261
  top: type === "solid" ? 16 : 0,
262
+ fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
253
263
  left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
254
264
  transform: [{
255
265
  // Move label to top
@@ -273,7 +283,7 @@ const DatePicker = _ref => {
273
283
  };
274
284
  const inputStyles = [styles.input, inputStyle, type === "solid" ? {
275
285
  marginHorizontal: 12
276
- } : {}]; // const render = (props) => <NativeTextInput {...props} />;
286
+ } : {}, textStyles]; // const render = (props) => <NativeTextInput {...props} />;
277
287
 
278
288
  return /*#__PURE__*/React.createElement(_reactNative.View, {
279
289
  style: [styles.container, style]
@@ -319,7 +329,7 @@ const DatePicker = _ref => {
319
329
  style: [styles.placeholder, type === "solid" ? {
320
330
  paddingHorizontal: 12
321
331
  } : {}, labelStyle, {
322
- color: colors.light,
332
+ color: labelColor || colors.light,
323
333
  opacity: labeled.interpolate({
324
334
  inputRange: [0, 1],
325
335
  outputRange: [hasActiveOutline ? 1 : 0, 0]
@@ -330,7 +340,7 @@ const DatePicker = _ref => {
330
340
  style: [styles.placeholder, type === "solid" ? {
331
341
  paddingHorizontal: 12
332
342
  } : {}, labelStyle, {
333
- color: placeholderColor,
343
+ color: labelColor || placeholder,
334
344
  opacity: hasActiveOutline ? labeled : 1
335
345
  }],
336
346
  numberOfLines: 1
@@ -18,6 +18,12 @@ const SEED_DATA_PROPS = {
18
18
  required: true,
19
19
  group: _types.GROUPS.data
20
20
  },
21
+ labelSize: (0, _types.createNumberProp)({
22
+ label: "Label Size"
23
+ }),
24
+ labelColor: (0, _types.createColorProp)({
25
+ label: "Label Color"
26
+ }),
21
27
  mode: {
22
28
  label: "Mode",
23
29
  description: "Choose between date, time and datetime",
@@ -29,6 +35,12 @@ const SEED_DATA_PROPS = {
29
35
  options: ["date", "time", "datetime"],
30
36
  group: _types.GROUPS.basic
31
37
  },
38
+ borderColor: (0, _types.createColorProp)({
39
+ label: "Border Color"
40
+ }),
41
+ borderColorActive: (0, _types.createColorProp)({
42
+ label: "Border Color"
43
+ }),
32
44
  format: {
33
45
  label: "Format",
34
46
  description: "Create an output format for the date.",
@@ -145,6 +157,7 @@ const SEED_DATA = [{
145
157
  category: _types.COMPONENT_TYPES.input,
146
158
  layout: null,
147
159
  triggers: [_types.Triggers.OnDateChange],
160
+ StylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Size, _types.StylesPanelSections.Typography],
148
161
  props: { ...SEED_DATA_PROPS,
149
162
  type: {
150
163
  label: "Appearance",
@@ -1,3 +1,5 @@
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
+
1
3
  import * as React from "react";
2
4
  import { Button, Text, View, StyleSheet, Animated } from "react-native";
3
5
  import Surface from "./Surface";
@@ -72,9 +74,9 @@ const Banner = _ref => {
72
74
 
73
75
  const height = Animated.multiply(position, layout.height);
74
76
  const translateY = Animated.multiply(Animated.add(position, -1), layout.height);
75
- return /*#__PURE__*/React.createElement(Surface, { ...rest,
77
+ return /*#__PURE__*/React.createElement(Surface, _extends({}, rest, {
76
78
  style: [styles.container, shadow(ELEVATION), style]
77
- }, /*#__PURE__*/React.createElement(View, {
79
+ }), /*#__PURE__*/React.createElement(View, {
78
80
  style: [styles.wrapper, contentStyle]
79
81
  }, /*#__PURE__*/React.createElement(Animated.View, {
80
82
  style: {
@@ -153,26 +155,4 @@ const styles = StyleSheet.create({
153
155
  margin: 8
154
156
  }
155
157
  });
156
- export default withTheme(Banner);00%"
157
- },
158
- content: {
159
- flexDirection: "row",
160
- justifyContent: "flex-start",
161
- marginHorizontal: 8,
162
- marginTop: 16,
163
- marginBottom: 0
164
- },
165
- icon: {
166
- margin: 8
167
- },
168
- message: {
169
- flex: 1,
170
- margin: 8
171
- },
172
- actions: {
173
- flexDirection: "row",
174
- justifyContent: "flex-end",
175
- margin: 8
176
- }
177
- });
178
158
  export default withTheme(Banner);
@@ -1,3 +1,5 @@
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
+
1
3
  import * as React from "react";
2
4
  import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput } from "react-native";
3
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -6,6 +8,7 @@ import { withTheme } from "../../theming";
6
8
  import Portal from "../Portal/Portal";
7
9
  import Touchable from "../Touchable";
8
10
  import DateTimePicker from "./DatePickerComponent";
11
+ import { extractStyles } from "../../utilities";
9
12
  const AnimatedText = Animated.createAnimatedComponent(Text);
10
13
  const FOCUS_ANIMATION_DURATION = 150;
11
14
  const BLUR_ANIMATION_DURATION = 180;
@@ -33,7 +36,11 @@ const DatePicker = _ref => {
33
36
  rightIconName,
34
37
  leftIconMode = "inset",
35
38
  label,
39
+ labelSize,
40
+ labelColor,
36
41
  placeholder,
42
+ borderColor: inputBorderColor,
43
+ borderColorActive: inputBorderColorActive,
37
44
  ...props
38
45
  } = _ref;
39
46
  const [value, setValue] = React.useState(date || defaultValue);
@@ -50,6 +57,9 @@ const DatePicker = _ref => {
50
57
  measured: false,
51
58
  width: 0
52
59
  });
60
+ const {
61
+ textStyles
62
+ } = extractStyles(style);
53
63
 
54
64
  const getValidDate = () => {
55
65
  if (!value) {
@@ -151,8 +161,8 @@ const DatePicker = _ref => {
151
161
 
152
162
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
153
163
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
154
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
155
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
164
+ const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
165
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
156
166
  const hasActiveOutline = focused;
157
167
  let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
158
168
  inputTextColor = colors.strong;
@@ -164,9 +174,9 @@ const DatePicker = _ref => {
164
174
  underlineColor = "transparent";
165
175
  backgroundColor = colors.divider;
166
176
  } else {
167
- activeColor = colors.primary;
168
- placeholderColor = borderColor = colors.light;
169
- underlineColor = colors.light;
177
+ activeColor = inputBorderColorActive || colors.primary;
178
+ placeholderColor = borderColor = inputBorderColor || colors.light;
179
+ underlineColor = inputBorderColor || colors.light;
170
180
  backgroundColor = colors.background;
171
181
  }
172
182
 
@@ -226,6 +236,7 @@ const DatePicker = _ref => {
226
236
  };
227
237
  const labelStyle = { ...typography.subtitle1,
228
238
  top: type === "solid" ? 16 : 0,
239
+ fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
229
240
  left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
230
241
  transform: [{
231
242
  // Move label to top
@@ -249,7 +260,7 @@ const DatePicker = _ref => {
249
260
  };
250
261
  const inputStyles = [styles.input, inputStyle, type === "solid" ? {
251
262
  marginHorizontal: 12
252
- } : {}]; // const render = (props) => <NativeTextInput {...props} />;
263
+ } : {}, textStyles]; // const render = (props) => <NativeTextInput {...props} />;
253
264
 
254
265
  return /*#__PURE__*/React.createElement(View, {
255
266
  style: [styles.container, style]
@@ -260,9 +271,9 @@ const DatePicker = _ref => {
260
271
  pointerEvents: "none"
261
272
  }, /*#__PURE__*/React.createElement(View, {
262
273
  style: [styles.container, style]
263
- }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
274
+ }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
264
275
  style: leftIconStyle
265
- }) : null, /*#__PURE__*/React.createElement(View, {
276
+ })) : null, /*#__PURE__*/React.createElement(View, {
266
277
  style: [containerStyle, style ? {
267
278
  height: style.height
268
279
  } : {}]
@@ -295,7 +306,7 @@ const DatePicker = _ref => {
295
306
  style: [styles.placeholder, type === "solid" ? {
296
307
  paddingHorizontal: 12
297
308
  } : {}, labelStyle, {
298
- color: colors.light,
309
+ color: labelColor || colors.light,
299
310
  opacity: labeled.interpolate({
300
311
  inputRange: [0, 1],
301
312
  outputRange: [hasActiveOutline ? 1 : 0, 0]
@@ -306,15 +317,15 @@ const DatePicker = _ref => {
306
317
  style: [styles.placeholder, type === "solid" ? {
307
318
  paddingHorizontal: 12
308
319
  } : {}, labelStyle, {
309
- color: placeholderColor,
320
+ color: labelColor || placeholder,
310
321
  opacity: hasActiveOutline ? labeled : 1
311
322
  }],
312
323
  numberOfLines: 1
313
- }, label)) : null, leftIconName && leftIconMode === "inset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
324
+ }, label)) : null, leftIconName && leftIconMode === "inset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
314
325
  style: { ...leftIconStyle,
315
326
  marginLeft: type === "solid" ? 16 : 0
316
327
  }
317
- }) : null, /*#__PURE__*/React.createElement(NativeTextInput, {
328
+ })) : null, /*#__PURE__*/React.createElement(NativeTextInput, _extends({
318
329
  value: formatDate(),
319
330
  placeholder: label ? placeholder1 : placeholder,
320
331
  editable: !disabled,
@@ -323,9 +334,8 @@ const DatePicker = _ref => {
323
334
  onFocus: _handleFocus,
324
335
  onBlur: _handleBlur,
325
336
  underlineColorAndroid: "transparent",
326
- style: inputStyles,
327
- ...props
328
- })), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
337
+ style: inputStyles
338
+ }, props))), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
329
339
  name: rightIconName,
330
340
  size: ICON_SIZE,
331
341
  color: colors.light,
@@ -1,9 +1,11 @@
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
+
1
3
  import * as React from "react";
2
4
  import { Animated, StyleSheet, View } from "react-native";
3
5
  import shadow from "../styles/shadow";
4
6
  import { withTheme } from "../theming";
5
- /* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
6
7
 
8
+ /* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
7
9
  const Elevation = _ref => {
8
10
  let {
9
11
  style,
@@ -19,20 +21,7 @@ const Elevation = _ref => {
19
21
  colors
20
22
  } = theme;
21
23
  const borderRadius = radius;
22
- return /*#__PURE__*/React.createElement(Animated.View, { ...rest,
23
- style: [{
24
- borderRadius,
25
- backgroundColor: colors.surface
26
- }, elevation ? shadow(elevation) : null, style]
27
- }, /*#__PURE__*/React.createElement(View, {
28
- style: {
29
- overflow: "hidden",
30
- borderRadius
31
- }
32
- }, children));
33
- };
34
-
35
- export default withTheme(Elevation);__*/React.createElement(Animated.View, _extends({}, rest, {
24
+ return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
36
25
  style: [{
37
26
  borderRadius,
38
27
  backgroundColor: colors.surface
@@ -1,3 +1,5 @@
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
+
1
3
  /* README: Internal Image component used for stuff like Card. DO NOT EXPORT! */
2
4
  import React from "react";
3
5
  import { Image as NativeImage, StyleSheet } from "react-native";
@@ -62,24 +64,7 @@ const Image = _ref2 => {
62
64
  height,
63
65
  aspectRatio
64
66
  }]
65
- }, /*#__PURE__*/React.createElement(NativeImage, { ...props,
66
- source: imageSource,
67
- resizeMode: resizeMode,
68
- style: [style, {
69
- height: "100%",
70
- width: "100%"
71
- }]
72
- }));
73
- }
74
-
75
- return /*#__PURE__*/React.createElement(NativeImage, { ...props,
76
- source: source,
77
- resizeMode: resizeMode,
78
- style: style
79
- });
80
- };
81
-
82
- export default Image;ent(NativeImage, _extends({}, props, {
67
+ }, /*#__PURE__*/React.createElement(NativeImage, _extends({}, props, {
83
68
  source: imageSource,
84
69
  resizeMode: resizeMode,
85
70
  style: [style, {
@@ -1,3 +1,5 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  // @ts-nocheck
2
4
  import React, { Component } from "react";
3
5
  import { View, Text, StyleSheet, Animated, TouchableWithoutFeedback } from "react-native";
@@ -10,7 +12,7 @@ export default class StepIndicator extends Component {
10
12
  constructor(props) {
11
13
  super(props);
12
14
 
13
- this.renderProgressBarBackground = () => {
15
+ _defineProperty(this, "renderProgressBarBackground", () => {
14
16
  const {
15
17
  stepCount,
16
18
  direction
@@ -55,9 +57,9 @@ export default class StepIndicator extends Component {
55
57
  },
56
58
  style: progressBarBackgroundStyle
57
59
  });
58
- };
60
+ });
59
61
 
60
- this.renderProgressBar = () => {
62
+ _defineProperty(this, "renderProgressBar", () => {
61
63
  const {
62
64
  stepCount,
63
65
  direction
@@ -89,9 +91,9 @@ export default class StepIndicator extends Component {
89
91
  return /*#__PURE__*/React.createElement(Animated.View, {
90
92
  style: progressBarStyle
91
93
  });
92
- };
94
+ });
93
95
 
94
- this.renderStepIndicator = () => {
96
+ _defineProperty(this, "renderStepIndicator", () => {
95
97
  let steps = [];
96
98
  const {
97
99
  stepCount,
@@ -124,9 +126,9 @@ export default class StepIndicator extends Component {
124
126
  height: this.state.customStyles.currentStepIndicatorSize
125
127
  }]
126
128
  }, steps);
127
- };
129
+ });
128
130
 
129
- this.renderStepLabels = () => {
131
+ _defineProperty(this, "renderStepLabels", () => {
130
132
  const {
131
133
  labels,
132
134
  direction,
@@ -168,9 +170,9 @@ export default class StepIndicator extends Component {
168
170
  alignItems: this.state.customStyles.labelAlign
169
171
  }]
170
172
  }, labelViews);
171
- };
173
+ });
172
174
 
173
- this.renderStep = position => {
175
+ _defineProperty(this, "renderStep", position => {
174
176
  const {
175
177
  renderStepIndicator
176
178
  } = this.props;
@@ -242,9 +244,9 @@ export default class StepIndicator extends Component {
242
244
  }) : /*#__PURE__*/React.createElement(Text, {
243
245
  style: indicatorLabelStyle
244
246
  }, "".concat(position + 1)));
245
- };
247
+ });
246
248
 
247
- this.getStepStatus = stepPosition => {
249
+ _defineProperty(this, "getStepStatus", stepPosition => {
248
250
  const {
249
251
  currentPosition
250
252
  } = this.props;
@@ -256,9 +258,9 @@ export default class StepIndicator extends Component {
256
258
  } else {
257
259
  return STEP_STATUS.UNFINISHED;
258
260
  }
259
- };
261
+ });
260
262
 
261
- this.onCurrentPositionChanged = position => {
263
+ _defineProperty(this, "onCurrentPositionChanged", position => {
262
264
  let {
263
265
  stepCount
264
266
  } = this.props;
@@ -280,7 +282,7 @@ export default class StepIndicator extends Component {
280
282
  toValue: this.state.customStyles.currentStepIndicatorSize / 2,
281
283
  duration: 100
282
284
  })])]).start();
283
- };
285
+ });
284
286
 
285
287
  const defaultStyles = {
286
288
  stepIndicatorSize: 30,
@@ -391,25 +393,6 @@ const styles = StyleSheet.create({
391
393
  justifyContent: "center"
392
394
  }
393
395
  });
394
- StepIndicator.defaultProps = {
395
- currentPosition: 0,
396
- stepCount: 5,
397
- customStyles: {},
398
- direction: "horizontal"
399
- };s: "center",
400
- justifyContent: "center"
401
- },
402
- stepLabel: {
403
- fontSize: 12,
404
- textAlign: "center",
405
- fontWeight: "500"
406
- },
407
- stepLabelItem: {
408
- flex: 1,
409
- alignItems: "center",
410
- justifyContent: "center"
411
- }
412
- });
413
396
  StepIndicator.defaultProps = {
414
397
  currentPosition: 0,
415
398
  stepCount: 5,
@@ -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.",
@@ -137,6 +149,7 @@ export const SEED_DATA = [{
137
149
  category: COMPONENT_TYPES.input,
138
150
  layout: null,
139
151
  triggers: [Triggers.OnDateChange],
152
+ StylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Size, StylesPanelSections.Typography],
140
153
  props: { ...SEED_DATA_PROPS,
141
154
  type: {
142
155
  label: "Appearance",
@@ -15,10 +15,14 @@ declare type Props = {
15
15
  mode?: "date" | "time" | "datetime";
16
16
  type?: "solid" | "underline";
17
17
  label?: string;
18
+ labelSize?: number;
19
+ labelColor: string;
18
20
  placeholder?: string;
19
21
  leftIconName?: string;
20
22
  leftIconMode?: "outset" | "inset";
21
23
  rightIconName?: string;
24
+ borderColor?: string;
25
+ borderColorActive?: string;
22
26
  } & IconSlot & TextInputProps;
23
27
  declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
24
28
  theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
@@ -5,6 +5,7 @@ export declare const SEED_DATA: {
5
5
  category: string;
6
6
  layout: null;
7
7
  triggers: string[];
8
+ StylesPanelSections: string[];
8
9
  props: {
9
10
  type: {
10
11
  label: string;
@@ -27,6 +28,27 @@ export declare const SEED_DATA: {
27
28
  required: boolean;
28
29
  group: string;
29
30
  };
31
+ labelSize: {
32
+ label: string;
33
+ description: string;
34
+ formType: string;
35
+ propType: string;
36
+ group: string;
37
+ defaultValue: null;
38
+ editable: boolean;
39
+ required: boolean;
40
+ step: number;
41
+ };
42
+ labelColor: {
43
+ group: string;
44
+ label: string;
45
+ description: string;
46
+ editable: boolean;
47
+ required: boolean;
48
+ defaultValue: null;
49
+ formType: string;
50
+ propType: string;
51
+ };
30
52
  mode: {
31
53
  label: string;
32
54
  description: string;
@@ -38,6 +60,26 @@ export declare const SEED_DATA: {
38
60
  options: string[];
39
61
  group: string;
40
62
  };
63
+ borderColor: {
64
+ group: string;
65
+ label: string;
66
+ description: string;
67
+ editable: boolean;
68
+ required: boolean;
69
+ defaultValue: null;
70
+ formType: string;
71
+ propType: string;
72
+ };
73
+ borderColorActive: {
74
+ group: string;
75
+ label: string;
76
+ description: string;
77
+ editable: boolean;
78
+ required: boolean;
79
+ defaultValue: null;
80
+ formType: string;
81
+ propType: string;
82
+ };
41
83
  format: {
42
84
  label: string;
43
85
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.4.4-d73221.2+d73221d",
3
+ "version": "46.4.4-dc9728.2+dc9728c",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.4.4-d73221.2+d73221d",
44
+ "@draftbit/types": "^46.4.4-dc9728.2+dc9728c",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -81,5 +81,5 @@
81
81
  ]
82
82
  ]
83
83
  },
84
- "gitHead": "d73221d43a4c59a3e3576ae7dd7fd60ce115452c"
84
+ "gitHead": "dc9728c2090d6315a258345e71d4d61f903ce2a1"
85
85
  }
@@ -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
  ]}
@@ -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: {