@mantis-core/ui 0.1.2 → 0.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/COMPONENTS.md +15 -142
- package/LICENSE +21 -0
- package/PRIMEREACT_MAPPING.md +6 -0
- package/README.md +56 -72
- package/dist/components/Forms/AsyncSelect.d.ts +20 -0
- package/dist/components/Forms/AsyncSelect.d.ts.map +1 -0
- package/dist/components/Forms/AsyncSelect.js +77 -0
- package/dist/components/Forms/AsyncSelect.js.map +1 -0
- package/dist/components/Forms/DirtyFormGuard.d.ts +5 -0
- package/dist/components/Forms/DirtyFormGuard.d.ts.map +1 -0
- package/dist/components/Forms/DirtyFormGuard.js +8 -0
- package/dist/components/Forms/DirtyFormGuard.js.map +1 -0
- package/dist/components/Forms/FileDropzone.d.ts +29 -0
- package/dist/components/Forms/FileDropzone.d.ts.map +1 -0
- package/dist/components/Forms/FileDropzone.js +137 -0
- package/dist/components/Forms/FileDropzone.js.map +1 -0
- package/dist/components/Forms/FormActionsBar.d.ts +26 -0
- package/dist/components/Forms/FormActionsBar.d.ts.map +1 -0
- package/dist/components/Forms/FormActionsBar.js +16 -0
- package/dist/components/Forms/FormActionsBar.js.map +1 -0
- package/dist/components/Forms/Select.d.ts +3 -0
- package/dist/components/Forms/Select.d.ts.map +1 -1
- package/dist/components/Forms/Select.js +12 -3
- package/dist/components/Forms/Select.js.map +1 -1
- package/dist/components/Forms/useDirtyFormGuard.d.ts +12 -0
- package/dist/components/Forms/useDirtyFormGuard.d.ts.map +1 -0
- package/dist/components/Forms/useDirtyFormGuard.js +36 -0
- package/dist/components/Forms/useDirtyFormGuard.js.map +1 -0
- package/dist/components/ui/ConfirmDialog.d.ts +19 -0
- package/dist/components/ui/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/ui/ConfirmDialog.js +20 -0
- package/dist/components/ui/ConfirmDialog.js.map +1 -0
- package/dist/components/ui/DataState.d.ts +20 -0
- package/dist/components/ui/DataState.d.ts.map +1 -0
- package/dist/components/ui/DataState.js +30 -0
- package/dist/components/ui/DataState.js.map +1 -0
- package/dist/components/ui/Pagination.js +1 -1
- package/dist/components/ui/Pagination.js.map +1 -1
- package/dist/components/ui/StatusBadge.d.ts +12 -0
- package/dist/components/ui/StatusBadge.d.ts.map +1 -0
- package/dist/components/ui/StatusBadge.js +19 -0
- package/dist/components/ui/StatusBadge.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/docs/README.md +72 -0
- package/docs/components/action-column.md +17 -0
- package/docs/components/admin-page-header.md +21 -0
- package/docs/components/admin-page-layout.md +29 -0
- package/docs/components/async-select.md +26 -0
- package/docs/components/button.md +25 -0
- package/docs/components/ckeditor-input.md +24 -0
- package/docs/components/confirm-dialog.md +21 -0
- package/docs/components/data-state.md +19 -0
- package/docs/components/date-input.md +22 -0
- package/docs/components/dirty-form-guard.md +31 -0
- package/docs/components/drop-down.md +28 -0
- package/docs/components/error-message.md +13 -0
- package/docs/components/file-dropzone.md +25 -0
- package/docs/components/filter-pannel.md +23 -0
- package/docs/components/form-actions-bar.md +22 -0
- package/docs/components/form-field-render.md +20 -0
- package/docs/components/form-section.md +15 -0
- package/docs/components/hidden-field.md +19 -0
- package/docs/components/index-column.md +13 -0
- package/docs/components/loading.md +21 -0
- package/docs/components/map-picker-client.md +22 -0
- package/docs/components/map-picker-osm.md +18 -0
- package/docs/components/map-picker.md +21 -0
- package/docs/components/menu-button.md +22 -0
- package/docs/components/multi-select-filter.md +20 -0
- package/docs/components/multi-select.md +23 -0
- package/docs/components/number-input.md +20 -0
- package/docs/components/page-title.md +13 -0
- package/docs/components/paginated-table.md +35 -0
- package/docs/components/pagination.md +27 -0
- package/docs/components/render-field.md +24 -0
- package/docs/components/rich-text-preview.md +18 -0
- package/docs/components/select.md +28 -0
- package/docs/components/status-badge.md +14 -0
- package/docs/components/switch.md +27 -0
- package/docs/components/table-filter-field.md +21 -0
- package/docs/components/table-toolbar.md +19 -0
- package/docs/components/text-area.md +20 -0
- package/docs/components/text-input.md +23 -0
- package/docs/components/time-picker.md +22 -0
- package/docs/components/toggle-inline-button.md +22 -0
- package/docs/components/toggle.md +21 -0
- package/docs/components/upload-files-preview.md +26 -0
- package/docs/contracts/controller-props.md +28 -0
- package/docs/contracts/dependency-map.md +57 -0
- package/docs/contracts/style-imports.md +27 -0
- package/package.json +14 -7
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as MultiSelect } from "./components/Forms/MultiSelect";
|
|
|
10
10
|
export { default as NumberInput } from "./components/Forms/NumberInput";
|
|
11
11
|
export { default as RenderField } from "./components/Forms/RenderField";
|
|
12
12
|
export { default as Select } from "./components/Forms/Select";
|
|
13
|
+
export { default as AsyncSelect } from "./components/Forms/AsyncSelect";
|
|
13
14
|
export { default as Switch } from "./components/Forms/Switch";
|
|
14
15
|
export { default as TextArea } from "./components/Forms/TextArea";
|
|
15
16
|
export { default as TextInput } from "./components/Forms/TextInput";
|
|
@@ -17,6 +18,10 @@ export { default as TimePicker } from "./components/Forms/TimePicker";
|
|
|
17
18
|
export { default as Toggle } from "./components/Forms/Toggle";
|
|
18
19
|
export { default as ToggleInlineButton } from "./components/Forms/ToggleInlineButton";
|
|
19
20
|
export { default as UploadFilesPreview } from "./components/Forms/UploadFilesPreview";
|
|
21
|
+
export { default as FileDropzone } from "./components/Forms/FileDropzone";
|
|
22
|
+
export { default as FormActionsBar } from "./components/Forms/FormActionsBar";
|
|
23
|
+
export { default as DirtyFormGuard } from "./components/Forms/DirtyFormGuard";
|
|
24
|
+
export { default as useDirtyFormGuard } from "./components/Forms/useDirtyFormGuard";
|
|
20
25
|
export { default as TableToolbar } from "./components/table-toolbar";
|
|
21
26
|
export { default as TableFilterField } from "./components/table-filter-field";
|
|
22
27
|
export { default as ActionColumn } from "./components/Tables/ActionColumn";
|
|
@@ -33,6 +38,9 @@ export { AdminPageLayoutProvider, useAdminPageLayout } from "./components/pages/
|
|
|
33
38
|
export { default as AdminPageLayoutShell } from "./components/pages/admin-layout/AdminPageLayoutShell";
|
|
34
39
|
export { Pagination, PaginationInfo, PageSizeSelector } from "./components/ui/Pagination";
|
|
35
40
|
export { default as RichTextPreview } from "./components/ui/RichTextPreview";
|
|
41
|
+
export { default as StatusBadge } from "./components/ui/StatusBadge";
|
|
42
|
+
export { default as DataState } from "./components/ui/DataState";
|
|
43
|
+
export { default as ConfirmDialog } from "./components/ui/ConfirmDialog";
|
|
36
44
|
export { default as MapPicker } from "./components/Maps/MapPicker";
|
|
37
45
|
export { default as MapPickerClient } from "./components/Maps/MapPickerClient";
|
|
38
46
|
export { default as MapPickerOSM } from "./components/Maps/MapPickerOSM";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAGlE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAG5E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGpE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGhF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGxE,OAAO,EAAE,O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folder contains focused documentation files intended for direct human lookup and efficient LLM retrieval.
|
|
4
|
+
|
|
5
|
+
## Contracts
|
|
6
|
+
|
|
7
|
+
- [Controller props](./contracts/controller-props.md)
|
|
8
|
+
- [Underlying library map](./contracts/dependency-map.md)
|
|
9
|
+
- [Style import guide](./contracts/style-imports.md)
|
|
10
|
+
|
|
11
|
+
## Components
|
|
12
|
+
|
|
13
|
+
### Buttons and loaders
|
|
14
|
+
|
|
15
|
+
- [Button](./components/button.md)
|
|
16
|
+
- [Loading](./components/loading.md)
|
|
17
|
+
|
|
18
|
+
### Forms
|
|
19
|
+
|
|
20
|
+
- [TextInput](./components/text-input.md)
|
|
21
|
+
- [TextArea](./components/text-area.md)
|
|
22
|
+
- [NumberInput](./components/number-input.md)
|
|
23
|
+
- [DateInput](./components/date-input.md)
|
|
24
|
+
- [DropDown](./components/drop-down.md)
|
|
25
|
+
- [MultiSelect](./components/multi-select.md)
|
|
26
|
+
- [Select](./components/select.md)
|
|
27
|
+
- [AsyncSelect](./components/async-select.md)
|
|
28
|
+
- [CKEditorInput](./components/ckeditor-input.md)
|
|
29
|
+
- [TimePicker](./components/time-picker.md)
|
|
30
|
+
- [Switch](./components/switch.md)
|
|
31
|
+
- [Toggle](./components/toggle.md)
|
|
32
|
+
- [ToggleInlineButton](./components/toggle-inline-button.md)
|
|
33
|
+
- [FileDropzone](./components/file-dropzone.md)
|
|
34
|
+
- [UploadFilesPreview](./components/upload-files-preview.md)
|
|
35
|
+
- [FormActionsBar](./components/form-actions-bar.md)
|
|
36
|
+
- [FormFieldRender](./components/form-field-render.md)
|
|
37
|
+
- [RenderField](./components/render-field.md)
|
|
38
|
+
- [ErrorMessage](./components/error-message.md)
|
|
39
|
+
- [HiddenField](./components/hidden-field.md)
|
|
40
|
+
- [DirtyFormGuard and useDirtyFormGuard](./components/dirty-form-guard.md)
|
|
41
|
+
|
|
42
|
+
### Tables
|
|
43
|
+
|
|
44
|
+
- [TableToolbar](./components/table-toolbar.md)
|
|
45
|
+
- [TableFilterField](./components/table-filter-field.md)
|
|
46
|
+
- [PaginatedTable](./components/paginated-table.md)
|
|
47
|
+
- [ActionColumn](./components/action-column.md)
|
|
48
|
+
- [MenuButton](./components/menu-button.md)
|
|
49
|
+
- [FilterPannel](./components/filter-pannel.md)
|
|
50
|
+
- [MultiSelectFilter](./components/multi-select-filter.md)
|
|
51
|
+
- [IndexColumn](./components/index-column.md)
|
|
52
|
+
|
|
53
|
+
### Page and layout
|
|
54
|
+
|
|
55
|
+
- [PageTitle](./components/page-title.md)
|
|
56
|
+
- [FormSection](./components/form-section.md)
|
|
57
|
+
- [AdminPageHeader](./components/admin-page-header.md)
|
|
58
|
+
- [Admin page layout](./components/admin-page-layout.md)
|
|
59
|
+
|
|
60
|
+
### Generic UI
|
|
61
|
+
|
|
62
|
+
- [Pagination, PaginationInfo, PageSizeSelector](./components/pagination.md)
|
|
63
|
+
- [RichTextPreview](./components/rich-text-preview.md)
|
|
64
|
+
- [StatusBadge](./components/status-badge.md)
|
|
65
|
+
- [DataState](./components/data-state.md)
|
|
66
|
+
- [ConfirmDialog](./components/confirm-dialog.md)
|
|
67
|
+
|
|
68
|
+
### Maps
|
|
69
|
+
|
|
70
|
+
- [MapPicker](./components/map-picker.md)
|
|
71
|
+
- [MapPickerClient](./components/map-picker-client.md)
|
|
72
|
+
- [MapPickerOSM](./components/map-picker-osm.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ActionColumn
|
|
2
|
+
|
|
3
|
+
- Export: `ActionColumn`
|
|
4
|
+
- Extra exports: `ActionColumnProps`
|
|
5
|
+
- Import: `import { ActionColumn } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/column`
|
|
7
|
+
- Base typing: `ColumnProps & { label?: string; icon?: string }`
|
|
8
|
+
- Required styles: usually `@mantis-core/styles/scss/table.scss` through table context
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
{ActionColumn(
|
|
14
|
+
(row) => [{ label: "Open", route: `/admin/items/${row.id}` }],
|
|
15
|
+
{ label: "Actions" },
|
|
16
|
+
)}
|
|
17
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# AdminPageHeader
|
|
2
|
+
|
|
3
|
+
- Export: `AdminPageHeader`
|
|
4
|
+
- Import: `import { AdminPageHeader } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: custom header + `next/link`
|
|
6
|
+
- Base typing: `{ title: string; description?: string; actions?: ReactNode; breadcrumbs?: readonly AdminBreadcrumbItem[] }`
|
|
7
|
+
- Required styles: none
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<AdminPageHeader
|
|
13
|
+
title="Clients"
|
|
14
|
+
description="Manage B2B accounts"
|
|
15
|
+
breadcrumbs={[
|
|
16
|
+
{ label: "Dashboard", href: "/admin" },
|
|
17
|
+
{ label: "Clients" },
|
|
18
|
+
]}
|
|
19
|
+
actions={<Button label="New client" icon="pi pi-plus" />}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Admin Page Layout
|
|
2
|
+
|
|
3
|
+
- Exports:
|
|
4
|
+
- `AdminPageLayoutProvider`
|
|
5
|
+
- `useAdminPageLayout`
|
|
6
|
+
- `AdminPageConfigurator`
|
|
7
|
+
- `AdminPageLayoutShell`
|
|
8
|
+
- `AdminBreadcrumbItem`
|
|
9
|
+
- `AdminPageLayoutConfig`
|
|
10
|
+
- Import: `import { AdminPageLayoutProvider, AdminPageConfigurator, AdminPageLayoutShell } from "@mantis-core/ui";`
|
|
11
|
+
- Base library: React context + custom shell
|
|
12
|
+
- Required styles: none
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
<AdminPageLayoutProvider>
|
|
18
|
+
<AdminPageLayoutShell>
|
|
19
|
+
<AdminPageConfigurator config={{ title: "Leads" }}>
|
|
20
|
+
<LeadsTable />
|
|
21
|
+
</AdminPageConfigurator>
|
|
22
|
+
</AdminPageLayoutShell>
|
|
23
|
+
</AdminPageLayoutProvider>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
- `useAdminPageLayout` must run inside `AdminPageLayoutProvider`.
|
|
29
|
+
- `AdminPageLayoutShell` renders `AdminPageHeader` when `config.title` exists and `hideHeader` is not set.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# AsyncSelect
|
|
2
|
+
|
|
3
|
+
- Export: `AsyncSelect`
|
|
4
|
+
- Extra exports: `AsyncSelectProps`
|
|
5
|
+
- Import: `import { AsyncSelect } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `react-select/async` or `react-select/async-creatable`
|
|
7
|
+
- Base typing: `Omit<ReactSelectProps<SelectOption>, "name" | "defaultValue" | "options"> & { controller: ControllerProps; block?: boolean; variant?: ButtonVariant; isCreatable?: boolean; loadOptions; defaultOptions?; cacheOptions?; debounceMs?; onCreateOption?; formatCreateLabel? }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: `@mantis-core/styles/scss/select.scss`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<AsyncSelect
|
|
15
|
+
controller={{ name: "city", control: form.control }}
|
|
16
|
+
block
|
|
17
|
+
loadOptions={async (input) => searchCities(input)}
|
|
18
|
+
defaultOptions
|
|
19
|
+
debounceMs={300}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
|
|
25
|
+
- `loadOptions` is required.
|
|
26
|
+
- Debouncing is implemented inside the wrapper.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
- Export: `Button`
|
|
4
|
+
- Import: `import { Button } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `primereact/button`
|
|
6
|
+
- Base typing: `Omit<PrimeButtonProps, "onClick" | "ref">` plus `href`, `variant`, `block`, `sm`, `lg`, `outlined`, `text`, `rounded`
|
|
7
|
+
- Required styles: `@mantis-core/styles/scss/buttons.scss`
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Button
|
|
13
|
+
label="Save"
|
|
14
|
+
icon="pi pi-check"
|
|
15
|
+
variant="primary"
|
|
16
|
+
rounded
|
|
17
|
+
onClick={() => console.log("saved")}
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
|
|
23
|
+
- PrimeReact props still pass through.
|
|
24
|
+
- `href` triggers client navigation with `next/navigation`.
|
|
25
|
+
- `ButtonVariant` accepts `danger`, but the tokenized SCSS loop is defined around `error`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# CKEditorInput
|
|
2
|
+
|
|
3
|
+
- Export: `CKEditorInput`
|
|
4
|
+
- Extra exports: `CKEditorInputProps`, `CKEditorContentMetrics`
|
|
5
|
+
- Import: `import { CKEditorInput } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `@ckeditor/ckeditor5-react` + `ckeditor5`
|
|
7
|
+
- Base typing: explicit `CKEditorInputProps`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: `@mantis-core/styles/scss/ckeditor.scss`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<CKEditorInput
|
|
15
|
+
controller={{ name: "body", control: form.control }}
|
|
16
|
+
minHeight="20rem"
|
|
17
|
+
showStats
|
|
18
|
+
onMetricsChange={(metrics) => console.log(metrics.words)}
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
|
|
24
|
+
- This wrapper adds metrics, presets, and optional non-empty HTML validation on top of CKEditor.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ConfirmDialog
|
|
2
|
+
|
|
3
|
+
- Export: `ConfirmDialog`
|
|
4
|
+
- Extra exports: `ConfirmDialogProps`, `ConfirmDialogSeverity`
|
|
5
|
+
- Import: `import { ConfirmDialog } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/dialog`
|
|
7
|
+
- Base typing: explicit `ConfirmDialogProps`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/confirm-dialog.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<ConfirmDialog
|
|
14
|
+
visible={open}
|
|
15
|
+
title="Delete listing"
|
|
16
|
+
message="This action cannot be undone."
|
|
17
|
+
confirmSeverity="danger"
|
|
18
|
+
onConfirm={handleDelete}
|
|
19
|
+
onCancel={() => setOpen(false)}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# DataState
|
|
2
|
+
|
|
3
|
+
- Export: `DataState`
|
|
4
|
+
- Extra exports: `DataStateProps`, `DataStateStatus`
|
|
5
|
+
- Import: `import { DataState } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom state wrapper + `Button`
|
|
7
|
+
- Base typing: explicit `DataStateProps`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/data-state.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<DataState
|
|
14
|
+
status={query.isError ? "error" : query.isLoading ? "loading" : rows.length === 0 ? "empty" : "ready"}
|
|
15
|
+
onRetry={() => query.refetch()}
|
|
16
|
+
>
|
|
17
|
+
<PaginatedTable value={rows}>{/* columns */}</PaginatedTable>
|
|
18
|
+
</DataState>
|
|
19
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# DateInput
|
|
2
|
+
|
|
3
|
+
- Export: `DateInput`
|
|
4
|
+
- Extra exports: `DateInputProps`
|
|
5
|
+
- Import: `import { DateInput } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/calendar`
|
|
7
|
+
- Base typing: `Omit<CalendarProps, "name" | "defaultValue"> & { controller: ControllerProps; block?: boolean }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles:
|
|
10
|
+
- `@mantis-core/styles/scss/inputs.scss`
|
|
11
|
+
- `@mantis-core/styles/scss/date-picker.scss`
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<DateInput
|
|
17
|
+
controller={{ name: "publishAt", control: form.control }}
|
|
18
|
+
block
|
|
19
|
+
showIcon
|
|
20
|
+
dateFormat="yy-mm-dd"
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# DirtyFormGuard and useDirtyFormGuard
|
|
2
|
+
|
|
3
|
+
- Exports: `DirtyFormGuard`, `useDirtyFormGuard`
|
|
4
|
+
- Extra exports: `DirtyFormGuardProps`, `UseDirtyFormGuardOptions`, `UseDirtyFormGuardResult`
|
|
5
|
+
- Base library: browser `beforeunload` + `window.confirm`
|
|
6
|
+
- Required styles: none
|
|
7
|
+
|
|
8
|
+
## Component example
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
<DirtyFormGuard
|
|
12
|
+
isDirty={form.formState.isDirty}
|
|
13
|
+
message="You have unsaved changes."
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Hook example
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
const guard = useDirtyFormGuard({
|
|
21
|
+
isDirty: form.formState.isDirty,
|
|
22
|
+
message: "Leave without saving?",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
void guard.confirmIfDirty(async () => router.push("/admin"));
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Notes
|
|
29
|
+
|
|
30
|
+
- Use the component for declarative page guards.
|
|
31
|
+
- Use the hook when you need to wrap specific navigation or destructive actions.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# DropDown
|
|
2
|
+
|
|
3
|
+
- Export: `DropDown`
|
|
4
|
+
- Extra exports: `DropDownProps`
|
|
5
|
+
- Import: `import { DropDown } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/dropdown`
|
|
7
|
+
- Base typing: `Omit<DropdownProps, "name" | "defaultValue"> & { controller: ControllerProps; block?: boolean }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: `@mantis-core/styles/scss/inputs.scss`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<DropDown
|
|
15
|
+
controller={{ name: "status", control: form.control }}
|
|
16
|
+
block
|
|
17
|
+
options={[
|
|
18
|
+
{ label: "Draft", value: "draft" },
|
|
19
|
+
{ label: "Published", value: "published" },
|
|
20
|
+
]}
|
|
21
|
+
optionLabel="label"
|
|
22
|
+
optionValue="value"
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
|
|
28
|
+
- This is the PrimeReact dropdown wrapper, not the `react-select` wrapper.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# ErrorMessage
|
|
2
|
+
|
|
3
|
+
- Export: `ErrorMessage`
|
|
4
|
+
- Import: `import { ErrorMessage } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `@hookform/error-message`
|
|
6
|
+
- Base typing: wrapper export around hook-form error rendering
|
|
7
|
+
- Required styles: none
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<ErrorMessage errors={form.formState.errors} name="title" />
|
|
13
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# FileDropzone
|
|
2
|
+
|
|
3
|
+
- Export: `FileDropzone`
|
|
4
|
+
- Extra exports: `FileDropzoneProps`, `FileDropzoneRejectedFile`, `FileDropzoneRejectCode`
|
|
5
|
+
- Import: `import { FileDropzone } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom drag-and-drop file input
|
|
7
|
+
- Base typing: explicit `FileDropzoneProps`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/file-dropzone.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<FileDropzone
|
|
14
|
+
controller={{ name: "attachments", control: form.control, defaultValue: [] }}
|
|
15
|
+
accept={["image/*", ".pdf"]}
|
|
16
|
+
maxFiles={5}
|
|
17
|
+
maxSizeBytes={5 * 1024 * 1024}
|
|
18
|
+
label="Attachments"
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
|
|
24
|
+
- Supports both `react-hook-form` mode and plain controlled mode with `value` and `onChange`.
|
|
25
|
+
- Rejections are normalized into `FileDropzoneRejectedFile`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# FilterPannel
|
|
2
|
+
|
|
3
|
+
- Export: `FilterPannel`
|
|
4
|
+
- Import: `import { FilterPannel } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `primereact/sidebar` + `react-hook-form`
|
|
6
|
+
- Base typing: `PropsWithChildren<{ onApplyFilter: (data: T) => Promise<void> }>`
|
|
7
|
+
- Required styles: none
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<FilterPannel<{ status: string | null; city: string | null }>
|
|
13
|
+
onApplyFilter={async (filters) => setFilters(filters)}
|
|
14
|
+
>
|
|
15
|
+
<DropDown controller={{ name: "status" }} options={statusOptions} />
|
|
16
|
+
<DropDown controller={{ name: "city" }} options={cityOptions} />
|
|
17
|
+
</FilterPannel>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Notes
|
|
21
|
+
|
|
22
|
+
- The component creates its own `FormProvider`.
|
|
23
|
+
- Empty values are normalized to `null` before `onApplyFilter`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# FormActionsBar
|
|
2
|
+
|
|
3
|
+
- Export: `FormActionsBar`
|
|
4
|
+
- Import: `import { FormActionsBar } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: custom layout + `Button`
|
|
6
|
+
- Base typing: explicit `FormActionsBarProps`
|
|
7
|
+
- Required styles: `@mantis-core/styles/scss/form-actions.scss`
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<FormActionsBar
|
|
13
|
+
align="between"
|
|
14
|
+
sticky
|
|
15
|
+
leftSlot={<span>Unsaved changes</span>}
|
|
16
|
+
primaryLabel="Save"
|
|
17
|
+
primaryType="submit"
|
|
18
|
+
secondaryLabel="Cancel"
|
|
19
|
+
secondaryOutlined
|
|
20
|
+
onSecondaryClick={() => router.back()}
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# FormFieldRender
|
|
2
|
+
|
|
3
|
+
- Export: `FormFieldRender`
|
|
4
|
+
- Extra exports: `FormFieldRenderProps`
|
|
5
|
+
- Import: `import { FormFieldRender } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom label and error wrapper
|
|
7
|
+
- Base typing: `{ name: string; label: string | ReactElement; labelProps?; containerClassName?; render: ({ name }) => ReactElement | ReactNode }`
|
|
8
|
+
- Required styles: none
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<FormFieldRender
|
|
14
|
+
name="email"
|
|
15
|
+
label="Email"
|
|
16
|
+
render={({ name }) => (
|
|
17
|
+
<TextInput controller={{ name, control: form.control }} block />
|
|
18
|
+
)}
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# FormSection
|
|
2
|
+
|
|
3
|
+
- Export: `FormSection`
|
|
4
|
+
- Import: `import { FormSection } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: custom card section
|
|
6
|
+
- Base typing: `{ title: string; description?: string; icon?: ReactNode; children: ReactNode; className?: string }`
|
|
7
|
+
- Required styles: none
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<FormSection title="Publishing" description="Visibility and timing controls">
|
|
13
|
+
<Switch name="published" control={form.control} />
|
|
14
|
+
</FormSection>
|
|
15
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# HiddenField
|
|
2
|
+
|
|
3
|
+
- Export: `HiddenField`
|
|
4
|
+
- Extra exports: `HiddenFieldProps`
|
|
5
|
+
- Import: `import { HiddenField } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `react-hook-form`
|
|
7
|
+
- Base typing: `ControllerProps & { hidden?: boolean }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: none
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<HiddenField
|
|
15
|
+
name="tenantId"
|
|
16
|
+
control={form.control}
|
|
17
|
+
defaultValue={tenantId}
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# IndexColumn
|
|
2
|
+
|
|
3
|
+
- Export: `IndexColumn`
|
|
4
|
+
- Import: `import { IndexColumn } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `primereact/column`
|
|
6
|
+
- Base typing: `(props?: ColumnProps) => JSX.Element`
|
|
7
|
+
- Required styles: none beyond table context
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<IndexColumn style={{ width: "4rem" }} />
|
|
13
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Loading
|
|
2
|
+
|
|
3
|
+
- Export: `Loading`
|
|
4
|
+
- Extra exports: `LoadingWrapperProps`
|
|
5
|
+
- Import: `import { Loading } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom full-screen overlay
|
|
7
|
+
- Base typing: `PropsWithChildren<{ loading?: boolean; texto?: string; className?: string }>`
|
|
8
|
+
- Required styles: none
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<Loading loading={isSubmitting} texto="Saving changes...">
|
|
14
|
+
<FormScreen />
|
|
15
|
+
</Loading>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Notes
|
|
19
|
+
|
|
20
|
+
- When `loading` is `false`, it returns `children` unchanged.
|
|
21
|
+
- This is a page overlay, not an inline spinner primitive.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MapPickerClient
|
|
2
|
+
|
|
3
|
+
- Export: `MapPickerClient`
|
|
4
|
+
- Extra exports: `MapPickerClientProps`
|
|
5
|
+
- Import: `import { MapPickerClient } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `react-leaflet` + `leaflet`
|
|
7
|
+
- Base typing: `{ onLocationSelect: (lat: number, lng: number) => void; initialLat?: number | null; initialLng?: number | null }`
|
|
8
|
+
- Required styles: Leaflet CSS is imported by the component
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<MapPickerClient
|
|
14
|
+
initialLat={-2.9}
|
|
15
|
+
initialLng={-79.0}
|
|
16
|
+
onLocationSelect={(lat, lng) => console.log(lat, lng)}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Notes
|
|
21
|
+
|
|
22
|
+
- Marker assets are expected under `/leaflet/*`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# MapPickerOSM
|
|
2
|
+
|
|
3
|
+
- Export: `MapPickerOSM`
|
|
4
|
+
- Extra exports: `MapPickerOSMProps`, `LatLng`
|
|
5
|
+
- Import: `import { MapPickerOSM } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: Leaflet loaded from CDN
|
|
7
|
+
- Base typing: `{ initialPosition?: LatLng; zoom?: number; height?: string; onChange?: (pos: LatLng) => void; onSave?: (pos: LatLng) => void }`
|
|
8
|
+
- Required styles: no `@mantis-core/styles` partial; Leaflet CSS is injected from CDN
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<MapPickerOSM
|
|
14
|
+
initialPosition={{ lat: -12.0464, lng: -77.0428 }}
|
|
15
|
+
onChange={(pos) => console.log(pos)}
|
|
16
|
+
onSave={(pos) => saveCoordinates(pos)}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MapPicker
|
|
2
|
+
|
|
3
|
+
- Export: `MapPicker`
|
|
4
|
+
- Extra exports: `MapPickerProps`
|
|
5
|
+
- Import: `import { MapPicker } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `next/dynamic` wrapper over `MapPickerClient`
|
|
7
|
+
- Base typing: `{ onLocationSelect: (lat: number, lng: number) => void; initialLat?: number | null; initialLng?: number | null }`
|
|
8
|
+
- Required styles: Leaflet CSS comes from the client implementation
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<MapPicker
|
|
14
|
+
initialLat={-2.9}
|
|
15
|
+
initialLng={-79.0}
|
|
16
|
+
onLocationSelect={(lat, lng) => {
|
|
17
|
+
form.setValue("lat", lat);
|
|
18
|
+
form.setValue("lng", lng);
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MenuButton
|
|
2
|
+
|
|
3
|
+
- Export: `MenuButton`
|
|
4
|
+
- Extra exports: `MenuButtonProps`, `ActionMenuItem`
|
|
5
|
+
- Import: `import { MenuButton } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/tieredmenu`
|
|
7
|
+
- Base typing:
|
|
8
|
+
- `ActionMenuItem extends MenuItem { route?: string; items?: ActionMenuItem[] | ActionMenuItem[][] }`
|
|
9
|
+
- `MenuButtonProps = { label?: string; icon?: string; items?: ActionMenuItem[] }`
|
|
10
|
+
- Required styles: [`buttons.scss`](../../../../packages/mantis-core-styles/docs/styles/buttons.md) indirectly through `Button`
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<MenuButton
|
|
16
|
+
label="Actions"
|
|
17
|
+
items={[
|
|
18
|
+
{ label: "Edit", icon: "pi pi-pencil", route: "/admin/listings/1" },
|
|
19
|
+
{ label: "Delete", icon: "pi pi-trash", command: () => setOpen(true) },
|
|
20
|
+
]}
|
|
21
|
+
/>
|
|
22
|
+
```
|