@hmscodes/honey-core 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 (40) hide show
  1. package/.editorconfig +17 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +59 -0
  6. package/angular.json +61 -0
  7. package/package.json +48 -0
  8. package/projects/honey-core/.storybook/main.ts +18 -0
  9. package/projects/honey-core/.storybook/preview.ts +14 -0
  10. package/projects/honey-core/.storybook/tsconfig.json +11 -0
  11. package/projects/honey-core/.storybook/typings.d.ts +4 -0
  12. package/projects/honey-core/README.md +63 -0
  13. package/projects/honey-core/ng-package.json +7 -0
  14. package/projects/honey-core/package.json +12 -0
  15. package/projects/honey-core/src/lib/components/button/button.component.html +8 -0
  16. package/projects/honey-core/src/lib/components/button/button.component.scss +47 -0
  17. package/projects/honey-core/src/lib/components/button/button.component.spec.ts +23 -0
  18. package/projects/honey-core/src/lib/components/button/button.component.ts +44 -0
  19. package/projects/honey-core/src/lib/honey-core.component.spec.ts +23 -0
  20. package/projects/honey-core/src/lib/honey-core.component.ts +15 -0
  21. package/projects/honey-core/src/lib/honey-core.service.spec.ts +16 -0
  22. package/projects/honey-core/src/lib/honey-core.service.ts +9 -0
  23. package/projects/honey-core/src/public-api.ts +6 -0
  24. package/projects/honey-core/src/stories/.eslintrc.json +5 -0
  25. package/projects/honey-core/src/stories/Colors.mdx +40 -0
  26. package/projects/honey-core/src/stories/Presentation.mdx +7 -0
  27. package/projects/honey-core/src/stories/button.component.stories.ts +67 -0
  28. package/projects/honey-core/src/stories/button.css +30 -0
  29. package/projects/honey-core/src/stories/header.component.ts +75 -0
  30. package/projects/honey-core/src/stories/header.css +32 -0
  31. package/projects/honey-core/src/stories/header.stories.ts +33 -0
  32. package/projects/honey-core/src/stories/page.component.ts +82 -0
  33. package/projects/honey-core/src/stories/page.css +68 -0
  34. package/projects/honey-core/src/stories/page.stories.ts +32 -0
  35. package/projects/honey-core/src/stories/user.ts +3 -0
  36. package/projects/honey-core/src/styles/variables.scss +18 -0
  37. package/projects/honey-core/tsconfig.lib.json +15 -0
  38. package/projects/honey-core/tsconfig.lib.prod.json +11 -0
  39. package/projects/honey-core/tsconfig.spec.json +15 -0
  40. package/tsconfig.json +32 -0
