@spartan-ng/cli 0.0.1-alpha.613 → 0.0.1-alpha.628

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 (63) hide show
  1. package/package.json +5 -1
  2. package/src/generators/healthcheck/generator.js +2 -0
  3. package/src/generators/healthcheck/generator.js.map +1 -1
  4. package/src/generators/healthcheck/healthchecks/hlm-dialog-portal.d.ts +2 -0
  5. package/src/generators/healthcheck/healthchecks/hlm-dialog-portal.js +35 -0
  6. package/src/generators/healthcheck/healthchecks/hlm-dialog-portal.js.map +1 -0
  7. package/src/generators/migrate-dialog-portal/compat.d.ts +2 -0
  8. package/src/generators/migrate-dialog-portal/compat.js +6 -0
  9. package/src/generators/migrate-dialog-portal/compat.js.map +1 -0
  10. package/src/generators/migrate-dialog-portal/generator.d.ts +4 -0
  11. package/src/generators/migrate-dialog-portal/generator.js +93 -0
  12. package/src/generators/migrate-dialog-portal/generator.js.map +1 -0
  13. package/src/generators/migrate-dialog-portal/schema.d.ts +4 -0
  14. package/src/generators/migrate-dialog-portal/schema.json +19 -0
  15. package/src/generators/ui/libs/alert-dialog/files/index.ts.template +5 -2
  16. package/src/generators/ui/libs/alert-dialog/files/lib/hlm-alert-dialog-portal.ts.template +8 -0
  17. package/src/generators/ui/libs/autocomplete/files/index.ts.template +3 -0
  18. package/src/generators/ui/libs/autocomplete/files/lib/hlm-autocomplete-content.ts.template +2 -2
  19. package/src/generators/ui/libs/autocomplete/files/lib/hlm-autocomplete-portal.ts.template +8 -0
  20. package/src/generators/ui/libs/autocomplete/files/lib/hlm-autocomplete-search.ts.template +11 -2
  21. package/src/generators/ui/libs/autocomplete/files/lib/hlm-autocomplete.ts.template +11 -2
  22. package/src/generators/ui/libs/combobox/files/index.ts.template +3 -0
  23. package/src/generators/ui/libs/combobox/files/lib/hlm-combobox-content.ts.template +2 -2
  24. package/src/generators/ui/libs/combobox/files/lib/hlm-combobox-multiple.ts.template +20 -2
  25. package/src/generators/ui/libs/combobox/files/lib/hlm-combobox-portal.ts.template +8 -0
  26. package/src/generators/ui/libs/combobox/files/lib/hlm-combobox.ts.template +20 -2
  27. package/src/generators/ui/libs/command/files/index.ts.template +3 -6
  28. package/src/generators/ui/libs/command/files/lib/hlm-command-dialog.ts.template +46 -18
  29. package/src/generators/ui/libs/command/files/lib/hlm-command-input.ts.template +38 -0
  30. package/src/generators/ui/libs/command/files/lib/hlm-command-list.ts.template +1 -1
  31. package/src/generators/ui/libs/command/files/lib/hlm-command-separator.ts.template +1 -1
  32. package/src/generators/ui/libs/command/files/lib/hlm-command.ts.template +3 -3
  33. package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker-multi.ts.template +4 -4
  34. package/src/generators/ui/libs/date-picker/files/lib/hlm-date-picker.ts.template +3 -4
  35. package/src/generators/ui/libs/date-picker/files/lib/hlm-date-range-picker.ts.template +3 -4
  36. package/src/generators/ui/libs/dialog/files/index.ts.template +3 -0
  37. package/src/generators/ui/libs/dialog/files/lib/hlm-dialog-portal.ts.template +8 -0
  38. package/src/generators/ui/libs/hover-card/files/index.ts.template +12 -1
  39. package/src/generators/ui/libs/hover-card/files/lib/hlm-hover-card-portal.ts.template +8 -0
  40. package/src/generators/ui/libs/hover-card/files/lib/hlm-hover-card-trigger.ts.template +23 -0
  41. package/src/generators/ui/libs/hover-card/files/lib/hlm-hover-card.ts.template +11 -0
  42. package/src/generators/ui/libs/navigation-menu/files/hlm-navigation-menu-content.ts.template +1 -1
  43. package/src/generators/ui/libs/navigation-menu/files/hlm-navigation-menu-portal.ts.template +8 -0
  44. package/src/generators/ui/libs/navigation-menu/files/hlm-navigation-menu.ts.template +1 -1
  45. package/src/generators/ui/libs/navigation-menu/files/index.ts.template +4 -1
  46. package/src/generators/ui/libs/popover/files/index.ts.template +3 -1
  47. package/src/generators/ui/libs/popover/files/lib/hlm-popover-content.ts.template +2 -2
  48. package/src/generators/ui/libs/popover/files/lib/hlm-popover-portal.ts.template +8 -0
  49. package/src/generators/ui/libs/radio-group/files/lib/hlm-radio-group.ts.template +1 -1
  50. package/src/generators/ui/libs/sheet/files/index.ts.template +3 -0
  51. package/src/generators/ui/libs/sheet/files/lib/hlm-sheet-close.ts.template +1 -7
  52. package/src/generators/ui/libs/sheet/files/lib/hlm-sheet-content.ts.template +23 -6
  53. package/src/generators/ui/libs/sheet/files/lib/hlm-sheet-portal.ts.template +8 -0
  54. package/src/generators/ui/libs/sidebar/files/lib/hlm-sidebar-menu-button.ts.template +3 -4
  55. package/src/generators/ui/libs/sidebar/files/lib/hlm-sidebar.ts.template +2 -3
  56. package/src/generators/ui/libs/tooltip/files/index.ts.template +1 -3
  57. package/src/generators/ui/libs/tooltip/files/lib/hlm-tooltip.ts.template +34 -7
  58. package/src/generators/ui/primitive-deps.js +1 -1
  59. package/src/generators/ui/primitive-deps.js.map +1 -1
  60. package/src/generators/ui/supported-ui-libraries.json +45 -39
  61. package/src/generators/ui/libs/command/files/lib/hlm-command-search-input.ts.template +0 -19
  62. package/src/generators/ui/libs/command/files/lib/hlm-command-search.ts.template +0 -16
  63. package/src/generators/ui/libs/tooltip/files/lib/hlm-tooltip-trigger.ts.template +0 -41
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@spartan-ng/cli",
3
- "version": "0.0.1-alpha.613",
3
+ "version": "0.0.1-alpha.628",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/spartan-ng/spartan"
7
+ },
4
8
  "type": "commonjs",
