@react-pdf-viewer/scroll-mode
Advanced tools
Comparing version 2.11.0 to 3.0.0
@@ -96,3 +96,15 @@ 'use strict'; | ||
var isSelected = _a.isSelected, mode = _a.mode, onClick = _a.onClick; | ||
return (React__namespace.createElement(SwitchScrollModeDecorator, { mode: mode, onClick: onClick }, function (props) { return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "scroll-mode-switch", position: core.Position.BottomCenter, target: React__namespace.createElement(core.MinimalButton, { ariaLabel: props.label, isSelected: isSelected, onClick: props.onClick }, props.icon), content: function () { return props.label; }, offset: TOOLTIP_OFFSET })); })); | ||
var testId = ''; | ||
switch (mode) { | ||
case exports.ScrollMode.Horizontal: | ||
testId = 'scroll-mode__horizontal-button'; | ||
break; | ||
case exports.ScrollMode.Vertical: | ||
testId = 'scroll-mode__vertical-button'; | ||
break; | ||
case exports.ScrollMode.Wrapped: | ||
default: | ||
testId = 'scroll-mode__wrapped-button'; | ||
} | ||
return (React__namespace.createElement(SwitchScrollModeDecorator, { mode: mode, onClick: onClick }, function (props) { return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "scroll-mode-switch", position: core.Position.BottomCenter, target: React__namespace.createElement(core.MinimalButton, { ariaLabel: props.label, isSelected: isSelected, testId: testId, onClick: props.onClick }, props.icon), content: function () { return props.label; }, offset: TOOLTIP_OFFSET })); })); | ||
}; | ||
@@ -152,3 +164,15 @@ | ||
var isSelected = _a.isSelected, mode = _a.mode, onClick = _a.onClick; | ||
return (React__namespace.createElement(SwitchScrollModeDecorator, { mode: mode, onClick: onClick }, function (props) { return (React__namespace.createElement(core.MenuItem, { checked: isSelected, icon: props.icon, onClick: props.onClick }, props.label)); })); | ||
var testId = ''; | ||
switch (mode) { | ||
case exports.ScrollMode.Horizontal: | ||
testId = 'scroll-mode__horizontal-menu'; | ||
break; | ||
case exports.ScrollMode.Vertical: | ||
testId = 'scroll-mode__vertical-menu'; | ||
break; | ||
case exports.ScrollMode.Wrapped: | ||
default: | ||
testId = 'scroll-mode__wrapped-menu'; | ||
} | ||
return (React__namespace.createElement(SwitchScrollModeDecorator, { mode: mode, onClick: onClick }, function (props) { return (React__namespace.createElement(core.MenuItem, { checked: isSelected, icon: props.icon, testId: testId, onClick: props.onClick }, props.label)); })); | ||
}; | ||
@@ -155,0 +179,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@react-pdf-viewer/core");function o(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var t=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,t.get?t:{enumerable:!0,get:function(){return e[o]}})}})),r.default=e,Object.freeze(r)}var t,c=o(e);exports.ScrollMode=void 0,(t=exports.ScrollMode||(exports.ScrollMode={})).Horizontal="Horizontal",t.Vertical="Vertical",t.Wrapped="Wrapped"; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),o=require("@react-pdf-viewer/core");function r(e){if(e&&e.__esModule)return e;var o=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),o.default=e,Object.freeze(o)}var t,c=r(e);exports.ScrollMode=void 0,(t=exports.ScrollMode||(exports.ScrollMode={})).Horizontal="Horizontal",t.Vertical="Vertical",t.Wrapped="Wrapped"; | ||
/*! ***************************************************************************** | ||
@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
var l=function(){return l=Object.assign||function(e){for(var r,o=1,t=arguments.length;o<t;o++)for(var c in r=arguments[o])Object.prototype.hasOwnProperty.call(r,c)&&(e[c]=r[c]);return e},l.apply(this,arguments)},n=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M6.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M14.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M22.5,21.5 c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z"}))},i=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M23.5,5.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V5.5z\n M23.5,13.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V13.5z\n M23.5,21.5 c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V21.5z"}))},a=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z\n M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z"}))},s=function(e){var o=e.children,t=e.mode,l=e.onClick,s=c.useContext(r.LocalizationContext).l10n,d="",u=c.createElement(i,null);switch(t){case exports.ScrollMode.Horizontal:d=s&&s.scrollMode?s.scrollMode.horizontalScrolling:"Horizontal scrolling",u=c.createElement(n,null);break;case exports.ScrollMode.Wrapped:d=s&&s.scrollMode?s.scrollMode.wrappedScrolling:"Wrapped scrolling",u=c.createElement(a,null);break;case exports.ScrollMode.Vertical:default:d=s&&s.scrollMode?s.scrollMode.verticalScrolling:"Vertical scrolling",u=c.createElement(i,null)}return o({icon:u,label:d,onClick:l})},d={left:0,top:8},u=function(e){var o=e.isSelected,t=e.mode,l=e.onClick;return c.createElement(s,{mode:t,onClick:l},(function(e){return c.createElement(r.Tooltip,{ariaControlsSuffix:"scroll-mode-switch",position:r.Position.BottomCenter,target:c.createElement(r.MinimalButton,{ariaLabel:e.label,isSelected:o,onClick:e.onClick},e.icon),content:function(){return e.label},offset:d})}))},m=function(e){var r=c.useState(e.get("scrollMode")||exports.ScrollMode.Vertical),o=r[0],t=r[1];return{scrollMode:o,switchTo:function(r){t(r);var o=e.get("getPagesContainer");if(o){var c=o();if(c)switch(r){case exports.ScrollMode.Vertical:c.classList.add("rpv-scroll-mode__vertical"),c.classList.remove("rpv-scroll-mode__horizontal"),c.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Horizontal:c.classList.add("rpv-scroll-mode__horizontal"),c.classList.remove("rpv-scroll-mode__vertical"),c.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Wrapped:c.classList.add("rpv-scroll-mode__wrapped"),c.classList.remove("rpv-scroll-mode__vertical"),c.classList.remove("rpv-scroll-mode__horizontal")}}}}},p=function(e){var r=e.children,o=e.mode,t=e.store,l=m(t),n=l.scrollMode,i=l.switchTo,a=n===o;return(r||function(e){return c.createElement(u,{isSelected:a,mode:e.mode,onClick:e.onClick})})({isSelected:a,mode:o,onClick:function(){i(o),t.update("scrollMode",o)}})},f=function(e){var o=e.isSelected,t=e.mode,l=e.onClick;return c.createElement(s,{mode:t,onClick:l},(function(e){return c.createElement(r.MenuItem,{checked:o,icon:e.icon,onClick:e.onClick},e.label)}))},v=function(e){var o=e.store,t=c.useContext(r.ThemeContext).direction===r.TextDirection.RightToLeft,l=m(o),n=l.scrollMode,i=l.switchTo,a=function(e){var r=e();if(r){t?r.classList.add("rpv-scroll-mode--rtl"):r.classList.remove("rpv-scroll-mode--rtl");var c=o.get("scrollMode")||exports.ScrollMode.Vertical;c!==exports.ScrollMode.Vertical&&i(c)}},s=function(e){e!==n&&i(e)};return c.useEffect((function(){return o.subscribe("getPagesContainer",a),o.subscribe("scrollMode",s),function(){o.unsubscribe("getPagesContainer",a),o.unsubscribe("scrollMode",s)}}),[]),c.createElement(c.Fragment,null)};exports.HorizontalScrollingIcon=n,exports.VerticalScrollingIcon=i,exports.WrappedScrollingIcon=a,exports.scrollModePlugin=function(e){var o=c.useMemo((function(){return r.createStore({scrollMode:e&&e.scrollMode?e.scrollMode:exports.ScrollMode.Vertical})}),[]),t=function(e){return c.createElement(p,l({},e,{store:o}))};return{install:function(e){o.update("getPagesContainer",e.getPagesContainer)},renderViewer:function(e){var r=e.slot;return r&&r.children&&(r.children=c.createElement(c.Fragment,null,c.createElement(v,{store:o}),r.children)),r},switchScrollMode:function(e){o.update("scrollMode",e)},SwitchScrollMode:t,SwitchScrollModeButton:function(e){return c.createElement(t,{mode:e.mode},(function(e){return c.createElement(u,{isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchScrollModeMenuItem:function(e){return c.createElement(t,{mode:e.mode},(function(r){return c.createElement(f,{isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick(),e.onClick()}})}))}}}; | ||
var l=function(){return l=Object.assign||function(e){for(var o,r=1,t=arguments.length;r<t;r++)for(var c in o=arguments[r])Object.prototype.hasOwnProperty.call(o,c)&&(e[c]=o[c]);return e},l.apply(this,arguments)},n=function(){return c.createElement(o.Icon,{size:16},c.createElement("path",{d:"M6.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M14.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M22.5,21.5 c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z"}))},i=function(){return c.createElement(o.Icon,{size:16},c.createElement("path",{d:"M23.5,5.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V5.5z\n M23.5,13.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V13.5z\n M23.5,21.5 c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V21.5z"}))},a=function(){return c.createElement(o.Icon,{size:16},c.createElement("path",{d:"M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z\n M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z"}))},s=function(e){var r=e.children,t=e.mode,l=e.onClick,s=c.useContext(o.LocalizationContext).l10n,d="",u=c.createElement(i,null);switch(t){case exports.ScrollMode.Horizontal:d=s&&s.scrollMode?s.scrollMode.horizontalScrolling:"Horizontal scrolling",u=c.createElement(n,null);break;case exports.ScrollMode.Wrapped:d=s&&s.scrollMode?s.scrollMode.wrappedScrolling:"Wrapped scrolling",u=c.createElement(a,null);break;case exports.ScrollMode.Vertical:default:d=s&&s.scrollMode?s.scrollMode.verticalScrolling:"Vertical scrolling",u=c.createElement(i,null)}return r({icon:u,label:d,onClick:l})},d={left:0,top:8},u=function(e){var r=e.isSelected,t=e.mode,l=e.onClick,n="";switch(t){case exports.ScrollMode.Horizontal:n="scroll-mode__horizontal-button";break;case exports.ScrollMode.Vertical:n="scroll-mode__vertical-button";break;case exports.ScrollMode.Wrapped:default:n="scroll-mode__wrapped-button"}return c.createElement(s,{mode:t,onClick:l},(function(e){return c.createElement(o.Tooltip,{ariaControlsSuffix:"scroll-mode-switch",position:o.Position.BottomCenter,target:c.createElement(o.MinimalButton,{ariaLabel:e.label,isSelected:r,testId:n,onClick:e.onClick},e.icon),content:function(){return e.label},offset:d})}))},p=function(e){var o=c.useState(e.get("scrollMode")||exports.ScrollMode.Vertical),r=o[0],t=o[1];return{scrollMode:r,switchTo:function(o){t(o);var r=e.get("getPagesContainer");if(r){var c=r();if(c)switch(o){case exports.ScrollMode.Vertical:c.classList.add("rpv-scroll-mode__vertical"),c.classList.remove("rpv-scroll-mode__horizontal"),c.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Horizontal:c.classList.add("rpv-scroll-mode__horizontal"),c.classList.remove("rpv-scroll-mode__vertical"),c.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Wrapped:c.classList.add("rpv-scroll-mode__wrapped"),c.classList.remove("rpv-scroll-mode__vertical"),c.classList.remove("rpv-scroll-mode__horizontal")}}}}},m=function(e){var o=e.children,r=e.mode,t=e.store,l=p(t),n=l.scrollMode,i=l.switchTo,a=n===r;return(o||function(e){return c.createElement(u,{isSelected:a,mode:e.mode,onClick:e.onClick})})({isSelected:a,mode:r,onClick:function(){i(r),t.update("scrollMode",r)}})},f=function(e){var r=e.isSelected,t=e.mode,l=e.onClick,n="";switch(t){case exports.ScrollMode.Horizontal:n="scroll-mode__horizontal-menu";break;case exports.ScrollMode.Vertical:n="scroll-mode__vertical-menu";break;case exports.ScrollMode.Wrapped:default:n="scroll-mode__wrapped-menu"}return c.createElement(s,{mode:t,onClick:l},(function(e){return c.createElement(o.MenuItem,{checked:r,icon:e.icon,testId:n,onClick:e.onClick},e.label)}))},M=function(e){var r=e.store,t=c.useContext(o.ThemeContext).direction===o.TextDirection.RightToLeft,l=p(r),n=l.scrollMode,i=l.switchTo,a=function(e){var o=e();if(o){t?o.classList.add("rpv-scroll-mode--rtl"):o.classList.remove("rpv-scroll-mode--rtl");var c=r.get("scrollMode")||exports.ScrollMode.Vertical;c!==exports.ScrollMode.Vertical&&i(c)}},s=function(e){e!==n&&i(e)};return c.useEffect((function(){return r.subscribe("getPagesContainer",a),r.subscribe("scrollMode",s),function(){r.unsubscribe("getPagesContainer",a),r.unsubscribe("scrollMode",s)}}),[]),c.createElement(c.Fragment,null)};exports.HorizontalScrollingIcon=n,exports.VerticalScrollingIcon=i,exports.WrappedScrollingIcon=a,exports.scrollModePlugin=function(e){var r=c.useMemo((function(){return o.createStore({scrollMode:e&&e.scrollMode?e.scrollMode:exports.ScrollMode.Vertical})}),[]),t=function(e){return c.createElement(m,l({},e,{store:r}))};return{install:function(e){r.update("getPagesContainer",e.getPagesContainer)},renderViewer:function(e){var o=e.slot;return o&&o.children&&(o.children=c.createElement(c.Fragment,null,c.createElement(M,{store:r}),o.children)),o},switchScrollMode:function(e){r.update("scrollMode",e)},SwitchScrollMode:t,SwitchScrollModeButton:function(e){return c.createElement(t,{mode:e.mode},(function(e){return c.createElement(u,{isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchScrollModeMenuItem:function(e){return c.createElement(t,{mode:e.mode},(function(o){return c.createElement(f,{isSelected:o.isSelected,mode:o.mode,onClick:function(){o.onClick(),e.onClick()}})}))}}}; |
{ | ||
"name": "@react-pdf-viewer/scroll-mode", | ||
"version": "2.11.0", | ||
"version": "3.0.0", | ||
"description": "A React component to view a PDF document", | ||
@@ -36,3 +36,3 @@ "license": "https://react-pdf-viewer.dev/license", | ||
"dependencies": { | ||
"@react-pdf-viewer/core": "2.11.0" | ||
"@react-pdf-viewer/core": "3.0.0" | ||
}, | ||
@@ -52,3 +52,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5e4074055f48210e89c1fdf5b1cc53d78d56be44" | ||
"gitHead": "db24bf8b47a1ef4ee9da726af7f66268468c3420" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23703
334
+ Added@react-pdf-viewer/core@3.0.0(transitive)
- Removed@react-pdf-viewer/core@2.11.0(transitive)
Updated@react-pdf-viewer/core@3.0.0