@sarasanalytics-com/design-system 0.0.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.
- package/.editorconfig +16 -0
- package/.eslintrc.json +22 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/manager.ts +17 -0
- package/.storybook/preview-head.html +5 -0
- package/.storybook/preview.ts +65 -0
- package/.storybook/tsconfig.doc.json +10 -0
- package/.storybook/tsconfig.json +11 -0
- package/.storybook/typings.d.ts +4 -0
- package/.vscode/extensions.json +7 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/settings.json +13 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +27 -0
- package/angular.json +189 -0
- package/build-storybook.log +39 -0
- package/documentation.json +0 -0
- package/package.json +74 -0
- package/projects/component-library/README.md +24 -0
- package/projects/component-library/ng-package.json +8 -0
- package/projects/component-library/package.json +12 -0
- package/projects/component-library/src/interfaces/avatar-interface.ts +6 -0
- package/projects/component-library/src/interfaces/button-interface.ts +12 -0
- package/projects/component-library/src/interfaces/chip-interface.ts +11 -0
- package/projects/component-library/src/interfaces/grid-interface.ts +24 -0
- package/projects/component-library/src/interfaces/select-interface.ts +19 -0
- package/projects/component-library/src/interfaces/tab-interface.ts +6 -0
- package/projects/component-library/src/lib/avatar/avatar.component.css +48 -0
- package/projects/component-library/src/lib/avatar/avatar.component.html +5 -0
- package/projects/component-library/src/lib/avatar/avatar.component.spec.ts +23 -0
- package/projects/component-library/src/lib/avatar/avatar.component.ts +50 -0
- package/projects/component-library/src/lib/button/button.component.css +145 -0
- package/projects/component-library/src/lib/button/button.component.html +11 -0
- package/projects/component-library/src/lib/button/button.component.spec.ts +23 -0
- package/projects/component-library/src/lib/button/button.component.ts +68 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.css +67 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.html +20 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.spec.ts +23 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.ts +196 -0
- package/projects/component-library/src/lib/chips/chips.component.css +129 -0
- package/projects/component-library/src/lib/chips/chips.component.html +17 -0
- package/projects/component-library/src/lib/chips/chips.component.spec.ts +23 -0
- package/projects/component-library/src/lib/chips/chips.component.ts +55 -0
- package/projects/component-library/src/lib/component-library.component.spec.ts +23 -0
- package/projects/component-library/src/lib/component-library.component.ts +16 -0
- package/projects/component-library/src/lib/component-library.service.spec.ts +16 -0
- package/projects/component-library/src/lib/component-library.service.ts +9 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.css +33 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.html +11 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.spec.ts +23 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.ts +37 -0
- package/projects/component-library/src/lib/form-select/form-select.component.css +156 -0
- package/projects/component-library/src/lib/form-select/form-select.component.html +38 -0
- package/projects/component-library/src/lib/form-select/form-select.component.spec.ts +23 -0
- package/projects/component-library/src/lib/form-select/form-select.component.ts +54 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.css +78 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.html +31 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.spec.ts +23 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.ts +89 -0
- package/projects/component-library/src/lib/header/header.component.css +62 -0
- package/projects/component-library/src/lib/header/header.component.html +23 -0
- package/projects/component-library/src/lib/header/header.component.spec.ts +23 -0
- package/projects/component-library/src/lib/header/header.component.ts +28 -0
- package/projects/component-library/src/lib/stepper/stepper.component.css +96 -0
- package/projects/component-library/src/lib/stepper/stepper.component.html +14 -0
- package/projects/component-library/src/lib/stepper/stepper.component.spec.ts +23 -0
- package/projects/component-library/src/lib/stepper/stepper.component.ts +61 -0
- package/projects/component-library/src/lib/tabs/tabs.component.css +100 -0
- package/projects/component-library/src/lib/tabs/tabs.component.html +16 -0
- package/projects/component-library/src/lib/tabs/tabs.component.spec.ts +23 -0
- package/projects/component-library/src/lib/tabs/tabs.component.ts +37 -0
- package/projects/component-library/src/lib/toast/toast.component.css +108 -0
- package/projects/component-library/src/lib/toast/toast.component.html +25 -0
- package/projects/component-library/src/lib/toast/toast.component.spec.ts +23 -0
- package/projects/component-library/src/lib/toast/toast.component.ts +37 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.css +139 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.html +31 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.spec.ts +23 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.ts +37 -0
- package/projects/component-library/src/public-api.ts +25 -0
- package/projects/component-library/tsconfig.lib.json +14 -0
- package/projects/component-library/tsconfig.lib.prod.json +10 -0
- package/projects/component-library/tsconfig.spec.json +14 -0
- package/src/Saras-logo.svg +15 -0
- package/src/app/app.component.css +13 -0
- package/src/app/app.component.html +77 -0
- package/src/app/app.component.spec.ts +29 -0
- package/src/app/app.component.ts +505 -0
- package/src/app/app.config.ts +27 -0
- package/src/app/app.routes.ts +3 -0
- package/src/app/data.ts +52 -0
- package/src/app/kitchen-sink/kitchen-sink.component.css +29 -0
- package/src/app/kitchen-sink/kitchen-sink.component.html +7 -0
- package/src/app/kitchen-sink/kitchen-sink.component.spec.ts +23 -0
- package/src/app/kitchen-sink/kitchen-sink.component.ts +92 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/Chevron.svg +5 -0
- package/src/assets/Frame.svg +5 -0
- package/src/assets/Grid.svg +5 -0
- package/src/assets/Location.svg +5 -0
- package/src/assets/Mail.svg +5 -0
- package/src/assets/Person.svg +5 -0
- package/src/assets/Scan.svg +5 -0
- package/src/assets/Sources.svg +5 -0
- package/src/assets/arrow.svg +5 -0
- package/src/assets/avatar.svg +12 -0
- package/src/assets/checkmark.svg +5 -0
- package/src/assets/crossmark.svg +5 -0
- package/src/assets/dot.svg +5 -0
- package/src/assets/negativemark.svg +5 -0
- package/src/assets/pointer-polygon.svg +3 -0
- package/src/assets/tick-icon.svg +5 -0
- package/src/assets/tick.svg +8 -0
- package/src/assets/warningmark.svg +5 -0
- package/src/custom-theme.scss +37 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +23 -0
- package/src/main.ts +6 -0
- package/src/stories/GettingStarted.mdx +233 -0
- package/src/stories/KitchenSink.stories.ts +86 -0
- package/src/stories/avatar.stories.ts +45 -0
- package/src/stories/chips.stories.ts +61 -0
- package/src/stories/custom-button.stories.ts +74 -0
- package/src/stories/datepicker.stories.ts +78 -0
- package/src/stories/gridCell.stories.ts +234 -0
- package/src/stories/header.stories.ts +61 -0
- package/src/stories/selectInput.stories.ts +158 -0
- package/src/stories/stepper.stories.ts +92 -0
- package/src/stories/tabs.stories.ts +97 -0
- package/src/stories/toast.stories.ts +54 -0
- package/src/stories/tool-tip.stories.ts +45 -0
- package/src/styles.css +204 -0
- package/src/svg.d.ts +1 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +42 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// parent.component.stories.ts
|
|
2
|
+
import { moduleMetadata, StoryFn, Meta } from '@storybook/angular';
|
|
3
|
+
import { KitchenSinkComponent } from '../app/kitchen-sink/kitchen-sink.component';
|
|
4
|
+
import { AvatarComponent } from '../../projects/component-library/src/public-api';
|
|
5
|
+
import { ChipsComponent } from '../../projects/component-library/src/public-api';
|
|
6
|
+
import { ButtonComponent } from '../../projects/component-library/src/public-api';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Kitchen Sink',
|
|
10
|
+
component: KitchenSinkComponent,
|
|
11
|
+
decorators: [
|
|
12
|
+
moduleMetadata({
|
|
13
|
+
imports: [KitchenSinkComponent],
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
inputComponent: { control: 'object' },
|
|
18
|
+
},
|
|
19
|
+
} as Meta;
|
|
20
|
+
|
|
21
|
+
const Template: StoryFn<KitchenSinkComponent> = (args: KitchenSinkComponent) => ({
|
|
22
|
+
props: args,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const _Avatar = Template.bind({});
|
|
26
|
+
export const _Button = Template.bind({});
|
|
27
|
+
export const _Chip = Template.bind({});
|
|
28
|
+
|
|
29
|
+
_Avatar.args = {
|
|
30
|
+
inputComponent: AvatarComponent,
|
|
31
|
+
params: [
|
|
32
|
+
["../assets/avatar.svg", ""],
|
|
33
|
+
["extra-small", "small", "medium", "large", "extra-large"],
|
|
34
|
+
["AB"]
|
|
35
|
+
],
|
|
36
|
+
paramTypes: ["imagePath", "size", "altText"]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
_Button.args = {
|
|
40
|
+
inputComponent: ButtonComponent,
|
|
41
|
+
params: [
|
|
42
|
+
["primary", "outline", "transparent"],
|
|
43
|
+
["default", "error", "disabled"],
|
|
44
|
+
["small", "medium", "large"],
|
|
45
|
+
["Button"],
|
|
46
|
+
["../assets/Sources.svg"],
|
|
47
|
+
["both", "left", "right"],
|
|
48
|
+
["https://sarasanalytics.com"],
|
|
49
|
+
["self"]
|
|
50
|
+
],
|
|
51
|
+
paramTypes: [
|
|
52
|
+
"type",
|
|
53
|
+
"state",
|
|
54
|
+
"size",
|
|
55
|
+
"text",
|
|
56
|
+
"ImagePath",
|
|
57
|
+
"iconPosition",
|
|
58
|
+
"href",
|
|
59
|
+
"hrefTarget"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
_Chip.args = {
|
|
65
|
+
inputComponent: ChipsComponent,
|
|
66
|
+
params: [
|
|
67
|
+
["regular", "small", "large"],
|
|
68
|
+
["primary", "secondary", "neutral", "success", "error", "warning"],
|
|
69
|
+
["filled", "outline"],
|
|
70
|
+
["Chip text"],
|
|
71
|
+
["../assets/Frame.svg"],
|
|
72
|
+
["both", "left", "right"],
|
|
73
|
+
["../assets/dot.svg"],
|
|
74
|
+
["Good"],
|
|
75
|
+
],
|
|
76
|
+
paramTypes: [
|
|
77
|
+
"type",
|
|
78
|
+
"state",
|
|
79
|
+
"filling",
|
|
80
|
+
"text",
|
|
81
|
+
"iconPath",
|
|
82
|
+
"iconPosition",
|
|
83
|
+
"largeStateIcon",
|
|
84
|
+
"largeStateText"
|
|
85
|
+
]
|
|
86
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { argsToTemplate } from '@storybook/angular';
|
|
3
|
+
import { AvatarComponent } from '../../projects/component-library/src/lib/avatar/avatar.component';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<AvatarComponent> = {
|
|
6
|
+
title: 'Avatar',
|
|
7
|
+
component: AvatarComponent,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
size: {
|
|
11
|
+
options: ['extra-small', 'small', 'medium', 'large', 'extra-large'],
|
|
12
|
+
control: { type: 'radio' },
|
|
13
|
+
},
|
|
14
|
+
altText: {
|
|
15
|
+
description: "Alternate text that should be displayed if image doesn't exist or is broken"
|
|
16
|
+
},
|
|
17
|
+
onClickEvent: {
|
|
18
|
+
action: "onClickEvent"
|
|
19
|
+
},
|
|
20
|
+
onMouseInEvent: {
|
|
21
|
+
action: "onMouseInEvent"
|
|
22
|
+
},
|
|
23
|
+
onMouseOutEvent: {
|
|
24
|
+
action: "onMouseOutEvent"
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
render: (args) => ({
|
|
28
|
+
props: {
|
|
29
|
+
...args,
|
|
30
|
+
},
|
|
31
|
+
template: `<sa-avatar ${argsToTemplate(args)}></sa-avatar>`
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<AvatarComponent>;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export const Avatar: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
size: "medium",
|
|
42
|
+
imagePath: "../assets/avatar.svg",
|
|
43
|
+
altText: "AB"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { argsToTemplate } from '@storybook/angular';
|
|
3
|
+
import { ChipsComponent } from '../../projects/component-library/src/lib/chips/chips.component';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const meta: Meta<ChipsComponent> = {
|
|
7
|
+
title: 'Chips',
|
|
8
|
+
component: ChipsComponent,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
largeStateIcon: {
|
|
12
|
+
description: "This icon will be used when type is set to `large`.",
|
|
13
|
+
},
|
|
14
|
+
largeStateText: {
|
|
15
|
+
description: "This text will be used next to `text` when type is set to `large`."
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
options: ['regular', 'small', 'large'],
|
|
19
|
+
control: { type: 'radio' },
|
|
20
|
+
},
|
|
21
|
+
state: {
|
|
22
|
+
options: ['primary', 'secondary', 'neutral', 'error', 'warning', 'success'],
|
|
23
|
+
control: { type: 'radio' },
|
|
24
|
+
},
|
|
25
|
+
filling: {
|
|
26
|
+
options: ['outline', 'filled'],
|
|
27
|
+
control: { type: 'radio' },
|
|
28
|
+
},
|
|
29
|
+
iconPosition: {
|
|
30
|
+
description: "`''` renders no icon",
|
|
31
|
+
options: ['left', 'right', 'both', ''],
|
|
32
|
+
control: { type: 'radio' },
|
|
33
|
+
},
|
|
34
|
+
onClickEvent: {
|
|
35
|
+
action: "onClickEvent"
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
render: (args) => ({
|
|
39
|
+
props: {
|
|
40
|
+
...args,
|
|
41
|
+
},
|
|
42
|
+
template: `<sa-chip ${argsToTemplate(args)}></sa-chip>`
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default meta;
|
|
47
|
+
type Story = StoryObj<ChipsComponent>;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export const chips: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
iconPath: "../assets/Frame.svg",
|
|
53
|
+
text: "Chip text",
|
|
54
|
+
type: "regular",
|
|
55
|
+
state: "success",
|
|
56
|
+
filling: "outline",
|
|
57
|
+
iconPosition: "both",
|
|
58
|
+
largeStateIcon: "../assets/dot.svg",
|
|
59
|
+
largeStateText: "Good",
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { argsToTemplate } from '@storybook/angular';
|
|
3
|
+
import { ButtonComponent } from '../../projects/component-library/src/lib/button/button.component';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<ButtonComponent> = {
|
|
6
|
+
title: 'Button',
|
|
7
|
+
component: ButtonComponent,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
href: {
|
|
11
|
+
description: "Button redirects to the link given here."
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
options: ['primary', 'outline', 'transparent'],
|
|
15
|
+
control: { type: 'radio' },
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
options: ['small', 'medium', 'large'],
|
|
19
|
+
control: { type: 'radio' },
|
|
20
|
+
},
|
|
21
|
+
state: {
|
|
22
|
+
options: ['default', 'error', 'disabled'],
|
|
23
|
+
control: { type: 'radio' },
|
|
24
|
+
},
|
|
25
|
+
iconPosition: {
|
|
26
|
+
description: "`''` renders no icon",
|
|
27
|
+
options: ['left', 'right', 'both', ''],
|
|
28
|
+
control: { type: 'radio' },
|
|
29
|
+
},
|
|
30
|
+
hrefTarget: {
|
|
31
|
+
options: ['blank', 'self'],
|
|
32
|
+
control: { type: 'radio' },
|
|
33
|
+
description: "Specifies where the `href` should be opened. (same tab or different tab)."
|
|
34
|
+
},
|
|
35
|
+
isSubmit: {
|
|
36
|
+
options: [true, false],
|
|
37
|
+
control: { type: 'boolean' },
|
|
38
|
+
description: "Setting this `True`, Button will act as a submit button inside a form."
|
|
39
|
+
},
|
|
40
|
+
onClickEvent: {
|
|
41
|
+
action: "onClickEvent"
|
|
42
|
+
},
|
|
43
|
+
onMouseInEvent: {
|
|
44
|
+
action: "onMouseInEvent"
|
|
45
|
+
},
|
|
46
|
+
onMouseOutEvent: {
|
|
47
|
+
action: "onMouseOutEvent"
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
render: (args) => ({
|
|
51
|
+
props: {
|
|
52
|
+
...args,
|
|
53
|
+
},
|
|
54
|
+
template: `<sa-button ${argsToTemplate(args)}></sa-button>`
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
type Story = StoryObj<ButtonComponent>;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export const default_button: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
id: 1,
|
|
65
|
+
text: "Button",
|
|
66
|
+
type: "primary",
|
|
67
|
+
size: "medium",
|
|
68
|
+
state: "default",
|
|
69
|
+
ImagePath: "../assets/Sources.svg",
|
|
70
|
+
iconPosition: "both",
|
|
71
|
+
href: "",
|
|
72
|
+
hrefTarget: "blank",
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { argsToTemplate } from '@storybook/angular';
|
|
3
|
+
import { DatepickerComponent } from '../../projects/component-library/src/lib/datepicker/datepicker.component';
|
|
4
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
+
import { MatInputModule } from '@angular/material/input';
|
|
6
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
7
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
8
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
9
|
+
import { CalendarHeaderComponent } from '../../projects/component-library/src/lib/calendar-header/calendar-header.component';
|
|
10
|
+
import { MatIcon } from '@angular/material/icon';
|
|
11
|
+
|
|
12
|
+
const meta: Meta<DatepickerComponent> = {
|
|
13
|
+
title: 'Datepicker',
|
|
14
|
+
component: DatepickerComponent,
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
decorators: [
|
|
17
|
+
moduleMetadata({
|
|
18
|
+
imports: [
|
|
19
|
+
MatFormFieldModule,
|
|
20
|
+
MatInputModule,
|
|
21
|
+
MatDatepickerModule,
|
|
22
|
+
BrowserAnimationsModule,
|
|
23
|
+
CalendarHeaderComponent,
|
|
24
|
+
MatIcon
|
|
25
|
+
]
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
render: (args) => ({
|
|
29
|
+
props: {
|
|
30
|
+
...args,
|
|
31
|
+
},
|
|
32
|
+
template: `<sa-datepicker ${argsToTemplate(args)}></sa-datepicker>`
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
type Story = StoryObj<DatepickerComponent>;
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export const datepicker: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// import type { Meta, StoryObj } from '@storybook/angular';
|
|
46
|
+
// import { moduleMetadata } from '@storybook/angular';
|
|
47
|
+
// import { DatepickerComponent } from '../../projects/component-library/src/lib/datepicker/datepicker.component';
|
|
48
|
+
// import { MatFormFieldModule } from '@angular/material/form-field';
|
|
49
|
+
// import { MatInputModule } from '@angular/material/input';
|
|
50
|
+
// import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
51
|
+
// import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// export default {
|
|
55
|
+
// title: 'Datepicker',
|
|
56
|
+
// component: DatepickerComponent,
|
|
57
|
+
// decorators: [
|
|
58
|
+
// moduleMetadata({
|
|
59
|
+
// declarations: [],
|
|
60
|
+
// imports: [
|
|
61
|
+
// MatFormFieldModule,
|
|
62
|
+
// MatInputModule,
|
|
63
|
+
// MatDatepickerModule,
|
|
64
|
+
// BrowserAnimationsModule,
|
|
65
|
+
// ],
|
|
66
|
+
// })
|
|
67
|
+
// ]
|
|
68
|
+
// } as Meta;
|
|
69
|
+
|
|
70
|
+
// const Template: any = (args: DatepickerComponent) => ({
|
|
71
|
+
// props: args,
|
|
72
|
+
// });
|
|
73
|
+
|
|
74
|
+
// export const Primary = Template.bind({});
|
|
75
|
+
// Primary.args = {
|
|
76
|
+
// start: new Date(),
|
|
77
|
+
// end: new Date()
|
|
78
|
+
// };
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { argsToTemplate } from '@storybook/angular';
|
|
3
|
+
import { GridInterface } from '../../projects/component-library/src/public-api';
|
|
4
|
+
import { GridCellComponent } from '../../projects/component-library/src/public-api';
|
|
5
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
6
|
+
import { AgGridAngular, AgGridModule } from 'ag-grid-angular';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const meta: Meta<AgGridAngular> = {
|
|
10
|
+
title: 'GridCell',
|
|
11
|
+
component: AgGridAngular,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
decorators: [
|
|
14
|
+
moduleMetadata({ imports: [GridCellComponent, AgGridAngular, AgGridModule], }),
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
rowData: {
|
|
18
|
+
description: [
|
|
19
|
+
"An array of objects.",
|
|
20
|
+
"Each object in this array (lets call it `rowObj`) represents a row.",
|
|
21
|
+
"The `keys` in `rowObj` takes the same name (lets call it `colName`) as columns in that row,",
|
|
22
|
+
"and the values take `GridInterface` object describing how that cell is rendered and with what content.",
|
|
23
|
+
"**Please use `GridInterface` to configure cells**."
|
|
24
|
+
].join(" ")
|
|
25
|
+
},
|
|
26
|
+
columnDefs: {
|
|
27
|
+
description: [
|
|
28
|
+
"An array of objects. Each object represents a column.",
|
|
29
|
+
"The `field` attribute in this object must be same as `colName`(from `rowData`).",
|
|
30
|
+
"`CellRenderer` should be set to `GridCellComponent`.",
|
|
31
|
+
"Remaining parameters are common to general ag-grid configuration."
|
|
32
|
+
].join(" ")
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
render: (args) => ({
|
|
36
|
+
props: {
|
|
37
|
+
...args,
|
|
38
|
+
},
|
|
39
|
+
template: `
|
|
40
|
+
<ag-grid-angular
|
|
41
|
+
style="height: 300px;"
|
|
42
|
+
[rowHeight]=50
|
|
43
|
+
[headerHeight]=44
|
|
44
|
+
[suppressCellFocus]=true
|
|
45
|
+
${argsToTemplate(args)}>
|
|
46
|
+
</ag-grid-angular>
|
|
47
|
+
`
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
type Story = StoryObj<AgGridAngular>;
|
|
53
|
+
|
|
54
|
+
const params: GridInterface = {
|
|
55
|
+
cellType: '',
|
|
56
|
+
viewText: false,
|
|
57
|
+
viewLeadingIcon: false,
|
|
58
|
+
viewTrailingIcon: false,
|
|
59
|
+
viewButton: false,
|
|
60
|
+
viewChip: false,
|
|
61
|
+
viewAvatar: false,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const default_colDef = [{
|
|
65
|
+
field: "TestField",
|
|
66
|
+
headerComponentParams: {
|
|
67
|
+
...params,
|
|
68
|
+
text: "Cell Text",
|
|
69
|
+
cellType: "header",
|
|
70
|
+
viewText: true
|
|
71
|
+
},
|
|
72
|
+
resizable: false,
|
|
73
|
+
headerComponent: GridCellComponent,
|
|
74
|
+
cellRenderer: GridCellComponent,
|
|
75
|
+
}]
|
|
76
|
+
|
|
77
|
+
export const Regular: Story = {
|
|
78
|
+
args: {
|
|
79
|
+
rowData: [{
|
|
80
|
+
TestField: {
|
|
81
|
+
...params,
|
|
82
|
+
viewText: true,
|
|
83
|
+
cellType: 'row',
|
|
84
|
+
text: 1,
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
TestField: {
|
|
89
|
+
...params,
|
|
90
|
+
viewText: true,
|
|
91
|
+
cellType: 'row',
|
|
92
|
+
text: 2,
|
|
93
|
+
}
|
|
94
|
+
}],
|
|
95
|
+
columnDefs: default_colDef
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const Numeric: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
rowData: [{
|
|
102
|
+
TestField: {
|
|
103
|
+
...params,
|
|
104
|
+
viewText: true,
|
|
105
|
+
cellType: 'numeric',
|
|
106
|
+
text: 1,
|
|
107
|
+
},
|
|
108
|
+
}],
|
|
109
|
+
columnDefs: default_colDef
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const Text_SubText: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
rowData: [{
|
|
116
|
+
TestField: {
|
|
117
|
+
...params,
|
|
118
|
+
viewText: true,
|
|
119
|
+
cellType: "row",
|
|
120
|
+
text: "Nithish",
|
|
121
|
+
subText: "Developer",
|
|
122
|
+
},
|
|
123
|
+
}],
|
|
124
|
+
columnDefs: default_colDef
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export const leadingIcon: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
rowData: [{
|
|
132
|
+
TestField: {
|
|
133
|
+
...params,
|
|
134
|
+
viewText: true,
|
|
135
|
+
viewLeadingIcon: true,
|
|
136
|
+
iconPath: '../assets/Scan.svg',
|
|
137
|
+
cellType: 'Row',
|
|
138
|
+
text: "Cell Name",
|
|
139
|
+
},
|
|
140
|
+
}],
|
|
141
|
+
columnDefs: default_colDef
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const Chip: Story = {
|
|
146
|
+
args: {
|
|
147
|
+
rowData: [{
|
|
148
|
+
TestField: {
|
|
149
|
+
...params,
|
|
150
|
+
viewChip: true,
|
|
151
|
+
cellType: 'Row',
|
|
152
|
+
chipConfig: [
|
|
153
|
+
{
|
|
154
|
+
id: 0,
|
|
155
|
+
text: "Chip text",
|
|
156
|
+
type: 'primary',
|
|
157
|
+
state: 'regular',
|
|
158
|
+
filling: 'filled',
|
|
159
|
+
iconPath: '../assets/Frame.svg',
|
|
160
|
+
iconPosition: 'left',
|
|
161
|
+
largeStateIcon: '',
|
|
162
|
+
largeStateText: '',
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
chipClicked: (evt: Event) => {
|
|
166
|
+
console.log(evt);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
}],
|
|
170
|
+
columnDefs: default_colDef
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const Interactive: Story = {
|
|
175
|
+
args: {
|
|
176
|
+
rowData: [{
|
|
177
|
+
TestField: {
|
|
178
|
+
...params,
|
|
179
|
+
viewText: true,
|
|
180
|
+
cellType: 'interactive',
|
|
181
|
+
interactiveLink: '',
|
|
182
|
+
interactiveLinkTarget: 'blank',
|
|
183
|
+
text: "Cell Name",
|
|
184
|
+
},
|
|
185
|
+
}],
|
|
186
|
+
columnDefs: default_colDef
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const Button: Story = {
|
|
191
|
+
args: {
|
|
192
|
+
rowData: [{
|
|
193
|
+
TestField: {
|
|
194
|
+
...params,
|
|
195
|
+
viewButton: true,
|
|
196
|
+
cellType: 'Row',
|
|
197
|
+
buttonConfig: {
|
|
198
|
+
id: 0,
|
|
199
|
+
type: 'primary',
|
|
200
|
+
state: 'default',
|
|
201
|
+
size: 'small',
|
|
202
|
+
text: 'Button',
|
|
203
|
+
imagePath: '../assets/Sources.svg',
|
|
204
|
+
iconPosition: 'right',
|
|
205
|
+
href: "",
|
|
206
|
+
hrefTarget: 'blank',
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
}],
|
|
210
|
+
columnDefs: default_colDef
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const Avatar: Story = {
|
|
215
|
+
args: {
|
|
216
|
+
rowData: [{
|
|
217
|
+
TestField: {
|
|
218
|
+
...params,
|
|
219
|
+
viewText: true,
|
|
220
|
+
cellType: "row",
|
|
221
|
+
avatarConfig: {
|
|
222
|
+
id: 0,
|
|
223
|
+
size: 'small',
|
|
224
|
+
imagePath: '../assets/avatar.svg',
|
|
225
|
+
altText: 'AB'
|
|
226
|
+
},
|
|
227
|
+
viewAvatar: true,
|
|
228
|
+
text: "Nithish",
|
|
229
|
+
subText: "Developer",
|
|
230
|
+
},
|
|
231
|
+
}],
|
|
232
|
+
columnDefs: default_colDef
|
|
233
|
+
}
|
|
234
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { argsToTemplate } from '@storybook/angular';
|
|
3
|
+
import { HeaderComponent } from '../../projects/component-library/src/lib/header/header.component';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<HeaderComponent> = {
|
|
6
|
+
title: 'Header',
|
|
7
|
+
component: HeaderComponent,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
mainButtonClicked: {
|
|
11
|
+
action: "mainButtonClicked"
|
|
12
|
+
},
|
|
13
|
+
helperButtonClicked: {
|
|
14
|
+
action: "helperButtonClicked"
|
|
15
|
+
},
|
|
16
|
+
info: {
|
|
17
|
+
description: "Two dimensional array of strings containing label and it's icon address."
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
render: (args) => ({
|
|
21
|
+
props: {
|
|
22
|
+
...args,
|
|
23
|
+
},
|
|
24
|
+
template: `<sa-header ${argsToTemplate(args)}></sa-header>`
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<HeaderComponent>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
info: [
|
|
34
|
+
["Info Text 1", "../assets/Person.svg"],
|
|
35
|
+
["Info Text 2", "../assets/Location.svg"],
|
|
36
|
+
["Info Text 3", "../assets/Mail.svg"]
|
|
37
|
+
],
|
|
38
|
+
buttonMain: "+ Button",
|
|
39
|
+
buttonHelper: "Helper",
|
|
40
|
+
headerName: "Header"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const With_Chips: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
info: [
|
|
47
|
+
["Info Text 1", "../assets/Person.svg"],
|
|
48
|
+
["Info Text 2", "../assets/Location.svg"],
|
|
49
|
+
["Info Text 3", "../assets/Mail.svg"]
|
|
50
|
+
],
|
|
51
|
+
chipConfig: [
|
|
52
|
+
["Chip 1", "success"],
|
|
53
|
+
["Chip 2", "warning"],
|
|
54
|
+
["Chip 3", "error"],
|
|
55
|
+
],
|
|
56
|
+
buttonMain: "+ Button",
|
|
57
|
+
buttonHelper: "Helper",
|
|
58
|
+
headerName: "Header"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|