@telia/teddy 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +8 -10
  2. package/dist/assets/5161b177f001ea1a.svg +1080 -0
  3. package/dist/assets/badge.css +1 -0
  4. package/dist/assets/button.css +1 -1
  5. package/dist/assets/grid.css +1 -0
  6. package/dist/assets/heading.css +1 -0
  7. package/dist/assets/icon.css +1 -1
  8. package/dist/assets/input.css +1 -1
  9. package/dist/assets/label.css +1 -1
  10. package/dist/assets/link.css +1 -0
  11. package/dist/assets/main.css +1 -1
  12. package/dist/assets/navigation-menu.css +1 -0
  13. package/dist/assets/text-field.css +1 -1
  14. package/dist/assets/text-spacing.css +1 -0
  15. package/dist/assets/text.css +1 -1
  16. package/dist/assets/visually-hidden.css +1 -0
  17. package/dist/badge-CbHdlkcM.js +742 -0
  18. package/dist/components/accordion/accordion.d.ts +59 -0
  19. package/dist/components/accordion/accordion.js +24 -0
  20. package/dist/components/accordion/index.d.ts +2 -0
  21. package/dist/components/accordion/index.js +4 -0
  22. package/dist/components/badge/badge.d.ts +21 -0
  23. package/dist/components/badge/badge.js +24 -0
  24. package/dist/components/badge/index.d.ts +2 -0
  25. package/dist/components/badge/index.js +4 -0
  26. package/dist/components/button/button.d.ts +19 -20
  27. package/dist/components/button/button.js +82 -71
  28. package/dist/components/button/index.d.ts +1 -1
  29. package/dist/components/card/card.d.ts +68 -0
  30. package/dist/components/card/card.js +24 -0
  31. package/dist/components/card/index.d.ts +2 -0
  32. package/dist/components/card/index.js +4 -0
  33. package/dist/components/field-error-text/field-error-text.d.ts +4 -3
  34. package/dist/components/field-error-text/field-error-text.js +12 -12
  35. package/dist/components/grid/grid.d.ts +23 -0
  36. package/dist/components/grid/grid.js +18 -0
  37. package/dist/components/grid/index.d.ts +2 -0
  38. package/dist/components/grid/index.js +4 -0
  39. package/dist/components/heading/heading.d.ts +63 -0
  40. package/dist/components/heading/heading.js +53 -0
  41. package/dist/components/heading/index.d.ts +2 -0
  42. package/dist/components/heading/index.js +4 -0
  43. package/dist/components/helper-text/helper-text.d.ts +2 -1
  44. package/dist/components/helper-text/helper-text.js +7 -7
  45. package/dist/components/icon/icon.d.ts +13 -2
  46. package/dist/components/icon/icon.js +22 -22
  47. package/dist/components/icon/index.d.ts +2 -1
  48. package/dist/components/icon/index.js +1 -1
  49. package/dist/components/index.d.ts +10 -0
  50. package/dist/components/index.js +38 -21
  51. package/dist/components/input/input.d.ts +14 -23
  52. package/dist/components/input/input.js +72 -50
  53. package/dist/components/label/label.d.ts +3 -1
  54. package/dist/components/label/label.js +23 -51
  55. package/dist/components/link/index.d.ts +2 -0
  56. package/dist/components/link/index.js +4 -0
  57. package/dist/components/link/link.d.ts +49 -0
  58. package/dist/components/link/link.js +36 -0
  59. package/dist/components/navigation-menu/index.d.ts +2 -0
  60. package/dist/components/navigation-menu/index.js +4 -0
  61. package/dist/components/navigation-menu/navigation-menu.d.ts +126 -0
  62. package/dist/components/navigation-menu/navigation-menu.js +10 -0
  63. package/dist/components/spinner/spinner.d.ts +2 -1
  64. package/dist/components/spinner/spinner.js +5 -5
  65. package/dist/components/switch/index.d.ts +2 -0
  66. package/dist/components/switch/index.js +4 -0
  67. package/dist/components/switch/switch.d.ts +44 -0
  68. package/dist/components/switch/switch.js +23 -0
  69. package/dist/components/text/text.d.ts +15 -8
  70. package/dist/components/text/text.js +27 -41
  71. package/dist/components/text-field/text-field.d.ts +24 -24
  72. package/dist/components/text-field/text-field.js +102 -125
  73. package/dist/components/text-spacing/index.d.ts +2 -0
  74. package/dist/components/text-spacing/index.js +4 -0
  75. package/dist/components/text-spacing/text-spacing.d.ts +19 -0
  76. package/dist/components/text-spacing/text-spacing.js +17 -0
  77. package/dist/components/visually-hidden/index.d.ts +2 -0
  78. package/dist/components/visually-hidden/index.js +4 -0
  79. package/dist/components/visually-hidden/visually-hidden.d.ts +15 -0
  80. package/dist/components/visually-hidden/visually-hidden.js +24 -0
  81. package/dist/icons/category.d.ts +985 -0
  82. package/dist/icons/category.js +333 -0
  83. package/dist/icons/name.d.ts +1 -1
  84. package/dist/icons/name.js +250 -200
  85. package/dist/index-DM5e-Whg.js +43 -0
  86. package/dist/index-DpfSJps6.js +75 -0
  87. package/dist/main.d.ts +1 -0
  88. package/dist/main.js +53 -36
  89. package/dist/navigation-menu-BgN7IKev.js +1334 -0
  90. package/dist/tokens/spacing/variables.json.d.ts +34 -0
  91. package/dist/utils/action.d.ts +2 -2
  92. package/dist/utils/composeEventHandlers.d.ts +30 -0
  93. package/dist/utils/composeEventHandlers.js +9 -0
  94. package/dist/utils/composeRefs.d.ts +40 -0
  95. package/dist/utils/composeRefs.js +14 -0
  96. package/dist/utils/layout.d.ts +60 -0
  97. package/dist/utils/layout.js +100 -0
  98. package/package.json +25 -24
  99. package/dist/assets/f2a2f391a886d395.svg +0 -284
  100. package/dist/index-TI1xsy6a.js +0 -70
  101. package/dist/teams/index.d.ts +0 -0
  102. package/dist/teams/index.js +0 -1
  103. package/dist/teams/min-side/index.d.ts +0 -0
  104. package/dist/teams/min-side/index.js +0 -1
  105. package/dist/teams/webshop/index.d.ts +0 -0
  106. package/dist/teams/webshop/index.js +0 -1
  107. /package/dist/{teams/business/index.d.ts → components/text-field/tex-field-label.d.ts} +0 -0
  108. /package/dist/{teams/business/index.js → components/text-field/tex-field-label.js} +0 -0
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ export { Heading } from './heading';
2
+ export type { HeadingProps } from './heading';
@@ -0,0 +1,4 @@
1
+ import { Heading as r } from "./heading.js";
2
+ export {
3
+ r as Heading
4
+ };
@@ -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 "../../assets/helper-text.css";
1
+ import '../../assets/helper-text.css';
2
2
  import { jsx as l } from "react/jsx-runtime";
