@telia/teddy 0.0.37 → 0.0.39

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.
Files changed (100) hide show
  1. package/dist/components/card/card-button.cjs +42 -0
  2. package/dist/components/card/card-button.d.ts +35 -0
  3. package/dist/components/card/card-button.js +42 -0
  4. package/dist/components/card/card-content.cjs +15 -0
  5. package/dist/components/card/card-content.d.ts +6 -0
  6. package/dist/components/card/card-content.js +15 -0
  7. package/dist/components/card/card-footer.cjs +15 -0
  8. package/dist/components/card/card-footer.d.ts +6 -0
  9. package/dist/components/card/card-footer.js +15 -0
  10. package/dist/components/card/card-heading.cjs +25 -0
  11. package/dist/components/card/card-heading.d.ts +6 -0
  12. package/dist/components/card/card-heading.js +25 -0
  13. package/dist/components/card/card-illustration.cjs +22 -0
  14. package/dist/components/card/card-illustration.d.ts +15 -0
  15. package/dist/components/card/card-illustration.js +22 -0
  16. package/dist/components/card/card-line.cjs +13 -0
  17. package/dist/components/card/card-line.d.ts +5 -0
  18. package/dist/components/card/card-line.js +13 -0
  19. package/dist/components/card/card-link.cjs +18 -0
  20. package/dist/components/card/card-link.d.ts +11 -0
  21. package/dist/components/card/card-link.js +18 -0
  22. package/dist/components/card/card-slot.cjs +36 -0
  23. package/dist/components/card/card-slot.d.ts +8 -0
  24. package/dist/components/card/card-slot.js +36 -0
  25. package/dist/components/card/card.cjs +38 -171
  26. package/dist/components/card/card.d.ts +15 -99
  27. package/dist/components/card/card.js +39 -172
  28. package/dist/components/card/index.cjs +28 -1
  29. package/dist/components/card/index.d.ts +64 -2
  30. package/dist/components/card/index.js +28 -1
  31. package/dist/components/card/utils.cjs +4 -0
  32. package/dist/components/card/utils.d.ts +2 -0
  33. package/dist/components/card/utils.js +4 -0
  34. package/dist/components/date-picker/css.cjs +59 -0
  35. package/dist/components/date-picker/css.d.ts +1 -0
  36. package/dist/components/date-picker/css.js +59 -0
  37. package/dist/components/date-picker/date-picker-day.cjs +67 -0
  38. package/dist/components/date-picker/date-picker-day.d.ts +13 -0
  39. package/dist/components/date-picker/date-picker-day.js +67 -0
  40. package/dist/components/date-picker/date-picker-input.cjs +89 -0
  41. package/dist/components/date-picker/date-picker-input.d.ts +27 -0
  42. package/dist/components/date-picker/date-picker-input.js +90 -0
  43. package/dist/components/date-picker/date-picker-localization.cjs +31 -0
  44. package/dist/components/date-picker/date-picker-localization.d.ts +20 -0
  45. package/dist/components/date-picker/date-picker-localization.js +32 -0
  46. package/dist/components/date-picker/date-picker-month.cjs +42 -0
  47. package/dist/components/date-picker/date-picker-month.d.ts +20 -0
  48. package/dist/components/date-picker/date-picker-month.js +43 -0
  49. package/dist/components/date-picker/date-picker-navigation-key.cjs +15 -0
  50. package/dist/components/date-picker/date-picker-navigation-key.d.ts +14 -0
  51. package/dist/components/date-picker/date-picker-navigation-key.js +16 -0
  52. package/dist/components/date-picker/date-picker-props.cjs +1 -0
  53. package/dist/components/date-picker/date-picker-props.d.ts +23 -0
  54. package/dist/components/date-picker/date-picker-props.js +1 -0
  55. package/dist/components/date-picker/date-picker-unique-id.cjs +4 -0
  56. package/dist/components/date-picker/date-picker-unique-id.d.ts +1 -0
  57. package/dist/components/date-picker/date-picker-unique-id.js +4 -0
  58. package/dist/components/date-picker/date-picker-year-print.cjs +61 -0
  59. package/dist/components/date-picker/date-picker-year-print.d.ts +12 -0
  60. package/dist/components/date-picker/date-picker-year-print.js +61 -0
  61. package/dist/components/date-picker/date-picker-year.cjs +36 -0
  62. package/dist/components/date-picker/date-picker-year.d.ts +16 -0
  63. package/dist/components/date-picker/date-picker-year.js +37 -0
  64. package/dist/components/date-picker/date-picker.cjs +597 -0
  65. package/dist/components/date-picker/date-picker.d.ts +5 -0
  66. package/dist/components/date-picker/date-picker.js +597 -0
  67. package/dist/components/date-picker/date-utils.cjs +340 -0
  68. package/dist/components/date-picker/date-utils.d.ts +29 -0
  69. package/dist/components/date-picker/date-utils.js +340 -0
  70. package/dist/components/date-picker/date-year-range.cjs +1 -0
  71. package/dist/components/date-picker/date-year-range.d.ts +4 -0
  72. package/dist/components/date-picker/date-year-range.js +1 -0
  73. package/dist/components/date-picker/dialog-utils.cjs +36 -0
  74. package/dist/components/date-picker/dialog-utils.d.ts +3 -0
  75. package/dist/components/date-picker/dialog-utils.js +36 -0
  76. package/dist/components/date-picker/index.cjs +4 -0
  77. package/dist/components/date-picker/index.d.ts +2 -0
  78. package/dist/components/date-picker/index.js +4 -0
  79. package/dist/components/expandable-card/expandable-card-root.cjs +15 -15
  80. package/dist/components/expandable-card/expandable-card-root.js +15 -15
  81. package/dist/components/image/image.cjs +1 -1
  82. package/dist/components/image/image.js +1 -1
  83. package/dist/components/index.cjs +4 -2
  84. package/dist/components/index.d.ts +1 -0
  85. package/dist/components/index.js +3 -1
  86. package/dist/components/modal/modal.cjs +4 -4
  87. package/dist/components/modal/modal.js +4 -4
  88. package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.cjs +33 -18
  89. package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.js +34 -19
  90. package/dist/components/navigation-menu/global-navigation/global-navigation-root.d.ts +3 -1
  91. package/dist/components/navigation-menu/global-navigation/utils.cjs +152 -125
  92. package/dist/components/navigation-menu/global-navigation/utils.d.ts +229 -219
  93. package/dist/components/navigation-menu/global-navigation/utils.js +152 -125
  94. package/dist/components/notification/notification.cjs +2 -2
  95. package/dist/components/notification/notification.d.ts +7 -7
  96. package/dist/components/notification/notification.js +1 -1
  97. package/dist/main.cjs +4 -2
  98. package/dist/main.js +3 -1
  99. package/dist/style.css +637 -187
  100. package/package.json +1 -1
