@charcoal-ui/react 6.0.0-rc.9 → 6.0.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 (265) hide show
  1. package/dist/_lib/compat.d.ts.map +1 -1
  2. package/dist/_lib/createDivComponent.cjs +0 -1
  3. package/dist/_lib/createDivComponent.cjs.map +1 -1
  4. package/dist/_lib/createDivComponent.d.ts +1 -1
  5. package/dist/_lib/createDivComponent.js.map +1 -1
  6. package/dist/_lib/index.cjs.map +1 -1
  7. package/dist/_lib/index.js.map +1 -1
  8. package/dist/_lib/useClassNames.cjs +0 -1
  9. package/dist/_lib/useClassNames.cjs.map +1 -1
  10. package/dist/_lib/useClassNames.js.map +1 -1
  11. package/dist/_lib/useForwardedRef.cjs +1 -1
  12. package/dist/_lib/useForwardedRef.cjs.map +1 -1
  13. package/dist/_lib/useForwardedRef.js.map +1 -1
  14. package/dist/_lib/useIsomorphicLayoutEffect.cjs +0 -1
  15. package/dist/_lib/useIsomorphicLayoutEffect.cjs.map +1 -1
  16. package/dist/_lib/useIsomorphicLayoutEffect.d.ts +2 -2
  17. package/dist/_lib/useIsomorphicLayoutEffect.d.ts.map +1 -1
  18. package/dist/_lib/useIsomorphicLayoutEffect.js.map +1 -1
  19. package/dist/components/Button/index.d.ts +1 -1
  20. package/dist/components/Button/index.d.ts.map +1 -1
  21. package/dist/components/Button/index2.cjs +1 -1
  22. package/dist/components/Button/index2.cjs.map +1 -1
  23. package/dist/components/Button/index2.js.map +1 -1
  24. package/dist/components/Carousel/CarouselItem.cjs +0 -1
  25. package/dist/components/Carousel/CarouselItem.cjs.map +1 -1
  26. package/dist/components/Carousel/CarouselItem.d.ts.map +1 -1
  27. package/dist/components/Carousel/CarouselItem.js.map +1 -1
  28. package/dist/components/Carousel/carouselStore.cjs.map +1 -1
  29. package/dist/components/Carousel/carouselStore.js.map +1 -1
  30. package/dist/components/Carousel/index.d.ts +1 -1
  31. package/dist/components/Carousel/index.d.ts.map +1 -1
  32. package/dist/components/Carousel/index2.cjs +0 -1
  33. package/dist/components/Carousel/index2.cjs.map +1 -1
  34. package/dist/components/Carousel/index2.js.map +1 -1
  35. package/dist/components/Carousel/intersectionObserver.cjs.map +1 -1
  36. package/dist/components/Carousel/intersectionObserver.js.map +1 -1
  37. package/dist/components/Carousel/resizeObserver.cjs.map +1 -1
  38. package/dist/components/Carousel/resizeObserver.js.map +1 -1
  39. package/dist/components/Carousel/store.cjs.map +1 -1
  40. package/dist/components/Carousel/store.js.map +1 -1
  41. package/dist/components/Carousel/useCarouselScroller.cjs +0 -1
  42. package/dist/components/Carousel/useCarouselScroller.cjs.map +1 -1
  43. package/dist/components/Carousel/useCarouselScroller.js.map +1 -1
  44. package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -1
  45. package/dist/components/Checkbox/CheckboxInput/index2.cjs +0 -1
  46. package/dist/components/Checkbox/CheckboxInput/index2.cjs.map +1 -1
  47. package/dist/components/Checkbox/CheckboxInput/index2.js.map +1 -1
  48. package/dist/components/Checkbox/CheckboxWithLabel.cjs +1 -1
  49. package/dist/components/Checkbox/CheckboxWithLabel.cjs.map +1 -1
  50. package/dist/components/Checkbox/CheckboxWithLabel.d.ts +2 -2
  51. package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -1
  52. package/dist/components/Checkbox/CheckboxWithLabel.js.map +1 -1
  53. package/dist/components/Checkbox/index.d.ts.map +1 -1
  54. package/dist/components/Checkbox/index2.cjs +0 -1
  55. package/dist/components/Checkbox/index2.cjs.map +1 -1
  56. package/dist/components/Checkbox/index2.js.map +1 -1
  57. package/dist/components/Clickable/index.d.ts +1 -1
  58. package/dist/components/Clickable/index.d.ts.map +1 -1
  59. package/dist/components/Clickable/index2.cjs +1 -1
  60. package/dist/components/Clickable/index2.cjs.map +1 -1
  61. package/dist/components/Clickable/index2.js.map +1 -1
  62. package/dist/components/DropdownSelector/DropdownMenuItem/index2.cjs +0 -1
  63. package/dist/components/DropdownSelector/DropdownMenuItem/index2.cjs.map +1 -1
  64. package/dist/components/DropdownSelector/DropdownMenuItem/index2.js.map +1 -1
  65. package/dist/components/DropdownSelector/DropdownPopover.cjs +0 -1
  66. package/dist/components/DropdownSelector/DropdownPopover.cjs.map +1 -1
  67. package/dist/components/DropdownSelector/DropdownPopover.js.map +1 -1
  68. package/dist/components/DropdownSelector/ListItem/index.d.ts +1 -1
  69. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
  70. package/dist/components/DropdownSelector/ListItem/index2.cjs +0 -1
  71. package/dist/components/DropdownSelector/ListItem/index2.cjs.map +1 -1
  72. package/dist/components/DropdownSelector/ListItem/index2.js.map +1 -1
  73. package/dist/components/DropdownSelector/MenuItem/index.cjs +29 -2
  74. package/dist/components/DropdownSelector/MenuItem/index.cjs.map +1 -1
  75. package/dist/components/DropdownSelector/MenuItem/index.d.ts.map +1 -1
  76. package/dist/components/DropdownSelector/MenuItem/index.js +30 -2
  77. package/dist/components/DropdownSelector/MenuItem/index.js.map +1 -1
  78. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.cjs.map +1 -1
  79. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.js.map +1 -1
  80. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.cjs +0 -1
  81. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.cjs.map +1 -1
  82. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.js.map +1 -1
  83. package/dist/components/DropdownSelector/MenuItemGroup/index2.cjs +0 -1
  84. package/dist/components/DropdownSelector/MenuItemGroup/index2.cjs.map +1 -1
  85. package/dist/components/DropdownSelector/MenuItemGroup/index2.js.map +1 -1
  86. package/dist/components/DropdownSelector/MenuList/MenuListContext.cjs +0 -1
  87. package/dist/components/DropdownSelector/MenuList/MenuListContext.cjs.map +1 -1
  88. package/dist/components/DropdownSelector/MenuList/MenuListContext.js.map +1 -1
  89. package/dist/components/DropdownSelector/MenuList/index2.cjs +0 -1
  90. package/dist/components/DropdownSelector/MenuList/index2.cjs.map +1 -1
  91. package/dist/components/DropdownSelector/MenuList/index2.js.map +1 -1
  92. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.cjs +1 -1
  93. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.cjs.map +1 -1
  94. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.js.map +1 -1
  95. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  96. package/dist/components/DropdownSelector/Popover/index2.cjs +18 -1
  97. package/dist/components/DropdownSelector/Popover/index2.cjs.map +1 -1
  98. package/dist/components/DropdownSelector/Popover/index2.js +19 -1
  99. package/dist/components/DropdownSelector/Popover/index2.js.map +1 -1
  100. package/dist/components/DropdownSelector/Popover/usePreventScroll.cjs +0 -1
  101. package/dist/components/DropdownSelector/Popover/usePreventScroll.cjs.map +1 -1
  102. package/dist/components/DropdownSelector/Popover/usePreventScroll.js.map +1 -1
  103. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  104. package/dist/components/DropdownSelector/index2.cjs +27 -10
  105. package/dist/components/DropdownSelector/index2.cjs.map +1 -1
  106. package/dist/components/DropdownSelector/index2.js +26 -9
  107. package/dist/components/DropdownSelector/index2.js.map +1 -1
  108. package/dist/components/DropdownSelector/utils/findPreviewRecursive.cjs +1 -1
  109. package/dist/components/DropdownSelector/utils/findPreviewRecursive.cjs.map +1 -1
  110. package/dist/components/DropdownSelector/utils/findPreviewRecursive.js.map +1 -1
  111. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  112. package/dist/components/FieldLabel/index2.cjs +1 -1
  113. package/dist/components/FieldLabel/index2.cjs.map +1 -1
  114. package/dist/components/FieldLabel/index2.js.map +1 -1
  115. package/dist/components/HintText/index2.cjs +0 -1
  116. package/dist/components/HintText/index2.cjs.map +1 -1
  117. package/dist/components/HintText/index2.js.map +1 -1
  118. package/dist/components/Icon/index.cjs +1 -1
  119. package/dist/components/Icon/index.cjs.map +1 -1
  120. package/dist/components/Icon/index.d.ts.map +1 -1
  121. package/dist/components/Icon/index.js.map +1 -1
  122. package/dist/components/IconButton/index.d.ts +1 -1
  123. package/dist/components/IconButton/index.d.ts.map +1 -1
  124. package/dist/components/IconButton/index2.cjs +1 -1
  125. package/dist/components/IconButton/index2.cjs.map +1 -1
  126. package/dist/components/IconButton/index2.js.map +1 -1
  127. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  128. package/dist/components/LoadingSpinner/index2.cjs +0 -1
  129. package/dist/components/LoadingSpinner/index2.cjs.map +1 -1
  130. package/dist/components/LoadingSpinner/index2.js.map +1 -1
  131. package/dist/components/Modal/Dialog/index2.cjs +1 -1
  132. package/dist/components/Modal/Dialog/index2.cjs.map +1 -1
  133. package/dist/components/Modal/Dialog/index2.js.map +1 -1
  134. package/dist/components/Modal/ModalBackgroundContext.cjs +1 -1
  135. package/dist/components/Modal/ModalBackgroundContext.cjs.map +1 -1
  136. package/dist/components/Modal/ModalBackgroundContext.js.map +1 -1
  137. package/dist/components/Modal/ModalPlumbing.d.ts +3 -3
  138. package/dist/components/Modal/ModalPlumbing2.cjs +0 -1
  139. package/dist/components/Modal/ModalPlumbing2.cjs.map +1 -1
  140. package/dist/components/Modal/ModalPlumbing2.js.map +1 -1
  141. package/dist/components/Modal/index.d.ts.map +1 -1
  142. package/dist/components/Modal/index2.cjs +1 -1
  143. package/dist/components/Modal/index2.cjs.map +1 -1
  144. package/dist/components/Modal/index2.js.map +1 -1
  145. package/dist/components/Modal/useCustomModalOverlay.cjs +1 -1
  146. package/dist/components/Modal/useCustomModalOverlay.cjs.map +1 -1
  147. package/dist/components/Modal/useCustomModalOverlay.js.map +1 -1
  148. package/dist/components/Modal/useTransitionPresence.cjs +1 -3
  149. package/dist/components/Modal/useTransitionPresence.cjs.map +1 -1
  150. package/dist/components/Modal/useTransitionPresence.js +1 -2
  151. package/dist/components/Modal/useTransitionPresence.js.map +1 -1
  152. package/dist/components/MultiSelect/context.cjs +0 -1
  153. package/dist/components/MultiSelect/context.cjs.map +1 -1
  154. package/dist/components/MultiSelect/context.js.map +1 -1
  155. package/dist/components/MultiSelect/index.d.ts +1 -1
  156. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  157. package/dist/components/MultiSelect/index2.cjs +2 -2
  158. package/dist/components/MultiSelect/index2.cjs.map +1 -1
  159. package/dist/components/MultiSelect/index2.js.map +1 -1
  160. package/dist/components/Pagination/PaginationContext.cjs +0 -1
  161. package/dist/components/Pagination/PaginationContext.cjs.map +1 -1
  162. package/dist/components/Pagination/PaginationContext.js.map +1 -1
  163. package/dist/components/Pagination/helper.cjs.map +1 -1
  164. package/dist/components/Pagination/helper.js.map +1 -1
  165. package/dist/components/Pagination/index2.cjs +26 -135
  166. package/dist/components/Pagination/index2.cjs.map +1 -1
  167. package/dist/components/Pagination/index2.js +86 -182
  168. package/dist/components/Pagination/index2.js.map +1 -1
  169. package/dist/components/Radio/RadioGroup/index2.cjs +1 -1
  170. package/dist/components/Radio/RadioGroup/index2.cjs.map +1 -1
  171. package/dist/components/Radio/RadioGroup/index2.js.map +1 -1
  172. package/dist/components/Radio/RadioGroupContext.cjs.map +1 -1
  173. package/dist/components/Radio/RadioGroupContext.js.map +1 -1
  174. package/dist/components/Radio/RadioInput/index.d.ts.map +1 -1
  175. package/dist/components/Radio/RadioInput/index2.cjs +0 -1
  176. package/dist/components/Radio/RadioInput/index2.cjs.map +1 -1
  177. package/dist/components/Radio/RadioInput/index2.js.map +1 -1
  178. package/dist/components/Radio/index.d.ts.map +1 -1
  179. package/dist/components/Radio/index2.cjs +2 -2
  180. package/dist/components/Radio/index2.cjs.map +1 -1
  181. package/dist/components/Radio/index2.js.map +1 -1
  182. package/dist/components/SegmentedControl/RadioGroupContext.cjs +1 -1
  183. package/dist/components/SegmentedControl/RadioGroupContext.cjs.map +1 -1
  184. package/dist/components/SegmentedControl/RadioGroupContext.js.map +1 -1
  185. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  186. package/dist/components/SegmentedControl/index2.cjs +1 -1
  187. package/dist/components/SegmentedControl/index2.cjs.map +1 -1
  188. package/dist/components/SegmentedControl/index2.js.map +1 -1
  189. package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -1
  190. package/dist/components/Switch/SwitchInput/index2.cjs +0 -1
  191. package/dist/components/Switch/SwitchInput/index2.cjs.map +1 -1
  192. package/dist/components/Switch/SwitchInput/index2.js.map +1 -1
  193. package/dist/components/Switch/SwitchWithLabel.cjs +1 -1
  194. package/dist/components/Switch/SwitchWithLabel.cjs.map +1 -1
  195. package/dist/components/Switch/SwitchWithLabel.d.ts +2 -2
  196. package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -1
  197. package/dist/components/Switch/SwitchWithLabel.js.map +1 -1
  198. package/dist/components/Switch/index.d.ts +1 -1
  199. package/dist/components/Switch/index.d.ts.map +1 -1
  200. package/dist/components/Switch/index2.cjs +0 -1
  201. package/dist/components/Switch/index2.cjs.map +1 -1
  202. package/dist/components/Switch/index2.js.map +1 -1
  203. package/dist/components/TagItem/index.d.ts +1 -1
  204. package/dist/components/TagItem/index.d.ts.map +1 -1
  205. package/dist/components/TagItem/index2.cjs +1 -1
  206. package/dist/components/TagItem/index2.cjs.map +1 -1
  207. package/dist/components/TagItem/index2.js.map +1 -1
  208. package/dist/components/TextArea/index.d.ts.map +1 -1
  209. package/dist/components/TextArea/index2.cjs +0 -1
  210. package/dist/components/TextArea/index2.cjs.map +1 -1
  211. package/dist/components/TextArea/index2.js.map +1 -1
  212. package/dist/components/TextEllipsis/helper.cjs +2 -1
  213. package/dist/components/TextEllipsis/helper.cjs.map +1 -1
  214. package/dist/components/TextEllipsis/helper.d.ts.map +1 -1
  215. package/dist/components/TextEllipsis/helper.js +1 -1
  216. package/dist/components/TextEllipsis/helper.js.map +1 -1
  217. package/dist/components/TextEllipsis/index2.cjs +14 -98
  218. package/dist/components/TextEllipsis/index2.cjs.map +1 -1
  219. package/dist/components/TextEllipsis/index2.js +14 -93
  220. package/dist/components/TextEllipsis/index2.js.map +1 -1
  221. package/dist/components/TextField/AssistiveText/index.d.ts +1 -1
  222. package/dist/components/TextField/AssistiveText/index2.cjs.map +1 -1
  223. package/dist/components/TextField/AssistiveText/index2.js.map +1 -1
  224. package/dist/components/TextField/index.d.ts +1 -1
  225. package/dist/components/TextField/index.d.ts.map +1 -1
  226. package/dist/components/TextField/index2.cjs +1 -1
  227. package/dist/components/TextField/index2.cjs.map +1 -1
  228. package/dist/components/TextField/index2.js.map +1 -1
  229. package/dist/components/TextField/useFocusWithClick.cjs +0 -1
  230. package/dist/components/TextField/useFocusWithClick.cjs.map +1 -1
  231. package/dist/components/TextField/useFocusWithClick.js.map +1 -1
  232. package/dist/core/CharcoalProvider.cjs +1 -1
  233. package/dist/core/CharcoalProvider.cjs.map +1 -1
  234. package/dist/core/CharcoalProvider.js.map +1 -1
  235. package/dist/core/SSRProvider.cjs +1 -1
  236. package/dist/core/SSRProvider.cjs.map +1 -1
  237. package/dist/core/SSRProvider.js +1 -1
  238. package/dist/core/SSRProvider.js.map +1 -1
  239. package/dist/core/SetThemeScript.cjs +0 -1
  240. package/dist/core/SetThemeScript.cjs.map +1 -1
  241. package/dist/core/SetThemeScript.js.map +1 -1
  242. package/dist/core/themeHelper.cjs +0 -1
  243. package/dist/core/themeHelper.cjs.map +1 -1
  244. package/dist/core/themeHelper.d.ts +2 -2
  245. package/dist/core/themeHelper.d.ts.map +1 -1
  246. package/dist/core/themeHelper.js.map +1 -1
  247. package/dist/index.cjs +22 -23
  248. package/dist/index.css +1000 -1000
  249. package/dist/layered.css +1000 -1000
  250. package/dist/layered.css.map +1 -1
  251. package/package.json +10 -10
  252. package/src/_lib/compat.ts +1 -7
  253. package/src/components/Carousel/index.browser.test.tsx +1 -1
  254. package/src/components/Carousel/intersectionObserver.test.ts +12 -12
  255. package/src/components/Carousel/resizeObserver.test.ts +1 -1
  256. package/src/components/DropdownSelector/MenuItem/index.tsx +40 -2
  257. package/src/components/DropdownSelector/Popover/index.tsx +20 -1
  258. package/src/components/DropdownSelector/index.browser.test.tsx +94 -0
  259. package/src/components/DropdownSelector/index.test.tsx +57 -2
  260. package/src/components/DropdownSelector/index.tsx +37 -12
  261. package/src/components/FieldLabel/index.tsx +1 -2
  262. package/src/components/Icon/index.tsx +2 -1
  263. package/src/components/Modal/__snapshots__/index.css.snap +1 -0
  264. package/src/components/TextEllipsis/TextEllipsis.story.tsx +1 -1
  265. package/src/css.d.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"store.cjs","names":["Store","Readonly","dispatch","action","Action","subscribe","listener","getSnapshot","State","createStore","reducer","state","initialState","listeners","Set","add","delete"],"sources":["../../../src/components/Carousel/store.ts"],"sourcesContent":["export type Store<State, Action> = Readonly<{\n dispatch: (action: Action) => void\n subscribe: (listener: () => void) => () => void\n getSnapshot: () => State\n}>\n\nexport function createStore<State, Action>(\n reducer: (state: State, action: Action) => State,\n initialState: State,\n): Store<State, Action> {\n let state = initialState\n const listeners = new Set<() => void>()\n\n return {\n dispatch(action) {\n state = reducer(state, action)\n for (const listener of listeners) listener()\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n getSnapshot: () => state,\n }\n}\n"],"mappings":";;;AAMA,SAAgBS,YACdC,SACAE,cACsB;CACtB,IAAID,QAAQC;CACZ,MAAMC,4BAAY,IAAIC,KAAiB;CAEvC,OAAO;EACLZ,SAASC,QAAQ;GACfQ,QAAQD,QAAQC,OAAOR,OAAO;GAC9B,KAAK,MAAMG,YAAYO,WAAWP,UAAU;;EAE9CD,UAAUC,UAAU;GAClBO,UAAUE,IAAIT,SAAS;GACvB,aAAa;IACXO,UAAUG,OAAOV,SAAS;;;EAG9BC,mBAAmBI;EACpB"}
