@wistia/ui 0.6.20-beta.f693d494.df8ca33 → 0.6.21

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.d.mts CHANGED
@@ -439,6 +439,7 @@ declare const ActionButton: react.ForwardRefExoticComponent<(Omit<{
439
439
 
440
440
  type AvatarInstanceType = 'image' | 'initials';
441
441
  type AvatarImageLoadStateType = 'error' | 'loaded' | 'loading';
442
+ type AvatarSizeType = 'lg' | 'md' | 'sm';
442
443
  type AvatarStatus = {
443
444
  type: AvatarInstanceType;
444
445
  state: AvatarImageLoadStateType;
@@ -461,7 +462,7 @@ type AvatarProps = ComponentPropsWithoutRef<'div'> & {
461
462
  /**
462
463
  * A predefined size for the avatar
463
464
  */
464
- size?: 'lg' | 'md' | 'sm';
465
+ size?: AvatarSizeType;
465
466
  /**
466
467
  * A callback that is invoked after the image has loaded or failed to load
467
468
  */
@@ -826,7 +827,8 @@ declare const Card: {
826
827
  displayName: string;
827
828
  };
828
829
 
829
- type CheckboxProps = Omit<ComponentPropsWithRef<'input'>, 'onChange'> & {
830
+ type CheckboxSizeType = 'lg' | 'md' | 'sm';
831
+ declare const Checkbox: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "size"> & {
830
832
  /**
831
833
  * Indicates the state of the checkbox
832
834
  */
@@ -855,12 +857,19 @@ type CheckboxProps = Omit<ComponentPropsWithRef<'input'>, 'onChange'> & {
855
857
  * Callback function invoked when the value changes
856
858
  */
857
859
  onChange?: (event: ChangeEvent) => unknown;
860
+ /**
861
+ * Indicates if the input is required
862
+ */
863
+ required?: boolean;
864
+ /**
865
+ * A predefined size for the checkbox
866
+ */
867
+ size?: CheckboxSizeType;
858
868
  /**
859
869
  * The value given as data when submitted with a `name`.
860
870
  */
861
871
  value?: string;
862
- };
863
- declare const Checkbox: react.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
872
+ } & react.RefAttributes<HTMLInputElement>>;
864
873
 
865
874
  type ClickRegionProps = {
866
875
  /**
@@ -2238,7 +2247,8 @@ declare const ProgressBar: {
2238
2247
  displayName: string;
2239
2248
  };
2240
2249
 
2241
- type RadioProps = ComponentPropsWithoutRef<'input'> & {
2250
+ type RadioSizeType = 'lg' | 'md' | 'sm';
2251
+ type RadioProps = Omit<ComponentPropsWithoutRef<'input'>, 'onChange' | 'size'> & {
2242
2252
  /**
2243
2253
  * Indicates the state of the radio
2244
2254
  */
@@ -2272,12 +2282,20 @@ type RadioProps = ComponentPropsWithoutRef<'input'> & {
2272
2282
  * Callback function invoked when the value changes
2273
2283
  */
2274
2284
  onChange?: (event: ChangeEvent) => unknown;
2285
+ /**
2286
+ * Indicates if the input is required
2287
+ */
2288
+ required?: boolean;
2289
+ /**
2290
+ * A predefined size for the radio
2291
+ */
2292
+ size?: RadioSizeType;
2275
2293
  /**
2276
2294
  * The value attribute of the input
2277
2295
  */
2278
2296
  value?: string;
2279
2297
  };
2280
- declare const Radio: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
2298
+ declare const Radio: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "size"> & {
2281
2299
  /**
2282
2300
  * Indicates the state of the radio
2283
2301
  */
@@ -2311,6 +2329,14 @@ declare const Radio: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProp
2311
2329
  * Callback function invoked when the value changes
2312
2330
  */
2313
2331
  onChange?: (event: ChangeEvent) => unknown;
2332
+ /**
2333
+ * Indicates if the input is required
2334
+ */
2335
+ required?: boolean;
2336
+ /**
2337
+ * A predefined size for the radio
2338
+ */
2339
+ size?: RadioSizeType;
2314
2340
  /**
2315
2341
  * The value attribute of the input
2316
2342
  */
@@ -2663,6 +2689,10 @@ type TagProps = ComponentPropsWithoutRef<'div'> & {
2663
2689
  * Valid URL for the `Tag` label to link to
2664
2690
  */
2665
2691
  href?: string;
2692
+ /**
2693
+ * Optional icon to display before the label
2694
+ */
2695
+ icon?: JSX.Element | undefined;
2666
2696
  /**
2667
2697
  * Text label for the `Tag`
2668
2698
  */
@@ -2688,6 +2718,10 @@ declare const Tag: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<
2688
2718
  * Valid URL for the `Tag` label to link to
2689
2719
  */
2690
2720
  href?: string;
2721
+ /**
2722
+ * Optional icon to display before the label
2723
+ */
2724
+ icon?: JSX.Element | undefined;
2691
2725
  /**
2692
2726
  * Text label for the `Tag`
2693
2727
  */
package/dist/index.d.ts CHANGED
@@ -439,6 +439,7 @@ declare const ActionButton: react.ForwardRefExoticComponent<(Omit<{
439
439
 
440
440
  type AvatarInstanceType = 'image' | 'initials';
441
441
  type AvatarImageLoadStateType = 'error' | 'loaded' | 'loading';
442
+ type AvatarSizeType = 'lg' | 'md' | 'sm';
442
443
  type AvatarStatus = {
443
444
  type: AvatarInstanceType;
444
445
  state: AvatarImageLoadStateType;
@@ -461,7 +462,7 @@ type AvatarProps = ComponentPropsWithoutRef<'div'> & {
461
462
  /**
462
463
  * A predefined size for the avatar
463
464
  */
464
- size?: 'lg' | 'md' | 'sm';
465
+ size?: AvatarSizeType;
465
466
  /**
466
467
  * A callback that is invoked after the image has loaded or failed to load
467
468
  */
@@ -826,7 +827,8 @@ declare const Card: {
826
827
  displayName: string;
827
828
  };
828
829
 
829
- type CheckboxProps = Omit<ComponentPropsWithRef<'input'>, 'onChange'> & {
830
+ type CheckboxSizeType = 'lg' | 'md' | 'sm';
831
+ declare const Checkbox: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "size"> & {
830
832
  /**
831
833
  * Indicates the state of the checkbox
832
834
  */
@@ -855,12 +857,19 @@ type CheckboxProps = Omit<ComponentPropsWithRef<'input'>, 'onChange'> & {
855
857
  * Callback function invoked when the value changes
856
858
  */
857
859
  onChange?: (event: ChangeEvent) => unknown;
860
+ /**
861
+ * Indicates if the input is required
862
+ */
863
+ required?: boolean;
864
+ /**
865
+ * A predefined size for the checkbox
866
+ */
867
+ size?: CheckboxSizeType;
858
868
  /**
859
869
  * The value given as data when submitted with a `name`.
860
870
  */
861
871
  value?: string;
862
- };
863
- declare const Checkbox: react.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
872
+ } & react.RefAttributes<HTMLInputElement>>;
864
873
 
865
874
  type ClickRegionProps = {
866
875
  /**
@@ -2238,7 +2247,8 @@ declare const ProgressBar: {
2238
2247
  displayName: string;
2239
2248
  };
2240
2249
 
2241
- type RadioProps = ComponentPropsWithoutRef<'input'> & {
2250
+ type RadioSizeType = 'lg' | 'md' | 'sm';
2251
+ type RadioProps = Omit<ComponentPropsWithoutRef<'input'>, 'onChange' | 'size'> & {
2242
2252
  /**
2243
2253
  * Indicates the state of the radio
2244
2254
  */
@@ -2272,12 +2282,20 @@ type RadioProps = ComponentPropsWithoutRef<'input'> & {
2272
2282
  * Callback function invoked when the value changes
2273
2283
  */
2274
2284
  onChange?: (event: ChangeEvent) => unknown;
2285
+ /**
2286
+ * Indicates if the input is required
2287
+ */
2288
+ required?: boolean;
2289
+ /**
2290
+ * A predefined size for the radio
2291
+ */
2292
+ size?: RadioSizeType;
2275
2293
  /**
2276
2294
  * The value attribute of the input
2277
2295
  */
2278
2296
  value?: string;
2279
2297
  };
2280
- declare const Radio: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
2298
+ declare const Radio: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "size"> & {
2281
2299
  /**
2282
2300
  * Indicates the state of the radio
2283
2301
  */
@@ -2311,6 +2329,14 @@ declare const Radio: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProp
2311
2329
  * Callback function invoked when the value changes
2312
2330
  */
2313
2331
  onChange?: (event: ChangeEvent) => unknown;
2332
+ /**
2333
+ * Indicates if the input is required
2334
+ */
2335
+ required?: boolean;
2336
+ /**
2337
+ * A predefined size for the radio
2338
+ */
2339
+ size?: RadioSizeType;
2314
2340
  /**
2315
2341
  * The value attribute of the input
2316
2342
  */
@@ -2663,6 +2689,10 @@ type TagProps = ComponentPropsWithoutRef<'div'> & {
2663
2689
  * Valid URL for the `Tag` label to link to
2664
2690
  */
2665
2691
  href?: string;
2692
+ /**
2693
+ * Optional icon to display before the label
2694
+ */
2695
+ icon?: JSX.Element | undefined;
2666
2696
  /**
2667
2697
  * Text label for the `Tag`
2668
2698
  */
@@ -2688,6 +2718,10 @@ declare const Tag: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<
2688
2718
  * Valid URL for the `Tag` label to link to
2689
2719
  */
2690
2720
  href?: string;
2721
+ /**
2722
+ * Optional icon to display before the label
2723
+ */
2724
+ icon?: JSX.Element | undefined;
2691
2725
  /**
2692
2726
  * Text label for the `Tag`
2693
2727
  */
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.6.20-beta.f693d494.df8ca33
3
+ * @license @wistia/ui v0.6.21
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -7531,12 +7531,24 @@ var disabledStyle3 = css20`
7531
7531
  cursor: not-allowed;
7532
7532
  opacity: 0.5;
7533
7533
  `;
7534
+ var inputSizeSmall = css20`
7535
+ width: 14px;
7536
+ height: 14px;
7537
+ min-width: 14px;
7538
+ min-height: 14px;
7539
+ `;
7534
7540
  var inputSizeMedium = css20`
7535
7541
  width: 16px;
7536
7542
  height: 16px;
7537
7543
  min-width: 16px;
7538
7544
  min-height: 16px;
7539
7545
  `;
7546
+ var inputSizeLarge = css20`
7547
+ width: 20px;
7548
+ height: 20px;
7549
+ min-width: 20px;
7550
+ min-height: 20px;
7551
+ `;
7540
7552
  var StyledCheckboxWrapper = styled17.div`
7541
7553
  display: flex;
7542
7554
  margin: 0;
@@ -7546,9 +7558,13 @@ var StyledCheckboxWrapper = styled17.div`
7546
7558
 
7547
7559
  ${({ disabled }) => disabled && disabledStyle3};
7548
7560
  `;
7561
+ var getSizeCss = (size) => {
7562
+ if (size === "sm") return inputSizeSmall;
7563
+ if (size === "lg") return inputSizeLarge;
7564
+ return inputSizeMedium;
7565
+ };
7549
7566
  var StyledCheckboxInput = styled17.div`
7550
- /* TODO prop-ify sizes */
7551
- ${inputSizeMedium}
7567
+ ${({ $size }) => getSizeCss($size)}
7552
7568
  line-height: 0;
7553
7569
  margin: 0;
7554
7570
  border: 1px solid var(--wui-color-border);
@@ -7580,7 +7596,19 @@ var StyledHiddenCheckboxInput = styled17.input`
7580
7596
  }
7581
7597
  `;
7582
7598
  var Checkbox = forwardRef6(
7583
- ({ checked, disabled = false, id, label, description, name, onChange, value, ...props }, ref) => {
7599
+ ({
7600
+ checked,
7601
+ disabled = false,
7602
+ id,
7603
+ label,
7604
+ description,
7605
+ name,
7606
+ onChange,
7607
+ size = "md",
7608
+ value,
7609
+ required = false,
7610
+ ...props
7611
+ }, ref) => {
7584
7612
  const generatedId = useId();
7585
7613
  const computedId = isNonEmptyString2(id) ? id : `wistia-ui-checkbox-${generatedId}`;
7586
7614
  return /* @__PURE__ */ jsxs13(
@@ -7599,6 +7627,7 @@ var Checkbox = forwardRef6(
7599
7627
  id: computedId,
7600
7628
  name,
7601
7629
  onChange,
7630
+ required,
7602
7631
  type: "checkbox",
7603
7632
  value
7604
7633
  }
@@ -7606,7 +7635,14 @@ var Checkbox = forwardRef6(
7606
7635
  /* @__PURE__ */ jsx201(
7607
7636
  FormControlLabel,
7608
7637
  {
7609
- controlSlot: /* @__PURE__ */ jsx201(StyledCheckboxInput, { "data-wui-faux-input": "true", children: /* @__PURE__ */ jsx201(CheckIcon, {}) }),
7638
+ controlSlot: /* @__PURE__ */ jsx201(
7639
+ StyledCheckboxInput,
7640
+ {
7641
+ $size: size,
7642
+ "data-wui-faux-input": "true",
7643
+ children: /* @__PURE__ */ jsx201(CheckIcon, {})
7644
+ }
7645
+ ),
7610
7646
  description,
7611
7647
  htmlFor: computedId,
7612
7648
  label
@@ -10261,13 +10297,33 @@ var StyledHiddenRadioInput = styled49.input`
10261
10297
  display: block;
10262
10298
  }
10263
10299
  `;
10264
- var StyledRadioInput = styled49.div`
10265
- line-height: 0;
10266
- margin: 0;
10300
+ var inputSizeSmall2 = css30`
10301
+ width: 14px;
10302
+ height: 14px;
10303
+ min-width: 14px;
10304
+ min-height: 14px;
10305
+ `;
10306
+ var inputSizeMedium2 = css30`
10267
10307
  width: 16px;
10268
- min-width: 16px;
10269
10308
  height: 16px;
10309
+ min-width: 16px;
10270
10310
  min-height: 16px;
10311
+ `;
10312
+ var inputSizeLarge2 = css30`
10313
+ width: 20px;
10314
+ height: 20px;
10315
+ min-width: 20px;
10316
+ min-height: 20px;
10317
+ `;
10318
+ var getSizeCss2 = (size) => {
10319
+ if (size === "sm") return inputSizeSmall2;
10320
+ if (size === "lg") return inputSizeLarge2;
10321
+ return inputSizeMedium2;
10322
+ };
10323
+ var StyledRadioInput = styled49.div`
10324
+ ${({ $size }) => getSizeCss2($size)}
10325
+ line-height: 0;
10326
+ margin: 0;
10271
10327
  border: 1px solid var(--wui-color-border);
10272
10328
  border-radius: 50%; /* TODO --wui-border-radius-rounded */
10273
10329
  background-color: var(--wui-color-bg-fill-white);
@@ -10305,7 +10361,9 @@ var Radio = forwardRef18(
10305
10361
  description,
10306
10362
  name,
10307
10363
  onChange,
10364
+ size = "md",
10308
10365
  value = "false",
10366
+ required = false,
10309
10367
  ...props
10310
10368
  }, ref) => {
10311
10369
  const generatedId = useId3();
@@ -10326,6 +10384,7 @@ var Radio = forwardRef18(
10326
10384
  id: computedId,
10327
10385
  name,
10328
10386
  onChange,
10387
+ required,
10329
10388
  type: "radio",
10330
10389
  value
10331
10390
  }
@@ -10333,7 +10392,14 @@ var Radio = forwardRef18(
10333
10392
  /* @__PURE__ */ jsx241(
10334
10393
  FormControlLabel,
10335
10394
  {
10336
- controlSlot: /* @__PURE__ */ jsx241(StyledRadioInput, { "data-wui-faux-input": "true", children: /* @__PURE__ */ jsx241(RadioIcon, {}) }),
10395
+ controlSlot: /* @__PURE__ */ jsx241(
10396
+ StyledRadioInput,
10397
+ {
10398
+ $size: size,
10399
+ "data-wui-faux-input": "true",
10400
+ children: /* @__PURE__ */ jsx241(RadioIcon, {})
10401
+ }
10402
+ ),
10337
10403
  description,
10338
10404
  htmlFor: computedId,
10339
10405
  label
@@ -11254,10 +11320,17 @@ var TagLabel = styled67.a`
11254
11320
  font-weight: var(--wui-typography-label-4-weight);
11255
11321
  line-height: var(--wui-typography-label-4-line-height);
11256
11322
  border-radius: var(--wui-border-radius-01);
11323
+ display: flex;
11257
11324
  align-items: center;
11258
11325
  color: var(--wui-color-text);
11259
11326
  text-decoration: none;
11260
11327
  padding: var(--wui-space-01);
11328
+ gap: var(--wui-space-01);
11329
+
11330
+ svg {
11331
+ height: 12px;
11332
+ width: 12px;
11333
+ }
11261
11334
 
11262
11335
  :not(:only-child) {
11263
11336
  padding-right: var(--wui-space-01);
@@ -11355,7 +11428,16 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
11355
11428
  ] });
11356
11429
  };
11357
11430
  var Tag = forwardRef26(
11358
- ({ onClickRemove, colorScheme = "inherit", href, label, onClickRemoveLabel, ...otherProps }, ref) => {
11431
+ ({
11432
+ onClickRemove,
11433
+ colorScheme = "inherit",
11434
+ href,
11435
+ icon,
11436
+ label,
11437
+ onClickRemoveLabel,
11438
+ ...otherProps
11439
+ }, ref) => {
11440
+ const hasIcon = isNotNil25(icon);
11359
11441
  const labelProps = isNotNil25(href) && isNonEmptyString4(href) ? { href, as: "a" } : { as: "span" };
11360
11442
  return /* @__PURE__ */ jsxs40(
11361
11443
  StyledTag,
@@ -11364,12 +11446,15 @@ var Tag = forwardRef26(
11364
11446
  $colorScheme: colorScheme,
11365
11447
  ...otherProps,
11366
11448
  children: [
11367
- /* @__PURE__ */ jsx259(
11449
+ /* @__PURE__ */ jsxs40(
11368
11450
  TagLabel,
11369
11451
  {
11370
11452
  ...labelProps,
11371
11453
  $colorScheme: colorScheme,
11372
- children: label
11454
+ children: [
11455
+ hasIcon ? icon : null,
11456
+ label
11457
+ ]
11373
11458
  }
11374
11459
  ),
11375
11460
  /* @__PURE__ */ jsx259(