@telia/teddy 0.0.15 → 0.0.16

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 (116) hide show
  1. package/dist/components/accordion/accordion.d.ts +2 -1
  2. package/dist/components/accordion/accordion.js +90 -24
  3. package/dist/components/accordion/index.js +2 -2
  4. package/dist/components/badge/badge.js +40 -24
  5. package/dist/components/badge/index.js +2 -2
  6. package/dist/components/box/box.js +14 -10
  7. package/dist/components/box/index.js +2 -2
  8. package/dist/components/button/button.js +60 -52
  9. package/dist/components/button/index.js +2 -2
  10. package/dist/components/card/card.d.ts +29 -3
  11. package/dist/components/card/card.js +202 -25
  12. package/dist/components/card/index.js +2 -2
  13. package/dist/components/field-error-text/field-error-text.js +21 -19
  14. package/dist/components/field-error-text/index.js +2 -2
  15. package/dist/components/flex/flex.js +15 -12
  16. package/dist/components/flex/index.js +2 -2
  17. package/dist/components/grid/grid.js +15 -12
  18. package/dist/components/grid/index.js +2 -2
  19. package/dist/components/heading/heading.js +22 -19
  20. package/dist/components/heading/index.js +2 -2
  21. package/dist/components/helper-text/helper-text.js +14 -13
  22. package/dist/components/helper-text/index.js +2 -2
  23. package/dist/components/icon/icon.js +16 -14
  24. package/dist/components/icon/index.js +4 -4
  25. package/dist/components/index.js +51 -46
  26. package/dist/components/input/index.js +3 -3
  27. package/dist/components/input/input.js +79 -66
  28. package/dist/components/label/index.js +2 -2
  29. package/dist/components/label/label.js +17 -23
  30. package/dist/components/link/index.js +2 -2
  31. package/dist/components/link/link.js +20 -19
  32. package/dist/components/modal/index.js +2 -2
  33. package/dist/components/modal/modal.js +173 -14
  34. package/dist/components/navigation-menu/index.js +2 -2
  35. package/dist/components/navigation-menu/navigation-menu.js +391 -8
  36. package/dist/components/notification/index.js +2 -2
  37. package/dist/components/notification/notification.d.ts +8 -7
  38. package/dist/components/notification/notification.js +96 -24
  39. package/dist/components/radio-group/index.js +2 -2
  40. package/dist/components/radio-group/radio-group.js +91 -8
  41. package/dist/components/spinner/index.js +2 -2
  42. package/dist/components/spinner/spinner.js +36 -29
  43. package/dist/components/text/index.js +2 -2
  44. package/dist/components/text/text.js +18 -17
  45. package/dist/components/text-field/index.js +2 -2
  46. package/dist/components/text-field/text-field.js +110 -90
  47. package/dist/components/text-spacing/index.js +2 -2
  48. package/dist/components/text-spacing/text-spacing.js +14 -12
  49. package/dist/components/toggle/index.js +2 -2
  50. package/dist/components/toggle/toggle.d.ts +1 -1
  51. package/dist/components/toggle/toggle.js +84 -23
  52. package/dist/components/visually-hidden/index.js +2 -2
  53. package/dist/components/visually-hidden/visually-hidden.js +17 -15
  54. package/dist/icons/category.js +2 -2
  55. package/dist/icons/name.js +2 -2
  56. package/dist/main.js +359 -61
  57. package/dist/style.css +3402 -0
  58. package/dist/tokens/border/variables.js +18 -10
  59. package/dist/tokens/breakpoint/variables.js +8 -5
  60. package/dist/tokens/color/variables.js +452 -227
  61. package/dist/tokens/index.d.ts +7 -7
  62. package/dist/tokens/index.js +308 -14
  63. package/dist/tokens/motion/variables.js +22 -12
  64. package/dist/tokens/shadow/variables.js +8 -5
  65. package/dist/tokens/spacing/variables.js +46 -24
  66. package/dist/tokens/typography/variables.js +48 -25
  67. package/dist/utils/action.js +10 -7
  68. package/dist/utils/composeEventHandlers.js +7 -5
  69. package/dist/utils/composeRefs.js +13 -9
  70. package/dist/utils/layout/align.js +5 -4
  71. package/dist/utils/layout/flex.js +25 -18
  72. package/dist/utils/layout/gap.js +7 -6
  73. package/dist/utils/layout/grid.js +31 -24
  74. package/dist/utils/layout/height.js +12 -11
  75. package/dist/utils/layout/index.js +76 -59
  76. package/dist/utils/layout/inset.js +10 -9
  77. package/dist/utils/layout/justify.js +6 -5
  78. package/dist/utils/layout/margin.js +10 -9
  79. package/dist/utils/layout/padding.js +10 -9
  80. package/dist/utils/layout/position.js +6 -5
  81. package/dist/utils/layout/util.js +7 -6
  82. package/dist/utils/layout/width.js +8 -7
  83. package/package.json +21 -14
  84. package/dist/assets/badge.css +0 -1
  85. package/dist/assets/button.css +0 -1
  86. package/dist/assets/field-error-text.css +0 -1
  87. package/dist/assets/flex.css +0 -1
  88. package/dist/assets/grid.css +0 -1
  89. package/dist/assets/heading.css +0 -1
  90. package/dist/assets/helper-text.css +0 -1
  91. package/dist/assets/icon.css +0 -1
  92. package/dist/assets/input.css +0 -1
  93. package/dist/assets/label.css +0 -1
  94. package/dist/assets/link.css +0 -1
  95. package/dist/assets/main.css +0 -1
  96. package/dist/assets/navigation-menu.css +0 -1
  97. package/dist/assets/radio-group.css +0 -1
  98. package/dist/assets/spinner.css +0 -1
  99. package/dist/assets/text-field.css +0 -1
  100. package/dist/assets/text-spacing.css +0 -1
  101. package/dist/assets/text.css +0 -1
  102. package/dist/assets/visually-hidden.css +0 -1
  103. package/dist/badge-Cnug5TzH.js +0 -1855
  104. package/dist/clsx-DB4S2d7J.js +0 -22
  105. package/dist/index-DM5e-Whg.js +0 -43
  106. package/dist/index-DpfSJps6.js +0 -75
  107. package/dist/index-FPIZOCcD.js +0 -305
  108. package/dist/navigation-menu-DKuyW8zE.js +0 -1036
  109. package/dist/radio-group-B--zT3OL.js +0 -440
  110. package/dist/variables-BKiPmtHY.js +0 -458
  111. package/dist/variables-BkY5b0io.js +0 -14
  112. package/dist/variables-Bq0YUbLS.js +0 -14
  113. package/dist/variables-CDK515QX.js +0 -52
  114. package/dist/variables-CMRTN8qo.js +0 -28
  115. package/dist/variables-Dmoh9YtD.js +0 -54
  116. package/dist/variables-IczXZ5CN.js +0 -24
