notionsoft-ui 1.0.22 → 1.0.24

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/cli/index.cjs CHANGED
@@ -144,88 +144,80 @@ program
144
144
  // console.log(
145
145
  // chalk.green(`✓ Installed ${component} component as ${destFile}`)
146
146
  // );
147
- try {
148
- const templateDir = path.join(__dirname, "../src/notion-ui", component);
149
- const destDir = path.join(config.componentDir, component);
150
-
151
- if (!fs.existsSync(templateDir)) {
152
- console.log(chalk.red(`❌ Component '${component}' does not exist.`));
153
- return;
154
- }
147
+ const utilsDir = path.join(cwd, "src/utils");
148
+ fs.ensureDirSync(utilsDir);
155
149
 
156
- // --- Step 1: Merge to utils ---
157
- const utilsDir = path.join(cwd, "src/utils");
158
- fs.ensureDirSync(utilsDir);
159
-
160
- let mergeSuccess = true;
161
-
162
- fs.readdirSync(templateDir).forEach((file) => {
163
- const filePath = path.join(templateDir, file);
164
- const content = fs.readFileSync(filePath, "utf-8").trim();
165
-
166
- try {
167
- let targetPath;
168
- if (file.endsWith("-data.ts"))
169
- targetPath = path.join(utilsDir, "dt.ts");
170
- else if (file === "type.ts")
171
- targetPath = path.join(utilsDir, "type.ts");
172
- else if (file.startsWith("use-") && file.endsWith(".ts"))
173
- targetPath = path.join(utilsDir, "hook.ts");
174
- else return; // skip other files
175
-
176
- let targetContent = "";
177
- if (fs.existsSync(targetPath))
178
- targetContent = fs.readFileSync(targetPath, "utf-8");
179
-
180
- // Append only if content not already in the target file
181
- if (!targetContent.includes(content)) {
182
- if (targetContent.length > 0) targetContent += "\n\n";
183
- targetContent += content;
184
- fs.writeFileSync(targetPath, targetContent);
185
- console.log(
186
- chalk.green(
187
- `✓ Merged ${file} → ${path.relative(cwd, targetPath)}`
188
- )
189
- );
190
- } else {
191
- console.log(
192
- chalk.yellow(
193
- `⚠ ${file} already exists in ${path.relative(
194
- cwd,
195
- targetPath
196
- )}, skipping`
197
- )
198
- );
199
- }
200
- } catch (err) {
201
- mergeSuccess = false;
202
- console.log(chalk.red(`❌ Failed merging ${file}: ${err.message}`));
150
+ let mergeSuccess = true;
151
+
152
+ // --- Step 1: Merge utils ---
153
+ fs.readdirSync(templateDir).forEach((file) => {
154
+ const filePath = path.join(templateDir, file);
155
+ const content = fs.readFileSync(filePath, "utf-8").trim();
156
+
157
+ let targetPath;
158
+ if (file.endsWith("-data.ts")) targetPath = path.join(utilsDir, "dt.ts");
159
+ else if (file === "type.ts") targetPath = path.join(utilsDir, "type.ts");
160
+ else if (file.startsWith("use-") && file.endsWith(".ts"))
161
+ targetPath = path.join(utilsDir, "hook.ts");
162
+ else return; // skip other files
163
+
164
+ try {
165
+ let targetContent = "";
166
+ if (fs.existsSync(targetPath))
167
+ targetContent = fs.readFileSync(targetPath, "utf-8");
168
+
169
+ if (!targetContent.includes(content)) {
170
+ if (targetContent.length > 0) targetContent += "\n\n";
171
+ targetContent += content;
172
+ fs.writeFileSync(targetPath, targetContent);
173
+ console.log(
174
+ chalk.green(`✓ Merged ${file} ${path.relative(cwd, targetPath)}`)
175
+ );
176
+ } else {
177
+ console.log(
178
+ chalk.yellow(
179
+ `⚠ ${file} already exists in ${path.relative(
180
+ cwd,
181
+ targetPath
182
+ )}, skipping`
183
+ )
184
+ );
203
185
  }
204
- });
205
-
206
- if (!mergeSuccess) {
207
- console.log(
208
- chalk.red(
209
- "❌ Failed to merge required files. Component installation aborted."
210
- )
211
- );
212
- return;
186
+ } catch (err) {
187
+ mergeSuccess = false;
188
+ console.log(chalk.red(`❌ Failed merging ${file}: ${err.message}`));
213
189
  }
190
+ });
214
191
 
215
- // --- Step 2: Copy component files ---
216
- fs.copySync(templateDir, destDir, {
217
- filter: (src) => {
218
- const filename = path.basename(src);
219
- if (filename === "index.ts") return false;
220
- if (filename.endsWith(".stories.tsx")) return false;
221
- return true;
222
- },
223
- });
224
-
225
- console.log(chalk.green(`✓ Installed ${component} to ${destDir}`));
226
- } catch (err) {
227
- console.log(chalk.red(`❌ Installation failed: ${err.message}`));
192
+ if (!mergeSuccess) {
193
+ console.log(
194
+ chalk.red(
195
+ "❌ Failed to merge required files. Component installation aborted."
196
+ )
197
+ );
198
+ return;
228
199
  }
200
+
201
+ // --- Step 2: Copy remaining files flat into componentDir ---
202
+ fs.ensureDirSync(config.componentDir);
203
+ fs.readdirSync(templateDir).forEach((file) => {
204
+ if (
205
+ file === "index.ts" ||
206
+ file === "type.ts" ||
207
+ file.endsWith("-data.ts") ||
208
+ file.endsWith(".stories.tsx") ||
209
+ (file.startsWith("use-") && file.endsWith(".ts"))
210
+ )
211
+ return;
212
+
213
+ const srcFile = path.join(templateDir, file);
214
+ const destFile = path.join(config.componentDir, file); // flat copy
215
+ fs.copyFileSync(srcFile, destFile);
216
+ });
217
+
218
+ console.log(
219
+ chalk.green(`✓ Installed ${component} to ${config.componentDir}`)
220
+ );
229
221
  });
230
222
 
231
223
  /* ------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notionsoft-ui",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "A React UI component installer (shadcn-style). Installs components directly into your project.",
5
5
  "bin": {
6
6
  "notionsoft-ui": "./cli/index.cjs"
@@ -0,0 +1,3 @@
1
+ import PhoneInput from "./phone-input";
2
+
3
+ export default PhoneInput;
@@ -67,10 +67,9 @@ const VirtualList: React.FC<VirtualListProps> = ({
67
67
  </div>
68
68
  );
69
69
  };
70
- export type PhoneCountryPickerSize = "sm" | "md" | "lg";
70
+ export type PhoneInputSize = "sm" | "md" | "lg";
71
71
 
72
- interface PhoneCountryPickerProps
73
- extends React.InputHTMLAttributes<HTMLInputElement> {
72
+ interface PhoneInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
74
73
  requiredHint?: string;
75
74
  label?: string;
76
75
  errorMessage?: string;
@@ -78,13 +77,13 @@ interface PhoneCountryPickerProps
78
77
  rootDivClassName?: string;
79
78
  iconClassName?: string;
80
79
  };
81
- measurement?: PhoneCountryPickerSize;
80
+ measurement?: PhoneInputSize;
82
81
  ROW_HEIGHT?: number;
83
82
  VISIBLE_ROWS?: number;
84
83
  BUFFER?: number;
85
84
  }
86
85
 
87
- export const PhoneCountryPicker: React.FC<PhoneCountryPickerProps> = ({
86
+ const PhoneInput: React.FC<PhoneInputProps> = ({
88
87
  measurement = "sm",
89
88
  errorMessage,
90
89
  label,
@@ -398,3 +397,4 @@ export const PhoneCountryPicker: React.FC<PhoneCountryPickerProps> = ({
398
397
  </div>
399
398
  );
400
399
  };
400
+ export default PhoneInput;