@easypost/easy-ui 1.0.0-alpha.4 → 1.0.0-alpha.6

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 (133) hide show
  1. package/Badge/index.js +32 -26
  2. package/Badge/index.mjs +32 -26
  3. package/Banner/index.js +15 -16
  4. package/Banner/index.mjs +15 -16
  5. package/Button/Button.d.ts +61 -0
  6. package/Button/Button.d.ts.map +1 -1
  7. package/Button/index.js +34 -69
  8. package/Button/index.mjs +33 -68
  9. package/CHANGELOG.md +21 -0
  10. package/Card/index.js +84 -5
  11. package/Card/index.mjs +84 -5
  12. package/Checkbox/index.js +84 -72
  13. package/Checkbox/index.mjs +84 -72
  14. package/CodeBlock/index.js +43 -49
  15. package/CodeBlock/index.mjs +43 -49
  16. package/DropdownButton/DropdownButton.d.ts +48 -0
  17. package/DropdownButton/DropdownButton.d.ts.map +1 -1
  18. package/DropdownButton/index.js +29 -101
  19. package/DropdownButton/index.mjs +29 -85
  20. package/HorizontalGrid/index.js +11 -31
  21. package/HorizontalGrid/index.mjs +11 -31
  22. package/HorizontalStack/index.js +48 -4
  23. package/HorizontalStack/index.mjs +48 -4
  24. package/Icon/Icon.d.ts +51 -0
  25. package/Icon/Icon.d.ts.map +1 -1
  26. package/Icon/index.js +38 -4
  27. package/Icon/index.mjs +38 -4
  28. package/IconButton/IconButton.d.ts +62 -0
  29. package/IconButton/IconButton.d.ts.map +1 -1
  30. package/IconButton/index.js +26 -43
  31. package/IconButton/index.mjs +25 -42
  32. package/InputField/Label.d.ts +2 -2
  33. package/InputField/index.js +282 -10
  34. package/InputField/index.mjs +266 -10
  35. package/InputField/utilities.d.ts +1 -1
  36. package/InputField/utilities.d.ts.map +1 -1
  37. package/Menu/MenuOverlay.d.ts.map +1 -1
  38. package/Menu/index.js +178 -1958
  39. package/Menu/index.mjs +168 -1948
  40. package/Menu/utilities.d.ts +11 -0
  41. package/Menu/utilities.d.ts.map +1 -0
  42. package/Notification/index.js +1534 -14
  43. package/Notification/index.mjs +1518 -14
  44. package/Provider/index.js +15 -15
  45. package/Provider/index.mjs +15 -15
  46. package/RadioGroup/index.js +63 -63
  47. package/RadioGroup/index.mjs +63 -63
  48. package/Select/Select.d.ts +88 -0
  49. package/Select/Select.d.ts.map +1 -0
  50. package/Select/Select.stories.d.ts +17 -0
  51. package/Select/Select.stories.d.ts.map +1 -0
  52. package/Select/Select.test.d.ts +2 -0
  53. package/Select/Select.test.d.ts.map +1 -0
  54. package/Select/SelectContext.d.ts +14 -0
  55. package/Select/SelectContext.d.ts.map +1 -0
  56. package/Select/SelectField.d.ts +62 -0
  57. package/Select/SelectField.d.ts.map +1 -0
  58. package/Select/SelectOption.d.ts +23 -0
  59. package/Select/SelectOption.d.ts.map +1 -0
  60. package/Select/SelectOverlay.d.ts +3 -0
  61. package/Select/SelectOverlay.d.ts.map +1 -0
  62. package/Select/SelectSection.d.ts +22 -0
  63. package/Select/SelectSection.d.ts.map +1 -0
  64. package/Select/SelectTrigger.d.ts +30 -0
  65. package/Select/SelectTrigger.d.ts.map +1 -0
  66. package/Select/index.d.ts +2 -0
  67. package/Select/index.d.ts.map +1 -0
  68. package/Select/index.js +816 -0
  69. package/Select/index.mjs +816 -0
  70. package/SelectorErrorTooltip/index.js +102 -11
  71. package/SelectorErrorTooltip/index.mjs +86 -11
  72. package/Text/index.js +85 -4
  73. package/Text/index.mjs +85 -4
  74. package/TextField/index.js +19 -38
  75. package/TextField/index.mjs +19 -38
  76. package/Textarea/index.js +20 -37
  77. package/Textarea/index.mjs +20 -37
  78. package/Theme/index.js +145 -9
  79. package/Theme/index.mjs +145 -9
  80. package/Toggle/index.js +51 -50
  81. package/Toggle/index.mjs +51 -50
  82. package/Tooltip/index.js +299 -10
  83. package/Tooltip/index.mjs +299 -10
  84. package/UnstyledButton/index.js +4 -4
  85. package/UnstyledButton/index.mjs +3 -3
  86. package/VerticalStack/index.js +13 -47
  87. package/VerticalStack/index.mjs +13 -47
  88. package/__chunks__/ExpandMore400-7c5263a4.mjs +49 -0
  89. package/__chunks__/ExpandMore400-92646971.js +65 -0
  90. package/__chunks__/InputIcon-2317befd.mjs +148 -0
  91. package/__chunks__/InputIcon-d3963cf8.js +147 -0
  92. package/__chunks__/{import-e7f45c7e.mjs → import-0561e1ba.mjs} +3 -3
  93. package/__chunks__/{import-b7971a11.mjs → import-19bc38ac.mjs} +72 -34
  94. package/__chunks__/{import-01299af6.js → import-24a482e1.js} +3 -2
  95. package/__chunks__/{import-baa3cd0c.mjs → import-29af6941.mjs} +4 -3
  96. package/__chunks__/{import-0d1b4d93.js → import-2b302763.js} +193 -141
  97. package/__chunks__/{import-ab878fb6.mjs → import-3d962a94.mjs} +205 -153
  98. package/__chunks__/{import-86330a7c.mjs → import-6a831ca1.mjs} +16 -15
  99. package/__chunks__/{import-7545401a.js → import-8b6c0bc7.js} +3 -3
  100. package/__chunks__/{import-63bf0645.js → import-a1e0f814.js} +47 -9
  101. package/__chunks__/{import-3ab42f86.js → import-a2023d8f.js} +35 -22
  102. package/__chunks__/{import-76076ca6.js → import-dea5a24d.js} +15 -14
  103. package/__chunks__/{import-856e0385.mjs → import-f1f4792a.mjs} +36 -23
  104. package/__chunks__/{UnstyledButton-883f0c6c.mjs → index-29d7bca9.mjs} +17 -42
  105. package/__chunks__/{UnstyledButton-96172ec0.js → index-3985350a.js} +17 -42
  106. package/__chunks__/{overlayscrollbars-react.es-c8369a03.mjs → overlayscrollbars-react.es-7f332a3b.mjs} +4 -4
  107. package/__chunks__/{overlayscrollbars-react.es-20563393.js → overlayscrollbars-react.es-f2a0bcff.js} +4 -4
  108. package/__chunks__/{real-module-e4cd2301.mjs → real-module-515df21d.mjs} +1 -1
  109. package/__chunks__/{real-module-ae2a4342.js → real-module-e36b1436.js} +1 -1
  110. package/__chunks__/useTriggerWidth-156b038a.js +2030 -0
  111. package/__chunks__/useTriggerWidth-addcd1d6.mjs +2031 -0
  112. package/package.json +11 -11
  113. package/style.css +1423 -1196
  114. package/utilities/css.js +14 -58
  115. package/utilities/css.mjs +14 -58
  116. package/__chunks__/Card-7bbd41e0.mjs +0 -110
  117. package/__chunks__/Card-dac53c75.js +0 -109
  118. package/__chunks__/HorizontalStack-a441c63f.mjs +0 -80
  119. package/__chunks__/HorizontalStack-a862839b.js +0 -79
  120. package/__chunks__/Icon-3d00481a.js +0 -44
  121. package/__chunks__/Icon-a75b5201.mjs +0 -45
  122. package/__chunks__/InputField-4fbaae06.js +0 -487
  123. package/__chunks__/InputField-a272f602.mjs +0 -472
  124. package/__chunks__/Notification-b8eafec6.mjs +0 -1456
  125. package/__chunks__/Notification-c5b34eb3.js +0 -1471
  126. package/__chunks__/SelectorErrorTooltip-43c5e29e.js +0 -84
  127. package/__chunks__/SelectorErrorTooltip-b6204987.mjs +0 -69
  128. package/__chunks__/Text-1ae70c19.js +0 -102
  129. package/__chunks__/Text-4ae50d5c.mjs +0 -103
  130. package/__chunks__/Theme-4e498252.mjs +0 -132
  131. package/__chunks__/Theme-751e5575.js +0 -131
  132. package/__chunks__/Tooltip-bd55165e.js +0 -317
  133. package/__chunks__/Tooltip-f7e67b21.mjs +0 -318
