@wistia/ui 0.0.2 → 0.0.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.0.2
3
+ * @license @wistia/ui v0.0.4
4
4
  *
5
5
  * Copyright (c) 2024-2024, Wistia, Inc. and its affiliates.
6
6
  *
@@ -58,6 +58,7 @@ __export(src_exports, {
58
58
  ellipsisFlexParentStyle: () => ellipsisFlexParentStyle,
59
59
  ellipsisStyle: () => ellipsisStyle,
60
60
  iconSizeMap: () => iconSizeMap,
61
+ mq: () => mq,
61
62
  useActiveMq: () => useActiveMq,
62
63
  useAriaLive: () => useAriaLive,
63
64
  useMq: () => useMq,
@@ -1300,6 +1301,52 @@ var copyToClipboard = async (textToCopy) => {
1300
1301
  });
1301
1302
  };
1302
1303
 
1304
+ // src/helpers/mq/mq.ts
1305
+ var import_polished = require("polished");
1306
+
1307
+ // src/css/breakpoints.ts
1308
+ var breakpoints = {
1309
+ xs: "0em",
1310
+ // 0px
1311
+ sm: "37.5em",
1312
+ // 600px
1313
+ md: "56.5625em",
1314
+ // ~904px
1315
+ lg: "77.5em",
1316
+ // 1240px
1317
+ xl: "90em"
1318
+ // 1440px
1319
+ };
1320
+
1321
+ // src/helpers/mq/mq.ts
1322
+ var getMaxWidth = (breakpoint) => {
1323
+ const breakpointBuffer = 25e-4;
1324
+ const [value, unit] = (0, import_polished.getValueAndUnit)(breakpoint);
1325
+ return `@media (max-width: ${Math.max(value - breakpointBuffer, 0)}${unit})`;
1326
+ };
1327
+ var xsAndUp = () => `@media (min-width: ${breakpoints.xs})`;
1328
+ var smAndUp = () => `@media (min-width: ${breakpoints.sm})`;
1329
+ var mdAndUp = () => `@media (min-width: ${breakpoints.md})`;
1330
+ var lgAndUp = () => `@media (min-width: ${breakpoints.lg})`;
1331
+ var xlAndUp = () => `@media (min-width: ${breakpoints.xl})`;
1332
+ var xsAndDown = () => getMaxWidth(breakpoints.xs);
1333
+ var smAndDown = () => getMaxWidth(breakpoints.sm);
1334
+ var mdAndDown = () => getMaxWidth(breakpoints.md);
1335
+ var lgAndDown = () => getMaxWidth(breakpoints.lg);
1336
+ var xlAndDown = () => getMaxWidth(breakpoints.xl);
1337
+ var mq = {
1338
+ xsAndUp,
1339
+ smAndUp,
1340
+ mdAndUp,
1341
+ lgAndUp,
1342
+ xlAndUp,
1343
+ xsAndDown,
1344
+ smAndDown,
1345
+ mdAndDown,
1346
+ lgAndDown,
1347
+ xlAndDown
1348
+ };
1349
+
1303
1350
  // src/hooks/useMq/useMq.ts
1304
1351
  var import_type_guards3 = require("@wistia/type-guards");
1305
1352
 
@@ -1330,20 +1377,6 @@ var useWindowSize = (interval = 0) => {
1330
1377
  return dimensions;
1331
1378
  };
1332
1379
 
1333
- // src/css/breakpoints.ts
1334
- var breakpoints = {
1335
- xs: "0em",
1336
- // 0px
1337
- sm: "37.5em",
1338
- // 600px
1339
- md: "56.5625em",
1340
- // ~904px
1341
- lg: "77.5em",
1342
- // 1240px
1343
- xl: "90em"
1344
- // 1440px
1345
- };
1346
-
1347
1380
  // src/hooks/useMq/useMq.ts
1348
1381
  var REM_SIZE = 16;
