@fluentui/react-button 0.0.0-nightly-20220302-0405.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +4894 -0
- package/CHANGELOG.md +1817 -0
- package/LICENSE +15 -0
- package/README.md +36 -0
- 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 +240 -0
- package/lib/Button.d.ts +1 -0
- package/lib/Button.js +2 -0
- package/lib/Button.js.map +1 -0
- 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/components/Button/Button.d.ts +6 -0
- package/lib/components/Button/Button.js +15 -0
- package/lib/components/Button/Button.js.map +1 -0
- package/lib/components/Button/Button.types.d.ts +62 -0
- package/lib/components/Button/Button.types.js +2 -0
- package/lib/components/Button/Button.types.js.map +1 -0
- package/lib/components/Button/index.d.ts +5 -0
- package/lib/components/Button/index.js +5 -0
- package/lib/components/Button/index.js.map +1 -0
- package/lib/components/Button/renderButton.d.ts +5 -0
- package/lib/components/Button/renderButton.js +21 -0
- package/lib/components/Button/renderButton.js.map +1 -0
- package/lib/components/Button/useButton.d.ts +8 -0
- package/lib/components/Button/useButton.js +50 -0
- package/lib/components/Button/useButton.js.map +1 -0
- package/lib/components/Button/useButtonStyles.d.ts +3 -0
- package/lib/components/Button/useButtonStyles.js +418 -0
- package/lib/components/Button/useButtonStyles.js.map +1 -0
- 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 +23 -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 +3 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +168 -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 +10 -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 +21 -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 +3 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js +36 -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 +21 -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 +17 -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 +81 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +3 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +93 -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 +20 -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 +52 -0
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +3 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js +194 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib-commonjs/Button.d.ts +1 -0
- package/lib-commonjs/Button.js +10 -0
- package/lib-commonjs/Button.js.map +1 -0
- 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/components/Button/Button.d.ts +6 -0
- package/lib-commonjs/components/Button/Button.js +26 -0
- package/lib-commonjs/components/Button/Button.js.map +1 -0
- package/lib-commonjs/components/Button/Button.types.d.ts +62 -0
- package/lib-commonjs/components/Button/Button.types.js +6 -0
- package/lib-commonjs/components/Button/Button.types.js.map +1 -0
- package/lib-commonjs/components/Button/index.d.ts +5 -0
- package/lib-commonjs/components/Button/index.js +30 -0
- package/lib-commonjs/components/Button/index.js.map +1 -0
- package/lib-commonjs/components/Button/renderButton.d.ts +5 -0
- package/lib-commonjs/components/Button/renderButton.js +32 -0
- package/lib-commonjs/components/Button/renderButton.js.map +1 -0
- package/lib-commonjs/components/Button/useButton.d.ts +8 -0
- package/lib-commonjs/components/Button/useButton.js +61 -0
- package/lib-commonjs/components/Button/useButton.js.map +1 -0
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +3 -0
- package/lib-commonjs/components/Button/useButtonStyles.js +430 -0
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -0
- 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 +32 -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 +34 -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 +40 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +3 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +180 -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 +10 -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 +32 -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 +32 -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 +45 -0
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +3 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +47 -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 +21 -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 +32 -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 +28 -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 +93 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +3 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +105 -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 +20 -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 +32 -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 +64 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +3 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +206 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -0
- package/lib-commonjs/index.d.ts +5 -0
- package/lib-commonjs/index.js +18 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +68 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["ToggleButton.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/ToggleButton/index';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Button = void 0;
|
7
|
+
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
const renderButton_1 = /*#__PURE__*/require("./renderButton");
|
11
|
+
|
12
|
+
const useButton_1 = /*#__PURE__*/require("./useButton");
|
13
|
+
|
14
|
+
const useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
|
15
|
+
/**
|
16
|
+
* Buttons give people a way to trigger an action.
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
exports.Button = /*#__PURE__*/React.forwardRef((props, ref) => {
|
21
|
+
const state = useButton_1.useButton_unstable(props, ref);
|
22
|
+
useButtonStyles_1.useButtonStyles_unstable(state);
|
23
|
+
return renderButton_1.renderButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
|
24
|
+
});
|
25
|
+
exports.Button.displayName = 'Button';
|
26
|
+
//# sourceMappingURL=Button.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/Button/Button.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,MAAA,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,WAAA,CAAA,kBAAA,CAAmB,KAAnB,EAA0B,GAA1B,CAAd;AAEA,EAAA,iBAAA,CAAA,wBAAA,CAAyB,KAAzB;AAEA,SAAO,cAAA,CAAA,qBAAA,CAAsB,KAAtB,CAAP,CALsF,CAMtF;AACD,CAPuD,CAA3C;AASb,OAAA,CAAA,MAAA,CAAO,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { renderButton_unstable } from './renderButton';\nimport { useButton_unstable } from './useButton';\nimport { useButtonStyles_unstable } from './useButtonStyles';\nimport type { ButtonProps } from './Button.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Buttons give people a way to trigger an action.\n */\nexport const Button: ForwardRefComponent<ButtonProps> = React.forwardRef((props, ref) => {\n const state = useButton_unstable(props, ref);\n\n useButtonStyles_unstable(state);\n\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ButtonProps>;\n\nButton.displayName = 'Button';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import type { ARIAButtonSlotProps } from '@fluentui/react-aria';
|
2
|
+
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
3
|
+
export declare type ButtonSlots = {
|
4
|
+
/**
|
5
|
+
* Root of the component that renders as either a `<button>` tag or an `<a>` tag.
|
6
|
+
*/
|
7
|
+
root: Slot<ARIAButtonSlotProps>;
|
8
|
+
/**
|
9
|
+
* Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
|
10
|
+
*/
|
11
|
+
icon?: Slot<'span'>;
|
12
|
+
};
|
13
|
+
export declare type ButtonCommons = {
|
14
|
+
/**
|
15
|
+
* A button can have its content and borders styled for greater emphasis or to be subtle.
|
16
|
+
* - 'primary': Emphasizes the button as a primary action.
|
17
|
+
* - 'outline': Removes background styling.
|
18
|
+
* - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.
|
19
|
+
* - 'transparent': Removes background and border styling.
|
20
|
+
*/
|
21
|
+
appearance?: 'primary' | 'outline' | 'subtle' | 'transparent';
|
22
|
+
/**
|
23
|
+
* A button can fill the width of its container.
|
24
|
+
* @default false
|
25
|
+
*/
|
26
|
+
block: boolean;
|
27
|
+
/**
|
28
|
+
* When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it
|
29
|
+
* is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this
|
30
|
+
* pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.
|
31
|
+
* @default false
|
32
|
+
*/
|
33
|
+
disabledFocusable: boolean;
|
34
|
+
/**
|
35
|
+
* A button can show that it cannot be interacted with.
|
36
|
+
* @default false
|
37
|
+
*/
|
38
|
+
disabled: boolean;
|
39
|
+
/**
|
40
|
+
* A button can format its icon to appear before or after its content.
|
41
|
+
* @default 'before'
|
42
|
+
*/
|
43
|
+
iconPosition?: 'before' | 'after';
|
44
|
+
/**
|
45
|
+
* A button can be rounded, circular, or square.
|
46
|
+
* @default 'rounded'
|
47
|
+
*/
|
48
|
+
shape: 'rounded' | 'circular' | 'square';
|
49
|
+
/**
|
50
|
+
* A button supports different sizes.
|
51
|
+
* @default 'medium'
|
52
|
+
*/
|
53
|
+
size: 'small' | 'medium' | 'large';
|
54
|
+
};
|
55
|
+
export declare type ButtonProps = ComponentProps<ButtonSlots> & Partial<ButtonCommons>;
|
56
|
+
export declare type ButtonState = ComponentState<ButtonSlots> & ButtonCommons & {
|
57
|
+
/**
|
58
|
+
* A button can contain only an icon.
|
59
|
+
* @default false
|
60
|
+
*/
|
61
|
+
iconOnly: boolean;
|
62
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useButtonStyles_unstable = exports.buttonClassName = void 0;
|
7
|
+
|
8
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
tslib_1.__exportStar(require("./Button"), exports);
|
11
|
+
|
12
|
+
tslib_1.__exportStar(require("./renderButton"), exports);
|
13
|
+
|
14
|
+
tslib_1.__exportStar(require("./useButton"), exports);
|
15
|
+
|
16
|
+
var useButtonStyles_1 = /*#__PURE__*/require("./useButtonStyles");
|
17
|
+
|
18
|
+
Object.defineProperty(exports, "buttonClassName", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () {
|
21
|
+
return useButtonStyles_1.buttonClassName;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "useButtonStyles_unstable", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function () {
|
27
|
+
return useButtonStyles_1.useButtonStyles_unstable;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/Button/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AAGA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,eAAA;AAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,iBAAA,CAAA,wBAAA;AAAwB;AAAxB,CAAA","sourcesContent":["export * from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button.types';\nexport * from './renderButton';\nexport * from './useButton';\nexport { buttonClassName, useButtonStyles_unstable } from './useButtonStyles';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.renderButton_unstable = void 0;
|
7
|
+
|
8
|
+
const React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
/**
|
12
|
+
* Renders a Button component by passing the state defined props to the appropriate slots.
|
13
|
+
*/
|
14
|
+
|
15
|
+
|
16
|
+
const renderButton_unstable = state => {
|
17
|
+
const {
|
18
|
+
slots,
|
19
|
+
slotProps
|
20
|
+
} = react_utilities_1.getSlots(state);
|
21
|
+
const {
|
22
|
+
iconOnly,
|
23
|
+
iconPosition
|
24
|
+
} = state;
|
25
|
+
return React.createElement(slots.root, { ...slotProps.root
|
26
|
+
}, iconPosition !== 'after' && slots.icon && React.createElement(slots.icon, { ...slotProps.icon
|
27
|
+
}), !iconOnly && state.root.children, iconPosition === 'after' && slots.icon && React.createElement(slots.icon, { ...slotProps.icon
|
28
|
+
}));
|
29
|
+
};
|
30
|
+
|
31
|
+
exports.renderButton_unstable = renderButton_unstable;
|
32
|
+
//# sourceMappingURL=renderButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,qBAAqB,GAAI,KAAD,IAAuB;AAC1D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAsB,KAAtB,CAA7B;AACA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA6B,KAAnC;AAEA,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,IAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAD7C,EAEG,CAAC,QAAD,IAAa,KAAK,CAAC,IAAN,CAAW,QAF3B,EAGG,YAAY,KAAK,OAAjB,IAA4B,KAAK,CAAC,IAAlC,IAA0C,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAH7C,CADF;AAOD,CAXM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { ButtonSlots, ButtonState } from './Button.types';\n\n/**\n * Renders a Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton_unstable = (state: ButtonState) => {\n const { slots, slotProps } = getSlots<ButtonSlots>(state);\n const { iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n {!iconOnly && state.root.children}\n {iconPosition === 'after' && slots.icon && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { ButtonProps, ButtonState } from './Button.types';
|
3
|
+
/**
|
4
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
5
|
+
* @param props - User provided props to the Button component.
|
6
|
+
* @param ref - User provided ref to be passed to the Button component.
|
7
|
+
*/
|
8
|
+
export declare const useButton_unstable: (props: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => ButtonState;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useButton_unstable = void 0;
|
7
|
+
|
8
|
+
const react_aria_1 = /*#__PURE__*/require("@fluentui/react-aria");
|
9
|
+
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
/**
|
12
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
13
|
+
* @param props - User provided props to the Button component.
|
14
|
+
* @param ref - User provided ref to be passed to the Button component.
|
15
|
+
*/
|
16
|
+
|
17
|
+
|
18
|
+
const useButton_unstable = (props, ref) => {
|
19
|
+
const {
|
20
|
+
appearance,
|
21
|
+
as,
|
22
|
+
block = false,
|
23
|
+
disabled = false,
|
24
|
+
disabledFocusable = false,
|
25
|
+
icon,
|
26
|
+
iconPosition = 'before',
|
27
|
+
shape = 'rounded',
|
28
|
+
size = 'medium'
|
29
|
+
} = props;
|
30
|
+
const iconShorthand = react_utilities_1.resolveShorthand(icon);
|
31
|
+
return {
|
32
|
+
// Props passed at the top-level
|
33
|
+
appearance,
|
34
|
+
block,
|
35
|
+
disabled,
|
36
|
+
disabledFocusable,
|
37
|
+
iconPosition,
|
38
|
+
shape,
|
39
|
+
size,
|
40
|
+
// State calculated from a set of props
|
41
|
+
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
|
42
|
+
// Slots definition
|
43
|
+
components: {
|
44
|
+
root: 'button',
|
45
|
+
icon: 'span'
|
46
|
+
},
|
47
|
+
root: react_utilities_1.getNativeElementProps(as || 'button', react_aria_1.useARIAButton(props, {
|
48
|
+
required: true,
|
49
|
+
defaultProps: {
|
50
|
+
// useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>
|
51
|
+
ref: ref,
|
52
|
+
type: 'button' // This is added because the default for type is 'submit'
|
53
|
+
|
54
|
+
}
|
55
|
+
})),
|
56
|
+
icon: iconShorthand
|
57
|
+
};
|
58
|
+
};
|
59
|
+
|
60
|
+
exports.useButton_unstable = useButton_unstable;
|
61
|
+
//# sourceMappingURL=useButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;;AAEA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;;AAIG;;;AACI,MAAM,kBAAkB,GAAG,CAChC,KADgC,EAEhC,GAFgC,KAGjB;AACf,QAAM;AACJ,IAAA,UADI;AAEJ,IAAA,EAFI;AAGJ,IAAA,KAAK,GAAG,KAHJ;AAIJ,IAAA,QAAQ,GAAG,KAJP;AAKJ,IAAA,iBAAiB,GAAG,KALhB;AAMJ,IAAA,IANI;AAOJ,IAAA,YAAY,GAAG,QAPX;AAQJ,IAAA,KAAK,GAAG,SARJ;AASJ,IAAA,IAAI,GAAG;AATH,MAUF,KAVJ;AAWA,QAAM,aAAa,GAAG,iBAAA,CAAA,gBAAA,CAAiB,IAAjB,CAAtB;AAEA,SAAO;AACL;AACA,IAAA,UAFK;AAGL,IAAA,KAHK;AAIL,IAAA,QAJK;AAKL,IAAA,iBALK;AAML,IAAA,YANK;AAOL,IAAA,KAPK;AAQL,IAAA,IARK;AAUL;AACA,IAAA,QAAQ,EAAE,OAAO,CAAC,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,QAAf,KAA2B,CAAC,KAAK,CAAC,QAAnC,CAXZ;AAaL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE;AAFI,KAdP;AAmBL,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CACJ,EAAE,IAAI,QADF,EAEJ,YAAA,CAAA,aAAA,CAAmC,KAAnC,EAA0C;AACxC,MAAA,QAAQ,EAAE,IAD8B;AAExC,MAAA,YAAY,EAAE;AACZ;AACA,QAAA,GAAG,EAAE,GAFO;AAGZ,QAAA,IAAI,EAAE,QAHM,CAGI;;AAHJ;AAF0B,KAA1C,CAFI,CAnBD;AA8BL,IAAA,IAAI,EAAE;AA9BD,GAAP;AAgCD,CAjDM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useARIAButton } from '@fluentui/react-aria';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonState } from './Button.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonState => {\n const {\n appearance,\n as,\n block = false,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n shape = 'rounded',\n size = 'medium',\n } = props;\n const iconShorthand = resolveShorthand(icon);\n\n return {\n // Props passed at the top-level\n appearance,\n block,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // State calculated from a set of props\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n },\n\n root: getNativeElementProps(\n as || 'button',\n useARIAButton<ARIAButtonSlotProps>(props, {\n required: true,\n defaultProps: {\n // useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>\n ref: ref as React.Ref<HTMLButtonElement>,\n type: 'button', // This is added because the default for type is 'submit'\n },\n }),\n ),\n icon: iconShorthand,\n };\n};\n"],"sourceRoot":"../src/"}
|