@@ -1,487 +0,0 @@
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));
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- const React = require("react");
34
- const utilities_css = require("../utilities/css.js");
35
- const Text = require("./Text-1ae70c19.js");
36
- const Icon = require("./Icon-3d00481a.js");
37
- const UnstyledButton = require("./UnstyledButton-96172ec0.js");
38
- const _import$2 = require("./import-63bf0645.js");
39
- const _import$1 = require("./import-01299af6.js");
40
- const _import = require("./import-0d1b4d93.js");
41
- function _interopNamespaceDefault(e) {
42
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
43
- if (e) {
44
- for (const k in e) {
45
- if (k !== "default") {
46
- const d = Object.getOwnPropertyDescriptor(e, k);
47
- Object.defineProperty(n, k, d.get ? d : {
48
- enumerable: true,
49
- get: () => e[k]
50
- });
51
- }
52
- }
53
- }
54
- n.default = e;
55
- return Object.freeze(n);
56
- }
57
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
58
- function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
59
- let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, validationState, type = "text", onChange = () => {
60
- } } = props;
61
- let { focusableProps } = _import.$e6afbd83fe6ebbd2$export$4c014de7c8940b4c(props, ref);
62
- let { labelProps, fieldProps, descriptionProps, errorMessageProps } = _import$1.$2baaea4c71418dea$export$294aa081a6c6f55d(props);
63
- let domProps = _import$2.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
64
- labelable: true
65
- });
66
- const inputOnlyProps = {
67
- type,
68
- pattern: props.pattern
69
- };
70
- return {
71
- labelProps,
72
- inputProps: _import$2.$3ef42575df84b30b$export$9d1611c77c2fe928(domProps, inputElementType === "input" && inputOnlyProps, __spreadValues(__spreadValues({
73
- disabled: isDisabled,
74
- readOnly: isReadOnly,
75
- "aria-required": isRequired || void 0,
76
- "aria-invalid": validationState === "invalid" || void 0,
77
- "aria-errormessage": props["aria-errormessage"],
78
- "aria-activedescendant": props["aria-activedescendant"],
79
- "aria-autocomplete": props["aria-autocomplete"],
80
- "aria-haspopup": props["aria-haspopup"],
81
- value: props.value,
82
- defaultValue: props.value ? void 0 : props.defaultValue,
83
- onChange: (e) => onChange(e.target.value),
84
- autoComplete: props.autoComplete,
85
- maxLength: props.maxLength,
86
- minLength: props.minLength,
87
- name: props.name,
88
- placeholder: props.placeholder,
89
- inputMode: props.inputMode,
90
- // Clipboard events
91
- onCopy: props.onCopy,
92
- onCut: props.onCut,
93
- onPaste: props.onPaste,
94
- // Composition events
95
- onCompositionEnd: props.onCompositionEnd,
96
- onCompositionStart: props.onCompositionStart,
97
- onCompositionUpdate: props.onCompositionUpdate,
98
- // Selection events
99
- onSelect: props.onSelect,
100
- // Input events
101
- onBeforeInput: props.onBeforeInput,
102
- onInput: props.onInput
103
- }, focusableProps), fieldProps)),
104
- descriptionProps,
105
- errorMessageProps
106
- };
107
- }
108
- const root = "_root_1rp7g_5";
109
- const inputIconContainer = "_inputIconContainer_1rp7g_25";
110
- const label = "_label_1rp7g_31";
111
- const labelHidden = "_labelHidden_1rp7g_35";
112
- const input = "_input_1rp7g_25";
113
- const errorInput = "_errorInput_1rp7g_73";
114
- const inputSizeSm = "_inputSizeSm_1rp7g_81";
115
- const inputSizeLg = "_inputSizeLg_1rp7g_95";
116
- const passwordInput = "_passwordInput_1rp7g_103";
117
- const passwordBtn = "_passwordBtn_1rp7g_113";
118
- const hovered = "_hovered_1rp7g_144";
119
- const textArea = "_textArea_1rp7g_153";
120
- const passwordBtnError = "_passwordBtnError_1rp7g_158";
121
- const passwordBtnSm = "_passwordBtnSm_1rp7g_164";
122
- const passwordBtnLg = "_passwordBtnLg_1rp7g_173";
123
- const icon = "_icon_1rp7g_182";
124
- const iconDisabled = "_iconDisabled_1rp7g_192";
125
- const iconStart = "_iconStart_1rp7g_196";
126
- const iconEnd = "_iconEnd_1rp7g_200";
127
- const iconStartInput = "_iconStartInput_1rp7g_204";
128
- const iconEndInput = "_iconEndInput_1rp7g_208";
129
- const inputIconPlacementSm = "_inputIconPlacementSm_1rp7g_212";
130
- const inputIconPlacementLg = "_inputIconPlacementLg_1rp7g_216";
131
- const caption = "_caption_1rp7g_220";
132
- const styles = {
133
- root,
134
- inputIconContainer,
135
- label,
136
- labelHidden,
137
- input,
138
- errorInput,
139
- inputSizeSm,
140
- inputSizeLg,
141
- passwordInput,
142
- passwordBtn,
143
- hovered,
144
- textArea,
145
- passwordBtnError,
146
- passwordBtnSm,
147
- passwordBtnLg,
148
- icon,
149
- iconDisabled,
150
- iconStart,
151
- iconEnd,
152
- iconStartInput,
153
- iconEndInput,
154
- inputIconPlacementSm,
155
- inputIconPlacementLg,
156
- caption
157
- };
158
- function Label(props) {
159
- const _a = props, {
160
- isLabelVisuallyHidden = false,
161
- isLabelEmphasized = false,
162
- inputSize = "md",
163
- hasError = false,
164
- children
165
- } = _a, labelProps = __objRest(_a, [
166
- "isLabelVisuallyHidden",
167
- "isLabelEmphasized",
168
- "inputSize",
169
- "hasError",
170
- "children"
171
- ]);
172
- const textVariant = isLabelEmphasized ? "subtitle1" : inputSize === "sm" ? "body2" : "body1";
173
- const as = isLabelEmphasized ? "strong" : "span";
174
- const color = hasError ? "danger" : void 0;
175
- return /* @__PURE__ */ React.createElement(
176
- "label",
177
- __spreadProps(__spreadValues({}, labelProps), {
178
- className: utilities_css.classNames(
179
- styles.label,
180
- isLabelVisuallyHidden && styles.labelHidden
181
- )
182
- }),
183
- /* @__PURE__ */ React.createElement(
184
- Text.Text,
185
- {
186
- variant: textVariant,
187
- as,
188
- color,
189
- visuallyHidden: isLabelVisuallyHidden
190
- },
191
- children
192
- )
193
- );
194
- }
195
- function InputCaption(props) {
196
- const _a = props, { variant, children } = _a, captionTextProps = __objRest(_a, ["variant", "children"]);
197
- return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, captionTextProps), { className: styles.caption }), /* @__PURE__ */ React.createElement(
198
- Text.Text,
199
- {
200
- variant: "caption",
201
- color: variant === "helper" ? "subdued" : "danger"
202
- },
203
- children
204
- ));
205
- }
206
- var __defProp$1 = Object.defineProperty;
207
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
208
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
209
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
210
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
211
- var __spreadValues$1 = (a, b) => {
212
- for (var prop in b || (b = {}))
213
- if (__hasOwnProp$1.call(b, prop))
214
- __defNormalProp$1(a, prop, b[prop]);
215
- if (__getOwnPropSymbols$1)
216
- for (var prop of __getOwnPropSymbols$1(b)) {
217
- if (__propIsEnum$1.call(b, prop))
218
- __defNormalProp$1(a, prop, b[prop]);
219
- }
220
- return a;
221
- };
222
- var __objRest$1 = (source, exclude) => {
223
- var target = {};
224
- for (var prop in source)
225
- if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
226
- target[prop] = source[prop];
227
- if (source != null && __getOwnPropSymbols$1)
228
- for (var prop of __getOwnPropSymbols$1(source)) {
229
- if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
230
- target[prop] = source[prop];
231
- }
232
- return target;
233
- };
234
- const Visibility = (_a) => {
235
- var _b = _a, {
236
- title,
237
- titleId
238
- } = _b, props = __objRest$1(_b, [
239
- "title",
240
- "titleId"
241
- ]);
242
- return /* @__PURE__ */ React__namespace.createElement("svg", __spreadValues$1({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 -960 960 960", "aria-labelledby": titleId }, props), title ? /* @__PURE__ */ React__namespace.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React__namespace.createElement("path", { 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" }));
243
- };
244
- var __defProp2 = Object.defineProperty;
245
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
246
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
247
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
248
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
249
- var __spreadValues2 = (a, b) => {
250
- for (var prop in b || (b = {}))
251
- if (__hasOwnProp2.call(b, prop))
252
- __defNormalProp2(a, prop, b[prop]);
253
- if (__getOwnPropSymbols2)
254
- for (var prop of __getOwnPropSymbols2(b)) {
255
- if (__propIsEnum2.call(b, prop))
256
- __defNormalProp2(a, prop, b[prop]);
257
- }
258
- return a;
259
- };
260
- var __objRest2 = (source, exclude) => {
261
- var target = {};
262
- for (var prop in source)
263
- if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
264
- target[prop] = source[prop];
265
- if (source != null && __getOwnPropSymbols2)
266
- for (var prop of __getOwnPropSymbols2(source)) {
267
- if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
268
- target[prop] = source[prop];
269
- }
270
- return target;
271
- };
272
- const VisibilityOff = (_a) => {
273
- var _b = _a, {
274
- title,
275
- titleId
276
- } = _b, props = __objRest2(_b, [
277
- "title",
278
- "titleId"
279
- ]);
280
- return /* @__PURE__ */ React__namespace.createElement("svg", __spreadValues2({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 -960 960 960", "aria-labelledby": titleId }, props), title ? /* @__PURE__ */ React__namespace.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React__namespace.createElement("path", { 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" }));
281
- };
282
- function mapIconSize(size) {
283
- if (size === "sm") {
284
- return "xs";
285
- } else if (size === "lg") {
286
- return "md";
287
- }
288
- return size;
289
- }
290
- function logWarningsForInvalidPropConfiguration(bothIconPropsDefined, smallSizeTextarea, definedIconsWithTextarea) {
291
- if (bothIconPropsDefined) {
292
- console.warn("Cannot simultaneously define `iconAtEnd` and `iconAtStart`");
293
- }
294
- if (smallSizeTextarea) {
295
- console.warn("`textarea` cannot be defined with size `sm`");
296
- }
297
- if (definedIconsWithTextarea) {
298
- console.warn("Cannot define `textarea` with `iconAtEnd` or `iconAtStart`");
299
- }
300
- }
301
- function getElementType(isMultiline) {
302
- return isMultiline ? "textarea" : "input";
303
- }
304
- function PasswordButton(props) {
305
- const {
306
- hasError = false,
307
- inputSize = "md",
308
- isDisabled = false,
309
- isPasswordVisible = false,
310
- toggleVisibility,
311
- isInputHovered = false
312
- } = props;
313
- return /* @__PURE__ */ React.createElement(
314
- UnstyledButton.UnstyledButton,
315
- {
316
- className: utilities_css.classNames(
317
- styles.passwordBtn,
318
- isInputHovered && styles.hovered,
319
- hasError && styles.passwordBtnError,
320
- styles[utilities_css.variationName("passwordBtn", inputSize)]
321
- ),
322
- onPress: toggleVisibility,
323
- isDisabled
324
- },
325
- /* @__PURE__ */ React.createElement(Text.Text, { visuallyHidden: true }, "password visibility"),
326
- /* @__PURE__ */ React.createElement(
327
- Icon.Icon,
328
- {
329
- symbol: isPasswordVisible ? Visibility : VisibilityOff,
330
- size: mapIconSize(inputSize)
331
- }
332
- )
333
- );
334
- }
335
- function InputIcon(props) {
336
- const { alignment = "start", size = "md", isDisabled = false, icon: icon2 } = props;
337
- return /* @__PURE__ */ React.createElement(
338
- "div",
339
- {
340
- className: utilities_css.classNames(
341
- styles.icon,
342
- alignment === "start" ? styles.iconStart : styles.iconEnd,
343
- isDisabled && styles.iconDisabled,
344
- styles[utilities_css.variationName("inputIconPlacement", size)]
345
- )
346
- },
347
- /* @__PURE__ */ React.createElement(Icon.Icon, { symbol: icon2, size: mapIconSize(size) })
348
- );
349
- }
350
- function useInputField(props, ref) {
351
- const { isMultiline = false } = props;
352
- const {
353
- labelProps,
354
- inputProps,
355
- descriptionProps: helperTextProps,
356
- errorMessageProps: errorTextProps
357
- } = $2d73ec29415bd339$export$712718f7aec83d5(
358
- __spreadProps(__spreadValues({}, props), { inputElementType: getElementType(isMultiline) }),
359
- ref
360
- );
361
- let elementProps = {};
362
- if (isMultiline) {
363
- elementProps = inputProps;
364
- } else {
365
- elementProps = inputProps;
366
- }
367
- return {
368
- labelProps,
369
- elementProps,
370
- helperTextProps,
371
- errorTextProps
372
- };
373
- }
374
- function InputField(props) {
375
- const {
376
- isMultiline = false,
377
- type = "text",
378
- size = "md",
379
- isLabelVisuallyHidden = false,
380
- isDisabled = false,
381
- isRequired = false,
382
- validationState = "valid",
383
- isLabelEmphasized = false,
384
- autoFocus = false,
385
- label: label2,
386
- errorText,
387
- helperText,
388
- placeholder,
389
- value,
390
- defaultValue,
391
- iconAtStart,
392
- iconAtEnd,
393
- rows
394
- } = props;
395
- const [isPasswordVisible, setIsPasswordVisible] = React.useState(false);
396
- const ref = React.useRef(null);
397
- const { labelProps, elementProps, helperTextProps, errorTextProps } = useInputField(props, ref);
398
- const { isHovered: isInputHovered, hoverProps } = _import.$6179b936705e76d3$export$ae780daf29e6d456(props);
399
- const Component = getElementType(isMultiline);
400
- const bothIconPropsDefined = !!iconAtEnd && !!iconAtStart;
401
- const smallSizeTextarea = size === "sm" && Component === "textarea";
402
- const definedIconsWithTextarea = (!!iconAtEnd || !!iconAtStart) && Component === "textarea";
403
- logWarningsForInvalidPropConfiguration(
404
- bothIconPropsDefined,
405
- smallSizeTextarea,
406
- definedIconsWithTextarea
407
- );
408
- const isPassword = type === "password";
409
- const hasError = validationState === "invalid";
410
- const showErrorText = hasError && errorText;
411
- const showHelperText = !showErrorText && helperText;
412
- const canUseIcon = !bothIconPropsDefined && !isPassword && !definedIconsWithTextarea;
413
- const hasStartIcon = canUseIcon && iconAtStart;
414
- const hasEndIcon = canUseIcon && iconAtEnd;
415
- const isTypeAdjustedForPasswordVisibility = isPassword && isPasswordVisible;
416
- const captionProps = showHelperText ? helperTextProps : errorTextProps;
417
- const captionText = showHelperText ? helperText : errorText;
418
- const adjustedSize = smallSizeTextarea ? "md" : size;
419
- const className = utilities_css.classNames(
420
- styles.input,
421
- isInputHovered && styles.hovered,
422
- Component === "textarea" && styles.textArea,
423
- isPassword && styles.passwordInput,
424
- hasError && styles.errorInput,
425
- hasStartIcon && styles.iconStartInput,
426
- hasEndIcon && styles.iconEndInput,
427
- styles[utilities_css.variationName("inputSize", adjustedSize)]
428
- );
429
- const inputType = Component === "textarea" ? void 0 : isTypeAdjustedForPasswordVisibility ? "text" : type;
430
- return /* @__PURE__ */ React.createElement("div", { className: utilities_css.classNames(styles.root) }, /* @__PURE__ */ React.createElement(
431
- Label,
432
- __spreadValues({
433
- isLabelVisuallyHidden,
434
- inputSize: adjustedSize,
435
- hasError,
436
- isLabelEmphasized
437
- }, labelProps),
438
- label2
439
- ), /* @__PURE__ */ React.createElement("div", { className: styles.inputIconContainer }, hasStartIcon && /* @__PURE__ */ React.createElement(
440
- InputIcon,
441
- {
442
- alignment: "start",
443
- size: adjustedSize,
444
- isDisabled,
445
- icon: iconAtStart
446
- }
447
- ), /* @__PURE__ */ React.createElement(
448
- Component,
449
- __spreadProps(__spreadValues(__spreadValues({}, elementProps), hoverProps), {
450
- className,
451
- ref,
452
- type: inputType,
453
- value,
454
- required: isRequired,
455
- disabled: isDisabled,
456
- placeholder,
457
- autoFocus,
458
- defaultValue,
459
- rows: Component === "textarea" ? rows : void 0
460
- })
461
- ), isPassword ? /* @__PURE__ */ React.createElement(
462
- PasswordButton,
463
- {
464
- isInputHovered,
465
- hasError,
466
- inputSize: adjustedSize,
467
- isDisabled,
468
- isPasswordVisible,
469
- toggleVisibility: () => setIsPasswordVisible((prevVisibility) => !prevVisibility)
470
- }
471
- ) : hasEndIcon && /* @__PURE__ */ React.createElement(
472
- InputIcon,
473
- {
474
- alignment: "end",
475
- size: adjustedSize,
476
- isDisabled,
477
- icon: iconAtEnd
478
- }
479
- )), (showErrorText || showHelperText) && /* @__PURE__ */ React.createElement(
480
- InputCaption,
481
- __spreadValues({
482
- variant: showHelperText ? "helper" : "error"
483
- }, captionProps),
484
- captionText
485
- ));
486
- }
487
- exports.InputField = InputField;