Blame view

天文台pc/tianwentai-ui/node_modules/@mui/material/internal/SwitchBase.d.ts 3.8 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  import * as React from 'react';
  import { InternalStandardProps as StandardProps } from "./index.js";
  import { ButtonBaseProps } from "../ButtonBase/index.js";
  import { SwitchBaseClasses } from "./switchBaseClasses.js";
  import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
  interface SwitchBaseSlots {
    /**
     * The component that renders the root slot.
     * @default ButtonBase
     */
    root: React.ElementType;
    /**
     * The component that renders the input slot.
     * @default 'input'
     */
    input: React.ElementType;
  }
  type SwitchBaseSlotsAndSlotProps = CreateSlotsAndSlotProps<SwitchBaseSlots, {
    /**
     * Props forwarded to the root slot.
     * By default, the available props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component.
     */
    root: SlotProps<React.ElementType<ButtonBaseProps>, {}, SwitchBaseOwnerState>;
    /**
     * Props forwarded to the input slot.
     */
    input: SlotProps<'input', {}, SwitchBaseOwnerState>;
  }>;
  export interface SwitchBaseProps extends StandardProps<ButtonBaseProps, 'children' | 'onChange' | 'type' | 'value'>, SwitchBaseSlotsAndSlotProps {
    autoFocus?: boolean;
    /**
     * If `true`, the component is checked.
     */
    checked?: boolean;
    checkedIcon: React.ReactNode;
    /**
     * Override or extend the styles applied to the component.
     */
    classes?: Partial<SwitchBaseClasses>;
    /**
     * The default checked state. Use when the component is not controlled.
     */
    defaultChecked?: boolean;
    /**
     * If `true`, the component is disabled.
     */
    disabled?: boolean;
    /**
     * If `true`, the ripple effect is disabled.
     * @default false
     */
    disableRipple?: boolean;
    /**
     * If `true`, the  keyboard focus ripple is disabled.
     * @default false
     */
    disableFocusRipple?: boolean;
    /**
     * If given, uses a negative margin to counteract the padding on one
     * side (this is often helpful for aligning the left or right
     * side of the icon with content above or below, without ruining the border
     * size and shape).
     * @default false
     */
    edge?: 'start' | 'end' | false;
    icon: React.ReactNode;
    /**
     * The id of the `input` element.
     */
    id?: string;
    /**
     * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
     * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
     */
    inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
    /**
     * Pass a ref to the `input` element.
     * @deprecated Use `slotProps.input.ref` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
     */
    inputRef?: React.Ref<any>;
    /**
     * Name attribute of the `input` element.
     */
    name?: string;
    /**
     * Callback fired when the state is changed.
     *
     * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
     * You can pull out the new value by accessing `event.target.value` (string).
     * You can pull out the new checked state by accessing `event.target.checked` (boolean).
     */
    onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
    readOnly?: boolean;
    /**
     * If `true`, the `input` element is required.
     * @default false
     */
    required?: boolean;
    tabIndex?: number;
    type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
    /**
     * The value of the component. The DOM API casts this to a string.
     */
    value?: unknown;
  }
  export interface SwitchBaseOwnerState extends Omit<SwitchBaseProps, 'slots' | 'slotProps'> {}
  declare const SwitchBase: React.JSXElementConstructor<SwitchBaseProps>;
  export default SwitchBase;