@telia/teddy 0.0.14 → 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 +32 -10
  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 +39 -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-C6I_qxYL.js +0 -1853
  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,10 +1,93 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import "../../clsx-DB4S2d7J.js";
4
- import { R as d } from "../../radio-group-B--zT3OL.js";
5
- import "../label/label.js";
6
- import "../../utils/composeRefs.js";
7
- import "../../index-DpfSJps6.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default, { useRef } from "react";
3
+ import clsx from "clsx";
4
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
5
+ import { Label as Label$1 } from "../label/label.js";
6
+ import { useComposedRefs } from "../../utils/composeRefs.js";
7
+ import { Slot } from "@radix-ui/react-slot";
8
+ const styles = {
9
+ "teddy-radio-group": "_teddy-radio-group_1flae_1",
10
+ "teddy-radio-group__group-label": "_teddy-radio-group__group-label_1flae_10",
11
+ "teddy-radio-group__label": "_teddy-radio-group__label_1flae_13",
12
+ "teddy-radio-group__group-label--required": "_teddy-radio-group__group-label--required_1flae_23",
13
+ "teddy-radio-group__item": "_teddy-radio-group__item_1flae_26",
14
+ "teddy-radio-group__trigger": "_teddy-radio-group__trigger_1flae_54",
15
+ "teddy-radio-group__indicator": "_teddy-radio-group__indicator_1flae_111"
16
+ };
17
+ const rootClassName = "teddy-radio-group";
18
+ const RootContext = React__default.createContext(void 0);
19
+ const Root = React__default.forwardRef(
20
+ ({ className, ...props }, forwardRef) => {
21
+ const classes = clsx([styles[`${rootClassName}`]], className);
22
+ const [groupLabelId, setGroupLabelId] = React__default.useState();
23
+ return /* @__PURE__ */ jsx(RootContext.Provider, { value: { setGroupLabelId, required: props.required }, children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { "aria-labelledby": groupLabelId, ...props, ref: forwardRef, className: classes }) });
24
+ }
25
+ );
26
+ Root.displayName = "RadioGroup";
27
+ const ItemContext = React__default.createContext(
28
+ void 0
29
+ );
30
+ const Item = React__default.forwardRef(({ className, ...props }, forwardRef) => {
31
+ const classes = clsx([styles[`${rootClassName}__item`]], className);
32
+ const triggerRef = useRef(null);
33
+ const triggerId = `${React__default.useId()}-trigger`;
34
+ return /* @__PURE__ */ jsx(ItemContext.Provider, { value: { triggerRef, id: triggerId }, children: /* @__PURE__ */ jsx("div", { ...props, ref: forwardRef, className: classes }) });
35
+ });
36
+ Item.displayName = "RadioGroup.Item";
37
+ const GroupLabel = React__default.forwardRef(
38
+ ({ className, asChild, as: Tag = "h3", children, ...props }, forwardRef) => {
39
+ const context = React__default.useContext(RootContext);
40
+ const classes = clsx(
41
+ [styles[`${rootClassName}__group-label`]],
42
+ {
43
+ [styles[`${rootClassName}__group-label--required`]]: context == null ? void 0 : context.required
44
+ },
45
+ className
46
+ );
47
+ const fallbackId = React__default.useId();
48
+ const id = props.id || fallbackId;
49
+ React__default.useEffect(() => {
50
+ if (context) {
51
+ context.setGroupLabelId(id);
52
+ }
53
+ }, [id, context]);
54
+ return /* @__PURE__ */ jsx(Slot, { ...props, id, ref: forwardRef, className: classes, children: asChild ? children : Tag ? /* @__PURE__ */ jsx(Tag, { children }) : null });
55
+ }
56
+ );
57
+ GroupLabel.displayName = "RadioGroup.GroupLabel";
58
+ const Trigger = React__default.forwardRef(
59
+ ({ className, children, ...props }, forwardRef) => {
60
+ const classes = clsx([styles[`${rootClassName}__trigger`]], className);
61
+ const context = React__default.useContext(ItemContext);
62
+ const ref = useComposedRefs(forwardRef, context == null ? void 0 : context.triggerRef);
63
+ const id = props.id || (context == null ? void 0 : context.id);
64
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Item, { ...props, id, ref, className: classes, children: children || /* @__PURE__ */ jsx(Indicator, {}) });
65
+ }
66
+ );
67
+ Trigger.displayName = "RadioGroup.Trigger";
68
+ const Indicator = React__default.forwardRef(
69
+ ({ className, ...props }, forwardRef) => {
70
+ const classes = clsx([styles[`${rootClassName}__indicator`]], className);
71
+ return /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { ...props, ref: forwardRef, className: classes });
72
+ }
73
+ );
74
+ Indicator.displayName = "RadioGroup.Indicator";
75
+ const Label = React__default.forwardRef(
76
+ ({ className, ...props }, forwardRef) => {
77
+ const classes = clsx([styles[`${rootClassName}__label`]], className);
78
+ const context = React__default.useContext(ItemContext);
79
+ const htmlFor = props.htmlFor || (context == null ? void 0 : context.id);
80
+ return /* @__PURE__ */ jsx(Label$1, { ...props, htmlFor, ref: forwardRef, className: classes });
81
+ }
82
+ );
83
+ Label.displayName = "RadioGroup.Label";
84
+ const RadioGroup = Object.assign(Root, {
85
+ Item,
86
+ Trigger,
87
+ Indicator,
88
+ Label,
89
+ GroupLabel
90
+ });
8
91
  export {
9
- d as RadioGroup
92
+ RadioGroup
10
93
  };