@@ -3,49 +3,45 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const clsx = require("clsx");
6
- const utils_composeRefs = require("../../utils/composeRefs.cjs");
7
6
  const utils_composeEventHandlers = require("../../utils/composeEventHandlers.cjs");
8
- const components_box_box = require("../box/box.cjs");
9
- const components_heading_heading = require("../heading/heading.cjs");
10
- const components_button_button = require("../button/button.cjs");
11
- const components_link_link = require("../link/link.cjs");
12
- const tokens_spacing_variables = require("../../tokens/spacing/variables.cjs");
13
7
  const components_grid_grid = require("../grid/grid.cjs");
14
8
  const tokens_color_variables = require("../../tokens/color/variables.cjs");
15
9
  const styles = {
16
- "teddy-card": "_teddy-card_aok47_3",
17
- "teddy-card__slot": "_teddy-card__slot_aok47_13",
18
- "teddy-card__slot--bottom": "_teddy-card__slot--bottom_aok47_16",
19
- "teddy-card__slot--center": "_teddy-card__slot--center_aok47_19",
20
- "teddy-card--shadow": "_teddy-card--shadow_aok47_41",
21
- "teddy-card__action": "_teddy-card__action_aok47_45",
22
- "teddy-card__action--disabled": "_teddy-card__action--disabled_aok47_45",
23
- "teddy-card--border": "_teddy-card--border_aok47_52",
24
- "teddy-card--layout": "_teddy-card--layout_aok47_55",
25
- "teddy-card__illustration": "_teddy-card__illustration_aok47_55",
26
- "teddy-card__content": "_teddy-card__content_aok47_58",
27
- "teddy-card__heading": "_teddy-card__heading_aok47_61",
28
- "teddy-card--navigation-vertical": "_teddy-card--navigation-vertical_aok47_67",
29
- "teddy-card--navigation-horizontal-small": "_teddy-card--navigation-horizontal-small_aok47_86",
30
- "teddy-card--navigation-horizontal-large": "_teddy-card--navigation-horizontal-large_aok47_98",
31
- "teddy-card--rich-card": "_teddy-card--rich-card_aok47_110",
32
- "teddy-card__line": "_teddy-card__line_aok47_128",
33
- "teddy-card--purple-light": "_teddy-card--purple-light_aok47_132",
34
- "teddy-card--purple-dark": "_teddy-card--purple-dark_aok47_146",
35
- "teddy-card--white": "_teddy-card--white_aok47_165",
36
- "teddy-card--gray": "_teddy-card--gray_aok47_179",
37
- "teddy-card--beige": "_teddy-card--beige_aok47_193",
38
- "teddy-card__image--as-background": "_teddy-card__image--as-background_aok47_207",
39
- "teddy-card--background-image": "_teddy-card--background-image_aok47_213",
40
- "teddy-card__inset": "_teddy-card__inset_aok47_218",
41
- "teddy-card__inset--top": "_teddy-card__inset--top_aok47_221",
42
- "teddy-card__inset--left": "_teddy-card__inset--left_aok47_224",
43
- "teddy-card__inset--right": "_teddy-card__inset--right_aok47_227",
44
- "teddy-card__inset--bottom": "_teddy-card__inset--bottom_aok47_230"
10
+ "teddy-card": "_teddy-card_141ee_3",
11
+ "teddy-card__slot": "_teddy-card__slot_141ee_13",
12
+ "teddy-card__slot--bottom": "_teddy-card__slot--bottom_141ee_16",
13
+ "teddy-card__slot--center": "_teddy-card__slot--center_141ee_19",
14
+ "teddy-card--shadow": "_teddy-card--shadow_141ee_41",
15
+ "teddy-card__action": "_teddy-card__action_141ee_45",
16
+ "teddy-card__action--disabled": "_teddy-card__action--disabled_141ee_45",
17
+ "teddy-card--border": "_teddy-card--border_141ee_52",
18
+ "teddy-card--layout": "_teddy-card--layout_141ee_55",
19
+ "teddy-card__illustration": "_teddy-card__illustration_141ee_55",
20
+ "teddy-card__content": "_teddy-card__content_141ee_58",
21
+ "teddy-card__heading": "_teddy-card__heading_141ee_61",
22
+ "teddy-card__footer": "_teddy-card__footer_141ee_67",
23
+ "teddy-card--default": "_teddy-card--default_141ee_70",
24
+ "teddy-card--navigation-vertical": "_teddy-card--navigation-vertical_141ee_75",
25
+ "teddy-card--navigation-horizontal-small": "_teddy-card--navigation-horizontal-small_141ee_94",
26
+ "teddy-card--navigation-horizontal-large": "_teddy-card--navigation-horizontal-large_141ee_106",
27
+ "teddy-card--rich-card": "_teddy-card--rich-card_141ee_118",
28
+ "teddy-card__line": "_teddy-card__line_141ee_136",
29
+ "teddy-card--purple-light": "_teddy-card--purple-light_141ee_140",
30
+ "teddy-card--purple-dark": "_teddy-card--purple-dark_141ee_154",
31
+ "teddy-card--white": "_teddy-card--white_141ee_173",
32
+ "teddy-card--gray": "_teddy-card--gray_141ee_187",
33
+ "teddy-card--beige": "_teddy-card--beige_141ee_201",
34
+ "teddy-card__image--as-background": "_teddy-card__image--as-background_141ee_215",
35
+ "teddy-card--background-image": "_teddy-card--background-image_141ee_221",
36
+ "teddy-card__illustration--rounded": "_teddy-card__illustration--rounded_141ee_226",
37
+ "teddy-card__inset": "_teddy-card__inset_141ee_230",
38
+ "teddy-card__inset--top": "_teddy-card__inset--top_141ee_233",
39
+ "teddy-card__inset--left": "_teddy-card__inset--left_141ee_236",
40
+ "teddy-card__inset--right": "_teddy-card__inset--right_141ee_239",
41
+ "teddy-card__inset--bottom": "_teddy-card__inset--bottom_141ee_242"
45
42
  };
