@wistia/ui 0.10.10-beta.ee09f415.fc0d795 → 0.10.11

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.10.10-beta.ee09f415.fc0d795
3
+ * @license @wistia/ui v0.10.11
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -8744,9 +8744,9 @@ var Center = forwardRef9(
8744
8744
  Center.displayName = "Center";
8745
8745
 
8746
8746
  // src/components/Checkbox/Checkbox.tsx
8747
- import { forwardRef as forwardRef11, useId } from "react";
8748
- import styled26, { css as css25 } from "styled-components";
8749
- import { isNonEmptyString as isNonEmptyString2 } from "@wistia/type-guards";
8747
+ import { forwardRef as forwardRef12, useId as useId2 } from "react";
8748
+ import styled27, { css as css25 } from "styled-components";
8749
+ import { isNonEmptyString as isNonEmptyString2, isNotUndefined as isNotUndefined7 } from "@wistia/type-guards";
8750
8750
 
8751
8751
  // src/private/components/FormControlLabel/FormControlLabel.tsx
8752
8752
  import styled23, { css as css24 } from "styled-components";
@@ -8865,7 +8865,8 @@ var FormControlLabel = ({
8865
8865
  FormControlLabel.displayName = "FormControlLabel";
8866
8866
 
8867
8867
  // src/components/FormGroup/CheckboxGroup.tsx
8868
- import { createContext as createContext3, useMemo as useMemo6, useContext as useContext3 } from "react";
8868
+ import { createContext as createContext4, useMemo as useMemo7, useContext as useContext3 } from "react";
8869
+ import { isArray } from "@wistia/type-guards";
8869
8870
 
8870
8871
  // src/components/FormGroup/FormGroup.tsx
8871
8872
  import styled25 from "styled-components";
@@ -8935,9 +8936,130 @@ var FormGroup = ({ children, label, ...props }) => {
8935
8936
  };
8936
8937
  FormGroup.displayName = "FormGroup";
8937
8938
 
8938
- // src/components/FormGroup/CheckboxGroup.tsx
8939
+ // src/components/Form/Form.tsx
8940
+ import { forwardRef as forwardRef11, useRef as useRef8, useMemo as useMemo6, createContext as createContext3, useState as useState11, useId } from "react";
8941
+ import styled26 from "styled-components";
8942
+ import { isNotUndefined as isNotUndefined6, isUndefined as isUndefined3 } from "@wistia/type-guards";
8943
+
8944
+ // src/components/Form/serializeFormData.tsx
8945
+ var ARRAY_SUFFIX = "[]";
8946
+ var serializeFormData = (formData) => {
8947
+ const data = {};
8948
+ formData.forEach((value, key) => {
8949
+ if (key.endsWith(ARRAY_SUFFIX)) {
8950
+ const newKey = key.slice(0, -ARRAY_SUFFIX.length);
8951
+ data[newKey] = formData.getAll(key);
8952
+ } else {
8953
+ data[key] = value;
8954
+ }
8955
+ });
8956
+ return data;
8957
+ };
8958
+
8959
+ // src/components/Form/Form.tsx
8939
8960
  import { jsx as jsx216 } from "react/jsx-runtime";
8940
- var CheckboxGroupContext = createContext3(null);
8961
+ var StyledForm = styled26.form`
8962
+ --form-default-width: 690px;
8963
+
8964
+ max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
8965
+ `;
8966
+ var FormContext = createContext3({
8967
+ values: {},
8968
+ errors: {},
8969
+ hasSubmitted: false,
8970
+ formId: "NO_FORM",
8971
+ labelPosition: "block"
8972
+ });
8973
+ var FormComponent = ({
8974
+ children,
8975
+ action,
8976
+ values = {},
8977
+ labelPosition = "block",
8978
+ validate,
8979
+ fullWidth = false,
8980
+ ...props
8981
+ }, forwardedRef) => {
8982
+ const [errors, setErrors] = useState11({});
8983
+ const [hasSubmitted, setHasSubmitted] = useState11(false);
8984
+ const innerRef = useRef8();
8985
+ const ref = forwardedRef ?? innerRef;
8986
+ const autoId = useId();
8987
+ const id = props.id ?? autoId;
8988
+ const handleValidate = (nextFormData) => {
8989
+ const nextData = serializeFormData(nextFormData);
8990
+ if (isUndefined3(validate)) {
8991
+ return {};
8992
+ }
8993
+ return validate(nextData);
8994
+ };
8995
+ const handleBlur2 = (event) => {
8996
+ if (props.onBlur) {
8997
+ props.onBlur(event);
8998
+ }
8999
+ const formData = new FormData(event.currentTarget);
9000
+ if (isNotUndefined6(validate)) {
9001
+ handleValidate(formData);
9002
+ }
9003
+ };
9004
+ const handleSubmit = (event) => {
9005
+ event.preventDefault();
9006
+ const formData = new FormData(event.currentTarget);
9007
+ const nextErrors = handleValidate(formData);
9008
+ const isValid = Object.keys(nextErrors).length === 0;
9009
+ setErrors(nextErrors);
9010
+ setHasSubmitted(true);
9011
+ if (isValid && props.onSubmit) {
9012
+ props.onSubmit(event);
9013
+ }
9014
+ if (isValid && action) {
9015
+ void action(formData);
9016
+ }
9017
+ };
9018
+ const handleReset = (event) => {
9019
+ setErrors({});
9020
+ setHasSubmitted(false);
9021
+ if (props.onReset) {
9022
+ props.onReset(event);
9023
+ }
9024
+ if (action) {
9025
+ void action(null);
9026
+ }
9027
+ };
9028
+ const context = useMemo6(() => {
9029
+ return {
9030
+ values,
9031
+ errors,
9032
+ hasSubmitted,
9033
+ formId: id,
9034
+ labelPosition
9035
+ };
9036
+ }, [labelPosition, values, errors, id, hasSubmitted]);
9037
+ return (
9038
+ // @ts-expect-error - generic context providers are a giant pain
9039
+ /* @__PURE__ */ jsx216(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx216(
9040
+ Stack,
9041
+ {
9042
+ ...props,
9043
+ ref,
9044
+ $fullWidth: fullWidth,
9045
+ alignItems: fullWidth ? "stretch" : "flex-start",
9046
+ as: StyledForm,
9047
+ gap: "space-05",
9048
+ id,
9049
+ onBlur: handleBlur2,
9050
+ onReset: handleReset,
9051
+ onSubmit: handleSubmit,
9052
+ children
9053
+ }
9054
+ ) })
9055
+ );
9056
+ };
9057
+ FormComponent.displayName = "Form";
9058
+ var Form = forwardRef11(FormComponent);
9059
+
9060
+ // src/components/FormGroup/CheckboxGroup.tsx
9061
+ import { jsx as jsx217 } from "react/jsx-runtime";
9062
+ var CheckboxGroupContext = createContext4(null);
8941
9063
  var useCheckboxGroup = () => {
8942
9064
  return useContext3(CheckboxGroupContext);
8943
9065
  };
@@ -8948,19 +9070,22 @@ var CheckboxGroup = ({
8948
9070
  value,
8949
9071
  ...props
8950
9072
  }) => {
8951
- const context = useMemo6(() => {
9073
+ const formState = useContext3(FormContext);
9074
+ const derivedValue = isArray(formState.values[name]) ? formState.values[name] : value;
9075
+ const context = useMemo7(() => {
8952
9076
  return {
8953
- name,
8954
- onChange
9077
+ name: `${name}[]`,
9078
+ onChange,
9079
+ value: derivedValue
8955
9080
  };
8956
- }, [name, onChange]);
8957
- return /* @__PURE__ */ jsx216(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsx216(FormGroup, { ...props, children }) });
9081
+ }, [name, derivedValue, onChange]);
9082
+ return /* @__PURE__ */ jsx217(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsx217(FormGroup, { ...props, children }) });
8958
9083
  };
8959
9084
  CheckboxGroup.displayName = "CheckboxGroup";
8960
9085
 
8961
9086
  // src/components/Checkbox/Checkbox.tsx
