@box/copy-input 1.5.0 → 1.5.2
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 +33 -33
- package/dist/styles/copy-input.css +1 -1
- package/package.json +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useUniqueId as _, BaseTextInput as k, Button as F, InlineError as O, Text as q } from "@box/blueprint-web";
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as w, useCallback as
|
|
2
|
+
import c from "clsx";
|
|
3
|
+
import { forwardRef as w, useCallback as f } from "react";
|
|
4
4
|
import { useIntl as z } from "react-intl";
|
|
5
|
-
import { messages as
|
|
5
|
+
import { messages as h } from "./messages.js";
|
|
6
6
|
import { useClipboardCopy as H } from "./utils.js";
|
|
7
7
|
import { jsxs as I, jsx as s } from "react/jsx-runtime";
|
|
8
|
-
import '../../styles/copy-input.css';const U = "
|
|
8
|
+
import '../../styles/copy-input.css';const U = "_formWrapper_1obil_2", A = "_hasError_1obil_7", G = "_copyInputWrapper_1obil_15", J = "_copied_1obil_20", K = "_copyButton_1obil_35", P = "_copyInput_1obil_15", Q = "_noButton_1obil_44", V = "_subtext_1obil_57", X = "_inlineError_1obil_58", o = {
|
|
9
9
|
formWrapper: U,
|
|
10
10
|
hasError: A,
|
|
11
11
|
copyInputWrapper: G,
|
|
@@ -28,39 +28,39 @@ import '../../styles/copy-input.css';const U = "_formWrapper_yd7hc_1", A = "_has
|
|
|
28
28
|
onCopy: L,
|
|
29
29
|
hideLabel: W,
|
|
30
30
|
...l
|
|
31
|
-
} = x,
|
|
32
|
-
copied:
|
|
33
|
-
handleCopy:
|
|
31
|
+
} = x, u = z(), N = u.formatMessage(h.copyButtonLabel), S = u.formatMessage(h.copyButtonCopiedLabel), d = _("inline-error-"), b = _("subtext-"), {
|
|
32
|
+
copied: y,
|
|
33
|
+
handleCopy: m,
|
|
34
34
|
inputRef: T
|
|
35
|
-
} = H(n, L, C), D =
|
|
36
|
-
|
|
37
|
-
}, []), M =
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
const j =
|
|
43
|
-
[
|
|
35
|
+
} = H(n, L, C), D = f((t) => {
|
|
36
|
+
t.target.select();
|
|
37
|
+
}, []), M = f((t) => {
|
|
38
|
+
t.target instanceof HTMLInputElement && t.target.setSelectionRange(0, t.target.value.length);
|
|
39
|
+
}, []), e = !!r && !n, a = !r && !!p, R = e || a;
|
|
40
|
+
let i = "";
|
|
41
|
+
e ? i = d : a && (i = b);
|
|
42
|
+
const j = c(l["aria-describedby"], {
|
|
43
|
+
[i]: R
|
|
44
44
|
});
|
|
45
45
|
return /* @__PURE__ */ I("div", {
|
|
46
|
-
className:
|
|
47
|
-
[
|
|
46
|
+
className: c(o.formWrapper, {
|
|
47
|
+
[o.hasError]: r
|
|
48
48
|
}),
|
|
49
49
|
children: [/* @__PURE__ */ I("div", {
|
|
50
|
-
className:
|
|
51
|
-
[
|
|
50
|
+
className: c(o.copyInputWrapper, {
|
|
51
|
+
[o.copied]: y
|
|
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": e,
|
|
58
|
+
className: o.copyInput,
|
|
59
59
|
disabled: n,
|
|
60
60
|
hideLabel: W,
|
|
61
|
-
invalid:
|
|
61
|
+
invalid: e,
|
|
62
62
|
label: v,
|
|
63
|
-
onCopy:
|
|
63
|
+
onCopy: m,
|
|
64
64
|
onFocus: D,
|
|
65
65
|
onSelect: M,
|
|
66
66
|
readOnly: !0,
|
|
@@ -68,22 +68,22 @@ import '../../styles/copy-input.css';const U = "_formWrapper_yd7hc_1", A = "_has
|
|
|
68
68
|
}), /* @__PURE__ */ s(F, {
|
|
69
69
|
ref: B,
|
|
70
70
|
"aria-live": g,
|
|
71
|
-
className:
|
|
71
|
+
className: o.copyButton,
|
|
72
72
|
disabled: n,
|
|
73
|
-
onClick:
|
|
73
|
+
onClick: m,
|
|
74
74
|
size: "large",
|
|
75
75
|
variant: "secondary",
|
|
76
|
-
children:
|
|
76
|
+
children: y ? S : N
|
|
77
77
|
})]
|
|
78
|
-
}),
|
|
79
|
-
className:
|
|
80
|
-
id:
|
|
78
|
+
}), e ? /* @__PURE__ */ s(O, {
|
|
79
|
+
className: o.inlineError,
|
|
80
|
+
id: d,
|
|
81
81
|
children: r
|
|
82
|
-
}) :
|
|
82
|
+
}) : a && /* @__PURE__ */ s(q, {
|
|
83
83
|
as: "p",
|
|
84
|
-
className:
|
|
84
|
+
className: o.subtext,
|
|
85
85
|
color: "textOnLightSecondary",
|
|
86
|
-
id:
|
|
86
|
+
id: b,
|
|
87
87
|
variant: "caption",
|
|
88
88
|
children: p
|
|
89
89
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._formWrapper_1obil_2{--border-collapsible-border: var(--border-cta-border-secondary);display:flex;flex-direction:column}._formWrapper_1obil_2._hasError_1obil_7 input:not(:focus-visible){border-color:var(--border-input-border-error)!important;border-width:2px!important}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15{--text-input-disabled-opacity-api: .3;display:flex}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15._copied_1obil_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_1obil_2 ._copyInputWrapper_1obil_15._copied_1obil_20 input{border-color:var(--green-light-120)!important;border-width:1px!important}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15._copied_1obil_20 input:focus{border-color:var(--outline-focus-on-light)!important;border-width:2px!important}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15._copied_1obil_20 ._copyButton_1obil_35._copyButton_1obil_35{background-color:var(--green-light-50);border-color:var(--green-light-120)}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15 ._copyInput_1obil_15._copyInput_1obil_15{position:relative;left:1px;flex-grow:1}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15 ._copyInput_1obil_15._copyInput_1obil_15:not(._noButton_1obil_44) input{border-top-right-radius:0;border-bottom-right-radius:0}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15 ._copyButton_1obil_35._copyButton_1obil_35{flex-grow:0;align-self:flex-end;border-start-start-radius:0;border-end-start-radius:0}._formWrapper_1obil_2 ._copyInputWrapper_1obil_15 ._copyButton_1obil_35._copyButton_1obil_35:focus-visible{z-index:1}._formWrapper_1obil_2 ._subtext_1obil_57,._formWrapper_1obil_2 ._inlineError_1obil_58{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.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^9.19.0",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"react-intl": "^6.4.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@box/blueprint-web": "^12.92.
|
|
14
|
-
"@box/blueprint-web-assets": "^4.76.
|
|
15
|
-
"@box/storybook-utils": "0.14.
|
|
13
|
+
"@box/blueprint-web": "^12.92.2",
|
|
14
|
+
"@box/blueprint-web-assets": "^4.76.2",
|
|
15
|
+
"@box/storybook-utils": "0.14.13",
|
|
16
16
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
17
17
|
"react-intl": "^6.4.2"
|
|
18
18
|
},
|