@fluentui/react-badge 0.0.0-nightly-20230501-0418.1 → 0.0.0-nightly-20230503-0419.1
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/CHANGELOG.json +13 -13
- package/CHANGELOG.md +9 -9
- package/dist/index.d.ts +159 -0
- package/lib/Badge.js +2 -0
- package/lib/Badge.js.map +1 -0
- package/lib/CounterBadge.js +2 -0
- package/lib/CounterBadge.js.map +1 -0
- package/lib/PresenceBadge.js +2 -0
- package/lib/PresenceBadge.js.map +1 -0
- package/lib/components/Badge/Badge.js +16 -0
- package/lib/components/Badge/Badge.js.map +1 -0
- package/lib/components/Badge/Badge.types.js +2 -0
- package/lib/components/Badge/Badge.types.js.map +1 -0
- package/lib/components/Badge/index.js +5 -0
- package/lib/components/Badge/index.js.map +1 -0
- package/lib/components/Badge/renderBadge.js +10 -0
- package/lib/components/Badge/renderBadge.js.map +1 -0
- package/lib/components/Badge/useBadge.js +32 -0
- package/lib/components/Badge/useBadge.js.map +1 -0
- package/lib/components/Badge/useBadgeStyles.styles.js +315 -0
- package/lib/components/Badge/useBadgeStyles.styles.js.map +1 -0
- package/lib/components/CounterBadge/CounterBadge.js +16 -0
- package/lib/components/CounterBadge/CounterBadge.js.map +1 -0
- package/lib/components/CounterBadge/CounterBadge.types.js +2 -0
- package/lib/components/CounterBadge/CounterBadge.types.js.map +1 -0
- package/lib/components/CounterBadge/index.js +5 -0
- package/lib/components/CounterBadge/index.js.map +1 -0
- package/lib/components/CounterBadge/useCounterBadge.js +28 -0
- package/lib/components/CounterBadge/useCounterBadge.js.map +1 -0
- package/lib/components/CounterBadge/useCounterBadgeStyles.styles.js +34 -0
- package/lib/components/CounterBadge/useCounterBadgeStyles.styles.js.map +1 -0
- package/lib/components/PresenceBadge/PresenceBadge.js +16 -0
- package/lib/components/PresenceBadge/PresenceBadge.js.map +1 -0
- package/lib/components/PresenceBadge/PresenceBadge.types.js +2 -0
- package/lib/components/PresenceBadge/PresenceBadge.types.js.map +1 -0
- package/lib/components/PresenceBadge/index.js +5 -0
- package/lib/components/PresenceBadge/index.js.map +1 -0
- package/lib/components/PresenceBadge/presenceIcons.js +135 -0
- package/lib/components/PresenceBadge/presenceIcons.js.map +1 -0
- package/lib/components/PresenceBadge/usePresenceBadge.js +65 -0
- package/lib/components/PresenceBadge/usePresenceBadge.js.map +1 -0
- package/lib/components/PresenceBadge/usePresenceBadgeStyles.styles.js +79 -0
- package/lib/components/PresenceBadge/usePresenceBadgeStyles.styles.js.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -0
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-badge",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-badge_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Wed, 03 May 2023 04:25:33 GMT",
|
6
|
+
"tag": "@fluentui/react-badge_v0.0.0-nightly-20230503-0419.1",
|
7
|
+
"version": "0.0.0-nightly-20230503-0419.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,32 +16,32 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-badge",
|
19
|
-
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230503-0419.1",
|
20
|
+
"commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-badge",
|
25
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230503-0419.1",
|
26
|
+
"commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-badge",
|
31
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230503-0419.1",
|
32
|
+
"commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"author": "beachball",
|
36
36
|
"package": "@fluentui/react-badge",
|
37
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230503-0419.1",
|
38
|
+
"commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
"author": "beachball",
|
42
42
|
"package": "@fluentui/react-badge",
|
43
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230503-0419.1",
|
44
|
+
"commit": "a9a6cef152f4c3885a3697ddf9ded12bfce5a2be"
|
45
45
|
}
|
46
46
|
]
|
47
47
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# Change Log - @fluentui/react-badge
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Wed, 03 May 2023 04:25:33 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230503-0419.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v0.0.0-nightly-20230503-0419.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.1.10..@fluentui/react-badge_v0.0.0-nightly-
|
9
|
+
Wed, 03 May 2023 04:25:33 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-badge_v9.1.10..@fluentui/react-badge_v0.0.0-nightly-20230503-0419.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
|
16
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
|
17
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
|
18
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
|
19
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230503-0419.1 ([commit](https://github.com/microsoft/fluentui/commit/a9a6cef152f4c3885a3697ddf9ded12bfce5a2be) by beachball)
|
20
20
|
|
21
21
|
## [9.1.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-badge_v9.1.10)
|
22
22
|
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
|
3
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
4
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
5
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
6
|
+
import * as React_2 from 'react';
|
7
|
+
import type { Slot } from '@fluentui/react-utilities';
|
8
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Define a styled Badge, using the `useBadge_unstable` hook.
|
12
|
+
*/
|
13
|
+
export declare const Badge: ForwardRefComponent<BadgeProps>;
|
14
|
+
|
15
|
+
export declare const badgeClassNames: SlotClassNames<BadgeSlots>;
|
16
|
+
|
17
|
+
export declare type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & {
|
18
|
+
/**
|
19
|
+
* A Badge can be filled, outline, ghost, inverted
|
20
|
+
* @defaultvalue filled
|
21
|
+
*/
|
22
|
+
appearance?: 'filled' | 'ghost' | 'outline' | 'tint';
|
23
|
+
/**
|
24
|
+
* A Badge can be one of preset colors
|
25
|
+
* @defaultvalue brand
|
26
|
+
*/
|
27
|
+
color?: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
|
28
|
+
/**
|
29
|
+
* A Badge can position the icon before or after the content.
|
30
|
+
* @defaultvalue before
|
31
|
+
*/
|
32
|
+
iconPosition?: 'before' | 'after';
|
33
|
+
/**
|
34
|
+
* A Badge can be square, circular or rounded.
|
35
|
+
* @defaultvalue circular
|
36
|
+
*/
|
37
|
+
shape?: 'circular' | 'rounded' | 'square';
|
38
|
+
/**
|
39
|
+
* A Badge can be on of several preset sizes.
|
40
|
+
* @defaultvalue medium
|
41
|
+
*/
|
42
|
+
size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
|
43
|
+
};
|
44
|
+
|
45
|
+
export declare type BadgeSlots = {
|
46
|
+
root: Slot<'div'>;
|
47
|
+
icon?: Slot<'span'>;
|
48
|
+
};
|
49
|
+
|
50
|
+
export declare type BadgeState = ComponentState<BadgeSlots> & Required<Pick<BadgeProps, 'appearance' | 'color' | 'iconPosition' | 'shape' | 'size'>>;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Define a styled CounterBadge, using the `useCounterBadge_unstable` hook.
|
54
|
+
*/
|
55
|
+
export declare const CounterBadge: ForwardRefComponent<CounterBadgeProps>;
|
56
|
+
|
57
|
+
export declare const counterBadgeClassNames: SlotClassNames<BadgeSlots>;
|
58
|
+
|
59
|
+
export declare type CounterBadgeProps = Omit<BadgeProps, 'appearance' | 'color' | 'shape'> & {
|
60
|
+
/**
|
61
|
+
* A Badge can have different appearances that emphasize certain parts of it:
|
62
|
+
* - filled: The default appearance if one is not specified.
|
63
|
+
* The badge background is filled with color with a contrasting foreground text to match.
|
64
|
+
* - ghost: The badge background is transparent, with the foreground text taking color to emphasize it.
|
65
|
+
* @default filled
|
66
|
+
*/
|
67
|
+
appearance?: 'filled' | 'ghost';
|
68
|
+
/**
|
69
|
+
* Semantic colors for a counter badge
|
70
|
+
* @default brand
|
71
|
+
*/
|
72
|
+
color?: Extract<BadgeProps['color'], 'brand' | 'danger' | 'important' | 'informative'>;
|
73
|
+
/**
|
74
|
+
* Value displayed by the Badge
|
75
|
+
* @default 0
|
76
|
+
*/
|
77
|
+
count?: number;
|
78
|
+
/**
|
79
|
+
* If a dot should be displayed without the count
|
80
|
+
* @default false
|
81
|
+
*/
|
82
|
+
dot?: boolean;
|
83
|
+
/**
|
84
|
+
* Max number to be displayed
|
85
|
+
* @default 99
|
86
|
+
*/
|
87
|
+
overflowCount?: number;
|
88
|
+
/**
|
89
|
+
* A Badge can be circular or rounded
|
90
|
+
* @default circular
|
91
|
+
*/
|
92
|
+
shape?: 'circular' | 'rounded';
|
93
|
+
/**
|
94
|
+
* If the badge should be shown when count is 0
|
95
|
+
* @default false
|
96
|
+
*/
|
97
|
+
showZero?: boolean;
|
98
|
+
};
|
99
|
+
|
100
|
+
export declare type CounterBadgeState = Omit<BadgeState, 'appearance' | 'color' | 'shape'> & Required<Pick<CounterBadgeProps, 'appearance' | 'color' | 'count' | 'dot' | 'shape' | 'showZero'>>;
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Define a styled Badge, using the `useBadge_unstable` hook.
|
104
|
+
*/
|
105
|
+
export declare const PresenceBadge: ForwardRefComponent<PresenceBadgeProps>;
|
106
|
+
|
107
|
+
export declare const presenceBadgeClassNames: SlotClassNames<BadgeSlots>;
|
108
|
+
|
109
|
+
export declare type PresenceBadgeProps = Omit<ComponentProps<Pick<BadgeSlots, 'root' | 'icon'>>, 'color'> & Pick<BadgeProps, 'size'> & {
|
110
|
+
/**
|
111
|
+
* Represents several status
|
112
|
+
* @default available
|
113
|
+
*/
|
114
|
+
status?: PresenceBadgeStatus;
|
115
|
+
/**
|
116
|
+
* Modifies the display to indicate that the user is out of office.
|
117
|
+
* This can be combined with any status to display an out-of-office version of that status
|
118
|
+
* @default false
|
119
|
+
*/
|
120
|
+
outOfOffice?: boolean;
|
121
|
+
};
|
122
|
+
|
123
|
+
export declare type PresenceBadgeState = ComponentState<BadgeSlots> & BadgeState & Required<Pick<PresenceBadgeProps, 'status' | 'outOfOffice'>>;
|
124
|
+
|
125
|
+
export declare type PresenceBadgeStatus = 'busy' | 'out-of-office' | 'away' | 'available' | 'offline' | 'do-not-disturb' | 'unknown' | 'blocked';
|
126
|
+
|
127
|
+
export declare const renderBadge_unstable: (state: BadgeState) => JSX.Element;
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Returns the props and state required to render the component
|
131
|
+
*/
|
132
|
+
export declare const useBadge_unstable: (props: BadgeProps, ref: React_2.Ref<HTMLElement>) => BadgeState;
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Applies style classnames to slots
|
136
|
+
*/
|
137
|
+
export declare const useBadgeStyles_unstable: (state: BadgeState) => BadgeState;
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Returns the props and state required to render the component
|
141
|
+
*/
|
142
|
+
export declare const useCounterBadge_unstable: (props: CounterBadgeProps, ref: React_2.Ref<HTMLElement>) => CounterBadgeState;
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Applies style classnames to slots
|
146
|
+
*/
|
147
|
+
export declare const useCounterBadgeStyles_unstable: (state: CounterBadgeState) => CounterBadgeState;
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Returns the props and state required to render the component
|
151
|
+
*/
|
152
|
+
export declare const usePresenceBadge_unstable: (props: PresenceBadgeProps, ref: React_2.Ref<HTMLElement>) => PresenceBadgeState;
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Applies style classnames to slots
|
156
|
+
*/
|
157
|
+
export declare const usePresenceBadgeStyles_unstable: (state: PresenceBadgeState) => PresenceBadgeState;
|
158
|
+
|
159
|
+
export { }
|
package/lib/Badge.js
ADDED
package/lib/Badge.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["../src/Badge.ts"],"sourcesContent":["export * from './components/Badge/index';\n"],"mappings":"AAAA,cAAc"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["../src/CounterBadge.ts"],"sourcesContent":["export * from './components/CounterBadge/index';\n"],"mappings":"AAAA,cAAc"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["../src/PresenceBadge.ts"],"sourcesContent":["export * from './components/PresenceBadge/index';\n"],"mappings":"AAAA,cAAc"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { useBadge_unstable } from './useBadge';
|
3
|
+
import { useBadgeStyles_unstable } from './useBadgeStyles.styles';
|
4
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
5
|
+
import { renderBadge_unstable } from './renderBadge';
|
6
|
+
/**
|
7
|
+
* Define a styled Badge, using the `useBadge_unstable` hook.
|
8
|
+
*/
|
9
|
+
export const Badge = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useBadge_unstable(props, ref);
|
11
|
+
useBadgeStyles_unstable(state);
|
12
|
+
useCustomStyleHook_unstable('useBadgeStyles_unstable')(state);
|
13
|
+
return renderBadge_unstable(state);
|
14
|
+
});
|
15
|
+
Badge.displayName = 'Badge';
|
16
|
+
//# sourceMappingURL=Badge.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["React","useBadge_unstable","useBadgeStyles_unstable","useCustomStyleHook_unstable","renderBadge_unstable","Badge","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useBadge_unstable } from './useBadge';\nimport { useBadgeStyles_unstable } from './useBadgeStyles.styles';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { renderBadge_unstable } from './renderBadge';\nimport type { BadgeProps } from './Badge.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled Badge, using the `useBadge_unstable` hook.\n */\nexport const Badge: ForwardRefComponent<BadgeProps> = React.forwardRef((props, ref) => {\n const state = useBadge_unstable(props, ref);\n\n useBadgeStyles_unstable(state);\n\n useCustomStyleHook_unstable('useBadgeStyles_unstable')(state);\n\n return renderBadge_unstable(state);\n});\n\nBadge.displayName = 'Badge';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AAIrC;;;AAGA,OAAO,MAAMC,KAAA,gBAAyCL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACrF,MAAMC,KAAA,GAAQR,iBAAA,CAAkBM,KAAA,EAAOC,GAAA;EAEvCN,uBAAA,CAAwBO,KAAA;EAExBN,2BAAA,CAA4B,2BAA2BM,KAAA;EAEvD,OAAOL,oBAAA,CAAqBK,KAAA;AAC9B;AAEAJ,KAAA,CAAMK,WAAW,GAAG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/Badge/Badge.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type BadgeSlots = {\n root: Slot<'div'>;\n icon?: Slot<'span'>;\n};\n\n// react has a non-standard `color` attribute in its types\n// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a4ab0fa432320e70da9e51c8ae2e47377f65804b/types/react/index.d.ts#L1868\nexport type BadgeProps = Omit<ComponentProps<BadgeSlots>, 'color'> & {\n /**\n * A Badge can be filled, outline, ghost, inverted\n * @defaultvalue filled\n */\n appearance?: 'filled' | 'ghost' | 'outline' | 'tint';\n\n /**\n * A Badge can be one of preset colors\n * @defaultvalue brand\n */\n color?: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';\n\n /**\n * A Badge can position the icon before or after the content.\n * @defaultvalue before\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A Badge can be square, circular or rounded.\n * @defaultvalue circular\n */\n shape?: 'circular' | 'rounded' | 'square';\n\n /**\n * A Badge can be on of several preset sizes.\n * @defaultvalue medium\n */\n size?: 'tiny' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';\n};\n\nexport type BadgeState = ComponentState<BadgeSlots> &\n Required<Pick<BadgeProps, 'appearance' | 'color' | 'iconPosition' | 'shape' | 'size'>>;\n"],"mappings":"AAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/Badge/index.ts"],"sourcesContent":["export * from './Badge';\n// Explicit exports to omit BadgeCommons\nexport type { BadgeProps, BadgeSlots, BadgeState } from './Badge.types';\nexport * from './renderBadge';\nexport * from './useBadge';\nexport * from './useBadgeStyles.styles';\n"],"mappings":"AAAA,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
2
|
+
import { getSlotsNext } from '@fluentui/react-utilities';
|
3
|
+
export const renderBadge_unstable = state => {
|
4
|
+
const {
|
5
|
+
slots,
|
6
|
+
slotProps
|
7
|
+
} = getSlotsNext(state);
|
8
|
+
return /*#__PURE__*/createElement(slots.root, slotProps.root, state.iconPosition === 'before' && slots.icon && /*#__PURE__*/createElement(slots.icon, slotProps.icon), state.root.children, state.iconPosition === 'after' && slots.icon && /*#__PURE__*/createElement(slots.icon, slotProps.icon));
|
9
|
+
};
|
10
|
+
//# sourceMappingURL=renderBadge.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createElement","getSlotsNext","renderBadge_unstable","state","slots","slotProps","root","iconPosition","icon","children"],"sources":["../../../src/components/Badge/renderBadge.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { BadgeState, BadgeSlots } from './Badge.types';\n\nexport const renderBadge_unstable = (state: BadgeState) => {\n const { slots, slotProps } = getSlotsNext<BadgeSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.iconPosition === 'before' && slots.icon && <slots.icon {...slotProps.icon} />}\n {state.root.children}\n {state.iconPosition === 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAE9B,SAASC,YAAY,QAAQ;AAG7B,OAAO,MAAMC,oBAAA,GAAwBC,KAAA,IAAsB;EACzD,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,YAAA,CAAyBE,KAAA;EAEtD,oBACEH,aAXJ,CAWKI,KAAA,CAAME,IAAI,EAAKD,SAAA,CAAUC,IAAI,EAC3BH,KAAA,CAAMI,YAAY,KAAK,YAAYH,KAAA,CAAMI,IAAI,iBAAIR,aAZxD,CAYyDI,KAAA,CAAMI,IAAI,EAAKH,SAAA,CAAUG,IAAI,GAC/EL,KAAA,CAAMG,IAAI,CAACG,QAAQ,EACnBN,KAAA,CAAMI,YAAY,KAAK,WAAWH,KAAA,CAAMI,IAAI,iBAAIR,aAdvD,CAcwDI,KAAA,CAAMI,IAAI,EAAKH,SAAA,CAAUG,IAAI;AAGrF"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
|
3
|
+
/**
|
4
|
+
* Returns the props and state required to render the component
|
5
|
+
*/
|
6
|
+
export const useBadge_unstable = (props, ref) => {
|
7
|
+
const {
|
8
|
+
shape = 'circular',
|
9
|
+
size = 'medium',
|
10
|
+
iconPosition = 'before',
|
11
|
+
appearance = 'filled',
|
12
|
+
color = 'brand'
|
13
|
+
} = props;
|
14
|
+
const state = {
|
15
|
+
shape,
|
16
|
+
size,
|
17
|
+
iconPosition,
|
18
|
+
appearance,
|
19
|
+
color,
|
20
|
+
components: {
|
21
|
+
root: 'div',
|
22
|
+
icon: 'span'
|
23
|
+
},
|
24
|
+
root: getNativeElementProps('div', {
|
25
|
+
ref,
|
26
|
+
...props
|
27
|
+
}),
|
28
|
+
icon: resolveShorthand(props.icon)
|
29
|
+
};
|
30
|
+
return state;
|
31
|
+
};
|
32
|
+
//# sourceMappingURL=useBadge.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["React","getNativeElementProps","resolveShorthand","useBadge_unstable","props","ref","shape","size","iconPosition","appearance","color","state","components","root","icon"],"sources":["../../../src/components/Badge/useBadge.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { BadgeProps, BadgeState } from './Badge.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useBadge_unstable = (props: BadgeProps, ref: React.Ref<HTMLElement>): BadgeState => {\n const {\n shape = 'circular',\n size = 'medium',\n iconPosition = 'before',\n appearance = 'filled',\n color = 'brand',\n } = props;\n\n const state: BadgeState = {\n shape,\n size,\n iconPosition,\n appearance,\n color,\n components: {\n root: 'div',\n icon: 'span',\n },\n root: getNativeElementProps('div', {\n ref,\n ...props,\n }),\n icon: resolveShorthand(props.icon),\n };\n\n return state;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ;AAGxD;;;AAGA,OAAO,MAAMC,iBAAA,GAAoBA,CAACC,KAAA,EAAmBC,GAAA,KAA4C;EAC/F,MAAM;IACJC,KAAA,GAAQ;IACRC,IAAA,GAAO;IACPC,YAAA,GAAe;IACfC,UAAA,GAAa;IACbC,KAAA,GAAQ;EAAO,CAChB,GAAGN,KAAA;EAEJ,MAAMO,KAAA,GAAoB;IACxBL,KAAA;IACAC,IAAA;IACAC,YAAA;IACAC,UAAA;IACAC,KAAA;IACAE,UAAA,EAAY;MACVC,IAAA,EAAM;MACNC,IAAA,EAAM;IACR;IACAD,IAAA,EAAMZ,qBAAA,CAAsB,OAAO;MACjCI,GAAA;MACA,GAAGD;IACL;IACAU,IAAA,EAAMZ,gBAAA,CAAiBE,KAAA,CAAMU,IAAI;EACnC;EAEA,OAAOH,KAAA;AACT"}
|