@aerogel/cli 0.0.0-next.deed5f96c88f54b3908a9da7fe630324e78aa4ac → 0.0.0-next.e3690204fb6f5fb723525710ac64e3b3fe4fd487

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 (37) hide show
  1. package/dist/aerogel-cli.js +199 -288
  2. package/dist/aerogel-cli.js.map +1 -1
  3. package/package.json +2 -2
  4. package/src/cli.ts +0 -2
  5. package/src/commands/generate-component.test.ts +0 -60
  6. package/src/commands/generate-component.ts +3 -79
  7. package/src/commands/install.test.ts +8 -0
  8. package/src/commands/install.ts +4 -3
  9. package/src/lib/Editor.ts +0 -1
  10. package/src/plugins/LocalFirst.ts +9 -0
  11. package/src/plugins/Plugin.ts +3 -21
  12. package/src/plugins/Solid.ts +1 -9
  13. package/src/plugins/Soukai.ts +1 -1
  14. package/templates/app/.vscode/launch.json +1 -0
  15. package/templates/app/index.html +2 -2
  16. package/templates/app/package.json +8 -7
  17. package/templates/app/src/App.vue +3 -3
  18. package/templates/app/src/assets/css/main.css +4 -3
  19. package/src/commands/generate-overrides.ts +0 -85
  20. package/templates/app/postcss.config.js +0 -6
  21. package/templates/app/tailwind.config.js +0 -5
  22. package/templates/component-button/[component.name].vue +0 -42
  23. package/templates/component-button-story/[component.name].story.vue +0 -77
  24. package/templates/component-checkbox/[component.name].vue +0 -34
  25. package/templates/component-checkbox-story/[component.name].story.vue +0 -63
  26. package/templates/component-input/[component.name].vue +0 -17
  27. package/templates/component-input-story/[component.name].story.vue +0 -63
  28. package/templates/component-story/[component.name].story.vue +0 -7
  29. package/templates/overrides/components/index.ts +0 -15
  30. package/templates/overrides/components/overrides/AlertModal.vue +0 -11
  31. package/templates/overrides/components/overrides/ConfirmModal.vue +0 -20
  32. package/templates/overrides/components/overrides/ErrorReportModal.vue +0 -35
  33. package/templates/overrides/components/overrides/LoadingModal.vue +0 -12
  34. package/templates/overrides/components/overrides/ModalWrapper.vue +0 -22
  35. package/templates/overrides/components/overrides/SnackbarNotification.vue +0 -34
  36. package/templates/overrides-story/Overrides.story.vue +0 -86
  37. package/templates/postcss-pseudo-classes/postcss.config.js +0 -15
@@ -1,4 +1,4 @@
1
- import { arrayFilter, arrayFrom, stringToSlug } from '@noeldemartin/utils';
1
+ import { arrayFrom, stringToSlug } from '@noeldemartin/utils';
2
2
  import { Node, SyntaxKind } from 'ts-morph';
3
3
  import type { ArrayLiteralExpression, CallExpression, SourceFile } from 'ts-morph';
4
4
 
@@ -9,7 +9,6 @@ import Template from '@aerogel/cli/lib/Template';
9
9
  import { app } from '@aerogel/cli/lib/utils/app';
10
10
  import { editFiles, findDescendant } from '@aerogel/cli/lib/utils/edit';
11
11
  import { templatePath } from '@aerogel/cli/lib/utils/paths';
12
- import type { CommandOptions } from '@aerogel/cli/commands/Command';
13
12
 
