@ttoss/components 2.14.24 → 2.14.26

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 (47) hide show
  1. package/dist/index.d.mts +910 -0
  2. package/dist/index.mjs +3074 -0
  3. package/package.json +18 -104
  4. package/dist/Accordion/index.d.mts +0 -157
  5. package/dist/Accordion/index.mjs +0 -175
  6. package/dist/DatePicker/index.d.mts +0 -26
  7. package/dist/DatePicker/index.mjs +0 -339
  8. package/dist/Drawer/index.d.mts +0 -17
  9. package/dist/Drawer/index.mjs +0 -66
  10. package/dist/EnhancedTitle/index.d.mts +0 -107
  11. package/dist/EnhancedTitle/index.mjs +0 -234
  12. package/dist/FileUploader/index.d.mts +0 -77
  13. package/dist/FileUploader/index.mjs +0 -386
  14. package/dist/InstallPwa/index.d.mts +0 -13
  15. package/dist/InstallPwa/index.mjs +0 -64
  16. package/dist/JsonEditor/index.d.mts +0 -3
  17. package/dist/JsonEditor/index.mjs +0 -3
  18. package/dist/JsonView/index.d.mts +0 -3
  19. package/dist/JsonView/index.mjs +0 -3
  20. package/dist/List/index.d.mts +0 -16
  21. package/dist/List/index.mjs +0 -34
  22. package/dist/LockedOverlay/index.d.mts +0 -162
  23. package/dist/LockedOverlay/index.mjs +0 -386
  24. package/dist/Markdown/index.d.mts +0 -16
  25. package/dist/Markdown/index.mjs +0 -26
  26. package/dist/Menu/index.d.mts +0 -16
  27. package/dist/Menu/index.mjs +0 -136
  28. package/dist/MetricCard/index.d.mts +0 -153
  29. package/dist/MetricCard/index.mjs +0 -408
  30. package/dist/Modal/index.d.mts +0 -11
  31. package/dist/Modal/index.mjs +0 -64
  32. package/dist/NavList/index.d.mts +0 -64
  33. package/dist/NavList/index.mjs +0 -252
  34. package/dist/NotificationCard/index.d.mts +0 -22
  35. package/dist/NotificationCard/index.mjs +0 -173
  36. package/dist/NotificationsMenu/index.d.mts +0 -47
  37. package/dist/NotificationsMenu/index.mjs +0 -380
  38. package/dist/Search/index.d.mts +0 -18
  39. package/dist/Search/index.mjs +0 -31
  40. package/dist/SpotlightCard/index.d.mts +0 -36
  41. package/dist/SpotlightCard/index.mjs +0 -219
  42. package/dist/Table/index.d.mts +0 -17
  43. package/dist/Table/index.mjs +0 -64
  44. package/dist/Tabs/index.d.mts +0 -17
  45. package/dist/Tabs/index.mjs +0 -87
  46. package/dist/Toast/index.d.mts +0 -8
  47. package/dist/Toast/index.mjs +0 -43
