@telia/teddy 0.3.4 → 0.3.7

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.
@@ -28,14 +28,14 @@ const Button = React.forwardRef(
28
28
  },
29
29
  className
30
30
  );
31
- const ref = utils_composeRefs.composeRefs(context == null ? void 0 : context.buttonRef, forwardRef);
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 { composeRefs } from "../../utils/composeRefs.js";
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 = composeRefs(context == null ? void 0 : context.buttonRef, forwardRef);
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
- onClick: utils_composeEventHandlers.composeEventHandlers(props.onClick, (e) => {
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
- (_a = buttonRef.current) == null ? void 0 : _a.click();
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
- onClick: composeEventHandlers(props.onClick, (e) => {
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
- (_a = buttonRef.current) == null ? void 0 : _a.click();
106
+ if (buttonRef.current && e.target !== buttonRef.current)
107
+ return buttonRef.current.click();
108
108
  }),
109
109
  ref: forwardRef,
110
110
  children
@@ -15,35 +15,34 @@ const components_card_cardAvailability = require("./card-availability.cjs");
15
15
  const components_card_cardColorDots = require("./card-color-dots.cjs");
16
16
  const components_card_cardPrice = require("./card-price.cjs");
17
17
  const components_card_cardCarousel = require("./card-carousel.cjs");
18
- components_card_card.Root.displayName = "Card";
19
- components_card_cardButton.Button.displayName = "Card.Button";
20
- components_card_cardContent.Content.displayName = "Card.Content";
21
- components_card_cardHeading.Heading.displayName = "Card.Heading";
22
- components_card_cardIllustration.Illustration.displayName = "Card.Illustration";
23
- components_card_cardLine.Line.displayName = "Card.Line";
24
- components_card_cardLink.Link.displayName = "Card.Link";
25
- components_card_cardSlot.Slot.displayName = "Card.Slot";
26
- components_card_cardFooter.Footer.displayName = "Card.Footer";
27
- components_card_cardOverline.Overline.displayName = "Card.Overline";
28
- components_card_cardDescription.Description.displayName = "Card.Description";
29
- components_card_cardAvailability.Availability.displayName = "Card.Availability";
30
- components_card_cardColorDots.ColorDots.displayName = "Card.ColorDots";
31
- components_card_cardPrice.Price.displayName = "Card.Price";
32
- components_card_cardCarousel.ImageSlider.displayName = "Card.ImageSlider";
33
- const Card = Object.assign(components_card_card.Root, {
34
- Heading: components_card_cardHeading.Heading,
35
- Button: components_card_cardButton.Button,
36
- Content: components_card_cardContent.Content,
37
- Illustration: components_card_cardIllustration.Illustration,
38
- Line: components_card_cardLine.Line,
39
- Link: components_card_cardLink.Link,
40
- Overline: components_card_cardOverline.Overline,
41
- Slot: components_card_cardSlot.Slot,
42
- Footer: components_card_cardFooter.Footer,
43
- Description: components_card_cardDescription.Description,
44
- Availability: components_card_cardAvailability.Availability,
45
- ColorDots: components_card_cardColorDots.ColorDots,
46
- Price: components_card_cardPrice.Price,
47
- ImageSlider: components_card_cardCarousel.ImageSlider
48
- });
18
+ const Card = components_card_card.Root;
19
+ Card.displayName = "Card";
20
+ Card.Heading = components_card_cardHeading.Heading;
21
+ Card.Heading.displayName = "Card.Heading";
22
+ Card.Button = components_card_cardButton.Button;
23
+ Card.Button.displayName = "Card.Button";
24
+ Card.Content = components_card_cardContent.Content;
25
+ Card.Content.displayName = "Card.Content";
26
+ Card.Illustration = components_card_cardIllustration.Illustration;
27
+ Card.Illustration.displayName = "Card.Illustration";
28
+ Card.Line = components_card_cardLine.Line;
29
+ Card.Line.displayName = "Card.Line";
30
+ Card.Link = components_card_cardLink.Link;
31
+ Card.Link.displayName = "Card.Link";
32
+ Card.Slot = components_card_cardSlot.Slot;
33
+ Card.Slot.displayName = "Card.Slot";
34
+ Card.Footer = components_card_cardFooter.Footer;
35
+ Card.Footer.displayName = "Card.Footer";
36
+ Card.Overline = components_card_cardOverline.Overline;
37
+ Card.Overline.displayName = "Card.Overline";
38
+ Card.Description = components_card_cardDescription.Description;
39
+ Card.Description.displayName = "Card.Description";
40
+ Card.Availability = components_card_cardAvailability.Availability;
41
+ Card.Availability.displayName = "Card.Availability";
42
+ Card.ColorDots = components_card_cardColorDots.ColorDots;
43
+ Card.ColorDots.displayName = "Card.ColorDots";
44
+ Card.Price = components_card_cardPrice.Price;
45
+ Card.Price.displayName = "Card.Price";
46
+ Card.ImageSlider = components_card_cardCarousel.ImageSlider;
47
+ Card.ImageSlider.displayName = "Card.ImageSlider";
49
48
  exports.Card = Card;
@@ -1,47 +1,20 @@
1
- import { HeadingProps } from './card-heading';
1
+ import { Heading, HeadingProps } from './card-heading';
2
2
  import { RootProps } from './card';
3
- import { ButtonProps } from './card-button';
4
- import { ContentProps } from './card-content';
5
- import { IllustrationProps } from './card-illustration';
6
- import { LineProps } from './card-line';
7
- import { LinkProps } from './card-link';
8
- import { SlotProps } from './card-slot';
9
- import { FooterProps } from './card-footer';
10
- import { OverlineProps } from './card-overline';
11
- import { DescriptionProps } from './card-description';
12
- import { AvailabilityProps } from './card-availability';
13
- import { ColorDotsProps } from './card-color-dots';
14
- import { PriceProps } from './card-price';
15
- import { ImageSliderProps } from './card-carousel';
3
+ import { Button, ButtonProps } from './card-button';
4
+ import { Content, ContentProps } from './card-content';
5
+ import { Illustration, IllustrationProps } from './card-illustration';
6
+ import { Line, LineProps } from './card-line';
7
+ import { Link, LinkProps } from './card-link';
8
+ import { Slot, SlotProps } from './card-slot';
9
+ import { Footer, FooterProps } from './card-footer';
10
+ import { Overline, OverlineProps } from './card-overline';
11
+ import { Description, DescriptionProps } from './card-description';
12
+ import { Availability, AvailabilityProps } from './card-availability';
13
+ import { ColorDots, ColorDotsProps } from './card-color-dots';
14
+ import { Price, PriceProps } from './card-price';
15
+ import { ImageSlider, ImageSliderProps } from './card-carousel';
16
16
 
17
- export declare const Card: import('react').ForwardRefExoticComponent<RootProps & import('react').RefAttributes<HTMLDivElement>> & {
18
- Heading: import('react').ForwardRefExoticComponent<HeadingProps & import('react').RefAttributes<HTMLHeadingElement>>;
19
- Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
20
- Content: import('react').ForwardRefExoticComponent<ContentProps & import('react').RefAttributes<HTMLDivElement>>;
21
- Illustration: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
22
- inset?: "all" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
23
- rounded?: boolean | undefined;
24
- } & import('react').RefAttributes<HTMLDivElement>>;
25
- Line: import('react').ForwardRefExoticComponent<LineProps & import('react').RefAttributes<HTMLDivElement>>;
26
- Link: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
27
- asChild?: boolean | undefined;
28
- disableVisited?: boolean | undefined;
29
- ensureTargetArea?: boolean | undefined;
30
- silent?: boolean | undefined;
31
- variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
32
- } & import('react').RefAttributes<HTMLAnchorElement>, "ref"> & import('react').RefAttributes<HTMLAnchorElement>>;
33
- Overline: import('react').ForwardRefExoticComponent<OverlineProps & import('react').RefAttributes<HTMLSpanElement>>;
34
- Slot: import('react').ForwardRefExoticComponent<SlotProps & import('react').RefAttributes<HTMLDivElement>>;
35
- Footer: import('react').ForwardRefExoticComponent<FooterProps & import('react').RefAttributes<HTMLDivElement>>;
36
- Description: import('react').ForwardRefExoticComponent<DescriptionProps & import('react').RefAttributes<HTMLSpanElement>>;
37
- Availability: import('react').ForwardRefExoticComponent<Partial<Omit<import('..').AlertBadgeProps & import('react').RefAttributes<HTMLSpanElement>, "ref">> & {
38
- statusText: string;
39
- } & import('react').RefAttributes<HTMLDivElement>>;
40
- ColorDots: import('react').ForwardRefExoticComponent<ColorDotsProps & import('react').RefAttributes<HTMLDivElement>>;
41
- Price: import('react').ForwardRefExoticComponent<PriceProps & import('react').RefAttributes<HTMLDivElement>>;
42
- ImageSlider: import('react').ForwardRefExoticComponent<ImageSliderProps & import('react').RefAttributes<HTMLDivElement>>;
43
- };
44
- export type CardProps = {
17
+ type CardProps = {
45
18
  Root: RootProps;
46
19
  Heading: HeadingProps;
47
20
  Button: ButtonProps;
@@ -58,3 +31,224 @@ export type CardProps = {
58
31
  Price: PriceProps;
59
32
  ImageSlider: ImageSliderProps;
60
33
  };
34
+ /**
35
+ * Card is a versatile container component that can be used to display various types of content in a structured and consistent way.
36
+ * It supports different variants, layouts, and can be used for both static and interactive content.
37
+ *
38
+ * @component
39
+ *
40
+ * @example
41
+ * // Basic card with default layout
42
+ * <Card>
43
+ * <Card.Heading>Basic Card</Card.Heading>
44
+ * <Card.Content>
45
+ * <Text>Some content here</Text>
46
+ * </Card.Content>
47
+ * </Card>
48
+ *
49
+ * @example
50
+ * // Navigation card with vertical layout
51
+ * <Card layout="navigation-vertical">
52
+ * <Card.Heading>Product Card</Card.Heading>
53
+ * <Card.Content>
54
+ * <Card.Button>View Details</Card.Button>
55
+ * </Card.Content>
56
+ * </Card>
57
+ *
58
+ * @example
59
+ * // Product card with product layout
60
+ * <Card layout="product">
61
+ * <Card.Illustration>
62
+ * <Image src="product.jpg" alt="Product" />
63
+ * </Card.Illustration>
64
+ * <Card.Heading>Product Name</Card.Heading>
65
+ * <Card.Price>99.99</Card.Price>
66
+ * <Card.Content>
67
+ * <Text>Product description</Text>
68
+ * </Card.Content>
69
+ * </Card.Footer>
70
+ * </Card>
71
+ *
72
+ * @example
73
+ * // Rich card with background image
74
+ * <Card layout="rich-card" backgroundImageSrc="background.jpg" imageGradient="light">
75
+ * <Card.Heading>Featured Content</Card.Heading>
76
+ * <Card.Description>Rich content with background image</Card.Description>
77
+ * <Card.Content>
78
+ * <Card.Button>Learn More</Card.Button>
79
+ * </Card.Content>
80
+ * </Card>
81
+ */
82
+ declare const Card: import('react').ForwardRefExoticComponent<RootProps & import('react').RefAttributes<HTMLDivElement>> & {
83
+ /**
84
+ * Main title of the card. Renders the internal Heading component.
85
+ * Should be used to provide clear context about the card's content.
86
+ *
87
+ * @component
88
+ *
89
+ * @example
90
+ * <Card.Heading>Product Name</Card.Heading>
91
+ */
92
+ Heading: typeof Heading;
93
+ /**
94
+ * Interactive button for navigation cards.
95
+ * When used, the entire card becomes interactive through ref forwarding.
96
+ * Should not be used together with Card.Link in the same card.
97
+ * Works best with navigation layouts (navigation-vertical, navigation-horizontal-small, etc.).
98
+ *
99
+ * @component
100
+ *
101
+ * @example
102
+ * <Card.Content>
103
+ * <Card.Button>View Details</Card.Button>
104
+ * </Card.Content>
105
+ */
106
+ Button: typeof Button;
107
+ /**
108
+ * Main content area of the card.
109
+ * Should wrap the primary content of the card.
110
+ * Layout and positioning are determined by the card's layout prop.
111
+ *
112
+ * @component
113
+ *
114
+ * @example
115
+ * <Card.Content>
116
+ * <Text>Main content goes here</Text>
117
+ * </Card.Content>
118
+ */
119
+ Content: typeof Content;
120
+ /**
121
+ * Container for images or illustrations.
122
+ * Handles proper sizing and positioning of visual content.
123
+ * Particularly important for product and rich card layouts.
124
+ *
125
+ * @component
126
+ *
127
+ * @example
128
+ * <Card.Illustration>
129
+ * <Image src="product.jpg" alt="Product" />
130
+ * </Card.Illustration>
131
+ */
132
+ Illustration: typeof Illustration;
133
+ /**
134
+ * Divider line between sections of the card.
135
+ * Used to create visual separation between content blocks.
136
+ * Common in product and rich card layouts.
137
+ *
138
+ * @component
139
+ *
140
+ * @example
141
+ * <Card.Line />
142
+ */
143
+ Line: typeof Line;
144
+ /**
145
+ * Alternative to Card.Button for navigation cards.
146
+ * When used, the entire card becomes interactive through ref forwarding.
147
+ * Should not be used together with Card.Button in the same card.
148
+ * Works best with navigation layouts.
149
+ *
150
+ * @component
151
+ *
152
+ * @example
153
+ * <Card.Content>
154
+ * <Card.Link>Learn More</Card.Link>
155
+ * </Card.Content>
156
+ */
157
+ Link: typeof Link;
158
+ /**
159
+ * Flexible container for badges, icons, or other small elements.
160
+ * Can be positioned using the align prop.
161
+ * Common in product cards for badges and status indicators.
162
+ *
163
+ * @component
164
+ *
165
+ * @example
166
+ * <Card.Slot align="top-right">
167
+ * <Badge>New</Badge>
168
+ * </Card.Slot>
169
+ */
170
+ Slot: typeof Slot;
171
+ /**
172
+ * Footer section of the card.
173
+ * Typically used for additional actions or information.
174
+ * Common in product cards for action buttons.
175
+ *
176
+ * @component
177
+ *
178
+ * @example
179
+ * <Card.Footer>
180
+ * <Button>Add to Cart</Button>
181
+ * </Card.Footer>
182
+ */
183
+ Footer: typeof Footer;
184
+ /**
185
+ * Text displayed above the heading.
186
+ * Used for additional context or categorization.
187
+ * Common in product and rich card layouts.
188
+ *
189
+ * @component
190
+ *
191
+ * @example
192
+ * <Card.Overline>Featured Product</Card.Overline>
193
+ */
194
+ Overline: typeof Overline;
195
+ /**
196
+ * Short description text for the card.
197
+ * Provides additional context about the card's content.
198
+ * Common in product and rich card layouts.
199
+ *
200
+ * @component
201
+ *
202
+ * @example
203
+ * <Card.Description>Limited time offer</Card.Description>
204
+ */
205
+ Description: typeof Description;
206
+ /**
207
+ * Shows availability status of a product or service.
208
+ * Primarily used in product card layouts.
209
+ *
210
+ * @component
211
+ *
212
+ * @example
213
+ * <Card.Availability>In Stock</Card.Availability>
214
+ */
215
+ Availability: typeof Availability;
216
+ /**
217
+ * Displays color options or variants.
218
+ * Useful for product cards with multiple color choices.
219
+ * Primarily used in product card layouts.
220
+ *
221
+ * @component
222
+ *
223
+ * @example
224
+ * <Card.ColorDots colors={['red', 'blue', 'green']} />
225
+ */
226
+ ColorDots: typeof ColorDots;
227
+ /**
228
+ * Shows pricing information.
229
+ * Can display various price formats and options.
230
+ * Primarily used in product card layouts.
231
+ *
232
+ * @component
233
+ *
234
+ * @example
235
+ * <Card.Price>99.99</Card.Price>
236
+ */
237
+ Price: typeof Price;
238
+ /**
239
+ * Carousel component for displaying multiple images.
240
+ * Useful for product cards with multiple views.
241
+ * Primarily used in product card layouts.
242
+ *
243
+ * @component
244
+ *
245
+ * @example
246
+ * <Card.ImageSlider>
247
+ * <Image src="view1.jpg" alt="View 1" />
248
+ * <Image src="view2.jpg" alt="View 2" />
249
+ * </Card.ImageSlider>
250
+ */
251
+ ImageSlider: typeof ImageSlider;
252
+ };
253
+ export { Card };
254
+ export type { CardProps };
@@ -13,37 +13,36 @@ import { Availability } from "./card-availability.js";
13
13
  import { ColorDots } from "./card-color-dots.js";
14
14
  import { Price } from "./card-price.js";
15
15
  import { ImageSlider } from "./card-carousel.js";
16
- Root.displayName = "Card";
17
- Button.displayName = "Card.Button";
18
- Content.displayName = "Card.Content";
19
- Heading.displayName = "Card.Heading";
20
- Illustration.displayName = "Card.Illustration";
21
- Line.displayName = "Card.Line";
22
- Link.displayName = "Card.Link";
23
- Slot.displayName = "Card.Slot";
24
- Footer.displayName = "Card.Footer";
25
- Overline.displayName = "Card.Overline";
26
- Description.displayName = "Card.Description";
27
- Availability.displayName = "Card.Availability";
28
- ColorDots.displayName = "Card.ColorDots";
29
- Price.displayName = "Card.Price";
30
- ImageSlider.displayName = "Card.ImageSlider";
31
- const Card = Object.assign(Root, {
32
- Heading,
33
- Button,
34
- Content,
35
- Illustration,
36
- Line,
37
- Link,
38
- Overline,
39
- Slot,
40
- Footer,
41
- Description,
42
- Availability,
43
- ColorDots,
44
- Price,
45
- ImageSlider
46
- });
16
+ const Card = Root;
17
+ Card.displayName = "Card";
18
+ Card.Heading = Heading;
19
+ Card.Heading.displayName = "Card.Heading";
20
+ Card.Button = Button;
21
+ Card.Button.displayName = "Card.Button";
22
+ Card.Content = Content;
23
+ Card.Content.displayName = "Card.Content";
24
+ Card.Illustration = Illustration;
25
+ Card.Illustration.displayName = "Card.Illustration";
26
+ Card.Line = Line;
27
+ Card.Line.displayName = "Card.Line";
28
+ Card.Link = Link;
29
+ Card.Link.displayName = "Card.Link";
30
+ Card.Slot = Slot;
31
+ Card.Slot.displayName = "Card.Slot";
32
+ Card.Footer = Footer;
33
+ Card.Footer.displayName = "Card.Footer";
34
+ Card.Overline = Overline;
35
+ Card.Overline.displayName = "Card.Overline";
36
+ Card.Description = Description;
37
+ Card.Description.displayName = "Card.Description";
38
+ Card.Availability = Availability;
39
+ Card.Availability.displayName = "Card.Availability";
40
+ Card.ColorDots = ColorDots;
41
+ Card.ColorDots.displayName = "Card.ColorDots";
42
+ Card.Price = Price;
43
+ Card.Price.displayName = "Card.Price";
44
+ Card.ImageSlider = ImageSlider;
45
+ Card.ImageSlider.displayName = "Card.ImageSlider";
47
46
  export {
48
47
  Card
49
48
  };
@@ -32,7 +32,7 @@ const Close = React.forwardRef(
32
32
  [drawer_module.styles[`${components_drawer_drawerRoot.rootClassName}__close--floating`]]: props.slot === "floating",
33
33
  className
34
34
  });
35
- return /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Close, { ...props, className: classes, ref: forwardedRef, asChild: true, children: props.children || /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "tertiary-purple", iconOnly: true, "aria-label": props["aria-label"], children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "close" }) }) });
35
+ return /* @__PURE__ */ jsxRuntime.jsx(DrawerPrimitive__namespace.Close, { ...props, className: classes, ref: forwardedRef, asChild: true, children: props.children || /* @__PURE__ */ jsxRuntime.jsx(components_button_button.Button, { variant: "tertiary-purple", iconOnly: true, "aria-label": props["aria-label"] ?? "Lukk", children: /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "close" }) }) });
36
36
  }