8962
- import { jsx as jsx217, jsxs as jsxs17 } from "react/jsx-runtime";
8963
- var CheckIcon = () => /* @__PURE__ */ jsx217(
9087
+ import { jsx as jsx218, jsxs as jsxs17 } from "react/jsx-runtime";
9088
+ var CheckIcon = () => /* @__PURE__ */ jsx218(
8964
9089
  "svg",
8965
9090
  {
8966
9091
  fill: "inherit",
@@ -8968,7 +9093,7 @@ var CheckIcon = () => /* @__PURE__ */ jsx217(
8968
9093
  viewBox: "0 0 10 8",
8969
9094
  width: "10",
8970
9095
  xmlns: "http://www.w3.org/2000/svg",
8971
- children: /* @__PURE__ */ jsx217(
9096
+ children: /* @__PURE__ */ jsx218(
8972
9097
  "path",
8973
9098
  {
8974
9099
  d: "M3.47281 7.19303L0.377565 4.07999C0.191609 3.89297 0.191609 3.58973 0.377565 3.40268L1.05098 2.72537C1.23694 2.53833 1.53847 2.53833 1.72442 2.72537L3.80953 4.82245L8.27558 0.330729C8.46154 0.143704 8.76306 0.143704 8.94902 0.330729L9.62244 1.00804C9.8084 1.19506 9.8084 1.49831 9.62244 1.68535L4.14624 7.19305C3.96027 7.38008 3.65876 7.38008 3.47281 7.19303Z",
@@ -9015,14 +9140,14 @@ var getSizeCss = (size) => {
9015
9140
  if (size === "lg") return sizeLarge;
9016
9141
  return sizeMedium;
9017
9142
  };
9018
- var StyledCheckboxWrapper = styled26.div`
9143
+ var StyledCheckboxWrapper = styled27.div`
9019
9144
  display: flex;
9020
9145
  margin: 0;
9021
9146
 
9022
9147
  /* TODO this solves a problem but potentially causes and a11y issue */
9023
9148
  user-select: none;
9024
9149
  `;
9025
- var StyledCheckboxInput = styled26.div`
9150
+ var StyledCheckboxInput = styled27.div`
9026
9151
  ${({ $size }) => getSizeCss($size)}
9027
9152
  line-height: 0;
9028
9153
  margin: 0;
@@ -9044,7 +9169,7 @@ var StyledCheckboxInput = styled26.div`
9044
9169
  }
9045
9170
  }
9046
9171
  `;
9047
- var StyledHiddenCheckboxInput = styled26.input`
9172
+ var StyledHiddenCheckboxInput = styled27.input`
9048
9173
  ${visuallyHiddenStyle}
9049
9174
 
9050
9175
  /* toggles display of faux-input background-color */
@@ -9058,7 +9183,7 @@ var StyledHiddenCheckboxInput = styled26.input`
9058
9183
  display: block;
9059
9184
  }
9060
9185
  `;
9061
- var Checkbox = forwardRef11(
9186
+ var Checkbox = forwardRef12(
9062
9187
  ({
9063
9188
  checked,
9064
9189
  disabled = false,
@@ -9073,20 +9198,22 @@ var Checkbox = forwardRef11(
9073
9198
  hideLabel = false,
9074
9199
  ...props
9075
9200
  }, ref) => {
9076
- const generatedId = useId();
9201
+ const generatedId = useId2();
9077
9202
  const computedId = isNonEmptyString2(id) ? id : `wistia-ui-checkbox-${generatedId}`;
9078
9203
  const checkboxGroupContext = useCheckboxGroup();
9079
9204
  const contextName = checkboxGroupContext?.name;
9080
9205
  const contextOnChange = checkboxGroupContext?.onChange;
9206
+ const contextValue = checkboxGroupContext?.value;
9081
9207
  const checkboxName = name ?? contextName;
9082
9208
  const handleOnChange = onChange ?? contextOnChange;
9209
+ const defaultChecked = isNotUndefined7(value) && contextValue ? contextValue.includes(value) : void 0;
9083
9210
  return /* @__PURE__ */ jsxs17(StyledCheckboxWrapper, { disabled, children: [
9084
- /* @__PURE__ */ jsx217(
9211
+ /* @__PURE__ */ jsx218(
9085
9212
  StyledHiddenCheckboxInput,
9086
9213
  {
9087
9214
  ...props,
9088
9215
  ref,
9089
- checked,
9216
+ ...isNotUndefined7(defaultChecked) ? { defaultChecked } : { checked },
9090
9217
  disabled,
9091
9218
  id: computedId,
9092
9219
  name: checkboxName,
@@ -9096,16 +9223,16 @@ var Checkbox = forwardRef11(
9096
9223
  value
9097
9224
  }
9098
9225
  ),
9099
- /* @__PURE__ */ jsx217(
9226
+ /* @__PURE__ */ jsx218(
9100
9227
  FormControlLabel,
9101
9228
  {
9102
- controlSlot: /* @__PURE__ */ jsx217(
9229
+ controlSlot: /* @__PURE__ */ jsx218(
9103
9230
  StyledCheckboxInput,
9104
9231
  {
9105
9232
  $disabled: disabled,
9106
9233
  $size: size,
9107
9234
  "data-wui-faux-input": "true",
9108
- children: /* @__PURE__ */ jsx217(CheckIcon, {})
9235
+ children: /* @__PURE__ */ jsx218(CheckIcon, {})
9109
9236
  }
9110
9237
  ),
9111
9238
  description,
@@ -9166,9 +9293,9 @@ ClickRegion.displayName = "ClickRegion";
9166
9293
  // src/components/Collapsible/Collapsible.tsx
9167
9294
  import { Root as CollapsibleRoot } from "@radix-ui/react-collapsible";
9168
9295
  import { isNotNil as isNotNil16 } from "@wistia/type-guards";
9169
- import styled27 from "styled-components";
9170
- import { jsx as jsx218 } from "react/jsx-runtime";
9171
- var StyledRoot = styled27(CollapsibleRoot)`
9296
+ import styled28 from "styled-components";
9297
+ import { jsx as jsx219 } from "react/jsx-runtime";
9298
+ var StyledRoot = styled28(CollapsibleRoot)`
9172
9299
  &[data-state='closed'] [data-wui-collapsible-content] {
9173
9300
  display: -webkit-box;
9174
9301
  -webkit-box-orient: vertical;
@@ -9184,16 +9311,16 @@ var Collapsible = ({
9184
9311
  const controlProps = {
9185
9312
  ...isNotNil16(onOpenChange) && isNotNil16(isOpen) ? { open: isOpen, onOpenChange } : {}
9186
9313
  };
9187
- return /* @__PURE__ */ jsx218(StyledRoot, { ...controlProps, children });
9314
+ return /* @__PURE__ */ jsx219(StyledRoot, { ...controlProps, children });
9188
9315
  };
9189
9316
  Collapsible.displayName = "Collapsible";
9190
9317
 
9191
9318
  // src/components/Collapsible/CollapsibleTrigger.tsx
9192
9319
  import { Children as Children4 } from "react";
9193
9320
  import { Trigger } from "@radix-ui/react-collapsible";
9194
- import styled28 from "styled-components";
9195
- import { jsx as jsx219 } from "react/jsx-runtime";
9196
- var StyledTrigger = styled28(Trigger)`
9321
+ import styled29 from "styled-components";
9322
+ import { jsx as jsx220 } from "react/jsx-runtime";
9323
+ var StyledTrigger = styled29(Trigger)`
9197
9324
  [data-wui-collapsible-icon] {
9198
9325
  transition: transform var(--wui-motion-duration-03) ease-in-out;
9199
9326
  }
@@ -9216,11 +9343,11 @@ var StyledTrigger = styled28(Trigger)`
9216
9343
  `;
9217
9344
  var CollapsibleTrigger = ({ children }) => {
9218
9345
  Children4.only(children);
9219
- return /* @__PURE__ */ jsx219(StyledTrigger, { asChild: true, children });
9346
+ return /* @__PURE__ */ jsx220(StyledTrigger, { asChild: true, children });
9220
9347
  };
9221
9348
 
9222
9349
  // src/components/Collapsible/CollapsibleTriggerIcon.tsx
9223
- import { jsx as jsx220 } from "react/jsx-runtime";
9350
+ import { jsx as jsx221 } from "react/jsx-runtime";
9224
9351
  var iconRotationMap = {
9225
9352
  "caret-left-strong": "-90",
9226
9353
  "caret-left": "-90",
@@ -9229,7 +9356,7 @@ var iconRotationMap = {
9229
9356
  plus: "45"
9230
9357
  };
9231
9358
  var CollapsibleTriggerIcon = ({ type, ...props }) => {
9232
- return /* @__PURE__ */ jsx220(
9359
+ return /* @__PURE__ */ jsx221(
9233
9360
  Icon,
9234
9361
  {
9235
9362
  ...props,
@@ -9242,16 +9369,16 @@ var CollapsibleTriggerIcon = ({ type, ...props }) => {
9242
9369
  CollapsibleTriggerIcon.displayName = "CollapsibleTriggerIcon";
9243
9370
 
9244
9371
  // src/components/Collapsible/CollapsibleContent.tsx
9245
- import styled29 from "styled-components";
9372
+ import styled30 from "styled-components";
9246
9373
  import { Content } from "@radix-ui/react-collapsible";
9247
- import { isNotUndefined as isNotUndefined6 } from "@wistia/type-guards";
9248
- import { Fragment as Fragment4, jsx as jsx221, jsxs as jsxs18 } from "react/jsx-runtime";
9249
- var ClampedContent = styled29.div`
9374
+ import { isNotUndefined as isNotUndefined8 } from "@wistia/type-guards";
9375
+ import { Fragment as Fragment4, jsx as jsx222, jsxs as jsxs18 } from "react/jsx-runtime";
9376
+ var ClampedContent = styled30.div`
9250
9377
  --wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
9251
9378
  `;
9252
9379
  var CollapsibleContent = ({ clamp, children }) => {
9253
- if (isNotUndefined6(clamp)) {
9254
- return /* @__PURE__ */ jsx221(
9380
+ if (isNotUndefined8(clamp)) {
9381
+ return /* @__PURE__ */ jsx222(
9255
9382
  ClampedContent,
9256
9383
  {
9257
9384
  $clamp: clamp,
@@ -9260,7 +9387,7 @@ var CollapsibleContent = ({ clamp, children }) => {
9260
9387
  }
9261
9388
  );
9262
9389
  }
9263
- return /* @__PURE__ */ jsx221(Content, { children: /* @__PURE__ */ jsxs18(Fragment4, { children: [
9390
+ return /* @__PURE__ */ jsx222(Content, { children: /* @__PURE__ */ jsxs18(Fragment4, { children: [
9264
9391
  children,
9265
9392
  " "
9266
9393
  ] }) });
@@ -9269,23 +9396,23 @@ var CollapsibleContent = ({ clamp, children }) => {
9269
9396
  // src/components/Combobox/Combobox.tsx
9270
9397
  import * as Ariakit from "@ariakit/react";
9271
9398
  import {
9272
- useMemo as useMemo7,
9273
- useRef as useRef8,
9274
- useState as useState11,
9399
+ useMemo as useMemo8,
9400
+ useRef as useRef9,
9401
+ useState as useState12,
9275
9402
  useTransition,
9276
9403
  useEffect as useEffect10,
9277
9404
  Children as Children5,
9278
9405
  isValidElement as isValidElement2
9279
9406
  } from "react";
9280
9407
  import { matchSorter } from "match-sorter";
9281
- import styled31 from "styled-components";
9408
+ import styled32 from "styled-components";
9282
9409
 
9283
9410
  // src/components/Tag/Tag.tsx
9284
- import { forwardRef as forwardRef12 } from "react";
9285
- import styled30 from "styled-components";
9411
+ import { forwardRef as forwardRef13 } from "react";
9412
+ import styled31 from "styled-components";
9286
9413
  import { isNil as isNil13, isNotNil as isNotNil17, isNonEmptyString as isNonEmptyString3 } from "@wistia/type-guards";
9287
- import { Fragment as Fragment5, jsx as jsx222, jsxs as jsxs19 } from "react/jsx-runtime";
9288
- var TagLabel = styled30.a`
9414
+ import { Fragment as Fragment5, jsx as jsx223, jsxs as jsxs19 } from "react/jsx-runtime";
9415
+ var TagLabel = styled31.a`
9289
9416
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
9290
9417
  font-size: var(--wui-typography-label-4-size);
9291
9418
  font-weight: var(--wui-typography-label-4-weight);
@@ -9320,14 +9447,14 @@ var TagLabel = styled30.a`
9320
9447
  background: var(--wui-color-bg-surface-secondary-active);
9321
9448
  }
9322
9449
  `;
9323
- var TagDivider = styled30.div`
9450
+ var TagDivider = styled31.div`
9324
9451
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
9325
9452
  border-left: 1px solid var(--wui-color-border);
9326
9453
  display: flex;
9327
9454
  height: 14px;
9328
9455
  width: 1px;
9329
9456
  `;
9330
- var StyledRemoveButton = styled30.button`
9457
+ var StyledRemoveButton = styled31.button`
9331
9458
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
9332
9459
  all: unset;
9333
9460
  cursor: pointer;
@@ -9355,7 +9482,7 @@ var StyledRemoveButton = styled30.button`
9355
9482
  box-shadow: inset 0 0 0 2px var(--wui-color-border-secondary);
9356
9483
  }
9357
9484
  `;
9358
- var StyledTag = styled30.div`
9485
+ var StyledTag = styled31.div`
9359
9486
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
9360
9487
  align-items: center;
9361
9488
  background-color: var(--wui-color-bg-surface-secondary);
@@ -9377,7 +9504,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
9377
9504
  );
9378
9505
  }
9379
9506
  return /* @__PURE__ */ jsxs19(Fragment5, { children: [
9380
- /* @__PURE__ */ jsx222(TagDivider, { $colorScheme: colorScheme }),
9507
+ /* @__PURE__ */ jsx223(TagDivider, { $colorScheme: colorScheme }),
9381
9508
  /* @__PURE__ */ jsxs19(
9382
9509
  StyledRemoveButton,
9383
9510
  {
@@ -9385,20 +9512,20 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
9385
9512
  onClick: onClickRemove,
9386
9513
  type: "button",
9387
9514
  children: [
9388
- /* @__PURE__ */ jsx222(
9515
+ /* @__PURE__ */ jsx223(
9389
9516
  Icon,
9390
9517
  {
9391
9518
  size: "sm",
9392
9519
  type: "close"
9393
9520
  }
9394
9521
  ),
9395
- /* @__PURE__ */ jsx222(ScreenReaderOnly, { children: onClickRemoveLabel })
9522
+ /* @__PURE__ */ jsx223(ScreenReaderOnly, { children: onClickRemoveLabel })
9396
9523
  ]
9397
9524
  }
9398
9525
  )
9399
9526
  ] });
9400
9527
  };
9401
- var Tag = forwardRef12(
9528
+ var Tag = forwardRef13(
9402
9529
  ({ onClickRemove, colorScheme = "inherit", href, icon, label, onClickRemoveLabel, ...props }, ref) => {
9403
9530
  const hasIcon = isNotNil17(icon);
9404
9531
  const labelProps = isNotNil17(href) && isNonEmptyString3(href) ? { href, as: "a" } : { as: "span" };
@@ -9420,7 +9547,7 @@ var Tag = forwardRef12(
9420
9547
  ]
9421
9548
  }
9422
9549
  ),
9423
- /* @__PURE__ */ jsx222(
9550
+ /* @__PURE__ */ jsx223(
9424
9551
  RemoveButton,
9425
9552
  {
9426
9553
  colorScheme,
@@ -9463,8 +9590,8 @@ var inputCss = css26`
9463
9590
  `;
9464
9591
 
9465
9592
  // src/components/Combobox/Combobox.tsx
9466
- import { jsx as jsx223, jsxs as jsxs20 } from "react/jsx-runtime";
9467
- var ComboboxWapper = styled31.div`
9593
+ import { jsx as jsx224, jsxs as jsxs20 } from "react/jsx-runtime";
9594
+ var ComboboxWapper = styled32.div`
9468
9595
  ${inputCss};
9469
9596
  width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
9470
9597
  padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
@@ -9513,7 +9640,7 @@ var ComboboxWapper = styled31.div`
9513
9640
  }
9514
9641
  }
9515
9642
  `;
9516
- var ComboboxInput = styled31(Ariakit.Combobox)`
9643
+ var ComboboxInput = styled32(Ariakit.Combobox)`
9517
9644
  appearance: none;
9518
9645
  padding: 0;
9519
9646
  width: 100%;
@@ -9528,7 +9655,7 @@ var ComboboxInput = styled31(Ariakit.Combobox)`
9528
9655
  outline-width: 2px;
9529
9656
  }
9530
9657
  `;
9531
- var ComboboxPopover = styled31(Ariakit.Popover)`
9658
+ var ComboboxPopover = styled32(Ariakit.Popover)`
9532
9659
  --wui-combobox-content-border: var(--wui-color-border);
9533
9660
  --wui-combobox-content-bg: var(--wui-color-bg-surface);
9534
9661
  --wui-combobox-content-border-radius: var(--wui-border-radius-02);
@@ -9553,7 +9680,7 @@ var ComboboxPopover = styled31(Ariakit.Popover)`
9553
9680
  --item-opacity: 0.5;
9554
9681
  }
9555
9682
  `;
9556
- var ComboboxItem2 = styled31(Ariakit.ComboboxItem)`
9683
+ var ComboboxItem2 = styled32(Ariakit.ComboboxItem)`
9557
9684
  ${variantStyleMap2.body3};
9558
9685
  display: flex;
9559
9686
  padding: var(--wui-combobox-option-padding);
@@ -9578,12 +9705,12 @@ var ComboboxItem2 = styled31(Ariakit.ComboboxItem)`
9578
9705
  background-color: transparent;
9579
9706
  }
9580
9707
  `;
9581
- var NoResults = styled31.div`
9708
+ var NoResults = styled32.div`
9582
9709
  gap: var(--wui-space-02);
9583
9710
  `;
9584
9711
  var POPOVER_WIDTH_OFFSET = 20;
9585
9712
  var ComboboxOption = ({ value, children }) => {
9586
- return /* @__PURE__ */ jsx223(
9713
+ return /* @__PURE__ */ jsx224(
9587
9714
  ComboboxItem2,
9588
9715
  {
9589
9716
  className: "combobox-item",
@@ -9612,9 +9739,9 @@ var Combobox2 = ({
9612
9739
  fullWidth = true
9613
9740
  }) => {
9614
9741
  const [isPending, startTransition] = useTransition();
9615
- const [wrapperWidth, setWrapperWidth] = useState11("auto");
9616
- const comboboxWrapperRef = useRef8(null);
9617
- const options = useMemo7(() => extractOptions(children), [children]);
9742
+ const [wrapperWidth, setWrapperWidth] = useState12("auto");
9743
+ const comboboxWrapperRef = useRef9(null);
9744
+ const options = useMemo8(() => extractOptions(children), [children]);
9618
9745
  useEffect10(() => {
9619
9746
  const comboboxWrapper = comboboxWrapperRef.current;
9620
9747
  if (comboboxWrapper) {
@@ -9633,7 +9760,7 @@ var Combobox2 = ({
9633
9760
  const handleRemoveValue = (valueToRemove) => {
9634
9761
  onChange(value.filter((val) => val !== valueToRemove));
9635
9762
  };
9636
- const matches = useMemo7(() => {
9763
+ const matches = useMemo8(() => {
9637
9764
  return matchSorter(Object.keys(options), searchValue);
9638
9765
  }, [options, searchValue]);
9639
9766
  return /* @__PURE__ */ jsxs20(
@@ -9653,7 +9780,7 @@ var Combobox2 = ({
9653
9780
  ref: comboboxWrapperRef,
9654
9781
  $fullWidth: fullWidth,
9655
9782
  children: [
9656
- value.map((selectedValue) => /* @__PURE__ */ jsx223(
9783
+ value.map((selectedValue) => /* @__PURE__ */ jsx224(
9657
9784
  Tag,
9658
9785
  {
9659
9786
  href: "https://example.com",
@@ -9663,7 +9790,7 @@ var Combobox2 = ({
9663
9790
  },
9664
9791
  selectedValue
9665
9792
  )),
9666
- /* @__PURE__ */ jsx223(ComboboxInput, { placeholder })
9793
+ /* @__PURE__ */ jsx224(ComboboxInput, { placeholder })
9667
9794
  ]
9668
9795
  }
9669
9796
  ),
@@ -9684,7 +9811,7 @@ var Combobox2 = ({
9684
9811
  focusOnHover: true,
9685
9812
  value: match,
9686
9813
  children: [
9687
- /* @__PURE__ */ jsx223(
9814
+ /* @__PURE__ */ jsx224(
9688
9815
  Icon,
9689
9816
  {
9690
9817
  size: "sm",
@@ -9699,7 +9826,7 @@ var Combobox2 = ({
9699
9826
  },
9700
9827
  match
9701
9828
  )),
9702
- !matches.length && /* @__PURE__ */ jsx223(NoResults, { children: "No results found" })
9829
+ !matches.length && /* @__PURE__ */ jsx224(NoResults, { children: "No results found" })
9703
9830
  ]
9704
9831
  }
9705
9832
  )
@@ -9709,11 +9836,11 @@ var Combobox2 = ({
9709
9836
  };
9710
9837
 
9711
9838
  // src/components/DataCards/DataCard.tsx
9712
- import { useRef as useRef9 } from "react";
9713
- import styled32, { keyframes } from "styled-components";
9839
+ import { useRef as useRef10 } from "react";
9840
+ import styled33, { keyframes } from "styled-components";
9714
9841
  import { isNotNil as isNotNil18, isNotNull } from "@wistia/type-guards";
9715
- import { jsx as jsx224, jsxs as jsxs21 } from "react/jsx-runtime";
9716
- var StyledDataCard = styled32.div`
9842
+ import { jsx as jsx225, jsxs as jsxs21 } from "react/jsx-runtime";
9843
+ var StyledDataCard = styled33.div`
9717
9844
  display: grid;
9718
9845
  grid-template-areas: 'label slot' 'value value';
9719
9846
  grid-template-rows: auto auto;
@@ -9776,7 +9903,7 @@ var shimmer = keyframes`
9776
9903
  background-position: -200% 0;
9777
9904
  }
9778
9905
  `;
9779
- var LoadingBackground = styled32.div`
9906
+ var LoadingBackground = styled33.div`
9780
9907
  background: linear-gradient(
9781
9908
  90deg,
9782
9909
  var(--wui-color-bg-surface-tertiary) 25%,
@@ -9787,27 +9914,27 @@ var LoadingBackground = styled32.div`
9787
9914
  animation: ${shimmer} 1.5s infinite;
9788
9915
  border-radius: var(--wui-border-radius-01);
9789
9916
  `;
9790
- var StyledLoadingLabel = styled32(LoadingBackground)`
9917
+ var StyledLoadingLabel = styled33(LoadingBackground)`
9791
9918
  width: 80px;
9792
9919
  height: var(--wui-typography-heading-6-line-height);
9793
9920
  `;
9794
- var StyledLoadingValue = styled32(LoadingBackground)`
9921
+ var StyledLoadingValue = styled33(LoadingBackground)`
9795
9922
  width: 90%;
9796
9923
  height: var(--wui-typography-heading-3-line-height);
9797
9924
  `;
9798
- var StyledLabel2 = styled32(Heading)`
9925
+ var StyledLabel2 = styled33(Heading)`
9799
9926
  grid-area: label;
9800
9927
  `;
9801
- var StyledValue = styled32(Heading)`
9928
+ var StyledValue = styled33(Heading)`
9802
9929
  grid-area: value;
9803
9930
  `;
9804
- var StyledSlot = styled32.div`
9931
+ var StyledSlot = styled33.div`
9805
9932
  display: flex;
9806
9933
  justify-content: flex-end;
9807
9934
  grid-area: slot;
9808
9935
  align-self: center;
9809
9936
  `;
9810
- var StyledDataCardTrendContainer = styled32.div`
9937
+ var StyledDataCardTrendContainer = styled33.div`
9811
9938
  position: absolute;
9812
9939
  bottom: var(--wui-space-01);
9813
9940
  right: var(--wui-space-01);
@@ -9826,28 +9953,28 @@ var DataCardInner = ({
9826
9953
  $colorScheme: colorScheme,
9827
9954
  ...props,
9828
9955
  children: [
9829
- /* @__PURE__ */ jsx224(
9956
+ /* @__PURE__ */ jsx225(
9830
9957
  StyledLabel2,
9831
9958
  {
9832
9959
  renderAs: "dt",
9833
9960
  variant: "heading6",
9834
- children: isLoading ? /* @__PURE__ */ jsx224(StyledLoadingLabel, {}) : label
9961
+ children: isLoading ? /* @__PURE__ */ jsx225(StyledLoadingLabel, {}) : label
9835
9962
  }
9836
9963
  ),
9837
- /* @__PURE__ */ jsx224(
9964
+ /* @__PURE__ */ jsx225(
9838
9965
  StyledValue,
9839
9966
  {
9840
9967
  renderAs: "dd",
9841
9968
  variant: "heading3",
9842
- children: isLoading ? /* @__PURE__ */ jsx224(StyledLoadingValue, {}) : value
9969
+ children: isLoading ? /* @__PURE__ */ jsx225(StyledLoadingValue, {}) : value
9843
9970
  }
9844
9971
  ),
9845
- isNotNull(upperRightSlot) && !isLoading && /* @__PURE__ */ jsx224(StyledSlot, { children: upperRightSlot }),
9846
- isNotNull(trend) && !isLoading && /* @__PURE__ */ jsx224(StyledDataCardTrendContainer, { children: trend })
9972
+ isNotNull(upperRightSlot) && !isLoading && /* @__PURE__ */ jsx225(StyledSlot, { children: upperRightSlot }),
9973
+ isNotNull(trend) && !isLoading && /* @__PURE__ */ jsx225(StyledDataCardTrendContainer, { children: trend })
9847
9974
  ]
9848
9975
  }
9849
9976
  );
9850
- var DataCardArrowIcon = /* @__PURE__ */ jsx224(
9977
+ var DataCardArrowIcon = /* @__PURE__ */ jsx225(
9851
9978
  Icon,
9852
9979
  {
9853
9980
  "data-wui-data-card-hover-icon": true,
@@ -9855,14 +9982,14 @@ var DataCardArrowIcon = /* @__PURE__ */ jsx224(
9855
9982
  }
9856
9983
  );
9857
9984
  var DataCard = (props) => {
9858
- const ref = useRef9(null);
9985
+ const ref = useRef10(null);
9859
9986
  if (isNotNil18(props.href) || isNotNil18(props.onClick)) {
9860
- return /* @__PURE__ */ jsx224(ClickRegion, { targetRef: ref, children: /* @__PURE__ */ jsx224(
9987
+ return /* @__PURE__ */ jsx225(ClickRegion, { targetRef: ref, children: /* @__PURE__ */ jsx225(
9861
9988
  DataCardInner,
9862
9989
  {
9863
9990
  upperRightSlot: props.upperRightSlot ?? DataCardArrowIcon,
9864
9991
  ...props,
9865
- label: /* @__PURE__ */ jsx224(
9992
+ label: /* @__PURE__ */ jsx225(
9866
9993
  Button,
9867
9994
  {
9868
9995
  ref,
@@ -9877,14 +10004,14 @@ var DataCard = (props) => {
9877
10004
  }
9878
10005
  ) });
9879
10006
  }
9880
- return /* @__PURE__ */ jsx224(DataCardInner, { ...props });
10007
+ return /* @__PURE__ */ jsx225(DataCardInner, { ...props });
9881
10008
  };
9882
10009
  DataCard.displayName = "DataCard";
9883
10010
 
9884
10011
  // src/components/DataCards/DataCards.tsx
9885
- import styled33 from "styled-components";
9886
- import { jsx as jsx225 } from "react/jsx-runtime";
9887
- var StyledDataCards = styled33(Box)`
10012
+ import styled34 from "styled-components";
10013
+ import { jsx as jsx226 } from "react/jsx-runtime";
10014
+ var StyledDataCards = styled34(Box)`
9888
10015
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
9889
10016
  margin-top: 0; /* Remove default <dl> style */
9890
10017
  > * {
@@ -9898,7 +10025,7 @@ var DataCards = ({
9898
10025
  colorScheme = "inherit",
9899
10026
  ...props
9900
10027
  }) => {
9901
- return /* @__PURE__ */ jsx225(
10028
+ return /* @__PURE__ */ jsx226(
9902
10029
  StyledDataCards,
9903
10030
  {
9904
10031
  ...props,
@@ -9916,9 +10043,9 @@ var DataCards = ({
9916
10043
  DataCards.displayName = "DataCards";
9917
10044
 
9918
10045
  // src/components/DataCards/DataCardTrend.tsx
9919
- import styled34 from "styled-components";
9920
- import { jsx as jsx226, jsxs as jsxs22 } from "react/jsx-runtime";
9921
- var StyledDataCardTrend = styled34.div`
10046
+ import styled35 from "styled-components";
10047
+ import { jsx as jsx227, jsxs as jsxs22 } from "react/jsx-runtime";
10048
+ var StyledDataCardTrend = styled35.div`
9922
10049
  ${({ $outlook }) => getColorScheme($outlook === "positive" ? "success" : "error")};
9923
10050
  background: var(--wui-color-bg-app);
9924
10051
  border-radius: var(--wui-border-radius-rounded);
@@ -9934,7 +10061,7 @@ var DataCardTrend = ({
9934
10061
  ...props
9935
10062
  }) => {
9936
10063
  return /* @__PURE__ */ jsxs22(StyledDataCardTrend, { $outlook: outlook, children: [
9937
- /* @__PURE__ */ jsx226(
10064
+ /* @__PURE__ */ jsx227(
9938
10065
  Icon,
9939
10066
  {
9940
10067
  size: "md",
@@ -9942,7 +10069,7 @@ var DataCardTrend = ({
9942
10069
  ...props
9943
10070
  }
9944
10071
  ),
9945
- /* @__PURE__ */ jsx226(
10072
+ /* @__PURE__ */ jsx227(
9946
10073
  Text,
9947
10074
  {
9948
10075
  prominence: "secondary",
@@ -9954,8 +10081,8 @@ var DataCardTrend = ({
9954
10081
  };
9955
10082
 
9956
10083
  // src/components/Divider/Divider.tsx
9957
- import styled35, { css as css27 } from "styled-components";
9958
- import { jsx as jsx227 } from "react/jsx-runtime";
10084
+ import styled36, { css as css27 } from "styled-components";
10085
+ import { jsx as jsx228 } from "react/jsx-runtime";
9959
10086
  var horizontalBorderCss = css27`
9960
10087
  border-top-color: var(--wui-color-border);
9961
10088
  border-top-style: solid;
@@ -9969,7 +10096,7 @@ var verticalBorderCss = css27`
9969
10096
  min-height: 100%;
9970
10097
  width: 1px;
9971
10098
  `;
9972
- var DividerComponent = styled35.div`
10099
+ var DividerComponent = styled36.div`
9973
10100
  ${({ $orientation }) => {
9974
10101
  switch ($orientation) {
9975
10102
  case "vertical":
@@ -9981,7 +10108,7 @@ var DividerComponent = styled35.div`
9981
10108
  }}
9982
10109
  `;
9983
10110
  var Divider = ({ orientation = "horizontal", ...props }) => {
9984
- return /* @__PURE__ */ jsx227(
10111
+ return /* @__PURE__ */ jsx228(
9985
10112
  DividerComponent,
9986
10113
  {
9987
10114
  $orientation: orientation,
@@ -9994,8 +10121,8 @@ var Divider = ({ orientation = "horizontal", ...props }) => {
9994
10121
  Divider.displayName = "Divider";
9995
10122
 
9996
10123
  // src/components/EditableHeading/EditableHeading.tsx
9997
- import styled38, { css as css29 } from "styled-components";
9998
- import { useState as useState12, useRef as useRef11 } from "react";
10124
+ import styled39, { css as css29 } from "styled-components";
10125
+ import { useState as useState13, useRef as useRef12 } from "react";
9999
10126
 
10000
10127
  // src/components/Tooltip/Tooltip.tsx
10001
10128
  import {
@@ -10005,8 +10132,8 @@ import {
10005
10132
  Portal as TooltipPortal,
10006
10133
  Arrow as TooltipArrow
10007
10134
  } from "@radix-ui/react-tooltip";
10008
- import styled36, { keyframes as keyframes2 } from "styled-components";
10009
- import { jsx as jsx228, jsxs as jsxs23 } from "react/jsx-runtime";
10135
+ import styled37, { keyframes as keyframes2 } from "styled-components";
10136
+ import { jsx as jsx229, jsxs as jsxs23 } from "react/jsx-runtime";
10010
10137
  var hide = keyframes2`
10011
10138
  from {
10012
10139
  opacity: 1;
@@ -10055,7 +10182,7 @@ var slideRightAndFade = keyframes2`
10055
10182
  transform: translateX(0);
10056
10183
  }
10057
10184
  `;
10058
- var StyledContent = styled36(TooltipContent)`
10185
+ var StyledContent = styled37(TooltipContent)`
10059
10186
  --tooltip-font-family: var(--wui-typography-family-default);
10060
10187
  --tooltip-border-radius: var(--wui-border-radius-05);
10061
10188
  --tooltip-bg: var(--wui-color-bg-tooltip);
@@ -10123,15 +10250,15 @@ var Tooltip = ({
10123
10250
  delayDuration: delay,
10124
10251
  ...rootProps,
10125
10252
  children: [
10126
- /* @__PURE__ */ jsx228(TooltipTrigger, { asChild: true, children }),
10127
- /* @__PURE__ */ jsx228(TooltipPortal, { children: /* @__PURE__ */ jsxs23(
10253
+ /* @__PURE__ */ jsx229(TooltipTrigger, { asChild: true, children }),
10254
+ /* @__PURE__ */ jsx229(TooltipPortal, { children: /* @__PURE__ */ jsxs23(
10128
10255
  StyledContent,
10129
10256
  {
10130
10257
  side: direction,
10131
10258
  sideOffset: hideArrow ? VISUAL_OFFSET : VISUAL_OFFSET - 2,
10132
10259
  children: [
10133
10260
  content,
10134
- !hideArrow ? /* @__PURE__ */ jsx228(TooltipArrow, { asChild: true, children: /* @__PURE__ */ jsx228(
10261
+ !hideArrow ? /* @__PURE__ */ jsx229(TooltipArrow, { asChild: true, children: /* @__PURE__ */ jsx229(
10135
10262
  "svg",
10136
10263
  {
10137
10264
  fill: "var(--tooltip-bg)",
@@ -10140,7 +10267,7 @@ var Tooltip = ({
10140
10267
  viewBox: "0 0 12 8",
10141
10268
  width: "12",
10142
10269
  xmlns: "http://www.w3.org/2000/svg",
10143
- children: /* @__PURE__ */ jsx228("path", { d: "M6.8 6.93333C6.4 7.46667 5.6 7.46667 5.2 6.93333L-2.54292e-07 -1.04907e-06L12 0L6.8 6.93333Z" })
10270
+ children: /* @__PURE__ */ jsx229("path", { d: "M6.8 6.93333C6.4 7.46667 5.6 7.46667 5.2 6.93333L-2.54292e-07 -1.04907e-06L12 0L6.8 6.93333Z" })
10144
10271
  }
10145
10272
  ) }) : null
10146
10273
  ]
@@ -10153,10 +10280,10 @@ var Tooltip = ({
10153
10280
  Tooltip.displayName = "Tooltip";
10154
10281
 
10155
10282
  // src/components/Input/Input.tsx
10156
- import { forwardRef as forwardRef13, cloneElement as cloneElement4, useRef as useRef10 } from "react";
10157
- import styled37, { css as css28 } from "styled-components";
10283
+ import { forwardRef as forwardRef14, cloneElement as cloneElement4, useRef as useRef11 } from "react";
10284
+ import styled38, { css as css28 } from "styled-components";
10158
10285
  import { isNil as isNil14, isNotNil as isNotNil19, isRecord as isRecord4 } from "@wistia/type-guards";
10159
- import { jsx as jsx229, jsxs as jsxs24 } from "react/jsx-runtime";
10286
+ import { jsx as jsx230, jsxs as jsxs24 } from "react/jsx-runtime";
10160
10287
  var inputStyles = css28`
10161
10288
  ${inputCss}
10162
10289
  input,
@@ -10192,7 +10319,7 @@ var inputStyles = css28`
10192
10319
  }
10193
10320
  }
10194
10321
  `;
10195
- var StyledInputContainer = styled37.div`
10322
+ var StyledInputContainer = styled38.div`
10196
10323
  display: inline-flex;
10197
10324
  position: relative;
10198
10325
  ${inputStyles};
@@ -10259,7 +10386,7 @@ var StyledInputContainer = styled37.div`
10259
10386
  padding-right: 32px;
10260
10387
  }
10261
10388
  `;
10262
- var Input = forwardRef13(
10389
+ var Input = forwardRef14(
10263
10390
  ({
10264
10391
  fullWidth = true,
10265
10392
  monospace = false,
@@ -10269,14 +10396,14 @@ var Input = forwardRef13(
10269
10396
  rightIcon,
10270
10397
  ...props
10271
10398
  }, externalRef) => {
10272
- const internalRef = useRef10();
10399
+ const internalRef = useRef11();
10273
10400
  const ref = (
10274
10401
  // eslint-disable-next-line react-compiler/react-compiler
10275
10402
  isNotNil19(externalRef) && isRecord4(externalRef) && "current" in externalRef ? externalRef : internalRef
10276
10403
  );
10277
10404
  let leftIconToDisplay = leftIcon;
10278
10405
  if (isNil14(leftIcon) && type === "search") {
10279
- leftIconToDisplay = /* @__PURE__ */ jsx229(Icon, { type: "search" });
10406
+ leftIconToDisplay = /* @__PURE__ */ jsx230(Icon, { type: "search" });
10280
10407
  }
10281
10408
  if (isNotNil19(leftIconToDisplay)) {
10282
10409
  leftIconToDisplay = cloneElement4(leftIconToDisplay, {
@@ -10308,14 +10435,14 @@ var Input = forwardRef13(
10308
10435
  $monospace: monospace,
10309
10436
  children: [
10310
10437
  leftIconToDisplay ?? null,
10311
- type === "multiline" ? /* @__PURE__ */ jsx229(
10438
+ type === "multiline" ? /* @__PURE__ */ jsx230(
10312
10439
  "textarea",
10313
10440
  {
10314
10441
  ...props,
10315
10442
  ref,
10316
10443
  onFocus: handleFocus2
10317
10444
  }
10318
- ) : /* @__PURE__ */ jsx229(
10445
+ ) : /* @__PURE__ */ jsx230(
10319
10446
  "input",
10320
10447
  {
10321
10448
  ...props,
@@ -10333,8 +10460,8 @@ var Input = forwardRef13(
10333
10460
  Input.displayName = "Input";
10334
10461
 
10335
10462
  // src/components/EditableHeading/EditableHeading.tsx
10336
- import { Fragment as Fragment6, jsx as jsx230, jsxs as jsxs25 } from "react/jsx-runtime";
10337
- var StyledInput = styled38(Input)`
10463
+ import { Fragment as Fragment6, jsx as jsx231, jsxs as jsxs25 } from "react/jsx-runtime";
10464
+ var StyledInput = styled39(Input)`
10338
10465
  :not([rows]) {
10339
10466
  min-height: unset;
10340
10467
  }
@@ -10362,7 +10489,7 @@ var editableStyles = css29`
10362
10489
  cursor: pointer;
10363
10490
  }
10364
10491
  `;
10365
- var StyledHeading2 = styled38(Heading)`
10492
+ var StyledHeading2 = styled39(Heading)`
10366
10493
  width: 100%;
10367
10494
  border-radius: var(--wui-border-radius-02);
10368
10495
  padding: var(--wui-space-02);
@@ -10379,11 +10506,11 @@ var EditableHeading = ({
10379
10506
  __forceEditing = false,
10380
10507
  editingDisabled = false
10381
10508
  }) => {
10382
- const [isEditing, setIsEditing] = useState12(false);
10383
- const [value, setValue] = useState12(children);
10384
- const [previousValue, setPreviousValue] = useState12(children);
10385
- const [headingHeight, setHeadingHeight] = useState12("60");
10386
- const headingRef = useRef11(null);
10509
+ const [isEditing, setIsEditing] = useState13(false);
10510
+ const [value, setValue] = useState13(children);
10511
+ const [previousValue, setPreviousValue] = useState13(children);
10512
+ const [headingHeight, setHeadingHeight] = useState13("60");
10513
+ const headingRef = useRef12(null);
10387
10514
  const handleSetEditing = (editing) => {
10388
10515
  if (editingDisabled) return;
10389
10516
  if (editing && headingRef.current) {
@@ -10416,7 +10543,7 @@ var EditableHeading = ({
10416
10543
  handleSetEditing(false);
10417
10544
  }
10418
10545
  };
10419
- const HeadingComponent2 = /* @__PURE__ */ jsx230(
10546
+ const HeadingComponent2 = /* @__PURE__ */ jsx231(
10420
10547
  StyledHeading2,
10421
10548
  {
10422
10549
  ref: headingRef,
@@ -10430,7 +10557,7 @@ var EditableHeading = ({
10430
10557
  return HeadingComponent2;
10431
10558
  }
10432
10559
  if (isEditing || __forceEditing) {
10433
- return /* @__PURE__ */ jsx230(
10560
+ return /* @__PURE__ */ jsx231(
10434
10561
  StyledInput,
10435
10562
  {
10436
10563
  $height: headingHeight,
@@ -10449,8 +10576,8 @@ var EditableHeading = ({
10449
10576
  );
10450
10577
  }
10451
10578
  return /* @__PURE__ */ jsxs25(Fragment6, { children: [
10452
- /* @__PURE__ */ jsx230(Tooltip, { content: tooltipText, children: HeadingComponent2 }),
10453
- /* @__PURE__ */ jsx230(ScreenReaderOnly, { children: /* @__PURE__ */ jsx230(
10579
+ /* @__PURE__ */ jsx231(Tooltip, { content: tooltipText, children: HeadingComponent2 }),
10580
+ /* @__PURE__ */ jsx231(ScreenReaderOnly, { children: /* @__PURE__ */ jsx231(
10454
10581
  "button",
10455
10582
  {
10456
10583
  "aria-label": ariaLabel,
@@ -10461,110 +10588,6 @@ var EditableHeading = ({
10461
10588
  ] });
10462
10589
  };
10463
10590
 
10464
- // src/components/Form/Form.tsx
10465
- import { forwardRef as forwardRef14, useRef as useRef12, useMemo as useMemo8, createContext as createContext4, useState as useState13, useId as useId2 } from "react";
10466
- import styled39 from "styled-components";
10467
- import { isNotUndefined as isNotUndefined7, isUndefined as isUndefined3 } from "@wistia/type-guards";
10468
- import { jsx as jsx231 } from "react/jsx-runtime";
10469
- var StyledForm = styled39.form`
10470
- --form-default-width: 690px;
10471
-
10472
- max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
10473
- align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
10474
- `;
10475
- var FormContext = createContext4({
10476
- values: {},
10477
- errors: {},
10478
- hasSubmitted: false,
10479
- formId: "NO_FORM",
10480
- labelPosition: "block"
10481
- });
10482
- var FormComponent = ({
10483
- children,
10484
- action,
10485
- values = {},
10486
- labelPosition = "block",
10487
- validate,
10488
- fullWidth = false,
10489
- ...props
10490
- }, forwardedRef) => {
10491
- const [errors, setErrors] = useState13({});
10492
- const [hasSubmitted, setHasSubmitted] = useState13(false);
10493
- const innerRef = useRef12();
10494
- const ref = forwardedRef ?? innerRef;
10495
- const autoId = useId2();
10496
- const id = props.id ?? autoId;
10497
- const handleValidate = (nextFormData) => {
10498
- const nextData = Object.fromEntries(nextFormData.entries());
10499
- if (isUndefined3(validate)) {
10500
- return {};
10501
- }
10502
- return validate(nextData);
10503
- };
10504
- const handleBlur2 = (event) => {
10505
- if (props.onBlur) {
10506
- props.onBlur(event);
10507
- }
10508
- const formData = new FormData(event.currentTarget);
10509
- if (isNotUndefined7(validate)) {
10510
- handleValidate(formData);
10511
- }
10512
- };
10513
- const handleSubmit = (event) => {
10514
- event.preventDefault();
10515
- const formData = new FormData(event.currentTarget);
10516
- const nextErrors = handleValidate(formData);
10517
- const isValid = Object.keys(nextErrors).length === 0;
10518
- setErrors(nextErrors);
10519
- setHasSubmitted(true);
10520
- if (isValid && props.onSubmit) {
10521
- props.onSubmit(event);
10522
- }
10523
- if (isValid && action) {
10524
- void action(formData);
10525
- }
10526
- };
10527
- const handleReset = (event) => {
10528
- setErrors({});
10529
- setHasSubmitted(false);
10530
- if (props.onReset) {
10531
- props.onReset(event);
10532
- }
10533
- if (action) {
10534
- void action(null);
10535
- }
10536
- };
10537
- const context = useMemo8(() => {
10538
- return {
10539
- values,
10540
- errors,
10541
- hasSubmitted,
10542
- formId: id,
10543
- labelPosition
10544
- };
10545
- }, [labelPosition, values, errors, id, hasSubmitted]);
10546
- return (
10547
- // @ts-expect-error - generic context providers are a giant pain
10548
- /* @__PURE__ */ jsx231(FormContext.Provider, { value: context, children: /* @__PURE__ */ jsx231(
10549
- Stack,
10550
- {
10551
- ...props,
10552
- ref,
10553
- $fullWidth: fullWidth,
10554
- as: StyledForm,
10555
- gap: "space-05",
10556
- id,
10557
- onBlur: handleBlur2,
10558
- onReset: handleReset,
10559
- onSubmit: handleSubmit,
10560
- children
10561
- }
10562
- ) })
10563
- );
10564
- };
10565
- FormComponent.displayName = "Form";
10566
- var Form = forwardRef14(FormComponent);
10567
-
10568
10591
  // src/components/Form/useFormState.tsx
10569
10592
  import { useCallback as useCallback9, useState as useState14 } from "react";
10570
10593
  var useFormState = (action, initialData = {}) => {
@@ -10578,7 +10601,7 @@ var useFormState = (action, initialData = {}) => {
10578
10601
  setError(null);
10579
10602
  return;
10580
10603
  }
10581
- const nextData = Object.fromEntries(nextFormData.entries());
10604
+ const nextData = serializeFormData(nextFormData);
10582
10605
  setIsPending(true);
10583
10606
  try {
10584
10607
  const result = await action(data, nextData);
@@ -10603,7 +10626,7 @@ var useFormState = (action, initialData = {}) => {
10603
10626
 
10604
10627
  // src/components/Form/FormErrorSummary.tsx
10605
10628
  import { useContext as useContext4, useRef as useRef13 } from "react";
10606
- import { isArray, isNotUndefined as isNotUndefined8 } from "@wistia/type-guards";
10629
+ import { isArray as isArray2, isNotUndefined as isNotUndefined9 } from "@wistia/type-guards";
10607
10630
  import { jsx as jsx232, jsxs as jsxs26 } from "react/jsx-runtime";
10608
10631
  var ErrorItem = ({ name, error, formId }) => {
10609
10632
  return /* @__PURE__ */ jsx232("li", { children: /* @__PURE__ */ jsx232(Link, { href: `#${formId}-${name}`, children: error }) }, name);
@@ -10617,8 +10640,8 @@ var FormErrorSummary = ({ description }) => {
10617
10640
  }
10618
10641
  return /* @__PURE__ */ jsxs26("div", { ref, children: [
10619
10642
  /* @__PURE__ */ jsx232("p", { children: description }),
10620
- /* @__PURE__ */ jsx232("ul", { children: Object.entries(errors).filter(([, error]) => isNotUndefined8(error)).map(
10621
- ([name, error]) => isArray(error) ? error.map((err) => /* @__PURE__ */ jsx232(
10643
+ /* @__PURE__ */ jsx232("ul", { children: Object.entries(errors).filter(([, error]) => isNotUndefined9(error)).map(
10644
+ ([name, error]) => isArray2(error) ? error.map((err) => /* @__PURE__ */ jsx232(
10622
10645
  ErrorItem,
10623
10646
  {
10624
10647
  error: err,
@@ -10642,7 +10665,7 @@ var FormErrorSummary = ({ description }) => {
10642
10665
  // src/components/FormField/FormField.tsx
10643
10666
  import { Children as Children6, cloneElement as cloneElement5, useContext as useContext5 } from "react";
10644
10667
  import styled41 from "styled-components";
10645
- import { isArray as isArray2, isNotNil as isNotNil20, isNotUndefined as isNotUndefined9, isUndefined as isUndefined4 } from "@wistia/type-guards";
10668
+ import { isArray as isArray3, isNotNil as isNotNil20, isNotUndefined as isNotUndefined10, isUndefined as isUndefined4 } from "@wistia/type-guards";
10646
10669
 
10647
10670
  // src/components/Label/Label.tsx
10648
10671
  import styled40, { css as css30 } from "styled-components";
@@ -10745,7 +10768,7 @@ var StyledErrorList = styled41.ul`
10745
10768
  gap: var(--wui-space-01);
10746
10769
  `;
10747
10770
  var ErrorMessages = ({ errors, id }) => {
10748
- const isMultipleErrors = isArray2(errors);
10771
+ const isMultipleErrors = isArray3(errors);
10749
10772
  return isMultipleErrors ? /* @__PURE__ */ jsx234(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ jsx234(
10750
10773
  Text,
10751
10774
  {
@@ -10795,7 +10818,7 @@ var FormField = ({
10795
10818
  "aria-describedby": ariaDescribedby,
10796
10819
  ...props
10797
10820
  };
10798
- if (isUndefined4(value) && isNotUndefined9(defaultValue)) {
10821
+ if (isUndefined4(value) && isNotUndefined10(defaultValue)) {
10799
10822
  childProps = {
10800
10823
  ...childProps,
10801
10824
  defaultValue
@@ -10804,10 +10827,10 @@ var FormField = ({
10804
10827
  if (isNotNil20(checkboxGroup)) {
10805
10828
  const computedName = isNotNil20(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
10806
10829
  const handleChange = (event) => {
10807
- if (isNotUndefined9(props.onChange)) {
10830
+ if (isNotUndefined10(props.onChange)) {
10808
10831
  props.onChange(event);
10809
10832
  }
10810
- if (isNotUndefined9(checkboxGroup.onChange)) {
10833
+ if (isNotUndefined10(checkboxGroup.onChange)) {
10811
10834
  checkboxGroup.onChange(event);
10812
10835
  }
10813
10836
  };
@@ -10858,12 +10881,15 @@ var RadioGroup = ({
10858
10881
  value,
10859
10882
  ...props
10860
10883
  }) => {
10884
+ const formState = useContext6(FormContext);
10885
+ const derivedValue = typeof formState.values[name] === "string" ? formState.values[name] : value;
10861
10886
  const context = useMemo9(() => {
10862
10887
  return {
10863
10888
  name,
10864
- onChange
10889
+ onChange,
10890
+ value: derivedValue
10865
10891
  };
10866
- }, [name, onChange]);
10892
+ }, [name, derivedValue, onChange]);
10867
10893
  return /* @__PURE__ */ jsx235(RadioGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsx235(FormGroup, { ...props, children }) });
10868
10894
  };
10869
10895
  RadioGroup.displayName = "RadioGroup";
@@ -11207,7 +11233,7 @@ import {
11207
11233
  DropdownMenuPortal,
11208
11234
  DropdownMenuContent
11209
11235
  } from "@radix-ui/react-dropdown-menu";
11210
- import { isNotNil as isNotNil23, isNotUndefined as isNotUndefined10 } from "@wistia/type-guards";
11236
+ import { isNotNil as isNotNil23, isNotUndefined as isNotUndefined11 } from "@wistia/type-guards";
11211
11237
  import { useMemo as useMemo10 } from "react";
11212
11238
 
11213
11239
  // src/components/Menu/MenuContext.tsx
@@ -11333,7 +11359,7 @@ var Menu = ({
11333
11359
  modal: false,
11334
11360
  ...controlProps,
11335
11361
  children: [
11336
- /* @__PURE__ */ jsx240(DropdownMenuTrigger, { asChild: true, children: isNotUndefined10(trigger) ? trigger : /* @__PURE__ */ jsx240(
11362
+ /* @__PURE__ */ jsx240(DropdownMenuTrigger, { asChild: true, children: isNotUndefined11(trigger) ? trigger : /* @__PURE__ */ jsx240(
11337
11363
  Button,
11338
11364
  {
11339
11365
  "aria-expanded": isOpen,
@@ -11407,7 +11433,7 @@ import { isNotNil as isNotNil25 } from "@wistia/type-guards";
11407
11433
  // src/components/Menu/MenuItemButton.tsx
11408
11434
  import { forwardRef as forwardRef16 } from "react";
11409
11435
  import styled48 from "styled-components";
11410
- import { isNotNil as isNotNil24, isNotUndefined as isNotUndefined11 } from "@wistia/type-guards";
11436
+ import { isNotNil as isNotNil24, isNotUndefined as isNotUndefined12 } from "@wistia/type-guards";
11411
11437
  import { jsx as jsx242, jsxs as jsxs31 } from "react/jsx-runtime";
11412
11438
  var StyledButton3 = styled48(Button)`
11413
11439
  ${({ colorScheme }) => getColorScheme(colorScheme)};
@@ -11485,7 +11511,7 @@ var StyledBadgeContainer = styled48.div`
11485
11511
  var MenuItemButton = forwardRef16(({ children, appearance, command, icon, ...props }, ref) => {
11486
11512
  let { colorScheme, badge } = props;
11487
11513
  if (appearance === "dangerous") {
11488
- if (isNotUndefined11(colorScheme)) {
11514
+ if (isNotUndefined12(colorScheme)) {
11489
11515
  console.warn("colorScheme prop is ignored when appearance is dangerous");
11490
11516
  }
11491
11517
  colorScheme = "error";
@@ -12321,7 +12347,7 @@ ProgressBar.displayName = "ProgressBar";
12321
12347
  // src/components/Radio/Radio.tsx
12322
12348
  import { forwardRef as forwardRef21, useId as useId3 } from "react";
12323
12349
  import styled59, { css as css36 } from "styled-components";
12324
- import { isNonEmptyString as isNonEmptyString4 } from "@wistia/type-guards";
12350
+ import { isNonEmptyString as isNonEmptyString4, isNotUndefined as isNotUndefined13 } from "@wistia/type-guards";
12325
12351
  import { jsx as jsx257, jsxs as jsxs39 } from "react/jsx-runtime";
12326
12352
  var RadioIcon = () => /* @__PURE__ */ jsx257(
12327
12353
  "svg",
@@ -12442,8 +12468,10 @@ var Radio = forwardRef21(
12442
12468
  const radioGroupContext = useRadioGroup();
12443
12469
  const contextName = radioGroupContext?.name;
12444
12470
  const contextOnChange = radioGroupContext?.onChange;
12471
+ const contextValue = radioGroupContext?.value;
12445
12472
  const radioName = name ?? contextName;
12446
12473
  const handleOnChange = onChange ?? contextOnChange;
12474
+ const defaultChecked = isNotUndefined13(value) && isNotUndefined13(contextValue) ? contextValue.includes(value) : void 0;
12447
12475
  return /* @__PURE__ */ jsxs39(
12448
12476
  StyledRadioWrapper,
12449
12477
  {
@@ -12455,14 +12483,14 @@ var Radio = forwardRef21(
12455
12483
  {
12456
12484
  ...props,
12457
12485
  ref,
12458
- checked,
12459
12486
  disabled,
12460
12487
  id: computedId,
12461
12488
  name: radioName,
12462
12489
  onChange: handleOnChange,
12463
12490
  required,
12464
12491
  type: "radio",
12465
- value
12492
+ value,
12493
+ ...isNotUndefined13(defaultChecked) ? { defaultChecked } : { checked }
12466
12494
  }
12467
12495
  ),
12468
12496
  /* @__PURE__ */ jsx257(