sls-ui-library 1.0.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/README.md +152 -0
- package/dist/sls-ui.es.js +2236 -0
- package/dist/sls-ui.umd.js +175 -0
- package/dist/style.css +1 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# sls-ui
|
|
2
|
+
|
|
3
|
+
A standalone, reusable **React + Tailwind** component library (plain JavaScript —
|
|
4
|
+
no TypeScript) built from the **SLS – Software License System** component spec
|
|
5
|
+
(`SLS_React_Componants_Updated.docx`). This package contains **only the
|
|
6
|
+
component library** (`src/components`, `src/theme`) — `src/App.jsx` is a local
|
|
7
|
+
dev preview harness, not part of the published library.
|
|
8
|
+
|
|
9
|
+
Every label, option, column header, and message shown in the preview app is
|
|
10
|
+
copied verbatim from the doc's own screenshots — nothing outside the
|
|
11
|
+
documentation was invented for the demo content.
|
|
12
|
+
|
|
13
|
+
## What's in here
|
|
14
|
+
|
|
15
|
+
- **`src/theme/tokens.js`** — the 4 color themes (`slate-navy`, `arctic-white`,
|
|
16
|
+
`carbon-pro`, `narnix-edge`) exactly as provided, plus `CSS_VAR_MAP`. Unchanged.
|
|
17
|
+
- **`src/theme/ThemeProvider.jsx`** — writes a theme's tokens onto `:root` (or
|
|
18
|
+
any wrapped subtree) as CSS custom properties (`--accent-primary`,
|
|
19
|
+
`--card-bg`, …). Every component is styled with Tailwind classes that resolve
|
|
20
|
+
through these variables (`bg-card`, `text-ink-primary`, `border-card-border`,
|
|
21
|
+
…), so switching themes never touches component code.
|
|
22
|
+
- **`src/components/common/*`** — ~30 generic, reusable primitives: Button,
|
|
23
|
+
IconButton, FloatingAddButton, InputField, PasswordInput,
|
|
24
|
+
PasswordStrengthMeter, Dropdown, MultiSelectDropdown, DatePicker,
|
|
25
|
+
DateRangePicker (preset list + dual calendar, matching the doc screenshot),
|
|
26
|
+
Checkbox, ToggleButtonGroup, SearchBox, Loader, Modal, ConfirmDialog,
|
|
27
|
+
FormModal, SlideOverModal, DataTable, ColumnFilterDropdown,
|
|
28
|
+
RowSelectCheckbox, Pagination, Badge, Card, Panel, Tabs, FilterPanel,
|
|
29
|
+
DynamicRowList, FormGroup, ValidationMessage, TableToolbar.
|
|
30
|
+
- **`src/components/layout/*`** — MainLayout, AuthLayout, Header, Sidebar,
|
|
31
|
+
Footer, ProfileMenu.
|
|
32
|
+
- **`src/components/feature/*`** — the feature-level components the spec marks
|
|
33
|
+
"Reusable: Yes": InvoicePreviewModal, ReportWidget, ChangesPreviewModal.
|
|
34
|
+
|
|
35
|
+
## Components grounded in the doc's exact text
|
|
36
|
+
|
|
37
|
+
- **Button** — the two labels shown in the doc's own Button screenshot: `Close`
|
|
38
|
+
/ `Ok`.
|
|
39
|
+
- **ConfirmDialog** — title `Deletion Confirmation`, message `Are you sure you
|
|
40
|
+
want to delete the license?`, buttons `Close` / `Ok` — copied from the doc's
|
|
41
|
+
Modal screenshot.
|
|
42
|
+
- **Dropdown** — options `Corporate` / `Retailer`.
|
|
43
|
+
- **MultiSelectDropdown** — options `EnviroFRONT` / `OCEMS` / `SolarFRONT`.
|
|
44
|
+
- **DateRangePicker** — presets `This Financial Year`, `This Month`,
|
|
45
|
+
`Last Month`, `Next Month`, `This Quarter`, `This Year`, `Last Year`,
|
|
46
|
+
`Custom Range`, with `Cancel` / `Apply`, matching the doc's picker screenshot.
|
|
47
|
+
- **ToggleButtonGroup** — `Issue Date` / `Activation Date`.
|
|
48
|
+
- **DataTable** — `NAME` / `STATUS` columns with the doc's four sample rows
|
|
49
|
+
(`Desktop Application`, `Device`, `One-time DL FTP Configuration`,
|
|
50
|
+
`Web Application`).
|
|
51
|
+
- **Pagination** — the doc's `« 1-4 of 4 »` range style (not numbered pages).
|
|
52
|
+
- **ColumnFilterDropdown** — checkbox list `Account`, `Site Name`,
|
|
53
|
+
`License Type`, `License Key`, `Invoice No`, `Amount`.
|
|
54
|
+
- **Badge** — `PI - ₹60,475.00`, `Invoice - ₹0.00`, `Pending - ₹60,475.00`,
|
|
55
|
+
`Cancel - ₹0.00`.
|
|
56
|
+
- **Card** — the profile card content (`Super Admin`, `admin@m2mlogger.com`,
|
|
57
|
+
`Manage your SLS Account`, `Sign out`).
|
|
58
|
+
- **Tabs** — `Performa Invoice` / `Tax Invoice`.
|
|
59
|
+
- **FilterPanel** — `Product` / `Name` fields, `Clear filters` / `Search`.
|
|
60
|
+
- **FormModal** — used as the doc's `Change Password` dialog (`New Password` /
|
|
61
|
+
`Confirm Password`, `Close` / `Ok`).
|
|
62
|
+
- **Modal (Timeline)** — the doc's Timeline entries (`Change Site`,
|
|
63
|
+
`Activate License`, `New account added`, …).
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
import { ThemeProvider, Button, Card, InputField } from "sls-ui";
|
|
69
|
+
import "sls-ui/dist/index.css"; // Tailwind output, once built
|
|
70
|
+
|
|
71
|
+
function App() {
|
|
72
|
+
return (
|
|
73
|
+
<ThemeProvider theme="carbon-pro">
|
|
74
|
+
<Card>
|
|
75
|
+
<InputField label="Name" required />
|
|
76
|
+
<Button variant="outline">Ok</Button>
|
|
77
|
+
</Card>
|
|
78
|
+
</ThemeProvider>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Changing / adding themes
|
|
84
|
+
|
|
85
|
+
Everything lives in one file: `src/theme/tokens.js`. To add a 5th theme, add a
|
|
86
|
+
new entry to `THEMES` with the same shape — no component changes needed. Drop
|
|
87
|
+
in `<ThemeSwitcher />` (exported from `src/theme`) to let a user switch at
|
|
88
|
+
runtime, or call `useTheme().setTheme("arctic-white")` from anywhere inside
|
|
89
|
+
`<ThemeProvider>`.
|
|
90
|
+
|
|
91
|
+
## Local development
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm install
|
|
95
|
+
npm run dev # Vite dev server — opens App.jsx, a preview harness only
|
|
96
|
+
npm run build # vite build — verifies the whole library builds cleanly
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
|
|
101
|
+
- **No TypeScript anywhere** — the whole project is plain JavaScript (`.js` /
|
|
102
|
+
`.jsx`). No `tsconfig.json`, no `@types/*`, no type annotations.
|
|
103
|
+
- Tailwind's `tailwind.config.js` maps each theme token to a utility class
|
|
104
|
+
(e.g. `--accent-primary` → `bg-accent`, `text-accent`, `border-accent`), so
|
|
105
|
+
components never hardcode hex colors.
|
|
106
|
+
- `fontFamily`, `borderRadius`, and `boxShadow` scales in `tailwind.config.js`
|
|
107
|
+
come from the design-tokens JSON you provided (Source Sans 3 / Cabin /
|
|
108
|
+
JetBrains Mono, the 8-step radius scale, and the shadow ramp).
|
|
109
|
+
- `Modal` and `SlideOverModal` render via `createPortal` into `document.body`.
|
|
110
|
+
|
|
111
|
+
## Interactive pages added from the full component spec
|
|
112
|
+
|
|
113
|
+
Beyond the shared `src/components/common` / `layout` / `feature` library, this
|
|
114
|
+
build now wires up the page- and feature-level components from the full
|
|
115
|
+
`SLS_React_Componants_Updated.docx` spec into a real, click-through app
|
|
116
|
+
(`src/App.jsx` is the entry point — still a dev harness, not part of the
|
|
117
|
+
published library import):
|
|
118
|
+
|
|
119
|
+
- **Auth** (`src/pages/auth/`) — `LoginForm` (checks the email, `admin@m2mlogger.com`
|
|
120
|
+
works) → `LoginPasswordForm` (any password signs in) → main app.
|
|
121
|
+
- **License** (`src/pages/LicensePage.jsx` + `src/components/feature/license/*`)
|
|
122
|
+
— the full toolbar (add/edit/delete/activate/deactivate/update property/
|
|
123
|
+
renewal/history/invoice/download) is wired to real state over an in-memory
|
|
124
|
+
license list: `LicenseFormModal`, `DeleteLicenseModal`, `ActivateLicenseModal`,
|
|
125
|
+
`DeactivateLicenseModal`, `UpdatePropertyModal`, `LicenseFilter`,
|
|
126
|
+
`TimelineModal`, `HistoryPiInvoiceModal`, `SingleLicensePreviewModal`,
|
|
127
|
+
`LicenseRenewalModal`, `ManageRenewalStreamModal`, `ValidateTicketModal`,
|
|
128
|
+
`CancelPiModal`, `SelectionRowPreviewModal`, `LicenseToolbar`,
|
|
129
|
+
`LicenseAgentButton`.
|
|
130
|
+
- **Users** (`src/pages/UsersPage.jsx` + `src/components/feature/users/*`) —
|
|
131
|
+
`UserFormModal`, `UsersFilter`, activate/deactivate.
|
|
132
|
+
- **Masters** (`src/pages/masters/*` + `src/components/feature/masters/*`) —
|
|
133
|
+
`LicenseTypePage`/`LicenseTypeFormModal`, `LicenseTermPage`/
|
|
134
|
+
`LicenseTermFormModal`, `ProductTypePage`/`ProductTypeFormModal`, all built
|
|
135
|
+
on a shared `MasterListPage` CRUD pattern.
|
|
136
|
+
- **Report** (`src/pages/ReportPage.jsx` + `src/components/feature/report/*`)
|
|
137
|
+
— `ReportFilter`, `InvoicePdfViewer`, `ExcelPreviewViewer`, wired into
|
|
138
|
+
`InvoicePreviewModal`.
|
|
139
|
+
- **Dashboard** (`src/pages/SlsReportDashboard.jsx` +
|
|
140
|
+
`src/components/feature/dashboard/*`) — `UpcomingRenewalChart`,
|
|
141
|
+
`LicenseTrendChart`, `ReportWidget` (reload/export/filter all work),
|
|
142
|
+
`ChangesPreviewModal`.
|
|
143
|
+
- **Home (legacy)** (`src/pages/HomeDashboard.jsx`) — customer filter over a
|
|
144
|
+
materials table.
|
|
145
|
+
- **Profile** (`src/pages/UserProfilePage.jsx` +
|
|
146
|
+
`src/components/feature/profile/*`) — `ProfileActions` (rename / change
|
|
147
|
+
permission / change password), `PermissionEditor`, `ChangePasswordModal`.
|
|
148
|
+
|
|
149
|
+
Every button documented in the spec (Add, Edit, Delete, Activate, Deactivate,
|
|
150
|
+
Filter, Reload, Export, Download, Sign in, Sign out, etc.) triggers a real
|
|
151
|
+
state change or opens a real modal — nothing is a visual dead end. Toasts
|
|
152
|
+
(bottom-center) confirm the result of most actions.
|