@mantis-core/ui 0.1.1
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 +147 -0
- package/README.md +120 -0
- package/dist/components/Buttons/Button.d.ts +19 -0
- package/dist/components/Buttons/Button.d.ts.map +1 -0
- package/dist/components/Buttons/Button.js +27 -0
- package/dist/components/Buttons/Button.js.map +1 -0
- package/dist/components/Forms/CKEditorInput.d.ts +32 -0
- package/dist/components/Forms/CKEditorInput.d.ts.map +1 -0
- package/dist/components/Forms/CKEditorInput.js +357 -0
- package/dist/components/Forms/CKEditorInput.js.map +1 -0
- package/dist/components/Forms/DateInput.d.ts +10 -0
- package/dist/components/Forms/DateInput.d.ts.map +1 -0
- package/dist/components/Forms/DateInput.js +11 -0
- package/dist/components/Forms/DateInput.js.map +1 -0
- package/dist/components/Forms/DropDown.d.ts +10 -0
- package/dist/components/Forms/DropDown.d.ts.map +1 -0
- package/dist/components/Forms/DropDown.js +11 -0
- package/dist/components/Forms/DropDown.js.map +1 -0
- package/dist/components/Forms/ErrorMessage.d.ts +6 -0
- package/dist/components/Forms/ErrorMessage.d.ts.map +1 -0
- package/dist/components/Forms/ErrorMessage.js +14 -0
- package/dist/components/Forms/ErrorMessage.js.map +1 -0
- package/dist/components/Forms/FormFieldRender.d.ts +13 -0
- package/dist/components/Forms/FormFieldRender.d.ts.map +1 -0
- package/dist/components/Forms/FormFieldRender.js +9 -0
- package/dist/components/Forms/FormFieldRender.js.map +1 -0
- package/dist/components/Forms/HiddenField.d.ts +8 -0
- package/dist/components/Forms/HiddenField.d.ts.map +1 -0
- package/dist/components/Forms/HiddenField.js +8 -0
- package/dist/components/Forms/HiddenField.js.map +1 -0
- package/dist/components/Forms/MultiSelect.d.ts +10 -0
- package/dist/components/Forms/MultiSelect.d.ts.map +1 -0
- package/dist/components/Forms/MultiSelect.js +13 -0
- package/dist/components/Forms/MultiSelect.js.map +1 -0
- package/dist/components/Forms/NumberInput.d.ts +10 -0
- package/dist/components/Forms/NumberInput.d.ts.map +1 -0
- package/dist/components/Forms/NumberInput.js +16 -0
- package/dist/components/Forms/NumberInput.js.map +1 -0
- package/dist/components/Forms/RenderField.d.ts +18 -0
- package/dist/components/Forms/RenderField.d.ts.map +1 -0
- package/dist/components/Forms/RenderField.js +14 -0
- package/dist/components/Forms/RenderField.js.map +1 -0
- package/dist/components/Forms/Select.d.ts +12 -0
- package/dist/components/Forms/Select.d.ts.map +1 -0
- package/dist/components/Forms/Select.js +39 -0
- package/dist/components/Forms/Select.js.map +1 -0
- package/dist/components/Forms/Switch.d.ts +18 -0
- package/dist/components/Forms/Switch.d.ts.map +1 -0
- package/dist/components/Forms/Switch.js +30 -0
- package/dist/components/Forms/Switch.js.map +1 -0
- package/dist/components/Forms/TextArea.d.ts +11 -0
- package/dist/components/Forms/TextArea.d.ts.map +1 -0
- package/dist/components/Forms/TextArea.js +11 -0
- package/dist/components/Forms/TextArea.js.map +1 -0
- package/dist/components/Forms/TextInput.d.ts +11 -0
- package/dist/components/Forms/TextInput.d.ts.map +1 -0
- package/dist/components/Forms/TextInput.js +12 -0
- package/dist/components/Forms/TextInput.js.map +1 -0
- package/dist/components/Forms/TimePicker.d.ts +13 -0
- package/dist/components/Forms/TimePicker.d.ts.map +1 -0
- package/dist/components/Forms/TimePicker.js +19 -0
- package/dist/components/Forms/TimePicker.js.map +1 -0
- package/dist/components/Forms/Toggle.d.ts +14 -0
- package/dist/components/Forms/Toggle.d.ts.map +1 -0
- package/dist/components/Forms/Toggle.js +10 -0
- package/dist/components/Forms/Toggle.js.map +1 -0
- package/dist/components/Forms/ToggleInlineButton.d.ts +14 -0
- package/dist/components/Forms/ToggleInlineButton.d.ts.map +1 -0
- package/dist/components/Forms/ToggleInlineButton.js +9 -0
- package/dist/components/Forms/ToggleInlineButton.js.map +1 -0
- package/dist/components/Forms/UploadFilesPreview.d.ts +30 -0
- package/dist/components/Forms/UploadFilesPreview.d.ts.map +1 -0
- package/dist/components/Forms/UploadFilesPreview.js +118 -0
- package/dist/components/Forms/UploadFilesPreview.js.map +1 -0
- package/dist/components/Forms/types.d.ts +9 -0
- package/dist/components/Forms/types.d.ts.map +1 -0
- package/dist/components/Forms/types.js +2 -0
- package/dist/components/Forms/types.js.map +1 -0
- package/dist/components/Loaders/Loading.d.ts +9 -0
- package/dist/components/Loaders/Loading.d.ts.map +1 -0
- package/dist/components/Loaders/Loading.js +11 -0
- package/dist/components/Loaders/Loading.js.map +1 -0
- package/dist/components/Maps/MapPicker.d.ts +7 -0
- package/dist/components/Maps/MapPicker.d.ts.map +1 -0
- package/dist/components/Maps/MapPicker.js +10 -0
- package/dist/components/Maps/MapPicker.js.map +1 -0
- package/dist/components/Maps/MapPickerClient.d.ts +8 -0
- package/dist/components/Maps/MapPickerClient.d.ts.map +1 -0
- package/dist/components/Maps/MapPickerClient.js +83 -0
- package/dist/components/Maps/MapPickerClient.js.map +1 -0
- package/dist/components/Maps/MapPickerOSM.d.ts +13 -0
- package/dist/components/Maps/MapPickerOSM.d.ts.map +1 -0
- package/dist/components/Maps/MapPickerOSM.js +117 -0
- package/dist/components/Maps/MapPickerOSM.js.map +1 -0
- package/dist/components/Tables/ActionColumn.d.ts +9 -0
- package/dist/components/Tables/ActionColumn.d.ts.map +1 -0
- package/dist/components/Tables/ActionColumn.js +8 -0
- package/dist/components/Tables/ActionColumn.js.map +1 -0
- package/dist/components/Tables/FilterPannel.d.ts +7 -0
- package/dist/components/Tables/FilterPannel.d.ts.map +1 -0
- package/dist/components/Tables/FilterPannel.js +32 -0
- package/dist/components/Tables/FilterPannel.js.map +1 -0
- package/dist/components/Tables/IndexColumn.d.ts +4 -0
- package/dist/components/Tables/IndexColumn.d.ts.map +1 -0
- package/dist/components/Tables/IndexColumn.js +7 -0
- package/dist/components/Tables/IndexColumn.js.map +1 -0
- package/dist/components/Tables/MenuButton.d.ts +14 -0
- package/dist/components/Tables/MenuButton.d.ts.map +1 -0
- package/dist/components/Tables/MenuButton.js +15 -0
- package/dist/components/Tables/MenuButton.js.map +1 -0
- package/dist/components/Tables/PaginatedTable.d.ts +23 -0
- package/dist/components/Tables/PaginatedTable.d.ts.map +1 -0
- package/dist/components/Tables/PaginatedTable.js +26 -0
- package/dist/components/Tables/PaginatedTable.js.map +1 -0
- package/dist/components/Tables/filters/MultiSelectFilter.d.ts +8 -0
- package/dist/components/Tables/filters/MultiSelectFilter.d.ts.map +1 -0
- package/dist/components/Tables/filters/MultiSelectFilter.js +7 -0
- package/dist/components/Tables/filters/MultiSelectFilter.js.map +1 -0
- package/dist/components/pages/AdminPageHeader.d.ts +11 -0
- package/dist/components/pages/AdminPageHeader.d.ts.map +1 -0
- package/dist/components/pages/AdminPageHeader.js +19 -0
- package/dist/components/pages/AdminPageHeader.js.map +1 -0
- package/dist/components/pages/FormSection.d.ts +11 -0
- package/dist/components/pages/FormSection.d.ts.map +1 -0
- package/dist/components/pages/FormSection.js +16 -0
- package/dist/components/pages/FormSection.js.map +1 -0
- package/dist/components/pages/PageTitle.d.ts +4 -0
- package/dist/components/pages/PageTitle.d.ts.map +1 -0
- package/dist/components/pages/PageTitle.js +6 -0
- package/dist/components/pages/PageTitle.js.map +1 -0
- package/dist/components/pages/admin-layout/AdminPageConfigurator.d.ts +9 -0
- package/dist/components/pages/admin-layout/AdminPageConfigurator.d.ts.map +1 -0
- package/dist/components/pages/admin-layout/AdminPageConfigurator.js +13 -0
- package/dist/components/pages/admin-layout/AdminPageConfigurator.js.map +1 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutContext.d.ts +14 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutContext.d.ts.map +1 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutContext.js +27 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutContext.js.map +1 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutShell.d.ts +7 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutShell.d.ts.map +1 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutShell.js +11 -0
- package/dist/components/pages/admin-layout/AdminPageLayoutShell.js.map +1 -0
- package/dist/components/pages/admin-layout/types.d.ts +13 -0
- package/dist/components/pages/admin-layout/types.d.ts.map +1 -0
- package/dist/components/pages/admin-layout/types.js +2 -0
- package/dist/components/pages/admin-layout/types.js.map +1 -0
- package/dist/components/table-filter-field.d.ts +11 -0
- package/dist/components/table-filter-field.d.ts.map +1 -0
- package/dist/components/table-filter-field.js +7 -0
- package/dist/components/table-filter-field.js.map +1 -0
- package/dist/components/table-toolbar.d.ts +13 -0
- package/dist/components/table-toolbar.d.ts.map +1 -0
- package/dist/components/table-toolbar.js +9 -0
- package/dist/components/table-toolbar.js.map +1 -0
- package/dist/components/ui/Pagination.d.ts +37 -0
- package/dist/components/ui/Pagination.d.ts.map +1 -0
- package/dist/components/ui/Pagination.js +42 -0
- package/dist/components/ui/Pagination.js.map +1 -0
- package/dist/components/ui/RichTextPreview.d.ts +12 -0
- package/dist/components/ui/RichTextPreview.d.ts.map +1 -0
- package/dist/components/ui/RichTextPreview.js +17 -0
- package/dist/components/ui/RichTextPreview.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/package.json +76 -0
package/COMPONENTS.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# @mantis-core/ui Component Catalog
|
|
2
|
+
|
|
3
|
+
This document describes what each exported UI component does, when to use it, and key integration notes.
|
|
4
|
+
|
|
5
|
+
## Export Groups
|
|
6
|
+
|
|
7
|
+
## Buttons
|
|
8
|
+
|
|
9
|
+
- `Button`
|
|
10
|
+
- Generic action button with variant support.
|
|
11
|
+
- Use for reusable actions, not domain-specific behavior.
|
|
12
|
+
|
|
13
|
+
## Loaders
|
|
14
|
+
|
|
15
|
+
- `Loading`
|
|
16
|
+
- Wrapper and spinner/loading utilities for async states.
|
|
17
|
+
|
|
18
|
+
## Forms
|
|
19
|
+
|
|
20
|
+
- `CKEditorInput`
|
|
21
|
+
- Rich text editor input built around CKEditor.
|
|
22
|
+
- Includes content metrics type export.
|
|
23
|
+
- `DateInput`
|
|
24
|
+
- Date picker field.
|
|
25
|
+
- `DropDown`
|
|
26
|
+
- PrimeReact dropdown wrapper.
|
|
27
|
+
- `ErrorMessage`
|
|
28
|
+
- Standardized field error rendering.
|
|
29
|
+
- `FormFieldRender`
|
|
30
|
+
- Label + render prop + error wrapper for fields.
|
|
31
|
+
- `HiddenField`
|
|
32
|
+
- Hidden input field support.
|
|
33
|
+
- `MultiSelect`
|
|
34
|
+
- Multi-select control wrapper.
|
|
35
|
+
- `NumberInput`
|
|
36
|
+
- Numeric input control.
|
|
37
|
+
- `RenderField`
|
|
38
|
+
- Field renderer utility.
|
|
39
|
+
- `Select`
|
|
40
|
+
- Select component wrapper.
|
|
41
|
+
- `Switch`
|
|
42
|
+
- Boolean switch input.
|
|
43
|
+
- `TextArea`
|
|
44
|
+
- Multi-line text input.
|
|
45
|
+
- `TextInput`
|
|
46
|
+
- Standard text input.
|
|
47
|
+
- `TimePicker`
|
|
48
|
+
- Time selection input.
|
|
49
|
+
- `Toggle`
|
|
50
|
+
- Toggle control.
|
|
51
|
+
- `ToggleInlineButton`
|
|
52
|
+
- Inline toggle button.
|
|
53
|
+
- `UploadFilesPreview`
|
|
54
|
+
- Upload preview component with item/copy types.
|
|
55
|
+
- `ControllerProps` (type)
|
|
56
|
+
- Shared control typing contract.
|
|
57
|
+
|
|
58
|
+
## Tables
|
|
59
|
+
|
|
60
|
+
- `TableToolbar`
|
|
61
|
+
- Header area for title, meta, and actions.
|
|
62
|
+
- `TableFilterField`
|
|
63
|
+
- Wrapper for consistent table filter controls.
|
|
64
|
+
- `ActionColumn`
|
|
65
|
+
- Action menu column helper.
|
|
66
|
+
- `FilterPannel`
|
|
67
|
+
- Filter container panel.
|
|
68
|
+
- `MultiSelectFilter`
|
|
69
|
+
- Multi-select filter utility for tables.
|
|
70
|
+
- `IndexColumn`
|
|
71
|
+
- Index/ordinal column helper.
|
|
72
|
+
- `MenuButton`
|
|
73
|
+
- Row action menu button.
|
|
74
|
+
- `PaginatedTable`
|
|
75
|
+
- PrimeReact `DataTable` wrapper with Mantis Core defaults.
|
|
76
|
+
- Key props:
|
|
77
|
+
- `showIndexColumn`
|
|
78
|
+
- `showActionColumn`
|
|
79
|
+
- `useMantisCoreStyles`
|
|
80
|
+
- `actionColumnItems`
|
|
81
|
+
|
|
82
|
+
## Page and Admin Layout
|
|
83
|
+
|
|
84
|
+
- `FormSection`
|
|
85
|
+
- Structured form section block.
|
|
86
|
+
- `PageTitle`
|
|
87
|
+
- Page heading helper.
|
|
88
|
+
- `AdminPageHeader`
|
|
89
|
+
- Page header presentation component.
|
|
90
|
+
- `AdminPageConfigurator`
|
|
91
|
+
- Configures admin page layout context.
|
|
92
|
+
- `AdminPageLayoutProvider`
|
|
93
|
+
- Context provider for admin layout.
|
|
94
|
+
- `useAdminPageLayout`
|
|
95
|
+
- Hook to read/update admin layout state.
|
|
96
|
+
- `AdminPageLayoutShell`
|
|
97
|
+
- Shared admin page shell renderer.
|
|
98
|
+
- `AdminBreadcrumbItem`, `AdminPageLayoutConfig` (types)
|
|
99
|
+
- Layout contract types.
|
|
100
|
+
|
|
101
|
+
## Generic UI
|
|
102
|
+
|
|
103
|
+
- `Pagination`
|
|
104
|
+
- Page navigation component.
|
|
105
|
+
- `PaginationInfo`
|
|
106
|
+
- Current page range summary.
|
|
107
|
+
- `PageSizeSelector`
|
|
108
|
+
- Page size control.
|
|
109
|
+
- `RichTextPreview`
|
|
110
|
+
- Sanitized rich-text display helper.
|
|
111
|
+
|
|
112
|
+
## Maps
|
|
113
|
+
|
|
114
|
+
- `MapPicker`
|
|
115
|
+
- Dynamic import wrapper for client map rendering.
|
|
116
|
+
- `MapPickerClient`
|
|
117
|
+
- Leaflet/react-leaflet map picker implementation.
|
|
118
|
+
- `MapPickerOSM`
|
|
119
|
+
- OpenStreetMap picker variant.
|
|
120
|
+
- `LatLng`, `MapPicker*Props` (types)
|
|
121
|
+
- Map contracts.
|
|
122
|
+
|
|
123
|
+
## Runtime Notes
|
|
124
|
+
|
|
125
|
+
1. Many components are client-side (`"use client"`).
|
|
126
|
+
2. Map components depend on Leaflet assets and browser APIs.
|
|
127
|
+
3. Table and paginator visuals depend on `@mantis-core/styles` classes.
|
|
128
|
+
|
|
129
|
+
## Integration Rules
|
|
130
|
+
|
|
131
|
+
1. Keep domain logic outside this package.
|
|
132
|
+
2. Keep text/content generic when possible.
|
|
133
|
+
3. If a component cannot be generic, keep it in app layer instead.
|
|
134
|
+
4. Any new export must be added to:
|
|
135
|
+
- `src/index.ts`
|
|
136
|
+
- this file (`COMPONENTS.md`)
|
|
137
|
+
- package README if category-level behavior changes.
|
|
138
|
+
|
|
139
|
+
## Suggested Validation For New Components
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
pnpm --filter @mantis-core/ui build
|
|
143
|
+
pnpm --filter @mantis-core/ui typecheck
|
|
144
|
+
pnpm lint
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Also validate in at least one consuming app route.
|
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# @mantis-core/ui
|
|
2
|
+
|
|
3
|
+
Reusable React component library for Mantis Core apps.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
`@mantis-core/ui` centralizes shared UI primitives so feature teams can build pages without duplicating component logic across projects.
|
|
8
|
+
|
|
9
|
+
## Scope
|
|
10
|
+
|
|
11
|
+
- Generic UI components for forms, tables, admin layout, maps, and pagination.
|
|
12
|
+
- Components intended to be reused by multiple verticals/apps.
|
|
13
|
+
- Components designed to work with `@mantis-core/styles` (`mantis-core-*` class contract).
|
|
14
|
+
|
|
15
|
+
## Out Of Scope
|
|
16
|
+
|
|
17
|
+
- Domain-specific workflows (real estate, restaurant, carpentry, etc).
|
|
18
|
+
- Business rules and domain orchestration.
|
|
19
|
+
- App-level provider setup (handled by `@mantis-core/next-core`).
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @mantis-core/ui @mantis-core/styles
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Make sure peer dependencies exist in the app (`react`, `react-dom`, `next`, `primereact`, `primeicons`).
|
|
28
|
+
|
|
29
|
+
## Styling Requirement
|
|
30
|
+
|
|
31
|
+
Components rely on style contracts from `@mantis-core/styles`.
|
|
32
|
+
Import the required SCSS modules in your app, for example:
|
|
33
|
+
|
|
34
|
+
```scss
|
|
35
|
+
@use "@mantis-core/styles/scss/table.scss";
|
|
36
|
+
@use "@mantis-core/styles/scss/paginator.scss";
|
|
37
|
+
@use "@mantis-core/styles/scss/inputs.scss";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Public API Strategy
|
|
41
|
+
|
|
42
|
+
Preferred import style:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { PaginatedTable, TableToolbar, FormFieldRender } from "@mantis-core/ui";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Supported subpath imports:
|
|
49
|
+
|
|
50
|
+
- `@mantis-core/ui/components/*`
|
|
51
|
+
- `@mantis-core/ui/table-toolbar`
|
|
52
|
+
- `@mantis-core/ui/table-filter-field`
|
|
53
|
+
|
|
54
|
+
Use subpaths only when you need explicit boundaries.
|
|
55
|
+
|
|
56
|
+
## Component Catalog
|
|
57
|
+
|
|
58
|
+
See full catalog in [COMPONENTS.md](./COMPONENTS.md).
|
|
59
|
+
|
|
60
|
+
Top-level categories:
|
|
61
|
+
|
|
62
|
+
- Buttons: `Button`
|
|
63
|
+
- Loaders: `Loading`
|
|
64
|
+
- Forms: `CKEditorInput`, `TextInput`, `Select`, `Switch`, `UploadFilesPreview`, etc
|
|
65
|
+
- Tables: `PaginatedTable`, `TableToolbar`, `TableFilterField`, `ActionColumn`, etc
|
|
66
|
+
- Page/Admin layout: `AdminPageConfigurator`, `AdminPageLayoutProvider`, `AdminPageLayoutShell`
|
|
67
|
+
- Generic UI: `Pagination`, `PaginationInfo`, `PageSizeSelector`, `RichTextPreview`
|
|
68
|
+
- Maps: `MapPicker`, `MapPickerClient`, `MapPickerOSM`
|
|
69
|
+
|
|
70
|
+
## Core Usage Patterns
|
|
71
|
+
|
|
72
|
+
### 1) Forms
|
|
73
|
+
|
|
74
|
+
- Compose fields with `FormFieldRender` + specific input components.
|
|
75
|
+
- Keep validation/business rules in the app layer.
|
|
76
|
+
|
|
77
|
+
### 2) Data Tables
|
|
78
|
+
|
|
79
|
+
Recommended stack:
|
|
80
|
+
|
|
81
|
+
1. `TableToolbar`
|
|
82
|
+
2. `TableFilterField` / `FilterPannel`
|
|
83
|
+
3. `PaginatedTable`
|
|
84
|
+
4. `Pagination` helpers when needed
|
|
85
|
+
|
|
86
|
+
### 3) Admin Page Layout
|
|
87
|
+
|
|
88
|
+
Use the layout contract together:
|
|
89
|
+
|
|
90
|
+
- `AdminPageLayoutProvider`
|
|
91
|
+
- `AdminPageLayoutShell`
|
|
92
|
+
- `AdminPageConfigurator`
|
|
93
|
+
|
|
94
|
+
### 4) Maps
|
|
95
|
+
|
|
96
|
+
- `MapPicker` is dynamic/SSR-safe wrapper.
|
|
97
|
+
- `MapPickerClient` and `MapPickerOSM` run on client.
|
|
98
|
+
|
|
99
|
+
## Architecture Rules For Contributors
|
|
100
|
+
|
|
101
|
+
1. New components must be domain-agnostic.
|
|
102
|
+
2. Avoid direct business terms in props, labels, or naming.
|
|
103
|
+
3. Keep runtime boundaries explicit (`"use client"` only when required).
|
|
104
|
+
4. Export through `src/index.ts` and document in `COMPONENTS.md`.
|
|
105
|
+
5. Preserve `mantis-core-*` visual contract for shared styles.
|
|
106
|
+
|
|
107
|
+
## Build
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pnpm --filter @mantis-core/ui build
|
|
111
|
+
pnpm --filter @mantis-core/ui typecheck
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Release Checklist
|
|
115
|
+
|
|
116
|
+
1. Component behavior verified in consuming app.
|
|
117
|
+
2. Props/types documented.
|
|
118
|
+
3. `src/index.ts` export updated.
|
|
119
|
+
4. `COMPONENTS.md` updated.
|
|
120
|
+
5. Add changeset.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Button as PrimeButton, ButtonProps as PrimeButtonProps } from "primereact/button";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type ButtonVariant = "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info" | "gray" | "danger";
|
|
4
|
+
interface BaseProps extends Omit<PrimeButtonProps, "onClick" | "ref"> {
|
|
5
|
+
href?: string;
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
outlined?: boolean;
|
|
8
|
+
block?: boolean;
|
|
9
|
+
sm?: boolean;
|
|
10
|
+
lg?: boolean;
|
|
11
|
+
text?: boolean;
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
accessKey?: string;
|
|
14
|
+
onClick?: PrimeButtonProps["onClick"];
|
|
15
|
+
}
|
|
16
|
+
export type ButtonProps = BaseProps;
|
|
17
|
+
declare const Button: React.ForwardRefExoticComponent<BaseProps & React.RefAttributes<PrimeButton>>;
|
|
18
|
+
export default Button;
|
|
19
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Buttons/Button.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAuD,MAAM,OAAO,CAAC;AAM5E,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,CAAC;AAEb,UAAU,SAAU,SAAQ,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,KAAK,CAAC;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CACvC;AAKD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AAGpC,QAAA,MAAM,MAAM,+EAkEX,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import { Button as PrimeButton } from "primereact/button";
|
|
6
|
+
import { forwardRef, useCallback, useMemo } from "react";
|
|
7
|
+
const Button = forwardRef(({ sm = false, lg = false, block = false, outlined = false, href, text = false, rounded = false, accessKey, variant = "primary", className, onClick, type = "button", children, ...rest }, ref) => {
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
// stable handler avoids re-renders of downstream memoized components
|
|
10
|
+
const handleClick = useCallback((evt) => {
|
|
11
|
+
onClick?.(evt);
|
|
12
|
+
if (href) {
|
|
13
|
+
router.push(href);
|
|
14
|
+
}
|
|
15
|
+
}, [onClick, href, router]);
|
|
16
|
+
const classes = useMemo(() => classNames(`p-button-${variant}`, {
|
|
17
|
+
"w-full": block,
|
|
18
|
+
}, className), [variant, block, className]);
|
|
19
|
+
// Because PrimeReact button comes with a couple of generic size
|
|
20
|
+
// values we keep the prop around but don't hard‑code the string
|
|
21
|
+
// (previously ignored with ts‑ignore). When the library adds more
|
|
22
|
+
// sizes we can expose them here.
|
|
23
|
+
return (_jsx(PrimeButton, { ref: ref, className: classes, text: text, outlined: outlined, rounded: rounded, size: sm ? "small" : lg ? "large" : undefined, onClick: handleClick, type: type, accessKey: accessKey, ...rest, children: children }));
|
|
24
|
+
});
|
|
25
|
+
Button.displayName = "Button";
|
|
26
|
+
export default Button;
|
|
27
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Buttons/Button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,WAAW,EAAmC,MAAM,mBAAmB,CAAC;AAC3F,OAAc,EAAE,UAAU,EAAc,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAoC5E,MAAM,MAAM,GAAG,UAAU,CACvB,CACE,EACE,EAAE,GAAG,KAAK,EACV,EAAE,GAAG,KAAK,EACV,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,EAChB,IAAI,EACJ,IAAI,GAAG,KAAK,EACZ,OAAO,GAAG,KAAK,EACf,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,SAAS,EACT,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,QAAQ,EACR,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,qEAAqE;IACrE,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,GAAkC,EAAE,EAAE;QACrC,OAAO,EAAE,CAAC,GAAU,CAAC,CAAC;QACtB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CACxB,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CACH,UAAU,CACR,YAAY,OAAO,EAAE,EACrB;QACE,QAAQ,EAAE,KAAK;KAChB,EACD,SAAS,CACV,EACH,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAC5B,CAAC;IAEF,gEAAgE;IAChE,gEAAgE;IAChE,kEAAkE;IAClE,iCAAiC;IAEjC,OAAO,CACL,KAAC,WAAW,IACV,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC7C,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,KAChB,IAAI,YACP,QAAQ,GACG,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EditorConfig } from "ckeditor5";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ControllerProps } from "./types";
|
|
4
|
+
type CKEditorPreset = "default" | "blog" | "property" | "note";
|
|
5
|
+
export type CKEditorContentMetrics = {
|
|
6
|
+
plainText: string;
|
|
7
|
+
words: number;
|
|
8
|
+
characters: number;
|
|
9
|
+
readTimeMinutes: number;
|
|
10
|
+
};
|
|
11
|
+
export interface CKEditorInputProps {
|
|
12
|
+
controller: ControllerProps;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
preset?: CKEditorPreset;
|
|
18
|
+
toolbarItems?: string[];
|
|
19
|
+
minHeight?: string;
|
|
20
|
+
maxHeight?: string;
|
|
21
|
+
showStats?: boolean;
|
|
22
|
+
validateNonEmptyHtml?: boolean;
|
|
23
|
+
requiredMessage?: string;
|
|
24
|
+
config?: EditorConfig;
|
|
25
|
+
onReady?: (editor: any) => void;
|
|
26
|
+
onHtmlChange?: (html: string) => void;
|
|
27
|
+
onPlainTextChange?: (plainText: string) => void;
|
|
28
|
+
onMetricsChange?: (metrics: CKEditorContentMetrics) => void;
|
|
29
|
+
}
|
|
30
|
+
declare const CKEditorInput: React.FC<CKEditorInputProps>;
|
|
31
|
+
export default CKEditorInput;
|
|
32
|
+
//# sourceMappingURL=CKEditorInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CKEditorInput.d.ts","sourceRoot":"","sources":["../../../src/components/Forms/CKEditorInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAKL,YAAY,EAqBb,MAAM,WAAW,CAAC;AAGnB,OAAO,KAA0B,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AA6K/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAmEF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,eAAe,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC7D;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAiN/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|