@draftbit/core 46.1.3 → 46.2.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 (77) hide show
  1. package/lib/commonjs/components/Carousel.js +3 -1
  2. package/lib/commonjs/components/Carousel.js.map +1 -1
  3. package/lib/commonjs/components/Config.js +3 -3
  4. package/lib/commonjs/components/Config.js.map +1 -1
  5. package/lib/commonjs/components/DatePicker/DatePicker.js +3 -3
  6. package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
  7. package/lib/commonjs/components/Picker/Picker.js +4 -5
  8. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  9. package/lib/commonjs/components/Picker/PickerComponent.android.js +2 -2
  10. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
  11. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  12. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
  13. package/lib/commonjs/components/Picker/PickerComponent.web.js +2 -2
  14. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
  15. package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
  16. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
  17. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
  18. package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
  19. package/lib/commonjs/components/StepIndicator.js +1 -1
  20. package/lib/commonjs/components/StepIndicator.js.map +1 -1
  21. package/lib/commonjs/components/Stepper.js +1 -1
  22. package/lib/commonjs/components/Stepper.js.map +1 -1
  23. package/lib/commonjs/mappings/ActionSheetItem.js.map +1 -1
  24. package/lib/commonjs/mappings/BlurView.js.map +1 -1
  25. package/lib/commonjs/utilities.js +1 -1
  26. package/lib/commonjs/utilities.js.map +1 -1
  27. package/lib/module/components/Carousel.js +3 -1
  28. package/lib/module/components/Carousel.js.map +1 -1
  29. package/lib/module/components/Config.js +3 -3
  30. package/lib/module/components/Config.js.map +1 -1
  31. package/lib/module/components/DatePicker/DatePicker.js +3 -3
  32. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  33. package/lib/module/components/Picker/Picker.js +4 -5
  34. package/lib/module/components/Picker/Picker.js.map +1 -1
  35. package/lib/module/components/Picker/PickerComponent.android.js +2 -2
  36. package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
  37. package/lib/module/components/Picker/PickerComponent.ios.js +2 -2
  38. package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -1
  39. package/lib/module/components/Picker/PickerComponent.web.js +2 -2
  40. package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
  41. package/lib/module/components/RadioButton/RadioButton.js +1 -1
  42. package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
  43. package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
  44. package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
  45. package/lib/module/components/StepIndicator.js +1 -1
  46. package/lib/module/components/StepIndicator.js.map +1 -1
  47. package/lib/module/components/Stepper.js +1 -1
  48. package/lib/module/components/Stepper.js.map +1 -1
  49. package/lib/module/utilities.js +1 -1
  50. package/lib/module/utilities.js.map +1 -1
  51. package/package.json +3 -3
  52. package/src/components/ActionSheet/ActionSheet.js +1 -1
  53. package/src/components/Carousel.js +4 -2
  54. package/src/components/Checkbox/Checkbox.js +3 -3
  55. package/src/components/Checkbox/CheckboxGroupRow.js +2 -2
  56. package/src/components/Checkbox/CheckboxRow.js +3 -3
  57. package/src/components/CircularProgress.js +29 -26
  58. package/src/components/DatePicker/DatePicker.js +1 -1
  59. package/src/components/NumberInput.js +1 -1
  60. package/src/components/Picker/Picker.js +8 -8
  61. package/src/components/Picker/Picker.tsx +8 -6
  62. package/src/components/Picker/PickerComponent.android.js +2 -1
  63. package/src/components/Picker/PickerComponent.ios.js +2 -1
  64. package/src/components/Picker/PickerComponent.web.js +2 -1
  65. package/src/components/Portal/Portal.js +2 -2
  66. package/src/components/Portal/PortalConsumer.js +0 -1
  67. package/src/components/Portal/PortalHost.js +43 -41
  68. package/src/components/Portal/PortalManager.js +21 -18
  69. package/src/components/ProgressBar.js +9 -9
  70. package/src/components/RadioButton/RadioButton.js +3 -3
  71. package/src/components/RadioButton/RadioButtonGroup.js +1 -1
  72. package/src/components/RadioButton/RadioButtonRow.js +3 -3
  73. package/src/components/StepIndicator.js +225 -225
  74. package/src/components/Stepper.js +2 -2
  75. package/src/components/Text.js +0 -1
  76. package/src/components/TextField.js +62 -59
  77. package/src/constants.js +1 -1