1
+ {"version":3,"file":"store.cjs","names":[],"sources":["../../../src/components/Carousel/store.ts"],"sourcesContent":["export type Store<State, Action> = Readonly<{\n dispatch: (action: Action) => void\n subscribe: (listener: () => void) => () => void\n getSnapshot: () => State\n}>\n\nexport function createStore<State, Action>(\n reducer: (state: State, action: Action) => State,\n initialState: State,\n): Store<State, Action> {\n let state = initialState\n const listeners = new Set<() => void>()\n\n return {\n dispatch(action) {\n state = reducer(state, action)\n for (const listener of listeners) listener()\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n getSnapshot: () => state,\n }\n}\n"],"mappings":";;;AAMA,SAAgB,YACd,SACA,cACsB;CACtB,IAAI,QAAQ;CACZ,MAAM,4BAAY,IAAI,IAAgB;CAEtC,OAAO;EACL,SAAS,QAAQ;GACf,QAAQ,QAAQ,OAAO,MAAM;GAC7B,KAAK,MAAM,YAAY,WAAW,SAAS;EAC7C;EACA,UAAU,UAAU;GAClB,UAAU,IAAI,QAAQ;GACtB,aAAa;IACX,UAAU,OAAO,QAAQ;GAC3B;EACF;EACA,mBAAmB;CACrB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","names":["Store","Readonly","dispatch","action","Action","subscribe","listener","getSnapshot","State","createStore","reducer","state","initialState","listeners","Set","add","delete"],"sources":["../../../src/components/Carousel/store.ts"],"sourcesContent":["export type Store<State, Action> = Readonly<{\n dispatch: (action: Action) => void\n subscribe: (listener: () => void) => () => void\n getSnapshot: () => State\n}>\n\nexport function createStore<State, Action>(\n reducer: (state: State, action: Action) => State,\n initialState: State,\n): Store<State, Action> {\n let state = initialState\n const listeners = new Set<() => void>()\n\n return {\n dispatch(action) {\n state = reducer(state, action)\n for (const listener of listeners) listener()\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n getSnapshot: () => state,\n }\n}\n"],"mappings":";;AAMA,SAAgBS,YACdC,SACAE,cACsB;CACtB,IAAID,QAAQC;CACZ,MAAMC,4BAAY,IAAIC,KAAiB;CAEvC,OAAO;EACLZ,SAASC,QAAQ;GACfQ,QAAQD,QAAQC,OAAOR,OAAO;GAC9B,KAAK,MAAMG,YAAYO,WAAWP,UAAU;;EAE9CD,UAAUC,UAAU;GAClBO,UAAUE,IAAIT,SAAS;GACvB,aAAa;IACXO,UAAUG,OAAOV,SAAS;;;EAG9BC,mBAAmBI;EACpB"}
1
+ {"version":3,"file":"store.js","names":[],"sources":["../../../src/components/Carousel/store.ts"],"sourcesContent":["export type Store<State, Action> = Readonly<{\n dispatch: (action: Action) => void\n subscribe: (listener: () => void) => () => void\n getSnapshot: () => State\n}>\n\nexport function createStore<State, Action>(\n reducer: (state: State, action: Action) => State,\n initialState: State,\n): Store<State, Action> {\n let state = initialState\n const listeners = new Set<() => void>()\n\n return {\n dispatch(action) {\n state = reducer(state, action)\n for (const listener of listeners) listener()\n },\n subscribe(listener) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n getSnapshot: () => state,\n }\n}\n"],"mappings":";;AAMA,SAAgB,YACd,SACA,cACsB;CACtB,IAAI,QAAQ;CACZ,MAAM,4BAAY,IAAI,IAAgB;CAEtC,OAAO;EACL,SAAS,QAAQ;GACf,QAAQ,QAAQ,OAAO,MAAM;GAC7B,KAAK,MAAM,YAAY,WAAW,SAAS;EAC7C;EACA,UAAU,UAAU;GAClB,UAAU,IAAI,QAAQ;GACtB,aAAa;IACX,UAAU,OAAO,QAAQ;GAC3B;EACF;EACA,mBAAmB;CACrB;AACF"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_useIsomorphicLayoutEffect = require('../../_lib/useIsomorphicLayoutEffect.cjs');
4
3
  let react = require("react");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"useCarouselScroller.cjs","names":["useCallback","useEffect","useRef","RefObject","useIsomorphicLayoutEffect","CarouselStore","ScrollAlign","ScrollStep","INTERACTION_EVENTS","const","CarouselScrollerOptions","Readonly","align","offset","scrollStep","onScroll","left","onResize","width","onScrollStateChange","canScroll","CarouselScrollerResult","scrollByStep","direction","onItemResize","resetScroll","useCarouselScroller","scrollerRef","HTMLElement","store","itemCount","options","initialScrollActive","callbacksRef","current","prevCanScroll","updateScrollState","el","scrollLeft","scrollWidth","clientWidth","canPrev","canNext","dispatch","type","applyInitialScroll","maxScroll","scrollTo","Math","max","min","behavior","handleScroll","addEventListener","passive","removeEventListener","ResizeObserver","ro","observe","disconnect","stop","delta","scrollBy"],"sources":["../../../src/components/Carousel/useCarouselScroller.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, type RefObject } from 'react'\nimport { useIsomorphicLayoutEffect } from '../../_lib/useIsomorphicLayoutEffect'\nimport type { CarouselStore } from './carouselStore'\nimport type { ScrollAlign, ScrollStep } from './index'\n\nconst INTERACTION_EVENTS = ['pointerdown', 'wheel', 'touchstart'] as const\n\nexport type CarouselScrollerOptions = Readonly<{\n align: ScrollAlign\n offset: number\n scrollStep: ScrollStep\n onScroll?: (left: number) => void\n onResize?: (width: number) => void\n onScrollStateChange?: (canScroll: boolean) => void\n}>\n\nexport type CarouselScrollerResult = Readonly<{\n scrollByStep: (direction: 'prev' | 'next') => void\n onItemResize: () => void\n resetScroll: () => void\n}>\n\nexport function useCarouselScroller(\n scrollerRef: RefObject<HTMLElement | null>,\n store: CarouselStore,\n itemCount: number,\n options: CarouselScrollerOptions,\n): CarouselScrollerResult {\n const { align, offset, scrollStep, onScroll, onResize, onScrollStateChange } =\n options\n const initialScrollActive = useRef(true)\n\n // コールバックは最新参照を ref に保持し、リスナーの貼り直しを避ける。\n const callbacksRef = useRef({ onScroll, onResize, onScrollStateChange })\n useEffect(() => {\n callbacksRef.current = { onScroll, onResize, onScrollStateChange }\n })\n\n // onScrollStateChange は canScroll(=canPrev||canNext) が変化した時だけ発火する。\n const prevCanScroll = useRef<boolean | null>(null)\n\n const updateScrollState = useCallback(() => {\n const el = scrollerRef.current\n if (!el) return\n const { scrollLeft, scrollWidth, clientWidth } = el\n const canPrev = scrollLeft > 1\n const canNext = scrollLeft < scrollWidth - clientWidth - 1\n store.dispatch({ type: 'setScrollState', canPrev, canNext })\n const canScroll = canPrev || canNext\n if (prevCanScroll.current !== canScroll) {\n prevCanScroll.current = canScroll\n callbacksRef.current.onScrollStateChange?.(canScroll)\n }\n }, [scrollerRef, store])\n\n const applyInitialScroll = useCallback(() => {\n const el = scrollerRef.current\n if (!el || !initialScrollActive.current) return\n const maxScroll = el.scrollWidth - el.clientWidth\n let left = offset\n switch (align) {\n case 'center':\n left = maxScroll / 2 + offset\n break\n case 'right':\n left = maxScroll + offset\n break\n }\n // scrollLeft 代入は CSS の scroll-behavior: smooth の対象になり\n // 初期位置決めがアニメーションしてしまうため、instant で確定させる。\n el.scrollTo({\n left: Math.max(0, Math.min(left, maxScroll)),\n behavior: 'instant',\n })\n }, [scrollerRef, align, offset])\n\n // canPrev/canNext: scroll で更新。onScroll もここから発火。itemCount 変化で貼り直し。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el) return\n updateScrollState()\n const handleScroll = () => {\n updateScrollState()\n callbacksRef.current.onScroll?.(el.scrollLeft)\n }\n el.addEventListener('scroll', handleScroll, { passive: true })\n return () => el.removeEventListener('scroll', handleScroll)\n }, [scrollerRef, updateScrollState, itemCount])\n\n // scroller 幅の変化で onResize(clientWidth) を通知し、状態と初期位置を再計算する。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el || typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver(() => {\n applyInitialScroll()\n updateScrollState()\n callbacksRef.current.onResize?.(el.clientWidth)\n })\n ro.observe(el)\n return () => ro.disconnect()\n }, [scrollerRef, applyInitialScroll, updateScrollState])\n\n // 初期スクロール適用 + ユーザー操作で打ち切り。\n useIsomorphicLayoutEffect(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n // 初期位置適用後の scrollLeft で canPrev/canNext を確定させる\n // (center/right 初期化で scroll イベント待ちにならないように)。\n updateScrollState()\n const el = scrollerRef.current\n if (!el) return\n const stop = () => {\n initialScrollActive.current = false\n }\n for (const type of INTERACTION_EVENTS) el.addEventListener(type, stop, true)\n return () => {\n for (const type of INTERACTION_EVENTS)\n el.removeEventListener(type, stop, true)\n }\n }, [scrollerRef, applyInitialScroll, updateScrollState, itemCount])\n\n const onItemResize = useCallback(() => {\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n // defaultScroll の初期位置へ戻す(命令的 API: CarouselHandlerRef.resetScroll)。\n const resetScroll = useCallback(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n const scrollByStep = useCallback(\n (direction: 'prev' | 'next') => {\n const el = scrollerRef.current\n if (!el) return\n initialScrollActive.current = false\n const { clientWidth, scrollWidth, scrollLeft } = el\n // 進む量(px)の絶対値。符号は direction で付ける。\n const delta =\n typeof scrollStep === 'function'\n ? scrollStep({ clientWidth, scrollWidth, scrollLeft, direction })\n : clientWidth * scrollStep\n el.scrollBy({\n left: direction === 'next' ? delta : -delta,\n behavior: 'smooth',\n })\n },\n [scrollerRef, scrollStep],\n )\n\n return { scrollByStep, onItemResize, resetScroll }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"useCarouselScroller.cjs","names":[],"sources":["../../../src/components/Carousel/useCarouselScroller.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, type RefObject } from 'react'\nimport { useIsomorphicLayoutEffect } from '../../_lib/useIsomorphicLayoutEffect'\nimport type { CarouselStore } from './carouselStore'\nimport type { ScrollAlign, ScrollStep } from './index'\n\nconst INTERACTION_EVENTS = ['pointerdown', 'wheel', 'touchstart'] as const\n\nexport type CarouselScrollerOptions = Readonly<{\n align: ScrollAlign\n offset: number\n scrollStep: ScrollStep\n onScroll?: (left: number) => void\n onResize?: (width: number) => void\n onScrollStateChange?: (canScroll: boolean) => void\n}>\n\nexport type CarouselScrollerResult = Readonly<{\n scrollByStep: (direction: 'prev' | 'next') => void\n onItemResize: () => void\n resetScroll: () => void\n}>\n\nexport function useCarouselScroller(\n scrollerRef: RefObject<HTMLElement | null>,\n store: CarouselStore,\n itemCount: number,\n options: CarouselScrollerOptions,\n): CarouselScrollerResult {\n const { align, offset, scrollStep, onScroll, onResize, onScrollStateChange } =\n options\n const initialScrollActive = useRef(true)\n\n // コールバックは最新参照を ref に保持し、リスナーの貼り直しを避ける。\n const callbacksRef = useRef({ onScroll, onResize, onScrollStateChange })\n useEffect(() => {\n callbacksRef.current = { onScroll, onResize, onScrollStateChange }\n })\n\n // onScrollStateChange は canScroll(=canPrev||canNext) が変化した時だけ発火する。\n const prevCanScroll = useRef<boolean | null>(null)\n\n const updateScrollState = useCallback(() => {\n const el = scrollerRef.current\n if (!el) return\n const { scrollLeft, scrollWidth, clientWidth } = el\n const canPrev = scrollLeft > 1\n const canNext = scrollLeft < scrollWidth - clientWidth - 1\n store.dispatch({ type: 'setScrollState', canPrev, canNext })\n const canScroll = canPrev || canNext\n if (prevCanScroll.current !== canScroll) {\n prevCanScroll.current = canScroll\n callbacksRef.current.onScrollStateChange?.(canScroll)\n }\n }, [scrollerRef, store])\n\n const applyInitialScroll = useCallback(() => {\n const el = scrollerRef.current\n if (!el || !initialScrollActive.current) return\n const maxScroll = el.scrollWidth - el.clientWidth\n let left = offset\n switch (align) {\n case 'center':\n left = maxScroll / 2 + offset\n break\n case 'right':\n left = maxScroll + offset\n break\n }\n // scrollLeft 代入は CSS の scroll-behavior: smooth の対象になり\n // 初期位置決めがアニメーションしてしまうため、instant で確定させる。\n el.scrollTo({\n left: Math.max(0, Math.min(left, maxScroll)),\n behavior: 'instant',\n })\n }, [scrollerRef, align, offset])\n\n // canPrev/canNext: scroll で更新。onScroll もここから発火。itemCount 変化で貼り直し。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el) return\n updateScrollState()\n const handleScroll = () => {\n updateScrollState()\n callbacksRef.current.onScroll?.(el.scrollLeft)\n }\n el.addEventListener('scroll', handleScroll, { passive: true })\n return () => el.removeEventListener('scroll', handleScroll)\n }, [scrollerRef, updateScrollState, itemCount])\n\n // scroller 幅の変化で onResize(clientWidth) を通知し、状態と初期位置を再計算する。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el || typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver(() => {\n applyInitialScroll()\n updateScrollState()\n callbacksRef.current.onResize?.(el.clientWidth)\n })\n ro.observe(el)\n return () => ro.disconnect()\n }, [scrollerRef, applyInitialScroll, updateScrollState])\n\n // 初期スクロール適用 + ユーザー操作で打ち切り。\n useIsomorphicLayoutEffect(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n // 初期位置適用後の scrollLeft で canPrev/canNext を確定させる\n // (center/right 初期化で scroll イベント待ちにならないように)。\n updateScrollState()\n const el = scrollerRef.current\n if (!el) return\n const stop = () => {\n initialScrollActive.current = false\n }\n for (const type of INTERACTION_EVENTS) el.addEventListener(type, stop, true)\n return () => {\n for (const type of INTERACTION_EVENTS)\n el.removeEventListener(type, stop, true)\n }\n }, [scrollerRef, applyInitialScroll, updateScrollState, itemCount])\n\n const onItemResize = useCallback(() => {\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n // defaultScroll の初期位置へ戻す(命令的 API: CarouselHandlerRef.resetScroll)。\n const resetScroll = useCallback(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n const scrollByStep = useCallback(\n (direction: 'prev' | 'next') => {\n const el = scrollerRef.current\n if (!el) return\n initialScrollActive.current = false\n const { clientWidth, scrollWidth, scrollLeft } = el\n // 進む量(px)の絶対値。符号は direction で付ける。\n const delta =\n typeof scrollStep === 'function'\n ? scrollStep({ clientWidth, scrollWidth, scrollLeft, direction })\n : clientWidth * scrollStep\n el.scrollBy({\n left: direction === 'next' ? delta : -delta,\n behavior: 'smooth',\n })\n },\n [scrollerRef, scrollStep],\n )\n\n return { scrollByStep, onItemResize, resetScroll }\n}\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCarouselScroller.js","names":["useCallback","useEffect","useRef","RefObject","useIsomorphicLayoutEffect","CarouselStore","ScrollAlign","ScrollStep","INTERACTION_EVENTS","const","CarouselScrollerOptions","Readonly","align","offset","scrollStep","onScroll","left","onResize","width","onScrollStateChange","canScroll","CarouselScrollerResult","scrollByStep","direction","onItemResize","resetScroll","useCarouselScroller","scrollerRef","HTMLElement","store","itemCount","options","initialScrollActive","callbacksRef","current","prevCanScroll","updateScrollState","el","scrollLeft","scrollWidth","clientWidth","canPrev","canNext","dispatch","type","applyInitialScroll","maxScroll","scrollTo","Math","max","min","behavior","handleScroll","addEventListener","passive","removeEventListener","ResizeObserver","ro","observe","disconnect","stop","delta","scrollBy"],"sources":["../../../src/components/Carousel/useCarouselScroller.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, type RefObject } from 'react'\nimport { useIsomorphicLayoutEffect } from '../../_lib/useIsomorphicLayoutEffect'\nimport type { CarouselStore } from './carouselStore'\nimport type { ScrollAlign, ScrollStep } from './index'\n\nconst INTERACTION_EVENTS = ['pointerdown', 'wheel', 'touchstart'] as const\n\nexport type CarouselScrollerOptions = Readonly<{\n align: ScrollAlign\n offset: number\n scrollStep: ScrollStep\n onScroll?: (left: number) => void\n onResize?: (width: number) => void\n onScrollStateChange?: (canScroll: boolean) => void\n}>\n\nexport type CarouselScrollerResult = Readonly<{\n scrollByStep: (direction: 'prev' | 'next') => void\n onItemResize: () => void\n resetScroll: () => void\n}>\n\nexport function useCarouselScroller(\n scrollerRef: RefObject<HTMLElement | null>,\n store: CarouselStore,\n itemCount: number,\n options: CarouselScrollerOptions,\n): CarouselScrollerResult {\n const { align, offset, scrollStep, onScroll, onResize, onScrollStateChange } =\n options\n const initialScrollActive = useRef(true)\n\n // コールバックは最新参照を ref に保持し、リスナーの貼り直しを避ける。\n const callbacksRef = useRef({ onScroll, onResize, onScrollStateChange })\n useEffect(() => {\n callbacksRef.current = { onScroll, onResize, onScrollStateChange }\n })\n\n // onScrollStateChange は canScroll(=canPrev||canNext) が変化した時だけ発火する。\n const prevCanScroll = useRef<boolean | null>(null)\n\n const updateScrollState = useCallback(() => {\n const el = scrollerRef.current\n if (!el) return\n const { scrollLeft, scrollWidth, clientWidth } = el\n const canPrev = scrollLeft > 1\n const canNext = scrollLeft < scrollWidth - clientWidth - 1\n store.dispatch({ type: 'setScrollState', canPrev, canNext })\n const canScroll = canPrev || canNext\n if (prevCanScroll.current !== canScroll) {\n prevCanScroll.current = canScroll\n callbacksRef.current.onScrollStateChange?.(canScroll)\n }\n }, [scrollerRef, store])\n\n const applyInitialScroll = useCallback(() => {\n const el = scrollerRef.current\n if (!el || !initialScrollActive.current) return\n const maxScroll = el.scrollWidth - el.clientWidth\n let left = offset\n switch (align) {\n case 'center':\n left = maxScroll / 2 + offset\n break\n case 'right':\n left = maxScroll + offset\n break\n }\n // scrollLeft 代入は CSS の scroll-behavior: smooth の対象になり\n // 初期位置決めがアニメーションしてしまうため、instant で確定させる。\n el.scrollTo({\n left: Math.max(0, Math.min(left, maxScroll)),\n behavior: 'instant',\n })\n }, [scrollerRef, align, offset])\n\n // canPrev/canNext: scroll で更新。onScroll もここから発火。itemCount 変化で貼り直し。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el) return\n updateScrollState()\n const handleScroll = () => {\n updateScrollState()\n callbacksRef.current.onScroll?.(el.scrollLeft)\n }\n el.addEventListener('scroll', handleScroll, { passive: true })\n return () => el.removeEventListener('scroll', handleScroll)\n }, [scrollerRef, updateScrollState, itemCount])\n\n // scroller 幅の変化で onResize(clientWidth) を通知し、状態と初期位置を再計算する。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el || typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver(() => {\n applyInitialScroll()\n updateScrollState()\n callbacksRef.current.onResize?.(el.clientWidth)\n })\n ro.observe(el)\n return () => ro.disconnect()\n }, [scrollerRef, applyInitialScroll, updateScrollState])\n\n // 初期スクロール適用 + ユーザー操作で打ち切り。\n useIsomorphicLayoutEffect(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n // 初期位置適用後の scrollLeft で canPrev/canNext を確定させる\n // (center/right 初期化で scroll イベント待ちにならないように)。\n updateScrollState()\n const el = scrollerRef.current\n if (!el) return\n const stop = () => {\n initialScrollActive.current = false\n }\n for (const type of INTERACTION_EVENTS) el.addEventListener(type, stop, true)\n return () => {\n for (const type of INTERACTION_EVENTS)\n el.removeEventListener(type, stop, true)\n }\n }, [scrollerRef, applyInitialScroll, updateScrollState, itemCount])\n\n const onItemResize = useCallback(() => {\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n // defaultScroll の初期位置へ戻す(命令的 API: CarouselHandlerRef.resetScroll)。\n const resetScroll = useCallback(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n const scrollByStep = useCallback(\n (direction: 'prev' | 'next') => {\n const el = scrollerRef.current\n if (!el) return\n initialScrollActive.current = false\n const { clientWidth, scrollWidth, scrollLeft } = el\n // 進む量(px)の絶対値。符号は direction で付ける。\n const delta =\n typeof scrollStep === 'function'\n ? scrollStep({ clientWidth, scrollWidth, scrollLeft, direction })\n : clientWidth * scrollStep\n el.scrollBy({\n left: direction === 'next' ? delta : -delta,\n behavior: 'smooth',\n })\n },\n [scrollerRef, scrollStep],\n )\n\n return { scrollByStep, onItemResize, resetScroll }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"useCarouselScroller.js","names":[],"sources":["../../../src/components/Carousel/useCarouselScroller.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, type RefObject } from 'react'\nimport { useIsomorphicLayoutEffect } from '../../_lib/useIsomorphicLayoutEffect'\nimport type { CarouselStore } from './carouselStore'\nimport type { ScrollAlign, ScrollStep } from './index'\n\nconst INTERACTION_EVENTS = ['pointerdown', 'wheel', 'touchstart'] as const\n\nexport type CarouselScrollerOptions = Readonly<{\n align: ScrollAlign\n offset: number\n scrollStep: ScrollStep\n onScroll?: (left: number) => void\n onResize?: (width: number) => void\n onScrollStateChange?: (canScroll: boolean) => void\n}>\n\nexport type CarouselScrollerResult = Readonly<{\n scrollByStep: (direction: 'prev' | 'next') => void\n onItemResize: () => void\n resetScroll: () => void\n}>\n\nexport function useCarouselScroller(\n scrollerRef: RefObject<HTMLElement | null>,\n store: CarouselStore,\n itemCount: number,\n options: CarouselScrollerOptions,\n): CarouselScrollerResult {\n const { align, offset, scrollStep, onScroll, onResize, onScrollStateChange } =\n options\n const initialScrollActive = useRef(true)\n\n // コールバックは最新参照を ref に保持し、リスナーの貼り直しを避ける。\n const callbacksRef = useRef({ onScroll, onResize, onScrollStateChange })\n useEffect(() => {\n callbacksRef.current = { onScroll, onResize, onScrollStateChange }\n })\n\n // onScrollStateChange は canScroll(=canPrev||canNext) が変化した時だけ発火する。\n const prevCanScroll = useRef<boolean | null>(null)\n\n const updateScrollState = useCallback(() => {\n const el = scrollerRef.current\n if (!el) return\n const { scrollLeft, scrollWidth, clientWidth } = el\n const canPrev = scrollLeft > 1\n const canNext = scrollLeft < scrollWidth - clientWidth - 1\n store.dispatch({ type: 'setScrollState', canPrev, canNext })\n const canScroll = canPrev || canNext\n if (prevCanScroll.current !== canScroll) {\n prevCanScroll.current = canScroll\n callbacksRef.current.onScrollStateChange?.(canScroll)\n }\n }, [scrollerRef, store])\n\n const applyInitialScroll = useCallback(() => {\n const el = scrollerRef.current\n if (!el || !initialScrollActive.current) return\n const maxScroll = el.scrollWidth - el.clientWidth\n let left = offset\n switch (align) {\n case 'center':\n left = maxScroll / 2 + offset\n break\n case 'right':\n left = maxScroll + offset\n break\n }\n // scrollLeft 代入は CSS の scroll-behavior: smooth の対象になり\n // 初期位置決めがアニメーションしてしまうため、instant で確定させる。\n el.scrollTo({\n left: Math.max(0, Math.min(left, maxScroll)),\n behavior: 'instant',\n })\n }, [scrollerRef, align, offset])\n\n // canPrev/canNext: scroll で更新。onScroll もここから発火。itemCount 変化で貼り直し。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el) return\n updateScrollState()\n const handleScroll = () => {\n updateScrollState()\n callbacksRef.current.onScroll?.(el.scrollLeft)\n }\n el.addEventListener('scroll', handleScroll, { passive: true })\n return () => el.removeEventListener('scroll', handleScroll)\n }, [scrollerRef, updateScrollState, itemCount])\n\n // scroller 幅の変化で onResize(clientWidth) を通知し、状態と初期位置を再計算する。\n useIsomorphicLayoutEffect(() => {\n const el = scrollerRef.current\n if (!el || typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver(() => {\n applyInitialScroll()\n updateScrollState()\n callbacksRef.current.onResize?.(el.clientWidth)\n })\n ro.observe(el)\n return () => ro.disconnect()\n }, [scrollerRef, applyInitialScroll, updateScrollState])\n\n // 初期スクロール適用 + ユーザー操作で打ち切り。\n useIsomorphicLayoutEffect(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n // 初期位置適用後の scrollLeft で canPrev/canNext を確定させる\n // (center/right 初期化で scroll イベント待ちにならないように)。\n updateScrollState()\n const el = scrollerRef.current\n if (!el) return\n const stop = () => {\n initialScrollActive.current = false\n }\n for (const type of INTERACTION_EVENTS) el.addEventListener(type, stop, true)\n return () => {\n for (const type of INTERACTION_EVENTS)\n el.removeEventListener(type, stop, true)\n }\n }, [scrollerRef, applyInitialScroll, updateScrollState, itemCount])\n\n const onItemResize = useCallback(() => {\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n // defaultScroll の初期位置へ戻す(命令的 API: CarouselHandlerRef.resetScroll)。\n const resetScroll = useCallback(() => {\n initialScrollActive.current = true\n applyInitialScroll()\n updateScrollState()\n }, [applyInitialScroll, updateScrollState])\n\n const scrollByStep = useCallback(\n (direction: 'prev' | 'next') => {\n const el = scrollerRef.current\n if (!el) return\n initialScrollActive.current = false\n const { clientWidth, scrollWidth, scrollLeft } = el\n // 進む量(px)の絶対値。符号は direction で付ける。\n const delta =\n typeof scrollStep === 'function'\n ? scrollStep({ clientWidth, scrollWidth, scrollLeft, direction })\n : clientWidth * scrollStep\n el.scrollBy({\n left: direction === 'next' ? delta : -delta,\n behavior: 'smooth',\n })\n },\n [scrollerRef, scrollStep],\n )\n\n return { scrollByStep, onItemResize, resetScroll }\n}\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/CheckboxInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,KAAK,0BAA0B,GAAG;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,GACzD,IAAI,CAAC,UAAU,EAAE,MAAM,0BAA0B,GAAG,KAAK,CAAC,CAAA;;AAgC5D,wBAAkC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/CheckboxInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,KAAK,0BAA0B,GAAG;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,GACzD,IAAI,CAAC,UAAU,EAAE,MAAM,0BAA0B,GAAG,KAAK,CAAC,CAAA"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_useClassNames = require('../../../_lib/useClassNames.cjs');
4
3
  require('./index.cjs');
5
4
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["forwardRef","memo","useCallback","useClassNames","CharcoalCheckboxInputProps","invalid","onChange","checked","rounded","InputProps","React","HTMLProps","HTMLInputElement","CheckboxInputProps","Omit","CheckboxInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Checkbox/CheckboxInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalCheckboxInputProps = {\n invalid?: boolean\n onChange?: (checked: boolean) => void\n rounded?: boolean\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type CheckboxInputProps = CharcoalCheckboxInputProps &\n Omit<InputProps, keyof CharcoalCheckboxInputProps | 'ref'>\n\nconst CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function CheckboxInput(\n { onChange, checked, invalid, className, rounded, ...props },\n ref,\n ) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-checkbox-input', className)\n\n return (\n <input\n className={classNames}\n ref={ref}\n type=\"checkbox\"\n onChange={handleChange}\n aria-invalid={invalid}\n checked={checked}\n data-rounded={rounded}\n {...props}\n />\n )\n },\n)\n\nexport default memo(CheckboxInput)\n"],"mappings":";;;;;;;;AAgBA,MAAMe,sCACJ,SAASA,cACP,EAAET,UAAUC,SAASF,SAASW,WAAWR,SAAS,GAAGS,SACrDC,KACA;CACA,MAAMC,uCACHC,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbjB,WAAWgB,GAAGf,QAAQ;IAExB,CAACD,SACH,CAAC;CAID,OACE,2CAAC,SAAD;EACE,WAJeH,oCAAc,2BAA2Ba,UAInC;EAChBE;EACL,MAAK;EACL,UAAUC;EACV,gBAAcd;EACLE;EACT,gBAAcC;EACd,GAAIS;EACJ;EAGP;AAED,4CAAoBF,cAAc"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../../src/components/Checkbox/CheckboxInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalCheckboxInputProps = {\n invalid?: boolean\n onChange?: (checked: boolean) => void\n rounded?: boolean\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type CheckboxInputProps = CharcoalCheckboxInputProps &\n Omit<InputProps, keyof CharcoalCheckboxInputProps | 'ref'>\n\nconst CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function CheckboxInput(\n { onChange, checked, invalid, className, rounded, ...props },\n ref,\n ) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-checkbox-input', className)\n\n return (\n <input\n className={classNames}\n ref={ref}\n type=\"checkbox\"\n onChange={handleChange}\n aria-invalid={invalid}\n checked={checked}\n data-rounded={rounded}\n {...props}\n />\n )\n },\n)\n\nexport default memo(CheckboxInput)\n"],"mappings":";;;;;;;AAgBA,MAAM,sCACJ,SAAS,cACP,EAAE,UAAU,SAAS,SAAS,WAAW,SAAS,GAAG,SACrD,KACA;CACA,MAAM,uCACH,MAA2C;EAC1C,MAAM,KAAK,EAAE;EACb,WAAW,GAAG,OAAO;CACvB,GACA,CAAC,QAAQ,CACX;CAIA,OACE,2CAAC,SAAD;EACE,WAJe,oCAAc,2BAA2B,SAI7C;EACN;EACL,MAAK;EACL,UAAU;EACV,gBAAc;EACL;EACT,gBAAc;EACd,GAAI;CAAM;AAGhB,CACF;AAEA,4CAAoB,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["forwardRef","memo","useCallback","useClassNames","CharcoalCheckboxInputProps","invalid","onChange","checked","rounded","InputProps","React","HTMLProps","HTMLInputElement","CheckboxInputProps","Omit","CheckboxInput","className","props","ref","handleChange","e","ChangeEvent","el","currentTarget","classNames"],"sources":["../../../../src/components/Checkbox/CheckboxInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalCheckboxInputProps = {\n invalid?: boolean\n onChange?: (checked: boolean) => void\n rounded?: boolean\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type CheckboxInputProps = CharcoalCheckboxInputProps &\n Omit<InputProps, keyof CharcoalCheckboxInputProps | 'ref'>\n\nconst CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function CheckboxInput(\n { onChange, checked, invalid, className, rounded, ...props },\n ref,\n ) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-checkbox-input', className)\n\n return (\n <input\n className={classNames}\n ref={ref}\n type=\"checkbox\"\n onChange={handleChange}\n aria-invalid={invalid}\n checked={checked}\n data-rounded={rounded}\n {...props}\n />\n )\n },\n)\n\nexport default memo(CheckboxInput)\n"],"mappings":";;;;;;;AAgBA,MAAMe,gBAAgBf,WACpB,SAASe,cACP,EAAET,UAAUC,SAASF,SAASW,WAAWR,SAAS,GAAGS,SACrDC,KACA;CACA,MAAMC,eAAejB,aAClBkB,MAA2C;EAC1C,MAAME,KAAKF,EAAEG;EACbjB,WAAWgB,GAAGf,QAAQ;IAExB,CAACD,SACH,CAAC;CAID,OACE,oBAAC,SAAD;EACE,WAJeH,cAAc,2BAA2Ba,UAInC;EAChBE;EACL,MAAK;EACL,UAAUC;EACV,gBAAcd;EACLE;EACT,gBAAcC;EACd,GAAIS;EACJ;EAGP;AAED,4BAAehB,KAAKc,cAAc"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../../src/components/Checkbox/CheckboxInput/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo, useCallback } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\ntype CharcoalCheckboxInputProps = {\n invalid?: boolean\n onChange?: (checked: boolean) => void\n rounded?: boolean\n}\n\ntype InputProps = React.HTMLProps<HTMLInputElement>\n\nexport type CheckboxInputProps = CharcoalCheckboxInputProps &\n Omit<InputProps, keyof CharcoalCheckboxInputProps | 'ref'>\n\nconst CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function CheckboxInput(\n { onChange, checked, invalid, className, rounded, ...props },\n ref,\n ) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const el = e.currentTarget\n onChange?.(el.checked)\n },\n [onChange],\n )\n\n const classNames = useClassNames('charcoal-checkbox-input', className)\n\n return (\n <input\n className={classNames}\n ref={ref}\n type=\"checkbox\"\n onChange={handleChange}\n aria-invalid={invalid}\n checked={checked}\n data-rounded={rounded}\n {...props}\n />\n )\n },\n)\n\nexport default memo(CheckboxInput)\n"],"mappings":";;;;;;;AAgBA,MAAM,gBAAgB,WACpB,SAAS,cACP,EAAE,UAAU,SAAS,SAAS,WAAW,SAAS,GAAG,SACrD,KACA;CACA,MAAM,eAAe,aAClB,MAA2C;EAC1C,MAAM,KAAK,EAAE;EACb,WAAW,GAAG,OAAO;CACvB,GACA,CAAC,QAAQ,CACX;CAIA,OACE,oBAAC,SAAD;EACE,WAJe,cAAc,2BAA2B,SAI7C;EACN;EACL,MAAK;EACL,UAAU;EACV,gBAAc;EACL;EACT,gBAAc;EACd,GAAI;CAAM;AAGhB,CACF;AAEA,4BAAe,KAAK,aAAa"}
@@ -2,7 +2,7 @@
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_useClassNames = require('../../_lib/useClassNames.cjs');
4
4
  let react = require("react");
