@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.
- 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 +77 -0
- package/dist/components/grid/grid.js +393 -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 +1 -1
- 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 +12 -0
- package/dist/utils/layout.js +11 -0
- package/package.json +23 -22
- 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,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,4 @@
|
|
|
1
|
-
import
|
|
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
|
-
},
|
|
22
|
+
}, y = {
|
|
23
23
|
XXS: "xxs",
|
|
24
24
|
XS: "xs",
|
|
25
25
|
SM: "sm",
|
|
26
26
|
MD: "md",
|
|
27
27
|
LG: "lg"
|
|
28
|
-
},
|
|
29
|
-
({ size: n =
|
|
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
|
-
|
|
49
|
+
q as Spinner
|
|
50
50
|
};
|
|
@@ -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
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
3
|
type AsChildProps = {
|
|
4
4
|
asChild: true;
|
|
5
5
|
as?: never;
|
|
6
|
-
} & React.ComponentPropsWithoutRef<'
|
|
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 =
|
|
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
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @default 'paragraph-100'
|
|
32
|
+
*/
|
|
33
|
+
variant?: TextVariant;
|
|
28
34
|
} & (AsChildProps | SpanProps | DivProps | LabelProps | PProps);
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
1
|
+
import '../../assets/text.css';
|
|
2
2
|
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { $ as l } from "../../index-DpfSJps6.js";
|
|
4
4
|
import { c as n } from "../../clsx-DB4S2d7J.js";
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
"teddy-text": "_teddy-
|
|
8
|
-
"teddy-text--disabled": "_teddy-text--
|
|
9
|
-
"teddy-text--hyphens": "_teddy-text--
|
|
10
|
-
"teddy-text--paragraph-100": "_teddy-text--paragraph-
|
|
11
|
-
"teddy-text--paragraph-100-medium": "_teddy-text--paragraph-100-
|
|
12
|
-
"teddy-text--paragraph-100-bold": "_teddy-text--paragraph-100-
|
|
13
|
-
"teddy-text--paragraph-200": "_teddy-text--paragraph-
|
|
14
|
-
"teddy-text--preamble-100": "_teddy-text--preamble-
|
|
15
|
-
"teddy-text--preamble-200": "_teddy-text--preamble-
|
|
16
|
-
"teddy-text--additional-100": "_teddy-text--additional-
|
|
17
|
-
"teddy-text--additional-100-medium": "_teddy-text--additional-100-
|
|
18
|
-
"teddy-text--overline-100": "_teddy-text--overline-
|
|
19
|
-
"teddy-text--overline-200": "_teddy-text--overline-
|
|
20
|
-
},
|
|
21
|
-
"paragraph-100",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
[
|
|
38
|
-
[
|
|
26
|
+
[t[`${e}--hyphens`]]: _,
|
|
27
|
+
[t[`${e}--disabled`]]: r
|
|
39
28
|
},
|
|
40
29
|
p
|
|
41
30
|
);
|
|
42
|
-
return /* @__PURE__ */ a(
|
|
31
|
+
return /* @__PURE__ */ a(l, { ...o, ref: s, className: i, children: x ? d : /* @__PURE__ */ a(y, { children: d }) });
|
|
43
32
|
}
|
|
44
33
|
);
|
|
45
|
-
|
|
46
|
-
const v = Object.assign(r, {
|
|
47
|
-
paragraphVariants: h
|
|
48
|
-
});
|
|
34
|
+
h.displayName = "Text";
|
|
49
35
|
export {
|
|
50
|
-
|
|
36
|
+
h as Text
|
|
51
37
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
-
}
|
|
44
|
-
type TextFieldInputProps = Omit<
|
|
45
|
-
type
|
|
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?:
|
|
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<
|
|
82
|
-
Label: React.ForwardRefExoticComponent<Omit<import(
|
|
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
|
-
|
|
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?:
|
|
85
|
+
children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
|
|
89
86
|
} & React.RefAttributes<HTMLUListElement>>;
|
|
90
|
-
Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> &
|
|
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
|
|
93
|
-
Root: TextFieldRootProps
|
|
92
|
+
export type TextFieldProps = {
|
|
93
|
+
Root: TextFieldRootProps;
|
|
94
94
|
Input: TextFieldInputProps;
|
|
95
95
|
Label: TextFieldLabelProps;
|
|
96
|
-
|
|
96
|
+
Group: TextFieldInputGroupProps;
|
|
97
97
|
HelperText: TextFieldHelperTextProps;
|
|
98
98
|
ErrorList: TextFieldErrorList;
|
|
99
99
|
Indicator: TextFieldIndicatorProps;
|
|
@@ -1,141 +1,118 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c } from "../../clsx-DB4S2d7J.js";
|
|
4
|
-
import
|
|
5
|
-
import { FieldErrorText as
|
|
6
|
-
import { HelperText as
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
108
|
-
const
|
|
109
|
-
({ className:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
119
|
-
const
|
|
120
|
-
({ className:
|
|
121
|
-
const t =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
131
|
-
const
|
|
132
|
-
Input:
|
|
133
|
-
Label:
|
|
134
|
-
|
|
135
|
-
HelperText:
|
|
136
|
-
ErrorList:
|
|
137
|
-
Indicator:
|
|
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
|
-
|
|
117
|
+
D as TextField
|
|
141
118
|
};
|