@telia/teddy 0.0.3 → 0.0.4

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 +77 -0
  36. package/dist/components/grid/grid.js +393 -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 +1 -1
  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 +12 -0
  97. package/dist/utils/layout.js +11 -0
  98. package/package.json +23 -22
  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,10 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "../../clsx-DB4S2d7J.js";
4
+ import { N as n } from "../../navigation-menu-BgN7IKev.js";
5
+ import "../../utils/composeRefs.js";
6
+ import "../visually-hidden/visually-hidden.js";
7
+ import "../../utils/composeEventHandlers.js";
8
+ export {
9
+ n as NavigationMenu
10
+ };
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
+
2
3
  declare const SPINNER_VARIANT: {
3
4
  readonly PRIMARY: "primary";
4
5
  readonly DISABLED: "disabled";
@@ -1,4 +1,4 @@
1
- import "../../assets/spinner.css";
1
+ import '../../assets/spinner.css';
2
2
  import { jsx as _ } from "react/jsx-runtime";
3
3
  import { c as s } from "../../clsx-DB4S2d7J.js";
4
4
  import a from "react";
@@ -19,14 +19,14 @@ const l = "_dash_qjx6c_1", p = "_rotate_qjx6c_1", e = {
19
19
  DISABLED: "disabled",
20
20
  NEGATIVE: "negative",
21
21
  NEGATIVE_DISABLED: "negative-disabled"
22
- }, o = {
22
+ }, y = {
23
23
  XXS: "xxs",
24
24
  XS: "xs",
25
25
  SM: "sm",
26
26
  MD: "md",
27
27
  LG: "lg"
28
- }, g = a.forwardRef(
29
- ({ size: n = o.SM, variant: r = x.PRIMARY, className: i, ...c }, t) => /* @__PURE__ */ _(
28
+ }, q = a.forwardRef(
29
+ ({ size: n = y.SM, variant: r = x.PRIMARY, className: i, ...c }, t) => /* @__PURE__ */ _(
30
30
  "svg",
31
31
  {
32
32
  ...c,
@@ -46,5 +46,5 @@ const l = "_dash_qjx6c_1", p = "_rotate_qjx6c_1", e = {
46
46
  )
47
47
  );
48
48
  export {
49
- g as Spinner
49
+ q as Spinner
50
50
  };
@@ -0,0 +1,2 @@
1
+ export { Switch } from './switch';
2
+ export type { SwitchProps } from './switch';
@@ -0,0 +1,4 @@
1
+ import { S as t } from "../../badge-CbHdlkcM.js";
2
+ export {
3
+ t as Switch
4
+ };
@@ -0,0 +1,44 @@
1
+ import { Label } from '..';
2
+ import { default as React } from 'react';
3
+
4
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
5
+ /** -------------------------------------------------------------------------------------------------
6
+ * SwitchRoot
7
+ * -----------------------------------------------------------------------------------------------*/
8
+ type SwitchRootProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'id'> & {
9
+ /** The id you want to use to connect the label to the switch. If not provided, it will be generated */
10
+ id?: string;
11
+ };
12
+ /** -------------------------------------------------------------------------------------------------
13
+ * SwitchLabel
14
+ * -----------------------------------------------------------------------------------------------*/
15
+ type SwitchLabelProps = Omit<React.ComponentPropsWithoutRef<typeof Label>, 'id'>;
16
+ /** -------------------------------------------------------------------------------------------------
17
+ * SwitchInput
18
+ * -----------------------------------------------------------------------------------------------*/
19
+ type SwitchInputProps = Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, 'id'>;
20
+ /** -------------------------------------------------------------------------------------------------
21
+ * SwitchThumb
22
+ * -----------------------------------------------------------------------------------------------*/
23
+ type SwitchThumbProps = React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Thumb>;
24
+ declare const Switch: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "id"> & {
25
+ /** The id you want to use to connect the label to the switch. If not provided, it will be generated */
26
+ id?: string | undefined;
27
+ } & React.RefAttributes<HTMLDivElement>> & {
28
+ Label: React.ForwardRefExoticComponent<SwitchLabelProps & React.RefAttributes<HTMLLabelElement>>;
29
+ Input: React.ForwardRefExoticComponent<SwitchInputProps & React.RefAttributes<HTMLButtonElement>>;
30
+ Thumb: React.ForwardRefExoticComponent<Omit<SwitchPrimitive.SwitchThumbProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
31
+ Indicator: React.ForwardRefExoticComponent<Partial<Omit<React.SVGProps<SVGSVGElement> & {
32
+ name: "link" | "map" | "menu" | "search" | "summary" | "time" | "video" | "filter" | "image" | "stop" | "key" | "x" | "download" | "split" | "alert" | "radio" | "email" | "copy" | "add" | "reverse" | "infinite" | "visible" | "help" | "zoom-out" | "zoom" | "sync" | "close" | "error" | "focus" | "play" | "alarm-off" | "alarm-on" | "attachment" | "bookmark-filled" | "bookmark" | "copy-filled" | "dislike" | "edit" | "heart-filled" | "heart" | "invisible" | "like" | "lock-open" | "lock" | "login" | "logout" | "maximize" | "minimize" | "mute" | "password-invisible" | "password-visible" | "play-filled" | "remove-filled" | "remove" | "save" | "send" | "settings" | "share" | "shuffle" | "skip-back-10sec" | "skip-back-30sec" | "skip-forward-10sec" | "skip-forward-30sec" | "star-filled" | "star" | "switch-arrows" | "tv-next" | "tv-pause" | "tv-previous" | "tv-stop" | "upload" | "volume" | "connected-building" | "home" | "hospital" | "industry" | "premises-datacenter" | "premises-large" | "premises-medium" | "premises-small" | "premises" | "store" | "address-book" | "b2b-customer" | "care" | "chat-robot" | "chat" | "child-1" | "child-2" | "conversation" | "customer-dialogue" | "dsl-hub" | "end-user" | "handshake" | "headphones" | "letter" | "mms" | "new-contact" | "new-group" | "news" | "parental-guide" | "people-hub" | "people" | "portal" | "signature" | "smiley-happy" | "smiley-sad" | "sms" | "support" | "user-admin" | "vcard" | "voicemail" | "battery" | "bluetooth" | "broadband" | "broken-phone" | "cast" | "cloud-connect" | "connected" | "core-router" | "daas-device" | "data-transfer" | "desktop" | "devices" | "esim-simcard" | "esim" | "face-id" | "fiber" | "fingerprint" | "fiveg" | "fourg" | "home-installation" | "industrial-iot" | "internet" | "it-service" | "laptop" | "mobile-broadband" | "network" | "phone-recycling" | "phone-ringing" | "phone" | "rack" | "refill-card" | "remote-control" | "repair" | "roaming" | "router" | "secure-device" | "sense-car" | "server" | "service-device" | "service-supervision" | "slow-wifi" | "smart-wifi" | "smartphone" | "smartwatch" | "tablet" | "trade-phone" | "tv" | "usb" | "voice-switch" | "wallplug" | "wireless-off" | "wireless-weak" | "wireless" | "world-alert" | "world-off" | "world-question" | "bar-chart" | "doc" | "document-doc" | "document-edit" | "document-pdf" | "document-ppt" | "excel" | "folder-copy" | "folder-new" | "folder" | "gif" | "graph" | "media-content" | "org-chart" | "pie-chart" | "print" | "register" | "report" | "simcard" | "spell-check" | "credit-card" | "euro" | "invoice" | "kontantkort" | "kr" | "late-payment" | "money-back-euro" | "money-back-kr" | "money-euro" | "money-kr" | "pay-monthly-euro" | "pay-monthly-kr" | "pay-once-euro" | "pay-once-kr" | "payment-success" | "savings" | "wallet" | "airplay" | "camera" | "entertainment" | "external" | "film" | "games" | "megaphone" | "microphone" | "music" | "player-settings" | "record" | "stream" | "trailer" | "video-conference" | "activity-level" | "ai-robot" | "bag" | "basketball" | "blood-pressure" | "bulb" | "business-continuity" | "business-intelligence" | "calendar" | "cart" | "close-circle" | "cloud" | "coffee" | "compass" | "construction" | "cookie" | "delivery" | "drone" | "education" | "efficiency" | "environment" | "facemask" | "flag" | "food" | "fraud" | "getting-started" | "home-care" | "job-search" | "layers" | "measuring-health" | "moisture" | "offering" | "offshore" | "optimization" | "pebble" | "pet-dog" | "pin" | "plane" | "plus-minus" | "police" | "power-grid" | "present" | "press-button" | "price" | "pulse" | "recycle" | "reservation" | "route" | "ruler" | "satellite" | "secured-1" | "secured-2" | "security-camera" | "shopping" | "snowflake" | "speedometer" | "spyware" | "suitcase" | "sustainability" | "tag" | "temperature" | "thinking" | "train" | "transfer" | "undo" | "wavelength" | "weather" | "world" | "android" | "apple" | "bankid" | "facebook" | "instagram" | "linkedin" | "snapchat" | "whatsapp" | "windows" | "youtube" | "alert-filled" | "check-circle-filled" | "check-circle" | "error-filled" | "info-filled" | "info" | "question-filled" | "question" | "warning" | "arrow-down" | "arrow-left" | "arrow-right" | "arrow-subdirectory" | "arrow-up" | "card-view" | "checkmark-bold" | "checkmark" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "grid-view" | "list-view" | "minus-bold" | "minus" | "more-horizontal" | "more-vertical" | "plus" | "services" | "sorter" | "table-view";
33
+ size?: ("sm" | "md" | "lg" | "xl" | "font" | "xxs" | "xs") | undefined;
34
+ children?: React.ReactNode;
35
+ }, "ref">> & React.RefAttributes<SVGSVGElement>>;
36
+ };
37
+ type SwitchProps = {
38
+ Root: SwitchRootProps;
39
+ Label: SwitchLabelProps;
40
+ Input: SwitchInputProps;
41
+ Thumb: SwitchThumbProps;
42
+ };
43
+ export { Switch };
44
+ export type { SwitchProps };
@@ -0,0 +1,23 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "../../clsx-DB4S2d7J.js";
4
+ import { S as n } from "../../badge-CbHdlkcM.js";
5
+ import "../../assets/5161b177f001ea1a.svg";
6
+ import "../icon/icon.js";
7
+ import "../grid/grid.js";
8
+ import "../../navigation-menu-BgN7IKev.js";
9
+ import "../link/link.js";
10
+ import "../button/button.js";
11
+ import "../field-error-text/field-error-text.js";
12
+ import "../helper-text/helper-text.js";
13
+ import "../input/input.js";
14
+ import "../label/label.js";
15
+ import "../spinner/spinner.js";
16
+ import "../text/text.js";
17
+ import "../text-field/text-field.js";
18
+ import "../heading/heading.js";
19
+ import "../visually-hidden/visually-hidden.js";
20
+ import "../text-spacing/text-spacing.js";
21
+ export {
22
+ n as Switch
23
+ };
@@ -1,9 +1,9 @@
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"];
1
+ import { default as React } from 'react';
2
+
3
3
  type AsChildProps = {
4
4
  asChild: true;
5
5
  as?: never;
6
- } & React.ComponentPropsWithoutRef<'p'>;
6
+ } & React.ComponentPropsWithoutRef<'span'>;
7
7
  type SpanProps = {
8
8
  as?: 'span';
9
9
  asChild?: false;
@@ -17,17 +17,24 @@ type LabelProps = {
17
17
  asChild?: false;
18
18
  } & React.ComponentPropsWithoutRef<'label'>;
19
19
  type PProps = {
20
+ /**
21
+ * @default 'p'
22
+ */
20
23
  as: 'p';
21
24
  asChild?: false;
22
25
  } & React.ComponentPropsWithoutRef<'p'>;
23
- type TextVariant = (typeof paragraphVariants)[number];
26
+ type TextVariant = 'paragraph-100' | 'paragraph-100-medium' | 'paragraph-100-bold' | 'paragraph-200' | 'preamble-100' | 'preamble-200' | 'additional-100' | 'additional-100-medium' | 'overline-100' | 'overline-200';
24
27
  type TextProps = {
25
28
  enableHyphenation?: boolean;
26
29
  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';
30
+ /**
31
+ * @default 'paragraph-100'
32
+ */
33
+ variant?: TextVariant;
28
34
  } & (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
- };
35
+ /**
36
+ * Text is used to render text elements. By default, it renders as a `p` tag.
37
+ */
38
+ declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLSpanElement>>;
32
39
  export { Text };
33
40
  export type { TextProps, TextVariant };
@@ -1,51 +1,37 @@
1
- import "../../assets/text.css";
1
+ import '../../assets/text.css';
2
2
  import { jsx as a } from "react/jsx-runtime";
3
- import { a as b } from "../../index-TI1xsy6a.js";
3
+ import { $ as l } from "../../index-DpfSJps6.js";
4
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}`],
5
+ import c from "react";
6
+ const t = {
7
+ "teddy-text": "_teddy-text_2zpdm_1",
8
+ "teddy-text--disabled": "_teddy-text--disabled_2zpdm_7",
9
+ "teddy-text--hyphens": "_teddy-text--hyphens_2zpdm_10",
10
+ "teddy-text--paragraph-100": "_teddy-text--paragraph-100_2zpdm_13",
11
+ "teddy-text--paragraph-100-medium": "_teddy-text--paragraph-100-medium_2zpdm_19",
12
+ "teddy-text--paragraph-100-bold": "_teddy-text--paragraph-100-bold_2zpdm_26",
13
+ "teddy-text--paragraph-200": "_teddy-text--paragraph-200_2zpdm_33",
14
+ "teddy-text--preamble-100": "_teddy-text--preamble-100_2zpdm_39",
15
+ "teddy-text--preamble-200": "_teddy-text--preamble-200_2zpdm_45",
16
+ "teddy-text--additional-100": "_teddy-text--additional-100_2zpdm_51",
17
+ "teddy-text--additional-100-medium": "_teddy-text--additional-100-medium_2zpdm_57",
18
+ "teddy-text--overline-100": "_teddy-text--overline-100_2zpdm_64",
19
+ "teddy-text--overline-200": "_teddy-text--overline-200_2zpdm_71"
20
+ }, e = "teddy-text", h = c.forwardRef(
21
+ ({ className: p, children: d, disabled: r, enableHyphenation: _, variant: m = "paragraph-100", asChild: x, as: y = "p", ...o }, s) => {
22
+ const i = n(
23
+ t[e],
24
+ t[`${e}--${m}`],
36
25
  {
37
- [e[`${t}--hyphens`]]: _,
38
- [e[`${t}--disabled`]]: s
26
+ [t[`${e}--hyphens`]]: _,
27
+ [t[`${e}--disabled`]]: r
39
28
  },
40
29
  p
41
30
  );
42
- return /* @__PURE__ */ a(b, { ...y, ref: l, className: m, children: i ? d : /* @__PURE__ */ a(x, { children: d }) });
31
+ return /* @__PURE__ */ a(l, { ...o, ref: s, className: i, children: x ? d : /* @__PURE__ */ a(y, { children: d }) });
43
32
  }
44
33
  );
45
- r.displayName = "Text";
46
- const v = Object.assign(r, {
47
- paragraphVariants: h
48
- });
34
+ h.displayName = "Text";
49
35
  export {
50
- v as Text
36
+ h as Text
51
37
  };
@@ -1,11 +1,15 @@
1
- import React from 'react';
2
- import { HelperTextProps } from '../helper-text';
1
+ import { InputGroupProps } from '../input';
3
2
  import { LabelProps } from '../label';
3
+ import { HelperTextProps } from '../helper-text';
4
+ import { default as React } from 'react';
5
+
4
6
  type ListOfErrors = Array<string | null | undefined> | null | undefined;
5
7
  type TextFieldContextValue = {
6
8
  id: string;
7
9
  errorId?: string;
10
+ setErrorId: React.Dispatch<React.SetStateAction<string | undefined>>;
8
11
  helperTextId?: string;
12
+ setHelperTextId: React.Dispatch<React.SetStateAction<string | undefined>>;
9
13
  disabled?: boolean;
10
14
  errors?: ListOfErrors;
11
15
  readOnly?: boolean;
@@ -13,12 +17,7 @@ type TextFieldContextValue = {
13
17
  isLoading?: boolean;
14
18
  isRequired?: boolean;
15
19
  };
16
- type 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'> & {
20
+ type TextFieldRootProps = React.ComponentPropsWithoutRef<'div'> & {
22
21
  /**
23
22
  * Whether the input is disabled.
24
23
  */
@@ -40,18 +39,18 @@ type TextFieldRootProps<T extends Input['value']> = React.ComponentPropsWithoutR
40
39
  * Whether the input is required.
41
40
  */
42
41
  isRequired?: boolean;
43
- } & RootInputProps<T>;
44
- type TextFieldInputProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'id' | 'disabled' | 'readOnly' | 'required'> & {};
45
- type TextFieldDecoratorProps = React.ComponentPropsWithoutRef<'div'> & {};
42
+ };
43
+ type TextFieldInputProps = Omit<InputGroupProps['Input'], 'id' | 'disabled' | 'readOnly' | 'required'> & {};
44
+ type TextFieldInputGroupProps = InputGroupProps['Root'] & {};
45
+ type TextFieldIndicatorProps = InputGroupProps['Indicator'];
46
46
  type TextFieldLabelProps = LabelProps;
47
47
  type TextFieldHelperTextProps = HelperTextProps & {};
48
48
  type TextFieldErrorList = Omit<React.ComponentPropsWithoutRef<'ul'>, 'children'> & {
49
49
  children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
50
50
  };
51
51
  declare const TextFieldErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
52
- children?: React.ReactNode | ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode);
52
+ children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
53
53
  } & React.RefAttributes<HTMLUListElement>>;
54
- type TextFieldIndicatorProps = React.ComponentPropsWithoutRef<'svg'>;
55
54
  export declare const TextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
56
55
  /**
57
56
  * Whether the input is disabled.
@@ -74,26 +73,27 @@ export declare const TextField: React.ForwardRefExoticComponent<Omit<React.Detai
74
73
  * Whether the input is required.
75
74
  */
76
75
  isRequired?: boolean | undefined;
77
- } & Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value"> & {
78
- value?: string | number | readonly string[] | undefined;
79
- onValueChange?: ((value: string | number | readonly string[] | undefined) => void) | undefined;
80
76
  } & React.RefAttributes<HTMLDivElement>> & {
81
- Input: React.ForwardRefExoticComponent<Omit<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"> & {
77
+ Input: React.ForwardRefExoticComponent<Omit<import('../input').InputProps, "id" | "disabled" | "readOnly" | "required"> & React.RefAttributes<HTMLInputElement>>;
78
+ Label: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-label').LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
83
79
  disabled?: boolean | undefined;
80
+ isRequired?: boolean | undefined;
84
81
  } & React.RefAttributes<HTMLLabelElement>>;
85
- Decorator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
82
+ InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
86
83
  HelperText: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
87
84
  ErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
88
- children?: React.ReactNode | ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode);
85
+ children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
89
86
  } & React.RefAttributes<HTMLUListElement>>;
90
- Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
87
+ Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
88
+ isLoading?: boolean | undefined;
89
+ isValid?: boolean | undefined;
90
+ } & React.RefAttributes<SVGSVGElement>>;
91
91
  };
92
- export type TextFieldProps<T extends Input['value']> = {
93
- Root: TextFieldRootProps<T>;
92
+ export type TextFieldProps = {
93
+ Root: TextFieldRootProps;
94
94
  Input: TextFieldInputProps;
95
95
  Label: TextFieldLabelProps;
96
- Decorator: TextFieldDecoratorProps;
96
+ Group: TextFieldInputGroupProps;
97
97
  HelperText: TextFieldHelperTextProps;
98
98
  ErrorList: TextFieldErrorList;
99
99
  Indicator: TextFieldIndicatorProps;
@@ -1,141 +1,118 @@
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,
1
+ import '../../assets/text-field.css';
2
+ import { jsx as o, jsxs as H } from "react/jsx-runtime";
3
+ import { c as u } from "../../clsx-DB4S2d7J.js";
4
+ import i from "react";
5
+ import { FieldErrorText as T } from "../field-error-text/field-error-text.js";
6
+ import { HelperText as $ } from "../helper-text/helper-text.js";
7
+ import { Label as j } from "../label/label.js";
8
+ import { InputGroup as I } from "../input/input.js";
9
+ const q = "_fadeInAnimation_1i091_1", G = "_scaleInAnimation_1i091_1", p = {
10
+ "teddy-text-field": "_teddy-text-field_1i091_17",
11
+ "teddy-text-field__error-list": "_teddy-text-field__error-list_1i091_23",
12
+ fadeInAnimation: q,
13
+ scaleInAnimation: G
14
+ }, m = "teddy-text-field", f = i.createContext(void 0), _ = i.forwardRef(
15
+ ({ className: t, children: d, readOnly: e, disabled: r, errors: a, isValid: s, isLoading: l, isRequired: n, ...c }, N) => {
16
+ const R = i.useId(), h = c.id || R, C = u([p[m]], t), [E, g] = i.useState(void 0), [w, A] = i.useState(void 0);
17
+ return /* @__PURE__ */ o("div", { ...c, ref: N, className: C, children: /* @__PURE__ */ o(
18
+ f.Provider,
19
+ {
20
+ value: {
21
+ errors: a,
22
+ id: h,
23
+ errorId: w,
24
+ setErrorId: A,
25
+ helperTextId: E,
26
+ setHelperTextId: g,
27
+ disabled: r,
28
+ readOnly: e,
29
+ isValid: s,
30
+ isLoading: l,
31
+ isRequired: n
32
+ },
33
+ children: d
34
+ }
35
+ ) });
36
+ }
37
+ );
38
+ _.displayName = "TextField";
39
+ const y = i.forwardRef((t, d) => {
40
+ var a;
41
+ const e = i.useContext(f), r = e == null ? void 0 : e.id;
42
+ return /* @__PURE__ */ o(
43
+ I.Input,
28
44
  {
29
- 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,
45
+ ...t,
46
+ "aria-describedby": [e == null ? void 0 : e.errorId, e == null ? void 0 : e.helperTextId].filter(Boolean).join(" "),
51
47
  disabled: e == null ? void 0 : e.disabled,
52
48
  readOnly: e == null ? void 0 : e.readOnly,
53
- required: e == null ? void 0 : e.isRequired
54
- };
55
- return _ ? /* @__PURE__ */ s("input", { ...r, ...m, ref: d }) : /* @__PURE__ */ s(y, { children: /* @__PURE__ */ s("input", { ...r, ...m, ref: d }) });
49
+ required: e == null ? void 0 : e.isRequired,
50
+ isLoading: e == null ? void 0 : e.isLoading,
51
+ validationState: e != null && e.isValid ? "valid" : (a = e == null ? void 0 : e.errors) != null && a.length ? "invalid" : void 0,
52
+ id: r,
53
+ ref: d
54
+ }
55
+ );
56
+ });
57
+ y.displayName = "TextField.Input";
58
+ const F = i.forwardRef((t, d) => /* @__PURE__ */ o(I, { ...t, ref: d }));
59
+ F.displayName = "TextField.InputGroup";
60
+ const b = i.forwardRef(
61
+ (t, d) => {
62
+ const e = i.useContext(f);
63
+ return /* @__PURE__ */ o(I.Indicator, { isValid: e == null ? void 0 : e.isValid, isLoading: e == null ? void 0 : e.isLoading, ...t, ref: d });
56
64
  }
57
65
  );
58
- 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`]],
66
+ b.displayName = "TextField.Indicator";
67
+ const v = i.forwardRef(
68
+ ({ className: t, ...d }, e) => {
69
+ const r = i.useContext(f), a = u([p[`${m}__label`]], t), s = d.id || (r == null ? void 0 : r.id);
70
+ return /* @__PURE__ */ o(
71
+ j,
79
72
  {
80
- [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
73
+ ...d,
74
+ isRequired: r == null ? void 0 : r.isRequired,
75
+ htmlFor: s,
76
+ disabled: r == null ? void 0 : r.disabled,
77
+ ref: e,
78
+ className: a
79
+ }
86
80
  );
87
- return /* @__PURE__ */ v("div", { ...d, onPointerDown: H, ref: t, className: o, children: [
88
- /* @__PURE__ */ s(F.Provider, { value: !0, children: r }),
89
- /* @__PURE__ */ s("div", { className: l[`${n}__frame`] })
90
- ] });
91
- }
92
- );
93
- y.displayName = "TextFieldDecorator";
94
- const N = a.forwardRef(
95
- ({ className: i, ...r }, d) => {
96
- const t = c([l[`${n}__label`]], i), e = a.useContext(u), o = r.id || (e == null ? void 0 : e.id);
97
- return /* @__PURE__ */ s(O, { ...r, htmlFor: o, disabled: e == null ? void 0 : e.disabled, ref: d, className: t });
98
- }
99
- );
100
- N.displayName = "TextFieldLabel";
101
- const b = a.forwardRef(
102
- ({ className: i, ...r }, d) => {
103
- const t = c([l[`${n}__help-text`]], i);
104
- return /* @__PURE__ */ s(L, { ...r, ref: d, className: t });
105
81
  }
106
82
  );
107
- 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))) });
83
+ v.displayName = "TextField.Label";
84
+ const x = i.forwardRef(
85
+ ({ className: t, ...d }, e) => {
86
+ const r = i.useContext(f), a = u([p[`${m}__help-text`]], t);
87
+ return i.useLayoutEffect(() => {
88
+ r == null || r.setHelperTextId(`${r.id}-helper-text`);
89
+ }, [r]), /* @__PURE__ */ o($, { id: r == null ? void 0 : r.helperTextId, ...d, ref: e, className: a });
116
90
  }
117
91
  );
