@telia/teddy 0.7.64 → 0.7.66
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.
- package/dist/components/notification/notification-dismiss.cjs +2 -0
- package/dist/components/notification/notification-dismiss.js +3 -1
- package/dist/components/notification/notification-root.cjs +10 -3
- package/dist/components/notification/notification-root.d.ts +17 -1
- package/dist/components/notification/notification-root.js +10 -3
- package/dist/components/shopping-cart/shopping-cart-payment.cjs +15 -9
- package/dist/components/shopping-cart/shopping-cart-payment.d.ts +2 -2
- package/dist/components/shopping-cart/shopping-cart-payment.js +15 -9
- package/package.json +1 -1
|
@@ -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(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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";
|
|
@@ -9,16 +9,22 @@ const components_progressBar_progressBar = require("../progress-bar/progress-bar
|
|
|
9
9
|
const components_shoppingCart_shoppingCartContext = require("./shopping-cart-context.cjs");
|
|
10
10
|
const shoppingCart_module = require("../../shopping-cart.module-C9EOksct.cjs");
|
|
11
11
|
const components_box_box = require("../box/box.cjs");
|
|
12
|
-
const HighlightedLine = ({ icon, heading, price, description }) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/* @__PURE__ */ jsxRuntime.
|
|
12
|
+
const HighlightedLine = ({ icon, heading, price, description }) => {
|
|
13
|
+
const hasHeading = heading || price;
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.highlightedLine, children: [
|
|
15
|
+
hasHeading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.highlightedLineTop, children: [
|
|
16
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.highlightedLineLeft, children: [
|
|
17
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: icon, className: shoppingCart_module.styles.highlightedLineIcon }),
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.highlightedLineHeading, children: heading })
|
|
19
|
+
] }),
|
|
20
|
+
price && /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.highlightedLinePrice, children: price })
|
|
17
21
|
] }),
|
|
18
|
-
/* @__PURE__ */ jsxRuntime.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
] })
|
|
22
|
+
description && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.highlightedLineLeft, children: [
|
|
23
|
+
!hasHeading && icon && /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: icon, className: shoppingCart_module.styles.highlightedLineIcon }),
|
|
24
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: shoppingCart_module.styles.highlightedLineDescription, children: description })
|
|
25
|
+
] })
|
|
26
|
+
] });
|
|
27
|
+
};
|
|
22
28
|
const MonthlyPriceDetailsDisplay = ({
|
|
23
29
|
monthlyPriceDetails,
|
|
24
30
|
totalPriceMonthly,
|
|
@@ -7,16 +7,22 @@ import { ProgressBar } from "../progress-bar/progress-bar.js";
|
|
|
7
7
|
import { useShoppingCart } from "./shopping-cart-context.js";
|
|
8
8
|
import { s as styles } from "../../shopping-cart.module-ClaAAxQV.js";
|
|
9
9
|
import { Box } from "../box/box.js";
|
|
10
|
-
const HighlightedLine = ({ icon, heading, price, description }) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/* @__PURE__ */
|
|
10
|
+
const HighlightedLine = ({ icon, heading, price, description }) => {
|
|
11
|
+
const hasHeading = heading || price;
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.highlightedLine, children: [
|
|
13
|
+
hasHeading && /* @__PURE__ */ jsxs("div", { className: styles.highlightedLineTop, children: [
|
|
14
|
+
/* @__PURE__ */ jsxs("div", { className: styles.highlightedLineLeft, children: [
|
|
15
|
+
icon && /* @__PURE__ */ jsx(Icon, { name: icon, className: styles.highlightedLineIcon }),
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: styles.highlightedLineHeading, children: heading })
|
|
17
|
+
] }),
|
|
18
|
+
price && /* @__PURE__ */ jsx("span", { className: styles.highlightedLinePrice, children: price })
|
|
15
19
|
] }),
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
] })
|
|
20
|
+
description && /* @__PURE__ */ jsxs("div", { className: styles.highlightedLineLeft, children: [
|
|
21
|
+
!hasHeading && icon && /* @__PURE__ */ jsx(Icon, { name: icon, className: styles.highlightedLineIcon }),
|
|
22
|
+
/* @__PURE__ */ jsx("p", { className: styles.highlightedLineDescription, children: description })
|
|
23
|
+
] })
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
20
26
|
const MonthlyPriceDetailsDisplay = ({
|
|
21
27
|
monthlyPriceDetails,
|
|
22
28
|
totalPriceMonthly,
|