@sqrzro/admin 2.1.0-bz.18 → 2.1.0-bz.19

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 (101) hide show
  1. package/dist/components/AppLayout/index.d.ts +9 -0
  2. package/dist/components/AppLayout/index.js +14 -0
  3. package/dist/components/AppNavigation/index.d.ts +6 -0
  4. package/dist/components/AppNavigation/index.js +8 -0
  5. package/dist/components/AppNavigationComponent/index.d.ts +12 -0
  6. package/dist/components/AppNavigationComponent/index.js +19 -0
  7. package/dist/components/Auth/index.d.ts +10 -0
  8. package/dist/components/Auth/index.js +10 -0
  9. package/dist/components/Badge/index.d.ts +8 -0
  10. package/dist/components/Badge/index.js +20 -0
  11. package/dist/components/BooleanFilter/index.d.ts +5 -0
  12. package/dist/components/BooleanFilter/index.js +19 -0
  13. package/dist/components/Config/index.d.ts +6 -0
  14. package/dist/components/Config/index.js +9 -0
  15. package/dist/components/Dashboard/index.d.ts +7 -0
  16. package/dist/components/Dashboard/index.js +5 -0
  17. package/dist/components/DateFilter/index.d.ts +6 -0
  18. package/dist/components/DateFilter/index.js +31 -0
  19. package/dist/components/DropdownFilter/index.d.ts +6 -0
  20. package/dist/components/DropdownFilter/index.js +9 -0
  21. package/dist/components/FilterBar/index.d.ts +10 -0
  22. package/dist/components/FilterBar/index.js +39 -0
  23. package/dist/components/FilterBarClearButton/index.d.ts +6 -0
  24. package/dist/components/FilterBarClearButton/index.js +5 -0
  25. package/dist/components/FilterBarItem/index.d.ts +17 -0
  26. package/dist/components/FilterBarItem/index.js +32 -0
  27. package/dist/components/GridList/index.d.ts +5 -0
  28. package/dist/components/GridList/index.js +7 -0
  29. package/dist/components/GridListItem/index.d.ts +4 -0
  30. package/dist/components/GridListItem/index.js +8 -0
  31. package/dist/components/InfoPanel/index.d.ts +8 -0
  32. package/dist/components/InfoPanel/index.js +18 -0
  33. package/dist/components/List/index.d.ts +8 -0
  34. package/dist/components/List/index.js +23 -0
  35. package/dist/components/ListAction/index.d.ts +7 -0
  36. package/dist/components/ListAction/index.js +9 -0
  37. package/dist/components/ListActions/index.d.ts +11 -0
  38. package/dist/components/ListActions/index.js +19 -0
  39. package/dist/components/ListClientComponent/index.d.ts +15 -0
  40. package/dist/components/ListClientComponent/index.js +14 -0
  41. package/dist/components/ListComponent/index.d.ts +14 -0
  42. package/dist/components/ListComponent/index.js +21 -0
  43. package/dist/components/ListItem/index.d.ts +23 -0
  44. package/dist/components/ListItem/index.js +26 -0
  45. package/dist/components/ListSkeleton/index.d.ts +5 -0
  46. package/dist/components/ListSkeleton/index.js +5 -0
  47. package/dist/components/MeActions/index.d.ts +3 -0
  48. package/dist/components/MeActions/index.js +6 -0
  49. package/dist/components/MePanel/index.d.ts +9 -0
  50. package/dist/components/MePanel/index.js +7 -0
  51. package/dist/components/Menu/index.d.ts +8 -0
  52. package/dist/components/Menu/index.js +7 -0
  53. package/dist/components/MenuItem/index.d.ts +5 -0
  54. package/dist/components/MenuItem/index.js +20 -0
  55. package/dist/components/Page/index.d.ts +14 -0
  56. package/dist/components/Page/index.js +11 -0
  57. package/dist/components/PageActions/index.d.ts +6 -0
  58. package/dist/components/PageActions/index.js +13 -0
  59. package/dist/components/Panel/index.d.ts +9 -0
  60. package/dist/components/Panel/index.js +6 -0
  61. package/dist/components/RootLayout/index.d.ts +10 -0
  62. package/dist/components/RootLayout/index.js +15 -0
  63. package/dist/components/SettingsForm/index.d.ts +7 -0
  64. package/dist/components/SettingsForm/index.js +14 -0
  65. package/dist/components/SettingsPage/index.d.ts +3 -0
  66. package/dist/components/SettingsPage/index.js +9 -0
  67. package/dist/components/Table/index.d.ts +9 -0
  68. package/dist/components/Table/index.js +17 -0
  69. package/dist/components/TableClientComponent/index.d.ts +16 -0
  70. package/dist/components/TableClientComponent/index.js +49 -0
  71. package/dist/components/Tabs/index.d.ts +4 -0
  72. package/dist/components/Tabs/index.js +8 -0
  73. package/dist/components/TabsComponent/index.d.ts +8 -0
  74. package/dist/components/TabsComponent/index.js +9 -0
  75. package/dist/components/index.d.ts +33 -0
  76. package/dist/components/index.js +17 -0
  77. package/dist/hooks/useNavigation.d.ts +11 -0
  78. package/dist/hooks/useNavigation.js +27 -0
  79. package/dist/index.cjs +1166 -105
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.d.ts +3 -169
  82. package/dist/index.js +3 -16
  83. package/dist/index.js.map +1 -1
  84. package/dist/interfaces.d.ts +10 -0
  85. package/dist/interfaces.js +1 -0
  86. package/dist/services/ConfigService.d.ts +17 -0
  87. package/dist/services/ConfigService.js +14 -0
  88. package/dist/services/PermissionService.d.ts +3 -0
  89. package/dist/services/PermissionService.js +25 -0
  90. package/dist/services/SettingsService.d.ts +8 -0
  91. package/dist/services/SettingsService.js +9 -0
  92. package/dist/styles/config.d.ts +3 -0
  93. package/dist/styles/config.js +184 -0
  94. package/dist/styles/postcss.d.ts +6 -0
  95. package/dist/styles/postcss.js +4 -0
  96. package/dist/styles/tailwind.d.ts +10 -0
  97. package/dist/styles/tailwind.js +76 -0
  98. package/package.json +18 -21
  99. package/dist/index.d.cts +0 -169
  100. /package/{postcss.js → postcss.cjs} +0 -0
  101. /package/{tailwind.js → tailwind.cjs} +0 -0
