my-react-lib-prashant 1.0.1 → 1.0.2

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-react-lib-prashant",
3
- "version": "1.0.1",
4
- "main": "dist/my-react-lib.js",
3
+ "version": "1.0.2",
4
+ "main": "src/main.jsx",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
package/src/App.jsx CHANGED
@@ -1,122 +0,0 @@
1
- import { useState } from 'react'
2
- import reactLogo from './assets/react.svg'
3
- import viteLogo from './assets/vite.svg'
4
- import heroImg from './assets/hero.png'
5
- import './App.css'
6
-
7
- function App() {
8
- const [count, setCount] = useState(0)
9
-
10
- return (
11
- <>
12
- <section id="center">
13
- <div className="hero">
14
- <img src={heroImg} className="base" width="170" height="179" alt="" />
15
- <img src={reactLogo} className="framework" alt="React logo" />
16
- <img src={viteLogo} className="vite" alt="Vite logo" />
17
- </div>
18
- <div>
19
- <h1>Get started</h1>
20
- <p>
21
- Edit <code>src/App.jsx</code> and save to test <code>HMR</code>
22
- </p>
23
- </div>
24
- <button
25
- type="button"
26
- className="counter"
27
- onClick={() => setCount((count) => count + 1)}
28
- >
29
- Count is {count}
30
- </button>
31
- </section>
32
-
33
- <div className="ticks"></div>
34
-
35
- <section id="next-steps">
36
- <div id="docs">
37
- <svg className="icon" role="presentation" aria-hidden="true">
38
- <use href="/icons.svg#documentation-icon"></use>
39
- </svg>
40
- <h2>Documentation</h2>
41
- <p>Your questions, answered</p>
42
- <ul>
43
- <li>
44
- <a href="https://vite.dev/" target="_blank">
45
- <img className="logo" src={viteLogo} alt="" />
46
- Explore Vite
47
- </a>
48
- </li>
49
- <li>
50
- <a href="https://react.dev/" target="_blank">
51
- <img className="button-icon" src={reactLogo} alt="" />
52
- Learn more
53
- </a>
54
- </li>
55
- </ul>
56
- </div>
57
- <div id="social">
58
- <svg className="icon" role="presentation" aria-hidden="true">
59
- <use href="/icons.svg#social-icon"></use>
60
- </svg>
61
- <h2>Connect with us</h2>
62
- <p>Join the Vite community</p>
63
- <ul>
64
- <li>
65
- <a href="https://github.com/vitejs/vite" target="_blank">
66
- <svg
67
- className="button-icon"
68
- role="presentation"
69
- aria-hidden="true"
70
- >
71
- <use href="/icons.svg#github-icon"></use>
72
- </svg>
73
- GitHub
74
- </a>
75
- </li>
76
- <li>
77
- <a href="https://chat.vite.dev/" target="_blank">
78
- <svg
79
- className="button-icon"
80
- role="presentation"
81
- aria-hidden="true"
82
- >
83
- <use href="/icons.svg#discord-icon"></use>
84
- </svg>
85
- Discord
86
- </a>
87
- </li>
88
- <li>
89
- <a href="https://x.com/vite_js" target="_blank">
90
- <svg
91
- className="button-icon"
92
- role="presentation"
93
- aria-hidden="true"
94
- >
95
- <use href="/icons.svg#x-icon"></use>
96
- </svg>
97
- X.com
98
- </a>
99
- </li>
100
- <li>
101
- <a href="https://bsky.app/profile/vite.dev" target="_blank">
102
- <svg
103
- className="button-icon"
104
- role="presentation"
105
- aria-hidden="true"
106
- >
107
- <use href="/icons.svg#bluesky-icon"></use>
108
- </svg>
109
- Bluesky
110
- </a>
111
- </li>
112
- </ul>
113
- </div>
114
- </section>
115
-
116
- <div className="ticks"></div>
117
- <section id="spacer"></section>
118
- </>
119
- )
120
- }
121
-
122
- export default App
@@ -1,12 +1,21 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
+
3
+ export default function TextBox(props) {
4
+ const [value, setValue] = useState("");
5
+
6
+ const handleChange = (e) => {
7
+ setValue(e.target.value);
8
+ };
2
9
 
3
- export default function TextBox({ label, value, onChange }) {
4
10
  return (
5
- <div>
6
- <label>{label}</label>
11
+ <div style={{ padding: "20px" }}>
12
+ <label>{props.label}</label>
13
+ <br />
7
14
  <input
15
+ type="text"
16
+ placeholder={props.placeholder}
8
17
  value={value}
9
- onChange={(e) => onChange(e.target.value)}
18
+ onChange={handleChange}
10
19
  />
11
20
  </div>
12
21
  );
package/src/index.css CHANGED
@@ -1,111 +0,0 @@
1
- :root {
2
- --text: #6b6375;
3
- --text-h: #08060d;
4
- --bg: #fff;
5
- --border: #e5e4e7;
6
- --code-bg: #f4f3ec;
7
- --accent: #aa3bff;
8
- --accent-bg: rgba(170, 59, 255, 0.1);
9
- --accent-border: rgba(170, 59, 255, 0.5);
10
- --social-bg: rgba(244, 243, 236, 0.5);
11
- --shadow:
12
- rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
13
-
14
- --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
15
- --heading: system-ui, 'Segoe UI', Roboto, sans-serif;
16
- --mono: ui-monospace, Consolas, monospace;
17
-
18
- font: 18px/145% var(--sans);
19
- letter-spacing: 0.18px;
20
- color-scheme: light dark;
21
- color: var(--text);
22
- background: var(--bg);
23
- font-synthesis: none;
24
- text-rendering: optimizeLegibility;
25
- -webkit-font-smoothing: antialiased;
26
- -moz-osx-font-smoothing: grayscale;
27
-
28
- @media (max-width: 1024px) {
29
- font-size: 16px;
30
- }
31
- }
32
-
33
- @media (prefers-color-scheme: dark) {
34
- :root {
35
- --text: #9ca3af;
36
- --text-h: #f3f4f6;
37
- --bg: #16171d;
38
- --border: #2e303a;
39
- --code-bg: #1f2028;
40
- --accent: #c084fc;
41
- --accent-bg: rgba(192, 132, 252, 0.15);
42
- --accent-border: rgba(192, 132, 252, 0.5);
43
- --social-bg: rgba(47, 48, 58, 0.5);
44
- --shadow:
45
- rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
46
- }
47
-
48
- #social .button-icon {
49
- filter: invert(1) brightness(2);
50
- }
51
- }
52
-
53
- body {
54
- margin: 0;
55
- }
56
-
57
- #root {
58
- width: 1126px;
59
- max-width: 100%;
60
- margin: 0 auto;
61
- text-align: center;
62
- border-inline: 1px solid var(--border);
63
- min-height: 100svh;
64
- display: flex;
65
- flex-direction: column;
66
- box-sizing: border-box;
67
- }
68
-
69
- h1,
70
- h2 {
71
- font-family: var(--heading);
72
- font-weight: 500;
73
- color: var(--text-h);
74
- }
75
-
76
- h1 {
77
- font-size: 56px;
78
- letter-spacing: -1.68px;
79
- margin: 32px 0;
80
- @media (max-width: 1024px) {
81
- font-size: 36px;
82
- margin: 20px 0;
83
- }
84
- }
85
- h2 {
86
- font-size: 24px;
87
- line-height: 118%;
88
- letter-spacing: -0.24px;
89
- margin: 0 0 8px;
90
- @media (max-width: 1024px) {
91
- font-size: 20px;
92
- }
93
- }
94
- p {
95
- margin: 0;
96
- }
97
-
98
- code,
99
- .counter {
100
- font-family: var(--mono);
101
- display: inline-flex;
102
- border-radius: 4px;
103
- color: var(--text-h);
104
- }
105
-
106
- code {
107
- font-size: 15px;
108
- line-height: 135%;
109
- padding: 4px 8px;
110
- background: var(--code-bg);
111
- }
package/src/main.jsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import reactToWebComponent from "react-to-webcomponent";
4
- import TextBox from "./TextBox";
4
+ import TextBox from "./components/TextBox";
5
5
 
6
- const MyTextbox = reactToWebComponent(TextBox, React, ReactDOM);
6
+ const WebTextBox = reactToWebComponent(TextBox, React, ReactDOM);
7
7
 
8
- customElements.define("my-textbox", MyTextbox);
8
+ customElements.define("my-textbox", WebTextBox);
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import reactToWebComponent from "react-to-webcomponent";
4
- import TextBox from "./TextBox";
4
+ import TextBox from "./components/TextBox";
5
5
 
6
6
  const MyTextbox = reactToWebComponent(TextBox, React, ReactDOM);
7
7