pre-installations and preparations
This commit is contained in:
1 parent
3e5a0329cb
commit
201d621ac3
6977 files changed
+742826
No files matched your search
+126
@@ -0,0 +1,126 @@
|
||||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
||||
import { unstable_composeClasses as composeClasses } from '../composeClasses';
|
||||
import { getTabUtilityClass } from './tabClasses';
|
||||
import { useTab } from '../useTab';
|
||||
import { useSlotProps } from '../utils';
|
||||
import { useClassNamesOverride } from '../utils/ClassNameConfigurator';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
||||
var selected = ownerState.selected,
|
||||
disabled = ownerState.disabled;
|
||||
var slots = {
|
||||
root: ['root', selected && 'selected', disabled && 'disabled']
|
||||
};
|
||||
return composeClasses(slots, useClassNamesOverride(getTabUtilityClass));
|
||||
};
|
||||
/**
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Tabs](https://mui.com/base-ui/react-tabs/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [Tab API](https://mui.com/base-ui/react-tabs/components-api/#tab)
|
||||
*/
|
||||
var Tab = /*#__PURE__*/React.forwardRef(function Tab(props, forwardedRef) {
|
||||
var _slots$root;
|
||||
var action = props.action,
|
||||
children = props.children,
|
||||
_props$disabled = props.disabled,
|
||||
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
||||
onChange = props.onChange,
|
||||
onClick = props.onClick,
|
||||
onFocus = props.onFocus,
|
||||
_props$slotProps = props.slotProps,
|
||||
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
||||
_props$slots = props.slots,
|
||||
slots = _props$slots === void 0 ? {} : _props$slots,
|
||||
value = props.value,
|
||||
other = _objectWithoutProperties(props, ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"]);
|
||||
var tabRef = React.useRef();
|
||||
var handleRef = useForkRef(tabRef, forwardedRef);
|
||||
var _useTab = useTab(_extends({}, props, {
|
||||
rootRef: handleRef,
|
||||
value: value
|
||||
})),
|
||||
active = _useTab.active,
|
||||
highlighted = _useTab.highlighted,
|
||||
selected = _useTab.selected,
|
||||
getRootProps = _useTab.getRootProps;
|
||||
var ownerState = _extends({}, props, {
|
||||
active: active,
|
||||
disabled: disabled,
|
||||
highlighted: highlighted,
|
||||
selected: selected
|
||||
});
|
||||
var classes = useUtilityClasses(ownerState);
|
||||
var TabRoot = (_slots$root = slots.root) != null ? _slots$root : 'button';
|
||||
var tabRootProps = useSlotProps({
|
||||
elementType: TabRoot,
|
||||
getSlotProps: getRootProps,
|
||||
externalSlotProps: slotProps.root,
|
||||
externalForwardedProps: other,
|
||||
additionalProps: {
|
||||
ref: forwardedRef
|
||||
},
|
||||
ownerState: ownerState,
|
||||
className: classes.root
|
||||
});
|
||||
return /*#__PURE__*/_jsx(TabRoot, _extends({}, tabRootProps, {
|
||||
children: children
|
||||
}));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Tab.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* A ref for imperative actions. It currently only supports `focusVisible()` action.
|
||||
*/
|
||||
action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
||||
current: PropTypes.shape({
|
||||
focusVisible: PropTypes.func.isRequired
|
||||
})
|
||||
})]),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
* @default false
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* Callback invoked when new value is being set.
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* The props used for each slot inside the Tab.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: PropTypes.shape({
|
||||
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
||||
}),
|
||||
/**
|
||||
* The components used for each slot inside the Tab.
|
||||
* Either a string to use a HTML element or a component.
|
||||
* @default {}
|
||||
*/
|
||||
slots: PropTypes.shape({
|
||||
root: PropTypes.elementType
|
||||
}),
|
||||
/**
|
||||
* You can provide your own value. Otherwise, it falls back to the child position index.
|
||||
*/
|
||||
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
||||
} : void 0;
|
||||
export { Tab };
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
'use client';
|
||||
|
||||
export { Tab } from './Tab';
|
||||
export * from './Tab.types';
|
||||
export * from './tabClasses';
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { generateUtilityClass } from '../generateUtilityClass';
|
||||
import { generateUtilityClasses } from '../generateUtilityClasses';
|
||||
var COMPONENT_NAME = 'Tab';
|
||||
export function getTabUtilityClass(slot) {
|
||||
return generateUtilityClass(COMPONENT_NAME, slot);
|
||||
}
|
||||
export var tabClasses = generateUtilityClasses(COMPONENT_NAME, ['root', 'selected', 'disabled']);
|
||||
Reference in new issue
Block a user