@hjmds/design-contracts 1.1.1 → 1.2.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 (194) hide show
  1. package/dist/agreement.d.ts +183 -0
  2. package/dist/agreement.d.ts.map +1 -0
  3. package/dist/agreement.js +137 -0
  4. package/dist/agreement.js.map +1 -0
  5. package/dist/anchor.d.ts +62 -0
  6. package/dist/anchor.d.ts.map +1 -0
  7. package/dist/anchor.js +43 -0
  8. package/dist/anchor.js.map +1 -0
  9. package/dist/asset.d.ts +94 -0
  10. package/dist/asset.d.ts.map +1 -0
  11. package/dist/asset.js +60 -0
  12. package/dist/asset.js.map +1 -0
  13. package/dist/base-recipes.d.ts +19 -0
  14. package/dist/base-recipes.d.ts.map +1 -1
  15. package/dist/base-recipes.js +17 -0
  16. package/dist/base-recipes.js.map +1 -1
  17. package/dist/behaviors.d.ts +346 -3
  18. package/dist/behaviors.d.ts.map +1 -1
  19. package/dist/behaviors.js +35 -1
  20. package/dist/behaviors.js.map +1 -1
  21. package/dist/bottom-info.d.ts +58 -0
  22. package/dist/bottom-info.d.ts.map +1 -0
  23. package/dist/bottom-info.js +48 -0
  24. package/dist/bottom-info.js.map +1 -0
  25. package/dist/carousel.d.ts +3 -3
  26. package/dist/carousel.js +1 -1
  27. package/dist/carousel.js.map +1 -1
  28. package/dist/catalog.d.ts +1250 -239
  29. package/dist/catalog.d.ts.map +1 -1
  30. package/dist/catalog.js +65 -25
  31. package/dist/catalog.js.map +1 -1
  32. package/dist/collapsible.d.ts +56 -0
  33. package/dist/collapsible.d.ts.map +1 -0
  34. package/dist/collapsible.js +37 -0
  35. package/dist/collapsible.js.map +1 -0
  36. package/dist/component-definitions.d.ts +16 -0
  37. package/dist/component-definitions.d.ts.map +1 -1
  38. package/dist/component-definitions.js +16 -0
  39. package/dist/component-definitions.js.map +1 -1
  40. package/dist/component-recipes.d.ts +20 -3
  41. package/dist/component-recipes.d.ts.map +1 -1
  42. package/dist/component-recipes.js +24 -1
  43. package/dist/component-recipes.js.map +1 -1
  44. package/dist/context-menu.d.ts +53 -0
  45. package/dist/context-menu.d.ts.map +1 -0
  46. package/dist/context-menu.js +44 -0
  47. package/dist/context-menu.js.map +1 -0
  48. package/dist/counter-badge-recipe.d.ts +5 -0
  49. package/dist/counter-badge-recipe.d.ts.map +1 -1
  50. package/dist/counter-badge-recipe.js +5 -0
  51. package/dist/counter-badge-recipe.js.map +1 -1
  52. package/dist/dataviz.d.ts +76 -0
  53. package/dist/dataviz.d.ts.map +1 -0
  54. package/dist/dataviz.js +58 -0
  55. package/dist/dataviz.js.map +1 -0
  56. package/dist/date-range.d.ts +56 -0
  57. package/dist/date-range.d.ts.map +1 -0
  58. package/dist/date-range.js +79 -0
  59. package/dist/date-range.js.map +1 -0
  60. package/dist/design-system-provider.d.ts +24 -0
  61. package/dist/design-system-provider.d.ts.map +1 -1
  62. package/dist/design-system-provider.js +21 -0
  63. package/dist/design-system-provider.js.map +1 -1
  64. package/dist/floating-action-button.d.ts +1 -1
  65. package/dist/floating-action-button.d.ts.map +1 -1
  66. package/dist/floating-action-button.js +3 -1
  67. package/dist/floating-action-button.js.map +1 -1
  68. package/dist/formatters.d.ts +37 -0
  69. package/dist/formatters.d.ts.map +1 -0
  70. package/dist/formatters.js +69 -0
  71. package/dist/formatters.js.map +1 -0
  72. package/dist/heading.d.ts +82 -0
  73. package/dist/heading.d.ts.map +1 -0
  74. package/dist/heading.js +48 -0
  75. package/dist/heading.js.map +1 -0
  76. package/dist/index.d.ts +19 -0
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +19 -0
  79. package/dist/index.js.map +1 -1
  80. package/dist/menubar.d.ts +133 -0
  81. package/dist/menubar.d.ts.map +1 -0
  82. package/dist/menubar.js +80 -0
  83. package/dist/menubar.js.map +1 -0
  84. package/dist/native-platform.d.ts +88 -0
  85. package/dist/native-platform.d.ts.map +1 -0
  86. package/dist/native-platform.js +70 -0
  87. package/dist/native-platform.js.map +1 -0
  88. package/dist/popover.d.ts +19 -4
  89. package/dist/popover.d.ts.map +1 -1
  90. package/dist/popover.js +3 -0
  91. package/dist/popover.js.map +1 -1
  92. package/dist/progress-recipe.d.ts +14 -0
  93. package/dist/progress-recipe.d.ts.map +1 -1
  94. package/dist/progress-recipe.js +14 -1
  95. package/dist/progress-recipe.js.map +1 -1
  96. package/dist/provider-button.d.ts +140 -0
  97. package/dist/provider-button.d.ts.map +1 -0
  98. package/dist/provider-button.js +83 -0
  99. package/dist/provider-button.js.map +1 -0
  100. package/dist/recipes.d.ts +15 -1
  101. package/dist/recipes.d.ts.map +1 -1
  102. package/dist/recipes.js +14 -0
  103. package/dist/recipes.js.map +1 -1
  104. package/dist/sheet.d.ts +16 -0
  105. package/dist/sheet.d.ts.map +1 -1
  106. package/dist/sheet.js +33 -0
  107. package/dist/sheet.js.map +1 -1
  108. package/dist/sidebar.d.ts +168 -0
  109. package/dist/sidebar.d.ts.map +1 -0
  110. package/dist/sidebar.js +98 -0
  111. package/dist/sidebar.js.map +1 -0
  112. package/dist/skip-nav.d.ts +67 -0
  113. package/dist/skip-nav.d.ts.map +1 -0
  114. package/dist/skip-nav.js +47 -0
  115. package/dist/skip-nav.js.map +1 -0
  116. package/dist/tags-input.d.ts +157 -0
  117. package/dist/tags-input.d.ts.map +1 -0
  118. package/dist/tags-input.js +108 -0
  119. package/dist/tags-input.js.map +1 -0
  120. package/dist/text-formats.d.ts +85 -0
  121. package/dist/text-formats.d.ts.map +1 -0
  122. package/dist/text-formats.js +43 -0
  123. package/dist/text-formats.js.map +1 -0
  124. package/dist/toggle-group.d.ts +111 -0
  125. package/dist/toggle-group.d.ts.map +1 -0
  126. package/dist/toggle-group.js +78 -0
  127. package/dist/toggle-group.js.map +1 -0
  128. package/dist/top.d.ts +113 -0
  129. package/dist/top.d.ts.map +1 -0
  130. package/dist/top.js +72 -0
  131. package/dist/top.js.map +1 -0
  132. package/dist/version.d.ts +1 -1
  133. package/dist/version.js +1 -1
  134. package/dist/version.js.map +1 -1
  135. package/docs/agreement.md +33 -0
  136. package/docs/anchor.md +59 -59
  137. package/docs/ant-design-coverage.md +5 -3
  138. package/docs/asset.md +26 -0
  139. package/docs/bottom-info.md +15 -0
  140. package/docs/breadcrumb.md +15 -15
  141. package/docs/button-label.md +20 -0
  142. package/docs/calendar.md +82 -154
  143. package/docs/carousel.md +27 -2
  144. package/docs/cascader.md +17 -0
  145. package/docs/chart.md +33 -0
  146. package/docs/clipboard.md +13 -0
  147. package/docs/collapsible.md +19 -0
  148. package/docs/command-palette.md +19 -0
  149. package/docs/confirm-popover.md +11 -1
  150. package/docs/context-menu.md +23 -0
  151. package/docs/data-table.md +22 -0
  152. package/docs/date-range.md +31 -0
  153. package/docs/density.md +23 -0
  154. package/docs/expansion-roadmap.md +16 -3
  155. package/docs/floating-action-button.md +35 -3
  156. package/docs/formatters.md +18 -0
  157. package/docs/generated/component-maturity.md +39 -23
  158. package/docs/generated/renderer-evidence.json +2921 -642
  159. package/docs/generated/renderer-evidence.md +53 -6
  160. package/docs/generated/showcase-manifest.json +1087 -64
  161. package/docs/heading.md +25 -0
  162. package/docs/identity.md +5 -0
  163. package/docs/layout.md +1 -1
  164. package/docs/library-gap-analysis.md +29 -9
  165. package/docs/list-row.md +14 -0
  166. package/docs/mentions.md +18 -0
  167. package/docs/menubar.md +22 -0
  168. package/docs/native-platform.md +36 -0
  169. package/docs/overlay-stack.md +24 -0
  170. package/docs/pagination.md +16 -8
  171. package/docs/popover.md +42 -13
  172. package/docs/product-audit-2026-09-15.md +88 -0
  173. package/docs/progress.md +16 -0
  174. package/docs/provider-button.md +33 -0
  175. package/docs/rating.md +19 -0
  176. package/docs/react-native-completion.md +347 -0
  177. package/docs/screen-chrome.md +52 -0
  178. package/docs/side-panel.md +23 -2
  179. package/docs/sidebar.md +30 -0
  180. package/docs/skip-nav.md +20 -0
  181. package/docs/splitter.md +22 -2
  182. package/docs/stable-promotion.md +51 -0
  183. package/docs/tags-input.md +25 -0
  184. package/docs/text-formats.md +15 -0
  185. package/docs/theming.md +84 -0
  186. package/docs/time-picker.md +22 -1
  187. package/docs/toast.md +18 -0
  188. package/docs/toggle-group.md +21 -0
  189. package/docs/top.md +32 -0
  190. package/docs/tour.md +23 -2
  191. package/docs/transfer-list.md +20 -0
  192. package/docs/tree-select.md +18 -0
  193. package/docs/tree.md +21 -0
  194. package/package.json +120 -6
