@draftbit/core 47.0.1-9fd6f2.2 → 47.0.1-df014a.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.
- package/lib/commonjs/mappings/DatePickerModal.js +74 -0
- package/lib/module/components/AvatarEdit.js +15 -4
- package/lib/module/components/CardBlock.js +14 -4
- package/lib/module/components/CircleImage.js +16 -1
- package/lib/module/components/DeprecatedCardWrapper.js +18 -1
- package/lib/module/components/FAB.js +22 -4
- package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
- package/lib/module/components/Picker/PickerComponent.web.js +21 -3
- package/lib/module/components/Switch.js +21 -10
- package/lib/module/components/TextField.js +78 -28
- package/lib/module/components/Touchable.js +18 -1
- package/lib/module/mappings/DatePickerModal.js +65 -0
- package/lib/typescript/src/mappings/DatePickerModal.d.ts +153 -0
- package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/mappings/DatePickerModal.js +73 -0
- package/src/mappings/DatePickerModal.ts +91 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SHARED_SEED_DATA_PROPS = exports.SHARED_SEED_DATA = exports.SEED_DATA = void 0;
|
|
7
|
+
var _types = require("@draftbit/types");
|
|
8
|
+
const SHARED_SEED_DATA = {
|
|
9
|
+
triggers: [_types.Triggers.OnDismiss, _types.Triggers.OnConfirm, _types.Triggers.OnChange],
|
|
10
|
+
category: _types.COMPONENT_TYPES.input,
|
|
11
|
+
StylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position],
|
|
12
|
+
layout: null
|
|
13
|
+
};
|
|
14
|
+
exports.SHARED_SEED_DATA = SHARED_SEED_DATA;
|
|
15
|
+
const SHARED_SEED_DATA_PROPS = {
|
|
16
|
+
locale: {},
|
|
17
|
+
visible: (0, _types.createBoolProp)({
|
|
18
|
+
label: "Visible",
|
|
19
|
+
description: "If true, show the modal. If false, hide the modal.",
|
|
20
|
+
required: true
|
|
21
|
+
}),
|
|
22
|
+
label: (0, _types.createTextProp)({
|
|
23
|
+
label: "Label",
|
|
24
|
+
description: "Label used as the header in the component, defaults to `Select Date`"
|
|
25
|
+
}),
|
|
26
|
+
saveLabel: (0, _types.createTextProp)({
|
|
27
|
+
label: "Save Label",
|
|
28
|
+
description: "Label used to confirm a date selection. Defaults to `Save`."
|
|
29
|
+
}),
|
|
30
|
+
saveLabelDisabled: (0, _types.createStaticBoolProp)({
|
|
31
|
+
label: "Disable Save Label",
|
|
32
|
+
description: "Flag indicating if the save label should be disabled and unable to receive events"
|
|
33
|
+
}),
|
|
34
|
+
uppercase: (0, _types.createStaticBoolProp)({
|
|
35
|
+
label: "Uppercase",
|
|
36
|
+
description: "Flag indicating if the text in the component should be uppercase. Defaults to true."
|
|
37
|
+
}),
|
|
38
|
+
startYear: (0, _types.createStaticNumberProp)({
|
|
39
|
+
label: "Start Year",
|
|
40
|
+
description: "The start year when the component is rendered. Defaults to 1800.",
|
|
41
|
+
required: false
|
|
42
|
+
}),
|
|
43
|
+
endYear: (0, _types.createStaticNumberProp)({
|
|
44
|
+
label: "End Year",
|
|
45
|
+
description: "The end year when the component is rendered. Defaults to 2200.",
|
|
46
|
+
required: false
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
exports.SHARED_SEED_DATA_PROPS = SHARED_SEED_DATA_PROPS;
|
|
50
|
+
const SEED_DATA = [{
|
|
51
|
+
name: "Single Date Picker Modal",
|
|
52
|
+
tag: "SingleDatePickerModal",
|
|
53
|
+
description: "A modal allowing date selection.",
|
|
54
|
+
...SHARED_SEED_DATA,
|
|
55
|
+
props: {
|
|
56
|
+
mode: (0, _types.createTextEnumProp)({
|
|
57
|
+
label: "Mode",
|
|
58
|
+
description: "The selection mode of the date picker",
|
|
59
|
+
required: true,
|
|
60
|
+
options: ["single", "multiple", "range"],
|
|
61
|
+
editable: false,
|
|
62
|
+
defaultValue: "single",
|
|
63
|
+
formType: _types.FORM_TYPES.flatArray
|
|
64
|
+
}),
|
|
65
|
+
fieldName: {
|
|
66
|
+
..._types.FIELD_NAME,
|
|
67
|
+
handlerPropName: "onConfirm",
|
|
68
|
+
valuePropName: "date",
|
|
69
|
+
defaultValue: "date"
|
|
70
|
+
},
|
|
71
|
+
...SHARED_SEED_DATA_PROPS
|
|
72
|
+
}
|
|
73
|
+
}];
|
|
74
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -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 { View } from "react-native";
|
|
4
3
|
import Touchable from "./Touchable";
|
|
@@ -23,9 +22,10 @@ const AvatarEdit = _ref => {
|
|
|
23
22
|
width: size,
|
|
24
23
|
height: size
|
|
25
24
|
};
|
|
26
|
-
return /*#__PURE__*/React.createElement(View,
|
|
27
|
-
style: [style, dimensions]
|
|
28
|
-
|
|
25
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
26
|
+
style: [style, dimensions],
|
|
27
|
+
...rest
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
29
29
|
onPress: onPress
|
|
30
30
|
}, /*#__PURE__*/React.createElement(CircleImage, {
|
|
31
31
|
source: image,
|
|
@@ -46,4 +46,15 @@ const AvatarEdit = _ref => {
|
|
|
46
46
|
size: size * (3 / 16)
|
|
47
47
|
}))));
|
|
48
48
|
};
|
|
49
|
+
export default withTheme(AvatarEdit);yles.editBorderColor,
|
|
50
|
+
backgroundColor: colorStyles.editBackgroundColor,
|
|
51
|
+
borderRadius: size * (3 / 16),
|
|
52
|
+
padding: size * (3 / 32)
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
55
|
+
name: "MaterialIcons/edit",
|
|
56
|
+
color: colorStyles.editIconColor,
|
|
57
|
+
size: size * (3 / 16)
|
|
58
|
+
}))));
|
|
59
|
+
};
|
|
49
60
|
export default withTheme(AvatarEdit);
|
|
@@ -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 React from "react";
|
|
3
2
|
import { View, Text } from "react-native";
|
|
4
3
|
import Image from "./Image";
|
|
@@ -42,11 +41,12 @@ const CardBlock = _ref => {
|
|
|
42
41
|
const rightDescriptionStyles = [typography.subtitle2, {
|
|
43
42
|
color: colors.light
|
|
44
43
|
}];
|
|
45
|
-
return /*#__PURE__*/React.createElement(Card,
|
|
44
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
46
45
|
style: style,
|
|
47
46
|
onPress: onPress,
|
|
48
|
-
numColumns: numColumns
|
|
49
|
-
|
|
47
|
+
numColumns: numColumns,
|
|
48
|
+
...rest
|
|
49
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
50
50
|
style: {
|
|
51
51
|
backgroundColor: colors.background
|
|
52
52
|
}
|
|
@@ -95,4 +95,14 @@ const CardBlock = _ref => {
|
|
|
95
95
|
style: rightDescriptionStyles
|
|
96
96
|
}, rightDescription) : null) : null));
|
|
97
97
|
};
|
|
98
|
+
export default withTheme(CardBlock);PURE__*/React.createElement(Text, {
|
|
99
|
+
numberOfLines: 1,
|
|
100
|
+
style: [typography.body2, {
|
|
101
|
+
color: colors.medium
|
|
102
|
+
}]
|
|
103
|
+
}, leftDescription), rightDescription ? /*#__PURE__*/React.createElement(Text, {
|
|
104
|
+
numberOfLines: 1,
|
|
105
|
+
style: rightDescriptionStyles
|
|
106
|
+
}, rightDescription) : null) : null));
|
|
107
|
+
};
|
|
98
108
|
export default withTheme(CardBlock);
|
|
@@ -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 { Image } from "react-native";
|
|
4
3
|
import Config from "./Config";
|
|
@@ -10,6 +9,22 @@ const CircleImage = _ref => {
|
|
|
10
9
|
...props
|
|
11
10
|
} = _ref;
|
|
12
11
|
const borderRadius = size / 2;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
13
|
+
style: [{
|
|
14
|
+
width: size,
|
|
15
|
+
height: size,
|
|
16
|
+
borderRadius
|
|
17
|
+
}, style],
|
|
18
|
+
source: typeof source === "string" ? {
|
|
19
|
+
uri: source
|
|
20
|
+
} : source,
|
|
21
|
+
resizeMode: "cover",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export default CircleImage;props
|
|
26
|
+
} = _ref;
|
|
27
|
+
const borderRadius = size / 2;
|
|
13
28
|
return /*#__PURE__*/React.createElement(Image, _extends({
|
|
14
29
|
style: [{
|
|
15
30
|
width: size,
|
|
@@ -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 React from "react";
|
|
3
2
|
import { withTheme } from "../theming";
|
|
4
3
|
import Touchable from "./Touchable";
|
|
@@ -13,6 +12,24 @@ const getWidth = numColumns => {
|
|
|
13
12
|
}
|
|
14
13
|
};
|
|
15
14
|
const Card = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
numColumns = 3,
|
|
17
|
+
children,
|
|
18
|
+
onPress,
|
|
19
|
+
style,
|
|
20
|
+
...rest
|
|
21
|
+
} = _ref;
|
|
22
|
+
const width = getWidth(numColumns);
|
|
23
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
24
|
+
disabled: !onPress,
|
|
25
|
+
onPress: onPress,
|
|
26
|
+
style: [style, {
|
|
27
|
+
width
|
|
28
|
+
}],
|
|
29
|
+
...rest
|
|
30
|
+
}, children);
|
|
31
|
+
};
|
|
32
|
+
export default withTheme(Card);ef => {
|
|
16
33
|
let {
|
|
17
34
|
numColumns = 3,
|
|
18
35
|
children,
|
|
@@ -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 { View, StyleSheet, Pressable, ActivityIndicator, Platform } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -25,7 +24,7 @@ const FAB = _ref => {
|
|
|
25
24
|
borderRadius: size / 2,
|
|
26
25
|
overflow: "hidden"
|
|
27
26
|
}, style]
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Pressable,
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
29
28
|
onPress: onPress,
|
|
30
29
|
disabled: loading || disabled,
|
|
31
30
|
android_ripple: {
|
|
@@ -43,8 +42,9 @@ const FAB = _ref => {
|
|
|
43
42
|
borderRadius: size / 2,
|
|
44
43
|
backgroundColor
|
|
45
44
|
}];
|
|
46
|
-
}
|
|
47
|
-
|
|
45
|
+
},
|
|
46
|
+
...props
|
|
47
|
+
}, /*#__PURE__*/React.createElement(View, null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
48
48
|
style: size > 50 ? {
|
|
49
49
|
marginTop: 2,
|
|
50
50
|
marginLeft: 2
|
|
@@ -70,4 +70,22 @@ const styles = StyleSheet.create({
|
|
|
70
70
|
})
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
export default withTheme(FAB); name: iconName,
|
|
74
|
+
size: size,
|
|
75
|
+
color: color
|
|
76
|
+
}))));
|
|
77
|
+
};
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
button: {
|
|
80
|
+
backgroundColor: "#5a45ff",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
...Platform.select({
|
|
84
|
+
web: {
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
userSelect: "none"
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
});
|
|
73
91
|
export default withTheme(FAB);
|
|
@@ -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 { View, StyleSheet } from "react-native";
|
|
4
3
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -11,7 +10,6 @@ import TextField from "../TextField";
|
|
|
11
10
|
import Touchable from "../Touchable";
|
|
12
11
|
import { extractStyles } from "../../utilities";
|
|
13
12
|
const Picker = _ref => {
|
|
14
|
-
var _options$find$label, _options$find;
|
|
15
13
|
let {
|
|
16
14
|
Icon,
|
|
17
15
|
style,
|
|
@@ -25,6 +23,7 @@ const Picker = _ref => {
|
|
|
25
23
|
},
|
|
26
24
|
...props
|
|
27
25
|
} = _ref;
|
|
26
|
+
var _a, _b;
|
|
28
27
|
const {
|
|
29
28
|
viewStyles: {
|
|
30
29
|
borderRadius,
|
|
@@ -65,26 +64,24 @@ const Picker = _ref => {
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
68
|
-
const selectedLabel = selectedValue && ((
|
|
67
|
+
const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
|
|
69
68
|
return /*#__PURE__*/React.createElement(View, {
|
|
70
69
|
style: [styles.container, viewStyles]
|
|
71
70
|
}, /*#__PURE__*/React.createElement(Touchable, {
|
|
72
71
|
disabled: disabled,
|
|
73
72
|
onPress: toggleVisibility
|
|
74
|
-
}, /*#__PURE__*/React.createElement(TextField,
|
|
73
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
74
|
+
...props,
|
|
75
75
|
value: String(selectedLabel),
|
|
76
|
-
placeholder: placeholder
|
|
76
|
+
placeholder: placeholder,
|
|
77
77
|
// @ts-ignore
|
|
78
|
-
,
|
|
79
|
-
ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
|
|
80
|
-
,
|
|
78
|
+
ref: textField,
|
|
81
79
|
disabled: disabled,
|
|
82
|
-
pointerEvents: "none"
|
|
80
|
+
pointerEvents: "none",
|
|
83
81
|
// @ts-expect-error
|
|
84
|
-
,
|
|
85
82
|
style: stylesWithoutMargin,
|
|
86
83
|
Icon: Icon
|
|
87
|
-
}))
|
|
84
|
+
})), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
|
|
88
85
|
style: [styles.picker, {
|
|
89
86
|
backgroundColor: colors.divider
|
|
90
87
|
}]
|
|
@@ -128,4 +125,32 @@ const styles = StyleSheet.create({
|
|
|
128
125
|
alignSelf: "flex-end"
|
|
129
126
|
}
|
|
130
127
|
});
|
|
128
|
+
export default withTheme(Picker);nValueChange
|
|
129
|
+
}, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
|
|
130
|
+
label: o.label,
|
|
131
|
+
value: o.value,
|
|
132
|
+
key: o.value
|
|
133
|
+
})))))));
|
|
134
|
+
};
|
|
135
|
+
const styles = StyleSheet.create({
|
|
136
|
+
container: {
|
|
137
|
+
alignSelf: "stretch"
|
|
138
|
+
},
|
|
139
|
+
picker: {
|
|
140
|
+
position: "absolute",
|
|
141
|
+
bottom: 0,
|
|
142
|
+
left: 0,
|
|
143
|
+
right: 0,
|
|
144
|
+
flexDirection: "row",
|
|
145
|
+
justifyContent: "center"
|
|
146
|
+
},
|
|
147
|
+
pickerContainer: {
|
|
148
|
+
backgroundColor: "white",
|
|
149
|
+
flexDirection: "column",
|
|
150
|
+
width: "100%"
|
|
151
|
+
},
|
|
152
|
+
closeButton: {
|
|
153
|
+
alignSelf: "flex-end"
|
|
154
|
+
}
|
|
155
|
+
});
|
|
131
156
|
export default withTheme(Picker);
|
|
@@ -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 { View, StyleSheet } from "react-native";
|
|
4
3
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -8,7 +7,6 @@ import { extractStyles } from "../../utilities";
|
|
|
8
7
|
import TextField from "../TextField";
|
|
9
8
|
import Touchable from "../Touchable";
|
|
10
9
|
const Picker = _ref => {
|
|
11
|
-
var _options$find$label, _options$find;
|
|
12
10
|
let {
|
|
13
11
|
style,
|
|
14
12
|
options,
|
|
@@ -18,6 +16,7 @@ const Picker = _ref => {
|
|
|
18
16
|
onValueChange: onValueChangeOverride = () => {},
|
|
19
17
|
...props
|
|
20
18
|
} = _ref;
|
|
19
|
+
var _a, _b;
|
|
21
20
|
const {
|
|
22
21
|
viewStyles: {
|
|
23
22
|
borderRadius,
|
|
@@ -62,7 +61,7 @@ const Picker = _ref => {
|
|
|
62
61
|
};
|
|
63
62
|
|
|
64
63
|
const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
|
|
65
|
-
const selectedLabel = selectedValue && ((
|
|
64
|
+
const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
|
|
66
65
|
return /*#__PURE__*/React.createElement(Touchable, {
|
|
67
66
|
disabled: disabled,
|
|
68
67
|
onPress: toggleFocus,
|
|
@@ -85,6 +84,25 @@ const Picker = _ref => {
|
|
|
85
84
|
label: o.label,
|
|
86
85
|
value: o.value,
|
|
87
86
|
key: o.value
|
|
87
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
pointerEvents: "none"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
90
|
+
...props,
|
|
91
|
+
value: selectedLabel,
|
|
92
|
+
placeholder: placeholder,
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
ref: textField,
|
|
95
|
+
disabled: disabled,
|
|
96
|
+
// @ts-expect-error
|
|
97
|
+
style: stylesWithoutMargin
|
|
98
|
+
}))));
|
|
99
|
+
};
|
|
100
|
+
const styles = StyleSheet.create({
|
|
101
|
+
container: {
|
|
102
|
+
alignSelf: "stretch"
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export default withTheme(Picker);y: o.value
|
|
88
106
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
89
107
|
pointerEvents: "none"
|
|
90
108
|
}, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
@@ -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 { Switch as NativeSwitch } from "react-native";
|
|
4
3
|
import { withTheme } from "../theming";
|
|
@@ -29,7 +28,6 @@ function Switch(_ref) {
|
|
|
29
28
|
setChecked(value);
|
|
30
29
|
}
|
|
31
30
|
}, [value, checked]);
|
|
32
|
-
|
|
33
31
|
// This special logic is to handle weird APIs like Airtable that return
|
|
34
32
|
// true or undefined for a boolean
|
|
35
33
|
const previousDefaultValue = usePrevious(defaultValue);
|
|
@@ -38,24 +36,24 @@ function Switch(_ref) {
|
|
|
38
36
|
setChecked(Boolean(defaultValue));
|
|
39
37
|
}
|
|
40
38
|
}, [defaultValue, previousDefaultValue]);
|
|
41
|
-
return /*#__PURE__*/React.createElement(NativeSwitch,
|
|
39
|
+
return /*#__PURE__*/React.createElement(NativeSwitch, {
|
|
42
40
|
value: checked,
|
|
43
41
|
disabled: disabled,
|
|
44
42
|
trackColor: {
|
|
45
43
|
false: inactiveTrackThemeColor,
|
|
46
44
|
true: activeTrackThemeColor
|
|
47
45
|
},
|
|
48
|
-
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
|
|
46
|
+
thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
|
|
49
47
|
// @ts-ignore react-native-web only
|
|
50
|
-
,
|
|
51
48
|
activeThumbColor: activeThumbThemeColor,
|
|
52
49
|
ios_backgroundColor: inactiveTrackThemeColor,
|
|
53
50
|
style: style,
|
|
54
51
|
onValueChange: bool => {
|
|
55
52
|
setChecked(bool);
|
|
56
53
|
onValueChange && onValueChange(bool);
|
|
57
|
-
}
|
|
58
|
-
|
|
54
|
+
},
|
|
55
|
+
...rest
|
|
56
|
+
});
|
|
59
57
|
}
|
|
60
58
|
function Row(_ref2) {
|
|
61
59
|
let {
|
|
@@ -84,7 +82,7 @@ function Row(_ref2) {
|
|
|
84
82
|
setChecked(defaultValue);
|
|
85
83
|
}
|
|
86
84
|
}, [defaultValue]);
|
|
87
|
-
return /*#__PURE__*/React.createElement(FormRow,
|
|
85
|
+
return /*#__PURE__*/React.createElement(FormRow, {
|
|
88
86
|
disabled: disabled,
|
|
89
87
|
onPress: () => {
|
|
90
88
|
setChecked(!checked);
|
|
@@ -92,8 +90,9 @@ function Row(_ref2) {
|
|
|
92
90
|
},
|
|
93
91
|
label: label,
|
|
94
92
|
direction: direction,
|
|
95
|
-
style: style
|
|
96
|
-
|
|
93
|
+
style: style,
|
|
94
|
+
...rest
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
97
96
|
theme: theme,
|
|
98
97
|
value: checked,
|
|
99
98
|
disabled: disabled,
|
|
@@ -106,4 +105,16 @@ function Row(_ref2) {
|
|
|
106
105
|
}
|
|
107
106
|
const SwitchRow = withTheme(Row);
|
|
108
107
|
export { SwitchRow };
|
|
108
|
+
export default withTheme(Switch);: theme,
|
|
109
|
+
value: checked,
|
|
110
|
+
disabled: disabled,
|
|
111
|
+
onValueChange: onValueChange,
|
|
112
|
+
activeTrackColor: activeTrackColor,
|
|
113
|
+
inactiveTrackColor: inactiveTrackColor,
|
|
114
|
+
activeThumbColor: activeThumbColor,
|
|
115
|
+
inactiveThumbColor: inactiveThumbColor
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
const SwitchRow = withTheme(Row);
|
|
119
|
+
export { SwitchRow };
|
|
109
120
|
export default withTheme(Switch);
|
|
@@ -1,7 +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
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
1
|
import * as React from "react";
|
|
6
2
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
7
3
|
import { withTheme } from "../theming";
|
|
@@ -13,7 +9,7 @@ const ICON_SIZE = 24;
|
|
|
13
9
|
class TextField extends React.Component {
|
|
14
10
|
constructor() {
|
|
15
11
|
super(...arguments);
|
|
16
|
-
|
|
12
|
+
this.state = {
|
|
17
13
|
nativeProps: {},
|
|
18
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
19
15
|
focused: false,
|
|
@@ -22,47 +18,46 @@ class TextField extends React.Component {
|
|
|
22
18
|
measured: false,
|
|
23
19
|
width: 0
|
|
24
20
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
};
|
|
22
|
+
this._timer = setTimeout(() => {}, 0);
|
|
23
|
+
this._showPlaceholder = () => {
|
|
28
24
|
clearTimeout(this._timer);
|
|
29
|
-
|
|
30
25
|
// Set the placeholder in a delay to offset the label animation
|
|
31
26
|
// If we show it immediately, they'll overlap and look ugly
|
|
32
27
|
this._timer = setTimeout(() => this.setState({
|
|
33
28
|
placeholder: this.props.placeholder
|
|
34
29
|
}), 50);
|
|
35
|
-
}
|
|
36
|
-
|
|
30
|
+
};
|
|
31
|
+
this._hidePlaceholder = () => this.setState({
|
|
37
32
|
placeholder: ""
|
|
38
|
-
})
|
|
39
|
-
|
|
33
|
+
});
|
|
34
|
+
this._restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
40
35
|
toValue: 1,
|
|
41
36
|
duration: FOCUS_ANIMATION_DURATION,
|
|
42
37
|
useNativeDriver: true
|
|
43
|
-
}).start()
|
|
44
|
-
|
|
38
|
+
}).start();
|
|
39
|
+
this._minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
45
40
|
toValue: 0,
|
|
46
41
|
duration: BLUR_ANIMATION_DURATION,
|
|
47
42
|
useNativeDriver: true
|
|
48
|
-
}).start()
|
|
49
|
-
|
|
43
|
+
}).start();
|
|
44
|
+
this._handleFocus = () => {
|
|
50
45
|
if (this.props.disabled) {
|
|
51
46
|
return;
|
|
52
47
|
}
|
|
53
48
|
this.setState({
|
|
54
49
|
focused: true
|
|
55
50
|
});
|
|
56
|
-
}
|
|
57
|
-
|
|
51
|
+
};
|
|
52
|
+
this._handleBlur = () => {
|
|
58
53
|
if (this.props.disabled) {
|
|
59
54
|
return;
|
|
60
55
|
}
|
|
61
56
|
this.setState({
|
|
62
57
|
focused: false
|
|
63
58
|
});
|
|
64
|
-
}
|
|
65
|
-
|
|
59
|
+
};
|
|
60
|
+
this._handleChangeText = value => {
|
|
66
61
|
if (this.props.disabled) {
|
|
67
62
|
return;
|
|
68
63
|
}
|
|
@@ -77,8 +72,8 @@ class TextField extends React.Component {
|
|
|
77
72
|
});
|
|
78
73
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
79
74
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
75
|
+
};
|
|
76
|
+
this._root = undefined;
|
|
82
77
|
}
|
|
83
78
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
84
79
|
return {
|
|
@@ -165,7 +160,9 @@ class TextField extends React.Component {
|
|
|
165
160
|
roundness,
|
|
166
161
|
disabledOpacity
|
|
167
162
|
},
|
|
168
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput,
|
|
163
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, {
|
|
164
|
+
...props
|
|
165
|
+
}),
|
|
169
166
|
...rest
|
|
170
167
|
} = this.props;
|
|
171
168
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -305,9 +302,10 @@ class TextField extends React.Component {
|
|
|
305
302
|
} = StyleSheet.flatten(style || {});
|
|
306
303
|
return /*#__PURE__*/React.createElement(View, {
|
|
307
304
|
style: [styles.container, styleProp]
|
|
308
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon,
|
|
305
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, {
|
|
306
|
+
...leftIconProps,
|
|
309
307
|
style: leftIconStyle
|
|
310
|
-
})
|
|
308
|
+
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
311
309
|
style: applyStyles([containerStyle], {
|
|
312
310
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
313
311
|
backgroundColor: bgColor,
|
|
@@ -375,9 +373,10 @@ class TextField extends React.Component {
|
|
|
375
373
|
style: {
|
|
376
374
|
justifyContent: type === "solid" ? "center" : undefined
|
|
377
375
|
}
|
|
378
|
-
}, /*#__PURE__*/React.createElement(Icon,
|
|
376
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
377
|
+
...leftIconProps,
|
|
379
378
|
style: leftIconStyle
|
|
380
|
-
}))
|
|
379
|
+
})) : null, render({
|
|
381
380
|
ref: c => {
|
|
382
381
|
this._root = c;
|
|
383
382
|
},
|
|
@@ -414,6 +413,57 @@ class TextField extends React.Component {
|
|
|
414
413
|
}
|
|
415
414
|
}
|
|
416
415
|
export default withTheme(TextField);
|
|
416
|
+
const styles = StyleSheet.create({
|
|
417
|
+
container: {
|
|
418
|
+
alignSelf: "stretch"
|
|
419
|
+
},
|
|
420
|
+
placeholder: {
|
|
421
|
+
position: "absolute",
|
|
422
|
+
left: 0
|
|
423
|
+
},
|
|
424
|
+
underline: {
|
|
425
|
+
position: "absolute",
|
|
426
|
+
left: 0,
|
|
427
|
+
right: 0,
|
|
428
|
+
bottom: 0,
|
|
429
|
+
height: 2
|
|
430
|
+
},
|
|
431
|
+
input: {
|
|
432
|
+
flexGrow: 1,
|
|
433
|
+
justifyContent: "center",
|
|
434
|
+
textAlignVertical: "center",
|
|
435
|
+
margin: 0,
|
|
436
|
+
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
437
|
+
}
|
|
438
|
+
});ionColor: activeColor,
|
|
439
|
+
multiline,
|
|
440
|
+
numberOfLines,
|
|
441
|
+
onFocus: this._handleFocus,
|
|
442
|
+
onBlur: this._handleBlur,
|
|
443
|
+
underlineColorAndroid: "transparent",
|
|
444
|
+
style: inputStyles,
|
|
445
|
+
...rest,
|
|
446
|
+
...this.state.nativeProps,
|
|
447
|
+
value: this.state.value
|
|
448
|
+
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
449
|
+
name: rightIconName,
|
|
450
|
+
size: ICON_SIZE,
|
|
451
|
+
color: colors.light,
|
|
452
|
+
style: {
|
|
453
|
+
position: "absolute",
|
|
454
|
+
right: 16,
|
|
455
|
+
marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
456
|
+
}
|
|
457
|
+
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
458
|
+
style: [{
|
|
459
|
+
color: error ? colors.error : colors.light,
|
|
460
|
+
marginTop: 8,
|
|
461
|
+
marginLeft: assistiveTextLeftMargin
|
|
462
|
+
}]
|
|
463
|
+
}, assistiveText) : null);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
export default withTheme(TextField);
|
|
417
467
|
const styles = StyleSheet.create({
|
|
418
468
|
container: {
|
|
419
469
|
alignSelf: "stretch"
|
|
@@ -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 React from "react";
|
|
3
2
|
import { Pressable } from "react-native";
|
|
4
3
|
export default function Touchable(_ref) {
|
|
@@ -9,6 +8,24 @@ export default function Touchable(_ref) {
|
|
|
9
8
|
style,
|
|
10
9
|
...props
|
|
11
10
|
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
12
|
+
onPress: onPress,
|
|
13
|
+
disabled: disabled,
|
|
14
|
+
hitSlop: 8,
|
|
15
|
+
style: _ref2 => {
|
|
16
|
+
let {
|
|
17
|
+
pressed
|
|
18
|
+
} = _ref2;
|
|
19
|
+
return [{
|
|
20
|
+
opacity: pressed || disabled ? 0.75 : 1
|
|
21
|
+
}, style];
|
|
22
|
+
},
|
|
23
|
+
...props
|
|
24
|
+
}, children);
|
|
25
|
+
},
|
|
26
|
+
style,
|
|
27
|
+
...props
|
|
28
|
+
} = _ref;
|
|
12
29
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
13
30
|
onPress: onPress,
|
|
14
31
|
disabled: disabled,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, FIELD_NAME, Triggers, StylesPanelSections, createBoolProp, createTextProp, createTextEnumProp, createStaticBoolProp, createStaticNumberProp } from "@draftbit/types";
|
|
2
|
+
export const SHARED_SEED_DATA = {
|
|
3
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
4
|
+
category: COMPONENT_TYPES.input,
|
|
5
|
+
StylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position],
|
|
6
|
+
layout: null
|
|
7
|
+
};
|
|
8
|
+
export const SHARED_SEED_DATA_PROPS = {
|
|
9
|
+
locale: {},
|
|
10
|
+
visible: createBoolProp({
|
|
11
|
+
label: "Visible",
|
|
12
|
+
description: "If true, show the modal. If false, hide the modal.",
|
|
13
|
+
required: true
|
|
14
|
+
}),
|
|
15
|
+
label: createTextProp({
|
|
16
|
+
label: "Label",
|
|
17
|
+
description: "Label used as the header in the component, defaults to `Select Date`"
|
|
18
|
+
}),
|
|
19
|
+
saveLabel: createTextProp({
|
|
20
|
+
label: "Save Label",
|
|
21
|
+
description: "Label used to confirm a date selection. Defaults to `Save`."
|
|
22
|
+
}),
|
|
23
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
24
|
+
label: "Disable Save Label",
|
|
25
|
+
description: "Flag indicating if the save label should be disabled and unable to receive events"
|
|
26
|
+
}),
|
|
27
|
+
uppercase: createStaticBoolProp({
|
|
28
|
+
label: "Uppercase",
|
|
29
|
+
description: "Flag indicating if the text in the component should be uppercase. Defaults to true."
|
|
30
|
+
}),
|
|
31
|
+
startYear: createStaticNumberProp({
|
|
32
|
+
label: "Start Year",
|
|
33
|
+
description: "The start year when the component is rendered. Defaults to 1800.",
|
|
34
|
+
required: false
|
|
35
|
+
}),
|
|
36
|
+
endYear: createStaticNumberProp({
|
|
37
|
+
label: "End Year",
|
|
38
|
+
description: "The end year when the component is rendered. Defaults to 2200.",
|
|
39
|
+
required: false
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
export const SEED_DATA = [{
|
|
43
|
+
name: "Single Date Picker Modal",
|
|
44
|
+
tag: "SingleDatePickerModal",
|
|
45
|
+
description: "A modal allowing date selection.",
|
|
46
|
+
...SHARED_SEED_DATA,
|
|
47
|
+
props: {
|
|
48
|
+
mode: createTextEnumProp({
|
|
49
|
+
label: "Mode",
|
|
50
|
+
description: "The selection mode of the date picker",
|
|
51
|
+
required: true,
|
|
52
|
+
options: ["single", "multiple", "range"],
|
|
53
|
+
editable: false,
|
|
54
|
+
defaultValue: "single",
|
|
55
|
+
formType: FORM_TYPES.flatArray
|
|
56
|
+
}),
|
|
57
|
+
fieldName: {
|
|
58
|
+
...FIELD_NAME,
|
|
59
|
+
handlerPropName: "onConfirm",
|
|
60
|
+
valuePropName: "date",
|
|
61
|
+
defaultValue: "date"
|
|
62
|
+
},
|
|
63
|
+
...SHARED_SEED_DATA_PROPS
|
|
64
|
+
}
|
|
65
|
+
}];
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
export declare const SHARED_SEED_DATA: {
|
|
2
|
+
triggers: string[];
|
|
3
|
+
category: string;
|
|
4
|
+
StylesPanelSections: string[];
|
|
5
|
+
layout: null;
|
|
6
|
+
};
|
|
7
|
+
export declare const SHARED_SEED_DATA_PROPS: {
|
|
8
|
+
locale: {};
|
|
9
|
+
visible: {
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
formType: string;
|
|
13
|
+
propType: string;
|
|
14
|
+
defaultValue: boolean;
|
|
15
|
+
editable: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
group: string;
|
|
18
|
+
};
|
|
19
|
+
label: any;
|
|
20
|
+
saveLabel: any;
|
|
21
|
+
saveLabelDisabled: {
|
|
22
|
+
label: string;
|
|
23
|
+
description: string;
|
|
24
|
+
formType: string;
|
|
25
|
+
propType: string;
|
|
26
|
+
defaultValue: boolean;
|
|
27
|
+
editable: boolean;
|
|
28
|
+
required: boolean;
|
|
29
|
+
group: string;
|
|
30
|
+
};
|
|
31
|
+
uppercase: {
|
|
32
|
+
label: string;
|
|
33
|
+
description: string;
|
|
34
|
+
formType: string;
|
|
35
|
+
propType: string;
|
|
36
|
+
defaultValue: boolean;
|
|
37
|
+
editable: boolean;
|
|
38
|
+
required: boolean;
|
|
39
|
+
group: string;
|
|
40
|
+
};
|
|
41
|
+
startYear: {
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
formType: string;
|
|
45
|
+
propType: string;
|
|
46
|
+
group: string;
|
|
47
|
+
defaultValue: null;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
required: boolean;
|
|
50
|
+
step: number;
|
|
51
|
+
};
|
|
52
|
+
endYear: {
|
|
53
|
+
label: string;
|
|
54
|
+
description: string;
|
|
55
|
+
formType: string;
|
|
56
|
+
propType: string;
|
|
57
|
+
group: string;
|
|
58
|
+
defaultValue: null;
|
|
59
|
+
editable: boolean;
|
|
60
|
+
required: boolean;
|
|
61
|
+
step: number;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const SEED_DATA: {
|
|
65
|
+
props: {
|
|
66
|
+
locale: {};
|
|
67
|
+
visible: {
|
|
68
|
+
label: string;
|
|
69
|
+
description: string;
|
|
70
|
+
formType: string;
|
|
71
|
+
propType: string;
|
|
72
|
+
defaultValue: boolean;
|
|
73
|
+
editable: boolean;
|
|
74
|
+
required: boolean;
|
|
75
|
+
group: string;
|
|
76
|
+
};
|
|
77
|
+
label: any;
|
|
78
|
+
saveLabel: any;
|
|
79
|
+
saveLabelDisabled: {
|
|
80
|
+
label: string;
|
|
81
|
+
description: string;
|
|
82
|
+
formType: string;
|
|
83
|
+
propType: string;
|
|
84
|
+
defaultValue: boolean;
|
|
85
|
+
editable: boolean;
|
|
86
|
+
required: boolean;
|
|
87
|
+
group: string;
|
|
88
|
+
};
|
|
89
|
+
uppercase: {
|
|
90
|
+
label: string;
|
|
91
|
+
description: string;
|
|
92
|
+
formType: string;
|
|
93
|
+
propType: string;
|
|
94
|
+
defaultValue: boolean;
|
|
95
|
+
editable: boolean;
|
|
96
|
+
required: boolean;
|
|
97
|
+
group: string;
|
|
98
|
+
};
|
|
99
|
+
startYear: {
|
|
100
|
+
label: string;
|
|
101
|
+
description: string;
|
|
102
|
+
formType: string;
|
|
103
|
+
propType: string;
|
|
104
|
+
group: string;
|
|
105
|
+
defaultValue: null;
|
|
106
|
+
editable: boolean;
|
|
107
|
+
required: boolean;
|
|
108
|
+
step: number;
|
|
109
|
+
};
|
|
110
|
+
endYear: {
|
|
111
|
+
label: string;
|
|
112
|
+
description: string;
|
|
113
|
+
formType: string;
|
|
114
|
+
propType: string;
|
|
115
|
+
group: string;
|
|
116
|
+
defaultValue: null;
|
|
117
|
+
editable: boolean;
|
|
118
|
+
required: boolean;
|
|
119
|
+
step: number;
|
|
120
|
+
};
|
|
121
|
+
mode: {
|
|
122
|
+
group: string;
|
|
123
|
+
label: string;
|
|
124
|
+
description: string;
|
|
125
|
+
editable: boolean;
|
|
126
|
+
required: boolean;
|
|
127
|
+
formType: string;
|
|
128
|
+
propType: string;
|
|
129
|
+
defaultValue: null;
|
|
130
|
+
options: never[];
|
|
131
|
+
};
|
|
132
|
+
fieldName: {
|
|
133
|
+
handlerPropName: string;
|
|
134
|
+
valuePropName: string;
|
|
135
|
+
defaultValue: string;
|
|
136
|
+
group: string;
|
|
137
|
+
label: string;
|
|
138
|
+
description: string;
|
|
139
|
+
formType: string;
|
|
140
|
+
propType: string;
|
|
141
|
+
editable: boolean;
|
|
142
|
+
required: boolean;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
triggers: string[];
|
|
146
|
+
category: string;
|
|
147
|
+
StylesPanelSections: string[];
|
|
148
|
+
layout: null;
|
|
149
|
+
name: string;
|
|
150
|
+
tag: string;
|
|
151
|
+
description: string;
|
|
152
|
+
}[];
|
|
153
|
+
//# sourceMappingURL=DatePickerModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerModal.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePickerModal.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB;;;;;CAW5B,CAAC;AACF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClC,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "47.0.1-
|
|
3
|
+
"version": "47.0.1-df014a.2+df014a6",
|
|
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": "^47.0.1-
|
|
44
|
+
"@draftbit/types": "^47.0.1-df014a.2+df014a6",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
]
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "df014a665028fd9c7f159e2c7f4fd5bdb4de22e0"
|
|
95
95
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, FIELD_NAME, Triggers, StylesPanelSections, createBoolProp, createTextProp, createTextEnumProp, createStaticBoolProp, createStaticNumberProp, } from "@draftbit/types";
|
|
2
|
+
export const SHARED_SEED_DATA = {
|
|
3
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
4
|
+
category: COMPONENT_TYPES.input,
|
|
5
|
+
StylesPanelSections: [
|
|
6
|
+
StylesPanelSections.Typography,
|
|
7
|
+
StylesPanelSections.Background,
|
|
8
|
+
StylesPanelSections.Size,
|
|
9
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
10
|
+
StylesPanelSections.Position,
|
|
11
|
+
],
|
|
12
|
+
layout: null,
|
|
13
|
+
};
|
|
14
|
+
export const SHARED_SEED_DATA_PROPS = {
|
|
15
|
+
locale: {},
|
|
16
|
+
visible: createBoolProp({
|
|
17
|
+
label: "Visible",
|
|
18
|
+
description: "If true, show the modal. If false, hide the modal.",
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
label: createTextProp({
|
|
22
|
+
label: "Label",
|
|
23
|
+
description: "Label used as the header in the component, defaults to `Select Date`",
|
|
24
|
+
}),
|
|
25
|
+
saveLabel: createTextProp({
|
|
26
|
+
label: "Save Label",
|
|
27
|
+
description: "Label used to confirm a date selection. Defaults to `Save`.",
|
|
28
|
+
}),
|
|
29
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
30
|
+
label: "Disable Save Label",
|
|
31
|
+
description: "Flag indicating if the save label should be disabled and unable to receive events",
|
|
32
|
+
}),
|
|
33
|
+
uppercase: createStaticBoolProp({
|
|
34
|
+
label: "Uppercase",
|
|
35
|
+
description: "Flag indicating if the text in the component should be uppercase. Defaults to true.",
|
|
36
|
+
}),
|
|
37
|
+
startYear: createStaticNumberProp({
|
|
38
|
+
label: "Start Year",
|
|
39
|
+
description: "The start year when the component is rendered. Defaults to 1800.",
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
endYear: createStaticNumberProp({
|
|
43
|
+
label: "End Year",
|
|
44
|
+
description: "The end year when the component is rendered. Defaults to 2200.",
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
export const SEED_DATA = [
|
|
49
|
+
{
|
|
50
|
+
name: "Single Date Picker Modal",
|
|
51
|
+
tag: "SingleDatePickerModal",
|
|
52
|
+
description: "A modal allowing date selection.",
|
|
53
|
+
...SHARED_SEED_DATA,
|
|
54
|
+
props: {
|
|
55
|
+
mode: createTextEnumProp({
|
|
56
|
+
label: "Mode",
|
|
57
|
+
description: "The selection mode of the date picker",
|
|
58
|
+
required: true,
|
|
59
|
+
options: ["single", "multiple", "range"],
|
|
60
|
+
editable: false,
|
|
61
|
+
defaultValue: "single",
|
|
62
|
+
formType: FORM_TYPES.flatArray,
|
|
63
|
+
}),
|
|
64
|
+
fieldName: {
|
|
65
|
+
...FIELD_NAME,
|
|
66
|
+
handlerPropName: "onConfirm",
|
|
67
|
+
valuePropName: "date",
|
|
68
|
+
defaultValue: "date",
|
|
69
|
+
},
|
|
70
|
+
...SHARED_SEED_DATA_PROPS,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
FORM_TYPES,
|
|
4
|
+
FIELD_NAME,
|
|
5
|
+
Triggers,
|
|
6
|
+
StylesPanelSections,
|
|
7
|
+
createBoolProp,
|
|
8
|
+
createTextProp,
|
|
9
|
+
createTextEnumProp,
|
|
10
|
+
createStaticBoolProp,
|
|
11
|
+
createStaticNumberProp,
|
|
12
|
+
} from "@draftbit/types";
|
|
13
|
+
|
|
14
|
+
export const SHARED_SEED_DATA = {
|
|
15
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
16
|
+
category: COMPONENT_TYPES.input,
|
|
17
|
+
StylesPanelSections: [
|
|
18
|
+
StylesPanelSections.Typography,
|
|
19
|
+
StylesPanelSections.Background,
|
|
20
|
+
StylesPanelSections.Size,
|
|
21
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
22
|
+
StylesPanelSections.Position,
|
|
23
|
+
],
|
|
24
|
+
layout: null,
|
|
25
|
+
};
|
|
26
|
+
export const SHARED_SEED_DATA_PROPS = {
|
|
27
|
+
locale: {},
|
|
28
|
+
visible: createBoolProp({
|
|
29
|
+
label: "Visible",
|
|
30
|
+
description: "If true, show the modal. If false, hide the modal.",
|
|
31
|
+
required: true,
|
|
32
|
+
}),
|
|
33
|
+
label: createTextProp({
|
|
34
|
+
label: "Label",
|
|
35
|
+
description:
|
|
36
|
+
"Label used as the header in the component, defaults to `Select Date`",
|
|
37
|
+
}),
|
|
38
|
+
saveLabel: createTextProp({
|
|
39
|
+
label: "Save Label",
|
|
40
|
+
description: "Label used to confirm a date selection. Defaults to `Save`.",
|
|
41
|
+
}),
|
|
42
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
43
|
+
label: "Disable Save Label",
|
|
44
|
+
description:
|
|
45
|
+
"Flag indicating if the save label should be disabled and unable to receive events",
|
|
46
|
+
}),
|
|
47
|
+
uppercase: createStaticBoolProp({
|
|
48
|
+
label: "Uppercase",
|
|
49
|
+
description:
|
|
50
|
+
"Flag indicating if the text in the component should be uppercase. Defaults to true.",
|
|
51
|
+
}),
|
|
52
|
+
startYear: createStaticNumberProp({
|
|
53
|
+
label: "Start Year",
|
|
54
|
+
description:
|
|
55
|
+
"The start year when the component is rendered. Defaults to 1800.",
|
|
56
|
+
required: false,
|
|
57
|
+
}),
|
|
58
|
+
endYear: createStaticNumberProp({
|
|
59
|
+
label: "End Year",
|
|
60
|
+
description:
|
|
61
|
+
"The end year when the component is rendered. Defaults to 2200.",
|
|
62
|
+
required: false,
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const SEED_DATA = [
|
|
67
|
+
{
|
|
68
|
+
name: "Single Date Picker Modal",
|
|
69
|
+
tag: "SingleDatePickerModal",
|
|
70
|
+
description: "A modal allowing date selection.",
|
|
71
|
+
...SHARED_SEED_DATA,
|
|
72
|
+
props: {
|
|
73
|
+
mode: createTextEnumProp({
|
|
74
|
+
label: "Mode",
|
|
75
|
+
description: "The selection mode of the date picker",
|
|
76
|
+
required: true,
|
|
77
|
+
options: ["single", "multiple", "range"],
|
|
78
|
+
editable: false,
|
|
79
|
+
defaultValue: "single",
|
|
80
|
+
formType: FORM_TYPES.flatArray,
|
|
81
|
+
}),
|
|
82
|
+
fieldName: {
|
|
83
|
+
...FIELD_NAME,
|
|
84
|
+
handlerPropName: "onConfirm",
|
|
85
|
+
valuePropName: "date",
|
|
86
|
+
defaultValue: "date",
|
|
87
|
+
},
|
|
88
|
+
...SHARED_SEED_DATA_PROPS,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
];
|