@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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# MultiSelectFilter
|
|
2
|
+
|
|
3
|
+
- Export: `MultiSelectFilter`
|
|
4
|
+
- Import: `import { MultiSelectFilter } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `primereact/multiselect`
|
|
6
|
+
- Base typing: `Omit<MultiSelectProps, "value" | "onChange"> & { filterProps: ColumnFilterElementTemplateOptions }`
|
|
7
|
+
- Required styles: `@mantis-core/styles/scss/inputs.scss`
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
filterElement={(filterProps) => (
|
|
13
|
+
<MultiSelectFilter
|
|
14
|
+
filterProps={filterProps}
|
|
15
|
+
options={statusOptions}
|
|
16
|
+
optionLabel="label"
|
|
17
|
+
optionValue="value"
|
|
18
|
+
/>
|
|
19
|
+
)}
|
|
20
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# MultiSelect
|
|
2
|
+
|
|
3
|
+
- Export: `MultiSelect`
|
|
4
|
+
- Import: `import { MultiSelect } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `primereact/multiselect`
|
|
6
|
+
- Base typing: `Omit<PrimeMultiSelectProps, "name" | "defaultValue"> & { controller: ControllerProps; block?: boolean }`
|
|
7
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/inputs.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<MultiSelect
|
|
14
|
+
controller={{ name: "tags", control: form.control }}
|
|
15
|
+
block
|
|
16
|
+
options={[
|
|
17
|
+
{ label: "Featured", value: "featured" },
|
|
18
|
+
{ label: "Luxury", value: "luxury" },
|
|
19
|
+
]}
|
|
20
|
+
optionLabel="label"
|
|
21
|
+
optionValue="value"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# NumberInput
|
|
2
|
+
|
|
3
|
+
- Export: `NumberInput`
|
|
4
|
+
- Extra exports: `NumberInputProps`
|
|
5
|
+
- Import: `import { NumberInput } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/inputnumber`
|
|
7
|
+
- Base typing: `Omit<InputNumberProps, "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
|
+
<NumberInput
|
|
15
|
+
controller={{ name: "price", control: form.control }}
|
|
16
|
+
block
|
|
17
|
+
mode="currency"
|
|
18
|
+
currency="USD"
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# PageTitle
|
|
2
|
+
|
|
3
|
+
- Export: `PageTitle`
|
|
4
|
+
- Import: `import { PageTitle } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: custom typographic wrapper
|
|
6
|
+
- Base typing: `PropsWithChildren`
|
|
7
|
+
- Required styles: none
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<PageTitle>Inventory Overview</PageTitle>
|
|
13
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# PaginatedTable
|
|
2
|
+
|
|
3
|
+
- Export: `PaginatedTable`
|
|
4
|
+
- Extra exports: `PaginatedTableProps`
|
|
5
|
+
- Import: `import { PaginatedTable } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `primereact/datatable` + `primereact/column`
|
|
7
|
+
- Base typing: `DataTableBaseProps<TValue> & { showIndexColumn?; showActionColumn?; useMantisCoreStyles?; indexColumnProps?; actionColumnProps?; actionColumnItems? }`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/table.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { Column } from "primereact/column";
|
|
14
|
+
|
|
15
|
+
<PaginatedTable
|
|
16
|
+
value={rows}
|
|
17
|
+
totalRecords={total}
|
|
18
|
+
lazy
|
|
19
|
+
first={first}
|
|
20
|
+
rows={pageSize}
|
|
21
|
+
onPage={onPage}
|
|
22
|
+
showActionColumn
|
|
23
|
+
actionColumnItems={(row) => [
|
|
24
|
+
{ label: "Edit", icon: "pi pi-pencil", route: `/admin/listings/${row.id}` },
|
|
25
|
+
]}
|
|
26
|
+
>
|
|
27
|
+
<Column field="name" header="Name" sortable />
|
|
28
|
+
<Column field="status" header="Status" />
|
|
29
|
+
</PaginatedTable>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- It sets Mantis defaults for pagination, stripes, gridlines, sorting, empty state, and responsive layout.
|
|
35
|
+
- Set `useMantisCoreStyles={false}` only if you want plain PrimeReact styling.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Pagination, PaginationInfo, and PageSizeSelector
|
|
2
|
+
|
|
3
|
+
- Exports: `Pagination`, `PaginationInfo`, `PageSizeSelector`
|
|
4
|
+
- Extra exports: `PaginationProps`, `PaginationInfoProps`, `PageSizeSelectorProps`
|
|
5
|
+
- Import: `import { Pagination, PaginationInfo, PageSizeSelector } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom pagination UI using `@mantis-core/utils`
|
|
7
|
+
- Required styles: none
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Pagination
|
|
13
|
+
currentPage={page}
|
|
14
|
+
totalPages={totalPages}
|
|
15
|
+
onPageChange={setPage}
|
|
16
|
+
maxVisible={5}
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<PaginationInfo currentPage={page} pageSize={pageSize} totalCount={total} />
|
|
20
|
+
|
|
21
|
+
<PageSizeSelector pageSize={pageSize} onPageSizeChange={setPageSize} />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Notes
|
|
25
|
+
|
|
26
|
+
- This is not PrimeReact `Paginator`.
|
|
27
|
+
- `paginator.scss` styles PrimeReact paginator markup, not these exports.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# RenderField
|
|
2
|
+
|
|
3
|
+
- Export: `RenderField`
|
|
4
|
+
- Extra exports: `RenderFieldProps`
|
|
5
|
+
- Import: `import { RenderField } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: `react-hook-form` `Controller`
|
|
7
|
+
- Base typing: `{ name: string; defaultValue?: any; control?: Control; render: (props: RenderProps) => ReactElement; rules?: RegisterOptions }`
|
|
8
|
+
- Required styles: none
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<RenderField
|
|
14
|
+
name="featured"
|
|
15
|
+
control={form.control}
|
|
16
|
+
render={({ field }) => (
|
|
17
|
+
<input
|
|
18
|
+
type="checkbox"
|
|
19
|
+
checked={!!field.value}
|
|
20
|
+
onChange={(e) => field.onChange(e.target.checked)}
|
|
21
|
+
/>
|
|
22
|
+
)}
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# RichTextPreview
|
|
2
|
+
|
|
3
|
+
- Export: `RichTextPreview`
|
|
4
|
+
- Extra exports: `RichTextPreviewProps`
|
|
5
|
+
- Import: `import { RichTextPreview } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: sanitized HTML renderer via `@mantis-core/utils`
|
|
7
|
+
- Base typing: `{ html?: string | null; className?: string; sanitize?: boolean; size?: "sm" | "md" | "lg"; emptyFallback?: ReactNode }`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/rich-text-preview.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<RichTextPreview
|
|
14
|
+
html={post.bodyHtml}
|
|
15
|
+
size="lg"
|
|
16
|
+
emptyFallback={<p>No content yet.</p>}
|
|
17
|
+
/>
|
|
18
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
- Export: `Select`
|
|
4
|
+
- Import: `import { Select } from "@mantis-core/ui";`
|
|
5
|
+
- Base library: `react-select` or `react-select/creatable`
|
|
6
|
+
- Base typing: `Omit<ReactSelectProps, "name" | "defaultValue"> & { controller: ControllerProps; block?: boolean; variant?: ButtonVariant; isCreatable?: boolean; onCreateOption?; formatCreateLabel? }`
|
|
7
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/select.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<Select
|
|
14
|
+
controller={{ name: "agent", control: form.control }}
|
|
15
|
+
block
|
|
16
|
+
variant="secondary"
|
|
17
|
+
options={[
|
|
18
|
+
{ label: "Alice", value: "alice" },
|
|
19
|
+
{ label: "Bob", value: "bob" },
|
|
20
|
+
]}
|
|
21
|
+
isClearable
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Notes
|
|
26
|
+
|
|
27
|
+
- This is not PrimeReact.
|
|
28
|
+
- Keep `classNamePrefix="react-select"` behavior so the shared SCSS continues to match.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# StatusBadge
|
|
2
|
+
|
|
3
|
+
- Export: `StatusBadge`
|
|
4
|
+
- Extra exports: `StatusBadgeProps`, `StatusBadgeTone`, `StatusBadgeSize`
|
|
5
|
+
- Import: `import { StatusBadge } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom span primitive
|
|
7
|
+
- Base typing: `Omit<HTMLAttributes<HTMLSpanElement>, "children"> & { label?: ReactNode; tone?: "success" | "muted" | "warning" | "info" | "danger"; size?: "sm" | "md"; block?: boolean; children?: ReactNode }`
|
|
8
|
+
- Required styles: `@mantis-core/styles/scss/status-badge.scss`
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<StatusBadge tone="success" size="sm" label="Published" />
|
|
14
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
- Export: `Switch`
|
|
4
|
+
- Extra exports: `SwitchProps`
|
|
5
|
+
- Import: `import { Switch } from "@mantis-core/ui";`
|
|
6
|
+
- Base library: custom bootstrap-switch-like markup
|
|
7
|
+
- Base typing: `ControllerProps & { onLabel?; offLabel?; size?; onStyle?; offStyle?; width?; height?; disabled?; onChange?; className?; style? }`
|
|
8
|
+
- Form contract: [`ControllerProps`](../contracts/controller-props.md)
|
|
9
|
+
- Required styles: `@mantis-core/styles/scss/switch.scss`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Switch
|
|
15
|
+
name="enabled"
|
|
16
|
+
control={form.control}
|
|
17
|
+
defaultValue={true}
|
|
18
|
+
onLabel="Enabled"
|
|
19
|
+
offLabel="Disabled"
|
|
20
|
+
onStyle="success"
|
|
21
|
+
offStyle="light"
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Notes
|
|
26
|
+
|
|
27
|
+
- This is not PrimeReact `InputSwitch`.
|
|
@@ -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,9 +1,15 @@
|
|
|
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",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20.0.0",
|
|
11
|
+
"pnpm": ">=10.0.0"
|
|
12
|
+
},
|
|
7
13
|
"main": "./dist/index.js",
|
|
8
14
|
"types": "./dist/index.d.ts",
|
|
9
15
|
"exports": {
|
|
@@ -26,8 +32,10 @@
|
|
|
26
32
|
},
|
|
27
33
|
"files": [
|
|
28
34
|
"dist",
|
|
35
|
+
"docs",
|
|
29
36
|
"README.md",
|
|
30
|
-
"COMPONENTS.md"
|
|
37
|
+
"COMPONENTS.md",
|
|
38
|
+
"PRIMEREACT_MAPPING.md"
|
|
31
39
|
],
|
|
32
40
|
"publishConfig": {
|
|
33
41
|
"access": "public"
|
|
@@ -37,7 +45,8 @@
|
|
|
37
45
|
"primeicons": "^7.0.0",
|
|
38
46
|
"primereact": "^10.9.0",
|
|
39
47
|
"react": "^19.0.0",
|
|
40
|
-
"react-dom": "^19.0.0"
|
|
48
|
+
"react-dom": "^19.0.0",
|
|
49
|
+
"react-hook-form": "^7.68.0"
|
|
41
50
|
},
|
|
42
51
|
"dependencies": {
|
|
43
52
|
"@ckeditor/ckeditor5-react": "^11.0.0",
|
|
@@ -47,11 +56,9 @@
|
|
|
47
56
|
"leaflet": "^1.9.4",
|
|
48
57
|
"lucide-react": "^0.556.0",
|
|
49
58
|
"react-datepicker": "^9.0.0",
|
|
50
|
-
"react-hook-form": "^7.68.0",
|
|
51
59
|
"react-leaflet": "^5.0.0",
|
|
52
60
|
"react-select": "^5.10.2",
|
|
53
|
-
"@mantis-core/
|
|
54
|
-
"@mantis-core/utils": "^0.2.0"
|
|
61
|
+
"@mantis-core/utils": "^0.4.0"
|
|
55
62
|
},
|
|
56
63
|
"repository": {
|
|
57
64
|
"type": "git",
|
|
@@ -70,7 +77,7 @@
|
|
|
70
77
|
],
|
|
71
78
|
"scripts": {
|
|
72
79
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
73
|
-
"build": "
|
|
80
|
+
"build": "tsc -p tsconfig.build.json",
|
|
74
81
|
"typecheck": "tsc -p tsconfig.build.json --noEmit"
|
|
75
82
|
}
|
|
76
83
|
}
|