Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React wrappers remove ref #50

Merged
merged 3 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/react-wrappers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.1.1

- Removed duplicate `ref` prop in wrapper

## 1.1.0

- Changed attribute binding to add attributes before rendering
Expand Down
2 changes: 1 addition & 1 deletion packages/react-wrappers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-element-react-wrappers",
"version": "1.1.0",
"version": "1.1.1",
"description": "A tool for generating react-compatible wrappers for custom elements",
"main": "index.js",
"module": "index.js",
Expand Down
19 changes: 15 additions & 4 deletions packages/react-wrappers/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,38 @@ export const baseProperties: MappedAttribute[] = [
{
name: "key",
propName: "key",
description: "Used to help React identify which items have changed, are added, or are removed within a list.",
description:
"Used to help React identify which items have changed, are added, or are removed within a list.",
type: {
text: "number | string",
},
},
{
{
name: "children",
propName: "children",
description: "Content between the opening and closing component tags.",
type: {
text: "any",
},
},
{
{
name: "ref",
propName: "ref",
description: "A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component.",
description:
"A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component.",
type: {
text: "any",
},
},
{
name: "tabindex",
propName: "tabIndex",
description:
"Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation.",
type: {
text: "string",
},
},
];

export const baseEvents: GlobalEvent[] = [
Expand Down
1 change: 1 addition & 0 deletions packages/react-wrappers/src/wrapper-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ function getReactComponentTemplate(
{
${useEffect ? "ref," : ""}
${attributes
.filter((x) => x.name !== "ref")
.map((attr) => {
return (attr.originalName || attr?.name) === attr?.propName
? attr?.name
Expand Down