@oxy.so/bloom 7.15.0 → 7.16.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 (271) hide show
  1. package/docs/accordion.mdx +38 -1
  2. package/docs/adoption-matrix.mdx +7 -7
  3. package/docs/rating.mdx +18 -0
  4. package/docs/stat-bar.mdx +1 -0
  5. package/lib/commonjs/accordion/Accordion.js +60 -78
  6. package/lib/commonjs/accordion/Accordion.js.map +1 -1
  7. package/lib/commonjs/accordion/Accordion.web.js +193 -0
  8. package/lib/commonjs/accordion/Accordion.web.js.map +1 -0
  9. package/lib/commonjs/accordion/context.js +21 -0
  10. package/lib/commonjs/accordion/context.js.map +1 -0
  11. package/lib/commonjs/accordion/index.js +1 -1
  12. package/lib/commonjs/accordion/index.web.js +31 -0
  13. package/lib/commonjs/accordion/index.web.js.map +1 -0
  14. package/lib/commonjs/accordion/use-accordion.js +82 -0
  15. package/lib/commonjs/accordion/use-accordion.js.map +1 -0
  16. package/lib/commonjs/booking/BookingCard.js +2 -2
  17. package/lib/commonjs/booking/BookingCard.js.map +1 -1
  18. package/lib/commonjs/carrier-quote/CarrierQuoteCard.js +11 -11
  19. package/lib/commonjs/carrier-quote/CarrierQuoteCard.js.map +1 -1
  20. package/lib/commonjs/cart-panel/CartPanel.js +5 -5
  21. package/lib/commonjs/cart-panel/CartPanel.js.map +1 -1
  22. package/lib/commonjs/creator-studio/TrackUploadRow.js +10 -10
  23. package/lib/commonjs/creator-studio/TrackUploadRow.js.map +1 -1
  24. package/lib/commonjs/index.js +839 -839
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/index.web.js +906 -906
  27. package/lib/commonjs/index.web.js.map +1 -1
  28. package/lib/commonjs/lead-score/LeadScoreCard.js +10 -10
  29. package/lib/commonjs/lead-score/LeadScoreCard.js.map +1 -1
  30. package/lib/commonjs/listing-actions/ApplicationChecklist.js +7 -7
  31. package/lib/commonjs/listing-actions/ApplicationChecklist.js.map +1 -1
  32. package/lib/commonjs/listing-card/ListingCard.js +25 -25
  33. package/lib/commonjs/listing-card/ListingCard.js.map +1 -1
  34. package/lib/commonjs/listing-details/ListingHeader.js +8 -8
  35. package/lib/commonjs/listing-details/ListingHeader.js.map +1 -1
  36. package/lib/commonjs/listing-details/ReviewSummary.js +8 -8
  37. package/lib/commonjs/listing-details/ReviewSummary.js.map +1 -1
  38. package/lib/commonjs/listing-editor/ListingQualityMeter.js +10 -10
  39. package/lib/commonjs/listing-editor/ListingQualityMeter.js.map +1 -1
  40. package/lib/commonjs/map-marker/MapListingPreview.js +9 -9
  41. package/lib/commonjs/map-marker/MapListingPreview.js.map +1 -1
  42. package/lib/commonjs/media-card/parts.js +2 -2
  43. package/lib/commonjs/media-card/parts.js.map +1 -1
  44. package/lib/commonjs/media-header/AudiobookHeader.js +6 -6
  45. package/lib/commonjs/media-header/AudiobookHeader.js.map +1 -1
  46. package/lib/commonjs/media-header/PodcastShowHeader.js +8 -8
  47. package/lib/commonjs/media-header/PodcastShowHeader.js.map +1 -1
  48. package/lib/commonjs/media-header/parts.js +11 -11
  49. package/lib/commonjs/media-header/parts.js.map +1 -1
  50. package/lib/commonjs/order-status/OrderStatusBar.js +6 -6
  51. package/lib/commonjs/order-status/OrderStatusBar.js.map +1 -1
  52. package/lib/commonjs/outline-nav/OutlineNav.js +5 -5
  53. package/lib/commonjs/outline-nav/OutlineNav.js.map +1 -1
  54. package/lib/commonjs/place-card/PlaceCard.js +21 -21
  55. package/lib/commonjs/place-card/PlaceCard.js.map +1 -1
  56. package/lib/commonjs/place-details/PlaceHours.js +12 -12
  57. package/lib/commonjs/place-details/PlaceHours.js.map +1 -1
  58. package/lib/commonjs/place-reviews/PlaceReviewCard.js +9 -9
  59. package/lib/commonjs/place-reviews/PlaceReviewCard.js.map +1 -1
  60. package/lib/commonjs/property-insights/NeighbourhoodScores.js +10 -10
  61. package/lib/commonjs/property-insights/NeighbourhoodScores.js.map +1 -1
  62. package/lib/commonjs/property-insights/PricePerAreaComparison.js +5 -5
  63. package/lib/commonjs/property-insights/PricePerAreaComparison.js.map +1 -1
  64. package/lib/commonjs/rating/Rating.js +7 -4
  65. package/lib/commonjs/rating/Rating.js.map +1 -1
  66. package/lib/commonjs/rating/RatingBar.js +23 -12
  67. package/lib/commonjs/rating/RatingBar.js.map +1 -1
  68. package/lib/commonjs/rating/RatingBar.web.js +74 -0
  69. package/lib/commonjs/rating/RatingBar.web.js.map +1 -0
  70. package/lib/commonjs/rating/index.js +1 -1
  71. package/lib/commonjs/rating/index.web.js +27 -0
  72. package/lib/commonjs/rating/index.web.js.map +1 -0
  73. package/lib/commonjs/stat-bar/Meter.js +9 -2
  74. package/lib/commonjs/stat-bar/Meter.js.map +1 -1
  75. package/lib/commonjs/stat-bar/Meter.web.js +79 -0
  76. package/lib/commonjs/stat-bar/Meter.web.js.map +1 -0
  77. package/lib/commonjs/stat-bar/StatBar.js +1 -1
  78. package/lib/commonjs/stat-bar/index.js +1 -1
  79. package/lib/commonjs/stat-bar/index.web.js +46 -0
  80. package/lib/commonjs/stat-bar/index.web.js.map +1 -0
  81. package/lib/commonjs/styles/resolve-native-web-style.js +50 -0
  82. package/lib/commonjs/styles/resolve-native-web-style.js.map +1 -0
  83. package/lib/commonjs/tenancy/parts.js +5 -5
  84. package/lib/commonjs/tenancy/parts.js.map +1 -1
  85. package/lib/commonjs/track-list/EpisodeRow.js +9 -9
  86. package/lib/commonjs/track-list/EpisodeRow.js.map +1 -1
  87. package/lib/commonjs/vendor-card/VendorCard.js +11 -11
  88. package/lib/commonjs/vendor-card/VendorCard.js.map +1 -1
  89. package/lib/commonjs/wizard/WizardProgress.js +6 -6
  90. package/lib/commonjs/wizard/WizardProgress.js.map +1 -1
  91. package/lib/module/accordion/Accordion.js +58 -76
  92. package/lib/module/accordion/Accordion.js.map +1 -1
  93. package/lib/module/accordion/Accordion.web.js +188 -0
  94. package/lib/module/accordion/Accordion.web.js.map +1 -0
  95. package/lib/module/accordion/context.js +17 -0
  96. package/lib/module/accordion/context.js.map +1 -0
  97. package/lib/module/accordion/index.js +1 -1
  98. package/lib/module/accordion/index.js.map +1 -1
  99. package/lib/module/accordion/index.web.js +9 -0
  100. package/lib/module/accordion/index.web.js.map +1 -0
  101. package/lib/module/accordion/use-accordion.js +76 -0
  102. package/lib/module/accordion/use-accordion.js.map +1 -0
  103. package/lib/module/booking/BookingCard.js +1 -1
  104. package/lib/module/booking/BookingCard.js.map +1 -1
  105. package/lib/module/carrier-quote/CarrierQuoteCard.js +1 -1
  106. package/lib/module/carrier-quote/CarrierQuoteCard.js.map +1 -1
  107. package/lib/module/cart-panel/CartPanel.js +1 -1
  108. package/lib/module/cart-panel/CartPanel.js.map +1 -1
  109. package/lib/module/creator-studio/TrackUploadRow.js +1 -1
  110. package/lib/module/creator-studio/TrackUploadRow.js.map +1 -1
  111. package/lib/module/index.js +3 -3
  112. package/lib/module/index.js.map +1 -1
  113. package/lib/module/index.web.js +3 -3
  114. package/lib/module/index.web.js.map +1 -1
  115. package/lib/module/lead-score/LeadScoreCard.js +1 -1
  116. package/lib/module/lead-score/LeadScoreCard.js.map +1 -1
  117. package/lib/module/listing-actions/ApplicationChecklist.js +1 -1
  118. package/lib/module/listing-actions/ApplicationChecklist.js.map +1 -1
  119. package/lib/module/listing-card/ListingCard.js +1 -1
  120. package/lib/module/listing-card/ListingCard.js.map +1 -1
  121. package/lib/module/listing-details/ListingHeader.js +1 -1
  122. package/lib/module/listing-details/ListingHeader.js.map +1 -1
  123. package/lib/module/listing-details/ReviewSummary.js +1 -1
  124. package/lib/module/listing-details/ReviewSummary.js.map +1 -1
  125. package/lib/module/listing-editor/ListingQualityMeter.js +1 -1
  126. package/lib/module/listing-editor/ListingQualityMeter.js.map +1 -1
  127. package/lib/module/map-marker/MapListingPreview.js +1 -1
  128. package/lib/module/map-marker/MapListingPreview.js.map +1 -1
  129. package/lib/module/media-card/parts.js +1 -1
  130. package/lib/module/media-card/parts.js.map +1 -1
  131. package/lib/module/media-header/AudiobookHeader.js +1 -1
  132. package/lib/module/media-header/AudiobookHeader.js.map +1 -1
  133. package/lib/module/media-header/PodcastShowHeader.js +1 -1
  134. package/lib/module/media-header/PodcastShowHeader.js.map +1 -1
  135. package/lib/module/media-header/parts.js +1 -1
  136. package/lib/module/media-header/parts.js.map +1 -1
  137. package/lib/module/order-status/OrderStatusBar.js +1 -1
  138. package/lib/module/order-status/OrderStatusBar.js.map +1 -1
  139. package/lib/module/outline-nav/OutlineNav.js +1 -1
  140. package/lib/module/outline-nav/OutlineNav.js.map +1 -1
  141. package/lib/module/place-card/PlaceCard.js +1 -1
  142. package/lib/module/place-card/PlaceCard.js.map +1 -1
  143. package/lib/module/place-details/PlaceHours.js +1 -1
  144. package/lib/module/place-details/PlaceHours.js.map +1 -1
  145. package/lib/module/place-reviews/PlaceReviewCard.js +1 -1
  146. package/lib/module/place-reviews/PlaceReviewCard.js.map +1 -1
  147. package/lib/module/property-insights/NeighbourhoodScores.js +1 -1
  148. package/lib/module/property-insights/NeighbourhoodScores.js.map +1 -1
  149. package/lib/module/property-insights/PricePerAreaComparison.js +1 -1
  150. package/lib/module/property-insights/PricePerAreaComparison.js.map +1 -1
  151. package/lib/module/rating/Rating.js +7 -4
  152. package/lib/module/rating/Rating.js.map +1 -1
  153. package/lib/module/rating/RatingBar.js +19 -8
  154. package/lib/module/rating/RatingBar.js.map +1 -1
  155. package/lib/module/rating/RatingBar.web.js +69 -0
  156. package/lib/module/rating/RatingBar.web.js.map +1 -0
  157. package/lib/module/rating/index.js +1 -1
  158. package/lib/module/rating/index.js.map +1 -1
  159. package/lib/module/rating/index.web.js +11 -0
  160. package/lib/module/rating/index.web.js.map +1 -0
  161. package/lib/module/stat-bar/Meter.js +9 -2
  162. package/lib/module/stat-bar/Meter.js.map +1 -1
  163. package/lib/module/stat-bar/Meter.web.js +74 -0
  164. package/lib/module/stat-bar/Meter.web.js.map +1 -0
  165. package/lib/module/stat-bar/StatBar.js +1 -1
  166. package/lib/module/stat-bar/StatBar.js.map +1 -1
  167. package/lib/module/stat-bar/index.js +1 -1
  168. package/lib/module/stat-bar/index.js.map +1 -1
  169. package/lib/module/stat-bar/index.web.js +12 -0
  170. package/lib/module/stat-bar/index.web.js.map +1 -0
  171. package/lib/module/styles/resolve-native-web-style.js +47 -0
  172. package/lib/module/styles/resolve-native-web-style.js.map +1 -0
  173. package/lib/module/tenancy/parts.js +1 -1
  174. package/lib/module/tenancy/parts.js.map +1 -1
  175. package/lib/module/track-list/EpisodeRow.js +1 -1
  176. package/lib/module/track-list/EpisodeRow.js.map +1 -1
  177. package/lib/module/vendor-card/VendorCard.js +1 -1
  178. package/lib/module/vendor-card/VendorCard.js.map +1 -1
  179. package/lib/module/wizard/WizardProgress.js +1 -1
  180. package/lib/module/wizard/WizardProgress.js.map +1 -1
  181. package/lib/typescript/commonjs/accordion/Accordion.d.ts +15 -4
  182. package/lib/typescript/commonjs/accordion/Accordion.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/accordion/Accordion.web.d.ts +7 -0
  184. package/lib/typescript/commonjs/accordion/Accordion.web.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/accordion/context.d.ts +16 -0
  186. package/lib/typescript/commonjs/accordion/context.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/accordion/index.d.ts +1 -1
  188. package/lib/typescript/commonjs/accordion/index.d.ts.map +1 -1
  189. package/lib/typescript/commonjs/accordion/index.web.d.ts +3 -0
  190. package/lib/typescript/commonjs/accordion/index.web.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/accordion/types.d.ts +15 -0
  192. package/lib/typescript/commonjs/accordion/types.d.ts.map +1 -1
  193. package/lib/typescript/commonjs/accordion/use-accordion.d.ts +18 -0
  194. package/lib/typescript/commonjs/accordion/use-accordion.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/index.web.d.ts +5 -5
  196. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  197. package/lib/typescript/commonjs/rating/Rating.d.ts +1 -1
  198. package/lib/typescript/commonjs/rating/Rating.d.ts.map +1 -1
  199. package/lib/typescript/commonjs/rating/RatingBar.d.ts +11 -3
  200. package/lib/typescript/commonjs/rating/RatingBar.d.ts.map +1 -1
  201. package/lib/typescript/commonjs/rating/RatingBar.web.d.ts +4 -0
  202. package/lib/typescript/commonjs/rating/RatingBar.web.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/rating/index.web.d.ts +5 -0
  204. package/lib/typescript/commonjs/rating/index.web.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/rating/types.d.ts +11 -0
  206. package/lib/typescript/commonjs/rating/types.d.ts.map +1 -1
  207. package/lib/typescript/commonjs/stat-bar/Meter.d.ts +7 -25
  208. package/lib/typescript/commonjs/stat-bar/Meter.d.ts.map +1 -1
  209. package/lib/typescript/commonjs/stat-bar/Meter.web.d.ts +4 -0
  210. package/lib/typescript/commonjs/stat-bar/Meter.web.d.ts.map +1 -0
  211. package/lib/typescript/commonjs/stat-bar/index.web.d.ts +7 -0
  212. package/lib/typescript/commonjs/stat-bar/index.web.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/stat-bar/types.d.ts +4 -0
  214. package/lib/typescript/commonjs/stat-bar/types.d.ts.map +1 -1
  215. package/lib/typescript/commonjs/styles/resolve-native-web-style.d.ts +5 -0
  216. package/lib/typescript/commonjs/styles/resolve-native-web-style.d.ts.map +1 -0
  217. package/lib/typescript/module/accordion/Accordion.d.ts +15 -4
  218. package/lib/typescript/module/accordion/Accordion.d.ts.map +1 -1
  219. package/lib/typescript/module/accordion/Accordion.web.d.ts +7 -0
  220. package/lib/typescript/module/accordion/Accordion.web.d.ts.map +1 -0
  221. package/lib/typescript/module/accordion/context.d.ts +16 -0
  222. package/lib/typescript/module/accordion/context.d.ts.map +1 -0
  223. package/lib/typescript/module/accordion/index.d.ts +1 -1
  224. package/lib/typescript/module/accordion/index.d.ts.map +1 -1
  225. package/lib/typescript/module/accordion/index.web.d.ts +3 -0
  226. package/lib/typescript/module/accordion/index.web.d.ts.map +1 -0
  227. package/lib/typescript/module/accordion/types.d.ts +15 -0
  228. package/lib/typescript/module/accordion/types.d.ts.map +1 -1
  229. package/lib/typescript/module/accordion/use-accordion.d.ts +18 -0
  230. package/lib/typescript/module/accordion/use-accordion.d.ts.map +1 -0
  231. package/lib/typescript/module/index.web.d.ts +5 -5
  232. package/lib/typescript/module/index.web.d.ts.map +1 -1
  233. package/lib/typescript/module/rating/Rating.d.ts +1 -1
  234. package/lib/typescript/module/rating/Rating.d.ts.map +1 -1
  235. package/lib/typescript/module/rating/RatingBar.d.ts +11 -3
  236. package/lib/typescript/module/rating/RatingBar.d.ts.map +1 -1
  237. package/lib/typescript/module/rating/RatingBar.web.d.ts +4 -0
  238. package/lib/typescript/module/rating/RatingBar.web.d.ts.map +1 -0
  239. package/lib/typescript/module/rating/index.web.d.ts +5 -0
  240. package/lib/typescript/module/rating/index.web.d.ts.map +1 -0
  241. package/lib/typescript/module/rating/types.d.ts +11 -0
  242. package/lib/typescript/module/rating/types.d.ts.map +1 -1
  243. package/lib/typescript/module/stat-bar/Meter.d.ts +7 -25
  244. package/lib/typescript/module/stat-bar/Meter.d.ts.map +1 -1
  245. package/lib/typescript/module/stat-bar/Meter.web.d.ts +4 -0
  246. package/lib/typescript/module/stat-bar/Meter.web.d.ts.map +1 -0
  247. package/lib/typescript/module/stat-bar/index.web.d.ts +7 -0
  248. package/lib/typescript/module/stat-bar/index.web.d.ts.map +1 -0
  249. package/lib/typescript/module/stat-bar/types.d.ts +4 -0
  250. package/lib/typescript/module/stat-bar/types.d.ts.map +1 -1
  251. package/lib/typescript/module/styles/resolve-native-web-style.d.ts +5 -0
  252. package/lib/typescript/module/styles/resolve-native-web-style.d.ts.map +1 -0
  253. package/package.json +16 -1
  254. package/src/accordion/Accordion.tsx +34 -94
  255. package/src/accordion/Accordion.web.tsx +91 -0
  256. package/src/accordion/context.ts +15 -0
  257. package/src/accordion/index.ts +1 -0
  258. package/src/accordion/index.web.ts +14 -0
  259. package/src/accordion/types.ts +15 -0
  260. package/src/accordion/use-accordion.ts +47 -0
  261. package/src/index.web.ts +5 -5
  262. package/src/rating/Rating.tsx +7 -4
  263. package/src/rating/RatingBar.tsx +10 -5
  264. package/src/rating/RatingBar.web.tsx +29 -0
  265. package/src/rating/index.web.ts +17 -0
  266. package/src/rating/types.ts +11 -0
  267. package/src/stat-bar/Meter.tsx +6 -4
  268. package/src/stat-bar/Meter.web.tsx +32 -0
  269. package/src/stat-bar/index.web.ts +20 -0
  270. package/src/stat-bar/types.ts +4 -0
  271. package/src/styles/resolve-native-web-style.ts +41 -0