46
43
  const rootClassName = "teddy-card";
47
44
  const actionElementIdentifier = `${rootClassName}__action`;
48
- const variantOptions = ["purple-light", "purple-dark", "gray", "white", "beige"];
49
45
  const RootContext = React.createContext(void 0);
50
46
  const Root = React.forwardRef(
51
47
  ({ className, children, shadow, backgroundImageSrc, imageGradient, layout, variant, bordered, ...props }, forwardRef) => {
@@ -98,138 +94,9 @@ const Root = React.forwardRef(
98
94
  ) });
99
95
  }
100
96
  );
101
- Root.displayName = "Card";
102
- const Heading = React.forwardRef(
103
- ({ className, as = "h2", ...props }, forwardRef) => {
104
- const classes = clsx([styles[`${rootClassName}__heading`]], className);
105
- const variant = props.variant ?? "title-200";
106
- return /* @__PURE__ */ jsxRuntime.jsx(
107
- components_heading_heading.Heading,
108
- {
109
- ...props,
110
- ...!props.asChild ? { as, asChild: false } : { as: void 0, asChild: true },
111
- variant,
112
- ref: forwardRef,
113
- className: classes
114
- }
115
- );
116
- }
117
- );
118
- Heading.displayName = "Card.Heading";
119
- const Content = React.forwardRef(({ className, ...props }, forwardRef) => {
120
- const classes = clsx([styles[`${rootClassName}__content`]], className);
121
- return /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { ...props, ref: forwardRef, className: classes });
122
- });
123
- Content.displayName = "Card.Content";
124
- const Slot = React.forwardRef(({ className, align, ...props }, forwardRef) => {
125
- const classes = clsx(
126
- [
127
- styles[`${rootClassName}__slot`],
128
- {
129
- [styles[`${rootClassName}__slot--center`]]: align === "top" || align === "bottom",
130
- [styles[`${rootClassName}__slot--bottom`]]: align == null ? void 0 : align.includes("bottom")
131
- }
132
- ],
133
- className
134
- );
135
- return /* @__PURE__ */ jsxRuntime.jsx(
136
- components_box_box.Box,
137
- {
138
- position: "absolute",
139
- top: (align == null ? void 0 : align.includes("top")) ? "0" : void 0,
140
- bottom: (align == null ? void 0 : align.includes("bottom")) ? "0" : void 0,
141
- left: (align == null ? void 0 : align.includes("left")) ? "200" : (align == null ? void 0 : align.includes("right")) ? void 0 : "50%",
142
- right: (align == null ? void 0 : align.includes("right")) ? "200" : void 0,
143
- ...props,
144
- ref: forwardRef,
145
- className: classes
146
- }
147
- );
148
- });
149
- const insetOptions = [
150
- "top",
151
- "bottom",
152
- "left",
153
- "right",
154
- "all",
155
- "top-right-left",
156
- "bottom-left-right",
157
- "top-left",
158
- "top-right",
159
- "bottom-left",
160
- "bottom-right",
161
- "top-bottom",
162
- "left-right"
163
- ];
164
- const Illustration = React.forwardRef(
165
- ({ className, children, ...props }, forwardRef) => {
166
- var _a, _b, _c, _d, _e, _f, _g, _h;
167
- const classes = clsx([styles[`${rootClassName}__illustration`]], className, [styles[`${rootClassName}__inset`]], {
168
- [styles[`${rootClassName}__inset--top`]]: ((_a = props.inset) == null ? void 0 : _a.includes("top")) || ((_b = props.inset) == null ? void 0 : _b.includes("all")),
169
- [styles[`${rootClassName}__inset--bottom`]]: ((_c = props.inset) == null ? void 0 : _c.includes("bottom")) || ((_d = props.inset) == null ? void 0 : _d.includes("all")),
170
- [styles[`${rootClassName}__inset--left`]]: ((_e = props.inset) == null ? void 0 : _e.includes("left")) || ((_f = props.inset) == null ? void 0 : _f.includes("all")),
171
- [styles[`${rootClassName}__inset--right`]]: ((_g = props.inset) == null ? void 0 : _g.includes("right")) || ((_h = props.inset) == null ? void 0 : _h.includes("all"))
172
- });
173
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, className: classes, ref: forwardRef, children });
174
- }
175
- );
176
- Illustration.displayName = "Card.Illustration";
177
- function getButtonVariant(variant) {
178
- switch (variant) {
179
- case "purple-dark":
180
- return "primary-negative";
181
- default:
182
- return "primary";
183
- }
184
- }
185
- const Button = React.forwardRef(
186
- ({ className, iconOnly = false, ...props }, forwardRef) => {
187
- const context = React.useContext(RootContext);
188
- const classes = clsx(
189
- [styles[`${rootClassName}__button`]],
190
- styles[actionElementIdentifier],
191
- {
192
- [styles[`${actionElementIdentifier}--disabled`]]: props.disabled
193
- },
194
- className
195
- );
196
- const ref = utils_composeRefs.composeRefs(context == null ? void 0 : context.buttonRef, forwardRef);
197
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
198
- components_button_button.Button,
199
- {
200
- ...!iconOnly || !props["aria-label"] ? { iconOnly: false, "aria-label": void 0 } : { iconOnly: true, "aria-label": props["aria-label"] },
201
- ref,
202
- variant: getButtonVariant(context == null ? void 0 : context.variant),
203
- ...props,
204
- className: classes
205
- }
206
- ) });
207
- }
208
- );
209
- Button.displayName = "Card.Button";
210
- const Link = React.forwardRef(
211
- ({ className, ...props }, forwardRef) => {
212
- const context = React.useContext(RootContext);
213
- const classes = clsx([styles[`${rootClassName}__link`]], styles[actionElementIdentifier], className);
214
- const ref = utils_composeRefs.composeRefs(context == null ? void 0 : context.linkRef, forwardRef);
215
- return /* @__PURE__ */ jsxRuntime.jsx(components_link_link.Link, { ...props, ref, className: classes });
216
- }
217
- );
218
- Link.displayName = "Card.Link";
219
- const Line = React.forwardRef(({ className, ...props }, forwardRef) => {
220
- const classes = clsx([styles[`${rootClassName}__line`]], className);
221
- return /* @__PURE__ */ jsxRuntime.jsx(components_box_box.Box, { width: "100%", p: "0", m: `${tokens_spacing_variables.teddySpacing50} 0`, ...props, ref: forwardRef, className: classes, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("hr", {}) });
222
- });
223
- const Card = Object.assign(Root, {
224
- Root,
225
- Heading,
226
- Content,
227
- Illustration,
228
- Button,
229
- Link,
230
- Slot,
231
- Line,
232
- variantOptions,
233
- insetOptions
234
- });
235
- exports.Card = Card;
97
+ Root.displayName = "Root";
98
+ exports.Root = Root;
99
+ exports.RootContext = RootContext;
100
+ exports.actionElementIdentifier = actionElementIdentifier;
101
+ exports.rootClassName = rootClassName;
102
+ exports.styles = styles;
@@ -1,18 +1,21 @@
1
1
  import { default as React } from 'react';
