@telia/teddy 0.0.24 → 0.0.26

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 (205) 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-close.d.ts +0 -3
  26. package/dist/components/drawer/drawer-close.js +1 -1
  27. package/dist/components/drawer/drawer-content.cjs +42 -0
  28. package/dist/components/drawer/drawer-content.d.ts +0 -3
  29. package/dist/components/drawer/drawer-content.js +1 -1
  30. package/dist/components/drawer/drawer-description.cjs +36 -0
  31. package/dist/components/drawer/drawer-description.d.ts +0 -3
  32. package/dist/components/drawer/drawer-description.js +1 -1
  33. package/dist/components/drawer/drawer-footer.cjs +16 -0
  34. package/dist/components/drawer/drawer-footer.d.ts +0 -3
  35. package/dist/components/drawer/drawer-footer.js +1 -1
  36. package/dist/components/drawer/drawer-overlay.cjs +43 -0
  37. package/dist/components/drawer/drawer-overlay.d.ts +0 -3
  38. package/dist/components/drawer/drawer-overlay.js +1 -1
  39. package/dist/components/drawer/drawer-root.cjs +28 -0
  40. package/dist/components/drawer/drawer-root.d.ts +1 -1
  41. package/dist/components/drawer/drawer-title.cjs +34 -0
  42. package/dist/components/drawer/drawer-title.d.ts +4 -3
  43. package/dist/components/drawer/drawer-title.js +1 -1
  44. package/dist/components/drawer/drawer-trigger.cjs +27 -0
  45. package/dist/components/drawer/drawer-trigger.d.ts +5 -3
  46. package/dist/components/drawer/index.cjs +28 -0
  47. package/dist/components/drawer/index.d.ts +28 -0
  48. package/dist/components/drawer/index.js +8 -0
  49. package/dist/components/field-error-text/field-error-text.cjs +30 -0
  50. package/dist/components/field-error-text/index.cjs +4 -0
  51. package/dist/components/flex/flex.cjs +19 -0
  52. package/dist/components/flex/index.cjs +4 -0
  53. package/dist/components/grid/grid.cjs +19 -0
  54. package/dist/components/grid/index.cjs +4 -0
  55. package/dist/components/heading/heading.cjs +55 -0
  56. package/dist/components/heading/index.cjs +4 -0
  57. package/dist/components/helper-text/helper-text.cjs +21 -0
  58. package/dist/components/helper-text/helper-text.d.ts +2 -4
  59. package/dist/components/helper-text/index.cjs +4 -0
  60. package/dist/components/icon/AllIcons.cjs +1091 -0
  61. package/dist/components/icon/AllIcons.d.ts +2 -0
  62. package/dist/components/icon/AllIcons.js +1092 -0
  63. package/dist/components/icon/icon.cjs +29 -0
  64. package/dist/components/icon/index.cjs +8 -0
  65. package/dist/components/icon/index.d.ts +1 -0
  66. package/dist/components/icon/index.js +2 -0
  67. package/dist/components/image/image.cjs +17 -0
  68. package/dist/components/image/index.cjs +4 -0
  69. package/dist/components/index.cjs +66 -0
  70. package/dist/components/index.js +6 -3
  71. package/dist/components/input/index.cjs +14 -0
  72. package/dist/components/input/index.d.ts +27 -2
  73. package/dist/components/input/index.js +10 -1
  74. package/dist/components/input/input-clear-button.cjs +43 -0
  75. package/dist/components/input/input-clear-button.d.ts +6 -0
  76. package/dist/components/input/input-clear-button.js +43 -0
  77. package/dist/components/input/input-group.cjs +132 -0
  78. package/dist/components/input/input-group.d.ts +16 -0
  79. package/dist/components/input/input-group.js +132 -0
  80. package/dist/components/input/input-indicator.cjs +10 -0
  81. package/dist/components/input/input-indicator.d.ts +23 -0
  82. package/dist/components/input/input-indicator.js +10 -0
  83. package/dist/components/input/input.cjs +9 -0
  84. package/dist/components/input/input.d.ts +4 -28
  85. package/dist/components/input/input.js +7 -114
  86. package/dist/components/label/index.cjs +4 -0
  87. package/dist/components/label/label.cjs +44 -0
  88. package/dist/components/link/index.cjs +4 -0
  89. package/dist/components/link/link.cjs +37 -0
  90. package/dist/components/link/link.js +10 -10
  91. package/dist/components/modal/index.cjs +4 -0
  92. package/dist/components/modal/modal.cjs +210 -0
  93. package/dist/components/modal/modal.js +17 -16
  94. package/dist/components/navigation-menu/index.cjs +4 -0
  95. package/dist/components/navigation-menu/navigation-menu.cjs +412 -0
  96. package/dist/components/navigation-menu/navigation-menu.d.ts +2 -0
  97. package/dist/components/navigation-menu/navigation-menu.js +24 -22
  98. package/dist/components/notification/index.cjs +4 -0
  99. package/dist/components/notification/notification.cjs +116 -0
  100. package/dist/components/notification/notification.js +8 -8
  101. package/dist/components/radio-group/index.cjs +4 -0
  102. package/dist/components/radio-group/radio-group.cjs +110 -0
  103. package/dist/components/scroll-area/index.cjs +9 -0
  104. package/dist/components/scroll-area/scroll-area-bar.cjs +175 -0
  105. package/dist/components/scroll-area/scroll-area-bar.js +8 -8
  106. package/dist/components/scroll-area/scroll-area-button.cjs +11 -0
  107. package/dist/components/scroll-area/scroll-area-corner.cjs +8 -0
  108. package/dist/components/scroll-area/scroll-area-item.cjs +42 -0
  109. package/dist/components/scroll-area/scroll-area-item.js +2 -1
  110. package/dist/components/scroll-area/scroll-area-root.cjs +11 -0
  111. package/dist/components/scroll-area/scroll-area-thumb.cjs +8 -0
  112. package/dist/components/spinner/index.cjs +4 -0
  113. package/dist/components/spinner/spinner.cjs +57 -0
  114. package/dist/components/tabs/index.cjs +16 -0
  115. package/dist/components/tabs/tabs-content.cjs +32 -0
  116. package/dist/components/tabs/tabs-list.cjs +39 -0
  117. package/dist/components/tabs/tabs-list.js +6 -4
  118. package/dist/components/tabs/tabs-root.cjs +75 -0
  119. package/dist/components/tabs/tabs-root.d.ts +4 -7
  120. package/dist/components/tabs/tabs-root.js +25 -8
  121. package/dist/components/tabs/tabs-scroll-button.cjs +15 -0
  122. package/dist/components/tabs/tabs-scroll.cjs +22 -0
  123. package/dist/components/tabs/tabs-trigger.cjs +55 -0
  124. package/dist/components/tabs/tabs-trigger.js +19 -9
  125. package/dist/components/text/index.cjs +4 -0
  126. package/dist/components/text/text.cjs +49 -0
  127. package/dist/components/text-field/index.cjs +31 -0
  128. package/dist/components/text-field/index.d.ts +63 -2
  129. package/dist/components/text-field/index.js +28 -1
  130. package/dist/components/text-field/text-field-button.cjs +31 -0
  131. package/dist/components/text-field/text-field-button.d.ts +27 -0
  132. package/dist/components/text-field/text-field-button.js +31 -0
  133. package/dist/components/text-field/text-field-clear-button.cjs +12 -0
  134. package/dist/components/text-field/text-field-clear-button.d.ts +6 -0
  135. package/dist/components/text-field/text-field-clear-button.js +12 -0
  136. package/dist/components/text-field/text-field-error-list.cjs +28 -0
  137. package/dist/components/text-field/text-field-error-list.d.ts +9 -0
  138. package/dist/components/text-field/text-field-error-list.js +28 -0
  139. package/dist/components/text-field/text-field-helper-text.cjs +19 -0
  140. package/dist/components/text-field/text-field-helper-text.d.ts +5 -0
  141. package/dist/components/text-field/text-field-helper-text.js +19 -0
  142. package/dist/components/text-field/text-field-indicator.cjs +14 -0
  143. package/dist/components/text-field/text-field-indicator.d.ts +6 -0
  144. package/dist/components/text-field/text-field-indicator.js +14 -0
  145. package/dist/components/text-field/text-field-input-group.cjs +11 -0
  146. package/dist/components/text-field/text-field-input-group.d.ts +7 -0
  147. package/dist/components/text-field/text-field-input-group.js +11 -0
  148. package/dist/components/text-field/text-field-input.cjs +27 -0
  149. package/dist/components/text-field/text-field-input.d.ts +5 -0
  150. package/dist/components/text-field/text-field-input.js +27 -0
  151. package/dist/components/text-field/text-field-label.cjs +27 -0
  152. package/dist/components/text-field/text-field-label.d.ts +8 -0
  153. package/dist/components/text-field/text-field-label.js +27 -0
  154. package/dist/components/text-field/text-field.cjs +54 -0
  155. package/dist/components/text-field/text-field.d.ts +12 -58
  156. package/dist/components/text-field/text-field.js +17 -101
  157. package/dist/components/text-field/util.cjs +4 -0
  158. package/dist/components/text-field/util.d.ts +1 -0
  159. package/dist/components/text-field/util.js +4 -0
  160. package/dist/components/text-spacing/index.cjs +4 -0
  161. package/dist/components/text-spacing/text-spacing.cjs +19 -0
  162. package/dist/components/toggle/index.cjs +4 -0
  163. package/dist/components/toggle/toggle.cjs +104 -0
  164. package/dist/components/visually-hidden/index.cjs +4 -0
  165. package/dist/components/visually-hidden/visually-hidden.cjs +26 -0
  166. package/dist/drawer.module-BxsrDZFu.js +14 -0
  167. package/dist/drawer.module-CWDhohQm.cjs +13 -0
  168. package/dist/icons/category.cjs +335 -0
  169. package/dist/icons/name.cjs +335 -0
  170. package/dist/icons/name.d.cjs +1 -0
  171. package/dist/main.cjs +374 -0
  172. package/dist/main.js +6 -3
  173. package/dist/style.css +573 -492
  174. package/dist/tokens/border/variables.cjs +20 -0
  175. package/dist/tokens/breakpoint/variables.cjs +10 -0
  176. package/dist/tokens/color/variables.cjs +454 -0
  177. package/dist/tokens/index.cjs +310 -0
  178. package/dist/tokens/motion/variables.cjs +24 -0
  179. package/dist/tokens/shadow/variables.cjs +10 -0
  180. package/dist/tokens/spacing/variables.cjs +48 -0
  181. package/dist/tokens/typography/variables.cjs +50 -0
  182. package/dist/utils/action.cjs +21 -0
  183. package/dist/utils/component-props-as.cjs +1 -0
  184. package/dist/utils/composeEventHandlers.cjs +11 -0
  185. package/dist/utils/composeRefs.cjs +18 -0
  186. package/dist/utils/generate-styling/align.cjs +32 -0
  187. package/dist/utils/generate-styling/color.cjs +12 -0
  188. package/dist/utils/generate-styling/flex.cjs +67 -0
  189. package/dist/utils/generate-styling/gap.cjs +22 -0
  190. package/dist/utils/generate-styling/grid.cjs +123 -0
  191. package/dist/utils/generate-styling/height.cjs +51 -0
  192. package/dist/utils/generate-styling/index.cjs +97 -0
  193. package/dist/utils/generate-styling/inset.cjs +33 -0
  194. package/dist/utils/generate-styling/justify.cjs +18 -0
  195. package/dist/utils/generate-styling/margin.cjs +33 -0
  196. package/dist/utils/generate-styling/object-fit.cjs +18 -0
  197. package/dist/utils/generate-styling/padding.cjs +33 -0
  198. package/dist/utils/generate-styling/position.cjs +21 -0
  199. package/dist/utils/generate-styling/util.cjs +33 -0
  200. package/dist/utils/generate-styling/width.cjs +26 -0
  201. package/dist/vite-env.d.cjs +1 -0
  202. package/package.json +6 -4
  203. package/dist/components/text-field/tex-field-label.d.ts +0 -0
  204. package/dist/components/text-field/tex-field-label.js +0 -1
  205. package/dist/drawer.module-B3QhrxH1.js +0 -14
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const iconsHref = require("../../assets/sprite.5636ec8e-teddy.svg");
5
+ const clsx = require("clsx");
6
+ const styles = {
7
+ "teddy-icon": "_teddy-icon_1rwgf_2",
8
+ "teddy-icon--font": "_teddy-icon--font_1rwgf_7",
9
+ "teddy-icon--xxs": "_teddy-icon--xxs_1rwgf_11",
10
+ "teddy-icon--xs": "_teddy-icon--xs_1rwgf_15",
11
+ "teddy-icon--sm": "_teddy-icon--sm_1rwgf_19",
12
+ "teddy-icon--md": "_teddy-icon--md_1rwgf_23",
13
+ "teddy-icon--lg": "_teddy-icon--lg_1rwgf_27",
14
+ "teddy-icon--xl": "_teddy-icon--xl_1rwgf_31",
15
+ "teddy-icon-with-children": "_teddy-icon-with-children_1rwgf_35"
16
+ };
17
+ const rootClassName = "teddy-icon";
18
+ const rootClassNameWithChildren = `${rootClassName}-with-children`;
19
+ function Icon({ name, size = "font", className, children, ...props }) {
20
+ if (children) {
21
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: clsx([styles[rootClassNameWithChildren]]), children: [
22
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { name, size, className, ...props }),
23
+ children
24
+ ] });
25
+ }
26
+ const classes = clsx([styles[rootClassName], styles[`${rootClassName}--${size}`]], className);
27
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { ...props, className: classes, children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: `${iconsHref}#${name}` }) });
28
+ }
29
+ exports.Icon = Icon;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const iconsHref = require("../../assets/sprite.5636ec8e-teddy.svg");
4
+ const components_icon_icon = require("./icon.cjs");
5
+ const components_icon_AllIcons = require("./AllIcons.cjs");
6
+ exports.iconsHref = iconsHref;
7
+ exports.Icon = components_icon_icon.Icon;
8
+ exports.AllIcons = components_icon_AllIcons;
@@ -1,5 +1,6 @@
1
1
  import { default as iconsHref } from '../../icons/sprite.svg';
