@wistia/ui 0.8.9-beta.c65c9abf.a0225aa → 0.8.9
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 +33 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +25 -26
- package/dist/index.d.ts +25 -26
- package/dist/index.mjs +33 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.8.9
|
|
3
|
+
* @license @wistia/ui v0.8.9
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -6985,29 +6985,31 @@ Icon.displayName = "Icon";
|
|
|
6985
6985
|
|
|
6986
6986
|
// src/components/Link/Link.tsx
|
|
6987
6987
|
var import_react15 = require("react");
|
|
6988
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
6988
6989
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
6989
6990
|
var import_react_router_dom = require("react-router-dom");
|
|
6990
|
-
var import_type_guards14 = require("@wistia/type-guards");
|
|
6991
6991
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
6992
6992
|
var generateHref = (href, type, disabled) => {
|
|
6993
6993
|
if (disabled || (0, import_type_guards14.isNil)(href)) {
|
|
6994
6994
|
return void 0;
|
|
6995
6995
|
}
|
|
6996
|
-
let
|
|
6996
|
+
let to = href;
|
|
6997
6997
|
if (type === "phone") {
|
|
6998
|
-
|
|
6998
|
+
to = `tel:${href}`;
|
|
6999
6999
|
}
|
|
7000
7000
|
if (type === "email") {
|
|
7001
|
-
|
|
7001
|
+
to = `mailto:${href}`;
|
|
7002
7002
|
}
|
|
7003
|
-
return
|
|
7003
|
+
return to;
|
|
7004
7004
|
};
|
|
7005
7005
|
var isButton = (props) => (0, import_type_guards14.isUndefined)(props.href);
|
|
7006
7006
|
var isLink = (props) => (0, import_type_guards14.isNotUndefined)(props.href);
|
|
7007
7007
|
var StyledLink = import_styled_components20.default.a`
|
|
7008
|
+
--link-icon-size: 14px;
|
|
7009
|
+
|
|
7008
7010
|
${({ href }) => (0, import_type_guards14.isNil)(href) && buttonResetCss};
|
|
7009
7011
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
7010
|
-
cursor:
|
|
7012
|
+
cursor: pointer;
|
|
7011
7013
|
font-family: var(--wui-typography-family-default);
|
|
7012
7014
|
color: var(--wui-color-text-link);
|
|
7013
7015
|
text-decoration: ${({ $underline }) => $underline ? "underline" : "none"};
|
|
@@ -7017,8 +7019,8 @@ var StyledLink = import_styled_components20.default.a`
|
|
|
7017
7019
|
|
|
7018
7020
|
&& {
|
|
7019
7021
|
svg {
|
|
7020
|
-
width:
|
|
7021
|
-
height:
|
|
7022
|
+
width: var(--link-icon-size);
|
|
7023
|
+
height: var(--link-icon-size);
|
|
7022
7024
|
}
|
|
7023
7025
|
}
|
|
7024
7026
|
`;
|
|
@@ -7063,7 +7065,6 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7063
7065
|
};
|
|
7064
7066
|
const commonProps = {
|
|
7065
7067
|
$colorScheme: colorScheme,
|
|
7066
|
-
$disabled: disabled,
|
|
7067
7068
|
$underline: underline,
|
|
7068
7069
|
onClick: handleClick
|
|
7069
7070
|
};
|
|
@@ -7082,27 +7083,33 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7082
7083
|
}
|
|
7083
7084
|
if (isLink(props)) {
|
|
7084
7085
|
const externalLinkProps = type === "external" ? { target: "_blank", rel: "noopener noreferrer" } : null;
|
|
7085
|
-
const routerSpecificProps = shouldUseReactRouterLink ? {
|
|
7086
|
-
// TODO: Using 'any' here due to styled-components typing limitations with RouterLink
|
|
7087
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
|
|
7088
|
-
as: import_react_router_dom.Link,
|
|
7089
|
-
to: to ?? ""
|
|
7090
|
-
} : {
|
|
7091
|
-
as: "a",
|
|
7092
|
-
href: to
|
|
7093
|
-
};
|
|
7094
7086
|
const combinedProps = {
|
|
7095
7087
|
ref,
|
|
7096
7088
|
...props,
|
|
7097
7089
|
...commonProps,
|
|
7098
|
-
...externalLinkProps
|
|
7099
|
-
...routerSpecificProps
|
|
7090
|
+
...externalLinkProps
|
|
7100
7091
|
};
|
|
7101
|
-
return /* @__PURE__ */ (0, import_jsx_runtime192.
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7092
|
+
return shouldUseReactRouterLink ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
|
|
7093
|
+
StyledLink,
|
|
7094
|
+
{
|
|
7095
|
+
as: import_react_router_dom.Link,
|
|
7096
|
+
...combinedProps,
|
|
7097
|
+
to: to ?? "",
|
|
7098
|
+
children
|
|
7099
|
+
}
|
|
7100
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
|
|
7101
|
+
StyledLink,
|
|
7102
|
+
{
|
|
7103
|
+
as: "a",
|
|
7104
|
+
...combinedProps,
|
|
7105
|
+
href: to,
|
|
7106
|
+
children: [
|
|
7107
|
+
leftIcon ?? null,
|
|
7108
|
+
children,
|
|
7109
|
+
rightIcon ?? null
|
|
7110
|
+
]
|
|
7111
|
+
}
|
|
7112
|
+
);
|
|
7106
7113
|
}
|
|
7107
7114
|
return null;
|
|
7108
7115
|
}
|