@archbase/components 3.0.25 → 4.0.1

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 (168) hide show
  1. package/dist/buttons/ArchbaseSpeedDial.d.ts +59 -0
  2. package/dist/buttons/index.d.ts +2 -0
  3. package/dist/charts/ArchbaseArcGauge.d.ts +55 -0
  4. package/dist/charts/ArchbaseGantt.d.ts +70 -0
  5. package/dist/charts/ArchbaseLinearGauge.d.ts +55 -0
  6. package/dist/charts/ArchbaseResourceTimeline.d.ts +61 -0
  7. package/dist/charts/ArchbaseSparkline.d.ts +45 -0
  8. package/dist/charts/index.d.ts +10 -0
  9. package/dist/containers/ArchbaseExpansionPanel.d.ts +60 -0
  10. package/dist/containers/ArchbaseFloatingPanel.d.ts +91 -0
  11. package/dist/containers/index.d.ts +4 -0
  12. package/dist/datagrid/export/ArchbaseDataGridExcelExport.d.ts +67 -0
  13. package/dist/datagrid/export/index.d.ts +2 -0
  14. package/dist/datagrid/index.d.ts +1 -0
  15. package/dist/display/ArchbaseAnimationWrapper.d.ts +73 -0
  16. package/dist/display/ArchbaseBarcodeGenerator.d.ts +50 -0
  17. package/dist/display/ArchbaseCarousel.d.ts +100 -0
  18. package/dist/display/ArchbaseCodeViewer.d.ts +63 -0
  19. package/dist/display/ArchbaseDiffViewer.d.ts +41 -0
  20. package/dist/display/ArchbaseJsonTree.d.ts +34 -0
  21. package/dist/display/ArchbaseLightbox.d.ts +89 -0
  22. package/dist/display/ArchbaseMarquee.d.ts +46 -0
  23. package/dist/display/ArchbasePhotoAlbum.d.ts +58 -0
  24. package/dist/display/ArchbaseQRCode.d.ts +44 -0
  25. package/dist/display/ArchbaseTooltipRich.d.ts +82 -0
  26. package/dist/display/ArchbaseVirtualList.d.ts +116 -0
  27. package/dist/display/index.d.ts +24 -0
  28. package/dist/editors/ArchbaseAIPromptInput.d.ts +69 -0
  29. package/dist/editors/ArchbaseAsyncMultiSelect.d.ts +1 -1
  30. package/dist/editors/ArchbaseAsyncSelect.d.ts +1 -1
  31. package/dist/editors/ArchbaseBarcodeScanner.d.ts +63 -0
  32. package/dist/editors/ArchbaseCepInput.d.ts +26 -0
  33. package/dist/editors/ArchbaseColorGradientPicker.d.ts +80 -0
  34. package/dist/editors/ArchbaseCpfCnpjInput.d.ts +21 -0
  35. package/dist/editors/ArchbaseCurrencyInput.d.ts +25 -0
  36. package/dist/editors/ArchbaseDualListbox.d.ts +61 -0
  37. package/dist/editors/ArchbaseInPlaceEditor.d.ts +67 -0
  38. package/dist/editors/ArchbaseLightGrid.d.ts +56 -0
  39. package/dist/editors/ArchbaseMentionInput.d.ts +75 -0
  40. package/dist/editors/ArchbaseMultiEmail.d.ts +53 -0
  41. package/dist/editors/ArchbaseMultiViewCalendar.d.ts +47 -0
  42. package/dist/editors/ArchbaseNumberStepper.d.ts +66 -0
  43. package/dist/editors/ArchbaseOTPInput.d.ts +27 -0
  44. package/dist/editors/ArchbasePhoneInput.d.ts +52 -0
  45. package/dist/editors/ArchbaseRangeSlider.d.ts +22 -0
  46. package/dist/editors/ArchbaseSignaturePad.d.ts +60 -0
  47. package/dist/editors/ArchbaseSpeechToTextInput.d.ts +106 -0
  48. package/dist/editors/ArchbaseSpreadsheet.d.ts +56 -0
  49. package/dist/editors/ArchbaseTagInput.d.ts +55 -0
  50. package/dist/editors/index.d.ts +40 -0
  51. package/dist/feedback/ArchbaseChunkProgressBar.d.ts +35 -0
  52. package/dist/feedback/ArchbaseRipple.d.ts +43 -0
  53. package/dist/feedback/ArchbaseSkeleton.d.ts +115 -0
  54. package/dist/feedback/index.d.ts +6 -0
  55. package/dist/filters/ArchbaseColumnSelector.d.ts +38 -0
  56. package/dist/filters/index.d.ts +2 -0
  57. package/dist/forms/ArchbaseFieldArray.d.ts +80 -0
  58. package/dist/forms/ArchbaseFormWizard.d.ts +73 -0
  59. package/dist/forms/ArchbaseStepper.d.ts +51 -0
  60. package/dist/forms/index.d.ts +8 -0
  61. package/dist/forms/useArchbaseFormWizard.d.ts +74 -0
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/useArchbaseConfirm.d.ts +59 -0
  64. package/dist/image/editor/index.d.ts +43 -4
  65. package/dist/image/index.d.ts +1 -0
  66. package/dist/index.css +1 -1
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.js +22510 -13820
  69. package/dist/list/ArchbaseTreeList.d.ts +76 -0
  70. package/dist/list/index.d.ts +2 -0
  71. package/dist/navigation/ArchbaseActionSheet.d.ts +70 -0
  72. package/dist/navigation/ArchbaseAppBar.d.ts +63 -0
  73. package/dist/navigation/ArchbaseBottomNavigation.d.ts +61 -0
  74. package/dist/navigation/ArchbaseContextMenu.d.ts +76 -0
  75. package/dist/navigation/ArchbaseKeyboardShortcuts.d.ts +85 -0
  76. package/dist/navigation/ArchbaseSpotlight.d.ts +69 -0
  77. package/dist/navigation/index.d.ts +12 -0
  78. package/dist/notification/ArchbaseNotificationCenter.d.ts +56 -0
  79. package/dist/notification/index.d.ts +2 -0
  80. package/dist/onboarding/ArchbaseOnboardingTour.d.ts +27 -76
  81. package/dist/viewers/ArchbaseDocViewer.d.ts +40 -0
  82. package/dist/viewers/ArchbasePdfBuilder.d.ts +53 -0
  83. package/dist/viewers/ArchbaseXmlViewer.d.ts +36 -0
  84. package/dist/viewers/index.d.ts +6 -0
  85. package/package.json +41 -18
  86. package/src/buttons/ArchbaseSpeedDial.tsx +282 -0
  87. package/src/buttons/index.ts +3 -0
  88. package/src/charts/ArchbaseArcGauge.tsx +325 -0
  89. package/src/charts/ArchbaseGantt.tsx +494 -0
  90. package/src/charts/ArchbaseLinearGauge.tsx +288 -0
  91. package/src/charts/ArchbaseResourceTimeline.tsx +433 -0
  92. package/src/charts/ArchbaseSparkline.tsx +193 -0
  93. package/src/charts/index.ts +20 -1
  94. package/src/containers/ArchbaseExpansionPanel.tsx +208 -0
  95. package/src/containers/ArchbaseFloatingPanel.tsx +448 -0
  96. package/src/containers/index.ts +17 -0
  97. package/src/datagrid/components/pagination/grid-pagination.tsx +2 -2
  98. package/src/datagrid/export/ArchbaseDataGridExcelExport.tsx +293 -0
  99. package/src/datagrid/export/index.ts +8 -0
  100. package/src/datagrid/index.tsx +2 -0
  101. package/src/display/ArchbaseAnimationWrapper.tsx +272 -0
  102. package/src/display/ArchbaseBarcodeGenerator.tsx +303 -0
  103. package/src/display/ArchbaseCarousel.tsx +679 -0
  104. package/src/display/ArchbaseCodeViewer.tsx +271 -0
  105. package/src/display/ArchbaseDiffViewer.tsx +108 -0
  106. package/src/display/ArchbaseJsonTree.tsx +150 -0
  107. package/src/display/ArchbaseLightbox.tsx +279 -0
  108. package/src/display/ArchbaseMarquee.tsx +268 -0
  109. package/src/display/ArchbasePhotoAlbum.tsx +415 -0
  110. package/src/display/ArchbaseQRCode.tsx +137 -0
  111. package/src/display/ArchbaseTooltipRich.tsx +317 -0
  112. package/src/display/ArchbaseVirtualList.tsx +618 -0
  113. package/src/display/index.ts +94 -1
  114. package/src/editors/ArchbaseAIPromptInput.tsx +432 -0
  115. package/src/editors/ArchbaseBarcodeScanner.tsx +570 -0
  116. package/src/editors/ArchbaseCepInput.tsx +173 -0
  117. package/src/editors/ArchbaseColorGradientPicker.tsx +460 -0
  118. package/src/editors/ArchbaseCpfCnpjInput.tsx +193 -0
  119. package/src/editors/ArchbaseCurrencyInput.tsx +100 -0
  120. package/src/editors/ArchbaseDualListbox.tsx +671 -0
  121. package/src/editors/ArchbaseInPlaceEditor.tsx +406 -0
  122. package/src/editors/ArchbaseLightGrid.tsx +538 -0
  123. package/src/editors/ArchbaseMentionInput.tsx +384 -0
  124. package/src/editors/ArchbaseMultiEmail.tsx +367 -0
  125. package/src/editors/ArchbaseMultiViewCalendar.tsx +439 -0
  126. package/src/editors/ArchbaseNumberStepper.tsx +219 -0
  127. package/src/editors/ArchbaseOTPInput.tsx +133 -0
  128. package/src/editors/ArchbaseOperationHoursEditor.tsx +1 -1
  129. package/src/editors/ArchbasePhoneInput.tsx +355 -0
  130. package/src/editors/ArchbaseRangeSlider.tsx +109 -0
  131. package/src/editors/ArchbaseSignaturePad.tsx +425 -0
  132. package/src/editors/ArchbaseSpeechToTextInput.tsx +444 -0
  133. package/src/editors/ArchbaseSpreadsheet.tsx +388 -0
  134. package/src/editors/ArchbaseTagInput.tsx +326 -0
  135. package/src/editors/index.tsx +92 -0
  136. package/src/feedback/ArchbaseChunkProgressBar.tsx +156 -0
  137. package/src/feedback/ArchbaseRipple.tsx +278 -0
  138. package/src/feedback/ArchbaseSkeleton.tsx +419 -0
  139. package/src/feedback/index.ts +22 -1
  140. package/src/filters/ArchbaseColumnSelector.tsx +268 -0
  141. package/src/filters/index.ts +2 -0
  142. package/src/forms/ArchbaseFieldArray.tsx +305 -0
  143. package/src/forms/ArchbaseFormWizard.tsx +284 -0
  144. package/src/forms/ArchbaseStepper.tsx +137 -0
  145. package/src/forms/index.ts +24 -2
  146. package/src/forms/useArchbaseFormWizard.ts +283 -0
  147. package/src/hooks/index.ts +12 -0
  148. package/src/hooks/useArchbaseConfirm.ts +293 -0
  149. package/src/image/editor/functions/image-processing.ts +5 -0
  150. package/src/image/editor/index.tsx +305 -391
  151. package/src/image/index.ts +1 -0
  152. package/src/index.ts +3 -0
  153. package/src/list/ArchbaseTreeList.tsx +422 -0
  154. package/src/list/index.ts +3 -0
  155. package/src/navigation/ArchbaseActionSheet.tsx +301 -0
  156. package/src/navigation/ArchbaseAppBar.tsx +233 -0
  157. package/src/navigation/ArchbaseBottomNavigation.tsx +243 -0
  158. package/src/navigation/ArchbaseContextMenu.tsx +298 -0
  159. package/src/navigation/ArchbaseKeyboardShortcuts.tsx +472 -0
  160. package/src/navigation/ArchbaseSpotlight.tsx +483 -0
  161. package/src/navigation/index.ts +48 -1
  162. package/src/notification/ArchbaseNotificationCenter.tsx +502 -0
  163. package/src/notification/index.ts +2 -0
  164. package/src/onboarding/ArchbaseOnboardingTour.tsx +229 -102
  165. package/src/viewers/ArchbaseDocViewer.tsx +584 -0
  166. package/src/viewers/ArchbasePdfBuilder.tsx +291 -0
  167. package/src/viewers/ArchbaseXmlViewer.tsx +142 -0
  168. package/src/viewers/index.ts +12 -0
