@draftbit/core 43.4.15-641e7e.0 → 43.4.15-7fb85c.1

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 (38) hide show
  1. package/lib/commonjs/components/Accordion/AccordionGroup.js +17 -16
  2. package/lib/commonjs/components/Accordion/AccordionGroup.js.map +1 -1
  3. package/lib/commonjs/components/CardInline.js.map +1 -1
  4. package/lib/commonjs/components/DatePicker/DatePicker.js +2 -1
  5. package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
  6. package/lib/commonjs/components/Divider.js +13 -3
  7. package/lib/commonjs/components/Divider.js.map +1 -1
  8. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +6 -10
  9. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js.map +1 -1
  10. package/lib/commonjs/mappings/Accordion.js +14 -10
  11. package/lib/commonjs/mappings/Accordion.js.map +1 -1
  12. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  13. package/lib/commonjs/mappings/RowBodyIcon.js.map +1 -1
  14. package/lib/commonjs/mappings/RowHeadlineImageCaption.js.map +1 -1
  15. package/lib/commonjs/mappings/RowHeadlineImageIcon.js.map +1 -1
  16. package/lib/module/components/Accordion/AccordionGroup.js +17 -16
  17. package/lib/module/components/Accordion/AccordionGroup.js.map +1 -1
  18. package/lib/module/components/DatePicker/DatePicker.js +2 -1
  19. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  20. package/lib/module/components/RadioButton/RadioButtonFieldGroup.js +4 -5
  21. package/lib/module/components/RadioButton/RadioButtonFieldGroup.js.map +1 -1
  22. package/lib/module/components/RadioButton/RadioButtonGroup.js +6 -10
  23. package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
  24. package/lib/module/mappings/Accordion.js +14 -10
  25. package/lib/module/mappings/Accordion.js.map +1 -1
  26. package/lib/module/mappings/DatePicker.js.map +1 -1
  27. package/lib/typescript/src/components/Accordion/AccordionGroup.d.ts +26 -23
  28. package/lib/typescript/src/components/RadioButton/RadioButtonGroup.d.ts +1 -1
  29. package/lib/typescript/src/mappings/Accordion.d.ts +20 -9
  30. package/package.json +2 -2
  31. package/src/components/Accordion/AccordionGroup.js +9 -9
  32. package/src/components/Accordion/AccordionGroup.tsx +23 -27
  33. package/src/components/DatePicker/DatePicker.js +1 -1
  34. package/src/components/DatePicker/DatePicker.tsx +1 -1
  35. package/src/components/RadioButton/RadioButtonGroup.js +6 -10
  36. package/src/components/RadioButton/RadioButtonGroup.tsx +8 -12
  37. package/src/mappings/Accordion.js +13 -9
  38. package/src/mappings/Accordion.ts +14 -9
@@ -2,28 +2,30 @@ import * as React from "react";
2
2
  import { StyleProp, TextStyle } from "react-native";
3
3
  import type { IconSlot } from "../../interfaces/Icon";
4
4
  import type { Theme } from "../../styles/DefaultTheme";
