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
|
-
|
|
148
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
)
|
|
189
|
-
)
|
|
190
|
-
|
|
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
|
-
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
@@ -67,10 +67,9 @@ const VirtualList: React.FC<VirtualListProps> = ({
|
|
|
67
67
|
</div>
|
|
68
68
|
);
|
|
69
69
|
};
|
|
70
|
-
export type
|
|
70
|
+
export type PhoneInputSize = "sm" | "md" | "lg";
|
|
71
71
|
|
|
72
|
-
interface
|
|
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?:
|
|
80
|
+
measurement?: PhoneInputSize;
|
|
82
81
|
ROW_HEIGHT?: number;
|
|
83
82
|
VISIBLE_ROWS?: number;
|
|
84
83
|
BUFFER?: number;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
|
|
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;
|