@scalewing/react 1.25.0 → 1.26.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/CHANGELOG.md +12 -0
- package/README.md +23 -0
- package/dist/components/DescriptionList.d.ts +28 -0
- package/dist/components/DescriptionList.js +15 -0
- package/dist/css/css-components.js +3 -0
- package/dist/css/css-description-list.d.ts +12 -0
- package/dist/css/css-description-list.js +63 -0
- package/dist/css/stylesheet.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/styles.css +43 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scalewing/react
|
|
2
2
|
|
|
3
|
+
## 1.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e484799: `DescriptionList` and `DescriptionItem` (with `DescriptionListProps` and `DescriptionItemProps`): terms paired with what each says, one per row (`docs/requests/teisoro-description-list.md`, Teisoro F-006-S03).
|
|
8
|
+
|
|
9
|
+
- A `dl` of items, each a `div` grouping a `dt` (`term`) with its `dd` (`children`); the list and each item take their own HTML attributes and `className`.
|
|
10
|
+
- From `md` up the items share the list's two columns (`subgrid`): the term column as wide as the widest term, up to 40% of the list, then the detail. Every row aligns to its top, a hairline (`--sw-color-border`, `CanvasText` in forced colors) divides the rows, and the list is flush above its first row and below its last.
|
|
11
|
+
- Below `md` each term sits over its detail.
|
|
12
|
+
- A term and a detail are columns of lines: each child is its own line with its own line height, so a caption term starts level with a caption detail; each is as wide as its content unless it sets its own width (a `Progress` fills the detail), and long unbreakable words wrap. Wrap inline content in one element.
|
|
13
|
+
- New generated classes `sw-description-list`, `sw-description-item`, `sw-description-term` and `sw-description-detail`. No new tokens or dependencies.
|
|
14
|
+
|
|
3
15
|
## 1.25.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
Tooltip,
|
|
23
23
|
InfoTip,
|
|
24
24
|
Separator,
|
|
25
|
+
DescriptionList,
|
|
26
|
+
DescriptionItem,
|
|
25
27
|
DenominationGrid,
|
|
26
28
|
FilterChips,
|
|
27
29
|
Grid,
|
|
@@ -310,6 +312,27 @@ A header `TableCell` (`as="th"`) with `sort` (`'ascending'`, `'descending'` or `
|
|
|
310
312
|
|
|
311
313
|
`Separator` divides sections with a token-colored line. It is horizontal by default; use `orientation="vertical"` in a flex row. Set `decorative` when the line only supports layout so assistive technology ignores it.
|
|
312
314
|
|
|
315
|
+
`DescriptionList` pairs terms with what each says, one `DescriptionItem` per row: a `dl` whose items each group a `dt` (`term`) with its `dd` (`children`). From `md` up the term sits in a start column as wide as the widest term, up to 40% of the list, and the detail beside it; every row aligns to its top, so a term and its detail's first line start level, and a hairline divides the rows, with no space above the first row or below the last. Below `md` each term sits over its detail. The list sets only the layout: pass your own `Text` for the term and the detail. Each child of a term or a detail is its own line with its own line height (a column), as wide as its content unless it sets its own width (a `Progress` fills the detail; a `Field` keeps its input's width): wrap inline content, such as words and a link on one line, in one element such as an `Inline`. Long unbreakable words wrap inside their column. A `dl` has no ARIA role, so name a list with a visible heading, and `aria-labelledby` on the `section` around it, rather than an `aria-label` on the list.
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
<DescriptionList>
|
|
319
|
+
<DescriptionItem
|
|
320
|
+
term={
|
|
321
|
+
<Text variant="caption" color="muted">
|
|
322
|
+
Wetland
|
|
323
|
+
</Text>
|
|
324
|
+
}
|
|
325
|
+
>
|
|
326
|
+
<Inline align="start" gap={2} wrap>
|
|
327
|
+
<Text variant="data">12 herons</Text>
|
|
328
|
+
<Text variant="caption" color="muted">
|
|
329
|
+
Recounted
|
|
330
|
+
</Text>
|
|
331
|
+
</Inline>
|
|
332
|
+
</DescriptionItem>
|
|
333
|
+
</DescriptionList>
|
|
334
|
+
```
|
|
335
|
+
|
|
313
336
|
`Card` defaults to `glass`; `outlined` and `elevated` are solid surfaces, and `filled` is a quiet `--sw-color-subtle` fill with no border for plain information apart from pressable rows.
|
|
314
337
|
|
|
315
338
|
`--sw-color-accentSubtle` is the accent tint from `@scalewing/tokens`: a quiet fill behind accent text or glyphs that keeps 4.5:1. The stylesheet and every palette file set it, and a palette that moves the accent or surface retints it.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type DescriptionListProps = Omit<HTMLAttributes<HTMLDListElement>, 'children'> & {
|
|
3
|
+
/** The list's `DescriptionItem`s. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Terms and what each one says, one item per row: the term in a start
|
|
8
|
+
* column as wide as the widest term (up to 40% of the list), the detail
|
|
9
|
+
* beside it, a hairline between rows, every row aligned to its top. Below
|
|
10
|
+
* the layout breakpoint (`md`) each term sits over its detail.
|
|
11
|
+
*/
|
|
12
|
+
export declare function DescriptionList({ children, className, ...rest }: DescriptionListProps): import("react").JSX.Element;
|
|
13
|
+
export type DescriptionItemProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
14
|
+
/**
|
|
15
|
+
* What the row describes, such as a name; the consumer's own `Text`. Each
|
|
16
|
+
* child of the term, and of the detail, is its own line.
|
|
17
|
+
*/
|
|
18
|
+
term: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* What the term says: text, a link, or several lines. Each child is its
|
|
21
|
+
* own line, as wide as its content unless it sets its own width (a
|
|
22
|
+
* `Progress` fills the detail); wrap words and a link that share a line
|
|
23
|
+
* in one element such as `Inline`.
|
|
24
|
+
*/
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
/** One row of a `DescriptionList`: a `dt` and its `dd` in one group. */
|
|
28
|
+
export declare function DescriptionItem({ term, children, className, ...rest }: DescriptionItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from '../class-names.js';
|
|
3
|
+
/**
|
|
4
|
+
* Terms and what each one says, one item per row: the term in a start
|
|
5
|
+
* column as wide as the widest term (up to 40% of the list), the detail
|
|
6
|
+
* beside it, a hairline between rows, every row aligned to its top. Below
|
|
7
|
+
* the layout breakpoint (`md`) each term sits over its detail.
|
|
8
|
+
*/
|
|
9
|
+
export function DescriptionList({ children, className, ...rest }) {
|
|
10
|
+
return (_jsx("dl", { className: cx('sw-description-list', className), ...rest, children: children }));
|
|
11
|
+
}
|
|
12
|
+
/** One row of a `DescriptionList`: a `dt` and its `dd` in one group. */
|
|
13
|
+
export function DescriptionItem({ term, children, className, ...rest }) {
|
|
14
|
+
return (_jsxs("div", { className: cx('sw-description-item', className), ...rest, children: [_jsx("dt", { className: "sw-description-term", children: term }), _jsx("dd", { className: "sw-description-detail", children: children })] }));
|
|
15
|
+
}
|
|
@@ -23,6 +23,7 @@ import { cssTooltipClasses } from './css-tooltip.js';
|
|
|
23
23
|
import { cssInfoTipClasses } from './css-info-tip.js';
|
|
24
24
|
import { cssSeparatorClasses } from './css-separator.js';
|
|
25
25
|
import { cssStatTileClasses } from './css-stat-tile.js';
|
|
26
|
+
import { cssDescriptionListClasses } from './css-description-list.js';
|
|
26
27
|
import { cssTabsClasses } from './css-tabs.js';
|
|
27
28
|
import { cssResponsiveClasses } from './css-responsive.js';
|
|
28
29
|
import { cssFilterChipsClasses } from './css-filter-chips.js';
|
|
@@ -151,6 +152,8 @@ ${cssSeparatorClasses()}
|
|
|
151
152
|
|
|
152
153
|
${cssStatTileClasses()}
|
|
153
154
|
|
|
155
|
+
${cssDescriptionListClasses()}
|
|
156
|
+
|
|
154
157
|
${cssTabsClasses()}
|
|
155
158
|
|
|
156
159
|
${cssFilterChipsClasses()}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The description list: a two-column grid whose items share its columns
|
|
3
|
+
* (`subgrid`), so every term starts the same column and every detail the
|
|
4
|
+
* next. The term column fits the widest term up to 40% of the list. A
|
|
5
|
+
* hairline divides the rows, the list sits flush with no space above the
|
|
6
|
+
* first row or below the last, and each row aligns to its top. Below `md`
|
|
7
|
+
* a term sits over its detail. A term and a detail are columns of lines:
|
|
8
|
+
* each child is its own line with its own line height, so a caption term
|
|
9
|
+
* starts level with a caption detail instead of on the list's taller line.
|
|
10
|
+
*/
|
|
11
|
+
export declare function cssDescriptionListClasses(): string;
|
|
12
|
+
export declare function descriptionListClassCatalog(): string[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { breakpointQuery } from './breakpoints.js';
|
|
2
|
+
/**
|
|
3
|
+
* The description list: a two-column grid whose items share its columns
|
|
4
|
+
* (`subgrid`), so every term starts the same column and every detail the
|
|
5
|
+
* next. The term column fits the widest term up to 40% of the list. A
|
|
6
|
+
* hairline divides the rows, the list sits flush with no space above the
|
|
7
|
+
* first row or below the last, and each row aligns to its top. Below `md`
|
|
8
|
+
* a term sits over its detail. A term and a detail are columns of lines:
|
|
9
|
+
* each child is its own line with its own line height, so a caption term
|
|
10
|
+
* starts level with a caption detail instead of on the list's taller line.
|
|
11
|
+
*/
|
|
12
|
+
export function cssDescriptionListClasses() {
|
|
13
|
+
return `.sw-description-list {
|
|
14
|
+
column-gap: var(--sw-space-4);
|
|
15
|
+
display: grid;
|
|
16
|
+
grid-template-columns: fit-content(40%) minmax(0, 1fr);
|
|
17
|
+
margin: 0;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sw-description-item {
|
|
22
|
+
align-items: start;
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-column: 1 / -1;
|
|
25
|
+
grid-template-columns: subgrid;
|
|
26
|
+
padding-block: var(--sw-space-2);
|
|
27
|
+
row-gap: var(--sw-space-1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.sw-description-item:first-child { padding-top: 0; }
|
|
31
|
+
|
|
32
|
+
.sw-description-item:last-child { padding-bottom: 0; }
|
|
33
|
+
|
|
34
|
+
.sw-description-item + .sw-description-item {
|
|
35
|
+
border-top: 1px solid var(--sw-color-border);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sw-description-term,
|
|
39
|
+
.sw-description-detail {
|
|
40
|
+
align-items: flex-start;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
margin: 0;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
overflow-wrap: anywhere;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media ${breakpointQuery('below', 'md')} {
|
|
49
|
+
.sw-description-list { grid-template-columns: minmax(0, 1fr); }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (forced-colors: active) {
|
|
53
|
+
.sw-description-item + .sw-description-item { border-top-color: CanvasText; }
|
|
54
|
+
}`;
|
|
55
|
+
}
|
|
56
|
+
export function descriptionListClassCatalog() {
|
|
57
|
+
return [
|
|
58
|
+
'sw-description-list',
|
|
59
|
+
'sw-description-item',
|
|
60
|
+
'sw-description-term',
|
|
61
|
+
'sw-description-detail',
|
|
62
|
+
];
|
|
63
|
+
}
|
package/dist/css/stylesheet.js
CHANGED
|
@@ -13,6 +13,7 @@ import { tooltipClassCatalog } from './css-tooltip.js';
|
|
|
13
13
|
import { infoTipClassCatalog } from './css-info-tip.js';
|
|
14
14
|
import { separatorClassCatalog } from './css-separator.js';
|
|
15
15
|
import { statTileClassCatalog } from './css-stat-tile.js';
|
|
16
|
+
import { descriptionListClassCatalog } from './css-description-list.js';
|
|
16
17
|
import { tabsClassCatalog } from './css-tabs.js';
|
|
17
18
|
import { responsiveClassCatalog } from './css-responsive.js';
|
|
18
19
|
import { filterChipsClassCatalog } from './css-filter-chips.js';
|
|
@@ -76,6 +77,7 @@ export function utilityClassCatalog() {
|
|
|
76
77
|
...infoTipClassCatalog(),
|
|
77
78
|
...separatorClassCatalog(),
|
|
78
79
|
...statTileClassCatalog(),
|
|
80
|
+
...descriptionListClassCatalog(),
|
|
79
81
|
...tabsClassCatalog(),
|
|
80
82
|
...filterChipsClassCatalog(),
|
|
81
83
|
...gridClassCatalog(),
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export type { Breakpoint, BreakpointDirection, VisibilityBreakpoint, } from './c
|
|
|
42
42
|
export { breakpointQuery } from './css/breakpoints.js';
|
|
43
43
|
export { Separator } from './components/Separator.js';
|
|
44
44
|
export type { SeparatorOrientation, SeparatorProps, } from './components/Separator.js';
|
|
45
|
+
export { DescriptionItem, DescriptionList, } from './components/DescriptionList.js';
|
|
46
|
+
export type { DescriptionItemProps, DescriptionListProps, } from './components/DescriptionList.js';
|
|
45
47
|
export { Grid } from './components/Grid.js';
|
|
46
48
|
export type { GridColumns, GridProps } from './components/Grid.js';
|
|
47
49
|
export type { GridColumnSpan } from './css/css-grid-span.js';
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { ThemeProvider, useTheme, } from './theme/ThemeProvider.js';
|
|
|
35
35
|
export { utilityClassCatalog } from './css/stylesheet.js';
|
|
36
36
|
export { breakpointQuery } from './css/breakpoints.js';
|
|
37
37
|
export { Separator } from './components/Separator.js';
|
|
38
|
+
export { DescriptionItem, DescriptionList, } from './components/DescriptionList.js';
|
|
38
39
|
export { Grid } from './components/Grid.js';
|
|
39
40
|
export { DenominationGrid } from './components/DenominationGrid.js';
|
|
40
41
|
export { FilterChips } from './components/FilterChips.js';
|
package/dist/styles.css
CHANGED
|
@@ -3039,6 +3039,49 @@ body {
|
|
|
3039
3039
|
.sw-stat-tile-primary { background: Highlight; }
|
|
3040
3040
|
}
|
|
3041
3041
|
|
|
3042
|
+
.sw-description-list {
|
|
3043
|
+
column-gap: var(--sw-space-4);
|
|
3044
|
+
display: grid;
|
|
3045
|
+
grid-template-columns: fit-content(40%) minmax(0, 1fr);
|
|
3046
|
+
margin: 0;
|
|
3047
|
+
min-width: 0;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
.sw-description-item {
|
|
3051
|
+
align-items: start;
|
|
3052
|
+
display: grid;
|
|
3053
|
+
grid-column: 1 / -1;
|
|
3054
|
+
grid-template-columns: subgrid;
|
|
3055
|
+
padding-block: var(--sw-space-2);
|
|
3056
|
+
row-gap: var(--sw-space-1);
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
.sw-description-item:first-child { padding-top: 0; }
|
|
3060
|
+
|
|
3061
|
+
.sw-description-item:last-child { padding-bottom: 0; }
|
|
3062
|
+
|
|
3063
|
+
.sw-description-item + .sw-description-item {
|
|
3064
|
+
border-top: 1px solid var(--sw-color-border);
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
.sw-description-term,
|
|
3068
|
+
.sw-description-detail {
|
|
3069
|
+
align-items: flex-start;
|
|
3070
|
+
display: flex;
|
|
3071
|
+
flex-direction: column;
|
|
3072
|
+
margin: 0;
|
|
3073
|
+
min-width: 0;
|
|
3074
|
+
overflow-wrap: anywhere;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
@media not all and (min-width: 48rem) {
|
|
3078
|
+
.sw-description-list { grid-template-columns: minmax(0, 1fr); }
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
@media (forced-colors: active) {
|
|
3082
|
+
.sw-description-item + .sw-description-item { border-top-color: CanvasText; }
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3042
3085
|
.sw-tabs {
|
|
3043
3086
|
border-bottom: 1px solid var(--sw-color-border);
|
|
3044
3087
|
display: flex;
|