@draftbit/core 43.3.4-e422d9.0 → 43.4.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.
Files changed (55) hide show
  1. package/lib/commonjs/components/Accordion/AccordionGroup.js +14 -26
  2. package/lib/commonjs/components/Accordion/AccordionGroup.js.map +1 -1
  3. package/lib/commonjs/components/FAB.js +6 -2
  4. package/lib/commonjs/components/FAB.js.map +1 -1
  5. package/lib/commonjs/components/Swiper/Swiper.js +23 -1
  6. package/lib/commonjs/components/Swiper/Swiper.js.map +1 -1
  7. package/lib/commonjs/mappings/{AccordionGroup.js → Accordion.js} +9 -2
  8. package/lib/commonjs/mappings/Accordion.js.map +1 -0
  9. package/lib/commonjs/mappings/AccordionItem.js +1 -1
  10. package/lib/commonjs/mappings/AccordionItem.js.map +1 -1
  11. package/lib/commonjs/mappings/Swiper.js +14 -0
  12. package/lib/commonjs/mappings/Swiper.js.map +1 -1
  13. package/lib/commonjs/mappings/TextArea.js +10 -1
  14. package/lib/commonjs/mappings/TextArea.js.map +1 -1
  15. package/lib/module/components/Accordion/AccordionGroup.js +13 -26
  16. package/lib/module/components/Accordion/AccordionGroup.js.map +1 -1
  17. package/lib/module/components/FAB.js +6 -2
  18. package/lib/module/components/FAB.js.map +1 -1
  19. package/lib/module/components/Picker/PickerComponent.web.js +3 -17
  20. package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
  21. package/lib/module/components/Swiper/Swiper.js +23 -1
  22. package/lib/module/components/Swiper/Swiper.js.map +1 -1
  23. package/lib/module/mappings/{AccordionGroup.js → Accordion.js} +9 -2
  24. package/lib/module/mappings/Accordion.js.map +1 -0
  25. package/lib/module/mappings/AccordionItem.js +1 -1
  26. package/lib/module/mappings/AccordionItem.js.map +1 -1
  27. package/lib/module/mappings/MapCallout.js.map +1 -1
  28. package/lib/module/mappings/RowHeadlineImageIcon.js.map +1 -1
  29. package/lib/module/mappings/ScrollView.js.map +1 -1
  30. package/lib/module/mappings/Swiper.js +15 -1
  31. package/lib/module/mappings/Swiper.js.map +1 -1
  32. package/lib/module/mappings/TextArea.js +10 -1
  33. package/lib/module/mappings/TextArea.js.map +1 -1
  34. package/lib/module/styles/DefaultTheme.js.map +1 -1
  35. package/lib/typescript/src/components/Swiper/Swiper.d.ts +5 -1
  36. package/lib/typescript/src/mappings/{AccordionGroup.d.ts → Accordion.d.ts} +7 -0
  37. package/lib/typescript/src/mappings/Swiper.d.ts +40 -0
  38. package/lib/typescript/src/mappings/TextArea.d.ts +10 -1
  39. package/package.json +3 -3
  40. package/src/components/Accordion/AccordionGroup.js +16 -33
  41. package/src/components/Accordion/AccordionGroup.tsx +28 -56
  42. package/src/components/FAB.js +1 -1
  43. package/src/components/FAB.tsx +6 -2
  44. package/src/components/Swiper/Swiper.js +9 -1
  45. package/src/components/Swiper/Swiper.tsx +16 -0
  46. package/src/mappings/{AccordionGroup.js → Accordion.js} +8 -1
  47. package/src/mappings/{AccordionGroup.ts → Accordion.ts} +8 -1
  48. package/src/mappings/AccordionItem.js +1 -1
  49. package/src/mappings/AccordionItem.ts +1 -1
  50. package/src/mappings/Swiper.js +15 -1
  51. package/src/mappings/Swiper.ts +15 -0
  52. package/src/mappings/TextArea.js +12 -1
  53. package/src/mappings/TextArea.ts +12 -1
  54. package/lib/commonjs/mappings/AccordionGroup.js.map +0 -1
  55. package/lib/module/mappings/AccordionGroup.js.map +0 -1
@@ -10,6 +10,7 @@ import Text from "../Text";
10
10
  import { withTheme } from "../../theming";
11
11
  import type { IconSlot } from "../../interfaces/Icon";
12
12
  import type { Theme } from "../../styles/DefaultTheme";
13
+ import { extractStyles } from "../../utilities";
13
14
 
