Added Statistics calculation
Statistics now show calculated values
This commit is contained in:
parent
fe87374e47
commit
fc0f69dacb
2147 changed files with 141321 additions and 39 deletions
23
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.d.ts
generated
vendored
Normal file
23
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import * as React from 'react';
|
||||
import { PickerLayoutOwnerState, PickersLayoutProps } from "./PickersLayout.types.js";
|
||||
import { PickerValidValue } from "../internals/models/index.js";
|
||||
export declare const PickersLayoutRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
||||
ownerState: PickerLayoutOwnerState;
|
||||
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | keyof React.ClassAttributes<HTMLDivElement>>, {}>;
|
||||
export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
||||
ownerState: PickerLayoutOwnerState;
|
||||
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement> | keyof React.ClassAttributes<HTMLDivElement>>, {}>;
|
||||
type PickersLayoutComponent = (<TValue extends PickerValidValue>(props: PickersLayoutProps<TValue> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
||||
propTypes?: any;
|
||||
};
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [Custom layout](https://mui.com/x/react-date-pickers/custom-layout/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
|
||||
*/
|
||||
declare const PickersLayout: PickersLayoutComponent;
|
||||
export { PickersLayout };
|
||||
176
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.js
generated
vendored
Normal file
176
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.js
generated
vendored
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PickersLayoutRoot = exports.PickersLayoutContentWrapper = exports.PickersLayout = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _styles = require("@mui/material/styles");
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _pickersLayoutClasses = require("./pickersLayoutClasses");
|
||||
var _usePickerLayout = _interopRequireDefault(require("./usePickerLayout"));
|
||||
var _usePickerContext = require("../hooks/usePickerContext");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const useUtilityClasses = (classes, ownerState) => {
|
||||
const {
|
||||
pickerOrientation
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', pickerOrientation === 'landscape' && 'landscape'],
|
||||
contentWrapper: ['contentWrapper']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _pickersLayoutClasses.getPickersLayoutUtilityClass, classes);
|
||||
};
|
||||
const PickersLayoutRoot = exports.PickersLayoutRoot = (0, _styles.styled)('div', {
|
||||
name: 'MuiPickersLayout',
|
||||
slot: 'Root'
|
||||
})({
|
||||
display: 'grid',
|
||||
gridAutoColumns: 'max-content auto max-content',
|
||||
gridAutoRows: 'max-content auto max-content',
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.actionBar}`]: {
|
||||
gridColumn: '1 / 4',
|
||||
gridRow: 3
|
||||
},
|
||||
variants: [{
|
||||
props: {
|
||||
pickerOrientation: 'landscape',
|
||||
hasShortcuts: false
|
||||
},
|
||||
style: {
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.toolbar}`]: {
|
||||
gridColumn: 1,
|
||||
gridRow: '1 / 3'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: {
|
||||
pickerOrientation: 'landscape',
|
||||
hasShortcuts: true
|
||||
},
|
||||
style: {
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.toolbar}`]: {
|
||||
gridColumn: '2 / 4',
|
||||
gridRow: 1,
|
||||
maxWidth: 'max-content'
|
||||
},
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.shortcuts}`]: {
|
||||
gridColumn: 1,
|
||||
gridRow: 2
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: {
|
||||
pickerOrientation: 'portrait'
|
||||
},
|
||||
style: {
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.toolbar}`]: {
|
||||
gridColumn: '2 / 4',
|
||||
gridRow: 1
|
||||
},
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.shortcuts}`]: {
|
||||
gridColumn: 1,
|
||||
gridRow: '2 / 3'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
props: {
|
||||
hasShortcuts: true,
|
||||
layoutDirection: 'rtl'
|
||||
},
|
||||
style: {
|
||||
[`& .${_pickersLayoutClasses.pickersLayoutClasses.shortcuts}`]: {
|
||||
gridColumn: 4
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
const PickersLayoutContentWrapper = exports.PickersLayoutContentWrapper = (0, _styles.styled)('div', {
|
||||
name: 'MuiPickersLayout',
|
||||
slot: 'ContentWrapper'
|
||||
})({
|
||||
gridColumn: '2 / 4',
|
||||
gridRow: 2,
|
||||
display: 'flex',
|
||||
flexDirection: 'column'
|
||||
});
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [Custom layout](https://mui.com/x/react-date-pickers/custom-layout/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
|
||||
*/
|
||||
const PickersLayout = exports.PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inProps, ref) {
|
||||
const props = (0, _styles.useThemeProps)({
|
||||
props: inProps,
|
||||
name: 'MuiPickersLayout'
|
||||
});
|
||||
const {
|
||||
toolbar,
|
||||
content,
|
||||
tabs,
|
||||
actionBar,
|
||||
shortcuts,
|
||||
ownerState
|
||||
} = (0, _usePickerLayout.default)(props);
|
||||
const {
|
||||
orientation,
|
||||
variant
|
||||
} = (0, _usePickerContext.usePickerContext)();
|
||||
const {
|
||||
sx,
|
||||
className,
|
||||
classes: classesProp
|
||||
} = props;
|
||||
const classes = useUtilityClasses(classesProp, ownerState);
|
||||
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersLayoutRoot, {
|
||||
ref: ref,
|
||||
sx: sx,
|
||||
className: (0, _clsx.default)(classes.root, className),
|
||||
ownerState: ownerState,
|
||||
children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersLayoutContentWrapper, {
|
||||
className: classes.contentWrapper,
|
||||
ownerState: ownerState,
|
||||
children: variant === 'desktop' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
||||
children: [content, tabs]
|
||||
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
||||
children: [tabs, content]
|
||||
})
|
||||
}), actionBar]
|
||||
});
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") PickersLayout.displayName = "PickersLayout";
|
||||
process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
children: _propTypes.default.node,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: _propTypes.default.object,
|
||||
className: _propTypes.default.string,
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps: _propTypes.default.object,
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots: _propTypes.default.object,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
||||
} : void 0;
|
||||
105
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.types.d.ts
generated
vendored
Normal file
105
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
import * as React from 'react';
|
||||
import { SxProps, Theme } from '@mui/material/styles';
|
||||
import { SlotComponentProps } from '@mui/utils/types';
|
||||
import { PickersActionBar, PickersActionBarProps } from "../PickersActionBar/index.js";
|
||||
import { BaseToolbarProps, ExportedBaseToolbarProps } from "../internals/models/props/toolbar.js";
|
||||
import { ExportedBaseTabsProps } from "../internals/models/props/tabs.js";
|
||||
import { PickersLayoutClasses } from "./pickersLayoutClasses.js";
|
||||
import { PickersShortcutsProps } from "../PickersShortcuts/index.js";
|
||||
import { ExportedPickersShortcutProps, PickersShortcuts } from "../PickersShortcuts/PickersShortcuts.js";
|
||||
import { PickerOwnerState } from "../models/index.js";
|
||||
import { PickerValidValue } from "../internals/models/index.js";
|
||||
export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue> {
|
||||
/**
|
||||
* Custom component for the action bar, it is placed below the Picker views.
|
||||
* @default PickersActionBar
|
||||
*/
|
||||
actionBar?: React.ElementType<PickersActionBarProps>;
|
||||
/**
|
||||
* Custom component for the shortcuts.
|
||||
* @default PickersShortcuts
|
||||
*/
|
||||
shortcuts?: React.JSXElementConstructor<PickersShortcutsProps<TValue>>;
|
||||
/**
|
||||
* Custom component for wrapping the layout.
|
||||
* It wraps the toolbar, views, action bar, and shortcuts.
|
||||
*/
|
||||
layout?: React.JSXElementConstructor<PickersLayoutProps<TValue> & React.RefAttributes<HTMLDivElement>>;
|
||||
}
|
||||
export interface PickerLayoutOwnerState extends PickerOwnerState {
|
||||
/**
|
||||
* The direction of the layout.
|
||||
* Is equal to "ltr" when the layout is in left-to-right direction.
|
||||
* Is equal to "rtl" when the layout is in right-to-left direction.
|
||||
*/
|
||||
layoutDirection: 'ltr' | 'rtl';
|
||||
/**
|
||||
* Whether the layout should display the shortcuts panel or not.
|
||||
* This flag is used to adjust the layout accordingly.
|
||||
*/
|
||||
hasShortcuts: boolean;
|
||||
}
|
||||
export interface ExportedPickersLayoutSlotProps<TValue extends PickerValidValue> {
|
||||
/**
|
||||
* Props passed down to the action bar component.
|
||||
*/
|
||||
actionBar?: SlotComponentProps<typeof PickersActionBar, {}, PickerLayoutOwnerState>;
|
||||
/**
|
||||
* Props passed down to the shortcuts component.
|
||||
*/
|
||||
shortcuts?: SlotComponentProps<typeof PickersShortcuts, {}, PickerLayoutOwnerState>;
|
||||
/**
|
||||
* Props passed down to the layoutRoot component.
|
||||
*/
|
||||
layout?: Partial<PickersLayoutProps<TValue>>;
|
||||
}
|
||||
export interface PickersLayoutSlots<TValue extends PickerValidValue> extends ExportedPickersLayoutSlots<TValue> {
|
||||
/**
|
||||
* Tabs enabling toggling between views.
|
||||
*/
|
||||
tabs?: React.ElementType<{}>;
|
||||
/**
|
||||
* Custom component for the toolbar.
|
||||
* It is placed above the Picker views.
|
||||
*/
|
||||
toolbar?: React.JSXElementConstructor<BaseToolbarProps>;
|
||||
}
|
||||
export interface PickersLayoutSlotProps<TValue extends PickerValidValue> extends ExportedPickersLayoutSlotProps<TValue> {
|
||||
/**
|
||||
* Props passed down to the tabs component.
|
||||
*/
|
||||
tabs?: ExportedBaseTabsProps;
|
||||
/**
|
||||
* Props passed down to the toolbar component.
|
||||
*/
|
||||
toolbar?: ExportedBaseToolbarProps;
|
||||
}
|
||||
export interface PickersLayoutProps<TValue extends PickerValidValue> {
|
||||
className?: string;
|
||||
children?: React.ReactNode;
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx?: SxProps<Theme>;
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes?: Partial<PickersLayoutClasses>;
|
||||
/**
|
||||
* Overridable component slots.
|
||||
* @default {}
|
||||
*/
|
||||
slots?: PickersLayoutSlots<TValue>;
|
||||
/**
|
||||
* The props used for each component slot.
|
||||
* @default {}
|
||||
*/
|
||||
slotProps?: PickersLayoutSlotProps<TValue>;
|
||||
}
|
||||
export interface SubComponents<TValue extends PickerValidValue> {
|
||||
toolbar: React.ReactElement<ExportedBaseToolbarProps> | null;
|
||||
content: React.ReactNode;
|
||||
tabs: React.ReactElement<ExportedBaseTabsProps> | null;
|
||||
actionBar: React.ReactElement<PickersActionBarProps>;
|
||||
shortcuts: React.ReactElement<ExportedPickersShortcutProps<TValue>> | null;
|
||||
}
|
||||
5
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.types.js
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout.types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
5
node_modules/@mui/x-date-pickers/PickersLayout/index.d.ts
generated
vendored
Normal file
5
node_modules/@mui/x-date-pickers/PickersLayout/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export { PickersLayout, PickersLayoutRoot, PickersLayoutContentWrapper } from "./PickersLayout.js";
|
||||
export type { PickersLayoutProps, PickersLayoutSlots, PickersLayoutSlotProps, ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, PickerLayoutOwnerState } from "./PickersLayout.types.js";
|
||||
export { default as usePickerLayout } from "./usePickerLayout.js";
|
||||
export { pickersLayoutClasses } from "./pickersLayoutClasses.js";
|
||||
export type { PickersLayoutClassKey } from "./pickersLayoutClasses.js";
|
||||
39
node_modules/@mui/x-date-pickers/PickersLayout/index.js
generated
vendored
Normal file
39
node_modules/@mui/x-date-pickers/PickersLayout/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "PickersLayout", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _PickersLayout.PickersLayout;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PickersLayoutContentWrapper", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _PickersLayout.PickersLayoutContentWrapper;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PickersLayoutRoot", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _PickersLayout.PickersLayoutRoot;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "pickersLayoutClasses", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _pickersLayoutClasses.pickersLayoutClasses;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "usePickerLayout", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _usePickerLayout.default;
|
||||
}
|
||||
});
|
||||
var _PickersLayout = require("./PickersLayout");
|
||||
var _usePickerLayout = _interopRequireDefault(require("./usePickerLayout"));
|
||||
var _pickersLayoutClasses = require("./pickersLayoutClasses");
|
||||
19
node_modules/@mui/x-date-pickers/PickersLayout/pickersLayoutClasses.d.ts
generated
vendored
Normal file
19
node_modules/@mui/x-date-pickers/PickersLayout/pickersLayoutClasses.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export interface PickersLayoutClasses {
|
||||
/** Styles applied to the root element. */
|
||||
root: string;
|
||||
/** Styles applied to the root element in landscape orientation. */
|
||||
landscape: string;
|
||||
/** Styles applied to the contentWrapper element (which contains the tabs and the view itself). */
|
||||
contentWrapper: string;
|
||||
/** Styles applied to the toolbar. */
|
||||
toolbar: string;
|
||||
/** Styles applied to the action bar. */
|
||||
actionBar: string;
|
||||
/** Styles applied to the tabs. */
|
||||
tabs: string;
|
||||
/** Styles applied to the shortcuts container. */
|
||||
shortcuts: string;
|
||||
}
|
||||
export type PickersLayoutClassKey = keyof PickersLayoutClasses;
|
||||
export declare function getPickersLayoutUtilityClass(slot: string): string;
|
||||
export declare const pickersLayoutClasses: Record<keyof PickersLayoutClasses, string>;
|
||||
14
node_modules/@mui/x-date-pickers/PickersLayout/pickersLayoutClasses.js
generated
vendored
Normal file
14
node_modules/@mui/x-date-pickers/PickersLayout/pickersLayoutClasses.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPickersLayoutUtilityClass = getPickersLayoutUtilityClass;
|
||||
exports.pickersLayoutClasses = void 0;
|
||||
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
||||
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
||||
function getPickersLayoutUtilityClass(slot) {
|
||||
return (0, _generateUtilityClass.default)('MuiPickersLayout', slot);
|
||||
}
|
||||
const pickersLayoutClasses = exports.pickersLayoutClasses = (0, _generateUtilityClasses.default)('MuiPickersLayout', ['root', 'landscape', 'contentWrapper', 'toolbar', 'actionBar', 'tabs', 'shortcuts']);
|
||||
7
node_modules/@mui/x-date-pickers/PickersLayout/usePickerLayout.d.ts
generated
vendored
Normal file
7
node_modules/@mui/x-date-pickers/PickersLayout/usePickerLayout.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { PickerLayoutOwnerState, PickersLayoutProps, SubComponents } from "./PickersLayout.types.js";
|
||||
import { PickerValidValue } from "../internals/models/index.js";
|
||||
interface UsePickerLayoutResponse<TValue extends PickerValidValue> extends SubComponents<TValue> {
|
||||
ownerState: PickerLayoutOwnerState;
|
||||
}
|
||||
declare const usePickerLayout: <TValue extends PickerValidValue>(props: PickersLayoutProps<TValue>) => UsePickerLayoutResponse<TValue>;
|
||||
export default usePickerLayout;
|
||||
116
node_modules/@mui/x-date-pickers/PickersLayout/usePickerLayout.js
generated
vendored
Normal file
116
node_modules/@mui/x-date-pickers/PickersLayout/usePickerLayout.js
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
"use strict";
|
||||
'use client';
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
||||
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
||||
var _RtlProvider = require("@mui/system/RtlProvider");
|
||||
var _PickersActionBar = require("../PickersActionBar");
|
||||
var _pickersLayoutClasses = require("./pickersLayoutClasses");
|
||||
var _PickersShortcuts = require("../PickersShortcuts");
|
||||
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
||||
var _hooks = require("../hooks");
|
||||
var _jsxRuntime = require("react/jsx-runtime");
|
||||
const _excluded = ["ownerState"];
|
||||
function toolbarHasView(toolbarProps) {
|
||||
return toolbarProps.view !== null;
|
||||
}
|
||||
const useUtilityClasses = (classes, ownerState) => {
|
||||
const {
|
||||
pickerOrientation
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', pickerOrientation === 'landscape' && 'landscape'],
|
||||
contentWrapper: ['contentWrapper'],
|
||||
toolbar: ['toolbar'],
|
||||
actionBar: ['actionBar'],
|
||||
tabs: ['tabs'],
|
||||
landscape: ['landscape'],
|
||||
shortcuts: ['shortcuts']
|
||||
};
|
||||
return (0, _composeClasses.default)(slots, _pickersLayoutClasses.getPickersLayoutUtilityClass, classes);
|
||||
};
|
||||
const usePickerLayout = props => {
|
||||
const {
|
||||
ownerState: pickerOwnerState,
|
||||
defaultActionBarActions
|
||||
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
||||
const {
|
||||
view
|
||||
} = (0, _hooks.usePickerContext)();
|
||||
const isRtl = (0, _RtlProvider.useRtl)();
|
||||
const {
|
||||
children,
|
||||
slots,
|
||||
slotProps,
|
||||
classes: classesProp
|
||||
} = props;
|
||||
const ownerState = React.useMemo(() => (0, _extends2.default)({}, pickerOwnerState, {
|
||||
layoutDirection: isRtl ? 'rtl' : 'ltr',
|
||||
hasShortcuts: false
|
||||
}), [pickerOwnerState, isRtl]);
|
||||
const classes = useUtilityClasses(classesProp, ownerState);
|
||||
|
||||
// Action bar
|
||||
const ActionBar = slots?.actionBar ?? _PickersActionBar.PickersActionBar;
|
||||
const _useSlotProps = (0, _useSlotProps2.default)({
|
||||
elementType: ActionBar,
|
||||
externalSlotProps: slotProps?.actionBar,
|
||||
additionalProps: {
|
||||
actions: defaultActionBarActions
|
||||
},
|
||||
className: classes.actionBar,
|
||||
ownerState
|
||||
}),
|
||||
actionBarProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded);
|
||||
const actionBar = /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionBar, (0, _extends2.default)({}, actionBarProps));
|
||||
|
||||
// Toolbar
|
||||
const Toolbar = slots?.toolbar;
|
||||
const toolbarProps = (0, _useSlotProps2.default)({
|
||||
elementType: Toolbar,
|
||||
externalSlotProps: slotProps?.toolbar,
|
||||
className: classes.toolbar,
|
||||
ownerState
|
||||
});
|
||||
const toolbar = toolbarHasView(toolbarProps) && !!Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, toolbarProps)) : null;
|
||||
|
||||
// Content
|
||||
const content = children;
|
||||
|
||||
// Tabs
|
||||
const Tabs = slots?.tabs;
|
||||
const tabs = view && Tabs ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs, (0, _extends2.default)({
|
||||
className: classes.tabs
|
||||
}, slotProps?.tabs)) : null;
|
||||
|
||||
// Shortcuts
|
||||
const Shortcuts = slots?.shortcuts ?? _PickersShortcuts.PickersShortcuts;
|
||||
const shortcutsProps = (0, _useSlotProps2.default)({
|
||||
elementType: Shortcuts,
|
||||
externalSlotProps: slotProps?.shortcuts,
|
||||
className: classes.shortcuts,
|
||||
ownerState
|
||||
});
|
||||
const hasShortcuts = Array.isArray(shortcutsProps?.items) && shortcutsProps.items.length > 0;
|
||||
const shortcuts = view && !!Shortcuts ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Shortcuts, (0, _extends2.default)({}, shortcutsProps)) : null;
|
||||
return {
|
||||
toolbar,
|
||||
content,
|
||||
tabs,
|
||||
actionBar,
|
||||
shortcuts,
|
||||
ownerState: (0, _extends2.default)({}, ownerState, {
|
||||
hasShortcuts
|
||||
})
|
||||
};
|
||||
};
|
||||
var _default = exports.default = usePickerLayout;
|
||||
Loading…
Add table
Add a link
Reference in a new issue