@telia/teddy 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +8 -10
  2. package/dist/assets/5161b177f001ea1a.svg +1080 -0
  3. package/dist/assets/badge.css +1 -0
  4. package/dist/assets/button.css +1 -1
  5. package/dist/assets/grid.css +1 -0
  6. package/dist/assets/heading.css +1 -0
  7. package/dist/assets/icon.css +1 -1
  8. package/dist/assets/input.css +1 -1
  9. package/dist/assets/label.css +1 -1
  10. package/dist/assets/link.css +1 -0
  11. package/dist/assets/main.css +1 -1
  12. package/dist/assets/navigation-menu.css +1 -0
  13. package/dist/assets/text-field.css +1 -1
  14. package/dist/assets/text-spacing.css +1 -0
  15. package/dist/assets/text.css +1 -1
  16. package/dist/assets/visually-hidden.css +1 -0
  17. package/dist/badge-CbHdlkcM.js +742 -0
  18. package/dist/components/accordion/accordion.d.ts +59 -0
  19. package/dist/components/accordion/accordion.js +24 -0
  20. package/dist/components/accordion/index.d.ts +2 -0
  21. package/dist/components/accordion/index.js +4 -0
  22. package/dist/components/badge/badge.d.ts +21 -0
  23. package/dist/components/badge/badge.js +24 -0
  24. package/dist/components/badge/index.d.ts +2 -0
  25. package/dist/components/badge/index.js +4 -0
  26. package/dist/components/button/button.d.ts +19 -20
  27. package/dist/components/button/button.js +82 -71
  28. package/dist/components/button/index.d.ts +1 -1
  29. package/dist/components/card/card.d.ts +68 -0
  30. package/dist/components/card/card.js +24 -0
  31. package/dist/components/card/index.d.ts +2 -0
  32. package/dist/components/card/index.js +4 -0
  33. package/dist/components/field-error-text/field-error-text.d.ts +4 -3
  34. package/dist/components/field-error-text/field-error-text.js +12 -12
  35. package/dist/components/grid/grid.d.ts +23 -0
  36. package/dist/components/grid/grid.js +18 -0
  37. package/dist/components/grid/index.d.ts +2 -0
  38. package/dist/components/grid/index.js +4 -0
  39. package/dist/components/heading/heading.d.ts +63 -0
  40. package/dist/components/heading/heading.js +53 -0
  41. package/dist/components/heading/index.d.ts +2 -0
  42. package/dist/components/heading/index.js +4 -0
  43. package/dist/components/helper-text/helper-text.d.ts +2 -1
  44. package/dist/components/helper-text/helper-text.js +7 -7
  45. package/dist/components/icon/icon.d.ts +13 -2
  46. package/dist/components/icon/icon.js +22 -22
  47. package/dist/components/icon/index.d.ts +2 -1
  48. package/dist/components/icon/index.js +1 -1
  49. package/dist/components/index.d.ts +10 -0
  50. package/dist/components/index.js +38 -21
  51. package/dist/components/input/input.d.ts +14 -23
  52. package/dist/components/input/input.js +72 -50
  53. package/dist/components/label/label.d.ts +3 -1
  54. package/dist/components/label/label.js +23 -51
  55. package/dist/components/link/index.d.ts +2 -0
  56. package/dist/components/link/index.js +4 -0
  57. package/dist/components/link/link.d.ts +49 -0
  58. package/dist/components/link/link.js +36 -0
  59. package/dist/components/navigation-menu/index.d.ts +2 -0
  60. package/dist/components/navigation-menu/index.js +4 -0
  61. package/dist/components/navigation-menu/navigation-menu.d.ts +126 -0
  62. package/dist/components/navigation-menu/navigation-menu.js +10 -0
  63. package/dist/components/spinner/spinner.d.ts +2 -1
  64. package/dist/components/spinner/spinner.js +5 -5
  65. package/dist/components/switch/index.d.ts +2 -0
  66. package/dist/components/switch/index.js +4 -0
  67. package/dist/components/switch/switch.d.ts +44 -0
  68. package/dist/components/switch/switch.js +23 -0
  69. package/dist/components/text/text.d.ts +15 -8
  70. package/dist/components/text/text.js +27 -41
  71. package/dist/components/text-field/text-field.d.ts +24 -24
  72. package/dist/components/text-field/text-field.js +102 -125
  73. package/dist/components/text-spacing/index.d.ts +2 -0
  74. package/dist/components/text-spacing/index.js +4 -0
  75. package/dist/components/text-spacing/text-spacing.d.ts +19 -0
  76. package/dist/components/text-spacing/text-spacing.js +17 -0
  77. package/dist/components/visually-hidden/index.d.ts +2 -0
  78. package/dist/components/visually-hidden/index.js +4 -0
  79. package/dist/components/visually-hidden/visually-hidden.d.ts +15 -0
  80. package/dist/components/visually-hidden/visually-hidden.js +24 -0
  81. package/dist/icons/category.d.ts +985 -0
  82. package/dist/icons/category.js +333 -0
  83. package/dist/icons/name.d.ts +1 -1
  84. package/dist/icons/name.js +250 -200
  85. package/dist/index-DM5e-Whg.js +43 -0
  86. package/dist/index-DpfSJps6.js +75 -0
  87. package/dist/main.d.ts +1 -0
  88. package/dist/main.js +53 -36
  89. package/dist/navigation-menu-BgN7IKev.js +1334 -0
  90. package/dist/tokens/spacing/variables.json.d.ts +34 -0
  91. package/dist/utils/action.d.ts +2 -2
  92. package/dist/utils/composeEventHandlers.d.ts +30 -0
  93. package/dist/utils/composeEventHandlers.js +9 -0
  94. package/dist/utils/composeRefs.d.ts +40 -0
  95. package/dist/utils/composeRefs.js +14 -0
  96. package/dist/utils/layout.d.ts +60 -0
  97. package/dist/utils/layout.js +100 -0
  98. package/package.json +25 -24
  99. package/dist/assets/f2a2f391a886d395.svg +0 -284
  100. package/dist/index-TI1xsy6a.js +0 -70
  101. package/dist/teams/index.d.ts +0 -0
  102. package/dist/teams/index.js +0 -1
  103. package/dist/teams/min-side/index.d.ts +0 -0
  104. package/dist/teams/min-side/index.js +0 -1
  105. package/dist/teams/webshop/index.d.ts +0 -0
  106. package/dist/teams/webshop/index.js +0 -1
  107. /package/dist/{teams/business/index.d.ts → components/text-field/tex-field-label.d.ts} +0 -0
  108. /package/dist/{teams/business/index.js → components/text-field/tex-field-label.js} +0 -0
