@openameba/spindle-ui 0.26.0 → 0.26.1-alpha.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 (361) hide show
  1. package/Button/Button.mjs +7 -0
  2. package/Button/index.mjs +1 -0
  3. package/ButtonGroup/ButtonGroup.mjs +13 -0
  4. package/ButtonGroup/index.mjs +1 -0
  5. package/CHANGELOG.md +33 -0
  6. package/Form/Checkbox.mjs +11 -0
  7. package/Form/DropDown.mjs +38 -0
  8. package/Form/InlineDropDown.mjs +30 -0
  9. package/Form/InputLabel.mjs +5 -0
  10. package/Form/InvalidMessage.mjs +9 -0
  11. package/Form/Radio.mjs +11 -0
  12. package/Form/TextArea.mjs +5 -0
  13. package/Form/TextField.mjs +9 -0
  14. package/Form/ToggleSwitch.mjs +8 -0
  15. package/Form/index.mjs +8 -0
  16. package/HeroCarousel/HeroCarousel.mjs +27 -0
  17. package/HeroCarousel/HeroCarouselItem.mjs +21 -0
  18. package/HeroCarousel/hooks/useAutoPlayCarousel.mjs +158 -0
  19. package/HeroCarousel/hooks/useAutoSlide.mjs +40 -0
  20. package/HeroCarousel/hooks/useCarouselFocus.mjs +22 -0
  21. package/HeroCarousel/hooks/useSliderMoveEvent.mjs +47 -0
  22. package/HeroCarousel/hooks/useSliderTransition.mjs +30 -0
  23. package/HeroCarousel/hooks/useValueRef.mjs +8 -0
  24. package/HeroCarousel/index.mjs +1 -0
  25. package/Icon/755.mjs +6 -0
  26. package/Icon/Abemakun.mjs +6 -0
  27. package/Icon/Abematv.mjs +6 -0
  28. package/Icon/Accesslink.mjs +6 -0
  29. package/Icon/Accesspage.mjs +6 -0
  30. package/Icon/AccesspageFill.mjs +6 -0
  31. package/Icon/AddressbookFill.mjs +6 -0
  32. package/Icon/AlbumAddFill.mjs +6 -0
  33. package/Icon/AlbumFill.mjs +6 -0
  34. package/Icon/AlignCenter.mjs +6 -0
  35. package/Icon/AlignLeft.mjs +6 -0
  36. package/Icon/AlignRight.mjs +6 -0
  37. package/Icon/AllFill.mjs +6 -0
  38. package/Icon/Amebacoin.mjs +6 -0
  39. package/Icon/Amebapick.mjs +9 -0
  40. package/Icon/Amegold.mjs +6 -0
  41. package/Icon/Amember.mjs +6 -0
  42. package/Icon/ArrowDown.mjs +6 -0
  43. package/Icon/ArrowDownBold.mjs +6 -0
  44. package/Icon/ArrowLeft.mjs +6 -0
  45. package/Icon/ArrowLeftBold.mjs +6 -0
  46. package/Icon/ArrowRight.mjs +6 -0
  47. package/Icon/ArrowRightBold.mjs +6 -0
  48. package/Icon/ArrowRightCircle.mjs +6 -0
  49. package/Icon/ArrowRightCircleFill.mjs +6 -0
  50. package/Icon/ArrowUp.mjs +6 -0
  51. package/Icon/ArrowUpBold.mjs +6 -0
  52. package/Icon/ArrowpagingDown.mjs +6 -0
  53. package/Icon/ArrowpagingDownCircle.mjs +6 -0
  54. package/Icon/ArrowpagingLeft.mjs +6 -0
  55. package/Icon/ArrowpagingLeftCircle.mjs +6 -0
  56. package/Icon/ArrowpagingRight.mjs +6 -0
  57. package/Icon/ArrowpagingRightCircle.mjs +6 -0
  58. package/Icon/ArrowpagingUp.mjs +6 -0
  59. package/Icon/ArrowpagingUpCircle.mjs +6 -0
  60. package/Icon/Article.mjs +6 -0
  61. package/Icon/ArticleSlash.mjs +6 -0
  62. package/Icon/Articledesign.mjs +6 -0
  63. package/Icon/Astrogy.mjs +6 -0
  64. package/Icon/AstrogyFill.mjs +6 -0
  65. package/Icon/Baby.mjs +7 -0
  66. package/Icon/Bbs.mjs +6 -0
  67. package/Icon/Beginner.mjs +6 -0
  68. package/Icon/Bell.mjs +6 -0
  69. package/Icon/BellFill.mjs +6 -0
  70. package/Icon/BellFillSlash.mjs +6 -0
  71. package/Icon/BellSlash.mjs +6 -0
  72. package/Icon/Blog.mjs +6 -0
  73. package/Icon/Bold.mjs +6 -0
  74. package/Icon/Book.mjs +6 -0
  75. package/Icon/BookFill.mjs +6 -0
  76. package/Icon/Bookmark.mjs +6 -0
  77. package/Icon/BookmarkFill.mjs +6 -0
  78. package/Icon/Bookshelf.mjs +6 -0
  79. package/Icon/BookshelfFill.mjs +6 -0
  80. package/Icon/Border.mjs +6 -0
  81. package/Icon/BottomnavFollowfeedActive.mjs +6 -0
  82. package/Icon/BottomnavFollowfeedInactive.mjs +6 -0
  83. package/Icon/BottomnavHomeActive.mjs +6 -0
  84. package/Icon/BottomnavHomeInactive.mjs +6 -0
  85. package/Icon/BottomnavMypageActive.mjs +6 -0
  86. package/Icon/BottomnavSearchActive.mjs +6 -0
  87. package/Icon/BottomnavSearchInactive.mjs +6 -0
  88. package/Icon/BottomnvavMypageInactive.mjs +6 -0
  89. package/Icon/Bullets.mjs +6 -0
  90. package/Icon/Calendar.mjs +6 -0
  91. package/Icon/CameraFill.mjs +6 -0
  92. package/Icon/CautionFill.mjs +6 -0
  93. package/Icon/Check.mjs +6 -0
  94. package/Icon/CheckBold.mjs +6 -0
  95. package/Icon/CheckCircle.mjs +6 -0
  96. package/Icon/CheckCircleFill.mjs +6 -0
  97. package/Icon/CheckRectangle.mjs +6 -0
  98. package/Icon/Checklist.mjs +6 -0
  99. package/Icon/ChevronDown.mjs +6 -0
  100. package/Icon/ChevronDownBold.mjs +6 -0
  101. package/Icon/ChevronLeft.mjs +6 -0
  102. package/Icon/ChevronLeftBold.mjs +6 -0
  103. package/Icon/ChevronRight.mjs +6 -0
  104. package/Icon/ChevronRightBold.mjs +6 -0
  105. package/Icon/ChevronUp.mjs +6 -0
  106. package/Icon/ChevronUpBold.mjs +6 -0
  107. package/Icon/Circle.mjs +6 -0
  108. package/Icon/CircleBold.mjs +6 -0
  109. package/Icon/CircleFill.mjs +6 -0
  110. package/Icon/Clock.mjs +6 -0
  111. package/Icon/ClockFill.mjs +6 -0
  112. package/Icon/Coin.mjs +6 -0
  113. package/Icon/Comment.mjs +6 -0
  114. package/Icon/CommentFill.mjs +6 -0
  115. package/Icon/CommentPen.mjs +6 -0
  116. package/Icon/CommentTwoFill.mjs +6 -0
  117. package/Icon/CommentTwoSlashFill.mjs +6 -0
  118. package/Icon/Community.mjs +6 -0
  119. package/Icon/Compass.mjs +7 -0
  120. package/Icon/Coupon.mjs +6 -0
  121. package/Icon/Crop.mjs +6 -0
  122. package/Icon/CropDin.mjs +6 -0
  123. package/Icon/CropLandscape.mjs +6 -0
  124. package/Icon/Cross.mjs +6 -0
  125. package/Icon/CrossBold.mjs +6 -0
  126. package/Icon/CrossCircle.mjs +6 -0
  127. package/Icon/CrossCircleFill.mjs +6 -0
  128. package/Icon/CrossRectangle.mjs +6 -0
  129. package/Icon/Cutlery.mjs +6 -0
  130. package/Icon/DiamondTwo.mjs +11 -0
  131. package/Icon/Dice.mjs +7 -0
  132. package/Icon/Dot.mjs +6 -0
  133. package/Icon/Dotmoney.mjs +6 -0
  134. package/Icon/Download.mjs +6 -0
  135. package/Icon/Embed.mjs +6 -0
  136. package/Icon/EmotionFill.mjs +6 -0
  137. package/Icon/EntryLost.mjs +6 -0
  138. package/Icon/Exclamationmark.mjs +6 -0
  139. package/Icon/ExclamationmarkBalloon.mjs +6 -0
  140. package/Icon/ExclamationmarkBalloonFill.mjs +6 -0
  141. package/Icon/ExclamationmarkBold.mjs +6 -0
  142. package/Icon/ExclamationmarkCircle.mjs +6 -0
  143. package/Icon/ExclamationmarkCircleFill.mjs +6 -0
  144. package/Icon/Expand.mjs +6 -0
  145. package/Icon/ExpandExit.mjs +6 -0
  146. package/Icon/Facebook.mjs +6 -0
  147. package/Icon/File.mjs +6 -0
  148. package/Icon/FileAdd.mjs +6 -0
  149. package/Icon/FileAddFill.mjs +6 -0
  150. package/Icon/FileCircle.mjs +6 -0
  151. package/Icon/FileCircleFill.mjs +6 -0
  152. package/Icon/FileFill.mjs +6 -0
  153. package/Icon/Filter.mjs +6 -0
  154. package/Icon/FilterCheck.mjs +6 -0
  155. package/Icon/Fit.mjs +6 -0
  156. package/Icon/FlagFill.mjs +6 -0
  157. package/Icon/FlagRanking.mjs +6 -0
  158. package/Icon/FlagRankingTrim.mjs +10 -0
  159. package/Icon/Flash.mjs +6 -0
  160. package/Icon/FlashAuto.mjs +6 -0
  161. package/Icon/FlashOff.mjs +6 -0
  162. package/Icon/Flowervase.mjs +6 -0
  163. package/Icon/Folder.mjs +6 -0
  164. package/Icon/FolderFill.mjs +6 -0
  165. package/Icon/FolderTwo.mjs +6 -0
  166. package/Icon/FolderTwoFill.mjs +6 -0
  167. package/Icon/Font.mjs +6 -0
  168. package/Icon/Fontstyle.mjs +6 -0
  169. package/Icon/Game.mjs +6 -0
  170. package/Icon/GameFill.mjs +6 -0
  171. package/Icon/GameKantan.mjs +6 -0
  172. package/Icon/Gear.mjs +6 -0
  173. package/Icon/GearFill.mjs +6 -0
  174. package/Icon/Genre.mjs +6 -0
  175. package/Icon/GenreAdd.mjs +6 -0
  176. package/Icon/GenreDone.mjs +6 -0
  177. package/Icon/GraphBar.mjs +6 -0
  178. package/Icon/Gruppo.mjs +6 -0
  179. package/Icon/HandWaveFill.mjs +6 -0
  180. package/Icon/Hatenabookmark.mjs +6 -0
  181. package/Icon/Heart.mjs +6 -0
  182. package/Icon/HeartFill.mjs +6 -0
  183. package/Icon/History.mjs +6 -0
  184. package/Icon/HomeFill.mjs +6 -0
  185. package/Icon/Hot.mjs +6 -0
  186. package/Icon/Htmltag.mjs +6 -0
  187. package/Icon/ImageAddFill.mjs +6 -0
  188. package/Icon/ImageBanFill.mjs +6 -0
  189. package/Icon/ImageFill.mjs +6 -0
  190. package/Icon/ImageFillSlash.mjs +6 -0
  191. package/Icon/ImageQuestionFill.mjs +6 -0
  192. package/Icon/Information.mjs +6 -0
  193. package/Icon/Instagram.mjs +6 -0
  194. package/Icon/Italic.mjs +6 -0
  195. package/Icon/Kaomoji.mjs +6 -0
  196. package/Icon/Keyboard.mjs +6 -0
  197. package/Icon/KeyboardDownFill.mjs +6 -0
  198. package/Icon/KeyboardFill.mjs +6 -0
  199. package/Icon/Koeblog.mjs +6 -0
  200. package/Icon/LineCircle.mjs +6 -0
  201. package/Icon/LineSquare.mjs +6 -0
  202. package/Icon/Link.mjs +6 -0
  203. package/Icon/ListBulleted.mjs +6 -0
  204. package/Icon/ListNumbered.mjs +6 -0
  205. package/Icon/Loading.mjs +6 -0
  206. package/Icon/LockFill.mjs +6 -0
  207. package/Icon/LockOpenFill.mjs +6 -0
  208. package/Icon/Magicwand.mjs +6 -0
  209. package/Icon/Mail.mjs +6 -0
  210. package/Icon/MailCheck.mjs +6 -0
  211. package/Icon/MailCircle.mjs +6 -0
  212. package/Icon/MailCircleFill.mjs +6 -0
  213. package/Icon/MailFill.mjs +6 -0
  214. package/Icon/Megaphone.mjs +6 -0
  215. package/Icon/MenuHamburger.mjs +6 -0
  216. package/Icon/MenuHamburgerBold.mjs +6 -0
  217. package/Icon/MenuHamburgerFourline.mjs +6 -0
  218. package/Icon/MenuHorizotal.mjs +6 -0
  219. package/Icon/MenuVertical.mjs +6 -0
  220. package/Icon/Messageboard.mjs +6 -0
  221. package/Icon/Microphone.mjs +6 -0
  222. package/Icon/MicrophoneFill.mjs +6 -0
  223. package/Icon/Minus.mjs +6 -0
  224. package/Icon/MinusBold.mjs +6 -0
  225. package/Icon/Moon.mjs +6 -0
  226. package/Icon/MoonFill.mjs +6 -0
  227. package/Icon/MovieCameraFill.mjs +6 -0
  228. package/Icon/MoviePlay.mjs +6 -0
  229. package/Icon/MoviePlayFill.mjs +6 -0
  230. package/Icon/MovieStop.mjs +6 -0
  231. package/Icon/MusicFill.mjs +6 -0
  232. package/Icon/New.mjs +6 -0
  233. package/Icon/Newbook.mjs +6 -0
  234. package/Icon/NewbookFill.mjs +6 -0
  235. package/Icon/News.mjs +6 -0
  236. package/Icon/Nice.mjs +6 -0
  237. package/Icon/NiceDone.mjs +6 -0
  238. package/Icon/Nodate.mjs +6 -0
  239. package/Icon/Now.mjs +6 -0
  240. package/Icon/Officialstar.mjs +6 -0
  241. package/Icon/OfficialstarFill.mjs +6 -0
  242. package/Icon/OnedariFill.mjs +6 -0
  243. package/Icon/OpenCl.mjs +6 -0
  244. package/Icon/Openblank.mjs +6 -0
  245. package/Icon/OpenblankFill.mjs +6 -0
  246. package/Icon/Ownd.mjs +6 -0
  247. package/Icon/PaletteFill.mjs +6 -0
  248. package/Icon/Pause.mjs +6 -0
  249. package/Icon/PauseBold.mjs +6 -0
  250. package/Icon/Pawprint.mjs +6 -0
  251. package/Icon/Pencil.mjs +6 -0
  252. package/Icon/PencilAdd.mjs +6 -0
  253. package/Icon/PencilBold.mjs +6 -0
  254. package/Icon/Person.mjs +6 -0
  255. package/Icon/PersonFill.mjs +6 -0
  256. package/Icon/PersonThreeFill.mjs +6 -0
  257. package/Icon/PersonTwoAddFill.mjs +6 -0
  258. package/Icon/PersonTwoDeleteFill.mjs +6 -0
  259. package/Icon/PersonTwoDoneFill.mjs +6 -0
  260. package/Icon/PersonTwoFill.mjs +6 -0
  261. package/Icon/Peta.mjs +6 -0
  262. package/Icon/Pigg.mjs +6 -0
  263. package/Icon/PinFill.mjs +6 -0
  264. package/Icon/PlayCircle.mjs +6 -0
  265. package/Icon/PlayFill.mjs +6 -0
  266. package/Icon/Plus.mjs +6 -0
  267. package/Icon/PlusBold.mjs +6 -0
  268. package/Icon/PlusCircle.mjs +6 -0
  269. package/Icon/PlusCircleFill.mjs +6 -0
  270. package/Icon/PremiumFill.mjs +6 -0
  271. package/Icon/Present.mjs +6 -0
  272. package/Icon/Profilecard.mjs +6 -0
  273. package/Icon/Qr.mjs +6 -0
  274. package/Icon/Question.mjs +6 -0
  275. package/Icon/QuestionmarkCircle.mjs +6 -0
  276. package/Icon/QuestionmarkCircleFill.mjs +6 -0
  277. package/Icon/RankingCrown.mjs +6 -0
  278. package/Icon/RankingCrownFill.mjs +6 -0
  279. package/Icon/RankingPlatformFill.mjs +6 -0
  280. package/Icon/Reblog.mjs +6 -0
  281. package/Icon/ReblogSlash.mjs +6 -0
  282. package/Icon/Redo.mjs +6 -0
  283. package/Icon/RedoBold.mjs +6 -0
  284. package/Icon/Refresh.mjs +6 -0
  285. package/Icon/ReplyCircleFill.mjs +6 -0
  286. package/Icon/ReplyFill.mjs +6 -0
  287. package/Icon/Requ.mjs +6 -0
  288. package/Icon/Sad.mjs +6 -0
  289. package/Icon/Saveblog.mjs +6 -0
  290. package/Icon/ScreenFull.mjs +6 -0
  291. package/Icon/ScreenInline.mjs +6 -0
  292. package/Icon/Search.mjs +6 -0
  293. package/Icon/Service.mjs +6 -0
  294. package/Icon/Share.mjs +6 -0
  295. package/Icon/ShineFill.mjs +6 -0
  296. package/Icon/Shirt.mjs +6 -0
  297. package/Icon/SidefaceClose.mjs +6 -0
  298. package/Icon/SidefaceOpen.mjs +6 -0
  299. package/Icon/Smartphone.mjs +6 -0
  300. package/Icon/SmartphoneFill.mjs +6 -0
  301. package/Icon/Sort.mjs +6 -0
  302. package/Icon/SortFeed.mjs +6 -0
  303. package/Icon/SortTile.mjs +6 -0
  304. package/Icon/SpeakerOffFill.mjs +6 -0
  305. package/Icon/SpeakerOnFill.mjs +6 -0
  306. package/Icon/Sprout.mjs +6 -0
  307. package/Icon/Stampside.mjs +6 -0
  308. package/Icon/Star.mjs +6 -0
  309. package/Icon/StarCircleFill.mjs +6 -0
  310. package/Icon/StarFaceFill.mjs +6 -0
  311. package/Icon/StarFill.mjs +6 -0
  312. package/Icon/StopFill.mjs +6 -0
  313. package/Icon/Strikethrough.mjs +6 -0
  314. package/Icon/Sun.mjs +6 -0
  315. package/Icon/SunFill.mjs +6 -0
  316. package/Icon/Switching.mjs +6 -0
  317. package/Icon/SwitchingCamera.mjs +6 -0
  318. package/Icon/TagFill.mjs +6 -0
  319. package/Icon/TagOfficialFill.mjs +6 -0
  320. package/Icon/Thumbsup.mjs +6 -0
  321. package/Icon/ThumbsupFill.mjs +6 -0
  322. package/Icon/Title.mjs +6 -0
  323. package/Icon/TopbloggerRibbon.mjs +6 -0
  324. package/Icon/TranscriptOff.mjs +6 -0
  325. package/Icon/TranscriptOn.mjs +6 -0
  326. package/Icon/Transmission.mjs +6 -0
  327. package/Icon/Trashcan.mjs +6 -0
  328. package/Icon/Trend.mjs +6 -0
  329. package/Icon/TrendFill.mjs +6 -0
  330. package/Icon/TriangleDown.mjs +6 -0
  331. package/Icon/TriangleLeft.mjs +6 -0
  332. package/Icon/TriangleRight.mjs +6 -0
  333. package/Icon/TriangleUp.mjs +6 -0
  334. package/Icon/TrianglearrowDown.mjs +6 -0
  335. package/Icon/TrianglearrowDownright.mjs +6 -0
  336. package/Icon/TrianglearrowRight.mjs +6 -0
  337. package/Icon/TrianglearrowUp.mjs +6 -0
  338. package/Icon/TrianglearrowUpright.mjs +6 -0
  339. package/Icon/TriangleendLeft.mjs +6 -0
  340. package/Icon/TriangleendRight.mjs +6 -0
  341. package/Icon/TrophyFill.mjs +6 -0
  342. package/Icon/TvFill.mjs +6 -0
  343. package/Icon/Twitter.mjs +6 -0
  344. package/Icon/Underline.mjs +6 -0
  345. package/Icon/Undo.mjs +6 -0
  346. package/Icon/UndoBold.mjs +6 -0
  347. package/Icon/Wallet.mjs +6 -0
  348. package/Icon/Webview.mjs +6 -0
  349. package/Icon/Youtube.mjs +6 -0
  350. package/Icon/index.mjs +325 -0
  351. package/IconButton/IconButton.mjs +5 -0
  352. package/IconButton/index.mjs +1 -0
  353. package/LinkButton/LinkButton.mjs +7 -0
  354. package/LinkButton/index.mjs +1 -0
  355. package/README.md +3 -1
  356. package/Toast/Toast.mjs +67 -0
  357. package/Toast/index.mjs +1 -0
  358. package/index.mjs +10 -0
  359. package/package.json +11 -3
  360. package/tsconfig.cjs.json +10 -0
  361. package/tsconfig.esm.json +8 -0