37
37
  );
38
38
  Close.displayName = "Close";
@@ -5,7 +5,12 @@ export type CloseProps = Omit<React.ComponentPropsWithoutRef<typeof DrawerPrimit
5
5
  children: React.ReactElement;
6
6
  slot: 'content';
7
7
  } | {
8
- ['aria-label']: string;
8
+ /**
9
+ * Accessibility purposes, providing a label for screen readers
10
+ *
11
+ * @default 'Lukk'
12
+ */
13
+ ['aria-label']?: string;
9
14
  slot: 'floating';
10
15
  children?: never;
11
16
  });
@@ -13,7 +13,7 @@ const Close = React__default.forwardRef(
13
13
  [styles[`${rootClassName}__close--floating`]]: props.slot === "floating",
14
14
  className
15
15
  });
16
- return /* @__PURE__ */ jsx(DrawerPrimitive.Close, { ...props, className: classes, ref: forwardedRef, asChild: true, children: props.children || /* @__PURE__ */ jsx(Button, { variant: "tertiary-purple", iconOnly: true, "aria-label": props["aria-label"], children: /* @__PURE__ */ jsx(Icon, { name: "close" }) }) });
16
+ return /* @__PURE__ */ jsx(DrawerPrimitive.Close, { ...props, className: classes, ref: forwardedRef, asChild: true, children: props.children || /* @__PURE__ */ jsx(Button, { variant: "tertiary-purple", iconOnly: true, "aria-label": props["aria-label"] ?? "Lukk", children: /* @__PURE__ */ jsx(Icon, { name: "close" }) }) });
17
17
  }
