@draftbit/core 46.7.9-437259.2 → 46.7.9-57e94b.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/components/DeprecatedFAB.js +21 -3
- package/lib/commonjs/components/Divider.js +14 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +20 -3
- package/lib/commonjs/components/Portal/PortalConsumer.js +22 -7
- package/lib/commonjs/index.js +0 -13
- package/lib/commonjs/mappings/DatePickerModal.js +151 -0
- package/lib/module/components/IconButton.js +4 -21
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePickerModal.js +145 -0
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePickerModal.d.ts +241 -0
- package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/DatePickerModal.js +152 -0
- package/src/mappings/DatePickerModal.ts +175 -0
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +0 -73
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +0 -35
- package/lib/commonjs/components/DeckSwiper/index.js +0 -20
- package/lib/commonjs/mappings/DeckSwiper.js +0 -52
- package/lib/commonjs/mappings/DeckSwiperCard.js +0 -16
- package/lib/module/components/DeckSwiper/DeckSwiper.js +0 -65
- package/lib/module/components/DeckSwiper/DeckSwiperCard.js +0 -27
- package/lib/module/components/DeckSwiper/index.js +0 -2
- package/lib/module/mappings/DeckSwiper.js +0 -45
- package/lib/module/mappings/DeckSwiperCard.js +0 -9
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +0 -15
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +0 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +0 -13
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +0 -1
- package/lib/typescript/src/components/DeckSwiper/index.d.ts +0 -3
- package/lib/typescript/src/components/DeckSwiper/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +0 -83
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +0 -1
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +0 -9
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +0 -1
- package/src/components/DeckSwiper/DeckSwiper.js +0 -34
- package/src/components/DeckSwiper/DeckSwiper.tsx +0 -93
- package/src/components/DeckSwiper/DeckSwiperCard.js +0 -22
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +0 -42
- package/src/components/DeckSwiper/index.js +0 -2
- package/src/components/DeckSwiper/index.tsx +0 -2
- package/src/mappings/DeckSwiper.js +0 -45
- package/src/mappings/DeckSwiper.ts +0 -54
- package/src/mappings/DeckSwiperCard.js +0 -9
- package/src/mappings/DeckSwiperCard.ts +0 -13
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
export declare const SEED_DATA: ({
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
props: {
|
|
5
|
+
onConfirm: {
|
|
6
|
+
label: string;
|
|
7
|
+
description: string;
|
|
8
|
+
editable: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
formType: string;
|
|
11
|
+
propType: string;
|
|
12
|
+
defaultValue: null;
|
|
13
|
+
group: string;
|
|
14
|
+
};
|
|
15
|
+
onChange: {
|
|
16
|
+
label: string;
|
|
17
|
+
description: string;
|
|
18
|
+
editable: boolean;
|
|
19
|
+
required: boolean;
|
|
20
|
+
formType: string;
|
|
21
|
+
propType: string;
|
|
22
|
+
defaultValue: null;
|
|
23
|
+
group: string;
|
|
24
|
+
};
|
|
25
|
+
mode: {
|
|
26
|
+
group: string;
|
|
27
|
+
label: string;
|
|
28
|
+
description: string;
|
|
29
|
+
editable: boolean;
|
|
30
|
+
required: boolean;
|
|
31
|
+
formType: string;
|
|
32
|
+
propType: string;
|
|
33
|
+
defaultValue: null;
|
|
34
|
+
options: never[];
|
|
35
|
+
};
|
|
36
|
+
fieldName: {
|
|
37
|
+
handlerPropName: string;
|
|
38
|
+
group: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description: string;
|
|
41
|
+
formType: string;
|
|
42
|
+
propType: string;
|
|
43
|
+
defaultValue: string;
|
|
44
|
+
valuePropName: string;
|
|
45
|
+
editable: boolean;
|
|
46
|
+
required: boolean;
|
|
47
|
+
};
|
|
48
|
+
onDismiss: {
|
|
49
|
+
label: string;
|
|
50
|
+
description: string;
|
|
51
|
+
editable: boolean;
|
|
52
|
+
required: boolean;
|
|
53
|
+
formType: string;
|
|
54
|
+
propType: string;
|
|
55
|
+
defaultValue: null;
|
|
56
|
+
group: string;
|
|
57
|
+
};
|
|
58
|
+
locale: any;
|
|
59
|
+
visible: {
|
|
60
|
+
label: string;
|
|
61
|
+
description: string;
|
|
62
|
+
formType: string;
|
|
63
|
+
propType: string;
|
|
64
|
+
defaultValue: boolean;
|
|
65
|
+
editable: boolean;
|
|
66
|
+
required: boolean;
|
|
67
|
+
group: string;
|
|
68
|
+
};
|
|
69
|
+
label: any;
|
|
70
|
+
saveLabel: any;
|
|
71
|
+
saveLabelDisabled: {
|
|
72
|
+
label: string;
|
|
73
|
+
description: string;
|
|
74
|
+
formType: string;
|
|
75
|
+
propType: string;
|
|
76
|
+
defaultValue: boolean;
|
|
77
|
+
editable: boolean;
|
|
78
|
+
required: boolean;
|
|
79
|
+
group: string;
|
|
80
|
+
};
|
|
81
|
+
uppercase: {
|
|
82
|
+
label: string;
|
|
83
|
+
description: string;
|
|
84
|
+
formType: string;
|
|
85
|
+
propType: string;
|
|
86
|
+
defaultValue: boolean;
|
|
87
|
+
editable: boolean;
|
|
88
|
+
required: boolean;
|
|
89
|
+
group: string;
|
|
90
|
+
};
|
|
91
|
+
startYear: {
|
|
92
|
+
label: string;
|
|
93
|
+
description: string;
|
|
94
|
+
formType: string;
|
|
95
|
+
propType: string;
|
|
96
|
+
group: string;
|
|
97
|
+
defaultValue: null;
|
|
98
|
+
editable: boolean;
|
|
99
|
+
required: boolean;
|
|
100
|
+
step: number;
|
|
101
|
+
};
|
|
102
|
+
endYear: {
|
|
103
|
+
label: string;
|
|
104
|
+
description: string;
|
|
105
|
+
formType: string;
|
|
106
|
+
propType: string;
|
|
107
|
+
group: string;
|
|
108
|
+
defaultValue: null;
|
|
109
|
+
editable: boolean;
|
|
110
|
+
required: boolean;
|
|
111
|
+
step: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
tag: string;
|
|
115
|
+
packageName: string;
|
|
116
|
+
triggers: string[];
|
|
117
|
+
category: string;
|
|
118
|
+
StylesPanelSections: string[];
|
|
119
|
+
} | {
|
|
120
|
+
name: string;
|
|
121
|
+
description: string;
|
|
122
|
+
props: {
|
|
123
|
+
onConfirm: {
|
|
124
|
+
label: string;
|
|
125
|
+
description: string;
|
|
126
|
+
editable: boolean;
|
|
127
|
+
required: boolean;
|
|
128
|
+
formType: string;
|
|
129
|
+
propType: string;
|
|
130
|
+
defaultValue: null;
|
|
131
|
+
group: string;
|
|
132
|
+
};
|
|
133
|
+
onChange: {
|
|
134
|
+
label: string;
|
|
135
|
+
description: string;
|
|
136
|
+
editable: boolean;
|
|
137
|
+
required: boolean;
|
|
138
|
+
formType: string;
|
|
139
|
+
propType: string;
|
|
140
|
+
defaultValue: null;
|
|
141
|
+
group: string;
|
|
142
|
+
};
|
|
143
|
+
mode: {
|
|
144
|
+
group: string;
|
|
145
|
+
label: string;
|
|
146
|
+
description: string;
|
|
147
|
+
editable: boolean;
|
|
148
|
+
required: boolean;
|
|
149
|
+
formType: string;
|
|
150
|
+
propType: string;
|
|
151
|
+
defaultValue: null;
|
|
152
|
+
options: never[];
|
|
153
|
+
};
|
|
154
|
+
moreLabel: any;
|
|
155
|
+
startLabel: any;
|
|
156
|
+
endLabel: any;
|
|
157
|
+
fieldName: {
|
|
158
|
+
handlerPropName: string;
|
|
159
|
+
group: string;
|
|
160
|
+
label: string;
|
|
161
|
+
description: string;
|
|
162
|
+
formType: string;
|
|
163
|
+
propType: string;
|
|
164
|
+
defaultValue: string;
|
|
165
|
+
valuePropName: string;
|
|
166
|
+
editable: boolean;
|
|
167
|
+
required: boolean;
|
|
168
|
+
};
|
|
169
|
+
onDismiss: {
|
|
170
|
+
label: string;
|
|
171
|
+
description: string;
|
|
172
|
+
editable: boolean;
|
|
173
|
+
required: boolean;
|
|
174
|
+
formType: string;
|
|
175
|
+
propType: string;
|
|
176
|
+
defaultValue: null;
|
|
177
|
+
group: string;
|
|
178
|
+
};
|
|
179
|
+
locale: any;
|
|
180
|
+
visible: {
|
|
181
|
+
label: string;
|
|
182
|
+
description: string;
|
|
183
|
+
formType: string;
|
|
184
|
+
propType: string;
|
|
185
|
+
defaultValue: boolean;
|
|
186
|
+
editable: boolean;
|
|
187
|
+
required: boolean;
|
|
188
|
+
group: string;
|
|
189
|
+
};
|
|
190
|
+
label: any;
|
|
191
|
+
saveLabel: any;
|
|
192
|
+
saveLabelDisabled: {
|
|
193
|
+
label: string;
|
|
194
|
+
description: string;
|
|
195
|
+
formType: string;
|
|
196
|
+
propType: string;
|
|
197
|
+
defaultValue: boolean;
|
|
198
|
+
editable: boolean;
|
|
199
|
+
required: boolean;
|
|
200
|
+
group: string;
|
|
201
|
+
};
|
|
202
|
+
uppercase: {
|
|
203
|
+
label: string;
|
|
204
|
+
description: string;
|
|
205
|
+
formType: string;
|
|
206
|
+
propType: string;
|
|
207
|
+
defaultValue: boolean;
|
|
208
|
+
editable: boolean;
|
|
209
|
+
required: boolean;
|
|
210
|
+
group: string;
|
|
211
|
+
};
|
|
212
|
+
startYear: {
|
|
213
|
+
label: string;
|
|
214
|
+
description: string;
|
|
215
|
+
formType: string;
|
|
216
|
+
propType: string;
|
|
217
|
+
group: string;
|
|
218
|
+
defaultValue: null;
|
|
219
|
+
editable: boolean;
|
|
220
|
+
required: boolean;
|
|
221
|
+
step: number;
|
|
222
|
+
};
|
|
223
|
+
endYear: {
|
|
224
|
+
label: string;
|
|
225
|
+
description: string;
|
|
226
|
+
formType: string;
|
|
227
|
+
propType: string;
|
|
228
|
+
group: string;
|
|
229
|
+
defaultValue: null;
|
|
230
|
+
editable: boolean;
|
|
231
|
+
required: boolean;
|
|
232
|
+
step: number;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
tag: string;
|
|
236
|
+
packageName: string;
|
|
237
|
+
triggers: string[];
|
|
238
|
+
category: string;
|
|
239
|
+
StylesPanelSections: string[];
|
|
240
|
+
})[];
|
|
241
|
+
//# sourceMappingURL=DatePickerModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerModal.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePickerModal.ts"],"names":[],"mappings":"AA0FA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoFrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.7.9-
|
|
3
|
+
"version": "46.7.9-57e94b.2+57e94bb",
|
|
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.7.9-
|
|
44
|
+
"@draftbit/types": "^46.7.9-57e94b.2+57e94bb",
|
|
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",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"lodash.isnumber": "^3.0.3",
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
|
-
"react-native-deck-swiper": "^2.0.12",
|
|
57
56
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
|
+
"react-native-paper-dates": "^0.12.0",
|
|
58
58
|
"react-native-svg": "12.3.0",
|
|
59
59
|
"react-native-typography": "^1.4.1",
|
|
60
60
|
"react-native-web-swiper": "^2.2.3"
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
]
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "57e94bb598c22c342071a6b52dd51b721098d85c"
|
|
96
96
|
}
|
package/src/index.js
CHANGED
|
@@ -31,7 +31,6 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
|
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
|
-
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
34
|
/* Deprecated: Fix or Delete! */
|
|
36
35
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
37
36
|
export { default as Picker } from "./components/Picker/Picker";
|
package/src/index.tsx
CHANGED
|
@@ -51,8 +51,6 @@ export {
|
|
|
51
51
|
RadioButtonFieldGroup,
|
|
52
52
|
} from "./components/RadioButton/index";
|
|
53
53
|
|
|
54
|
-
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
55
|
-
|
|
56
54
|
/* Deprecated: Fix or Delete! */
|
|
57
55
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
58
56
|
export { default as Picker } from "./components/Picker/Picker";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, Triggers, StylesPanelSections, createBoolProp, createTextProp, createTextEnumProp, createStaticBoolProp, createStaticNumberProp, createFieldNameProp, createActionProp, GROUPS, } from "@draftbit/types";
|
|
2
|
+
/**
|
|
3
|
+
* Maps react-native-paper-dates DatePickerModal in modes: "single" and "multiple"
|
|
4
|
+
* Cannot map mode "range" because it relies on 2 fieldNames (startDate and endDate)
|
|
5
|
+
*/
|
|
6
|
+
const SHARED_SEED_DATA = {
|
|
7
|
+
tag: "DatePickerModal",
|
|
8
|
+
packageName: "react-native-paper-dates",
|
|
9
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
10
|
+
category: COMPONENT_TYPES.input,
|
|
11
|
+
StylesPanelSections: [
|
|
12
|
+
StylesPanelSections.Typography,
|
|
13
|
+
StylesPanelSections.Background,
|
|
14
|
+
StylesPanelSections.Size,
|
|
15
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
16
|
+
StylesPanelSections.Position,
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
const SHARED_SEED_DATA_PROPS = {
|
|
20
|
+
onDismiss: createActionProp({
|
|
21
|
+
label: "On Dismiss",
|
|
22
|
+
description: "Called when date picker dimissed",
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
locale: createTextProp({
|
|
26
|
+
label: "Locale",
|
|
27
|
+
description: "A locale can be composed of both a base language, the country (territory) of use, and possibly codeset (which is usually assumed). For example, German is de",
|
|
28
|
+
defaultValue: "en",
|
|
29
|
+
required: true,
|
|
30
|
+
group: GROUPS.basic,
|
|
31
|
+
}),
|
|
32
|
+
visible: createBoolProp({
|
|
33
|
+
label: "Visible",
|
|
34
|
+
description: "Flag indicating if the component should be displayed",
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
label: createTextProp({
|
|
38
|
+
label: "Label",
|
|
39
|
+
description: "The label used as the header in the component",
|
|
40
|
+
defaultValue: "Select date",
|
|
41
|
+
group: GROUPS.basic,
|
|
42
|
+
}),
|
|
43
|
+
saveLabel: createTextProp({
|
|
44
|
+
label: "Save Label",
|
|
45
|
+
description: "Label used to confirm a date selection",
|
|
46
|
+
defaultValue: "Save",
|
|
47
|
+
group: GROUPS.basic,
|
|
48
|
+
}),
|
|
49
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
50
|
+
label: "Disable Save Label",
|
|
51
|
+
description: "Flag indicating if the save label should be disabled and unable to receive events",
|
|
52
|
+
}),
|
|
53
|
+
uppercase: createStaticBoolProp({
|
|
54
|
+
label: "Uppercase",
|
|
55
|
+
description: "Flag indicating if the text in the component should be uppercase",
|
|
56
|
+
defaultValue: true,
|
|
57
|
+
}),
|
|
58
|
+
startYear: createStaticNumberProp({
|
|
59
|
+
label: "Start Year",
|
|
60
|
+
description: "The start year when the component is rendered",
|
|
61
|
+
required: false,
|
|
62
|
+
defaultValue: 1800,
|
|
63
|
+
}),
|
|
64
|
+
endYear: createStaticNumberProp({
|
|
65
|
+
label: "End Year",
|
|
66
|
+
description: "The end year when the component is rendered",
|
|
67
|
+
required: false,
|
|
68
|
+
defaultValue: 2200,
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
export const SEED_DATA = [
|
|
72
|
+
{
|
|
73
|
+
...SHARED_SEED_DATA,
|
|
74
|
+
name: "Date Picker Modal",
|
|
75
|
+
description: "Date Picker modal for date selection",
|
|
76
|
+
props: {
|
|
77
|
+
...SHARED_SEED_DATA_PROPS,
|
|
78
|
+
onConfirm: createActionProp({
|
|
79
|
+
label: "On Confirm",
|
|
80
|
+
description: "Called when date selected and confirmed",
|
|
81
|
+
required: true,
|
|
82
|
+
}),
|
|
83
|
+
onChange: createActionProp({
|
|
84
|
+
label: "On Change",
|
|
85
|
+
description: "Called when date selection changes",
|
|
86
|
+
}),
|
|
87
|
+
mode: createTextEnumProp({
|
|
88
|
+
label: "Mode",
|
|
89
|
+
description: "The selection mode of the date picker",
|
|
90
|
+
required: true,
|
|
91
|
+
options: ["single"],
|
|
92
|
+
editable: false,
|
|
93
|
+
defaultValue: "single",
|
|
94
|
+
formType: FORM_TYPES.flatArray,
|
|
95
|
+
}),
|
|
96
|
+
fieldName: createFieldNameProp({
|
|
97
|
+
defaultValue: "date",
|
|
98
|
+
handlerPropName: "onConfirm",
|
|
99
|
+
valuePropName: "date",
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
...SHARED_SEED_DATA,
|
|
105
|
+
name: "Multiple Date Picker Modal",
|
|
106
|
+
description: "Date Picker modal for multiple date selection",
|
|
107
|
+
props: {
|
|
108
|
+
...SHARED_SEED_DATA_PROPS,
|
|
109
|
+
onConfirm: createActionProp({
|
|
110
|
+
label: "On Confirm",
|
|
111
|
+
description: "Called when dates selected and confirmed",
|
|
112
|
+
required: true,
|
|
113
|
+
}),
|
|
114
|
+
onChange: createActionProp({
|
|
115
|
+
label: "On Change",
|
|
116
|
+
description: "Called when dates selection changes",
|
|
117
|
+
}),
|
|
118
|
+
mode: createTextEnumProp({
|
|
119
|
+
label: "Mode",
|
|
120
|
+
description: "The selection mode of the date picker",
|
|
121
|
+
required: true,
|
|
122
|
+
options: ["multiple"],
|
|
123
|
+
editable: false,
|
|
124
|
+
defaultValue: "multiple",
|
|
125
|
+
formType: FORM_TYPES.flatArray,
|
|
126
|
+
}),
|
|
127
|
+
moreLabel: createTextProp({
|
|
128
|
+
label: "More Label",
|
|
129
|
+
description: "The label used display when multiple dates have been selected in the component",
|
|
130
|
+
defaultValue: "More",
|
|
131
|
+
group: GROUPS.basic,
|
|
132
|
+
}),
|
|
133
|
+
startLabel: createTextProp({
|
|
134
|
+
label: "Start Label",
|
|
135
|
+
description: "The label used as the prefix to the starting date in the component",
|
|
136
|
+
defaultValue: "Start",
|
|
137
|
+
group: GROUPS.basic,
|
|
138
|
+
}),
|
|
139
|
+
endLabel: createTextProp({
|
|
140
|
+
label: "End Label",
|
|
141
|
+
description: "The label used as the suffix to the ending date in the component",
|
|
142
|
+
defaultValue: "End",
|
|
143
|
+
group: GROUPS.basic,
|
|
144
|
+
}),
|
|
145
|
+
fieldName: createFieldNameProp({
|
|
146
|
+
defaultValue: "dates",
|
|
147
|
+
handlerPropName: "onConfirm",
|
|
148
|
+
valuePropName: "dates",
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
];
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
FORM_TYPES,
|
|
4
|
+
Triggers,
|
|
5
|
+
StylesPanelSections,
|
|
6
|
+
createBoolProp,
|
|
7
|
+
createTextProp,
|
|
8
|
+
createTextEnumProp,
|
|
9
|
+
createStaticBoolProp,
|
|
10
|
+
createStaticNumberProp,
|
|
11
|
+
createFieldNameProp,
|
|
12
|
+
createActionProp,
|
|
13
|
+
GROUPS,
|
|
14
|
+
} from "@draftbit/types";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Maps react-native-paper-dates DatePickerModal in modes: "single" and "multiple"
|
|
18
|
+
* Cannot map mode "range" because it relies on 2 fieldNames (startDate and endDate)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const SHARED_SEED_DATA = {
|
|
22
|
+
tag: "DatePickerModal",
|
|
23
|
+
packageName: "react-native-paper-dates",
|
|
24
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
25
|
+
category: COMPONENT_TYPES.input,
|
|
26
|
+
StylesPanelSections: [
|
|
27
|
+
StylesPanelSections.Typography,
|
|
28
|
+
StylesPanelSections.Background,
|
|
29
|
+
StylesPanelSections.Size,
|
|
30
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
31
|
+
StylesPanelSections.Position,
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const SHARED_SEED_DATA_PROPS = {
|
|
36
|
+
onDismiss: createActionProp({
|
|
37
|
+
label: "On Dismiss",
|
|
38
|
+
description: "Called when date picker dimissed",
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
locale: createTextProp({
|
|
42
|
+
label: "Locale",
|
|
43
|
+
description:
|
|
44
|
+
"A locale can be composed of both a base language, the country (territory) of use, and possibly codeset (which is usually assumed). For example, German is de",
|
|
45
|
+
defaultValue: "en",
|
|
46
|
+
required: true,
|
|
47
|
+
group: GROUPS.basic,
|
|
48
|
+
}),
|
|
49
|
+
visible: createBoolProp({
|
|
50
|
+
label: "Visible",
|
|
51
|
+
description: "Flag indicating if the component should be displayed",
|
|
52
|
+
required: true,
|
|
53
|
+
}),
|
|
54
|
+
label: createTextProp({
|
|
55
|
+
label: "Label",
|
|
56
|
+
description: "The label used as the header in the component",
|
|
57
|
+
defaultValue: "Select date",
|
|
58
|
+
group: GROUPS.basic,
|
|
59
|
+
}),
|
|
60
|
+
saveLabel: createTextProp({
|
|
61
|
+
label: "Save Label",
|
|
62
|
+
description: "Label used to confirm a date selection",
|
|
63
|
+
defaultValue: "Save",
|
|
64
|
+
group: GROUPS.basic,
|
|
65
|
+
}),
|
|
66
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
67
|
+
label: "Disable Save Label",
|
|
68
|
+
description:
|
|
69
|
+
"Flag indicating if the save label should be disabled and unable to receive events",
|
|
70
|
+
}),
|
|
71
|
+
uppercase: createStaticBoolProp({
|
|
72
|
+
label: "Uppercase",
|
|
73
|
+
description:
|
|
74
|
+
"Flag indicating if the text in the component should be uppercase",
|
|
75
|
+
defaultValue: true,
|
|
76
|
+
}),
|
|
77
|
+
startYear: createStaticNumberProp({
|
|
78
|
+
label: "Start Year",
|
|
79
|
+
description: "The start year when the component is rendered",
|
|
80
|
+
required: false,
|
|
81
|
+
defaultValue: 1800,
|
|
82
|
+
}),
|
|
83
|
+
endYear: createStaticNumberProp({
|
|
84
|
+
label: "End Year",
|
|
85
|
+
description: "The end year when the component is rendered",
|
|
86
|
+
required: false,
|
|
87
|
+
defaultValue: 2200,
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const SEED_DATA = [
|
|
92
|
+
{
|
|
93
|
+
...SHARED_SEED_DATA,
|
|
94
|
+
name: "Date Picker Modal",
|
|
95
|
+
description: "Date Picker modal for date selection",
|
|
96
|
+
props: {
|
|
97
|
+
...SHARED_SEED_DATA_PROPS,
|
|
98
|
+
onConfirm: createActionProp({
|
|
99
|
+
label: "On Confirm",
|
|
100
|
+
description: "Called when date selected and confirmed",
|
|
101
|
+
required: true,
|
|
102
|
+
}),
|
|
103
|
+
onChange: createActionProp({
|
|
104
|
+
label: "On Change",
|
|
105
|
+
description: "Called when date selection changes",
|
|
106
|
+
}),
|
|
107
|
+
mode: createTextEnumProp({
|
|
108
|
+
label: "Mode",
|
|
109
|
+
description: "The selection mode of the date picker",
|
|
110
|
+
required: true,
|
|
111
|
+
options: ["single"],
|
|
112
|
+
editable: false,
|
|
113
|
+
defaultValue: "single",
|
|
114
|
+
formType: FORM_TYPES.flatArray,
|
|
115
|
+
}),
|
|
116
|
+
fieldName: createFieldNameProp({
|
|
117
|
+
defaultValue: "date",
|
|
118
|
+
handlerPropName: "onConfirm",
|
|
119
|
+
valuePropName: "date",
|
|
120
|
+
}),
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
...SHARED_SEED_DATA,
|
|
125
|
+
name: "Multiple Date Picker Modal",
|
|
126
|
+
description: "Date Picker modal for multiple date selection",
|
|
127
|
+
props: {
|
|
128
|
+
...SHARED_SEED_DATA_PROPS,
|
|
129
|
+
onConfirm: createActionProp({
|
|
130
|
+
label: "On Confirm",
|
|
131
|
+
description: "Called when dates selected and confirmed",
|
|
132
|
+
required: true,
|
|
133
|
+
}),
|
|
134
|
+
onChange: createActionProp({
|
|
135
|
+
label: "On Change",
|
|
136
|
+
description: "Called when dates selection changes",
|
|
137
|
+
}),
|
|
138
|
+
mode: createTextEnumProp({
|
|
139
|
+
label: "Mode",
|
|
140
|
+
description: "The selection mode of the date picker",
|
|
141
|
+
required: true,
|
|
142
|
+
options: ["multiple"],
|
|
143
|
+
editable: false,
|
|
144
|
+
defaultValue: "multiple",
|
|
145
|
+
formType: FORM_TYPES.flatArray,
|
|
146
|
+
}),
|
|
147
|
+
moreLabel: createTextProp({
|
|
148
|
+
label: "More Label",
|
|
149
|
+
description:
|
|
150
|
+
"The label used display when multiple dates have been selected in the component",
|
|
151
|
+
defaultValue: "More",
|
|
152
|
+
group: GROUPS.basic,
|
|
153
|
+
}),
|
|
154
|
+
startLabel: createTextProp({
|
|
155
|
+
label: "Start Label",
|
|
156
|
+
description:
|
|
157
|
+
"The label used as the prefix to the starting date in the component",
|
|
158
|
+
defaultValue: "Start",
|
|
159
|
+
group: GROUPS.basic,
|
|
160
|
+
}),
|
|
161
|
+
endLabel: createTextProp({
|
|
162
|
+
label: "End Label",
|
|
163
|
+
description:
|
|
164
|
+
"The label used as the suffix to the ending date in the component",
|
|
165
|
+
defaultValue: "End",
|
|
166
|
+
group: GROUPS.basic,
|
|
167
|
+
}),
|
|
168
|
+
fieldName: createFieldNameProp({
|
|
169
|
+
defaultValue: "dates",
|
|
170
|
+
handlerPropName: "onConfirm",
|
|
171
|
+
valuePropName: "dates",
|
|
172
|
+
}),
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
];
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeDeckSwiper = _interopRequireDefault(require("react-native-deck-swiper"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const DeckSwiper = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
onIndexChanged,
|
|
14
|
-
onEndReached,
|
|
15
|
-
startCardIndex = 0,
|
|
16
|
-
infiniteSwiping = false,
|
|
17
|
-
verticalEnabled = true,
|
|
18
|
-
horizontalEnabled = true,
|
|
19
|
-
visibleCardCount = 1,
|
|
20
|
-
style,
|
|
21
|
-
children
|
|
22
|
-
} = _ref;
|
|
23
|
-
const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
|
|
24
|
-
|
|
25
|
-
// an array of indices based on children count
|
|
26
|
-
const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* By default react-native-deck-swiper positions everything with absolute position
|
|
30
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure
|
|
31
|
-
*
|
|
32
|
-
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird
|
|
33
|
-
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space
|
|
34
|
-
* This effectivley makes the default height of the container be the height of the first card
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
38
|
-
style: styles.containerHeightFiller
|
|
39
|
-
}, childrenArray.length && childrenArray[0]), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
|
|
40
|
-
cards: cardsFillerData,
|
|
41
|
-
renderCard: (_, i) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[i]),
|
|
42
|
-
keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
|
|
43
|
-
containerStyle: _reactNative.StyleSheet.flatten([styles.cardsContainer, style]),
|
|
44
|
-
cardStyle: styles.card,
|
|
45
|
-
onSwiped: onIndexChanged,
|
|
46
|
-
onSwipedAll: onEndReached,
|
|
47
|
-
cardIndex: startCardIndex,
|
|
48
|
-
infinite: infiniteSwiping,
|
|
49
|
-
verticalSwipe: verticalEnabled,
|
|
50
|
-
horizontalSwipe: horizontalEnabled,
|
|
51
|
-
showSecondCard: visibleCardCount > 1,
|
|
52
|
-
stackSize: visibleCardCount,
|
|
53
|
-
backgroundColor: "transparent",
|
|
54
|
-
cardVerticalMargin: 0,
|
|
55
|
-
cardHorizontalMargin: 0
|
|
56
|
-
}));
|
|
57
|
-
};
|
|
58
|
-
const styles = _reactNative.StyleSheet.create({
|
|
59
|
-
cardsContainer: {
|
|
60
|
-
width: "100%"
|
|
61
|
-
},
|
|
62
|
-
card: {
|
|
63
|
-
left: 0,
|
|
64
|
-
right: 0,
|
|
65
|
-
width: "auto",
|
|
66
|
-
height: "auto"
|
|
67
|
-
},
|
|
68
|
-
containerHeightFiller: {
|
|
69
|
-
opacity: 0.0
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
var _default = DeckSwiper;
|
|
73
|
-
exports.default = _default;
|