5
- react = require_runtime.__toESM(react);
5
+ react = require_runtime.__toESM(react, 1);
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
 
8
8
  //#region src/components/Checkbox/CheckboxWithLabel.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxWithLabel.cjs","names":["React","useClassNames","CheckboxWithLabel","memo","className","children","input","id","disabled","ReactNode","classNames"],"sources":["../../../src/components/Checkbox/CheckboxWithLabel.tsx"],"sourcesContent":["import React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const CheckboxWithLabel = React.memo(function CheckboxWithLabel({\n className,\n children,\n input,\n id,\n disabled,\n}: {\n children: React.ReactNode\n input: React.ReactNode\n disabled?: boolean\n className?: string\n id?: string\n}) {\n const classNames = useClassNames('charcoal-checkbox__label', className)\n return (\n <label htmlFor={id} aria-disabled={disabled} className={classNames}>\n {input}\n <div className=\"charcoal-checkbox__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;;;AAGA,MAAaE,oBAAoBF,cAAMG,KAAK,SAASD,kBAAkB,EACrEE,WACAC,UACAC,OACAC,IACAC,YAOC;CAED,OACE,4CAAC,SAAD;EAAO,SAASD;EAAI,iBAAeC;EAAU,WAF5BP,oCAAc,4BAA4BG,UAEO;YAAlE,CACGE,OACD,2CAAC,OAAD;GAAK,WAAU;GAAgCD;GAAc,EACvD;;EAEV"}