2
2
 
3
3
  export { Icon } from './icon';
4
+ export { default as AllIcons } from './AllIcons';
4
5
  export type { IconName, IconProps } from './icon';
5
6
  export { iconsHref };
@@ -1,6 +1,8 @@
1
1
  import { default as default2 } from "../../assets/sprite.5636ec8e-teddy.svg";
2
2
  import { Icon } from "./icon.js";
3
+ import { default as default3 } from "./AllIcons.js";
3
4
  export {
5
+ default3 as AllIcons,
4
6
  Icon,
5
7
  default2 as iconsHref
6
8
  };
@@ -0,0 +1,17 @@
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 utils_generateStyling_index = require("../../utils/generate-styling/index.cjs");
7
+ const styles = {
8
+ "teddy-image": "_teddy-image_oyxp8_1"
9
+ };
10
+ const rootClassName = "teddy-image";
11
+ const Image = React.forwardRef((props, forwardRef) => {
12
+ const { className, ...rest } = utils_generateStyling_index.extractProps(props);
13
+ const classes = clsx([styles[`${rootClassName}`]], className);
14
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { ...rest, ref: forwardRef, className: classes });
15
+ });
16
+ Image.displayName = "Image";
17
+ exports.Image = Image;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_image_image = require("./image.cjs");
4
+ exports.Image = components_image_image.Image;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_scrollArea_index = require("./scroll-area/index.cjs");
4
+ const components_tabs_index = require("./tabs/index.cjs");
5
+ const components_drawer_index = require("./drawer/index.cjs");
6
+ const components_image_image = require("./image/image.cjs");
7
+ const components_chip_index = require("./chip/index.cjs");
8
+ const components_modal_modal = require("./modal/modal.cjs");
9
+ const components_notification_notification = require("./notification/notification.cjs");
10
+ const components_radioGroup_radioGroup = require("./radio-group/radio-group.cjs");
11
+ const components_box_box = require("./box/box.cjs");
12
+ const components_flex_flex = require("./flex/flex.cjs");
13
+ const components_card_card = require("./card/card.cjs");
14
+ const components_grid_grid = require("./grid/grid.cjs");
15
+ const components_navigationMenu_navigationMenu = require("./navigation-menu/navigation-menu.cjs");
16
+ const components_toggle_toggle = require("./toggle/toggle.cjs");
17
+ const components_accordion_index = require("./accordion/index.cjs");
18
+ const components_link_link = require("./link/link.cjs");
19
+ const components_badge_badge = require("./badge/badge.cjs");
20
+ const components_button_button = require("./button/button.cjs");
21
+ const components_fieldErrorText_fieldErrorText = require("./field-error-text/field-error-text.cjs");
22
+ const components_helperText_helperText = require("./helper-text/helper-text.cjs");
23
+ const iconsHref = require("../assets/sprite.5636ec8e-teddy.svg");
24
+ const components_icon_icon = require("./icon/icon.cjs");
25
+ const components_icon_AllIcons = require("./icon/AllIcons.cjs");
26
+ const components_input_index = require("./input/index.cjs");
27
+ const components_label_label = require("./label/label.cjs");
28
+ const components_spinner_spinner = require("./spinner/spinner.cjs");
29
+ const components_text_text = require("./text/text.cjs");
30
+ const components_textField_index = require("./text-field/index.cjs");
31
+ const components_heading_heading = require("./heading/heading.cjs");
32
+ const components_visuallyHidden_visuallyHidden = require("./visually-hidden/visually-hidden.cjs");
33
+ const components_textSpacing_textSpacing = require("./text-spacing/text-spacing.cjs");
34
+ const components_input_inputGroup = require("./input/input-group.cjs");
35
+ exports.ScrollArea = components_scrollArea_index.ScrollArea;
36
+ exports.Tabs = components_tabs_index.Tabs;
37
+ exports.Drawer = components_drawer_index.Drawer;
38
+ exports.Image = components_image_image.Image;
39
+ exports.Chip = components_chip_index.Chip;
40
+ exports.Modal = components_modal_modal.Modal;
41
+ exports.Notification = components_notification_notification.Notification;
42
+ exports.RadioGroup = components_radioGroup_radioGroup.RadioGroup;
43
+ exports.Box = components_box_box.Box;
44
+ exports.Flex = components_flex_flex.Flex;
45
+ exports.Card = components_card_card.Card;
46
+ exports.Grid = components_grid_grid.Grid;
47
+ exports.NavigationMenu = components_navigationMenu_navigationMenu.NavigationMenu;
48
+ exports.Toggle = components_toggle_toggle.Toggle;
49
+ exports.Accordion = components_accordion_index.Accordion;
50
+ exports.Link = components_link_link.Link;
51
+ exports.Badge = components_badge_badge.Badge;
52
+ exports.Button = components_button_button.Button;
53
+ exports.FieldErrorText = components_fieldErrorText_fieldErrorText.FieldErrorText;
54
+ exports.HelperText = components_helperText_helperText.HelperText;
55
+ exports.iconsHref = iconsHref;
56
+ exports.Icon = components_icon_icon.Icon;
57
+ exports.AllIcons = components_icon_AllIcons;
58
+ exports.InputGroup = components_input_index.InputGroup;
59
+ exports.Label = components_label_label.Label;
60
+ exports.Spinner = components_spinner_spinner.Spinner;
61
+ exports.Text = components_text_text.Text;
62
+ exports.TextField = components_textField_index.TextField;
63
+ exports.Heading = components_heading_heading.Heading;
64
+ exports.VisuallyHidden = components_visuallyHidden_visuallyHidden.VisuallyHidden;
65
+ exports.TextSpacing = components_textSpacing_textSpacing.TextSpacing;
66
+ exports.Input = components_input_inputGroup.Input;
@@ -20,16 +20,19 @@ import { FieldErrorText } from "./field-error-text/field-error-text.js";
20
20
  import { HelperText } from "./helper-text/helper-text.js";