5
9
  "dependencies": {
6
10
  "@angular/core": ">=19.0.0",
@@ -19,6 +19,7 @@ const helm_imports_1 = require("./healthchecks/helm-imports");
19
19
  const hlm_1 = require("./healthchecks/hlm");
20
20
  const hlm_date_picker_1 = require("./healthchecks/hlm-date-picker");
21
21
  const hlm_dialog_1 = require("./healthchecks/hlm-dialog");
22
+ const hlm_dialog_portal_1 = require("./healthchecks/hlm-dialog-portal");
22
23
  const hlm_icon_1 = require("./healthchecks/hlm-icon");
23
24
  const hlm_menu_1 = require("./healthchecks/hlm-menu");
24
25
  const hlm_progress_1 = require("./healthchecks/hlm-progress");
@@ -56,6 +57,7 @@ async function healthcheckGenerator(tree, options) {
56
57
  brn_collapsible_1.brainCollapsibleHealthcheck,
57
58
  hlm_menu_1.helmMenuHealthcheck,
58
59
  hlm_dialog_1.helmDialogHealthcheck,
60
+ hlm_dialog_portal_1.helmDialogPortalHealthcheck,
59
61
  ];
60
62
  const failedReports = [];
61
63
  const importAlias = await (0, config_1.getImportAlias)(tree, options.angularCli);
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/healthcheck/generator.ts"],"names":[],"mappings":";;AA+BA,oDAuDC;AAtFD,uCAA4D;AAC5D,+CAAoD;AACpD,iDAAmH;AACnH,gEAAuE;AACvE,gFAAwF;AACxF,wGAAiG;AACjG,oEAA6E;AAC7E,wDAAiE;AACjE,gEAAyE;AACzE,oGAA6F;AAC7F,0DAAmE;AACnE,sEAA8E;AAC9E,0EAAiF;AACjF,8DAAqE;AACrE,8DAAqE;AACrE,4CAA0D;AAC1D,oEAAuE;AACvE,0DAAkE;AAClE,sDAA8D;AAC9D,sDAA8D;AAC9D,8DAAkE;AAClE,oEAAuE;AACvE,0DAA8D;AAC9D,kEAAyE;AACzE,0EAAgF;AAChF,oDAA4D;AAE5D,2CAA4C;AAC5C,+CAA+C;AAC/C,2CAAgD;AAEzC,KAAK,UAAU,oBAAoB,CAAC,IAAU,EAAE,OAA8D;IACpH,eAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAkB;QACnC,4BAAkB;QAClB,uCAAuB;QACvB,qCAAsB;QACtB,8BAAmB;QACnB,uCAAqB;QACrB,iCAAqB;QACrB,8BAAiB;QACjB,8CAA2B;QAC3B,qCAAsB;QACtB,gDAA2B;QAC3B,uCAAqB;QACrB,kCAAmB;QACnB,0BAAoB;QACpB,yCAAyB;QACzB,iEAA6B;QAC7B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AC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACpE,IAAA,sBAAW,EAAC,MAAM,CAAC,CAAC;QAEpB,IAAI,MAAM,CAAC,MAAM,KAAK,gCAAiB,CAAC,OAAO,EAAE,CAAC;YACjD,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;IACF,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,OAAO,IAAI,IAAA,mCAAoB,EAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAChE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,IAAA,mBAAU,EAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YAE7E,IAAI,GAAG,EAAE,CAAC;gBACT,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;YACrF,CAAC;QACF,CAAC;IACF,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACzB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACzB,CAAC;AACF,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type Healthcheck } from '../healthchecks';
2
+ export declare const helmDialogPortalHealthcheck: Healthcheck;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.helmDialogPortalHealthcheck = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const generator_1 = tslib_1.__importDefault(require("../../migrate-dialog-portal/generator"));
7
+ const healthchecks_1 = require("../healthchecks");
8
+ exports.helmDialogPortalHealthcheck = {
9
+ name: 'Helm Dialog Portal',
10
+ async detect(tree, failure) {
11
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '/', (file) => {
12
+ // if the file is a .ts or .htlm file, check for helm menu
13
+ if (!file.endsWith('.ts') && !file.endsWith('.html')) {
14
+ return;
15
+ }
16
+ const contents = tree.read(file, 'utf-8');
17
+ if (!contents) {
18
+ return;
19
+ }
20
+ if (contents.includes('*brnDialogContent') ||
21
+ contents.includes('*brnAlertDialogContent') ||
22
+ contents.includes('*brnPopoverContent') ||
23
+ contents.includes('*brnSheetContent') ||
24
+ contents.includes('*brnNavigationMenuContent')) {
25
+ failure('Please use the new helm directives *hlm*Portal for alert-dialog, dialog, popover, sheet or navigation-menu.', healthchecks_1.HealthcheckSeverity.Error, true);
26
+ }
27
+ });
28
+ },
29
+ fix: async (tree, { importAlias }) => {
30
+ await (0, generator_1.default)(tree, { skipFormat: true, importAlias });
31
+ return true;
32
+ },
33
+ prompt: 'Would you like to migrate *brn*Content selectors to *hlm*Portal? You need to regenerate helm components to have *hlm*Portal in your project.',
34
+ };
35
+ //# sourceMappingURL=hlm-dialog-portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hlm-dialog-portal.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/generators/healthcheck/healthchecks/hlm-dialog-portal.ts"],"names":[],"mappings":";;;;AAAA,uCAAkD;AAClD,8FAAiF;AACjF,kDAAwE;AAE3D,QAAA,2BAA2B,GAAgB;IACvD,IAAI,EAAE,oBAAoB;IAC1B,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO;QACzB,IAAA,6BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;YACxC,0DAA0D;YAC1D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtD,OAAO;YACR,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE1C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,OAAO;YACR,CAAC;YAED,IACC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBACtC,QAAQ,CAAC,QAAQ,CAAC,wBAAwB,CAAC;gBAC3C,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,CAAC;gBACvC,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC;gBACrC,QAAQ,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAC7C,CAAC;gBACF,OAAO,CACN,6GAA6G,EAC7G,kCAAmB,CAAC,KAAK,EACzB,IAAI,CACJ,CAAC;YACH,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;QACpC,MAAM,IAAA,mBAA4B,EAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,EACL,8IAA8I;CAC/I,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const _default: (generatorOptions: import("./schema").MigrateDialogPortalGeneratorSchema) => (tree: any, context: any) => Promise<any>;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const generator_1 = require("./generator");
5
+ exports.default = (0, devkit_1.convertNxGenerator)(generator_1.migrateDialogPortalGenerator);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-dialog-portal/compat.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,2CAA2D;AAE3D,kBAAe,IAAA,2BAAkB,EAAC,wCAA4B,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { MigrateDialogPortalGeneratorSchema } from './schema';
3
+ export declare function migrateDialogPortalGenerator(tree: Tree, { skipFormat, importAlias }: MigrateDialogPortalGeneratorSchema): Promise<void>;
4
+ export default migrateDialogPortalGenerator;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateDialogPortalGenerator = migrateDialogPortalGenerator;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const import_alias_1 = require("../../utils/import-alias");
6
+ const visit_files_1 = require("../../utils/visit-files");
7
+ async function migrateDialogPortalGenerator(tree, { skipFormat, importAlias }) {
8
+ updateImports(tree, importAlias);
9
+ replaceSelector(tree);
10
+ if (!skipFormat) {
11
+ await (0, devkit_1.formatFiles)(tree);
12
+ }
13
+ }
14
+ /**
15
+ * Update imports
16
+ */
17
+ function updateImports(tree, importAlias) {
18
+ (0, visit_files_1.visitFiles)(tree, '/', (path) => {
19
+ // if this is not a typescript file then skip
20
+ if (!path.endsWith('.ts')) {
21
+ return;
22
+ }
23
+ let content = tree.read(path, 'utf-8');
24
+ if (!content) {
25
+ return;
26
+ }
27
+ if (content.includes('*brnDialogContent')) {
28
+ content = content
29
+ .replace("import { BrnDialogImports } from '@spartan-ng/brain/dialog';", '')
30
+ .replace(/BrnDialogImports,?\s?/, '');
31
+ }
32
+ if (content.includes('*brnAlertDialogContent')) {
33
+ content = content
34
+ .replace("import { BrnAlertDialogImports } from '@spartan-ng/brain/alert-dialog';", '')
35
+ .replace(/BrnAlertDialogImports,?\s?/, '');
36
+ }
37
+ if (content.includes('*brnPopoverContent')) {
38
+ const popoverImport = (0, import_alias_1.helmImport)(importAlias, 'popover');
39
+ content = content
40
+ .replace("import { BrnPopoverImports } from '@spartan-ng/brain/popover';", '')
41
+ .replace(/BrnPopoverImports,?\s?/, '')
42
+ // handle BrnPopoverContent import
43
+ .replace("import { BrnPopoverContent } from '@spartan-ng/brain/popover';", `import { HlmPopoverImports } from '${popoverImport}';`)
44
+ .replace(/BrnPopoverContent?\s?/, 'HlmPopoverImports');
45
+ }
46
+ if (content.includes('*brnSheetContent')) {
47
+ content = content
48
+ .replace("import { BrnSheetImports } from '@spartan-ng/brain/sheet';", '')
49
+ .replace(/BrnSheetImports,?\s?/, '');
50
+ }
51
+ if (content.includes('*brnNavigationMenuContent')) {
52
+ content = content
53
+ .replace("import { BrnNavigationMenuImports } from '@spartan-ng/brain/navigation-menu';", '')
54
+ .replace(/BrnNavigationMenuImports,?\s?/, '');
55
+ }
56
+ tree.write(path, content);
57
+ });
58
+ }
59
+ function replaceSelector(tree) {
60
+ (0, visit_files_1.visitFiles)(tree, '.', (path) => {
61
+ // if this is not an html file or typescript file (inline templates) then skip
62
+ if (!path.endsWith('.html') && !path.endsWith('.ts')) {
63
+ return;
64
+ }
65
+ let content = tree.read(path, 'utf-8');
66
+ if (!content) {
67
+ return;
68
+ }
69
+ // dialog content
70
+ if (content.includes('*brnDialogContent')) {
71
+ content = content.replace(/\*brnDialogContent/g, '*hlmDialogPortal');
72
+ }
73
+ // alert dialog content
74
+ if (content.includes('*brnAlertDialogContent')) {
75
+ content = content.replace(/\*brnAlertDialogContent/g, '*hlmAlertDialogPortal');
76
+ }
77
+ // popover content
78
+ if (content.includes('*brnPopoverContent')) {
79
+ content = content.replace(/\*brnPopoverContent/g, '*hlmPopoverPortal');
80
+ }
81
+ // sheet content
82
+ if (content.includes('*brnSheetContent')) {
83
+ content = content.replace(/\*brnSheetContent/g, '*hlmSheetPortal');
84
+ }
85
+ // navigation-menu content
86
+ if (content.includes('*brnNavigationMenuContent')) {
87
+ content = content.replace(/\*brnNavigationMenuContent/g, '*hlmNavigationMenuPortal');
88
+ }
89
+ tree.write(path, content);
90
+ });
91
+ }
92
+ exports.default = migrateDialogPortalGenerator;
93
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-dialog-portal/gener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C;YAC3C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;QACtE,CAAC;QAED,uBAAuB;QACvB,IAAI,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAChD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,EAAE,uBAAuB,CAAC,CAAC;QAChF,CAAC;QAED,kBAAkB;QAClB,IAAI,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC5C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,CAAC;QACxE,CAAC;QAED,gBAAgB;QAChB,IAAI,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;QACpE,CAAC;QAED,0BAA0B;QAC1B,IAAI,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC;YACnD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,0BAA0B,CAAC,CAAC;QACtF,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,4BAA4B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface MigrateDialogPortalGeneratorSchema {
2
+ skipFormat?: boolean;
3
+ importAlias: string;
4
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "MigrateDialogPortal",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {
7
+ "skipFormat": {
8
+ "type": "boolean",
9
+ "default": false,
10
+ "description": "Skip formatting files"
11
+ },
12
+ "importAlias": {
13
+ "type": "string",
14
+ "default": "@spartan-ui/helm",
15
+ "description": "The prefix to use for helm imports"
16
+ }
17
+ },
18
+ "required": []
19
+ }
@@ -6,6 +6,7 @@ import { HlmAlertDialogDescription } from './lib/hlm-alert-dialog-description';
6
6
  import { HlmAlertDialogFooter } from './lib/hlm-alert-dialog-footer';
