Začetni commit projekta rezervacije

This commit is contained in:
Mark Poljanšek committed 2025-04-23 20:19:33 +02:00
commit 328731b32f
56062 files changed
+2485242

No files matched your search

+188
View File
@@ -0,0 +1,188 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { InternalStandardProps as StandardProps, Theme } from "../index.js";
import { InputProps } from "../Input/index.js";
import { MenuProps } from "../Menu/index.js";
import { SelectChangeEvent, SelectInputProps } from "./SelectInput.js";
import { SelectClasses } from "./selectClasses.js";
import { OutlinedInputProps } from "../OutlinedInput/index.js";
import { FilledInputProps } from "../FilledInput/index.js";
export { SelectChangeEvent };
export interface BaseSelectProps<Value = unknown> extends StandardProps<InputProps, 'value' | 'onChange' | 'placeholder'> {
/**
* If `true`, the width of the popover will automatically be set according to the items inside the
* menu, otherwise it will be at least the width of the select input.
* @default false
*/
autoWidth?: boolean;
/**
* The option elements to populate the select with.
* Can be some `MenuItem` when `native` is false and `option` when `native` is true.
*
* ⚠️The `MenuItem` elements **must** be direct descendants when `native` is false.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
* @default {}
*/
classes?: Partial<SelectClasses>;
/**
* If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
* You can only use it when the `native` prop is `false` (default).
* @default false
*/
defaultOpen?: boolean;
/**
* The default value. Use when the component is not controlled.
*/
defaultValue?: Value;
/**
* If `true`, a value is displayed even if no items are selected.
*
* In order to display a meaningful value, a function can be passed to the `renderValue` prop which
* returns the value to be displayed when no items are selected.
*
* ⚠️ When using this prop, make sure the label doesn't overlap with the empty displayed value.
* The label should either be hidden or forced to a shrunk state.
* @default false
*/
displayEmpty?: boolean;
/**
* The icon that displays the arrow.
* @default ArrowDropDownIcon
*/
IconComponent?: React.ElementType;
/**
* The `id` of the wrapper element or the `select` element when `native`.
*/
id?: string;
/**
* An `Input` element; does not have to be a material-ui specific `Input`.
*/
input?: React.ReactElement<unknown, any>;
/**
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
* When `native` is `true`, the attributes are applied on the `select` element.
*/
inputProps?: InputProps['inputProps'];
/**
* See [OutlinedInput#label](https://mui.com/material-ui/api/outlined-input/#props)
*/
label?: React.ReactNode;
/**
* The ID of an element that acts as an additional label. The Select will
* be labelled by the additional label and the selected value.
*/
labelId?: string;
/**
* Props applied to the [`Menu`](https://mui.com/material-ui/api/menu/) element.
*/
MenuProps?: Partial<MenuProps>;
/**
* If `true`, `value` must be an array and the menu will support multiple selections.
* @default false
*/
multiple?: boolean;
/**
* If `true`, the component uses a native `select` element.
* @default false
*/
native?: boolean;
/**
* Callback fired when a menu item is selected.
*
* @param {SelectChangeEvent<Value>} 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, unless the change event is caused by browser autofill.
* @param {object} [child] The react element that was selected when `native` is `false` (default).
*/
onChange?: SelectInputProps<Value>['onChange'];
/**
* Callback fired when the component requests to be closed.
* Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select collapses).
*
* @param {object} event The event source of the callback.
*/
onClose?: (event: React.SyntheticEvent) => void;
/**
* Callback fired when the component requests to be opened.
* Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select expands).
*
* @param {object} event The event source of the callback.
*/
onOpen?: (event: React.SyntheticEvent) => void;
/**
* If `true`, the component is shown.
* You can only use it when the `native` prop is `false` (default).
*/
open?: boolean;
/**
* Render the selected value.
* You can only use it when the `native` prop is `false` (default).
*
* @param {any} value The `value` provided to the component.
* @returns {ReactNode}
*/
renderValue?: (value: Value) => React.ReactNode;
/**
* Props applied to the clickable div element.
*/
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* The `input` value. Providing an empty string will select no options.
* Set to an empty string `''` if you don't want any of the available options to be selected.
*
* If the value is an object it must have reference equality with the option in order to be selected.
* If the value is not an object, the string representation must match with the string representation of the option in order to be selected.
*/
value?: Value | '';
/**
* The variant to use.
* @default 'outlined'
*/
variant?: SelectVariants;
}
export interface FilledSelectProps extends Omit<FilledInputProps, 'value' | 'onChange' | 'id' | 'classes' | 'inputProps' | 'placeholder'> {
/**
* The variant to use.
* @default 'outlined'
*/
variant: 'filled';
}
export interface StandardSelectProps extends Omit<InputProps, 'value' | 'onChange' | 'id' | 'classes' | 'inputProps' | 'placeholder'> {
/**
* The variant to use.
* @default 'outlined'
*/
variant: 'standard';
}
export interface OutlinedSelectProps extends Omit<OutlinedInputProps, 'value' | 'onChange' | 'id' | 'classes' | 'inputProps' | 'placeholder'> {
/**
* The variant to use.
* @default 'outlined'
*/
variant?: 'outlined';
}
export type SelectVariants = 'outlined' | 'standard' | 'filled';
export type SelectProps<Value = unknown> = (FilledSelectProps & BaseSelectProps<Value>) | (StandardSelectProps & BaseSelectProps<Value>) | (OutlinedSelectProps & BaseSelectProps<Value>);
/**
*
* Demos:
*
* - [Select](https://mui.com/material-ui/react-select/)
*
* API:
*
* - [Select API](https://mui.com/material-ui/api/select/)
* - inherits [OutlinedInput API](https://mui.com/material-ui/api/outlined-input/)
*/
declare const Select: (<Value = unknown>(props: SelectProps<Value>) => React.JSX.Element) & {
muiName: string;
};
export default Select;
+47
View File
@@ -0,0 +1,47 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from "../index.js";
import { MenuProps } from "../Menu/index.js";
/**
* The change can be caused by different kind of events.
* The type of event depends on what caused the change.
* For example, when the browser auto-fills the `Select` you'll receive a `React.ChangeEvent`.
*/
export type SelectChangeEvent<Value = string> = (Event & {
target: {
value: Value;
name: string;
};
}) | React.ChangeEvent<HTMLInputElement>;
export interface SelectInputProps<Value = unknown> {
autoFocus?: boolean;
autoWidth: boolean;
defaultOpen?: boolean;
disabled?: boolean;
error?: boolean;
IconComponent?: React.ElementType;
inputRef?: (ref: HTMLSelectElement | {
node: HTMLInputElement;
value: SelectInputProps<Value>['value'];
}) => void;
MenuProps?: Partial<MenuProps>;
multiple: boolean;
name?: string;
native: boolean;
onBlur?: React.FocusEventHandler<any>;
onChange?: (event: SelectChangeEvent<Value>, child: React.ReactNode) => void;
onClose?: (event: React.SyntheticEvent) => void;
onFocus?: React.FocusEventHandler<any>;
onOpen?: (event: React.SyntheticEvent) => void;
open?: boolean;
readOnly?: boolean;
renderValue?: (value: SelectInputProps<Value>['value']) => React.ReactNode;
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
sx?: SxProps<Theme>;
tabIndex?: number;
value?: Value;
variant?: 'standard' | 'outlined' | 'filled';
}
declare const SelectInput: React.JSXElementConstructor<SelectInputProps>;
export default SelectInput;
+4
View File
@@ -0,0 +1,4 @@
export { default } from "./Select.js";
export * from "./Select.js";
export { default as selectClasses } from "./selectClasses.js";
export * from "./selectClasses.js";
+42
View File
@@ -0,0 +1,42 @@
export interface SelectClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the select component `select` class. */
select: string;
/** Styles applied to the select component if `multiple={true}`. */
multiple: string;
/** Styles applied to the select component if `variant="filled"`. */
filled: string;
/** Styles applied to the select component if it is focused. */
focused: string;
/** Styles applied to the select component if `variant="outlined"`. */
outlined: string;
/** Styles applied to the select component if `variant="standard"`. */
standard: string;
/** State class applied to the select component `disabled` class. */
disabled: string;
/** Styles applied to the icon component. */
icon: string;
/** Styles applied to the icon component if the popup is open. */
iconOpen: string;
/** Styles applied to the icon component if `variant="filled"`.
* @deprecated Combine the [.MuiSelect-icon](/material-ui/api/select/#select-classes-icon) and [.MuiSelect-filled](/material-ui/api/select/#select-classes-filled) classes instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
iconFilled: string;
/** Styles applied to the icon component if `variant="outlined"`.
* @deprecated Combine the [.MuiSelect-icon](/material-ui/api/select/#select-classes-icon) and [.MuiSelect-outlined](/material-ui/api/select/#select-classes-outlined) classes instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
iconOutlined: string;
/** Styles applied to the icon component if `variant="standard"`.
* @deprecated Combine the [.MuiSelect-icon](/material-ui/api/select/#select-classes-icon) and [.MuiSelect-standard](/material-ui/api/select/#select-classes-standard) classes instead. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
iconStandard: string;
/** Styles applied to the underlying native input component. */
nativeInput: string;
/** State class applied to the root element if `error={true}`. */
error: string;
}
export type SelectClassKey = keyof SelectClasses;
export declare function getSelectUtilityClasses(slot: string): string;
declare const selectClasses: SelectClasses;
export default selectClasses;