Skip to content

Commit

Permalink
feat(textfield): add experimental react wrapper
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 599982922
  • Loading branch information
Elliott Marquez authored and copybara-github committed Feb 15, 2024
1 parent b23e321 commit e50979b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
19 changes: 19 additions & 0 deletions textfield/tsx/filled-text-field.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions textfield/tsx/internal/events.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions textfield/tsx/outlined-text-field.ts
Original file line number Diff line number Diff line change
@@ -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,
});
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"exclude": [
"catalog",
"**/demo",
"**/tsx",
"scripts/"
]
}

0 comments on commit e50979b

Please sign in to comment.