sdaia-ui 0.3.0 → 1.0.0
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/dist/icons/AIIcon.d.ts +11 -0
- package/dist/icons/AaIcon.d.ts +11 -0
- package/dist/icons/AlertCircle02Icon.d.ts +8 -0
- package/dist/icons/AlertCircleIcon.d.ts +9 -0
- package/dist/icons/AlertCircleSVG.d.ts +3 -0
- package/dist/icons/AlertCircleWarningIcon.d.ts +9 -0
- package/dist/icons/AlertTriangleIcon.d.ts +9 -0
- package/dist/icons/AlignCenterIcon.d.ts +10 -0
- package/dist/icons/AlignLeftIcon.d.ts +10 -0
- package/dist/icons/AlignRightIcon.d.ts +10 -0
- package/dist/icons/ArrowDownIcon.d.ts +9 -0
- package/dist/icons/ArrowDownLeft01Icon.d.ts +14 -0
- package/dist/icons/ArrowDownSVG.d.ts +3 -0
- package/dist/icons/ArrowIcon.d.ts +18 -0
- package/dist/icons/ArrowLeft01Icon.d.ts +4 -0
- package/dist/icons/ArrowLeft02SVG.d.ts +3 -0
- package/dist/icons/ArrowLeftIcon.d.ts +4 -0
- package/dist/icons/ArrowRight01Icon.d.ts +4 -0
- package/dist/icons/ArrowRight01SVG.d.ts +3 -0
- package/dist/icons/ArrowRightIcon.d.ts +4 -0
- package/dist/icons/ArrowUpIcon.d.ts +9 -0
- package/dist/icons/ArrowUpRight01Icon.d.ts +11 -0
- package/dist/icons/ArrowUpSVG.d.ts +3 -0
- package/dist/icons/AtIcon.d.ts +10 -0
- package/dist/icons/BeakBottom.d.ts +4 -0
- package/dist/icons/BeakDown.d.ts +13 -0
- package/dist/icons/BeakLeft.d.ts +4 -0
- package/dist/icons/BeakRight.d.ts +3 -0
- package/dist/icons/BeakTop.d.ts +4 -0
- package/dist/icons/BeakUp.d.ts +8 -0
- package/dist/icons/BellCircleIcon.d.ts +9 -0
- package/dist/icons/BellIcon.d.ts +9 -0
- package/dist/icons/BoldIcon.d.ts +10 -0
- package/dist/icons/CalendarIcon.d.ts +3 -0
- package/dist/icons/ChartsIcon.d.ts +3 -0
- package/dist/icons/CheckCircleIcon.d.ts +9 -0
- package/dist/icons/ChevronDownIcon.d.ts +9 -0
- package/dist/icons/ChevronDownSmIcon.d.ts +10 -0
- package/dist/icons/ChevronLeftIcon.d.ts +2 -0
- package/dist/icons/ChevronRightIcon.d.ts +3 -0
- package/dist/icons/ClearIcon.d.ts +12 -0
- package/dist/icons/ClockIcon.d.ts +12 -0
- package/dist/icons/CloseIcon.d.ts +9 -0
- package/dist/icons/CloudUploadIcon.d.ts +3 -0
- package/dist/icons/CodeSnippetChevronDownIcon.d.ts +3 -0
- package/dist/icons/CodeSnippetCopyIcon.d.ts +4 -0
- package/dist/icons/CodeSnippetStarIcon.d.ts +3 -0
- package/dist/icons/ColorSquareIcon.d.ts +6 -0
- package/dist/icons/ComponentsIcon.d.ts +3 -0
- package/dist/icons/DGALogoSVG.d.ts +3 -0
- package/dist/icons/DeleteIcon.d.ts +3 -0
- package/dist/icons/DownloadIcon.d.ts +6 -0
- package/dist/icons/DragHandleVerticalIcon.d.ts +3 -0
- package/dist/icons/FeedbackEmojiDislikeIcon.d.ts +2 -0
- package/dist/icons/FeedbackEmojiLikeIcon.d.ts +2 -0
- package/dist/icons/FeedbackEmojiNeutralIcon.d.ts +2 -0
- package/dist/icons/FeedbackThumbDislikeFilledIcon.d.ts +2 -0
- package/dist/icons/FeedbackThumbDislikeIcon.d.ts +2 -0
- package/dist/icons/FeedbackThumbLikeFilledIcon.d.ts +2 -0
- package/dist/icons/FeedbackThumbLikeIcon.d.ts +2 -0
- package/dist/icons/FileUploadItemCloseIcon.d.ts +6 -0
- package/dist/icons/FileUploadItemEmptyFileIcon.d.ts +5 -0
- package/dist/icons/FileUploadItemPdfIcon.d.ts +6 -0
- package/dist/icons/FilterFunnelIcon.d.ts +12 -0
- package/dist/icons/FilterIcon.d.ts +9 -0
- package/dist/icons/FitIcon.d.ts +6 -0
- package/dist/icons/FolderFilledIcon.d.ts +3 -0
- package/dist/icons/FolderIcon.d.ts +4 -0
- package/dist/icons/FoundationsIcon.d.ts +3 -0
- package/dist/icons/FullscreenExitIcon.d.ts +11 -0
- package/dist/icons/FullscreenIcon.d.ts +10 -0
- package/dist/icons/GoBackward10Icon.d.ts +3 -0
- package/dist/icons/GoForward10Icon.d.ts +3 -0
- package/dist/icons/GridSquaresIcon.d.ts +12 -0
- package/dist/icons/HamburgerIcon.d.ts +7 -0
- package/dist/icons/HelpCircleIcon.d.ts +7 -0
- package/dist/icons/HomeIcon.d.ts +2 -0
- package/dist/icons/HomeSVG.d.ts +3 -0
- package/dist/icons/IconFactory.d.ts +142 -0
- package/dist/icons/Image01SVG.d.ts +3 -0
- package/dist/icons/ImageIcon.d.ts +10 -0
- package/dist/icons/InfoCircleIcon.d.ts +10 -0
- package/dist/icons/InfoCircleSVG.d.ts +3 -0
- package/dist/icons/InfoIcon.d.ts +9 -0
- package/dist/icons/ItalicIcon.d.ts +10 -0
- package/dist/icons/LearnMoreArrowIcon.d.ts +4 -0
- package/dist/icons/LinkCircleSVG.d.ts +3 -0
- package/dist/icons/LinkIcon.d.ts +10 -0
- package/dist/icons/ListLinesIcon.d.ts +12 -0
- package/dist/icons/LockCircleSVG.d.ts +3 -0
- package/dist/icons/LockIcon.d.ts +13 -0
- package/dist/icons/Logout02Icon.d.ts +3 -0
- package/dist/icons/MicrophoneIcon.d.ts +2 -0
- package/dist/icons/MinusIcon.d.ts +19 -0
- package/dist/icons/MoreHorizontalIcon.d.ts +7 -0
- package/dist/icons/MoreVerticalIcon.d.ts +9 -0
- package/dist/icons/NextIcon.d.ts +10 -0
- package/dist/icons/PDFSvg.d.ts +12 -0
- package/dist/icons/PatternsIcon.d.ts +2 -0
- package/dist/icons/PauseIcon.d.ts +6 -0
- package/dist/icons/PencilIcon.d.ts +8 -0
- package/dist/icons/PlayButtonCardIcon.d.ts +14 -0
- package/dist/icons/PlayCenterIcon.d.ts +13 -0
- package/dist/icons/PlayIcon.d.ts +3 -0
- package/dist/icons/PlayIconSolid.d.ts +6 -0
- package/dist/icons/PlayIconStroke.d.ts +2 -0
- package/dist/icons/PlayIconTwotone.d.ts +6 -0
- package/dist/icons/PlayVideoIcon.d.ts +14 -0
- package/dist/icons/PlusCircleIcon.d.ts +9 -0
- package/dist/icons/PlusIcon.d.ts +22 -0
- package/dist/icons/PreviousIcon.d.ts +10 -0
- package/dist/icons/PrintIcon.d.ts +4 -0
- package/dist/icons/QuestionMarkGrayBgIcon.d.ts +22 -0
- package/dist/icons/QuestionMarkIcon.d.ts +11 -0
- package/dist/icons/RedoIcon.d.ts +10 -0
- package/dist/icons/SaudiFlagSVG.d.ts +3 -0
- package/dist/icons/SdaiaNavLogo.d.ts +2 -0
- package/dist/icons/SearchIcon.d.ts +12 -0
- package/dist/icons/SettingsIcon.d.ts +2 -0
- package/dist/icons/ShareIcon.d.ts +4 -0
- package/dist/icons/SidebarCollapseIcon.d.ts +3 -0
- package/dist/icons/SmileIcon.d.ts +11 -0
- package/dist/icons/SortIcon.d.ts +2 -0
- package/dist/icons/StarIcon.d.ts +11 -0
- package/dist/icons/StatusBadgeIcon.d.ts +2 -0
- package/dist/icons/TextTIcon.d.ts +10 -0
- package/dist/icons/Tick02Icon.d.ts +8 -0
- package/dist/icons/TickIcon.d.ts +12 -0
- package/dist/icons/TrashIcon.d.ts +14 -0
- package/dist/icons/UnderlineIcon.d.ts +10 -0
- package/dist/icons/UndoIcon.d.ts +10 -0
- package/dist/icons/UploadArrowIcon.d.ts +10 -0
- package/dist/icons/UserIcon.d.ts +2 -0
- package/dist/icons/VolumeHighIcon.d.ts +3 -0
- package/dist/icons/VolumeMuteIcon.d.ts +11 -0
- package/dist/icons/XCircleIcon.d.ts +8 -0
- package/dist/icons/XIcon.d.ts +8 -0
- package/dist/icons/XIconSVG.d.ts +3 -0
- package/dist/icons/XSmallIcon.d.ts +7 -0
- package/dist/icons/XSvg.d.ts +3 -0
- package/dist/icons/ZoomInIcon.d.ts +4 -0
- package/dist/icons.cjs +4452 -0
- package/dist/icons.js +4429 -0
- package/dist/index.js +62 -19
- package/package.json +15 -1
package/dist/index.js
CHANGED
|
@@ -126,6 +126,8 @@ var logger = {
|
|
|
126
126
|
var DEFAULT_REGISTRY_URL = "https://ds.nacew.com/api/registry";
|
|
127
127
|
var DEFAULT_COMPONENT_DIR = "src/components/ui";
|
|
128
128
|
var DEFAULT_UTILS_DIR = "src/lib";
|
|
129
|
+
var TAILWIND_IMPORT = '@import "tailwindcss";';
|
|
130
|
+
var TOKENS_IMPORT = '@import "@sdaia-ds/tokens/css";';
|
|
129
131
|
function isTailwindInstalled() {
|
|
130
132
|
const pkgJsonPath = path3.resolve(process.cwd(), "package.json");
|
|
131
133
|
if (!fs3.existsSync(pkgJsonPath)) return false;
|
|
@@ -136,6 +138,34 @@ function isTailwindInstalled() {
|
|
|
136
138
|
};
|
|
137
139
|
return !!allDeps["tailwindcss"];
|
|
138
140
|
}
|
|
141
|
+
function findCssEntryFile() {
|
|
142
|
+
const candidates = ["src/index.css", "src/App.css", "src/globals.css", "app/globals.css"];
|
|
143
|
+
for (const rel of candidates) {
|
|
144
|
+
const full = path3.resolve(process.cwd(), rel);
|
|
145
|
+
if (fs3.existsSync(full)) return full;
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
function ensureCssImport(cssFilePath, importStmt, importHrefForCheck) {
|
|
150
|
+
const content = fs3.readFileSync(cssFilePath, "utf-8");
|
|
151
|
+
const escaped = importHrefForCheck.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
152
|
+
const existsRe = new RegExp(`@import\\s+['"]${escaped}['"]`);
|
|
153
|
+
if (existsRe.test(content)) return false;
|
|
154
|
+
const lines = content.split("\n");
|
|
155
|
+
let lastImportIdx = -1;
|
|
156
|
+
for (let i = 0; i < lines.length; i++) {
|
|
157
|
+
if (/^\s*@import\s+/.test(lines[i])) lastImportIdx = i;
|
|
158
|
+
}
|
|
159
|
+
if (lastImportIdx === -1) {
|
|
160
|
+
fs3.writeFileSync(cssFilePath, `${importStmt}
|
|
161
|
+
|
|
162
|
+
${content}`);
|
|
163
|
+
} else {
|
|
164
|
+
lines.splice(lastImportIdx + 1, 0, importStmt);
|
|
165
|
+
fs3.writeFileSync(cssFilePath, lines.join("\n"));
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
139
169
|
async function init() {
|
|
140
170
|
logger.break();
|
|
141
171
|
logger.info("Initializing SDAIA Design System in your project...");
|
|
@@ -222,26 +252,15 @@ export default config;
|
|
|
222
252
|
fs3.writeFileSync(postcssConfigPath, postcssConfig);
|
|
223
253
|
logger.success("Created postcss.config.mjs");
|
|
224
254
|
}
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (fs3.existsSync(fullPath)) {
|
|
230
|
-
cssFilePath = fullPath;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
if (cssFilePath) {
|
|
235
|
-
const cssContent = fs3.readFileSync(cssFilePath, "utf-8");
|
|
236
|
-
if (!cssContent.includes('@import "tailwindcss"') && !cssContent.includes("@import 'tailwindcss'")) {
|
|
237
|
-
fs3.writeFileSync(cssFilePath, `@import "tailwindcss";
|
|
238
|
-
|
|
239
|
-
${cssContent}`);
|
|
240
|
-
logger.success(`Added Tailwind import to ${path3.relative(process.cwd(), cssFilePath)}`);
|
|
255
|
+
const cssFilePath2 = findCssEntryFile();
|
|
256
|
+
if (cssFilePath2) {
|
|
257
|
+
if (ensureCssImport(cssFilePath2, TAILWIND_IMPORT, "tailwindcss")) {
|
|
258
|
+
logger.success(`Added Tailwind import to ${path3.relative(process.cwd(), cssFilePath2)}`);
|
|
241
259
|
}
|
|
242
260
|
} else {
|
|
243
261
|
logger.warn(
|
|
244
|
-
|
|
262
|
+
`Could not find a CSS entry file. Add this to your main CSS file:
|
|
263
|
+
${TAILWIND_IMPORT}`
|
|
245
264
|
);
|
|
246
265
|
}
|
|
247
266
|
} else {
|
|
@@ -251,7 +270,7 @@ ${cssContent}`);
|
|
|
251
270
|
logger.info("Install it manually later:");
|
|
252
271
|
logger.info(` ${getInstallCommand(pm, ["-D", "tailwindcss", "@tailwindcss/postcss", "postcss"])}`);
|
|
253
272
|
logger.info("Then add to your main CSS file:");
|
|
254
|
-
logger.info(
|
|
273
|
+
logger.info(` ${TAILWIND_IMPORT}`);
|
|
255
274
|
}
|
|
256
275
|
} else {
|
|
257
276
|
logger.success("Tailwind CSS detected");
|
|
@@ -277,6 +296,30 @@ ${cssContent}`);
|
|
|
277
296
|
logger.warn(`Failed to auto-install. Run manually:
|
|
278
297
|
${utilityCmd}`);
|
|
279
298
|
}
|
|
299
|
+
logger.break();
|
|
300
|
+
logger.info("Installing @sdaia-ds/tokens (design tokens)...");
|
|
301
|
+
const tokensCmd = getInstallCommand(pm, ["@sdaia-ds/tokens"]);
|
|
302
|
+
try {
|
|
303
|
+
execSync(tokensCmd, { stdio: "inherit", cwd: process.cwd() });
|
|
304
|
+
logger.success("@sdaia-ds/tokens installed");
|
|
305
|
+
} catch {
|
|
306
|
+
logger.warn(`Failed to auto-install @sdaia-ds/tokens. Run manually:
|
|
307
|
+
${tokensCmd}`);
|
|
308
|
+
}
|
|
309
|
+
const cssFilePath = findCssEntryFile();
|
|
310
|
+
if (cssFilePath) {
|
|
311
|
+
const added = ensureCssImport(cssFilePath, TOKENS_IMPORT, "@sdaia-ds/tokens/css");
|
|
312
|
+
if (added) {
|
|
313
|
+
logger.success(`Added tokens import to ${path3.relative(process.cwd(), cssFilePath)}`);
|
|
314
|
+
} else {
|
|
315
|
+
logger.info("Tokens import already present in CSS file");
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
logger.warn(
|
|
319
|
+
`Could not find a CSS entry file. Add this to your main CSS file:
|
|
320
|
+
${TOKENS_IMPORT}`
|
|
321
|
+
);
|
|
322
|
+
}
|
|
280
323
|
const utilsPath = path3.resolve(process.cwd(), config.utilsDir);
|
|
281
324
|
const cnPath = path3.join(utilsPath, "cn.ts");
|
|
282
325
|
if (fs3.existsSync(cnPath)) {
|
|
@@ -468,7 +511,7 @@ async function add(componentSlugs, options) {
|
|
|
468
511
|
|
|
469
512
|
// src/index.ts
|
|
470
513
|
var program = new Command();
|
|
471
|
-
program.name("sdaia-ui").description("Install SDAIA Design System components into your project").version("
|
|
514
|
+
program.name("sdaia-ui").description("Install SDAIA Design System components into your project").version("1.0.0");
|
|
472
515
|
program.command("init").description("Initialize your project for SDAIA Design System components").action(init);
|
|
473
516
|
program.command("add").description("Add components to your project").argument("<components...>", "Component names (e.g. button modal tag)").option("--overwrite", "Overwrite existing components", false).action((components, options) => {
|
|
474
517
|
add(components, options);
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdaia-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "CLI for installing SDAIA Design System components into your project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"sdaia-ui": "./dist/index.js"
|
|
8
8
|
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./icons": {
|
|
14
|
+
"types": "./dist/icons/IconFactory.d.ts",
|
|
15
|
+
"import": "./dist/icons.js",
|
|
16
|
+
"require": "./dist/icons.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
9
19
|
"files": [
|
|
10
20
|
"dist"
|
|
11
21
|
],
|
|
@@ -13,6 +23,9 @@
|
|
|
13
23
|
"build": "node build.mjs",
|
|
14
24
|
"dev": "node build.mjs --watch"
|
|
15
25
|
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": ">=18"
|
|
28
|
+
},
|
|
16
29
|
"dependencies": {
|
|
17
30
|
"commander": "^13.1.0",
|
|
18
31
|
"prompts": "^2.4.2",
|
|
@@ -21,6 +34,7 @@
|
|
|
21
34
|
"devDependencies": {
|
|
22
35
|
"@types/prompts": "^2.4.9",
|
|
23
36
|
"@types/node": "^22.0.0",
|
|
37
|
+
"@types/react": "^19.0.0",
|
|
24
38
|
"esbuild": "^0.25.0",
|
|
25
39
|
"typescript": "^5.8.0"
|
|
26
40
|
},
|