mirror of
https://github.com/material-components/material-web.git
synced 2026-01-09 07:21:09 +08:00
feat(textfield): add experimental react wrapper
PiperOrigin-RevId: 599982922
This commit is contained in:
parent
b23e3218ee
commit
043727c5dc
19
textfield/tsx/filled-text-field.ts
Normal file
19
textfield/tsx/filled-text-field.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import {createComponent} from '@lit/react';
|
||||
import {MdFilledTextField} from '../filled-text-field.js';
|
||||
import {events} from './internal/events.js';
|
||||
export type {MdFilledTextField} from '../filled-text-field.js';
|
||||
|
||||
// tslint:disable-next-line
|
||||
export const FilledTextField = createComponent({
|
||||
tagName: 'md-filled-text-field',
|
||||
elementClass: MdFilledTextField,
|
||||
events,
|
||||
react: React,
|
||||
});
|
||||
13
textfield/tsx/internal/events.ts
Normal file
13
textfield/tsx/internal/events.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {EventName} from '@lit/react';
|
||||
|
||||
// tslint:disable-next-line
|
||||
export const events = {
|
||||
onChange: 'change',
|
||||
onInput: 'input' as EventName<InputEvent>,
|
||||
} as const;
|
||||
19
textfield/tsx/outlined-text-field.ts
Normal file
19
textfield/tsx/outlined-text-field.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import {createComponent} from '@lit/react';
|
||||
import {MdOutlinedTextField} from '../outlined-text-field.js';
|
||||
import {events} from './internal/events.js';
|
||||
export type {MdOutlinedTextField} from '../outlined-text-field.js';
|
||||
|
||||
// tslint:disable-next-line
|
||||
export const OutlinedTextField = createComponent({
|
||||
tagName: 'md-outlined-text-field',
|
||||
elementClass: MdOutlinedTextField,
|
||||
events,
|
||||
react: React,
|
||||
});
|
||||
@ -29,6 +29,7 @@
|
||||
"exclude": [
|
||||
"catalog",
|
||||
"**/demo",
|
||||
"**/tsx",
|
||||
"scripts/"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user