2
- import { Box } from '../box';
3
- import { Heading as PrimitiveHeading } from '../heading';
4
- import { Button as PrimitiveButton } from '../button';
5
- import { Link as PrimitiveLink } from '../link';
6
2
  import { Grid } from '../grid';
3
+ import { Variant } from './utils';
7
4
 
8
- declare const variantOptions: readonly ["purple-light", "purple-dark", "gray", "white", "beige"];
9
- type Variant = (typeof variantOptions)[number];
10
- type Layout = 'navigation-vertical' | 'navigation-horizontal-small' | 'navigation-horizontal-large' | 'rich-card';
11
- type Gradient = 'light' | 'dark';
5
+ export declare const rootClassName = "teddy-card";
6
+ export declare const actionElementIdentifier = "teddy-card__action";
7
+ export type Layout = 'navigation-vertical' | 'navigation-horizontal-small' | 'navigation-horizontal-large' | 'rich-card';
8
+ type Gradient = 'light' | 'dark' | 'default';
9
+ export declare const RootContext: React.Context<{
10
+ buttonRef: React.RefObject<HTMLButtonElement>;
11
+ linkRef: React.RefObject<HTMLAnchorElement>;
12
+ variant?: "beige" | "gray" | "white" | "purple-light" | "purple-dark" | undefined;
13
+ layout?: Layout | undefined;
14
+ } | undefined>;
12
15
  /** -------------------------------------------------------------------------------------------------
13
16
  * Root
14
17
  * -----------------------------------------------------------------------------------------------*/
