@makroz/web 1.0.1 → 1.2.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/dist/components/MkButton.d.ts.map +1 -1
- package/dist/components/MkButton.js +0 -2
- package/dist/components/MkButton.js.map +1 -1
- package/dist/components/MkThemeEditor.js +1 -1
- package/dist/components/MkThemeEditor.js.map +1 -1
- package/dist/components/MkToastContainer.d.ts.map +1 -1
- package/dist/components/MkToastContainer.js +0 -2
- package/dist/components/MkToastContainer.js.map +1 -1
- package/dist/components/MkToastContainer.stories.d.ts.map +1 -0
- package/dist/components/MkToastContainer.stories.test.d.ts.map +1 -0
- package/dist/context/MkAuthContext.d.ts +1 -2
- package/dist/context/MkAuthContext.d.ts.map +1 -1
- package/dist/context/MkAuthContext.js +1 -3
- package/dist/context/MkAuthContext.js.map +1 -1
- package/dist/context/MkConfirmContext.d.ts +1 -2
- package/dist/context/MkConfirmContext.d.ts.map +1 -1
- package/dist/context/MkConfirmContext.js +0 -2
- package/dist/context/MkConfirmContext.js.map +1 -1
- package/dist/context/MkToastContext.d.ts +1 -2
- package/dist/context/MkToastContext.d.ts.map +1 -1
- package/dist/context/MkToastContext.js +0 -2
- package/dist/context/MkToastContext.js.map +1 -1
- package/dist/hooks/useApi.d.ts +5 -6
- package/dist/hooks/useApi.d.ts.map +1 -1
- package/dist/hooks/useApi.js +0 -2
- package/dist/hooks/useApi.js.map +1 -1
- package/dist/hooks/useMkCrud.d.ts.map +1 -1
- package/dist/hooks/useMkCrud.js +0 -2
- package/dist/hooks/useMkCrud.js.map +1 -1
- package/dist/hooks/useMkCrud.test.js +0 -2
- package/dist/hooks/useMkCrud.test.js.map +1 -1
- package/dist/hooks/useMkForm.d.ts.map +1 -1
- package/dist/hooks/useMkForm.js +1 -1
- package/dist/hooks/useMkForm.js.map +1 -1
- package/dist/hooks/useMkList.d.ts +7 -7
- package/dist/theme/MkThemeProvider.d.ts.map +1 -1
- package/dist/theme/MkThemeProvider.js +2 -2
- package/dist/theme/MkThemeProvider.js.map +1 -1
- package/eslint-plugin-mk/README.md +167 -0
- package/package.json +17 -5
- package/dist/auth/MkAuthContext.d.ts +0 -43
- package/dist/auth/MkAuthContext.d.ts.map +0 -1
- package/dist/auth/MkAuthContext.js +0 -3
- package/dist/auth/MkAuthContext.js.map +0 -1
- package/dist/auth/MkAuthForm.d.ts +0 -42
- package/dist/auth/MkAuthForm.d.ts.map +0 -1
- package/dist/auth/MkAuthForm.js +0 -53
- package/dist/auth/MkAuthForm.js.map +0 -1
- package/dist/auth/MkAuthProvider.d.ts +0 -30
- package/dist/auth/MkAuthProvider.d.ts.map +0 -1
- package/dist/auth/MkAuthProvider.js +0 -319
- package/dist/auth/MkAuthProvider.js.map +0 -1
- package/dist/auth/auth/MkAuthContext.d.ts +0 -42
- package/dist/auth/auth/MkAuthForm.d.ts +0 -41
- package/dist/auth/auth/MkAuthProvider.d.ts +0 -29
- package/dist/auth/auth/types.d.ts +0 -62
- package/dist/auth/auth/useMkAuth.d.ts +0 -18
- package/dist/auth/components/MkButton.d.ts +0 -10
- package/dist/auth/components/MkInput.d.ts +0 -12
- package/dist/auth/types.d.ts +0 -63
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -20
- package/dist/auth/types.js.map +0 -1
- package/dist/auth/useMkAuth.d.ts +0 -19
- package/dist/auth/useMkAuth.d.ts.map +0 -1
- package/dist/auth/useMkAuth.js +0 -26
- package/dist/auth/useMkAuth.js.map +0 -1
- package/dist/components/MkAccordion.d.ts +0 -36
- package/dist/components/MkAccordion.d.ts.map +0 -1
- package/dist/components/MkAccordion.js +0 -25
- package/dist/components/MkAccordion.js.map +0 -1
- package/dist/components/MkAccordion.module.css +0 -79
- package/dist/components/MkAlert.d.ts +0 -25
- package/dist/components/MkAlert.d.ts.map +0 -1
- package/dist/components/MkAlert.js +0 -23
- package/dist/components/MkAlert.js.map +0 -1
- package/dist/components/MkAlert.module.css +0 -103
- package/dist/components/MkAvatar.d.ts +0 -16
- package/dist/components/MkAvatar.d.ts.map +0 -1
- package/dist/components/MkAvatar.js +0 -25
- package/dist/components/MkAvatar.js.map +0 -1
- package/dist/components/MkAvatar.module.css +0 -62
- package/dist/components/MkBadge.d.ts +0 -15
- package/dist/components/MkBadge.d.ts.map +0 -1
- package/dist/components/MkBadge.js +0 -9
- package/dist/components/MkBadge.js.map +0 -1
- package/dist/components/MkBadge.module.css +0 -74
- package/dist/components/MkButton.d.ts +0 -11
- package/dist/components/MkButton.module.css +0 -85
- package/dist/components/MkButton.test.d.ts +0 -2
- package/dist/components/MkButton.test.d.ts.map +0 -1
- package/dist/components/MkButton.test.js +0 -58
- package/dist/components/MkButton.test.js.map +0 -1
- package/dist/components/MkCard.d.ts +0 -18
- package/dist/components/MkCard.d.ts.map +0 -1
- package/dist/components/MkCard.js +0 -8
- package/dist/components/MkCard.js.map +0 -1
- package/dist/components/MkCard.module.css +0 -63
- package/dist/components/MkCheck.d.ts +0 -32
- package/dist/components/MkCheck.d.ts.map +0 -1
- package/dist/components/MkCheck.js +0 -14
- package/dist/components/MkCheck.js.map +0 -1
- package/dist/components/MkCheck.module.css +0 -87
- package/dist/components/MkDatePicker.d.ts +0 -29
- package/dist/components/MkDatePicker.d.ts.map +0 -1
- package/dist/components/MkDatePicker.js +0 -12
- package/dist/components/MkDatePicker.js.map +0 -1
- package/dist/components/MkDatePicker.module.css +0 -77
- package/dist/components/MkDivider.d.ts +0 -14
- package/dist/components/MkDivider.d.ts.map +0 -1
- package/dist/components/MkDivider.js +0 -14
- package/dist/components/MkDivider.js.map +0 -1
- package/dist/components/MkDivider.module.css +0 -39
- package/dist/components/MkDropDown.d.ts +0 -22
- package/dist/components/MkDropDown.d.ts.map +0 -1
- package/dist/components/MkDropDown.js +0 -26
- package/dist/components/MkDropDown.js.map +0 -1
- package/dist/components/MkDropDown.module.css +0 -108
- package/dist/components/MkEmptyState.d.ts +0 -14
- package/dist/components/MkEmptyState.d.ts.map +0 -1
- package/dist/components/MkEmptyState.js +0 -8
- package/dist/components/MkEmptyState.js.map +0 -1
- package/dist/components/MkEmptyState.module.css +0 -35
- package/dist/components/MkFileUpload.d.ts +0 -36
- package/dist/components/MkFileUpload.d.ts.map +0 -1
- package/dist/components/MkFileUpload.js +0 -52
- package/dist/components/MkFileUpload.js.map +0 -1
- package/dist/components/MkFileUpload.module.css +0 -74
- package/dist/components/MkIcons.d.ts +0 -14
- package/dist/components/MkIcons.d.ts.map +0 -1
- package/dist/components/MkIcons.js +0 -38
- package/dist/components/MkIcons.js.map +0 -1
- package/dist/components/MkInfiniteList.d.ts +0 -15
- package/dist/components/MkInfiniteList.d.ts.map +0 -1
- package/dist/components/MkInfiniteList.js +0 -31
- package/dist/components/MkInfiniteList.js.map +0 -1
- package/dist/components/MkInfiniteList.module.css +0 -69
- package/dist/components/MkInput.d.ts +0 -13
- package/dist/components/MkInput.d.ts.map +0 -1
- package/dist/components/MkInput.js +0 -23
- package/dist/components/MkInput.js.map +0 -1
- package/dist/components/MkInput.module.css +0 -94
- package/dist/components/MkLoading.d.ts +0 -20
- package/dist/components/MkLoading.d.ts.map +0 -1
- package/dist/components/MkLoading.js +0 -16
- package/dist/components/MkLoading.js.map +0 -1
- package/dist/components/MkLoading.module.css +0 -39
- package/dist/components/MkModal.d.ts +0 -20
- package/dist/components/MkModal.d.ts.map +0 -1
- package/dist/components/MkModal.js +0 -33
- package/dist/components/MkModal.js.map +0 -1
- package/dist/components/MkModal.module.css +0 -107
- package/dist/components/MkProgressBar.d.ts +0 -17
- package/dist/components/MkProgressBar.d.ts.map +0 -1
- package/dist/components/MkProgressBar.js +0 -9
- package/dist/components/MkProgressBar.js.map +0 -1
- package/dist/components/MkProgressBar.module.css +0 -48
- package/dist/components/MkRadio.d.ts +0 -34
- package/dist/components/MkRadio.d.ts.map +0 -1
- package/dist/components/MkRadio.js +0 -21
- package/dist/components/MkRadio.js.map +0 -1
- package/dist/components/MkRadio.module.css +0 -74
- package/dist/components/MkSearchInput.d.ts +0 -30
- package/dist/components/MkSearchInput.d.ts.map +0 -1
- package/dist/components/MkSearchInput.js +0 -29
- package/dist/components/MkSearchInput.js.map +0 -1
- package/dist/components/MkSearchInput.module.css +0 -80
- package/dist/components/MkSelect.d.ts +0 -23
- package/dist/components/MkSelect.d.ts.map +0 -1
- package/dist/components/MkSelect.js +0 -61
- package/dist/components/MkSelect.js.map +0 -1
- package/dist/components/MkSelect.module.css +0 -177
- package/dist/components/MkSkeleton.d.ts +0 -22
- package/dist/components/MkSkeleton.d.ts.map +0 -1
- package/dist/components/MkSkeleton.js +0 -23
- package/dist/components/MkSkeleton.js.map +0 -1
- package/dist/components/MkSkeleton.module.css +0 -28
- package/dist/components/MkSwitch.d.ts +0 -22
- package/dist/components/MkSwitch.d.ts.map +0 -1
- package/dist/components/MkSwitch.js +0 -16
- package/dist/components/MkSwitch.js.map +0 -1
- package/dist/components/MkSwitch.module.css +0 -108
- package/dist/components/MkTable.d.ts +0 -27
- package/dist/components/MkTable.d.ts.map +0 -1
- package/dist/components/MkTable.js +0 -13
- package/dist/components/MkTable.js.map +0 -1
- package/dist/components/MkTable.module.css +0 -163
- package/dist/components/MkTabs.d.ts +0 -22
- package/dist/components/MkTabs.d.ts.map +0 -1
- package/dist/components/MkTabs.js +0 -19
- package/dist/components/MkTabs.js.map +0 -1
- package/dist/components/MkTabs.module.css +0 -117
- package/dist/components/MkTextArea.d.ts +0 -21
- package/dist/components/MkTextArea.d.ts.map +0 -1
- package/dist/components/MkTextArea.js +0 -10
- package/dist/components/MkTextArea.js.map +0 -1
- package/dist/components/MkThemeEditor.d.ts +0 -8
- package/dist/components/MkThemeEditor.module.css +0 -177
- package/dist/components/MkToastContainer.d.ts +0 -3
- package/dist/components/MkToastContainer.module.css +0 -95
- package/dist/components/MkTooltip.d.ts +0 -14
- package/dist/components/MkTooltip.d.ts.map +0 -1
- package/dist/components/MkTooltip.js +0 -19
- package/dist/components/MkTooltip.js.map +0 -1
- package/dist/components/MkTooltip.module.css +0 -43
- package/dist/components/MkWindowList.d.ts +0 -20
- package/dist/components/MkWindowList.d.ts.map +0 -1
- package/dist/components/MkWindowList.js +0 -61
- package/dist/components/MkWindowList.js.map +0 -1
- package/dist/components/MkWindowList.module.css +0 -59
- package/dist/components/index.d.ts +0 -31
- package/dist/components/index.js +0 -34
- package/dist/components/index.js.map +0 -1
- package/dist/context/MkApiContext.d.ts +0 -15
- package/dist/context/MkApiContext.d.ts.map +0 -1
- package/dist/context/MkApiContext.js +0 -30
- package/dist/context/MkApiContext.js.map +0 -1
- package/dist/hooks/useApi.test.d.ts +0 -2
- package/dist/hooks/useApi.test.js +0 -186
- package/dist/hooks/useApi.test.js.map +0 -1
- package/dist/hooks/useMkClickOutside.d.ts +0 -8
- package/dist/hooks/useMkClickOutside.d.ts.map +0 -1
- package/dist/hooks/useMkClickOutside.js +0 -26
- package/dist/hooks/useMkClickOutside.js.map +0 -1
- package/dist/hooks/useMkCrud.d.ts +0 -39
- package/dist/hooks/useMkCrud.test.d.ts +0 -2
- package/dist/hooks/useMkDebounce.d.ts +0 -24
- package/dist/hooks/useMkDebounce.d.ts.map +0 -1
- package/dist/hooks/useMkDebounce.js +0 -38
- package/dist/hooks/useMkDebounce.js.map +0 -1
- package/dist/hooks/useMkEffectDebug.d.ts +0 -7
- package/dist/hooks/useMkEffectDebug.d.ts.map +0 -1
- package/dist/hooks/useMkEffectDebug.js +0 -26
- package/dist/hooks/useMkEffectDebug.js.map +0 -1
- package/dist/hooks/useMkEvent.d.ts +0 -31
- package/dist/hooks/useMkEvent.d.ts.map +0 -1
- package/dist/hooks/useMkEvent.js +0 -56
- package/dist/hooks/useMkEvent.js.map +0 -1
- package/dist/hooks/useMkForm.d.ts +0 -43
- package/dist/hooks/useMkForm.test.d.ts +0 -2
- package/dist/hooks/useMkInViewPort.d.ts +0 -14
- package/dist/hooks/useMkInViewPort.d.ts.map +0 -1
- package/dist/hooks/useMkInViewPort.js +0 -31
- package/dist/hooks/useMkInViewPort.js.map +0 -1
- package/dist/hooks/useMkInfiniteList.d.ts +0 -15
- package/dist/hooks/useMkInfiniteList.js +0 -47
- package/dist/hooks/useMkInfiniteList.js.map +0 -1
- package/dist/hooks/useMkList.js +0 -54
- package/dist/hooks/useMkList.js.map +0 -1
- package/dist/hooks/useMkLocalStorage.d.ts +0 -6
- package/dist/hooks/useMkLocalStorage.d.ts.map +0 -1
- package/dist/hooks/useMkLocalStorage.js +0 -33
- package/dist/hooks/useMkLocalStorage.js.map +0 -1
- package/dist/hooks/useMkLongPress.d.ts +0 -37
- package/dist/hooks/useMkLongPress.d.ts.map +0 -1
- package/dist/hooks/useMkLongPress.js +0 -59
- package/dist/hooks/useMkLongPress.js.map +0 -1
- package/dist/hooks/useMkMediaQuery.d.ts +0 -14
- package/dist/hooks/useMkMediaQuery.d.ts.map +0 -1
- package/dist/hooks/useMkMediaQuery.js +0 -31
- package/dist/hooks/useMkMediaQuery.js.map +0 -1
- package/dist/hooks/useMkPrevious.d.ts +0 -7
- package/dist/hooks/useMkPrevious.d.ts.map +0 -1
- package/dist/hooks/useMkPrevious.js +0 -14
- package/dist/hooks/useMkPrevious.js.map +0 -1
- package/dist/hooks/useMkScreenSize.d.ts +0 -25
- package/dist/hooks/useMkScreenSize.d.ts.map +0 -1
- package/dist/hooks/useMkScreenSize.js +0 -43
- package/dist/hooks/useMkScreenSize.js.map +0 -1
- package/dist/hooks/useMkStore.d.ts +0 -22
- package/dist/hooks/useMkStore.d.ts.map +0 -1
- package/dist/hooks/useMkStore.js +0 -58
- package/dist/hooks/useMkStore.js.map +0 -1
- package/dist/hooks/useMkToggle.d.ts +0 -6
- package/dist/hooks/useMkToggle.d.ts.map +0 -1
- package/dist/hooks/useMkToggle.js +0 -13
- package/dist/hooks/useMkToggle.js.map +0 -1
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -37
- package/dist/index.js.map +0 -1
- package/dist/styles/index.css +0 -124
- package/dist/test-setup.d.ts +0 -2
- package/dist/test-setup.d.ts.map +0 -1
- package/dist/test-setup.js +0 -2
- package/dist/test-setup.js.map +0 -1
- package/dist/theme/MkThemeProvider.d.ts +0 -20
- package/dist/utils/images.d.ts +0 -9
- package/dist/utils/images.d.ts.map +0 -1
- package/dist/utils/images.js +0 -50
- package/dist/utils/images.js.map +0 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# `@mk/eslint-plugin-mk`
|
|
2
|
+
|
|
3
|
+
> ESLint plugin that enforces the **MME rule (R-MK-001)** for
|
|
4
|
+
> JavaScript / TypeScript code in the `mk-director` monorepo and
|
|
5
|
+
> any downstream app that adopts `mk-director` modules.
|
|
6
|
+
>
|
|
7
|
+
> **Companion to** `mk:lint:boundaries` on the Laravel side. Both
|
|
8
|
+
> are required CI checks on `dev` of the `mk-director` monorepo
|
|
9
|
+
> (see [`../../BRANCH_PROTECTION.md`](../../BRANCH_PROTECTION.md)).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## The rule: `no-cross-module-import`
|
|
14
|
+
|
|
15
|
+
Forbids files inside `src/modules/<X>/` from importing deep paths
|
|
16
|
+
inside another module. Only `@/modules/<X>` (the public index) is
|
|
17
|
+
allowed.
|
|
18
|
+
|
|
19
|
+
| Import | Verdict |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `import { useAuth } from '@/modules/auth';` | OK — uses the public index |
|
|
22
|
+
| `import { PaymentForm } from '@/modules/payments/components/PaymentForm';` (file in `modules/payments/`) | OK — same module |
|
|
23
|
+
| `import { AdminForm } from '@/modules/admin/components/AdminForm';` (file in `modules/payments/`) | **Error** — deep cross-module import |
|
|
24
|
+
| `import { AdminListPage } from '@/modules/admin/pages/AdminListPage';` (file in `app/admin/page.tsx`) | OK — file is outside any module |
|
|
25
|
+
| `import { foo } from './useFoo';` | OK — relative import, ignored by the rule |
|
|
26
|
+
|
|
27
|
+
The error message is:
|
|
28
|
+
|
|
29
|
+
> Cross-module import is forbidden. Use '@/modules/<source>'
|
|
30
|
+
> public API instead. Got: '<imported>'.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
The plugin is shipped as a workspace entry of `@makroz/web` (and
|
|
37
|
+
re-exported by `@makroz/mobile`). Add it to your consuming app's
|
|
38
|
+
dependencies:
|
|
39
|
+
|
|
40
|
+
```jsonc
|
|
41
|
+
// package.json
|
|
42
|
+
{
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@makroz/web": "^1.1.0" // (or @makroz/mobile)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The `eslint-plugin-mk` sub-path is exported automatically:
|
|
50
|
+
|
|
51
|
+
```jsonc
|
|
52
|
+
// @makroz/web/package.json (excerpt)
|
|
53
|
+
"exports": {
|
|
54
|
+
"./eslint-plugin-mk": "./eslint-plugin-mk/index.js"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Activate (ESLint v9 flat config)
|
|
61
|
+
|
|
62
|
+
Add the plugin to your `eslint.config.js` (or `.mjs`):
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
// eslint.config.js
|
|
66
|
+
import mkPlugin from '@makroz/web/eslint-plugin-mk';
|
|
67
|
+
|
|
68
|
+
export default [
|
|
69
|
+
// ...your other config blocks...
|
|
70
|
+
{
|
|
71
|
+
files: ['src/modules/**/*.{ts,tsx}'],
|
|
72
|
+
plugins: {
|
|
73
|
+
'@mk': mkPlugin,
|
|
74
|
+
},
|
|
75
|
+
rules: {
|
|
76
|
+
'@mk/no-cross-module-import': 'error',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
> **The `files` glob must match the folders where your modules
|
|
83
|
+
> live.** In the `mk-director` monorepo, the glob is
|
|
84
|
+
> `{,apps/sandbox-web/,apps/sandbox-mobile/}src/modules/**/*.{ts,tsx}`
|
|
85
|
+
> so the rule fires whether `pnpm lint` is run from the root or
|
|
86
|
+
> from inside a sandbox app.
|
|
87
|
+
|
|
88
|
+
### Next.js (downstream)
|
|
89
|
+
|
|
90
|
+
For a Next.js 16 app generated by `create-mk-director`, the
|
|
91
|
+
template already wires this up — see
|
|
92
|
+
[`../../create-mk-director/src/templates/admin-nextjs/eslint.config.mjs`](../../create-mk-director/src/templates/admin-nextjs/eslint.config.mjs).
|
|
93
|
+
|
|
94
|
+
### React Native (downstream)
|
|
95
|
+
|
|
96
|
+
Use `@makroz/mobile/eslint-plugin-mk` instead. The mobile entry
|
|
97
|
+
re-exports the same rule with mobile-flavored metadata, so RN
|
|
98
|
+
consumers don't pull in React-specific types from `@makroz/web`.
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
// eslint.config.js (RN app)
|
|
102
|
+
import mkPlugin from '@makroz/mobile/eslint-plugin-mk';
|
|
103
|
+
// ...same activation as above
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Required CI check (mk-director monorepo)
|
|
109
|
+
|
|
110
|
+
`pnpm lint` at the root activates the rule. The job that
|
|
111
|
+
enforces it on `dev` is **`lint-eslint-mk-rule`** in
|
|
112
|
+
[`../../workflows/ci.yml`](../../workflows/ci.yml). The job
|
|
113
|
+
runs `pnpm install --frozen-lockfile` and then `pnpm lint`; any
|
|
114
|
+
deep cross-module import makes it fail with exit 1. The
|
|
115
|
+
corresponding branch-protection entry (status check name) is:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
🌳 MME: @mk/no-cross-module-import (R-MK-001, ESLint)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Escape hatch
|
|
124
|
+
|
|
125
|
+
If a deep import is truly needed (rare — usually a sign of a
|
|
126
|
+
missing public export), suppress on a per-line basis with a
|
|
127
|
+
justified comment:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
// eslint-disable-next-line @mk/no-cross-module-import
|
|
131
|
+
import { AdminForm } from '@/modules/admin/components/AdminForm';
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
> **Default in this monorepo**: every existing cross-module
|
|
135
|
+
> import is a code smell. Fix the public surface of the source
|
|
136
|
+
> module first, then re-export from its `index.ts`.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Test the rule
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pnpm --filter @makroz/web test
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Tests live in
|
|
147
|
+
[`__tests__/no-cross-module-import.test.js`](./__tests__/no-cross-module-import.test.js)
|
|
148
|
+
and use `vitest` + `eslint`'s `RuleTester`.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Layout
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
packages/mk-web/eslint-plugin-mk/
|
|
156
|
+
├── index.js # plugin entry (default export)
|
|
157
|
+
├── README.md # this file
|
|
158
|
+
├── rules/
|
|
159
|
+
│ └── no-cross-module-import.js # the rule
|
|
160
|
+
└── __tests__/
|
|
161
|
+
└── no-cross-module-import.test.js # 8 vitest cases
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The mobile re-export lives at
|
|
165
|
+
`packages/mk-mobile/eslint-plugin-mk/index.js` and is a thin
|
|
166
|
+
shim that re-exports the web plugin's rules under the
|
|
167
|
+
`@mk/eslint-plugin-mk (mobile)` metadata.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makroz/web",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "React UI components and hooks for MK-Director web applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -29,14 +29,19 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@tanstack/react-query": "^5.62.0",
|
|
32
|
-
"@makroz/core": "1.0
|
|
32
|
+
"@makroz/core": "1.1.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
+
"next": "^16.0.0",
|
|
35
36
|
"react": "19.2.3",
|
|
36
|
-
"react-dom": "19.2.3"
|
|
37
|
-
"next": "^16.0.0"
|
|
37
|
+
"react-dom": "19.2.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
41
|
+
"@storybook/nextjs": "^8.6.18",
|
|
42
|
+
"@storybook/react": "^8.6.18",
|
|
43
|
+
"@storybook/react-vite": "^8.6.18",
|
|
44
|
+
"@storybook/test-runner": "^0.21.3",
|
|
40
45
|
"@testing-library/jest-dom": "^6.9.1",
|
|
41
46
|
"@testing-library/react": "^16.0.0",
|
|
42
47
|
"@types/react": "19.2.3",
|
|
@@ -46,17 +51,24 @@
|
|
|
46
51
|
"jsdom": "^24.0.0",
|
|
47
52
|
"react": "^19.0.0",
|
|
48
53
|
"react-dom": "^19.0.0",
|
|
54
|
+
"storybook": "^8.6.18",
|
|
49
55
|
"typescript": "^5.7.0",
|
|
56
|
+
"vite": "^5.4.21",
|
|
50
57
|
"vitest": "^3.0.0"
|
|
51
58
|
},
|
|
52
59
|
"scripts": {
|
|
53
60
|
"build": "tsc && rm -f dist/**/*.test.* && cp -r src/components/*.css dist/components/ && cp -r src/styles dist/",
|
|
54
61
|
"lint": "eslint src/",
|
|
55
62
|
"lint:fix": "eslint src/ --fix",
|
|
63
|
+
"lint:stories": "node scripts/lint-stories.mjs",
|
|
64
|
+
"lint:stories:json": "node scripts/lint-stories.mjs --json",
|
|
56
65
|
"test": "vitest run",
|
|
57
66
|
"test:watch": "vitest",
|
|
58
67
|
"test:coverage": "vitest run --coverage",
|
|
59
68
|
"type-check": "tsc --noEmit",
|
|
60
|
-
"clean": "rm -rf dist"
|
|
69
|
+
"clean": "rm -rf dist",
|
|
70
|
+
"storybook": "storybook dev -p 6006",
|
|
71
|
+
"build-storybook": "storybook build",
|
|
72
|
+
"test:storybook": "test-storybook --url http://localhost:6006"
|
|
61
73
|
}
|
|
62
74
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { AdminDto } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Shape of the value exposed by `<MkAuthProvider>`.
|
|
4
|
-
*
|
|
5
|
-
* The provider is intentionally minimal: it only knows about the
|
|
6
|
-
* current scope, the cached `user`, and the auth lifecycle (`login`,
|
|
7
|
-
* `logout`, `refresh`, `hasAbility`). Token persistence is internal —
|
|
8
|
-
* callers never see the raw tokens, only the boolean/typed results.
|
|
9
|
-
*/
|
|
10
|
-
export interface MkAuthContextValue {
|
|
11
|
-
/** The currently authenticated admin, or `null` if signed out. */
|
|
12
|
-
user: AdminDto | null;
|
|
13
|
-
/** True once the provider has completed its initial bootstrap (me/refresh). */
|
|
14
|
-
isLoading: boolean;
|
|
15
|
-
/** True iff `user !== null`. */
|
|
16
|
-
isAuthenticated: boolean;
|
|
17
|
-
/** Last error from login/refresh, cleared on the next successful call. */
|
|
18
|
-
error: Error | null;
|
|
19
|
-
/**
|
|
20
|
-
* Exchange email + password for tokens, persist them, and set `user`.
|
|
21
|
-
* On failure throws — the form catches and renders the error inline.
|
|
22
|
-
*/
|
|
23
|
-
login: (email: string, password: string) => Promise<AdminDto>;
|
|
24
|
-
/**
|
|
25
|
-
* Hit the logout endpoint, clear the local cache, drop `user`.
|
|
26
|
-
* Best-effort: even if the network call fails, the local state is cleared.
|
|
27
|
-
*/
|
|
28
|
-
logout: () => Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Manually trigger a token refresh and re-fetch the current user.
|
|
31
|
-
* Mostly used internally on mount, but exposed so consumers can
|
|
32
|
-
* force-refresh after a permission change, for example.
|
|
33
|
-
*/
|
|
34
|
-
refresh: () => Promise<AdminDto | null>;
|
|
35
|
-
/**
|
|
36
|
-
* True iff the current user's `abilities` array contains `ability`
|
|
37
|
-
* (exact match). The backend may return wildcard scopes in the
|
|
38
|
-
* future; for now it's a plain array of strings.
|
|
39
|
-
*/
|
|
40
|
-
hasAbility: (ability: string) => boolean;
|
|
41
|
-
}
|
|
42
|
-
export declare const MkAuthContext: import("react").Context<MkAuthContextValue | undefined>;
|
|
43
|
-
//# sourceMappingURL=MkAuthContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MkAuthContext.d.ts","sourceRoot":"","sources":["../../src/auth/MkAuthContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IAC/B,kEAAkE;IAClE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,+EAA+E;IAC/E,SAAS,EAAE,OAAO,CAAC;IACnB,gCAAgC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,0EAA0E;IAC1E,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9D;;;OAGG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;;OAIG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAExC;;;;OAIG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C;AAED,eAAO,MAAM,aAAa,yDAA2D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MkAuthContext.js","sourceRoot":"","sources":["../../src/auth/MkAuthContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAgDtC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export interface MkAuthFormProps {
|
|
2
|
-
/** Auth scope to use, e.g. "admin", "member", "guard". */
|
|
3
|
-
scope: string;
|
|
4
|
-
/**
|
|
5
|
-
* Path to navigate to after a successful login. Defaults to
|
|
6
|
-
* `/{scope}/dashboard`. Use a fully qualified path or a relative one
|
|
7
|
-
* — this component only triggers a callback.
|
|
8
|
-
*/
|
|
9
|
-
redirectAfterLogin?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Show a "¿Olvidaste tu contraseña?" link below the submit button.
|
|
12
|
-
* Defaults to `true`.
|
|
13
|
-
*/
|
|
14
|
-
showForgotPassword?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Optional: invoked after a successful login. Receives the resolved
|
|
17
|
-
* `AdminDto` and the `redirectAfterLogin` value so the host can do
|
|
18
|
-
* `router.push(...)` with its own router. When omitted, the
|
|
19
|
-
* component only logs the success.
|
|
20
|
-
*/
|
|
21
|
-
onLoginSuccess?: (admin: {
|
|
22
|
-
id: string;
|
|
23
|
-
email: string;
|
|
24
|
-
}, redirectTo: string) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Optional: invoked when the user clicks the forgot-password link.
|
|
27
|
-
* When omitted, the link is rendered as a plain `<a href="/{scope}/forgot">`
|
|
28
|
-
* — sufficient for any routing setup.
|
|
29
|
-
*/
|
|
30
|
-
onForgotPassword?: () => void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Minimal, dependency-free login form. Renders email + password fields,
|
|
34
|
-
* a submit button, an inline error region, and an optional
|
|
35
|
-
* "¿Olvidaste tu contraseña?" link.
|
|
36
|
-
*
|
|
37
|
-
* Validation is intentionally simple (non-empty + email shape) — the
|
|
38
|
-
* server is the source of truth, and this keeps the component focused
|
|
39
|
-
* on the auth lifecycle.
|
|
40
|
-
*/
|
|
41
|
-
export declare function MkAuthForm({ scope, redirectAfterLogin, showForgotPassword, onLoginSuccess, onForgotPassword, }: MkAuthFormProps): React.JSX.Element;
|
|
42
|
-
//# sourceMappingURL=MkAuthForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MkAuthForm.d.ts","sourceRoot":"","sources":["../../src/auth/MkAuthForm.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC5B,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACpF;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAOD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,kBAAkB,EAClB,kBAAyB,EACzB,cAAc,EACd,gBAAgB,GACnB,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAqIrC"}
|
package/dist/auth/MkAuthForm.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useCallback, useMemo } from 'react';
|
|
4
|
-
import { useMkAuth } from './useMkAuth';
|
|
5
|
-
import { MkInput } from '../components/MkInput';
|
|
6
|
-
import { MkButton } from '../components/MkButton';
|
|
7
|
-
/**
|
|
8
|
-
* Minimal, dependency-free login form. Renders email + password fields,
|
|
9
|
-
* a submit button, an inline error region, and an optional
|
|
10
|
-
* "¿Olvidaste tu contraseña?" link.
|
|
11
|
-
*
|
|
12
|
-
* Validation is intentionally simple (non-empty + email shape) — the
|
|
13
|
-
* server is the source of truth, and this keeps the component focused
|
|
14
|
-
* on the auth lifecycle.
|
|
15
|
-
*/
|
|
16
|
-
export function MkAuthForm({ scope, redirectAfterLogin, showForgotPassword = true, onLoginSuccess, onForgotPassword, }) {
|
|
17
|
-
const { login, error, isLoading } = useMkAuth();
|
|
18
|
-
const [state, setState] = useState({ email: '', password: '' });
|
|
19
|
-
const [submitting, setSubmitting] = useState(false);
|
|
20
|
-
const target = useMemo(() => redirectAfterLogin !== null && redirectAfterLogin !== void 0 ? redirectAfterLogin : `/${scope}/dashboard`, [redirectAfterLogin, scope]);
|
|
21
|
-
const handleChange = useCallback((field) => (value) => {
|
|
22
|
-
setState((prev) => (Object.assign(Object.assign({}, prev), { [field]: value })));
|
|
23
|
-
}, []);
|
|
24
|
-
const handleSubmit = useCallback((e) => {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
if (submitting || isLoading)
|
|
27
|
-
return;
|
|
28
|
-
setSubmitting(true);
|
|
29
|
-
// Error is surfaced via `error` from `useMkAuth`; we just need to
|
|
30
|
-
// reset submitting on completion.
|
|
31
|
-
void login(state.email.trim(), state.password)
|
|
32
|
-
.then((admin) => onLoginSuccess === null || onLoginSuccess === void 0 ? void 0 : onLoginSuccess({ id: admin.id, email: admin.email }, target))
|
|
33
|
-
.finally(() => setSubmitting(false));
|
|
34
|
-
}, [submitting, isLoading, login, state.email, state.password, onLoginSuccess, target]);
|
|
35
|
-
// `MkInput` calls `onChange(value: string)`; we forward to our state
|
|
36
|
-
// setter. We don't pass the native event through because the existing
|
|
37
|
-
// `MkInput` signature strips it.
|
|
38
|
-
const onEmailChange = useCallback((v) => handleChange('email')(v), [handleChange]);
|
|
39
|
-
const onPasswordChange = useCallback((v) => handleChange('password')(v), [handleChange]);
|
|
40
|
-
const errorMessage = error ? error.message : null;
|
|
41
|
-
return (_jsxs("form", { "data-mk-auth-scope": scope, onSubmit: handleSubmit, noValidate: true, "aria-busy": submitting || isLoading, style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [_jsxs("div", { children: [_jsx("label", { htmlFor: `${scope}-email`, children: "Email" }), _jsx(MkInput, { id: `${scope}-email`, name: "email", type: "email", autoComplete: "email", required: true, value: state.email, onChange: onEmailChange, disabled: submitting || isLoading, placeholder: "admin@example.com" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: `${scope}-password`, children: "Contrase\u00F1a" }), _jsx(MkInput, { id: `${scope}-password`, name: "password", type: "password", autoComplete: "current-password", required: true, value: state.password, onChange: onPasswordChange, disabled: submitting || isLoading })] }), errorMessage ? (_jsx("div", { role: "alert", "data-mk-auth-error": true, style: {
|
|
42
|
-
color: 'var(--mk-color-error, #d32f2f)',
|
|
43
|
-
fontSize: 14,
|
|
44
|
-
}, children: errorMessage })) : null, _jsx(MkButton, { type: "submit", variant: "primary", loading: submitting || isLoading, disabled: submitting || isLoading || !state.email || !state.password, children: "Iniciar sesi\u00F3n" }), showForgotPassword ? (_jsx("div", { style: { fontSize: 14, textAlign: 'center' }, children: onForgotPassword ? (_jsx("button", { type: "button", onClick: onForgotPassword, style: {
|
|
45
|
-
background: 'none',
|
|
46
|
-
border: 'none',
|
|
47
|
-
color: 'var(--mk-color-primary, #1976d2)',
|
|
48
|
-
cursor: 'pointer',
|
|
49
|
-
padding: 0,
|
|
50
|
-
textDecoration: 'underline',
|
|
51
|
-
}, children: "\u00BFOlvidaste tu contrase\u00F1a?" })) : (_jsx("a", { href: `/${scope}/forgot`, style: { color: 'var(--mk-color-primary, #1976d2)' }, children: "\u00BFOlvidaste tu contrase\u00F1a?" })) })) : null] }));
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=MkAuthForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MkAuthForm.js","sourceRoot":"","sources":["../../src/auth/MkAuthForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAA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E,kCAAkC;wBACzC,MAAM,EAAE,SAAS;wBACjB,OAAO,EAAE,CAAC;wBACV,cAAc,EAAE,WAAW;qBAC9B,oDAGI,CACZ,CAAC,CAAC,CAAC,CACA,YACI,IAAI,EAAE,IAAI,KAAK,SAAS,EACxB,KAAK,EAAE,EAAE,KAAK,EAAE,kCAAkC,EAAE,oDAGpD,CACP,GACC,CACT,CAAC,CAAC,CAAC,IAAI,IACL,CACV,CAAC;AACN,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { AuthStorageAdapter } from './types';
|
|
3
|
-
export interface MkAuthProviderProps {
|
|
4
|
-
/** Logical scope of this provider, e.g. "admin", "member", "guard". */
|
|
5
|
-
scope: string;
|
|
6
|
-
/**
|
|
7
|
-
* Base URL of the API. The provider appends `/api/${scope}/auth/...`
|
|
8
|
-
* to it. Trailing slashes are tolerated.
|
|
9
|
-
*/
|
|
10
|
-
apiBaseUrl: string;
|
|
11
|
-
/** Children wrapped by the provider. */
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Optional storage adapter. Defaults to `window.localStorage` when
|
|
15
|
-
* available. Tests pass an in-memory adapter.
|
|
16
|
-
*/
|
|
17
|
-
storage?: AuthStorageAdapter;
|
|
18
|
-
/**
|
|
19
|
-
* Optional: inject a custom `fetch` implementation (e.g. for tests
|
|
20
|
-
* that polyfill `global.fetch` differently). Defaults to `globalThis.fetch`.
|
|
21
|
-
*/
|
|
22
|
-
fetcher?: typeof fetch;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* `<QueryClientProvider>` + `<MkAuthProviderInner>`. The outer wrapper
|
|
26
|
-
* exists so consumers don't have to remember to also mount a
|
|
27
|
-
* `QueryClient` — the auth provider is self-contained.
|
|
28
|
-
*/
|
|
29
|
-
export declare function MkAuthProvider(props: MkAuthProviderProps): React.JSX.Element;
|
|
30
|
-
//# sourceMappingURL=MkAuthProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MkAuthProvider.d.ts","sourceRoot":"","sources":["../../src/auth/MkAuthProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,OAAO,KAAK,EAER,kBAAkB,EAKrB,MAAM,SAAS,CAAC;AAmBjB,MAAM,WAAW,mBAAmB;IAChC,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAwSD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAkB5E"}
|