@telia/teddy 0.0.57 → 0.0.58

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.
@@ -95,11 +95,11 @@ function LoggedInContent() {
95
95
  ] }),
96
96
  /* @__PURE__ */ jsxRuntime.jsxs(components_textSpacing_textSpacing.TextSpacing, { children: [
97
97
  /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "private", children: [
98
- /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Privat" }),
98
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
99
99
  (_a = components_navigationMenu_globalNavigation_utils.MY_PAGE_LINKS.links) == null ? void 0 : _a.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
100
100
  ] }),
101
101
  /* @__PURE__ */ jsxRuntime.jsxs(components_tabs_index.Tabs.Content, { value: "business", children: [
102
- /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedrift" }),
102
+ /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedriftsportaler" }),
103
103
  components_navigationMenu_globalNavigation_utils.LOGGED_IN_LINKS_BUSINESS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: link.icon, children: link.name }) }) }, link.link))
104
104
  ] }),
105
105
  /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { mt: "200", onClick: () => rootContext == null ? void 0 : rootContext.onLogoutClick(), variant: "secondary", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "logout", children: "Logg ut" }) })
@@ -413,7 +413,7 @@ function Mobile(props) {
413
413
  value: rootContext.selectedDomainItem,
414
414
  onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
415
415
  children: [
416
- /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { value: link.name, children: link.name }, link.name)) }),
416
+ /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.List, { children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsxRuntime.jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
417
417
  /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { mt: "400", children: components_navigationMenu_globalNavigation_utils.LINKS.map((link) => {
418
418
  var _a;
419
419
  return /* @__PURE__ */ jsxRuntime.jsx(components_tabs_index.Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -93,11 +93,11 @@ function LoggedInContent() {
93
93
  ] }),
94
94
  /* @__PURE__ */ jsxs(TextSpacing, { children: [
95
95
  /* @__PURE__ */ jsxs(Tabs.Content, { value: "private", children: [
96
- /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Privat" }),
96
+ /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Min Side" }),
97
97
  (_a = MY_PAGE_LINKS.links) == null ? void 0 : _a.map((link) => /* @__PURE__ */ jsx(Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsx("a", { href: link.link, children: /* @__PURE__ */ jsx(Icon, { name: link.icon, children: link.name }) }) }, link.link))
98
98
  ] }),
99
99
  /* @__PURE__ */ jsxs(Tabs.Content, { value: "business", children: [
100
- /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedrift" }),
100
+ /* @__PURE__ */ jsx(Heading, { variant: "title-100", as: "h3", mb: "100", mt: "400", children: "Bedriftsportaler" }),
101
101
  LOGGED_IN_LINKS_BUSINESS.map((link) => /* @__PURE__ */ jsx(Button, { variant: "list-item", fullWidth: true, asChild: true, children: /* @__PURE__ */ jsx("a", { href: link.link, children: /* @__PURE__ */ jsx(Icon, { name: link.icon, children: link.name }) }) }, link.link))
102
102
  ] }),
103
103
  /* @__PURE__ */ jsx(Button, { mt: "200", onClick: () => rootContext == null ? void 0 : rootContext.onLogoutClick(), variant: "secondary", children: /* @__PURE__ */ jsx(Icon, { name: "logout", children: "Logg ut" }) })
@@ -411,7 +411,7 @@ function Mobile(props) {
411
411
  value: rootContext.selectedDomainItem,
412
412
  onValueChange: (v) => rootContext.setSelectedDomainItem(v, true),
413
413
  children: [
414
- /* @__PURE__ */ jsx(Tabs.List, { children: LINKS.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { value: link.name, children: link.name }, link.name)) }),
414
+ /* @__PURE__ */ jsx(Tabs.List, { children: LINKS.map((link) => /* @__PURE__ */ jsx(Tabs.Trigger, { asChild: true, value: link.name, children: link.appKey === rootContext.appKey || rootContext.appKey === "storybook" ? /* @__PURE__ */ jsx(NavLink, { href: link.link, children: link.name }) : /* @__PURE__ */ jsx("a", { href: link.link, children: link.name }) }, link.name)) }),
415
415
  /* @__PURE__ */ jsx(Box, { mt: "400", children: LINKS.map((link) => {
416
416
  var _a;
417
417
  return /* @__PURE__ */ jsx(Tabs.Content, { value: link.name, children: /* @__PURE__ */ jsx(
@@ -26,15 +26,15 @@ function _interopNamespaceDefault(e) {
26
26
  }
27
27
  const TabsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TabsPrimitive);
28
28
  const Trigger = React.forwardRef(
29
- ({ className, ...props }, forwardRef) => {
29
+ ({ className, asChild, children, ...props }, forwardRef) => {
30
30
  const classes = clsx([components_tabs_tabsRoot.styles[`${components_tabs_tabsRoot.rootClassName}__trigger`]], className);
31
31
  const innerElementRef = React.useRef(null);
32
+ const ref = utils_composeRefs.useComposedRefs(forwardRef, innerElementRef);
32
33
  const context = React.useContext(components_tabs_tabsRoot.RootContext);
33
34
  const isFirstRender = React.useRef(true);
34
35
  React.useEffect(() => {
35
36
  if ((context == null ? void 0 : context.value) === props.value && innerElementRef.current) {
36
37
  const newTab = innerElementRef.current;
37
- context == null ? void 0 : context.setActiveElement(newTab);
38
38
  const tabsContainer = context == null ? void 0 : context.listElement.current;
39
39
  if (!newTab || !tabsContainer)
40
40
  return;
@@ -47,9 +47,9 @@ const Trigger = React.forwardRef(
47
47
  }
48
48
  }, [context, props.value]);
49
49
  if (context == null ? void 0 : context.snapCenter) {
50
- return /* @__PURE__ */ jsxRuntime.jsx(components_scrollArea_index.ScrollArea.Item, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, { ...props, ref: utils_composeRefs.composeRefs(forwardRef, innerElementRef), className: classes }) }) });
50
+ return /* @__PURE__ */ jsxRuntime.jsx(components_scrollArea_index.ScrollArea.Item, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, { ...props, asChild: true, ref, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "primary", asChild, children }) }) });
51
51
  }
52
- return /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, { ...props, ref: utils_composeRefs.composeRefs(forwardRef, innerElementRef), className: classes }) });
52
+ return /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.Trigger, { ...props, asChild: true, ref, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "primary", asChild, children }) });
53
53
  }
