@telia/teddy 0.3.4 → 0.3.5
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/card/card-button.cjs +2 -2
- package/dist/components/card/card-button.js +3 -3
- package/dist/components/card/card.cjs +4 -4
- package/dist/components/card/card.js +4 -4
- package/dist/components/drawer/index.cjs +16 -17
- package/dist/components/drawer/index.d.ts +122 -10
- package/dist/components/drawer/index.js +16 -17
- package/dist/components/modal/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -28,14 +28,14 @@ const Button = React.forwardRef(
|
|
|
28
28
|
},
|
|
29
29
|
className
|
|
30
30
|
);
|
|
31
|
-
const ref = utils_composeRefs.
|
|
31
|
+
const ref = utils_composeRefs.useComposedRefs(forwardRef, context == null ? void 0 : context.buttonRef);
|
|
32
32
|
return /* @__PURE__ */ jsxRuntime.jsxs(components_flex_flex.Flex, { className: wrapperClasses, children: [
|
|
33
33
|
disclaimer && /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { mr: "100", variant: "additional-100", children: disclaimer }),
|
|
34
34
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
35
35
|
components_button_button.Button,
|
|
36
36
|
{
|
|
37
|
-
...!iconOnly || !props["aria-label"] ? { iconOnly: false, "aria-label": void 0 } : { iconOnly: true, "aria-label": props["aria-label"] },
|
|
38
37
|
ref,
|
|
38
|
+
...!iconOnly || !props["aria-label"] ? { iconOnly: false, "aria-label": void 0 } : { iconOnly: true, "aria-label": props["aria-label"] },
|
|
39
39
|
variant: getButtonVariant(context == null ? void 0 : context.variant),
|
|
40
40
|
...props,
|
|
41
41
|
className: classes
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { RootContext, s as styles, actionElementIdentifier, rootClassName } from "./card.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useComposedRefs } from "../../utils/composeRefs.js";
|
|
6
6
|
import { Button as Button$1 } from "../button/button.js";
|
|
7
7
|
import { Flex } from "../flex/flex.js";
|
|
8
8
|
import { Text } from "../text/text.js";
|
|
@@ -26,14 +26,14 @@ const Button = React__default.forwardRef(
|
|
|
26
26
|
},
|
|
27
27
|
className
|
|
28
28
|
);
|
|
29
|
-
const ref =
|
|
29
|
+
const ref = useComposedRefs(forwardRef, context == null ? void 0 : context.buttonRef);
|
|
30
30
|
return /* @__PURE__ */ jsxs(Flex, { className: wrapperClasses, children: [
|
|
31
31
|
disclaimer && /* @__PURE__ */ jsx(Text, { mr: "100", variant: "additional-100", children: disclaimer }),
|
|
32
32
|
/* @__PURE__ */ jsx(
|
|
33
33
|
Button$1,
|
|
34
34
|
{
|
|
35
|
-
...!iconOnly || !props["aria-label"] ? { iconOnly: false, "aria-label": void 0 } : { iconOnly: true, "aria-label": props["aria-label"] },
|
|
36
35
|
ref,
|
|
36
|
+
...!iconOnly || !props["aria-label"] ? { iconOnly: false, "aria-label": void 0 } : { iconOnly: true, "aria-label": props["aria-label"] },
|
|
37
37
|
variant: getButtonVariant(context == null ? void 0 : context.variant),
|
|
38
38
|
...props,
|
|
39
39
|
className: classes
|
|
@@ -100,13 +100,13 @@ const Root = React.forwardRef(
|
|
|
100
100
|
...props,
|
|
101
101
|
className: classes,
|
|
102
102
|
style: customStyle,
|
|
103
|
-
|
|
104
|
-
var _a;
|
|
103
|
+
onPointerDown: utils_composeEventHandlers.composeEventHandlers(props.onPointerDown, (e) => {
|
|
105
104
|
if (e.isDefaultPrevented())
|
|
106
105
|
return;
|
|
107
|
-
if (linkRef.current)
|
|
106
|
+
if (linkRef.current && e.target !== linkRef.current)
|
|
108
107
|
return linkRef.current.click();
|
|
109
|
-
(
|
|
108
|
+
if (buttonRef.current && e.target !== buttonRef.current)
|
|
109
|
+
return buttonRef.current.click();
|
|
110
110
|
}),
|
|
111
111
|
ref: forwardRef,
|
|
112
112
|
children
|
|
@@ -98,13 +98,13 @@ const Root = React__default.forwardRef(
|
|
|
98
98
|
...props,
|
|
99
99
|
className: classes,
|
|
100
100
|
style: customStyle,
|
|
101
|
-
|
|
102
|
-
var _a;
|
|
101
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (e) => {
|
|
103
102
|
if (e.isDefaultPrevented())
|
|
104
103
|
return;
|
|
105
|
-
if (linkRef.current)
|
|
104
|
+
if (linkRef.current && e.target !== linkRef.current)
|
|
106
105
|
return linkRef.current.click();
|
|
107
|
-
(
|
|
106
|
+
if (buttonRef.current && e.target !== buttonRef.current)
|
|
107
|
+
return buttonRef.current.click();
|
|
108
108
|
}),
|
|
109
109
|
ref: forwardRef,
|
|
110
110
|
children
|
|
@@ -8,21 +8,20 @@ const components_drawer_drawerOverlay = require("./drawer-overlay.cjs");
|
|
|
8
8
|
const components_drawer_drawerRoot = require("./drawer-root.cjs");
|
|
9
9
|
const components_drawer_drawerTitle = require("./drawer-title.cjs");
|
|
10
10
|
const components_drawer_drawerTrigger = require("./drawer-trigger.cjs");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
11
|
+
const Drawer = components_drawer_drawerRoot.Root;
|
|
12
|
+
Drawer.displayName = "Drawer";
|
|
13
|
+
Drawer.Trigger = components_drawer_drawerTrigger.Trigger;
|
|
14
|
+
Drawer.Trigger.displayName = "Drawer.Trigger";
|
|
15
|
+
Drawer.Content = components_drawer_drawerContent.Content;
|
|
16
|
+
Drawer.Content.displayName = "Drawer.Content";
|
|
17
|
+
Drawer.Title = components_drawer_drawerTitle.Title;
|
|
18
|
+
Drawer.Title.displayName = "Drawer.Title";
|
|
19
|
+
Drawer.Description = components_drawer_drawerDescription.Description;
|
|
20
|
+
Drawer.Description.displayName = "Drawer.Description";
|
|
21
|
+
Drawer.Overlay = components_drawer_drawerOverlay.Overlay;
|
|
22
|
+
Drawer.Overlay.displayName = "Drawer.Overlay";
|
|
23
|
+
Drawer.Footer = components_drawer_drawerFooter.Footer;
|
|
24
|
+
Drawer.Footer.displayName = "Drawer.Footer";
|
|
25
|
+
Drawer.Close = components_drawer_drawerClose.Close;
|
|
26
|
+
Drawer.Close.displayName = "Drawer.Close";
|
|
28
27
|
exports.Drawer = Drawer;
|
|
@@ -7,16 +7,7 @@ import { Root, RootProps } from './drawer-root';
|
|
|
7
7
|
import { Title, TitleProps } from './drawer-title';
|
|
8
8
|
import { Trigger, TriggerProps } from './drawer-trigger';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
Title: typeof Title;
|
|
12
|
-
Description: typeof Description;
|
|
13
|
-
Trigger: typeof Trigger;
|
|
14
|
-
Overlay: typeof Overlay;
|
|
15
|
-
Content: typeof Content;
|
|
16
|
-
Footer: typeof Footer;
|
|
17
|
-
Close: typeof Close;
|
|
18
|
-
};
|
|
19
|
-
export type DrawerProps = {
|
|
10
|
+
type DrawerProps = {
|
|
20
11
|
Root: RootProps;
|
|
21
12
|
Title: TitleProps;
|
|
22
13
|
Description: DescriptionProps;
|
|
@@ -26,3 +17,124 @@ export type DrawerProps = {
|
|
|
26
17
|
Footer: FooterProps;
|
|
27
18
|
Close: CloseProps;
|
|
28
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Drawer is a sliding panel that appears from the side of the screen.
|
|
22
|
+
* It's commonly used for navigation, settings, or displaying additional content without leaving the current page.
|
|
23
|
+
*
|
|
24
|
+
* @component
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Basic usage
|
|
28
|
+
* <Drawer>
|
|
29
|
+
* <Drawer.Trigger>
|
|
30
|
+
* <Button variant="primary">Open Drawer</Button>
|
|
31
|
+
* </Drawer.Trigger>
|
|
32
|
+
* <Drawer.Content>
|
|
33
|
+
* <Drawer.Title as="h3">Drawer Title</Drawer.Title>
|
|
34
|
+
* <Drawer.Close slot="floating" aria-label="close" />
|
|
35
|
+
* <Drawer.Description>Drawer content goes here.</Drawer.Description>
|
|
36
|
+
* <Drawer.Footer>
|
|
37
|
+
* <Button variant="primary">Save</Button>
|
|
38
|
+
* </Drawer.Footer>
|
|
39
|
+
* </Drawer.Content>
|
|
40
|
+
* </Drawer>
|
|
41
|
+
*/
|
|
42
|
+
declare const Drawer: typeof Root & {
|
|
43
|
+
/**
|
|
44
|
+
* Trigger component that opens the drawer when clicked.
|
|
45
|
+
* Must be passed a single child component that will be used as the trigger.
|
|
46
|
+
*
|
|
47
|
+
* @component
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* <Drawer.Trigger>
|
|
51
|
+
* <Button variant="primary">Open Drawer</Button>
|
|
52
|
+
* </Drawer.Trigger>
|
|
53
|
+
*/
|
|
54
|
+
Trigger: typeof Trigger;
|
|
55
|
+
/**
|
|
56
|
+
* Content component that contains the drawer's content.
|
|
57
|
+
* Handles the positioning and scrolling behavior of the drawer content.
|
|
58
|
+
*
|
|
59
|
+
* @component
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <Drawer.Content>
|
|
63
|
+
* <Drawer.Title>Title</Drawer.Title>
|
|
64
|
+
* <Drawer.Description>Content</Drawer.Description>
|
|
65
|
+
* </Drawer.Content>
|
|
66
|
+
*/
|
|
67
|
+
Content: typeof Content;
|
|
68
|
+
/**
|
|
69
|
+
* An accessible title to be announced when the drawer is opened.
|
|
70
|
+
* It will render the internal Heading component.
|
|
71
|
+
* If you want to hide the title, wrap it inside our Visually Hidden utility like this `<VisuallyHidden asChild>`.
|
|
72
|
+
*
|
|
73
|
+
* @component
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* <Drawer.Title as="h3">Drawer Title</Drawer.Title>
|
|
77
|
+
*/
|
|
78
|
+
Title: typeof Title;
|
|
79
|
+
/**
|
|
80
|
+
* An optional accessible description to be announced when the drawer is opened.
|
|
81
|
+
* This will render the internal Text component with a default p tag.
|
|
82
|
+
*
|
|
83
|
+
* If you want to hide the description, wrap it inside our Visually Hidden utility like this `<VisuallyHidden asChild>`.
|
|
84
|
+
*
|
|
85
|
+
* @component
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* <Drawer.Description>
|
|
89
|
+
* This is the main content of the drawer.
|
|
90
|
+
* It can contain multiple paragraphs and other components.
|
|
91
|
+
* </Drawer.Description>
|
|
92
|
+
*/
|
|
93
|
+
Description: typeof Description;
|
|
94
|
+
/**
|
|
95
|
+
* Overlay component provides the backdrop for the drawer.
|
|
96
|
+
* Handles the background dimming and click-outside behavior.
|
|
97
|
+
*
|
|
98
|
+
* @component
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* <Drawer.Overlay>
|
|
102
|
+
* <Drawer.Content>
|
|
103
|
+
* {/* Content will slide in from the side *\/}
|
|
104
|
+
* </Drawer.Content>
|
|
105
|
+
* </Drawer.Overlay>
|
|
106
|
+
*/
|
|
107
|
+
Overlay: typeof Overlay;
|
|
108
|
+
/**
|
|
109
|
+
* Footer component for organizing action buttons or additional content at the bottom of the drawer.
|
|
110
|
+
* Provides consistent spacing and styling for footer content.
|
|
111
|
+
*
|
|
112
|
+
* @component
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* <Drawer.Footer>
|
|
116
|
+
* <Button variant="tertiary-purple">Cancel</Button>
|
|
117
|
+
* <Button variant="primary">Save Changes</Button>
|
|
118
|
+
* </Drawer.Footer>
|
|
119
|
+
*/
|
|
120
|
+
Footer: typeof Footer;
|
|
121
|
+
/**
|
|
122
|
+
* Close component provides a button to close the drawer.
|
|
123
|
+
* Can be used either as a floating close button or within content.
|
|
124
|
+
*
|
|
125
|
+
* @component
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* // Floating close button
|
|
129
|
+
* <Drawer.Close slot="floating" aria-label="Lukk" />
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* // Close button within content
|
|
133
|
+
* <Drawer.Close slot="content">
|
|
134
|
+
* <Button variant="primary">Done</Button>
|
|
135
|
+
* </Drawer.Close>
|
|
136
|
+
*/
|
|
137
|
+
Close: typeof Close;
|
|
138
|
+
};
|
|
139
|
+
export { Drawer };
|
|
140
|
+
export type { DrawerProps };
|
|
@@ -6,23 +6,22 @@ import { Overlay } from "./drawer-overlay.js";
|
|
|
6
6
|
import { Root } from "./drawer-root.js";
|
|
7
7
|
import { Title } from "./drawer-title.js";
|
|
8
8
|
import { Trigger } from "./drawer-trigger.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Title
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
9
|
+
const Drawer = Root;
|
|
10
|
+
Drawer.displayName = "Drawer";
|
|
11
|
+
Drawer.Trigger = Trigger;
|
|
12
|
+
Drawer.Trigger.displayName = "Drawer.Trigger";
|
|
13
|
+
Drawer.Content = Content;
|
|
14
|
+
Drawer.Content.displayName = "Drawer.Content";
|
|
15
|
+
Drawer.Title = Title;
|
|
16
|
+
Drawer.Title.displayName = "Drawer.Title";
|
|
17
|
+
Drawer.Description = Description;
|
|
18
|
+
Drawer.Description.displayName = "Drawer.Description";
|
|
19
|
+
Drawer.Overlay = Overlay;
|
|
20
|
+
Drawer.Overlay.displayName = "Drawer.Overlay";
|
|
21
|
+
Drawer.Footer = Footer;
|
|
22
|
+
Drawer.Footer.displayName = "Drawer.Footer";
|
|
23
|
+
Drawer.Close = Close;
|
|
24
|
+
Drawer.Close.displayName = "Drawer.Close";
|
|
26
25
|
export {
|
|
27
26
|
Drawer
|
|
28
27
|
};
|
|
@@ -88,7 +88,7 @@ declare const Modal: import('react').FC<RootProps> & {
|
|
|
88
88
|
/**
|
|
89
89
|
* An accessible title to be announced when the dialog is opened.
|
|
90
90
|
* It will render the internal Heading component
|
|
91
|
-
* If you want to hide the title, wrap it inside our Visually Hidden utility like this
|
|
91
|
+
* If you want to hide the title, wrap it inside our Visually Hidden utility like this`<VisuallyHidden asChild>`.
|
|
92
92
|
*
|
|
93
93
|
* @component
|
|
94
94
|
*
|
|
@@ -100,7 +100,7 @@ declare const Modal: import('react').FC<RootProps> & {
|
|
|
100
100
|
* An optional accessible description to be announced when the dialog is opened.
|
|
101
101
|
* This will render the internal Text component with an default p tag
|
|
102
102
|
*
|
|
103
|
-
* If you want to hide the description, wrap it inside our Visually Hidden utility like this
|
|
103
|
+
* If you want to hide the description, wrap it inside our Visually Hidden utility like this `<VisuallyHidden asChild>`
|
|
104
104
|
*
|
|
105
105
|
* @component
|
|
106
106
|
*
|