smarthr-ui 96.1.3 → 98.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 (341) hide show
  1. package/lib/components/AppHeader/components/common/AppLauncherFeatures.cjs +1 -1
  2. package/lib/components/AppHeader/components/common/AppLauncherFeatures.js +1 -1
  3. package/lib/components/AppHeader/components/common/AppLauncherSortDropdown.cjs +1 -1
  4. package/lib/components/AppHeader/components/common/AppLauncherSortDropdown.js +1 -1
  5. package/lib/components/AppHeader/components/desktop/AppLauncher.cjs +5 -5
  6. package/lib/components/AppHeader/components/desktop/AppLauncher.cjs.map +1 -1
  7. package/lib/components/AppHeader/components/desktop/AppLauncher.js +5 -5
  8. package/lib/components/AppHeader/components/desktop/AppLauncher.js.map +1 -1
  9. package/lib/components/AppHeader/components/desktop/DesktopHeader.cjs +1 -1
  10. package/lib/components/AppHeader/components/desktop/DesktopHeader.js +1 -1
  11. package/lib/components/AppHeader/components/desktop/ReleaseNotesDropdown.cjs +1 -1
  12. package/lib/components/AppHeader/components/desktop/ReleaseNotesDropdown.js +1 -1
  13. package/lib/components/AppHeader/components/desktop/UserInfo.cjs +1 -1
  14. package/lib/components/AppHeader/components/desktop/UserInfo.js +1 -1
  15. package/lib/components/AppHeader/components/mobile/AppLauncher.cjs +1 -1
  16. package/lib/components/AppHeader/components/mobile/AppLauncher.js +1 -1
  17. package/lib/components/AppHeader/components/mobile/AppLauncherFilterDropdown.cjs +1 -1
  18. package/lib/components/AppHeader/components/mobile/AppLauncherFilterDropdown.js +1 -1
  19. package/lib/components/AppHeader/components/mobile/Help.cjs +1 -1
  20. package/lib/components/AppHeader/components/mobile/Help.js +1 -1
  21. package/lib/components/AppHeader/components/mobile/LanguageSelector.cjs +1 -1
  22. package/lib/components/AppHeader/components/mobile/LanguageSelector.js +1 -1
  23. package/lib/components/AppHeader/components/mobile/Menu.cjs +1 -1
  24. package/lib/components/AppHeader/components/mobile/Menu.js +1 -1
  25. package/lib/components/AppHeader/components/mobile/MenuAccordion.cjs +1 -1
  26. package/lib/components/AppHeader/components/mobile/MenuAccordion.js +1 -1
  27. package/lib/components/AppHeader/components/mobile/MenuDialog.cjs +2 -2
  28. package/lib/components/AppHeader/components/mobile/MenuDialog.js +2 -2
  29. package/lib/components/AppHeader/components/mobile/MenuSubHeading.cjs +1 -1
  30. package/lib/components/AppHeader/components/mobile/MenuSubHeading.js +1 -1
  31. package/lib/components/AppHeader/components/mobile/ReleaseNote.cjs +1 -1
  32. package/lib/components/AppHeader/components/mobile/ReleaseNote.js +1 -1
  33. package/lib/components/AppHeader/components/mobile/UserInfo.cjs +2 -2
  34. package/lib/components/AppHeader/components/mobile/UserInfo.js +2 -2
  35. package/lib/components/Browser/Browser.cjs +11 -7
  36. package/lib/components/Browser/Browser.cjs.map +1 -1
  37. package/lib/components/Browser/Browser.js +12 -8
  38. package/lib/components/Browser/Browser.js.map +1 -1
  39. package/lib/components/Calendar/Calendar.cjs +1 -1
  40. package/lib/components/Calendar/Calendar.js +1 -1
  41. package/lib/components/Calendar/CalendarTable.cjs +1 -1
  42. package/lib/components/Calendar/CalendarTable.js +1 -1
  43. package/lib/components/Calendar/YearPicker.cjs +1 -1
  44. package/lib/components/Calendar/YearPicker.js +1 -1
  45. package/lib/components/Combobox/MultiCombobox/MultiCombobox.cjs +122 -134
  46. package/lib/components/Combobox/MultiCombobox/MultiCombobox.cjs.map +1 -1
  47. package/lib/components/Combobox/MultiCombobox/MultiCombobox.js +123 -135
  48. package/lib/components/Combobox/MultiCombobox/MultiCombobox.js.map +1 -1
  49. package/lib/components/Combobox/MultiCombobox/MultiSelectedItem.cjs +1 -1
  50. package/lib/components/Combobox/MultiCombobox/MultiSelectedItem.js +1 -1
  51. package/lib/components/Combobox/SingleCombobox/SingleCombobox.cjs +96 -46
  52. package/lib/components/Combobox/SingleCombobox/SingleCombobox.cjs.map +1 -1
  53. package/lib/components/Combobox/SingleCombobox/SingleCombobox.js +98 -48
  54. package/lib/components/Combobox/SingleCombobox/SingleCombobox.js.map +1 -1
  55. package/lib/components/Combobox/helper.cjs +29 -13
  56. package/lib/components/Combobox/helper.cjs.map +1 -1
  57. package/lib/components/Combobox/helper.d.ts +1 -1
  58. package/lib/components/Combobox/helper.js +29 -13
  59. package/lib/components/Combobox/helper.js.map +1 -1
  60. package/lib/components/Combobox/useListbox.cjs +1 -1
  61. package/lib/components/Combobox/useListbox.js +1 -1
  62. package/lib/components/Combobox/useOptions.cjs +24 -18
  63. package/lib/components/Combobox/useOptions.cjs.map +1 -1
  64. package/lib/components/Combobox/useOptions.js +25 -19
  65. package/lib/components/Combobox/useOptions.js.map +1 -1
  66. package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.cjs +3 -3
  67. package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.cjs.map +1 -1
  68. package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.js +3 -3
  69. package/lib/components/Dialog/ControlledActionDialog/ActionDialogContentInner.js.map +1 -1
  70. package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.cjs +3 -3
  71. package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.cjs.map +1 -1
  72. package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.js +3 -3
  73. package/lib/components/Dialog/ControlledFormDialog/FormDialogContentInner.js.map +1 -1
  74. package/lib/components/Dialog/ControlledMessageDialog/MessageDialogContentInner.cjs +1 -1
  75. package/lib/components/Dialog/ControlledMessageDialog/MessageDialogContentInner.js +1 -1
  76. package/lib/components/Dialog/ControlledStepFormDialog/ControlledStepFormDialog.cjs +1 -1
  77. package/lib/components/Dialog/ControlledStepFormDialog/ControlledStepFormDialog.js +1 -1
  78. package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.cjs +2 -2
  79. package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.cjs.map +1 -1
  80. package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.js +2 -2
  81. package/lib/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.js.map +1 -1
  82. package/lib/components/Dialog/DialogContentInner.cjs +8 -1
  83. package/lib/components/Dialog/DialogContentInner.cjs.map +1 -1
  84. package/lib/components/Dialog/DialogContentInner.js +9 -2
  85. package/lib/components/Dialog/DialogContentInner.js.map +1 -1
  86. package/lib/components/Dialog/DialogContentResponseStatusMessage.cjs +3 -8
  87. package/lib/components/Dialog/DialogContentResponseStatusMessage.cjs.map +1 -1
  88. package/lib/components/Dialog/DialogContentResponseStatusMessage.d.ts +1 -1
  89. package/lib/components/Dialog/DialogContentResponseStatusMessage.js +3 -8
  90. package/lib/components/Dialog/DialogContentResponseStatusMessage.js.map +1 -1
  91. package/lib/components/Dialog/FocusTrap.cjs +4 -1
  92. package/lib/components/Dialog/FocusTrap.cjs.map +1 -1
  93. package/lib/components/Dialog/FocusTrap.js +4 -1
  94. package/lib/components/Dialog/FocusTrap.js.map +1 -1
  95. package/lib/components/Dialog/ModelessDialog/ModelessDialog.cjs +14 -12
  96. package/lib/components/Dialog/ModelessDialog/ModelessDialog.cjs.map +1 -1
  97. package/lib/components/Dialog/ModelessDialog/ModelessDialog.js +14 -12
  98. package/lib/components/Dialog/ModelessDialog/ModelessDialog.js.map +1 -1
  99. package/lib/components/Dialog/RemoteDialogTrigger/RemoteDialogTrigger.cjs +5 -2
  100. package/lib/components/Dialog/RemoteDialogTrigger/RemoteDialogTrigger.cjs.map +1 -1
  101. package/lib/components/Dialog/RemoteDialogTrigger/RemoteDialogTrigger.js +5 -2
  102. package/lib/components/Dialog/RemoteDialogTrigger/RemoteDialogTrigger.js.map +1 -1
  103. package/lib/components/Disclosure/DisclosureTrigger.cjs +39 -18
  104. package/lib/components/Disclosure/DisclosureTrigger.cjs.map +1 -1
  105. package/lib/components/Disclosure/DisclosureTrigger.js +40 -19
  106. package/lib/components/Disclosure/DisclosureTrigger.js.map +1 -1
  107. package/lib/components/Disclosure/useDisclosure.cjs +8 -14
  108. package/lib/components/Disclosure/useDisclosure.cjs.map +1 -1
  109. package/lib/components/Disclosure/useDisclosure.js +8 -14
  110. package/lib/components/Disclosure/useDisclosure.js.map +1 -1
  111. package/lib/components/DropZone/DropZone.cjs +1 -1
  112. package/lib/components/DropZone/DropZone.js +1 -1
  113. package/lib/components/Dropdown/Dropdown.cjs +36 -34
  114. package/lib/components/Dropdown/Dropdown.cjs.map +1 -1
  115. package/lib/components/Dropdown/Dropdown.js +37 -35
  116. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  117. package/lib/components/Dropdown/DropdownMenuButton/DropdownMenuButton.cjs +5 -3
  118. package/lib/components/Dropdown/DropdownMenuButton/DropdownMenuButton.cjs.map +1 -1
  119. package/lib/components/Dropdown/DropdownMenuButton/DropdownMenuButton.js +5 -3
  120. package/lib/components/Dropdown/DropdownMenuButton/DropdownMenuButton.js.map +1 -1
  121. package/lib/components/Dropdown/DropdownTrigger.cjs +3 -0
  122. package/lib/components/Dropdown/DropdownTrigger.cjs.map +1 -1
  123. package/lib/components/Dropdown/DropdownTrigger.js +3 -0
  124. package/lib/components/Dropdown/DropdownTrigger.js.map +1 -1
  125. package/lib/components/Dropdown/FilterDropdown/FilterDropdown.cjs +3 -5
  126. package/lib/components/Dropdown/FilterDropdown/FilterDropdown.cjs.map +1 -1
  127. package/lib/components/Dropdown/FilterDropdown/FilterDropdown.d.ts +1 -1
  128. package/lib/components/Dropdown/FilterDropdown/FilterDropdown.js +3 -5
  129. package/lib/components/Dropdown/FilterDropdown/FilterDropdown.js.map +1 -1
  130. package/lib/components/Dropdown/SortDropdown/useSortDropdown.cjs +1 -1
  131. package/lib/components/Dropdown/SortDropdown/useSortDropdown.js +1 -1
  132. package/lib/components/ErrorScreen/AuthErrorScreen.cjs +1 -1
  133. package/lib/components/ErrorScreen/AuthErrorScreen.js +1 -1
  134. package/lib/components/ErrorScreen/ForbiddenErrorScreen.cjs +1 -1
  135. package/lib/components/ErrorScreen/ForbiddenErrorScreen.js +1 -1
  136. package/lib/components/ErrorScreen/NotFoundErrorScreen.cjs +1 -1
  137. package/lib/components/ErrorScreen/NotFoundErrorScreen.js +1 -1
  138. package/lib/components/ErrorScreen/UnauthorizedErrorScreen.cjs +1 -1
  139. package/lib/components/ErrorScreen/UnauthorizedErrorScreen.js +1 -1
  140. package/lib/components/FormControl/FormControl.cjs +2 -22
  141. package/lib/components/FormControl/FormControl.cjs.map +1 -1
  142. package/lib/components/FormControl/FormControl.js +2 -22
  143. package/lib/components/FormControl/FormControl.js.map +1 -1
  144. package/lib/components/Header/AppLauncher/AppLauncher.cjs +1 -1
  145. package/lib/components/Header/AppLauncher/AppLauncher.js +1 -1
  146. package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.cjs +1 -1
  147. package/lib/components/Header/LanguageSwitcher/LanguageSwitcher.js +1 -1
  148. package/lib/components/Icon/OpenInNewTabIcon.cjs +1 -1
  149. package/lib/components/Icon/OpenInNewTabIcon.js +1 -1
  150. package/lib/components/InformationPanel/InformationPanel.cjs +1 -1
  151. package/lib/components/InformationPanel/InformationPanel.js +1 -1
  152. package/lib/components/Input/SearchInput/SearchInputIcon.cjs +1 -1
  153. package/lib/components/Input/SearchInput/SearchInputIcon.js +1 -1
  154. package/lib/components/InputFile/InputFileMultiplyAppendable.cjs +13 -18
  155. package/lib/components/InputFile/InputFileMultiplyAppendable.cjs.map +1 -1
  156. package/lib/components/InputFile/InputFileMultiplyAppendable.js +13 -18
  157. package/lib/components/InputFile/InputFileMultiplyAppendable.js.map +1 -1
  158. package/lib/components/InputFile/InputFileNative.cjs +1 -1
  159. package/lib/components/InputFile/InputFileNative.js +1 -1
  160. package/lib/components/Layout/Cluster/Cluster.cjs +0 -1
  161. package/lib/components/Layout/Cluster/Cluster.cjs.map +1 -1
  162. package/lib/components/Layout/Cluster/Cluster.js +0 -1
  163. package/lib/components/Layout/Cluster/Cluster.js.map +1 -1
  164. package/lib/components/Layout/Container/Container.cjs +1 -5
  165. package/lib/components/Layout/Container/Container.cjs.map +1 -1
  166. package/lib/components/Layout/Container/Container.js +1 -5
  167. package/lib/components/Layout/Container/Container.js.map +1 -1
  168. package/lib/components/Layout/Stack/Stack.cjs +22 -22
  169. package/lib/components/Layout/Stack/Stack.cjs.map +1 -1
  170. package/lib/components/Layout/Stack/Stack.js +22 -22
  171. package/lib/components/Layout/Stack/Stack.js.map +1 -1
  172. package/lib/components/LineClamp/LineClamp.cjs +14 -3
  173. package/lib/components/LineClamp/LineClamp.cjs.map +1 -1
  174. package/lib/components/LineClamp/LineClamp.js +14 -3
  175. package/lib/components/LineClamp/LineClamp.js.map +1 -1
  176. package/lib/components/Loader/LoaderSpinner.cjs +1 -1
  177. package/lib/components/Loader/LoaderSpinner.js +1 -1
  178. package/lib/components/Pagination/Pagination.cjs +1 -1
  179. package/lib/components/Pagination/Pagination.js +1 -1
  180. package/lib/components/Pagination/PaginationItemButton.cjs +1 -1
  181. package/lib/components/Pagination/PaginationItemButton.js +1 -1
  182. package/lib/components/Select/Select.cjs +11 -11
  183. package/lib/components/Select/Select.cjs.map +1 -1
  184. package/lib/components/Select/Select.js +12 -12
  185. package/lib/components/Select/Select.js.map +1 -1
  186. package/lib/components/SideNav/SideNav.cjs +3 -22
  187. package/lib/components/SideNav/SideNav.cjs.map +1 -1
  188. package/lib/components/SideNav/SideNav.d.ts +2 -9
  189. package/lib/components/SideNav/SideNav.js +4 -23
  190. package/lib/components/SideNav/SideNav.js.map +1 -1
  191. package/lib/components/SideNav/SideNavContext.cjs +11 -0
  192. package/lib/components/SideNav/SideNavContext.cjs.map +1 -0
  193. package/lib/components/SideNav/SideNavContext.d.ts +7 -0
  194. package/lib/components/SideNav/SideNavContext.js +8 -0
  195. package/lib/components/SideNav/SideNavContext.js.map +1 -0
  196. package/lib/components/SideNav/SideNavItemButton.cjs +12 -7
  197. package/lib/components/SideNav/SideNavItemButton.cjs.map +1 -1
  198. package/lib/components/SideNav/SideNavItemButton.d.ts +5 -11
  199. package/lib/components/SideNav/SideNavItemButton.js +12 -7
  200. package/lib/components/SideNav/SideNavItemButton.js.map +1 -1
  201. package/lib/components/TabBar/TabItem.cjs +11 -9
  202. package/lib/components/TabBar/TabItem.cjs.map +1 -1
  203. package/lib/components/TabBar/TabItem.d.ts +2 -2
  204. package/lib/components/TabBar/TabItem.js +13 -11
  205. package/lib/components/TabBar/TabItem.js.map +1 -1
  206. package/lib/components/Table/Th.cjs +2 -2
  207. package/lib/components/Table/Th.cjs.map +1 -1
  208. package/lib/components/Table/Th.d.ts +0 -2
  209. package/lib/components/Table/Th.js +2 -2
  210. package/lib/components/Table/Th.js.map +1 -1
  211. package/lib/components/Table/ThCheckbox.cjs +1 -1
  212. package/lib/components/Table/ThCheckbox.js +1 -1
  213. package/lib/components/Table/ThSortButton.cjs +5 -6
  214. package/lib/components/Table/ThSortButton.cjs.map +1 -1
  215. package/lib/components/Table/ThSortButton.d.ts +1 -6
  216. package/lib/components/Table/ThSortButton.js +5 -6
  217. package/lib/components/Table/ThSortButton.js.map +1 -1
  218. package/lib/components/WarekiPicker/WarekiPicker.cjs +1 -1
  219. package/lib/components/WarekiPicker/WarekiPicker.js +1 -1
  220. package/lib/hooks/useHandleEscape.cjs +4 -4
  221. package/lib/hooks/useHandleEscape.cjs.map +1 -1
  222. package/lib/hooks/useHandleEscape.d.ts +1 -1
  223. package/lib/hooks/useHandleEscape.js +4 -4
  224. package/lib/hooks/useHandleEscape.js.map +1 -1
  225. package/lib/index.cjs +1 -6
  226. package/lib/index.cjs.map +1 -1
  227. package/lib/index.d.ts +0 -1
  228. package/lib/index.js +1 -4
  229. package/lib/index.js.map +1 -1
  230. package/lib/intl/Localizer.cjs +5 -1
  231. package/lib/intl/Localizer.cjs.map +1 -1
  232. package/lib/intl/Localizer.d.ts +4 -4
  233. package/lib/intl/Localizer.js +5 -1
  234. package/lib/intl/Localizer.js.map +1 -1
  235. package/lib/intl/locales/en_us.json.cjs +133 -0
  236. package/lib/intl/locales/en_us.json.cjs.map +1 -0
  237. package/lib/intl/locales/en_us.json.js +131 -0
  238. package/lib/intl/locales/en_us.json.js.map +1 -0
  239. package/lib/intl/locales/id_id.json.cjs +133 -0
  240. package/lib/intl/locales/id_id.json.cjs.map +1 -0
  241. package/lib/intl/locales/id_id.json.js +131 -0
  242. package/lib/intl/locales/id_id.json.js.map +1 -0
  243. package/lib/intl/locales/index.cjs +24 -18
  244. package/lib/intl/locales/index.cjs.map +1 -1
  245. package/lib/intl/locales/index.d.ts +1135 -1136
  246. package/lib/intl/locales/index.js +25 -19
  247. package/lib/intl/locales/index.js.map +1 -1
  248. package/lib/intl/locales/ja.json.cjs +133 -0
  249. package/lib/intl/locales/ja.json.cjs.map +1 -0
  250. package/lib/intl/locales/ja.json.js +131 -0
  251. package/lib/intl/locales/ja.json.js.map +1 -0
  252. package/lib/intl/locales/ja_easy.json.cjs +133 -0
  253. package/lib/intl/locales/ja_easy.json.cjs.map +1 -0
  254. package/lib/intl/locales/ja_easy.json.js +131 -0
  255. package/lib/intl/locales/ja_easy.json.js.map +1 -0
  256. package/lib/intl/locales/ko_kr.json.cjs +133 -0
  257. package/lib/intl/locales/ko_kr.json.cjs.map +1 -0
  258. package/lib/intl/locales/ko_kr.json.js +131 -0
  259. package/lib/intl/locales/ko_kr.json.js.map +1 -0
  260. package/lib/intl/locales/pt_br.json.cjs +133 -0
  261. package/lib/intl/locales/pt_br.json.cjs.map +1 -0
  262. package/lib/intl/locales/pt_br.json.js +131 -0
  263. package/lib/intl/locales/pt_br.json.js.map +1 -0
  264. package/lib/intl/locales/vi_vn.json.cjs +133 -0
  265. package/lib/intl/locales/vi_vn.json.cjs.map +1 -0
  266. package/lib/intl/locales/vi_vn.json.js +131 -0
  267. package/lib/intl/locales/vi_vn.json.js.map +1 -0
  268. package/lib/intl/locales/zh_hans_cn.json.cjs +133 -0
  269. package/lib/intl/locales/zh_hans_cn.json.cjs.map +1 -0
  270. package/lib/intl/locales/zh_hans_cn.json.js +131 -0
  271. package/lib/intl/locales/zh_hans_cn.json.js.map +1 -0
  272. package/lib/intl/locales/zh_hant_tw.json.cjs +133 -0
  273. package/lib/intl/locales/zh_hant_tw.json.cjs.map +1 -0
  274. package/lib/intl/locales/zh_hant_tw.json.js +131 -0
  275. package/lib/intl/locales/zh_hant_tw.json.js.map +1 -0
  276. package/lib/intl/useIntl.cjs.map +1 -1
  277. package/lib/intl/useIntl.d.ts +3 -3
  278. package/lib/intl/useIntl.js.map +1 -1
  279. package/metadata.json +1 -1
  280. package/package.json +2 -1
  281. package/smarthr-ui.css +0 -94
  282. package/lib/hooks/useDecorators.cjs +0 -18
  283. package/lib/hooks/useDecorators.cjs.map +0 -1
  284. package/lib/hooks/useDecorators.d.ts +0 -6
  285. package/lib/hooks/useDecorators.js +0 -16
  286. package/lib/hooks/useDecorators.js.map +0 -1
  287. package/lib/hooks/useDevice/DeviceProvider.cjs +0 -37
  288. package/lib/hooks/useDevice/DeviceProvider.cjs.map +0 -1
  289. package/lib/hooks/useDevice/DeviceProvider.d.ts +0 -4
  290. package/lib/hooks/useDevice/DeviceProvider.js +0 -35
  291. package/lib/hooks/useDevice/DeviceProvider.js.map +0 -1
  292. package/lib/hooks/useDevice/index.cjs +0 -10
  293. package/lib/hooks/useDevice/index.cjs.map +0 -1
  294. package/lib/hooks/useDevice/index.d.ts +0 -2
  295. package/lib/hooks/useDevice/index.js +0 -3
  296. package/lib/hooks/useDevice/index.js.map +0 -1
  297. package/lib/hooks/useDevice/useDevice.cjs +0 -11
  298. package/lib/hooks/useDevice/useDevice.cjs.map +0 -1
  299. package/lib/hooks/useDevice/useDevice.d.ts +0 -4
  300. package/lib/hooks/useDevice/useDevice.js +0 -8
  301. package/lib/hooks/useDevice/useDevice.js.map +0 -1
  302. package/lib/intl/locales/en_us.cjs +0 -135
  303. package/lib/intl/locales/en_us.cjs.map +0 -1
  304. package/lib/intl/locales/en_us.d.ts +0 -128
  305. package/lib/intl/locales/en_us.js +0 -133
  306. package/lib/intl/locales/en_us.js.map +0 -1
  307. package/lib/intl/locales/id_id.cjs +0 -135
  308. package/lib/intl/locales/id_id.cjs.map +0 -1
  309. package/lib/intl/locales/id_id.d.ts +0 -128
  310. package/lib/intl/locales/id_id.js +0 -133
  311. package/lib/intl/locales/id_id.js.map +0 -1
  312. package/lib/intl/locales/ja_easy.cjs +0 -135
  313. package/lib/intl/locales/ja_easy.cjs.map +0 -1
  314. package/lib/intl/locales/ja_easy.d.ts +0 -128
  315. package/lib/intl/locales/ja_easy.js +0 -133
  316. package/lib/intl/locales/ja_easy.js.map +0 -1
  317. package/lib/intl/locales/ko_kr.cjs +0 -135
  318. package/lib/intl/locales/ko_kr.cjs.map +0 -1
  319. package/lib/intl/locales/ko_kr.d.ts +0 -128
  320. package/lib/intl/locales/ko_kr.js +0 -133
  321. package/lib/intl/locales/ko_kr.js.map +0 -1
  322. package/lib/intl/locales/pt_br.cjs +0 -135
  323. package/lib/intl/locales/pt_br.cjs.map +0 -1
  324. package/lib/intl/locales/pt_br.d.ts +0 -128
  325. package/lib/intl/locales/pt_br.js +0 -133
  326. package/lib/intl/locales/pt_br.js.map +0 -1
  327. package/lib/intl/locales/vi_vn.cjs +0 -135
  328. package/lib/intl/locales/vi_vn.cjs.map +0 -1
  329. package/lib/intl/locales/vi_vn.d.ts +0 -128
  330. package/lib/intl/locales/vi_vn.js +0 -133
  331. package/lib/intl/locales/vi_vn.js.map +0 -1
  332. package/lib/intl/locales/zh_hans_cn.cjs +0 -135
  333. package/lib/intl/locales/zh_hans_cn.cjs.map +0 -1
  334. package/lib/intl/locales/zh_hans_cn.d.ts +0 -128
  335. package/lib/intl/locales/zh_hans_cn.js +0 -133
  336. package/lib/intl/locales/zh_hans_cn.js.map +0 -1
  337. package/lib/intl/locales/zh_hant_tw.cjs +0 -135
  338. package/lib/intl/locales/zh_hant_tw.cjs.map +0 -1
  339. package/lib/intl/locales/zh_hant_tw.d.ts +0 -128
  340. package/lib/intl/locales/zh_hant_tw.js +0 -133
  341. package/lib/intl/locales/zh_hant_tw.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FormDialogContentInner.cjs","sources":["../../../../src/components/Dialog/ControlledFormDialog/FormDialogContentInner.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type ReactNode,\n memo,\n useCallback,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { useIntl } from '../../../intl'\nimport { Button } from '../../Button'\nimport { Cluster, Stack } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nexport type FormDialogHelpers = {\n close: () => void\n}\n\ntype ObjectActionButtonType = {\n /** アクションボタンのラベル */\n text: ReactNode\n /** アクションボタンのスタイル */\n theme?: 'primary' | 'secondary' | 'danger'\n /** アクションボタンを無効にするかどうか */\n disabled?: boolean\n}\n\ntype ObjectCloseButtonType = {\n /** 閉じるボタンのラベル */\n text: ReactNode\n /** 閉じるボタンを無効にするかどうか */\n disabled?: boolean\n}\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** アクションボタン */\n actionButton: ObjectActionButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ダイアログ操作のためのヘルパー関数\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: FormDialogHelpers) => void\n /** 閉じるボタン */\n closeButton: ObjectCloseButtonType\n /** ダイアログフッターの左端操作領域 */\n subActionArea?: ReactNode\n }\n>\n\nexport type FormDialogContentInnerProps = AbstractProps & {\n onClickClose: () => void\n responseStatus?: ResponseStatus\n}\n\nconst ACTION_AREA_CLUSTER_GAP = { row: 0.5, column: 1 } as const\n\nconst formDialogContentInner = tv({\n extend: dialogContentInner,\n slots: {\n form: 'shr-contents',\n },\n})\n\nexport const FormDialogContentInner: FC<FormDialogContentInnerProps> = ({\n children,\n heading,\n contentBgColor,\n contentPadding,\n actionButton,\n onSubmit,\n onClickClose,\n responseStatus,\n closeButton,\n subActionArea,\n}) => {\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Portals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n onSubmit(e, { close: onClickClose })\n },\n [onSubmit, onClickClose],\n )\n\n const calculatedResponseStatus = useResponseStatus(responseStatus)\n\n const styles = useMemo(() => {\n const { form, wrapper, actionArea, buttonArea, message } = formDialogContentInner()\n\n return {\n form: form(),\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section className={styles.wrapper}>\n <DialogHeading {...heading} />\n <form onSubmit={handleSubmitAction} className={styles.form}>\n <DialogBody contentPadding={contentPadding} contentBgColor={contentBgColor}>\n {children}\n </DialogBody>\n <Stack gap={0.5} className={styles.actionArea}>\n <Cluster justify=\"space-between\">\n {subActionArea}\n <ActionAreaCluster\n onClickClose={onClickClose}\n closeButton={closeButton}\n actionButton={actionButton}\n loading={calculatedResponseStatus.isProcessing}\n className={styles.buttonArea}\n />\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calculatedResponseStatus}\n className={styles.message}\n />\n </Stack>\n </form>\n </Section>\n )\n}\n\nconst ActionAreaCluster = memo<\n Pick<FormDialogContentInnerProps, 'onClickClose'> & {\n actionButton: ObjectActionButtonType\n closeButton: ObjectCloseButtonType\n loading: boolean\n className: string\n }\n>(({ onClickClose, closeButton, actionButton, loading, className }) => (\n <Cluster gap={ACTION_AREA_CLUSTER_GAP} className={className}>\n <CloseButton\n onClick={onClickClose}\n disabled={closeButton.disabled || loading}\n text={closeButton.text}\n />\n <ActionButton variant={actionButton.theme} disabled={actionButton.disabled} loading={loading}>\n {actionButton.text}\n </ActionButton>\n </Cluster>\n))\n\nconst ActionButton = memo<\n PropsWithChildren<{\n variant: ObjectActionButtonType['theme']\n disabled: ObjectActionButtonType['disabled']\n loading: boolean\n }>\n>(({ variant = 'primary', disabled, loading, children }) => (\n <Button\n type=\"submit\"\n variant={variant}\n disabled={disabled}\n loading={loading}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {children}\n </Button>\n))\n\nconst CloseButton = memo<{\n onClick: FormDialogContentInnerProps['onClickClose']\n disabled: boolean\n text: ReactNode\n}>(({ onClick, disabled, text }) => {\n const { localize } = useIntl()\n\n const defaultText = useMemo(\n () =>\n localize({\n id: 'smarthr-ui/FormDialog/closeButtonLabel',\n defaultText: 'キャンセル',\n }),\n [localize],\n )\n\n return (\n <Button onClick={onClick} disabled={disabled} className=\"smarthr-ui-Dialog-closeButton\">\n {text ?? defaultText}\n </Button>\n )\n})\n"],"names":["tv","dialogContentInner","useCallback","useResponseStatus","useMemo","_jsxs","Section","_jsx","DialogHeading","DialogBody","Stack","Cluster","DialogContentResponseStatusMessage","memo","Button","useIntl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAEhE,MAAM,sBAAsB,GAAGA,QAAE,CAAC;AAChC,IAAA,MAAM,EAAEC,qDAAkB;AAC1B,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,cAAc;AACrB,KAAA;AACF,CAAA,CAAC;AAEK,MAAM,sBAAsB,GAAoC,CAAC,EACtE,QAAQ,EACR,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACX,aAAa,GACd,KAAI;AACH,IAAA,MAAM,kBAAkB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,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAI;AACjC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAGE,oBAAO,EAAE;IAE9B,MAAM,WAAW,GAAGX,aAAO,CACzB,MACE,QAAQ,CAAC;AACP,QAAA,EAAE,EAAE,wCAAwC;AAC5C,QAAA,WAAW,EAAE,OAAO;AACrB,KAAA,CAAC,EACJ,CAAC,QAAQ,CAAC,CACX;IAED,QACEG,eAACO,+BAAM,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,+BAA+B,EAAA,QAAA,EACpF,IAAI,IAAI,WAAW,EAAA,CACb;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"FormDialogContentInner.cjs","sources":["../../../../src/components/Dialog/ControlledFormDialog/FormDialogContentInner.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type ReactNode,\n memo,\n useCallback,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { useIntl } from '../../../intl'\nimport { Button } from '../../Button'\nimport { Cluster } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nexport type FormDialogHelpers = {\n close: () => void\n}\n\ntype ObjectActionButtonType = {\n /** アクションボタンのラベル */\n text: ReactNode\n /** アクションボタンのスタイル */\n theme?: 'primary' | 'secondary' | 'danger'\n /** アクションボタンを無効にするかどうか */\n disabled?: boolean\n}\n\ntype ObjectCloseButtonType = {\n /** 閉じるボタンのラベル */\n text: ReactNode\n /** 閉じるボタンを無効にするかどうか */\n disabled?: boolean\n}\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** アクションボタン */\n actionButton: ObjectActionButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ダイアログ操作のためのヘルパー関数\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: FormDialogHelpers) => void\n /** 閉じるボタン */\n closeButton: ObjectCloseButtonType\n /** ダイアログフッターの左端操作領域 */\n subActionArea?: ReactNode\n }\n>\n\nexport type FormDialogContentInnerProps = AbstractProps & {\n onClickClose: () => void\n responseStatus?: ResponseStatus\n}\n\nconst ACTION_AREA_CLUSTER_GAP = { row: 0.5, column: 1 } as const\n\nconst formDialogContentInner = tv({\n extend: dialogContentInner,\n slots: {\n form: 'shr-contents',\n },\n})\n\nexport const FormDialogContentInner: FC<FormDialogContentInnerProps> = ({\n children,\n heading,\n contentBgColor,\n contentPadding,\n actionButton,\n onSubmit,\n onClickClose,\n responseStatus,\n closeButton,\n subActionArea,\n}) => {\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Portals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n onSubmit(e, { close: onClickClose })\n },\n [onSubmit, onClickClose],\n )\n\n const calculatedResponseStatus = useResponseStatus(responseStatus)\n\n const styles = useMemo(() => {\n const { form, wrapper, actionArea, buttonArea, message } = formDialogContentInner()\n\n return {\n form: form(),\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section className={styles.wrapper}>\n <DialogHeading {...heading} />\n <form onSubmit={handleSubmitAction} className={styles.form}>\n <DialogBody contentPadding={contentPadding} contentBgColor={contentBgColor}>\n {children}\n </DialogBody>\n <div className={styles.actionArea}>\n <Cluster justify=\"space-between\">\n {subActionArea}\n <ActionAreaCluster\n onClickClose={onClickClose}\n closeButton={closeButton}\n actionButton={actionButton}\n loading={calculatedResponseStatus.isProcessing}\n className={styles.buttonArea}\n />\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calculatedResponseStatus}\n className={styles.message}\n />\n </div>\n </form>\n </Section>\n )\n}\n\nconst ActionAreaCluster = memo<\n Pick<FormDialogContentInnerProps, 'onClickClose'> & {\n actionButton: ObjectActionButtonType\n closeButton: ObjectCloseButtonType\n loading: boolean\n className: string\n }\n>(({ onClickClose, closeButton, actionButton, loading, className }) => (\n <Cluster gap={ACTION_AREA_CLUSTER_GAP} className={className}>\n <CloseButton\n onClick={onClickClose}\n disabled={closeButton.disabled || loading}\n text={closeButton.text}\n />\n <ActionButton variant={actionButton.theme} disabled={actionButton.disabled} loading={loading}>\n {actionButton.text}\n </ActionButton>\n </Cluster>\n))\n\nconst ActionButton = memo<\n PropsWithChildren<{\n variant: ObjectActionButtonType['theme']\n disabled: ObjectActionButtonType['disabled']\n loading: boolean\n }>\n>(({ variant = 'primary', disabled, loading, children }) => (\n <Button\n type=\"submit\"\n variant={variant}\n disabled={disabled}\n loading={loading}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {children}\n </Button>\n))\n\nconst CloseButton = memo<{\n onClick: FormDialogContentInnerProps['onClickClose']\n disabled: boolean\n text: ReactNode\n}>(({ onClick, disabled, text }) => {\n const { localize } = useIntl()\n\n const defaultText = useMemo(\n () =>\n localize({\n id: 'smarthr-ui/FormDialog/closeButtonLabel',\n defaultText: 'キャンセル',\n }),\n [localize],\n )\n\n return (\n <Button onClick={onClick} disabled={disabled} className=\"smarthr-ui-Dialog-closeButton\">\n {text ?? defaultText}\n </Button>\n )\n})\n"],"names":["tv","dialogContentInner","useCallback","useResponseStatus","useMemo","_jsxs","Section","_jsx","DialogHeading","DialogBody","Cluster","DialogContentResponseStatusMessage","memo","Button","useIntl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,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AY,GAAGK,UAAI,CAMvB,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MACrDL,cAAA,CAACM,+BAAM,EAAA,EACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,gCAAgC,YAEzC,QAAQ,EAAA,CACF,CACV,CAAC;AAEF,MAAM,WAAW,GAAGD,UAAI,CAIrB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAI;AACjC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAGE,oBAAO,EAAE;IAE9B,MAAM,WAAW,GAAGV,aAAO,CACzB,MACE,QAAQ,CAAC;AACP,QAAA,EAAE,EAAE,wCAAwC;AAC5C,QAAA,WAAW,EAAE,OAAO;AACrB,KAAA,CAAC,EACJ,CAAC,QAAQ,CAAC,CACX;IAED,QACEG,eAACM,+BAAM,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,+BAA+B,EAAA,QAAA,EACpF,IAAI,IAAI,WAAW,EAAA,CACb;AAEb,CAAC,CAAC;;;;"}
@@ -4,13 +4,13 @@ import { tv as ce } from './../../../vendor/.pnpm/tailwind-variants@0.3.1_tailwi
4
4
  import { useResponseStatus } from '../../../hooks/useResponseStatus.js';
5
5
  import '../../../intl/IntlProvider.js';
6
6
  import { useIntl } from '../../../intl/useIntl.js';
7
- import 'react-intl';
7
+ import '../../../intl/Localizer.js';
8
8
  import '../../../_virtual/dayjs.min.js';
9
9
  import '../../../intl/TimeFormatter.js';
10
10
  import { Button } from '../../Button/Button.js';
11
11
  import '../../Button/AnchorButton.js';
12
12
  import '../../Button/UnstyledButton.js';
13
- import { Stack } from '../../Layout/Stack/Stack.js';
13
+ import '../../Layout/Stack/Stack.js';
14
14
  import { Cluster } from '../../Layout/Cluster/Cluster.js';
15
15
  import '../../Layout/Reel/Reel.js';
16
16
  import '../../Layout/Sidebar/Sidebar.js';
@@ -52,7 +52,7 @@ const FormDialogContentInner = ({ children, heading, contentBgColor, contentPadd
52
52
  }, []);
53
53
  return (
54
54
  // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form
55
- jsxs(Section, { className: styles.wrapper, children: [jsx(DialogHeading, { ...heading }), jsxs("form", { onSubmit: handleSubmitAction, className: styles.form, children: [jsx(DialogBody, { contentPadding: contentPadding, contentBgColor: contentBgColor, children: children }), jsxs(Stack, { gap: 0.5, className: styles.actionArea, children: [jsxs(Cluster, { justify: "space-between", children: [subActionArea, jsx(ActionAreaCluster, { onClickClose: onClickClose, closeButton: closeButton, actionButton: actionButton, loading: calculatedResponseStatus.isProcessing, className: styles.buttonArea })] }), jsx(DialogContentResponseStatusMessage, { responseStatus: calculatedResponseStatus, className: styles.message })] })] })] }));
55
+ jsxs(Section, { className: styles.wrapper, children: [jsx(DialogHeading, { ...heading }), jsxs("form", { onSubmit: handleSubmitAction, className: styles.form, children: [jsx(DialogBody, { contentPadding: contentPadding, contentBgColor: contentBgColor, children: children }), jsxs("div", { className: styles.actionArea, children: [jsxs(Cluster, { justify: "space-between", children: [subActionArea, jsx(ActionAreaCluster, { onClickClose: onClickClose, closeButton: closeButton, actionButton: actionButton, loading: calculatedResponseStatus.isProcessing, className: styles.buttonArea })] }), jsx(DialogContentResponseStatusMessage, { responseStatus: calculatedResponseStatus, className: styles.message })] })] })] }));
56
56
  };
