@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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
/** -------------------------------------------------------------------------------------------------
|
|
4
|
+
* Heading
|
|
5
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
6
|
+
declare const headingVariants: readonly ["title-100", "title-200", "title-300", "title-400", "title-500", "title-600", "title-700", "subsection-100", "display-25", "display-50", "display-100", "display-200"];
|
|
7
|
+
type AsChildProps = {
|
|
8
|
+
/**
|
|
9
|
+
* If `true`, the children element will be cloned and used instead of the heading element.
|
|
10
|
+
*/
|
|
11
|
+
asChild: true;
|
|
12
|
+
as?: never;
|
|
13
|
+
} & React.ComponentPropsWithoutRef<'h1'>;
|
|
14
|
+
type H1Props = {
|
|
15
|
+
as: 'h1';
|
|
16
|
+
asChild?: false;
|
|
17
|
+
} & React.ComponentPropsWithoutRef<'h1'>;
|
|
18
|
+
type H2Props = {
|
|
19
|
+
as: 'h2';
|
|
20
|
+
asChild?: false;
|
|
21
|
+
} & React.ComponentPropsWithoutRef<'h2'>;
|
|
22
|
+
type H3Props = {
|
|
23
|
+
as: 'h3';
|
|
24
|
+
asChild?: false;
|
|
25
|
+
} & React.ComponentPropsWithoutRef<'h3'>;
|
|
26
|
+
type H4Props = {
|
|
27
|
+
as: 'h4';
|
|
28
|
+
asChild?: false;
|
|
29
|
+
} & React.ComponentPropsWithoutRef<'h4'>;
|
|
30
|
+
type H5Props = {
|
|
31
|
+
as: 'h5';
|
|
32
|
+
asChild?: false;
|
|
33
|
+
} & React.ComponentPropsWithoutRef<'h5'>;
|
|
34
|
+
type H6Props = {
|
|
35
|
+
as: 'h6';
|
|
36
|
+
asChild?: false;
|
|
37
|
+
} & React.ComponentPropsWithoutRef<'h6'>;
|
|
38
|
+
type HeadingVariant = (typeof headingVariants)[number];
|
|
39
|
+
type RootProps = {
|
|
40
|
+
/**
|
|
41
|
+
* EnableHyphenation
|
|
42
|
+
* The hyphens CSS property specifies how words should be hyphenated when text wraps across multiple lines.
|
|
43
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens
|
|
44
|
+
*/
|
|
45
|
+
enableHyphenation?: boolean;
|
|
46
|
+
variant: HeadingVariant;
|
|
47
|
+
} & (AsChildProps | H1Props | H2Props | H3Props | H4Props | H5Props | H6Props);
|
|
48
|
+
declare const Heading: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLHeadingElement>> & {
|
|
49
|
+
headingVariants: readonly ["title-100", "title-200", "title-300", "title-400", "title-500", "title-600", "title-700", "subsection-100", "display-25", "display-50", "display-100", "display-200"];
|
|
50
|
+
};
|
|
51
|
+
type HeadingProps = {
|
|
52
|
+
Root: RootProps;
|
|
53
|
+
headingVariants: typeof headingVariants;
|
|
54
|
+
AsChildProps: AsChildProps;
|
|
55
|
+
H1Props: H1Props;
|
|
56
|
+
H2Props: H2Props;
|
|
57
|
+
H3Props: H3Props;
|
|
58
|
+
H4Props: H4Props;
|
|
59
|
+
H5Props: H5Props;
|
|
60
|
+
H6Props: H6Props;
|
|
61
|
+
};
|
|
62
|
+
export { Heading };
|
|
63
|
+
export type { HeadingProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import '../../assets/heading.css';
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { $ as q } from "../../index-DpfSJps6.js";
|
|
4
|
+
import { c as o } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
import p from "react";
|
|
6
|
+
const d = {
|
|
7
|
+
"teddy-heading": "_teddy-heading_1qjqc_2",
|
|
8
|
+
"teddy-heading--hyphens": "_teddy-heading--hyphens_1qjqc_9",
|
|
9
|
+
"teddy-heading--subsection-100": "_teddy-heading--subsection-100_1qjqc_12",
|
|
10
|
+
"teddy-heading--title-100": "_teddy-heading--title-100_1qjqc_18",
|
|
11
|
+
"teddy-heading--title-200": "_teddy-heading--title-200_1qjqc_24",
|
|
12
|
+
"teddy-heading--title-300": "_teddy-heading--title-300_1qjqc_30",
|
|
13
|
+
"teddy-heading--title-400": "_teddy-heading--title-400_1qjqc_36",
|
|
14
|
+
"teddy-heading--title-500": "_teddy-heading--title-500_1qjqc_42",
|
|
15
|
+
"teddy-heading--title-600": "_teddy-heading--title-600_1qjqc_48",
|
|
16
|
+
"teddy-heading--title-700": "_teddy-heading--title-700_1qjqc_54",
|
|
17
|
+
"teddy-heading--display-25": "_teddy-heading--display-25_1qjqc_60",
|
|
18
|
+
"teddy-heading--display-50": "_teddy-heading--display-50_1qjqc_66",
|
|
19
|
+
"teddy-heading--display-100": "_teddy-heading--display-100_1qjqc_72",
|
|
20
|
+
"teddy-heading--display-200": "_teddy-heading--display-200_1qjqc_78"
|
|
21
|
+
}, e = "teddy-heading", j = [
|
|
22
|
+
"title-100",
|
|
23
|
+
"title-200",
|
|
24
|
+
"title-300",
|
|
25
|
+
"title-400",
|
|
26
|
+
"title-500",
|
|
27
|
+
"title-600",
|
|
28
|
+
"title-700",
|
|
29
|
+
"subsection-100",
|
|
30
|
+
"display-25",
|
|
31
|
+
"display-50",
|
|
32
|
+
"display-100",
|
|
33
|
+
"display-200"
|
|
34
|
+
], y = p.forwardRef(
|
|
35
|
+
({ className: s, children: t, variant: i, asChild: _, enableHyphenation: l, as: a, ...h }, c) => {
|
|
36
|
+
const g = o(
|
|
37
|
+
d[`${e}`],
|
|
38
|
+
{
|
|
39
|
+
[d[`${e}--${i}`]]: i,
|
|
40
|
+
[d[`${e}--hyphens`]]: l
|
|
41
|
+
},
|
|
42
|
+
s
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ n(q, { ...h, ref: c, className: g, children: _ ? t : a ? /* @__PURE__ */ n(a, { children: t }) : null });
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
y.displayName = "Heading";
|
|
48
|
+
const u = Object.assign(y, {
|
|
49
|
+
headingVariants: j
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
u as Heading
|
|
53
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
2
3
|
type HelperTextProps = React.ComponentPropsWithoutRef<'span'>;
|
|
3
4
|
declare const HelperText: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
5
|
export { HelperText };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../assets/helper-text.css';
|
|
2
2
|
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
3
|
+
import { c as a } from "../../clsx-DB4S2d7J.js";
|
|
4
|
+
import o from "react";
|
|
5
5
|
const p = {
|
|
6
6
|
"teddy-helper-text": "_teddy-helper-text_6xdzb_1",
|
|
7
7
|
"teddy-helper-text--disabled": "_teddy-helper-text--disabled_6xdzb_9"
|
|
8
|
-
}, x = "teddy-helper-text",
|
|
8
|
+
}, x = "teddy-helper-text", c = o.forwardRef(
|
|
9
9
|
({ className: e, children: t, ...r }, s) => {
|
|
10
|
-
const d =
|
|
10
|
+
const d = a(
|
|
11
11
|
[p[x]],
|
|
12
12
|
e
|
|
13
13
|
);
|
|
14
14
|
return /* @__PURE__ */ l("span", { ...r, ref: s, className: d, children: t });
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
|
-
|
|
17
|
+
c.displayName = "HelperText";
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
c as HelperText
|
|
20
20
|
};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { IconName } from '../../icons/name';
|
|
2
|
+
|
|
3
3
|
export { IconName };
|
|
4
4
|
type Size = 'font' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
5
|
export type IconProps = React.SVGProps<SVGSVGElement> & {
|
|
6
6
|
name: IconName;
|
|
7
|
+
/**
|
|
8
|
+
* Size of the icon
|
|
9
|
+
* @default 'font'
|
|
10
|
+
* @property font => 1em
|
|
11
|
+
* @property xxs => 12px (0.75rem)
|
|
12
|
+
* @property xs => 16px (1rem)
|
|
13
|
+
* @property sm => 20px (1.25rem)
|
|
14
|
+
* @property md => 24px (1.5rem)
|
|
15
|
+
* @property lg => 32px (2rem)
|
|
16
|
+
* @property xl => 48px (3rem)
|
|
17
|
+
*/
|
|
7
18
|
size?: Size;
|
|
8
19
|
children?: React.ReactNode;
|
|
9
20
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
6
|
-
"teddy-icon": "_teddy-
|
|
7
|
-
"teddy-icon--font": "_teddy-icon--
|
|
8
|
-
"teddy-icon--xxs": "_teddy-icon--
|
|
9
|
-
"teddy-icon--xs": "_teddy-icon--
|
|
10
|
-
"teddy-icon--sm": "_teddy-icon--
|
|
11
|
-
"teddy-icon--md": "_teddy-icon--
|
|
12
|
-
"teddy-icon--lg": "_teddy-icon--
|
|
13
|
-
"teddy-icon--xl": "_teddy-icon--
|
|
14
|
-
"teddy-icon-with-children": "_teddy-icon-with-
|
|
15
|
-
},
|
|
16
|
-
function g({ name: n, size: c = "font", className:
|
|
17
|
-
if (
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
|
|
1
|
+
import '../../assets/icon.css';
|
|
2
|
+
import { jsxs as y, jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import f from "../../assets/5161b177f001ea1a.svg";
|
|
4
|
+
import { c as s } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
const t = {
|
|
6
|
+
"teddy-icon": "_teddy-icon_1rwgf_2",
|
|
7
|
+
"teddy-icon--font": "_teddy-icon--font_1rwgf_7",
|
|
8
|
+
"teddy-icon--xxs": "_teddy-icon--xxs_1rwgf_11",
|
|
9
|
+
"teddy-icon--xs": "_teddy-icon--xs_1rwgf_15",
|
|
10
|
+
"teddy-icon--sm": "_teddy-icon--sm_1rwgf_19",
|
|
11
|
+
"teddy-icon--md": "_teddy-icon--md_1rwgf_23",
|
|
12
|
+
"teddy-icon--lg": "_teddy-icon--lg_1rwgf_27",
|
|
13
|
+
"teddy-icon--xl": "_teddy-icon--xl_1rwgf_31",
|
|
14
|
+
"teddy-icon-with-children": "_teddy-icon-with-children_1rwgf_35"
|
|
15
|
+
}, o = "teddy-icon", l = `${o}-with-children`;
|
|
16
|
+
function g({ name: n, size: c = "font", className: e, children: i, ...r }) {
|
|
17
|
+
if (i)
|
|
18
|
+
return /* @__PURE__ */ y("span", { className: s([t[l]]), children: [
|
|
19
|
+
/* @__PURE__ */ d(g, { name: n, size: c, className: e, ...r }),
|
|
20
|
+
i
|
|
21
21
|
] });
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
const _ = s([t[o], t[`${o}--${c}`]], e);
|
|
23
|
+
return /* @__PURE__ */ d("svg", { ...r, className: _, children: /* @__PURE__ */ d("use", { href: `${f}#${n}` }) });
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
26
26
|
g as Icon
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export * from './card';
|
|
2
|
+
export * from './grid';
|
|
3
|
+
export * from './navigation-menu';
|
|
4
|
+
export * from './switch';
|
|
5
|
+
export * from './accordion';
|
|
6
|
+
export * from './link';
|
|
7
|
+
export * from './badge';
|
|
1
8
|
export * from './button';
|
|
2
9
|
export * from './field-error-text';
|
|
3
10
|
export * from './helper-text';
|
|
@@ -7,3 +14,6 @@ export * from './label';
|
|
|
7
14
|
export * from './spinner';
|
|
8
15
|
export * from './text';
|
|
9
16
|
export * from './text-field';
|
|
17
|
+
export * from './heading';
|
|
18
|
+
export * from './visually-hidden';
|
|
19
|
+
export * from './text-spacing';
|
package/dist/components/index.js
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { A as e, B as t, C as p, S as x } from "../badge-CbHdlkcM.js";
|
|
2
|
+
import { Grid as m } from "./grid/grid.js";
|
|
3
|
+
import { N as i } from "../navigation-menu-BgN7IKev.js";
|
|
4
|
+
import { Link as d } from "./link/link.js";
|
|
5
|
+
import { Button as l } from "./button/button.js";
|
|
6
|
+
import { FieldErrorText as c } from "./field-error-text/field-error-text.js";
|
|
7
|
+
import { HelperText as g } from "./helper-text/helper-text.js";
|
|
8
|
+
import { default as S } from "../assets/5161b177f001ea1a.svg";
|
|
9
|
+
import { Icon as I } from "./icon/icon.js";
|
|
10
|
+
import { Input as C, InputGroup as F } from "./input/input.js";
|
|
11
|
+
import { Label as L } from "./label/label.js";
|
|
12
|
+
import { Spinner as b } from "./spinner/spinner.js";
|
|
13
|
+
import { Text as k } from "./text/text.js";
|
|
14
|
+
import { TextField as w } from "./text-field/text-field.js";
|
|
15
|
+
import { Heading as E } from "./heading/heading.js";
|
|
16
|
+
import { VisuallyHidden as V } from "./visually-hidden/visually-hidden.js";
|
|
17
|
+
import { TextSpacing as q } from "./text-spacing/text-spacing.js";
|
|
11
18
|
export {
|
|
12
|
-
e as
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
e as Accordion,
|
|
20
|
+
t as Badge,
|
|
21
|
+
l as Button,
|
|
22
|
+
p as Card,
|
|
23
|
+
c as FieldErrorText,
|
|
24
|
+
m as Grid,
|
|
25
|
+
E as Heading,
|
|
26
|
+
g as HelperText,
|
|
27
|
+
I as Icon,
|
|
28
|
+
C as Input,
|
|
29
|
+
F as InputGroup,
|
|
30
|
+
L as Label,
|
|
31
|
+
d as Link,
|
|
32
|
+
i as NavigationMenu,
|
|
33
|
+
b as Spinner,
|
|
34
|
+
x as Switch,
|
|
35
|
+
k as Text,
|
|
36
|
+
w as TextField,
|
|
37
|
+
q as TextSpacing,
|
|
38
|
+
V as VisuallyHidden,
|
|
39
|
+
S as iconsHref
|
|
23
40
|
};
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
2
3
|
type InputGroupRootProps = React.ComponentPropsWithoutRef<'div'> & {};
|
|
3
4
|
type ValidationState = 'valid' | 'invalid';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
5
|
+
type Input = React.ComponentPropsWithoutRef<'input'>;
|
|
6
|
+
type InputProps = Omit<Input, 'children'> & {
|
|
7
|
+
/** Whether the input should display its "valid" or "invalid" visual styling. */
|
|
8
8
|
validationState?: ValidationState;
|
|
9
|
-
/**
|
|
10
|
-
* Whether to show a loading indicator.
|
|
11
|
-
*/
|
|
9
|
+
/** Whether to show a loading indicator. */
|
|
12
10
|
isLoading?: boolean;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
13
12
|
};
|
|
14
|
-
/**
|
|
15
|
-
* The input
|
|
16
|
-
*/
|
|
13
|
+
/** The input element */
|
|
17
14
|
declare const Input: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "children"> & {
|
|
18
|
-
/**
|
|
19
|
-
* Whether the input should display its "valid" or "invalid" visual styling.
|
|
20
|
-
*/
|
|
15
|
+
/** Whether the input should display its "valid" or "invalid" visual styling. */
|
|
21
16
|
validationState?: ValidationState | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to show a loading indicator.
|
|
24
|
-
*/
|
|
17
|
+
/** Whether to show a loading indicator. */
|
|
25
18
|
isLoading?: boolean | undefined;
|
|
19
|
+
onValueChange?: ((value: string) => void) | undefined;
|
|
26
20
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
27
21
|
type InputIndicatorProps = React.ComponentPropsWithoutRef<'svg'> & {
|
|
28
22
|
isLoading?: boolean;
|
|
@@ -30,14 +24,11 @@ type InputIndicatorProps = React.ComponentPropsWithoutRef<'svg'> & {
|
|
|
30
24
|
};
|
|
31
25
|
declare const InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
32
26
|
Input: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "children"> & {
|
|
33
|
-
/**
|
|
34
|
-
* Whether the input should display its "valid" or "invalid" visual styling.
|
|
35
|
-
*/
|
|
27
|
+
/** Whether the input should display its "valid" or "invalid" visual styling. */
|
|
36
28
|
validationState?: ValidationState | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Whether to show a loading indicator.
|
|
39
|
-
*/
|
|
29
|
+
/** Whether to show a loading indicator. */
|
|
40
30
|
isLoading?: boolean | undefined;
|
|
31
|
+
onValueChange?: ((value: string) => void) | undefined;
|
|
41
32
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
42
33
|
Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
43
34
|
isLoading?: boolean | undefined;
|
|
@@ -1,82 +1,104 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { c
|
|
4
|
-
import
|
|
5
|
-
import "../../assets/
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { Spinner as
|
|
8
|
-
const
|
|
9
|
-
"teddy-input": "_teddy-
|
|
10
|
-
"teddy-input__frame": "_teddy-
|
|
11
|
-
"teddy-input__input": "_teddy-
|
|
12
|
-
"teddy-input__input--valid": "_teddy-input__input--
|
|
13
|
-
"teddy-input__input--invalid": "_teddy-input__input--
|
|
14
|
-
"teddy-input__indicator": "_teddy-
|
|
15
|
-
"teddy-input__input--error": "_teddy-input__input--
|
|
16
|
-
fadeInAnimation:
|
|
17
|
-
scaleInAnimation:
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
const e =
|
|
1
|
+
import '../../assets/input.css';
|
|
2
|
+
import { jsxs as y, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { c } from "../../clsx-DB4S2d7J.js";
|
|
4
|
+
import s from "react";
|
|
5
|
+
import "../../assets/5161b177f001ea1a.svg";
|
|
6
|
+
import { Icon as C } from "../icon/icon.js";
|
|
7
|
+
import { Spinner as h } from "../spinner/spinner.js";
|
|
8
|
+
const x = "_fadeInAnimation_1o9uu_1", A = "_scaleInAnimation_1o9uu_1", a = {
|
|
9
|
+
"teddy-input": "_teddy-input_1o9uu_17",
|
|
10
|
+
"teddy-input__frame": "_teddy-input__frame_1o9uu_24",
|
|
11
|
+
"teddy-input__input": "_teddy-input__input_1o9uu_31",
|
|
12
|
+
"teddy-input__input--valid": "_teddy-input__input--valid_1o9uu_66",
|
|
13
|
+
"teddy-input__input--invalid": "_teddy-input__input--invalid_1o9uu_66",
|
|
14
|
+
"teddy-input__indicator": "_teddy-input__indicator_1o9uu_72",
|
|
15
|
+
"teddy-input__input--error": "_teddy-input__input--error_1o9uu_75",
|
|
16
|
+
fadeInAnimation: x,
|
|
17
|
+
scaleInAnimation: A
|
|
18
|
+
}, _ = "teddy-input";
|
|
19
|
+
function G(i) {
|
|
20
|
+
const e = i == null ? void 0 : i.target;
|
|
21
21
|
if (e.closest("input, button, a"))
|
|
22
22
|
return;
|
|
23
|
-
const t = [...
|
|
23
|
+
const t = [...i.currentTarget.getElementsByTagName("input")].find((d) => d);
|
|
24
24
|
if (!t)
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
26
|
+
const r = (t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING) !== 0 ? 0 : t.value.length;
|
|
27
27
|
requestAnimationFrame(() => {
|
|
28
28
|
try {
|
|
29
|
-
t.setSelectionRange(
|
|
29
|
+
t.setSelectionRange(r, r);
|
|
30
30
|
} finally {
|
|
31
31
|
t.focus();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
({ className:
|
|
37
|
-
const
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */ o(
|
|
40
|
-
/* @__PURE__ */ o("div", { className:
|
|
35
|
+
const g = s.createContext(void 0), p = s.forwardRef(
|
|
36
|
+
({ className: i, children: e, ...t }, n) => {
|
|
37
|
+
const u = c([a[`${_}`]], i);
|
|
38
|
+
return /* @__PURE__ */ y("div", { ...t, onPointerDown: G, ref: n, className: u, children: [
|
|
39
|
+
/* @__PURE__ */ o(g.Provider, { value: !0, children: e }),
|
|
40
|
+
/* @__PURE__ */ o("div", { className: a[`${_}__frame`] })
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
({ className:
|
|
47
|
-
const
|
|
44
|
+
p.displayName = "InputGroup";
|
|
45
|
+
const v = s.forwardRef(
|
|
46
|
+
({ className: i, isLoading: e, validationState: t, ...n }, u) => {
|
|
47
|
+
const r = s.useContext(g), d = c(
|
|
48
48
|
[
|
|
49
|
-
|
|
49
|
+
a[`${_}__input`],
|
|
50
50
|
{
|
|
51
|
-
[
|
|
52
|
-
[
|
|
51
|
+
[a[`${_}__input--valid`]]: t === "valid",
|
|
52
|
+
[a[`${_}__input--error`]]: t === "invalid"
|
|
53
53
|
}
|
|
54
54
|
],
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
i
|
|
56
|
+
), N = r === !0;
|
|
57
|
+
function m(f) {
|
|
58
|
+
var I;
|
|
59
|
+
(I = n.onValueChange) == null || I.call(n, f.target.value), n.onChange && n.onChange(f);
|
|
60
|
+
}
|
|
61
|
+
return N ? /* @__PURE__ */ o(
|
|
62
|
+
"input",
|
|
63
|
+
{
|
|
64
|
+
"aria-invalid": t === "invalid",
|
|
65
|
+
...n,
|
|
66
|
+
onChange: m,
|
|
67
|
+
className: d,
|
|
68
|
+
ref: u
|
|
69
|
+
}
|
|
70
|
+
) : /* @__PURE__ */ y(p, { children: [
|
|
71
|
+
/* @__PURE__ */ o(
|
|
72
|
+
"input",
|
|
73
|
+
{
|
|
74
|
+
"aria-invalid": t === "invalid",
|
|
75
|
+
...n,
|
|
76
|
+
onChange: m,
|
|
77
|
+
className: d,
|
|
78
|
+
ref: u
|
|
79
|
+
}
|
|
80
|
+
),
|
|
59
81
|
/* @__PURE__ */ o(l, { isValid: t === "valid", isLoading: e })
|
|
60
82
|
] });
|
|
61
83
|
}
|
|
62
84
|
);
|
|
63
|
-
|
|
64
|
-
const l =
|
|
65
|
-
({ className:
|
|
85
|
+
v.displayName = "Input";
|
|
86
|
+
const l = s.forwardRef(
|
|
87
|
+
({ className: i, isLoading: e, isValid: t, ...n }, u) => {
|
|
66
88
|
if (!t && !e)
|
|
67
89
|
return null;
|
|
68
90
|
if (!t && e)
|
|
69
|
-
return /* @__PURE__ */ o(
|
|
70
|
-
const
|
|
71
|
-
return /* @__PURE__ */ o(
|
|
91
|
+
return /* @__PURE__ */ o(h, { className: i, size: "xs", ...n, ref: u });
|
|
92
|
+
const r = c([a[`${_}__indicator`]], i);
|
|
93
|
+
return /* @__PURE__ */ o(C, { ...n, size: "md", name: "check-circle-filled", className: r, ref: u });
|
|
72
94
|
}
|
|
73
95
|
);
|
|
74
96
|
l.displayName = "InputIndicator";
|
|
75
|
-
const
|
|
76
|
-
Input:
|
|
97
|
+
const T = Object.assign(p, {
|
|
98
|
+
Input: v,
|
|
77
99
|
Indicator: l
|
|
78
100
|
});
|
|
79
101
|
export {
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
v as Input,
|
|
103
|
+
T as InputGroup
|
|
82
104
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
export type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & {
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
isRequired?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
|
|
7
8
|
disabled?: boolean | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
8
10
|
} & React.RefAttributes<HTMLLabelElement>>;
|
|
9
11
|
export { Label };
|