pre-installations and preparations

This commit is contained in:
MuhammadKhalilzadeh committed 2024-05-05 11:21:00 +03:30
1 parent 3e5a0329cb
commit 201d621ac3
6977 files changed
+742826

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import * as React from 'react';
import { MenuButtonProps } from './MenuButton.types';
/**
*
* Demos:
*
* - [Menu](https://mui.com/base-ui/react-menu/)
*
* API:
*
* - [MenuButton API](https://mui.com/base-ui/react-menu/components-api/#menu-button)
*/
declare const MenuButton: React.ForwardRefExoticComponent<MenuButtonProps & React.RefAttributes<HTMLElement>>;
export { MenuButton };
+121
View File
@@ -0,0 +1,121 @@
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["children", "disabled", "label", "slots", "slotProps", "focusableWhenDisabled"];
import * as React from 'react';
import PropTypes from 'prop-types';
import { useSlotProps } from '../utils';
import { useMenuButton } from '../useMenuButton';
import { unstable_composeClasses as composeClasses } from '../composeClasses';
import { useClassNamesOverride } from '../utils/ClassNameConfigurator';
import { getMenuButtonUtilityClass } from './menuButtonClasses';
import { jsx as _jsx } from "react/jsx-runtime";
const useUtilityClasses = ownerState => {
const {
active,
disabled,
open
} = ownerState;
const slots = {
root: ['root', disabled && 'disabled', active && 'active', open && 'expanded']
};
return composeClasses(slots, useClassNamesOverride(getMenuButtonUtilityClass));
};
/**
*
* Demos:
*
* - [Menu](https://mui.com/base-ui/react-menu/)
*
* API:
*
* - [MenuButton API](https://mui.com/base-ui/react-menu/components-api/#menu-button)
*/
const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(props, forwardedRef) {
const {
children,
disabled = false,
slots = {},
slotProps = {},
focusableWhenDisabled = false
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
getRootProps,
open,
active
} = useMenuButton({
disabled,
focusableWhenDisabled,
rootRef: forwardedRef
});
const ownerState = _extends({}, props, {
open,
active,
disabled,
focusableWhenDisabled
});
const classes = useUtilityClasses(ownerState);
const Root = slots.root || 'button';
const rootProps = useSlotProps({
elementType: Root,
getSlotProps: getRootProps,
externalForwardedProps: other,
externalSlotProps: slotProps.root,
additionalProps: {
ref: forwardedRef,
type: 'button'
},
ownerState,
className: classes.root
});
return /*#__PURE__*/_jsx(Root, _extends({}, rootProps, {
children: children
}));
});
process.env.NODE_ENV !== "production" ? MenuButton.propTypes /* remove-proptypes */ = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* @ignore
*/
children: PropTypes.node,
/**
* Class name applied to the root element.
*/
className: PropTypes.string,
/**
* If `true`, the component is disabled.
* @default false
*/
disabled: PropTypes.bool,
/**
* If `true`, allows a disabled button to receive focus.
* @default false
*/
focusableWhenDisabled: PropTypes.bool,
/**
* Label of the button
*/
label: PropTypes.string,
/**
* The components used for each slot inside the MenuButton.
* Either a string to use a HTML element or a component.
* @default {}
*/
slotProps: PropTypes.shape({
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
}),
/**
* The props used for each slot inside the MenuButton.
* @default {}
*/
slots: PropTypes.shape({
root: PropTypes.elementType
})
} : void 0;
export { MenuButton };
+50
View File
@@ -0,0 +1,50 @@
/// <reference types="react" />
import { SlotComponentProps } from '../utils/types';
export interface MenuButtonRootSlotPropsOverrides {
}
export interface MenuButtonProps {
children?: React.ReactNode;
/**
* Class name applied to the root element.
*/
className?: string;
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean;
/**
* If `true`, allows a disabled button to receive focus.
* @default false
*/
focusableWhenDisabled?: boolean;
/**
* Label of the button
*/
label?: string;
/**
* The props used for each slot inside the MenuButton.
* @default {}
*/
slots?: MenuButtonSlots;
/**
* The components used for each slot inside the MenuButton.
* Either a string to use a HTML element or a component.
* @default {}
*/
slotProps?: {
root?: SlotComponentProps<'button', MenuButtonRootSlotPropsOverrides, MenuButtonOwnerState>;
};
}
export interface MenuButtonSlots {
/**
* The component that renders the root.
* @default 'button'
*/
root?: React.ElementType;
}
export type MenuButtonOwnerState = MenuButtonProps & {
active: boolean;
focusableWhenDisabled: boolean;
open: boolean;
};
+1
View File
@@ -0,0 +1 @@
export {};
+3
View File
@@ -0,0 +1,3 @@
export { MenuButton } from './MenuButton';
export * from './MenuButton.types';
export * from './menuButtonClasses';
+5
View File
@@ -0,0 +1,5 @@
'use client';
export { MenuButton } from './MenuButton';
export * from './MenuButton.types';
export * from './menuButtonClasses';
+13
View File
@@ -0,0 +1,13 @@
export interface MenuButtonClasses {
/** Class name applied to the root element. */
root: string;
/** State class applied to the root element if `active={true}`. */
active: string;
/** State class applied to the root element if `disabled={true}`. */
disabled: string;
/** State class applied to the root element if the associated menu is open. */
expanded: string;
}
export type MenuButtonClassKey = keyof MenuButtonClasses;
export declare function getMenuButtonUtilityClass(slot: string): string;
export declare const menuButtonClasses: MenuButtonClasses;
+7
View File
@@ -0,0 +1,7 @@
import { generateUtilityClass } from '../generateUtilityClass';
import { generateUtilityClasses } from '../generateUtilityClasses';
const COMPONENT_NAME = 'MenuButton';
export function getMenuButtonUtilityClass(slot) {
return generateUtilityClass(COMPONENT_NAME, slot);
}
export const menuButtonClasses = generateUtilityClasses(COMPONENT_NAME, ['root', 'active', 'disabled', 'expanded']);
+6
View File
@@ -0,0 +1,6 @@
{
"sideEffects": false,
"module": "./index.js",
"main": "../node/MenuButton/index.js",
"types": "./index.d.ts"
}