init project
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled

This commit is contained in:
how2ice
2025-12-12 14:26:25 +09:00
commit 005cf56baf
43188 changed files with 1079531 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '../styles';
import { InternalStandardProps as StandardProps } from '../internal';
import { CardActionsClasses } from './cardActionsClasses';
export interface CardActionsProps extends StandardProps<React.HTMLAttributes<HTMLDivElement>> {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<CardActionsClasses>;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* If `true`, the actions do not have additional margin.
* @default false
*/
disableSpacing?: boolean;
}
/**
*
* Demos:
*
* - [Card](https://mui.com/material-ui/react-card/)
*
* API:
*
* - [CardActions API](https://mui.com/material-ui/api/card-actions/)
*/
export default function CardActions(props: CardActionsProps): React.JSX.Element;

View File

@@ -0,0 +1,98 @@
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import composeClasses from '@mui/utils/composeClasses';
import { styled } from '../zero-styled';
import { useDefaultProps } from '../DefaultPropsProvider';
import { getCardActionsUtilityClass } from './cardActionsClasses';
const useUtilityClasses = (ownerState) => {
const { classes, disableSpacing } = ownerState;
const slots = {
root: ['root', !disableSpacing && 'spacing'],
};
return composeClasses(slots, getCardActionsUtilityClass, classes);
};
const CardActionsRoot = styled('div', {
name: 'MuiCardActions',
slot: 'Root',
overridesResolver: (props, styles) => {
const { ownerState } = props;
return [styles.root, !ownerState.disableSpacing && styles.spacing];
},
})({
display: 'flex',
alignItems: 'center',
padding: 8,
variants: [
{
props: { disableSpacing: false },
style: {
'& > :not(style) ~ :not(style)': {
marginLeft: 8,
},
},
},
],
});
const CardActions = React.forwardRef(function CardActions(inProps, ref) {
const props = useDefaultProps({
props: inProps,
name: 'MuiCardActions',
});
const { disableSpacing = false, className, ...other } = props;
const ownerState = { ...props, disableSpacing };
const classes = useUtilityClasses(ownerState);
return (
<CardActionsRoot
className={clsx(classes.root, className)}
ownerState={ownerState}
ref={ref}
{...other}
/>
);
});
CardActions.propTypes /* remove-proptypes */ = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* The content of the component.
*/
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
*/
classes: PropTypes.object,
/**
* @ignore
*/
className: PropTypes.string,
/**
* If `true`, the actions do not have additional margin.
* @default false
*/
disableSpacing: PropTypes.bool,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])),
PropTypes.func,
PropTypes.object,
]),
};
export default CardActions;

View File

@@ -0,0 +1,40 @@
import { createRenderer, isJsdom } from '@mui/internal-test-utils';
import CardActions, { cardActionsClasses as classes } from '@mui/material/CardActions';
import Button from '@mui/material/Button';
import { expect } from 'chai';
import describeConformance from '../../test/describeConformance';
describe('<CardActions />', () => {
const { render } = createRenderer();
describeConformance(<CardActions />, () => ({
classes,
inheritComponent: 'div',
render,
refInstanceof: window.HTMLDivElement,
muiName: 'MuiCardActions',
testVariantProps: { disableSpacing: true },
skip: ['componentProp', 'componentsProp'],
}));
it.skipIf(isJsdom())('should apply margin to all children but the first one', function test() {
const { container } = render(
<CardActions>
<Button data-testid="child-1">Agree</Button>
<Button data-testid="child-2" href="#">
Agree
</Button>
<Button data-testid="child-3" component="span">
Agree
</Button>
<div data-testid="child-4" />
</CardActions>,
);
const children = container.querySelectorAll('[data-testid^="child-"]');
expect(children[0]).toHaveComputedStyle({ marginLeft: '0px' });
expect(children[1]).toHaveComputedStyle({ marginLeft: '8px' });
expect(children[2]).toHaveComputedStyle({ marginLeft: '8px' });
expect(children[3]).toHaveComputedStyle({ marginLeft: '8px' });
});
});

View File

@@ -0,0 +1,22 @@
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
import generateUtilityClass from '@mui/utils/generateUtilityClass';
export interface CardActionsClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the root element unless `disableSpacing={true}`. */
spacing: string;
}
export type CardActionsClassKey = keyof CardActionsClasses;
export function getCardActionsUtilityClass(slot: string): string {
return generateUtilityClass('MuiCardActions', slot);
}
const cardActionsClasses: CardActionsClasses = generateUtilityClasses('MuiCardActions', [
'root',
'spacing',
]);
export default cardActionsClasses;

View File

@@ -0,0 +1,5 @@
export { default } from './CardActions';
export * from './CardActions';
export { default as cardActionsClasses } from './cardActionsClasses';
export * from './cardActionsClasses';

View File

@@ -0,0 +1,4 @@
export { default } from './CardActions';
export { default as cardActionsClasses } from './cardActionsClasses';
export * from './cardActionsClasses';