1349
1382
  var useMq = () => {
@@ -1718,7 +1751,7 @@ var buttonSizeStyles = {
1718
1751
  hero: buttonHeroStyles
1719
1752
  };
1720
1753
 
1721
- // src/helpers/getColorScheme/getColorScheme.ts
1754
+ // src/private/getColorScheme/getColorScheme.ts
1722
1755
  var import_styled_components13 = require("styled-components");
1723
1756
  var colorSchemeSchema = [
1724
1757
  { token: "bg-surface", step: "surface" },
@@ -4998,7 +5031,7 @@ var isButton = (props) => (0, import_type_guards8.isUndefined)(props.href);
4998
5031
  var isLink = (props) => (0, import_type_guards8.isNotUndefined)(props.href);
4999
5032
  var StyledLink = import_styled_components14.default.a`
5000
5033
  ${({ href }) => (0, import_type_guards8.isNil)(href) && buttonResetCss};
5001
- ${({ colorScheme }) => getColorScheme(colorScheme)}
5034
+ ${({ $colorScheme }) => getColorScheme($colorScheme)}
5002
5035
  cursor: pointer;
5003
5036
  font-family: var(--typography-family-default);
5004
5037
  color: var(--color-text-link);
@@ -5037,7 +5070,7 @@ var Link = (0, import_react7.forwardRef)(
5037
5070
  }
5038
5071
  };
5039
5072
  const commonProps = {
5040
- colorScheme,
5073
+ $colorScheme: colorScheme,
5041
5074
  $underline: underline,
5042
5075
  onClick: handleClick
5043
5076
  };
@@ -5056,14 +5089,25 @@ var Link = (0, import_react7.forwardRef)(
5056
5089
  }
5057
5090
  if (isLink(props)) {
5058
5091
  const externalLinkProps = type === "external" ? { target: "_blank", rel: "noopener noreferrer" } : null;
5059
- return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
5092
+ const combinedProps = {
5093
+ ref,
5094
+ ...props,
5095
+ ...commonProps,
5096
+ ...externalLinkProps
5097
+ };
5098
+ return inRouterContext && type !== "external" ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
5060
5099
  StyledLink,
5061
5100
  {
5062
- ref,
5063
- as: inRouterContext ? import_react_router_dom.Link : "a",
5064
- ...props,
5065
- ...commonProps,
5066
- ...externalLinkProps,
5101
+ as: import_react_router_dom.Link,
5102
+ ...combinedProps,
5103
+ to: to ?? "",
5104
+ children
5105
+ }
5106
+ ) : /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
5107
+ StyledLink,
5108
+ {
5109
+ as: "a",
5110
+ ...combinedProps,
5067
5111
  href: to,
5068
5112
  children
5069
5113
  }
@@ -5207,38 +5251,6 @@ Button.displayName = "Button";
5207
5251
  // src/components/ButtonGroup/ButtonGroup.tsx
5208
5252
  var import_styled_components16 = __toESM(require("styled-components"), 1);
5209
5253
  var import_type_guards10 = require("@wistia/type-guards");
5210
-
5211
- // src/helpers/mq/mq.ts
5212
- var import_polished = require("polished");
5213
- var getMaxWidth = (breakpoint) => {
5214
- const breakpointBuffer = 25e-4;
5215
- const [value, unit] = (0, import_polished.getValueAndUnit)(breakpoint);
5216
- return `@media (max-width: ${Math.max(value - breakpointBuffer, 0)}${unit})`;
5217
- };
5218
- var xsAndUp = () => `@media (min-width: ${breakpoints.xs})`;
5219
- var smAndUp = () => `@media (min-width: ${breakpoints.sm})`;
5220
- var mdAndUp = () => `@media (min-width: ${breakpoints.md})`;
5221
- var lgAndUp = () => `@media (min-width: ${breakpoints.lg})`;
5222
- var xlAndUp = () => `@media (min-width: ${breakpoints.xl})`;
5223
- var xsAndDown = () => getMaxWidth(breakpoints.xs);
5224
- var smAndDown = () => getMaxWidth(breakpoints.sm);
5225
- var mdAndDown = () => getMaxWidth(breakpoints.md);
5226
- var lgAndDown = () => getMaxWidth(breakpoints.lg);
5227
- var xlAndDown = () => getMaxWidth(breakpoints.xl);
5228
- var mq = {
5229
- xsAndUp,
5230
- smAndUp,
5231
- mdAndUp,
5232
- lgAndUp,
5233
- xlAndUp,
5234
- xsAndDown,
5235
- smAndDown,
5236
- mdAndDown,
5237
- lgAndDown,
5238
- xlAndDown
5239
- };
5240
-
5241
- // src/components/ButtonGroup/ButtonGroup.tsx
5242
5254
  var import_jsx_runtime159 = require("react/jsx-runtime");
5243
5255
  var getAlignment = (align) => {
5244
5256
  if (align === "center") {
@@ -5998,6 +6010,7 @@ WistiaLogo.displayName = "WistiaLogo";
5998
6010
  ellipsisFlexParentStyle,
5999
6011
  ellipsisStyle,
6000
6012
  iconSizeMap,
6013
+ mq,
6001
6014
  useActiveMq,
6002
6015
  useAriaLive,
6003
6016
  useMq,