melta-app 0.1.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 (311) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -0
  3. package/THIRD_PARTY_LICENSES.md +198 -0
  4. package/lib/module/components/ActionSheet.js +87 -0
  5. package/lib/module/components/ActionSheet.js.map +1 -0
  6. package/lib/module/components/Alert.js +93 -0
  7. package/lib/module/components/Alert.js.map +1 -0
  8. package/lib/module/components/Avatar.js +93 -0
  9. package/lib/module/components/Avatar.js.map +1 -0
  10. package/lib/module/components/BottomSheet.js +69 -0
  11. package/lib/module/components/BottomSheet.js.map +1 -0
  12. package/lib/module/components/Card.js +93 -0
  13. package/lib/module/components/Card.js.map +1 -0
  14. package/lib/module/components/Checkbox.js +115 -0
  15. package/lib/module/components/Checkbox.js.map +1 -0
  16. package/lib/module/components/EmptyState.js +70 -0
  17. package/lib/module/components/EmptyState.js.map +1 -0
  18. package/lib/module/components/Header.js +53 -0
  19. package/lib/module/components/Header.js.map +1 -0
  20. package/lib/module/components/Image.js +67 -0
  21. package/lib/module/components/Image.js.map +1 -0
  22. package/lib/module/components/Modal.js +95 -0
  23. package/lib/module/components/Modal.js.map +1 -0
  24. package/lib/module/components/Progress.js +113 -0
  25. package/lib/module/components/Progress.js.map +1 -0
  26. package/lib/module/components/Radio.js +134 -0
  27. package/lib/module/components/Radio.js.map +1 -0
  28. package/lib/module/components/Screen.js +57 -0
  29. package/lib/module/components/Screen.js.map +1 -0
  30. package/lib/module/components/Skeleton.js +169 -0
  31. package/lib/module/components/Skeleton.js.map +1 -0
  32. package/lib/module/components/Surface.js +49 -0
  33. package/lib/module/components/Surface.js.map +1 -0
  34. package/lib/module/components/TextField.js +84 -0
  35. package/lib/module/components/TextField.js.map +1 -0
  36. package/lib/module/components/Toast.js +105 -0
  37. package/lib/module/components/Toast.js.map +1 -0
  38. package/lib/module/components/Toggle.js +77 -0
  39. package/lib/module/components/Toggle.js.map +1 -0
  40. package/lib/module/components/action-sheet.styles.js +70 -0
  41. package/lib/module/components/action-sheet.styles.js.map +1 -0
  42. package/lib/module/components/alert.styles.js +80 -0
  43. package/lib/module/components/alert.styles.js.map +1 -0
  44. package/lib/module/components/avatar.styles.js +94 -0
  45. package/lib/module/components/avatar.styles.js.map +1 -0
  46. package/lib/module/components/bottom-sheet.styles.js +55 -0
  47. package/lib/module/components/bottom-sheet.styles.js.map +1 -0
  48. package/lib/module/components/card.styles.js +50 -0
  49. package/lib/module/components/card.styles.js.map +1 -0
  50. package/lib/module/components/checkbox.styles.js +55 -0
  51. package/lib/module/components/checkbox.styles.js.map +1 -0
  52. package/lib/module/components/empty-state.styles.js +60 -0
  53. package/lib/module/components/empty-state.styles.js.map +1 -0
  54. package/lib/module/components/header.styles.js +33 -0
  55. package/lib/module/components/header.styles.js.map +1 -0
  56. package/lib/module/components/image.styles.js +37 -0
  57. package/lib/module/components/image.styles.js.map +1 -0
  58. package/lib/module/components/index.js +26 -0
  59. package/lib/module/components/index.js.map +1 -0
  60. package/lib/module/components/modal.styles.js +68 -0
  61. package/lib/module/components/modal.styles.js.map +1 -0
  62. package/lib/module/components/progress.styles.js +55 -0
  63. package/lib/module/components/progress.styles.js.map +1 -0
  64. package/lib/module/components/radio.styles.js +96 -0
  65. package/lib/module/components/radio.styles.js.map +1 -0
  66. package/lib/module/components/screen.styles.js +38 -0
  67. package/lib/module/components/screen.styles.js.map +1 -0
  68. package/lib/module/components/skeleton.styles.js +114 -0
  69. package/lib/module/components/skeleton.styles.js.map +1 -0
  70. package/lib/module/components/surface.styles.js +37 -0
  71. package/lib/module/components/surface.styles.js.map +1 -0
  72. package/lib/module/components/textfield.styles.js +121 -0
  73. package/lib/module/components/textfield.styles.js.map +1 -0
  74. package/lib/module/components/toast.styles.js +81 -0
  75. package/lib/module/components/toast.styles.js.map +1 -0
  76. package/lib/module/components/toggle.styles.js +69 -0
  77. package/lib/module/components/toggle.styles.js.map +1 -0
  78. package/lib/module/contracts/contract-types.js +192 -0
  79. package/lib/module/contracts/contract-types.js.map +1 -0
  80. package/lib/module/icons/Icon.js +57 -0
  81. package/lib/module/icons/Icon.js.map +1 -0
  82. package/lib/module/icons/glyphs.js +257 -0
  83. package/lib/module/icons/glyphs.js.map +1 -0
  84. package/lib/module/icons/icon.styles.js +28 -0
  85. package/lib/module/icons/icon.styles.js.map +1 -0
  86. package/lib/module/icons/index.js +14 -0
  87. package/lib/module/icons/index.js.map +1 -0
  88. package/lib/module/index.js +20 -0
  89. package/lib/module/index.js.map +1 -0
  90. package/lib/module/package.json +1 -0
  91. package/lib/module/primitives/Button.js +105 -0
  92. package/lib/module/primitives/Button.js.map +1 -0
  93. package/lib/module/primitives/Metric.js +68 -0
  94. package/lib/module/primitives/Metric.js.map +1 -0
  95. package/lib/module/primitives/Row.js +43 -0
  96. package/lib/module/primitives/Row.js.map +1 -0
  97. package/lib/module/primitives/Stack.js +39 -0
  98. package/lib/module/primitives/Stack.js.map +1 -0
  99. package/lib/module/primitives/Tag.js +160 -0
  100. package/lib/module/primitives/Tag.js.map +1 -0
  101. package/lib/module/primitives/Text.js +54 -0
  102. package/lib/module/primitives/Text.js.map +1 -0
  103. package/lib/module/primitives/_internal/focus-ring.js +57 -0
  104. package/lib/module/primitives/_internal/focus-ring.js.map +1 -0
  105. package/lib/module/primitives/button.styles.js +88 -0
  106. package/lib/module/primitives/button.styles.js.map +1 -0
  107. package/lib/module/primitives/index.js +11 -0
  108. package/lib/module/primitives/index.js.map +1 -0
  109. package/lib/module/primitives/metric.styles.js +54 -0
  110. package/lib/module/primitives/metric.styles.js.map +1 -0
  111. package/lib/module/primitives/row.styles.js +53 -0
  112. package/lib/module/primitives/row.styles.js.map +1 -0
  113. package/lib/module/primitives/stack.styles.js +37 -0
  114. package/lib/module/primitives/stack.styles.js.map +1 -0
  115. package/lib/module/primitives/tag.styles.js +56 -0
  116. package/lib/module/primitives/tag.styles.js.map +1 -0
  117. package/lib/module/primitives/text.styles.js +33 -0
  118. package/lib/module/primitives/text.styles.js.map +1 -0
  119. package/lib/module/theme/ThemeProvider.js +41 -0
  120. package/lib/module/theme/ThemeProvider.js.map +1 -0
  121. package/lib/module/theme/index.js +19 -0
  122. package/lib/module/theme/index.js.map +1 -0
  123. package/lib/module/theme/native-theme.js +201 -0
  124. package/lib/module/theme/native-theme.js.map +1 -0
  125. package/lib/module/theme/types.js +4 -0
  126. package/lib/module/theme/types.js.map +1 -0
  127. package/lib/typescript/package.json +1 -0
  128. package/lib/typescript/src/components/ActionSheet.d.ts +45 -0
  129. package/lib/typescript/src/components/ActionSheet.d.ts.map +1 -0
  130. package/lib/typescript/src/components/Alert.d.ts +43 -0
  131. package/lib/typescript/src/components/Alert.d.ts.map +1 -0
  132. package/lib/typescript/src/components/Avatar.d.ts +45 -0
  133. package/lib/typescript/src/components/Avatar.d.ts.map +1 -0
  134. package/lib/typescript/src/components/BottomSheet.d.ts +36 -0
  135. package/lib/typescript/src/components/BottomSheet.d.ts.map +1 -0
  136. package/lib/typescript/src/components/Card.d.ts +46 -0
  137. package/lib/typescript/src/components/Card.d.ts.map +1 -0
  138. package/lib/typescript/src/components/Checkbox.d.ts +40 -0
  139. package/lib/typescript/src/components/Checkbox.d.ts.map +1 -0
  140. package/lib/typescript/src/components/EmptyState.d.ts +36 -0
  141. package/lib/typescript/src/components/EmptyState.d.ts.map +1 -0
  142. package/lib/typescript/src/components/Header.d.ts +34 -0
  143. package/lib/typescript/src/components/Header.d.ts.map +1 -0
  144. package/lib/typescript/src/components/Image.d.ts +41 -0
  145. package/lib/typescript/src/components/Image.d.ts.map +1 -0
  146. package/lib/typescript/src/components/Modal.d.ts +46 -0
  147. package/lib/typescript/src/components/Modal.d.ts.map +1 -0
  148. package/lib/typescript/src/components/Progress.d.ts +39 -0
  149. package/lib/typescript/src/components/Progress.d.ts.map +1 -0
  150. package/lib/typescript/src/components/Radio.d.ts +52 -0
  151. package/lib/typescript/src/components/Radio.d.ts.map +1 -0
  152. package/lib/typescript/src/components/Screen.d.ts +42 -0
  153. package/lib/typescript/src/components/Screen.d.ts.map +1 -0
  154. package/lib/typescript/src/components/Skeleton.d.ts +37 -0
  155. package/lib/typescript/src/components/Skeleton.d.ts.map +1 -0
  156. package/lib/typescript/src/components/Surface.d.ts +31 -0
  157. package/lib/typescript/src/components/Surface.d.ts.map +1 -0
  158. package/lib/typescript/src/components/TextField.d.ts +45 -0
  159. package/lib/typescript/src/components/TextField.d.ts.map +1 -0
  160. package/lib/typescript/src/components/Toast.d.ts +45 -0
  161. package/lib/typescript/src/components/Toast.d.ts.map +1 -0
  162. package/lib/typescript/src/components/Toggle.d.ts +39 -0
  163. package/lib/typescript/src/components/Toggle.d.ts.map +1 -0
  164. package/lib/typescript/src/components/action-sheet.styles.d.ts +65 -0
  165. package/lib/typescript/src/components/action-sheet.styles.d.ts.map +1 -0
  166. package/lib/typescript/src/components/alert.styles.d.ts +61 -0
  167. package/lib/typescript/src/components/alert.styles.d.ts.map +1 -0
  168. package/lib/typescript/src/components/avatar.styles.d.ts +60 -0
  169. package/lib/typescript/src/components/avatar.styles.d.ts.map +1 -0
  170. package/lib/typescript/src/components/bottom-sheet.styles.d.ts +50 -0
  171. package/lib/typescript/src/components/bottom-sheet.styles.d.ts.map +1 -0
  172. package/lib/typescript/src/components/card.styles.d.ts +27 -0
  173. package/lib/typescript/src/components/card.styles.d.ts.map +1 -0
  174. package/lib/typescript/src/components/checkbox.styles.d.ts +55 -0
  175. package/lib/typescript/src/components/checkbox.styles.d.ts.map +1 -0
  176. package/lib/typescript/src/components/empty-state.styles.d.ts +58 -0
  177. package/lib/typescript/src/components/empty-state.styles.d.ts.map +1 -0
  178. package/lib/typescript/src/components/header.styles.d.ts +30 -0
  179. package/lib/typescript/src/components/header.styles.d.ts.map +1 -0
  180. package/lib/typescript/src/components/image.styles.d.ts +28 -0
  181. package/lib/typescript/src/components/image.styles.d.ts.map +1 -0
  182. package/lib/typescript/src/components/index.d.ts +23 -0
  183. package/lib/typescript/src/components/index.d.ts.map +1 -0
  184. package/lib/typescript/src/components/modal.styles.d.ts +66 -0
  185. package/lib/typescript/src/components/modal.styles.d.ts.map +1 -0
  186. package/lib/typescript/src/components/progress.styles.d.ts +44 -0
  187. package/lib/typescript/src/components/progress.styles.d.ts.map +1 -0
  188. package/lib/typescript/src/components/radio.styles.d.ts +91 -0
  189. package/lib/typescript/src/components/radio.styles.d.ts.map +1 -0
  190. package/lib/typescript/src/components/screen.styles.d.ts +34 -0
  191. package/lib/typescript/src/components/screen.styles.d.ts.map +1 -0
  192. package/lib/typescript/src/components/skeleton.styles.d.ts +105 -0
  193. package/lib/typescript/src/components/skeleton.styles.d.ts.map +1 -0
  194. package/lib/typescript/src/components/surface.styles.d.ts +31 -0
  195. package/lib/typescript/src/components/surface.styles.d.ts.map +1 -0
  196. package/lib/typescript/src/components/textfield.styles.d.ts +75 -0
  197. package/lib/typescript/src/components/textfield.styles.d.ts.map +1 -0
  198. package/lib/typescript/src/components/toast.styles.d.ts +62 -0
  199. package/lib/typescript/src/components/toast.styles.d.ts.map +1 -0
  200. package/lib/typescript/src/components/toggle.styles.d.ts +53 -0
  201. package/lib/typescript/src/components/toggle.styles.d.ts.map +1 -0
  202. package/lib/typescript/src/contracts/contract-types.d.ts +193 -0
  203. package/lib/typescript/src/contracts/contract-types.d.ts.map +1 -0
  204. package/lib/typescript/src/icons/Icon.d.ts +40 -0
  205. package/lib/typescript/src/icons/Icon.d.ts.map +1 -0
  206. package/lib/typescript/src/icons/glyphs.d.ts +259 -0
  207. package/lib/typescript/src/icons/glyphs.d.ts.map +1 -0
  208. package/lib/typescript/src/icons/icon.styles.d.ts +20 -0
  209. package/lib/typescript/src/icons/icon.styles.d.ts.map +1 -0
  210. package/lib/typescript/src/icons/index.d.ts +12 -0
  211. package/lib/typescript/src/icons/index.d.ts.map +1 -0
  212. package/lib/typescript/src/index.d.ts +12 -0
  213. package/lib/typescript/src/index.d.ts.map +1 -0
  214. package/lib/typescript/src/primitives/Button.d.ts +48 -0
  215. package/lib/typescript/src/primitives/Button.d.ts.map +1 -0
  216. package/lib/typescript/src/primitives/Metric.d.ts +38 -0
  217. package/lib/typescript/src/primitives/Metric.d.ts.map +1 -0
  218. package/lib/typescript/src/primitives/Row.d.ts +37 -0
  219. package/lib/typescript/src/primitives/Row.d.ts.map +1 -0
  220. package/lib/typescript/src/primitives/Stack.d.ts +33 -0
  221. package/lib/typescript/src/primitives/Stack.d.ts.map +1 -0
  222. package/lib/typescript/src/primitives/Tag.d.ts +43 -0
  223. package/lib/typescript/src/primitives/Tag.d.ts.map +1 -0
  224. package/lib/typescript/src/primitives/Text.d.ts +45 -0
  225. package/lib/typescript/src/primitives/Text.d.ts.map +1 -0
  226. package/lib/typescript/src/primitives/_internal/focus-ring.d.ts +31 -0
  227. package/lib/typescript/src/primitives/_internal/focus-ring.d.ts.map +1 -0
  228. package/lib/typescript/src/primitives/button.styles.d.ts +29 -0
  229. package/lib/typescript/src/primitives/button.styles.d.ts.map +1 -0
  230. package/lib/typescript/src/primitives/index.d.ts +8 -0
  231. package/lib/typescript/src/primitives/index.d.ts.map +1 -0
  232. package/lib/typescript/src/primitives/metric.styles.d.ts +43 -0
  233. package/lib/typescript/src/primitives/metric.styles.d.ts.map +1 -0
  234. package/lib/typescript/src/primitives/row.styles.d.ts +50 -0
  235. package/lib/typescript/src/primitives/row.styles.d.ts.map +1 -0
  236. package/lib/typescript/src/primitives/stack.styles.d.ts +34 -0
  237. package/lib/typescript/src/primitives/stack.styles.d.ts.map +1 -0
  238. package/lib/typescript/src/primitives/tag.styles.d.ts +32 -0
  239. package/lib/typescript/src/primitives/tag.styles.d.ts.map +1 -0
  240. package/lib/typescript/src/primitives/text.styles.d.ts +26 -0
  241. package/lib/typescript/src/primitives/text.styles.d.ts.map +1 -0
  242. package/lib/typescript/src/theme/ThemeProvider.d.ts +32 -0
  243. package/lib/typescript/src/theme/ThemeProvider.d.ts.map +1 -0
  244. package/lib/typescript/src/theme/index.d.ts +15 -0
  245. package/lib/typescript/src/theme/index.d.ts.map +1 -0
  246. package/lib/typescript/src/theme/native-theme.d.ts +3 -0
  247. package/lib/typescript/src/theme/native-theme.d.ts.map +1 -0
  248. package/lib/typescript/src/theme/types.d.ts +121 -0
  249. package/lib/typescript/src/theme/types.d.ts.map +1 -0
  250. package/package.json +120 -0
  251. package/src/components/ActionSheet.tsx +112 -0
  252. package/src/components/Alert.tsx +84 -0
  253. package/src/components/Avatar.tsx +110 -0
  254. package/src/components/BottomSheet.tsx +81 -0
  255. package/src/components/Card.tsx +102 -0
  256. package/src/components/Checkbox.tsx +107 -0
  257. package/src/components/EmptyState.tsx +64 -0
  258. package/src/components/Header.tsx +51 -0
  259. package/src/components/Image.tsx +89 -0
  260. package/src/components/Modal.tsx +113 -0
  261. package/src/components/Progress.tsx +124 -0
  262. package/src/components/Radio.tsx +151 -0
  263. package/src/components/Screen.tsx +62 -0
  264. package/src/components/Skeleton.tsx +154 -0
  265. package/src/components/Surface.tsx +37 -0
  266. package/src/components/TextField.tsx +102 -0
  267. package/src/components/Toast.tsx +103 -0
  268. package/src/components/Toggle.tsx +94 -0
  269. package/src/components/action-sheet.styles.ts +102 -0
  270. package/src/components/alert.styles.ts +115 -0
  271. package/src/components/avatar.styles.ts +110 -0
  272. package/src/components/bottom-sheet.styles.ts +78 -0
  273. package/src/components/card.styles.ts +56 -0
  274. package/src/components/checkbox.styles.ts +83 -0
  275. package/src/components/empty-state.styles.ts +98 -0
  276. package/src/components/header.styles.ts +44 -0
  277. package/src/components/image.styles.ts +36 -0
  278. package/src/components/index.ts +23 -0
  279. package/src/components/modal.styles.ts +106 -0
  280. package/src/components/progress.styles.ts +74 -0
  281. package/src/components/radio.styles.ts +132 -0
  282. package/src/components/screen.styles.ts +44 -0
  283. package/src/components/skeleton.styles.ts +155 -0
  284. package/src/components/surface.styles.ts +50 -0
  285. package/src/components/textfield.styles.ts +135 -0
  286. package/src/components/toast.styles.ts +115 -0
  287. package/src/components/toggle.styles.ts +73 -0
  288. package/src/contracts/contract-types.ts +199 -0
  289. package/src/icons/Icon.tsx +65 -0
  290. package/src/icons/glyphs.ts +54 -0
  291. package/src/icons/icon.styles.ts +37 -0
  292. package/src/icons/index.ts +12 -0
  293. package/src/index.ts +24 -0
  294. package/src/primitives/Button.tsx +114 -0
  295. package/src/primitives/Metric.tsx +67 -0
  296. package/src/primitives/Row.tsx +54 -0
  297. package/src/primitives/Stack.tsx +42 -0
  298. package/src/primitives/Tag.tsx +126 -0
  299. package/src/primitives/Text.tsx +71 -0
  300. package/src/primitives/_internal/focus-ring.tsx +59 -0
  301. package/src/primitives/button.styles.ts +69 -0
  302. package/src/primitives/index.ts +8 -0
  303. package/src/primitives/metric.styles.ts +75 -0
  304. package/src/primitives/row.styles.ts +66 -0
  305. package/src/primitives/stack.styles.ts +47 -0
  306. package/src/primitives/tag.styles.ts +65 -0
  307. package/src/primitives/text.styles.ts +42 -0
  308. package/src/theme/ThemeProvider.tsx +60 -0
  309. package/src/theme/index.ts +18 -0
  310. package/src/theme/native-theme.ts +215 -0
  311. package/src/theme/types.ts +137 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,197 @@
