Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "add react-card components",
"packageName": "@fluentui-contrib/react-cap-theme",
"email": "egianoglio@microsoft.com",
"dependentChangeType": "patch"
}
24 changes: 24 additions & 0 deletions packages/react-cap-theme/src/capStyleHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ import type {
ToggleButtonState,
} from './components/react-button';
import type { CompoundButtonState } from '@fluentui/react-button';
import {
useCardStyles,
useCardFooterStyles,
useCardHeaderStyles,
useCardPreviewStyles,
} from './components/react-card';
import type {
CardState,
CardHeaderState,
CardPreviewState,
} from './components/react-card';
import type { CardFooterState } from '@fluentui/react-components';
import {
useCarouselStyles,
useCarouselAutoplayButtonStyles,
Expand Down Expand Up @@ -158,6 +170,18 @@ export const CAP_STYLE_HOOKS: NonNullable<
useButtonStyles_unstable: (state) => {
return useButtonStyles(state as ButtonState);
},
useCardStyles_unstable: (state) => {
return useCardStyles(state as CardState);
},
useCardFooterStyles_unstable: (state) => {
return useCardFooterStyles(state as CardFooterState);
},
useCardHeaderStyles_unstable: (state) => {
return useCardHeaderStyles(state as CardHeaderState);
},
useCardPreviewStyles_unstable: (state) => {
return useCardPreviewStyles(state as CardPreviewState);
},
useCarouselAutoplayButtonStyles_unstable: (state) => {
return useCarouselAutoplayButtonStyles(
state as CarouselAutoplayButtonState
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import type {
CardContextValue as BaseContextValue,
CardProps as BaseProps,
CardState as BaseState,
} from '@fluentui/react-card';

/**
* SP specific data shared between card components
* @internal
*/
export type CardContextValueInternal = Pick<
CardState,
'disabled' | 'orientation' | 'size'
>;

/**
* Data shared between card components
* @internal
*/
export type CardContextValue = CardContextValueInternal & BaseContextValue;

/**
* Combined Fluent and SP context values for Card and its underlying components.
* @internal
*/
export type CardContextValues = {
/** Fluent's context values from the Card component */
base: BaseContextValue;
/** Local context values specific to this SP implementation */
local: CardContextValueInternal;
};

/**
* Props for the Card component.
* @alpha
*/
export type CardProps = Omit<BaseProps, 'appearance'> & {
/**
* Sets the appearance of the card.
*
* `filled`
* The card will have a shadow, border and background color.
*
* `subtle`
* This appearance shows no background or shadow on rest.
*
* @default 'filled'
*/
appearance?: 'filled' | 'subtle';
};

/**
* State for rendering the Card.
* @alpha
*/
export type CardState = Omit<BaseState, 'appearance'> &
Required<Pick<CardProps, 'appearance'>>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { cardCSSVars as fluentCardCSSVars } from '@fluentui/react-card';

// Declared in a separate file to avoid circular dependency.
/**
* CSS variable names used internally for uniform styling in Card.
* @internal
*/
export const cardCSSVars = {
...fluentCardCSSVars,
cardChildMarginVar: '--cap-Card--child-margin',
};
Loading
Loading