@wistia/ui 0.7.0 → 0.7.1-beta.09277a60.15097e4
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/index.cjs +70 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.mjs +69 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.7.
|
|
3
|
+
* @license @wistia/ui v0.7.1-beta.09277a60.15097e4
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -76,6 +76,7 @@ __export(index_exports, {
|
|
|
76
76
|
Image: () => Image,
|
|
77
77
|
ImageDimensionsValidator: () => import_validators.ImageDimensionsValidator,
|
|
78
78
|
Input: () => Input,
|
|
79
|
+
InputClickToCopy: () => InputClickToCopy,
|
|
79
80
|
Label: () => Label,
|
|
80
81
|
Link: () => Link,
|
|
81
82
|
Menu: () => Menu,
|
|
@@ -7032,7 +7033,7 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7032
7033
|
}, ref) => {
|
|
7033
7034
|
const inRouterContext = (0, import_react_router_dom.useInRouterContext)();
|
|
7034
7035
|
const to = generateHref(props.href, type, disabled);
|
|
7035
|
-
const handleClick = async (event
|
|
7036
|
+
const handleClick = async (event) => {
|
|
7036
7037
|
if (disabled) {
|
|
7037
7038
|
event.preventDefault();
|
|
7038
7039
|
} else if (beforeAction) {
|
|
@@ -7044,11 +7045,9 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7044
7045
|
} finally {
|
|
7045
7046
|
if ((0, import_type_guards14.isFunction)(props.onClick)) {
|
|
7046
7047
|
props.onClick(event);
|
|
7047
|
-
}
|
|
7048
|
-
|
|
7049
|
-
} else if ((0, import_type_guards14.isNotNil)(to)) {
|
|
7048
|
+
}
|
|
7049
|
+
if (!inRouterContext && (0, import_type_guards14.isNotNil)(to)) {
|
|
7050
7050
|
window.location.assign(to);
|
|
7051
|
-
} else {
|
|
7052
7051
|
}
|
|
7053
7052
|
}
|
|
7054
7053
|
} else if ((0, import_type_guards14.isFunction)(props.onClick)) {
|
|
@@ -12713,6 +12712,70 @@ var Thumbnail = (0, import_react66.forwardRef)(
|
|
|
12713
12712
|
}
|
|
12714
12713
|
);
|
|
12715
12714
|
Thumbnail.displayName = "Thumbnail";
|
|
12715
|
+
|
|
12716
|
+
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
12717
|
+
var import_styled_components90 = __toESM(require("styled-components"));
|
|
12718
|
+
var import_react67 = require("react");
|
|
12719
|
+
var import_type_guards54 = require("@wistia/type-guards");
|
|
12720
|
+
var import_jsx_runtime271 = require("react/jsx-runtime");
|
|
12721
|
+
var StyledInput2 = (0, import_styled_components90.default)(Input)`
|
|
12722
|
+
&:not([aria-disabled='true']) {
|
|
12723
|
+
cursor: pointer;
|
|
12724
|
+
}
|
|
12725
|
+
|
|
12726
|
+
&::selection {
|
|
12727
|
+
background-color: transparent;
|
|
12728
|
+
}
|
|
12729
|
+
`;
|
|
12730
|
+
var COPY_SUCCESS_DURATION = 2e3;
|
|
12731
|
+
var InputClickToCopy = (0, import_react67.forwardRef)(
|
|
12732
|
+
({ value, onCopy, ...props }, ref) => {
|
|
12733
|
+
const [isCopied, setIsCopied] = (0, import_react67.useState)(false);
|
|
12734
|
+
(0, import_react67.useEffect)(() => {
|
|
12735
|
+
if (isCopied) {
|
|
12736
|
+
const timeout = setTimeout(() => {
|
|
12737
|
+
setIsCopied(false);
|
|
12738
|
+
}, COPY_SUCCESS_DURATION);
|
|
12739
|
+
return () => {
|
|
12740
|
+
clearTimeout(timeout);
|
|
12741
|
+
};
|
|
12742
|
+
}
|
|
12743
|
+
return () => null;
|
|
12744
|
+
}, [isCopied]);
|
|
12745
|
+
const handleClick = (event) => {
|
|
12746
|
+
event.preventDefault();
|
|
12747
|
+
if ((0, import_type_guards54.isFunction)(props.onClick)) {
|
|
12748
|
+
props.onClick(event);
|
|
12749
|
+
}
|
|
12750
|
+
void copyToClipboard(value).then(() => {
|
|
12751
|
+
setIsCopied(true);
|
|
12752
|
+
if ((0, import_type_guards54.isFunction)(onCopy)) {
|
|
12753
|
+
onCopy(value);
|
|
12754
|
+
}
|
|
12755
|
+
return value;
|
|
12756
|
+
});
|
|
12757
|
+
};
|
|
12758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
12759
|
+
StyledInput2,
|
|
12760
|
+
{
|
|
12761
|
+
"aria-label": "Click to Copy",
|
|
12762
|
+
...props,
|
|
12763
|
+
ref,
|
|
12764
|
+
onClick: handleClick,
|
|
12765
|
+
readOnly: true,
|
|
12766
|
+
rightIcon: isCopied ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
12767
|
+
Icon,
|
|
12768
|
+
{
|
|
12769
|
+
colorScheme: "success",
|
|
12770
|
+
type: "checkmark-circle"
|
|
12771
|
+
}
|
|
12772
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Icon, { type: "save-as-copy" }),
|
|
12773
|
+
value
|
|
12774
|
+
}
|
|
12775
|
+
);
|
|
12776
|
+
}
|
|
12777
|
+
);
|
|
12778
|
+
InputClickToCopy.displayName = "InputClickToCopy";
|
|
12716
12779
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12717
12780
|
0 && (module.exports = {
|
|
12718
12781
|
ActionButton,
|
|
@@ -12752,6 +12815,7 @@ Thumbnail.displayName = "Thumbnail";
|
|
|
12752
12815
|
Image,
|
|
12753
12816
|
ImageDimensionsValidator,
|
|
12754
12817
|
Input,
|
|
12818
|
+
InputClickToCopy,
|
|
12755
12819
|
Label,
|
|
12756
12820
|
Link,
|
|
12757
12821
|
Menu,
|