@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,288 @@
1
+ import React, { forwardRef, useMemo } from 'react';
2
+ import { Box, Text, Stack, MantineColor, MantineSize } from '@mantine/core';
3
+
4
+ export interface ArchbaseLinearGaugeZone {
5
+ /** Valor inicial da zona */
6
+ from: number;
7
+ /** Valor final da zona */
8
+ to: number;
9
+ /** Cor da zona */
10
+ color: MantineColor;
11
+ /** Label opcional */
12
+ label?: string;
13
+ }
14
+
15
+ export interface ArchbaseLinearGaugeProps {
16
+ /** Valor atual */
17
+ value: number;
18
+ /** Valor mínimo */
19
+ min?: number;
20
+ /** Valor máximo */
21
+ max?: number;
22
+ /** Orientação */
23
+ orientation?: 'horizontal' | 'vertical';
24
+ /** Zonas coloridas */
25
+ zones?: ArchbaseLinearGaugeZone[];
26
+ /** Cor padrão da barra */
27
+ color?: MantineColor;
28
+ /** Cor do fundo */
29
+ backgroundColor?: MantineColor;
30
+ /** Cor do indicador */
31
+ indicatorColor?: MantineColor;
32
+ /** Largura (horizontal) ou altura (vertical) */
33
+ size?: number;
34
+ /** Espessura da barra */
35
+ thickness?: number;
36
+ /** Se deve mostrar o valor */
37
+ showValue?: boolean;
38
+ /** Formato do valor */
39
+ valueFormat?: (value: number) => string;
40
+ /** Sufixo do valor */
41
+ valueSuffix?: string;
42
+ /** Label */
43
+ label?: string;
44
+ /** Tamanho do label */
45
+ labelSize?: MantineSize;
46
+ /** Se deve mostrar ticks */
47
+ showTicks?: boolean;
48
+ /** Número de ticks */
49
+ tickCount?: number;
50
+ /** Se deve mostrar labels nos ticks */
51
+ showTickLabels?: boolean;
52
+ /** Classe CSS */
53
+ className?: string;
54
+ /** Estilo */
55
+ style?: React.CSSProperties;
56
+ }
57
+
58
+ export const ArchbaseLinearGauge = forwardRef<HTMLDivElement, ArchbaseLinearGaugeProps>(
59
+ (
60
+ {
61
+ value,
62
+ min = 0,
63
+ max = 100,
64
+ orientation = 'horizontal',
65
+ zones,
66
+ color = 'blue',
67
+ backgroundColor = 'gray.2',
68
+ indicatorColor = 'dark',
69
+ size = 200,
70
+ thickness = 20,
71
+ showValue = true,
72
+ valueFormat,
73
+ valueSuffix = '',
74
+ label,
75
+ labelSize = 'sm',
76
+ showTicks = false,
77
+ tickCount = 5,
78
+ showTickLabels = false,
79
+ className,
80
+ style,
81
+ },
82
+ ref
83
+ ) => {
84
+ const isHorizontal = orientation === 'horizontal';
85
+ const svgWidth = isHorizontal ? size : thickness + 40;
86
+ const svgHeight = isHorizontal ? thickness + 40 : size;
87
+
88
+ // Normaliza o valor para percentual
89
+ const normalizedValue = useMemo(() => {
90
+ const clamped = Math.min(max, Math.max(min, value));
91
+ return ((clamped - min) / (max - min)) * 100;
92
+ }, [max, min, value]);
93
+
94
+ // Posição do indicador
95
+ const indicatorPosition = useMemo(() => {
96
+ const barLength = size - 20; // Margem para o indicador
97
+ return 10 + (normalizedValue / 100) * barLength;
98
+ }, [normalizedValue, size]);
99
+
100
+ // Gera as zonas da barra
101
+ const barZones = useMemo(() => {
102
+ const barLength = size - 20;
103
+ const barStart = 10;
104
+
105
+ if (!zones || zones.length === 0) {
106
+ // Zona única
107
+ const valueLength = (normalizedValue / 100) * barLength;
108
+ return [
109
+ {
110
+ x: isHorizontal ? barStart : 20,
111
+ y: isHorizontal ? 20 : barStart + barLength - valueLength,
112
+ width: isHorizontal ? valueLength : thickness,
113
+ height: isHorizontal ? thickness : valueLength,
114
+ color: `var(--mantine-color-${color}-6)`,
115
+ },
116
+ ];
117
+ }
118
+
119
+ // Múltiplas zonas
120
+ return zones.map((zone) => {
121
+ const fromPercent = ((zone.from - min) / (max - min)) * 100;
122
+ const toPercent = ((zone.to - min) / (max - min)) * 100;
123
+ const clampedFrom = Math.max(0, Math.min(fromPercent, normalizedValue));
124
+ const clampedTo = Math.max(0, Math.min(toPercent, normalizedValue));
125
+
126
+ if (clampedFrom >= clampedTo) return null;
127
+
128
+ const start = (clampedFrom / 100) * barLength;
129
+ const length = ((clampedTo - clampedFrom) / 100) * barLength;
130
+
131
+ return {
132
+ x: isHorizontal ? barStart + start : 20,
133
+ y: isHorizontal ? 20 : barStart + barLength - start - length,
134
+ width: isHorizontal ? length : thickness,
135
+ height: isHorizontal ? thickness : length,
136
+ color: `var(--mantine-color-${zone.color}-6)`,
137
+ };
138
+ }).filter(Boolean);
139
+ }, [color, isHorizontal, max, min, normalizedValue, size, thickness, zones]);
140
+
141
+ // Gera os ticks
142
+ const ticks = useMemo(() => {
143
+ if (!showTicks) return [];
144
+
145
+ const barLength = size - 20;
146
+ const barStart = 10;
147
+ const result: Array<{
148
+ x1: number;
149
+ y1: number;
150
+ x2: number;
151
+ y2: number;
152
+ labelX: number;
153
+ labelY: number;
154
+ value: number;
155
+ }> = [];
156
+
157
+ for (let i = 0; i <= tickCount; i++) {
158
+ const tickValue = min + (i / tickCount) * (max - min);
159
+ const position = barStart + (i / tickCount) * barLength;
160
+ const tickLength = 6;
161
+
162
+ if (isHorizontal) {
163
+ result.push({
164
+ x1: position,
165
+ y1: 20 + thickness,
166
+ x2: position,
167
+ y2: 20 + thickness + tickLength,
168
+ labelX: position,
169
+ labelY: 20 + thickness + tickLength + 12,
170
+ value: tickValue,
171
+ });
172
+ } else {
173
+ result.push({
174
+ x1: 20 + thickness,
175
+ y1: barStart + barLength - (i / tickCount) * barLength,
176
+ x2: 20 + thickness + tickLength,
177
+ y2: barStart + barLength - (i / tickCount) * barLength,
178
+ labelX: 20 + thickness + tickLength + 15,
179
+ labelY: barStart + barLength - (i / tickCount) * barLength,
180
+ value: tickValue,
181
+ });
182
+ }
183
+ }
184
+
185
+ return result;
186
+ }, [isHorizontal, max, min, showTicks, size, thickness, tickCount]);
187
+
188
+ // Formata o valor para exibição
189
+ const displayValue = useMemo(() => {
190
+ if (valueFormat) {
191
+ return valueFormat(value);
192
+ }
193
+ return `${Math.round(value)}${valueSuffix}`;
194
+ }, [value, valueFormat, valueSuffix]);
195
+
196
+ // Coordenadas do indicador (triângulo)
197
+ const indicatorPoints = useMemo(() => {
198
+ const triangleSize = 8;
199
+
200
+ if (isHorizontal) {
201
+ const cx = indicatorPosition;
202
+ const cy = 20 - 2;
203
+ return `${cx},${cy - triangleSize} ${cx - triangleSize / 2},${cy} ${cx + triangleSize / 2},${cy}`;
204
+ } else {
205
+ const cx = 20 - 2;
206
+ const cy = 10 + size - 20 - (normalizedValue / 100) * (size - 20);
207
+ return `${cx - triangleSize},${cy} ${cx},${cy - triangleSize / 2} ${cx},${cy + triangleSize / 2}`;
208
+ }
209
+ }, [indicatorPosition, isHorizontal, normalizedValue, size]);
210
+
211
+ return (
212
+ <Stack ref={ref} gap={4} align="center" className={className} style={style}>
213
+ {label && (
214
+ <Text size={labelSize} c="dimmed">
215
+ {label}
216
+ </Text>
217
+ )}
218
+
219
+ <svg width={svgWidth} height={svgHeight}>
220
+ {/* Background bar */}
221
+ <rect
222
+ x={isHorizontal ? 10 : 20}
223
+ y={isHorizontal ? 20 : 10}
224
+ width={isHorizontal ? size - 20 : thickness}
225
+ height={isHorizontal ? thickness : size - 20}
226
+ rx={4}
227
+ fill={`var(--mantine-color-${backgroundColor})`}
228
+ />
229
+
230
+ {/* Value zones */}
231
+ {barZones.map((zone, index) => (
232
+ zone && (
233
+ <rect
234
+ key={index}
235
+ x={zone.x}
236
+ y={zone.y}
237
+ width={zone.width}
238
+ height={zone.height}
239
+ rx={4}
240
+ fill={zone.color}
241
+ />
242
+ )
243
+ ))}
244
+
245
+ {/* Ticks */}
246
+ {ticks.map((tick, index) => (
247
+ <g key={index}>
248
+ <line
249
+ x1={tick.x1}
250
+ y1={tick.y1}
251
+ x2={tick.x2}
252
+ y2={tick.y2}
253
+ stroke="var(--mantine-color-gray-5)"
254
+ strokeWidth={1}
255
+ />
256
+ {showTickLabels && (
257
+ <text
258
+ x={tick.labelX}
259
+ y={tick.labelY}
260
+ textAnchor="middle"
261
+ dominantBaseline="middle"
262
+ fontSize={10}
263
+ fill="var(--mantine-color-gray-6)"
264
+ >
265
+ {Math.round(tick.value)}
266
+ </text>
267
+ )}
268
+ </g>
269
+ ))}
270
+
271
+ {/* Indicator triangle */}
272
+ <polygon
273
+ points={indicatorPoints}
274
+ fill={`var(--mantine-color-${indicatorColor}-7)`}
275
+ />
276
+ </svg>
277
+
278
+ {showValue && (
279
+ <Text size="sm" fw={600}>
280
+ {displayValue}
281
+ </Text>
282
+ )}
283
+ </Stack>
284
+ );
285
+ }
286
+ );
287
+
288
+ ArchbaseLinearGauge.displayName = 'ArchbaseLinearGauge';