@draftbit/core 46.4.4-e6bfdd.2 → 46.4.4-fe82de.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.
@@ -10,7 +10,6 @@ var _CircularProgress = _interopRequireDefault(require("./CircularProgress"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  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); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- 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); }
14
13
  const AnimatedProgress = _reactNative.Animated.createAnimatedComponent(_CircularProgress.default);
15
14
  const AnimatedCircularProgress = _ref => {
16
15
  let {
@@ -55,6 +54,18 @@ const AnimatedCircularProgress = _ref => {
55
54
  React.useEffect(() => {
56
55
  animate();
57
56
  }, [fill, animate]);
57
+ return /*#__PURE__*/React.createElement(AnimatedProgress, {
58
+ ...other,
59
+ style: other.style,
60
+ childrenContainerStyle: other.childrenContainerStyle,
61
+ fill: fillAnimation,
62
+ tintColor: animateColor()
63
+ });
64
+ };
65
+ var _default = AnimatedCircularProgress;
66
+ exports.default = _default;ect(() => {
67
+ animate();
68
+ }, [fill, animate]);
58
69
  return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
59
70
  style: other.style,
60
71
  childrenContainerStyle: other.childrenContainerStyle,
@@ -7,7 +7,6 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- 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); }
11
10
  const AspectRatio = props => {
12
11
  const [layout, setLayout] = _react.default.useState(null);
13
12
  const {
@@ -34,6 +33,23 @@ const AspectRatio = props => {
34
33
  });
35
34
  }
36
35
  }