15
- type RootProps = React.ComponentPropsWithoutRef<typeof Grid> & {
18
+ export type RootProps = React.ComponentPropsWithoutRef<typeof Grid> & {
16
19
  asChild?: boolean;
17
20
  variant?: Variant;
18
21
  bordered?: boolean;
@@ -21,93 +24,6 @@ type RootProps = React.ComponentPropsWithoutRef<typeof Grid> & {
21
24
  imageGradient?: Gradient;
22
25
  layout?: Layout;
23
26
  };
24
- /** -------------------------------------------------------------------------------------------------
25
- * Heading
26
- * -----------------------------------------------------------------------------------------------*/
27
- type HeadingProps = Partial<React.ComponentPropsWithoutRef<typeof PrimitiveHeading>>;
28
- /** -------------------------------------------------------------------------------------------------
29
- * Content
30
- * -----------------------------------------------------------------------------------------------*/
31
- type ContentProps = React.ComponentPropsWithoutRef<typeof Box>;
32
- /** -------------------------------------------------------------------------------------------------
33
- * Slot
34
- * -----------------------------------------------------------------------------------------------*/
35
- type SlotProps = React.ComponentPropsWithoutRef<typeof Box> & {
36
- align?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
37
- };
38
- /** -------------------------------------------------------------------------------------------------
39
- * Illustration
40
- * -----------------------------------------------------------------------------------------------*/
41
- declare const insetOptions: readonly ["top", "bottom", "left", "right", "all", "top-right-left", "bottom-left-right", "top-left", "top-right", "bottom-left", "bottom-right", "top-bottom", "left-right"];
42
- type IllustrationProps = React.ComponentPropsWithoutRef<'div'> & {
43
- /** The inset allows make the image bleed out to the edges */
44
- inset?: (typeof insetOptions)[number];
45
- };
46
- type ButtonProps = Omit<React.ComponentPropsWithoutRef<typeof PrimitiveButton>, 'variant'> & {
47
- variant?: React.ComponentPropsWithoutRef<typeof PrimitiveButton>['variant'];
48
- };
49
- /** -------------------------------------------------------------------------------------------------
50
- * Link
51
- * -----------------------------------------------------------------------------------------------*/
52
- type LinkProps = React.ComponentPropsWithoutRef<typeof PrimitiveLink>;
53
- /** -------------------------------------------------------------------------------------------------
54
- * Line
55
- * -----------------------------------------------------------------------------------------------*/
56
- type LineProps = Omit<React.ComponentPropsWithoutRef<typeof Box>, 'asChild' | 'as' | 'children'>;
57
- declare const Card: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>> & {
58
- Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
59
- Heading: React.ForwardRefExoticComponent<HeadingProps & React.RefAttributes<HTMLHeadingElement>>;
60
- Content: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<HTMLDivElement>>;
61
- Illustration: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
62
- /** The inset allows make the image bleed out to the edges */
63
- inset?: "top" | "bottom" | "left" | "right" | "all" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
64
- } & React.RefAttributes<HTMLDivElement>>;
65
- Button: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & 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/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 & {
66
- display?: import('../../utils/generate-styling').DisplayChildren | undefined;
67
- } & {
68
- asChild?: boolean | undefined;
69
- loading?: boolean | undefined;
70
- fullWidth?: boolean | undefined;
71
- size?: "sm" | "md" | "lg" | undefined;
72
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
73
- } & {
74
- iconOnly: true;
75
- "aria-label": string;
76
- } & React.RefAttributes<HTMLButtonElement>, "ref"> | Omit<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & 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/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 & {
77
- display?: import('../../utils/generate-styling').DisplayChildren | undefined;
78
- } & {
79
- asChild?: boolean | undefined;
80
- loading?: boolean | undefined;
81
- fullWidth?: boolean | undefined;
82
- size?: "sm" | "md" | "lg" | undefined;
83
- variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
84
- } & {
85
- iconOnly?: false | undefined;
86
- "aria-label"?: string | undefined;
87
- } & React.RefAttributes<HTMLButtonElement>, "ref">, "variant"> & {
88
- variant?: React.ComponentPropsWithoutRef<typeof PrimitiveButton>['variant'];
89
- } & React.RefAttributes<HTMLButtonElement>>;
90
- Link: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
91
- asChild?: boolean | undefined;
92
- disableVisited?: boolean | undefined;
93
- ensureTargetArea?: boolean | undefined;
94
- silent?: boolean | undefined;
95
- variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
96
- } & React.RefAttributes<HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
97
- Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLDivElement>>;
98
- Line: React.ForwardRefExoticComponent<LineProps & React.RefAttributes<HTMLDivElement>>;
99
- variantOptions: readonly ["purple-light", "purple-dark", "gray", "white", "beige"];
100
- insetOptions: readonly ["top", "bottom", "left", "right", "all", "top-right-left", "bottom-left-right", "top-left", "top-right", "bottom-left", "bottom-right", "top-bottom", "left-right"];
101
- };
102
- type CardProps = {
103
- Root: RootProps;
104
- Heading: HeadingProps;
105
- Content: ContentProps;
106
- Button: ButtonProps;
107
- Illustration: IllustrationProps;
108
- Slot: SlotProps;
109
- Link: LinkProps;
110
- Line: LineProps;
111
- };
112
- export { Card };
113
- export type { CardProps };
27
+ /** This component is used to render a card element. */
28
+ export declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
29
+ export {};
@@ -1,49 +1,45 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import React__default from "react";
3
3
  import clsx from "clsx";