21
21
  import { default as default2 } from "../assets/sprite.5636ec8e-teddy.svg";
22
22
  import { Icon } from "./icon/icon.js";
23
- import { Input, InputGroup } from "./input/input.js";
23
+ import { default as default3 } from "./icon/AllIcons.js";
24
+ import { InputGroup } from "./input/index.js";
24
25
  import { Label } from "./label/label.js";
25
26
  import { Spinner } from "./spinner/spinner.js";
26
27
  import { Text } from "./text/text.js";
27
- import { TextField } from "./text-field/text-field.js";
28
+ import { TextField } from "./text-field/index.js";
28
29
  import { Heading } from "./heading/heading.js";
29
30
  import { VisuallyHidden } from "./visually-hidden/visually-hidden.js";
30
31
  import { TextSpacing } from "./text-spacing/text-spacing.js";
32
+ import { I } from "./input/input-group.js";
31
33
  export {
32
34
  Accordion,
35
+ default3 as AllIcons,
33
36
  Badge,
34
37
  Box,
35
38
  Button,
@@ -43,7 +46,7 @@ export {
43
46
  HelperText,
44
47
  Icon,
45
48
  Image,
46
- Input,
49
+ I as Input,
47
50
  InputGroup,
48
51
  Label,
49
52
  Link,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const components_input_inputGroup = require("./input-group.cjs");
4
+ const components_input_inputClearButton = require("./input-clear-button.cjs");
5
+ components_input_inputGroup.Root.displayName = "InputGroup";
6
+ components_input_inputGroup.Input.displayName = "InputGroup.Input";
7
+ components_input_inputGroup.Indicator.displayName = "InputGroup.Indicator";
8
+ const InputGroup = Object.assign(components_input_inputGroup.Root, {
9
+ Input: components_input_inputGroup.Input,
10
+ Indicator: components_input_inputGroup.Indicator,
11
+ ClearButton: components_input_inputClearButton.ClearButton
12
+ });
13
+ exports.Input = components_input_inputGroup.Input;
14
+ exports.InputGroup = InputGroup;
@@ -1,2 +1,27 @@
1
- export { Input, InputGroup } from './input';
2
- export type { InputGroupProps, InputProps } from './input';
1
+ import { Input, InputProps } from './input';
2
+ import { InputIndicatorProps } from './input-indicator';
3
+ import { InputGroupRootProps } from './input-group';
4
+ import { ClearButtonProps } from './input-clear-button';
5
+
6
+ declare const InputGroup: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
7
+ frameClassName?: string | undefined;
8
+ } & import('react').RefAttributes<HTMLDivElement>> & {
9
+ Input: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "children"> & {
10
+ validationState?: ("invalid" | "valid") | undefined;
11
+ isLoading?: boolean | undefined;
12
+ onValueChange?: ((value: string) => void) | undefined;
13
+ } & import('react').RefAttributes<HTMLInputElement>>;
14
+ Indicator: import('react').ForwardRefExoticComponent<Omit<import('react').SVGProps<SVGSVGElement>, "ref"> & {
15
+ isValid?: boolean | undefined;
16
+ isLoading?: boolean | undefined;
17
+ } & import('react').RefAttributes<SVGSVGElement>>;
18
+ ClearButton: import('react').ForwardRefExoticComponent<ClearButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
19
+ };
20
+ type InputGroupProps = {
21
+ Root: InputGroupRootProps;
22
+ Input: InputProps;
23
+ Indicator: InputIndicatorProps;
24
+ ClearButton: ClearButtonProps;
25
+ };
26
+ export { Input, InputGroup };
27
+ export type { InputGroupProps, InputProps };
@@ -1,4 +1,13 @@
1
- import { Input, InputGroup } from "./input.js";
1
+ import { Root, I as Input, a as Indicator } from "./input-group.js";
2
+ import { ClearButton } from "./input-clear-button.js";
3
+ Root.displayName = "InputGroup";
4
+ Input.displayName = "InputGroup.Input";
5
+ Indicator.displayName = "InputGroup.Indicator";
6
+ const InputGroup = Object.assign(Root, {
7
+ Input,
8
+ Indicator,
9
+ ClearButton
10
+ });
2
11
  export {
3
12
  Input,
4
13
  InputGroup
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ require("../../assets/sprite.5636ec8e-teddy.svg");
6
+ const components_icon_icon = require("../icon/icon.cjs");
7
+ const components_button_button = require("../button/button.cjs");
8
+ const clsx = require("clsx");
9
+ const components_input_inputGroup = require("./input-group.cjs");
10
+ const utils_composeEventHandlers = require("../../utils/composeEventHandlers.cjs");
11
+ const ClearButton = React.forwardRef(
12
+ ({ children, className, ...props }, forwardRef) => {
13
+ const groupContext = React.useContext(components_input_inputGroup.InputGroupContext);
14
+ const hidden = !(groupContext == null ? void 0 : groupContext.isDirty);
15
+ const classes = clsx([components_input_inputGroup.styles[`${components_input_inputGroup.rootClassName}__clear-button`]], className);
16
+ if (hidden) {
17
+ return null;
18
+ }
19
+ return /* @__PURE__ */ jsxRuntime.jsx(
20
+ components_button_button.Button,
21
+ {
22
+ size: "sm",
23
+ variant: "tertiary-purple",
24
+ iconOnly: true,
25
+ "aria-label": "Slett",
26
+ type: "button",
27
+ ref: forwardRef,
28
+ onClick: utils_composeEventHandlers.composeEventHandlers(props.onClick, (e) => {
29
+ e.stopPropagation();
30
+ if (e.defaultPrevented || !(groupContext == null ? void 0 : groupContext.inputRef.current))
31
+ return;
32
+ groupContext.inputRef.current.value = "";
33
+ groupContext.inputRef.current.focus();
34
+ }),
35
+ ...props,
36
+ className: classes,
37
+ children: children || /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "close" })
38
+ }
39
+ );
40
+ }
41
+ );
42
+ ClearButton.displayName = "ClearButton";
43
+ exports.ClearButton = ClearButton;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { Button } from '../button';
3
+
4
+ export type ClearButtonProps = React.ComponentPropsWithoutRef<typeof Button>;
5
+ /** This is a button that is used to clear the input field */
6
+ export declare const ClearButton: React.ForwardRefExoticComponent<ClearButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,43 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React__default from "react";
3
+ import "../../assets/sprite.5636ec8e-teddy.svg";
4
+ import { Icon } from "../icon/icon.js";
5
+ import { Button } from "../button/button.js";
6
+ import clsx from "clsx";
7
+ import { InputGroupContext, s as styles, r as rootClassName } from "./input-group.js";
8
+ import { composeEventHandlers } from "../../utils/composeEventHandlers.js";
9
+ const ClearButton = React__default.forwardRef(
10
+ ({ children, className, ...props }, forwardRef) => {
11
+ const groupContext = React__default.useContext(InputGroupContext);
12
+ const hidden = !(groupContext == null ? void 0 : groupContext.isDirty);
13
+ const classes = clsx([styles[`${rootClassName}__clear-button`]], className);
14
+ if (hidden) {
15
+ return null;
16
+ }
17
+ return /* @__PURE__ */ jsx(
18
+ Button,
19
+ {
20
+ size: "sm",
21
+ variant: "tertiary-purple",
22
+ iconOnly: true,
23
+ "aria-label": "Slett",
24
+ type: "button",
25
+ ref: forwardRef,
26
+ onClick: composeEventHandlers(props.onClick, (e) => {
27
+ e.stopPropagation();
28
+ if (e.defaultPrevented || !(groupContext == null ? void 0 : groupContext.inputRef.current))
29
+ return;
30
+ groupContext.inputRef.current.value = "";
31
+ groupContext.inputRef.current.focus();
32
+ }),
33
+ ...props,
34
+ className: classes,
35
+ children: children || /* @__PURE__ */ jsx(Icon, { name: "close" })
36
+ }
37
+ );
38
+ }
39
+ );
40
+ ClearButton.displayName = "ClearButton";
41
+ export {
42
+ ClearButton
43
+ };
@@ -0,0 +1,132 @@
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
+ require("../../assets/sprite.5636ec8e-teddy.svg");
7
+ const components_icon_icon = require("../icon/icon.cjs");
8
+ const components_spinner_spinner = require("../spinner/spinner.cjs");
9
+ const utils_composeRefs = require("../../utils/composeRefs.cjs");
10
+ const fadeInAnimation = "_fadeInAnimation_5urff_1";
11
+ const scaleInAnimation = "_scaleInAnimation_5urff_1";
12
+ const styles = {
13
+ "teddy-input": "_teddy-input_5urff_18",
14
+ "teddy-input__frame": "_teddy-input__frame_5urff_27",
15
+ "teddy-input__clear-button": "_teddy-input__clear-button_5urff_35",
16
+ "teddy-input__input": "_teddy-input__input_5urff_38",
17
+ "teddy-input__input--valid": "_teddy-input__input--valid_5urff_79",
18
+ "teddy-input__input--invalid": "_teddy-input__input--invalid_5urff_79",
19
+ "teddy-input__indicator": "_teddy-input__indicator_5urff_85",
20
+ "teddy-input__input--error": "_teddy-input__input--error_5urff_88",
21
+ fadeInAnimation,
22
+ scaleInAnimation
23
+ };
24
+ function setCursorOnInput(e) {
25
+ const target = e == null ? void 0 : e.target;
26
+ if (target.closest("input, button, a"))
27
+ return;
28
+ const input = [...e.currentTarget.getElementsByTagName("input")].find((input2) => input2);
29
+ if (!input)
30
+ return;
31
+ const position = input.compareDocumentPosition(target);
32
+ const targetIsBeforeInput = (position & Node.DOCUMENT_POSITION_PRECEDING) !== 0;
33
+ const cursorPosition = targetIsBeforeInput ? 0 : input.value.length;
34
+ requestAnimationFrame(() => {
35
+ try {
36
+ input.setSelectionRange(cursorPosition, cursorPosition);
37
+ } finally {
38
+ input.focus();
39
+ }
40
+ });
41
+ }
42
+ const InputGroupContext = React.createContext(void 0);
43
+ const Root = React.forwardRef(
44
+ ({ className, children, frameClassName, ...props }, forwardRef) => {
45
+ const classes = clsx([styles[`${rootClassName}`]], className);
46
+ const inputRef = React.useRef(null);
47
+ const [isDirty, setIsDirty] = React.useState(false);
48
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props, onPointerDown: setCursorOnInput, ref: forwardRef, className: classes, children: [
49
+ /* @__PURE__ */ jsxRuntime.jsx(InputGroupContext.Provider, { value: { isDirty, setIsDirty, inputRef }, children }),
50
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
51
+ ] });
52
+ }
53
+ );
54
+ Root.displayName = "Root";
55
+ const Indicator = React.forwardRef(
56
+ ({ className, isLoading, isValid, ...props }, forwardRef) => {
57
+ if (!isValid && !isLoading)
58
+ return null;
59
+ if (!isValid && isLoading) {
60
+ return /* @__PURE__ */ jsxRuntime.jsx(components_spinner_spinner.Spinner, { className, size: "xs", ...props, ref: forwardRef });
61
+ }
62
+ const classes = clsx([styles[`${rootClassName}__indicator`]], className);
63
+ return /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { ...props, size: "md", name: "check-circle-filled", className: classes, ref: forwardRef });
64
+ }
65
+ );
66
+ Indicator.displayName = "Indicator";
67
+ const rootClassName = "teddy-input";
68
+ const Input = React.forwardRef(
69
+ ({ className, onValueChange, isLoading, validationState, ...props }, forwardRef) => {
70
+ const groupContext = React.useContext(InputGroupContext);
71
+ const composedRef = utils_composeRefs.useComposedRefs(forwardRef, groupContext == null ? void 0 : groupContext.inputRef);
72
+ const classes = clsx(
73
+ [
74
+ styles[`${rootClassName}__input`],
75
+ {
76
+ [styles[`${rootClassName}__input--valid`]]: validationState === "valid",
77
+ [styles[`${rootClassName}__input--error`]]: validationState === "invalid"
78
+ }
79
+ ],
80
+ className
81
+ );
82
+ React.useEffect(() => {
83
+ var _a, _b;
84
+ if (!groupContext)
85
+ return;
86
+ if ((_b = (_a = groupContext == null ? void 0 : groupContext.inputRef) == null ? void 0 : _a.current) == null ? void 0 : _b.value.length) {
87
+ return groupContext.setIsDirty(true);
88
+ }
89
+ groupContext.setIsDirty(false);
90
+ }, [groupContext]);
91
+ const hasInputGroup = groupContext !== void 0;
92
+ function onChange(e) {
93
+ var _a;
94
+ onValueChange == null ? void 0 : onValueChange(e.target.value);
95
+ groupContext == null ? void 0 : groupContext.setIsDirty(((_a = e.target) == null ? void 0 : _a.value.length) > 0);
96
+ if (props.onChange)
97
+ props.onChange(e);
98
+ }
99
+ if (hasInputGroup) {
100
+ return /* @__PURE__ */ jsxRuntime.jsx(
101
+ "input",
102
+ {
103
+ "aria-invalid": validationState === "invalid",
104
+ ...props,
105
+ onChange,
106
+ className: classes,
107
+ ref: composedRef
108
+ }
109
+ );
110
+ }
111
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root, { children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx(
113
+ "input",
114
+ {
115
+ "aria-invalid": validationState === "invalid",
116
+ ...props,
117
+ onChange,
118
+ className: classes,
119
+ ref: composedRef
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsxRuntime.jsx(Indicator, { isValid: validationState === "valid", isLoading })
123
+ ] });
124
+ }
125
+ );
126
+ Input.displayName = "Input";
127
+ exports.Indicator = Indicator;
128
+ exports.Input = Input;
129
+ exports.InputGroupContext = InputGroupContext;
130
+ exports.Root = Root;
131
+ exports.rootClassName = rootClassName;
132
+ exports.styles = styles;
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+
3
+ export type InputGroupRootProps = React.ComponentPropsWithoutRef<'div'> & {
4
+ frameClassName?: string;
5
+ };
6
+ type InputGroupContextValue = {
7
+ isDirty: boolean;
8
+ setIsDirty: React.Dispatch<React.SetStateAction<boolean>>;
9
+ inputRef: React.RefObject<HTMLInputElement>;
10
+ };
11
+ export declare const InputGroupContext: React.Context<InputGroupContextValue | undefined>;
12
+ /** This is the element that wraps the input element gives the outline effect */
13
+ export declare const Root: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
14
+ frameClassName?: string | undefined;
15
+ } & React.RefAttributes<HTMLDivElement>>;
16
+ export {};
@@ -0,0 +1,132 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import React__default, { useEffect } from "react";
4
+ import "../../assets/sprite.5636ec8e-teddy.svg";
5
+ import { Icon } from "../icon/icon.js";
6
+ import { Spinner } from "../spinner/spinner.js";
7
+ import { useComposedRefs } from "../../utils/composeRefs.js";
8
+ const fadeInAnimation = "_fadeInAnimation_5urff_1";
9
+ const scaleInAnimation = "_scaleInAnimation_5urff_1";
10
+ const styles = {
11
+ "teddy-input": "_teddy-input_5urff_18",
12
+ "teddy-input__frame": "_teddy-input__frame_5urff_27",
13
+ "teddy-input__clear-button": "_teddy-input__clear-button_5urff_35",
14
+ "teddy-input__input": "_teddy-input__input_5urff_38",
15
+ "teddy-input__input--valid": "_teddy-input__input--valid_5urff_79",
16
+ "teddy-input__input--invalid": "_teddy-input__input--invalid_5urff_79",
17
+ "teddy-input__indicator": "_teddy-input__indicator_5urff_85",
18
+ "teddy-input__input--error": "_teddy-input__input--error_5urff_88",
19
+ fadeInAnimation,
20
+ scaleInAnimation
21
+ };
22
+ function setCursorOnInput(e) {
23
+ const target = e == null ? void 0 : e.target;
24
+ if (target.closest("input, button, a"))
25
+ return;
26
+ const input = [...e.currentTarget.getElementsByTagName("input")].find((input2) => input2);
27
+ if (!input)
28
+ return;
29
+ const position = input.compareDocumentPosition(target);
30
+ const targetIsBeforeInput = (position & Node.DOCUMENT_POSITION_PRECEDING) !== 0;
31
+ const cursorPosition = targetIsBeforeInput ? 0 : input.value.length;
32
+ requestAnimationFrame(() => {
33
+ try {
34
+ input.setSelectionRange(cursorPosition, cursorPosition);
35
+ } finally {
36
+ input.focus();
37
+ }
38
+ });
39
+ }
40
+ const InputGroupContext = React__default.createContext(void 0);
41
+ const Root = React__default.forwardRef(
42
+ ({ className, children, frameClassName, ...props }, forwardRef) => {
43
+ const classes = clsx([styles[`${rootClassName}`]], className);
44
+ const inputRef = React__default.useRef(null);
45
+ const [isDirty, setIsDirty] = React__default.useState(false);
46
+ return /* @__PURE__ */ jsxs("div", { ...props, onPointerDown: setCursorOnInput, ref: forwardRef, className: classes, children: [
47
+ /* @__PURE__ */ jsx(InputGroupContext.Provider, { value: { isDirty, setIsDirty, inputRef }, children }),
48
+ /* @__PURE__ */ jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
49
+ ] });
50
+ }
51
+ );
52
+ Root.displayName = "Root";
53
+ const Indicator = React__default.forwardRef(
54
+ ({ className, isLoading, isValid, ...props }, forwardRef) => {
55
+ if (!isValid && !isLoading)
56
+ return null;
57
+ if (!isValid && isLoading) {
58
+ return /* @__PURE__ */ jsx(Spinner, { className, size: "xs", ...props, ref: forwardRef });
59
+ }
60
+ const classes = clsx([styles[`${rootClassName}__indicator`]], className);
61
+ return /* @__PURE__ */ jsx(Icon, { ...props, size: "md", name: "check-circle-filled", className: classes, ref: forwardRef });
62
+ }
63
+ );
64
+ Indicator.displayName = "Indicator";
65
+ const rootClassName = "teddy-input";
66
+ const Input = React__default.forwardRef(
67
+ ({ className, onValueChange, isLoading, validationState, ...props }, forwardRef) => {
68
+ const groupContext = React__default.useContext(InputGroupContext);
69
+ const composedRef = useComposedRefs(forwardRef, groupContext == null ? void 0 : groupContext.inputRef);
70
+ const classes = clsx(
71
+ [
72
+ styles[`${rootClassName}__input`],
73
+ {
74
+ [styles[`${rootClassName}__input--valid`]]: validationState === "valid",
75
+ [styles[`${rootClassName}__input--error`]]: validationState === "invalid"
76
+ }
77
+ ],
78
+ className
79
+ );
80
+ useEffect(() => {
81
+ var _a, _b;
82
+ if (!groupContext)
83
+ return;
84
+ if ((_b = (_a = groupContext == null ? void 0 : groupContext.inputRef) == null ? void 0 : _a.current) == null ? void 0 : _b.value.length) {
85
+ return groupContext.setIsDirty(true);
86
+ }
87
+ groupContext.setIsDirty(false);
88
+ }, [groupContext]);
89
+ const hasInputGroup = groupContext !== void 0;
90
+ function onChange(e) {
91
+ var _a;
92
+ onValueChange == null ? void 0 : onValueChange(e.target.value);
93
+ groupContext == null ? void 0 : groupContext.setIsDirty(((_a = e.target) == null ? void 0 : _a.value.length) > 0);
94
+ if (props.onChange)
95
+ props.onChange(e);
96
+ }
97
+ if (hasInputGroup) {
98
+ return /* @__PURE__ */ jsx(
99
+ "input",
100
+ {
101
+ "aria-invalid": validationState === "invalid",
102
+ ...props,
103
+ onChange,
104
+ className: classes,
105
+ ref: composedRef
106
+ }
107
+ );
108
+ }
109
+ return /* @__PURE__ */ jsxs(Root, { children: [
110
+ /* @__PURE__ */ jsx(
111
+ "input",
112
+ {
113
+ "aria-invalid": validationState === "invalid",
114
+ ...props,
115
+ onChange,
116
+ className: classes,
117
+ ref: composedRef
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsx(Indicator, { isValid: validationState === "valid", isLoading })
121
+ ] });
122
+ }
123
+ );
124
+ Input.displayName = "Input";
125
+ export {
126
+ Input as I,
127
+ InputGroupContext,
128
+ Root,
129
+ Indicator as a,
130
+ rootClassName as r,
131
+ styles as s
132
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ require("react/jsx-runtime");
4
+ require("clsx");
5
+ require("react");
6
+ require("../../assets/sprite.5636ec8e-teddy.svg");
7
+ require("../icon/icon.cjs");
8
+ require("../spinner/spinner.cjs");
9
+ const components_input_inputGroup = require("./input-group.cjs");
10
+ exports.Indicator = components_input_inputGroup.Indicator;
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+
3
+ export type InputIndicatorProps = React.ComponentPropsWithoutRef<'svg'> & {
4
+ /**
5
+ * Whether the input is invalid.
6
+ */
7
+ isValid?: boolean;
8
+ /**
9
+ * Whether the input is loading.
10
+ */
11
+ isLoading?: boolean;
12
+ };
13
+ /** This element displays the validation state, e.g. "valid", "loading" */
14
+ export declare const Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
15
+ /**
16
+ * Whether the input is invalid.
17
+ */
18
+ isValid?: boolean | undefined;
19
+ /**
20
+ * Whether the input is loading.
21
+ */
22
+ isLoading?: boolean | undefined;
23
+ } & React.RefAttributes<SVGSVGElement>>;