@telia-ace/widget-ui 1.0.13 → 1.0.14
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.
|
@@ -56,3 +56,4 @@ export { default as Typography } from './typography';
|
|
|
56
56
|
export type { Props as TypographyProps } from './typography';
|
|
57
57
|
export { default as WidgetLink } from './widget-link';
|
|
58
58
|
export type { Props as WidgetLinkProps } from './widget-link';
|
|
59
|
+
export { WidgetOverlayOutlet } from './widget-overlay-outlet';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare type Props = {
|
|
3
3
|
elementId?: string;
|
|
4
|
+
parent?: Element | HTMLElement;
|
|
4
5
|
children?: any;
|
|
5
6
|
};
|
|
6
|
-
declare const Portal:
|
|
7
|
+
declare const Portal: FC<Props>;
|
|
7
8
|
export default Portal;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
portalId: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const WidgetOverlayOutlet: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AnchorLink, Button, ButtonProps, Checkbox, CheckboxProps, Confirm, DateFormats, Drawer, DrawerAnimationType, Dropdown, DropdownProps, Empty, EmptyProps, Grid, GridProps, Html, HtmlIconProps, HtmlParseInstruction, HtmlProps, Icon, IconProps, Input, InputProps, ItemList, ItemListProps, ItemRenderer, ItemTree, ItemTreeProps, Lightbox, LightboxProps, Link, LinkProps, List, ListProps, Modal, ModalProps, NotFound, NotFoundProps, Overlay, OverlayProps, Paragraph, ParagraphProps, Portal, PortalProps, RouteLink, RouteLinkProps, Symbol, SymbolBadge, SymbolBadgeProps, TabStop, TabStopProps, Text, TextLink, TextLinkProps, TextProps, Timestamp, TimestampProps, Tooltip, TooltipProps, TransitionComponent, TransitionComponentProps, Typography, TypographyProps, WidgetLink, WidgetLinkProps } from './components';
|
|
1
|
+
import { AnchorLink, Button, ButtonProps, Checkbox, CheckboxProps, Confirm, DateFormats, Drawer, DrawerAnimationType, Dropdown, DropdownProps, Empty, EmptyProps, Grid, GridProps, Html, HtmlIconProps, HtmlParseInstruction, HtmlProps, Icon, IconProps, Input, InputProps, ItemList, ItemListProps, ItemRenderer, ItemTree, ItemTreeProps, Lightbox, LightboxProps, Link, LinkProps, List, ListProps, Modal, ModalProps, NotFound, NotFoundProps, Overlay, OverlayProps, Paragraph, ParagraphProps, Portal, PortalProps, RouteLink, RouteLinkProps, Symbol, SymbolBadge, SymbolBadgeProps, TabStop, TabStopProps, Text, TextLink, TextLinkProps, TextProps, Timestamp, TimestampProps, Tooltip, TooltipProps, TransitionComponent, TransitionComponentProps, Typography, TypographyProps, WidgetLink, WidgetLinkProps, WidgetOverlayOutlet } from './components';
|
|
2
2
|
import { ColumnContext, ComponentNodeContext, ComponentPropertyContext, ContainerContext, RoutingContext } from './contexts';
|
|
3
3
|
import { default as createReactComponent } from './create-react-component';
|
|
4
4
|
import { DispatchAction, useAction, useChildren, useColumns, useComponent, useComponentDescriptor, useComponentNode, useComponentPlatform, useContainer, useContext, useDispatch, useEventListener, useEvents, useIsMounted, useKeyPress, useLayout, usePrevious, useProperties, useRenderState, useRouteData, useRouter, useScroll, useSettings, useToggle, useTransitionEnd, useUniqueMenu, useWidgetEvent } from './hooks';
|
|
5
5
|
import { borderTabStyle, buttonCss, contentBox, genericHtml, invertedHoverButton, itemList, linkTabStyle, list, paddedBorderTabStyle, StyledText } from './styles';
|
|
6
6
|
import { browser, Browsers, convertToStringAttributes, createEmptyComponent, defaultRenderInstructions, embeddedLinkMapper, filterCssProps, filterCssPropsStyle, genericHashLink, GenericHashLinkProps, headingElement, processHtmlString, transitionComposer, TransitionStateSettings } from './utils';
|
|
7
|
-
export { AnchorLink, borderTabStyle, Button, buttonCss, Checkbox, ColumnContext, ComponentNodeContext, ComponentPropertyContext, Confirm, ContainerContext, contentBox, createEmptyComponent, createReactComponent, DateFormats, Drawer, DrawerAnimationType, Dropdown, filterCssProps, filterCssPropsStyle, Grid, headingElement, Html, Icon, Input, genericHtml, invertedHoverButton, ItemList, ItemTree, Lightbox, Link, linkTabStyle, List, paddedBorderTabStyle, RoutingContext, SymbolBadge, Text, TextLink, TransitionComponent, transitionComposer, Typography, useChildren, useColumns, useComponent, useComponentDescriptor, useComponentNode, useComponentPlatform, useContainer, useContext, useDispatch, useIsMounted, useLayout, useProperties, useRenderState, useRouteData, useRouter, useScroll, useTransitionEnd, useAction, useEventListener, useEvents, useKeyPress, usePrevious, useSettings, useToggle, useUniqueMenu, useWidgetEvent, Empty, Modal, NotFound, Overlay, Paragraph, Portal, RouteLink, TabStop, Timestamp, Tooltip, WidgetLink, itemList, list, StyledText, browser, convertToStringAttributes, defaultRenderInstructions, embeddedLinkMapper, genericHashLink, processHtmlString, };
|
|
7
|
+
export { AnchorLink, borderTabStyle, Button, buttonCss, Checkbox, ColumnContext, ComponentNodeContext, ComponentPropertyContext, Confirm, ContainerContext, contentBox, createEmptyComponent, createReactComponent, DateFormats, Drawer, DrawerAnimationType, Dropdown, filterCssProps, filterCssPropsStyle, Grid, headingElement, Html, Icon, Input, genericHtml, invertedHoverButton, ItemList, ItemTree, Lightbox, Link, linkTabStyle, List, paddedBorderTabStyle, RoutingContext, SymbolBadge, Text, TextLink, TransitionComponent, transitionComposer, Typography, useChildren, useColumns, useComponent, useComponentDescriptor, useComponentNode, useComponentPlatform, useContainer, useContext, useDispatch, useIsMounted, useLayout, useProperties, useRenderState, useRouteData, useRouter, useScroll, useTransitionEnd, useAction, useEventListener, useEvents, useKeyPress, usePrevious, useSettings, useToggle, useUniqueMenu, useWidgetEvent, Empty, Modal, NotFound, Overlay, Paragraph, Portal, RouteLink, TabStop, Timestamp, Tooltip, WidgetLink, WidgetOverlayOutlet, itemList, list, StyledText, browser, convertToStringAttributes, defaultRenderInstructions, embeddedLinkMapper, genericHashLink, processHtmlString, };
|
|
8
8
|
export type { ButtonProps, CheckboxProps, DropdownProps, EmptyProps, GridProps, HtmlIconProps, HtmlParseInstruction, HtmlProps, IconProps, InputProps, ItemListProps, ItemRenderer, ItemTreeProps, LightboxProps, LinkProps, ListProps, ModalProps, NotFoundProps, OverlayProps, ParagraphProps, PortalProps, RouteLinkProps, Symbol, SymbolBadgeProps, TabStopProps, TextLinkProps, TextProps, TimestampProps, TooltipProps, TransitionComponentProps, TypographyProps, WidgetLinkProps, Browsers, GenericHashLinkProps, TransitionStateSettings, };
|
|
9
9
|
export type { DispatchAction };
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import styled, { css } from "styled-components";
|
|
33
33
|
import { kebabCase, appendClassNames, uuid, removeNullAndUndefinedValues } from "@telia-ace/widget-utilities";
|
|
34
|
-
import React, { forwardRef, createContext, useContext as useContext$1, useState, useEffect, useRef, useCallback, useImperativeHandle, Component, lazy } from "react";
|
|
34
|
+
import React, { forwardRef, createContext, useContext as useContext$1, useState, useEffect, useRef, useCallback, useImperativeHandle, Component, useMemo, lazy } from "react";
|
|
35
35
|
import { CSSTransition, Transition } from "react-transition-group";
|
|
36
36
|
import { Container, WidgetState } from "@webprovisions/platform";
|
|
37
37
|
import { ComponentPlatform, asDescriptor, createEventSubscriber, ComponentQuery, WidgetRenderState, extendComponent } from "@telia-ace/widget-core";
|
|
@@ -1168,17 +1168,21 @@ const genericHtml = css`
|
|
|
1168
1168
|
margin: 0;
|
|
1169
1169
|
}
|
|
1170
1170
|
`;
|
|
1171
|
-
const Portal = ({
|
|
1172
|
-
|
|
1171
|
+
const Portal = ({
|
|
1172
|
+
elementId = "humany-portal-elements",
|
|
1173
|
+
parent = document.body,
|
|
1174
|
+
children
|
|
1175
|
+
}) => {
|
|
1176
|
+
const [container] = useState(() => {
|
|
1173
1177
|
const el = document.getElementById(elementId) || document.createElement("div");
|
|
1174
1178
|
el.id = elementId;
|
|
1175
1179
|
return el;
|
|
1176
1180
|
});
|
|
1177
1181
|
useEffect(() => {
|
|
1178
|
-
|
|
1182
|
+
parent.appendChild(container);
|
|
1179
1183
|
return () => {
|
|
1180
1184
|
if (container.childElementCount <= 1) {
|
|
1181
|
-
|
|
1185
|
+
parent.removeChild(container);
|
|
1182
1186
|
}
|
|
1183
1187
|
};
|
|
1184
1188
|
}, [container]);
|
|
@@ -1760,7 +1764,7 @@ const Drawer = ({
|
|
|
1760
1764
|
"aria-expanded": visible
|
|
1761
1765
|
}));
|
|
1762
1766
|
};
|
|
1763
|
-
const Wrapper$
|
|
1767
|
+
const Wrapper$5 = styled.div`
|
|
1764
1768
|
font-family: ${(p) => {
|
|
1765
1769
|
var _a;
|
|
1766
1770
|
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
@@ -1802,7 +1806,7 @@ const Header$1 = styled(Typography)`
|
|
|
1802
1806
|
const AnimationBase = css`
|
|
1803
1807
|
transition: ${(p) => p.duration}ms;
|
|
1804
1808
|
`;
|
|
1805
|
-
const WrapperWithSlideInBottom = styled(Wrapper$
|
|
1809
|
+
const WrapperWithSlideInBottom = styled(Wrapper$5)`
|
|
1806
1810
|
max-height: 0;
|
|
1807
1811
|
${AnimationBase}
|
|
1808
1812
|
|
|
@@ -1820,7 +1824,7 @@ const WrapperWithSlideInBottom = styled(Wrapper$4)`
|
|
|
1820
1824
|
max-height: 0;
|
|
1821
1825
|
}
|
|
1822
1826
|
`;
|
|
1823
|
-
const WrapperWithSlideInRight = styled(Wrapper$
|
|
1827
|
+
const WrapperWithSlideInRight = styled(Wrapper$5)`
|
|
1824
1828
|
${AnimationBase}
|
|
1825
1829
|
transform: translateX(100%);
|
|
1826
1830
|
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
@@ -1839,7 +1843,7 @@ const WrapperWithSlideInRight = styled(Wrapper$4)`
|
|
|
1839
1843
|
transform: translateX(100%);
|
|
1840
1844
|
}
|
|
1841
1845
|
`;
|
|
1842
|
-
const WrapperWithSlideInLeft = styled(Wrapper$
|
|
1846
|
+
const WrapperWithSlideInLeft = styled(Wrapper$5)`
|
|
1843
1847
|
${AnimationBase}
|
|
1844
1848
|
transform: translateX(-100%);
|
|
1845
1849
|
height: ${(p) => p.fullScreen ? "100%" : "auto"};
|
|
@@ -1858,7 +1862,7 @@ const WrapperWithSlideInLeft = styled(Wrapper$4)`
|
|
|
1858
1862
|
transform: translateX(-100%);
|
|
1859
1863
|
}
|
|
1860
1864
|
`;
|
|
1861
|
-
const WrapperWithSlideInTop = styled(Wrapper$
|
|
1865
|
+
const WrapperWithSlideInTop = styled(Wrapper$5)`
|
|
1862
1866
|
${AnimationBase}
|
|
1863
1867
|
bottom: unset;
|
|
1864
1868
|
top: 0;
|
|
@@ -2011,9 +2015,9 @@ const StyledDropdown = styled.div`
|
|
|
2011
2015
|
`;
|
|
2012
2016
|
const Empty = (_k) => {
|
|
2013
2017
|
var other = __objRest(_k, []);
|
|
2014
|
-
return /* @__PURE__ */ React.createElement(Wrapper$
|
|
2018
|
+
return /* @__PURE__ */ React.createElement(Wrapper$4, __spreadValues({}, other));
|
|
2015
2019
|
};
|
|
2016
|
-
const Wrapper$
|
|
2020
|
+
const Wrapper$4 = styled.div`
|
|
2017
2021
|
display: none;
|
|
2018
2022
|
`;
|
|
2019
2023
|
var grid = forwardRef((_l, ref) => {
|
|
@@ -2268,14 +2272,14 @@ const Overlay = (_z) => {
|
|
|
2268
2272
|
classNames: "humany-overlay-transition",
|
|
2269
2273
|
unmountOnExit: true,
|
|
2270
2274
|
timeout: duration
|
|
2271
|
-
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$
|
|
2275
|
+
}, /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Wrapper$3, __spreadValues({
|
|
2272
2276
|
className: "humany-overlay",
|
|
2273
2277
|
duration,
|
|
2274
2278
|
ref,
|
|
2275
2279
|
onClick: onOverlayClick
|
|
2276
2280
|
}, other), children)));
|
|
2277
2281
|
};
|
|
2278
|
-
const Wrapper$
|
|
2282
|
+
const Wrapper$3 = styled.div`
|
|
2279
2283
|
background: rgba(0, 0, 0, 0.6);
|
|
2280
2284
|
min-width: 100%;
|
|
2281
2285
|
min-height: 100%;
|
|
@@ -2538,7 +2542,7 @@ const Modal = forwardRef((_F, ref) => {
|
|
|
2538
2542
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Overlay, {
|
|
2539
2543
|
visible,
|
|
2540
2544
|
onClick: overlayClick
|
|
2541
|
-
}, /* @__PURE__ */ React.createElement(Wrapper$
|
|
2545
|
+
}, /* @__PURE__ */ React.createElement(Wrapper$2, __spreadProps(__spreadValues({
|
|
2542
2546
|
className: appendClassNames(className, "humany-modal", `humany-modal-${id.current}`),
|
|
2543
2547
|
css: css2,
|
|
2544
2548
|
tabIndex: -1
|
|
@@ -2557,7 +2561,7 @@ const Modal = forwardRef((_F, ref) => {
|
|
|
2557
2561
|
}
|
|
2558
2562
|
}));
|
|
2559
2563
|
});
|
|
2560
|
-
const Wrapper$
|
|
2564
|
+
const Wrapper$2 = styled.div`
|
|
2561
2565
|
font-family: ${(p) => {
|
|
2562
2566
|
var _a;
|
|
2563
2567
|
return (_a = p.theme.fonts) == null ? void 0 : _a.type;
|
|
@@ -2692,7 +2696,7 @@ const NotFound = ({
|
|
|
2692
2696
|
suggestionHeader = "",
|
|
2693
2697
|
suggestion = ""
|
|
2694
2698
|
}) => {
|
|
2695
|
-
return /* @__PURE__ */ React.createElement(Wrapper, null, /* @__PURE__ */ React.createElement(Status, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
2699
|
+
return /* @__PURE__ */ React.createElement(Wrapper$1, null, /* @__PURE__ */ React.createElement(Status, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
2696
2700
|
variant: "h2"
|
|
2697
2701
|
}, "404")), /* @__PURE__ */ React.createElement(Header, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
2698
2702
|
variant: "h3"
|
|
@@ -2702,7 +2706,7 @@ const NotFound = ({
|
|
|
2702
2706
|
text: link
|
|
2703
2707
|
})), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement("span", null, suggestionHeader), /* @__PURE__ */ React.createElement("ul", null, /* @__PURE__ */ React.createElement("li", null, suggestion))));
|
|
2704
2708
|
};
|
|
2705
|
-
const Wrapper = styled.div`
|
|
2709
|
+
const Wrapper$1 = styled.div`
|
|
2706
2710
|
display: flex;
|
|
2707
2711
|
flex-wrap: wrap;
|
|
2708
2712
|
`;
|
|
@@ -3051,6 +3055,38 @@ var WidgetLink = forwardRef((_L, ref) => {
|
|
|
3051
3055
|
ref
|
|
3052
3056
|
}), children);
|
|
3053
3057
|
});
|
|
3058
|
+
const WidgetOverlayOutlet = forwardRef(({ portalId = "humany-widget-overlay-portal", className, children }, ref) => {
|
|
3059
|
+
const container = useContainer();
|
|
3060
|
+
const parentElement = useMemo(() => {
|
|
3061
|
+
if (!container)
|
|
3062
|
+
return null;
|
|
3063
|
+
const widgetDOMElement = container.get("widgetDOMElement");
|
|
3064
|
+
if (!widgetDOMElement || !widgetDOMElement.childElementCount)
|
|
3065
|
+
return null;
|
|
3066
|
+
return widgetDOMElement.children[0];
|
|
3067
|
+
}, [container]);
|
|
3068
|
+
if (!parentElement) {
|
|
3069
|
+
return null;
|
|
3070
|
+
}
|
|
3071
|
+
return /* @__PURE__ */ React.createElement(Portal, {
|
|
3072
|
+
elementId: portalId,
|
|
3073
|
+
parent: parentElement
|
|
3074
|
+
}, /* @__PURE__ */ React.createElement(Wrapper, {
|
|
3075
|
+
className: appendClassNames("humany-widget-overlay-outlet", className),
|
|
3076
|
+
ref
|
|
3077
|
+
}, children));
|
|
3078
|
+
});
|
|
3079
|
+
const Wrapper = styled.div`
|
|
3080
|
+
background-color: #ffffff;
|
|
3081
|
+
position: absolute;
|
|
3082
|
+
top: 0;
|
|
3083
|
+
left: 0;
|
|
3084
|
+
bottom: 0;
|
|
3085
|
+
right: 0;
|
|
3086
|
+
z-index: 10;
|
|
3087
|
+
width: 100%;
|
|
3088
|
+
height: 100%;
|
|
3089
|
+
`;
|
|
3054
3090
|
const createReactComponent = (container, type, reactComponent, fn, options) => {
|
|
3055
3091
|
return container.getAsync("componentResolver").then((componentResolver) => {
|
|
3056
3092
|
componentResolver.registerComponent(type, lazy(() => reactComponent));
|
|
@@ -3058,5 +3094,5 @@ const createReactComponent = (container, type, reactComponent, fn, options) => {
|
|
|
3058
3094
|
}), type, options);
|
|
3059
3095
|
});
|
|
3060
3096
|
};
|
|
3061
|
-
export { AnchorLink, Button, Checkbox, ColumnContext, ComponentNodeContext, ComponentPropertyContext, Confirm, ContainerContext, DateFormats, Drawer, AnimationType as DrawerAnimationType, Dropdown, Empty, grid as Grid, Html, Icon, input as Input, ItemList, ItemTree, Lightbox, Link, List, Modal, NotFound, Overlay, Paragraph, Portal, RouteLink, RoutingContext, StyledText, SymbolBadge, TabStop, Text, TextLink, Timestamp, Tooltip, TransitionComponent, Typography, WidgetLink, borderTabStyle, browser, buttonCss, contentBox, convertToStringAttributes, createEmptyComponent, createReactComponent, defaultRenderInstructions, embeddedLinkMapper, filterCssProps, filterCssPropsStyle, genericHashLink, genericHtml, headingElement, invertedHoverButton, itemList, linkTabStyle, list, paddedBorderTabStyle, parseHtmlString as processHtmlString, transitionComposer, useAction, useChildren, useColumns, useComponent, useComponentDescriptor, useComponentNode, useComponentPlatform, useContainer, useContext, useDispatch, useEventListener, useEvents, useIsMounted, useKeyPress, useLayout, usePrevious, useProperties, useRenderState, useRouteData, useRouter, useScroll, useSettings, useToggle, useTransitionEnd, useUniqueMenu, useWidgetEvent };
|
|
3097
|
+
export { AnchorLink, Button, Checkbox, ColumnContext, ComponentNodeContext, ComponentPropertyContext, Confirm, ContainerContext, DateFormats, Drawer, AnimationType as DrawerAnimationType, Dropdown, Empty, grid as Grid, Html, Icon, input as Input, ItemList, ItemTree, Lightbox, Link, List, Modal, NotFound, Overlay, Paragraph, Portal, RouteLink, RoutingContext, StyledText, SymbolBadge, TabStop, Text, TextLink, Timestamp, Tooltip, TransitionComponent, Typography, WidgetLink, WidgetOverlayOutlet, borderTabStyle, browser, buttonCss, contentBox, convertToStringAttributes, createEmptyComponent, createReactComponent, defaultRenderInstructions, embeddedLinkMapper, filterCssProps, filterCssPropsStyle, genericHashLink, genericHtml, headingElement, invertedHoverButton, itemList, linkTabStyle, list, paddedBorderTabStyle, parseHtmlString as processHtmlString, transitionComposer, useAction, useChildren, useColumns, useComponent, useComponentDescriptor, useComponentNode, useComponentPlatform, useContainer, useContext, useDispatch, useEventListener, useEvents, useIsMounted, useKeyPress, useLayout, usePrevious, useProperties, useRenderState, useRouteData, useRouter, useScroll, useSettings, useToggle, useTransitionEnd, useUniqueMenu, useWidgetEvent };
|
|
3062
3098
|
//# sourceMappingURL=index.js.map
|