@@ -0,0 +1,25 @@
1
+ 'use server';
2
+ import { cookies } from 'next/headers';
3
+ export async function filterList(list) {
4
+ if (process.env.APP_ENV !== 'production' && process.env.DANGEROUSLY_DISABLE_PERMISSIONS) {
5
+ return Promise.resolve(list);
6
+ }
7
+ const cookie = cookies().get('permissions')?.value;
8
+ if (!cookie) {
9
+ return Promise.resolve([]);
10
+ }
11
+ let value = [];
12
+ try {
13
+ value = JSON.parse(cookie);
14
+ }
15
+ catch (err) {
16
+ return Promise.resolve([]);
17
+ }
18
+ return Promise.resolve(list.filter(({ permission }) => {
19
+ if (!permission) {
20
+ return true;
21
+ }
22
+ const permissions = Array.isArray(permission) ? permission : [permission];
23
+ return permissions.every((item) => value.includes(item));
24
+ }));
25
+ }
@@ -0,0 +1,8 @@
1
+ import type { Errorable } from '@sqrzro/interfaces';
2
+ export type Layout = 'sidebar' | 'topbar';
3
+ export interface SettingsFormFields {
4
+ isDark: boolean;
5
+ layout: Layout;
6
+ }
7
+ export declare function getLayout(): Promise<Layout>;
8
+ export declare function submitSettingsForm(formData: SettingsFormFields): Promise<Errorable<boolean>>;
@@ -0,0 +1,9 @@
1
+ 'use server';
2
+ import { cookies } from 'next/headers';
3
+ export async function getLayout() {
4
+ return Promise.resolve((cookies().get('layout')?.value || 'topbar'));
5
+ }
6
+ export async function submitSettingsForm(formData) {
7
+ cookies().set('layout', formData.layout);
8
+ return Promise.resolve([true, null]);
9
+ }
@@ -0,0 +1,3 @@
1
+ import type { RegisteredClassNames } from '@sqrzro/components';
2
+ declare const classNames: RegisteredClassNames;
3
+ export default classNames;
@@ -0,0 +1,184 @@
1
+ 'use client';
2
+ import { tw, twx } from '@sqrzro/components';
3
+ const classNames = twx({
4
+ actionList: () => ({
5
+ root: 'flex gap-2',
6
+ }),
7
+ button: (props) => ({
8
+ root: {
9
+ danger: 'border-red-500 bg-red-500 text-white',
10
+ default: tw('text-md h-10 rounded border border-slate-300 bg-white px-5 text-slate-600', props?.isFullWidth ? 'w-full' : null),
11
+ primary: 'bg-button-bg text-button-text border-none font-semibold',
12
+ },
13
+ }),
14
+ calendar: () => ({
15
+ root: 'p-4 pb-3 text-sm text-slate-600',
16
+ head: 'pb-2 text-center text-xs text-slate-400',
17
+ month: 'w-full table-fixed',
18
+ day: {
19
+ default: 'h-10 border border-slate-200',
20
+ highlighted: 'bg-slate-100',
21
+ selected: 'bg-slate-200',
22
+ },
23
+ }),
24
+ calendarNavigation: () => ({
25
+ root: 'mb-6 flex items-center justify-between',
26
+ title: 'text-base font-semibold',
27
+ control: 'h-6 w-6 rounded-full border border-slate-300',
28
+ previous: '-order-1',
29
+ }),
30
+ checkboxInput: (props) => ({
31
+ root: tw('flex', props?.isInline ? 'gap-6' : 'flex-col gap-2'),
32
+ icon: {
33
+ default: 'h-5 w-5 rounded border border-slate-300',
34
+ checked: 'border-primary bg-primary relative before:absolute before:inset-0.5 before:bg-[url(/admin/images/check-white.svg)] before:bg-contain',
35
+ },
36
+ label: 'flex min-h-5 items-center pl-2',
37
+ }),
38
+ codeInput: () => ({
39
+ input: {
40
+ default: 'focus:border-primary h-10 rounded border border-slate-300 text-center',
41
+ error: 'border-red-500',
42
+ },
43
+ }),
44
+ definitionList: () => ({
45
+ root: 'flex flex-col gap-4',
46
+ row: 'relative border-b border-slate-200 pb-4',
47
+ term: 'pb-1 text-slate-500',
48
+ }),
49
+ dropdown: () => ({
50
+ list: 'overflow-hidden rounded',
51
+ item: {
52
+ default: 'block border-b border-slate-100 p-3 text-sm text-slate-700',
53
+ selected: 'bg-slate-100',
54
+ },
55
+ title: 'block leading-none',
56
+ meta: 'mt-1.5 block text-xs leading-none text-slate-500',
57
+ icon: 'mr-2 h-5 w-5 bg-[url(/admin/images/chevron.svg)] bg-contain bg-center bg-no-repeat',
58
+ clear: 'mr-2 h-4 w-4 bg-[url(/admin/images/close.svg)] bg-contain bg-center bg-no-repeat',
59
+ }),
60
+ editableFieldset: () => ({
61
+ root: 'bg-panel grid grid-cols-[25%_1fr] gap-20 rounded p-8 shadow',
62
+ title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
63
+ description: 'text-slate-600',
64
+ actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
65
+ }),
66
+ editableFormField: () => ({
67
+ root: 'grid grid-cols-[25%_1fr] border-t border-slate-200 py-4',
68
+ label: 'flex items-center font-semibold leading-none',
69
+ field: 'flex min-h-10 items-center',
70
+ }),
71
+ emptyMessage: (props) => ({
72
+ root: tw('@md:p-16 relative mx-auto mt-4 w-full max-w-2xl p-4 text-center text-slate-500', props?.isMinimal
73
+ ? null
74
+ : 'rounded bg-white shadow before:pointer-events-none before:absolute before:inset-2 before:border-2 before:border-dashed'),
75
+ title: '@md:text-xl mb-2 text-pretty font-semibold leading-tight',
76
+ description: '@md:text-sm text-pretty text-xs',
77
+ action: 'mt-6 flex justify-center',
78
+ }),
79
+ fieldset: () => ({
80
+ root: 'rounded bg-white p-8 shadow',
81
+ title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
82
+ }),
83
+ form: () => ({
84
+ root: 'flex flex-col gap-6',
85
+ }),
86
+ formField: (props) => ({
87
+ root: {
88
+ default: tw(props?.isEditable ? 'grid grid-cols-[25%_1fr] border-t border-slate-200 py-4' : ''),
89
+ },
90
+ label: tw('flex font-semibold leading-none', props?.isEditable ? 'items-center' : 'mb-2 justify-between'),
91
+ field: tw(props?.isEditable ? 'flex min-h-10 flex-col justify-center' : ''),
92
+ details: tw('text-xs font-normal text-slate-500', props?.isEditable ? 'col-start-2 row-start-2 mt-2' : 'mb-2'),
93
+ optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
94
+ error: tw('mt-2 flex items-center gap-1.5 text-red-600 before:h-4 before:w-4 before:rounded-full before:bg-[url(/admin/images/danger.svg)] before:bg-contain', props?.isEditable ? 'col-start-2' : ''),
95
+ }),
96
+ imageInput: () => ({
97
+ root: 'h-64 rounded border border-slate-300 bg-slate-50 p-8',
98
+ icon: 'mx-auto mb-2 block h-12 w-12 rounded-full border-2 border-slate-300',
99
+ title: 'mb-1 font-semibold',
100
+ description: 'text-xs italic text-slate-700',
101
+ }),
102
+ inputPanel: () => ({
103
+ root: 'show my-1 origin-top rounded border border-slate-300 bg-white shadow-md',
104
+ }),
105
+ loadingModal: () => ({
106
+ root: 'open:backdrop:fade py-16 backdrop:bg-slate-700/50 backdrop:backdrop-blur-sm',
107
+ panel: 'text-center text-lg font-semibold text-white',
108
+ }),
109
+ modal: () => ({
110
+ root: 'open:backdrop:fade py-16 backdrop:bg-slate-700/50 backdrop:backdrop-blur-sm',
111
+ panel: 'show bg-panel row-start-2 mx-auto w-full max-w-lg rounded p-6 text-left shadow-xl',
112
+ title: 'mb-6 text-lg font-semibold',
113
+ actions: 'flex justify-end border-t border-slate-200 pt-6',
114
+ }),
115
+ multiInput: () => ({
116
+ root: 'flex flex-col gap-2 pt-2',
117
+ row: 'grid grid-cols-[1fr_auto] has-[>_button]:gap-2',
118
+ }),
119
+ objectInput: () => ({
120
+ root: 'flex flex-col gap-2',
121
+ }),
122
+ passwordInput: () => ({
123
+ action: {
124
+ default: 'mr-2 h-6 w-6 overflow-hidden bg-[url(/admin/images/eye.svg)] bg-no-repeat indent-12',
125
+ selected: 'bg-bottom',
126
+ },
127
+ }),
128
+ radioInput: (props) => ({
129
+ root: tw('flex', props?.isInline ? 'gap-6' : 'flex-col gap-2'),
130
+ icon: {
131
+ default: 'h-5 w-5 rounded border border-slate-300',
132
+ checked: 'border-primary bg-primary relative before:absolute before:inset-0.5 before:bg-[url(/admin/images/check-white.svg)] before:bg-contain',
133
+ },
134
+ label: 'flex min-h-5 items-center pl-2',
135
+ }),
136
+ staticTextInput: () => ({
137
+ root: {
138
+ default: 'text-md flex min-h-10 flex-col justify-center rounded border border-slate-300 bg-white p-3',
139
+ error: 'border-red-500',
140
+ },
141
+ label: 'block leading-none',
142
+ meta: 'mt-1 block text-xs leading-none text-slate-500',
143
+ placeholder: 'block leading-none text-slate-500',
144
+ }),
145
+ switch: () => ({
146
+ root: 'flex gap-4',
147
+ input: {
148
+ default: 'h-6 w-10 flex-none cursor-pointer rounded-full bg-slate-300 p-1 transition-colors',
149
+ checked: 'bg-primary',
150
+ },
151
+ control: {
152
+ default: 'h-4 w-4 translate-x-0 transform rounded-full bg-white shadow-md transition-transform',
153
+ checked: 'translate-x-full',
154
+ },
155
+ label: 'block flex min-h-6 flex-col justify-center',
156
+ details: 'mt-1 block text-xs text-slate-500',
157
+ }),
158
+ textArea: () => ({
159
+ root: {
160
+ default: 'text-md focus:border-primary rounded border border-slate-300 px-3 py-2',
161
+ error: 'border-red-500',
162
+ },
163
+ }),
164
+ textButton: () => ({
165
+ root: { danger: 'text-red-600' },
166
+ }),
167
+ textInput: () => ({
168
+ root: {
169
+ default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3',
170
+ error: 'border-red-500',
171
+ },
172
+ prefix: {
173
+ default: 'peer-focus:border-primary relative -mr-1 rounded-l border border-slate-300 bg-white px-3 text-sm text-slate-600',
174
+ },
175
+ }),
176
+ toast: () => ({
177
+ root: {
178
+ default: 'rounded border px-4 py-2',
179
+ success: 'border-green-300 bg-green-100 text-green-700',
180
+ error: 'border-red-300 bg-red-100 text-red-700',
181
+ },
182
+ }),
183
+ });
184
+ export default classNames;
@@ -0,0 +1,6 @@
1
+ declare const config: {
2
+ plugins: {
3
+ tailwindcss: {};
4
+ };
5
+ };
6
+ export default config;
@@ -0,0 +1,4 @@
1
+ const config = {
2
+ plugins: { tailwindcss: {} },
3
+ };
4
+ export default config;
@@ -0,0 +1,10 @@
1
+ interface Theme {
2
+ colors?: Partial<{
3
+ 'button-bg': string;
4
+ 'button-text': string;
5
+ link: string;
6
+ primary: string;
7
+ }>;
8
+ }
9
+ declare function config(resolves: string[], customization: Theme, plugins: unknown[]): Record<string, unknown>;
10
+ export default config;
@@ -0,0 +1,76 @@
1
+ import path from 'path';
2
+ import plugin from 'tailwindcss/plugin'; // eslint-disable-line import/no-extraneous-dependencies
3
+ function config(resolves, customization, plugins) {
4
+ return {
5
+ content: [
6
+ './app/**/*.tsx',
7
+ './src/**/*.tsx',
8
+ ...resolves.map((item) => path.join(item, '**/*.js')),
9
+ ],
10
+ darkMode: 'class',
11
+ mode: 'jit',
12
+ theme: {
13
+ extend: {
14
+ colors: {
15
+ 'button-bg': 'var(--color-button-bg)',
16
+ 'button-text': 'var(--color-button-text)',
17
+ link: 'var(--color-link)',
18
+ panel: 'var(--color-panel)',
19
+ primary: 'var(--color-primary)',
20
+ },
21
+ fontFamily: {
22
+ sans: ['var(--font-inter)'],
23
+ },
24
+ },
25
+ },
26
+ plugins: [
27
+ ...plugins,
28
+ plugin(({ addBase, addUtilities, theme }) => {
29
+ addBase({
30
+ body: {
31
+ '--color-button-bg': customization?.colors?.['button-bg'] ||
32
+ customization?.colors?.primary ||
33
+ theme('colors.indigo.800'),
34
+ '--color-button-text': customization?.colors?.['button-text'] || theme('colors.white'),
35
+ '--color-link': customization?.colors?.link || theme('colors.indigo.800'),
36
+ '--color-panel': theme('colors.white'),
37
+ '--color-primary': customization?.colors?.primary || theme('colors.indigo.800'),
38
+ },
39
+ 'body.dark': {
40
+ '--color-panel': theme('colors.gray.700'),
41
+ },
42
+ strong: {
43
+ fontWeight: theme('fontWeight.semibold'),
44
+ },
45
+ });
46
+ addUtilities({
47
+ '@keyframes show': {
48
+ from: {
49
+ opacity: '0',
50
+ transform: 'scale3d(.9,.9,.9)',
51
+ },
52
+ to: {
53
+ opacity: '1',
54
+ transform: 'scale3d(1,1,1)',
55
+ },
56
+ },
57
+ '.show': {
58
+ animation: 'show 0.1s ease-in-out',
59
+ },
60
+ '@keyframes fade': {
61
+ from: {
62
+ opacity: '0',
63
+ },
64
+ to: {
65
+ opacity: '1',
66
+ },
67
+ },
68
+ '.fade': {
69
+ animation: 'fade 0.2s ease-in-out',
70
+ },
71
+ });
72
+ }),
73
+ ],
74
+ };
75
+ }
76
+ export default config;
package/package.json CHANGED
@@ -1,37 +1,33 @@
1
1
  {
2
2
  "name": "@sqrzro/admin",
3
3
  "type": "module",
4
- "version": "2.1.0-bz.18",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.js",
4
+ "version": "2.1.0-bz.19",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "license": "ISC",
9
8
  "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
- "types": "./dist/index.d.ts"
14
- }
9
+ ".": "./dist/index.js",
10
+ "./postcss": "./postcss.cjs",
11
+ "./tailwind": "./tailwind.cjs"
15
12
  },