18
18
  );
19
19
  Close.displayName = "Close";
@@ -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
- components_drawer_drawerClose.Close.displayName = "Drawer.Close";
12
- components_drawer_drawerContent.Content.displayName = "Drawer.Content";
13
- components_drawer_drawerDescription.Description.displayName = "Drawer.Description";
14
- components_drawer_drawerFooter.Footer.displayName = "Drawer.Footer";
15
- components_drawer_drawerOverlay.Overlay.displayName = "Drawer.Overlay";
16
- components_drawer_drawerRoot.Root.displayName = "Drawer";
17
- components_drawer_drawerTitle.Title.displayName = "Drawer.Title";
18
- components_drawer_drawerTrigger.Trigger.displayName = "Drawer.Trigger";
19
- const Drawer = Object.assign(components_drawer_drawerRoot.Root, {
20
- Title: components_drawer_drawerTitle.Title,
21
- Description: components_drawer_drawerDescription.Description,
22
- Trigger: components_drawer_drawerTrigger.Trigger,
23
- Overlay: components_drawer_drawerOverlay.Overlay,
24
- Content: components_drawer_drawerContent.Content,
25
- Footer: components_drawer_drawerFooter.Footer,
26
- Close: components_drawer_drawerClose.Close
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
- export declare const Drawer: typeof Root & {
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
- Close.displayName = "Drawer.Close";
10
- Content.displayName = "Drawer.Content";
11
- Description.displayName = "Drawer.Description";
12
- Footer.displayName = "Drawer.Footer";
13
- Overlay.displayName = "Drawer.Overlay";
14
- Root.displayName = "Drawer";
15
- Title.displayName = "Drawer.Title";
16
- Trigger.displayName = "Drawer.Trigger";
17
- const Drawer = Object.assign(Root, {
18
- Title,
19
- Description,
20
- Trigger,
21
- Overlay,
22
- Content,
23
- Footer,
24
- Close
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 <VisuallyHidden asChild>.
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 <VisuallyHidden asChild>
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
  *
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.3.4",
23
+ "version": "0.3.7",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"