@easypost/easy-ui 1.0.0-alpha.5 → 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.
- package/Badge/index.js +16 -16
- package/Badge/index.mjs +14 -14
- package/Banner/index.js +7 -7
- package/Banner/index.mjs +5 -5
- package/Button/Button.d.ts +61 -0
- package/Button/Button.d.ts.map +1 -1
- package/Button/index.js +23 -23
- package/Button/index.mjs +20 -20
- package/CHANGELOG.md +8 -0
- package/Card/index.js +84 -5
- package/Card/index.mjs +84 -5
- package/Checkbox/index.js +26 -26
- package/Checkbox/index.mjs +24 -24
- package/CodeBlock/index.js +4 -4
- package/CodeBlock/index.mjs +4 -4
- package/DropdownButton/DropdownButton.d.ts +48 -0
- package/DropdownButton/DropdownButton.d.ts.map +1 -1
- package/DropdownButton/index.js +17 -17
- package/DropdownButton/index.mjs +15 -15
- package/HorizontalGrid/index.js +1 -1
- package/HorizontalGrid/index.mjs +1 -1
- package/HorizontalStack/index.js +48 -4
- package/HorizontalStack/index.mjs +48 -4
- package/Icon/Icon.d.ts +51 -0
- package/Icon/Icon.d.ts.map +1 -1
- package/Icon/index.js +38 -4
- package/Icon/index.mjs +38 -4
- package/IconButton/IconButton.d.ts +62 -0
- package/IconButton/IconButton.d.ts.map +1 -1
- package/IconButton/index.js +18 -18
- package/IconButton/index.mjs +15 -15
- package/InputField/index.js +282 -11
- package/InputField/index.mjs +266 -11
- package/Menu/index.js +57 -15
- package/Menu/index.mjs +58 -16
- package/Notification/index.js +1534 -14
- package/Notification/index.mjs +1518 -14
- package/Provider/index.js +8 -8
- package/Provider/index.mjs +8 -8
- package/RadioGroup/index.js +24 -24
- package/RadioGroup/index.mjs +22 -22
- package/Select/index.js +71 -29
- package/Select/index.mjs +71 -29
- package/SelectorErrorTooltip/index.js +99 -8
- package/SelectorErrorTooltip/index.mjs +85 -10
- package/Text/index.js +85 -4
- package/Text/index.mjs +85 -4
- package/TextField/index.js +7 -7
- package/TextField/index.mjs +8 -8
- package/Textarea/index.js +7 -7
- package/Textarea/index.mjs +8 -8
- package/Theme/index.js +145 -9
- package/Theme/index.mjs +145 -9
- package/Toggle/index.js +14 -14
- package/Toggle/index.mjs +14 -14
- package/Tooltip/index.js +297 -8
- package/Tooltip/index.mjs +298 -9
- package/UnstyledButton/index.js +3 -3
- package/UnstyledButton/index.mjs +3 -3
- package/VerticalStack/index.js +3 -3
- package/VerticalStack/index.mjs +3 -3
- package/__chunks__/{InputIcon-4a8e5243.mjs → InputIcon-2317befd.mjs} +26 -26
- package/__chunks__/{InputIcon-70dad3e5.js → InputIcon-d3963cf8.js} +29 -29
- package/__chunks__/{import-9c958e32.mjs → import-0561e1ba.mjs} +2 -2
- package/__chunks__/{import-fbe7cc7e.mjs → import-19bc38ac.mjs} +26 -26
- package/__chunks__/{import-d2e79ac1.mjs → import-29af6941.mjs} +3 -3
- package/__chunks__/{import-9581a2dc.js → import-2b302763.js} +43 -1
- package/__chunks__/{import-a6cadfe8.mjs → import-3d962a94.mjs} +57 -15
- package/__chunks__/{import-d52cd5cf.js → import-8b6c0bc7.js} +1 -1
- package/__chunks__/{import-87c465c9.js → import-a2023d8f.js} +1 -1
- package/__chunks__/{import-29edaaea.mjs → import-f1f4792a.mjs} +9 -9
- package/__chunks__/{UnstyledButton-981cd9af.mjs → index-29d7bca9.mjs} +2 -2
- package/__chunks__/{UnstyledButton-5bbb3c5e.js → index-3985350a.js} +1 -1
- package/__chunks__/{overlayscrollbars-react.es-c8369a03.mjs → overlayscrollbars-react.es-7f332a3b.mjs} +4 -4
- package/__chunks__/{overlayscrollbars-react.es-20563393.js → overlayscrollbars-react.es-f2a0bcff.js} +4 -4
- package/__chunks__/{real-module-2f165429.mjs → real-module-515df21d.mjs} +4 -4
- package/__chunks__/{useTriggerWidth-9528009c.js → useTriggerWidth-156b038a.js} +48 -6
- package/__chunks__/{useTriggerWidth-29becc21.mjs → useTriggerWidth-addcd1d6.mjs} +71 -29
- package/package.json +6 -6
- package/style.css +1437 -1436
- package/__chunks__/Card-2bd533c4.js +0 -85
- package/__chunks__/Card-4ad318ba.mjs +0 -86
- package/__chunks__/HorizontalStack-65adb570.mjs +0 -50
- package/__chunks__/HorizontalStack-f331bfc7.js +0 -49
- package/__chunks__/Icon-1a25dcae.js +0 -39
- package/__chunks__/Icon-6eb724b4.mjs +0 -40
- package/__chunks__/InputField-cc829736.mjs +0 -268
- package/__chunks__/InputField-f5072e37.js +0 -283
- package/__chunks__/Notification-8d749bd1.mjs +0 -1533
- package/__chunks__/Notification-b7a2c277.js +0 -1548
- package/__chunks__/SelectorErrorTooltip-4d820c45.mjs +0 -83
- package/__chunks__/SelectorErrorTooltip-b7bb5b9d.js +0 -98
- package/__chunks__/Text-2efbe1fe.js +0 -86
- package/__chunks__/Text-ec2b8d8a.mjs +0 -87
- package/__chunks__/Theme-123ba2c3.mjs +0 -147
- package/__chunks__/Theme-57f8311c.js +0 -146
- package/__chunks__/Tooltip-b4e23b78.mjs +0 -299
- package/__chunks__/Tooltip-c5076ca7.js +0 -298
package/IconButton/index.js
CHANGED
|
@@ -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
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const UnstyledButton_index = require("../__chunks__/index-3985350a.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-
|
|
39
|
-
const IconButton$1 = "
|
|
40
|
-
const colorPrimary = "
|
|
41
|
-
const colorSecondary = "
|
|
42
|
-
const colorSuccess = "
|
|
43
|
-
const colorWarning = "
|
|
44
|
-
const colorNeutral = "
|
|
45
|
-
const colorSupport = "
|
|
46
|
-
const colorInverse = "
|
|
47
|
-
const variantOutlined = "
|
|
48
|
-
const variantFilled = "
|
|
38
|
+
require("../__chunks__/import-2b302763.js");
|
|
39
|
+
const IconButton$1 = "_IconButton_1yv50_5";
|
|
40
|
+
const colorPrimary = "_colorPrimary_1yv50_20";
|
|
41
|
+
const colorSecondary = "_colorSecondary_1yv50_28";
|
|
42
|
+
const colorSuccess = "_colorSuccess_1yv50_36";
|
|
43
|
+
const colorWarning = "_colorWarning_1yv50_44";
|
|
44
|
+
const colorNeutral = "_colorNeutral_1yv50_52";
|
|
45
|
+
const colorSupport = "_colorSupport_1yv50_60";
|
|
46
|
+
const colorInverse = "_colorInverse_1yv50_66";
|
|
47
|
+
const variantOutlined = "_variantOutlined_1yv50_72";
|
|
48
|
+
const variantFilled = "_variantFilled_1yv50_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
|
-
|
|
64
|
-
return React.createElement(
|
|
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(
|
|
68
|
+
}, restProps), React.createElement(Text_index.Text, {
|
|
69
69
|
visuallyHidden: true
|
|
70
|
-
}, accessibilityLabel), React.createElement(
|
|
70
|
+
}, accessibilityLabel), React.createElement(Icon_index.Icon, {
|
|
71
71
|
symbol: icon
|
|
72
72
|
}));
|
|
73
73
|
});
|
package/IconButton/index.mjs
CHANGED
|
@@ -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__/
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
30
|
+
import { l as logWarningIfInvalidColorVariantCombination, U as UnstyledButton } from "../__chunks__/index-29d7bca9.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-
|
|
34
|
+
import "../__chunks__/import-19bc38ac.mjs";
|
|
35
35
|
import "../__chunks__/omit-f17deb8f.mjs";
|
|
36
|
-
import "../__chunks__/import-
|
|
37
|
-
const IconButton$1 = "
|
|
38
|
-
const colorPrimary = "
|
|
39
|
-
const colorSecondary = "
|
|
40
|
-
const colorSuccess = "
|
|
41
|
-
const colorWarning = "
|
|
42
|
-
const colorNeutral = "
|
|
43
|
-
const colorSupport = "
|
|
44
|
-
const colorInverse = "
|
|
45
|
-
const variantOutlined = "
|
|
46
|
-
const variantFilled = "
|
|
36
|
+
import "../__chunks__/import-3d962a94.mjs";
|
|
37
|
+
const IconButton$1 = "_IconButton_1yv50_5";
|
|
38
|
+
const colorPrimary = "_colorPrimary_1yv50_20";
|
|
39
|
+
const colorSecondary = "_colorSecondary_1yv50_28";
|
|
40
|
+
const colorSuccess = "_colorSuccess_1yv50_36";
|
|
41
|
+
const colorWarning = "_colorWarning_1yv50_44";
|
|
42
|
+
const colorNeutral = "_colorNeutral_1yv50_52";
|
|
43
|
+
const colorSupport = "_colorSupport_1yv50_60";
|
|
44
|
+
const colorInverse = "_colorInverse_1yv50_66";
|
|
45
|
+
const variantOutlined = "_variantOutlined_1yv50_72";
|
|
46
|
+
const variantFilled = "_variantFilled_1yv50_103";
|
|
47
47
|
const styles = {
|
|
48
48
|
IconButton: IconButton$1,
|
|
49
49
|
colorPrimary,
|
package/InputField/index.js
CHANGED
|
@@ -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
|
|
4
|
-
require("
|
|
5
|
-
require("../
|
|
6
|
-
require("../
|
|
7
|
-
require("../
|
|
8
|
-
require("../__chunks__/
|
|
9
|
-
require("../__chunks__/
|
|
10
|
-
require("../__chunks__/import-
|
|
22
|
+
const React = require("react");
|
|
23
|
+
const utilities_css = require("../utilities/css.js");
|
|
24
|
+
const InputIcon = require("../__chunks__/InputIcon-d3963cf8.js");
|
|
25
|
+
const Text_index = require("../Text/index.js");
|
|
26
|
+
const Icon_index = require("../Icon/index.js");
|
|
27
|
+
const UnstyledButton_index = require("../__chunks__/index-3985350a.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-2b302763.js");
|
|
11
31
|
require("../__chunks__/omit-fca26542.js");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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;
|