@telia/teddy 0.0.23 → 0.0.25

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 (186) hide show
  1. package/dist/components/accordion/accordion-content.cjs +32 -0
  2. package/dist/components/accordion/accordion-header.cjs +33 -0
  3. package/dist/components/accordion/accordion-indicator.cjs +16 -0
  4. package/dist/components/accordion/accordion-item.cjs +32 -0
  5. package/dist/components/accordion/accordion-root.cjs +56 -0
  6. package/dist/components/accordion/accordion-root.js +11 -11
  7. package/dist/components/accordion/accordion-title.cjs +15 -0
  8. package/dist/components/accordion/accordion-trigger.cjs +37 -0
  9. package/dist/components/accordion/index.cjs +25 -0
  10. package/dist/components/accordion/index.js +7 -0
  11. package/dist/components/badge/badge.cjs +43 -0
  12. package/dist/components/badge/index.cjs +4 -0
  13. package/dist/components/box/box.cjs +17 -0
  14. package/dist/components/box/index.cjs +4 -0
  15. package/dist/components/button/button.cjs +130 -0
  16. package/dist/components/button/button.js +24 -24
  17. package/dist/components/button/index.cjs +4 -0
  18. package/dist/components/card/card.cjs +219 -0
  19. package/dist/components/card/index.cjs +4 -0
  20. package/dist/components/chip/chip-indicator.cjs +16 -0
  21. package/dist/components/chip/chip-item.cjs +45 -0
  22. package/dist/components/chip/chip.cjs +48 -0
  23. package/dist/components/chip/index.cjs +10 -0
  24. package/dist/components/drawer/drawer-close.cjs +39 -0
  25. package/dist/components/drawer/drawer-content.cjs +42 -0
  26. package/dist/components/drawer/drawer-description.cjs +36 -0
  27. package/dist/components/drawer/drawer-footer.cjs +16 -0
  28. package/dist/components/drawer/drawer-overlay.cjs +43 -0
  29. package/dist/components/drawer/drawer-root.cjs +28 -0
  30. package/dist/components/drawer/drawer-title.cjs +34 -0
  31. package/dist/components/drawer/drawer-trigger.cjs +27 -0
  32. package/dist/components/drawer/index.cjs +20 -0
  33. package/dist/components/field-error-text/field-error-text.cjs +30 -0
  34. package/dist/components/field-error-text/index.cjs +4 -0
  35. package/dist/components/flex/flex.cjs +19 -0
  36. package/dist/components/flex/index.cjs +4 -0
  37. package/dist/components/grid/grid.cjs +19 -0
  38. package/dist/components/grid/index.cjs +4 -0
  39. package/dist/components/heading/heading.cjs +55 -0
  40. package/dist/components/heading/index.cjs +4 -0
  41. package/dist/components/helper-text/helper-text.cjs +21 -0
  42. package/dist/components/helper-text/helper-text.d.ts +2 -4
  43. package/dist/components/helper-text/index.cjs +4 -0
  44. package/dist/components/icon/AllIcons.cjs +1091 -0
  45. package/dist/components/icon/AllIcons.d.ts +2 -0
  46. package/dist/components/icon/AllIcons.js +1092 -0
  47. package/dist/components/icon/icon.cjs +29 -0
  48. package/dist/components/icon/index.cjs +8 -0
  49. package/dist/components/icon/index.d.ts +1 -0
  50. package/dist/components/icon/index.js +2 -0
  51. package/dist/components/image/image.cjs +17 -0
  52. package/dist/components/image/index.cjs +4 -0
  53. package/dist/components/index.cjs +66 -0
  54. package/dist/components/index.js +6 -3
  55. package/dist/components/input/index.cjs +14 -0
  56. package/dist/components/input/index.d.ts +27 -2
  57. package/dist/components/input/index.js +10 -1
  58. package/dist/components/input/input-clear-button.cjs +43 -0
  59. package/dist/components/input/input-clear-button.d.ts +6 -0
  60. package/dist/components/input/input-clear-button.js +43 -0
  61. package/dist/components/input/input-group.cjs +132 -0
  62. package/dist/components/input/input-group.d.ts +16 -0
  63. package/dist/components/input/input-group.js +132 -0
  64. package/dist/components/input/input-indicator.cjs +10 -0
  65. package/dist/components/input/input-indicator.d.ts +23 -0
  66. package/dist/components/input/input-indicator.js +10 -0
  67. package/dist/components/input/input.cjs +9 -0
  68. package/dist/components/input/input.d.ts +4 -28
  69. package/dist/components/input/input.js +7 -114
  70. package/dist/components/label/index.cjs +4 -0
  71. package/dist/components/label/label.cjs +44 -0
  72. package/dist/components/link/index.cjs +4 -0
  73. package/dist/components/link/link.cjs +37 -0
  74. package/dist/components/link/link.js +10 -10
  75. package/dist/components/modal/index.cjs +4 -0
  76. package/dist/components/modal/modal.cjs +209 -0
  77. package/dist/components/modal/modal.js +2 -2
  78. package/dist/components/navigation-menu/index.cjs +4 -0
  79. package/dist/components/navigation-menu/navigation-menu.cjs +410 -0
  80. package/dist/components/notification/index.cjs +4 -0
  81. package/dist/components/notification/notification.cjs +116 -0
  82. package/dist/components/notification/notification.js +8 -8
  83. package/dist/components/radio-group/index.cjs +4 -0
  84. package/dist/components/radio-group/radio-group.cjs +110 -0
  85. package/dist/components/scroll-area/index.cjs +9 -0
  86. package/dist/components/scroll-area/scroll-area-bar.cjs +175 -0
  87. package/dist/components/scroll-area/scroll-area-bar.js +8 -8
  88. package/dist/components/scroll-area/scroll-area-button.cjs +11 -0
  89. package/dist/components/scroll-area/scroll-area-corner.cjs +8 -0
  90. package/dist/components/scroll-area/scroll-area-item.cjs +42 -0
  91. package/dist/components/scroll-area/scroll-area-item.js +2 -1
  92. package/dist/components/scroll-area/scroll-area-root.cjs +11 -0
  93. package/dist/components/scroll-area/scroll-area-root.d.ts +11 -1
  94. package/dist/components/scroll-area/scroll-area-thumb.cjs +8 -0
  95. package/dist/components/spinner/index.cjs +4 -0
  96. package/dist/components/spinner/spinner.cjs +57 -0
  97. package/dist/components/tabs/index.cjs +16 -0
  98. package/dist/components/tabs/tabs-content.cjs +32 -0
  99. package/dist/components/tabs/tabs-list.cjs +39 -0
  100. package/dist/components/tabs/tabs-list.js +6 -4
  101. package/dist/components/tabs/tabs-root.cjs +75 -0
  102. package/dist/components/tabs/tabs-root.d.ts +4 -7
  103. package/dist/components/tabs/tabs-root.js +25 -8
  104. package/dist/components/tabs/tabs-scroll-button.cjs +15 -0
  105. package/dist/components/tabs/tabs-scroll.cjs +22 -0
  106. package/dist/components/tabs/tabs-trigger.cjs +55 -0
  107. package/dist/components/tabs/tabs-trigger.js +19 -9
  108. package/dist/components/text/index.cjs +4 -0
  109. package/dist/components/text/text.cjs +49 -0
  110. package/dist/components/text-field/index.cjs +31 -0
  111. package/dist/components/text-field/index.d.ts +63 -2
  112. package/dist/components/text-field/index.js +28 -1
  113. package/dist/components/text-field/text-field-button.cjs +31 -0
  114. package/dist/components/text-field/text-field-button.d.ts +27 -0
  115. package/dist/components/text-field/text-field-button.js +31 -0
  116. package/dist/components/text-field/text-field-clear-button.cjs +12 -0
  117. package/dist/components/text-field/text-field-clear-button.d.ts +6 -0
  118. package/dist/components/text-field/text-field-clear-button.js +12 -0
  119. package/dist/components/text-field/text-field-error-list.cjs +28 -0
  120. package/dist/components/text-field/text-field-error-list.d.ts +9 -0
  121. package/dist/components/text-field/text-field-error-list.js +28 -0
  122. package/dist/components/text-field/text-field-helper-text.cjs +19 -0
  123. package/dist/components/text-field/text-field-helper-text.d.ts +5 -0
  124. package/dist/components/text-field/text-field-helper-text.js +19 -0
  125. package/dist/components/text-field/text-field-indicator.cjs +14 -0
  126. package/dist/components/text-field/text-field-indicator.d.ts +6 -0
  127. package/dist/components/text-field/text-field-indicator.js +14 -0
  128. package/dist/components/text-field/text-field-input-group.cjs +11 -0
  129. package/dist/components/text-field/text-field-input-group.d.ts +7 -0
  130. package/dist/components/text-field/text-field-input-group.js +11 -0
  131. package/dist/components/text-field/text-field-input.cjs +27 -0
  132. package/dist/components/text-field/text-field-input.d.ts +5 -0
  133. package/dist/components/text-field/text-field-input.js +27 -0
  134. package/dist/components/text-field/text-field-label.cjs +27 -0
  135. package/dist/components/text-field/text-field-label.d.ts +8 -0
  136. package/dist/components/text-field/text-field-label.js +27 -0
  137. package/dist/components/text-field/text-field.cjs +54 -0
  138. package/dist/components/text-field/text-field.d.ts +12 -58
  139. package/dist/components/text-field/text-field.js +17 -101
  140. package/dist/components/text-field/util.cjs +4 -0
  141. package/dist/components/text-field/util.d.ts +1 -0
  142. package/dist/components/text-field/util.js +4 -0
  143. package/dist/components/text-spacing/index.cjs +4 -0
  144. package/dist/components/text-spacing/text-spacing.cjs +19 -0
  145. package/dist/components/toggle/index.cjs +4 -0
  146. package/dist/components/toggle/toggle.cjs +104 -0
  147. package/dist/components/visually-hidden/index.cjs +4 -0
  148. package/dist/components/visually-hidden/visually-hidden.cjs +26 -0
  149. package/dist/drawer.module-w9nGK9pO.cjs +13 -0
  150. package/dist/icons/category.cjs +335 -0
  151. package/dist/icons/name.cjs +335 -0
  152. package/dist/icons/name.d.cjs +1 -0
  153. package/dist/main.cjs +374 -0
  154. package/dist/main.js +6 -3
  155. package/dist/style.css +385 -323
  156. package/dist/tokens/border/variables.cjs +20 -0
  157. package/dist/tokens/breakpoint/variables.cjs +10 -0
  158. package/dist/tokens/color/variables.cjs +454 -0
  159. package/dist/tokens/index.cjs +310 -0
  160. package/dist/tokens/motion/variables.cjs +24 -0
  161. package/dist/tokens/shadow/variables.cjs +10 -0
  162. package/dist/tokens/spacing/variables.cjs +48 -0
  163. package/dist/tokens/typography/variables.cjs +50 -0
  164. package/dist/utils/action.cjs +21 -0
  165. package/dist/utils/component-props-as.cjs +1 -0
  166. package/dist/utils/composeEventHandlers.cjs +11 -0
  167. package/dist/utils/composeRefs.cjs +18 -0
  168. package/dist/utils/generate-styling/align.cjs +32 -0
  169. package/dist/utils/generate-styling/color.cjs +12 -0
  170. package/dist/utils/generate-styling/flex.cjs +67 -0
  171. package/dist/utils/generate-styling/gap.cjs +22 -0
  172. package/dist/utils/generate-styling/grid.cjs +123 -0
  173. package/dist/utils/generate-styling/height.cjs +51 -0
  174. package/dist/utils/generate-styling/index.cjs +97 -0
  175. package/dist/utils/generate-styling/inset.cjs +33 -0
  176. package/dist/utils/generate-styling/justify.cjs +18 -0
  177. package/dist/utils/generate-styling/margin.cjs +33 -0
  178. package/dist/utils/generate-styling/object-fit.cjs +18 -0
  179. package/dist/utils/generate-styling/padding.cjs +33 -0
  180. package/dist/utils/generate-styling/position.cjs +21 -0
  181. package/dist/utils/generate-styling/util.cjs +33 -0
  182. package/dist/utils/generate-styling/width.cjs +26 -0
  183. package/dist/vite-env.d.cjs +1 -0
  184. package/package.json +6 -4
  185. package/dist/components/text-field/tex-field-label.d.ts +0 -0
  186. package/dist/components/text-field/tex-field-label.js +0 -1
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const components_input_index = require("../input/index.cjs");
6
+ const components_textField_textField = require("./text-field.cjs");
7
+ const InputGroup = React.forwardRef((props, forwardRef) => {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(components_input_index.InputGroup, { ...props, ref: forwardRef, frameClassName: components_textField_textField.styles[`${components_textField_textField.rootClassName}__frame`] });
9
+ });
10
+ InputGroup.displayName = "InputGroup";
11
+ exports.InputGroup = InputGroup;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { InputGroupProps } from '../input';
3
+
4
+ export type TextFieldInputGroupProps = InputGroupProps['Root'];
5
+ export declare const InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
6
+ frameClassName?: string | undefined;
7
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,11 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default from "react";
3
+ import { InputGroup as InputGroup$1 } from "../input/index.js";
4
+ import { s as styles, rootClassName } from "./text-field.js";
5
+ const InputGroup = React__default.forwardRef((props, forwardRef) => {
6
+ return /* @__PURE__ */ jsx(InputGroup$1, { ...props, ref: forwardRef, frameClassName: styles[`${rootClassName}__frame`] });
7
+ });
8
+ InputGroup.displayName = "InputGroup";
9
+ export {
10
+ InputGroup
11
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const components_input_index = require("../input/index.cjs");
6
+ const components_textField_textField = require("./text-field.cjs");
7
+ const Input = React.forwardRef((props, forwardRef) => {
8
+ var _a;
9
+ const context = React.useContext(components_textField_textField.TextFieldContext);
10
+ const id = context == null ? void 0 : context.id;
11
+ return /* @__PURE__ */ jsxRuntime.jsx(
12
+ components_input_index.InputGroup.Input,
13
+ {
14
+ ...props,
15
+ "aria-describedby": [context == null ? void 0 : context.errorId, context == null ? void 0 : context.helperTextId].filter(Boolean).join(" "),
16
+ disabled: context == null ? void 0 : context.disabled,
17
+ readOnly: context == null ? void 0 : context.readOnly,
18
+ required: context == null ? void 0 : context.isRequired,
19
+ isLoading: context == null ? void 0 : context.isLoading,
20
+ validationState: (context == null ? void 0 : context.isValid) ? "valid" : ((_a = context == null ? void 0 : context.errors) == null ? void 0 : _a.length) ? "invalid" : void 0,
21
+ id,
22
+ ref: forwardRef
23
+ }
24
+ );
25
+ });
26
+ Input.displayName = "Input";
27
+ exports.Input = Input;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { InputGroupProps } from '../input';
3
+
4
+ export type TextFieldInputProps = Omit<InputGroupProps['Input'], 'id' | 'disabled' | 'readOnly' | 'required'>;
5
+ export declare const Input: React.ForwardRefExoticComponent<TextFieldInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,27 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default from "react";
3
+ import { InputGroup } from "../input/index.js";
4
+ import { TextFieldContext } from "./text-field.js";
5
+ const Input = React__default.forwardRef((props, forwardRef) => {
6
+ var _a;
7
+ const context = React__default.useContext(TextFieldContext);
8
+ const id = context == null ? void 0 : context.id;
9
+ return /* @__PURE__ */ jsx(
10
+ InputGroup.Input,
11
+ {
12
+ ...props,
13
+ "aria-describedby": [context == null ? void 0 : context.errorId, context == null ? void 0 : context.helperTextId].filter(Boolean).join(" "),
14
+ disabled: context == null ? void 0 : context.disabled,
15
+ readOnly: context == null ? void 0 : context.readOnly,
16
+ required: context == null ? void 0 : context.isRequired,
17
+ isLoading: context == null ? void 0 : context.isLoading,
18
+ validationState: (context == null ? void 0 : context.isValid) ? "valid" : ((_a = context == null ? void 0 : context.errors) == null ? void 0 : _a.length) ? "invalid" : void 0,
19
+ id,
20
+ ref: forwardRef
21
+ }
22
+ );
23
+ });
24
+ Input.displayName = "Input";
25
+ export {
26
+ Input
27
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const clsx = require("clsx");
5
+ const React = require("react");
6
+ const components_label_label = require("../label/label.cjs");
7
+ const components_textField_textField = require("./text-field.cjs");
8
+ const Label = React.forwardRef(
9
+ ({ className, ...props }, forwardRef) => {
10
+ const context = React.useContext(components_textField_textField.TextFieldContext);
11
+ const classes = clsx([components_textField_textField.styles[`${components_textField_textField.rootClassName}__label`]], className);
12
+ const id = props.id || (context == null ? void 0 : context.id);
13
+ return /* @__PURE__ */ jsxRuntime.jsx(
14
+ components_label_label.Label,
15
+ {
16
+ ...props,
17
+ isRequired: context == null ? void 0 : context.isRequired,
18
+ htmlFor: id,
19
+ disabled: context == null ? void 0 : context.disabled,
20
+ ref: forwardRef,
21
+ className: classes
22
+ }
23
+ );
24
+ }
25
+ );
26
+ Label.displayName = "Label";
27
+ exports.Label = Label;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { LabelProps } from '../label';
3
+
4
+ export type TextFieldLabelProps = LabelProps;
5
+ export declare const Label: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-label').LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & {
6
+ disabled?: boolean | undefined;
7
+ isRequired?: boolean | undefined;
8
+ } & React.RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,27 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import React__default from "react";
4
+ import { Label as Label$1 } from "../label/label.js";
5
+ import { TextFieldContext, s as styles, rootClassName } from "./text-field.js";
6
+ const Label = React__default.forwardRef(
7
+ ({ className, ...props }, forwardRef) => {
8
+ const context = React__default.useContext(TextFieldContext);
9
+ const classes = clsx([styles[`${rootClassName}__label`]], className);
10
+ const id = props.id || (context == null ? void 0 : context.id);
11
+ return /* @__PURE__ */ jsx(
12
+ Label$1,
13
+ {
14
+ ...props,
15
+ isRequired: context == null ? void 0 : context.isRequired,
16
+ htmlFor: id,
17
+ disabled: context == null ? void 0 : context.disabled,
18
+ ref: forwardRef,
19
+ className: classes
20
+ }
21
+ );
22
+ }
23
+ );
24
+ Label.displayName = "Label";
25
+ export {
26
+ Label
27
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const clsx = require("clsx");
5
+ const React = require("react");
6
+ const fadeInAnimation = "_fadeInAnimation_shhej_1";
7
+ const scaleInAnimation = "_scaleInAnimation_shhej_1";
8
+ const styles = {
9
+ "teddy-text-field": "_teddy-text-field_shhej_17",
10
+ "teddy-text-field__label": "_teddy-text-field__label_shhej_24",
11
+ "teddy-text-field__input-group": "_teddy-text-field__input-group_shhej_27",
12
+ "teddy-text-field__button--attached": "_teddy-text-field__button--attached_shhej_30",
13
+ "teddy-text-field__frame": "_teddy-text-field__frame_shhej_30",
14
+ "teddy-text-field__button": "_teddy-text-field__button_shhej_30",
15
+ "teddy-text-field__helper-text": "_teddy-text-field__helper-text_shhej_42",
16
+ "teddy-text-field__error-list": "_teddy-text-field__error-list_shhej_45",
17
+ fadeInAnimation,
18
+ scaleInAnimation
19
+ };
20
+ const rootClassName = "teddy-text-field";
21
+ const TextFieldContext = React.createContext(void 0);
22
+ const Root = React.forwardRef(
23
+ ({ className, children, readOnly, disabled, errors, isValid, isLoading, isRequired, ...props }, forwardRef) => {
24
+ const fallbackId = React.useId();
25
+ const id = props.id || fallbackId;
26
+ const classes = clsx([styles[rootClassName]], className);
27
+ const [helperTextId, setHelperTextId] = React.useState(void 0);
28
+ const [errorId, setErrorId] = React.useState(void 0);
29
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, ref: forwardRef, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(
30
+ TextFieldContext.Provider,
31
+ {
32
+ value: {
33
+ errors,
34
+ id,
35
+ errorId,
36
+ setErrorId,
37
+ helperTextId,
38
+ setHelperTextId,
39
+ disabled,
40
+ readOnly,
41
+ isValid,
42
+ isLoading,
43
+ isRequired
44
+ },
45
+ children
46
+ }
47
+ ) });
48
+ }
49
+ );
50
+ Root.displayName = "Root";
51
+ exports.Root = Root;
52
+ exports.TextFieldContext = TextFieldContext;
53
+ exports.rootClassName = rootClassName;
54
+ exports.styles = styles;
@@ -1,10 +1,10 @@
1
1
  import { default as React } from 'react';