3
- import { c as o } from "../../clsx-DB4S2d7J.js";
4
- import a from "react";
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", m = a.forwardRef(
8
+ }, x = "teddy-helper-text", c = o.forwardRef(
9
9
  ({ className: e, children: t, ...r }, s) => {
10
- const d = o(
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
- m.displayName = "HelperText";
17
+ c.displayName = "HelperText";
18
18
  export {
19
- m as HelperText
19
+ c as HelperText
20
20
  };
@@ -1,9 +1,20 @@
1
- /// <reference types="react" />
2
- import { type IconName } from '../../icons/name';
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 "../../assets/icon.css";
2
- import { jsxs as m, jsx as o } from "react/jsx-runtime";
3
- import r from "../../assets/f2a2f391a886d395.svg";
4
- import { c as _ } from "../../clsx-DB4S2d7J.js";
5
- const d = {
6
- "teddy-icon": "_teddy-icon_mqgol_1",
7
- "teddy-icon--font": "_teddy-icon--font_mqgol_6",
8
- "teddy-icon--xxs": "_teddy-icon--xxs_mqgol_10",
9
- "teddy-icon--xs": "_teddy-icon--xs_mqgol_14",
10
- "teddy-icon--sm": "_teddy-icon--sm_mqgol_18",
11
- "teddy-icon--md": "_teddy-icon--md_mqgol_22",
12
- "teddy-icon--lg": "_teddy-icon--lg_mqgol_26",
13
- "teddy-icon--xl": "_teddy-icon--xl_mqgol_30",
14
- "teddy-icon-with-children": "_teddy-icon-with-children_mqgol_35"
15
- }, t = "teddy-icon", y = `${t}-with-children`;
16
- function g({ name: n, size: c = "font", className: i, children: e, ...s }) {
17
- if (e)
18
- return /* @__PURE__ */ m("span", { className: _([d[y]]), children: [
19
- /* @__PURE__ */ o(g, { name: n, size: c, className: i, ...s }),
20
- e
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 l = _([d[t], d[`${t}--${c}`]], i);
23
- return /* @__PURE__ */ o("svg", { ...s, className: l, children: /* @__PURE__ */ o("use", { href: `${r}#${n}` }) });
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,4 +1,5 @@
1
- import iconsHref from '../../icons/sprite.svg';
1
+ import { default as iconsHref } from '../../icons/sprite.svg';
2
+
2
3
  export { Icon } from './icon';
3
4
  export type { IconName, IconProps } from './icon';
4
5
  export { iconsHref };
@@ -1,4 +1,4 @@
1
- import { default as e } from "../../assets/f2a2f391a886d395.svg";
1
+ import { default as e } from "../../assets/5161b177f001ea1a.svg";
2
2
  import { Icon as t } from "./icon.js";
3
3
  export {
4
4
  t 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';
@@ -1,23 +1,40 @@
1
- import { Button as e } from "./button/button.js";
2
- import { FieldErrorText as p } from "./field-error-text/field-error-text.js";
3
- import { HelperText as f } from "./helper-text/helper-text.js";
4
- import { default as n } from "../assets/f2a2f391a886d395.svg";
5
- import { Icon as u } from "./icon/icon.js";
6
- import { Input as T, InputGroup as a } from "./input/input.js";
7
- import { Label as I } from "./label/label.js";
8
- import { Spinner as s } from "./spinner/spinner.js";
9
- import { Text as H } from "./text/text.js";
10
- import { TextField as B } from "./text-field/text-field.js";
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 Button,
13
- p as FieldErrorText,
14
- f as HelperText,
15
- u as Icon,
16
- T as Input,
17
- a as InputGroup,
18
- I as Label,
19
- s as Spinner,
20
- H as Text,
21
- B as TextField,
22
- n as iconsHref
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 InputProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> & {
5
- /**
6
- * Whether the input should display its "valid" or "invalid" visual styling.
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 "../../assets/input.css";
2
- import { jsxs as m, jsx as o } from "react/jsx-runtime";
3
- import { c as d } from "../../clsx-DB4S2d7J.js";
4
- import _ from "react";
5
- import "../../assets/f2a2f391a886d395.svg";
6
- import { Icon as y } from "../icon/icon.js";
7
- import { Spinner as x } from "../spinner/spinner.js";
8
- const N = "_fadeInAnimation_1bk8x_1", v = "_scaleInAnimation_1bk8x_1", s = {
9
- "teddy-input": "_teddy-input_1bk8x_17",
10
- "teddy-input__frame": "_teddy-input__frame_1bk8x_24",
11
- "teddy-input__input": "_teddy-input__input_1bk8x_31",
12
- "teddy-input__input--valid": "_teddy-input__input--valid_1bk8x_62",
13
- "teddy-input__input--invalid": "_teddy-input__input--invalid_1bk8x_62",
14
- "teddy-input__indicator": "_teddy-input__indicator_1bk8x_68",
15
- "teddy-input__input--error": "_teddy-input__input--error_1bk8x_71",
16
- fadeInAnimation: N,
17
- scaleInAnimation: v
18
- }, a = "teddy-input";
19
- function b(n) {
20
- const e = n == null ? void 0 : n.target;
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 = [...n.currentTarget.getElementsByTagName("input")].find((p) => p);
23
+ const t = [...i.currentTarget.getElementsByTagName("input")].find((d) => d);
24
24
  if (!t)
25
25
  return;
26
- const u = (t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING) !== 0 ? 0 : t.value.length;
26
+ const r = (t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING) !== 0 ? 0 : t.value.length;
27
27
  requestAnimationFrame(() => {
28
28
  try {
29
- t.setSelectionRange(u, u);
29
+ t.setSelectionRange(r, r);
30
30
  } finally {
31
31
  t.focus();
32
32
  }
33
33
  });
34
34
  }
35
- const f = _.createContext(void 0), c = _.forwardRef(
36
- ({ className: n, children: e, ...t }, i) => {
37
- const r = d([s[`${a}`]], n);
38
- return /* @__PURE__ */ m("div", { ...t, onPointerDown: b, ref: i, className: r, children: [
39
- /* @__PURE__ */ o(f.Provider, { value: !0, children: e }),
40
- /* @__PURE__ */ o("div", { className: s[`${a}__frame`] })
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
- c.displayName = "InputGroup";
45
- const I = _.forwardRef(
46
- ({ className: n, isLoading: e, validationState: t, ...i }, r) => {
47
- const u = _.useContext(f), p = d(
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
- s[`${a}__input`],
49
+ a[`${_}__input`],
50
50
  {
51
- [s[`${a}__input--valid`]]: t === "valid",
52
- [s[`${a}__input--error`]]: t === "invalid"
51
+ [a[`${_}__input--valid`]]: t === "valid",
52
+ [a[`${_}__input--error`]]: t === "invalid"
53
53
  }
54
54
  ],
55
- n
56
- );
57
- return u === !0 ? /* @__PURE__ */ o("input", { ...i, className: p, ref: r }) : /* @__PURE__ */ m(c, { children: [
58
- /* @__PURE__ */ o("input", { ...i, className: p, ref: r }),
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
- I.displayName = "Input";
64
- const l = _.forwardRef(
65
- ({ className: n, isLoading: e, isValid: t, ...i }, r) => {
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(x, { className: n, size: "xs", ...i, ref: r });
70
- const u = d([s[`${a}__indicator`]], n);
71
- return /* @__PURE__ */ o(y, { ...i, size: "md", name: "check-circle-filled", className: u, ref: r });
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 O = Object.assign(c, {
76
- Input: I,
97
+ const T = Object.assign(p, {
98
+ Input: v,
77
99
  Indicator: l
78
100
  });
79
101
  export {
80
- I as Input,
81
- O as InputGroup
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 };