@easypost/easy-ui 1.0.0-alpha.5 → 1.0.0-alpha.7

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 (138) hide show
  1. package/Badge/index.js +16 -16
  2. package/Badge/index.mjs +14 -14
  3. package/Banner/index.js +7 -7
  4. package/Banner/index.mjs +5 -5
  5. package/Button/Button.d.ts +61 -0
  6. package/Button/Button.d.ts.map +1 -1
  7. package/Button/index.js +23 -23
  8. package/Button/index.mjs +20 -20
  9. package/CHANGELOG.md +22 -0
  10. package/Card/index.js +84 -5
  11. package/Card/index.mjs +84 -5
  12. package/Checkbox/index.js +28 -28
  13. package/Checkbox/index.mjs +26 -26
  14. package/CodeBlock/CodeBlock.d.ts +49 -61
  15. package/CodeBlock/CodeBlock.d.ts.map +1 -1
  16. package/CodeBlock/CodeBlock.stories.d.ts +3 -2
  17. package/CodeBlock/CodeBlock.stories.d.ts.map +1 -1
  18. package/CodeBlock/CopyButton.d.ts +9 -0
  19. package/CodeBlock/CopyButton.d.ts.map +1 -0
  20. package/CodeBlock/LanguageMenu.d.ts +18 -0
  21. package/CodeBlock/LanguageMenu.d.ts.map +1 -0
  22. package/CodeBlock/context.d.ts +11 -0
  23. package/CodeBlock/context.d.ts.map +1 -0
  24. package/CodeBlock/index.js +310 -5335
  25. package/CodeBlock/index.mjs +299 -5340
  26. package/CodeSnippet/CodeSnippet.d.ts +82 -0
  27. package/CodeSnippet/CodeSnippet.d.ts.map +1 -0
  28. package/CodeSnippet/CodeSnippet.stories.d.ts +14 -0
  29. package/CodeSnippet/CodeSnippet.stories.d.ts.map +1 -0
  30. package/CodeSnippet/CodeSnippet.test.d.ts +2 -0
  31. package/CodeSnippet/CodeSnippet.test.d.ts.map +1 -0
  32. package/CodeSnippet/SyntaxHighlighter.d.ts +8 -0
  33. package/CodeSnippet/SyntaxHighlighter.d.ts.map +1 -0
  34. package/CodeSnippet/index.d.ts +2 -0
  35. package/CodeSnippet/index.d.ts.map +1 -0
  36. package/CodeSnippet/index.js +11 -0
  37. package/CodeSnippet/index.mjs +11 -0
  38. package/CodeSnippet/theme.d.ts.map +1 -0
  39. package/CodeSnippet/useScrollbar.d.ts.map +1 -0
  40. package/DropdownButton/DropdownButton.d.ts +48 -0
  41. package/DropdownButton/DropdownButton.d.ts.map +1 -1
  42. package/DropdownButton/index.js +17 -17
  43. package/DropdownButton/index.mjs +15 -15
  44. package/HorizontalGrid/index.js +1 -1
  45. package/HorizontalGrid/index.mjs +1 -1
  46. package/HorizontalStack/index.js +48 -4
  47. package/HorizontalStack/index.mjs +48 -4
  48. package/Icon/Icon.d.ts +51 -0
  49. package/Icon/Icon.d.ts.map +1 -1
  50. package/Icon/index.js +38 -4
  51. package/Icon/index.mjs +38 -4
  52. package/IconButton/IconButton.d.ts +62 -0
  53. package/IconButton/IconButton.d.ts.map +1 -1
  54. package/IconButton/index.js +18 -18
  55. package/IconButton/index.mjs +15 -15
  56. package/InputField/index.js +282 -11
  57. package/InputField/index.mjs +266 -11
  58. package/Menu/index.js +57 -15
  59. package/Menu/index.mjs +58 -16
  60. package/Notification/index.js +1534 -14
  61. package/Notification/index.mjs +1518 -14
  62. package/Provider/index.js +9 -9
  63. package/Provider/index.mjs +9 -9
  64. package/RadioGroup/index.js +24 -24
  65. package/RadioGroup/index.mjs +22 -22
  66. package/Select/index.js +71 -29
  67. package/Select/index.mjs +71 -29
  68. package/SelectorErrorTooltip/index.js +99 -8
  69. package/SelectorErrorTooltip/index.mjs +85 -10
  70. package/Text/index.js +85 -4
  71. package/Text/index.mjs +85 -4
  72. package/TextField/index.js +7 -7
  73. package/TextField/index.mjs +8 -8
  74. package/Textarea/index.js +7 -7
  75. package/Textarea/index.mjs +8 -8
  76. package/Theme/index.js +145 -9
  77. package/Theme/index.mjs +145 -9
  78. package/Toggle/index.js +14 -14
  79. package/Toggle/index.mjs +14 -14
  80. package/Tooltip/Tooltip.stories.d.ts +1 -0
  81. package/Tooltip/Tooltip.stories.d.ts.map +1 -1
  82. package/Tooltip/index.js +5 -5
  83. package/Tooltip/index.mjs +6 -6
  84. package/UnstyledButton/index.js +3 -3
  85. package/UnstyledButton/index.mjs +3 -3
  86. package/VerticalStack/index.js +3 -3
  87. package/VerticalStack/index.mjs +3 -3
  88. package/__chunks__/{InputIcon-4a8e5243.mjs → InputIcon-1f2ed127.mjs} +26 -26
  89. package/__chunks__/{InputIcon-70dad3e5.js → InputIcon-f456e366.js} +29 -29
  90. package/__chunks__/{import-87c465c9.js → import-0f8555a4.js} +1 -1
  91. package/__chunks__/{import-fbe7cc7e.mjs → import-19bc38ac.mjs} +26 -26
  92. package/__chunks__/{import-9581a2dc.js → import-26676303.js} +44 -1
  93. package/__chunks__/{import-d2e79ac1.mjs → import-29af6941.mjs} +3 -3
  94. package/__chunks__/{import-a6cadfe8.mjs → import-3faba3a6.mjs} +58 -15
  95. package/__chunks__/{import-d52cd5cf.js → import-890ae60e.js} +1 -1
  96. package/__chunks__/{import-29edaaea.mjs → import-c4caaddf.mjs} +9 -9
  97. package/__chunks__/{import-9c958e32.mjs → import-eb35a9b9.mjs} +2 -2
  98. package/__chunks__/{UnstyledButton-981cd9af.mjs → index-45f05366.mjs} +2 -2
  99. package/__chunks__/{UnstyledButton-5bbb3c5e.js → index-5f429325.js} +1 -1
  100. package/__chunks__/index-72137376.mjs +5421 -0
  101. package/__chunks__/index-a7b6b429.js +5420 -0
  102. package/__chunks__/{Tooltip-c5076ca7.js → index-affe5510.js} +13 -12
  103. package/__chunks__/{Tooltip-b4e23b78.mjs → index-e989a741.mjs} +14 -13
  104. package/__chunks__/{overlayscrollbars-react.es-c8369a03.mjs → overlayscrollbars-react.es-7f332a3b.mjs} +4 -4
  105. package/__chunks__/{overlayscrollbars-react.es-20563393.js → overlayscrollbars-react.es-f2a0bcff.js} +4 -4
  106. package/__chunks__/{real-module-2f165429.mjs → real-module-515df21d.mjs} +4 -4
  107. package/__chunks__/{tokens-6be8e137.mjs → tokens-3c27019b.mjs} +1 -0
  108. package/__chunks__/{tokens-e696ca96.js → tokens-ad06cd2c.js} +1 -0
  109. package/__chunks__/{useTriggerWidth-29becc21.mjs → useTriggerWidth-b554acaf.mjs} +50 -8
  110. package/__chunks__/{useTriggerWidth-9528009c.js → useTriggerWidth-e11bf6d6.js} +48 -6
  111. package/package.json +10 -8
  112. package/style.css +2182 -2110
  113. package/utilities/react.d.ts +15 -0
  114. package/utilities/react.d.ts.map +1 -0
  115. package/utilities/react.js +333 -0
  116. package/utilities/react.mjs +333 -0
  117. package/CodeBlock/SyntaxHighlighter.d.ts +0 -5
  118. package/CodeBlock/SyntaxHighlighter.d.ts.map +0 -1
  119. package/CodeBlock/theme.d.ts.map +0 -1
  120. package/CodeBlock/useScrollbar.d.ts.map +0 -1
  121. package/__chunks__/Card-2bd533c4.js +0 -85
  122. package/__chunks__/Card-4ad318ba.mjs +0 -86
  123. package/__chunks__/HorizontalStack-65adb570.mjs +0 -50
  124. package/__chunks__/HorizontalStack-f331bfc7.js +0 -49
  125. package/__chunks__/Icon-1a25dcae.js +0 -39
  126. package/__chunks__/Icon-6eb724b4.mjs +0 -40
  127. package/__chunks__/InputField-cc829736.mjs +0 -268
  128. package/__chunks__/InputField-f5072e37.js +0 -283
  129. package/__chunks__/Notification-8d749bd1.mjs +0 -1533
  130. package/__chunks__/Notification-b7a2c277.js +0 -1548
  131. package/__chunks__/SelectorErrorTooltip-4d820c45.mjs +0 -83
  132. package/__chunks__/SelectorErrorTooltip-b7bb5b9d.js +0 -98
  133. package/__chunks__/Text-2efbe1fe.js +0 -86
  134. package/__chunks__/Text-ec2b8d8a.mjs +0 -87
  135. package/__chunks__/Theme-123ba2c3.mjs +0 -147
  136. package/__chunks__/Theme-57f8311c.js +0 -146
  137. /package/{CodeBlock → CodeSnippet}/theme.d.ts +0 -0
  138. /package/{CodeBlock → CodeSnippet}/useScrollbar.d.ts +0 -0