14
15
  type Props = {
15
16
  openColor: string;
@@ -42,9 +43,7 @@ const AccordionGroup = ({
42
43
  );
43
44
 
44
45
  const handlePressAction = () => {
45
- if (expandedProp === undefined) {
46
- setExpanded(!expanded);
47
- }
46
+ setExpanded(!expanded);
48
47
  };
49
48
 
50
49
  const expandedInternal = expandedProp !== undefined ? expandedProp : expanded;
@@ -54,64 +53,40 @@ const AccordionGroup = ({
54
53
 
55
54
  const labelColor = expanded ? expandedColor : collapsedColor;
56
55
 
56
+ const { textStyles, viewStyles } = extractStyles(style);
57
+
57
58
  return (
58
59
  <>
59
60
  <Pressable
60
- style={[style]}
61
+ style={[styles.row, viewStyles]}
61
62
  onPress={handlePressAction}
62
63
  accessibilityRole="button"
63
64
  >
64
- <View style={styles.row}>
65
- {icon ? (
66
- <Icon
67
- name={icon}
68
- size={iconSize}
69
- color={labelColor}
70
- style={styles.icon}
71
- />
72
- ) : null}
73
- <View style={[styles.item, styles.content]}>
74
- <Text
75
- selectable={false}
76
- style={[
77
- styles.label,
78
- {
79
- color: labelColor,
80
- },
81
- style,
82
- ]}
83
- >
84
- {label}
85
- </Text>
86
- </View>
87
- <View style={[styles.item]}>
88
- <Icon
89
- name={
90
- expanded
91
- ? "MaterialIcons/keyboard-arrow-up"
92
- : "MaterialIcons/keyboard-arrow-down"
93
- }
94
- color={caretColor}
95
- size={24}
96
- />
97
- </View>
65
+ {icon ? <Icon name={icon} size={iconSize} color={labelColor} /> : null}
66
+ <View style={styles.content}>
67
+ <Text
68
+ selectable={false}
69
+ style={[
70
+ {
71
+ color: labelColor,
72
+ },
73
+ textStyles,
74
+ ]}
75
+ >
76
+ {label}
77
+ </Text>
98
78
  </View>
79
+ <Icon
80
+ name={
81
+ expanded
82
+ ? "MaterialIcons/keyboard-arrow-up"
83
+ : "MaterialIcons/keyboard-arrow-down"
84
+ }
85
+ color={caretColor}
86
+ size={24}
87
+ />
99
88
  </Pressable>
100
- {expandedInternal
101
- ? React.Children.map(children, (child) => {
102
- if (
103
- React.isValidElement(child) &&
104
- !child.props.left &&
105
- !child.props.right
106
- ) {
107
- return React.cloneElement(child, {
108
- style: child.props.style,
109
- });
110
- }
111
-
112
- return child;
113
- })
114
- : null}
89
+ {expandedInternal ? children : null}
115
90
  </>
116
91
  );
117
92
  };
@@ -124,9 +99,6 @@ const styles = StyleSheet.create({
124
99
  label: {
125
100
  fontSize: 16,
126
101
  },
127
- item: {
128
- margin: 8,
129
- },
130
102
  content: {
131
103
  flex: 1,
132
104
  justifyContent: "center",
@@ -28,7 +28,7 @@ const FAB = ({ onPress, disabled, loading, iconName = "MaterialIcons/add", style
28
28
  },
29
29
  ];
30
30
  }, ...props },
31
- React.createElement(View, null, loading ? (React.createElement(ActivityIndicator, { size: "small", color: color })) : (React.createElement(Icon, { name: iconName, size: 28, color: color }))))));
31
+ React.createElement(View, null, loading ? (React.createElement(ActivityIndicator, { style: size > 50 ? { marginTop: 2, marginLeft: 2 } : undefined, size: size <= 50 ? "small" : "large", color: color })) : (React.createElement(Icon, { name: iconName, size: size, color: color }))))));
32
32
  };
