my-react-lib-prashant 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18693,17 +18693,16 @@ function ne(e) {
|
|
|
18693
18693
|
value: t,
|
|
18694
18694
|
placeholder: e.placeholder || "Enter text",
|
|
18695
18695
|
onChange: (t) => {
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
style: {
|
|
18699
|
-
padding: "8px",
|
|
18700
|
-
width: "250px",
|
|
18701
|
-
marginTop: "5px"
|
|
18696
|
+
let r = t.target.value;
|
|
18697
|
+
n(r), e.onChange && e.onChange(r), window.dispatchEvent(new CustomEvent("textbox-change", { detail: r }));
|
|
18702
18698
|
}
|
|
18703
18699
|
})] });
|
|
18704
18700
|
}
|
|
18705
18701
|
//#endregion
|
|
18706
18702
|
//#region src/main.jsx
|
|
18707
|
-
var re = N(ne, y.default, b.default
|
|
18703
|
+
var re = N(ne, y.default, b.default, { props: {
|
|
18704
|
+
label: "string",
|
|
18705
|
+
placeholder: "string"
|
|
18706
|
+
} });
|
|
18708
18707
|
customElements.define("my-textbox", re);
|
|
18709
18708
|
//#endregion
|
|
@@ -168,4 +168,4 @@ Check the top-level render call using <`+n+`>.`)}return t}function Xe(e,t){if(!(
|
|
|
168
168
|
<%s {...props} />
|
|
169
169
|
React keys must be passed directly to JSX without using spread:
|
|
170
170
|
let props = %s;
|
|
171
|
-
<%s key={someKey} {...props} />`,_,h,g.length>0?`{`+g.join(`: ..., `)+`: ...}`:`{}`,h),et[h+_]=!0)}return e===i?$e(f):Qe(f),f}function nt(e,t,n){return tt(e,t,n,!0)}function rt(e,t,n){return tt(e,t,n,!1)}var it=rt,at=nt;e.Fragment=i,e.jsx=it,e.jsxs=at})()})),te=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=P():t.exports=ee()}))();function ne(e){let[t,n]=(0,y.useState)(``);return(0,te.jsxs)(`div`,{children:[(0,te.jsxs)(`label`,{children:[e.label||`Textbox`,`:`]}),(0,te.jsx)(`input`,{type:`text`,value:t,placeholder:e.placeholder||`Enter text`,onChange:t=>{
|
|
171
|
+
<%s key={someKey} {...props} />`,_,h,g.length>0?`{`+g.join(`: ..., `)+`: ...}`:`{}`,h),et[h+_]=!0)}return e===i?$e(f):Qe(f),f}function nt(e,t,n){return tt(e,t,n,!0)}function rt(e,t,n){return tt(e,t,n,!1)}var it=rt,at=nt;e.Fragment=i,e.jsx=it,e.jsxs=at})()})),te=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=P():t.exports=ee()}))();function ne(e){let[t,n]=(0,y.useState)(``);return(0,te.jsxs)(`div`,{children:[(0,te.jsxs)(`label`,{children:[e.label||`Textbox`,`:`]}),(0,te.jsx)(`input`,{type:`text`,value:t,placeholder:e.placeholder||`Enter text`,onChange:t=>{let r=t.target.value;n(r),e.onChange&&e.onChange(r),window.dispatchEvent(new CustomEvent(`textbox-change`,{detail:r}))}})]})}var re=N(ne,y.default,b.default,{props:{label:`string`,placeholder:`string`}});customElements.define(`my-textbox`,re)});
|
package/package.json
CHANGED
|
@@ -4,11 +4,18 @@ export default function TextBox(props) {
|
|
|
4
4
|
const [value, setValue] = useState("");
|
|
5
5
|
|
|
6
6
|
const handleChange = (e) => {
|
|
7
|
-
|
|
7
|
+
const newValue = e.target.value;
|
|
8
|
+
setValue(newValue);
|
|
8
9
|
|
|
9
10
|
if (props.onChange) {
|
|
10
|
-
props.onChange(
|
|
11
|
+
props.onChange(newValue);
|
|
11
12
|
}
|
|
13
|
+
|
|
14
|
+
window.dispatchEvent(
|
|
15
|
+
new CustomEvent("textbox-change", {
|
|
16
|
+
detail: newValue
|
|
17
|
+
})
|
|
18
|
+
);
|
|
12
19
|
};
|
|
13
20
|
|
|
14
21
|
return (
|
|
@@ -19,11 +26,6 @@ export default function TextBox(props) {
|
|
|
19
26
|
value={value}
|
|
20
27
|
placeholder={props.placeholder || "Enter text"}
|
|
21
28
|
onChange={handleChange}
|
|
22
|
-
style={{
|
|
23
|
-
padding: "8px",
|
|
24
|
-
width: "250px",
|
|
25
|
-
marginTop: "5px"
|
|
26
|
-
}}
|
|
27
29
|
/>
|
|
28
30
|
</div>
|
|
29
31
|
);
|
package/src/main.jsx
CHANGED
|
@@ -3,6 +3,11 @@ import ReactDOM from "react-dom/client";
|
|
|
3
3
|
import reactToWebComponent from "react-to-webcomponent";
|
|
4
4
|
import TextBox from "./components/TextBox";
|
|
5
5
|
|
|
6
|
-
const WebTextBox = reactToWebComponent(TextBox, React, ReactDOM
|
|
6
|
+
const WebTextBox = reactToWebComponent(TextBox, React, ReactDOM, {
|
|
7
|
+
props: {
|
|
8
|
+
label: "string",
|
|
9
|
+
placeholder: "string"
|
|
10
|
+
}
|
|
11
|
+
});
|
|
7
12
|
|
|
8
13
|
customElements.define("my-textbox", WebTextBox);
|