@draftbit/core 46.7.9-f9c613.2 → 46.8.0
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/DatePicker/DatePicker.js +14 -1
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +74 -0
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +34 -0
- package/lib/commonjs/components/DeckSwiper/index.js +20 -0
- package/lib/commonjs/components/Divider.js +1 -14
- package/lib/commonjs/components/Elevation.js +2 -14
- package/lib/commonjs/components/Picker/Picker.js +10 -3
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/mappings/DatePicker.js +8 -2
- package/lib/commonjs/mappings/DeckSwiper.js +55 -0
- package/lib/commonjs/mappings/DeckSwiperCard.js +23 -0
- package/lib/commonjs/mappings/Picker.js +5 -0
- package/lib/module/components/DatePicker/DatePicker.js +15 -2
- package/lib/module/components/DeckSwiper/DeckSwiper.js +66 -0
- package/lib/module/components/DeckSwiper/DeckSwiperCard.js +26 -0
- package/lib/module/components/DeckSwiper/index.js +2 -0
- package/lib/module/components/Picker/Picker.js +11 -4
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/DatePicker.js +9 -3
- package/lib/module/mappings/DeckSwiper.js +48 -0
- package/lib/module/mappings/DeckSwiperCard.js +16 -0
- package/lib/module/mappings/Picker.js +6 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +1 -0
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +15 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +13 -0
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -0
- package/lib/typescript/src/components/DeckSwiper/index.d.ts +3 -0
- package/lib/typescript/src/components/DeckSwiper/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts +1 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +10 -0
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +86 -0
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -0
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +16 -0
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Picker.d.ts +10 -0
- package/lib/typescript/src/mappings/Picker.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/DatePicker/DatePicker.js +8 -3
- package/src/components/DatePicker/DatePicker.tsx +10 -1
- package/src/components/DeckSwiper/DeckSwiper.js +35 -0
- package/src/components/DeckSwiper/DeckSwiper.tsx +94 -0
- package/src/components/DeckSwiper/DeckSwiperCard.js +21 -0
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +41 -0
- package/src/components/DeckSwiper/index.js +2 -0
- package/src/components/DeckSwiper/index.tsx +2 -0
- package/src/components/Picker/Picker.js +9 -3
- package/src/components/Picker/Picker.tsx +14 -2
- package/src/index.js +1 -0
- package/src/index.tsx +2 -0
- package/src/mappings/DatePicker.js +8 -2
- package/src/mappings/DatePicker.ts +8 -1
- package/src/mappings/DeckSwiper.js +48 -0
- package/src/mappings/DeckSwiper.ts +57 -0
- package/src/mappings/DeckSwiperCard.js +16 -0
- package/src/mappings/DeckSwiperCard.ts +20 -0
- package/src/mappings/Picker.js +6 -1
- package/src/mappings/Picker.ts +6 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, Triggers, createActionProp, createStaticNumberProp, createStaticBoolProp, BLOCK_STYLES_SECTIONS } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Deck Swiper",
|
|
4
|
+
tag: "DeckSwiper",
|
|
5
|
+
description: "Deck swiper container",
|
|
6
|
+
category: COMPONENT_TYPES.swiper,
|
|
7
|
+
stylesPanelSections: BLOCK_STYLES_SECTIONS,
|
|
8
|
+
layout: {
|
|
9
|
+
width: "100%"
|
|
10
|
+
},
|
|
11
|
+
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
12
|
+
props: {
|
|
13
|
+
onIndexChanged: createActionProp({
|
|
14
|
+
label: "On index changed",
|
|
15
|
+
description: "Action to execute when swipe to new index"
|
|
16
|
+
}),
|
|
17
|
+
onEndReached: createActionProp({
|
|
18
|
+
label: "On end reached",
|
|
19
|
+
description: "Action to execute when end of swiping reached"
|
|
20
|
+
}),
|
|
21
|
+
startCardIndex: createStaticNumberProp({
|
|
22
|
+
label: "Start card index",
|
|
23
|
+
description: "Index of card to start swiping from",
|
|
24
|
+
defaultValue: 0
|
|
25
|
+
}),
|
|
26
|
+
infiniteSwiping: createStaticBoolProp({
|
|
27
|
+
label: "Infinite swiping",
|
|
28
|
+
description: "Whether to infinitley loop through cards or not"
|
|
29
|
+
}),
|
|
30
|
+
verticalEnabled: createStaticBoolProp({
|
|
31
|
+
label: "Vertical swipe enabled",
|
|
32
|
+
description: "Whether cards should be swipeable vertically or not",
|
|
33
|
+
defaultValue: true
|
|
34
|
+
}),
|
|
35
|
+
horizontalEnabled: createStaticBoolProp({
|
|
36
|
+
label: "Horizontal swipe enabled",
|
|
37
|
+
description: "Whether cards should be swipeable horizontally or not",
|
|
38
|
+
defaultValue: true
|
|
39
|
+
}),
|
|
40
|
+
visibleCardCount: createStaticNumberProp({
|
|
41
|
+
label: "Visible card count",
|
|
42
|
+
description: "Number of cards visible behind (and including) the current card",
|
|
43
|
+
defaultValue: 1,
|
|
44
|
+
min: 1,
|
|
45
|
+
step: 1
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, CONTAINER_COMPONENT_STYLES_SECTIONS } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Deck Swiper Card",
|
|
4
|
+
tag: "DeckSwiperCard",
|
|
5
|
+
description: "Single Deck Swiper Card item to be used in DeckSwiper",
|
|
6
|
+
category: COMPONENT_TYPES.swiper,
|
|
7
|
+
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
8
|
+
layout: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
padding: 20,
|
|
13
|
+
borderWidth: 2
|
|
14
|
+
},
|
|
15
|
+
props: {}
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections, createStaticBoolProp } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
group: GROUPS.data,
|
|
@@ -136,6 +136,11 @@ export const SEED_DATA = [{
|
|
|
136
136
|
}),
|
|
137
137
|
iconColor: createColorProp({
|
|
138
138
|
label: "Icon Color"
|
|
139
|
+
}),
|
|
140
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
141
|
+
label: "Auto dismiss keyboard",
|
|
142
|
+
description: "Automatically dismiss keyboard when Picker is opened",
|
|
143
|
+
defaultValue: true
|
|
139
144
|
})
|
|
140
145
|
},
|
|
141
146
|
layout: {}
|
|
@@ -23,6 +23,7 @@ declare type Props = {
|
|
|
23
23
|
rightIconName?: string;
|
|
24
24
|
borderColor?: string;
|
|
25
25
|
borderColorActive?: string;
|
|
26
|
+
autoDismissKeyboard?: boolean;
|
|
26
27
|
} & IconSlot & TextInputProps;
|
|
27
28
|
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
|
|
28
29
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,EAMf,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAStD,aAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,KAAK,EAAE,KAAK,CAAC;IAMb,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,QAAQ,GACV,cAAc,CAAC;;;;AAsgBjB,wBAAqC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface DeckSwiperProps {
|
|
4
|
+
onIndexChanged?: (index: number) => void;
|
|
5
|
+
onEndReached?: () => void;
|
|
6
|
+
startCardIndex?: number;
|
|
7
|
+
infiniteSwiping?: boolean;
|
|
8
|
+
verticalEnabled?: boolean;
|
|
9
|
+
horizontalEnabled?: boolean;
|
|
10
|
+
visibleCardCount?: number;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
declare const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>>;
|
|
14
|
+
export default DeckSwiper;
|
|
15
|
+
//# sourceMappingURL=DeckSwiper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA6DlE,CAAC;AAiBF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import type { Theme } from "../../styles/DefaultTheme";
|
|
4
|
+
export interface DeckSwiperCardProps {
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
theme: Theme;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<DeckSwiperCardProps, "theme"> & {
|
|
10
|
+
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
11
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<DeckSwiperCardProps> & React.FC<DeckSwiperCardProps>, {}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=DeckSwiperCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA+BD,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AA2aF,wBAAiC"}
|
|
@@ -31,6 +31,7 @@ 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";
|
|
34
35
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
35
36
|
export { default as Picker } from "./components/Picker/Picker";
|
|
36
37
|
export { default as ProgressBar } from "./components/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,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -18,6 +18,16 @@ export declare const SEED_DATA: {
|
|
|
18
18
|
required: boolean;
|
|
19
19
|
group: string;
|
|
20
20
|
};
|
|
21
|
+
autoDismissKeyboard: {
|
|
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
|
+
};
|
|
21
31
|
mode: {
|
|
22
32
|
label: string;
|
|
23
33
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePicker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePicker.ts"],"names":[],"mappings":"AAiKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCrB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
layout: {
|
|
8
|
+
width: string;
|
|
9
|
+
};
|
|
10
|
+
triggers: string[];
|
|
11
|
+
props: {
|
|
12
|
+
onIndexChanged: {
|
|
13
|
+
label: string;
|
|
14
|
+
description: string;
|
|
15
|
+
editable: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
formType: string;
|
|
18
|
+
propType: string;
|
|
19
|
+
defaultValue: null;
|
|
20
|
+
group: string;
|
|
21
|
+
};
|
|
22
|
+
onEndReached: {
|
|
23
|
+
label: string;
|
|
24
|
+
description: string;
|
|
25
|
+
editable: boolean;
|
|
26
|
+
required: boolean;
|
|
27
|
+
formType: string;
|
|
28
|
+
propType: string;
|
|
29
|
+
defaultValue: null;
|
|
30
|
+
group: string;
|
|
31
|
+
};
|
|
32
|
+
startCardIndex: {
|
|
33
|
+
label: string;
|
|
34
|
+
description: string;
|
|
35
|
+
formType: string;
|
|
36
|
+
propType: string;
|
|
37
|
+
group: string;
|
|
38
|
+
defaultValue: null;
|
|
39
|
+
editable: boolean;
|
|
40
|
+
required: boolean;
|
|
41
|
+
step: number;
|
|
42
|
+
};
|
|
43
|
+
infiniteSwiping: {
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
formType: string;
|
|
47
|
+
propType: string;
|
|
48
|
+
defaultValue: boolean;
|
|
49
|
+
editable: boolean;
|
|
50
|
+
required: boolean;
|
|
51
|
+
group: string;
|
|
52
|
+
};
|
|
53
|
+
verticalEnabled: {
|
|
54
|
+
label: string;
|
|
55
|
+
description: string;
|
|
56
|
+
formType: string;
|
|
57
|
+
propType: string;
|
|
58
|
+
defaultValue: boolean;
|
|
59
|
+
editable: boolean;
|
|
60
|
+
required: boolean;
|
|
61
|
+
group: string;
|
|
62
|
+
};
|
|
63
|
+
horizontalEnabled: {
|
|
64
|
+
label: string;
|
|
65
|
+
description: string;
|
|
66
|
+
formType: string;
|
|
67
|
+
propType: string;
|
|
68
|
+
defaultValue: boolean;
|
|
69
|
+
editable: boolean;
|
|
70
|
+
required: boolean;
|
|
71
|
+
group: string;
|
|
72
|
+
};
|
|
73
|
+
visibleCardCount: {
|
|
74
|
+
label: string;
|
|
75
|
+
description: string;
|
|
76
|
+
formType: string;
|
|
77
|
+
propType: string;
|
|
78
|
+
group: string;
|
|
79
|
+
defaultValue: null;
|
|
80
|
+
editable: boolean;
|
|
81
|
+
required: boolean;
|
|
82
|
+
step: number;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=DeckSwiper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DeckSwiper.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CrB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
description: string;
|
|
5
|
+
category: string;
|
|
6
|
+
stylesPanelSections: string[];
|
|
7
|
+
layout: {
|
|
8
|
+
flex: number;
|
|
9
|
+
alignItems: string;
|
|
10
|
+
justifyContent: string;
|
|
11
|
+
padding: number;
|
|
12
|
+
borderWidth: number;
|
|
13
|
+
};
|
|
14
|
+
props: {};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=DeckSwiperCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DeckSwiperCard.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;CAcrB,CAAC"}
|
|
@@ -40,6 +40,16 @@ export declare const SEED_DATA: {
|
|
|
40
40
|
formType: string;
|
|
41
41
|
propType: string;
|
|
42
42
|
};
|
|
43
|
+
autoDismissKeyboard: {
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
formType: string;
|
|
47
|
+
propType: string;
|
|
48
|
+
defaultValue: boolean;
|
|
49
|
+
editable: boolean;
|
|
50
|
+
required: boolean;
|
|
51
|
+
group: string;
|
|
52
|
+
};
|
|
43
53
|
label: {
|
|
44
54
|
group: string;
|
|
45
55
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Picker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Picker.ts"],"names":[],"mappings":"AA+HA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.8.0",
|
|
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.
|
|
44
|
+
"@draftbit/types": "^46.8.0",
|
|
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,6 +53,7 @@
|
|
|
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",
|
|
56
57
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
58
|
"react-native-svg": "12.3.0",
|
|
58
59
|
"react-native-typography": "^1.4.1",
|
|
@@ -91,5 +92,5 @@
|
|
|
91
92
|
]
|
|
92
93
|
]
|
|
93
94
|
},
|
|
94
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "c39b951332cf49ab0c1a244b1939f60f241f3ffa"
|
|
95
96
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, } from "react-native";
|
|
2
|
+
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, Keyboard, } from "react-native";
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import dateFormat from "dateformat";
|
|
5
5
|
import { withTheme } from "../../theming";
|
|
@@ -25,7 +25,7 @@ const MONTHS = [
|
|
|
25
25
|
"November",
|
|
26
26
|
"December",
|
|
27
27
|
];
|
|
28
|
-
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
|
|
28
|
+
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, autoDismissKeyboard = true, ...props }) => {
|
|
29
29
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
30
30
|
React.useEffect(() => {
|
|
31
31
|
if (defaultValue != null) {
|
|
@@ -113,6 +113,11 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
113
113
|
clearTimeout(_showPlaceholder());
|
|
114
114
|
};
|
|
115
115
|
}, [focused, label, placeholder]);
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
118
|
+
Keyboard.dismiss();
|
|
119
|
+
}
|
|
120
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
116
121
|
const _handleFocus = () => {
|
|
117
122
|
if (disabled) {
|
|
118
123
|
return;
|
|
@@ -132,7 +137,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
132
137
|
? labelSize
|
|
133
138
|
: typography.caption.fontSize;
|
|
134
139
|
const hasActiveOutline = focused;
|
|
135
|
-
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
140
|
+
let inputTextColor, activeColor, underlineColor, borderColor = inputBorderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
136
141
|
inputTextColor = colors.strong;
|
|
137
142
|
if (disabled) {
|
|
138
143
|
activeColor = colors.light;
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
I18nManager,
|
|
13
13
|
LayoutChangeEvent,
|
|
14
14
|
TextInput as NativeTextInput,
|
|
15
|
+
Keyboard,
|
|
15
16
|
} from "react-native";
|
|
16
17
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
17
18
|
|
|
@@ -55,6 +56,7 @@ type Props = {
|
|
|
55
56
|
rightIconName?: string;
|
|
56
57
|
borderColor?: string;
|
|
57
58
|
borderColorActive?: string;
|
|
59
|
+
autoDismissKeyboard?: boolean;
|
|
58
60
|
} & IconSlot &
|
|
59
61
|
TextInputProps;
|
|
60
62
|
|
|
@@ -93,6 +95,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
93
95
|
placeholder,
|
|
94
96
|
borderColor: inputBorderColor,
|
|
95
97
|
borderColorActive: inputBorderColorActive,
|
|
98
|
+
autoDismissKeyboard = true,
|
|
96
99
|
...props
|
|
97
100
|
}) => {
|
|
98
101
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -204,6 +207,12 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
204
207
|
};
|
|
205
208
|
}, [focused, label, placeholder]);
|
|
206
209
|
|
|
210
|
+
React.useEffect(() => {
|
|
211
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
212
|
+
Keyboard.dismiss();
|
|
213
|
+
}
|
|
214
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
215
|
+
|
|
207
216
|
const _handleFocus = () => {
|
|
208
217
|
if (disabled) {
|
|
209
218
|
return;
|
|
@@ -232,7 +241,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
232
241
|
let inputTextColor,
|
|
233
242
|
activeColor,
|
|
234
243
|
underlineColor,
|
|
235
|
-
borderColor,
|
|
244
|
+
borderColor = inputBorderColor,
|
|
236
245
|
placeholderColor,
|
|
237
246
|
containerStyle: StyleProp<ViewStyle>,
|
|
238
247
|
backgroundColor,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
|
+
const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, style, children, }) => {
|
|
5
|
+
const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
|
|
6
|
+
// an array of indices based on children count
|
|
7
|
+
const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
|
|
8
|
+
/**
|
|
9
|
+
* By default react-native-deck-swiper positions everything with absolute position.
|
|
10
|
+
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
14
|
+
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
15
|
+
* This effectivley makes the default height of the container be the height of the first card.
|
|
16
|
+
*/
|
|
17
|
+
return (React.createElement(View, null,
|
|
18
|
+
React.createElement(View, { style: styles.containerHeightFiller }, childrenArray.length && childrenArray[0]),
|
|
19
|
+
React.createElement(DeckSwiperComponent, { cards: cardsFillerData, renderCard: (_, i) => React.createElement(React.Fragment, null, childrenArray[i]), keyExtractor: (card) => card === null || card === void 0 ? void 0 : card.toString(), containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
|
|
20
|
+
};
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
cardsContainer: {
|
|
23
|
+
width: "100%",
|
|
24
|
+
},
|
|
25
|
+
card: {
|
|
26
|
+
left: 0,
|
|
27
|
+
right: 0,
|
|
28
|
+
width: "auto",
|
|
29
|
+
height: "auto",
|
|
30
|
+
},
|
|
31
|
+
containerHeightFiller: {
|
|
32
|
+
opacity: 0.0,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export default DeckSwiper;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
|
|
3
|
+
import DeckSwiperComponent from "react-native-deck-swiper";
|
|
4
|
+
|
|
5
|
+
export interface DeckSwiperProps {
|
|
6
|
+
onIndexChanged?: (index: number) => void;
|
|
7
|
+
onEndReached?: () => void;
|
|
8
|
+
startCardIndex?: number;
|
|
9
|
+
infiniteSwiping?: boolean;
|
|
10
|
+
verticalEnabled?: boolean;
|
|
11
|
+
horizontalEnabled?: boolean;
|
|
12
|
+
visibleCardCount?: number;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
|
|
17
|
+
onIndexChanged,
|
|
18
|
+
onEndReached,
|
|
19
|
+
startCardIndex = 0,
|
|
20
|
+
infiniteSwiping = false,
|
|
21
|
+
verticalEnabled = true,
|
|
22
|
+
horizontalEnabled = true,
|
|
23
|
+
visibleCardCount = 1,
|
|
24
|
+
style,
|
|
25
|
+
children,
|
|
26
|
+
}) => {
|
|
27
|
+
const childrenArray = React.useMemo(
|
|
28
|
+
() => React.Children.toArray(children),
|
|
29
|
+
[children]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// an array of indices based on children count
|
|
33
|
+
const cardsFillerData = React.useMemo(
|
|
34
|
+
() => Array.from(Array(childrenArray.length).keys()),
|
|
35
|
+
[childrenArray]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* By default react-native-deck-swiper positions everything with absolute position.
|
|
40
|
+
* To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
|
|
41
|
+
*
|
|
42
|
+
*
|
|
43
|
+
* Since all children of that View are absolutley positioned, the View does not have a height and still looks and behaves weird.
|
|
44
|
+
* To fix/mitage this without setting a static height, the first card is rendered in invisible state to take up space.
|
|
45
|
+
* This effectivley makes the default height of the container be the height of the first card.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<View>
|
|
50
|
+
<View style={styles.containerHeightFiller}>
|
|
51
|
+
{childrenArray.length && childrenArray[0]}
|
|
52
|
+
</View>
|
|
53
|
+
<DeckSwiperComponent
|
|
54
|
+
cards={cardsFillerData}
|
|
55
|
+
renderCard={(_, i) => <>{childrenArray[i]}</>}
|
|
56
|
+
keyExtractor={(card) => card?.toString()}
|
|
57
|
+
containerStyle={
|
|
58
|
+
StyleSheet.flatten([styles.cardsContainer, style]) as
|
|
59
|
+
| object
|
|
60
|
+
| undefined
|
|
61
|
+
}
|
|
62
|
+
cardStyle={styles.card as object | undefined}
|
|
63
|
+
onSwiped={onIndexChanged}
|
|
64
|
+
onSwipedAll={onEndReached}
|
|
65
|
+
cardIndex={startCardIndex}
|
|
66
|
+
infinite={infiniteSwiping}
|
|
67
|
+
verticalSwipe={verticalEnabled}
|
|
68
|
+
horizontalSwipe={horizontalEnabled}
|
|
69
|
+
showSecondCard={visibleCardCount > 1}
|
|
70
|
+
stackSize={visibleCardCount}
|
|
71
|
+
backgroundColor="transparent"
|
|
72
|
+
cardVerticalMargin={0}
|
|
73
|
+
cardHorizontalMargin={0}
|
|
74
|
+
/>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
cardsContainer: {
|
|
81
|
+
width: "100%",
|
|
82
|
+
},
|
|
83
|
+
card: {
|
|
84
|
+
left: 0,
|
|
85
|
+
right: 0,
|
|
86
|
+
width: "auto",
|
|
87
|
+
height: "auto",
|
|
88
|
+
},
|
|
89
|
+
containerHeightFiller: {
|
|
90
|
+
opacity: 0.0,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export default DeckSwiper;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { withTheme } from "../../theming";
|
|
4
|
+
const DeckSwiperCard = ({ style, children, theme, }) => (React.createElement(View, { style: [
|
|
5
|
+
styles.card,
|
|
6
|
+
{
|
|
7
|
+
backgroundColor: theme.colors.background,
|
|
8
|
+
borderColor: theme.colors.divider,
|
|
9
|
+
},
|
|
10
|
+
style,
|
|
11
|
+
] }, children));
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
card: {
|
|
14
|
+
flex: 1,
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
padding: 20,
|
|
18
|
+
borderWidth: 2,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
export default withTheme(DeckSwiperCard);
|