@@ -1,48 +1,53 @@
1
- import { A as e, B as t, C as p, M as x, N as f, T as a } from "../badge-Cnug5TzH.js";
2
- import { R as i } from "../radio-group-B--zT3OL.js";
3
- import { Box as d } from "./box/box.js";
4
- import { Flex as l } from "./flex/flex.js";
5
- import { Grid as T } from "./grid/grid.js";
6
- import { N as g } from "../navigation-menu-DKuyW8zE.js";
7
- import { Link as H } from "./link/link.js";
8
- import { Button as F } from "./button/button.js";
9
- import { FieldErrorText as I } from "./field-error-text/field-error-text.js";
10
- import { HelperText as A } from "./helper-text/helper-text.js";
11
- import { default as L } from "../assets/4bbd022cee9b0f06.svg";
12
- import { Icon as S } from "./icon/icon.js";
13
- import { Input as k, InputGroup as v } from "./input/input.js";
14
- import { Label as E } from "./label/label.js";
15
- import { Spinner as h } from "./spinner/spinner.js";
16
- import { Text as q } from "./text/text.js";
17
- import { TextField as z } from "./text-field/text-field.js";
18
- import { Heading as J } from "./heading/heading.js";
19
- import { VisuallyHidden as O } from "./visually-hidden/visually-hidden.js";
20
- import { TextSpacing as Q } from "./text-spacing/text-spacing.js";
1
+ import { Modal } from "./modal/modal.js";
2
+ import { Notification } from "./notification/notification.js";
3
+ import { RadioGroup } from "./radio-group/radio-group.js";
4
+ import { Box } from "./box/box.js";
5
+ import { Flex } from "./flex/flex.js";
6
+ import { Card } from "./card/card.js";
7
+ import { Grid } from "./grid/grid.js";
8
+ import { NavigationMenu } from "./navigation-menu/navigation-menu.js";
9
+ import { Toggle } from "./toggle/toggle.js";
10
+ import { Accordion } from "./accordion/accordion.js";
11
+ import { Link } from "./link/link.js";
12
+ import { Badge } from "./badge/badge.js";
13
+ import { Button } from "./button/button.js";
14
+ import { FieldErrorText } from "./field-error-text/field-error-text.js";
15
+ import { HelperText } from "./helper-text/helper-text.js";
16
+ import { default as default2 } from "../assets/4bbd022cee9b0f06.svg";
17
+ import { Icon } from "./icon/icon.js";
18
+ import { Input, InputGroup } from "./input/input.js";
19
+ import { Label } from "./label/label.js";
20
+ import { Spinner } from "./spinner/spinner.js";
21
+ import { Text } from "./text/text.js";
22
+ import { TextField } from "./text-field/text-field.js";
23
+ import { Heading } from "./heading/heading.js";
24
+ import { VisuallyHidden } from "./visually-hidden/visually-hidden.js";
25
+ import { TextSpacing } from "./text-spacing/text-spacing.js";
21
26
  export {
22
- e as Accordion,
23
- t as Badge,
24
- d as Box,
25
- F as Button,
26
- p as Card,
27
- I as FieldErrorText,
28
- l as Flex,
29
- T as Grid,
30
- J as Heading,
31
- A as HelperText,
32
- S as Icon,
33
- k as Input,
34
- v as InputGroup,
35
- E as Label,
36
- H as Link,
37
- x as Modal,
38
- g as NavigationMenu,
39
- f as Notification,
40
- i as RadioGroup,
41
- h as Spinner,
42
- q as Text,
43
- z as TextField,
44
- Q as TextSpacing,
45
- a as Toggle,
46
- O as VisuallyHidden,
47
- L as iconsHref
27
+ Accordion,
28
+ Badge,
29
+ Box,
30
+ Button,
31
+ Card,
32
+ FieldErrorText,
33
+ Flex,
34
+ Grid,
35
+ Heading,
36
+ HelperText,
37
+ Icon,
38
+ Input,
39
+ InputGroup,
40
+ Label,
41
+ Link,
42
+ Modal,
43
+ NavigationMenu,
44
+ Notification,
45
+ RadioGroup,
46
+ Spinner,
47
+ Text,
48
+ TextField,
49
+ TextSpacing,
50
+ Toggle,
51
+ VisuallyHidden,
52
+ default2 as iconsHref
48
53
  };