2
- import { HelperTextProps } from '../helper-text';
3
- import { LabelProps } from '../label';
4
- import { InputGroupProps } from '../input';
2
+ import { InputIndicatorProps } from '../input/input-indicator';
3
+ import { indicatorFelidsInRoot } from './util';
5
4
 
5
+ export declare const rootClassName = "teddy-text-field";
6
6
  type ListOfErrors = Array<string | null | undefined> | null | undefined;
7
- type TextFieldContextValue = {
7
+ export type TextFieldContextValue = {
8
8
  id: string;
9
9
  errorId?: string;
10
10
  setErrorId: React.Dispatch<React.SetStateAction<string | undefined>>;
@@ -17,7 +17,8 @@ type TextFieldContextValue = {
17
17
  isLoading?: boolean;
18
18
  isRequired?: boolean;
19
19
  };
20
- type TextFieldRootProps = React.ComponentPropsWithoutRef<'div'> & {
20
+ export declare const TextFieldContext: React.Context<TextFieldContextValue | undefined>;
21
+ export type TextFieldRootProps = React.ComponentPropsWithoutRef<'div'> & Pick<InputIndicatorProps, (typeof indicatorFelidsInRoot)[number]> & {
21
22
  /**
22
23
  * Whether the input is disabled.
23
24
  */
@@ -27,31 +28,16 @@ type TextFieldRootProps = React.ComponentPropsWithoutRef<'div'> & {
27
28
  * List of errors
28
29
  */
29
30
  errors?: ListOfErrors;
30
- /**
31
- * Whether the input is invalid.
32
- */
33
- isValid?: boolean;
34
- /**
35
- * Whether the input is loading.
36
- */
37
- isLoading?: boolean;
38
31
  /**
39
32
  * Whether the input is required.
40
33
  */
41
34
  isRequired?: boolean;
42
35
  };
43
- type TextFieldInputProps = Omit<InputGroupProps['Input'], 'id' | 'disabled' | 'readOnly' | 'required'> & {};
44
- type TextFieldInputGroupProps = InputGroupProps['Root'] & {};
45
- type TextFieldIndicatorProps = InputGroupProps['Indicator'];
46
- type TextFieldLabelProps = LabelProps;
47
- type TextFieldHelperTextProps = HelperTextProps & {};
48
- type TextFieldErrorList = Omit<React.ComponentPropsWithoutRef<'ul'>, 'children'> & {
49
- children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
50
- };
51
- declare const TextFieldErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
52
- children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
53
- } & React.RefAttributes<HTMLUListElement>>;
54
- export declare const TextField: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
36
+ /**
37
+ * The root component of the text field.
38
+ * This components holds the state of the text field. All components that is needed can be extracted from it.
39
+ */
40
+ export declare const Root: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & Pick<InputIndicatorProps, "isLoading" | "isValid"> & {
55
41
  /**
56
42
  * Whether the input is disabled.
57
43
  */
@@ -61,41 +47,9 @@ export declare const TextField: React.ForwardRefExoticComponent<Omit<React.Detai
61
47
  * List of errors
62
48
  */
63
49
  errors?: ListOfErrors;
64
- /**
65
- * Whether the input is invalid.
66
- */
67
- isValid?: boolean | undefined;
68
- /**
69
- * Whether the input is loading.
70
- */
71
- isLoading?: boolean | undefined;
72
50
  /**
73
51
  * Whether the input is required.
74
52
  */
75
53
  isRequired?: boolean | undefined;
76
- } & React.RefAttributes<HTMLDivElement>> & {
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"> & {
79
- disabled?: boolean | undefined;
80
- isRequired?: boolean | undefined;
81
- } & React.RefAttributes<HTMLLabelElement>>;
82
- InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
83
- HelperText: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
84
- ErrorList: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "children"> & {
85
- children?: ((args: Pick<TextFieldContextValue, 'errors'>) => React.ReactNode) | React.ReactNode;
86
- } & React.RefAttributes<HTMLUListElement>>;
87
- Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
88
- isLoading?: boolean | undefined;
89
- isValid?: boolean | undefined;
90
- } & React.RefAttributes<SVGSVGElement>>;
91
- };
92
- export type TextFieldProps = {
93
- Root: TextFieldRootProps;
94
- Input: TextFieldInputProps;
95
- Label: TextFieldLabelProps;
96
- Group: TextFieldInputGroupProps;
97
- HelperText: TextFieldHelperTextProps;
98
- ErrorList: TextFieldErrorList;
99
- Indicator: TextFieldIndicatorProps;
100
- };
54
+ } & React.RefAttributes<HTMLDivElement>>;
101
55
  export {};
