@fluentui/react-card 0.0.0-nightly-20230316-0427.1 → 0.0.0-nightly-20230317-1454.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/.swcrc +39 -0
- package/CHANGELOG.json +42 -15
- package/CHANGELOG.md +21 -10
- package/lib/Card.js +1 -1
- package/lib/Card.js.map +1 -1
- package/lib/CardFooter.js +1 -1
- package/lib/CardFooter.js.map +1 -1
- package/lib/CardHeader.js +1 -1
- package/lib/CardHeader.js.map +1 -1
- package/lib/CardPreview.js +1 -1
- package/lib/CardPreview.js.map +1 -1
- package/lib/components/Card/Card.js +6 -6
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/Card.types.js +1 -1
- package/lib/components/Card/Card.types.js.map +1 -1
- package/lib/components/Card/CardContext.js +4 -9
- package/lib/components/Card/CardContext.js.map +1 -1
- package/lib/components/Card/index.js +6 -6
- package/lib/components/Card/index.js.map +1 -1
- package/lib/components/Card/renderCard.js +5 -11
- package/lib/components/Card/renderCard.js.map +1 -1
- package/lib/components/Card/useCard.js +20 -20
- package/lib/components/Card/useCard.js.map +1 -1
- package/lib/components/Card/useCardContextValue.js.map +1 -1
- package/lib/components/Card/useCardSelectable.js +10 -10
- package/lib/components/Card/useCardSelectable.js.map +1 -1
- package/lib/components/Card/useCardStyles.js +14 -14
- package/lib/components/Card/useCardStyles.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.js +5 -5
- package/lib/components/CardFooter/CardFooter.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib/components/CardFooter/index.js +5 -5
- package/lib/components/CardFooter/index.js.map +1 -1
- package/lib/components/CardFooter/renderCardFooter.js +3 -7
- package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooter.js +5 -4
- package/lib/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooterStyles.js +3 -3
- package/lib/components/CardFooter/useCardFooterStyles.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.js +5 -5
- package/lib/components/CardHeader/CardHeader.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib/components/CardHeader/index.js +5 -5
- package/lib/components/CardHeader/index.js.map +1 -1
- package/lib/components/CardHeader/renderCardHeader.js +3 -13
- package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeader.js +10 -10
- package/lib/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeaderStyles.js +7 -7
- package/lib/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.js +5 -5
- package/lib/components/CardPreview/CardPreview.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib/components/CardPreview/index.js +5 -5
- package/lib/components/CardPreview/index.js.map +1 -1
- package/lib/components/CardPreview/renderCardPreview.js +3 -7
- package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreview.js +9 -9
- package/lib/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreviewStyles.js +3 -3
- package/lib/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Card.js +5 -4
- package/lib-commonjs/Card.js.map +1 -1
- package/lib-commonjs/CardFooter.js +5 -4
- package/lib-commonjs/CardFooter.js.map +1 -1
- package/lib-commonjs/CardHeader.js +5 -4
- package/lib-commonjs/CardHeader.js.map +1 -1
- package/lib-commonjs/CardPreview.js +5 -4
- package/lib-commonjs/CardPreview.js.map +1 -1
- package/lib-commonjs/components/Card/Card.js +18 -17
- package/lib-commonjs/components/Card/Card.js.map +1 -1
- package/lib-commonjs/components/Card/Card.types.js +5 -2
- package/lib-commonjs/components/Card/Card.types.js.map +1 -1
- package/lib-commonjs/components/Card/CardContext.js +26 -30
- package/lib-commonjs/components/Card/CardContext.js.map +1 -1
- package/lib-commonjs/components/Card/index.js +10 -9
- package/lib-commonjs/components/Card/index.js.map +1 -1
- package/lib-commonjs/components/Card/renderCard.js +16 -25
- package/lib-commonjs/components/Card/renderCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCard.js +81 -94
- package/lib-commonjs/components/Card/useCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCardContextValue.js +11 -11
- package/lib-commonjs/components/Card/useCardContextValue.js.map +1 -1
- package/lib-commonjs/components/Card/useCardSelectable.js +130 -117
- package/lib-commonjs/components/Card/useCardSelectable.js.map +1 -1
- package/lib-commonjs/components/Card/useCardStyles.js +738 -336
- package/lib-commonjs/components/Card/useCardStyles.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.js +16 -15
- package/lib-commonjs/components/CardFooter/CardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.types.js +3 -2
- package/lib-commonjs/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib-commonjs/components/CardFooter/index.js +9 -8
- package/lib-commonjs/components/CardFooter/index.js.map +1 -1
- package/lib-commonjs/components/CardFooter/renderCardFooter.js +13 -20
- package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooter.js +23 -30
- package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.js +45 -33
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.js +16 -15
- package/lib-commonjs/components/CardHeader/CardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.types.js +3 -2
- package/lib-commonjs/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib-commonjs/components/CardHeader/index.js +9 -8
- package/lib-commonjs/components/CardHeader/index.js.map +1 -1
- package/lib-commonjs/components/CardHeader/renderCardHeader.js +13 -26
- package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeader.js +50 -64
- package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js +88 -67
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.js +16 -15
- package/lib-commonjs/components/CardPreview/CardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.types.js +3 -2
- package/lib-commonjs/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib-commonjs/components/CardPreview/index.js +9 -8
- package/lib-commonjs/components/CardPreview/index.js.map +1 -1
- package/lib-commonjs/components/CardPreview/renderCardPreview.js +13 -20
- package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreview.js +51 -60
- package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js +53 -37
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- package/lib-commonjs/index.js +40 -153
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
package/.swcrc
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json.schemastore.org/swcrc",
|
3
|
+
"env": {
|
4
|
+
"targets": {
|
5
|
+
"chrome": "84",
|
6
|
+
"edge": "84",
|
7
|
+
"firefox": "75",
|
8
|
+
"opera": "73",
|
9
|
+
"safari": "14.1"
|
10
|
+
},
|
11
|
+
"bugfixes": true
|
12
|
+
},
|
13
|
+
"exclude": [
|
14
|
+
"/testing",
|
15
|
+
"/**/*.cy.ts",
|
16
|
+
"/**/*.cy.tsx",
|
17
|
+
"/**/*.spec.ts",
|
18
|
+
"/**/*.spec.tsx",
|
19
|
+
"/**/*.test.ts",
|
20
|
+
"/**/*.test.tsx"
|
21
|
+
],
|
22
|
+
"jsc": {
|
23
|
+
"parser": {
|
24
|
+
"syntax": "typescript",
|
25
|
+
"tsx": true,
|
26
|
+
"decorators": false,
|
27
|
+
"dynamicImport": false
|
28
|
+
},
|
29
|
+
"externalHelpers": true,
|
30
|
+
"transform": {
|
31
|
+
"react": {
|
32
|
+
"runtime": "classic",
|
33
|
+
"useSpread": true
|
34
|
+
}
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"minify": false,
|
38
|
+
"sourceMaps": true
|
39
|
+
}
|
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-card",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-card_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Fri, 17 Mar 2023 15:00:13 GMT",
|
6
|
+
"tag": "@fluentui/react-card_v0.0.0-nightly-20230317-1454.1",
|
7
|
+
"version": "0.0.0-nightly-20230317-1454.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,38 +16,65 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-card",
|
19
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1",
|
20
|
+
"commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-card",
|
25
|
-
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230317-1454.1",
|
26
|
+
"commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-card",
|
31
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230317-1454.1",
|
32
|
+
"commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"author": "beachball",
|
36
36
|
"package": "@fluentui/react-card",
|
37
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230317-1454.1",
|
38
|
+
"commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
"author": "beachball",
|
42
42
|
"package": "@fluentui/react-card",
|
43
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230317-1454.1",
|
44
|
+
"commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
|
45
45
|
},
|
46
46
|
{
|
47
47
|
"author": "beachball",
|
48
48
|
"package": "@fluentui/react-card",
|
49
|
-
"comment": "Bump @fluentui/react-button to v0.0.0-nightly-
|
50
|
-
"commit": "
|
49
|
+
"comment": "Bump @fluentui/react-button to v0.0.0-nightly-20230317-1454.1",
|
50
|
+
"commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"date": "Thu, 16 Mar 2023 14:36:59 GMT",
|
57
|
+
"tag": "@fluentui/react-card_v9.0.2",
|
58
|
+
"version": "9.0.2",
|
59
|
+
"comments": {
|
60
|
+
"patch": [
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-card",
|
64
|
+
"comment": "Bump @fluentui/react-tabster to v9.6.0",
|
65
|
+
"commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-card",
|
70
|
+
"comment": "Bump @fluentui/react-utilities to v9.7.1",
|
71
|
+
"commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-card",
|
76
|
+
"comment": "Bump @fluentui/react-button to v9.3.4",
|
77
|
+
"commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
|
51
78
|
}
|
52
79
|
]
|
53
80
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,23 +1,34 @@
|
|
1
1
|
# Change Log - @fluentui/react-card
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Fri, 17 Mar 2023 15:00:13 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230317-1454.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v0.0.0-nightly-20230317-1454.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.
|
9
|
+
Fri, 17 Mar 2023 15:00:13 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.2..@fluentui/react-card_v0.0.0-nightly-20230317-1454.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-tabster to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
20
|
-
- Bump @fluentui/react-button to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
|
16
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
|
17
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
|
18
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
|
19
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
|
20
|
+
- Bump @fluentui/react-button to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
|
21
|
+
|
22
|
+
## [9.0.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v9.0.2)
|
23
|
+
|
24
|
+
Thu, 16 Mar 2023 14:36:59 GMT
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-card_v9.0.1..@fluentui/react-card_v9.0.2)
|
26
|
+
|
27
|
+
### Patches
|
28
|
+
|
29
|
+
- Bump @fluentui/react-tabster to v9.6.0 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
|
30
|
+
- Bump @fluentui/react-utilities to v9.7.1 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
|
31
|
+
- Bump @fluentui/react-button to v9.3.4 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
|
21
32
|
|
22
33
|
## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-card_v9.0.1)
|
23
34
|
|
package/lib/Card.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
1
|
+
export * from "./components/Card/index";
|
2
2
|
//# sourceMappingURL=Card.js.map
|
package/lib/Card.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../src/Card.ts"],"sourcesContent":["export * from './components/Card/index';\n"],"mappings":"AAAA,cAAc"}
|
package/lib/CardFooter.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
1
|
+
export * from "./components/CardFooter/index";
|
2
2
|
//# sourceMappingURL=CardFooter.js.map
|
package/lib/CardFooter.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../src/CardFooter.ts"],"sourcesContent":["export * from './components/CardFooter/index';\n"],"mappings":"AAAA,cAAc"}
|
package/lib/CardHeader.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
1
|
+
export * from "./components/CardHeader/index";
|
2
2
|
//# sourceMappingURL=CardHeader.js.map
|
package/lib/CardHeader.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../src/CardHeader.ts"],"sourcesContent":["export * from './components/CardHeader/index';\n"],"mappings":"AAAA,cAAc"}
|
package/lib/CardPreview.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
1
|
+
export * from "./components/CardPreview/index";
|
2
2
|
//# sourceMappingURL=CardPreview.js.map
|
package/lib/CardPreview.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../src/CardPreview.ts"],"sourcesContent":["export * from './components/CardPreview/index';\n"],"mappings":"AAAA,cAAc"}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { useCard_unstable } from
|
3
|
-
import { renderCard_unstable } from
|
4
|
-
import { useCardStyles_unstable } from
|
5
|
-
import { useCardContextValue } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { useCard_unstable } from "./useCard";
|
3
|
+
import { renderCard_unstable } from "./renderCard";
|
4
|
+
import { useCardStyles_unstable } from "./useCardStyles";
|
5
|
+
import { useCardContextValue } from "./useCardContextValue";
|
6
6
|
/**
|
7
7
|
* A card provides scaffolding for hosting actions and content for a single topic.
|
8
8
|
*/
|
@@ -12,5 +12,5 @@ export const Card = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
12
12
|
useCardStyles_unstable(state);
|
13
13
|
return renderCard_unstable(state, cardContextValue);
|
14
14
|
});
|
15
|
-
Card.displayName =
|
15
|
+
Card.displayName = "Card";
|
16
16
|
//# sourceMappingURL=Card.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useCard_unstable","renderCard_unstable","useCardStyles_unstable","useCardContextValue","Card","forwardRef","props","ref","state","cardContextValue","displayName"],"sources":["
|
1
|
+
{"version":3,"names":["React","useCard_unstable","renderCard_unstable","useCardStyles_unstable","useCardContextValue","Card","forwardRef","props","ref","state","cardContextValue","displayName"],"sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCard_unstable } from './useCard';\nimport { renderCard_unstable } from './renderCard';\nimport { useCardStyles_unstable } from './useCardStyles';\nimport type { CardProps } from './Card.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCardContextValue } from './useCardContextValue';\n\n/**\n * A card provides scaffolding for hosting actions and content for a single topic.\n */\nexport const Card: ForwardRefComponent<CardProps> = React.forwardRef<HTMLDivElement>((props, ref) => {\n const state = useCard_unstable(props, ref);\n const cardContextValue = useCardContextValue(state);\n\n useCardStyles_unstable(state);\n return renderCard_unstable(state, cardContextValue);\n});\n\nCard.displayName = 'Card';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,sBAAsB,QAAQ;AAGvC,SAASC,mBAAmB,QAAQ;AAEpC;;;AAGA,OAAO,MAAMC,IAAA,gBAAuCL,KAAA,CAAMM,UAAU,CAAiB,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACnG,MAAMC,KAAA,GAAQR,gBAAA,CAAiBM,KAAA,EAAOC,GAAA;EACtC,MAAME,gBAAA,GAAmBN,mBAAA,CAAoBK,KAAA;EAE7CN,sBAAA,CAAuBM,KAAA;EACvB,OAAOP,mBAAA,CAAoBO,KAAA,EAAOC,gBAAA;AACpC;AAEAL,IAAA,CAAKM,WAAW,GAAG"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
import * as React from "react";
|
2
2
|
//# sourceMappingURL=Card.types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React"],"sources":["../../../src/components/Card/Card.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Card selected event type\n *\n * This event is fired when a selectable card changes its selection state.\n */\nexport type CardOnSelectionChangeEvent = React.MouseEvent | React.KeyboardEvent | React.ChangeEvent;\n\n/**\n * Data sent from the selection events on a selectable card.\n */\nexport type CardOnSelectData = {\n selected: boolean;\n};\n\n/**\n * Data shared between card components\n */\nexport interface CardContextValue {\n selectableA11yProps: {\n referenceId?: string;\n setReferenceId: (referenceId: string) => void;\n referenceLabel?: string;\n setReferenceLabel: (referenceLabel: string) => void;\n };\n}\n\n/**\n * Slots available in the Card component.\n */\nexport type CardSlots = {\n /**\n * Root element of the component.\n */\n root: Slot<'div'>;\n\n /**\n * Floating action that can be rendered on the top-right of a card. Often used together with\n * `selected`, `defaultSelected`, and `onSelectionChange` props\n */\n floatingAction?: Slot<'div'>;\n\n /**\n * The internal checkbox element that renders when the card is selectable.\n */\n checkbox?: Slot<'input'>;\n};\n\n/**\n * Card component props.\n */\nexport type CardProps = ComponentProps<CardSlots> & {\n /**\n * Sets the appearance of the card.\n *\n * `filled`\n * The card will have a shadow, border and background color.\n *\n * `filled-alternative`\n * This appearance is similar to `filled`, but the background color will be a little darker.\n *\n * `outline`\n * This appearance is similar to `filled`, but the background color will be transparent and no shadow applied.\n *\n * `subtle`\n * This appearance is similar to `filled-alternative`, but no border is applied.\n *\n * @default 'filled'\n */\n appearance?: 'filled' | 'filled-alternative' | 'outline' | 'subtle';\n\n /**\n * Sets the focus behavior for the card.\n *\n * `off`\n * The card will not focusable.\n *\n * `no-tab`\n * This behaviour traps the focus inside of the Card when pressing the Enter key and will only release focus when\n * pressing the Escape key.\n *\n * `tab-exit`\n * This behaviour traps the focus inside of the Card when pressing the Enter key but will release focus when pressing\n * the Tab key on the last inner element.\n *\n * `tab-only`\n * This behaviour will cycle through all elements inside of the Card when pressing the Tab key and then release focus\n * after the last inner element.\n *\n * @default 'off'\n */\n focusMode?: 'off' | 'no-tab' | 'tab-exit' | 'tab-only';\n\n /**\n * Defines the orientation of the card.\n *\n * @default 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n\n /**\n * Controls the card's border radius and padding between inner elements.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Defines the controlled selected state of the card.\n *\n * @default false\n */\n selected?: boolean;\n\n /**\n * Defines whether the card is initially in a selected state when rendered.\n *\n * @default false\n */\n defaultSelected?: boolean;\n\n /**\n * Callback to be called when the selected state value changes.\n */\n onSelectionChange?: (event: CardOnSelectionChangeEvent, data: CardOnSelectData) => void;\n};\n\n/**\n * State used in rendering Card.\n */\nexport type CardState = ComponentState<CardSlots> &\n CardContextValue &\n Required<\n Pick<CardProps, 'appearance' | 'orientation' | 'size'> & {\n /**\n * Represents a card that contains interactive events (MouseEvents) or is a button/a tag.\n *\n * @default false\n */\n interactive: boolean;\n\n /**\n * Represents a selectable card.\n *\n * @default false\n */\n selectable: boolean;\n\n /**\n * Defines whether the card is currently selected.\n *\n * @default false\n */\n selected: boolean;\n\n /**\n * Defines whether the card internal checkbox is currently focused.\n *\n * @default false\n */\n selectFocused: boolean;\n }\n >;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import * as React from
|
1
|
+
import * as React from "react";
|
2
2
|
const cardContext = /*#__PURE__*/React.createContext(undefined);
|
3
3
|
/**
|
4
4
|
* @internal
|
@@ -7,12 +7,10 @@ export const cardContextDefaultValue = {
|
|
7
7
|
selectableA11yProps: {
|
8
8
|
referenceId: undefined,
|
9
9
|
setReferenceId() {
|
10
|
-
/* Noop */
|
11
|
-
},
|
10
|
+
/* Noop */},
|
12
11
|
referenceLabel: undefined,
|
13
12
|
setReferenceLabel() {
|
14
|
-
/* Noop */
|
15
|
-
}
|
13
|
+
/* Noop */}
|
16
14
|
}
|
17
15
|
};
|
18
16
|
/**
|
@@ -22,8 +20,5 @@ export const CardProvider = cardContext.Provider;
|
|
22
20
|
/**
|
23
21
|
* @internal
|
24
22
|
*/
|
25
|
-
export const useCardContext_unstable = () =>
|
26
|
-
var _a;
|
27
|
-
return (_a = React.useContext(cardContext)) !== null && _a !== void 0 ? _a : cardContextDefaultValue;
|
28
|
-
};
|
23
|
+
export const useCardContext_unstable = () => React.useContext(cardContext) ?? cardContextDefaultValue;
|
29
24
|
//# sourceMappingURL=CardContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","cardContext","createContext","undefined","cardContextDefaultValue","selectableA11yProps","referenceId","setReferenceId","referenceLabel","setReferenceLabel","CardProvider","Provider","useCardContext_unstable","
|
1
|
+
{"version":3,"names":["React","cardContext","createContext","undefined","cardContextDefaultValue","selectableA11yProps","referenceId","setReferenceId","referenceLabel","setReferenceLabel","CardProvider","Provider","useCardContext_unstable","useContext"],"sources":["../../../src/components/Card/CardContext.ts"],"sourcesContent":["import * as React from 'react';\nimport { CardContextValue } from './Card.types';\n\nconst cardContext = React.createContext<CardContextValue | undefined>(undefined);\n\n/**\n * @internal\n */\nexport const cardContextDefaultValue: CardContextValue = {\n selectableA11yProps: {\n referenceId: undefined,\n setReferenceId() {\n /* Noop */\n },\n referenceLabel: undefined,\n setReferenceLabel() {\n /* Noop */\n },\n },\n};\n\n/**\n * @internal\n */\nexport const CardProvider = cardContext.Provider;\n\n/**\n * @internal\n */\nexport const useCardContext_unstable = () => React.useContext(cardContext) ?? cardContextDefaultValue;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAGvB,MAAMC,WAAA,gBAAcD,KAAA,CAAME,aAAa,CAA+BC,SAAA;AAEtE;;;AAGA,OAAO,MAAMC,uBAAA,GAA4C;EACvDC,mBAAA,EAAqB;IACnBC,WAAA,EAAaH,SAAA;IACbI,eAAA,EAAiB;MACf,WACF;IACAC,cAAA,EAAgBL,SAAA;IAChBM,kBAAA,EAAoB;MAClB;EAEJ;AACF;AAEA;;;AAGA,OAAO,MAAMC,YAAA,GAAeT,WAAA,CAAYU,QAAQ;AAEhD;;;AAGA,OAAO,MAAMC,uBAAA,GAA0BA,CAAA,KAAMZ,KAAA,CAAMa,UAAU,CAACZ,WAAA,KAAgBG,uBAAA"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
6
|
-
export * from
|
1
|
+
export * from "./Card";
|
2
|
+
export * from "./Card.types";
|
3
|
+
export * from "./CardContext";
|
4
|
+
export * from "./renderCard";
|
5
|
+
export * from "./useCard";
|
6
|
+
export * from "./useCardStyles";
|
7
7
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/Card/index.ts"],"sourcesContent":["export * from './Card';\nexport * from './Card.types';\nexport * from './CardContext';\nexport * from './renderCard';\nexport * from './useCard';\nexport * from './useCardStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { getSlots } from
|
3
|
-
import { CardProvider } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { getSlots } from "@fluentui/react-utilities";
|
3
|
+
import { CardProvider } from "./CardContext";
|
4
4
|
/**
|
5
5
|
* Render the final JSX of Card.
|
6
6
|
*/
|
@@ -9,14 +9,8 @@ export const renderCard_unstable = (state, cardContextValue) => {
|
|
9
9
|
slots,
|
10
10
|
slotProps
|
11
11
|
} = getSlots(state);
|
12
|
-
return /*#__PURE__*/React.createElement(slots.root, {
|
13
|
-
...slotProps.root
|
14
|
-
}, /*#__PURE__*/React.createElement(CardProvider, {
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, slotProps.root, /*#__PURE__*/React.createElement(CardProvider, {
|
15
13
|
value: cardContextValue
|
16
|
-
}, slots.checkbox ? /*#__PURE__*/React.createElement(slots.checkbox,
|
17
|
-
...slotProps.checkbox
|
18
|
-
}) : null, slots.floatingAction ? /*#__PURE__*/React.createElement(slots.floatingAction, {
|
19
|
-
...slotProps.floatingAction
|
20
|
-
}) : null, slotProps.root.children));
|
14
|
+
}, slots.checkbox ? /*#__PURE__*/React.createElement(slots.checkbox, slotProps.checkbox) : null, slots.floatingAction ? /*#__PURE__*/React.createElement(slots.floatingAction, slotProps.floatingAction) : null, slotProps.root.children));
|
21
15
|
};
|
22
16
|
//# sourceMappingURL=renderCard.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getSlots","CardProvider","renderCard_unstable","state","cardContextValue","slots","slotProps","createElement","root","value","checkbox","floatingAction","children"],"sources":["
|
1
|
+
{"version":3,"names":["React","getSlots","CardProvider","renderCard_unstable","state","cardContextValue","slots","slotProps","createElement","root","value","checkbox","floatingAction","children"],"sources":["../../../src/components/Card/renderCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { CardContextValue, CardSlots, CardState } from './Card.types';\nimport { CardProvider } from './CardContext';\n\n/**\n * Render the final JSX of Card.\n */\nexport const renderCard_unstable = (state: CardState, cardContextValue: CardContextValue) => {\n const { slots, slotProps } = getSlots<CardSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <CardProvider value={cardContextValue}>\n {slots.checkbox ? <slots.checkbox {...slotProps.checkbox} /> : null}\n {slots.floatingAction ? <slots.floatingAction {...slotProps.floatingAction} /> : null}\n {slotProps.root.children}\n </CardProvider>\n </slots.root>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,YAAY,QAAQ;AAE7B;;;AAGA,OAAO,MAAMC,mBAAA,GAAsBA,CAACC,KAAA,EAAkBC,gBAAA,KAAuC;EAC3F,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGN,QAAA,CAAoBG,KAAA;EAEjD,oBACEJ,KAAA,CAAAQ,aAAA,CAACF,KAAA,CAAMG,IAAI,EAAKF,SAAA,CAAUE,IAAI,eAC5BT,KAAA,CAAAQ,aAAA,CAACN,YAAA;IAAaQ,KAAA,EAAOL;KAClBC,KAAA,CAAMK,QAAQ,gBAAGX,KAAA,CAAAQ,aAAA,CAACF,KAAA,CAAMK,QAAQ,EAAKJ,SAAA,CAAUI,QAAQ,IAAO,IAAI,EAClEL,KAAA,CAAMM,cAAc,gBAAGZ,KAAA,CAAAQ,aAAA,CAACF,KAAA,CAAMM,cAAc,EAAKL,SAAA,CAAUK,cAAc,IAAO,IAAI,EACpFL,SAAA,CAAUE,IAAI,CAACI,QAAQ;AAIhC"}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { getNativeElementProps, useMergedRefs } from
|
3
|
-
import { useFocusableGroup, useFocusWithin } from
|
4
|
-
import { useCardSelectable } from
|
5
|
-
import { cardContextDefaultValue } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { getNativeElementProps, useMergedRefs } from "@fluentui/react-utilities";
|
3
|
+
import { useFocusableGroup, useFocusWithin } from "@fluentui/react-tabster";
|
4
|
+
import { useCardSelectable } from "./useCardSelectable";
|
5
|
+
import { cardContextDefaultValue } from "./CardContext";
|
6
6
|
const focusMap = {
|
7
7
|
off: undefined,
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
"no-tab": "limited-trap-focus",
|
9
|
+
"tab-exit": "limited",
|
10
|
+
"tab-only": "unlimited"
|
11
11
|
};
|
12
12
|
/**
|
13
13
|
* Create the state for interactive cards.
|
@@ -18,12 +18,12 @@ const focusMap = {
|
|
18
18
|
* @param props - props from this instance of Card
|
19
19
|
*/
|
20
20
|
const useCardInteractive = ({
|
21
|
-
focusMode =
|
21
|
+
focusMode = "off",
|
22
22
|
...props
|
23
23
|
}) => {
|
24
|
-
const interactive = [
|
24
|
+
const interactive = ["onClick", "onDoubleClick", "onMouseUp", "onMouseDown", "onPointerUp", "onPointerDown", "onTouchStart", "onTouchEnd", "onDragStart", "onDragEnd"].some(prop => props[prop]);
|
25
25
|
const groupperAttrs = useFocusableGroup({
|
26
|
-
tabBehavior: focusMap[interactive ?
|
26
|
+
tabBehavior: focusMap[interactive ? "no-tab" : focusMode]
|
27
27
|
});
|
28
28
|
const interactiveFocusAttributes = {
|
29
29
|
...groupperAttrs,
|
@@ -31,7 +31,7 @@ const useCardInteractive = ({
|
|
31
31
|
};
|
32
32
|
return {
|
33
33
|
interactive,
|
34
|
-
focusAttributes: focusMode ===
|
34
|
+
focusAttributes: focusMode === "off" ? null : interactiveFocusAttributes
|
35
35
|
};
|
36
36
|
};
|
37
37
|
/**
|
@@ -45,9 +45,9 @@ const useCardInteractive = ({
|
|
45
45
|
*/
|
46
46
|
export const useCard_unstable = (props, ref) => {
|
47
47
|
const {
|
48
|
-
appearance =
|
49
|
-
orientation =
|
50
|
-
size =
|
48
|
+
appearance = "filled",
|
49
|
+
orientation = "vertical",
|
50
|
+
size = "medium"
|
51
51
|
} = props;
|
52
52
|
const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);
|
53
53
|
const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);
|
@@ -83,13 +83,13 @@ export const useCard_unstable = (props, ref) => {
|
|
83
83
|
setReferenceLabel
|
84
84
|
},
|
85
85
|
components: {
|
86
|
-
root:
|
87
|
-
floatingAction:
|
88
|
-
checkbox:
|
86
|
+
root: "div",
|
87
|
+
floatingAction: "div",
|
88
|
+
checkbox: "input"
|
89
89
|
},
|
90
|
-
root: getNativeElementProps(
|
90
|
+
root: getNativeElementProps("div", {
|
91
91
|
ref: cardRef,
|
92
|
-
role:
|
92
|
+
role: "group",
|
93
93
|
...focusAttributes,
|
94
94
|
...props,
|
95
95
|
...selectableCardProps
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","getNativeElementProps","useMergedRefs","useFocusableGroup","useFocusWithin","useCardSelectable","cardContextDefaultValue","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","useCard_unstable","ref","appearance","orientation","size","referenceId","setReferenceId","useState","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","cardRef","components","root","floatingAction","checkbox","role"],"sources":["
|
1
|
+
{"version":3,"names":["React","getNativeElementProps","useMergedRefs","useFocusableGroup","useFocusWithin","useCardSelectable","cardContextDefaultValue","focusMap","off","undefined","useCardInteractive","focusMode","props","interactive","some","prop","groupperAttrs","tabBehavior","interactiveFocusAttributes","tabIndex","focusAttributes","useCard_unstable","ref","appearance","orientation","size","referenceId","setReferenceId","useState","selectableA11yProps","referenceLabel","setReferenceLabel","cardBaseRef","selectable","selected","selectableCardProps","selectFocused","checkboxSlot","floatingActionSlot","cardRef","components","root","floatingAction","checkbox","role"],"sources":["../../../src/components/Card/useCard.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusableGroup, useFocusWithin } from '@fluentui/react-tabster';\n\nimport type { CardProps, CardState } from './Card.types';\nimport { useCardSelectable } from './useCardSelectable';\nimport { cardContextDefaultValue } from './CardContext';\n\nconst focusMap = {\n off: undefined,\n 'no-tab': 'limited-trap-focus',\n 'tab-exit': 'limited',\n 'tab-only': 'unlimited',\n} as const;\n\n/**\n * Create the state for interactive cards.\n *\n * This internal hook defines if the card is interactive\n * and control focus properties based on that.\n *\n * @param props - props from this instance of Card\n */\nconst useCardInteractive = ({ focusMode = 'off', ...props }: CardProps) => {\n const interactive = (\n [\n 'onClick',\n 'onDoubleClick',\n 'onMouseUp',\n 'onMouseDown',\n 'onPointerUp',\n 'onPointerDown',\n 'onTouchStart',\n 'onTouchEnd',\n 'onDragStart',\n 'onDragEnd',\n ] as (keyof React.HTMLAttributes<HTMLElement>)[]\n ).some(prop => props[prop]);\n\n const groupperAttrs = useFocusableGroup({\n tabBehavior: focusMap[interactive ? 'no-tab' : focusMode],\n });\n\n const interactiveFocusAttributes = {\n ...groupperAttrs,\n tabIndex: 0,\n };\n\n return {\n interactive,\n focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes,\n };\n};\n\n/**\n * Create the state required to render Card.\n *\n * The returned state can be modified with hooks such as useCardStyles_unstable,\n * before being passed to renderCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param ref - reference to the root element of Card\n */\nexport const useCard_unstable = (props: CardProps, ref: React.Ref<HTMLDivElement>): CardState => {\n const { appearance = 'filled', orientation = 'vertical', size = 'medium' } = props;\n\n const [referenceId, setReferenceId] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n const [referenceLabel, setReferenceLabel] = React.useState(cardContextDefaultValue.selectableA11yProps.referenceId);\n\n const cardBaseRef = useFocusWithin<HTMLDivElement>();\n const { selectable, selected, selectableCardProps, selectFocused, checkboxSlot, floatingActionSlot } =\n useCardSelectable(props, { referenceId, referenceLabel }, cardBaseRef);\n\n const cardRef = useMergedRefs(cardBaseRef, ref);\n\n const { interactive, focusAttributes } = useCardInteractive(props);\n\n return {\n appearance,\n orientation,\n size,\n interactive,\n selectable,\n selectFocused,\n selected,\n selectableA11yProps: {\n setReferenceId,\n referenceId,\n referenceLabel,\n setReferenceLabel,\n },\n\n components: {\n root: 'div',\n floatingAction: 'div',\n checkbox: 'input',\n },\n\n root: getNativeElementProps('div', {\n ref: cardRef,\n role: 'group',\n ...focusAttributes,\n ...props,\n ...selectableCardProps,\n }),\n\n floatingAction: floatingActionSlot,\n checkbox: checkboxSlot,\n };\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,EAAEC,aAAa,QAAQ;AACrD,SAASC,iBAAiB,EAAEC,cAAc,QAAQ;AAGlD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,uBAAuB,QAAQ;AAExC,MAAMC,QAAA,GAAW;EACfC,GAAA,EAAKC,SAAA;EACL,UAAU;EACV,YAAY;EACZ,YAAY;AACd;AAEA;;;;;;;;AAQA,MAAMC,kBAAA,GAAqBA,CAAC;EAAEC,SAAA,GAAY;EAAO,GAAGC;AAAA,CAAkB,KAAK;EACzE,MAAMC,WAAA,GAAc,CAEhB,WACA,iBACA,aACA,eACA,eACA,iBACA,gBACA,cACA,eACA,YACD,CACDC,IAAI,CAACC,IAAA,IAAQH,KAAK,CAACG,IAAA,CAAK;EAE1B,MAAMC,aAAA,GAAgBb,iBAAA,CAAkB;IACtCc,WAAA,EAAaV,QAAQ,CAACM,WAAA,GAAc,WAAWF,SAAS;EAC1D;EAEA,MAAMO,0BAAA,GAA6B;IACjC,GAAGF,aAAa;IAChBG,QAAA,EAAU;EACZ;EAEA,OAAO;IACLN,WAAA;IACAO,eAAA,EAAiBT,SAAA,KAAc,QAAQ,IAAI,GAAGO;EAChD;AACF;AAEA;;;;;;;;;AASA,OAAO,MAAMG,gBAAA,GAAmBA,CAACT,KAAA,EAAkBU,GAAA,KAA8C;EAC/F,MAAM;IAAEC,UAAA,GAAa;IAAUC,WAAA,GAAc;IAAYC,IAAA,GAAO;EAAQ,CAAE,GAAGb,KAAA;EAE7E,MAAM,CAACc,WAAA,EAAaC,cAAA,CAAe,GAAG3B,KAAA,CAAM4B,QAAQ,CAACtB,uBAAA,CAAwBuB,mBAAmB,CAACH,WAAW;EAC5G,MAAM,CAACI,cAAA,EAAgBC,iBAAA,CAAkB,GAAG/B,KAAA,CAAM4B,QAAQ,CAACtB,uBAAA,CAAwBuB,mBAAmB,CAACH,WAAW;EAElH,MAAMM,WAAA,GAAc5B,cAAA;EACpB,MAAM;IAAE6B,UAAA;IAAYC,QAAA;IAAUC,mBAAA;IAAqBC,aAAA;IAAeC,YAAA;IAAcC;EAAkB,CAAE,GAClGjC,iBAAA,CAAkBO,KAAA,EAAO;IAAEc,WAAA;IAAaI;EAAe,GAAGE,WAAA;EAE5D,MAAMO,OAAA,GAAUrC,aAAA,CAAc8B,WAAA,EAAaV,GAAA;EAE3C,MAAM;IAAET,WAAA;IAAaO;EAAe,CAAE,GAAGV,kBAAA,CAAmBE,KAAA;EAE5D,OAAO;IACLW,UAAA;IACAC,WAAA;IACAC,IAAA;IACAZ,WAAA;IACAoB,UAAA;IACAG,aAAA;IACAF,QAAA;IACAL,mBAAA,EAAqB;MACnBF,cAAA;MACAD,WAAA;MACAI,cAAA;MACAC;IACF;IAEAS,UAAA,EAAY;MACVC,IAAA,EAAM;MACNC,cAAA,EAAgB;MAChBC,QAAA,EAAU;IACZ;IAEAF,IAAA,EAAMxC,qBAAA,CAAsB,OAAO;MACjCqB,GAAA,EAAKiB,OAAA;MACLK,IAAA,EAAM;MACN,GAAGxB,eAAe;MAClB,GAAGR,KAAK;MACR,GAAGuB;IACL;IAEAO,cAAA,EAAgBJ,kBAAA;IAChBK,QAAA,EAAUN;EACZ;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useCardContextValue","selectableA11yProps"],"sources":["
|
1
|
+
{"version":3,"names":["useCardContextValue","selectableA11yProps"],"sources":["../../../src/components/Card/useCardContextValue.ts"],"sourcesContent":["import type { CardContextValue, CardState } from './Card.types';\n\nexport function useCardContextValue({ selectableA11yProps }: CardState): CardContextValue {\n return { selectableA11yProps };\n}\n"],"mappings":"AAEA,OAAO,SAASA,oBAAoB;EAAEC;AAAmB,CAAa,EAAoB;EACxF,OAAO;IAAEA;EAAoB;AAC/B"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import * as React from
|
2
|
-
import { mergeCallbacks, resolveShorthand } from
|
3
|
-
import { Enter } from
|
4
|
-
import { useFocusFinders } from
|
1
|
+
import * as React from "react";
|
2
|
+
import { mergeCallbacks, resolveShorthand } from "@fluentui/react-utilities";
|
3
|
+
import { Enter } from "@fluentui/keyboard-keys";
|
4
|
+
import { useFocusFinders } from "@fluentui/react-tabster";
|
5
5
|
/**
|
6
6
|
* @internal
|
7
7
|
*
|
@@ -31,7 +31,7 @@ export const useCardSelectable = (props, {
|
|
31
31
|
findAllFocusable
|
32
32
|
} = useFocusFinders();
|
33
33
|
const checkboxRef = React.useRef(null);
|
34
|
-
const isSelectable = [selected, defaultSelected, onSelectionChange].some(prop => typeof prop !==
|
34
|
+
const isSelectable = [selected, defaultSelected, onSelectionChange].some(prop => typeof prop !== "undefined");
|
35
35
|
const [isCardSelected, setIsCardSelected] = React.useState(false);
|
36
36
|
const [isSelectFocused, setIsSelectFocused] = React.useState(false);
|
37
37
|
const shouldRestrictTriggerAction = React.useCallback(event => {
|
@@ -41,7 +41,7 @@ export const useCardSelectable = (props, {
|
|
41
41
|
const focusableElements = findAllFocusable(cardRef.current);
|
42
42
|
const target = event.target;
|
43
43
|
const isElementInFocusableGroup = focusableElements.some(element => element.contains(target));
|
44
|
-
const isCheckboxSlot =
|
44
|
+
const isCheckboxSlot = checkboxRef?.current === target;
|
45
45
|
return isElementInFocusableGroup && !isCheckboxSlot;
|
46
46
|
}, [cardRef, findAllFocusable]);
|
47
47
|
const onChangeHandler = React.useCallback(event => {
|
@@ -68,14 +68,14 @@ export const useCardSelectable = (props, {
|
|
68
68
|
}
|
69
69
|
const selectableCheckboxProps = {};
|
70
70
|
if (referenceId) {
|
71
|
-
selectableCheckboxProps[
|
71
|
+
selectableCheckboxProps["aria-labelledby"] = referenceId;
|
72
72
|
} else if (referenceLabel) {
|
73
|
-
selectableCheckboxProps[
|
73
|
+
selectableCheckboxProps["aria-label"] = referenceLabel;
|
74
74
|
}
|
75
75
|
return resolveShorthand(checkbox, {
|
76
76
|
defaultProps: {
|
77
77
|
ref: checkboxRef,
|
78
|
-
type:
|
78
|
+
type: "checkbox",
|
79
79
|
checked: isCardSelected,
|
80
80
|
onChange: event => onChangeHandler(event),
|
81
81
|
onFocus: () => setIsSelectFocused(true),
|
@@ -103,7 +103,7 @@ export const useCardSelectable = (props, {
|
|
103
103
|
onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler)
|
104
104
|
};
|
105
105
|
}, [isSelectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);
|
106
|
-
React.useEffect(() => setIsCardSelected(Boolean(defaultSelected
|
106
|
+
React.useEffect(() => setIsCardSelected(Boolean(defaultSelected ?? selected)), [defaultSelected, selected, setIsCardSelected]);
|
107
107
|
return {
|
108
108
|
selected: isCardSelected,
|
109
109
|
selectable: isSelectable,
|