@wistia/ui 0.13.10 → 0.13.11-beta.e83846c4.6d00a8f

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.13.10
3
+ * @license @wistia/ui v0.13.11-beta.e83846c4.6d00a8f
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2853,7 +2853,7 @@ var useToast = () => {
2853
2853
 
2854
2854
  // src/components/ActionButton/ActionButton.tsx
2855
2855
  import { forwardRef as forwardRef3 } from "react";
2856
- import styled6, { css as css17 } from "styled-components";
2856
+ import styled6, { css as css18 } from "styled-components";
2857
2857
 
2858
2858
  // src/components/Button/Button.tsx
2859
2859
  import { forwardRef as forwardRef2 } from "react";
@@ -3062,7 +3062,7 @@ var buttonSizeStyles = {
3062
3062
 
3063
3063
  // src/components/Icon/Icon.tsx
3064
3064
  import { isNil as isNil5 } from "@wistia/type-guards";
3065
- import styled3 from "styled-components";
3065
+ import styled3, { css as css17 } from "styled-components";
3066
3066
 
3067
3067
  // src/components/Icon/icons/AbTestIcon.tsx
3068
3068
  import { jsx as jsx7 } from "react/jsx-runtime";
@@ -7023,10 +7023,26 @@ var iconSizeMap = {
7023
7023
  xl: "32",
7024
7024
  xxl: "48"
7025
7025
  };
7026
+ var iconInlineStyle = css17`
7027
+ [data-wui-icon-inline] {
7028
+ --wui-icon-inline-size: 0.8em;
7029
+ --wui-icon-inline-offset: 0.05em;
7030
+ --wui-icon-vertical-align: none;
7031
+
7032
+ top: var(--wui-icon-inline-offset);
7033
+ position: relative;
7034
+ }
7035
+ `;
7026
7036
  var StyledIcon = styled3.svg`
7027
7037
  ${({ $colorScheme }) => getColorScheme($colorScheme ?? "inherit")}
7038
+ --wui-icon-size: var(--wui-icon-inline-size, ${({ $height }) => $height}px);
7039
+ --wui-icon-vertical-align: middle;
7040
+
7041
+ height: var(--wui-icon-size);
7042
+ width: var(--wui-icon-size);
7028
7043
  `;
7029
7044
  var Icon = ({
7045
+ useInlineStyles = true,
7030
7046
  invertColor,
7031
7047
  colorScheme = "inherit",
7032
7048
  size = "lg",
@@ -7048,7 +7064,7 @@ var Icon = ({
7048
7064
  }
7049
7065
  const IconElement = iconMap[type];
7050
7066
  const defaultStyle = {
7051
- verticalAlign: "middle",
7067
+ verticalAlign: "var(--wui-icon-vertical-align)",
7052
7068
  ...style
7053
7069
  };
7054
7070
  const iconColor = invertColor ? "var(--wui-color-icon-on-fill)" : "var(--wui-color-icon)";
@@ -7056,13 +7072,14 @@ var Icon = ({
7056
7072
  StyledIcon,
7057
7073
  {
7058
7074
  $colorScheme: colorScheme,
7075
+ $height: iconSizeMap[responsiveSize],
7076
+ $width: iconSizeMap[responsiveSize],
7059
7077
  "aria-hidden": "true",
7060
7078
  as: IconElement,
7061
- height: `${iconSizeMap[responsiveSize]}px`,
7079
+ "data-wui-icon-inline": useInlineStyles ? true : void 0,
7062
7080
  role: "presentation",
7063
7081
  style: defaultStyle,
7064
7082
  viewBox: "0 0 24 24",
7065
- width: `${iconSizeMap[responsiveSize]}px`,
7066
7083
  xmlns: "http://www.w3.org/2000/svg",
7067
7084
  ...props,
7068
7085
  color: iconColor
@@ -7422,7 +7439,7 @@ var StyledSecondaryIcon = styled6.div`
7422
7439
  justify-content: flex-end;
7423
7440
  transition: all var(--wui-motion-duration-02) var(--wui-motion-ease-out);
7424
7441
 
7425
- ${({ $hideUntilHover }) => $hideUntilHover && css17`
7442
+ ${({ $hideUntilHover }) => $hideUntilHover && css18`
7426
7443
  will-change: transform;
7427
7444
  opacity: 0;
7428
7445
  transform: translateX(-16px);
@@ -7798,12 +7815,12 @@ Badge.displayName = "Badge_UI";
7798
7815
 
7799
7816
  // src/components/Banner/Banner.tsx
7800
7817
  import { useEffect as useEffect8, useState as useState10, useMemo as useMemo5 } from "react";
7801
- import styled16, { css as css22 } from "styled-components";
7818
+ import styled16 from "styled-components";
7802
7819
  import { isNil as isNil10, isNotNil as isNotNil13 } from "@wistia/type-guards";
7803
7820
 
7804
7821
  // src/components/Box/Box.tsx
7805
7822
  import { forwardRef as forwardRef5 } from "react";
7806
- import styled11, { css as css18 } from "styled-components";
7823
+ import styled11, { css as css19 } from "styled-components";
7807
7824
  import { isNotNil as isNotNil10, isRecord as isRecord3, isNotUndefined as isNotUndefined5 } from "@wistia/type-guards";
7808
7825
 
7809
7826
  // src/private/helpers/makePolymorphic/makePolymorphic.tsx
@@ -7859,27 +7876,27 @@ var getFlexStyle = (flexMode) => {
7859
7876
  switch (flexMode) {
7860
7877
  // grows to fill space, won't shrink, starts at 0
7861
7878
  case "grow":
7862
- return css18`
7879
+ return css19`
7863
7880
  flex: 1 0 0;
7864
7881
  `;
7865
7882
  // default behavior, can shrink but won't grow
7866
7883
  case "initial":
7867
- return css18`
7884
+ return css19`
7868
7885
  flex: 0 1 auto;
7869
7886
  `;
7870
7887
  // equal distribution of space
7871
7888
  case "equal":
7872
- return css18`
7889
+ return css19`
7873
7890
  flex: 1;
7874
7891
  `;
7875
7892
  // won't grow or shrink
7876
7893
  case "rigid":
7877
- return css18`
7894
+ return css19`
7878
7895
  flex: 0 0 auto;
7879
7896
  `;
7880
7897
  // can grow and shrink from content size
7881
7898
  case "fluid":
7882
- return css18`
7899
+ return css19`
7883
7900
  flex: 1 1 auto;
7884
7901
  `;
7885
7902
  default:
@@ -7991,46 +8008,46 @@ var Box = makePolymorphic(BoxComponent);
7991
8008
 
7992
8009
  // src/components/Heading/Heading.tsx
7993
8010
  import { forwardRef as forwardRef6 } from "react";
7994
- import styled12, { css as css19 } from "styled-components";
8011
+ import styled12, { css as css20 } from "styled-components";
7995
8012
  import { isNotNil as isNotNil11 } from "@wistia/type-guards";
7996
8013
  import { jsx as jsx204 } from "react/jsx-runtime";
7997
- var heroStyle = css19`
8014
+ var heroStyle = css20`
7998
8015
  --font-family: var(--wui-typography-heading-hero-family);
7999
8016
  --font-size: var(--wui-typography-heading-hero-size);
8000
8017
  --font-weight: var(--wui-typography-heading-hero-weight);
8001
8018
  --line-height: var(--wui-typography-heading-hero-line-height);
8002
8019
  `;
8003
- var heading1TextStyle = css19`
8020
+ var heading1TextStyle = css20`
8004
8021
  --font-family: var(--wui-typography-heading-1-family);
8005
8022
  --font-size: var(--wui-typography-heading-1-size);
8006
8023
  --font-weight: var(--wui-typography-heading-1-weight);
8007
8024
  --line-height: var(--wui-typography-heading-1-line-height);
8008
8025
  `;
8009
- var heading2TextStyle = css19`
8026
+ var heading2TextStyle = css20`
8010
8027
  --font-family: var(--wui-typography-heading-2-family);
8011
8028
  --font-size: var(--wui-typography-heading-2-size);
8012
8029
  --font-weight: var(--wui-typography-heading-2-weight);
8013
8030
  --line-height: var(--wui-typography-heading-2-line-height);
8014
8031
  `;
8015
- var heading3TextStyle = css19`
8032
+ var heading3TextStyle = css20`
8016
8033
  --font-family: var(--wui-typography-heading-3-family);
8017
8034
  --font-size: var(--wui-typography-heading-3-size);
8018
8035
  --font-weight: var(--wui-typography-heading-3-weight);
8019
8036
  --line-height: var(--wui-typography-heading-3-line-height);
8020
8037
  `;
8021
- var heading4TextStyle = css19`
8038
+ var heading4TextStyle = css20`
8022
8039
  --font-family: var(--wui-typography-heading-4-family);
8023
8040
  --font-size: var(--wui-typography-heading-4-size);
8024
8041
  --font-weight: var(--wui-typography-heading-4-weight);
8025
8042
  --line-height: var(--wui-typography-heading-4-line-height);
8026
8043
  `;
8027
- var heading5TextStyle = css19`
8044
+ var heading5TextStyle = css20`
8028
8045
  --font-family: var(--wui-typography-heading-5-family);
8029
8046
  --font-size: var(--wui-typography-heading-5-size);
8030
8047
  --font-weight: var(--wui-typography-heading-5-weight);
8031
8048
  --line-height: var(--wui-typography-heading-5-line-height);
8032
8049
  `;
8033
- var heading6TextStyle = css19`
8050
+ var heading6TextStyle = css20`
8034
8051
  --font-family: var(--wui-typography-heading-6-family);
8035
8052
  --font-size: var(--wui-typography-heading-6-size);
8036
8053
  --font-weight: var(--wui-typography-heading-6-weight);
@@ -8069,23 +8086,25 @@ var StyledHeading = styled12.div`
8069
8086
  ${({ $variant }) => variantStyleMap[$variant]}
8070
8087
  ${({ $truncate }) => {
8071
8088
  if (isNotNil11($truncate)) {
8072
- return css19`
8089
+ return css20`
8073
8090
  ${ellipsisStyle};
8074
8091
  ${lineClampCss($truncate)};
8075
8092
  `;
8076
8093
  }
8077
8094
  return void 0;
8078
8095
  }}
8079
- ${({ $inline }) => $inline && css19`
8096
+ ${({ $inline }) => $inline && css20`
8080
8097
  display: inline-block;
8081
8098
  `}
8082
- ${({ $preventUserSelect }) => $preventUserSelect && css19`
8099
+ ${({ $preventUserSelect }) => $preventUserSelect && css20`
8083
8100
  user-select: none;
8084
8101
  `}
8085
- ${({ $align }) => css19`
8102
+ ${({ $align }) => css20`
8086
8103
  text-align: ${$align};
8087
8104
  `}
8088
8105
  margin: 0;
8106
+
8107
+ ${iconInlineStyle}
8089
8108
  `;
8090
8109
  var variantElementMap = {
8091
8110
  hero: DEFAULT_ELEMENT2,
@@ -8130,22 +8149,22 @@ var Heading = makePolymorphic(HeadingComponent);
8130
8149
 
8131
8150
  // src/components/Text/Text.tsx
8132
8151
  import { forwardRef as forwardRef7 } from "react";
8133
- import styled13, { css as css20 } from "styled-components";
8152
+ import styled13, { css as css21 } from "styled-components";
8134
8153
  import { isNotNil as isNotNil12 } from "@wistia/type-guards";
8135
8154
  import { jsx as jsx205 } from "react/jsx-runtime";
8136
- var bodyBoldStyles = css20`
8155
+ var bodyBoldStyles = css21`
8137
8156
  > strong,
8138
8157
  b {
8139
8158
  font-weight: var(--wui-typography-weight-body-bold);
8140
8159
  }
8141
8160
  `;
8142
- var labelBoldStyles = css20`
8161
+ var labelBoldStyles = css21`
8143
8162
  > strong,
8144
8163
  b {
8145
8164
  font-weight: var(--wui-typography-weight-label-bold);
8146
8165
  }
8147
8166
  `;
8148
- var body1TextStyle = css20`
8167
+ var body1TextStyle = css21`
8149
8168
  --font-family: var(--wui-typography-body-1-family);
8150
8169
  --font-size: var(--wui-typography-body-1-size);
8151
8170
  --font-weight: var(--wui-typography-body-1-weight);
@@ -8153,7 +8172,7 @@ var body1TextStyle = css20`
8153
8172
  --paragraph-spacing: var(--wui-typography-body-1-paragraph-spacing);
8154
8173
  ${bodyBoldStyles}
8155
8174
  `;
8156
- var body2TextStyle = css20`
8175
+ var body2TextStyle = css21`
8157
8176
  --font-family: var(--wui-typography-body-2-family);
8158
8177
  --font-size: var(--wui-typography-body-2-size);
8159
8178
  --font-weight: var(--wui-typography-body-2-weight);
@@ -8161,7 +8180,7 @@ var body2TextStyle = css20`
8161
8180
  --paragraph-spacing: var(--wui-typography-body-2-paragraph-spacing);
8162
8181
  ${bodyBoldStyles}
8163
8182
  `;
8164
- var body3TextStyle = css20`
8183
+ var body3TextStyle = css21`
8165
8184
  --font-family: var(--wui-typography-body-3-family);
8166
8185
  --font-size: var(--wui-typography-body-3-size);
8167
8186
  --font-weight: var(--wui-typography-body-3-weight);
@@ -8169,7 +8188,7 @@ var body3TextStyle = css20`
8169
8188
  --paragraph-spacing: var(--wui-typography-body-3-paragraph-spacing);
8170
8189
  ${bodyBoldStyles}
8171
8190
  `;
8172
- var body4TextStyle = css20`
8191
+ var body4TextStyle = css21`
8173
8192
  --font-family: var(--wui-typography-body-4-family);
8174
8193
  --font-size: var(--wui-typography-body-4-size);
8175
8194
  --font-weight: var(--wui-typography-body-4-weight);
@@ -8177,47 +8196,47 @@ var body4TextStyle = css20`
8177
8196
  --paragraph-spacing: var(--wui-typography-body-4-paragraph-spacing);
8178
8197
  ${bodyBoldStyles}
8179
8198
  `;
8180
- var label1TextStyle = css20`
8199
+ var label1TextStyle = css21`
8181
8200
  --font-family: var(--wui-typography-label-1-family);
8182
8201
  --font-size: var(--wui-typography-label-1-size);
8183
8202
  --font-weight: var(--wui-typography-label-1-weight);
8184
8203
  --line-height: var(--wui-typography-label-1-line-height);
8185
8204
  ${labelBoldStyles}
8186
8205
  `;
8187
- var label2TextStyle = css20`
8206
+ var label2TextStyle = css21`
8188
8207
  --font-family: var(--wui-typography-label-2-family);
8189
8208
  --font-size: var(--wui-typography-label-2-size);
8190
8209
  --font-weight: var(--wui-typography-label-2-weight);
8191
8210
  --line-height: var(--wui-typography-label-2-line-height);
8192
8211
  ${labelBoldStyles}
8193
8212
  `;
8194
- var label3TextStyle = css20`
8213
+ var label3TextStyle = css21`
8195
8214
  --font-family: var(--wui-typography-label-3-family);
8196
8215
  --font-size: var(--wui-typography-label-3-size);
8197
8216
  --font-weight: var(--wui-typography-label-3-weight);
8198
8217
  --line-height: var(--wui-typography-label-3-line-height);
8199
8218
  ${labelBoldStyles}
8200
8219
  `;
8201
- var label4TextStyle = css20`
8220
+ var label4TextStyle = css21`
8202
8221
  --font-family: var(--wui-typography-label-4-family);
8203
8222
  --font-size: var(--wui-typography-label-4-size);
8204
8223
  --font-weight: var(--wui-typography-label-4-weight);
8205
8224
  --line-height: var(--wui-typography-label-4-line-height);
8206
8225
  ${labelBoldStyles}
8207
8226
  `;
8208
- var body1MonoTextStyle = css20`
8227
+ var body1MonoTextStyle = css21`
8209
8228
  ${body1TextStyle};
8210
8229
  --font-family: var(--wui-typography-family-mono);
8211
8230
  `;
8212
- var body2MonoTextStyle = css20`
8231
+ var body2MonoTextStyle = css21`
8213
8232
  ${body2TextStyle};
8214
8233
  --font-family: var(--wui-typography-family-mono);
8215
8234
  `;
8216
- var body3MonoTextStyle = css20`
8235
+ var body3MonoTextStyle = css21`
8217
8236
  ${body3TextStyle};
8218
8237
  --font-family: var(--wui-typography-family-mono);
8219
8238
  `;
8220
- var body4MonoTextStyle = css20`
8239
+ var body4MonoTextStyle = css21`
8221
8240
  ${body4TextStyle};
8222
8241
  --font-family: var(--wui-typography-family-mono);
8223
8242
  `;
@@ -8267,6 +8286,7 @@ var StyledText = styled13.div`
8267
8286
  return "var(--wui-color-text)";
8268
8287
  }};
8269
8288
 
8289
+ ${iconInlineStyle}
8270
8290
  color: var(--text-color);
8271
8291
  font-family: var(--font-family);
8272
8292
  font-size: var(--font-size);
@@ -8277,26 +8297,26 @@ var StyledText = styled13.div`
8277
8297
  ${({ $variant }) => variantStyleMap2[$variant]}
8278
8298
  ${({ $truncate }) => {
8279
8299
  if (isNotNil12($truncate)) {
8280
- return css20`
8300
+ return css21`
8281
8301
  ${ellipsisStyle};
8282
8302
  ${lineClampCss($truncate)};
8283
8303
  `;
8284
8304
  }
8285
8305
  return void 0;
8286
8306
  }}
8287
- ${({ $inline }) => $inline && css20`
8307
+ ${({ $inline }) => $inline && css21`
8288
8308
  display: inline-block;
8289
8309
  `}
8290
- ${({ $disabled }) => $disabled && css20`
8310
+ ${({ $disabled }) => $disabled && css21`
8291
8311
  --text-color: var(--wui-color-text-disabled);
8292
8312
  `}
8293
- ${({ $preventUserSelect }) => $preventUserSelect && css20`
8313
+ ${({ $preventUserSelect }) => $preventUserSelect && css21`
8294
8314
  user-select: none;
8295
8315
  `}
8296
- ${({ $align }) => css20`
8316
+ ${({ $align }) => css21`
8297
8317
  text-align: ${$align};
8298
8318
  `}
8299
- ${({ as }) => as === "p" && css20`
8319
+ ${({ as }) => as === "p" && css21`
8300
8320
  display: block;
8301
8321
 
8302
8322
  + p {
@@ -8339,7 +8359,7 @@ TextComponent.displayName = "Text_UI";
8339
8359
  var Text = makePolymorphic(TextComponent);
8340
8360
 
8341
8361
  // src/components/ButtonGroup/ButtonGroup.tsx
8342
- import styled14, { css as css21 } from "styled-components";
8362
+ import styled14, { css as css22 } from "styled-components";
8343
8363
  import { isNil as isNil9 } from "@wistia/type-guards";
8344
8364
  import { jsx as jsx206 } from "react/jsx-runtime";
8345
8365
  var getAlignment = (align) => {
@@ -8379,7 +8399,7 @@ var ButtonGroupComponent = styled14.div`
8379
8399
  }
8380
8400
  }
8381
8401
 
8382
- ${({ $buttonSize }) => $buttonSize !== "natural" && css21`
8402
+ ${({ $buttonSize }) => $buttonSize !== "natural" && css22`
8383
8403
  button,
8384
8404
  a {
8385
8405
  ${buttonSizeStyles[$buttonSize]}
@@ -8456,7 +8476,7 @@ var IconButton = forwardRef8(
8456
8476
  IconButton.displayName = "IconButton_UI";
8457
8477
 
8458
8478
  // src/components/Banner/Banner.tsx
8459
- import { jsx as jsx208, jsxs as jsxs13 } from "react/jsx-runtime";
8479
+ import { Fragment as Fragment2, jsx as jsx208, jsxs as jsxs13 } from "react/jsx-runtime";
8460
8480
  var BREAKPOINT_WIDTH = 600;
8461
8481
  var VERTICAL_BREAKPOINT_WIDTH = 284;
8462
8482
  var MIN_IMAGE_WIDTH = 400;
@@ -8493,21 +8513,6 @@ var StyledBanner = styled16.div`
8493
8513
 
8494
8514
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
8495
8515
  `;
8496
- var IconWrapper = styled16(Box)`
8497
- --wui-banner-icon-size: var(--font-size, 24px);
8498
-
8499
- ${({ $iconPosition }) => $iconPosition === "inline" && css22`
8500
- display: inline-block;
8501
- vertical-align: text-bottom;
8502
- margin-right: calc(var(--wui-banner-icon-size) / 3);
8503
- `}
8504
-
8505
- svg {
8506
- color: var(--wui-color-icon);
8507
- width: var(--wui-banner-icon-size);
8508
- height: var(--wui-banner-icon-size);
8509
- }
8510
- `;
8511
8516
  var Banner = ({
8512
8517
  bodyText,
8513
8518
  colorScheme = "inherit",
@@ -8570,9 +8575,8 @@ var Banner = ({
8570
8575
  style: { padding: "var(--wui-banner-padding)" },
8571
8576
  children: [
8572
8577
  iconPosition === "above" && /* @__PURE__ */ jsx208(
8573
- IconWrapper,
8578
+ Box,
8574
8579
  {
8575
- $iconPosition: "above",
8576
8580
  alignSelf: "stretch",
8577
8581
  direction: "column",
8578
8582
  justifyContent: "center",
@@ -8588,7 +8592,10 @@ var Banner = ({
8588
8592
  justifyContent: "center",
8589
8593
  children: [
8590
8594
  isNotNil13(headingText) ? /* @__PURE__ */ jsxs13(Heading, { variant: headingVariant, children: [
8591
- iconPosition === "inline" && /* @__PURE__ */ jsx208(IconWrapper, { $iconPosition: "inline", children: icon }),
8595
+ iconPosition === "inline" && /* @__PURE__ */ jsxs13(Fragment2, { children: [
8596
+ icon,
8597
+ " "
8598
+ ] }),
8592
8599
  headingText
8593
8600
  ] }) : null,
8594
8601
  /* @__PURE__ */ jsx208(Text, { variant: textVariant, children: bodyText })
@@ -8634,7 +8641,7 @@ Banner.displayName = "Banner_UI";
8634
8641
  // src/components/Breadcrumbs/Breadcrumbs.tsx
8635
8642
  import { Children as Children2 } from "react";
8636
8643
  import styled17 from "styled-components";
8637
- import { Fragment as Fragment2, jsx as jsx209, jsxs as jsxs14 } from "react/jsx-runtime";
8644
+ import { Fragment as Fragment3, jsx as jsx209, jsxs as jsxs14 } from "react/jsx-runtime";
8638
8645
  var StyledBreadcrumbs = styled17.nav`
8639
8646
  display: flex;
8640
8647
  align-items: center;
@@ -8653,7 +8660,7 @@ var Breadcrumbs = ({ children, ...props }) => {
8653
8660
  crumbs = crumbs.slice(-1);
8654
8661
  }
8655
8662
  const crumbMaxWidth = Math.floor(100 / crumbs.length) - BUFFER_WIDTH;
8656
- return /* @__PURE__ */ jsxs14(Fragment2, { children: [
8663
+ return /* @__PURE__ */ jsxs14(Fragment3, { children: [
8657
8664
  /* @__PURE__ */ jsx209("style", { type: "text/css", children: `
8658
8665
  [data-wui-breadcrumbs] {
8659
8666
  container-type: inline-size;
@@ -8681,7 +8688,7 @@ Breadcrumbs.displayName = "Breadcrumbs_UI";
8681
8688
 
8682
8689
  // src/components/Breadcrumbs/Breadcrumb.tsx
8683
8690
  import styled18 from "styled-components";
8684
- import { Fragment as Fragment3, jsx as jsx210, jsxs as jsxs15 } from "react/jsx-runtime";
8691
+ import { Fragment as Fragment4, jsx as jsx210, jsxs as jsxs15 } from "react/jsx-runtime";
8685
8692
  var BreadcrumbContent = styled18.span`
8686
8693
  overflow: hidden;
8687
8694
  white-space: nowrap;
@@ -8691,7 +8698,7 @@ var BreadcrumbContent = styled18.span`
8691
8698
  flex: 0;
8692
8699
  `;
8693
8700
  var Breadcrumb = ({ icon, href, children, ...props }) => {
8694
- return /* @__PURE__ */ jsxs15(Fragment3, { children: [
8701
+ return /* @__PURE__ */ jsxs15(Fragment4, { children: [
8695
8702
  /* @__PURE__ */ jsx210(
8696
8703
  Button,
8697
8704
  {
@@ -9468,7 +9475,7 @@ CollapsibleTriggerIcon.displayName = "CollapsibleTriggerIcon_UI";
9468
9475
  import styled30 from "styled-components";
9469
9476
  import { Content } from "@radix-ui/react-collapsible";
9470
9477
  import { isNotUndefined as isNotUndefined8 } from "@wistia/type-guards";
9471
- import { Fragment as Fragment4, jsx as jsx224, jsxs as jsxs19 } from "react/jsx-runtime";
9478
+ import { Fragment as Fragment5, jsx as jsx224, jsxs as jsxs19 } from "react/jsx-runtime";
9472
9479
  var ClampedContent = styled30.div`
9473
9480
  --wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
9474
9481
  `;
@@ -9483,7 +9490,7 @@ var CollapsibleContent = ({ clamp, children }) => {
9483
9490
  }
9484
9491
  );
9485
9492
  }
9486
- return /* @__PURE__ */ jsx224(Content, { children: /* @__PURE__ */ jsxs19(Fragment4, { children: [
9493
+ return /* @__PURE__ */ jsx224(Content, { children: /* @__PURE__ */ jsxs19(Fragment5, { children: [
9487
9494
  children,
9488
9495
  " "
9489
9496
  ] }) });
@@ -9496,7 +9503,7 @@ import { Root as RadioGroupRoot } from "@radix-ui/react-radio-group";
9496
9503
 
9497
9504
  // src/components/ColorPicker/ColorPickerContext.tsx
9498
9505
  import { createContext as createContext5, useCallback as useCallback9, useContext as useContext4, useEffect as useEffect10, useMemo as useMemo8, useState as useState12 } from "react";
9499
- import { formatHex as formatHex2, wcagContrast as wcagContrast2 } from "culori/fn";
9506
+ import { formatHex as formatHex2 } from "culori/fn";
9500
9507
 
9501
9508
  // src/components/ColorPicker/color-conversion-utils.ts
9502
9509
  import { modeHsv, modeLrgb, modeRgb, parseHex, useMode } from "culori/fn";
@@ -9602,6 +9609,16 @@ var compositeOverWhite = (color, alpha = 1) => {
9602
9609
  b: compositeChannel(colorAsRgb.b)
9603
9610
  };
9604
9611
  };
9612
+ var calculateContrast = ({
9613
+ backgroundColor,
9614
+ foregroundColor = DEFAULT_COLOR_FOR_COMPARISON,
9615
+ backgroundOpacity = DEFAULT_OPACITY_FOR_CONTRAST_CALCULATION
9616
+ }) => {
9617
+ const backgroundColorAsRgb = convertToRgb(backgroundColor);
9618
+ const foregroundColorAsRgb = convertToRgb(foregroundColor);
9619
+ const compositeBackground = compositeOverWhite(backgroundColorAsRgb, backgroundOpacity);
9620
+ return wcagContrast(compositeBackground, foregroundColorAsRgb);
9621
+ };
9605
9622
  var snapValueToEdges = (value) => {
9606
9623
  if (value > 1 - VALUE_CHANNEL_SNAP_EPSILON) {
9607
9624
  return 1;
@@ -9624,13 +9641,15 @@ var updateSearchBounds = (searchingBrighter, contrast, minContrast, midValue, se
9624
9641
  return { newSearchLow: searchLow, newSearchHigh: midValue };
9625
9642
  };
9626
9643
  var getAccessibleColorByValueChannelChange = ({
9627
- originalHsv,
9644
+ originalColor,
9628
9645
  colorForComparison,
9629
9646
  minContrast,
9630
9647
  maxIterations = 50,
9631
9648
  direction,
9632
- opacityForContrastCalculation
9649
+ opacityForContrastCalculation,
9650
+ shouldConvertToHex = true
9633
9651
  }) => {
9652
+ const originalHsv = convertToHsv(originalColor);
9634
9653
  const searchingBrighter = direction === "brighter";
9635
9654
  const lowValue = searchingBrighter ? originalHsv.v : 0;
9636
9655
  const highValue = searchingBrighter ? 1 : originalHsv.v;
@@ -9641,10 +9660,11 @@ var getAccessibleColorByValueChannelChange = ({
9641
9660
  v: extremeValue,
9642
9661
  mode: "hsv"
9643
9662
  };
9644
- const extremeContrast = wcagContrast(
9645
- compositeOverWhite(extremeVariant, opacityForContrastCalculation),
9646
- colorForComparison
9647
- );
9663
+ const extremeContrast = calculateContrast({
9664
+ backgroundColor: shouldConvertToHex ? formatHex(extremeVariant) : extremeVariant,
9665
+ foregroundColor: colorForComparison,
9666
+ backgroundOpacity: opacityForContrastCalculation
9667
+ });
9648
9668
  if (extremeContrast < minContrast) {
9649
9669
  return null;
9650
9670
  }
@@ -9660,10 +9680,11 @@ var getAccessibleColorByValueChannelChange = ({
9660
9680
  v: midValue,
9661
9681
  mode: "hsv"
9662
9682
  };
9663
- const contrast = wcagContrast(
9664
- compositeOverWhite(candidateHsv, opacityForContrastCalculation),
9665
- colorForComparison
9666
- );
9683
+ const contrast = calculateContrast({
9684
+ backgroundColor: shouldConvertToHex ? formatHex(candidateHsv) : candidateHsv,
9685
+ foregroundColor: colorForComparison,
9686
+ backgroundOpacity: opacityForContrastCalculation
9687
+ });
9667
9688
  if (contrast >= minContrast) {
9668
9689
  bestSoFar = candidateHsv;
9669
9690
  }
@@ -9683,7 +9704,7 @@ var getAccessibleColorByValueChannelChange = ({
9683
9704
  }
9684
9705
  return bestSoFar;
9685
9706
  };
9686
- var chooseClosestDerivativeToOriginal = (brighterOption, darkerOption, originalHsv) => {
9707
+ var chooseClosestDerivativeToOriginal = (brighterOption, darkerOption, originalColor) => {
9687
9708
  const hsvDifference = differenceEuclidean("hsv");
9688
9709
  if (!brighterOption && !darkerOption) {
9689
9710
  return null;
@@ -9694,8 +9715,8 @@ var chooseClosestDerivativeToOriginal = (brighterOption, darkerOption, originalH
9694
9715
  if (!darkerOption && brighterOption != null) {
9695
9716
  return brighterOption;
9696
9717
  }
9697
- const brighterDifference = brighterOption === null ? Infinity : hsvDifference(originalHsv, brighterOption);
9698
- const darkerDifference = darkerOption === null ? Infinity : hsvDifference(originalHsv, darkerOption);
9718
+ const brighterDifference = brighterOption === null ? Infinity : hsvDifference(originalColor, brighterOption);
9719
+ const darkerDifference = darkerOption === null ? Infinity : hsvDifference(originalColor, darkerOption);
9699
9720
  if (brighterDifference <= darkerDifference && brighterOption != null) {
9700
9721
  return brighterOption;
9701
9722
  }
@@ -9705,12 +9726,13 @@ var chooseClosestDerivativeToOriginal = (brighterOption, darkerOption, originalH
9705
9726
  throw new Error("Unable to determine the best accessible color variant");
9706
9727
  };
9707
9728
  var getAccessibleColorBySaturationAndValueChange = ({
9708
- originalHsv,
9729
+ originalColor,
9709
9730
  colorForComparison,
9710
9731
  minContrast,
9711
9732
  direction,
9712
9733
  opacityForContrastCalculation
9713
9734
  }) => {
9735
+ const originalHsv = convertToHsv(originalColor);
9714
9736
  const hsvDifference = differenceEuclidean("hsv");
9715
9737
  const maxIterations = 50;
9716
9738
  let lowStep = 0;
@@ -9736,7 +9758,11 @@ var getAccessibleColorBySaturationAndValueChange = ({
9736
9758
  };
9737
9759
  };
9738
9760
  const checkContrast = (hsv) => {
9739
- return wcagContrast(compositeOverWhite(hsv, opacityForContrastCalculation), colorForComparison);
9761
+ return calculateContrast({
9762
+ backgroundColor: formatHex(hsv),
9763
+ foregroundColor: colorForComparison,
9764
+ backgroundOpacity: opacityForContrastCalculation
9765
+ });
9740
9766
  };
9741
9767
  const extremeHsv = getHsvForStep(highStep);
9742
9768
  if (checkContrast(extremeHsv) < minContrast) {
@@ -9765,7 +9791,7 @@ var getAccessibleColorBySaturationAndValueChange = ({
9765
9791
  return bestCandidate;
9766
9792
  };
9767
9793
  var getAccessibleColorInDirection = ({
9768
- originalHsv,
9794
+ originalColor,
9769
9795
  colorForComparison,
9770
9796
  minContrast,
9771
9797
  maxIterations = 50,
@@ -9773,7 +9799,7 @@ var getAccessibleColorInDirection = ({
9773
9799
  opacityForContrastCalculation
9774
9800
  }) => {
9775
9801
  const valueResult = getAccessibleColorByValueChannelChange({
9776
- originalHsv,
9802
+ originalColor,
9777
9803
  colorForComparison,
9778
9804
  minContrast,
9779
9805
  maxIterations,
@@ -9784,7 +9810,7 @@ var getAccessibleColorInDirection = ({
9784
9810
  return valueResult;
9785
9811
  }
9786
9812
  return getAccessibleColorBySaturationAndValueChange({
9787
- originalHsv,
9813
+ originalColor,
9788
9814
  colorForComparison,
9789
9815
  minContrast,
9790
9816
  direction,
@@ -9792,21 +9818,23 @@ var getAccessibleColorInDirection = ({
9792
9818
  });
9793
9819
  };
9794
9820
  var getAccessibleColor = ({
9795
- originalHsv,
9821
+ originalColor,
9796
9822
  colorForComparison,
9797
9823
  minContrast = DEFAULT_MIN_CONTRAST,
9798
9824
  maxIterations = 50,
9799
9825
  opacityForContrastCalculation
9800
9826
  }) => {
9801
- const originalContrast = wcagContrast(
9802
- compositeOverWhite(originalHsv, opacityForContrastCalculation),
9803
- colorForComparison
9804
- );
9827
+ const originalColorAsHsv = convertToHsv(originalColor);
9828
+ const originalContrast = calculateContrast({
9829
+ backgroundColor: formatHex(originalColorAsHsv),
9830
+ foregroundColor: colorForComparison,
9831
+ backgroundOpacity: opacityForContrastCalculation
9832
+ });
9805
9833
  if (originalContrast >= minContrast) {
9806
- return originalHsv;
9834
+ return convertToHsv(originalColor);
9807
9835
  }
9808
9836
  const brighterOption = getAccessibleColorInDirection({
9809
- originalHsv,
9837
+ originalColor,
9810
9838
  colorForComparison,
9811
9839
  minContrast,
9812
9840
  maxIterations,
@@ -9814,43 +9842,45 @@ var getAccessibleColor = ({
9814
9842
  opacityForContrastCalculation
9815
9843
  });
9816
9844
  const darkerOption = getAccessibleColorInDirection({
9817
- originalHsv,
9845
+ originalColor,
9818
9846
  colorForComparison,
9819
9847
  minContrast,
9820
9848
  maxIterations,
9821
9849
  direction: "darker",
9822
9850
  opacityForContrastCalculation
9823
9851
  });
9824
- const result = chooseClosestDerivativeToOriginal(brighterOption, darkerOption, originalHsv);
9852
+ const result = chooseClosestDerivativeToOriginal(brighterOption, darkerOption, originalColor);
9825
9853
  if (result == null) {
9826
9854
  throw new Error(
9827
- `Unable to get accessible derivative for ${formatHex(originalHsv)} at minimum contrast ratio ${minContrast}`
9855
+ `Unable to get accessible derivative for ${formatHex(originalColor)} at minimum contrast ratio ${minContrast}`
9828
9856
  );
9829
9857
  }
9830
9858
  return result;
9831
9859
  };
9832
9860
  var hasAccessibleDerivatives = ({
9833
- originalHsv,
9861
+ originalColor,
9834
9862
  colorForComparison,
9835
9863
  minContrast = DEFAULT_MIN_CONTRAST,
9836
9864
  opacityForContrastCalculation
9837
9865
  }) => {
9838
- const originalContrast = wcagContrast(
9839
- compositeOverWhite(originalHsv, opacityForContrastCalculation),
9840
- colorForComparison
9841
- );
9866
+ const originalColorAsHsv = convertToHsv(originalColor);
9867
+ const originalContrast = calculateContrast({
9868
+ backgroundColor: formatHex(originalColorAsHsv),
9869
+ foregroundColor: colorForComparison,
9870
+ backgroundOpacity: opacityForContrastCalculation
9871
+ });
9842
9872
  if (originalContrast >= minContrast) {
9843
9873
  return true;
9844
9874
  }
9845
9875
  const brighterOption = getAccessibleColorInDirection({
9846
- originalHsv,
9876
+ originalColor,
9847
9877
  colorForComparison,
9848
9878
  minContrast,
9849
9879
  direction: "brighter",
9850
9880
  opacityForContrastCalculation
9851
9881
  });
9852
9882
  const darkerOption = getAccessibleColorInDirection({
9853
- originalHsv,
9883
+ originalColor,
9854
9884
  colorForComparison,
9855
9885
  minContrast,
9856
9886
  direction: "darker",
@@ -9874,27 +9904,28 @@ var ColorPickerProvider = ({
9874
9904
  const [nonDerivedValueAsHsv, setNonDerivedValueAsHsv] = useState12(convertToHsv(valueAsHex));
9875
9905
  const [shouldEnforceMinContrast, setShouldEnforceMinContrast] = useState12(false);
9876
9906
  const getAccessibleDerivativeColor = useCallback9(
9877
- (originalHsv) => getAccessibleColor({
9878
- originalHsv,
9907
+ (originalColor) => getAccessibleColor({
9908
+ originalColor,
9879
9909
  colorForComparison,
9880
9910
  minContrast: minimumContrastRatio,
9881
9911
  opacityForContrastCalculation
9882
9912
  }),
9883
9913
  [colorForComparison, minimumContrastRatio, opacityForContrastCalculation]
9884
9914
  );
9885
- const valueAsHsv = shouldEnforceMinContrast ? getAccessibleDerivativeColor(nonDerivedValueAsHsv) : nonDerivedValueAsHsv;
9886
- const currentContrastRatio = wcagContrast2(
9887
- compositeOverWhite(valueAsHsv, opacityForContrastCalculation),
9888
- colorForComparison
9889
- );
9915
+ const valueAsHsv = shouldEnforceMinContrast ? getAccessibleDerivativeColor(formatHex2(nonDerivedValueAsHsv)) : nonDerivedValueAsHsv;
9916
+ const currentContrastRatio = calculateContrast({
9917
+ backgroundColor: valueAsHex,
9918
+ foregroundColor: colorForComparison,
9919
+ backgroundOpacity: opacityForContrastCalculation
9920
+ });
9890
9921
  const hasAccessibleDerivativesValue = useMemo8(() => {
9891
9922
  return hasAccessibleDerivatives({
9892
- originalHsv: valueAsHsv,
9923
+ originalColor: valueAsHex,
9893
9924
  colorForComparison,
9894
9925
  minContrast: minimumContrastRatio,
9895
9926
  opacityForContrastCalculation
9896
9927
  });
9897
- }, [valueAsHsv, colorForComparison, minimumContrastRatio, opacityForContrastCalculation]);
9928
+ }, [valueAsHex, colorForComparison, minimumContrastRatio, opacityForContrastCalculation]);
9898
9929
  const onChangeNonDerivedValueAsHsv = useCallback9((nonDerivedValue) => {
9899
9930
  setNonDerivedValueAsHsv(nonDerivedValue);
9900
9931
  }, []);
@@ -9918,15 +9949,21 @@ var ColorPickerProvider = ({
9918
9949
  const setShouldEnforceMinContrastWrapped = useCallback9(
9919
9950
  (newShouldEnforceMinContrast) => {
9920
9951
  setShouldEnforceMinContrast(newShouldEnforceMinContrast);
9921
- const newColorAsHsv = newShouldEnforceMinContrast ? getAccessibleDerivativeColor(valueAsHsv) : nonDerivedValueAsHsv;
9952
+ const newColorAsHsv = newShouldEnforceMinContrast ? getAccessibleDerivativeColor(valueAsHex) : nonDerivedValueAsHsv;
9922
9953
  const currentHsv = valueAsHsv;
9923
9954
  if (currentHsv.h !== newColorAsHsv.h || currentHsv.s !== newColorAsHsv.s || currentHsv.v !== newColorAsHsv.v) {
9924
9955
  changeValueSmoothly(newColorAsHsv);
9925
9956
  }
9926
9957
  },
9927
- [changeValueSmoothly, getAccessibleDerivativeColor, nonDerivedValueAsHsv, valueAsHsv]
9958
+ [
9959
+ changeValueSmoothly,
9960
+ getAccessibleDerivativeColor,
9961
+ nonDerivedValueAsHsv,
9962
+ valueAsHex,
9963
+ valueAsHsv
9964
+ ]
9928
9965
  );
9929
- const whatValuePropShouldBe = shouldEnforceMinContrast ? formatHex2(getAccessibleDerivativeColor(nonDerivedValueAsHsv)) : formatHex2(nonDerivedValueAsHsv);
9966
+ const whatValuePropShouldBe = shouldEnforceMinContrast ? formatHex2(getAccessibleDerivativeColor(formatHex2(nonDerivedValueAsHsv))) : formatHex2(nonDerivedValueAsHsv);
9930
9967
  useEffect10(() => {
9931
9968
  if (valueAsHex !== whatValuePropShouldBe && !isTransitioning) {
9932
9969
  onValueChange(whatValuePropShouldBe);
@@ -10563,6 +10600,9 @@ var Container6 = styled41.div`
10563
10600
  justify-content: end;
10564
10601
  align-items: center;
10565
10602
  `;
10603
+ var floorToTenth = (value) => {
10604
+ return Math.floor(value * 10) / 10;
10605
+ };
10566
10606
  var ContrastIndicator = () => {
10567
10607
  const { currentContrastRatio, minimumContrastRatio } = useColorPickerState();
10568
10608
  const isContrastSufficient = currentContrastRatio >= minimumContrastRatio;
@@ -10582,7 +10622,7 @@ var ContrastIndicator = () => {
10582
10622
  renderAs: "span",
10583
10623
  variant: "body4Mono",
10584
10624
  children: [
10585
- currentContrastRatio.toFixed(2),
10625
+ floorToTenth(currentContrastRatio).toFixed(1),
10586
10626
  ":1"
10587
10627
  ]
10588
10628
  }
@@ -11398,11 +11438,13 @@ var calculateContrastCurve = (width, height, hue, minimumContrastRatio, colorFor
11398
11438
  const saturationChanel = x / (width - 1);
11399
11439
  const initialValueChannelForSearch = limit === "upper" ? 0 : 1;
11400
11440
  const colorForXAsHsv = getAccessibleColorByValueChannelChange({
11401
- originalHsv: { h: hue, s: saturationChanel, v: initialValueChannelForSearch, mode: "hsv" },
11441
+ originalColor: { h: hue, s: saturationChanel, v: initialValueChannelForSearch, mode: "hsv" },
11402
11442
  colorForComparison,
11403
11443
  minContrast: minimumContrastRatio,
11404
11444
  direction: limit === "upper" ? "brighter" : "darker",
11405
- opacityForContrastCalculation
11445
+ opacityForContrastCalculation,
11446
+ // We set shouldConvertToHex to false to make the curve smoother.
11447
+ shouldConvertToHex: false
11406
11448
  });
11407
11449
  if (colorForXAsHsv != null) {
11408
11450
  const point = {
@@ -11740,7 +11782,7 @@ import styled49 from "styled-components";
11740
11782
  import { forwardRef as forwardRef16 } from "react";
11741
11783
  import styled48 from "styled-components";
11742
11784
  import { isNil as isNil14, isNotNil as isNotNil19, isNonEmptyString as isNonEmptyString5 } from "@wistia/type-guards";
11743
- import { Fragment as Fragment5, jsx as jsx251, jsxs as jsxs32 } from "react/jsx-runtime";
11785
+ import { Fragment as Fragment6, jsx as jsx251, jsxs as jsxs32 } from "react/jsx-runtime";
11744
11786
  var TagLabel = styled48.a`
11745
11787
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
11746
11788
  font-size: var(--wui-typography-label-4-size);
@@ -11832,7 +11874,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
11832
11874
  "for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
11833
11875
  );
11834
11876
  }
11835
- return /* @__PURE__ */ jsxs32(Fragment5, { children: [
11877
+ return /* @__PURE__ */ jsxs32(Fragment6, { children: [
11836
11878
  /* @__PURE__ */ jsx251(TagDivider, { $colorScheme: colorScheme }),
11837
11879
  /* @__PURE__ */ jsxs32(
11838
11880
  StyledRemoveButton,
@@ -12471,7 +12513,7 @@ Divider.displayName = "Divider_UI";
12471
12513
  // src/components/EditableHeading/EditableHeading.tsx
12472
12514
  import styled55, { css as css30 } from "styled-components";
12473
12515
  import { useState as useState16, useRef as useRef16 } from "react";
12474
- import { Fragment as Fragment6, jsx as jsx258, jsxs as jsxs36 } from "react/jsx-runtime";
12516
+ import { Fragment as Fragment7, jsx as jsx258, jsxs as jsxs36 } from "react/jsx-runtime";
12475
12517
  var StyledInput = styled55(Input)`
12476
12518
  &:not([rows]) {
12477
12519
  min-height: unset;
@@ -12590,7 +12632,7 @@ var EditableHeading = ({
12590
12632
  }
12591
12633
  );
12592
12634
  }
12593
- return /* @__PURE__ */ jsxs36(Fragment6, { children: [
12635
+ return /* @__PURE__ */ jsxs36(Fragment7, { children: [
12594
12636
  /* @__PURE__ */ jsx258(Tooltip, { content: tooltipText, children: HeadingComponent2 }),
12595
12637
  /* @__PURE__ */ jsx258(ScreenReaderOnly, { children: /* @__PURE__ */ jsx258(
12596
12638
  "button",
@@ -12743,7 +12785,7 @@ var Label = ({
12743
12785
  Label.displayName = "Label_UI";
12744
12786
 
12745
12787
  // src/components/FormField/FormField.tsx
12746
- import { Fragment as Fragment7, jsx as jsx261, jsxs as jsxs38 } from "react/jsx-runtime";
12788
+ import { Fragment as Fragment8, jsx as jsx261, jsxs as jsxs38 } from "react/jsx-runtime";
12747
12789
  var StyledFormField = styled57.div`
12748
12790
  --form-field-spacing: var(--wui-space-01);
12749
12791
  --form-field-spacing-inline: var(--wui-space-02);
@@ -12884,7 +12926,7 @@ var FormField = ({
12884
12926
  !isIntegratedLabel && /* @__PURE__ */ jsx261(Label, { htmlFor: computedId, children: label }),
12885
12927
  isNotNil21(description) ? /* @__PURE__ */ jsx261(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
12886
12928
  cloneElement5(children, childProps),
12887
- isNotNil21(computedError) ? /* @__PURE__ */ jsxs38(Fragment7, { children: [
12929
+ isNotNil21(computedError) ? /* @__PURE__ */ jsxs38(Fragment8, { children: [
12888
12930
  /* @__PURE__ */ jsx261("div", {}),
12889
12931
  /* @__PURE__ */ jsx261(
12890
12932
  ErrorMessages,
@@ -16894,6 +16936,7 @@ export {
16894
16936
  ValueNameOrHexCode,
16895
16937
  ValueSwatch,
16896
16938
  WistiaLogo,
16939
+ calculateContrast,
16897
16940
  colorSchemeOptions,
16898
16941
  copyToClipboard,
16899
16942
  dateTime,