@telia/teddy 0.0.60 → 0.0.62

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 (102) hide show
  1. package/dist/components/breadcrumbs/breadcrumbs-link.d.ts +1 -1
  2. package/dist/components/breadcrumbs/index.d.ts +1 -1
  3. package/dist/components/card/card-illustration.d.ts +1 -1
  4. package/dist/components/card/card-link.d.ts +1 -1
  5. package/dist/components/card/index.d.ts +2 -2
  6. package/dist/components/chip/chip-indicator.d.ts +1 -1
  7. package/dist/components/chip/index.d.ts +1 -1
  8. package/dist/components/expandable-card/expandable-card-button.d.ts +3 -3
  9. package/dist/components/expandable-card/index.d.ts +4 -4
  10. package/dist/components/index.cjs +11 -4
  11. package/dist/components/index.d.ts +2 -0
  12. package/dist/components/index.js +9 -5
  13. package/dist/components/modal/modal.cjs +3 -2
  14. package/dist/components/modal/modal.js +3 -2
  15. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop-simplified.cjs +2 -3
  16. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop-simplified.js +2 -3
  17. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.cjs +2 -3
  18. package/dist/components/navigation-menu/global-navigation/global-navigation-desktop.js +1 -2
  19. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile-simplified.cjs +2 -3
  20. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile-simplified.js +2 -3
  21. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.cjs +2 -3
  22. package/dist/components/navigation-menu/global-navigation/global-navigation-mobile.js +2 -3
  23. package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.cjs +12 -682
  24. package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.js +12 -682
  25. package/dist/components/navigation-menu/global-navigation/global-navigation-root.cjs +4 -5
  26. package/dist/components/navigation-menu/global-navigation/global-navigation-root.js +4 -5
  27. package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.cjs +2 -2
  28. package/dist/components/navigation-menu/global-navigation/global-navigation-search-field.js +2 -2
  29. package/dist/components/navigation-menu/global-navigation/global-navigation-search.cjs +2 -3
  30. package/dist/components/navigation-menu/global-navigation/global-navigation-search.js +2 -3
  31. package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.cjs +2 -3
  32. package/dist/components/navigation-menu/global-navigation/global-navigation-shopping-cart.js +2 -3
  33. package/dist/components/navigation-menu/global-navigation/index.cjs +2 -2
  34. package/dist/components/navigation-menu/global-navigation/index.js +1 -1
  35. package/dist/components/navigation-menu/index.cjs +3 -4
  36. package/dist/components/navigation-menu/index.js +2 -3
  37. package/dist/components/navigation-menu/navigation-menu.cjs +55 -436
  38. package/dist/components/navigation-menu/navigation-menu.d.ts +9 -1
  39. package/dist/components/navigation-menu/navigation-menu.js +55 -419
  40. package/dist/components/notabene/notabene-icon.d.ts +1 -1
  41. package/dist/components/notification/notification.d.ts +1 -1
  42. package/dist/components/radio-card-group/radio-card-group-content.cjs +3 -2
  43. package/dist/components/radio-card-group/radio-card-group-content.js +3 -2
  44. package/dist/components/radio-card-group/radio-card-group-item-body.cjs +3 -2
  45. package/dist/components/radio-card-group/radio-card-group-item-body.js +3 -2
  46. package/dist/components/radio-card-group/radio-card-group-item-title.cjs +1137 -51
  47. package/dist/components/radio-card-group/radio-card-group-item-title.js +1148 -63
  48. package/dist/components/radio-card-group/radio-card-group-item.cjs +3 -2
  49. package/dist/components/radio-card-group/radio-card-group-item.js +3 -2
  50. package/dist/components/scroll-area/index.d.ts +3 -3
  51. package/dist/components/scroll-area/scroll-area-button.d.ts +3 -3
  52. package/dist/components/tabs/index.d.ts +3 -3
  53. package/dist/components/tabs/tabs-scroll-button.d.ts +3 -3
  54. package/dist/components/text-field/index.d.ts +2 -2
  55. package/dist/components/text-field/text-field-button.d.ts +2 -2
  56. package/dist/components/toast/index.cjs +10 -0
  57. package/dist/components/toast/index.d.ts +9 -0
  58. package/dist/components/toast/index.js +7 -0
  59. package/dist/components/toast/toast-root.cjs +121 -0
  60. package/dist/components/toast/toast-root.d.ts +9 -0
  61. package/dist/components/toast/toast-root.js +121 -0
  62. package/dist/components/toggle/toggle.d.ts +1 -1
  63. package/dist/components/toggletip/index.cjs +31 -0
  64. package/dist/components/toggletip/index.d.ts +33 -0
  65. package/dist/components/toggletip/index.js +31 -0
  66. package/dist/components/toggletip/toggletip-anchor.cjs +33 -0
  67. package/dist/components/toggletip/toggletip-anchor.d.ts +6 -0
  68. package/dist/components/toggletip/toggletip-anchor.js +16 -0
  69. package/dist/components/toggletip/toggletip-arrow.cjs +38 -0
  70. package/dist/components/toggletip/toggletip-arrow.d.ts +6 -0
  71. package/dist/components/toggletip/toggletip-arrow.js +21 -0
  72. package/dist/components/toggletip/toggletip-close.cjs +48 -0
  73. package/dist/components/toggletip/toggletip-close.d.ts +10 -0
  74. package/dist/components/toggletip/toggletip-close.js +31 -0
  75. package/dist/components/toggletip/toggletip-content.cjs +80 -0
  76. package/dist/components/toggletip/toggletip-content.d.ts +16 -0
  77. package/dist/components/toggletip/toggletip-content.js +63 -0
  78. package/dist/components/toggletip/toggletip-footer.cjs +10 -0
  79. package/dist/components/toggletip/toggletip-footer.d.ts +6 -0
  80. package/dist/components/toggletip/toggletip-footer.js +10 -0
  81. package/dist/components/toggletip/toggletip-heading.cjs +25 -0
  82. package/dist/components/toggletip/toggletip-heading.d.ts +6 -0
  83. package/dist/components/toggletip/toggletip-heading.js +25 -0
  84. package/dist/components/toggletip/toggletip-portal.cjs +31 -0
  85. package/dist/components/toggletip/toggletip-portal.d.ts +11 -0
  86. package/dist/components/toggletip/toggletip-portal.js +14 -0
  87. package/dist/components/toggletip/toggletip-root.cjs +36 -0
  88. package/dist/components/toggletip/toggletip-root.d.ts +26 -0
  89. package/dist/components/toggletip/toggletip-root.js +19 -0
  90. package/dist/components/toggletip/toggletip-trigger.cjs +33 -0
  91. package/dist/components/toggletip/toggletip-trigger.d.ts +10 -0
  92. package/dist/components/toggletip/toggletip-trigger.js +16 -0
  93. package/dist/components/tooltip/index.d.ts +3 -3
  94. package/dist/main.cjs +11 -4
  95. package/dist/main.js +9 -5
  96. package/dist/style.css +3458 -2751
  97. package/dist/toggletip.module-A6XIfaD_.cjs +10 -0
  98. package/dist/toggletip.module-BUx6_4pv.js +11 -0
  99. package/dist/utils/generate-styling/grid.d.ts +24 -24
  100. package/dist/utils/generate-styling/index.d.ts +16 -16
  101. package/dist/utils/generate-styling/util.d.ts +2 -2
  102. package/package.json +17 -15
