@livetiles/reach-components-react 0.4.0-preview.310 → 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.
@@ -1035,6 +1035,7 @@ var en = {
1035
1035
  "Themes.contrast.rating": "Contrast Rating: {rating}",
1036
1036
  "Themes.contrast.pass": "good",
1037
1037
  "Themes.contrast.fail": "fail",
1038
+ "Themes.contrast.onWhite.info": "This is how the base color appears on a white background",
1038
1039
  "Themes.applyColors": "Apply",
1039
1040
  "Themes.baseColor.dark": "Base color",
1040
1041
  "Themes.accentColorToggle.label": "Use the highlight color for highlights on white background",
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.310";
87853
- var buildId = "100347";
87854
- var commitId = "4f8af46c9e999a60fe141419fd746312ae4b4d2c";
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,
@@ -131939,7 +131939,7 @@ $$a({target:'String',proto:true,forced:!MDN_POLYFILL_BUG$1&&!CORRECT_IS_REGEXP_L
131939
131939
  var _b=useState$2(false),didInitialFocus=_b[0],setDidInitialFocus=_b[1];var showEmojiButton=!env.isNativeMobileApp;var screenSize=useWindowSize$2();var inputPlaceholder=screenSize.width>maxScreenSize.medium?'PostMessage.inputPlaceholder':'PostMessage.inputPlaceholder.mobile';useImperativeHandle(ref,function(){return inputRef.current;},[inputRef]);useEffect$1(function(){if(autoFocus&&inputRef.current&&!didInitialFocus&&!disabled){// HACK: it seems as the react-mentions input does not like setting the focus
131940
131940
  // right away. Postpone it for a couple of ms
131941
131941
  // Unfortunately autoFocus={true} is not supported
131942
- setTimeout(function(){focusOnEnd(inputRef.current);setDidInitialFocus(true);});}},[inputRef,autoFocus,didInitialFocus,disabled]);return jsxs(Host$W,__assign({ref:hostRef,className:classNames('comment-input__host',className),"data-comment-input":true,"data-did-initial-focus":didInitialFocus,disableBoxShadow:disableBoxShadow},{children:[jsxs(InputContainer,{children:[jsx$1(MentionsInput$1,__assign({className:"comment-input",value:content,singleLine:false,allowSpaceInQuery:true,onKeyDown:handleKeyDown,onChange:function(event){return onChange(event.target.value);},placeholder:getPlaceholder(),disabled:disabled,inputRef:inputRef,allowSuggestionsAboveCursor:true,onFocus:onFocus,"aria-label":ariaLabel},{children:jsx$1(Mention$1,{trigger:"@",data:handleSearch,appendSpaceOnAdd:true,renderSuggestion:function(s){var userSuggestion=s;return jsx$1(Avatar,{upn:userSuggestion.upn,text:userSuggestion.displayName,secondaryText:userSuggestion.upn},s.id);}},void 0)}),void 0),additionalInputControl]},void 0),jsxs(Buttons$4,{children:[(buttons.leftSide||showEmojiButton)&&jsx$1(Fragment,{children:jsxs(LeftSide,{children:[buttons.leftSide,jsx$1(EmojiButton,{onEmojiSelected:handleAddEmoji,disabled:disabled},void 0)]},void 0)},void 0),buttons.rightSide&&jsx$1(RightSide,{children:buttons.rightSide},void 0)]},void 0)]}),void 0);function handleAddEmoji(emoji){var mentionMatches=__spreadArray([],Array.from(getAllMatches(content,mentionRegex)));var cursorPosition=getCorrectCursorPosition(inputRef.current.selectionStart,mentionMatches);var end=getCorrectCursorPosition(inputRef.current.selectionEnd,mentionMatches);var before=content.substring(0,cursorPosition);var after=content.substring(end);onChange(before+emoji+after);setTimeout(function(){inputRef.current.focus();inputRef.current.setSelectionRange(cursorPosition+2,cursorPosition+2);},0);}function getCorrectCursorPosition(cursorPosition,matches){// this method is required because for the user visible content in the textbox will look like this:
131942
+ setTimeout(function(){focusOnEnd(inputRef.current);setDidInitialFocus(true);});}},[inputRef,autoFocus,didInitialFocus,disabled]);return jsxs(Host$W,__assign({ref:hostRef,className:classNames('comment-input__host',className),"data-comment-input":true,"data-did-initial-focus":didInitialFocus,disableBoxShadow:disableBoxShadow},{children:[jsxs(InputContainer,{children:[jsx$1(MentionsInput$1,__assign({className:"comment-input",value:content,singleLine:false,allowSpaceInQuery:true,onKeyDown:handleKeyDown,onChange:function(event){return onChange(event.target.value);},placeholder:getPlaceholder(),disabled:disabled,inputRef:inputRef,allowSuggestionsAboveCursor:true,onFocus:onFocus,"aria-label":ariaLabel},{children:jsx$1(Mention$1,{trigger:"@",data:handleSearch,appendSpaceOnAdd:true,renderSuggestion:function(s){var userSuggestion=s;return jsx$1(Avatar,{upn:userSuggestion.upn,text:userSuggestion.displayName,secondaryText:userSuggestion.upn},s.id);}},void 0)}),void 0),additionalInputControl]},void 0),jsxs(Buttons$4,{children:[((buttons===null||buttons===void 0?void 0:buttons.leftSide)||showEmojiButton)&&jsx$1(Fragment,{children:jsxs(LeftSide,{children:[buttons===null||buttons===void 0?void 0:buttons.leftSide,jsx$1(EmojiButton,{onEmojiSelected:handleAddEmoji,disabled:disabled},void 0)]},void 0)},void 0),(buttons===null||buttons===void 0?void 0:buttons.rightSide)&&jsx$1(RightSide,{children:buttons.rightSide},void 0)]},void 0)]}),void 0);function handleAddEmoji(emoji){var mentionMatches=__spreadArray([],Array.from(getAllMatches(content,mentionRegex)));var cursorPosition=getCorrectCursorPosition(inputRef.current.selectionStart,mentionMatches);var end=getCorrectCursorPosition(inputRef.current.selectionEnd,mentionMatches);var before=content.substring(0,cursorPosition);var after=content.substring(end);onChange(before+emoji+after);setTimeout(function(){inputRef.current.focus();inputRef.current.setSelectionRange(cursorPosition+2,cursorPosition+2);},0);}function getCorrectCursorPosition(cursorPosition,matches){// this method is required because for the user visible content in the textbox will look like this:
131943
131943
  // hallo @Shimp Pansen how are you?
131944
131944
  // while the internal value looks like this:
131945
131945
  // hallo @[@Shimp Pansen](60a25c30cfc17a0c3b5f2d53) how are you?
@@ -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.310";
87709
- var buildId = "100347";
87710
- var commitId = "4f8af46c9e999a60fe141419fd746312ae4b4d2c";
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,
@@ -131811,7 +131811,7 @@
131811
131811
  var _b=React$d.useState(false),didInitialFocus=_b[0],setDidInitialFocus=_b[1];var showEmojiButton=!env.isNativeMobileApp;var screenSize=useWindowSize$2();var inputPlaceholder=screenSize.width>maxScreenSize.medium?'PostMessage.inputPlaceholder':'PostMessage.inputPlaceholder.mobile';React$d.useImperativeHandle(ref,function(){return inputRef.current;},[inputRef]);React$d.useEffect(function(){if(autoFocus&&inputRef.current&&!didInitialFocus&&!disabled){// HACK: it seems as the react-mentions input does not like setting the focus
131812
131812
  // right away. Postpone it for a couple of ms
131813
131813
  // Unfortunately autoFocus={true} is not supported
131814
- setTimeout(function(){focusOnEnd(inputRef.current);setDidInitialFocus(true);});}},[inputRef,autoFocus,didInitialFocus,disabled]);return jsxRuntime.jsxs(Host$W,__assign({ref:hostRef,className:classNames('comment-input__host',className),"data-comment-input":true,"data-did-initial-focus":didInitialFocus,disableBoxShadow:disableBoxShadow},{children:[jsxRuntime.jsxs(InputContainer,{children:[jsxRuntime.jsx(MentionsInput$1,__assign({className:"comment-input",value:content,singleLine:false,allowSpaceInQuery:true,onKeyDown:handleKeyDown,onChange:function(event){return onChange(event.target.value);},placeholder:getPlaceholder(),disabled:disabled,inputRef:inputRef,allowSuggestionsAboveCursor:true,onFocus:onFocus,"aria-label":ariaLabel},{children:jsxRuntime.jsx(Mention$1,{trigger:"@",data:handleSearch,appendSpaceOnAdd:true,renderSuggestion:function(s){var userSuggestion=s;return jsxRuntime.jsx(Avatar,{upn:userSuggestion.upn,text:userSuggestion.displayName,secondaryText:userSuggestion.upn},s.id);}},void 0)}),void 0),additionalInputControl]},void 0),jsxRuntime.jsxs(Buttons$4,{children:[(buttons.leftSide||showEmojiButton)&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(LeftSide,{children:[buttons.leftSide,jsxRuntime.jsx(EmojiButton,{onEmojiSelected:handleAddEmoji,disabled:disabled},void 0)]},void 0)},void 0),buttons.rightSide&&jsxRuntime.jsx(RightSide,{children:buttons.rightSide},void 0)]},void 0)]}),void 0);function handleAddEmoji(emoji){var mentionMatches=__spreadArray([],Array.from(getAllMatches(content,mentionRegex)));var cursorPosition=getCorrectCursorPosition(inputRef.current.selectionStart,mentionMatches);var end=getCorrectCursorPosition(inputRef.current.selectionEnd,mentionMatches);var before=content.substring(0,cursorPosition);var after=content.substring(end);onChange(before+emoji+after);setTimeout(function(){inputRef.current.focus();inputRef.current.setSelectionRange(cursorPosition+2,cursorPosition+2);},0);}function getCorrectCursorPosition(cursorPosition,matches){// this method is required because for the user visible content in the textbox will look like this:
131814
+ setTimeout(function(){focusOnEnd(inputRef.current);setDidInitialFocus(true);});}},[inputRef,autoFocus,didInitialFocus,disabled]);return jsxRuntime.jsxs(Host$W,__assign({ref:hostRef,className:classNames('comment-input__host',className),"data-comment-input":true,"data-did-initial-focus":didInitialFocus,disableBoxShadow:disableBoxShadow},{children:[jsxRuntime.jsxs(InputContainer,{children:[jsxRuntime.jsx(MentionsInput$1,__assign({className:"comment-input",value:content,singleLine:false,allowSpaceInQuery:true,onKeyDown:handleKeyDown,onChange:function(event){return onChange(event.target.value);},placeholder:getPlaceholder(),disabled:disabled,inputRef:inputRef,allowSuggestionsAboveCursor:true,onFocus:onFocus,"aria-label":ariaLabel},{children:jsxRuntime.jsx(Mention$1,{trigger:"@",data:handleSearch,appendSpaceOnAdd:true,renderSuggestion:function(s){var userSuggestion=s;return jsxRuntime.jsx(Avatar,{upn:userSuggestion.upn,text:userSuggestion.displayName,secondaryText:userSuggestion.upn},s.id);}},void 0)}),void 0),additionalInputControl]},void 0),jsxRuntime.jsxs(Buttons$4,{children:[((buttons===null||buttons===void 0?void 0:buttons.leftSide)||showEmojiButton)&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(LeftSide,{children:[buttons===null||buttons===void 0?void 0:buttons.leftSide,jsxRuntime.jsx(EmojiButton,{onEmojiSelected:handleAddEmoji,disabled:disabled},void 0)]},void 0)},void 0),(buttons===null||buttons===void 0?void 0:buttons.rightSide)&&jsxRuntime.jsx(RightSide,{children:buttons.rightSide},void 0)]},void 0)]}),void 0);function handleAddEmoji(emoji){var mentionMatches=__spreadArray([],Array.from(getAllMatches(content,mentionRegex)));var cursorPosition=getCorrectCursorPosition(inputRef.current.selectionStart,mentionMatches);var end=getCorrectCursorPosition(inputRef.current.selectionEnd,mentionMatches);var before=content.substring(0,cursorPosition);var after=content.substring(end);onChange(before+emoji+after);setTimeout(function(){inputRef.current.focus();inputRef.current.setSelectionRange(cursorPosition+2,cursorPosition+2);},0);}function getCorrectCursorPosition(cursorPosition,matches){// this method is required because for the user visible content in the textbox will look like this:
131815
131815
  // hallo @Shimp Pansen how are you?
131816
131816
  // while the internal value looks like this:
131817
131817
  // hallo @[@Shimp Pansen](60a25c30cfc17a0c3b5f2d53) how are you?
@@ -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
 
@@ -158729,6 +158771,7 @@
158729
158771
  "Themes.contrast.rating": "Contrast Rating: {rating}",
158730
158772
  "Themes.contrast.pass": "good",
158731
158773
  "Themes.contrast.fail": "fail",
158774
+ "Themes.contrast.onWhite.info": "This is how the base color appears on a white background",
158732
158775
  "Themes.applyColors": "Apply",
158733
158776
  "Themes.baseColor.dark": "Base color",
158734
158777
  "Themes.accentColorToggle.label": "Use the highlight color for highlights on white background",
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.310",
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",