@@ -1,11 +1,15 @@
1
- import React from 'react';
2
- import { HelperTextProps } from '../helper-text';
1
+ import { InputGroupProps } from '../input';
3
2
  import { LabelProps } from '../label';
3
+ import { HelperTextProps } from '../helper-text';
4
+ import { default as React } from 'react';
5
+
4
6
  type ListOfErrors = Array<string | null | undefined> | null | undefined;
5
7
  type TextFieldContextValue = {
6
8
  id: string;
7
9
  errorId?: string;
10
+ setErrorId: React.Dispatch<React.SetStateAction<string | undefined>>;
8
11
  helperTextId?: string;
12
+ setHelperTextId: React.Dispatch<React.SetStateAction<string | undefined>>;
9
13
  disabled?: boolean;
10
14
  errors?: ListOfErrors;
11
15
  readOnly?: boolean;
@@ -13,12 +17,7 @@ type TextFieldContextValue = {
13
17
  isLoading?: boolean;
14
18
  isRequired?: boolean;
15
19
  };
16
- type Input = React.ComponentPropsWithoutRef<'input'>;
17
- type RootInputProps<T extends Input['value']> = Omit<Input, 'value'> & {
18
- value?: T;
19
- onValueChange?: (value: T) => void;
20
- };
21
- type TextFieldRootProps<T extends Input['value']> = React.ComponentPropsWithoutRef<'div'> & {
20
+ type TextFieldRootProps = React.ComponentPropsWithoutRef<'div'> & {
22
21
  /**
23
22
  * Whether the input is disabled.
24
23
  */
@@ -40,18 +39,18 @@ type TextFieldRootProps<T extends Input['value']> = React.ComponentPropsWithoutR
40
39
  * Whether the input is required.
41
40
  */
42
41
  isRequired?: boolean;
43
- } & RootInputProps<T>;
44
- type TextFieldInputProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'id' | 'disabled' | 'readOnly' | 'required'> & {};
45
- type TextFieldDecoratorProps = React.ComponentPropsWithoutRef<'div'> & {};
42
+ };
43
+ type TextFieldInputProps = Omit<InputGroupProps['Input'], 'id' | 'disabled' | 'readOnly' | 'required'> & {};
44
+ type TextFieldInputGroupProps = InputGroupProps['Root'] & {};
45
+ type TextFieldIndicatorProps = InputGroupProps['Indicator'];
46
46
  type TextFieldLabelProps = LabelProps;
47
47
  type TextFieldHelperTextProps = HelperTextProps & {};
48
48
  type TextFieldErrorList = Omit<React.ComponentPropsWithoutRef<'ul'>, 'children'> & {
49
49
  children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
50
50
  };
51
51
  declare const TextFieldErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
52
- children?: React.ReactNode | ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode);
52
+ children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
53
53
  } & React.RefAttributes<HTMLUListElement>>;
