@tecsinapse/cortex-react 1.2.2-beta.0 → 1.2.2-beta.2

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 (81) hide show
  1. package/dist/cjs/components/BaseSnackbar.js +13 -0
  2. package/dist/cjs/components/Calendar.js +22 -0
  3. package/dist/cjs/components/CalendarCell.js +51 -0
  4. package/dist/cjs/components/CalendarGrid.js +23 -0
  5. package/dist/cjs/components/CalendarGridBodyRows.js +12 -0
  6. package/dist/cjs/components/CalendarGridHeaderRow.js +12 -0
  7. package/dist/cjs/components/CalendarHeader.js +40 -0
  8. package/dist/cjs/components/DefaultSnack.js +27 -0
  9. package/dist/cjs/components/GroupButton.js +2 -1
  10. package/dist/cjs/components/ProgressBar.js +2 -1
  11. package/dist/cjs/components/RangeCalendar.js +44 -0
  12. package/dist/cjs/components/SearchInput.js +19 -12
  13. package/dist/cjs/components/Select.js +4 -4
  14. package/dist/cjs/components/Skeleton.js +1 -0
  15. package/dist/cjs/components/Table.js +8 -14
  16. package/dist/cjs/hooks/useCalendar.js +27 -0
  17. package/dist/cjs/hooks/useCalendarCell.js +35 -0
  18. package/dist/cjs/hooks/useCalendarGrid.js +14 -0
  19. package/dist/cjs/index.js +35 -20
  20. package/dist/cjs/service/SnackbarSonner.js +54 -0
  21. package/dist/cjs/styles/calendar-cell.js +40 -0
  22. package/dist/esm/components/BaseSnackbar.js +11 -0
  23. package/dist/esm/components/Calendar.js +20 -0
  24. package/dist/esm/components/CalendarCell.js +49 -0
  25. package/dist/esm/components/CalendarGrid.js +21 -0
  26. package/dist/esm/components/CalendarGridBodyRows.js +10 -0
  27. package/dist/esm/components/CalendarGridHeaderRow.js +10 -0
  28. package/dist/esm/components/CalendarHeader.js +38 -0
  29. package/dist/esm/components/DefaultSnack.js +25 -0
  30. package/dist/esm/components/GroupButton.js +2 -1
  31. package/dist/esm/components/ProgressBar.js +2 -1
  32. package/dist/esm/components/RangeCalendar.js +42 -0
  33. package/dist/esm/components/SearchInput.js +19 -12
  34. package/dist/esm/components/Select.js +4 -4
  35. package/dist/esm/components/Skeleton.js +1 -0
  36. package/dist/esm/components/Table.js +9 -14
  37. package/dist/esm/hooks/useCalendar.js +25 -0
  38. package/dist/esm/hooks/useCalendarCell.js +33 -0
  39. package/dist/esm/hooks/useCalendarGrid.js +12 -0
  40. package/dist/esm/index.js +17 -9
  41. package/dist/esm/service/SnackbarSonner.js +52 -0
  42. package/dist/esm/styles/calendar-cell.js +38 -0
  43. package/dist/types/components/BaseSnackbar.d.ts +9 -0
  44. package/dist/types/components/Calendar.d.ts +6 -0
  45. package/dist/types/components/CalendarCell.d.ts +8 -0
  46. package/dist/types/components/CalendarGrid.d.ts +6 -0
  47. package/dist/types/components/CalendarGridBodyRows.d.ts +6 -0
  48. package/dist/types/components/CalendarGridHeaderRow.d.ts +5 -0
  49. package/dist/types/components/CalendarHeader.d.ts +6 -0
  50. package/dist/types/components/DefaultSnack.d.ts +6 -0
  51. package/dist/types/components/RangeCalendar.d.ts +10 -0
  52. package/dist/types/components/Table.d.ts +0 -1
  53. package/dist/types/components/index.d.ts +12 -9
  54. package/dist/types/hooks/index.d.ts +3 -0
  55. package/dist/types/hooks/useCalendar.d.ts +10 -0
  56. package/dist/types/hooks/useCalendarCell.d.ts +18 -0
  57. package/dist/types/hooks/useCalendarGrid.d.ts +10 -0
  58. package/dist/types/index.d.ts +2 -0
  59. package/dist/types/provider/SnackbarProvider.d.ts +10 -0
  60. package/dist/types/service/ISnackbar.d.ts +7 -0
  61. package/dist/types/service/SnackbarSonner.d.ts +7 -0
  62. package/dist/types/service/index.d.ts +2 -0
  63. package/dist/types/styles/calendar-cell.d.ts +199 -0
  64. package/dist/types/styles/index.d.ts +2 -1
  65. package/dist/types/tests/Calendar.test.d.ts +1 -0
  66. package/dist/types/tests/CalendarCell.test.d.ts +1 -0
  67. package/dist/types/tests/CalendarGridBodyRows.test.d.ts +1 -0
  68. package/dist/types/tests/CalendarGridHeaderRow.test.d.ts +1 -0
  69. package/dist/types/tests/CalendarHeader.test.d.ts +1 -0
  70. package/dist/types/tests/DefaultSnack.test.d.ts +1 -0
  71. package/dist/types/tests/SearchInput.test.d.ts +1 -0
  72. package/dist/types/tests/Select.test.d.ts +1 -0
  73. package/dist/types/tests/Skeleton.test.d.ts +1 -0
  74. package/dist/types/tests/Snackbar.test.d.ts +1 -0
  75. package/dist/types/tests/Table.test.d.ts +1 -0
  76. package/dist/types/tests/useCalendarCell.test.d.ts +1 -0
  77. package/dist/types/tests/useDebouncedState.test.d.ts +1 -0
  78. package/package.json +7 -4
  79. package/dist/cjs/components/Snackbar.js +0 -18
  80. package/dist/esm/components/Snackbar.js +0 -16
  81. package/dist/types/components/Snackbar.d.ts +0 -9
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { SnackbarVariants } from '@tecsinapse/cortex-core';
3
+ interface SnackbarProps {
4
+ variants?: SnackbarVariants;
5
+ children?: ReactNode;
6
+ show: boolean;
7
+ }
8
+ export declare const BaseSnackbar: React.ForwardRefExoticComponent<SnackbarProps & React.RefAttributes<HTMLDivElement>>;
9
+ export {};
@@ -0,0 +1,6 @@
1
+ interface CalendarProps {
2
+ value: Date;
3
+ onChange: (value: Date) => void;
4
+ }
5
+ export declare const Calendar: ({ value, onChange }: CalendarProps) => JSX.Element;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { CalendarDate } from '@internationalized/date';
2
+ import { CalendarState, RangeCalendarState } from 'react-stately';
3
+ interface CalendarCellProps {
4
+ state: CalendarState | RangeCalendarState;
5
+ date: CalendarDate;
6
+ }
7
+ export declare const CalendarCell: ({ state, date }: CalendarCellProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import { CalendarState, RangeCalendarState } from 'react-stately';
2
+ interface CalendarGridProps {
3
+ state: CalendarState | RangeCalendarState;
4
+ }
5
+ export declare const CalendarGrid: ({ state }: CalendarGridProps) => JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { CalendarState, RangeCalendarState } from 'react-stately';
2
+ interface CalendarGridBodyRowsProps {
3
+ state: CalendarState | RangeCalendarState;
4
+ }
5
+ export declare const CalendarGridBodyRows: ({ state }: CalendarGridBodyRowsProps) => JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ interface CalendarGridHeaderRowProps {
2
+ weekDays: string[];
3
+ }
4
+ export declare const CalendarGridHeaderRow: ({ weekDays, }: CalendarGridHeaderRowProps) => JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface CalendarHeaderProps {
2
+ onClickPrevButton: () => void;
3
+ onClickNextButton: () => void;
4
+ title: string;
5
+ }
6
+ export declare const CalendarHeader: ({ onClickPrevButton, onClickNextButton, title, }: CalendarHeaderProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { SnackbarVariants } from '@tecsinapse/cortex-core';
2
+ export declare const DefaultSnack: ({ text, onDismiss, variants, }: {
3
+ text: string;
4
+ onDismiss: () => void;
5
+ variants?: SnackbarVariants;
6
+ }) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ export type DateRange = {
2
+ start: Date;
3
+ end: Date;
4
+ };
5
+ interface RangeCalendarProps {
6
+ onChange: (value: DateRange) => void;
7
+ value: DateRange;
8
+ }
9
+ export declare const RangeCalendar: ({ value, onChange }: RangeCalendarProps) => JSX.Element;
10
+ export {};
@@ -9,6 +9,5 @@ export declare const TRowHeader: ({ children, }: TableCommon & ThHTMLAttributes<
9
9
  export declare const TCell: ({ children, className, ...rest }: TableCommon & TdHTMLAttributes<HTMLTableCellElement>) => JSX.Element;
10
10
  export declare const TFoot: ({ children, className, ...rest }: TableCommon & HTMLAttributes<HTMLTableSectionElement>) => JSX.Element;
11
11
  export declare const Table: ({ children, className, ...rest }: TableCommon & TableHTMLAttributes<HTMLTableElement>) => JSX.Element;
12
- export declare const Hr: ({ children, className, ...rest }: TableCommon & HTMLAttributes<HTMLHRElement>) => JSX.Element;
13
12
  export declare const Td: ({ children, ...rest }: TableCommon & TdHTMLAttributes<HTMLTableCellElement>) => JSX.Element;
14
13
  export {};
@@ -1,18 +1,21 @@
1
+ export * from './Avatar';
1
2
  export * from './Badge';
3
+ export * from './BaseSnackbar';
4
+ export * from './Breadcrumbs';
2
5
  export * from './Button';
6
+ export * from './Calendar';
3
7
  export * from './Card';
8
+ export * from './DefaultSnack';
9
+ export * from './Drawer';
10
+ export * from './GroupButton';
4
11
  export * from './Hint';
5
12
  export * from './Input';
6
13
  export * from './Modal';
14
+ export * from './ProgressBar';
15
+ export * from './RangeCalendar';
7
16
  export { default as Select } from './Select';
8
- export * from './Snackbar';
17
+ export * from './Skeleton';
18
+ export * from './Table';
9
19
  export * from './Tag';
10
- export * from './Toggle';
11
20
  export * from './TextArea';
12
- export * from './Table';
13
- export * from './Drawer';
14
- export * from './Breadcrumbs';
15
- export * from './Avatar';
16
- export * from './Skeleton';
17
- export * from './ProgressBar';
18
- export * from './GroupButton';
21
+ export * from './Toggle';
@@ -1 +1,4 @@
1
+ export * from './useCalendar';
2
+ export * from './useCalendarCell';
3
+ export * from './useCalendarGrid';
1
4
  export * from './useDebouncedState';
@@ -0,0 +1,10 @@
1
+ interface useCalendarProps {
2
+ value: Date;
3
+ onChange: (value: Date) => void;
4
+ }
5
+ export declare const useCalendar: ({ value, onChange }: useCalendarProps) => {
6
+ calendarProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
7
+ title: string;
8
+ state: import("react-stately").CalendarState;
9
+ };
10
+ export {};
@@ -0,0 +1,18 @@
1
+ import { CalendarDate } from '@internationalized/date';
2
+ import { CalendarState, RangeCalendarState } from 'react-stately';
3
+ interface useCalendarCellProps {
4
+ state: CalendarState | RangeCalendarState;
5
+ date: CalendarDate;
6
+ }
7
+ export declare const useCalendarCell: ({ state, date }: useCalendarCellProps) => {
8
+ ref: import("react").MutableRefObject<null>;
9
+ cellProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
10
+ buttonProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
11
+ isSelected: boolean;
12
+ isOutsideVisibleRange: boolean;
13
+ formattedDate: string;
14
+ isSelectionStart: boolean | undefined;
15
+ isSelectionEnd: boolean | undefined;
16
+ inRange: boolean;
17
+ };
18
+ export {};
@@ -0,0 +1,10 @@
1
+ import { CalendarState, RangeCalendarState } from 'react-stately';
2
+ interface useCalendarGridProps {
3
+ state: CalendarState | RangeCalendarState;
4
+ }
5
+ export declare const useCalendarGrid: ({ state }: useCalendarGridProps) => {
6
+ gridProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
7
+ headerProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
8
+ weekDays: string[];
9
+ };
10
+ export {};
@@ -1 +1,3 @@
1
1
  export * from './components';
2
+ export * from './service';
3
+ export * from './hooks';
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { SnackbarSonner } from '../service';
3
+ interface SnackbarProviderProps {
4
+ snackbar: SnackbarSonner;
5
+ }
6
+ export declare const SnackbarProvider: ({ children }: {
7
+ children: ReactNode;
8
+ }) => JSX.Element;
9
+ export declare const useSnackbar: () => SnackbarProviderProps;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ReactElement } from 'react';
2
+ import { SnackbarVariants } from '@tecsinapse/cortex-core';
3
+ export type TypeSnack = SnackbarVariants['intent'];
4
+ export interface ISnackbar<T> {
5
+ show(type: TypeSnack, message: string, options?: T): any;
6
+ custom(component: ReactElement, options?: T): any;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ExternalToast } from 'sonner';
2
+ import React from 'react';
3
+ import { ISnackbar, TypeSnack } from './ISnackbar';
4
+ export declare class SnackbarSonner implements ISnackbar<ExternalToast> {
5
+ custom(Component: React.ReactElement, options?: ExternalToast): string | number;
6
+ show(type: TypeSnack, message: string, options?: Omit<ExternalToast, 'className' | 'style'>): string | number;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './SnackbarSonner';
2
+ export * from './ISnackbar';
@@ -0,0 +1,199 @@
1
+ export declare const calendarCell: import("tailwind-variants").TVReturnType<{
2
+ isSelected: {
3
+ true: {
4
+ cell: string;
5
+ };
6
+ };
7
+ isSelectionStart: {
8
+ true: {
9
+ cell: string;
10
+ };
11
+ };
12
+ isSelectionEnd: {
13
+ true: {
14
+ cell: string;
15
+ };
16
+ };
17
+ inRange: {
18
+ true: {
19
+ cell: string;
20
+ };
21
+ };
22
+ isOutsideVisibleRange: {
23
+ true: {
24
+ cell: string;
25
+ button: string;
26
+ };
27
+ };
28
+ }, {
29
+ cell: string;
30
+ button: string;
31
+ }, undefined, import("tailwind-variants/dist/config").TVConfig<{
32
+ isSelected: {
33
+ true: {
34
+ cell: string;
35
+ };
36
+ };
37
+ isSelectionStart: {
38
+ true: {
39
+ cell: string;
40
+ };
41
+ };
42
+ isSelectionEnd: {
43
+ true: {
44
+ cell: string;
45
+ };
46
+ };
47
+ inRange: {
48
+ true: {
49
+ cell: string;
50
+ };
51
+ };
52
+ isOutsideVisibleRange: {
53
+ true: {
54
+ cell: string;
55
+ button: string;
56
+ };
57
+ };
58
+ }, {
59
+ isSelected: {
60
+ true: {
61
+ cell: string;
62
+ };
63
+ };
64
+ isSelectionStart: {
65
+ true: {
66
+ cell: string;
67
+ };
68
+ };
69
+ isSelectionEnd: {
70
+ true: {
71
+ cell: string;
72
+ };
73
+ };
74
+ inRange: {
75
+ true: {
76
+ cell: string;
77
+ };
78
+ };
79
+ isOutsideVisibleRange: {
80
+ true: {
81
+ cell: string;
82
+ button: string;
83
+ };
84
+ };
85
+ }>, {
86
+ isSelected: {
87
+ true: {
88
+ cell: string;
89
+ };
90
+ };
91
+ isSelectionStart: {
92
+ true: {
93
+ cell: string;
94
+ };
95
+ };
96
+ isSelectionEnd: {
97
+ true: {
98
+ cell: string;
99
+ };
100
+ };
101
+ inRange: {
102
+ true: {
103
+ cell: string;
104
+ };
105
+ };
106
+ isOutsideVisibleRange: {
107
+ true: {
108
+ cell: string;
109
+ button: string;
110
+ };
111
+ };
112
+ }, {
113
+ cell: string;
114
+ button: string;
115
+ }, import("tailwind-variants").TVReturnType<{
116
+ isSelected: {
117
+ true: {
118
+ cell: string;
119
+ };
120
+ };
121
+ isSelectionStart: {
122
+ true: {
123
+ cell: string;
124
+ };
125
+ };
126
+ isSelectionEnd: {
127
+ true: {
128
+ cell: string;
129
+ };
130
+ };
131
+ inRange: {
132
+ true: {
133
+ cell: string;
134
+ };
135
+ };
136
+ isOutsideVisibleRange: {
137
+ true: {
138
+ cell: string;
139
+ button: string;
140
+ };
141
+ };
142
+ }, {
143
+ cell: string;
144
+ button: string;
145
+ }, undefined, import("tailwind-variants/dist/config").TVConfig<{
146
+ isSelected: {
147
+ true: {
148
+ cell: string;
149
+ };
150
+ };
151
+ isSelectionStart: {
152
+ true: {
153
+ cell: string;
154
+ };
155
+ };
156
+ isSelectionEnd: {
157
+ true: {
158
+ cell: string;
159
+ };
160
+ };
161
+ inRange: {
162
+ true: {
163
+ cell: string;
164
+ };
165
+ };
166
+ isOutsideVisibleRange: {
167
+ true: {
168
+ cell: string;
169
+ button: string;
170
+ };
171
+ };
172
+ }, {
173
+ isSelected: {
174
+ true: {
175
+ cell: string;
176
+ };
177
+ };
178
+ isSelectionStart: {
179
+ true: {
180
+ cell: string;
181
+ };
182
+ };
183
+ isSelectionEnd: {
184
+ true: {
185
+ cell: string;
186
+ };
187
+ };
188
+ inRange: {
189
+ true: {
190
+ cell: string;
191
+ };
192
+ };
193
+ isOutsideVisibleRange: {
194
+ true: {
195
+ cell: string;
196
+ button: string;
197
+ };
198
+ };
199
+ }>, unknown, unknown, undefined>>;
@@ -1,2 +1,3 @@
1
- export * from './progressBar';
1
+ export * from './calendar-cell';
2
2
  export * from './groupButton';
3
+ export * from './progressBar';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.2.2-beta.0",
3
+ "version": "1.2.2-beta.2",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -18,9 +18,12 @@
18
18
  "test:watch": "jest --watch"
19
19
  },
20
20
  "dependencies": {
21
- "@tecsinapse/cortex-core": "0.2.2-beta.0",
21
+ "@tecsinapse/cortex-core": "0.2.2-beta.1",
22
22
  "clsx": "*",
23
- "react-icons": "^5.2.1"
23
+ "react-aria": "^3.33.1",
24
+ "react-icons": "^5.2.1",
25
+ "react-stately": "^3.31.1",
26
+ "sonner": "^1.5.0"
24
27
  },
25
28
  "repository": {
26
29
  "type": "git",
@@ -36,5 +39,5 @@
36
39
  "react-dom": ">=18.0.0",
37
40
  "tailwind": ">=3.3.0"
38
41
  },
39
- "gitHead": "c0748464b3ede06c6c907f81970fcc9eacf43bc0"
42
+ "gitHead": "8018ecf7ba73dcedf9d6f58c9c836f50ca94ea70"
40
43
  }
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var cortexCore = require('@tecsinapse/cortex-core');
5
-
6
- const Snackbar = React.forwardRef((props, ref) => {
7
- const { children, show, variants } = props;
8
- return /* @__PURE__ */ React.createElement(React.Fragment, null, show ? /* @__PURE__ */ React.createElement(
9
- "div",
10
- {
11
- className: cortexCore.snackbar(variants),
12
- ref
13
- },
14
- children
15
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null));
16
- });
17
-
18
- exports.Snackbar = Snackbar;
@@ -1,16 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import { snackbar } from '@tecsinapse/cortex-core';
3
-
4
- const Snackbar = forwardRef((props, ref) => {
5
- const { children, show, variants } = props;
6
- return /* @__PURE__ */ React.createElement(React.Fragment, null, show ? /* @__PURE__ */ React.createElement(
7
- "div",
8
- {
9
- className: snackbar(variants),
10
- ref
11
- },
12
- children
13
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null));
14
- });
15
-
16
- export { Snackbar };
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { SnackbarVariants } from '@tecsinapse/cortex-core';
3
- interface SnackbarProps {
4
- variants?: SnackbarVariants;
5
- children: JSX.Element;
6
- show: boolean;
7
- }
8
- export declare const Snackbar: React.ForwardRefExoticComponent<SnackbarProps & React.RefAttributes<HTMLDivElement>>;
9
- export {};