5
- declare type Props = {
6
- openColor: string;
7
- closedColor: string;
8
- caretColor: string;
5
+ declare type AccordionGroupProps = {
6
+ label?: string;
7
+ expanded?: boolean;
8
+ openColor?: string;
9
+ closedColor?: string;
10
+ caretColor?: string;
11
+ caretSize?: number;
9
12
  icon?: string;
10
- iconSize: number;
13
+ iconSize?: number;
11
14
  style?: StyleProp<TextStyle>;
12
- children: React.ReactNode;
13
- label: string;
14
- expanded?: boolean;
15
+ children?: React.ReactNode;
15
16
  theme: Theme;
16
17
  } & IconSlot;
17
18
  declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<{
18
- openColor: string;
19
- closedColor: string;
20
- caretColor: string;
19
+ label?: string | undefined;
20
+ expanded?: boolean | undefined;
21
+ openColor?: string | undefined;
22
+ closedColor?: string | undefined;
23
+ caretColor?: string | undefined;
24
+ caretSize?: number | undefined;
21
25
  icon?: string | undefined;
22
- iconSize: number;
26
+ iconSize?: number | undefined;
23
27
  style?: StyleProp<TextStyle>;
24
- children: React.ReactNode;
25
- label: string;
26
- expanded?: boolean | undefined;
28
+ children?: React.ReactNode;
27
29
  theme: {
28
30
  disabledOpacity: number;
29
31
  roundness: number;
@@ -1526,15 +1528,16 @@ declare const _default: React.ComponentType<import("@draftbit/react-theme-provid
1526
1528
  } & IconSlot, "theme"> & {
1527
1529
  theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
1528
1530
  }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<{
1529
- openColor: string;
1530
- closedColor: string;
1531
- caretColor: string;
1531
+ label?: string | undefined;
1532
+ expanded?: boolean | undefined;
1533
+ openColor?: string | undefined;
1534
+ closedColor?: string | undefined;
1535
+ caretColor?: string | undefined;
1536
+ caretSize?: number | undefined;
1532
1537
  icon?: string | undefined;
1533
- iconSize: number;
1538
+ iconSize?: number | undefined;
1534
1539
  style?: StyleProp<TextStyle>;
1535
- children: React.ReactNode;
1536
- label: string;
1537
- expanded?: boolean | undefined;
1540
+ children?: React.ReactNode;
1538
1541
  theme: {
1539
1542
  disabledOpacity: number;
1540
1543
  roundness: number;
@@ -3034,5 +3037,5 @@ declare const _default: React.ComponentType<import("@draftbit/react-theme-provid
3034
3037
  };
3035
3038
  };
3036
3039
  };
3037
- } & IconSlot> & (({ Icon, openColor, closedColor, caretColor, icon, iconSize, style, label, children, expanded: expandedProp, theme, }: Props) => JSX.Element), {}>;
3040
+ } & IconSlot> & (({ label, expanded: expandedProp, openColor, closedColor, caretColor: caretColorProp, caretSize, icon, iconSize, style, children, theme, Icon, }: AccordionGroupProps) => JSX.Element), {}>;
3038
3041
  export default _default;
@@ -5,7 +5,7 @@ import { Direction } from "./context";
5
5
  export interface RadioButtonGroupProps {
6
6
  direction?: Direction;
7
7
  style?: StyleProp<ViewStyle>;
8
- value: string | number;
8
+ value: string;
9
9
  onValueChange?: (value: string) => void;
10
10
  defaultValue?: string | number;
11
11
  theme: Theme;
@@ -11,6 +11,17 @@ export declare const SEED_DATA: {
11
11
  fontSize: number;
12
12
  };
13
13
  props: {
14
+ label: any;
15
+ expanded: {
16
+ label: string;
17
+ description: string;
18
+ formType: string;
19
+ propType: string;
20
+ defaultValue: boolean;
21
+ editable: boolean;
22
+ required: boolean;
23
+ group: string;
24
+ };
14
25
  openColor: {
15
26
  group: string;
16
27
  label: string;
@@ -41,7 +52,7 @@ export declare const SEED_DATA: {
41
52
  formType: string;
42
53
  propType: string;
43
54
  };
44
- iconSize: {
55
+ caretSize: {
45
56
  label: string;
46
57
  description: string;
47
58
  formType: string;
@@ -52,26 +63,26 @@ export declare const SEED_DATA: {
52
63
  required: boolean;
53
64
  step: number;
54
65
  };
55
- label: any;
56
- expanded: {
66
+ icon: {
57
67
  label: string;
58
68
  description: string;
59
69
  formType: string;
60
70
  propType: string;
61
- defaultValue: boolean;
62
- editable: boolean;
71
+ defaultValue: string;
63
72
  required: boolean;
73
+ editable: boolean;
64
74
  group: string;
65
75
  };
66
- icon: {
76
+ iconSize: {
67
77
  label: string;
68
78
  description: string;
69
79
  formType: string;
70
80
  propType: string;
71
- defaultValue: string;
72
- required: boolean;
73
- editable: boolean;
74
81
  group: string;
82
+ defaultValue: null;
83
+ editable: boolean;
84
+ required: boolean;
85
+ step: number;
75
86
  };
76
87
  };
77
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "43.4.15-641e7e.0+641e7e58",
3
+ "version": "43.4.15-7fb85c.1+7fb85c2d",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -80,5 +80,5 @@
80
80
  ]
81
81
  ]
82
82
  },
83
- "gitHead": "641e7e58aa06994d0836b6b5df5c687b444fc7aa"
83
+ "gitHead": "7fb85c2dab4429b2ce879f759c01c27a869fc99f"
84
84
  }
@@ -3,16 +3,16 @@ import { View, StyleSheet, Pressable, } from "react-native";
3
3
  import Text from "../Text";
4
4
  import { withTheme } from "../../theming";
5
5
  import { extractStyles } from "../../utilities";
6
- const AccordionGroup = ({ Icon, openColor, closedColor, caretColor, icon, iconSize = 24, style, label, children, expanded: expandedProp, theme, }) => {
7
- const [expanded, setExpanded] = React.useState(expandedProp || false);
8
- const handlePressAction = () => {
9
- setExpanded(!expanded);
10
- };
11
- const expandedInternal = expandedProp !== undefined ? expandedProp : expanded;
6
+ const AccordionGroup = ({ label, expanded: expandedProp = false, openColor, closedColor, caretColor: caretColorProp, caretSize = 24, icon, iconSize = 24, style, children, theme, Icon, }) => {
7
+ const [expanded, setExpanded] = React.useState(expandedProp);
8
+ const { textStyles, viewStyles } = extractStyles(style);
12
9
  const expandedColor = openColor || theme.colors.primary;
13
10
  const collapsedColor = closedColor || theme.colors.primary;
14
11
  const labelColor = expanded ? expandedColor : collapsedColor;
15
- const { textStyles, viewStyles } = extractStyles(style);
12
+ const caretColor = caretColorProp || labelColor;
13
+ const handlePressAction = () => {
14
+ setExpanded(!expanded);
15
+ };
16
16
  return (React.createElement(React.Fragment, null,
17
17
  React.createElement(Pressable, { style: [styles.row, viewStyles], onPress: handlePressAction, accessibilityRole: "button" },
18
18
  icon ? (React.createElement(Icon, { name: icon, size: iconSize, color: labelColor, style: styles.icon })) : null,
@@ -25,8 +25,8 @@ const AccordionGroup = ({ Icon, openColor, closedColor, caretColor, icon, iconSi
25
25
  ] }, label)),
26
26
  React.createElement(Icon, { name: expanded
27
27
  ? "MaterialIcons/keyboard-arrow-up"
28
- : "MaterialIcons/keyboard-arrow-down", color: caretColor, size: 24 })),
29
- expandedInternal ? children : null));
28
+ : "MaterialIcons/keyboard-arrow-down", color: caretColor, size: caretSize })),
29
+ expanded ? children : null));
30
30
  };