54
54
  );
55
55
  Trigger.displayName = "Trigger";
@@ -5,17 +5,17 @@ import clsx from "clsx";
5
5
  import { s as styles, rootClassName, RootContext } from "./tabs-root.js";
6
6
  import { ScrollArea } from "../scroll-area/index.js";
7
7
  import { Button } from "../button/button.js";
8
- import { composeRefs } from "../../utils/composeRefs.js";
8
+ import { useComposedRefs } from "../../utils/composeRefs.js";
9
9
  const Trigger = React__default.forwardRef(
10
- ({ className, ...props }, forwardRef) => {
10
+ ({ className, asChild, children, ...props }, forwardRef) => {
11
11
  const classes = clsx([styles[`${rootClassName}__trigger`]], className);
12
12
  const innerElementRef = React__default.useRef(null);
13
+ const ref = useComposedRefs(forwardRef, innerElementRef);
13
14
  const context = React__default.useContext(RootContext);
14
15
  const isFirstRender = React__default.useRef(true);
15
16
  React__default.useEffect(() => {
16
17
  if ((context == null ? void 0 : context.value) === props.value && innerElementRef.current) {
17
18
  const newTab = innerElementRef.current;
18
- context == null ? void 0 : context.setActiveElement(newTab);
19
19
  const tabsContainer = context == null ? void 0 : context.listElement.current;
20
20
  if (!newTab || !tabsContainer)
21
21
  return;
@@ -28,9 +28,9 @@ const Trigger = React__default.forwardRef(
28
28
  }
29
29
  }, [context, props.value]);
30
30
  if (context == null ? void 0 : context.snapCenter) {
31
- return /* @__PURE__ */ jsx(ScrollArea.Item, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { ...props, ref: composeRefs(forwardRef, innerElementRef), className: classes }) }) });
31
+ return /* @__PURE__ */ jsx(ScrollArea.Item, { asChild: true, children: /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { ...props, asChild: true, ref, className: classes, children: /* @__PURE__ */ jsx(Button, { variant: "primary", asChild, children }) }) });
32
32
  }
33
- return /* @__PURE__ */ jsx(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { ...props, ref: composeRefs(forwardRef, innerElementRef), className: classes }) });
33
+ return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, { ...props, asChild: true, ref, className: classes, children: /* @__PURE__ */ jsx(Button, { variant: "primary", asChild, children }) });
34
34
  }
35
35
  );
36
36
  Trigger.displayName = "Trigger";
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=8"
21
21
  },
22
22
  "private": false,
23
- "version": "0.0.57",
23
+ "version": "0.0.58",
24
24
  "sideEffects": [
25
25
  "**/*.css"
26
26
  ],