@hero-design/rn 8.35.0-alpha.0 → 8.35.0-alpha.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.
@@ -4,5 +4,5 @@ $ rollup -c
4
4
  src/index.ts → lib/index.js, es/index.js...
5
5
  (!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
6
6
  (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/Volumes/Data/Projects/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
7
- created lib/index.js, es/index.js in 32.7s
7
+ created lib/index.js, es/index.js in 31s
8
8
  $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/es/index.js CHANGED
@@ -13432,10 +13432,17 @@ var FAB = /*#__PURE__*/forwardRef(function (_ref3, ref) {
13432
13432
  return /*#__PURE__*/React.createElement(StyledFAB$1
13433
13433
  /** Add a small timeout before executing animation to prevent flakiness */, {
13434
13434
  onLayout: function onLayout() {
13435
- return setTimeout(function () {
13435
+ setTimeout(function () {
13436
13436
  return setCanAnimate(true);
13437
13437
  }, 500);
13438
13438
  },
13439
+ ref: function ref(_ref4) {
13440
+ if (_ref4) {
13441
+ _ref4.measureInWindow(function (x, y, width, height) {
13442
+ console.log('measureInWindow', x, y, width, height);
13443
+ });
13444
+ }
13445
+ },
13439
13446
  underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
13440
13447
  onPress: onPress,
13441
13448
  style: [style, {
@@ -13563,136 +13570,6 @@ var StyledHeaderText = index$b(Typography.Title)(function (_ref3) {
13563
13570
  };
13564
13571
  });
13565
13572
 
13566
- var _excluded$d = ["style", "children"];
13567
- var FABModalPresenter = /*#__PURE__*/forwardRef(function (_ref2, ref) {
13568
- var style = _ref2.style,
13569
- children = _ref2.children,
13570
- props = _objectWithoutProperties(_ref2, _excluded$d);
13571
- var animatedOpacity = useRef(new Animated.Value(0));
13572
- React.useEffect(function () {
13573
- Animated.spring(animatedOpacity.current, {
13574
- toValue: 1,
13575
- useNativeDriver: true
13576
- }).start();
13577
- }, []);
13578
- React.useImperativeHandle(ref, function () {
13579
- return {
13580
- animatedOut: function animatedOut(completion) {
13581
- Animated.spring(animatedOpacity.current, {
13582
- toValue: 0,
13583
- useNativeDriver: true
13584
- }).start(function () {
13585
- completion === null || completion === void 0 ? void 0 : completion();
13586
- });
13587
- }
13588
- };
13589
- });
13590
- return /*#__PURE__*/React.createElement(Box, {
13591
- style: StyleSheet$1.absoluteFill,
13592
- pointerEvents: "box-none"
13593
- }, /*#__PURE__*/React.createElement(Animated.View, _extends$1({
13594
- style: [{
13595
- width: '100%',
13596
- height: '100%',
13597
- justifyContent: 'center',
13598
- alignItems: 'center',
13599
- opacity: animatedOpacity.current
13600
- }, style]
13601
- }, props, {
13602
- pointerEvents: "box-none"
13603
- }), children));
13604
- });
13605
- /**
13606
- * Present a modal on screen immediately.
13607
- *
13608
- * The new presented modal will be on top of existing modals if there are any.
13609
- *
13610
- * @param Content A component to be presented as a modal on screen.
13611
- * This component will be centered horizontally and vertically on screen with
13612
- * a semitransparent black overlay underneath.
13613
- * @param contentProps Props for this modal component.
13614
- * @returns A `ModalHandler` you can use to dismiss the modal.
13615
- */
13616
- var showFABModal = function showFABModal(content) {
13617
- var _ref3 = null;
13618
- var rootSiblings = null;
13619
- var dismiss = function dismiss(onDismiss) {
13620
- if (rootSiblings) {
13621
- var cleanup = function cleanup() {
13622
- var _rootSiblings;
13623
- (_rootSiblings = rootSiblings) === null || _rootSiblings === void 0 ? void 0 : _rootSiblings.destroy();
13624
- rootSiblings = null;
13625
- _ref3 = null;
13626
- onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
13627
- };
13628
- if (_ref3) {
13629
- _ref3.animatedOut(cleanup);
13630
- } else {
13631
- cleanup();
13632
- }
13633
- }
13634
- };
13635
- var update = function update(newContent) {
13636
- var _rootSiblings2;
13637
- (_rootSiblings2 = rootSiblings) === null || _rootSiblings2 === void 0 ? void 0 : _rootSiblings2.update( /*#__PURE__*/React.createElement(FABModalPresenter, {
13638
- ref: function ref(_ref) {
13639
- _ref3 = _ref;
13640
- }
13641
- }, newContent));
13642
- };
13643
- rootSiblings = new RootSiblings( /*#__PURE__*/React.createElement(FABModalPresenter, {
13644
- ref: function ref(_ref) {
13645
- _ref3 = _ref;
13646
- }
13647
- }, content));
13648
- return {
13649
- dismiss: dismiss,
13650
- update: update
13651
- };
13652
- };
13653
- FABModalPresenter.displayName = 'FABModalPresenter';
13654
-
13655
- var wrapperStyle$1 = {
13656
- width: Dimensions.get('window').width,
13657
- height: Dimensions.get('window').height
13658
- };
13659
- var fABModal = function fABModal(_ref) {
13660
- var children = _ref.children,
13661
- onShow = _ref.onShow,
13662
- testID = _ref.testID,
13663
- _ref$visible = _ref.visible,
13664
- visible = _ref$visible === void 0 ? true : _ref$visible;
13665
- var _React$useState = React.useState(),
13666
- _React$useState2 = _slicedToArray(_React$useState, 2),
13667
- modalHandler = _React$useState2[0],
13668
- setModalHandler = _React$useState2[1];
13669
- var getModalContent = React.useCallback(function () {
13670
- return /*#__PURE__*/React.createElement(View, {
13671
- pointerEvents: "box-none",
13672
- style: wrapperStyle$1,
13673
- testID: testID
13674
- }, children);
13675
- }, [visible, children, onShow, testID]);
13676
- React.useEffect(function () {
13677
- if (visible) {
13678
- // Modal does not exist, create a new one
13679
- if (!modalHandler) {
13680
- var newModalHandler = showFABModal(getModalContent());
13681
- setModalHandler(newModalHandler);
13682
- onShow === null || onShow === void 0 ? void 0 : onShow();
13683
- }
13684
- // Modal already exists, update it
13685
- else {
13686
- modalHandler.update(getModalContent());
13687
- }
13688
- } else {
13689
- modalHandler === null || modalHandler === void 0 ? void 0 : modalHandler.dismiss();
13690
- setModalHandler(undefined);
13691
- }
13692
- }, [getModalContent]);
13693
- return null;
13694
- };
13695
-
13696
13573
  var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13697
13574
  var headerTitle = _ref.headerTitle,
13698
13575
  onPress = _ref.onPress,
@@ -13743,7 +13620,7 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13743
13620
  inputRange: [0, 1],
13744
13621
  outputRange: [0, 1]
13745
13622
  });
13746
- return /*#__PURE__*/React.createElement(fABModal, null, /*#__PURE__*/React.createElement(StyledContainer$2, {
13623
+ return /*#__PURE__*/React.createElement(StyledContainer$2, {
13747
13624
  testID: testID,
13748
13625
  pointerEvents: "box-none",
13749
13626
  style: style
@@ -13787,7 +13664,7 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13787
13664
  active: active,
13788
13665
  title: fabTitle,
13789
13666
  ref: fabRef
13790
- })));
13667
+ }));
13791
13668
  });
13792
13669
  ActionGroup.displayName = 'FAB.ActionGroup';
13793
13670
 
@@ -14046,11 +13923,11 @@ var ModalProvider = function ModalProvider(_ref) {
14046
13923
  return /*#__PURE__*/React.createElement(RootSiblingParent, null, children);
14047
13924
  };
14048
13925
 
14049
- var _excluded$c = ["style", "children"];
13926
+ var _excluded$d = ["style", "children"];
14050
13927
  var ModalPresenter = /*#__PURE__*/forwardRef(function (_ref2, ref) {
14051
13928
  var style = _ref2.style,
14052
13929
  children = _ref2.children,
14053
- props = _objectWithoutProperties(_ref2, _excluded$c);
13930
+ props = _objectWithoutProperties(_ref2, _excluded$d);
14054
13931
  var animatedOpacity = useRef(new Animated.Value(0));
14055
13932
  var theme = useTheme();
14056
13933
  React.useEffect(function () {
@@ -14134,7 +14011,7 @@ var showModal = function showModal(content) {
14134
14011
  };
14135
14012
  ModalPresenter.displayName = 'ModalPresenter';
14136
14013
 
14137
- var wrapperStyle = {
14014
+ var wrapperStyle$1 = {
14138
14015
  width: Dimensions.get('window').width,
14139
14016
  height: Dimensions.get('window').height
14140
14017
  };
@@ -14155,11 +14032,11 @@ var Modal = function Modal(_ref) {
14155
14032
  var getModalContent = React.useCallback(function () {
14156
14033
  var isUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
14157
14034
  return animationType === 'none' ? /*#__PURE__*/React.createElement(View, {
14158
- style: wrapperStyle,
14035
+ style: wrapperStyle$1,
14159
14036
  testID: testID
14160
14037
  }, children) : /*#__PURE__*/React.createElement(ModalContentWrapper, {
14161
14038
  visible: visible,
14162
- style: wrapperStyle,
14039
+ style: wrapperStyle$1,
14163
14040
  animationType: animationType,
14164
14041
  testID: testID,
14165
14042
  onShow: onShow,
@@ -14508,7 +14385,7 @@ var StyledStrokeEnd = index$b(View)(function (_ref6) {
14508
14385
  };
14509
14386
  });
14510
14387
 
14511
- var _excluded$b = ["value", "renderValue", "intent", "style", "testID"];
14388
+ var _excluded$c = ["value", "renderValue", "intent", "style", "testID"];
14512
14389
  var HalfCircle = function HalfCircle(_ref) {
14513
14390
  var type = _ref.type,
14514
14391
  themeIntent = _ref.themeIntent;
@@ -14529,7 +14406,7 @@ var ProgressCircle = function ProgressCircle(_ref2) {
14529
14406
  intent = _ref2$intent === void 0 ? 'primary' : _ref2$intent,
14530
14407
  style = _ref2.style,
14531
14408
  testID = _ref2.testID,
14532
- nativeProps = _objectWithoutProperties(_ref2, _excluded$b);
14409
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$c);
14533
14410
  var theme = useTheme$1();
14534
14411
  var radius = theme.__hd__.progress.sizes.circleDiameter / 2;
14535
14412
  var progressAnimatedValue = useRef(new Animated.Value(0));
@@ -14644,14 +14521,14 @@ var StyledInner = index$b(Animated.View)(function (_ref2) {
14644
14521
  };
14645
14522
  });
14646
14523
 
14647
- var _excluded$a = ["value", "intent", "style", "testID"];
14524
+ var _excluded$b = ["value", "intent", "style", "testID"];
14648
14525
  var ProgressBar = function ProgressBar(_ref) {
14649
14526
  var value = _ref.value,
14650
14527
  _ref$intent = _ref.intent,
14651
14528
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14652
14529
  style = _ref.style,
14653
14530
  testID = _ref.testID,
14654
- nativeProps = _objectWithoutProperties(_ref, _excluded$a);
14531
+ nativeProps = _objectWithoutProperties(_ref, _excluded$b);
14655
14532
  var _useState = useState(0),
14656
14533
  _useState2 = _slicedToArray(_useState, 2),
14657
14534
  width = _useState2[0],
@@ -14842,14 +14719,14 @@ var AnimatedSpinner = function AnimatedSpinner(_ref) {
14842
14719
  }, dotProps))));
14843
14720
  };
14844
14721
 
14845
- var _excluded$9 = ["testID", "size", "intent"];
14722
+ var _excluded$a = ["testID", "size", "intent"];
14846
14723
  var Spinner = function Spinner(_ref) {
14847
14724
  var testID = _ref.testID,
14848
14725
  _ref$size = _ref.size,
14849
14726
  size = _ref$size === void 0 ? 'medium' : _ref$size,
14850
14727
  _ref$intent = _ref.intent,
14851
14728
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14852
- nativeProps = _objectWithoutProperties(_ref, _excluded$9);
14729
+ nativeProps = _objectWithoutProperties(_ref, _excluded$a);
14853
14730
  return /*#__PURE__*/React.createElement(StyledView$1, nativeProps, /*#__PURE__*/React.createElement(StyledSpinnerContainer, {
14854
14731
  testID: testID
14855
14732
  }, /*#__PURE__*/React.createElement(AnimatedSpinner, {
@@ -14882,7 +14759,7 @@ var SwipeableAction = function SwipeableAction(_ref) {
14882
14759
  }, children);
14883
14760
  };
14884
14761
 
14885
- var _excluded$8 = ["children", "state", "onStateChange", "leftActions", "leftActionsWidth", "rightActions", "rightActionsWidth"];
14762
+ var _excluded$9 = ["children", "state", "onStateChange", "leftActions", "leftActionsWidth", "rightActions", "rightActionsWidth"];
14886
14763
  var renderActions = function renderActions(actions, width, progress, direction) {
14887
14764
  var trans = progress.interpolate({
14888
14765
  inputRange: [0, 1],
@@ -14907,7 +14784,7 @@ var Swipeable = function Swipeable(_ref) {
14907
14784
  leftActionsWidth = _ref.leftActionsWidth,
14908
14785
  rightActions = _ref.rightActions,
14909
14786
  rightActionsWidth = _ref.rightActionsWidth,
14910
- swipeableProps = _objectWithoutProperties(_ref, _excluded$8);
14787
+ swipeableProps = _objectWithoutProperties(_ref, _excluded$9);
14911
14788
  var _useWindowDimensions = useWindowDimensions(),
14912
14789
  width = _useWindowDimensions.width;
14913
14790
  var swipeableRef = useRef(null);
@@ -15212,7 +15089,7 @@ var StyledSectionList = index$b(SectionList)(function (_ref4) {
15212
15089
  };
15213
15090
  });
15214
15091
 
15215
- var _excluded$7 = ["keyExtractor", "loading", "onEndReached", "onQueryChange", "sections", "renderItem", "sectionListRef"];
15092
+ var _excluded$8 = ["keyExtractor", "loading", "onEndReached", "onQueryChange", "sections", "renderItem", "sectionListRef"];
15216
15093
  var BaseOptionList = function BaseOptionList(_ref) {
15217
15094
  var keyExtractor = _ref.keyExtractor,
15218
15095
  loading = _ref.loading,
@@ -15221,7 +15098,7 @@ var BaseOptionList = function BaseOptionList(_ref) {
15221
15098
  sections = _ref.sections,
15222
15099
  renderItem = _ref.renderItem,
15223
15100
  sectionListRef = _ref.sectionListRef,
15224
- rest = _objectWithoutProperties(_ref, _excluded$7);
15101
+ rest = _objectWithoutProperties(_ref, _excluded$8);
15225
15102
  var theme = useTheme$1();
15226
15103
  var _useState = useState(false),
15227
15104
  _useState2 = _slicedToArray(_useState, 2),
@@ -15291,7 +15168,7 @@ var Option$2 = function Option(_ref) {
15291
15168
  return highlighted === true ? /*#__PURE__*/React.createElement(List.Item, props) : /*#__PURE__*/React.createElement(List.BasicItem, props);
15292
15169
  };
15293
15170
 
15294
- var _excluded$6 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15171
+ var _excluded$7 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15295
15172
  var OptionList$1 = function OptionList(_ref) {
15296
15173
  var keyExtractor = _ref.keyExtractor,
15297
15174
  loading = _ref.loading,
@@ -15302,7 +15179,7 @@ var OptionList$1 = function OptionList(_ref) {
15302
15179
  renderOption = _ref.renderOption,
15303
15180
  value = _ref.value,
15304
15181
  sectionListRef = _ref.sectionListRef,
15305
- rest = _objectWithoutProperties(_ref, _excluded$6);
15182
+ rest = _objectWithoutProperties(_ref, _excluded$7);
15306
15183
  var renderItem = function renderItem(info) {
15307
15184
  var item = info.item;
15308
15185
  var selected = value.includes(info.item.value);
@@ -15490,7 +15367,7 @@ var StyledOptionList = index$b(BaseOptionList)(function (_ref) {
15490
15367
  };
15491
15368
  });
15492
15369
 
15493
- var _excluded$5 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15370
+ var _excluded$6 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15494
15371
  var OptionList = function OptionList(_ref) {
15495
15372
  var keyExtractor = _ref.keyExtractor,
15496
15373
  loading = _ref.loading,
@@ -15501,7 +15378,7 @@ var OptionList = function OptionList(_ref) {
15501
15378
  renderOption = _ref.renderOption,
15502
15379
  value = _ref.value,
15503
15380
  sectionListRef = _ref.sectionListRef,
15504
- rest = _objectWithoutProperties(_ref, _excluded$5);
15381
+ rest = _objectWithoutProperties(_ref, _excluded$6);
15505
15382
  var renderItem = function renderItem(info) {
15506
15383
  var item = info.item;
15507
15384
  var selected = item.value === value;
@@ -15666,7 +15543,7 @@ var StyledGradientContainer = index$b(Box)(function (_ref2) {
15666
15543
  };
15667
15544
  });
15668
15545
 
15669
- var _excluded$4 = ["intent", "variant", "style", "onLayout"];
15546
+ var _excluded$5 = ["intent", "variant", "style", "onLayout"];
15670
15547
  var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
15671
15548
  var gradientPositions = {
15672
15549
  start: {
@@ -15698,7 +15575,7 @@ var Skeleton = function Skeleton(_ref) {
15698
15575
  variant = _ref$variant === void 0 ? 'rounded' : _ref$variant,
15699
15576
  style = _ref.style,
15700
15577
  onLayout = _ref.onLayout,
15701
- props = _objectWithoutProperties(_ref, _excluded$4);
15578
+ props = _objectWithoutProperties(_ref, _excluded$5);
15702
15579
  var theme = useTheme();
15703
15580
  var colors = useMemo(function () {
15704
15581
  return getGradientColors(theme, intent);
@@ -15830,7 +15707,7 @@ var StyledSuccessModal = index$b(Modal$1)({
15830
15707
  width: '100%'
15831
15708
  });
15832
15709
 
15833
- var _excluded$3 = ["variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
15710
+ var _excluded$4 = ["variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
15834
15711
  var renderImage = function renderImage(image) {
15835
15712
  if ( /*#__PURE__*/isValidElement(image)) {
15836
15713
  return /*#__PURE__*/React.cloneElement(image, {
@@ -15856,7 +15733,7 @@ var SuccessPage = function SuccessPage(_ref) {
15856
15733
  onCtaPress = _ref$onCtaPress === void 0 ? noop$1 : _ref$onCtaPress,
15857
15734
  secondaryCtaText = _ref.secondaryCtaText,
15858
15735
  onSecondaryCtaPress = _ref.onSecondaryCtaPress,
15859
- nativeProps = _objectWithoutProperties(_ref, _excluded$3);
15736
+ nativeProps = _objectWithoutProperties(_ref, _excluded$4);
15860
15737
  var showSecondaryButton = secondaryCtaText && onSecondaryCtaPress;
15861
15738
  return /*#__PURE__*/React.createElement(StyledSuccessContainer, _extends$1({
15862
15739
  testID: testID,
@@ -16746,7 +16623,7 @@ var StyledText = index$b(Typography.Caption)(function (_ref3) {
16746
16623
  };
16747
16624
  });
16748
16625
 
16749
- var _excluded$2 = ["content", "variant", "intent", "style", "testID"];
16626
+ var _excluded$3 = ["content", "variant", "intent", "style", "testID"];
16750
16627
  var Tag = function Tag(_ref) {
16751
16628
  var content = _ref.content,
16752
16629
  _ref$variant = _ref.variant,
@@ -16755,7 +16632,7 @@ var Tag = function Tag(_ref) {
16755
16632
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
16756
16633
  style = _ref.style,
16757
16634
  testID = _ref.testID,
16758
- nativeProps = _objectWithoutProperties(_ref, _excluded$2);
16635
+ nativeProps = _objectWithoutProperties(_ref, _excluded$3);
16759
16636
  return /*#__PURE__*/React.createElement(StyledView, _extends$1({}, nativeProps, {
16760
16637
  themeIntent: intent,
16761
16638
  themeVariant: variant,
@@ -17372,10 +17249,10 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
17372
17249
  }));
17373
17250
  };
17374
17251
 
17375
- var _excluded$1 = ["children"];
17252
+ var _excluded$2 = ["children"];
17376
17253
  var Toolbar = function Toolbar(_ref) {
17377
17254
  var children = _ref.children,
17378
- rest = _objectWithoutProperties(_ref, _excluded$1);
17255
+ rest = _objectWithoutProperties(_ref, _excluded$2);
17379
17256
  return /*#__PURE__*/React.createElement(ToolbarWrapper, rest, children);
17380
17257
  };
17381
17258
  var index$1 = Object.assign(Toolbar, {
@@ -17394,7 +17271,7 @@ var StyledIconWrapper = index$b(AnimatedBox)(function (_ref) {
17394
17271
  };
17395
17272
  });
17396
17273
 
17397
- var _excluded = ["options", "value", "onChange", "readonly", "disabled"];
17274
+ var _excluded$1 = ["options", "value", "onChange", "readonly", "disabled"];
17398
17275
  var Rate = function Rate(_ref) {
17399
17276
  var options = _ref.options,
17400
17277
  value = _ref.value,
@@ -17403,7 +17280,7 @@ var Rate = function Rate(_ref) {
17403
17280
  readonly = _ref$readonly === void 0 ? false : _ref$readonly,
17404
17281
  _ref$disabled = _ref.disabled,
17405
17282
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
17406
- otherProps = _objectWithoutProperties(_ref, _excluded);
17283
+ otherProps = _objectWithoutProperties(_ref, _excluded$1);
17407
17284
  var valueIndex = useMemo(function () {
17408
17285
  return options.findIndex(function (item) {
17409
17286
  return item.value === value;
@@ -33826,4 +33703,134 @@ var index = Object.assign(RichTextEditorWithRef, {
33826
33703
  Toolbar: EditorToolbar
33827
33704
  });
33828
33705
 
33829
- export { Accordion, Alert, Attachment, index$a as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, Card$1 as Card, index$9 as Carousel, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$8 as Drawer, Empty, Error$1 as Error, index$7 as FAB, Icon, Image, List, index$6 as Modal, PageControl, PinInput, Progress, CompoundRadio as Radio, Rate, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Skeleton, Slider, Spinner, Success, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };
33706
+ var _excluded = ["style", "children"];
33707
+ var FABModalPresenter = /*#__PURE__*/forwardRef(function (_ref2, ref) {
33708
+ var style = _ref2.style,
33709
+ children = _ref2.children,
33710
+ props = _objectWithoutProperties(_ref2, _excluded);
33711
+ var animatedOpacity = useRef(new Animated.Value(0));
33712
+ React.useEffect(function () {
33713
+ Animated.spring(animatedOpacity.current, {
33714
+ toValue: 1,
33715
+ useNativeDriver: true
33716
+ }).start();
33717
+ }, []);
33718
+ React.useImperativeHandle(ref, function () {
33719
+ return {
33720
+ animatedOut: function animatedOut(completion) {
33721
+ Animated.spring(animatedOpacity.current, {
33722
+ toValue: 0,
33723
+ useNativeDriver: true
33724
+ }).start(function () {
33725
+ completion === null || completion === void 0 ? void 0 : completion();
33726
+ });
33727
+ }
33728
+ };
33729
+ });
33730
+ return /*#__PURE__*/React.createElement(Box, {
33731
+ style: StyleSheet$1.absoluteFill,
33732
+ pointerEvents: "box-none"
33733
+ }, /*#__PURE__*/React.createElement(Animated.View, _extends$1({
33734
+ style: [{
33735
+ width: '100%',
33736
+ height: '100%',
33737
+ justifyContent: 'center',
33738
+ alignItems: 'center',
33739
+ opacity: animatedOpacity.current
33740
+ }, style]
33741
+ }, props, {
33742
+ pointerEvents: "box-none"
33743
+ }), children));
33744
+ });
33745
+ /**
33746
+ * Present a modal on screen immediately.
33747
+ *
33748
+ * The new presented modal will be on top of existing modals if there are any.
33749
+ *
33750
+ * @param Content A component to be presented as a modal on screen.
33751
+ * This component will be centered horizontally and vertically on screen with
33752
+ * a semitransparent black overlay underneath.
33753
+ * @param contentProps Props for this modal component.
33754
+ * @returns A `ModalHandler` you can use to dismiss the modal.
33755
+ */
33756
+ var showFABModal = function showFABModal(content) {
33757
+ var _ref3 = null;
33758
+ var rootSiblings = null;
33759
+ var dismiss = function dismiss(onDismiss) {
33760
+ if (rootSiblings) {
33761
+ var cleanup = function cleanup() {
33762
+ var _rootSiblings;
33763
+ (_rootSiblings = rootSiblings) === null || _rootSiblings === void 0 ? void 0 : _rootSiblings.destroy();
33764
+ rootSiblings = null;
33765
+ _ref3 = null;
33766
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
33767
+ };
33768
+ if (_ref3) {
33769
+ _ref3.animatedOut(cleanup);
33770
+ } else {
33771
+ cleanup();
33772
+ }
33773
+ }
33774
+ };
33775
+ var update = function update(newContent) {
33776
+ var _rootSiblings2;
33777
+ (_rootSiblings2 = rootSiblings) === null || _rootSiblings2 === void 0 ? void 0 : _rootSiblings2.update( /*#__PURE__*/React.createElement(FABModalPresenter, {
33778
+ ref: function ref(_ref) {
33779
+ _ref3 = _ref;
33780
+ }
33781
+ }, newContent));
33782
+ };
33783
+ rootSiblings = new RootSiblings( /*#__PURE__*/React.createElement(FABModalPresenter, {
33784
+ ref: function ref(_ref) {
33785
+ _ref3 = _ref;
33786
+ }
33787
+ }, content));
33788
+ return {
33789
+ dismiss: dismiss,
33790
+ update: update
33791
+ };
33792
+ };
33793
+ FABModalPresenter.displayName = 'FABModalPresenter';
33794
+
33795
+ var wrapperStyle = {
33796
+ width: Dimensions.get('window').width,
33797
+ height: Dimensions.get('window').height
33798
+ };
33799
+ var fABModal = function fABModal(_ref) {
33800
+ var children = _ref.children,
33801
+ onShow = _ref.onShow,
33802
+ testID = _ref.testID,
33803
+ _ref$visible = _ref.visible,
33804
+ visible = _ref$visible === void 0 ? true : _ref$visible;
33805
+ var _React$useState = React.useState(),
33806
+ _React$useState2 = _slicedToArray(_React$useState, 2),
33807
+ modalHandler = _React$useState2[0],
33808
+ setModalHandler = _React$useState2[1];
33809
+ var getModalContent = React.useCallback(function () {
33810
+ return /*#__PURE__*/React.createElement(View, {
33811
+ pointerEvents: "box-none",
33812
+ style: wrapperStyle,
33813
+ testID: testID
33814
+ }, children);
33815
+ }, [visible, children, onShow, testID]);
33816
+ React.useEffect(function () {
33817
+ if (visible) {
33818
+ // Modal does not exist, create a new one
33819
+ if (!modalHandler) {
33820
+ var newModalHandler = showFABModal(getModalContent());
33821
+ setModalHandler(newModalHandler);
33822
+ onShow === null || onShow === void 0 ? void 0 : onShow();
33823
+ }
33824
+ // Modal already exists, update it
33825
+ else {
33826
+ modalHandler.update(getModalContent());
33827
+ }
33828
+ } else {
33829
+ modalHandler === null || modalHandler === void 0 ? void 0 : modalHandler.dismiss();
33830
+ setModalHandler(undefined);
33831
+ }
33832
+ }, [getModalContent]);
33833
+ return null;
33834
+ };
33835
+
33836
+ export { Accordion, Alert, Attachment, index$a as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, Card$1 as Card, index$9 as Carousel, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$8 as Drawer, Empty, Error$1 as Error, index$7 as FAB, fABModal as FABModal, Icon, Image, List, index$6 as Modal, PageControl, PinInput, Progress, CompoundRadio as Radio, Rate, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Skeleton, Slider, Spinner, Success, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagDarkSystemPalette, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, withTheme, workSystemPalette };
package/lib/index.js CHANGED
@@ -13463,10 +13463,17 @@ var FAB = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
13463
13463
  return /*#__PURE__*/React__default["default"].createElement(StyledFAB$1
13464
13464
  /** Add a small timeout before executing animation to prevent flakiness */, {
13465
13465
  onLayout: function onLayout() {
13466
- return setTimeout(function () {
13466
+ setTimeout(function () {
13467
13467
  return setCanAnimate(true);
13468
13468
  }, 500);
13469
13469
  },
13470
+ ref: function ref(_ref4) {
13471
+ if (_ref4) {
13472
+ _ref4.measureInWindow(function (x, y, width, height) {
13473
+ console.log('measureInWindow', x, y, width, height);
13474
+ });
13475
+ }
13476
+ },
13470
13477
  underlayColor: theme.__hd__.fab.colors.buttonPressedBackground,
13471
13478
  onPress: onPress,
13472
13479
  style: [style, {
@@ -13594,136 +13601,6 @@ var StyledHeaderText = index$b(Typography.Title)(function (_ref3) {
13594
13601
  };
13595
13602
  });
13596
13603
 
13597
- var _excluded$d = ["style", "children"];
13598
- var FABModalPresenter = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13599
- var style = _ref2.style,
13600
- children = _ref2.children,
13601
- props = _objectWithoutProperties(_ref2, _excluded$d);
13602
- var animatedOpacity = React.useRef(new reactNative.Animated.Value(0));
13603
- React__default["default"].useEffect(function () {
13604
- reactNative.Animated.spring(animatedOpacity.current, {
13605
- toValue: 1,
13606
- useNativeDriver: true
13607
- }).start();
13608
- }, []);
13609
- React__default["default"].useImperativeHandle(ref, function () {
13610
- return {
13611
- animatedOut: function animatedOut(completion) {
13612
- reactNative.Animated.spring(animatedOpacity.current, {
13613
- toValue: 0,
13614
- useNativeDriver: true
13615
- }).start(function () {
13616
- completion === null || completion === void 0 ? void 0 : completion();
13617
- });
13618
- }
13619
- };
13620
- });
13621
- return /*#__PURE__*/React__default["default"].createElement(Box, {
13622
- style: reactNative.StyleSheet.absoluteFill,
13623
- pointerEvents: "box-none"
13624
- }, /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, _extends$1({
13625
- style: [{
13626
- width: '100%',
13627
- height: '100%',
13628
- justifyContent: 'center',
13629
- alignItems: 'center',
13630
- opacity: animatedOpacity.current
13631
- }, style]
13632
- }, props, {
13633
- pointerEvents: "box-none"
13634
- }), children));
13635
- });
13636
- /**
13637
- * Present a modal on screen immediately.
13638
- *
13639
- * The new presented modal will be on top of existing modals if there are any.
13640
- *
13641
- * @param Content A component to be presented as a modal on screen.
13642
- * This component will be centered horizontally and vertically on screen with
13643
- * a semitransparent black overlay underneath.
13644
- * @param contentProps Props for this modal component.
13645
- * @returns A `ModalHandler` you can use to dismiss the modal.
13646
- */
13647
- var showFABModal = function showFABModal(content) {
13648
- var _ref3 = null;
13649
- var rootSiblings = null;
13650
- var dismiss = function dismiss(onDismiss) {
13651
- if (rootSiblings) {
13652
- var cleanup = function cleanup() {
13653
- var _rootSiblings;
13654
- (_rootSiblings = rootSiblings) === null || _rootSiblings === void 0 ? void 0 : _rootSiblings.destroy();
13655
- rootSiblings = null;
13656
- _ref3 = null;
13657
- onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
13658
- };
13659
- if (_ref3) {
13660
- _ref3.animatedOut(cleanup);
13661
- } else {
13662
- cleanup();
13663
- }
13664
- }
13665
- };
13666
- var update = function update(newContent) {
13667
- var _rootSiblings2;
13668
- (_rootSiblings2 = rootSiblings) === null || _rootSiblings2 === void 0 ? void 0 : _rootSiblings2.update( /*#__PURE__*/React__default["default"].createElement(FABModalPresenter, {
13669
- ref: function ref(_ref) {
13670
- _ref3 = _ref;
13671
- }
13672
- }, newContent));
13673
- };
13674
- rootSiblings = new RootSiblings__default["default"]( /*#__PURE__*/React__default["default"].createElement(FABModalPresenter, {
13675
- ref: function ref(_ref) {
13676
- _ref3 = _ref;
13677
- }
13678
- }, content));
13679
- return {
13680
- dismiss: dismiss,
13681
- update: update
13682
- };
13683
- };
13684
- FABModalPresenter.displayName = 'FABModalPresenter';
13685
-
13686
- var wrapperStyle$1 = {
13687
- width: reactNative.Dimensions.get('window').width,
13688
- height: reactNative.Dimensions.get('window').height
13689
- };
13690
- var fABModal = function fABModal(_ref) {
13691
- var children = _ref.children,
13692
- onShow = _ref.onShow,
13693
- testID = _ref.testID,
13694
- _ref$visible = _ref.visible,
13695
- visible = _ref$visible === void 0 ? true : _ref$visible;
13696
- var _React$useState = React__default["default"].useState(),
13697
- _React$useState2 = _slicedToArray(_React$useState, 2),
13698
- modalHandler = _React$useState2[0],
13699
- setModalHandler = _React$useState2[1];
13700
- var getModalContent = React__default["default"].useCallback(function () {
13701
- return /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
13702
- pointerEvents: "box-none",
13703
- style: wrapperStyle$1,
13704
- testID: testID
13705
- }, children);
13706
- }, [visible, children, onShow, testID]);
13707
- React__default["default"].useEffect(function () {
13708
- if (visible) {
13709
- // Modal does not exist, create a new one
13710
- if (!modalHandler) {
13711
- var newModalHandler = showFABModal(getModalContent());
13712
- setModalHandler(newModalHandler);
13713
- onShow === null || onShow === void 0 ? void 0 : onShow();
13714
- }
13715
- // Modal already exists, update it
13716
- else {
13717
- modalHandler.update(getModalContent());
13718
- }
13719
- } else {
13720
- modalHandler === null || modalHandler === void 0 ? void 0 : modalHandler.dismiss();
13721
- setModalHandler(undefined);
13722
- }
13723
- }, [getModalContent]);
13724
- return null;
13725
- };
13726
-
13727
13604
  var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13728
13605
  var headerTitle = _ref.headerTitle,
13729
13606
  onPress = _ref.onPress,
@@ -13774,7 +13651,7 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13774
13651
  inputRange: [0, 1],
13775
13652
  outputRange: [0, 1]
13776
13653
  });
13777
- return /*#__PURE__*/React__default["default"].createElement(fABModal, null, /*#__PURE__*/React__default["default"].createElement(StyledContainer$2, {
13654
+ return /*#__PURE__*/React__default["default"].createElement(StyledContainer$2, {
13778
13655
  testID: testID,
13779
13656
  pointerEvents: "box-none",
13780
13657
  style: style
@@ -13818,7 +13695,7 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
13818
13695
  active: active,
13819
13696
  title: fabTitle,
13820
13697
  ref: fabRef
13821
- })));
13698
+ }));
13822
13699
  });
13823
13700
  ActionGroup.displayName = 'FAB.ActionGroup';
13824
13701
 
@@ -14077,11 +13954,11 @@ var ModalProvider = function ModalProvider(_ref) {
14077
13954
  return /*#__PURE__*/React__default["default"].createElement(RootSiblings.RootSiblingParent, null, children);
14078
13955
  };
14079
13956
 
14080
- var _excluded$c = ["style", "children"];
13957
+ var _excluded$d = ["style", "children"];
14081
13958
  var ModalPresenter = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
14082
13959
  var style = _ref2.style,
14083
13960
  children = _ref2.children,
14084
- props = _objectWithoutProperties(_ref2, _excluded$c);
13961
+ props = _objectWithoutProperties(_ref2, _excluded$d);
14085
13962
  var animatedOpacity = React.useRef(new reactNative.Animated.Value(0));
14086
13963
  var theme = useTheme();
14087
13964
  React__default["default"].useEffect(function () {
@@ -14165,7 +14042,7 @@ var showModal = function showModal(content) {
14165
14042
  };
14166
14043
  ModalPresenter.displayName = 'ModalPresenter';
14167
14044
 
14168
- var wrapperStyle = {
14045
+ var wrapperStyle$1 = {
14169
14046
  width: reactNative.Dimensions.get('window').width,
14170
14047
  height: reactNative.Dimensions.get('window').height
14171
14048
  };
@@ -14186,11 +14063,11 @@ var Modal = function Modal(_ref) {
14186
14063
  var getModalContent = React__default["default"].useCallback(function () {
14187
14064
  var isUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
14188
14065
  return animationType === 'none' ? /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
14189
- style: wrapperStyle,
14066
+ style: wrapperStyle$1,
14190
14067
  testID: testID
14191
14068
  }, children) : /*#__PURE__*/React__default["default"].createElement(ModalContentWrapper, {
14192
14069
  visible: visible,
14193
- style: wrapperStyle,
14070
+ style: wrapperStyle$1,
14194
14071
  animationType: animationType,
14195
14072
  testID: testID,
14196
14073
  onShow: onShow,
@@ -14539,7 +14416,7 @@ var StyledStrokeEnd = index$b(reactNative.View)(function (_ref6) {
14539
14416
  };
14540
14417
  });
14541
14418
 
14542
- var _excluded$b = ["value", "renderValue", "intent", "style", "testID"];
14419
+ var _excluded$c = ["value", "renderValue", "intent", "style", "testID"];
14543
14420
  var HalfCircle = function HalfCircle(_ref) {
14544
14421
  var type = _ref.type,
14545
14422
  themeIntent = _ref.themeIntent;
@@ -14560,7 +14437,7 @@ var ProgressCircle = function ProgressCircle(_ref2) {
14560
14437
  intent = _ref2$intent === void 0 ? 'primary' : _ref2$intent,
14561
14438
  style = _ref2.style,
14562
14439
  testID = _ref2.testID,
14563
- nativeProps = _objectWithoutProperties(_ref2, _excluded$b);
14440
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$c);
14564
14441
  var theme = useTheme$1();
14565
14442
  var radius = theme.__hd__.progress.sizes.circleDiameter / 2;
14566
14443
  var progressAnimatedValue = React.useRef(new reactNative.Animated.Value(0));
@@ -14675,14 +14552,14 @@ var StyledInner = index$b(reactNative.Animated.View)(function (_ref2) {
14675
14552
  };
14676
14553
  });
14677
14554
 
14678
- var _excluded$a = ["value", "intent", "style", "testID"];
14555
+ var _excluded$b = ["value", "intent", "style", "testID"];
14679
14556
  var ProgressBar = function ProgressBar(_ref) {
14680
14557
  var value = _ref.value,
14681
14558
  _ref$intent = _ref.intent,
14682
14559
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14683
14560
  style = _ref.style,
14684
14561
  testID = _ref.testID,
14685
- nativeProps = _objectWithoutProperties(_ref, _excluded$a);
14562
+ nativeProps = _objectWithoutProperties(_ref, _excluded$b);
14686
14563
  var _useState = React.useState(0),
14687
14564
  _useState2 = _slicedToArray(_useState, 2),
14688
14565
  width = _useState2[0],
@@ -14873,14 +14750,14 @@ var AnimatedSpinner = function AnimatedSpinner(_ref) {
14873
14750
  }, dotProps))));
14874
14751
  };
14875
14752
 
14876
- var _excluded$9 = ["testID", "size", "intent"];
14753
+ var _excluded$a = ["testID", "size", "intent"];
14877
14754
  var Spinner = function Spinner(_ref) {
14878
14755
  var testID = _ref.testID,
14879
14756
  _ref$size = _ref.size,
14880
14757
  size = _ref$size === void 0 ? 'medium' : _ref$size,
14881
14758
  _ref$intent = _ref.intent,
14882
14759
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14883
- nativeProps = _objectWithoutProperties(_ref, _excluded$9);
14760
+ nativeProps = _objectWithoutProperties(_ref, _excluded$a);
14884
14761
  return /*#__PURE__*/React__default["default"].createElement(StyledView$1, nativeProps, /*#__PURE__*/React__default["default"].createElement(StyledSpinnerContainer, {
14885
14762
  testID: testID
14886
14763
  }, /*#__PURE__*/React__default["default"].createElement(AnimatedSpinner, {
@@ -14913,7 +14790,7 @@ var SwipeableAction = function SwipeableAction(_ref) {
14913
14790
  }, children);
14914
14791
  };
14915
14792
 
14916
- var _excluded$8 = ["children", "state", "onStateChange", "leftActions", "leftActionsWidth", "rightActions", "rightActionsWidth"];
14793
+ var _excluded$9 = ["children", "state", "onStateChange", "leftActions", "leftActionsWidth", "rightActions", "rightActionsWidth"];
14917
14794
  var renderActions = function renderActions(actions, width, progress, direction) {
14918
14795
  var trans = progress.interpolate({
14919
14796
  inputRange: [0, 1],
@@ -14938,7 +14815,7 @@ var Swipeable = function Swipeable(_ref) {
14938
14815
  leftActionsWidth = _ref.leftActionsWidth,
14939
14816
  rightActions = _ref.rightActions,
14940
14817
  rightActionsWidth = _ref.rightActionsWidth,
14941
- swipeableProps = _objectWithoutProperties(_ref, _excluded$8);
14818
+ swipeableProps = _objectWithoutProperties(_ref, _excluded$9);
14942
14819
  var _useWindowDimensions = reactNative.useWindowDimensions(),
14943
14820
  width = _useWindowDimensions.width;
14944
14821
  var swipeableRef = React.useRef(null);
@@ -15243,7 +15120,7 @@ var StyledSectionList = index$b(reactNative.SectionList)(function (_ref4) {
15243
15120
  };
15244
15121
  });
15245
15122
 
15246
- var _excluded$7 = ["keyExtractor", "loading", "onEndReached", "onQueryChange", "sections", "renderItem", "sectionListRef"];
15123
+ var _excluded$8 = ["keyExtractor", "loading", "onEndReached", "onQueryChange", "sections", "renderItem", "sectionListRef"];
15247
15124
  var BaseOptionList = function BaseOptionList(_ref) {
15248
15125
  var keyExtractor = _ref.keyExtractor,
15249
15126
  loading = _ref.loading,
@@ -15252,7 +15129,7 @@ var BaseOptionList = function BaseOptionList(_ref) {
15252
15129
  sections = _ref.sections,
15253
15130
  renderItem = _ref.renderItem,
15254
15131
  sectionListRef = _ref.sectionListRef,
15255
- rest = _objectWithoutProperties(_ref, _excluded$7);
15132
+ rest = _objectWithoutProperties(_ref, _excluded$8);
15256
15133
  var theme = useTheme$1();
15257
15134
  var _useState = React.useState(false),
15258
15135
  _useState2 = _slicedToArray(_useState, 2),
@@ -15322,7 +15199,7 @@ var Option$2 = function Option(_ref) {
15322
15199
  return highlighted === true ? /*#__PURE__*/React__default["default"].createElement(List.Item, props) : /*#__PURE__*/React__default["default"].createElement(List.BasicItem, props);
15323
15200
  };
15324
15201
 
15325
- var _excluded$6 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15202
+ var _excluded$7 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15326
15203
  var OptionList$1 = function OptionList(_ref) {
15327
15204
  var keyExtractor = _ref.keyExtractor,
15328
15205
  loading = _ref.loading,
@@ -15333,7 +15210,7 @@ var OptionList$1 = function OptionList(_ref) {
15333
15210
  renderOption = _ref.renderOption,
15334
15211
  value = _ref.value,
15335
15212
  sectionListRef = _ref.sectionListRef,
15336
- rest = _objectWithoutProperties(_ref, _excluded$6);
15213
+ rest = _objectWithoutProperties(_ref, _excluded$7);
15337
15214
  var renderItem = function renderItem(info) {
15338
15215
  var item = info.item;
15339
15216
  var selected = value.includes(info.item.value);
@@ -15521,7 +15398,7 @@ var StyledOptionList = index$b(BaseOptionList)(function (_ref) {
15521
15398
  };
15522
15399
  });
15523
15400
 
15524
- var _excluded$5 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15401
+ var _excluded$6 = ["keyExtractor", "loading", "onEndReached", "onPress", "onQueryChange", "sections", "renderOption", "value", "sectionListRef"];
15525
15402
  var OptionList = function OptionList(_ref) {
15526
15403
  var keyExtractor = _ref.keyExtractor,
15527
15404
  loading = _ref.loading,
@@ -15532,7 +15409,7 @@ var OptionList = function OptionList(_ref) {
15532
15409
  renderOption = _ref.renderOption,
15533
15410
  value = _ref.value,
15534
15411
  sectionListRef = _ref.sectionListRef,
15535
- rest = _objectWithoutProperties(_ref, _excluded$5);
15412
+ rest = _objectWithoutProperties(_ref, _excluded$6);
15536
15413
  var renderItem = function renderItem(info) {
15537
15414
  var item = info.item;
15538
15415
  var selected = item.value === value;
@@ -15697,7 +15574,7 @@ var StyledGradientContainer = index$b(Box)(function (_ref2) {
15697
15574
  };
15698
15575
  });
15699
15576
 
15700
- var _excluded$4 = ["intent", "variant", "style", "onLayout"];
15577
+ var _excluded$5 = ["intent", "variant", "style", "onLayout"];
15701
15578
  var AnimatedLinearGradient = reactNative.Animated.createAnimatedComponent(LinearGradient__default["default"]);
15702
15579
  var gradientPositions = {
15703
15580
  start: {
@@ -15729,7 +15606,7 @@ var Skeleton = function Skeleton(_ref) {
15729
15606
  variant = _ref$variant === void 0 ? 'rounded' : _ref$variant,
15730
15607
  style = _ref.style,
15731
15608
  onLayout = _ref.onLayout,
15732
- props = _objectWithoutProperties(_ref, _excluded$4);
15609
+ props = _objectWithoutProperties(_ref, _excluded$5);
15733
15610
  var theme = useTheme();
15734
15611
  var colors = React.useMemo(function () {
15735
15612
  return getGradientColors(theme, intent);
@@ -15861,7 +15738,7 @@ var StyledSuccessModal = index$b(reactNative.Modal)({
15861
15738
  width: '100%'
15862
15739
  });
15863
15740
 
15864
- var _excluded$3 = ["variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
15741
+ var _excluded$4 = ["variant", "title", "description", "image", "testID", "ctaText", "onCtaPress", "secondaryCtaText", "onSecondaryCtaPress"];
15865
15742
  var renderImage = function renderImage(image) {
15866
15743
  if ( /*#__PURE__*/React.isValidElement(image)) {
15867
15744
  return /*#__PURE__*/React__default["default"].cloneElement(image, {
@@ -15887,7 +15764,7 @@ var SuccessPage = function SuccessPage(_ref) {
15887
15764
  onCtaPress = _ref$onCtaPress === void 0 ? noop$1 : _ref$onCtaPress,
15888
15765
  secondaryCtaText = _ref.secondaryCtaText,
15889
15766
  onSecondaryCtaPress = _ref.onSecondaryCtaPress,
15890
- nativeProps = _objectWithoutProperties(_ref, _excluded$3);
15767
+ nativeProps = _objectWithoutProperties(_ref, _excluded$4);
15891
15768
  var showSecondaryButton = secondaryCtaText && onSecondaryCtaPress;
15892
15769
  return /*#__PURE__*/React__default["default"].createElement(StyledSuccessContainer, _extends$1({
15893
15770
  testID: testID,
@@ -16777,7 +16654,7 @@ var StyledText = index$b(Typography.Caption)(function (_ref3) {
16777
16654
  };
16778
16655
  });
16779
16656
 
16780
- var _excluded$2 = ["content", "variant", "intent", "style", "testID"];
16657
+ var _excluded$3 = ["content", "variant", "intent", "style", "testID"];
16781
16658
  var Tag = function Tag(_ref) {
16782
16659
  var content = _ref.content,
16783
16660
  _ref$variant = _ref.variant,
@@ -16786,7 +16663,7 @@ var Tag = function Tag(_ref) {
16786
16663
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
16787
16664
  style = _ref.style,
16788
16665
  testID = _ref.testID,
16789
- nativeProps = _objectWithoutProperties(_ref, _excluded$2);
16666
+ nativeProps = _objectWithoutProperties(_ref, _excluded$3);
16790
16667
  return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({}, nativeProps, {
16791
16668
  themeIntent: intent,
16792
16669
  themeVariant: variant,
@@ -17403,10 +17280,10 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
17403
17280
  }));
17404
17281
  };
17405
17282
 
17406
- var _excluded$1 = ["children"];
17283
+ var _excluded$2 = ["children"];
17407
17284
  var Toolbar = function Toolbar(_ref) {
17408
17285
  var children = _ref.children,
17409
- rest = _objectWithoutProperties(_ref, _excluded$1);
17286
+ rest = _objectWithoutProperties(_ref, _excluded$2);
17410
17287
  return /*#__PURE__*/React__default["default"].createElement(ToolbarWrapper, rest, children);
17411
17288
  };
17412
17289
  var index$1 = Object.assign(Toolbar, {
@@ -17425,7 +17302,7 @@ var StyledIconWrapper = index$b(AnimatedBox)(function (_ref) {
17425
17302
  };
17426
17303
  });
17427
17304
 
17428
- var _excluded = ["options", "value", "onChange", "readonly", "disabled"];
17305
+ var _excluded$1 = ["options", "value", "onChange", "readonly", "disabled"];
17429
17306
  var Rate = function Rate(_ref) {
17430
17307
  var options = _ref.options,
17431
17308
  value = _ref.value,
@@ -17434,7 +17311,7 @@ var Rate = function Rate(_ref) {
17434
17311
  readonly = _ref$readonly === void 0 ? false : _ref$readonly,
17435
17312
  _ref$disabled = _ref.disabled,
17436
17313
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
17437
- otherProps = _objectWithoutProperties(_ref, _excluded);
17314
+ otherProps = _objectWithoutProperties(_ref, _excluded$1);
17438
17315
  var valueIndex = React.useMemo(function () {
17439
17316
  return options.findIndex(function (item) {
17440
17317
  return item.value === value;
@@ -33857,6 +33734,136 @@ var index = Object.assign(RichTextEditorWithRef, {
33857
33734
  Toolbar: EditorToolbar
33858
33735
  });
33859
33736
 
33737
+ var _excluded = ["style", "children"];
33738
+ var FABModalPresenter = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
33739
+ var style = _ref2.style,
33740
+ children = _ref2.children,
33741
+ props = _objectWithoutProperties(_ref2, _excluded);
33742
+ var animatedOpacity = React.useRef(new reactNative.Animated.Value(0));
33743
+ React__default["default"].useEffect(function () {
33744
+ reactNative.Animated.spring(animatedOpacity.current, {
33745
+ toValue: 1,
33746
+ useNativeDriver: true
33747
+ }).start();
33748
+ }, []);
33749
+ React__default["default"].useImperativeHandle(ref, function () {
33750
+ return {
33751
+ animatedOut: function animatedOut(completion) {
33752
+ reactNative.Animated.spring(animatedOpacity.current, {
33753
+ toValue: 0,
33754
+ useNativeDriver: true
33755
+ }).start(function () {
33756
+ completion === null || completion === void 0 ? void 0 : completion();
33757
+ });
33758
+ }
33759
+ };
33760
+ });
33761
+ return /*#__PURE__*/React__default["default"].createElement(Box, {
33762
+ style: reactNative.StyleSheet.absoluteFill,
33763
+ pointerEvents: "box-none"
33764
+ }, /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, _extends$1({
33765
+ style: [{
33766
+ width: '100%',
33767
+ height: '100%',
33768
+ justifyContent: 'center',
33769
+ alignItems: 'center',
33770
+ opacity: animatedOpacity.current
33771
+ }, style]
33772
+ }, props, {
33773
+ pointerEvents: "box-none"
33774
+ }), children));
33775
+ });
33776
+ /**
33777
+ * Present a modal on screen immediately.
33778
+ *
33779
+ * The new presented modal will be on top of existing modals if there are any.
33780
+ *
33781
+ * @param Content A component to be presented as a modal on screen.
33782
+ * This component will be centered horizontally and vertically on screen with
33783
+ * a semitransparent black overlay underneath.
33784
+ * @param contentProps Props for this modal component.
33785
+ * @returns A `ModalHandler` you can use to dismiss the modal.
33786
+ */
33787
+ var showFABModal = function showFABModal(content) {
33788
+ var _ref3 = null;
33789
+ var rootSiblings = null;
33790
+ var dismiss = function dismiss(onDismiss) {
33791
+ if (rootSiblings) {
33792
+ var cleanup = function cleanup() {
33793
+ var _rootSiblings;
33794
+ (_rootSiblings = rootSiblings) === null || _rootSiblings === void 0 ? void 0 : _rootSiblings.destroy();
33795
+ rootSiblings = null;
33796
+ _ref3 = null;
33797
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
33798
+ };
33799
+ if (_ref3) {
33800
+ _ref3.animatedOut(cleanup);
33801
+ } else {
33802
+ cleanup();
33803
+ }
33804
+ }
33805
+ };
33806
+ var update = function update(newContent) {
33807
+ var _rootSiblings2;
33808
+ (_rootSiblings2 = rootSiblings) === null || _rootSiblings2 === void 0 ? void 0 : _rootSiblings2.update( /*#__PURE__*/React__default["default"].createElement(FABModalPresenter, {
33809
+ ref: function ref(_ref) {
33810
+ _ref3 = _ref;
33811
+ }
33812
+ }, newContent));
33813
+ };
33814
+ rootSiblings = new RootSiblings__default["default"]( /*#__PURE__*/React__default["default"].createElement(FABModalPresenter, {
33815
+ ref: function ref(_ref) {
33816
+ _ref3 = _ref;
33817
+ }
33818
+ }, content));
33819
+ return {
33820
+ dismiss: dismiss,
33821
+ update: update
33822
+ };
33823
+ };
33824
+ FABModalPresenter.displayName = 'FABModalPresenter';
33825
+
33826
+ var wrapperStyle = {
33827
+ width: reactNative.Dimensions.get('window').width,
33828
+ height: reactNative.Dimensions.get('window').height
33829
+ };
33830
+ var fABModal = function fABModal(_ref) {
33831
+ var children = _ref.children,
33832
+ onShow = _ref.onShow,
33833
+ testID = _ref.testID,
33834
+ _ref$visible = _ref.visible,
33835
+ visible = _ref$visible === void 0 ? true : _ref$visible;
33836
+ var _React$useState = React__default["default"].useState(),
33837
+ _React$useState2 = _slicedToArray(_React$useState, 2),
33838
+ modalHandler = _React$useState2[0],
33839
+ setModalHandler = _React$useState2[1];
33840
+ var getModalContent = React__default["default"].useCallback(function () {
33841
+ return /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
33842
+ pointerEvents: "box-none",
33843
+ style: wrapperStyle,
33844
+ testID: testID
33845
+ }, children);
33846
+ }, [visible, children, onShow, testID]);
33847
+ React__default["default"].useEffect(function () {
33848
+ if (visible) {
33849
+ // Modal does not exist, create a new one
33850
+ if (!modalHandler) {
33851
+ var newModalHandler = showFABModal(getModalContent());
33852
+ setModalHandler(newModalHandler);
33853
+ onShow === null || onShow === void 0 ? void 0 : onShow();
33854
+ }
33855
+ // Modal already exists, update it
33856
+ else {
33857
+ modalHandler.update(getModalContent());
33858
+ }
33859
+ } else {
33860
+ modalHandler === null || modalHandler === void 0 ? void 0 : modalHandler.dismiss();
33861
+ setModalHandler(undefined);
33862
+ }
33863
+ }, [getModalContent]);
33864
+ return null;
33865
+ };
33866
+
33860
33867
  exports.Accordion = Accordion;
33861
33868
  exports.Alert = Alert;
33862
33869
  exports.Attachment = Attachment;
@@ -33878,6 +33885,7 @@ exports.Drawer = index$8;
33878
33885
  exports.Empty = Empty;
33879
33886
  exports.Error = Error$1;
33880
33887
  exports.FAB = index$7;
33888
+ exports.FABModal = fABModal;
33881
33889
  exports.Icon = Icon;
33882
33890
  exports.Image = Image;
33883
33891
  exports.List = List;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.35.0-alpha.0",
3
+ "version": "8.35.0-alpha.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,6 +1,6 @@
1
1
  import React, { forwardRef, useRef } from 'react';
2
2
  import type { StyleProp, ViewStyle } from 'react-native';
3
- import { Animated, Platform } from 'react-native';
3
+ import { Animated, Modal, Platform } from 'react-native';
4
4
  import type { IconName } from '../../Icon';
5
5
  import type { ActionItemProps } from './ActionItem';
6
6
  import ActionItem from './ActionItem';
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  import Box from '../../Box';
16
16
  import { FABHandles } from '../FAB';
17
- import FABModal from './FABModal';
17
+ import { FABModal } from '../../..';
18
18
 
19
19
  export type ActionGroupHandles = {
20
20
  showFAB: () => void;
@@ -124,53 +124,71 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
124
124
  });
125
125
 
126
126
  return (
127
- <FABModal>
128
- <StyledContainer testID={testID} pointerEvents="box-none" style={style}>
129
- <StyledBackdrop
130
- pointerEvents={active ? 'auto' : 'box-none'}
131
- testID="back-drop"
132
- style={{ opacity: interpolatedBackdropOpacityAnimation }}
133
- />
134
- <StyledActionGroupContainer
135
- pointerEvents={active ? 'auto' : 'none'}
136
- testID="action-group"
137
- style={{
138
- opacity: interpolatedActionGroupOpacityAnimation,
139
- }}
127
+ <StyledContainer testID={testID} pointerEvents="box-none" style={style}>
128
+ <FABModal visible={active}>
129
+ <StyledContainer
130
+ testID={testID}
131
+ pointerEvents="box-none"
132
+ style={style}
140
133
  >
141
- {!!headerTitle && (
142
- <Animated.View
143
- style={{ transform: [{ translateY: titleTranslateY }] }}
144
- >
145
- <StyledHeaderText testID="header-text" level="h4">
146
- {headerTitle}
147
- </StyledHeaderText>
148
- </Animated.View>
149
- )}
150
-
151
- <Box style={[style, { paddingBottom: 0 }]}>
152
- {items?.map((itemProp, index) => (
153
- <ActionItem
154
- key={itemProp.key || `${itemProp.icon}_${itemProp.title}`}
155
- {...itemProp}
156
- index={active ? index : items.length - index}
157
- active={active}
158
- />
159
- ))}
160
- </Box>
161
- </StyledActionGroupContainer>
162
-
163
- <StyledFAB
164
- testID="fab"
165
- icon={fabIcon}
166
- onPress={onPress}
167
- animated
168
- active={active}
169
- title={fabTitle}
170
- ref={fabRef}
171
- />
172
- </StyledContainer>
173
- </FABModal>
134
+ <StyledBackdrop
135
+ pointerEvents={active ? 'auto' : 'box-none'}
136
+ testID="back-drop"
137
+ style={{
138
+ opacity: interpolatedBackdropOpacityAnimation,
139
+ backgroundColor: 'yellow',
140
+ }}
141
+ />
142
+ <StyledActionGroupContainer
143
+ pointerEvents={active ? 'auto' : 'none'}
144
+ testID="action-group"
145
+ style={{
146
+ opacity: interpolatedActionGroupOpacityAnimation,
147
+ flex: 1,
148
+ }}
149
+ >
150
+ {!!headerTitle && (
151
+ <Animated.View
152
+ style={{ transform: [{ translateY: titleTranslateY }] }}
153
+ >
154
+ <StyledHeaderText testID="header-text" level="h4">
155
+ {headerTitle}
156
+ </StyledHeaderText>
157
+ </Animated.View>
158
+ )}
159
+
160
+ <Box style={[style, { paddingBottom: 0 }]}>
161
+ {items?.map((itemProp, index) => (
162
+ <ActionItem
163
+ key={itemProp.key || `${itemProp.icon}_${itemProp.title}`}
164
+ {...itemProp}
165
+ index={active ? index : items.length - index}
166
+ active={active}
167
+ />
168
+ ))}
169
+ </Box>
170
+ </StyledActionGroupContainer>
171
+ <StyledFAB
172
+ testID="fab"
173
+ icon={fabIcon}
174
+ onPress={onPress}
175
+ animated
176
+ active={active}
177
+ title={fabTitle}
178
+ ref={fabRef}
179
+ />
180
+ </StyledContainer>
181
+ </FABModal>
182
+ <StyledFAB
183
+ testID="fab"
184
+ icon={fabIcon}
185
+ onPress={onPress}
186
+ animated
187
+ active={active}
188
+ title={fabTitle}
189
+ ref={fabRef}
190
+ />
191
+ </StyledContainer>
174
192
  );
175
193
  }
176
194
  );
@@ -163,7 +163,16 @@ const FAB = forwardRef<FABHandles, FABProps>(
163
163
  return (
164
164
  <StyledFAB
165
165
  /** Add a small timeout before executing animation to prevent flakiness */
166
- onLayout={() => setTimeout(() => setCanAnimate(true), 500)}
166
+ onLayout={() => {
167
+ setTimeout(() => setCanAnimate(true), 500);
168
+ }}
169
+ ref={(ref) => {
170
+ if (ref) {
171
+ ref.measureInWindow((x, y, width, height) => {
172
+ console.log('measureInWindow', x, y, width, height);
173
+ });
174
+ }
175
+ }}
167
176
  underlayColor={theme.__hd__.fab.colors.buttonPressedBackground}
168
177
  onPress={onPress}
169
178
  style={[
package/src/index.ts CHANGED
@@ -60,6 +60,7 @@ import Rate from './components/Rate';
60
60
  import RefreshControl from './components/RefreshControl';
61
61
  import RichTextEditor from './components/RichTextEditor';
62
62
  import PageControl from './components/PageControl';
63
+ import FABModal from './components/FAB/ActionGroup/FABModal';
63
64
 
64
65
  export {
65
66
  theme,
@@ -123,6 +124,7 @@ export {
123
124
  Rate,
124
125
  RefreshControl,
125
126
  RichTextEditor,
127
+ FABModal,
126
128
  };
127
129
 
128
130
  export * from './types';
package/types/index.d.ts CHANGED
@@ -47,5 +47,6 @@ import Rate from './components/Rate';
47
47
  import RefreshControl from './components/RefreshControl';
48
48
  import RichTextEditor from './components/RichTextEditor';
49
49
  import PageControl from './components/PageControl';
50
- export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, Icon, Image, List, Modal, PinInput, Progress, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, Rate, RefreshControl, RichTextEditor, };
50
+ import FABModal from './components/FAB/ActionGroup/FABModal';
51
+ export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, Accordion, Alert, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, Icon, Image, List, Modal, PinInput, Progress, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, SectionHeading, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, Rate, RefreshControl, RichTextEditor, FABModal, };
51
52
  export * from './types';