@livetiles/reach-components-react 0.4.0-preview.312 → 0.4.0-preview.313

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 (3) hide show
  1. package/index.esm2.js +52 -10
  2. package/index.umd.js +52 -10
  3. package/package.json +1 -1
package/index.esm2.js CHANGED
@@ -87849,9 +87849,9 @@ var AuthenticationContextProvider = function AuthenticationContextProvider(_a) {
87849
87849
  }), void 0);
87850
87850
  };
87851
87851
 
87852
- var version$1 = "0.4.0-preview.312";
87853
- var buildId = "100367";
87854
- var commitId = "6ebc60836600173adb26d3000b167ceff44b7b9b";
87852
+ var version$1 = "0.4.0-preview.313";
87853
+ var buildId = "100376";
87854
+ var commitId = "916b802c1949cb2127b24368855e41b9dc4fafc1";
87855
87855
  var isCustomerBuild = false;
87856
87856
  var buildInfo = {
87857
87857
  version: version$1,
@@ -135699,9 +135699,11 @@ var ToolbarFilterPanel = function ToolbarFilterPanel(_a) {
135699
135699
  children = _a.children;
135700
135700
  var overflowContainerRef = useRef$1(null);
135701
135701
 
135702
- var _b = useState$2(false),
135703
- showScrollButtons = _b[0],
135704
- setShowScrollButtons = _b[1];
135702
+ var _b = useState$2({
135703
+ show: false
135704
+ }),
135705
+ scrollButtonsState = _b[0],
135706
+ setScrollButtonsState = _b[1];
135705
135707
 
135706
135708
  useEffect$1(function () {
135707
135709
  var observer = new ResizeObserver_2(handleResize);
@@ -135710,6 +135712,23 @@ var ToolbarFilterPanel = function ToolbarFilterPanel(_a) {
135710
135712
  return observer.disconnect();
135711
135713
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
135712
135714
  }, []);
135715
+ useEffect$1(function () {
135716
+ var scrollTimeout;
135717
+
135718
+ var scrollListener = function scrollListener() {
135719
+ clearTimeout(scrollTimeout);
135720
+ scrollTimeout = setTimeout(function () {
135721
+ setScrollButtonDisabledState();
135722
+ }, 100);
135723
+ };
135724
+
135725
+ overflowContainerRef.current.addEventListener('scroll', scrollListener);
135726
+ return function () {
135727
+ var _a;
135728
+
135729
+ return (_a = overflowContainerRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', scrollListener);
135730
+ };
135731
+ });
135713
135732
  return jsx$1(FilterContextProvider, __assign$g({
135714
135733
  filter: filter,
135715
135734
  onChange: onChange
@@ -135719,17 +135738,19 @@ var ToolbarFilterPanel = function ToolbarFilterPanel(_a) {
135719
135738
  ref: overflowContainerRef
135720
135739
  }, {
135721
135740
  children: children
135722
- }), void 0), showScrollButtons && jsxs(Fragment, {
135741
+ }), void 0), scrollButtonsState.show && jsxs(Fragment, {
135723
135742
  children: [jsx$1(ToolbarIconButton, {
135724
135743
  iconName: "ChevronLeft",
135725
135744
  onClick: function () {
135726
135745
  return handleScroll('left');
135727
- }
135746
+ },
135747
+ disabled: scrollButtonsState.disableLeft
135728
135748
  }, void 0), jsx$1(ToolbarIconButton, {
135729
135749
  iconName: "ChevronRight",
135730
135750
  onClick: function () {
135731
135751
  return handleScroll('right');
135732
- }
135752
+ },
135753
+ disabled: scrollButtonsState.disableRight
135733
135754
  }, void 0)]
135734
135755
  }, void 0)]
135735
135756
  }, void 0)
@@ -135798,7 +135819,28 @@ var ToolbarFilterPanel = function ToolbarFilterPanel(_a) {
135798
135819
  }
135799
135820
 
135800
135821
  function handleResize() {
135801
- setShowScrollButtons(overflowContainerRef.current.scrollWidth > overflowContainerRef.current.clientWidth);
135822
+ setScrollButtonsState({
135823
+ show: overflowContainerRef.current.scrollWidth > overflowContainerRef.current.clientWidth,
135824
+ disableLeft: isLeftScrollButtonDisabled(),
135825
+ disableRight: isRightScrollButtonDisabled()
135826
+ });
135827
+ }
135828
+
135829
+ function setScrollButtonDisabledState() {
135830
+ setScrollButtonsState(function (s) {
135831
+ return __assign$g(__assign$g({}, s), {
135832
+ disableLeft: isLeftScrollButtonDisabled(),
135833
+ disableRight: isRightScrollButtonDisabled()
135834
+ });
135835
+ });
135836
+ }
135837
+
135838
+ function isLeftScrollButtonDisabled() {
135839
+ return overflowContainerRef.current.scrollLeft === 0;
135840
+ }
135841
+
135842
+ function isRightScrollButtonDisabled() {
135843
+ return overflowContainerRef.current.scrollLeft + overflowContainerRef.current.clientWidth >= overflowContainerRef.current.scrollWidth;
135802
135844
  }