@@ -15,6 +15,68 @@ export type IconButtonProps = AriaButtonProps & {
15
15
  /** Disables button */
16
16
  isDisabled?: boolean;
17
17
  };
18
+ /**
19
+ * Button element that represents its behavior with a contextually
20
+ * appropriate icon instead of text.
21
+ *
22
+ * @remarks
23
+ * Use to communicate an action the user can take in order to continue
24
+ * flow in the UI. Supports multiple colors, an outlined variation, and
25
+ * an accessibility label that describes the icon. Underlying element
26
+ * is a button.
27
+ *
28
+ * @example
29
+ * _Default:_
30
+ * ```tsx
31
+ * import { IconButton } from "@easypost/easy-ui/IconButton";
32
+ * import ArrowBackIcon from "@easypost/easy-ui-icons/ArrowBack";
33
+ *
34
+ * export function Component() {
35
+ * return (
36
+ * <IconButton
37
+ * onPress={() => alert("clicked")}
38
+ * icon={ArrowBackIcon}
39
+ * accessibilityLabel="Back"
40
+ * />
41
+ * );
42
+ * }
43
+ * ```
44
+ *
45
+ * @example
46
+ * _Outlined variant:_
47
+ * ```tsx
48
+ * import { IconButton } from "@easypost/easy-ui/IconButton";
49
+ * import ArrowBackIcon from "@easypost/easy-ui-icons/ArrowBack";
50
+ *
51
+ * export function Component() {
52
+ * return (
53
+ * <IconButton
54
+ * onPress={() => alert("clicked")}
55
+ * icon={ArrowBackIcon}
56
+ * accessibilityLabel="Back"
57
+ * variant="outlined"
58
+ * />
59
+ * );
60
+ * }
61
+ * ```
62
+ * @example
63
+ * _Success color:_
64
+ * ```tsx
65
+ * import { IconButton } from "@easypost/easy-ui/IconButton";
66
+ * import ArrowBackIcon from "@easypost/easy-ui-icons/ArrowBack";
67
+ *
68
+ * export function Component() {
69
+ * return (
70
+ * <IconButton
71
+ * onPress={() => alert("clicked")}
72
+ * icon={ArrowBackIcon}
73
+ * accessibilityLabel="Back"
74
+ * color="success"
75
+ * />
76
+ * );
77
+ * }
78
+ * ```
79
+ */
18
80
  export declare const IconButton: React.ForwardRefExoticComponent<AriaButtonProps<"button"> & {
19
81
  /** Button color */
20
82
  color?: ButtonColor | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,mBAAmB;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,qBAAqB;IACrB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,kBAAkB;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,0BAA0B;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,UAAU;IAZrB,mBAAmB;;IAEnB,qBAAqB;;IAErB,kBAAkB;UACZ,UAAU;IAChB,0BAA0B;wBACN,MAAM;IAC1B,sBAAsB;;8BA+BtB,CAAC"}
1
+ {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,mBAAmB;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,qBAAqB;IACrB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,kBAAkB;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,0BAA0B;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,UAAU;IA1ErB,mBAAmB;;IAEnB,qBAAqB;;IAErB,kBAAkB;UACZ,UAAU;IAChB,0BAA0B;wBACN,MAAM;IAC1B,sBAAsB;;8BA6FtB,CAAC"}
@@ -29,23 +29,23 @@ var __objRest = (source, exclude) => {
29
29
  };
30
30
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
31
31
  const React = require("react");
32
- const UnstyledButton = require("../__chunks__/UnstyledButton-5bbb3c5e.js");
33
- const Icon = require("../__chunks__/Icon-1a25dcae.js");
34
- const Text = require("../__chunks__/Text-2efbe1fe.js");
32
+ const UnstyledButton_index = require("../__chunks__/index-5f429325.js");
33
+ const Icon_index = require("../Icon/index.js");
34
+ const Text_index = require("../Text/index.js");
35
35
  const utilities_css = require("../utilities/css.js");
36
36
  require("../__chunks__/import-a1e0f814.js");
37
37
  require("../__chunks__/omit-fca26542.js");
38
- require("../__chunks__/import-9581a2dc.js");
39
- const IconButton$1 = "_IconButton_gpz05_5";
40
- const colorPrimary = "_colorPrimary_gpz05_20";
41
- const colorSecondary = "_colorSecondary_gpz05_28";
42
- const colorSuccess = "_colorSuccess_gpz05_36";
43
- const colorWarning = "_colorWarning_gpz05_44";
44
- const colorNeutral = "_colorNeutral_gpz05_52";
45
- const colorSupport = "_colorSupport_gpz05_60";
46
- const colorInverse = "_colorInverse_gpz05_66";
47
- const variantOutlined = "_variantOutlined_gpz05_72";
48
- const variantFilled = "_variantFilled_gpz05_103";
38
+ require("../__chunks__/import-26676303.js");
39
+ const IconButton$1 = "_IconButton_18ccc_5";
40
+ const colorPrimary = "_colorPrimary_18ccc_20";
41
+ const colorSecondary = "_colorSecondary_18ccc_28";
42
+ const colorSuccess = "_colorSuccess_18ccc_36";
43
+ const colorWarning = "_colorWarning_18ccc_44";
44
+ const colorNeutral = "_colorNeutral_18ccc_52";
45
+ const colorSupport = "_colorSupport_18ccc_60";
46
+ const colorInverse = "_colorInverse_18ccc_66";
47
+ const variantOutlined = "_variantOutlined_18ccc_72";
48
+ const variantFilled = "_variantFilled_18ccc_103";
49
49
  const styles = {
50
50
  IconButton: IconButton$1,
51
51
  colorPrimary,
@@ -60,14 +60,14 @@ const styles = {
60
60
  };
61
61
  const IconButton = React.forwardRef((props, inRef) => {
62
62
  const _a = props, { color = "primary", variant = "filled", icon, accessibilityLabel, isDisabled = false } = _a, restProps = __objRest(_a, ["color", "variant", "icon", "accessibilityLabel", "isDisabled"]);
63
- UnstyledButton.logWarningIfInvalidColorVariantCombination(color, variant);
64
- return React.createElement(UnstyledButton.UnstyledButton, __spreadValues({
63
+ UnstyledButton_index.logWarningIfInvalidColorVariantCombination(color, variant);
64
+ return React.createElement(UnstyledButton_index.UnstyledButton, __spreadValues({
65
65
  isDisabled,
66
66
  ref: inRef,
67
67
  className: utilities_css.classNames(styles.IconButton, styles[utilities_css.variationName("variant", variant)], styles[utilities_css.variationName("color", color)])
68
- }, restProps), React.createElement(Text.Text, {
68
+ }, restProps), React.createElement(Text_index.Text, {
69
69
  visuallyHidden: true
70
- }, accessibilityLabel), React.createElement(Icon.Icon, {
70
+ }, accessibilityLabel), React.createElement(Icon_index.Icon, {
71
71
  symbol: icon
72
72
  }));
73
73
  });
@@ -27,23 +27,23 @@ var __objRest = (source, exclude) => {
27
27
  return target;
28
28
  };
29
29
  import React__default, { forwardRef } from "react";
30
- import { l as logWarningIfInvalidColorVariantCombination, U as UnstyledButton } from "../__chunks__/UnstyledButton-981cd9af.mjs";
31
- import { I as Icon } from "../__chunks__/Icon-6eb724b4.mjs";
32
- import { T as Text } from "../__chunks__/Text-ec2b8d8a.mjs";
30
+ import { l as logWarningIfInvalidColorVariantCombination, U as UnstyledButton } from "../__chunks__/index-45f05366.mjs";
31
+ import { Icon } from "../Icon/index.mjs";
32
+ import { Text } from "../Text/index.mjs";
33
33
  import { classNames, variationName } from "../utilities/css.mjs";
34
- import "../__chunks__/import-fbe7cc7e.mjs";
34
+ import "../__chunks__/import-19bc38ac.mjs";
35
35
  import "../__chunks__/omit-f17deb8f.mjs";
36
- import "../__chunks__/import-a6cadfe8.mjs";
37
- const IconButton$1 = "_IconButton_gpz05_5";
38
- const colorPrimary = "_colorPrimary_gpz05_20";
39
- const colorSecondary = "_colorSecondary_gpz05_28";
40
- const colorSuccess = "_colorSuccess_gpz05_36";
41
- const colorWarning = "_colorWarning_gpz05_44";
42
- const colorNeutral = "_colorNeutral_gpz05_52";
43
- const colorSupport = "_colorSupport_gpz05_60";
44
- const colorInverse = "_colorInverse_gpz05_66";
45
- const variantOutlined = "_variantOutlined_gpz05_72";
46
- const variantFilled = "_variantFilled_gpz05_103";
36
+ import "../__chunks__/import-3faba3a6.mjs";
37
+ const IconButton$1 = "_IconButton_18ccc_5";
38
+ const colorPrimary = "_colorPrimary_18ccc_20";
39
+ const colorSecondary = "_colorSecondary_18ccc_28";
40
+ const colorSuccess = "_colorSuccess_18ccc_36";
41
+ const colorWarning = "_colorWarning_18ccc_44";
42
+ const colorNeutral = "_colorNeutral_18ccc_52";
43
+ const colorSupport = "_colorSupport_18ccc_60";
44
+ const colorInverse = "_colorInverse_18ccc_66";
45
+ const variantOutlined = "_variantOutlined_18ccc_72";
46
+ const variantFilled = "_variantFilled_18ccc_103";
47
47
  const styles = {
48
48
  IconButton: IconButton$1,
49
49
  colorPrimary,
@@ -1,14 +1,285 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2
21
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const InputField = require("../__chunks__/InputField-f5072e37.js");
4
- require("react");
5
- require("../utilities/css.js");
6
- require("../__chunks__/InputIcon-70dad3e5.js");
7
- require("../__chunks__/Text-2efbe1fe.js");
8
- require("../__chunks__/Icon-1a25dcae.js");
9
- require("../__chunks__/UnstyledButton-5bbb3c5e.js");
10
- require("../__chunks__/import-a1e0f814.js");
22
+ const React = require("react");
23
+ const utilities_css = require("../utilities/css.js");
24
+ const InputIcon = require("../__chunks__/InputIcon-f456e366.js");
25
+ const Text_index = require("../Text/index.js");
26
+ const Icon_index = require("../Icon/index.js");
27
+ const UnstyledButton_index = require("../__chunks__/index-5f429325.js");
28
+ const _import$2 = require("../__chunks__/import-a1e0f814.js");
29
+ const _import$1 = require("../__chunks__/import-24a482e1.js");
30
+ const _import = require("../__chunks__/import-26676303.js");
11
31
  require("../__chunks__/omit-fca26542.js");
12
- require("../__chunks__/import-9581a2dc.js");
13
- require("../__chunks__/import-24a482e1.js");
14
- exports.InputField = InputField.InputField;
32
+ function _interopNamespaceDefault(e) {
33
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
34
+ if (e) {
35
+ for (const k in e) {
36
+ if (k !== "default") {
37
+ const d = Object.getOwnPropertyDescriptor(e, k);
38
+ Object.defineProperty(n, k, d.get ? d : {
39
+ enumerable: true,
40
+ get: () => e[k]
41
+ });
42
+ }
43
+ }
44
+ }
45
+ n.default = e;
46
+ return Object.freeze(n);
47
+ }
48
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
49
+ function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
50
+ let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, validationState, type = "text", onChange = () => {
51
+ } } = props;
52
+ let { focusableProps } = _import.$e6afbd83fe6ebbd2$export$4c014de7c8940b4c(props, ref);
53
+ let { labelProps, fieldProps, descriptionProps, errorMessageProps } = _import$1.$2baaea4c71418dea$export$294aa081a6c6f55d(props);
54
+ let domProps = _import$2.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
55
+ labelable: true
56
+ });
57
+ const inputOnlyProps = {
58
+ type,
59
+ pattern: props.pattern
60
+ };
61
+ return {
62
+ labelProps,
63
+ inputProps: _import$2.$3ef42575df84b30b$export$9d1611c77c2fe928(domProps, inputElementType === "input" && inputOnlyProps, __spreadValues(__spreadValues({
64
+ disabled: isDisabled,
65
+ readOnly: isReadOnly,
66
+ "aria-required": isRequired || void 0,
67
+ "aria-invalid": validationState === "invalid" || void 0,
68
+ "aria-errormessage": props["aria-errormessage"],
69
+ "aria-activedescendant": props["aria-activedescendant"],
70
+ "aria-autocomplete": props["aria-autocomplete"],
71
+ "aria-haspopup": props["aria-haspopup"],
72
+ value: props.value,
73
+ defaultValue: props.value ? void 0 : props.defaultValue,
74
+ onChange: (e) => onChange(e.target.value),
75
+ autoComplete: props.autoComplete,
76
+ maxLength: props.maxLength,
77
+ minLength: props.minLength,
78
+ name: props.name,
79
+ placeholder: props.placeholder,
80
+ inputMode: props.inputMode,
81
+ // Clipboard events
82
+ onCopy: props.onCopy,
83
+ onCut: props.onCut,
84
+ onPaste: props.onPaste,
85
+ // Composition events
86
+ onCompositionEnd: props.onCompositionEnd,
87
+ onCompositionStart: props.onCompositionStart,
88
+ onCompositionUpdate: props.onCompositionUpdate,
89
+ // Selection events
90
+ onSelect: props.onSelect,
91
+ // Input events
92
+ onBeforeInput: props.onBeforeInput,
93
+ onInput: props.onInput
94
+ }, focusableProps), fieldProps)),
95
+ descriptionProps,
96
+ errorMessageProps
97
+ };
98
+ }
99
+ var __defProp$1 = Object.defineProperty;
100
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
101
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
102
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
103
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
104
+ enumerable: true,
105
+ configurable: true,
106
+ writable: true,
107
+ value
108
+ }) : obj[key] = value;
109
+ var __spreadValues$1 = (a, b) => {
110
+ for (var prop in b || (b = {}))
111
+ if (__hasOwnProp$1.call(b, prop))
112
+ __defNormalProp$1(a, prop, b[prop]);
113
+ if (__getOwnPropSymbols$1)
114
+ for (var prop of __getOwnPropSymbols$1(b)) {
115
+ if (__propIsEnum$1.call(b, prop))
116
+ __defNormalProp$1(a, prop, b[prop]);
117
+ }
118
+ return a;
119
+ };
120
+ var __objRest$1 = (source, exclude) => {
121
+ var target = {};
122
+ for (var prop in source)
123
+ if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
124
+ target[prop] = source[prop];
125
+ if (source != null && __getOwnPropSymbols$1)
126
+ for (var prop of __getOwnPropSymbols$1(source)) {
127
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
128
+ target[prop] = source[prop];
129
+ }
130
+ return target;
131
+ };
132
+ const Visibility = (_a) => {
133
+ var _b = _a, { title, titleId } = _b, props = __objRest$1(_b, ["title", "titleId"]);
134
+ return React__namespace.createElement("svg", __spreadValues$1({
135
+ xmlns: "http://www.w3.org/2000/svg",
136
+ viewBox: "0 -960 960 960",
137
+ "aria-labelledby": titleId
138
+ }, props), title ? React__namespace.createElement("title", {
139
+ id: titleId
140
+ }, title) : null, React__namespace.createElement("path", {
141
+ d: "M480.208-344.232q64.638 0 110.099-45.669 45.461-45.67 45.461-110.307 0-64.638-45.669-110.099-45.67-45.461-110.307-45.461-64.638 0-110.099 45.669-45.461 45.67-45.461 110.307 0 64.638 45.669 110.099 45.67 45.461 110.307 45.461Zm-.511-44.922q-46.312 0-78.428-32.418-32.115-32.419-32.115-78.731t32.418-78.428q32.419-32.115 78.731-32.115t78.428 32.418q32.115 32.419 32.115 78.731t-32.418 78.428q-32.419 32.115-78.731 32.115Zm.358 169.153q-137.593 0-249.823-77.038Q118.001-374.078 61.54-500q56.461-125.922 168.637-202.961 112.175-77.038 249.768-77.038 137.593 0 249.823 77.038Q841.999-625.922 898.46-500q-56.461 125.922-168.637 202.961-112.175 77.038-249.768 77.038ZM480-500Zm-.169 234.615q119.246 0 218.823-63.769Q798.23-392.923 850.461-500 798.23-607.077 698.822-670.846q-99.408-63.769-218.653-63.769-119.246 0-218.823 63.769Q161.77-607.077 108.924-500q52.846 107.077 152.254 170.846 99.408 63.769 218.653 63.769Z"
142
+ }));
143
+ };
144
+ var __defProp2 = Object.defineProperty;
145
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
146
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
147
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
148
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, {
149
+ enumerable: true,
150
+ configurable: true,
151
+ writable: true,
152
+ value
153
+ }) : obj[key] = value;
154
+ var __spreadValues2 = (a, b) => {
155
+ for (var prop in b || (b = {}))
156
+ if (__hasOwnProp2.call(b, prop))
157
+ __defNormalProp2(a, prop, b[prop]);
158
+ if (__getOwnPropSymbols2)
159
+ for (var prop of __getOwnPropSymbols2(b)) {
160
+ if (__propIsEnum2.call(b, prop))
161
+ __defNormalProp2(a, prop, b[prop]);
162
+ }
163
+ return a;
164
+ };
165
+ var __objRest = (source, exclude) => {
166
+ var target = {};
167
+ for (var prop in source)
168
+ if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
169
+ target[prop] = source[prop];
170
+ if (source != null && __getOwnPropSymbols2)
171
+ for (var prop of __getOwnPropSymbols2(source)) {
172
+ if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
173
+ target[prop] = source[prop];
174
+ }
175
+ return target;
176
+ };
177
+ const VisibilityOff = (_a) => {
178
+ var _b = _a, { title, titleId } = _b, props = __objRest(_b, ["title", "titleId"]);
179
+ return React__namespace.createElement("svg", __spreadValues2({
180
+ xmlns: "http://www.w3.org/2000/svg",
181
+ viewBox: "0 -960 960 960",
182
+ "aria-labelledby": titleId
183
+ }, props), title ? React__namespace.createElement("title", {
184
+ id: titleId
185
+ }, title) : null, React__namespace.createElement("path", {
186
+ d: "m620.153-434.386-34.768-34.768q21.384-67.539-28.539-111.461-49.923-43.923-107.692-24.77l-34.768-34.768q13.538-7.923 30.307-11.769T480-655.768q65.23 0 110.499 45.269Q635.768-565.23 635.768-500q0 18.538-4.154 35.999-4.153 17.462-11.461 29.615Zm127.846 126.692-31.153-29.999q45.923-34.077 80.692-75.884 34.769-41.808 52.923-86.423-50-108.307-148.461-171.461-98.462-63.154-214.693-63.154-38.538 0-78.114 7.038-39.577 7.039-65.346 16.885l-34.846-35.461q33.462-14.461 81.423-24.153 47.961-9.693 93.422-9.693 134.538 0 248.038 76.115Q845.383-627.769 898.46-500q-24.461 57.461-62.192 105.653-37.731 48.192-88.269 86.653Zm59.923 216.769-161.845-160q-30.769 13.616-74.384 22.27-43.616 8.654-91.693 8.654-137.538 0-250.768-76.115Q116.001-372.231 61.54-500q21.539-52.385 59.154-101.115 37.616-48.731 87.077-89.115L85.233-812.384l31.999-32.615L837.691-124.54l-29.769 33.615ZM238.77-658.231q-37.384 26.231-74.961 71-37.578 44.769-54.885 87.231 50.615 108.307 150.807 171.461 100.192 63.154 225.961 63.154 37.231 0 73.655-5.731 36.423-5.731 52.423-14.115l-70.924-70.924q-10.615 5.385-28.346 8.654t-32.5 3.269q-64.615 0-110.192-44.961Q324.232-434.154 324.232-500q0-15 3.269-31.923t8.654-28.923l-97.385-97.385ZM531.462-517Zm-105.999 53.384Z"
187
+ }));
188
+ };
189
+ function PasswordButton(props) {
190
+ const { hasError = false, inputSize = "md", isDisabled = false, isPasswordVisible = false, toggleVisibility, isInputHovered = false } = props;
191
+ return React.createElement(UnstyledButton_index.UnstyledButton, {
192
+ className: utilities_css.classNames(InputIcon.styles.passwordBtn, isInputHovered && InputIcon.styles.hovered, hasError && InputIcon.styles.passwordBtnError, InputIcon.styles[utilities_css.variationName("passwordBtn", inputSize)]),
193
+ onPress: toggleVisibility,
194
+ isDisabled
195
+ }, React.createElement(Text_index.Text, {
196
+ visuallyHidden: true
197
+ }, "password visibility"), React.createElement(Icon_index.Icon, {
198
+ symbol: isPasswordVisible ? Visibility : VisibilityOff,
199
+ size: InputIcon.mapIconSize(inputSize)
200
+ }));
201
+ }
202
+ function useInputField(props, ref) {
203
+ const { isMultiline = false } = props;
204
+ const { labelProps, inputProps, descriptionProps: helperTextProps, errorMessageProps: errorTextProps } = $2d73ec29415bd339$export$712718f7aec83d5(__spreadProps(__spreadValues({}, props), {
205
+ inputElementType: InputIcon.getElementType(isMultiline)
206
+ }), ref);
207
+ let elementProps = {};
208
+ if (isMultiline) {
209
+ elementProps = inputProps;
210
+ } else {
211
+ elementProps = inputProps;
212
+ }
213
+ return {
214
+ labelProps,
215
+ elementProps,
216
+ helperTextProps,
217
+ errorTextProps
218
+ };
219
+ }
220
+ function InputField(props) {
221
+ const { isMultiline = false, type = "text", size = "md", isLabelVisuallyHidden = false, isDisabled = false, isRequired = false, validationState = "valid", isLabelEmphasized = false, autoFocus = false, label, errorText, helperText, placeholder, value, defaultValue, iconAtStart, iconAtEnd, rows } = props;
222
+ const [isPasswordVisible, setIsPasswordVisible] = React.useState(false);
223
+ const ref = React.useRef(null);
224
+ const { labelProps, elementProps, helperTextProps, errorTextProps } = useInputField(props, ref);
225
+ const { isHovered: isInputHovered, hoverProps } = _import.$6179b936705e76d3$export$ae780daf29e6d456(props);
226
+ const Component = InputIcon.getElementType(isMultiline);
227
+ const bothIconPropsDefined = !!iconAtEnd && !!iconAtStart;
228
+ const smallSizeTextarea = size === "sm" && Component === "textarea";
229
+ const definedIconsWithTextarea = (!!iconAtEnd || !!iconAtStart) && Component === "textarea";
230
+ InputIcon.logWarningsForInvalidPropConfiguration(bothIconPropsDefined, smallSizeTextarea, definedIconsWithTextarea);
231
+ const isPassword = type === "password";
232
+ const hasError = validationState === "invalid";
233
+ const showErrorText = hasError && errorText;
234
+ const showHelperText = !showErrorText && helperText;
235
+ const canUseIcon = !bothIconPropsDefined && !isPassword && !definedIconsWithTextarea;
236
+ const hasStartIcon = canUseIcon && iconAtStart;
237
+ const hasEndIcon = canUseIcon && iconAtEnd;
238
+ const isTypeAdjustedForPasswordVisibility = isPassword && isPasswordVisible;
239
+ const captionProps = showHelperText ? helperTextProps : errorTextProps;
240
+ const captionText = showHelperText ? helperText : errorText;
241
+ const adjustedSize = smallSizeTextarea ? "md" : size;
242
+ const className = utilities_css.classNames(InputIcon.styles.input, isInputHovered && InputIcon.styles.hovered, Component === "textarea" && InputIcon.styles.textArea, isPassword && InputIcon.styles.passwordInput, hasError && InputIcon.styles.errorInput, hasStartIcon && InputIcon.styles.iconStartInput, hasEndIcon && InputIcon.styles.iconEndInput, InputIcon.styles[utilities_css.variationName("inputSize", adjustedSize)]);
243
+ const inputType = Component === "textarea" ? void 0 : isTypeAdjustedForPasswordVisibility ? "text" : type;
244
+ return React.createElement("div", {
245
+ className: utilities_css.classNames(InputIcon.styles.root)
246
+ }, React.createElement(InputIcon.Label, __spreadValues({
247
+ isLabelVisuallyHidden,
248
+ fieldSize: adjustedSize,
249
+ hasError,
250
+ isLabelEmphasized
251
+ }, labelProps), label), React.createElement("div", {
252
+ className: InputIcon.styles.inputIconContainer
253
+ }, hasStartIcon && React.createElement(InputIcon.InputIcon, {
254
+ alignment: "start",
255
+ size: adjustedSize,
256
+ isDisabled,
257
+ icon: iconAtStart
258
+ }), React.createElement(Component, __spreadProps(__spreadValues(__spreadValues({}, elementProps), hoverProps), {
259
+ className,
260
+ ref,
261
+ type: inputType,
262
+ value,
263
+ required: isRequired,
264
+ disabled: isDisabled,
265
+ placeholder,
266
+ autoFocus,
267
+ defaultValue,
268
+ rows: Component === "textarea" ? rows : void 0
269
+ })), isPassword ? React.createElement(PasswordButton, {
270
+ isInputHovered,
271
+ hasError,
272
+ inputSize: adjustedSize,
273
+ isDisabled,
274
+ isPasswordVisible,
275
+ toggleVisibility: () => setIsPasswordVisible((prevVisibility) => !prevVisibility)
276
+ }) : hasEndIcon && React.createElement(InputIcon.InputIcon, {
277
+ alignment: "end",
278
+ size: adjustedSize,
279
+ isDisabled,
280
+ icon: iconAtEnd
281
+ })), (showErrorText || showHelperText) && React.createElement(InputIcon.InputCaption, __spreadValues({
282
+ variant: showHelperText ? "helper" : "error"
283
+ }, captionProps), captionText));
284
+ }
285
+ exports.InputField = InputField;