@stapel/search-react 0.44.0 → 0.45.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 +56 -0
- package/dist/default/PopularValues.d.ts +48 -44
- package/dist/default/PopularValues.d.ts.map +1 -1
- package/dist/default/PopularValues.js +87 -71
- package/dist/default/PopularValues.js.map +1 -1
- package/dist/default/index.d.ts +1 -1
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +1 -1
- package/dist/default/index.js.map +1 -1
- package/llms.txt +1 -1
- package/manifest.json +1 -1
- package/nav-manifest.json +1 -1
- package/package.json +4 -4
- package/src/analytics/generated/events.json +1 -1
- package/src/default/PopularValues.tsx +92 -93
- package/src/default/index.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# @stapel/search-react
|
|
2
2
|
|
|
3
|
+
## 0.45.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 26b513c: The popular-values band uses the width it is given.
|
|
8
|
+
|
|
9
|
+
Measured on the live storefront's `/c/transport` at 1440 (headless Chromium):
|
|
10
|
+
the results column is 1088px and the band's columns box drew **377px** of it —
|
|
11
|
+
three columns of a make and its count — leaving 711px of white and stacking
|
|
12
|
+
twelve values four rows deep.
|
|
13
|
+
|
|
14
|
+
Two causes, compounding:
|
|
15
|
+
|
|
16
|
+
- `inline-size: fit-content` sized the box to its WORDS, so the pane's width
|
|
17
|
+
was never used;
|
|
18
|
+
- the container-query ladder asked for `breakpoints.desktop` (1200px) before
|
|
19
|
+
granting a fourth column, and this block is the window less a 280px rail less
|
|
20
|
+
the gap — 1088px at 1440. **The top rung could never fire.** The rungs were
|
|
21
|
+
window-scale numbers measuring a container that is never window-sized, which
|
|
22
|
+
is the exact mistake the module's own doc argued a media query would make.
|
|
23
|
+
|
|
24
|
+
`columns="responsive"` is now native multicol over a column MEASURE — the same
|
|
25
|
+
mechanism the expanded band next door already uses. The element answers "how
|
|
26
|
+
many columns" from its own width, with no container query, no rungs and no
|
|
27
|
+
hoisted sheet.
|
|
28
|
+
|
|
29
|
+
`POPULAR_VALUE_COLUMN_WIDTH` is 150 (was 200), swept in a real browser over the
|
|
30
|
+
live twelve makes and a worst case of the longest make with a four-digit count:
|
|
31
|
+
200/170/160 all give 4 columns and 3 rows in that pane; 150 gives 6 and 2. The
|
|
32
|
+
used column is 155px there and never below 152px at any width swept, so nothing
|
|
33
|
+
wraps — the old claim that a value wraps under its own number below 200 does not
|
|
34
|
+
hold at the default type step.
|
|
35
|
+
|
|
36
|
+
Before and after, with the literal styles the component emits:
|
|
37
|
+
|
|
38
|
+
| pane | before | after |
|
|
39
|
+
| ------ | --------------------------- | ---------------------------- |
|
|
40
|
+
| 1088px | 3 cols, 4 rows, 666px white | **6 cols, 2 rows, no white** |
|
|
41
|
+
| 840px | 3 cols, 4 rows, 418px white | 4 cols, 3 rows, no white |
|
|
42
|
+
| 600px | 3 cols, 4 rows, 178px white | 3 cols, 4 rows, no white |
|
|
43
|
+
| 380px | 3 cols, 5 rows (cramped) | 2 cols, 6 rows |
|
|
44
|
+
|
|
45
|
+
The columns box halves, 68px to 34px.
|
|
46
|
+
|
|
47
|
+
The numeric arm is untouched: a host that names a count still gets that many
|
|
48
|
+
words-wide columns, still clamped by `POPULAR_VALUES_MAX_COLUMNS`. That ceiling
|
|
49
|
+
now governs the numeric arm only — the responsive arm has no count to cap and
|
|
50
|
+
needs none, because the measure is the ceiling: no pane, however wide, can
|
|
51
|
+
produce a column narrower than a value and its count.
|
|
52
|
+
|
|
53
|
+
REMOVED, and nothing outside this package imported them: `popularValuesLadderCss`,
|
|
54
|
+
`POPULAR_VALUES_CLASS`, `POPULAR_VALUES_LADDER`, `POPULAR_VALUES_STYLE_HREF`.
|
|
55
|
+
ADDED: `POPULAR_VALUES_COLUMN_GAP`, half of the arithmetic that decides how many
|
|
56
|
+
columns a pane buys, so a host sizing a reservation for this block need not
|
|
57
|
+
re-measure it.
|
|
58
|
+
|
|
3
59
|
## 0.44.0
|
|
4
60
|
|
|
5
61
|
### Minor Changes
|
|
@@ -30,58 +30,60 @@ import type { ReactElement, ReactNode } from "react";
|
|
|
30
30
|
import type { FacetGroup, FacetOption } from "../state/facets.js";
|
|
31
31
|
/** How many values the block prints before the link into the full control. */
|
|
32
32
|
export declare const POPULAR_VALUES_LIMIT = 12;
|
|
33
|
-
/** How many columns the list flows into
|
|
34
|
-
* without turning a make into a two-line wrap. */
|
|
33
|
+
/** How many columns the list flows into when a host names a number. Three
|
|
34
|
+
* fills a desktop content column without turning a make into a two-line wrap. */
|
|
35
35
|
export declare const POPULAR_VALUES_COLUMNS = 3;
|
|
36
36
|
/**
|
|
37
|
-
* The ceiling on columns
|
|
37
|
+
* The ceiling on columns a HOST may ask for.
|
|
38
38
|
*
|
|
39
|
-
* Past four
|
|
40
|
-
* two-word cells: each column is one make and
|
|
41
|
-
*
|
|
42
|
-
* make. Four is where
|
|
39
|
+
* Past four a block whose width is fixed by its words stops being a table of
|
|
40
|
+
* contents and becomes a grid of two-word cells: each column is one make and
|
|
41
|
+
* one number, and a fifth column puts 60px of air between «Toyota 4» and the
|
|
42
|
+
* next make. Four is where that density still reads as a list.
|
|
43
|
+
*
|
|
44
|
+
* It governs the numeric arm ONLY, and since 0.45 that is the whole of its
|
|
45
|
+
* job. The responsive arm has no count to cap and needs none — see
|
|
46
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH}: there the MEASURE is the ceiling, so a
|
|
47
|
+
* column can never be narrower than a value and its count however many of them
|
|
48
|
+
* the pane holds.
|
|
43
49
|
*/
|
|
44
50
|
export declare const POPULAR_VALUES_MAX_COLUMNS = 4;
|
|
45
51
|
/**
|
|
46
|
-
* The
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
52
|
+
* The minimum measure one column of this block needs, and the whole of the
|
|
53
|
+
* responsive arm's layout input.
|
|
54
|
+
*
|
|
55
|
+
* `column-width` is a MINIMUM, not a width: the browser fits as many columns
|
|
56
|
+
* of at least this measure as the element's own width allows and then widens
|
|
57
|
+
* them to fill it. That is what makes the number a ceiling on density as well
|
|
58
|
+
* as a floor on legibility — no pane, however wide, can produce a column
|
|
59
|
+
* narrower than this.
|
|
60
|
+
*
|
|
61
|
+
* ── 150, and it is measured rather than reasoned ──────────────────────────
|
|
62
|
+
*
|
|
63
|
+
* It was 200, declared as the measure «Ford 1 204» needs. Swept in a real
|
|
64
|
+
* browser over the live twelve makes and over a worst case of the longest make
|
|
65
|
+
* on the stand with a four-digit count, at this gap:
|
|
58
66
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* wide screen. `container-type: inline-size` plus `@container` asks the only
|
|
64
|
-
* question that has an answer here — how wide is this block.
|
|
67
|
+
* 200 → 4 columns in the storefront's 1088px pane, 3 rows
|
|
68
|
+
* 170 → 4 columns, 3 rows
|
|
69
|
+
* 160 → 4 columns, 3 rows
|
|
70
|
+
* 150 → 6 columns, 2 rows
|
|
65
71
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* is where a layout of this density gains a column.
|
|
72
|
+
* 150 is the knee, and nothing wraps at it: because the browser widens the
|
|
73
|
+
* columns to fill, the USED column is 155px in that pane and never below 152px
|
|
74
|
+
* at any width swept. The old claim that a value wraps under its own number
|
|
75
|
+
* below 200 does not hold at the default type step.
|
|
71
76
|
*/
|
|
72
|
-
export declare const
|
|
73
|
-
readonly minInlineSize: number;
|
|
74
|
-
readonly columns: number;
|
|
75
|
-
}[];
|
|
77
|
+
export declare const POPULAR_VALUE_COLUMN_WIDTH = 150;
|
|
76
78
|
/**
|
|
77
|
-
* The
|
|
78
|
-
*
|
|
79
|
+
* The gutter between columns — one step up the scale from the row's own, so a
|
|
80
|
+
* new column reads as a column rather than as a wrapped line.
|
|
79
81
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
82
|
+
* Exported because it is half of the arithmetic that decides how many columns
|
|
83
|
+
* a pane produces (`floor((available + gap) / (width + gap))`), and a host
|
|
84
|
+
* sizing a reservation for this block should not have to re-measure it.
|
|
83
85
|
*/
|
|
84
|
-
export declare
|
|
86
|
+
export declare const POPULAR_VALUES_COLUMN_GAP: number;
|
|
85
87
|
/** The busiest values of the group, count-descending, capped. */
|
|
86
88
|
export declare function popularOptions(group: FacetGroup, limit?: number): readonly FacetOption[];
|
|
87
89
|
export interface PopularValuesProps {
|
|
@@ -97,10 +99,12 @@ export interface PopularValuesProps {
|
|
|
97
99
|
/**
|
|
98
100
|
* How many columns. Default {@link POPULAR_VALUES_COLUMNS}.
|
|
99
101
|
*
|
|
100
|
-
* `"responsive"`
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
102
|
+
* `"responsive"` hands the question to the ELEMENT: native multicol over
|
|
103
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH} fits as many columns as this block's own
|
|
104
|
+
* width allows, at every width, with no rungs to keep in step with a layout
|
|
105
|
+
* this component cannot see. The numeric form stays, and stays the default:
|
|
106
|
+
* a host that has already decided its layout should not have that decision
|
|
107
|
+
* taken back.
|
|
104
108
|
*/
|
|
105
109
|
readonly columns?: number | "responsive";
|
|
106
110
|
/** The block's heading. Defaults to the group's own label; `null` draws
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopularValues.d.ts","sourceRoot":"","sources":["../../src/default/PopularValues.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASpE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,o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,EAAE,SAAS,CAAC;IAC7B;2CACuC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,GAAG,IAAI,CA4E5E"}
|
|
@@ -1,72 +1,65 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Flex, Typography } from "antd";
|
|
3
3
|
import { useT } from "@stapel/core";
|
|
4
|
-
import {
|
|
4
|
+
import { spacing } from "@stapel/tokens";
|
|
5
5
|
import { POINTER_FOCUS, POINTER_FOCUS_STYLE_HREF, pointerFocusCss, } from "./focusRing.js";
|
|
6
6
|
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
7
7
|
/** How many values the block prints before the link into the full control. */
|
|
8
8
|
export const POPULAR_VALUES_LIMIT = 12;
|
|
9
|
-
/** How many columns the list flows into
|
|
10
|
-
* without turning a make into a two-line wrap. */
|
|
9
|
+
/** How many columns the list flows into when a host names a number. Three
|
|
10
|
+
* fills a desktop content column without turning a make into a two-line wrap. */
|
|
11
11
|
export const POPULAR_VALUES_COLUMNS = 3;
|
|
12
12
|
/**
|
|
13
|
-
* The ceiling on columns
|
|
13
|
+
* The ceiling on columns a HOST may ask for.
|
|
14
14
|
*
|
|
15
|
-
* Past four
|
|
16
|
-
* two-word cells: each column is one make and
|
|
17
|
-
*
|
|
18
|
-
* make. Four is where
|
|
15
|
+
* Past four a block whose width is fixed by its words stops being a table of
|
|
16
|
+
* contents and becomes a grid of two-word cells: each column is one make and
|
|
17
|
+
* one number, and a fifth column puts 60px of air between «Toyota 4» and the
|
|
18
|
+
* next make. Four is where that density still reads as a list.
|
|
19
|
+
*
|
|
20
|
+
* It governs the numeric arm ONLY, and since 0.45 that is the whole of its
|
|
21
|
+
* job. The responsive arm has no count to cap and needs none — see
|
|
22
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH}: there the MEASURE is the ceiling, so a
|
|
23
|
+
* column can never be narrower than a value and its count however many of them
|
|
24
|
+
* the pane holds.
|
|
19
25
|
*/
|
|
20
26
|
export const POPULAR_VALUES_MAX_COLUMNS = 4;
|
|
21
27
|
/**
|
|
22
|
-
* The
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
* The minimum measure one column of this block needs, and the whole of the
|
|
29
|
+
* responsive arm's layout input.
|
|
30
|
+
*
|
|
31
|
+
* `column-width` is a MINIMUM, not a width: the browser fits as many columns
|
|
32
|
+
* of at least this measure as the element's own width allows and then widens
|
|
33
|
+
* them to fill it. That is what makes the number a ceiling on density as well
|
|
34
|
+
* as a floor on legibility — no pane, however wide, can produce a column
|
|
35
|
+
* narrower than this.
|
|
36
|
+
*
|
|
37
|
+
* ── 150, and it is measured rather than reasoned ──────────────────────────
|
|
38
|
+
*
|
|
39
|
+
* It was 200, declared as the measure «Ford 1 204» needs. Swept in a real
|
|
40
|
+
* browser over the live twelve makes and over a worst case of the longest make
|
|
41
|
+
* on the stand with a four-digit count, at this gap:
|
|
34
42
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* wide screen. `container-type: inline-size` plus `@container` asks the only
|
|
40
|
-
* question that has an answer here — how wide is this block.
|
|
43
|
+
* 200 → 4 columns in the storefront's 1088px pane, 3 rows
|
|
44
|
+
* 170 → 4 columns, 3 rows
|
|
45
|
+
* 160 → 4 columns, 3 rows
|
|
46
|
+
* 150 → 6 columns, 2 rows
|
|
41
47
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* is where a layout of this density gains a column.
|
|
48
|
+
* 150 is the knee, and nothing wraps at it: because the browser widens the
|
|
49
|
+
* columns to fill, the USED column is 155px in that pane and never below 152px
|
|
50
|
+
* at any width swept. The old claim that a value wraps under its own number
|
|
51
|
+
* below 200 does not hold at the default type step.
|
|
47
52
|
*/
|
|
48
|
-
export const
|
|
49
|
-
{ minInlineSize: POPULAR_VALUE_COLUMN_WIDTH * 2, columns: 2 },
|
|
50
|
-
{ minInlineSize: breakpoints.tablet, columns: 3 },
|
|
51
|
-
{ minInlineSize: breakpoints.desktop, columns: 4 },
|
|
52
|
-
];
|
|
53
|
+
export const POPULAR_VALUE_COLUMN_WIDTH = 150;
|
|
53
54
|
/**
|
|
54
|
-
* The
|
|
55
|
-
*
|
|
55
|
+
* The gutter between columns — one step up the scale from the row's own, so a
|
|
56
|
+
* new column reads as a column rather than as a wrapped line.
|
|
56
57
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* Exported because it is half of the arithmetic that decides how many columns
|
|
59
|
+
* a pane produces (`floor((available + gap) / (width + gap))`), and a host
|
|
60
|
+
* sizing a reservation for this block should not have to re-measure it.
|
|
60
61
|
*/
|
|
61
|
-
export
|
|
62
|
-
const block = `.${POPULAR_VALUES_CLASS}`;
|
|
63
|
-
return [
|
|
64
|
-
`${block}{container-type:inline-size}`,
|
|
65
|
-
`${block}>[data-popular-columns]{column-count:1}`,
|
|
66
|
-
...POPULAR_VALUES_LADDER.map((rung) => `@container (min-width: ${String(rung.minInlineSize)}px)` +
|
|
67
|
-
`{${block}>[data-popular-columns]{column-count:${String(rung.columns)}}}`),
|
|
68
|
-
].join("\n");
|
|
69
|
-
}
|
|
62
|
+
export const POPULAR_VALUES_COLUMN_GAP = spacing[6];
|
|
70
63
|
/** A value with no evidence behind it is not a popular value. Uncounted
|
|
71
64
|
* options carry `count: null` and are dropped here rather than printed with a
|
|
72
65
|
* blank where the number belongs — the block IS the numbers. */
|
|
@@ -80,32 +73,55 @@ export function popularOptions(group, limit = POPULAR_VALUES_LIMIT) {
|
|
|
80
73
|
.slice(0, limit);
|
|
81
74
|
}
|
|
82
75
|
/**
|
|
83
|
-
* The columns box
|
|
76
|
+
* The columns box, in its two arms.
|
|
77
|
+
*
|
|
78
|
+
* ── The responsive arm: a block, and a MEASURE ────────────────────────────
|
|
79
|
+
*
|
|
80
|
+
* `column-width` asks the element's own width how many columns fit. That is
|
|
81
|
+
* the whole mechanism — no container query, no rungs, no hoisted sheet, and no
|
|
82
|
+
* number that has to be kept in step with a layout this component cannot see.
|
|
83
|
+
* It is also what the expanded band next door already does, so the two arms of
|
|
84
|
+
* one control stop answering "how many columns" two different ways.
|
|
85
|
+
*
|
|
86
|
+
* What it replaced was a container-query ladder whose rungs were the token
|
|
87
|
+
* WINDOW breakpoints — and this block is the window less a 280px rail less the
|
|
88
|
+
* gap, so at 1440 it is 1088px wide and the rung that grants a fourth column
|
|
89
|
+
* (1200px) could never fire. The ladder's own doc argued that a media query
|
|
90
|
+
* would be wrong here for precisely that reason, and then used the window's
|
|
91
|
+
* numbers to measure the container.
|
|
92
|
+
*
|
|
93
|
+
* `inline-size: fit-content` is deliberately NOT here, and its absence is
|
|
94
|
+
* load-bearing twice over. It sized the box to its words — 377px of a 1088px
|
|
95
|
+
* pane on the live storefront, 711px of white beside twelve values stacked
|
|
96
|
+
* four deep — and it is measurably incompatible with a column measure: set
|
|
97
|
+
* together, the box collapses to a single column. The defect `fit-content` was
|
|
98
|
+
* added for (three ~360px columns each holding «Chery 5») cannot arise here,
|
|
99
|
+
* because a column is never wider than the pane divided by however many
|
|
100
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH} fit in it.
|
|
84
101
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* — which on the storefront printed a make, then 300px of nothing, then the
|
|
88
|
-
* next make. The owner read it as broken, and it is: nothing about this block
|
|
89
|
-
* wants the pane's width, it wants its own.
|
|
102
|
+
* `column-fill: balance` spreads the rows evenly over the columns the width
|
|
103
|
+
* produces, rather than filling the first column to the box's block-size.
|
|
90
104
|
*
|
|
91
|
-
*
|
|
92
|
-
* size is `columns × (the widest item) + gaps` — exactly the block's natural
|
|
93
|
-
* measure — and `fit-content` takes that unless the available space is
|
|
94
|
-
* smaller, in which case the columns shrink instead of overflowing. The box
|
|
95
|
-
* stays a block, so it stays flush with the pane's leading edge; the ladder in
|
|
96
|
-
* the sheet still decides HOW MANY columns, and each one is now sized by the
|
|
97
|
-
* longest make in it.
|
|
105
|
+
* ── The numeric arm: unchanged, words-wide ────────────────────────────────
|
|
98
106
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
107
|
+
* A host that names a number has decided its own layout, and a count divides
|
|
108
|
+
* the container — so three columns of a box handed the whole results pane are
|
|
109
|
+
* three ~360px columns holding «Chery 5», a make and then 300px of nothing.
|
|
110
|
+
* `fit-content` is the cure there and stays: the box takes its natural measure
|
|
111
|
+
* (`columns × widest item + gaps`) unless the space is smaller, in which case
|
|
112
|
+
* the columns shrink rather than overflow.
|
|
102
113
|
*/
|
|
103
114
|
function COLUMNS(count) {
|
|
115
|
+
if (count === undefined) {
|
|
116
|
+
return {
|
|
117
|
+
columnWidth: POPULAR_VALUE_COLUMN_WIDTH,
|
|
118
|
+
columnGap: POPULAR_VALUES_COLUMN_GAP,
|
|
119
|
+
columnFill: "balance",
|
|
120
|
+
};
|
|
121
|
+
}
|
|
104
122
|
return {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
...(count === undefined ? {} : { columnCount: count }),
|
|
108
|
-
columnGap: spacing[6],
|
|
123
|
+
columnCount: count,
|
|
124
|
+
columnGap: POPULAR_VALUES_COLUMN_GAP,
|
|
109
125
|
inlineSize: "fit-content",
|
|
110
126
|
maxInlineSize: "100%",
|
|
111
127
|
};
|
|
@@ -127,7 +143,7 @@ export function PopularValues(props) {
|
|
|
127
143
|
if (options.length === 0)
|
|
128
144
|
return null;
|
|
129
145
|
const responsive = props.columns === "responsive";
|
|
130
|
-
return (_jsxs(Flex, { vertical: true, gap: spacing[2],
|
|
146
|
+
return (_jsxs(Flex, { vertical: true, gap: spacing[2], "data-testid": `popular-values-${group.slug}`, "data-label-source": group.labelSource, "data-columns": responsive ? "responsive" : String(props.columns ?? POPULAR_VALUES_COLUMNS), children: [_jsx("style", { href: POINTER_FOCUS_STYLE_HREF, precedence: "default", children: pointerFocusCss() }), props.heading !== null && (_jsx(Typography.Text, { strong: true, children: props.heading ?? group.label })), _jsx("div", { "data-testid": `popular-columns-${group.slug}`, style: COLUMNS(responsive
|
|
131
147
|
? undefined
|
|
132
148
|
: Math.min(props.columns ?? POPULAR_VALUES_COLUMNS, POPULAR_VALUES_MAX_COLUMNS)), children: options.map((option) => (_jsxs("div", { style: ROW, children: [_jsx(Button, { type: "link", size: "small", ...POINTER_FOCUS, style: { paddingInline: 0, height: "auto" }, "data-testid": `popular-value-${group.slug}-${option.value}`, "data-analytics": "none", "data-analytics-reason": "a filter is a read, not a flow step", onClick: () => {
|
|
133
149
|
props.onApply(group.slug, option.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopularValues.js","sourceRoot":"","sources":["../../src/default/PopularValues.tsx"],"names":[],"mappings":";AA6BA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"PopularValues.js","sourceRoot":"","sources":["../../src/default/PopularValues.tsx"],"names":[],"mappings":";AA6BA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,8EAA8E;AA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,
|
|
|
58
58
|
export type { FacetGroupControlProps, FacetGroupShape, FacetOptionNode, } from "./FacetGroupControl.js";
|
|
59
59
|
export { SWATCH_SIZE, facetSwatch, isColorAxis, swatchColor, termHue, } from "./swatches.js";
|
|
60
60
|
export type { ColorAxisLike, TermExtra } from "./swatches.js";
|
|
61
|
-
export { PopularValues, popularOptions,
|
|
61
|
+
export { PopularValues, popularOptions, POPULAR_VALUES_COLUMNS, POPULAR_VALUES_COLUMN_GAP, POPULAR_VALUES_LIMIT, POPULAR_VALUES_MAX_COLUMNS, POPULAR_VALUE_COLUMN_WIDTH, } from "./PopularValues.js";
|
|
62
62
|
export type { PopularValuesProps } from "./PopularValues.js";
|
|
63
63
|
export { PartitionChips } from "./PartitionChips.js";
|
|
64
64
|
export type { PartitionChild, PartitionChipsProps, PartitionLinkedChildren, } from "./PartitionChips.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB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0BAA0B,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK9D,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EACV,eAAe,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E,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChF,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EACV,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG3E,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/default/index.js
CHANGED
|
@@ -53,7 +53,7 @@ export { SWATCH_SIZE, facetSwatch, isColorAxis, swatchColor, termHue, } from "./
|
|
|
53
53
|
// ── the browse surfaces a storefront PLACES (this pair does not lay them
|
|
54
54
|
// out: where a popular-values block or a partition row belongs on a
|
|
55
55
|
// category page is the page's decision) ──────────────────────────────────
|
|
56
|
-
export { PopularValues, popularOptions,
|
|
56
|
+
export { PopularValues, popularOptions, POPULAR_VALUES_COLUMNS, POPULAR_VALUES_COLUMN_GAP, POPULAR_VALUES_LIMIT, POPULAR_VALUES_MAX_COLUMNS, POPULAR_VALUE_COLUMN_WIDTH, } from "./PopularValues.js";
|
|
57
57
|
export { PartitionChips } from "./PartitionChips.js";
|
|
58
58
|
export { FacetPanelPane, FACET_OPEN_GROUPS, FACET_SEARCH_THRESHOLD, FACET_VISIBLE_GROUPS, } from "./FacetPanelPane.js";
|
|
59
59
|
export { RankingDisclosurePane, RANKING_MAX_WIDTH } from "./RankingDisclosurePane.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,+EAA+E;AAC/E,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAcxB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,gCAAgC,EAChC,2BAA2B,EAC3B,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAY1B,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,OAAO,GACR,MAAM,eAAe,CAAC;AAGvB,0EAA0E;AAC1E,uEAAuE;AACvE,8EAA8E;AAC9E,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,+EAA+E;AAC/E,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAg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
|
2
2
|
"name": "@stapel/search-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Headless React pair for stapel-search: a typed query client, TanStack Query hooks, and a URL-first state codec that makes a search shareable by construction (filters, ranges, geo, sort and the keyset cursor all live in the query string). Drill-down facets rendered with their remaining counts and with the server's own honesty flags — approximate, skipped, degraded — never swallowed; keyset pagination with the window refusal named; DSA Art. 26 `promoted` marking carried into every card slot and the P2B Art. 5 ranking disclosure exposed as data. Zero visual opinion in the main entry; an opt-in /default subpath ships the antd skin, and /router binds the codec to react-router's useSearchParams.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -115,11 +115,11 @@
|
|
|
115
115
|
"size-limit": "^11.2.0",
|
|
116
116
|
"typescript": "^5.8.3",
|
|
117
117
|
"vitest": "^3.2.4",
|
|
118
|
-
"@stapel/core": "^0.26.1",
|
|
119
|
-
"@stapel/showcase": "^0.3.0",
|
|
120
|
-
"@stapel/image": "^0.4.2",
|
|
121
118
|
"@stapel/attributes-react": "^0.17.0",
|
|
119
|
+
"@stapel/core": "^0.26.1",
|
|
122
120
|
"@stapel/tokens": "^0.8.0",
|
|
121
|
+
"@stapel/image": "^0.4.2",
|
|
122
|
+
"@stapel/showcase": "^0.3.0",
|
|
123
123
|
"@stapel/tokens-antd": "^0.19.0"
|
|
124
124
|
},
|
|
125
125
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import type { CSSProperties, ReactElement, ReactNode } from "react";
|
|
30
30
|
import { Button, Flex, Typography } from "antd";
|
|
31
31
|
import { useT } from "@stapel/core";
|
|
32
|
-
import {
|
|
32
|
+
import { spacing } from "@stapel/tokens";
|
|
33
33
|
import {
|
|
34
34
|
POINTER_FOCUS,
|
|
35
35
|
POINTER_FOCUS_STYLE_HREF,
|
|
@@ -41,79 +41,63 @@ import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
|
41
41
|
/** How many values the block prints before the link into the full control. */
|
|
42
42
|
export const POPULAR_VALUES_LIMIT = 12;
|
|
43
43
|
|
|
44
|
-
/** How many columns the list flows into
|
|
45
|
-
* without turning a make into a two-line wrap. */
|
|
44
|
+
/** How many columns the list flows into when a host names a number. Three
|
|
45
|
+
* fills a desktop content column without turning a make into a two-line wrap. */
|
|
46
46
|
export const POPULAR_VALUES_COLUMNS = 3;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* The ceiling on columns
|
|
49
|
+
* The ceiling on columns a HOST may ask for.
|
|
50
50
|
*
|
|
51
|
-
* Past four
|
|
52
|
-
* two-word cells: each column is one make and
|
|
53
|
-
*
|
|
54
|
-
* make. Four is where
|
|
51
|
+
* Past four a block whose width is fixed by its words stops being a table of
|
|
52
|
+
* contents and becomes a grid of two-word cells: each column is one make and
|
|
53
|
+
* one number, and a fifth column puts 60px of air between «Toyota 4» and the
|
|
54
|
+
* next make. Four is where that density still reads as a list.
|
|
55
|
+
*
|
|
56
|
+
* It governs the numeric arm ONLY, and since 0.45 that is the whole of its
|
|
57
|
+
* job. The responsive arm has no count to cap and needs none — see
|
|
58
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH}: there the MEASURE is the ceiling, so a
|
|
59
|
+
* column can never be narrower than a value and its count however many of them
|
|
60
|
+
* the pane holds.
|
|
55
61
|
*/
|
|
56
62
|
export const POPULAR_VALUES_MAX_COLUMNS = 4;
|
|
57
63
|
|
|
58
64
|
/**
|
|
59
|
-
* The
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export const POPULAR_VALUES_STYLE_HREF = "stapel-popular-values";
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The ladder `columns="responsive"` climbs — one rung per column, by the width
|
|
73
|
-
* of the BLOCK rather than of the window.
|
|
65
|
+
* The minimum measure one column of this block needs, and the whole of the
|
|
66
|
+
* responsive arm's layout input.
|
|
67
|
+
*
|
|
68
|
+
* `column-width` is a MINIMUM, not a width: the browser fits as many columns
|
|
69
|
+
* of at least this measure as the element's own width allows and then widens
|
|
70
|
+
* them to fill it. That is what makes the number a ceiling on density as well
|
|
71
|
+
* as a floor on legibility — no pane, however wide, can produce a column
|
|
72
|
+
* narrower than this.
|
|
73
|
+
*
|
|
74
|
+
* ── 150, and it is measured rather than reasoned ──────────────────────────
|
|
74
75
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* has, and one column inside a narrow host container that happens to sit on a
|
|
79
|
-
* wide screen. `container-type: inline-size` plus `@container` asks the only
|
|
80
|
-
* question that has an answer here — how wide is this block.
|
|
76
|
+
* It was 200, declared as the measure «Ford 1 204» needs. Swept in a real
|
|
77
|
+
* browser over the live twelve makes and over a worst case of the longest make
|
|
78
|
+
* on the stand with a four-digit count, at this gap:
|
|
81
79
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
80
|
+
* 200 → 4 columns in the storefront's 1088px pane, 3 rows
|
|
81
|
+
* 170 → 4 columns, 3 rows
|
|
82
|
+
* 160 → 4 columns, 3 rows
|
|
83
|
+
* 150 → 6 columns, 2 rows
|
|
84
|
+
*
|
|
85
|
+
* 150 is the knee, and nothing wraps at it: because the browser widens the
|
|
86
|
+
* columns to fill, the USED column is 155px in that pane and never below 152px
|
|
87
|
+
* at any width swept. The old claim that a value wraps under its own number
|
|
88
|
+
* below 200 does not hold at the default type step.
|
|
87
89
|
*/
|
|
88
|
-
export const
|
|
89
|
-
readonly minInlineSize: number;
|
|
90
|
-
readonly columns: number;
|
|
91
|
-
}[] = [
|
|
92
|
-
{ minInlineSize: POPULAR_VALUE_COLUMN_WIDTH * 2, columns: 2 },
|
|
93
|
-
{ minInlineSize: breakpoints.tablet, columns: 3 },
|
|
94
|
-
{ minInlineSize: breakpoints.desktop, columns: 4 },
|
|
95
|
-
];
|
|
90
|
+
export const POPULAR_VALUE_COLUMN_WIDTH = 150;
|
|
96
91
|
|
|
97
92
|
/**
|
|
98
|
-
* The
|
|
99
|
-
*
|
|
93
|
+
* The gutter between columns — one step up the scale from the row's own, so a
|
|
94
|
+
* new column reads as a column rather than as a wrapped line.
|
|
100
95
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
96
|
+
* Exported because it is half of the arithmetic that decides how many columns
|
|
97
|
+
* a pane produces (`floor((available + gap) / (width + gap))`), and a host
|
|
98
|
+
* sizing a reservation for this block should not have to re-measure it.
|
|
104
99
|
*/
|
|
105
|
-
export
|
|
106
|
-
const block = `.${POPULAR_VALUES_CLASS}`;
|
|
107
|
-
return [
|
|
108
|
-
`${block}{container-type:inline-size}`,
|
|
109
|
-
`${block}>[data-popular-columns]{column-count:1}`,
|
|
110
|
-
...POPULAR_VALUES_LADDER.map(
|
|
111
|
-
(rung) =>
|
|
112
|
-
`@container (min-width: ${String(rung.minInlineSize)}px)` +
|
|
113
|
-
`{${block}>[data-popular-columns]{column-count:${String(rung.columns)}}}`
|
|
114
|
-
),
|
|
115
|
-
].join("\n");
|
|
116
|
-
}
|
|
100
|
+
export const POPULAR_VALUES_COLUMN_GAP: number = spacing[6];
|
|
117
101
|
|
|
118
102
|
/** A value with no evidence behind it is not a popular value. Uncounted
|
|
119
103
|
* options carry `count: null` and are dropped here rather than printed with a
|
|
@@ -133,32 +117,55 @@ export function popularOptions(
|
|
|
133
117
|
}
|
|
134
118
|
|
|
135
119
|
/**
|
|
136
|
-
* The columns box
|
|
120
|
+
* The columns box, in its two arms.
|
|
121
|
+
*
|
|
122
|
+
* ── The responsive arm: a block, and a MEASURE ────────────────────────────
|
|
123
|
+
*
|
|
124
|
+
* `column-width` asks the element's own width how many columns fit. That is
|
|
125
|
+
* the whole mechanism — no container query, no rungs, no hoisted sheet, and no
|
|
126
|
+
* number that has to be kept in step with a layout this component cannot see.
|
|
127
|
+
* It is also what the expanded band next door already does, so the two arms of
|
|
128
|
+
* one control stop answering "how many columns" two different ways.
|
|
137
129
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
130
|
+
* What it replaced was a container-query ladder whose rungs were the token
|
|
131
|
+
* WINDOW breakpoints — and this block is the window less a 280px rail less the
|
|
132
|
+
* gap, so at 1440 it is 1088px wide and the rung that grants a fourth column
|
|
133
|
+
* (1200px) could never fire. The ladder's own doc argued that a media query
|
|
134
|
+
* would be wrong here for precisely that reason, and then used the window's
|
|
135
|
+
* numbers to measure the container.
|
|
143
136
|
*
|
|
144
|
-
* `inline-size: fit-content` is
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
137
|
+
* `inline-size: fit-content` is deliberately NOT here, and its absence is
|
|
138
|
+
* load-bearing twice over. It sized the box to its words — 377px of a 1088px
|
|
139
|
+
* pane on the live storefront, 711px of white beside twelve values stacked
|
|
140
|
+
* four deep — and it is measurably incompatible with a column measure: set
|
|
141
|
+
* together, the box collapses to a single column. The defect `fit-content` was
|
|
142
|
+
* added for (three ~360px columns each holding «Chery 5») cannot arise here,
|
|
143
|
+
* because a column is never wider than the pane divided by however many
|
|
144
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH} fit in it.
|
|
151
145
|
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
146
|
+
* `column-fill: balance` spreads the rows evenly over the columns the width
|
|
147
|
+
* produces, rather than filling the first column to the box's block-size.
|
|
148
|
+
*
|
|
149
|
+
* ── The numeric arm: unchanged, words-wide ────────────────────────────────
|
|
150
|
+
*
|
|
151
|
+
* A host that names a number has decided its own layout, and a count divides
|
|
152
|
+
* the container — so three columns of a box handed the whole results pane are
|
|
153
|
+
* three ~360px columns holding «Chery 5», a make and then 300px of nothing.
|
|
154
|
+
* `fit-content` is the cure there and stays: the box takes its natural measure
|
|
155
|
+
* (`columns × widest item + gaps`) unless the space is smaller, in which case
|
|
156
|
+
* the columns shrink rather than overflow.
|
|
155
157
|
*/
|
|
156
158
|
function COLUMNS(count: number | undefined): CSSProperties {
|
|
159
|
+
if (count === undefined) {
|
|
160
|
+
return {
|
|
161
|
+
columnWidth: POPULAR_VALUE_COLUMN_WIDTH,
|
|
162
|
+
columnGap: POPULAR_VALUES_COLUMN_GAP,
|
|
163
|
+
columnFill: "balance",
|
|
164
|
+
};
|
|
165
|
+
}
|
|
157
166
|
return {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
...(count === undefined ? {} : { columnCount: count }),
|
|
161
|
-
columnGap: spacing[6],
|
|
167
|
+
columnCount: count,
|
|
168
|
+
columnGap: POPULAR_VALUES_COLUMN_GAP,
|
|
162
169
|
inlineSize: "fit-content",
|
|
163
170
|
maxInlineSize: "100%",
|
|
164
171
|
};
|
|
@@ -186,10 +193,12 @@ export interface PopularValuesProps {
|
|
|
186
193
|
/**
|
|
187
194
|
* How many columns. Default {@link POPULAR_VALUES_COLUMNS}.
|
|
188
195
|
*
|
|
189
|
-
* `"responsive"`
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
196
|
+
* `"responsive"` hands the question to the ELEMENT: native multicol over
|
|
197
|
+
* {@link POPULAR_VALUE_COLUMN_WIDTH} fits as many columns as this block's own
|
|
198
|
+
* width allows, at every width, with no rungs to keep in step with a layout
|
|
199
|
+
* this component cannot see. The numeric form stays, and stays the default:
|
|
200
|
+
* a host that has already decided its layout should not have that decision
|
|
201
|
+
* taken back.
|
|
193
202
|
*/
|
|
194
203
|
readonly columns?: number | "responsive";
|
|
195
204
|
/** The block's heading. Defaults to the group's own label; `null` draws
|
|
@@ -213,7 +222,6 @@ export function PopularValues(props: PopularValuesProps): ReactElement | null {
|
|
|
213
222
|
<Flex
|
|
214
223
|
vertical
|
|
215
224
|
gap={spacing[2]}
|
|
216
|
-
{...(responsive ? { className: POPULAR_VALUES_CLASS } : {})}
|
|
217
225
|
data-testid={`popular-values-${group.slug}`}
|
|
218
226
|
data-label-source={group.labelSource}
|
|
219
227
|
data-columns={responsive ? "responsive" : String(props.columns ?? POPULAR_VALUES_COLUMNS)}
|
|
@@ -222,19 +230,10 @@ export function PopularValues(props: PopularValuesProps): ReactElement | null {
|
|
|
222
230
|
<style href={POINTER_FOCUS_STYLE_HREF} precedence="default">
|
|
223
231
|
{pointerFocusCss()}
|
|
224
232
|
</style>
|
|
225
|
-
{/* The ladder, hoisted and deduped by `href`: a container query has no
|
|
226
|
-
inline form. Only where it is asked for — a block with a fixed
|
|
227
|
-
column count needs no sheet at all. */}
|
|
228
|
-
{responsive && (
|
|
229
|
-
<style href={POPULAR_VALUES_STYLE_HREF} precedence="default">
|
|
230
|
-
{popularValuesLadderCss()}
|
|
231
|
-
</style>
|
|
232
|
-
)}
|
|
233
233
|
{props.heading !== null && (
|
|
234
234
|
<Typography.Text strong>{props.heading ?? group.label}</Typography.Text>
|
|
235
235
|
)}
|
|
236
236
|
<div
|
|
237
|
-
{...(responsive ? { "data-popular-columns": "" } : {})}
|
|
238
237
|
data-testid={`popular-columns-${group.slug}`}
|
|
239
238
|
style={COLUMNS(
|
|
240
239
|
responsive
|
package/src/default/index.ts
CHANGED
|
@@ -189,13 +189,10 @@ export type { ColorAxisLike, TermExtra } from "./swatches.js";
|
|
|
189
189
|
export {
|
|
190
190
|
PopularValues,
|
|
191
191
|
popularOptions,
|
|
192
|
-
popularValuesLadderCss,
|
|
193
|
-
POPULAR_VALUES_CLASS,
|
|
194
192
|
POPULAR_VALUES_COLUMNS,
|
|
195
|
-
|
|
193
|
+
POPULAR_VALUES_COLUMN_GAP,
|
|
196
194
|
POPULAR_VALUES_LIMIT,
|
|
197
195
|
POPULAR_VALUES_MAX_COLUMNS,
|
|
198
|
-
POPULAR_VALUES_STYLE_HREF,
|
|
199
196
|
POPULAR_VALUE_COLUMN_WIDTH,
|
|
200
197
|
} from "./PopularValues.js";
|
|
201
198
|
export type { PopularValuesProps } from "./PopularValues.js";
|