57
57
  const ActionAreaCluster = memo(({ onClickClose, closeButton, actionButton, loading, className }) => (jsxs(Cluster, { gap: ACTION_AREA_CLUSTER_GAP, className: className, children: [jsx(CloseButton, { onClick: onClickClose, disabled: closeButton.disabled || loading, text: closeButton.text }), jsx(ActionButton, { variant: actionButton.theme, disabled: actionButton.disabled, loading: loading, children: actionButton.text })] })));
58
58
  const ActionButton = memo(({ variant = 'primary', disabled, loading, children }) => (jsx(Button, { type: "submit", variant: variant, disabled: disabled, loading: loading, className: "smarthr-ui-Dialog-actionButton", children: children })));
@@ -1 +1 @@
1
- {"version":3,"file":"FormDialogContentInner.js","sources":["../../../../src/components/Dialog/ControlledFormDialog/FormDialogContentInner.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type ReactNode,\n memo,\n useCallback,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { useIntl } from '../../../intl'\nimport { Button } from '../../Button'\nimport { Cluster, Stack } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nexport type FormDialogHelpers = {\n close: () => void\n}\n\ntype ObjectActionButtonType = {\n /** アクションボタンのラベル */\n text: ReactNode\n /** アクションボタンのスタイル */\n theme?: 'primary' | 'secondary' | 'danger'\n /** アクションボタンを無効にするかどうか */\n disabled?: boolean\n}\n\ntype ObjectCloseButtonType = {\n /** 閉じるボタンのラベル */\n text: ReactNode\n /** 閉じるボタンを無効にするかどうか */\n disabled?: boolean\n}\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** アクションボタン */\n actionButton: ObjectActionButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ダイアログ操作のためのヘルパー関数\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: FormDialogHelpers) => void\n /** 閉じるボタン */\n closeButton: ObjectCloseButtonType\n /** ダイアログフッターの左端操作領域 */\n subActionArea?: ReactNode\n }\n>\n\nexport type FormDialogContentInnerProps = AbstractProps & {\n onClickClose: () => void\n responseStatus?: ResponseStatus\n}\n\nconst ACTION_AREA_CLUSTER_GAP = { row: 0.5, column: 1 } as const\n\nconst formDialogContentInner = tv({\n extend: dialogContentInner,\n slots: {\n form: 'shr-contents',\n },\n})\n\nexport const FormDialogContentInner: FC<FormDialogContentInnerProps> = ({\n children,\n heading,\n contentBgColor,\n contentPadding,\n actionButton,\n onSubmit,\n onClickClose,\n responseStatus,\n closeButton,\n subActionArea,\n}) => {\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Portals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n onSubmit(e, { close: onClickClose })\n },\n [onSubmit, onClickClose],\n )\n\n const calculatedResponseStatus = useResponseStatus(responseStatus)\n\n const styles = useMemo(() => {\n const { form, wrapper, actionArea, buttonArea, message } = formDialogContentInner()\n\n return {\n form: form(),\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section className={styles.wrapper}>\n <DialogHeading {...heading} />\n <form onSubmit={handleSubmitAction} className={styles.form}>\n <DialogBody contentPadding={contentPadding} contentBgColor={contentBgColor}>\n {children}\n </DialogBody>\n <Stack gap={0.5} className={styles.actionArea}>\n <Cluster justify=\"space-between\">\n {subActionArea}\n <ActionAreaCluster\n onClickClose={onClickClose}\n closeButton={closeButton}\n actionButton={actionButton}\n loading={calculatedResponseStatus.isProcessing}\n className={styles.buttonArea}\n />\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calculatedResponseStatus}\n className={styles.message}\n />\n </Stack>\n </form>\n </Section>\n )\n}\n\nconst ActionAreaCluster = memo<\n Pick<FormDialogContentInnerProps, 'onClickClose'> & {\n actionButton: ObjectActionButtonType\n closeButton: ObjectCloseButtonType\n loading: boolean\n className: string\n }\n>(({ onClickClose, closeButton, actionButton, loading, className }) => (\n <Cluster gap={ACTION_AREA_CLUSTER_GAP} className={className}>\n <CloseButton\n onClick={onClickClose}\n disabled={closeButton.disabled || loading}\n text={closeButton.text}\n />\n <ActionButton variant={actionButton.theme} disabled={actionButton.disabled} loading={loading}>\n {actionButton.text}\n </ActionButton>\n </Cluster>\n))\n\nconst ActionButton = memo<\n PropsWithChildren<{\n variant: ObjectActionButtonType['theme']\n disabled: ObjectActionButtonType['disabled']\n loading: boolean\n }>\n>(({ variant = 'primary', disabled, loading, children }) => (\n <Button\n type=\"submit\"\n variant={variant}\n disabled={disabled}\n loading={loading}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {children}\n </Button>\n))\n\nconst CloseButton = memo<{\n onClick: FormDialogContentInnerProps['onClickClose']\n disabled: boolean\n text: ReactNode\n}>(({ onClick, disabled, text }) => {\n const { localize } = useIntl()\n\n const defaultText = useMemo(\n () =>\n localize({\n id: 'smarthr-ui/FormDialog/closeButtonLabel',\n defaultText: 'キャンセル',\n }),\n [localize],\n )\n\n return (\n <Button onClick={onClick} disabled={disabled} className=\"smarthr-ui-Dialog-closeButton\">\n {text ?? defaultText}\n </Button>\n )\n})\n"],"names":["tv","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAEhE,MAAM,sBAAsB,GAAGA,EAAE,CAAC;AAChC,IAAA,MAAM,EAAE,kBAAkB;AAC1B,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,cAAc;AACrB,KAAA;AACF,CAAA,CAAC;AAEK,MAAM,sBAAsB,GAAoC,CAAC,EACtE,QAAQ,EACR,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACX,aAAa,GACd,KAAI;AACH,IAAA,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,CAA6B,K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EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE;IAE9B,MAAM,WAAW,GAAG,OAAO,CACzB,MACE,QAAQ,CAAC;AACP,QAAA,EAAE,EAAE,wCAAwC;AAC5C,QAAA,WAAW,EAAE,OAAO;AACrB,KAAA,CAAC,EACJ,CAAC,QAAQ,CAAC,CACX;IAED,QACEA,IAAC,MAAM,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,+BAA+B,EAAA,QAAA,EACpF,IAAI,IAAI,WAAW,EAAA,CACb;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"FormDialogContentInner.js","sources":["../../../../src/components/Dialog/ControlledFormDialog/FormDialogContentInner.tsx"],"sourcesContent":["import {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n type ReactNode,\n memo,\n useCallback,\n useMemo,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { useIntl } from '../../../intl'\nimport { Button } from '../../Button'\nimport { Cluster } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nexport type FormDialogHelpers = {\n close: () => void\n}\n\ntype ObjectActionButtonType = {\n /** アクションボタンのラベル */\n text: ReactNode\n /** アクションボタンのスタイル */\n theme?: 'primary' | 'secondary' | 'danger'\n /** アクションボタンを無効にするかどうか */\n disabled?: boolean\n}\n\ntype ObjectCloseButtonType = {\n /** 閉じるボタンのラベル */\n text: ReactNode\n /** 閉じるボタンを無効にするかどうか */\n disabled?: boolean\n}\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** アクションボタン */\n actionButton: ObjectActionButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ダイアログ操作のためのヘルパー関数\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: FormDialogHelpers) => void\n /** 閉じるボタン */\n closeButton: ObjectCloseButtonType\n /** ダイアログフッターの左端操作領域 */\n subActionArea?: ReactNode\n }\n>\n\nexport type FormDialogContentInnerProps = AbstractProps & {\n onClickClose: () => void\n responseStatus?: ResponseStatus\n}\n\nconst ACTION_AREA_CLUSTER_GAP = { row: 0.5, column: 1 } as const\n\nconst formDialogContentInner = tv({\n extend: dialogContentInner,\n slots: {\n form: 'shr-contents',\n },\n})\n\nexport const FormDialogContentInner: FC<FormDialogContentInnerProps> = ({\n children,\n heading,\n contentBgColor,\n contentPadding,\n actionButton,\n onSubmit,\n onClickClose,\n responseStatus,\n closeButton,\n subActionArea,\n}) => {\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Portals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n onSubmit(e, { close: onClickClose })\n },\n [onSubmit, onClickClose],\n )\n\n const calculatedResponseStatus = useResponseStatus(responseStatus)\n\n const styles = useMemo(() => {\n const { form, wrapper, actionArea, buttonArea, message } = formDialogContentInner()\n\n return {\n form: form(),\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section className={styles.wrapper}>\n <DialogHeading {...heading} />\n <form onSubmit={handleSubmitAction} className={styles.form}>\n <DialogBody contentPadding={contentPadding} contentBgColor={contentBgColor}>\n {children}\n </DialogBody>\n <div className={styles.actionArea}>\n <Cluster justify=\"space-between\">\n {subActionArea}\n <ActionAreaCluster\n onClickClose={onClickClose}\n closeButton={closeButton}\n actionButton={actionButton}\n loading={calculatedResponseStatus.isProcessing}\n className={styles.buttonArea}\n />\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calculatedResponseStatus}\n className={styles.message}\n />\n </div>\n </form>\n </Section>\n )\n}\n\nconst ActionAreaCluster = memo<\n Pick<FormDialogContentInnerProps, 'onClickClose'> & {\n actionButton: ObjectActionButtonType\n closeButton: ObjectCloseButtonType\n loading: boolean\n className: string\n }\n>(({ onClickClose, closeButton, actionButton, loading, className }) => (\n <Cluster gap={ACTION_AREA_CLUSTER_GAP} className={className}>\n <CloseButton\n onClick={onClickClose}\n disabled={closeButton.disabled || loading}\n text={closeButton.text}\n />\n <ActionButton variant={actionButton.theme} disabled={actionButton.disabled} loading={loading}>\n {actionButton.text}\n </ActionButton>\n </Cluster>\n))\n\nconst ActionButton = memo<\n PropsWithChildren<{\n variant: ObjectActionButtonType['theme']\n disabled: ObjectActionButtonType['disabled']\n loading: boolean\n }>\n>(({ variant = 'primary', disabled, loading, children }) => (\n <Button\n type=\"submit\"\n variant={variant}\n disabled={disabled}\n loading={loading}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {children}\n </Button>\n))\n\nconst CloseButton = memo<{\n onClick: FormDialogContentInnerProps['onClickClose']\n disabled: boolean\n text: ReactNode\n}>(({ onClick, disabled, text }) => {\n const { localize } = useIntl()\n\n const defaultText = useMemo(\n () =>\n localize({\n id: 'smarthr-ui/FormDialog/closeButtonLabel',\n defaultText: 'キャンセル',\n }),\n [localize],\n )\n\n return (\n <Button onClick={onClick} disabled={disabled} className=\"smarthr-ui-Dialog-closeButton\">\n {text ?? defaultText}\n </Button>\n )\n})\n"],"names":["tv","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAW;AAEhE,MAAM,sBAAsB,GAAGA,EAAE,CAAC;AAChC,IAAA,MAAM,EAAE,kBAAkB;AAC1B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AO,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,gCAAgC,YAEzC,QAAQ,EAAA,CACF,CACV,CAAC;AAEF,MAAM,WAAW,GAAG,IAAI,CAIrB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAI;AACjC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE;IAE9B,MAAM,WAAW,GAAG,OAAO,CACzB,MACE,QAAQ,CAAC;AACP,QAAA,EAAE,EAAE,wCAAwC;AAC5C,QAAA,WAAW,EAAE,OAAO;AACrB,KAAA,CAAC,EACJ,CAAC,QAAQ,CAAC,CACX;IAED,QACEA,IAAC,MAAM,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAC,+BAA+B,EAAA,QAAA,EACpF,IAAI,IAAI,WAAW,EAAA,CACb;AAEb,CAAC,CAAC;;;;"}
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  require('../../../intl/IntlProvider.cjs');
6
6
  var intl_useIntl = require('../../../intl/useIntl.cjs');
7
- require('react-intl');
7
+ require('../../../intl/Localizer.cjs');
8
8
  require('../../../_virtual/dayjs.min.cjs');
9
9
  require('../../../intl/TimeFormatter.cjs');
10
10
  var components_Button_Button = require('../../Button/Button.cjs');
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { memo, useMemo } from 'react';
3
3
  import '../../../intl/IntlProvider.js';
4
4
  import { useIntl } from '../../../intl/useIntl.js';
5
- import 'react-intl';
5
+ import '../../../intl/Localizer.js';
6
6
  import '../../../_virtual/dayjs.min.js';
7
7
  import '../../../intl/TimeFormatter.js';
8
8
  import { Button } from '../../Button/Button.js';
@@ -5,7 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  require('../../../intl/IntlProvider.cjs');
7
7
  var intl_useIntl = require('../../../intl/useIntl.cjs');
8
- require('react-intl');
8
+ require('../../../intl/Localizer.cjs');
9
9
  require('../../../_virtual/dayjs.min.cjs');
10
10
  require('../../../intl/TimeFormatter.cjs');
11
11
  var components_Dialog_DialogContentInner = require('../DialogContentInner.cjs');
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { useMemo, useContext, useRef, useCallback } from 'react';
4
4
  import '../../../intl/IntlProvider.js';
5
5
  import { useIntl } from '../../../intl/useIntl.js';
6
- import 'react-intl';
6
+ import '../../../intl/Localizer.js';
7
7
  import '../../../_virtual/dayjs.min.js';
8
8
  import '../../../intl/TimeFormatter.js';
9
9
  import { DialogContentInner } from '../DialogContentInner.js';
@@ -7,7 +7,7 @@ var hooks_useResponseStatus = require('../../../hooks/useResponseStatus.cjs');
7
7
  var components_Button_Button = require('../../Button/Button.cjs');
8
8
  require('../../Button/AnchorButton.cjs');
9
9
  require('../../Button/UnstyledButton.cjs');
10
- var components_Layout_Stack_Stack = require('../../Layout/Stack/Stack.cjs');
10
+ require('../../Layout/Stack/Stack.cjs');
11
11
  var components_Layout_Cluster_Cluster = require('../../Layout/Cluster/Cluster.cjs');
12
12
  require('../../Layout/Reel/Reel.cjs');
13
13
  require('../../Layout/Sidebar/Sidebar.cjs');
@@ -75,7 +75,7 @@ const StepFormDialogContentInner = ({ children, heading, activeStep, contentBgCo
75
75
  const calcedResponseStatus = hooks_useResponseStatus.useResponseStatus(responseStatus);
76
76
  return (
77
77
  // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form
78
- jsxRuntime.jsx(components_SectioningContent_SectioningContent.Section, { children: jsxRuntime.jsx("form", { onSubmit: handleSubmitAction, children: jsxRuntime.jsxs("div", { className: classNames.wrapper, children: [jsxRuntime.jsx(components_Dialog_DialogHeading.DialogHeading, { id: heading.id, sub: heading.sub ? `${heading.sub}${stepText}` : undefined, text: heading.sub ? heading.text : `${heading.text}${stepText}` }), jsxRuntime.jsx(components_Dialog_DialogBody.DialogBody, { contentPadding: contentPadding, contentBgColor: contentBgColor, ref: scrollerRef, children: children }), jsxRuntime.jsxs(components_Layout_Stack_Stack.Stack, { gap: 0.5, className: classNames.actionArea, children: [jsxRuntime.jsxs(components_Layout_Cluster_Cluster.Cluster, { justify: "space-between", gap: { row: 0.5, column: 2 }, children: [!backButton.hidden && activeStep > 1 && (jsxRuntime.jsx(components_Button_Button.Button, { onClick: handleBackAction, variant: backButton.theme, disabled: backButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-backButton", children: backButton.text })), jsxRuntime.jsxs(components_Layout_Cluster_Cluster.Cluster, { gap: BUTTON_COLUMN_GAP, className: classNames.buttonArea, children: [!closeButton.hidden && (jsxRuntime.jsx(components_Button_Button.Button, { onClick: handleCloseAction, variant: closeButton.theme, disabled: closeButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-closeButton", children: closeButton.text })), !submitButton.hidden && (jsxRuntime.jsx(components_Button_Button.Button, { type: "submit", variant: submitButton.theme, disabled: submitButton.disabled, loading: calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-actionButton", children: submitButton.text }))] })] }), jsxRuntime.jsx(components_Dialog_DialogContentResponseStatusMessage.DialogContentResponseStatusMessage, { responseStatus: calcedResponseStatus, className: classNames.message })] })] }) }) }));
78
+ jsxRuntime.jsx(components_SectioningContent_SectioningContent.Section, { children: jsxRuntime.jsx("form", { onSubmit: handleSubmitAction, children: jsxRuntime.jsxs("div", { className: classNames.wrapper, children: [jsxRuntime.jsx(components_Dialog_DialogHeading.DialogHeading, { id: heading.id, sub: heading.sub ? `${heading.sub}${stepText}` : undefined, text: heading.sub ? heading.text : `${heading.text}${stepText}` }), jsxRuntime.jsx(components_Dialog_DialogBody.DialogBody, { contentPadding: contentPadding, contentBgColor: contentBgColor, ref: scrollerRef, children: children }), jsxRuntime.jsxs("div", { className: classNames.actionArea, children: [jsxRuntime.jsxs(components_Layout_Cluster_Cluster.Cluster, { justify: "space-between", gap: { row: 0.5, column: 2 }, children: [!backButton.hidden && activeStep > 1 && (jsxRuntime.jsx(components_Button_Button.Button, { onClick: handleBackAction, variant: backButton.theme, disabled: backButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-backButton", children: backButton.text })), jsxRuntime.jsxs(components_Layout_Cluster_Cluster.Cluster, { gap: BUTTON_COLUMN_GAP, className: classNames.buttonArea, children: [!closeButton.hidden && (jsxRuntime.jsx(components_Button_Button.Button, { onClick: handleCloseAction, variant: closeButton.theme, disabled: closeButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-closeButton", children: closeButton.text })), !submitButton.hidden && (jsxRuntime.jsx(components_Button_Button.Button, { type: "submit", variant: submitButton.theme, disabled: submitButton.disabled, loading: calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-actionButton", children: submitButton.text }))] })] }), jsxRuntime.jsx(components_Dialog_DialogContentResponseStatusMessage.DialogContentResponseStatusMessage, { responseStatus: calcedResponseStatus, className: classNames.message })] })] }) }) }));
79
79
  };
80
80
 
81
81
  exports.StepFormDialogContentInner = StepFormDialogContentInner;
@@ -1 +1 @@
1
- {"version":3,"file":"StepFormDialogContentInner.cjs","sources":["../../../../src/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n useCallback,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { Button } from '../../Button'\nimport { Cluster, Stack } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nimport { StepFormDialogContext, type StepItem } from './StepFormDialogProvider'\n\nimport type { useStepFormDialogButton } from './useStepFormDialogButton'\n\ntype StepFormHelpers = {\n /** 指定したステップに移動する関数 */\n goto: (nextStep: StepItem) => void\n /** ダイアログを閉じる関数 */\n close: () => void\n /** 現在のステップ情報 */\n currentStep: StepItem\n}\n\ntype CommonButtonType = ReturnType<typeof useStepFormDialogButton>\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** 現在のStepNo */\n activeStep: number\n /** submitボタン */\n submitButton: CommonButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ステップ操作用のヘルパー関数群\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: StepFormHelpers) => void\n /** キャンセルボタン */\n closeButton: CommonButtonType\n /** 戻るボタン */\n backButton: CommonButtonType\n }\n>\n\nexport type StepFormDialogContentInnerProps = AbstractProps & {\n firstStep: StepItem\n onClickClose: () => void\n responseStatus?: ResponseStatus\n /** ステップの総数 */\n stepLength: number\n onClickBack?: () => void\n}\n\nconst BUTTON_COLUMN_GAP = {\n row: 0.5,\n column: 1,\n} as const\n\nexport const StepFormDialogContentInner: FC<StepFormDialogContentInnerProps> = ({\n children,\n heading,\n activeStep,\n contentBgColor,\n contentPadding,\n submitButton,\n closeButton,\n backButton,\n stepLength,\n firstStep,\n onSubmit,\n onClickClose,\n responseStatus,\n onClickBack,\n}) => {\n const { currentStep, stepQueue, setCurrentStep, scrollerRef } = useContext(StepFormDialogContext)\n\n const handleCloseAction = useCallback(() => {\n onClickClose()\n setTimeout(() => {\n // HINT: ダイアログが閉じるtransitionが完了してから初期化をしている\n stepQueue.current = []\n setCurrentStep(firstStep)\n }, 300)\n }, [firstStep, stepQueue, setCurrentStep, onClickClose])\n\n const changeCurrentStep = useCallback(\n (step: Parameters<typeof setCurrentStep>[0]) => {\n setCurrentStep(step)\n\n // HINT: stepが切り替わるごとにbodyのscroll位置を先頭に戻す処理\n if (scrollerRef.current) {\n scrollerRef.current.scroll(0, 0)\n }\n },\n [setCurrentStep, scrollerRef],\n )\n\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Potals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n\n const helpers: StepFormHelpers = {\n goto: (nextStep: StepItem) => {\n stepQueue.current.push(currentStep)\n changeCurrentStep(nextStep)\n },\n close: handleCloseAction,\n currentStep,\n }\n\n onSubmit(e, helpers)\n },\n [currentStep, stepQueue, onSubmit, handleCloseAction, changeCurrentStep],\n )\n const handleBackAction = useCallback(() => {\n onClickBack?.()\n\n changeCurrentStep(stepQueue.current.pop() ?? firstStep)\n }, [firstStep, stepQueue, onClickBack, changeCurrentStep])\n\n const classNames = useMemo(() => {\n const { wrapper, actionArea, buttonArea, message } = dialogContentInner()\n\n return {\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n const stepText = stepLength > 1 ? `(${activeStep}/${stepLength})` : ''\n\n const calcedResponseStatus = useResponseStatus(responseStatus)\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section>\n <form onSubmit={handleSubmitAction}>\n <div className={classNames.wrapper}>\n <DialogHeading\n id={heading.id}\n sub={heading.sub ? `${heading.sub}${stepText}` : undefined}\n text={heading.sub ? heading.text : `${heading.text}${stepText}`}\n />\n <DialogBody\n contentPadding={contentPadding}\n contentBgColor={contentBgColor}\n ref={scrollerRef}\n >\n {children}\n </DialogBody>\n <Stack gap={0.5} className={classNames.actionArea}>\n <Cluster justify=\"space-between\" gap={{ row: 0.5, column: 2 }}>\n {!backButton.hidden && activeStep > 1 && (\n <Button\n onClick={handleBackAction}\n variant={backButton.theme}\n disabled={backButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-backButton\"\n >\n {backButton.text}\n </Button>\n )}\n <Cluster gap={BUTTON_COLUMN_GAP} className={classNames.buttonArea}>\n {!closeButton.hidden && (\n <Button\n onClick={handleCloseAction}\n variant={closeButton.theme}\n disabled={closeButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-closeButton\"\n >\n {closeButton.text}\n </Button>\n )}\n {!submitButton.hidden && (\n <Button\n type=\"submit\"\n variant={submitButton.theme}\n disabled={submitButton.disabled}\n loading={calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {submitButton.text}\n </Button>\n )}\n </Cluster>\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calcedResponseStatus}\n className={classNames.message}\n />\n </Stack>\n </div>\n </form>\n </Section>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiEA;AACE;AACA;;AAGK;AAgBL;AAEA;AACE;;;AAGE;;;;AAKJ;;;AAKI;;;AAGF;AAIF;;;;;AAOI;AACE;AACE;;;AAGF;;;AAIF;AACF;AAGF;;;;AAMA;AACE;;;;;;;;AAUF;AAEA;;;AAIE;AA4DJ;;"}
1
+ {"version":3,"file":"StepFormDialogContentInner.cjs","sources":["../../../../src/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n useCallback,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { Button } from '../../Button'\nimport { Cluster } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nimport { StepFormDialogContext, type StepItem } from './StepFormDialogProvider'\n\nimport type { useStepFormDialogButton } from './useStepFormDialogButton'\n\ntype StepFormHelpers = {\n /** 指定したステップに移動する関数 */\n goto: (nextStep: StepItem) => void\n /** ダイアログを閉じる関数 */\n close: () => void\n /** 現在のステップ情報 */\n currentStep: StepItem\n}\n\ntype CommonButtonType = ReturnType<typeof useStepFormDialogButton>\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** 現在のStepNo */\n activeStep: number\n /** submitボタン */\n submitButton: CommonButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ステップ操作用のヘルパー関数群\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: StepFormHelpers) => void\n /** キャンセルボタン */\n closeButton: CommonButtonType\n /** 戻るボタン */\n backButton: CommonButtonType\n }\n>\n\nexport type StepFormDialogContentInnerProps = AbstractProps & {\n firstStep: StepItem\n onClickClose: () => void\n responseStatus?: ResponseStatus\n /** ステップの総数 */\n stepLength: number\n onClickBack?: () => void\n}\n\nconst BUTTON_COLUMN_GAP = {\n row: 0.5,\n column: 1,\n} as const\n\nexport const StepFormDialogContentInner: FC<StepFormDialogContentInnerProps> = ({\n children,\n heading,\n activeStep,\n contentBgColor,\n contentPadding,\n submitButton,\n closeButton,\n backButton,\n stepLength,\n firstStep,\n onSubmit,\n onClickClose,\n responseStatus,\n onClickBack,\n}) => {\n const { currentStep, stepQueue, setCurrentStep, scrollerRef } = useContext(StepFormDialogContext)\n\n const handleCloseAction = useCallback(() => {\n onClickClose()\n setTimeout(() => {\n // HINT: ダイアログが閉じるtransitionが完了してから初期化をしている\n stepQueue.current = []\n setCurrentStep(firstStep)\n }, 300)\n }, [firstStep, stepQueue, setCurrentStep, onClickClose])\n\n const changeCurrentStep = useCallback(\n (step: Parameters<typeof setCurrentStep>[0]) => {\n setCurrentStep(step)\n\n // HINT: stepが切り替わるごとにbodyのscroll位置を先頭に戻す処理\n if (scrollerRef.current) {\n scrollerRef.current.scroll(0, 0)\n }\n },\n [setCurrentStep, scrollerRef],\n )\n\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Potals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n\n const helpers: StepFormHelpers = {\n goto: (nextStep: StepItem) => {\n stepQueue.current.push(currentStep)\n changeCurrentStep(nextStep)\n },\n close: handleCloseAction,\n currentStep,\n }\n\n onSubmit(e, helpers)\n },\n [currentStep, stepQueue, onSubmit, handleCloseAction, changeCurrentStep],\n )\n const handleBackAction = useCallback(() => {\n onClickBack?.()\n\n changeCurrentStep(stepQueue.current.pop() ?? firstStep)\n }, [firstStep, stepQueue, onClickBack, changeCurrentStep])\n\n const classNames = useMemo(() => {\n const { wrapper, actionArea, buttonArea, message } = dialogContentInner()\n\n return {\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n const stepText = stepLength > 1 ? `(${activeStep}/${stepLength})` : ''\n\n const calcedResponseStatus = useResponseStatus(responseStatus)\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section>\n <form onSubmit={handleSubmitAction}>\n <div className={classNames.wrapper}>\n <DialogHeading\n id={heading.id}\n sub={heading.sub ? `${heading.sub}${stepText}` : undefined}\n text={heading.sub ? heading.text : `${heading.text}${stepText}`}\n />\n <DialogBody\n contentPadding={contentPadding}\n contentBgColor={contentBgColor}\n ref={scrollerRef}\n >\n {children}\n </DialogBody>\n <div className={classNames.actionArea}>\n <Cluster justify=\"space-between\" gap={{ row: 0.5, column: 2 }}>\n {!backButton.hidden && activeStep > 1 && (\n <Button\n onClick={handleBackAction}\n variant={backButton.theme}\n disabled={backButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-backButton\"\n >\n {backButton.text}\n </Button>\n )}\n <Cluster gap={BUTTON_COLUMN_GAP} className={classNames.buttonArea}>\n {!closeButton.hidden && (\n <Button\n onClick={handleCloseAction}\n variant={closeButton.theme}\n disabled={closeButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-closeButton\"\n >\n {closeButton.text}\n </Button>\n )}\n {!submitButton.hidden && (\n <Button\n type=\"submit\"\n variant={submitButton.theme}\n disabled={submitButton.disabled}\n loading={calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {submitButton.text}\n </Button>\n )}\n </Cluster>\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calcedResponseStatus}\n className={classNames.message}\n />\n </div>\n </div>\n </form>\n </Section>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiEA;AACE;AACA;;AAGK;AAgBL;AAEA;AACE;;;AAGE;;;;AAKJ;;;AAKI;;;AAGF;AAIF;;;;;AAOI;AACE;AACE;;;AAGF;;;AAIF;AACF;AAGF;;;;AAMA;AACE;;;;;;;;AAUF;AAEA;;;AAIE;AA4DJ;;"}
@@ -5,7 +5,7 @@ import { useResponseStatus } from '../../../hooks/useResponseStatus.js';
5
5
  import { Button } from '../../Button/Button.js';
6
6
  import '../../Button/AnchorButton.js';
7
7
  import '../../Button/UnstyledButton.js';
8
- import { Stack } from '../../Layout/Stack/Stack.js';
8
+ import '../../Layout/Stack/Stack.js';
9
9
  import { Cluster } from '../../Layout/Cluster/Cluster.js';
10
10
  import '../../Layout/Reel/Reel.js';
11
11
  import '../../Layout/Sidebar/Sidebar.js';
@@ -73,7 +73,7 @@ const StepFormDialogContentInner = ({ children, heading, activeStep, contentBgCo
73
73
  const calcedResponseStatus = useResponseStatus(responseStatus);
74
74
  return (
75
75
  // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form
76
- jsx(Section, { children: jsx("form", { onSubmit: handleSubmitAction, children: jsxs("div", { className: classNames.wrapper, children: [jsx(DialogHeading, { id: heading.id, sub: heading.sub ? `${heading.sub}${stepText}` : undefined, text: heading.sub ? heading.text : `${heading.text}${stepText}` }), jsx(DialogBody, { contentPadding: contentPadding, contentBgColor: contentBgColor, ref: scrollerRef, children: children }), jsxs(Stack, { gap: 0.5, className: classNames.actionArea, children: [jsxs(Cluster, { justify: "space-between", gap: { row: 0.5, column: 2 }, children: [!backButton.hidden && activeStep > 1 && (jsx(Button, { onClick: handleBackAction, variant: backButton.theme, disabled: backButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-backButton", children: backButton.text })), jsxs(Cluster, { gap: BUTTON_COLUMN_GAP, className: classNames.buttonArea, children: [!closeButton.hidden && (jsx(Button, { onClick: handleCloseAction, variant: closeButton.theme, disabled: closeButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-closeButton", children: closeButton.text })), !submitButton.hidden && (jsx(Button, { type: "submit", variant: submitButton.theme, disabled: submitButton.disabled, loading: calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-actionButton", children: submitButton.text }))] })] }), jsx(DialogContentResponseStatusMessage, { responseStatus: calcedResponseStatus, className: classNames.message })] })] }) }) }));
76
+ jsx(Section, { children: jsx("form", { onSubmit: handleSubmitAction, children: jsxs("div", { className: classNames.wrapper, children: [jsx(DialogHeading, { id: heading.id, sub: heading.sub ? `${heading.sub}${stepText}` : undefined, text: heading.sub ? heading.text : `${heading.text}${stepText}` }), jsx(DialogBody, { contentPadding: contentPadding, contentBgColor: contentBgColor, ref: scrollerRef, children: children }), jsxs("div", { className: classNames.actionArea, children: [jsxs(Cluster, { justify: "space-between", gap: { row: 0.5, column: 2 }, children: [!backButton.hidden && activeStep > 1 && (jsx(Button, { onClick: handleBackAction, variant: backButton.theme, disabled: backButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-backButton", children: backButton.text })), jsxs(Cluster, { gap: BUTTON_COLUMN_GAP, className: classNames.buttonArea, children: [!closeButton.hidden && (jsx(Button, { onClick: handleCloseAction, variant: closeButton.theme, disabled: closeButton.disabled || calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-closeButton", children: closeButton.text })), !submitButton.hidden && (jsx(Button, { type: "submit", variant: submitButton.theme, disabled: submitButton.disabled, loading: calcedResponseStatus.isProcessing, className: "smarthr-ui-Dialog-actionButton", children: submitButton.text }))] })] }), jsx(DialogContentResponseStatusMessage, { responseStatus: calcedResponseStatus, className: classNames.message })] })] }) }) }));
77
77
  };
78
78
 
79
79
  export { StepFormDialogContentInner };
@@ -1 +1 @@
1
- {"version":3,"file":"StepFormDialogContentInner.js","sources":["../../../../src/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n useCallback,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { Button } from '../../Button'\nimport { Cluster, Stack } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nimport { StepFormDialogContext, type StepItem } from './StepFormDialogProvider'\n\nimport type { useStepFormDialogButton } from './useStepFormDialogButton'\n\ntype StepFormHelpers = {\n /** 指定したステップに移動する関数 */\n goto: (nextStep: StepItem) => void\n /** ダイアログを閉じる関数 */\n close: () => void\n /** 現在のステップ情報 */\n currentStep: StepItem\n}\n\ntype CommonButtonType = ReturnType<typeof useStepFormDialogButton>\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** 現在のStepNo */\n activeStep: number\n /** submitボタン */\n submitButton: CommonButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ステップ操作用のヘルパー関数群\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: StepFormHelpers) => void\n /** キャンセルボタン */\n closeButton: CommonButtonType\n /** 戻るボタン */\n backButton: CommonButtonType\n }\n>\n\nexport type StepFormDialogContentInnerProps = AbstractProps & {\n firstStep: StepItem\n onClickClose: () => void\n responseStatus?: ResponseStatus\n /** ステップの総数 */\n stepLength: number\n onClickBack?: () => void\n}\n\nconst BUTTON_COLUMN_GAP = {\n row: 0.5,\n column: 1,\n} as const\n\nexport const StepFormDialogContentInner: FC<StepFormDialogContentInnerProps> = ({\n children,\n heading,\n activeStep,\n contentBgColor,\n contentPadding,\n submitButton,\n closeButton,\n backButton,\n stepLength,\n firstStep,\n onSubmit,\n onClickClose,\n responseStatus,\n onClickBack,\n}) => {\n const { currentStep, stepQueue, setCurrentStep, scrollerRef } = useContext(StepFormDialogContext)\n\n const handleCloseAction = useCallback(() => {\n onClickClose()\n setTimeout(() => {\n // HINT: ダイアログが閉じるtransitionが完了してから初期化をしている\n stepQueue.current = []\n setCurrentStep(firstStep)\n }, 300)\n }, [firstStep, stepQueue, setCurrentStep, onClickClose])\n\n const changeCurrentStep = useCallback(\n (step: Parameters<typeof setCurrentStep>[0]) => {\n setCurrentStep(step)\n\n // HINT: stepが切り替わるごとにbodyのscroll位置を先頭に戻す処理\n if (scrollerRef.current) {\n scrollerRef.current.scroll(0, 0)\n }\n },\n [setCurrentStep, scrollerRef],\n )\n\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Potals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n\n const helpers: StepFormHelpers = {\n goto: (nextStep: StepItem) => {\n stepQueue.current.push(currentStep)\n changeCurrentStep(nextStep)\n },\n close: handleCloseAction,\n currentStep,\n }\n\n onSubmit(e, helpers)\n },\n [currentStep, stepQueue, onSubmit, handleCloseAction, changeCurrentStep],\n )\n const handleBackAction = useCallback(() => {\n onClickBack?.()\n\n changeCurrentStep(stepQueue.current.pop() ?? firstStep)\n }, [firstStep, stepQueue, onClickBack, changeCurrentStep])\n\n const classNames = useMemo(() => {\n const { wrapper, actionArea, buttonArea, message } = dialogContentInner()\n\n return {\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n const stepText = stepLength > 1 ? `(${activeStep}/${stepLength})` : ''\n\n const calcedResponseStatus = useResponseStatus(responseStatus)\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section>\n <form onSubmit={handleSubmitAction}>\n <div className={classNames.wrapper}>\n <DialogHeading\n id={heading.id}\n sub={heading.sub ? `${heading.sub}${stepText}` : undefined}\n text={heading.sub ? heading.text : `${heading.text}${stepText}`}\n />\n <DialogBody\n contentPadding={contentPadding}\n contentBgColor={contentBgColor}\n ref={scrollerRef}\n >\n {children}\n </DialogBody>\n <Stack gap={0.5} className={classNames.actionArea}>\n <Cluster justify=\"space-between\" gap={{ row: 0.5, column: 2 }}>\n {!backButton.hidden && activeStep > 1 && (\n <Button\n onClick={handleBackAction}\n variant={backButton.theme}\n disabled={backButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-backButton\"\n >\n {backButton.text}\n </Button>\n )}\n <Cluster gap={BUTTON_COLUMN_GAP} className={classNames.buttonArea}>\n {!closeButton.hidden && (\n <Button\n onClick={handleCloseAction}\n variant={closeButton.theme}\n disabled={closeButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-closeButton\"\n >\n {closeButton.text}\n </Button>\n )}\n {!submitButton.hidden && (\n <Button\n type=\"submit\"\n variant={submitButton.theme}\n disabled={submitButton.disabled}\n loading={calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {submitButton.text}\n </Button>\n )}\n </Cluster>\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calcedResponseStatus}\n className={classNames.message}\n />\n </Stack>\n </div>\n </form>\n </Section>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiEA;AACE;AACA;;AAGK;AAgBL;AAEA;AACE;;;AAGE;;;;AAKJ;;;AAKI;;;AAGF;AAIF;;;;;AAOI;AACE;AACE;;;AAGF;;;AAIF;AACF;AAGF;;;;AAMA;AACE;;;;;;;;AAUF;AAEA;;;AAIE;AA4DJ;;"}
1
+ {"version":3,"file":"StepFormDialogContentInner.js","sources":["../../../../src/components/Dialog/ControlledStepFormDialog/StepFormDialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type FC,\n type FormEvent,\n type PropsWithChildren,\n useCallback,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type ResponseStatus, useResponseStatus } from '../../../hooks/useResponseStatus'\nimport { Button } from '../../Button'\nimport { Cluster } from '../../Layout'\nimport { Section } from '../../SectioningContent'\nimport { DialogBody, type Props as DialogBodyProps } from '../DialogBody'\nimport { DialogContentResponseStatusMessage } from '../DialogContentResponseStatusMessage'\nimport { DialogHeading, type Props as DialogHeadingProps } from '../DialogHeading'\nimport { dialogContentInner } from '../dialogInnerStyle'\n\nimport { StepFormDialogContext, type StepItem } from './StepFormDialogProvider'\n\nimport type { useStepFormDialogButton } from './useStepFormDialogButton'\n\ntype StepFormHelpers = {\n /** 指定したステップに移動する関数 */\n goto: (nextStep: StepItem) => void\n /** ダイアログを閉じる関数 */\n close: () => void\n /** 現在のステップ情報 */\n currentStep: StepItem\n}\n\ntype CommonButtonType = ReturnType<typeof useStepFormDialogButton>\n\nexport type AbstractProps = PropsWithChildren<\n DialogBodyProps & {\n /** ダイアログタイトル */\n heading: DialogHeadingProps\n /** 現在のStepNo */\n activeStep: number\n /** submitボタン */\n submitButton: CommonButtonType\n /**\n * アクションボタンをクリックした時に発火するコールバック関数\n * @param e フォームイベント\n * @param helpers ステップ操作用のヘルパー関数群\n */\n onSubmit: (e: FormEvent<HTMLFormElement>, helpers: StepFormHelpers) => void\n /** キャンセルボタン */\n closeButton: CommonButtonType\n /** 戻るボタン */\n backButton: CommonButtonType\n }\n>\n\nexport type StepFormDialogContentInnerProps = AbstractProps & {\n firstStep: StepItem\n onClickClose: () => void\n responseStatus?: ResponseStatus\n /** ステップの総数 */\n stepLength: number\n onClickBack?: () => void\n}\n\nconst BUTTON_COLUMN_GAP = {\n row: 0.5,\n column: 1,\n} as const\n\nexport const StepFormDialogContentInner: FC<StepFormDialogContentInnerProps> = ({\n children,\n heading,\n activeStep,\n contentBgColor,\n contentPadding,\n submitButton,\n closeButton,\n backButton,\n stepLength,\n firstStep,\n onSubmit,\n onClickClose,\n responseStatus,\n onClickBack,\n}) => {\n const { currentStep, stepQueue, setCurrentStep, scrollerRef } = useContext(StepFormDialogContext)\n\n const handleCloseAction = useCallback(() => {\n onClickClose()\n setTimeout(() => {\n // HINT: ダイアログが閉じるtransitionが完了してから初期化をしている\n stepQueue.current = []\n setCurrentStep(firstStep)\n }, 300)\n }, [firstStep, stepQueue, setCurrentStep, onClickClose])\n\n const changeCurrentStep = useCallback(\n (step: Parameters<typeof setCurrentStep>[0]) => {\n setCurrentStep(step)\n\n // HINT: stepが切り替わるごとにbodyのscroll位置を先頭に戻す処理\n if (scrollerRef.current) {\n scrollerRef.current.scroll(0, 0)\n }\n },\n [setCurrentStep, scrollerRef],\n )\n\n const handleSubmitAction = useCallback(\n (e: FormEvent<HTMLFormElement>) => {\n e.preventDefault()\n // HINT: React Potals などで擬似的にformがネストしている場合など、stopPropagationを実行しないと\n // 親formが意図せずsubmitされてしまう場合がある\n e.stopPropagation()\n\n const helpers: StepFormHelpers = {\n goto: (nextStep: StepItem) => {\n stepQueue.current.push(currentStep)\n changeCurrentStep(nextStep)\n },\n close: handleCloseAction,\n currentStep,\n }\n\n onSubmit(e, helpers)\n },\n [currentStep, stepQueue, onSubmit, handleCloseAction, changeCurrentStep],\n )\n const handleBackAction = useCallback(() => {\n onClickBack?.()\n\n changeCurrentStep(stepQueue.current.pop() ?? firstStep)\n }, [firstStep, stepQueue, onClickBack, changeCurrentStep])\n\n const classNames = useMemo(() => {\n const { wrapper, actionArea, buttonArea, message } = dialogContentInner()\n\n return {\n wrapper: wrapper(),\n actionArea: actionArea(),\n buttonArea: buttonArea(),\n message: message(),\n }\n }, [])\n\n const stepText = stepLength > 1 ? `(${activeStep}/${stepLength})` : ''\n\n const calcedResponseStatus = useResponseStatus(responseStatus)\n\n return (\n // eslint-disable-next-line smarthr/a11y-prohibit-sectioning-content-in-form\n <Section>\n <form onSubmit={handleSubmitAction}>\n <div className={classNames.wrapper}>\n <DialogHeading\n id={heading.id}\n sub={heading.sub ? `${heading.sub}${stepText}` : undefined}\n text={heading.sub ? heading.text : `${heading.text}${stepText}`}\n />\n <DialogBody\n contentPadding={contentPadding}\n contentBgColor={contentBgColor}\n ref={scrollerRef}\n >\n {children}\n </DialogBody>\n <div className={classNames.actionArea}>\n <Cluster justify=\"space-between\" gap={{ row: 0.5, column: 2 }}>\n {!backButton.hidden && activeStep > 1 && (\n <Button\n onClick={handleBackAction}\n variant={backButton.theme}\n disabled={backButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-backButton\"\n >\n {backButton.text}\n </Button>\n )}\n <Cluster gap={BUTTON_COLUMN_GAP} className={classNames.buttonArea}>\n {!closeButton.hidden && (\n <Button\n onClick={handleCloseAction}\n variant={closeButton.theme}\n disabled={closeButton.disabled || calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-closeButton\"\n >\n {closeButton.text}\n </Button>\n )}\n {!submitButton.hidden && (\n <Button\n type=\"submit\"\n variant={submitButton.theme}\n disabled={submitButton.disabled}\n loading={calcedResponseStatus.isProcessing}\n className=\"smarthr-ui-Dialog-actionButton\"\n >\n {submitButton.text}\n </Button>\n )}\n </Cluster>\n </Cluster>\n <DialogContentResponseStatusMessage\n responseStatus={calcedResponseStatus}\n className={classNames.message}\n />\n </div>\n </div>\n </form>\n </Section>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiEA;AACE;AACA;;AAGK;AAgBL;AAEA;AACE;;;AAGE;;;;AAKJ;;;AAKI;;;AAGF;AAIF;;;;;AAOI;AACE;AACE;;;AAGF;;;AAIF;AACF;AAGF;;;;AAMA;AACE;;;;;;;;AAUF;AAEA;;;AAIE;AA4DJ;;"}
@@ -57,7 +57,14 @@ const DialogContentInner = ({ onClickOverlay, onPressEscape, isOpen, id, width,
57
57
  return actualWidth ? { width: actualWidth } : undefined;
58
58
  }, [width, size]);
59
59
  const innerRef = React.useRef(null);
60
- hooks_useHandleEscape.useHandleEscape(React.useMemo(() => (onPressEscape && isOpen ? onPressEscape : undefined), [isOpen, onPressEscape]));
60
+ // 外部propsのonPressEscapeをrefに保存
61
+ const onPressEscapeRef = React.useRef(onPressEscape);
62
+ onPressEscapeRef.current = onPressEscape;
63
+ // stableなcallbackを作成
64
+ const memoizedOnPressEscape = React.useCallback(() => {
65
+ onPressEscapeRef.current?.();
66
+ }, []);
67
+ hooks_useHandleEscape.useHandleEscape(isOpen ? memoizedOnPressEscape : undefined);
61
68
  components_Dialog_useBodyScrollLock.useBodyScrollLock(isOpen);
62
69
  return (jsxRuntime.jsx(components_Dialog_DialogOverlap.DialogOverlap, { isOpen: isOpen, children: jsxRuntime.jsxs("div", { id: id, className: classNames.layout, style: style, children: [jsxRuntime.jsx(Overlay, { isOpen: isOpen, onClickOverlay: onClickOverlay, className: classNames.background }), jsxRuntime.jsx("div", { ...rest, ref: innerRef, role: "dialog", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-modal": "true", className: classNames.inner, children: jsxRuntime.jsx(components_Dialog_FocusTrap.FocusTrap, { firstFocusTarget: firstFocusTarget, ref: focusTrapRef, children: children }) })] }) }));
63
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentInner.cjs","sources":["../../../src/components/Dialog/DialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type RefObject,\n memo,\n useMemo,\n useRef,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useHandleEscape } from '../../hooks/useHandleEscape'\nimport { dialogSize } from '../../tailwind'\n\nimport { DialogOverlap } from './DialogOverlap'\nimport { FocusTrap, type FocusTrapRef } from './FocusTrap'\nimport { useBodyScrollLock } from './useBodyScrollLock'\n\nimport type { DialogSize } from './types'\n\nexport type DialogContentInnerProps = PropsWithChildren<{\n /**\n * オーバーレイをクリックした時に発火するコールバック関数\n */\n onClickOverlay?: () => void\n /**\n * エスケープキーを押下した時に発火するコールバック関数\n */\n onPressEscape?: () => void\n /**\n * ダイアログを開いているかどうか\n */\n isOpen: boolean\n /**\n * @deprecated ダイアログの幅を指定する場合は、`width` ではなく `size` を使用してください。\n * ダイアログの幅\n */\n width?: string | number\n /**\n * ダイアログの大きさ\n */\n size?: DialogSize\n /**\n * ダイアログの `id`\n * TODO 使われてなさそうなので確認\n */\n id?: string\n /**\n * ダイアログを開いた時にフォーカスする対象\n */\n firstFocusTarget?: RefObject<HTMLElement>\n /**\n * ダイアログの `aria-label`\n */\n ariaLabel?: string\n /**\n * ダイアログの `aria-labelledby`\n */\n ariaLabelledby?: string\n /**\n * ダイアログトップのフォーカストラップへの ref\n */\n focusTrapRef?: RefObject<FocusTrapRef>\n}>\ntype Props = DialogContentInnerProps & Omit<ComponentProps<'div'>, keyof DialogContentInnerProps>\n\nconst classNameGenerator = tv({\n slots: {\n layout: ['smarthr-ui-Dialog-wrapper', 'shr-max-w-[calc(100dvw-theme(spacing.1))]'],\n inner: [\n 'smarthr-ui-Dialog',\n 'shr-border-shorthand shr-relative shr-z-1 shr-rounded-m shr-bg-white shr-shadow-layer-3',\n 'contrast-more:shr-border-high-contrast',\n ],\n background: ['smarthr-ui-Dialog-background', 'shr-absolute shr-inset-0 shr-bg-scrim'],\n },\n variants: {\n size: {\n XS: { layout: dialogSize.XS },\n S: { layout: dialogSize.S },\n M: { layout: dialogSize.M },\n L: { layout: dialogSize.L },\n XL: { layout: dialogSize.XL },\n XXL: { layout: dialogSize.XXL },\n FULL: { layout: dialogSize.FULL },\n },\n },\n})\n\nexport const DialogContentInner: FC<Props> = ({\n onClickOverlay,\n onPressEscape,\n isOpen,\n id,\n width,\n size,\n firstFocusTarget,\n ariaLabel,\n ariaLabelledby,\n children,\n className,\n focusTrapRef,\n ...rest\n}) => {\n const classNames = useMemo(() => {\n const { layout, inner, background } = classNameGenerator()\n\n return {\n layout: layout({ size }),\n inner: inner({ className }),\n background: background(),\n }\n }, [size, className])\n const style = useMemo(() => {\n // width は deprecated なので、size が指定されている場合は width を無視する\n const actualWidth = size ? undefined : typeof width === 'number' ? `${width}px` : width\n\n return actualWidth ? { width: actualWidth } : undefined\n }, [width, size])\n\n const innerRef = useRef<HTMLDivElement>(null)\n\n useHandleEscape(\n useMemo(() => (onPressEscape && isOpen ? onPressEscape : undefined), [isOpen, onPressEscape]),\n )\n\n useBodyScrollLock(isOpen)\n\n return (\n <DialogOverlap isOpen={isOpen}>\n <div id={id} className={classNames.layout} style={style}>\n <Overlay\n isOpen={isOpen}\n onClickOverlay={onClickOverlay}\n className={classNames.background}\n />\n <div\n {...rest}\n ref={innerRef}\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-modal=\"true\"\n className={classNames.inner}\n >\n <FocusTrap firstFocusTarget={firstFocusTarget} ref={focusTrapRef}>\n {children}\n </FocusTrap>\n </div>\n </div>\n </DialogOverlap>\n )\n}\n\nconst Overlay = memo<Pick<Props, 'onClickOverlay' | 'isOpen'> & { className: string }>(\n ({ onClickOverlay, isOpen, className }) => {\n const onClick = useMemo(\n () => (onClickOverlay && isOpen ? onClickOverlay : undefined),\n [isOpen, onClickOverlay],\n )\n\n // eslint-disable-next-line smarthr/best-practice-for-interactive-element\n return <div onClick={onClick} className={className} role=\"presentation\" />\n },\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoEA;AACE;AACE;AACA;;;;AAIC;AACD;AACD;AACD;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AACF;AACF;AAEM;AAeL;;;AAII;AACA;;;AAGJ;AACA;;;AAIE;AACF;AAEA;;;AAQA;AAwBF;AAEA;;;AAQI;AACF;;"}
1
+ {"version":3,"file":"DialogContentInner.cjs","sources":["../../../src/components/Dialog/DialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type RefObject,\n memo,\n useCallback,\n useMemo,\n useRef,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useHandleEscape } from '../../hooks/useHandleEscape'\nimport { dialogSize } from '../../tailwind'\n\nimport { DialogOverlap } from './DialogOverlap'\nimport { FocusTrap, type FocusTrapRef } from './FocusTrap'\nimport { useBodyScrollLock } from './useBodyScrollLock'\n\nimport type { DialogSize } from './types'\n\nexport type DialogContentInnerProps = PropsWithChildren<{\n /**\n * オーバーレイをクリックした時に発火するコールバック関数\n */\n onClickOverlay?: () => void\n /**\n * エスケープキーを押下した時に発火するコールバック関数\n */\n onPressEscape?: () => void\n /**\n * ダイアログを開いているかどうか\n */\n isOpen: boolean\n /**\n * @deprecated ダイアログの幅を指定する場合は、`width` ではなく `size` を使用してください。\n * ダイアログの幅\n */\n width?: string | number\n /**\n * ダイアログの大きさ\n */\n size?: DialogSize\n /**\n * ダイアログの `id`\n * TODO 使われてなさそうなので確認\n */\n id?: string\n /**\n * ダイアログを開いた時にフォーカスする対象\n */\n firstFocusTarget?: RefObject<HTMLElement>\n /**\n * ダイアログの `aria-label`\n */\n ariaLabel?: string\n /**\n * ダイアログの `aria-labelledby`\n */\n ariaLabelledby?: string\n /**\n * ダイアログトップのフォーカストラップへの ref\n */\n focusTrapRef?: RefObject<FocusTrapRef>\n}>\ntype Props = DialogContentInnerProps & Omit<ComponentProps<'div'>, keyof DialogContentInnerProps>\n\nconst classNameGenerator = tv({\n slots: {\n layout: ['smarthr-ui-Dialog-wrapper', 'shr-max-w-[calc(100dvw-theme(spacing.1))]'],\n inner: [\n 'smarthr-ui-Dialog',\n 'shr-border-shorthand shr-relative shr-z-1 shr-rounded-m shr-bg-white shr-shadow-layer-3',\n 'contrast-more:shr-border-high-contrast',\n ],\n background: ['smarthr-ui-Dialog-background', 'shr-absolute shr-inset-0 shr-bg-scrim'],\n },\n variants: {\n size: {\n XS: { layout: dialogSize.XS },\n S: { layout: dialogSize.S },\n M: { layout: dialogSize.M },\n L: { layout: dialogSize.L },\n XL: { layout: dialogSize.XL },\n XXL: { layout: dialogSize.XXL },\n FULL: { layout: dialogSize.FULL },\n },\n },\n})\n\nexport const DialogContentInner: FC<Props> = ({\n onClickOverlay,\n onPressEscape,\n isOpen,\n id,\n width,\n size,\n firstFocusTarget,\n ariaLabel,\n ariaLabelledby,\n children,\n className,\n focusTrapRef,\n ...rest\n}) => {\n const classNames = useMemo(() => {\n const { layout, inner, background } = classNameGenerator()\n\n return {\n layout: layout({ size }),\n inner: inner({ className }),\n background: background(),\n }\n }, [size, className])\n const style = useMemo(() => {\n // width は deprecated なので、size が指定されている場合は width を無視する\n const actualWidth = size ? undefined : typeof width === 'number' ? `${width}px` : width\n\n return actualWidth ? { width: actualWidth } : undefined\n }, [width, size])\n\n const innerRef = useRef<HTMLDivElement>(null)\n\n // 外部propsのonPressEscapeをrefに保存\n const onPressEscapeRef = useRef(onPressEscape)\n onPressEscapeRef.current = onPressEscape\n\n // stableなcallbackを作成\n const memoizedOnPressEscape = useCallback(() => {\n onPressEscapeRef.current?.()\n }, [])\n\n useHandleEscape(isOpen ? memoizedOnPressEscape : undefined)\n\n useBodyScrollLock(isOpen)\n\n return (\n <DialogOverlap isOpen={isOpen}>\n <div id={id} className={classNames.layout} style={style}>\n <Overlay\n isOpen={isOpen}\n onClickOverlay={onClickOverlay}\n className={classNames.background}\n />\n <div\n {...rest}\n ref={innerRef}\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-modal=\"true\"\n className={classNames.inner}\n >\n <FocusTrap firstFocusTarget={firstFocusTarget} ref={focusTrapRef}>\n {children}\n </FocusTrap>\n </div>\n </div>\n </DialogOverlap>\n )\n}\n\nconst Overlay = memo<Pick<Props, 'onClickOverlay' | 'isOpen'> & { className: string }>(\n ({ onClickOverlay, isOpen, className }) => {\n const onClick = useMemo(\n () => (onClickOverlay && isOpen ? onClickOverlay : undefined),\n [isOpen, onClickOverlay],\n )\n\n // eslint-disable-next-line smarthr/best-practice-for-interactive-element\n return <div onClick={onClick} className={className} role=\"presentation\" />\n },\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqEA;AACE;AACE;AACA;;;;AAIC;AACD;AACD;AACD;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AACF;AACF;AAEM;AAeL;;;AAII;AACA;;;AAGJ;AACA;;;AAIE;AACF;AAEA;;AAGA;AACA;;AAGA;AACE;;;;AAOF;AAwBF;AAEA;;;AAQI;AACF;;"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { memo, useMemo, useRef } from 'react';
3
+ import { memo, useMemo, useRef, useCallback } from 'react';
4
4
  import { tv as ce } from './../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.19_ts-node@10.9.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.js';
5
5
  import { useHandleEscape } from '../../hooks/useHandleEscape.js';
6
6
  import { dialogSize } from '../../tailwind/dialogSize.js';
@@ -55,7 +55,14 @@ const DialogContentInner = ({ onClickOverlay, onPressEscape, isOpen, id, width,
55
55
  return actualWidth ? { width: actualWidth } : undefined;
56
56
  }, [width, size]);
57
57
  const innerRef = useRef(null);
58
- useHandleEscape(useMemo(() => (onPressEscape && isOpen ? onPressEscape : undefined), [isOpen, onPressEscape]));
58
+ // 外部propsのonPressEscapeをrefに保存
59
+ const onPressEscapeRef = useRef(onPressEscape);
60
+ onPressEscapeRef.current = onPressEscape;
61
+ // stableなcallbackを作成
62
+ const memoizedOnPressEscape = useCallback(() => {
63
+ onPressEscapeRef.current?.();
64
+ }, []);
65
+ useHandleEscape(isOpen ? memoizedOnPressEscape : undefined);
59
66
  useBodyScrollLock(isOpen);
60
67
  return (jsx(DialogOverlap, { isOpen: isOpen, children: jsxs("div", { id: id, className: classNames.layout, style: style, children: [jsx(Overlay, { isOpen: isOpen, onClickOverlay: onClickOverlay, className: classNames.background }), jsx("div", { ...rest, ref: innerRef, role: "dialog", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-modal": "true", className: classNames.inner, children: jsx(FocusTrap, { firstFocusTarget: firstFocusTarget, ref: focusTrapRef, children: children }) })] }) }));
61
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentInner.js","sources":["../../../src/components/Dialog/DialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type RefObject,\n memo,\n useMemo,\n useRef,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useHandleEscape } from '../../hooks/useHandleEscape'\nimport { dialogSize } from '../../tailwind'\n\nimport { DialogOverlap } from './DialogOverlap'\nimport { FocusTrap, type FocusTrapRef } from './FocusTrap'\nimport { useBodyScrollLock } from './useBodyScrollLock'\n\nimport type { DialogSize } from './types'\n\nexport type DialogContentInnerProps = PropsWithChildren<{\n /**\n * オーバーレイをクリックした時に発火するコールバック関数\n */\n onClickOverlay?: () => void\n /**\n * エスケープキーを押下した時に発火するコールバック関数\n */\n onPressEscape?: () => void\n /**\n * ダイアログを開いているかどうか\n */\n isOpen: boolean\n /**\n * @deprecated ダイアログの幅を指定する場合は、`width` ではなく `size` を使用してください。\n * ダイアログの幅\n */\n width?: string | number\n /**\n * ダイアログの大きさ\n */\n size?: DialogSize\n /**\n * ダイアログの `id`\n * TODO 使われてなさそうなので確認\n */\n id?: string\n /**\n * ダイアログを開いた時にフォーカスする対象\n */\n firstFocusTarget?: RefObject<HTMLElement>\n /**\n * ダイアログの `aria-label`\n */\n ariaLabel?: string\n /**\n * ダイアログの `aria-labelledby`\n */\n ariaLabelledby?: string\n /**\n * ダイアログトップのフォーカストラップへの ref\n */\n focusTrapRef?: RefObject<FocusTrapRef>\n}>\ntype Props = DialogContentInnerProps & Omit<ComponentProps<'div'>, keyof DialogContentInnerProps>\n\nconst classNameGenerator = tv({\n slots: {\n layout: ['smarthr-ui-Dialog-wrapper', 'shr-max-w-[calc(100dvw-theme(spacing.1))]'],\n inner: [\n 'smarthr-ui-Dialog',\n 'shr-border-shorthand shr-relative shr-z-1 shr-rounded-m shr-bg-white shr-shadow-layer-3',\n 'contrast-more:shr-border-high-contrast',\n ],\n background: ['smarthr-ui-Dialog-background', 'shr-absolute shr-inset-0 shr-bg-scrim'],\n },\n variants: {\n size: {\n XS: { layout: dialogSize.XS },\n S: { layout: dialogSize.S },\n M: { layout: dialogSize.M },\n L: { layout: dialogSize.L },\n XL: { layout: dialogSize.XL },\n XXL: { layout: dialogSize.XXL },\n FULL: { layout: dialogSize.FULL },\n },\n },\n})\n\nexport const DialogContentInner: FC<Props> = ({\n onClickOverlay,\n onPressEscape,\n isOpen,\n id,\n width,\n size,\n firstFocusTarget,\n ariaLabel,\n ariaLabelledby,\n children,\n className,\n focusTrapRef,\n ...rest\n}) => {\n const classNames = useMemo(() => {\n const { layout, inner, background } = classNameGenerator()\n\n return {\n layout: layout({ size }),\n inner: inner({ className }),\n background: background(),\n }\n }, [size, className])\n const style = useMemo(() => {\n // width は deprecated なので、size が指定されている場合は width を無視する\n const actualWidth = size ? undefined : typeof width === 'number' ? `${width}px` : width\n\n return actualWidth ? { width: actualWidth } : undefined\n }, [width, size])\n\n const innerRef = useRef<HTMLDivElement>(null)\n\n useHandleEscape(\n useMemo(() => (onPressEscape && isOpen ? onPressEscape : undefined), [isOpen, onPressEscape]),\n )\n\n useBodyScrollLock(isOpen)\n\n return (\n <DialogOverlap isOpen={isOpen}>\n <div id={id} className={classNames.layout} style={style}>\n <Overlay\n isOpen={isOpen}\n onClickOverlay={onClickOverlay}\n className={classNames.background}\n />\n <div\n {...rest}\n ref={innerRef}\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-modal=\"true\"\n className={classNames.inner}\n >\n <FocusTrap firstFocusTarget={firstFocusTarget} ref={focusTrapRef}>\n {children}\n </FocusTrap>\n </div>\n </div>\n </DialogOverlap>\n )\n}\n\nconst Overlay = memo<Pick<Props, 'onClickOverlay' | 'isOpen'> & { className: string }>(\n ({ onClickOverlay, isOpen, className }) => {\n const onClick = useMemo(\n () => (onClickOverlay && isOpen ? onClickOverlay : undefined),\n [isOpen, onClickOverlay],\n )\n\n // eslint-disable-next-line smarthr/best-practice-for-interactive-element\n return <div onClick={onClick} className={className} role=\"presentation\" />\n },\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAoEA;AACE;AACE;AACA;;;;AAIC;AACD;AACD;AACD;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AACF;AACF;AAEM;AAeL;;;AAII;AACA;;;AAGJ;AACA;;;AAIE;AACF;AAEA;;;AAQA;AAwBF;AAEA;;;AAQI;AACF;;"}
1
+ {"version":3,"file":"DialogContentInner.js","sources":["../../../src/components/Dialog/DialogContentInner.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type RefObject,\n memo,\n useCallback,\n useMemo,\n useRef,\n} from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { useHandleEscape } from '../../hooks/useHandleEscape'\nimport { dialogSize } from '../../tailwind'\n\nimport { DialogOverlap } from './DialogOverlap'\nimport { FocusTrap, type FocusTrapRef } from './FocusTrap'\nimport { useBodyScrollLock } from './useBodyScrollLock'\n\nimport type { DialogSize } from './types'\n\nexport type DialogContentInnerProps = PropsWithChildren<{\n /**\n * オーバーレイをクリックした時に発火するコールバック関数\n */\n onClickOverlay?: () => void\n /**\n * エスケープキーを押下した時に発火するコールバック関数\n */\n onPressEscape?: () => void\n /**\n * ダイアログを開いているかどうか\n */\n isOpen: boolean\n /**\n * @deprecated ダイアログの幅を指定する場合は、`width` ではなく `size` を使用してください。\n * ダイアログの幅\n */\n width?: string | number\n /**\n * ダイアログの大きさ\n */\n size?: DialogSize\n /**\n * ダイアログの `id`\n * TODO 使われてなさそうなので確認\n */\n id?: string\n /**\n * ダイアログを開いた時にフォーカスする対象\n */\n firstFocusTarget?: RefObject<HTMLElement>\n /**\n * ダイアログの `aria-label`\n */\n ariaLabel?: string\n /**\n * ダイアログの `aria-labelledby`\n */\n ariaLabelledby?: string\n /**\n * ダイアログトップのフォーカストラップへの ref\n */\n focusTrapRef?: RefObject<FocusTrapRef>\n}>\ntype Props = DialogContentInnerProps & Omit<ComponentProps<'div'>, keyof DialogContentInnerProps>\n\nconst classNameGenerator = tv({\n slots: {\n layout: ['smarthr-ui-Dialog-wrapper', 'shr-max-w-[calc(100dvw-theme(spacing.1))]'],\n inner: [\n 'smarthr-ui-Dialog',\n 'shr-border-shorthand shr-relative shr-z-1 shr-rounded-m shr-bg-white shr-shadow-layer-3',\n 'contrast-more:shr-border-high-contrast',\n ],\n background: ['smarthr-ui-Dialog-background', 'shr-absolute shr-inset-0 shr-bg-scrim'],\n },\n variants: {\n size: {\n XS: { layout: dialogSize.XS },\n S: { layout: dialogSize.S },\n M: { layout: dialogSize.M },\n L: { layout: dialogSize.L },\n XL: { layout: dialogSize.XL },\n XXL: { layout: dialogSize.XXL },\n FULL: { layout: dialogSize.FULL },\n },\n },\n})\n\nexport const DialogContentInner: FC<Props> = ({\n onClickOverlay,\n onPressEscape,\n isOpen,\n id,\n width,\n size,\n firstFocusTarget,\n ariaLabel,\n ariaLabelledby,\n children,\n className,\n focusTrapRef,\n ...rest\n}) => {\n const classNames = useMemo(() => {\n const { layout, inner, background } = classNameGenerator()\n\n return {\n layout: layout({ size }),\n inner: inner({ className }),\n background: background(),\n }\n }, [size, className])\n const style = useMemo(() => {\n // width は deprecated なので、size が指定されている場合は width を無視する\n const actualWidth = size ? undefined : typeof width === 'number' ? `${width}px` : width\n\n return actualWidth ? { width: actualWidth } : undefined\n }, [width, size])\n\n const innerRef = useRef<HTMLDivElement>(null)\n\n // 外部propsのonPressEscapeをrefに保存\n const onPressEscapeRef = useRef(onPressEscape)\n onPressEscapeRef.current = onPressEscape\n\n // stableなcallbackを作成\n const memoizedOnPressEscape = useCallback(() => {\n onPressEscapeRef.current?.()\n }, [])\n\n useHandleEscape(isOpen ? memoizedOnPressEscape : undefined)\n\n useBodyScrollLock(isOpen)\n\n return (\n <DialogOverlap isOpen={isOpen}>\n <div id={id} className={classNames.layout} style={style}>\n <Overlay\n isOpen={isOpen}\n onClickOverlay={onClickOverlay}\n className={classNames.background}\n />\n <div\n {...rest}\n ref={innerRef}\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-modal=\"true\"\n className={classNames.inner}\n >\n <FocusTrap firstFocusTarget={firstFocusTarget} ref={focusTrapRef}>\n {children}\n </FocusTrap>\n </div>\n </div>\n </DialogOverlap>\n )\n}\n\nconst Overlay = memo<Pick<Props, 'onClickOverlay' | 'isOpen'> & { className: string }>(\n ({ onClickOverlay, isOpen, className }) => {\n const onClick = useMemo(\n () => (onClickOverlay && isOpen ? onClickOverlay : undefined),\n [isOpen, onClickOverlay],\n )\n\n // eslint-disable-next-line smarthr/best-practice-for-interactive-element\n return <div onClick={onClick} className={className} role=\"presentation\" />\n },\n)\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAqEA;AACE;AACE;AACA;;;;AAIC;AACD;AACD;AACD;AACE;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AACF;AACF;AAEM;AAeL;;;AAII;AACA;;;AAGJ;AACA;;;AAIE;AACF;AAEA;;AAGA;AACA;;AAGA;AACE;;;;AAOF;AAwBF;AAEA;;;AAQI;AACF;;"}
@@ -1,23 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var index = require('./../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.19_ts-node@10.9.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.cjs');
6
4
  var components_ResponseMessage_ResponseMessage = require('../ResponseMessage/ResponseMessage.cjs');
7
5
 
8
- const classNameGenerator = index.tv({
9
- base: 'empty:!shr-mt-0',
10
- });
11
6
  const DialogContentResponseStatusMessage = ({ responseStatus, className }) => {
12
- const classNames = React.useMemo(() => classNameGenerator({ className }), [className]);
13
- const StatusMessage = () => (jsxRuntime.jsx(components_ResponseMessage_ResponseMessage.ResponseMessage, { status: responseStatus.status, children: responseStatus.message }));
7
+ const isError = responseStatus.message && responseStatus.status === 'error';
8
+ const isSuccess = responseStatus.message && responseStatus.status === 'success';
14
9
  return (
15
10
  /**
16
11
  * ライブリージョンを条件付きでDOMに追加すると、支援技術に通知が正しく行われないことがあるため、常にDOM上に存在するようにしています
17
12
  *
18
13
  * @see https://www.sarasoueidan.com/blog/accessible-notifications-with-aria-live-regions-part-2/#make-sure-the-live-region-container-is-in-the-dom-as-early-as-possible
19
14
  */
20
- jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: classNames, role: "alert", children: responseStatus.message && responseStatus.status === 'error' && jsxRuntime.jsx(StatusMessage, {}) }), jsxRuntime.jsx("div", { className: classNames, role: "status", children: responseStatus.message && responseStatus.status === 'success' && jsxRuntime.jsx(StatusMessage, {}) })] }));
15
+ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: isError ? `${className} shr-mt-0.5` : className, role: "alert", children: isError && jsxRuntime.jsx(components_ResponseMessage_ResponseMessage.ResponseMessage, { status: "error", children: responseStatus.message }) }), jsxRuntime.jsx("div", { className: isSuccess ? `${className} shr-mt-0.5` : className, role: "status", children: isSuccess && jsxRuntime.jsx(components_ResponseMessage_ResponseMessage.ResponseMessage, { status: "success", children: responseStatus.message }) })] }));
21
16
  };
22
17
 
23
18
  exports.DialogContentResponseStatusMessage = DialogContentResponseStatusMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentResponseStatusMessage.cjs","sources":["../../../src/components/Dialog/DialogContentResponseStatusMessage.tsx"],"sourcesContent":["import { type FC, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { ResponseMessage } from '../ResponseMessage'\n\nimport type { useResponseStatus } from '../../hooks/useResponseStatus'\n\nconst classNameGenerator = tv({\n base: 'empty:!shr-mt-0',\n})\n\nexport const DialogContentResponseStatusMessage: FC<{\n responseStatus: ReturnType<typeof useResponseStatus>\n className?: string\n}> = ({ responseStatus, className }) => {\n const classNames = useMemo(() => classNameGenerator({ className }), [className])\n\n const StatusMessage = () => (\n <ResponseMessage status={responseStatus.status}>{responseStatus.message}</ResponseMessage>\n )\n\n return (\n /**\n * ライブリージョンを条件付きでDOMに追加すると、支援技術に通知が正しく行われないことがあるため、常にDOM上に存在するようにしています\n *\n * @see https://www.sarasoueidan.com/blog/accessible-notifications-with-aria-live-regions-part-2/#make-sure-the-live-region-container-is-in-the-dom-as-early-as-possible\n */\n <>\n <div className={classNames} role=\"alert\">\n {responseStatus.message && responseStatus.status === 'error' && <StatusMessage />}\n </div>\n <div className={classNames} role=\"status\">\n {responseStatus.message && responseStatus.status === 'success' && <StatusMessage />}\n </div>\n </>\n )\n}\n"],"names":["tv","useMemo","_jsx","ResponseMessage","_jsxs","_Fragment"],"mappings":";;;;;;;AAOA,MAAM,kBAAkB,GAAGA,QAAE,CAAC;AAC5B,IAAA,IAAI,EAAE,iBAAiB;AACxB,CAAA,CAAC;AAEK,MAAM,kCAAkC,GAG1C,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,KAAI;AACrC,IAAA,MAAM,UAAU,GAAGC,aAAO,CAAC,MAAM,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEhF,MAAM,aAAa,GAAG,OACpBC,cAAA,CAACC,0DAAe,EAAA,EAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAA,QAAA,EAAG,cAAc,CAAC,OAAO,EAAA,CAAmB,CAC3F;IAED;AACE;;;;AAIG;IACHC,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA,CACEH,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,EAAE,IAAI,EAAC,OAAO,EAAA,QAAA,EACrC,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,OAAO,IAAIA,cAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAA,CAC7E,EACNA,wBAAK,SAAS,EAAE,UAAU,EAAE,IAAI,EAAC,QAAQ,EAAA,QAAA,EACtC,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,IAAIA,cAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAA,CAC/E,CAAA,EAAA,CACL;AAEP;;;;"}
1
+ {"version":3,"file":"DialogContentResponseStatusMessage.cjs","sources":["../../../src/components/Dialog/DialogContentResponseStatusMessage.tsx"],"sourcesContent":["import { ResponseMessage } from '../ResponseMessage'\n\nimport type { useResponseStatus } from '../../hooks/useResponseStatus'\nimport type { FC } from 'react'\n\nexport const DialogContentResponseStatusMessage: FC<{\n responseStatus: ReturnType<typeof useResponseStatus>\n className?: string\n}> = ({ responseStatus, className }) => {\n const isError = responseStatus.message && responseStatus.status === 'error'\n const isSuccess = responseStatus.message && responseStatus.status === 'success'\n\n return (\n /**\n * ライブリージョンを条件付きでDOMに追加すると、支援技術に通知が正しく行われないことがあるため、常にDOM上に存在するようにしています\n *\n * @see https://www.sarasoueidan.com/blog/accessible-notifications-with-aria-live-regions-part-2/#make-sure-the-live-region-container-is-in-the-dom-as-early-as-possible\n */\n <>\n <div className={isError ? `${className} shr-mt-0.5` : className} role=\"alert\">\n {isError && <ResponseMessage status=\"error\">{responseStatus.message}</ResponseMessage>}\n </div>\n <div className={isSuccess ? `${className} shr-mt-0.5` : className} role=\"status\">\n {isSuccess && <ResponseMessage status=\"success\">{responseStatus.message}</ResponseMessage>}\n </div>\n </>\n )\n}\n"],"names":["_jsxs","_Fragment","_jsx","ResponseMessage"],"mappings":";;;;;AAKO,MAAM,kCAAkC,GAG1C,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,KAAI;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,OAAO;IAC3E,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS;IAE/E;AACE;;;;AAIG;AACH,IAAAA,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA,CACEC,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,OAAO,GAAG,CAAA,EAAG,SAAS,CAAA,WAAA,CAAa,GAAG,SAAS,EAAE,IAAI,EAAC,OAAO,EAAA,QAAA,EAC1E,OAAO,IAAIA,cAAA,CAACC,0DAAe,EAAA,EAAC,MAAM,EAAC,OAAO,EAAA,QAAA,EAAE,cAAc,CAAC,OAAO,GAAmB,EAAA,CAClF,EACND,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,GAAG,CAAA,EAAG,SAAS,CAAA,WAAA,CAAa,GAAG,SAAS,EAAE,IAAI,EAAC,QAAQ,EAAA,QAAA,EAC7E,SAAS,IAAIA,cAAA,CAACC,0DAAe,EAAA,EAAC,MAAM,EAAC,SAAS,EAAA,QAAA,EAAE,cAAc,CAAC,OAAO,EAAA,CAAmB,EAAA,CACtF,CAAA,EAAA,CACL;AAEP;;;;"}
@@ -1,5 +1,5 @@
1
- import { type FC } from 'react';
2
1
  import type { useResponseStatus } from '../../hooks/useResponseStatus';
2
+ import type { FC } from 'react';
3
3
  export declare const DialogContentResponseStatusMessage: FC<{
4
4
  responseStatus: ReturnType<typeof useResponseStatus>;
5
5
  className?: string;
@@ -1,21 +1,16 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useMemo } from 'react';
3
- import { tv as ce } from './../../vendor/.pnpm/tailwind-variants@0.3.1_tailwindcss@3.4.19_ts-node@10.9.2_@swc_core@1.15.17_@types_node@20.19.35_typescript@5.9.3__/vendor/tailwind-variants/dist/index.js';
4
2
  import { ResponseMessage } from '../ResponseMessage/ResponseMessage.js';
5
3
 
6
- const classNameGenerator = ce({
7
- base: 'empty:!shr-mt-0',
8
- });
9
4
  const DialogContentResponseStatusMessage = ({ responseStatus, className }) => {
10
- const classNames = useMemo(() => classNameGenerator({ className }), [className]);
11
- const StatusMessage = () => (jsx(ResponseMessage, { status: responseStatus.status, children: responseStatus.message }));
5
+ const isError = responseStatus.message && responseStatus.status === 'error';
6
+ const isSuccess = responseStatus.message && responseStatus.status === 'success';
12
7
  return (
13
8
  /**
14
9
  * ライブリージョンを条件付きでDOMに追加すると、支援技術に通知が正しく行われないことがあるため、常にDOM上に存在するようにしています
15
10
  *
16
11
  * @see https://www.sarasoueidan.com/blog/accessible-notifications-with-aria-live-regions-part-2/#make-sure-the-live-region-container-is-in-the-dom-as-early-as-possible
17
12
  */
18
- jsxs(Fragment, { children: [jsx("div", { className: classNames, role: "alert", children: responseStatus.message && responseStatus.status === 'error' && jsx(StatusMessage, {}) }), jsx("div", { className: classNames, role: "status", children: responseStatus.message && responseStatus.status === 'success' && jsx(StatusMessage, {}) })] }));
13
+ jsxs(Fragment, { children: [jsx("div", { className: isError ? `${className} shr-mt-0.5` : className, role: "alert", children: isError && jsx(ResponseMessage, { status: "error", children: responseStatus.message }) }), jsx("div", { className: isSuccess ? `${className} shr-mt-0.5` : className, role: "status", children: isSuccess && jsx(ResponseMessage, { status: "success", children: responseStatus.message }) })] }));
19
14
  };
20
15
 
21
16
  export { DialogContentResponseStatusMessage };
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContentResponseStatusMessage.js","sources":["../../../src/components/Dialog/DialogContentResponseStatusMessage.tsx"],"sourcesContent":["import { type FC, useMemo } from 'react'\nimport { tv } from 'tailwind-variants'\n\nimport { ResponseMessage } from '../ResponseMessage'\n\nimport type { useResponseStatus } from '../../hooks/useResponseStatus'\n\nconst classNameGenerator = tv({\n base: 'empty:!shr-mt-0',\n})\n\nexport const DialogContentResponseStatusMessage: FC<{\n responseStatus: ReturnType<typeof useResponseStatus>\n className?: string\n}> = ({ responseStatus, className }) => {\n const classNames = useMemo(() => classNameGenerator({ className }), [className])\n\n const StatusMessage = () => (\n <ResponseMessage status={responseStatus.status}>{responseStatus.message}</ResponseMessage>\n )\n\n return (\n /**\n * ライブリージョンを条件付きでDOMに追加すると、支援技術に通知が正しく行われないことがあるため、常にDOM上に存在するようにしています\n *\n * @see https://www.sarasoueidan.com/blog/accessible-notifications-with-aria-live-regions-part-2/#make-sure-the-live-region-container-is-in-the-dom-as-early-as-possible\n */\n <>\n <div className={classNames} role=\"alert\">\n {responseStatus.message && responseStatus.status === 'error' && <StatusMessage />}\n </div>\n <div className={classNames} role=\"status\">\n {responseStatus.message && responseStatus.status === 'success' && <StatusMessage />}\n </div>\n </>\n )\n}\n"],"names":["tv","_jsx","_jsxs","_Fragment"],"mappings":";;;;;AAOA,MAAM,kBAAkB,GAAGA,EAAE,CAAC;AAC5B,IAAA,IAAI,EAAE,iBAAiB;AACxB,CAAA,CAAC;AAEK,MAAM,kCAAkC,GAG1C,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,KAAI;AACrC,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAEhF,MAAM,aAAa,GAAG,OACpBC,GAAA,CAAC,eAAe,EAAA,EAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAA,QAAA,EAAG,cAAc,CAAC,OAAO,EAAA,CAAmB,CAC3F;IAED;AACE;;;;AAIG;IACHC,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACEF,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,EAAE,IAAI,EAAC,OAAO,EAAA,QAAA,EACrC,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,OAAO,IAAIA,GAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAA,CAC7E,EACNA,aAAK,SAAS,EAAE,UAAU,EAAE,IAAI,EAAC,QAAQ,EAAA,QAAA,EACtC,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,IAAIA,GAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAA,CAC/E,CAAA,EAAA,CACL;AAEP;;;;"}
1
+ {"version":3,"file":"DialogContentResponseStatusMessage.js","sources":["../../../src/components/Dialog/DialogContentResponseStatusMessage.tsx"],"sourcesContent":["import { ResponseMessage } from '../ResponseMessage'\n\nimport type { useResponseStatus } from '../../hooks/useResponseStatus'\nimport type { FC } from 'react'\n\nexport const DialogContentResponseStatusMessage: FC<{\n responseStatus: ReturnType<typeof useResponseStatus>\n className?: string\n}> = ({ responseStatus, className }) => {\n const isError = responseStatus.message && responseStatus.status === 'error'\n const isSuccess = responseStatus.message && responseStatus.status === 'success'\n\n return (\n /**\n * ライブリージョンを条件付きでDOMに追加すると、支援技術に通知が正しく行われないことがあるため、常にDOM上に存在するようにしています\n *\n * @see https://www.sarasoueidan.com/blog/accessible-notifications-with-aria-live-regions-part-2/#make-sure-the-live-region-container-is-in-the-dom-as-early-as-possible\n */\n <>\n <div className={isError ? `${className} shr-mt-0.5` : className} role=\"alert\">\n {isError && <ResponseMessage status=\"error\">{responseStatus.message}</ResponseMessage>}\n </div>\n <div className={isSuccess ? `${className} shr-mt-0.5` : className} role=\"status\">\n {isSuccess && <ResponseMessage status=\"success\">{responseStatus.message}</ResponseMessage>}\n </div>\n </>\n )\n}\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;AAKO,MAAM,kCAAkC,GAG1C,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,KAAI;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,OAAO;IAC3E,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS;IAE/E;AACE;;;;AAIG;AACH,IAAAA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACEC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,OAAO,GAAG,CAAA,EAAG,SAAS,CAAA,WAAA,CAAa,GAAG,SAAS,EAAE,IAAI,EAAC,OAAO,EAAA,QAAA,EAC1E,OAAO,IAAIA,GAAA,CAAC,eAAe,EAAA,EAAC,MAAM,EAAC,OAAO,EAAA,QAAA,EAAE,cAAc,CAAC,OAAO,GAAmB,EAAA,CAClF,EACNA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,GAAG,CAAA,EAAG,SAAS,CAAA,WAAA,CAAa,GAAG,SAAS,EAAE,IAAI,EAAC,QAAQ,EAAA,QAAA,EAC7E,SAAS,IAAIA,GAAA,CAAC,eAAe,EAAA,EAAC,MAAM,EAAC,SAAS,EAAA,QAAA,EAAE,cAAc,CAAC,OAAO,EAAA,CAAmB,EAAA,CACtF,CAAA,EAAA,CACL;AAEP;;;;"}
@@ -19,7 +19,10 @@ const FocusTrap = React.forwardRef(({ firstFocusTarget, children }, ref) => {
19
19
  }));
20
20
  React.useEffect(() => {
21
21
  const handleKeyDown = (e) => {
22
- if (e.key !== 'Tab' || innerRef.current === null) {
22
+ // IME 変換中の Tab は変換候補の選択に使われるため、フォーカストラップの対象外にする。
23
+ // ここで preventDefault してしまうと、Dialog 内で日本語入力中に Tab を押しても
24
+ // 変換候補が確定されず、未確定文字列がそのまま入力されてしまう。
25
+ if (e.key !== 'Tab' || e.isComposing || innerRef.current === null) {
23
26
  return;
24
27
  }
25
28
  const tabbables = libs_tabbable.tabbable(innerRef.current).filter((elm) => elm.tabIndex >= 0);
@@ -1 +1 @@
1
- {"version":3,"file":"FocusTrap.cjs","sources":["../../../src/components/Dialog/FocusTrap.tsx"],"sourcesContent":["import {\n type PropsWithChildren,\n type RefObject,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\n\nimport { tabbable } from '../../libs/tabbable'\n\ntype Props = PropsWithChildren<{\n firstFocusTarget?: RefObject<HTMLElement>\n}>\n\nexport type FocusTrapRef = {\n focus: () => void\n}\n\nexport const FocusTrap = forwardRef<FocusTrapRef, Props>(({ firstFocusTarget, children }, ref) => {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const dummyFocusRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n if (firstFocusTarget?.current) {\n firstFocusTarget.current.focus()\n } else {\n dummyFocusRef.current?.focus()\n }\n },\n }))\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab' || innerRef.current === null) {\n return\n }\n\n const tabbables = tabbable(innerRef.current).filter((elm) => elm.tabIndex >= 0)\n\n if (tabbables.length === 0) {\n return\n }\n\n const firstTabbable = tabbables[0]\n const lastTabbable = tabbables[tabbables.length - 1]\n const currentFocused = tabbables.find((elm) => elm === e.target)\n\n if (e.shiftKey) {\n if (currentFocused === firstTabbable || document.activeElement === dummyFocusRef.current) {\n e.preventDefault()\n lastTabbable.focus()\n }\n } else if (currentFocused === lastTabbable) {\n e.preventDefault()\n firstTabbable.focus()\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown)\n }\n }, [])\n\n useEffect(() => {\n const triggerElement = document.activeElement\n\n if (firstFocusTarget?.current) {\n firstFocusTarget.current.focus()\n } else {\n dummyFocusRef.current?.focus()\n }\n\n return () => {\n // フォーカストラップ終了時にトリガにフォーカスを戻す\n if (triggerElement instanceof HTMLElement) {\n triggerElement.focus()\n }\n }\n }, [firstFocusTarget])\n\n return (\n <div ref={innerRef}>\n {/* eslint-disable-next-line smarthr/a11y-scroller-has-tabindex -- dummy element for focus management. */}\n <div ref={dummyFocusRef} tabIndex={-1} />\n {children}\n </div>\n )\n})\n"],"names":["forwardRef","useRef","useImperativeHandle","useEffect","tabbable","_jsxs","_jsx"],"mappings":";;;;;;AAmBO,MAAM,SAAS,GAAGA,gBAAU,CAAsB,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAI;AAC/F,IAAA,MAAM,QAAQ,GAAGC,YAAM,CAAwB,IAAI,CAAC;AACpD,IAAA,MAAM,aAAa,GAAGA,YAAM,CAAiB,IAAI,CAAC;AAElD,IAAAC,yBAAmB,CAAC,GAAG,EAAE,OAAO;QAC9B,KAAK,EAAE,MAAK;AACV,YAAA,IAAI,gBAAgB,EAAE,OAAO,EAAE;AAC7B,gBAAA,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE;YAClC;iBAAO;AACL,gBAAA,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE;YAChC;QACF,CAAC;AACF,KAAA,CAAC,CAAC;IAEHC,eAAS,CAAC,MAAK;AACb,QAAA,MAAM,aAAa,GAAG,CAAC,CAAgB,KAAI;AACzC,YAAA,IAAI,CAAC,CAAC,GAAG,KAAK,KAAK,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAE;gBAChD;YACF;YAEA,MAAM,SAAS,GAAGC,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;AAE/E,YAAA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC1B;YACF;AAEA,YAAA,MAAM,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC;YAClC,MAAM,YAAY,GAAG,SA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E,EAAA,CAAI,EACxC,QAAQ,CAAA,EAAA,CACL;AAEV,CAAC;;;;"}
1
+ {"version":3,"file":"FocusTrap.cjs","sources":["../../../src/components/Dialog/FocusTrap.tsx"],"sourcesContent":["import {\n type PropsWithChildren,\n type RefObject,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\n\nimport { tabbable } from '../../libs/tabbable'\n\ntype Props = PropsWithChildren<{\n firstFocusTarget?: RefObject<HTMLElement>\n}>\n\nexport type FocusTrapRef = {\n focus: () => void\n}\n\nexport const FocusTrap = forwardRef<FocusTrapRef, Props>(({ firstFocusTarget, children }, ref) => {\n const innerRef = useRef<HTMLDivElement | null>(null)\n const dummyFocusRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(ref, () => ({\n focus: () => {\n if (firstFocusTarget?.current) {\n firstFocusTarget.current.focus()\n } else {\n dummyFocusRef.current?.focus()\n }\n },\n }))\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n // IME 変換中の Tab は変換候補の選択に使われるため、フォーカストラップの対象外にする。\n // ここで preventDefault してしまうと、Dialog 内で日本語入力中に Tab を押しても\n // 変換候補が確定されず、未確定文字列がそのまま入力されてしまう。\n if (e.key !== 'Tab' || e.isComposing || innerRef.current === null) {\n return\n }\n\n const tabbables = tabbable(innerRef.current).filter((elm) => elm.tabIndex >= 0)\n\n if (tabbables.length === 0) {\n return\n }\n\n const firstTabbable = tabbables[0]\n const lastTabbable = tabbables[tabbables.length - 1]\n const currentFocused = tabbables.find((elm) => elm === e.target)\n\n if (e.shiftKey) {\n if (currentFocused === firstTabbable || document.activeElement === dummyFocusRef.current) {\n e.preventDefault()\n lastTabbable.focus()\n }\n } else if (currentFocused === lastTabbable) {\n e.preventDefault()\n firstTabbable.focus()\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown)\n }\n }, [])\n\n useEffect(() => {\n const triggerElement = document.activeElement\n\n if (firstFocusTarget?.current) {\n firstFocusTarget.current.focus()\n } else {\n dummyFocusRef.current?.focus()\n }\n\n return () => {\n // フォーカストラップ終了時にトリガにフォーカスを戻す\n if (triggerElement instanceof HTMLElement) {\n triggerElement.focus()\n }\n }\n }, [firstFocusTarget])\n\n return (\n <div ref={innerRef}>\n {/* eslint-disable-next-line smarthr/a11y-scroller-has-tabindex -- dummy element for focus management. */}\n <div ref={dummyFocusRef} tabIndex={-1} />\n {children}\n </div>\n )\n})\n"],"names":["forwardRef","useRef","useImperativeHandle","useEffect","tabbable","_jsxs","_jsx"],"mappings":";;;;;;AAmBO,MAAM,SAAS,GAAGA,gBAAU,CAAsB,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,GAAG,KAAI;AAC/F,IAAA,MAAM,QAAQ,GAAGC,YAAM,CAAwB,IAAI,CAAC;AACpD,IAAA,MAAM,aAAa,GAAGA,YAAM,CAAiB,IAAI,CAAC;AAElD,IAAAC,yBAAmB,CAAC,GAAG,EAAE,OAAO;QAC9B,KAAK,EAAE,MAAK;AACV,YAAA,IAAI,gBAAgB,EAAE,OAAO,EAAE;AAC7B,gBAAA,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE;YAClC;iBAAO;AACL,gBAAA,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE;YAChC;QACF,CAAC;AACF,KAAA,CAAC,CAAC;IAEHC,eAAS,CAAC,MAAK;AACb,QAAA,MAAM,aAAa,GAAG,CAAC,CAAgB,KAAI;;;;AAIzC,YAAA,IAAI,CAAC,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,WAAW,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAE;gBACjE;YACF;YAEA,MAAM,SAAS,GAAGC,sBAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;AAE/E,YAAA,IAAI,SAAS,CAAC,MAAM,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,EAAE,QAAQ,EAAA,QAAA,EAAA,CAEhBC,cAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAA,CAAI,EACxC,QAAQ,CAAA,EAAA,CACL;AAEV,CAAC;;;;"}
@@ -17,7 +17,10 @@ const FocusTrap = forwardRef(({ firstFocusTarget, children }, ref) => {
17
17
  }));
18
18
  useEffect(() => {
19
19
  const handleKeyDown = (e) => {
20
- if (e.key !== 'Tab' || innerRef.current === null) {
20
+ // IME 変換中の Tab は変換候補の選択に使われるため、フォーカストラップの対象外にする。
21
+ // ここで preventDefault してしまうと、Dialog 内で日本語入力中に Tab を押しても
22
+ // 変換候補が確定されず、未確定文字列がそのまま入力されてしまう。
23
+ if (e.key !== 'Tab' || e.isComposing || innerRef.current === null) {
21
24
  return;
22
25
  }
23
26
  const tabbables = tabbable(innerRef.current).filter((elm) => elm.tabIndex >= 0);