7
7
  import { HlmAlertDialogHeader } from './lib/hlm-alert-dialog-header';
8
8
  import { HlmAlertDialogOverlay } from './lib/hlm-alert-dialog-overlay';
9
+ import { HlmAlertDialogPortal } from './lib/hlm-alert-dialog-portal';
9
10
  import { HlmAlertDialogTitle } from './lib/hlm-alert-dialog-title';
10
11
  import { HlmAlertDialogTrigger } from './lib/hlm-alert-dialog-trigger';
11
12
 
@@ -17,18 +18,20 @@ export * from './lib/hlm-alert-dialog-description';
17
18
  export * from './lib/hlm-alert-dialog-footer';
18
19
  export * from './lib/hlm-alert-dialog-header';
19
20
  export * from './lib/hlm-alert-dialog-overlay';
21
+ export * from './lib/hlm-alert-dialog-portal';
20
22
  export * from './lib/hlm-alert-dialog-title';
21
23
  export * from './lib/hlm-alert-dialog-trigger';
22
24
 
23
25
  export const HlmAlertDialogImports = [
24
26
  HlmAlertDialog,
27
+ HlmAlertDialogAction,
28
+ HlmAlertDialogCancel,
25
29
  HlmAlertDialogContent,
26
30
  HlmAlertDialogDescription,
27
31
  HlmAlertDialogFooter,
28
32
  HlmAlertDialogHeader,
29
33
  HlmAlertDialogOverlay,
34
+ HlmAlertDialogPortal,
30
35
  HlmAlertDialogTitle,
31
- HlmAlertDialogAction,
32
- HlmAlertDialogCancel,
33
36
  HlmAlertDialogTrigger,
34
37
  ] as const;
