sy-ui-lib 1.0.4 → 1.0.5
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/components/CommonMarketHeader/CommonMarketHeader.types.d.ts +5 -0
- package/dist/components/SnackBar/SnackBar.stories.d.ts +1 -0
- package/dist/components/SnackBar/SnackBar.types.d.ts +3 -0
- package/dist/components/SnackBar/SnackbarFetcher.d.ts +5 -1
- package/dist/components/SnackBar/SnackbarProvider.d.ts +6 -0
- package/dist/index.cjs +10 -10
- package/dist/index.css +1 -1
- package/dist/index.js +562 -538
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonProps } from '../Button';
|
|
1
2
|
export interface MultiMarketButtonProps {
|
|
2
3
|
eventId: string;
|
|
3
4
|
onClick: (eventId: string) => void;
|
|
@@ -26,6 +27,10 @@ export interface CommonMarketHeaderProps {
|
|
|
26
27
|
level?: 1 | 2 | 3;
|
|
27
28
|
/**Controls whether the sub-header is rendered or not */
|
|
28
29
|
isSubHeader?: boolean;
|
|
30
|
+
/** controls whether the view bet button is rendered or not */
|
|
31
|
+
showBetsButton?: boolean;
|
|
32
|
+
/** buttons (CTAs) to render view button. */
|
|
33
|
+
viewBetCTA?: ButtonProps;
|
|
29
34
|
/** Click handler (e.g. navigate to Match Odds) Used in: MultiMarket*/
|
|
30
35
|
onClick?: (eventId: string) => void;
|
|
31
36
|
/** Prop to show or hide inplay marker */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export type SnackBarVariant = "default" | "action" | "dismiss";
|
|
3
3
|
/** Types of snackbar message types. */
|
|
4
4
|
export type SnackBarType = "info" | "success" | "error";
|
|
5
|
+
export type SnackBarPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
5
6
|
/** Props for the Action button (only for "action" variant) */
|
|
6
7
|
export interface ActionProps {
|
|
7
8
|
/** Label for the action button (only for "action" variant) */
|
|
@@ -21,6 +22,8 @@ interface SnackBarBaseProps {
|
|
|
21
22
|
duration?: number;
|
|
22
23
|
/** Type of message (info, success, error) to control the snackbar color */
|
|
23
24
|
type?: SnackBarType;
|
|
25
|
+
/** Position of the snackbar on screen" */
|
|
26
|
+
position?: SnackBarPosition;
|
|
24
27
|
}
|
|
25
28
|
/** Props for the default variant */
|
|
26
29
|
interface DefaultSnackBarProps extends SnackBarBaseProps {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { SnackBarPosition } from './SnackBar.types';
|
|
1
2
|
/** Options for displaying a snackbar, based on the variant type.*/
|
|
2
3
|
type SnackbarOptions = {
|
|
3
4
|
/** Default variant */
|
|
4
|
-
variant
|
|
5
|
+
variant?: "default";
|
|
5
6
|
/** Auto-close duration (ms) */
|
|
6
7
|
duration?: number;
|
|
8
|
+
position?: SnackBarPosition;
|
|
7
9
|
} | {
|
|
8
10
|
/** Action variant */
|
|
9
11
|
variant: "action";
|
|
10
12
|
duration?: number;
|
|
13
|
+
position?: SnackBarPosition;
|
|
11
14
|
/** Action button config */
|
|
12
15
|
actionProps: {
|
|
13
16
|
actionLabel: string;
|
|
@@ -17,6 +20,7 @@ type SnackbarOptions = {
|
|
|
17
20
|
/** Dismiss variant */
|
|
18
21
|
variant: "dismiss";
|
|
19
22
|
duration?: number;
|
|
23
|
+
position?: SnackBarPosition;
|
|
20
24
|
/** Dismiss button config */
|
|
21
25
|
dismissProps: {
|
|
22
26
|
title: string;
|
|
@@ -5,6 +5,11 @@ import { default as React } from 'react';
|
|
|
5
5
|
* Global provider to display toast/snackbar notifications via a portal.
|
|
6
6
|
* Mount it once at the app root (e.g., in `App.tsx`).
|
|
7
7
|
*
|
|
8
|
+
* Positioning:
|
|
9
|
+
* - Snackbars can be displayed in 4 positions:
|
|
10
|
+
* "top-left" | "top-right" | "bottom-left" | "bottom-right"
|
|
11
|
+
* @default "bottom-right
|
|
12
|
+
*
|
|
8
13
|
* Usage:
|
|
9
14
|
* 1. Add provider:
|
|
10
15
|
* <MainRouter />
|
|
@@ -12,6 +17,7 @@ import { default as React } from 'react';
|
|
|
12
17
|
* ```
|
|
13
18
|
* 2. Trigger notifications:
|
|
14
19
|
* snackbar.success("Saved!");
|
|
20
|
+
* snackbar.success("Saved!", { position: "top-right" });
|
|
15
21
|
* snackbar.error("Error", { variant: "dismiss" });
|
|
16
22
|
* snackbar.info("Retry?", { variant: "action", actionProps: { ... } });
|
|
17
23
|
* ```
|