@jongh/ui 1.6.5 → 2.20260902.1

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 (316) hide show
  1. package/dist/base.css +1103 -0
  2. package/dist/blue.css +155 -0
  3. package/dist/chunks/component-accordion-CNhK3gho.js +27 -0
  4. package/dist/chunks/component-avatar-C5ox3FhU.js +15 -0
  5. package/dist/chunks/component-badge-GyL8C7n9.js +23 -0
  6. package/dist/chunks/component-box-BnXf833v.js +26 -0
  7. package/dist/chunks/component-button-cnnLKCl_.js +21 -0
  8. package/dist/chunks/component-calendar-D53mkOdW.js +240 -0
  9. package/dist/chunks/component-center-BIp6NkIt.js +32 -0
  10. package/dist/chunks/component-checkbox-cJlGSnlk.js +54 -0
  11. package/dist/chunks/component-dialog-yBIkthjw.js +35 -0
  12. package/dist/chunks/component-grid-BKLFatKL.js +38 -0
  13. package/dist/chunks/component-h-stack-ODw00BMb.js +36 -0
  14. package/dist/chunks/component-select-CHwGLpGT.js +52 -0
  15. package/dist/chunks/component-slider-Ba5H5eY3.js +16 -0
  16. package/dist/chunks/component-tabs-BIWU8zcA.js +58 -0
  17. package/dist/chunks/component-textfield-CCdnfRzb.js +53 -0
  18. package/dist/chunks/component-v-stack-_k842HHc.js +36 -0
  19. package/dist/chunks/recipe-accordion-recipe-DPDnNF9J.js +27 -0
  20. package/dist/chunks/recipe-avatar-recipe-HkwMS2OJ.js +24 -0
  21. package/dist/chunks/recipe-badge-recipe-DWojym5V.js +136 -0
  22. package/dist/chunks/recipe-button-recipe-BA1JNmBF.js +36 -0
  23. package/dist/chunks/recipe-calendar-recipe-CUjveeyt.js +31 -0
  24. package/dist/chunks/recipe-center-recipe-CBm4FTPj.js +24 -0
  25. package/dist/chunks/recipe-checkbox-recipe-CCDU79zw.js +31 -0
  26. package/dist/chunks/recipe-dialog-recipe-Dp_2WfN_.js +31 -0
  27. package/dist/chunks/recipe-layout-recipe-CXAjEcDn.js +20 -0
  28. package/dist/chunks/recipe-select-recipe-Chdpfb_N.js +33 -0
  29. package/dist/chunks/recipe-slider-recipe-Bn_q7Je8.js +25 -0
  30. package/dist/chunks/recipe-tabs-recipe-Bo5qcI1u.js +26 -0
  31. package/dist/chunks/recipe-textfield-recipe-szIwdV6q.js +27 -0
  32. package/dist/chunks/rolldown-runtime-CKyOoeiN.js +12 -0
  33. package/dist/index.d.ts +21694 -0
  34. package/dist/index.js +583 -0
  35. package/dist/purple.css +155 -0
  36. package/dist/recipes/accordion-recipe.css +118 -0
  37. package/dist/recipes/avatar-recipe.css +44 -0
  38. package/dist/recipes/badge-recipe.css +47 -0
  39. package/dist/recipes/button-recipe.css +153 -0
  40. package/dist/recipes/calendar-recipe.css +145 -0
  41. package/dist/recipes/center-recipe.css +13 -0
  42. package/dist/recipes/checkbox-recipe.css +156 -0
  43. package/dist/recipes/dialog-recipe.css +101 -0
  44. package/dist/recipes/layout-recipe.css +427 -0
  45. package/dist/recipes/select-recipe.css +175 -0
  46. package/dist/recipes/slider-recipe.css +60 -0
  47. package/dist/recipes/tabs-recipe.css +76 -0
  48. package/dist/recipes/textfield-recipe.css +95 -0
  49. package/dist/style.css +1 -0
  50. package/package.json +62 -37
  51. package/.storybook/index.css +0 -1
  52. package/.storybook/main.ts +0 -40
  53. package/.storybook/preview.ts +0 -16
  54. package/.storybook/vitest.setup.ts +0 -9
  55. package/.turbo/turbo-build.log +0 -79
  56. package/CHANGELOG.md +0 -54
  57. package/chromatic.config.json +0 -6
  58. package/eslint.config.mjs +0 -14
  59. package/index.html +0 -13
  60. package/panda.config.ts +0 -13
  61. package/postcss.config.cjs +0 -3
  62. package/preset.ts +0 -134
  63. package/src/component/accordion/ui/index.tsx +0 -80
  64. package/src/component/accordion/ui/recipe.ts +0 -65
  65. package/src/component/avatar/ui/index.tsx +0 -47
  66. package/src/component/avatar/ui/recipe.ts +0 -30
  67. package/src/component/button/ui/index.tsx +0 -29
  68. package/src/component/button/ui/recipe.ts +0 -102
  69. package/src/component/chip/ui/index.tsx +0 -30
  70. package/src/component/chip/ui/recipe.ts +0 -112
  71. package/src/component/dialog/ui/index.tsx +0 -73
  72. package/src/component/dialog/ui/recipe.ts +0 -92
  73. package/src/component/select/ui/index.tsx +0 -128
  74. package/src/component/select/ui/recipe.ts +0 -142
  75. package/src/component/slider/ui/index.tsx +0 -61
  76. package/src/component/slider/ui/recipe.ts +0 -52
  77. package/src/component/tabs/ui/index.tsx +0 -61
  78. package/src/component/tabs/ui/recipe.ts +0 -59
  79. package/src/hooks/createContext.tsx +0 -34
  80. package/src/hooks/useComposedRefs.ts +0 -20
  81. package/src/hooks/useControllableState.ts +0 -87
  82. package/src/hooks/useKeyboardEvent.ts +0 -58
  83. package/src/stories/accordion.stories.tsx +0 -63
  84. package/src/stories/avatar.stories.tsx +0 -33
  85. package/src/stories/button.stories.tsx +0 -53
  86. package/src/stories/chip.stories.tsx +0 -69
  87. package/src/stories/dialog.stories.tsx +0 -134
  88. package/src/stories/select.stories.tsx +0 -35
  89. package/src/stories/slider.stories.tsx +0 -31
  90. package/src/stories/tabs.stories.tsx +0 -63
  91. package/src/test/accordion.test.tsx +0 -66
  92. package/src/test/tabs.test.tsx +0 -30
  93. package/src/types/index.ts +0 -1
  94. package/src/utils/createStyleContext.tsx +0 -108
  95. package/src/utils/defineSafe.ts +0 -46
  96. package/src/utils/getObjectKeys.ts +0 -20
  97. package/src/vite-env.d.ts +0 -1
  98. package/storybook-static/assets/Color-F6OSRLHC-CrKta8Qx.js +0 -1
  99. package/storybook-static/assets/DocsRenderer-CFRXHY34-Crd9Mepd.js +0 -586
  100. package/storybook-static/assets/_commonjsHelpers-Cpj98o6Y.js +0 -1
  101. package/storybook-static/assets/accordion.stories-0Om0AnMm.js +0 -50
  102. package/storybook-static/assets/avatar.stories-DMDsrSks.js +0 -16
  103. package/storybook-static/assets/axe-Dzet_oDA.js +0 -30
  104. package/storybook-static/assets/button.stories-CuVC-3x-.js +0 -40
  105. package/storybook-static/assets/chip.stories-FBIp8XNi.js +0 -48
  106. package/storybook-static/assets/chunk-XP5HYGXS-D5tuasO7.js +0 -1
  107. package/storybook-static/assets/createLucideIcon-DmXe7Z8R.js +0 -21
  108. package/storybook-static/assets/dialog.stories-3WsEvXt4.js +0 -106
  109. package/storybook-static/assets/entry-preview-Bkgdgq1b.js +0 -10
  110. package/storybook-static/assets/entry-preview-docs-zLz1Es7d.js +0 -46
  111. package/storybook-static/assets/iframe-LPPPXabV.js +0 -199
  112. package/storybook-static/assets/index-Bklpsb39.js +0 -1
  113. package/storybook-static/assets/index-BrlJLjep.js +0 -24
  114. package/storybook-static/assets/index-C2tRLqin.js +0 -41
  115. package/storybook-static/assets/index-CBft-ReK.js +0 -8
  116. package/storybook-static/assets/index-CSbWd7UJ.js +0 -1
  117. package/storybook-static/assets/index-ClcD9ViR.js +0 -9
  118. package/storybook-static/assets/index-Cu4lwwaE.js +0 -1
  119. package/storybook-static/assets/index-Cvkemp2J.js +0 -1
  120. package/storybook-static/assets/index-D59aU5s_.js +0 -240
  121. package/storybook-static/assets/index-DNo8LKN3.js +0 -1
  122. package/storybook-static/assets/index-DUy19JZU.js +0 -1
  123. package/storybook-static/assets/index-D_35mznO.js +0 -1
  124. package/storybook-static/assets/index-DrFu-skq.js +0 -6
  125. package/storybook-static/assets/index-DvbTp2M2.js +0 -1
  126. package/storybook-static/assets/index-rtmQni2k.js +0 -1
  127. package/storybook-static/assets/jsx-runtime-BYYWji4R.js +0 -9
  128. package/storybook-static/assets/matchers-57EZJSQE-oeXCqs4p.js +0 -14
  129. package/storybook-static/assets/preview-1l6V4UsQ.js +0 -1
  130. package/storybook-static/assets/preview-B3PTUHS7.js +0 -1
  131. package/storybook-static/assets/preview-BBWR9nbA.js +0 -1
  132. package/storybook-static/assets/preview-BCV5r-Ja.js +0 -1
  133. package/storybook-static/assets/preview-BWzBA1C2.js +0 -396
  134. package/storybook-static/assets/preview-Bb56VplF.js +0 -2
  135. package/storybook-static/assets/preview-Bl8rsKRy.js +0 -1
  136. package/storybook-static/assets/preview-Bm-a94Ct.js +0 -2
  137. package/storybook-static/assets/preview-Br-h4d84.js +0 -1
  138. package/storybook-static/assets/preview-D77C14du.js +0 -34
  139. package/storybook-static/assets/preview-DC8N7cZb.css +0 -1
  140. package/storybook-static/assets/preview-DGUiP6tS.js +0 -7
  141. package/storybook-static/assets/react-18-BPs3tMGP.js +0 -1
  142. package/storybook-static/assets/select.stories-AN8Hb81Z.js +0 -20
  143. package/storybook-static/assets/slider.stories-CxOczq0y.js +0 -12
  144. package/storybook-static/assets/tabs.stories-BbTU4QU3.js +0 -28
  145. package/storybook-static/favicon.svg +0 -1
  146. package/storybook-static/iframe.html +0 -666
  147. package/storybook-static/index.html +0 -193
  148. package/storybook-static/index.json +0 -1
  149. package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
  150. package/storybook-static/nunito-sans-bold.woff2 +0 -0
  151. package/storybook-static/nunito-sans-italic.woff2 +0 -0
  152. package/storybook-static/nunito-sans-regular.woff2 +0 -0
  153. package/storybook-static/project.json +0 -1
  154. package/storybook-static/sb-addons/a11y-12/manager-bundle.js +0 -3
  155. package/storybook-static/sb-addons/a11y-12/manager-bundle.js.LEGAL.txt +0 -0
  156. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +0 -331
  157. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +0 -51
  158. package/storybook-static/sb-addons/controls-11/manager-bundle.js +0 -391
  159. package/storybook-static/sb-addons/controls-11/manager-bundle.js.LEGAL.txt +0 -0
  160. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
  161. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
  162. package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js +0 -12
  163. package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js.LEGAL.txt +0 -0
  164. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -391
  165. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -0
  166. package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js +0 -230
  167. package/storybook-static/sb-addons/essentials-docs-4/manager-bundle.js.LEGAL.txt +0 -0
  168. package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js +0 -3
  169. package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js.LEGAL.txt +0 -0
  170. package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js +0 -3
  171. package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js.LEGAL.txt +0 -0
  172. package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js +0 -3
  173. package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js.LEGAL.txt +0 -0
  174. package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js +0 -3
  175. package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js.LEGAL.txt +0 -0
  176. package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
  177. package/storybook-static/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
  178. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
  179. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  180. package/storybook-static/sb-addons/storybook-experimental-addon-test-13/manager-bundle.js +0 -211
  181. package/storybook-static/sb-addons/storybook-experimental-addon-test-13/manager-bundle.js.LEGAL.txt +0 -0
  182. package/storybook-static/sb-common-assets/favicon.svg +0 -1
  183. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  184. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  185. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  186. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  187. package/storybook-static/sb-manager/globals-module-info.js +0 -1037
  188. package/storybook-static/sb-manager/globals-runtime.js +0 -40857
  189. package/storybook-static/sb-manager/globals.js +0 -48
  190. package/storybook-static/sb-manager/runtime.js +0 -11963
  191. package/styled-system/css/conditions.mjs +0 -36
  192. package/styled-system/css/css.d.ts +0 -22
  193. package/styled-system/css/css.mjs +0 -45
  194. package/styled-system/css/cva.d.ts +0 -6
  195. package/styled-system/css/cva.mjs +0 -87
  196. package/styled-system/css/cx.d.ts +0 -5
  197. package/styled-system/css/cx.mjs +0 -15
  198. package/styled-system/css/index.d.ts +0 -5
  199. package/styled-system/css/index.mjs +0 -4
  200. package/styled-system/css/sva.d.ts +0 -4
  201. package/styled-system/css/sva.mjs +0 -41
  202. package/styled-system/helpers.mjs +0 -336
  203. package/styled-system/jsx/aspect-ratio.d.ts +0 -10
  204. package/styled-system/jsx/aspect-ratio.mjs +0 -14
  205. package/styled-system/jsx/bleed.d.ts +0 -10
  206. package/styled-system/jsx/bleed.mjs +0 -14
  207. package/styled-system/jsx/box.d.ts +0 -10
  208. package/styled-system/jsx/box.mjs +0 -14
  209. package/styled-system/jsx/center.d.ts +0 -10
  210. package/styled-system/jsx/center.mjs +0 -14
  211. package/styled-system/jsx/circle.d.ts +0 -10
  212. package/styled-system/jsx/circle.mjs +0 -14
  213. package/styled-system/jsx/container.d.ts +0 -10
  214. package/styled-system/jsx/container.mjs +0 -14
  215. package/styled-system/jsx/cq.d.ts +0 -10
  216. package/styled-system/jsx/cq.mjs +0 -14
  217. package/styled-system/jsx/divider.d.ts +0 -10
  218. package/styled-system/jsx/divider.mjs +0 -14
  219. package/styled-system/jsx/factory-helper.mjs +0 -22
  220. package/styled-system/jsx/factory.d.ts +0 -3
  221. package/styled-system/jsx/factory.mjs +0 -80
  222. package/styled-system/jsx/flex.d.ts +0 -10
  223. package/styled-system/jsx/flex.mjs +0 -14
  224. package/styled-system/jsx/float.d.ts +0 -10
  225. package/styled-system/jsx/float.mjs +0 -14
  226. package/styled-system/jsx/grid-item.d.ts +0 -10
  227. package/styled-system/jsx/grid-item.mjs +0 -14
  228. package/styled-system/jsx/grid.d.ts +0 -10
  229. package/styled-system/jsx/grid.mjs +0 -14
  230. package/styled-system/jsx/hstack.d.ts +0 -10
  231. package/styled-system/jsx/hstack.mjs +0 -14
  232. package/styled-system/jsx/index.d.ts +0 -24
  233. package/styled-system/jsx/index.mjs +0 -22
  234. package/styled-system/jsx/is-valid-prop.d.ts +0 -11
  235. package/styled-system/jsx/is-valid-prop.mjs +0 -17
  236. package/styled-system/jsx/link-overlay.d.ts +0 -10
  237. package/styled-system/jsx/link-overlay.mjs +0 -14
  238. package/styled-system/jsx/spacer.d.ts +0 -10
  239. package/styled-system/jsx/spacer.mjs +0 -14
  240. package/styled-system/jsx/square.d.ts +0 -10
  241. package/styled-system/jsx/square.mjs +0 -14
  242. package/styled-system/jsx/stack.d.ts +0 -10
  243. package/styled-system/jsx/stack.mjs +0 -14
  244. package/styled-system/jsx/visually-hidden.d.ts +0 -10
  245. package/styled-system/jsx/visually-hidden.mjs +0 -14
  246. package/styled-system/jsx/vstack.d.ts +0 -10
  247. package/styled-system/jsx/vstack.mjs +0 -14
  248. package/styled-system/jsx/wrap.d.ts +0 -10
  249. package/styled-system/jsx/wrap.mjs +0 -14
  250. package/styled-system/patterns/aspect-ratio.d.ts +0 -21
  251. package/styled-system/patterns/aspect-ratio.mjs +0 -38
  252. package/styled-system/patterns/bleed.d.ts +0 -22
  253. package/styled-system/patterns/bleed.mjs +0 -24
  254. package/styled-system/patterns/box.d.ts +0 -21
  255. package/styled-system/patterns/box.mjs +0 -15
  256. package/styled-system/patterns/center.d.ts +0 -21
  257. package/styled-system/patterns/center.mjs +0 -21
  258. package/styled-system/patterns/circle.d.ts +0 -21
  259. package/styled-system/patterns/circle.mjs +0 -25
  260. package/styled-system/patterns/container.d.ts +0 -21
  261. package/styled-system/patterns/container.mjs +0 -21
  262. package/styled-system/patterns/cq.d.ts +0 -22
  263. package/styled-system/patterns/cq.mjs +0 -21
  264. package/styled-system/patterns/divider.d.ts +0 -23
  265. package/styled-system/patterns/divider.mjs +0 -25
  266. package/styled-system/patterns/flex.d.ts +0 -27
  267. package/styled-system/patterns/flex.mjs +0 -26
  268. package/styled-system/patterns/float.d.ts +0 -24
  269. package/styled-system/patterns/float.mjs +0 -52
  270. package/styled-system/patterns/grid-item.d.ts +0 -26
  271. package/styled-system/patterns/grid-item.mjs +0 -25
  272. package/styled-system/patterns/grid.d.ts +0 -25
  273. package/styled-system/patterns/grid.mjs +0 -27
  274. package/styled-system/patterns/hstack.d.ts +0 -22
  275. package/styled-system/patterns/hstack.mjs +0 -24
  276. package/styled-system/patterns/index.d.ts +0 -21
  277. package/styled-system/patterns/index.mjs +0 -20
  278. package/styled-system/patterns/link-overlay.d.ts +0 -21
  279. package/styled-system/patterns/link-overlay.mjs +0 -24
  280. package/styled-system/patterns/spacer.d.ts +0 -21
  281. package/styled-system/patterns/spacer.mjs +0 -21
  282. package/styled-system/patterns/square.d.ts +0 -21
  283. package/styled-system/patterns/square.mjs +0 -24
  284. package/styled-system/patterns/stack.d.ts +0 -24
  285. package/styled-system/patterns/stack.mjs +0 -24
  286. package/styled-system/patterns/visually-hidden.d.ts +0 -21
  287. package/styled-system/patterns/visually-hidden.mjs +0 -18
  288. package/styled-system/patterns/vstack.d.ts +0 -22
  289. package/styled-system/patterns/vstack.mjs +0 -24
  290. package/styled-system/patterns/wrap.d.ts +0 -25
  291. package/styled-system/patterns/wrap.mjs +0 -25
  292. package/styled-system/tokens/index.d.ts +0 -9
  293. package/styled-system/tokens/index.mjs +0 -1992
  294. package/styled-system/tokens/tokens.d.ts +0 -60
  295. package/styled-system/types/composition.d.ts +0 -164
  296. package/styled-system/types/conditions.d.ts +0 -274
  297. package/styled-system/types/csstype.d.ts +0 -21298
  298. package/styled-system/types/global.d.ts +0 -20
  299. package/styled-system/types/index.d.ts +0 -8
  300. package/styled-system/types/jsx.d.ts +0 -52
  301. package/styled-system/types/parts.d.ts +0 -8
  302. package/styled-system/types/pattern.d.ts +0 -78
  303. package/styled-system/types/prop-type.d.ts +0 -235
  304. package/styled-system/types/recipe.d.ts +0 -181
  305. package/styled-system/types/selectors.d.ts +0 -59
  306. package/styled-system/types/static-css.d.ts +0 -56
  307. package/styled-system/types/style-props.d.ts +0 -7468
  308. package/styled-system/types/system-types.d.ts +0 -109
  309. package/tsconfig.json +0 -13
  310. package/turbo/generators/config.cjs +0 -7
  311. package/turbo/generators/stories.cjs +0 -23
  312. package/turbo/generators/templates/stories.tsx.hbs +0 -16
  313. package/turbo/generators/templates/ui.tsx.hbs +0 -8
  314. package/turbo/generators/ui.cjs +0 -19
  315. package/vite.config.ts +0 -7
  316. package/vitest.config.ts +0 -45
