@sdxc/ui 2026.11.17 → 2026.11.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -2
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +1 -0
- package/dist/app/mixins/command-palette.js +10 -2
- package/dist/app/mixins/log-viewer.js +17 -14
- package/dist/app/mixins/route-dialog.d.ts +17 -0
- package/dist/app/mixins/route-dialog.js +53 -0
- package/dist/app/optimistic-toggle.js +6 -0
- package/dist/app/route-dialog.d.ts +38 -0
- package/dist/app/route-dialog.js +49 -0
- package/dist/audio/equalizer.d.ts +24 -0
- package/dist/audio/equalizer.js +57 -0
- package/dist/audio/index.d.ts +16 -0
- package/dist/audio/index.js +16 -0
- package/dist/audio/media-tile.d.ts +38 -0
- package/dist/audio/media-tile.js +98 -0
- package/dist/audio/player-bar.d.ts +108 -0
- package/dist/audio/player-bar.js +338 -0
- package/dist/audio/queue-list.d.ts +56 -0
- package/dist/audio/queue-list.js +102 -0
- package/dist/audio/track-list.d.ts +91 -0
- package/dist/audio/track-list.js +226 -0
- package/dist/audio/utils/media-session.d.ts +44 -0
- package/dist/audio/utils/media-session.js +87 -0
- package/dist/audio/utils/play-queue.d.ts +98 -0
- package/dist/audio/utils/play-queue.js +149 -0
- package/dist/audio/utils/track-time.d.ts +28 -0
- package/dist/audio/utils/track-time.js +36 -0
- package/dist/chat/composer-format.d.ts +35 -0
- package/dist/chat/composer-format.js +84 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/index.js +6 -0
- package/dist/chat/mention-menu.d.ts +43 -0
- package/dist/chat/mention-menu.js +70 -0
- package/dist/chat/message-group.d.ts +92 -0
- package/dist/chat/message-group.js +222 -0
- package/dist/chat/mixins/composer-format.d.ts +28 -0
- package/dist/chat/mixins/composer-format.js +80 -0
- package/dist/chat/mixins/composer-send.d.ts +2 -2
- package/dist/chat/mixins/composer-send.js +4 -2
- package/dist/chat/mixins/mention-menu.d.ts +41 -0
- package/dist/chat/mixins/mention-menu.js +213 -0
- package/dist/chat/mixins/reaction-sync.d.ts +47 -0
- package/dist/chat/mixins/reaction-sync.js +172 -0
- package/dist/chat/reaction-bar.d.ts +70 -0
- package/dist/chat/reaction-bar.js +108 -0
- package/dist/chat/typing-indicator.d.ts +42 -0
- package/dist/chat/typing-indicator.js +68 -0
- package/dist/chat/utils/composer-text.d.ts +38 -0
- package/dist/chat/utils/composer-text.js +86 -0
- package/dist/chat/utils/markdown-format.d.ts +30 -0
- package/dist/chat/utils/markdown-format.js +158 -0
- package/dist/chat/utils/mention-query.d.ts +55 -0
- package/dist/chat/utils/mention-query.js +60 -0
- package/dist/commerce/cart-drawer.d.ts +69 -0
- package/dist/commerce/cart-drawer.js +163 -0
- package/dist/commerce/cart-line.d.ts +32 -0
- package/dist/commerce/cart-line.js +43 -0
- package/dist/commerce/checkout-layout.d.ts +32 -0
- package/dist/commerce/checkout-layout.js +51 -0
- package/dist/commerce/facet-filters.d.ts +121 -0
- package/dist/commerce/facet-filters.js +318 -0
- package/dist/commerce/fulfilment-note.d.ts +28 -0
- package/dist/commerce/fulfilment-note.js +26 -0
- package/dist/commerce/index.d.ts +27 -0
- package/dist/commerce/index.js +27 -0
- package/dist/commerce/item-options-dialog.d.ts +67 -0
- package/dist/commerce/item-options-dialog.js +150 -0
- package/dist/commerce/menu-item-card.d.ts +37 -0
- package/dist/commerce/menu-item-card.js +96 -0
- package/dist/commerce/option-group.d.ts +62 -0
- package/dist/commerce/option-group.js +121 -0
- package/dist/commerce/order-summary.d.ts +42 -0
- package/dist/commerce/order-summary.js +76 -0
- package/dist/commerce/order-tracker.d.ts +80 -0
- package/dist/commerce/order-tracker.js +178 -0
- package/dist/commerce/price.d.ts +52 -0
- package/dist/commerce/price.js +108 -0
- package/dist/commerce/product-card.d.ts +53 -0
- package/dist/commerce/product-card.js +127 -0
- package/dist/commerce/product-gallery.d.ts +70 -0
- package/dist/commerce/product-gallery.js +186 -0
- package/dist/commerce/promo-code.d.ts +56 -0
- package/dist/commerce/promo-code.js +101 -0
- package/dist/commerce/quantity-stepper.d.ts +42 -0
- package/dist/commerce/quantity-stepper.js +53 -0
- package/dist/commerce/question-list.d.ts +53 -0
- package/dist/commerce/question-list.js +92 -0
- package/dist/commerce/shipping-estimate.d.ts +53 -0
- package/dist/commerce/shipping-estimate.js +39 -0
- package/dist/commerce/sort-select.d.ts +38 -0
- package/dist/commerce/sort-select.js +38 -0
- package/dist/commerce/variant-picker.d.ts +75 -0
- package/dist/commerce/variant-picker.js +135 -0
- package/dist/components/amount.d.ts +46 -0
- package/dist/components/amount.js +34 -0
- package/dist/components/autocomplete.d.ts +82 -0
- package/dist/components/autocomplete.js +114 -0
- package/dist/components/carousel.d.ts +31 -1
- package/dist/components/carousel.js +66 -3
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +11 -0
- package/dist/components/letterbox.d.ts +47 -0
- package/dist/components/letterbox.js +56 -0
- package/dist/components/lightbox.d.ts +88 -0
- package/dist/components/lightbox.js +224 -0
- package/dist/components/media-grid.d.ts +53 -0
- package/dist/components/media-grid.js +89 -0
- package/dist/components/range-months.d.ts +100 -0
- package/dist/components/range-months.js +274 -0
- package/dist/components/rating-input.d.ts +33 -0
- package/dist/components/rating-input.js +63 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +66 -0
- package/dist/components/review-card.d.ts +39 -0
- package/dist/components/review-card.js +59 -0
- package/dist/components/section-bar.d.ts +57 -0
- package/dist/components/section-bar.js +140 -0
- package/dist/components/step-indicator.d.ts +46 -0
- package/dist/components/step-indicator.js +96 -0
- package/dist/finance/index.d.ts +10 -0
- package/dist/finance/index.js +10 -0
- package/dist/finance/ledger.d.ts +60 -0
- package/dist/finance/ledger.js +93 -0
- package/dist/finance/payment-card.d.ts +49 -0
- package/dist/finance/payment-card.js +115 -0
- package/dist/map/engine.d.ts +49 -0
- package/dist/map/engine.js +591 -0
- package/dist/map/index.d.ts +12 -0
- package/dist/map/index.js +12 -0
- package/dist/map/map-canvas.d.ts +101 -0
- package/dist/map/map-canvas.js +275 -0
- package/dist/map/map.d.ts +217 -0
- package/dist/map/map.js +598 -0
- package/dist/map/mixins/map-link.d.ts +30 -0
- package/dist/map/mixins/map-link.js +116 -0
- package/dist/map/utils/basemap.d.ts +88 -0
- package/dist/map/utils/basemap.js +84 -0
- package/dist/map/utils/cluster.d.ts +43 -0
- package/dist/map/utils/cluster.js +80 -0
- package/dist/map/utils/mercator.d.ts +66 -0
- package/dist/map/utils/mercator.js +92 -0
- package/dist/map/utils/stage.d.ts +24 -0
- package/dist/map/utils/stage.js +49 -0
- package/dist/mixins/autocomplete.d.ts +28 -0
- package/dist/mixins/autocomplete.js +283 -0
- package/dist/mixins/carousel-controls.d.ts +14 -3
- package/dist/mixins/carousel-controls.js +89 -30
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/mixins/lightbox-controls.d.ts +34 -0
- package/dist/mixins/lightbox-controls.js +176 -0
- package/dist/schedule/agenda.d.ts +63 -0
- package/dist/schedule/agenda.js +221 -0
- package/dist/schedule/day-strip.d.ts +50 -0
- package/dist/schedule/day-strip.js +136 -0
- package/dist/schedule/free-busy.d.ts +96 -0
- package/dist/schedule/free-busy.js +285 -0
- package/dist/schedule/index.d.ts +15 -0
- package/dist/schedule/index.js +15 -0
- package/dist/schedule/mixins/day-strip-scroll.d.ts +16 -0
- package/dist/schedule/mixins/day-strip-scroll.js +40 -0
- package/dist/schedule/mixins/time-grid-drag.d.ts +24 -0
- package/dist/schedule/mixins/time-grid-drag.js +532 -0
- package/dist/schedule/month-view.d.ts +68 -0
- package/dist/schedule/month-view.js +301 -0
- package/dist/schedule/time-grid.d.ts +168 -0
- package/dist/schedule/time-grid.js +417 -0
- package/dist/schedule/utils/time-grid-layout.d.ts +50 -0
- package/dist/schedule/utils/time-grid-layout.js +93 -0
- package/dist/schedule/year-view.d.ts +46 -0
- package/dist/schedule/year-view.js +142 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.js +1 -0
- package/dist/styles/typewriter-text.d.ts +20 -0
- package/dist/styles/typewriter-text.js +23 -0
- package/dist/test/map.d.ts +18 -0
- package/dist/test/map.js +96 -0
- package/dist/test/reels.d.ts +30 -0
- package/dist/test/reels.js +41 -0
- package/dist/test/stories.d.ts +31 -0
- package/dist/test/stories.js +66 -0
- package/dist/travel/boarding-pass.d.ts +107 -0
- package/dist/travel/boarding-pass.js +293 -0
- package/dist/travel/car-offer.d.ts +70 -0
- package/dist/travel/car-offer.js +127 -0
- package/dist/travel/fare-calendar.d.ts +85 -0
- package/dist/travel/fare-calendar.js +233 -0
- package/dist/travel/fare-options.d.ts +84 -0
- package/dist/travel/fare-options.js +142 -0
- package/dist/travel/flight-itinerary.d.ts +84 -0
- package/dist/travel/flight-itinerary.js +112 -0
- package/dist/travel/flight-option.d.ts +58 -0
- package/dist/travel/flight-option.js +111 -0
- package/dist/travel/flight-segment.d.ts +105 -0
- package/dist/travel/flight-segment.js +174 -0
- package/dist/travel/index.d.ts +20 -0
- package/dist/travel/index.js +20 -0
- package/dist/travel/package-savings.d.ts +74 -0
- package/dist/travel/package-savings.js +128 -0
- package/dist/travel/price-breakdown.d.ts +66 -0
- package/dist/travel/price-breakdown.js +102 -0
- package/dist/travel/rating-breakdown.d.ts +81 -0
- package/dist/travel/rating-breakdown.js +132 -0
- package/dist/travel/seat-map.d.ts +108 -0
- package/dist/travel/seat-map.js +371 -0
- package/dist/travel/trip-timeline.d.ts +84 -0
- package/dist/travel/trip-timeline.js +212 -0
- package/dist/utils/gamepad-presses.d.ts +21 -0
- package/dist/utils/gamepad-presses.js +28 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/move-focus.d.ts +20 -0
- package/dist/utils/move-focus.js +28 -0
- package/dist/utils/range-months.d.ts +54 -0
- package/dist/utils/range-months.js +98 -0
- package/dist/utils/swipe-direction.d.ts +23 -0
- package/dist/utils/swipe-direction.js +27 -0
- package/dist/utils/typewriter.d.ts +49 -0
- package/dist/utils/typewriter.js +171 -0
- package/dist/video/index.d.ts +6 -2
- package/dist/video/index.js +6 -2
- package/dist/video/mixins/reel-feed-sync.d.ts +41 -0
- package/dist/video/mixins/reel-feed-sync.js +430 -0
- package/dist/video/mixins/story-viewer-sync.d.ts +31 -0
- package/dist/video/mixins/story-viewer-sync.js +391 -0
- package/dist/video/mixins/video-player-sync.js +138 -5
- package/dist/video/reel-feed.d.ts +95 -0
- package/dist/video/reel-feed.js +124 -0
- package/dist/video/story-ring.d.ts +32 -0
- package/dist/video/story-ring.js +42 -0
- package/dist/video/story-viewer.d.ts +85 -0
- package/dist/video/story-viewer.js +250 -0
- package/dist/video/video-card.d.ts +3 -1
- package/dist/video/video-card.js +15 -5
- package/dist/video/video-player.d.ts +33 -0
- package/dist/video/video-player.js +226 -20
- package/package.json +21 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
3
|
+
/** From this width the summary moves into its own column. */
|
|
4
|
+
const WIDE = "(min-width: 56rem)";
|
|
5
|
+
/**
|
|
6
|
+
* Renders one column on a phone, summary then steps then form. From 56rem the form takes the
|
|
7
|
+
* flexible column and the summary a 24rem column on a tinted band, sticky to the top so the
|
|
8
|
+
* total stays in view; the whole frame stops at 70rem.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <CheckoutLayout steps={<StepIndicator … />} summary={<OrderSummary collapsible … />}><form method="post">…</form></CheckoutLayout>
|
|
12
|
+
*/
|
|
13
|
+
export function CheckoutLayout(handle) {
|
|
14
|
+
return () => {
|
|
15
|
+
let { aside, children, mix, steps, summary, ...rest } = handle.props;
|
|
16
|
+
return (_jsxs("div", { ...rest, "data-slot": "checkout-layout", mix: mergeMix([
|
|
17
|
+
raw({
|
|
18
|
+
display: "grid",
|
|
19
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
20
|
+
gridTemplateAreas: '"summary" "steps" "main"',
|
|
21
|
+
gap: "1.5rem",
|
|
22
|
+
inlineSize: "100%",
|
|
23
|
+
maxInlineSize: "70rem",
|
|
24
|
+
marginInline: "auto",
|
|
25
|
+
boxSizing: "border-box",
|
|
26
|
+
[`@media ${WIDE}`]: {
|
|
27
|
+
gridTemplateColumns: "minmax(0, 1fr) 24rem",
|
|
28
|
+
gridTemplateAreas: '"steps summary" "main summary"',
|
|
29
|
+
gridTemplateRows: "auto 1fr",
|
|
30
|
+
columnGap: "3rem",
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
], mix), children: [_jsxs("div", { "data-slot": "checkout-layout-summary", mix: [
|
|
34
|
+
raw({
|
|
35
|
+
gridArea: "summary",
|
|
36
|
+
display: "grid",
|
|
37
|
+
alignContent: "start",
|
|
38
|
+
gap: "1.25rem",
|
|
39
|
+
padding: "1rem",
|
|
40
|
+
borderRadius: "var(--ui-radius-lg, 0.75rem)",
|
|
41
|
+
backgroundColor: "var(--ui-neutral-bg-tint)",
|
|
42
|
+
[`@media ${WIDE}`]: {
|
|
43
|
+
position: "sticky",
|
|
44
|
+
insetBlockStart: "1.5rem",
|
|
45
|
+
alignSelf: "start",
|
|
46
|
+
padding: "1.5rem",
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
], children: [summary, aside === undefined ? null : _jsx("div", { "data-slot": "checkout-layout-aside", children: aside })] }), steps === undefined ? null : (_jsx("div", { "data-slot": "checkout-layout-steps", mix: [raw({ gridArea: "steps" })], children: steps })), _jsx("div", { "data-slot": "checkout-layout-main", mix: [raw({ gridArea: "main", minInlineSize: "0" })], children: children })] }));
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The filters beside a product listing as one GET form: collapsible groups of checkboxes
|
|
3
|
+
* with counts, switches, a price range with buckets, and the applied filters as removable
|
|
4
|
+
* chips. It submits with an Apply button; once script runs, each change submits on its own.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { EntryComponent, Handle, MixinFactory, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
/** Prop types for {@link FacetFilters} and its compound parts. */
|
|
11
|
+
export declare namespace FacetFilters {
|
|
12
|
+
/** The words the form's controls are named by. */
|
|
13
|
+
interface Labels {
|
|
14
|
+
/** The submit button shown until script runs, such as "Apply". */
|
|
15
|
+
apply: string;
|
|
16
|
+
}
|
|
17
|
+
/** Props accepted by {@link FacetFilters}; the host is a `<form method="get">`. */
|
|
18
|
+
interface Props extends Omit<TagProps<"form">, "children" | "method" | "action"> {
|
|
19
|
+
/** The listing page the filters submit to. */
|
|
20
|
+
action: string;
|
|
21
|
+
/** Query fields the form carries unchanged, such as the search and the sort. */
|
|
22
|
+
keep?: Record<string, string>;
|
|
23
|
+
children: RemixNode;
|
|
24
|
+
labels: Labels;
|
|
25
|
+
}
|
|
26
|
+
/** Props accepted by {@link FacetFilters.Group}. */
|
|
27
|
+
interface GroupProps {
|
|
28
|
+
title: RemixNode;
|
|
29
|
+
/** @default true */
|
|
30
|
+
open?: boolean;
|
|
31
|
+
children: RemixNode;
|
|
32
|
+
}
|
|
33
|
+
/** Props accepted by {@link FacetFilters.Check}. */
|
|
34
|
+
interface CheckProps {
|
|
35
|
+
name: string;
|
|
36
|
+
value: string;
|
|
37
|
+
label: RemixNode;
|
|
38
|
+
/** How many results this value has with the other filters applied. */
|
|
39
|
+
count: number;
|
|
40
|
+
checked?: boolean;
|
|
41
|
+
/** A colour dot before the label, as any CSS colour or gradient. */
|
|
42
|
+
swatch?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Props accepted by {@link FacetFilters.Toggle}. */
|
|
45
|
+
interface ToggleProps {
|
|
46
|
+
/** The field that posts `1` while on. */
|
|
47
|
+
name: string;
|
|
48
|
+
label: RemixNode;
|
|
49
|
+
count: number;
|
|
50
|
+
checked?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** One price bucket, a link to the listing with that range applied. */
|
|
53
|
+
interface Bucket {
|
|
54
|
+
label: RemixNode;
|
|
55
|
+
href: string;
|
|
56
|
+
count: number;
|
|
57
|
+
selected: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Props accepted by {@link FacetFilters.Range}. */
|
|
60
|
+
interface RangeProps {
|
|
61
|
+
minName: string;
|
|
62
|
+
maxName: string;
|
|
63
|
+
min?: number | null;
|
|
64
|
+
max?: number | null;
|
|
65
|
+
/** The two fields' labels, such as "Min" and "Max". */
|
|
66
|
+
labels: {
|
|
67
|
+
min: string;
|
|
68
|
+
max: string;
|
|
69
|
+
};
|
|
70
|
+
/** A symbol before each figure, such as "$". */
|
|
71
|
+
prefix?: string;
|
|
72
|
+
buckets?: Bucket[];
|
|
73
|
+
}
|
|
74
|
+
/** One applied filter, a link to the listing without it. */
|
|
75
|
+
interface Chip {
|
|
76
|
+
label: RemixNode;
|
|
77
|
+
href: string;
|
|
78
|
+
}
|
|
79
|
+
/** Props accepted by {@link FacetFilters.Applied}. */
|
|
80
|
+
interface AppliedProps {
|
|
81
|
+
chips: Chip[];
|
|
82
|
+
/** A link to the listing with every filter removed. */
|
|
83
|
+
clear?: {
|
|
84
|
+
label: string;
|
|
85
|
+
href: string;
|
|
86
|
+
};
|
|
87
|
+
/** The row's accessible name, such as "Applied filters". */
|
|
88
|
+
label: string;
|
|
89
|
+
}
|
|
90
|
+
/** Props {@link AutoSubmit} serializes for hydration; it reads its place in the page. */
|
|
91
|
+
type AutoSubmitProps = Record<never, never>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Renders the form: the kept fields, the groups, then the Apply button, which hides once
|
|
95
|
+
* {@link AutoSubmit} takes over submitting.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* <FacetFilters action="/shop" keep={{ sort: "new" }} labels={{ apply: "Apply" }}><FacetFilters.Group title="Colour">…</FacetFilters.Group></FacetFilters>
|
|
99
|
+
*/
|
|
100
|
+
export declare function FacetFilters(handle: Handle<FacetFilters.Props>): () => import("remix/component").RemixElement;
|
|
101
|
+
export declare namespace FacetFilters {
|
|
102
|
+
var Group: (handle: Handle<FacetFilters.GroupProps>) => () => import("remix/component").RemixElement;
|
|
103
|
+
var Check: (handle: Handle<FacetFilters.CheckProps>) => () => import("remix/component").RemixElement;
|
|
104
|
+
var Toggle: (handle: Handle<FacetFilters.ToggleProps>) => () => import("remix/component").RemixElement;
|
|
105
|
+
var Range: (handle: Handle<FacetFilters.RangeProps>) => () => import("remix/component").RemixElement;
|
|
106
|
+
var Applied: (handle: Handle<FacetFilters.AppliedProps>) => () => import("remix/component").RemixElement | null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Submits a form on every `change` inside its host's form (or, outside one, inside its
|
|
110
|
+
* parent), through `requestSubmit()` so validation and submit listeners still run, and hides
|
|
111
|
+
* that form's no-script controls, such as an Apply button.
|
|
112
|
+
*
|
|
113
|
+
* @example <span hidden mix={[autoSubmit()]} />
|
|
114
|
+
*/
|
|
115
|
+
export declare const autoSubmit: MixinFactory<HTMLElement>;
|
|
116
|
+
/**
|
|
117
|
+
* Loads {@link autoSubmit} on a server-rendered page: rendered inside a form, or beside a
|
|
118
|
+
* control that names its form, it submits that form on each change. It loads from
|
|
119
|
+
* `@sdxc/ui/commerce/facet-filters`; {@link FacetFilters} and SortSelect render it.
|
|
120
|
+
*/
|
|
121
|
+
export declare const AutoSubmit: EntryComponent<FacetFilters.AutoSubmitProps>;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ChevronDownIcon, XIcon } from "@sdxc/icons";
|
|
3
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
4
|
+
import { motionReduce } from "@sdxc/u/responsive";
|
|
5
|
+
import { when } from "@sdxc/u/state";
|
|
6
|
+
import { clientEntry, createMixin } from "remix/component";
|
|
7
|
+
/** Marks a control that only matters without script, such as an Apply button. */
|
|
8
|
+
const NO_SCRIPT_ATTRIBUTE = "data-auto-submit-hide";
|
|
9
|
+
/** Marks a form already submitting on change, so a second marker inside it adds no listener. */
|
|
10
|
+
const LIVE_ATTRIBUTE = "data-auto-submit";
|
|
11
|
+
/**
|
|
12
|
+
* Renders the form: the kept fields, the groups, then the Apply button, which hides once
|
|
13
|
+
* {@link AutoSubmit} takes over submitting.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <FacetFilters action="/shop" keep={{ sort: "new" }} labels={{ apply: "Apply" }}><FacetFilters.Group title="Colour">…</FacetFilters.Group></FacetFilters>
|
|
17
|
+
*/
|
|
18
|
+
export function FacetFilters(handle) {
|
|
19
|
+
return () => {
|
|
20
|
+
let { action, children, keep = {}, labels, mix, ...rest } = handle.props;
|
|
21
|
+
return (_jsxs("form", { ...rest, method: "get", action: action, "data-slot": "facet-filters", mix: mergeMix([raw({ display: "grid", gap: "0" })], mix), children: [Object.entries(keep).map(([name, value]) => (_jsx("input", { type: "hidden", name: name, value: value }))), _jsx(AutoSubmit, {}), children, _jsx("button", { type: "submit", "data-auto-submit-hide": "", "data-slot": "facet-filters-apply", mix: [
|
|
22
|
+
raw({
|
|
23
|
+
justifySelf: "start",
|
|
24
|
+
marginBlockStart: "1rem",
|
|
25
|
+
minBlockSize: "2.5rem",
|
|
26
|
+
paddingInline: "1.25rem",
|
|
27
|
+
border: "0",
|
|
28
|
+
borderRadius: "999px",
|
|
29
|
+
font: "inherit",
|
|
30
|
+
fontWeight: "600",
|
|
31
|
+
color: "var(--ui-neutral-fg-on-solid)",
|
|
32
|
+
backgroundColor: "var(--ui-neutral-bg-solid)",
|
|
33
|
+
cursor: "pointer",
|
|
34
|
+
}),
|
|
35
|
+
when("&[hidden]", raw({ display: "none" })),
|
|
36
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" })),
|
|
37
|
+
], children: labels.apply })] }));
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Renders a group as a `<details>` whose summary row carries the title and a chevron, open
|
|
42
|
+
* unless `open` is false.
|
|
43
|
+
*
|
|
44
|
+
* @example <FacetFilters.Group title="Size">…</FacetFilters.Group>
|
|
45
|
+
*/
|
|
46
|
+
FacetFilters.Group = function FacetFiltersGroup(handle) {
|
|
47
|
+
return () => {
|
|
48
|
+
let { children, open = true, title } = handle.props;
|
|
49
|
+
return (_jsxs("details", { open: open, "data-slot": "facet-filters-group", mix: [
|
|
50
|
+
raw({
|
|
51
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
52
|
+
"&[open] [data-slot='facet-filters-chevron']": { rotate: "180deg" },
|
|
53
|
+
}),
|
|
54
|
+
], children: [_jsxs("summary", { mix: [
|
|
55
|
+
raw({
|
|
56
|
+
display: "flex",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
justifyContent: "space-between",
|
|
59
|
+
gap: "0.75rem",
|
|
60
|
+
minBlockSize: "2.75rem",
|
|
61
|
+
fontSize: "0.875rem",
|
|
62
|
+
fontWeight: "650",
|
|
63
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
64
|
+
listStyle: "none",
|
|
65
|
+
cursor: "pointer",
|
|
66
|
+
"&::-webkit-details-marker": { display: "none" },
|
|
67
|
+
}),
|
|
68
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" })),
|
|
69
|
+
], children: [title, _jsx("span", { "data-slot": "facet-filters-chevron", mix: [
|
|
70
|
+
raw({ display: "inline-grid", transition: "rotate 160ms ease" }),
|
|
71
|
+
motionReduce(raw({ transition: "none" })),
|
|
72
|
+
], children: _jsx(ChevronDownIcon, { size: 16, "aria-hidden": "true" }) })] }), _jsx("div", { mix: [raw({ display: "grid", gap: "0.125rem", paddingBlockEnd: "0.875rem" })], children: children })] }));
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/** A row of a group: control, label and count, at least 36px tall. */
|
|
76
|
+
function rowStyles() {
|
|
77
|
+
return [
|
|
78
|
+
raw({
|
|
79
|
+
display: "grid",
|
|
80
|
+
gridTemplateColumns: "auto minmax(0, 1fr) auto",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
gap: "0.625rem",
|
|
83
|
+
minBlockSize: "2.25rem",
|
|
84
|
+
fontSize: "0.875rem",
|
|
85
|
+
color: "var(--ui-neutral-fg)",
|
|
86
|
+
cursor: "pointer",
|
|
87
|
+
"& input": { margin: "0", accentColor: "var(--ui-neutral-fg-emphasis)" },
|
|
88
|
+
}),
|
|
89
|
+
when("&[data-empty]", raw({ color: "var(--ui-neutral-fg-muted)" })),
|
|
90
|
+
when("&:has(input:disabled)", raw({ cursor: "not-allowed", opacity: "0.55" })),
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
/** A result count at a row's end, in tabular figures so a column of counts lines up. */
|
|
94
|
+
function Count(handle) {
|
|
95
|
+
return () => (_jsx("span", { "data-slot": "facet-filters-count", mix: [
|
|
96
|
+
raw({
|
|
97
|
+
fontSize: "0.8125rem",
|
|
98
|
+
fontVariantNumeric: "tabular-nums",
|
|
99
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
100
|
+
}),
|
|
101
|
+
], children: handle.props.value }));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Renders a checkbox row. A value with no results stays enabled while checked, so the
|
|
105
|
+
* shopper can still clear it, and is disabled otherwise.
|
|
106
|
+
*
|
|
107
|
+
* @example <FacetFilters.Check name="colour" value="blue" label="Blue" count={12} swatch="#3b6fd8" />
|
|
108
|
+
*/
|
|
109
|
+
FacetFilters.Check = function FacetFiltersCheck(handle) {
|
|
110
|
+
return () => {
|
|
111
|
+
let { checked = false, count, label, name, swatch, value } = handle.props;
|
|
112
|
+
let empty = count === 0;
|
|
113
|
+
return (_jsxs("label", { "data-slot": "facet-filters-check", "data-empty": empty ? "" : undefined, mix: rowStyles(), children: [_jsx("input", { type: "checkbox", name: name, value: value, checked: checked, disabled: empty && !checked, mix: [raw({ inlineSize: "1rem", blockSize: "1rem" })] }), _jsxs("span", { mix: [raw({ display: "inline-flex", alignItems: "center", gap: "0.5rem" })], children: [swatch === undefined ? null : (_jsx("span", { "aria-hidden": "true", "data-slot": "facet-filters-swatch", style: { background: swatch }, mix: [
|
|
114
|
+
raw({
|
|
115
|
+
flexShrink: "0",
|
|
116
|
+
inlineSize: "0.875rem",
|
|
117
|
+
blockSize: "0.875rem",
|
|
118
|
+
borderRadius: "999px",
|
|
119
|
+
boxShadow: "inset 0 0 0 1px rgb(0 0 0 / 0.14)",
|
|
120
|
+
}),
|
|
121
|
+
] })), label] }), _jsx(Count, { value: count })] }));
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Renders an on/off filter as a switch-styled checkbox that posts `1` while on.
|
|
126
|
+
*
|
|
127
|
+
* @example <FacetFilters.Toggle name="in_stock" label="In stock" count={84} checked />
|
|
128
|
+
*/
|
|
129
|
+
FacetFilters.Toggle = function FacetFiltersToggle(handle) {
|
|
130
|
+
return () => {
|
|
131
|
+
let { checked = false, count, label, name } = handle.props;
|
|
132
|
+
return (_jsxs("label", { "data-slot": "facet-filters-toggle", mix: rowStyles(), children: [_jsx("input", { type: "checkbox", name: name, value: "1", checked: checked, mix: [
|
|
133
|
+
raw({
|
|
134
|
+
appearance: "none",
|
|
135
|
+
position: "relative",
|
|
136
|
+
inlineSize: "2rem",
|
|
137
|
+
blockSize: "1.125rem",
|
|
138
|
+
borderRadius: "999px",
|
|
139
|
+
backgroundColor: "var(--ui-neutral-border-strong)",
|
|
140
|
+
transition: "background-color 160ms ease",
|
|
141
|
+
cursor: "inherit",
|
|
142
|
+
"&::before": {
|
|
143
|
+
content: '""',
|
|
144
|
+
position: "absolute",
|
|
145
|
+
insetBlockStart: "0.125rem",
|
|
146
|
+
insetInlineStart: "0.125rem",
|
|
147
|
+
inlineSize: "0.875rem",
|
|
148
|
+
blockSize: "0.875rem",
|
|
149
|
+
borderRadius: "999px",
|
|
150
|
+
backgroundColor: "white",
|
|
151
|
+
transition: "translate 160ms ease",
|
|
152
|
+
},
|
|
153
|
+
"&:checked": { backgroundColor: "var(--ui-neutral-fg-emphasis)" },
|
|
154
|
+
"&:checked::before": { translate: "0.875rem 0" },
|
|
155
|
+
}),
|
|
156
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" })),
|
|
157
|
+
motionReduce(raw({ transition: "none", "&::before": { transition: "none" } })),
|
|
158
|
+
] }), _jsx("span", { children: label }), _jsx(Count, { value: count })] }));
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Renders two number fields side by side, then the bucket links with their counts. The
|
|
163
|
+
* fields submit on `change`, so typing a figure does not reload the listing per keystroke.
|
|
164
|
+
*
|
|
165
|
+
* @example <FacetFilters.Range minName="min" maxName="max" min={20} max={null} prefix="$" labels={{ min: "Min", max: "Max" }} />
|
|
166
|
+
*/
|
|
167
|
+
FacetFilters.Range = function FacetFiltersRange(handle) {
|
|
168
|
+
return () => {
|
|
169
|
+
let { buckets = [], labels, max, maxName, min, minName, prefix } = handle.props;
|
|
170
|
+
let fields = [
|
|
171
|
+
{ name: minName, value: min, label: labels.min },
|
|
172
|
+
{ name: maxName, value: max, label: labels.max },
|
|
173
|
+
];
|
|
174
|
+
return (_jsxs("div", { "data-slot": "facet-filters-range", mix: [raw({ display: "grid", gap: "0.625rem" })], children: [_jsx("div", { mix: [raw({ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.5rem" })], children: fields.map((field) => (_jsxs("label", { mix: [raw({ display: "grid", gap: "0.25rem", fontSize: "0.75rem" })], children: [_jsx("span", { mix: [raw({ color: "var(--ui-neutral-fg-muted)" })], children: field.label }), _jsxs("span", { mix: [
|
|
175
|
+
raw({
|
|
176
|
+
display: "flex",
|
|
177
|
+
alignItems: "center",
|
|
178
|
+
gap: "0.25rem",
|
|
179
|
+
minBlockSize: "2.25rem",
|
|
180
|
+
paddingInline: "0.625rem",
|
|
181
|
+
borderRadius: "var(--ui-radius-md, 0.5rem)",
|
|
182
|
+
boxShadow: "inset 0 0 0 1px var(--ui-neutral-border)",
|
|
183
|
+
"&:focus-within": { boxShadow: "inset 0 0 0 2px var(--ui-brand-ring)" },
|
|
184
|
+
}),
|
|
185
|
+
], children: [prefix === undefined ? null : (_jsx("span", { "aria-hidden": "true", mix: [raw({ color: "var(--ui-neutral-fg-muted)" })], children: prefix })), _jsx("input", { type: "number", inputMode: "numeric", min: "0", name: field.name, value: field.value === null || field.value === undefined ? "" : String(field.value), mix: [
|
|
186
|
+
raw({
|
|
187
|
+
inlineSize: "100%",
|
|
188
|
+
minInlineSize: "0",
|
|
189
|
+
border: "0",
|
|
190
|
+
padding: "0",
|
|
191
|
+
font: "inherit",
|
|
192
|
+
fontSize: "0.875rem",
|
|
193
|
+
fontVariantNumeric: "tabular-nums",
|
|
194
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
195
|
+
background: "none",
|
|
196
|
+
outline: "none",
|
|
197
|
+
}),
|
|
198
|
+
] })] })] }))) }), buckets.length === 0 ? null : (_jsx("ul", { mix: [raw({ display: "grid", margin: "0", padding: "0", listStyle: "none" })], children: buckets.map((bucket) => (_jsx("li", { children: _jsxs("a", { href: bucket.href, "aria-current": bucket.selected ? "true" : undefined, "data-slot": "facet-filters-bucket", mix: [
|
|
199
|
+
raw({
|
|
200
|
+
display: "flex",
|
|
201
|
+
alignItems: "center",
|
|
202
|
+
justifyContent: "space-between",
|
|
203
|
+
gap: "0.75rem",
|
|
204
|
+
minBlockSize: "2rem",
|
|
205
|
+
fontSize: "0.875rem",
|
|
206
|
+
color: "var(--ui-neutral-fg)",
|
|
207
|
+
textDecoration: "none",
|
|
208
|
+
}),
|
|
209
|
+
when("&:hover", raw({ textDecoration: "underline" })),
|
|
210
|
+
when("&[aria-current='true']", raw({ fontWeight: "650", color: "var(--ui-neutral-fg-emphasis)" })),
|
|
211
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" })),
|
|
212
|
+
], children: [_jsx("span", { children: bucket.label }), _jsx(Count, { value: bucket.count })] }) }))) }))] }));
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Renders the applied filters as a row of chips, each a link to the listing without that
|
|
217
|
+
* filter, then a "Clear all" link. It renders nothing when no filter is applied.
|
|
218
|
+
*
|
|
219
|
+
* @example <FacetFilters.Applied label="Applied filters" chips={[{ label: "Blue", href: "/shop" }]} clear={{ label: "Clear all", href: "/shop" }} />
|
|
220
|
+
*/
|
|
221
|
+
FacetFilters.Applied = function FacetFiltersApplied(handle) {
|
|
222
|
+
return () => {
|
|
223
|
+
let { chips, clear, label } = handle.props;
|
|
224
|
+
if (chips.length === 0)
|
|
225
|
+
return null;
|
|
226
|
+
return (_jsxs("ul", { "aria-label": label, "data-slot": "facet-filters-applied", mix: [
|
|
227
|
+
raw({
|
|
228
|
+
display: "flex",
|
|
229
|
+
flexWrap: "wrap",
|
|
230
|
+
alignItems: "center",
|
|
231
|
+
gap: "0.5rem",
|
|
232
|
+
margin: "0",
|
|
233
|
+
padding: "0",
|
|
234
|
+
listStyle: "none",
|
|
235
|
+
}),
|
|
236
|
+
], children: [chips.map((chip) => (_jsx("li", { children: _jsxs("a", { href: chip.href, "data-slot": "facet-filters-chip", mix: [
|
|
237
|
+
raw({
|
|
238
|
+
display: "inline-flex",
|
|
239
|
+
alignItems: "center",
|
|
240
|
+
gap: "0.375rem",
|
|
241
|
+
minBlockSize: "2rem",
|
|
242
|
+
paddingInline: "0.75rem 0.5rem",
|
|
243
|
+
borderRadius: "999px",
|
|
244
|
+
fontSize: "0.8125rem",
|
|
245
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
246
|
+
textDecoration: "none",
|
|
247
|
+
backgroundColor: "var(--ui-neutral-bg-tint)",
|
|
248
|
+
boxShadow: "inset 0 0 0 1px var(--ui-neutral-border)",
|
|
249
|
+
}),
|
|
250
|
+
when("&:hover", raw({ boxShadow: "inset 0 0 0 1px var(--ui-neutral-border-strong)" })),
|
|
251
|
+
when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" })),
|
|
252
|
+
], children: [chip.label, _jsx(XIcon, { size: 14, "aria-hidden": "true" })] }) }))), clear === undefined ? null : (_jsx("li", { children: _jsx("a", { href: clear.href, "data-slot": "facet-filters-clear", mix: [
|
|
253
|
+
raw({
|
|
254
|
+
fontSize: "0.8125rem",
|
|
255
|
+
fontWeight: "600",
|
|
256
|
+
color: "var(--ui-neutral-fg-emphasis)",
|
|
257
|
+
textUnderlineOffset: "0.2em",
|
|
258
|
+
}),
|
|
259
|
+
], children: clear.label }) }))] }));
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Submits a form on every `change` inside its host's form (or, outside one, inside its
|
|
264
|
+
* parent), through `requestSubmit()` so validation and submit listeners still run, and hides
|
|
265
|
+
* that form's no-script controls, such as an Apply button.
|
|
266
|
+
*
|
|
267
|
+
* @example <span hidden mix={[autoSubmit()]} />
|
|
268
|
+
*/
|
|
269
|
+
export const autoSubmit = createMixin((handle) => {
|
|
270
|
+
handle.addEventListener("insert", (event) => {
|
|
271
|
+
let marker = event.node;
|
|
272
|
+
let scope = marker.closest("form") ?? marker.parentElement;
|
|
273
|
+
if (scope === null)
|
|
274
|
+
return;
|
|
275
|
+
for (let control of scope.querySelectorAll(`[${NO_SCRIPT_ATTRIBUTE}]`)) {
|
|
276
|
+
control.hidden = true;
|
|
277
|
+
}
|
|
278
|
+
if (scope.hasAttribute(LIVE_ATTRIBUTE))
|
|
279
|
+
return;
|
|
280
|
+
let live = scope;
|
|
281
|
+
live.setAttribute(LIVE_ATTRIBUTE, "");
|
|
282
|
+
handle.signal.addEventListener("abort", () => live.removeAttribute(LIVE_ATTRIBUTE));
|
|
283
|
+
scope.addEventListener("change", (change) => {
|
|
284
|
+
let field = change.target;
|
|
285
|
+
if (!(field instanceof HTMLInputElement) &&
|
|
286
|
+
!(field instanceof HTMLSelectElement) &&
|
|
287
|
+
!(field instanceof HTMLTextAreaElement)) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
field.form?.requestSubmit();
|
|
291
|
+
}, { signal: handle.signal });
|
|
292
|
+
scope.addEventListener("formdata", (event) => dropBlankFields(event.formData), {
|
|
293
|
+
signal: handle.signal,
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
/**
|
|
298
|
+
* Leaves blank fields out of a submission, so an open-ended range writes `?price_max=25`
|
|
299
|
+
* rather than `?price_min=&price_max=25`; a blank field reads as absent either way.
|
|
300
|
+
*/
|
|
301
|
+
function dropBlankFields(data) {
|
|
302
|
+
let blank = new Set();
|
|
303
|
+
for (let [name, value] of data)
|
|
304
|
+
if (value === "")
|
|
305
|
+
blank.add(name);
|
|
306
|
+
for (let name of blank) {
|
|
307
|
+
if (data.getAll(name).every((entry) => entry === ""))
|
|
308
|
+
data.delete(name);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Loads {@link autoSubmit} on a server-rendered page: rendered inside a form, or beside a
|
|
313
|
+
* control that names its form, it submits that form on each change. It loads from
|
|
314
|
+
* `@sdxc/ui/commerce/facet-filters`; {@link FacetFilters} and SortSelect render it.
|
|
315
|
+
*/
|
|
316
|
+
export const AutoSubmit = clientEntry("@sdxc/ui/commerce/facet-filters#AutoSubmit", function AutoSubmit() {
|
|
317
|
+
return () => _jsx("span", { hidden: true, "data-slot": "auto-submit", mix: [autoSubmit()] });
|
|
318
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A quiet line saying how an item reaches the buyer: a download, a parcel, or a pickup. It
|
|
3
|
+
* sits under a cart line or a product's price, with an icon naming the way so a mixed cart
|
|
4
|
+
* of prints and digital files reads at a glance.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
/** Prop types for {@link FulfilmentNote}. */
|
|
11
|
+
export declare namespace FulfilmentNote {
|
|
12
|
+
/** How the item reaches the buyer. */
|
|
13
|
+
type Kind = "download" | "ships" | "pickup";
|
|
14
|
+
/** Props accepted by {@link FulfilmentNote}; the host is a `<span>`. */
|
|
15
|
+
interface Props extends Omit<TagProps<"span">, "children"> {
|
|
16
|
+
kind: Kind;
|
|
17
|
+
/** The words, such as "Instant download" or "Ships in 3–5 days". */
|
|
18
|
+
children: RemixNode;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders an inline icon and text in small muted type, so it flows inside a line of details
|
|
23
|
+
* or stands alone under a price. The kind is written to `data-kind` for a page to style by.
|
|
24
|
+
*
|
|
25
|
+
* @example <FulfilmentNote kind="download">Instant download</FulfilmentNote>
|
|
26
|
+
* @example <FulfilmentNote kind="ships">Ships in 3–5 days</FulfilmentNote>
|
|
27
|
+
*/
|
|
28
|
+
export declare function FulfilmentNote(handle: Handle<FulfilmentNote.Props>): () => import("remix/component").RemixElement;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { DownloadIcon, StoreIcon, TruckIcon } from "@sdxc/icons";
|
|
3
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
4
|
+
/**
|
|
5
|
+
* Renders an inline icon and text in small muted type, so it flows inside a line of details
|
|
6
|
+
* or stands alone under a price. The kind is written to `data-kind` for a page to style by.
|
|
7
|
+
*
|
|
8
|
+
* @example <FulfilmentNote kind="download">Instant download</FulfilmentNote>
|
|
9
|
+
* @example <FulfilmentNote kind="ships">Ships in 3–5 days</FulfilmentNote>
|
|
10
|
+
*/
|
|
11
|
+
export function FulfilmentNote(handle) {
|
|
12
|
+
return () => {
|
|
13
|
+
let { children, kind, mix, ...rest } = handle.props;
|
|
14
|
+
return (_jsxs("span", { ...rest, "data-slot": "fulfilment-note", "data-kind": kind, mix: mergeMix([
|
|
15
|
+
raw({
|
|
16
|
+
display: "inline-flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
gap: "0.375rem",
|
|
19
|
+
fontSize: "0.8125rem",
|
|
20
|
+
lineHeight: "1.3",
|
|
21
|
+
color: "var(--ui-neutral-fg-muted)",
|
|
22
|
+
"& > svg": { flex: "none", inlineSize: "0.9375rem", blockSize: "0.9375rem" },
|
|
23
|
+
}),
|
|
24
|
+
], mix), children: [kind === "download" ? _jsx(DownloadIcon, { "aria-hidden": "true" }) : null, kind === "ships" ? _jsx(TruckIcon, { "aria-hidden": "true" }) : null, kind === "pickup" ? _jsx(StoreIcon, { "aria-hidden": "true" }) : null, _jsx("span", { children: children })] }));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/commerce`: the pieces of a shop, from browsing (product cards, prices,
|
|
3
|
+
* facet filters, galleries, variant pickers) through the cart and checkout to the order and its
|
|
4
|
+
* tracker. Each module also imports on its own, as `@sdxc/ui/commerce/cart-line`.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./cart-drawer.js";
|
|
10
|
+
export * from "./cart-line.js";
|
|
11
|
+
export * from "./checkout-layout.js";
|
|
12
|
+
export * from "./facet-filters.js";
|
|
13
|
+
export * from "./fulfilment-note.js";
|
|
14
|
+
export * from "./item-options-dialog.js";
|
|
15
|
+
export * from "./menu-item-card.js";
|
|
16
|
+
export * from "./option-group.js";
|
|
17
|
+
export * from "./order-summary.js";
|
|
18
|
+
export * from "./order-tracker.js";
|
|
19
|
+
export * from "./price.js";
|
|
20
|
+
export * from "./product-card.js";
|
|
21
|
+
export * from "./product-gallery.js";
|
|
22
|
+
export * from "./promo-code.js";
|
|
23
|
+
export * from "./quantity-stepper.js";
|
|
24
|
+
export * from "./question-list.js";
|
|
25
|
+
export * from "./shipping-estimate.js";
|
|
26
|
+
export * from "./sort-select.js";
|
|
27
|
+
export * from "./variant-picker.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel for `@sdxc/ui/commerce`: the pieces of a shop, from browsing (product cards, prices,
|
|
3
|
+
* facet filters, galleries, variant pickers) through the cart and checkout to the order and its
|
|
4
|
+
* tracker. Each module also imports on its own, as `@sdxc/ui/commerce/cart-line`.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
export * from "./cart-drawer.js";
|
|
10
|
+
export * from "./cart-line.js";
|
|
11
|
+
export * from "./checkout-layout.js";
|
|
12
|
+
export * from "./facet-filters.js";
|
|
13
|
+
export * from "./fulfilment-note.js";
|
|
14
|
+
export * from "./item-options-dialog.js";
|
|
15
|
+
export * from "./menu-item-card.js";
|
|
16
|
+
export * from "./option-group.js";
|
|
17
|
+
export * from "./order-summary.js";
|
|
18
|
+
export * from "./order-tracker.js";
|
|
19
|
+
export * from "./price.js";
|
|
20
|
+
export * from "./product-card.js";
|
|
21
|
+
export * from "./product-gallery.js";
|
|
22
|
+
export * from "./promo-code.js";
|
|
23
|
+
export * from "./quantity-stepper.js";
|
|
24
|
+
export * from "./question-list.js";
|
|
25
|
+
export * from "./shipping-estimate.js";
|
|
26
|
+
export * from "./sort-select.js";
|
|
27
|
+
export * from "./variant-picker.js";
|