aravint-ui-navigation 1.0.69 → 1.0.70
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 +39 -57
- package/dist/navigation.cjs.js +8 -8
- package/dist/navigation.es.js +252 -251
- package/dist/types/types/SummaryDetailsCard.d.ts +2 -1
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -265,7 +265,16 @@ by dividers (e.g. PNC/RDR detail header, ticket summary, order details).
|
|
|
265
265
|
## Usage
|
|
266
266
|
|
|
267
267
|
```tsx
|
|
268
|
-
import
|
|
268
|
+
import { DetailRow, SummaryDetailsCard } from "@digitus-fci-oa/navigation";
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
## Import Styles
|
|
273
|
+
|
|
274
|
+
Import the stylesheet once in your application's global CSS file (e.g. `index.css` or `App.css`).
|
|
275
|
+
|
|
276
|
+
```css
|
|
277
|
+
@import "@digitus-fci-oa/navigation/dist/navigation.css";
|
|
269
278
|
|
|
270
279
|
const rows: DetailRow[] = [
|
|
271
280
|
[
|
|
@@ -294,65 +303,12 @@ const rows: DetailRow[] = [
|
|
|
294
303
|
/>
|
|
295
304
|
```
|
|
296
305
|
|
|
297
|
-
`value` accepts a `ReactNode`, so a field can render client-provided JSX such as a table. Use `span` to control the field width; with four columns, a one-column summary field beside a three-column table matches layouts such as a charge summary:
|
|
298
|
-
|
|
299
|
-
```tsx
|
|
300
|
-
const charges = [
|
|
301
|
-
{ range: 'From 1kg to 44 Kg', rate: '1.31' },
|
|
302
|
-
{ range: 'From 45kg to 99kg', rate: '1.31' },
|
|
303
|
-
{ range: 'From 100kg to 249kg', rate: '1.31' },
|
|
304
|
-
];
|
|
305
|
-
|
|
306
|
-
const airFreightRows: DetailRow[] = [
|
|
307
|
-
[
|
|
308
|
-
{ label: 'Minimum Charge', value: '150.00' },
|
|
309
|
-
{
|
|
310
|
-
label: '',
|
|
311
|
-
span: 3,
|
|
312
|
-
value: (
|
|
313
|
-
<div className="air-freight-table-wrap">
|
|
314
|
-
<table className="air-freight-table">
|
|
315
|
-
<tbody>
|
|
316
|
-
{charges.map(({ range, rate }) => (
|
|
317
|
-
<tr key={range}>
|
|
318
|
-
<td>{range}</td>
|
|
319
|
-
<td>{rate}</td>
|
|
320
|
-
</tr>
|
|
321
|
-
))}
|
|
322
|
-
</tbody>
|
|
323
|
-
</table>
|
|
324
|
-
</div>
|
|
325
|
-
),
|
|
326
|
-
},
|
|
327
|
-
],
|
|
328
|
-
];
|
|
329
|
-
|
|
330
|
-
<SummaryDetailsCard rows={airFreightRows} columns={4} title="Air Freight Charges" />
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
Style custom content in the consuming app. For example:
|
|
334
|
-
|
|
335
|
-
```css
|
|
336
|
-
.air-freight-table-wrap {
|
|
337
|
-
overflow-x: auto;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.air-freight-table {
|
|
341
|
-
width: 100%;
|
|
342
|
-
border-collapse: collapse;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.air-freight-table td {
|
|
346
|
-
border: 1px solid #e5e7eb;
|
|
347
|
-
padding: 0.5rem;
|
|
348
|
-
}
|
|
349
|
-
```
|
|
350
|
-
|
|
351
306
|
## Props
|
|
352
307
|
|
|
353
308
|
| Prop | Type | Default | Description |
|
|
354
309
|
| ------------------ | ------------- | -------------- | ---------------------------------------------- |
|
|
355
|
-
| `rows` | `DetailRow[]` | — |
|
|
310
|
+
| `rows` | `DetailRow[]` | — | Optional rows of fields, top to bottom, each row on its own divider-separated line. Used when `children` is not provided. |
|
|
311
|
+
| `children` | `ReactNode` | — | Optional custom body content rendered inside the card, useful for tables or client-specific layouts. |
|
|
356
312
|
| `className` | `string` | `'mt-2 mx-2'` | Extra classes on the outer card |
|
|
357
313
|
| `showRowDividers` | `boolean` | `true` | Show a top border between rows |
|
|
358
314
|
| `columns` | `1 \| 2 \| 3 \| 4` | `4` | Number of columns in each row on desktop/tablet |
|
|
@@ -360,12 +316,38 @@ Style custom content in the consuming app. For example:
|
|
|
360
316
|
| `title` | `ReactNode` | — | Optional title shown in the card header |
|
|
361
317
|
| `onEdit` | `() => void` | — | Optional callback; when provided, shows an Edit button that calls it |
|
|
362
318
|
|
|
319
|
+
### Custom Body
|
|
320
|
+
|
|
321
|
+
Pass content as children when the client needs a custom layout, such as a table.
|
|
322
|
+
The card retains its title and Edit button, and `children` takes precedence over `rows`.
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
<SummaryDetailsCard title="Air Freight Charges" onEdit={handleEdit}>
|
|
326
|
+
<div className="air-freight-summary">
|
|
327
|
+
<div>
|
|
328
|
+
<p>Minimum Charge</p>
|
|
329
|
+
<strong>150.00</strong>
|
|
330
|
+
</div>
|
|
331
|
+
<table>
|
|
332
|
+
<tbody>
|
|
333
|
+
{charges.map((charge) => (
|
|
334
|
+
<tr key={charge.range}>
|
|
335
|
+
<td>{charge.range}</td>
|
|
336
|
+
<td>{charge.rate}</td>
|
|
337
|
+
</tr>
|
|
338
|
+
))}
|
|
339
|
+
</tbody>
|
|
340
|
+
</table>
|
|
341
|
+
</div>
|
|
342
|
+
</SummaryDetailsCard>
|
|
343
|
+
```
|
|
344
|
+
|
|
363
345
|
### Field (`DetailRow` = `DetailField[]`)
|
|
364
346
|
|
|
365
347
|
| Prop | Type | Default | Description |
|
|
366
348
|
| ------- | ------------------- | ----------- | ------------------------------------------------------------------------------------ |
|
|
367
349
|
| `label` | `string` | — | Small uppercase label |
|
|
368
|
-
| `value` | `ReactNode` | — |
|
|
350
|
+
| `value` | `ReactNode` | — | The value to display |
|
|
369
351
|
| `valueColor` | `CSSProperties['color']` | — | Optional CSS color for this field's value |
|
|
370
352
|
| `size` | `'default' \| 'lg'` | `'default'` | `'lg'` for hero fields like Title/Remark |
|
|
371
353
|
| `span` | `1 \| 2 \| 3 \| 4` | `1` | How many of the 4 grid columns this field occupies (desktop/tablet — mobile is always full width) |
|