16
13
  "files": [
17
14
  "dist/**/*",
18
- "postcss.js",
19
- "tailwind.js",
15
+ "postcss.cjs",
16
+ "tailwind.cjs",
20
17
  "tailwind.d.ts"
21
18
  ],
22
19
  "dependencies": {
23
20
  "@sqrzro/components": "bz",
24
21
  "@sqrzro/hooks": "bz",
25
22
  "@sqrzro/interfaces": "bz",
26
- "@sqrzro/server": "bz",
27
23
  "@sqrzro/utility": "bz",
28
24
  "next": "^14.1.4",
29
- "react": "18.3.0-canary-e373190fa-20240325",
30
- "react-dom": "18.3.0-canary-e373190fa-20240325"
25
+ "react": "^18.2.0",
26
+ "react-dom": "^18.2.0"
31
27
  },
32
28
  "devDependencies": {
33
- "@babel/core": "^7.24.3",
34
- "@babel/preset-env": "^7.24.3",
29
+ "@babel/core": "^7.24.4",
30
+ "@babel/preset-env": "^7.24.4",
35
31
  "@babel/preset-react": "^7.24.1",
36
32
  "@babel/preset-typescript": "^7.24.1",
37
33
  "@sqrzro/eslint-plugin": "bz",
@@ -45,6 +41,7 @@
45
41
  "@storybook/react": "^7.6.17",
46
42
  "@storybook/react-webpack5": "7.0.7",
47
43
  "@storybook/testing-library": "^0.1.0",
44
+ "@tailwindcss/container-queries": "^0.1.1",
48
45
  "@testing-library/dom": "^8.20.1",
49
46
  "@testing-library/jest-dom": "^5.17.0",
50
47
  "@testing-library/react": "^13.4.0",
@@ -52,8 +49,8 @@
52
49
  "@types/bcrypt": "^5.0.2",
53
50
  "@types/jest": "^29.5.12",
54
51
  "@types/node": "18.14.6",
55
- "@types/react": "^18.2.71",
56
- "@types/react-dom": "^18.2.22",
52
+ "@types/react": "^18.2.74",
53
+ "@types/react-dom": "^18.2.24",
57
54
  "babel-loader": "^8.3.0",
58
55
  "concurrently": "^7.6.0",
59
56
  "eslint": "^8.57.0",
@@ -62,15 +59,15 @@
62
59
  "prettier": "^3.2.5",
63
60
  "rimraf": "^4.4.1",
64
61
  "storybook": "^7.6.17",
65
- "tailwindcss": "^3.4.1",
62
+ "tailwindcss": "^3.4.3",
66
63
  "tslib": "^2.6.2",
67
64
  "tsup": "^8.0.2",
68
- "typescript": "^5.4.3"
65
+ "typescript": "^5.4.4"
69
66
  },
