@fluentui/react-button 9.0.0-alpha.10 → 9.0.0-alpha.100
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +2418 -1
- package/CHANGELOG.md +920 -2
- package/README.md +19 -108
- package/dist/demo/index.html +71 -0
- package/dist/demo/react-dom.development.js +21413 -0
- package/dist/demo/react.development.js +3155 -0
- package/dist/react-button.d.ts +204 -82
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.d.ts +1 -0
- package/lib/CompoundButton.js +2 -0
- package/lib/CompoundButton.js.map +1 -0
- package/lib/MenuButton.d.ts +1 -0
- package/lib/MenuButton.js +2 -0
- package/lib/MenuButton.js.map +1 -0
- package/lib/SplitButton.d.ts +1 -0
- package/lib/SplitButton.js +2 -0
- package/lib/SplitButton.js.map +1 -0
- package/lib/ToggleButton.d.ts +1 -0
- package/lib/ToggleButton.js +2 -0
- package/lib/ToggleButton.js.map +1 -0
- package/lib/common/isConformant.d.ts +4 -2
- package/lib/common/isConformant.js +9 -6
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Button/Button.d.ts +4 -11
- package/lib/components/Button/Button.js +7 -16
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.d.ts +57 -60
- package/lib/components/Button/Button.types.js +1 -0
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.d.ts +1 -2
- package/lib/components/Button/index.js +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.d.ts +2 -2
- package/lib/components/Button/renderButton.js +9 -8
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.d.ts +5 -7
- package/lib/components/Button/useButton.js +49 -23
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.d.ts +10 -4
- package/lib/components/Button/useButtonStyles.js +350 -378
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.d.ts +6 -0
- package/lib/components/CompoundButton/CompoundButton.js +15 -0
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +14 -0
- package/lib/components/CompoundButton/CompoundButton.types.js +2 -0
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib/components/CompoundButton/index.d.ts +5 -0
- package/lib/components/CompoundButton/index.js +6 -0
- package/lib/components/CompoundButton/index.js.map +1 -0
- package/lib/components/CompoundButton/renderCompoundButton.d.ts +5 -0
- package/lib/components/CompoundButton/renderCompoundButton.js +17 -0
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButton.d.ts +8 -0
- package/lib/components/CompoundButton/useCompoundButton.js +29 -0
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +164 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.d.ts +6 -0
- package/lib/components/MenuButton/MenuButton.js +15 -0
- package/lib/components/MenuButton/MenuButton.js.map +1 -0
- package/lib/components/MenuButton/MenuButton.types.d.ts +11 -0
- package/lib/components/MenuButton/MenuButton.types.js +2 -0
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib/components/MenuButton/index.d.ts +5 -0
- package/lib/components/MenuButton/index.js +6 -0
- package/lib/components/MenuButton/index.js.map +1 -0
- package/lib/components/MenuButton/renderMenuButton.d.ts +5 -0
- package/lib/components/MenuButton/renderMenuButton.js +17 -0
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib/components/MenuButton/useMenuButton.d.ts +6 -0
- package/lib/components/MenuButton/useMenuButton.js +32 -0
- package/lib/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js +34 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib/components/SplitButton/SplitButton.js +16 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.types.d.ts +19 -0
- package/lib/components/SplitButton/SplitButton.types.js +2 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib/components/SplitButton/index.d.ts +5 -0
- package/lib/components/SplitButton/index.js +6 -0
- package/lib/components/SplitButton/index.js.map +1 -0
- package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib/components/SplitButton/renderSplitButton.js +15 -0
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButton.d.ts +8 -0
- package/lib/components/SplitButton/useSplitButton.js +73 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +77 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts +6 -0
- package/lib/components/ToggleButton/ToggleButton.js +15 -0
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +19 -0
- package/lib/components/ToggleButton/ToggleButton.types.js +2 -0
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib/components/ToggleButton/index.d.ts +5 -0
- package/lib/components/ToggleButton/index.js +6 -0
- package/lib/components/ToggleButton/index.js.map +1 -0
- package/lib/components/ToggleButton/renderToggleButton.d.ts +1 -0
- package/lib/components/ToggleButton/renderToggleButton.js +2 -0
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButton.d.ts +9 -0
- package/lib/components/ToggleButton/useToggleButton.js +50 -0
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js +190 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Button.js +7 -2
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.d.ts +1 -0
- package/lib-commonjs/CompoundButton.js +10 -0
- package/lib-commonjs/CompoundButton.js.map +1 -0
- package/lib-commonjs/MenuButton.d.ts +1 -0
- package/lib-commonjs/MenuButton.js +10 -0
- package/lib-commonjs/MenuButton.js.map +1 -0
- package/lib-commonjs/SplitButton.d.ts +1 -0
- package/lib-commonjs/SplitButton.js +10 -0
- package/lib-commonjs/SplitButton.js.map +1 -0
- package/lib-commonjs/ToggleButton.d.ts +1 -0
- package/lib-commonjs/ToggleButton.js +10 -0
- package/lib-commonjs/ToggleButton.js.map +1 -0
- package/lib-commonjs/common/isConformant.d.ts +4 -2
- package/lib-commonjs/common/isConformant.js +19 -8
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Button/Button.d.ts +4 -11
- package/lib-commonjs/components/Button/Button.js +20 -20
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.d.ts +57 -60
- package/lib-commonjs/components/Button/Button.types.js +4 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.d.ts +1 -2
- package/lib-commonjs/components/Button/index.js +21 -5
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.d.ts +2 -2
- package/lib-commonjs/components/Button/renderButton.js +24 -13
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.d.ts +5 -7
- package/lib-commonjs/components/Button/useButton.js +59 -24
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +10 -4
- package/lib-commonjs/components/Button/useButtonStyles.js +360 -379
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +6 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +26 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +14 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js +6 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/index.d.ts +5 -0
- package/lib-commonjs/components/CompoundButton/index.js +26 -0
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +5 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +29 -0
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +8 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +41 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +175 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.d.ts +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js +26 -0
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +11 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.js +6 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -0
- package/lib-commonjs/components/MenuButton/index.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/index.js +26 -0
- package/lib-commonjs/components/MenuButton/index.js.map +1 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +29 -0
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +6 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js +46 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +44 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js +27 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +19 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/index.js +26 -0
- package/lib-commonjs/components/SplitButton/index.js.map +1 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +27 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +8 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js +86 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +88 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +6 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +26 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +19 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js +6 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/index.d.ts +5 -0
- package/lib-commonjs/components/ToggleButton/index.js +26 -0
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +1 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +16 -0
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +9 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +63 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +200 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +4 -0
- package/lib-commonjs/index.js +15 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +21 -14
- package/config/api-extractor.json +0 -3
- package/config/pre-copy.json +0 -9
- package/config/tests.js +0 -6
- package/etc/react-button.api.md +0 -104
- package/just.config.ts +0 -3
- package/lib/components/Button/useButtonState.d.ts +0 -6
- package/lib/components/Button/useButtonState.js +0 -45
- package/lib/components/Button/useButtonState.js.map +0 -1
- package/lib-amd/Button.d.ts +0 -1
- package/lib-amd/Button.js +0 -6
- package/lib-amd/Button.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -2
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/components/Button/Button.d.ts +0 -13
- package/lib-amd/components/Button/Button.js +0 -24
- package/lib-amd/components/Button/Button.js.map +0 -1
- package/lib-amd/components/Button/Button.types.d.ts +0 -65
- package/lib-amd/components/Button/Button.types.js +0 -5
- package/lib-amd/components/Button/Button.types.js.map +0 -1
- package/lib-amd/components/Button/index.d.ts +0 -6
- package/lib-amd/components/Button/index.js +0 -10
- package/lib-amd/components/Button/index.js.map +0 -1
- package/lib-amd/components/Button/renderButton.d.ts +0 -5
- package/lib-amd/components/Button/renderButton.js +0 -16
- package/lib-amd/components/Button/renderButton.js.map +0 -1
- package/lib-amd/components/Button/useButton.d.ts +0 -10
- package/lib-amd/components/Button/useButton.js +0 -28
- package/lib-amd/components/Button/useButton.js.map +0 -1
- package/lib-amd/components/Button/useButtonState.d.ts +0 -6
- package/lib-amd/components/Button/useButtonState.js +0 -48
- package/lib-amd/components/Button/useButtonState.js.map +0 -1
- package/lib-amd/components/Button/useButtonStyles.d.ts +0 -4
- package/lib-amd/components/Button/useButtonStyles.js +0 -385
- package/lib-amd/components/Button/useButtonStyles.js.map +0 -1
- package/lib-amd/index.d.ts +0 -1
- package/lib-amd/index.js +0 -6
- package/lib-amd/index.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonState.d.ts +0 -6
- package/lib-commonjs/components/Button/useButtonState.js +0 -47
- package/lib-commonjs/components/Button/useButtonState.js.map +0 -1
- package/src/components/Button/Button.types.ts +0 -120
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useToggleButton = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
|
12
|
+
var React = /*#__PURE__*/require("react");
|
13
|
+
|
14
|
+
var useButton_1 = /*#__PURE__*/require("../Button/useButton");
|
15
|
+
/**
|
16
|
+
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
17
|
+
* processed state.
|
18
|
+
* @param props - User provided props to the ToggleButton component.
|
19
|
+
* @param ref - User provided ref to be passed to the ToggleButton component.
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
var useToggleButton = function (_a, ref) {
|
24
|
+
var _b;
|
25
|
+
|
26
|
+
var checked = _a.checked,
|
27
|
+
defaultChecked = _a.defaultChecked,
|
28
|
+
props = tslib_1.__rest(_a, ["checked", "defaultChecked"]);
|
29
|
+
|
30
|
+
var buttonState = useButton_1.useButton(props, ref);
|
31
|
+
var _c = buttonState.root,
|
32
|
+
role = _c.role,
|
33
|
+
onClick = _c.onClick;
|
34
|
+
|
35
|
+
var _d = react_utilities_1.useControllableState({
|
36
|
+
state: checked,
|
37
|
+
defaultState: defaultChecked,
|
38
|
+
initialState: false
|
39
|
+
}),
|
40
|
+
checkedValue = _d[0],
|
41
|
+
setCheckedValue = _d[1];
|
42
|
+
|
43
|
+
var isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';
|
44
|
+
return tslib_1.__assign(tslib_1.__assign({}, buttonState), {
|
45
|
+
// State calculated from a set of props
|
46
|
+
checked: checkedValue,
|
47
|
+
// Slots definition
|
48
|
+
root: tslib_1.__assign(tslib_1.__assign({}, buttonState.root), (_b = {}, _b[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed'] = !!checkedValue, _b.onClick = React.useCallback(function (ev) {
|
49
|
+
if (onClick) {
|
50
|
+
onClick(ev);
|
51
|
+
|
52
|
+
if (ev.defaultPrevented) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
setCheckedValue(!checkedValue);
|
58
|
+
}, [checkedValue, setCheckedValue, onClick]), _b))
|
59
|
+
});
|
60
|
+
};
|
61
|
+
|
62
|
+
exports.useToggleButton = useToggleButton;
|
63
|
+
//# sourceMappingURL=useToggleButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAGA;;;;;AAKG;;;AACI,IAAM,eAAe,GAAG,UAC7B,EAD6B,EAE7B,GAF6B,EAEwB;;;AADnD,MAAA,OAAO,GAAA,EAAA,CAAA,OAAP;AAAA,MAAS,cAAc,GAAA,EAAA,CAAA,cAAvB;AAAA,MAA4B,KAAK,GAAA,OAAA,CAAA,MAAA,CAAA,EAAA,EAAnC,CAAA,SAAA,EAAA,gBAAA,CAAmC,CAAjC;;AAGF,MAAM,WAAW,GAAG,WAAA,CAAA,SAAA,CAAU,KAAV,EAAiB,GAAjB,CAApB;AACM,MAAA,EAAA,GAAoB,WAAW,CAAC,IAAhC;AAAA,MAAE,IAAI,GAAA,EAAA,CAAA,IAAN;AAAA,MAAQ,OAAO,GAAA,EAAA,CAAA,OAAf;;AAEA,MAAA,EAAA,GAAkC,iBAAA,CAAA,oBAAA,CAAqB;AAC3D,IAAA,KAAK,EAAE,OADoD;AAE3D,IAAA,YAAY,EAAE,cAF6C;AAG3D,IAAA,YAAY,EAAE;AAH6C,GAArB,CAAlC;AAAA,MAAC,YAAY,GAAA,EAAA,CAAA,CAAA,CAAb;AAAA,MAAe,eAAe,GAAA,EAAA,CAAA,CAAA,CAA9B;;AAMN,MAAM,kBAAkB,GAAG,IAAI,KAAK,kBAAT,IAA+B,IAAI,KAAK,UAAnE;AAEA,SAAA,OAAA,CAAA,QAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,EAEK,WAFL,CAAA,EAEgB;AAEd;AACA,IAAA,OAAO,EAAE,YAHK;AAKd;AACA,IAAA,IAAI,EAAA,OAAA,CAAA,QAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,EACC,WAAW,CAAC,IADb,CAAA,GACiB,EAAA,GAAA,EAAA,EAAA,EAAA,CAClB,kBAAkB,GAAG,cAAH,GAAoB,cADpB,CAAA,GACqC,CAAC,CAAC,YADvC,EAEnB,EAAA,CAAA,OAAA,GAAS,KAAK,CAAC,WAAN,CACP,UAAA,EAAA,EAAE;AACA,UAAI,OAAJ,EAAa;AACX,QAAA,OAAO,CAAC,EAAD,CAAP;;AAEA,YAAI,EAAE,CAAC,gBAAP,EAAyB;AACvB;AACD;AACF;;AAED,MAAA,eAAe,CAAC,CAAC,YAAF,CAAf;AACD,KAXM,EAYP,CAAC,YAAD,EAAe,eAAf,EAAgC,OAAhC,CAZO,CAFU,EAelB,EAhBC;AANU,GAFhB,CAAA;AA2BD,CA1CM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourceRoot":""}
|
@@ -0,0 +1,200 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useToggleButtonStyles = void 0;
|
7
|
+
|
8
|
+
var react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
|
+
|
10
|
+
var useButtonStyles_1 = /*#__PURE__*/require("../Button/useButtonStyles");
|
11
|
+
|
12
|
+
var useCheckedStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
13
|
+
"base": {
|
14
|
+
"ayd6f0": "fg85c1j",
|
15
|
+
"g2u3we": "fj3muxo",
|
16
|
+
"h3c5rm": ["f1akhkt", "f1lxtadh"],
|
17
|
+
"B9xav0g": "f1aperda",
|
18
|
+
"zhjwy3": ["f1lxtadh", "f1akhkt"],
|
19
|
+
"sj55zd": "f19n0e5",
|
20
|
+
"B4j52fo": "f192inf7",
|
21
|
+
"Bekrc4i": ["f5tn483", "f1ojsxk5"],
|
22
|
+
"Bn0qgzm": "f1vxd6vx",
|
23
|
+
"ibv6hh": ["f1ojsxk5", "f5tn483"],
|
24
|
+
"v4pbla": "f56u8ty",
|
25
|
+
"Bgoe8wy": "fvcxoqz",
|
26
|
+
"Bwzppfd": ["f1ub3y4t", "f1m52nbi"],
|
27
|
+
"oetu4i": "f1xlaoq0",
|
28
|
+
"gg5e9n": ["f1m52nbi", "f1ub3y4t"],
|
29
|
+
"Bi91k9c": "fax3udt",
|
30
|
+
"vv34bc": "fzgy25m",
|
31
|
+
"B6oc9vd": "fvs00aa",
|
32
|
+
"ak43y8": ["f1assf6x", "f4ruux4"],
|
33
|
+
"wmxk5l": "fumykes",
|
34
|
+
"B50zh58": ["f4ruux4", "f1assf6x"],
|
35
|
+
"lj723h": "f1r2dosr"
|
36
|
+
},
|
37
|
+
"outline": {
|
38
|
+
"ayd6f0": "f6r4cvw",
|
39
|
+
"v4pbla": "f62j56f",
|
40
|
+
"vv34bc": "flt377r"
|
41
|
+
},
|
42
|
+
"primary": {
|
43
|
+
"ayd6f0": "fvinvdn",
|
44
|
+
"g2u3we": "f1p3nwhy",
|
45
|
+
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
46
|
+
"B9xav0g": "f1q5o8ev",
|
47
|
+
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
48
|
+
"sj55zd": "f1phragk",
|
49
|
+
"v4pbla": "f1fitrdm",
|
50
|
+
"Bgoe8wy": "f1s2uweq",
|
51
|
+
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
52
|
+
"oetu4i": "f1ukrpxl",
|
53
|
+
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
54
|
+
"Bi91k9c": "f1rq72xc",
|
55
|
+
"vv34bc": "f4ihffn",
|
56
|
+
"B6oc9vd": "ff472gp",
|
57
|
+
"ak43y8": ["f4yyc7m", "ft2aflc"],
|
58
|
+
"wmxk5l": "fggejwh",
|
59
|
+
"B50zh58": ["ft2aflc", "f4yyc7m"],
|
60
|
+
"lj723h": "f18otbis"
|
61
|
+
},
|
62
|
+
"subtle": {
|
63
|
+
"ayd6f0": "f1n839y3",
|
64
|
+
"g2u3we": "f1p3nwhy",
|
65
|
+
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
66
|
+
"B9xav0g": "f1q5o8ev",
|
67
|
+
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
68
|
+
"sj55zd": "f1qj7y59",
|
69
|
+
"v4pbla": "f4wzgrt",
|
70
|
+
"Bgoe8wy": "f1s2uweq",
|
71
|
+
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
72
|
+
"oetu4i": "f1ukrpxl",
|
73
|
+
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
74
|
+
"Bi91k9c": "f139oj5f",
|
75
|
+
"vv34bc": "f1be4e1d",
|
76
|
+
"B6oc9vd": "ff472gp",
|
77
|
+
"ak43y8": ["f4yyc7m", "ft2aflc"],
|
78
|
+
"wmxk5l": "fggejwh",
|
79
|
+
"B50zh58": ["ft2aflc", "f4yyc7m"],
|
80
|
+
"lj723h": "f19au66r"
|
81
|
+
},
|
82
|
+
"transparent": {
|
83
|
+
"ayd6f0": "f6r4cvw",
|
84
|
+
"g2u3we": "f1p3nwhy",
|
85
|
+
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
86
|
+
"B9xav0g": "f1q5o8ev",
|
87
|
+
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
88
|
+
"sj55zd": "f1qj7y59",
|
89
|
+
"v4pbla": "f62j56f",
|
90
|
+
"Bgoe8wy": "f1s2uweq",
|
91
|
+
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
92
|
+
"oetu4i": "f1ukrpxl",
|
93
|
+
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
94
|
+
"Bi91k9c": "f139oj5f",
|
95
|
+
"vv34bc": "flt377r",
|
96
|
+
"B6oc9vd": "ff472gp",
|
97
|
+
"ak43y8": ["f4yyc7m", "ft2aflc"],
|
98
|
+
"wmxk5l": "fggejwh",
|
99
|
+
"B50zh58": ["ft2aflc", "f4yyc7m"],
|
100
|
+
"lj723h": "f19au66r"
|
101
|
+
}
|
102
|
+
}, {
|
103
|
+
"d": [".fg85c1j{background:var(--colorNeutralBackground1Selected);}", ".fj3muxo{border-top-color:var(--colorNeutralStroke1);}", ".f1akhkt{border-right-color:var(--colorNeutralStroke1);}", ".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}", ".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".f6r4cvw{background:var(--colorTransparentBackgroundSelected);}", ".fvinvdn{background:var(--colorBrandBackgroundSelected);}", ".f1p3nwhy{border-top-color:transparent;}", ".f11589ue{border-right-color:transparent;}", ".f1pdflbu{border-left-color:transparent;}", ".f1q5o8ev{border-bottom-color:transparent;}", ".f1phragk{color:var(--colorNeutralForegroundOnBrand);}", ".f1n839y3{background:var(--colorSubtleBackgroundSelected);}", ".f1qj7y59{color:var(--colorNeutralForeground2BrandSelected);}"],
|
104
|
+
"h": [".f56u8ty:hover{background:var(--colorNeutralBackground1Hover);}", ".fvcxoqz:hover{border-top-color:var(--colorNeutralStroke1Hover);}", ".f1ub3y4t:hover{border-right-color:var(--colorNeutralStroke1Hover);}", ".f1m52nbi:hover{border-left-color:var(--colorNeutralStroke1Hover);}", ".f1xlaoq0:hover{border-bottom-color:var(--colorNeutralStroke1Hover);}", ".fax3udt:hover{color:var(--colorNeutralForeground1);}", ".f62j56f:hover{background:var(--colorTransparentBackgroundHover);}", ".f1fitrdm:hover{background:var(--colorBrandBackgroundHover);}", ".f1s2uweq:hover{border-top-color:transparent;}", ".fr80ssc:hover{border-right-color:transparent;}", ".fecsdlb:hover{border-left-color:transparent;}", ".f1ukrpxl:hover{border-bottom-color:transparent;}", ".f1rq72xc:hover{color:var(--colorNeutralForegroundOnBrand);}", ".f4wzgrt:hover{background:var(--colorSubtleBackgroundHover);}", ".f139oj5f:hover{color:var(--colorNeutralForeground2BrandHover);}"],
|
105
|
+
"a": [".fzgy25m:active{background:var(--colorNeutralBackground1Pressed);}", ".fvs00aa:active{border-top-color:var(--colorNeutralStroke1Pressed);}", ".f1assf6x:active{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f4ruux4:active{border-left-color:var(--colorNeutralStroke1Pressed);}", ".fumykes:active{border-bottom-color:var(--colorNeutralStroke1Pressed);}", ".f1r2dosr:active{color:var(--colorNeutralForeground1);}", ".flt377r:active{background:var(--colorTransparentBackgroundPressed);}", ".f4ihffn:active{background:var(--colorBrandBackgroundPressed);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f18otbis:active{color:var(--colorNeutralForegroundOnBrand);}", ".f1be4e1d:active{background:var(--colorSubtleBackgroundPressed);}", ".f19au66r:active{color:var(--colorNeutralForeground2BrandPressed);}"]
|
106
|
+
});
|
107
|
+
|
108
|
+
var useDisabledStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
109
|
+
"base": {
|
110
|
+
"ayd6f0": "fqst6tg",
|
111
|
+
"g2u3we": "f1jj8ep1",
|
112
|
+
"h3c5rm": ["f15xbau", "fy0fskl"],
|
113
|
+
"B9xav0g": "f4ikngz",
|
114
|
+
"zhjwy3": ["fy0fskl", "f15xbau"],
|
115
|
+
"sj55zd": "f1s2aq7o",
|
116
|
+
"v4pbla": "f1nil5o8",
|
117
|
+
"Bgoe8wy": "f12mpcsy",
|
118
|
+
"Bwzppfd": ["f1gwvigk", "f18rmfxp"],
|
119
|
+
"oetu4i": "f1jnshp0",
|
120
|
+
"gg5e9n": ["f18rmfxp", "f1gwvigk"],
|
121
|
+
"Bi91k9c": "fvgxktp",
|
122
|
+
"vv34bc": "fkqx3al",
|
123
|
+
"B6oc9vd": "fdi4vxw",
|
124
|
+
"ak43y8": ["f4ryxzl", "fkdgpbx"],
|
125
|
+
"wmxk5l": "fcmhn06",
|
126
|
+
"B50zh58": ["fkdgpbx", "f4ryxzl"],
|
127
|
+
"lj723h": "f19wldhg"
|
128
|
+
},
|
129
|
+
"outline": {},
|
130
|
+
"primary": {
|
131
|
+
"g2u3we": "f1p3nwhy",
|
132
|
+
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
133
|
+
"B9xav0g": "f1q5o8ev",
|
134
|
+
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
135
|
+
"Bgoe8wy": "f1s2uweq",
|
136
|
+
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
137
|
+
"oetu4i": "f1ukrpxl",
|
138
|
+
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
139
|
+
"B6oc9vd": "ff472gp",
|
140
|
+
"ak43y8": ["f4yyc7m", "ft2aflc"],
|
141
|
+
"wmxk5l": "fggejwh",
|
142
|
+
"B50zh58": ["ft2aflc", "f4yyc7m"]
|
143
|
+
},
|
144
|
+
"subtle": {
|
145
|
+
"ayd6f0": "f1k2sg7s",
|
146
|
+
"g2u3we": "f1p3nwhy",
|
147
|
+
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
148
|
+
"B9xav0g": "f1q5o8ev",
|
149
|
+
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
150
|
+
"v4pbla": "f1vc35iv",
|
151
|
+
"Bgoe8wy": "f1s2uweq",
|
152
|
+
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
153
|
+
"oetu4i": "f1ukrpxl",
|
154
|
+
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
155
|
+
"vv34bc": "f17oliv9",
|
156
|
+
"B6oc9vd": "ff472gp",
|
157
|
+
"ak43y8": ["f4yyc7m", "ft2aflc"],
|
158
|
+
"wmxk5l": "fggejwh",
|
159
|
+
"B50zh58": ["ft2aflc", "f4yyc7m"]
|
160
|
+
},
|
161
|
+
"transparent": {
|
162
|
+
"ayd6f0": "f1k2sg7s",
|
163
|
+
"g2u3we": "f1p3nwhy",
|
164
|
+
"h3c5rm": ["f11589ue", "f1pdflbu"],
|
165
|
+
"B9xav0g": "f1q5o8ev",
|
166
|
+
"zhjwy3": ["f1pdflbu", "f11589ue"],
|
167
|
+
"v4pbla": "f1vc35iv",
|
168
|
+
"Bgoe8wy": "f1s2uweq",
|
169
|
+
"Bwzppfd": ["fr80ssc", "fecsdlb"],
|
170
|
+
"oetu4i": "f1ukrpxl",
|
171
|
+
"gg5e9n": ["fecsdlb", "fr80ssc"],
|
172
|
+
"vv34bc": "f17oliv9",
|
173
|
+
"B6oc9vd": "ff472gp",
|
174
|
+
"ak43y8": ["f4yyc7m", "ft2aflc"],
|
175
|
+
"wmxk5l": "fggejwh",
|
176
|
+
"B50zh58": ["ft2aflc", "f4yyc7m"]
|
177
|
+
}
|
178
|
+
}, {
|
179
|
+
"d": [".fqst6tg{background:var(--colorNeutralBackgroundDisabled);}", ".f1jj8ep1{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f15xbau{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fy0fskl{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f4ikngz{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f1s2aq7o{color:var(--colorNeutralForegroundDisabled);}", ".f1p3nwhy{border-top-color:transparent;}", ".f11589ue{border-right-color:transparent;}", ".f1pdflbu{border-left-color:transparent;}", ".f1q5o8ev{border-bottom-color:transparent;}", ".f1k2sg7s{background:none;}"],
|
180
|
+
"h": [".f1nil5o8:hover{background:var(--colorNeutralBackgroundDisabled);}", ".f12mpcsy:hover{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f1gwvigk:hover{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f18rmfxp:hover{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f1jnshp0:hover{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".fvgxktp:hover{color:var(--colorNeutralForegroundDisabled);}", ".f1s2uweq:hover{border-top-color:transparent;}", ".fr80ssc:hover{border-right-color:transparent;}", ".fecsdlb:hover{border-left-color:transparent;}", ".f1ukrpxl:hover{border-bottom-color:transparent;}", ".f1vc35iv:hover{background:none;}"],
|
181
|
+
"a": [".fkqx3al:active{background:var(--colorNeutralBackgroundDisabled);}", ".fdi4vxw:active{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f4ryxzl:active{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fkdgpbx:active{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fcmhn06:active{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f17oliv9:active{background:none;}"]
|
182
|
+
});
|
183
|
+
|
184
|
+
var useToggleButtonStyles = function (state) {
|
185
|
+
var checkedStyles = useCheckedStyles();
|
186
|
+
var disabledStyles = useDisabledStyles();
|
187
|
+
var appearance = state.appearance,
|
188
|
+
checked = state.checked,
|
189
|
+
disabled = state.disabled,
|
190
|
+
disabledFocusable = state.disabledFocusable;
|
191
|
+
state.root.className = react_make_styles_1.mergeClasses( // Checked styles
|
192
|
+
checked && checkedStyles.base, appearance && checked && checkedStyles[appearance], // Disabled styles
|
193
|
+
(disabled || disabledFocusable) && disabledStyles.base, appearance && (disabled || disabledFocusable) && disabledStyles[appearance], // User provided class name
|
194
|
+
state.root.className);
|
195
|
+
useButtonStyles_1.useButtonStyles(state);
|
196
|
+
return state;
|
197
|
+
};
|
198
|
+
|
199
|
+
exports.useToggleButtonStyles = useToggleButtonStyles;
|
200
|
+
//# sourceMappingURL=useToggleButtonStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,gBAAgB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAzB;;AAuFA,IAAM,iBAAiB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAiEO,IAAM,qBAAqB,GAAG,UAAC,KAAD,EAAyB;AAC5D,MAAM,aAAa,GAAG,gBAAgB,EAAtC;AACA,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEQ,MAAA,UAAU,GAA2C,KAAK,CAAhD,UAAV;AAAA,MAAY,OAAO,GAAkC,KAAK,CAAvC,OAAnB;AAAA,MAAqB,QAAQ,GAAwB,KAAK,CAA7B,QAA7B;AAAA,MAA+B,iBAAiB,GAAK,KAAK,CAAV,iBAAhD;AAER,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,mBAAA,CAAA,YAAA,EACrB;AACA,EAAA,OAAO,IAAI,aAAa,CAAC,IAFJ,EAGrB,UAAU,IAAI,OAAd,IAAyB,aAAa,CAAC,UAAD,CAHjB,EAKrB;AACA,GAAC,QAAQ,IAAI,iBAAb,KAAmC,cAAc,CAAC,IAN7B,EAOrB,UAAU,KAAK,QAAQ,IAAI,iBAAjB,CAAV,IAAiD,cAAc,CAAC,UAAD,CAP1C,EASrB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAVU,CAAvB;AAaA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CAtBM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourceRoot":""}
|
package/lib-commonjs/index.d.ts
CHANGED
package/lib-commonjs/index.js
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
|
4
9
|
tslib_1.__exportStar(require("./Button"), exports);
|
10
|
+
|
11
|
+
tslib_1.__exportStar(require("./CompoundButton"), exports);
|
12
|
+
|
13
|
+
tslib_1.__exportStar(require("./MenuButton"), exports);
|
14
|
+
|
15
|
+
tslib_1.__exportStar(require("./SplitButton"), exports);
|
16
|
+
|
17
|
+
tslib_1.__exportStar(require("./ToggleButton"), exports);
|
5
18
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
|
package/package.json
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-button",
|
3
|
-
"version": "9.0.0-alpha.
|
3
|
+
"version": "9.0.0-alpha.100",
|
4
4
|
"description": "Fluent UI React Button component.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
7
7
|
"typings": "lib/index.d.ts",
|
8
|
+
"sideEffects": false,
|
8
9
|
"repository": {
|
9
10
|
"type": "git",
|
10
11
|
"url": "https://github.com/microsoft/fluentui"
|
@@ -12,20 +13,25 @@
|
|
12
13
|
"license": "MIT",
|
13
14
|
"scripts": {
|
14
15
|
"build": "just-scripts build",
|
16
|
+
"bundle-size": "bundle-size measure",
|
15
17
|
"clean": "just-scripts clean",
|
16
18
|
"code-style": "just-scripts code-style",
|
17
19
|
"just": "just-scripts",
|
18
20
|
"lint": "just-scripts lint",
|
19
|
-
"start": "
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
21
|
+
"start": "yarn storybook",
|
22
|
+
"test": "jest",
|
23
|
+
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
24
|
+
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/packages/react-button/src && yarn docs",
|
25
|
+
"storybook": "start-storybook"
|
23
26
|
},
|
24
27
|
"devDependencies": {
|
25
28
|
"@fluentui/a11y-testing": "^0.1.0",
|
26
|
-
"@fluentui/
|
27
|
-
"@fluentui/eslint-plugin": "
|
28
|
-
"@fluentui/
|
29
|
+
"@fluentui/babel-make-styles": "9.0.0-alpha.59",
|
30
|
+
"@fluentui/eslint-plugin": "*",
|
31
|
+
"@fluentui/jest-serializer-make-styles": "9.0.0-alpha.52",
|
32
|
+
"@fluentui/react-conformance": "*",
|
33
|
+
"@fluentui/react-conformance-make-styles": "9.0.0-alpha.21",
|
34
|
+
"@fluentui/react-menu": "9.0.0-alpha.91",
|
29
35
|
"@fluentui/scripts": "^1.0.0",
|
30
36
|
"@types/enzyme": "3.10.3",
|
31
37
|
"@types/enzyme-adapter-react-16": "1.0.3",
|
@@ -35,16 +41,17 @@
|
|
35
41
|
"enzyme": "~3.10.0",
|
36
42
|
"enzyme-adapter-react-16": "^1.15.0",
|
37
43
|
"react": "16.8.6",
|
38
|
-
"react-app-polyfill": "~1.0.1",
|
39
44
|
"react-dom": "16.8.6",
|
40
45
|
"react-test-renderer": "^16.3.0"
|
41
46
|
},
|
42
47
|
"dependencies": {
|
43
|
-
"@fluentui/keyboard-
|
44
|
-
"@fluentui/react-
|
45
|
-
"@fluentui/react-
|
46
|
-
"@fluentui/react-
|
47
|
-
"
|
48
|
+
"@fluentui/keyboard-keys": "9.0.0-alpha.5",
|
49
|
+
"@fluentui/react-aria": "9.0.0-alpha.44",
|
50
|
+
"@fluentui/react-icons": "^1.1.140",
|
51
|
+
"@fluentui/react-make-styles": "9.0.0-alpha.77",
|
52
|
+
"@fluentui/react-tabster": "9.0.0-alpha.72",
|
53
|
+
"@fluentui/react-utilities": "9.0.0-alpha.56",
|
54
|
+
"tslib": "^2.1.0"
|
48
55
|
},
|
49
56
|
"peerDependencies": {
|
50
57
|
"@types/react": ">=16.8.0 <18.0.0",
|
package/config/pre-copy.json
DELETED
package/config/tests.js
DELETED
package/etc/react-button.api.md
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
## API Report File for "@fluentui/react-button"
|
2
|
-
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
4
|
-
|
5
|
-
```ts
|
6
|
-
|
7
|
-
import { ComponentProps } from '@fluentui/react-utilities';
|
8
|
-
import { ObjectShorthandProps } from '@fluentui/react-utilities';
|
9
|
-
import * as React from 'react';
|
10
|
-
import { ShorthandProps } from '@fluentui/react-utilities';
|
11
|
-
|
12
|
-
// @public
|
13
|
-
export const Button: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
|
14
|
-
icon?: import("@fluentui/react-utilities").ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
15
|
-
disabled?: boolean | undefined;
|
16
|
-
iconOnly?: boolean | undefined;
|
17
|
-
iconPosition?: "after" | "before" | undefined;
|
18
|
-
primary?: boolean | undefined;
|
19
|
-
size?: "small" | "large" | undefined;
|
20
|
-
} & React.RefAttributes<HTMLElement>>;
|
21
|
-
|
22
|
-
// @public (undocumented)
|
23
|
-
export type ButtonProps = ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
|
24
|
-
icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
25
|
-
disabled?: boolean;
|
26
|
-
iconOnly?: boolean;
|
27
|
-
iconPosition?: 'before' | 'after';
|
28
|
-
primary?: boolean;
|
29
|
-
size?: 'small' | 'large';
|
30
|
-
};
|
31
|
-
|
32
|
-
// @public
|
33
|
-
export const buttonShorthandProps: string[];
|
34
|
-
|
35
|
-
// @public (undocumented)
|
36
|
-
export interface ButtonState extends ButtonProps {
|
37
|
-
// (undocumented)
|
38
|
-
children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
39
|
-
// (undocumented)
|
40
|
-
icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
41
|
-
// (undocumented)
|
42
|
-
ref: React.RefObject<HTMLButtonElement>;
|
43
|
-
}
|
44
|
-
|
45
|
-
// @public (undocumented)
|
46
|
-
export type ButtonStyleSelectors = {
|
47
|
-
disabled?: boolean;
|
48
|
-
iconOnly?: boolean;
|
49
|
-
primary?: boolean;
|
50
|
-
size?: string;
|
51
|
-
};
|
52
|
-
|
53
|
-
// @public (undocumented)
|
54
|
-
export type ButtonTokens = {
|
55
|
-
height: string;
|
56
|
-
paddingX: string;
|
57
|
-
paddingY: string;
|
58
|
-
minWidth: string;
|
59
|
-
maxWidth: string;
|
60
|
-
fontSize: string;
|
61
|
-
fontWeight: number;
|
62
|
-
lineHeight: string;
|
63
|
-
iconWidth: string;
|
64
|
-
iconHeight: string;
|
65
|
-
iconSpacing: string;
|
66
|
-
color: string;
|
67
|
-
content2Color: string;
|
68
|
-
background: string;
|
69
|
-
backgroundHover: string;
|
70
|
-
backgroundPressed: string;
|
71
|
-
backgroundActive: string;
|
72
|
-
borderColor: string;
|
73
|
-
borderColorHover: string;
|
74
|
-
borderColorActive: string;
|
75
|
-
borderWidth: string;
|
76
|
-
borderRadius: string;
|
77
|
-
shadow: string;
|
78
|
-
shadowPressed: string;
|
79
|
-
};
|
80
|
-
|
81
|
-
// @public (undocumented)
|
82
|
-
export type ButtonVariants = 'base' | 'disabled' | 'iconOnly' | 'primary' | 'small' | 'large' | 'primaryDisabled' | 'iconOnlySmall' | 'iconOnlyLarge';
|
83
|
-
|
84
|
-
// @public (undocumented)
|
85
|
-
export type ButtonVariantTokens = {
|
86
|
-
[variant in ButtonVariants]: Partial<ButtonTokens>;
|
87
|
-
};
|
88
|
-
|
89
|
-
// @public
|
90
|
-
export const renderButton: (state: ButtonState) => JSX.Element;
|
91
|
-
|
92
|
-
// @public
|
93
|
-
export const useButton: (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
|
94
|
-
|
95
|
-
// @public
|
96
|
-
export const useButtonState: (draftState: ButtonState) => void;
|
97
|
-
|
98
|
-
// @public (undocumented)
|
99
|
-
export const useButtonStyles: (state: ButtonState, selectors: ButtonStyleSelectors) => void;
|
100
|
-
|
101
|
-
|
102
|
-
// (No @packageDocumentation comment for this package)
|
103
|
-
|
104
|
-
```
|
package/just.config.ts
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
import { getCode, EnterKey, SpacebarKey } from '@fluentui/keyboard-key';
|
2
|
-
/**
|
3
|
-
* The useButton hook processes the Button draft state.
|
4
|
-
* @param draftState - Button draft state to mutate.
|
5
|
-
*/
|
6
|
-
export var useButtonState = function (draftState) {
|
7
|
-
if (draftState.as !== 'button') {
|
8
|
-
draftState.role = 'button';
|
9
|
-
if (draftState.as !== 'a') {
|
10
|
-
var onClickCallback_1 = draftState.onClick, onKeyDownCallback_1 = draftState.onKeyDown;
|
11
|
-
draftState.tabIndex = 0;
|
12
|
-
draftState.onKeyDown = function (ev) {
|
13
|
-
if (onKeyDownCallback_1) {
|
14
|
-
onKeyDownCallback_1(ev);
|
15
|
-
}
|
16
|
-
var keyCode = getCode(ev);
|
17
|
-
if (!ev.defaultPrevented && onClickCallback_1 && (keyCode === EnterKey || keyCode === SpacebarKey)) {
|
18
|
-
// Translate the keydown enter/space to a click.
|
19
|
-
ev.preventDefault();
|
20
|
-
ev.stopPropagation();
|
21
|
-
ev.target.click();
|
22
|
-
}
|
23
|
-
};
|
24
|
-
}
|
25
|
-
}
|
26
|
-
// Disallow click and keyboard events when component is disabled and eat events when disabledFocusable is set to true.
|
27
|
-
var disabled = draftState.disabled, /* disabledFocusable, */ onKeyDown = draftState.onKeyDown;
|
28
|
-
if (disabled) {
|
29
|
-
draftState.onClick = undefined;
|
30
|
-
}
|
31
|
-
draftState.onKeyDown = function (ev) {
|
32
|
-
var _a;
|
33
|
-
var keyCode = getCode(ev);
|
34
|
-
if (disabled && (keyCode === EnterKey || keyCode === SpacebarKey)) {
|
35
|
-
ev.preventDefault();
|
36
|
-
ev.stopPropagation();
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
(_a = onKeyDown) === null || _a === void 0 ? void 0 : _a(ev);
|
40
|
-
}
|
41
|
-
};
|
42
|
-
draftState['aria-disabled'] = disabled /* || disabledFocusable*/;
|
43
|
-
draftState.disabled = draftState.as === 'button' ? disabled /* && !disabledFocusable */ : undefined;
|
44
|
-
};
|
45
|
-
//# sourceMappingURL=useButtonState.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useButtonState.js","sourceRoot":"../src/","sources":["components/Button/useButtonState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGxE;;;GAGG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG,UAAC,UAAuB;IACpD,IAAI,UAAU,CAAC,EAAE,KAAK,QAAQ,EAAE;QAC9B,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC;QAE3B,IAAI,UAAU,CAAC,EAAE,KAAK,GAAG,EAAE;YACjB,IAAA,sCAAwB,EAAE,0CAA4B,CAAgB;YAE9E,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC;YAExB,UAAU,CAAC,SAAS,GAAG,UAAC,EAAoC;gBAC1D,IAAI,mBAAiB,EAAE;oBACrB,mBAAiB,CAAC,EAAE,CAAC,CAAC;iBACvB;gBAED,IAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;gBAC5B,IAAI,CAAC,EAAE,CAAC,gBAAgB,IAAI,iBAAe,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,WAAW,CAAC,EAAE;oBAChG,gDAAgD;oBAChD,EAAE,CAAC,cAAc,EAAE,CAAC;oBACpB,EAAE,CAAC,eAAe,EAAE,CAAC;oBAEpB,EAAE,CAAC,MAAsB,CAAC,KAAK,EAAE,CAAC;iBACpC;YACH,CAAC,CAAC;SACH;KACF;IAED,sHAAsH;IAC9G,IAAA,8BAAQ,EAAE,wBAAwB,CAAC,gCAAS,CAAgB;IACpE,IAAI,QAAQ,EAAE;QACZ,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;KAChC;IACD,UAAU,CAAC,SAAS,GAAG,UAAC,EAAoC;;QAC1D,IAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,QAAQ,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,WAAW,CAAC,EAAE;YACjE,EAAE,CAAC,cAAc,EAAE,CAAC;YACpB,EAAE,CAAC,eAAe,EAAE,CAAC;SACtB;aAAM;YACL,MAAA,SAAS,0CAAG,EAAE,EAAE;SACjB;IACH,CAAC,CAAC;IAEF,UAAU,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC,yBAAyB,CAAC;IACjE,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC;AACtG,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { getCode, EnterKey, SpacebarKey } from '@fluentui/keyboard-key';\nimport { ButtonState } from './Button.types';\n\n/**\n * The useButton hook processes the Button draft state.\n * @param draftState - Button draft state to mutate.\n */\nexport const useButtonState = (draftState: ButtonState) => {\n if (draftState.as !== 'button') {\n draftState.role = 'button';\n\n if (draftState.as !== 'a') {\n const { onClick: onClickCallback, onKeyDown: onKeyDownCallback } = draftState;\n\n draftState.tabIndex = 0;\n\n draftState.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (onKeyDownCallback) {\n onKeyDownCallback(ev);\n }\n\n const keyCode = getCode(ev);\n if (!ev.defaultPrevented && onClickCallback && (keyCode === EnterKey || keyCode === SpacebarKey)) {\n // Translate the keydown enter/space to a click.\n ev.preventDefault();\n ev.stopPropagation();\n\n (ev.target as HTMLElement).click();\n }\n };\n }\n }\n\n // Disallow click and keyboard events when component is disabled and eat events when disabledFocusable is set to true.\n const { disabled, /* disabledFocusable, */ onKeyDown } = draftState;\n if (disabled) {\n draftState.onClick = undefined;\n }\n draftState.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n const keyCode = getCode(ev);\n if (disabled && (keyCode === EnterKey || keyCode === SpacebarKey)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n draftState['aria-disabled'] = disabled /* || disabledFocusable*/;\n draftState.disabled = draftState.as === 'button' ? disabled /* && !disabledFocusable */ : undefined;\n};\n"]}
|
package/lib-amd/Button.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './components/Button/index';
|
package/lib-amd/Button.js
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./components/Button/index"], function (require, exports, tslib_1, index_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(index_1, exports);
|
5
|
-
});
|
6
|
-
//# sourceMappingURL=Button.js.map
|
package/lib-amd/Button.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["Button.tsx"],"names":[],"mappings":";;;IAAA,uCAA0C","sourcesContent":["export * from './components/Button/index';\n"]}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@fluentui/react-conformance"], function (require, exports, react_conformance_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
function isConformant(testInfo) {
|
5
|
-
var defaultOptions = {
|
6
|
-
asPropHandlesRef: true,
|
7
|
-
componentPath: module.parent.filename.replace('.test', ''),
|
8
|
-
disabledTests: ['has-docblock', 'kebab-aria-attributes'],
|
9
|
-
};
|
10
|
-
react_conformance_1.isConformant(defaultOptions, testInfo);
|
11
|
-
}
|
12
|
-
exports.isConformant = isConformant;
|
13
|
-
});
|
14
|
-
//# sourceMappingURL=isConformant.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"isConformant.js","sourceRoot":"../src/","sources":["common/isConformant.ts"],"names":[],"mappings":";;;IAEA,SAAgB,YAAY,CAAC,QAAoD;QAC/E,IAAM,cAAc,GAAG;YACrB,gBAAgB,EAAE,IAAI;YACtB,aAAa,EAAE,MAAO,CAAC,MAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAC5D,aAAa,EAAE,CAAC,cAAc,EAAE,uBAAuB,CAAC;SACzD,CAAC;QAEF,gCAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IARD,oCAQC","sourcesContent":["import { isConformant as baseIsConformant, IsConformantOptions } from '@fluentui/react-conformance';\n\nexport function isConformant(testInfo: Omit<IsConformantOptions, 'componentPath'>) {\n const defaultOptions = {\n asPropHandlesRef: true,\n componentPath: module!.parent!.filename.replace('.test', ''),\n disabledTests: ['has-docblock', 'kebab-aria-attributes'],\n };\n\n baseIsConformant(defaultOptions, testInfo);\n}\n"]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
/**
|
3
|
-
* Define a styled Button, using the `useButton` hook.
|
4
|
-
* {@docCategory Button}
|
5
|
-
*/
|
6
|
-
export declare const Button: React.ForwardRefExoticComponent<import("@fluentui/react-utilities").ComponentProps & React.ButtonHTMLAttributes<HTMLElement> & {
|
7
|
-
icon?: import("@fluentui/react-utilities").ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
8
|
-
disabled?: boolean | undefined;
|
9
|
-
iconOnly?: boolean | undefined;
|
10
|
-
iconPosition?: "after" | "before" | undefined;
|
11
|
-
primary?: boolean | undefined;
|
12
|
-
size?: "small" | "large" | undefined;
|
13
|
-
} & React.RefAttributes<HTMLElement>>;
|