package/.editorconfig ADDED
@@ -0,0 +1,17 @@
1
+ # Editor configuration, see https://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.ts]
12
+ quote_type = single
13
+ ij_typescript_use_double_quotes = false
14
+
15
+ [*.md]
16
+ max_line_length = off
17
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3
+ "recommendations": ["angular.ng-template"]
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3
+ "version": "0.2.0",
4
+ "configurations": [
5
+ {
6
+ "name": "ng serve",
7
+ "type": "chrome",
8
+ "request": "launch",
9
+ "preLaunchTask": "npm: start",
10
+ "url": "http://localhost:4200/"
11
+ },
12
+ {
13
+ "name": "ng test",
14
+ "type": "chrome",
15
+ "request": "launch",
16
+ "preLaunchTask": "npm: test",
17
+ "url": "http://localhost:9876/debug.html"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
+ "version": "2.0.0",
4
+ "tasks": [
5
+ {
6
+ "type": "npm",
7
+ "script": "start",
8
+ "isBackground": true,
9
+ "problemMatcher": {
10
+ "owner": "typescript",
11
+ "pattern": "$tsc",
12
+ "background": {
13
+ "activeOnStart": true,
14
+ "beginsPattern": {
15
+ "regexp": "(.*?)"
16
+ },
17
+ "endsPattern": {
18
+ "regexp": "bundle generation complete"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ {
24
+ "type": "npm",
25
+ "script": "test",
26
+ "isBackground": true,
27
+ "problemMatcher": {
28
+ "owner": "typescript",
29
+ "pattern": "$tsc",
30
+ "background": {
31
+ "activeOnStart": true,
32
+ "beginsPattern": {
33
+ "regexp": "(.*?)"
34
+ },
35
+ "endsPattern": {
36
+ "regexp": "bundle generation complete"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # HoneyCore
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.4.
4
+
5
+ ## Development server
6
+
7
+ To start a local development server, run:
8
+
9
+ ```bash
10
+ ng serve
11
+ ```
12
+
13
+ Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
14
+
15
+ ## Code scaffolding
16
+
17
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
18
+
19
+ ```bash
20
+ ng generate component component-name
21
+ ```
22
+
23
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
24
+
25
+ ```bash
26
+ ng generate --help
27
+ ```
28
+
29
+ ## Building
30
+
31
+ To build the project run:
32
+
33
+ ```bash
34
+ ng build
35
+ ```
36
+
37
+ This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
38
+
39
+ ## Running unit tests
40
+
41
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
42
+
43
+ ```bash
44
+ ng test
45
+ ```
46
+
47
+ ## Running end-to-end tests
48
+
49
+ For end-to-end (e2e) testing, run:
50
+
51
+ ```bash
52
+ ng e2e
53
+ ```
54
+
55
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
56
+
57
+ ## Additional Resources
58
+
59
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
package/angular.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "newProjectRoot": "projects",
5
+ "projects": {
6
+ "honey-core": {
7
+ "projectType": "library",
8
+ "root": "projects/honey-core",
9
+ "sourceRoot": "projects/honey-core/src",
10
+ "prefix": "lib",
11
+ "architect": {
12
+ "build": {
13
+ "builder": "@angular-devkit/build-angular:ng-packagr",
14
+ "options": {
15
+ "project": "projects/honey-core/ng-package.json"
16
+ },
17
+ "configurations": {
18
+ "production": {
19
+ "tsConfig": "projects/honey-core/tsconfig.lib.prod.json"
20
+ },
21
+ "development": {
22
+ "tsConfig": "projects/honey-core/tsconfig.lib.json"
23
+ }
24
+ },
25
+ "defaultConfiguration": "production"
26
+ },
27
+ "test": {
28
+ "builder": "@angular-devkit/build-angular:karma",
29
+ "options": {
30
+ "tsConfig": "projects/honey-core/tsconfig.spec.json",
31
+ "polyfills": [
32
+ "zone.js",
33
+ "zone.js/testing"
34
+ ]
35
+ }
36
+ },
37
+ "storybook": {
38
+ "builder": "@storybook/angular:start-storybook",
39
+ "options": {
40
+ "configDir": "projects/honey-core/.storybook",
41
+ "browserTarget": "honey-core:build",
42
+ "compodoc": false,
43
+ "port": 6006,
44
+ "styles": [
45
+ "projects/honey-core/src/styles/variables.scss"
46
+ ]
47
+ }
48
+ },
49
+ "build-storybook": {
50
+ "builder": "@storybook/angular:build-storybook",
51
+ "options": {
52
+ "configDir": "projects/honey-core/.storybook",
53
+ "browserTarget": "honey-core:build",
54
+ "compodoc": false,
55
+ "outputDir": "storybook-static"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@hmscodes/honey-core",
3
+ "version": "1.0.0",
4
+ "scripts": {
5
+ "ng": "ng",
6
+ "start": "ng serve",
7
+ "build": "ng build",
8
+ "watch": "ng build --watch --configuration development",
9
+ "test": "ng test",
10
+ "storybook": "ng run honey-core:storybook",
11
+ "build-storybook": "ng run honey-core:build-storybook"
12
+ },
13
+ "private": false,
14
+ "dependencies": {
15
+ "@angular/common": "^19.2.0",
16
+ "@angular/compiler": "^19.2.0",
17
+ "@angular/core": "^19.2.0",
18
+ "@angular/forms": "^19.2.0",
19
+ "@angular/platform-browser": "^19.2.0",
20
+ "@angular/platform-browser-dynamic": "^19.2.0",
21
+ "@angular/router": "^19.2.0",
22
+ "rxjs": "~7.8.0",
23
+ "tslib": "^2.3.0",
24
+ "zone.js": "~0.15.0"
25
+ },
26
+ "devDependencies": {
27
+ "@angular-devkit/build-angular": "^19.2.8",
28
+ "@angular/cli": "^19.2.4",
29
+ "@angular/compiler-cli": "^19.2.0",
30
+ "@storybook/addon-essentials": "^8.6.12",
31
+ "@storybook/addon-interactions": "^8.6.12",
32
+ "@storybook/addon-onboarding": "^8.6.12",
33
+ "@storybook/angular": "^8.6.12",
34
+ "@storybook/blocks": "^8.6.12",
35
+ "@storybook/test": "^8.6.12",
36
+ "@types/jasmine": "~5.1.0",
37
+ "jasmine-core": "~5.6.0",
38
+ "karma": "~6.4.0",
39
+ "karma-chrome-launcher": "~3.2.0",
40
+ "karma-coverage": "~2.2.0",
41
+ "karma-jasmine": "~5.1.0",
42
+ "karma-jasmine-html-reporter": "~2.1.0",
43
+ "ng-packagr": "^19.2.0",
44
+ "sass": "^1.87.0",
45
+ "storybook": "^8.6.12",
46
+ "typescript": "~5.7.2"
47
+ }
48
+ }
@@ -0,0 +1,18 @@
1
+ import type { StorybookConfig } from '@storybook/angular';
2
+
3
+ const config: StorybookConfig = {
4
+ "stories": [
5
+ "../src/**/*.mdx",
6
+ "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
7
+ ],
8
+ "addons": [
9
+ "@storybook/addon-essentials",
10
+ "@storybook/addon-onboarding",
11
+ "@storybook/addon-interactions"
12
+ ],
13
+ "framework": {
14
+ "name": "@storybook/angular",
15
+ "options": {}
16
+ }
17
+ };
18
+ export default config;
@@ -0,0 +1,14 @@
1
+ import type { Preview } from '@storybook/angular'
2
+
3
+ const preview: Preview = {
4
+ parameters: {
5
+ controls: {
6
+ matchers: {
7
+ color: /(background|color)$/i,
8
+ date: /Date$/i,
9
+ },
10
+ },
11
+ },
12
+ };
13
+
14
+ export default preview;
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "types": ["node"],
5
+ "allowSyntheticDefaultImports": true,
6
+ "resolveJsonModule": true
7
+ },
8
+ "exclude": ["../src/test.ts", "../src/**/*.spec.ts"],
9
+ "include": ["../src/**/*.stories.*", "./preview.ts"],
10
+ "files": ["./typings.d.ts"]
11
+ }
@@ -0,0 +1,4 @@
1
+ declare module '*.md' {
2
+ const content: string;
3
+ export default content;
4
+ }
@@ -0,0 +1,63 @@
1
+ # HoneyCore
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build honey-core
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/honey-core
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
42
+
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
+
61
+ ## Additional Resources
62
+
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/honey-core",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "honey-core",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^19.2.0",
6
+ "@angular/core": "^19.2.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false
12
+ }
@@ -0,0 +1,8 @@
1
+ <button
2
+ type="button"
3
+ [class]="classes"
4
+ [disabled]="disabled"
5
+ (click)="onClick.emit($event)"
6
+ >
7
+ <ng-content />
8
+ </button>
@@ -0,0 +1,47 @@
1
+ .hc-button {
2
+ display : inline-block;
3
+ cursor : pointer;
4
+ border : 0;
5
+ border-radius : 4px;
6
+ font-weight : 700;
7
+ line-height : 1;
8
+ font-family : 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
9
+
10
+
11
+ &:disabled {
12
+ cursor : not-allowed;
13
+ background : var(--hc-disabled-bg);
14
+ color : var(--hc-disabled-text);
15
+
16
+ &:hover {
17
+ background : var(--hc-disabled-bg);
18
+ color : var(--hc-disabled-text);
19
+ }
20
+ }
21
+ }
22
+
23
+ .hc-primary {
24
+ background-color : var(--hc-background-primary);
25
+ color : white;
26
+
27
+ &:hover {
28
+ background-color : var(--hc-background-primary-hover);
29
+ }
30
+ }
31
+
32
+ .hc-secondary {
33
+ background-color : var(--hc-secondary-500);
34
+ color : white;
35
+ }
36
+ .hc-small {
37
+ padding : 10px 16px;
38
+ font-size : 12px;
39
+ }
40
+ .hc-medium {
41
+ padding : 10px 20px;
42
+ font-size : 14px;
43
+ }
44
+ .hc-large {
45
+ padding : 12px 24px;
46
+ font-size : 16px;
47
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ButtonComponent } from './button.component';
4
+
5
+ describe('ButtonComponent', () => {
6
+ let component: ButtonComponent;
7
+ let fixture: ComponentFixture<ButtonComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [ButtonComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(ButtonComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,44 @@
1
+ import { Component, Input, Output, EventEmitter } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'hc-button',
5
+ templateUrl: './button.component.html',
6
+ styleUrl: './button.component.scss',
7
+ imports: [],
8
+ standalone: true,
9
+ })
10
+ export class ButtonComponent {
11
+ /** Is this the principal call to action on the page? */
12
+ @Input()
13
+ variant: 'primary' | 'secondary' = 'primary';
14
+
15
+ /** What background color to use */
16
+ @Input()
17
+ backgroundColor?: string;
18
+
19
+ /** How large should the button be? */
20
+ @Input()
21
+ size: 'small' | 'medium' | 'large' = 'medium';
22
+
23
+ /**
24
+ * Button contents
25
+ *
26
+ * @required
27
+ */
28
+ @Input()
29
+ label = 'Button';
30
+
31
+ /**
32
+ * Disabled state of the button
33
+ */
34
+ @Input()
35
+ disabled = false;
36
+
37
+ /** Optional click handler */
38
+ @Output()
39
+ onClick = new EventEmitter<Event>();
40
+
41
+ public get classes(): string[] {
42
+ return ['hc-button', `hc-${this.size}`, `hc-${this.variant}`];
43
+ }
44
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { HoneyCoreComponent } from './honey-core.component';
4
+
5
+ describe('HoneyCoreComponent', () => {
6
+ let component: HoneyCoreComponent;
7
+ let fixture: ComponentFixture<HoneyCoreComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [HoneyCoreComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(HoneyCoreComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,15 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'lib-honey-core',
5
+ imports: [],
6
+ template: `
7
+ <p>
8
+ honey-core works!
9
+ </p>
10
+ `,
11
+ styles: ``
12
+ })
13
+ export class HoneyCoreComponent {
14
+
15
+ }
@@ -0,0 +1,16 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { HoneyCoreService } from './honey-core.service';
4
+
5
+ describe('HoneyCoreService', () => {
6
+ let service: HoneyCoreService;
7
+
8
+ beforeEach(() => {
9
+ TestBed.configureTestingModule({});
10
+ service = TestBed.inject(HoneyCoreService);
11
+ });
12
+
13
+ it('should be created', () => {
14
+ expect(service).toBeTruthy();
15
+ });
16
+ });
@@ -0,0 +1,9 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ @Injectable({
4
+ providedIn: 'root'
5
+ })
6
+ export class HoneyCoreService {
7
+
8
+ constructor() { }
9
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface of honey-core
3
+ */
4
+
5
+ export * from './lib/honey-core.service';
6
+ export * from './lib/honey-core.component';
@@ -0,0 +1,5 @@
1
+ {
2
+ "rules": {
3
+ "@typescript-eslint/consistent-type-imports": ["error", { "disallowTypeAnnotations": false }]
4
+ }
5
+ }
@@ -0,0 +1,40 @@
1
+ import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
2
+
3
+ <Meta title="Colors" />
4
+
5
+ <ColorPalette>
6
+ <ColorItem
7
+ title="theme.color.primary"
8
+ subtitle="Honey Core"
9
+ colors={{
10
+ '--hc-primary-500': '#F55638',
11
+ '--hc-primary-600': '#F57738',
12
+ '--hc-primary-700': '#F59838',
13
+ }}
14
+ />
15
+ <ColorItem
16
+ title="theme.color.secondary"
17
+ subtitle="Honey Core Secondary"
18
+ colors={{
19
+ '--hc-secondary-500': '#FFC857',
20
+ '--hc-secondary-600': '#f7a838',
21
+ '--hc-secondary-700': '#d68d2a',
22
+ }}
23
+ />
24
+ <ColorItem
25
+ title="theme.color.brown"
26
+ subtitle="Honey Core Secondary"
27
+ colors={{
28
+ '--hc-brown-500': '#95570e',
29
+ '--hc-brown-600': '#753c00',
30
+ }}
31
+ />
32
+ <ColorItem
33
+ title="theme.color.greyscale"
34
+ subtitle="Some of the greys"
35
+ colors={{
36
+ '--hc-text-strong': '#2E282A',
37
+ '--hc-text-light': '#6C757D',
38
+ }}
39
+ />
40
+ </ColorPalette>
@@ -0,0 +1,7 @@
1
+ import { Meta } from "@storybook/blocks";
2
+
3
+ <Meta title="Apresentação" />
4
+
5
+ # Configure your project
6
+
7
+ HoneyCore is a reusable component library for Angular, crafted to bring consistency, efficiency, and style to personal projects. Inspired by the elegant structure of honeycombs, it’s built to scale and sweeten your workflow. 🐝
@@ -0,0 +1,67 @@
1
+ import { argsToTemplate, type Meta, type StoryObj } from '@storybook/angular';
2
+ import { fn } from '@storybook/test';
3
+ import { ButtonComponent } from '../lib/components/button/button.component';
4
+
5
+ type ButtonInputsAndCustomArgs = ButtonComponent & { text: string };
6
+
7
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
8
+ const meta: Meta<ButtonInputsAndCustomArgs> = {
9
+ title: 'Example/Button',
10
+ component: ButtonComponent,
11
+ tags: ['autodocs'],
12
+ args: {
13
+ text: 'Button',
14
+ },
15
+ render: ({ text, ...buttonArgs }) => ({
16
+ props: buttonArgs,
17
+ template: `
18
+ <hc-button ${argsToTemplate(buttonArgs)}>
19
+ ${text}
20
+ </hc-button>
21
+ `,
22
+ }),
23
+ };
24
+
25
+ export default meta;
26
+ type Story = StoryObj<ButtonComponent>;
27
+
28
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
29
+ export const Primary: Story = {
30
+ args: {
31
+ variant: 'primary',
32
+ },
33
+ };
34
+
35
+ export const PrimaryDisabled: Story = {
36
+ args: {
37
+ variant: 'primary',
38
+ disabled: true,
39
+ },
40
+ };
41
+
42
+ export const Secondary: Story = {
43
+ args: {
44
+ variant: 'secondary',
45
+ },
46
+ };
47
+
48
+ export const Large: Story = {
49
+ args: {
50
+ variant: 'primary',
51
+ size: 'large',
52
+ },
53
+ };
54
+
55
+ export const Medium: Story = {
56
+ args: {
57
+ variant: 'primary',
58
+ size: 'medium',
59
+ },
60
+ };
61
+
62
+ export const Small: Story = {
63
+ args: {
64
+ variant: 'primary',
65
+ size: 'small',
66
+ },
67
+ };
@@ -0,0 +1,30 @@
1
+ .storybook-button {
2
+ display: inline-block;
3
+ cursor: pointer;
4
+ border: 0;
5
+ border-radius: 3em;
6
+ font-weight: 700;
7
+ line-height: 1;
8
+ font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
9
+ }
10
+ .storybook-button--primary {
11
+ background-color: #555ab9;
12
+ color: white;
13
+ }
14
+ .storybook-button--secondary {
15
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
16
+ background-color: transparent;
17
+ color: #333;
18
+ }
19
+ .storybook-button--small {
20
+ padding: 10px 16px;
21
+ font-size: 12px;
22
+ }
23
+ .storybook-button--medium {
24
+ padding: 11px 20px;
25
+ font-size: 14px;
26
+ }
27
+ .storybook-button--large {
28
+ padding: 12px 24px;
29
+ font-size: 16px;
30
+ }
@@ -0,0 +1,75 @@
1
+ import { Component, Input, Output, EventEmitter } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+ import type { User } from './user';
5
+ import { ButtonComponent } from '../lib/components/button/button.component';
6
+
7
+ @Component({
8
+ selector: 'storybook-header',
9
+ standalone: true,
10
+ imports: [CommonModule, ButtonComponent],
11
+ template: `<header>
12
+ <div class="storybook-header">
13
+ <div>
14
+ <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
15
+ <g fill="none" fillRule="evenodd">
16
+ <path
17
+ d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
18
+ fill="#FFF"
19
+ />
20
+ <path
21
+ d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
22
+ fill="#555AB9"
23
+ />
24
+ <path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
25
+ </g>
26
+ </svg>
27
+ <h1>Acme</h1>
28
+ </div>
29
+ <div>
30
+ <div *ngIf="user">
31
+ <span class="welcome">
32
+ Welcome, <b>{{ user.name }}</b
33
+ >!
34
+ </span>
35
+ <hc-button
36
+ *ngIf="user"
37
+ size="small"
38
+ (onClick)="onLogout.emit($event)"
39
+ label="Log out"
40
+ ></hc-button>
41
+ </div>
42
+ <div *ngIf="!user">
43
+ <hc-button
44
+ *ngIf="!user"
45
+ size="small"
46
+ class="margin-left"
47
+ (onClick)="onLogin.emit($event)"
48
+ label="Log in"
49
+ ></hc-button>
50
+ <hc-button
51
+ *ngIf="!user"
52
+ size="small"
53
+ class="margin-left"
54
+ (onClick)="onCreateAccount.emit($event)"
55
+ label="Sign up"
56
+ ></hc-button>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </header>`,
61
+ styleUrls: ['./header.css'],
62
+ })
63
+ export class HeaderComponent {
64
+ @Input()
65
+ user: User | null = null;
66
+
67
+ @Output()
68
+ onLogin = new EventEmitter<Event>();
69
+
70
+ @Output()
71
+ onLogout = new EventEmitter<Event>();
72
+
73
+ @Output()
74
+ onCreateAccount = new EventEmitter<Event>();
75
+ }
@@ -0,0 +1,32 @@
1
+ .storybook-header {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ align-items: center;
5
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
6
+ padding: 15px 20px;
7
+ font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
8
+ }
9
+
10
+ .storybook-header svg {
11
+ display: inline-block;
12
+ vertical-align: top;
13
+ }
14
+
15
+ .storybook-header h1 {
16
+ display: inline-block;
17
+ vertical-align: top;
18
+ margin: 6px 0 6px 10px;
19
+ font-weight: 700;
20
+ font-size: 20px;
21
+ line-height: 1;
22
+ }
23
+
24
+ .storybook-header button + button {
25
+ margin-left: 10px;
26
+ }
27
+
28
+ .storybook-header .welcome {
29
+ margin-right: 10px;
30
+ color: #333;
31
+ font-size: 14px;
32
+ }
@@ -0,0 +1,33 @@
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+ import { fn } from '@storybook/test';
3
+
4
+ import { HeaderComponent } from './header.component';
5
+
6
+ const meta: Meta<HeaderComponent> = {
7
+ title: 'Example/Header',
8
+ component: HeaderComponent,
9
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
10
+ tags: ['autodocs'],
11
+ parameters: {
12
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
13
+ layout: 'fullscreen',
14
+ },
15
+ args: {
16
+ onLogin: fn(),
17
+ onLogout: fn(),
18
+ onCreateAccount: fn(),
19
+ },
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<HeaderComponent>;
24
+
25
+ export const LoggedIn: Story = {
26
+ args: {
27
+ user: {
28
+ name: 'Jane Doe',
29
+ },
30
+ },
31
+ };
32
+
33
+ export const LoggedOut: Story = {};
@@ -0,0 +1,82 @@
1
+ import { Component } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+ import { HeaderComponent } from './header.component';
5
+ import type { User } from './user';
6
+
7
+ @Component({
8
+ selector: 'storybook-page',
9
+ standalone: true,
10
+ imports: [CommonModule, HeaderComponent],
11
+ template: `<article>
12
+ <storybook-header
13
+ [user]="user"
14
+ (onLogout)="doLogout()"
15
+ (onLogin)="doLogin()"
16
+ (onCreateAccount)="doCreateAccount()"
17
+ ></storybook-header>
18
+ <section class="storybook-page">
19
+ <h2>Pages in Storybook</h2>
20
+ <p>
21
+ We recommend building UIs with a
22
+ <a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
23
+ <strong>component-driven</strong>
24
+ </a>
25
+ process starting with atomic components and ending with pages.
26
+ </p>
27
+ <p>
28
+ Render pages with mock data. This makes it easy to build and review page states without
29
+ needing to navigate to them in your app. Here are some handy patterns for managing page data
30
+ in Storybook:
31
+ </p>
32
+ <ul>
33
+ <li>
34
+ Use a higher-level connected component. Storybook helps you compose such data from the
35
+ "args" of child component stories
36
+ </li>
37
+ <li>
38
+ Assemble data in the page component from your services. You can mock these services out
39
+ using Storybook.
40
+ </li>
41
+ </ul>
42
+ <p>
43
+ Get a guided tutorial on component-driven development at
44
+ <a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
45
+ Storybook tutorials
46
+ </a>
47
+ . Read more in the
48
+ <a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer"> docs </a>
49
+ .
50
+ </p>
51
+ <div class="tip-wrapper">
52
+ <span class="tip">Tip</span> Adjust the width of the canvas with the
53
+ <svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
54
+ <g fill="none" fillRule="evenodd">
55
+ <path
56
+ d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
57
+ id="a"
58
+ fill="#999"
59
+ />
60
+ </g>
61
+ </svg>
62
+ Viewports addon in the toolbar
63
+ </div>
64
+ </section>
65
+ </article>`,
66
+ styleUrls: ['./page.css'],
67
+ })
68
+ export class PageComponent {
69
+ user: User | null = null;
70
+
71
+ doLogout() {
72
+ this.user = null;
73
+ }
74
+
75
+ doLogin() {
76
+ this.user = { name: 'Jane Doe' };
77
+ }
78
+
79
+ doCreateAccount() {
80
+ this.user = { name: 'Jane Doe' };
81
+ }
82
+ }
@@ -0,0 +1,68 @@
1
+ .storybook-page {
2
+ margin: 0 auto;
3
+ padding: 48px 20px;
4
+ max-width: 600px;
5
+ color: #333;
6
+ font-size: 14px;
7
+ line-height: 24px;
8
+ font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
9
+ }
10
+
11
+ .storybook-page h2 {
12
+ display: inline-block;
13
+ vertical-align: top;
14
+ margin: 0 0 4px;
15
+ font-weight: 700;
16
+ font-size: 32px;
17
+ line-height: 1;
18
+ }
19
+
20
+ .storybook-page p {
21
+ margin: 1em 0;
22
+ }
23
+
24
+ .storybook-page a {
25
+ color: inherit;
26
+ }
27
+
28
+ .storybook-page ul {
29
+ margin: 1em 0;
30
+ padding-left: 30px;
31
+ }
32
+
33
+ .storybook-page li {
34
+ margin-bottom: 8px;
35
+ }
36
+
37
+ .storybook-page .tip {
38
+ display: inline-block;
39
+ vertical-align: top;
40
+ margin-right: 10px;
41
+ border-radius: 1em;
42
+ background: #e7fdd8;
43
+ padding: 4px 12px;
44
+ color: #357a14;
45
+ font-weight: 700;
46
+ font-size: 11px;
47
+ line-height: 12px;
48
+ }
49
+
50
+ .storybook-page .tip-wrapper {
51
+ margin-top: 40px;
52
+ margin-bottom: 40px;
53
+ font-size: 13px;
54
+ line-height: 20px;
55
+ }
56
+
57
+ .storybook-page .tip-wrapper svg {
58
+ display: inline-block;
59
+ vertical-align: top;
60
+ margin-top: 3px;
61
+ margin-right: 4px;
62
+ width: 12px;
63
+ height: 12px;
64
+ }
65
+
66
+ .storybook-page .tip-wrapper svg path {
67
+ fill: #1ea7fd;
68
+ }
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+ import { expect, userEvent, within } from '@storybook/test';
3
+
4
+ import { PageComponent } from './page.component';
5
+
6
+ const meta: Meta<PageComponent> = {
7
+ title: 'Example/Page',
8
+ component: PageComponent,
9
+ parameters: {
10
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
11
+ layout: 'fullscreen',
12
+ },
13
+ };
14
+
15
+ export default meta;
16
+ type Story = StoryObj<PageComponent>;
17
+
18
+ export const LoggedOut: Story = {};
19
+
20
+ // More on component testing: https://storybook.js.org/docs/writing-tests/component-testing
21
+ export const LoggedIn: Story = {
22
+ play: async ({ canvasElement }) => {
23
+ const canvas = within(canvasElement);
24
+ const loginButton = canvas.getByRole('button', { name: /Log in/i });
25
+ await expect(loginButton).toBeInTheDocument();
26
+ await userEvent.click(loginButton);
27
+ await expect(loginButton).not.toBeInTheDocument();
28
+
29
+ const logoutButton = canvas.getByRole('button', { name: /Log out/i });
30
+ await expect(logoutButton).toBeInTheDocument();
31
+ },
32
+ };
@@ -0,0 +1,3 @@
1
+ export interface User {
2
+ name: string;
3
+ }
@@ -0,0 +1,18 @@
1
+ :root {
2
+ --hc-primary-500 : #F55638;
3
+ --hc-primary-600 : #F57738;
4
+ --hc-primary-700 : #F59838;
5
+ --hc-secondary-500 : #FFC857;
6
+ --hc-secondary-600 : #f7a838;
7
+ --hc-secondary-700 : #d68d2a;
8
+ --hc-brown-500 : #95570e;
9
+ --hc-brown-600 : #753c00;
10
+ --hc-text-strong : #2E282A;
11
+ --hc-text-light : #6C757D;
12
+
13
+ --hc-disabled-bg : #c7c7c7;
14
+ --hc-disabled-text : #6C757D;
15
+ --hc-background-primary : var(--hc-primary-500);
16
+ --hc-background-primary-hover : var(--hc-primary-600);
17
+ }
18
+
@@ -0,0 +1,15 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/lib",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "types": []
11
+ },
12
+ "exclude": [
13
+ "**/*.spec.ts"
14
+ ]
15
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "types": [
8
+ "jasmine"
9
+ ]
10
+ },
11
+ "include": [
12
+ "**/*.spec.ts",
13
+ "**/*.d.ts"
14
+ ]
15
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "compileOnSave": false,
5
+ "compilerOptions": {
6
+ "outDir": "./dist/out-tsc",
7
+ "strict": true,
8
+ "paths": {
9
+ "honey-core": [
10
+ "./dist/honey-core"
11
+ ]
12
+ },
13
+ "noImplicitOverride": true,
14
+ "noPropertyAccessFromIndexSignature": true,
15
+ "noImplicitReturns": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "skipLibCheck": true,
18
+ "isolatedModules": true,
19
+ "esModuleInterop": true,
20
+ "experimentalDecorators": true,
21
+ "moduleResolution": "bundler",
22
+ "importHelpers": true,
23
+ "target": "ES2022",
24
+ "module": "ES2022"
25
+ },
26
+ "angularCompilerOptions": {
27
+ "enableI18nLegacyMessageIdFormat": false,
28
+ "strictInjectionParameters": true,
29
+ "strictInputAccessModifiers": true,
30
+ "strictTemplates": true
31
+ }
32
+ }