@@ -0,0 +1,8 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnAlertDialogContent } from '@spartan-ng/brain/alert-dialog';
3
+
4
+ @Directive({
5
+ selector: '[hlmAlertDialogPortal]',
6
+ hostDirectives: [{ directive: BrnAlertDialogContent, inputs: ['context', 'class'] }],
7
+ })
8
+ export class HlmAlertDialogPortal {}
@@ -6,6 +6,7 @@ import { HlmAutocompleteInput } from './lib/hlm-autocomplete-input';
6
6
  import { HlmAutocompleteItem } from './lib/hlm-autocomplete-item';
7
7
  import { HlmAutocompleteLabel } from './lib/hlm-autocomplete-label';
8
8
  import { HlmAutocompleteList } from './lib/hlm-autocomplete-list';
9
+ import { HlmAutocompletePortal } from './lib/hlm-autocomplete-portal';
9
10
  import { HlmAutocompleteSearch } from './lib/hlm-autocomplete-search';
10
11
  import { HlmAutocompleteSeparator } from './lib/hlm-autocomplete-separator';
11
12
  import { HlmAutocompleteStatus } from './lib/hlm-autocomplete-status';
@@ -18,6 +19,7 @@ export * from './lib/hlm-autocomplete-input';
18
19
  export * from './lib/hlm-autocomplete-item';