31
31
  const styles = StyleSheet.create({
32
32
  row: {
@@ -12,48 +12,44 @@ import type { IconSlot } from "../../interfaces/Icon";
12
12
  import type { Theme } from "../../styles/DefaultTheme";
13
13
  import { extractStyles } from "../../utilities";
14
14
 
15
- type Props = {
16
- openColor: string;
17
- closedColor: string;
18
- caretColor: string;
15
+ type AccordionGroupProps = {
16
+ label?: string;
17
+ expanded?: boolean;
18
+ openColor?: string;
19
+ closedColor?: string;
20
+ caretColor?: string;
21
+ caretSize?: number;
19
22
  icon?: string;
20
- iconSize: number;
23
+ iconSize?: number;
21
24
  style?: StyleProp<TextStyle>;
22
- children: React.ReactNode;
23
- label: string;
24
- expanded?: boolean;
25
+ children?: React.ReactNode;
25
26
  theme: Theme;
26
27
  } & IconSlot;
27
28
 
28
29
  const AccordionGroup = ({
29
- Icon,
30
+ label,
31
+ expanded: expandedProp = false,
30
32
  openColor,
31
33
  closedColor,
32
- caretColor,
34
+ caretColor: caretColorProp,
35
+ caretSize = 24,
33
36
  icon,
34
37
  iconSize = 24,
35
38
  style,
36
- label,
37
39
  children,
38
- expanded: expandedProp,
39
40
  theme,
40
- }: Props) => {
41
- const [expanded, setExpanded] = React.useState<boolean>(
42
- expandedProp || false
43
- );
44
-
45
- const handlePressAction = () => {
46
- setExpanded(!expanded);
47
- };
48
-
49
- const expandedInternal = expandedProp !== undefined ? expandedProp : expanded;
50
-
41
+ Icon,
42
+ }: AccordionGroupProps) => {
43
+ const [expanded, setExpanded] = React.useState<boolean>(expandedProp);
44
+ const { textStyles, viewStyles } = extractStyles(style);
51
45
  const expandedColor = openColor || theme.colors.primary;
52
46
  const collapsedColor = closedColor || theme.colors.primary;
53
-
54
47
  const labelColor = expanded ? expandedColor : collapsedColor;
48
+ const caretColor = caretColorProp || labelColor;
55
49
 
56
- const { textStyles, viewStyles } = extractStyles(style);
50
+ const handlePressAction = () => {
51
+ setExpanded(!expanded);
52
+ };
57
53
 
58
54
  return (
59
55
  <>
@@ -90,10 +86,10 @@ const AccordionGroup = ({
90
86
  : "MaterialIcons/keyboard-arrow-down"
91
87
  }
92
88
  color={caretColor}
93
- size={24}
89
+ size={caretSize}
94
90
  />
95
91
  </Pressable>
96
- {expandedInternal ? children : null}
92
+ {expanded ? children : null}
97
93
  </>
98
94
  );
99
95
  };
@@ -360,7 +360,7 @@ const styles = StyleSheet.create({
360
360
  position: "absolute",
361
361
  left: 0,
362
362
  },
363
- pickerContainer: { flexDirection: "column", width: "100%" },
363
+ pickerContainer: { flexDirection: "column", width: "100%", zIndex: 100 },
364
364
  closeButton: {
365
365
  alignSelf: "flex-end",
366
366
  },
@@ -543,7 +543,7 @@ const styles = StyleSheet.create({
543
543
  position: "absolute",
544
544
  left: 0,
545
545
  },
546
- pickerContainer: { flexDirection: "column", width: "100%" },
546
+ pickerContainer: { flexDirection: "column", width: "100%", zIndex: 100 },
547
547
  closeButton: {
548
548
  alignSelf: "flex-end",
549
549
  },
@@ -3,19 +3,15 @@ import { View } from "react-native";
3
3
  import { getValueForRadioButton } from "../../utilities";
4
4
  import { radioButtonGroupContext, Direction } from "./context";
5
5
  const { Provider } = radioButtonGroupContext;
6
- const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueChange, defaultValue, style, children, ...rest }) => {
6
+ const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueChange, defaultValue = "", style, children, ...rest }) => {
7
7
  const [internalValue, setInternalValue] = React.useState("");
8
8
  React.useEffect(() => {
9
- if (value != null) {
10
- const realValue = getValueForRadioButton(value);
11
- setInternalValue(realValue);
12
- }
9
+ const realValue = getValueForRadioButton(value);
10
+ setInternalValue(realValue);
13
11
  }, [value]);
14
12
  React.useEffect(() => {
15
- if (defaultValue != null) {
16
- const realDefaultValue = getValueForRadioButton(defaultValue);
17
- setInternalValue(realDefaultValue);
18
- }
13
+ const realDefaultValue = getValueForRadioButton(defaultValue);
14
+ setInternalValue(realDefaultValue);
19
15
  }, [defaultValue]);
20
16
  const handleValueChange = (newValue) => {
21
17
  const realNewValue = getValueForRadioButton(newValue);
@@ -34,7 +30,7 @@ const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueC
34
30
  }
35
31
  return (React.createElement(View, { style: [{ minHeight: 40 }, style], ...rest },
36
32
  React.createElement(Provider, { value: {
37
- value: internalValue,
33
+ value: internalValue || "",
38
34
  onValueChange: handleValueChange,
39
35
  direction,
40
36
  } },
@@ -6,7 +6,7 @@ import { radioButtonGroupContext, Direction } from "./context";
6
6
  export interface RadioButtonGroupProps {
7
7
  direction?: Direction;
8
8
  style?: StyleProp<ViewStyle>;
9
- value: string | number;
9
+ value: string;
10
10
  onValueChange?: (value: string) => void;
11
11
  defaultValue?: string | number;
12
12
  theme: Theme;
@@ -19,27 +19,23 @@ const RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({
19
19
  direction = Direction.Vertical,
20
20
  value = "",
21
21
  onValueChange,
22
- defaultValue,
22
+ defaultValue = "",
23
23
  style,
24
24
  children,
25
25
  ...rest
26
26
  }) => {
27
- const [internalValue, setInternalValue] = React.useState("");
27
+ const [internalValue, setInternalValue] = React.useState<string>("");
28
28
 
29
29
  React.useEffect(() => {
30
- if (value != null) {
31
- const realValue = getValueForRadioButton(value);
30
+ const realValue = getValueForRadioButton(value);
32
31
 
33
- setInternalValue(realValue);
34
- }
32
+ setInternalValue(realValue);
35
33
  }, [value]);
36
34
 
37
35
  React.useEffect(() => {
38
- if (defaultValue != null) {
39
- const realDefaultValue = getValueForRadioButton(defaultValue);
36
+ const realDefaultValue = getValueForRadioButton(defaultValue);
40
37
 
41
- setInternalValue(realDefaultValue);
42
- }
38
+ setInternalValue(realDefaultValue);
43
39
  }, [defaultValue]);
44
40
 
45
41
  const handleValueChange = (newValue: string | number) => {
@@ -65,7 +61,7 @@ const RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({
65
61
  <View style={[{ minHeight: 40 }, style]} {...rest}>
66
62
  <Provider
67
63
  value={{
68
- value: internalValue,
64
+ value: internalValue || "",
69
65
  onValueChange: handleValueChange,
70
66
  direction,
71
67
  }}
@@ -12,26 +12,30 @@ export const SEED_DATA = {
12
12
  fontSize: 16,
13
13
  },
14
14
  props: {
15
+ label: createTextProp({
16
+ label: "Label",
17
+ }),
18
+ expanded: createStaticBoolProp({
19
+ label: "Expanded",
20
+ description: "Whether the AccordionGroup should be initaially expanded or not",
21
+ }),
15
22
  openColor: createColorProp({
16
23
  label: "Open text color",
17
24
  }),
18
25
  closedColor: createColorProp({
19
- label: "Closed text Color",
26
+ label: "Closed text color",
20
27
  }),
21
28
  caretColor: createColorProp({
22
29
  label: "Caret color",
23
30
  }),
31
+ caretSize: createNumberProp({
32
+ label: "Caret size",
33
+ defaultValue: 24,
34
+ }),
35
+ icon: createIconProp(),
24
36
  iconSize: createNumberProp({
25
37
  label: "Icon size",
26
38
  defaultValue: 24,
27
39
  }),
28
- label: createTextProp({
29
- label: "Label",
30
- }),
31
- expanded: createStaticBoolProp({
32
- label: "Expanded",
33
- description: "Whether the AccordionGroup should be expanded or not",
34
- }),
35
- icon: createIconProp(),
36
40
  },
37
41
  };
@@ -20,26 +20,31 @@ export const SEED_DATA = {
20
20
  fontSize: 16,
21
21
  },
22
22
  props: {
23
+ label: createTextProp({
24
+ label: "Label",
25
+ }),
26
+ expanded: createStaticBoolProp({
27
+ label: "Expanded",
28
+ description:
29
+ "Whether the AccordionGroup should be initaially expanded or not",
30
+ }),
23
31
  openColor: createColorProp({
24
32
  label: "Open text color",
25
33
  }),
26
34
  closedColor: createColorProp({
27
- label: "Closed text Color",
35
+ label: "Closed text color",
28
36
  }),
29
37
  caretColor: createColorProp({
30
38
  label: "Caret color",
31
39
  }),
40
+ caretSize: createNumberProp({
41
+ label: "Caret size",
42
+ defaultValue: 24,
43
+ }),
44
+ icon: createIconProp(),
32
45
  iconSize: createNumberProp({
33
46
  label: "Icon size",
34
47
  defaultValue: 24,
35
48
  }),
36
- label: createTextProp({
37
- label: "Label",
38
- }),
39
- expanded: createStaticBoolProp({
40
- label: "Expanded",
41
- description: "Whether the AccordionGroup should be expanded or not",
42
- }),
43
- icon: createIconProp(),
44
49
  },
45
50
  };