@@ -1,4 +1,4 @@
1
- import { Spinner as n } from "./spinner.js";
1
+ import { Spinner } from "./spinner.js";
2
2
  export {
3
- n as Spinner
3
+ Spinner
4
4
  };
@@ -1,50 +1,57 @@
1
- import '../../assets/spinner.css';
2
- import { jsx as n } from "react/jsx-runtime";
3
- import { c as _ } from "../../clsx-DB4S2d7J.js";
4
- import y from "react";
5
- const a = "_dash_ywden_1", l = "_rotate_ywden_1", e = {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import React__default from "react";
4
+ const dash = "_dash_ywden_1";
5
+ const rotate = "_rotate_ywden_1";
6
+ const styles = {
6
7
  "teddy-spinner--xxs": "_teddy-spinner--xxs_ywden_1",
7
8
  "teddy-spinner--xs": "_teddy-spinner--xs_ywden_5",
8
9
  "teddy-spinner--sm": "_teddy-spinner--sm_ywden_9",
9
10
  "teddy-spinner--md": "_teddy-spinner--md_ywden_13",
10
11
  "teddy-spinner--lg": "_teddy-spinner--lg_ywden_18",
11
12
  "teddy-spinner__circle": "_teddy-spinner__circle_ywden_23",
12
- dash: a,
13
- rotate: l,
13
+ dash,
14
+ rotate,
14
15
  "teddy-spinner__circle--disabled": "_teddy-spinner__circle--disabled_ywden_33",
15
16
  "teddy-spinner__circle--negative": "_teddy-spinner__circle--negative_ywden_36",
16
17
  "teddy-spinner__circle--negative-disabled": "_teddy-spinner__circle--negative-disabled_ywden_39"
17
- }, d = "teddy-spinner", p = {
18
+ };
19
+ const rootClassName = "teddy-spinner";
20
+ const SPINNER_VARIANT = {
18
21
  PRIMARY: "primary",
19
22
  DISABLED: "disabled",
20
23
  NEGATIVE: "negative",
21
24
  NEGATIVE_DISABLED: "negative-disabled"
22
- }, o = {
25
+ };
26
+ const SPINNER_SIZE = {
23
27
  XXS: "xxs",
24
28
  XS: "xs",
25
29
  SM: "sm",
26
30
  MD: "md",
27
31
  LG: "lg"
28
- }, g = y.forwardRef(
29
- ({ size: s = o.SM, variant: r = p.PRIMARY, className: i, ...t }, c) => /* @__PURE__ */ n(
30
- "svg",
31
- {
32
- ...t,
33
- viewBox: "0 0 50 50",
34
- className: _([e[d], e[`${d}--${s}`], i]),
35
- ref: c,
36
- children: /* @__PURE__ */ n(
37
- "circle",
38
- {
39
- className: _(e[`${d}__circle`], e[`${d}__circle--${r}`]),
40
- cx: "25",
41
- cy: "25",
42
- r: "20"
43
- }
44
- )
45
- }
46
- )
32
+ };
33
+ const Spinner = React__default.forwardRef(
34
+ ({ size = SPINNER_SIZE.SM, variant = SPINNER_VARIANT.PRIMARY, className, ...props }, forwardRef) => {
35
+ return /* @__PURE__ */ jsx(
36
+ "svg",
37
+ {
38
+ ...props,
39
+ viewBox: "0 0 50 50",
40
+ className: clsx([styles[rootClassName], styles[`${rootClassName}--${size}`], className]),
41
+ ref: forwardRef,
42
+ children: /* @__PURE__ */ jsx(
43
+ "circle",
44
+ {
45
+ className: clsx(styles[`${rootClassName}__circle`], styles[`${rootClassName}__circle--${variant}`]),
46
+ cx: "25",
47
+ cy: "25",
48
+ r: "20"
49
+ }
50
+ )
51
+ }
52
+ );
53
+ }
47
54
  );
48
55
  export {
49
- g as Spinner
56
+ Spinner
50
57
  };
@@ -1,4 +1,4 @@
1
- import { Text as r } from "./text.js";
1
+ import { Text } from "./text.js";
2
2
  export {
3
- r as Text
3
+ Text
4
4
  };
@@ -1,9 +1,8 @@
1
- import '../../assets/text.css';
2
- import { jsx as a } from "react/jsx-runtime";
3
- import { $ as l } from "../../index-DpfSJps6.js";
4
- import { c as n } from "../../clsx-DB4S2d7J.js";
5
- import c from "react";
6
- const t = {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import clsx from "clsx";
4
+ import React__default from "react";
5
+ const styles = {
7
6
  "teddy-text": "_teddy-text_2zpdm_1",
8
7
  "teddy-text--disabled": "_teddy-text--disabled_2zpdm_7",
9
8
  "teddy-text--hyphens": "_teddy-text--hyphens_2zpdm_10",
@@ -17,21 +16,23 @@ const t = {
17
16
  "teddy-text--additional-100-medium": "_teddy-text--additional-100-medium_2zpdm_57",
18
17
  "teddy-text--overline-100": "_teddy-text--overline-100_2zpdm_64",
19
18
  "teddy-text--overline-200": "_teddy-text--overline-200_2zpdm_71"
20
- }, e = "teddy-text", h = c.forwardRef(
21
- ({ className: p, children: d, disabled: r, enableHyphenation: _, variant: m = "paragraph-100", asChild: x, as: y = "p", ...o }, s) => {
22
- const i = n(
23
- t[e],
24
- t[`${e}--${m}`],
19
+ };
20
+ const rootClassName = "teddy-text";
21
+ const Text = React__default.forwardRef(
22
+ ({ className, children, disabled, enableHyphenation, variant = "paragraph-100", asChild, as: Tag = "p", ...props }, forwardRef) => {
23
+ const classes = clsx(
24
+ styles[rootClassName],
25
+ styles[`${rootClassName}--${variant}`],
25
26
  {
26
- [t[`${e}--hyphens`]]: _,
27
- [t[`${e}--disabled`]]: r
27
+ [styles[`${rootClassName}--hyphens`]]: enableHyphenation,
28
+ [styles[`${rootClassName}--disabled`]]: disabled
28
29
  },
29
- p
30
+ className
30
31
  );
31
- return /* @__PURE__ */ a(l, { ...o, ref: s, className: i, children: x ? d : /* @__PURE__ */ a(y, { children: d }) });
32
+ return /* @__PURE__ */ jsx(Slot, { ...props, ref: forwardRef, className: classes, children: asChild ? children : /* @__PURE__ */ jsx(Tag, { children }) });
32
33
  }
33
34
  );
34
- h.displayName = "Text";
35
+ Text.displayName = "Text";
35
36
  export {
36
- h as Text
37
+ Text
37
38
  };
@@ -1,4 +1,4 @@
1
- import { TextField as r } from "./text-field.js";
1
+ import { TextField } from "./text-field.js";
2
2
  export {
3
- r as TextField
3
+ TextField
4
4
  };
@@ -1,118 +1,138 @@
1
- import '../../assets/text-field.css';
2
- import { jsx as o, jsxs as H } from "react/jsx-runtime";
3
- import { c as u } from "../../clsx-DB4S2d7J.js";
4
- import i from "react";
5
- import { FieldErrorText as T } from "../field-error-text/field-error-text.js";
6
- import { HelperText as $ } from "../helper-text/helper-text.js";
7
- import { Label as j } from "../label/label.js";
8
- import { InputGroup as I } from "../input/input.js";
9
- const q = "_fadeInAnimation_1i091_1", G = "_scaleInAnimation_1i091_1", p = {
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import React__default from "react";
4
+ import { FieldErrorText } from "../field-error-text/field-error-text.js";
5
+ import { HelperText } from "../helper-text/helper-text.js";
6
+ import { Label } from "../label/label.js";
7
+ import { InputGroup } from "../input/input.js";
8
+ const fadeInAnimation = "_fadeInAnimation_1i091_1";
9
+ const scaleInAnimation = "_scaleInAnimation_1i091_1";
10
+ const styles = {
10
11
  "teddy-text-field": "_teddy-text-field_1i091_17",
11
12
  "teddy-text-field__error-list": "_teddy-text-field__error-list_1i091_23",
12
- fadeInAnimation: q,
13
- scaleInAnimation: G
14
- }, m = "teddy-text-field", f = i.createContext(void 0), _ = i.forwardRef(
15
- ({ className: t, children: d, readOnly: e, disabled: r, errors: a, isValid: s, isLoading: l, isRequired: n, ...c }, R) => {
16
- const h = i.useId(), L = c.id || h, C = u([p[m]], t), [E, g] = i.useState(void 0), [w, A] = i.useState(void 0);
17
- return /* @__PURE__ */ o("div", { ...c, ref: R, className: C, children: /* @__PURE__ */ o(
18
- f.Provider,
13
+ fadeInAnimation,
14
+ scaleInAnimation
15
+ };
16
+ const rootClassName = "teddy-text-field";
17
+ const TextFieldContext = React__default.createContext(void 0);
18
+ const TextFieldRoot = React__default.forwardRef(
19
+ ({ className, children, readOnly, disabled, errors, isValid, isLoading, isRequired, ...props }, forwardRef) => {
20
+ const fallbackId = React__default.useId();
21
+ const id = props.id || fallbackId;
22
+ const classes = clsx([styles[rootClassName]], className);
23
+ const [helperTextId, setHelperTextId] = React__default.useState(void 0);
24
+ const [errorId, setErrorId] = React__default.useState(void 0);
25
+ return /* @__PURE__ */ jsx("div", { ...props, ref: forwardRef, className: classes, children: /* @__PURE__ */ jsx(
26
+ TextFieldContext.Provider,
19
27
  {
20
28
  value: {
21
- errors: a,
22
- id: L,
23
- errorId: w,
24
- setErrorId: A,
25
- helperTextId: E,
26
- setHelperTextId: g,
27
- disabled: r,
28
- readOnly: e,
29
- isValid: s,
30
- isLoading: l,
31
- isRequired: n
29
+ errors,
30
+ id,
31
+ errorId,
32
+ setErrorId,
33
+ helperTextId,
34
+ setHelperTextId,
35
+ disabled,
36
+ readOnly,
37
+ isValid,
38
+ isLoading,
39
+ isRequired
32
40
  },
33
- children: d
41
+ children
34
42
  }
35
43
  ) });
36
44
  }
37
45
  );
38
- _.displayName = "TextField";
39
- const F = i.forwardRef((t, d) => {
40
- var a;
41
- const e = i.useContext(f), r = e == null ? void 0 : e.id;
42
- return /* @__PURE__ */ o(
43
- I.Input,
46
+ TextFieldRoot.displayName = "TextField";
47
+ const TextFieldInput = React__default.forwardRef((props, forwardRef) => {
48
+ var _a;
49
+ const context = React__default.useContext(TextFieldContext);
50
+ const id = context == null ? void 0 : context.id;
51
+ return /* @__PURE__ */ jsx(
52
+ InputGroup.Input,
44
53
  {
45
- ...t,
46
- "aria-describedby": [e == null ? void 0 : e.errorId, e == null ? void 0 : e.helperTextId].filter(Boolean).join(" "),
47
- disabled: e == null ? void 0 : e.disabled,
48
- readOnly: e == null ? void 0 : e.readOnly,
49
- required: e == null ? void 0 : e.isRequired,
50
- isLoading: e == null ? void 0 : e.isLoading,
51
- validationState: e != null && e.isValid ? "valid" : (a = e == null ? void 0 : e.errors) != null && a.length ? "invalid" : void 0,
52
- id: r,
53
- ref: d
54
+ ...props,
55
+ "aria-describedby": [context == null ? void 0 : context.errorId, context == null ? void 0 : context.helperTextId].filter(Boolean).join(" "),
56
+ disabled: context == null ? void 0 : context.disabled,
57
+ readOnly: context == null ? void 0 : context.readOnly,
58
+ required: context == null ? void 0 : context.isRequired,
59
+ isLoading: context == null ? void 0 : context.isLoading,
60
+ validationState: (context == null ? void 0 : context.isValid) ? "valid" : ((_a = context == null ? void 0 : context.errors) == null ? void 0 : _a.length) ? "invalid" : void 0,
61
+ id,
62
+ ref: forwardRef
54
63
  }
55
64
  );
56
65
  });
57
- F.displayName = "TextField.Input";
58
- const y = i.forwardRef((t, d) => /* @__PURE__ */ o(I, { ...t, ref: d }));
59
- y.displayName = "TextField.InputGroup";
60
- const b = i.forwardRef(
61
- (t, d) => {
62
- const e = i.useContext(f);
63
- return /* @__PURE__ */ o(I.Indicator, { isValid: e == null ? void 0 : e.isValid, isLoading: e == null ? void 0 : e.isLoading, ...t, ref: d });
66
+ TextFieldInput.displayName = "TextField.Input";
67
+ const TextFieldInputGroup = React__default.forwardRef((props, forwardRef) => {
68
+ return /* @__PURE__ */ jsx(InputGroup, { ...props, ref: forwardRef });
69
+ });
70
+ TextFieldInputGroup.displayName = "TextField.InputGroup";
71
+ const TextFieldIndicator = React__default.forwardRef(
72
+ (props, forwardRef) => {
73
+ const context = React__default.useContext(TextFieldContext);
74
+ return /* @__PURE__ */ jsx(InputGroup.Indicator, { isValid: context == null ? void 0 : context.isValid, isLoading: context == null ? void 0 : context.isLoading, ...props, ref: forwardRef });
64
75
  }
65
76
  );
66
- b.displayName = "TextField.Indicator";
67
- const v = i.forwardRef(
68
- ({ className: t, ...d }, e) => {
69
- const r = i.useContext(f), a = u([p[`${m}__label`]], t), s = d.id || (r == null ? void 0 : r.id);
70
- return /* @__PURE__ */ o(
71
- j,
77
+ TextFieldIndicator.displayName = "TextField.Indicator";
78
+ const TextFieldLabel = React__default.forwardRef(
79
+ ({ className, ...props }, forwardRef) => {
80
+ const context = React__default.useContext(TextFieldContext);
81
+ const classes = clsx([styles[`${rootClassName}__label`]], className);
82
+ const id = props.id || (context == null ? void 0 : context.id);
83
+ return /* @__PURE__ */ jsx(
84
+ Label,
72
85
  {
73
- ...d,
74
- isRequired: r == null ? void 0 : r.isRequired,
75
- htmlFor: s,
76
- disabled: r == null ? void 0 : r.disabled,
77
- ref: e,
78
- className: a
86
+ ...props,
87
+ isRequired: context == null ? void 0 : context.isRequired,
88
+ htmlFor: id,
89
+ disabled: context == null ? void 0 : context.disabled,
90
+ ref: forwardRef,
91
+ className: classes
79
92
  }
80
93
  );
81
94
  }
82
95
  );
83
- v.displayName = "TextField.Label";
84
- const x = i.forwardRef(
85
- ({ className: t, ...d }, e) => {
86
- const r = i.useContext(f), a = u([p[`${m}__help-text`]], t);
87
- return i.useEffect(() => {
88
- r == null || r.setHelperTextId(`${r.id}-helper-text`);
89
- }, [r]), /* @__PURE__ */ o($, { id: r == null ? void 0 : r.helperTextId, ...d, ref: e, className: a });
96
+ TextFieldLabel.displayName = "TextField.Label";
97
+ const TextFieldHelperText = React__default.forwardRef(
98
+ ({ className, ...props }, forwardRef) => {
99
+ const context = React__default.useContext(TextFieldContext);
100
+ const classes = clsx([styles[`${rootClassName}__help-text`]], className);
101
+ React__default.useEffect(() => {
102
+ context == null ? void 0 : context.setHelperTextId(`${context.id}-helper-text`);
103
+ }, [context]);
104
+ return /* @__PURE__ */ jsx(HelperText, { id: context == null ? void 0 : context.helperTextId, ...props, ref: forwardRef, className: classes });
90
105
  }
91
106
  );
92
- x.displayName = "TextField.HelperText";
93
- const N = i.forwardRef(
94
- ({ className: t, children: d, ...e }, r) => {
95
- const a = u([p[`${m}__error-list`]], t), s = i.useContext(f), l = s == null ? void 0 : s.errors;
96
- return i.useEffect(() => {
97
- if (!s)
107
+ TextFieldHelperText.displayName = "TextField.HelperText";
108
+ const TextFieldErrorList = React__default.forwardRef(
109
+ ({ className, children, ...props }, forwardRef) => {
110
+ const classes = clsx([styles[`${rootClassName}__error-list`]], className);
111
+ const context = React__default.useContext(TextFieldContext);
112
+ const errors = context == null ? void 0 : context.errors;
113
+ React__default.useEffect(() => {
114
+ if (!context)
98
115
  return;
99
- const n = l != null && l.length ? `${s.id}-error` : void 0;
100
- s == null || s.setErrorId(n);
101
- }, [l, s]), !s || !s.errors ? null : /* @__PURE__ */ o("ul", { id: s.errorId, "aria-live": "assertive", ...e, ref: r, className: a, children: typeof d == "function" ? d({ errors: l }) : d || (l == null ? void 0 : l.map((n) => /* @__PURE__ */ o(T, { asChild: !0, children: /* @__PURE__ */ H("li", { children: [
102
- /* @__PURE__ */ o(T.Indicator, {}),
103
- n
104
- ] }) }, n))) });
116
+ const errorId = (errors == null ? void 0 : errors.length) ? `${context.id}-error` : void 0;
117
+ context == null ? void 0 : context.setErrorId(errorId);
118
+ }, [errors, context]);
119
+ if (!context || !context.errors)
120
+ return null;
121
+ return /* @__PURE__ */ jsx("ul", { id: context.errorId, "aria-live": "assertive", ...props, ref: forwardRef, className: classes, children: typeof children === "function" ? children({ errors }) : children || (errors == null ? void 0 : errors.map((error) => /* @__PURE__ */ jsx(FieldErrorText, { asChild: true, children: /* @__PURE__ */ jsxs("li", { children: [
122
+ /* @__PURE__ */ jsx(FieldErrorText.Indicator, {}),
123
+ error
124
+ ] }) }, error))) });
105
125
  }
106
126
  );
107
- N.displayName = "TextField.ErrorList";
108
- const D = Object.assign(_, {
109
- Input: F,
110
- Label: v,
111
- InputGroup: y,
112
- HelperText: x,
113
- ErrorList: N,
114
- Indicator: b
127
+ TextFieldErrorList.displayName = "TextField.ErrorList";
128
+ const TextField = Object.assign(TextFieldRoot, {
129
+ Input: TextFieldInput,
130
+ Label: TextFieldLabel,
131
+ InputGroup: TextFieldInputGroup,
132
+ HelperText: TextFieldHelperText,
133
+ ErrorList: TextFieldErrorList,
134
+ Indicator: TextFieldIndicator
115
135
  });
116
136
  export {
117
- D as TextField
137
+ TextField
118
138
  };
@@ -1,4 +1,4 @@
1
- import { TextSpacing as p } from "./text-spacing.js";
1
+ import { TextSpacing } from "./text-spacing.js";
2
2
  export {
3
- p as TextSpacing
3
+ TextSpacing
4
4
  };
@@ -1,17 +1,19 @@
1
- import '../../assets/text-spacing.css';
2
- import { jsx as p } from "react/jsx-runtime";
3
- import { c as d } from "../../clsx-DB4S2d7J.js";
4
- import m from "react";
5
- import { $ as i } from "../../index-DpfSJps6.js";
6
- const n = {
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-text-spacing": "_teddy-text-spacing_dwbo8_1"
8
- }, f = "teddy-text-spacing", x = m.forwardRef(
9
- ({ className: t, asChild: e = !1, children: s, ...c }, o) => {
10
- const a = e ? i : "div", r = d([n[`${f}`]], t);
11
- return /* @__PURE__ */ p(a, { ...c, ref: o, className: r, children: s });
7
+ };
8
+ const rootClassName = "teddy-text-spacing";
9
+ const TextSpacing = React__default.forwardRef(
10
+ ({ className, asChild = false, children, ...props }, forwardRef) => {
11
+ const Comp = asChild ? Slot : "div";
12
+ const classes = clsx([styles[`${rootClassName}`]], className);
13
+ return /* @__PURE__ */ jsx(Comp, { ...props, ref: forwardRef, className: classes, children });
12
14
  }
13
15
  );
14
- x.displayName = "TextSpacing";
16
+ TextSpacing.displayName = "TextSpacing";
15
17
  export {
16
- x as TextSpacing
18
+ TextSpacing
17
19
  };
@@ -1,4 +1,4 @@
1
- import { T as g } from "../../badge-C6I_qxYL.js";
1
+ import { Toggle } from "./toggle.js";
2
2
  export {
3
- g as Toggle
3
+ Toggle
4
4
  };
@@ -1,4 +1,4 @@
1
- import { Label } from '..';
1
+ import { Label } from '../label';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  import * as SwitchPrimitive from '@radix-ui/react-switch';