@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.
- package/dist/components/accordion/accordion.d.ts +2 -1
- package/dist/components/accordion/accordion.js +90 -24
- package/dist/components/accordion/index.js +2 -2
- package/dist/components/badge/badge.js +40 -24
- package/dist/components/badge/index.js +2 -2
- package/dist/components/box/box.js +14 -10
- package/dist/components/box/index.js +2 -2
- package/dist/components/button/button.js +60 -52
- package/dist/components/button/index.js +2 -2
- package/dist/components/card/card.d.ts +32 -10
- package/dist/components/card/card.js +202 -25
- package/dist/components/card/index.js +2 -2
- package/dist/components/field-error-text/field-error-text.js +21 -19
- package/dist/components/field-error-text/index.js +2 -2
- package/dist/components/flex/flex.js +15 -12
- package/dist/components/flex/index.js +2 -2
- package/dist/components/grid/grid.js +15 -12
- package/dist/components/grid/index.js +2 -2
- package/dist/components/heading/heading.js +22 -19
- package/dist/components/heading/index.js +2 -2
- package/dist/components/helper-text/helper-text.js +14 -13
- package/dist/components/helper-text/index.js +2 -2
- package/dist/components/icon/icon.js +16 -14
- package/dist/components/icon/index.js +4 -4
- package/dist/components/index.js +51 -46
- package/dist/components/input/index.js +3 -3
- package/dist/components/input/input.js +79 -66
- package/dist/components/label/index.js +2 -2
- package/dist/components/label/label.js +17 -23
- package/dist/components/link/index.js +2 -2
- package/dist/components/link/link.js +20 -19
- package/dist/components/modal/index.js +2 -2
- package/dist/components/modal/modal.js +173 -14
- package/dist/components/navigation-menu/index.js +2 -2
- package/dist/components/navigation-menu/navigation-menu.js +391 -8
- package/dist/components/notification/index.js +2 -2
- package/dist/components/notification/notification.d.ts +39 -7
- package/dist/components/notification/notification.js +96 -24
- package/dist/components/radio-group/index.js +2 -2
- package/dist/components/radio-group/radio-group.js +91 -8
- package/dist/components/spinner/index.js +2 -2
- package/dist/components/spinner/spinner.js +36 -29
- package/dist/components/text/index.js +2 -2
- package/dist/components/text/text.js +18 -17
- package/dist/components/text-field/index.js +2 -2
- package/dist/components/text-field/text-field.js +110 -90
- package/dist/components/text-spacing/index.js +2 -2
- package/dist/components/text-spacing/text-spacing.js +14 -12
- package/dist/components/toggle/index.js +2 -2
- package/dist/components/toggle/toggle.d.ts +1 -1
- package/dist/components/toggle/toggle.js +84 -23
- package/dist/components/visually-hidden/index.js +2 -2
- package/dist/components/visually-hidden/visually-hidden.js +17 -15
- package/dist/icons/category.js +2 -2
- package/dist/icons/name.js +2 -2
- package/dist/main.js +359 -61
- package/dist/style.css +3402 -0
- package/dist/tokens/border/variables.js +18 -10
- package/dist/tokens/breakpoint/variables.js +8 -5
- package/dist/tokens/color/variables.js +452 -227
- package/dist/tokens/index.d.ts +7 -7
- package/dist/tokens/index.js +308 -14
- package/dist/tokens/motion/variables.js +22 -12
- package/dist/tokens/shadow/variables.js +8 -5
- package/dist/tokens/spacing/variables.js +46 -24
- package/dist/tokens/typography/variables.js +48 -25
- package/dist/utils/action.js +10 -7
- package/dist/utils/composeEventHandlers.js +7 -5
- package/dist/utils/composeRefs.js +13 -9
- package/dist/utils/layout/align.js +5 -4
- package/dist/utils/layout/flex.js +25 -18
- package/dist/utils/layout/gap.js +7 -6
- package/dist/utils/layout/grid.js +31 -24
- package/dist/utils/layout/height.js +12 -11
- package/dist/utils/layout/index.js +76 -59
- package/dist/utils/layout/inset.js +10 -9
- package/dist/utils/layout/justify.js +6 -5
- package/dist/utils/layout/margin.js +10 -9
- package/dist/utils/layout/padding.js +10 -9
- package/dist/utils/layout/position.js +6 -5
- package/dist/utils/layout/util.js +7 -6
- package/dist/utils/layout/width.js +8 -7
- package/package.json +21 -14
- package/dist/assets/badge.css +0 -1
- package/dist/assets/button.css +0 -1
- package/dist/assets/field-error-text.css +0 -1
- package/dist/assets/flex.css +0 -1
- package/dist/assets/grid.css +0 -1
- package/dist/assets/heading.css +0 -1
- package/dist/assets/helper-text.css +0 -1
- package/dist/assets/icon.css +0 -1
- package/dist/assets/input.css +0 -1
- package/dist/assets/label.css +0 -1
- package/dist/assets/link.css +0 -1
- package/dist/assets/main.css +0 -1
- package/dist/assets/navigation-menu.css +0 -1
- package/dist/assets/radio-group.css +0 -1
- package/dist/assets/spinner.css +0 -1
- package/dist/assets/text-field.css +0 -1
- package/dist/assets/text-spacing.css +0 -1
- package/dist/assets/text.css +0 -1
- package/dist/assets/visually-hidden.css +0 -1
- package/dist/badge-C6I_qxYL.js +0 -1853
- package/dist/clsx-DB4S2d7J.js +0 -22
- package/dist/index-DM5e-Whg.js +0 -43
- package/dist/index-DpfSJps6.js +0 -75
- package/dist/index-FPIZOCcD.js +0 -305
- package/dist/navigation-menu-DKuyW8zE.js +0 -1036
- package/dist/radio-group-B--zT3OL.js +0 -440
- package/dist/variables-BKiPmtHY.js +0 -458
- package/dist/variables-BkY5b0io.js +0 -14
- package/dist/variables-Bq0YUbLS.js +0 -14
- package/dist/variables-CDK515QX.js +0 -52
- package/dist/variables-CMRTN8qo.js +0 -28
- package/dist/variables-Dmoh9YtD.js +0 -54
- package/dist/variables-IczXZ5CN.js +0 -24
|
@@ -1,10 +1,93 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
5
|
-
import "../label/label.js";
|
|
6
|
-
import "../../utils/composeRefs.js";
|
|
7
|
-
import "
|
|
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
|
-
|
|
92
|
+
RadioGroup
|
|
10
93
|
};
|
|
@@ -1,50 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const
|
|
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
|
|
13
|
-
rotate
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
56
|
+
Spinner
|
|
50
57
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
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
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
[
|
|
27
|
-
[
|
|
27
|
+
[styles[`${rootClassName}--hyphens`]]: enableHyphenation,
|
|
28
|
+
[styles[`${rootClassName}--disabled`]]: disabled
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
className
|
|
30
31
|
);
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsx(Slot, { ...props, ref: forwardRef, className: classes, children: asChild ? children : /* @__PURE__ */ jsx(Tag, { children }) });
|
|
32
33
|
}
|
|
33
34
|
);
|
|
34
|
-
|
|
35
|
+
Text.displayName = "Text";
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
Text
|
|
37
38
|
};
|
|
@@ -1,118 +1,138 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const
|
|
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
|
|
13
|
-
scaleInAnimation
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
22
|
-
id
|
|
23
|
-
errorId
|
|
24
|
-
setErrorId
|
|
25
|
-
helperTextId
|
|
26
|
-
setHelperTextId
|
|
27
|
-
disabled
|
|
28
|
-
readOnly
|
|
29
|
-
isValid
|
|
30
|
-
isLoading
|
|
31
|
-
isRequired
|
|
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
|
|
41
|
+
children
|
|
34
42
|
}
|
|
35
43
|
) });
|
|
36
44
|
}
|
|
37
45
|
);
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
var
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
...
|
|
46
|
-
"aria-describedby": [
|
|
47
|
-
disabled:
|
|
48
|
-
readOnly:
|
|
49
|
-
required:
|
|
50
|
-
isLoading:
|
|
51
|
-
validationState:
|
|
52
|
-
id
|
|
53
|
-
ref:
|
|
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
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
67
|
-
const
|
|
68
|
-
({ className
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
...
|
|
74
|
-
isRequired:
|
|
75
|
-
htmlFor:
|
|
76
|
-
disabled:
|
|
77
|
-
ref:
|
|
78
|
-
className:
|
|
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
|
-
|
|
84
|
-
const
|
|
85
|
-
({ className
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
93
|
-
const
|
|
94
|
-
({ className
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
100
|
-
|
|
101
|
-
}, [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
108
|
-
const
|
|
109
|
-
Input:
|
|
110
|
-
Label:
|
|
111
|
-
InputGroup:
|
|
112
|
-
HelperText:
|
|
113
|
-
ErrorList:
|
|
114
|
-
Indicator:
|
|
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
|
-
|
|
137
|
+
TextField
|
|
118
138
|
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
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
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
16
|
+
TextSpacing.displayName = "TextSpacing";
|
|
15
17
|
export {
|
|
16
|
-
|
|
18
|
+
TextSpacing
|
|
17
19
|
};
|