@equinor/echo-components 0.5.11 → 0.5.12
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SideSheetOrientation } from '../enums';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function GetSheetContainerClass(side?: 'left' | 'right', orientation?: SideSheetOrientation, floating?: boolean, isMobile?: boolean): string;
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14899,6 +14899,28 @@ var useEventListener = function useEventListener(eventName, handler, options) {
|
|
|
14899
14899
|
}, [eventName, element]);
|
|
14900
14900
|
};
|
|
14901
14901
|
|
|
14902
|
+
var useInitial = EchoUtils.Hooks.useInitial;
|
|
14903
|
+
/**
|
|
14904
|
+
* Hook for checking if page is loaded from mobile device.
|
|
14905
|
+
* @returns boolean true if on mobile.
|
|
14906
|
+
*/
|
|
14907
|
+
function useIsMobile() {
|
|
14908
|
+
var _useState = useState(false),
|
|
14909
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14910
|
+
isMobile = _useState2[0],
|
|
14911
|
+
setIsMobile = _useState2[1];
|
|
14912
|
+
useInitial(function () {
|
|
14913
|
+
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
|
14914
|
+
// true for mobile device
|
|
14915
|
+
setIsMobile(true);
|
|
14916
|
+
} else {
|
|
14917
|
+
// false for not mobile device
|
|
14918
|
+
setIsMobile(false);
|
|
14919
|
+
}
|
|
14920
|
+
});
|
|
14921
|
+
return isMobile;
|
|
14922
|
+
}
|
|
14923
|
+
|
|
14902
14924
|
var Keys = {
|
|
14903
14925
|
ArrowUp: "up",
|
|
14904
14926
|
ArrowRight: "right",
|
|
@@ -21100,7 +21122,8 @@ var css_248z$7 = ".Sheet-module_container__MJ-Md{background-color:var(--white);b
|
|
|
21100
21122
|
var styles$6 = {"container":"Sheet-module_container__MJ-Md","verticalContainer":"Sheet-module_verticalContainer__0wKqY Sheet-module_container__MJ-Md","blockContainer":"Sheet-module_blockContainer__JZVGn","rightContainer":"Sheet-module_rightContainer__u1DzS Sheet-module_verticalContainer__0wKqY Sheet-module_container__MJ-Md","leftContainer":"Sheet-module_leftContainer__8nvAG Sheet-module_verticalContainer__0wKqY Sheet-module_container__MJ-Md","horizontalContainer":"Sheet-module_horizontalContainer__ibaGL Sheet-module_container__MJ-Md","fullscreenContainer":"Sheet-module_fullscreenContainer__5qqvB Sheet-module_container__MJ-Md"};
|
|
21101
21123
|
styleInject(css_248z$7);
|
|
21102
21124
|
|
|
21103
|
-
function
|
|
21125
|
+
function GetSheetContainerClass(side, orientation, floating, isMobile) {
|
|
21126
|
+
if (isMobile) return styles$6.fullscreenContainer;
|
|
21104
21127
|
switch (orientation) {
|
|
21105
21128
|
case SideSheetOrientation.Horizontal:
|
|
21106
21129
|
return styles$6.horizontalContainer;
|
|
@@ -21126,9 +21149,10 @@ function Sheet(_ref) {
|
|
|
21126
21149
|
children = _ref.children,
|
|
21127
21150
|
className = _ref.className,
|
|
21128
21151
|
style = _ref.style;
|
|
21152
|
+
var isMobile = useIsMobile();
|
|
21129
21153
|
var containerClass = useMemo(function () {
|
|
21130
|
-
return
|
|
21131
|
-
}, [side, orientation, floating]);
|
|
21154
|
+
return GetSheetContainerClass(side, orientation, floating, isMobile);
|
|
21155
|
+
}, [side, orientation, floating, isMobile]);
|
|
21132
21156
|
if (className !== undefined) {
|
|
21133
21157
|
containerClass += ' ' + className;
|
|
21134
21158
|
}
|
|
@@ -21147,9 +21171,10 @@ function SheetTopArea(_ref) {
|
|
|
21147
21171
|
onOrientationChange = _ref.onOrientationChange,
|
|
21148
21172
|
closeSheet = _ref.closeSheet,
|
|
21149
21173
|
previous = _ref.previous;
|
|
21174
|
+
var isMobile = useIsMobile();
|
|
21150
21175
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
21151
21176
|
className: styles$5.topArea
|
|
21152
|
-
}, /*#__PURE__*/React__default.createElement("div", null, previous), orientation && onOrientationChange && /*#__PURE__*/React__default.createElement(SheetOrientationActions, {
|
|
21177
|
+
}, /*#__PURE__*/React__default.createElement("div", null, previous), orientation && onOrientationChange && !isMobile && /*#__PURE__*/React__default.createElement(SheetOrientationActions, {
|
|
21153
21178
|
orientation: orientation,
|
|
21154
21179
|
onOrientationChange: onOrientationChange
|
|
21155
21180
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
@@ -21759,5 +21784,5 @@ var OptionsList = function OptionsList(_ref) {
|
|
|
21759
21784
|
}));
|
|
21760
21785
|
};
|
|
21761
21786
|
|
|
21762
|
-
export { ButtonWithPopover, ContextMenu, DataInfoButton, DialogGenerator, DraggableItemsWrapper, Dropdown, EchoBottomBar, EchoCard, EchoHeader, FloatingActionButton, FloatingSearchBar, Icon, IconList, InlineTagIconLink, LinkCard, ListItem, ListRow, OptionsList, Panel, PanelContent, PanelWrapper, RadioButtonGroup, ReactDatePicker, RoundIconButton, RoundIconButtonVariants, SideSheet, SideSheetOrientation, SidebarButton, SliderField, SplitView, TagCategoryIcon, TagCategoryType, TagContextMenu, TagIcon, TagIconShadowWrapper, TextIconButton, TimePicker, classnames$1 as classnames, echoIcons, getIcon, notifications_m1, notifications_m2, notifications_m3, notifications_m4, notifications_m5, notifications_m6, notifications_m9, notifications_main_group, robim_external_ald, robim_external_iwit, robim_external_timp, robim_external_timp_text, themeConst, useKeyboardNavigation, useListNavigator, usePanelContext, useSectionNavigator, workorders_main_group, workorders_pm01, workorders_pm02, workorders_pm03, workorders_pm04, workorders_pm05, workorders_pm06, workorders_pm10, workorders_pm15, workorders_pm20 };
|
|
21787
|
+
export { ButtonWithPopover, ContextMenu, DataInfoButton, DialogGenerator, DraggableItemsWrapper, Dropdown, EchoBottomBar, EchoCard, EchoHeader, FloatingActionButton, FloatingSearchBar, Icon, IconList, InlineTagIconLink, LinkCard, ListItem, ListRow, OptionsList, Panel, PanelContent, PanelWrapper, RadioButtonGroup, ReactDatePicker, RoundIconButton, RoundIconButtonVariants, SideSheet, SideSheetOrientation, SidebarButton, SliderField, SplitView, TagCategoryIcon, TagCategoryType, TagContextMenu, TagIcon, TagIconShadowWrapper, TextIconButton, TimePicker, classnames$1 as classnames, echoIcons, getIcon, notifications_m1, notifications_m2, notifications_m3, notifications_m4, notifications_m5, notifications_m6, notifications_m9, notifications_main_group, robim_external_ald, robim_external_iwit, robim_external_timp, robim_external_timp_text, themeConst, useIsMobile, useKeyboardNavigation, useListNavigator, usePanelContext, useSectionNavigator, workorders_main_group, workorders_pm01, workorders_pm02, workorders_pm03, workorders_pm04, workorders_pm05, workorders_pm06, workorders_pm10, workorders_pm15, workorders_pm20 };
|
|
21763
21788
|
//# sourceMappingURL=index.js.map
|