@telia/teddy 0.0.1
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/LICENSE +661 -0
- package/README.md +82 -0
- package/dist/assets/button.css +1 -0
- package/dist/assets/f2a2f391a886d395.svg +284 -0
- package/dist/assets/field-error-text.css +1 -0
- package/dist/assets/helper-text.css +1 -0
- package/dist/assets/icon.css +1 -0
- package/dist/assets/input.css +1 -0
- package/dist/assets/label.css +1 -0
- package/dist/assets/main.css +1 -0
- package/dist/assets/spinner.css +1 -0
- package/dist/assets/text-field.css +1 -0
- package/dist/assets/text.css +1 -0
- package/dist/clsx-DB4S2d7J.js +22 -0
- package/dist/components/button/button.d.ts +24 -0
- package/dist/components/button/button.js +95 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +4 -0
- package/dist/components/field-error-text/field-error-text.d.ts +8 -0
- package/dist/components/field-error-text/field-error-text.js +28 -0
- package/dist/components/field-error-text/index.d.ts +2 -0
- package/dist/components/field-error-text/index.js +4 -0
- package/dist/components/helper-text/helper-text.d.ts +5 -0
- package/dist/components/helper-text/helper-text.js +20 -0
- package/dist/components/helper-text/index.d.ts +2 -0
- package/dist/components/helper-text/index.js +4 -0
- package/dist/components/icon/icon.d.ts +10 -0
- package/dist/components/icon/icon.js +27 -0
- package/dist/components/icon/index.d.ts +4 -0
- package/dist/components/icon/index.js +6 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +23 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +5 -0
- package/dist/components/input/input.d.ts +53 -0
- package/dist/components/input/input.js +82 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/index.js +4 -0
- package/dist/components/label/label.d.ts +9 -0
- package/dist/components/label/label.js +61 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +4 -0
- package/dist/components/spinner/spinner.d.ts +26 -0
- package/dist/components/spinner/spinner.js +50 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/index.js +4 -0
- package/dist/components/text/text.d.ts +33 -0
- package/dist/components/text/text.js +51 -0
- package/dist/components/text-field/index.d.ts +2 -0
- package/dist/components/text-field/index.js +4 -0
- package/dist/components/text-field/text-field.d.ts +101 -0
- package/dist/components/text-field/text-field.js +141 -0
- package/dist/icons/name.d.js +1 -0
- package/dist/icons/name.d.ts +2 -0
- package/dist/icons/name.js +283 -0
- package/dist/index-TI1xsy6a.js +70 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +38 -0
- package/dist/teams/business/index.d.ts +0 -0
- package/dist/teams/business/index.js +1 -0
- package/dist/teams/index.d.ts +0 -0
- package/dist/teams/index.js +1 -0
- package/dist/teams/min-side/index.d.ts +0 -0
- package/dist/teams/min-side/index.js +1 -0
- package/dist/teams/webshop/index.d.ts +0 -0
- package/dist/teams/webshop/index.js +1 -0
- package/dist/tokens/border/variables.d.ts +9 -0
- package/dist/tokens/border/variables.js +12 -0
- package/dist/tokens/breakpoint/variables.d.ts +4 -0
- package/dist/tokens/breakpoint/variables.js +7 -0
- package/dist/tokens/color/variables.d.ts +226 -0
- package/dist/tokens/color/variables.js +229 -0
- package/dist/tokens/index.d.ts +7 -0
- package/dist/tokens/index.js +16 -0
- package/dist/tokens/motion/variables.d.ts +11 -0
- package/dist/tokens/motion/variables.js +14 -0
- package/dist/tokens/shadow/variables.d.ts +4 -0
- package/dist/tokens/shadow/variables.js +7 -0
- package/dist/tokens/spacing/variables.d.ts +23 -0
- package/dist/tokens/spacing/variables.js +26 -0
- package/dist/tokens/typography/variables.d.ts +24 -0
- package/dist/tokens/typography/variables.js +27 -0
- package/dist/utils/action.d.ts +36 -0
- package/dist/utils/action.js +18 -0
- package/dist/variables-BKiPmtHY.js +458 -0
- package/dist/variables-BkY5b0io.js +14 -0
- package/dist/variables-Bq0YUbLS.js +14 -0
- package/dist/variables-CDK515QX.js +52 -0
- package/dist/variables-CMRTN8qo.js +28 -0
- package/dist/variables-Dmoh9YtD.js +54 -0
- package/dist/variables-IczXZ5CN.js +24 -0
- package/dist/vite-env.d.js +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "../../assets/label.css";
|
|
2
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
3
|
+
import { _ as d, a as p } from "../../index-TI1xsy6a.js";
|
|
4
|
+
import u, { forwardRef as f, useEffect as $, createElement as i } from "react";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
import { c as _ } from "../../clsx-DB4S2d7J.js";
|
|
7
|
+
const x = [
|
|
8
|
+
"a",
|
|
9
|
+
"button",
|
|
10
|
+
"div",
|
|
11
|
+
"form",
|
|
12
|
+
"h2",
|
|
13
|
+
"h3",
|
|
14
|
+
"img",
|
|
15
|
+
"input",
|
|
16
|
+
"label",
|
|
17
|
+
"li",
|
|
18
|
+
"nav",
|
|
19
|
+
"ol",
|
|
20
|
+
"p",
|
|
21
|
+
"span",
|
|
22
|
+
"svg",
|
|
23
|
+
"ul"
|
|
24
|
+
], y = x.reduce((a, t) => {
|
|
25
|
+
const e = /* @__PURE__ */ f((o, r) => {
|
|
26
|
+
const { asChild: l, ...n } = o, m = l ? p : t;
|
|
27
|
+
return $(() => {
|
|
28
|
+
window[Symbol.for("radix-ui")] = !0;
|
|
29
|
+
}, []), /* @__PURE__ */ i(m, d({}, n, {
|
|
30
|
+
ref: r
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
return e.displayName = `Primitive.${t}`, {
|
|
34
|
+
...a,
|
|
35
|
+
[t]: e
|
|
36
|
+
};
|
|
37
|
+
}, {}), v = /* @__PURE__ */ f((a, t) => /* @__PURE__ */ i(y.label, d({}, a, {
|
|
38
|
+
ref: t,
|
|
39
|
+
onMouseDown: (e) => {
|
|
40
|
+
var o;
|
|
41
|
+
(o = a.onMouseDown) === null || o === void 0 || o.call(a, e), !e.defaultPrevented && e.detail > 1 && e.preventDefault();
|
|
42
|
+
}
|
|
43
|
+
}))), w = v, s = {
|
|
44
|
+
"teddy-label": "_teddy-label_rfe6h_1",
|
|
45
|
+
"teddy-label--disabled": "_teddy-label--disabled_rfe6h_8"
|
|
46
|
+
}, c = "teddy-label", h = u.forwardRef(
|
|
47
|
+
({ className: a, disabled: t, children: e, ...o }, r) => {
|
|
48
|
+
const l = _(
|
|
49
|
+
[s[c]],
|
|
50
|
+
{
|
|
51
|
+
[s[`${c}--disabled`]]: t
|
|
52
|
+
},
|
|
53
|
+
a
|
|
54
|
+
);
|
|
55
|
+
return /* @__PURE__ */ b(w, { ...o, ref: r, className: l, children: e });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
h.displayName = "Label";
|
|
59
|
+
export {
|
|
60
|
+
h as Label
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Spinner } from './spinner';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const SPINNER_VARIANT: {
|
|
3
|
+
readonly PRIMARY: "primary";
|
|
4
|
+
readonly DISABLED: "disabled";
|
|
5
|
+
readonly NEGATIVE: "negative";
|
|
6
|
+
readonly NEGATIVE_DISABLED: "negative-disabled";
|
|
7
|
+
};
|
|
8
|
+
type SpinnerVariant = (typeof SPINNER_VARIANT)[keyof typeof SPINNER_VARIANT];
|
|
9
|
+
declare const SPINNER_SIZE: {
|
|
10
|
+
readonly XXS: "xxs";
|
|
11
|
+
readonly XS: "xs";
|
|
12
|
+
readonly SM: "sm";
|
|
13
|
+
readonly MD: "md";
|
|
14
|
+
readonly LG: "lg";
|
|
15
|
+
};
|
|
16
|
+
type SpinnerSize = (typeof SPINNER_SIZE)[keyof typeof SPINNER_SIZE];
|
|
17
|
+
type SpinnerProps = React.ComponentPropsWithoutRef<'svg'> & {
|
|
18
|
+
size?: SpinnerSize;
|
|
19
|
+
variant?: SpinnerVariant;
|
|
20
|
+
};
|
|
21
|
+
declare const Spinner: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
22
|
+
size?: SpinnerSize | undefined;
|
|
23
|
+
variant?: SpinnerVariant | undefined;
|
|
24
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
25
|
+
export { Spinner };
|
|
26
|
+
export type { SpinnerProps, SpinnerSize, SpinnerVariant };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "../../assets/spinner.css";
|
|
2
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
3
|
+
import { c as s } from "../../clsx-DB4S2d7J.js";
|
|
4
|
+
import a from "react";
|
|
5
|
+
const l = "_dash_qjx6c_1", p = "_rotate_qjx6c_1", e = {
|
|
6
|
+
"teddy-spinner--xxs": "_teddy-spinner--xxs_qjx6c_1",
|
|
7
|
+
"teddy-spinner--xs": "_teddy-spinner--xs_qjx6c_5",
|
|
8
|
+
"teddy-spinner--sm": "_teddy-spinner--sm_qjx6c_9",
|
|
9
|
+
"teddy-spinner--md": "_teddy-spinner--md_qjx6c_13",
|
|
10
|
+
"teddy-spinner--lg": "_teddy-spinner--lg_qjx6c_17",
|
|
11
|
+
"teddy-spinner__circle": "_teddy-spinner__circle_qjx6c_21",
|
|
12
|
+
dash: l,
|
|
13
|
+
rotate: p,
|
|
14
|
+
"teddy-spinner__circle--disabled": "_teddy-spinner__circle--disabled_qjx6c_31",
|
|
15
|
+
"teddy-spinner__circle--negative": "_teddy-spinner__circle--negative_qjx6c_34",
|
|
16
|
+
"teddy-spinner__circle--negative-disabled": "_teddy-spinner__circle--negative-disabled_qjx6c_37"
|
|
17
|
+
}, d = "teddy-spinner", x = {
|
|
18
|
+
PRIMARY: "primary",
|
|
19
|
+
DISABLED: "disabled",
|
|
20
|
+
NEGATIVE: "negative",
|
|
21
|
+
NEGATIVE_DISABLED: "negative-disabled"
|
|
22
|
+
}, o = {
|
|
23
|
+
XXS: "xxs",
|
|
24
|
+
XS: "xs",
|
|
25
|
+
SM: "sm",
|
|
26
|
+
MD: "md",
|
|
27
|
+
LG: "lg"
|
|
28
|
+
}, g = a.forwardRef(
|
|
29
|
+
({ size: n = o.SM, variant: r = x.PRIMARY, className: i, ...c }, t) => /* @__PURE__ */ _(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
...c,
|
|
33
|
+
viewBox: "0 0 50 50",
|
|
34
|
+
className: s([e[d], e[`${d}--${n}`], i]),
|
|
35
|
+
ref: t,
|
|
36
|
+
children: /* @__PURE__ */ _(
|
|
37
|
+
"circle",
|
|
38
|
+
{
|
|
39
|
+
className: s(e[`${d}__circle`], e[`${d}__circle--${r}`]),
|
|
40
|
+
cx: "25",
|
|
41
|
+
cy: "25",
|
|
42
|
+
r: "20"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
export {
|
|
49
|
+
g as Spinner
|
|
50
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const paragraphVariants: readonly ["paragraph-100", "paragraph-100-medium", "paragraph-100-bold", "paragraph-200", "preamble-100", "preamble-200", "additional-100", "additional-100-medium", "overline-100", "overline-200"];
|
|
3
|
+
type AsChildProps = {
|
|
4
|
+
asChild: true;
|
|
5
|
+
as?: never;
|
|
6
|
+
} & React.ComponentPropsWithoutRef<'p'>;
|
|
7
|
+
type SpanProps = {
|
|
8
|
+
as?: 'span';
|
|
9
|
+
asChild?: false;
|
|
10
|
+
} & React.ComponentPropsWithoutRef<'span'>;
|
|
11
|
+
type DivProps = {
|
|
12
|
+
as: 'div';
|
|
13
|
+
asChild?: false;
|
|
14
|
+
} & React.ComponentPropsWithoutRef<'div'>;
|
|
15
|
+
type LabelProps = {
|
|
16
|
+
as: 'label';
|
|
17
|
+
asChild?: false;
|
|
18
|
+
} & React.ComponentPropsWithoutRef<'label'>;
|
|
19
|
+
type PProps = {
|
|
20
|
+
as: 'p';
|
|
21
|
+
asChild?: false;
|
|
22
|
+
} & React.ComponentPropsWithoutRef<'p'>;
|
|
23
|
+
type TextVariant = (typeof paragraphVariants)[number];
|
|
24
|
+
type TextProps = {
|
|
25
|
+
enableHyphenation?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
variant?: 'paragraph-100' | 'paragraph-100-medium' | 'paragraph-100-bold' | 'paragraph-200' | 'preamble-100' | 'preamble-200' | 'additional-100' | 'additional-100-medium' | 'overline-100' | 'overline-200';
|
|
28
|
+
} & (AsChildProps | SpanProps | DivProps | LabelProps | PProps);
|
|
29
|
+
declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLParagraphElement>> & {
|
|
30
|
+
paragraphVariants: readonly ["paragraph-100", "paragraph-100-medium", "paragraph-100-bold", "paragraph-200", "preamble-100", "preamble-200", "additional-100", "additional-100-medium", "overline-100", "overline-200"];
|
|
31
|
+
};
|
|
32
|
+
export { Text };
|
|
33
|
+
export type { TextProps, TextVariant };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "../../assets/text.css";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { a as b } from "../../index-TI1xsy6a.js";
|
|
4
|
+
import { c as n } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
import f from "react";
|
|
6
|
+
const e = {
|
|
7
|
+
"teddy-text": "_teddy-text_ebzsf_1",
|
|
8
|
+
"teddy-text--disabled": "_teddy-text--disabled_ebzsf_7",
|
|
9
|
+
"teddy-text--hyphens": "_teddy-text--hyphens_ebzsf_10",
|
|
10
|
+
"teddy-text--paragraph-100": "_teddy-text--paragraph-100_ebzsf_13",
|
|
11
|
+
"teddy-text--paragraph-100-medium": "_teddy-text--paragraph-100-medium_ebzsf_19",
|
|
12
|
+
"teddy-text--paragraph-100-bold": "_teddy-text--paragraph-100-bold_ebzsf_26",
|
|
13
|
+
"teddy-text--paragraph-200": "_teddy-text--paragraph-200_ebzsf_33",
|
|
14
|
+
"teddy-text--preamble-100": "_teddy-text--preamble-100_ebzsf_39",
|
|
15
|
+
"teddy-text--preamble-200": "_teddy-text--preamble-200_ebzsf_45",
|
|
16
|
+
"teddy-text--additional-100": "_teddy-text--additional-100_ebzsf_51",
|
|
17
|
+
"teddy-text--additional-100-medium": "_teddy-text--additional-100-medium_ebzsf_57",
|
|
18
|
+
"teddy-text--overline-100": "_teddy-text--overline-100_ebzsf_64",
|
|
19
|
+
"teddy-text--overline-200": "_teddy-text--overline-200_ebzsf_71"
|
|
20
|
+
}, t = "teddy-text", h = [
|
|
21
|
+
"paragraph-100",
|
|
22
|
+
"paragraph-100-medium",
|
|
23
|
+
"paragraph-100-bold",
|
|
24
|
+
"paragraph-200",
|
|
25
|
+
"preamble-100",
|
|
26
|
+
"preamble-200",
|
|
27
|
+
"additional-100",
|
|
28
|
+
"additional-100-medium",
|
|
29
|
+
"overline-100",
|
|
30
|
+
"overline-200"
|
|
31
|
+
], r = f.forwardRef(
|
|
32
|
+
({ className: p, children: d, disabled: s, enableHyphenation: _, variant: o = "paragraph-100", asChild: i, as: x = "p", ...y }, l) => {
|
|
33
|
+
const m = n(
|
|
34
|
+
e[t],
|
|
35
|
+
e[`${t}--${o}`],
|
|
36
|
+
{
|
|
37
|
+
[e[`${t}--hyphens`]]: _,
|
|
38
|
+
[e[`${t}--disabled`]]: s
|
|
39
|
+
},
|
|
40
|
+
p
|
|
41
|
+
);
|
|
42
|
+
return /* @__PURE__ */ a(b, { ...y, ref: l, className: m, children: i ? d : /* @__PURE__ */ a(x, { children: d }) });
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
r.displayName = "Text";
|
|
46
|
+
const v = Object.assign(r, {
|
|
47
|
+
paragraphVariants: h
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
v as Text
|
|
51
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HelperTextProps } from '../helper-text';
|
|
3
|
+
import { LabelProps } from '../label';
|
|
4
|
+
type ListOfErrors = Array<string | null | undefined> | null | undefined;
|
|
5
|
+
type TextFieldContextValue = {
|
|
6
|
+
id: string;
|
|
7
|
+
errorId?: string;
|
|
8
|
+
helperTextId?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
errors?: ListOfErrors;
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
isValid?: boolean;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
isRequired?: boolean;
|
|
15
|
+
};
|
|
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'> & {
|
|
22
|
+
/**
|
|
23
|
+
* Whether the input is disabled.
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* List of errors
|
|
29
|
+
*/
|
|
30
|
+
errors?: ListOfErrors;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the input is invalid.
|
|
33
|
+
*/
|
|
34
|
+
isValid?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the input is loading.
|
|
37
|
+
*/
|
|
38
|
+
isLoading?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the input is required.
|
|
41
|
+
*/
|
|
42
|
+
isRequired?: boolean;
|
|
43
|
+
} & RootInputProps<T>;
|
|
44
|
+
type TextFieldInputProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'id' | 'disabled' | 'readOnly' | 'required'> & {};
|
|
45
|
+
type TextFieldDecoratorProps = React.ComponentPropsWithoutRef<'div'> & {};
|
|
46
|
+
type TextFieldLabelProps = LabelProps;
|
|
47
|
+
type TextFieldHelperTextProps = HelperTextProps & {};
|
|
48
|
+
type TextFieldErrorList = Omit<React.ComponentPropsWithoutRef<'ul'>, 'children'> & {
|
|
49
|
+
children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
|
|
50
|
+
};
|
|
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);
|
|
53
|
+
} & React.RefAttributes<HTMLUListElement>>;
|
|
54
|
+
type TextFieldIndicatorProps = React.ComponentPropsWithoutRef<'svg'>;
|
|
55
|
+
export declare const TextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
56
|
+
/**
|
|
57
|
+
* Whether the input is disabled.
|
|
58
|
+
*/
|
|
59
|
+
disabled?: boolean | undefined;
|
|
60
|
+
readOnly?: boolean | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* List of errors
|
|
63
|
+
*/
|
|
64
|
+
errors?: ListOfErrors;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the input is invalid.
|
|
67
|
+
*/
|
|
68
|
+
isValid?: boolean | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the input is loading.
|
|
71
|
+
*/
|
|
72
|
+
isLoading?: boolean | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the input is required.
|
|
75
|
+
*/
|
|
76
|
+
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
|
+
} & 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"> & {
|
|
83
|
+
disabled?: boolean | undefined;
|
|
84
|
+
} & React.RefAttributes<HTMLLabelElement>>;
|
|
85
|
+
Decorator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
86
|
+
HelperText: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
87
|
+
ErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
|
|
88
|
+
children?: React.ReactNode | ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode);
|
|
89
|
+
} & React.RefAttributes<HTMLUListElement>>;
|
|
90
|
+
Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
91
|
+
};
|
|
92
|
+
export type TextFieldProps<T extends Input['value']> = {
|
|
93
|
+
Root: TextFieldRootProps<T>;
|
|
94
|
+
Input: TextFieldInputProps;
|
|
95
|
+
Label: TextFieldLabelProps;
|
|
96
|
+
Decorator: TextFieldDecoratorProps;
|
|
97
|
+
HelperText: TextFieldHelperTextProps;
|
|
98
|
+
ErrorList: TextFieldErrorList;
|
|
99
|
+
Indicator: TextFieldIndicatorProps;
|
|
100
|
+
};
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
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,
|
|
28
|
+
{
|
|
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,
|
|
51
|
+
disabled: e == null ? void 0 : e.disabled,
|
|
52
|
+
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 }) });
|
|
56
|
+
}
|
|
57
|
+
);
|
|
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`]],
|
|
79
|
+
{
|
|
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
|
|
86
|
+
);
|
|
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
|
+
}
|
|
106
|
+
);
|
|
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))) });
|
|
116
|
+
}
|
|
117
|
+
);
|
|
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 });
|
|
128
|
+
}
|
|
129
|
+
);
|
|
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
|
|
138
|
+
});
|
|
139
|
+
export {
|
|
140
|
+
J as TextField
|
|
141
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const iconNames: readonly ["activity-level", "add", "address-book", "ai-robot", "airplay", "alert-filled", "alert", "arrow-down", "arrow-left", "arrow-right", "arrow-subdirectory", "arrow-up", "attachment", "b2b-customer", "bag", "bar-chart", "basketball", "battery", "blood-pressure", "bluetooth", "broadband", "broken-phone", "bulb", "business-continuity", "business-intelligence", "calendar", "camera", "card-view", "care", "cast", "chat-robot", "chat", "check-circle-filled", "check-circle", "checkmark", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "child-2", "close-circle", "close", "cloud-connect", "cloud", "coffee", "compass", "connected-building", "connected", "construction", "conversation", "core-router", "credit-card", "customer-dialogue", "daas-device", "data-transfer", "delivery", "desktop", "devices", "dislike", "doc", "document-doc", "document-edit", "document-pdf", "document-ppt", "download", "drone", "dsl-hub", "edit", "education", "efficiency", "end-user", "entertainment", "environment", "error-filled", "error", "esim-simcard", "esim", "euro", "excel", "external", "face-id", "facemask", "fiber", "film", "filter", "fingerprint", "fiveg", "flag", "focus", "folder-copy", "folder-new", "folder", "food", "fourg", "fraud", "games", "getting-started", "GIF", "graph", "grid-view", "handshake", "headphones", "help", "home-care", "home-installation", "home", "hospital", "image", "industrial-iot", "industry", "infinite", "info-filled", "info", "internet", "invoice", "job-search", "key", "kontantkort", "laptop", "late-payment", "layers", "letter", "like", "link", "list-view", "lock-open", "lock", "login", "logout", "map", "measuring-health", "media-content", "megaphone", "menu", "microphone", "minus", "mms", "mobile-broadband", "moisture", "money-back", "money-krone", "money", "more-horizontal", "more-vertical", "music", "network", "new-contact", "new-group", "news", "offering", "offshore", "optimization", "org-chart", "pay-monthly", "pay-once", "payment-success", "people", "pet-dog", "phone-recycling", "phone-ringing", "phone", "pie-chart", "pin", "plane", "player-settings", "plus-minus", "plus", "police", "power-grid", "premises-datacenter", "premises-large", "premises-medium", "premises-small", "premises", "present", "press-button", "price", "print", "pulse", "question-filled", "question", "rack", "radio", "record", "recycle", "refill-card", "register", "remote-control", "repair", "report", "reservation", "reverse", "roaming", "route", "router", "ruler", "satellite", "save", "savings", "search", "secure-device", "secured-1", "secured-2", "security-camera", "send", "sense-car", "server", "service-device", "service-supervision", "services", "settings", "share", "shopping", "shuffle", "signature", "simcard", "skip-back-10sec", "skip-back-30sec", "skip-forward-10sec", "skip-forward-30sec", "slow-wifi", "smart-wifi", "smartphone", "smartwatch", "smiley-happy", "sms", "snowflake", "sorter", "speedometer", "spell-check", "split", "spyware", "stop", "store", "stream", "suitcase", "summary", "support", "sustainability", "switch", "sync", "table-view", "tablet", "tag", "temperature", "thinking", "time", "trade-phone", "trailer", "train", "transfer", "tv-next", "tv-pause", "tv-previous", "tv-stop", "tv", "undo", "upload", "usb", "user-admin", "vcard", "video-conference", "video", "voice-switch", "voicemail", "wallet", "wallplug", "warning", "wavelength", "weather", "wireless-off", "wireless", "world-alert", "world-off", "world-question", "world", "zoom-out", "zoom"];
|
|
2
|
+
export type IconName = (typeof iconNames)[number];
|