@ttoss/components 2.14.20 → 2.14.21
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/dist/Accordion/index.d.mts +157 -0
- package/dist/Accordion/index.mjs +175 -0
- package/dist/DatePicker/index.d.mts +26 -0
- package/dist/DatePicker/index.mjs +339 -0
- package/dist/Drawer/index.d.mts +17 -0
- package/dist/{esm/Drawer/index.js → Drawer/index.mjs} +21 -14
- package/dist/EnhancedTitle/{index.d.ts → index.d.mts} +57 -47
- package/dist/EnhancedTitle/index.mjs +234 -0
- package/dist/FileUploader/index.d.mts +77 -0
- package/dist/FileUploader/index.mjs +386 -0
- package/dist/InstallPwa/index.d.mts +13 -0
- package/dist/InstallPwa/index.mjs +64 -0
- package/dist/JsonEditor/index.d.mts +3 -0
- package/dist/{esm/JsonEditor/index.js → JsonEditor/index.mjs} +0 -3
- package/dist/JsonView/index.d.mts +3 -0
- package/dist/{esm/JsonView/index.js → JsonView/index.mjs} +0 -3
- package/dist/List/{index.d.ts → index.d.mts} +9 -6
- package/dist/List/index.mjs +34 -0
- package/dist/LockedOverlay/index.d.mts +162 -0
- package/dist/LockedOverlay/index.mjs +386 -0
- package/dist/Markdown/index.d.mts +16 -0
- package/dist/Markdown/index.mjs +26 -0
- package/dist/Menu/index.d.mts +16 -0
- package/dist/{esm/Menu/index.js → Menu/index.mjs} +56 -51
- package/dist/MetricCard/index.d.mts +153 -0
- package/dist/MetricCard/index.mjs +408 -0
- package/dist/Modal/index.d.mts +11 -0
- package/dist/{esm/Modal/index.js → Modal/index.mjs} +11 -12
- package/dist/NavList/index.d.mts +64 -0
- package/dist/{esm/NavList/index.js → NavList/index.mjs} +79 -73
- package/dist/NotificationCard/index.d.mts +22 -0
- package/dist/NotificationCard/index.mjs +173 -0
- package/dist/NotificationsMenu/index.d.mts +47 -0
- package/dist/NotificationsMenu/index.mjs +380 -0
- package/dist/Search/index.d.mts +18 -0
- package/dist/{esm/Search/index.js → Search/index.mjs} +11 -9
- package/dist/SpotlightCard/index.d.mts +36 -0
- package/dist/SpotlightCard/index.mjs +219 -0
- package/dist/Table/index.d.mts +17 -0
- package/dist/Table/index.mjs +64 -0
- package/dist/Tabs/index.d.mts +17 -0
- package/dist/{esm/Tabs/index.js → Tabs/index.mjs} +24 -12
- package/dist/Toast/index.d.mts +8 -0
- package/dist/Toast/index.mjs +43 -0
- package/package.json +15 -15
- package/dist/Accordion/index.d.ts +0 -148
- package/dist/DatePicker/index.d.ts +0 -20
- package/dist/Drawer/index.d.ts +0 -12
- package/dist/LockedOverlay/index.d.ts +0 -151
- package/dist/Markdown/index.d.ts +0 -11
- package/dist/Menu/index.d.ts +0 -11
- package/dist/MetricCard/index.d.ts +0 -148
- package/dist/Modal/index.d.ts +0 -10
- package/dist/NavList/index.d.ts +0 -55
- package/dist/NotificationCard/index.d.ts +0 -21
- package/dist/NotificationsMenu/index.d.ts +0 -36
- package/dist/Search/index.d.ts +0 -11
- package/dist/SpotlightCard/index.d.ts +0 -27
- package/dist/Table/index.d.ts +0 -16
- package/dist/esm/Accordion/index.js +0 -119
- package/dist/esm/DatePicker/index.js +0 -331
- package/dist/esm/EnhancedTitle/index.js +0 -190
- package/dist/esm/FileUploader/index.js +0 -401
- package/dist/esm/InstallPwa/index.js +0 -61
- package/dist/esm/List/index.js +0 -30
- package/dist/esm/LockedOverlay/index.js +0 -316
- package/dist/esm/Markdown/index.js +0 -23
- package/dist/esm/MetricCard/index.js +0 -327
- package/dist/esm/NotificationCard/index.js +0 -156
- package/dist/esm/NotificationsMenu/index.js +0 -359
- package/dist/esm/SpotlightCard/index.js +0 -212
- package/dist/esm/Table/index.js +0 -63
- package/dist/esm/Toast/index.js +0 -38
- package/dist/esm/chunk-V4MHYKRI.js +0 -7
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { defineMessages, useI18n } from "@ttoss/react-i18n";
|
|
3
|
+
import { Icon } from "@ttoss/react-icons";
|
|
4
|
+
import { Box, Card, Flex, Text, TooltipIcon } from "@ttoss/ui";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/MetricCard/MetricCard.tsx
|
|
8
|
+
const messages = defineMessages({
|
|
9
|
+
ofMax: {
|
|
10
|
+
id: "oYpm71",
|
|
11
|
+
defaultMessage: [{
|
|
12
|
+
"type": 0,
|
|
13
|
+
"value": "of "
|
|
14
|
+
}, {
|
|
15
|
+
"type": 1,
|
|
16
|
+
"value": "max"
|
|
17
|
+
}]
|
|
18
|
+
},
|
|
19
|
+
percentageUsed: {
|
|
20
|
+
id: "zr0OS6",
|
|
21
|
+
defaultMessage: [{
|
|
22
|
+
"type": 1,
|
|
23
|
+
"value": "percentage"
|
|
24
|
+
}, {
|
|
25
|
+
"type": 0,
|
|
26
|
+
"value": "% used"
|
|
27
|
+
}]
|
|
28
|
+
},
|
|
29
|
+
unlimited: {
|
|
30
|
+
id: "rskBv4",
|
|
31
|
+
defaultMessage: [{
|
|
32
|
+
"type": 0,
|
|
33
|
+
"value": "Unlimited"
|
|
34
|
+
}]
|
|
35
|
+
},
|
|
36
|
+
infinity: {
|
|
37
|
+
id: "0EjvY6",
|
|
38
|
+
defaultMessage: [{
|
|
39
|
+
"type": 0,
|
|
40
|
+
"value": "∞"
|
|
41
|
+
}]
|
|
42
|
+
},
|
|
43
|
+
nearLimit: {
|
|
44
|
+
id: "1DbX9V",
|
|
45
|
+
defaultMessage: [{
|
|
46
|
+
"type": 0,
|
|
47
|
+
"value": "Near limit"
|
|
48
|
+
}]
|
|
49
|
+
},
|
|
50
|
+
reachedLimit: {
|
|
51
|
+
id: "4NwCn9",
|
|
52
|
+
defaultMessage: [{
|
|
53
|
+
"type": 0,
|
|
54
|
+
"value": "Reached limit"
|
|
55
|
+
}]
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Icon wrapper for metric cards.
|
|
60
|
+
*/
|
|
61
|
+
const MetricIconWrapper = ({
|
|
62
|
+
icon
|
|
63
|
+
}) => {
|
|
64
|
+
return /* @__PURE__ */jsx(Flex, {
|
|
65
|
+
sx: {
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
borderRadius: "full",
|
|
69
|
+
border: "md",
|
|
70
|
+
borderColor: "display.border.muted.default",
|
|
71
|
+
backgroundColor: "display.background.muted.default",
|
|
72
|
+
color: "display.text.secondary.default",
|
|
73
|
+
width: "48px",
|
|
74
|
+
height: "48px",
|
|
75
|
+
flexShrink: 0
|
|
76
|
+
},
|
|
77
|
+
children: icon && /* @__PURE__ */jsx(Icon, {
|
|
78
|
+
icon
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Card header with label, tooltip, and optional clickable icon.
|
|
84
|
+
*/
|
|
85
|
+
const MetricCardHeader = ({
|
|
86
|
+
label,
|
|
87
|
+
tooltip,
|
|
88
|
+
isClickable
|
|
89
|
+
}) => {
|
|
90
|
+
const isTooltipAction = typeof tooltip === "function";
|
|
91
|
+
const tooltipText = typeof tooltip === "string" ? tooltip : void 0;
|
|
92
|
+
return /* @__PURE__ */jsxs(Flex, {
|
|
93
|
+
sx: {
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
gap: "2"
|
|
96
|
+
},
|
|
97
|
+
children: [/* @__PURE__ */jsx(Text, {
|
|
98
|
+
sx: {
|
|
99
|
+
fontSize: "sm",
|
|
100
|
+
fontWeight: "medium",
|
|
101
|
+
color: "display.text.secondary.default"
|
|
102
|
+
},
|
|
103
|
+
children: label
|
|
104
|
+
}), tooltipText && /* @__PURE__ */jsx(TooltipIcon, {
|
|
105
|
+
icon: "fluent:info-24-regular",
|
|
106
|
+
tooltip: {
|
|
107
|
+
children: tooltipText
|
|
108
|
+
},
|
|
109
|
+
variant: "info"
|
|
110
|
+
}), isTooltipAction && /* @__PURE__ */jsx(Text, {
|
|
111
|
+
onClick: e => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
tooltip();
|
|
114
|
+
},
|
|
115
|
+
sx: {
|
|
116
|
+
fontSize: "sm",
|
|
117
|
+
color: "display.text.secondary.default",
|
|
118
|
+
cursor: "pointer",
|
|
119
|
+
":hover": {
|
|
120
|
+
color: "action.text.primary.default"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
children: /* @__PURE__ */jsx(Icon, {
|
|
124
|
+
icon: "fluent:info-24-regular",
|
|
125
|
+
inline: true
|
|
126
|
+
})
|
|
127
|
+
}), isClickable && /* @__PURE__ */jsx(Text, {
|
|
128
|
+
sx: {
|
|
129
|
+
fontSize: "sm",
|
|
130
|
+
color: "display.text.secondary.default"
|
|
131
|
+
},
|
|
132
|
+
children: /* @__PURE__ */jsx(Icon, {
|
|
133
|
+
icon: "fluent:open-24-regular",
|
|
134
|
+
inline: true
|
|
135
|
+
})
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Renders the content for a date metric.
|
|
141
|
+
*/
|
|
142
|
+
const DateMetricContent = ({
|
|
143
|
+
metric
|
|
144
|
+
}) => {
|
|
145
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
146
|
+
children: [/* @__PURE__ */jsx(Text, {
|
|
147
|
+
sx: {
|
|
148
|
+
fontSize: "2xl",
|
|
149
|
+
fontWeight: "bold",
|
|
150
|
+
color: "display.text.primary.default"
|
|
151
|
+
},
|
|
152
|
+
children: metric.date
|
|
153
|
+
}), metric.remainingDaysMessage && /* @__PURE__ */jsxs(Flex, {
|
|
154
|
+
sx: {
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
gap: "2"
|
|
157
|
+
},
|
|
158
|
+
children: [/* @__PURE__ */jsx(Text, {
|
|
159
|
+
sx: {
|
|
160
|
+
fontSize: "sm",
|
|
161
|
+
color: metric.isWarning ? "feedback.text.caution.default" : "display.text.secondary.default"
|
|
162
|
+
},
|
|
163
|
+
children: /* @__PURE__ */jsx(Icon, {
|
|
164
|
+
icon: metric.isWarning ? "fluent:warning-24-regular" : "fluent:clock-24-regular",
|
|
165
|
+
inline: true
|
|
166
|
+
})
|
|
167
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
168
|
+
sx: {
|
|
169
|
+
fontSize: "sm",
|
|
170
|
+
color: metric.isWarning ? "feedback.text.caution.default" : "display.text.secondary.default"
|
|
171
|
+
},
|
|
172
|
+
children: metric.remainingDaysMessage
|
|
173
|
+
})]
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Renders the content for a percentage metric.
|
|
179
|
+
*/
|
|
180
|
+
const PercentageMetricContent = ({
|
|
181
|
+
metric
|
|
182
|
+
}) => {
|
|
183
|
+
const {
|
|
184
|
+
intl
|
|
185
|
+
} = useI18n();
|
|
186
|
+
const percentage = metric.max === null || metric.max <= 0 ? null : Math.min(Math.round(metric.current / metric.max * 100), 100);
|
|
187
|
+
const formatValue = metric.formatValue || (val => {
|
|
188
|
+
return val.toString();
|
|
189
|
+
});
|
|
190
|
+
const showAlert = percentage !== null && metric.showAlertThreshold !== void 0 && percentage >= metric.showAlertThreshold;
|
|
191
|
+
const isOverLimit = percentage !== null && percentage >= 100;
|
|
192
|
+
const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages.infinity);
|
|
193
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
194
|
+
children: [/* @__PURE__ */jsxs(Flex, {
|
|
195
|
+
sx: {
|
|
196
|
+
alignItems: "baseline",
|
|
197
|
+
justifyContent: "space-between",
|
|
198
|
+
gap: "2"
|
|
199
|
+
},
|
|
200
|
+
children: [/* @__PURE__ */jsx(Text, {
|
|
201
|
+
sx: {
|
|
202
|
+
fontSize: "2xl",
|
|
203
|
+
fontWeight: "bold",
|
|
204
|
+
color: "display.text.primary.default"
|
|
205
|
+
},
|
|
206
|
+
children: formatValue(metric.current)
|
|
207
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
208
|
+
sx: {
|
|
209
|
+
fontSize: "sm",
|
|
210
|
+
color: "display.text.secondary.default"
|
|
211
|
+
},
|
|
212
|
+
children: intl.formatMessage(messages.ofMax, {
|
|
213
|
+
max: maxText
|
|
214
|
+
})
|
|
215
|
+
})]
|
|
216
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
217
|
+
sx: {
|
|
218
|
+
width: "full",
|
|
219
|
+
height: "8px",
|
|
220
|
+
backgroundColor: "display.background.secondary.default",
|
|
221
|
+
borderRadius: "full",
|
|
222
|
+
overflow: "hidden"
|
|
223
|
+
},
|
|
224
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
225
|
+
sx: {
|
|
226
|
+
height: "full",
|
|
227
|
+
width: percentage !== null ? `${percentage}%` : "100%",
|
|
228
|
+
backgroundColor: "action.background.primary.default",
|
|
229
|
+
borderRadius: "full",
|
|
230
|
+
transition: "width 0.5s ease-out"
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
}), /* @__PURE__ */jsxs(Flex, {
|
|
234
|
+
sx: {
|
|
235
|
+
alignItems: "center",
|
|
236
|
+
justifyContent: "space-between",
|
|
237
|
+
fontSize: "xs"
|
|
238
|
+
},
|
|
239
|
+
children: [/* @__PURE__ */jsx(Text, {
|
|
240
|
+
sx: {
|
|
241
|
+
color: "display.text.secondary.default"
|
|
242
|
+
},
|
|
243
|
+
children: percentage !== null ? intl.formatMessage(messages.percentageUsed, {
|
|
244
|
+
percentage
|
|
245
|
+
}) : intl.formatMessage(messages.unlimited)
|
|
246
|
+
}), showAlert && !isOverLimit && /* @__PURE__ */jsxs(Flex, {
|
|
247
|
+
sx: {
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
gap: "1",
|
|
250
|
+
color: "feedback.text.caution.default"
|
|
251
|
+
},
|
|
252
|
+
children: [/* @__PURE__ */jsx(Icon, {
|
|
253
|
+
icon: "fluent:warning-24-regular"
|
|
254
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
255
|
+
sx: {
|
|
256
|
+
fontWeight: "medium"
|
|
257
|
+
},
|
|
258
|
+
children: intl.formatMessage(messages.nearLimit)
|
|
259
|
+
})]
|
|
260
|
+
}), showAlert && isOverLimit && /* @__PURE__ */jsxs(Flex, {
|
|
261
|
+
sx: {
|
|
262
|
+
alignItems: "center",
|
|
263
|
+
gap: "1",
|
|
264
|
+
color: "feedback.text.negative.default"
|
|
265
|
+
},
|
|
266
|
+
children: [/* @__PURE__ */jsx(Icon, {
|
|
267
|
+
icon: "fluent:warning-24-regular"
|
|
268
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
269
|
+
sx: {
|
|
270
|
+
fontWeight: "medium",
|
|
271
|
+
color: "feedback.text.negative.default"
|
|
272
|
+
},
|
|
273
|
+
children: intl.formatMessage(messages.reachedLimit)
|
|
274
|
+
})]
|
|
275
|
+
})]
|
|
276
|
+
})]
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Renders the content for a number metric.
|
|
281
|
+
*/
|
|
282
|
+
const NumberMetricContent = ({
|
|
283
|
+
metric
|
|
284
|
+
}) => {
|
|
285
|
+
const {
|
|
286
|
+
intl
|
|
287
|
+
} = useI18n();
|
|
288
|
+
const formatValue = metric.formatValue || (val => {
|
|
289
|
+
return val.toString();
|
|
290
|
+
});
|
|
291
|
+
const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages.infinity);
|
|
292
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
293
|
+
children: [/* @__PURE__ */jsxs(Flex, {
|
|
294
|
+
sx: {
|
|
295
|
+
alignItems: "baseline",
|
|
296
|
+
gap: "3"
|
|
297
|
+
},
|
|
298
|
+
children: [/* @__PURE__ */jsx(Text, {
|
|
299
|
+
sx: {
|
|
300
|
+
fontSize: "2xl",
|
|
301
|
+
fontWeight: "bold",
|
|
302
|
+
color: "display.text.primary.default"
|
|
303
|
+
},
|
|
304
|
+
children: formatValue(metric.current)
|
|
305
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
306
|
+
sx: {
|
|
307
|
+
fontSize: "sm",
|
|
308
|
+
color: "display.text.secondary.default"
|
|
309
|
+
},
|
|
310
|
+
children: intl.formatMessage(messages.ofMax, {
|
|
311
|
+
max: maxText
|
|
312
|
+
})
|
|
313
|
+
})]
|
|
314
|
+
}), metric.footerText && /* @__PURE__ */jsx(Text, {
|
|
315
|
+
sx: {
|
|
316
|
+
fontSize: "xs",
|
|
317
|
+
color: "display.text.secondary.default",
|
|
318
|
+
lineHeight: "relaxed",
|
|
319
|
+
maxWidth: "300px"
|
|
320
|
+
},
|
|
321
|
+
children: metric.footerText
|
|
322
|
+
})]
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* MetricCard component displays a metric in a consistent card layout.
|
|
327
|
+
*
|
|
328
|
+
* It supports three metric types:
|
|
329
|
+
* - **date**: displays a date and optional remaining-days message
|
|
330
|
+
* - **percentage**: displays current/max values and a progress bar
|
|
331
|
+
* - **number**: displays current/max values and an optional footer text
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```tsx
|
|
335
|
+
* <MetricCard
|
|
336
|
+
* metric={{
|
|
337
|
+
* type: 'date',
|
|
338
|
+
* label: 'Renewal date',
|
|
339
|
+
* date: '31/12/2025',
|
|
340
|
+
* icon: 'fluent:calendar-24-regular',
|
|
341
|
+
* remainingDaysMessage: '10 days remaining',
|
|
342
|
+
* }}
|
|
343
|
+
* />
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```tsx
|
|
348
|
+
* <MetricCard
|
|
349
|
+
* metric={{
|
|
350
|
+
* type: 'percentage',
|
|
351
|
+
* label: 'Plan usage',
|
|
352
|
+
* current: 350,
|
|
353
|
+
* max: 1000,
|
|
354
|
+
* icon: 'fluent:gauge-24-regular',
|
|
355
|
+
* showAlertThreshold: 80,
|
|
356
|
+
* }}
|
|
357
|
+
* />
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
const MetricCard = ({
|
|
361
|
+
metric,
|
|
362
|
+
isLoading = false
|
|
363
|
+
}) => {
|
|
364
|
+
if (isLoading) return null;
|
|
365
|
+
const isClickable = Boolean(metric.onClick || metric.helpArticleAction);
|
|
366
|
+
return /* @__PURE__ */jsx(Card, {
|
|
367
|
+
onClick: metric.onClick || metric.helpArticleAction,
|
|
368
|
+
sx: {
|
|
369
|
+
backgroundColor: "display.background.muted.default",
|
|
370
|
+
padding: "6",
|
|
371
|
+
cursor: isClickable ? "pointer" : "default",
|
|
372
|
+
transition: "all 0.2s ease",
|
|
373
|
+
minWidth: ["full", "full", "400px"],
|
|
374
|
+
":hover": {
|
|
375
|
+
transform: "scale(1.01)"
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
379
|
+
sx: {
|
|
380
|
+
gap: "4",
|
|
381
|
+
width: "full"
|
|
382
|
+
},
|
|
383
|
+
children: [/* @__PURE__ */jsx(MetricIconWrapper, {
|
|
384
|
+
icon: metric.icon
|
|
385
|
+
}), /* @__PURE__ */jsxs(Flex, {
|
|
386
|
+
sx: {
|
|
387
|
+
flex: 1,
|
|
388
|
+
flexDirection: "column",
|
|
389
|
+
gap: "2"
|
|
390
|
+
},
|
|
391
|
+
children: [/* @__PURE__ */jsx(MetricCardHeader, {
|
|
392
|
+
label: metric.label,
|
|
393
|
+
tooltip: metric.tooltip,
|
|
394
|
+
isClickable
|
|
395
|
+
}), metric.type === "date" && /* @__PURE__ */jsx(DateMetricContent, {
|
|
396
|
+
metric
|
|
397
|
+
}), metric.type === "percentage" && /* @__PURE__ */jsx(PercentageMetricContent, {
|
|
398
|
+
metric
|
|
399
|
+
}), metric.type === "number" && /* @__PURE__ */jsx(NumberMetricContent, {
|
|
400
|
+
metric
|
|
401
|
+
})]
|
|
402
|
+
})]
|
|
403
|
+
})
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
//#endregion
|
|
408
|
+
export { MetricCard };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import ReactModal from "react-modal";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Modal/Modal.d.ts
|
|
5
|
+
type ModalProps = ReactModal.Props;
|
|
6
|
+
declare const Modal: {
|
|
7
|
+
(props: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
setAppElement: typeof ReactModal.setAppElement;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Modal, ModalProps };
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { __name } from "../chunk-V4MHYKRI.js";
|
|
4
|
-
|
|
5
|
-
// src/components/Modal/Modal.tsx
|
|
6
|
-
import { css as transformStyleObject } from "@theme-ui/css";
|
|
7
2
|
import { useResponsiveValue, useTheme } from "@ttoss/ui";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { css } from "@theme-ui/css";
|
|
8
5
|
import ReactModal from "react-modal";
|
|
6
|
+
|
|
7
|
+
//#region src/components/Modal/Modal.tsx
|
|
9
8
|
ReactModal.defaultStyles = {
|
|
10
9
|
overlay: {},
|
|
11
10
|
content: {}
|
|
12
11
|
};
|
|
13
|
-
|
|
12
|
+
const Modal = props => {
|
|
14
13
|
const {
|
|
15
14
|
theme
|
|
16
15
|
} = useTheme();
|
|
17
16
|
const space = theme.space;
|
|
18
17
|
const padding = useResponsiveValue([space?.["4"], space?.["5"], space?.["5"]]) || 0;
|
|
19
18
|
const style = {
|
|
20
|
-
overlay:
|
|
19
|
+
overlay: css({
|
|
21
20
|
position: "fixed",
|
|
22
21
|
top: 0,
|
|
23
22
|
left: 0,
|
|
@@ -28,10 +27,9 @@ var Modal = /* @__PURE__ */__name(props => {
|
|
|
28
27
|
justifyContent: "center",
|
|
29
28
|
alignItems: "center",
|
|
30
29
|
zIndex: "modal",
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
30
|
...props.style?.overlay
|
|
33
31
|
})(theme),
|
|
34
|
-
content:
|
|
32
|
+
content: css({
|
|
35
33
|
/**
|
|
36
34
|
* Theme
|
|
37
35
|
*/
|
|
@@ -52,14 +50,15 @@ var Modal = /* @__PURE__ */__name(props => {
|
|
|
52
50
|
bottom: "0px",
|
|
53
51
|
maxHeight: "90%",
|
|
54
52
|
maxWidth: "90%",
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
53
|
...props.style?.content
|
|
57
54
|
})(theme)
|
|
58
55
|
};
|
|
59
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */jsx(ReactModal, {
|
|
60
57
|
...props,
|
|
61
58
|
style
|
|
62
59
|
});
|
|
63
|
-
}
|
|
60
|
+
};
|
|
64
61
|
Modal.setAppElement = ReactModal.setAppElement;
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
65
64
|
export { Modal };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/NavList/NavList.d.ts
|
|
5
|
+
type NavListItem = {
|
|
6
|
+
id?: string;
|
|
7
|
+
label: string;
|
|
8
|
+
href: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
active?: boolean;
|
|
12
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
13
|
+
group?: string;
|
|
14
|
+
divider?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type NavListGroup = {
|
|
17
|
+
id?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
items: NavListItem[];
|
|
20
|
+
divider?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type LinkComponentProps = {
|
|
23
|
+
href: string;
|
|
24
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
type NavListProps = {
|
|
29
|
+
items?: NavListItem[];
|
|
30
|
+
groups?: NavListGroup[];
|
|
31
|
+
variant?: 'sidebar' | 'menu' | 'dropdown';
|
|
32
|
+
onItemClick?: (item: NavListItem) => void;
|
|
33
|
+
sx?: Record<string, unknown>;
|
|
34
|
+
iconSize?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Custom Link component to use for rendering links.
|
|
37
|
+
* Useful for integrating with Next.js Link, React Router Link, etc.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Next.js
|
|
41
|
+
* import NextLink from 'next/link';
|
|
42
|
+
* <NavList LinkComponent={NextLink} ... />
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // React Router
|
|
46
|
+
* import { Link as RouterLink } from 'react-router-dom';
|
|
47
|
+
* <NavList LinkComponent={RouterLink} ... />
|
|
48
|
+
*/
|
|
49
|
+
LinkComponent?: React.ComponentType<LinkComponentProps>;
|
|
50
|
+
};
|
|
51
|
+
declare const NavList: {
|
|
52
|
+
({
|
|
53
|
+
items,
|
|
54
|
+
groups,
|
|
55
|
+
variant,
|
|
56
|
+
onItemClick,
|
|
57
|
+
sx,
|
|
58
|
+
iconSize,
|
|
59
|
+
LinkComponent
|
|
60
|
+
}: NavListProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { type LinkComponentProps, NavList, type NavListGroup, type NavListItem, type NavListProps };
|