70
67
  "scripts": {
71
- "build": "tsup",
68
+ "build": "tsc -p tsconfig.build.json",
72
69
  "clean": "rimraf ./dist",
73
- "dev": "tsup --watch",
70
+ "dev": "pnpm build --watch",
74
71
  "docs": "storybook dev -p 6006",
75
72
  "lint": "tsc --noEmit && eslint \"./src/**/*.tsx\" \"./src/**/*.ts\"",
76
73
  "prettier": "prettier --write \"./src/**/*.tsx\" \"./src/**/*.ts\"",
package/dist/index.d.cts DELETED
@@ -1,169 +0,0 @@
1
- import { AuthProps as AuthProps$1, EmptyMessageProps } from '@sqrzro/components';
2
- export { Autocomplete, AutocompleteFormField, Button, CalendarInput, CheckboxInput, ConfirmableButton, ConnectedDropdown, ContentFormField, DateFormField, DateInput, DefinitionList, Dropdown, DropdownFormField, DropdownItem, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextAreaFormField, EditableTextFormField, EmptyMessage, Fieldset, Form, FormField, FormSubmit, ImageFormField, ImageInput, Link, LoadingModal, ModalForm, MultiFormField, NumberFormField, NumberInput, RadioInput, Switch, SwitchFormField, TextArea, TextAreaFormField, TextFormField, TextInput, Toaster } from '@sqrzro/components';
3
- import { StyleVariant, SimpleObject, Errorable, ConfirmableAction, InputProps, LinkableAction } from '@sqrzro/interfaces';
4
-
5
- interface AppLayoutProps {
6
- children: React.ReactNode;
7
- user?: {
8
- name: string;
9
- } | null;
10
- }
11
- declare function AppLayout({ children, user }: Readonly<AppLayoutProps>): Promise<JSX.Element>;
12
-
13
- type AuthProps = AuthProps$1;
14
- declare function Auth(props: AuthProps$1): JSX.Element;
15
-
16
- interface BadgeProps {
17
- children: React.ReactNode;
18
- variant?: StyleVariant | null;
19
- }
20
- declare function Badge({ children, variant }: Readonly<BadgeProps>): React.ReactElement;
21
-
22
- interface DashboardProps {
23
- children?: React.ReactNode;
24
- title: string;
25
- }
26
- declare function Dashboard({ children, title }: Readonly<DashboardProps>): React.ReactElement;
27
-
28
- type FilterType = 'boolean' | 'date' | 'dropdown';
29
- interface FilterObject {
30
- data?: SimpleObject[];
31
- label: string;
32
- name: string;
33
- type: FilterType;
34
- }
35
-
36
- interface FilterBarProps {
37
- hasSearch?: boolean;
38
- map?: FilterObject[];
39
- }
40
- declare function FilterBar({ hasSearch, map }: Readonly<FilterBarProps>): React.ReactElement;
41
-
42
- interface ListObject {
43
- actions?: ({ id }: {
44
- id: number | string;
45
- }) => React.ReactElement;
46
- description?: React.ReactNode | null;
47
- href?: string;
48
- id: number | string;
49
- image?: string | null;
50
- imageHref?: string | null;
51
- meta?: React.ReactNode[] | Record<string, React.ReactNode>;
52
- permission?: string;
53
- subtitle?: React.ReactNode | null;
54
- title?: string;
55
- }
56
-
57
- interface ListComponentProps {
58
- params?: Record<string, string>;
59
- searchParams?: Record<string, string>;
60
- }
61
- interface ListProps<Item, Params> {
62
- actions?: ({ id }: {
63
- readonly id: number;
64
- }) => React.ReactElement;
65
- columns?: number;
66
- emptyMessageProps?: EmptyMessageProps;
67
- filters?: FilterObject[];
68
- fn: (params?: Params, searchParams?: URLSearchParams) => Promise<Errorable<Item[]>>;
69
- hasSearch?: boolean;
70
- isMinimal?: boolean;
71
- renderItem?: (props: ListObject) => JSX.Element;
72
- params?: Params;
73
- transformer?: (item: Item) => ListObject;
74
- }
75
- declare function List<Item extends object, Params>({ actions, columns, emptyMessageProps, filters, fn, hasSearch, isMinimal, params, renderItem, transformer, }: Readonly<ListProps<Item, Params>>): Promise<React.ReactElement>;
76
-
77
- type GridListProps<Item, Params> = Omit<ListProps<Item, Params>, 'renderItem'>;
78
- declare function GridList<Item extends object, Params>(props: GridListProps<Item, Params>): React.ReactElement;
79
-
80
- interface InfoPanelProps {
81
- children: React.ReactNode;
82
- variant?: StyleVariant;
83
- }
84
- declare function InfoPanel({ children, variant }: Readonly<InfoPanelProps>): React.ReactElement;
85
-
86
- interface ListActionsProps {
87
- actions: ConfirmableAction<number>[];
88
- id: number;
89
- }
90
- declare function ListActions({ actions, id }: Readonly<ListActionsProps>): React.ReactElement;
91
-
92
- type FilterComponentProps = InputProps<string> & {
93
- data?: SimpleObject[];
94
- };
95
- interface NavigationAction extends LinkableAction {
96
- permission?: string;
97
- }
98
-
99
- interface PageProps {
100
- actions?: LinkableAction[];
101
- basePath?: string;
102
- children: React.ReactNode;
103
- isFullWidth?: boolean;
104
- tabs?: (NavigationAction | null)[];
105
- title: string;
106
- }
107
- declare function Page({ basePath, children, isFullWidth, tabs, title, }: Readonly<PageProps>): Promise<React.ReactElement>;
108
-
109
- interface PanelProps {
110
- action?: LinkableAction;
111
- children: React.ReactNode;
112
- title?: string;
113
- }
114
- declare function Panel({ action, children, title }: Readonly<PanelProps>): React.ReactElement;
115
-
116
- interface PageActionsProps {
117
- children: React.ReactNode;
118
- }
119
- declare function PageActions({ children }: Readonly<PageActionsProps>): React.ReactElement | null;
120
-
121
- interface ConfigNavigationObject {
122
- href: string;
123
- label: string;
124
- permission?: string;
125
- }
126
- interface Config {
127
- app: {
128
- name: string;
129
- url: string;
130
- };
131
- logo?: () => React.ReactElement;
132
- navigation: ConfigNavigationObject[];
133
- }
134
- declare function setConfig(cfg: Config, logo?: () => React.ReactElement): Config;
135
- declare function getConfig(): Config;
136
-
137
- interface RootLayoutProps {
138
- children: React.ReactNode;
139
- config?: Config;
140
- logo?: () => React.ReactElement;
141
- }
142
- declare function RootLayout({ children, config, logo }: Readonly<RootLayoutProps>): React.ReactElement;
143
-
144
- interface SettingsPageProps {
145
- children: React.ReactNode;
146
- }
147
- declare function SettingsPage({ children, }: Readonly<SettingsPageProps>): Promise<React.ReactElement>;
148
-
149
- interface TableItemObject {
150
- [key: string]: string;
151
- id: string;
152
- }
153
- interface TableColumnObject {
154
- key: string;
155
- title?: string;
156
- type?: 'number' | 'string';
157
- }
158
- interface TableClientComponentProps {
159
- columns: string[] | TableColumnObject[];
160
- data: TableItemObject[];
161
- }
162
-
163
- interface TableProps<T> extends Omit<TableClientComponentProps, 'data'> {
164
- fn: (filters?: Record<string, string>) => Promise<Errorable<T[]>>;
165
- searchParams?: Record<string, string>;
166
- }
167
- declare function Table<T>({ columns, fn, searchParams, }: Readonly<TableProps<T>>): Promise<React.ReactElement>;
168
-
169
- export { AppLayout, type AppLayoutProps, Auth, type AuthProps, Badge, type BadgeProps, type Config, Dashboard, type DashboardProps, FilterBar, type FilterBarProps, type FilterComponentProps, type FilterObject, GridList, type GridListProps, InfoPanel, type InfoPanelProps, List, ListActions, type ListActionsProps, type ListComponentProps, type ListObject, type ListProps, type NavigationAction, Page, PageActions, type PageActionsProps, type PageProps, Panel, type PanelProps, RootLayout, type RootLayoutProps, SettingsPage, Table, type TableColumnObject, type TableProps, getConfig, setConfig };
File without changes
File without changes