54
- type TextFieldIndicatorProps = React.ComponentPropsWithoutRef<'svg'>;
55
54
  export declare const TextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
56
55
  /**
57
56
  * Whether the input is disabled.
@@ -74,26 +73,27 @@ export declare const TextField: React.ForwardRefExoticComponent<Omit<React.Detai
74
73
  * Whether the input is required.
75
74
  */
76
75
  isRequired?: boolean | undefined;
77
- } & Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value"> & {
78
- value?: string | number | readonly string[] | undefined;
79
- onValueChange?: ((value: string | number | readonly string[] | undefined) => void) | undefined;
80
76
  } & React.RefAttributes<HTMLDivElement>> & {
81
- Input: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "disabled" | "id" | "readOnly" | "required"> & React.RefAttributes<HTMLInputElement>>;
82
- Label: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-label").LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
77
+ Input: React.ForwardRefExoticComponent<Omit<import('../input').InputProps, "id" | "disabled" | "readOnly" | "required"> & React.RefAttributes<HTMLInputElement>>;
78
+ Label: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-label').LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
83
79
  disabled?: boolean | undefined;
80
+ isRequired?: boolean | undefined;
84
81
  } & React.RefAttributes<HTMLLabelElement>>;
85
- Decorator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
82
+ InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
86
83
  HelperText: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
87
84
  ErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
88
- children?: React.ReactNode | ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode);
85
+ children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
89
86
  } & React.RefAttributes<HTMLUListElement>>;
90
- Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
87
+ Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
88
+ isLoading?: boolean | undefined;
89
+ isValid?: boolean | undefined;
90
+ } & React.RefAttributes<SVGSVGElement>>;
91
91
  };