14
13
  export interface Options {
15
14
  button?: boolean;
@@ -26,52 +25,21 @@ export class GenerateComponentCommand extends Command {
26
25
  ['path', 'Component path (relative to components folder; extension not necessary)'],
27
26
  ];
28
27
 
29
- protected static override options: CommandOptions = {
30
- button: {
31
- description: 'Create a custom button',
32
- type: 'boolean',
33
- },
34
- checkbox: {
35
- description: 'Create a custom checkbox',
36
- type: 'boolean',
37
- },
38
- input: {
39
- description: 'Create a custom input',
40
- type: 'boolean',
41
- },
42
- story: {
43
- description: 'Create component story using Histoire',
44
- type: 'boolean',
45
- },
46
- };
47
-
48
28
  private path: string;
49
- private options: Options;
50
29
 
51
- constructor(path: string, options: Options = {}) {
30
+ constructor(path: string) {
52
31
  super();
53
32
 
54
33
  this.path = path;
55
- this.options = options;
56
- }
57
-
58
- protected override async validate(): Promise<void> {
59
- const components = arrayFilter([this.options.button, this.options.input, this.options.checkbox]).length;
60
-
61
- if (components > 1) {
62
- Log.fail('Can only use one of \'button\', \'input\', or \'checkbox\' flags!');
63
- }
64
34
  }
65
35
 
66
36
  protected override async run(): Promise<void> {
67
37
  this.assertAerogelOrDirectory('src/components');
68
- this.assertHistoireInstalled();
69
38
 
70
39
  const files = new Set<string>();
71
40
  const [directoryName, componentName] = this.parsePathComponents();
72
41
 
73
42
  await this.createComponent(directoryName, componentName, files);
74
- await this.createStory(directoryName, componentName, files);
75
43
  await this.declareComponents();
76
44
 
77
45
  const filesList = arrayFrom(files)
@@ -81,33 +49,13 @@ export class GenerateComponentCommand extends Command {
81
49
  Log.info(`${componentName} component created successfully! The following files were created:\n\n${filesList}`);
82
50
  }
83
51
 
84
- protected assertHistoireInstalled(): void {
85
- if (!this.options.story) {
86
- return;
87
- }
88
-
89
- if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
90
- Log.fail(`
91
- Histoire is not installed yet! You can install it running:
92
- npx gel install histoire
93
- `);
94
- }
95
- }
96
-
97
52
  protected async createComponent(directoryName: string, componentName: string, files: Set<string>): Promise<void> {
98
53
  await Log.animate('Creating component', async () => {
99
54
  if (File.exists(`src/components/${this.path}.vue`)) {
100
55
  Log.fail(`${this.path} component already exists!`);
101
56
  }
102
57
 
103
- const templateName = this.options.input
104
- ? 'component-input'
105
- : this.options.button
106
- ? 'component-button'
107
- : this.options.checkbox
108
- ? 'component-checkbox'
109
- : 'component';
110
- const componentFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
58
+ const componentFiles = Template.instantiate(templatePath('component'), `src/components/${directoryName}`, {
111
59
  component: {
112
60
  name: componentName,
113
61
  slug: stringToSlug(componentName),
@@ -118,30 +66,6 @@ export class GenerateComponentCommand extends Command {
118
66
  });
119
67
  }
120
68
 
121
- protected async createStory(directoryName: string, componentName: string, files: Set<string>): Promise<void> {
122
- if (!this.options.story) {
123
- return;
124
- }
125
-
126
- await Log.animate('Creating story', async () => {
127
- const templateName = this.options.input
128
- ? 'component-input-story'
129
- : this.options.button
130
- ? 'component-button-story'
131
- : this.options.checkbox
132
- ? 'component-checkbox-story'
133
- : 'component-story';
134
- const storyFiles = Template.instantiate(templatePath(templateName), `src/components/${directoryName}`, {
135
- component: {
136
- name: componentName,
137
- slug: stringToSlug(componentName),
138
- },
139
- });
140
-
141
- storyFiles.forEach((file) => files.add(file));
142
- });
143
- }
144
-
145
69
  protected async declareComponents(): Promise<void> {
146
70
  if (!editFiles()) {
147
71
  return;
@@ -24,4 +24,12 @@ describe('Install plugin command', () => {
24
24
  ShellMock.expectRan('npm install @aerogel/plugin-soukai@next --save-exact');
25
25
  });
26
26
 
27
+ it('installs local-first', async () => {
28
+ // Act
29
+ await InstallCommand.run('local-first');
30
+
31
+ // Assert
32
+ ShellMock.expectRan('npm install @aerogel/plugin-local-first@next --save-exact');
33
+ });
34
+
27
35
  });
@@ -1,10 +1,11 @@
1
1
  import Command from '@aerogel/cli/commands/Command';
2
+ import LocalFirst from '@aerogel/cli/plugins/LocalFirst';
2
3
  import Log from '@aerogel/cli/lib/Log';
3
- import { Solid } from '@aerogel/cli/plugins/Solid';
4
- import { Soukai } from '@aerogel/cli/plugins/Soukai';
4
+ import Solid from '@aerogel/cli/plugins/Solid';
5
+ import Soukai from '@aerogel/cli/plugins/Soukai';
5
6
  import type Plugin from '@aerogel/cli/plugins/Plugin';
6
7
 
7
- const plugins = [new Soukai(), new Solid()].reduce(
8
+ const plugins = [new Soukai(), new Solid(), new LocalFirst()].reduce(
8
9
  (pluginsObject, plugin) => Object.assign(pluginsObject, { [plugin.name]: plugin }),
9
10
  {} as Record<string, Plugin>,
10
11
  );
package/src/lib/Editor.ts CHANGED
@@ -16,7 +16,6 @@ export class Editor {
16
16
  this.modifiedFiles = new Set();
17
17
 
18
18
  this.project.addSourceFilesAtPaths('src/**/*.ts');
19
- this.project.addSourceFilesAtPaths('tailwind.config.js');
20
19
  this.project.addSourceFilesAtPaths('vite.config.ts');
21
20
  this.project.addSourceFilesAtPaths('package.json');
22
21
  }
@@ -0,0 +1,9 @@
1
+ import Plugin from '@aerogel/cli/plugins/Plugin';
2
+
3
+ export default class LocalFirst extends Plugin {
4
+
5
+ constructor() {
6
+ super('local-first');
7
+ }
8
+
9
+ }
@@ -1,4 +1,5 @@
1
1
  import { Node, SyntaxKind } from 'ts-morph';
2
+ import { stringToCamelCase } from '@noeldemartin/utils';
2
3
  import type { ArrayLiteralExpression, ImportDeclarationStructure, OptionalKind, SourceFile } from 'ts-morph';
3
4
 
4
5
  import Log from '@aerogel/cli/lib/Log';
@@ -101,25 +102,6 @@ export default abstract class Plugin {
101
102
  });
102
103
  }
103
104
 
104
- protected async updateTailwindConfig(editor: Editor, options: { content: string }): Promise<void> {
105
- await Log.animate('Updating tailwind configuration', async () => {
106
- const tailwindConfig = editor.requireSourceFile('tailwind.config.js');
107
- const contentArray = this.getTailwindContentArray(tailwindConfig);
108
-
109
- if (!contentArray) {
110
- return Log.fail(`
111
- Could not find content array in tailwind config, please add the following manually:
112
-
113
- ${options.content}
114
- `);
115
- }
116
-
117
- contentArray.addElement(options.content);
118
-
119
- await editor.save(tailwindConfig);
120
- });
121
- }
122
-
123
105
  protected getBootstrapPluginsDeclaration(mainConfig: SourceFile): ArrayLiteralExpression | null {
124
106
  const bootstrapAppCall = findDescendant(mainConfig, {
125
107
  guard: Node.isCallExpression,
@@ -154,7 +136,7 @@ export default abstract class Plugin {
154
136
 
155
137
  protected getBootstrapImport(): OptionalKind<ImportDeclarationStructure> {
156
138
  return {
157
- defaultImport: this.name,
139
+ defaultImport: stringToCamelCase(this.name),
158
140
  moduleSpecifier: `@aerogel/plugin-${this.name}`,
159
141
  };
160
142
  }
@@ -172,7 +154,7 @@ export default abstract class Plugin {
172
154
  }
173
155
 
174
156
  protected getBootstrapConfig(): string {
175
- return `${this.name}()`;
157
+ return `${stringToCamelCase(this.name)}()`;
176
158
  }
177
159
 
178
160
  }
@@ -2,23 +2,15 @@ import File from '@aerogel/cli/lib/File';
2
2
  import Log from '@aerogel/cli/lib/Log';
3
3
  import Plugin from '@aerogel/cli/plugins/Plugin';
4
4
  import Shell from '@aerogel/cli/lib/Shell';
5
- import { isLinkedLocalApp } from '@aerogel/cli/lib/utils/app';
6
- import { packagePath } from '@aerogel/cli/lib/utils/paths';
7
5
  import type { Editor } from '@aerogel/cli/lib/Editor';
8
6
 
9
- export class Solid extends Plugin {
7
+ export default class Solid extends Plugin {
10
8
 
11
9
  constructor() {
12
10
  super('solid');
13
11
  }
14
12
 
15
13
  protected override async updateFiles(editor: Editor): Promise<void> {
16
- await this.updateTailwindConfig(editor, {
17
- content: isLinkedLocalApp()
18
- ? `'${packagePath('plugin-solid')}/dist/**/*.js'`
19
- : '\'./node_modules/@aerogel/plugin-solid/dist/**/*.js\'',
20
- });
21
-
22
14
  await this.updateNpmScripts(editor);
23
15
  await this.updateGitIgnore();
24
16
  await super.updateFiles(editor);
@@ -1,7 +1,7 @@
1
1
  import Plugin from '@aerogel/cli/plugins/Plugin';
2
2
  import Shell from '@aerogel/cli/lib/Shell';
3
3
 
4
- export class Soukai extends Plugin {
4
+ export default class Soukai extends Plugin {
5
5
 
6
6
  constructor() {
7
7
  super('soukai');
@@ -3,6 +3,7 @@
3
3
  "configurations": [
4
4
  {
5
5
  "type": "node",
6
+ "runtimeVersion": "22.14.0",
6
7
  "request": "launch",
7
8
  "name": "Debug Current Test File",
8
9
  "autoAttachChildProcesses": true,
@@ -1,12 +1,12 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" class="h-full w-full">
2
+ <html lang="en" class="size-full">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>{{ app.name }}</title>
7
7
  {{ socialMeta() }}
8
8
  </head>
9
- <body class="h-full w-full text-base font-normal leading-tight text-gray-900 antialiased">
9
+ <body class="size-full text-base font-normal leading-tight text-gray-900 antialiased">
10
10
  <div id="app" class="loading h-full"></div>
11
11
  <script type="module" src="./src/main.ts"></script>
12
12
  </body>
@@ -21,14 +21,14 @@
21
21
  "@aerogel/core": "<% &dependencies.aerogelCore %>",
22
22
  "@aerogel/plugin-i18n": "<% &dependencies.aerogelPluginI18n %>",
23
23
  "@aerogel/plugin-soukai": "<% &dependencies.aerogelPluginSoukai %>",
24
- "@intlify/unplugin-vue-i18n": "^0.12.2",
24
+ "@intlify/unplugin-vue-i18n": "^6.0.5",
25
25
  "@noeldemartin/utils": "next",
26
- "@tailwindcss/forms": "^0.5.3",
27
- "@tailwindcss/typography": "^0.5.9",
26
+ "@tailwindcss/forms": "^0.5.10",
27
+ "@tailwindcss/typography": "^0.5.16",
28
28
  "soukai": "next",
29
- "tailwindcss": "^3.3.2",
30
- "vue": "^3.3.0",
31
- "vue-i18n": "9.3.0-beta.19"
29
+ "tailwindcss": "^4.1.1",
30
+ "vue": "^3.5.13",
31
+ "vue-i18n": "^11.1.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@aerogel/cli": "<% &dependencies.aerogelCli %>",
@@ -43,7 +43,8 @@
43
43
  "@vue/tsconfig": "^0.7.0",
44
44
  "autoprefixer": "^10.4.14",
45
45
  "concurrently": "^8.2.0",
46
- "cypress": "^14.2.0",
46
+ "cypress": "14.2.0",
47
+ "prettier-plugin-tailwindcss": "^0.6.11",
47
48
  "start-server-and-test": "^2.0.0",
48
49
  "typescript": "^5.8.2",
49
50
  "unplugin-icons": "^0.16.3",
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <AGAppLayout class="bg-blue-50">
3
- <main class="flex flex-grow flex-col items-center justify-center">
2
+ <AppLayout class="bg-blue-50">
3
+ <main class="flex grow flex-col items-center justify-center">
4
4
  <h1 class="text-4xl font-semibold">
5
5
  {{ $t('home.title') }}
6
6
  </h1>
@@ -8,5 +8,5 @@
8
8
  {{ $t('home.getStarted') }}
9
9
  </a>
10
10
  </main>
11
- </AGAppLayout>
11
+ </AppLayout>
12
12
  </template>
@@ -1,3 +1,4 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
1
+ @import 'tailwindcss';
2
+ @import '@aerogel/core';
3
+ @plugin '@tailwindcss/forms';
4
+ @plugin '@tailwindcss/typography';
@@ -1,85 +0,0 @@
1
- import { arrayFrom } from '@noeldemartin/utils';
2
-
3
- import Command from '@aerogel/cli/commands/Command';
4
- import File from '@aerogel/cli/lib/File';
5
- import Log from '@aerogel/cli/lib/Log';
6
- import Template from '@aerogel/cli/lib/Template';
7
- import { templatePath } from '@aerogel/cli/lib/utils/paths';
8
- import type { CommandOptions } from '@aerogel/cli/commands/Command';
9
-
10
- export interface Options {
11
- story?: boolean;
12
- }
13
-
14
- export class GenerateOverridesCommand extends Command {
15
-
16
- protected static override command: string = 'generate:overrides';
17
- protected static override description: string = 'Generate AerogelJS component overrides';
18
-
19
- protected static override options: CommandOptions = {
20
- story: {
21
- description: 'Create overrides story using Histoire',
22
- type: 'boolean',
23
- },
24
- };
25
-
26
- private options: Options;
27
-
28
- constructor(options: Options = {}) {
29
- super();
30
-
31
- this.options = options;
32
- }
33
-
34
- protected override async run(): Promise<void> {
35
- this.assertAerogelOrDirectory('src/components');
36
- this.assertHistoireInstalled();
37
-
38
- const files = new Set<string>();
39
-
40
- await this.createComponents(files);
41
- await this.createStory(files);
42
-
43
- const filesList = arrayFrom(files)
44
- .map((file) => `- ${file}`)
45
- .join('\n');
46
-
47
- Log.info(`Overrides created successfully! The following files were created:\n\n${filesList}`);
48
- Log.info('\nRemember to declare your components in main.ts and main.histoire.ts!');
49
- }
50
-
51
- protected assertHistoireInstalled(): void {
52
- if (!this.options.story) {
53
- return;
54
- }
55
-
56
- if (!File.contains('package.json', '"histoire"') && !File.contains('package.json', '"@aerogel/histoire"')) {
57
- Log.fail(`
58
- Histoire is not installed yet! You can install it running:
59
- npx gel install histoire
60
- `);
61
- }
62
- }
63
-
64
- protected async createComponents(files: Set<string>): Promise<void> {
65
- await Log.animate('Creating components', async () => {
66
- if (File.exists('src/components/ModalWrapper.vue')) {
67
- Log.fail('ModalWrapper component already exists!');
68
- }
69
-
70
- Template.instantiate(templatePath('overrides'), 'src').forEach((file) => files.add(file));
71
- });
72
- }
73
-
74
- protected async createStory(files: Set<string>): Promise<void> {
75
- if (!this.options.story) {
76
- return;
77
- }
78
-
79
- await Log.animate('Creating story', async () => {
80
- Template.instantiate(templatePath('overrides-story'), 'src/components/overrides/').forEach((file) =>
81
- files.add(file));
82
- });
83
- }
84
-
85
- }
@@ -1,6 +0,0 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -1,5 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: ['./index.html', './src/**/*.{vue,ts}', '<% &contentPath %>'],
4
- plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
5
- };
@@ -1,42 +0,0 @@
1
- <template>
2
- <AGHeadlessButton :class="variantClasses" :disabled="disabled">
3
- <slot />
4
- </AGHeadlessButton>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import { Colors, booleanProp, enumProp, removeInteractiveClasses } from '@aerogel/core';
9
- import { computed } from 'vue';
10
-
11
- const props = defineProps({
12
- color: enumProp(Colors, Colors.Primary),
13
- disabled: booleanProp(),
14
- });
15
-
16
- const colorClasses = computed(() => {
17
- switch (props.color) {
18
- case Colors.Secondary:
19
- // Add your custom color classes here.
20
- return '';
21
- case Colors.Clear:
22
- // Add your custom color classes here.
23
- return '';
24
- case Colors.Danger:
25
- // Add your custom color classes here.
26
- return '';
27
- case Colors.Primary:
28
- default:
29
- // Add your custom color classes here.
30
- return '';
31
- }
32
- });
33
-
34
- const variantClasses = computed(() => {
35
- if (props.disabled) {
36
- // Add additional classes for disabled state here.
37
- return removeInteractiveClasses(colorClasses.value);
38
- }
39
-
40
- return colorClasses.value;
41
- });
42
- </script>
@@ -1,77 +0,0 @@
1
- <template>
2
- <Story :layout="{ type: 'grid' }">
3
- <Variant title="Playground">
4
- <<% component.name %> :color="color">
5
- {{ content }}
6
- </<% component.name %>>
7
-
8
- <template #controls>
9
- <HstText v-model="content" title="Content" />
10
- <HstSelect v-model="color" title="Color" :options="colorOptions" />
11
- </template>
12
- </Variant>
13
-
14
- <Variant title="Default">
15
- <<% component.name %>>
16
- Click me!
17
- </<% component.name %>>
18
- </Variant>
19
-
20
- <Variant title="Hover">
21
- <<% component.name %> class=":hover">
22
- Click me!
23
- </<% component.name %>>
24
- </Variant>
25
-
26
- <Variant title="Focus">
27
- <<% component.name %> class=":focus :focus-visible">
28
- Click me!
29
- </<% component.name %>>
30
- </Variant>
31
-
32
- <Variant title="Disabled">
33
- <<% component.name %> disabled>
34
- You can't click me
35
- </<% component.name %>>
36
- </Variant>
37
-
38
- <Variant title="Colors" :layout="{ width: '300px' }">
39
- <div class="flex items-center gap-2">
40
- <<% component.name %> color="primary">
41
- Primary
42
- </<% component.name %>>
43
- <<% component.name %> color="secondary">
44
- Secondary
45
- </<% component.name %>>
46
- <<% component.name %> color="danger">
47
- Danger
48
- </<% component.name %>>
49
- <<% component.name %> color="clear">
50
- Clear
51
- </<% component.name %>>
52
- </div>
53
- </Variant>
54
- </Story>
55
- </template>
56
-
57
- <script setup lang="ts">
58
- import { Colors } from '@aerogel/core';
59
- import { invert } from '@noeldemartin/utils';
60
- import { ref } from 'vue';
61
- import type { Color } from '@aerogel/core';
62
-
63
- const content = ref('Click me!');
64
- const color = ref<Color>(Colors.Primary);
65
- const colorOptions = invert(Colors);
66
- </script>
67
-
68
- <style>
69
- .story-<% component.slug %> {
70
- grid-template-columns: repeat(2, 300px) !important;
71
- }
72
-
73
- .story-<% component.slug %> .variant-playground,
74
- .story-<% component.slug %> .variant-colors{
75
- grid-column: 1 / -1;
76
- }
77
- </style>
@@ -1,34 +0,0 @@
1
- <template>
2
- <AGHeadlessInput
3
- ref="$input"
4
- :name="name"
5
- :class="className"
6
- :label="label"
7
- >
8
- <AGHeadlessInputInput
9
- v-bind="attrs"
10
- type="checkbox"
11
- />
12
- <div v-if="$slots.default">
13
- <AGHeadlessInputLabel>
14
- <slot />
15
- </AGHeadlessInputLabel>
16
- <AGHeadlessInputError />
17
- </div>
18
- </AGHeadlessInput>
19
- </template>
20
-
21
- <script setup lang="ts">
22
- import { AGHeadlessInputLabel, componentRef, stringProp, useInputAttrs } from '@aerogel/core';
23
- import type { IAGHeadlessInput } from '@aerogel/core';
24
-
25
- defineOptions({ inheritAttrs: false });
26
- defineProps({
27
- name: stringProp(),
28
- label: stringProp(),
29
- inputClass: stringProp(''),
30
- });
31
-
32
- const $input = componentRef<IAGHeadlessInput>();
33
- const [attrs, className] = useInputAttrs();
34
- </script>
@@ -1,63 +0,0 @@
1
- <template>
2
- <Story group="base" :layout="{ type: 'grid' }">
3
- <Variant title="Playground">
4
- <AGForm :form="form" class="m-1">
5
- <<% component.name %> name="accept" :form="form">
6
- {{ label }}
7
- </<% component.name %>>
8
- </AGForm>
9
-
10
- <template #controls>
11
- <HstText v-model="label" title="Label" />
12
- </template>
13
- </Variant>
14
-
15
- <Variant title="Default">
16
- <<% component.name %> class="m-1">
17
- Accept Terms & Conditions
18
- </<% component.name %>>
19
- </Variant>
20
-
21
- <Variant title="Hover">
22
- <<% component.name %> class="m-1" input-class=":hover">
23
- Accept Terms & Conditions
24
- </<% component.name %>>
25
- </Variant>
26
-
27
- <Variant title="Focus">
28
- <<% component.name %> class="m-1" input-class=":focus :focus-visible">
29
- Accept Terms & Conditions
30
- </<% component.name %>>
31
- </Variant>
32
-
33
- <Variant title="Error">
34
- <AGForm :form="errorForm" class="m-1">
35
- <<% component.name %> name="accept">
36
- Accept Terms & Conditions
37
- </<% component.name %>>
38
- </AGForm>
39
- </Variant>
40
- </Story>
41
- </template>
42
-
43
- <script setup lang="ts">
44
- import { requiredBooleanInput, useForm } from '@aerogel/core';
45
- import { ref } from 'vue';
46
-
47
- const form = useForm({ accept: requiredBooleanInput(true) });
48
- const errorForm = useForm({ accept: requiredBooleanInput() });
49
- const label = ref('Accept Terms & Conditions');
50
-
51
- form.submit();
52
- errorForm.submit();
53
- </script>
54
-
55
- <style>
56
- .story-<% component.slug %> {
57
- grid-template-columns: repeat(2, 300px) !important;
58
- }
59
-
60
- .story-<% component.slug %> .variant-playground {
61
- grid-column: 1 / -1;
62
- }
63
- </style>