1
+ # melta for APP(melta-app)
2
+
3
+ **React Native(Expo)版の melta デザインシステム — アプリ本体ではなく、`npm install melta-app` で使う UI kit(ライブラリ)。** web 版 [melta-ui](https://github.com/tsubotax/melta-ui) と同じデザイン契約(`melta-contracts`)を single source of truth に、RN 実装でその契約を満たす。
4
+
5
+ > 1 つのデザイン言語が、web では Tailwind に、app では React Native に降りる。
6
+
7
+ - **Showcase / Live Catalog**: https://app.melta.tsubotax.com (Live Catalog は実 RN コンポーネントの web export。HTML 再現デモではない)
8
+ - **Web 版 showcase**: https://melta.tsubotax.com
9
+
10
+ D2I(北海道ツーリング DB)アプリが最初の adopter / dogfood。最初の実需は「ツーリング記録を Garmin 風サマリーカードに焼いて外部シェア」機能。
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install melta-app
16
+ ```
17
+
18
+ peerDependencies は `react` / `react-native` のみ(Expo でも素の RN でも可、runtime 依存ゼロ)。
19
+
20
+ ```tsx
21
+ import { ThemeProvider, Screen, Header, Card, Text, Button } from "melta-app";
22
+
23
+ export default function App() {
24
+ return (
25
+ <ThemeProvider>
26
+ <Screen variant="scroll" header={<Header title="ツーリング" />}>
27
+ <Card>
28
+ <Text>道東ぐるり 摩周湖・屈斜路湖</Text>
29
+ </Card>
30
+ <Button label="記録する" onPress={() => {}} />
31
+ </Screen>
32
+ </ThemeProvider>
33
+ );
34
+ }
35
+ ```
36
+
37
+ テーマは `ThemeProvider` が OS の light / dark に自動追従(`forcedMode` で固定も可)。トークンは `useTheme()` / `nativeTheme` から取れる。Icon だけは subpath([後述](#icon-だけ-subpath-エントリmelta-appicons))。
38
+
39
+ ## 設計の核
40
+
41
+ - **契約は共有、実装は各最適**: tokens / 禁止ルール / component 契約は `melta-contracts`(JSON)が SSOT。melta-app に token は持たない(二重化を物理防止)。
42
+ - **公開 DS の純度を守る**: 汎用 UI プリミティブだけを置く。D2I 固有 UI(スポットカード / GPS 軌跡 / ツー活サマリーカード)は **D2I 側**に置き、ここには混ぜない。
43
+ - **依存最小**: 初期は RN `StyleSheet` 固定(nativewind / unistyles 等の runtime styling lib を入れない)。Storybook RN も使わず自前カタログ。
44
+
45
+ ## AI-Ready
46
+
47
+ 人間と AI の両方が読めることを最初から設計に入れている。
48
+
49
+ - **契約が機械可読**: variants / sizes / states / tokens / a11y はすべて `melta-contracts` の JSON。生成 AI は「それっぽい見た目」ではなく契約を参照して UI を書ける。
50
+ - **実装状態も機械可読**: 各契約の `appStatus`(implemented / planned / not-planned)と `appMapping`(adapted = モバイル慣習への変換)が SSOT。この README のコンポーネント表も、showcase の表も、そこから生成される — 手書きの表はこのリポに存在しない。
51
+ - **ズレは CI が拾う**: 契約と実装の齟齬は conformance テスト、ドキュメントの腐りは drift 検査が落とす。「AI が書いたコードが DS に準拠しているか」を人間の目視でなくハーネスが判定する。
52
+ - web 版には MCP サーバー(`melta-ds-mcp`)もあり、Claude Code / Cursor から契約・トークン・ルールを直接引ける(RN 対応は今後)。
53
+
54
+ ## ディレクトリ
55
+
56
+ ```
57
+ melta-app/
58
+ src/ ライブラリ本体(npm 配布物)
59
+ theme/
60
+ types.ts NativeTheme の型
61
+ native-theme.ts ⚠️ 自動生成(melta-contracts → RN 正規化済み)
62
+ index.ts theme エントリ(ThemeProvider / useTheme / nativeTheme)
63
+ primitives/ Text / Button / Tag / Metric / Stack / Row
64
+ components/ Card / Image / Surface / Skeleton / EmptyState / Screen / Header /
65
+ Avatar / TextField / Toggle / Checkbox / Radio / Alert / Toast /
66
+ Progress / Modal / ActionSheet / BottomSheet
67
+ icons/ Icon + glyphs(subpath エントリ melta-app/icons、react-native-svg 隔離)
68
+ contracts/
69
+ contract-types.ts ⚠️ 自動生成(契約メタ CONTRACTS + 型)
70
+ index.ts 公開エントリ
71
+ example/ カタログアプリ(Expo、publish 除外)
72
+ App.tsx / catalog/ / screens/
73
+ scripts/
74
+ generate-native-theme.ts melta-contracts/tokens.json → src/theme/native-theme.ts
75
+ generate-contract-types.ts 契約 JSON → src/contracts/contract-types.ts
76
+ check-drift.ts README / catalog / allowlist の drift 検査(--write で heal)
77
+ check-installability.sh pack → install → import → typecheck の公開ゲート
78
+ lib/ token 正規化 + conformance / consumer テスト
79
+ ```
80
+
81
+ ## トークン正規化(web → RN)
82
+
83
+ `scripts/lib/normalize-tokens.ts` が変換する。壊れやすい箇所はテスト必須。
84
+
85
+ | トークン | web | RN |
86
+ |---|---|---|
87
+ | color | hex / rgba | そのまま(semantic は light/dark mode 切替) |
88
+ | spacing / radius / fontSize | rem + px | px の数値を採用(RN は unitless) |
89
+ | shadow | CSS box-shadow | iOS shadow* + Android elevation に分解(1 ViewStyle に同居) |
90
+ | fontFamily | 配列 | 単一文字列(先頭採用、未ロード時 OS デフォルト fallback) |
91
+ | lineHeight | 比率("2.0") | `fontSize × ratio` を px 算出 |
92
+ | letterSpacing | em | **em ratio の数値で保持**(fontSize 相対のため token 単体で px 化不可。適用側が `fontSize × ratio` で解決) |
93
+ | motion duration | "150ms" | 150(数値) |
94
+ | motion easing | cubic-bezier | `[a,b,c,d]` tuple(`Easing.bezier(...)` に展開) |
95
+
96
+ ## 開発(このリポを触る人向け)
97
+
98
+ ```bash
99
+ npm install # melta-contracts(npm 公開済み)も devDependencies として入る
100
+
101
+ # theme + contract 型を生成(melta-contracts のノードを読む。
102
+ # 未 install 時のみ隣の melta-ui を fallback で読む開発モード)
103
+ npm run generate
104
+
105
+ # 変換・conformance・consumer テスト
106
+ npm test
107
+
108
+ # 実機 / シミュレータでカタログを確認
109
+ npm run ios # または android / web
110
+ ```
111
+
112
+ ## コンポーネント
113
+
114
+ 契約(melta-contracts)とコンポーネントの対応。この表は手書きせず契約から生成する(`npm run check:drift` が同期を検査)。
115
+
116
+ <!-- BEGIN GENERATED: component-status(scripts/check-drift.ts --write で再生成。手編集禁止) -->
117
+ | 契約 | Component | APP | 形(appMapping) | メモ |
118
+ |---|---|---|---|---|
119
+ | action-sheet | `ActionSheet` | ✅ implemented | — | |
120
+ | alert | `Alert` | ✅ implemented | — | |
121
+ | avatar | `Avatar` | ✅ implemented | — | |
122
+ | bottom-sheet | `BottomSheet` | ✅ implemented | — | |
123
+ | button | `Button` | ✅ implemented | — | |
124
+ | card | `Card` | ✅ implemented | — | |
125
+ | checkbox | `Checkbox` | ✅ implemented | — | |
126
+ | empty-state | `EmptyState` | ✅ implemented | — | |
127
+ | header | `Header` | ✅ implemented | — | |
128
+ | icon | `Icon` | ✅ implemented | — | |
129
+ | image | `Image` | ✅ implemented | — | |
130
+ | metric | `Metric` | ✅ implemented | — | |
131
+ | modal | `Modal` | ✅ implemented | — | |
132
+ | progress | `Progress` | ✅ implemented | — | |
133
+ | radio | `Radio` | ✅ implemented | — | |
134
+ | row | `Row` | ✅ implemented | — | |
135
+ | screen | `Screen` | ✅ implemented | — | |
136
+ | skeleton | `Skeleton` | ✅ implemented | — | |
137
+ | stack | `Stack` | ✅ implemented | — | |
138
+ | surface | `Surface` | ✅ implemented | — | |
139
+ | tag | `Tag` | ✅ implemented | — | |
140
+ | text | `Text` | ✅ implemented | — | |
141
+ | textfield | `TextField` | ✅ implemented | — | |
142
+ | toast | `Toast` | ✅ implemented | — | |
143
+ | toggle | `Toggle` | ✅ implemented | — | |
144
+ | accordion | — | ⬜ planned | — | |
145
+ | badge | — | ⬜ planned | — | |
146
+ | datepicker | — | ⬜ planned | adapted | カレンダー自作はしない。OS 標準の日付ピッカー(@react-native-community/datetimepicker 等)への委譲でトークンのみ供給 |
147
+ | divider | — | ⬜ planned | — | |
148
+ | dropdown | — | ⬜ planned | adapted | hover 起動は存在しない。タップ起動の Menu(アンカー付き)or ActionSheet に変換 |
149
+ | list | — | ⬜ planned | — | |
150
+ | select | — | ⬜ planned | adapted | web のドロップリストは持ち込まない。ActionSheet / BottomSheet / OS Picker で開く選択 UI に変換(gluestack/Tamagui も native では Sheet 化) |
151
+ | stepper | — | ⬜ planned | — | |
152
+ | tabs | — | ⬜ planned | adapted | トップタブ / SegmentedControl 型として実装(web の下線タブ意味論を M3 segmented / iOS UISegmentedControl に写像) |
153
+ | breadcrumb | — | 🚫 not-planned | — | RN 主要ライブラリ提供 0/5。Apple HIG が multisegment breadcrumb を明示的に否定。back ボタン + nav bar タイトルで代替 |
154
+ | copy-button | — | 🚫 not-planned | — | DS プリミティブでなくアプリ層のコンポジット(button + clipboard + toast) |
155
+ | pagination | — | 🚫 not-planned | — | モバイルは無限スクロール(FlatList onEndReached)で代替。カルーセル文脈は PageControl の領分 |
156
+ | sidebar | — | 🚫 not-planned | — | Navigation Drawer の領分=react-navigation 側の責務。DS はトークン供給のみ |
157
+ | table | — | 🚫 not-planned | — | モバイルは単列リスト / Card への再構成が定石(M3 に data table なし)。list + metric で分解表現する |
158
+ | tooltip | — | 🚫 not-planned | — | hover 前提のため。iPhone HIG に tooltip 概念なし。必要になれば長押し Hint として別契約を切る |
159
+ <!-- END GENERATED: component-status -->
160
+
161
+ ### Icon だけ subpath エントリ(`melta-app/icons`)
162
+
163
+ Icon は唯一 `react-native-svg`(optional peerDependency)に依存するため、本体エントリから分離している。
164
+ 本体 `melta-app` は依存ゼロのまま — Icon を使うアプリだけが以下を行う:
165
+
166
+ ```bash
167
+ npx expo install react-native-svg
168
+ ```
169
+
170
+ ```tsx
171
+ import { Icon } from "melta-app/icons";
172
+
173
+ <Icon name="like-on" accessibilityLabel="いいね" /> // 意味を持つ icon は label 必須
174
+ <Icon name="close" size="sm" color="text-muted" /> // 省略時は装飾扱い(a11y ツリーから除外)
175
+ ```
176
+
177
+ グリフは Charcoal Icons(pixiv、Apache-2.0)の curated サブセット(`assets/icons/*.svg` →
178
+ `npm run generate:icons` で `src/icons/glyphs.ts` に codegen、commit 済みを配布)。
179
+ 帰属表示は `THIRD_PARTY_LICENSES.md`。
180
+
181
+ ## ステータス
182
+
183
+ - ✅ ライブラリ化(root=ライブラリ / example=カタログアプリ、peerDeps react + react-native、runtime deps ゼロ)
184
+ - ✅ `melta-contracts` を npm 依存として購読(recipes/app の styleRefs 同梱)
185
+ - ✅ conformance: 契約源 ↔ 生成メタ ↔ `__contract` 宣言の照合 + consumer テスト(契約 subset / token 実在 / contractVersion 同期)+ styleRefs conformance(全実装コンポーネント展開済み)+ RN mount smoke(light/dark × 全公開コンポーネント)
186
+ - ✅ ハーネス: design lint(CI `--max-warnings 0` + PostToolUse hook)/ drift 検査(README・catalog・allowlist 突合)/ installability ゲート(pack → install → import → typecheck)
187
+ - ✅ layout 6 個(Stack / Row / Screen / Header / Icon / Avatar)— dogfood 不足 1〜4 を解消、TouringFeedScreen は公開 primitive だけで構成
188
+ - 既知の割り切り: Screen の SafeArea は RN core の SafeAreaView(deprecated / iOS のみの最小対応)。依存ゼロ方針を優先した判断で、精度が必要になれば react-native-safe-area-context への adapter 化を検討
189
+ - ✅ form / feedback 10 個(TextField / Toggle / Checkbox / Radio / Alert / Toast / Progress / Modal / ActionSheet / BottomSheet)— checkbox / radio は Pressable + 描画(svg 非依存)、ActionSheet / BottomSheet は select / dropdown の adapted 変換先の受け皿
190
+ - ✅ showcase(https://app.melta.tsubotax.com — melta-ui 様式シェル + 実 RN カタログの Live 埋め込み。表・統計は契約からビルド時生成)
191
+ - ⬜ 0.1.0 publish → React Native Directory 登録
192
+
193
+ 詳細は D2I リポの `.team/specs/requirements-melta-app.md`。
194
+
195
+ ## License
196
+
197
+ MIT
@@ -0,0 +1,198 @@
1
+ # Third-Party Licenses
2
+
3
+ melta-app は以下のサードパーティ製アイコンを同梱しています。
4
+
5
+ ---
6
+
7
+
8
+ ## Charcoal Icons (@charcoal-ui/icons)
9
+
10
+ - **License**: Apache License, Version 2.0
11
+ - **Copyright**: Copyright 2022 pixiv Inc.
12
+ - **Source**: https://github.com/pixiv/charcoal
13
+ - **Location**: repository source: `assets/icons/`(melta-ui からの curated サブセット SVG。npm tarball には含まない)/ packaged output: `src/icons/glyphs.ts` + `lib/module/icons/`(SVG から codegen した path データ、これが配布物)
14
+ - **Modifications**: 単色 tint 契約のため fill が currentColor でない path(白抜き backdrop)を codegen 時に除外(scripts/generate-icons.ts)
15
+
16
+ ### Apache License, Version 2.0
17
+
18
+ ```
19
+ Apache License
20
+ Version 2.0, January 2004
21
+ http://www.apache.org/licenses/
22
+
23
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
24
+
25
+ 1. Definitions.
26
+
27
+ "License" shall mean the terms and conditions for use, reproduction,
28
+ and distribution as defined by Sections 1 through 9 of this document.
29
+
30
+ "Licensor" shall mean the copyright owner or entity authorized by
31
+ the copyright owner that is granting the License.
32
+
33
+ "Legal Entity" shall mean the union of the acting entity and all
34
+ other entities that control, are controlled by, or are under common
35
+ control with that entity. For the purposes of this definition,
36
+ "control" means (i) the power, direct or indirect, to cause the
37
+ direction or management of such entity, whether by contract or
38
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
39
+ outstanding shares, or (iii) beneficial ownership of such entity.
40
+
41
+ "You" (or "Your") shall mean an individual or Legal Entity
42
+ exercising permissions granted by this License.
43
+
44
+ "Source" form shall mean the preferred form for making modifications,
45
+ including but not limited to software source code, documentation
46
+ source, and configuration files.
47
+
48
+ "Object" form shall mean any form resulting from mechanical
49
+ transformation or translation of a Source form, including but
50
+ not limited to compiled object code, generated documentation,
51
+ and conversions to other media types.
52
+
53
+ "Work" shall mean the work of authorship, whether in Source or
54
+ Object form, made available under the License, as indicated by a
55
+ copyright notice that is included in or attached to the work
56
+ (an example is provided in the Appendix below).
57
+
58
+ "Derivative Works" shall mean any work, whether in Source or Object
59
+ form, that is based on (or derived from) the Work and for which the
60
+ editorial revisions, annotations, elaborations, or other modifications
61
+ represent, as a whole, an original work of authorship. For the purposes
62
+ of this License, Derivative Works shall not include works that remain
63
+ separable from, or merely link (or bind by name) to the interfaces of,
64
+ the Work and Derivative Works thereof.
65
+
66
+ "Contribution" shall mean any work of authorship, including
67
+ the original version of the Work and any modifications or additions
68
+ to that Work or Derivative Works thereof, that is intentionally
69
+ submitted to the Licensor for inclusion in the Work by the copyright owner
70
+ or by an individual or Legal Entity authorized to submit on behalf of
71
+ the copyright owner. For the purposes of this definition, "submitted"
72
+ means any form of electronic, verbal, or written communication sent
73
+ to the Licensor or its representatives, including but not limited to
74
+ communication on electronic mailing lists, source code control systems,
75
+ and issue tracking systems that are managed by, or on behalf of, the
76
+ Licensor for the purpose of discussing and improving the Work, but
77
+ excluding communication that is conspicuously marked or otherwise
78
+ designated in writing by the copyright owner as "Not a Contribution."
79
+
80
+ "Contributor" shall mean Licensor and any individual or Legal Entity
81
+ on behalf of whom a Contribution has been received by the Licensor and
82
+ subsequently incorporated within the Work.
83
+
84
+ 2. Grant of Copyright License. Subject to the terms and conditions of
85
+ this License, each Contributor hereby grants to You a perpetual,
86
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
87
+ copyright license to reproduce, prepare Derivative Works of,
88
+ publicly display, publicly perform, sublicense, and distribute the
89
+ Work and such Derivative Works in Source or Object form.
90
+
91
+ 3. Grant of Patent License. Subject to the terms and conditions of
92
+ this License, each Contributor hereby grants to You a perpetual,
93
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
94
+ (except as stated in this section) patent license to make, have made,
95
+ use, offer to sell, sell, import, and otherwise transfer the Work,
96
+ where such license applies only to those patent claims licensable
97
+ by such Contributor that are necessarily infringed by their
98
+ Contribution(s) alone or by combination of their Contribution(s)
99
+ with the Work to which such Contribution(s) was submitted. If You
100
+ institute patent litigation against any entity (including a
101
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
102
+ or a Contribution incorporated within the Work constitutes direct
103
+ or contributory patent infringement, then any patent licenses
104
+ granted to You under this License for that Work shall terminate
105
+ as of the date such litigation is filed.
106
+
107
+ 4. Redistribution. You may reproduce and distribute copies of the
108
+ Work or Derivative Works thereof in any medium, with or without
109
+ modifications, and in Source or Object form, provided that You
110
+ meet the following conditions:
111
+
112
+ (a) You must give any other recipients of the Work or
113
+ Derivative Works a copy of this License; and
114
+
115
+ (b) You must cause any modified files to carry prominent notices
116
+ stating that You changed the files; and
117
+
118
+ (c) You must retain, in the Source form of any Derivative Works
119
+ that You distribute, all copyright, patent, trademark, and
120
+ attribution notices from the Source form of the Work,
121
+ excluding those notices that do not pertain to any part of
122
+ the Derivative Works; and
123
+
124
+ (d) If the Work includes a "NOTICE" text file as part of its
125
+ distribution, then any Derivative Works that You distribute must
126
+ include a readable copy of the attribution notices contained
127
+ within such NOTICE file, excluding any notices that do not
128
+ pertain to any part of the Derivative Works, in at least one
129
+ of the following places: within a NOTICE text file distributed
130
+ as part of the Derivative Works; within the Source form or
131
+ documentation, if provided along with the Derivative Works; or,
132
+ within a display generated by the Derivative Works, if and
133
+ wherever such third-party notices normally appear. The contents
134
+ of the NOTICE file are for informational purposes only and
135
+ do not modify the License. You may add Your own attribution
136
+ notices within Derivative Works that You distribute, alongside
137
+ or as an addendum to the NOTICE text from the Work, provided
138
+ that such additional attribution notices cannot be construed
139
+ as modifying the License.
140
+
141
+ You may add Your own copyright statement to Your modifications and
142
+ may provide additional or different license terms and conditions
143
+ for use, reproduction, or distribution of Your modifications, or
144
+ for any such Derivative Works as a whole, provided Your use,
145
+ reproduction, and distribution of the Work otherwise complies with
146
+ the conditions stated in this License.
147
+
148
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
149
+ any Contribution intentionally submitted for inclusion in the Work
150
+ by You to the Licensor shall be under the terms and conditions of
151
+ this License, without any additional terms or conditions.
152
+ Notwithstanding the above, nothing herein shall supersede or modify
153
+ the terms of any separate license agreement you may have executed
154
+ with Licensor regarding such Contributions.
155
+
156
+ 6. Trademarks. This License does not grant permission to use the trade
157
+ names, trademarks, service marks, or product names of the Licensor,
158
+ except as required for reasonable and customary use in describing the
159
+ origin of the Work and reproducing the content of the NOTICE file.
160
+
161
+ 7. Disclaimer of Warranty. Unless required by applicable law or
162
+ agreed to in writing, Licensor provides the Work (and each
163
+ Contributor provides its Contributions) on an "AS IS" BASIS,
164
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
165
+ implied, including, without limitation, any warranties or conditions
166
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
167
+ PARTICULAR PURPOSE. You are solely responsible for determining the
168
+ appropriateness of using or redistributing the Work and assume any
169
+ risks associated with Your exercise of permissions under this License.
170
+
171
+ 8. Limitation of Liability. In no event and under no legal theory,
172
+ whether in tort (including negligence), contract, or otherwise,
173
+ unless required by applicable law (such as deliberate and grossly
174
+ negligent acts) or agreed to in writing, shall any Contributor be
175
+ liable to You for damages, including any direct, indirect, special,
176
+ incidental, or consequential damages of any character arising as a
177
+ result of this License or out of the use or inability to use the
178
+ Work (including but not limited to damages for loss of goodwill,
179
+ work stoppage, computer failure or malfunction, or any and all
180
+ other commercial damages or losses), even if such Contributor
181
+ has been advised of the possibility of such damages.
182
+
183
+ 9. Accepting Warranty or Additional Liability. While redistributing
184
+ the Work or Derivative Works thereof, You may choose to offer,
185
+ and charge a fee for, acceptance of support, warranty, indemnity,
186
+ or other liability obligations and/or rights consistent with this
187
+ License. However, in accepting such obligations, You may act only
188
+ on Your own behalf and on Your sole responsibility, not on behalf
189
+ of any other Contributor, and only if You agree to indemnify,
190
+ defend, and hold each Contributor harmless for any liability
191
+ incurred by, or claims asserted against, such Contributor by reason
192
+ of your accepting any such warranty or additional liability.
193
+
194
+ END OF TERMS AND CONDITIONS
195
+ ```
196
+
197
+ ---
198
+
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * ActionSheet — 画面下から出るアクション/選択リスト。contract: action-sheet(appFirst、feedback)。
5
+ * RN core Modal(transparent + slide)+ 下端 sheet。web の select / dropdown を APP に
6
+ * adapted 変換する際の受け皿。
7
+ *
8
+ * - actions は縦積み(区切り線 border-default)、cancel は下に分離した独立ブロック
9
+ * (閉じる手段を複数持つ: cancelAction + overlay tap + Android back = contract a11y required)。
10
+ * - destructive アクションは destructiveTextStyle(status.danger.base)で色を差し替える。
11
+ * 色だけでなくラベル文言でも破壊的操作と分かる文言にするのは呼び出し側の責務(contract a11y)。
12
+ * - 先頭 action の borderTop は title が無い場合は消す(title がある時だけ区切りとして意味を持つ)。
13
+ * - action の onPress 後は onClose も呼ぶ(選択 = シートを閉じる)。
14
+ * - sheet 群は SafeAreaView で包み下余白(ホームインジケータ)を確保(recipe description 参照)。
15
+ * - sheet 側は onStartShouldSetResponder で touch を claim し、overlay tap でだけ閉じる。
16
+ * - style の決定は pure resolver(action-sheet.styles.ts)に分離 — recipe との機械照合対象。
17
+ */
18
+
19
+ import { useMemo } from "react";
20
+ import { Modal as RNModal, Pressable, SafeAreaView, Text as RNText, View } from "react-native";
21
+ import { useTheme } from "../theme/index.js";
22
+ import { CONTRACTS } from "../contracts/contract-types.js";
23
+ import { resolveActionSheetStyle } from "./action-sheet.styles.js";
24
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
+ export function ActionSheet({
26
+ visible,
27
+ onClose,
28
+ title,
29
+ actions,
30
+ cancelLabel = "キャンセル",
31
+ testID
32
+ }) {
33
+ const {
34
+ theme,
35
+ mode
36
+ } = useTheme();
37
+ const styles = useMemo(() => resolveActionSheetStyle(theme, mode), [theme, mode]);
38
+ return /*#__PURE__*/_jsx(RNModal, {
39
+ visible: visible,
40
+ transparent: true,
41
+ animationType: "slide",
42
+ onRequestClose: onClose,
43
+ statusBarTranslucent: true,
44
+ children: /*#__PURE__*/_jsx(Pressable, {
45
+ style: styles.overlayStyle,
46
+ onPress: onClose,
47
+ accessible: false,
48
+ children: /*#__PURE__*/_jsxs(SafeAreaView, {
49
+ accessibilityViewIsModal: true,
50
+ onStartShouldSetResponder: () => true,
51
+ testID: testID,
52
+ children: [/*#__PURE__*/_jsxs(View, {
53
+ style: styles.sheetStyle,
54
+ children: [title != null && /*#__PURE__*/_jsx(RNText, {
55
+ style: styles.titleStyle,
56
+ children: title
57
+ }), actions.map((action, index) => /*#__PURE__*/_jsx(Pressable, {
58
+ accessibilityRole: "button",
59
+ onPress: () => {
60
+ action.onPress();
61
+ onClose();
62
+ },
63
+ style: [styles.actionStyle,
64
+ // 先頭 action の区切り線は title がある時だけ意味を持つ
65
+ index === 0 && title == null ? {
66
+ borderTopWidth: 0
67
+ } : null],
68
+ children: /*#__PURE__*/_jsx(RNText, {
69
+ style: action.destructive ? styles.destructiveTextStyle : styles.actionTextStyle,
70
+ children: action.label
71
+ })
72
+ }, `${index}-${action.label}`))]
73
+ }), /*#__PURE__*/_jsx(Pressable, {
74
+ accessibilityRole: "button",
75
+ onPress: onClose,
76
+ style: styles.cancelStyle,
77
+ children: /*#__PURE__*/_jsx(RNText, {
78
+ style: styles.cancelTextStyle,
79
+ children: cancelLabel
80
+ })
81
+ })]
82
+ })
83
+ })
84
+ });
85
+ }
86
+ ActionSheet.__contract = CONTRACTS.actionSheet;
87
+ //# sourceMappingURL=ActionSheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","Modal","RNModal","Pressable","SafeAreaView","Text","RNText","View","useTheme","CONTRACTS","resolveActionSheetStyle","jsx","_jsx","jsxs","_jsxs","ActionSheet","visible","onClose","title","actions","cancelLabel","testID","theme","mode","styles","transparent","animationType","onRequestClose","statusBarTranslucent","children","style","overlayStyle","onPress","accessible","accessibilityViewIsModal","onStartShouldSetResponder","sheetStyle","titleStyle","map","action","index","accessibilityRole","actionStyle","borderTopWidth","destructive","destructiveTextStyle","actionTextStyle","label","cancelStyle","cancelTextStyle","__contract","actionSheet"],"sourceRoot":"../../../src","sources":["components/ActionSheet.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SACEC,KAAK,IAAIC,OAAO,EAChBC,SAAS,EACTC,YAAY,EACZC,IAAI,IAAIC,MAAM,EACdC,IAAI,QACC,cAAc;AACrB,SAASC,QAAQ,QAAQ,mBAAU;AACnC,SAASC,SAAS,QAAQ,gCAA6B;AACvD,SAASC,uBAAuB,QAA+B,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsBvF,OAAO,SAASC,WAAWA,CAAC;EAC1BC,OAAO;EACPC,OAAO;EACPC,KAAK;EACLC,OAAO;EACPC,WAAW,GAAG,OAAO;EACrBC;AACgB,CAAC,EAAE;EACnB,MAAM;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGf,QAAQ,CAAC,CAAC;EAElC,MAAMgB,MAAM,GAAGxB,OAAO,CACpB,MAAMU,uBAAuB,CAACY,KAAK,EAAEC,IAAI,CAAC,EAC1C,CAACD,KAAK,EAAEC,IAAI,CACd,CAAC;EAED,oBACEX,IAAA,CAACV,OAAO;IACNc,OAAO,EAAEA,OAAQ;IACjBS,WAAW;IACXC,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAEV,OAAQ;IACxBW,oBAAoB;IAAAC,QAAA,eAEpBjB,IAAA,CAACT,SAAS;MAAC2B,KAAK,EAAEN,MAAM,CAACO,YAAa;MAACC,OAAO,EAAEf,OAAQ;MAACgB,UAAU,EAAE,KAAM;MAAAJ,QAAA,eAEzEf,KAAA,CAACV,YAAY;QACX8B,wBAAwB;QACxBC,yBAAyB,EAAEA,CAAA,KAAM,IAAK;QACtCd,MAAM,EAAEA,MAAO;QAAAQ,QAAA,gBAEff,KAAA,CAACP,IAAI;UAACuB,KAAK,EAAEN,MAAM,CAACY,UAAW;UAAAP,QAAA,GAC5BX,KAAK,IAAI,IAAI,iBAAIN,IAAA,CAACN,MAAM;YAACwB,KAAK,EAAEN,MAAM,CAACa,UAAW;YAAAR,QAAA,EAAEX;UAAK,CAAS,CAAC,EACnEC,OAAO,CAACmB,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,kBACzB5B,IAAA,CAACT,SAAS;YAERsC,iBAAiB,EAAC,QAAQ;YAC1BT,OAAO,EAAEA,CAAA,KAAM;cACbO,MAAM,CAACP,OAAO,CAAC,CAAC;cAChBf,OAAO,CAAC,CAAC;YACX,CAAE;YACFa,KAAK,EAAE,CACLN,MAAM,CAACkB,WAAW;YAClB;YACAF,KAAK,KAAK,CAAC,IAAItB,KAAK,IAAI,IAAI,GAAG;cAAEyB,cAAc,EAAE;YAAE,CAAC,GAAG,IAAI,CAC3D;YAAAd,QAAA,eAEFjB,IAAA,CAACN,MAAM;cACLwB,KAAK,EAAES,MAAM,CAACK,WAAW,GAAGpB,MAAM,CAACqB,oBAAoB,GAAGrB,MAAM,CAACsB,eAAgB;cAAAjB,QAAA,EAEhFU,MAAM,CAACQ;YAAK,CACP;UAAC,GAhBJ,GAAGP,KAAK,IAAID,MAAM,CAACQ,KAAK,EAiBpB,CACZ,CAAC;QAAA,CACE,CAAC,eACPnC,IAAA,CAACT,SAAS;UAACsC,iBAAiB,EAAC,QAAQ;UAACT,OAAO,EAAEf,OAAQ;UAACa,KAAK,EAAEN,MAAM,CAACwB,WAAY;UAAAnB,QAAA,eAChFjB,IAAA,CAACN,MAAM;YAACwB,KAAK,EAAEN,MAAM,CAACyB,eAAgB;YAAApB,QAAA,EAAET;UAAW,CAAS;QAAC,CACpD,CAAC;MAAA,CACA;IAAC,CACN;EAAC,CACL,CAAC;AAEd;AAEAL,WAAW,CAACmC,UAAU,GAAGzC,SAAS,CAAC0C,WAAW","ignoreList":[]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Alert — インラインアラート通知(feedback)。contract: alert。
5
+ * Info / Success / Warning / Error の4タイプ。Text の compose + 任意 icon slot / 閉じるボタン。
6
+ *
7
+ * - RN では border を持たず bg subtle + text 色で表現(status token に border 用の中間色が無い、
8
+ * recipe description)。COLOR_ONLY_FORBIDDEN は title/message のテキストと icon slot で担保する設計。
9
+ * - icon は ReactNode slot(EmptyState 前例。Icon を差すなら melta-app/icons を利用者が opt-in)。
10
+ * - a11y(§2 web→RN mapping): web の role=alert(error/warning) / status(info/success) を、
11
+ * error/warning → accessibilityRole="alert"、info/success → accessibilityLiveRegion="polite"
12
+ * (Android のみ有効。RN に status role が無いための写像)に落とす。
13
+ * - 色・寸法の決定は pure resolver(alert.styles.ts)に分離。dark mode は resolver が
14
+ * status.*.subtleDark / textDark を解決(info のみ primary 固定)。
15
+ * recipes/app/alert.recipe.json との機械照合は scripts/lib/alert-conformance.test.ts が行う。
16
+ */
17
+
18
+ import { useMemo } from "react";
19
+ import { Pressable, View } from "react-native";
20
+ import { Text } from "../primitives/Text.js";
21
+ import { useTheme } from "../theme/index.js";
22
+ import { CONTRACTS } from "../contracts/contract-types.js";
23
+ import { ALERT_SPEC, resolveAlertStyles } from "./alert.styles.js";
24
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
+ export function Alert({
26
+ variant,
27
+ title,
28
+ message,
29
+ icon,
30
+ onClose,
31
+ style,
32
+ testID
33
+ }) {
34
+ const {
35
+ theme,
36
+ mode
37
+ } = useTheme();
38
+ const styles = useMemo(() => resolveAlertStyles(theme, mode, variant), [theme, mode, variant]);
39
+ const urgent = variant === "error" || variant === "warning";
40
+ return /*#__PURE__*/_jsxs(View, {
41
+ accessibilityRole: urgent ? "alert" : undefined,
42
+ accessibilityLiveRegion: urgent ? undefined : "polite",
43
+ testID: testID,
44
+ style: [styles.containerStyle, style],
45
+ children: [icon != null && /*#__PURE__*/_jsx(View, {
46
+ children: icon
47
+ }), /*#__PURE__*/_jsxs(View, {
48
+ style: {
49
+ flex: 1,
50
+ gap: theme.spacing["1"]
51
+ },
52
+ children: [title != null && /*#__PURE__*/_jsx(Text, {
53
+ variant: ALERT_SPEC.titleFont,
54
+ weight: ALERT_SPEC.titleWeight,
55
+ style: {
56
+ color: styles.titleStyle.color
57
+ },
58
+ children: title
59
+ }), /*#__PURE__*/_jsx(Text, {
60
+ variant: ALERT_SPEC.messageFont,
61
+ style: {
62
+ color: styles.messageStyle.color
63
+ },
64
+ children: message
65
+ })]
66
+ }), onClose != null &&
67
+ /*#__PURE__*/
68
+ // 最小タップターゲット確保: min 24 + hitSlop(Tag removable と同じ手当て)。
69
+ _jsx(Pressable, {
70
+ onPress: onClose,
71
+ accessibilityRole: "button",
72
+ accessibilityLabel: "\u9589\u3058\u308B",
73
+ hitSlop: 10,
74
+ style: {
75
+ minWidth: 24,
76
+ minHeight: 24,
77
+ alignItems: "center",
78
+ justifyContent: "center"
79
+ },
80
+ children: /*#__PURE__*/_jsx(Text, {
81
+ variant: "xs",
82
+ style: {
83
+ color: styles.messageStyle.color
84
+ },
85
+ children: "\xD7"
86
+ })
87
+ })]
88
+ });
89
+ }
90
+
91
+ // Phase 2 conformance test 用の contract メタ(§2 A-3)。
92
+ Alert.__contract = CONTRACTS.alert;
93
+ //# sourceMappingURL=Alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","Pressable","View","Text","useTheme","CONTRACTS","ALERT_SPEC","resolveAlertStyles","jsx","_jsx","jsxs","_jsxs","Alert","variant","title","message","icon","onClose","style","testID","theme","mode","styles","urgent","accessibilityRole","undefined","accessibilityLiveRegion","containerStyle","children","flex","gap","spacing","titleFont","weight","titleWeight","color","titleStyle","messageFont","messageStyle","onPress","accessibilityLabel","hitSlop","minWidth","minHeight","alignItems","justifyContent","__contract","alert"],"sourceRoot":"../../../src","sources":["components/Alert.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAwB,OAAO;AAC/C,SAASC,SAAS,EAAEC,IAAI,QAAwC,cAAc;AAC9E,SAASC,IAAI,QAAQ,uBAAoB;AACzC,SAASC,QAAQ,QAAQ,mBAAU;AACnC,SAASC,SAAS,QAAQ,gCAA6B;AACvD,SAASC,UAAU,EAAEC,kBAAkB,QAA2B,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBnF,OAAO,SAASC,KAAKA,CAAC;EAAEC,OAAO;EAAEC,KAAK;EAAEC,OAAO;EAAEC,IAAI;EAAEC,OAAO;EAAEC,KAAK;EAAEC;AAAmB,CAAC,EAAE;EAC3F,MAAM;IAAEC,KAAK;IAAEC;EAAK,CAAC,GAAGjB,QAAQ,CAAC,CAAC;EAClC,MAAMkB,MAAM,GAAGtB,OAAO,CAAC,MAAMO,kBAAkB,CAACa,KAAK,EAAEC,IAAI,EAAER,OAAO,CAAC,EAAE,CAACO,KAAK,EAAEC,IAAI,EAAER,OAAO,CAAC,CAAC;EAC9F,MAAMU,MAAM,GAAGV,OAAO,KAAK,OAAO,IAAIA,OAAO,KAAK,SAAS;EAE3D,oBACEF,KAAA,CAACT,IAAI;IACHsB,iBAAiB,EAAED,MAAM,GAAG,OAAO,GAAGE,SAAU;IAChDC,uBAAuB,EAAEH,MAAM,GAAGE,SAAS,GAAG,QAAS;IACvDN,MAAM,EAAEA,MAAO;IACfD,KAAK,EAAE,CAACI,MAAM,CAACK,cAAc,EAAET,KAAK,CAAE;IAAAU,QAAA,GAErCZ,IAAI,IAAI,IAAI,iBAAIP,IAAA,CAACP,IAAI;MAAA0B,QAAA,EAAEZ;IAAI,CAAO,CAAC,eACpCL,KAAA,CAACT,IAAI;MAACgB,KAAK,EAAE;QAAEW,IAAI,EAAE,CAAC;QAAEC,GAAG,EAAEV,KAAK,CAACW,OAAO,CAAC,GAAG;MAAE,CAAE;MAAAH,QAAA,GAC/Cd,KAAK,IAAI,IAAI,iBACZL,IAAA,CAACN,IAAI;QACHU,OAAO,EAAEP,UAAU,CAAC0B,SAAU;QAC9BC,MAAM,EAAE3B,UAAU,CAAC4B,WAAY;QAC/BhB,KAAK,EAAE;UAAEiB,KAAK,EAAEb,MAAM,CAACc,UAAU,CAACD;QAAM,CAAE;QAAAP,QAAA,EAEzCd;MAAK,CACF,CACP,eACDL,IAAA,CAACN,IAAI;QAACU,OAAO,EAAEP,UAAU,CAAC+B,WAAY;QAACnB,KAAK,EAAE;UAAEiB,KAAK,EAAEb,MAAM,CAACgB,YAAY,CAACH;QAAM,CAAE;QAAAP,QAAA,EAChFb;MAAO,CACJ,CAAC;IAAA,CACH,CAAC,EACNE,OAAO,IAAI,IAAI;IAAA;IACd;IACAR,IAAA,CAACR,SAAS;MACRsC,OAAO,EAAEtB,OAAQ;MACjBO,iBAAiB,EAAC,QAAQ;MAC1BgB,kBAAkB,EAAC,oBAAK;MACxBC,OAAO,EAAE,EAAG;MACZvB,KAAK,EAAE;QAAEwB,QAAQ,EAAE,EAAE;QAAEC,SAAS,EAAE,EAAE;QAAEC,UAAU,EAAE,QAAQ;QAAEC,cAAc,EAAE;MAAS,CAAE;MAAAjB,QAAA,eAEvFnB,IAAA,CAACN,IAAI;QAACU,OAAO,EAAC,IAAI;QAACK,KAAK,EAAE;UAAEiB,KAAK,EAAEb,MAAM,CAACgB,YAAY,CAACH;QAAM,CAAE;QAAAP,QAAA,EAAC;MAEhE,CAAM;IAAC,CACE,CACZ;EAAA,CACG,CAAC;AAEX;;AAEA;AACAhB,KAAK,CAACkC,UAAU,GAAGzC,SAAS,CAAC0C,KAAK","ignoreList":[]}