92
- export type TextFieldProps<T extends Input['value']> = {
93
- Root: TextFieldRootProps<T>;
92
+ export type TextFieldProps = {
93
+ Root: TextFieldRootProps;
94
94
  Input: TextFieldInputProps;
95
95
  Label: TextFieldLabelProps;
96
- Decorator: TextFieldDecoratorProps;
96
+ Group: TextFieldInputGroupProps;
97
97
  HelperText: TextFieldHelperTextProps;
98
98
  ErrorList: TextFieldErrorList;
99
99
  Indicator: TextFieldIndicatorProps;
@@ -1,141 +1,118 @@
1
- import "../../assets/text-field.css";
2
- import { jsx as s, jsxs as v } from "react/jsx-runtime";
3
- import { c } from "../../clsx-DB4S2d7J.js";
4
- import a from "react";
5
- import { FieldErrorText as x } from "../field-error-text/field-error-text.js";
6
- import { HelperText as L } from "../helper-text/helper-text.js";
7
- import "../../assets/f2a2f391a886d395.svg";
8
- import { Icon as E } from "../icon/icon.js";
9
- import { Label as O } from "../label/label.js";
10
- import { Spinner as P } from "../spinner/spinner.js";
11
- const A = "_fadeInAnimation_370v0_1", w = "_scaleInAnimation_370v0_1", l = {
12
- "teddy-text-field": "_teddy-text-field_370v0_17",
13
- "teddy-text-field__frame": "_teddy-text-field__frame_370v0_23",
14
- "teddy-text-field__input": "_teddy-text-field__input_370v0_30",
15
- "teddy-text-field__decorator": "_teddy-text-field__decorator_370v0_47",
16
- "teddy-text-field__decorator--disabled": "_teddy-text-field__decorator--disabled_370v0_54",
17
- "teddy-text-field__decorator--read-only": "_teddy-text-field__decorator--read-only_370v0_54",
18
- "teddy-text-field__decorator--error": "_teddy-text-field__decorator--error_370v0_68",
19
- "teddy-text-field__decorator--valid": "_teddy-text-field__decorator--valid_370v0_71",
20
- "teddy-text-field__indicator": "_teddy-text-field__indicator_370v0_74",
21
- fadeInAnimation: A,
22
- scaleInAnimation: w,
23
- "teddy-text-field__error-list": "_teddy-text-field__error-list_370v0_80"
24
- }, n = "teddy-text-field", u = a.createContext(void 0), I = a.forwardRef(function({ className: i, children: r, readOnly: d, disabled: t, errors: e, isValid: o, isLoading: _, isRequired: f, ...m }, $) {
25
- const h = a.useId(), p = m.id || h, R = c([l[n]], i), D = e != null && e.length ? `${p}-error` : void 0;
26
- return /* @__PURE__ */ s("div", { ...m, ref: $, className: R, children: /* @__PURE__ */ s(
27
- u.Provider,
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 = {
10
+ "teddy-text-field": "_teddy-text-field_1i091_17",
11
+ "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 }, N) => {
16
+ const R = i.useId(), h = c.id || R, C = u([p[m]], t), [E, g] = i.useState(void 0), [w, A] = i.useState(void 0);
17
+ return /* @__PURE__ */ o("div", { ...c, ref: N, className: C, children: /* @__PURE__ */ o(
18
+ f.Provider,
19
+ {
20
+ value: {
21
+ errors: a,
22
+ id: h,
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
32
+ },
33
+ children: d
34
+ }
35
+ ) });
36
+ }
37
+ );
38
+ _.displayName = "TextField";
39
+ const y = 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,
28
44
  {
29
- value: {
30
- errors: e,
31
- id: p,
32
- errorId: D,
33
- disabled: t,
34
- readOnly: d,
35
- isValid: o,
36
- isLoading: _,
37
- isRequired: f
38
- },
39
- children: r
40
- }
41
- ) });
42
- });
43
- I.displayName = "TextFieldRoot";
44
- const T = a.forwardRef(
45
- ({ className: i, ...r }, d) => {
46
- const t = a.useContext(F), e = a.useContext(u), o = c([l[`${n}__input`]], i), _ = t !== void 0, f = e == null ? void 0 : e.id, m = {
47
- "aria-invalid": e != null && e.errorId ? !0 : void 0,
48
- "aria-describedby": e == null ? void 0 : e.errorId,
49
- id: f,
50
- className: o,
45
+ ...t,
46
+ "aria-describedby": [e == null ? void 0 : e.errorId, e == null ? void 0 : e.helperTextId].filter(Boolean).join(" "),
51
47
  disabled: e == null ? void 0 : e.disabled,
52
48
  readOnly: e == null ? void 0 : e.readOnly,
53
- required: e == null ? void 0 : e.isRequired
54
- };
55
- return _ ? /* @__PURE__ */ s("input", { ...r, ...m, ref: d }) : /* @__PURE__ */ s(y, { children: /* @__PURE__ */ s("input", { ...r, ...m, ref: d }) });
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
+ }
55
+ );
56
+ });
57
+ y.displayName = "TextField.Input";
58
+ const F = i.forwardRef((t, d) => /* @__PURE__ */ o(I, { ...t, ref: d }));
59
+ F.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 });
56
64
  }
57
65
  );
