@fluentui/react-button 9.0.3 → 9.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/CHANGELOG.json +142 -4
  2. package/CHANGELOG.md +40 -5
  3. package/dist/index.d.ts +1 -1
  4. package/lib/components/Button/Button.types.js.map +1 -1
  5. package/lib/components/Button/useButton.js +4 -6
  6. package/lib/components/Button/useButton.js.map +1 -1
  7. package/lib/components/Button/useButtonStyles.js +76 -67
  8. package/lib/components/Button/useButtonStyles.js.map +1 -1
  9. package/lib/components/CompoundButton/useCompoundButtonStyles.js +3 -4
  10. package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  11. package/lib/components/MenuButton/useMenuButton.js +3 -0
  12. package/lib/components/MenuButton/useMenuButton.js.map +1 -1
  13. package/lib/components/SplitButton/useSplitButtonStyles.js +18 -15
  14. package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  15. package/lib/components/ToggleButton/useToggleButtonStyles.js +52 -34
  16. package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  17. package/lib/utils/useToggleState.js +2 -2
  18. package/lib/utils/useToggleState.js.map +1 -1
  19. package/lib-commonjs/components/Button/useButton.js +3 -5
  20. package/lib-commonjs/components/Button/useButton.js.map +1 -1
  21. package/lib-commonjs/components/Button/useButtonStyles.js +76 -67
  22. package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
  23. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +3 -4
  24. package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
  25. package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -0
  26. package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
  27. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +18 -15
  28. package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
  29. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +54 -37
  30. package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
  31. package/lib-commonjs/utils/useToggleState.js +1 -1
  32. package/lib-commonjs/utils/useToggleState.js.map +1 -1
  33. package/package.json +11 -10
  34. package/dist/tsdoc-metadata.json +0 -11
package/CHANGELOG.json CHANGED
@@ -2,7 +2,145 @@
2
2
  "name": "@fluentui/react-button",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 14 Jul 2022 21:18:44 GMT",
