@telia/teddy 0.7.63 → 0.7.65

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.
@@ -65,7 +65,7 @@ const MY_PAGE_RETAILER_LINKS = {
65
65
  icon: "end-user"
66
66
  },
67
67
  {
68
- name: "Administrasjon",
68
+ name: "Min Butikk",
69
69
  link: "/nexus/administrasjon",
70
70
  appKey: APP_KEYS["web-shop"],
71
71
  icon: "settings"
@@ -65,7 +65,7 @@ export declare const MY_PAGE_RETAILER_LINKS: {
65
65
  readonly appKey: "web-shop";
66
66
  readonly icon: "end-user";
67
67
  }, {
68
- readonly name: "Administrasjon";
68
+ readonly name: "Min Butikk";
69
69
  readonly link: "/nexus/administrasjon";
70
70
  readonly appKey: "web-shop";
71
71
  readonly icon: "settings";
@@ -63,7 +63,7 @@ const MY_PAGE_RETAILER_LINKS = {
63
63
  icon: "end-user"
64
64
  },
65
65
  {
66
- name: "Administrasjon",
66
+ name: "Min Butikk",
67
67
  link: "/nexus/administrasjon",
68
68
  appKey: APP_KEYS["web-shop"],
69
69
  icon: "settings"
@@ -27,7 +27,9 @@ function _interopNamespaceDefault(e) {
27
27
  const CollapsiblePrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(CollapsiblePrimitive);
28
28
  const Dismiss = React.forwardRef(
29
29
  ({ className, children, ...props }, forwardRef) => {
30
+ const context = React.useContext(components_notification_notificationRoot.NotificationContext);
30
31
  const classes = clsx([components_notification_notificationRoot.styles[`${components_notification_notificationRoot.rootClassName}__dismiss`]], className);
32
+ if ((context == null ? void 0 : context.dismissible) === false) return null;
31
33
  return /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
32
34
  components_button_button.Button,
33
35
  {
@@ -5,10 +5,12 @@ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
5
5
  import { Button } from "../button/button.js";
6
6
  import "../../assets/sprite.44b293a1-teddy.svg";
7
7
  import { Icon } from "../icon/icon.js";
8
- import { s as styles, rootClassName } from "./notification-root.js";
8
+ import { NotificationContext, s as styles, rootClassName } from "./notification-root.js";
9
9
  const Dismiss = React__default.forwardRef(
10
10
  ({ className, children, ...props }, forwardRef) => {
11
+ const context = React__default.useContext(NotificationContext);
11
12
  const classes = clsx([styles[`${rootClassName}__dismiss`]], className);
13
+ if ((context == null ? void 0 : context.dismissible) === false) return null;
12
14
  return /* @__PURE__ */ jsx(CollapsiblePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
13
15
  Button,
14
16
  {
@@ -6,6 +6,7 @@ const clsx = require("clsx");
6
6
  const CollapsiblePrimitive = require("@radix-ui/react-collapsible");
7
7
  const reactUseControllableState = require("@radix-ui/react-use-controllable-state");
8
8
  const components_card_index = require("../card/index.cjs");
9
+ const components_grid_grid = require("../grid/grid.cjs");
9
10
  function _interopNamespaceDefault(e) {
10
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
12
  if (e) {
@@ -41,9 +42,11 @@ const styles = {
41
42
  "teddy-notification__heading": "_teddy-notification__heading_1x0q6_80"
42
43
  };
43
44
  const rootClassName = "teddy-notification";
44
- const NotificationContext = React.createContext(void 0);
45
+ const NotificationContext = React.createContext(
46
+ void 0
47
+ );
45
48
  const Root = React.forwardRef(
46
- ({ className, open: openProp, defaultOpen, onOpenChange, variant, type, ...props }, forwardRef) => {
49
+ ({ className, open: openProp, defaultOpen, onOpenChange, variant, type, dismissible = true, ...props }, forwardRef) => {
47
50
  const classes = clsx(
48
51
  [styles[`${rootClassName}`]],
49
52
  styles[`${rootClassName}--${variant}`],
@@ -55,7 +58,11 @@ const Root = React.forwardRef(
55
58
  defaultProp: defaultOpen,
56
59
  onChange: onOpenChange
57
60
  });
58
- return /* @__PURE__ */ jsxRuntime.jsx(NotificationContext.Provider, { value: { variant, type }, children: /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Root, { open, onOpenChange: setOpen, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Content, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(components_card_index.Card, { variant: "white", as: void 0, ...props, ref: forwardRef, className: classes }) }) }) });
61
+ const contextValue = React.useMemo(() => ({ variant, type, dismissible }), [variant, type, dismissible]);
62
+ if (!dismissible) {
63
+ return /* @__PURE__ */ jsxRuntime.jsx(NotificationContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(components_grid_grid.Grid, { ...props, as: "div", asChild: false, ref: forwardRef, className: classes }) });
64
+ }
65
+ return /* @__PURE__ */ jsxRuntime.jsx(NotificationContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Root, { open, onOpenChange: setOpen, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CollapsiblePrimitive__namespace.Content, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(components_card_index.Card, { variant: "white", as: void 0, ...props, ref: forwardRef, className: classes }) }) }) });
59
66
  }
60
67
  );
61
68
  Root.displayName = "Root";
@@ -17,8 +17,16 @@ export type RootProps = Omit<React.ComponentPropsWithoutRef<typeof Card>, 'varia
17
17
  defaultOpen?: boolean;
18
18
  onOpenChange?: (open: boolean) => void;
19
19
  role?: 'alert';
20
+ /**
21
+ * Whether the notification can be dismissed by the user.
22
+ * Set to `false` when using Notification inside another interactive container (e.g. a collapsible card)
23
+ * to prevent the Notification from capturing and stopping click propagation.
24
+ * When `false`, `Notification.Dismiss` will not render.
25
+ * @default true
26
+ */
27
+ dismissible?: boolean;
20
28
  };
21
- export declare const NotificationContext: React.Context<Pick<RootProps, "type" | "variant"> | undefined>;
29
+ export declare const NotificationContext: React.Context<Pick<RootProps, "type" | "variant" | "dismissible"> | undefined>;
22
30
  /** Groups Icon and Text parts. This component is based on the div element */
23
31
  export declare const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/radius').RadiusProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
24
32
  display?: import('../../utils/generate-styling').DisplayChildren;
@@ -83,4 +91,12 @@ export declare const Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<R
83
91
  defaultOpen?: boolean;
84
92
  onOpenChange?: (open: boolean) => void;
85
93
  role?: "alert";
94
+ /**
95
+ * Whether the notification can be dismissed by the user.
96
+ * Set to `false` when using Notification inside another interactive container (e.g. a collapsible card)
97
+ * to prevent the Notification from capturing and stopping click propagation.
98
+ * When `false`, `Notification.Dismiss` will not render.
99
+ * @default true
100
+ */
101
+ dismissible?: boolean;
86
102
  } & React.RefAttributes<HTMLDivElement>>;
@@ -4,6 +4,7 @@ import clsx from "clsx";
4
4
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
5
5
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
6
6
  import { Card } from "../card/index.js";
7
+ import { Grid } from "../grid/grid.js";
7
8
  const styles = {
8
9
  "teddy-notification": "_teddy-notification_1x0q6_3",
9
10
  "teddy-notification--success": "_teddy-notification--success_1x0q6_11",
@@ -22,9 +23,11 @@ const styles = {
22
23
  "teddy-notification__heading": "_teddy-notification__heading_1x0q6_80"
23
24
  };
24
25
  const rootClassName = "teddy-notification";
25
- const NotificationContext = React__default.createContext(void 0);
26
+ const NotificationContext = React__default.createContext(
27
+ void 0
28
+ );
26
29
  const Root = React__default.forwardRef(
27
- ({ className, open: openProp, defaultOpen, onOpenChange, variant, type, ...props }, forwardRef) => {
30
+ ({ className, open: openProp, defaultOpen, onOpenChange, variant, type, dismissible = true, ...props }, forwardRef) => {
28
31
  const classes = clsx(
29
32
  [styles[`${rootClassName}`]],
30
33
  styles[`${rootClassName}--${variant}`],
@@ -36,7 +39,11 @@ const Root = React__default.forwardRef(
36
39
  defaultProp: defaultOpen,
37
40
  onChange: onOpenChange
38
41
  });
39
- return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: { variant, type }, children: /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, { open, onOpenChange: setOpen, asChild: true, children: /* @__PURE__ */ jsx(CollapsiblePrimitive.Content, { asChild: true, children: /* @__PURE__ */ jsx(Card, { variant: "white", as: void 0, ...props, ref: forwardRef, className: classes }) }) }) });
42
+ const contextValue = React__default.useMemo(() => ({ variant, type, dismissible }), [variant, type, dismissible]);
43
+ if (!dismissible) {
44
+ return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(Grid, { ...props, as: "div", asChild: false, ref: forwardRef, className: classes }) });
45
+ }
46
+ return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, { open, onOpenChange: setOpen, asChild: true, children: /* @__PURE__ */ jsx(CollapsiblePrimitive.Content, { asChild: true, children: /* @__PURE__ */ jsx(Card, { variant: "white", as: void 0, ...props, ref: forwardRef, className: classes }) }) }) });
40
47
  }
41
48
  );
42
49
  Root.displayName = "Root";
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=10"
21
21
  },
22
22
  "private": false,
23
- "version": "0.7.63",
23
+ "version": "0.7.65",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"