@camtomlabs/malix-design-system 0.3.0 → 0.4.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/README.md +69 -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 +5 -2
- package/src/compat-bootstrap.css +51 -0
- package/src/styles.css +127 -0
package/README.md
CHANGED
|
@@ -46,6 +46,27 @@ Layer cascade order:
|
|
|
46
46
|
malix-reset → malix-tokens → malix-components → app
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
### Using Malix alongside Bootstrap (or other unlayered frameworks)
|
|
50
|
+
|
|
51
|
+
CSS spec: **unlayered styles always beat layered styles**, regardless of
|
|
52
|
+
source order or specificity. Since Bootstrap, Tailwind Preflight, and most
|
|
53
|
+
legacy CSS frameworks don't use `@layer`, their global `body` rules will
|
|
54
|
+
override Malix's layered reset.
|
|
55
|
+
|
|
56
|
+
Import the compatibility stylesheet **after** Bootstrap and Malix:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
60
|
+
import '@camtomlabs/malix-design-system/reset.css'; // optional
|
|
61
|
+
import '@camtomlabs/malix-design-system/styles.css';
|
|
62
|
+
import '@camtomlabs/malix-design-system/compat-bootstrap.css'; // ← add this
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This file is intentionally unlayered so it wins over Bootstrap's global
|
|
66
|
+
`body { font-family }`, `a { color }`, and heading declarations. It only
|
|
67
|
+
overrides properties where Bootstrap and Malix conflict — it is safe to
|
|
68
|
+
import even if you later remove Bootstrap.
|
|
69
|
+
|
|
49
70
|
## Usage
|
|
50
71
|
|
|
51
72
|
```tsx
|
|
@@ -83,6 +104,13 @@ Sizes: `'xs'` (12px), `'sm'` (14px), `'md'` (16px), `'lg'` (20px), `'xl'` (24px)
|
|
|
83
104
|
Malix ships an ESLint plugin that catches raw `<button>` and `<input>`
|
|
84
105
|
elements and tells you to use `<Button>` / `<Input>` from the DS.
|
|
85
106
|
|
|
107
|
+
Install the sibling plugin package alongside the main package so that
|
|
108
|
+
classic ESLint config can resolve `@camtomlabs/malix` automatically:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pnpm add -D @camtomlabs/eslint-plugin-malix
|
|
112
|
+
```
|
|
113
|
+
|
|
86
114
|
```js
|
|
87
115
|
// .eslintrc.cjs
|
|
88
116
|
module.exports = {
|
|
@@ -109,6 +137,11 @@ You can escape the rule with a standard disable comment when needed:
|
|
|
109
137
|
|
|
110
138
|
The `no-raw-input` rule allows `type="hidden"` and `type="file"` by default.
|
|
111
139
|
|
|
140
|
+
> **Legacy subpath export.** The `@camtomlabs/malix-design-system/eslint-plugin`
|
|
141
|
+
> subpath export still works but is considered legacy — classic ESLint
|
|
142
|
+
> configs can't resolve plugin names from subpath exports. Prefer installing
|
|
143
|
+
> `@camtomlabs/eslint-plugin-malix` directly.
|
|
144
|
+
|
|
112
145
|
## Theme Provider
|
|
113
146
|
|
|
114
147
|
Malix includes a React theme provider for managing dark mode:
|
|
@@ -232,11 +265,46 @@ import { tokenRegistry } from '@camtomlabs/malix-design-system';
|
|
|
232
265
|
### Overlays
|
|
233
266
|
| Component | Description |
|
|
234
267
|
|-----------|-------------|
|
|
268
|
+
| `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.** |
|
|
269
|
+
| `ConfirmDialog` | Preset confirm/cancel dialog with title + description + icon. Variants: `default \| danger \| warning \| info`. Use for simple binary confirmations. |
|
|
270
|
+
| `Modal` | Opinionated glass-style modal with fixed header/body/footer preset. Legacy — prefer `Dialog` for new code. |
|
|
235
271
|
| `GlassPopover` | Glassmorphism-styled popover |
|
|
236
|
-
| `Modal` | Full-screen modal dialog |
|
|
237
272
|
| `OnboardingPopover` | Guided onboarding popover |
|
|
238
273
|
| `Overlay` | Backdrop overlay layer |
|
|
239
274
|
|
|
275
|
+
#### Dialog usage
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import { Dialog, Button } from '@camtomlabs/malix-design-system';
|
|
279
|
+
|
|
280
|
+
function DeleteCatalogDialog({ open, onClose, onDelete }) {
|
|
281
|
+
return (
|
|
282
|
+
<Dialog open={open} onClose={onClose} variant="danger" size="sm" role="alertdialog">
|
|
283
|
+
<Dialog.Header>Delete catalog?</Dialog.Header>
|
|
284
|
+
<Dialog.Body>
|
|
285
|
+
This action cannot be undone. All related glosas and flags will be
|
|
286
|
+
permanently removed.
|
|
287
|
+
</Dialog.Body>
|
|
288
|
+
<Dialog.Footer>
|
|
289
|
+
<Button hierarchy="secondary" onClick={onClose}>Cancel</Button>
|
|
290
|
+
<Button hierarchy="danger" onClick={onDelete}>Delete</Button>
|
|
291
|
+
</Dialog.Footer>
|
|
292
|
+
</Dialog>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
`Dialog` handles all the modal plumbing for you:
|
|
298
|
+
|
|
299
|
+
- **Portal to `document.body`** — immune to `transform` / `overflow: hidden` ancestors
|
|
300
|
+
- **Focus trap** — Tab cycles within the panel
|
|
301
|
+
- **Escape to close** (disable via `closeOnEsc={false}`)
|
|
302
|
+
- **Backdrop click to close** (disable via `closeOnBackdropClick={false}`)
|
|
303
|
+
- **Body scroll lock** while open
|
|
304
|
+
- **Focus restore** — returns focus to the trigger on close
|
|
305
|
+
- **ARIA wiring** — `aria-labelledby` / `aria-describedby` auto-generated via `useId`
|
|
306
|
+
- **`role="alertdialog"`** opt-in for urgent confirm flows
|
|
307
|
+
|
|
240
308
|
### Interactive / Composite
|
|
241
309
|
| Component | Description |
|
|
242
310
|
|-----------|-------------|
|