19
20
  export * from './lib/hlm-autocomplete-label';
20
21
  export * from './lib/hlm-autocomplete-list';
22
+ export * from './lib/hlm-autocomplete-portal';
21
23
  export * from './lib/hlm-autocomplete-search';
22
24
  export * from './lib/hlm-autocomplete-separator';
23
25
  export * from './lib/hlm-autocomplete-status';
@@ -31,6 +33,7 @@ export const HlmAutocompleteImports = [
31
33
  HlmAutocompleteItem,
32
34
  HlmAutocompleteLabel,
33
35
  HlmAutocompleteList,
36
+ HlmAutocompletePortal,
34
37
  HlmAutocompleteSearch,
35
38
  HlmAutocompleteSeparator,
36
39
  HlmAutocompleteStatus,
@@ -3,14 +3,14 @@ import { BrnAutocompleteContent } from '@spartan-ng/brain/autocomplete';
3
3
  import { classes } from '<%- importAlias %>/utils';
4
4
 
5
5
  @Directive({
6
- selector: '[hlmAutocompleteContent]',
6
+ selector: '[hlmAutocompleteContent],hlm-autocomplete-content',
7
7
  hostDirectives: [BrnAutocompleteContent],
8
8
  })
9
9
  export class HlmAutocompleteContent {
10
10
  constructor() {
11
11
  classes(
12
12
  () =>
13
- 'group/autocomplete-content bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 max-h-72 w-(--brn-autocomplete-width) min-w-36 overflow-hidden rounded-md p-0 shadow-md ring-1 duration-100',
13
+ 'group/autocomplete-content bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex max-h-72 w-(--brn-autocomplete-width) min-w-36 flex-col overflow-hidden rounded-md p-0 shadow-md ring-1 duration-100',
14
14
  );
15
15
  }
16
16
  }
@@ -0,0 +1,8 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnPopoverContent } from '@spartan-ng/brain/popover';
3
+
4
+ @Directive({
5
+ selector: '[hlmAutocompletePortal]',
6
+ hostDirectives: [{ directive: BrnPopoverContent, inputs: ['context', 'class'] }],
7
+ })
8
+ export class HlmAutocompletePortal {}
@@ -18,12 +18,21 @@ import { classes } from '<%- importAlias %>/utils';
18
18
  hostDirectives: [
19
19
  {
20
20
  directive: BrnAutocompleteSearch,
21
- inputs: ['disabled', 'value', 'search', 'itemToString'],
21
+ inputs: ['autoHighlight', 'disabled', 'value', 'search', 'itemToString'],
22
22
  outputs: ['valueChange', 'searchChange'],
23
23
  },
24
24
  {
25
25
  directive: BrnPopover,
26
- inputs: ['align', 'autoFocus', 'closeDelay', 'closeOnOutsidePointerEvents', 'sideOffset', 'state', 'offsetX'],
26
+ inputs: [
27
+ 'align',
28
+ 'autoFocus',
29
+ 'closeDelay',
30
+ 'closeOnOutsidePointerEvents',
31
+ 'sideOffset',
32
+ 'state',
33
+ 'offsetX',
34
+ 'restoreFocus',
35
+ ],
27
36
  outputs: ['stateChanged', 'closed'],
28
37
  },
29
38
  ],