4
- import { composeRefs } from "../../utils/composeRefs.js";
5
4
  import { composeEventHandlers } from "../../utils/composeEventHandlers.js";
6
- import { Box } from "../box/box.js";
7
- import { Heading as Heading$1 } from "../heading/heading.js";
8
- import { Button as Button$1 } from "../button/button.js";
9
- import { Link as Link$1 } from "../link/link.js";
10
- import { teddySpacing50 } from "../../tokens/spacing/variables.js";
11
5
  import { Grid } from "../grid/grid.js";
12
6
  import { teddyColorTransparentWhite850, teddyColorTransparentWhite800, teddyColorTransparentWhite100, teddyColorTransparentBlack600, teddyColorTransparentBlack200 } from "../../tokens/color/variables.js";
13
7
  const styles = {
14
- "teddy-card": "_teddy-card_aok47_3",
15
- "teddy-card__slot": "_teddy-card__slot_aok47_13",
16
- "teddy-card__slot--bottom": "_teddy-card__slot--bottom_aok47_16",
17
- "teddy-card__slot--center": "_teddy-card__slot--center_aok47_19",
18
- "teddy-card--shadow": "_teddy-card--shadow_aok47_41",
19
- "teddy-card__action": "_teddy-card__action_aok47_45",
20
- "teddy-card__action--disabled": "_teddy-card__action--disabled_aok47_45",
21
- "teddy-card--border": "_teddy-card--border_aok47_52",
22
- "teddy-card--layout": "_teddy-card--layout_aok47_55",
23
- "teddy-card__illustration": "_teddy-card__illustration_aok47_55",
24
- "teddy-card__content": "_teddy-card__content_aok47_58",
25
- "teddy-card__heading": "_teddy-card__heading_aok47_61",
26
- "teddy-card--navigation-vertical": "_teddy-card--navigation-vertical_aok47_67",
27
- "teddy-card--navigation-horizontal-small": "_teddy-card--navigation-horizontal-small_aok47_86",
28
- "teddy-card--navigation-horizontal-large": "_teddy-card--navigation-horizontal-large_aok47_98",
29
- "teddy-card--rich-card": "_teddy-card--rich-card_aok47_110",
30
- "teddy-card__line": "_teddy-card__line_aok47_128",
31
- "teddy-card--purple-light": "_teddy-card--purple-light_aok47_132",
32
- "teddy-card--purple-dark": "_teddy-card--purple-dark_aok47_146",
33
- "teddy-card--white": "_teddy-card--white_aok47_165",
34
- "teddy-card--gray": "_teddy-card--gray_aok47_179",
35
- "teddy-card--beige": "_teddy-card--beige_aok47_193",
36
- "teddy-card__image--as-background": "_teddy-card__image--as-background_aok47_207",
37
- "teddy-card--background-image": "_teddy-card--background-image_aok47_213",
38
- "teddy-card__inset": "_teddy-card__inset_aok47_218",
39
- "teddy-card__inset--top": "_teddy-card__inset--top_aok47_221",
40
- "teddy-card__inset--left": "_teddy-card__inset--left_aok47_224",
41
- "teddy-card__inset--right": "_teddy-card__inset--right_aok47_227",
42
- "teddy-card__inset--bottom": "_teddy-card__inset--bottom_aok47_230"
8
+ "teddy-card": "_teddy-card_141ee_3",
9
+ "teddy-card__slot": "_teddy-card__slot_141ee_13",
10
+ "teddy-card__slot--bottom": "_teddy-card__slot--bottom_141ee_16",
11
+ "teddy-card__slot--center": "_teddy-card__slot--center_141ee_19",
12
+ "teddy-card--shadow": "_teddy-card--shadow_141ee_41",
13
+ "teddy-card__action": "_teddy-card__action_141ee_45",
14
+ "teddy-card__action--disabled": "_teddy-card__action--disabled_141ee_45",
15
+ "teddy-card--border": "_teddy-card--border_141ee_52",
16
+ "teddy-card--layout": "_teddy-card--layout_141ee_55",
17
+ "teddy-card__illustration": "_teddy-card__illustration_141ee_55",
18
+ "teddy-card__content": "_teddy-card__content_141ee_58",
19
+ "teddy-card__heading": "_teddy-card__heading_141ee_61",
20
+ "teddy-card__footer": "_teddy-card__footer_141ee_67",
21
+ "teddy-card--default": "_teddy-card--default_141ee_70",
22
+ "teddy-card--navigation-vertical": "_teddy-card--navigation-vertical_141ee_75",
23
+ "teddy-card--navigation-horizontal-small": "_teddy-card--navigation-horizontal-small_141ee_94",
24
+ "teddy-card--navigation-horizontal-large": "_teddy-card--navigation-horizontal-large_141ee_106",
25
+ "teddy-card--rich-card": "_teddy-card--rich-card_141ee_118",
26
+ "teddy-card__line": "_teddy-card__line_141ee_136",
27
+ "teddy-card--purple-light": "_teddy-card--purple-light_141ee_140",
28
+ "teddy-card--purple-dark": "_teddy-card--purple-dark_141ee_154",
29
+ "teddy-card--white": "_teddy-card--white_141ee_173",
30
+ "teddy-card--gray": "_teddy-card--gray_141ee_187",
31
+ "teddy-card--beige": "_teddy-card--beige_141ee_201",
32
+ "teddy-card__image--as-background": "_teddy-card__image--as-background_141ee_215",
33
+ "teddy-card--background-image": "_teddy-card--background-image_141ee_221",
34
+ "teddy-card__illustration--rounded": "_teddy-card__illustration--rounded_141ee_226",
35
+ "teddy-card__inset": "_teddy-card__inset_141ee_230",
36
+ "teddy-card__inset--top": "_teddy-card__inset--top_141ee_233",
37
+ "teddy-card__inset--left": "_teddy-card__inset--left_141ee_236",
38
+ "teddy-card__inset--right": "_teddy-card__inset--right_141ee_239",
39
+ "teddy-card__inset--bottom": "_teddy-card__inset--bottom_141ee_242"
43
40
  };
