ngx-opalbytes-components 1.26.0 → 1.28.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/README.md +370 -1
- package/fesm2022/ngx-opalbytes-components.mjs +562 -3
- package/fesm2022/ngx-opalbytes-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/shared/components/accordion/accordion.component.css +30 -0
- package/src/lib/shared/components/accordion/accordion.component.html +1 -0
- package/src/lib/shared/components/accordion/accordion.component.spec.ts +117 -0
- package/src/lib/shared/components/accordion/accordion.component.ts +195 -0
- package/src/lib/shared/components/accordion/accordion.token.ts +40 -0
- package/src/lib/shared/components/accordion-item/accordion-item.component.css +137 -0
- package/src/lib/shared/components/accordion-item/accordion-item.component.html +52 -0
- package/src/lib/shared/components/accordion-item/accordion-item.component.ts +157 -0
- package/src/lib/shared/components/accordion-item/accordion-item.spec.ts +22 -0
- package/src/lib/shared/components/checkbox/checkbox.component.css +131 -0
- package/src/lib/shared/components/checkbox/checkbox.component.html +84 -0
- package/src/lib/shared/components/checkbox/checkbox.component.spec.ts +344 -0
- package/src/lib/shared/components/checkbox/checkbox.component.ts +258 -0
- package/src/lib/shared/components/checkbox/checkbox.stories.ts +240 -0
- package/src/lib/shared/components/index.ts +4 -0
- package/types/ngx-opalbytes-components.d.ts +341 -126
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { FormsModule } from '@angular/forms';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
LucideCheck,
|
|
5
|
+
LucideCircle,
|
|
6
|
+
LucideHeart,
|
|
7
|
+
LucideMinus,
|
|
8
|
+
LucideX,
|
|
9
|
+
provideLucideIcons,
|
|
10
|
+
} from '@lucide/angular';
|
|
11
|
+
import { applicationConfig, type Meta, type StoryObj } from '@storybook/angular-vite';
|
|
12
|
+
import { fn } from 'storybook/test';
|
|
13
|
+
|
|
14
|
+
import { CaoCheckboxComponent } from './checkbox.component';
|
|
15
|
+
|
|
16
|
+
const imageIcon =
|
|
17
|
+
'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Ccircle cx="12" cy="12" r="8" fill="%234f46e5"/%3E%3C/svg%3E';
|
|
18
|
+
|
|
19
|
+
const meta: Meta<CaoCheckboxComponent> = {
|
|
20
|
+
title: 'Componentes/Checkbox',
|
|
21
|
+
component: CaoCheckboxComponent,
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
decorators: [
|
|
24
|
+
applicationConfig({
|
|
25
|
+
providers: [
|
|
26
|
+
provideLucideIcons(
|
|
27
|
+
LucideCheck,
|
|
28
|
+
LucideMinus,
|
|
29
|
+
LucideX,
|
|
30
|
+
LucideCircle,
|
|
31
|
+
LucideHeart,
|
|
32
|
+
),
|
|
33
|
+
],
|
|
34
|
+
}),
|
|
35
|
+
(story) => ({
|
|
36
|
+
...story,
|
|
37
|
+
moduleMetadata: {
|
|
38
|
+
imports: [FormsModule],
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
argTypes: {
|
|
43
|
+
checked: { control: 'boolean' },
|
|
44
|
+
indeterminate: { control: 'boolean' },
|
|
45
|
+
isDisabled: { control: 'boolean' },
|
|
46
|
+
disabled: { control: 'boolean' },
|
|
47
|
+
required: { control: 'boolean' },
|
|
48
|
+
label: { control: 'text' },
|
|
49
|
+
labelPosition: { control: 'select', options: ['before', 'after'] },
|
|
50
|
+
name: { control: 'text' },
|
|
51
|
+
id: { control: 'text' },
|
|
52
|
+
ariaLabel: { control: 'text' },
|
|
53
|
+
ariaLabelledBy: { control: 'text' },
|
|
54
|
+
dataCy: { control: 'text' },
|
|
55
|
+
color: { control: 'color' },
|
|
56
|
+
uncheckedColor: { control: 'color' },
|
|
57
|
+
disabledColor: { control: 'color' },
|
|
58
|
+
labelColor: { control: 'color' },
|
|
59
|
+
disabledLabelColor: { control: 'color' },
|
|
60
|
+
focusRingColor: { control: 'color' },
|
|
61
|
+
size: { control: 'text' },
|
|
62
|
+
borderRadius: { control: 'text' },
|
|
63
|
+
animationDuration: { control: 'text' },
|
|
64
|
+
checkedIcon: { control: 'text' },
|
|
65
|
+
uncheckedIcon: { control: 'text' },
|
|
66
|
+
indeterminateIcon: { control: 'text' },
|
|
67
|
+
isLucideIcon: { control: 'boolean' },
|
|
68
|
+
iconColor: { control: 'color' },
|
|
69
|
+
checkedIconColor: { control: 'color' },
|
|
70
|
+
uncheckedIconColor: { control: 'color' },
|
|
71
|
+
iconSize: { control: 'text' },
|
|
72
|
+
iconStrokeWidth: { control: 'text' },
|
|
73
|
+
},
|
|
74
|
+
args: {
|
|
75
|
+
checked: false,
|
|
76
|
+
indeterminate: false,
|
|
77
|
+
isDisabled: false,
|
|
78
|
+
required: false,
|
|
79
|
+
label: 'Aceito os termos',
|
|
80
|
+
labelPosition: 'after',
|
|
81
|
+
checkedIcon: '',
|
|
82
|
+
uncheckedIcon: '',
|
|
83
|
+
indeterminateIcon: '',
|
|
84
|
+
isLucideIcon: false,
|
|
85
|
+
iconColor: '',
|
|
86
|
+
checkedIconColor: '',
|
|
87
|
+
uncheckedIconColor: '',
|
|
88
|
+
iconSize: 14,
|
|
89
|
+
iconStrokeWidth: 2.5,
|
|
90
|
+
checkedChange: fn(),
|
|
91
|
+
indeterminateChange: fn(),
|
|
92
|
+
checkboxChange: fn(),
|
|
93
|
+
},
|
|
94
|
+
render: (args) => ({
|
|
95
|
+
props: args,
|
|
96
|
+
template: `
|
|
97
|
+
<cao-checkbox
|
|
98
|
+
[(ngModel)]="checked"
|
|
99
|
+
[indeterminate]="indeterminate"
|
|
100
|
+
[isDisabled]="isDisabled"
|
|
101
|
+
[required]="required"
|
|
102
|
+
[label]="label"
|
|
103
|
+
[labelPosition]="labelPosition"
|
|
104
|
+
[name]="name"
|
|
105
|
+
[id]="id"
|
|
106
|
+
[ariaLabel]="ariaLabel"
|
|
107
|
+
[ariaLabelledBy]="ariaLabelledBy"
|
|
108
|
+
[dataCy]="dataCy"
|
|
109
|
+
[color]="color"
|
|
110
|
+
[uncheckedColor]="uncheckedColor"
|
|
111
|
+
[disabledColor]="disabledColor"
|
|
112
|
+
[labelColor]="labelColor"
|
|
113
|
+
[disabledLabelColor]="disabledLabelColor"
|
|
114
|
+
[focusRingColor]="focusRingColor"
|
|
115
|
+
[size]="size"
|
|
116
|
+
[borderRadius]="borderRadius"
|
|
117
|
+
[animationDuration]="animationDuration"
|
|
118
|
+
[checkedIcon]="checkedIcon"
|
|
119
|
+
[uncheckedIcon]="uncheckedIcon"
|
|
120
|
+
[indeterminateIcon]="indeterminateIcon"
|
|
121
|
+
[isLucideIcon]="isLucideIcon"
|
|
122
|
+
[iconColor]="iconColor"
|
|
123
|
+
[checkedIconColor]="checkedIconColor"
|
|
124
|
+
[uncheckedIconColor]="uncheckedIconColor"
|
|
125
|
+
[iconSize]="iconSize"
|
|
126
|
+
[iconStrokeWidth]="iconStrokeWidth"
|
|
127
|
+
(checkedChange)="checkedChange($event)"
|
|
128
|
+
(indeterminateChange)="indeterminateChange($event)"
|
|
129
|
+
(checkboxChange)="checkboxChange($event)">
|
|
130
|
+
</cao-checkbox>
|
|
131
|
+
`,
|
|
132
|
+
}),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default meta;
|
|
136
|
+
type Story = StoryObj<CaoCheckboxComponent>;
|
|
137
|
+
|
|
138
|
+
export const Padrao: Story = {};
|
|
139
|
+
|
|
140
|
+
export const Marcado: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
checked: true,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const Indeterminado: Story = {
|
|
147
|
+
args: {
|
|
148
|
+
indeterminate: true,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const Desabilitado: Story = {
|
|
153
|
+
args: {
|
|
154
|
+
isDisabled: true,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const DesabilitadoMarcado: Story = {
|
|
159
|
+
args: {
|
|
160
|
+
checked: true,
|
|
161
|
+
isDisabled: true,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const LabelAntes: Story = {
|
|
166
|
+
args: {
|
|
167
|
+
checked: true,
|
|
168
|
+
labelPosition: 'before',
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const Obrigatorio: Story = {
|
|
173
|
+
args: {
|
|
174
|
+
required: true,
|
|
175
|
+
label: 'Campo obrigatório',
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const CoresCustomizadas: Story = {
|
|
180
|
+
args: {
|
|
181
|
+
checked: true,
|
|
182
|
+
label: 'Cores customizadas',
|
|
183
|
+
color: '#16a34a',
|
|
184
|
+
uncheckedColor: '#94a3b8',
|
|
185
|
+
labelColor: '#166534',
|
|
186
|
+
focusRingColor: 'rgba(22, 163, 74, 0.35)',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const TamanhoCustomizado: Story = {
|
|
191
|
+
args: {
|
|
192
|
+
checked: true,
|
|
193
|
+
label: 'Tamanho customizado',
|
|
194
|
+
size: '28px',
|
|
195
|
+
borderRadius: '8px',
|
|
196
|
+
animationDuration: '300ms',
|
|
197
|
+
iconSize: 20,
|
|
198
|
+
iconStrokeWidth: 3,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export const IconesLucide: Story = {
|
|
203
|
+
args: {
|
|
204
|
+
checked: true,
|
|
205
|
+
label: 'Ícones Lucide',
|
|
206
|
+
checkedIcon: 'check',
|
|
207
|
+
uncheckedIcon: 'x',
|
|
208
|
+
indeterminateIcon: 'minus',
|
|
209
|
+
isLucideIcon: true,
|
|
210
|
+
checkedIconColor: '#ffffff',
|
|
211
|
+
uncheckedIconColor: '#6b7280',
|
|
212
|
+
iconSize: 14,
|
|
213
|
+
iconStrokeWidth: 2.5,
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export const IconesCustomizados: Story = {
|
|
218
|
+
args: {
|
|
219
|
+
checked: true,
|
|
220
|
+
label: 'Ícones customizados',
|
|
221
|
+
checkedIcon: 'heart',
|
|
222
|
+
uncheckedIcon: 'circle',
|
|
223
|
+
isLucideIcon: true,
|
|
224
|
+
checkedIconColor: '#ffffff',
|
|
225
|
+
uncheckedIconColor: '#db2777',
|
|
226
|
+
color: '#db2777',
|
|
227
|
+
uncheckedColor: '#f9a8d4',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const IconeImagem: Story = {
|
|
232
|
+
args: {
|
|
233
|
+
checked: true,
|
|
234
|
+
label: 'Ícone via URL/data URI',
|
|
235
|
+
checkedIcon: imageIcon,
|
|
236
|
+
uncheckedIcon: imageIcon,
|
|
237
|
+
isLucideIcon: false,
|
|
238
|
+
iconSize: 12,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export * from './accordion/accordion.component'
|
|
2
|
+
export * from './accordion/accordion.token'
|
|
3
|
+
export * from './accordion-item/accordion-item.component'
|
|
1
4
|
export * from './base-button/base-button.component'
|
|
2
5
|
export * from './base-input/base-input'
|
|
3
6
|
export * from './base-time-range/base-time-range'
|
|
@@ -30,4 +33,5 @@ export * from "./base-toggle/base-toggle.component"
|
|
|
30
33
|
export * from "./slide-toggle/slide-toggle.component"
|
|
31
34
|
export * from "./radio/radio-group.component"
|
|
32
35
|
export * from "./radio/radio-button.component"
|
|
36
|
+
export * from "./checkbox/checkbox.component"
|
|
33
37
|
export * from "./footer/footer"
|