1 | import * as React from 'react';
|
2 | import { SxProps } from '@mui/system';
|
3 | import { OverridableStringUnion, Simplify } from '@mui/types';
|
4 | import { SlotComponentProps } from '../utils/types';
|
5 | import { Theme } from '../styles';
|
6 | import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
7 | import { BadgeClasses } from './badgeClasses';
|
8 |
|
9 | export interface BadgePropsVariantOverrides {}
|
10 | export interface BadgePropsColorOverrides {}
|
11 | export interface BadgeRootSlotPropsOverrides {}
|
12 | export interface BadgeBadgeSlotPropsOverrides {}
|
13 |
|
14 | export type BadgeOwnerState = Simplify<
|
15 | BadgeOwnProps & {
|
16 | badgeContent: React.ReactNode;
|
17 | invisible: boolean;
|
18 | max: number;
|
19 | displayValue: React.ReactNode;
|
20 | showZero: boolean;
|
21 | anchorOrigin: BadgeOrigin;
|
22 | color: OverridableStringUnion<
|
23 | 'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning',
|
24 | BadgePropsColorOverrides
|
25 | >;
|
26 | overlap: 'rectangular' | 'circular';
|
27 | variant: OverridableStringUnion<'standard' | 'dot', BadgePropsVariantOverrides>;
|
28 | }
|
29 | >;
|
30 |
|
31 | export interface BadgeOrigin {
|
32 | vertical?: 'top' | 'bottom';
|
33 | horizontal?: 'left' | 'right';
|
34 | }
|
35 |
|
36 | export interface BadgeOwnProps {
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | anchorOrigin?: BadgeOrigin;
|
45 | |
46 |
|
47 |
|
48 | badgeContent?: React.ReactNode;
|
49 | |
50 |
|
51 |
|
52 | children?: React.ReactNode;
|
53 | |
54 |
|
55 |
|
56 | classes?: Partial<BadgeClasses>;
|
57 | |
58 |
|
59 |
|
60 | className?: string;
|
61 | |
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | color?: OverridableStringUnion<
|
68 | 'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning',
|
69 | BadgePropsColorOverrides
|
70 | >;
|
71 | |
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 | componentsProps?: BadgeOwnProps['slotProps'];
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | components?: {
|
88 | Root?: React.ElementType;
|
89 | Badge?: React.ElementType;
|
90 | };
|
91 | |
92 |
|
93 |
|
94 |
|
95 | invisible?: boolean;
|
96 | |
97 |
|
98 |
|
99 |
|
100 | max?: number;
|
101 | |
102 |
|
103 |
|
104 |
|
105 | overlap?: 'rectangular' | 'circular';
|
106 | |
107 |
|
108 |
|
109 |
|
110 | slotProps?: {
|
111 | root?: SlotComponentProps<'span', BadgeRootSlotPropsOverrides, BadgeOwnerState>;
|
112 | badge?: SlotComponentProps<'span', BadgeBadgeSlotPropsOverrides, BadgeOwnerState>;
|
113 | };
|
114 | |
115 |
|
116 |
|
117 |
|
118 |
|
119 | slots?: {
|
120 | |
121 |
|
122 |
|
123 |
|
124 | root?: React.ElementType;
|
125 | |
126 |
|
127 |
|
128 |
|
129 | badge?: React.ElementType;
|
130 | };
|
131 | |
132 |
|
133 |
|
134 |
|
135 | showZero?: boolean;
|
136 | |
137 |
|
138 |
|
139 | sx?: SxProps<Theme>;
|
140 | |
141 |
|
142 |
|
143 |
|
144 | variant?: OverridableStringUnion<'standard' | 'dot', BadgePropsVariantOverrides>;
|
145 | }
|
146 |
|
147 | export interface BadgeTypeMap<
|
148 | RootComponent extends React.ElementType = 'span',
|
149 | AdditionalProps = {},
|
150 | > {
|
151 | props: AdditionalProps & BadgeOwnProps;
|
152 | defaultComponent: RootComponent;
|
153 | }
|
154 |
|
155 | type BadgeRootProps = NonNullable<BadgeTypeMap['props']['slotProps']>['root'];
|
156 | type BadgeBadgeProps = NonNullable<BadgeTypeMap['props']['slotProps']>['badge'];
|
157 |
|
158 | export declare const BadgeRoot: React.FC<BadgeRootProps>;
|
159 | export declare const BadgeMark: React.FC<BadgeBadgeProps>;
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | declare const Badge: OverridableComponent<BadgeTypeMap>;
|
173 |
|
174 | export type BadgeProps<
|
175 | RootComponent extends React.ElementType = BadgeTypeMap['defaultComponent'],
|
176 | AdditionalProps = {},
|
177 | > = OverrideProps<BadgeTypeMap<RootComponent, AdditionalProps>, RootComponent> & {
|
178 | component?: React.ElementType;
|
179 | };
|
180 |
|
181 | export default Badge;
|