@wistia/ui 0.18.0-beta.6d32b1a6.7a80f3d → 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
  };
@@ -2078,11 +2083,6 @@ type EditableTextRootProps = Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue
2078
2083
  * Whether the editable text is read only. If true, the editable text will not be editable and the trigger will not be shown.
2079
2084
  */
2080
2085
  readOnly?: boolean;
2081
- /**
2082
- * When true, prevents the text from entering edit mode
2083
- * @default false
2084
- */
2085
- disabled?: boolean;
2086
2086
  /**
2087
2087
  * The id of the editable text.
2088
2088
  */
@@ -2119,7 +2119,6 @@ type EditableTextContextValues = {
2119
2119
  typographicVariant: TypographicVariant;
2120
2120
  submitMode: 'blur' | 'both' | 'enter' | 'none';
2121
2121
  readOnly: boolean;
2122
- disabled: boolean;
2123
2122
  id: string;
2124
2123
  label: string;
2125
2124
  placeholder: string;
@@ -2128,7 +2127,7 @@ type EditableTextContextValues = {
2128
2127
  finalFocusEl: (() => HTMLElement | null) | undefined;
2129
2128
  };
2130
2129
  declare const EditableTextContext: react.Context<EditableTextContextValues | null>;
2131
- declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, disabled, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
2130
+ declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
2132
2131
 
2133
2132
  type EditableTextProps = Omit<EditableTextRootProps, 'children'> & {
2134
2133
  /**
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
  };
@@ -2078,11 +2083,6 @@ type EditableTextRootProps = Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue
2078
2083
  * Whether the editable text is read only. If true, the editable text will not be editable and the trigger will not be shown.
2079
2084
  */
2080
2085
  readOnly?: boolean;
2081
- /**
2082
- * When true, prevents the text from entering edit mode
2083
- * @default false
2084
- */
2085
- disabled?: boolean;
2086
2086
  /**
2087
2087
  * The id of the editable text.
2088
2088
  */
@@ -2119,7 +2119,6 @@ type EditableTextContextValues = {
2119
2119
  typographicVariant: TypographicVariant;
2120
2120
  submitMode: 'blur' | 'both' | 'enter' | 'none';
2121
2121
  readOnly: boolean;
2122
- disabled: boolean;
2123
2122
  id: string;
2124
2123
  label: string;
2125
2124
  placeholder: string;
@@ -2128,7 +2127,7 @@ type EditableTextContextValues = {
2128
2127
  finalFocusEl: (() => HTMLElement | null) | undefined;
2129
2128
  };
2130
2129
  declare const EditableTextContext: react.Context<EditableTextContextValues | null>;
2131
- declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, disabled, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
2130
+ declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
2132
2131
 
2133
2132
  type EditableTextProps = Omit<EditableTextRootProps, 'children'> & {
2134
2133
  /**
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.0-beta.6d32b1a6.7a80f3d
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
  },
@@ -14230,7 +14253,6 @@ var EditableTextRoot = ({
14230
14253
  typographicVariant = "body2",
14231
14254
  submitMode = "both",
14232
14255
  readOnly = false,
14233
- disabled = false,
14234
14256
  id,
14235
14257
  label,
14236
14258
  placeholder = "Click to edit this text",
@@ -14248,14 +14270,13 @@ var EditableTextRoot = ({
14248
14270
  const computedId = isNonEmptyString6(id) ? id : `wistia-ui-editable-text-${generatedId}`;
14249
14271
  const handleSetIsEditing = useCallback16(
14250
14272
  (editing) => {
14251
- if (disabled) return;
14252
14273
  if (editing && !isEditing) {
14253
14274
  setOriginalValue(value);
14254
14275
  }
14255
14276
  setIsEditing(editing);
14256
14277
  onEditingChange?.(editing);
14257
14278
  },
14258
- [disabled, isEditing, value, onEditingChange]
14279
+ [isEditing, value, onEditingChange]
14259
14280
  );
14260
14281
  const setValue = useCallback16(
14261
14282
  (newValue) => {
@@ -14278,7 +14299,6 @@ var EditableTextRoot = ({
14278
14299
  typographicVariant,
14279
14300
  submitMode,
14280
14301
  readOnly,
14281
- disabled,
14282
14302
  id: computedId,
14283
14303
  label,
14284
14304
  placeholder,
@@ -14297,7 +14317,6 @@ var EditableTextRoot = ({
14297
14317
  typographicVariant,
14298
14318
  submitMode,
14299
14319
  readOnly,
14300
- disabled,
14301
14320
  computedId,
14302
14321
  label,
14303
14322
  placeholder,
@@ -14309,9 +14328,6 @@ var EditableTextRoot = ({
14309
14328
  if (readOnly) {
14310
14329
  return "read-only";
14311
14330
  }
14312
- if (disabled) {
14313
- return "disabled";
14314
- }
14315
14331
  if (isEditing) {
14316
14332
  return "editing";
14317
14333
  }
@@ -14372,16 +14388,7 @@ var EditableTextDisplayComponent = forwardRef21(
14372
14388
  if (!context) {
14373
14389
  throw new Error("EditableTextDisplay must be used within an EditableTextRoot context");
14374
14390
  }
14375
- const {
14376
- value,
14377
- typographicVariant,
14378
- setIsEditing,
14379
- placeholder,
14380
- maxLines,
14381
- isEditing,
14382
- minLines,
14383
- disabled
14384
- } = context;
14391
+ const { value, typographicVariant, setIsEditing, placeholder, maxLines, isEditing, minLines } = context;
14385
14392
  const triggerButtonRef = useRef17(null);
14386
14393
  const handleTriggerClick = () => {
14387
14394
  setIsEditing(true);
@@ -14392,7 +14399,7 @@ var EditableTextDisplayComponent = forwardRef21(
14392
14399
  if (isEditing) {
14393
14400
  return null;
14394
14401
  }
14395
- if (asTrigger && !context.readOnly && !disabled) {
14402
+ if (asTrigger && !context.readOnly) {
14396
14403
  return /* @__PURE__ */ jsx278(ClickRegion, { targetRef: triggerButtonRef, children: /* @__PURE__ */ jsxs43(
14397
14404
  StyledEditableTextDisplay,
14398
14405
  {