@box/copy-input 1.13.0 → 1.13.1
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/dist/esm/lib/copy-input.js +42 -42
- package/dist/styles/copy-input.css +1 -1
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useUniqueId as
|
|
2
|
-
import
|
|
1
|
+
import { useUniqueId as b, BaseTextInput as k, Button as F, InlineError as O, Text as q } from "@box/blueprint-web";
|
|
2
|
+
import i from "clsx";
|
|
3
3
|
import { forwardRef as w, useCallback as f } from "react";
|
|
4
4
|
import { useIntl as z } from "react-intl";
|
|
5
5
|
import { messages as h } from "./messages.js";
|
|
6
6
|
import { useClipboardCopy as H } from "./utils.js";
|
|
7
|
-
import { jsxs as
|
|
8
|
-
import '../../styles/copy-input.css';const U = "
|
|
7
|
+
import { jsxs as v, jsx as s } from "react/jsx-runtime";
|
|
8
|
+
import '../../styles/copy-input.css';const U = "_formWrapper_1181v_2", A = "_hasError_1181v_7", G = "_copyInputWrapper_1181v_15", J = "_copied_1181v_20", K = "_copyButton_1181v_35", P = "_copyInput_1181v_15", Q = "_noButton_1181v_44", V = "_subtext_1181v_64", X = "_inlineError_1181v_65", e = {
|
|
9
9
|
formWrapper: U,
|
|
10
10
|
hasError: A,
|
|
11
11
|
copyInputWrapper: G,
|
|
@@ -15,75 +15,75 @@ import '../../styles/copy-input.css';const U = "_formWrapper_1obil_2", A = "_has
|
|
|
15
15
|
noButton: Q,
|
|
16
16
|
subtext: V,
|
|
17
17
|
inlineError: X
|
|
18
|
-
}, Y = /* @__PURE__ */ w((
|
|
18
|
+
}, Y = /* @__PURE__ */ w((I, x) => {
|
|
19
19
|
const {
|
|
20
20
|
id: Z,
|
|
21
|
-
value:
|
|
21
|
+
value: B,
|
|
22
22
|
subtext: p,
|
|
23
23
|
error: r,
|
|
24
24
|
disabled: n,
|
|
25
|
-
ariaLive:
|
|
26
|
-
successStateDuration:
|
|
27
|
-
label:
|
|
25
|
+
ariaLive: E,
|
|
26
|
+
successStateDuration: g,
|
|
27
|
+
label: C,
|
|
28
28
|
onCopy: L,
|
|
29
29
|
hideLabel: W,
|
|
30
30
|
...l
|
|
31
|
-
} =
|
|
32
|
-
copied:
|
|
33
|
-
handleCopy:
|
|
31
|
+
} = I, u = z(), N = u.formatMessage(h.copyButtonLabel), S = u.formatMessage(h.copyButtonCopiedLabel), d = b("inline-error-"), y = b("subtext-"), {
|
|
32
|
+
copied: m,
|
|
33
|
+
handleCopy: _,
|
|
34
34
|
inputRef: T
|
|
35
|
-
} = H(n, L,
|
|
36
|
-
|
|
37
|
-
}, []), M = f((
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
const j =
|
|
43
|
-
[
|
|
35
|
+
} = H(n, L, g), D = f((o) => {
|
|
36
|
+
o.target.select();
|
|
37
|
+
}, []), M = f((o) => {
|
|
38
|
+
o.target instanceof HTMLInputElement && o.target.setSelectionRange(0, o.target.value.length);
|
|
39
|
+
}, []), t = !!r && !n, a = !r && !!p, R = t || a;
|
|
40
|
+
let c = "";
|
|
41
|
+
t ? c = d : a && (c = y);
|
|
42
|
+
const j = i(l["aria-describedby"], {
|
|
43
|
+
[c]: R
|
|
44
44
|
});
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
className:
|
|
47
|
-
[
|
|
45
|
+
return /* @__PURE__ */ v("div", {
|
|
46
|
+
className: i(e.formWrapper, {
|
|
47
|
+
[e.hasError]: r
|
|
48
48
|
}),
|
|
49
|
-
children: [/* @__PURE__ */
|
|
50
|
-
className:
|
|
51
|
-
[
|
|
49
|
+
children: [/* @__PURE__ */ v("div", {
|
|
50
|
+
className: i(e.copyInputWrapper, {
|
|
51
|
+
[e.copied]: m
|
|
52
52
|
}),
|
|
53
53
|
children: [/* @__PURE__ */ s(k, {
|
|
54
54
|
...l,
|
|
55
55
|
ref: T,
|
|
56
56
|
"aria-describedby": j || void 0,
|
|
57
|
-
"aria-invalid":
|
|
58
|
-
className:
|
|
57
|
+
"aria-invalid": t,
|
|
58
|
+
className: e.copyInput,
|
|
59
59
|
disabled: n,
|
|
60
60
|
hideLabel: W,
|
|
61
|
-
invalid:
|
|
62
|
-
label:
|
|
63
|
-
onCopy:
|
|
61
|
+
invalid: t,
|
|
62
|
+
label: C,
|
|
63
|
+
onCopy: _,
|
|
64
64
|
onFocus: D,
|
|
65
65
|
onSelect: M,
|
|
66
66
|
readOnly: !0,
|
|
67
|
-
value:
|
|
67
|
+
value: B
|
|
68
68
|
}), /* @__PURE__ */ s(F, {
|
|
69
|
-
ref:
|
|
70
|
-
"aria-live":
|
|
71
|
-
className:
|
|
69
|
+
ref: x,
|
|
70
|
+
"aria-live": E,
|
|
71
|
+
className: e.copyButton,
|
|
72
72
|
disabled: n,
|
|
73
|
-
onClick:
|
|
73
|
+
onClick: _,
|
|
74
74
|
size: "large",
|
|
75
75
|
variant: "secondary",
|
|
76
|
-
children:
|
|
76
|
+
children: m ? S : N
|
|
77
77
|
})]
|
|
78
|
-
}),
|
|
79
|
-
className:
|
|
78
|
+
}), t ? /* @__PURE__ */ s(O, {
|
|
79
|
+
className: e.inlineError,
|
|
80
80
|
id: d,
|
|
81
81
|
children: r
|
|
82
82
|
}) : a && /* @__PURE__ */ s(q, {
|
|
83
83
|
as: "p",
|
|
84
|
-
className:
|
|
84
|
+
className: e.subtext,
|
|
85
85
|
color: "textOnLightSecondary",
|
|
86
|
-
id:
|
|
86
|
+
id: y,
|
|
87
87
|
variant: "caption",
|
|
88
88
|
children: p
|
|
89
89
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._formWrapper_1181v_2{--border-collapsible-border: var(--border-cta-border-secondary);display:flex;flex-direction:column}._formWrapper_1181v_2._hasError_1181v_7 input:not(:focus-visible){border-color:var(--border-input-border-error)!important;border-width:2px!important}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15{--text-input-disabled-opacity-api: .3;display:flex}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15._copied_1181v_20{--border-collapsible-border: var(--green-light-120);--surface-cta-surface-secondary: var(--green-light-50);--surface-cta-surface-secondary-hover: var(--green-light-50)}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15._copied_1181v_20 input{border-color:var(--green-light-120)!important;border-width:1px!important}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15._copied_1181v_20 input:focus{border-color:var(--outline-focus-on-light)!important;border-width:2px!important}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15._copied_1181v_20 ._copyButton_1181v_35._copyButton_1181v_35{background-color:var(--green-light-50);border-color:var(--green-light-120)}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15 ._copyInput_1181v_15._copyInput_1181v_15{position:relative;left:1px;flex-grow:1}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15 ._copyInput_1181v_15._copyInput_1181v_15:not(._noButton_1181v_44) input{border-top-right-radius:0;border-bottom-right-radius:0}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15 ._copyButton_1181v_35._copyButton_1181v_35{flex-grow:0;align-self:flex-end;border-start-start-radius:0;border-end-start-radius:0}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15 ._copyButton_1181v_35._copyButton_1181v_35:focus-visible{z-index:1}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15 ._copyButton_1181v_35._copyButton_1181v_35[data-modern=true]{border-end-end-radius:var(--bp-radius-06);border-start-end-radius:var(--bp-radius-06)}._formWrapper_1181v_2 ._copyInputWrapper_1181v_15:not(._copied_1181v_20) ._copyButton_1181v_35._copyButton_1181v_35[data-modern=true]{border-color:var(--bp-gray-20)}._formWrapper_1181v_2 ._subtext_1181v_64,._formWrapper_1181v_2 ._inlineError_1181v_65{margin-block-start:var(--space-2)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/copy-input",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^9.19.0",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"react-intl": "^6.4.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@box/blueprint-web": "^12.99.
|
|
13
|
+
"@box/blueprint-web": "^12.99.1",
|
|
14
14
|
"@box/blueprint-web-assets": "^4.82.0",
|
|
15
15
|
"@box/storybook-utils": "0.14.19",
|
|
16
16
|
"@box/eslint-plugin-blueprint": "1.0.5",
|