@wistia/ui 0.18.0-beta.978703a9.78cdfd1 → 0.18.0-beta.ce6c1712.725e361
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.cjs +27 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -12
- package/dist/index.d.ts +7 -12
- package/dist/index.mjs +27 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -123,11 +123,11 @@ declare const useFocusTrap: (active?: boolean, options?: UseFocusTrapOptions) =>
|
|
|
123
123
|
declare const useForceUpdate: () => (() => void);
|
|
124
124
|
|
|
125
125
|
type HoverProps = {
|
|
126
|
-
onFocus: () => void;
|
|
127
|
-
onMouseEnter: () => void;
|
|
128
|
-
onBlur: () => void;
|
|
129
|
-
onMouseLeave: () => void;
|
|
130
|
-
onMouseMove?: () => void;
|
|
126
|
+
onFocus: (event: React.FocusEvent) => void;
|
|
127
|
+
onMouseEnter: (event: React.MouseEvent) => void;
|
|
128
|
+
onBlur: (event: React.FocusEvent) => void;
|
|
129
|
+
onMouseLeave: (event: React.MouseEvent) => void;
|
|
130
|
+
onMouseMove?: (event: React.MouseEvent) => void;
|
|
131
131
|
};
|
|
132
132
|
declare const useIsHovered: () => [boolean, HoverProps, (hovered: boolean) => void];
|
|
133
133
|
|
|
@@ -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
|
|
433
|
+
* Action can be undefined (default dismiss button), a Button component or false to hide the dismiss button
|
|
434
434
|
*/
|
|
435
435
|
action?: React.ReactElement<typeof Button> | undefined;
|
|
436
436
|
/**
|
|
@@ -445,15 +445,10 @@ 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;
|
|
453
448
|
};
|
|
454
449
|
|
|
455
450
|
type Position = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
|
|
456
|
-
type UseToastProps =
|
|
451
|
+
type UseToastProps = ToastProps & {
|
|
457
452
|
position?: Position;
|
|
458
453
|
duration?: number;
|
|
459
454
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -123,11 +123,11 @@ declare const useFocusTrap: (active?: boolean, options?: UseFocusTrapOptions) =>
|
|
|
123
123
|
declare const useForceUpdate: () => (() => void);
|
|
124
124
|
|
|
125
125
|
type HoverProps = {
|
|
126
|
-
onFocus: () => void;
|
|
127
|
-
onMouseEnter: () => void;
|
|
128
|
-
onBlur: () => void;
|
|
129
|
-
onMouseLeave: () => void;
|
|
130
|
-
onMouseMove?: () => void;
|
|
126
|
+
onFocus: (event: React.FocusEvent) => void;
|
|
127
|
+
onMouseEnter: (event: React.MouseEvent) => void;
|
|
128
|
+
onBlur: (event: React.FocusEvent) => void;
|
|
129
|
+
onMouseLeave: (event: React.MouseEvent) => void;
|
|
130
|
+
onMouseMove?: (event: React.MouseEvent) => void;
|
|
131
131
|
};
|
|
132
132
|
declare const useIsHovered: () => [boolean, HoverProps, (hovered: boolean) => void];
|
|
133
133
|
|
|
@@ -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
|
|
433
|
+
* Action can be undefined (default dismiss button), a Button component or false to hide the dismiss button
|
|
434
434
|
*/
|
|
435
435
|
action?: React.ReactElement<typeof Button> | undefined;
|
|
436
436
|
/**
|
|
@@ -445,15 +445,10 @@ 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;
|
|
453
448
|
};
|
|
454
449
|
|
|
455
450
|
type Position = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
|
|
456
|
-
type UseToastProps =
|
|
451
|
+
type UseToastProps = ToastProps & {
|
|
457
452
|
position?: Position;
|
|
458
453
|
duration?: number;
|
|
459
454
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.18.0-beta.
|
|
3
|
+
* @license @wistia/ui v0.18.0-beta.ce6c1712.725e361
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -2812,11 +2812,26 @@ var useForceUpdate = () => {
|
|
|
2812
2812
|
import { useState as useState6 } from "react";
|
|
2813
2813
|
var useIsHovered = () => {
|
|
2814
2814
|
const [isHovered, setIsHovered] = useState6(false);
|
|
2815
|
-
const onFocus = () =>
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
const
|
|
2815
|
+
const onFocus = (event) => {
|
|
2816
|
+
if (event.target !== event.currentTarget) return;
|
|
2817
|
+
setIsHovered(true);
|
|
2818
|
+
};
|
|
2819
|
+
const onMouseEnter = (event) => {
|
|
2820
|
+
if (event.target !== event.currentTarget) return;
|
|
2821
|
+
setIsHovered(true);
|
|
2822
|
+
};
|
|
2823
|
+
const onMouseMove = (event) => {
|
|
2824
|
+
if (event.target !== event.currentTarget) return;
|
|
2825
|
+
setIsHovered(true);
|
|
2826
|
+
};
|
|
2827
|
+
const onBlur = (event) => {
|
|
2828
|
+
if (event.target !== event.currentTarget) return;
|
|
2829
|
+
setIsHovered(false);
|
|
2830
|
+
};
|
|
2831
|
+
const onMouseLeave = (event) => {
|
|
2832
|
+
if (event.target !== event.currentTarget) return;
|
|
2833
|
+
setIsHovered(false);
|
|
2834
|
+
};
|
|
2820
2835
|
const hoverProps = {
|
|
2821
2836
|
onFocus,
|
|
2822
2837
|
onMouseEnter,
|
|
@@ -3190,7 +3205,7 @@ var StyledToast = styled2.div`
|
|
|
3190
3205
|
justify-content: space-between;
|
|
3191
3206
|
min-height: 56px;
|
|
3192
3207
|
width: 356px;
|
|
3193
|
-
border-radius: var(--wui-border-radius-
|
|
3208
|
+
border-radius: var(--wui-border-radius-01);
|
|
3194
3209
|
background-color: var(--wui-color-bg-surface);
|
|
3195
3210
|
border: 1px solid var(--wui-color-border);
|
|
3196
3211
|
color: var(--wui-color-text);
|
|
@@ -3206,28 +3221,13 @@ var StyledToast = styled2.div`
|
|
|
3206
3221
|
flex: 0 0 16px;
|
|
3207
3222
|
}
|
|
3208
3223
|
`;
|
|
3209
|
-
var Action = ({
|
|
3210
|
-
actionButton,
|
|
3211
|
-
toastId
|
|
3212
|
-
}) => {
|
|
3224
|
+
var Action = ({ actionButton }) => {
|
|
3213
3225
|
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
|
-
};
|
|
3223
3226
|
return /* @__PURE__ */ jsx5(ActionWrapper, { children: cloneElement(actionButton, {
|
|
3224
|
-
...restProps,
|
|
3225
3227
|
variant: "soft",
|
|
3226
3228
|
// force Button variant
|
|
3227
|
-
size: "sm"
|
|
3229
|
+
size: "sm"
|
|
3228
3230
|
// force Button size
|
|
3229
|
-
onClick: handleClick
|
|
3230
|
-
// decorate onClick function with new args
|
|
3231
3231
|
}) });
|
|
3232
3232
|
}
|
|
3233
3233
|
return null;
|
|
@@ -3237,7 +3237,6 @@ var Toast = ({
|
|
|
3237
3237
|
message,
|
|
3238
3238
|
colorScheme = "inherit",
|
|
3239
3239
|
icon,
|
|
3240
|
-
toastId,
|
|
3241
3240
|
...props
|
|
3242
3241
|
}) => {
|
|
3243
3242
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -3250,13 +3249,7 @@ var Toast = ({
|
|
|
3250
3249
|
isNotNil4(icon) ? icon : null,
|
|
3251
3250
|
/* @__PURE__ */ jsx5(Message, { lines: 3, children: message })
|
|
3252
3251
|
] }),
|
|
3253
|
-
/* @__PURE__ */ jsx5(
|
|
3254
|
-
Action,
|
|
3255
|
-
{
|
|
3256
|
-
actionButton: action,
|
|
3257
|
-
toastId
|
|
3258
|
-
}
|
|
3259
|
-
)
|
|
3252
|
+
/* @__PURE__ */ jsx5(Action, { actionButton: action })
|
|
3260
3253
|
]
|
|
3261
3254
|
}
|
|
3262
3255
|
);
|
|
@@ -3269,15 +3262,14 @@ var useToast = () => {
|
|
|
3269
3262
|
return useCallback7(
|
|
3270
3263
|
({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
|
|
3271
3264
|
sonnerToast.custom(
|
|
3272
|
-
(
|
|
3265
|
+
() => {
|
|
3273
3266
|
return /* @__PURE__ */ jsx6(
|
|
3274
3267
|
Toast,
|
|
3275
3268
|
{
|
|
3276
3269
|
action,
|
|
3277
3270
|
colorScheme,
|
|
3278
3271
|
icon,
|
|
3279
|
-
message
|
|
3280
|
-
toastId: String(toastId)
|
|
3272
|
+
message
|
|
3281
3273
|
}
|
|
3282
3274
|
);
|
|
3283
3275
|
},
|