@@ -1,26 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { jsx } from "react/jsx-runtime";
3
- import { BaseStyles } from "@ttoss/ui";
4
- import ReactMarkdown from "react-markdown";
5
- import rehypeRaw from "rehype-raw";
6
- import remarkGfm from "remark-gfm";
7
-
8
- //#region src/components/Markdown/Markdown.tsx
9
- var Markdown = ({
10
- children,
11
- sx,
12
- ...props
13
- }) => {
14
- return /* @__PURE__ */jsx(BaseStyles, {
15
- sx,
16
- children: /* @__PURE__ */jsx(ReactMarkdown, {
17
- rehypePlugins: [rehypeRaw],
18
- remarkPlugins: [remarkGfm],
19
- ...props,
20
- children
21
- })
22
- });
23
- };
24
-
25
- //#endregion
26
- export { Markdown };
@@ -1,16 +0,0 @@
1
-
2
- import * as React from "react";
3
-
4
- //#region src/components/Menu/Menu.d.ts
5
- type MenuProps = {
6
- children: React.ReactNode;
7
- sx?: Record<string, unknown>;
8
- menuIcon?: string;
9
- };
10
- declare const Menu: ({
11
- children,
12
- sx,
13
- menuIcon
14
- }: MenuProps) => import("react/jsx-runtime").JSX.Element;
15
- //#endregion
16
- export { Menu, MenuProps };
@@ -1,136 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import * as React from "react";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { Icon } from "@ttoss/react-icons";
5
- import { Box, Flex } from "@ttoss/ui";
6
-
7
- //#region src/components/Menu/Menu.tsx
8
- var Menu = ({
9
- children,
10
- sx,
11
- menuIcon = "menu-open"
12
- }) => {
13
- const [isOpen, setIsOpen] = React.useState(false);
14
- const [stylePos, setStylePos] = React.useState({});
15
- const triggerRef = React.useRef(null);
16
- const panelRef = React.useRef(null);
17
- const toggle = () => {
18
- return setIsOpen(v => {
19
- return !v;
20
- });
21
- };
22
- React.useEffect(() => {
23
- if (!isOpen) return;
24
- const onDocClick = e => {
25
- const t = e.target;
26
- if (panelRef.current && !panelRef.current.contains(t) && triggerRef.current && !triggerRef.current.contains(t)) setIsOpen(false);
27
- };
28
- document.addEventListener("mousedown", onDocClick);
29
- return () => {
30
- return document.removeEventListener("mousedown", onDocClick);
31
- };
32
- }, [isOpen]);
33
- React.useLayoutEffect(() => {
34
- if (!isOpen) return;
35
- let rafId = 0;
36
- const getWidth = () => {
37
- const w = sx?.width ?? sx?.maxWidth ?? sx?.minWidth;
38
- return Array.isArray(w) ? w[w.length - 1] : w;
39
- };
40
- const compute = () => {
41
- const trigger = triggerRef.current;
42
- const panel = panelRef.current;
43
- if (!trigger || !panel) return;
44
- const width = getWidth();
45
- if (width) panel.style.width = typeof width === "number" ? `${width}px` : String(width);
46
- const tr = trigger.getBoundingClientRect();
47
- const pr = panel.getBoundingClientRect();
48
- const vw = window.innerWidth,
49
- vh = window.innerHeight,
50
- m = 8;
51
- if (pr.width === 0) {
52
- rafId = requestAnimationFrame(compute);
53
- return;
54
- }
55
- const left = Math.max(m, Math.min(tr.left + tr.width / 2 - pr.width / 2, vw - pr.width - m));
56
- const top = vh - tr.bottom < pr.height + m ? Math.max(m, tr.top - pr.height - m) : tr.bottom + m;
57
- setStylePos({
58
- position: "fixed",
59
- left: `${left}px`,
60
- top: `${top}px`,
61
- zIndex: 9999,
62
- ...(width && {
63
- width: typeof width === "number" ? `${width}px` : String(width)
64
- })
65
- });
66
- };
67
- rafId = requestAnimationFrame(compute);
68
- const onResizeScroll = () => {
69
- return rafId = requestAnimationFrame(compute);
70
- };
71
- window.addEventListener("resize", onResizeScroll);
72
- window.addEventListener("scroll", onResizeScroll, true);
73
- return () => {
74
- cancelAnimationFrame(rafId);
75
- window.removeEventListener("resize", onResizeScroll);
76
- window.removeEventListener("scroll", onResizeScroll, true);
77
- };
78
- }, [isOpen, sx]);
79
- const panel = isOpen ? /* @__PURE__ */jsx(Flex, {
80
- ref: panelRef,
81
- sx: {
82
- width: ["280px", "320px"],
83
- maxHeight: "400px",
84
- flexDirection: "column",
85
- gap: "3",
86
- padding: "3",
87
- backgroundColor: "input.background.muted.default",
88
- borderRadius: "xl",
89
- boxShadow: "xl",
90
- overflowY: "auto",
91
- border: "md",
92
- borderColor: "display.border.muted.default",
93
- ...sx
94
- },
95
- style: {
96
- pointerEvents: "auto",
97
- ...stylePos
98
- },
99
- children: /* @__PURE__ */jsx(Box, {
100
- as: "nav",
101
- children
102
- })
103
- }) : null;
104
- return /* @__PURE__ */jsx(Flex, {
105
- sx: {
106
- position: "relative",
107
- display: "inline-block"
108
- },
109
- children: /* @__PURE__ */jsxs(Box, {
110
- sx: {
111
- position: "relative"
112
- },
113
- children: [/* @__PURE__ */jsx("button", {
114
- ref: triggerRef,
115
- onClick: toggle,
116
- "aria-haspopup": "true",
117
- "aria-expanded": isOpen,
118
- style: {
119
- background: "transparent",
120
- border: 0,
121
- padding: 4,
122
- cursor: "pointer",
123
- display: "inline-flex",
124
- alignItems: "center",
125
- justifyContent: "center"
126
- },
127
- children: /* @__PURE__ */jsx(Icon, {
128
- icon: menuIcon
129
- })
130
- }), isOpen && panel]
131
- })
132
- });
133
- };
134
-
135
- //#endregion
136
- export { Menu };
@@ -1,153 +0,0 @@
1
-
2
- import { IconType } from "@ttoss/react-icons";
3
-
4
- //#region src/components/MetricCard/MetricCard.types.d.ts
5
- /**
6
- * Base metric properties shared by all metric types.
7
- */
8
- interface BaseMetric {
9
- /**
10
- * Label displayed above the metric value.
11
- */
12
- label: string;
13
- /**
14
- * Optional tooltip text or action handler for additional context.
15
- * When a string is provided, it displays a simple tooltip.
16
- * When a function is provided, it's called when the tooltip icon is clicked.
17
- */
18
- tooltip?: string | (() => void);
19
- /**
20
- * Icon to display alongside the metric.
21
- */
22
- icon?: IconType;
23
- /**
24
- * Optional click handler to make the metric card interactive.
25
- */
26
- onClick?: () => void;
27
- /**
28
- * Optional help article action handler.
29
- */
30
- helpArticleAction?: () => void;
31
- }
32
- /**
33
- * Date-based metric for displaying dates like expiration or renewal.
34
- */
35
- interface DateMetric extends BaseMetric {
36
- type: 'date';
37
- /**
38
- * The date value to display.
39
- */
40
- date: string;
41
- /**
42
- * Optional message showing remaining days.
43
- */
44
- remainingDaysMessage?: string;
45
- /**
46
- * Whether to show a warning indicator.
47
- */
48
- isWarning?: boolean;
49
- }
50
- /**
51
- * Percentage-based metric with progress bar.
52
- */
53
- interface PercentageMetric extends BaseMetric {
54
- type: 'percentage';
55
- /**
56
- * Current value.
57
- */
58
- current: number;
59
- /**
60
- * Maximum value. Use null for unlimited.
61
- */
62
- max: number | null;
63
- /**
64
- * Custom formatter for displaying values.
65
- */
66
- formatValue?: (value: number) => string;
67
- /**
68
- * Percentage threshold at which to show an alert.
69
- */
70
- showAlertThreshold?: number;
71
- }
72
- /**
73
- * Number-based metric for displaying counts.
74
- */
75
- interface NumberMetric extends BaseMetric {
76
- type: 'number';
77
- /**
78
- * Current value.
79
- */
80
- current: number;
81
- /**
82
- * Maximum value. Use null for unlimited.
83
- */
84
- max: number | null;
85
- /**
86
- * Custom formatter for displaying values.
87
- */
88
- formatValue?: (value: number) => string;
89
- /**
90
- * Optional footer text below the metric.
91
- */
92
- footerText?: string;
93
- }
94
- /**
95
- * Union type for all supported metric types.
96
- */
97
- type Metric = DateMetric | PercentageMetric | NumberMetric;
98
- /**
99
- * Props for the MetricCard component.
100
- */
101
- interface MetricCardProps {
102
- /**
103
- * The metric configuration to display.
104
- */
105
- metric: Metric;
106
- /**
107
- * Whether the card is in loading state.
108
- */
109
- isLoading?: boolean;
110
- }
111
- //#endregion
112
- //#region src/components/MetricCard/MetricCard.d.ts
113
- /**
114
- * MetricCard component displays a metric in a consistent card layout.
115
- *
116
- * It supports three metric types:
117
- * - **date**: displays a date and optional remaining-days message
118
- * - **percentage**: displays current/max values and a progress bar
119
- * - **number**: displays current/max values and an optional footer text
120
- *
121
- * @example
122
- * ```tsx
123
- * <MetricCard
124
- * metric={{
125
- * type: 'date',
126
- * label: 'Renewal date',
127
- * date: '31/12/2025',
128
- * icon: 'fluent:calendar-24-regular',
129
- * remainingDaysMessage: '10 days remaining',
130
- * }}
131
- * />
132
- * ```
133
- *
134
- * @example
135
- * ```tsx
136
- * <MetricCard
137
- * metric={{
138
- * type: 'percentage',
139
- * label: 'Plan usage',
140
- * current: 350,
141
- * max: 1000,
142
- * icon: 'fluent:gauge-24-regular',
143
- * showAlertThreshold: 80,
144
- * }}
145
- * />
146
- * ```
147
- */
148
- declare const MetricCard: ({
149
- metric,
150
- isLoading
151
- }: MetricCardProps) => import("react/jsx-runtime").JSX.Element | null;
152
- //#endregion
153
- export { BaseMetric, DateMetric, Metric, MetricCard, MetricCardProps, NumberMetric, PercentageMetric };