36
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
37
+ ...props,
38
+ style: style,
39
+ onLayout: _ref => {
40
+ let {
41
+ nativeEvent: {
42
+ layout: l
43
+ }
44
+ } = _ref;
45
+ return setLayout(l);
46
+ }
47
+ }, props.children);
48
+ };
49
+ var _default = AspectRatio;
50
+ exports.default = _default; });
51
+ }
52
+ }
37
53
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({}, props, {
38
54
  style: style,
39
55
  onLayout: _ref => {
@@ -12,6 +12,7 @@ var _theming = require("../../theming");
12
12
  var _Portal = _interopRequireDefault(require("../Portal/Portal"));
13
13
  var _Touchable = _interopRequireDefault(require("../Touchable"));
14
14
  var _DatePickerComponent = _interopRequireDefault(require("./DatePickerComponent"));
15
+ var _utilities = require("../../utilities");
15
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -42,7 +43,11 @@ const DatePicker = _ref => {
42
43
  rightIconName,
43
44
  leftIconMode = "inset",
44
45
  label,
46
+ labelSize,
47
+ labelColor,
45
48
  placeholder,
49
+ borderColor: inputBorderColor,
50
+ borderColorActive: inputBorderColorActive,
46
51
  ...props
47
52
  } = _ref;
48
53
  const [value, setValue] = React.useState(date || defaultValue);
@@ -59,6 +64,9 @@ const DatePicker = _ref => {
59
64
  measured: false,
60
65
  width: 0
61
66
  });
67
+ const {
68
+ textStyles
69
+ } = (0, _utilities.extractStyles)(style);
62
70
  const getValidDate = () => {
63
71
  if (!value) {
64
72
  return new Date();
@@ -148,8 +156,8 @@ const DatePicker = _ref => {
148
156
  };
149
157
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
150
158
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
151
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
152
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
159
+ const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
160
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
153
161
  const hasActiveOutline = focused;
154
162
  let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
155
163
  inputTextColor = colors.strong;
@@ -160,9 +168,9 @@ const DatePicker = _ref => {
160
168
  underlineColor = "transparent";
161
169
  backgroundColor = colors.divider;
162
170
  } else {
163
- activeColor = colors.primary;
164
- placeholderColor = borderColor = colors.light;
165
- underlineColor = colors.light;
171
+ activeColor = inputBorderColorActive || colors.primary;
172
+ placeholderColor = borderColor = inputBorderColor || colors.light;
173
+ underlineColor = inputBorderColor || colors.light;
166
174
  backgroundColor = colors.background;
167
175
  }
168
176
  const {
@@ -217,6 +225,7 @@ const DatePicker = _ref => {
217
225
  const labelStyle = {
218
226
  ...typography.subtitle1,
219
227
  top: type === "solid" ? 16 : 0,
228
+ fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
220
229
  left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
221
230
  transform: [{
222
231
  // Move label to top
@@ -240,7 +249,7 @@ const DatePicker = _ref => {
240
249
  };
241
250
  const inputStyles = [styles.input, inputStyle, type === "solid" ? {
242
251
  marginHorizontal: 12
243
- } : {}];
252
+ } : {}, textStyles];
244
253
 
245
254
  // const render = (props) => <NativeTextInput {...props} />;
246
255
 
@@ -289,7 +298,7 @@ const DatePicker = _ref => {
289
298
  style: [styles.placeholder, type === "solid" ? {
290
299
  paddingHorizontal: 12
291
300
  } : {}, labelStyle, {
292
- color: colors.light,
301
+ color: labelColor || colors.light,
293
302
  opacity: labeled.interpolate({
294
303
  inputRange: [0, 1],
295
304
  outputRange: [hasActiveOutline ? 1 : 0, 0]
@@ -300,7 +309,7 @@ const DatePicker = _ref => {
300
309
  style: [styles.placeholder, type === "solid" ? {
301
310
  paddingHorizontal: 12
302
311
  } : {}, labelStyle, {
303
- color: placeholderColor,
312
+ color: labelColor || placeholder,
304
313
  opacity: hasActiveOutline ? labeled : 1
305
314
  }],
306
315
  numberOfLines: 1
@@ -16,6 +16,12 @@ const SEED_DATA_PROPS = {
16
16
  required: true,
17
17
  group: _types.GROUPS.data
18
18
  },
19
+ labelSize: (0, _types.createNumberProp)({
20
+ label: "Label Size"
21
+ }),
22
+ labelColor: (0, _types.createColorProp)({
23
+ label: "Label Color"
24
+ }),
19
25
  mode: {
20
26
  label: "Mode",
21
27
  description: "Choose between date, time and datetime",
@@ -27,6 +33,12 @@ const SEED_DATA_PROPS = {
27
33
  options: ["date", "time", "datetime"],
28
34
  group: _types.GROUPS.basic
29
35
  },
36
+ borderColor: (0, _types.createColorProp)({
37
+ label: "Border Color"
38
+ }),
39
+ borderColorActive: (0, _types.createColorProp)({
40
+ label: "Border Color"
41
+ }),
30
42
  format: {
31
43
  label: "Format",
32
44
  description: "Create an output format for the date.",
@@ -144,6 +156,7 @@ const SEED_DATA = [{
144
156
  category: _types.COMPONENT_TYPES.input,
145
157
  layout: null,
146
158
  triggers: [_types.Triggers.OnDateChange],
159
+ StylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Size, _types.StylesPanelSections.Typography],
147
160
  props: {
148
161
  ...SEED_DATA_PROPS,
149
162
  type: {
@@ -1,4 +1,3 @@
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
  import * as React from "react";
3
2
  import { withTheme } from "../theming";
4
3
  import { ScrollView, View, StyleSheet, Dimensions } from "react-native";
@@ -37,9 +36,10 @@ function Carousel(_ref2) {
37
36
  style,
38
37
  ...rest
39
38
  } = _ref2;
39
+ var _a;
40
40
  const [index, setIndex] = React.useState(0);
41
41
  const length = React.Children.count(children);
42
- const itemsLength = ((data === null || data === void 0 ? void 0 : data.length) ?? 0) + length;
42
+ const itemsLength = ((_a = data === null || data === void 0 ? void 0 : data.length) !== null && _a !== void 0 ? _a : 0) + length;
43
43
  const slides = Array.isArray(data) ? data : [];
44
44
  const {
45
45
  width,
@@ -47,9 +47,10 @@ function Carousel(_ref2) {
47
47
  } = StyleSheet.flatten(style || {});
48
48
  const slideWidth = width || screenWidth;
49
49
  const slideHeight = height || 250;
50
- return /*#__PURE__*/React.createElement(View, _extends({
51
- style: [styles.container, style]
52
- }, rest), /*#__PURE__*/React.createElement(ScrollView, {
50
+ return /*#__PURE__*/React.createElement(View, {
51
+ style: [styles.container, style],
52
+ ...rest
53
+ }, /*#__PURE__*/React.createElement(ScrollView, {
53
54
  pagingEnabled: true,
54
55
  horizontal: true,
55
56
  decelerationRate: "fast",
@@ -77,8 +78,8 @@ function Carousel(_ref2) {
77
78
  }]
78
79
  });
79
80
  }) : null, React.Children.map(children, child => {
80
- var _child$props;
81
- const s = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
81
+ var _a;
82
+ const s = ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.style) || {};
82
83
  return /*#__PURE__*/React.createElement(View, {
83
84
  style: {
84
85
  width: slideWidth
@@ -116,4 +117,23 @@ const styles = StyleSheet.create({
116
117
  backgroundColor: "#000"
117
118
  }
118
119
  });
120
+ export default withTheme(Carousel);#eee"
121
+ },
122
+ pager: {
123
+ position: "absolute",
124
+ bottom: 12,
125
+ left: 0,
126
+ right: 0,
127
+ flexDirection: "row",
128
+ justifyContent: "center",
129
+ alignItems: "center"
130
+ },
131
+ bullet: {
132
+ marginHorizontal: 2,
133
+ width: 10,
134
+ height: 10,
135
+ borderRadius: 20,
136
+ backgroundColor: "#000"
137
+ }
138
+ });
119
139
  export default withTheme(Carousel);
@@ -7,6 +7,7 @@ import { withTheme } from "../../theming";
7
7
  import Portal from "../Portal/Portal";
8
8
  import Touchable from "../Touchable";
9
9
  import DateTimePicker from "./DatePickerComponent";
10
+ import { extractStyles } from "../../utilities";
10
11
  const AnimatedText = Animated.createAnimatedComponent(Text);
11
12
  const FOCUS_ANIMATION_DURATION = 150;
12
13
  const BLUR_ANIMATION_DURATION = 180;
@@ -33,7 +34,11 @@ const DatePicker = _ref => {
33
34
  rightIconName,
34
35
  leftIconMode = "inset",
35
36
  label,
37
+ labelSize,
38
+ labelColor,
36
39
  placeholder,
40
+ borderColor: inputBorderColor,
41
+ borderColorActive: inputBorderColorActive,
37
42
  ...props
38
43
  } = _ref;
39
44
  const [value, setValue] = React.useState(date || defaultValue);
@@ -50,6 +55,9 @@ const DatePicker = _ref => {
50
55
  measured: false,
51
56
  width: 0
52
57
  });
58
+ const {
59
+ textStyles
60
+ } = extractStyles(style);
53
61
  const getValidDate = () => {
54
62
  if (!value) {
55
63
  return new Date();
@@ -139,8 +147,8 @@ const DatePicker = _ref => {
139
147
  };
140
148
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
141
149
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
142
- const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
143
- const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
150
+ const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
151
+ const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
144
152
  const hasActiveOutline = focused;
145
153
  let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
146
154
  inputTextColor = colors.strong;
@@ -151,9 +159,9 @@ const DatePicker = _ref => {
151
159
  underlineColor = "transparent";
152
160
  backgroundColor = colors.divider;
153
161
  } else {
154
- activeColor = colors.primary;
155
- placeholderColor = borderColor = colors.light;
156
- underlineColor = colors.light;
162
+ activeColor = inputBorderColorActive || colors.primary;
163
+ placeholderColor = borderColor = inputBorderColor || colors.light;
164
+ underlineColor = inputBorderColor || colors.light;
157
165
  backgroundColor = colors.background;
158
166
  }
159
167
  const {
@@ -208,6 +216,7 @@ const DatePicker = _ref => {
208
216
  const labelStyle = {
209
217
  ...typography.subtitle1,
210
218
  top: type === "solid" ? 16 : 0,
219
+ fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
211
220
  left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
212
221
  transform: [{
213
222
  // Move label to top
@@ -231,7 +240,7 @@ const DatePicker = _ref => {
231
240
  };
232
241
  const inputStyles = [styles.input, inputStyle, type === "solid" ? {
233
242
  marginHorizontal: 12
234
- } : {}];
243
+ } : {}, textStyles];
235
244
 
236
245
  // const render = (props) => <NativeTextInput {...props} />;
237
246
 
@@ -280,7 +289,7 @@ const DatePicker = _ref => {
280
289
  style: [styles.placeholder, type === "solid" ? {
281
290
  paddingHorizontal: 12
282
291
  } : {}, labelStyle, {
283
- color: colors.light,
292
+ color: labelColor || colors.light,
284
293
  opacity: labeled.interpolate({
285
294
  inputRange: [0, 1],
286
295
  outputRange: [hasActiveOutline ? 1 : 0, 0]
@@ -291,7 +300,7 @@ const DatePicker = _ref => {
291
300
  style: [styles.placeholder, type === "solid" ? {
292
301
  paddingHorizontal: 12
293
302
  } : {}, labelStyle, {
294
- color: placeholderColor,
303
+ color: labelColor || placeholder,
295
304
  opacity: hasActiveOutline ? labeled : 1
296
305
  }],
297
306
  numberOfLines: 1
@@ -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.",
@@ -138,6 +150,7 @@ export const SEED_DATA = [{
138
150
  category: COMPONENT_TYPES.input,
139
151
  layout: null,
140
152
  triggers: [Triggers.OnDateChange],
153
+ StylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Size, StylesPanelSections.Typography],
141
154
  props: {
142
155
  ...SEED_DATA_PROPS,
143
156
  type: {
@@ -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-e6bfdd.2+e6bfddf",
3
+ "version": "46.4.4-fe82de.2+fe82deb",
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-e6bfdd.2+e6bfddf",
44
+ "@draftbit/types": "^46.4.4-fe82de.2+fe82deb",
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": "e6bfddf7459c45527ca7c50c0c5a1ea34fe40967"
84
+ "gitHead": "fe82deb935cd477c88ab9da4c278e474b36e4665"
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: {