@@ -1,685 +1,15 @@
1
1
  "use strict";
2
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");
3
+ require("react/jsx-runtime");
4
+ require("react");
5
+ require("../../drawer/index.cjs");
6
+ const components_radioCardGroup_radioCardGroupItemTitle = require("../../radio-card-group/radio-card-group-item-title.cjs");
10
7
  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_textField_index = require("../../text-field/index.cjs");
18
- const utils_composeRefs = require("../../../utils/composeRefs.cjs");
19
- require("../../badge/badge.cjs");
20
- require("../../badge/alert-badge.cjs");
21
- const components_badge_counterBadge = require("../../badge/counter-badge.cjs");
22
- const utils_useSize = require("../../../utils/useSize.cjs");
23
- const utils_generateStyling_index = require("../../../utils/generate-styling/index.cjs");
24
- const utils_useCallbackRef = require("../../../utils/useCallbackRef.cjs");
25
- const tokens_motion_variables = require("../../../tokens/motion/variables.cjs");
26
- const components_flex_flex = require("../../flex/flex.cjs");
27
- const components_accordion_index = require("../../accordion/index.cjs");
28
- const components_visuallyHidden_visuallyHidden = require("../../visually-hidden/visually-hidden.cjs");
29
- const components_link_link = require("../../link/link.cjs");
30
- const components_list_index = require("../../list/index.cjs");
31
- const styles = {
32
- "teddy-global-navigation": "_teddy-global-navigation_1m6ra_1",
33
- "teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-trigger_1m6ra_6",
34
- "teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-header_1m6ra_9",
35
- "teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_1m6ra_6",
36
- "teddy-global-navigation__link": "_teddy-global-navigation__link_1m6ra_26",
37
- "teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_1m6ra_29",
38
- "teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_1m6ra_32",
39
- "teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_1m6ra_36",
40
- "teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_1m6ra_43",
41
- "close-viewport": "_close-viewport_1m6ra_1",
42
- "teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_1m6ra_54",
43
- "teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-look_1m6ra_64",
44
- "teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-look_1m6ra_80"
45
- };
46
- function MyPages(props) {
47
- var _a, _b;
48
- const rootContext = React.useContext(RootContext);
49
- const isLoggedIn = (((_a = rootContext == null ? void 0 : rootContext.loggedInUser) == null ? void 0 : _a.name.length) || 0) > 0;
50
- return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
51
- /* @__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", { "data-di-mask": true, children: [
52
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "end-user", size: "sm" }),
53
- rootContext.loggedInUser.name
54
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
55
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "login", size: "sm" }),
56
- "Logg inn"
57
- ] }) }) }),
58
- /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { asChild: true, size: rootContext == null ? void 0 : rootContext.drawerSize, children: [
59
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
60
- isLoggedIn ? /* @__PURE__ */ jsxRuntime.jsx(LoggedInContent, {}) : /* @__PURE__ */ jsxRuntime.jsx(LoggedOutContent, {}),
61
- /* @__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, { variant: "secondary", children: "Lukk" }) }) })
62
- ] })
63
- ] });
64
- }
65
- function LoggedOutContent() {
66
- return /* @__PURE__ */ jsxRuntime.jsxs(components_grid_grid.Grid, { gap: "400", children: [
67
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Logg inn" }),
68
- /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
69
- /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", children: "Privat" }),
70
- /* @__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: [
71
- components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.name,
72
- " ",
73
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
74
- ] }) })
75
- ] }),
76
- /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
77
- /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", children: "Bedrift" }),
78
- /* @__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: [
79
- link.name,
80
- " ",
81
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
82
- ] }) })) })
83
- ] })
84
- ] });
85
- }
86
- function LoggedInContent() {
87
- var _a;
88
- const rootContext = React.useContext(RootContext);
89
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
90
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Dine sider" }),
91
- /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs, { defaultValue: "private", children: [
92
- /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.List, { children: [
93
- /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: "private", children: "Privat" }),
94
- /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: "business", children: "Bedrift" })
95
- ] }),
96
- /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
97
- /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "private", children: [
98
- /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
99
- (_a = components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links) == null ? void 0 : _a.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))
100
- ] }),
101
- /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "business", children: [
102
- /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedriftsportaler" }),
103
- 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))
104
- ] }),
105
- /* @__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" }) })
106
- ] })
107
- ] })
108
- ] });
109
- }
110
- MyPages.displayName = "MyPages";
111
- const SearchField = React.forwardRef(
112
- (props, forwardRef) => {
113
- const ref = React.useRef(null);
114
- const context = React.useContext(RootContext);
115
- const composedRef = utils_composeRefs.useComposedRefs(forwardRef, ref);
116
- return /* @__PURE__ */ jsxRuntime.jsx(
117
- "form",
118
- {
119
- onSubmit: (e) => {
120
- var _a, _b;
121
- console.log("Search submitted,111");
122
- if (context == null ? void 0 : context.onSearchSubmit) {
123
- context.onSearchSubmit(e, (_a = ref.current) == null ? void 0 : _a.value);
124
- }
125
- if (!window || e.isDefaultPrevented())
126
- return;
127
- e.preventDefault();
128
- window.location.href = `/sok?q=${encodeURIComponent(((_b = ref.current) == null ? void 0 : _b.value) || "")}`;
129
- },
130
- children: /* @__PURE__ */ jsxRuntime.jsxs(components_textField_index.TextField, { ...props, children: [
131
- /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Label, { children: "Søk i innhold" }),
132
- /* @__PURE__ */ jsxRuntime.jsxs(components_textField_index.TextField.InputGroup, { children: [
133
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "search" }),
134
- /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Input, { ref: composedRef, placeholder: "Søk her" }),
135
- /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.ClearButton, {})
136
- ] }),
137
- /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Button, { variant: "separated", children: "Søk" })
138
- ] })
139
- }
140
- );
141
- }
142
- );
143
- SearchField.displayName = "SearchField";
144
- function Search(props) {
145
- const rootContext = React.useContext(RootContext);
146
- const searchFieldRef = React.useRef(null);
147
- return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
148
- /* @__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: [
149
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "search", size: "sm" }),
150
- " Søk"
151
- ] }) }) }),
152
- /* @__PURE__ */ jsxRuntime.jsxs(
153
- components_drawer_index.Drawer.Content,
154
- {
155
- size: rootContext == null ? void 0 : rootContext.drawerSize,
156
- onOpenAutoFocus: (e) => {
157
- var _a;
158
- e.preventDefault();
159
- (_a = searchFieldRef.current) == null ? void 0 : _a.focus();
160
- },
161
- children: [
162
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
163
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Hva leter du etter?" }),
164
- /* @__PURE__ */ jsxRuntime.jsx(SearchField, { ref: searchFieldRef }),
165
- /* @__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, { variant: "secondary", children: "Lukk" }) }) })
166
- ]
167
- }
168
- )
169
- ] });
170
- }
171
- Search.displayName = "Search";
172
- const ShoppingCart = React.forwardRef(() => {
173
- const rootContext = React.useContext(RootContext);
174
- const shoppingCartContent = rootContext == null ? void 0 : rootContext.shoppingCart;
175
- const numberOfItemsInCart = (rootContext == null ? void 0 : rootContext.shoppingCartNumberOfItems) || 0;
176
- const titleSuffix = numberOfItemsInCart > 0 ? `(${numberOfItemsInCart})` : "";
177
- if (!numberOfItemsInCart)
178
- return null;
179
- return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { open: rootContext == null ? void 0 : rootContext.isCartOpen, onOpenChange: rootContext == null ? void 0 : rootContext.onCartOpenChange, children: [
180
- /* @__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: [
181
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx([styles[`${rootClassName}__item-wrapper`]]), children: [
182
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "cart", size: "sm" }),
183
- numberOfItemsInCart > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: clsx([styles[`${rootClassName}__item-count`]]), children: /* @__PURE__ */ jsxRuntime.jsx(components_badge_counterBadge.CounterBadge, { variant: "attention", children: numberOfItemsInCart }) })
184
- ] }),
185
- "Handlekurv"
186
- ] }) }) }),
187
- /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { size: rootContext == null ? void 0 : rootContext.drawerSize, children: [
188
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
189
- /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Title, { children: [
190
- "Handlekurv ",
191
- titleSuffix
192
- ] }),
193
- shoppingCartContent ? shoppingCartContent : null,
194
- /* @__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, { variant: "secondary", children: "Lukk" }) }) })
195
- ] })
196
- ] });
197
- });
198
- ShoppingCart.displayName = "ShoppingCart";
199
- const scrollDistanceDownThreshold = 200;
200
- const scrollDistanceUpThreshold = 50;
201
- const ANIMATION_DURATION = 300;
202
- const Desktop = React.forwardRef(() => {
203
- const rootContext = React.useContext(RootContext);
204
- const [hideMenu, setHideMenu] = React.useState(null);
205
- const lastScrollDirection = React.useRef();
206
- const scrollStartPos = React.useRef(0);
207
- const lastScrollPos = React.useRef(0);
208
- const topMenuRef = React.useRef(null);
209
- const viewPortRef = React.useRef(null);
210
- const shouldShowViewport = [...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links, ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links, ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links].some(
211
- (link) => !!components_navigationMenu_globalNavigation_utils.getActiveSubLink((rootContext == null ? void 0 : rootContext.pathname) || "", link.links) || link.links.length && link.link === (rootContext == null ? void 0 : rootContext.pathname)
212
- );
213
- const viewPortSize = utils_useSize.useSize(viewPortRef.current);
214
- const topMenuSize = utils_useSize.useSize(topMenuRef.current);
215
- const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
216
- const viewPortHeight = shouldShowViewport ? "47px" : void 0;
217
- const animationTimer = React.useRef(0);
218
- const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React.useState(false);
219
- const timerRef = React.useRef(void 0);
220
- React.useEffect(() => {
221
- timerRef.current = setTimeout(() => {
222
- setAllowAnimationOfHeight(true);
223
- }, 500);
224
- return () => {
225
- timerRef.current && clearTimeout(timerRef.current);
226
- };
227
- }, []);
228
- const handleScroll = () => {
229
- let compensateHight = 0;
230
- if (animationTimer.current > 0) {
231
- const currentTime = (/* @__PURE__ */ new Date()).getTime();
232
- if (animationTimer.current + ANIMATION_DURATION > currentTime) {
233
- compensateHight = ((topMenuSize == null ? void 0 : topMenuSize.height) || 0) + ((viewPortSize == null ? void 0 : viewPortSize.height) || 0);
234
- } else {
235
- animationTimer.current = 0;
236
- }
237
- }
238
- const scrollY = window.scrollY;
239
- const scrollDirection = scrollY > lastScrollPos.current ? "down" : "up";
240
- const scrollDistance = Math.abs(scrollStartPos.current - scrollY);
241
- if (scrollDirection !== lastScrollDirection.current) {
242
- scrollStartPos.current = scrollY;
243
- }
244
- if (!hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "down" && scrollDistance > scrollDistanceDownThreshold + compensateHight) {
245
- setHideMenu(true);
246
- const currentTime = (/* @__PURE__ */ new Date()).getTime();
247
- animationTimer.current = currentTime;
248
- }
249
- if (hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "up" && scrollDistance > scrollDistanceUpThreshold + compensateHight || scrollY === 0) {
250
- setHideMenu(false);
251
- const currentTime = (/* @__PURE__ */ new Date()).getTime();
252
- animationTimer.current = currentTime;
253
- }
254
- lastScrollDirection.current = scrollDirection;
255
- lastScrollPos.current = scrollY;
256
- };
257
- const throttledScrollHandler = useDebounceCallback(handleScroll, 5);
258
- React.useEffect(() => {
259
- window.addEventListener("scroll", throttledScrollHandler);
260
- return () => {
261
- window.removeEventListener("scroll", throttledScrollHandler);
262
- };
263
- }, [throttledScrollHandler]);
264
- if (!rootContext)
265
- return null;
266
- function resetAndShowMenu() {
267
- lastScrollDirection.current = null;
268
- scrollStartPos.current = window.scrollY;
269
- lastScrollPos.current = window.scrollY;
270
- setHideMenu(false);
271
- }
272
- const { setSelectedMenuItem, linkComponent: Link } = rootContext;
273
- const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
274
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
275
- /* @__PURE__ */ jsxRuntime.jsx(
276
- "div",
277
- {
278
- style: utils_generateStyling_index.mergeStyles(
279
- { ["--teddy-top-menu-height"]: topMenuHeight },
280
- allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
281
- ),
282
- className: styles[`${rootClassName}__top-menu-wrapper`],
283
- "data-state": hideMenu ? "closed" : "open",
284
- children: /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuList, { onFocus: resetAndShowMenu, ref: topMenuRef, children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
285
- components_navigationMenu_navigationMenu.NavigationMenu.TopMenuTrigger,
286
- {
287
- value: link.name,
288
- asChild: true,
289
- onClick: () => rootContext.setPathname(link.link),
290
- children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name })
291
- }
292
- ) }, link.name)) })
293
- }
294
- ),
295
- components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
296
- var _a;
297
- return /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.List, { onFocus: resetAndShowMenu, value: link.name, children: [
298
- (_a = link.links) == null ? void 0 : _a.map((subLink) => {
299
- var _a2, _b;
300
- return /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.Item, { value: subLink.name, children: [
301
- 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(
302
- "img",
303
- {
304
- src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
305
- draggable: "false",
306
- alt: "Telia logo"
307
- }
308
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
309
- "img",
310
- {
311
- src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
312
- draggable: "false",
313
- alt: "Telia logo"
314
- }
315
- ) }) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsxRuntime.jsx(
316
- components_navigationMenu_navigationMenu.NavigationMenu.Trigger,
317
- {
318
- asChild: true,
319
- active: currentLocation === subLink.link,
320
- onClick: () => {
321
- rootContext.setPathname(subLink.link);
322
- },
323
- 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 })
324
- }
325
- ) : /* @__PURE__ */ jsxRuntime.jsx(
326
- components_navigationMenu_navigationMenu.NavigationMenu.Link,
327
- {
328
- asChild: true,
329
- active: currentLocation === subLink.link,
330
- onClick: () => {
331
- rootContext.setPathname(subLink.link);
332
- },
333
- 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 })
334
- }
335
- ),
336
- /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: (_b = subLink.links) == null ? void 0 : _b.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
337
- components_navigationMenu_navigationMenu.NavigationMenu.Link,
338
- {
339
- asChild: true,
340
- active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
341
- onClick: () => {
342
- rootContext.setPathname(subSubLink.link);
343
- },
344
- variant: "small",
345
- 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 })
346
- }
347
- ) }, subSubLink.name)) }) })
348
- ] }, subLink.name);
349
- }),
350
- /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
351
- /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
352
- /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Search, {}) }),
353
- /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
354
- ] }, link.name);
355
- }),
356
- /* @__PURE__ */ jsxRuntime.jsx(
357
- "div",
358
- {
359
- style: utils_generateStyling_index.mergeStyles(
360
- { ["--teddy-viewport-wrapper-height"]: viewPortHeight },
361
- allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
362
- ),
363
- className: styles[`${rootClassName}__viewport-wrapper`],
364
- "data-state": hideMenu === null ? "" : hideMenu ? "closed" : "open",
365
- children: /* @__PURE__ */ jsxRuntime.jsx(
366
- components_navigationMenu_navigationMenu.NavigationMenu.Viewport,
367
- {
368
- onFocus: resetAndShowMenu,
369
- ref: viewPortRef,
370
- className: styles[`${rootClassName}__viewport`]
371
- }
372
- )
373
- }
374
- )
375
- ] });
376
- });
377
- Desktop.displayName = "Desktop";
378
- function useDebounceCallback(callback, delay) {
379
- const handleCallback = utils_useCallbackRef.useCallbackRef(callback);
380
- const debounceTimerRef = React.useRef(0);
381
- React.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
382
- return React.useCallback(() => {
383
- window.clearTimeout(debounceTimerRef.current);
384
- debounceTimerRef.current = window.setTimeout(handleCallback, delay);
385
- }, [handleCallback, delay]);
386
- }
387
- function Mobile(props) {
388
- const rootContext = React.useContext(RootContext);
389
- const drawerRef = React.useRef(null);
390
- if (!rootContext)
391
- return null;
392
- const { linkComponent: NavLink } = rootContext;
393
- const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
394
- const linkClasses = clsx([styles[`${rootClassName}__link`]]);
395
- const currentLocation = rootContext.pathname;
396
- return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200", children: [
397
- /* @__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" }) }) }) }),
398
- /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: [
399
- /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}),
400
- /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}),
401
- /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { children: [
402
- /* @__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: [
403
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "menu", size: "sm" }),
404
- " Meny"
405
- ] }) }) }),
406
- /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { gap: "400", size: rootContext.drawerSize, children: [
407
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { ref: drawerRef, slot: "floating", "aria-label": "Lukk" }),
408
- /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Meny" }),
409
- /* @__PURE__ */ jsxRuntime.jsx(SearchField, {}),
410
- /* @__PURE__ */ jsxRuntime.jsxs(
411
- components_tabs_index.Tabs,
412
- {
413
- value: rootContext.selectedDomainItem,
414
- onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
415
- children: [
416
- /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
417
- /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
418
- var _a;
419
- return /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsxRuntime.jsx(
420
- components_accordion_index.Accordion,
421
- {
422
- type: "single",
423
- collapsible: true,
424
- value: rootContext.selectedMenuItem,
425
- onValueChange: (v) => rootContext.setSelectedMenuItem(v, true),
426
- children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
427
- (subLink) => {
428
- var _a2;
429
- return subLink.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Item, { value: subLink.name, children: [
430
- /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Header, { className: styles[`${rootClassName}__mobile-header`], children: [
431
- /* @__PURE__ */ jsxRuntime.jsx(
432
- components_link_link.Link,
433
- {
434
- className: linkClasses,
435
- variant: "standalone",
436
- asChild: true,
437
- onClick: () => {
438
- var _a3;
439
- (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
440
- rootContext.setSelectedMenuItem(subLink.name);
441
- rootContext.setPathname(subLink.link);
442
- },
443
- 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 })
444
- }
445
- ),
446
- /* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Trigger, { className: styles[`${rootClassName}__mobile-trigger`], children: /* @__PURE__ */ jsxRuntime.jsxs(components_visuallyHidden_visuallyHidden.VisuallyHidden, { children: [
447
- subLink.name,
448
- " linker"
449
- ] }) })
450
- ] }),
451
- /* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List, { gap: "10", pl: "25", children: (_a2 = subLink.links) == null ? void 0 : _a2.map((subSubLink) => /* @__PURE__ */ jsxRuntime.jsx(components_list_index.List.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(
452
- components_navigationMenu_navigationMenu.NavigationMenu.Link,
453
- {
454
- asChild: true,
455
- variant: "small",
456
- active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
457
- onClick: () => {
458
- var _a3;
459
- (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
460
- rootContext.setPathname(subSubLink.link);
461
- },
462
- 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: [
463
- subSubLink.name,
464
- " ",
465
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
466
- ] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", children: [
467
- subSubLink.name,
468
- " ",
469
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
470
- ] }) })
471
- }
472
- ) }, subSubLink.name)) }) })
473
- ] }, subLink.name) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__accordion-look`], children: /* @__PURE__ */ jsxRuntime.jsx(
474
- components_link_link.Link,
475
- {
476
- className: clsx([
477
- linkClasses,
478
- styles[`${rootClassName}__mobile-link--accordion-look`]
479
- ]),
480
- variant: "standalone",
481
- asChild: true,
482
- onClick: () => {
483
- var _a3;
484
- (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
485
- rootContext.setSelectedMenuItem(subLink.name);
486
- rootContext.setPathname(subLink.link);
487
- },
488
- children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsxs(NavLink, { href: subLink.link, children: [
489
- subLink.name,
490
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
491
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("a", { href: subLink.link, children: [
492
- subLink.name,
493
- " ",
494
- /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
495
- ] })
496
- }
497
- ) }, subLink.name);
498
- }
499
- )
500
- }
501
- ) }, link.name);
502
- }) })
503
- ]
504
- }
505
- ),
506
- /* @__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, { variant: "secondary", children: "Lukk" }) }) })
507
- ] })
508
- ] })
509
- ] })
510
- ] }) });
511
- }
512
- Mobile.displayName = "Mobile";
513
- const DesktopSimplified = React.forwardRef(() => {
514
- const rootContext = React.useContext(RootContext);
515
- if (!rootContext)
516
- return null;
517
- const { setSelectedMenuItem, linkComponent: Link } = rootContext;
518
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
519
- components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
520
- var _a;
521
- return /* @__PURE__ */ jsxRuntime.jsxs(components_navigationMenu_navigationMenu.NavigationMenu.List, { value: link.name, children: [
522
- (_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { value: subLink.name, children: 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(
523
- "img",
524
- {
525
- src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
526
- draggable: "false",
527
- alt: "Telia logo"
528
- }
529
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
530
- "img",
531
- {
532
- src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
533
- draggable: "false",
534
- alt: "Telia logo"
535
- }
536
- ) }) }) }, subLink.name)),
537
- /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
538
- /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) })
539
- ] }, link.name);
540
- }),
541
- /* @__PURE__ */ jsxRuntime.jsx(components_navigationMenu_navigationMenu.NavigationMenu.Viewport, { className: styles[`${rootClassName}__viewport`] })
542
- ] });
543
- });
544
- DesktopSimplified.displayName = "DesktopSimplified";
545
- function MobileSimplified(props) {
546
- const rootContext = React.useContext(RootContext);
547
- if (!rootContext)
548
- return null;
549
- const { linkComponent: NavLink } = rootContext;
550
- const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
551
- return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexGrow: "1", justify: "between", align: "center", gap: "200", children: [
552
- /* @__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" }) }) }) }),
553
- /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) })
554
- ] }) });
555
- }
556
- MobileSimplified.displayName = "MobileSimplified";
557
- const rootClassName = "teddy-global-navigation";
558
- const RootContext = React.createContext(null);
559
- function Root({
560
- className,
561
- appKey,
562
- loggedInUser,
563
- linkComponent,
564
- onLogoutClick,
565
- shoppingCart,
566
- shoppingCartNumberOfItems,
567
- onSearchSubmit,
568
- isCartOpen,
569
- onCartOpenChange,
570
- drawerSize = "md",
571
- isSimplified,
572
- currentPath,
573
- ...props
574
- }) {
575
- const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
576
- const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
577
- const [pathname, setPathname] = React.useState(currentPath || "");
578
- const classes = clsx([styles[`${rootClassName}`]], className);
579
- return /* @__PURE__ */ jsxRuntime.jsx(
580
- RootContext.Provider,
581
- {
582
- value: {
583
- appKey,
584
- loggedInUser,
585
- selectedMenuItem,
586
- setSelectedMenuItem(v, onlyStateChange) {
587
- if (appKey === "open-pages" && !onlyStateChange)
588
- return;
589
- setSelectedMenuItem(v);
590
- },
591
- linkComponent,
592
- selectedDomainItem,
593
- setSelectedDomainItem(v, onlyStateChange) {
594
- if (appKey === "open-pages" && !onlyStateChange)
595
- return;
596
- setSelectedDomainItem(v);
597
- },
598
- pathname,
599
- setPathname(v) {
600
- if (appKey === "open-pages")
601
- return;
602
- setPathname(v);
603
- },
604
- onLogoutClick,
605
- shoppingCart,
606
- shoppingCartNumberOfItems,
607
- onSearchSubmit,
608
- isCartOpen,
609
- onCartOpenChange,
610
- drawerSize
611
- },
612
- children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
613
- components_navigationMenu_navigationMenu.NavigationMenu,
614
- {
615
- topMenuValue: selectedDomainItem,
616
- onTopMenuValueChange: setSelectedDomainItem,
617
- value: selectedMenuItem,
618
- onValueChange: (v) => {
619
- if (v === "" || appKey === "open-pages")
620
- return;
621
- setSelectedMenuItem(v);
622
- },
623
- children: [
624
- /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { sm: "none", lg: "block" }, children: [
625
- isSimplified && /* @__PURE__ */ jsxRuntime.jsx(DesktopSimplified, {}),
626
- !isSimplified && /* @__PURE__ */ jsxRuntime.jsx(Desktop, {})
627
- ] }),
628
- /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { lg: "none" }, children: [
629
- isSimplified && /* @__PURE__ */ jsxRuntime.jsx(MobileSimplified, {}),
630
- !isSimplified && /* @__PURE__ */ jsxRuntime.jsx(Mobile, {})
631
- ] })
632
- ]
633
- }
634
- ) })
635
- }
636
- );
637
- }
638
- Root.displayName = "Root";
639
- function getInitialDomain(currentPath) {
640
- if (!currentPath)
641
- return components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
642
- const locationArray = currentPath ? currentPath.split("/") : [];
643
- const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
644
- 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;
645
- return initDomain;
646
- }
647
- function getInitialMenuItem(currentPath) {
648
- var _a, _b, _c, _d, _e, _f;
649
- if (!currentPath)
650
- return;
651
- const locationArray = currentPath ? currentPath.split("/") : [];
652
- const initialDomain = getInitialDomain(currentPath);
653
- if (initialDomain === "Bedrift") {
654
- const mainMenuPartOfLocation2 = locationArray[2];
655
- return (_b = (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links) == null ? void 0 : _a.find(
656
- (link) => {
657
- var _a2;
658
- return link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`));
659
- }
660
- )) == null ? void 0 : _b.name;
661
- }
662
- if (initialDomain === "Borettslag") {
663
- const mainMenuPartOfLocation2 = locationArray[2];
664
- return (_d = (_c = components_navigationMenu_globalNavigation_utils.MDU_LINKS.links) == null ? void 0 : _c.find((link) => link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`)) == null ? void 0 : _d.name;
665
- }
666
- const mainMenuPartOfLocation = locationArray[1];
667
- return (_f = (_e = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
668
- var _a2;
669
- return link.link === `/${mainMenuPartOfLocation}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
670
- })) == null ? void 0 : _f.name;
671
- }
672
- Root.displayName = "GlobalNavigation";
673
- const GlobalNavigation = Root;
674
- exports.Desktop = Desktop;
675
- exports.DesktopSimplified = DesktopSimplified;
676
- exports.GlobalNavigation = GlobalNavigation;
677
- exports.Mobile = Mobile;
678
- exports.MobileSimplified = MobileSimplified;
679
- exports.MyPages = MyPages;
680
- exports.Root = Root;
681
- exports.RootContext = RootContext;
682
- exports.Search = Search;
683
- exports.SearchField = SearchField;
684
- exports.ShoppingCart = ShoppingCart;
685
- exports.rootClassName = rootClassName;
8
+ require("../../icon/icon.cjs");
9
+ require("../../button/button.cjs");
10
+ require("../../grid/grid.cjs");
11
+ require("../../heading/heading.cjs");
12
+ require("../../text-spacing/text-spacing.cjs");
13
+ require("../../tabs/index.cjs");
14
+ require("./utils.cjs");
15
+ exports.MyPages = components_radioCardGroup_radioCardGroupItemTitle.MyPages;