44
41
  const rootClassName = "teddy-card";
45
42
  const actionElementIdentifier = `${rootClassName}__action`;
46
- const variantOptions = ["purple-light", "purple-dark", "gray", "white", "beige"];
47
43
  const RootContext = React__default.createContext(void 0);
48
44
  const Root = React__default.forwardRef(
49
45
  ({ className, children, shadow, backgroundImageSrc, imageGradient, layout, variant, bordered, ...props }, forwardRef) => {
@@ -96,140 +92,11 @@ const Root = React__default.forwardRef(
96
92
  ) });
97
93
  }
98
94
  );
99
- Root.displayName = "Card";
100
- const Heading = React__default.forwardRef(
101
- ({ className, as = "h2", ...props }, forwardRef) => {
102
- const classes = clsx([styles[`${rootClassName}__heading`]], className);
103
- const variant = props.variant ?? "title-200";
104
- return /* @__PURE__ */ jsx(
105
- Heading$1,
106
- {
107
- ...props,
108
- ...!props.asChild ? { as, asChild: false } : { as: void 0, asChild: true },
109
- variant,
110
- ref: forwardRef,
111
- className: classes
112
- }
113
- );
114
- }
115
- );
116
- Heading.displayName = "Card.Heading";
117
- const Content = React__default.forwardRef(({ className, ...props }, forwardRef) => {
118
- const classes = clsx([styles[`${rootClassName}__content`]], className);
119
- return /* @__PURE__ */ jsx(Box, { ...props, ref: forwardRef, className: classes });
120
- });
121
- Content.displayName = "Card.Content";
122
- const Slot = React__default.forwardRef(({ className, align, ...props }, forwardRef) => {
123
- const classes = clsx(
124
- [
125
- styles[`${rootClassName}__slot`],
126
- {
127
- [styles[`${rootClassName}__slot--center`]]: align === "top" || align === "bottom",
128
- [styles[`${rootClassName}__slot--bottom`]]: align == null ? void 0 : align.includes("bottom")
129
- }
130
- ],
131
- className
132
- );
133
- return /* @__PURE__ */ jsx(
134
- Box,
135
- {
136
- position: "absolute",
137
- top: (align == null ? void 0 : align.includes("top")) ? "0" : void 0,
138
- bottom: (align == null ? void 0 : align.includes("bottom")) ? "0" : void 0,
139
- left: (align == null ? void 0 : align.includes("left")) ? "200" : (align == null ? void 0 : align.includes("right")) ? void 0 : "50%",
140
- right: (align == null ? void 0 : align.includes("right")) ? "200" : void 0,
141
- ...props,
142
- ref: forwardRef,
143
- className: classes
144
- }
145
- );
146
- });
147
- const insetOptions = [
148
- "top",
149
- "bottom",
150
- "left",
151
- "right",
152
- "all",
153
- "top-right-left",
154
- "bottom-left-right",
155
- "top-left",
156
- "top-right",
157
- "bottom-left",
158
- "bottom-right",
159
- "top-bottom",
160
- "left-right"
161
- ];
162
- const Illustration = React__default.forwardRef(
163
- ({ className, children, ...props }, forwardRef) => {
164
- var _a, _b, _c, _d, _e, _f, _g, _h;
165
- const classes = clsx([styles[`${rootClassName}__illustration`]], className, [styles[`${rootClassName}__inset`]], {
166
- [styles[`${rootClassName}__inset--top`]]: ((_a = props.inset) == null ? void 0 : _a.includes("top")) || ((_b = props.inset) == null ? void 0 : _b.includes("all")),
167
- [styles[`${rootClassName}__inset--bottom`]]: ((_c = props.inset) == null ? void 0 : _c.includes("bottom")) || ((_d = props.inset) == null ? void 0 : _d.includes("all")),
168
- [styles[`${rootClassName}__inset--left`]]: ((_e = props.inset) == null ? void 0 : _e.includes("left")) || ((_f = props.inset) == null ? void 0 : _f.includes("all")),
169
- [styles[`${rootClassName}__inset--right`]]: ((_g = props.inset) == null ? void 0 : _g.includes("right")) || ((_h = props.inset) == null ? void 0 : _h.includes("all"))
170
- });
171
- return /* @__PURE__ */ jsx("div", { ...props, className: classes, ref: forwardRef, children });
172
- }
173
- );
174
- Illustration.displayName = "Card.Illustration";
175
- function getButtonVariant(variant) {
176
- switch (variant) {
177
- case "purple-dark":
178
- return "primary-negative";
179
- default:
180
- return "primary";
181
- }
182
- }
183
- const Button = React__default.forwardRef(
184
- ({ className, iconOnly = false, ...props }, forwardRef) => {
185
- const context = React__default.useContext(RootContext);
186
- const classes = clsx(
187
- [styles[`${rootClassName}__button`]],
188
- styles[actionElementIdentifier],
189
- {
190
- [styles[`${actionElementIdentifier}--disabled`]]: props.disabled
191
- },
192
- className
193
- );
194
- const ref = composeRefs(context == null ? void 0 : context.buttonRef, forwardRef);
195
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
196
- Button$1,
197
- {
198
- ...!iconOnly || !props["aria-label"] ? { iconOnly: false, "aria-label": void 0 } : { iconOnly: true, "aria-label": props["aria-label"] },
199
- ref,
200
- variant: getButtonVariant(context == null ? void 0 : context.variant),
201
- ...props,
202
- className: classes
203
- }
204
- ) });
205
- }
206
- );
207
- Button.displayName = "Card.Button";
208
- const Link = React__default.forwardRef(
209
- ({ className, ...props }, forwardRef) => {
210
- const context = React__default.useContext(RootContext);
211
- const classes = clsx([styles[`${rootClassName}__link`]], styles[actionElementIdentifier], className);
212
- const ref = composeRefs(context == null ? void 0 : context.linkRef, forwardRef);
213
- return /* @__PURE__ */ jsx(Link$1, { ...props, ref, className: classes });
214
- }
215
- );
216
- Link.displayName = "Card.Link";
217
- const Line = React__default.forwardRef(({ className, ...props }, forwardRef) => {
218
- const classes = clsx([styles[`${rootClassName}__line`]], className);
219
- return /* @__PURE__ */ jsx(Box, { width: "100%", p: "0", m: `${teddySpacing50} 0`, ...props, ref: forwardRef, className: classes, asChild: true, children: /* @__PURE__ */ jsx("hr", {}) });
220
- });
221
- const Card = Object.assign(Root, {
222
- Root,
223
- Heading,
224
- Content,
225
- Illustration,
226
- Button,
227
- Link,
228
- Slot,
229
- Line,
230
- variantOptions,
231
- insetOptions
232
- });
95
+ Root.displayName = "Root";
233
96
  export {
234
- Card
97
+ Root,
98
+ RootContext,
99
+ actionElementIdentifier,
100
+ rootClassName,
101
+ styles as s
235
102
  };
