@mantis-core/ui 0.1.3 → 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/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/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/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 +6 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# TableFilterField
|
|
2
|
+
|
|
3
|
+
- Export: `TableFilterField`
|
|
4
|
+
- Extra exports: `TableFilterFieldProps`
|
|
5
|
+
- Import: `import { TableFilterField } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom filter wrapper
|
|
7
|
+
- Base typing: `{ label: ReactNode; htmlFor: string; children: ReactNode; className?: string; labelClassName?: string }`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/table.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<TableFilterField label="Status" htmlFor="status-filter">
|
|
14
|
+
<DropDown
|
|
15
|
+
controller={{ name: "status", control: form.control }}
|
|
16
|
+
block
|
|
17
|
+
inputId="status-filter"
|
|
18
|
+
options={statusOptions}
|
|
19
|
+
/>
|
|
20
|
+
</TableFilterField>
|
|
21
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# TableToolbar
|
|
2
|
+
|
|
3
|
+
- Export: `TableToolbar`
|
|
4
|
+
- Extra exports: `TableToolbarProps`
|
|
5
|
+
- Import: `import { TableToolbar } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom layout
|
|
7
|
+
- Base typing: `{ title?: ReactNode; totalRecords?: number; meta?: ReactNode; actions?: ReactNode; className?: string; copyClassName?: string; actionsClassName?: string }`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/table.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<TableToolbar
|
|
14
|
+
title="Listings"
|
|
15
|
+
totalRecords={total}
|
|
16
|
+
meta="Updated today"
|
|
17
|
+
actions={<Button label="New listing" icon="pi pi-plus" />}
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# TextArea
|
|
2
|
+
|
|
3
|
+
- Export: `TextArea`
|
|
4
|
+
- Extra exports: `TextAreaProps`
|
|
5
|
+
- Import: `import { TextArea } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/inputtextarea`
|
|
7
|
+
- Base typing: `Omit<InputTextareaProps, "name" | "defaultValue" | "ref" | "onChange"> & { controller: ControllerProps; block?: boolean; loading?: 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
|
+
<TextArea
|
|
15
|
+
controller={{ name: "description", control: form.control }}
|
|
16
|
+
block
|
|
17
|
+
rows={6}
|
|
18
|
+
autoResize
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# TextInput
|
|
2
|
+
|
|
3
|
+
- Export: `TextInput`
|
|
4
|
+
- Extra exports: `TextInputProps`
|
|
5
|
+
- Import: `import { TextInput } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/inputtext`
|
|
7
|
+
- Base typing: `Omit<InputTextProps, "name" | "defaultValue"> & { controller: ControllerProps; block?: boolean; defaultValue?: string }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: `@mantis-core/styles/scss/inputs.scss`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<TextInput
|
|
15
|
+
controller={{ name: "title", control: form.control }}
|
|
16
|
+
block
|
|
17
|
+
placeholder="Listing title"
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
|
|
23
|
+
- Use this when you want PrimeReact `InputText` behavior with `react-hook-form` wiring.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# TimePicker
|
|
2
|
+
|
|
3
|
+
- Export: `TimePicker`
|
|
4
|
+
- Import: `import { TimePicker } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `react-datepicker`
|
|
6
|
+
- Base typing: explicit `TimePickerProps`
|
|
7
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
8
|
+
- Required styles: none
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<TimePicker
|
|
14
|
+
controller={{ name: "openingTime", control: form.control }}
|
|
15
|
+
block
|
|
16
|
+
datePicker={{ showTimeSelectOnly: true, timeIntervals: 30 }}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Notes
|
|
21
|
+
|
|
22
|
+
- This is not PrimeReact `Calendar`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# ToggleInlineButton
|
|
2
|
+
|
|
3
|
+
- Export: `ToggleInlineButton`
|
|
4
|
+
- Extra exports: `ToggleInlineButtonProps`
|
|
5
|
+
- Import: `import { ToggleInlineButton } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/selectbutton`
|
|
7
|
+
- Base typing: `{ controller: ControllerProps; options: any[]; variant?: ButtonVariant; multiple?: boolean }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: `@mantis-core/styles/scss/select-button.scss`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<ToggleInlineButton
|
|
15
|
+
controller={{ name: "visibility", control: form.control }}
|
|
16
|
+
variant="accent"
|
|
17
|
+
options={[
|
|
18
|
+
{ label: "Public", value: "public" },
|
|
19
|
+
{ label: "Private", value: "private" },
|
|
20
|
+
]}
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
- Export: `Toggle`
|
|
4
|
+
- Extra exports: `ToggleProps`
|
|
5
|
+
- Import: `import { Toggle } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/checkbox`
|
|
7
|
+
- Base typing: `ControllerProps & { on?; off?; size?; offstyle?; onstyle?; onClick?; active? }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: none
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Toggle
|
|
15
|
+
name="published"
|
|
16
|
+
control={form.control}
|
|
17
|
+
defaultValue={false}
|
|
18
|
+
on="YES"
|
|
19
|
+
off="NO"
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# UploadFilesPreview
|
|
2
|
+
|
|
3
|
+
- Export: `UploadFilesPreview`
|
|
4
|
+
- Extra exports: `UploadFilesPreviewProps`, `UploadPreviewItem`, `UploadFilesPreviewCopy`
|
|
5
|
+
- Import: `import { UploadFilesPreview } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom upload queue and sortable preview grid
|
|
7
|
+
- Base typing: `UploadFilesPreviewProps<TItem extends UploadPreviewItem = UploadPreviewItem>`
|
|
8
|
+
- Required styles: none
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
type PhotoItem = {
|
|
14
|
+
id: string;
|
|
15
|
+
fullUrl: string;
|
|
16
|
+
storagePath: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
<UploadFilesPreview<PhotoItem>
|
|
20
|
+
previews={photos}
|
|
21
|
+
onUploadFile={uploadPhoto}
|
|
22
|
+
onFileUploaded={(photo) => setPhotos((prev) => [...prev, photo])}
|
|
23
|
+
onRemoveFile={(photo) => removePhoto(photo.id)}
|
|
24
|
+
onReorder={setPhotos}
|
|
25
|
+
/>
|
|
26
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Controller Props
|
|
2
|
+
|
|
3
|
+
Shared form wrappers in `@mantis-core/ui` use this contract:
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
export interface ControllerProps {
|
|
7
|
+
name: string;
|
|
8
|
+
rules?: RegisterOptions;
|
|
9
|
+
shouldUnregister?: boolean;
|
|
10
|
+
defaultValue?: any;
|
|
11
|
+
control?: Control;
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
controller={{
|
|
19
|
+
name: "title",
|
|
20
|
+
control: form.control,
|
|
21
|
+
rules: { required: "Title is required" },
|
|
22
|
+
}}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Notes
|
|
26
|
+
|
|
27
|
+
- Components that expose `controller: ControllerProps` are designed for `react-hook-form`.
|
|
28
|
+
- Some components, such as `FileDropzone`, also support plain controlled mode without `controller`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Underlying Library Map
|
|
2
|
+
|
|
3
|
+
Use this file when you need to know which base library a component wraps.
|
|
4
|
+
|
|
5
|
+
## PrimeReact wrappers
|
|
6
|
+
|
|
7
|
+
- `Button`: `primereact/button`
|
|
8
|
+
- `DateInput`: `primereact/calendar`
|
|
9
|
+
- `DropDown`: `primereact/dropdown`
|
|
10
|
+
- `MultiSelect`: `primereact/multiselect`
|
|
11
|
+
- `NumberInput`: `primereact/inputnumber`
|
|
12
|
+
- `TextInput`: `primereact/inputtext`
|
|
13
|
+
- `TextArea`: `primereact/inputtextarea`
|
|
14
|
+
- `Toggle`: `primereact/checkbox`
|
|
15
|
+
- `ToggleInlineButton`: `primereact/selectbutton`
|
|
16
|
+
- `PaginatedTable`: `primereact/datatable`
|
|
17
|
+
- `ActionColumn`: `primereact/column`
|
|
18
|
+
- `IndexColumn`: `primereact/column`
|
|
19
|
+
- `MenuButton`: `primereact/tieredmenu`
|
|
20
|
+
- `FilterPannel`: `primereact/sidebar`
|
|
21
|
+
- `MultiSelectFilter`: `primereact/multiselect`
|
|
22
|
+
- `ConfirmDialog`: `primereact/dialog`
|
|
23
|
+
|
|
24
|
+
## Non-PrimeReact wrappers
|
|
25
|
+
|
|
26
|
+
- `Select`: `react-select`
|
|
27
|
+
- `AsyncSelect`: `react-select/async`
|
|
28
|
+
- `CKEditorInput`: `@ckeditor/ckeditor5-react` + `ckeditor5`
|
|
29
|
+
- `TimePicker`: `react-datepicker`
|
|
30
|
+
- `MapPickerClient`: `react-leaflet` + `leaflet`
|
|
31
|
+
- `MapPickerOSM`: Leaflet loaded from CDN
|
|
32
|
+
- `MapPicker`: `next/dynamic` wrapper over `MapPickerClient`
|
|
33
|
+
|
|
34
|
+
## Custom components
|
|
35
|
+
|
|
36
|
+
- `Loading`
|
|
37
|
+
- `FileDropzone`
|
|
38
|
+
- `UploadFilesPreview`
|
|
39
|
+
- `FormActionsBar`
|
|
40
|
+
- `FormFieldRender`
|
|
41
|
+
- `RenderField`
|
|
42
|
+
- `DirtyFormGuard`
|
|
43
|
+
- `useDirtyFormGuard`
|
|
44
|
+
- `TableToolbar`
|
|
45
|
+
- `TableFilterField`
|
|
46
|
+
- `PageTitle`
|
|
47
|
+
- `FormSection`
|
|
48
|
+
- `AdminPageHeader`
|
|
49
|
+
- `AdminPageLayoutProvider`
|
|
50
|
+
- `AdminPageConfigurator`
|
|
51
|
+
- `AdminPageLayoutShell`
|
|
52
|
+
- `Pagination`
|
|
53
|
+
- `PaginationInfo`
|
|
54
|
+
- `PageSizeSelector`
|
|
55
|
+
- `RichTextPreview`
|
|
56
|
+
- `StatusBadge`
|
|
57
|
+
- `DataState`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Style Import Guide
|
|
2
|
+
|
|
3
|
+
`@mantis-core/ui` does not inject CSS automatically. Import the matching partials from `@mantis-core/styles`.
|
|
4
|
+
|
|
5
|
+
## Common imports
|
|
6
|
+
|
|
7
|
+
```scss
|
|
8
|
+
@use "@mantis-core/styles/scss/buttons.scss";
|
|
9
|
+
@use "@mantis-core/styles/scss/inputs.scss";
|
|
10
|
+
@use "@mantis-core/styles/scss/select.scss";
|
|
11
|
+
@use "@mantis-core/styles/scss/select-button.scss";
|
|
12
|
+
@use "@mantis-core/styles/scss/table.scss";
|
|
13
|
+
@use "@mantis-core/styles/scss/status-badge.scss";
|
|
14
|
+
@use "@mantis-core/styles/scss/data-state.scss";
|
|
15
|
+
@use "@mantis-core/styles/scss/confirm-dialog.scss";
|
|
16
|
+
@use "@mantis-core/styles/scss/form-actions.scss";
|
|
17
|
+
@use "@mantis-core/styles/scss/file-dropzone.scss";
|
|
18
|
+
@use "@mantis-core/styles/scss/ckeditor.scss";
|
|
19
|
+
@use "@mantis-core/styles/scss/rich-text-preview.scss";
|
|
20
|
+
@use "@mantis-core/styles/scss/switch.scss";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
|
|
25
|
+
- `Pagination` is a custom component and does not use `paginator.scss`.
|
|
26
|
+
- `Select` and `AsyncSelect` require `select.scss`, not PrimeReact input styles.
|
|
27
|
+
- Components like `Loading`, `UploadFilesPreview`, `PageTitle`, and `FormSection` rely mainly on utility classes or inline styles.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantis-core/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable React UI components for Mantis Core.",
|
|
6
6
|
"type": "module",
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"dist",
|
|
35
|
+
"docs",
|
|
35
36
|
"README.md",
|
|
36
|
-
"COMPONENTS.md"
|
|
37
|
+
"COMPONENTS.md",
|
|
38
|
+
"PRIMEREACT_MAPPING.md"
|
|
37
39
|
],
|
|
38
40
|
"publishConfig": {
|
|
39
41
|
"access": "public"
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
"react-datepicker": "^9.0.0",
|
|
57
59
|
"react-leaflet": "^5.0.0",
|
|
58
60
|
"react-select": "^5.10.2",
|
|
59
|
-
"@mantis-core/utils": "^0.
|
|
61
|
+
"@mantis-core/utils": "^0.4.0"
|
|
60
62
|
},
|
|
61
63
|
"repository": {
|
|
62
64
|
"type": "git",
|
|
@@ -75,7 +77,7 @@
|
|
|
75
77
|
],
|
|
76
78
|
"scripts": {
|
|
77
79
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
78
|
-
"build": "
|
|
80
|
+
"build": "tsc -p tsconfig.build.json",
|
|
79
81
|
"typecheck": "tsc -p tsconfig.build.json --noEmit"
|
|
80
82
|
}
|
|
81
83
|
}
|