118
- 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 });
92
+ x.displayName = "TextField.HelperText";
93
+ const L = i.forwardRef(
94
+ ({ className: t, children: d, ...e }, r) => {
95
+ const a = u([p[`${m}__error-list`]], t), s = i.useContext(f), l = s == null ? void 0 : s.errors;
96
+ return i.useLayoutEffect(() => {
97
+ if (!s)
98
+ return;
99
+ const n = l != null && l.length ? `${s.id}-error` : void 0;
100
+ s == null || s.setErrorId(n);
101
+ }, [l, s]), !s || !s.errors ? null : /* @__PURE__ */ o("ul", { id: s.errorId, "aria-live": "assertive", ...e, ref: r, className: a, children: typeof d == "function" ? d({ errors: l }) : d || (l == null ? void 0 : l.map((n) => /* @__PURE__ */ o(T, { asChild: !0, children: /* @__PURE__ */ H("li", { children: [
102
+ /* @__PURE__ */ o(T.Indicator, {}),
103
+ n
104
+ ] }) }, n))) });
128
105
  }
129
106
  );
130
- 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
107
+ L.displayName = "TextField.ErrorList";
108
+ const D = Object.assign(_, {
109
+ Input: y,
110
+ Label: v,
111
+ InputGroup: F,
112
+ HelperText: x,
113
+ ErrorList: L,
114
+ Indicator: b
138
115
  });
139
116
  export {
140
- J as TextField
117
+ D as TextField
141
118
  };
@@ -0,0 +1,2 @@
1
+ export { TextSpacing } from './text-spacing';
2
+ export type { TextSpacingProps } from './text-spacing';
@@ -0,0 +1,4 @@
1
+ import { TextSpacing as p } from "./text-spacing.js";
2
+ export {
3
+ p as TextSpacing
4
+ };