@@ -0,0 +1,7 @@
1
+ import React, { forwardRef } from 'react';
2
+ const BLOCK_NAME = 'spui-Button';
3
+ export const Button = forwardRef(function Button({ children, layout = 'intrinsic', size = 'large', variant = 'contained', icon, ...rest }, ref) {
4
+ return (React.createElement("button", Object.assign({ className: `${BLOCK_NAME} ${BLOCK_NAME}--${layout} ${BLOCK_NAME}--${size} ${BLOCK_NAME}--${variant}`, ref: ref }, rest), icon ? (React.createElement(React.Fragment, null,
5
+ React.createElement("span", { className: `${BLOCK_NAME}-icon ${BLOCK_NAME}-icon--${size}` }, icon),
6
+ children)) : (children)));
7
+ });
@@ -0,0 +1 @@
1
+ export { Button } from './Button';
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ const BLOCK_NAME = 'spui-ButtonGroup';
3
+ export const ButtonGroup = ({ children, className, direction = 'row', size = 'large', ...rest }) => {
4
+ const classnames = [
5
+ BLOCK_NAME,
6
+ `${BLOCK_NAME}--${direction}`,
7
+ `${BLOCK_NAME}--${size}`,
8
+ className,
9
+ ]
10
+ .filter(Boolean)
11
+ .join(' ');
12
+ return (React.createElement("div", Object.assign({ className: classnames }, rest), children));
13
+ };
@@ -0,0 +1 @@
1
+ export { ButtonGroup } from './ButtonGroup';
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.26.1-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.26.0...@openameba/spindle-ui@0.26.1-alpha.0) (2022-02-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **spindle-ui:** set side effect for css ([5a24128](https://github.com/openameba/spindle/commit/5a241288ba6964c77fabdeb7b498fe4ac62b7328))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.26.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.25.1...@openameba/spindle-ui@0.26.0) (2022-02-21)
7
18
 
8
19
 
@@ -10,6 +21,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
10
21
 
11
22
  * **spindle-ui:** add HeroCarousel component ([d7e0a53](https://github.com/openameba/spindle/commit/d7e0a5302cfca4d7600188098ef4dd224998e2bb))
12
23
 
24
+ ## [0.25.2-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.25.1...@openameba/spindle-ui@0.25.2-alpha.0) (2021-12-09)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **spindle-ui:** set side effect for css ([bdf0c9f](https://github.com/openameba/spindle/commit/bdf0c9ff79a69ad9dd2706dcfe96bd29559b373e))
30
+
13
31
 
14
32
 
15
33
 
@@ -70,12 +88,19 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
70
88
  ### Features
71
89
 
72
90
  * **spindle-icons:** update icons ([39ce767](https://github.com/openameba/spindle/commit/39ce7673df4556ee3b9a6ea6dc62ad25236a6fc9))
91
+ ## [0.22.1-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.22.0...@openameba/spindle-ui@0.22.1-alpha.0) (2021-09-06)
92
+
93
+
94
+ ### Bug Fixes
95
+
96
+ * **spindle-ui:** set side effect for css ([f26be31](https://github.com/openameba/spindle/commit/f26be31bf53ec73fbe00222773ba691809dae5d5))
73
97
 
74
98
 
75
99
 
76
100
 
77
101
 
78
102
  # [0.22.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.21.2...@openameba/spindle-ui@0.22.0) (2021-09-06)
103
+ ## [0.21.3-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.21.2...@openameba/spindle-ui@0.21.3-alpha.0) (2021-07-30)
79
104
 
80
105
 
81
106
  ### Bug Fixes
@@ -97,12 +122,14 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
97
122
  ### BREAKING CHANGES
98
123
 
99
124
  * **spindle-icons,spindle-ui:** setting icon was renamed to gear
125
+ * **spindle-ui:** set side effect for css ([ec4e8f1](https://github.com/openameba/spindle/commit/ec4e8f143cd6769cc6b3d49534233a46eaf79b2d))
100
126
 
101
127
 
102
128
 
103
129
 
104
130
 
105
131
  ## [0.21.2](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.21.1...@openameba/spindle-ui@0.21.2) (2021-07-30)
132
+ ## [0.21.2-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.21.1...@openameba/spindle-ui@0.21.2-alpha.0) (2021-07-28)
106
133
 
107
134
  **Note:** Version bump only for package @openameba/spindle-ui
108
135
 
@@ -163,6 +190,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
163
190
  ### Features
164
191
 
165
192
  * **spindle-icons:** update icons ([ae07c8e](https://github.com/openameba/spindle/commit/ae07c8eca4f33789c45b3c3d6a2e7f8f17c11e81))
193
+ ## [0.18.1-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.18.0...@openameba/spindle-ui@0.18.1-alpha.0) (2021-06-11)
194
+
195
+ **Note:** Version bump only for package @openameba/spindle-ui
166
196
 
167
197
 
168
198
 
@@ -218,6 +248,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
218
248
  ### Bug Fixes
219
249
 
220
250
  * **spindle-ui:** fix CSS variable name ([f76d2ee](https://github.com/openameba/spindle/commit/f76d2ee1840574a1247a20ea1ee212b85d99708e))
251
+ # [0.15.0-alpha.0](https://github.com/openameba/spindle/compare/@openameba/spindle-ui@0.14.0...@openameba/spindle-ui@0.15.0-alpha.0) (2021-03-15)
252
+
253
+ **Note:** Version bump only for package @openameba/spindle-ui
221
254
 
222
255
 
223
256
 
@@ -0,0 +1,11 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { CheckBold } from '../Icon';
3
+ const BLOCK_NAME = 'spui-Checkbox';
4
+ export const Checkbox = forwardRef(function Checkbox({ children, ...rest }, ref) {
5
+ return (React.createElement("label", { className: `${BLOCK_NAME}-label` },
6
+ React.createElement("input", Object.assign({ className: `${BLOCK_NAME}-input`, ref: ref, type: "checkbox" }, rest)),
7
+ React.createElement("span", { className: `${BLOCK_NAME}-icon` },
8
+ React.createElement(CheckBold, { "aria-hidden": "true" })),
9
+ React.createElement("span", { className: `${BLOCK_NAME}-outline` }),
10
+ children && React.createElement("span", { className: `${BLOCK_NAME}-text` }, children)));
11
+ });
@@ -0,0 +1,38 @@
1
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
2
+ import mergeRefs from 'react-merge-refs';
3
+ import { ChevronDownBold } from '../Icon';
4
+ const BLOCK_NAME = 'spui-DropDown';
5
+ export const DropDown = forwardRef(function DropDown({ children, hasError = false, onChange, ...rest }, ref) {
6
+ const selectEl = useRef(null);
7
+ const [text, setText] = useState('');
8
+ const [disabled, setDisabled] = useState(false);
9
+ const update = () => {
10
+ if (selectEl && selectEl.current) {
11
+ const selectedEl = selectEl.current.options[selectEl.current.selectedIndex];
12
+ const value = selectedEl.text;
13
+ const disabled = selectedEl.disabled;
14
+ setText(value);
15
+ setDisabled(disabled);
16
+ }
17
+ };
18
+ const handleChange = (event) => {
19
+ if (typeof onChange === 'function') {
20
+ onChange(event);
21
+ }
22
+ update();
23
+ };
24
+ // Update text once
25
+ useEffect(update, []);
26
+ return (React.createElement("label", { className: [
27
+ `${BLOCK_NAME}-label`,
28
+ !disabled ? 'is-active' : '',
29
+ hasError ? 'is-error' : '',
30
+ ]
31
+ .filter(Boolean)
32
+ .join(' ') },
33
+ React.createElement("span", { className: `${BLOCK_NAME}-visual` }, text),
34
+ React.createElement("span", { className: `${BLOCK_NAME}-icon` },
35
+ React.createElement(ChevronDownBold, { "aria-hidden": "true" })),
36
+ React.createElement("select", Object.assign({ className: `${BLOCK_NAME}-select`, ref: mergeRefs([selectEl, ref]), onChange: handleChange }, rest), children),
37
+ React.createElement("span", { className: `${BLOCK_NAME}-outline` })));
38
+ });
@@ -0,0 +1,30 @@
1
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
2
+ import mergeRefs from 'react-merge-refs';
3
+ import { ChevronDownBold } from '../Icon';
4
+ const BLOCK_NAME = 'spui-InlineDropDown';
5
+ export const InlineDropDown = forwardRef(function InlineDropDown({ children, visualSize = 'medium', onChange, ...rest }, ref) {
6
+ const selectEl = useRef(null);
7
+ const [text, setText] = useState('');
8
+ const update = () => {
9
+ if (selectEl && selectEl.current) {
10
+ const selectedEl = selectEl.current.options[selectEl.current.selectedIndex];
11
+ const value = selectedEl.text;
12
+ setText(value);
13
+ }
14
+ };
15
+ const handleChange = (event) => {
16
+ if (typeof onChange === 'function') {
17
+ onChange(event);
18
+ }
19
+ update();
20
+ };
21
+ // Update text once
22
+ useEffect(update, []);
23
+ return (React.createElement("label", { className: [`${BLOCK_NAME}-label`].filter(Boolean).join(' ') },
24
+ React.createElement("span", { className: `${BLOCK_NAME}-visual` },
25
+ React.createElement("span", { className: `${BLOCK_NAME}-text ${BLOCK_NAME}-text--${visualSize}` }, text),
26
+ React.createElement("span", { className: `${BLOCK_NAME}-icon ${BLOCK_NAME}-icon--${visualSize}` },
27
+ React.createElement(ChevronDownBold, { "aria-hidden": "true" }))),
28
+ React.createElement("select", Object.assign({ className: `${BLOCK_NAME}-select ${BLOCK_NAME}-select--${visualSize}`, ref: mergeRefs([selectEl, ref]), onChange: handleChange }, rest), children),
29
+ React.createElement("span", { className: `${BLOCK_NAME}-outline` })));
30
+ });
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ const BLOCK_NAME = 'spui-InputLabel';
3
+ export const InputLabel = ({ children, id = '', ...rest }) => {
4
+ return (React.createElement("label", Object.assign({ className: BLOCK_NAME, htmlFor: id }, rest), children));
5
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ExclamationmarkCircleFill } from '../Icon';
3
+ const BLOCK_NAME = 'spui-InvalidMessage';
4
+ export const InvalidMessage = ({ children, visible = false, ...rest }) => {
5
+ return (React.createElement("p", Object.assign({ className: BLOCK_NAME, hidden: !visible }, rest),
6
+ React.createElement("span", { className: `${BLOCK_NAME}-icon` },
7
+ React.createElement(ExclamationmarkCircleFill, { "aria-hidden": "true" })),
8
+ React.createElement("span", { className: `${BLOCK_NAME}-body` }, children)));
9
+ };
package/Form/Radio.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { CheckBold } from '../Icon';
3
+ const BLOCK_NAME = 'spui-Radio';
4
+ export const Radio = forwardRef(function Radio({ children, id = '', ...rest }, ref) {
5
+ return (React.createElement("label", { className: `${BLOCK_NAME}-label`, htmlFor: id },
6
+ React.createElement("input", Object.assign({ className: `${BLOCK_NAME}-input`, id: id, ref: ref, type: "radio" }, rest)),
7
+ React.createElement("span", { className: `${BLOCK_NAME}-icon` },
8
+ React.createElement(CheckBold, { "aria-hidden": "true" })),
9
+ React.createElement("span", { className: `${BLOCK_NAME}-outline` }),
10
+ children && React.createElement("span", { className: `${BLOCK_NAME}-text` }, children)));
11
+ });
@@ -0,0 +1,5 @@
1
+ import React, { forwardRef } from 'react';
2
+ const BLOCK_NAME = 'spui-TextArea';
3
+ export const TextArea = forwardRef(function TextArea({ children, hasError = false, id = '', ...rest }, ref) {
4
+ return (React.createElement("textarea", Object.assign({ className: [`${BLOCK_NAME}`, hasError ? 'is-error' : ''].join(' '), id: id, ref: ref }, rest), children));
5
+ });
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from 'react';
2
+ const BLOCK_NAME = 'spui-TextField';
3
+ export const TextField = forwardRef(function TextField({ hasError = false, id = '', variant = 'medium', ...rest }, ref) {
4
+ return (React.createElement("input", Object.assign({ className: [
5
+ `${BLOCK_NAME}`,
6
+ `${BLOCK_NAME}--${variant}`,
7
+ hasError ? 'is-error' : '',
8
+ ].join(' '), id: id, ref: ref }, rest)));
9
+ });
@@ -0,0 +1,8 @@
1
+ import React, { forwardRef } from 'react';
2
+ const BLOCK_NAME = 'spui-ToggleSwitch';
3
+ export const ToggleSwitch = forwardRef(function ToggleSwitch({ id = '', ...rest }, ref) {
4
+ return (React.createElement("label", { className: BLOCK_NAME },
5
+ React.createElement("input", Object.assign({ className: `${BLOCK_NAME}-input`, id: id, ref: ref, type: "checkbox" }, rest)),
6
+ React.createElement("span", { className: `${BLOCK_NAME}-visual` }),
7
+ React.createElement("span", { className: `${BLOCK_NAME}-outline` })));
8
+ });
package/Form/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ export { Checkbox } from './Checkbox';
2
+ export { DropDown } from './DropDown';
3
+ export { InputLabel } from './InputLabel';
4
+ export { InvalidMessage } from './InvalidMessage';
5
+ export { Radio } from './Radio';
6
+ export { TextArea } from './TextArea';
7
+ export { TextField } from './TextField';
8
+ export { ToggleSwitch } from './ToggleSwitch';
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import ChevronLeftBold from '../Icon/ChevronLeftBold';
3
+ import ChevronRightBold from '../Icon/ChevronRightBold';
4
+ import Pause from '../Icon/Pause';
5
+ import PlayFill from '../Icon/PlayFill';
6
+ import HeroCarouselItem from './HeroCarouselItem';
7
+ import { useAutoPlayCarousel } from './hooks/useAutoPlayCarousel';
8
+ const BLOCK_NAME = 'spui-HeroCarousel';
9
+ const ITEM_LINK_CLASS_NAME = 'js-auto-play-carousel-item-link';
10
+ export const HeroCarousel = React.memo(function HeroCarousel({ carouselList, }) {
11
+ if (carouselList.length === 0) {
12
+ return null;
13
+ }
14
+ const { handleSlideToPrev, handleSlideToNext, handleMouseEnter, handleMouseDown, handleMouseLeave, handleTouchStart, handleTransitionEnd, isAutoPlaying, isLinkClicked, itemsToRender, listRef, listStyles, toggleAutoPlay, handleFocus, handleBlur, } = useAutoPlayCarousel({
15
+ items: carouselList,
16
+ itemLinkClassName: ITEM_LINK_CLASS_NAME,
17
+ });
18
+ return (React.createElement("div", null,
19
+ React.createElement("div", { className: `${BLOCK_NAME}-container`, onBlur: handleBlur, onFocus: handleFocus, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onTouchStart: handleTouchStart, onTransitionEnd: handleTransitionEnd },
20
+ React.createElement("ul", { "aria-roledescription": "\u30AB\u30EB\u30FC\u30BB\u30EB", className: `${BLOCK_NAME}-list`, ref: listRef, role: "group", style: listStyles }, itemsToRender.map((item, index) => (React.createElement(HeroCarouselItem, { carouselItem: item, isLinkClicked: isLinkClicked, itemLinkClassName: ITEM_LINK_CLASS_NAME, key: `hero-carousel-${index}` }))))),
21
+ React.createElement("div", { className: `${BLOCK_NAME}-controls` },
22
+ React.createElement("button", { "aria-label": "1\u3064\u524D\u306E\u30A2\u30A4\u30C6\u30E0\u306B\u79FB\u52D5", className: `${BLOCK_NAME}-control ${BLOCK_NAME}-control--prev`, type: "button", onClick: handleSlideToPrev },
23
+ React.createElement(ChevronLeftBold, { "aria-hidden": true })),
24
+ React.createElement("button", { "aria-label": isAutoPlaying ? 'スライドを停止' : 'スライドを再生', className: `${BLOCK_NAME}-control`, type: "button", onClick: toggleAutoPlay }, isAutoPlaying ? (React.createElement(Pause, { "aria-hidden": true })) : (React.createElement(PlayFill, { "aria-hidden": true }))),
25
+ React.createElement("button", { "aria-label": "1\u3064\u5F8C\u308D\u306E\u30A2\u30A4\u30C6\u30E0\u306B\u79FB\u52D5", className: `${BLOCK_NAME}-control ${BLOCK_NAME}-control--next`, type: "button", onClick: handleSlideToNext },
26
+ React.createElement(ChevronRightBold, { "aria-hidden": true })))));
27
+ });
@@ -0,0 +1,21 @@
1
+ import React, { useCallback } from 'react';
2
+ import './HeroCarouselItem.css';
3
+ const BLOCK_NAME = 'spui-HeroCarouselItem';
4
+ export const HeroCarouselItem = React.memo(function HeroCarouselItem({ carouselItem, isLinkClicked, itemLinkClassName, }) {
5
+ const handleLinkClick = useCallback((e) => {
6
+ if (!isLinkClicked) {
7
+ e.preventDefault();
8
+ }
9
+ }, [isLinkClicked]);
10
+ return (React.createElement("li", { className: `${BLOCK_NAME}-listItem` },
11
+ React.createElement("a", { className: `${itemLinkClassName} ${BLOCK_NAME}-link`, href: carouselItem.link, onClick: handleLinkClick },
12
+ React.createElement("span", { className: `${BLOCK_NAME}-imageBlock` },
13
+ React.createElement("img", { alt: "", className: `${BLOCK_NAME}-image`, src: carouselItem.imageUrl })),
14
+ React.createElement("div", { className: `${BLOCK_NAME}-titleContainer` },
15
+ React.createElement("p", { className: `${BLOCK_NAME}-title` }, carouselItem.title)))));
16
+ }, (prevProps, nextProps) => prevProps.isLinkClicked === nextProps.isLinkClicked &&
17
+ prevProps.itemLinkClassName === nextProps.itemLinkClassName &&
18
+ prevProps.carouselItem.title === nextProps.carouselItem.title &&
19
+ prevProps.carouselItem.link === nextProps.carouselItem.link &&
20
+ prevProps.carouselItem.imageUrl === nextProps.carouselItem.imageUrl);
21
+ export default HeroCarouselItem;
@@ -0,0 +1,158 @@
1
+ import { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import { useAutoSlide } from './useAutoSlide';
3
+ import { useCarouselFocus } from './useCarouselFocus';
4
+ import { useSliderMoveEvent } from './useSliderMoveEvent';
5
+ import { useSliderTransition } from './useSliderTransition';
6
+ import { useValueRef } from './useValueRef';
7
+ const COPY_COUNT = 5;
8
+ const SWIPE_THRESHOLD_X = 20;
9
+ export function useAutoPlayCarousel({ items, itemLinkClassName, }) {
10
+ const { diffXRef, diffYRef, setDiffX, setDiffY, setStartX, setStartY, } = useSliderMoveEvent();
11
+ const [focusOffset, setFocusOffset] = useState(0);
12
+ const [isHovering, setIsHovering] = useState(false);
13
+ const [isLinkClicked, setIsLinkClicked] = useState(false);
14
+ const isHoveringRef = useValueRef(isHovering);
15
+ const slideToNextRef = useValueRef(() => slideToNext());
16
+ const itemCount = useMemo(() => items.length, [items]);
17
+ const getIsCopiedItem = useCallback((index) => {
18
+ return index < COPY_COUNT || index >= itemCount + COPY_COUNT;
19
+ }, [itemCount]);
20
+ const { isAutoPlaying, setIsAutoPlaying, resetAutoSlide, resetTimeOut, toggleAutoPlay, } = useAutoSlide({
21
+ onTimeOut: slideToNextRef.current,
22
+ });
23
+ const { linkRefs, listRef } = useCarouselFocus({
24
+ getIsCopiedItem,
25
+ itemLinkClassName,
26
+ });
27
+ const isAutoPlayingRef = useValueRef(isAutoPlaying);
28
+ const { currentIndexRef, handleTransitionEnd, listStyles, setCurrentIndex, setDisableAutoFocus, setDisableTransition, } = useSliderTransition({
29
+ copyCount: COPY_COUNT,
30
+ itemCount,
31
+ isAutoPlaying,
32
+ linkRefs,
33
+ });
34
+ const itemsToRender = useMemo(
35
+ // generate copy contents on both ends to make carousel look like looping
36
+ () => [
37
+ ...items.slice(-COPY_COUNT),
38
+ ...items,
39
+ ...items.slice(0, COPY_COUNT),
40
+ ], [items]);
41
+ const slideToNext = (ignoreHover = false) => {
42
+ const shouldSlideToNext = ((!isHoveringRef.current && isAutoPlayingRef.current) || ignoreHover) &&
43
+ currentIndexRef.current <= itemCount;
44
+ if (shouldSlideToNext) {
45
+ setDisableTransition(false);
46
+ setCurrentIndex(currentIndexRef.current + 1);
47
+ }
48
+ resetAutoSlide();
49
+ };
50
+ const slideToPrev = () => {
51
+ if (currentIndexRef.current >= 0) {
52
+ setDisableTransition(false);
53
+ setCurrentIndex(currentIndexRef.current - 1);
54
+ }
55
+ resetAutoSlide();
56
+ };
57
+ const handleMouseEnter = () => setIsHovering(true);
58
+ const handleMouseLeave = () => {
59
+ setIsHovering(false);
60
+ resetAutoSlide();
61
+ };
62
+ const handleMouseDown = (e) => {
63
+ resetTimeOut();
64
+ setStartX(e.clientX);
65
+ setStartY(e.clientY);
66
+ };
67
+ const onMouseUp = () => {
68
+ if (diffXRef.current > SWIPE_THRESHOLD_X) {
69
+ setIsLinkClicked(false);
70
+ setIsAutoPlaying(false);
71
+ slideToPrev();
72
+ }
73
+ if (diffXRef.current < -SWIPE_THRESHOLD_X) {
74
+ setIsLinkClicked(false);
75
+ setIsAutoPlaying(false);
76
+ slideToNext(true);
77
+ }
78
+ if (diffXRef.current === 0 && diffYRef.current === 0) {
79
+ setIsLinkClicked(true);
80
+ }
81
+ setStartX(null);
82
+ setStartY(null);
83
+ setDiffX(0);
84
+ setDiffY(0);
85
+ };
86
+ const handleTouchStart = (e) => {
87
+ if (!e.touches.length)
88
+ return;
89
+ const touch = e.touches[0];
90
+ resetTimeOut();
91
+ handleMouseEnter();
92
+ setStartX(touch.clientX);
93
+ setStartY(touch.clientY);
94
+ };
95
+ const onTouchEnd = () => {
96
+ setIsHovering(false);
97
+ onMouseUp();
98
+ };
99
+ const handleSlideToPrev = () => {
100
+ resetTimeOut();
101
+ setIsAutoPlaying(false);
102
+ slideToPrev();
103
+ };
104
+ const handleSlideToNext = () => {
105
+ resetTimeOut();
106
+ setIsAutoPlaying(false);
107
+ slideToNext(true);
108
+ };
109
+ const handleFocus = (e) => {
110
+ setIsAutoPlaying(false);
111
+ const { offsetLeft: newFocusOffset } = e.target;
112
+ setFocusOffset(newFocusOffset);
113
+ if (focusOffset === 0) {
114
+ return;
115
+ }
116
+ setDisableAutoFocus(true);
117
+ if (isHovering && diffXRef.current === 0 && diffYRef.current === 0) {
118
+ setIsLinkClicked(true);
119
+ return;
120
+ }
121
+ if (focusOffset > newFocusOffset) {
122
+ setDisableTransition(false);
123
+ setCurrentIndex(currentIndexRef.current - 1);
124
+ }
125
+ if (focusOffset < newFocusOffset) {
126
+ setDisableTransition(false);
127
+ setCurrentIndex(currentIndexRef.current + 1);
128
+ }
129
+ };
130
+ const handleBlur = () => {
131
+ setIsAutoPlaying(true);
132
+ };
133
+ useEffect(() => {
134
+ document.body.addEventListener('mouseup', onMouseUp);
135
+ document.body.addEventListener('touchend', onTouchEnd);
136
+ return () => {
137
+ document.body.removeEventListener('mouseup', onMouseUp);
138
+ document.body.removeEventListener('touchend', onTouchEnd);
139
+ };
140
+ }, []);
141
+ return {
142
+ handleSlideToPrev,
143
+ handleSlideToNext,
144
+ handleMouseEnter,
145
+ handleMouseDown,
146
+ handleMouseLeave,
147
+ handleTouchStart,
148
+ handleTransitionEnd,
149
+ isAutoPlaying,
150
+ isLinkClicked,
151
+ itemsToRender,
152
+ listRef,
153
+ listStyles,
154
+ toggleAutoPlay,
155
+ handleFocus,
156
+ handleBlur,
157
+ };
158
+ }
@@ -0,0 +1,40 @@
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ const AUTO_SLIDE_SPEED = 4000; // ms
3
+ export function useAutoSlide({ onTimeOut }) {
4
+ const [isAutoPlaying, setIsAutoPlaying] = useState(true);
5
+ const [timeoutId, setTimeoutId] = useState(null);
6
+ const resetTimeOut = useCallback(() => {
7
+ if (timeoutId) {
8
+ clearTimeout(timeoutId);
9
+ }
10
+ }, [timeoutId]);
11
+ const activateAutoSlide = () => {
12
+ resetTimeOut();
13
+ const newTimeoutId = setTimeout(() => {
14
+ onTimeOut();
15
+ }, AUTO_SLIDE_SPEED);
16
+ setTimeoutId(newTimeoutId);
17
+ };
18
+ const resetAutoSlide = () => {
19
+ if (isAutoPlaying) {
20
+ activateAutoSlide();
21
+ }
22
+ };
23
+ const toggleAutoPlay = () => {
24
+ resetTimeOut();
25
+ if (!isAutoPlaying) {
26
+ activateAutoSlide();
27
+ }
28
+ setIsAutoPlaying((prev) => !prev);
29
+ };
30
+ useEffect(() => {
31
+ activateAutoSlide();
32
+ }, []);
33
+ return {
34
+ isAutoPlaying,
35
+ setIsAutoPlaying,
36
+ resetAutoSlide,
37
+ resetTimeOut,
38
+ toggleAutoPlay,
39
+ };
40
+ }
@@ -0,0 +1,22 @@
1
+ import { useEffect, useRef } from 'react';
2
+ export function useCarouselFocus({ getIsCopiedItem, itemLinkClassName, }) {
3
+ const listRef = useRef(null);
4
+ const linkRefs = useRef([]);
5
+ useEffect(() => {
6
+ if (!listRef.current)
7
+ return;
8
+ const linkElements = listRef.current.querySelectorAll(`a.${itemLinkClassName}`);
9
+ if (!linkElements)
10
+ return;
11
+ // NOTE: use NodeList forEach as IE polyfill
12
+ Array.prototype.forEach.call(linkElements, (link, index) => {
13
+ linkRefs.current.push(link);
14
+ link.setAttribute('tabindex', getIsCopiedItem(index) ? '-1' : '0');
15
+ link.setAttribute('aria-hidden', getIsCopiedItem(index) ? 'true' : 'false');
16
+ });
17
+ }, [getIsCopiedItem, itemLinkClassName]);
18
+ return {
19
+ linkRefs,
20
+ listRef,
21
+ };
22
+ }
@@ -0,0 +1,47 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useValueRef } from './useValueRef';
3
+ export function useSliderMoveEvent() {
4
+ const [diffX, setDiffX] = useState(0);
5
+ const [diffY, setDiffY] = useState(0);
6
+ const [startX, setStartX] = useState(null);
7
+ const [startY, setStartY] = useState(null);
8
+ const diffXRef = useValueRef(diffX);
9
+ const diffYRef = useValueRef(diffY);
10
+ const startXRef = useValueRef(startX);
11
+ const startYRef = useValueRef(startY);
12
+ const onMouseMove = (e) => {
13
+ if (startXRef.current === null || startYRef.current === null)
14
+ return;
15
+ e.preventDefault();
16
+ setDiffX(e.clientX - startXRef.current);
17
+ setDiffY(e.clientY - startYRef.current);
18
+ };
19
+ const onTouchMove = (e) => {
20
+ if (startXRef.current === null ||
21
+ startYRef.current === null ||
22
+ !e.touches.length) {
23
+ return;
24
+ }
25
+ const touch = e.touches[0];
26
+ setDiffX(touch.clientX - startXRef.current);
27
+ setDiffY(touch.clientY - startYRef.current);
28
+ };
29
+ useEffect(() => {
30
+ document.body.addEventListener('mousemove', onMouseMove);
31
+ document.body.addEventListener('touchmove', onTouchMove, {
32
+ passive: true,
33
+ });
34
+ return () => {
35
+ document.body.removeEventListener('mousemove', onMouseMove);
36
+ document.body.removeEventListener('touchmove', onTouchMove);
37
+ };
38
+ }, []);
39
+ return {
40
+ diffXRef,
41
+ diffYRef,
42
+ setDiffX,
43
+ setDiffY,
44
+ setStartX,
45
+ setStartY,
46
+ };
47
+ }
@@ -0,0 +1,30 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { useValueRef } from './useValueRef';
3
+ export function useSliderTransition({ copyCount, itemCount, linkRefs, isAutoPlaying, }) {
4
+ const [currentIndex, setCurrentIndex] = useState(0);
5
+ const currentIndexRef = useValueRef(currentIndex);
6
+ const [disableTransition, setDisableTransition] = useState(false);
7
+ const [disableAutoFocus, setDisableAutoFocus] = useState(false);
8
+ const listStyles = useMemo(() => {
9
+ return {
10
+ transition: disableTransition ? 'none' : '',
11
+ transform: `translate3d(${-100 * (currentIndex + copyCount)}%, 0, 0) translateX(0)`,
12
+ };
13
+ }, [copyCount, currentIndex, disableTransition]);
14
+ const handleTransitionEnd = () => {
15
+ if (!isAutoPlaying && !disableAutoFocus) {
16
+ linkRefs.current[currentIndex + copyCount].focus();
17
+ }
18
+ // if reach contents end, rewind without transition to make it look like looping
19
+ setDisableTransition(true);
20
+ setCurrentIndex((prev) => (prev + itemCount) % itemCount);
21
+ };
22
+ return {
23
+ currentIndexRef,
24
+ handleTransitionEnd,
25
+ listStyles,
26
+ setCurrentIndex,
27
+ setDisableAutoFocus,
28
+ setDisableTransition,
29
+ };
30
+ }
@@ -0,0 +1,8 @@
1
+ import { useEffect, useRef } from 'react';
2
+ export function useValueRef(value) {
3
+ const ref = useRef(value);
4
+ useEffect(() => {
5
+ ref.current = value;
6
+ }, [value]);
7
+ return ref;
8
+ }
@@ -0,0 +1 @@
1
+ export { HeroCarousel } from './HeroCarousel';
package/Icon/755.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ function Svg755(props) {
3
+ return (React.createElement("svg", Object.assign({ width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", role: "img" }, props),
4
+ React.createElement("path", { d: "M18.28 9.5h-1.64l-.35.72.07.03c.19.09.37.22.55.42.31.33.47.76.46 1.27-.01.62-.23 1.13-.66 1.52-.42.38-.95.58-1.6.58h-.01c-.55 0-1.03-.16-1.43-.46l-.18-.14.57-1.04.25.2c.26.2.49.28.85.28.28 0 .5-.08.68-.26.18-.18.26-.38.26-.66 0-.2-.09-.39-.26-.52-.22-.17-.6-.21-.61-.21-.35-.04-.62-.03-.78-.01l.99-2.13.39-.87h3.03l-.58 1.28zm-6.46 1.22c.19.09.37.22.55.42.31.33.47.76.47 1.27-.01.62-.23 1.13-.66 1.52-.42.38-.95.57-1.59.57h-.03c-.55 0-1.03-.16-1.43-.46l-.18-.14.57-1.04.25.2c.26.2.49.28.85.28.28 0 .5-.08.68-.26.18-.18.26-.38.26-.66 0-.2-.09-.39-.26-.52-.22-.17-.6-.21-.61-.21-.35-.04-.62-.03-.78-.01l.99-2.13.39-.86h3.03l-.57 1.28H12.1l-.35.72.07.03zm-6.12 4l2.08-4.3H5.25l.2-.41.39-.87h3.95l-2.66 5.57H5.7v.01zM3 6.1v11.19l7.45-.01-.07 1.8 2.75-1.8 7.87.01V4.92L3 6.1z" })));
5
+ }
6
+ export default Svg755;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ function SvgAbemakun(props) {
3
+ return (React.createElement("svg", Object.assign({ width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "currentColor", role: "img" }, props),
4
+ React.createElement("path", { d: "M19.24 16.91c-.18-.45-.52-.65-1.14-1.06-.47-.3-.79-.72-.85-1.55-.07-1.08.16-1.76.11-3.31-.04-1.2-.47-2.1-.74-2.63-.32-.62-.37-1.06-.4-1.78-.02-.66.01-2.12 0-2.58-.02-.46-.2-.76-.52-.9-.38-.18-.79-.12-1.13.25-.31.34-.88.95-1.28 1.31-.51.47-.84.57-1.29.57-.45 0-.78-.1-1.29-.57-.4-.36-.97-.97-1.28-1.31-.34-.37-.75-.43-1.13-.25-.32.14-.5.44-.52.9-.01.46.02 1.92 0 2.57-.02.72-.08 1.16-.4 1.79-.27.53-.7 1.43-.74 2.63-.06 1.55.18 2.23.11 3.31-.06.83-.38 1.25-.85 1.55-.62.4-.96.61-1.14 1.06-.13.31-.13.77.25.96.24.12.54.1.84-.02.24-.09.47-.24.7-.22.18.01.32.1.35.4.03.3.17.43.39.43.18 0 .35-.12.47-.45.14-.35.2-.66.42-.66.23.01.28.25.3.59.02.49-.17.88-.53 1.21-.42.39-.74.76-.62 1.24.08.34.45.56 1.05.59.59.03 1.57.04 2.25.02.63-.02 1-.29 1.08-.65.09-.41-.15-.56-.09-.9.03-.19.21-.27.4-.27.19 0 .37.08.4.27.06.34-.18.49-.09.9.08.36.44.64 1.08.65.68.02 1.66.01 2.25-.02.59-.03.96-.25 1.04-.59.11-.48-.2-.85-.62-1.24-.37-.34-.56-.72-.53-1.21.02-.34.07-.59.3-.59.21-.01.28.31.42.66.13.33.3.45.47.45.22 0 .36-.13.39-.43.03-.29.17-.39.35-.4.23-.01.46.13.7.22.31.12.6.15.84.02.35-.2.35-.65.22-.96zM14.76 8.3a.49.49 0 11-.49.49c-.01-.27.21-.49.49-.49zm-5.52 0a.49.49 0 11-.002.981.49.49 0 01.002-.981zM12 18.51a2.279 2.279 0 110-4.56 2.279 2.279 0 110 4.56zm3.26-6.24c-.21.35-.62.64-1.1.68-.64.06-1.03-.17-1.29-.45-.24-.27-.5-.52-.87-.52s-.63.25-.87.52c-.25.28-.65.51-1.29.45-.48-.04-.89-.32-1.1-.68-.42-.7-.06-1.63.49-2.09.79-.68 1.62-.94 2.77-.94s1.97.26 2.77.94c.55.47.9 1.39.49 2.09zm-2.12-1.91c0 .49-.5.87-1.14.87-.64 0-1.14-.38-1.14-.87s.5-.87 1.14-.87c.64 0 1.14.38 1.14.87z" })));
5
+ }
6
+ export default SvgAbemakun;