@wistia/ui 0.7.1 → 0.8.1-beta.3c5d1921.3fffdf1
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 +77 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +34 -6
- package/dist/index.d.ts +34 -6
- package/dist/index.mjs +129 -80
- 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.
|
|
3
|
+
* @license @wistia/ui v0.8.1-beta.3c5d1921.3fffdf1
|
|
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,11 +7033,14 @@ 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);
|
|
7036
|
+
const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
|
|
7035
7037
|
const handleClick = async (event) => {
|
|
7036
7038
|
if (disabled) {
|
|
7037
7039
|
event.preventDefault();
|
|
7038
7040
|
} else if (beforeAction) {
|
|
7039
|
-
|
|
7041
|
+
if (!shouldUseReactRouterLink) {
|
|
7042
|
+
event.preventDefault();
|
|
7043
|
+
}
|
|
7040
7044
|
try {
|
|
7041
7045
|
await beforeAction();
|
|
7042
7046
|
} catch (error) {
|
|
@@ -7080,7 +7084,6 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7080
7084
|
...commonProps,
|
|
7081
7085
|
...externalLinkProps
|
|
7082
7086
|
};
|
|
7083
|
-
const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
|
|
7084
7087
|
return shouldUseReactRouterLink ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
|
|
7085
7088
|
StyledLink,
|
|
7086
7089
|
{
|
|
@@ -9039,26 +9042,17 @@ var import_react29 = require("react");
|
|
|
9039
9042
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
9040
9043
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
9041
9044
|
var import_jsx_runtime218 = require("react/jsx-runtime");
|
|
9042
|
-
var CompactTooltipStyles = import_styled_components44.css`
|
|
9043
|
-
--tooltip-font-size: var(--wui-typography-label-4-size);
|
|
9044
|
-
--tooltip-line-height: var(--wui-typography-label-4-line-height);
|
|
9045
|
-
--tooltip-font-weight: var(--wui-typography-label-4-weight);
|
|
9046
|
-
--tooltip-horizontal-padding: var(--wui-space-02);
|
|
9047
|
-
--tooltip-vertical-padding: var(--wui-space-03);
|
|
9048
|
-
`;
|
|
9049
9045
|
var StyledContent = (0, import_styled_components44.default)(import_react_tooltip2.Content)`
|
|
9050
9046
|
--tooltip-font-family: var(--wui-typography-family-default);
|
|
9051
9047
|
--tooltip-border-radius: var(--wui-border-radius-05);
|
|
9052
9048
|
--tooltip-bg: var(--wui-color-bg-tooltip);
|
|
9053
9049
|
--tooltip-color: var(--wui-color-text-on-fill);
|
|
9054
|
-
--tooltip-font-size: var(--wui-typography-label-
|
|
9055
|
-
--tooltip-line-height: var(--wui-typography-label-
|
|
9056
|
-
--tooltip-font-weight: var(--wui-typography-label-
|
|
9057
|
-
--tooltip-horizontal-padding: var(--wui-space-
|
|
9050
|
+
--tooltip-font-size: var(--wui-typography-label-4-size);
|
|
9051
|
+
--tooltip-line-height: var(--wui-typography-label-4-line-height);
|
|
9052
|
+
--tooltip-font-weight: var(--wui-typography-label-4-weight);
|
|
9053
|
+
--tooltip-horizontal-padding: var(--wui-space-02);
|
|
9058
9054
|
--tooltip-vertical-padding: var(--wui-space-03);
|
|
9059
9055
|
|
|
9060
|
-
${({ $compact }) => Boolean($compact) && CompactTooltipStyles};
|
|
9061
|
-
|
|
9062
9056
|
font-family: var(--tooltip-font-family);
|
|
9063
9057
|
font-size: var(--tooltip-font-size);
|
|
9064
9058
|
border-radius: var(--tooltip-border-radius);
|
|
@@ -9090,12 +9084,11 @@ var StyledContent = (0, import_styled_components44.default)(import_react_tooltip
|
|
|
9090
9084
|
`;
|
|
9091
9085
|
var VISUAL_OFFSET = 6;
|
|
9092
9086
|
var Tooltip = ({
|
|
9093
|
-
delay =
|
|
9087
|
+
delay = 500,
|
|
9094
9088
|
direction = "top",
|
|
9095
9089
|
content,
|
|
9096
9090
|
children,
|
|
9097
9091
|
forceOpen,
|
|
9098
|
-
compact = false,
|
|
9099
9092
|
hideArrow = false
|
|
9100
9093
|
}) => {
|
|
9101
9094
|
const rootProps = {};
|
|
@@ -9115,7 +9108,6 @@ var Tooltip = ({
|
|
|
9115
9108
|
/* @__PURE__ */ (0, import_jsx_runtime218.jsx)(import_react_tooltip2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)(
|
|
9116
9109
|
StyledContent,
|
|
9117
9110
|
{
|
|
9118
|
-
$compact: compact,
|
|
9119
9111
|
side: direction,
|
|
9120
9112
|
sideOffset: hideArrow ? VISUAL_OFFSET : VISUAL_OFFSET - 2,
|
|
9121
9113
|
children: [
|
|
@@ -9461,14 +9453,7 @@ var EditableHeading = ({
|
|
|
9461
9453
|
);
|
|
9462
9454
|
}
|
|
9463
9455
|
return /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)(import_jsx_runtime220.Fragment, { children: [
|
|
9464
|
-
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
9465
|
-
Tooltip,
|
|
9466
|
-
{
|
|
9467
|
-
compact: true,
|
|
9468
|
-
content: tooltipText,
|
|
9469
|
-
children: HeadingComponent2
|
|
9470
|
-
}
|
|
9471
|
-
),
|
|
9456
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(Tooltip, { content: tooltipText, children: HeadingComponent2 }),
|
|
9472
9457
|
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(ScreenReaderOnly, { children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
9473
9458
|
"button",
|
|
9474
9459
|
{
|
|
@@ -12711,6 +12696,70 @@ var Thumbnail = (0, import_react66.forwardRef)(
|
|
|
12711
12696
|
}
|
|
12712
12697
|
);
|
|
12713
12698
|
Thumbnail.displayName = "Thumbnail";
|
|
12699
|
+
|
|
12700
|
+
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
12701
|
+
var import_styled_components90 = __toESM(require("styled-components"));
|
|
12702
|
+
var import_react67 = require("react");
|
|
12703
|
+
var import_type_guards54 = require("@wistia/type-guards");
|
|
12704
|
+
var import_jsx_runtime271 = require("react/jsx-runtime");
|
|
12705
|
+
var StyledInput2 = (0, import_styled_components90.default)(Input)`
|
|
12706
|
+
&:not([aria-disabled='true']) {
|
|
12707
|
+
cursor: pointer;
|
|
12708
|
+
}
|
|
12709
|
+
|
|
12710
|
+
&::selection {
|
|
12711
|
+
background-color: transparent;
|
|
12712
|
+
}
|
|
12713
|
+
`;
|
|
12714
|
+
var COPY_SUCCESS_DURATION = 2e3;
|
|
12715
|
+
var InputClickToCopy = (0, import_react67.forwardRef)(
|
|
12716
|
+
({ value, onCopy, ...props }, ref) => {
|
|
12717
|
+
const [isCopied, setIsCopied] = (0, import_react67.useState)(false);
|
|
12718
|
+
(0, import_react67.useEffect)(() => {
|
|
12719
|
+
if (isCopied) {
|
|
12720
|
+
const timeout = setTimeout(() => {
|
|
12721
|
+
setIsCopied(false);
|
|
12722
|
+
}, COPY_SUCCESS_DURATION);
|
|
12723
|
+
return () => {
|
|
12724
|
+
clearTimeout(timeout);
|
|
12725
|
+
};
|
|
12726
|
+
}
|
|
12727
|
+
return () => null;
|
|
12728
|
+
}, [isCopied]);
|
|
12729
|
+
const handleClick = (event) => {
|
|
12730
|
+
event.preventDefault();
|
|
12731
|
+
if ((0, import_type_guards54.isFunction)(props.onClick)) {
|
|
12732
|
+
props.onClick(event);
|
|
12733
|
+
}
|
|
12734
|
+
void copyToClipboard(value).then(() => {
|
|
12735
|
+
setIsCopied(true);
|
|
12736
|
+
if ((0, import_type_guards54.isFunction)(onCopy)) {
|
|
12737
|
+
onCopy(value);
|
|
12738
|
+
}
|
|
12739
|
+
return value;
|
|
12740
|
+
});
|
|
12741
|
+
};
|
|
12742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
12743
|
+
StyledInput2,
|
|
12744
|
+
{
|
|
12745
|
+
"aria-label": "Click to Copy",
|
|
12746
|
+
...props,
|
|
12747
|
+
ref,
|
|
12748
|
+
onClick: handleClick,
|
|
12749
|
+
readOnly: true,
|
|
12750
|
+
rightIcon: isCopied ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
12751
|
+
Icon,
|
|
12752
|
+
{
|
|
12753
|
+
colorScheme: "success",
|
|
12754
|
+
type: "checkmark-circle"
|
|
12755
|
+
}
|
|
12756
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Icon, { type: "save-as-copy" }),
|
|
12757
|
+
value
|
|
12758
|
+
}
|
|
12759
|
+
);
|
|
12760
|
+
}
|
|
12761
|
+
);
|
|
12762
|
+
InputClickToCopy.displayName = "InputClickToCopy";
|
|
12714
12763
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12715
12764
|
0 && (module.exports = {
|
|
12716
12765
|
ActionButton,
|
|
@@ -12750,6 +12799,7 @@ Thumbnail.displayName = "Thumbnail";
|
|
|
12750
12799
|
Image,
|
|
12751
12800
|
ImageDimensionsValidator,
|
|
12752
12801
|
Input,
|
|
12802
|
+
InputClickToCopy,
|
|
12753
12803
|
Label,
|
|
12754
12804
|
Link,
|
|
12755
12805
|
Menu,
|