@camtomlabs/malix-design-system 0.3.0 → 0.4.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 +48 -1
- package/dist/index.cjs +452 -291
- package/dist/index.d.cts +97 -3
- package/dist/index.d.ts +97 -3
- package/dist/index.js +437 -277
- package/package.json +1 -1
- package/src/styles.css +127 -0
package/README.md
CHANGED
|
@@ -83,6 +83,13 @@ Sizes: `'xs'` (12px), `'sm'` (14px), `'md'` (16px), `'lg'` (20px), `'xl'` (24px)
|
|
|
83
83
|
Malix ships an ESLint plugin that catches raw `<button>` and `<input>`
|
|
84
84
|
elements and tells you to use `<Button>` / `<Input>` from the DS.
|
|
85
85
|
|
|
86
|
+
Install the sibling plugin package alongside the main package so that
|
|
87
|
+
classic ESLint config can resolve `@camtomlabs/malix` automatically:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm add -D @camtomlabs/eslint-plugin-malix
|
|
91
|
+
```
|
|
92
|
+
|
|
86
93
|
```js
|
|
87
94
|
// .eslintrc.cjs
|
|
88
95
|
module.exports = {
|
|
@@ -109,6 +116,11 @@ You can escape the rule with a standard disable comment when needed:
|
|
|
109
116
|
|
|
110
117
|
The `no-raw-input` rule allows `type="hidden"` and `type="file"` by default.
|
|
111
118
|
|
|
119
|
+
> **Legacy subpath export.** The `@camtomlabs/malix-design-system/eslint-plugin`
|
|
120
|
+
> subpath export still works but is considered legacy — classic ESLint
|
|
121
|
+
> configs can't resolve plugin names from subpath exports. Prefer installing
|
|
122
|
+
> `@camtomlabs/eslint-plugin-malix` directly.
|
|
123
|
+
|
|
112
124
|
## Theme Provider
|
|
113
125
|
|
|
114
126
|
Malix includes a React theme provider for managing dark mode:
|
|
@@ -232,11 +244,46 @@ import { tokenRegistry } from '@camtomlabs/malix-design-system';
|
|
|
232
244
|
### Overlays
|
|
233
245
|
| Component | Description |
|
|
234
246
|
|-----------|-------------|
|
|
247
|
+
| `Dialog` | **Composable modal** with `Dialog.Header` / `Dialog.Body` / `Dialog.Footer` slots. Portal + focus trap + scroll lock + focus restore. Variants: `default \| danger \| warning \| info`. Sizes: `sm \| md \| lg`. **Prefer this for custom modal layouts.** |
|
|
248
|
+
| `ConfirmDialog` | Preset confirm/cancel dialog with title + description + icon. Variants: `default \| danger \| warning \| info`. Use for simple binary confirmations. |
|
|
249
|
+
| `Modal` | Opinionated glass-style modal with fixed header/body/footer preset. Legacy — prefer `Dialog` for new code. |
|
|
235
250
|
| `GlassPopover` | Glassmorphism-styled popover |
|
|
236
|
-
| `Modal` | Full-screen modal dialog |
|
|
237
251
|
| `OnboardingPopover` | Guided onboarding popover |
|
|
238
252
|
| `Overlay` | Backdrop overlay layer |
|
|
239
253
|
|
|
254
|
+
#### Dialog usage
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
import { Dialog, Button } from '@camtomlabs/malix-design-system';
|
|
258
|
+
|
|
259
|
+
function DeleteCatalogDialog({ open, onClose, onDelete }) {
|
|
260
|
+
return (
|
|
261
|
+
<Dialog open={open} onClose={onClose} variant="danger" size="sm" role="alertdialog">
|
|
262
|
+
<Dialog.Header>Delete catalog?</Dialog.Header>
|
|
263
|
+
<Dialog.Body>
|
|
264
|
+
This action cannot be undone. All related glosas and flags will be
|
|
265
|
+
permanently removed.
|
|
266
|
+
</Dialog.Body>
|
|
267
|
+
<Dialog.Footer>
|
|
268
|
+
<Button hierarchy="secondary" onClick={onClose}>Cancel</Button>
|
|
269
|
+
<Button hierarchy="danger" onClick={onDelete}>Delete</Button>
|
|
270
|
+
</Dialog.Footer>
|
|
271
|
+
</Dialog>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
`Dialog` handles all the modal plumbing for you:
|
|
277
|
+
|
|
278
|
+
- **Portal to `document.body`** — immune to `transform` / `overflow: hidden` ancestors
|
|
279
|
+
- **Focus trap** — Tab cycles within the panel
|
|
280
|
+
- **Escape to close** (disable via `closeOnEsc={false}`)
|
|
281
|
+
- **Backdrop click to close** (disable via `closeOnBackdropClick={false}`)
|
|
282
|
+
- **Body scroll lock** while open
|
|
283
|
+
- **Focus restore** — returns focus to the trigger on close
|
|
284
|
+
- **ARIA wiring** — `aria-labelledby` / `aria-describedby` auto-generated via `useId`
|
|
285
|
+
- **`role="alertdialog"`** opt-in for urgent confirm flows
|
|
286
|
+
|
|
240
287
|
### Interactive / Composite
|
|
241
288
|
| Component | Description |
|
|
242
289
|
|-----------|-------------|
|