@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,339 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Box, Button, Flex, Label, Text } from "@ttoss/ui";
3
- import * as React from "react";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import { Icon } from "@ttoss/react-icons";
6
- import { DayPicker } from "react-day-picker";
7
- import { ptBR } from "react-day-picker/locale";
8
-
9
- //#region src/components/DatePicker/DatePicker.tsx
10
- var formatDate = date => {
11
- return date.toLocaleDateString("pt-BR");
12
- };
13
- var DatePicker = ({
14
- label,
15
- value,
16
- presets,
17
- onChange,
18
- disabled
19
- }) => {
20
- const [date, setDate] = React.useState(value);
21
- const [pickerSelection, setPickerSelection] = React.useState(value);
22
- const [isOpen, setIsOpen] = React.useState(false);
23
- const containerRef = React.useRef(null);
24
- const isResettingRangeRef = React.useRef(false);
25
- React.useEffect(() => {
26
- setDate(value);
27
- }, [value]);
28
- React.useEffect(() => {
29
- if (isOpen) setPickerSelection(date);
30
- }, [isOpen, date]);
31
- React.useEffect(() => {
32
- const handleClickOutside = event => {
33
- if (containerRef.current && !containerRef.current.contains(event.target)) setIsOpen(false);
34
- };
35
- if (isOpen) document.addEventListener("mousedown", handleClickOutside);
36
- return () => {
37
- document.removeEventListener("mousedown", handleClickOutside);
38
- };
39
- }, [isOpen]);
40
- const commitSelection = range => {
41
- setDate(range);
42
- onChange?.(range);
43
- };
44
- const handlePresetClick = preset => {
45
- commitSelection(preset.getValue());
46
- setIsOpen(false);
47
- };
48
- const handleDayPickerSelect = selected => {
49
- if (isResettingRangeRef.current && !selected && pickerSelection?.from && !pickerSelection?.to) {
50
- commitSelection({
51
- from: pickerSelection.from,
52
- to: pickerSelection.from
53
- });
54
- setIsOpen(false);
55
- return;
56
- }
57
- isResettingRangeRef.current = false;
58
- const hadFullRange = date?.from && date?.to;
59
- const hadPartialPicker = pickerSelection?.from && !pickerSelection?.to;
60
- if (hadFullRange && !hadPartialPicker && selected?.from && selected?.to) {
61
- setPickerSelection({
62
- from: selected.from.getTime() === date?.from?.getTime() ? selected.to : selected.from,
63
- to: void 0
64
- });
65
- return;
66
- }
67
- setPickerSelection(selected);
68
- if (selected?.from && selected?.to) {
69
- commitSelection(selected);
70
- setIsOpen(false);
71
- } else if (!selected?.from && !selected?.to) commitSelection(void 0);
72
- };
73
- const handleDayClick = day => {
74
- if (date?.from && date?.to) {
75
- isResettingRangeRef.current = true;
76
- setPickerSelection({
77
- from: day,
78
- to: void 0
79
- });
80
- }
81
- };
82
- return /* @__PURE__ */jsxs(Flex, {
83
- ref: containerRef,
84
- sx: {
85
- flexDirection: "column",
86
- gap: "1",
87
- position: "relative"
88
- },
89
- children: [label && /* @__PURE__ */jsx(Label, {
90
- children: label
91
- }), /* @__PURE__ */jsx(Button, {
92
- disabled,
93
- variant: "secondary",
94
- onClick: () => {
95
- return setIsOpen(!isOpen);
96
- },
97
- sx: {
98
- width: "100%",
99
- justifyContent: "space-between",
100
- fontSize: ["14px", "14px"],
101
- fontWeight: 400,
102
- backgroundColor: "white",
103
- padding: "8px 12px",
104
- borderRadius: "lg",
105
- border: "md",
106
- borderColor: "display.border.muted.default",
107
- height: "40px",
108
- minWidth: ["auto", "240px"],
109
- "&:disabled": {
110
- borderColor: "display.border.muted.default"
111
- }
112
- },
113
- children: date?.from ? date.to ? /* @__PURE__ */jsxs(Text, {
114
- sx: {
115
- fontSize: ["12px", "14px"],
116
- overflow: "hidden",
117
- textOverflow: "ellipsis",
118
- whiteSpace: "nowrap"
119
- },
120
- children: [formatDate(date.from), " - ", formatDate(date.to)]
121
- }) : /* @__PURE__ */jsx(Text, {
122
- sx: {
123
- fontSize: ["12px", "14px"],
124
- overflow: "hidden",
125
- textOverflow: "ellipsis",
126
- whiteSpace: "nowrap"
127
- },
128
- children: formatDate(date.from)
129
- }) : /* @__PURE__ */jsx(Text, {
130
- sx: {
131
- fontSize: ["12px", "14px"]
132
- },
133
- children: "Selecione o período"
134
- })
135
- }), isOpen && /* @__PURE__ */jsxs(Fragment, {
136
- children: [/* @__PURE__ */jsx(Box, {
137
- sx: {
138
- display: ["block", "none"],
139
- position: "fixed",
140
- top: 0,
141
- left: 0,
142
- right: 0,
143
- bottom: 0,
144
- backgroundColor: "rgba(0, 0, 0, 0.5)",
145
- zIndex: 49
146
- },
147
- onClick: () => {
148
- return setIsOpen(false);
149
- }
150
- }), /* @__PURE__ */jsxs(Box, {
151
- sx: {
152
- position: ["fixed", "absolute"],
153
- top: ["auto", "calc(100% + 4px)"],
154
- bottom: ["0", "auto"],
155
- left: ["0", "0"],
156
- right: ["0", "auto"],
157
- width: ["100%", "auto"],
158
- maxWidth: ["100%", "650px"],
159
- zIndex: 50,
160
- backgroundColor: "white",
161
- border: "1px solid",
162
- borderColor: "display.border.muted.default",
163
- borderRadius: ["16px 16px 0 0", "8px"],
164
- boxShadow: ["0 -4px 6px -1px rgba(0, 0, 0, 0.1)", "0 4px 6px -1px rgba(0, 0, 0, 0.1)"],
165
- overflow: "hidden",
166
- maxHeight: ["80vh", "none"],
167
- display: "flex",
168
- flexDirection: "column"
169
- },
170
- children: [/* @__PURE__ */jsxs(Flex, {
171
- sx: {
172
- display: ["flex", "none"],
173
- justifyContent: "space-between",
174
- alignItems: "center",
175
- padding: "12px 16px",
176
- borderBottom: "1px solid",
177
- borderColor: "display.border.muted.default"
178
- },
179
- children: [/* @__PURE__ */jsx(Text, {
180
- sx: {
181
- fontSize: "16px",
182
- fontWeight: 600
183
- },
184
- children: label || "Selecione o período"
185
- }), /* @__PURE__ */jsx(Button, {
186
- variant: "ghost",
187
- onClick: () => {
188
- return setIsOpen(false);
189
- },
190
- sx: {
191
- padding: "4px",
192
- minWidth: "auto",
193
- width: "32px",
194
- height: "32px"
195
- },
196
- children: /* @__PURE__ */jsx(Icon, {
197
- icon: "mdi:close",
198
- size: 20
199
- })
200
- })]
201
- }), /* @__PURE__ */jsxs(Flex, {
202
- sx: {
203
- minHeight: "300px",
204
- flexDirection: ["column", "row"],
205
- maxHeight: ["calc(80vh - 60px)", "none"],
206
- overflow: ["auto", "visible"]
207
- },
208
- children: [presets && presets.length > 0 && /* @__PURE__ */jsx(Flex, {
209
- sx: {
210
- flexDirection: ["row", "column"],
211
- gap: "4px",
212
- padding: ["8px", "12px"],
213
- borderRight: ["none", "1px solid"],
214
- borderBottom: ["1px solid", "none"],
215
- borderColor: "display.border.muted.default",
216
- backgroundColor: "navigation.background.muted.default",
217
- minWidth: ["auto", "140px"],
218
- width: ["100%", "auto"],
219
- overflowX: ["auto", "visible"],
220
- overflowY: ["visible", "auto"],
221
- flexWrap: ["nowrap", "wrap"],
222
- "@media (max-width: 768px)": {
223
- "&::-webkit-scrollbar": {
224
- display: "none"
225
- },
226
- scrollbarWidth: "none"
227
- }
228
- },
229
- children: presets?.map(preset => {
230
- return /* @__PURE__ */jsx(Button, {
231
- variant: "ghost",
232
- onClick: () => {
233
- return handlePresetClick(preset);
234
- },
235
- sx: {
236
- justifyContent: ["center", "flex-start"],
237
- fontSize: ["12px", "14px"],
238
- fontWeight: 400,
239
- padding: ["6px 8px", "8px 12px"],
240
- color: "display.text.secondary.default",
241
- backgroundColor: "transparent",
242
- whiteSpace: "nowrap",
243
- minWidth: ["auto", "auto"],
244
- flexShrink: 0,
245
- "&:hover": {
246
- backgroundColor: "input.background.muted.active"
247
- }
248
- },
249
- children: preset.label
250
- }, preset.label);
251
- })
252
- }), /* @__PURE__ */jsx(Box, {
253
- sx: {
254
- padding: ["12px", "16px"],
255
- flex: 1,
256
- overflow: "auto",
257
- "& .rdp": {
258
- margin: 0
259
- },
260
- "& .rdp-month": {
261
- width: "100%"
262
- },
263
- "& .rdp-day_button": {
264
- borderRadius: "50% !important",
265
- border: "none",
266
- fontSize: ["12px", "14px"],
267
- width: ["32px", "36px"],
268
- height: ["32px", "36px"],
269
- cursor: "pointer"
270
- },
271
- "& .rdp-range_start .rdp-day_button": {
272
- backgroundColor: "action.background.accent.default",
273
- color: "black"
274
- },
275
- "& .rdp-range_end .rdp-day_button": {
276
- backgroundColor: "action.background.accent.default",
277
- color: "black"
278
- },
279
- "& .rdp-day_button:hover": {
280
- backgroundColor: "action.background.primary.default",
281
- color: "action.text.primary.default"
282
- },
283
- "& .rdp-day_selected": {
284
- backgroundColor: "action.background.accent.default",
285
- color: "white",
286
- fontWeight: 600
287
- },
288
- "& .rdp-day_range_middle": {
289
- backgroundColor: "action.background.accent.default",
290
- color: "white"
291
- },
292
- "& .rdp-day_range_start, & .rdp-day_range_end": {
293
- backgroundColor: "action.background.accent.default",
294
- color: "white",
295
- fontWeight: 600
296
- },
297
- "& .rdp-weekday": {
298
- fontSize: ["10px", "12px"],
299
- fontWeight: 500,
300
- color: "display.text.muted.default"
301
- },
302
- "& .rdp-month_caption": {
303
- fontSize: ["12px", "14px"],
304
- fontWeight: 600,
305
- marginBottom: ["12px", "16px"]
306
- },
307
- "@media (max-width: 768px)": {
308
- "& .rdp-caption": {
309
- marginBottom: "8px"
310
- },
311
- "& .rdp-table": {
312
- width: "100%"
313
- }
314
- }
315
- },
316
- children: /* @__PURE__ */jsx(DayPicker, {
317
- disabled,
318
- mode: "range",
319
- locale: ptBR,
320
- selected: pickerSelection?.from ? {
321
- from: pickerSelection.from,
322
- to: pickerSelection.to ?? pickerSelection.from
323
- } : void 0,
324
- onSelect: selected => {
325
- return handleDayPickerSelect(selected);
326
- },
327
- onDayClick: handleDayClick,
328
- weekStartsOn: 1,
329
- showOutsideDays: true
330
- })
331
- })]
332
- })]
333
- })]
334
- })]
335
- });
336
- };
337
-
338
- //#endregion
339
- export { DatePicker };
@@ -1,17 +0,0 @@
1
-
2
- import { BoxProps } from "@ttoss/ui";
3
- import * as React from "react";
4
- import DrawerUi from "react-modern-drawer";
5
-
6
- //#region src/components/Drawer/Drawer.d.ts
7
- type DrawerUiProps = React.ComponentProps<typeof DrawerUi>;
8
- type DrawerProps = DrawerUiProps & {
9
- sx?: BoxProps['sx'];
10
- };
11
- declare const Drawer: ({
12
- children,
13
- sx,
14
- ...props
15
- }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
16
- //#endregion
17
- export { Drawer, DrawerProps };
@@ -1,66 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Box } from "@ttoss/ui";
3
- import "react";
4
- import { jsx } from "react/jsx-runtime";
5
- import DrawerUi from "react-modern-drawer";
6
-
7
- //#region src/components/Drawer/Drawer.tsx
8
- var Drawer = ({
9
- children,
10
- sx,
11
- ...props
12
- }) => {
13
- return /* @__PURE__ */jsx(Box, {
14
- "data-testid": "drawer-container",
15
- sx: {
16
- /**
17
- * https://github.com/Farzin-Firoozi/react-modern-drawer/blob/master/src/styles.css
18
- */
19
- zIndex: "overlay",
20
- width: "100%",
21
- height: "100%",
22
- ".EZDrawer__checkbox": {
23
- display: "none"
24
- },
25
- ".EZDrawer__checkbox:checked ~ .EZDrawer__overlay": {
26
- display: "block",
27
- opacity: 1
28
- },
29
- ".EZDrawer__checkbox:checked ~ .EZDrawer__container": {
30
- visibility: "visible",
31
- transform: "translate3d(0, 0, 0) !important"
32
- },
33
- ".EZDrawer__overlay ": {
34
- display: "none",
35
- height: "100vh",
36
- left: "0",
37
- position: "fixed",
38
- top: "0",
39
- width: "100%"
40
- },
41
- ".EZDrawer__container": {
42
- position: "fixed",
43
- visibility: "hidden",
44
- backgroundColor: "navigation.background.muted.default",
45
- transition: "all",
46
- boxShadow: "0 0 10px 5px rgba(0, 0, 0, 0.1)",
47
- paddingX: "6",
48
- overflowY: "auto"
49
- },
50
- ...sx
51
- },
52
- children: /* @__PURE__ */jsx(DrawerUi, {
53
- ...props,
54
- children: /* @__PURE__ */jsx(Box, {
55
- sx: {
56
- width: "100%",
57
- height: "100%"
58
- },
59
- children
60
- })
61
- })
62
- });
63
- };
64
-
65
- //#endregion
66
- export { Drawer };
@@ -1,107 +0,0 @@
1
-
2
- import { BadgeProps } from "@ttoss/ui";
3
-
4
- //#region src/components/EnhancedTitle/EnhancedTitle.types.d.ts
5
- /**
6
- * Visual variant for the icon wrapper.
7
- */
8
- type EnhancedTitleVariant = 'spotlight-accent' | 'spotlight-primary' | 'primary' | 'secondary' | 'accent' | 'positive' | 'negative' | 'informative' | 'muted';
9
- /**
10
- * Badge configuration for top and bottom badge sections.
11
- */
12
- interface EnhancedTitleBadge {
13
- /**
14
- * Icon to display in the badge.
15
- */
16
- icon?: string;
17
- /**
18
- * Badge label text.
19
- */
20
- label: string;
21
- /**
22
- * Badge visual variant.
23
- */
24
- variant?: BadgeProps['variant'];
25
- }
26
- /**
27
- * Props for the EnhancedTitle component.
28
- */
29
- interface EnhancedTitleProps {
30
- /**
31
- * Visual variant for the icon wrapper.
32
- * @default 'primary'
33
- */
34
- variant?: EnhancedTitleVariant;
35
- /**
36
- * Icon to display next to the title.
37
- */
38
- icon?: string;
39
- /**
40
- * Main title text (heading).
41
- */
42
- title: string;
43
- /**
44
- * Optional subtitle/description text.
45
- */
46
- description?: string;
47
- /**
48
- * Optional text displayed next to the title (e.g., price, metadata).
49
- */
50
- frontTitle?: string;
51
- /**
52
- * Badges to display above the title.
53
- */
54
- topBadges?: EnhancedTitleBadge[];
55
- /**
56
- * Badges to display below the title.
57
- */
58
- bottomBadges?: EnhancedTitleBadge[];
59
- }
60
- //#endregion
61
- //#region src/components/EnhancedTitle/EnhancedTitle.d.ts
62
- /**
63
- * EnhancedTitle component renders a structured title section with icon, badges, and metadata.
64
- *
65
- * This component is useful for displaying rich title sections with status indicators,
66
- * feature tags, and supplementary information in a consistent layout.
67
- *
68
- * @example
69
- * ```tsx
70
- * <EnhancedTitle
71
- * icon="fluent:shield-24-filled"
72
- * title="Starter Plan"
73
- * frontTitle="R$ 49,90/mês"
74
- * description="Perfect for small teams"
75
- * variant="primary"
76
- * topBadges={[
77
- * { label: 'Active', variant: 'positive', icon: 'fluent:checkmark-circle-24-filled' }
78
- * ]}
79
- * bottomBadges={[
80
- * { label: 'OneClick Tracking', icon: 'fluent:checkmark-24-filled' }
81
- * ]}
82
- * />
83
- * ```
84
- *
85
- * @example
86
- * ```tsx
87
- * <EnhancedTitle
88
- * title="Pro Plan"
89
- * frontTitle="$99/month"
90
- * variant="accent"
91
- * topBadges={[
92
- * { label: 'Most Popular', variant: 'informative' }
93
- * ]}
94
- * />
95
- * ```
96
- */
97
- declare const EnhancedTitle: ({
98
- variant,
99
- icon,
100
- title,
101
- description,
102
- frontTitle,
103
- topBadges,
104
- bottomBadges
105
- }: EnhancedTitleProps) => import("react/jsx-runtime").JSX.Element;
106
- //#endregion
107
- export { EnhancedTitle, EnhancedTitleBadge, EnhancedTitleProps, EnhancedTitleVariant };