@@ -1,4 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_card_cardHeading = require("./card-heading.cjs");
3
4
  const components_card_card = require("./card.cjs");
4
- exports.Card = components_card_card.Card;
5
+ const components_card_cardButton = require("./card-button.cjs");
6
+ const components_card_cardContent = require("./card-content.cjs");
7
+ const components_card_cardIllustration = require("./card-illustration.cjs");
8
+ const components_card_cardLine = require("./card-line.cjs");
9
+ const components_card_cardLink = require("./card-link.cjs");
10
+ const components_card_cardSlot = require("./card-slot.cjs");
11
+ const components_card_cardFooter = require("./card-footer.cjs");
12
+ components_card_card.Root.displayName = "Card";
13
+ components_card_cardButton.Button.displayName = "Card.Button";
14
+ components_card_cardContent.Content.displayName = "Card.Content";
15
+ components_card_cardHeading.Heading.displayName = "Card.Heading";
16
+ components_card_cardIllustration.Illustration.displayName = "Card.Illustration";
17
+ components_card_cardLine.Line.displayName = "Card.Line";
18
+ components_card_cardLink.Link.displayName = "Card.Link";
19
+ components_card_cardSlot.Slot.displayName = "Card.Slot";
20
+ components_card_cardFooter.Footer.displayName = "Card.Footer";
21
+ const Card = Object.assign(components_card_card.Root, {
22
+ Heading: components_card_cardHeading.Heading,
23
+ Button: components_card_cardButton.Button,
24
+ Content: components_card_cardContent.Content,
25
+ Illustration: components_card_cardIllustration.Illustration,
26
+ Line: components_card_cardLine.Line,
27
+ Link: components_card_cardLink.Link,
28
+ Slot: components_card_cardSlot.Slot,
29
+ Footer: components_card_cardFooter.Footer
30
+ });
31
+ exports.Card = Card;