benflux-ui 0.1.2 → 0.1.3

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.
@@ -28,11 +28,11 @@ var import_commander = require("commander");
28
28
  var import_picocolors5 = __toESM(require("picocolors"));
29
29
 
30
30
  // src/commands/init.ts
31
- var import_path2 = __toESM(require("path"));
32
31
  var clack = __toESM(require("@clack/prompts"));
33
- var import_picocolors = __toESM(require("picocolors"));
34
- var import_fs_extra2 = __toESM(require("fs-extra"));
35
32
  var import_execa = require("execa");
33
+ var import_fs_extra2 = __toESM(require("fs-extra"));
34
+ var import_path2 = __toESM(require("path"));
35
+ var import_picocolors = __toESM(require("picocolors"));
36
36
 
37
37
  // src/utils/detect-framework.ts
38
38
  var import_path = __toESM(require("path"));
@@ -815,26 +815,23 @@ async function addCommand(components, options) {
815
815
  const defaultDir = options.path ?? await getComponentsPath(cwd);
816
816
  let selectedComponents = components;
817
817
  if (selectedComponents.length === 0) {
818
- const categories = [...new Set(REGISTRY.map((c) => c.category))];
819
- const category = await clack2.select({
820
- message: "Select component category:",
821
- options: [
822
- { label: "All components", value: "all" },
823
- ...categories.map((c) => ({
824
- label: c.charAt(0).toUpperCase() + c.slice(1),
825
- value: c
826
- }))
827
- ]
828
- });
829
- if (clack2.isCancel(category)) {
830
- clack2.cancel("Cancelled.");
831
- process.exit(0);
832
- }
833
- const componentOptions = category === "all" ? REGISTRY : REGISTRY.filter((c) => c.category === category);
818
+ const categoryLabel = {
819
+ layout: "Layout",
820
+ inputs: "Inputs",
821
+ navigation: "Navigation",
822
+ feedback: "Feedback",
823
+ "data-display": "Data Display",
824
+ ai: "AI",
825
+ wow: "WOW Effects"
826
+ };
827
+ const sorted = [...REGISTRY].sort(
828
+ (a, b) => a.category === b.category ? a.name.localeCompare(b.name) : a.category.localeCompare(b.category)
829
+ );
834
830
  const selected = await clack2.multiselect({
835
- message: "Select components to add:",
836
- options: componentOptions.map((c) => ({
837
- label: `${c.name} \u2014 ${c.description}`,
831
+ message: "Which components would you like to add?",
832
+ options: sorted.map((c) => ({
833
+ label: c.name,
834
+ hint: `${categoryLabel[c.category] ?? c.category} \u2014 ${c.description}`,
838
835
  value: c.name
839
836
  }))
840
837
  });
package/dist/index.js CHANGED
@@ -46,11 +46,11 @@ __export(src_exports, {
46
46
  module.exports = __toCommonJS(src_exports);
47
47
 
48
48
  // src/commands/init.ts
49
- var import_path2 = __toESM(require("path"));
50
49
  var clack = __toESM(require("@clack/prompts"));
51
- var import_picocolors = __toESM(require("picocolors"));
52
- var import_fs_extra2 = __toESM(require("fs-extra"));
53
50
  var import_execa = require("execa");
51
+ var import_fs_extra2 = __toESM(require("fs-extra"));
52
+ var import_path2 = __toESM(require("path"));
53
+ var import_picocolors = __toESM(require("picocolors"));
54
54
 
55
55
  // src/utils/detect-framework.ts
56
56
  var import_path = __toESM(require("path"));
@@ -842,26 +842,23 @@ async function addCommand(components, options) {
842
842
  const defaultDir = options.path ?? await getComponentsPath(cwd);
843
843
  let selectedComponents = components;
844
844
  if (selectedComponents.length === 0) {
845
- const categories = [...new Set(REGISTRY.map((c) => c.category))];
846
- const category = await clack2.select({
847
- message: "Select component category:",
848
- options: [
849
- { label: "All components", value: "all" },
850
- ...categories.map((c) => ({
851
- label: c.charAt(0).toUpperCase() + c.slice(1),
852
- value: c
853
- }))
854
- ]
855
- });
856
- if (clack2.isCancel(category)) {
857
- clack2.cancel("Cancelled.");
858
- process.exit(0);
859
- }
860
- const componentOptions = category === "all" ? REGISTRY : REGISTRY.filter((c) => c.category === category);
845
+ const categoryLabel = {
846
+ layout: "Layout",
847
+ inputs: "Inputs",
848
+ navigation: "Navigation",
849
+ feedback: "Feedback",
850
+ "data-display": "Data Display",
851
+ ai: "AI",
852
+ wow: "WOW Effects"
853
+ };
854
+ const sorted = [...REGISTRY].sort(
855
+ (a, b) => a.category === b.category ? a.name.localeCompare(b.name) : a.category.localeCompare(b.category)
856
+ );
861
857
  const selected = await clack2.multiselect({
862
- message: "Select components to add:",
863
- options: componentOptions.map((c) => ({
864
- label: `${c.name} \u2014 ${c.description}`,
858
+ message: "Which components would you like to add?",
859
+ options: sorted.map((c) => ({
860
+ label: c.name,
861
+ hint: `${categoryLabel[c.category] ?? c.category} \u2014 ${c.description}`,
865
862
  value: c.name
866
863
  }))
867
864
  });
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  // src/commands/init.ts
2
- import path2 from "path";
3
2
  import * as clack from "@clack/prompts";
4
- import pc from "picocolors";
5
- import fs2 from "fs-extra";
6
3
  import { execa } from "execa";
4
+ import fs2 from "fs-extra";
5
+ import path2 from "path";
6
+ import pc from "picocolors";
7
7
 
8
8
  // src/utils/detect-framework.ts
9
9
  import path from "path";
@@ -795,26 +795,23 @@ async function addCommand(components, options) {
795
795
  const defaultDir = options.path ?? await getComponentsPath(cwd);
796
796
  let selectedComponents = components;
797
797
  if (selectedComponents.length === 0) {
798
- const categories = [...new Set(REGISTRY.map((c) => c.category))];
799
- const category = await clack2.select({
800
- message: "Select component category:",
801
- options: [
802
- { label: "All components", value: "all" },
803
- ...categories.map((c) => ({
804
- label: c.charAt(0).toUpperCase() + c.slice(1),
805
- value: c
806
- }))
807
- ]
808
- });
809
- if (clack2.isCancel(category)) {
810
- clack2.cancel("Cancelled.");
811
- process.exit(0);
812
- }
813
- const componentOptions = category === "all" ? REGISTRY : REGISTRY.filter((c) => c.category === category);
798
+ const categoryLabel = {
799
+ layout: "Layout",
800
+ inputs: "Inputs",
801
+ navigation: "Navigation",
802
+ feedback: "Feedback",
803
+ "data-display": "Data Display",
804
+ ai: "AI",
805
+ wow: "WOW Effects"
806
+ };
807
+ const sorted = [...REGISTRY].sort(
808
+ (a, b) => a.category === b.category ? a.name.localeCompare(b.name) : a.category.localeCompare(b.category)
809
+ );
814
810
  const selected = await clack2.multiselect({
815
- message: "Select components to add:",
816
- options: componentOptions.map((c) => ({
817
- label: `${c.name} \u2014 ${c.description}`,
811
+ message: "Which components would you like to add?",
812
+ options: sorted.map((c) => ({
813
+ label: c.name,
814
+ hint: `${categoryLabel[c.category] ?? c.category} \u2014 ${c.description}`,
818
815
  value: c.name
819
816
  }))
820
817
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benflux-ui",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for adding Benflux UI components to your project",
5
5
  "keywords": [
6
6
  "benflux-ui",