@@ -0,0 +1,48 @@
1
+ import { spacing, typography } from "./foundations.js";
2
+ import { semanticColors } from "./semantic-colors.js";
3
+ export function validateBottomInfoDescriptor(descriptor) {
4
+ if (descriptor === null || typeof descriptor !== "object") {
5
+ throw new TypeError("BottomInfo descriptor must be an object");
6
+ }
7
+ if (!Array.isArray(descriptor.items) || descriptor.items.length === 0) {
8
+ throw new RangeError("BottomInfo must contain at least one item");
9
+ }
10
+ for (const item of descriptor.items) {
11
+ if (typeof item !== "string" || item.trim().length === 0) {
12
+ throw new TypeError("BottomInfo items must not be empty");
13
+ }
14
+ }
15
+ if (descriptor.tone !== undefined &&
16
+ descriptor.tone !== "muted" &&
17
+ descriptor.tone !== "emphasis") {
18
+ throw new TypeError(`Unsupported BottomInfo tone: ${String(descriptor.tone)}`);
19
+ }
20
+ }
21
+ export const bottomInfoRecipe = {
22
+ slots: ["root", "item"],
23
+ defaults: { tone: "muted" },
24
+ tones: {
25
+ muted: semanticColors.content.secondary,
26
+ /** 법적 고지처럼 놓치면 안 되는 문장. 여전히 상태가 아니라 조건이다. */
27
+ emphasis: semanticColors.content.body,
28
+ },
29
+ textVariant: "caption",
30
+ gap: spacing.xxs,
31
+ paddingTop: spacing.sm,
32
+ /** 여러 줄일 때만 목록 표식을 쓴다 — 한 줄에 점을 찍으면 오히려 시끄럽다. */
33
+ listMarkerFrom: 2,
34
+ };
35
+ export const bottomInfoBehavior = {
36
+ controlled: [],
37
+ inputs: ["items", "tone"],
38
+ stateAxes: {},
39
+ web: { roles: ["list", "listitem"], keyboard: [], focus: "none" },
40
+ native: { roles: [], states: [], actions: [] },
41
+ scenarios: [
42
+ "it-states-a-standing-condition-not-a-state-change-so-it-has-no-tone-of-alarm",
43
+ "a-single-line-renders-without-a-list-marker-and-several-lines-render-as-a-list",
44
+ "the-text-wraps-and-is-never-truncated-because-it-is-usually-a-legal-notice",
45
+ "links-inside-the-copy-belong-to-the-product-not-to-this-contract",
46
+ ],
47
+ };
48
+ //# sourceMappingURL=bottom-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bottom-info.js","sourceRoot":"","sources":["../src/bottom-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAoBtD,MAAM,UAAU,4BAA4B,CAAC,UAAgC;IAC3E,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1D,MAAM,IAAI,SAAS,CAAC,yCAAyC,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,UAAU,CAAC,2CAA2C,CAAC,CAAC;IACpE,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,IACE,UAAU,CAAC,IAAI,KAAK,SAAS;QAC7B,UAAU,CAAC,IAAI,KAAK,OAAO;QAC3B,UAAU,CAAC,IAAI,KAAK,UAAU,EAC9B,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,gCAAgC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAU;IAChC,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAyB,EAAE;IAC7C,KAAK,EAAE;QACL,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,SAAS;QACvC,6CAA6C;QAC7C,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,IAAI;KACtC;IACD,WAAW,EAAE,SAAkB;IAC/B,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,UAAU,EAAE,OAAO,CAAC,EAAE;IACtB,iDAAiD;IACjD,cAAc,EAAE,CAAC;CASlB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,UAAU,EAAE,EAAE;IACd,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,EAAE;IACb,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;IACjE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAC9C,SAAS,EAAE;QACT,8EAA8E;QAC9E,gFAAgF;QAChF,4EAA4E;QAC5E,kEAAkE;KACnE;CACkC,CAAC","sourcesContent":["import type { BehaviorContract } from \"./behaviors.js\";\nimport type { ColorReference } from \"./color-references.js\";\nimport { spacing, typography } from \"./foundations.js\";\nimport { semanticColors } from \"./semantic-colors.js\";\n\n/**\n * 주 행동 **아래** 붙는 작은 안내 — \"가입하면 약관에 동의하는 것으로 봅니다\",\n * \"수수료는 결제 시점에 확정됩니다\" 같은 문장. 토스 TDS의 BottomInfo와 같은 자리다.\n *\n * `Notice`와 다르다. Notice는 **지금 생긴 상태**를 알린다(오류·성공·경고). BottomInfo는\n * 화면에 늘 있는 **조건**이라 tone도 아이콘도 없고 사라지지도 않는다. Notice로 쓰면\n * 사용자가 매번 \"무슨 문제가 생겼나\" 하고 읽게 된다.\n *\n * 문단 하나 이상을 담을 수 있고, 각 문단 안의 링크(약관·자세히 보기)는 제품이 넣는다.\n */\nexport type BottomInfoTone = \"muted\" | \"emphasis\";\n\nexport type BottomInfoDescriptor = Readonly<{\n /** 목록으로 읽히는 여러 줄. 한 줄이면 배열 하나. */\n items: readonly string[];\n tone?: BottomInfoTone;\n}>;\n\nexport function validateBottomInfoDescriptor(descriptor: BottomInfoDescriptor): void {\n if (descriptor === null || typeof descriptor !== \"object\") {\n throw new TypeError(\"BottomInfo descriptor must be an object\");\n }\n if (!Array.isArray(descriptor.items) || descriptor.items.length === 0) {\n throw new RangeError(\"BottomInfo must contain at least one item\");\n }\n for (const item of descriptor.items) {\n if (typeof item !== \"string\" || item.trim().length === 0) {\n throw new TypeError(\"BottomInfo items must not be empty\");\n }\n }\n if (\n descriptor.tone !== undefined &&\n descriptor.tone !== \"muted\" &&\n descriptor.tone !== \"emphasis\"\n ) {\n throw new TypeError(`Unsupported BottomInfo tone: ${String(descriptor.tone)}`);\n }\n}\n\nexport const bottomInfoRecipe = {\n slots: [\"root\", \"item\"] as const,\n defaults: { tone: \"muted\" as BottomInfoTone },\n tones: {\n muted: semanticColors.content.secondary,\n /** 법적 고지처럼 놓치면 안 되는 문장. 여전히 상태가 아니라 조건이다. */\n emphasis: semanticColors.content.body,\n },\n textVariant: \"caption\" as const,\n gap: spacing.xxs,\n paddingTop: spacing.sm,\n /** 여러 줄일 때만 목록 표식을 쓴다 — 한 줄에 점을 찍으면 오히려 시끄럽다. */\n listMarkerFrom: 2,\n} as const satisfies {\n slots: readonly [\"root\", \"item\"];\n defaults: { tone: BottomInfoTone };\n tones: Record<BottomInfoTone, ColorReference>;\n textVariant: keyof typeof typography;\n gap: number;\n paddingTop: number;\n listMarkerFrom: number;\n};\n\nexport const bottomInfoBehavior = {\n controlled: [],\n inputs: [\"items\", \"tone\"],\n stateAxes: {},\n web: { roles: [\"list\", \"listitem\"], keyboard: [], focus: \"none\" },\n native: { roles: [], states: [], actions: [] },\n scenarios: [\n \"it-states-a-standing-condition-not-a-state-change-so-it-has-no-tone-of-alarm\",\n \"a-single-line-renders-without-a-list-marker-and-several-lines-render-as-a-list\",\n \"the-text-wraps-and-is-never-truncated-because-it-is-usually-a-legal-notice\",\n \"links-inside-the-copy-belong-to-the-product-not-to-this-contract\",\n ],\n} as const satisfies BehaviorContract;\n"]}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Ant Design Carousel's infinite loop and default autoplay are intentionally
3
- * not reproduced — both remove the one thing this contract treats as
2
+ * Ant Design Carousel's default infinite loop is intentionally not reproduced;
3
+ * autoplay remains opt-in in both libraries — automatic movement can obscure what this contract treats as
4
4
  * non-negotiable: a reliable answer to "where am I, and where does it end".
