@fluentui/react-card 9.0.2 → 9.0.3
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 +30 -0
- package/CHANGELOG.json +58 -1
- package/CHANGELOG.md +18 -2
- package/lib/Card.js.map +1 -1
- package/lib/CardFooter.js.map +1 -1
- package/lib/CardHeader.js.map +1 -1
- package/lib/CardPreview.js.map +1 -1
- 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 -8
- package/lib/components/Card/CardContext.js.map +1 -1
- package/lib/components/Card/index.js.map +1 -1
- package/lib/components/Card/renderCard.js +2 -8
- package/lib/components/Card/renderCard.js.map +1 -1
- package/lib/components/Card/useCard.js.map +1 -1
- package/lib/components/Card/useCardContextValue.js.map +1 -1
- package/lib/components/Card/useCardSelectable.js.map +1 -1
- package/lib/components/Card/useCardStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/CardFooter/renderCardFooter.js +1 -5
- package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooter.js +1 -0
- package/lib/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooterStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/CardHeader/renderCardHeader.js +1 -11
- package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- 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.map +1 -1
- package/lib/components/CardPreview/renderCardPreview.js +1 -5
- package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- 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 +27 -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 +10 -9
- package/lib-amd/Card.js +0 -6
- package/lib-amd/Card.js.map +0 -1
- package/lib-amd/CardFooter.js +0 -6
- package/lib-amd/CardFooter.js.map +0 -1
- package/lib-amd/CardHeader.js +0 -6
- package/lib-amd/CardHeader.js.map +0 -1
- package/lib-amd/CardPreview.js +0 -6
- package/lib-amd/CardPreview.js.map +0 -1
- package/lib-amd/components/Card/Card.js +0 -16
- package/lib-amd/components/Card/Card.js.map +0 -1
- package/lib-amd/components/Card/Card.types.js +0 -5
- package/lib-amd/components/Card/Card.types.js.map +0 -1
- package/lib-amd/components/Card/CardContext.js +0 -31
- package/lib-amd/components/Card/CardContext.js.map +0 -1
- package/lib-amd/components/Card/index.js +0 -11
- package/lib-amd/components/Card/index.js.map +0 -1
- package/lib-amd/components/Card/renderCard.js +0 -18
- package/lib-amd/components/Card/renderCard.js.map +0 -1
- package/lib-amd/components/Card/useCard.js +0 -85
- package/lib-amd/components/Card/useCard.js.map +0 -1
- package/lib-amd/components/Card/useCardContextValue.js +0 -11
- package/lib-amd/components/Card/useCardContextValue.js.map +0 -1
- package/lib-amd/components/Card/useCardSelectable.js +0 -97
- package/lib-amd/components/Card/useCardSelectable.js.map +0 -1
- package/lib-amd/components/Card/useCardStyles.js +0 -253
- package/lib-amd/components/Card/useCardStyles.js.map +0 -1
- package/lib-amd/components/CardFooter/CardFooter.js +0 -15
- package/lib-amd/components/CardFooter/CardFooter.js.map +0 -1
- package/lib-amd/components/CardFooter/CardFooter.types.js +0 -5
- package/lib-amd/components/CardFooter/CardFooter.types.js.map +0 -1
- package/lib-amd/components/CardFooter/index.js +0 -10
- package/lib-amd/components/CardFooter/index.js.map +0 -1
- package/lib-amd/components/CardFooter/renderCardFooter.js +0 -16
- package/lib-amd/components/CardFooter/renderCardFooter.js.map +0 -1
- package/lib-amd/components/CardFooter/useCardFooter.js +0 -27
- package/lib-amd/components/CardFooter/useCardFooter.js.map +0 -1
- package/lib-amd/components/CardFooter/useCardFooterStyles.js +0 -31
- package/lib-amd/components/CardFooter/useCardFooterStyles.js.map +0 -1
- package/lib-amd/components/CardHeader/CardHeader.js +0 -15
- package/lib-amd/components/CardHeader/CardHeader.js.map +0 -1
- package/lib-amd/components/CardHeader/CardHeader.types.js +0 -5
- package/lib-amd/components/CardHeader/CardHeader.types.js.map +0 -1
- package/lib-amd/components/CardHeader/index.js +0 -10
- package/lib-amd/components/CardHeader/index.js.map +0 -1
- package/lib-amd/components/CardHeader/renderCardHeader.js +0 -18
- package/lib-amd/components/CardHeader/renderCardHeader.js.map +0 -1
- package/lib-amd/components/CardHeader/useCardHeader.js +0 -48
- package/lib-amd/components/CardHeader/useCardHeader.js.map +0 -1
- package/lib-amd/components/CardHeader/useCardHeaderStyles.js +0 -72
- package/lib-amd/components/CardHeader/useCardHeaderStyles.js.map +0 -1
- package/lib-amd/components/CardPreview/CardPreview.js +0 -15
- package/lib-amd/components/CardPreview/CardPreview.js.map +0 -1
- package/lib-amd/components/CardPreview/CardPreview.types.js +0 -5
- package/lib-amd/components/CardPreview/CardPreview.types.js.map +0 -1
- package/lib-amd/components/CardPreview/index.js +0 -10
- package/lib-amd/components/CardPreview/index.js.map +0 -1
- package/lib-amd/components/CardPreview/renderCardPreview.js +0 -16
- package/lib-amd/components/CardPreview/renderCardPreview.js.map +0 -1
- package/lib-amd/components/CardPreview/useCardPreview.js +0 -50
- package/lib-amd/components/CardPreview/useCardPreview.js.map +0 -1
- package/lib-amd/components/CardPreview/useCardPreviewStyles.js +0 -44
- package/lib-amd/components/CardPreview/useCardPreviewStyles.js.map +0 -1
- package/lib-amd/index.js +0 -30
- package/lib-amd/index.js.map +0 -1
@@ -1,31 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react"], function (require, exports, React) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useCardContext_unstable = exports.CardProvider = exports.cardContextDefaultValue = void 0;
|
5
|
-
var cardContext = React.createContext(undefined);
|
6
|
-
/**
|
7
|
-
* @internal
|
8
|
-
*/
|
9
|
-
exports.cardContextDefaultValue = {
|
10
|
-
selectableA11yProps: {
|
11
|
-
referenceId: undefined,
|
12
|
-
setReferenceId: function () {
|
13
|
-
/* Noop */
|
14
|
-
},
|
15
|
-
referenceLabel: undefined,
|
16
|
-
setReferenceLabel: function () {
|
17
|
-
/* Noop */
|
18
|
-
},
|
19
|
-
},
|
20
|
-
};
|
21
|
-
/**
|
22
|
-
* @internal
|
23
|
-
*/
|
24
|
-
exports.CardProvider = cardContext.Provider;
|
25
|
-
/**
|
26
|
-
* @internal
|
27
|
-
*/
|
28
|
-
var useCardContext_unstable = function () { var _a; return (_a = React.useContext(cardContext)) !== null && _a !== void 0 ? _a : exports.cardContextDefaultValue; };
|
29
|
-
exports.useCardContext_unstable = useCardContext_unstable;
|
30
|
-
});
|
31
|
-
//# sourceMappingURL=CardContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CardContext.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/CardContext.ts"],"names":[],"mappings":";;;;IAGA,IAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAA+B,SAAS,CAAC,CAAC;IAEjF;;OAEG;IACU,QAAA,uBAAuB,GAAqB;QACvD,mBAAmB,EAAE;YACnB,WAAW,EAAE,SAAS;YACtB,cAAc;gBACZ,UAAU;YACZ,CAAC;YACD,cAAc,EAAE,SAAS;YACzB,iBAAiB;gBACf,UAAU;YACZ,CAAC;SACF;KACF,CAAC;IAEF;;OAEG;IACU,QAAA,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC;IAEjD;;OAEG;IACI,IAAM,uBAAuB,GAAG,sBAAM,OAAA,MAAA,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,mCAAI,+BAAuB,CAAA,EAAA,CAAC;IAAzF,QAAA,uBAAuB,2BAAkE","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"]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "./Card", "./Card.types", "./CardContext", "./renderCard", "./useCard", "./useCardStyles"], function (require, exports, tslib_1, Card_1, Card_types_1, CardContext_1, renderCard_1, useCard_1, useCardStyles_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
tslib_1.__exportStar(Card_1, exports);
|
5
|
-
tslib_1.__exportStar(Card_types_1, exports);
|
6
|
-
tslib_1.__exportStar(CardContext_1, exports);
|
7
|
-
tslib_1.__exportStar(renderCard_1, exports);
|
8
|
-
tslib_1.__exportStar(useCard_1, exports);
|
9
|
-
tslib_1.__exportStar(useCardStyles_1, exports);
|
10
|
-
});
|
11
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/index.ts"],"names":[],"mappings":";;;IAAA,sCAAuB;IACvB,4CAA6B;IAC7B,6CAA8B;IAC9B,4CAA6B;IAC7B,yCAA0B;IAC1B,+CAAgC","sourcesContent":["export * from './Card';\nexport * from './Card.types';\nexport * from './CardContext';\nexport * from './renderCard';\nexport * from './useCard';\nexport * from './useCardStyles';\n"]}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "./CardContext"], function (require, exports, tslib_1, React, react_utilities_1, CardContext_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.renderCard_unstable = void 0;
|
5
|
-
/**
|
6
|
-
* Render the final JSX of Card.
|
7
|
-
*/
|
8
|
-
var renderCard_unstable = function (state, cardContextValue) {
|
9
|
-
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
10
|
-
return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
|
11
|
-
React.createElement(CardContext_1.CardProvider, { value: cardContextValue },
|
12
|
-
slots.checkbox ? React.createElement(slots.checkbox, tslib_1.__assign({}, slotProps.checkbox)) : null,
|
13
|
-
slots.floatingAction ? React.createElement(slots.floatingAction, tslib_1.__assign({}, slotProps.floatingAction)) : null,
|
14
|
-
slotProps.root.children)));
|
15
|
-
};
|
16
|
-
exports.renderCard_unstable = renderCard_unstable;
|
17
|
-
});
|
18
|
-
//# sourceMappingURL=renderCard.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderCard.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/renderCard.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,mBAAmB,GAAG,UAAC,KAAgB,EAAE,gBAAkC;QAChF,IAAA,KAAuB,0BAAQ,CAAY,KAAK,CAAC,EAA/C,KAAK,WAAA,EAAE,SAAS,eAA+B,CAAC;QAExD,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC5B,oBAAC,0BAAY,IAAC,KAAK,EAAE,gBAAgB;gBAClC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI,CAAC,CAAC,CAAC,IAAI;gBAClE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,oBAAC,KAAK,CAAC,cAAc,uBAAK,SAAS,CAAC,cAAc,EAAI,CAAC,CAAC,CAAC,IAAI;gBACpF,SAAS,CAAC,IAAI,CAAC,QAAQ,CACX,CACJ,CACd,CAAC;IACJ,CAAC,CAAC;IAZW,QAAA,mBAAmB,uBAY9B","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"]}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-tabster", "./useCardSelectable", "./CardContext"], function (require, exports, tslib_1, React, react_utilities_1, react_tabster_1, useCardSelectable_1, CardContext_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useCard_unstable = void 0;
|
5
|
-
var focusMap = {
|
6
|
-
off: undefined,
|
7
|
-
'no-tab': 'limited-trap-focus',
|
8
|
-
'tab-exit': 'limited',
|
9
|
-
'tab-only': 'unlimited',
|
10
|
-
};
|
11
|
-
/**
|
12
|
-
* Create the state for interactive cards.
|
13
|
-
*
|
14
|
-
* This internal hook defines if the card is interactive
|
15
|
-
* and control focus properties based on that.
|
16
|
-
*
|
17
|
-
* @param props - props from this instance of Card
|
18
|
-
*/
|
19
|
-
var useCardInteractive = function (_a) {
|
20
|
-
var _b = _a.focusMode, focusMode = _b === void 0 ? 'off' : _b, props = tslib_1.__rest(_a, ["focusMode"]);
|
21
|
-
var interactive = [
|
22
|
-
'onClick',
|
23
|
-
'onDoubleClick',
|
24
|
-
'onMouseUp',
|
25
|
-
'onMouseDown',
|
26
|
-
'onPointerUp',
|
27
|
-
'onPointerDown',
|
28
|
-
'onTouchStart',
|
29
|
-
'onTouchEnd',
|
30
|
-
'onDragStart',
|
31
|
-
'onDragEnd',
|
32
|
-
].some(function (prop) { return props[prop]; });
|
33
|
-
var groupperAttrs = react_tabster_1.useFocusableGroup({
|
34
|
-
tabBehavior: focusMap[interactive ? 'no-tab' : focusMode],
|
35
|
-
});
|
36
|
-
var interactiveFocusAttributes = tslib_1.__assign(tslib_1.__assign({}, groupperAttrs), { tabIndex: 0 });
|
37
|
-
return {
|
38
|
-
interactive: interactive,
|
39
|
-
focusAttributes: focusMode === 'off' ? null : interactiveFocusAttributes,
|
40
|
-
};
|
41
|
-
};
|
42
|
-
/**
|
43
|
-
* Create the state required to render Card.
|
44
|
-
*
|
45
|
-
* The returned state can be modified with hooks such as useCardStyles_unstable,
|
46
|
-
* before being passed to renderCard_unstable.
|
47
|
-
*
|
48
|
-
* @param props - props from this instance of Card
|
49
|
-
* @param ref - reference to the root element of Card
|
50
|
-
*/
|
51
|
-
var useCard_unstable = function (props, ref) {
|
52
|
-
var _a = props.appearance, appearance = _a === void 0 ? 'filled' : _a, _b = props.orientation, orientation = _b === void 0 ? 'vertical' : _b, _c = props.size, size = _c === void 0 ? 'medium' : _c;
|
53
|
-
var _d = React.useState(CardContext_1.cardContextDefaultValue.selectableA11yProps.referenceId), referenceId = _d[0], setReferenceId = _d[1];
|
54
|
-
var _e = React.useState(CardContext_1.cardContextDefaultValue.selectableA11yProps.referenceId), referenceLabel = _e[0], setReferenceLabel = _e[1];
|
55
|
-
var cardBaseRef = react_tabster_1.useFocusWithin();
|
56
|
-
var _f = useCardSelectable_1.useCardSelectable(props, { referenceId: referenceId, referenceLabel: referenceLabel }, cardBaseRef), selectable = _f.selectable, selected = _f.selected, selectableCardProps = _f.selectableCardProps, selectFocused = _f.selectFocused, checkboxSlot = _f.checkboxSlot, floatingActionSlot = _f.floatingActionSlot;
|
57
|
-
var cardRef = react_utilities_1.useMergedRefs(cardBaseRef, ref);
|
58
|
-
var _g = useCardInteractive(props), interactive = _g.interactive, focusAttributes = _g.focusAttributes;
|
59
|
-
return {
|
60
|
-
appearance: appearance,
|
61
|
-
orientation: orientation,
|
62
|
-
size: size,
|
63
|
-
interactive: interactive,
|
64
|
-
selectable: selectable,
|
65
|
-
selectFocused: selectFocused,
|
66
|
-
selected: selected,
|
67
|
-
selectableA11yProps: {
|
68
|
-
setReferenceId: setReferenceId,
|
69
|
-
referenceId: referenceId,
|
70
|
-
referenceLabel: referenceLabel,
|
71
|
-
setReferenceLabel: setReferenceLabel,
|
72
|
-
},
|
73
|
-
components: {
|
74
|
-
root: 'div',
|
75
|
-
floatingAction: 'div',
|
76
|
-
checkbox: 'input',
|
77
|
-
},
|
78
|
-
root: react_utilities_1.getNativeElementProps('div', tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ ref: cardRef, role: 'group' }, focusAttributes), props), selectableCardProps)),
|
79
|
-
floatingAction: floatingActionSlot,
|
80
|
-
checkbox: checkboxSlot,
|
81
|
-
};
|
82
|
-
};
|
83
|
-
exports.useCard_unstable = useCard_unstable;
|
84
|
-
});
|
85
|
-
//# sourceMappingURL=useCard.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useCard.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/useCard.ts"],"names":[],"mappings":";;;;IAQA,IAAM,QAAQ,GAAG;QACf,GAAG,EAAE,SAAS;QACd,QAAQ,EAAE,oBAAoB;QAC9B,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,WAAW;KACf,CAAC;IAEX;;;;;;;OAOG;IACH,IAAM,kBAAkB,GAAG,UAAC,EAA0C;QAAxC,IAAA,iBAAiB,EAAjB,SAAS,mBAAG,K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AiB,CAAC,KAAK,EAAE,EAAE,WAAW,aAAA,EAAE,cAAc,gBAAA,EAAE,EAAE,WAAW,CAAC,EADhE,UAAU,gBAAA,EAAE,QAAQ,cAAA,EAAE,mBAAmB,yBAAA,EAAE,aAAa,mBAAA,EAAE,YAAY,kBAAA,EAAE,kBAAkB,wBAC1B,CAAC;QAEzE,IAAM,OAAO,GAAG,+BAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAE1C,IAAA,KAAmC,kBAAkB,CAAC,KAAK,CAAC,EAA1D,WAAW,iBAAA,EAAE,eAAe,qBAA8B,CAAC;QAEnE,OAAO;YACL,UAAU,YAAA;YACV,WAAW,aAAA;YACX,IAAI,MAAA;YACJ,WAAW,aAAA;YACX,UAAU,YAAA;YACV,aAAa,eAAA;YACb,QAAQ,UAAA;YACR,mBAAmB,EAAE;gBACnB,cAAc,gBAAA;gBACd,WAAW,aAAA;gBACX,cAAc,gBAAA;gBACd,iBAAiB,mBAAA;aAClB;YAED,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;gBACX,cAAc,EAAE,KAAK;gBACrB,QAAQ,EAAE,OAAO;aAClB;YAED,IAAI,EAAE,uCAAqB,CAAC,KAAK,uDAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,OAAO,IACV,eAAe,GACf,KAAK,GACL,mBAAmB,EACtB;YAEF,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,YAAY;SACvB,CAAC;IACJ,CAAC,CAAC;IA9CW,QAAA,gBAAgB,oBA8C3B","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"]}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
define(["require", "exports"], function (require, exports) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useCardContextValue = void 0;
|
5
|
-
function useCardContextValue(_a) {
|
6
|
-
var selectableA11yProps = _a.selectableA11yProps;
|
7
|
-
return { selectableA11yProps: selectableA11yProps };
|
8
|
-
}
|
9
|
-
exports.useCardContextValue = useCardContextValue;
|
10
|
-
});
|
11
|
-
//# sourceMappingURL=useCardContextValue.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useCardContextValue.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/useCardContextValue.ts"],"names":[],"mappings":";;;;IAEA,SAAgB,mBAAmB,CAAC,EAAkC;YAAhC,mBAAmB,yBAAA;QACvD,OAAO,EAAE,mBAAmB,qBAAA,EAAE,CAAC;IACjC,CAAC;IAFD,kDAEC","sourcesContent":["import type { CardContextValue, CardState } from './Card.types';\n\nexport function useCardContextValue({ selectableA11yProps }: CardState): CardContextValue {\n return { selectableA11yProps };\n}\n"]}
|
@@ -1,97 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/keyboard-keys", "@fluentui/react-tabster"], function (require, exports, tslib_1, React, react_utilities_1, keyboard_keys_1, react_tabster_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.useCardSelectable = void 0;
|
5
|
-
/**
|
6
|
-
* @internal
|
7
|
-
*
|
8
|
-
* Create the state related to selectable cards.
|
9
|
-
*
|
10
|
-
* This internal hook controls all the logic for selectable cards and is
|
11
|
-
* intended to be used alongside with useCard_unstable.
|
12
|
-
*
|
13
|
-
* @param props - props from this instance of Card
|
14
|
-
* @param a11yProps - accessibility props shared between elements of the card
|
15
|
-
* @param ref - reference to the root element of Card
|
16
|
-
*/
|
17
|
-
var useCardSelectable = function (props, _a, cardRef) {
|
18
|
-
var referenceLabel = _a.referenceLabel, referenceId = _a.referenceId;
|
19
|
-
var _b = props.checkbox, checkbox = _b === void 0 ? {} : _b, selected = props.selected, defaultSelected = props.defaultSelected, onSelectionChange = props.onSelectionChange, floatingAction = props.floatingAction, onClick = props.onClick, onKeyDown = props.onKeyDown;
|
20
|
-
var findAllFocusable = react_tabster_1.useFocusFinders().findAllFocusable;
|
21
|
-
var checkboxRef = React.useRef(null);
|
22
|
-
var isSelectable = [selected, defaultSelected, onSelectionChange].some(function (prop) { return typeof prop !== 'undefined'; });
|
23
|
-
var _c = React.useState(false), isCardSelected = _c[0], setIsCardSelected = _c[1];
|
24
|
-
var _d = React.useState(false), isSelectFocused = _d[0], setIsSelectFocused = _d[1];
|
25
|
-
var shouldRestrictTriggerAction = React.useCallback(function (event) {
|
26
|
-
if (!cardRef.current) {
|
27
|
-
return false;
|
28
|
-
}
|
29
|
-
var focusableElements = findAllFocusable(cardRef.current);
|
30
|
-
var target = event.target;
|
31
|
-
var isElementInFocusableGroup = focusableElements.some(function (element) { return element.contains(target); });
|
32
|
-
var isCheckboxSlot = (checkboxRef === null || checkboxRef === void 0 ? void 0 : checkboxRef.current) === target;
|
33
|
-
return isElementInFocusableGroup && !isCheckboxSlot;
|
34
|
-
}, [cardRef, findAllFocusable]);
|
35
|
-
var onChangeHandler = React.useCallback(function (event) {
|
36
|
-
if (shouldRestrictTriggerAction(event)) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
var newCheckedValue = !isCardSelected;
|
40
|
-
setIsCardSelected(newCheckedValue);
|
41
|
-
if (onSelectionChange) {
|
42
|
-
onSelectionChange(event, { selected: newCheckedValue });
|
43
|
-
}
|
44
|
-
}, [onSelectionChange, isCardSelected, shouldRestrictTriggerAction]);
|
45
|
-
var onKeyDownHandler = React.useCallback(function (event) {
|
46
|
-
if ([keyboard_keys_1.Enter].includes(event.key)) {
|
47
|
-
event.preventDefault();
|
48
|
-
onChangeHandler(event);
|
49
|
-
}
|
50
|
-
}, [onChangeHandler]);
|
51
|
-
var checkboxSlot = React.useMemo(function () {
|
52
|
-
if (!isSelectable || floatingAction) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
var selectableCheckboxProps = {};
|
56
|
-
if (referenceId) {
|
57
|
-
selectableCheckboxProps['aria-labelledby'] = referenceId;
|
58
|
-
}
|
59
|
-
else if (referenceLabel) {
|
60
|
-
selectableCheckboxProps['aria-label'] = referenceLabel;
|
61
|
-
}
|
62
|
-
return react_utilities_1.resolveShorthand(checkbox, {
|
63
|
-
defaultProps: tslib_1.__assign({ ref: checkboxRef, type: 'checkbox', checked: isCardSelected, onChange: function (event) { return onChangeHandler(event); }, onFocus: function () { return setIsSelectFocused(true); }, onBlur: function () { return setIsSelectFocused(false); } }, selectableCheckboxProps),
|
64
|
-
});
|
65
|
-
}, [checkbox, floatingAction, isCardSelected, isSelectable, onChangeHandler, referenceId, referenceLabel]);
|
66
|
-
var floatingActionSlot = React.useMemo(function () {
|
67
|
-
if (!floatingAction) {
|
68
|
-
return;
|
69
|
-
}
|
70
|
-
return react_utilities_1.resolveShorthand(floatingAction, {
|
71
|
-
defaultProps: {
|
72
|
-
ref: checkboxRef,
|
73
|
-
},
|
74
|
-
});
|
75
|
-
}, [floatingAction]);
|
76
|
-
var selectableCardProps = React.useMemo(function () {
|
77
|
-
if (!isSelectable) {
|
78
|
-
return null;
|
79
|
-
}
|
80
|
-
return {
|
81
|
-
onClick: react_utilities_1.mergeCallbacks(onClick, onChangeHandler),
|
82
|
-
onKeyDown: react_utilities_1.mergeCallbacks(onKeyDown, onKeyDownHandler),
|
83
|
-
};
|
84
|
-
}, [isSelectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);
|
85
|
-
React.useEffect(function () { return setIsCardSelected(Boolean(defaultSelected !== null && defaultSelected !== void 0 ? defaultSelected : selected)); }, [defaultSelected, selected, setIsCardSelected]);
|
86
|
-
return {
|
87
|
-
selected: isCardSelected,
|
88
|
-
selectable: isSelectable,
|
89
|
-
selectFocused: isSelectFocused,
|
90
|
-
selectableCardProps: selectableCardProps,
|
91
|
-
checkboxSlot: checkboxSlot,
|
92
|
-
floatingActionSlot: floatingActionSlot,
|
93
|
-
};
|
94
|
-
};
|
95
|
-
exports.useCardSelectable = useCardSelectable;
|
96
|
-
});
|
97
|
-
//# sourceMappingURL=useCardSelectable.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useCardSelectable.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/useCardSelectable.ts"],"names":[],"mappings":";;;;IAOA;;;;;;;;;;;OAWG;IACI,IAAM,iBAAiB,GAAG,UAC/B,KAAgB,EAChB,EAAgH,EAChH,OAAwC;YADtC,cAAc,oBAAA,EAAE,WAAW,iBAAA;QAGrB,IAAA,KAAoG,KAAK,SAA5F,EAAb,QAAQ,mBAAG,EAAE,KAAA,EAAE,QAAQ,GAA6E,KAAK,SAAlF,EAAE,eAAe,GAA4D,KAAK,gBAAjE,EAAE,iBAAiB,GAAyC,KAAK,kBAA9C,EAAE,cAAc,GAAyB,KAAK,eAA9B,EAAE,OAAO,GAAgB,KAAK,QAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;QAE1G,IAAA,gBAAgB,GAAK,+BAAe,EAAE,iBAAtB,CAAuB;QAE/C,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;QAEzD,IAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,OAAO,IAAI,KAAK,WAAW,EAA3B,CAA2B,CAAC,CAAC;QAExG,IAAA,KAAsC,KAAK,CAAC,QAAQ,CAAC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,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAErB,IAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,CAAC;YACxC,IAAI,CAAC,YAAY,EAAE;gBACjB,OAAO,IAAI,CAAC;aACb;YAED,OAAO;gBACL,OAAO,EAAE,gCAAc,CAAC,OAAO,EAAE,eAAe,CAAC;gBACjD,SAAS,EAAE,gCAAc,CAAC,SAAS,EAAE,gBAAgB,CAAC;aACvD,CAAC;QACJ,CAAC,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAE1E,KAAK,CAAC,SAAS,CACb,cAAM,OAAA,iBAAiB,CAAC,OAAO,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,QAAQ,CAAC,CAAC,EAAvD,CAAuD,EAC7D,CAAC,eAAe,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAC/C,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,cAAc;YACxB,UAAU,EAAE,YAAY;YACxB,aAAa,EAAE,eAAe;YAC9B,mBAAmB,qBAAA;YACnB,YAAY,cAAA;YACZ,kBAAkB,oBAAA;SACnB,CAAC;IACJ,CAAC,CAAC;IAzHW,QAAA,iBAAiB,qBAyH5B","sourcesContent":["import * as React from 'react';\nimport { mergeCallbacks, resolveShorthand } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useFocusFinders } from '@fluentui/react-tabster';\n\nimport type { CardContextValue, CardOnSelectionChangeEvent, CardProps, CardSlots } from './Card.types';\n\n/**\n * @internal\n *\n * Create the state related to selectable cards.\n *\n * This internal hook controls all the logic for selectable cards and is\n * intended to be used alongside with useCard_unstable.\n *\n * @param props - props from this instance of Card\n * @param a11yProps - accessibility props shared between elements of the card\n * @param ref - reference to the root element of Card\n */\nexport const useCardSelectable = (\n props: CardProps,\n { referenceLabel, referenceId }: Pick<CardContextValue['selectableA11yProps'], 'referenceId' | 'referenceLabel'>,\n cardRef: React.RefObject<HTMLDivElement>,\n) => {\n const { checkbox = {}, selected, defaultSelected, onSelectionChange, floatingAction, onClick, onKeyDown } = props;\n\n const { findAllFocusable } = useFocusFinders();\n\n const checkboxRef = React.useRef<HTMLInputElement>(null);\n\n const isSelectable = [selected, defaultSelected, onSelectionChange].some(prop => typeof prop !== 'undefined');\n\n const [isCardSelected, setIsCardSelected] = React.useState(false);\n const [isSelectFocused, setIsSelectFocused] = React.useState(false);\n\n const shouldRestrictTriggerAction = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (!cardRef.current) {\n return false;\n }\n\n const focusableElements = findAllFocusable(cardRef.current);\n const target = event.target as HTMLElement;\n const isElementInFocusableGroup = focusableElements.some(element => element.contains(target));\n const isCheckboxSlot = checkboxRef?.current === target;\n\n return isElementInFocusableGroup && !isCheckboxSlot;\n },\n [cardRef, findAllFocusable],\n );\n\n const onChangeHandler = React.useCallback(\n (event: CardOnSelectionChangeEvent) => {\n if (shouldRestrictTriggerAction(event)) {\n return;\n }\n\n const newCheckedValue = !isCardSelected;\n\n setIsCardSelected(newCheckedValue);\n\n if (onSelectionChange) {\n onSelectionChange(event, { selected: newCheckedValue });\n }\n },\n [onSelectionChange, isCardSelected, shouldRestrictTriggerAction],\n );\n\n const onKeyDownHandler = React.useCallback(\n (event: React.KeyboardEvent<HTMLElement>) => {\n if ([Enter].includes(event.key)) {\n event.preventDefault();\n onChangeHandler(event);\n }\n },\n [onChangeHandler],\n );\n\n const checkboxSlot = React.useMemo(() => {\n if (!isSelectable || floatingAction) {\n return;\n }\n\n const selectableCheckboxProps: CardSlots['checkbox'] = {};\n\n if (referenceId) {\n selectableCheckboxProps['aria-labelledby'] = referenceId;\n } else if (referenceLabel) {\n selectableCheckboxProps['aria-label'] = referenceLabel;\n }\n\n return resolveShorthand(checkbox, {\n defaultProps: {\n ref: checkboxRef,\n type: 'checkbox',\n checked: isCardSelected,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChangeHandler(event),\n onFocus: () => setIsSelectFocused(true),\n onBlur: () => setIsSelectFocused(false),\n ...selectableCheckboxProps,\n },\n });\n }, [checkbox, floatingAction, isCardSelected, isSelectable, onChangeHandler, referenceId, referenceLabel]);\n\n const floatingActionSlot = React.useMemo(() => {\n if (!floatingAction) {\n return;\n }\n\n return resolveShorthand(floatingAction, {\n defaultProps: {\n ref: checkboxRef,\n },\n });\n }, [floatingAction]);\n\n const selectableCardProps = React.useMemo(() => {\n if (!isSelectable) {\n return null;\n }\n\n return {\n onClick: mergeCallbacks(onClick, onChangeHandler),\n onKeyDown: mergeCallbacks(onKeyDown, onKeyDownHandler),\n };\n }, [isSelectable, onChangeHandler, onClick, onKeyDown, onKeyDownHandler]);\n\n React.useEffect(\n () => setIsCardSelected(Boolean(defaultSelected ?? selected)),\n [defaultSelected, selected, setIsCardSelected],\n );\n\n return {\n selected: isCardSelected,\n selectable: isSelectable,\n selectFocused: isSelectFocused,\n selectableCardProps,\n checkboxSlot,\n floatingActionSlot,\n };\n};\n"]}
|
@@ -1,253 +0,0 @@
|
|
1
|
-
define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme", "@fluentui/react-tabster", "../CardPreview/useCardPreviewStyles", "../CardHeader/useCardHeaderStyles", "../CardFooter/useCardFooterStyles"], function (require, exports, tslib_1, react_1, react_theme_1, react_tabster_1, useCardPreviewStyles_1, useCardHeaderStyles_1, useCardFooterStyles_1) {
|
2
|
-
"use strict";
|
3
|
-
var _a, _b, _c, _d, _e, _f;
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
5
|
-
exports.useCardStyles_unstable = exports.cardCSSVars = exports.cardClassNames = void 0;
|
6
|
-
/**
|
7
|
-
* Static CSS class names used internally for the component slots.
|
8
|
-
*/
|
9
|
-
exports.cardClassNames = {
|
10
|
-
root: 'fui-Card',
|
11
|
-
floatingAction: 'fui-Card__floatingAction',
|
12
|
-
checkbox: 'fui-Card__checkbox',
|
13
|
-
};
|
14
|
-
/**
|
15
|
-
* CSS variable names used internally for uniform styling in Card.
|
16
|
-
*/
|
17
|
-
exports.cardCSSVars = {
|
18
|
-
cardSizeVar: '--fui-Card--size',
|
19
|
-
cardBorderRadiusVar: '--fui-Card--border-radius',
|
20
|
-
};
|
21
|
-
var focusOutlineStyle = {
|
22
|
-
outlineRadius: "var(" + exports.cardCSSVars.cardBorderRadiusVar + ")",
|
23
|
-
outlineWidth: react_theme_1.tokens.strokeWidthThick,
|
24
|
-
};
|
25
|
-
var useStyles = react_1.makeStyles({
|
26
|
-
root: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.overflow('hidden')), react_1.shorthands.borderRadius("var(" + exports.cardCSSVars.cardBorderRadiusVar + ")")), react_1.shorthands.padding("var(" + exports.cardCSSVars.cardSizeVar + ")")), react_1.shorthands.gap("var(" + exports.cardCSSVars.cardSizeVar + ")")), (_a = { display: 'flex', position: 'relative', boxSizing: 'border-box', color: react_theme_1.tokens.colorNeutralForeground1,
|
27
|
-
// Border setting using after pseudo element to allow CardPreview to render behind it.
|
28
|
-
'::after': tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, content: '""', pointerEvents: 'none' }, react_1.shorthands.borderStyle('solid')), react_1.shorthands.borderWidth(react_theme_1.tokens.strokeWidthThin)), react_1.shorthands.borderRadius("var(" + exports.cardCSSVars.cardBorderRadiusVar + ")")) }, _a["> ." + useCardHeaderStyles_1.cardHeaderClassNames.root + ", > ." + useCardFooterStyles_1.cardFooterClassNames.root] = {
|
29
|
-
flexShrink: 0,
|
30
|
-
}, _a["> :not(." + useCardPreviewStyles_1.cardPreviewClassNames.root + "):not(." + useCardHeaderStyles_1.cardHeaderClassNames.root + "):not(." + useCardFooterStyles_1.cardFooterClassNames.root + ")"] = {
|
31
|
-
flexGrow: 1,
|
32
|
-
}, _a)), react_tabster_1.createFocusOutlineStyle({
|
33
|
-
style: focusOutlineStyle,
|
34
|
-
selector: 'focus',
|
35
|
-
})),
|
36
|
-
selectableFocused: react_tabster_1.createFocusOutlineStyle({
|
37
|
-
style: focusOutlineStyle,
|
38
|
-
selector: 'focus-within',
|
39
|
-
}),
|
40
|
-
orientationHorizontal: (_b = {
|
41
|
-
flexDirection: 'row',
|
42
|
-
alignItems: 'center'
|
43
|
-
},
|
44
|
-
// Remove vertical padding to keep CardPreview content flush with Card's borders.
|
45
|
-
_b["> ." + useCardPreviewStyles_1.cardPreviewClassNames.root] = {
|
46
|
-
marginTop: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
47
|
-
marginBottom: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
48
|
-
},
|
49
|
-
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
50
|
-
// As such, the code below targets a CardPreview, when it's the first element.
|
51
|
-
// Since this is on horizontal cards, the left padding is removed to keep the content flush with the border.
|
52
|
-
_b["> :not([aria-hidden=\"true\"])." + useCardPreviewStyles_1.cardPreviewClassNames.root + ":first-of-type"] = {
|
53
|
-
marginLeft: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
54
|
-
},
|
55
|
-
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
56
|
-
// As such, the code below targets a CardPreview, when it's the last element.
|
57
|
-
// Since this is on horizontal cards, the right padding is removed to keep the content flush with the border.
|
58
|
-
_b["> :not([aria-hidden=\"true\"])." + useCardPreviewStyles_1.cardPreviewClassNames.root + ":last-of-type"] = {
|
59
|
-
marginRight: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
60
|
-
},
|
61
|
-
// If the last child is a CardHeader or CardFooter, allow it to grow to fill the available space.
|
62
|
-
_b["> ." + useCardHeaderStyles_1.cardHeaderClassNames.root + ":last-of-type, > ." + useCardFooterStyles_1.cardFooterClassNames.root + ":last-of-type"] = {
|
63
|
-
flexGrow: 1,
|
64
|
-
},
|
65
|
-
_b),
|
66
|
-
orientationVertical: (_c = {
|
67
|
-
flexDirection: 'column'
|
68
|
-
},
|
69
|
-
// Remove lateral padding to keep CardPreview content flush with Card's borders.
|
70
|
-
_c["> ." + useCardPreviewStyles_1.cardPreviewClassNames.root] = {
|
71
|
-
marginLeft: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
72
|
-
marginRight: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
73
|
-
},
|
74
|
-
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
75
|
-
// As such, the code below targets a CardPreview, when it's the first element.
|
76
|
-
// Since this is on vertical cards, the top padding is removed to keep the content flush with the border.
|
77
|
-
_c["> :not([aria-hidden=\"true\"])." + useCardPreviewStyles_1.cardPreviewClassNames.root + ":first-of-type"] = {
|
78
|
-
marginTop: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
79
|
-
},
|
80
|
-
_c["> ." + exports.cardClassNames.floatingAction + " + ." + useCardPreviewStyles_1.cardPreviewClassNames.root] = {
|
81
|
-
marginTop: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
82
|
-
},
|
83
|
-
// Due to Tabster's "Groupper" focus functionality, hidden elements are injected before and after Card's content.
|
84
|
-
// As such, the code below targets a CardPreview, when it's the first element.
|
85
|
-
// Since this is on vertical cards, the bottom padding is removed to keep the content flush with the border.
|
86
|
-
_c["> :not([aria-hidden=\"true\"])." + useCardPreviewStyles_1.cardPreviewClassNames.root + ":last-of-type"] = {
|
87
|
-
marginBottom: "calc(var(" + exports.cardCSSVars.cardSizeVar + ") * -1)",
|
88
|
-
},
|
89
|
-
_c),
|
90
|
-
sizeSmall: (_d = {},
|
91
|
-
_d[exports.cardCSSVars.cardSizeVar] = '8px',
|
92
|
-
_d[exports.cardCSSVars.cardBorderRadiusVar] = react_theme_1.tokens.borderRadiusSmall,
|
93
|
-
_d),
|
94
|
-
sizeMedium: (_e = {},
|
95
|
-
_e[exports.cardCSSVars.cardSizeVar] = '12px',
|
96
|
-
_e[exports.cardCSSVars.cardBorderRadiusVar] = react_theme_1.tokens.borderRadiusMedium,
|
97
|
-
_e),
|
98
|
-
sizeLarge: (_f = {},
|
99
|
-
_f[exports.cardCSSVars.cardSizeVar] = '16px',
|
100
|
-
_f[exports.cardCSSVars.cardBorderRadiusVar] = react_theme_1.tokens.borderRadiusLarge,
|
101
|
-
_f),
|
102
|
-
filled: {
|
103
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground1,
|
104
|
-
boxShadow: react_theme_1.tokens.shadow4,
|
105
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
|
106
|
-
},
|
107
|
-
filledInteractive: {
|
108
|
-
cursor: 'pointer',
|
109
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground1,
|
110
|
-
boxShadow: react_theme_1.tokens.shadow4,
|
111
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
|
112
|
-
':hover': {
|
113
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground1Hover,
|
114
|
-
boxShadow: react_theme_1.tokens.shadow8,
|
115
|
-
},
|
116
|
-
':active': {
|
117
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground1Pressed,
|
118
|
-
},
|
119
|
-
},
|
120
|
-
filledInteractiveSelected: {
|
121
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground1Selected,
|
122
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Selected)),
|
123
|
-
':hover': {
|
124
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground1Selected,
|
125
|
-
},
|
126
|
-
},
|
127
|
-
filledAlternative: {
|
128
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground2,
|
129
|
-
boxShadow: react_theme_1.tokens.shadow4,
|
130
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
|
131
|
-
},
|
132
|
-
filledAlternativeInteractive: {
|
133
|
-
cursor: 'pointer',
|
134
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground2,
|
135
|
-
boxShadow: react_theme_1.tokens.shadow4,
|
136
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
|
137
|
-
':hover': {
|
138
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground2Hover,
|
139
|
-
boxShadow: react_theme_1.tokens.shadow8,
|
140
|
-
},
|
141
|
-
':active': {
|
142
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground2Pressed,
|
143
|
-
},
|
144
|
-
},
|
145
|
-
filledAlternativeInteractiveSelected: {
|
146
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground2Selected,
|
147
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Selected)),
|
148
|
-
':hover': {
|
149
|
-
backgroundColor: react_theme_1.tokens.colorNeutralBackground2Selected,
|
150
|
-
},
|
151
|
-
},
|
152
|
-
outline: {
|
153
|
-
backgroundColor: react_theme_1.tokens.colorTransparentBackground,
|
154
|
-
boxShadow: 'none',
|
155
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1)),
|
156
|
-
},
|
157
|
-
outlineInteractive: {
|
158
|
-
cursor: 'pointer',
|
159
|
-
backgroundColor: react_theme_1.tokens.colorTransparentBackground,
|
160
|
-
boxShadow: 'none',
|
161
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1)),
|
162
|
-
':hover': {
|
163
|
-
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundHover,
|
164
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Hover)),
|
165
|
-
},
|
166
|
-
':active': {
|
167
|
-
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundPressed,
|
168
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Pressed)),
|
169
|
-
},
|
170
|
-
},
|
171
|
-
outlineInteractiveSelected: {
|
172
|
-
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundSelected,
|
173
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Selected)),
|
174
|
-
':hover': {
|
175
|
-
backgroundColor: react_theme_1.tokens.colorTransparentBackgroundSelected,
|
176
|
-
},
|
177
|
-
},
|
178
|
-
subtle: {
|
179
|
-
backgroundColor: react_theme_1.tokens.colorSubtleBackground,
|
180
|
-
boxShadow: 'none',
|
181
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
|
182
|
-
},
|
183
|
-
subtleInteractive: {
|
184
|
-
cursor: 'pointer',
|
185
|
-
backgroundColor: react_theme_1.tokens.colorSubtleBackground,
|
186
|
-
boxShadow: 'none',
|
187
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorTransparentStroke)),
|
188
|
-
':hover': {
|
189
|
-
backgroundColor: react_theme_1.tokens.colorSubtleBackgroundHover,
|
190
|
-
},
|
191
|
-
':active': {
|
192
|
-
backgroundColor: react_theme_1.tokens.colorSubtleBackgroundPressed,
|
193
|
-
},
|
194
|
-
},
|
195
|
-
subtleInteractiveSelected: {
|
196
|
-
backgroundColor: react_theme_1.tokens.colorSubtleBackgroundSelected,
|
197
|
-
'::after': tslib_1.__assign({}, react_1.shorthands.borderColor(react_theme_1.tokens.colorNeutralStroke1Selected)),
|
198
|
-
':hover': {
|
199
|
-
backgroundColor: react_theme_1.tokens.colorSubtleBackgroundSelected,
|
200
|
-
},
|
201
|
-
},
|
202
|
-
select: {
|
203
|
-
position: 'absolute',
|
204
|
-
top: '4px',
|
205
|
-
right: '4px',
|
206
|
-
zIndex: 1,
|
207
|
-
},
|
208
|
-
hiddenCheckbox: tslib_1.__assign(tslib_1.__assign({}, react_1.shorthands.overflow('hidden')), { width: '1px', height: '1px', position: 'absolute', clip: 'rect(0 0 0 0)', clipPath: 'inset(50%)', whiteSpace: 'nowrap' }),
|
209
|
-
});
|
210
|
-
/**
|
211
|
-
* Apply styling to the Card slots based on the state.
|
212
|
-
*/
|
213
|
-
var useCardStyles_unstable = function (state) {
|
214
|
-
var styles = useStyles();
|
215
|
-
var orientationMap = {
|
216
|
-
horizontal: styles.orientationHorizontal,
|
217
|
-
vertical: styles.orientationVertical,
|
218
|
-
};
|
219
|
-
var sizeMap = {
|
220
|
-
small: styles.sizeSmall,
|
221
|
-
medium: styles.sizeMedium,
|
222
|
-
large: styles.sizeLarge,
|
223
|
-
};
|
224
|
-
var appearanceMap = {
|
225
|
-
filled: styles.filled,
|
226
|
-
'filled-alternative': styles.filledAlternative,
|
227
|
-
outline: styles.outline,
|
228
|
-
subtle: styles.subtle,
|
229
|
-
};
|
230
|
-
var selectedMap = {
|
231
|
-
filled: styles.filledInteractiveSelected,
|
232
|
-
'filled-alternative': styles.filledAlternativeInteractiveSelected,
|
233
|
-
outline: styles.outlineInteractiveSelected,
|
234
|
-
subtle: styles.subtleInteractiveSelected,
|
235
|
-
};
|
236
|
-
var interactiveMap = {
|
237
|
-
filled: styles.filledInteractive,
|
238
|
-
'filled-alternative': styles.filledAlternativeInteractive,
|
239
|
-
outline: styles.outlineInteractive,
|
240
|
-
subtle: styles.subtleInteractive,
|
241
|
-
};
|
242
|
-
state.root.className = react_1.mergeClasses(exports.cardClassNames.root, styles.root, orientationMap[state.orientation], sizeMap[state.size], appearanceMap[state.appearance], (state.interactive || state.selectable) && interactiveMap[state.appearance], state.selected && selectedMap[state.appearance], state.selectFocused && styles.selectableFocused, state.root.className);
|
243
|
-
if (state.floatingAction) {
|
244
|
-
state.floatingAction.className = react_1.mergeClasses(exports.cardClassNames.floatingAction, styles.select, state.floatingAction.className);
|
245
|
-
}
|
246
|
-
if (state.checkbox) {
|
247
|
-
state.checkbox.className = react_1.mergeClasses(exports.cardClassNames.checkbox, styles.hiddenCheckbox, state.checkbox.className);
|
248
|
-
}
|
249
|
-
return state;
|
250
|
-
};
|
251
|
-
exports.useCardStyles_unstable = useCardStyles_unstable;
|
252
|
-
});
|
253
|
-
//# sourceMappingURL=useCardStyles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useCardStyles.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-card/src/components/Card/useCardStyles.ts"],"names":[],"mappings":";;;;;IAUA;;OAEG;IACU,QAAA,cAAc,GAA8B;QACvD,IAAI,EAAE,UAAU;QAChB,cAAc,EAAE,0BAA0B;QAC1C,QAAQ,EAAE,oBAAoB;KAC/B,CAAC;IAEF;;OAEG;IACU,QAAA,WAAW,GAAG;QACzB,WAAW,EAAE,kBAAkB;QAC/B,mBAAmB,EAAE,2BAA2B;KACjD,CAAC;IAEF,IAAM,iBAAiB,GAAG;QACxB,aAAa,EAAE,SAAO,mBAAW,CAAC,mBAAmB,MAAG;QACxD,YAAY,EAAE,oBAAM,CAAC,gBAAgB;KACtC,CAAC;IAEF,IAAM,SAAS,GAAG,kBAAU,CAAC;QAC3B,IAAI,4GACC,kBAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAC7B,kBAAU,CAAC,YAAY,CAAC,SAAO,mBAAW,CAAC,mBAAmB,MAAG,CAAC,GAClE,kBAAU,CAAC,OAAO,CAAC,SAAO,mBAAW,CAAC,WAAW,MAAG,CAAC,GACrD,kBAAU,CAAC,GAAG,CAAC,SAAO,mBAAW,CAAC,WAAW,MAAG,CAAC,WAEpD,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,YAAY,EACvB,KAAK,EAAE,oBAAM,CAAC,uBAAuB;gBAErC,sFAAs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CAAC,cAAc,EAC7B,MAAM,CAAC,MAAM,EACb,KAAK,CAAC,cAAc,CAAC,SAAS,CAC/B,CAAC;SACH;QAED,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClB,KAAK,CAAC,QAAQ,CAAC,SAAS,GAAG,oBAAY,CAAC,sBAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;SACnH;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA3DW,QAAA,sBAAsB,0BA2DjC","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { createFocusOutlineStyle } from '@fluentui/react-tabster';\n\nimport { cardPreviewClassNames } from '../CardPreview/useCardPreviewStyles';\nimport { cardHeaderClassNames } from '../CardHeader/useCardHeaderStyles';\nimport { cardFooterClassNames } from '../CardFooter/useCardFooterStyles';\nimport type { CardSlots, CardState } from './Card.types';\n\n/**\n * Static CSS class names used internally for the component slots.\n */\nexport const cardClassNames: SlotClassNames<CardSlots> = {\n root: 'fui-Card',\n floatingAction: 'fui-Card__floatingAction',\n checkbox: 'fui-Card__checkbox',\n};\n\n/**\n * CSS variable names used internally for uniform styling in Card.\n */\nexport const cardCSSVars = {\n cardSizeVar: '--fui-Card--size',\n cardBorderRadiusVar: '--fui-Card--border-radius',\n};\n\nconst focusOutlineStyle = {\n outlineRadius: `var(${cardCSSVars.cardBorderRadiusVar})`,\n outlineWidth: tokens.strokeWidthThick,\n};\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.overflow('hidden'),\n ...shorthands.borderRadius(`var(${cardCSSVars.cardBorderRadiusVar})`),\n ...shorthands.padding(`var(${cardCSSVars.cardSizeVar})`),\n ...shorthands.gap(`var(${cardCSSVars.cardSizeVar})`),\n\n display: 'flex',\n position: 'relative',\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground1,\n\n // Border setting using after pseudo element to allow CardPreview to render behind it.\n '::after': {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n content: '\"\"',\n pointerEvents: 'none',\n\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n ...shorthands.borderRadius(`var(${cardCSSVars.cardBorderRadiusVar})`),\n },\n\n // Prevents CardHeader and CardFooter from shrinking.\n [`> .${cardHeaderClassNames.root}, > .${cardFooterClassNames.root}`]: {\n flexShrink: 0,\n },\n // Allows non-card components to grow to fill the available space.\n [`> :not(.${cardPreviewClassNames.root}):not(.${cardHeaderClassNames.root}):not(.${cardFooterClassNames.root})`]: {\n flexGrow: 1,\n },\n\n ...createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus',\n }),\n },\n\n selectableFocused: createFocusOutlineStyle({\n style: focusOutlineStyle,\n selector: 'focus-within',\n }),\n\n orientationHorizontal: {\n flexDirection: 'row',\n alignItems: 'center',\n\n // Remove vertical padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on horizontal cards, the left padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the last element.\n // Since this is on horizontal cards, the right padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // If the last child is a CardHeader or CardFooter, allow it to grow to fill the available space.\n [`> .${cardHeaderClassNames.root}:last-of-type, > .${cardFooterClassNames.root}:last-of-type`]: {\n flexGrow: 1,\n },\n },\n orientationVertical: {\n flexDirection: 'column',\n\n // Remove lateral padding to keep CardPreview content flush with Card's borders.\n [`> .${cardPreviewClassNames.root}`]: {\n marginLeft: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n marginRight: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the top padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:first-of-type`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n [`> .${cardClassNames.floatingAction} + .${cardPreviewClassNames.root}`]: {\n marginTop: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n\n // Due to Tabster's \"Groupper\" focus functionality, hidden elements are injected before and after Card's content.\n // As such, the code below targets a CardPreview, when it's the first element.\n // Since this is on vertical cards, the bottom padding is removed to keep the content flush with the border.\n [`> :not([aria-hidden=\"true\"]).${cardPreviewClassNames.root}:last-of-type`]: {\n marginBottom: `calc(var(${cardCSSVars.cardSizeVar}) * -1)`,\n },\n },\n\n sizeSmall: {\n [cardCSSVars.cardSizeVar]: '8px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusSmall,\n },\n sizeMedium: {\n [cardCSSVars.cardSizeVar]: '12px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusMedium,\n },\n sizeLarge: {\n [cardCSSVars.cardSizeVar]: '16px',\n [cardCSSVars.cardBorderRadiusVar]: tokens.borderRadiusLarge,\n },\n\n filled: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground1Pressed,\n },\n },\n filledInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n },\n },\n\n filledAlternative: {\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n filledAlternativeInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorNeutralBackground2,\n boxShadow: tokens.shadow4,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground2Hover,\n boxShadow: tokens.shadow8,\n },\n ':active': {\n backgroundColor: tokens.colorNeutralBackground2Pressed,\n },\n },\n filledAlternativeInteractiveSelected: {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground2Selected,\n },\n },\n\n outline: {\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n },\n outlineInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorTransparentBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n },\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundHover,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Hover),\n },\n },\n ':active': {\n backgroundColor: tokens.colorTransparentBackgroundPressed,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),\n },\n },\n },\n outlineInteractiveSelected: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n },\n },\n\n subtle: {\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n },\n subtleInteractive: {\n cursor: 'pointer',\n backgroundColor: tokens.colorSubtleBackground,\n boxShadow: 'none',\n\n '::after': {\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n },\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n subtleInteractiveSelected: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n\n '::after': {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n },\n\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n },\n },\n\n select: {\n position: 'absolute',\n top: '4px',\n right: '4px',\n zIndex: 1,\n },\n\n hiddenCheckbox: {\n ...shorthands.overflow('hidden'),\n width: '1px',\n height: '1px',\n position: 'absolute',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n },\n});\n\n/**\n * Apply styling to the Card slots based on the state.\n */\nexport const useCardStyles_unstable = (state: CardState): CardState => {\n const styles = useStyles();\n\n const orientationMap = {\n horizontal: styles.orientationHorizontal,\n vertical: styles.orientationVertical,\n };\n\n const sizeMap = {\n small: styles.sizeSmall,\n medium: styles.sizeMedium,\n large: styles.sizeLarge,\n };\n\n const appearanceMap = {\n filled: styles.filled,\n 'filled-alternative': styles.filledAlternative,\n outline: styles.outline,\n subtle: styles.subtle,\n };\n\n const selectedMap = {\n filled: styles.filledInteractiveSelected,\n 'filled-alternative': styles.filledAlternativeInteractiveSelected,\n outline: styles.outlineInteractiveSelected,\n subtle: styles.subtleInteractiveSelected,\n };\n const interactiveMap = {\n filled: styles.filledInteractive,\n 'filled-alternative': styles.filledAlternativeInteractive,\n outline: styles.outlineInteractive,\n subtle: styles.subtleInteractive,\n };\n\n state.root.className = mergeClasses(\n cardClassNames.root,\n styles.root,\n orientationMap[state.orientation],\n sizeMap[state.size],\n appearanceMap[state.appearance],\n (state.interactive || state.selectable) && interactiveMap[state.appearance],\n state.selected && selectedMap[state.appearance],\n state.selectFocused && styles.selectableFocused,\n state.root.className,\n );\n\n if (state.floatingAction) {\n state.floatingAction.className = mergeClasses(\n cardClassNames.floatingAction,\n styles.select,\n state.floatingAction.className,\n );\n }\n\n if (state.checkbox) {\n state.checkbox.className = mergeClasses(cardClassNames.checkbox, styles.hiddenCheckbox, state.checkbox.className);\n }\n\n return state;\n};\n"]}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
define(["require", "exports", "react", "./useCardFooter", "./renderCardFooter", "./useCardFooterStyles"], function (require, exports, React, useCardFooter_1, renderCardFooter_1, useCardFooterStyles_1) {
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.CardFooter = void 0;
|
5
|
-
/**
|
6
|
-
* Component to render Button actions in a Card component.
|
7
|
-
*/
|
8
|
-
exports.CardFooter = React.forwardRef(function (props, ref) {
|
9
|
-
var state = useCardFooter_1.useCardFooter_unstable(props, ref);
|
10
|
-
useCardFooterStyles_1.useCardFooterStyles_unstable(state);
|
11
|
-
return renderCardFooter_1.renderCardFooter_unstable(state);
|
12
|
-
});
|
13
|
-
exports.CardFooter.displayName = 'CardFooter';
|
14
|
-
});
|
15
|
-
//# sourceMappingURL=CardFooter.js.map
|