@stapel/categories-react 0.1.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.
Files changed (205) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/MODULE.md +194 -0
  3. package/README.md +191 -0
  4. package/dist/api/categoriesApi.d.ts +121 -0
  5. package/dist/api/categoriesApi.d.ts.map +1 -0
  6. package/dist/api/categoriesApi.js +48 -0
  7. package/dist/api/categoriesApi.js.map +1 -0
  8. package/dist/api/generated/schema.d.ts +2321 -0
  9. package/dist/api/generated/schema.d.ts.map +1 -0
  10. package/dist/api/generated/schema.js +2 -0
  11. package/dist/api/generated/schema.js.map +1 -0
  12. package/dist/api/types.d.ts +92 -0
  13. package/dist/api/types.d.ts.map +1 -0
  14. package/dist/api/types.js +2 -0
  15. package/dist/api/types.js.map +1 -0
  16. package/dist/catalog/labels.d.ts +103 -0
  17. package/dist/catalog/labels.d.ts.map +1 -0
  18. package/dist/catalog/labels.js +56 -0
  19. package/dist/catalog/labels.js.map +1 -0
  20. package/dist/catalog/pks.d.ts +25 -0
  21. package/dist/catalog/pks.d.ts.map +1 -0
  22. package/dist/catalog/pks.js +38 -0
  23. package/dist/catalog/pks.js.map +1 -0
  24. package/dist/catalog/sync.d.ts +103 -0
  25. package/dist/catalog/sync.d.ts.map +1 -0
  26. package/dist/catalog/sync.js +114 -0
  27. package/dist/catalog/sync.js.map +1 -0
  28. package/dist/catalog/tree.d.ts +119 -0
  29. package/dist/catalog/tree.d.ts.map +1 -0
  30. package/dist/catalog/tree.js +166 -0
  31. package/dist/catalog/tree.js.map +1 -0
  32. package/dist/default/CatalogPage.d.ts +16 -0
  33. package/dist/default/CatalogPage.d.ts.map +1 -0
  34. package/dist/default/CatalogPage.js +13 -0
  35. package/dist/default/CatalogPage.js.map +1 -0
  36. package/dist/default/CategoryBreadcrumbsBar.d.ts +20 -0
  37. package/dist/default/CategoryBreadcrumbsBar.d.ts.map +1 -0
  38. package/dist/default/CategoryBreadcrumbsBar.js +35 -0
  39. package/dist/default/CategoryBreadcrumbsBar.js.map +1 -0
  40. package/dist/default/CategoryCarouselStrip.d.ts +22 -0
  41. package/dist/default/CategoryCarouselStrip.d.ts.map +1 -0
  42. package/dist/default/CategoryCarouselStrip.js +24 -0
  43. package/dist/default/CategoryCarouselStrip.js.map +1 -0
  44. package/dist/default/CategoryFeatureList.d.ts +23 -0
  45. package/dist/default/CategoryFeatureList.d.ts.map +1 -0
  46. package/dist/default/CategoryFeatureList.js +28 -0
  47. package/dist/default/CategoryFeatureList.js.map +1 -0
  48. package/dist/default/CategoryPage.d.ts +43 -0
  49. package/dist/default/CategoryPage.d.ts.map +1 -0
  50. package/dist/default/CategoryPage.js +21 -0
  51. package/dist/default/CategoryPage.js.map +1 -0
  52. package/dist/default/CategoryPickerField.d.ts +26 -0
  53. package/dist/default/CategoryPickerField.d.ts.map +1 -0
  54. package/dist/default/CategoryPickerField.js +40 -0
  55. package/dist/default/CategoryPickerField.js.map +1 -0
  56. package/dist/default/CategoryTreePane.d.ts +28 -0
  57. package/dist/default/CategoryTreePane.d.ts.map +1 -0
  58. package/dist/default/CategoryTreePane.js +25 -0
  59. package/dist/default/CategoryTreePane.js.map +1 -0
  60. package/dist/default/ErrorAlert.d.ts +9 -0
  61. package/dist/default/ErrorAlert.d.ts.map +1 -0
  62. package/dist/default/ErrorAlert.js +27 -0
  63. package/dist/default/ErrorAlert.js.map +1 -0
  64. package/dist/default/index.d.ts +37 -0
  65. package/dist/default/index.d.ts.map +1 -0
  66. package/dist/default/index.js +28 -0
  67. package/dist/default/index.js.map +1 -0
  68. package/dist/default/theme.d.ts +25 -0
  69. package/dist/default/theme.d.ts.map +1 -0
  70. package/dist/default/theme.js +40 -0
  71. package/dist/default/theme.js.map +1 -0
  72. package/dist/default/types.d.ts +12 -0
  73. package/dist/default/types.d.ts.map +1 -0
  74. package/dist/default/types.js +2 -0
  75. package/dist/default/types.js.map +1 -0
  76. package/dist/headless/CategoriesProvider.d.ts +19 -0
  77. package/dist/headless/CategoriesProvider.d.ts.map +1 -0
  78. package/dist/headless/CategoriesProvider.js +15 -0
  79. package/dist/headless/CategoriesProvider.js.map +1 -0
  80. package/dist/headless/CategoryBreadcrumbs.d.ts +40 -0
  81. package/dist/headless/CategoryBreadcrumbs.d.ts.map +1 -0
  82. package/dist/headless/CategoryBreadcrumbs.js +42 -0
  83. package/dist/headless/CategoryBreadcrumbs.js.map +1 -0
  84. package/dist/headless/CategoryCarousel.d.ts +48 -0
  85. package/dist/headless/CategoryCarousel.d.ts.map +1 -0
  86. package/dist/headless/CategoryCarousel.js +34 -0
  87. package/dist/headless/CategoryCarousel.js.map +1 -0
  88. package/dist/headless/CategoryFeatures.d.ts +67 -0
  89. package/dist/headless/CategoryFeatures.d.ts.map +1 -0
  90. package/dist/headless/CategoryFeatures.js +46 -0
  91. package/dist/headless/CategoryFeatures.js.map +1 -0
  92. package/dist/headless/CategoryPicker.d.ts +69 -0
  93. package/dist/headless/CategoryPicker.d.ts.map +1 -0
  94. package/dist/headless/CategoryPicker.js +86 -0
  95. package/dist/headless/CategoryPicker.js.map +1 -0
  96. package/dist/headless/CategoryTree.d.ts +55 -0
  97. package/dist/headless/CategoryTree.d.ts.map +1 -0
  98. package/dist/headless/CategoryTree.js +51 -0
  99. package/dist/headless/CategoryTree.js.map +1 -0
  100. package/dist/i18n/errorsMap.d.ts +22 -0
  101. package/dist/i18n/errorsMap.d.ts.map +1 -0
  102. package/dist/i18n/errorsMap.js +31 -0
  103. package/dist/i18n/errorsMap.js.map +1 -0
  104. package/dist/i18n/es.d.ts +25 -0
  105. package/dist/i18n/es.d.ts.map +1 -0
  106. package/dist/i18n/es.js +74 -0
  107. package/dist/i18n/es.js.map +1 -0
  108. package/dist/i18n/generated/errors.es.gen.d.ts +16 -0
  109. package/dist/i18n/generated/errors.es.gen.d.ts.map +1 -0
  110. package/dist/i18n/generated/errors.es.gen.js +58 -0
  111. package/dist/i18n/generated/errors.es.gen.js.map +1 -0
  112. package/dist/i18n/generated/errors.gen.d.ts +407 -0
  113. package/dist/i18n/generated/errors.gen.d.ts.map +1 -0
  114. package/dist/i18n/generated/errors.gen.js +207 -0
  115. package/dist/i18n/generated/errors.gen.js.map +1 -0
  116. package/dist/i18n/generated/errors.ru.gen.d.ts +16 -0
  117. package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -0
  118. package/dist/i18n/generated/errors.ru.gen.js +58 -0
  119. package/dist/i18n/generated/errors.ru.gen.js.map +1 -0
  120. package/dist/i18n/keys.d.ts +89 -0
  121. package/dist/i18n/keys.d.ts.map +1 -0
  122. package/dist/i18n/keys.js +134 -0
  123. package/dist/i18n/keys.js.map +1 -0
  124. package/dist/i18n/ru.d.ts +41 -0
  125. package/dist/i18n/ru.d.ts.map +1 -0
  126. package/dist/i18n/ru.js +90 -0
  127. package/dist/i18n/ru.js.map +1 -0
  128. package/dist/index.d.ts +88 -0
  129. package/dist/index.d.ts.map +1 -0
  130. package/dist/index.js +78 -0
  131. package/dist/index.js.map +1 -0
  132. package/dist/model/catalogStore.d.ts +23 -0
  133. package/dist/model/catalogStore.d.ts.map +1 -0
  134. package/dist/model/catalogStore.js +85 -0
  135. package/dist/model/catalogStore.js.map +1 -0
  136. package/dist/model/catalogSync.d.ts +49 -0
  137. package/dist/model/catalogSync.d.ts.map +1 -0
  138. package/dist/model/catalogSync.js +64 -0
  139. package/dist/model/catalogSync.js.map +1 -0
  140. package/dist/model/context.d.ts +11 -0
  141. package/dist/model/context.d.ts.map +1 -0
  142. package/dist/model/context.js +16 -0
  143. package/dist/model/context.js.map +1 -0
  144. package/dist/model/queries.d.ts +124 -0
  145. package/dist/model/queries.d.ts.map +1 -0
  146. package/dist/model/queries.js +147 -0
  147. package/dist/model/queries.js.map +1 -0
  148. package/dist/model/queryKeys.d.ts +30 -0
  149. package/dist/model/queryKeys.d.ts.map +1 -0
  150. package/dist/model/queryKeys.js +16 -0
  151. package/dist/model/queryKeys.js.map +1 -0
  152. package/dist/model/runtime.d.ts +31 -0
  153. package/dist/model/runtime.d.ts.map +1 -0
  154. package/dist/model/runtime.js +6 -0
  155. package/dist/model/runtime.js.map +1 -0
  156. package/dist/nav/manifest.d.ts +31 -0
  157. package/dist/nav/manifest.d.ts.map +1 -0
  158. package/dist/nav/manifest.js +37 -0
  159. package/dist/nav/manifest.js.map +1 -0
  160. package/llms.txt +125 -0
  161. package/manifest.json +918 -0
  162. package/nav-manifest.json +44 -0
  163. package/package.json +119 -0
  164. package/src/analytics/generated/events.json +7 -0
  165. package/src/api/categoriesApi.ts +179 -0
  166. package/src/api/generated/schema.ts +2323 -0
  167. package/src/api/types.ts +99 -0
  168. package/src/catalog/labels.ts +129 -0
  169. package/src/catalog/pks.ts +35 -0
  170. package/src/catalog/sync.ts +169 -0
  171. package/src/catalog/tree.ts +242 -0
  172. package/src/default/CatalogPage.tsx +40 -0
  173. package/src/default/CategoryBreadcrumbsBar.tsx +93 -0
  174. package/src/default/CategoryCarouselStrip.tsx +102 -0
  175. package/src/default/CategoryFeatureList.tsx +125 -0
  176. package/src/default/CategoryPage.tsx +114 -0
  177. package/src/default/CategoryPickerField.tsx +173 -0
  178. package/src/default/CategoryTreePane.tsx +134 -0
  179. package/src/default/ErrorAlert.tsx +46 -0
  180. package/src/default/index.ts +36 -0
  181. package/src/default/theme.tsx +67 -0
  182. package/src/default/types.ts +12 -0
  183. package/src/headless/CategoriesProvider.tsx +20 -0
  184. package/src/headless/CategoryBreadcrumbs.tsx +78 -0
  185. package/src/headless/CategoryCarousel.tsx +80 -0
  186. package/src/headless/CategoryFeatures.tsx +100 -0
  187. package/src/headless/CategoryPicker.tsx +173 -0
  188. package/src/headless/CategoryTree.tsx +115 -0
  189. package/src/i18n/errorsMap.ts +46 -0
  190. package/src/i18n/es.ts +92 -0
  191. package/src/i18n/generated/errors.es.gen.ts +64 -0
  192. package/src/i18n/generated/errors.gen.ts +238 -0
  193. package/src/i18n/generated/errors.json +495 -0
  194. package/src/i18n/generated/errors.ru.gen.ts +64 -0
  195. package/src/i18n/keys.ts +156 -0
  196. package/src/i18n/ru.ts +110 -0
  197. package/src/index.ts +191 -0
  198. package/src/model/catalogStore.ts +102 -0
  199. package/src/model/catalogSync.ts +115 -0
  200. package/src/model/context.tsx +28 -0
  201. package/src/model/queries.ts +226 -0
  202. package/src/model/queryKeys.ts +50 -0
  203. package/src/model/runtime.ts +39 -0
  204. package/src/nav/manifest.ts +66 -0
  205. package/tsconfig.json +26 -0
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Empty, Flex, List, Spin, Tag, Typography } from "antd";
3
+ import { matchList, toFlowError, useDescribeFlowError, useT } from "@stapel/core";
4
+ import { BUILTIN_VALUE_EDITOR_TYPES } from "@stapel/attributes-react/default";
5
+ import { renderCategoryLabel } from "../catalog/labels.js";
6
+ import { CategoryFeatures } from "../headless/CategoryFeatures.js";
7
+ import { CATEGORIES_I18N_KEYS } from "../i18n/keys.js";
8
+ import { ErrorAlert } from "./ErrorAlert.js";
9
+ import { CategoriesSkinTheme } from "./theme.js";
10
+ export function CategoryFeatureList(props) {
11
+ const t = useT();
12
+ const describe = useDescribeFlowError();
13
+ const drawable = new Set(BUILTIN_VALUE_EDITOR_TYPES);
14
+ return (_jsx(CategoriesSkinTheme, { ...(props.mode !== undefined ? { mode: props.mode } : {}), children: _jsx(CategoryFeatures, { categoryId: props.categoryId, children: (bag) => (_jsxs(Flex, { vertical: true, gap: 8, "data-testid": "categories-features", children: [_jsx(Typography.Title, { level: 5, style: { margin: 0 }, children: t(CATEGORIES_I18N_KEYS.featuresTitle) }), matchList(bag.state, {
15
+ loading: () => (_jsx(Flex, { justify: "center", style: { padding: 16 }, children: _jsx(Spin, { "data-testid": "categories-features-loading" }) })),
16
+ failed: (error) => (_jsx(ErrorAlert, { testId: "categories-features-failed", error: {
17
+ ...describe(toFlowError(error)),
18
+ message: t(CATEGORIES_I18N_KEYS.featuresLoadFailed),
19
+ } })),
20
+ empty: () => (_jsx(Empty, { "data-testid": "categories-features-empty", description: t(CATEGORIES_I18N_KEYS.featuresEmpty) })),
21
+ ready: (entries) => (_jsx(List, { "data-testid": "categories-features-list", size: "small", dataSource: [...entries], renderItem: (entry) => (_jsx(List.Item, { "data-feature-slug": entry.feature.slug, children: _jsxs(Flex, { justify: "space-between", align: "center", gap: 8, style: { width: "100%" }, children: [_jsx(Typography.Text, { children: renderCategoryLabel(entry.label, t) }), _jsxs(Flex, { gap: 4, align: "center", children: [entry.mandatory ? (_jsx(Tag, { color: "red", children: t(CATEGORIES_I18N_KEYS.featuresMandatory) })) : null, entry.type === undefined ? (_jsx(Tag, { color: "warning", "data-feature-untyped": true, children: t(CATEGORIES_I18N_KEYS.featuresUntyped) })) : (_jsx(Tag, { ...(drawable.has(entry.type)
22
+ ? {}
23
+ : { color: "warning" }), "data-feature-type": entry.type, children: t(CATEGORIES_I18N_KEYS.featuresType, {
24
+ type: entry.type,
25
+ }) }))] })] }) }, entry.feature.slug)) })),
26
+ })] })) }) }));
27
+ }
28
+ //# sourceMappingURL=CategoryFeatureList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryFeatureList.js","sourceRoot":"","sources":["../../src/default/CategoryFeatureList.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAA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AE;wDACpC,IAAI,EAAE,KAAK,CAAC,IAAI;qDACjB,CAAC,GACE,CACP,IACI,IACF,IAnCF,KAAK,CAAC,OAAO,CAAC,IAAI,CAoCb,CACb,GACD,CACH;qBACF,CAAC,IACG,CACR,GACgB,GACC,CACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `<CategoryPage>` — the `/c/:slug` screen: breadcrumbs, sub-categories, and a
3
+ * SLOT where the listings go.
4
+ *
5
+ * The slot is the whole design. Spec §5.1 makes this route "categories +
6
+ * search": the sub-category menu comes from here, the results with facets come
7
+ * from `@stapel/search-react`. A pair may not import another L2 pair
8
+ * (dependency direction is strictly downward), and a screen that rendered only
9
+ * half of itself would be useless — so the half this pair does not own is a
10
+ * render prop, handed the resolved category. The container writes one line:
11
+ *
12
+ * ```tsx
13
+ * <CategoryPage
14
+ * slug={slug}
15
+ * renderListings={(category) => (
16
+ * <SearchPage adapter={useRouterSearchParams()} defaultType="listing"
17
+ * fixedCategory={category.id} />
18
+ * )}
19
+ * />
20
+ * ```
21
+ *
22
+ * `slug` resolution happens against the synced tree because the SERVER cannot
23
+ * do it (`nav/manifest.ts`, `catalog/tree.ts`). Until the catalogue has
24
+ * loaded, an unknown slug is not yet unknown — the "no category here" line is
25
+ * shown only once the sync succeeded, so a slow network never renders a 404
26
+ * for a page that exists.
27
+ */
28
+ import type { ReactElement, ReactNode } from "react";
29
+ import type { Category } from "../api/types.js";
30
+ import type { ThemeModeProp } from "./types.js";
31
+ export interface CategoryPageProps extends ThemeModeProp {
32
+ /** The `:slug` segment of `/c/:slug`. */
33
+ readonly slug: string;
34
+ readonly basePath?: string;
35
+ /** The listings half of the screen — supplied by the container, because it
36
+ * belongs to another pair. */
37
+ readonly renderListings?: (category: Category) => ReactNode;
38
+ /** Show the category's feature schema. Off by default: on a storefront the
39
+ * schema is the facet panel's input, not a visitor-facing table. */
40
+ readonly showFeatures?: boolean;
41
+ }
42
+ export declare function CategoryPage(props: CategoryPageProps): ReactElement;
43
+ //# sourceMappingURL=CategoryPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryPage.d.ts","sourceRoot":"","sources":["../../src/default/CategoryPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAShD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;kCAC8B;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC;IAC5D;wEACoE;IACpE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA4DnE"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Empty, Flex, Spin, Typography } from "antd";
3
+ import { toFlowError, useDescribeFlowError, useT } from "@stapel/core";
4
+ import { categoryLabel, renderCategoryLabel } from "../catalog/labels.js";
5
+ import { CategoryTree } from "../headless/CategoryTree.js";
6
+ import { CATEGORIES_I18N_KEYS } from "../i18n/keys.js";
7
+ import { CategoryBreadcrumbsBar } from "./CategoryBreadcrumbsBar.js";
8
+ import { CategoryFeatureList } from "./CategoryFeatureList.js";
9
+ import { CategoryTreePane } from "./CategoryTreePane.js";
10
+ import { ErrorAlert } from "./ErrorAlert.js";
11
+ import { CategoriesSkinTheme } from "./theme.js";
12
+ export function CategoryPage(props) {
13
+ const t = useT();
14
+ const describe = useDescribeFlowError();
15
+ const base = props.basePath ?? "/c";
16
+ return (_jsx(CategoriesSkinTheme, { ...(props.mode !== undefined ? { mode: props.mode } : {}), children: _jsx(CategoryTree, { slug: props.slug, children: (bag) => (_jsxs(Flex, { vertical: true, gap: 16, "data-testid": "categories-category-page", children: [_jsx(CategoryBreadcrumbsBar, { slug: props.slug, basePath: base }), bag.catalog.status === "loading" ? (_jsx(Flex, { justify: "center", style: { padding: 16 }, children: _jsx(Spin, { "data-testid": "categories-category-loading" }) })) : bag.catalog.status === "failed" ? (_jsx(ErrorAlert, { testId: "categories-category-failed", error: {
17
+ ...describe(toFlowError(bag.catalog.error)),
18
+ message: t(CATEGORIES_I18N_KEYS.catalogLoadFailed),
19
+ } })) : bag.current === null ? (_jsx(Empty, { "data-testid": "categories-category-unknown", description: t(CATEGORIES_I18N_KEYS.categoryUnknownSlug) })) : (_jsxs(_Fragment, { children: [_jsx(Typography.Title, { level: 3, style: { margin: 0 }, children: renderCategoryLabel(categoryLabel(bag.current.category), t) }), bag.current.children.length > 0 ? (_jsx(CategoryTreePane, { slug: props.slug, basePath: base, titleKey: CATEGORIES_I18N_KEYS.categorySubcategories })) : null, props.showFeatures === true ? (_jsx(CategoryFeatureList, { categoryId: bag.current.id })) : null, props.renderListings?.(bag.current.category)] }))] })) }) }));
20
+ }
21
+ //# sourceMappingURL=CategoryPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryPage.js","sourceRoot":"","sources":["../../src/default/CategoryPage.tsx"],"names":[],"mappings":";AA4BA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,YAAY,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AC,CACpC,KAAC,UAAU,IACT,MAAM,EAAC,4BAA4B,EACnC,KAAK,EAAE;4BACL,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;4BAC3C,OAAO,EAAE,CAAC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;yBACnD,GACD,CACH,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CACzB,KAAC,KAAK,mBACQ,6BAA6B,EACzC,WAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,GACxD,CACH,CAAC,CAAC,CAAC,CACF,8BACE,KAAC,UAAU,CAAC,KAAK,IAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAC7C,mBAAmB,CAClB,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnC,CAAC,CACF,GACgB,EAElB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACjC,KAAC,gBAAgB,IACf,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,oBAAoB,CAAC,qBAAqB,GACpD,CACH,CAAC,CAAC,CAAC,IAAI,EAEP,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,CAC7B,KAAC,mBAAmB,IAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,GAAI,CACpD,CAAC,CAAC,CAAC,IAAI,EAEP,KAAK,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,IAC5C,CACJ,IACI,CACR,GACY,GACK,CACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `<CategoryPickerField>` — the compose form's category chooser.
3
+ *
4
+ * Drill down or search; either way the options come out of the tree that is
5
+ * already in memory, so typing does not issue a request per keystroke and the
6
+ * whole control works offline once the catalogue has synced.
7
+ *
8
+ * The blocked state carries its reason, always. `ActionAvailability`'s rule is
9
+ * that a disabled control must say why, and this control has two different
10
+ * whys — nothing chosen yet, versus a chosen category that still has
11
+ * sub-categories. The second one matters more than it looks: filing a listing
12
+ * under "Electronics" instead of "Electronics › Phones" inherits a different
13
+ * feature set, so the form then asks the wrong questions and the server
14
+ * refuses a field the person never saw.
15
+ */
16
+ import type { ReactElement } from "react";
17
+ import type { CategoryNode } from "../catalog/tree.js";
18
+ import type { ThemeModeProp } from "./types.js";
19
+ export interface CategoryPickerFieldProps extends ThemeModeProp {
20
+ readonly value?: number | null;
21
+ readonly onChange?: (id: number | null, node: CategoryNode | null) => void;
22
+ /** Only leaf categories are valid. Default `true`. */
23
+ readonly leavesOnly?: boolean;
24
+ }
25
+ export declare function CategoryPickerField(props: CategoryPickerFieldProps): ReactElement;
26
+ //# sourceMappingURL=CategoryPickerField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryPickerField.d.ts","sourceRoot":"","sources":["../../src/default/CategoryPickerField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAOhD,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3E,sDAAsD;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,YAAY,CAmId"}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert, Breadcrumb, Button, Empty, Flex, Input, List, Spin } from "antd";
3
+ import { matchList, toFlowError, useDescribeFlowError, useT } from "@stapel/core";
4
+ import { categoryLabel, renderCategoryLabel } from "../catalog/labels.js";
5
+ import { CategoryPicker } from "../headless/CategoryPicker.js";
6
+ import { CATEGORIES_I18N_KEYS } from "../i18n/keys.js";
7
+ import { ErrorAlert } from "./ErrorAlert.js";
8
+ import { CategoriesSkinTheme } from "./theme.js";
9
+ const BLOCKED_KEY = {
10
+ nothing_selected: CATEGORIES_I18N_KEYS.pickerBlockedNothingSelected,
11
+ not_a_leaf: CATEGORIES_I18N_KEYS.pickerBlockedNotALeaf,
12
+ };
13
+ export function CategoryPickerField(props) {
14
+ const t = useT();
15
+ const describe = useDescribeFlowError();
16
+ return (_jsx(CategoriesSkinTheme, { ...(props.mode !== undefined ? { mode: props.mode } : {}), children: _jsx(CategoryPicker, { ...(props.value !== undefined ? { value: props.value } : {}), ...(props.onChange !== undefined ? { onChange: props.onChange } : {}), ...(props.leavesOnly !== undefined
17
+ ? { leavesOnly: props.leavesOnly }
18
+ : {}), translate: t, children: (bag) => (_jsxs(Flex, { vertical: true, gap: 8, "data-testid": "categories-picker", children: [_jsx(Input, { allowClear: true, value: bag.query, placeholder: t(CATEGORIES_I18N_KEYS.pickerSearch), "aria-label": t(CATEGORIES_I18N_KEYS.pickerSearch), "data-testid": "categories-picker-search", onChange: (event) => {
19
+ bag.setQuery(event.target.value);
20
+ } }), bag.query === "" && bag.path.length > 0 ? (_jsxs(Flex, { align: "center", gap: 8, children: [_jsx(Button, { size: "small", "data-testid": "categories-picker-up", "data-analytics": "none", "data-analytics-reason": "walking the local tree is a read; nothing leaves the browser", onClick: bag.up, children: t(CATEGORIES_I18N_KEYS.pickerUp) }), _jsx(Breadcrumb, { items: bag.path.map((node) => ({
21
+ title: renderCategoryLabel(categoryLabel(node.category), t),
22
+ })) })] })) : null, matchList(bag.state, {
23
+ loading: () => (_jsx(Flex, { justify: "center", style: { padding: 16 }, children: _jsx(Spin, { "data-testid": "categories-picker-loading" }) })),
24
+ failed: (error) => (_jsx(ErrorAlert, { testId: "categories-picker-failed", error: {
25
+ ...describe(toFlowError(error)),
26
+ message: t(CATEGORIES_I18N_KEYS.pickerLoadFailed),
27
+ } })),
28
+ empty: () => (_jsx(Empty, { "data-testid": "categories-picker-empty", description: t(bag.query === ""
29
+ ? CATEGORIES_I18N_KEYS.categoryNoSubcategories
30
+ : CATEGORIES_I18N_KEYS.pickerNoMatches) })),
31
+ ready: (options) => (_jsx(List, { "data-testid": "categories-picker-list", size: "small", dataSource: [...options], renderItem: (option) => (_jsx(List.Item, { "data-category-id": option.node.id, children: _jsx(Button, { type: "link", "data-testid": `categories-picker-option-${String(option.node.id)}`, "data-analytics": "none", "data-analytics-reason": "drilling into the local tree is a read; the host tracks the SUBMIT that consumes the chosen category", onClick: () => {
32
+ bag.open(option.node);
33
+ }, children: renderCategoryLabel(option.label, t) }) }, option.node.id)) })),
34
+ }), bag.submitBlockedReason !== null ? (_jsx(Alert, { type: "info", showIcon: true, "data-testid": "categories-picker-blocked", message: t(BLOCKED_KEY[bag.submitBlockedReason]) })) : (_jsx(Alert, { type: "success", showIcon: true, "data-testid": "categories-picker-selected", message: t(CATEGORIES_I18N_KEYS.pickerSelected, {
35
+ category: bag.selected === null
36
+ ? ""
37
+ : renderCategoryLabel(categoryLabel(bag.selected.category), t),
38
+ }) }))] })) }) }));
39
+ }
40
+ //# sourceMappingURL=CategoryPickerField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryPickerField.js","sourceRoot":"","sources":["../../src/default/CategoryPickerField.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,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AC,KAAK,IACJ,IAAI,EAAC,MAAM,EACX,QAAQ,uBACI,2BAA2B,EACvC,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,GAChD,CACH,CAAC,CAAC,CAAC,CACF,KAAC,KAAK,IACJ,IAAI,EAAC,SAAS,EACd,QAAQ,uBACI,4BAA4B,EACxC,OAAO,EAAE,CAAC,CAAC,oBAAoB,CAAC,cAAc,EAAE;4BAC9C,QAAQ,EACN,GAAG,CAAC,QAAQ,KAAK,IAAI;gCACnB,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC,mBAAmB,CACjB,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACpC,CAAC,CACF;yBACR,CAAC,GACF,CACH,IACI,CACR,GACc,GACG,CACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `<CategoryTreePane>` — one level of the catalogue as a list of links.
3
+ *
4
+ * The four arms of `matchList` are the point of this file, not decoration:
5
+ * "still syncing", "the sync failed", "this category has no sub-categories"
6
+ * and "here they are" are four different sentences, and the third is the one a
7
+ * leaf category legitimately gets. Collapsing any two is the incident
8
+ * `@stapel/core`'s `loadState.ts` was written for.
9
+ *
10
+ * A fifth condition rides alongside them: `truncated`. The sync walk hit its
11
+ * page budget, so what is on screen is a PARTIAL catalogue — which is neither
12
+ * an empty one nor a failed one, and gets its own line rather than being
13
+ * silently indistinguishable from a complete tree.
14
+ */
15
+ import type { ReactElement } from "react";
16
+ import type { ThemeModeProp } from "./types.js";
17
+ export interface CategoryTreePaneProps extends ThemeModeProp {
18
+ /** Render this category's children. Omitted renders the roots. */
19
+ readonly parentId?: number | null;
20
+ /** Render the children of the category at this slug (the `/c/:slug` page). */
21
+ readonly slug?: string;
22
+ /** Path prefix for a row's link. Default `/c`. */
23
+ readonly basePath?: string;
24
+ /** Heading above the list. Omitted renders no heading. */
25
+ readonly titleKey?: string;
26
+ }
27
+ export declare function CategoryTreePane(props: CategoryTreePaneProps): ReactElement;
28
+ //# sourceMappingURL=CategoryTreePane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryTreePane.d.ts","sourceRoot":"","sources":["../../src/default/CategoryTreePane.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAS1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAiG3E"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert, Badge, Empty, Flex, List, Spin, Typography } from "antd";
3
+ import { matchList, toFlowError, useDescribeFlowError, useT } from "@stapel/core";
4
+ import { categoryLabel, renderCategoryLabel } from "../catalog/labels.js";
5
+ import { CategoryTree } from "../headless/CategoryTree.js";
6
+ import { CATEGORIES_I18N_KEYS } from "../i18n/keys.js";
7
+ import { ErrorAlert } from "./ErrorAlert.js";
8
+ import { CategoriesSkinTheme } from "./theme.js";
9
+ export function CategoryTreePane(props) {
10
+ const t = useT();
11
+ const describe = useDescribeFlowError();
12
+ const base = props.basePath ?? "/c";
13
+ return (_jsx(CategoriesSkinTheme, { ...(props.mode !== undefined ? { mode: props.mode } : {}), children: _jsx(CategoryTree, { ...(props.parentId !== undefined ? { parentId: props.parentId } : {}), ...(props.slug !== undefined ? { slug: props.slug } : {}), children: (bag) => (_jsxs(Flex, { vertical: true, gap: 8, "data-testid": "categories-tree", children: [props.titleKey !== undefined ? (_jsx(Typography.Title, { level: 5, style: { margin: 0 }, children: t(props.titleKey) })) : null, bag.truncated ? (_jsx(Alert, { type: "warning", showIcon: true, "data-testid": "categories-tree-truncated", message: t(CATEGORIES_I18N_KEYS.catalogTruncated) })) : null, matchList(bag.state, {
14
+ loading: () => (_jsx(Flex, { justify: "center", style: { padding: 16 }, children: _jsx(Spin, { "data-testid": "categories-tree-loading" }) })),
15
+ failed: (error) => (_jsx(ErrorAlert, { testId: "categories-tree-failed", error: {
16
+ ...describe(toFlowError(error)),
17
+ message: t(CATEGORIES_I18N_KEYS.catalogLoadFailed),
18
+ } })),
19
+ empty: () => (_jsx(Empty, { "data-testid": "categories-tree-empty", description: t(bag.current === null
20
+ ? CATEGORIES_I18N_KEYS.catalogEmpty
21
+ : CATEGORIES_I18N_KEYS.categoryNoSubcategories) })),
22
+ ready: (nodes) => (_jsx(List, { "data-testid": "categories-tree-list", size: "small", dataSource: [...nodes], renderItem: (node) => (_jsx(List.Item, { "data-category-id": node.id, children: _jsxs(Flex, { justify: "space-between", align: "center", gap: 8, style: { width: "100%" }, children: [_jsx(Typography.Link, { href: `${base}/${node.category.slug}`, "data-category-slug": node.category.slug, children: renderCategoryLabel(categoryLabel(node.category), t) }), node.children.length > 0 ? (_jsx(Badge, { count: node.children.length, color: "blue", title: t(CATEGORIES_I18N_KEYS.categorySubcategories) })) : null] }) }, node.id)) })),
23
+ })] })) }) }));
24
+ }
25
+ //# sourceMappingURL=CategoryTreePane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryTreePane.js","sourceRoot":"","sources":["../../src/default/CategoryTreePane.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE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AC,CACpB,KAAC,IAAI,CAAC,IAAI,wBAAiC,IAAI,CAAC,EAAE,YAChD,MAAC,IAAI,IACH,OAAO,EAAC,eAAe,EACvB,KAAK,EAAC,QAAQ,EACd,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,aAExB,KAAC,UAAU,CAAC,IAAI,IACd,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,wBACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,YAErC,mBAAmB,CAClB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC5B,CAAC,CACF,GACe,EACjB,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAC1B,KAAC,KAAK,IACJ,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC3B,KAAK,EAAC,MAAM,EACZ,KAAK,EAAE,CAAC,CACN,oBAAoB,CAAC,qBAAqB,CAC3C,GACD,CACH,CAAC,CAAC,CAAC,IAAI,IACH,IAzBO,IAAI,CAAC,EAAE,CA0BX,CACb,GACD,CACH;qBACF,CAAC,IACG,CACR,GACY,GACK,CACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { CSSProperties, ReactElement, ReactNode } from "react";
2
+ import type { FlowErrorDisplay } from "@stapel/core";
3
+ export declare function ErrorAlert(props: {
4
+ error: FlowErrorDisplay | undefined;
5
+ style?: CSSProperties | undefined;
6
+ testId?: string | undefined;
7
+ action?: ReactNode;
8
+ }): ReactElement | null;
9
+ //# sourceMappingURL=ErrorAlert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../src/default/ErrorAlert.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,GAAG,YAAY,GAAG,IAAI,CAsBtB"}
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The one error surface this pair's default skin renders, so the split copy
4
+ * core produces reaches a screen the same way everywhere (mirrors the
5
+ * docs/notifications/workspaces etalon).
6
+ *
7
+ * Core's `describeFlowError` splits a failure into the sentence a person
8
+ * reads and the technical detail a support agent quotes (owner report
9
+ * 2026-08-09: the status used to be spliced into the sentence, ending in a
10
+ * bare `" (500)"`). The split only helps if a skin renders both halves at
11
+ * their own weights: `message` at normal weight, `detail` muted and small.
12
+ *
13
+ * `undefined` in — including a `detail` core left `undefined` because there
14
+ * was nothing worth quoting — renders nothing rather than an empty line.
15
+ */
16
+ import { Alert, Typography } from "antd";
17
+ export function ErrorAlert(props) {
18
+ const { error } = props;
19
+ if (!error)
20
+ return null;
21
+ return (_jsx(Alert, { type: "error", showIcon: true, ...(props.style ? { style: props.style } : {}), ...(props.testId ? { "data-testid": props.testId } : {}), ...(props.action ? { action: props.action } : {}), message: error.message, ...(error.detail
22
+ ? {
23
+ description: (_jsx(Typography.Text, { type: "secondary", style: { fontSize: 12 }, children: error.detail })),
24
+ }
25
+ : {}) }));
26
+ }
27
+ //# sourceMappingURL=ErrorAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorAlert.js","sourceRoot":"","sources":["../../src/default/ErrorAlert.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIzC,MAAM,UAAU,UAAU,CAAC,KAK1B;IACC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO,CACL,KAAC,KAAK,IACJ,IAAI,EAAC,OAAO,EACZ,QAAQ,WACJ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAC3C,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACrD,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAClD,OAAO,EAAE,KAAK,CAAC,OAAO,KAClB,CAAC,KAAK,CAAC,MAAM;YACf,CAAC,CAAC;gBACE,WAAW,EAAE,CACX,KAAC,UAAU,CAAC,IAAI,IAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,YACtD,KAAK,CAAC,MAAM,GACG,CACnB;aACF;YACH,CAAC,CAAC,EAAE,CAAC,GACP,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `@stapel/categories-react/default` — the antd skin over the headless pair.
3
+ *
4
+ * A separate entry point (the convention every pair's `/default` follows) so a
5
+ * host rendering its own catalogue chrome never pulls `antd` into its bundle.
6
+ * The main entry has no visual opinion at all and no import path from it
7
+ * reaches this directory — size-limit and the bundle-purity test are the
8
+ * teeth on that.
9
+ *
10
+ * ```tsx
11
+ * import { createCategoriesRuntime, CategoriesProvider } from "@stapel/categories-react";
12
+ * import { CatalogPage, CategoryPage } from "@stapel/categories-react/default";
13
+ * ```
14
+ *
15
+ * `CategoryPage` takes `renderListings` — the half of `/c/:slug` that belongs
16
+ * to `@stapel/search-react`, handed in by the container rather than imported
17
+ * across the L2 layer.
18
+ */
19
+ export { CatalogPage } from "./CatalogPage.js";
20
+ export type { CatalogPageProps } from "./CatalogPage.js";
21
+ export { CategoryPage } from "./CategoryPage.js";
22
+ export type { CategoryPageProps } from "./CategoryPage.js";
23
+ export { CategoryTreePane } from "./CategoryTreePane.js";
24
+ export type { CategoryTreePaneProps } from "./CategoryTreePane.js";
25
+ export { CategoryBreadcrumbsBar } from "./CategoryBreadcrumbsBar.js";
26
+ export type { CategoryBreadcrumbsBarProps } from "./CategoryBreadcrumbsBar.js";
27
+ export { CategoryCarouselStrip } from "./CategoryCarouselStrip.js";
28
+ export type { CategoryCarouselStripProps } from "./CategoryCarouselStrip.js";
29
+ export { CategoryPickerField } from "./CategoryPickerField.js";
30
+ export type { CategoryPickerFieldProps } from "./CategoryPickerField.js";
31
+ export { CategoryFeatureList } from "./CategoryFeatureList.js";
32
+ export type { CategoryFeatureListProps } from "./CategoryFeatureList.js";
33
+ export { CategoriesSkinTheme } from "./theme.js";
34
+ export type { CategoriesSkinThemeProps } from "./theme.js";
35
+ export { ErrorAlert } from "./ErrorAlert.js";
36
+ export type { ThemeModeProp } from "./types.js";
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `@stapel/categories-react/default` — the antd skin over the headless pair.
3
+ *
4
+ * A separate entry point (the convention every pair's `/default` follows) so a
5
+ * host rendering its own catalogue chrome never pulls `antd` into its bundle.
6
+ * The main entry has no visual opinion at all and no import path from it
7
+ * reaches this directory — size-limit and the bundle-purity test are the
8
+ * teeth on that.
9
+ *
10
+ * ```tsx
11
+ * import { createCategoriesRuntime, CategoriesProvider } from "@stapel/categories-react";
12
+ * import { CatalogPage, CategoryPage } from "@stapel/categories-react/default";
13
+ * ```
14
+ *
15
+ * `CategoryPage` takes `renderListings` — the half of `/c/:slug` that belongs
16
+ * to `@stapel/search-react`, handed in by the container rather than imported
17
+ * across the L2 layer.
18
+ */
19
+ export { CatalogPage } from "./CatalogPage.js";
20
+ export { CategoryPage } from "./CategoryPage.js";
21
+ export { CategoryTreePane } from "./CategoryTreePane.js";
22
+ export { CategoryBreadcrumbsBar } from "./CategoryBreadcrumbsBar.js";
23
+ export { CategoryCarouselStrip } from "./CategoryCarouselStrip.js";
24
+ export { CategoryPickerField } from "./CategoryPickerField.js";
25
+ export { CategoryFeatureList } from "./CategoryFeatureList.js";
26
+ export { CategoriesSkinTheme } from "./theme.js";
27
+ export { ErrorAlert } from "./ErrorAlert.js";
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { CSSProperties, ReactElement, ReactNode } from "react";
2
+ import type { ThemeMode } from "@stapel/tokens-antd";
3
+ export interface CategoriesSkinThemeProps {
4
+ /**
5
+ * Light or dark. Defaults to the mode the host's document declares
6
+ * (`resolveThemeMode()`). Pass explicitly to pin a side.
7
+ */
8
+ readonly mode?: ThemeMode;
9
+ /** Extra styles merged onto the themed root element (layout only — colors
10
+ * come from the mode). */
11
+ readonly style?: CSSProperties;
12
+ readonly children: ReactNode;
13
+ }
14
+ /**
15
+ * `<CategoriesSkinTheme/>` — the self-theming wrapper of
16
+ * `@stapel/categories-react/default`. Standalone use is supported (wrap any
17
+ * composition of the skin's parts once); the shipped surfaces
18
+ * (`CatalogPage`, `CategoryPage`, `CategoryTreePane`, `CategoryCarouselStrip`,
19
+ * `CategoryPickerField`, `CategoryFeatureList`, `CategoryBreadcrumbsBar`)
20
+ * each already wrap themselves, and nested antd
21
+ * `ConfigProvider`s merge, so composing them under one `CategoriesSkinTheme`
22
+ * stays correct.
23
+ */
24
+ export declare function CategoriesSkinTheme(props: CategoriesSkinThemeProps): ReactElement;
25
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/default/theme.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B;8BAC0B;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CAmBjF"}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The default skin's INTERNAL theme provider — every `/default` surface wraps
4
+ * itself in this, so the skin is readable no matter what the host supplies
5
+ * (tracker #26: a skin set with no internal provider once inherited a theme
6
+ * bridge serving light-mode values inside a dark document — text on
7
+ * background at 1.00:1). The theme derives from `@stapel/tokens` via
8
+ * `@stapel/tokens-antd`'s `toAntdThemeConfig(mode)`; `mode` defaults to what
9
+ * the HOST's document declares (`resolveThemeMode()` — the `data-theme`
10
+ * attribute `tokens.css` keys its dark block on), never to a hardcoded side.
11
+ *
12
+ * This is also what "override styles" means for this pair: a storefront
13
+ * retheming through the §68 token JSON regenerates its `--stapel-*` custom
14
+ * properties and the result page follows with zero code — a far better deal
15
+ * than a prop-per-colour API, and the reason the skin has none.
16
+ */
17
+ import { useMemo } from "react";
18
+ import { ConfigProvider } from "antd";
19
+ import { resolveThemeMode, toAntdTheme, toAntdThemeConfig, } from "@stapel/tokens-antd";
20
+ /**
21
+ * `<CategoriesSkinTheme/>` — the self-theming wrapper of
22
+ * `@stapel/categories-react/default`. Standalone use is supported (wrap any
23
+ * composition of the skin's parts once); the shipped surfaces
24
+ * (`CatalogPage`, `CategoryPage`, `CategoryTreePane`, `CategoryCarouselStrip`,
25
+ * `CategoryPickerField`, `CategoryFeatureList`, `CategoryBreadcrumbsBar`)
26
+ * each already wrap themselves, and nested antd
27
+ * `ConfigProvider`s merge, so composing them under one `CategoriesSkinTheme`
28
+ * stays correct.
29
+ */
30
+ export function CategoriesSkinTheme(props) {
31
+ const mode = props.mode ?? resolveThemeMode();
32
+ const theme = useMemo(() => toAntdThemeConfig(mode), [mode]);
33
+ const token = useMemo(() => toAntdTheme(mode), [mode]);
34
+ return (_jsx(ConfigProvider, { theme: theme, children: _jsx("div", { "data-categories-skin-root": true, "data-categories-skin-mode": mode, style: {
35
+ color: token.colorText,
36
+ backgroundColor: token.colorBgContainer,
37
+ ...props.style,
38
+ }, children: props.children }) }));
39
+ }
40
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/default/theme.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAe7B;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,gBAAgB,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,YAC1B,8EAE6B,IAAI,EAC/B,KAAK,EAAE;gBACL,KAAK,EAAE,KAAK,CAAC,SAAS;gBACtB,eAAe,EAAE,KAAK,CAAC,gBAAgB;gBACvC,GAAG,KAAK,CAAC,KAAK;aACf,YAEA,KAAK,CAAC,QAAQ,GACX,GACS,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Small shared types for the `/default` skin — kept in one place so every
3
+ * surface takes the same `mode` prop and re-exports the same error dialect.
4
+ */
5
+ export type { FlowError } from "@stapel/core";
6
+ import type { ThemeMode } from "@stapel/tokens-antd";
7
+ /** Every `/default` surface accepts a theme mode; absent means "whatever the
8
+ * host document declares" (`resolveThemeMode()`), never a hardcoded side. */
9
+ export interface ThemeModeProp {
10
+ readonly mode?: ThemeMode;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/default/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD;6EAC6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/default/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import type { CategoriesRuntime } from "../model/runtime.js";
3
+ /**
4
+ * Provides the wired {@link CategoriesRuntime} to every categories hook and
5
+ * headless component below it. Bring your own visual shell — this component
6
+ * renders nothing of its own. (Core's `createModuleContext` provider, bound to
7
+ * this pair — slim wave §21/S2.)
8
+ *
9
+ * ```tsx
10
+ * const runtime = createCategoriesRuntime({ baseUrl: "/categories/api/v1/" });
11
+ * // give runtime.client to core's <StapelConfigProvider config={{ client }}>
12
+ * <CategoriesProvider runtime={runtime}>{app}</CategoriesProvider>
13
+ * ```
14
+ */
15
+ export declare const CategoriesProvider: (props: {
16
+ runtime: CategoriesRuntime;
17
+ children: ReactNode;
18
+ }) => ReactElement;
19
+ //# sourceMappingURL=CategoriesProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoriesProvider.d.ts","sourceRoot":"","sources":["../../src/headless/CategoriesProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,KAAK,EAAE;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACrB,KAAK,YAA6B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { ModuleProvider } from "../model/context.js";
2
+ /**
3
+ * Provides the wired {@link CategoriesRuntime} to every categories hook and
4
+ * headless component below it. Bring your own visual shell — this component
5
+ * renders nothing of its own. (Core's `createModuleContext` provider, bound to
6
+ * this pair — slim wave §21/S2.)
7
+ *
8
+ * ```tsx
9
+ * const runtime = createCategoriesRuntime({ baseUrl: "/categories/api/v1/" });
10
+ * // give runtime.client to core's <StapelConfigProvider config={{ client }}>
11
+ * <CategoriesProvider runtime={runtime}>{app}</CategoriesProvider>
12
+ * ```
13
+ */
14
+ export const CategoriesProvider = ModuleProvider;
15
+ //# sourceMappingURL=CategoriesProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoriesProvider.js","sourceRoot":"","sources":["../../src/headless/CategoriesProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAGV,cAAc,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from "react";
2
+ import type { LoadState } from "@stapel/core";
3
+ import type { CategoryNode } from "../catalog/tree.js";
4
+ import type { CategoryLabel } from "../catalog/labels.js";
5
+ import type { UseCategoryCatalogOptions } from "../model/queries.js";
6
+ /** One crumb: the node, and how its caption must be rendered. */
7
+ export interface CategoryCrumb {
8
+ readonly node: CategoryNode;
9
+ /** `kind: "key"` → run `value` through the host's `t`. See
10
+ * `catalog/labels.ts` — names on the wire are translation keys. */
11
+ readonly label: CategoryLabel;
12
+ /** `true` for the last crumb — the page you are on. */
13
+ readonly isCurrent: boolean;
14
+ }
15
+ export interface CategoryBreadcrumbsBag {
16
+ /**
17
+ * Root → current, inclusive. `empty` means the selected category IS a root
18
+ * (there is nothing above it), which is a different thing from a catalogue
19
+ * that has not loaded and from a slug that does not exist.
20
+ */
21
+ readonly state: LoadState<readonly CategoryCrumb[]>;
22
+ readonly unknownSlug: boolean;
23
+ refetch(): void;
24
+ }
25
+ export interface CategoryBreadcrumbsProps extends UseCategoryCatalogOptions {
26
+ slug?: string;
27
+ categoryId?: number | null;
28
+ children: (bag: CategoryBreadcrumbsBag) => ReactNode;
29
+ }
30
+ /**
31
+ * The ancestry of the current category, as data.
32
+ *
33
+ * Walks the BUILT index rather than `tn_ancestors_pks`: a crumb must name a
34
+ * category the visitor can actually open, and the built index is what the
35
+ * visitor is being shown. The server's own column is exposed separately
36
+ * (`categoryAncestorIds`) and the two are cross-checked in the suite, so a
37
+ * divergence is a red test rather than a link to nowhere.
38
+ */
39
+ export declare function CategoryBreadcrumbs(props: CategoryBreadcrumbsProps): ReactNode;
40
+ //# sourceMappingURL=CategoryBreadcrumbs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryBreadcrumbs.d.ts","sourceRoot":"","sources":["../../src/headless/CategoryBreadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAErE,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;uEACmE;IACnE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,CAAC,GAAG,EAAE,sBAAsB,KAAK,SAAS,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,SAAS,CA6BX"}