pre-installations and preparations
This commit is contained in:
1 parent
3e5a0329cb
commit
201d621ac3
6977 files changed
+742826
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
import { PolymorphicComponent } from '../utils';
|
||||
import { TabPanelTypeMap } from './TabPanel.types';
|
||||
/**
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Tabs](https://mui.com/base-ui/react-tabs/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [TabPanel API](https://mui.com/base-ui/react-tabs/components-api/#tab-panel)
|
||||
*/
|
||||
declare const TabPanel: PolymorphicComponent<TabPanelTypeMap<{}, "div">>;
|
||||
export { TabPanel };
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
const _excluded = ["children", "value", "slotProps", "slots"];
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useSlotProps } from '../utils';
|
||||
import { unstable_composeClasses as composeClasses } from '../composeClasses';
|
||||
import { getTabPanelUtilityClass } from './tabPanelClasses';
|
||||
import { useTabPanel } from '../useTabPanel/useTabPanel';
|
||||
import { useClassNamesOverride } from '../utils/ClassNameConfigurator';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const useUtilityClasses = ownerState => {
|
||||
const {
|
||||
hidden
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', hidden && 'hidden']
|
||||
};
|
||||
return composeClasses(slots, useClassNamesOverride(getTabPanelUtilityClass));
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Tabs](https://mui.com/base-ui/react-tabs/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [TabPanel API](https://mui.com/base-ui/react-tabs/components-api/#tab-panel)
|
||||
*/
|
||||
const TabPanel = /*#__PURE__*/React.forwardRef(function TabPanel(props, forwardedRef) {
|
||||
var _slots$root;
|
||||
const {
|
||||
children,
|
||||
slotProps = {},
|
||||
slots = {}
|
||||
} = props,
|
||||
other = _objectWithoutPropertiesLoose(props, _excluded);
|
||||
const {
|
||||
hidden,
|
||||
getRootProps
|
||||
} = useTabPanel(props);
|
||||
const ownerState = _extends({}, props, {
|
||||
hidden
|
||||
});
|
||||
const classes = useUtilityClasses(ownerState);
|
||||
const TabPanelRoot = (_slots$root = slots.root) != null ? _slots$root : 'div';
|
||||
const tabPanelRootProps = useSlotProps({
|
||||
elementType: TabPanelRoot,
|
||||
getSlotProps: getRootProps,
|
||||
externalSlotProps: slotProps.root,
|
||||
externalForwardedProps: other,
|
||||
additionalProps: {
|
||||
role: 'tabpanel',
|
||||
ref: forwardedRef
|
||||
},
|
||||
ownerState,
|
||||
className: classes.root
|
||||
});
|
||||
return /*#__PURE__*/_jsx(TabPanelRoot, _extends({}, tabPanelRootProps, {
|
||||
children: !hidden && children
|
||||
}));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? TabPanel.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* The props used for each slot inside the TabPanel.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: PropTypes.shape({
|
||||
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
||||
}),
|
||||
/**
|
||||
* The components used for each slot inside the TabPanel.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots: PropTypes.shape({
|
||||
root: PropTypes.elementType
|
||||
}),
|
||||
/**
|
||||
* The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.
|
||||
* If not provided, it will fall back to the index of the panel.
|
||||
* It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
|
||||
*/
|
||||
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
||||
} : void 0;
|
||||
export { TabPanel };
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
import * as React from 'react';
|
||||
import { Simplify } from '@mui/types';
|
||||
import { UseTabPanelRootSlotProps } from '../useTabPanel';
|
||||
import { PolymorphicProps, SlotComponentProps } from '../utils';
|
||||
export interface TabPanelRootSlotPropsOverrides {
|
||||
}
|
||||
export interface TabPanelOwnProps {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
/**
|
||||
* The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.
|
||||
* If not provided, it will fall back to the index of the panel.
|
||||
* It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
|
||||
*/
|
||||
value?: number | string;
|
||||
/**
|
||||
* The components used for each slot inside the TabPanel.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: TabPanelSlots;
|
||||
/**
|
||||
* The props used for each slot inside the TabPanel.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: {
|
||||
root?: SlotComponentProps<'div', TabPanelRootSlotPropsOverrides, TabPanelOwnerState>;
|
||||
};
|
||||
}
|
||||
export interface TabPanelSlots {
|
||||
/**
|
||||
* The component that renders the root.
|
||||
* @default 'div'
|
||||
*/
|
||||
root?: React.ElementType;
|
||||
}
|
||||
export interface TabPanelTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
|
||||
props: TabPanelOwnProps & AdditionalProps;
|
||||
defaultComponent: RootComponentType;
|
||||
}
|
||||
export type TabPanelProps<RootComponentType extends React.ElementType = TabPanelTypeMap['defaultComponent']> = PolymorphicProps<TabPanelTypeMap<{}, RootComponentType>, RootComponentType>;
|
||||
export type TabPanelOwnerState = Simplify<TabPanelOwnProps & {
|
||||
hidden: boolean;
|
||||
}>;
|
||||
export type TabPanelRootSlotProps = UseTabPanelRootSlotProps & {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
ownerState: TabPanelOwnerState;
|
||||
ref: React.Ref<any>;
|
||||
role: React.AriaRole;
|
||||
};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export { TabPanel } from './TabPanel';
|
||||
export * from './TabPanel.types';
|
||||
export * from './tabPanelClasses';
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
'use client';
|
||||
|
||||
export { TabPanel } from './TabPanel';
|
||||
export * from './TabPanel.types';
|
||||
export * from './tabPanelClasses';
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "../node/TabPanel/index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
export interface TabPanelClasses {
|
||||
/** Class name applied to the root element. */
|
||||
root: string;
|
||||
/** State class applied to the root `div` element if `hidden={true}`. */
|
||||
hidden: string;
|
||||
}
|
||||
export type TabPanelClassKey = keyof TabPanelClasses;
|
||||
export declare function getTabPanelUtilityClass(slot: string): string;
|
||||
export declare const tabPanelClasses: TabPanelClasses;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { generateUtilityClass } from '../generateUtilityClass';
|
||||
import { generateUtilityClasses } from '../generateUtilityClasses';
|
||||
const COMPONENT_NAME = 'TabPanel';
|
||||
export function getTabPanelUtilityClass(slot) {
|
||||
return generateUtilityClass(COMPONENT_NAME, slot);
|
||||
}
|
||||
export const tabPanelClasses = generateUtilityClasses(COMPONENT_NAME, ['root', 'hidden']);
|
||||
Reference in new issue
Block a user