@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
@@ -1,385 +0,0 @@
|
|
1
|
-
define(["require", "exports", "@fluentui/react-make-styles"], function (require, exports, react_make_styles_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
// TODO: These are named in design specs but not hoisted to global/alias yet.
|
5
|
-
// We're tracking these here to determine how we can hoist them.
|
6
|
-
var buttonSpacing = {
|
7
|
-
smallest: '2px',
|
8
|
-
smaller: '4px',
|
9
|
-
small: '6px',
|
10
|
-
medium: '8px',
|
11
|
-
large: '12px',
|
12
|
-
larger: '16px',
|
13
|
-
};
|
14
|
-
// We do not want a combinatorial explosion of component variables for variants (bg, bgPrimary, etc)
|
15
|
-
// We want a fixed interface of variables for a given component and to alter those between variants
|
16
|
-
exports.makeButtonTokens = function (theme) { return ({
|
17
|
-
base: {
|
18
|
-
// TODO: these are not in the global/alias theme currently
|
19
|
-
// When they are shown in the token UI, we need to make it clear there is no global/alias mapping support
|
20
|
-
height: '32px',
|
21
|
-
paddingX: buttonSpacing.large,
|
22
|
-
paddingY: '0',
|
23
|
-
minWidth: '96px',
|
24
|
-
maxWidth: '280px',
|
25
|
-
color: theme.alias.color.neutral.neutralForeground1,
|
26
|
-
content2Color: theme.alias.color.neutral.neutralForeground2,
|
27
|
-
background: theme.alias.color.neutral.neutralBackground1,
|
28
|
-
backgroundPressed: theme.alias.color.neutral.neutralBackground1,
|
29
|
-
borderRadius: theme.global.borderRadius.medium,
|
30
|
-
borderWidth: theme.global.strokeWidth.thin,
|
31
|
-
borderColor: theme.alias.color.neutral.neutralStroke1,
|
32
|
-
backgroundHover: theme.alias.color.neutral.neutralBackground1Hover,
|
33
|
-
borderColorHover: theme.alias.color.neutral.neutralStroke1Hover,
|
34
|
-
backgroundActive: theme.alias.color.neutral.neutralBackground1Pressed,
|
35
|
-
borderColorActive: theme.alias.color.neutral.neutralStroke1Pressed,
|
36
|
-
fontWeight: theme.global.type.fontWeights.semibold,
|
37
|
-
fontSize: theme.global.type.fontSizes.base[300],
|
38
|
-
lineHeight: theme.global.type.lineHeights.base[300],
|
39
|
-
iconSpacing: buttonSpacing.small,
|
40
|
-
iconWidth: '20px',
|
41
|
-
iconHeight: '20px',
|
42
|
-
},
|
43
|
-
disabled: {
|
44
|
-
background: theme.alias.color.neutral.neutralBackgroundDisabled,
|
45
|
-
borderColor: theme.alias.color.neutral.neutralStrokeDisabled,
|
46
|
-
color: theme.alias.color.neutral.neutralForegroundDisabled,
|
47
|
-
content2Color: theme.alias.color.neutral.neutralForegroundDisabled,
|
48
|
-
},
|
49
|
-
small: {
|
50
|
-
paddingX: buttonSpacing.medium,
|
51
|
-
borderRadius: theme.global.borderRadius.small,
|
52
|
-
// TODO: design spec says minWidth "can be toggled off", consider prop like compact?
|
53
|
-
minWidth: '64px',
|
54
|
-
height: '24px',
|
55
|
-
fontSize: theme.global.type.fontSizes.base[200],
|
56
|
-
lineHeight: theme.global.type.fontSizes.base[200],
|
57
|
-
fontWeight: theme.global.type.fontWeights.regular,
|
58
|
-
},
|
59
|
-
large: {
|
60
|
-
paddingX: buttonSpacing.larger,
|
61
|
-
height: '40px',
|
62
|
-
borderRadius: theme.global.borderRadius.medium,
|
63
|
-
fontSize: theme.global.type.fontSizes.base[400],
|
64
|
-
// TODO: 24px is not on the global ramp of line heights
|
65
|
-
// 22px = theme.global.type.lineHeights.base[400]
|
66
|
-
// 28px = theme.global.type.lineHeights.base[500]
|
67
|
-
lineHeight: '24px',
|
68
|
-
iconWidth: '24px',
|
69
|
-
iconHeight: '24px',
|
70
|
-
iconSpacing: buttonSpacing.small,
|
71
|
-
},
|
72
|
-
// TODO: Would be ideal to automate a check to ensure when a variant is accessed, all the tokens are accessed as well.
|
73
|
-
// If not, it means there is cruft in the variant tokens definition.
|
74
|
-
// All tokens in a variant should be mapped to some style property.
|
75
|
-
iconOnly: {
|
76
|
-
paddingX: buttonSpacing.small,
|
77
|
-
paddingY: buttonSpacing.small,
|
78
|
-
minWidth: '32px',
|
79
|
-
maxWidth: '32px',
|
80
|
-
},
|
81
|
-
// TODO: combinatorial "variants" is wrong, we already have iconOnly and small.
|
82
|
-
// we essentially need to update component token mappings based on variant matchers.
|
83
|
-
// fow the sake of progress for now, we're extending variants to have combinations.
|
84
|
-
iconOnlySmall: {
|
85
|
-
paddingX: buttonSpacing.smallest,
|
86
|
-
paddingY: buttonSpacing.smallest,
|
87
|
-
borderRadius: theme.global.borderRadius.small,
|
88
|
-
minWidth: '24px',
|
89
|
-
maxWidth: '24px',
|
90
|
-
},
|
91
|
-
iconOnlyLarge: {
|
92
|
-
paddingX: buttonSpacing.small,
|
93
|
-
paddingY: buttonSpacing.small,
|
94
|
-
borderRadius: theme.global.borderRadius.medium,
|
95
|
-
minWidth: '40px',
|
96
|
-
maxWidth: '40px',
|
97
|
-
},
|
98
|
-
primary: {
|
99
|
-
color: theme.alias.color.neutral.neutralForegroundInvertedAccessible,
|
100
|
-
background: theme.alias.color.brand.brandBackground,
|
101
|
-
borderColor: 'transparent',
|
102
|
-
borderColorHover: 'transparent',
|
103
|
-
borderColorActive: 'transparent',
|
104
|
-
backgroundHover: theme.alias.color.brand.brandBackgroundHover,
|
105
|
-
backgroundPressed: theme.alias.color.brand.brandBackgroundPressed,
|
106
|
-
// TODO: spec calls out "shadow 4 __brand__", are we missing tokens?
|
107
|
-
shadow: theme.alias.shadow.shadow4,
|
108
|
-
// TODO: spec calls out "shadow 2 __darker__", are we missing tokens?
|
109
|
-
shadowPressed: theme.alias.shadow.shadow2,
|
110
|
-
},
|
111
|
-
primaryDisabled: {
|
112
|
-
background: theme.alias.color.neutral.neutralBackgroundDisabled,
|
113
|
-
// borderColor: theme.alias.color.neutral.neutralStrokeDisabled,
|
114
|
-
color: theme.alias.color.neutral.neutralForegroundDisabled,
|
115
|
-
content2Color: theme.alias.color.neutral.neutralForegroundDisabled,
|
116
|
-
shadow: 'none',
|
117
|
-
shadowPressed: 'none',
|
118
|
-
},
|
119
|
-
}); };
|
120
|
-
var useRootStyles = react_make_styles_1.makeStylesCompat([
|
121
|
-
[
|
122
|
-
null,
|
123
|
-
function (theme) {
|
124
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
125
|
-
return {
|
126
|
-
display: 'inline-flex',
|
127
|
-
alignItems: 'center',
|
128
|
-
justifyContent: 'center',
|
129
|
-
// TODO: remove unsafe property: https://caniuse.com/?search=gap
|
130
|
-
gap: buttonTokens.base.iconSpacing,
|
131
|
-
// // TODO: 1) ask designers what our vertical align strategy is
|
132
|
-
// // 2) enforce with conformance for inline elements
|
133
|
-
verticalAlign: 'text-bottom',
|
134
|
-
margin: 0,
|
135
|
-
padding: buttonTokens.base.paddingY + " " + buttonTokens.base.paddingX,
|
136
|
-
height: buttonTokens.base.height,
|
137
|
-
minWidth: buttonTokens.base.minWidth,
|
138
|
-
maxWidth: buttonTokens.base.maxWidth,
|
139
|
-
color: buttonTokens.base.color,
|
140
|
-
borderStyle: 'solid',
|
141
|
-
borderRadius: buttonTokens.base.borderRadius,
|
142
|
-
borderWidth: buttonTokens.base.borderWidth,
|
143
|
-
borderColor: buttonTokens.base.borderColor,
|
144
|
-
background: buttonTokens.base.background,
|
145
|
-
outline: 'none',
|
146
|
-
':hover': {
|
147
|
-
background: buttonTokens.base.backgroundHover,
|
148
|
-
borderColor: buttonTokens.base.borderColorHover,
|
149
|
-
cursor: 'pointer',
|
150
|
-
},
|
151
|
-
':active': {
|
152
|
-
background: buttonTokens.base.backgroundActive,
|
153
|
-
borderColor: buttonTokens.base.borderColorActive,
|
154
|
-
outline: 'none',
|
155
|
-
},
|
156
|
-
};
|
157
|
-
},
|
158
|
-
],
|
159
|
-
[
|
160
|
-
function (_a) {
|
161
|
-
var size = _a.size;
|
162
|
-
return size === 'small';
|
163
|
-
},
|
164
|
-
function (theme) {
|
165
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
166
|
-
return {
|
167
|
-
padding: buttonTokens.small.paddingX + " " + buttonTokens.small.paddingY,
|
168
|
-
minWidth: buttonTokens.small.minWidth,
|
169
|
-
height: buttonTokens.small.height,
|
170
|
-
borderRadius: buttonTokens.small.borderRadius,
|
171
|
-
};
|
172
|
-
},
|
173
|
-
],
|
174
|
-
[
|
175
|
-
function (_a) {
|
176
|
-
var size = _a.size;
|
177
|
-
return size === 'large';
|
178
|
-
},
|
179
|
-
function (theme) {
|
180
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
181
|
-
return {
|
182
|
-
gap: buttonTokens.large.iconSpacing,
|
183
|
-
padding: buttonTokens.large.paddingX + " " + buttonTokens.large.paddingY,
|
184
|
-
height: buttonTokens.large.height,
|
185
|
-
borderRadius: buttonTokens.large.borderRadius,
|
186
|
-
};
|
187
|
-
},
|
188
|
-
],
|
189
|
-
[
|
190
|
-
function (_a) {
|
191
|
-
var disabled = _a.disabled;
|
192
|
-
return disabled;
|
193
|
-
},
|
194
|
-
function (theme) {
|
195
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
196
|
-
return {
|
197
|
-
background: buttonTokens.disabled.background,
|
198
|
-
borderColor: buttonTokens.disabled.borderColor,
|
199
|
-
color: buttonTokens.disabled.color,
|
200
|
-
':hover': {
|
201
|
-
background: buttonTokens.disabled.background,
|
202
|
-
borderColor: buttonTokens.disabled.borderColor,
|
203
|
-
cursor: 'default',
|
204
|
-
},
|
205
|
-
':active': {
|
206
|
-
background: buttonTokens.disabled.background,
|
207
|
-
borderColor: buttonTokens.disabled.borderColor,
|
208
|
-
},
|
209
|
-
};
|
210
|
-
},
|
211
|
-
],
|
212
|
-
[
|
213
|
-
function (_a) {
|
214
|
-
var primary = _a.primary;
|
215
|
-
return primary;
|
216
|
-
},
|
217
|
-
function (theme) {
|
218
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
219
|
-
return {
|
220
|
-
background: buttonTokens.primary.background,
|
221
|
-
color: buttonTokens.primary.color,
|
222
|
-
borderColor: buttonTokens.primary.borderColor,
|
223
|
-
// TODO: spec calls out "shadow 4 __darker__", are we missing tokens?
|
224
|
-
boxShadow: buttonTokens.primary.shadow,
|
225
|
-
':hover': {
|
226
|
-
background: buttonTokens.primary.backgroundHover,
|
227
|
-
borderColor: buttonTokens.primary.borderColorHover,
|
228
|
-
},
|
229
|
-
':active': {
|
230
|
-
background: buttonTokens.primary.backgroundPressed,
|
231
|
-
// TODO: spec calls out "shadow 2 __darker__", are we missing tokens?
|
232
|
-
boxShadow: buttonTokens.primary.shadow,
|
233
|
-
borderColor: buttonTokens.primary.borderColorActive,
|
234
|
-
},
|
235
|
-
};
|
236
|
-
},
|
237
|
-
],
|
238
|
-
[
|
239
|
-
function (_a) {
|
240
|
-
var primary = _a.primary, disabled = _a.disabled;
|
241
|
-
return primary && disabled;
|
242
|
-
},
|
243
|
-
function (theme) {
|
244
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
245
|
-
return {
|
246
|
-
background: buttonTokens.primaryDisabled.background,
|
247
|
-
color: buttonTokens.primaryDisabled.color,
|
248
|
-
boxShadow: buttonTokens.primaryDisabled.shadow,
|
249
|
-
':hover': {
|
250
|
-
background: buttonTokens.primaryDisabled.background,
|
251
|
-
cursor: 'default',
|
252
|
-
},
|
253
|
-
':active': {
|
254
|
-
boxShadow: buttonTokens.primaryDisabled.shadowPressed,
|
255
|
-
},
|
256
|
-
};
|
257
|
-
},
|
258
|
-
],
|
259
|
-
[
|
260
|
-
function (_a) {
|
261
|
-
var iconOnly = _a.iconOnly;
|
262
|
-
return iconOnly;
|
263
|
-
},
|
264
|
-
function (theme) {
|
265
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
266
|
-
return {
|
267
|
-
padding: buttonTokens.iconOnly.paddingX,
|
268
|
-
minWidth: buttonTokens.iconOnly.minWidth,
|
269
|
-
maxWidth: buttonTokens.iconOnly.maxWidth,
|
270
|
-
};
|
271
|
-
},
|
272
|
-
],
|
273
|
-
[
|
274
|
-
function (_a) {
|
275
|
-
var iconOnly = _a.iconOnly, size = _a.size;
|
276
|
-
return iconOnly && size === 'small';
|
277
|
-
},
|
278
|
-
function (theme) {
|
279
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
280
|
-
return {
|
281
|
-
padding: buttonTokens.iconOnlySmall.paddingX + " " + buttonTokens.iconOnlySmall.paddingY,
|
282
|
-
minWidth: buttonTokens.iconOnlySmall.minWidth,
|
283
|
-
maxWidth: buttonTokens.iconOnlySmall.maxWidth,
|
284
|
-
borderRadius: buttonTokens.iconOnlySmall.borderRadius,
|
285
|
-
};
|
286
|
-
},
|
287
|
-
],
|
288
|
-
[
|
289
|
-
function (_a) {
|
290
|
-
var iconOnly = _a.iconOnly, size = _a.size;
|
291
|
-
return iconOnly && size === 'large';
|
292
|
-
},
|
293
|
-
function (theme) {
|
294
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
295
|
-
return {
|
296
|
-
padding: buttonTokens.iconOnlyLarge.paddingX + " " + buttonTokens.iconOnlyLarge.paddingY,
|
297
|
-
minWidth: buttonTokens.iconOnlyLarge.minWidth,
|
298
|
-
maxWidth: buttonTokens.iconOnlyLarge.maxWidth,
|
299
|
-
borderRadius: buttonTokens.iconOnlyLarge.borderRadius,
|
300
|
-
};
|
301
|
-
},
|
302
|
-
],
|
303
|
-
]);
|
304
|
-
var useChildrenStyles = react_make_styles_1.makeStylesCompat([
|
305
|
-
[
|
306
|
-
null,
|
307
|
-
function (theme) {
|
308
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
309
|
-
return {
|
310
|
-
textOverflow: 'ellipsis',
|
311
|
-
overflow: 'hidden',
|
312
|
-
whiteSpace: 'nowrap',
|
313
|
-
// TODO: This is "Body, Strong (?)" token in the design spec (14px size, 20px line, semibold weight)
|
314
|
-
// There are some type aliases in the figma not in our theme as well, not sure if this maps to alias or not
|
315
|
-
fontWeight: buttonTokens.base.fontWeight,
|
316
|
-
fontSize: buttonTokens.base.fontSize,
|
317
|
-
lineHeight: buttonTokens.base.lineHeight,
|
318
|
-
};
|
319
|
-
},
|
320
|
-
],
|
321
|
-
[
|
322
|
-
function (_a) {
|
323
|
-
var size = _a.size;
|
324
|
-
return size === 'small';
|
325
|
-
},
|
326
|
-
function (theme) {
|
327
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
328
|
-
return {
|
329
|
-
fontSize: buttonTokens.small.fontSize,
|
330
|
-
fontWeight: buttonTokens.small.fontWeight,
|
331
|
-
lineHeight: buttonTokens.small.lineHeight,
|
332
|
-
};
|
333
|
-
},
|
334
|
-
],
|
335
|
-
[
|
336
|
-
function (_a) {
|
337
|
-
var size = _a.size;
|
338
|
-
return size === 'large';
|
339
|
-
},
|
340
|
-
function (theme) {
|
341
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
342
|
-
return {
|
343
|
-
fontSize: buttonTokens.large.fontSize,
|
344
|
-
lineHeight: buttonTokens.large.lineHeight,
|
345
|
-
};
|
346
|
-
},
|
347
|
-
],
|
348
|
-
]);
|
349
|
-
var useIconStyles = react_make_styles_1.makeStylesCompat([
|
350
|
-
[
|
351
|
-
null,
|
352
|
-
function (theme) {
|
353
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
354
|
-
return {
|
355
|
-
display: 'inline-flex',
|
356
|
-
alignItems: 'center',
|
357
|
-
justifyContent: 'center',
|
358
|
-
height: buttonTokens.base.iconHeight,
|
359
|
-
width: buttonTokens.base.iconWidth,
|
360
|
-
};
|
361
|
-
},
|
362
|
-
],
|
363
|
-
[
|
364
|
-
function (_a) {
|
365
|
-
var size = _a.size;
|
366
|
-
return size === 'large';
|
367
|
-
},
|
368
|
-
function (theme) {
|
369
|
-
var buttonTokens = exports.makeButtonTokens(theme);
|
370
|
-
return {
|
371
|
-
width: buttonTokens.large.iconWidth,
|
372
|
-
height: buttonTokens.large.iconHeight,
|
373
|
-
};
|
374
|
-
},
|
375
|
-
],
|
376
|
-
]);
|
377
|
-
exports.useButtonStyles = function (state, selectors) {
|
378
|
-
state.className = react_make_styles_1.ax(state.className, useRootStyles(selectors));
|
379
|
-
state.children = state.children || { className: '' };
|
380
|
-
state.icon = state.icon || { className: '' };
|
381
|
-
state.children.className = react_make_styles_1.ax(state.children.className, useChildrenStyles(selectors));
|
382
|
-
state.icon.className = react_make_styles_1.ax(state.icon.className, useIconStyles(selectors));
|
383
|
-
};
|
384
|
-
});
|
385
|
-
//# sourceMappingURL=useButtonStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useButtonStyles.js","sourceRoot":"../src/","sources":["components/Button/useButtonStyles.ts"],"names":[],"mappings":";;;IAIA,6EAA6E;IAC7E,sEAAsE;IACtE,IAAM,aAAa,GAAG;QACpB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,KAAK,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AhB,CAAgB;YAC9B,UAAA,KAAK;gBACH,IAAM,YAAY,GAAG,wBAAgB,CAAC,KAAK,CAAC,CAAC;gBAE7C,OAAO;oBACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS;oBACnC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,UAAU;iBACtC,CAAC;YACJ,CAAC;SACF;KACF,CAAC,CAAC;IAEU,QAAA,eAAe,GAAG,UAAC,KAAkB,EAAE,SAA+B;QACjF,KAAK,CAAC,SAAS,GAAG,sBAAE,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;QAEhE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACrD,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAE7C,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,sBAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;QACtF,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,sBAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC","sourcesContent":["import { ButtonState, ButtonStyleSelectors, ButtonVariantTokens } from './Button.types';\nimport { ax, makeStylesCompat } from '@fluentui/react-make-styles';\nimport { Theme } from '@fluentui/react-theme';\n\n// TODO: These are named in design specs but not hoisted to global/alias yet.\n// We're tracking these here to determine how we can hoist them.\nconst buttonSpacing = {\n smallest: '2px',\n smaller: '4px',\n small: '6px',\n medium: '8px',\n large: '12px',\n larger: '16px',\n};\n\n// We do not want a combinatorial explosion of component variables for variants (bg, bgPrimary, etc)\n// We want a fixed interface of variables for a given component and to alter those between variants\nexport const makeButtonTokens = (theme: Theme): ButtonVariantTokens => ({\n base: {\n // TODO: these are not in the global/alias theme currently\n // When they are shown in the token UI, we need to make it clear there is no global/alias mapping support\n height: '32px',\n paddingX: buttonSpacing.large,\n paddingY: '0',\n minWidth: '96px',\n maxWidth: '280px',\n\n color: theme.alias.color.neutral.neutralForeground1,\n content2Color: theme.alias.color.neutral.neutralForeground2,\n background: theme.alias.color.neutral.neutralBackground1,\n backgroundPressed: theme.alias.color.neutral.neutralBackground1,\n\n borderRadius: theme.global.borderRadius.medium,\n borderWidth: theme.global.strokeWidth.thin,\n borderColor: theme.alias.color.neutral.neutralStroke1,\n\n backgroundHover: theme.alias.color.neutral.neutralBackground1Hover,\n borderColorHover: theme.alias.color.neutral.neutralStroke1Hover,\n\n backgroundActive: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColorActive: theme.alias.color.neutral.neutralStroke1Pressed,\n\n fontWeight: theme.global.type.fontWeights.semibold,\n fontSize: theme.global.type.fontSizes.base[300],\n lineHeight: theme.global.type.lineHeights.base[300],\n\n iconSpacing: buttonSpacing.small,\n iconWidth: '20px',\n iconHeight: '20px',\n },\n disabled: {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n content2Color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n small: {\n paddingX: buttonSpacing.medium,\n borderRadius: theme.global.borderRadius.small,\n // TODO: design spec says minWidth \"can be toggled off\", consider prop like compact?\n minWidth: '64px',\n height: '24px',\n fontSize: theme.global.type.fontSizes.base[200],\n lineHeight: theme.global.type.fontSizes.base[200],\n fontWeight: theme.global.type.fontWeights.regular,\n },\n large: {\n paddingX: buttonSpacing.larger,\n height: '40px',\n borderRadius: theme.global.borderRadius.medium,\n fontSize: theme.global.type.fontSizes.base[400],\n // TODO: 24px is not on the global ramp of line heights\n // 22px = theme.global.type.lineHeights.base[400]\n // 28px = theme.global.type.lineHeights.base[500]\n lineHeight: '24px',\n iconWidth: '24px',\n iconHeight: '24px',\n iconSpacing: buttonSpacing.small,\n },\n // TODO: Would be ideal to automate a check to ensure when a variant is accessed, all the tokens are accessed as well.\n // If not, it means there is cruft in the variant tokens definition.\n // All tokens in a variant should be mapped to some style property.\n iconOnly: {\n paddingX: buttonSpacing.small,\n paddingY: buttonSpacing.small,\n minWidth: '32px',\n maxWidth: '32px',\n },\n // TODO: combinatorial \"variants\" is wrong, we already have iconOnly and small.\n // we essentially need to update component token mappings based on variant matchers.\n // fow the sake of progress for now, we're extending variants to have combinations.\n iconOnlySmall: {\n paddingX: buttonSpacing.smallest,\n paddingY: buttonSpacing.smallest,\n borderRadius: theme.global.borderRadius.small,\n minWidth: '24px',\n maxWidth: '24px',\n },\n iconOnlyLarge: {\n paddingX: buttonSpacing.small,\n paddingY: buttonSpacing.small,\n borderRadius: theme.global.borderRadius.medium,\n minWidth: '40px',\n maxWidth: '40px',\n },\n primary: {\n color: theme.alias.color.neutral.neutralForegroundInvertedAccessible,\n\n background: theme.alias.color.brand.brandBackground,\n borderColor: 'transparent',\n borderColorHover: 'transparent',\n borderColorActive: 'transparent',\n\n backgroundHover: theme.alias.color.brand.brandBackgroundHover,\n backgroundPressed: theme.alias.color.brand.brandBackgroundPressed,\n\n // TODO: spec calls out \"shadow 4 __brand__\", are we missing tokens?\n shadow: theme.alias.shadow.shadow4,\n\n // TODO: spec calls out \"shadow 2 __darker__\", are we missing tokens?\n shadowPressed: theme.alias.shadow.shadow2,\n },\n primaryDisabled: {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n // borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n content2Color: theme.alias.color.neutral.neutralForegroundDisabled,\n shadow: 'none',\n shadowPressed: 'none',\n },\n});\n\nconst useRootStyles = makeStylesCompat<ButtonStyleSelectors>([\n [\n null,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n // TODO: remove unsafe property: https://caniuse.com/?search=gap\n gap: buttonTokens.base.iconSpacing,\n // // TODO: 1) ask designers what our vertical align strategy is\n // // 2) enforce with conformance for inline elements\n verticalAlign: 'text-bottom',\n margin: 0,\n\n padding: `${buttonTokens.base.paddingY} ${buttonTokens.base.paddingX}`,\n height: buttonTokens.base.height,\n\n minWidth: buttonTokens.base.minWidth,\n maxWidth: buttonTokens.base.maxWidth,\n\n color: buttonTokens.base.color,\n borderStyle: 'solid',\n borderRadius: buttonTokens.base.borderRadius,\n borderWidth: buttonTokens.base.borderWidth,\n borderColor: buttonTokens.base.borderColor,\n background: buttonTokens.base.background,\n\n outline: 'none',\n ':hover': {\n background: buttonTokens.base.backgroundHover,\n borderColor: buttonTokens.base.borderColorHover,\n cursor: 'pointer',\n },\n ':active': {\n background: buttonTokens.base.backgroundActive,\n borderColor: buttonTokens.base.borderColorActive,\n outline: 'none',\n },\n // TODO: this is for toggle button only. Use here in regular button?\n // '.active': theme.alias.color.neutral.neutralStroke1Pressed,\n };\n },\n ],\n [\n ({ size }) => size === 'small',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n padding: `${buttonTokens.small.paddingX} ${buttonTokens.small.paddingY}`,\n minWidth: buttonTokens.small.minWidth,\n height: buttonTokens.small.height,\n borderRadius: buttonTokens.small.borderRadius,\n };\n },\n ],\n [\n ({ size }) => size === 'large',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n gap: buttonTokens.large.iconSpacing,\n padding: `${buttonTokens.large.paddingX} ${buttonTokens.large.paddingY}`,\n height: buttonTokens.large.height,\n borderRadius: buttonTokens.large.borderRadius,\n };\n },\n ],\n [\n ({ disabled }) => disabled,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n background: buttonTokens.disabled.background,\n borderColor: buttonTokens.disabled.borderColor,\n color: buttonTokens.disabled.color,\n ':hover': {\n background: buttonTokens.disabled.background,\n borderColor: buttonTokens.disabled.borderColor,\n cursor: 'default',\n },\n ':active': {\n background: buttonTokens.disabled.background,\n borderColor: buttonTokens.disabled.borderColor,\n },\n };\n },\n ],\n [\n ({ primary }) => primary,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n background: buttonTokens.primary.background,\n color: buttonTokens.primary.color,\n borderColor: buttonTokens.primary.borderColor,\n // TODO: spec calls out \"shadow 4 __darker__\", are we missing tokens?\n boxShadow: buttonTokens.primary.shadow,\n\n ':hover': {\n background: buttonTokens.primary.backgroundHover,\n borderColor: buttonTokens.primary.borderColorHover,\n },\n\n ':active': {\n background: buttonTokens.primary.backgroundPressed,\n // TODO: spec calls out \"shadow 2 __darker__\", are we missing tokens?\n boxShadow: buttonTokens.primary.shadow,\n borderColor: buttonTokens.primary.borderColorActive,\n },\n\n // TODO: focus\n };\n },\n ],\n [\n ({ primary, disabled }) => primary && disabled,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n background: buttonTokens.primaryDisabled.background,\n color: buttonTokens.primaryDisabled.color,\n boxShadow: buttonTokens.primaryDisabled.shadow,\n ':hover': {\n background: buttonTokens.primaryDisabled.background,\n cursor: 'default',\n },\n ':active': {\n boxShadow: buttonTokens.primaryDisabled.shadowPressed,\n },\n };\n },\n ],\n [\n ({ iconOnly }) => iconOnly,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n padding: buttonTokens.iconOnly.paddingX,\n minWidth: buttonTokens.iconOnly.minWidth,\n maxWidth: buttonTokens.iconOnly.maxWidth,\n };\n },\n ],\n [\n ({ iconOnly, size }) => iconOnly && size === 'small',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n padding: `${buttonTokens.iconOnlySmall.paddingX} ${buttonTokens.iconOnlySmall.paddingY}`,\n minWidth: buttonTokens.iconOnlySmall.minWidth,\n maxWidth: buttonTokens.iconOnlySmall.maxWidth,\n borderRadius: buttonTokens.iconOnlySmall.borderRadius,\n };\n },\n ],\n [\n ({ iconOnly, size }) => iconOnly && size === 'large',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n padding: `${buttonTokens.iconOnlyLarge.paddingX} ${buttonTokens.iconOnlyLarge.paddingY}`,\n minWidth: buttonTokens.iconOnlyLarge.minWidth,\n maxWidth: buttonTokens.iconOnlyLarge.maxWidth,\n borderRadius: buttonTokens.iconOnlyLarge.borderRadius,\n };\n },\n ],\n // TODO: add disabled before ship prerelease\n]);\n\nconst useChildrenStyles = makeStylesCompat<ButtonStyleSelectors>([\n [\n null,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n // TODO: This is \"Body, Strong (?)\" token in the design spec (14px size, 20px line, semibold weight)\n // There are some type aliases in the figma not in our theme as well, not sure if this maps to alias or not\n fontWeight: buttonTokens.base.fontWeight,\n fontSize: buttonTokens.base.fontSize,\n lineHeight: buttonTokens.base.lineHeight,\n };\n },\n ],\n [\n ({ size }) => size === 'small',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n fontSize: buttonTokens.small.fontSize,\n fontWeight: buttonTokens.small.fontWeight,\n lineHeight: buttonTokens.small.lineHeight,\n };\n },\n ],\n [\n ({ size }) => size === 'large',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n fontSize: buttonTokens.large.fontSize,\n lineHeight: buttonTokens.large.lineHeight,\n };\n },\n ],\n]);\n\nconst useIconStyles = makeStylesCompat<ButtonStyleSelectors>([\n [\n null,\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n height: buttonTokens.base.iconHeight,\n width: buttonTokens.base.iconWidth,\n };\n },\n ],\n [\n ({ size }) => size === 'large',\n theme => {\n const buttonTokens = makeButtonTokens(theme);\n\n return {\n width: buttonTokens.large.iconWidth,\n height: buttonTokens.large.iconHeight,\n };\n },\n ],\n]);\n\nexport const useButtonStyles = (state: ButtonState, selectors: ButtonStyleSelectors) => {\n state.className = ax(state.className, useRootStyles(selectors));\n\n state.children = state.children || { className: '' };\n state.icon = state.icon || { className: '' };\n\n state.children.className = ax(state.children.className, useChildrenStyles(selectors));\n state.icon.className = ax(state.icon.className, useIconStyles(selectors));\n};\n"]}
|
package/lib-amd/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './Button';
|
package/lib-amd/index.js
DELETED
package/lib-amd/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAAA,wCAAyB","sourcesContent":["export * from './Button';\n"]}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
var keyboard_key_1 = require("@fluentui/keyboard-key");
|
4
|
-
/**
|
5
|
-
* The useButton hook processes the Button draft state.
|
6
|
-
* @param draftState - Button draft state to mutate.
|
7
|
-
*/
|
8
|
-
exports.useButtonState = function (draftState) {
|
9
|
-
if (draftState.as !== 'button') {
|
10
|
-
draftState.role = 'button';
|
11
|
-
if (draftState.as !== 'a') {
|
12
|
-
var onClickCallback_1 = draftState.onClick, onKeyDownCallback_1 = draftState.onKeyDown;
|
13
|
-
draftState.tabIndex = 0;
|
14
|
-
draftState.onKeyDown = function (ev) {
|
15
|
-
if (onKeyDownCallback_1) {
|
16
|
-
onKeyDownCallback_1(ev);
|
17
|
-
}
|
18
|
-
var keyCode = keyboard_key_1.getCode(ev);
|
19
|
-
if (!ev.defaultPrevented && onClickCallback_1 && (keyCode === keyboard_key_1.EnterKey || keyCode === keyboard_key_1.SpacebarKey)) {
|
20
|
-
// Translate the keydown enter/space to a click.
|
21
|
-
ev.preventDefault();
|
22
|
-
ev.stopPropagation();
|
23
|
-
ev.target.click();
|
24
|
-
}
|
25
|
-
};
|
26
|
-
}
|
27
|
-
}
|
28
|
-
// Disallow click and keyboard events when component is disabled and eat events when disabledFocusable is set to true.
|
29
|
-
var disabled = draftState.disabled, /* disabledFocusable, */ onKeyDown = draftState.onKeyDown;
|
30
|
-
if (disabled) {
|
31
|
-
draftState.onClick = undefined;
|
32
|
-
}
|
33
|
-
draftState.onKeyDown = function (ev) {
|
34
|
-
var _a;
|
35
|
-
var keyCode = keyboard_key_1.getCode(ev);
|
36
|
-
if (disabled && (keyCode === keyboard_key_1.EnterKey || keyCode === keyboard_key_1.SpacebarKey)) {
|
37
|
-
ev.preventDefault();
|
38
|
-
ev.stopPropagation();
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
(_a = onKeyDown) === null || _a === void 0 ? void 0 : _a(ev);
|
42
|
-
}
|
43
|
-
};
|
44
|
-
draftState['aria-disabled'] = disabled /* || disabledFocusable*/;
|
45
|
-
draftState.disabled = draftState.as === 'button' ? disabled /* && !disabledFocusable */ : undefined;
|
46
|
-
};
|
47
|
-
//# sourceMappingURL=useButtonState.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useButtonState.js","sourceRoot":"../src/","sources":["components/Button/useButtonState.ts"],"names":[],"mappings":";;AACA,uDAAwE;AAGxE;;;GAGG;AACU,QAAA,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,sBAAO,CAAC,EAAE,CAAC,CAAC;gBAC5B,IAAI,CAAC,EAAE,CAAC,gBAAgB,IAAI,iBAAe,IAAI,CAAC,OAAO,KAAK,uBAAQ,IAAI,OAAO,KAAK,0BAAW,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,sBAAO,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,QAAQ,IAAI,CAAC,OAAO,KAAK,uBAAQ,IAAI,OAAO,KAAK,0BAAW,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"]}
|
@@ -1,120 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { ComponentProps, ShorthandProps } from '@fluentui/react-utilities';
|
3
|
-
import { ObjectShorthandProps } from '@fluentui/react-utilities';
|
4
|
-
|
5
|
-
export type ButtonProps = ComponentProps &
|
6
|
-
React.ButtonHTMLAttributes<HTMLElement> & {
|
7
|
-
/**
|
8
|
-
* Shorthand icon. A shorthand prop can be a literal, object, or
|
9
|
-
* JSX. The `children` prop of the object can be a render function,
|
10
|
-
* taking in the original slot component and props.
|
11
|
-
*/
|
12
|
-
icon?: ShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
13
|
-
|
14
|
-
// TODO: children needs a new typing to handle render functions along with hook updates for children functionality
|
15
|
-
// children?: ???;
|
16
|
-
|
17
|
-
// /** A button can appear circular. */
|
18
|
-
// circular?: boolean;
|
19
|
-
|
20
|
-
/** A button can show that it cannot be interacted with. */
|
21
|
-
disabled?: boolean;
|
22
|
-
|
23
|
-
// /**
|
24
|
-
// eslint-disable-next-line @fluentui/max-len
|
25
|
-
// * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it is
|
26
|
-
// * important to keep a consistent tab order for screen reader and keyboard users.
|
27
|
-
// * @defaultvalue false
|
28
|
-
// */
|
29
|
-
// disabledFocusable?: boolean;
|
30
|
-
|
31
|
-
// /** A button can fill the width of its container. */
|
32
|
-
// block?: boolean;
|
33
|
-
|
34
|
-
/** A button can contain only an icon. */
|
35
|
-
iconOnly?: boolean;
|
36
|
-
|
37
|
-
/** An icon button can format its icon to appear before or after its content. */
|
38
|
-
iconPosition?: 'before' | 'after';
|
39
|
-
|
40
|
-
// /** A button can show a loading indicator. */
|
41
|
-
// loading?: boolean;
|
42
|
-
|
43
|
-
/** A button can emphasize that it represents the primary action. */
|
44
|
-
primary?: boolean;
|
45
|
-
|
46
|
-
// /** A button can blend into its background to become less emphasized. */
|
47
|
-
// subtle?: boolean;
|
48
|
-
|
49
|
-
// /** A button can have no background styling and just be emphasized through its content styling. */
|
50
|
-
// transparent?: boolean;
|
51
|
-
|
52
|
-
/** A button can be sized. */
|
53
|
-
size?: 'small' | 'large';
|
54
|
-
};
|
55
|
-
|
56
|
-
/**
|
57
|
-
* {@docCategory Button}
|
58
|
-
*/
|
59
|
-
export interface ButtonState extends ButtonProps {
|
60
|
-
ref: React.RefObject<HTMLButtonElement>;
|
61
|
-
|
62
|
-
icon?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
63
|
-
children?: ObjectShorthandProps<React.HTMLAttributes<HTMLSpanElement>>;
|
64
|
-
}
|
65
|
-
|
66
|
-
export type ButtonStyleSelectors = {
|
67
|
-
disabled?: boolean;
|
68
|
-
iconOnly?: boolean;
|
69
|
-
primary?: boolean;
|
70
|
-
size?: string;
|
71
|
-
};
|
72
|
-
|
73
|
-
export type ButtonVariants =
|
74
|
-
| 'base'
|
75
|
-
| 'disabled'
|
76
|
-
| 'iconOnly'
|
77
|
-
| 'primary'
|
78
|
-
| 'small'
|
79
|
-
| 'large'
|
80
|
-
// TODO: get rid of these combinations, use individual variants in matchers
|
81
|
-
| 'primaryDisabled'
|
82
|
-
| 'iconOnlySmall'
|
83
|
-
| 'iconOnlyLarge';
|
84
|
-
|
85
|
-
export type ButtonTokens = {
|
86
|
-
height: string;
|
87
|
-
paddingX: string;
|
88
|
-
paddingY: string;
|
89
|
-
minWidth: string;
|
90
|
-
maxWidth: string;
|
91
|
-
|
92
|
-
fontSize: string;
|
93
|
-
fontWeight: number;
|
94
|
-
lineHeight: string;
|
95
|
-
|
96
|
-
iconWidth: string;
|
97
|
-
iconHeight: string;
|
98
|
-
iconSpacing: string;
|
99
|
-
|
100
|
-
color: string;
|
101
|
-
content2Color: string;
|
102
|
-
|
103
|
-
background: string;
|
104
|
-
backgroundHover: string;
|
105
|
-
backgroundPressed: string;
|
106
|
-
backgroundActive: string;
|
107
|
-
|
108
|
-
borderColor: string;
|
109
|
-
borderColorHover: string;
|
110
|
-
borderColorActive: string;
|
111
|
-
borderWidth: string;
|
112
|
-
borderRadius: string;
|
113
|
-
|
114
|
-
shadow: string;
|
115
|
-
shadowPressed: string;
|
116
|
-
};
|
117
|
-
|
118
|
-
export type ButtonVariantTokens = {
|
119
|
-
[variant in ButtonVariants]: Partial<ButtonTokens>;
|
120
|
-
};
|