ngx-opalbytes-components 1.20.0 → 1.21.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.
- package/cli/cao-comp.cjs +272 -2
- package/package.json +1 -1
- package/src/lib/shared/components/autocomplete/autocomplete.stories.ts +133 -0
- package/src/lib/shared/components/base-button/base-button.stories.ts +102 -0
- package/src/lib/shared/components/base-icon/base-icon.stories.ts +56 -0
- package/src/lib/shared/components/base-input/base-input.stories.ts +137 -0
- package/src/lib/shared/components/base-time-range/base-time-range.stories.ts +54 -0
- package/src/lib/shared/components/base-toggle/base-toggle.stories.ts +63 -0
- package/src/lib/shared/components/card/card.stories.ts +114 -0
- package/src/lib/shared/components/date-picker/date-picker.stories.ts +91 -0
- package/src/lib/shared/components/drop-down/drop-down.stories.ts +90 -0
- package/src/lib/shared/components/footer/footer.stories.ts +51 -0
- package/src/lib/shared/components/kpi/kpi.stories.ts +65 -0
- package/src/lib/shared/components/links-button/links-button.stories.ts +75 -0
- package/src/lib/shared/components/paginator/paginator.stories.ts +56 -0
- package/src/lib/shared/components/stepper/stepper.stories.ts +77 -0
- package/src/lib/shared/components/tab-group/tab-group.stories.ts +102 -0
- package/src/lib/shared/components/tab-panel/tab-panel.stories.ts +54 -0
- package/src/lib/shared/components/time-picker/time-picker.stories.ts +66 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { signal } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
import { type Meta, type StoryObj, moduleMetadata } from '@storybook/angular-vite';
|
|
5
|
+
|
|
6
|
+
import { LinksButton, INavContent } from './links-button';
|
|
7
|
+
|
|
8
|
+
const defaultNav: INavContent = {
|
|
9
|
+
title: 'Navegação',
|
|
10
|
+
links: [
|
|
11
|
+
{ text: 'Dashboard', url: '/dashboard' },
|
|
12
|
+
{ text: 'Relatórios', url: '/relatorios' },
|
|
13
|
+
{ text: 'Configurações', url: '/configuracoes' },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const meta: Meta<LinksButton> = {
|
|
18
|
+
title: 'Componentes/Links Button',
|
|
19
|
+
component: LinksButton,
|
|
20
|
+
tags: ['autodocs'],
|
|
21
|
+
decorators: [
|
|
22
|
+
moduleMetadata({
|
|
23
|
+
providers: [
|
|
24
|
+
{ provide: Router, useValue: { navigate: () => Promise.resolve(true) } },
|
|
25
|
+
{ provide: ActivatedRoute, useValue: {} },
|
|
26
|
+
],
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<LinksButton>;
|
|
33
|
+
|
|
34
|
+
export const Padrao: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
navContent: signal(defaultNav),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const ComLinkDesabilitado: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
navContent: signal({
|
|
43
|
+
title: 'Navegação',
|
|
44
|
+
links: [
|
|
45
|
+
{ text: 'Dashboard', url: '/dashboard' },
|
|
46
|
+
{ text: 'Indisponível', url: '/x', disabled: true },
|
|
47
|
+
{ text: 'Configurações', url: '/configuracoes' },
|
|
48
|
+
],
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const ComRotaDireta: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
navContent: signal({
|
|
56
|
+
title: 'Navegação externa',
|
|
57
|
+
links: [
|
|
58
|
+
{ text: 'Site oficial', url: 'https://example.com', directRoute: true },
|
|
59
|
+
{ text: 'Dashboard', url: '/dashboard' },
|
|
60
|
+
],
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const ComDataCy: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
navContent: signal({
|
|
68
|
+
title: 'Navegação instrumentada',
|
|
69
|
+
links: [
|
|
70
|
+
{ text: 'Dashboard', url: '/dashboard', dataCy: 'link-dashboard' },
|
|
71
|
+
{ text: 'Relatórios', url: '/relatorios', dataCy: 'link-relatorios' },
|
|
72
|
+
],
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { Paginator } from './paginator';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<Paginator> = {
|
|
7
|
+
title: 'Componentes/Paginator',
|
|
8
|
+
component: Paginator,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
totalItems: { control: { type: 'number', min: 0 } },
|
|
12
|
+
pageSize: { control: { type: 'number', min: 1 } },
|
|
13
|
+
currentPage: { control: { type: 'number', min: 1 } },
|
|
14
|
+
pageSizeOptions: { control: 'object' },
|
|
15
|
+
customClass: { control: 'text' },
|
|
16
|
+
showFirstLastButtons: { control: 'boolean' },
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
pageEvent: fn(),
|
|
20
|
+
totalItems: 250,
|
|
21
|
+
pageSize: 10,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<Paginator>;
|
|
27
|
+
|
|
28
|
+
export const Padrao: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
totalItems: 250,
|
|
31
|
+
pageSize: 10,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const OpcoesPersonalizadas: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
totalItems: 1000,
|
|
38
|
+
pageSize: 25,
|
|
39
|
+
pageSizeOptions: [10, 25, 50, 100],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const SemPrimeiroEUltimo: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
totalItems: 250,
|
|
46
|
+
pageSize: 10,
|
|
47
|
+
showFirstLastButtons: false,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const VariasPaginas: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
totalItems: 3,
|
|
54
|
+
pageSize: 1,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { StepperComponent } from './stepper';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<StepperComponent> = {
|
|
7
|
+
title: 'Componentes/Stepper',
|
|
8
|
+
component: StepperComponent,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
title: { control: 'text' },
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
maxReachedEvent: fn(),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<StepperComponent>;
|
|
20
|
+
|
|
21
|
+
const renderStepper = (steps: string) => ({
|
|
22
|
+
template: `
|
|
23
|
+
<cao-stepper title="Etapas do cadastro" (maxReachedEvent)="maxReachedEvent()">
|
|
24
|
+
${steps}
|
|
25
|
+
</cao-stepper>
|
|
26
|
+
`,
|
|
27
|
+
props: { maxReachedEvent: fn() },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const Padrao: Story = {
|
|
31
|
+
render: () =>
|
|
32
|
+
renderStepper(`
|
|
33
|
+
<cao-step title="Dados pessoais" />
|
|
34
|
+
<cao-step title="Endereço" />
|
|
35
|
+
<cao-step title="Confirmação" />
|
|
36
|
+
`),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const ComTitulo: Story = {
|
|
40
|
+
render: () =>
|
|
41
|
+
renderStepper(`
|
|
42
|
+
<cao-step title="Etapa 1" />
|
|
43
|
+
<cao-step title="Etapa 2" />
|
|
44
|
+
<cao-step title="Etapa 3" />
|
|
45
|
+
`),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const MultiplastEtapas: Story = {
|
|
49
|
+
render: () =>
|
|
50
|
+
renderStepper(`
|
|
51
|
+
<cao-step title="Cadastro" />
|
|
52
|
+
<cao-step title="Documentos" />
|
|
53
|
+
<cao-step title="Bancário" />
|
|
54
|
+
<cao-step title="Revisão" />
|
|
55
|
+
<cao-step title="Conclusão" />
|
|
56
|
+
`),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const SomenteStep: Story = {
|
|
60
|
+
render: () => ({
|
|
61
|
+
template: `
|
|
62
|
+
<div style="display:flex;gap:16px">
|
|
63
|
+
<cao-step title="Ativa" isActive="true" />
|
|
64
|
+
<cao-step title="Inativa" />
|
|
65
|
+
</div>
|
|
66
|
+
`,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const StepComStepComponent: Story = {
|
|
71
|
+
render: () =>
|
|
72
|
+
renderStepper(`
|
|
73
|
+
<cao-step title="Primeira" />
|
|
74
|
+
<cao-step title="Segunda" />
|
|
75
|
+
<cao-step title="Terceira" isActive="true" />
|
|
76
|
+
`),
|
|
77
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { CaoTabGroup } from './tab-group';
|
|
5
|
+
import { CaoTabPanel } from '../tab-panel/tab-panel';
|
|
6
|
+
|
|
7
|
+
const renderTabs = (panels: string) => ({
|
|
8
|
+
template: `<cao-tab-group>${panels}</cao-tab-group>`,
|
|
9
|
+
moduleMetadata: { imports: [CaoTabGroup, CaoTabPanel] },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const defaultPanels = `
|
|
13
|
+
<cao-tab-panel label="Aba 1"><p>Conteúdo da primeira aba.</p></cao-tab-panel>
|
|
14
|
+
<cao-tab-panel label="Aba 2"><p>Conteúdo da segunda aba.</p></cao-tab-panel>
|
|
15
|
+
<cao-tab-panel label="Aba 3"><p>Conteúdo da terceira aba.</p></cao-tab-panel>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const panelsWithIcons = `
|
|
19
|
+
<cao-tab-panel label="Início" leadingIcon="Home"><p>Conteúdo de início.</p></cao-tab-panel>
|
|
20
|
+
<cao-tab-panel label="Buscar" leadingIcon="Search"><p>Conteúdo de busca.</p></cao-tab-panel>
|
|
21
|
+
<cao-tab-panel label="Configurações" leadingIcon="Settings"><p>Conteúdo de configurações.</p></cao-tab-panel>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const meta: Meta<CaoTabGroup> = {
|
|
25
|
+
title: 'Componentes/Tab Group',
|
|
26
|
+
component: CaoTabGroup,
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
argTypes: {
|
|
29
|
+
selectedIndex: { control: { type: 'number', min: 0 } },
|
|
30
|
+
labelHeight: { control: 'text' },
|
|
31
|
+
labelPaddingX: { control: 'text' },
|
|
32
|
+
labelGap: { control: 'text' },
|
|
33
|
+
colorText: { control: 'color' },
|
|
34
|
+
colorActive: { control: 'color' },
|
|
35
|
+
colorHoverBg: { control: 'color' },
|
|
36
|
+
colorDisabled: { control: 'color' },
|
|
37
|
+
colorInkBar: { control: 'color' },
|
|
38
|
+
colorHeaderBorder: { control: 'color' },
|
|
39
|
+
inkBarHeight: { control: 'text' },
|
|
40
|
+
contentPaddingTop: { control: 'text' },
|
|
41
|
+
labelRadius: { control: 'text' },
|
|
42
|
+
animationDuration: { control: 'text' },
|
|
43
|
+
dynamicHeight: { control: 'boolean' },
|
|
44
|
+
labelAlign: { control: 'select', options: ['start', 'center', 'end'] },
|
|
45
|
+
iconColorActive: { control: 'color' },
|
|
46
|
+
iconColorInactive: { control: 'color' },
|
|
47
|
+
strokeWidthIcon: { control: { type: 'number', min: 0.5, max: 3, step: 0.1 } },
|
|
48
|
+
},
|
|
49
|
+
args: {
|
|
50
|
+
selectedTabChange: fn(),
|
|
51
|
+
focusChange: fn(),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
type Story = StoryObj<CaoTabGroup>;
|
|
57
|
+
|
|
58
|
+
export const Padrao: Story = {
|
|
59
|
+
render: () => renderTabs(defaultPanels),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const ComIcones: Story = {
|
|
63
|
+
render: () => renderTabs(panelsWithIcons),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const ComAbaDesabilitada: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
selectedIndex: 0,
|
|
69
|
+
},
|
|
70
|
+
render: () =>
|
|
71
|
+
renderTabs(`
|
|
72
|
+
<cao-tab-panel label="Aba 1"><p>Conteúdo da primeira aba.</p></cao-tab-panel>
|
|
73
|
+
<cao-tab-panel label="Bloqueada" isDisabled="true"><p>Não acessível.</p></cao-tab-panel>
|
|
74
|
+
<cao-tab-panel label="Aba 3"><p>Conteúdo da terceira aba.</p></cao-tab-panel>
|
|
75
|
+
`),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const CoresPersonalizadas: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
colorText: '#374151',
|
|
81
|
+
colorActive: '#dc2626',
|
|
82
|
+
colorHoverBg: '#fee2e2',
|
|
83
|
+
colorInkBar: '#dc2626',
|
|
84
|
+
colorHeaderBorder: '#f3f4f6',
|
|
85
|
+
},
|
|
86
|
+
render: () => renderTabs(defaultPanels),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const LabelsCentralizados: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
labelAlign: 'center',
|
|
92
|
+
},
|
|
93
|
+
render: () => renderTabs(defaultPanels),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const TrailingIcons: Story = {
|
|
97
|
+
render: () =>
|
|
98
|
+
renderTabs(`
|
|
99
|
+
<cao-tab-panel label="Notificações" trailingIcon="Bell"><p>Conteúdo com sino.</p></cao-tab-panel>
|
|
100
|
+
<cao-tab-panel label="Perfil" trailingIcon="User"><p>Conteúdo de perfil.</p></cao-tab-panel>
|
|
101
|
+
`),
|
|
102
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
|
+
|
|
3
|
+
import { CaoTabPanel } from './tab-panel';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<CaoTabPanel> = {
|
|
6
|
+
title: 'Componentes/Tab Panel',
|
|
7
|
+
component: CaoTabPanel,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
label: { control: 'text' },
|
|
11
|
+
isLucideIcon: { control: 'boolean' },
|
|
12
|
+
leadingIcon: { control: 'text' },
|
|
13
|
+
trailingIcon: { control: 'text' },
|
|
14
|
+
isDisabled: { control: 'boolean' },
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
label: 'Conteúdo da aba',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<CaoTabPanel>;
|
|
23
|
+
|
|
24
|
+
export const Padrao: Story = {
|
|
25
|
+
render: (args) => ({
|
|
26
|
+
template: `
|
|
27
|
+
<cao-tab-panel
|
|
28
|
+
[label]="label"
|
|
29
|
+
[isLucideIcon]="isLucideIcon"
|
|
30
|
+
[leadingIcon]="leadingIcon"
|
|
31
|
+
[trailingIcon]="trailingIcon"
|
|
32
|
+
[isDisabled]="isDisabled">
|
|
33
|
+
<p>Este é o conteúdo renderizado pela aba.</p>
|
|
34
|
+
</cao-tab-panel>
|
|
35
|
+
`,
|
|
36
|
+
props: args,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const ComLeadingIcon: Story = {
|
|
41
|
+
args: { label: 'Início', leadingIcon: 'Home', isLucideIcon: true },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const ComTrailingIcon: Story = {
|
|
45
|
+
args: { label: 'Notificações', trailingIcon: 'Bell', isLucideIcon: true },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const ComAmbosIcones: Story = {
|
|
49
|
+
args: { label: 'Configurações', leadingIcon: 'Settings', trailingIcon: 'ChevronRight', isLucideIcon: true },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Desabilitado: Story = {
|
|
53
|
+
args: { label: 'Bloqueada', isDisabled: true },
|
|
54
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { FormControl } from '@angular/forms';
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
|
+
|
|
6
|
+
import { TimePicker } from './time-picker';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<TimePicker> = {
|
|
9
|
+
title: 'Componentes/Time Picker',
|
|
10
|
+
component: TimePicker,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
isDisabled: { control: 'boolean' },
|
|
14
|
+
dataCy: { control: 'text' },
|
|
15
|
+
min: { control: 'text' },
|
|
16
|
+
max: { control: 'text' },
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
timeChange: fn(),
|
|
20
|
+
min: '07:00',
|
|
21
|
+
max: '23:00',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<TimePicker>;
|
|
27
|
+
|
|
28
|
+
export const Padrao: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
min: '07:00',
|
|
31
|
+
max: '23:00',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const ComMinimoEMaximo: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
min: '09:00',
|
|
38
|
+
max: '18:00',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const ComValor: Story = {
|
|
43
|
+
render: (args) => ({
|
|
44
|
+
template: `
|
|
45
|
+
<cao-time-picker
|
|
46
|
+
[control]="control"
|
|
47
|
+
[min]="min"
|
|
48
|
+
[max]="max"
|
|
49
|
+
[isDisabled]="isDisabled"
|
|
50
|
+
(timeChange)="timeChange($event)" />
|
|
51
|
+
`,
|
|
52
|
+
props: {
|
|
53
|
+
control: new FormControl<Date | null>(new Date(2026, 0, 1, 14, 30)),
|
|
54
|
+
min: args.min,
|
|
55
|
+
max: args.max,
|
|
56
|
+
isDisabled: args.isDisabled,
|
|
57
|
+
timeChange: fn(),
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Desabilitado: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
isDisabled: true,
|
|
65
|
+
},
|
|
66
|
+
};
|