@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.
- package/README.md +8 -10
- package/dist/assets/5161b177f001ea1a.svg +1080 -0
- package/dist/assets/badge.css +1 -0
- package/dist/assets/button.css +1 -1
- package/dist/assets/grid.css +1 -0
- package/dist/assets/heading.css +1 -0
- package/dist/assets/icon.css +1 -1
- package/dist/assets/input.css +1 -1
- package/dist/assets/label.css +1 -1
- package/dist/assets/link.css +1 -0
- package/dist/assets/main.css +1 -1
- package/dist/assets/navigation-menu.css +1 -0
- package/dist/assets/text-field.css +1 -1
- package/dist/assets/text-spacing.css +1 -0
- package/dist/assets/text.css +1 -1
- package/dist/assets/visually-hidden.css +1 -0
- package/dist/badge-CbHdlkcM.js +742 -0
- package/dist/components/accordion/accordion.d.ts +59 -0
- package/dist/components/accordion/accordion.js +24 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/badge/badge.d.ts +21 -0
- package/dist/components/badge/badge.js +24 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +4 -0
- package/dist/components/button/button.d.ts +19 -20
- package/dist/components/button/button.js +82 -71
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/card/card.d.ts +68 -0
- package/dist/components/card/card.js +24 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +4 -0
- package/dist/components/field-error-text/field-error-text.d.ts +4 -3
- package/dist/components/field-error-text/field-error-text.js +12 -12
- package/dist/components/grid/grid.d.ts +23 -0
- package/dist/components/grid/grid.js +18 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/grid/index.js +4 -0
- package/dist/components/heading/heading.d.ts +63 -0
- package/dist/components/heading/heading.js +53 -0
- package/dist/components/heading/index.d.ts +2 -0
- package/dist/components/heading/index.js +4 -0
- package/dist/components/helper-text/helper-text.d.ts +2 -1
- package/dist/components/helper-text/helper-text.js +7 -7
- package/dist/components/icon/icon.d.ts +13 -2
- package/dist/components/icon/icon.js +22 -22
- package/dist/components/icon/index.d.ts +2 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +38 -21
- package/dist/components/input/input.d.ts +14 -23
- package/dist/components/input/input.js +72 -50
- package/dist/components/label/label.d.ts +3 -1
- package/dist/components/label/label.js +23 -51
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/link/index.js +4 -0
- package/dist/components/link/link.d.ts +49 -0
- package/dist/components/link/link.js +36 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +4 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +126 -0
- package/dist/components/navigation-menu/navigation-menu.js +10 -0
- package/dist/components/spinner/spinner.d.ts +2 -1
- package/dist/components/spinner/spinner.js +5 -5
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +4 -0
- package/dist/components/switch/switch.d.ts +44 -0
- package/dist/components/switch/switch.js +23 -0
- package/dist/components/text/text.d.ts +15 -8
- package/dist/components/text/text.js +27 -41
- package/dist/components/text-field/text-field.d.ts +24 -24
- package/dist/components/text-field/text-field.js +102 -125
- package/dist/components/text-spacing/index.d.ts +2 -0
- package/dist/components/text-spacing/index.js +4 -0
- package/dist/components/text-spacing/text-spacing.d.ts +19 -0
- package/dist/components/text-spacing/text-spacing.js +17 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +4 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +15 -0
- package/dist/components/visually-hidden/visually-hidden.js +24 -0
- package/dist/icons/category.d.ts +985 -0
- package/dist/icons/category.js +333 -0
- package/dist/icons/name.d.ts +1 -1
- package/dist/icons/name.js +250 -200
- package/dist/index-DM5e-Whg.js +43 -0
- package/dist/index-DpfSJps6.js +75 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +53 -36
- package/dist/navigation-menu-BgN7IKev.js +1334 -0
- package/dist/tokens/spacing/variables.json.d.ts +34 -0
- package/dist/utils/action.d.ts +2 -2
- package/dist/utils/composeEventHandlers.d.ts +30 -0
- package/dist/utils/composeEventHandlers.js +9 -0
- package/dist/utils/composeRefs.d.ts +40 -0
- package/dist/utils/composeRefs.js +14 -0
- package/dist/utils/layout.d.ts +60 -0
- package/dist/utils/layout.js +100 -0
- package/package.json +25 -24
- package/dist/assets/f2a2f391a886d395.svg +0 -284
- package/dist/index-TI1xsy6a.js +0 -70
- package/dist/teams/index.d.ts +0 -0
- package/dist/teams/index.js +0 -1
- package/dist/teams/min-side/index.d.ts +0 -0
- package/dist/teams/min-side/index.js +0 -1
- package/dist/teams/webshop/index.d.ts +0 -0
- package/dist/teams/webshop/index.js +0 -1
- /package/dist/{teams/business/index.d.ts → components/text-field/tex-field-label.d.ts} +0 -0
- /package/dist/{teams/business/index.js → components/text-field/tex-field-label.js} +0 -0
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
-
}
|
|
44
|
-
type TextFieldInputProps = Omit<
|
|
45
|
-
type
|
|
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?:
|
|
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<
|
|
82
|
-
Label: React.ForwardRefExoticComponent<Omit<import(
|
|
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
|
-
|
|
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?:
|
|
85
|
+
children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
|
|
89
86
|
} & React.RefAttributes<HTMLUListElement>>;
|
|
90
|
-
Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> &
|
|
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
|
|
93
|
-
Root: TextFieldRootProps
|
|
92
|
+
export type TextFieldProps = {
|
|
93
|
+
Root: TextFieldRootProps;
|
|
94
94
|
Input: TextFieldInputProps;
|
|
95
95
|
Label: TextFieldLabelProps;
|
|
96
|
-
|
|
96
|
+
Group: TextFieldInputGroupProps;
|
|
97
97
|
HelperText: TextFieldHelperTextProps;
|
|
98
98
|
ErrorList: TextFieldErrorList;
|
|
99
99
|
Indicator: TextFieldIndicatorProps;
|
|
@@ -1,141 +1,118 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c } from "../../clsx-DB4S2d7J.js";
|
|
4
|
-
import
|
|
5
|
-
import { FieldErrorText as
|
|
6
|
-
import { HelperText as
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
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
|
-
|
|
108
|
-
const
|
|
109
|
-
({ className:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
119
|
-
const
|
|
120
|
-
({ className:
|
|
121
|
-
const t =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
131
|
-
const
|
|
132
|
-
Input:
|
|
133
|
-
Label:
|
|
134
|
-
|
|
135
|
-
HelperText:
|
|
136
|
-
ErrorList:
|
|
137
|
-
Indicator:
|
|
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
|
-
|
|
117
|
+
D as TextField
|
|
141
118
|
};
|
|
@@ -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,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
|
+
};
|