@@ -18,12 +18,21 @@ import { classes } from '<%- importAlias %>/utils';
18
18
  hostDirectives: [
19
19
  {
20
20
  directive: BrnAutocomplete,
21
- inputs: ['disabled', 'value', 'search', 'itemToString', 'isItemEqualToValue'],
21
+ inputs: ['autoHighlight', 'disabled', 'value', 'search', 'itemToString', 'isItemEqualToValue'],
22
22
  outputs: ['valueChange', 'searchChange'],
23
23
  },
24
24
  {
25
25
  directive: BrnPopover,
26
- inputs: ['align', 'autoFocus', 'closeDelay', 'closeOnOutsidePointerEvents', 'sideOffset', 'state', 'offsetX'],
26
+ inputs: [
27
+ 'align',
28
+ 'autoFocus',
29
+ 'closeDelay',
30
+ 'closeOnOutsidePointerEvents',
31
+ 'sideOffset',
32
+ 'state',
33
+ 'offsetX',
34
+ 'restoreFocus',
35
+ ],
27
36
  outputs: ['stateChanged', 'closed'],
28
37
  },
29
38
  ],
@@ -10,6 +10,7 @@ import { HlmComboboxItem } from './lib/hlm-combobox-item';
10
10
  import { HlmComboboxLabel } from './lib/hlm-combobox-label';
11
11
  import { HlmComboboxList } from './lib/hlm-combobox-list';
12
12
  import { HlmComboboxMultiple } from './lib/hlm-combobox-multiple';
13
+ import { HlmComboboxPortal } from './lib/hlm-combobox-portal';
13
14
  import { HlmComboboxSeparator } from './lib/hlm-combobox-separator';
14
15
  import { HlmComboboxStatus } from './lib/hlm-combobox-status';
15
16
  import { HlmComboboxTrigger } from './lib/hlm-combobox-trigger';
@@ -28,6 +29,7 @@ export * from './lib/hlm-combobox-item';
28
29
  export * from './lib/hlm-combobox-label';
29
30
  export * from './lib/hlm-combobox-list';
30
31
  export * from './lib/hlm-combobox-multiple';
32
+ export * from './lib/hlm-combobox-portal';
31
33
  export * from './lib/hlm-combobox-separator';
32
34
  export * from './lib/hlm-combobox-status';
33
35
  export * from './lib/hlm-combobox-trigger';