33
33
  const styles = StyleSheet.create({
34
34
  button: {
@@ -77,9 +77,13 @@ const FAB: React.FC<Props> = ({
77
77
  >
78
78
  <View>
79
79
  {loading ? (
80
- <ActivityIndicator size="small" color={color} />
80
+ <ActivityIndicator
81
+ style={size > 50 ? { marginTop: 2, marginLeft: 2 } : undefined}
82
+ size={size <= 50 ? "small" : "large"}
83
+ color={color}
84
+ />
81
85
  ) : (
82
- <Icon name={iconName} size={28} color={color} />
86
+ <Icon name={iconName} size={size} color={color} />
83
87
  )}
84
88
  </View>
85
89
  </Pressable>
@@ -1,10 +1,18 @@
1
1
  import React from "react";
2
2
  import { View } from "react-native";
3
3
  import SwiperComponent from "react-native-web-swiper";
4
- const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", dotsTouchable = true, children, style, }) => (React.createElement(View, { style: style },
4
+ const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, children, style, }) => (React.createElement(View, { style: style },
5
5
  React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {
6
6
  prevTitle,
7
7
  nextTitle,
8
+ prevTitleStyle: { color: prevTitleColor },
9
+ nextTitleStyle: { color: nextTitleColor },
8
10
  dotsTouchable,
11
+ ...(dotColor
12
+ ? { dotProps: { badgeStyle: { backgroundColor: dotColor } } }
13
+ : {}),
14
+ ...(dotActiveColor
15
+ ? { dotActiveStyle: { backgroundColor: dotActiveColor } }
16
+ : {}),
9
17
  } }, children)));
10
18
  export default Swiper;
@@ -9,7 +9,11 @@ export interface SwiperProps {
9
9
  timeout?: number;
10
10
  prevTitle?: string;
11
11
  nextTitle?: string;
12
+ prevTitleColor?: string;
13
+ nextTitleColor?: string;
12
14
  dotsTouchable?: boolean;
15
+ dotColor?: string;
16
+ dotActiveColor?: string;
13
17
  children: React.ReactNode;
14
18
  style?: StyleProp<ViewStyle>;
15
19
  }
@@ -21,7 +25,11 @@ const Swiper = ({
21
25
  from = 0,
22
26
  prevTitle = "",
23
27
  nextTitle = "",
28
+ prevTitleColor,
29
+ nextTitleColor,
24
30
  dotsTouchable = true,
31
+ dotColor,
32
+ dotActiveColor,
25
33
  children,
26
34
  style,
27
35
  }: SwiperProps) => (
@@ -34,7 +42,15 @@ const Swiper = ({
34
42
  controlsProps={{
35
43
  prevTitle,
36
44
  nextTitle,
45
+ prevTitleStyle: { color: prevTitleColor },
46
+ nextTitleStyle: { color: nextTitleColor },
37
47
  dotsTouchable,
48
+ ...(dotColor
49
+ ? { dotProps: { badgeStyle: { backgroundColor: dotColor } } }
50
+ : {}),
51
+ ...(dotActiveColor
52
+ ? { dotActiveStyle: { backgroundColor: dotActiveColor } }
53
+ : {}),
38
54
  }}
39
55
  >
40
56
  {children}
@@ -1,9 +1,16 @@
1
1
  import { COMPONENT_TYPES, createNumberProp, createIconProp, createTextProp, createStaticBoolProp, createColorProp, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
- name: "Accordion Group",
3
+ name: "Accordion",
4
4
  tag: "AccordionGroup",
5
5
  description: "An expandable container containing components",
6
6
  category: COMPONENT_TYPES.container,
7
+ layout: {
8
+ paddingTop: 8,
9
+ paddingRight: 8,
10
+ paddingBottom: 8,
11
+ paddingLeft: 8,
12
+ fontSize: 16,
13
+ },
7
14
  props: {
8
15
  openColor: createColorProp({
9
16
  label: "Open text color",
@@ -8,10 +8,17 @@ import {
8
8
  } from "@draftbit/types";
9
9
 
10
10
  export const SEED_DATA = {
11
- name: "Accordion Group",
11
+ name: "Accordion",
12
12
  tag: "AccordionGroup",
13
13
  description: "An expandable container containing components",
14
14
  category: COMPONENT_TYPES.container,
15
+ layout: {
16
+ paddingTop: 8,
17
+ paddingRight: 8,
18
+ paddingBottom: 8,
19
+ paddingLeft: 8,
20
+ fontSize: 16,
21
+ },
15
22
  props: {
16
23
  openColor: createColorProp({
17
24
  label: "Open text color",
@@ -3,7 +3,7 @@ export const SEED_DATA = {
3
3
  name: "Accordion Item",
4
4
  tag: "AccordionItem",
5
5
  description: "Item to be used in Accordion",
6
- category: COMPONENT_TYPES.button,
6
+ category: COMPONENT_TYPES.deprecated,
7
7
  props: {
8
8
  icon: createIconProp(),
9
9
  label: createTextProp({
@@ -9,7 +9,7 @@ export const SEED_DATA = {
9
9
  name: "Accordion Item",
10
10
  tag: "AccordionItem",
11
11
  description: "Item to be used in Accordion",
12
- category: COMPONENT_TYPES.button,
12
+ category: COMPONENT_TYPES.deprecated,
13
13
  props: {
14
14
  icon: createIconProp(),
15
15
  label: createTextProp({
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, GROUPS, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Swiper",
4
4
  tag: "Swiper",
@@ -37,6 +37,20 @@ export const SEED_DATA = {
37
37
  label: "Next Title",
38
38
  defaultValue: "",
39
39
  }),
40
+ prevTitleColor: createColorProp({
41
+ label: "Previous Title Color",
42
+ }),
43
+ nextTitleColor: createColorProp({
44
+ label: "Next Title Color",
45
+ }),
46
+ dotColor: createColorProp({
47
+ label: "Dot Color",
48
+ defaultValue: "light",
49
+ }),
50
+ dotActiveColor: createColorProp({
51
+ label: "Dot Active Color",
52
+ defaultValue: "primary",
53
+ }),
40
54
  dotsTouchable: createBoolProp({
41
55
  group: GROUPS.basic,
42
56
  label: "Dots Touchable",
@@ -3,6 +3,7 @@ import {
3
3
  createBoolProp,
4
4
  createNumberProp,
5
5
  createTextProp,
6
+ createColorProp,
6
7
  GROUPS,
7
8
  } from "@draftbit/types";
8
9
 
@@ -44,6 +45,20 @@ export const SEED_DATA = {
44
45
  label: "Next Title",
45
46
  defaultValue: "",
46
47
  }),
48
+ prevTitleColor: createColorProp({
49
+ label: "Previous Title Color",
50
+ }),
51
+ nextTitleColor: createColorProp({
52
+ label: "Next Title Color",
53
+ }),
54
+ dotColor: createColorProp({
55
+ label: "Dot Color",
56
+ defaultValue: "light",
57
+ }),
58
+ dotActiveColor: createColorProp({
59
+ label: "Dot Active Color",
60
+ defaultValue: "primary",
61
+ }),
47
62
  dotsTouchable: createBoolProp({
48
63
  group: GROUPS.basic,
49
64
  label: "Dots Touchable",
@@ -4,7 +4,18 @@ export const SEED_DATA = {
4
4
  tag: "TextInput",
5
5
  description: "An input field that allows for multiple lines.",
6
6
  category: COMPONENT_TYPES.input,
7
- layout: { flex: 1 },
7
+ layout: {
8
+ borderLeftWidth: 1,
9
+ borderRightWidth: 1,
10
+ borderTopWidth: 1,
11
+ borderBottomWidth: 1,
12
+ borderColor: "divider",
13
+ paddingLeft: 8,
14
+ paddingRight: 8,
15
+ paddingTop: 8,
16
+ paddingBottom: 8,
17
+ borderRadius: 8,
18
+ },
8
19
  triggers: [Triggers.OnChangeText],
9
20
  props: {
10
21
  ...TEXT_INPUT_PROPS,
@@ -13,7 +13,18 @@ export const SEED_DATA = {
13
13
  tag: "TextInput",
14
14
  description: "An input field that allows for multiple lines.",
15
15
  category: COMPONENT_TYPES.input,
16
- layout: { flex: 1 },
16
+ layout: {
17
+ borderLeftWidth: 1,
18
+ borderRightWidth: 1,
19
+ borderTopWidth: 1,
20
+ borderBottomWidth: 1,
21
+ borderColor: "divider",
22
+ paddingLeft: 8,
23
+ paddingRight: 8,
24
+ paddingTop: 8,
25
+ paddingBottom: 8,
26
+ borderRadius: 8,
27
+ },
17
28
  triggers: [Triggers.OnChangeText],
18
29
  props: {
19
30
  ...TEXT_INPUT_PROPS,
@@ -1 +0,0 @@
1
- {"version":3,"sources":["AccordionGroup.ts"],"names":["SEED_DATA","name","tag","description","category","COMPONENT_TYPES","container","props","openColor","label","closedColor","caretColor","iconSize","defaultValue","expanded","icon"],"mappings":";;;;;;;AAAA;;AASO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,iBADiB;AAEvBC,EAAAA,GAAG,EAAE,gBAFkB;AAGvBC,EAAAA,WAAW,EAAE,+CAHU;AAIvBC,EAAAA,QAAQ,EAAEC,uBAAgBC,SAJH;AAKvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAE,4BAAgB;AACzBC,MAAAA,KAAK,EAAE;AADkB,KAAhB,CADN;AAILC,IAAAA,WAAW,EAAE,4BAAgB;AAC3BD,MAAAA,KAAK,EAAE;AADoB,KAAhB,CAJR;AAOLE,IAAAA,UAAU,EAAE,4BAAgB;AAC1BF,MAAAA,KAAK,EAAE;AADmB,KAAhB,CAPP;AAULG,IAAAA,QAAQ,EAAE,6BAAiB;AACzBH,MAAAA,KAAK,EAAE,WADkB;AAEzBI,MAAAA,YAAY,EAAE;AAFW,KAAjB,CAVL;AAcLJ,IAAAA,KAAK,EAAE,2BAAe;AACpBA,MAAAA,KAAK,EAAE;AADa,KAAf,CAdF;AAiBLK,IAAAA,QAAQ,EAAE,iCAAqB;AAC7BL,MAAAA,KAAK,EAAE,UADsB;AAE7BN,MAAAA,WAAW,EAAE;AAFgB,KAArB,CAjBL;AAqBLY,IAAAA,IAAI,EAAE;AArBD;AALgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createNumberProp,\n createIconProp,\n createTextProp,\n createStaticBoolProp,\n createColorProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Accordion Group\",\n tag: \"AccordionGroup\",\n description: \"An expandable container containing components\",\n category: COMPONENT_TYPES.container,\n props: {\n openColor: createColorProp({\n label: \"Open text color\",\n }),\n closedColor: createColorProp({\n label: \"Closed text Color\",\n }),\n caretColor: createColorProp({\n label: \"Caret color\",\n }),\n iconSize: createNumberProp({\n label: \"Icon size\",\n defaultValue: 24,\n }),\n label: createTextProp({\n label: \"Label\",\n }),\n expanded: createStaticBoolProp({\n label: \"Expanded\",\n description: \"Whether the AccordionGroup should be expanded or not\",\n }),\n icon: createIconProp(),\n },\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["AccordionGroup.ts"],"names":["COMPONENT_TYPES","createNumberProp","createIconProp","createTextProp","createStaticBoolProp","createColorProp","SEED_DATA","name","tag","description","category","container","props","openColor","label","closedColor","caretColor","iconSize","defaultValue","expanded","icon"],"mappings":"AAAA,SACEA,eADF,EAEEC,gBAFF,EAGEC,cAHF,EAIEC,cAJF,EAKEC,oBALF,EAMEC,eANF,QAOO,iBAPP;AASA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,iBADiB;AAEvBC,EAAAA,GAAG,EAAE,gBAFkB;AAGvBC,EAAAA,WAAW,EAAE,+CAHU;AAIvBC,EAAAA,QAAQ,EAAEV,eAAe,CAACW,SAJH;AAKvBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,SAAS,EAAER,eAAe,CAAC;AACzBS,MAAAA,KAAK,EAAE;AADkB,KAAD,CADrB;AAILC,IAAAA,WAAW,EAAEV,eAAe,CAAC;AAC3BS,MAAAA,KAAK,EAAE;AADoB,KAAD,CAJvB;AAOLE,IAAAA,UAAU,EAAEX,eAAe,CAAC;AAC1BS,MAAAA,KAAK,EAAE;AADmB,KAAD,CAPtB;AAULG,IAAAA,QAAQ,EAAEhB,gBAAgB,CAAC;AACzBa,MAAAA,KAAK,EAAE,WADkB;AAEzBI,MAAAA,YAAY,EAAE;AAFW,KAAD,CAVrB;AAcLJ,IAAAA,KAAK,EAAEX,cAAc,CAAC;AACpBW,MAAAA,KAAK,EAAE;AADa,KAAD,CAdhB;AAiBLK,IAAAA,QAAQ,EAAEf,oBAAoB,CAAC;AAC7BU,MAAAA,KAAK,EAAE,UADsB;AAE7BL,MAAAA,WAAW,EAAE;AAFgB,KAAD,CAjBzB;AAqBLW,IAAAA,IAAI,EAAElB,cAAc;AArBf;AALgB,CAAlB","sourcesContent":["import {\n COMPONENT_TYPES,\n createNumberProp,\n createIconProp,\n createTextProp,\n createStaticBoolProp,\n createColorProp,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Accordion Group\",\n tag: \"AccordionGroup\",\n description: \"An expandable container containing components\",\n category: COMPONENT_TYPES.container,\n props: {\n openColor: createColorProp({\n label: \"Open text color\",\n }),\n closedColor: createColorProp({\n label: \"Closed text Color\",\n }),\n caretColor: createColorProp({\n label: \"Caret color\",\n }),\n iconSize: createNumberProp({\n label: \"Icon size\",\n defaultValue: 24,\n }),\n label: createTextProp({\n label: \"Label\",\n }),\n expanded: createStaticBoolProp({\n label: \"Expanded\",\n description: \"Whether the AccordionGroup should be expanded or not\",\n }),\n icon: createIconProp(),\n },\n};\n"]}