58
- T.displayName = "TextFieldInput";
59
- function H(i) {
60
- const r = i == null ? void 0 : i.target;
61
- if (r.closest("input, button, a"))
62
- return;
63
- const d = [...i.currentTarget.getElementsByTagName("input")].find((_) => _);
64
- if (!d)
65
- return;
66
- const o = (d.compareDocumentPosition(r) & Node.DOCUMENT_POSITION_PRECEDING) !== 0 ? 0 : d.value.length;
67
- requestAnimationFrame(() => {
68
- try {
69
- d.setSelectionRange(o, o);
70
- } finally {
71
- d.focus();
72
- }
73
- });
74
- }
75
- const F = a.createContext(void 0), y = a.forwardRef(
76
- ({ className: i, children: r, ...d }, t) => {
77
- const e = a.useContext(u), o = c(
78
- [l[`${n}__decorator`]],
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,
79
72
  {
80
- [l[`${n}__decorator--disabled`]]: e == null ? void 0 : e.disabled,
81
- [l[`${n}__decorator--read-only`]]: e == null ? void 0 : e.readOnly,
82
- [l[`${n}__decorator--error`]]: e == null ? void 0 : e.errorId,
83
- [l[`${n}__decorator--valid`]]: e == null ? void 0 : e.isValid
84
- },
85
- i
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
79
+ }
86
80
  );
87
- return /* @__PURE__ */ v("div", { ...d, onPointerDown: H, ref: t, className: o, children: [
88
- /* @__PURE__ */ s(F.Provider, { value: !0, children: r }),
89
- /* @__PURE__ */ s("div", { className: l[`${n}__frame`] })
90
- ] });
91
- }
92
- );
93
- y.displayName = "TextFieldDecorator";
94
- const N = a.forwardRef(
95
- ({ className: i, ...r }, d) => {
96
- const t = c([l[`${n}__label`]], i), e = a.useContext(u), o = r.id || (e == null ? void 0 : e.id);
97
- return /* @__PURE__ */ s(O, { ...r, htmlFor: o, disabled: e == null ? void 0 : e.disabled, ref: d, className: t });
98
- }
99
- );
100
- N.displayName = "TextFieldLabel";
101
- const b = a.forwardRef(
102
- ({ className: i, ...r }, d) => {
103
- const t = c([l[`${n}__help-text`]], i);
104
- return /* @__PURE__ */ s(L, { ...r, ref: d, className: t });
105
81
  }
106
82
  );
107
- b.displayName = "TextFieldHelperText";
108
- const C = a.forwardRef(
109
- ({ className: i, children: r, ...d }, t) => {
110
- var _;
111
- const e = c([l[`${n}__error-list`]], i), o = a.useContext(u);
112
- return !o || !o.errors ? null : /* @__PURE__ */ s("ul", { id: o.errorId, "aria-live": "assertive", ...d, ref: t, className: e, children: typeof r == "function" ? r({ errors: o.errors }) : r || ((_ = o.errors) == null ? void 0 : _.map((f) => /* @__PURE__ */ s(x, { asChild: !0, children: /* @__PURE__ */ v("li", { children: [
113
- /* @__PURE__ */ s(x.Indicator, {}),
114
- f
115
- ] }) }, f))) });
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.useLayoutEffect(() => {
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 });
116
90
  }
117
91
  );
118
- C.displayName = "TextFieldErrorList";
119
- const g = a.forwardRef(
120
- ({ className: i, ...r }, d) => {
121
- const t = a.useContext(u);
122
- if (!(t != null && t.isValid) && !(t != null && t.isLoading))
123
- return null;
124
- if (!(t != null && t.isValid) && (t != null && t.isLoading))
125
- return /* @__PURE__ */ s(P, { className: i, size: "xs", ...r, ref: d });
126
- const e = c([l[`${n}__indicator`]], i);
127
- return /* @__PURE__ */ s(E, { ...r, size: "md", name: "check-circle-filled", className: e, ref: d });
92
+ x.displayName = "TextField.HelperText";
93
+ const L = 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.useLayoutEffect(() => {
97
+ if (!s)
98
+ 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))) });
128
105
  }
129
106
  );
