@stapel/listings-react 0.23.0 → 0.25.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 +93 -0
- package/MODULE.md +4 -0
- package/README.md +75 -0
- package/dist/api/generated/schema.d.ts +126 -11
- package/dist/api/generated/schema.d.ts.map +1 -1
- package/dist/api/listingsApi.d.ts +5 -3
- package/dist/api/listingsApi.d.ts.map +1 -1
- package/dist/api/listingsApi.js.map +1 -1
- package/dist/api/types.d.ts +51 -4
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js.map +1 -1
- package/dist/default/CardBadges.d.ts +47 -0
- package/dist/default/CardBadges.d.ts.map +1 -0
- package/dist/default/CardBadges.js +38 -0
- package/dist/default/CardBadges.js.map +1 -0
- package/dist/default/ListingCard.d.ts.map +1 -1
- package/dist/default/ListingCard.js +6 -6
- package/dist/default/ListingCard.js.map +1 -1
- package/dist/default/ListingDetailPane.d.ts.map +1 -1
- package/dist/default/ListingDetailPane.js +12 -19
- package/dist/default/ListingDetailPane.js.map +1 -1
- package/dist/default/ListingPhoto.d.ts.map +1 -1
- package/dist/default/ListingPhoto.js +12 -8
- package/dist/default/ListingPhoto.js.map +1 -1
- package/dist/default/ListingSerpCard.d.ts.map +1 -1
- package/dist/default/ListingSerpCard.js +3 -5
- package/dist/default/ListingSerpCard.js.map +1 -1
- package/dist/default/ListingSpecList.d.ts +74 -0
- package/dist/default/ListingSpecList.d.ts.map +1 -0
- package/dist/default/ListingSpecList.js +90 -0
- package/dist/default/ListingSpecList.js.map +1 -0
- package/dist/default/cardGallery.d.ts +81 -0
- package/dist/default/cardGallery.d.ts.map +1 -0
- package/dist/default/cardGallery.js +266 -0
- package/dist/default/cardGallery.js.map +1 -0
- package/dist/default/index.d.ts +6 -0
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +5 -0
- package/dist/default/index.js.map +1 -1
- package/dist/headless/ListingComposer.d.ts +20 -2
- package/dist/headless/ListingComposer.d.ts.map +1 -1
- package/dist/headless/ListingComposer.js +19 -4
- package/dist/headless/ListingComposer.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +1 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/generated/errors.es.gen.d.ts +1 -1
- package/dist/i18n/generated/errors.es.gen.js +1 -1
- package/dist/i18n/generated/errors.gen.d.ts +6 -0
- package/dist/i18n/generated/errors.gen.d.ts.map +1 -1
- package/dist/i18n/generated/errors.gen.js +3 -0
- package/dist/i18n/generated/errors.gen.js.map +1 -1
- package/dist/i18n/generated/errors.ru.gen.d.ts +1 -1
- package/dist/i18n/generated/errors.ru.gen.js +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +3 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/model/cardBadges.d.ts +134 -0
- package/dist/model/cardBadges.d.ts.map +1 -0
- package/dist/model/cardBadges.js +131 -0
- package/dist/model/cardBadges.js.map +1 -0
- package/dist/model/draft.d.ts +10 -2
- package/dist/model/draft.d.ts.map +1 -1
- package/dist/model/draft.js +22 -4
- package/dist/model/draft.js.map +1 -1
- package/dist/model/featureText.d.ts +85 -0
- package/dist/model/featureText.d.ts.map +1 -0
- package/dist/model/featureText.js +153 -0
- package/dist/model/featureText.js.map +1 -0
- package/dist/model/features.d.ts.map +1 -1
- package/dist/model/features.js +59 -0
- package/dist/model/features.js.map +1 -1
- package/llms.txt +5 -2
- package/manifest.json +47 -1
- package/nav-manifest.json +1 -1
- package/package.json +10 -10
- package/src/analytics/generated/events.json +1 -1
- package/src/api/generated/schema.ts +126 -11
- package/src/api/listingsApi.ts +5 -3
- package/src/api/types.ts +60 -6
- package/src/default/CardBadges.tsx +105 -0
- package/src/default/ListingCard.tsx +7 -21
- package/src/default/ListingDetailPane.tsx +13 -37
- package/src/default/ListingPhoto.tsx +54 -26
- package/src/default/ListingSerpCard.tsx +10 -28
- package/src/default/ListingSpecList.tsx +195 -0
- package/src/default/cardGallery.ts +287 -0
- package/src/default/index.ts +22 -0
- package/src/headless/ListingComposer.tsx +39 -5
- package/src/i18n/es.ts +3 -0
- package/src/i18n/generated/errors.es.gen.ts +1 -1
- package/src/i18n/generated/errors.gen.ts +3 -0
- package/src/i18n/generated/errors.json +9 -0
- package/src/i18n/generated/errors.ru.gen.ts +1 -1
- package/src/i18n/ru.ts +5 -0
- package/src/index.ts +15 -0
- package/src/model/cardBadges.ts +237 -0
- package/src/model/draft.ts +23 -5
- package/src/model/featureText.ts +251 -0
- package/src/model/features.ts +60 -0
|
@@ -3,14 +3,14 @@ import { Card, Flex, Typography, theme as antdTheme } from "antd";
|
|
|
3
3
|
import { SkinTheme } from "@stapel/tokens-antd/skin";
|
|
4
4
|
import { useT } from "@stapel/core";
|
|
5
5
|
import { fontSize, spacing } from "@stapel/tokens";
|
|
6
|
-
import {
|
|
7
|
-
import { asFeatureDaoList, featuresDtoFromDaoList, featuresFromDaoList, } from "../model/features.js";
|
|
6
|
+
import { asFeatureDaoList } from "../model/features.js";
|
|
8
7
|
import { lifecycleCaption } from "../model/status.js";
|
|
9
8
|
import { isListingViewed } from "../model/engagement.js";
|
|
10
9
|
import { useEngagedListing } from "../headless/Engagement.js";
|
|
11
10
|
import { LISTINGS_I18N_KEYS } from "../i18n/keys.js";
|
|
12
11
|
import { PriceTrendIcon } from "./icons.js";
|
|
13
12
|
import { FavoriteHeart } from "./favorite.js";
|
|
13
|
+
import { CardBadges, CardSpecLine } from "./CardBadges.js";
|
|
14
14
|
import { CARD_FRAME_CLASS, CARD_MAIN_CLASS, CARD_MEDIA_CLASS, CARD_QUERY_CLASS, CARD_TARGET_STYLE_HREF, CARD_HOVER_CLASS, CARD_VIEWED_CLASS, CardTarget, cardTargetCss, } from "./ListingCard.js";
|
|
15
15
|
import { ListingPhotoStrip } from "./ListingPhoto.js";
|
|
16
16
|
import { ListingPrice } from "./ListingPrice.js";
|
|
@@ -32,8 +32,6 @@ export function ListingSerpCard(props) {
|
|
|
32
32
|
const copy = props.categoryFeatures !== undefined
|
|
33
33
|
? { categoryFeatures: props.categoryFeatures }
|
|
34
34
|
: {};
|
|
35
|
-
const badgeFeatures = featuresFromDaoList(badgeDaos, copy);
|
|
36
|
-
const badgeValues = featuresDtoFromDaoList(badgeDaos);
|
|
37
35
|
// The fallback spec line when the host derived none: the row's own
|
|
38
36
|
// `features_title` projection, exactly the line `ListingCard` draws.
|
|
39
37
|
const titleDaos = props.specsLine !== undefined && props.specsLine.length > 0
|
|
@@ -65,7 +63,7 @@ export function ListingSerpCard(props) {
|
|
|
65
63
|
["--listing-card-hover-shadow"]: token.boxShadowSecondary,
|
|
66
64
|
}, children: _jsx("div", { className: CARD_QUERY_CLASS, children: _jsxs("div", { className: CARD_FRAME_CLASS, style: { gap: spacing[3] }, children: [_jsx("div", { className: CARD_MEDIA_CLASS, children: _jsx(ListingPhotoStrip, { images: photos, title: title.length > 0 ? title : String(listing.id), testId: "listings-serp-photos" }) }), _jsx("div", { className: CARD_MAIN_CLASS, children: _jsxs(Flex, { gap: spacing[3], align: "flex-start", children: [_jsxs(Flex, { vertical: true, gap: spacing[1], style: BODY, children: [_jsxs(CardTarget, { ...openProps(props), listingId: listing.id, label: targetLabel, testId: "listings-serp-open", bodyTestId: "listings-serp-body", children: [props.badge, _jsxs(Flex, { align: "center", gap: spacing[2], wrap: true, children: [_jsx(Typography.Text, { strong: true, style: { fontSize: fontSize.xl.fontSize }, "data-testid": "listings-serp-price", children: _jsx(ListingPrice, { amount: listing.price, ...currency }) }), priceTrend !== undefined && (_jsx(PriceTrendIcon, { direction: priceTrend.direction, label: t(priceTrend.direction === "down"
|
|
67
65
|
? LISTINGS_I18N_KEYS.cardPriceDropped
|
|
68
|
-
: LISTINGS_I18N_KEYS.cardPriceRaised) }))] }), priceTrend !== undefined && (_jsxs(Flex, { align: "baseline", gap: spacing[1], "data-testid": "listings-serp-old-price", children: [_jsx(Typography.Text, { type: "secondary", children: t(LISTINGS_I18N_KEYS.cardPriceWas) }), _jsx(Typography.Text, { type: "secondary", delete: true, children: _jsx(ListingPrice, { amount: priceTrend.oldPrice, ...currency }) })] })), _jsx(Typography.Text, { "data-testid": "listings-serp-title", children: title }), props.specsLine !== undefined && props.specsLine.length > 0 ? (_jsx(Typography.Text, { type: "secondary", ellipsis: true, "data-testid": "listings-serp-specs", children: props.specsLine })) :
|
|
66
|
+
: LISTINGS_I18N_KEYS.cardPriceRaised) }))] }), priceTrend !== undefined && (_jsxs(Flex, { align: "baseline", gap: spacing[1], "data-testid": "listings-serp-old-price", children: [_jsx(Typography.Text, { type: "secondary", children: t(LISTINGS_I18N_KEYS.cardPriceWas) }), _jsx(Typography.Text, { type: "secondary", delete: true, children: _jsx(ListingPrice, { amount: priceTrend.oldPrice, ...currency }) })] })), _jsx(Typography.Text, { "data-testid": "listings-serp-title", children: title }), props.specsLine !== undefined && props.specsLine.length > 0 ? (_jsx(Typography.Text, { type: "secondary", ellipsis: true, "data-testid": "listings-serp-specs", children: props.specsLine })) : (_jsx(CardSpecLine, { rows: titleDaos, copy: copy, testId: "listings-serp-specs" })), _jsx(CardBadges, { rows: badgeDaos, copy: copy, variant: "badges" })] }), props.sellerSlot ?? null, listing.location_label !== undefined &&
|
|
69
67
|
listing.location_label.length > 0 ? (_jsx(Typography.Text, { type: "secondary", "data-testid": "listings-serp-location", children: listing.location_label })) : null] }), rail] }) })] }) }) })] }));
|
|
70
68
|
}
|
|
71
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListingSerpCard.js","sourceRoot":"","sources":["../../src/default/ListingSerpCard.tsx"],"names":[],"mappings":";AA4EA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAClE,OAAO,EAAE,SAAS,E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AE,KAAK,CAAC,aAAa,EAAE;YAC1D,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IAChE,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The listing page's spec rows ("Characteristics"), as SENTENCES.
|
|
3
|
+
*
|
|
4
|
+
* ── What was on screen, and why a table was the wrong shape ───────────────
|
|
5
|
+
*
|
|
6
|
+
* The list was `<Descriptions column={1}>`: a real two-column table, label
|
|
7
|
+
* cell beside value cell. On a phone — and in the split layout's half-width
|
|
8
|
+
* left column — the value cell is narrow, so a long answer ("Trim level",
|
|
9
|
+
* a full trim name, a two-line address) wrapped INSIDE it and stacked under
|
|
10
|
+
* itself in a column a third of the page wide, beside acres of empty label
|
|
11
|
+
* gutter. A spec row is not tabular data that a reader scans down one axis;
|
|
12
|
+
* it is a short question and its answer, and it reads as a line of text.
|
|
13
|
+
*
|
|
14
|
+
* So the label is an inline `<span>`, muted, and the value follows it in the
|
|
15
|
+
* SAME text flow. A long value now wraps as a paragraph — full measure,
|
|
16
|
+
* hanging under the label — and a short one costs one line instead of a row
|
|
17
|
+
* of a table.
|
|
18
|
+
*
|
|
19
|
+
* ── The two-column grid that survives is a grid of ROWS ───────────────────
|
|
20
|
+
*
|
|
21
|
+
* The split layout still puts two columns of spec rows side by side on a wide
|
|
22
|
+
* screen, because a forty-row list under a photograph is a scroll nobody
|
|
23
|
+
* finishes. What is gone is the label being its own COLUMN: the columns hold
|
|
24
|
+
* whole rows, cut by row count so the category's declaration order still
|
|
25
|
+
* reads top-to-bottom, left column first. `<ListingSpecColumns>` is that cut,
|
|
26
|
+
* kept here beside the row it cuts.
|
|
27
|
+
*
|
|
28
|
+
* ── Units and digits ─────────────────────────────────────────────────────
|
|
29
|
+
*
|
|
30
|
+
* Every value goes through `formatSpecValue` rather than the shared
|
|
31
|
+
* `formatFeatureValue`: same answer, typeset — the unit appended and the
|
|
32
|
+
* digits grouped by the reader's locale. `model/featureText.ts` says where
|
|
33
|
+
* the unit comes from and why there is no `unit` key to read it from.
|
|
34
|
+
*/
|
|
35
|
+
import type { CSSProperties, ReactElement } from "react";
|
|
36
|
+
import type { FeatureDef, FeatureValueDto } from "@stapel/attributes-react";
|
|
37
|
+
/** The class one spec row carries. */
|
|
38
|
+
export declare const SPEC_ROW_CLASS = "stapel-listing-spec-row";
|
|
39
|
+
/** The class the row's inline label carries. */
|
|
40
|
+
export declare const SPEC_LABEL_CLASS = "stapel-listing-spec-label";
|
|
41
|
+
/** The `href` the hoisted spec stylesheet is deduplicated by. */
|
|
42
|
+
export declare const SPEC_STYLE_HREF = "stapel-listings-spec";
|
|
43
|
+
/**
|
|
44
|
+
* The rules an inline style cannot express — the label's own colour is set
|
|
45
|
+
* per-instance as a custom property so ONE hoisted copy serves either theme.
|
|
46
|
+
*
|
|
47
|
+
* `display: inline` on the label is the whole fix and is stated rather than
|
|
48
|
+
* inherited: antd's `<Text>` renders a `<span>`, but a skin that retunes it
|
|
49
|
+
* to a block would silently put the table back.
|
|
50
|
+
*/
|
|
51
|
+
export declare function specListCss(): string;
|
|
52
|
+
export interface ListingSpecListProps {
|
|
53
|
+
/** The category's features, in the order they are declared. */
|
|
54
|
+
readonly features: readonly FeatureDef[];
|
|
55
|
+
/** The DISPLAY envelope — redacted stubs included, which is what makes a
|
|
56
|
+
* withheld row keep its place. */
|
|
57
|
+
readonly values: Readonly<Record<string, FeatureValueDto>>;
|
|
58
|
+
/** The surface's own test id, so a split page holding two columns of these
|
|
59
|
+
* does not hand a test two elements under one name. */
|
|
60
|
+
readonly testId?: string;
|
|
61
|
+
readonly style?: CSSProperties;
|
|
62
|
+
}
|
|
63
|
+
export declare function ListingSpecList(props: ListingSpecListProps): ReactElement;
|
|
64
|
+
/**
|
|
65
|
+
* The same rows in TWO columns on a wide screen — a grid of whole rows, cut
|
|
66
|
+
* by row count so the category's declaration order still reads top-to-bottom,
|
|
67
|
+
* left column first.
|
|
68
|
+
*
|
|
69
|
+
* The cut is here rather than inside the list because a CSS `columns` rule
|
|
70
|
+
* would break a wrapped paragraph across the column boundary, which is
|
|
71
|
+
* exactly the defect the paragraph shape was adopted to avoid.
|
|
72
|
+
*/
|
|
73
|
+
export declare function ListingSpecColumns(props: ListingSpecListProps): ReactElement;
|
|
74
|
+
//# sourceMappingURL=ListingSpecList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListingSpecList.d.ts","sourceRoot":"","sources":["../../src/default/ListingSpecList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAazD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG5E,sCAAsC;AACtC,eAAO,MAAM,cAAc,4BAA4B,CAAC;AACxD,gDAAgD;AAChD,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAC5D,iEAAiE;AACjE,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAWpC;AAED,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC;sCACkC;IAClC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAC3D;2DACuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC;AAaD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAwDzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CA0B5E"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography, theme as antdTheme } from "antd";
|
|
3
|
+
import { SkinTheme } from "@stapel/tokens-antd/skin";
|
|
4
|
+
import { useI18n, useT } from "@stapel/core";
|
|
5
|
+
import { spacing } from "@stapel/tokens";
|
|
6
|
+
import { ATTRIBUTES_I18N_KEYS, featureName, featureType, isRedactedValue, isValuePresent, isValueVerified, } from "@stapel/attributes-react";
|
|
7
|
+
import { formatSpecValue } from "../model/featureText.js";
|
|
8
|
+
/** The class one spec row carries. */
|
|
9
|
+
export const SPEC_ROW_CLASS = "stapel-listing-spec-row";
|
|
10
|
+
/** The class the row's inline label carries. */
|
|
11
|
+
export const SPEC_LABEL_CLASS = "stapel-listing-spec-label";
|
|
12
|
+
/** The `href` the hoisted spec stylesheet is deduplicated by. */
|
|
13
|
+
export const SPEC_STYLE_HREF = "stapel-listings-spec";
|
|
14
|
+
/**
|
|
15
|
+
* The rules an inline style cannot express — the label's own colour is set
|
|
16
|
+
* per-instance as a custom property so ONE hoisted copy serves either theme.
|
|
17
|
+
*
|
|
18
|
+
* `display: inline` on the label is the whole fix and is stated rather than
|
|
19
|
+
* inherited: antd's `<Text>` renders a `<span>`, but a skin that retunes it
|
|
20
|
+
* to a block would silently put the table back.
|
|
21
|
+
*/
|
|
22
|
+
export function specListCss() {
|
|
23
|
+
return [
|
|
24
|
+
// A paragraph, not a table row. `margin: 0` because the gap between rows
|
|
25
|
+
// is the list's, so a row can be lifted into a grid cell unchanged.
|
|
26
|
+
`.${SPEC_ROW_CLASS}{margin:0;min-inline-size:0;overflow-wrap:anywhere}`,
|
|
27
|
+
`.${SPEC_LABEL_CLASS}{display:inline;color:var(--listing-spec-label)}`,
|
|
28
|
+
// The one space between the question and the answer, owned by the label
|
|
29
|
+
// rather than written as a text node — a `{" "}` between two JSX elements
|
|
30
|
+
// is the kind of whitespace a formatter deletes.
|
|
31
|
+
`.${SPEC_LABEL_CLASS}::after{content:"\\00a0"}`,
|
|
32
|
+
].join("");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A withheld value's row: what the system OBSERVED, and nothing more — the
|
|
36
|
+
* same three states `@stapel/attributes-react` prints, said with its own
|
|
37
|
+
* copy keys so the two lists cannot drift into two different sentences.
|
|
38
|
+
*/
|
|
39
|
+
function redactedText(dto, t) {
|
|
40
|
+
if (!isValuePresent(dto))
|
|
41
|
+
return t(ATTRIBUTES_I18N_KEYS.valueNotSet);
|
|
42
|
+
if (isValueVerified(dto))
|
|
43
|
+
return t(ATTRIBUTES_I18N_KEYS.valueVerified);
|
|
44
|
+
return t(ATTRIBUTES_I18N_KEYS.valueProvided);
|
|
45
|
+
}
|
|
46
|
+
export function ListingSpecList(props) {
|
|
47
|
+
const t = useT();
|
|
48
|
+
const { locale } = useI18n();
|
|
49
|
+
const { token } = antdTheme.useToken();
|
|
50
|
+
// A `header` is a section caption in a FORM, not a value: it has none, and
|
|
51
|
+
// a spec table that printed one would print "not specified" under it.
|
|
52
|
+
const rows = props.features.filter((feature) => featureType(feature) !== "header");
|
|
53
|
+
return (_jsxs(SkinTheme, { surface: "bare", children: [_jsx("style", { href: SPEC_STYLE_HREF, precedence: "default", children: specListCss() }), _jsx("div", { "data-testid": props.testId ?? "listings-spec-list", style: {
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "column",
|
|
56
|
+
gap: spacing[1],
|
|
57
|
+
minWidth: 0,
|
|
58
|
+
["--listing-spec-label"]: token.colorTextSecondary,
|
|
59
|
+
...props.style,
|
|
60
|
+
}, children: rows.map((feature) => {
|
|
61
|
+
const dto = props.values[feature.slug];
|
|
62
|
+
const redacted = isRedactedValue(dto);
|
|
63
|
+
const text = redacted
|
|
64
|
+
? redactedText(dto, t)
|
|
65
|
+
: (formatSpecValue(feature, dto, { t, locale }) ??
|
|
66
|
+
t(dto === undefined || featureType(feature) === undefined
|
|
67
|
+
? ATTRIBUTES_I18N_KEYS.valueNotSet
|
|
68
|
+
: ATTRIBUTES_I18N_KEYS.valueUnreadable));
|
|
69
|
+
return (_jsxs("p", { className: SPEC_ROW_CLASS, "data-testid": `listings-spec-row-${feature.slug}`, children: [_jsx(Typography.Text, { type: "secondary", className: SPEC_LABEL_CLASS, "data-testid": `listings-spec-label-${feature.slug}`, children: featureName(feature) }), _jsx("span", { "data-testid": `listings-spec-value-${feature.slug}`, children: text })] }, feature.slug));
|
|
70
|
+
}) })] }));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The same rows in TWO columns on a wide screen — a grid of whole rows, cut
|
|
74
|
+
* by row count so the category's declaration order still reads top-to-bottom,
|
|
75
|
+
* left column first.
|
|
76
|
+
*
|
|
77
|
+
* The cut is here rather than inside the list because a CSS `columns` rule
|
|
78
|
+
* would break a wrapped paragraph across the column boundary, which is
|
|
79
|
+
* exactly the defect the paragraph shape was adopted to avoid.
|
|
80
|
+
*/
|
|
81
|
+
export function ListingSpecColumns(props) {
|
|
82
|
+
const half = Math.ceil(props.features.length / 2);
|
|
83
|
+
return (_jsxs("div", { "data-testid": props.testId ?? "listings-detail-specs-split", style: {
|
|
84
|
+
display: "grid",
|
|
85
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
86
|
+
gap: spacing[4],
|
|
87
|
+
alignItems: "start",
|
|
88
|
+
}, children: [_jsx(ListingSpecList, { features: props.features.slice(0, half), values: props.values, testId: "listings-spec-list" }), props.features.length > half ? (_jsx(ListingSpecList, { features: props.features.slice(half), values: props.values, testId: "listings-spec-list-second" })) : null] }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ListingSpecList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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EAAC,2BAA2B,GAClC,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { PointerEvent as ReactPointerEvent, RefObject } from "react";
|
|
2
|
+
/** The class the gallery's own box carries — see {@link cardGalleryCss}. */
|
|
3
|
+
export declare const CARD_GALLERY_CLASS = "stapel-listing-gallery";
|
|
4
|
+
/** The `href` the hoisted gallery stylesheet is deduplicated by. */
|
|
5
|
+
export declare const CARD_GALLERY_STYLE_HREF = "stapel-listings-card-gallery";
|
|
6
|
+
/** The environment a hover scrub is allowed in, and the only one. */
|
|
7
|
+
export declare const SCRUB_MEDIA = "(hover: hover) and (pointer: fine)";
|
|
8
|
+
/**
|
|
9
|
+
* How far a finger travels before it has said "photo", in CSS pixels.
|
|
10
|
+
*
|
|
11
|
+
* Under this, a drag is a tap that wobbled — and a tap on a card is a
|
|
12
|
+
* navigation, so a low threshold does not change a photograph, it changes one
|
|
13
|
+
* and then leaves the listing.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SWIPE_MIN_PX = 32;
|
|
16
|
+
/**
|
|
17
|
+
* How much more horizontal than vertical a drag must be to count.
|
|
18
|
+
*
|
|
19
|
+
* 1.2 rather than 1: a thumb scrolling a feed travels a few degrees off
|
|
20
|
+
* vertical, and a bare `|dx| > |dy|` comparison hands the gesture to the
|
|
21
|
+
* gallery on the first pixel where the wobble wins.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SWIPE_AXIS_RATIO = 1.2;
|
|
24
|
+
/**
|
|
25
|
+
* Which of `count` equal segments the pointer is over.
|
|
26
|
+
*
|
|
27
|
+
* Clamped at both ends: `offsetX` can be reported one pixel past the box's
|
|
28
|
+
* own width, and an index of `count` is a photograph that does not exist.
|
|
29
|
+
*/
|
|
30
|
+
export declare function segmentIndex(offsetX: number, width: number, count: number): number;
|
|
31
|
+
/**
|
|
32
|
+
* A drag → the number of photographs it asks for: `1` forward, `-1` back, `0`
|
|
33
|
+
* for a drag that has not declared horizontal intent.
|
|
34
|
+
*
|
|
35
|
+
* Dragging LEFT advances, the direction the content moves under the finger —
|
|
36
|
+
* the same mapping the native scroller has.
|
|
37
|
+
*/
|
|
38
|
+
export declare function swipeStep(dx: number, dy: number): -1 | 0 | 1;
|
|
39
|
+
/** Does this environment have a real pointer? `false` where there is no
|
|
40
|
+
* `matchMedia` to ask (a server render, an old jsdom), which is the safe
|
|
41
|
+
* side: a scrub that does not happen costs a hover, a scrub on a phone is a
|
|
42
|
+
* photograph that changes when nobody touched it. */
|
|
43
|
+
export declare function hasFinePointer(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* {@link hasFinePointer}, as state.
|
|
46
|
+
*
|
|
47
|
+
* It opens `false` and settles in an effect rather than reading the media
|
|
48
|
+
* query during render: a server render has no `matchMedia`, and a first
|
|
49
|
+
* client render that disagreed with it is a hydration mismatch on every card
|
|
50
|
+
* on the page. Nothing is drawn differently either way — the flag only gates
|
|
51
|
+
* a gesture — so the one frame it costs is invisible.
|
|
52
|
+
*/
|
|
53
|
+
export declare function useFinePointer(): boolean;
|
|
54
|
+
/** The handlers and the box reference a gallery hands its media well. */
|
|
55
|
+
export interface CardGallery {
|
|
56
|
+
readonly ref: RefObject<HTMLDivElement | null>;
|
|
57
|
+
/** The photograph currently on screen. */
|
|
58
|
+
readonly active: number;
|
|
59
|
+
/** True while a pointer is scrubbing — the box publishes it so the strip's
|
|
60
|
+
* smooth-scroll can be switched off for the duration. */
|
|
61
|
+
readonly scrubbing: boolean;
|
|
62
|
+
readonly onPointerMove: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
63
|
+
readonly onPointerDown: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
64
|
+
readonly onPointerUp: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
65
|
+
readonly onPointerCancel: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
66
|
+
readonly onPointerLeave: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The gallery gestures for a media well holding `count` photographs.
|
|
70
|
+
*
|
|
71
|
+
* A well with one photograph gets an inert bag: every handler returns
|
|
72
|
+
* immediately, so a grid of forty single-photo tiles pays for nothing.
|
|
73
|
+
*/
|
|
74
|
+
export declare function useCardGallery(count: number): CardGallery;
|
|
75
|
+
/**
|
|
76
|
+
* The rules an inline style cannot reach: they apply to the STRIP inside the
|
|
77
|
+
* carousel, which this package renders through a component and does not hold
|
|
78
|
+
* a handle on.
|
|
79
|
+
*/
|
|
80
|
+
export declare function cardGalleryCss(): string;
|
|
81
|
+
//# sourceMappingURL=cardGallery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardGallery.d.ts","sourceRoot":"","sources":["../../src/default/cardGallery.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,YAAY,IAAI,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAEtE,qEAAqE;AACrE,eAAO,MAAM,WAAW,uCAAuC,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIlF;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAK5D;AAED;;;qDAGqD;AACrD,wBAAgB,cAAc,IAAI,OAAO,CAOxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,OAAO,CA0BxC;AAED,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/C,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;6DACyD;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACzE,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC7E,QAAQ,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CAC7E;AAoBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CA0EzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAevC"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The card gallery's two gestures — the ones a classified is expected to have
|
|
3
|
+
* and this pair did not.
|
|
4
|
+
*
|
|
5
|
+
* ── Hover scrub, on a device that has a pointer ──────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* A card with six photographs showed one, and the only way to the other five
|
|
8
|
+
* was to open the listing. Every mature classified answers this the same way:
|
|
9
|
+
* the media box is divided into N equal segments, and the segment the cursor
|
|
10
|
+
* is over IS the photograph on screen. Six photos become six glances and no
|
|
11
|
+
* clicks, and the pointer leaving puts the first photo back — the card must
|
|
12
|
+
* be in the same state after a hover as before one, or a grid of forty tiles
|
|
13
|
+
* becomes forty different tiles depending on where a cursor happened to pass.
|
|
14
|
+
*
|
|
15
|
+
* It is gated on `(hover: hover) and (pointer: fine)` and on a `mouse`
|
|
16
|
+
* pointer type, both, and the two gates are not redundant: the media query
|
|
17
|
+
* says the DEVICE has a real pointer, the pointer type says THIS gesture came
|
|
18
|
+
* from it. A touch laptop answers `hover: hover` and still delivers finger
|
|
19
|
+
* events, and a scrub driven by a finger dragging across the box is the
|
|
20
|
+
* gesture below wearing the wrong costume.
|
|
21
|
+
*
|
|
22
|
+
* ── Swipe, on a device that does not ─────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* A finger gets the same six photographs by swiping horizontally, one photo
|
|
25
|
+
* per swipe, in either direction.
|
|
26
|
+
*
|
|
27
|
+
* The rule that matters is the one about the OTHER axis: a card is a small
|
|
28
|
+
* box inside a long scrolling feed, and a gesture layer that treats every
|
|
29
|
+
* touch as its own turns the page into something that will not scroll. So
|
|
30
|
+
* the strip declares `touch-action: pan-y` — the browser keeps the vertical
|
|
31
|
+
* axis, unconditionally, and can never be argued out of it — and this hook
|
|
32
|
+
* only acts on a drag that has declared horizontal INTENT: past
|
|
33
|
+
* {@link SWIPE_MIN_PX}, and further across than down by
|
|
34
|
+
* {@link SWIPE_AXIS_RATIO}. A diagonal thumb scrolling the feed changes no
|
|
35
|
+
* photograph.
|
|
36
|
+
*
|
|
37
|
+
* ── What neither gesture touches ─────────────────────────────────────────
|
|
38
|
+
*
|
|
39
|
+
* The keyboard, and the card's single link target. The strip underneath is
|
|
40
|
+
* still `<SkinCarousel>`: a real scroll container, a tab stop, arrow-key
|
|
41
|
+
* scrollable, with the slides in the document and its own dots reporting the
|
|
42
|
+
* position. Both gestures below work by SCROLLING it — they set no state the
|
|
43
|
+
* strip does not already publish — so what a keyboard reaches, what a screen
|
|
44
|
+
* reader reads and what the dots say are unchanged, and the card stays one
|
|
45
|
+
* anchor with one accessible name.
|
|
46
|
+
*/
|
|
47
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
48
|
+
/** The class the gallery's own box carries — see {@link cardGalleryCss}. */
|
|
49
|
+
export const CARD_GALLERY_CLASS = "stapel-listing-gallery";
|
|
50
|
+
/** The `href` the hoisted gallery stylesheet is deduplicated by. */
|
|
51
|
+
export const CARD_GALLERY_STYLE_HREF = "stapel-listings-card-gallery";
|
|
52
|
+
/** The environment a hover scrub is allowed in, and the only one. */
|
|
53
|
+
export const SCRUB_MEDIA = "(hover: hover) and (pointer: fine)";
|
|
54
|
+
/**
|
|
55
|
+
* How far a finger travels before it has said "photo", in CSS pixels.
|
|
56
|
+
*
|
|
57
|
+
* Under this, a drag is a tap that wobbled — and a tap on a card is a
|
|
58
|
+
* navigation, so a low threshold does not change a photograph, it changes one
|
|
59
|
+
* and then leaves the listing.
|
|
60
|
+
*/
|
|
61
|
+
export const SWIPE_MIN_PX = 32;
|
|
62
|
+
/**
|
|
63
|
+
* How much more horizontal than vertical a drag must be to count.
|
|
64
|
+
*
|
|
65
|
+
* 1.2 rather than 1: a thumb scrolling a feed travels a few degrees off
|
|
66
|
+
* vertical, and a bare `|dx| > |dy|` comparison hands the gesture to the
|
|
67
|
+
* gallery on the first pixel where the wobble wins.
|
|
68
|
+
*/
|
|
69
|
+
export const SWIPE_AXIS_RATIO = 1.2;
|
|
70
|
+
/**
|
|
71
|
+
* Which of `count` equal segments the pointer is over.
|
|
72
|
+
*
|
|
73
|
+
* Clamped at both ends: `offsetX` can be reported one pixel past the box's
|
|
74
|
+
* own width, and an index of `count` is a photograph that does not exist.
|
|
75
|
+
*/
|
|
76
|
+
export function segmentIndex(offsetX, width, count) {
|
|
77
|
+
if (count <= 1 || width <= 0)
|
|
78
|
+
return 0;
|
|
79
|
+
const raw = Math.floor((offsetX / width) * count);
|
|
80
|
+
return Math.min(count - 1, Math.max(0, raw));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A drag → the number of photographs it asks for: `1` forward, `-1` back, `0`
|
|
84
|
+
* for a drag that has not declared horizontal intent.
|
|
85
|
+
*
|
|
86
|
+
* Dragging LEFT advances, the direction the content moves under the finger —
|
|
87
|
+
* the same mapping the native scroller has.
|
|
88
|
+
*/
|
|
89
|
+
export function swipeStep(dx, dy) {
|
|
90
|
+
const across = Math.abs(dx);
|
|
91
|
+
if (across < SWIPE_MIN_PX)
|
|
92
|
+
return 0;
|
|
93
|
+
if (across <= Math.abs(dy) * SWIPE_AXIS_RATIO)
|
|
94
|
+
return 0;
|
|
95
|
+
return dx < 0 ? 1 : -1;
|
|
96
|
+
}
|
|
97
|
+
/** Does this environment have a real pointer? `false` where there is no
|
|
98
|
+
* `matchMedia` to ask (a server render, an old jsdom), which is the safe
|
|
99
|
+
* side: a scrub that does not happen costs a hover, a scrub on a phone is a
|
|
100
|
+
* photograph that changes when nobody touched it. */
|
|
101
|
+
export function hasFinePointer() {
|
|
102
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
103
|
+
return false;
|
|
104
|
+
try {
|
|
105
|
+
return window.matchMedia(SCRUB_MEDIA).matches;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* {@link hasFinePointer}, as state.
|
|
113
|
+
*
|
|
114
|
+
* It opens `false` and settles in an effect rather than reading the media
|
|
115
|
+
* query during render: a server render has no `matchMedia`, and a first
|
|
116
|
+
* client render that disagreed with it is a hydration mismatch on every card
|
|
117
|
+
* on the page. Nothing is drawn differently either way — the flag only gates
|
|
118
|
+
* a gesture — so the one frame it costs is invisible.
|
|
119
|
+
*/
|
|
120
|
+
export function useFinePointer() {
|
|
121
|
+
const [fine, setFine] = useState(false);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
124
|
+
return;
|
|
125
|
+
let query;
|
|
126
|
+
try {
|
|
127
|
+
query = window.matchMedia(SCRUB_MEDIA);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
setFine(query.matches);
|
|
133
|
+
const onChange = (event) => {
|
|
134
|
+
setFine(event.matches);
|
|
135
|
+
};
|
|
136
|
+
// `addEventListener` is the modern spelling; Safari < 14 has only
|
|
137
|
+
// `addListener`, and a card grid that throws on mount there is worse than
|
|
138
|
+
// one that never notices a device changing its pointer.
|
|
139
|
+
if (typeof query.addEventListener === "function") {
|
|
140
|
+
query.addEventListener("change", onChange);
|
|
141
|
+
return () => {
|
|
142
|
+
query.removeEventListener("change", onChange);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}, []);
|
|
147
|
+
return fine;
|
|
148
|
+
}
|
|
149
|
+
/** Scroll the strip inside `box` so that slide `index` is at its leading
|
|
150
|
+
* edge. Rectangles rather than `scrollLeft / slideWidth`, for the reason
|
|
151
|
+
* `SkinCarousel`'s own `nearestSlideIndex` gives: the arithmetic version has
|
|
152
|
+
* to know the gap, the peek and the writing direction. */
|
|
153
|
+
function showSlide(box, index, instant) {
|
|
154
|
+
const strip = box.querySelector("[data-stapel-carousel-strip]");
|
|
155
|
+
if (strip === null)
|
|
156
|
+
return;
|
|
157
|
+
const slide = strip.children.item(index);
|
|
158
|
+
if (slide === null)
|
|
159
|
+
return;
|
|
160
|
+
const left = slide.getBoundingClientRect().left - strip.getBoundingClientRect().left + strip.scrollLeft;
|
|
161
|
+
if (typeof strip.scrollTo === "function") {
|
|
162
|
+
strip.scrollTo({ left, behavior: instant ? "auto" : "smooth" });
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
strip.scrollLeft = left;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The gallery gestures for a media well holding `count` photographs.
|
|
170
|
+
*
|
|
171
|
+
* A well with one photograph gets an inert bag: every handler returns
|
|
172
|
+
* immediately, so a grid of forty single-photo tiles pays for nothing.
|
|
173
|
+
*/
|
|
174
|
+
export function useCardGallery(count) {
|
|
175
|
+
const ref = useRef(null);
|
|
176
|
+
const [active, setActive] = useState(0);
|
|
177
|
+
const [scrubbing, setScrubbing] = useState(false);
|
|
178
|
+
// The origin of the drag in progress, or `null`. A ref rather than state:
|
|
179
|
+
// it changes on every move and no render depends on it.
|
|
180
|
+
const origin = useRef(null);
|
|
181
|
+
const fine = useFinePointer();
|
|
182
|
+
const many = count > 1;
|
|
183
|
+
// The one place the strip is driven. `active` is the whole state of both
|
|
184
|
+
// gestures, so neither handler talks to the DOM.
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
const box = ref.current;
|
|
187
|
+
if (box === null || !many)
|
|
188
|
+
return;
|
|
189
|
+
showSlide(box, active, scrubbing);
|
|
190
|
+
}, [active, scrubbing, many]);
|
|
191
|
+
const onPointerMove = useCallback((event) => {
|
|
192
|
+
if (!many)
|
|
193
|
+
return;
|
|
194
|
+
if (event.pointerType === "mouse") {
|
|
195
|
+
if (!fine)
|
|
196
|
+
return;
|
|
197
|
+
const box = ref.current;
|
|
198
|
+
if (box === null)
|
|
199
|
+
return;
|
|
200
|
+
const rect = box.getBoundingClientRect();
|
|
201
|
+
setScrubbing(true);
|
|
202
|
+
setActive(segmentIndex(event.clientX - rect.left, rect.width, count));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const from = origin.current;
|
|
206
|
+
if (from === null)
|
|
207
|
+
return;
|
|
208
|
+
const step = swipeStep(event.clientX - from.x, event.clientY - from.y);
|
|
209
|
+
if (step === 0)
|
|
210
|
+
return;
|
|
211
|
+
// The origin moves with the commit, so a long drag walks the strip one
|
|
212
|
+
// photograph per threshold rather than one per gesture.
|
|
213
|
+
origin.current = { x: event.clientX, y: event.clientY };
|
|
214
|
+
setScrubbing(false);
|
|
215
|
+
setActive((current) => Math.min(count - 1, Math.max(0, current + step)));
|
|
216
|
+
}, [count, fine, many]);
|
|
217
|
+
const onPointerDown = useCallback((event) => {
|
|
218
|
+
if (!many || event.pointerType === "mouse")
|
|
219
|
+
return;
|
|
220
|
+
origin.current = { x: event.clientX, y: event.clientY };
|
|
221
|
+
}, [many]);
|
|
222
|
+
const endDrag = useCallback(() => {
|
|
223
|
+
origin.current = null;
|
|
224
|
+
}, []);
|
|
225
|
+
const onPointerLeave = useCallback(() => {
|
|
226
|
+
origin.current = null;
|
|
227
|
+
if (!many)
|
|
228
|
+
return;
|
|
229
|
+
// The card goes back to the photograph it was drawn with. A hover is a
|
|
230
|
+
// look, not an edit.
|
|
231
|
+
setScrubbing(false);
|
|
232
|
+
setActive(0);
|
|
233
|
+
}, [many]);
|
|
234
|
+
return {
|
|
235
|
+
ref,
|
|
236
|
+
active,
|
|
237
|
+
scrubbing,
|
|
238
|
+
onPointerMove,
|
|
239
|
+
onPointerDown,
|
|
240
|
+
onPointerUp: endDrag,
|
|
241
|
+
onPointerCancel: endDrag,
|
|
242
|
+
onPointerLeave,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The rules an inline style cannot reach: they apply to the STRIP inside the
|
|
247
|
+
* carousel, which this package renders through a component and does not hold
|
|
248
|
+
* a handle on.
|
|
249
|
+
*/
|
|
250
|
+
export function cardGalleryCss() {
|
|
251
|
+
const box = `.${CARD_GALLERY_CLASS}`;
|
|
252
|
+
return [
|
|
253
|
+
// THE VERTICAL AXIS IS THE BROWSER'S, and is not negotiable: a card is a
|
|
254
|
+
// small box in a long feed, and the one unacceptable outcome of a gallery
|
|
255
|
+
// gesture is a page that will not scroll. `pan-y` says so at the platform
|
|
256
|
+
// level, where no handler can argue with it, and takes the horizontal
|
|
257
|
+
// axis for the swipe above.
|
|
258
|
+
`${box} [data-stapel-carousel-strip]{touch-action:pan-y}`,
|
|
259
|
+
// A per-pixel scrub must not animate: the strip's own `scroll-behavior:
|
|
260
|
+
// smooth` is right for a swipe committing one photograph and turns a
|
|
261
|
+
// cursor sweep into a queue of easing curves finishing after the pointer
|
|
262
|
+
// has left.
|
|
263
|
+
`${box}[data-scrubbing="true"] [data-stapel-carousel-strip]{scroll-behavior:auto}`,
|
|
264
|
+
].join("");
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=cardGallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardGallery.js","sourceRoot":"","sources":["../../src/default/cardGallery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAC3D,oEAAoE;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAC;AAEtE,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,KAAa,EAAE,KAAa;IACxE,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,E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;IACf,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO;QACL,GAAG;QACH,MAAM;QACN,SAAS;QACT,aAAa;QACb,aAAa;QACb,WAAW,EAAE,OAAO;QACpB,eAAe,EAAE,OAAO;QACxB,cAAc;KACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACrC,OAAO;QACL,yEAAyE;QACzE,0EAA0E;QAC1E,0EAA0E;QAC1E,sEAAsE;QACtE,4BAA4B;QAC5B,GAAG,GAAG,mDAAmD;QACzD,wEAAwE;QACxE,qEAAqE;QACrE,yEAAyE;QACzE,YAAY;QACZ,GAAG,GAAG,4EAA4E;KACnF,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC"}
|
package/dist/default/index.d.ts
CHANGED
|
@@ -53,6 +53,12 @@ export { LifecycleTag, ListingStatusBlock, ModerationNote } from "./StatusTags.j
|
|
|
53
53
|
export type { ListingStatusProps } from "./StatusTags.js";
|
|
54
54
|
export { ListingPhoto, ListingPhotoStrip, LISTING_PHOTO_ASPECT, } from "./ListingPhoto.js";
|
|
55
55
|
export type { ListingPhotoProps } from "./ListingPhoto.js";
|
|
56
|
+
export { ListingSpecColumns, ListingSpecList, specListCss, } from "./ListingSpecList.js";
|
|
57
|
+
export type { ListingSpecListProps } from "./ListingSpecList.js";
|
|
58
|
+
export { CardBadges, CardSpecLine } from "./CardBadges.js";
|
|
59
|
+
export type { CardBadgesProps } from "./CardBadges.js";
|
|
60
|
+
export { SWIPE_AXIS_RATIO, SWIPE_MIN_PX, cardGalleryCss, hasFinePointer, segmentIndex, swipeStep, useCardGallery, } from "./cardGallery.js";
|
|
61
|
+
export type { CardGallery } from "./cardGallery.js";
|
|
56
62
|
export { SignInLink } from "./SignInLink.js";
|
|
57
63
|
export type { SignInLinkProps } from "./SignInLink.js";
|
|
58
64
|
export type { CategoryFeaturesProp, ThemeModeProp } from "./types.js";
|