@@ -27,7 +27,48 @@ export const PortalContext = React.createContext(null);
27
27
  * Here any `Portal` elements under `<App />` are rendered alongside `<App />` and will appear above `<App />` like a `Modal`.
28
28
  */
29
29
  export default class PortalHost extends React.Component {
30
- static displayName = "Portal.Host";
30
+ constructor() {
31
+ super(...arguments);
32
+ this.setManager = (manager) => {
33
+ this.manager = manager;
34
+ };
35
+ this.mount = (children) => {
36
+ const key = this.nextKey++;
37
+ if (this.manager) {
38
+ this.manager.mount(key, children);
39
+ }
40
+ else {
41
+ this.queue.push({ type: "mount", key, children });
42
+ }
43
+ return key;
44
+ };
45
+ this.update = (key, children) => {
46
+ if (this.manager) {
47
+ this.manager.update(key, children);
48
+ }
49
+ else {
50
+ const op = { type: "mount", key, children };
51
+ const index = this.queue.findIndex((o) => o.type === "mount" || (o.type === "update" && o.key === key));
52
+ if (index > -1) {
53
+ // @ts-ignore
54
+ this.queue[index] = op;
55
+ }
56
+ else {
57
+ this.queue.push(op);
58
+ }
59
+ }
60
+ };
61
+ this.unmount = (key) => {
62
+ if (this.manager) {
63
+ this.manager.unmount(key);
64
+ }
65
+ else {
66
+ this.queue.push({ type: "unmount", key });
67
+ }
68
+ };
69
+ this.nextKey = 0;
70
+ this.queue = [];
71
+ }
31
72
  componentDidMount() {
32
73
  const manager = this.manager;
33
74
  const queue = this.queue;
@@ -48,46 +89,6 @@ export default class PortalHost extends React.Component {
48
89
  }
49
90
  }
50
91
  }
