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

+324
View File
@@ -0,0 +1,324 @@
import * as React from 'react';
import { SlotComponentProps } from '@mui/base';
import { Mark } from '@mui/base/useSlider';
import { SxProps } from '@mui/system';
import { OverridableStringUnion } from '@mui/types';
import { Theme } from '../styles';
import { OverrideProps, OverridableComponent } from '../OverridableComponent';
import SliderValueLabelComponent from './SliderValueLabel';
import { SliderClasses } from './sliderClasses';
export interface SliderPropsColorOverrides {}
export interface SliderPropsSizeOverrides {}
export interface SliderComponentsPropsOverrides {}
export interface SliderOwnerState extends SliderProps {
dragging: boolean;
marked: boolean;
focusedThumbIndex: number;
}
export interface SliderOwnProps {
/**
* The label of the slider.
*/
'aria-label'?: string;
/**
* The id of the element containing a label for the slider.
*/
'aria-labelledby'?: string;
/**
* A string value that provides a user-friendly name for the current value of the slider.
*/
'aria-valuetext'?: string;
/**
* The color of the component.
* It supports both default and custom theme colors, which can be added as shown in the
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
* @default 'primary'
*/
color?: OverridableStringUnion<
'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
SliderPropsColorOverrides
>;
/**
* The components used for each slot inside.
*
* @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
*
* @default {}
*/
components?: {
Root?: React.ElementType;
Track?: React.ElementType;
Rail?: React.ElementType;
Thumb?: React.ElementType;
Mark?: React.ElementType;
MarkLabel?: React.ElementType;
ValueLabel?: React.ElementType;
Input?: React.ElementType;
};
/**
* The extra props for the slot components.
* You can override the existing props or add new ones.
*
* @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
*
* @default {}
*/
componentsProps?: {
root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
valueLabel?: SlotComponentProps<
typeof SliderValueLabelComponent,
SliderComponentsPropsOverrides,
SliderOwnerState
>;
input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
};
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<SliderClasses>;
/**
* @ignore
*/
className?: string;
/**
* The default value. Use when the component is not controlled.
*/
defaultValue?: number | number[];
/**
* If `true`, the component is disabled.
* @default false
*/
disabled?: boolean;
/**
* If `true`, the active thumb doesn't swap when moving pointer over a thumb while dragging another thumb.
* @default false
*/
disableSwap?: boolean;
/**
* Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider.
* This is important for screen reader users.
* @param {number} index The thumb label's index to format.
* @returns {string}
*/
getAriaLabel?: (index: number) => string;
/**
* Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider.
* This is important for screen reader users.
* @param {number} value The thumb label's value to format.
* @param {number} index The thumb label's index to format.
* @returns {string}
*/
getAriaValueText?: (value: number, index: number) => string;
/**
* Marks indicate predetermined values to which the user can move the slider.
* If `true` the marks are spaced according the value of the `step` prop.
* If an array, it should contain objects with `value` and an optional `label` keys.
* @default false
*/
marks?: boolean | Mark[];
/**
* The maximum allowed value of the slider.
* Should not be equal to min.
* @default 100
*/
max?: number;
/**
* The minimum allowed value of the slider.
* Should not be equal to max.
* @default 0
*/
min?: number;
/**
* Name attribute of the hidden `input` element.
*/
name?: string;
/**
* Callback function that is fired when the slider's value changed.
*
* @param {Event} event The event source of the callback.
* You can pull out the new value by accessing `event.target.value` (any).
* **Warning**: This is a generic event not a change event.
* @param {number | number[]} value The new value.
* @param {number} activeThumb Index of the currently moved thumb.
*/
onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
/**
* Callback function that is fired when the `mouseup` is triggered.
*
* @param {React.SyntheticEvent | Event} event The event source of the callback. **Warning**: This is a generic event not a change event.
* @param {number | number[]} value The new value.
*/
onChangeCommitted?: (event: React.SyntheticEvent | Event, value: number | number[]) => void;
/**
* The component orientation.
* @default 'horizontal'
*/
orientation?: 'horizontal' | 'vertical';
/**
* A transformation function, to change the scale of the slider.
* @param {any} x
* @returns {any}
* @default function Identity(x) {
* return x;
* }
*/
scale?: (value: number) => number;
/**
* The granularity with which the slider can step through values when using Page Up/Page Down or Shift + Arrow Up/Arrow Down.
* @default 10
*/
shiftStep?: number;
/**
* The size of the slider.
* @default 'medium'
*/
size?: OverridableStringUnion<'small' | 'medium', SliderPropsSizeOverrides>;
/**
* The props used for each slot inside the Slider.
* @default {}
*/
slotProps?: {
root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
valueLabel?: SlotComponentProps<
typeof SliderValueLabelComponent,
SliderComponentsPropsOverrides,
SliderOwnerState
>;
input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
};
/**
* The components used for each slot inside the Slider.
* Either a string to use a HTML element or a component.
* @default {}
*/
slots?: {
root?: React.ElementType;
track?: React.ElementType;
rail?: React.ElementType;
thumb?: React.ElementType;
mark?: React.ElementType;
markLabel?: React.ElementType;
valueLabel?: React.ElementType;
input?: React.ElementType;
};
/**
* The granularity with which the slider can step through values. (A "discrete" slider.)
* The `min` prop serves as the origin for the valid values.
* We recommend (max - min) to be evenly divisible by the step.
*
* When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop.
* @default 1
*/
step?: number | null;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* Tab index attribute of the hidden `input` element.
*/
tabIndex?: number;
/**
* The track presentation:
*
* - `normal` the track will render a bar representing the slider value.
* - `inverted` the track will render a bar representing the remaining slider value.
* - `false` the track will render without a bar.
* @default 'normal'
*/
track?: 'normal' | false | 'inverted';
/**
* The value of the slider.
* For ranged sliders, provide an array with two values.
*/
value?: number | number[];
/**
* Controls when the value label is displayed:
*
* - `auto` the value label will display when the thumb is hovered or focused.
* - `on` will display persistently.
* - `off` will never display.
* @default 'off'
*/
valueLabelDisplay?: 'on' | 'auto' | 'off';
/**
* The format function the value label's value.
*
* When a function is provided, it should have the following signature:
*
* - {number} value The value label's value to format
* - {number} index The value label's index to format
* @param {any} x
* @returns {any}
* @default function Identity(x) {
* return x;
* }
*/
valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode);
}
export interface SliderTypeMap<
RootComponent extends React.ElementType = 'span',
AdditionalProps = {},
> {
props: AdditionalProps & SliderOwnProps;
defaultComponent: RootComponent;
}
export interface SliderValueLabelProps extends React.HTMLAttributes<HTMLSpanElement> {
children: React.ReactElement;
index: number;
open: boolean;
value: number;
}
type SliderRootProps = NonNullable<SliderTypeMap['props']['componentsProps']>['root'];
type SliderMarkProps = NonNullable<SliderTypeMap['props']['componentsProps']>['mark'];
type SliderMarkLabelProps = NonNullable<SliderTypeMap['props']['componentsProps']>['markLabel'];
type SliderRailProps = NonNullable<SliderTypeMap['props']['componentsProps']>['rail'];
type SliderTrackProps = NonNullable<SliderTypeMap['props']['componentsProps']>['track'];
type SliderThumbProps = NonNullable<SliderTypeMap['props']['componentsProps']>['thumb'];
export declare const SliderRoot: React.FC<SliderRootProps>;
export declare const SliderMark: React.FC<SliderMarkProps>;
export declare const SliderMarkLabel: React.FC<SliderMarkLabelProps>;
export declare const SliderRail: React.FC<SliderRailProps>;
export declare const SliderTrack: React.FC<SliderTrackProps>;
export declare const SliderThumb: React.FC<SliderThumbProps>;
export declare const SliderValueLabel: React.FC<SliderValueLabelProps>;
/**
*
* Demos:
*
* - [Slider](https://mui.com/material-ui/react-slider/)
*
* API:
*
* - [Slider API](https://mui.com/material-ui/api/slider/)
*/
declare const Slider: OverridableComponent<SliderTypeMap>;
export type SliderProps<
RootComponent extends React.ElementType = SliderTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<SliderTypeMap<RootComponent, AdditionalProps>, RootComponent> & {
component?: React.ElementType;
};
export default Slider;
+1042
View File
File diff suppressed because it is too large. Load diff
+10
View File
@@ -0,0 +1,10 @@
import * as React from 'react';
import { SliderValueLabelProps } from './SliderValueLabel.types';
/**
* @ignore - internal component.
*/
declare function SliderValueLabel(props: SliderValueLabelProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
declare namespace SliderValueLabel {
var propTypes: any;
}
export default SliderValueLabel;
+54
View File
@@ -0,0 +1,54 @@
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import sliderClasses from './sliderClasses';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const useValueLabelClasses = props => {
const {
open
} = props;
const utilityClasses = {
offset: clsx(open && sliderClasses.valueLabelOpen),
circle: sliderClasses.valueLabelCircle,
label: sliderClasses.valueLabelLabel
};
return utilityClasses;
};
/**
* @ignore - internal component.
*/
export default function SliderValueLabel(props) {
const {
children,
className,
value
} = props;
const classes = useValueLabelClasses(props);
if (!children) {
return null;
}
return /*#__PURE__*/React.cloneElement(children, {
className: clsx(children.props.className)
}, /*#__PURE__*/_jsxs(React.Fragment, {
children: [children.props.children, /*#__PURE__*/_jsx("span", {
className: clsx(classes.offset, className),
"aria-hidden": true,
children: /*#__PURE__*/_jsx("span", {
className: classes.circle,
children: /*#__PURE__*/_jsx("span", {
className: classes.label,
children: value
})
})
})]
}));
}
process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes = {
children: PropTypes.element.isRequired,
className: PropTypes.string,
value: PropTypes.node
} : void 0;
+24
View File
@@ -0,0 +1,24 @@
/// <reference types="react" />
export interface SliderValueLabelProps {
children?: React.ReactElement;
className?: string;
style?: React.CSSProperties;
/**
* If `true`, the value label is visible.
*/
open: boolean;
/**
* The value of the slider.
* For ranged sliders, provide an array with two values.
*/
value: number;
/**
* Controls when the value label is displayed:
*
* - `auto` the value label will display when the thumb is hovered or focused.
* - `on` will display persistently.
* - `off` will never display.
* @default 'off'
*/
valueLabelDisplay?: 'on' | 'auto' | 'off';
}
+1
View File
@@ -0,0 +1 @@
export {};
+5
View File
@@ -0,0 +1,5 @@
export { default } from './Slider';
export * from './Slider';
export { default as sliderClasses } from './sliderClasses';
export * from './sliderClasses';
+6
View File
@@ -0,0 +1,6 @@
'use client';
export { default } from './Slider';
export * from './Slider';
export { default as sliderClasses } from './sliderClasses';
export * from './sliderClasses';
+6
View File
@@ -0,0 +1,6 @@
{
"sideEffects": false,
"module": "./index.js",
"main": "../node/Slider/index.js",
"types": "./index.d.ts"
}
+74
View File
@@ -0,0 +1,74 @@
export interface SliderClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the root element if `color="primary"`. */
colorPrimary: string;
/** Styles applied to the root element if `color="secondary"`. */
colorSecondary: string;
/** Styles applied to the root element if `color="error"`. */
colorError: string;
/** Styles applied to the root element if `color="info"`. */
colorInfo: string;
/** Styles applied to the root element if `color="success"`. */
colorSuccess: string;
/** Styles applied to the root element if `color="warning"`. */
colorWarning: string;
/** Styles applied to the root element if `marks` is provided with at least one label. */
marked: string;
/** Styles applied to the root element if `orientation="vertical"`. */
vertical: string;
/** State class applied to the root and thumb element if `disabled={true}`. */
disabled: string;
/** State class applied to the root if a thumb is being dragged. */
dragging: string;
/** Styles applied to the rail element. */
rail: string;
/** Styles applied to the track element. */
track: string;
/** Styles applied to the root element if `track={false}`. */
trackFalse: string;
/** Styles applied to the root element if `track="inverted"`. */
trackInverted: string;
/** Styles applied to the thumb element. */
thumb: string;
/** State class applied to the thumb element if it's active. */
active: string;
/** State class applied to the thumb element if keyboard focused. */
focusVisible: string;
/** Styles applied to the mark element. */
mark: string;
/** Styles applied to the mark element if active (depending on the value). */
markActive: string;
/** Styles applied to the mark label element. */
markLabel: string;
/** Styles applied to the mark label element if active (depending on the value). */
markLabelActive: string;
/** Styles applied to the root element if `size="small"`. */
sizeSmall: string;
/** Styles applied to the thumb element if `color="primary"`. */
thumbColorPrimary: string;
/** Styles applied to the thumb element if `color="secondary"`. */
thumbColorSecondary: string;
/** Styles applied to the thumb element if `color="error"`. */
thumbColorError: string;
/** Styles applied to the thumb element if `color="info"`. */
thumbColorInfo: string;
/** Styles applied to the thumb element if `color="success"`. */
thumbColorSuccess: string;
/** Styles applied to the thumb element if `color="warning"`. */
thumbColorWarning: string;
/** Styles applied to the thumb element if `size="small"`. */
thumbSizeSmall: string;
/** Styles applied to the thumb label element. */
valueLabel: string;
/** Styles applied to the thumb label element if it's open. */
valueLabelOpen: string;
/** Styles applied to the thumb label's circle element. */
valueLabelCircle: string;
/** Styles applied to the thumb label's label element. */
valueLabelLabel: string;
}
export type SliderClassKey = keyof SliderClasses;
export declare function getSliderUtilityClass(slot: string): string;
declare const sliderClasses: SliderClasses;
export default sliderClasses;
+7
View File
@@ -0,0 +1,7 @@
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
import generateUtilityClass from '@mui/utils/generateUtilityClass';
export function getSliderUtilityClass(slot) {
return generateUtilityClass('MuiSlider', slot);
}
const sliderClasses = generateUtilityClasses('MuiSlider', ['root', 'active', 'colorPrimary', 'colorSecondary', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning', 'disabled', 'dragging', 'focusVisible', 'mark', 'markActive', 'marked', 'markLabel', 'markLabelActive', 'rail', 'sizeSmall', 'thumb', 'thumbColorPrimary', 'thumbColorSecondary', 'thumbColorError', 'thumbColorSuccess', 'thumbColorInfo', 'thumbColorWarning', 'track', 'trackInverted', 'trackFalse', 'thumbSizeSmall', 'valueLabel', 'valueLabelOpen', 'valueLabelCircle', 'valueLabelLabel', 'vertical']);
export default sliderClasses;