@draftbit/core 46.11.1-1cafec.2 → 46.11.1-3f956d.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/DeckSwiper/DeckSwiper.js +18 -3
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +13 -4
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Shadow.js +10 -2
- package/lib/commonjs/components/Shadow.js.map +1 -1
- package/lib/commonjs/components/Surface.js +1 -1
- package/lib/commonjs/components/Surface.js.map +1 -1
- package/lib/commonjs/components/TabView/TabView.js +1 -1
- package/lib/commonjs/components/TabView/TabView.js.map +1 -1
- package/lib/commonjs/components/Touchable.web.js.map +1 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/Banner.js.map +1 -1
- package/lib/commonjs/mappings/DeckSwiper.js +2 -2
- package/lib/commonjs/mappings/DeckSwiper.js.map +1 -1
- package/lib/commonjs/mappings/NativeBase/Layout.js +1 -1
- package/lib/commonjs/mappings/NativeBase/Layout.js.map +1 -1
- package/lib/commonjs/mappings/ProgressCircle.js.map +1 -1
- package/lib/commonjs/mappings/Shadow.js +2 -2
- package/lib/commonjs/mappings/Shadow.js.map +1 -1
- package/lib/commonjs/mappings/Table.js +3 -3
- package/lib/commonjs/mappings/Table.js.map +1 -1
- package/lib/commonjs/mappings/TextField.js.map +1 -1
- package/lib/module/components/Accordion/AccordionItem.js +23 -4
- package/lib/module/components/DeckSwiper/DeckSwiper.js +18 -3
- package/lib/module/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +13 -4
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Shadow.js +10 -2
- package/lib/module/components/Shadow.js.map +1 -1
- package/lib/module/components/Surface.js +1 -1
- package/lib/module/components/Surface.js.map +1 -1
- package/lib/module/components/TabView/TabView.js +1 -1
- package/lib/module/components/TabView/TabView.js.map +1 -1
- package/lib/module/mappings/DeckSwiper.js +3 -3
- package/lib/module/mappings/DeckSwiper.js.map +1 -1
- package/lib/module/mappings/NativeBase/Layout.js +1 -1
- package/lib/module/mappings/NativeBase/Layout.js.map +1 -1
- package/lib/module/mappings/Shadow.js +3 -3
- package/lib/module/mappings/Shadow.js.map +1 -1
- package/lib/module/mappings/Table.js +3 -3
- package/lib/module/mappings/Table.js.map +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Shadow.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +1 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/DeckSwiper/DeckSwiper.js +15 -3
- package/src/components/DeckSwiper/DeckSwiper.tsx +23 -3
- package/src/components/Picker/Picker.js +16 -4
- package/src/components/Picker/Picker.tsx +25 -5
- package/src/components/Shadow.js +7 -2
- package/src/components/Shadow.tsx +10 -3
- package/src/components/Surface.js +1 -1
- package/src/components/Surface.tsx +1 -1
- package/src/components/TabView/TabView.js +1 -1
- package/src/components/TabView/TabView.tsx +1 -1
- package/src/mappings/DeckSwiper.js +7 -3
- package/src/mappings/DeckSwiper.ts +7 -3
- package/src/mappings/NativeBase/Layout.js +1 -1
- package/src/mappings/NativeBase/Layout.ts +1 -1
- package/src/mappings/Shadow.js +10 -3
- package/src/mappings/Shadow.ts +10 -3
- package/src/mappings/Table.js +3 -3
- package/src/mappings/Table.ts +3 -3
|
@@ -101,7 +101,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
101
101
|
defaultValue,
|
|
102
102
|
Icon,
|
|
103
103
|
style,
|
|
104
|
-
placeholder
|
|
104
|
+
placeholder,
|
|
105
105
|
value,
|
|
106
106
|
disabled = false,
|
|
107
107
|
assistiveText,
|
|
@@ -130,6 +130,8 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
130
130
|
React.useEffect(() => {
|
|
131
131
|
if (value != null && value !== "") {
|
|
132
132
|
setInternalValue(value);
|
|
133
|
+
} else if (value === "") {
|
|
134
|
+
setInternalValue(undefined);
|
|
133
135
|
}
|
|
134
136
|
}, [value]);
|
|
135
137
|
|
|
@@ -151,13 +153,31 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
151
153
|
}
|
|
152
154
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
153
155
|
|
|
154
|
-
const normalizedOptions =
|
|
156
|
+
const normalizedOptions = React.useMemo(
|
|
157
|
+
() => normalizeOptions(options),
|
|
158
|
+
[options]
|
|
159
|
+
);
|
|
155
160
|
|
|
156
161
|
//Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
157
162
|
//Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
158
|
-
const pickerOptions =
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
const pickerOptions = React.useMemo(
|
|
164
|
+
() =>
|
|
165
|
+
placeholder
|
|
166
|
+
? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
|
|
167
|
+
: normalizedOptions,
|
|
168
|
+
[placeholder, normalizedOptions]
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
//When no placeholder is provided then first item should be marked selected to reflect underlying Picker internal state
|
|
172
|
+
if (
|
|
173
|
+
!placeholder &&
|
|
174
|
+
pickerOptions.length &&
|
|
175
|
+
!internalValue &&
|
|
176
|
+
internalValue !== pickerOptions[0].value //Prevent infinite state changes incase first value is falsy
|
|
177
|
+
) {
|
|
178
|
+
onValueChange?.(pickerOptions[0].value, 0);
|
|
179
|
+
setInternalValue(pickerOptions[0].value);
|
|
180
|
+
}
|
|
161
181
|
|
|
162
182
|
const { viewStyles, textStyles } = extractStyles(style);
|
|
163
183
|
|
package/src/components/Shadow.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
2
3
|
import { Shadow as ShadowComponent } from "react-native-shadow-2";
|
|
3
|
-
|
|
4
|
+
import { extractBorderAndMarginStyles } from "../utilities";
|
|
5
|
+
const Shadow = ({ offsetX = 0, offsetY = 0, showShadowSideStart = true, showShadowSideEnd = true, showShadowSideTop = true, showShadowSideBottom = true, showShadowCornerTopStart = true, showShadowCornerTopEnd = true, showShadowCornerBottomStart = true, showShadowCornerBottomEnd = true, paintInside = true, style, ...rest }) => {
|
|
6
|
+
const { borderStyles } = extractBorderAndMarginStyles(style);
|
|
7
|
+
const containerStyle = StyleSheet.flatten(style);
|
|
8
|
+
Object.keys(borderStyles).forEach((key) => delete containerStyle[key]);
|
|
4
9
|
return (React.createElement(ShadowComponent, { offset: [offsetX, offsetY], sides: {
|
|
5
10
|
start: showShadowSideStart,
|
|
6
11
|
end: showShadowSideEnd,
|
|
@@ -11,6 +16,6 @@ const Shadow = ({ offsetX = 0, offsetY = 0, showShadowSideStart = true, showShad
|
|
|
11
16
|
topEnd: showShadowCornerTopEnd,
|
|
12
17
|
bottomStart: showShadowCornerBottomStart,
|
|
13
18
|
bottomEnd: showShadowCornerBottomEnd,
|
|
14
|
-
}, containerStyle:
|
|
19
|
+
}, style: borderStyles, containerStyle: containerStyle, paintInside: paintInside, ...rest }));
|
|
15
20
|
};
|
|
16
21
|
export default Shadow;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
import { StyleProp, ViewStyle, StyleSheet } from "react-native";
|
|
3
3
|
import { Shadow as ShadowComponent } from "react-native-shadow-2";
|
|
4
|
+
import { extractBorderAndMarginStyles } from "../utilities";
|
|
4
5
|
|
|
5
6
|
interface ShadowProps {
|
|
6
7
|
disabled?: boolean;
|
|
@@ -33,10 +34,15 @@ const Shadow: React.FC<React.PropsWithChildren<ShadowProps>> = ({
|
|
|
33
34
|
showShadowCornerTopEnd = true,
|
|
34
35
|
showShadowCornerBottomStart = true,
|
|
35
36
|
showShadowCornerBottomEnd = true,
|
|
36
|
-
paintInside =
|
|
37
|
+
paintInside = true,
|
|
37
38
|
style,
|
|
38
39
|
...rest
|
|
39
40
|
}) => {
|
|
41
|
+
const { borderStyles } = extractBorderAndMarginStyles(style);
|
|
42
|
+
|
|
43
|
+
const containerStyle = StyleSheet.flatten(style) as StyleProp<any>;
|
|
44
|
+
Object.keys(borderStyles).forEach((key) => delete containerStyle[key]);
|
|
45
|
+
|
|
40
46
|
return (
|
|
41
47
|
<ShadowComponent
|
|
42
48
|
offset={[offsetX, offsetY]}
|
|
@@ -52,7 +58,8 @@ const Shadow: React.FC<React.PropsWithChildren<ShadowProps>> = ({
|
|
|
52
58
|
bottomStart: showShadowCornerBottomStart,
|
|
53
59
|
bottomEnd: showShadowCornerBottomEnd,
|
|
54
60
|
}}
|
|
55
|
-
|
|
61
|
+
style={borderStyles}
|
|
62
|
+
containerStyle={containerStyle}
|
|
56
63
|
paintInside={paintInside}
|
|
57
64
|
{...rest}
|
|
58
65
|
/>
|
|
@@ -7,7 +7,7 @@ import { withTheme } from "../theming";
|
|
|
7
7
|
const Surface = ({ elevation: propElevation, style, theme, children, ...rest }) => {
|
|
8
8
|
const { elevation: styleElevation = 3, backgroundColor, ...restStyle } = (StyleSheet.flatten(style) || {});
|
|
9
9
|
const { dark: isDarkTheme, mode, colors } = theme;
|
|
10
|
-
const elevation = propElevation
|
|
10
|
+
const elevation = propElevation !== null && propElevation !== void 0 ? propElevation : styleElevation;
|
|
11
11
|
const evalationStyles = elevation ? shadow(elevation) : {};
|
|
12
12
|
const getBackgroundColor = () => {
|
|
13
13
|
if (backgroundColor) {
|
|
@@ -34,7 +34,7 @@ const Surface: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
34
34
|
|
|
35
35
|
const { dark: isDarkTheme, mode, colors } = theme;
|
|
36
36
|
|
|
37
|
-
const elevation = propElevation
|
|
37
|
+
const elevation = propElevation ?? styleElevation;
|
|
38
38
|
|
|
39
39
|
const evalationStyles = elevation ? shadow(elevation) : {};
|
|
40
40
|
|
|
@@ -39,7 +39,7 @@ const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition,
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
const renderTabBar = (props) => {
|
|
42
|
-
return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor ||
|
|
42
|
+
return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || "rgb(200,200,200)", pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
|
|
43
43
|
backgroundColor: indicatorColor || theme.colors.primary,
|
|
44
44
|
}, labelStyle: textStyles, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 16 })) : null, style: {
|
|
45
45
|
backgroundColor: tabsBackgroundColor || theme.colors.background,
|
|
@@ -106,7 +106,7 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
|
|
|
106
106
|
<TabBar
|
|
107
107
|
{...props}
|
|
108
108
|
activeColor={activeColor || theme.colors.primary}
|
|
109
|
-
inactiveColor={inactiveColor ||
|
|
109
|
+
inactiveColor={inactiveColor || "rgb(200,200,200)"}
|
|
110
110
|
pressColor={pressColor || theme.colors.primary}
|
|
111
111
|
scrollEnabled={scrollEnabled}
|
|
112
112
|
indicatorStyle={{
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, Triggers, createActionProp, createStaticNumberProp, createStaticBoolProp,
|
|
1
|
+
import { COMPONENT_TYPES, Triggers, createActionProp, createStaticNumberProp, createStaticBoolProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Deck Swiper",
|
|
4
4
|
tag: "DeckSwiper",
|
|
5
5
|
description: "Deck swiper container",
|
|
6
6
|
category: COMPONENT_TYPES.swiper,
|
|
7
|
-
stylesPanelSections:
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.Size,
|
|
9
|
+
StylesPanelSections.Margins,
|
|
10
|
+
StylesPanelSections.Effects,
|
|
11
|
+
],
|
|
8
12
|
layout: {
|
|
9
|
-
|
|
13
|
+
flex: 1,
|
|
10
14
|
},
|
|
11
15
|
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
12
16
|
props: {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
createActionProp,
|
|
5
5
|
createStaticNumberProp,
|
|
6
6
|
createStaticBoolProp,
|
|
7
|
-
|
|
7
|
+
StylesPanelSections,
|
|
8
8
|
} from "@draftbit/types";
|
|
9
9
|
|
|
10
10
|
export const SEED_DATA = {
|
|
@@ -12,9 +12,13 @@ export const SEED_DATA = {
|
|
|
12
12
|
tag: "DeckSwiper",
|
|
13
13
|
description: "Deck swiper container",
|
|
14
14
|
category: COMPONENT_TYPES.swiper,
|
|
15
|
-
stylesPanelSections:
|
|
15
|
+
stylesPanelSections: [
|
|
16
|
+
StylesPanelSections.Size,
|
|
17
|
+
StylesPanelSections.Margins,
|
|
18
|
+
StylesPanelSections.Effects,
|
|
19
|
+
],
|
|
16
20
|
layout: {
|
|
17
|
-
|
|
21
|
+
flex: 1,
|
|
18
22
|
},
|
|
19
23
|
triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
|
|
20
24
|
props: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { COMPONENT_TYPES, createBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, createStaticNumberProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
const SHARED_SEED_DATA = {
|
|
3
|
-
category: COMPONENT_TYPES.layout
|
|
3
|
+
category: COMPONENT_TYPES.testing /*.layout*/,
|
|
4
4
|
packageName: "native-base",
|
|
5
5
|
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
6
6
|
};
|
package/src/mappings/Shadow.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { COMPONENT_TYPES,
|
|
1
|
+
import { COMPONENT_TYPES, createColorProp, createStaticNumberProp, createStaticBoolProp, createDisabledProp, GROUPS, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Shadow",
|
|
4
4
|
tag: "Shadow",
|
|
5
5
|
description: "A cross-platform, universal shadow.",
|
|
6
6
|
category: COMPONENT_TYPES.view,
|
|
7
|
-
stylesPanelSections:
|
|
7
|
+
stylesPanelSections: [
|
|
8
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
9
|
+
StylesPanelSections.Size,
|
|
10
|
+
StylesPanelSections.Margins,
|
|
11
|
+
StylesPanelSections.Position,
|
|
12
|
+
StylesPanelSections.Borders,
|
|
13
|
+
StylesPanelSections.Effects,
|
|
14
|
+
],
|
|
8
15
|
props: {
|
|
9
16
|
disabled: createDisabledProp({
|
|
10
17
|
description: "Disables the shadow.",
|
|
@@ -26,7 +33,7 @@ export const SEED_DATA = {
|
|
|
26
33
|
paintInside: createStaticBoolProp({
|
|
27
34
|
label: "Paint Inside",
|
|
28
35
|
description: "Apply the shadow below/inside the content.",
|
|
29
|
-
defaultValue:
|
|
36
|
+
defaultValue: true,
|
|
30
37
|
}),
|
|
31
38
|
stretch: createStaticBoolProp({
|
|
32
39
|
label: "Stretch",
|
package/src/mappings/Shadow.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMPONENT_TYPES,
|
|
3
|
-
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
4
3
|
createColorProp,
|
|
5
4
|
createStaticNumberProp,
|
|
6
5
|
createStaticBoolProp,
|
|
7
6
|
createDisabledProp,
|
|
8
7
|
GROUPS,
|
|
8
|
+
StylesPanelSections,
|
|
9
9
|
} from "@draftbit/types";
|
|
10
10
|
|
|
11
11
|
export const SEED_DATA = {
|
|
@@ -13,7 +13,14 @@ export const SEED_DATA = {
|
|
|
13
13
|
tag: "Shadow",
|
|
14
14
|
description: "A cross-platform, universal shadow.",
|
|
15
15
|
category: COMPONENT_TYPES.view,
|
|
16
|
-
stylesPanelSections:
|
|
16
|
+
stylesPanelSections: [
|
|
17
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
18
|
+
StylesPanelSections.Size,
|
|
19
|
+
StylesPanelSections.Margins,
|
|
20
|
+
StylesPanelSections.Position,
|
|
21
|
+
StylesPanelSections.Borders,
|
|
22
|
+
StylesPanelSections.Effects,
|
|
23
|
+
],
|
|
17
24
|
props: {
|
|
18
25
|
disabled: createDisabledProp({
|
|
19
26
|
description: "Disables the shadow.",
|
|
@@ -35,7 +42,7 @@ export const SEED_DATA = {
|
|
|
35
42
|
paintInside: createStaticBoolProp({
|
|
36
43
|
label: "Paint Inside",
|
|
37
44
|
description: "Apply the shadow below/inside the content.",
|
|
38
|
-
defaultValue:
|
|
45
|
+
defaultValue: true,
|
|
39
46
|
}),
|
|
40
47
|
stretch: createStaticBoolProp({
|
|
41
48
|
label: "Stretch",
|
package/src/mappings/Table.js
CHANGED
|
@@ -55,7 +55,7 @@ export const SEED_DATA = [
|
|
|
55
55
|
name: "Table",
|
|
56
56
|
tag: "Table",
|
|
57
57
|
description: "Top level table container",
|
|
58
|
-
category: COMPONENT_TYPES.table
|
|
58
|
+
category: COMPONENT_TYPES.testing /*.table*/,
|
|
59
59
|
stylesPanelSections: [
|
|
60
60
|
StylesPanelSections.Size,
|
|
61
61
|
StylesPanelSections.Margins,
|
|
@@ -101,7 +101,7 @@ export const SEED_DATA = [
|
|
|
101
101
|
name: "Table Row",
|
|
102
102
|
tag: "TableRow",
|
|
103
103
|
description: "Table Row container",
|
|
104
|
-
category: COMPONENT_TYPES.table
|
|
104
|
+
category: COMPONENT_TYPES.testing /*.table*/,
|
|
105
105
|
stylesPanelSections: [StylesPanelSections.Background],
|
|
106
106
|
props: {
|
|
107
107
|
...SHARED_SEED_DATA_PROPS,
|
|
@@ -124,7 +124,7 @@ export const SEED_DATA = [
|
|
|
124
124
|
name: "Table Cell",
|
|
125
125
|
tag: "TableCell",
|
|
126
126
|
description: "Table Cell container",
|
|
127
|
-
category: COMPONENT_TYPES.table
|
|
127
|
+
category: COMPONENT_TYPES.testing /*.table*/,
|
|
128
128
|
stylesPanelSections: [
|
|
129
129
|
StylesPanelSections.LayoutFlexItems,
|
|
130
130
|
StylesPanelSections.LayoutSelectedItem,
|
package/src/mappings/Table.ts
CHANGED
|
@@ -73,7 +73,7 @@ export const SEED_DATA = [
|
|
|
73
73
|
name: "Table",
|
|
74
74
|
tag: "Table",
|
|
75
75
|
description: "Top level table container",
|
|
76
|
-
category: COMPONENT_TYPES.table
|
|
76
|
+
category: COMPONENT_TYPES.testing /*.table*/,
|
|
77
77
|
stylesPanelSections: [
|
|
78
78
|
StylesPanelSections.Size,
|
|
79
79
|
StylesPanelSections.Margins,
|
|
@@ -120,7 +120,7 @@ export const SEED_DATA = [
|
|
|
120
120
|
name: "Table Row",
|
|
121
121
|
tag: "TableRow",
|
|
122
122
|
description: "Table Row container",
|
|
123
|
-
category: COMPONENT_TYPES.table
|
|
123
|
+
category: COMPONENT_TYPES.testing /*.table*/,
|
|
124
124
|
stylesPanelSections: [StylesPanelSections.Background],
|
|
125
125
|
props: {
|
|
126
126
|
...SHARED_SEED_DATA_PROPS,
|
|
@@ -144,7 +144,7 @@ export const SEED_DATA = [
|
|
|
144
144
|
name: "Table Cell",
|
|
145
145
|
tag: "TableCell",
|
|
146
146
|
description: "Table Cell container",
|
|
147
|
-
category: COMPONENT_TYPES.table
|
|
147
|
+
category: COMPONENT_TYPES.testing /*.table*/,
|
|
148
148
|
stylesPanelSections: [
|
|
149
149
|
StylesPanelSections.LayoutFlexItems,
|
|
150
150
|
StylesPanelSections.LayoutSelectedItem,
|