@@ -47,6 +49,7 @@ export const HlmComboboxImports = [
47
49
  HlmComboboxLabel,
48
50
  HlmComboboxList,
49
51
  HlmComboboxMultiple,
52
+ HlmComboboxPortal,
50
53
  HlmComboboxSeparator,
51
54
  HlmComboboxStatus,
52
55
  HlmComboboxTrigger,
@@ -3,13 +3,13 @@ import { BrnComboboxContent } from '@spartan-ng/brain/combobox';
3
3
  import { classes } from '<%- importAlias %>/utils';
4
4
 
5
5
  @Directive({
6
- selector: '[hlmComboboxContent]',
6
+ selector: '[hlmComboboxContent],hlm-combobox-content',
7
7
  hostDirectives: [BrnComboboxContent],
8
8
  })
9
9
  export class HlmComboboxContent {
10
10
  constructor() {
11
11
  classes(() => [
12
- 'group/combobox-content bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 max-h-72 w-(--brn-combobox-width) min-w-36 overflow-hidden rounded-md p-0 shadow-md ring-1 duration-100',
12
+ 'group/combobox-content bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex max-h-72 w-(--brn-combobox-width) min-w-36 flex-col overflow-hidden rounded-md p-0 shadow-md ring-1 duration-100',
13
13
  // change input group styles in the content
14
14
  '**:data-[slot=input-group]:bg-input **:data-[slot=input-group]:border-input/30 **:has-[[data-slot=input-group-control]:focus-visible]:border-input **:has-[[data-slot=input-group-control]:focus-visible]:ring-0 **:data-[slot=input-group]:m-1 **:data-[slot=input-group]:mb-0 **:data-[slot=input-group]:h-8 **:data-[slot=input-group]:shadow-none',
15
15
  ]);
@@ -18,12 +18,30 @@ import { classes } from '<%- importAlias %>/utils';
18
18
  hostDirectives: [
19
19
  {
20
20
  directive: BrnComboboxMultiple,
21
- inputs: ['disabled', 'filter', 'search', 'value', 'itemToString', 'filterOptions', 'isItemEqualToValue'],
21
+ inputs: [
22
+ 'autoHighlight',
23
+ 'disabled',
24
+ 'filter',
25
+ 'search',
26
+ 'value',
27
+ 'itemToString',
28
+ 'filterOptions',
29
+ 'isItemEqualToValue',
30
+ ],
22
31
  outputs: ['searchChange', 'valueChange'],
23
32
  },
24
33
  {
25
34
  directive: BrnPopover,
26
- inputs: ['align', 'autoFocus', 'closeDelay', 'closeOnOutsidePointerEvents', 'sideOffset', 'state', 'offsetX'],
35
+ inputs: [
36
+ 'align',
37
+ 'autoFocus',
38
+ 'closeDelay',
39
+ 'closeOnOutsidePointerEvents',
40
+ 'sideOffset',
41
+ 'state',
42
+ 'offsetX',
43
+ 'restoreFocus',
44
+ ],
27
45
  outputs: ['stateChanged', 'closed'],
28
46
  },
29
47
  ],
@@ -0,0 +1,8 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnPopoverContent } from '@spartan-ng/brain/popover';
3
+
4
+ @Directive({
5
+ selector: '[hlmComboboxPortal]',
6
+ hostDirectives: [{ directive: BrnPopoverContent, inputs: ['context', 'class'] }],
7
+ })
8
+ export class HlmComboboxPortal {}
@@ -18,12 +18,30 @@ import { classes } from '<%- importAlias %>/utils';
18
18
  hostDirectives: [
19
19
  {
20
20
  directive: BrnCombobox,
21
- inputs: ['disabled', 'filter', 'search', 'value', 'itemToString', 'filterOptions', 'isItemEqualToValue'],
21
+ inputs: [
22
+ 'autoHighlight',
23
+ 'disabled',
24
+ 'filter',
25
+ 'search',
26
+ 'value',
27
+ 'itemToString',
28
+ 'filterOptions',
29
+ 'isItemEqualToValue',
30
+ ],
22
31
  outputs: ['searchChange', 'valueChange'],
23
32
  },
24
33
  {
25
34
  directive: BrnPopover,
26
- inputs: ['align', 'autoFocus', 'closeDelay', 'closeOnOutsidePointerEvents', 'sideOffset', 'state', 'offsetX'],
35
+ inputs: [
36
+ 'align',
37
+ 'autoFocus',
38
+ 'closeDelay',
39
+ 'closeOnOutsidePointerEvents',
40
+ 'sideOffset',
41
+ 'state',
42
+ 'offsetX',
43
+ 'restoreFocus',
44
+ ],
27
45
  outputs: ['stateChanged', 'closed'],
28
46
  },
29
47
  ],
@@ -4,10 +4,9 @@ import { HlmCommandEmpty } from './lib/hlm-command-empty';
4
4
  import { HlmCommandEmptyState } from './lib/hlm-command-empty-state';
5
5
  import { HlmCommandGroup } from './lib/hlm-command-group';
6
6
  import { HlmCommandGroupLabel } from './lib/hlm-command-group-label';
7
+ import { HlmCommandInput } from './lib/hlm-command-input';
7
8
  import { HlmCommandItem } from './lib/hlm-command-item';
8
9
  import { HlmCommandList } from './lib/hlm-command-list';
9
- import { HlmCommandSearch } from './lib/hlm-command-search';
10
- import { HlmCommandSearchInput } from './lib/hlm-command-search-input';
11
10
  import { HlmCommandSeparator } from './lib/hlm-command-separator';
12
11
  import { HlmCommandShortcut } from './lib/hlm-command-shortcut';
13
12
 
@@ -17,10 +16,9 @@ export * from './lib/hlm-command-empty';
17
16
  export * from './lib/hlm-command-empty-state';
18
17
  export * from './lib/hlm-command-group';
19
18
  export * from './lib/hlm-command-group-label';
19
+ export * from './lib/hlm-command-input';
20
20
  export * from './lib/hlm-command-item';
21
21
  export * from './lib/hlm-command-list';
22
- export * from './lib/hlm-command-search';
23
- export * from './lib/hlm-command-search-input';
24
22
  export * from './lib/hlm-command-separator';
25
23
  export * from './lib/hlm-command-shortcut';
26
24
 
@@ -31,10 +29,9 @@ export const HlmCommandImports = [
31
29
  HlmCommandEmptyState,
32
30
  HlmCommandGroup,
33
31
  HlmCommandGroupLabel,
32
+ HlmCommandInput,
34
33
  HlmCommandItem,
35
34
  HlmCommandList,
36
- HlmCommandSearchInput,
37
- HlmCommandSearch,
38
35
  HlmCommandSeparator,
39
36
  HlmCommandShortcut,
40
37
  ] as const;
@@ -1,26 +1,54 @@
1
- import { Directive, ElementRef, afterNextRender, contentChild } from '@angular/core';
2
- import { BrnCommandSearchInputToken } from '@spartan-ng/brain/command';
3
- import { classes } from '<%- importAlias %>/utils';
1
+ import { BooleanInput } from '@angular/cdk/coercion';
2
+ import {
3
+ booleanAttribute,
4
+ ChangeDetectionStrategy,
5
+ Component,
6
+ computed,
7
+ input,
8
+ linkedSignal,
9
+ output,
10
+ } from '@angular/core';
11
+ import { BrnDialogContent, BrnDialogState } from '@spartan-ng/brain/dialog';
12
+ import { HlmDialogImports } from '<%- importAlias %>/dialog';
13
+ import { hlm } from '<%- importAlias %>/utils';
14
+ import { ClassValue } from 'clsx';
4
15
 
5
- @Directive({
6
- selector: '[hlmCommandDialog]',
7
- host: {
8
- 'data-slot': 'command-dialog',
9
- },
16
+ @Component({
17
+ selector: 'hlm-command-dialog',
18
+ imports: [HlmDialogImports, BrnDialogContent],
19
+ changeDetection: ChangeDetectionStrategy.OnPush,
20
+ template: `
21
+ <hlm-dialog [state]="_state()" (stateChanged)="stateChanged($event)">
22
+ <hlm-dialog-content
23
+ *hlmDialogPortal="let ctx"
24
+ [class]="_computedDialogContentClass()"
25
+ [showCloseButton]="showCloseButton()"
26
+ >
27
+ <hlm-dialog-header class="sr-only">
28
+ <h2 hlmDialogTitle>{{ title() }}</h2>
29
+ <p hlmDialogDescription>{{ description() }}</p>
30
+ </hlm-dialog-header>
31
+ <ng-content />
32
+ </hlm-dialog-content>
33
+ </hlm-dialog>
34
+ `,
10
35
  })
11
36
  export class HlmCommandDialog {
12
- /** Access the search field */
13
- private readonly _searchInput = contentChild(BrnCommandSearchInputToken, { read: ElementRef });
37
+ public readonly title = input<string>('Command Palette');
38
+ public readonly description = input<string>('Search for a command to run...');
14
39
 
15
- constructor() {
16
- classes(() => '**:data-[slot=command-search]:h-12 **:data-[slot=command-search-input]:h-12');
40
+ public readonly state = input<BrnDialogState>('closed');
41
+ protected readonly _state = linkedSignal(this.state);
17
42
 
18
- afterNextRender(() => {
19
- const searchInput = this._searchInput();
43
+ public readonly showCloseButton = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
20
44
 
21
- if (searchInput) {
22
- searchInput.nativeElement.focus();
23
- }
24
- });
45
+ public readonly dialogContentClass = input<ClassValue>('');
46
+ protected readonly _computedDialogContentClass = computed(() => hlm('w-96 p-0', this.dialogContentClass()));
47
+
48
+ public readonly stateChange = output<BrnDialogState>();
49
+
50
+ protected stateChanged(state: BrnDialogState) {
51
+ this.stateChange.emit(state);
52
+ this._state.set(state);
25
53
  }
26
54
  }