@draftbit/core 46.7.9-9ce779.2 → 46.7.9-b47217.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/Portal/PortalManager.js +8 -34
- package/lib/commonjs/index.js +0 -13
- package/lib/commonjs/mappings/DatePickerModal.js +145 -0
- package/lib/commonjs/styles/overlay.js +1 -3
- package/lib/module/components/AnimatedCircularProgress.js +1 -13
- package/lib/module/components/Container.js +4 -17
- package/lib/module/components/Divider.js +1 -18
- package/lib/module/components/Picker/PickerComponent.web.js +3 -21
- package/lib/module/components/Pressable.js +2 -15
- package/lib/module/components/Slider.js +4 -21
- package/lib/module/components/StarRating.js +4 -24
- package/lib/module/components/StepIndicator.js +18 -58
- package/lib/module/components/Switch.js +10 -21
- package/lib/module/constants.js +0 -1
- package/lib/module/hooks.js +2 -1
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePickerModal.js +139 -0
- package/lib/module/styles/overlay.js +3 -1
- 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 +3 -4
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/DatePickerModal.js +146 -0
- package/src/mappings/DatePickerModal.ts +168 -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
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-b47217.2+b47217f",
|
|
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-b47217.2+b47217f",
|
|
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,7 +53,6 @@
|
|
|
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",
|
|
58
57
|
"react-native-svg": "12.3.0",
|
|
59
58
|
"react-native-typography": "^1.4.1",
|
|
@@ -92,5 +91,5 @@
|
|
|
92
91
|
]
|
|
93
92
|
]
|
|
94
93
|
},
|
|
95
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "b47217fd8dbf71431b72eb41b8a4b4242ee666ac"
|
|
96
95
|
}
|
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,146 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, Triggers, StylesPanelSections, createBoolProp, createTextProp, createTextEnumProp, createStaticBoolProp, createStaticNumberProp, createFieldNameProp, createActionProp, } 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
|
+
}),
|
|
31
|
+
visible: createBoolProp({
|
|
32
|
+
label: "Visible",
|
|
33
|
+
description: "Flag indicating if the component should be displayed",
|
|
34
|
+
required: true,
|
|
35
|
+
}),
|
|
36
|
+
label: createTextProp({
|
|
37
|
+
label: "Label",
|
|
38
|
+
description: "The label used as the header in the component",
|
|
39
|
+
defaultValue: "Select date",
|
|
40
|
+
}),
|
|
41
|
+
saveLabel: createTextProp({
|
|
42
|
+
label: "Save Label",
|
|
43
|
+
description: "Label used to confirm a date selection",
|
|
44
|
+
defaultValue: "Save",
|
|
45
|
+
}),
|
|
46
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
47
|
+
label: "Disable Save Label",
|
|
48
|
+
description: "Flag indicating if the save label should be disabled and unable to receive events",
|
|
49
|
+
}),
|
|
50
|
+
uppercase: createStaticBoolProp({
|
|
51
|
+
label: "Uppercase",
|
|
52
|
+
description: "Flag indicating if the text in the component should be uppercase",
|
|
53
|
+
defaultValue: true,
|
|
54
|
+
}),
|
|
55
|
+
startYear: createStaticNumberProp({
|
|
56
|
+
label: "Start Year",
|
|
57
|
+
description: "The start year when the component is rendered",
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 1800,
|
|
60
|
+
}),
|
|
61
|
+
endYear: createStaticNumberProp({
|
|
62
|
+
label: "End Year",
|
|
63
|
+
description: "The end year when the component is rendered",
|
|
64
|
+
required: false,
|
|
65
|
+
defaultValue: 2200,
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
export const SEED_DATA = [
|
|
69
|
+
{
|
|
70
|
+
...SHARED_SEED_DATA,
|
|
71
|
+
name: "Date Picker Modal",
|
|
72
|
+
description: "Date Picker modal for date selection",
|
|
73
|
+
props: {
|
|
74
|
+
...SHARED_SEED_DATA_PROPS,
|
|
75
|
+
onConfirm: createActionProp({
|
|
76
|
+
label: "On Confirm",
|
|
77
|
+
description: "Called when date selected and confirmed",
|
|
78
|
+
required: true,
|
|
79
|
+
}),
|
|
80
|
+
onChange: createActionProp({
|
|
81
|
+
label: "On Change",
|
|
82
|
+
description: "Called when date selection changes",
|
|
83
|
+
}),
|
|
84
|
+
mode: createTextEnumProp({
|
|
85
|
+
label: "Mode",
|
|
86
|
+
description: "The selection mode of the date picker",
|
|
87
|
+
required: true,
|
|
88
|
+
options: ["single"],
|
|
89
|
+
editable: false,
|
|
90
|
+
defaultValue: "single",
|
|
91
|
+
formType: FORM_TYPES.flatArray,
|
|
92
|
+
}),
|
|
93
|
+
fieldName: createFieldNameProp({
|
|
94
|
+
defaultValue: "date",
|
|
95
|
+
handlerPropName: "onConfirm",
|
|
96
|
+
valuePropName: "date",
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
...SHARED_SEED_DATA,
|
|
102
|
+
name: "Multiple Date Picker Modal",
|
|
103
|
+
description: "Date Picker modal for multiple date selection",
|
|
104
|
+
props: {
|
|
105
|
+
...SHARED_SEED_DATA_PROPS,
|
|
106
|
+
onConfirm: createActionProp({
|
|
107
|
+
label: "On Confirm",
|
|
108
|
+
description: "Called when dates selected and confirmed",
|
|
109
|
+
required: true,
|
|
110
|
+
}),
|
|
111
|
+
onChange: createActionProp({
|
|
112
|
+
label: "On Change",
|
|
113
|
+
description: "Called when dates selection changes",
|
|
114
|
+
}),
|
|
115
|
+
mode: createTextEnumProp({
|
|
116
|
+
label: "Mode",
|
|
117
|
+
description: "The selection mode of the date picker",
|
|
118
|
+
required: true,
|
|
119
|
+
options: ["multiple"],
|
|
120
|
+
editable: false,
|
|
121
|
+
defaultValue: "multiple",
|
|
122
|
+
formType: FORM_TYPES.flatArray,
|
|
123
|
+
}),
|
|
124
|
+
moreLabel: createTextProp({
|
|
125
|
+
label: "More Label",
|
|
126
|
+
description: "The label used display when multiple dates have been selected in the component",
|
|
127
|
+
defaultValue: "More",
|
|
128
|
+
}),
|
|
129
|
+
startLabel: createTextProp({
|
|
130
|
+
label: "Start Label",
|
|
131
|
+
description: "The label used as the prefix to the starting date in the component",
|
|
132
|
+
defaultValue: "Start",
|
|
133
|
+
}),
|
|
134
|
+
endLabel: createTextProp({
|
|
135
|
+
label: "End Label",
|
|
136
|
+
description: "The label used as the suffix to the ending date in the component",
|
|
137
|
+
defaultValue: "End",
|
|
138
|
+
}),
|
|
139
|
+
fieldName: createFieldNameProp({
|
|
140
|
+
defaultValue: "dates",
|
|
141
|
+
handlerPropName: "onConfirm",
|
|
142
|
+
valuePropName: "dates",
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
];
|
|
@@ -0,0 +1,168 @@
|
|
|
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
|
+
} from "@draftbit/types";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Maps react-native-paper-dates DatePickerModal in modes: "single" and "multiple"
|
|
17
|
+
* Cannot map mode "range" because it relies on 2 fieldNames (startDate and endDate)
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const SHARED_SEED_DATA = {
|
|
21
|
+
tag: "DatePickerModal",
|
|
22
|
+
packageName: "react-native-paper-dates",
|
|
23
|
+
triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
|
|
24
|
+
category: COMPONENT_TYPES.input,
|
|
25
|
+
StylesPanelSections: [
|
|
26
|
+
StylesPanelSections.Typography,
|
|
27
|
+
StylesPanelSections.Background,
|
|
28
|
+
StylesPanelSections.Size,
|
|
29
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
30
|
+
StylesPanelSections.Position,
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const SHARED_SEED_DATA_PROPS = {
|
|
35
|
+
onDismiss: createActionProp({
|
|
36
|
+
label: "On Dismiss",
|
|
37
|
+
description: "Called when date picker dimissed",
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
locale: createTextProp({
|
|
41
|
+
label: "Locale",
|
|
42
|
+
description:
|
|
43
|
+
"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",
|
|
44
|
+
defaultValue: "en",
|
|
45
|
+
required: true,
|
|
46
|
+
}),
|
|
47
|
+
visible: createBoolProp({
|
|
48
|
+
label: "Visible",
|
|
49
|
+
description: "Flag indicating if the component should be displayed",
|
|
50
|
+
required: true,
|
|
51
|
+
}),
|
|
52
|
+
label: createTextProp({
|
|
53
|
+
label: "Label",
|
|
54
|
+
description: "The label used as the header in the component",
|
|
55
|
+
defaultValue: "Select date",
|
|
56
|
+
}),
|
|
57
|
+
saveLabel: createTextProp({
|
|
58
|
+
label: "Save Label",
|
|
59
|
+
description: "Label used to confirm a date selection",
|
|
60
|
+
defaultValue: "Save",
|
|
61
|
+
}),
|
|
62
|
+
saveLabelDisabled: createStaticBoolProp({
|
|
63
|
+
label: "Disable Save Label",
|
|
64
|
+
description:
|
|
65
|
+
"Flag indicating if the save label should be disabled and unable to receive events",
|
|
66
|
+
}),
|
|
67
|
+
uppercase: createStaticBoolProp({
|
|
68
|
+
label: "Uppercase",
|
|
69
|
+
description:
|
|
70
|
+
"Flag indicating if the text in the component should be uppercase",
|
|
71
|
+
defaultValue: true,
|
|
72
|
+
}),
|
|
73
|
+
startYear: createStaticNumberProp({
|
|
74
|
+
label: "Start Year",
|
|
75
|
+
description: "The start year when the component is rendered",
|
|
76
|
+
required: false,
|
|
77
|
+
defaultValue: 1800,
|
|
78
|
+
}),
|
|
79
|
+
endYear: createStaticNumberProp({
|
|
80
|
+
label: "End Year",
|
|
81
|
+
description: "The end year when the component is rendered",
|
|
82
|
+
required: false,
|
|
83
|
+
defaultValue: 2200,
|
|
84
|
+
}),
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const SEED_DATA = [
|
|
88
|
+
{
|
|
89
|
+
...SHARED_SEED_DATA,
|
|
90
|
+
name: "Date Picker Modal",
|
|
91
|
+
description: "Date Picker modal for date selection",
|
|
92
|
+
props: {
|
|
93
|
+
...SHARED_SEED_DATA_PROPS,
|
|
94
|
+
onConfirm: createActionProp({
|
|
95
|
+
label: "On Confirm",
|
|
96
|
+
description: "Called when date selected and confirmed",
|
|
97
|
+
required: true,
|
|
98
|
+
}),
|
|
99
|
+
onChange: createActionProp({
|
|
100
|
+
label: "On Change",
|
|
101
|
+
description: "Called when date selection changes",
|
|
102
|
+
}),
|
|
103
|
+
mode: createTextEnumProp({
|
|
104
|
+
label: "Mode",
|
|
105
|
+
description: "The selection mode of the date picker",
|
|
106
|
+
required: true,
|
|
107
|
+
options: ["single"],
|
|
108
|
+
editable: false,
|
|
109
|
+
defaultValue: "single",
|
|
110
|
+
formType: FORM_TYPES.flatArray,
|
|
111
|
+
}),
|
|
112
|
+
fieldName: createFieldNameProp({
|
|
113
|
+
defaultValue: "date",
|
|
114
|
+
handlerPropName: "onConfirm",
|
|
115
|
+
valuePropName: "date",
|
|
116
|
+
}),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
...SHARED_SEED_DATA,
|
|
121
|
+
name: "Multiple Date Picker Modal",
|
|
122
|
+
description: "Date Picker modal for multiple date selection",
|
|
123
|
+
props: {
|
|
124
|
+
...SHARED_SEED_DATA_PROPS,
|
|
125
|
+
onConfirm: createActionProp({
|
|
126
|
+
label: "On Confirm",
|
|
127
|
+
description: "Called when dates selected and confirmed",
|
|
128
|
+
required: true,
|
|
129
|
+
}),
|
|
130
|
+
onChange: createActionProp({
|
|
131
|
+
label: "On Change",
|
|
132
|
+
description: "Called when dates selection changes",
|
|
133
|
+
}),
|
|
134
|
+
mode: createTextEnumProp({
|
|
135
|
+
label: "Mode",
|
|
136
|
+
description: "The selection mode of the date picker",
|
|
137
|
+
required: true,
|
|
138
|
+
options: ["multiple"],
|
|
139
|
+
editable: false,
|
|
140
|
+
defaultValue: "multiple",
|
|
141
|
+
formType: FORM_TYPES.flatArray,
|
|
142
|
+
}),
|
|
143
|
+
moreLabel: createTextProp({
|
|
144
|
+
label: "More Label",
|
|
145
|
+
description:
|
|
146
|
+
"The label used display when multiple dates have been selected in the component",
|
|
147
|
+
defaultValue: "More",
|
|
148
|
+
}),
|
|
149
|
+
startLabel: createTextProp({
|
|
150
|
+
label: "Start Label",
|
|
151
|
+
description:
|
|
152
|
+
"The label used as the prefix to the starting date in the component",
|
|
153
|
+
defaultValue: "Start",
|
|
154
|
+
}),
|
|
155
|
+
endLabel: createTextProp({
|
|
156
|
+
label: "End Label",
|
|
157
|
+
description:
|
|
158
|
+
"The label used as the suffix to the ending date in the component",
|
|
159
|
+
defaultValue: "End",
|
|
160
|
+
}),
|
|
161
|
+
fieldName: createFieldNameProp({
|
|
162
|
+
defaultValue: "dates",
|
|
163
|
+
handlerPropName: "onConfirm",
|
|
164
|
+
valuePropName: "dates",
|
|
165
|
+
}),
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
];
|
|
@@ -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;
|
|
@@ -1,35 +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 _theming = require("../../theming");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const DeckSwiperCard = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
style,
|
|
14
|
-
children,
|
|
15
|
-
theme
|
|
16
|
-
} = _ref;
|
|
17
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
18
|
-
style: [styles.card, {
|
|
19
|
-
backgroundColor: theme.colors.background,
|
|
20
|
-
borderRadius: theme.borderRadius.global,
|
|
21
|
-
borderColor: theme.colors.divider
|
|
22
|
-
}, style]
|
|
23
|
-
}, children);
|
|
24
|
-
};
|
|
25
|
-
const styles = _reactNative.StyleSheet.create({
|
|
26
|
-
card: {
|
|
27
|
-
flex: 1,
|
|
28
|
-
alignItems: "center",
|
|
29
|
-
justifyContent: "center",
|
|
30
|
-
padding: 20,
|
|
31
|
-
borderWidth: 2
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
var _default = (0, _theming.withTheme)(DeckSwiperCard);
|
|
35
|
-
exports.default = _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "DeckSwiper", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _DeckSwiper.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "DeckSwiperCard", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _DeckSwiperCard.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _DeckSwiper = _interopRequireDefault(require("./DeckSwiper"));
|
|
19
|
-
var _DeckSwiperCard = _interopRequireDefault(require("./DeckSwiperCard"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA = {
|
|
9
|
-
name: "Deck Swiper",
|
|
10
|
-
tag: "DeckSwiper",
|
|
11
|
-
description: "Deck swiper container",
|
|
12
|
-
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
|
|
14
|
-
triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
|
|
15
|
-
props: {
|
|
16
|
-
onIndexChanged: (0, _types.createActionProp)({
|
|
17
|
-
label: "On index changed",
|
|
18
|
-
description: "Action to execute when swipe to new index"
|
|
19
|
-
}),
|
|
20
|
-
onEndReached: (0, _types.createActionProp)({
|
|
21
|
-
label: "On end reached",
|
|
22
|
-
description: "Action to execute when end of swiping reached"
|
|
23
|
-
}),
|
|
24
|
-
startCardIndex: (0, _types.createStaticNumberProp)({
|
|
25
|
-
label: "Start card index",
|
|
26
|
-
description: "Index of card to start swiping from",
|
|
27
|
-
defaultValue: 0
|
|
28
|
-
}),
|
|
29
|
-
infiniteSwiping: (0, _types.createStaticBoolProp)({
|
|
30
|
-
label: "Infinite swiping",
|
|
31
|
-
description: "Whether to infinitley loop through cards or not"
|
|
32
|
-
}),
|
|
33
|
-
verticalEnabled: (0, _types.createStaticBoolProp)({
|
|
34
|
-
label: "Vertical swipe enabled",
|
|
35
|
-
description: "Whether cards should be swipeable vertically or not",
|
|
36
|
-
defaultValue: true
|
|
37
|
-
}),
|
|
38
|
-
horizontalEnabled: (0, _types.createStaticBoolProp)({
|
|
39
|
-
label: "Horizontal swipe enabled",
|
|
40
|
-
description: "Whether cards should be swipeable horizontally or not",
|
|
41
|
-
defaultValue: true
|
|
42
|
-
}),
|
|
43
|
-
visibleCardCount: (0, _types.createStaticNumberProp)({
|
|
44
|
-
label: "Visible card count",
|
|
45
|
-
description: "Number of cards visible behind (and including) the current card",
|
|
46
|
-
defaultValue: 1,
|
|
47
|
-
min: 1,
|
|
48
|
-
step: 1
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA = {
|
|
9
|
-
name: "Deck Swiper Card",
|
|
10
|
-
tag: "DeckSwiperCard",
|
|
11
|
-
description: "Single Deck Swiper Card item to be used in DeckSwiper",
|
|
12
|
-
category: _types.COMPONENT_TYPES.swiper,
|
|
13
|
-
stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
14
|
-
props: {}
|
|
15
|
-
};
|
|
16
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
-
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
|
-
const DeckSwiper = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
onIndexChanged,
|
|
7
|
-
onEndReached,
|
|
8
|
-
startCardIndex = 0,
|
|
9
|
-
infiniteSwiping = false,
|
|
10
|
-
verticalEnabled = true,
|
|
11
|
-
horizontalEnabled = true,
|
|
12
|
-
visibleCardCount = 1,
|
|
13
|
-
style,
|
|
14
|
-
children
|
|
15
|
-
} = _ref;
|
|
16
|
-
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
17
|
-
|
|
18
|
-
// an array of indices based on children count
|
|
19
|
-
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* By default react-native-deck-swiper positions everything with absolute position
|
|
23
|
-
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure
|
|
24
|
-
*
|
|
25
|
-
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird
|
|
26
|
-
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space
|
|
27
|
-
* This effectivley makes the default height of the container be the height of the first card
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
31
|
-
style: styles.containerHeightFiller
|
|
32
|
-
}, childrenArray.length && childrenArray[0]), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
|
|
33
|
-
cards: cardsFillerData,
|
|
34
|
-
renderCard: (_, i) => /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[i]),
|
|
35
|
-
keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
|
|
36
|
-
containerStyle: StyleSheet.flatten([styles.cardsContainer, style]),
|
|
37
|
-
cardStyle: styles.card,
|
|
38
|
-
onSwiped: onIndexChanged,
|
|
39
|
-
onSwipedAll: onEndReached,
|
|
40
|
-
cardIndex: startCardIndex,
|
|
41
|
-
infinite: infiniteSwiping,
|
|
42
|
-
verticalSwipe: verticalEnabled,
|
|
43
|
-
horizontalSwipe: horizontalEnabled,
|
|
44
|
-
showSecondCard: visibleCardCount > 1,
|
|
45
|
-
stackSize: visibleCardCount,
|
|
46
|
-
backgroundColor: "transparent",
|
|
47
|
-
cardVerticalMargin: 0,
|
|
48
|
-
cardHorizontalMargin: 0
|
|
49
|
-
}));
|
|
50
|
-
};
|
|
51
|
-
const styles = StyleSheet.create({
|
|
52
|
-
cardsContainer: {
|
|
53
|
-
width: "100%"
|
|
54
|
-
},
|
|
55
|
-
card: {
|
|
56
|
-
left: 0,
|
|
57
|
-
right: 0,
|
|
58
|
-
width: "auto",
|
|
59
|
-
height: "auto"
|
|
60
|
-
},
|
|
61
|
-
containerHeightFiller: {
|
|
62
|
-
opacity: 0.0
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
export default DeckSwiper;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { withTheme } from "../../theming";
|
|
4
|
-
const DeckSwiperCard = _ref => {
|
|
5
|
-
let {
|
|
6
|
-
style,
|
|
7
|
-
children,
|
|
8
|
-
theme
|
|
9
|
-
} = _ref;
|
|
10
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
11
|
-
style: [styles.card, {
|
|
12
|
-
backgroundColor: theme.colors.background,
|
|
13
|
-
borderRadius: theme.borderRadius.global,
|
|
14
|
-
borderColor: theme.colors.divider
|
|
15
|
-
}, style]
|
|
16
|
-
}, children);
|
|
17
|
-
};
|
|
18
|
-
const styles = StyleSheet.create({
|
|
19
|
-
card: {
|
|
20
|
-
flex: 1,
|
|
21
|
-
alignItems: "center",
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
padding: 20,
|
|
24
|
-
borderWidth: 2
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
export default withTheme(DeckSwiperCard);
|