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.
Files changed (145) hide show
  1. package/dist/icons/AIIcon.d.ts +11 -0
  2. package/dist/icons/AaIcon.d.ts +11 -0
  3. package/dist/icons/AlertCircle02Icon.d.ts +8 -0
  4. package/dist/icons/AlertCircleIcon.d.ts +9 -0
  5. package/dist/icons/AlertCircleSVG.d.ts +3 -0
  6. package/dist/icons/AlertCircleWarningIcon.d.ts +9 -0
  7. package/dist/icons/AlertTriangleIcon.d.ts +9 -0
  8. package/dist/icons/AlignCenterIcon.d.ts +10 -0
  9. package/dist/icons/AlignLeftIcon.d.ts +10 -0
  10. package/dist/icons/AlignRightIcon.d.ts +10 -0
  11. package/dist/icons/ArrowDownIcon.d.ts +9 -0
  12. package/dist/icons/ArrowDownLeft01Icon.d.ts +14 -0
  13. package/dist/icons/ArrowDownSVG.d.ts +3 -0
  14. package/dist/icons/ArrowIcon.d.ts +18 -0
  15. package/dist/icons/ArrowLeft01Icon.d.ts +4 -0
  16. package/dist/icons/ArrowLeft02SVG.d.ts +3 -0
  17. package/dist/icons/ArrowLeftIcon.d.ts +4 -0
  18. package/dist/icons/ArrowRight01Icon.d.ts +4 -0
  19. package/dist/icons/ArrowRight01SVG.d.ts +3 -0
  20. package/dist/icons/ArrowRightIcon.d.ts +4 -0
  21. package/dist/icons/ArrowUpIcon.d.ts +9 -0
  22. package/dist/icons/ArrowUpRight01Icon.d.ts +11 -0
  23. package/dist/icons/ArrowUpSVG.d.ts +3 -0
  24. package/dist/icons/AtIcon.d.ts +10 -0
  25. package/dist/icons/BeakBottom.d.ts +4 -0
  26. package/dist/icons/BeakDown.d.ts +13 -0
  27. package/dist/icons/BeakLeft.d.ts +4 -0
  28. package/dist/icons/BeakRight.d.ts +3 -0
  29. package/dist/icons/BeakTop.d.ts +4 -0
  30. package/dist/icons/BeakUp.d.ts +8 -0
  31. package/dist/icons/BellCircleIcon.d.ts +9 -0
  32. package/dist/icons/BellIcon.d.ts +9 -0
  33. package/dist/icons/BoldIcon.d.ts +10 -0
  34. package/dist/icons/CalendarIcon.d.ts +3 -0
  35. package/dist/icons/ChartsIcon.d.ts +3 -0
  36. package/dist/icons/CheckCircleIcon.d.ts +9 -0
  37. package/dist/icons/ChevronDownIcon.d.ts +9 -0
  38. package/dist/icons/ChevronDownSmIcon.d.ts +10 -0
  39. package/dist/icons/ChevronLeftIcon.d.ts +2 -0
  40. package/dist/icons/ChevronRightIcon.d.ts +3 -0
  41. package/dist/icons/ClearIcon.d.ts +12 -0
  42. package/dist/icons/ClockIcon.d.ts +12 -0
  43. package/dist/icons/CloseIcon.d.ts +9 -0
  44. package/dist/icons/CloudUploadIcon.d.ts +3 -0
  45. package/dist/icons/CodeSnippetChevronDownIcon.d.ts +3 -0
  46. package/dist/icons/CodeSnippetCopyIcon.d.ts +4 -0
  47. package/dist/icons/CodeSnippetStarIcon.d.ts +3 -0
  48. package/dist/icons/ColorSquareIcon.d.ts +6 -0
  49. package/dist/icons/ComponentsIcon.d.ts +3 -0
  50. package/dist/icons/DGALogoSVG.d.ts +3 -0
  51. package/dist/icons/DeleteIcon.d.ts +3 -0
  52. package/dist/icons/DownloadIcon.d.ts +6 -0
  53. package/dist/icons/DragHandleVerticalIcon.d.ts +3 -0
  54. package/dist/icons/FeedbackEmojiDislikeIcon.d.ts +2 -0
  55. package/dist/icons/FeedbackEmojiLikeIcon.d.ts +2 -0
  56. package/dist/icons/FeedbackEmojiNeutralIcon.d.ts +2 -0
  57. package/dist/icons/FeedbackThumbDislikeFilledIcon.d.ts +2 -0
  58. package/dist/icons/FeedbackThumbDislikeIcon.d.ts +2 -0
  59. package/dist/icons/FeedbackThumbLikeFilledIcon.d.ts +2 -0
  60. package/dist/icons/FeedbackThumbLikeIcon.d.ts +2 -0
  61. package/dist/icons/FileUploadItemCloseIcon.d.ts +6 -0
  62. package/dist/icons/FileUploadItemEmptyFileIcon.d.ts +5 -0
  63. package/dist/icons/FileUploadItemPdfIcon.d.ts +6 -0
  64. package/dist/icons/FilterFunnelIcon.d.ts +12 -0
  65. package/dist/icons/FilterIcon.d.ts +9 -0
  66. package/dist/icons/FitIcon.d.ts +6 -0
  67. package/dist/icons/FolderFilledIcon.d.ts +3 -0
  68. package/dist/icons/FolderIcon.d.ts +4 -0
  69. package/dist/icons/FoundationsIcon.d.ts +3 -0
  70. package/dist/icons/FullscreenExitIcon.d.ts +11 -0
  71. package/dist/icons/FullscreenIcon.d.ts +10 -0
  72. package/dist/icons/GoBackward10Icon.d.ts +3 -0
  73. package/dist/icons/GoForward10Icon.d.ts +3 -0
  74. package/dist/icons/GridSquaresIcon.d.ts +12 -0
  75. package/dist/icons/HamburgerIcon.d.ts +7 -0
  76. package/dist/icons/HelpCircleIcon.d.ts +7 -0
  77. package/dist/icons/HomeIcon.d.ts +2 -0
  78. package/dist/icons/HomeSVG.d.ts +3 -0
  79. package/dist/icons/IconFactory.d.ts +142 -0
  80. package/dist/icons/Image01SVG.d.ts +3 -0
  81. package/dist/icons/ImageIcon.d.ts +10 -0
  82. package/dist/icons/InfoCircleIcon.d.ts +10 -0
  83. package/dist/icons/InfoCircleSVG.d.ts +3 -0
  84. package/dist/icons/InfoIcon.d.ts +9 -0
  85. package/dist/icons/ItalicIcon.d.ts +10 -0
  86. package/dist/icons/LearnMoreArrowIcon.d.ts +4 -0
  87. package/dist/icons/LinkCircleSVG.d.ts +3 -0
  88. package/dist/icons/LinkIcon.d.ts +10 -0
  89. package/dist/icons/ListLinesIcon.d.ts +12 -0
  90. package/dist/icons/LockCircleSVG.d.ts +3 -0
  91. package/dist/icons/LockIcon.d.ts +13 -0
  92. package/dist/icons/Logout02Icon.d.ts +3 -0
  93. package/dist/icons/MicrophoneIcon.d.ts +2 -0
  94. package/dist/icons/MinusIcon.d.ts +19 -0
  95. package/dist/icons/MoreHorizontalIcon.d.ts +7 -0
  96. package/dist/icons/MoreVerticalIcon.d.ts +9 -0
  97. package/dist/icons/NextIcon.d.ts +10 -0
  98. package/dist/icons/PDFSvg.d.ts +12 -0
  99. package/dist/icons/PatternsIcon.d.ts +2 -0
  100. package/dist/icons/PauseIcon.d.ts +6 -0
  101. package/dist/icons/PencilIcon.d.ts +8 -0
  102. package/dist/icons/PlayButtonCardIcon.d.ts +14 -0
  103. package/dist/icons/PlayCenterIcon.d.ts +13 -0
  104. package/dist/icons/PlayIcon.d.ts +3 -0
  105. package/dist/icons/PlayIconSolid.d.ts +6 -0
  106. package/dist/icons/PlayIconStroke.d.ts +2 -0
  107. package/dist/icons/PlayIconTwotone.d.ts +6 -0
  108. package/dist/icons/PlayVideoIcon.d.ts +14 -0
  109. package/dist/icons/PlusCircleIcon.d.ts +9 -0
  110. package/dist/icons/PlusIcon.d.ts +22 -0
  111. package/dist/icons/PreviousIcon.d.ts +10 -0
  112. package/dist/icons/PrintIcon.d.ts +4 -0
  113. package/dist/icons/QuestionMarkGrayBgIcon.d.ts +22 -0
  114. package/dist/icons/QuestionMarkIcon.d.ts +11 -0
  115. package/dist/icons/RedoIcon.d.ts +10 -0
  116. package/dist/icons/SaudiFlagSVG.d.ts +3 -0
  117. package/dist/icons/SdaiaNavLogo.d.ts +2 -0
  118. package/dist/icons/SearchIcon.d.ts +12 -0
  119. package/dist/icons/SettingsIcon.d.ts +2 -0
  120. package/dist/icons/ShareIcon.d.ts +4 -0
  121. package/dist/icons/SidebarCollapseIcon.d.ts +3 -0
  122. package/dist/icons/SmileIcon.d.ts +11 -0
  123. package/dist/icons/SortIcon.d.ts +2 -0
  124. package/dist/icons/StarIcon.d.ts +11 -0
  125. package/dist/icons/StatusBadgeIcon.d.ts +2 -0
  126. package/dist/icons/TextTIcon.d.ts +10 -0
  127. package/dist/icons/Tick02Icon.d.ts +8 -0
  128. package/dist/icons/TickIcon.d.ts +12 -0
  129. package/dist/icons/TrashIcon.d.ts +14 -0
  130. package/dist/icons/UnderlineIcon.d.ts +10 -0
  131. package/dist/icons/UndoIcon.d.ts +10 -0
  132. package/dist/icons/UploadArrowIcon.d.ts +10 -0
  133. package/dist/icons/UserIcon.d.ts +2 -0
  134. package/dist/icons/VolumeHighIcon.d.ts +3 -0
  135. package/dist/icons/VolumeMuteIcon.d.ts +11 -0
  136. package/dist/icons/XCircleIcon.d.ts +8 -0
  137. package/dist/icons/XIcon.d.ts +8 -0
  138. package/dist/icons/XIconSVG.d.ts +3 -0
  139. package/dist/icons/XSmallIcon.d.ts +7 -0
  140. package/dist/icons/XSvg.d.ts +3 -0
  141. package/dist/icons/ZoomInIcon.d.ts +4 -0
  142. package/dist/icons.cjs +4452 -0
  143. package/dist/icons.js +4429 -0
  144. package/dist/index.js +62 -19
  145. 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 cssFiles = ["src/index.css", "src/App.css", "src/globals.css", "app/globals.css"];
226
- let cssFilePath = null;
227
- for (const cssFile of cssFiles) {
228
- const fullPath = path3.resolve(process.cwd(), cssFile);
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
- 'Could not find a CSS entry file. Add this to your main CSS file:\n @import "tailwindcss";'
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(' @import "tailwindcss";');
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("0.1.0");
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.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
  },