@@ -1,28 +1,10 @@
1
1
  import React from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
2
3
  import type { AnyMeterProps } from './types';
3
- /**
4
- * ONE determinate bar. Every progress bar in Bloom is this one.
5
- *
6
- * track `height` tall (6), radius `height / 2`, `neutral-200` (dark
7
- * `neutral-700`), clipping its fill
8
- * fill `value / max` of the width, the accent, the same radius
9
- *
10
- * It draws NOTHING else — no label, no value, no footer. A bar with a label is
11
- * `StatBar`; a bar inside a card is that card's business. What this owns is the
12
- * geometry, the two colours and the accessibility, which is the part every
13
- * hand-rolled copy got subtly differently.
14
- *
15
- * Accessibility: a `progressbar` named by `accessibilityLabel`, with the FLAT
16
- * `aria-value*` props — react-native-web drops the `accessibilityValue` object
17
- * entirely, so a bar setting only that announces its role and no value, while
18
- * React Native folds the flat props back into `accessibilityValue` and native
19
- * is unchanged. `valueText` carries the reading ("4 of 5"), since a bare number
20
- * is announced as a percentage.
21
- *
22
- * A bar that is one SEGMENT of a larger progressbar passes `decorative` and
23
- * gets no role at all — two nested progressbars announce the measurement twice.
24
- */
25
- declare function MeterComponent(props: AnyMeterProps): import("react/jsx-runtime").JSX.Element;
26
- export declare const Meter: React.MemoExoticComponent<typeof MeterComponent>;
27
- export {};
4
+ export declare const Meter: React.MemoExoticComponent<(props: import("react-native-css").StyledProps<AnyMeterProps & {
5
+ fillStyle?: StyleProp<ViewStyle>;
6
+ }, {
7
+ readonly className: "style";
8
+ readonly fillClassName: "fillStyle";
9
+ }>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>>;
28
10
  //# sourceMappingURL=Meter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Meter.d.ts","sourceRoot":"","sources":["../../../../src/stat-bar/Meter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAaxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,cAAc,CAAC,KAAK,EAAE,aAAa,2CA2E3C;AAED,eAAO,MAAM,KAAK,kDAAuB,CAAC"}
1
+ {"version":3,"file":"Meter.d.ts","sourceRoot":"","sources":["../../../../src/stat-bar/Meter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmC,MAAM,OAAO,CAAC;AAExD,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAY9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAsG7C,eAAO,MAAM,KAAK;gBA9E2C,SAAS,CAAC,SAAS,CAAC;;;;8FA8EoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { AnyMeterProps } from './types';
3
+ export declare const Meter: React.NamedExoticComponent<AnyMeterProps>;
4
+ //# sourceMappingURL=Meter.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meter.web.d.ts","sourceRoot":"","sources":["../../../../src/stat-bar/Meter.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAKpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAS7C,eAAO,MAAM,KAAK,2CAiBhB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { Meter } from './Meter.web';
2
+ export { MeterRing } from './MeterRing';
3
+ export { StatBar } from './StatBar';
4
+ export { meterFraction, meterValue, resolveMeterColors } from './shared';
5
+ export type { MeterColors } from './shared';
6
+ export type { AnyMeterProps, MeterDecorativeProps, MeterProps, MeterRingProps, StatBarProps, StatBarProgressProps, StatBarSplitProps, StatBarVariant, } from './types';
7
+ //# sourceMappingURL=index.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/stat-bar/index.web.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACzE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAC"}
@@ -59,6 +59,10 @@ export interface StatBarSplitProps extends StatBarBaseProps {
59
59
  }
60
60
  export type StatBarProps = StatBarProgressProps | StatBarSplitProps;
61
61
  interface MeterGeometryProps {
62
+ /** Classes on the track. Unclaimed properties retain the normal Meter defaults. */
63
+ className?: string;
64
+ /** Classes on the fill. Width continues to represent value/max. */
65
+ fillClassName?: string;
62
66
  /** Current value. Clamped into `[0, max]`; `NaN` reads as empty. */
63
67
  value: number;
64
68
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/stat-bar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,cAAc,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AC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,UAAU,EAAE,IAAI,CAAC;IACjB,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAE9D,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,uEAAuE;IACvE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,5 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ /** Preserve RN-style overrides when a family moves from RNW hosts to DOM hosts. */
4
+ export declare function resolveNativeWebStyle(style: StyleProp<ViewStyle | TextStyle>): CSSProperties;
5
+ //# sourceMappingURL=resolve-native-web-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-native-web-style.d.ts","sourceRoot":"","sources":["../../../../src/styles/resolve-native-web-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,aAAa,CAmC5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/bloom",
3
- "version": "7.15.0",
3
+ "version": "7.16.0",
4
4
  "packageManager": "bun@1.3.14",
5
5
  "description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
6
6
  "main": "lib/commonjs/index.js",
@@ -1530,6 +1530,11 @@
1530
1530
  "types": "./lib/typescript/module/stat-bar/index.d.ts",
1531
1531
  "default": "./src/stat-bar/index.ts"
1532
1532
  },
1533
+ "browser": {
1534
+ "types": "./lib/typescript/module/stat-bar/index.web.d.ts",
1535
+ "import": "./lib/module/stat-bar/index.web.js",
1536
+ "require": "./lib/commonjs/stat-bar/index.web.js"
1537
+ },
1533
1538
  "import": {
1534
1539
  "types": "./lib/typescript/module/stat-bar/index.d.ts",
1535
1540
  "default": "./lib/module/stat-bar/index.js"
@@ -2005,6 +2010,11 @@
2005
2010
  "types": "./lib/typescript/module/rating/index.d.ts",
2006
2011
  "default": "./src/rating/index.ts"
2007
2012
  },
2013
+ "browser": {
2014
+ "types": "./lib/typescript/module/rating/index.web.d.ts",
2015
+ "import": "./lib/module/rating/index.web.js",
2016
+ "require": "./lib/commonjs/rating/index.web.js"
2017
+ },
2008
2018
  "import": {
2009
2019
  "types": "./lib/typescript/module/rating/index.d.ts",
2010
2020
  "default": "./lib/module/rating/index.js"
@@ -3158,6 +3168,11 @@
3158
3168
  "types": "./lib/typescript/module/accordion/index.d.ts",
3159
3169
  "default": "./src/accordion/index.ts"
3160
3170
  },
3171
+ "browser": {
3172
+ "types": "./lib/typescript/module/accordion/index.web.d.ts",
3173
+ "import": "./lib/module/accordion/index.web.js",
3174
+ "require": "./lib/commonjs/accordion/index.web.js"
3175
+ },
3161
3176
  "import": {
3162
3177
  "types": "./lib/typescript/module/accordion/index.d.ts",
3163
3178
  "default": "./lib/module/accordion/index.js"
@@ -1,11 +1,7 @@
1
1
  import React, {
2
- createContext,
3
2
  memo,
4
3
  useCallback,
5
4
  useContext,
6
- useEffect,
7
- useMemo,
8
- useRef,
9
5
  useState,
10
6
  } from 'react';
11
7
  import {
@@ -14,86 +10,37 @@ import {
14
10
  Pressable,
15
11
  Animated,
16
12
  type LayoutChangeEvent,
17
- type ViewStyle,
13
+ StyleSheet,
14
+ type TextStyle,
18
15
  } from 'react-native';
19
16
 
20
17
  import { RiArrowDownSLine as ChevronBottomIcon } from '../icons/remix/RiArrowDownSLine';
21
18
  import { useTheme } from '../theme/use-theme';
22
19
  import { useInteractionState } from '../hooks/use-interaction-state';
23
- import { DISABLED_OPACITY, animation, borderRadius, space } from '../styles/tokens';
20
+ import { DISABLED_OPACITY, space } from '../styles/tokens';
24
21
  import { SUPPORTS_NATIVE_DRIVER } from '../styles/native-driver';
22
+ import { styled } from 'react-native-css';
23
+ import { AccordionContext, AccordionItemContext } from './context';
24
+ import { useAccordionState, useAccordionItem, useAccordionMotion } from './use-accordion';
25
25
  import type {
26
26
  AccordionProps,
27
27
  AccordionItemProps,
28
28
  AccordionTriggerProps,
29
29
  AccordionContentProps,
30
- AccordionType,
31
30
  } from './types';
32
31
 
33
- // ---- Context ----
34
-
35
- interface AccordionContextValue {
36
- expandedValues: Set<string>;
37
- toggle: (value: string) => void;
38
- type: AccordionType;
39
- }
40
-
41
- const AccordionContext = createContext<AccordionContextValue>({
42
- expandedValues: new Set(),
43
- toggle: () => {},
44
- type: 'single',
45
- });
46
-
47
- interface AccordionItemContextValue {
48
- value: string;
49
- isExpanded: boolean;
50
- disabled: boolean;
51
- }
52
-
53
- const AccordionItemContext = createContext<AccordionItemContextValue>({
54
- value: '',
55
- isExpanded: false,
56
- disabled: false,
57
- });
58
-
59
32
  // ---- Accordion Root ----
60
33
 
61
34
  const AccordionComponent: React.FC<AccordionProps> = ({
62
35
  value,
63
36
  onValueChange,
64
37
  type = 'single',
38
+ transition,
65
39
  children,
66
40
  style,
67
41
  testID,
68
42
  }) => {
69
- const expandedValues = useMemo(() => {
70
- if (value == null) return new Set<string>();
71
- if (Array.isArray(value)) return new Set(value);
72
- return new Set([value]);
73
- }, [value]);
74
-
75
- const toggle = useCallback(
76
- (itemValue: string) => {
77
- if (type === 'single') {
78
- const next = expandedValues.has(itemValue) ? undefined : itemValue;
79
- onValueChange(next);
80
- } else {
81
- const next = new Set(expandedValues);
82
- if (next.has(itemValue)) {
83
- next.delete(itemValue);
84
- } else {
85
- next.add(itemValue);
86
- }
87
- onValueChange(Array.from(next));
88
- }
89
- },
90
- [type, expandedValues, onValueChange],
91
- );
92
-
93
- const contextValue = useMemo(
94
- () => ({ expandedValues, toggle, type }),
95
- [expandedValues, toggle, type],
96
- );
43
+ const contextValue = useAccordionState({ value, onValueChange, type, transition, children });
97
44
 
98
45
  return (
99
46
  <AccordionContext.Provider value={contextValue}>
@@ -112,15 +59,9 @@ const AccordionItemComponent: React.FC<AccordionItemProps> = ({
112
59
  disabled = false,
113
60
  style,
114
61
  }) => {
115
- const { expandedValues } = useContext(AccordionContext);
116
- const isExpanded = expandedValues.has(value);
62
+ const itemContext = useAccordionItem(value, disabled);
117
63
  const theme = useTheme();
118
64
 
119
- const itemContext = useMemo(
120
- () => ({ value, isExpanded, disabled }),
121
- [value, isExpanded, disabled],
122
- );
123
-
124
65
  return (
125
66
  <AccordionItemContext.Provider value={itemContext}>
126
67
  <View
@@ -151,22 +92,19 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
151
92
  }) => {
152
93
  const theme = useTheme();
153
94
  const { toggle } = useContext(AccordionContext);
154
- const { value, isExpanded, disabled } = useContext(AccordionItemContext);
155
- const rotateAnim = useRef(new Animated.Value(isExpanded ? 1 : 0)).current;
95
+ const { value, isExpanded, disabled, triggerId, contentId } = useContext(AccordionItemContext);
96
+ const rotateAnim = useAccordionMotion(isExpanded, 'trigger', SUPPORTS_NATIVE_DRIVER);
97
+ const resolved = StyleSheet.flatten(style) as TextStyle | undefined;
98
+ const callerText: TextStyle = {};
99
+ for (const key of ['color', 'fontSize', 'fontWeight', 'fontFamily', 'lineHeight', 'letterSpacing'] as const) {
100
+ if (resolved?.[key] !== undefined) Object.assign(callerText, { [key]: resolved[key] });
101
+ }
156
102
  // Drive press-opacity via state, not Pressable's function-form `style`,
157
103
  // which NativeWind v4's css-interop swallows (dropping the trigger's base
158
104
  // layout: flexDirection, padding, gap).
159
105
  const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
160
106
  useInteractionState();
161
107
 
162
- useEffect(() => {
163
- Animated.spring(rotateAnim, {
164
- toValue: isExpanded ? 1 : 0,
165
- useNativeDriver: SUPPORTS_NATIVE_DRIVER,
166
- ...animation.spring.snappy,
167
- }).start();
168
- }, [isExpanded, rotateAnim]);
169
-
170
108
  const handlePress = useCallback(() => {
171
109
  if (!disabled) {
172
110
  toggle(value);
@@ -180,6 +118,8 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
180
118
 
181
119
  return (
182
120
  <Pressable
121
+ nativeID={triggerId}
122
+ {...{ 'aria-controls': contentId }}
183
123
  style={[
184
124
  {
185
125
  flexDirection: 'row',
@@ -217,6 +157,7 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
217
157
  fontWeight: '600',
218
158
  color: theme.colors.text,
219
159
  },
160
+ callerText,
220
161
  textStyle,
221
162
  ]}
222
163
  >
@@ -235,12 +176,13 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
235
176
 
236
177
  // ---- Accordion Content ----
237
178
 
238
- const AccordionContentComponent: React.FC<AccordionContentProps> = ({
179
+ const AccordionContentComponent: React.FC<AccordionContentProps & { contentStyle?: AccordionContentProps['style'] }> = ({
239
180
  children,
240
181
  style,
182
+ contentStyle,
241
183
  }) => {
242
- const { isExpanded } = useContext(AccordionItemContext);
243
- const heightAnim = useRef(new Animated.Value(isExpanded ? 1 : 0)).current;
184
+ const { isExpanded, contentId, triggerId } = useContext(AccordionItemContext);
185
+ const heightAnim = useAccordionMotion(isExpanded, 'content', false);
244
186
  // The content's own height, measured. The reveal used to interpolate to a
245
187
  // hardcoded 500 ("reasonable max"), which is not a max at all: `overflow:
246
188
  // hidden` above it meant anything taller was CLIPPED, silently, with no error
@@ -254,14 +196,6 @@ const AccordionContentComponent: React.FC<AccordionContentProps> = ({
254
196
  setContentHeight((prev) => (Math.abs(prev - next) > 0.5 ? next : prev));
255
197
  }, []);
256
198
 
257
- useEffect(() => {
258
- Animated.spring(heightAnim, {
259
- toValue: isExpanded ? 1 : 0,
260
- useNativeDriver: false,
261
- ...animation.spring.gentle,
262
- }).start();
263
- }, [isExpanded, heightAnim]);
264
-
265
199
  const opacity = heightAnim.interpolate({
266
200
  inputRange: [0, 1],
267
201
  outputRange: [0, 1],
@@ -274,6 +208,12 @@ const AccordionContentComponent: React.FC<AccordionContentProps> = ({
274
208
 
275
209
  return (
276
210
  <Animated.View
211
+ nativeID={contentId}
212
+ {...{ 'aria-labelledby': triggerId }}
213
+ aria-hidden={!isExpanded}
214
+ pointerEvents={isExpanded ? 'auto' : 'none'}
215
+ accessibilityElementsHidden={!isExpanded}
216
+ importantForAccessibility={isExpanded ? 'auto' : 'no-hide-descendants'}
277
217
  style={[
278
218
  {
279
219
  overflow: 'hidden',
@@ -289,7 +229,7 @@ const AccordionContentComponent: React.FC<AccordionContentProps> = ({
289
229
  >
290
230
  <View
291
231
  onLayout={handleContentLayout}
292
- style={{ paddingBottom: space.md, paddingHorizontal: space.xs }}
232
+ style={[{ paddingBottom: space.md, paddingLeft: space.xs, paddingRight: space.xs }, contentStyle]}
293
233
  >
294
234
  {children}
295
235
  </View>
@@ -297,14 +237,14 @@ const AccordionContentComponent: React.FC<AccordionContentProps> = ({
297
237
  );
298
238
  };
299
239
 
300
- export const Accordion = memo(AccordionComponent);
240
+ export const Accordion = memo(styled(AccordionComponent, { className: 'style' }));
301
241
  Accordion.displayName = 'Accordion';
302
242
 
303
- export const AccordionItem = memo(AccordionItemComponent);
243
+ export const AccordionItem = memo(styled(AccordionItemComponent, { className: 'style' }));
304
244
  AccordionItem.displayName = 'AccordionItem';
305
245
 
306
- export const AccordionTrigger = memo(AccordionTriggerComponent);
246
+ export const AccordionTrigger = memo(styled(AccordionTriggerComponent, { className: 'style' }));
307
247
  AccordionTrigger.displayName = 'AccordionTrigger';
308
248
 
309
- export const AccordionContent = memo(AccordionContentComponent);
249
+ export const AccordionContent = memo(styled(AccordionContentComponent, { className: 'style', contentClassName: 'contentStyle' }));
310
250
  AccordionContent.displayName = 'AccordionContent';
@@ -0,0 +1,91 @@
1
+ import React, { forwardRef, memo, useContext, useLayoutEffect, useRef, useState } from 'react';
2
+ import { Animated, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { RiArrowDownSLine } from '../icons/remix/RiArrowDownSLine';
4
+ import { resolveNativeWebStyle } from '../styles/resolve-native-web-style';
5
+ import { useInteractiveWebCss } from '../styles/interactive-web-css';
6
+ import { useTheme } from '../theme/use-theme';
7
+ import { AccordionContext, AccordionItemContext } from './context';
8
+ import { useAccordionState, useAccordionItem, useAccordionMotion } from './use-accordion';
9
+ import type { AccordionProps, AccordionItemProps, AccordionTriggerProps, AccordionContentProps } from './types';
10
+
11
+ const CSS = `@layer base {
12
+ .bloom-accordion-root,.bloom-accordion-item,.bloom-accordion-panel,.bloom-accordion-body { box-sizing:border-box; display:flex; flex-direction:column; flex-shrink:0; min-width:0; }
13
+ .bloom-accordion-item { border:0 solid var(--bloom-accordion-border); border-bottom-width:1px; }
14
+ .bloom-accordion-trigger { box-sizing:border-box; flex-shrink:0; min-width:0; display:flex; align-items:center; gap:8px; padding:12px 4px; border:0; margin:0; background:transparent; color:var(--bloom-accordion-text); text-align:start; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif; line-height:normal; font-size:15px; font-weight:600; cursor:pointer; }
15
+ .bloom-accordion-trigger:active:not(:disabled) { opacity:.7; }
16
+ .bloom-accordion-trigger:disabled { opacity:.5; cursor:default; }
17
+ .bloom-accordion-label { white-space:pre-wrap; overflow-wrap:break-word; flex-grow:1; flex-shrink:1; min-width:0; }
18
+ .bloom-accordion-panel { overflow:hidden; }
19
+ .bloom-accordion-body { padding:0 4px 12px; }
20
+ }`;
21
+ function useStyles() { useInteractiveWebCss('bloom-accordion', CSS); }
22
+
23
+ /** RN Animated resolves numeric layout/opacity before this DOM host receives them. */
24
+ const PanelHost = forwardRef<HTMLDivElement, Omit<React.HTMLAttributes<HTMLDivElement>, 'style'> & { style?: StyleProp<ViewStyle> }>(function PanelHost({ style, ...props }, ref) {
25
+ return <div {...props} ref={ref} style={resolveNativeWebStyle(style)} />;
26
+ });
27
+ const AnimatedPanel = Animated.createAnimatedComponent(PanelHost);
28
+
29
+ export const Accordion = memo(function Accordion(props: AccordionProps) {
30
+ useStyles();
31
+ const state = useAccordionState(props);
32
+ return <AccordionContext.Provider value={state}>
33
+ <div className={['bloom-accordion-root', props.className].filter(Boolean).join(' ')} style={resolveNativeWebStyle(props.style)} data-testid={props.testID}>{props.children}</div>
34
+ </AccordionContext.Provider>;
35
+ });
36
+
37
+ export const AccordionItem = memo(function AccordionItem({ value, disabled = false, children, style, className }: AccordionItemProps) {
38
+ useStyles();
39
+ const state = useAccordionItem(value, disabled);
40
+ const theme = useTheme();
41
+ const vars = { '--bloom-accordion-border': theme.colors.borderLight } as React.CSSProperties;
42
+ return <AccordionItemContext.Provider value={state}>
43
+ <div className={['bloom-accordion-item', className].filter(Boolean).join(' ')} style={{ ...vars, ...resolveNativeWebStyle(style) }}>{children}</div>
44
+ </AccordionItemContext.Provider>;
45
+ });
46
+
47
+ export const AccordionTrigger = memo(function AccordionTrigger({ children, icon, style, textStyle, className }: AccordionTriggerProps) {
48
+ useStyles();
49
+ const theme = useTheme();
50
+ const { toggle } = useContext(AccordionContext);
51
+ const { value, isExpanded, disabled, triggerId, contentId } = useContext(AccordionItemContext);
52
+ const progress = useAccordionMotion(isExpanded, 'trigger', false);
53
+ const rotation = progress.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '180deg'] });
54
+ const vars = { '--bloom-accordion-text': theme.colors.text } as React.CSSProperties;
55
+ return <button type="button" id={triggerId} aria-expanded={isExpanded} aria-controls={contentId} disabled={disabled}
56
+ className={['bloom-accordion-trigger', className].filter(Boolean).join(' ')} style={{ ...vars, ...resolveNativeWebStyle(style) }}
57
+ onClick={() => toggle(value)}>
58
+ {icon}
59
+ <span className="bloom-accordion-label" data-testid="accordion-trigger-label" style={resolveNativeWebStyle(textStyle)}>{children}</span>
60
+ <Animated.View aria-hidden style={{ transform: [{ rotate: rotation }] }}><RiArrowDownSLine size="sm" fill={theme.colors.textSecondary} /></Animated.View>
61
+ </button>;
62
+ });
63
+
64
+ export const AccordionContent = memo(function AccordionContent({ children, style, className, contentClassName }: AccordionContentProps) {
65
+ useStyles();
66
+ const { isExpanded, triggerId, contentId } = useContext(AccordionItemContext);
67
+ const progress = useAccordionMotion(isExpanded, 'content', false);
68
+ const body = useRef<HTMLDivElement>(null);
69
+ const panel = useRef<HTMLDivElement>(null);
70
+ const [height, setHeight] = useState(0);
71
+ useLayoutEffect(() => {
72
+ const node = body.current;
73
+ if (!node) return;
74
+ const measure = () => {
75
+ const next = node.getBoundingClientRect().height;
76
+ setHeight(previous => Math.abs(previous - next) > .5 ? next : previous);
77
+ };
78
+ measure();
79
+ const observer = new ResizeObserver(measure); observer.observe(node);
80
+ return () => observer.disconnect();
81
+ }, []);
82
+ useLayoutEffect(() => {
83
+ if (!isExpanded && panel.current?.contains(document.activeElement)) document.getElementById(triggerId)?.focus();
84
+ }, [isExpanded, triggerId]);
85
+ const maxHeight = progress.interpolate({ inputRange: [0, 1], outputRange: [0, height] });
86
+ return <AnimatedPanel ref={panel} id={contentId} role="region" aria-labelledby={triggerId} aria-hidden={!isExpanded} inert={!isExpanded}
87
+ className={['bloom-accordion-panel', className].filter(Boolean).join(' ')}
88
+ style={[{ opacity: progress, maxHeight: height === 0 && isExpanded ? undefined : maxHeight }, style]}>
89
+ <div ref={body} className={['bloom-accordion-body', contentClassName].filter(Boolean).join(' ')}>{children}</div>
90
+ </AnimatedPanel>;
91
+ });
@@ -0,0 +1,15 @@
1
+ import { createContext } from 'react';
2
+ import type { AccordionTransition, AccordionType } from './types';
3
+
4
+ export interface AccordionContextValue {
5
+ expandedValues: Set<string>;
6
+ toggle: (value: string) => void;
7
+ type: AccordionType;
8
+ transition: AccordionTransition;
9
+ }
10
+ export const AccordionContext = createContext<AccordionContextValue>({
11
+ expandedValues: new Set(), toggle: () => {}, type: 'single', transition: 'spring',
12
+ });
13
+ export const AccordionItemContext = createContext({
14
+ value: '', isExpanded: false, disabled: false, triggerId: '', contentId: '',
15
+ });
@@ -5,4 +5,5 @@ export type {
5
5
  AccordionTriggerProps,
6
6
  AccordionContentProps,
7
7
  AccordionType,
8
+ AccordionTransition,
8
9
  } from './types';
@@ -0,0 +1,14 @@
1
+ // AUTO-GENERATED by scripts/generate-platform-exports.mjs — DO NOT EDIT.
2
+ // Source of truth: src/accordion/index.ts.
3
+ // Re-run `bun run generate:exports` (or any `bun run build`) after
4
+ // changing that barrel or the set of web-forked subpaths.
5
+
6
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './Accordion.web';
7
+ export type {
8
+ AccordionProps,
9
+ AccordionItemProps,
10
+ AccordionTriggerProps,
11
+ AccordionContentProps,
12
+ AccordionType,
13
+ AccordionTransition,
14
+ } from './types';
@@ -1,6 +1,13 @@
1
1
  import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
2
2
 
3
3
  export type AccordionType = 'single' | 'multiple';
4
+ /** Preserve the default springs, or opt into a shared timed reveal/chevron curve. */
5
+ export type AccordionTransition = 'spring' | {
6
+ /** Non-negative duration in milliseconds. Zero settles immediately. */
7
+ duration: number;
8
+ /** CSS cubic-bezier control points; x coordinates must be in 0..1. Default ease. */
9
+ easing?: readonly [number, number, number, number];
10
+ };
4
11
 
5
12
  export interface AccordionProps {
6
13
  /** Controls which items are expanded. For 'single' type, pass a string or undefined.
@@ -10,8 +17,11 @@ export interface AccordionProps {
10
17
  onValueChange: (value: string | string[] | undefined) => void;
11
18
  /** Whether only one item can be expanded at a time. */
12
19
  type?: AccordionType;
20
+ /** OS reduced motion always settles immediately, including live changes. */
21
+ transition?: AccordionTransition;
13
22
  /** Accordion items. */
14
23
  children: React.ReactNode;
24
+ className?: string;
15
25
  style?: StyleProp<ViewStyle>;
16
26
  testID?: string;
17
27
  }
@@ -23,6 +33,7 @@ export interface AccordionItemProps {
23
33
  children: React.ReactNode;
24
34
  /** Whether this item is disabled. */
25
35
  disabled?: boolean;
36
+ className?: string;
26
37
  style?: StyleProp<ViewStyle>;
27
38
  }
28
39
 
@@ -31,12 +42,16 @@ export interface AccordionTriggerProps {
31
42
  children: React.ReactNode;
32
43
  /** Icon to show on the left side. */
33
44
  icon?: React.ReactNode;
45
+ className?: string;
34
46
  style?: StyleProp<ViewStyle>;
35
47
  textStyle?: StyleProp<TextStyle>;
36
48
  }
37
49
 
38
50
  export interface AccordionContentProps {
51
+ /** Classes for the measured body, including its default content padding. */
52
+ contentClassName?: string;
39
53
  /** Content to show when expanded. */
40
54
  children: React.ReactNode;
55
+ className?: string;
41
56
  style?: StyleProp<ViewStyle>;
42
57
  }
@@ -0,0 +1,47 @@
1
+ import { useCallback, useContext, useLayoutEffect, useId, useMemo, useRef } from 'react';
2
+ import { Animated, Easing } from 'react-native';
3
+ import { usePrefersReducedMotion } from '../hooks/use-prefers-reduced-motion';
4
+ import { animation } from '../styles/tokens';
5
+ import { AccordionContext } from './context';
6
+ import type { AccordionProps } from './types';
7
+
8
+ export function useAccordionState({ value, onValueChange, type = 'single', transition = 'spring' }: AccordionProps) {
9
+ const expandedValues = useMemo(() => new Set(value == null ? [] : Array.isArray(value) ? value : [value]), [value]);
10
+ const toggle = useCallback((item: string) => {
11
+ if (type === 'single') onValueChange(expandedValues.has(item) ? undefined : item);
12
+ else {
13
+ const next = new Set(expandedValues);
14
+ if (next.has(item)) next.delete(item); else next.add(item);
15
+ onValueChange([...next]);
16
+ }
17
+ }, [expandedValues, onValueChange, type]);
18
+ return useMemo(() => ({ expandedValues, toggle, type, transition }), [expandedValues, toggle, type, transition]);
19
+ }
20
+
21
+ export function useAccordionItem(value: string, disabled: boolean) {
22
+ const { expandedValues } = useContext(AccordionContext);
23
+ const id = useId();
24
+ const isExpanded = expandedValues.has(value);
25
+ return useMemo(() => ({ value, disabled, isExpanded, triggerId: `${id}-trigger`, contentId: `${id}-content` }), [value, disabled, isExpanded, id]);
26
+ }
27
+
28
+ /** One motion policy for both forks, including a live OS preference change. */
29
+ export function useAccordionMotion(expanded: boolean, kind: 'trigger' | 'content', useNativeDriver: boolean) {
30
+ const { transition } = useContext(AccordionContext);
31
+ const reduced = usePrefersReducedMotion();
32
+ const progress = useRef(new Animated.Value(expanded ? 1 : 0)).current;
33
+ const duration = transition === 'spring' ? undefined : transition.duration;
34
+ const [x1, y1, x2, y2] = transition === 'spring' || !transition.easing ? [.25, .1, .25, 1] : transition.easing;
35
+ const easing = useMemo(() => Easing.bezier(x1, y1, x2, y2), [x1, y1, x2, y2]);
36
+ useLayoutEffect(() => {
37
+ progress.stopAnimation();
38
+ const toValue = expanded ? 1 : 0;
39
+ if (reduced || duration === 0) { progress.setValue(toValue); return; }
40
+ const motion = duration === undefined
41
+ ? Animated.spring(progress, { toValue, useNativeDriver, ...animation.spring[kind === 'trigger' ? 'snappy' : 'gentle'] })
42
+ : Animated.timing(progress, { toValue, useNativeDriver, duration: Math.max(0, duration), easing });
43
+ motion.start();
44
+ return () => motion.stop();
45
+ }, [expanded, progress, reduced, duration, easing, kind, useNativeDriver]);
46
+ return progress;
47
+ }