5
+ "date": "Thu, 15 Sep 2022 09:45:17 GMT",
6
+ "tag": "@fluentui/react-button_v9.1.1",
7
+ "version": "9.1.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "humberto_makoto@hotmail.com",
12
+ "package": "@fluentui/react-button",
13
+ "commit": "17b9063802b28bf7f4b1c4d439623819ad8940fa",
14
+ "comment": "fix: Adding 'aria-expanded=false' to collapsed MenuButtons."
15
+ },
16
+ {
17
+ "author": "makotom@microsoft.com",
18
+ "package": "@fluentui/react-button",
19
+ "commit": "6bc03a4e9ee815da750466f9dc2d25df1373f3e9",
20
+ "comment": "chore: Remove max-width style from Button components."
21
+ },
22
+ {
23
+ "author": "humberto_makoto@hotmail.com",
24
+ "package": "@fluentui/react-button",
25
+ "commit": "ef3ea2307fd97c893eded2164d96f1f56e378fd3",
26
+ "comment": "chore: Cleaning up tokens in Button components so they better adhere to the design spec."
27
+ },
28
+ {
29
+ "author": "humberto_makoto@hotmail.com",
30
+ "package": "@fluentui/react-button",
31
+ "commit": "28f55597050bcdd293e57e7d1fdc87802150c59d",
32
+ "comment": "fix: Wrapping long text in Button components."
33
+ },
34
+ {
35
+ "author": "behowell@microsoft.com",
36
+ "package": "@fluentui/react-button",
37
+ "commit": "e598325b985cad3e5057f00893e0176416edd292",
38
+ "comment": "refactor: Replace useMergedEventCallbacks utility with mergeCallbacks"
39
+ },
40
+ {
41
+ "author": "olfedias@microsoft.com",
42
+ "package": "@fluentui/react-button",
43
+ "commit": "e610024474cfe5d45f61501a8b6a21daf4c794a2",
44
+ "comment": "chore: Update Griffel to latest version"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-button",
49
+ "comment": "Bump @fluentui/react-aria to v9.2.0",
50
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-button",
55
+ "comment": "Bump @fluentui/react-tabster to v9.1.1",
56
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-button",
61
+ "comment": "Bump @fluentui/react-theme to v9.1.0",
62
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
63
+ },
64
+ {
65
+ "author": "beachball",
66
+ "package": "@fluentui/react-button",
67
+ "comment": "Bump @fluentui/react-utilities to v9.1.0",
68
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
69
+ },
70
+ {
71
+ "author": "beachball",
72
+ "package": "@fluentui/react-button",
73
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.13",
74
+ "commit": "a33448fe4a0f4117686c378f80b893d1406d95a8"
75
+ }
76
+ ],
77
+ "none": [
78
+ {
79
+ "author": "martinhochel@microsoft.com",
80
+ "package": "@fluentui/react-button",
81
+ "commit": "e6cf183695d6d67a24e038c49a876224e5ed35e5",
82
+ "comment": "chore: update package scaffold"
83
+ },
84
+ {
85
+ "author": "makotom@microsoft.com",
86
+ "package": "@fluentui/react-button",
87
+ "commit": "e176621e71d595c6d17655c108db0b73eb9ec188",
88
+ "comment": "chore: Removing CompoundButtonAsToggleButton story since it was using non-exported functions."
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ {
94
+ "date": "Wed, 03 Aug 2022 16:03:39 GMT",
95
+ "tag": "@fluentui/react-button_v9.1.0",
96
+ "version": "9.1.0",
97
+ "comments": {
98
+ "minor": [
99
+ {
100
+ "author": "bernardo.sunderhus@gmail.com",
101
+ "package": "@fluentui/react-button",
102
+ "commit": "1293f53f79ea1dc7429f77e174b2dfdaffa99558",
103
+ "comment": "chore: Updates Button to use useARIAButton over useARIAButtonShorthand"
104
+ },
105
+ {
106
+ "author": "beachball",
107
+ "package": "@fluentui/react-button",
108
+ "comment": "Bump @fluentui/react-aria to v9.1.0",
109
+ "commit": "ee4a8be0d0831a6615f878f98db6a97cc61a802d"
110
+ },
111
+ {
112
+ "author": "beachball",
113
+ "package": "@fluentui/react-button",
114
+ "comment": "Bump @fluentui/react-tabster to v9.1.0",
115
+ "commit": "ee4a8be0d0831a6615f878f98db6a97cc61a802d"
116
+ },
117
+ {
118
+ "author": "beachball",
119
+ "package": "@fluentui/react-button",
120
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.12",
121
+ "commit": "ee4a8be0d0831a6615f878f98db6a97cc61a802d"
122
+ }
123
+ ],
124
+ "none": [
125
+ {
126
+ "author": "lingfangao@hotmail.com",
127
+ "package": "@fluentui/react-button",
128
+ "commit": "99cc385631d04a76ee10ebc143cb9fecd99640b6",
129
+ "comment": "chore: Add `prerelease` as disallowed changetype for 9.0.0 packages"
130
+ }
131
+ ],
132
+ "patch": [
133
+ {
134
+ "author": "miroslav.stastny@microsoft.com",
135
+ "package": "@fluentui/react-button",
136
+ "commit": "08563664778fd80284561d3c9d254307a0a32362",
137
+ "comment": "chore: Bump Griffel dependencies"
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "date": "Thu, 14 Jul 2022 21:21:09 GMT",
6
144
  "tag": "@fluentui/react-button_v9.0.3",
7
145
  "version": "9.0.3",
8
146
  "comments": {
@@ -17,19 +155,19 @@
17
155
  "author": "beachball",
18
156
  "package": "@fluentui/react-button",
19
157
  "comment": "Bump @fluentui/react-aria to v9.0.2",
20
- "commit": "802bc4e3730a88b0fc61b5bf42ef7fc6b6543fe2"
158
+ "commit": "79b513146194367544160f364b0a7dd749ed93e4"
21
159
  },
22
160
  {
23
161
  "author": "beachball",
24
162
  "package": "@fluentui/react-button",
25
163
  "comment": "Bump @fluentui/react-tabster to v9.0.3",
26
- "commit": "802bc4e3730a88b0fc61b5bf42ef7fc6b6543fe2"
164
+ "commit": "79b513146194367544160f364b0a7dd749ed93e4"
27
165
  },
28
166
  {
29
167
  "author": "beachball",
30
168
  "package": "@fluentui/react-button",
31
169
  "comment": "Bump @fluentui/react-utilities to v9.0.2",
32
- "commit": "802bc4e3730a88b0fc61b5bf42ef7fc6b6543fe2"
170
+ "commit": "79b513146194367544160f364b0a7dd749ed93e4"
33
171
  }
34
172
  ]
35
173
  }
package/CHANGELOG.md CHANGED
@@ -1,20 +1,55 @@
1
1
  # Change Log - @fluentui/react-button
2
2
 
3
- This log was last generated on Thu, 14 Jul 2022 21:18:44 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 15 Sep 2022 09:45:17 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.1.1)
8
+
9
+ Thu, 15 Sep 2022 09:45:17 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.1.0..@fluentui/react-button_v9.1.1)
11
+
12
+ ### Patches
13
+
14
+ - fix: Adding 'aria-expanded=false' to collapsed MenuButtons. ([PR #24782](https://github.com/microsoft/fluentui/pull/24782) by humberto_makoto@hotmail.com)
15
+ - chore: Remove max-width style from Button components. ([PR #24647](https://github.com/microsoft/fluentui/pull/24647) by makotom@microsoft.com)
16
+ - chore: Cleaning up tokens in Button components so they better adhere to the design spec. ([PR #24732](https://github.com/microsoft/fluentui/pull/24732) by humberto_makoto@hotmail.com)
17
+ - fix: Wrapping long text in Button components. ([PR #24682](https://github.com/microsoft/fluentui/pull/24682) by humberto_makoto@hotmail.com)
18
+ - refactor: Replace useMergedEventCallbacks utility with mergeCallbacks ([PR #24152](https://github.com/microsoft/fluentui/pull/24152) by behowell@microsoft.com)
19
+ - chore: Update Griffel to latest version ([PR #24221](https://github.com/microsoft/fluentui/pull/24221) by olfedias@microsoft.com)
20
+ - Bump @fluentui/react-aria to v9.2.0 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
21
+ - Bump @fluentui/react-tabster to v9.1.1 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
22
+ - Bump @fluentui/react-theme to v9.1.0 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
23
+ - Bump @fluentui/react-utilities to v9.1.0 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
24
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.13 ([PR #24808](https://github.com/microsoft/fluentui/pull/24808) by beachball)
25
+
26
+ ## [9.1.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.1.0)
27
+
28
+ Wed, 03 Aug 2022 16:03:39 GMT
29
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.3..@fluentui/react-button_v9.1.0)
30
+
31
+ ### Minor changes
32
+
33
+ - chore: Updates Button to use useARIAButton over useARIAButtonShorthand ([PR #24032](https://github.com/microsoft/fluentui/pull/24032) by bernardo.sunderhus@gmail.com)
34
+ - Bump @fluentui/react-aria to v9.1.0 ([PR #24131](https://github.com/microsoft/fluentui/pull/24131) by beachball)
35
+ - Bump @fluentui/react-tabster to v9.1.0 ([PR #24131](https://github.com/microsoft/fluentui/pull/24131) by beachball)
36
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.12 ([PR #24131](https://github.com/microsoft/fluentui/pull/24131) by beachball)
37
+
38
+ ### Patches
39
+
40
+ - chore: Bump Griffel dependencies ([PR #24114](https://github.com/microsoft/fluentui/pull/24114) by miroslav.stastny@microsoft.com)
41
+
7
42
  ## [9.0.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.3)
8
43
 
9
- Thu, 14 Jul 2022 21:18:44 GMT
44
+ Thu, 14 Jul 2022 21:21:09 GMT
10
45
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.2..@fluentui/react-button_v9.0.3)
11
46
 
12
47
  ### Patches
13
48
 
14
49
  - fix: Fixing bad version bump of @fluentui/react-utilities. ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by Humberto.Morimoto@microsoft.com)
15
- - Bump @fluentui/react-aria to v9.0.2 ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by beachball)
16
- - Bump @fluentui/react-tabster to v9.0.3 ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by beachball)
17
- - Bump @fluentui/react-utilities to v9.0.2 ([PR #23920](https://github.com/microsoft/fluentui/pull/23920) by beachball)
50
+ - Bump @fluentui/react-aria to v9.0.2 ([PR #23918](https://github.com/microsoft/fluentui/pull/23918) by beachball)
51
+ - Bump @fluentui/react-tabster to v9.0.3 ([PR #23918](https://github.com/microsoft/fluentui/pull/23918) by beachball)
52
+ - Bump @fluentui/react-utilities to v9.0.2 ([PR #23918](https://github.com/microsoft/fluentui/pull/23918) by beachball)
18
53
 
19
54
  ## [9.0.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.2)
20
55
 
package/dist/index.d.ts CHANGED
@@ -65,7 +65,7 @@ export declare type ButtonSlots = {
65
65
  /**
66
66
  * Root of the component that renders as either a `<button>` tag or an `<a>` tag.
67
67
  */
68
- root: NonNullable<Slot<ARIAButtonSlotProps>>;
68
+ root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;
69
69
  /**
70
70
  * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.
71
71
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n};\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n Required<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n"]}
1
+ {"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n};\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n Required<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n"]}
@@ -1,4 +1,4 @@
1
- import { useARIAButton } from '@fluentui/react-aria';
1
+ import { useARIAButtonShorthand } from '@fluentui/react-aria';
2
2
  import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
@@ -9,7 +9,7 @@ import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utiliti
9
9
  export const useButton_unstable = (props, ref) => {
10
10
  const {
11
11
  appearance = 'secondary',
12
- as,
12
+ as = 'button',
13
13
  disabled = false,
14
14
  disabledFocusable = false,
15
15
  icon,
@@ -33,13 +33,11 @@ export const useButton_unstable = (props, ref) => {
33
33
  root: 'button',
34
34
  icon: 'span'
35
35
  },
36
- root: getNativeElementProps(as || 'button', useARIAButton(props, {
36
+ root: getNativeElementProps(as, useARIAButtonShorthand(props, {
37
37
  required: true,
38
38
  defaultProps: {
39
- // useARIAButton isn't working with React.Ref<HTMLButtonElement | HTMLAnchorElement>
40
39
  ref: ref,
41
- type: 'button' // This is added because the default for type is 'submit'
42
-
40
+ type: 'button'
43
41
  }
44
42
  })),
45
43
  icon: iconShorthand
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,QAA8B,sBAA9B;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAIA;;;;AAIG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAChC,KADgC,EAEhC,GAFgC,KAGjB;EACf,MAAM;IACJ,UAAU,GAAG,WADT;IAEJ,EAFI;IAGJ,QAAQ,GAAG,KAHP;IAIJ,iBAAiB,GAAG,KAJhB;IAKJ,IALI;IAMJ,YAAY,GAAG,QANX;IAOJ,KAAK,GAAG,SAPJ;IAQJ,IAAI,GAAG;EARH,IASF,KATJ;EAUA,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAD,CAAtC;EAEA,OAAO;IACL;IACA,UAFK;IAGL,QAHK;IAIL,iBAJK;IAKL,YALK;IAML,KANK;IAOL,IAPK;IASL;IACA,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,CAVZ;IAYL;IACA,UAAU,EAAE;MACV,IAAI,EAAE,QADI;MAEV,IAAI,EAAE;IAFI,CAbP;IAkBL,IAAI,EAAE,qBAAqB,CACzB,EAAE,IAAI,QADmB,EAEzB,aAAa,CAAsB,KAAtB,EAA6B;MACxC,QAAQ,EAAE,IAD8B;MAExC,YAAY,EAAE;QACZ;QACA,GAAG,EAAE,GAFO;QAGZ,IAAI,EAAE,QAHM,CAGI;;MAHJ;IAF0B,CAA7B,CAFY,CAlBtB;IA6BL,IAAI,EAAE;EA7BD,CAAP;AA+BD,CA/CM","sourcesContent":["import * as React from 'react';\nimport { useARIAButton } from '@fluentui/react-aria';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { ARIAButtonSlotProps } from '@fluentui/react-aria';\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 = 'secondary',\n as,\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 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/"}
1
+ {"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAA8B,sBAA9B,QAA4D,sBAA5D;AACA,SAAS,qBAAT,EAAgC,gBAAhC,QAAwD,2BAAxD;AAGA;;;;AAIG;;AACH,OAAO,MAAM,kBAAkB,GAAG,CAChC,KADgC,EAEhC,GAFgC,KAGjB;EACf,MAAM;IACJ,UAAU,GAAG,WADT;IAEJ,EAAE,GAAG,QAFD;IAGJ,QAAQ,GAAG,KAHP;IAIJ,iBAAiB,GAAG,KAJhB;IAKJ,IALI;IAMJ,YAAY,GAAG,QANX;IAOJ,KAAK,GAAG,SAPJ;IAQJ,IAAI,GAAG;EARH,IASF,KATJ;EAUA,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAD,CAAtC;EAEA,OAAO;IACL;IACA,UAFK;IAGL,QAHK;IAIL,iBAJK;IAKL,YALK;IAML,KANK;IAOL,IAPK;IASL;IACA,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,CAVZ;IAYL;IACA,UAAU,EAAE;MACV,IAAI,EAAE,QADI;MAEV,IAAI,EAAE;IAFI,CAbP;IAkBL,IAAI,EAAE,qBAAqB,CACzB,EADyB,EAEzB,sBAAsB,CAA2B,KAA3B,EAAkC;MACtD,QAAQ,EAAE,IAD4C;MAEtD,YAAY,EAAE;QACZ,GAAG,EAAE,GADO;QAEZ,IAAI,EAAE;MAFM;IAFwC,CAAlC,CAFG,CAlBtB;IA4BL,IAAI,EAAE;EA5BD,CAAP;AA8BD,CA9CM","sourcesContent":["import * as React from 'react';\nimport { ARIAButtonSlotProps, useARIAButtonShorthand } 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 = 'secondary',\n as = 'button',\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 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,\n useARIAButtonShorthand<ARIAButtonSlotProps<'a'>>(props, {\n required: true,\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: 'button',\n },\n }),\n ),\n icon: iconShorthand,\n };\n};\n"],"sourceRoot":"../src/"}