@@ -1,21 +1,23 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  import React__default from "react";
4
- import { FieldErrorText } from "../field-error-text/field-error-text.js";
5
- import { HelperText } from "../helper-text/helper-text.js";
6
- import { Label } from "../label/label.js";
7
- import { InputGroup } from "../input/input.js";
8
- const fadeInAnimation = "_fadeInAnimation_1i091_1";
9
- const scaleInAnimation = "_scaleInAnimation_1i091_1";
4
+ const fadeInAnimation = "_fadeInAnimation_shhej_1";
5
+ const scaleInAnimation = "_scaleInAnimation_shhej_1";
10
6
  const styles = {
11
- "teddy-text-field": "_teddy-text-field_1i091_17",
12
- "teddy-text-field__error-list": "_teddy-text-field__error-list_1i091_23",
7
+ "teddy-text-field": "_teddy-text-field_shhej_17",
8
+ "teddy-text-field__label": "_teddy-text-field__label_shhej_24",
9
+ "teddy-text-field__input-group": "_teddy-text-field__input-group_shhej_27",
10
+ "teddy-text-field__button--attached": "_teddy-text-field__button--attached_shhej_30",
11
+ "teddy-text-field__frame": "_teddy-text-field__frame_shhej_30",
12
+ "teddy-text-field__button": "_teddy-text-field__button_shhej_30",
13
+ "teddy-text-field__helper-text": "_teddy-text-field__helper-text_shhej_42",
14
+ "teddy-text-field__error-list": "_teddy-text-field__error-list_shhej_45",
13
15
  fadeInAnimation,
14
16
  scaleInAnimation
15
17
  };
