@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
@@ -2,40 +2,49 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
- const DrawerPrimitive = require("@radix-ui/react-dialog");
5
+ const clsx = require("clsx");
6
+ const components_navigationMenu_globalNavigation_utils = require("../navigation-menu/global-navigation/utils.cjs");
7
+ const NavigationMenuPrimitive = require("@radix-ui/react-navigation-menu");
8
+ const utils_composeRefs = require("../../utils/composeRefs.cjs");
9
+ const components_visuallyHidden_visuallyHidden = require("../visually-hidden/visually-hidden.cjs");
10
+ const utils_composeEventHandlers = require("../../utils/composeEventHandlers.cjs");
11
+ const reactSlot = require("@radix-ui/react-slot");
12
+ const reactUseControllableState = require("@radix-ui/react-use-controllable-state");
13
+ const utils_generateStyling_index = require("../../utils/generate-styling/index.cjs");
14
+ const tokens_motion_variables = require("../../tokens/motion/variables.cjs");
15
+ require("../toast/toast-root.cjs");
16
+ require("sonner");
17
+ require("../toggletip/index.cjs");
6
18
  require("../breadcrumbs/index.cjs");
7
19
  const components_radioCardGroup_radioCardGroupRoot = require("./radio-card-group-root.cjs");
8
20
  const components_radioCardGroup_radioCardGroupLabel = require("./radio-card-group-label.cjs");
9
- const clsx = require("clsx");
10
- const reactSlot = require("@radix-ui/react-slot");
11
21
  require("../ribbon/index.cjs");
12
22
  require("../expandable-card/index.cjs");
13
23
  require("../color-dot/color-dot-root.cjs");
14
24
  require("../progress-bar/progress-bar.cjs");
15
25
  require("../notabene/index.cjs");
16
26
  require("../tooltip/index.cjs");
17
- require("../list/index.cjs");
27
+ const components_list_index = require("../list/index.cjs");
18
28
  require("../scroll-area/index.cjs");
19
- require("../tabs/index.cjs");
20
- require("../drawer/index.cjs");
29
+ const components_tabs_index = require("../tabs/index.cjs");
30
+ const components_drawer_index = require("../drawer/index.cjs");
21
31
  require("../image/image.cjs");
22
32
  require("../chip/index.cjs");
23
33
  require("../../assets/sprite.269ba410-teddy.svg");
34
+ const DrawerPrimitive = require("@radix-ui/react-dialog");
24
35
  const components_icon_icon = require("../icon/icon.cjs");
25
36
  require("../notification/notification.cjs");
26
37
  require("../radio-group/index.cjs");
27
- require("../box/box.cjs");
38
+ const components_box_box = require("../box/box.cjs");
28
39
  const components_flex_flex = require("../flex/flex.cjs");
29
40
  require("../card/index.cjs");
30
- require("../grid/grid.cjs");
31
- require("../navigation-menu/navigation-menu.cjs");
32
- require("../navigation-menu/global-navigation/global-navigation-my-pages.cjs");
41
+ const components_grid_grid = require("../grid/grid.cjs");
33
42
  require("../toggle/toggle.cjs");
34
- require("../accordion/index.cjs");
35
- require("../link/link.cjs");
43
+ const components_accordion_index = require("../accordion/index.cjs");
44
+ const components_link_link = require("../link/link.cjs");
36
45
  require("../badge/badge.cjs");
37
46
  require("../badge/alert-badge.cjs");
38
- require("../badge/counter-badge.cjs");
47
+ const components_badge_counterBadge = require("../badge/counter-badge.cjs");
39
48
  const components_button_button = require("../button/button.cjs");
40
49
  require("../field-error-text/field-error-text.cjs");
41
50
  require("../helper-text/helper-text.cjs");
@@ -43,14 +52,14 @@ require("../input/index.cjs");
43
52
  require("../label/label.cjs");
44
53
  require("../spinner/spinner.cjs");
45
54
  const components_text_text = require("../text/text.cjs");
46
- require("../text-field/index.cjs");
55
+ const components_textField_index = require("../text-field/index.cjs");
47
56
  const components_heading_heading = require("../heading/heading.cjs");
48
- require("../visually-hidden/visually-hidden.cjs");
49
- require("../text-spacing/text-spacing.cjs");
57
+ const components_textSpacing_textSpacing = require("../text-spacing/text-spacing.cjs");
50
58
  require("../container/container.cjs");
51
- const utils_composeRefs = require("../../utils/composeRefs.cjs");
52
59
  const components_radioCardGroup_radioCardGroupIndicator = require("./radio-card-group-indicator.cjs");
53
60
  const RadioGroupPrimitive = require("@radix-ui/react-radio-group");
61
+ const utils_useSize = require("../../utils/useSize.cjs");
62
+ const utils_useCallbackRef = require("../../utils/useCallbackRef.cjs");
54
63
  function _interopNamespaceDefault(e) {
55
64
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
56
65
  if (e) {
@@ -67,6 +76,7 @@ function _interopNamespaceDefault(e) {
67
76
  n.default = e;
68
77
  return Object.freeze(n);
69
78
  }
79
+ const NavigationMenuPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(NavigationMenuPrimitive);
70
80
  const DrawerPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DrawerPrimitive);
71
81
  const RadioGroupPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadioGroupPrimitive);
72
82
  const Title$1 = React.forwardRef(
@@ -87,15 +97,15 @@ const Body = React.forwardRef(
87
97
  }
88
98
  );
89
99
  Body.displayName = "Body";
90
- const Content$1 = React.forwardRef(
100
+ const Content$2 = React.forwardRef(
91
101
  ({ className, children, ...props }, forwardRef) => {
92
102
  const classes = clsx([components_radioCardGroup_radioCardGroupRoot.styles[`${components_radioCardGroup_radioCardGroupRoot.rootClassName}__content-wrapper`]], className);
93
103
  return /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { direction: "column", width: "100%", gap: "50", ...props, ref: forwardRef, className: classes, children });
94
104
  }
95
105
  );
96
- Content$1.displayName = "Content";
106
+ Content$2.displayName = "Content";
97
107
  const ItemContext = React.createContext(void 0);
98
- const Item = React.forwardRef(
108
+ const Item$1 = React.forwardRef(
99
109
  ({ className, children, value, ...props }, forwardedRef) => {
100
110
  const classes = clsx([components_radioCardGroup_radioCardGroupRoot.styles[`${components_radioCardGroup_radioCardGroupRoot.rootClassName}__card-item`]], className);
101
111
  const context = React.useContext(ItemContext);
@@ -103,23 +113,23 @@ const Item = React.forwardRef(
103
113
  const id = props.id || (context == null ? void 0 : context.id);
104
114
  return /* @__PURE__ */ jsxRuntime.jsxs(RadioGroupPrimitive__namespace.Item, { value, id, ...props, asChild: false, ref, className: classes, children: [
105
115
  props.imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { className: clsx([components_radioCardGroup_radioCardGroupRoot.styles[`${components_radioCardGroup_radioCardGroupRoot.rootClassName}__illustration`]], className), justify: "center", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: props.imageUrl, alt: value }) }) : null,
106
- /* @__PURE__ */ jsxRuntime.jsx(Content$1, { children })
116
+ /* @__PURE__ */ jsxRuntime.jsx(Content$2, { children })
107
117
  ] });
108
118
  }
109
119
  );
110
- Item.displayName = "Item";
120
+ Item$1.displayName = "Item";
111
121
  components_radioCardGroup_radioCardGroupRoot.Root.displayName = "RadioCardGroup";
112
122
  components_radioCardGroup_radioCardGroupLabel.GroupLabel.displayName = "RadioCardGroup.GroupLabel";
113
- Item.displayName = "RadioCardGroup.Item";
123
+ Item$1.displayName = "RadioCardGroup.Item";
114
124
  Title$1.displayName = "RadioCardGroup.Title";
115
125
  Body.displayName = "RadioCardGroup.Body";
116
126
  const RadioCardGroup = Object.assign(components_radioCardGroup_radioCardGroupRoot.Root, {
117
127
  GroupLabel: components_radioCardGroup_radioCardGroupLabel.GroupLabel,
118
- Item,
128
+ Item: Item$1,
119
129
  Title: Title$1,
120
130
  Body
121
131
  });
