@fluentui/react-button 9.1.7 → 9.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +113 -1
- package/CHANGELOG.md +31 -2
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js +9 -12
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +63 -3
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +16 -15
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-amd/Button.js +6 -0
- package/lib-amd/Button.js.map +1 -0
- package/lib-amd/CompoundButton.js +6 -0
- package/lib-amd/CompoundButton.js.map +1 -0
- package/lib-amd/MenuButton.js +6 -0
- package/lib-amd/MenuButton.js.map +1 -0
- package/lib-amd/SplitButton.js +6 -0
- package/lib-amd/SplitButton.js.map +1 -0
- package/lib-amd/ToggleButton.js +6 -0
- package/lib-amd/ToggleButton.js.map +1 -0
- package/lib-amd/components/Button/Button.js +16 -0
- package/lib-amd/components/Button/Button.js.map +1 -0
- package/lib-amd/components/Button/Button.types.js +5 -0
- package/lib-amd/components/Button/Button.types.js.map +1 -0
- package/lib-amd/components/Button/index.js +11 -0
- package/lib-amd/components/Button/index.js.map +1 -0
- package/lib-amd/components/Button/renderButton.js +18 -0
- package/lib-amd/components/Button/renderButton.js.map +1 -0
- package/lib-amd/components/Button/useButton.js +40 -0
- package/lib-amd/components/Button/useButton.js.map +1 -0
- package/lib-amd/components/Button/useButtonStyles.js +187 -0
- package/lib-amd/components/Button/useButtonStyles.js.map +1 -0
- package/lib-amd/components/CompoundButton/CompoundButton.js +16 -0
- package/lib-amd/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib-amd/components/CompoundButton/CompoundButton.types.js +5 -0
- package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib-amd/components/CompoundButton/index.js +12 -0
- package/lib-amd/components/CompoundButton/index.js.map +1 -0
- package/lib-amd/components/CompoundButton/renderCompoundButton.js +20 -0
- package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib-amd/components/CompoundButton/useCompoundButton.js +27 -0
- package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js +211 -0
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib-amd/components/MenuButton/MenuButton.js +17 -0
- package/lib-amd/components/MenuButton/MenuButton.js.map +1 -0
- package/lib-amd/components/MenuButton/MenuButton.types.js +5 -0
- package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib-amd/components/MenuButton/index.js +12 -0
- package/lib-amd/components/MenuButton/index.js.map +1 -0
- package/lib-amd/components/MenuButton/renderMenuButton.js +18 -0
- package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib-amd/components/MenuButton/useMenuButton.js +30 -0
- package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js +97 -0
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.js +17 -0
- package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-amd/components/SplitButton/index.js +12 -0
- package/lib-amd/components/SplitButton/index.js.map +1 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButton.js +67 -0
- package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js +147 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-amd/components/ToggleButton/ToggleButton.js +16 -0
- package/lib-amd/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib-amd/components/ToggleButton/ToggleButton.types.js +5 -0
- package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib-amd/components/ToggleButton/index.js +12 -0
- package/lib-amd/components/ToggleButton/index.js.map +1 -0
- package/lib-amd/components/ToggleButton/renderToggleButton.js +7 -0
- package/lib-amd/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib-amd/components/ToggleButton/useToggleButton.js +17 -0
- package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js +75 -0
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib-amd/index.js +32 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/utils/index.js +6 -0
- package/lib-amd/utils/index.js.map +1 -0
- package/lib-amd/utils/useToggleState.js +27 -0
- package/lib-amd/utils/useToggleState.js.map +1 -0
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +9 -12
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +64 -3
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +16 -15
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/useToggleState.js.map +1 -1
- package/package.json +13 -13
@@ -0,0 +1,211 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-theme", "@griffel/react", "../Button/useButtonStyles"], function (require, exports, tslib_1, react_theme_1, react_1, useButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.useCompoundButtonStyles_unstable = exports.compoundButtonClassNames = void 0;
|
6
|
+
exports.compoundButtonClassNames = {
|
7
|
+
root: 'fui-CompoundButton',
|
8
|
+
icon: 'fui-CompoundButton__icon',
|
9
|
+
contentContainer: 'fui-CompoundButton__contentContainer',
|
10
|
+
secondaryContent: 'fui-CompoundButton__secondaryContent',
|
11
|
+
};
|
12
|
+
var useRootStyles = react_1.makeStyles({
|
13
|
+
// Base styles
|
14
|
+
base: (_a = {
|
15
|
+
height: 'auto'
|
16
|
+
},
|
17
|
+
_a["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
18
|
+
color: react_theme_1.tokens.colorNeutralForeground2,
|
19
|
+
},
|
20
|
+
_a[':hover'] = (_b = {},
|
21
|
+
_b["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
22
|
+
color: react_theme_1.tokens.colorNeutralForeground2Hover,
|
23
|
+
},
|
24
|
+
_b),
|
25
|
+
_a[':hover:active'] = (_c = {},
|
26
|
+
_c["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
27
|
+
color: react_theme_1.tokens.colorNeutralForeground2Pressed,
|
28
|
+
},
|
29
|
+
_c),
|
30
|
+
_a),
|
31
|
+
// High contrast styles
|
32
|
+
highContrast: {
|
33
|
+
'@media (forced-colors: active)': {
|
34
|
+
':hover': (_d = {},
|
35
|
+
_d["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
36
|
+
color: 'Highlight',
|
37
|
+
},
|
38
|
+
_d),
|
39
|
+
':hover:active': (_e = {},
|
40
|
+
_e["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
41
|
+
color: 'Highlight',
|
42
|
+
},
|
43
|
+
_e),
|
44
|
+
},
|
45
|
+
},
|
46
|
+
// Appearance variations
|
47
|
+
outline: {
|
48
|
+
/* No styles */
|
49
|
+
},
|
50
|
+
primary: (_f = {},
|
51
|
+
_f["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
52
|
+
color: react_theme_1.tokens.colorNeutralForegroundOnBrand,
|
53
|
+
},
|
54
|
+
_f[':hover'] = (_g = {},
|
55
|
+
_g["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
56
|
+
color: react_theme_1.tokens.colorNeutralForegroundOnBrand,
|
57
|
+
},
|
58
|
+
_g),
|
59
|
+
_f[':hover:active'] = (_h = {},
|
60
|
+
_h["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
61
|
+
color: react_theme_1.tokens.colorNeutralForegroundOnBrand,
|
62
|
+
},
|
63
|
+
_h),
|
64
|
+
_f),
|
65
|
+
secondary: {
|
66
|
+
/* The secondary styles are exactly the same as the base styles. */
|
67
|
+
},
|
68
|
+
subtle: (_j = {},
|
69
|
+
_j["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
70
|
+
color: react_theme_1.tokens.colorNeutralForeground2,
|
71
|
+
},
|
72
|
+
_j[':hover'] = (_k = {},
|
73
|
+
_k["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
74
|
+
color: react_theme_1.tokens.colorNeutralForeground2Hover,
|
75
|
+
},
|
76
|
+
_k),
|
77
|
+
_j[':hover:active'] = (_l = {},
|
78
|
+
_l["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
79
|
+
color: react_theme_1.tokens.colorNeutralForeground2Pressed,
|
80
|
+
},
|
81
|
+
_l),
|
82
|
+
_j),
|
83
|
+
transparent: (_m = {},
|
84
|
+
_m["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
85
|
+
color: react_theme_1.tokens.colorNeutralForeground2,
|
86
|
+
},
|
87
|
+
_m[':hover'] = (_o = {},
|
88
|
+
_o["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
89
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandHover,
|
90
|
+
},
|
91
|
+
_o),
|
92
|
+
_m[':hover:active'] = (_p = {},
|
93
|
+
_p["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
94
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandPressed,
|
95
|
+
},
|
96
|
+
_p),
|
97
|
+
_m),
|
98
|
+
// Size variations
|
99
|
+
small: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalS, react_theme_1.tokens.spacingHorizontalS, react_theme_1.tokens.spacingHorizontalMNudge, react_theme_1.tokens.spacingHorizontalS)), { fontSize: react_theme_1.tokens.fontSizeBase300, lineHeight: react_theme_1.tokens.lineHeightBase300 }),
|
100
|
+
medium: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding('14px', react_theme_1.tokens.spacingHorizontalM, react_theme_1.tokens.spacingHorizontalL, react_theme_1.tokens.spacingHorizontalM)), { fontSize: react_theme_1.tokens.fontSizeBase300, lineHeight: react_theme_1.tokens.lineHeightBase300 }),
|
101
|
+
large: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding('18px', react_theme_1.tokens.spacingHorizontalL, react_theme_1.tokens.spacingHorizontalXL, react_theme_1.tokens.spacingHorizontalL)), { fontSize: react_theme_1.tokens.fontSizeBase400, lineHeight: react_theme_1.tokens.lineHeightBase400 }),
|
102
|
+
// Disabled styles
|
103
|
+
disabled: (_q = {},
|
104
|
+
_q["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
105
|
+
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
106
|
+
},
|
107
|
+
_q[':hover'] = (_r = {},
|
108
|
+
_r["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
109
|
+
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
110
|
+
},
|
111
|
+
_r),
|
112
|
+
_q[':hover:active'] = (_s = {},
|
113
|
+
_s["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
114
|
+
color: react_theme_1.tokens.colorNeutralForegroundDisabled,
|
115
|
+
},
|
116
|
+
_s),
|
117
|
+
_q),
|
118
|
+
// Disabled high contrast styles
|
119
|
+
disabledHighContrast: {
|
120
|
+
'@media (forced-colors: active)': (_t = {},
|
121
|
+
_t["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
122
|
+
color: 'GrayText',
|
123
|
+
},
|
124
|
+
_t[':hover'] = (_u = {},
|
125
|
+
_u["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
126
|
+
color: 'GrayText',
|
127
|
+
},
|
128
|
+
_u),
|
129
|
+
_t[':hover:active'] = (_v = {},
|
130
|
+
_v["& ." + exports.compoundButtonClassNames.secondaryContent] = {
|
131
|
+
color: 'GrayText',
|
132
|
+
},
|
133
|
+
_v),
|
134
|
+
_t),
|
135
|
+
},
|
136
|
+
});
|
137
|
+
var useRootIconOnlyStyles = react_1.makeStyles({
|
138
|
+
// Size variations
|
139
|
+
small: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalXS)), { maxWidth: '48px', minWidth: '48px' }),
|
140
|
+
medium: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalSNudge)), { maxWidth: '52px', minWidth: '52px' }),
|
141
|
+
large: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.padding(react_theme_1.tokens.spacingHorizontalS)), { maxWidth: '56px', minWidth: '56px' }),
|
142
|
+
});
|
143
|
+
var useIconStyles = react_1.makeStyles({
|
144
|
+
// Base styles
|
145
|
+
base: {
|
146
|
+
fontSize: '40px',
|
147
|
+
height: '40px',
|
148
|
+
width: '40px',
|
149
|
+
},
|
150
|
+
// Icon position variations
|
151
|
+
before: {
|
152
|
+
marginRight: react_theme_1.tokens.spacingHorizontalM,
|
153
|
+
},
|
154
|
+
after: {
|
155
|
+
marginLeft: react_theme_1.tokens.spacingHorizontalM,
|
156
|
+
},
|
157
|
+
});
|
158
|
+
var useContentContainerStyles = react_1.makeStyles({
|
159
|
+
// Base styles
|
160
|
+
base: {
|
161
|
+
display: 'flex',
|
162
|
+
flexDirection: 'column',
|
163
|
+
textAlign: 'left',
|
164
|
+
},
|
165
|
+
});
|
166
|
+
var useSecondaryContentStyles = react_1.makeStyles({
|
167
|
+
// Base styles
|
168
|
+
base: {
|
169
|
+
lineHeight: '100%',
|
170
|
+
fontWeight: react_theme_1.tokens.fontWeightRegular,
|
171
|
+
},
|
172
|
+
// Size variations
|
173
|
+
small: {
|
174
|
+
fontSize: react_theme_1.tokens.fontSizeBase200,
|
175
|
+
},
|
176
|
+
medium: {
|
177
|
+
fontSize: react_theme_1.tokens.fontSizeBase200,
|
178
|
+
},
|
179
|
+
large: {
|
180
|
+
fontSize: react_theme_1.tokens.fontSizeBase300,
|
181
|
+
},
|
182
|
+
});
|
183
|
+
var useCompoundButtonStyles_unstable = function (state) {
|
184
|
+
var rootStyles = useRootStyles();
|
185
|
+
var rootIconOnlyStyles = useRootIconOnlyStyles();
|
186
|
+
var iconStyles = useIconStyles();
|
187
|
+
var contentContainerStyles = useContentContainerStyles();
|
188
|
+
var secondaryContentStyles = useSecondaryContentStyles();
|
189
|
+
var appearance = state.appearance, disabled = state.disabled, disabledFocusable = state.disabledFocusable, iconOnly = state.iconOnly, iconPosition = state.iconPosition, size = state.size;
|
190
|
+
state.root.className = react_1.mergeClasses(exports.compoundButtonClassNames.root,
|
191
|
+
// Root styles
|
192
|
+
rootStyles.base, rootStyles.highContrast, appearance && rootStyles[appearance], rootStyles[size],
|
193
|
+
// Disabled styles
|
194
|
+
(disabled || disabledFocusable) && rootStyles.disabled, (disabled || disabledFocusable) && rootStyles.disabledHighContrast,
|
195
|
+
// Icon-only styles
|
196
|
+
iconOnly && rootIconOnlyStyles[size],
|
197
|
+
// User provided class name
|
198
|
+
state.root.className);
|
199
|
+
state.contentContainer.className = react_1.mergeClasses(exports.compoundButtonClassNames.contentContainer, contentContainerStyles.base, state.contentContainer.className);
|
200
|
+
if (state.icon) {
|
201
|
+
state.icon.className = react_1.mergeClasses(exports.compoundButtonClassNames.icon, iconStyles.base, state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition], state.icon.className);
|
202
|
+
}
|
203
|
+
if (state.secondaryContent) {
|
204
|
+
state.secondaryContent.className = react_1.mergeClasses(exports.compoundButtonClassNames.secondaryContent, secondaryContentStyles.base, secondaryContentStyles[size], state.secondaryContent.className);
|
205
|
+
}
|
206
|
+
useButtonStyles_1.useButtonStyles_unstable(state);
|
207
|
+
return state;
|
208
|
+
};
|
209
|
+
exports.useCompoundButtonStyles_unstable = useCompoundButtonStyles_unstable;
|
210
|
+
});
|
211
|
+
//# sourceMappingURL=useCompoundButtonStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useCompoundButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":";;;;;IAMa,QAAA,wBAAwB,GAAwC;QAC3E,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,0BAA0B;QAChC,gBAAgB,EAAE,sCAAsC;QACxD,gBAAgB,EAAE,sCAAsC;KACzD,CAAC;IAEF,IAAM,aAAa,GAAG,kBAAU,CAAC;QAC/B,cAAc;QACd,IAAI;gBACF,MAAM,EAAE,MAAM;;YAEd,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;gBACnD,KAAK,EAAE,oBAAM,CAAC,uBAAuB;aACtC;YAED,YAAQ;gBACN,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;oBACnD,KAAK,EAAE,oBAAM,CAAC,4BAA4B;iBAC3C;mBACF;YAED,mBAAe;gBACb,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;oBACnD,KAAK,EAAE,oBAAM,CAAC,8BAA8B;iBAC7C;mBACF;eACF;QAED,uBAAuB;QACvB,YAAY,EAAE;YACZ,gCAAgC,EAAE;gBAChC,QAAQ;oBACN,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;wBACnD,KAAK,EAAE,WAAW;qBACnB;uBACF;gBAED,eAAe;oBACb,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;wBACnD,KAAK,EAAE,WAAW;qBACnB;uBACF;aACF;SACF;QAED,wBAAwB;QACxB,OAAO,EAAE;QACP,eAAe;SAChB;QACD,OAAO;YACL,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;gBACnD,KAAK,EAAE,oBAAM,CAAC,6BAA6B;aAC5C;YAED,YAAQ;gBACN,GAAC,QAAM,gCAAwB,CAAC,gBAAkB,IAAG;oBACnD,KAAK,EAAE,oBAAM,CAAC,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,CAAC,SAAS,CACrB,CAAC;SACH;QAED,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC1B,KAAK,CAAC,gBAAgB,CAAC,SAAS,GAAG,oBAAY,CAC7C,gCAAwB,CAAC,gBAAgB,EACzC,sBAAsB,CAAC,IAAI,EAC3B,sBAAsB,CAAC,IAAI,CAAC,EAC5B,KAAK,CAAC,gBAAgB,CAAC,SAAS,CACjC,CAAC;SACH;QAED,0CAAwB,CAAC,KAAK,CAAC,CAAC;QAEhC,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAxDW,QAAA,gCAAgC,oCAwD3C","sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { CompoundButtonSlots, CompoundButtonState } from './CompoundButton.types';\n\nexport const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots> = {\n root: 'fui-CompoundButton',\n icon: 'fui-CompoundButton__icon',\n contentContainer: 'fui-CompoundButton__contentContainer',\n secondaryContent: 'fui-CompoundButton__secondaryContent',\n};\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n height: 'auto',\n\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n },\n\n // High contrast styles\n highContrast: {\n '@media (forced-colors: active)': {\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'Highlight',\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'Highlight',\n },\n },\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundOnBrand,\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Hover,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2Pressed,\n },\n },\n },\n transparent: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2BrandHover,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForeground2BrandPressed,\n },\n },\n },\n\n // Size variations\n small: {\n ...shorthands.padding(\n tokens.spacingHorizontalS,\n tokens.spacingHorizontalS,\n tokens.spacingHorizontalMNudge,\n tokens.spacingHorizontalS,\n ),\n\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n medium: {\n ...shorthands.padding('14px', tokens.spacingHorizontalM, tokens.spacingHorizontalL, tokens.spacingHorizontalM),\n\n fontSize: tokens.fontSizeBase300,\n lineHeight: tokens.lineHeightBase300,\n },\n large: {\n ...shorthands.padding('18px', tokens.spacingHorizontalL, tokens.spacingHorizontalXL, tokens.spacingHorizontalL),\n\n fontSize: tokens.fontSizeBase400,\n lineHeight: tokens.lineHeightBase400,\n },\n\n // Disabled styles\n disabled: {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: tokens.colorNeutralForegroundDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'GrayText',\n },\n\n ':hover': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'GrayText',\n },\n },\n\n ':hover:active': {\n [`& .${compoundButtonClassNames.secondaryContent}`]: {\n color: 'GrayText',\n },\n },\n },\n },\n});\n\nconst useRootIconOnlyStyles = makeStyles({\n // Size variations\n small: {\n ...shorthands.padding(tokens.spacingHorizontalXS),\n\n maxWidth: '48px',\n minWidth: '48px',\n },\n medium: {\n ...shorthands.padding(tokens.spacingHorizontalSNudge),\n\n maxWidth: '52px',\n minWidth: '52px',\n },\n large: {\n ...shorthands.padding(tokens.spacingHorizontalS),\n\n maxWidth: '56px',\n minWidth: '56px',\n },\n});\n\nconst useIconStyles = makeStyles({\n // Base styles\n base: {\n fontSize: '40px',\n height: '40px',\n width: '40px',\n },\n\n // Icon position variations\n before: {\n marginRight: tokens.spacingHorizontalM,\n },\n after: {\n marginLeft: tokens.spacingHorizontalM,\n },\n});\n\nconst useContentContainerStyles = makeStyles({\n // Base styles\n base: {\n display: 'flex',\n flexDirection: 'column',\n textAlign: 'left',\n },\n});\n\nconst useSecondaryContentStyles = makeStyles({\n // Base styles\n base: {\n lineHeight: '100%',\n fontWeight: tokens.fontWeightRegular,\n },\n\n // Size variations\n small: {\n fontSize: tokens.fontSizeBase200,\n },\n medium: {\n fontSize: tokens.fontSizeBase200,\n },\n large: {\n fontSize: tokens.fontSizeBase300,\n },\n});\n\nexport const useCompoundButtonStyles_unstable = (state: CompoundButtonState): CompoundButtonState => {\n const rootStyles = useRootStyles();\n const rootIconOnlyStyles = useRootIconOnlyStyles();\n const iconStyles = useIconStyles();\n const contentContainerStyles = useContentContainerStyles();\n const secondaryContentStyles = useSecondaryContentStyles();\n\n const { appearance, disabled, disabledFocusable, iconOnly, iconPosition, size } = state;\n\n state.root.className = mergeClasses(\n compoundButtonClassNames.root,\n\n // Root styles\n rootStyles.base,\n rootStyles.highContrast,\n appearance && rootStyles[appearance],\n rootStyles[size],\n\n // Disabled styles\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\n\n // Icon-only styles\n iconOnly && rootIconOnlyStyles[size],\n\n // User provided class name\n state.root.className,\n );\n\n state.contentContainer.className = mergeClasses(\n compoundButtonClassNames.contentContainer,\n contentContainerStyles.base,\n state.contentContainer.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n compoundButtonClassNames.icon,\n iconStyles.base,\n state.root.children !== undefined && state.root.children !== null && iconStyles[iconPosition],\n state.icon.className,\n );\n }\n\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(\n compoundButtonClassNames.secondaryContent,\n secondaryContentStyles.base,\n secondaryContentStyles[size],\n state.secondaryContent.className,\n );\n }\n\n useButtonStyles_unstable(state);\n\n return state;\n};\n"]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
define(["require", "exports", "react", "./renderMenuButton", "./useMenuButton", "./useMenuButtonStyles"], function (require, exports, React, renderMenuButton_1, useMenuButton_1, useMenuButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.MenuButton = void 0;
|
5
|
+
/**
|
6
|
+
* MenuButtons are buttons that have a chevron icon after the button contents and are usually clicked to open/close
|
7
|
+
* menus.
|
8
|
+
*/
|
9
|
+
exports.MenuButton = React.forwardRef(function (props, ref) {
|
10
|
+
var state = useMenuButton_1.useMenuButton_unstable(props, ref);
|
11
|
+
useMenuButtonStyles_1.useMenuButtonStyles_unstable(state);
|
12
|
+
return renderMenuButton_1.renderMenuButton_unstable(state);
|
13
|
+
// Casting is required due to lack of distributive union to support unions on @types/react
|
14
|
+
});
|
15
|
+
exports.MenuButton.displayName = 'MenuButton';
|
16
|
+
});
|
17
|
+
//# sourceMappingURL=MenuButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";;;;IAOA;;;OAGG;IACU,QAAA,UAAU,GAAyC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC1F,IAAM,KAAK,GAAG,sCAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEjD,kDAA4B,CAAC,KAAK,CAAC,CAAC;QAEpC,OAAO,4CAAyB,CAAC,KAAK,CAAC,CAAC;QACxC,0FAA0F;IAC5F,CAAC,CAAyC,CAAC;IAE3C,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import * as React from 'react';\nimport { renderMenuButton_unstable } from './renderMenuButton';\nimport { useMenuButton_unstable } from './useMenuButton';\nimport { useMenuButtonStyles_unstable } from './useMenuButtonStyles';\nimport type { MenuButtonProps } from './MenuButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * MenuButtons are buttons that have a chevron icon after the button contents and are usually clicked to open/close\n * menus.\n */\nexport const MenuButton: ForwardRefComponent<MenuButtonProps> = React.forwardRef((props, ref) => {\n const state = useMenuButton_unstable(props, ref);\n\n useMenuButtonStyles_unstable(state);\n\n return renderMenuButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<MenuButtonProps>;\n\nMenuButton.displayName = 'MenuButton';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MenuButton.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/MenuButton/MenuButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonSlots, ButtonState } from '../Button/Button.types';\n\nexport type MenuButtonSlots = ButtonSlots & {\n /**\n * Menu icon that indicates that this button has a menu that can be expanded.\n */\n menuIcon?: Slot<'span'>;\n};\n\nexport type MenuButtonProps = ComponentProps<MenuButtonSlots> &\n Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'shape' | 'size'>;\n\nexport type MenuButtonState = ComponentState<MenuButtonSlots> &\n Omit<ButtonState, keyof ButtonSlots | 'components' | 'iconPosition'>;\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./MenuButton.types", "./MenuButton", "./renderMenuButton", "./useMenuButton", "./useMenuButtonStyles"], function (require, exports, tslib_1, MenuButton_types_1, MenuButton_1, renderMenuButton_1, useMenuButton_1, useMenuButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useMenuButtonStyles_unstable = exports.menuButtonClassNames = void 0;
|
5
|
+
tslib_1.__exportStar(MenuButton_types_1, exports);
|
6
|
+
tslib_1.__exportStar(MenuButton_1, exports);
|
7
|
+
tslib_1.__exportStar(renderMenuButton_1, exports);
|
8
|
+
tslib_1.__exportStar(useMenuButton_1, exports);
|
9
|
+
Object.defineProperty(exports, "menuButtonClassNames", { enumerable: true, get: function () { return useMenuButtonStyles_1.menuButtonClassNames; } });
|
10
|
+
Object.defineProperty(exports, "useMenuButtonStyles_unstable", { enumerable: true, get: function () { return useMenuButtonStyles_1.useMenuButtonStyles_unstable; } });
|
11
|
+
});
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/MenuButton/index.ts"],"names":[],"mappings":";;;;IAAA,kDAAmC;IACnC,4CAA6B;IAC7B,kDAAmC;IACnC,+CAAgC;IACvB,2HAAA,oBAAoB,OAAA;IAAE,mIAAA,4BAA4B,OAAA","sourcesContent":["export * from './MenuButton.types';\nexport * from './MenuButton';\nexport * from './renderMenuButton';\nexport * from './useMenuButton';\nexport { menuButtonClassNames, useMenuButtonStyles_unstable } from './useMenuButtonStyles';\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.renderMenuButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Renders a MenuButton component by passing the state defined props to the appropriate slots.
|
7
|
+
*/
|
8
|
+
var renderMenuButton_unstable = function (state) {
|
9
|
+
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
10
|
+
var icon = state.icon, iconOnly = state.iconOnly;
|
11
|
+
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
12
|
+
slots.icon && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
|
13
|
+
!iconOnly && slotProps.root.children,
|
14
|
+
(!iconOnly || !(icon === null || icon === void 0 ? void 0 : icon.children)) && slots.menuIcon && React.createElement(slots.menuIcon, tslib_1.__assign({}, slotProps.menuIcon))));
|
15
|
+
};
|
16
|
+
exports.renderMenuButton_unstable = renderMenuButton_unstable;
|
17
|
+
});
|
18
|
+
//# sourceMappingURL=renderMenuButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderMenuButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,yBAAyB,GAAG,UAAC,KAAsB;QACxD,IAAA,KAAuB,0BAAQ,CAAkB,KAAK,CAAC,EAArD,KAAK,WAAA,EAAE,SAAS,eAAqC,CAAC;QACtD,IAAA,IAAI,GAAe,KAAK,KAApB,EAAE,QAAQ,GAAK,KAAK,SAAV,CAAW;QAEjC,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAChD,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ;YACpC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAA,CAAC,IAAI,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI,CACpF,CACd,CAAC;IACJ,CAAC,CAAC;IAXW,QAAA,yBAAyB,6BAWpC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\n\n/**\n * Renders a MenuButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderMenuButton_unstable = (state: MenuButtonState) => {\n const { slots, slotProps } = getSlots<MenuButtonSlots>(state);\n const { icon, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {!iconOnly && slotProps.root.children}\n {(!iconOnly || !icon?.children) && slots.menuIcon && <slots.menuIcon {...slotProps.menuIcon} />}\n </slots.root>\n );\n};\n"]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-icons", "@fluentui/react-utilities", "../Button/index"], function (require, exports, tslib_1, React, react_icons_1, react_utilities_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useMenuButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Given user props, returns the final state for a MenuButton.
|
7
|
+
*/
|
8
|
+
var useMenuButton_unstable = function (_a, ref) {
|
9
|
+
var _b;
|
10
|
+
var menuIcon = _a.menuIcon, props = tslib_1.__rest(_a, ["menuIcon"]);
|
11
|
+
var buttonState = index_1.useButton_unstable(props, ref);
|
12
|
+
buttonState.root['aria-expanded'] = (_b = props['aria-expanded']) !== null && _b !== void 0 ? _b : false;
|
13
|
+
return tslib_1.__assign(tslib_1.__assign({}, buttonState), {
|
14
|
+
// State calculated from a set of props
|
15
|
+
iconOnly: Boolean(!props.children),
|
16
|
+
// Slots definition
|
17
|
+
components: {
|
18
|
+
root: 'button',
|
19
|
+
icon: 'span',
|
20
|
+
menuIcon: 'span',
|
21
|
+
}, menuIcon: react_utilities_1.resolveShorthand(menuIcon, {
|
22
|
+
defaultProps: {
|
23
|
+
children: React.createElement(react_icons_1.ChevronDownRegular, null),
|
24
|
+
},
|
25
|
+
required: true,
|
26
|
+
}) });
|
27
|
+
};
|
28
|
+
exports.useMenuButton_unstable = useMenuButton_unstable;
|
29
|
+
});
|
30
|
+
//# sourceMappingURL=useMenuButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useMenuButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/MenuButton/useMenuButton.tsx"],"names":[],"mappings":";;;;IAMA;;OAEG;IACI,IAAM,sBAAsB,GAAG,UACpC,EAAuC,EACvC,GAAqD;;QADnD,IAAA,QAAQ,cAAA,EAAK,KAAK,sBAApB,YAAsB,CAAF;QAGpB,IAAM,WAAW,GAAG,0BAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACnD,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,MAAA,KAAK,CAAC,eAAe,CAAC,mCAAI,KAAK,CAAC;QAEpE,6CAEK,WAAW;YAEd,uCAAuC;YACvC,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;YAElC,mBAAmB;YACnB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,MAAM;aACjB,EAED,QAAQ,EAAE,kCAAgB,CAAC,QAAQ,EAAE;gBACnC,YAAY,EAAE;oBACZ,QAAQ,EAAE,oBAAC,gCAAkB,OAAG;iBACjC;gBACD,QAAQ,EAAE,IAAI;aACf,CAAC,IACF;IACJ,CAAC,CAAC;IA5BW,QAAA,sBAAsB,0BA4BjC","sourcesContent":["import * as React from 'react';\nimport { ChevronDownRegular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { useButton_unstable } from '../Button/index';\nimport type { MenuButtonProps, MenuButtonState } from './MenuButton.types';\n\n/**\n * Given user props, returns the final state for a MenuButton.\n */\nexport const useMenuButton_unstable = (\n { menuIcon, ...props }: MenuButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): MenuButtonState => {\n const buttonState = useButton_unstable(props, ref);\n buttonState.root['aria-expanded'] = props['aria-expanded'] ?? false;\n\n return {\n // Button state\n ...buttonState,\n\n // State calculated from a set of props\n iconOnly: Boolean(!props.children),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n menuIcon: 'span',\n },\n\n menuIcon: resolveShorthand(menuIcon, {\n defaultProps: {\n children: <ChevronDownRegular />,\n },\n required: true,\n }),\n };\n};\n"]}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-icons", "@fluentui/react-theme", "@griffel/react", "../Button/useButtonStyles"], function (require, exports, tslib_1, react_icons_1, react_theme_1, react_1, useButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
var _a;
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
+
exports.useMenuButtonStyles_unstable = exports.menuButtonClassNames = void 0;
|
6
|
+
exports.menuButtonClassNames = {
|
7
|
+
root: 'fui-MenuButton',
|
8
|
+
icon: 'fui-MenuButton__icon',
|
9
|
+
menuIcon: 'fui-MenuButton__menuIcon',
|
10
|
+
};
|
11
|
+
var useRootExpandedStyles = react_1.makeStyles({
|
12
|
+
base: (_a = {},
|
13
|
+
_a["& ." + react_icons_1.iconFilledClassName] = {
|
14
|
+
display: 'inline',
|
15
|
+
},
|
16
|
+
_a["& ." + react_icons_1.iconRegularClassName] = {
|
17
|
+
display: 'none',
|
18
|
+
},
|
19
|
+
_a),
|
20
|
+
// Appearance variations
|
21
|
+
outline: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Selected)), react_1.shorthands.borderWidth(react_theme_1.tokens.strokeWidthThicker)), { color: react_theme_1.tokens.colorNeutralForeground1Selected }),
|
22
|
+
primary: {
|
23
|
+
backgroundColor: react_theme_1.tokens.colorBrandBackgroundSelected,
|
24
|
+
},
|
25
|
+
secondary: tslib_1.__assign(tslib_1.__assign({ backgroundColor: react_theme_1.tokens.colorNeutralBackground1Selected }, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Selected)), { color: react_theme_1.tokens.colorNeutralForeground1Selected }),
|
26
|
+
subtle: {
|
27
|
+
backgroundColor: react_theme_1.tokens.colorSubtleBackgroundSelected,
|
28
|
+
color: react_theme_1.tokens.colorNeutralForeground2Selected,
|
29
|
+
},
|
30
|
+
transparent: {
|
31
|
+
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundSelected,
|
32
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandSelected,
|
33
|
+
},
|
34
|
+
});
|
35
|
+
var useIconExpandedStyles = react_1.makeStyles({
|
36
|
+
// Appearance variations
|
37
|
+
outline: {
|
38
|
+
color: react_theme_1.tokens.colorNeutralForeground1Selected,
|
39
|
+
},
|
40
|
+
primary: {
|
41
|
+
/* The primary styles are exactly the same as the base styles. */
|
42
|
+
},
|
43
|
+
secondary: {
|
44
|
+
color: react_theme_1.tokens.colorNeutralForeground1Selected,
|
45
|
+
},
|
46
|
+
subtle: {
|
47
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandSelected,
|
48
|
+
},
|
49
|
+
transparent: {
|
50
|
+
color: react_theme_1.tokens.colorNeutralForeground2BrandSelected,
|
51
|
+
},
|
52
|
+
});
|
53
|
+
var useMenuIconStyles = react_1.makeStyles({
|
54
|
+
base: {
|
55
|
+
lineHeight: 0,
|
56
|
+
},
|
57
|
+
// Size appearance
|
58
|
+
small: {
|
59
|
+
fontSize: '12px',
|
60
|
+
height: '12px',
|
61
|
+
lineHeight: react_theme_1.tokens.lineHeightBase200,
|
62
|
+
width: '12px',
|
63
|
+
},
|
64
|
+
medium: {
|
65
|
+
fontSize: '12px',
|
66
|
+
height: '12px',
|
67
|
+
lineHeight: react_theme_1.tokens.lineHeightBase200,
|
68
|
+
width: '12px',
|
69
|
+
},
|
70
|
+
large: {
|
71
|
+
fontSize: '16px',
|
72
|
+
height: '16px',
|
73
|
+
lineHeight: react_theme_1.tokens.lineHeightBase400,
|
74
|
+
width: '16px',
|
75
|
+
},
|
76
|
+
// Not-icon only
|
77
|
+
notIconOnly: {
|
78
|
+
marginLeft: react_theme_1.tokens.spacingHorizontalXS,
|
79
|
+
},
|
80
|
+
});
|
81
|
+
var useMenuButtonStyles_unstable = function (state) {
|
82
|
+
var rootExpandedStyles = useRootExpandedStyles();
|
83
|
+
var iconExpandedStyles = useIconExpandedStyles();
|
84
|
+
var menuIconStyles = useMenuIconStyles();
|
85
|
+
state.root.className = react_1.mergeClasses(exports.menuButtonClassNames.root, state.root['aria-expanded'] && rootExpandedStyles.base, state.root['aria-expanded'] && rootExpandedStyles[state.appearance], state.root.className);
|
86
|
+
if (state.icon) {
|
87
|
+
state.icon.className = react_1.mergeClasses(exports.menuButtonClassNames.icon, state.root['aria-expanded'] && iconExpandedStyles[state.appearance], state.icon.className);
|
88
|
+
}
|
89
|
+
if (state.menuIcon) {
|
90
|
+
state.menuIcon.className = react_1.mergeClasses(exports.menuButtonClassNames.menuIcon, menuIconStyles.base, menuIconStyles[state.size], !state.iconOnly && menuIconStyles.notIconOnly, state.menuIcon.className);
|
91
|
+
}
|
92
|
+
useButtonStyles_1.useButtonStyles_unstable(tslib_1.__assign(tslib_1.__assign({}, state), { iconPosition: 'before' }));
|
93
|
+
return state;
|
94
|
+
};
|
95
|
+
exports.useMenuButtonStyles_unstable = useMenuButtonStyles_unstable;
|
96
|
+
});
|
97
|
+
//# sourceMappingURL=useMenuButtonStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useMenuButtonStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;;IAOa,QAAA,oBAAoB,GAAoC;QACnE,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE,0BAA0B;KACrC,CAAC;IAEF,IAAM,qBAAqB,GAAG,kBAAU,CAAC;QACvC,IAAI;YACF,GAAC,QAAM,iCAAqB,IAAG;gBAC7B,OAAO,EAAE,QAAQ;aAClB;YACD,GAAC,QAAM,kCAAsB,IAAG;gBAC9B,OAAO,EAAE,MAAM;aAChB;eACF;QAED,wBAAwB;QACxB,OAAO,yDACF,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,2BAA2B,CAAC,GAC1D,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,kBAAkB,CAAC,KACpD,KAAK,EAAE,oBAAM,CAAC,+BAA+B,GAC9C;QACD,OAAO,EAAE;YACP,eAAe,EAAE,oBAAM,CAAC,4BAA4B;SACrD;QACD,SAAS,sCACP,eAAe,EAAE,oBAAM,CAAC,+BAA+B,IACpD,kBAAU,CAAC,WAAW,CAAC,oBAAM,CAAC,2BAA2B,CAAC,KAC7D,KAAK,EAAE,oBAAM,CAAC,+BAA+B,GAC9C;QACD,MAAM,EAAE;YACN,eAAe,EAAE,oBAAM,CAAC,6BAA6B;YACrD,KAA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AAC;QACnD,IAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;QAE3C,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,4BAAoB,CAAC,IAAI,EACzB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC,IAAI,EACtD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,EACnE,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;QAEF,IAAI,KAAK,CAAC,IAAI,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,oBAAY,CACjC,4BAAoB,CAAC,IAAI,EACzB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,EACnE,KAAK,CAAC,IAAI,CAAC,SAAS,CACrB,CAAC;SACH;QAED,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClB,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,oBAAY,CACrC,4BAAoB,CAAC,QAAQ,EAC7B,cAAc,CAAC,IAAI,EACnB,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAC1B,CAAC,KAAK,CAAC,QAAQ,IAAI,cAAc,CAAC,WAAW,EAC7C,KAAK,CAAC,QAAQ,CAAC,SAAS,CACzB,CAAC;SACH;QAED,0CAAwB,uCAAM,KAAK,KAAE,YAAY,EAAE,QAAQ,IAAG,CAAC;QAE/D,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAjCW,QAAA,4BAA4B,gCAiCvC","sourcesContent":["import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\n\nexport const menuButtonClassNames: SlotClassNames<MenuButtonSlots> = {\n root: 'fui-MenuButton',\n icon: 'fui-MenuButton__icon',\n menuIcon: 'fui-MenuButton__menuIcon',\n};\n\nconst useRootExpandedStyles = makeStyles({\n base: {\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n },\n\n // Appearance variations\n outline: {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n color: tokens.colorNeutralForeground1Selected,\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n },\n secondary: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n color: tokens.colorNeutralForeground1Selected,\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nconst useIconExpandedStyles = makeStyles({\n // Appearance variations\n outline: {\n color: tokens.colorNeutralForeground1Selected,\n },\n primary: {\n /* The primary styles are exactly the same as the base styles. */\n },\n secondary: {\n color: tokens.colorNeutralForeground1Selected,\n },\n subtle: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n transparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nconst useMenuIconStyles = makeStyles({\n base: {\n lineHeight: 0,\n },\n\n // Size appearance\n small: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n medium: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n large: {\n fontSize: '16px',\n height: '16px',\n lineHeight: tokens.lineHeightBase400,\n width: '16px',\n },\n\n // Not-icon only\n notIconOnly: {\n marginLeft: tokens.spacingHorizontalXS,\n },\n});\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n const rootExpandedStyles = useRootExpandedStyles();\n const iconExpandedStyles = useIconExpandedStyles();\n const menuIconStyles = useMenuIconStyles();\n\n state.root.className = mergeClasses(\n menuButtonClassNames.root,\n state.root['aria-expanded'] && rootExpandedStyles.base,\n state.root['aria-expanded'] && rootExpandedStyles[state.appearance],\n state.root.className,\n );\n\n if (state.icon) {\n state.icon.className = mergeClasses(\n menuButtonClassNames.icon,\n state.root['aria-expanded'] && iconExpandedStyles[state.appearance],\n state.icon.className,\n );\n }\n\n if (state.menuIcon) {\n state.menuIcon.className = mergeClasses(\n menuButtonClassNames.menuIcon,\n menuIconStyles.base,\n menuIconStyles[state.size],\n !state.iconOnly && menuIconStyles.notIconOnly,\n state.menuIcon.className,\n );\n }\n\n useButtonStyles_unstable({ ...state, iconPosition: 'before' });\n\n return state;\n};\n"]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
define(["require", "exports", "react", "./renderSplitButton", "./useSplitButton", "./useSplitButtonStyles"], function (require, exports, React, renderSplitButton_1, useSplitButton_1, useSplitButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.SplitButton = void 0;
|
5
|
+
/**
|
6
|
+
* SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary
|
7
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
8
|
+
*/
|
9
|
+
exports.SplitButton = React.forwardRef(function (props, ref) {
|
10
|
+
var state = useSplitButton_1.useSplitButton_unstable(props, ref);
|
11
|
+
useSplitButtonStyles_1.useSplitButtonStyles_unstable(state);
|
12
|
+
return renderSplitButton_1.renderSplitButton_unstable(state);
|
13
|
+
// Casting is required due to lack of distributive union to support unions on @types/react
|
14
|
+
});
|
15
|
+
exports.SplitButton.displayName = 'SplitButton';
|
16
|
+
});
|
17
|
+
//# sourceMappingURL=SplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SplitButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/SplitButton.tsx"],"names":[],"mappings":";;;;IAOA;;;OAGG;IACU,QAAA,WAAW,GAA0C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC5F,IAAM,KAAK,GAAG,wCAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAElD,oDAA6B,CAAC,KAAK,CAAC,CAAC;QAErC,OAAO,8CAA0B,CAAC,KAAK,CAAC,CAAC;QACzC,0FAA0F;IAC5F,CAAC,CAA0C,CAAC;IAE5C,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { renderSplitButton_unstable } from './renderSplitButton';\nimport { useSplitButton_unstable } from './useSplitButton';\nimport { useSplitButtonStyles_unstable } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary\n * action, while interacting with the second one opens a menu with secondary actions.\n */\nexport const SplitButton: ForwardRefComponent<SplitButtonProps> = React.forwardRef((props, ref) => {\n const state = useSplitButton_unstable(props, ref);\n\n useSplitButtonStyles_unstable(state);\n\n return renderSplitButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<SplitButtonProps>;\n\nSplitButton.displayName = 'SplitButton';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SplitButton.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/SplitButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonState } from '../Button/Button.types';\nimport type { MenuButtonProps, MenuButtonState } from '../MenuButton/MenuButton.types';\n\nexport type SplitButtonSlots = {\n /**\n * Root of the component that wraps the primary action button and menu button.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Button that opens menu with secondary actions in SplitButton.\n */\n menuButton?: Slot<typeof MenuButton>;\n /**\n * Button to perform primary action in SplitButton.\n */\n primaryActionButton?: Slot<typeof Button>;\n};\n\nexport type SplitButtonProps = ComponentProps<SplitButtonSlots> &\n Omit<ButtonProps, 'root'> &\n Omit<MenuButtonProps, 'root'>;\n\nexport type SplitButtonState = ComponentState<SplitButtonSlots> &\n Omit<ButtonState, 'components' | 'iconOnly' | 'root'> &\n Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./SplitButton", "./SplitButton.types", "./renderSplitButton", "./useSplitButton", "./useSplitButtonStyles"], function (require, exports, tslib_1, SplitButton_1, SplitButton_types_1, renderSplitButton_1, useSplitButton_1, useSplitButtonStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useSplitButtonStyles_unstable = exports.splitButtonClassNames = void 0;
|
5
|
+
tslib_1.__exportStar(SplitButton_1, exports);
|
6
|
+
tslib_1.__exportStar(SplitButton_types_1, exports);
|
7
|
+
tslib_1.__exportStar(renderSplitButton_1, exports);
|
8
|
+
tslib_1.__exportStar(useSplitButton_1, exports);
|
9
|
+
Object.defineProperty(exports, "splitButtonClassNames", { enumerable: true, get: function () { return useSplitButtonStyles_1.splitButtonClassNames; } });
|
10
|
+
Object.defineProperty(exports, "useSplitButtonStyles_unstable", { enumerable: true, get: function () { return useSplitButtonStyles_1.useSplitButtonStyles_unstable; } });
|
11
|
+
});
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/index.ts"],"names":[],"mappings":";;;;IAAA,6CAA8B;IAC9B,mDAAoC;IACpC,mDAAoC;IACpC,gDAAiC;IACxB,6HAAA,qBAAqB,OAAA;IAAE,qIAAA,6BAA6B,OAAA","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.renderSplitButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
7
|
+
*/
|
8
|
+
var renderSplitButton_unstable = function (state) {
|
9
|
+
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
10
|
+
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
11
|
+
slots.primaryActionButton && React.createElement(slots.primaryActionButton, tslib_1.__assign({}, slotProps.primaryActionButton)),
|
12
|
+
slots.menuButton && React.createElement(slots.menuButton, tslib_1.__assign({}, slotProps.menuButton))));
|
13
|
+
};
|
14
|
+
exports.renderSplitButton_unstable = renderSplitButton_unstable;
|
15
|
+
});
|
16
|
+
//# sourceMappingURL=renderSplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderSplitButton.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-button/src/components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,0BAA0B,GAAG,UAAC,KAAuB;QAC1D,IAAA,KAAuB,0BAAQ,CAAmB,KAAK,CAAC,EAAtD,KAAK,WAAA,EAAE,SAAS,eAAsC,CAAC;QAE/D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,mBAAmB,IAAI,oBAAC,KAAK,CAAC,mBAAmB,uBAAK,SAAS,CAAC,mBAAmB,EAAI;YAC7F,KAAK,CAAC,UAAU,IAAI,oBAAC,KAAK,CAAC,UAAU,uBAAK,SAAS,CAAC,UAAU,EAAI,CACxD,CACd,CAAC;IACJ,CAAC,CAAC;IATW,QAAA,0BAA0B,8BASrC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton_unstable = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlots<SplitButtonSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.primaryActionButton && <slots.primaryActionButton {...slotProps.primaryActionButton} />}\n {slots.menuButton && <slots.menuButton {...slotProps.menuButton} />}\n </slots.root>\n );\n};\n"]}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-utilities", "../Button/Button", "../MenuButton/MenuButton"], function (require, exports, tslib_1, react_utilities_1, Button_1, MenuButton_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useSplitButton_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
7
|
+
* @param props - User provided props to the SplitButton component.
|
8
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
9
|
+
*/
|
10
|
+
var useSplitButton_unstable = function (props, ref) {
|
11
|
+
var _a = props.appearance, appearance = _a === void 0 ? 'secondary' : _a, children = props.children, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.disabledFocusable, disabledFocusable = _c === void 0 ? false : _c, icon = props.icon, _d = props.iconPosition, iconPosition = _d === void 0 ? 'before' : _d, menuButton = props.menuButton, menuIcon = props.menuIcon, primaryActionButton = props.primaryActionButton, _e = props.shape, shape = _e === void 0 ? 'rounded' : _e, _f = props.size, size = _f === void 0 ? 'medium' : _f;
|
12
|
+
var baseId = react_utilities_1.useId('splitButton-');
|
13
|
+
var menuButtonShorthand = react_utilities_1.resolveShorthand(menuButton, {
|
14
|
+
defaultProps: {
|
15
|
+
appearance: appearance,
|
16
|
+
disabled: disabled,
|
17
|
+
disabledFocusable: disabledFocusable,
|
18
|
+
menuIcon: menuIcon,
|
19
|
+
shape: shape,
|
20
|
+
size: size,
|
21
|
+
},
|
22
|
+
required: true,
|
23
|
+
});
|
24
|
+
var primaryActionButtonShorthand = react_utilities_1.resolveShorthand(primaryActionButton, {
|
25
|
+
defaultProps: {
|
26
|
+
appearance: appearance,
|
27
|
+
children: children,
|
28
|
+
disabled: disabled,
|
29
|
+
disabledFocusable: disabledFocusable,
|
30
|
+
icon: icon,
|
31
|
+
iconPosition: iconPosition,
|
32
|
+
id: baseId + '__primaryActionButton',
|
33
|
+
shape: shape,
|
34
|
+
size: size,
|
35
|
+
},
|
36
|
+
required: true,
|
37
|
+
});
|
38
|
+
// Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided
|
39
|
+
// by the user.
|
40
|
+
if (menuButtonShorthand &&
|
41
|
+
primaryActionButtonShorthand &&
|
42
|
+
!menuButtonShorthand['aria-label'] &&
|
43
|
+
!menuButtonShorthand['aria-labelledby']) {
|
44
|
+
menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
|
45
|
+
}
|
46
|
+
return {
|
47
|
+
// Props passed at the top-level
|
48
|
+
appearance: appearance,
|
49
|
+
disabled: disabled,
|
50
|
+
disabledFocusable: disabledFocusable,
|
51
|
+
iconPosition: iconPosition,
|
52
|
+
shape: shape,
|
53
|
+
size: size,
|
54
|
+
// Slots definition
|
55
|
+
components: {
|
56
|
+
root: 'div',
|
57
|
+
menuButton: MenuButton_1.MenuButton,
|
58
|
+
primaryActionButton: Button_1.Button,
|
59
|
+
},
|
60
|
+
root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign({ ref: ref }, props)),
|
61
|
+
menuButton: menuButtonShorthand,
|
62
|
+
primaryActionButton: primaryActionButtonShorthand,
|
63
|
+
};
|
64
|
+
};
|
65
|
+
exports.useSplitButton_unstable = useSplitButton_unstable;
|
66
|
+
});
|
67
|
+
//# sourceMappingURL=useSplitButton.js.map
|