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