karsten-design-system 1.2.28 → 1.2.31
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 +2 -3
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,14 +61,14 @@ Esta biblioteca requer as seguintes dependências:
|
|
|
61
61
|
1. Importe o componente desejado da biblioteca:
|
|
62
62
|
|
|
63
63
|
```jsx
|
|
64
|
-
import { Button } from 'karsten-design-system'
|
|
64
|
+
import { Button } from 'karsten-design-system'
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
2. Use o componente em seu projeto:
|
|
68
68
|
|
|
69
69
|
```jsx
|
|
70
70
|
function App() {
|
|
71
|
-
return <Button label="Clique aqui"
|
|
71
|
+
return <Button label="Clique aqui" />
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
74
|
|
|
@@ -83,7 +83,6 @@ function App() {
|
|
|
83
83
|
- `DateInput` - Campo de entrada para seleção de datas.
|
|
84
84
|
- `Dialog` - Modal para exibição de mensagens ou ações secundárias.
|
|
85
85
|
- `Divider` - Linha divisória para separação visual de conteúdo.
|
|
86
|
-
- `FilterButton` - Botão para aplicar ou remover filtros em listas ou tabelas.
|
|
87
86
|
- `Header` - Cabeçalho estilizado para títulos ou menus.
|
|
88
87
|
- `IconButton` - Botão com ícone, ideal para ações rápidas.
|
|
89
88
|
- `InfoCard` - Cartão informativo para exibir alertas ou dados destacados.
|
package/dist/index.js
CHANGED
|
@@ -157,6 +157,10 @@ function CalendarInput({ error, placeholder = 'Selecione uma data', label, disab
|
|
|
157
157
|
const calendarRef = useRef(null);
|
|
158
158
|
const hasError = (error && !disabled) || (!!error && !disabled);
|
|
159
159
|
const [isDarkMode, setIsDarkMode] = useState(false);
|
|
160
|
+
const [isClient, setIsClient] = useState(false);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
setIsClient(true);
|
|
163
|
+
}, []);
|
|
160
164
|
const dateTemplate = (data) => {
|
|
161
165
|
const date = new Date(`${data.year}/${data.month + 1}/${data.day}`);
|
|
162
166
|
const dayComponent = (className) => {
|
|
@@ -188,6 +192,8 @@ function CalendarInput({ error, placeholder = 'Selecione uma data', label, disab
|
|
|
188
192
|
}
|
|
189
193
|
};
|
|
190
194
|
useEffect(() => {
|
|
195
|
+
if (!isClient || typeof document === 'undefined')
|
|
196
|
+
return;
|
|
191
197
|
const htmlClassList = document.documentElement.classList;
|
|
192
198
|
setIsDarkMode(htmlClassList.contains('dark'));
|
|
193
199
|
const observer = new MutationObserver(() => {
|
|
@@ -198,7 +204,7 @@ function CalendarInput({ error, placeholder = 'Selecione uma data', label, disab
|
|
|
198
204
|
attributeFilter: ['class'],
|
|
199
205
|
});
|
|
200
206
|
return () => observer.disconnect();
|
|
201
|
-
}, []);
|
|
207
|
+
}, [isClient]);
|
|
202
208
|
return (jsx("div", { className: "relative flex flex-col w-full min-w-full", children: jsxs("div", { onClick: handleInputClick, children: [jsx(FloatingLabel, { value: props?.value ? props.value.toString() : '', label: label, disabled: disabled, error: error }), jsxs("div", { className: "relative w-full min-w-full", children: [jsx(Calendar, { ...props, disabled: disabled, placeholder: placeholder, ref: calendarRef, panelStyle: { width: '420px', height: '410px' }, className: clsx('w-full min-w-full focus:shadow-none border-none z-0 font-roboto border rounded-md', hasError
|
|
203
209
|
? 'border-redError placeholder:!text-redError p-invalid'
|
|
204
210
|
: 'border-light-700 focus:border-primary', disabled && 'border-light-100 text-disabled', error && 'border-redError text-redError p-invalid', !error && 'border-light-700 p-custom'), dateFormat: "dd/mm/yy", inputStyle: {
|
|
@@ -232,6 +238,10 @@ function CardIconsButton({ label, leftIcon, onClick, }) {
|
|
|
232
238
|
|
|
233
239
|
function Charts({ type, labels, datasets, title, stacked = false, horizontal = false, legendPosition = 'top', }) {
|
|
234
240
|
const [isDarkMode, setIsDarkMode] = useState(false);
|
|
241
|
+
const [isClient, setIsClient] = useState(false);
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
setIsClient(true);
|
|
244
|
+
}, []);
|
|
235
245
|
const chartData = {
|
|
236
246
|
labels,
|
|
237
247
|
datasets: datasets.map((ds) => ({
|
|
@@ -281,6 +291,8 @@ function Charts({ type, labels, datasets, title, stacked = false, horizontal = f
|
|
|
281
291
|
},
|
|
282
292
|
};
|
|
283
293
|
useEffect(() => {
|
|
294
|
+
if (!isClient || typeof document === 'undefined')
|
|
295
|
+
return;
|
|
284
296
|
const htmlClassList = document.documentElement.classList;
|
|
285
297
|
setIsDarkMode(htmlClassList.contains('dark'));
|
|
286
298
|
const observer = new MutationObserver(() => {
|
|
@@ -291,7 +303,7 @@ function Charts({ type, labels, datasets, title, stacked = false, horizontal = f
|
|
|
291
303
|
attributeFilter: ['class'],
|
|
292
304
|
});
|
|
293
305
|
return () => observer.disconnect();
|
|
294
|
-
}, []);
|
|
306
|
+
}, [isClient]);
|
|
295
307
|
return (jsx(Chart, { type: chartType, data: chartData, options: chartOptions, className: "w-full h-full", "aria-label": "chart" }));
|
|
296
308
|
}
|
|
297
309
|
|