@@ -0,0 +1,303 @@
1
+ import React, { useEffect, useRef, useCallback, useState } from 'react';
2
+ import { Box, BoxProps, Text, Stack, Paper, Group, ActionIcon, Tooltip } from '@mantine/core';
3
+ import { IconDownload, IconCopy, IconCheck } from '@tabler/icons-react';
4
+
5
+ // =============================================================================
6
+ // Types
7
+ // =============================================================================
8
+
9
+ export type BarcodeFormat =
10
+ | 'CODE128'
11
+ | 'CODE128A'
12
+ | 'CODE128B'
13
+ | 'CODE128C'
14
+ | 'EAN13'
15
+ | 'EAN8'
16
+ | 'EAN5'
17
+ | 'EAN2'
18
+ | 'UPC'
19
+ | 'UPCE'
20
+ | 'ITF14'
21
+ | 'ITF'
22
+ | 'MSI'
23
+ | 'MSI10'
24
+ | 'MSI11'
25
+ | 'MSI1010'
26
+ | 'MSI1110'
27
+ | 'pharmacode'
28
+ | 'codabar';
29
+
30
+ export interface ArchbaseBarcodeGeneratorProps extends Omit<BoxProps, 'children'> {
31
+ /** Valor a ser codificado */
32
+ value: string;
33
+ /** Formato do código de barras */
34
+ format?: BarcodeFormat;
35
+ /** Largura de cada barra */
36
+ width?: number;
37
+ /** Altura das barras */
38
+ height?: number;
39
+ /** Mostrar valor abaixo do código */
40
+ displayValue?: boolean;
41
+ /** Cor de fundo */
42
+ background?: string;
43
+ /** Cor das linhas */
44
+ lineColor?: string;
45
+ /** Margem ao redor */
46
+ margin?: number;
47
+ /** Fonte do texto */
48
+ font?: string;
49
+ /** Tamanho da fonte */
50
+ fontSize?: number;
51
+ /** Alinhamento do texto */
52
+ textAlign?: 'left' | 'center' | 'right';
53
+ /** Posição do texto */
54
+ textPosition?: 'bottom' | 'top';
55
+ /** Margem do texto */
56
+ textMargin?: number;
57
+ /** Mostrar botões de ação (download, copiar) */
58
+ showActions?: boolean;
59
+ /** Nome do arquivo para download */
60
+ downloadFilename?: string;
61
+ /** Callback quando código é gerado */
62
+ onGenerated?: () => void;
63
+ /** Callback de erro */
64
+ onError?: (error: Error) => void;
65
+ /** Label opcional */
66
+ label?: string;
67
+ }
68
+
69
+ // =============================================================================
70
+ // JsBarcode Dynamic Import Check
71
+ // =============================================================================
72
+
73
+ let JsBarcode: any = null;
74
+
75
+ async function loadJsBarcode(): Promise<boolean> {
76
+ if (JsBarcode) return true;
77
+
78
+ try {
79
+ const module = await import('jsbarcode');
80
+ JsBarcode = module.default || module;
81
+ return true;
82
+ } catch (error) {
83
+ console.warn(
84
+ 'JsBarcode não está instalado. Instale com: npm install jsbarcode'
85
+ );
86
+ return false;
87
+ }
88
+ }
89
+
90
+ // =============================================================================
91
+ // ArchbaseBarcodeGenerator Component
92
+ // =============================================================================
93
+
94
+ export function ArchbaseBarcodeGenerator({
95
+ value,
96
+ format = 'CODE128',
97
+ width = 2,
98
+ height = 100,
99
+ displayValue = true,
100
+ background = '#ffffff',
101
+ lineColor = '#000000',
102
+ margin = 10,
103
+ font = 'monospace',
104
+ fontSize = 20,
105
+ textAlign = 'center',
106
+ textPosition = 'bottom',
107
+ textMargin = 2,
108
+ showActions = false,
109
+ downloadFilename = 'barcode',
110
+ onGenerated,
111
+ onError,
112
+ label,
113
+ ...boxProps
114
+ }: ArchbaseBarcodeGeneratorProps) {
115
+ const svgRef = useRef<SVGSVGElement>(null);
116
+ const [isLoaded, setIsLoaded] = useState(false);
117
+ const [error, setError] = useState<string | null>(null);
118
+ const [copied, setCopied] = useState(false);
119
+
120
+ // Load JsBarcode
121
+ useEffect(() => {
122
+ loadJsBarcode().then((loaded) => {
123
+ setIsLoaded(loaded);
124
+ if (!loaded) {
125
+ setError('JsBarcode não está disponível');
126
+ }
127
+ });
128
+ }, []);
129
+
130
+ // Generate barcode
131
+ useEffect(() => {
132
+ if (!isLoaded || !svgRef.current || !value) return;
133
+
134
+ try {
135
+ JsBarcode(svgRef.current, value, {
136
+ format,
137
+ width,
138
+ height,
139
+ displayValue,
140
+ background,
141
+ lineColor,
142
+ margin,
143
+ font,
144
+ fontSize,
145
+ textAlign,
146
+ textPosition,
147
+ textMargin,
148
+ });
149
+ setError(null);
150
+ onGenerated?.();
151
+ } catch (err) {
152
+ const errorMessage = err instanceof Error ? err.message : 'Erro ao gerar código de barras';
153
+ setError(errorMessage);
154
+ onError?.(err instanceof Error ? err : new Error(errorMessage));
155
+ }
156
+ }, [
157
+ isLoaded,
158
+ value,
159
+ format,
160
+ width,
161
+ height,
162
+ displayValue,
163
+ background,
164
+ lineColor,
165
+ margin,
166
+ font,
167
+ fontSize,
168
+ textAlign,
169
+ textPosition,
170
+ textMargin,
171
+ onGenerated,
172
+ onError,
173
+ ]);
174
+
175
+ // Download as PNG
176
+ const handleDownload = useCallback(() => {
177
+ if (!svgRef.current) return;
178
+
179
+ const svg = svgRef.current;
180
+ const svgData = new XMLSerializer().serializeToString(svg);
181
+ const canvas = document.createElement('canvas');
182
+ const ctx = canvas.getContext('2d');
183
+ const img = new Image();
184
+
185
+ img.onload = () => {
186
+ canvas.width = img.width;
187
+ canvas.height = img.height;
188
+ ctx?.drawImage(img, 0, 0);
189
+
190
+ const link = document.createElement('a');
191
+ link.download = `${downloadFilename}.png`;
192
+ link.href = canvas.toDataURL('image/png');
193
+ link.click();
194
+ };
195
+
196
+ img.src = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(svgData)));
197
+ }, [downloadFilename]);
198
+
199
+ // Copy SVG to clipboard
200
+ const handleCopy = useCallback(async () => {
201
+ if (!svgRef.current) return;
202
+
203
+ try {
204
+ const svgData = new XMLSerializer().serializeToString(svgRef.current);
205
+ await navigator.clipboard.writeText(svgData);
206
+ setCopied(true);
207
+ setTimeout(() => setCopied(false), 2000);
208
+ } catch (err) {
209
+ console.error('Erro ao copiar:', err);
210
+ }
211
+ }, []);
212
+
213
+ if (!isLoaded) {
214
+ return (
215
+ <Paper withBorder p="md" ta="center">
216
+ <Text size="sm" c="dimmed">
217
+ Carregando gerador de código de barras...
218
+ </Text>
219
+ </Paper>
220
+ );
221
+ }
222
+
223
+ if (error) {
224
+ return (
225
+ <Paper withBorder p="md" ta="center" bg="red.0">
226
+ <Text size="sm" c="red">
227
+ {error}
228
+ </Text>
229
+ </Paper>
230
+ );
231
+ }
232
+
233
+ return (
234
+ <Stack gap="xs">
235
+ {label && (
236
+ <Text fw={500} size="sm">
237
+ {label}
238
+ </Text>
239
+ )}
240
+
241
+ <Box {...boxProps}>
242
+ <Paper withBorder p="sm" bg={background}>
243
+ <Stack gap="xs" align="center">
244
+ <svg ref={svgRef} />
245
+
246
+ {showActions && (
247
+ <Group gap="xs">
248
+ <Tooltip label="Download PNG">
249
+ <ActionIcon variant="light" onClick={handleDownload}>
250
+ <IconDownload size={16} />
251
+ </ActionIcon>
252
+ </Tooltip>
253
+ <Tooltip label={copied ? 'Copiado!' : 'Copiar SVG'}>
254
+ <ActionIcon
255
+ variant="light"
256
+ color={copied ? 'green' : 'gray'}
257
+ onClick={handleCopy}
258
+ >
259
+ {copied ? <IconCheck size={16} /> : <IconCopy size={16} />}
260
+ </ActionIcon>
261
+ </Tooltip>
262
+ </Group>
263
+ )}
264
+ </Stack>
265
+ </Paper>
266
+ </Box>
267
+ </Stack>
268
+ );
269
+ }
270
+
271
+ // =============================================================================
272
+ // Convenience Components
273
+ // =============================================================================
274
+
275
+ /** Gerador de código EAN-13 */
276
+ export function ArchbaseEAN13Generator(
277
+ props: Omit<ArchbaseBarcodeGeneratorProps, 'format'>
278
+ ) {
279
+ return <ArchbaseBarcodeGenerator format="EAN13" {...props} />;
280
+ }
281
+
282
+ /** Gerador de código EAN-8 */
283
+ export function ArchbaseEAN8Generator(
284
+ props: Omit<ArchbaseBarcodeGeneratorProps, 'format'>
285
+ ) {
286
+ return <ArchbaseBarcodeGenerator format="EAN8" {...props} />;
287
+ }
288
+
289
+ /** Gerador de código UPC */
290
+ export function ArchbaseUPCGenerator(
291
+ props: Omit<ArchbaseBarcodeGeneratorProps, 'format'>
292
+ ) {
293
+ return <ArchbaseBarcodeGenerator format="UPC" {...props} />;
294
+ }
295
+
296
+ /** Gerador de código CODE128 */
297
+ export function ArchbaseCODE128Generator(
298
+ props: Omit<ArchbaseBarcodeGeneratorProps, 'format'>
299
+ ) {
300
+ return <ArchbaseBarcodeGenerator format="CODE128" {...props} />;
301
+ }
302
+
303
+ export default ArchbaseBarcodeGenerator;