@telia-ace/widget-types-grid 0.0.1

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/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@telia-ace/widget-types-grid",
3
+ "version": "0.0.1",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.mjs",
9
+ "require": "./index.js"
10
+ }
11
+ },
12
+ "dependencies": {
13
+ "@telia-ace/widget-core": "*",
14
+ "@telia-ace/widget-routing": "*",
15
+ "@telia-ace/widget-services": "*",
16
+ "@telia-ace/widget-ui": "*",
17
+ "@telia-ace/widget-utilities": "*",
18
+ "@webprovisions/bootstrapping": "^1.0.14",
19
+ "@webprovisions/platform": "^1.1.4"
20
+ },
21
+ "peerDependencies": {
22
+ "react": "18.2.0",
23
+ "react-transition-group": "4.4.5",
24
+ "react-dom": "18.2.0",
25
+ "react-router": "^5.3.4",
26
+ "@emotion/cache": "^11.10.5",
27
+ "@emotion/react": "11.11.1",
28
+ "@emotion/styled": "11.11.0",
29
+ "react-router-dom": "5.3.4"
30
+ }
31
+ }
@@ -0,0 +1,64 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import f from "react-dom";
3
+ import h from "@emotion/cache";
4
+ import { CacheProvider as v } from "@emotion/react";
5
+ import { useIsMounted as y, useComponentPlatform as E, ContainerContext as R, RoutingContext as _ } from "@telia-ace/widget-ui";
6
+ import { useState as m, useEffect as a } from "react";
7
+ import { Router as C } from "react-router-dom";
8
+ import { Component as b } from "./index.mjs";
9
+ import "@telia-ace/widget-core";
10
+ import "@emotion/styled";
11
+ import "@telia-ace/widget-utilities";
12
+ import "react-transition-group";
13
+ import "react-router";
14
+ import "@telia-ace/widget-routing";
15
+ import "@telia-ace/widget-services";
16
+ import "@webprovisions/bootstrapping";
17
+ import "@webprovisions/platform";
18
+ var c, s = f;
19
+ if (process.env.NODE_ENV === "production")
20
+ c = s.createRoot, s.hydrateRoot;
21
+ else {
22
+ var p = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
23
+ c = function(t, r) {
24
+ p.usingClientEntryPoint = !0;
25
+ try {
26
+ return s.createRoot(t, r);
27
+ } finally {
28
+ p.usingClientEntryPoint = !1;
29
+ }
30
+ };
31
+ }
32
+ const P = (t) => {
33
+ const [r, e] = m(null), n = y();
34
+ return a(() => {
35
+ t.getAsync("router").then((i) => {
36
+ n.current && e(i);
37
+ });
38
+ }, [t, n]), r;
39
+ };
40
+ var l;
41
+ const N = h({
42
+ key: "css",
43
+ prepend: !0,
44
+ nonce: ((l = window.webprovisionsEnvironmentVariables) == null ? void 0 : l.cspNonce) || void 0
45
+ }), g = ({ container: t }) => {
46
+ const r = E(t), e = P(t), [n, i] = m(null);
47
+ return a(() => {
48
+ if (r)
49
+ return i(r.nodes.root.children.default[0].id || null), r.events.subscribe(
50
+ "components:root-children-changed",
51
+ (I, { node: u }) => {
52
+ if (u.parent && u.parent.type === "root") {
53
+ const d = u.parent.children.default[0].id;
54
+ i(d);
55
+ }
56
+ }
57
+ );
58
+ }, [r]), !e || !e.history || !r || !n ? null : /* @__PURE__ */ o(v, { value: N, children: /* @__PURE__ */ o(C, { history: e.history, children: /* @__PURE__ */ o(R.Provider, { value: t, children: /* @__PURE__ */ o(_.Provider, { value: e, children: /* @__PURE__ */ o(b, { id: n, branch: "default" }) }) }) }) });
59
+ }, O = g, z = (t, r) => {
60
+ c(r).render(/* @__PURE__ */ o(O, { container: t }));
61
+ };
62
+ export {
63
+ z as default
64
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),q=require("react-dom"),h=require("@emotion/cache"),v=require("@emotion/react"),i=require("@telia-ace/widget-ui"),c=require("react"),y=require("react-router-dom"),R=require("./index.js");require("@telia-ace/widget-core");require("@emotion/styled");require("@telia-ace/widget-utilities");require("react-transition-group");require("react-router");require("@telia-ace/widget-routing");require("@telia-ace/widget-services");require("@webprovisions/bootstrapping");require("@webprovisions/platform");var l,s=q;if(process.env.NODE_ENV==="production")l=s.createRoot,s.hydrateRoot;else{var d=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;l=function(r,e){d.usingClientEntryPoint=!0;try{return s.createRoot(r,e)}finally{d.usingClientEntryPoint=!1}}}const E=r=>{const[e,t]=c.useState(null),o=i.useIsMounted();return c.useEffect(()=>{r.getAsync("router").then(u=>{o.current&&t(u)})},[r,o]),e};var f;const _=h({key:"css",prepend:!0,nonce:((f=window.webprovisionsEnvironmentVariables)==null?void 0:f.cspNonce)||void 0}),b=({container:r})=>{const e=i.useComponentPlatform(r),t=E(r),[o,u]=c.useState(null);return c.useEffect(()=>{if(e)return u(e.nodes.root.children.default[0].id||null),e.events.subscribe("components:root-children-changed",(g,{node:a})=>{if(a.parent&&a.parent.type==="root"){const p=a.parent.children.default[0].id;u(p)}})},[e]),!t||!t.history||!e||!o?null:n.jsx(v.CacheProvider,{value:_,children:n.jsx(y.Router,{history:t.history,children:n.jsx(i.ContainerContext.Provider,{value:r,children:n.jsx(i.RoutingContext.Provider,{value:t,children:n.jsx(R.Component,{id:o,branch:"default"})})})})})},m=b,x=(r,e)=>{l(e).render(n.jsx(m,{container:r}))};exports.default=x;
package/services.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Container } from '@webprovisions/platform';
2
+
3
+ export declare const createRoutingService: (container: Container) => Promise<any>;
4
+ export declare const createStorageService: (container: Container) => Promise<import('../../services/src/index.ts').StorageProvider>;
5
+ export declare const createActionResolver: (container: Container) => Promise<import('../../core/src/index.ts').ActionResolver>;
6
+ export declare const createComponentResolver: (container: Container) => Promise<import('../../core/src/index.ts').ComponentResolver>;
7
+ export declare const createComponentPlatform: (container: Container) => Promise<import('../../core/src/index.ts').ComponentPlatform>;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ className?: string;
5
+ };
6
+ declare const AnimatedView: React.FC<Props>;
7
+ export default AnimatedView;
@@ -0,0 +1,16 @@
1
+ import { ComponentNode } from '../../../core/src/index.ts';
2
+ import { default as React } from 'react';
3
+
4
+ type Props = {
5
+ className?: string;
6
+ id: string;
7
+ branch: string;
8
+ node?: ComponentNode;
9
+ ariaLabel?: string;
10
+ tabIndex?: number;
11
+ context?: {
12
+ [key: string]: any;
13
+ };
14
+ };
15
+ declare const Component: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
16
+ export default Component;
@@ -0,0 +1,8 @@
1
+ import { ComponentNode, ComponentPlatform } from '../../../core/src/index.ts';
2
+ import { default as React } from 'react';
3
+
4
+ type Props = {
5
+ builder: (components: ComponentPlatform) => Promise<ComponentNode>;
6
+ };
7
+ declare const DetachedComponent: React.FC<Props>;
8
+ export default DetachedComponent;
@@ -0,0 +1,26 @@
1
+ export declare enum SlideDirection {
2
+ back = "back",
3
+ forth = "forth"
4
+ }
5
+ export interface RouteStructure {
6
+ name: string;
7
+ children: RouteStructure[];
8
+ }
9
+ /**
10
+ * Recursively find the parents of a nested route
11
+ * @param routeName Name of route to find
12
+ * @param routes Routes to look in
13
+ * @param trail Trail of parents
14
+ * @param level Level of the array currently looking in
15
+ */
16
+ export declare const findParentRoutes: (routeName: string, routes: RouteStructure[], trail?: string[], level?: number) => string[] | null;
17
+ /**
18
+ * Determine if the sliding animation should back or forth
19
+ * @param currentRouteName Name of current route
20
+ * @param nextRouteName Name of route to transition to
21
+ * @param routeRanking Hierarchical route ranking for the widget
22
+ */
23
+ export declare const determineSlideDirection: (currentRouteName: string, nextRouteName: string, routeRanking: RouteRanking) => SlideDirection;
24
+ export type RouteRanking = {
25
+ [key: string]: number;
26
+ };
@@ -0,0 +1,18 @@
1
+ export declare const renderSymbol: (symbol?: {
2
+ type: string;
3
+ content: string;
4
+ }) => string | undefined;
5
+ export type TriggerElementOptions = {
6
+ symbol?: {
7
+ type: string;
8
+ content: string;
9
+ };
10
+ widgetName: string;
11
+ label?: string;
12
+ ariaLabel?: string;
13
+ tooltip?: string;
14
+ };
15
+ export declare function createTriggerElement(element: HTMLElement, options: TriggerElementOptions): () => void;
16
+ export declare function setInactive(elements: HTMLElement | HTMLElement[], title?: string): void;
17
+ export declare function setLoading(elements: HTMLElement | HTMLElement[]): void;
18
+ export declare function setActive(elements: HTMLElement | HTMLElement[], title?: string): void;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ showSearch?: boolean;
5
+ };
6
+ declare const NotFound: React.FC<Props>;
7
+ export default NotFound;
@@ -0,0 +1,21 @@
1
+ import { ViewOutletOptions } from './view-outlet';
2
+
3
+ declare enum ProvidedElements {
4
+ None = "none",
5
+ WidgetDOM = "widgetDOM",
6
+ TriggerDOM = "triggerDOM",
7
+ Both = "both"
8
+ }
9
+ export declare enum TriggerType {
10
+ Inline = "inline",
11
+ Link = "link",
12
+ Badge = "badge",
13
+ Unsupported = "unsupported"
14
+ }
15
+ export declare const determineProvidedElements: (widgetDOMElement?: HTMLElement, triggerDOMElement?: HTMLElement) => ProvidedElements;
16
+ export declare const determineTriggerType: (triggerDefinition?: any) => TriggerType;
17
+ type PrepareDOMElementsOutput = ViewOutletOptions & {
18
+ callback?: () => void;
19
+ };
20
+ export declare const prepareDOMElements: (name: string, providedWidgetElement?: HTMLElement, providedTriggerElement?: HTMLElement, triggerDefinition?: any, waitWithReplace?: boolean) => PrepareDOMElementsOutput;
21
+ export {};
package/ui/render.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Container } from '@webprovisions/platform';
2
+
3
+ declare const _default: (container: Container, element: HTMLElement) => void;
4
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ role?: string;
5
+ 'data-width': number;
6
+ 'data-indent': number;
7
+ className?: string;
8
+ children?: React.ReactNode;
9
+ };
10
+ declare const ResolvableComponent: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
11
+ export default ResolvableComponent;
package/ui/styles.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { Theme } from '@emotion/react';
2
+
3
+ export declare const styling: (p: {
4
+ 'data-width'?: number;
5
+ 'data-indent'?: number;
6
+ theme: Theme;
7
+ }) => import('@emotion/react').SerializedStyles;
8
+ export declare const StyledView: import('@emotion/styled').StyledComponent<{
9
+ className?: string | undefined;
10
+ } & {
11
+ theme?: Theme | undefined;
12
+ }, {}, {}>;
13
+ export declare const StyledAnimatedView: import('@emotion/styled').StyledComponent<{
14
+ className?: string | undefined;
15
+ } & {
16
+ theme?: Theme | undefined;
17
+ }, {}, {}>;
package/ui/switch.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { ViewDefinition } from '../../../core/src/index.ts';
2
+ import { default as React } from 'react';
3
+
4
+ type Props = {
5
+ location?: any;
6
+ views: {
7
+ [key: string]: ViewDefinition;
8
+ };
9
+ render: (viewName: string) => JSX.Element | null;
10
+ };
11
+ declare const Switch: React.FC<Props>;
12
+ export default Switch;
@@ -0,0 +1,2 @@
1
+ declare const _default: (element: HTMLElement) => boolean;
2
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { ComponentNodeProperties } from '../../../core/src/index.ts';
2
+
3
+ declare const _default: (id: string) => ComponentNodeProperties;
4
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { RoutingService } from '../../../routing/src/index.ts';
2
+ import { Container } from '@webprovisions/platform';
3
+
4
+ declare const _default: (container: Container) => RoutingService | null;
5
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { Symbol } from '../../../ui/src/index.ts';
2
+ import { Container } from '@webprovisions/platform';
3
+ import { TriggerType } from './prepare-dom';
4
+
5
+ export type BadgeOptions = {
6
+ symbol?: Symbol;
7
+ label?: string;
8
+ ariaLabel?: string;
9
+ openTooltip?: string;
10
+ closedTooltip?: string;
11
+ };
12
+ export type ViewOutletOptions = {
13
+ widgetDOMElement: HTMLElement;
14
+ triggerDOMElement?: HTMLElement;
15
+ triggerOptions?: BadgeOptions | boolean;
16
+ triggerType: TriggerType;
17
+ cachedOriginals: {
18
+ widgetDOMElement?: Node;
19
+ triggerDOMElement?: Node;
20
+ };
21
+ };
22
+ export declare class ViewOutlet {
23
+ options: ViewOutletOptions;
24
+ container: Container;
25
+ private unsubscribe;
26
+ constructor(container: Container, options: ViewOutletOptions);
27
+ /**
28
+ * Renders the view outlet to the DOM.
29
+ */
30
+ render(): Promise<void>;
31
+ renderBadge(options: BadgeOptions): void;
32
+ dispose(): Promise<void>;
33
+ }
package/ui/view.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ type Props = {
4
+ className?: string;
5
+ };
6
+ declare const View: React.FC<Props>;
7
+ export default View;
@@ -0,0 +1,8 @@
1
+ import { Container } from '@webprovisions/platform';
2
+ import { default as React } from 'react';
3
+
4
+ type Props = {
5
+ container: Container;
6
+ };
7
+ declare const Wrapper: React.FC<Props>;
8
+ export default Wrapper;
@@ -0,0 +1,5 @@
1
+ import { unmountComponentAtNode as t } from "react-dom";
2
+ const m = (o) => t(o);
3
+ export {
4
+ m as default
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react-dom"),o=e=>t.unmountComponentAtNode(e);exports.default=o;
package/widget.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ import { WidgetRenderState, WidgetSettings } from '../../core/src/index.ts';
2
+ import { BootstrappingActivationData } from '@webprovisions/bootstrapping';
3
+ import { Container, EventSubscriptionCancellation, WidgetType } from '@webprovisions/platform';
4
+ import { ViewOutlet } from '././ui/view-outlet';
5
+
6
+ export declare enum InitialRenderState {
7
+ Open = "open",
8
+ Closed = "closed",
9
+ Hidden = "hidden",
10
+ Storage = "storage"
11
+ }
12
+ export type RenderData = {
13
+ widgetDOMElement?: HTMLElement;
14
+ triggerDOMElement?: HTMLElement;
15
+ key?: string;
16
+ open?: boolean;
17
+ withRenderState?: InitialRenderState;
18
+ };
19
+ export type AttachData = {
20
+ widgetDOMElement?: HTMLElement;
21
+ triggerDOMElement?: HTMLElement;
22
+ key?: string;
23
+ withRenderState?: InitialRenderState;
24
+ };
25
+ export default class Widget extends WidgetType {
26
+ outlets: Map<string, ViewOutlet>;
27
+ activated: Promise<void> | undefined;
28
+ subs: EventSubscriptionCancellation[];
29
+ constructor(container: Container);
30
+ handleBootstrapping: (activationData: BootstrappingActivationData) => void;
31
+ initialize(): Promise<void>;
32
+ attach(attachData?: AttachData): any;
33
+ detach(key?: string): void;
34
+ private triggerStateIfApplicable;
35
+ private getOrCreateViewOutlet;
36
+ render(renderData?: RenderData): any;
37
+ activate(data?: any): void;
38
+ setSettings(fn: (settings: WidgetSettings) => Promise<Partial<WidgetSettings>>): Promise<WidgetSettings>;
39
+ clearSettings(): Promise<void>;
40
+ action({ action, value }: {
41
+ action: string;
42
+ value?: any;
43
+ }): Promise<void>;
44
+ renderState(): Promise<WidgetRenderState>;
45
+ hide(options?: {
46
+ focusTrigger?: boolean;
47
+ }): Promise<void>;
48
+ open(): Promise<void>;
49
+ close(): Promise<void>;
50
+ show(): Promise<void>;
51
+ private onAction;
52
+ private setRenderState;
53
+ private onOpen;
54
+ private onClose;
55
+ private setTriggerState;
56
+ deactivate(): Promise<void[]>;
57
+ }