@@ -1,5 +1,5 @@
1
- import { Input as r, InputGroup as t } from "./input.js";
1
+ import { Input, InputGroup } from "./input.js";
2
2
  export {
3
- r as Input,
4
- t as InputGroup
3
+ Input,
4
+ InputGroup
5
5
  };
@@ -1,11 +1,12 @@
1
- import '../../assets/input.css';
2
- import { jsxs as y, jsx as r } from "react/jsx-runtime";
3
- import { c } from "../../clsx-DB4S2d7J.js";
4
- import a from "react";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import React__default from "react";
5
4
  import "../../assets/4bbd022cee9b0f06.svg";
6
- import { Icon as x } from "../icon/icon.js";
7
- import { Spinner as A } from "../spinner/spinner.js";
8
- const C = "_fadeInAnimation_1o9uu_1", G = "_scaleInAnimation_1o9uu_1", s = {
5
+ import { Icon } from "../icon/icon.js";
6
+ import { Spinner } from "../spinner/spinner.js";
7
+ const fadeInAnimation = "_fadeInAnimation_1o9uu_1";
8
+ const scaleInAnimation = "_scaleInAnimation_1o9uu_1";
9
+ const styles = {
9
10
  "teddy-input": "_teddy-input_1o9uu_17",
10
11
  "teddy-input__frame": "_teddy-input__frame_1o9uu_24",
11
12
  "teddy-input__input": "_teddy-input__input_1o9uu_31",
@@ -13,91 +14,103 @@ const C = "_fadeInAnimation_1o9uu_1", G = "_scaleInAnimation_1o9uu_1", s = {
13
14
  "teddy-input__input--invalid": "_teddy-input__input--invalid_1o9uu_66",
14
15
  "teddy-input__indicator": "_teddy-input__indicator_1o9uu_72",
15
16
  "teddy-input__input--error": "_teddy-input__input--error_1o9uu_75",
16
- fadeInAnimation: C,
17
- scaleInAnimation: G
18
- }, _ = "teddy-input";
19
- function P(n) {
20
- const i = n == null ? void 0 : n.target;
21
- if (i.closest("input, button, a"))
17
+ fadeInAnimation,
18
+ scaleInAnimation
19
+ };
20
+ const rootClassName = "teddy-input";
21
+ function setCursorOnInput(e) {
22
+ const target = e == null ? void 0 : e.target;
23
+ if (target.closest("input, button, a"))
22
24
  return;
23
- const t = [...n.currentTarget.getElementsByTagName("input")].find((d) => d);
24
- if (!t)
25
+ const input = [...e.currentTarget.getElementsByTagName("input")].find((input2) => input2);
26
+ if (!input)
25
27
  return;
26
- const u = (t.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_PRECEDING) !== 0 ? 0 : t.value.length;
28
+ const position = input.compareDocumentPosition(target);
29
+ const targetIsBeforeInput = (position & Node.DOCUMENT_POSITION_PRECEDING) !== 0;
30
+ const cursorPosition = targetIsBeforeInput ? 0 : input.value.length;
27
31
  requestAnimationFrame(() => {
28
32
  try {
29
- t.setSelectionRange(u, u);
33
+ input.setSelectionRange(cursorPosition, cursorPosition);
30
34
  } finally {
31
- t.focus();
35
+ input.focus();
32
36
  }
33
37
  });
34
38
  }
35
- const v = a.createContext(void 0), p = a.forwardRef(
36
- ({ className: n, children: i, ...t }, e) => {
37
- const o = c([s[`${_}`]], n);
38
- return /* @__PURE__ */ y("div", { ...t, onPointerDown: P, ref: e, className: o, children: [
39
- /* @__PURE__ */ r(v.Provider, { value: !0, children: i }),
40
- /* @__PURE__ */ r("div", { className: s[`${_}__frame`] })
39
+ const InputGroupContext = React__default.createContext(void 0);
40
+ const InputGroupRoot = React__default.forwardRef(
41
+ ({ className, children, ...props }, forwardRef) => {
42
+ const classes = clsx([styles[`${rootClassName}`]], className);
43
+ return /* @__PURE__ */ jsxs("div", { ...props, onPointerDown: setCursorOnInput, ref: forwardRef, className: classes, children: [
44
+ /* @__PURE__ */ jsx(InputGroupContext.Provider, { value: true, children }),
45
+ /* @__PURE__ */ jsx("div", { className: styles[`${rootClassName}__frame`] })
41
46
  ] });
42
47
  }
43
48
  );
44
- p.displayName = "InputGroup";
45
- const N = a.forwardRef(
46
- ({ className: n, onValueChange: i, isLoading: t, validationState: e, ...o }, u) => {
47
- const d = a.useContext(v), m = c(
49
+ InputGroupRoot.displayName = "InputGroup";
50
+ const Input = React__default.forwardRef(
51
+ ({ className, onValueChange, isLoading, validationState, ...props }, forwardRef) => {
52
+ const groupContext = React__default.useContext(InputGroupContext);
53
+ const classes = clsx(
48
54
  [
49
- s[`${_}__input`],
55
+ styles[`${rootClassName}__input`],
50
56
  {
51
- [s[`${_}__input--valid`]]: e === "valid",
52
- [s[`${_}__input--error`]]: e === "invalid"
57
+ [styles[`${rootClassName}__input--valid`]]: validationState === "valid",
58
+ [styles[`${rootClassName}__input--error`]]: validationState === "invalid"
53
59
  }
54
60
  ],
55
- n
56
- ), g = d === !0;
57
- function f(I) {
58
- i == null || i(I.target.value), o.onChange && o.onChange(I);
61
+ className
62
+ );
63
+ const hasInputGroup = groupContext === true;
64
+ function onChange(e) {
65
+ onValueChange == null ? void 0 : onValueChange(e.target.value);
66
+ if (props.onChange)
67
+ props.onChange(e);
68
+ }
69
+ if (hasInputGroup) {
70
+ return /* @__PURE__ */ jsx(
71
+ "input",
72
+ {
73
+ "aria-invalid": validationState === "invalid",
74
+ ...props,
75
+ onChange,
76
+ className: classes,
77
+ ref: forwardRef
78
+ }
79
+ );
59
80
  }
60
- return g ? /* @__PURE__ */ r(
61
- "input",
62
- {
63
- "aria-invalid": e === "invalid",
64
- ...o,
65
- onChange: f,
66
- className: m,
67
- ref: u
68
- }
69
- ) : /* @__PURE__ */ y(p, { children: [
70
- /* @__PURE__ */ r(
81
+ return /* @__PURE__ */ jsxs(InputGroupRoot, { children: [
82
+ /* @__PURE__ */ jsx(
71
83
  "input",
72
84
  {
73
- "aria-invalid": e === "invalid",
74
- ...o,
75
- onChange: f,
76
- className: m,
77
- ref: u
85
+ "aria-invalid": validationState === "invalid",
86
+ ...props,
87
+ onChange,
88
+ className: classes,
89
+ ref: forwardRef
78
90
  }
79
91
  ),
80
- /* @__PURE__ */ r(l, { isValid: e === "valid", isLoading: t })
92
+ /* @__PURE__ */ jsx(InputIndicator, { isValid: validationState === "valid", isLoading })
81
93
  ] });
82
94
  }
83
95
  );
84
- N.displayName = "Input";
85
- const l = a.forwardRef(
86
- ({ className: n, isLoading: i, isValid: t, ...e }, o) => {
87
- if (!t && !i)
96
+ Input.displayName = "Input";
97
+ const InputIndicator = React__default.forwardRef(
98
+ ({ className, isLoading, isValid, ...props }, forwardRef) => {
99
+ if (!isValid && !isLoading)
88
100
  return null;
89
- if (!t && i)
90
- return /* @__PURE__ */ r(A, { className: n, size: "xs", ...e, ref: o });
91
- const u = c([s[`${_}__indicator`]], n);
92
- return /* @__PURE__ */ r(x, { ...e, size: "md", name: "check-circle-filled", className: u, ref: o });
101
+ if (!isValid && isLoading) {
102
+ return /* @__PURE__ */ jsx(Spinner, { className, size: "xs", ...props, ref: forwardRef });
103
+ }
104
+ const classes = clsx([styles[`${rootClassName}__indicator`]], className);
105
+ return /* @__PURE__ */ jsx(Icon, { ...props, size: "md", name: "check-circle-filled", className: classes, ref: forwardRef });
93
106
  }
94
107
  );
95
- l.displayName = "InputIndicator";
96
- const T = Object.assign(p, {
97
- Input: N,
98
- Indicator: l
108
+ InputIndicator.displayName = "InputIndicator";
109
+ const InputGroup = Object.assign(InputGroupRoot, {
110
+ Input,
111
+ Indicator: InputIndicator
99
112
  });
100
113
  export {
101
- N as Input,
102
- T as InputGroup
114
+ Input,
115
+ InputGroup
103
116
  };
@@ -1,4 +1,4 @@
1
- import { Label as r } from "./label.js";
1
+ import { Label } from "./label.js";
2
2
  export {
3
- r as Label
3
+ Label
4
4
  };
@@ -1,33 +1,27 @@
1
- import '../../assets/label.css';
2
- import { jsx as f } from "react/jsx-runtime";
3
- import { _ as b } from "../../index-DpfSJps6.js";
4
- import n, { forwardRef as i, createElement as m } from "react";
5
- import { $ as _ } from "../../index-DM5e-Whg.js";
6
- import { c as $ } from "../../clsx-DB4S2d7J.js";
7
- const u = /* @__PURE__ */ i((a, d) => /* @__PURE__ */ m(_.label, b({}, a, {
8
- ref: d,
9
- onMouseDown: (e) => {
10
- var l;
11
- (l = a.onMouseDown) === null || l === void 0 || l.call(a, e), !e.defaultPrevented && e.detail > 1 && e.preventDefault();
12
- }
13
- }))), p = u, o = {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import clsx from "clsx";
4
+ import React__default from "react";
5
+ const styles = {
14
6
  "teddy-label": "_teddy-label_1hc8e_1",
15
7
  "teddy-label--disabled": "_teddy-label--disabled_1hc8e_8",
16
8
  "teddy-label--required": "_teddy-label--required_1hc8e_12"
17
- }, r = "teddy-label", y = n.forwardRef(
18
- ({ className: a, disabled: d, isRequired: e, children: l, ...t }, s) => {
19
- const c = $(
20
- [o[r]],
9
+ };
10
+ const rootClassName = "teddy-label";
11
+ const Label = React__default.forwardRef(
12
+ ({ className, disabled, isRequired, children, ...props }, ref) => {
13
+ const classes = clsx(
14
+ [styles[rootClassName]],
21
15
  {
22
- [o[`${r}--disabled`]]: d,
23
- [o[`${r}--required`]]: e
16
+ [styles[`${rootClassName}--disabled`]]: disabled,
17
+ [styles[`${rootClassName}--required`]]: isRequired
24
18
  },
25
- a
19
+ className
26
20
  );
27
- return /* @__PURE__ */ f(p, { ...t, ref: s, className: c, children: l });
21
+ return /* @__PURE__ */ jsx(LabelPrimitive.Root, { ...props, ref, className: classes, children });
28
22
  }
29
23
  );
30
- y.displayName = "Label";
24
+ Label.displayName = "Label";
31
25
  export {
32
- y as Label
26
+ Label
33
27
  };
@@ -1,4 +1,4 @@
1
- import { Link as e } from "./link.js";
1
+ import { Link } from "./link.js";
2
2
  export {
3
- e as Link
3
+ Link
4
4
  };
@@ -1,9 +1,8 @@
1
- import '../../assets/link.css';
2
- import { jsx as l } from "react/jsx-runtime";
3
- import { c } from "../../clsx-DB4S2d7J.js";
4
- import g from "react";
5
- import { $ as v } from "../../index-DpfSJps6.js";
6
- const e = {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import React__default from "react";
4
+ import { Slot } from "@radix-ui/react-slot";
5
+ const styles = {
7
6
  "teddy-link": "_teddy-link_1jza5_1",
8
7
  "teddy-link--text": "_teddy-link--text_1jza5_15",
9
8
  "teddy-link--standalone": "_teddy-link--standalone_1jza5_15",
@@ -14,23 +13,25 @@ const e = {
14
13
  "teddy-link--navigation-negative": "_teddy-link--navigation-negative_1jza5_28",
15
14
  "teddy-link--ensure-target-area": "_teddy-link--ensure-target-area_1jza5_56",
16
15
  "teddy-link--silent": "_teddy-link--silent_1jza5_62"
17
- }, t = "teddy-link", f = g.forwardRef(
18
- ({ className: s, variant: a, silent: d, disableVisited: _, ensureTargetArea: r, asChild: o, children: n, ...i }, k) => {
19
- const y = c(
20
- [e[`${t}`]],
21
- e[`${t}--${a}`],
16
+ };
17
+ const rootClassName = "teddy-link";
18
+ const Link = React__default.forwardRef(
19
+ ({ className, variant, silent, disableVisited, ensureTargetArea, asChild, children, ...props }, forwardRef) => {
20
+ const classes = clsx(
21
+ [styles[`${rootClassName}`]],
22
+ styles[`${rootClassName}--${variant}`],
22
23
  {
23
- [e[`${t}--silent`]]: d,
24
- [e[`${t}--negative`]]: a.endsWith("negative"),
25
- [e[`${t}--disable-visited`]]: _ ?? d,
26
- [e[`${t}--ensure-target-area`]]: r
24
+ [styles[`${rootClassName}--silent`]]: silent,
25
+ [styles[`${rootClassName}--negative`]]: variant.endsWith("negative"),
26
+ [styles[`${rootClassName}--disable-visited`]]: disableVisited ?? silent,
27
+ [styles[`${rootClassName}--ensure-target-area`]]: ensureTargetArea
27
28
  },
28
- s
29
+ className
29
30
  );
30
- return /* @__PURE__ */ l(v, { ...i, ref: k, className: y, children: o ? n : /* @__PURE__ */ l("a", { href: i.href, children: n }) });
31
+ return /* @__PURE__ */ jsx(Slot, { ...props, ref: forwardRef, className: classes, children: asChild ? children : /* @__PURE__ */ jsx("a", { href: props.href, children }) });
31
32
  }
32
33
  );
33
- f.displayName = "Link";
34
+ Link.displayName = "Link";
34
35
  export {
35
- f as Link
36
+ Link
36
37
  };
@@ -1,4 +1,4 @@
1
- import { M as r } from "../../badge-Cnug5TzH.js";
1
+ import { Modal } from "./modal.js";
2
2
  export {
3
- r as Modal
3
+ Modal
4
4
  };
@@ -1,28 +1,187 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import { M as z } from "../../badge-Cnug5TzH.js";
4
- import "../../radio-group-B--zT3OL.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default, { useEffect } from "react";
3
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
4
+ import "../notification/notification.js";
5
+ import "../radio-group/radio-group.js";
5
6
  import "../box/box.js";
6
- import "../flex/flex.js";
7
+ import { Flex } from "../flex/flex.js";
8
+ import "../card/card.js";
7
9
  import "../grid/grid.js";
8
- import "../../navigation-menu-DKuyW8zE.js";
10
+ import "../navigation-menu/navigation-menu.js";
11
+ import "../toggle/toggle.js";
12
+ import "../accordion/accordion.js";
9
13
  import "../link/link.js";
10
- import "../button/button.js";
14
+ import "../badge/badge.js";
15
+ import { Button } from "../button/button.js";
11
16
  import "../field-error-text/field-error-text.js";
12
17
  import "../helper-text/helper-text.js";
13
18
  import "../../assets/4bbd022cee9b0f06.svg";
14
- import "../icon/icon.js";
19
+ import { Icon } from "../icon/icon.js";
15
20
  import "../input/input.js";
16
21
  import "../label/label.js";
17
22
  import "../spinner/spinner.js";
18
- import "../text/text.js";
23
+ import { Text } from "../text/text.js";
19
24
  import "../text-field/text-field.js";
20
- import "../heading/heading.js";
25
+ import { Heading } from "../heading/heading.js";
21
26
  import "../visually-hidden/visually-hidden.js";
22
27
  import "../text-spacing/text-spacing.js";
23
- import "../../clsx-DB4S2d7J.js";
24
- import "../../index-DpfSJps6.js";
25
- import "../../utils/composeRefs.js";
28
+ import clsx from "clsx";
29
+ import { Slot } from "@radix-ui/react-slot";
30
+ import { composeRefs } from "../../utils/composeRefs.js";
31
+ const styles = {
32
+ "teddy-modal__overlay": "_teddy-modal__overlay_vfo5b_17",
33
+ "teddy-modal__content": "_teddy-modal__content_vfo5b_29",
34
+ "teddy-modal__scroll": "_teddy-modal__scroll_vfo5b_47",
35
+ "teddy-modal__image": "_teddy-modal__image_vfo5b_51",
36
+ "teddy-modal__close--floating": "_teddy-modal__close--floating_vfo5b_61",
37
+ "teddy-modal__group": "_teddy-modal__group_vfo5b_66",
38
+ "teddy-modal__group--title": "_teddy-modal__group--title_vfo5b_70",
39
+ "teddy-modal__group--scroll": "_teddy-modal__group--scroll_vfo5b_76",
40
+ "teddy-modal__group--action": "_teddy-modal__group--action_vfo5b_85",
41
+ "modal-overlay-no-op": "_modal-overlay-no-op_vfo5b_1",
42
+ "teddy-fade-in": "_teddy-fade-in_vfo5b_1",
43
+ "teddy-fade-out": "_teddy-fade-out_vfo5b_1",
44
+ "modal-content-show": "_modal-content-show_vfo5b_1",
45
+ "modal-content-hide": "_modal-content-hide_vfo5b_1"
46
+ };
47
+ const rootClassName = "teddy-modal";
48
+ const RootContext = React__default.createContext({
49
+ imageRef: null,
50
+ actionGroupRef: null,
51
+ scrollRef: null
52
+ });
53
+ const Root = (props) => {
54
+ const imageRef = React__default.useRef(null);
55
+ const actionGroupRef = React__default.useRef(null);
56
+ const scrollRef = React__default.useRef(null);
57
+ return /* @__PURE__ */ jsx(RootContext.Provider, { value: { imageRef, actionGroupRef, scrollRef }, children: /* @__PURE__ */ jsx(DialogPrimitive.Root, { ...props, modal: true }) });
58
+ };
59
+ Root.displayName = "Dialog.Root";
60
+ const Trigger = React__default.forwardRef(
61
+ ({ children, ...props }, forwardedRef) => /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { ...props, ref: forwardedRef, asChild: true, children })
62
+ );
63
+ Trigger.displayName = "Dialog.Trigger";
64
+ const OverlayContext = React__default.createContext(false);
65
+ const Overlay = React__default.forwardRef(
66
+ ({ className, forceMount, container, ...rest }, forwardedRef) => {
67
+ const classes = clsx([styles[`${rootClassName}__overlay`]], className);
68
+ return /* @__PURE__ */ jsx(OverlayContext.Provider, { value: true, children: /* @__PURE__ */ jsx(DialogPrimitive.Portal, { container, forceMount, children: /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: classes, ref: forwardedRef, ...rest }) }) });
69
+ }
70
+ );
71
+ Overlay.displayName = "Dialog.Content";
72
+ const InnerContent = React__default.forwardRef(
73
+ function InnerContent2({ asChild, children, className, ...props }, forwardedRef) {
74
+ const classes = clsx([styles[`${rootClassName}__scroll`]], className);
75
+ const context = React__default.useContext(RootContext);
76
+ return /* @__PURE__ */ jsx(
77
+ DialogPrimitive.Content,
78
+ {
79
+ ...props,
80
+ ref: forwardedRef,
81
+ className: clsx([styles[`${rootClassName}__content`]]),
82
+ asChild: true,
83
+ children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
84
+ Flex,
85
+ {
86
+ ...asChild ? { as: void 0, asChild } : {},
87
+ direction: "column",
88
+ align: "start",
89
+ maxWidth: { md: "600px" },
90
+ className: classes,
91
+ ref: context.scrollRef,
92
+ children
93
+ }
94
+ ) })
95
+ }
96
+ );
97
+ }
98
+ );
99
+ const Content = React__default.forwardRef(
100
+ ({ forceMount, ...contentProps }, forwardedRef) => {
101
+ const hasOverlay = React__default.useContext(OverlayContext);
102
+ if (!hasOverlay)
103
+ return /* @__PURE__ */ jsx(Overlay, { forceMount, children: /* @__PURE__ */ jsx(InnerContent, { ref: forwardedRef, ...contentProps }) });
104
+ return /* @__PURE__ */ jsx(InnerContent, { ref: forwardedRef, ...contentProps });
105
+ }
106
+ );
107
+ Content.displayName = "Dialog.Content";
108
+ const GroupContext = React__default.createContext(false);
109
+ const Group = React__default.forwardRef(
110
+ ({ className, variant, ...props }, forwardedRef) => {
111
+ const strollerRef = React__default.useContext(RootContext).scrollRef;
112
+ const [isOverflowing, setIsOverflowing] = React__default.useState(false);
113
+ useEffect(() => {
114
+ if (strollerRef == null ? void 0 : strollerRef.current) {
115
+ const hasOverflow = strollerRef.current.scrollHeight > strollerRef.current.clientHeight;
116
+ setIsOverflowing(hasOverflow);
117
+ }
118
+ }, [strollerRef]);
119
+ const classes = clsx(
120
+ [styles[`${rootClassName}__group`]],
121
+ {
122
+ [styles[`${rootClassName}__group--action`]]: variant === "action",
123
+ [styles[`${rootClassName}__group--title`]]: variant === "title",
124
+ [styles[`${rootClassName}__group--scroll`]]: isOverflowing
125
+ },
126
+ className
127
+ );
128
+ return /* @__PURE__ */ jsx(GroupContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
129
+ Flex,
130
+ {
131
+ ...variant === "action" ? {
132
+ gap: "200",
133
+ justify: { md: "end" },
134
+ align: { sm: "stretch", md: "end" },
135
+ direction: { sm: "column-reverse", md: "row" }
136
+ } : { direction: "column" },
137
+ ref: forwardedRef,
138
+ ...props,
139
+ className: classes
140
+ }
141
+ ) });
142
+ }
143
+ );
144
+ Group.displayName = "Dialog.Group";
145
+ const TitleInner = React__default.forwardRef(
146
+ function TitleInner2(props, forwardedRef) {
147
+ return /* @__PURE__ */ jsx(DialogPrimitive.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { variant: "title-200", as: "h2", ...props, asChild: false, ref: forwardedRef }) });
148
+ }
149
+ );
150
+ const Title = React__default.forwardRef((props, forwardedRef) => {
151
+ const isInsideGroup = React__default.useContext(GroupContext);
152
+ if (!isInsideGroup) {
153
+ return /* @__PURE__ */ jsx(Group, { variant: "title", children: /* @__PURE__ */ jsx(TitleInner, { ...props, ref: forwardedRef }) });
154
+ }
155
+ return /* @__PURE__ */ jsx(TitleInner, { ...props, ref: forwardedRef });
156
+ });
157
+ Title.displayName = "Dialog.Title";
158
+ const Description = React__default.forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { as: "p", variant: "paragraph-100", ...props, asChild: false, ref: forwardedRef }) }));
159
+ Description.displayName = "Dialog.Description";
160
+ const Image = React__default.forwardRef(({ asChild, ...props }, forwardedRef) => {
161
+ const classes = clsx([styles[`${rootClassName}__image`]], props.className);
162
+ const context = React__default.useContext(RootContext);
163
+ const Comp = asChild ? Slot : "img";
164
+ return /* @__PURE__ */ jsx(Comp, { ...props, className: classes, ref: composeRefs(context.imageRef, forwardedRef) });
165
+ });
166
+ Image.displayName = "Dialog.Image";
167
+ const Close = React__default.forwardRef(
168
+ ({ className, ...props }, forwardedRef) => {
169
+ const classes = clsx([styles[`${rootClassName}__close`]], {
170
+ [styles[`${rootClassName}__close--floating`]]: props.slot === "floating",
171
+ className
172
+ });
173
+ const imageRef = React__default.useContext(RootContext).imageRef;
174
+ const [hasImage, setHasImage] = React__default.useState(false);
175
+ useEffect(() => {
176
+ if (imageRef == null ? void 0 : imageRef.current) {
177
+ setHasImage(true);
178
+ }
179
+ }, [imageRef]);
180
+ return /* @__PURE__ */ jsx(DialogPrimitive.Close, { ...props, className: classes, ref: forwardedRef, asChild: true, children: props.children || /* @__PURE__ */ jsx(Button, { variant: hasImage ? "primary-negative" : "tertiary-purple", iconOnly: true, "aria-label": props["aria-label"], children: /* @__PURE__ */ jsx(Icon, { name: "close" }) }) });
181
+ }
182
+ );
183
+ Close.displayName = "Dialog.Close";
184
+ const Modal = Object.assign(Root, { Trigger, Content, Title, Overlay, Description, Close, Image, Group });
26
185
  export {
27
- z as Modal
186
+ Modal
28
187
  };
@@ -1,4 +1,4 @@
1
- import { N as e } from "../../navigation-menu-DKuyW8zE.js";
1
+ import { NavigationMenu } from "./navigation-menu.js";
2
2
  export {
3
- e as NavigationMenu
3
+ NavigationMenu
4
4
  };