@sdxc/ui 2026.11.18 → 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.
Files changed (233) hide show
  1. package/README.md +133 -1
  2. package/dist/app/index.d.ts +1 -0
  3. package/dist/app/index.js +1 -0
  4. package/dist/app/mixins/command-palette.js +10 -2
  5. package/dist/app/mixins/log-viewer.js +17 -14
  6. package/dist/app/mixins/route-dialog.d.ts +17 -0
  7. package/dist/app/mixins/route-dialog.js +53 -0
  8. package/dist/app/optimistic-toggle.js +6 -0
  9. package/dist/app/route-dialog.d.ts +38 -0
  10. package/dist/app/route-dialog.js +49 -0
  11. package/dist/audio/equalizer.d.ts +24 -0
  12. package/dist/audio/equalizer.js +57 -0
  13. package/dist/audio/index.d.ts +16 -0
  14. package/dist/audio/index.js +16 -0
  15. package/dist/audio/media-tile.d.ts +38 -0
  16. package/dist/audio/media-tile.js +98 -0
  17. package/dist/audio/player-bar.d.ts +108 -0
  18. package/dist/audio/player-bar.js +338 -0
  19. package/dist/audio/queue-list.d.ts +56 -0
  20. package/dist/audio/queue-list.js +102 -0
  21. package/dist/audio/track-list.d.ts +91 -0
  22. package/dist/audio/track-list.js +226 -0
  23. package/dist/audio/utils/media-session.d.ts +44 -0
  24. package/dist/audio/utils/media-session.js +87 -0
  25. package/dist/audio/utils/play-queue.d.ts +98 -0
  26. package/dist/audio/utils/play-queue.js +149 -0
  27. package/dist/audio/utils/track-time.d.ts +28 -0
  28. package/dist/audio/utils/track-time.js +36 -0
  29. package/dist/chat/composer-format.d.ts +35 -0
  30. package/dist/chat/composer-format.js +84 -0
  31. package/dist/chat/index.d.ts +6 -0
  32. package/dist/chat/index.js +6 -0
  33. package/dist/chat/mention-menu.d.ts +43 -0
  34. package/dist/chat/mention-menu.js +70 -0
  35. package/dist/chat/message-group.d.ts +92 -0
  36. package/dist/chat/message-group.js +222 -0
  37. package/dist/chat/mixins/composer-format.d.ts +28 -0
  38. package/dist/chat/mixins/composer-format.js +80 -0
  39. package/dist/chat/mixins/composer-send.d.ts +2 -2
  40. package/dist/chat/mixins/composer-send.js +4 -2
  41. package/dist/chat/mixins/mention-menu.d.ts +41 -0
  42. package/dist/chat/mixins/mention-menu.js +213 -0
  43. package/dist/chat/mixins/reaction-sync.d.ts +47 -0
  44. package/dist/chat/mixins/reaction-sync.js +172 -0
  45. package/dist/chat/reaction-bar.d.ts +70 -0
  46. package/dist/chat/reaction-bar.js +108 -0
  47. package/dist/chat/typing-indicator.d.ts +42 -0
  48. package/dist/chat/typing-indicator.js +68 -0
  49. package/dist/chat/utils/composer-text.d.ts +38 -0
  50. package/dist/chat/utils/composer-text.js +86 -0
  51. package/dist/chat/utils/markdown-format.d.ts +30 -0
  52. package/dist/chat/utils/markdown-format.js +158 -0
  53. package/dist/chat/utils/mention-query.d.ts +55 -0
  54. package/dist/chat/utils/mention-query.js +60 -0
  55. package/dist/commerce/cart-drawer.d.ts +69 -0
  56. package/dist/commerce/cart-drawer.js +163 -0
  57. package/dist/commerce/cart-line.d.ts +32 -0
  58. package/dist/commerce/cart-line.js +43 -0
  59. package/dist/commerce/checkout-layout.d.ts +32 -0
  60. package/dist/commerce/checkout-layout.js +51 -0
  61. package/dist/commerce/facet-filters.d.ts +121 -0
  62. package/dist/commerce/facet-filters.js +318 -0
  63. package/dist/commerce/fulfilment-note.d.ts +28 -0
  64. package/dist/commerce/fulfilment-note.js +26 -0
  65. package/dist/commerce/index.d.ts +27 -0
  66. package/dist/commerce/index.js +27 -0
  67. package/dist/commerce/item-options-dialog.d.ts +67 -0
  68. package/dist/commerce/item-options-dialog.js +150 -0
  69. package/dist/commerce/menu-item-card.d.ts +37 -0
  70. package/dist/commerce/menu-item-card.js +96 -0
  71. package/dist/commerce/option-group.d.ts +62 -0
  72. package/dist/commerce/option-group.js +121 -0
  73. package/dist/commerce/order-summary.d.ts +42 -0
  74. package/dist/commerce/order-summary.js +76 -0
  75. package/dist/commerce/order-tracker.d.ts +80 -0
  76. package/dist/commerce/order-tracker.js +178 -0
  77. package/dist/commerce/price.d.ts +52 -0
  78. package/dist/commerce/price.js +108 -0
  79. package/dist/commerce/product-card.d.ts +53 -0
  80. package/dist/commerce/product-card.js +127 -0
  81. package/dist/commerce/product-gallery.d.ts +70 -0
  82. package/dist/commerce/product-gallery.js +186 -0
  83. package/dist/commerce/promo-code.d.ts +56 -0
  84. package/dist/commerce/promo-code.js +101 -0
  85. package/dist/commerce/quantity-stepper.d.ts +42 -0
  86. package/dist/commerce/quantity-stepper.js +53 -0
  87. package/dist/commerce/question-list.d.ts +53 -0
  88. package/dist/commerce/question-list.js +92 -0
  89. package/dist/commerce/shipping-estimate.d.ts +53 -0
  90. package/dist/commerce/shipping-estimate.js +39 -0
  91. package/dist/commerce/sort-select.d.ts +38 -0
  92. package/dist/commerce/sort-select.js +38 -0
  93. package/dist/commerce/variant-picker.d.ts +75 -0
  94. package/dist/commerce/variant-picker.js +135 -0
  95. package/dist/components/amount.d.ts +46 -0
  96. package/dist/components/amount.js +34 -0
  97. package/dist/components/autocomplete.d.ts +82 -0
  98. package/dist/components/autocomplete.js +114 -0
  99. package/dist/components/carousel.d.ts +31 -1
  100. package/dist/components/carousel.js +66 -3
  101. package/dist/components/index.d.ts +11 -0
  102. package/dist/components/index.js +11 -0
  103. package/dist/components/letterbox.d.ts +47 -0
  104. package/dist/components/letterbox.js +56 -0
  105. package/dist/components/lightbox.d.ts +88 -0
  106. package/dist/components/lightbox.js +224 -0
  107. package/dist/components/media-grid.d.ts +53 -0
  108. package/dist/components/media-grid.js +89 -0
  109. package/dist/components/range-months.d.ts +100 -0
  110. package/dist/components/range-months.js +274 -0
  111. package/dist/components/rating-input.d.ts +33 -0
  112. package/dist/components/rating-input.js +63 -0
  113. package/dist/components/rating.d.ts +38 -0
  114. package/dist/components/rating.js +66 -0
  115. package/dist/components/review-card.d.ts +39 -0
  116. package/dist/components/review-card.js +59 -0
  117. package/dist/components/section-bar.d.ts +57 -0
  118. package/dist/components/section-bar.js +140 -0
  119. package/dist/components/step-indicator.d.ts +46 -0
  120. package/dist/components/step-indicator.js +96 -0
  121. package/dist/finance/index.d.ts +10 -0
  122. package/dist/finance/index.js +10 -0
  123. package/dist/finance/ledger.d.ts +60 -0
  124. package/dist/finance/ledger.js +93 -0
  125. package/dist/finance/payment-card.d.ts +49 -0
  126. package/dist/finance/payment-card.js +115 -0
  127. package/dist/map/engine.d.ts +49 -0
  128. package/dist/map/engine.js +591 -0
  129. package/dist/map/index.d.ts +12 -0
  130. package/dist/map/index.js +12 -0
  131. package/dist/map/map-canvas.d.ts +101 -0
  132. package/dist/map/map-canvas.js +275 -0
  133. package/dist/map/map.d.ts +217 -0
  134. package/dist/map/map.js +598 -0
  135. package/dist/map/mixins/map-link.d.ts +30 -0
  136. package/dist/map/mixins/map-link.js +116 -0
  137. package/dist/map/utils/basemap.d.ts +88 -0
  138. package/dist/map/utils/basemap.js +84 -0
  139. package/dist/map/utils/cluster.d.ts +43 -0
  140. package/dist/map/utils/cluster.js +80 -0
  141. package/dist/map/utils/mercator.d.ts +66 -0
  142. package/dist/map/utils/mercator.js +92 -0
  143. package/dist/map/utils/stage.d.ts +24 -0
  144. package/dist/map/utils/stage.js +49 -0
  145. package/dist/mixins/autocomplete.d.ts +28 -0
  146. package/dist/mixins/autocomplete.js +283 -0
  147. package/dist/mixins/carousel-controls.d.ts +14 -3
  148. package/dist/mixins/carousel-controls.js +89 -30
  149. package/dist/mixins/index.d.ts +2 -0
  150. package/dist/mixins/index.js +2 -0
  151. package/dist/mixins/lightbox-controls.d.ts +34 -0
  152. package/dist/mixins/lightbox-controls.js +176 -0
  153. package/dist/schedule/agenda.d.ts +63 -0
  154. package/dist/schedule/agenda.js +221 -0
  155. package/dist/schedule/day-strip.d.ts +50 -0
  156. package/dist/schedule/day-strip.js +136 -0
  157. package/dist/schedule/free-busy.d.ts +96 -0
  158. package/dist/schedule/free-busy.js +285 -0
  159. package/dist/schedule/index.d.ts +15 -0
  160. package/dist/schedule/index.js +15 -0
  161. package/dist/schedule/mixins/day-strip-scroll.d.ts +16 -0
  162. package/dist/schedule/mixins/day-strip-scroll.js +40 -0
  163. package/dist/schedule/mixins/time-grid-drag.d.ts +24 -0
  164. package/dist/schedule/mixins/time-grid-drag.js +532 -0
  165. package/dist/schedule/month-view.d.ts +68 -0
  166. package/dist/schedule/month-view.js +301 -0
  167. package/dist/schedule/time-grid.d.ts +168 -0
  168. package/dist/schedule/time-grid.js +417 -0
  169. package/dist/schedule/utils/time-grid-layout.d.ts +50 -0
  170. package/dist/schedule/utils/time-grid-layout.js +93 -0
  171. package/dist/schedule/year-view.d.ts +46 -0
  172. package/dist/schedule/year-view.js +142 -0
  173. package/dist/styles/index.d.ts +1 -0
  174. package/dist/styles/index.js +1 -0
  175. package/dist/styles/typewriter-text.d.ts +20 -0
  176. package/dist/styles/typewriter-text.js +23 -0
  177. package/dist/test/map.d.ts +18 -0
  178. package/dist/test/map.js +96 -0
  179. package/dist/test/reels.d.ts +30 -0
  180. package/dist/test/reels.js +41 -0
  181. package/dist/test/stories.d.ts +31 -0
  182. package/dist/test/stories.js +66 -0
  183. package/dist/travel/boarding-pass.d.ts +107 -0
  184. package/dist/travel/boarding-pass.js +293 -0
  185. package/dist/travel/car-offer.d.ts +70 -0
  186. package/dist/travel/car-offer.js +127 -0
  187. package/dist/travel/fare-calendar.d.ts +85 -0
  188. package/dist/travel/fare-calendar.js +233 -0
  189. package/dist/travel/fare-options.d.ts +84 -0
  190. package/dist/travel/fare-options.js +142 -0
  191. package/dist/travel/flight-itinerary.d.ts +84 -0
  192. package/dist/travel/flight-itinerary.js +112 -0
  193. package/dist/travel/flight-option.d.ts +58 -0
  194. package/dist/travel/flight-option.js +111 -0
  195. package/dist/travel/flight-segment.d.ts +105 -0
  196. package/dist/travel/flight-segment.js +174 -0
  197. package/dist/travel/index.d.ts +20 -0
  198. package/dist/travel/index.js +20 -0
  199. package/dist/travel/package-savings.d.ts +74 -0
  200. package/dist/travel/package-savings.js +128 -0
  201. package/dist/travel/price-breakdown.d.ts +66 -0
  202. package/dist/travel/price-breakdown.js +102 -0
  203. package/dist/travel/rating-breakdown.d.ts +81 -0
  204. package/dist/travel/rating-breakdown.js +132 -0
  205. package/dist/travel/seat-map.d.ts +108 -0
  206. package/dist/travel/seat-map.js +371 -0
  207. package/dist/travel/trip-timeline.d.ts +84 -0
  208. package/dist/travel/trip-timeline.js +212 -0
  209. package/dist/utils/gamepad-presses.d.ts +21 -0
  210. package/dist/utils/gamepad-presses.js +28 -0
  211. package/dist/utils/index.d.ts +5 -0
  212. package/dist/utils/index.js +5 -0
  213. package/dist/utils/move-focus.d.ts +20 -0
  214. package/dist/utils/move-focus.js +28 -0
  215. package/dist/utils/range-months.d.ts +54 -0
  216. package/dist/utils/range-months.js +98 -0
  217. package/dist/utils/swipe-direction.d.ts +23 -0
  218. package/dist/utils/swipe-direction.js +27 -0
  219. package/dist/utils/typewriter.d.ts +49 -0
  220. package/dist/utils/typewriter.js +171 -0
  221. package/dist/video/index.d.ts +6 -2
  222. package/dist/video/index.js +6 -2
  223. package/dist/video/mixins/reel-feed-sync.d.ts +41 -0
  224. package/dist/video/mixins/reel-feed-sync.js +430 -0
  225. package/dist/video/mixins/story-viewer-sync.d.ts +31 -0
  226. package/dist/video/mixins/story-viewer-sync.js +391 -0
  227. package/dist/video/reel-feed.d.ts +95 -0
  228. package/dist/video/reel-feed.js +124 -0
  229. package/dist/video/story-ring.d.ts +32 -0
  230. package/dist/video/story-ring.js +42 -0
  231. package/dist/video/story-viewer.d.ts +85 -0
  232. package/dist/video/story-viewer.js +250 -0
  233. package/package.json +21 -2
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The questions shoppers asked about a product and the answers they got: each question set
3
+ * bold behind a "Q:" mark, its answers indented behind "A:" with who answered, a badge such
4
+ * as "Store" or "Verified buyer", when, and room for a helpful vote.
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 QuestionList}. */
11
+ export declare namespace QuestionList {
12
+ /** One answer to a question. */
13
+ interface Answer {
14
+ id: string;
15
+ author: RemixNode;
16
+ /** Beside the author, such as "Store" or "Verified buyer". */
17
+ badge?: RemixNode;
18
+ body: RemixNode;
19
+ /** After the author, such as when it was written. */
20
+ meta?: RemixNode;
21
+ /** At the end of the answer, such as a POST form voting it helpful. */
22
+ helpful?: RemixNode;
23
+ }
24
+ /** One question and its answers. */
25
+ interface Question {
26
+ id: string;
27
+ question: RemixNode;
28
+ /** Under the question, such as who asked and when. */
29
+ meta?: RemixNode;
30
+ answers: Answer[];
31
+ }
32
+ /** The words the list carries. */
33
+ interface Labels {
34
+ /** The answer count under each question, with `{n}` for the count, such as "{n} answers". */
35
+ answers: string;
36
+ }
37
+ /** Props accepted by {@link QuestionList}; the host is a `<div>` holding the list. */
38
+ interface Props extends Omit<TagProps<"div">, "children"> {
39
+ questions: Question[];
40
+ /** Shown in place of the list when nobody has asked yet. */
41
+ empty?: RemixNode;
42
+ labels: Labels;
43
+ }
44
+ }
45
+ /**
46
+ * Renders each question as a list item: the "Q:" row, its meta and answer count, then an
47
+ * indented list of answers, each with its "A:" mark, its words and a row naming who answered.
48
+ * With no questions it renders `empty`, or nothing.
49
+ *
50
+ * @example
51
+ * <QuestionList questions={[{ id: "q1", question: "Does it come framed?", answers: [{ id: "a1", author: "The shop", badge: "Store", body: "Pick a frame on the format step." }] }]} labels={{ answers: "{n} answers" }} />
52
+ */
53
+ export declare function QuestionList(handle: Handle<QuestionList.Props>): () => import("remix/component").RemixElement | null;
@@ -0,0 +1,92 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { mergeMix, raw } from "@sdxc/u/general";
3
+ /** The bold "Q:" or "A:" mark that leads a question or an answer. */
4
+ function Marker(handle) {
5
+ return () => (_jsx("span", { "data-marker": "", mix: [
6
+ raw({
7
+ fontWeight: "800",
8
+ color: "var(--ui-neutral-fg-emphasis)",
9
+ fontVariantNumeric: "tabular-nums",
10
+ }),
11
+ ], children: handle.props.children }));
12
+ }
13
+ /**
14
+ * Renders each question as a list item: the "Q:" row, its meta and answer count, then an
15
+ * indented list of answers, each with its "A:" mark, its words and a row naming who answered.
16
+ * With no questions it renders `empty`, or nothing.
17
+ *
18
+ * @example
19
+ * <QuestionList questions={[{ id: "q1", question: "Does it come framed?", answers: [{ id: "a1", author: "The shop", badge: "Store", body: "Pick a frame on the format step." }] }]} labels={{ answers: "{n} answers" }} />
20
+ */
21
+ export function QuestionList(handle) {
22
+ return () => {
23
+ let { empty, labels, mix, questions, ...rest } = handle.props;
24
+ if (questions.length === 0) {
25
+ if (empty === undefined)
26
+ return null;
27
+ return (_jsx("div", { ...rest, "data-slot": "question-list", "data-empty": "", mix: mergeMix([raw({ color: "var(--ui-neutral-fg-muted)" })], mix), children: empty }));
28
+ }
29
+ return (_jsx("div", { ...rest, "data-slot": "question-list", mix: mix, children: _jsx("ul", { mix: [raw({ margin: "0", padding: "0", listStyle: "none" })], children: questions.map((entry) => (_jsxs("li", { "data-question": entry.id, mix: [
30
+ raw({
31
+ display: "grid",
32
+ gap: "0.75rem",
33
+ paddingBlock: "1.25rem",
34
+ borderBlockEnd: "1px solid var(--ui-neutral-border)",
35
+ "&:first-child": { paddingBlockStart: "0" },
36
+ }),
37
+ ], children: [_jsxs("div", { mix: [raw({ display: "grid", gap: "0.25rem" })], children: [_jsxs("p", { "data-slot": "question-list-question", mix: [
38
+ raw({
39
+ display: "flex",
40
+ gap: "0.5rem",
41
+ margin: "0",
42
+ fontWeight: "650",
43
+ lineHeight: "1.45",
44
+ color: "var(--ui-neutral-fg-emphasis)",
45
+ }),
46
+ ], children: [_jsx(Marker, { children: "Q:" }), _jsx("span", { children: entry.question })] }), _jsxs("p", { mix: [
47
+ raw({
48
+ margin: "0",
49
+ paddingInlineStart: "1.75rem",
50
+ fontSize: "0.8125rem",
51
+ color: "var(--ui-neutral-fg-muted)",
52
+ }),
53
+ ], children: [entry.meta === undefined ? null : _jsxs("span", { children: [entry.meta, " \u00B7 "] }), _jsx("span", { "data-slot": "question-list-count", children: labels.answers.replace("{n}", String(entry.answers.length)) })] })] }), entry.answers.length === 0 ? null : (_jsx("ul", { mix: [
54
+ raw({
55
+ display: "grid",
56
+ gap: "1rem",
57
+ margin: "0",
58
+ paddingInlineStart: "1.75rem",
59
+ listStyle: "none",
60
+ }),
61
+ ], children: entry.answers.map((answer) => (_jsxs("li", { "data-answer": answer.id, mix: [
62
+ raw({
63
+ display: "grid",
64
+ gridTemplateColumns: "1.25rem minmax(0, 1fr)",
65
+ columnGap: "0.5rem",
66
+ rowGap: "0.375rem",
67
+ lineHeight: "1.55",
68
+ }),
69
+ ], children: [_jsx(Marker, { children: "A:" }), _jsx("div", { "data-slot": "question-list-answer", children: answer.body }), _jsxs("div", { mix: [
70
+ raw({
71
+ gridColumn: "2",
72
+ display: "flex",
73
+ flexWrap: "wrap",
74
+ alignItems: "center",
75
+ columnGap: "0.5rem",
76
+ rowGap: "0.25rem",
77
+ fontSize: "0.8125rem",
78
+ color: "var(--ui-neutral-fg-muted)",
79
+ }),
80
+ ], children: [_jsx("span", { mix: [raw({ fontWeight: "600", color: "var(--ui-neutral-fg-emphasis)" })], children: answer.author }), answer.badge === undefined ? null : (_jsx("span", { "data-slot": "question-list-badge", mix: [
81
+ raw({
82
+ paddingInline: "0.4375rem",
83
+ paddingBlock: "0.0625rem",
84
+ borderRadius: "999px",
85
+ fontSize: "0.75rem",
86
+ fontWeight: "600",
87
+ color: "var(--ui-brand-fg)",
88
+ backgroundColor: "var(--ui-brand-bg-tint)",
89
+ }),
90
+ ], children: answer.badge })), answer.meta === undefined ? null : _jsx("span", { children: answer.meta }), answer.helpful === undefined ? null : (_jsx("span", { mix: [raw({ marginInlineStart: "auto" })], children: answer.helpful }))] })] }))) }))] }))) }) }));
91
+ };
92
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * "What will shipping cost?" on a cart page: a GET form taking a postcode, then each way the
3
+ * order could travel with its arrival date and price. The answer lives in the URL, so the
4
+ * estimate survives a reload and a shared link without script.
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 ShippingEstimate}. */
11
+ export declare namespace ShippingEstimate {
12
+ /** One way the order could travel. */
13
+ interface Option {
14
+ id: string;
15
+ /** Such as "Standard" or "Express courier". */
16
+ label: RemixNode;
17
+ /** When it would arrive, such as "Arrives Tue 24 Nov". */
18
+ arrives: RemixNode;
19
+ /** What it costs, formatted, or "Free". */
20
+ price: RemixNode;
21
+ }
22
+ /** The words the estimate carries. */
23
+ interface Labels {
24
+ /** The field's label, such as "Postcode". */
25
+ field: string;
26
+ submit: string;
27
+ /** The group's heading, such as "Estimate shipping". */
28
+ heading: string;
29
+ }
30
+ /** Props accepted by {@link ShippingEstimate}; the host is a `<div role="group">`. */
31
+ interface Props extends Omit<TagProps<"div">, "children"> {
32
+ /** The page the form reads back, usually the cart itself. */
33
+ action: string;
34
+ /** @default "postcode" */
35
+ name?: string;
36
+ /** The postcode the options answer. */
37
+ value?: string;
38
+ /** Why the postcode gave no options; the field is marked invalid and described by it. */
39
+ error?: RemixNode;
40
+ /** Hidden fields the query keeps, such as the country. */
41
+ fields?: Record<string, string>;
42
+ options?: Option[];
43
+ labels: Labels;
44
+ }
45
+ }
46
+ /**
47
+ * Renders the heading, the one-field form and, once a postcode is answered, the options as a
48
+ * list with the price end-aligned in tabular figures.
49
+ *
50
+ * @example
51
+ * <ShippingEstimate action="/cart" value="SW1A 1AA" options={[{ id: "std", label: "Standard", arrives: "Arrives Tue 24 Nov", price: "£4.95" }]} labels={{ field: "Postcode", submit: "Estimate", heading: "Estimate shipping" }} />
52
+ */
53
+ export declare function ShippingEstimate(handle: Handle<ShippingEstimate.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { mergeMix, raw } from "@sdxc/u/general";
3
+ import { Button } from "../components/button.js";
4
+ import { Input } from "../components/input.js";
5
+ /**
6
+ * Renders the heading, the one-field form and, once a postcode is answered, the options as a
7
+ * list with the price end-aligned in tabular figures.
8
+ *
9
+ * @example
10
+ * <ShippingEstimate action="/cart" value="SW1A 1AA" options={[{ id: "std", label: "Standard", arrives: "Arrives Tue 24 Nov", price: "£4.95" }]} labels={{ field: "Postcode", submit: "Estimate", heading: "Estimate shipping" }} />
11
+ */
12
+ export function ShippingEstimate(handle) {
13
+ return () => {
14
+ let { action, error, fields = {}, id, labels, mix, name = "postcode", options = [], value, ...rest } = handle.props;
15
+ let base = id ?? handle.id;
16
+ let headingId = `${base}-heading`;
17
+ let inputId = `${base}-field`;
18
+ let errorId = `${base}-error`;
19
+ let hasError = error !== undefined && error !== null && error !== false;
20
+ return (_jsxs("div", { ...rest, id: id, role: "group", "aria-labelledby": headingId, "data-slot": "shipping-estimate", mix: mergeMix([raw({ display: "grid", gap: "0.75rem" })], mix), children: [_jsx("p", { id: headingId, mix: [
21
+ raw({
22
+ margin: "0",
23
+ fontSize: "0.875rem",
24
+ fontWeight: "650",
25
+ color: "var(--ui-neutral-fg-emphasis)",
26
+ }),
27
+ ], children: labels.heading }), _jsxs("form", { method: "get", action: action, mix: [raw({ display: "grid", gap: "0.375rem" })], children: [Object.entries(fields).map(([field, fieldValue]) => (_jsx("input", { type: "hidden", name: field, value: fieldValue }))), _jsx("label", { htmlFor: inputId, mix: [raw({ fontSize: "0.8125rem", color: "var(--ui-neutral-fg-muted)" })], children: labels.field }), _jsxs("div", { mix: [raw({ display: "flex", gap: "0.5rem" })], children: [_jsx(Input, { id: inputId, name: name, value: value ?? "", autocomplete: "postal-code", "aria-invalid": hasError ? "true" : undefined, "aria-describedby": hasError ? errorId : undefined, mix: [raw({ flex: "1 1 auto", minInlineSize: "0" })] }), _jsx(Button, { type: "submit", variant: "outline", children: labels.submit })] }), hasError ? (_jsx("p", { id: errorId, "data-slot": "shipping-estimate-error", mix: [raw({ margin: "0", fontSize: "0.8125rem", color: "var(--ui-danger-fg)" })], children: error })) : null] }), options.length === 0 ? null : (_jsx("ul", { "data-slot": "shipping-estimate-options", mix: [raw({ margin: "0", padding: "0", listStyle: "none" })], children: options.map((option) => (_jsxs("li", { "data-option": option.id, mix: [
28
+ raw({
29
+ display: "grid",
30
+ gridTemplateColumns: "minmax(0, 1fr) auto",
31
+ columnGap: "1rem",
32
+ alignItems: "baseline",
33
+ paddingBlock: "0.625rem",
34
+ borderBlockEnd: "1px solid var(--ui-neutral-border)",
35
+ "&:last-child": { borderBlockEnd: "0" },
36
+ }),
37
+ ], children: [_jsxs("span", { mix: [raw({ display: "grid", gap: "0.125rem", minInlineSize: "0" })], children: [_jsx("span", { mix: [raw({ fontWeight: "600", color: "var(--ui-neutral-fg-emphasis)" })], children: option.label }), _jsx("span", { mix: [raw({ fontSize: "0.8125rem", color: "var(--ui-neutral-fg-muted)" })], children: option.arrives })] }), _jsx("span", { "data-slot": "shipping-estimate-price", mix: [raw({ fontWeight: "600", fontVariantNumeric: "tabular-nums" })], children: option.price })] }))) }))] }));
38
+ };
39
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The order a product listing is sorted in, as a labelled native select that submits its
3
+ * form the moment the shopper picks an order. It may sit outside that form by naming it, and
4
+ * without script a small button beside it submits instead.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { Handle, Props as TagProps } from "remix/component";
10
+ /** Prop types for {@link SortSelect}. */
11
+ export declare namespace SortSelect {
12
+ /** One order the listing can be sorted in. */
13
+ interface Option {
14
+ value: string;
15
+ label: string;
16
+ }
17
+ /** Props accepted by {@link SortSelect}; the host is a `<div>`. */
18
+ interface Props extends Omit<TagProps<"div">, "children"> {
19
+ /** The query field the order submits as, such as "sort". */
20
+ name: string;
21
+ /** The order selected now. */
22
+ value: string;
23
+ options: Option[];
24
+ /** The visible label, such as "Sort by". */
25
+ label: string;
26
+ /** The id of the form the select belongs to, when it sits outside that form. */
27
+ form?: string;
28
+ /** The button that submits without script. @default "Apply" */
29
+ submitLabel?: string;
30
+ }
31
+ }
32
+ /**
33
+ * Renders the label and select in a row, with a submit button that hides once script runs.
34
+ *
35
+ * @example
36
+ * <SortSelect form="filters" name="sort" value="new" label="Sort by" options={[{ value: "new", label: "Newest" }, { value: "price", label: "Price: low to high" }]} />
37
+ */
38
+ export declare function SortSelect(handle: Handle<SortSelect.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { mergeMix, raw } from "@sdxc/u/general";
3
+ import { Select } from "../components/select.js";
4
+ import { AutoSubmit } from "./facet-filters.js";
5
+ /** The no-script submit button's text when `submitLabel` is unset. */
6
+ const DEFAULT_SUBMIT_LABEL = "Apply";
7
+ /**
8
+ * Renders the label and select in a row, with a submit button that hides once script runs.
9
+ *
10
+ * @example
11
+ * <SortSelect form="filters" name="sort" value="new" label="Sort by" options={[{ value: "new", label: "Newest" }, { value: "price", label: "Price: low to high" }]} />
12
+ */
13
+ export function SortSelect(handle) {
14
+ return () => {
15
+ let { form, label, mix, name, options, submitLabel = DEFAULT_SUBMIT_LABEL, value, ...rest } = handle.props;
16
+ let selectId = `${handle.id}-select`;
17
+ return (_jsxs("div", { ...rest, "data-slot": "sort-select", mix: mergeMix([raw({ display: "inline-flex", alignItems: "center", gap: "0.5rem" })], mix), children: [_jsx("label", { for: selectId, mix: [
18
+ raw({
19
+ flexShrink: "0",
20
+ fontSize: "0.875rem",
21
+ color: "var(--ui-neutral-fg-muted)",
22
+ }),
23
+ ], children: label }), _jsx(Select, { id: selectId, name: name, form: form, mix: [raw({ inlineSize: "auto" })], children: options.map((option) => (_jsx("option", { value: option.value, selected: option.value === value, children: option.label }))) }), _jsx("button", { type: "submit", form: form, "data-auto-submit-hide": "", "data-slot": "sort-select-submit", mix: [
24
+ raw({
25
+ minBlockSize: "2.5rem",
26
+ paddingInline: "0.875rem",
27
+ border: "0",
28
+ borderRadius: "var(--ui-radius-md, 0.5rem)",
29
+ font: "inherit",
30
+ fontSize: "0.875rem",
31
+ fontWeight: "600",
32
+ color: "var(--ui-neutral-fg-emphasis)",
33
+ backgroundColor: "var(--ui-neutral-bg-tint)",
34
+ cursor: "pointer",
35
+ }),
36
+ ], children: submitLabel }), _jsx(AutoSubmit, {})] }));
37
+ };
38
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The options a product comes in, such as colour, size and format, where every option is a
3
+ * link to the product page with that option chosen. The server stays the source of the
4
+ * selection, the page works without script, and a frame target swaps it in place.
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 VariantPicker} and its compound parts. */
11
+ export declare namespace VariantPicker {
12
+ /** Props accepted by {@link VariantPicker}; the host is a `<div>`. */
13
+ interface Props extends Omit<TagProps<"div">, "children"> {
14
+ children: RemixNode;
15
+ /** A frame's name every option link loads into, so choosing swaps that frame in place. */
16
+ target?: string;
17
+ }
18
+ /** What the picker shares with its options. */
19
+ interface Context {
20
+ target?: string;
21
+ }
22
+ /** Props accepted by {@link VariantPicker.Axis}. */
23
+ interface AxisProps {
24
+ /** The axis's name, such as "Colour". */
25
+ label: RemixNode;
26
+ /** The current choice's name, shown after the label. */
27
+ value?: RemixNode;
28
+ /** Content at the row's end, such as a "Size guide" link. */
29
+ aside?: RemixNode;
30
+ children: RemixNode;
31
+ }
32
+ /** Props accepted by {@link VariantPicker.Swatch}. */
33
+ interface SwatchProps {
34
+ href: string;
35
+ /** The colour's name; it is the link's accessible name and tooltip. */
36
+ name: string;
37
+ /** Any CSS colour or gradient. */
38
+ color: string;
39
+ selected?: boolean;
40
+ /** Strikes the swatch through; it still links, so its page can offer a notice. */
41
+ unavailable?: boolean;
42
+ /** Added to the accessible name when unavailable, such as "sold out". */
43
+ unavailableLabel?: string;
44
+ }
45
+ /** Props accepted by {@link VariantPicker.Choice}. */
46
+ interface ChoiceProps {
47
+ href: string;
48
+ label: RemixNode;
49
+ /** A second line in a card, such as its price or "Instant download". */
50
+ detail?: RemixNode;
51
+ /** A small line under a card's detail, such as "Only 2 left". */
52
+ note?: RemixNode;
53
+ selected?: boolean;
54
+ /** Strikes the choice through; it still links, so its page can offer a notice. */
55
+ unavailable?: boolean;
56
+ /** Read after the label when unavailable, such as "sold out". */
57
+ unavailableLabel?: string;
58
+ /** A compact pill for sizes, or a card for formats with a detail line. @default "pill" */
59
+ variant?: "pill" | "card";
60
+ }
61
+ }
62
+ /**
63
+ * Renders the picker, a column of axes. Its `target` reaches every option link as
64
+ * `data-rmx-target`, so a choice reloads that frame in place: the page keeps its scroll and
65
+ * the address changes to the variant without a new history entry per pick.
66
+ *
67
+ * @example
68
+ * <VariantPicker target="product"><VariantPicker.Axis label="Size" value="50×70"><VariantPicker.Choice href="?size=50x70" label="50×70" selected /></VariantPicker.Axis></VariantPicker>
69
+ */
70
+ export declare function VariantPicker(handle: Handle<VariantPicker.Props, VariantPicker.Context>): () => import("remix/component").RemixElement;
71
+ export declare namespace VariantPicker {
72
+ var Axis: (handle: Handle<VariantPicker.AxisProps>) => () => import("remix/component").RemixElement;
73
+ var Swatch: (handle: Handle<VariantPicker.SwatchProps>) => () => import("remix/component").RemixElement;
74
+ var Choice: (handle: Handle<VariantPicker.ChoiceProps>) => () => import("remix/component").RemixElement;
75
+ }
@@ -0,0 +1,135 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { visuallyHidden } from "@sdxc/u/a11y";
3
+ import { mergeMix, raw } from "@sdxc/u/general";
4
+ import { when } from "@sdxc/u/state";
5
+ /**
6
+ * Reads the target the nearest picker set; an option outside a picker loads normally.
7
+ *
8
+ * @param handle Runtime handle of the option performing the lookup.
9
+ */
10
+ function readTarget(handle) {
11
+ let context = handle.context.get(VariantPicker);
12
+ return context?.target;
13
+ }
14
+ /**
15
+ * Renders the picker, a column of axes. Its `target` reaches every option link as
16
+ * `data-rmx-target`, so a choice reloads that frame in place: the page keeps its scroll and
17
+ * the address changes to the variant without a new history entry per pick.
18
+ *
19
+ * @example
20
+ * <VariantPicker target="product"><VariantPicker.Axis label="Size" value="50×70"><VariantPicker.Choice href="?size=50x70" label="50×70" selected /></VariantPicker.Axis></VariantPicker>
21
+ */
22
+ export function VariantPicker(handle) {
23
+ return () => {
24
+ let { children, mix, target, ...rest } = handle.props;
25
+ handle.context.set({ target });
26
+ return (_jsx("div", { ...rest, "data-slot": "variant-picker", mix: mergeMix([raw({ display: "grid", gap: "1.25rem" })], mix), children: children }));
27
+ };
28
+ }
29
+ /**
30
+ * Renders one axis: a row with its label, the current choice and an aside, over the options
31
+ * in a group named by that row.
32
+ *
33
+ * @example <VariantPicker.Axis label="Frame" value="Oak" aside={<a href="/frames">About frames</a>}>…</VariantPicker.Axis>
34
+ */
35
+ VariantPicker.Axis = function VariantPickerAxis(handle) {
36
+ return () => {
37
+ let { aside, children, label, value } = handle.props;
38
+ let labelId = `${handle.id}-label`;
39
+ return (_jsxs("div", { "data-slot": "variant-picker-axis", mix: [raw({ display: "grid", gap: "0.625rem" })], children: [_jsxs("div", { mix: [
40
+ raw({
41
+ display: "flex",
42
+ alignItems: "baseline",
43
+ justifyContent: "space-between",
44
+ gap: "0.75rem",
45
+ fontSize: "0.875rem",
46
+ }),
47
+ ], children: [_jsxs("span", { id: labelId, children: [_jsx("span", { mix: [raw({ fontWeight: "650", color: "var(--ui-neutral-fg-emphasis)" })], children: label }), value === undefined ? null : (_jsxs("span", { "data-slot": "variant-picker-value", mix: [raw({ color: "var(--ui-neutral-fg-muted)" })], children: [": ", value] }))] }), aside === undefined ? null : _jsx("span", { children: aside })] }), _jsx("div", { role: "group", "aria-labelledby": labelId, mix: [raw({ display: "flex", flexWrap: "wrap", gap: "0.5rem" })], children: children })] }));
48
+ };
49
+ };
50
+ /**
51
+ * Renders a round colour swatch as a link, ringed when selected and struck diagonally when
52
+ * unavailable. The name is its accessible name and its tooltip.
53
+ *
54
+ * @example <VariantPicker.Swatch href="?frame=oak" name="Oak" color="#b58a5a" selected />
55
+ */
56
+ VariantPicker.Swatch = function VariantPickerSwatch(handle) {
57
+ return () => {
58
+ let { color, href, name, selected = false, unavailable = false, unavailableLabel, } = handle.props;
59
+ let target = readTarget(handle);
60
+ let accessibleName = unavailable && unavailableLabel !== undefined ? `${name}, ${unavailableLabel}` : name;
61
+ return (_jsx("a", { href: href, title: name, "aria-label": accessibleName, "aria-current": selected ? "true" : undefined, "data-rmx-target": target, "data-rmx-reset-scroll": target === undefined ? undefined : "false", "data-rmx-history": target === undefined ? undefined : "replace", "data-unavailable": unavailable ? "" : undefined, "data-slot": "variant-picker-swatch", mix: [
62
+ raw({
63
+ position: "relative",
64
+ display: "inline-block",
65
+ inlineSize: "2.25rem",
66
+ blockSize: "2.25rem",
67
+ borderRadius: "999px",
68
+ boxShadow: "inset 0 0 0 1px rgb(0 0 0 / 0.14)",
69
+ cursor: "pointer",
70
+ }),
71
+ when("&[aria-current='true']", raw({
72
+ outline: "2px solid var(--ui-neutral-fg-emphasis)",
73
+ outlineOffset: "2px",
74
+ })),
75
+ when("&:hover:not([aria-current='true'])", raw({ outline: "1px solid var(--ui-neutral-border-strong)", outlineOffset: "2px" })),
76
+ when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "3px" })),
77
+ when("&[data-unavailable]::after", raw({
78
+ content: '""',
79
+ position: "absolute",
80
+ inset: "0",
81
+ borderRadius: "inherit",
82
+ background: "linear-gradient(to top right, transparent calc(50% - 1px), var(--ui-bg, white) calc(50% - 1px), var(--ui-bg, white) calc(50% + 1px), transparent calc(50% + 1px))",
83
+ opacity: "0.9",
84
+ })),
85
+ ], style: { background: color } }));
86
+ };
87
+ };
88
+ /**
89
+ * Renders a choice as a link: a pill for a size, or a card with a detail and note for a
90
+ * format. A card stands at least 44px tall, so it is an easy target on a phone.
91
+ *
92
+ * @example <VariantPicker.Choice href="?size=a2" label="A2" />
93
+ * @example <VariantPicker.Choice variant="card" href="?format=digital" label="Digital" detail="Instant download" />
94
+ */
95
+ VariantPicker.Choice = function VariantPickerChoice(handle) {
96
+ return () => {
97
+ let { detail, href, label, note, selected = false, unavailable = false, unavailableLabel, variant = "pill", } = handle.props;
98
+ let target = readTarget(handle);
99
+ let card = variant === "card";
100
+ return (_jsxs("a", { href: href, "aria-current": selected ? "true" : undefined, "data-rmx-target": target, "data-rmx-reset-scroll": target === undefined ? undefined : "false", "data-rmx-history": target === undefined ? undefined : "replace", "data-unavailable": unavailable ? "" : undefined, "data-variant": variant, "data-slot": "variant-picker-choice", mix: [
101
+ raw({
102
+ display: card ? "grid" : "inline-flex",
103
+ alignItems: "center",
104
+ alignContent: "center",
105
+ justifyContent: card ? "start" : "center",
106
+ gap: "0.125rem",
107
+ boxSizing: "border-box",
108
+ minInlineSize: card ? "9rem" : "3rem",
109
+ minBlockSize: card ? "2.75rem" : "2.5rem",
110
+ flex: card ? "1 1 9rem" : "0 0 auto",
111
+ paddingInline: card ? "0.875rem" : "1rem",
112
+ paddingBlock: card ? "0.625rem" : "0",
113
+ borderRadius: card ? "var(--ui-radius-md, 0.5rem)" : "999px",
114
+ fontSize: "0.875rem",
115
+ color: "var(--ui-neutral-fg-emphasis)",
116
+ textDecoration: "none",
117
+ boxShadow: "inset 0 0 0 1px var(--ui-neutral-border)",
118
+ "&:hover": { boxShadow: "inset 0 0 0 1px var(--ui-neutral-border-strong)" },
119
+ "&[data-unavailable]": { color: "var(--ui-neutral-fg-muted)" },
120
+ "&[aria-current='true']": {
121
+ boxShadow: "inset 0 0 0 2px var(--ui-neutral-fg-emphasis)",
122
+ backgroundColor: "var(--ui-neutral-bg-tint)",
123
+ },
124
+ }),
125
+ when("&:focus-visible", raw({ outline: "2px solid var(--ui-brand-ring)", outlineOffset: "2px" })),
126
+ when("&[data-unavailable] [data-slot='variant-picker-choice-label']", raw({ textDecoration: "line-through" })),
127
+ ], children: [_jsx("span", { "data-slot": "variant-picker-choice-label", mix: [raw({ fontWeight: card ? "650" : "500" })], children: label }), unavailable && unavailableLabel !== undefined ? (_jsx("span", { mix: [visuallyHidden()], children: `, ${unavailableLabel}` })) : null, card && detail !== undefined ? (_jsx("span", { "data-slot": "variant-picker-choice-detail", mix: [
128
+ raw({
129
+ fontSize: "0.8125rem",
130
+ fontVariantNumeric: "tabular-nums",
131
+ color: "var(--ui-neutral-fg-muted)",
132
+ }),
133
+ ], children: detail })) : null, card && note !== undefined ? (_jsx("span", { "data-slot": "variant-picker-choice-note", mix: [raw({ fontSize: "0.75rem", color: "var(--ui-neutral-fg-muted)" })], children: note })) : null] }));
134
+ };
135
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * An amount of money given as integer minor units and an ISO 4217 code, written by
3
+ * `@sdxc/money` in any locale: the currency's own decimals (none for yen), a true minus, an
4
+ * incoming-money tone, and smaller cents for a balance that leads a screen.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { SignDisplay } from "@sdxc/money";
10
+ import type { Handle, Props as TagProps } from "remix/component";
11
+ /** Prop types for {@link Amount}. */
12
+ export declare namespace Amount {
13
+ /**
14
+ * How the sign shows: `auto` marks a negative amount, `always` marks both directions,
15
+ * `never` shows the magnitude alone, and `ledger` marks money in with a plus and the
16
+ * success tone while money out reads as a plain figure, the way a statement lists them.
17
+ */
18
+ type Sign = SignDisplay;
19
+ /** Props accepted by {@link Amount}. */
20
+ interface Props extends Omit<TagProps<"data">, "value" | "children"> {
21
+ /** The amount in the currency's minor units (cents, pence; whole yen), as an integer. */
22
+ value: number;
23
+ /** The ISO 4217 code, such as `EUR` or `JPY`. */
24
+ currency: string;
25
+ /** @default "en-US" */
26
+ locale?: string;
27
+ /** @default "auto" */
28
+ sign?: Sign;
29
+ /** Sets the decimals in a smaller size, for a balance that heads a screen. @default false */
30
+ smallMinor?: boolean;
31
+ /** Abbreviates large amounts (`€12K`), for a chart axis or a tight tile. @default false */
32
+ compact?: boolean;
33
+ /** `symbol` (`$`), `narrowSymbol` (`$` for every dollar) or `code` (`USD`). @default "narrowSymbol" */
34
+ display?: "symbol" | "narrowSymbol" | "code";
35
+ }
36
+ }
37
+ /**
38
+ * Renders an amount in a native `<data>` element whose `value` is the decimal figure, so a
39
+ * script or a crawler reads the number while a person reads the formatted one. Figures are
40
+ * tabular, so a column of amounts lines up, and the amount never wraps.
41
+ *
42
+ * @example <Amount value={-1299} currency="EUR" locale="en-IE" />
43
+ * @example <Amount value={4500} currency="GBP" sign="ledger" />
44
+ * @example <Amount value={1284056} currency="EUR" smallMinor />
45
+ */
46
+ export declare function Amount(handle: Handle<Amount.Props>): () => import("remix/component").RemixElement;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "remix/component/jsx-runtime";
2
+ import { amountParts, currencyExponent } from "@sdxc/money";
3
+ import { fg } from "@sdxc/u/color";
4
+ import { mergeMix, raw } from "@sdxc/u/general";
5
+ import { when } from "@sdxc/u/state";
6
+ import { nowrap, tabularNums } from "@sdxc/u/typography";
7
+ /** Which way money moved, for styling a row by direction: `in`, `out`, or `zero`. */
8
+ function direction(value) {
9
+ if (value > 0)
10
+ return "in";
11
+ if (value < 0)
12
+ return "out";
13
+ return "zero";
14
+ }
15
+ /**
16
+ * Renders an amount in a native `<data>` element whose `value` is the decimal figure, so a
17
+ * script or a crawler reads the number while a person reads the formatted one. Figures are
18
+ * tabular, so a column of amounts lines up, and the amount never wraps.
19
+ *
20
+ * @example <Amount value={-1299} currency="EUR" locale="en-IE" />
21
+ * @example <Amount value={4500} currency="GBP" sign="ledger" />
22
+ * @example <Amount value={1284056} currency="EUR" smallMinor />
23
+ */
24
+ export function Amount(handle) {
25
+ return () => {
26
+ let { value, currency, locale, sign = "auto", smallMinor = false, compact = false, display, mix, ...rest } = handle.props;
27
+ let exponent = currencyExponent(currency);
28
+ let parts = amountParts(value, currency, { locale: locale ?? "en-US", sign, compact, display });
29
+ let credit = sign === "ledger" && value > 0;
30
+ return (_jsx("data", { ...rest, value: (value / 10 ** exponent).toFixed(exponent), "data-slot": "amount", "data-currency": currency, "data-direction": direction(value), "data-credit": credit ? "" : undefined, mix: mergeMix([tabularNums(), nowrap(), when("&[data-credit]", fg("success"))], mix), children: smallMinor
31
+ ? parts.map((part) => part.type === "fraction" || part.type === "decimal" ? (_jsx("span", { "data-slot": "amount-minor", mix: raw({ fontSize: "0.62em" }), children: part.value })) : (part.value))
32
+ : parts.map((part) => part.value).join("") }));
33
+ };
34
+ }