@ttoss/components 2.14.30 → 2.15.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 +15 -5
- package/dist/index.d.mts +22 -3
- package/dist/index.mjs +266 -161
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -209,14 +209,24 @@ import { Markdown } from '@ttoss/components';
|
|
|
209
209
|
|
|
210
210
|
### Menu
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
Floating dropdown panel with a configurable trigger icon. Use `NavList` as children for navigation items. [Docs](https://storybook.ttoss.dev/?path=/docs/components-menu--docs)
|
|
213
213
|
|
|
214
214
|
```tsx
|
|
215
|
-
import { Menu } from '@ttoss/components';
|
|
215
|
+
import { Menu, NavList } from '@ttoss/components';
|
|
216
|
+
|
|
217
|
+
<Menu>
|
|
218
|
+
<NavList
|
|
219
|
+
variant="menu"
|
|
220
|
+
items={[
|
|
221
|
+
{ href: '/dashboard', label: 'Dashboard', icon: 'mdi:home-outline' },
|
|
222
|
+
{ href: '/settings', label: 'Settings', icon: 'mdi:cog-outline' },
|
|
223
|
+
]}
|
|
224
|
+
/>
|
|
225
|
+
</Menu>;
|
|
216
226
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<
|
|
227
|
+
// Custom trigger icon
|
|
228
|
+
<Menu menuIcon="mdi:dots-vertical">
|
|
229
|
+
<NavList variant="menu" items={items} />
|
|
220
230
|
</Menu>;
|
|
221
231
|
```
|
|
222
232
|
|
package/dist/index.d.mts
CHANGED
|
@@ -791,11 +791,30 @@ declare const NavList: {
|
|
|
791
791
|
displayName: string;
|
|
792
792
|
};
|
|
793
793
|
//#endregion
|
|
794
|
+
//#region src/components/NotificationCard/NotificationButton.d.ts
|
|
795
|
+
type NotificationType$1 = 'success' | 'error' | 'warning' | 'info' | 'neutral';
|
|
796
|
+
/** Props for NotificationButton */
|
|
797
|
+
type NotificationButtonProps = Omit<ButtonProps, 'type'> & {
|
|
798
|
+
/** Notification type — controls background and border colors to match the card. */type: NotificationType$1;
|
|
799
|
+
};
|
|
800
|
+
/**
|
|
801
|
+
* A button styled to match the NotificationCard of a given type.
|
|
802
|
+
* Use this for action buttons rendered inside or alongside notification cards.
|
|
803
|
+
*/
|
|
804
|
+
declare const NotificationButton: ({
|
|
805
|
+
type,
|
|
806
|
+
...props
|
|
807
|
+
}: NotificationButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
808
|
+
//#endregion
|
|
794
809
|
//#region src/components/NotificationCard/NotificationCard.d.ts
|
|
795
810
|
type NotificationType = 'success' | 'error' | 'warning' | 'info' | 'neutral';
|
|
796
811
|
type NotificationAction = {
|
|
797
|
-
action
|
|
798
|
-
url
|
|
812
|
+
action: 'open_url';
|
|
813
|
+
url: string;
|
|
814
|
+
label?: string;
|
|
815
|
+
} | {
|
|
816
|
+
action: 'callback';
|
|
817
|
+
onClick: () => void;
|
|
799
818
|
label?: string;
|
|
800
819
|
};
|
|
801
820
|
type NotificationCardProps = {
|
|
@@ -907,4 +926,4 @@ declare const Tabs: {
|
|
|
907
926
|
declare const ToastContainer: (props: ToastContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
908
927
|
declare const toast: typeof toast$1;
|
|
909
928
|
//#endregion
|
|
910
|
-
export { Accordion, AccordionItem, AccordionProps, AccordionRenderItemProps, BaseMetric, DateMetric, DatePicker, DateRange, Drawer, DrawerProps, EnhancedTitle, EnhancedTitleBadge, EnhancedTitleProps, EnhancedTitleVariant, FileUploadState, FileUploader, FileUploaderProps, InstallPwa, InstallPwaUi, InstallPwaUiProps, JsonEditor, JsonView, type LinkComponentProps, List, ListItem, ListItemProps, ListProps, LockedOverlay, Markdown, MarkdownProps, Menu, MenuProps, Metric, MetricCard, MetricCardProps, Modal, ModalProps, NavList, type NavListGroup, type NavListItem, type NavListProps, Notification, NotificationAction, NotificationCard, NotificationCardProps, NotificationsMenu, NumberMetric, OnFilesChange, OnRemove, OnUpload, OnUploadComplete, OnUploadError, OnUploadProgress, OnUploadStart, PercentageMetric, Search, SearchProps, SpotlightCard, SpotlightCardProps, type TabListProps, type TabPanelProps, type TabProps, Table, Tabs, type TabsProps, ToastContainer, type ToastContainerProps, type ToastOptions, UploadResult, UploadedFile, createCell, createColumnHelper, flexRender, getCoreRowModel, toast, useReactTable };
|
|
929
|
+
export { Accordion, AccordionItem, AccordionProps, AccordionRenderItemProps, BaseMetric, DateMetric, DatePicker, DateRange, Drawer, DrawerProps, EnhancedTitle, EnhancedTitleBadge, EnhancedTitleProps, EnhancedTitleVariant, FileUploadState, FileUploader, FileUploaderProps, InstallPwa, InstallPwaUi, InstallPwaUiProps, JsonEditor, JsonView, type LinkComponentProps, List, ListItem, ListItemProps, ListProps, LockedOverlay, Markdown, MarkdownProps, Menu, MenuProps, Metric, MetricCard, MetricCardProps, Modal, ModalProps, NavList, type NavListGroup, type NavListItem, type NavListProps, Notification, NotificationAction, NotificationButton, NotificationButtonProps, NotificationCard, NotificationCardProps, NotificationsMenu, NumberMetric, OnFilesChange, OnRemove, OnUpload, OnUploadComplete, OnUploadError, OnUploadProgress, OnUploadStart, PercentageMetric, Search, SearchProps, SpotlightCard, SpotlightCardProps, type TabListProps, type TabPanelProps, type TabProps, Table, Tabs, type TabsProps, ToastContainer, type ToastContainerProps, type ToastOptions, UploadResult, UploadedFile, createCell, createColumnHelper, flexRender, getCoreRowModel, toast, useReactTable };
|
package/dist/index.mjs
CHANGED
|
@@ -1764,7 +1764,6 @@ var Menu = ({
|
|
|
1764
1764
|
...stylePos
|
|
1765
1765
|
},
|
|
1766
1766
|
children: /* @__PURE__ */jsx(Box, {
|
|
1767
|
-
as: "nav",
|
|
1768
1767
|
children
|
|
1769
1768
|
})
|
|
1770
1769
|
}) : null;
|
|
@@ -2269,13 +2268,15 @@ var getVariantStyles = variant => {
|
|
|
2269
2268
|
width: "full"
|
|
2270
2269
|
},
|
|
2271
2270
|
item: {
|
|
2272
|
-
backgroundColor: "
|
|
2271
|
+
backgroundColor: "navigation.background.muted.default",
|
|
2272
|
+
color: "navigation.text.primary.default",
|
|
2273
2273
|
padding: "3",
|
|
2274
2274
|
borderRadius: "none",
|
|
2275
2275
|
fontSize: "md",
|
|
2276
|
-
transition: "background-color 0.15s ease",
|
|
2276
|
+
transition: "background-color 0.15s ease, color 0.15s ease",
|
|
2277
2277
|
"&:hover": {
|
|
2278
2278
|
backgroundColor: "navigation.background.muted.hover",
|
|
2279
|
+
color: "navigation.text.primary.hover",
|
|
2279
2280
|
textDecoration: "none"
|
|
2280
2281
|
}
|
|
2281
2282
|
},
|
|
@@ -2305,13 +2306,15 @@ var getVariantStyles = variant => {
|
|
|
2305
2306
|
width: "full"
|
|
2306
2307
|
},
|
|
2307
2308
|
item: {
|
|
2308
|
-
backgroundColor: "
|
|
2309
|
+
backgroundColor: "navigation.background.muted.default",
|
|
2310
|
+
color: "navigation.text.primary.default",
|
|
2309
2311
|
borderRadius: "md",
|
|
2310
2312
|
padding: "2",
|
|
2311
2313
|
fontSize: "md",
|
|
2312
2314
|
transition: "all 0.2s ease",
|
|
2313
2315
|
"&:hover": {
|
|
2314
2316
|
backgroundColor: "navigation.background.muted.hover",
|
|
2317
|
+
color: "navigation.text.primary.hover",
|
|
2315
2318
|
transform: "translateX(4px)",
|
|
2316
2319
|
textDecoration: "none"
|
|
2317
2320
|
}
|
|
@@ -2339,14 +2342,16 @@ var getVariantStyles = variant => {
|
|
|
2339
2342
|
width: "full"
|
|
2340
2343
|
},
|
|
2341
2344
|
item: {
|
|
2342
|
-
backgroundColor: "
|
|
2345
|
+
backgroundColor: "navigation.background.muted.default",
|
|
2346
|
+
color: "navigation.text.primary.default",
|
|
2343
2347
|
padding: "2",
|
|
2344
2348
|
fontSize: "sm",
|
|
2345
2349
|
borderBottom: "sm",
|
|
2346
2350
|
borderColor: "display.border.muted.default",
|
|
2347
|
-
transition: "background-color 0.1s ease",
|
|
2351
|
+
transition: "background-color 0.1s ease, color 0.1s ease",
|
|
2348
2352
|
"&:hover": {
|
|
2349
2353
|
backgroundColor: "navigation.background.muted.hover",
|
|
2354
|
+
color: "navigation.text.primary.hover",
|
|
2350
2355
|
textDecoration: "none"
|
|
2351
2356
|
}
|
|
2352
2357
|
},
|
|
@@ -2370,6 +2375,17 @@ var getVariantStyles = variant => {
|
|
|
2370
2375
|
return getVariantStyles("menu");
|
|
2371
2376
|
}
|
|
2372
2377
|
};
|
|
2378
|
+
var resolveItemStyles = (item, variantStyles) => {
|
|
2379
|
+
return {
|
|
2380
|
+
...variantStyles.item,
|
|
2381
|
+
...(item.active ? variantStyles.activeItem : {}),
|
|
2382
|
+
...(item.disabled ? {
|
|
2383
|
+
opacity: .5,
|
|
2384
|
+
cursor: "not-allowed",
|
|
2385
|
+
pointerEvents: "none"
|
|
2386
|
+
} : {})
|
|
2387
|
+
};
|
|
2388
|
+
};
|
|
2373
2389
|
var NavListItemComponent = ({
|
|
2374
2390
|
item,
|
|
2375
2391
|
onItemClick,
|
|
@@ -2386,21 +2402,13 @@ var NavListItemComponent = ({
|
|
|
2386
2402
|
item.onClick?.(event);
|
|
2387
2403
|
onItemClick?.(item);
|
|
2388
2404
|
};
|
|
2389
|
-
const itemStyles =
|
|
2390
|
-
|
|
2391
|
-
...(item.active ? variantStyles.activeItem : {}),
|
|
2392
|
-
...(item.disabled ? {
|
|
2393
|
-
opacity: .5,
|
|
2394
|
-
cursor: "not-allowed",
|
|
2395
|
-
pointerEvents: "none"
|
|
2396
|
-
} : {})
|
|
2397
|
-
};
|
|
2405
|
+
const itemStyles = resolveItemStyles(item, variantStyles);
|
|
2406
|
+
const ariaCurrent = item.active ? "page" : void 0;
|
|
2398
2407
|
const isDefaultLink = LinkComponent === Link;
|
|
2399
2408
|
const linkContent = /* @__PURE__ */jsxs(Flex, {
|
|
2400
2409
|
sx: {
|
|
2401
2410
|
alignItems: "center",
|
|
2402
|
-
gap: "2"
|
|
2403
|
-
color: "navigation.text.primary.default"
|
|
2411
|
+
gap: "2"
|
|
2404
2412
|
},
|
|
2405
2413
|
children: [item.icon && /* @__PURE__ */jsx(Icon, {
|
|
2406
2414
|
icon: item.icon,
|
|
@@ -2416,7 +2424,7 @@ var NavListItemComponent = ({
|
|
|
2416
2424
|
onClick: handleClick,
|
|
2417
2425
|
sx: itemStyles,
|
|
2418
2426
|
"aria-disabled": item.disabled,
|
|
2419
|
-
"aria-current":
|
|
2427
|
+
"aria-current": ariaCurrent,
|
|
2420
2428
|
quiet: true,
|
|
2421
2429
|
children: linkContent
|
|
2422
2430
|
}) : /* @__PURE__ */jsx(Link, {
|
|
@@ -2425,7 +2433,7 @@ var NavListItemComponent = ({
|
|
|
2425
2433
|
onClick: handleClick,
|
|
2426
2434
|
sx: itemStyles,
|
|
2427
2435
|
"aria-disabled": item.disabled,
|
|
2428
|
-
"aria-current":
|
|
2436
|
+
"aria-current": ariaCurrent,
|
|
2429
2437
|
quiet: true,
|
|
2430
2438
|
children: linkContent
|
|
2431
2439
|
}), showDivider && /* @__PURE__ */jsx(Divider, {
|
|
@@ -2502,168 +2510,265 @@ var NavList = ({
|
|
|
2502
2510
|
};
|
|
2503
2511
|
NavList.displayName = "NavList";
|
|
2504
2512
|
|
|
2513
|
+
//#endregion
|
|
2514
|
+
//#region src/components/NotificationCard/NotificationButton.tsx
|
|
2515
|
+
var sxMap$1 = {
|
|
2516
|
+
success: {
|
|
2517
|
+
backgroundColor: "feedback.background.positive.active",
|
|
2518
|
+
borderColor: "feedback.border.positive.active"
|
|
2519
|
+
},
|
|
2520
|
+
error: {
|
|
2521
|
+
backgroundColor: "feedback.background.negative.active",
|
|
2522
|
+
borderColor: "feedback.border.negative.active"
|
|
2523
|
+
},
|
|
2524
|
+
warning: {
|
|
2525
|
+
backgroundColor: "feedback.background.caution.active",
|
|
2526
|
+
borderColor: "feedback.border.caution.active"
|
|
2527
|
+
},
|
|
2528
|
+
info: {
|
|
2529
|
+
backgroundColor: "feedback.background.primary.active",
|
|
2530
|
+
borderColor: "feedback.border.primary.active"
|
|
2531
|
+
},
|
|
2532
|
+
neutral: {
|
|
2533
|
+
backgroundColor: "feedback.background.primary.active",
|
|
2534
|
+
borderColor: "feedback.border.primary.active"
|
|
2535
|
+
}
|
|
2536
|
+
};
|
|
2537
|
+
/**
|
|
2538
|
+
* A button styled to match the NotificationCard of a given type.
|
|
2539
|
+
* Use this for action buttons rendered inside or alongside notification cards.
|
|
2540
|
+
*/
|
|
2541
|
+
var NotificationButton = ({
|
|
2542
|
+
type,
|
|
2543
|
+
...props
|
|
2544
|
+
}) => {
|
|
2545
|
+
return /* @__PURE__ */jsx(Button, {
|
|
2546
|
+
type: "button",
|
|
2547
|
+
...props,
|
|
2548
|
+
sx: {
|
|
2549
|
+
...sxMap$1[type],
|
|
2550
|
+
color: "display.text.primary.default",
|
|
2551
|
+
borderRadius: "lg",
|
|
2552
|
+
borderWidth: "sm",
|
|
2553
|
+
borderStyle: "solid"
|
|
2554
|
+
}
|
|
2555
|
+
});
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2505
2558
|
//#endregion
|
|
2506
2559
|
//#region src/components/NotificationCard/NotificationCard.tsx
|
|
2507
|
-
var
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
borderColor: "feedback.border.positive.default"
|
|
2513
|
-
}
|
|
2514
|
-
},
|
|
2515
|
-
error: {
|
|
2516
|
-
card: {
|
|
2517
|
-
backgroundColor: "feedback.background.negative.default",
|
|
2518
|
-
borderColor: "feedback.border.negative.default"
|
|
2519
|
-
}
|
|
2520
|
-
},
|
|
2521
|
-
warning: {
|
|
2522
|
-
card: {
|
|
2523
|
-
backgroundColor: "feedback.background.caution.default",
|
|
2524
|
-
borderColor: "feedback.border.caution.default"
|
|
2525
|
-
}
|
|
2526
|
-
},
|
|
2527
|
-
info: {
|
|
2528
|
-
card: {
|
|
2529
|
-
backgroundColor: "feedback.background.primary.default",
|
|
2530
|
-
borderColor: "feedback.border.primary.default"
|
|
2531
|
-
}
|
|
2532
|
-
},
|
|
2533
|
-
neutral: {
|
|
2534
|
-
card: {
|
|
2535
|
-
backgroundColor: "feedback.background.primary.default",
|
|
2536
|
-
borderColor: "feedback.border.primary.default"
|
|
2537
|
-
}
|
|
2560
|
+
var sxMap = {
|
|
2561
|
+
success: {
|
|
2562
|
+
card: {
|
|
2563
|
+
backgroundColor: "feedback.background.positive.default",
|
|
2564
|
+
borderColor: "feedback.border.positive.default"
|
|
2538
2565
|
}
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2566
|
+
},
|
|
2567
|
+
error: {
|
|
2568
|
+
card: {
|
|
2569
|
+
backgroundColor: "feedback.background.negative.default",
|
|
2570
|
+
borderColor: "feedback.border.negative.default"
|
|
2571
|
+
}
|
|
2572
|
+
},
|
|
2573
|
+
warning: {
|
|
2574
|
+
card: {
|
|
2575
|
+
backgroundColor: "feedback.background.caution.default",
|
|
2576
|
+
borderColor: "feedback.border.caution.default"
|
|
2577
|
+
}
|
|
2578
|
+
},
|
|
2579
|
+
info: {
|
|
2580
|
+
card: {
|
|
2581
|
+
backgroundColor: "feedback.background.primary.default",
|
|
2582
|
+
borderColor: "feedback.border.primary.default"
|
|
2583
|
+
}
|
|
2584
|
+
},
|
|
2585
|
+
neutral: {
|
|
2586
|
+
card: {
|
|
2587
|
+
backgroundColor: "feedback.background.primary.default",
|
|
2588
|
+
borderColor: "feedback.border.primary.default"
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
};
|
|
2592
|
+
var iconMap = {
|
|
2593
|
+
success: "success-circle",
|
|
2594
|
+
error: "error",
|
|
2595
|
+
warning: "warning-alt",
|
|
2596
|
+
info: "info",
|
|
2597
|
+
neutral: "info"
|
|
2598
|
+
};
|
|
2599
|
+
var NotificationCardTags = ({
|
|
2600
|
+
tags
|
|
2601
|
+
}) => {
|
|
2602
|
+
if (!tags) return null;
|
|
2603
|
+
if (Array.isArray(tags)) {
|
|
2604
|
+
if (tags.length === 0) return null;
|
|
2605
|
+
return /* @__PURE__ */jsx(Fragment, {
|
|
2606
|
+
children: tags.map((tag, index) => {
|
|
2607
|
+
return /* @__PURE__ */jsx(Tag, {
|
|
2608
|
+
children: tag
|
|
2609
|
+
}, index);
|
|
2610
|
+
})
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
return /* @__PURE__ */jsx(Tag, {
|
|
2614
|
+
children: tags
|
|
2615
|
+
});
|
|
2616
|
+
};
|
|
2617
|
+
var NotificationCardTitle = ({
|
|
2618
|
+
type,
|
|
2619
|
+
title,
|
|
2620
|
+
tags,
|
|
2621
|
+
onClose
|
|
2622
|
+
}) => {
|
|
2623
|
+
return /* @__PURE__ */jsxs(Card.Title, {
|
|
2554
2624
|
sx: {
|
|
2555
|
-
|
|
2556
|
-
|
|
2625
|
+
display: "flex",
|
|
2626
|
+
justifyContent: "space-between",
|
|
2627
|
+
alignItems: "center",
|
|
2628
|
+
fontSize: ["md", "xl"],
|
|
2629
|
+
paddingY: ["1", "2", "4"],
|
|
2630
|
+
paddingX: ["2", "4", "8"]
|
|
2557
2631
|
},
|
|
2558
|
-
children: [
|
|
2632
|
+
children: [/* @__PURE__ */jsxs(Text, {
|
|
2559
2633
|
sx: {
|
|
2560
|
-
display: "flex",
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
paddingX: ["2", "4", "8"]
|
|
2634
|
+
display: "inline-flex",
|
|
2635
|
+
alignItems: "flex-start",
|
|
2636
|
+
gap: "2",
|
|
2637
|
+
flexDirection: "row",
|
|
2638
|
+
flexWrap: "wrap"
|
|
2566
2639
|
},
|
|
2567
|
-
children: [/* @__PURE__ */jsxs(
|
|
2568
|
-
sx: {
|
|
2569
|
-
display: "inline-flex",
|
|
2570
|
-
alignItems: "flex-start",
|
|
2571
|
-
gap: "2",
|
|
2572
|
-
flexDirection: "row",
|
|
2573
|
-
flexWrap: "wrap"
|
|
2574
|
-
},
|
|
2575
|
-
children: [/* @__PURE__ */jsxs(Box, {
|
|
2576
|
-
sx: {
|
|
2577
|
-
display: "flex",
|
|
2578
|
-
alignItems: "center",
|
|
2579
|
-
gap: "2"
|
|
2580
|
-
},
|
|
2581
|
-
children: [/* @__PURE__ */jsx(Icon, {
|
|
2582
|
-
icon: icon[props.type]
|
|
2583
|
-
}), props.title]
|
|
2584
|
-
}), props.tags && (Array.isArray(props.tags) ? props.tags.length > 0 : true) && (Array.isArray(props.tags) ? props.tags.map((tag, index) => {
|
|
2585
|
-
return /* @__PURE__ */jsx(Tag, {
|
|
2586
|
-
children: tag
|
|
2587
|
-
}, index);
|
|
2588
|
-
}) : /* @__PURE__ */jsx(Tag, {
|
|
2589
|
-
children: props.tags
|
|
2590
|
-
}))]
|
|
2591
|
-
}), props.onClose && /* @__PURE__ */jsx(Box, {
|
|
2640
|
+
children: [/* @__PURE__ */jsxs(Box, {
|
|
2592
2641
|
sx: {
|
|
2593
|
-
|
|
2642
|
+
display: "flex",
|
|
2643
|
+
alignItems: "center",
|
|
2644
|
+
gap: "2"
|
|
2594
2645
|
},
|
|
2595
|
-
children: /* @__PURE__ */jsx(
|
|
2596
|
-
|
|
2597
|
-
})
|
|
2646
|
+
children: [/* @__PURE__ */jsx(Icon, {
|
|
2647
|
+
icon: iconMap[type]
|
|
2648
|
+
}), title]
|
|
2649
|
+
}), /* @__PURE__ */jsx(NotificationCardTags, {
|
|
2650
|
+
tags
|
|
2598
2651
|
})]
|
|
2599
|
-
}), /* @__PURE__ */
|
|
2652
|
+
}), onClose && /* @__PURE__ */jsx(Box, {
|
|
2653
|
+
sx: {
|
|
2654
|
+
marginLeft: "auto"
|
|
2655
|
+
},
|
|
2656
|
+
children: /* @__PURE__ */jsx(CloseButton, {
|
|
2657
|
+
onClick: onClose
|
|
2658
|
+
})
|
|
2659
|
+
})]
|
|
2660
|
+
});
|
|
2661
|
+
};
|
|
2662
|
+
var NotificationCardActions = ({
|
|
2663
|
+
type,
|
|
2664
|
+
actions
|
|
2665
|
+
}) => {
|
|
2666
|
+
if (actions.length === 0) return null;
|
|
2667
|
+
return /* @__PURE__ */jsx(Box, {
|
|
2668
|
+
sx: {
|
|
2669
|
+
display: "flex",
|
|
2670
|
+
flexDirection: "row",
|
|
2671
|
+
flexWrap: "wrap",
|
|
2672
|
+
gap: 2,
|
|
2673
|
+
mt: 2
|
|
2674
|
+
},
|
|
2675
|
+
children: actions.map((action, index) => {
|
|
2676
|
+
return /* @__PURE__ */jsx(NotificationButton, {
|
|
2677
|
+
type,
|
|
2678
|
+
onClick: action.action === "open_url" ? () => {
|
|
2679
|
+
return window.open(action.url, "_blank");
|
|
2680
|
+
} : action.onClick,
|
|
2681
|
+
children: action.label || "Acessar"
|
|
2682
|
+
}, index);
|
|
2683
|
+
})
|
|
2684
|
+
});
|
|
2685
|
+
};
|
|
2686
|
+
var NotificationCardBody = ({
|
|
2687
|
+
type,
|
|
2688
|
+
message,
|
|
2689
|
+
actions,
|
|
2690
|
+
caption,
|
|
2691
|
+
onClose,
|
|
2692
|
+
hasTitle
|
|
2693
|
+
}) => {
|
|
2694
|
+
const hasCaption = Boolean(caption);
|
|
2695
|
+
const hasActions = Boolean(actions?.length);
|
|
2696
|
+
const shouldCenter = !hasCaption && !hasActions;
|
|
2697
|
+
const bodyAlign = shouldCenter ? "center" : "flex-start";
|
|
2698
|
+
const bodyMinHeight = shouldCenter && !hasTitle ? "40px" : "auto";
|
|
2699
|
+
return /* @__PURE__ */jsxs(Card.Body, {
|
|
2700
|
+
sx: {
|
|
2701
|
+
...sxMap[type].card,
|
|
2702
|
+
display: "flex",
|
|
2703
|
+
flexDirection: "column",
|
|
2704
|
+
gap: "2",
|
|
2705
|
+
paddingY: ["1", "2", "4"],
|
|
2706
|
+
paddingX: ["2", "4", "8"]
|
|
2707
|
+
},
|
|
2708
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
2600
2709
|
sx: {
|
|
2601
|
-
...sxMap[props.type].card,
|
|
2602
2710
|
display: "flex",
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2711
|
+
justifyContent: "space-between",
|
|
2712
|
+
minHeight: bodyMinHeight,
|
|
2713
|
+
alignItems: bodyAlign,
|
|
2714
|
+
width: "100%",
|
|
2715
|
+
gap: "4"
|
|
2607
2716
|
},
|
|
2608
|
-
children:
|
|
2609
|
-
sx: {
|
|
2610
|
-
display: "flex",
|
|
2611
|
-
justifyContent: "space-between",
|
|
2612
|
-
minHeight: shouldAddMinHeight ? "40px" : "auto",
|
|
2613
|
-
alignItems: shouldCenterVerticallyWithoutTitle ? "center" : shouldCenterVerticallyWithTitle ? "center" : "flex-start",
|
|
2614
|
-
width: "100%",
|
|
2615
|
-
gap: "4"
|
|
2616
|
-
},
|
|
2617
|
-
children: /* @__PURE__ */jsx(Box, {
|
|
2618
|
-
sx: {
|
|
2619
|
-
flex: 1
|
|
2620
|
-
},
|
|
2621
|
-
children: /* @__PURE__ */jsx(Text, {
|
|
2622
|
-
sx: {
|
|
2623
|
-
fontSize: ["sm", "md"]
|
|
2624
|
-
},
|
|
2625
|
-
children: props.message
|
|
2626
|
-
})
|
|
2627
|
-
})
|
|
2628
|
-
}), props.actions && props.actions.length > 0 && /* @__PURE__ */jsx(Box, {
|
|
2629
|
-
sx: {
|
|
2630
|
-
display: "flex",
|
|
2631
|
-
flexDirection: "column",
|
|
2632
|
-
gap: 2,
|
|
2633
|
-
mt: 2
|
|
2634
|
-
},
|
|
2635
|
-
children: props.actions.map((action, index) => {
|
|
2636
|
-
return action.action === "open_url" ? /* @__PURE__ */jsx(Link, {
|
|
2637
|
-
href: action.url,
|
|
2638
|
-
target: "_blank",
|
|
2639
|
-
rel: "noopener noreferrer",
|
|
2640
|
-
sx: {
|
|
2641
|
-
color: "action.text.accent.default",
|
|
2642
|
-
cursor: "pointer"
|
|
2643
|
-
},
|
|
2644
|
-
children: action.label || "Acessar"
|
|
2645
|
-
}, index) : null;
|
|
2646
|
-
})
|
|
2647
|
-
}), props.caption && /* @__PURE__ */jsx(Box, {
|
|
2717
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
2648
2718
|
sx: {
|
|
2649
|
-
|
|
2650
|
-
mt: 6
|
|
2719
|
+
flex: 1
|
|
2651
2720
|
},
|
|
2652
2721
|
children: /* @__PURE__ */jsx(Text, {
|
|
2653
2722
|
sx: {
|
|
2654
|
-
fontSize: "
|
|
2655
|
-
color: "text.secondary"
|
|
2723
|
+
fontSize: ["sm", "md"]
|
|
2656
2724
|
},
|
|
2657
|
-
children:
|
|
2725
|
+
children: message
|
|
2658
2726
|
})
|
|
2659
|
-
})
|
|
2727
|
+
})
|
|
2728
|
+
}), actions && /* @__PURE__ */jsx(NotificationCardActions, {
|
|
2729
|
+
type,
|
|
2730
|
+
actions
|
|
2731
|
+
}), caption && /* @__PURE__ */jsx(Box, {
|
|
2732
|
+
sx: {
|
|
2733
|
+
whiteSpace: "nowrap",
|
|
2734
|
+
mt: 6
|
|
2735
|
+
},
|
|
2736
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
2660
2737
|
sx: {
|
|
2661
|
-
|
|
2738
|
+
fontSize: "xs",
|
|
2739
|
+
color: "text.secondary"
|
|
2662
2740
|
},
|
|
2663
|
-
children:
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2741
|
+
children: caption
|
|
2742
|
+
})
|
|
2743
|
+
}), !hasTitle && onClose && /* @__PURE__ */jsx(Box, {
|
|
2744
|
+
sx: {
|
|
2745
|
+
alignSelf: "flex-end"
|
|
2746
|
+
},
|
|
2747
|
+
children: /* @__PURE__ */jsx(CloseButton, {
|
|
2748
|
+
onClick: onClose
|
|
2749
|
+
})
|
|
2750
|
+
})]
|
|
2751
|
+
});
|
|
2752
|
+
};
|
|
2753
|
+
var NotificationCard = props => {
|
|
2754
|
+
const hasTitle = Boolean(props.title);
|
|
2755
|
+
return /* @__PURE__ */jsxs(Card, {
|
|
2756
|
+
sx: {
|
|
2757
|
+
...sxMap[props.type].card,
|
|
2758
|
+
width: "full"
|
|
2759
|
+
},
|
|
2760
|
+
children: [props.title && /* @__PURE__ */jsx(NotificationCardTitle, {
|
|
2761
|
+
type: props.type,
|
|
2762
|
+
title: props.title,
|
|
2763
|
+
tags: props.tags,
|
|
2764
|
+
onClose: props.onClose
|
|
2765
|
+
}), /* @__PURE__ */jsx(NotificationCardBody, {
|
|
2766
|
+
type: props.type,
|
|
2767
|
+
message: props.message,
|
|
2768
|
+
actions: props.actions,
|
|
2769
|
+
caption: props.caption,
|
|
2770
|
+
onClose: props.onClose,
|
|
2771
|
+
hasTitle
|
|
2667
2772
|
})]
|
|
2668
2773
|
});
|
|
2669
2774
|
};
|
|
@@ -3073,4 +3178,4 @@ var ToastContainer = props => {
|
|
|
3073
3178
|
var toast = toast$1;
|
|
3074
3179
|
|
|
3075
3180
|
//#endregion
|
|
3076
|
-
export { Accordion, DatePicker, Drawer, EnhancedTitle, FileUploader, InstallPwa, InstallPwaUi, JsonEditor, JsonView, List, ListItem, LockedOverlay, Markdown, Menu, MetricCard, Modal, NavList, NotificationCard, NotificationsMenu, Search, SpotlightCard, Table, Tabs, ToastContainer, createCell, createColumnHelper, flexRender, getCoreRowModel, toast, useReactTable };
|
|
3181
|
+
export { Accordion, DatePicker, Drawer, EnhancedTitle, FileUploader, InstallPwa, InstallPwaUi, JsonEditor, JsonView, List, ListItem, LockedOverlay, Markdown, Menu, MetricCard, Modal, NavList, NotificationButton, NotificationCard, NotificationsMenu, Search, SpotlightCard, Table, Tabs, ToastContainer, createCell, createColumnHelper, flexRender, getCoreRowModel, toast, useReactTable };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"React",
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
"tsdown": "^0.22.2",
|
|
55
55
|
"tsx": "^4.21.0",
|
|
56
56
|
"@ttoss/config": "^1.37.17",
|
|
57
|
+
"@ttoss/i18n-cli": "^0.8.17",
|
|
57
58
|
"@ttoss/react-hooks": "^2.3.20",
|
|
59
|
+
"@ttoss/react-i18n": "^2.3.0",
|
|
58
60
|
"@ttoss/react-icons": "^0.7.21",
|
|
59
|
-
"@ttoss/
|
|
60
|
-
"@ttoss/
|
|
61
|
-
"@ttoss/test-utils": "^4.2.18",
|
|
62
|
-
"@ttoss/ui": "^6.9.27"
|
|
61
|
+
"@ttoss/ui": "^6.9.28",
|
|
62
|
+
"@ttoss/test-utils": "^4.2.18"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": ">=16.8.0",
|
|
66
66
|
"@ttoss/react-hooks": "^2.3.20",
|
|
67
|
-
"@ttoss/react-i18n": "^2.
|
|
67
|
+
"@ttoss/react-i18n": "^2.3.0",
|
|
68
68
|
"@ttoss/react-icons": "^0.7.21",
|
|
69
|
-
"@ttoss/ui": "^6.9.
|
|
69
|
+
"@ttoss/ui": "^6.9.28"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public",
|