16
18
  const rootClassName = "teddy-text-field";
17
19
  const TextFieldContext = React__default.createContext(void 0);
18
- const TextFieldRoot = React__default.forwardRef(
20
+ const Root = React__default.forwardRef(
19
21
  ({ className, children, readOnly, disabled, errors, isValid, isLoading, isRequired, ...props }, forwardRef) => {
20
22
  const fallbackId = React__default.useId();
21
23
  const id = props.id || fallbackId;
@@ -43,96 +45,10 @@ const TextFieldRoot = React__default.forwardRef(
43
45
  ) });
44
46
  }
45
47
  );
46
- TextFieldRoot.displayName = "TextField";
47
- const TextFieldInput = React__default.forwardRef((props, forwardRef) => {
48
- var _a;
49
- const context = React__default.useContext(TextFieldContext);
50
- const id = context == null ? void 0 : context.id;
51
- return /* @__PURE__ */ jsx(
52
- InputGroup.Input,
53
- {
54
- ...props,
55
- "aria-describedby": [context == null ? void 0 : context.errorId, context == null ? void 0 : context.helperTextId].filter(Boolean).join(" "),
56
- disabled: context == null ? void 0 : context.disabled,
57
- readOnly: context == null ? void 0 : context.readOnly,
58
- required: context == null ? void 0 : context.isRequired,
59
- isLoading: context == null ? void 0 : context.isLoading,
60
- validationState: (context == null ? void 0 : context.isValid) ? "valid" : ((_a = context == null ? void 0 : context.errors) == null ? void 0 : _a.length) ? "invalid" : void 0,
61
- id,
62
- ref: forwardRef
63
- }
64
- );
65
- });
66
- TextFieldInput.displayName = "TextField.Input";
67
- const TextFieldInputGroup = React__default.forwardRef((props, forwardRef) => {
68
- return /* @__PURE__ */ jsx(InputGroup, { ...props, ref: forwardRef });
69
- });
70
- TextFieldInputGroup.displayName = "TextField.InputGroup";
71
- const TextFieldIndicator = React__default.forwardRef(
72
- (props, forwardRef) => {
73
- const context = React__default.useContext(TextFieldContext);
74
- return /* @__PURE__ */ jsx(InputGroup.Indicator, { isValid: context == null ? void 0 : context.isValid, isLoading: context == null ? void 0 : context.isLoading, ...props, ref: forwardRef });
75
- }
76
- );
77
- TextFieldIndicator.displayName = "TextField.Indicator";
78
- const TextFieldLabel = React__default.forwardRef(
79
- ({ className, ...props }, forwardRef) => {
80
- const context = React__default.useContext(TextFieldContext);
81
- const classes = clsx([styles[`${rootClassName}__label`]], className);
82
- const id = props.id || (context == null ? void 0 : context.id);
83
- return /* @__PURE__ */ jsx(
84
- Label,
85
- {
86
- ...props,
87
- isRequired: context == null ? void 0 : context.isRequired,
88
- htmlFor: id,
89
- disabled: context == null ? void 0 : context.disabled,
90
- ref: forwardRef,
91
- className: classes
92
- }
93
- );
94
- }
95
- );
96
- TextFieldLabel.displayName = "TextField.Label";
97
- const TextFieldHelperText = React__default.forwardRef(
98
- ({ className, ...props }, forwardRef) => {
99
- const context = React__default.useContext(TextFieldContext);
100
- const classes = clsx([styles[`${rootClassName}__help-text`]], className);
101
- React__default.useEffect(() => {
102
- context == null ? void 0 : context.setHelperTextId(`${context.id}-helper-text`);
103
- }, [context]);
104
- return /* @__PURE__ */ jsx(HelperText, { id: context == null ? void 0 : context.helperTextId, ...props, ref: forwardRef, className: classes });
105
- }
106
- );
107
- TextFieldHelperText.displayName = "TextField.HelperText";
108
- const TextFieldErrorList = React__default.forwardRef(
109
- ({ className, children, ...props }, forwardRef) => {
110
- const classes = clsx([styles[`${rootClassName}__error-list`]], className);
111
- const context = React__default.useContext(TextFieldContext);
112
- const errors = context == null ? void 0 : context.errors;
113
- React__default.useEffect(() => {
114
- if (!context)
115
- return;
116
- const errorId = (errors == null ? void 0 : errors.length) ? `${context.id}-error` : void 0;
117
- context == null ? void 0 : context.setErrorId(errorId);
118
- }, [errors, context]);
119
- if (!context || !context.errors)
120
- return null;
121
- return /* @__PURE__ */ jsx("ul", { id: context.errorId, "aria-live": "assertive", ...props, ref: forwardRef, className: classes, children: typeof children === "function" ? children({ errors }) : children || (errors == null ? void 0 : errors.map((error) => /* @__PURE__ */ jsx(FieldErrorText, { asChild: true, children: /* @__PURE__ */ jsxs("li", { children: [
122
- /* @__PURE__ */ jsx(FieldErrorText.Indicator, {}),
123
- error
124
- ] }) }, error))) });
125
- }
126
- );
127
- TextFieldErrorList.displayName = "TextField.ErrorList";
128
- const TextField = Object.assign(TextFieldRoot, {
129
- Input: TextFieldInput,
130
- Label: TextFieldLabel,
131
- InputGroup: TextFieldInputGroup,
132
- HelperText: TextFieldHelperText,
133
- ErrorList: TextFieldErrorList,
134
- Indicator: TextFieldIndicator
135
- });
48
+ Root.displayName = "Root";
136
49
  export {
137
- TextField
50
+ Root,
51
+ TextFieldContext,
52
+ rootClassName,
53
+ styles as s
138
54
  };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const indicatorFelidsInRoot = ["isValid", "isLoading"];
