@livetiles/reach-components-react 0.4.0-preview.225 → 0.4.0-preview.226
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.
- package/index.esm2.js +48 -51
- package/index.umd.js +48 -51
- package/package.json +1 -1
package/index.esm2.js
CHANGED
|
@@ -87469,9 +87469,9 @@ var AuthenticationContextProvider = function AuthenticationContextProvider(_a) {
|
|
|
87469
87469
|
}), void 0);
|
|
87470
87470
|
};
|
|
87471
87471
|
|
|
87472
|
-
var version$1 = "0.4.0-preview.
|
|
87473
|
-
var buildId = "
|
|
87474
|
-
var commitId = "
|
|
87472
|
+
var version$1 = "0.4.0-preview.226";
|
|
87473
|
+
var buildId = "98723";
|
|
87474
|
+
var commitId = "d4ffc6f3cefd0299aae5b9ab8b63fad6ff105570";
|
|
87475
87475
|
var isCustomerBuild = false;
|
|
87476
87476
|
var buildInfo = {
|
|
87477
87477
|
version: version$1,
|
|
@@ -133982,63 +133982,43 @@ var HeroPaging = function HeroPaging(_a) {
|
|
|
133982
133982
|
goToSlide = _a.goToSlide,
|
|
133983
133983
|
currentSlide = _a.currentSlide,
|
|
133984
133984
|
frameWidth = _a.frameWidth,
|
|
133985
|
-
slideCount = _a.slideCount,
|
|
133986
133985
|
autoplay = _a.autoplay,
|
|
133987
133986
|
className = _a.className;
|
|
133988
133987
|
var user = useCurrentUserContext().user;
|
|
133989
133988
|
var formatMessage = useIntl().formatMessage;
|
|
133990
133989
|
var palette = useContext(ThemeContext$1).theme.palette;
|
|
133990
|
+
var containerWidth = frameWidth - 60; // margins are extracted
|
|
133991
133991
|
|
|
133992
|
-
var
|
|
133993
|
-
showArrows = _b[0],
|
|
133994
|
-
setShowArrows = _b[1];
|
|
133995
|
-
|
|
133996
|
-
var _c = useState$2(0),
|
|
133997
|
-
startIndex = _c[0],
|
|
133998
|
-
setStartIndex = _c[1];
|
|
133992
|
+
var maxVisibleItems = Math.floor(containerWidth / 150); // 150 - min-width + gap
|
|
133999
133993
|
|
|
134000
|
-
var
|
|
134001
|
-
|
|
134002
|
-
|
|
133994
|
+
var hasOverflow = items.length > maxVisibleItems;
|
|
133995
|
+
var visibleItemsCount = hasOverflow ? maxVisibleItems : items.length;
|
|
133996
|
+
var showArrows = hasOverflow;
|
|
134003
133997
|
|
|
134004
|
-
|
|
134005
|
-
|
|
134006
|
-
|
|
134007
|
-
var maxNumberOfItems = Math.floor(containerWidth / 150); // 150 - min-width + gap
|
|
133998
|
+
var _b = useState$2(0),
|
|
133999
|
+
startIndex = _b[0],
|
|
134000
|
+
setStartIndex = _b[1]; // reset the active slide - ensure the first slide is active when resizing
|
|
134008
134001
|
|
|
134009
|
-
setVisibleItemsLength(maxNumberOfItems);
|
|
134010
|
-
setShowArrows(maxNumberOfItems < slideCount); // reset the active slide - ensure the first slide is active when resizing
|
|
134011
134002
|
|
|
134012
|
-
|
|
134003
|
+
useEffect$1(function () {
|
|
134004
|
+
return showItemsStartingAtIndex(0);
|
|
134013
134005
|
}, [frameWidth]);
|
|
134014
134006
|
useEffect$1(function () {
|
|
134015
134007
|
if (!autoplay || !showArrows) {
|
|
134016
134008
|
return;
|
|
134017
|
-
} //
|
|
134018
|
-
|
|
134009
|
+
} // update the visible paging buttons when currentSlide's paging button is outside the visible area
|
|
134019
134010
|
|
|
134020
|
-
if (currentSlide === 0 && startIndex > 0) {
|
|
134021
|
-
reset();
|
|
134022
|
-
return;
|
|
134023
|
-
} // update the visible paging buttons when currenSlide has the corresponding paging button outside of the visible area
|
|
134024
134011
|
|
|
134025
|
-
|
|
134026
|
-
|
|
134027
|
-
handleVisiblePagingItems(startIndex + visibleItemsLength);
|
|
134012
|
+
if (currentSlide === startIndex + visibleItemsCount) {
|
|
134013
|
+
showItemsStartingAtIndex(startIndex + visibleItemsCount);
|
|
134028
134014
|
}
|
|
134029
|
-
}, [currentSlide, autoplay
|
|
134030
|
-
var pagingItems = items.map(function (i) {
|
|
134031
|
-
return {
|
|
134032
|
-
title: getTitle(i.item, user, formatMessage),
|
|
134033
|
-
id: i.item.id
|
|
134034
|
-
};
|
|
134035
|
-
});
|
|
134015
|
+
}, [currentSlide, autoplay]);
|
|
134036
134016
|
var pagingColor = items[currentSlide].item.bannerInfo ? palette.white : palette.black;
|
|
134037
134017
|
var currentSlideId = items[currentSlide].item.id;
|
|
134038
134018
|
return jsxs(PagingHost, __assign$g({
|
|
134039
134019
|
className: className
|
|
134040
134020
|
}, {
|
|
134041
|
-
children: [showArrows &&
|
|
134021
|
+
children: [showArrows && jsx$1(PagingArrow, {
|
|
134042
134022
|
iconProps: {
|
|
134043
134023
|
iconName: 'ChevronLeft',
|
|
134044
134024
|
style: {
|
|
@@ -134046,24 +134026,23 @@ var HeroPaging = function HeroPaging(_a) {
|
|
|
134046
134026
|
}
|
|
134047
134027
|
},
|
|
134048
134028
|
onClick: function () {
|
|
134049
|
-
return
|
|
134029
|
+
return showItemsStartingAtIndex(startIndex - visibleItemsCount);
|
|
134050
134030
|
},
|
|
134051
134031
|
color: pagingColor,
|
|
134052
134032
|
"data-paging-back": true
|
|
134053
134033
|
}, void 0), jsx$1(Paging, {
|
|
134054
|
-
children:
|
|
134034
|
+
children: getItems().map(function (item) {
|
|
134055
134035
|
var isActive = currentSlideId === item.id;
|
|
134056
|
-
var isVisible = index >= startIndex && index < startIndex + visibleItemsLength;
|
|
134057
134036
|
return jsx$1(PagingItem, __assign$g({
|
|
134058
134037
|
className: classNames({
|
|
134059
134038
|
'paging-item--active': isActive,
|
|
134060
|
-
'paging-item--visible':
|
|
134039
|
+
'paging-item--visible': true
|
|
134061
134040
|
}),
|
|
134062
|
-
visibleItemsLength: showArrows ?
|
|
134041
|
+
visibleItemsLength: showArrows ? visibleItemsCount : null
|
|
134063
134042
|
}, {
|
|
134064
134043
|
children: jsx$1(PagingButton, __assign$g({
|
|
134065
134044
|
onClick: function () {
|
|
134066
|
-
return goToSlide(
|
|
134045
|
+
return goToSlide(item.allItemsIndex);
|
|
134067
134046
|
},
|
|
134068
134047
|
color: pagingColor
|
|
134069
134048
|
}, {
|
|
@@ -134071,7 +134050,7 @@ var HeroPaging = function HeroPaging(_a) {
|
|
|
134071
134050
|
}), void 0)
|
|
134072
134051
|
}), item.id);
|
|
134073
134052
|
})
|
|
134074
|
-
}, void 0), showArrows &&
|
|
134053
|
+
}, void 0), showArrows && jsx$1(PagingArrow, {
|
|
134075
134054
|
iconProps: {
|
|
134076
134055
|
iconName: 'ChevronRight',
|
|
134077
134056
|
style: {
|
|
@@ -134079,23 +134058,41 @@ var HeroPaging = function HeroPaging(_a) {
|
|
|
134079
134058
|
}
|
|
134080
134059
|
},
|
|
134081
134060
|
onClick: function () {
|
|
134082
|
-
return
|
|
134061
|
+
return showItemsStartingAtIndex(startIndex + visibleItemsCount);
|
|
134083
134062
|
},
|
|
134084
134063
|
color: pagingColor,
|
|
134085
134064
|
"data-paging-next": true
|
|
134086
134065
|
}, void 0)]
|
|
134087
134066
|
}), void 0);
|
|
134088
134067
|
|
|
134089
|
-
function
|
|
134090
|
-
setStartIndex(
|
|
134091
|
-
goToSlide(
|
|
134068
|
+
function showItemsStartingAtIndex(newFirstVisibleItemIndex) {
|
|
134069
|
+
setStartIndex(newFirstVisibleItemIndex);
|
|
134070
|
+
goToSlide(getWrappedIndex(newFirstVisibleItemIndex, items.length));
|
|
134092
134071
|
}
|
|
134093
134072
|
|
|
134094
|
-
function
|
|
134095
|
-
|
|
134073
|
+
function getItems() {
|
|
134074
|
+
var displayedItems = [];
|
|
134075
|
+
|
|
134076
|
+
for (var count = 0; count < visibleItemsCount; count++) {
|
|
134077
|
+
var itemsIndex = getWrappedIndex(startIndex + count, items.length);
|
|
134078
|
+
var heroItem = items[itemsIndex];
|
|
134079
|
+
displayedItems.push({
|
|
134080
|
+
title: getTitle(heroItem.item, user, formatMessage),
|
|
134081
|
+
id: heroItem.item.id,
|
|
134082
|
+
allItemsIndex: itemsIndex
|
|
134083
|
+
});
|
|
134084
|
+
}
|
|
134085
|
+
|
|
134086
|
+
return displayedItems;
|
|
134096
134087
|
}
|
|
134097
134088
|
};
|
|
134098
134089
|
|
|
134090
|
+
function getWrappedIndex(index, max) {
|
|
134091
|
+
// returns a number which is always between 0 and `max`, mimicking a circular array
|
|
134092
|
+
// the two-part modulo accounts for negative numbers as well as positive.
|
|
134093
|
+
return (index % max + max) % max;
|
|
134094
|
+
}
|
|
134095
|
+
|
|
134099
134096
|
var PagingHost = _styled.div.withConfig({
|
|
134100
134097
|
displayName: "HeroPaging__PagingHost",
|
|
134101
134098
|
componentId: "sc-1y3j8qb-0"
|
package/index.umd.js
CHANGED
|
@@ -87327,9 +87327,9 @@
|
|
|
87327
87327
|
}), void 0);
|
|
87328
87328
|
};
|
|
87329
87329
|
|
|
87330
|
-
var version$1 = "0.4.0-preview.
|
|
87331
|
-
var buildId = "
|
|
87332
|
-
var commitId = "
|
|
87330
|
+
var version$1 = "0.4.0-preview.226";
|
|
87331
|
+
var buildId = "98723";
|
|
87332
|
+
var commitId = "d4ffc6f3cefd0299aae5b9ab8b63fad6ff105570";
|
|
87333
87333
|
var isCustomerBuild = false;
|
|
87334
87334
|
var buildInfo = {
|
|
87335
87335
|
version: version$1,
|
|
@@ -133856,63 +133856,43 @@
|
|
|
133856
133856
|
goToSlide = _a.goToSlide,
|
|
133857
133857
|
currentSlide = _a.currentSlide,
|
|
133858
133858
|
frameWidth = _a.frameWidth,
|
|
133859
|
-
slideCount = _a.slideCount,
|
|
133860
133859
|
autoplay = _a.autoplay,
|
|
133861
133860
|
className = _a.className;
|
|
133862
133861
|
var user = useCurrentUserContext().user;
|
|
133863
133862
|
var formatMessage = useIntl().formatMessage;
|
|
133864
133863
|
var palette = React$d.useContext(ThemeContext$1).theme.palette;
|
|
133864
|
+
var containerWidth = frameWidth - 60; // margins are extracted
|
|
133865
133865
|
|
|
133866
|
-
var
|
|
133867
|
-
showArrows = _b[0],
|
|
133868
|
-
setShowArrows = _b[1];
|
|
133869
|
-
|
|
133870
|
-
var _c = React$d.useState(0),
|
|
133871
|
-
startIndex = _c[0],
|
|
133872
|
-
setStartIndex = _c[1];
|
|
133866
|
+
var maxVisibleItems = Math.floor(containerWidth / 150); // 150 - min-width + gap
|
|
133873
133867
|
|
|
133874
|
-
var
|
|
133875
|
-
|
|
133876
|
-
|
|
133868
|
+
var hasOverflow = items.length > maxVisibleItems;
|
|
133869
|
+
var visibleItemsCount = hasOverflow ? maxVisibleItems : items.length;
|
|
133870
|
+
var showArrows = hasOverflow;
|
|
133877
133871
|
|
|
133878
|
-
React$d.
|
|
133879
|
-
|
|
133880
|
-
|
|
133881
|
-
var maxNumberOfItems = Math.floor(containerWidth / 150); // 150 - min-width + gap
|
|
133872
|
+
var _b = React$d.useState(0),
|
|
133873
|
+
startIndex = _b[0],
|
|
133874
|
+
setStartIndex = _b[1]; // reset the active slide - ensure the first slide is active when resizing
|
|
133882
133875
|
|
|
133883
|
-
setVisibleItemsLength(maxNumberOfItems);
|
|
133884
|
-
setShowArrows(maxNumberOfItems < slideCount); // reset the active slide - ensure the first slide is active when resizing
|
|
133885
133876
|
|
|
133886
|
-
|
|
133877
|
+
React$d.useEffect(function () {
|
|
133878
|
+
return showItemsStartingAtIndex(0);
|
|
133887
133879
|
}, [frameWidth]);
|
|
133888
133880
|
React$d.useEffect(function () {
|
|
133889
133881
|
if (!autoplay || !showArrows) {
|
|
133890
133882
|
return;
|
|
133891
|
-
} //
|
|
133892
|
-
|
|
133883
|
+
} // update the visible paging buttons when currentSlide's paging button is outside the visible area
|
|
133893
133884
|
|
|
133894
|
-
if (currentSlide === 0 && startIndex > 0) {
|
|
133895
|
-
reset();
|
|
133896
|
-
return;
|
|
133897
|
-
} // update the visible paging buttons when currenSlide has the corresponding paging button outside of the visible area
|
|
133898
133885
|
|
|
133899
|
-
|
|
133900
|
-
|
|
133901
|
-
handleVisiblePagingItems(startIndex + visibleItemsLength);
|
|
133886
|
+
if (currentSlide === startIndex + visibleItemsCount) {
|
|
133887
|
+
showItemsStartingAtIndex(startIndex + visibleItemsCount);
|
|
133902
133888
|
}
|
|
133903
|
-
}, [currentSlide, autoplay
|
|
133904
|
-
var pagingItems = items.map(function (i) {
|
|
133905
|
-
return {
|
|
133906
|
-
title: getTitle(i.item, user, formatMessage),
|
|
133907
|
-
id: i.item.id
|
|
133908
|
-
};
|
|
133909
|
-
});
|
|
133889
|
+
}, [currentSlide, autoplay]);
|
|
133910
133890
|
var pagingColor = items[currentSlide].item.bannerInfo ? palette.white : palette.black;
|
|
133911
133891
|
var currentSlideId = items[currentSlide].item.id;
|
|
133912
133892
|
return jsxRuntime.jsxs(PagingHost, __assign$g({
|
|
133913
133893
|
className: className
|
|
133914
133894
|
}, {
|
|
133915
|
-
children: [showArrows &&
|
|
133895
|
+
children: [showArrows && jsxRuntime.jsx(PagingArrow, {
|
|
133916
133896
|
iconProps: {
|
|
133917
133897
|
iconName: 'ChevronLeft',
|
|
133918
133898
|
style: {
|
|
@@ -133920,24 +133900,23 @@
|
|
|
133920
133900
|
}
|
|
133921
133901
|
},
|
|
133922
133902
|
onClick: function () {
|
|
133923
|
-
return
|
|
133903
|
+
return showItemsStartingAtIndex(startIndex - visibleItemsCount);
|
|
133924
133904
|
},
|
|
133925
133905
|
color: pagingColor,
|
|
133926
133906
|
"data-paging-back": true
|
|
133927
133907
|
}, void 0), jsxRuntime.jsx(Paging, {
|
|
133928
|
-
children:
|
|
133908
|
+
children: getItems().map(function (item) {
|
|
133929
133909
|
var isActive = currentSlideId === item.id;
|
|
133930
|
-
var isVisible = index >= startIndex && index < startIndex + visibleItemsLength;
|
|
133931
133910
|
return jsxRuntime.jsx(PagingItem, __assign$g({
|
|
133932
133911
|
className: classNames({
|
|
133933
133912
|
'paging-item--active': isActive,
|
|
133934
|
-
'paging-item--visible':
|
|
133913
|
+
'paging-item--visible': true
|
|
133935
133914
|
}),
|
|
133936
|
-
visibleItemsLength: showArrows ?
|
|
133915
|
+
visibleItemsLength: showArrows ? visibleItemsCount : null
|
|
133937
133916
|
}, {
|
|
133938
133917
|
children: jsxRuntime.jsx(PagingButton, __assign$g({
|
|
133939
133918
|
onClick: function () {
|
|
133940
|
-
return goToSlide(
|
|
133919
|
+
return goToSlide(item.allItemsIndex);
|
|
133941
133920
|
},
|
|
133942
133921
|
color: pagingColor
|
|
133943
133922
|
}, {
|
|
@@ -133945,7 +133924,7 @@
|
|
|
133945
133924
|
}), void 0)
|
|
133946
133925
|
}), item.id);
|
|
133947
133926
|
})
|
|
133948
|
-
}, void 0), showArrows &&
|
|
133927
|
+
}, void 0), showArrows && jsxRuntime.jsx(PagingArrow, {
|
|
133949
133928
|
iconProps: {
|
|
133950
133929
|
iconName: 'ChevronRight',
|
|
133951
133930
|
style: {
|
|
@@ -133953,23 +133932,41 @@
|
|
|
133953
133932
|
}
|
|
133954
133933
|
},
|
|
133955
133934
|
onClick: function () {
|
|
133956
|
-
return
|
|
133935
|
+
return showItemsStartingAtIndex(startIndex + visibleItemsCount);
|
|
133957
133936
|
},
|
|
133958
133937
|
color: pagingColor,
|
|
133959
133938
|
"data-paging-next": true
|
|
133960
133939
|
}, void 0)]
|
|
133961
133940
|
}), void 0);
|
|
133962
133941
|
|
|
133963
|
-
function
|
|
133964
|
-
setStartIndex(
|
|
133965
|
-
goToSlide(
|
|
133942
|
+
function showItemsStartingAtIndex(newFirstVisibleItemIndex) {
|
|
133943
|
+
setStartIndex(newFirstVisibleItemIndex);
|
|
133944
|
+
goToSlide(getWrappedIndex(newFirstVisibleItemIndex, items.length));
|
|
133966
133945
|
}
|
|
133967
133946
|
|
|
133968
|
-
function
|
|
133969
|
-
|
|
133947
|
+
function getItems() {
|
|
133948
|
+
var displayedItems = [];
|
|
133949
|
+
|
|
133950
|
+
for (var count = 0; count < visibleItemsCount; count++) {
|
|
133951
|
+
var itemsIndex = getWrappedIndex(startIndex + count, items.length);
|
|
133952
|
+
var heroItem = items[itemsIndex];
|
|
133953
|
+
displayedItems.push({
|
|
133954
|
+
title: getTitle(heroItem.item, user, formatMessage),
|
|
133955
|
+
id: heroItem.item.id,
|
|
133956
|
+
allItemsIndex: itemsIndex
|
|
133957
|
+
});
|
|
133958
|
+
}
|
|
133959
|
+
|
|
133960
|
+
return displayedItems;
|
|
133970
133961
|
}
|
|
133971
133962
|
};
|
|
133972
133963
|
|
|
133964
|
+
function getWrappedIndex(index, max) {
|
|
133965
|
+
// returns a number which is always between 0 and `max`, mimicking a circular array
|
|
133966
|
+
// the two-part modulo accounts for negative numbers as well as positive.
|
|
133967
|
+
return (index % max + max) % max;
|
|
133968
|
+
}
|
|
133969
|
+
|
|
133973
133970
|
var PagingHost = _styled__default["default"].div.withConfig({
|
|
133974
133971
|
displayName: "HeroPaging__PagingHost",
|
|
133975
133972
|
componentId: "sc-1y3j8qb-0"
|
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.
|
|
4
|
+
"version": "0.4.0-preview.226",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "^16.14.0 || ^17",
|
|
7
7
|
"react-dom": "^16.14.0 || ^17",
|