5
5
  * See docs/carousel.md for the accessibility rationale on every point below.
6
6
  */
@@ -109,7 +109,7 @@ export declare const carouselBehavior: {
109
109
  readonly web: {
110
110
  readonly roles: readonly ["region", "group"];
111
111
  readonly keyboard: readonly ["Tab", "Enter", "Space", "ArrowLeft", "ArrowRight"];
112
- readonly focus: "roving";
112
+ readonly focus: "native";
113
113
  };
114
114
  readonly native: {
115
115
  readonly roles: readonly ["adjustable"];
package/dist/carousel.js CHANGED
@@ -107,7 +107,7 @@ export const carouselBehavior = {
107
107
  web: {
108
108
  roles: ["region", "group"],
109
109
  keyboard: ["Tab", "Enter", "Space", "ArrowLeft", "ArrowRight"],
110
- focus: "roving",
110
+ focus: "native",
111
111
  },
112
112
  native: {
113
113
  roles: ["adjustable"],
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,Y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AAI;SAClB;KACF;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,OAAO,CAAC,cAAc;QACjC,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM;YACtC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK;SACtC;KACF;IACD,2GAA2G;IAC3G,OAAO,EAAE;QACP,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc;YACxB,IAAI,EAAE,YAAY;SACiE;KACtF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,sBAAsB;QAC7B,cAAc,EAAE,OAAO,CAAC,OAAO;KAChC;IACD;;;;OAIG;IACH,UAAU,EAAE,YAAY,CAAC,OAAO;CAqBjC,CAAC","sourcesContent":["import type { BehaviorContract } from \"./behaviors.js\";\nimport type { ColorReference } from \"./color-references.js\";\nimport type { SemanticIconName } from \"./icon.js\";\nimport { focusIndicatorContract } from \"./component-contracts.js\";\nimport { control, motionPreset, opacity, spacing } from \"./foundations.js\";\nimport { assertFiniteNumber } from \"./number-field.js\";\nimport { semanticColors } from \"./semantic-colors.js\";\n\n/**\n * Ant Design Carousel's infinite loop and default autoplay are intentionally\n * not reproduced — both remove the one thing this contract treats as\n * non-negotiable: a reliable answer to \"where am I, and where does it end\".\n * See docs/carousel.md for the accessibility rationale on every point below.\n */\nexport type CarouselSlideDescriptor<Id extends string = string> = Readonly<{\n id: Id;\n /** Accessible name for the slide, e.g. \"8/19 두산 vs LG\". The slide's visual content is product-owned. */\n label: string;\n}>;\n\nexport type CarouselAutoplayConfig = Readonly<{\n /** Minimum time a slide stays current before an automatic advance. */\n intervalMs: number;\n}>;\n\n/**\n * Renderer-facing prop shape only — mirrors SelectSelection's controlled/\n * uncontrolled duality, but the resolver below always takes a concrete,\n * already-resolved `currentKey` (see CarouselDescriptor) so validation and\n * position math never have to branch on which mode the product chose.\n */\nexport type ControlledCarouselSelection<Id extends string = string> = Readonly<{\n currentKey: Id;\n defaultCurrentKey?: never;\n onCurrentKeyChange(key: Id): void;\n}>;\n\nexport type UncontrolledCarouselSelection<Id extends string = string> = Readonly<{\n currentKey?: never;\n defaultCurrentKey?: Id;\n onCurrentKeyChange?: (key: Id) => void;\n}>;\n\nexport type CarouselSelection<Id extends string = string> =\n | ControlledCarouselSelection<Id>\n | UncontrolledCarouselSelection<Id>;\n\nexport type CarouselDescriptor<Id extends string = string> = Readonly<{\n slides: readonly CarouselSlideDescriptor<Id>[];\n currentKey: Id;\n /** Absent by default. Autoplay is opt-in — see docs/carousel.md. */\n autoplay?: CarouselAutoplayConfig;\n}>;\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (value.trim().length === 0) {\n throw new TypeError(`Carousel ${field} must not be empty`);\n }\n}\n\nexport function validateCarouselSlide<Id extends string>(\n slide: CarouselSlideDescriptor<Id>,\n): void {\n assertNonEmpty(slide.id, \"slide id\");\n if (slide.id !== slide.id.trim()) {\n throw new TypeError(\"Carousel slide id must not start or end with whitespace\");\n }\n assertNonEmpty(slide.label, \"slide label\");\n}\n\nexport function validateCarouselAutoplayConfig(\n autoplay: CarouselAutoplayConfig,\n): void {\n assertFiniteNumber(autoplay.intervalMs, \"autoplay.intervalMs\");\n if (autoplay.intervalMs <= 0) {\n throw new RangeError(\"Carousel autoplay.intervalMs must be greater than zero\");\n }\n}\n\nexport function validateCarouselDescriptor<Id extends string>(\n descriptor: CarouselDescriptor<Id>,\n): void {\n if (descriptor.slides.length === 0) {\n throw new RangeError(\"Carousel must contain at least one slide\");\n }\n const ids = new Set<Id>();\n for (const slide of descriptor.slides) {\n validateCarouselSlide(slide);\n if (ids.has(slide.id)) {\n throw new TypeError(`Duplicate Carousel slide id: ${slide.id}`);\n }\n ids.add(slide.id);\n }\n if (!ids.has(descriptor.currentKey)) {\n throw new RangeError(\n `Carousel currentKey does not match any slide id: ${String(descriptor.currentKey)}`,\n );\n }\n if (descriptor.autoplay) {\n validateCarouselAutoplayConfig(descriptor.autoplay);\n }\n}\n\nexport type CarouselAccessibleNameInfo = Readonly<{\n position: number;\n total: number;\n label: string;\n}>;\n\n/**\n * Same reason Steps and Timeline do not assemble their own accessible name:\n * counter-word grammar and phrase order are product-owned copy decisions.\n */\nexport type ComposeCarouselAccessibleName = (\n info: CarouselAccessibleNameInfo,\n) => string;\n\nexport type ResolvedCarouselSlideDescriptor<Id extends string = string> =\n CarouselSlideDescriptor<Id> &\n Readonly<{\n /** 1-indexed so position and label both preserve reading order for renderers. */\n position: number;\n total: number;\n current: boolean;\n /**\n * True for every slide but the current one. A renderer must exclude an\n * inert slide's interactive content from both focus and the\n * accessibility tree — a hidden slide whose link can still receive\n * focus is worse than one that is simply unreachable until the user\n * advances to it (see docs/carousel.md).\n */\n inert: boolean;\n accessibleName: string;\n }>;\n\nexport type ResolveCarouselOptions = Readonly<{\n composeAccessibleName: ComposeCarouselAccessibleName;\n}>;\n\n/**\n * Attaches order, current/inert, and the composed accessible name used by\n * both the slide group and its indicator dot — one composer, reused for\n * every render target, the same way Steps reuses a single composer.\n */\nexport function resolveCarouselDescriptor<Id extends string>(\n descriptor: CarouselDescriptor<Id>,\n options: ResolveCarouselOptions,\n): readonly ResolvedCarouselSlideDescriptor<Id>[] {\n validateCarouselDescriptor(descriptor);\n if (typeof options.composeAccessibleName !== \"function\") {\n throw new TypeError(\"Carousel composeAccessibleName must be a function\");\n }\n\n const total = descriptor.slides.length;\n return descriptor.slides.map((slide, index) => {\n const position = index + 1;\n const current = slide.id === descriptor.currentKey;\n const accessibleName = options.composeAccessibleName({\n position,\n total,\n label: slide.label,\n });\n if (typeof accessibleName !== \"string\" || accessibleName.trim().length === 0) {\n throw new TypeError(\n \"Carousel composeAccessibleName must return a non-empty string\",\n );\n }\n return { ...slide, position, total, current, inert: !current, accessibleName };\n });\n}\n\nexport type CarouselNavigationIntent = \"next\" | \"previous\" | \"first\" | \"last\";\n\n/**\n * Clamps at the first/last slide instead of wrapping — infinite loop is out\n * of scope (see docs/carousel.md), so there is no modulo here at all, unlike\n * getCollectionNavigationTarget's `loop` parameter elsewhere in this package.\n */\nexport function getCarouselNavigationTarget<Id extends string>(\n descriptor: CarouselDescriptor<Id>,\n intent: CarouselNavigationIntent,\n): Id {\n validateCarouselDescriptor(descriptor);\n const { slides, currentKey } = descriptor;\n if (intent === \"first\") return slides[0]!.id;\n if (intent === \"last\") return slides.at(-1)!.id;\n const currentIndex = slides.findIndex((slide) => slide.id === currentKey);\n const delta = intent === \"next\" ? 1 : -1;\n const clampedIndex = Math.min(\n Math.max(currentIndex + delta, 0),\n slides.length - 1,\n );\n return slides[clampedIndex]!.id;\n}\n\nexport type CarouselAutoplayInputs = Readonly<{\n /** True whenever a platform reduce-motion preference is active. */\n reducedMotion: boolean;\n /** Renderer-combined pointer hover, focus-within, and drag signal. */\n paused: boolean;\n}>;\n\n/**\n * Autoplay is never active without an explicit config, under reduce motion,\n * or while the user is hovering, focusing, or dragging the carousel — the\n * three guards the brief requires are one function so a renderer cannot wire\n * an autoplay timer that forgets one of them.\n */\nexport function isCarouselAutoplayActive(\n autoplay: CarouselAutoplayConfig | undefined,\n inputs: CarouselAutoplayInputs,\n): boolean {\n if (!autoplay) return false;\n validateCarouselAutoplayConfig(autoplay);\n return !inputs.reducedMotion && !inputs.paused;\n}\n\nexport const carouselBehaviorDefaults = {\n autoplay: false,\n} as const satisfies Readonly<{ autoplay: boolean }>;\n\nexport const carouselBehavior = {\n controlled: [\"currentKey\", \"defaultCurrentKey\", \"onCurrentKeyChange\"],\n inputs: [\"autoplay\", \"reducedMotion\", \"dragged\"],\n defaults: carouselBehaviorDefaults,\n stateAxes: {\n interaction: [\"idle\", \"dragged\"],\n value: [\"selected\"],\n },\n web: {\n roles: [\"region\", \"group\"],\n keyboard: [\"Tab\", \"Enter\", \"Space\", \"ArrowLeft\", \"ArrowRight\"],\n focus: \"roving\",\n },\n native: {\n roles: [\"adjustable\"],\n states: [\"selected\"],\n actions: [\"increment\", \"decrement\"],\n },\n scenarios: [\n \"current-position-is-announced-with-a-readable-name-not-dots-alone\",\n \"inactive-slide-content-is-excluded-from-focus-and-the-accessibility-tree\",\n \"previous-next-and-dot-controls-stay-in-tab-order-regardless-of-current-slide\",\n \"arrow-keys-move-one-slide-on-web-swipe-moves-one-slide-on-native\",\n \"boundary-slides-clamp-instead-of-wrapping-because-loop-is-out-of-scope\",\n \"autoplay-is-opt-in-and-off-by-default\",\n \"autoplay-never-runs-when-reduced-motion-is-active\",\n \"autoplay-pauses-on-hover-focus-or-drag-and-does-not-announce-automatic-transitions\",\n ],\n} as const satisfies BehaviorContract;\n\nexport type CarouselSize = \"medium\";\n\nexport const carouselRecipe = {\n slots: [\n \"root\",\n \"track\",\n \"slide\",\n \"dots\",\n \"dot\",\n \"previousControl\",\n \"nextControl\",\n ] as const,\n defaults: { size: \"medium\" },\n sizes: {\n medium: {\n gap: spacing.sm,\n controlHitTarget: control.minTouchTarget,\n controlIcon: \"sm\",\n },\n },\n dot: {\n diameter: 8,\n hitTarget: control.minTouchTarget,\n color: {\n inactive: semanticColors.border.strong,\n current: semanticColors.content.brand,\n },\n },\n /** Previous/next chrome is composed from IconButton (ghost tone) rather than owning new button visuals. */\n control: {\n icons: {\n previous: \"chevronStart\",\n next: \"chevronEnd\",\n } as const satisfies Readonly<{ previous: SemanticIconName; next: SemanticIconName }>,\n },\n states: {\n focus: focusIndicatorContract,\n draggedOpacity: opacity.dragged,\n },\n /**\n * Manual slide-to-slide movement crossfades rather than snapping under\n * Reduce Motion, reusing the existing \"context\" preset instead of a new\n * token — autoplay itself simply does not run at all (isCarouselAutoplayActive).\n */\n transition: motionPreset.context,\n} as const satisfies {\n slots: readonly string[];\n defaults: { size: CarouselSize };\n sizes: Record<\n CarouselSize,\n { gap: number; controlHitTarget: number; controlIcon: string }\n >;\n dot: {\n diameter: number;\n hitTarget: number;\n color: Record<\"inactive\" | \"current\", ColorReference>;\n };\n control: {\n icons: Readonly<{ previous: SemanticIconName; next: SemanticIconName }>;\n };\n states: {\n focus: typeof focusIndicatorContract;\n draggedOpacity: number;\n };\n transition: typeof motionPreset.context;\n};\n"]}
1
+ {"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgDtD,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IAClD,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CAAC,YAAY,KAAK,oBAAoB,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAkC;IAElC,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QACjC,MAAM,IAAI,SAAS,CAAC,yDAAyD,CAAC,CAAC;IACjF,CAAC;IACD,cAAc,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,QAAgC;IAEhC,kBAAkB,CAAC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;IAC/D,IAAI,QAAQ,CAAC,UAAU,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,UAAU,CAAC,wDAAwD,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,UAAkC;IAElC,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,M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AAiB;QACjB,aAAa;KACL;IACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC5B,KAAK,EAAE;QACL,MAAM,EAAE;YACN,GAAG,EAAE,OAAO,CAAC,EAAE;YACf,gBAAgB,EAAE,OAAO,CAAC,cAAc;YACxC,WAAW,EAAE,IAAI;SAClB;KACF;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,OAAO,CAAC,cAAc;QACjC,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM;YACtC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK;SACtC;KACF;IACD,2GAA2G;IAC3G,OAAO,EAAE;QACP,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc;YACxB,IAAI,EAAE,YAAY;SACiE;KACtF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,sBAAsB;QAC7B,cAAc,EAAE,OAAO,CAAC,OAAO;KAChC;IACD;;;;OAIG;IACH,UAAU,EAAE,YAAY,CAAC,OAAO;CAqBjC,CAAC","sourcesContent":["import type { BehaviorContract } from \"./behaviors.js\";\nimport type { ColorReference } from \"./color-references.js\";\nimport type { SemanticIconName } from \"./icon.js\";\nimport { focusIndicatorContract } from \"./component-contracts.js\";\nimport { control, motionPreset, opacity, spacing } from \"./foundations.js\";\nimport { assertFiniteNumber } from \"./number-field.js\";\nimport { semanticColors } from \"./semantic-colors.js\";\n\n/**\n * Ant Design Carousel's default infinite loop is intentionally not reproduced;\n * autoplay remains opt-in in both libraries — automatic movement can obscure what this contract treats as\n * non-negotiable: a reliable answer to \"where am I, and where does it end\".\n * See docs/carousel.md for the accessibility rationale on every point below.\n */\nexport type CarouselSlideDescriptor<Id extends string = string> = Readonly<{\n id: Id;\n /** Accessible name for the slide, e.g. \"8/19 두산 vs LG\". The slide's visual content is product-owned. */\n label: string;\n}>;\n\nexport type CarouselAutoplayConfig = Readonly<{\n /** Minimum time a slide stays current before an automatic advance. */\n intervalMs: number;\n}>;\n\n/**\n * Renderer-facing prop shape only — mirrors SelectSelection's controlled/\n * uncontrolled duality, but the resolver below always takes a concrete,\n * already-resolved `currentKey` (see CarouselDescriptor) so validation and\n * position math never have to branch on which mode the product chose.\n */\nexport type ControlledCarouselSelection<Id extends string = string> = Readonly<{\n currentKey: Id;\n defaultCurrentKey?: never;\n onCurrentKeyChange(key: Id): void;\n}>;\n\nexport type UncontrolledCarouselSelection<Id extends string = string> = Readonly<{\n currentKey?: never;\n defaultCurrentKey?: Id;\n onCurrentKeyChange?: (key: Id) => void;\n}>;\n\nexport type CarouselSelection<Id extends string = string> =\n | ControlledCarouselSelection<Id>\n | UncontrolledCarouselSelection<Id>;\n\nexport type CarouselDescriptor<Id extends string = string> = Readonly<{\n slides: readonly CarouselSlideDescriptor<Id>[];\n currentKey: Id;\n /** Absent by default. Autoplay is opt-in — see docs/carousel.md. */\n autoplay?: CarouselAutoplayConfig;\n}>;\n\nfunction assertNonEmpty(value: string, field: string): void {\n if (value.trim().length === 0) {\n throw new TypeError(`Carousel ${field} must not be empty`);\n }\n}\n\nexport function validateCarouselSlide<Id extends string>(\n slide: CarouselSlideDescriptor<Id>,\n): void {\n assertNonEmpty(slide.id, \"slide id\");\n if (slide.id !== slide.id.trim()) {\n throw new TypeError(\"Carousel slide id must not start or end with whitespace\");\n }\n assertNonEmpty(slide.label, \"slide label\");\n}\n\nexport function validateCarouselAutoplayConfig(\n autoplay: CarouselAutoplayConfig,\n): void {\n assertFiniteNumber(autoplay.intervalMs, \"autoplay.intervalMs\");\n if (autoplay.intervalMs <= 0) {\n throw new RangeError(\"Carousel autoplay.intervalMs must be greater than zero\");\n }\n}\n\nexport function validateCarouselDescriptor<Id extends string>(\n descriptor: CarouselDescriptor<Id>,\n): void {\n if (descriptor.slides.length === 0) {\n throw new RangeError(\"Carousel must contain at least one slide\");\n }\n const ids = new Set<Id>();\n for (const slide of descriptor.slides) {\n validateCarouselSlide(slide);\n if (ids.has(slide.id)) {\n throw new TypeError(`Duplicate Carousel slide id: ${slide.id}`);\n }\n ids.add(slide.id);\n }\n if (!ids.has(descriptor.currentKey)) {\n throw new RangeError(\n `Carousel currentKey does not match any slide id: ${String(descriptor.currentKey)}`,\n );\n }\n if (descriptor.autoplay) {\n validateCarouselAutoplayConfig(descriptor.autoplay);\n }\n}\n\nexport type CarouselAccessibleNameInfo = Readonly<{\n position: number;\n total: number;\n label: string;\n}>;\n\n/**\n * Same reason Steps and Timeline do not assemble their own accessible name:\n * counter-word grammar and phrase order are product-owned copy decisions.\n */\nexport type ComposeCarouselAccessibleName = (\n info: CarouselAccessibleNameInfo,\n) => string;\n\nexport type ResolvedCarouselSlideDescriptor<Id extends string = string> =\n CarouselSlideDescriptor<Id> &\n Readonly<{\n /** 1-indexed so position and label both preserve reading order for renderers. */\n position: number;\n total: number;\n current: boolean;\n /**\n * True for every slide but the current one. A renderer must exclude an\n * inert slide's interactive content from both focus and the\n * accessibility tree — a hidden slide whose link can still receive\n * focus is worse than one that is simply unreachable until the user\n * advances to it (see docs/carousel.md).\n */\n inert: boolean;\n accessibleName: string;\n }>;\n\nexport type ResolveCarouselOptions = Readonly<{\n composeAccessibleName: ComposeCarouselAccessibleName;\n}>;\n\n/**\n * Attaches order, current/inert, and the composed accessible name used by\n * both the slide group and its indicator dot — one composer, reused for\n * every render target, the same way Steps reuses a single composer.\n */\nexport function resolveCarouselDescriptor<Id extends string>(\n descriptor: CarouselDescriptor<Id>,\n options: ResolveCarouselOptions,\n): readonly ResolvedCarouselSlideDescriptor<Id>[] {\n validateCarouselDescriptor(descriptor);\n if (typeof options.composeAccessibleName !== \"function\") {\n throw new TypeError(\"Carousel composeAccessibleName must be a function\");\n }\n\n const total = descriptor.slides.length;\n return descriptor.slides.map((slide, index) => {\n const position = index + 1;\n const current = slide.id === descriptor.currentKey;\n const accessibleName = options.composeAccessibleName({\n position,\n total,\n label: slide.label,\n });\n if (typeof accessibleName !== \"string\" || accessibleName.trim().length === 0) {\n throw new TypeError(\n \"Carousel composeAccessibleName must return a non-empty string\",\n );\n }\n return { ...slide, position, total, current, inert: !current, accessibleName };\n });\n}\n\nexport type CarouselNavigationIntent = \"next\" | \"previous\" | \"first\" | \"last\";\n\n/**\n * Clamps at the first/last slide instead of wrapping — infinite loop is out\n * of scope (see docs/carousel.md), so there is no modulo here at all, unlike\n * getCollectionNavigationTarget's `loop` parameter elsewhere in this package.\n */\nexport function getCarouselNavigationTarget<Id extends string>(\n descriptor: CarouselDescriptor<Id>,\n intent: CarouselNavigationIntent,\n): Id {\n validateCarouselDescriptor(descriptor);\n const { slides, currentKey } = descriptor;\n if (intent === \"first\") return slides[0]!.id;\n if (intent === \"last\") return slides.at(-1)!.id;\n const currentIndex = slides.findIndex((slide) => slide.id === currentKey);\n const delta = intent === \"next\" ? 1 : -1;\n const clampedIndex = Math.min(\n Math.max(currentIndex + delta, 0),\n slides.length - 1,\n );\n return slides[clampedIndex]!.id;\n}\n\nexport type CarouselAutoplayInputs = Readonly<{\n /** True whenever a platform reduce-motion preference is active. */\n reducedMotion: boolean;\n /** Renderer-combined pointer hover, focus-within, and drag signal. */\n paused: boolean;\n}>;\n\n/**\n * Autoplay is never active without an explicit config, under reduce motion,\n * or while the user is hovering, focusing, or dragging the carousel — the\n * three guards the brief requires are one function so a renderer cannot wire\n * an autoplay timer that forgets one of them.\n */\nexport function isCarouselAutoplayActive(\n autoplay: CarouselAutoplayConfig | undefined,\n inputs: CarouselAutoplayInputs,\n): boolean {\n if (!autoplay) return false;\n validateCarouselAutoplayConfig(autoplay);\n return !inputs.reducedMotion && !inputs.paused;\n}\n\nexport const carouselBehaviorDefaults = {\n autoplay: false,\n} as const satisfies Readonly<{ autoplay: boolean }>;\n\nexport const carouselBehavior = {\n controlled: [\"currentKey\", \"defaultCurrentKey\", \"onCurrentKeyChange\"],\n inputs: [\"autoplay\", \"reducedMotion\", \"dragged\"],\n defaults: carouselBehaviorDefaults,\n stateAxes: {\n interaction: [\"idle\", \"dragged\"],\n value: [\"selected\"],\n },\n web: {\n roles: [\"region\", \"group\"],\n keyboard: [\"Tab\", \"Enter\", \"Space\", \"ArrowLeft\", \"ArrowRight\"],\n focus: \"native\",\n },\n native: {\n roles: [\"adjustable\"],\n states: [\"selected\"],\n actions: [\"increment\", \"decrement\"],\n },\n scenarios: [\n \"current-position-is-announced-with-a-readable-name-not-dots-alone\",\n \"inactive-slide-content-is-excluded-from-focus-and-the-accessibility-tree\",\n \"previous-next-and-dot-controls-stay-in-tab-order-regardless-of-current-slide\",\n \"arrow-keys-move-one-slide-on-web-swipe-moves-one-slide-on-native\",\n \"boundary-slides-clamp-instead-of-wrapping-because-loop-is-out-of-scope\",\n \"autoplay-is-opt-in-and-off-by-default\",\n \"autoplay-never-runs-when-reduced-motion-is-active\",\n \"autoplay-pauses-on-hover-focus-or-drag-and-does-not-announce-automatic-transitions\",\n ],\n} as const satisfies BehaviorContract;\n\nexport type CarouselSize = \"medium\";\n\nexport const carouselRecipe = {\n slots: [\n \"root\",\n \"track\",\n \"slide\",\n \"dots\",\n \"dot\",\n \"previousControl\",\n \"nextControl\",\n ] as const,\n defaults: { size: \"medium\" },\n sizes: {\n medium: {\n gap: spacing.sm,\n controlHitTarget: control.minTouchTarget,\n controlIcon: \"sm\",\n },\n },\n dot: {\n diameter: 8,\n hitTarget: control.minTouchTarget,\n color: {\n inactive: semanticColors.border.strong,\n current: semanticColors.content.brand,\n },\n },\n /** Previous/next chrome is composed from IconButton (ghost tone) rather than owning new button visuals. */\n control: {\n icons: {\n previous: \"chevronStart\",\n next: \"chevronEnd\",\n } as const satisfies Readonly<{ previous: SemanticIconName; next: SemanticIconName }>,\n },\n states: {\n focus: focusIndicatorContract,\n draggedOpacity: opacity.dragged,\n },\n /**\n * Manual slide-to-slide movement crossfades rather than snapping under\n * Reduce Motion, reusing the existing \"context\" preset instead of a new\n * token — autoplay itself simply does not run at all (isCarouselAutoplayActive).\n */\n transition: motionPreset.context,\n} as const satisfies {\n slots: readonly string[];\n defaults: { size: CarouselSize };\n sizes: Record<\n CarouselSize,\n { gap: number; controlHitTarget: number; controlIcon: string }\n >;\n dot: {\n diameter: number;\n hitTarget: number;\n color: Record<\"inactive\" | \"current\", ColorReference>;\n };\n control: {\n icons: Readonly<{ previous: SemanticIconName; next: SemanticIconName }>;\n };\n states: {\n focus: typeof focusIndicatorContract;\n draggedOpacity: number;\n };\n transition: typeof motionPreset.context;\n};\n"]}