@telia/teddy 0.7.16 → 0.7.26

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