4
+ exports.indicatorFelidsInRoot = indicatorFelidsInRoot;
@@ -0,0 +1 @@
1
+ export declare const indicatorFelidsInRoot: ["isValid", "isLoading"];
@@ -0,0 +1,4 @@
1
+ const indicatorFelidsInRoot = ["isValid", "isLoading"];
2
+ export {
3
+ indicatorFelidsInRoot
4
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_textSpacing_textSpacing = require("./text-spacing.cjs");
4
+ exports.TextSpacing = components_textSpacing_textSpacing.TextSpacing;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const clsx = require("clsx");
5
+ const React = require("react");
6
+ const reactSlot = require("@radix-ui/react-slot");
7
+ const styles = {
8
+ "teddy-text-spacing": "_teddy-text-spacing_dwbo8_1"
9
+ };
10
+ const rootClassName = "teddy-text-spacing";
11
+ const TextSpacing = React.forwardRef(
12
+ ({ className, asChild = false, children, ...props }, forwardRef) => {
13
+ const Comp = asChild ? reactSlot.Slot : "div";
14
+ const classes = clsx([styles[`${rootClassName}`]], className);
15
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...props, ref: forwardRef, className: classes, children });
16
+ }
17
+ );
18
+ TextSpacing.displayName = "TextSpacing";
19
+ exports.TextSpacing = TextSpacing;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_toggle_toggle = require("./toggle.cjs");
4
+ exports.Toggle = components_toggle_toggle.Toggle;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const clsx = require("clsx");
6
+ const SwitchPrimitive = require("@radix-ui/react-switch");
7
+ require("../../assets/sprite.5636ec8e-teddy.svg");
8
+ const components_icon_icon = require("../icon/icon.cjs");
9
+ const components_label_label = require("../label/label.cjs");
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const SwitchPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(SwitchPrimitive);
27
+ const styles = {
28
+ "teddy-toggle": "_teddy-toggle_1rp8d_3",
29
+ "teddy-toggle__input": "_teddy-toggle__input_1rp8d_10",
30
+ "teddy-toggle__thumb": "_teddy-toggle__thumb_1rp8d_78",
31
+ "teddy-toggle__indicator": "_teddy-toggle__indicator_1rp8d_104"
32
+ };
33
+ const rootClassName = "teddy-toggle";
34
+ const ToggleContext = React.createContext(void 0);
35
+ const ToggleRoot = React.forwardRef(
36
+ ({ className, id, children, ...props }, forwardRef) => {
37
+ const classes = clsx([styles[`${rootClassName}`]], className);
38
+ const fallbackId = React.useId();
39
+ const [isDisabled, setIsDisabled] = React.useState(false);
40
+ const [isRequired, setIsRequired] = React.useState(false);
41
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, ref: forwardRef, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx(ToggleContext.Provider, { value: { id: id ?? fallbackId, isDisabled, setIsDisabled, isRequired, setIsRequired }, children }) });
42
+ }
43
+ );
44
+ ToggleRoot.displayName = "Toggle";
45
+ const ToggleLabel = React.forwardRef(
46
+ ({ className, ...props }, forwardRef) => {
47
+ const classes = clsx([styles[`${rootClassName}__label`]], className);
48
+ const context = React.useContext(ToggleContext);
49
+ return /* @__PURE__ */ jsxRuntime.jsx(
50
+ components_label_label.Label,
51
+ {
52
+ ...props,
53
+ htmlFor: context == null ? void 0 : context.id,
54
+ isRequired: context == null ? void 0 : context.isRequired,
55
+ disabled: context == null ? void 0 : context.isDisabled,
56
+ ref: forwardRef,
57
+ className: classes
58
+ }
59
+ );
60
+ }
61
+ );
62
+ ToggleLabel.displayName = "Toggle.Label";
63
+ const ToggleInput = React.forwardRef(
64
+ ({ className, children, ...props }, forwardRef) => {
65
+ const classes = clsx([styles[`${rootClassName}__input`]], className);
66
+ const context = React.useContext(ToggleContext);
67
+ React.useEffect(() => {
68
+ if (!context)
69
+ return;
70
+ context.setIsDisabled(props.disabled === true);
71
+ }, [context, props.disabled]);
72
+ React.useEffect(() => {
73
+ if (!context)
74
+ return;
75
+ context.setIsRequired(props.required === true);
76
+ }, [context, props.required]);
77
+ return /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitive__namespace.Root, { ...props, id: context == null ? void 0 : context.id, ref: forwardRef, className: classes, children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
78
+ /* @__PURE__ */ jsxRuntime.jsx(ToggleThumb, {}),
79
+ /* @__PURE__ */ jsxRuntime.jsx(ToggleIndicator, {})
80
+ ] }) });
81
+ }
82
+ );
83
+ ToggleInput.displayName = "Toggle.Input";
84
+ const ToggleThumb = React.forwardRef(
85
+ ({ className, ...props }, forwardRef) => {
86
+ const classes = clsx([styles[`${rootClassName}__thumb`]], className);
87
+ return /* @__PURE__ */ jsxRuntime.jsx(SwitchPrimitive__namespace.Thumb, { ...props, ref: forwardRef, className: classes });
88
+ }
89
+ );
90
+ ToggleThumb.displayName = "Toggle.Thumb";
91
+ const ToggleIndicator = React.forwardRef(
92
+ ({ className, ...props }, forwardRef) => {
93
+ const classes = clsx([styles[`${rootClassName}__indicator`]], className);
94
+ return /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "checkmark-bold", size: "xxs", ...props, ref: forwardRef, className: classes });
95
+ }
96
+ );
97
+ ToggleThumb.displayName = "Toggle.Indicator";
98
+ const Toggle = Object.assign(ToggleRoot, {
99
+ Label: ToggleLabel,
100
+ Input: ToggleInput,
101
+ Thumb: ToggleThumb,
102
+ Indicator: ToggleIndicator
103
+ });
104
+ exports.Toggle = Toggle;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_visuallyHidden_visuallyHidden = require("./visually-hidden.cjs");
4
+ exports.VisuallyHidden = components_visuallyHidden_visuallyHidden.VisuallyHidden;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const clsx = require("clsx");
5
+ const React = require("react");
6
+ const reactSlot = require("@radix-ui/react-slot");
7
+ const styles = {
8
+ "teddy-visually-hidden": "_teddy-visually-hidden_15nus_1",
9
+ "teddy-visually-hidden--focusable": "_teddy-visually-hidden--focusable_15nus_15"
10
+ };
11
+ const rootClassName = "teddy-visually-hidden";
12
+ const VisuallyHidden = React.forwardRef(
13
+ ({ className, visibleOnFocus, asChild, ...props }, forwardRef) => {
14
+ const Comp = asChild ? reactSlot.Slot : "span";
15
+ const classes = clsx(
16
+ {
17
+ [styles[`${rootClassName}`]]: !visibleOnFocus,
18
+ [styles[`${rootClassName}--focusable`]]: visibleOnFocus
19
+ },
20
+ className
21
+ );
22
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...props, ref: forwardRef, className: classes });
23
+ }
24
+ );
25
+ VisuallyHidden.displayName = "VisuallyHidden";
26
+ exports.VisuallyHidden = VisuallyHidden;