1
+ {"version":3,"file":"CheckboxWithLabel.cjs","names":[],"sources":["../../../src/components/Checkbox/CheckboxWithLabel.tsx"],"sourcesContent":["import React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const CheckboxWithLabel = React.memo(function CheckboxWithLabel({\n className,\n children,\n input,\n id,\n disabled,\n}: {\n children: React.ReactNode\n input: React.ReactNode\n disabled?: boolean\n className?: string\n id?: string\n}) {\n const classNames = useClassNames('charcoal-checkbox__label', className)\n return (\n <label htmlFor={id} aria-disabled={disabled} className={classNames}>\n {input}\n <div className=\"charcoal-checkbox__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;;;AAGA,MAAa,oBAAoB,cAAM,KAAK,SAAS,kBAAkB,EACrE,WACA,UACA,OACA,IACA,YAOC;CAED,OACE,4CAAC,SAAD;EAAO,SAAS;EAAI,iBAAe;EAAU,WAF5B,oCAAc,4BAA4B,SAEH;YAAxD,CACG,OACD,2CAAC,OAAD;GAAK,WAAU;GAAgC;EAAc,EACxD;;AAEX,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- export declare const CheckboxWithLabel: React.NamedExoticComponent<{
2
+ export declare const CheckboxWithLabel: React.MemoExoticComponent<({ className, children, input, id, disabled, }: {
3
3
  children: React.ReactNode;
4
4
  input: React.ReactNode;
5
5
  disabled?: boolean;
6
6
  className?: string;
7
7
  id?: string;
8
- }>;
8
+ }) => import("react/jsx-runtime").JSX.Element>;
9
9
  //# sourceMappingURL=CheckboxWithLabel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxWithLabel.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/CheckboxWithLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,eAAO,MAAM,iBAAiB;cAOlB,KAAK,CAAC,SAAS;WAClB,KAAK,CAAC,SAAS;eACX,OAAO;gBACN,MAAM;SACb,MAAM;EASX,CAAA"}
1
+ {"version":3,"file":"CheckboxWithLabel.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/CheckboxWithLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,eAAO,MAAM,iBAAiB,4EAM3B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,6CAQC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxWithLabel.js","names":["React","useClassNames","CheckboxWithLabel","memo","className","children","input","id","disabled","ReactNode","classNames"],"sources":["../../../src/components/Checkbox/CheckboxWithLabel.tsx"],"sourcesContent":["import React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const CheckboxWithLabel = React.memo(function CheckboxWithLabel({\n className,\n children,\n input,\n id,\n disabled,\n}: {\n children: React.ReactNode\n input: React.ReactNode\n disabled?: boolean\n className?: string\n id?: string\n}) {\n const classNames = useClassNames('charcoal-checkbox__label', className)\n return (\n <label htmlFor={id} aria-disabled={disabled} className={classNames}>\n {input}\n <div className=\"charcoal-checkbox__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;AAGA,MAAaE,oBAAoBF,MAAMG,KAAK,SAASD,kBAAkB,EACrEE,WACAC,UACAC,OACAC,IACAC,YAOC;CAED,OACE,qBAAC,SAAD;EAAO,SAASD;EAAI,iBAAeC;EAAU,WAF5BP,cAAc,4BAA4BG,UAEO;YAAlE,CACGE,OACD,oBAAC,OAAD;GAAK,WAAU;GAAgCD;GAAc,EACvD;;EAEV"}
1
+ {"version":3,"file":"CheckboxWithLabel.js","names":[],"sources":["../../../src/components/Checkbox/CheckboxWithLabel.tsx"],"sourcesContent":["import React from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\n\nexport const CheckboxWithLabel = React.memo(function CheckboxWithLabel({\n className,\n children,\n input,\n id,\n disabled,\n}: {\n children: React.ReactNode\n input: React.ReactNode\n disabled?: boolean\n className?: string\n id?: string\n}) {\n const classNames = useClassNames('charcoal-checkbox__label', className)\n return (\n <label htmlFor={id} aria-disabled={disabled} className={classNames}>\n {input}\n <div className=\"charcoal-checkbox__label_div\">{children}</div>\n </label>\n )\n})\n"],"mappings":";;;;;;AAGA,MAAa,oBAAoB,MAAM,KAAK,SAAS,kBAAkB,EACrE,WACA,UACA,OACA,IACA,YAOC;CAED,OACE,qBAAC,SAAD;EAAO,SAAS;EAAI,iBAAe;EAAU,WAF5B,cAAc,4BAA4B,SAEH;YAAxD,CACG,OACD,oBAAC,OAAD;GAAK,WAAU;GAAgC;EAAc,EACxD;;AAEX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAInE,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAA;;;;;;;;;;AA+B9C,wBAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAInE,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAA"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  require('./index.cjs');
4
3
  const require_index$1 = require('./CheckboxInput/index2.cjs');
5
4
  const require_CheckboxWithLabel = require('./CheckboxWithLabel.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["forwardRef","memo","CheckboxInput","CheckboxInputProps","CheckboxWithLabel","useId","CheckboxProps","Checkbox","HTMLInputElement","disabled","className","id","children","props","ref","htmlId","noChildren","undefined","input"],"sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo } from 'react'\nimport CheckboxInput, { CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxWithLabel } from './CheckboxWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type CheckboxProps = CheckboxInputProps\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function Checkbox({ disabled, className, id, children, ...props }, ref) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <CheckboxInput\n {...props}\n className={noChildren ? className : undefined}\n disabled={disabled}\n id={htmlId}\n ref={ref}\n />\n )\n if (noChildren) {\n return input\n }\n return (\n <CheckboxWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </CheckboxWithLabel>\n )\n },\n)\n\nexport default memo(Checkbox)\n"],"mappings":";;;;;;;;;;AASA,MAAMO,iCACJ,SAASA,SAAS,EAAEE,UAAUC,WAAWC,IAAIC,UAAU,GAAGC,SAASC,KAAK;CACtE,MAAMC,qCAAeJ,GAAG;CACxB,MAAMK,aAAaJ,aAAaK;CAChC,MAAMC,QACJ,2CAAC,yBAAD;EACE,GAAIL;EACJ,WAAWG,aAAaN,YAAYO;EAC1BR;EACV,IAAIM;EACCD;EAER;CACD,IAAIE,YACF,OAAOE;CAET,OACE,2CAAC,6CAAD;EACaR;EACDD;EACV,IAAIM;EACGG;EAENN;EACiB;EAGzB;AAED,uCAAoBL,SAAS"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo } from 'react'\nimport CheckboxInput, { CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxWithLabel } from './CheckboxWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type CheckboxProps = CheckboxInputProps\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function Checkbox({ disabled, className, id, children, ...props }, ref) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <CheckboxInput\n {...props}\n className={noChildren ? className : undefined}\n disabled={disabled}\n id={htmlId}\n ref={ref}\n />\n )\n if (noChildren) {\n return input\n }\n return (\n <CheckboxWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </CheckboxWithLabel>\n )\n },\n)\n\nexport default memo(Checkbox)\n"],"mappings":";;;;;;;;;AASA,MAAM,iCACJ,SAAS,SAAS,EAAE,UAAU,WAAW,IAAI,UAAU,GAAG,SAAS,KAAK;CACtE,MAAM,qCAAe,EAAE;CACvB,MAAM,aAAa,aAAa;CAChC,MAAM,QACJ,2CAAC,yBAAD;EACE,GAAI;EACJ,WAAW,aAAa,YAAY;EAC1B;EACV,IAAI;EACC;CAAI;CAGb,IAAI,YACF,OAAO;CAET,OACE,2CAAC,6CAAD;EACa;EACD;EACV,IAAI;EACG;EAEN;CACgB;AAEvB,CACF;AAEA,uCAAoB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["forwardRef","memo","CheckboxInput","CheckboxInputProps","CheckboxWithLabel","useId","CheckboxProps","Checkbox","HTMLInputElement","disabled","className","id","children","props","ref","htmlId","noChildren","undefined","input"],"sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo } from 'react'\nimport CheckboxInput, { CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxWithLabel } from './CheckboxWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type CheckboxProps = CheckboxInputProps\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function Checkbox({ disabled, className, id, children, ...props }, ref) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <CheckboxInput\n {...props}\n className={noChildren ? className : undefined}\n disabled={disabled}\n id={htmlId}\n ref={ref}\n />\n )\n if (noChildren) {\n return input\n }\n return (\n <CheckboxWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </CheckboxWithLabel>\n )\n },\n)\n\nexport default memo(Checkbox)\n"],"mappings":";;;;;;;;;AASA,MAAMO,WAAWP,WACf,SAASO,SAAS,EAAEE,UAAUC,WAAWC,IAAIC,UAAU,GAAGC,SAASC,KAAK;CACtE,MAAMC,SAASV,MAAMM,GAAG;CACxB,MAAMK,aAAaJ,aAAaK;CAChC,MAAMC,QACJ,oBAAC,uBAAD;EACE,GAAIL;EACJ,WAAWG,aAAaN,YAAYO;EAC1BR;EACV,IAAIM;EACCD;EAER;CACD,IAAIE,YACF,OAAOE;CAET,OACE,oBAAC,mBAAD;EACaR;EACDD;EACV,IAAIM;EACGG;EAENN;EACiB;EAGzB;AAED,uBAAeX,KAAKM,SAAS"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { forwardRef, memo } from 'react'\nimport CheckboxInput, { CheckboxInputProps } from './CheckboxInput'\nimport { CheckboxWithLabel } from './CheckboxWithLabel'\nimport { useId } from 'react-aria/useId'\n\nexport type CheckboxProps = CheckboxInputProps\n\nconst Checkbox = forwardRef<HTMLInputElement, CheckboxInputProps>(\n function Checkbox({ disabled, className, id, children, ...props }, ref) {\n const htmlId = useId(id)\n const noChildren = children === undefined\n const input = (\n <CheckboxInput\n {...props}\n className={noChildren ? className : undefined}\n disabled={disabled}\n id={htmlId}\n ref={ref}\n />\n )\n if (noChildren) {\n return input\n }\n return (\n <CheckboxWithLabel\n className={className}\n disabled={disabled}\n id={htmlId}\n input={input}\n >\n {children}\n </CheckboxWithLabel>\n )\n },\n)\n\nexport default memo(Checkbox)\n"],"mappings":";;;;;;;;;AASA,MAAM,WAAW,WACf,SAAS,SAAS,EAAE,UAAU,WAAW,IAAI,UAAU,GAAG,SAAS,KAAK;CACtE,MAAM,SAAS,MAAM,EAAE;CACvB,MAAM,aAAa,aAAa;CAChC,MAAM,QACJ,oBAAC,uBAAD;EACE,GAAI;EACJ,WAAW,aAAa,YAAY;EAC1B;EACV,IAAI;EACC;CAAI;CAGb,IAAI,YACF,OAAO;CAET,OACE,oBAAC,mBAAD;EACa;EACD;EACV,IAAI;EACG;EAEN;CACgB;AAEvB,CACF;AAEA,uBAAe,KAAK,QAAQ"}