122
- const styles = {
132
+ const styles$2 = {
123
133
  "teddy-modal__overlay": "_teddy-modal__overlay_3n21u_25",
124
134
  "teddy-modal__content": "_teddy-modal__content_3n21u_37",
125
135
  "teddy-modal__scroll": "_teddy-modal__scroll_3n21u_55",
@@ -136,41 +146,41 @@ const styles = {
136
146
  "modal-content-hide": "_modal-content-hide_3n21u_1",
137
147
  "teddy-overlay-no-op": "_teddy-overlay-no-op_3n21u_1"
138
148
  };
139
- const rootClassName = "teddy-modal";
140
- const RootContext = React.createContext({
149
+ const rootClassName$2 = "teddy-modal";
150
+ const RootContext$1 = React.createContext({
141
151
  imageRef: null,
142
152
  actionGroupRef: null,
143
153
  scrollRef: null
144
154
  });
145
- const Root = (props) => {
155
+ const Root$2 = (props) => {
146
156
  const imageRef = React.useRef(null);
147
157
  const actionGroupRef = React.useRef(null);
148
158
  const scrollRef = React.useRef(null);
149
- return /* @__PURE__ */ jsxRuntime.jsx(RootContext.Provider, { value: { imageRef, actionGroupRef, scrollRef }, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Root, { ...props, modal: true }) });
159
+ return /* @__PURE__ */ jsxRuntime.jsx(RootContext$1.Provider, { value: { imageRef, actionGroupRef, scrollRef }, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Root, { ...props, modal: true }) });
150
160
  };
151
- Root.displayName = "Dialog.Root";
152
- const Trigger = React.forwardRef(
161
+ Root$2.displayName = "Dialog.Root";
162
+ const Trigger$1 = React.forwardRef(
153
163
  ({ children, ...props }, forwardedRef) => /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Trigger, { ...props, ref: forwardedRef, asChild: true, children })
154
164
  );
155
- Trigger.displayName = "Dialog.Trigger";
165
+ Trigger$1.displayName = "Dialog.Trigger";
156
166
  const OverlayContext = React.createContext(false);
157
167
  const Overlay = React.forwardRef(
158
168
  ({ className, forceMount, container, ...rest }, forwardedRef) => {
159
- const classes = clsx([styles[`${rootClassName}__overlay`]], className);
169
+ const classes = clsx([styles$2[`${rootClassName$2}__overlay`]], className);
160
170
  return /* @__PURE__ */ jsxRuntime.jsx(OverlayContext.Provider, { value: true, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Portal, { container, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Overlay, { className: classes, ref: forwardedRef, ...rest }) }) });
161
171
  }
162
172
  );
163
173
  Overlay.displayName = "Dialog.Content";
164
174
  const InnerContent = React.forwardRef(
165
175
  function InnerContent2({ asChild, children, className, ...props }, forwardedRef) {
166
- const classes = clsx([styles[`${rootClassName}__scroll`]], className);
167
- const context = React.useContext(RootContext);
176
+ const classes = clsx([styles$2[`${rootClassName$2}__scroll`]], className);
177
+ const context = React.useContext(RootContext$1);
168
178
  return /* @__PURE__ */ jsxRuntime.jsx(
169
179
  DrawerPrimitive__namespace.Content,
170
180
  {
171
181
  ...props,
172
182
  ref: forwardedRef,
173
- className: clsx([styles[`${rootClassName}__content`]]),
183
+ className: clsx([styles$2[`${rootClassName$2}__content`]]),
174
184
  asChild: true,
175
185
  children: /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
176
186
  components_flex_flex.Flex,
@@ -188,7 +198,7 @@ const InnerContent = React.forwardRef(
188
198
  );
189
199
  }
190
200
  );
191
- const Content = React.forwardRef(
201
+ const Content$1 = React.forwardRef(
192
202
  ({ forceMount, ...contentProps }, forwardedRef) => {
193
203
  const hasOverlay = React.useContext(OverlayContext);
194
204
  if (!hasOverlay)
@@ -196,11 +206,11 @@ const Content = React.forwardRef(
196
206
  return /* @__PURE__ */ jsxRuntime.jsx(InnerContent, { ref: forwardedRef, ...contentProps });
197
207
  }
198
208
  );
199
- Content.displayName = "Dialog.Content";
209
+ Content$1.displayName = "Dialog.Content";
200
210
  const GroupContext = React.createContext(false);
201
211
  const Group = React.forwardRef(
202
212
  ({ className, variant, ...props }, forwardedRef) => {
203
- const strollerRef = React.useContext(RootContext).scrollRef;
213
+ const strollerRef = React.useContext(RootContext$1).scrollRef;
204
214
  const [isOverflowing, setIsOverflowing] = React.useState(false);
205
215
  React.useEffect(() => {
206
216
  if (strollerRef == null ? void 0 : strollerRef.current) {
@@ -209,11 +219,11 @@ const Group = React.forwardRef(
209
219
  }
210
220
  }, [strollerRef]);
211
221
  const classes = clsx(
212
- [styles[`${rootClassName}__group`]],
222
+ [styles$2[`${rootClassName$2}__group`]],
213
223
  {
214
- [styles[`${rootClassName}__group--action`]]: variant === "action",
215
- [styles[`${rootClassName}__group--title`]]: variant === "title",
216
- [styles[`${rootClassName}__group--scroll`]]: isOverflowing
224
+ [styles$2[`${rootClassName$2}__group--action`]]: variant === "action",
225
+ [styles$2[`${rootClassName$2}__group--title`]]: variant === "title",
226
+ [styles$2[`${rootClassName$2}__group--scroll`]]: isOverflowing
217
227
  },
218
228
  className
219
229
  );
@@ -250,19 +260,19 @@ Title.displayName = "Dialog.Title";
250
260
  const Description = React.forwardRef((props, forwardedRef) => /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { as: "p", variant: "paragraph-100", ...props, asChild: false, ref: forwardedRef }) }));
251
261
  Description.displayName = "Dialog.Description";
252
262
  const Image = React.forwardRef(({ asChild, ...props }, forwardedRef) => {
253
- const classes = clsx([styles[`${rootClassName}__image`]], props.className);
254
- const context = React.useContext(RootContext);
263
+ const classes = clsx([styles$2[`${rootClassName$2}__image`]], props.className);
264
+ const context = React.useContext(RootContext$1);
255
265
  const Comp = asChild ? reactSlot.Slot : "img";
256
266
  return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...props, className: classes, ref: utils_composeRefs.composeRefs(context.imageRef, forwardedRef) });
257
267
  });
258
268
  Image.displayName = "Dialog.Image";
259
269
  const Close = React.forwardRef(
260
270
  ({ className, ...props }, forwardedRef) => {
261
- const classes = clsx([styles[`${rootClassName}__close`]], {
262
- [styles[`${rootClassName}__close--floating`]]: props.slot === "floating",
271
+ const classes = clsx([styles$2[`${rootClassName$2}__close`]], {
272
+ [styles$2[`${rootClassName$2}__close--floating`]]: props.slot === "floating",
263
273
  className
264
274
  });
265
- const imageRef = React.useContext(RootContext).imageRef;
275
+ const imageRef = React.useContext(RootContext$1).imageRef;
266
276
  const [hasImage, setHasImage] = React.useState(false);
267
277
  React.useEffect(() => {
268
278
  if (imageRef == null ? void 0 : imageRef.current) {
@@ -273,11 +283,1087 @@ const Close = React.forwardRef(
273
283
  }
274
284
  );
275
285
  Close.displayName = "Dialog.Close";
276
- const Modal = Object.assign(Root, { Trigger, Content, Title, Overlay, Description, Close, Image, Group });
286
+ const Modal = Object.assign(Root$2, { Trigger: Trigger$1, Content: Content$1, Title, Overlay, Description, Close, Image, Group });
287
+ const scaleIn = "_scaleIn_11898_1";
288
+ const scaleOut = "_scaleOut_11898_1";
289
+ const enterFromRight = "_enterFromRight_11898_1";
290
+ const enterFromLeft = "_enterFromLeft_11898_1";
291
+ const exitToRight = "_exitToRight_11898_1";
292
+ const exitToLeft = "_exitToLeft_11898_1";
293
+ const styles$1 = {
294
+ "teddy-navigation-menu": "_teddy-navigation-menu_11898_1",
295
+ "teddy-navigation-menu__viewport": "_teddy-navigation-menu__viewport_11898_34",
296
+ "teddy-navigation-menu__separator": "_teddy-navigation-menu__separator_11898_37",
297
+ "teddy-navigation-menu__list": "_teddy-navigation-menu__list_11898_40",
298
+ "teddy-navigation-menu__top-menu-list": "_teddy-navigation-menu__top-menu-list_11898_66",
299
+ "teddy-navigation-menu__top-menu-trigger": "_teddy-navigation-menu__top-menu-trigger_11898_87",
300
+ "teddy-navigation-menu__top-menu-trigger--small": "_teddy-navigation-menu__top-menu-trigger--small_11898_106",
301
+ "teddy-navigation-menu__top-menu-trigger--button": "_teddy-navigation-menu__top-menu-trigger--button_11898_112",
302
+ "teddy-navigation-menu__content": "_teddy-navigation-menu__content_11898_187",
303
+ "teddy-navigation-menu__trigger": "_teddy-navigation-menu__trigger_11898_227",
304
+ "teddy-navigation-menu__trigger--small": "_teddy-navigation-menu__trigger--small_11898_247",
305
+ "teddy-navigation-menu__trigger--button": "_teddy-navigation-menu__trigger--button_11898_253",
306
+ "teddy-navigation-menu__link": "_teddy-navigation-menu__link_11898_321",
307
+ "teddy-navigation-menu__link--small": "_teddy-navigation-menu__link--small_11898_341",
308
+ "teddy-navigation-menu__link--button": "_teddy-navigation-menu__link--button_11898_347",
309
+ scaleIn,
310
+ scaleOut,
311
+ enterFromRight,
312
+ enterFromLeft,
313
+ exitToRight,
314
+ exitToLeft
315
+ };
316
+ const rootClassName$1 = "teddy-navigation-menu";
317
+ const NavigationMenuContext = React.createContext({
318
+ selectedTopMenu: void 0,
319
+ setSelectedTopMenu: () => {
320
+ },
321
+ contentRef: { current: null },
322
+ focusProxyRef: { current: null },
323
+ topMenuRef: { current: null },
324
+ id: "",
325
+ dir: "ltr",
326
+ orientation: "horizontal",
327
+ onEntryKeyDown: () => {
328
+ },
329
+ onFocusProxyEnter: () => {
330
+ },
331
+ onContentFocusOutside: () => {
332
+ }
333
+ });
334
+ const Root$1 = React.forwardRef(
335
+ ({ className, defaultTopMenuValue, topMenuValue, onTopMenuValueChange, ...props }, forwardRef) => {
336
+ const [selectedTopMenu, setSelectedTopMenu] = reactUseControllableState.useControllableState({
337
+ defaultProp: defaultTopMenuValue,
338
+ prop: topMenuValue,
339
+ onChange: onTopMenuValueChange
340
+ });
341
+ const contentRef = React.useRef(null);
342
+ const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React.useState(false);
343
+ const timerRef = React.useRef(void 0);
344
+ const restoreContentTabOrderRef = React.useRef(() => {
345
+ });
346
+ const focusProxyRef = React.useRef(null);
347
+ const topMenuRef = React.useRef(null);
348
+ const id = React.useId();
349
+ const handleContentEntry = React.useCallback((side = "start") => {
350
+ if (contentRef.current) {
351
+ restoreContentTabOrderRef.current();
352
+ const candidates = getTabbableCandidates(contentRef.current);
353
+ if (candidates.length)
354
+ focusFirst(side === "start" ? candidates : candidates.reverse());
355
+ }
356
+ }, []);
357
+ const handleContentExit = React.useCallback(() => {
358
+ if (contentRef.current) {
359
+ const candidates = getTabbableCandidates(contentRef.current);
360
+ if (candidates.length)
361
+ restoreContentTabOrderRef.current = removeFromTabOrder(candidates);
362
+ }
363
+ }, []);
364
+ React.useEffect(() => {
365
+ timerRef.current = setTimeout(() => {
366
+ setAllowAnimationOfHeight(true);
367
+ }, 500);
368
+ return () => {
369
+ timerRef.current && clearTimeout(timerRef.current);
370
+ };
371
+ }, []);
372
+ const classes = clsx([styles$1[`${rootClassName$1}`]], className);
373
+ return /* @__PURE__ */ jsxRuntime.jsx(
374
+ NavigationMenuContext.Provider,
375
+ {
376
+ value: {
377
+ contentRef,
378
+ focusProxyRef,
379
+ topMenuRef,
380
+ id,
381
+ dir: props.dir || "ltr",
382
+ orientation: props.orientation || "horizontal",
383
+ onEntryKeyDown: handleContentEntry,
384
+ onFocusProxyEnter: handleContentEntry,
385
+ onContentFocusOutside: handleContentExit,
386
+ selectedTopMenu,
387
+ setSelectedTopMenu
388
+ },
389
+ children: /* @__PURE__ */ jsxRuntime.jsx(
390
+ NavigationMenuPrimitive__namespace.Root,
391
+ {
392
+ ...props,
393
+ style: allowAnimationOfHeight ? utils_generateStyling_index.mergeStyles(props.style, { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 }) : props.style,
394
+ ref: forwardRef,
395
+ className: classes
396
+ }
397
+ )
398
+ }
399
+ );
400
+ }
401
+ );
402
+ Root$1.displayName = "NavigationMenu";
403
+ const TopMenuList = React.forwardRef(
404
+ ({ className, ...props }, forwardRef) => {
405
+ const classes = clsx([styles$1[`${rootClassName$1}__top-menu-list`]], className);
406
+ const context = React.useContext(NavigationMenuContext);
407
+ const ref = utils_composeRefs.useComposedRefs(context.topMenuRef, forwardRef);
408
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, ref, className: classes });
409
+ }
410
+ );
411
+ TopMenuList.displayName = "NavigationMenu.TopMenuList";
412
+ const TopMenuItem = React.forwardRef(
413
+ ({ className, ...props }, forwardRef) => {
414
+ const classes = clsx([styles$1[`${rootClassName$1}__top-menu-item`]], className);
415
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, ref: forwardRef, className: classes });
416
+ }
417
+ );
418
+ const TopMenuTrigger = React.forwardRef(
419
+ ({ className, asChild, active, ...props }, forwardRef) => {
420
+ const classes = clsx(
421
+ [styles$1[`${rootClassName$1}__top-menu-trigger`], styles$1[`${rootClassName$1}__top-menu-trigger--small`]],
422
+ className
423
+ );
424
+ const Comp = asChild ? reactSlot.Slot : "button";
425
+ const context = React.useContext(NavigationMenuContext);
426
+ const innerRef = React.useRef(null);
427
+ const ref = utils_composeRefs.useComposedRefs(innerRef, forwardRef);
428
+ const isOpen = context.selectedTopMenu === props.value;
429
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
430
+ /* @__PURE__ */ jsxRuntime.jsx(
431
+ Comp,
432
+ {
433
+ ...props,
434
+ ref,
435
+ className: classes,
436
+ "data-state": isOpen ? "open" : "closed",
437
+ "data-active": active ? "true" : void 0,
438
+ "aria-expanded": isOpen,
439
+ "aria-controls": makeContentId({ value: props.value, baseId: context.id }),
440
+ ...{ [ITEM_DATA_ATTR]: "" },
441
+ onClick: utils_composeEventHandlers.composeEventHandlers(props.onClick, () => {
442
+ context.setSelectedTopMenu(props.value);
443
+ }),
444
+ onKeyDown: utils_composeEventHandlers.composeEventHandlers(props.onKeyDown, (event) => {
445
+ var _a;
446
+ const verticalEntryKey = context.dir === "rtl" ? "ArrowLeft" : "ArrowRight";
447
+ const entryKey = { horizontal: "ArrowDown", vertical: verticalEntryKey }[context.orientation];
448
+ if (isOpen && event.key === entryKey) {
449
+ context.onEntryKeyDown();
450
+ return event.preventDefault();
451
+ }
452
+ const isFocusNavigationKey = ["Home", "End", ...ARROW_KEYS].includes(event.key);
453
+ if (isFocusNavigationKey) {
454
+ const triggers = (_a = context.topMenuRef.current) == null ? void 0 : _a.querySelectorAll(`[${ITEM_DATA_ATTR}]`);
455
+ if (!triggers)
456
+ return;
457
+ let candidateNodes = Array.from(triggers == null ? void 0 : triggers.values());
458
+ const prevItemKey = context.dir === "rtl" ? "ArrowRight" : "ArrowLeft";
459
+ const prevKeys = [prevItemKey, "ArrowUp", "End"];
460
+ if (prevKeys.includes(event.key))
461
+ candidateNodes.reverse();
462
+ if (ARROW_KEYS.includes(event.key)) {
463
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
464
+ candidateNodes = candidateNodes.slice(currentIndex + 1);
465
+ focusFirst(candidateNodes);
466
+ event.preventDefault();
467
+ }
468
+ }
469
+ })
470
+ }
471
+ ),
472
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx(
473
+ components_visuallyHidden_visuallyHidden.VisuallyHidden,
474
+ {
475
+ "aria-hidden": true,
476
+ tabIndex: 0,
477
+ ref: context.focusProxyRef,
478
+ onFocus: (event) => {
479
+ const content = context.contentRef.current;
480
+ const prevFocusedElement = event.relatedTarget;
481
+ const wasTriggerFocused = prevFocusedElement === innerRef.current;
482
+ const wasFocusFromContent = content == null ? void 0 : content.contains(prevFocusedElement);
483
+ if (wasTriggerFocused || !wasFocusFromContent) {
484
+ context.onFocusProxyEnter(wasTriggerFocused ? "start" : "end");
485
+ }
486
+ }
487
+ }
488
+ )
489
+ ] });
490
+ }
491
+ );
492
+ const List = React.forwardRef(
493
+ ({ className, variant, value, ...props }, forwardRef) => {
494
+ const classes = clsx([styles$1[`${rootClassName$1}__list`]], [styles$1[`${rootClassName$1}__list--${variant}`]], className);
495
+ const context = React.useContext(NavigationMenuContext);
496
+ const refOnOpen = utils_composeRefs.useComposedRefs(context.contentRef, forwardRef);
497
+ const hasTopMenu = context.selectedTopMenu !== void 0;
498
+ const isOpen = context.selectedTopMenu === value;
499
+ if (!isOpen)
500
+ return null;
501
+ return /* @__PURE__ */ jsxRuntime.jsx(
502
+ NavigationMenuPrimitive__namespace.List,
503
+ {
504
+ ref: hasTopMenu ? refOnOpen : forwardRef,
505
+ id: value && makeContentId({ value, baseId: context.id }),
506
+ ...props,
507
+ onKeyDown: utils_composeEventHandlers.composeEventHandlers(props.onKeyDown, (event) => {
508
+ var _a;
509
+ if (!value)
510
+ return;
511
+ const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
512
+ const isTabKey = event.key === "Tab" && !isMetaKey;
513
+ if (isTabKey) {
514
+ const candidates = getTabbableCandidates(event.currentTarget);
515
+ const focusedElement = document.activeElement;
516
+ const index = candidates.findIndex((candidate) => candidate === focusedElement);
517
+ const isMovingBackwards = event.shiftKey;
518
+ const nextCandidates = isMovingBackwards ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
519
+ if (focusFirst(nextCandidates)) {
520
+ event.preventDefault();
521
+ } else {
522
+ (_a = context.focusProxyRef.current) == null ? void 0 : _a.focus();
523
+ context.onContentFocusOutside();
524
+ }
525
+ }
526
+ }),
527
+ className: classes
528
+ }
529
+ );
530
+ }
531
+ );
532
+ List.displayName = "NavigationMenu.List";
533
+ const Separator = React.forwardRef(({ className, ...props }, forwardRef) => {
534
+ const classes = clsx(
535
+ [styles$1[`${rootClassName$1}__separator`]],
536
+ className
537
+ );
538
+ return /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { width: "100%", p: "0", m: "0", ...props, ref: forwardRef, className: classes, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("hr", {}) });
539
+ });
540
+ Separator.displayName = "NavigationMenu.Separator";
541
+ const Item = React.forwardRef(
542
+ ({ className, ...props }, forwardRef) => {
543
+ const classes = clsx([styles$1[`${rootClassName$1}__item`]], className);
544
+ return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenuPrimitive__namespace.Item, { ...props, ref: forwardRef, className: classes });
545
+ }
546
+ );
547
+ Item.displayName = "NavigationMenu.Item";
548
+ const Trigger = React.forwardRef(
549
+ ({ className, active, variant = "default", ...props }, forwardRef) => {
550
+ const classes = clsx(
551
+ [styles$1[`${rootClassName$1}__trigger`]],
552
+ [styles$1[`${rootClassName$1}__trigger--${variant}`]],
553
+ className
554
+ );
555
+ const innerRef = React.useRef(null);
556
+ const ref = utils_composeRefs.useComposedRefs(forwardRef, innerRef);
557
+ return /* @__PURE__ */ jsxRuntime.jsx(
558
+ NavigationMenuPrimitive__namespace.Trigger,
559
+ {
560
+ onPointerEnter: (e) => e.preventDefault(),
561
+ onPointerMove: (e) => e.preventDefault(),
562
+ onPointerLeave: (e) => e.preventDefault(),
563
+ ...props,
564
+ ref,
565
+ "data-active": active ? "true" : void 0,
566
+ className: classes,
567
+ "data-text": getLabelFromChildren(props.children)
568
+ }
569
+ );
570
+ }
571
+ );
572
+ Trigger.displayName = "NavigationMenu.Trigger";
573
+ const Content = React.forwardRef(
574
+ ({ className, variant = "default", ...props }, forwardRef) => {
575
+ const classes = clsx(
576
+ [styles$1[`${rootClassName$1}__content`]],
577
+ [styles$1[`${rootClassName$1}__content--${variant}`]],
578
+ className
579
+ );
580
+ return /* @__PURE__ */ jsxRuntime.jsx(
581
+ NavigationMenuPrimitive__namespace.Content,
582
+ {
583
+ onPointerEnter: (e) => e.preventDefault(),
584
+ onPointerLeave: (e) => e.preventDefault(),
585
+ ...props,
586
+ ref: forwardRef,
587
+ className: classes
588
+ }
589
+ );
590
+ }
591
+ );
592
+ const Link = React.forwardRef(
593
+ ({ className, variant = "default", ...props }, forwardRef) => {
594
+ const classes = clsx([styles$1[`${rootClassName$1}__link`]], [styles$1[`${rootClassName$1}__link--${variant}`]], className);
595
+ return /* @__PURE__ */ jsxRuntime.jsx(
596
+ NavigationMenuPrimitive__namespace.Link,
597
+ {
598
+ ...props,
599
+ ref: forwardRef,
600
+ className: classes,
601
+ "data-text": getLabelFromChildren(props.children)
602
+ }
603
+ );
604
+ }
605
+ );
606
+ Link.displayName = "NavigationMenu.Link";
607
+ const Indicator = React.forwardRef(
608
+ ({ className, ...props }, forwardRef) => {
609
+ const classes = clsx([styles$1[`${rootClassName$1}__indicator`]], className);
610
+ return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenuPrimitive__namespace.Indicator, { ...props, ref: forwardRef, className: classes });
611
+ }
612
+ );
613
+ Indicator.displayName = "NavigationMenu.Indicator";
614
+ const Viewport = React.forwardRef(
615
+ ({ className, ...props }, forwardRef) => {
616
+ const classes = clsx([styles$1[`${rootClassName$1}__viewport`]], className);
617
+ return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenuPrimitive__namespace.Viewport, { ...props, ref: forwardRef, className: classes });
618
+ }
619
+ );
620
+ Viewport.displayName = "NavigationMenu.Viewport";
621
+ const Sub = React.forwardRef(
622
+ ({ className, ...props }, forwardRef) => {
623
+ const classes = clsx([styles$1[`${rootClassName$1}__sub`]], className);
624
+ return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenuPrimitive__namespace.Sub, { ...props, ref: forwardRef, className: classes });
625
+ }
626
+ );
627
+ Sub.displayName = "NavigationMenu.Sub";
628
+ function getLabelFromChildren(children) {
629
+ function findLabel(node) {
630
+ if (typeof node === "string") {
631
+ return node;
632
+ }
633
+ if (React.isValidElement(node) && node.props.children) {
634
+ return findLabel(node.props.children);
635
+ }
636
+ if (Array.isArray(node)) {
637
+ for (let i = node.length - 1; i >= 0; i--) {
638
+ const label = findLabel(node[i]);
639
+ if (label) {
640
+ return label;
641
+ }
642
+ }
643
+ }
644
+ return void 0;
645
+ }
646
+ return findLabel(children);
647
+ }
648
+ function getTabbableCandidates(container) {
649
+ const nodes = [];
650
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
651
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
652
+ acceptNode: (node) => {
653
+ const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
654
+ if (node.disabled || node.hidden || isHiddenInput)
655
+ return NodeFilter.FILTER_SKIP;
656
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
657
+ }
658
+ });
659
+ while (walker.nextNode())
660
+ nodes.push(walker.currentNode);
661
+ return nodes;
662
+ }
663
+ function focusFirst(candidates) {
664
+ const previouslyFocusedElement = document.activeElement;
665
+ return candidates.some((candidate) => {
666
+ if (candidate === previouslyFocusedElement)
667
+ return true;
668
+ candidate.focus();
669
+ return document.activeElement !== previouslyFocusedElement;
670
+ });
671
+ }
672
+ function removeFromTabOrder(candidates) {
673
+ candidates.forEach((candidate) => {
674
+ candidate.dataset.tabindex = candidate.getAttribute("tabindex") || "";
675
+ candidate.setAttribute("tabindex", "-1");
676
+ });
677
+ return () => {
678
+ candidates.forEach((candidate) => {
679
+ const prevTabIndex = candidate.dataset.tabindex;
680
+ candidate.setAttribute("tabindex", prevTabIndex);
681
+ });
682
+ };
683
+ }
684
+ const ITEM_DATA_ATTR = "data-teddy-top-selector-trigger";
685
+ const ARROW_KEYS = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"];
686
+ function makeContentId(args) {
687
+ return `teddy-navigation-menu-${args.baseId}-${args.value}-content`;
688
+ }
689
+ const NavigationMenu = Object.assign(Root$1, {
690
+ List,
691
+ Separator,
692
+ Item,
693
+ Trigger,
694
+ Content,
695
+ Link,
696
+ Indicator,
697
+ Viewport,
698
+ Sub,
699
+ TopMenuList,
700
+ TopMenuItem,
701
+ TopMenuTrigger
702
+ });
703
+ const styles = {
704
+ "teddy-global-navigation": "_teddy-global-navigation_2fdb8_1",
705
+ "teddy-global-navigation__mobile-trigger": "_teddy-global-navigation__mobile-trigger_2fdb8_6",
706
+ "teddy-global-navigation__mobile-header": "_teddy-global-navigation__mobile-header_2fdb8_9",
707
+ "teddy-global-navigation__mobile": "_teddy-global-navigation__mobile_2fdb8_6",
708
+ "teddy-global-navigation__link": "_teddy-global-navigation__link_2fdb8_26",
709
+ "teddy-global-navigation__viewport": "_teddy-global-navigation__viewport_2fdb8_29",
710
+ "teddy-global-navigation__item-wrapper": "_teddy-global-navigation__item-wrapper_2fdb8_32",
711
+ "teddy-global-navigation__item-count": "_teddy-global-navigation__item-count_2fdb8_36",
712
+ "teddy-global-navigation__viewport-wrapper": "_teddy-global-navigation__viewport-wrapper_2fdb8_43",
713
+ "close-viewport": "_close-viewport_2fdb8_1",
714
+ "teddy-global-navigation__top-menu-color": "_teddy-global-navigation__top-menu-color_2fdb8_54",
715
+ "teddy-global-navigation__top-menu-wrapper": "_teddy-global-navigation__top-menu-wrapper_2fdb8_57",
716
+ "teddy-global-navigation__accordion-look": "_teddy-global-navigation__accordion-look_2fdb8_74",
717
+ "teddy-global-navigation__mobile-link--accordion-look": "_teddy-global-navigation__mobile-link--accordion-look_2fdb8_90"
718
+ };
719
+ function MyPages(props) {
720
+ var _a, _b;
721
+ const rootContext = React.useContext(RootContext);
722
+ const isLoggedIn = (((_a = rootContext == null ? void 0 : rootContext.loggedInUser) == null ? void 0 : _a.name.length) || 0) > 0;
723
+ return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
724
+ /* @__PURE__ */ jsxRuntime.jsx(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: [
725
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "end-user", size: "sm" }),
726
+ rootContext.loggedInUser.name
727
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
728
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "login", size: "sm" }),
729
+ "Logg inn"
730
+ ] }) }) }),
731
+ /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { asChild: true, size: rootContext == null ? void 0 : rootContext.drawerSize, children: [
732
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
733
+ isLoggedIn ? /* @__PURE__ */ jsxRuntime.jsx(LoggedInContent, {}) : /* @__PURE__ */ jsxRuntime.jsx(LoggedOutContent, {}),
734
+ /* @__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" }) }) })
735
+ ] })
736
+ ] });
737
+ }
738
+ function LoggedOutContent() {
739
+ return /* @__PURE__ */ jsxRuntime.jsxs(components_grid_grid.Grid, { gap: "400", children: [
740
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Logg inn" }),
741
+ /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
742
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", children: "Privat" }),
743
+ /* @__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: [
744
+ components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.name,
745
+ " ",
746
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
747
+ ] }) })
748
+ ] }),
749
+ /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
750
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", children: "Bedrift" }),
751
+ /* @__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: [
752
+ link.name,
753
+ " ",
754
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
755
+ ] }) })) })
756
+ ] })
757
+ ] });
758
+ }
759
+ function LoggedInContent() {
760
+ var _a;
761
+ const rootContext = React.useContext(RootContext);
762
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
763
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Dine sider" }),
764
+ /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs, { defaultValue: "private", children: [
765
+ /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.List, { children: [
766
+ /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: "private", children: "Privat" }),
767
+ /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: "business", children: "Bedrift" })
768
+ ] }),
769
+ /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
770
+ /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "private", children: [
771
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
772
+ (_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))
773
+ ] }),
774
+ /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "business", children: [
775
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedriftsportaler" }),
776
+ 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))
777
+ ] }),
778
+ /* @__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" }) })
779
+ ] })
780
+ ] })
781
+ ] });
782
+ }
783
+ MyPages.displayName = "MyPages";
784
+ const SearchField = React.forwardRef(
785
+ (props, forwardRef) => {
786
+ const ref = React.useRef(null);
787
+ const context = React.useContext(RootContext);
788
+ const composedRef = utils_composeRefs.useComposedRefs(forwardRef, ref);
789
+ return /* @__PURE__ */ jsxRuntime.jsx(
790
+ "form",
791
+ {
792
+ onSubmit: (e) => {
793
+ var _a, _b;
794
+ console.log("Search submitted,111");
795
+ if (context == null ? void 0 : context.onSearchSubmit) {
796
+ context.onSearchSubmit(e, (_a = ref.current) == null ? void 0 : _a.value);
797
+ }
798
+ if (!window || e.isDefaultPrevented())
799
+ return;
800
+ e.preventDefault();
801
+ window.location.href = `/sok?q=${encodeURIComponent(((_b = ref.current) == null ? void 0 : _b.value) || "")}`;
802
+ },
803
+ children: /* @__PURE__ */ jsxRuntime.jsxs(components_textField_index.TextField, { ...props, children: [
804
+ /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Label, { children: "Søk i innhold" }),
805
+ /* @__PURE__ */ jsxRuntime.jsxs(components_textField_index.TextField.InputGroup, { children: [
806
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "search" }),
807
+ /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Input, { ref: composedRef, placeholder: "Søk her" }),
808
+ /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.ClearButton, {})
809
+ ] }),
810
+ /* @__PURE__ */ jsxRuntime.jsx(components_textField_index.TextField.Button, { variant: "separated", children: "Søk" })
811
+ ] })
812
+ }
813
+ );
814
+ }
815
+ );
816
+ SearchField.displayName = "SearchField";
817
+ function Search(props) {
818
+ const rootContext = React.useContext(RootContext);
819
+ const searchFieldRef = React.useRef(null);
820
+ return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { ...props, children: [
821
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
822
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "search", size: "sm" }),
823
+ " Søk"
824
+ ] }) }) }),
825
+ /* @__PURE__ */ jsxRuntime.jsxs(
826
+ components_drawer_index.Drawer.Content,
827
+ {
828
+ size: rootContext == null ? void 0 : rootContext.drawerSize,
829
+ onOpenAutoFocus: (e) => {
830
+ var _a;
831
+ e.preventDefault();
832
+ (_a = searchFieldRef.current) == null ? void 0 : _a.focus();
833
+ },
834
+ children: [
835
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
836
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Hva leter du etter?" }),
837
+ /* @__PURE__ */ jsxRuntime.jsx(SearchField, { ref: searchFieldRef }),
838
+ /* @__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" }) }) })
839
+ ]
840
+ }
841
+ )
842
+ ] });
843
+ }
844
+ Search.displayName = "Search";
845
+ const ShoppingCart = React.forwardRef(() => {
846
+ const rootContext = React.useContext(RootContext);
847
+ const shoppingCartContent = rootContext == null ? void 0 : rootContext.shoppingCart;
848
+ const numberOfItemsInCart = (rootContext == null ? void 0 : rootContext.shoppingCartNumberOfItems) || 0;
849
+ const titleSuffix = numberOfItemsInCart > 0 ? `(${numberOfItemsInCart})` : "";
850
+ if (!numberOfItemsInCart)
851
+ return null;
852
+ return /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { open: rootContext == null ? void 0 : rootContext.isCartOpen, onOpenChange: rootContext == null ? void 0 : rootContext.onCartOpenChange, children: [
853
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
854
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx([styles[`${rootClassName}__item-wrapper`]]), children: [
855
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "cart", size: "sm" }),
856
+ numberOfItemsInCart > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: clsx([styles[`${rootClassName}__item-count`]]), children: /* @__PURE__ */ jsxRuntime.jsx(components_badge_counterBadge.CounterBadge, { variant: "attention", children: numberOfItemsInCart }) })
857
+ ] }),
858
+ "Handlekurv"
859
+ ] }) }) }),
860
+ /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { size: rootContext == null ? void 0 : rootContext.drawerSize, children: [
861
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { slot: "floating", "aria-label": "Lukk" }),
862
+ /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Title, { children: [
863
+ "Handlekurv ",
864
+ titleSuffix
865
+ ] }),
866
+ shoppingCartContent ? shoppingCartContent : null,
867
+ /* @__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" }) }) })
868
+ ] })
869
+ ] });
870
+ });
871
+ ShoppingCart.displayName = "ShoppingCart";
872
+ const scrollDistanceDownThreshold = 200;
873
+ const scrollDistanceUpThreshold = 50;
874
+ const ANIMATION_DURATION = 300;
875
+ const Desktop = React.forwardRef(() => {
876
+ const rootContext = React.useContext(RootContext);
877
+ const [hideMenu, setHideMenu] = React.useState(null);
878
+ const lastScrollDirection = React.useRef();
879
+ const scrollStartPos = React.useRef(0);
880
+ const lastScrollPos = React.useRef(0);
881
+ const topMenuRef = React.useRef(null);
882
+ const viewPortRef = React.useRef(null);
883
+ const shouldShowViewport = [...components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links, ...components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links, ...components_navigationMenu_globalNavigation_utils.MDU_LINKS.links].some(
884
+ (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)
885
+ );
886
+ const viewPortSize = utils_useSize.useSize(viewPortRef.current);
887
+ const topMenuSize = utils_useSize.useSize(topMenuRef.current);
888
+ const topMenuHeight = (topMenuSize == null ? void 0 : topMenuSize.height) ? `${topMenuSize.height}px` : void 0;
889
+ const viewPortHeight = shouldShowViewport ? "47px" : void 0;
890
+ const animationTimer = React.useRef(0);
891
+ const [allowAnimationOfHeight, setAllowAnimationOfHeight] = React.useState(false);
892
+ const timerRef = React.useRef(void 0);
893
+ React.useEffect(() => {
894
+ timerRef.current = setTimeout(() => {
895
+ setAllowAnimationOfHeight(true);
896
+ }, 500);
897
+ return () => {
898
+ timerRef.current && clearTimeout(timerRef.current);
899
+ };
900
+ }, []);
901
+ const handleScroll = () => {
902
+ let compensateHight = 0;
903
+ if (animationTimer.current > 0) {
904
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
905
+ if (animationTimer.current + ANIMATION_DURATION > currentTime) {
906
+ compensateHight = ((topMenuSize == null ? void 0 : topMenuSize.height) || 0) + ((viewPortSize == null ? void 0 : viewPortSize.height) || 0);
907
+ } else {
908
+ animationTimer.current = 0;
909
+ }
910
+ }
911
+ const scrollY = window.scrollY;
912
+ const scrollDirection = scrollY > lastScrollPos.current ? "down" : "up";
913
+ const scrollDistance = Math.abs(scrollStartPos.current - scrollY);
914
+ if (scrollDirection !== lastScrollDirection.current) {
915
+ scrollStartPos.current = scrollY;
916
+ }
917
+ if (!hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "down" && scrollDistance > scrollDistanceDownThreshold + compensateHight) {
918
+ setHideMenu(true);
919
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
920
+ animationTimer.current = currentTime;
921
+ }
922
+ if (hideMenu && scrollDirection === lastScrollDirection.current && scrollDirection === "up" && scrollDistance > scrollDistanceUpThreshold + compensateHight || scrollY === 0) {
923
+ setHideMenu(false);
924
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
925
+ animationTimer.current = currentTime;
926
+ }
927
+ lastScrollDirection.current = scrollDirection;
928
+ lastScrollPos.current = scrollY;
929
+ };
930
+ const throttledScrollHandler = useDebounceCallback(handleScroll, 5);
931
+ React.useEffect(() => {
932
+ window.addEventListener("scroll", throttledScrollHandler);
933
+ return () => {
934
+ window.removeEventListener("scroll", throttledScrollHandler);
935
+ };
936
+ }, [throttledScrollHandler]);
937
+ if (!rootContext)
938
+ return null;
939
+ function resetAndShowMenu() {
940
+ lastScrollDirection.current = null;
941
+ scrollStartPos.current = window.scrollY;
942
+ lastScrollPos.current = window.scrollY;
943
+ setHideMenu(false);
944
+ }
945
+ const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
946
+ const currentLocation = rootContext.pathname.endsWith("/") ? rootContext.pathname : `${rootContext.pathname}/`;
947
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
948
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__top-menu-color`], children: /* @__PURE__ */ jsxRuntime.jsx(
949
+ "div",
950
+ {
951
+ style: utils_generateStyling_index.mergeStyles(
952
+ { ["--teddy-top-menu-height"]: topMenuHeight },
953
+ allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
954
+ ),
955
+ className: styles[`${rootClassName}__top-menu-wrapper`],
956
+ "data-state": hideMenu ? "closed" : "open",
957
+ children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuList, { onFocus: resetAndShowMenu, ref: topMenuRef, children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.TopMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
958
+ NavigationMenu.TopMenuTrigger,
959
+ {
960
+ value: link.name,
961
+ asChild: true,
962
+ onClick: () => rootContext.setPathname(link.link),
963
+ children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name })
964
+ }
965
+ ) }, link.name)) })
966
+ }
967
+ ) }),
968
+ components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
969
+ var _a;
970
+ return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.List, { onFocus: resetAndShowMenu, value: link.name, children: [
971
+ (_a = link.links) == null ? void 0 : _a.map((subLink) => {
972
+ var _a2, _b;
973
+ return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.Item, { value: subLink.name, children: [
974
+ subLink.name === "Logo" ? /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
975
+ "img",
976
+ {
977
+ src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
978
+ draggable: "false",
979
+ alt: "Telia logo"
980
+ }
981
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
982
+ "img",
983
+ {
984
+ src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
985
+ draggable: "false",
986
+ alt: "Telia logo"
987
+ }
988
+ ) }) }) : ((_a2 = subLink.links) == null ? void 0 : _a2.length) ? /* @__PURE__ */ jsxRuntime.jsx(
989
+ NavigationMenu.Trigger,
990
+ {
991
+ asChild: true,
992
+ active: currentLocation === subLink.link,
993
+ onClick: () => {
994
+ rootContext.setPathname(subLink.link);
995
+ },
996
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
997
+ }
998
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
999
+ NavigationMenu.Link,
1000
+ {
1001
+ asChild: true,
1002
+ active: currentLocation === subLink.link,
1003
+ onClick: () => {
1004
+ rootContext.setPathname(subLink.link);
1005
+ },
1006
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, children: subLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, children: subLink.name })
1007
+ }
1008
+ ),
1009
+ /* @__PURE__ */ jsxRuntime.jsx(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(
1010
+ NavigationMenu.Link,
1011
+ {
1012
+ asChild: true,
1013
+ active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
1014
+ onClick: () => {
1015
+ rootContext.setPathname(subSubLink.link);
1016
+ },
1017
+ variant: "small",
1018
+ children: subSubLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subSubLink.link, children: subSubLink.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: subSubLink.name })
1019
+ }
1020
+ ) }, subSubLink.name)) }) })
1021
+ ] }, subLink.name);
1022
+ }),
1023
+ /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
1024
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) }),
1025
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Search, {}) }),
1026
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}) })
1027
+ ] }, link.name);
1028
+ }),
1029
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Separator, {}),
1030
+ /* @__PURE__ */ jsxRuntime.jsx(
1031
+ "div",
1032
+ {
1033
+ style: utils_generateStyling_index.mergeStyles(
1034
+ { ["--teddy-viewport-wrapper-height"]: viewPortHeight },
1035
+ allowAnimationOfHeight ? { ["--teddy-motion-duration-controlled"]: tokens_motion_variables.teddyMotionDuration300 } : {}
1036
+ ),
1037
+ className: styles[`${rootClassName}__viewport-wrapper`],
1038
+ "data-state": hideMenu === null ? "" : hideMenu ? "closed" : "open",
1039
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1040
+ NavigationMenu.Viewport,
1041
+ {
1042
+ onFocus: resetAndShowMenu,
1043
+ ref: viewPortRef,
1044
+ className: styles[`${rootClassName}__viewport`]
1045
+ }
1046
+ )
1047
+ }
1048
+ )
1049
+ ] });
1050
+ });
1051
+ Desktop.displayName = "Desktop";
1052
+ function useDebounceCallback(callback, delay) {
1053
+ const handleCallback = utils_useCallbackRef.useCallbackRef(callback);
1054
+ const debounceTimerRef = React.useRef(0);
1055
+ React.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
1056
+ return React.useCallback(() => {
1057
+ window.clearTimeout(debounceTimerRef.current);
1058
+ debounceTimerRef.current = window.setTimeout(handleCallback, delay);
1059
+ }, [handleCallback, delay]);
1060
+ }
1061
+ function Mobile(props) {
1062
+ const rootContext = React.useContext(RootContext);
1063
+ const drawerRef = React.useRef(null);
1064
+ if (!rootContext)
1065
+ return null;
1066
+ const { linkComponent: NavLink } = rootContext;
1067
+ const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
1068
+ const linkClasses = clsx([styles[`${rootClassName}__link`]]);
1069
+ const currentLocation = rootContext.pathname;
1070
+ 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: [
1071
+ /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { flexShrink: "0", children: /* @__PURE__ */ jsxRuntime.jsx(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" }) }) }) }),
1072
+ /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: [
1073
+ /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}),
1074
+ /* @__PURE__ */ jsxRuntime.jsx(MyPages, {}),
1075
+ /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer, { children: [
1076
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsxs("button", { children: [
1077
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "menu", size: "sm" }),
1078
+ " Meny"
1079
+ ] }) }) }),
1080
+ /* @__PURE__ */ jsxRuntime.jsxs(components_drawer_index.Drawer.Content, { gap: "400", size: rootContext.drawerSize, children: [
1081
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Close, { ref: drawerRef, slot: "floating", "aria-label": "Lukk" }),
1082
+ /* @__PURE__ */ jsxRuntime.jsx(components_drawer_index.Drawer.Title, { children: "Meny" }),
1083
+ /* @__PURE__ */ jsxRuntime.jsx(SearchField, {}),
1084
+ /* @__PURE__ */ jsxRuntime.jsxs(
1085
+ components_tabs_index.Tabs,
1086
+ {
1087
+ value: rootContext.selectedDomainItem,
1088
+ onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
1089
+ children: [
1090
+ /* @__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)) }),
1091
+ /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
1092
+ var _a;
1093
+ return /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsxRuntime.jsx(
1094
+ components_accordion_index.Accordion,
1095
+ {
1096
+ type: "single",
1097
+ collapsible: true,
1098
+ value: rootContext.selectedMenuItem,
1099
+ onValueChange: (v) => rootContext.setSelectedMenuItem(v, true),
1100
+ children: (_a = link.links) == null ? void 0 : _a.filter((l) => l.name !== "Logo").map(
1101
+ (subLink) => {
1102
+ var _a2;
1103
+ return subLink.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Item, { value: subLink.name, children: [
1104
+ /* @__PURE__ */ jsxRuntime.jsxs(components_accordion_index.Accordion.Header, { className: styles[`${rootClassName}__mobile-header`], children: [
1105
+ /* @__PURE__ */ jsxRuntime.jsx(
1106
+ components_link_link.Link,
1107
+ {
1108
+ className: linkClasses,
1109
+ variant: "standalone",
1110
+ asChild: true,
1111
+ onClick: () => {
1112
+ var _a3;
1113
+ (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
1114
+ rootContext.setSelectedMenuItem(subLink.name);
1115
+ rootContext.setPathname(subLink.link);
1116
+ },
1117
+ 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 })
1118
+ }
1119
+ ),
1120
+ /* @__PURE__ */ jsxRuntime.jsx(components_accordion_index.Accordion.Trigger, { className: styles[`${rootClassName}__mobile-trigger`], children: /* @__PURE__ */ jsxRuntime.jsxs(components_visuallyHidden_visuallyHidden.VisuallyHidden, { children: [
1121
+ subLink.name,
1122
+ " linker"
1123
+ ] }) })
1124
+ ] }),
1125
+ /* @__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(
1126
+ NavigationMenu.Link,
1127
+ {
1128
+ asChild: true,
1129
+ variant: "small",
1130
+ active: components_navigationMenu_globalNavigation_utils.getActiveSubLink(currentLocation, subLink.links || []) === subSubLink.link,
1131
+ onClick: () => {
1132
+ var _a3;
1133
+ (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
1134
+ rootContext.setPathname(subSubLink.link);
1135
+ },
1136
+ 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: [
1137
+ subSubLink.name,
1138
+ " ",
1139
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
1140
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subSubLink.link, children: /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { as: "span", gap: "100", children: [
1141
+ subSubLink.name,
1142
+ " ",
1143
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
1144
+ ] }) })
1145
+ }
1146
+ ) }, subSubLink.name)) }) })
1147
+ ] }, subLink.name) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles[`${rootClassName}__accordion-look`], children: /* @__PURE__ */ jsxRuntime.jsx(
1148
+ components_link_link.Link,
1149
+ {
1150
+ className: clsx([
1151
+ linkClasses,
1152
+ styles[`${rootClassName}__mobile-link--accordion-look`]
1153
+ ]),
1154
+ variant: "standalone",
1155
+ asChild: true,
1156
+ onClick: () => {
1157
+ var _a3;
1158
+ (_a3 = drawerRef.current) == null ? void 0 : _a3.click();
1159
+ rootContext.setSelectedMenuItem(subLink.name);
1160
+ rootContext.setPathname(subLink.link);
1161
+ },
1162
+ children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsxs(NavLink, { href: subLink.link, children: [
1163
+ subLink.name,
1164
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
1165
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("a", { href: subLink.link, children: [
1166
+ subLink.name,
1167
+ " ",
1168
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "arrow-right" })
1169
+ ] })
1170
+ }
1171
+ ) }, subLink.name);
1172
+ }
1173
+ )
1174
+ }
1175
+ ) }, link.name);
1176
+ }) })
1177
+ ]
1178
+ }
1179
+ ),
1180
+ /* @__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" }) }) })
1181
+ ] })
1182
+ ] })
1183
+ ] })
1184
+ ] }) });
1185
+ }
1186
+ Mobile.displayName = "Mobile";
1187
+ const DesktopSimplified = React.forwardRef(() => {
1188
+ const rootContext = React.useContext(RootContext);
1189
+ if (!rootContext)
1190
+ return null;
1191
+ const { setSelectedMenuItem, linkComponent: Link2 } = rootContext;
1192
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1193
+ components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
1194
+ var _a;
1195
+ return /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu.List, { value: link.name, children: [
1196
+ (_a = link.links) == null ? void 0 : _a.map((subLink) => /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { value: subLink.name, children: subLink.name === "Logo" && /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Link, { asChild: true, variant: "button", children: subLink.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
1197
+ "img",
1198
+ {
1199
+ src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
1200
+ draggable: "false",
1201
+ alt: "Telia logo"
1202
+ }
1203
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: subLink.link, onClick: () => setSelectedMenuItem(""), children: /* @__PURE__ */ jsxRuntime.jsx(
1204
+ "img",
1205
+ {
1206
+ src: "https://cdn.voca.teliacompany.com/logo/Telia-primary-default-v2.svg",
1207
+ draggable: "false",
1208
+ alt: "Telia logo"
1209
+ }
1210
+ ) }) }) }, subLink.name)),
1211
+ /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ml: "auto" }),
1212
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) })
1213
+ ] }, link.name);
1214
+ }),
1215
+ /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu.Viewport, { className: styles[`${rootClassName}__viewport`] })
1216
+ ] });
1217
+ });
1218
+ DesktopSimplified.displayName = "DesktopSimplified";
1219
+ function MobileSimplified(props) {
1220
+ const rootContext = React.useContext(RootContext);
1221
+ if (!rootContext)
1222
+ return null;
1223
+ const { linkComponent: NavLink } = rootContext;
1224
+ const classes = clsx([styles[`${rootClassName}__mobile`]], props.className);
1225
+ 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: [
1226
+ /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { flexShrink: "0", children: /* @__PURE__ */ jsxRuntime.jsx(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" }) }) }) }),
1227
+ /* @__PURE__ */ jsxRuntime.jsx(components_flex_flex.Flex, { flexBasis: "0", gap: { sm: "100", md: "200" }, children: /* @__PURE__ */ jsxRuntime.jsx(ShoppingCart, {}) })
1228
+ ] }) });
1229
+ }
1230
+ MobileSimplified.displayName = "MobileSimplified";
1231
+ const rootClassName = "teddy-global-navigation";
1232
+ const RootContext = React.createContext(null);
1233
+ function Root({
1234
+ className,
1235
+ appKey,
1236
+ loggedInUser,
1237
+ linkComponent,
1238
+ onLogoutClick,
1239
+ shoppingCart,
1240
+ shoppingCartNumberOfItems,
1241
+ onSearchSubmit,
1242
+ isCartOpen,
1243
+ onCartOpenChange,
1244
+ drawerSize = "md",
1245
+ isSimplified,
1246
+ currentPath,
1247
+ ...props
1248
+ }) {
1249
+ const [selectedMenuItem, setSelectedMenuItem] = React.useState(getInitialMenuItem(currentPath));
1250
+ const [selectedDomainItem, setSelectedDomainItem] = React.useState(getInitialDomain(currentPath));
1251
+ const [pathname, setPathname] = React.useState(currentPath || "");
1252
+ const classes = clsx([styles[`${rootClassName}`]], className);
1253
+ return /* @__PURE__ */ jsxRuntime.jsx(
1254
+ RootContext.Provider,
1255
+ {
1256
+ value: {
1257
+ appKey,
1258
+ loggedInUser,
1259
+ selectedMenuItem,
1260
+ setSelectedMenuItem(v, onlyStateChange) {
1261
+ if (appKey === "open-pages" && !onlyStateChange)
1262
+ return;
1263
+ setSelectedMenuItem(v);
1264
+ },
1265
+ linkComponent,
1266
+ selectedDomainItem,
1267
+ setSelectedDomainItem(v, onlyStateChange) {
1268
+ if (appKey === "open-pages" && !onlyStateChange)
1269
+ return;
1270
+ setSelectedDomainItem(v);
1271
+ },
1272
+ pathname,
1273
+ setPathname(v) {
1274
+ if (appKey === "open-pages")
1275
+ return;
1276
+ setPathname(v);
1277
+ },
1278
+ onLogoutClick,
1279
+ shoppingCart,
1280
+ shoppingCartNumberOfItems,
1281
+ onSearchSubmit,
1282
+ isCartOpen,
1283
+ onCartOpenChange,
1284
+ drawerSize
1285
+ },
1286
+ children: /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsxs(
1287
+ NavigationMenu,
1288
+ {
1289
+ topMenuValue: selectedDomainItem,
1290
+ onTopMenuValueChange: setSelectedDomainItem,
1291
+ value: selectedMenuItem,
1292
+ onValueChange: (v) => {
1293
+ if (v === "" || appKey === "open-pages")
1294
+ return;
1295
+ setSelectedMenuItem(v);
1296
+ },
1297
+ children: [
1298
+ /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { sm: "none", lg: "block" }, children: [
1299
+ isSimplified && /* @__PURE__ */ jsxRuntime.jsx(DesktopSimplified, {}),
1300
+ !isSimplified && /* @__PURE__ */ jsxRuntime.jsx(Desktop, {})
1301
+ ] }),
1302
+ /* @__PURE__ */ jsxRuntime.jsxs(components_box_box.Box, { display: { lg: "none" }, children: [
1303
+ isSimplified && /* @__PURE__ */ jsxRuntime.jsx(MobileSimplified, {}),
1304
+ !isSimplified && /* @__PURE__ */ jsxRuntime.jsx(Mobile, {})
1305
+ ] })
1306
+ ]
1307
+ }
1308
+ ) })
1309
+ }
1310
+ );
1311
+ }
1312
+ Root.displayName = "Root";
1313
+ function getInitialDomain(currentPath) {
1314
+ if (!currentPath)
1315
+ return components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.name;
1316
+ const locationArray = currentPath ? currentPath.split("/") : [];
1317
+ const domainPartOfLocation = `/${locationArray[1].toLowerCase()}/`;
1318
+ 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;
1319
+ return initDomain;
1320
+ }
1321
+ function getInitialMenuItem(currentPath) {
1322
+ var _a, _b, _c, _d, _e, _f;
1323
+ if (!currentPath)
1324
+ return;
1325
+ const locationArray = currentPath ? currentPath.split("/") : [];
1326
+ const initialDomain = getInitialDomain(currentPath);
1327
+ if (initialDomain === "Bedrift") {
1328
+ const mainMenuPartOfLocation2 = locationArray[2];
1329
+ return (_b = (_a = components_navigationMenu_globalNavigation_utils.BUSINESS_LINKS.links) == null ? void 0 : _a.find(
1330
+ (link) => {
1331
+ var _a2;
1332
+ return link.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${initialDomain.toLowerCase()}/${mainMenuPartOfLocation2}/`));
1333
+ }
1334
+ )) == null ? void 0 : _b.name;
1335
+ }
1336
+ if (initialDomain === "Borettslag") {
1337
+ const mainMenuPartOfLocation2 = locationArray[2];
1338
+ 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;
1339
+ }
1340
+ const mainMenuPartOfLocation = locationArray[1];
1341
+ return (_f = (_e = components_navigationMenu_globalNavigation_utils.PRIVATE_LINKS.links) == null ? void 0 : _e.find((link) => {
1342
+ var _a2;
1343
+ return link.link === `/${mainMenuPartOfLocation}/` || ((_a2 = link.links) == null ? void 0 : _a2.some((link2) => link2.link === `/${mainMenuPartOfLocation}/`));
1344
+ })) == null ? void 0 : _f.name;
1345
+ }
1346
+ Root.displayName = "GlobalNavigation";
1347
+ const GlobalNavigation = Root;
277
1348
  exports.Body = Body;
278
- exports.Content = Content$1;
279
- exports.Item = Item;
1349
+ exports.Content = Content$2;
1350
+ exports.Desktop = Desktop;
1351
+ exports.DesktopSimplified = DesktopSimplified;
1352
+ exports.GlobalNavigation = GlobalNavigation;
1353
+ exports.Item = Item$1;
280
1354
  exports.ItemContext = ItemContext;
1355
+ exports.Mobile = Mobile;
1356
+ exports.MobileSimplified = MobileSimplified;
281
1357
  exports.Modal = Modal;
1358
+ exports.MyPages = MyPages;
1359
+ exports.NavigationMenu = NavigationMenu;
282
1360
  exports.RadioCardGroup = RadioCardGroup;
1361
+ exports.Root = Root;
1362
+ exports.RootContext = RootContext;
1363
+ exports.Search = Search;
1364
+ exports.SearchField = SearchField;
1365
+ exports.Separator = Separator;
1366
+ exports.ShoppingCart = ShoppingCart;
283
1367
  exports.Title = Title$1;
1368
+ exports.rootClassName = rootClassName$1;
1369
+ exports.rootClassName$1 = rootClassName;