@@ -1,61 +0,0 @@
1
- import { css, cx } from "@styled-system/css"
2
- import { Tabs as TabsPrimitive } from "radix-ui"
3
- import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react"
4
-
5
- import { recipe } from "./recipe"
6
-
7
- export const Root = forwardRef<
8
- ElementRef<typeof TabsPrimitive.Root>,
9
- ComponentPropsWithoutRef<typeof TabsPrimitive.Root>
10
- >(({ className, ...props }, ref) => {
11
- const styles = recipe.raw()
12
- return (
13
- <TabsPrimitive.Root
14
- ref={ref}
15
- className={cx(css(styles.root), className)}
16
- {...props}
17
- />
18
- )
19
- })
20
-
21
- export const List = forwardRef<
22
- ElementRef<typeof TabsPrimitive.List>,
23
- ComponentPropsWithoutRef<typeof TabsPrimitive.List>
24
- >(({ className, ...props }, ref) => {
25
- const styles = recipe.raw()
26
- return (
27
- <TabsPrimitive.List
28
- ref={ref}
29
- className={cx(css(styles.list), className)}
30
- {...props}
31
- />
32
- )
33
- })
34
-
35
- export const Trigger = forwardRef<
36
- ElementRef<typeof TabsPrimitive.Trigger>,
37
- ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
38
- >(({ className, ...props }, ref) => {
39
- const styles = recipe.raw()
40
- return (
41
- <TabsPrimitive.Trigger
42
- ref={ref}
43
- className={cx(css(styles.trigger), className)}
44
- {...props}
45
- />
46
- )
47
- })
48
-
49
- export const Content = forwardRef<
50
- ElementRef<typeof TabsPrimitive.Content>,
51
- ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
52
- >(({ className, ...props }, ref) => {
53
- const styles = recipe.raw()
54
- return (
55
- <TabsPrimitive.Content
56
- ref={ref}
57
- className={cx(css(styles.content), className)}
58
- {...props}
59
- />
60
- )
61
- })
@@ -1,59 +0,0 @@
1
- import { sva } from "@styled-system/css"
2
-
3
- export const recipe = sva({
4
- slots: ["root", "list", "trigger", "content"],
5
- base: {
6
- list: {
7
- display: "inline-flex",
8
- h: "10",
9
- alignItems: "center",
10
- justifyContent: "center",
11
- rounded: "md",
12
- bg: "muted",
13
- p: "1",
14
- color: "muted.foreground",
15
- },
16
- trigger: {
17
- display: "inline-flex",
18
- alignItems: "center",
19
- justifyContent: "center",
20
- whiteSpace: "nowrap",
21
- rounded: "sm",
22
- px: "3",
23
- py: "1.5",
24
- textStyle: "sm",
25
- fontWeight: "medium",
26
- transition: "all",
27
- cursor: "pointer",
28
- ringColor: "background",
29
-
30
- _focusVisible: {
31
- ringWidth: "1",
32
- ringColor: "ring",
33
- ringOffset: "1",
34
- },
35
-
36
- _disabled: {
37
- pointerEvents: "none",
38
- opacity: "50%",
39
- },
40
-
41
- "&:is([data-state=active])": {
42
- bg: "background",
43
- color: "foreground",
44
- shadow: "sm",
45
- },
46
- },
47
- content: {
48
- mt: "2",
49
- ringColor: "background",
50
-
51
- _focusVisible: {
52
- outlineWidth: "2",
53
- outlineOffset: "2",
54
- ringWidth: "2",
55
- ringColor: "ring",
56
- },
57
- },
58
- },
59
- })
@@ -1,34 +0,0 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
- import * as React from "react"
3
-
4
- export function createContext<ContextValueType extends object | null>(
5
- rootComponentName: string,
6
- defaultContext?: ContextValueType,
7
- ) {
8
- const C = React.createContext<ContextValueType | undefined>(defaultContext) //context 생성
9
- const Provider = (
10
- props: ContextValueType & { children: React.ReactNode },
11
- ) => {
12
- const { children, ...context } = props
13
- // Only re-memoize when prop values change
14
- const value = React.useMemo(
15
- () => context,
16
- Object.values(context),
17
- ) as ContextValueType
18
-
19
- return <C.Provider value={value}>{children}</C.Provider>
20
- }
21
-
22
- function useContext(consumerName?: string) {
23
- const context = React.useContext(C)
24
- if (context) return context
25
- if (defaultContext !== undefined) return defaultContext
26
- // if a defaultContext wasn't specified, it's a required context.
27
- throw new Error(
28
- `\`${consumerName}\` must be used within \`${rootComponentName}\``,
29
- )
30
- }
31
-
32
- Provider.displayName = rootComponentName + "Provider"
33
- return [Provider, useContext] as const
34
- }
@@ -1,20 +0,0 @@
1
- import { useCallback } from "react"
2
-
3
- type PossibleRef<T> = React.Ref<T> | undefined
4
-
5
- function setRef<T>(ref: PossibleRef<T>, value: T) {
6
- if (typeof ref === "function") {
7
- ref(value)
8
- } else if (ref !== null && ref !== undefined) {
9
- ;(ref as React.MutableRefObject<T>).current = value
10
- }
11
- }
12
-
13
- export function composeRefs<T>(...refs: Array<PossibleRef<T>>) {
14
- return (node: T) => refs.forEach((ref) => setRef(ref, node))
15
- }
16
-
17
- export function useComposedRefs<T>(...refs: Array<PossibleRef<T>>) {
18
- // eslint-disable-next-line react-hooks/exhaustive-deps
19
- return useCallback(composeRefs(...refs), refs)
20
- }
@@ -1,87 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import {
3
- Dispatch,
4
- SetStateAction,
5
- useCallback,
6
- useEffect,
7
- useMemo,
8
- useRef,
9
- useState,
10
- } from "react"
11
-
12
- export const useCallbackRef = <T extends (...args: any[]) => any>(
13
- callback?: T,
14
- ) => {
15
- const callbackRef = useRef(callback)
16
-
17
- useEffect(() => {
18
- callbackRef.current = callback
19
- })
20
-
21
- return useMemo(
22
- () =>
23
- (...args: any[]) =>
24
- callbackRef.current?.(...args),
25
- [],
26
- )
27
- }
28
- //그냥 useState인데, onChange 이벤트를 할수있게 해준 hook
29
- export const useUncontrolledState = <T>({
30
- defaultValue,
31
- onChange,
32
- }: {
33
- defaultValue?: T | undefined
34
- onChange?: (params: T) => void
35
- }) => {
36
- const unControlledState = useState(defaultValue)
37
- const [value] = unControlledState
38
- const handleChange = useCallbackRef(onChange)
39
- const ref = useRef(value)
40
- useEffect(() => {
41
- if (ref.current !== value) {
42
- handleChange(value)
43
- ref.current = value
44
- }
45
- }, [value, ref, handleChange])
46
-
47
- return unControlledState
48
- }
49
-
50
- type SetStateFn<T> = (prev: T) => void
51
-
52
- type UseControllableState<T> = {
53
- prop?: T | undefined
54
- defaultProp?: T | undefined
55
- onChange?: (state: T) => void
56
- }
57
-
58
- export const useControlledState = <T>({
59
- prop,
60
- defaultProp,
61
- onChange,
62
- }: UseControllableState<T>) => {
63
- const isControlled = prop !== undefined
64
- const [unControlledProp, setUncontrolledProp] = useUncontrolledState({
65
- defaultValue: defaultProp,
66
- onChange,
67
- })
68
-
69
- const value = isControlled ? prop : unControlledProp
70
- const handleChange = useCallbackRef(onChange)
71
- const setValue: Dispatch<SetStateAction<T | undefined>> = useCallback(
72
- (nextValue) => {
73
- if (isControlled) {
74
- const setter = nextValue as SetStateFn<T>
75
- const value = typeof nextValue === "function" ? setter(prop) : nextValue
76
- if (value !== prop) {
77
- handleChange?.(value as T)
78
- }
79
- } else {
80
- setUncontrolledProp(nextValue)
81
- }
82
- },
83
- [isControlled, prop, setUncontrolledProp, handleChange],
84
- )
85
-
86
- return [value, setValue] as const
87
- }
@@ -1,58 +0,0 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
- import { KeyboardEvent, useCallback, useRef } from "react"
3
-
4
- type UseKeybaordEvent = {
5
- keyList: string[]
6
- changeIndex?: (index: number) => void
7
- }
8
-
9
- export const useKeyboardEvent = ({
10
- keyList,
11
- changeIndex,
12
- }: UseKeybaordEvent) => {
13
- const refs = useRef<HTMLElement[]>([])
14
-
15
- const handleKeyDown = useCallback(
16
- (event: KeyboardEvent<HTMLElement>, callback?: () => void) => {
17
- if (!keyList.includes(event.key)) return
18
- const length = refs.current.length
19
- const target = event.target as HTMLElement
20
- const currentIndex = refs.current.indexOf(target)
21
- event.preventDefault()
22
-
23
- let nextIndex = 0
24
- switch (event.key) {
25
- case "ArrowDown":
26
- nextIndex = (currentIndex + 1) % length
27
- break
28
- case "ArrowUp":
29
- nextIndex = (currentIndex - 1 + length) % length
30
- break
31
- case "ArrowRight":
32
- nextIndex = (currentIndex + 1) % length
33
- break
34
- case "ArrowLeft":
35
- nextIndex = (currentIndex - 1 + length) % length
36
- break
37
- case "Home":
38
- nextIndex = 0
39
- break
40
- case "End":
41
- nextIndex = length - 1
42
- break
43
- case "Tab":
44
- nextIndex = (currentIndex + 1) % length
45
- break
46
- case "Enter":
47
- callback?.()
48
- }
49
- changeIndex?.(nextIndex)
50
- refs.current[nextIndex]?.focus()
51
- },
52
- [],
53
- )
54
-
55
- return { refs, handleKeyDown }
56
- }
57
-
58
- export default useKeyboardEvent
@@ -1,63 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
- import { expect, userEvent, waitFor } from "@storybook/test"
3
- import { css } from "@styled-system/css"
4
-
5
- import * as Accordion from "../component/accordion/ui"
6
- export default {
7
- title: "Accordion",
8
- tags: ["autodocs"],
9
- } satisfies Meta<typeof Accordion>
10
-
11
- type Story = StoryObj<typeof Accordion>
12
-
13
- export const Primary: Story = {
14
- render: () => {
15
- return (
16
- <div style={{ width: "500px" }}>
17
- <Accordion.Root type="single" collapsible>
18
- <Accordion.Item value="1">
19
- <Accordion.Header>
20
- <Accordion.Trigger
21
- className={css({
22
- color: "red.100",
23
- })}
24
- >
25
- 1번
26
- </Accordion.Trigger>
27
- </Accordion.Header>
28
- <Accordion.Content>
29
- <div>내용1</div>
30
- </Accordion.Content>
31
- </Accordion.Item>
32
- <Accordion.Item value="2">
33
- <Accordion.Header>
34
- <Accordion.Trigger>2번</Accordion.Trigger>
35
- </Accordion.Header>
36
- <Accordion.Content>
37
- <div>내용1</div>
38
- </Accordion.Content>
39
- </Accordion.Item>
40
- <Accordion.Item value="3">
41
- <Accordion.Header>
42
- <Accordion.Trigger>3번</Accordion.Trigger>
43
- </Accordion.Header>
44
- <Accordion.Content>내용3</Accordion.Content>
45
- </Accordion.Item>
46
- </Accordion.Root>
47
- </div>
48
- )
49
- },
50
- play: async ({ canvas }) => {
51
- const Item = canvas.getByText("1번")
52
- expect(Item).toBeInTheDocument()
53
- //토글로 내용이 열고 닫히는지 확인
54
- await userEvent.click(Item)
55
- await expect(canvas.getByText("내용1")).toBeInTheDocument()
56
-
57
- await userEvent.click(Item)
58
- await waitFor(async () => {
59
- const Content = canvas.queryByText("내용1")
60
- expect(Content).toBeNull()
61
- })
62
- },
63
- }
@@ -1,33 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
-
3
- import * as Avatar from "../component/avatar/ui"
4
-
5
- export default {
6
- title: "Avatar",
7
- tags: ["autodocs"],
8
- } satisfies Meta<typeof Avatar>
9
-
10
- type Story = StoryObj<typeof Avatar>
11
-
12
- export const Primary: Story = {
13
- args: {},
14
- render: () => {
15
- return (
16
- <Avatar.Root>
17
- <Avatar.Image src="https://encrypted-tbn3.gstatic.com/licensed-image?q=tbn:ANd9GcSDvLC5bOMlnrUBoojLDYnfS0S8G6kuUgQfcFq6d60TsnCmfNGimIc4pIgCmTHdnLaIgxGHBcdNeJ6FAoE" />
18
- </Avatar.Root>
19
- )
20
- },
21
- }
22
-
23
- export const Fallback: Story = {
24
- args: {},
25
- render: () => {
26
- return (
27
- <Avatar.Root>
28
- <Avatar.Image src="" />
29
- <Avatar.Fallback>JD</Avatar.Fallback>
30
- </Avatar.Root>
31
- )
32
- },
33
- }
@@ -1,53 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
- import { expect, fn, userEvent, within } from "@storybook/test"
3
- import type { ComponentProps } from "react"
4
-
5
- import { Button } from "../component/button/ui"
6
- export default {
7
- title: "Button",
8
- tags: ["autodocs"],
9
- component: Button,
10
- } as Meta<typeof Button>
11
-
12
- type Story = StoryObj<ComponentProps<typeof Button>>
13
-
14
- export const Primary: Story = {
15
- args: {
16
- children: "click",
17
- onClick: fn(),
18
- },
19
- play: async ({ args, canvasElement }) => {
20
- const canvas = within(canvasElement)
21
- const button = canvas.getByRole("button")
22
- await userEvent.click(button)
23
- await expect(args.onClick).toHaveBeenCalled()
24
- },
25
- }
26
-
27
- export const Secondary: Story = {
28
- args: {
29
- children: "click",
30
- variant: "secondary",
31
- },
32
- }
33
-
34
- export const Ghost: Story = {
35
- args: {
36
- children: "click",
37
- variant: "outline",
38
- },
39
- }
40
-
41
- export const Disabled: Story = {
42
- args: {
43
- disabled: true,
44
- children: "disabled",
45
- onClick: fn(),
46
- },
47
- play: async ({ args, canvasElement }) => {
48
- const canvas = within(canvasElement)
49
- const button = canvas.getByRole("button")
50
- await userEvent.click(button)
51
- await expect(args.onClick).not.toHaveBeenCalled()
52
- },
53
- }
@@ -1,69 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
- import { expect, fn, userEvent } from "@storybook/test"
3
- import { PlusCircleIcon } from "lucide-react"
4
- import { ComponentProps } from "react"
5
-
6
- import { Chip } from "../component/chip/ui"
7
-
8
- export default {
9
- title: "Chip",
10
- tags: ["autodocs"],
11
- component: Chip,
12
- } as Meta<typeof Chip>
13
-
14
- type Story = StoryObj<ComponentProps<typeof Chip>>
15
-
16
- export const Primary: Story = {
17
- args: {
18
- children: <div>확인</div>,
19
- },
20
- }
21
-
22
- export const Outlined: Story = {
23
- args: {
24
- children: <div>확인</div>,
25
- variant: "outlined",
26
- },
27
- }
28
-
29
- export const IconOnly: Story = {
30
- args: {
31
- layout: "iconOnly",
32
- children: <PlusCircleIcon />,
33
- },
34
- }
35
-
36
- export const WithPrefixIcon: Story = {
37
- args: {
38
- children: (
39
- <>
40
- <PlusCircleIcon />
41
- ㅎㅇ
42
- </>
43
- ),
44
- },
45
- }
46
-
47
- export const WithSuffixIcon: Story = {
48
- args: {
49
- children: (
50
- <>
51
- ㅎㅇ
52
- <PlusCircleIcon />
53
- </>
54
- ),
55
- },
56
- }
57
-
58
- export const Disabled: Story = {
59
- args: {
60
- disabled: true,
61
- children: "disabled",
62
- onClick: fn(),
63
- },
64
- play: async ({ args, canvas }) => {
65
- const button = canvas.getByRole("button")
66
- await userEvent.click(button)
67
- await expect(args.onClick).not.toHaveBeenCalled()
68
- },
69
- }
@@ -1,134 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react"
2
- import {
3
- expect,
4
- screen,
5
- userEvent,
6
- waitForElementToBeRemoved,
7
- within,
8
- } from "@storybook/test"
9
- import { css } from "@styled-system/css"
10
-
11
- import * as Dialog from "../component/dialog/ui"
12
-
13
- const meta = {
14
- title: "Dialog",
15
- tags: ["autodocs"],
16
- } satisfies Meta<typeof Dialog>
17
-
18
- export default meta
19
-
20
- type Story = StoryObj<typeof meta>
21
-
22
- export const Primary: Story = {
23
- render: () => {
24
- return (
25
- <Dialog.Root>
26
- <Dialog.Trigger>Open</Dialog.Trigger>
27
- <Dialog.Content>
28
- <Dialog.Header>
29
- <Dialog.Title>Dialog</Dialog.Title>
30
- <Dialog.Description>
31
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
32
- venenatis feugiat eros aliquam convallis. Donec tincidunt eros sed
33
- ligula tincidunt, sit amet tristique purus pulvinar. Donec maximus
34
- nunc vitae vestibulum cursus. Phasellus laoreet, velit non mollis
35
- semper, nunc dui accumsan orci, consequat accumsan libero quam ac
36
- est. Pellentesque habitant morbi tristique senectus et netus et
37
- malesuada fames ac turpis egestas. Phasellus ac turpis neque.
38
- Class aptent taciti sociosqu ad litora torquent per conubia
39
- nostra, per inceptos himenaeos.
40
- </Dialog.Description>
41
- </Dialog.Header>
42
- </Dialog.Content>
43
- </Dialog.Root>
44
- )
45
- },
46
- play: async ({ canvasElement }) => {
47
- //canvasElement -> storybook의 #storybook-root
48
- //React portal API를 사용할 경우 다른곳에 렌더링
49
- //더 넓은 범위의 screen으로 테스트하는게 더 올바른 방법이라고 생각
50
- const canvas = within(canvasElement)
51
- const ButtonElement = canvas.getByRole("button")
52
- await userEvent.click(ButtonElement)
53
- const CloseElement = screen.getByText("Close")
54
- expect(CloseElement).not.toBeNull()
55
-
56
- await userEvent.click(CloseElement)
57
-
58
- waitForElementToBeRemoved(CloseElement).then(() =>
59
- expect(CloseElement).not.toBeInTheDocument(),
60
- )
61
- },
62
- }
63
-
64
- export const LongText: Story = {
65
- render: () => {
66
- return (
67
- <Dialog.Root>
68
- <Dialog.Trigger
69
- className={css({
70
- textStyle: "6xl",
71
- })}
72
- >
73
- Open
74
- </Dialog.Trigger>
75
- <Dialog.Content
76
- className={css({
77
- bg: "cyan.600",
78
- })}
79
- >
80
- <Dialog.Header>
81
- <Dialog.Title
82
- className={css({
83
- color: "red.100",
84
- })}
85
- >
86
- Dialog
87
- </Dialog.Title>
88
- <Dialog.Description
89
- className={css({
90
- fontSize: "sm",
91
- })}
92
- >
93
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
94
- venenatis feugiat eros aliquam convallis. Donec tincidunt eros sed
95
- ligula tincidunt, sit amet tristique purus pulvinar. Donec maximus
96
- nunc vitae vestibulum cursus. Phasellus laoreet, velit non mollis
97
- semper, nunc dui accumsan orci, consequat accumsan libero quam ac
98
- est. Pellentesque habitant morbi tristique senectus et netus et
99
- malesuada fames ac turpis egestas. Phasellus ac turpis neque.
100
- Class aptent taciti sociosqu ad litora torquent per conubia
101
- nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet,
102
- consectetur adipiscing elit. Integer venenatis feugiat eros
103
- aliquam convallis. Donec tincidunt eros sed ligula tincidunt, sit
104
- amet tristique purus pulvinar. Donec maximus nunc vitae vestibulum
105
- cursus. Phasellus laoreet, velit non mollis semper, nunc dui
106
- accumsan orci, consequat accumsan libero quam ac est. Pellentesque
107
- habitant morbi tristique senectus et netus et malesuada fames ac
108
- turpis egestas. Phasellus ac turpis neque. Class aptent taciti
109
- sociosqu ad litora torquent per conubia nostra, per inceptos
110
- himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing
111
- elit. Integer venenatis feugiat eros aliquam convallis. Donec
112
- tincidunt eros sed ligula tincidunt, sit amet tristique purus
113
- pulvinar. Donec maximus nunc vitae vestibulum cursus. Phasellus
114
- laoreet, velit non mollis semper, nunc dui accumsan orci,
115
- consequat accumsan libero quam ac est. Pellentesque habitant morbi
116
- tristique senectus et netus et malesuada fames ac turpis egestas.
117
- Phasellus ac turpis neque. Class aptent taciti sociosqu ad litora
118
- torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum
119
- dolor sit amet, consectetur adipiscing elit. Integer venenatis
120
- feugiat eros aliquam convallis. Donec tincidunt eros sed ligula
121
- tincidunt, sit amet tristique purus pulvinar. Donec maximus nunc
122
- vitae vestibulum cursus. Phasellus laoreet, velit non mollis
123
- semper, nunc dui accumsan orci, consequat accumsan libero quam ac
124
- est. Pellentesque habitant morbi tristique senectus et netus et
125
- malesuada fames ac turpis egestas. Phasellus ac turpis neque.
126
- Class aptent taciti sociosqu ad litora torquent per conubia
127
- nostra, per inceptos himenaeos.
128
- </Dialog.Description>
129
- </Dialog.Header>
130
- </Dialog.Content>
131
- </Dialog.Root>
132
- )
133
- },
134
- }