@wistia/ui 0.18.0-beta.782f3b36.e196b15 → 0.18.0-beta.978703a9.78cdfd1

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
@@ -430,7 +430,7 @@ declare const Button: react.ForwardRefExoticComponent<(Omit<BaseButtonProps & Om
430
430
 
431
431
  type ToastProps = ComponentPropsWithoutRef<'div'> & {
432
432
  /**
433
- * Action can be undefined (default dismiss button), a Button component or false to hide the dismiss button
433
+ * Action can be passed a Button component for a custom button to be displayed in the toast
434
434
  */
435
435
  action?: React.ReactElement<typeof Button> | undefined;
436
436
  /**
@@ -445,10 +445,15 @@ type ToastProps = ComponentPropsWithoutRef<'div'> & {
445
445
  * The message displayed in the toast
446
446
  */
447
447
  message: ReactNode;
448
+ /**
449
+ * @ignore
450
+ * The ID given for the Toast by sonner
451
+ */
452
+ toastId?: string;
448
453
  };
449
454
 
450
455
  type Position = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
451
- type UseToastProps = ToastProps & {
456
+ type UseToastProps = Omit<ToastProps, 'toastId'> & {
452
457
  position?: Position;
453
458
  duration?: number;
454
459
  };
@@ -711,18 +716,11 @@ type AlignContentType =
711
716
  | 'center'
712
717
  | 'flex-end'
713
718
  | 'flex-start'
714
- | 'normal'
715
719
  | 'space-around'
716
720
  | 'space-between'
717
721
  | 'stretch';
718
722
 
719
- type AlignItemsType =
720
- | 'baseline'
721
- | 'center'
722
- | 'flex-end'
723
- | 'flex-start'
724
- | 'normal'
725
- | 'stretch';
723
+ type AlignItemsType = 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch';
726
724
 
727
725
  type AlignSelfType = 'auto' | 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch';
728
726
 
@@ -1048,7 +1046,7 @@ type CardProps = BoxProps & ComponentPropsWithoutRef<'div'> & {
1048
1046
  * Cards can be used to visually distinguish content sections. Extends the [Box component.](https://wistia.github.io/vhs/storybook-ui/?path=/docs/components-box--docs)
1049
1047
  */
1050
1048
  declare const Card: {
1051
- ({ children, alignItems, border, borderRadius, colorScheme, direction, gap, height, paddingSize, prominence, width, ...props }: CardProps): JSX$1.Element;
1049
+ ({ children, border, borderRadius, colorScheme, direction, gap, height, paddingSize, prominence, width, ...props }: CardProps): JSX$1.Element;
1052
1050
  displayName: string;
1053
1051
  };
1054
1052
 
package/dist/index.d.ts CHANGED
@@ -430,7 +430,7 @@ declare const Button: react.ForwardRefExoticComponent<(Omit<BaseButtonProps & Om
430
430
 
431
431
  type ToastProps = ComponentPropsWithoutRef<'div'> & {
432
432
  /**
433
- * Action can be undefined (default dismiss button), a Button component or false to hide the dismiss button
433
+ * Action can be passed a Button component for a custom button to be displayed in the toast
434
434
  */
435
435
  action?: React.ReactElement<typeof Button> | undefined;
436
436
  /**
@@ -445,10 +445,15 @@ type ToastProps = ComponentPropsWithoutRef<'div'> & {
445
445
  * The message displayed in the toast
446
446
  */
447
447
  message: ReactNode;
448
+ /**
449
+ * @ignore
450
+ * The ID given for the Toast by sonner
451
+ */
452
+ toastId?: string;
448
453
  };
449
454
 
450
455
  type Position = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
451
- type UseToastProps = ToastProps & {
456
+ type UseToastProps = Omit<ToastProps, 'toastId'> & {
452
457
  position?: Position;
453
458
  duration?: number;
454
459
  };
@@ -711,18 +716,11 @@ type AlignContentType =
711
716
  | 'center'
712
717
  | 'flex-end'
713
718
  | 'flex-start'
714
- | 'normal'
715
719
  | 'space-around'
716
720
  | 'space-between'
717
721
  | 'stretch';
718
722
 
719
- type AlignItemsType =
720
- | 'baseline'
721
- | 'center'
722
- | 'flex-end'
723
- | 'flex-start'
724
- | 'normal'
725
- | 'stretch';
723
+ type AlignItemsType = 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch';
726
724
 
727
725
  type AlignSelfType = 'auto' | 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch';
728
726
 
@@ -1048,7 +1046,7 @@ type CardProps = BoxProps & ComponentPropsWithoutRef<'div'> & {
1048
1046
  * Cards can be used to visually distinguish content sections. Extends the [Box component.](https://wistia.github.io/vhs/storybook-ui/?path=/docs/components-box--docs)
1049
1047
  */
1050
1048
  declare const Card: {
1051
- ({ children, alignItems, border, borderRadius, colorScheme, direction, gap, height, paddingSize, prominence, width, ...props }: CardProps): JSX$1.Element;
1049
+ ({ children, border, borderRadius, colorScheme, direction, gap, height, paddingSize, prominence, width, ...props }: CardProps): JSX$1.Element;
1052
1050
  displayName: string;
1053
1051
  };
1054
1052
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.0-beta.782f3b36.e196b15
3
+ * @license @wistia/ui v0.18.0-beta.978703a9.78cdfd1
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -3190,7 +3190,7 @@ var StyledToast = styled2.div`
3190
3190
  justify-content: space-between;
3191
3191
  min-height: 56px;
3192
3192
  width: 356px;
3193
- border-radius: var(--wui-border-radius-01);
3193
+ border-radius: var(--wui-border-radius-02);
3194
3194
  background-color: var(--wui-color-bg-surface);
3195
3195
  border: 1px solid var(--wui-color-border);
3196
3196
  color: var(--wui-color-text);
@@ -3206,13 +3206,28 @@ var StyledToast = styled2.div`
3206
3206
  flex: 0 0 16px;
3207
3207
  }
3208
3208
  `;
3209
- var Action = ({ actionButton }) => {
3209
+ var Action = ({
3210
+ actionButton,
3211
+ toastId
3212
+ }) => {
3210
3213
  if (isNotNil4(actionButton) && isValidElement(actionButton)) {
3214
+ const { onClick, ...restProps } = actionButton.props;
3215
+ const handleClick = (event) => {
3216
+ if (onClick) {
3217
+ onClick(
3218
+ event,
3219
+ toastId ?? ""
3220
+ );
3221
+ }
3222
+ };
3211
3223
  return /* @__PURE__ */ jsx5(ActionWrapper, { children: cloneElement(actionButton, {
3224
+ ...restProps,
3212
3225
  variant: "soft",
3213
3226
  // force Button variant
3214
- size: "sm"
3227
+ size: "sm",
3215
3228
  // force Button size
3229
+ onClick: handleClick
3230
+ // decorate onClick function with new args
3216
3231
  }) });
3217
3232
  }
3218
3233
  return null;
@@ -3222,6 +3237,7 @@ var Toast = ({
3222
3237
  message,
3223
3238
  colorScheme = "inherit",
3224
3239
  icon,
3240
+ toastId,
3225
3241
  ...props
3226
3242
  }) => {
3227
3243
  return /* @__PURE__ */ jsxs2(
@@ -3234,7 +3250,13 @@ var Toast = ({
3234
3250
  isNotNil4(icon) ? icon : null,
3235
3251
  /* @__PURE__ */ jsx5(Message, { lines: 3, children: message })
3236
3252
  ] }),
3237
- /* @__PURE__ */ jsx5(Action, { actionButton: action })
3253
+ /* @__PURE__ */ jsx5(
3254
+ Action,
3255
+ {
3256
+ actionButton: action,
3257
+ toastId
3258
+ }
3259
+ )
3238
3260
  ]
3239
3261
  }
3240
3262
  );
@@ -3247,14 +3269,15 @@ var useToast = () => {
3247
3269
  return useCallback7(
3248
3270
  ({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
3249
3271
  sonnerToast.custom(
3250
- () => {
3272
+ (toastId) => {
3251
3273
  return /* @__PURE__ */ jsx6(
3252
3274
  Toast,
3253
3275
  {
3254
3276
  action,
3255
3277
  colorScheme,
3256
3278
  icon,
3257
- message
3279
+ message,
3280
+ toastId: String(toastId)
3258
3281
  }
3259
3282
  );
3260
3283
  },
@@ -8420,7 +8443,7 @@ var DEFAULT_ELEMENT = "div";
8420
8443
  var BoxComponent = forwardRef5(
8421
8444
  ({
8422
8445
  alignContent = "stretch",
8423
- alignItems = "stretch",
8446
+ alignItems = "flex-start",
8424
8447
  alignSelf,
8425
8448
  basis,
8426
8449
  children,
@@ -9301,7 +9324,6 @@ var prominenceMap = {
9301
9324
  };
9302
9325
  var Card = ({
9303
9326
  children,
9304
- alignItems = "flex-start",
9305
9327
  border = false,
9306
9328
  borderRadius = "border-radius-04",
9307
9329
  colorScheme = "inherit",
@@ -9315,7 +9337,6 @@ var Card = ({
9315
9337
  }) => /* @__PURE__ */ jsx214(
9316
9338
  StyledCard,
9317
9339
  {
9318
- $alignItems: alignItems,
9319
9340
  $backgroundColor: prominenceMap[prominence].backgroundColor,
9320
9341
  $borderColor: border ? prominenceMap[prominence].borderColor : "transparent",
9321
9342
  $borderRadius: borderRadius,