130
- g.displayName = "TextFieldIndicator";
131
- const J = Object.assign(I, {
132
- Input: T,
133
- Label: N,
134
- Decorator: y,
135
- HelperText: b,
136
- ErrorList: C,
137
- Indicator: g
107
+ L.displayName = "TextField.ErrorList";
108
+ const D = Object.assign(_, {
109
+ Input: y,
110
+ Label: v,
111
+ InputGroup: F,
112
+ HelperText: x,
113
+ ErrorList: L,
114
+ Indicator: b
138
115
  });
139
116
  export {
140
- J as TextField
117
+ D as TextField
141
118
  };
@@ -0,0 +1,2 @@
1
+ export { TextSpacing } from './text-spacing';
2
+ export type { TextSpacingProps } from './text-spacing';
@@ -0,0 +1,4 @@
1
+ import { TextSpacing as p } from "./text-spacing.js";
2
+ export {
3
+ p as TextSpacing
4
+ };
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+
3
+ /** -------------------------------------------------------------------------------------------------
4
+ * TextSpacing
5
+ * -----------------------------------------------------------------------------------------------*/
6
+ type TextSpacingProps = React.ComponentPropsWithoutRef<'div'> & {
7
+ asChild?: boolean;
8
+ };
9
+ /**
10
+ * TextSpacing is used to add spacing between text elements.
11
+ * Wrap the elements you want to add spacing in the TextSpacing component.
12
+ * The spacing will be applied to Teddy's Text and Heading components.
13
+ * https://www.figma.com/file/2QIcZVqP99ZKY4rNW7VuSx/Purpur-DS---Foundations-Library?type=design&node-id=9470-27984&mode=design&t=vJa9KJPym42lrLT9-4
14
+ */
15
+ declare const TextSpacing: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
16
+ asChild?: boolean | undefined;
17
+ } & React.RefAttributes<HTMLDivElement>>;
18
+ export { TextSpacing };
19
+ export type { TextSpacingProps };
@@ -0,0 +1,17 @@
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 = {
7
+ "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 });
12
+ }
13
+ );
14
+ x.displayName = "TextSpacing";
15
+ export {
16
+ x as TextSpacing
17
+ };
@@ -0,0 +1,2 @@
1
+ export { VisuallyHidden } from './visually-hidden';
2
+ export type { VisuallyHiddenProps } from './visually-hidden';
@@ -0,0 +1,4 @@
1
+ import { VisuallyHidden as i } from "./visually-hidden.js";
2
+ export {
3
+ i as VisuallyHidden
4
+ };
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+
3
+ type VisuallyHiddenProps = React.ComponentPropsWithoutRef<'span'> & {
4
+ visibleOnFocus?: boolean;
5
+ asChild?: boolean;
6
+ };
7
+ /**
8
+ * This component is used to hide content visually, but still accessible to screen readers
9
+ * */
10
+ declare const VisuallyHidden: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
11
+ visibleOnFocus?: boolean | undefined;
12
+ asChild?: boolean | undefined;
13
+ } & React.RefAttributes<HTMLSpanElement>>;
14
+ export { VisuallyHidden };
15
+ export type { VisuallyHiddenProps };
@@ -0,0 +1,24 @@
1
+ import '../../assets/visually-hidden.css';
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { c as n } from "../../clsx-DB4S2d7J.js";
4
+ import y from "react";
5
+ import { $ as u } from "../../index-DpfSJps6.js";
6
+ const e = {
7
+ "teddy-visually-hidden": "_teddy-visually-hidden_15nus_1",
8
+ "teddy-visually-hidden--focusable": "_teddy-visually-hidden--focusable_15nus_15"
9
+ }, d = "teddy-visually-hidden", f = y.forwardRef(
10
+ ({ className: a, visibleOnFocus: s, asChild: l, ...o }, t) => {
11
+ const c = l ? u : "span", i = n(
12
+ {
13
+ [e[`${d}`]]: !s,
14
+ [e[`${d}--focusable`]]: s
15
+ },
16
+ a
17
+ );
18
+ return /* @__PURE__ */ r(c, { ...o, ref: t, className: i });
19
+ }
20
+ );
21
+ f.displayName = "VisuallyHidden";
22
+ export {
23
+ f as VisuallyHidden
24
+ };