135803
135845
  };
135804
135846
 
package/index.umd.js CHANGED
@@ -87705,9 +87705,9 @@
87705
87705
  }), void 0);
87706
87706
  };
87707
87707
 
87708
- var version$1 = "0.4.0-preview.312";
87709
- var buildId = "100367";
87710
- var commitId = "6ebc60836600173adb26d3000b167ceff44b7b9b";
87708
+ var version$1 = "0.4.0-preview.313";
87709
+ var buildId = "100376";
87710
+ var commitId = "916b802c1949cb2127b24368855e41b9dc4fafc1";
87711
87711
  var isCustomerBuild = false;
87712
87712
  var buildInfo = {
87713
87713
  version: version$1,
@@ -135571,9 +135571,11 @@
135571
135571
  children = _a.children;
135572
135572
  var overflowContainerRef = React$d.useRef(null);
135573
135573
 
135574
- var _b = React$d.useState(false),
135575
- showScrollButtons = _b[0],
135576
- setShowScrollButtons = _b[1];
135574
+ var _b = React$d.useState({
135575
+ show: false
135576
+ }),
135577
+ scrollButtonsState = _b[0],
135578
+ setScrollButtonsState = _b[1];
135577
135579
 
135578
135580
  React$d.useEffect(function () {
135579
135581
  var observer = new ResizeObserver_2(handleResize);
@@ -135582,6 +135584,23 @@
135582
135584
  return observer.disconnect();
135583
135585
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
135584
135586
  }, []);
135587
+ React$d.useEffect(function () {
135588
+ var scrollTimeout;
135589
+
135590
+ var scrollListener = function scrollListener() {
135591
+ clearTimeout(scrollTimeout);
135592
+ scrollTimeout = setTimeout(function () {
135593
+ setScrollButtonDisabledState();
135594
+ }, 100);
135595
+ };
135596
+
135597
+ overflowContainerRef.current.addEventListener('scroll', scrollListener);
135598
+ return function () {
135599
+ var _a;
135600
+
135601
+ return (_a = overflowContainerRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', scrollListener);
135602
+ };
135603
+ });
135585
135604
  return jsxRuntime.jsx(FilterContextProvider, __assign$g({
135586
135605
  filter: filter,
135587
135606
  onChange: onChange
@@ -135591,17 +135610,19 @@
135591
135610
  ref: overflowContainerRef
135592
135611
  }, {
135593
135612
  children: children
135594
- }), void 0), showScrollButtons && jsxRuntime.jsxs(jsxRuntime.Fragment, {
135613
+ }), void 0), scrollButtonsState.show && jsxRuntime.jsxs(jsxRuntime.Fragment, {
135595
135614
  children: [jsxRuntime.jsx(ToolbarIconButton, {
135596
135615
  iconName: "ChevronLeft",
135597
135616
  onClick: function () {
135598
135617
  return handleScroll('left');
135599
- }
135618
+ },
135619
+ disabled: scrollButtonsState.disableLeft
135600
135620
  }, void 0), jsxRuntime.jsx(ToolbarIconButton, {
135601
135621
  iconName: "ChevronRight",
135602
135622
  onClick: function () {
135603
135623
  return handleScroll('right');
135604
- }
135624
+ },
135625
+ disabled: scrollButtonsState.disableRight
135605
135626
  }, void 0)]
135606
135627
  }, void 0)]
135607
135628
  }, void 0)
@@ -135670,7 +135691,28 @@
135670
135691
  }
135671
135692
 
135672
135693
  function handleResize() {
135673
- setShowScrollButtons(overflowContainerRef.current.scrollWidth > overflowContainerRef.current.clientWidth);
135694
+ setScrollButtonsState({
135695
+ show: overflowContainerRef.current.scrollWidth > overflowContainerRef.current.clientWidth,
135696
+ disableLeft: isLeftScrollButtonDisabled(),
135697
+ disableRight: isRightScrollButtonDisabled()
135698
+ });
135699
+ }
135700
+
135701
+ function setScrollButtonDisabledState() {
135702
+ setScrollButtonsState(function (s) {
135703
+ return __assign$g(__assign$g({}, s), {
135704
+ disableLeft: isLeftScrollButtonDisabled(),
135705
+ disableRight: isRightScrollButtonDisabled()
135706
+ });
135707
+ });
135708
+ }
135709
+
135710
+ function isLeftScrollButtonDisabled() {
135711
+ return overflowContainerRef.current.scrollLeft === 0;
135712
+ }
135713
+
135714
+ function isRightScrollButtonDisabled() {
135715
+ return overflowContainerRef.current.scrollLeft + overflowContainerRef.current.clientWidth >= overflowContainerRef.current.scrollWidth;
135674
135716
  }
135675
135717
  };
135676
135718
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@livetiles/reach-components-react",
3
3
  "description": "Provides React components to consume LiveTiles Reach data",
4
- "version": "0.4.0-preview.312",
4
+ "version": "0.4.0-preview.313",
5
5
  "peerDependencies": {
6
6
  "react": "^16.14.0 || ^17",
7
7
  "react-dom": "^16.14.0 || ^17",