@@ -8,7 +8,7 @@ export type ClickableProps<T extends React.ElementType = 'button'> = {
8
8
  */
9
9
  component?: T;
10
10
  } & Omit<React.ComponentPropsWithRef<T>, 'children'>;
11
- declare const Clickable: <T extends React.ElementType = "button">(p: ClickableProps<T>) => JSX.Element;
11
+ declare const Clickable: <T extends React.ElementType = 'button'>(p: ClickableProps<T>) => JSX.Element;
12
12
  export default Clickable;
13
13
  /**
14
14
  * @deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Clickable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuB,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvE,OAAO,aAAa,CAAA;AAEpB,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACnE,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,CAAA;CACd,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;AAEpD,QAAA,MAAM,SAAS,EAST,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAC3C,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,KACjB,GAAG,CAAC,OAAO,CAAA;AAChB,eAAe,SAAS,CAAA;AAExB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Clickable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAuB,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvE,OAAO,aAAa,CAAA;AAEpB,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACnE,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,CAAA;CACd,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAA;AAEpD,QAAA,MAAM,SAAS,EAST,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAC3C,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,KACjB,GAAG,CAAC,OAAO,CAAA;eACD,SAAS;AAExB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,CAAA"}
@@ -3,7 +3,7 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_useClassNames = require('../../_lib/useClassNames.cjs');
4
4
  require('./index.cjs');
5
5
  let react = require("react");
6
- react = require_runtime.__toESM(react);
6
+ react = require_runtime.__toESM(react, 1);
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
 
9
9
  //#region src/components/Clickable/index.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["React","useMemo","forwardRef","ReactNode","JSX","useClassNames","ClickableProps","ElementType","children","component","T","Omit","ComponentPropsWithRef","Clickable","props","ref","ForwardedRef","HTMLButtonElement","className","Component","p","Element","ClickableElement","HTMLAnchorElement"],"sources":["../../../src/components/Clickable/index.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, type JSX } from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nexport type ClickableProps<T extends React.ElementType = 'button'> = {\n children?: ReactNode\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'button'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children'>\n\nconst Clickable = forwardRef(function Clickable<T extends React.ElementType>(\n { component, ...props }: ClickableProps<T>,\n ref: React.ForwardedRef<HTMLButtonElement>,\n) {\n const className = useClassNames('charcoal-clickable', props.className)\n\n const Component = useMemo(() => component ?? 'button', [component])\n\n return <Component {...props} ref={ref} className={className} />\n}) as <T extends React.ElementType = 'button'>(\n p: ClickableProps<T>,\n) => JSX.Element\nexport default Clickable\n\n/**\n * @deprecated\n * remained for v3 compatibility and will be removed in the future\n */\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n"],"mappings":";;;;;;;;;AAaA,MAAMa,kCAAuB,SAASA,UACpC,EAAEJ,WAAW,GAAGK,SAChBC,KACA;CACA,MAAMG,YAAYb,oCAAc,sBAAsBS,MAAMI,UAAU;CAItE,OAAO,oEAFyBT,aAAa,UAAU,CAACA,UAAU,CAEjD,EAAV;EAAW,GAAIK;EAAYC;EAAgBG;EAAa;EAC/D"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../src/components/Clickable/index.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, type JSX } from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nexport type ClickableProps<T extends React.ElementType = 'button'> = {\n children?: ReactNode\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'button'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children'>\n\nconst Clickable = forwardRef(function Clickable<T extends React.ElementType>(\n { component, ...props }: ClickableProps<T>,\n ref: React.ForwardedRef<HTMLButtonElement>,\n) {\n const className = useClassNames('charcoal-clickable', props.className)\n\n const Component = useMemo(() => component ?? 'button', [component])\n\n return <Component {...props} ref={ref} className={className} />\n}) as <T extends React.ElementType = 'button'>(\n p: ClickableProps<T>,\n) => JSX.Element\nexport default Clickable\n\n/**\n * @deprecated\n * remained for v3 compatibility and will be removed in the future\n */\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n"],"mappings":";;;;;;;;;AAaA,MAAM,kCAAuB,SAAS,UACpC,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,YAAY,oCAAc,sBAAsB,MAAM,SAAS;CAIrE,OAAO,oEAFyB,aAAa,UAAU,CAAC,SAAS,CAEzD,GAAD;EAAW,GAAI;EAAY;EAAgB;CAAU;AAC9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["React","useMemo","forwardRef","ReactNode","JSX","useClassNames","ClickableProps","ElementType","children","component","T","Omit","ComponentPropsWithRef","Clickable","props","ref","ForwardedRef","HTMLButtonElement","className","Component","p","Element","ClickableElement","HTMLAnchorElement"],"sources":["../../../src/components/Clickable/index.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, type JSX } from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nexport type ClickableProps<T extends React.ElementType = 'button'> = {\n children?: ReactNode\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'button'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children'>\n\nconst Clickable = forwardRef(function Clickable<T extends React.ElementType>(\n { component, ...props }: ClickableProps<T>,\n ref: React.ForwardedRef<HTMLButtonElement>,\n) {\n const className = useClassNames('charcoal-clickable', props.className)\n\n const Component = useMemo(() => component ?? 'button', [component])\n\n return <Component {...props} ref={ref} className={className} />\n}) as <T extends React.ElementType = 'button'>(\n p: ClickableProps<T>,\n) => JSX.Element\nexport default Clickable\n\n/**\n * @deprecated\n * remained for v3 compatibility and will be removed in the future\n */\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n"],"mappings":";;;;;;;AAaA,MAAMa,YAAYX,WAAW,SAASW,UACpC,EAAEJ,WAAW,GAAGK,SAChBC,KACA;CACA,MAAMG,YAAYb,cAAc,sBAAsBS,MAAMI,UAAU;CAItE,OAAO,oBAFWjB,cAAcQ,aAAa,UAAU,CAACA,UAAU,CAEjD,EAAV;EAAW,GAAIK;EAAYC;EAAgBG;EAAa;EAC/D"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../src/components/Clickable/index.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, type JSX } from 'react'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport './index.css'\n\nexport type ClickableProps<T extends React.ElementType = 'button'> = {\n children?: ReactNode\n /**\n * The component used for root element.\n * @type T extends React.ElementType = 'button'\n */\n component?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children'>\n\nconst Clickable = forwardRef(function Clickable<T extends React.ElementType>(\n { component, ...props }: ClickableProps<T>,\n ref: React.ForwardedRef<HTMLButtonElement>,\n) {\n const className = useClassNames('charcoal-clickable', props.className)\n\n const Component = useMemo(() => component ?? 'button', [component])\n\n return <Component {...props} ref={ref} className={className} />\n}) as <T extends React.ElementType = 'button'>(\n p: ClickableProps<T>,\n) => JSX.Element\nexport default Clickable\n\n/**\n * @deprecated\n * remained for v3 compatibility and will be removed in the future\n */\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n"],"mappings":";;;;;;;AAaA,MAAM,YAAY,WAAW,SAAS,UACpC,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,YAAY,cAAc,sBAAsB,MAAM,SAAS;CAIrE,OAAO,oBAFW,cAAc,aAAa,UAAU,CAAC,SAAS,CAEzD,GAAD;EAAW,GAAI;EAAY;EAAgB;CAAU;AAC9D,CAAC"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_index = require('../../Icon/index.cjs');
4
3
  const require_MenuListContext = require('../MenuList/MenuListContext.cjs');
5
4
  const require_index$1 = require('../MenuItem/index.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["MenuItem","MenuItemProps","MenuListContext","ReactNode","useContext","Icon","DropdownMenuItemProps","Omit","secondary","contentFullWidth","DropdownMenuItem","props","value","ctxValue","isSelected","children","rest","fullWidthClassName"],"sources":["../../../../src/components/DropdownSelector/DropdownMenuItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport MenuItem, { MenuItemProps } from '../MenuItem'\nimport { MenuListContext } from '../MenuList/MenuListContext'\nimport { ReactNode, useContext } from 'react'\nimport Icon from '../../Icon'\n\nexport type DropdownMenuItemProps = Omit<MenuItemProps, 'as'> & {\n secondary?: ReactNode\n contentFullWidth?: boolean\n}\n\n/**\n * DropdownSelectorの選択肢として使うMenuItem\n */\nexport default function DropdownMenuItem(props: DropdownMenuItemProps) {\n const { value: ctxValue } = useContext(MenuListContext)\n const isSelected = props.value === ctxValue\n const { children, secondary, ...rest } = props\n\n const fullWidthClassName = props.contentFullWidth\n ? 'charcoal-dropdown-selector-menu-fullwidth'\n : ''\n\n return (\n <MenuItem {...rest} aria-selected={isSelected}>\n <div className={fullWidthClassName}>\n <div\n className={`charcoal-dropdown-selector-menu-item-container ${\n fullWidthClassName\n }`}\n >\n {isSelected && (\n <Icon\n className=\"charcoal-dropdown-selector-menu-item-icon\"\n name=\"16/Check\"\n />\n )}\n <span\n className={`charcoal-dropdown-selector-menu-item ${fullWidthClassName}`}\n data-selected={isSelected}\n >\n {children}\n </span>\n </div>\n {secondary && (\n <span className=\"charcoal-dropdown-selector-menu-secondary\">\n {secondary}\n </span>\n )}\n </div>\n </MenuItem>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAwBU,iBAAiBC,OAA8B;CACrE,MAAM,EAAEC,OAAOC,mCAAwBX,wCAAgB;CACvD,MAAMY,aAAaH,MAAMC,UAAUC;CACnC,MAAM,EAAEE,UAAUP,WAAW,GAAGQ,SAASL;CAEzC,MAAMM,qBAAqBN,MAAMF,mBAC7B,8CACA;CAEJ,OACE,2CAAC,yBAAD;EAAU,GAAIO;EAAM,iBAAeF;YACjC,4CAAC,OAAD;GAAK,WAAWG;aAAhB,CACE,4CAAC,OAAD;IACE,WAAW,kDACTA;cAFJ,CAKGH,cACC,2CAAC,uBAAD;KACE,WAAU;KACV,MAAK;KAER,GACD,2CAAC,QAAD;KACE,WAAW,wCAAwCG;KACnD,iBAAeH;KAEdC;KACG,EACH;OACJP,aACC,2CAAC,QAAD;IAAM,WAAU;cACbA;IAEJ,EACE;;EACI"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../../src/components/DropdownSelector/DropdownMenuItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport MenuItem, { MenuItemProps } from '../MenuItem'\nimport { MenuListContext } from '../MenuList/MenuListContext'\nimport { ReactNode, useContext } from 'react'\nimport Icon from '../../Icon'\n\nexport type DropdownMenuItemProps = Omit<MenuItemProps, 'as'> & {\n secondary?: ReactNode\n contentFullWidth?: boolean\n}\n\n/**\n * DropdownSelectorの選択肢として使うMenuItem\n */\nexport default function DropdownMenuItem(props: DropdownMenuItemProps) {\n const { value: ctxValue } = useContext(MenuListContext)\n const isSelected = props.value === ctxValue\n const { children, secondary, ...rest } = props\n\n const fullWidthClassName = props.contentFullWidth\n ? 'charcoal-dropdown-selector-menu-fullwidth'\n : ''\n\n return (\n <MenuItem {...rest} aria-selected={isSelected}>\n <div className={fullWidthClassName}>\n <div\n className={`charcoal-dropdown-selector-menu-item-container ${\n fullWidthClassName\n }`}\n >\n {isSelected && (\n <Icon\n className=\"charcoal-dropdown-selector-menu-item-icon\"\n name=\"16/Check\"\n />\n )}\n <span\n className={`charcoal-dropdown-selector-menu-item ${fullWidthClassName}`}\n data-selected={isSelected}\n >\n {children}\n </span>\n </div>\n {secondary && (\n <span className=\"charcoal-dropdown-selector-menu-secondary\">\n {secondary}\n </span>\n )}\n </div>\n </MenuItem>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAwB,iBAAiB,OAA8B;CACrE,MAAM,EAAE,OAAO,mCAAwB,uCAAe;CACtD,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CAEzC,MAAM,qBAAqB,MAAM,mBAC7B,8CACA;CAEJ,OACE,2CAAC,yBAAD;EAAU,GAAI;EAAM,iBAAe;YACjC,4CAAC,OAAD;GAAK,WAAW;aAAhB,CACE,4CAAC,OAAD;IACE,WAAW,kDACT;cAFJ,CAKG,cACC,2CAAC,uBAAD;KACE,WAAU;KACV,MAAK;IAAU,IAGnB,2CAAC,QAAD;KACE,WAAW,wCAAwC;KACnD,iBAAe;KAEd;IACG,EACH;OACJ,aACC,2CAAC,QAAD;IAAM,WAAU;cACb;GACG,EAEL;;CACG;AAEd"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["MenuItem","MenuItemProps","MenuListContext","ReactNode","useContext","Icon","DropdownMenuItemProps","Omit","secondary","contentFullWidth","DropdownMenuItem","props","value","ctxValue","isSelected","children","rest","fullWidthClassName"],"sources":["../../../../src/components/DropdownSelector/DropdownMenuItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport MenuItem, { MenuItemProps } from '../MenuItem'\nimport { MenuListContext } from '../MenuList/MenuListContext'\nimport { ReactNode, useContext } from 'react'\nimport Icon from '../../Icon'\n\nexport type DropdownMenuItemProps = Omit<MenuItemProps, 'as'> & {\n secondary?: ReactNode\n contentFullWidth?: boolean\n}\n\n/**\n * DropdownSelectorの選択肢として使うMenuItem\n */\nexport default function DropdownMenuItem(props: DropdownMenuItemProps) {\n const { value: ctxValue } = useContext(MenuListContext)\n const isSelected = props.value === ctxValue\n const { children, secondary, ...rest } = props\n\n const fullWidthClassName = props.contentFullWidth\n ? 'charcoal-dropdown-selector-menu-fullwidth'\n : ''\n\n return (\n <MenuItem {...rest} aria-selected={isSelected}>\n <div className={fullWidthClassName}>\n <div\n className={`charcoal-dropdown-selector-menu-item-container ${\n fullWidthClassName\n }`}\n >\n {isSelected && (\n <Icon\n className=\"charcoal-dropdown-selector-menu-item-icon\"\n name=\"16/Check\"\n />\n )}\n <span\n className={`charcoal-dropdown-selector-menu-item ${fullWidthClassName}`}\n data-selected={isSelected}\n >\n {children}\n </span>\n </div>\n {secondary && (\n <span className=\"charcoal-dropdown-selector-menu-secondary\">\n {secondary}\n </span>\n )}\n </div>\n </MenuItem>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAwBU,iBAAiBC,OAA8B;CACrE,MAAM,EAAEC,OAAOC,aAAaT,WAAWF,gBAAgB;CACvD,MAAMY,aAAaH,MAAMC,UAAUC;CACnC,MAAM,EAAEE,UAAUP,WAAW,GAAGQ,SAASL;CAEzC,MAAMM,qBAAqBN,MAAMF,mBAC7B,8CACA;CAEJ,OACE,oBAAC,UAAD;EAAU,GAAIO;EAAM,iBAAeF;YACjC,qBAAC,OAAD;GAAK,WAAWG;aAAhB,CACE,qBAAC,OAAD;IACE,WAAW,kDACTA;cAFJ,CAKGH,cACC,oBAAC,MAAD;KACE,WAAU;KACV,MAAK;KAER,GACD,oBAAC,QAAD;KACE,WAAW,wCAAwCG;KACnD,iBAAeH;KAEdC;KACG,EACH;OACJP,aACC,oBAAC,QAAD;IAAM,WAAU;cACbA;IAEJ,EACE;;EACI"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../../src/components/DropdownSelector/DropdownMenuItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport MenuItem, { MenuItemProps } from '../MenuItem'\nimport { MenuListContext } from '../MenuList/MenuListContext'\nimport { ReactNode, useContext } from 'react'\nimport Icon from '../../Icon'\n\nexport type DropdownMenuItemProps = Omit<MenuItemProps, 'as'> & {\n secondary?: ReactNode\n contentFullWidth?: boolean\n}\n\n/**\n * DropdownSelectorの選択肢として使うMenuItem\n */\nexport default function DropdownMenuItem(props: DropdownMenuItemProps) {\n const { value: ctxValue } = useContext(MenuListContext)\n const isSelected = props.value === ctxValue\n const { children, secondary, ...rest } = props\n\n const fullWidthClassName = props.contentFullWidth\n ? 'charcoal-dropdown-selector-menu-fullwidth'\n : ''\n\n return (\n <MenuItem {...rest} aria-selected={isSelected}>\n <div className={fullWidthClassName}>\n <div\n className={`charcoal-dropdown-selector-menu-item-container ${\n fullWidthClassName\n }`}\n >\n {isSelected && (\n <Icon\n className=\"charcoal-dropdown-selector-menu-item-icon\"\n name=\"16/Check\"\n />\n )}\n <span\n className={`charcoal-dropdown-selector-menu-item ${fullWidthClassName}`}\n data-selected={isSelected}\n >\n {children}\n </span>\n </div>\n {secondary && (\n <span className=\"charcoal-dropdown-selector-menu-secondary\">\n {secondary}\n </span>\n )}\n </div>\n </MenuItem>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAwB,iBAAiB,OAA8B;CACrE,MAAM,EAAE,OAAO,aAAa,WAAW,eAAe;CACtD,MAAM,aAAa,MAAM,UAAU;CACnC,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CAEzC,MAAM,qBAAqB,MAAM,mBAC7B,8CACA;CAEJ,OACE,oBAAC,UAAD;EAAU,GAAI;EAAM,iBAAe;YACjC,qBAAC,OAAD;GAAK,WAAW;aAAhB,CACE,qBAAC,OAAD;IACE,WAAW,kDACT;cAFJ,CAKG,cACC,oBAAC,MAAD;KACE,WAAU;KACV,MAAK;IAAU,IAGnB,oBAAC,QAAD;KACE,WAAW,wCAAwC;KACnD,iBAAe;KAEd;IACG,EACH;OACJ,aACC,oBAAC,QAAD;IAAM,WAAU;cACb;GACG,EAEL;;CACG;AAEd"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_index = require('./Popover/index2.cjs');
4
3
  let react = require("react");
5
4
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownPopover.cjs","names":["Key","useEffect","useRef","Popover","PopoverProps","DropdownPopoverProps","value","DropdownPopover","children","props","ref","HTMLDivElement","isOpen","current","triggerRef","style","width","clientWidth","undefined","windowScrollY","window","scrollY","windowScrollX","scrollX","selectedElement","document","querySelector","toString","HTMLElement","focus","scrollTo","el","onClose","inertWorkaround"],"sources":["../../../src/components/DropdownSelector/DropdownPopover.tsx"],"sourcesContent":["import { Key, useEffect, useRef } from 'react'\nimport Popover, { PopoverProps } from './Popover'\n\ntype DropdownPopoverProps = PopoverProps & {\n value?: Key\n}\n\n/**\n * DropdownSelectorの選択肢をを表示するためのPopover\n * triggerRefの要素と同じ幅になる\n * 表示の際にvalueが等しいDropdownMenuItemを中央に表示する\n */\nexport function DropdownPopover({ children, ...props }: DropdownPopoverProps) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (props.isOpen && ref.current && props.triggerRef.current) {\n ref.current.style.width = `${props.triggerRef.current.clientWidth}px`\n }\n }, [props.triggerRef, props.isOpen])\n\n useEffect(() => {\n if (props.isOpen) {\n if (props.value !== undefined && props.value !== '') {\n // windowのスクロールを維持したまま選択肢をPopoverの中心に表示する\n const windowScrollY = window.scrollY\n const windowScrollX = window.scrollX\n const selectedElement = document.querySelector(\n `[data-key=\"${props.value.toString()}\"]`,\n ) as HTMLElement | undefined\n selectedElement?.focus()\n window.scrollTo(windowScrollX, windowScrollY)\n } else {\n const el = ref.current?.querySelector(\"[role='option']\")\n if (el instanceof HTMLElement) {\n el.focus()\n }\n }\n }\n }, [props.value, props.isOpen])\n\n return (\n <Popover\n isOpen={props.isOpen}\n onClose={props.onClose}\n popoverRef={ref}\n triggerRef={props.triggerRef}\n inertWorkaround={props.inertWorkaround}\n >\n {children}\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgBO,gBAAgB,EAAEC,UAAU,GAAGC,SAA+B;CAC5E,MAAMC,wBAA6B,KAAK;CACxCT,2BAAgB;EACd,IAAIQ,MAAMG,UAAUF,IAAIG,WAAWJ,MAAMK,WAAWD,SAClDH,IAAIG,QAAQE,MAAMC,QAAQ,GAAGP,MAAMK,WAAWD,QAAQI,YAAW;IAElE,CAACR,MAAMK,YAAYL,MAAMG,OAAO,CAAC;CAEpCX,2BAAgB;EACd,IAAIQ,MAAMG,QACR,IAAIH,MAAMH,UAAUY,UAAaT,MAAMH,UAAU,IAAI;GAEnD,MAAMa,gBAAgBC,OAAOC;GAC7B,MAAMC,gBAAgBF,OAAOG;GAI7BC,AAHwBC,SAASC,cAC/B,cAAcjB,MAAMH,MAAMqB,UAAU,CAAA,IAEvB,EAAEE,OAAO;GACxBT,OAAOU,SAASR,eAAeH,cAAc;SACxC;GACL,MAAMY,KAAKrB,IAAIG,SAASa,cAAc,kBAAkB;GACxD,IAAIK,cAAcH,aAChBG,GAAGF,OAAO;;IAIf,CAACpB,MAAMH,OAAOG,MAAMG,OAAO,CAAC;CAE/B,OACE,2CAAC,uBAAD;EACE,QAAQH,MAAMG;EACd,SAASH,MAAMuB;EACf,YAAYtB;EACZ,YAAYD,MAAMK;EAClB,iBAAiBL,MAAMwB;EAEtBzB;EACO"}
1
+ {"version":3,"file":"DropdownPopover.cjs","names":[],"sources":["../../../src/components/DropdownSelector/DropdownPopover.tsx"],"sourcesContent":["import { Key, useEffect, useRef } from 'react'\nimport Popover, { PopoverProps } from './Popover'\n\ntype DropdownPopoverProps = PopoverProps & {\n value?: Key\n}\n\n/**\n * DropdownSelectorの選択肢をを表示するためのPopover\n * triggerRefの要素と同じ幅になる\n * 表示の際にvalueが等しいDropdownMenuItemを中央に表示する\n */\nexport function DropdownPopover({ children, ...props }: DropdownPopoverProps) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (props.isOpen && ref.current && props.triggerRef.current) {\n ref.current.style.width = `${props.triggerRef.current.clientWidth}px`\n }\n }, [props.triggerRef, props.isOpen])\n\n useEffect(() => {\n if (props.isOpen) {\n if (props.value !== undefined && props.value !== '') {\n // windowのスクロールを維持したまま選択肢をPopoverの中心に表示する\n const windowScrollY = window.scrollY\n const windowScrollX = window.scrollX\n const selectedElement = document.querySelector(\n `[data-key=\"${props.value.toString()}\"]`,\n ) as HTMLElement | undefined\n selectedElement?.focus()\n window.scrollTo(windowScrollX, windowScrollY)\n } else {\n const el = ref.current?.querySelector(\"[role='option']\")\n if (el instanceof HTMLElement) {\n el.focus()\n }\n }\n }\n }, [props.value, props.isOpen])\n\n return (\n <Popover\n isOpen={props.isOpen}\n onClose={props.onClose}\n popoverRef={ref}\n triggerRef={props.triggerRef}\n inertWorkaround={props.inertWorkaround}\n >\n {children}\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,gBAAgB,EAAE,UAAU,GAAG,SAA+B;CAC5E,MAAM,wBAA6B,IAAI;CACvC,2BAAgB;EACd,IAAI,MAAM,UAAU,IAAI,WAAW,MAAM,WAAW,SAClD,IAAI,QAAQ,MAAM,QAAQ,GAAG,MAAM,WAAW,QAAQ,YAAW;CAErE,GAAG,CAAC,MAAM,YAAY,MAAM,MAAM,CAAC;CAEnC,2BAAgB;EACd,IAAI,MAAM,QACR,IAAI,MAAM,UAAU,UAAa,MAAM,UAAU,IAAI;GAEnD,MAAM,gBAAgB,OAAO;GAC7B,MAAM,gBAAgB,OAAO;GAI7B,AAHwB,SAAS,cAC/B,cAAc,MAAM,MAAM,SAAS,EAAC,GAEtC,CAAe,EAAE,MAAM;GACvB,OAAO,SAAS,eAAe,aAAa;EAC9C,OAAO;GACL,MAAM,KAAK,IAAI,SAAS,cAAc,iBAAiB;GACvD,IAAI,cAAc,aAChB,GAAG,MAAM;EAEb;CAEJ,GAAG,CAAC,MAAM,OAAO,MAAM,MAAM,CAAC;CAE9B,OACE,2CAAC,uBAAD;EACE,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,YAAY;EACZ,YAAY,MAAM;EAClB,iBAAiB,MAAM;EAEtB;CACM;AAEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownPopover.js","names":["Key","useEffect","useRef","Popover","PopoverProps","DropdownPopoverProps","value","DropdownPopover","children","props","ref","HTMLDivElement","isOpen","current","triggerRef","style","width","clientWidth","undefined","windowScrollY","window","scrollY","windowScrollX","scrollX","selectedElement","document","querySelector","toString","HTMLElement","focus","scrollTo","el","onClose","inertWorkaround"],"sources":["../../../src/components/DropdownSelector/DropdownPopover.tsx"],"sourcesContent":["import { Key, useEffect, useRef } from 'react'\nimport Popover, { PopoverProps } from './Popover'\n\ntype DropdownPopoverProps = PopoverProps & {\n value?: Key\n}\n\n/**\n * DropdownSelectorの選択肢をを表示するためのPopover\n * triggerRefの要素と同じ幅になる\n * 表示の際にvalueが等しいDropdownMenuItemを中央に表示する\n */\nexport function DropdownPopover({ children, ...props }: DropdownPopoverProps) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (props.isOpen && ref.current && props.triggerRef.current) {\n ref.current.style.width = `${props.triggerRef.current.clientWidth}px`\n }\n }, [props.triggerRef, props.isOpen])\n\n useEffect(() => {\n if (props.isOpen) {\n if (props.value !== undefined && props.value !== '') {\n // windowのスクロールを維持したまま選択肢をPopoverの中心に表示する\n const windowScrollY = window.scrollY\n const windowScrollX = window.scrollX\n const selectedElement = document.querySelector(\n `[data-key=\"${props.value.toString()}\"]`,\n ) as HTMLElement | undefined\n selectedElement?.focus()\n window.scrollTo(windowScrollX, windowScrollY)\n } else {\n const el = ref.current?.querySelector(\"[role='option']\")\n if (el instanceof HTMLElement) {\n el.focus()\n }\n }\n }\n }, [props.value, props.isOpen])\n\n return (\n <Popover\n isOpen={props.isOpen}\n onClose={props.onClose}\n popoverRef={ref}\n triggerRef={props.triggerRef}\n inertWorkaround={props.inertWorkaround}\n >\n {children}\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgBO,gBAAgB,EAAEC,UAAU,GAAGC,SAA+B;CAC5E,MAAMC,MAAMR,OAAuB,KAAK;CACxCD,gBAAgB;EACd,IAAIQ,MAAMG,UAAUF,IAAIG,WAAWJ,MAAMK,WAAWD,SAClDH,IAAIG,QAAQE,MAAMC,QAAQ,GAAGP,MAAMK,WAAWD,QAAQI,YAAW;IAElE,CAACR,MAAMK,YAAYL,MAAMG,OAAO,CAAC;CAEpCX,gBAAgB;EACd,IAAIQ,MAAMG,QACR,IAAIH,MAAMH,UAAUY,UAAaT,MAAMH,UAAU,IAAI;GAEnD,MAAMa,gBAAgBC,OAAOC;GAC7B,MAAMC,gBAAgBF,OAAOG;GAI7BC,AAHwBC,SAASC,cAC/B,cAAcjB,MAAMH,MAAMqB,UAAU,CAAA,IAEvB,EAAEE,OAAO;GACxBT,OAAOU,SAASR,eAAeH,cAAc;SACxC;GACL,MAAMY,KAAKrB,IAAIG,SAASa,cAAc,kBAAkB;GACxD,IAAIK,cAAcH,aAChBG,GAAGF,OAAO;;IAIf,CAACpB,MAAMH,OAAOG,MAAMG,OAAO,CAAC;CAE/B,OACE,oBAAC,SAAD;EACE,QAAQH,MAAMG;EACd,SAASH,MAAMuB;EACf,YAAYtB;EACZ,YAAYD,MAAMK;EAClB,iBAAiBL,MAAMwB;EAEtBzB;EACO"}
1
+ {"version":3,"file":"DropdownPopover.js","names":[],"sources":["../../../src/components/DropdownSelector/DropdownPopover.tsx"],"sourcesContent":["import { Key, useEffect, useRef } from 'react'\nimport Popover, { PopoverProps } from './Popover'\n\ntype DropdownPopoverProps = PopoverProps & {\n value?: Key\n}\n\n/**\n * DropdownSelectorの選択肢をを表示するためのPopover\n * triggerRefの要素と同じ幅になる\n * 表示の際にvalueが等しいDropdownMenuItemを中央に表示する\n */\nexport function DropdownPopover({ children, ...props }: DropdownPopoverProps) {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (props.isOpen && ref.current && props.triggerRef.current) {\n ref.current.style.width = `${props.triggerRef.current.clientWidth}px`\n }\n }, [props.triggerRef, props.isOpen])\n\n useEffect(() => {\n if (props.isOpen) {\n if (props.value !== undefined && props.value !== '') {\n // windowのスクロールを維持したまま選択肢をPopoverの中心に表示する\n const windowScrollY = window.scrollY\n const windowScrollX = window.scrollX\n const selectedElement = document.querySelector(\n `[data-key=\"${props.value.toString()}\"]`,\n ) as HTMLElement | undefined\n selectedElement?.focus()\n window.scrollTo(windowScrollX, windowScrollY)\n } else {\n const el = ref.current?.querySelector(\"[role='option']\")\n if (el instanceof HTMLElement) {\n el.focus()\n }\n }\n }\n }, [props.value, props.isOpen])\n\n return (\n <Popover\n isOpen={props.isOpen}\n onClose={props.onClose}\n popoverRef={ref}\n triggerRef={props.triggerRef}\n inertWorkaround={props.inertWorkaround}\n >\n {children}\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAgB,gBAAgB,EAAE,UAAU,GAAG,SAA+B;CAC5E,MAAM,MAAM,OAAuB,IAAI;CACvC,gBAAgB;EACd,IAAI,MAAM,UAAU,IAAI,WAAW,MAAM,WAAW,SAClD,IAAI,QAAQ,MAAM,QAAQ,GAAG,MAAM,WAAW,QAAQ,YAAW;CAErE,GAAG,CAAC,MAAM,YAAY,MAAM,MAAM,CAAC;CAEnC,gBAAgB;EACd,IAAI,MAAM,QACR,IAAI,MAAM,UAAU,UAAa,MAAM,UAAU,IAAI;GAEnD,MAAM,gBAAgB,OAAO;GAC7B,MAAM,gBAAgB,OAAO;GAI7B,AAHwB,SAAS,cAC/B,cAAc,MAAM,MAAM,SAAS,EAAC,GAEtC,CAAe,EAAE,MAAM;GACvB,OAAO,SAAS,eAAe,aAAa;EAC9C,OAAO;GACL,MAAM,KAAK,IAAI,SAAS,cAAc,iBAAiB;GACvD,IAAI,cAAc,aAChB,GAAG,MAAM;EAEb;CAEJ,GAAG,CAAC,MAAM,OAAO,MAAM,MAAM,CAAC;CAE9B,OACE,oBAAC,SAAD;EACE,QAAQ,MAAM;EACd,SAAS,MAAM;EACf,YAAY;EACZ,YAAY,MAAM;EAClB,iBAAiB,MAAM;EAEtB;CACM;AAEb"}
@@ -5,6 +5,6 @@ export type ListItemProps<T extends React.ElementType = 'li'> = {
5
5
  children?: ReactNode;
6
6
  as?: T;
7
7
  } & Omit<React.ComponentPropsWithRef<T>, 'children' | 'as'>;
8
- declare const ListItem: <T extends React.ElementType = "li">(p: ListItemProps<T>) => JSX.Element;
8
+ declare const ListItem: <T extends React.ElementType = 'li'>(p: ListItemProps<T>) => JSX.Element;
9
9
  export default ListItem;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/ListItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAA4B,SAAS,EAAW,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAG9E,MAAM,MAAM,gBAAgB,GACxB,MAAM,GAAG,CAAC,iBAAiB,GAE3B,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAA;AAEpC,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI;IAC9D,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,EAAE,CAAC,EAAE,CAAC,CAAA;CACP,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,CAAA;AAE3D,QAAA,MAAM,QAAQ,EAOR,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;AAE9E,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/ListItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAA4B,SAAS,EAAW,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAG9E,MAAM,MAAM,gBAAgB,GACxB,MAAM,GAAG,CAAC,iBAAiB,GAE3B,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAA;AAEpC,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI;IAC9D,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,EAAE,CAAC,EAAE,CAAC,CAAA;CACP,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,CAAA;AAE3D,QAAA,MAAM,QAAQ,EAOR,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;eAE/D,QAAQ"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_useClassNames = require('../../../_lib/useClassNames.cjs');
4
3
  require('./index.cjs');
5
4
  let react = require("react");
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","names":["ForwardedRef","forwardRef","ReactNode","useMemo","JSX","useClassNames","CustomJSXElement","IntrinsicElements","React","JSXElementConstructor","ListItemProps","ElementType","children","as","T","Omit","ComponentPropsWithRef","ListItem","className","props","ref","HTMLLIElement","Component","classNames","p","Element"],"sources":["../../../../src/components/DropdownSelector/ListItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { ForwardedRef, forwardRef, ReactNode, useMemo, type JSX } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CustomJSXElement =\n | keyof JSX.IntrinsicElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | React.JSXElementConstructor<any>\n\nexport type ListItemProps<T extends React.ElementType = 'li'> = {\n children?: ReactNode\n as?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'as'>\n\nconst ListItem = forwardRef(function ListItem<T extends React.ElementType>(\n { as, className, ...props }: ListItemProps<T>,\n ref: ForwardedRef<HTMLLIElement>,\n) {\n const Component = useMemo(() => as ?? 'li', [as])\n const classNames = useClassNames('charcoal-list-item', className)\n return <Component className={classNames} ref={ref} {...props} />\n}) as <T extends React.ElementType = 'li'>(p: ListItemProps<T>) => JSX.Element\n\nexport default ListItem\n"],"mappings":";;;;;;;;AAeA,MAAMiB,iCAAsB,SAASA,SACnC,EAAEJ,IAAIK,WAAW,GAAGC,SACpBC,KACA;CAGA,OAAO,oEAFyBP,MAAM,MAAM,CAACA,GAAG,CAE/B,EAAV;EAAW,WADCR,oCAAc,sBAAsBa,UAChB;EAAOE;EAAK,GAAID;EAAS;EAChE"}
1
+ {"version":3,"file":"index2.cjs","names":[],"sources":["../../../../src/components/DropdownSelector/ListItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { ForwardedRef, forwardRef, ReactNode, useMemo, type JSX } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CustomJSXElement =\n | keyof JSX.IntrinsicElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | React.JSXElementConstructor<any>\n\nexport type ListItemProps<T extends React.ElementType = 'li'> = {\n children?: ReactNode\n as?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'as'>\n\nconst ListItem = forwardRef(function ListItem<T extends React.ElementType>(\n { as, className, ...props }: ListItemProps<T>,\n ref: ForwardedRef<HTMLLIElement>,\n) {\n const Component = useMemo(() => as ?? 'li', [as])\n const classNames = useClassNames('charcoal-list-item', className)\n return <Component className={classNames} ref={ref} {...props} />\n}) as <T extends React.ElementType = 'li'>(p: ListItemProps<T>) => JSX.Element\n\nexport default ListItem\n"],"mappings":";;;;;;;AAeA,MAAM,iCAAsB,SAAS,SACnC,EAAE,IAAI,WAAW,GAAG,SACpB,KACA;CAGA,OAAO,oEAFyB,MAAM,MAAM,CAAC,EAAE,CAEvC,GAAD;EAAW,WADC,oCAAc,sBAAsB,SAC1B;EAAiB;EAAK,GAAI;CAAM;AAC/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","names":["ForwardedRef","forwardRef","ReactNode","useMemo","JSX","useClassNames","CustomJSXElement","IntrinsicElements","React","JSXElementConstructor","ListItemProps","ElementType","children","as","T","Omit","ComponentPropsWithRef","ListItem","className","props","ref","HTMLLIElement","Component","classNames","p","Element"],"sources":["../../../../src/components/DropdownSelector/ListItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { ForwardedRef, forwardRef, ReactNode, useMemo, type JSX } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CustomJSXElement =\n | keyof JSX.IntrinsicElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | React.JSXElementConstructor<any>\n\nexport type ListItemProps<T extends React.ElementType = 'li'> = {\n children?: ReactNode\n as?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'as'>\n\nconst ListItem = forwardRef(function ListItem<T extends React.ElementType>(\n { as, className, ...props }: ListItemProps<T>,\n ref: ForwardedRef<HTMLLIElement>,\n) {\n const Component = useMemo(() => as ?? 'li', [as])\n const classNames = useClassNames('charcoal-list-item', className)\n return <Component className={classNames} ref={ref} {...props} />\n}) as <T extends React.ElementType = 'li'>(p: ListItemProps<T>) => JSX.Element\n\nexport default ListItem\n"],"mappings":";;;;;;;AAeA,MAAMiB,WAAWhB,WAAW,SAASgB,SACnC,EAAEJ,IAAIK,WAAW,GAAGC,SACpBC,KACA;CAGA,OAAO,oBAFWjB,cAAcU,MAAM,MAAM,CAACA,GAAG,CAE/B,EAAV;EAAW,WADCR,cAAc,sBAAsBa,UAChB;EAAOE;EAAK,GAAID;EAAS;EAChE"}
1
+ {"version":3,"file":"index2.js","names":[],"sources":["../../../../src/components/DropdownSelector/ListItem/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { ForwardedRef, forwardRef, ReactNode, useMemo, type JSX } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\n\nexport type CustomJSXElement =\n | keyof JSX.IntrinsicElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | React.JSXElementConstructor<any>\n\nexport type ListItemProps<T extends React.ElementType = 'li'> = {\n children?: ReactNode\n as?: T\n} & Omit<React.ComponentPropsWithRef<T>, 'children' | 'as'>\n\nconst ListItem = forwardRef(function ListItem<T extends React.ElementType>(\n { as, className, ...props }: ListItemProps<T>,\n ref: ForwardedRef<HTMLLIElement>,\n) {\n const Component = useMemo(() => as ?? 'li', [as])\n const classNames = useClassNames('charcoal-list-item', className)\n return <Component className={classNames} ref={ref} {...props} />\n}) as <T extends React.ElementType = 'li'>(p: ListItemProps<T>) => JSX.Element\n\nexport default ListItem\n"],"mappings":";;;;;;;AAeA,MAAM,WAAW,WAAW,SAAS,SACnC,EAAE,IAAI,WAAW,GAAG,SACpB,KACA;CAGA,OAAO,oBAFW,cAAc,MAAM,MAAM,CAAC,EAAE,CAEvC,GAAD;EAAW,WADC,cAAc,sBAAsB,SAC1B;EAAiB;EAAK,GAAI;CAAM;AAC/D,CAAC"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_index = require('../ListItem/index2.cjs');
4
3
  const require_useMenuItemHandleKeyDown = require('./internals/useMenuItemHandleKeyDown.cjs');
5
4
  let react = require("react");
@@ -12,12 +11,40 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
11
  */
13
12
  const MenuItem = (0, react.forwardRef)(function MenuItem({ className: _, value, disabled, ...props }, ref) {
14
13
  const [handleKeyDown, setContextValue] = require_useMenuItemHandleKeyDown.useMenuItemHandleKeyDown(value);
14
+ const penHandledRef = (0, react.useRef)(false);
15
+ const pointerStartRef = (0, react.useRef)(null);
16
+ const handlePointerDown = (0, react.useCallback)((e) => {
17
+ if (e.pointerType === "pen") pointerStartRef.current = {
18
+ x: e.clientX,
19
+ y: e.clientY
20
+ };
21
+ }, []);
22
+ const handlePointerUp = (0, react.useCallback)((e) => {
23
+ if (e.pointerType !== "pen" || disabled === true) return;
24
+ const start = pointerStartRef.current;
25
+ if (!start) return;
26
+ const dx = Math.abs(e.clientX - start.x);
27
+ const dy = Math.abs(e.clientY - start.y);
28
+ if (dx > 8 || dy > 8) return;
29
+ penHandledRef.current = true;
30
+ setContextValue();
31
+ }, [disabled, setContextValue]);
32
+ const handleClick = (0, react.useCallback)(() => {
33
+ if (penHandledRef.current) {
34
+ penHandledRef.current = false;
35
+ return;
36
+ }
37
+ if (disabled === true) return;
38
+ setContextValue();
39
+ }, [disabled, setContextValue]);
15
40
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
16
41
  ...props,
17
42
  ref,
18
43
  "data-key": value,
19
44
  onKeyDown: handleKeyDown,
20
- onClick: disabled === true ? void 0 : setContextValue,
45
+ onPointerDown: handlePointerDown,
46
+ onPointerUp: handlePointerUp,
47
+ onClick: handleClick,
21
48
  tabIndex: -1,
22
49
  "aria-disabled": disabled,
23
50
  role: "option",
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ForwardedRef","forwardRef","ListItem","ListItemProps","useMenuItemHandleKeyDown","MenuItemProps","React","ElementType","value","disabled","T","MenuItem","className","_","props","ref","HTMLLIElement","handleKeyDown","setContextValue","undefined","children"],"sources":["../../../../src/components/DropdownSelector/MenuItem/index.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport ListItem, { ListItemProps } from '../ListItem'\nimport { useMenuItemHandleKeyDown } from './internals/useMenuItemHandleKeyDown'\n\nexport type MenuItemProps<T extends React.ElementType = 'li'> = {\n value?: string\n disabled?: boolean\n} & ListItemProps<T>\n\n/**\n * 上下キーでフォーカス移動でき、エンターキーで選択できるリストの項目\n * 基本的に`<MenuList>`, `<MenuGroup>`と合わせて使用する\n */\nconst MenuItem = forwardRef(function MenuItem<\n T extends React.ElementType = 'li',\n>(\n { className: _, value, disabled, ...props }: MenuItemProps<T>,\n ref: ForwardedRef<HTMLLIElement>,\n) {\n const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value)\n return (\n // @ts-expect-error TODO: fix mismatch between MenuItemProps and ListItemProps\n <ListItem\n {...props}\n ref={ref}\n data-key={value}\n onKeyDown={handleKeyDown}\n onClick={disabled === true ? undefined : setContextValue}\n tabIndex={-1}\n aria-disabled={disabled}\n role=\"option\"\n >\n {props.children}\n </ListItem>\n )\n})\nexport default MenuItem\n"],"mappings":";;;;;;;;;;;;AAaA,MAAMW,iCAAsB,SAASA,SAGnC,EAAEC,WAAWC,GAAGL,OAAOC,UAAU,GAAGK,SACpCC,KACA;CACA,MAAM,CAACE,eAAeC,mBAAmBd,0DAAyBI,MAAM;CACxE,OAEE,2CAAC,uBAAD;EACE,GAAIM;EACCC;EACL,YAAUP;EACV,WAAWS;EACX,SAASR,aAAa,OAAOU,SAAYD;EACzC,UAAU;EACV,iBAAeT;EACf,MAAK;YAEJK,MAAMM;EACC;EAEZ"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/components/DropdownSelector/MenuItem/index.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, useCallback, useRef } from 'react'\nimport ListItem, { ListItemProps } from '../ListItem'\nimport { useMenuItemHandleKeyDown } from './internals/useMenuItemHandleKeyDown'\n\nexport type MenuItemProps<T extends React.ElementType = 'li'> = {\n value?: string\n disabled?: boolean\n} & ListItemProps<T>\n\n/**\n * 上下キーでフォーカス移動でき、エンターキーで選択できるリストの項目\n * 基本的に`<MenuList>`, `<MenuGroup>`と合わせて使用する\n */\nconst MenuItem = forwardRef(function MenuItem<\n T extends React.ElementType = 'li',\n>(\n { className: _, value, disabled, ...props }: MenuItemProps<T>,\n ref: ForwardedRef<HTMLLIElement>,\n) {\n const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value)\n const penHandledRef = useRef(false)\n const pointerStartRef = useRef<{ x: number; y: number } | null>(null)\n\n const handlePointerDown = useCallback(\n (e: React.PointerEvent<HTMLLIElement>) => {\n if (e.pointerType === 'pen') {\n pointerStartRef.current = { x: e.clientX, y: e.clientY }\n }\n },\n [],\n )\n\n const handlePointerUp = useCallback(\n (e: React.PointerEvent<HTMLLIElement>) => {\n if (e.pointerType !== 'pen' || disabled === true) return\n const start = pointerStartRef.current\n if (!start) return\n const dx = Math.abs(e.clientX - start.x)\n const dy = Math.abs(e.clientY - start.y)\n // タップとドラッグを区別するための許容量\n if (dx > 8 || dy > 8) return\n penHandledRef.current = true\n setContextValue()\n },\n [disabled, setContextValue],\n )\n\n const handleClick = useCallback(() => {\n if (penHandledRef.current) {\n penHandledRef.current = false\n return\n }\n if (disabled === true) return\n setContextValue()\n }, [disabled, setContextValue])\n\n return (\n // @ts-expect-error TODO: fix mismatch between MenuItemProps and ListItemProps\n <ListItem\n {...props}\n ref={ref}\n data-key={value}\n onKeyDown={handleKeyDown}\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onClick={handleClick}\n tabIndex={-1}\n aria-disabled={disabled}\n role=\"option\"\n >\n {props.children}\n </ListItem>\n )\n})\nexport default MenuItem\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,iCAAsB,SAAS,SAGnC,EAAE,WAAW,GAAG,OAAO,UAAU,GAAG,SACpC,KACA;CACA,MAAM,CAAC,eAAe,mBAAmB,0DAAyB,KAAK;CACvE,MAAM,kCAAuB,KAAK;CAClC,MAAM,oCAA0D,IAAI;CAEpE,MAAM,4CACH,MAAyC;EACxC,IAAI,EAAE,gBAAgB,OACpB,gBAAgB,UAAU;GAAE,GAAG,EAAE;GAAS,GAAG,EAAE;EAAQ;CAE3D,GACA,CAAA,CACF;CAEA,MAAM,0CACH,MAAyC;EACxC,IAAI,EAAE,gBAAgB,SAAS,aAAa,MAAM;EAClD,MAAM,QAAQ,gBAAgB;EAC9B,IAAI,CAAC,OAAO;EACZ,MAAM,KAAK,KAAK,IAAI,EAAE,UAAU,MAAM,CAAC;EACvC,MAAM,KAAK,KAAK,IAAI,EAAE,UAAU,MAAM,CAAC;EAEvC,IAAI,KAAK,KAAK,KAAK,GAAG;EACtB,cAAc,UAAU;EACxB,gBAAgB;CAClB,GACA,CAAC,UAAU,eAAe,CAC5B;CAEA,MAAM,2CAAgC;EACpC,IAAI,cAAc,SAAS;GACzB,cAAc,UAAU;GACxB;EACF;EACA,IAAI,aAAa,MAAM;EACvB,gBAAgB;CAClB,GAAG,CAAC,UAAU,eAAe,CAAC;CAE9B,OAEE,2CAAC,uBAAD;EACE,GAAI;EACC;EACL,YAAU;EACV,WAAW;EACX,eAAe;EACf,aAAa;EACb,SAAS;EACT,UAAU;EACV,iBAAe;EACf,MAAK;YAEJ,MAAM;CACC;AAEd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/MenuItem/index.tsx"],"names":[],"mappings":"AACA,OAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGrD,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;AAEpB;;;GAGG;AACH,QAAA,MAAM,QAAQ,qMAsBZ,CAAA;AACF,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/MenuItem/index.tsx"],"names":[],"mappings":"AACA,OAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGrD,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;AAEpB;;;GAGG;AACH,QAAA,MAAM,QAAQ,qMA4DZ,CAAA;eACa,QAAQ"}