@telia/teddy 0.0.27 → 0.0.28
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/dist/components/accordion/accordion-root.cjs +14 -14
- package/dist/components/accordion/accordion-root.js +14 -14
- package/dist/components/card/card.d.ts +1 -1
- package/dist/components/chip/chip-indicator.d.ts +2 -2
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/index.cjs +4 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/modal/modal.cjs +2 -0
- package/dist/components/modal/modal.js +2 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.cjs +9 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.d.ts +4 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.js +9 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.cjs +21 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.d.ts +4 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.js +21 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.cjs +369 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.d.ts +8 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.js +369 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-root.cjs +12 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-root.d.ts +33 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-root.js +12 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.cjs +37 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.d.ts +10 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.js +37 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-search.cjs +12 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-search.d.ts +8 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-search.js +12 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.cjs +11 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.d.ts +4 -0
- package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.js +11 -0
- package/dist/components/navigation-menu/global-navigation/index.cjs +4 -0
- package/dist/components/navigation-menu/global-navigation/index.d.ts +6 -0
- package/dist/components/navigation-menu/global-navigation/index.js +4 -0
- package/dist/components/navigation-menu/global-navigation/utils.cjs +318 -0
- package/dist/components/navigation-menu/global-navigation/utils.d.ts +496 -0
- package/dist/components/navigation-menu/global-navigation/utils.js +318 -0
- package/dist/components/navigation-menu/index.cjs +2 -0
- package/dist/components/navigation-menu/index.d.ts +1 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/navigation-menu/navigation-menu.cjs +49 -23
- package/dist/components/navigation-menu/navigation-menu.d.ts +5 -0
- package/dist/components/navigation-menu/navigation-menu.js +50 -24
- package/dist/components/notification/notification.d.ts +2 -2
- package/dist/components/tabs/index.d.ts +1 -1
- package/dist/components/tabs/tabs-trigger.d.ts +1 -1
- package/dist/components/toggle/toggle.d.ts +2 -2
- package/dist/components/tooltip/index.cjs +22 -0
- package/dist/components/tooltip/index.d.ts +40 -0
- package/dist/components/tooltip/index.js +22 -0
- package/dist/components/tooltip/tooltip-arrow.cjs +33 -0
- package/dist/components/tooltip/tooltip-arrow.d.ts +6 -0
- package/dist/components/tooltip/tooltip-arrow.js +16 -0
- package/dist/components/tooltip/tooltip-content.cjs +46 -0
- package/dist/components/tooltip/tooltip-content.d.ts +80 -0
- package/dist/components/tooltip/tooltip-content.js +29 -0
- package/dist/components/tooltip/tooltip-portal.cjs +26 -0
- package/dist/components/tooltip/tooltip-portal.d.ts +7 -0
- package/dist/components/tooltip/tooltip-portal.js +9 -0
- package/dist/components/tooltip/tooltip-provider.cjs +30 -0
- package/dist/components/tooltip/tooltip-provider.d.ts +9 -0
- package/dist/components/tooltip/tooltip-provider.js +13 -0
- package/dist/components/tooltip/tooltip-root.cjs +36 -0
- package/dist/components/tooltip/tooltip-root.d.ts +25 -0
- package/dist/components/tooltip/tooltip-root.js +19 -0
- package/dist/components/tooltip/tooltip-trigger.cjs +38 -0
- package/dist/components/tooltip/tooltip-trigger.d.ts +6 -0
- package/dist/components/tooltip/tooltip-trigger.js +21 -0
- package/dist/main.cjs +4 -0
- package/dist/main.js +4 -0
- package/dist/style.css +731 -594
- package/dist/tooltip.module-D_3DOZOn.cjs +15 -0
- package/dist/tooltip.module-DnKU2XS4.js +16 -0
- package/dist/utils/generate-styling/grid.d.ts +24 -24
- package/dist/utils/generate-styling/index.d.ts +16 -16
- package/dist/utils/generate-styling/util.d.ts +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const clsx = require("clsx");
|
|
6
|
+
const components_navigationMenu_globalNavigation_utils = require("./utils.cjs");
|
|
7
|
+
const components_navigationMenu_navigationMenu = require("../navigation-menu.cjs");
|
|
8
|
+
const components_box_box = require("../../box/box.cjs");
|
|
9
|
+
const components_drawer_index = require("../../drawer/index.cjs");
|
|
10
|
+
require("../../../assets/sprite.269ba410-teddy.svg");
|
|
11
|
+
const components_icon_icon = require("../../icon/icon.cjs");
|
|
12
|
+
const components_button_button = require("../../button/button.cjs");
|
|
13
|
+
const components_grid_grid = require("../../grid/grid.cjs");
|
|
14
|
+
const components_heading_heading = require("../../heading/heading.cjs");
|
|
15
|
+
const components_textSpacing_textSpacing = require("../../text-spacing/text-spacing.cjs");
|
|
16
|
+
const components_tabs_index = require("../../tabs/index.cjs");
|
|
17
|
+
const components_navigationMenu_globalNavigation_globalNavigationSearchField = require("./global-navigation-search-field.cjs");
|
|
18
|
+
const components_flex_flex = require("../../flex/flex.cjs");
|
|
19
|
+
const components_accordion_index = require("../../accordion/index.cjs");
|
|
20
|
+
const components_visuallyHidden_visuallyHidden = require("../../visually-hidden/visually-hidden.cjs");
|
|
21
|
+
const components_link_link = require("../../link/link.cjs");
|
|
22
|
+
const components_list_index = require("../../list/index.cjs");
|
|
23
|
+
const styles = {
|
|
24
|
+
"teddy-global-navigation": "_teddy-global-navigation_1b1i5_1",
|
|
25
|
+
"teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_1b1i5_5",
|
|
26
|
+
"teddy-global-navigation__link": "_teddy-global-navigation__link_1b1i5_19"
|
|
27
|
+
};
|
|
28
|
+
function MyPages(props) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const rootContext = React.useContext(RootContext);
|
|
31
|
+
const isLoggedIn = (((_a = rootContext == null ? void 0 : rootContext.loggedInUser) == null ? void 0 : _a.name.length) || 0) > 0;
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: ((_b = rootContext == null ? void 0 : rootContext.loggedInUser) == null ? void 0 : _b.name.length) ? /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "end-user", size: "sm" }),
|
|
35
|
+
rootContext.loggedInUser.name
|
|
36
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
37
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "login", size: "sm" }),
|
|
38
|
+
"Logg inn"
|
|
39
|
+
] }) }) }),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { asChild: true, children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
42
|
+
isLoggedIn ? /* @__PURE__ */ jsxRuntime.jsx(LoggedInContent, {}) : /* @__PURE__ */ jsxRuntime.jsx(LoggedOutContent, {}),
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
44
|
+
] })
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
function LoggedOutContent() {
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_grid_grid.Grid, { gap: "400", children: [
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Logg inn" }),
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", children: "Privat" }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "secondary", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.link, children: [
|
|
53
|
+
components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.name,
|
|
54
|
+
" ",
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
56
|
+
] }) })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", children: "Bedrift" }),
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_grid_grid.Grid, { gap: "150", children: components_navigationMenu_globalNavigation_utils.LOGGED_IN_LINKS_BUSINESS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "secondary", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: link.link, children: [
|
|
61
|
+
link.name,
|
|
62
|
+
" ",
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
64
|
+
] }) })) })
|
|
65
|
+
] })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
function LoggedInContent() {
|
|
69
|
+
const rootContext = React.useContext(RootContext);
|
|
70
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { mb: "200", children: "Dine sider" }),
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs, { defaultValue: "private", children: [
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.List, { children: [
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: "private", children: "Privat" }),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: "business", children: "Bedrift" })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "private", children: [
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Privat" }),
|
|
80
|
+
components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "business", children: [
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedrift" }),
|
|
84
|
+
components_navigationMenu_globalNavigation_utils.LOGGED_IN_LINKS_BUSINESS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { mt: "200", onClick: () => rootContext == null ? void 0 : rootContext.onLogoutClick, variant: "secondary", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "logout", children: "Logg ut" }) })
|
|
87
|
+
] })
|
|
88
|
+
] })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
MyPages.displayName = "MyPages";
|
|
92
|
+
function Search(props) {
|
|
93
|
+
const searchFieldRef = React.useRef(null);
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "search", size: "sm" }),
|
|
97
|
+
" Søk"
|
|
98
|
+
] }) }) }),
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
100
|
+
components_drawer_index.Drawer.Content,
|
|
101
|
+
{
|
|
102
|
+
onOpenAutoFocus: (e) => {
|
|
103
|
+
var _a;
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
(_a = searchFieldRef.current) == null ? void 0 : _a.focus();
|
|
106
|
+
},
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Hva leter du etter?" }),
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_globalNavigation_globalNavigationSearchField.SearchField, { ref: searchFieldRef }),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
Search.displayName = "Search";
|
|
118
|
+
const ShoppingCart = React.forwardRef(() => {
|
|
119
|
+
const rootContext = React.useContext(RootContext);
|
|
120
|
+
const shoppingCartContent = rootContext == null ? void 0 : rootContext.shoppingCart;
|
|
121
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { children: [
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "cart", size: "sm" }),
|
|
124
|
+
" Handlekurv"
|
|
125
|
+
] }) }) }),
|
|
126
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { children: [
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Handlekurv" }),
|
|
129
|
+
shoppingCartContent ? shoppingCartContent : null,
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
131
|
+
] })
|
|
132
|
+
] });
|
|
133
|
+
});
|
|
134
|
+
ShoppingCart.displayName = "ShoppingCart";
|
|
135
|
+
const Desktop = React.forwardRef(() => {
|
|
136
|
+
const rootContext = React.useContext(RootContext);
|
|
137
|
+
if (!rootContext)
|
|
138
|
+
return null;
|
|
139
|
+
const { setSelectedMenuItem, linkComponent: Link } = rootContext;
|
|
140
|
+
const currentLocation = rootContext.pathname;
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuList, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuTrigger, { value: link.name, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link, { children: link.name }) }) }, link.name)) }),
|
|
143
|
+
components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.List, { value: link.name, children: [
|
|
144
|
+
link.links.map((subLink) => /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.Item, { value: subLink.name, children: [
|
|
145
|
+
subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
+
"img",
|
|
147
|
+
{
|
|
148
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
149
|
+
draggable: "false",
|
|
150
|
+
alt: "Telia logo"
|
|
151
|
+
}
|
|
152
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
153
|
+
"img",
|
|
154
|
+
{
|
|
155
|
+
src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
|
|
156
|
+
draggable: "false",
|
|
157
|
+
alt: "Telia logo"
|
|
158
|
+
}
|
|
159
|
+
) }) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
160
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Trigger,
|
|
161
|
+
{
|
|
162
|
+
asChild: true,
|
|
163
|
+
active: currentLocation === subLink.link,
|
|
164
|
+
onClick: () => {
|
|
165
|
+
rootContext.setPathname(subLink.link);
|
|
166
|
+
},
|
|
167
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: subLink.links.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
171
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
172
|
+
{
|
|
173
|
+
asChild: true,
|
|
174
|
+
active: currentLocation === subSubLink.link,
|
|
175
|
+
onClick: () => {
|
|
176
|
+
rootContext.setPathname(subSubLink.link);
|
|
177
|
+
},
|
|
178
|
+
variant: "small",
|
|
179
|
+
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: subSubLink.link, children: subSubLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: subSubLink.name })
|
|
180
|
+
}
|
|
181
|
+
) }, subSubLink.name)) }) })
|
|
182
|
+
] }, subLink.name)),
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
|
|
184
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Search, {}) }),
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
|
|
187
|
+
] }, link.name)),
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Viewport, {})
|
|
189
|
+
] });
|
|
190
|
+
});
|
|
191
|
+
Desktop.displayName = "Desktop";
|
|
192
|
+
const Mobile = React.forwardRef(({ className }) => {
|
|
193
|
+
const rootContext = React.useContext(RootContext);
|
|
194
|
+
const drawerRef = React.useRef(null);
|
|
195
|
+
if (!rootContext)
|
|
196
|
+
return null;
|
|
197
|
+
const { linkComponent: NavLink } = rootContext;
|
|
198
|
+
const classes = clsx([styles[`${rootClassName}__mobile`]], className);
|
|
199
|
+
const linkClasses = clsx([styles[`${rootClassName}__link`]]);
|
|
200
|
+
const currentLocation = rootContext.pathname;
|
|
201
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200", children: [
|
|
202
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { flexShrink: "0", children: /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: rootContext.appKey === "open-pages" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: "/", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: "/", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { size: "lg", name: "telia-logo", "aria-label": "Telia logo" }) }) }) }),
|
|
203
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: [
|
|
204
|
+
/* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}),
|
|
205
|
+
/* @__PURE__ */ jsxRuntime.jsx(MyPages, {}),
|
|
206
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { children: [
|
|
207
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "menu", size: "sm" }),
|
|
209
|
+
" Meny"
|
|
210
|
+
] }) }) }),
|
|
211
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { gap: "400", children: [
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { ref: drawerRef, slot: "floating", "aria-label": "Lukk" }),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Meny" }),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_globalNavigation_globalNavigationSearchField.SearchField, {}),
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs, { value: rootContext.selectedDomainItem, onValueChange: rootContext.setSelectedDomainItem, children: [
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: link.name, children: link.name }, link.name)) }),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
218
|
+
components_accordion_index.Accordion,
|
|
219
|
+
{
|
|
220
|
+
type: "single",
|
|
221
|
+
collapsible: true,
|
|
222
|
+
value: rootContext.selectedMenuItem,
|
|
223
|
+
onValueChange: rootContext.setSelectedMenuItem,
|
|
224
|
+
children: link.links.filter((l) => l.name !== "Logo").map((subLink) => /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Item, { value: subLink.name, children: [
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Header, { children: [
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
227
|
+
components_link_link.Link,
|
|
228
|
+
{
|
|
229
|
+
className: linkClasses,
|
|
230
|
+
href: "#",
|
|
231
|
+
variant: "standalone",
|
|
232
|
+
asChild: true,
|
|
233
|
+
onClick: () => {
|
|
234
|
+
var _a;
|
|
235
|
+
(_a = drawerRef.current) == null ? void 0 : _a.click();
|
|
236
|
+
rootContext.setSelectedMenuItem(subLink.name);
|
|
237
|
+
rootContext.setPathname(subLink.link);
|
|
238
|
+
},
|
|
239
|
+
children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(components_visuallyHidden_visuallyHidden.VisuallyHidden, { children: [
|
|
243
|
+
subLink.name,
|
|
244
|
+
" linker"
|
|
245
|
+
] }) })
|
|
246
|
+
] }),
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List, { gap: "10", pl: "25", children: subLink.links.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
components_navigationMenu_navigationMenu.NavigationMenu.Link,
|
|
249
|
+
{
|
|
250
|
+
asChild: true,
|
|
251
|
+
variant: "small",
|
|
252
|
+
active: currentLocation === subSubLink.link,
|
|
253
|
+
onClick: () => {
|
|
254
|
+
var _a;
|
|
255
|
+
(_a = drawerRef.current) == null ? void 0 : _a.click();
|
|
256
|
+
rootContext.setPathname(subSubLink.link);
|
|
257
|
+
},
|
|
258
|
+
children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", children: [
|
|
259
|
+
subSubLink.name,
|
|
260
|
+
" ",
|
|
261
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
262
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", children: [
|
|
263
|
+
subSubLink.name,
|
|
264
|
+
" ",
|
|
265
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
|
|
266
|
+
] }) })
|
|
267
|
+
}
|
|
268
|
+
) }, subSubLink.name)) }) })
|
|
269
|
+
] }, subLink.name))
|
|
270
|
+
}
|
|
271
|
+
) }, link.name)) })
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "content", children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { children: "Lukk" }) }) })
|
|
274
|
+
] })
|
|
275
|
+
] })
|
|
276
|
+
] })
|
|
277
|
+
] }) });
|
|
278
|
+
});
|
|
279
|
+
Mobile.displayName = "Mobile";
|
|
280
|
+
const rootClassName = "teddy-global-navigation";
|
|
281
|
+
const RootContext = React.createContext(null);
|
|
282
|
+
function Root({
|
|
283
|
+
className,
|
|
284
|
+
appKey,
|
|
285
|
+
loggedInUser,
|
|
286
|
+
linkComponent,
|
|
287
|
+
onLogoutClick,
|
|
288
|
+
shoppingCart,
|
|
289
|
+
...props
|
|
290
|
+
}) {
|
|
291
|
+
const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem());
|
|
292
|
+
const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain());
|
|
293
|
+
const [pathname, setPathname] = React.useState(typeof window !== "undefined" ? window.location.pathname : "");
|
|
294
|
+
const classes = clsx([styles[`${rootClassName}`]], className);
|
|
295
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
296
|
+
RootContext.Provider,
|
|
297
|
+
{
|
|
298
|
+
value: {
|
|
299
|
+
appKey,
|
|
300
|
+
loggedInUser,
|
|
301
|
+
selectedMenuItem,
|
|
302
|
+
setSelectedMenuItem,
|
|
303
|
+
linkComponent,
|
|
304
|
+
selectedDomainItem,
|
|
305
|
+
setSelectedDomainItem,
|
|
306
|
+
pathname,
|
|
307
|
+
setPathname,
|
|
308
|
+
onLogoutClick,
|
|
309
|
+
shoppingCart
|
|
310
|
+
},
|
|
311
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
312
|
+
components_navigationMenu_navigationMenu.NavigationMenu,
|
|
313
|
+
{
|
|
314
|
+
topMenuValue: selectedDomainItem,
|
|
315
|
+
onTopMenuValueChange: setSelectedDomainItem,
|
|
316
|
+
value: selectedMenuItem,
|
|
317
|
+
onValueChange: (v) => {
|
|
318
|
+
if (v === "")
|
|
319
|
+
return;
|
|
320
|
+
setSelectedMenuItem(v);
|
|
321
|
+
},
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { display: { sm: "none", lg: "block" }, children: /* @__PURE__ */ jsxRuntime.jsx(Desktop, {}) }),
|
|
324
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { display: { lg: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(Mobile, {}) })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
) })
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
Root.displayName = "Root";
|
|
332
|
+
function getInitialDomain() {
|
|
333
|
+
const currentLocation = typeof window !== "undefined" ? window.location.pathname : null;
|
|
334
|
+
if (!currentLocation)
|
|
335
|
+
return components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
|
|
336
|
+
const locationArray = currentLocation ? currentLocation.split("/") : [];
|
|
337
|
+
const domainPartOfLocation = `/${locationArray[1]}`;
|
|
338
|
+
const initDomain = domainPartOfLocation === components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.link ? components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.name : domainPartOfLocation === components_navigationMenu_globalNavigation_utils.MDU_LINKS.link ? components_navigationMenu_globalNavigation_utils.MDU_LINKS.name : components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
|
|
339
|
+
return initDomain;
|
|
340
|
+
}
|
|
341
|
+
function getInitialMenuItem() {
|
|
342
|
+
var _a, _b, _c;
|
|
343
|
+
const currentLocation = typeof window !== "undefined" ? window.location.pathname : null;
|
|
344
|
+
if (!currentLocation)
|
|
345
|
+
return;
|
|
346
|
+
const locationArray = currentLocation ? currentLocation.split("/") : [];
|
|
347
|
+
const initialDomain = getInitialDomain();
|
|
348
|
+
if (initialDomain === "Bedrift") {
|
|
349
|
+
const mainMenuPartOfLocation2 = locationArray[2];
|
|
350
|
+
return (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}`)) == null ? void 0 : _a.name;
|
|
351
|
+
}
|
|
352
|
+
if (initialDomain === "Borettslag") {
|
|
353
|
+
const mainMenuPartOfLocation2 = locationArray[2];
|
|
354
|
+
return (_b = components_navigationMenu_globalNavigation_utils.MDU_LINKS.links.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}`)) == null ? void 0 : _b.name;
|
|
355
|
+
}
|
|
356
|
+
const mainMenuPartOfLocation = locationArray[1];
|
|
357
|
+
return (_c = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links.find((link) => link.link === `/${mainMenuPartOfLocation}`)) == null ? void 0 : _c.name;
|
|
358
|
+
}
|
|
359
|
+
Root.displayName = "GlobalNavigation";
|
|
360
|
+
const GlobalNavigation = Root;
|
|
361
|
+
exports.Desktop = Desktop;
|
|
362
|
+
exports.GlobalNavigation = GlobalNavigation;
|
|
363
|
+
exports.Mobile = Mobile;
|
|
364
|
+
exports.MyPages = MyPages;
|
|
365
|
+
exports.Root = Root;
|
|
366
|
+
exports.RootContext = RootContext;
|
|
367
|
+
exports.Search = Search;
|
|
368
|
+
exports.ShoppingCart = ShoppingCart;
|
|
369
|
+
exports.rootClassName = rootClassName;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Drawer } from '../../drawer';
|
|
3
|
+
|
|
4
|
+
export type MyPagesProps = React.ComponentPropsWithoutRef<typeof Drawer>;
|
|
5
|
+
export declare function MyPages(props: MyPagesProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare namespace MyPages {
|
|
7
|
+
var displayName: string;
|
|
8
|
+
}
|