@apliteni/apliteni-ui 0.41.5 → 0.42.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/package.json +1 -1
- package/react/README.md +30 -2
- package/react/dist/index.css +28 -0
- package/react/dist/index.d.ts +17 -1
- package/react/dist/index.js +26 -0
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -73,8 +73,7 @@ focus is already back on the opener and the dialog takes no clicks.
|
|
|
73
73
|
A panel that slides in from an edge of the screen over a scrim. It renders the vanilla
|
|
74
74
|
`drawer()` markup, class for class, so it looks and moves like the kit's drawer, and like
|
|
75
75
|
`Pagination` its styles come from `@apliteni/apliteni-ui/css` rather than from this bundle.
|
|
76
|
-
Group
|
|
77
|
-
and value rows — rather than in cards; the rules are on Guidelines / Drawers.
|
|
76
|
+
Group its contents with `DrawerSection` and `KeyValueList`; see Guidelines / Drawers.
|
|
78
77
|
|
|
79
78
|
```tsx
|
|
80
79
|
<Drawer open={open} title="Transaction" onClose={() => setOpen(false)}
|
|
@@ -292,3 +291,32 @@ Clearing the page-jump box, or typing into it and then pressing a step, does not
|
|
|
292
291
|
page.
|
|
293
292
|
|
|
294
293
|
`pageSize` defaults to `DEFAULT_PAGE_SIZE` (100). **Breaking:** it used to default to 4.
|
|
294
|
+
|
|
295
|
+
## KeyValueList and DrawerSection
|
|
296
|
+
|
|
297
|
+
KeyValueList displays one record’s facts with labels beside their values. Pass rows
|
|
298
|
+
with a label and a React value. Set `columns={2}` to show two label-value pairs on
|
|
299
|
+
each line. Null and undefined values are displayed as an em dash. Boolean values
|
|
300
|
+
are displayed as `false` or `true`, zero remains visible, and strings are preserved.
|
|
301
|
+
Set `redacted` on a row to display “Hidden” with an eye-off icon without rendering
|
|
302
|
+
the value. Below 560px, each label appears above its value, and the layout
|
|
303
|
+
changes to one column.
|
|
304
|
+
|
|
305
|
+
DrawerSection groups content under a heading and adds a hairline between adjacent
|
|
306
|
+
sections. Its `headingLevel` defaults to 3. Import both the kit CSS and the React
|
|
307
|
+
CSS. Use a table for figures that readers need to compare down a column.
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
import { DrawerSection, KeyValueList } from '@apliteni/apliteni-ui/react';
|
|
311
|
+
import '@apliteni/apliteni-ui/css';
|
|
312
|
+
import '@apliteni/apliteni-ui/react/css';
|
|
313
|
+
|
|
314
|
+
<DrawerSection title="Transaction">
|
|
315
|
+
<KeyValueList rows={[
|
|
316
|
+
{ label: 'Reference', value: <a href="/invoices/1001">INV-1001</a> },
|
|
317
|
+
{ label: 'Amount', value: '€ 1,240.00' },
|
|
318
|
+
{ label: 'Account', redacted: true },
|
|
319
|
+
{ label: 'Note' },
|
|
320
|
+
]} />
|
|
321
|
+
</DrawerSection>
|
|
322
|
+
```
|
package/react/dist/index.css
CHANGED
|
@@ -114,3 +114,31 @@
|
|
|
114
114
|
transition: none;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
/* src/KeyValueList.css */
|
|
119
|
+
.ui-drawer__rows.ui-kv {
|
|
120
|
+
grid-template-columns: calc(var(--space-6) * 5) minmax(0, 1fr);
|
|
121
|
+
}
|
|
122
|
+
.ui-drawer__rows.ui-kv--two-columns {
|
|
123
|
+
grid-template-columns: repeat(2, calc(var(--space-6) * 5) minmax(0, 1fr));
|
|
124
|
+
}
|
|
125
|
+
.ui-kv__hidden {
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: var(--space-1);
|
|
129
|
+
color: var(--text);
|
|
130
|
+
}
|
|
131
|
+
.ui-kv__hidden svg {
|
|
132
|
+
width: var(--space-4);
|
|
133
|
+
height: var(--space-4);
|
|
134
|
+
stroke-width: 2.25;
|
|
135
|
+
}
|
|
136
|
+
@media (max-width: 560px) {
|
|
137
|
+
.ui-drawer__rows.ui-kv {
|
|
138
|
+
grid-template-columns: minmax(0, 1fr);
|
|
139
|
+
row-gap: var(--space-3);
|
|
140
|
+
}
|
|
141
|
+
.ui-kv > .ui-drawer__row {
|
|
142
|
+
display: block;
|
|
143
|
+
}
|
|
144
|
+
}
|
package/react/dist/index.d.ts
CHANGED
|
@@ -425,7 +425,23 @@ type FilterBarProps = {
|
|
|
425
425
|
};
|
|
426
426
|
declare function FilterBar(props: FilterBarProps): react.JSX.Element;
|
|
427
427
|
|
|
428
|
+
type KeyValueRow = {
|
|
429
|
+
label: string;
|
|
430
|
+
value?: ReactNode;
|
|
431
|
+
redacted?: boolean;
|
|
432
|
+
};
|
|
433
|
+
type KeyValueListProps = Omit<ComponentPropsWithoutRef<'dl'>, 'children'> & {
|
|
434
|
+
rows: readonly KeyValueRow[];
|
|
435
|
+
columns?: 1 | 2;
|
|
436
|
+
};
|
|
437
|
+
declare function KeyValueList({ rows, columns, className, ...rest }: KeyValueListProps): react.JSX.Element;
|
|
438
|
+
type DrawerSectionProps = Omit<ComponentPropsWithoutRef<'section'>, 'title'> & {
|
|
439
|
+
title?: ReactNode;
|
|
440
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
441
|
+
};
|
|
442
|
+
declare function DrawerSection({ title, headingLevel, className, children, ...rest }: DrawerSectionProps): react.JSX.Element;
|
|
443
|
+
|
|
428
444
|
declare const PAGE_SIZES: readonly number[];
|
|
429
445
|
declare const DEFAULT_PAGE_SIZE: number;
|
|
430
446
|
|
|
431
|
-
export { BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonProps, Card, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, type Filter, FilterBar, type FilterBarProps, Icon, Modal, type ModalProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, RowIdentity, type RowIdentityProps, type SegmentOption, Segmented, type SegmentedProps, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, type TableSort, sortTableRows };
|
|
447
|
+
export { BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonProps, Card, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, RowIdentity, type RowIdentityProps, type SegmentOption, Segmented, type SegmentedProps, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, type TableSort, sortTableRows };
|
package/react/dist/index.js
CHANGED
|
@@ -1685,6 +1685,30 @@ function FilterBar(props) {
|
|
|
1685
1685
|
return /* @__PURE__ */ jsx16("div", { ref: host, dangerouslySetInnerHTML: initial.current });
|
|
1686
1686
|
}
|
|
1687
1687
|
|
|
1688
|
+
// src/KeyValueList.tsx
|
|
1689
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1690
|
+
function detail({ value, redacted }) {
|
|
1691
|
+
if (redacted) return /* @__PURE__ */ jsxs13("span", { className: "ui-kv__hidden", children: [
|
|
1692
|
+
/* @__PURE__ */ jsx17(Icon, { name: "eyeOff" }),
|
|
1693
|
+
"Hidden"
|
|
1694
|
+
] });
|
|
1695
|
+
if (value == null) return "\u2014";
|
|
1696
|
+
return typeof value === "boolean" ? String(value) : value;
|
|
1697
|
+
}
|
|
1698
|
+
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
1699
|
+
return /* @__PURE__ */ jsx17("dl", { ...rest, className: ["ui-drawer__rows", "ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */ jsxs13("div", { className: "ui-drawer__row", children: [
|
|
1700
|
+
/* @__PURE__ */ jsx17("dt", { children: row.label }),
|
|
1701
|
+
/* @__PURE__ */ jsx17("dd", { children: detail(row) })
|
|
1702
|
+
] }, index)) });
|
|
1703
|
+
}
|
|
1704
|
+
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
1705
|
+
const Heading = `h${headingLevel}`;
|
|
1706
|
+
return /* @__PURE__ */ jsxs13("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
1707
|
+
title != null && /* @__PURE__ */ jsx17(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
1708
|
+
children
|
|
1709
|
+
] });
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1688
1712
|
// src/index.ts
|
|
1689
1713
|
var PAGE_SIZES = KIT_PAGE_SIZES;
|
|
1690
1714
|
var DEFAULT_PAGE_SIZE3 = KIT_DEFAULT_PAGE_SIZE;
|
|
@@ -1700,9 +1724,11 @@ export {
|
|
|
1700
1724
|
DeltaValue,
|
|
1701
1725
|
Denied,
|
|
1702
1726
|
Drawer,
|
|
1727
|
+
DrawerSection,
|
|
1703
1728
|
Dropdown,
|
|
1704
1729
|
FilterBar,
|
|
1705
1730
|
Icon,
|
|
1731
|
+
KeyValueList,
|
|
1706
1732
|
Modal,
|
|
1707
1733
|
NumericValue,
|
|
1708
1734
|
PAGE_SIZES,
|