51
- setManager = (manager) => {
52
- this.manager = manager;
53
- };
54
- mount = (children) => {
55
- const key = this.nextKey++;
56
- if (this.manager) {
57
- this.manager.mount(key, children);
58
- }
59
- else {
60
- this.queue.push({ type: "mount", key, children });
61
- }
62
- return key;
63
- };
64
- update = (key, children) => {
65
- if (this.manager) {
66
- this.manager.update(key, children);
67
- }
68
- else {
69
- const op = { type: "mount", key, children };
70
- const index = this.queue.findIndex((o) => o.type === "mount" || (o.type === "update" && o.key === key));
71
- if (index > -1) {
72
- // @ts-ignore
73
- this.queue[index] = op;
74
- }
75
- else {
76
- this.queue.push(op);
77
- }
78
- }
79
- };
80
- unmount = (key) => {
81
- if (this.manager) {
82
- this.manager.unmount(key);
83
- }
84
- else {
85
- this.queue.push({ type: "unmount", key });
86
- }
87
- };
88
- nextKey = 0;
89
- queue = [];
90
- manager;
91
92
  render() {
92
93
  return (React.createElement(PortalContext.Provider, { value: {
93
94
  mount: this.mount,
@@ -98,6 +99,7 @@ export default class PortalHost extends React.Component {
98
99
  React.createElement(PortalManager, { ref: this.setManager })));
99
100
  }
100
101
  }
102
+ PortalHost.displayName = "Portal.Host";
101
103
  const styles = StyleSheet.create({
102
104
  container: {
103
105
  flex: 1,
@@ -4,25 +4,28 @@ import { View, StyleSheet } from "react-native";
4
4
  * Portal host is the component which actually renders all Portals.
5
5
  */
6
6
  export default class PortalManager extends React.PureComponent {
7
- state = {
8
- portals: [],
9
- };
10
- mount = (key, children) => {
11
- this.setState((state) => ({
12
- portals: [...state.portals, { key, children }],
7
+ constructor() {
8
+ super(...arguments);
9
+ this.state = {
10
+ portals: [],
11
+ };
12
+ this.mount = (key, children) => {
13
+ this.setState((state) => ({
14
+ portals: [...state.portals, { key, children }],
15
+ }));
16
+ };
17
+ this.update = (key, children) => this.setState((state) => ({
18
+ portals: state.portals.map((item) => {
19
+ if (item.key === key) {
20
+ return { ...item, children };
21
+ }
22
+ return item;
23
+ }),
13
24
  }));
14
- };
15
- update = (key, children) => this.setState((state) => ({
16
- portals: state.portals.map((item) => {
17
- if (item.key === key) {
18
- return { ...item, children };
19
- }
20
- return item;
21
- }),
22
- }));
23
- unmount = (key) => this.setState((state) => ({
24
- portals: state.portals.filter((item) => item.key !== key),
25
- }));
25
+ this.unmount = (key) => this.setState((state) => ({
26
+ portals: state.portals.filter((item) => item.key !== key),
27
+ }));
28
+ }
26
29
  render() {
27
30
  return this.state.portals.map(({ key, children }) => (React.createElement(View, { key: key, collapsable: false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */, pointerEvents: "box-none", style: StyleSheet.absoluteFill }, children)));
28
31
  }
@@ -5,6 +5,15 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
5
5
  export default class ProgressBar extends Component {
6
6
  constructor(props) {
7
7
  super(props);
8
+ this.handleLayout = (event) => {
9
+ const { width = 150, onLayout } = this.props;
10
+ if (!width) {
11
+ this.setState({ width: event.nativeEvent.layout.width });
12
+ }
13
+ if (onLayout) {
14
+ onLayout(event);
15
+ }
16
+ };
8
17
  const { progress: progressP = 0, indeterminate = false } = props;
9
18
  const progress = Math.min(Math.max(progressP, 0), 1);
10
19
  this.state = {
@@ -50,15 +59,6 @@ export default class ProgressBar extends Component {
50
59
  }
51
60
  }
52
61
  }
53
- handleLayout = (event) => {
54
- const { width = 150, onLayout } = this.props;
55
- if (!width) {
56
- this.setState({ width: event.nativeEvent.layout.width });
57
- }
58
- if (onLayout) {
59
- onLayout(event);
60
- }
61
- };
62
62
  animate() {
63
63
  const { useNativeDriver = false, indeterminateAnimationDuration = 1000 } = this.props;
64
64
  this.state.animationValue.setValue(0);
@@ -7,10 +7,10 @@ const RadioButton = ({ Icon, disabled = false, color, value = "", selected, unse
7
7
  const { value: contextValue, onValueChange } = useRadioButtonGroupContext();
8
8
  const realValue = getValueForRadioButton(value);
9
9
  const realContextValue = getValueForRadioButton(contextValue);
10
- const isSelected = selected ?? realContextValue === realValue;
10
+ const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
11
11
  const handlePress = () => {
12
- onPress?.(realValue);
13
- onValueChange?.(realValue);
12
+ onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
13
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
14
14
  };
15
15
  return (React.createElement(IconButton, { Icon: Icon, icon: isSelected ? selectedIcon : unselectedIcon, color: isSelected ? color : unselectedColor, disabled: disabled, onPress: handlePress, size: size, style: style, ...rest }));
16
16
  };
@@ -20,7 +20,7 @@ const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueC
20
20
  const handleValueChange = (newValue) => {
21
21
  const realNewValue = getValueForRadioButton(newValue);
22
22
  setInternalValue(realNewValue);
23
- onValueChange?.(realNewValue);
23
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realNewValue);
24
24
  };
25
25
  const _containerStyle = [
26
26
  {
@@ -34,10 +34,10 @@ const RadioButtonRow = ({ Icon, label, value = "", color, unselectedColor, onPre
34
34
  const { value: contextValue, onValueChange, direction: parentDirection, } = useRadioButtonGroupContext();
35
35
  const realValue = getValueForRadioButton(value);
36
36
  const realContextValue = getValueForRadioButton(contextValue);
37
- const isSelected = selected ?? realContextValue === realValue;
37
+ const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
38
38
  const handlePress = () => {
39
- onPress?.(realValue);
40
- onValueChange?.(realValue);
39
+ onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
40
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
41
41
  };
42
42
  const { textStyles, viewStyles } = extractStyles(style);
43
43
  return (React.createElement(Touchable, { onPress: handlePress, style: [styles.mainParent, { flexDirection: direction }, viewStyles], disabled: disabled, ...rest },